Skip to content

Commit

Permalink
Merge branch 'develop' into release/1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dinhlongviolin1 committed Jun 20, 2023
2 parents 82612ad + 3c7b38a commit 40dd1e7
Show file tree
Hide file tree
Showing 4 changed files with 257 additions and 6 deletions.
250 changes: 250 additions & 0 deletions src/assets/viselements.json
Original file line number Diff line number Diff line change
Expand Up @@ -1091,6 +1091,239 @@
}
]
}
],
[
"scenario_selector",
{
"inherits": [
"core_gui_shared"
],
"properties": [
{
"name": "value",
"default_property": true,
"type": "dynamic(Scenario)",
"doc": "Bound to the selected <code>Scenario^</code>, or None if there is none."
},
{
"name": "show_add_button",
"type": "bool",
"default_value": "True",
"doc": "If False, the button to create a new scenario is not displayed."
},
{
"name": "display_cycles",
"type": "bool",
"default_value": "True",
"doc": "If False, the cycles are not shown."
},
{
"name": "show_primary_flag",
"type": "bool",
"default_value": "True",
"doc": "If False, the primary scenarios are not identified with specific visual hint."
},
{
"name": "on_change",
"type": "Callback",
"doc": "The name of a function that is triggered when the value is updated.<br/>The parameters of that function are all optional:\n<ul>\n<li>state (<code>State^</code>): the state instance.</li>\n<li>var_name (str): the variable name.</li>\n<li>value (<code>Scenario^</code>): the selected scenario.</li>\n</ul>",
"signature": [
[
"state",
"State"
],
[
"var_name",
"str"
],
[
"value",
"optional[Scenario]"
]
]
},
{
"name": "height",
"type": "str",
"default_value": "50vh",
"doc": "The maximum height, in CSS units, of the tree."
}
]
}
],
[
"scenario",
{
"inherits": [
"core_gui_shared"
],
"properties": [
{
"name": "scenario",
"default_property": true,
"type": "dynamic(Scenario|list[Scenario])",
"doc": "The scenario to display and edit.<br/>If the value is a list, it must have a single element otherwise nothing is shown."
},
{
"name": "active",
"type": "dynamic(bool)",
"default_value": "True",
"doc": "Indicates if this component is active.<br/>An inactive component allows no user interaction."
},
{
"name": "expandable",
"type": "bool",
"default_value": "True",
"doc": "If True, the scenario visualizer can be expanded.<br/>If False, the scenario visualizer is always collapsed and only its name and the <i>submit</i> button are visible."
},
{
"name": "expanded",
"type": "dynamic(bool)",
"default_value": "True",
"doc": "If True, the scenario visualizer is expanded, and its content is displayed.<br/>If False, the scenario visualizer is collapsed and only its name a <i>submit</i> button are visible."
},
{
"name": "show_submit",
"type": "bool",
"default_value": "True",
"doc": "If False, the scenario submit button is not visible."
},
{
"name": "show_delete",
"type": "bool",
"default_value": "True",
"doc": "If False, the button to delete a scenario is not visible."
},
{
"name": "show_config",
"type": "bool",
"default_value": "False",
"doc": "If False, the scenario configuration label is not visible."
},
{
"name": "show_cycle",
"type": "bool",
"default_value": "False",
"doc": "If False, the scenario cycle label is not visible."
},
{
"name": "show_tags",
"type": "bool",
"default_value": "False",
"doc": "If False, the scenario tags are not visible."
},
{
"name": "show_properties",
"type": "bool",
"default_value": "True",
"doc": "If False, the scenario properties are not visible."
},
{
"name": "show_pipelines",
"type": "bool",
"default_value": "True",
"doc": "If False, the scenario pipelines are not visible."
},
{
"name": "show_submit_pipelines",
"type": "bool",
"default_value": "True",
"doc": "If False, the buttons to submit scenario pipelines are not visible."
}
]
}
],
[
"scenario_dag",
{
"inherits": [
"core_gui_shared"
],
"properties": [
{
"name": "scenario",
"type": "dynamic(Scenario|list[Scenario])",
"doc": "The <code>Scenario^</code> whose diagram is displayed.<br/>If the value is a list, it must have a single element otherwise nothing is shown."
},
{
"name": "render",
"type": "dynamic(bool)",
"default_value": "True",
"doc": "If False, this scenario's DAG is not displayed."
},
{
"name": "show_toolbar",
"type": "bool",
"default_value": "True",
"doc": "If False, the DAG toolbar is not visible."
},
{
"name": "height",
"type": "str",
"default_value": "50vh",
"doc": "The maximum height, in CSS units, of the DAG."
},
{
"name": "width",
"type": "str",
"default_value": "100%",
"doc": "The maximum width, in CSS units, of the DAG."
}
]
}
],
[
"data_node_selector",
{
"inherits": [
"core_gui_shared"
],
"properties": [
{
"name": "value",
"default_property": true,
"type": "dynamic(DataNode|list[DataNode])",
"doc": "Bound to the selected <code>DataNode^</code>(s), or None if there is none."
},
{
"name": "display_cycles",
"type": "bool",
"default_value": "True",
"doc": "If False, the cycles are now shown in the selector."
},
{
"name": "show_primary_flag",
"type": "bool",
"default_value": "True",
"doc": "If False, the primary scenarios are not identified with specific visual hint."
},
{
"name": "on_change",
"type": "callback",
"doc": "The name of a function that is triggered when the selection is updated.<br/>The parameters of that function are all optional:\n<ul>\n<li>state (<code>State^</code>): the state instance.</li>\n<li>var_name (str): the variable name.</li>\n<li>value (<code>DataNode^</code>): the selected data node.</li>\n</ul>",
"signature": [
[
"state",
"State"
],
[
"var_name",
"str"
],
[
"value",
"optional[DataNode]"
]
]
},
{
"name": "height",
"type": "str",
"default_value": "50vh",
"doc": "The maximum height, in CSS units,of the tree."
}
]
}
]
],
"blocks": [
Expand Down Expand Up @@ -1382,6 +1615,23 @@
}
]
}
],
[
"core_gui_shared",
{
"properties": [
{
"name": "id",
"type": "str",
"doc": "The identifier that will be assigned to the rendered HTML component."
},
{
"name": "class_name",
"type": "dynamic(str)",
"doc": "The list of CSS class names that will be associated with the generated HTML Element.<br/>These class names will be added to the default <code>taipy_gui_core-&lt;element_type&gt;</code>."
}
]
}
]
]
}
5 changes: 3 additions & 2 deletions src/gui/completion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export class GuiCompletionItemProvider implements CompletionItemProvider {
private async getCommonCompletion(document: TextDocument, linePrefix: string): Promise<CompletionItem[]> {
if (linePrefix.endsWith("|")) {
const foundElements = ElementProvider.getElementList().reduce((p: string[], c: string) => {
linePrefix.includes(`|${c}`) && p.push(c);
linePrefix.includes(`|${c}|`) && p.push(c);
return p;
}, []);
// element type completion
Expand All @@ -135,7 +135,8 @@ export class GuiCompletionItemProvider implements CompletionItemProvider {
if (properties !== undefined) {
return Object.keys(properties)
.reduce((p: string[], c: string) => {
!linePrefix.includes(`|${c}`) && p.push(c);
const PROP_MATCH = new RegExp(`\\|((?:don'?t|not)\\s+)?${c}\\s*(?:=(.*))?((?:\\|)?)`);
!PROP_MATCH.test(linePrefix) && p.push(c);
return p;
}, [])
.map((v) => {
Expand Down
2 changes: 1 addition & 1 deletion src/gui/diagnostics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ export const processElement = (

const propNameMatch = PROPERTY_NAME_RE.exec(propMatch[2]);
const propName = propNameMatch ? propNameMatch[1] : propMatch[2];
const val = propMatch[3];
const val = propMatch[3] || "";
const validPropertyList = Object.keys(ElementProvider.getElementProperties()[e.type] || []);
if (validPropertyList.length !== 0 && !validPropertyList.includes(propName)) {
const bestMatch = findBestMatch(propName, validPropertyList).bestMatch;
Expand Down
6 changes: 3 additions & 3 deletions src/markdownIt/ruleCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export const getTokenAttribute = (name: string, value: string): [string, string]
const getOpeningToken = (content: string, tokenClass: typeof Token): Token[] => {
let tokenNodes: Token[] = [],
lastPos = 0;
content.replace(REPLACE_OPENING_TAG_RE, (match: string, offset: number): string => {
content.replace(REPLACE_OPENING_TAG_RE, (match: string, _p1: string, _p2: string, offset: number): string => {
const regexMatchResult = OPENING_TAG_RE.exec(match);
if (offset > lastPos) {
let token = new tokenClass("text", "", 0);
Expand Down Expand Up @@ -122,7 +122,7 @@ const getOpeningToken = (content: string, tokenClass: typeof Token): Token[] =>
const getControlToken = (content: string, tokenClass: typeof Token): Token[] => {
let tokenNodes: Token[] = [],
lastPos = 0;
content.replace(REPLACE_CONTROL_RE, (match: string, offset: number): string => {
content.replace(REPLACE_CONTROL_RE, (match: string, _p1: string, offset: number): string => {
const regexMatchResult = CONTROL_RE.exec(match);
if (offset > lastPos) {
let token = new tokenClass("text", "", 0);
Expand Down Expand Up @@ -151,7 +151,7 @@ const getControlToken = (content: string, tokenClass: typeof Token): Token[] =>
const getClosingToken = (content: string, tag: string, tokenClass: typeof Token): Token[] => {
let tokenNodes: Token[] = [],
lastPos = 0;
content.replace(REPLACE_CLOSING_TAG_RE, (match: string, offset: number): string => {
content.replace(REPLACE_CLOSING_TAG_RE, (match: string, _p1: string, offset: number): string => {
if (offset > lastPos) {
let token = new tokenClass("text", "", 0);
token.content = content.slice(lastPos, offset);
Expand Down

0 comments on commit 40dd1e7

Please sign in to comment.