@node-projects/web-component-designer-visualization-addons 0.1.151 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/BindingsEditor.js +2 -2
- package/dist/components/BindingsEditorHelp.d.ts +1 -1
- package/dist/components/BindingsEditorHelp.js +8 -4
- package/dist/components/EventAssignment.d.ts +1 -0
- package/dist/components/EventAssignment.js +5 -2
- package/dist/helpers/BindingsHelper.d.ts +25 -13
- package/dist/helpers/BindingsHelper.js +602 -605
- package/dist/index-min.js +56 -56
- package/dist/services/VisualizationBindingsRefactorService.js +20 -23
- package/package.json +1 -1
- package/tests/BindingsHelper.test.ts +527 -0
|
@@ -9,7 +9,7 @@ export class BindingsEditor extends BaseCustomWebComponentConstructorAppend {
|
|
|
9
9
|
<div id="full-width-col">
|
|
10
10
|
<div id="signals-area">
|
|
11
11
|
<div class="row">
|
|
12
|
-
<span class="section-label" title="Add signals by name and path. The variable name is used in the formula (__0, __1,... or a custom name).
Access signal
|
|
12
|
+
<span class="section-label" title="Add signals by name and path. The variable name is used in the formula (__0, __1,... or a custom name).
Access signal names in properties via ?propertyName and #propertyName, property values via ??propertyName and ##propertyName, and signal objects stored in properties via ?$propertyName and #$propertyName.
Access screen attributes via ?@attributeName and target attributes via #@attributeName.
Resolve a named signal object via $objectId.
Bind to special values via §name (if supported by your framework).
You could also use signals inside of a Signal Name via {name}">objects</span>
|
|
13
13
|
<button id="helpBtn" class="info-btn" title="Help"><svg viewBox="0 0 512 512" width="16" height="16"><path d="M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM216 336h24V272H216c-13.3 0-24-10.7-24-24s10.7-24 24-24h48c13.3 0 24 10.7 24 24v88h8c13.3 0 24 10.7 24 24s-10.7 24-24 24H216c-13.3 0-24-10.7-24-24s10.7-24 24-24zm40-208a32 32 0 1 1 0 64 32 32 0 1 1 0-64z"/></svg></button>
|
|
14
14
|
</div>
|
|
15
15
|
<div class="bordered-section">
|
|
@@ -454,7 +454,7 @@ export class BindingsEditor extends BaseCustomWebComponentConstructorAppend {
|
|
|
454
454
|
signalInput.className = 'signal-path-input';
|
|
455
455
|
signalInput.value = sig.signal;
|
|
456
456
|
signalInput.placeholder = 'signal path';
|
|
457
|
-
signalInput.title = 'signal path (prefix: ? =
|
|
457
|
+
signalInput.title = 'signal path (prefix: ? = signal name in screen property, ?? = screen property value, ?$ = signal object in screen property, ?@ = screen attribute, # = signal name in target property, ## = target property value, #$ = signal object in target property, #@ = target attribute)';
|
|
458
458
|
signalInput.oninput = () => {
|
|
459
459
|
this._signals[i].signal = signalInput.value;
|
|
460
460
|
this._syncSignals();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const bindingsEditorHelpHtml = "<!DOCTYPE html>\n<html>\n<head>\n<meta charset=\"UTF-8\">\n<style>\n:root { --accent: #2c6e9b; }\n\n*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }\n\nhtml, body {\n width: 100%;\n height: 100%;\n font-family: Segoe UI, Arial, sans-serif;\n font-size: 13px;\n color: #333;\n background: #f0f1f3;\n}\n\n.content {\n height: 100%;\n overflow-y: auto;\n padding: 10px 14px 16px;\n display: flex;\n flex-direction: column;\n gap: 12px;\n}\n\n.intro-banner {\n background: #ffffff;\n border-left: 4px solid var(--accent);\n border-radius: 4px;\n padding: 8px 12px;\n font-size: 12px;\n line-height: 1.5;\n}\n\n.intro-banner code {\n font-family: Consolas, monospace;\n background: #eef2f6;\n padding: 1px 4px;\n border-radius: 3px;\n color: #2c4a68;\n}\n\n.content-section {\n background: #ffffff;\n border-radius: 6px;\n padding: 8px 10px 10px;\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n\n.section-title {\n display: flex;\n align-items: baseline;\n gap: 8px;\n border-bottom: 2px solid var(--accent);\n font-size: 13px;\n font-weight: bold;\n padding-bottom: 4px;\n color: #24405c;\n}\n\n.section-num {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 18px;\n height: 18px;\n border-radius: 50%;\n background: var(--accent);\n color: white;\n font-size: 10px;\n font-weight: bold;\n flex-shrink: 0;\n}\n\n.section-hint {\n font-size: 11px;\n font-weight: normal;\n color: #808080;\n}\n\n.snippet {\n font-family: Consolas, \"Courier New\", monospace;\n font-size: 11px;\n background: #f6f8fa;\n color: #24292e;\n border: 1px solid #e1e4e8;\n border-radius: 4px;\n padding: 6px 10px;\n white-space: pre;\n overflow-x: auto;\n line-height: 1.6;\n}\n\n.ref-table {\n width: 100%;\n border-collapse: collapse;\n font-size: 12px;\n}\n\n.ref-table th {\n text-align: left;\n font-weight: 600;\n color: #24405c;\n border-bottom: 1px solid #d0d7de;\n padding: 4px 6px;\n}\n\n.ref-table td {\n padding: 3px 6px;\n border-bottom: 1px solid #f0f0f0;\n vertical-align: top;\n}\n\n.ref-table tr:last-child td { border-bottom: none; }\n\n.ref-table td:first-child {\n font-family: Consolas, monospace;\n color: #005cc5;\n white-space: nowrap;\n width: 110px;\n}\n\n.note {\n font-size: 11px;\n color: #666;\n font-style: italic;\n}\n\ncode {\n font-family: Consolas, monospace;\n background: #eef2f6;\n padding: 1px 4px;\n border-radius: 3px;\n color: #2c4a68;\n font-size: 11px;\n}\n</style>\n</head>\n<body>\n<div class=\"content\">\n\n <div class=\"intro-banner\">\n A <strong>Binding</strong> connects one or more signals to a property of an element.<br>\n An optional <strong>formula</strong> transforms the signal values before they are applied.\n A <strong>converter</strong> maps the final value to a display value.\n </div>\n\n <div class=\"content-section\">\n <div class=\"section-title\"><span class=\"section-num\">1</span> Signals (Objects) <span class=\"section-hint\">what data to read</span></div>\n <div class=\"note\" style=\"margin-bottom:2px;\">Each row adds one signal. The <em>name</em> column sets the variable name used in the formula.</div>\n <pre class=\"snippet\"><span style=\"color:#6a737d;font-style:italic\">// name column empty \u2192 variable is __0, __1, __2 \u2026 (positional)</span>\n<span style=\"color:#6a737d;font-style:italic\">// name column filled \u2192 variable uses that name in the formula</span>\n\n<span style=\"color:#005cc5\">name</span>: mySpeed <span style=\"color:#005cc5\">signal</span>: .Drive.Speed \u2192 accessible as mySpeed\n<span style=\"color:#005cc5\">name</span>: (empty) <span style=\"color:#005cc5\">signal</span>: .Drive.Active \u2192 accessible as __1 (second row)</pre>\n <div class=\"note\">Multiple signals let you combine values in a formula, e.g. <code>__0 > 0 && __1</code>.</div>\n </div>\n\n <div class=\"content-section\">\n <div class=\"section-title\"><span class=\"section-num\">2</span> Signal path prefixes & special paths <span class=\"section-hint\">special access modes</span></div>\n <table class=\"ref-table\">\n <tr><th>Prefix / Pattern</th><th>What it accesses</th></tr>\n <tr><td>(none)</td><td>The signal's current value directly</td></tr>\n <tr><td>__name</td><td>Internal screen variable \u2014 local to the current screen, not connected to any external data source. Initial value is <code>null</code>. Useful for screen-local state like tab selection or panel visibility.</td></tr>\n <tr><td>?name</td><td>A property of the signal object itself (e.g. <code>?quality</code> \u2192 signal quality)</td></tr>\n <tr><td>??name</td><td>The value of a property of the signal object</td></tr>\n <tr><td>#name</td><td>A property of the bound target element</td></tr>\n <tr><td>##name</td><td>The current value of a property of the bound target element</td></tr>\n <tr><td>$objectId</td><td>The entire signal configuration object (meta-data)</td></tr>\n <tr><td>\u00A7name</td><td>A special framework-provided value (if supported)</td></tr>\n <tr><td>{name}</td><td>Dynamic signal path: embed another signal's value inside the path, e.g. <code>.Plant.{.ActiveLine}.Speed</code></td></tr>\n </table>\n </div>\n\n <div class=\"content-section\">\n <div class=\"section-title\"><span class=\"section-num\">3</span> Formula <span class=\"section-hint\">transform signal values with JavaScript</span></div>\n <div class=\"note\" style=\"margin-bottom:2px;\">Leave the formula empty to pass the first signal's value through unchanged.</div>\n <pre class=\"snippet\"><span style=\"color:#6a737d;font-style:italic\">// Access signal values by position or by name:</span>\n__0 * 100 <span style=\"color:#6a737d;font-style:italic\">// first signal \u00D7 100</span>\n__0 > 0 && __1 <span style=\"color:#6a737d;font-style:italic\">// combine two signals</span>\nspeed > limit <span style=\"color:#6a737d;font-style:italic\">// named variables</span>\n\n<span style=\"color:#6a737d;font-style:italic\">// Special variables available in the formula:</span>\n__ctx <span style=\"color:#6a737d;font-style:italic\">// the full binding context object</span>\n__res <span style=\"color:#6a737d;font-style:italic\">// the result of the previous evaluation</span></pre>\n <div class=\"note\">The formula must be a single JavaScript expression that returns a value (no <code>return</code> statement needed).</div>\n </div>\n\n <div class=\"content-section\">\n <div class=\"section-title\"><span class=\"section-num\">4</span> Write Back & Two-Way <span class=\"section-hint\">send values back to signals</span></div>\n <pre class=\"snippet\"><span style=\"color:#6a737d;font-style:italic\">// Write back signal</span>\n<span style=\"color:#6a737d;font-style:italic\">// \u2192 writes the formula result back to a signal whenever</span>\n<span style=\"color:#6a737d;font-style:italic\">// the element property changes (useful for derived values)</span>\n\n<span style=\"color:#6a737d;font-style:italic\">// Two-Way binding</span>\n<span style=\"color:#6a737d;font-style:italic\">// \u2192 also sets the signal when the element fires a DOM event</span>\n<span style=\"color:#6a737d;font-style:italic\">// (e.g. \"change\" for inputs). Enable \"events\" to configure</span>\n<span style=\"color:#6a737d;font-style:italic\">// which events trigger the write-back.</span>\n<span style=\"color:#6a737d;font-style:italic\">// \u2192 \"formula write back\" applies a reverse transformation</span>\n<span style=\"color:#6a737d;font-style:italic\">// before writing (useful when the formula changes the scale)</span></pre>\n <div class=\"note\">Two-Way is only available for <em>property</em> and <em>attribute</em> targets. Separate multiple event names with a semicolon.</div>\n </div>\n\n <div class=\"content-section\">\n <div class=\"section-title\"><span class=\"section-num\">5</span> Converter <span class=\"section-hint\">map values to display values</span></div>\n <div class=\"note\" style=\"margin-bottom:4px;\">Use the table to map specific conditions to output values. The <em>condition</em> column supports several matching modes:</div>\n <table class=\"ref-table\">\n <tr><th>Condition key</th><th>Matches when \u2026</th></tr>\n <tr><td>true / false</td><td>Signal value equals the boolean</td></tr>\n <tr><td>42</td><td>Signal value equals the number exactly</td></tr>\n <tr><td>running</td><td>Signal value equals the string \"running\"</td></tr>\n <tr><td>>10</td><td>Signal value is greater than 10</td></tr>\n <tr><td>>=5</td><td>Signal value is \u2265 5</td></tr>\n <tr><td><3</td><td>Signal value is < 3</td></tr>\n <tr><td>10-20</td><td>Signal value is in the range 10 \u2026 20 (inclusive)</td></tr>\n <tr><td>default</td><td>Fallback when no other key matches</td></tr>\n </table>\n <div class=\"note\" style=\"margin-top:4px;\">The value column supports template literals \u2014 use <code>${value}</code> to embed the original signal value in the output string.</div>\n <div class=\"note\" style=\"margin-top:4px;\"><strong>Named converter:</strong> enter a converter name in the <em>converter</em> field above the table to use a pre-registered converter instead of the inline table.</div>\n </div>\n\n</div>\n</body>\n</html>";
|
|
1
|
+
export declare const bindingsEditorHelpHtml = "<!DOCTYPE html>\n<html>\n<head>\n<meta charset=\"UTF-8\">\n<style>\n:root { --accent: #2c6e9b; }\n\n*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }\n\nhtml, body {\n width: 100%;\n height: 100%;\n font-family: Segoe UI, Arial, sans-serif;\n font-size: 13px;\n color: #333;\n background: #f0f1f3;\n}\n\n.content {\n height: 100%;\n overflow-y: auto;\n padding: 10px 14px 16px;\n display: flex;\n flex-direction: column;\n gap: 12px;\n}\n\n.intro-banner {\n background: #ffffff;\n border-left: 4px solid var(--accent);\n border-radius: 4px;\n padding: 8px 12px;\n font-size: 12px;\n line-height: 1.5;\n}\n\n.intro-banner code {\n font-family: Consolas, monospace;\n background: #eef2f6;\n padding: 1px 4px;\n border-radius: 3px;\n color: #2c4a68;\n}\n\n.content-section {\n background: #ffffff;\n border-radius: 6px;\n padding: 8px 10px 10px;\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n\n.section-title {\n display: flex;\n align-items: baseline;\n gap: 8px;\n border-bottom: 2px solid var(--accent);\n font-size: 13px;\n font-weight: bold;\n padding-bottom: 4px;\n color: #24405c;\n}\n\n.section-num {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 18px;\n height: 18px;\n border-radius: 50%;\n background: var(--accent);\n color: white;\n font-size: 10px;\n font-weight: bold;\n flex-shrink: 0;\n}\n\n.section-hint {\n font-size: 11px;\n font-weight: normal;\n color: #808080;\n}\n\n.snippet {\n font-family: Consolas, \"Courier New\", monospace;\n font-size: 11px;\n background: #f6f8fa;\n color: #24292e;\n border: 1px solid #e1e4e8;\n border-radius: 4px;\n padding: 6px 10px;\n white-space: pre;\n overflow-x: auto;\n line-height: 1.6;\n}\n\n.ref-table {\n width: 100%;\n border-collapse: collapse;\n font-size: 12px;\n}\n\n.ref-table th {\n text-align: left;\n font-weight: 600;\n color: #24405c;\n border-bottom: 1px solid #d0d7de;\n padding: 4px 6px;\n}\n\n.ref-table td {\n padding: 3px 6px;\n border-bottom: 1px solid #f0f0f0;\n vertical-align: top;\n}\n\n.ref-table tr:last-child td { border-bottom: none; }\n\n.ref-table td:first-child {\n font-family: Consolas, monospace;\n color: #005cc5;\n white-space: nowrap;\n width: 110px;\n}\n\n.note {\n font-size: 11px;\n color: #666;\n font-style: italic;\n}\n\ncode {\n font-family: Consolas, monospace;\n background: #eef2f6;\n padding: 1px 4px;\n border-radius: 3px;\n color: #2c4a68;\n font-size: 11px;\n}\n</style>\n</head>\n<body>\n<div class=\"content\">\n\n <div class=\"intro-banner\">\n A <strong>Binding</strong> connects one or more signals to a property of an element.<br>\n An optional <strong>formula</strong> transforms the signal values before they are applied.\n A <strong>converter</strong> maps the final value to a display value.\n </div>\n\n <div class=\"content-section\">\n <div class=\"section-title\"><span class=\"section-num\">1</span> Signals (Objects) <span class=\"section-hint\">what data to read</span></div>\n <div class=\"note\" style=\"margin-bottom:2px;\">Each row adds one signal. The <em>name</em> column sets the variable name used in the formula.</div>\n <pre class=\"snippet\"><span style=\"color:#6a737d;font-style:italic\">// name column empty \u2192 variable is __0, __1, __2 \u2026 (positional)</span>\n<span style=\"color:#6a737d;font-style:italic\">// name column filled \u2192 variable uses that name in the formula</span>\n\n<span style=\"color:#005cc5\">name</span>: mySpeed <span style=\"color:#005cc5\">signal</span>: .Drive.Speed \u2192 accessible as mySpeed\n<span style=\"color:#005cc5\">name</span>: (empty) <span style=\"color:#005cc5\">signal</span>: .Drive.Active \u2192 accessible as __1 (second row)</pre>\n <div class=\"note\">Multiple signals let you combine values in a formula, e.g. <code>__0 > 0 && __1</code>.</div>\n </div>\n\n <div class=\"content-section\">\n <div class=\"section-title\"><span class=\"section-num\">2</span> Signal path prefixes & special paths <span class=\"section-hint\">special access modes</span></div>\n <table class=\"ref-table\">\n <tr><th>Prefix / Pattern</th><th>What it accesses</th></tr>\n <tr><td>(none)</td><td>The signal's current value directly</td></tr>\n <tr><td>__name</td><td>Internal screen variable \u2014 local to the current screen, not connected to any external data source. Initial value is <code>null</code>. Useful for screen-local state like tab selection or panel visibility.</td></tr>\n <tr><td>?name</td><td>A signal in a screen property</td></tr>\n <tr><td>??name</td><td>The current value of a screen property</td></tr>\n <tr><td>?$name</td><td>The signal object stored in a screen property</td></tr>\n <tr><td>?@name</td><td>The current value of a screen attribute</td></tr>\n <tr><td>#name</td><td>A signal in a property of the bound target element</td></tr>\n <tr><td>##name</td><td>The current value of a property of the bound target element</td></tr>\n <tr><td>#$name</td><td>The signal object stored in a property of the bound target element</td></tr>\n <tr><td>#@name</td><td>The current value of an attribute of the bound target element</td></tr>\n <tr><td>$objectId</td><td>The entire signal object</td></tr>\n <tr><td>\u00A7name</td><td>A special framework-provided value (if supported)</td></tr>\n <tr><td>{name}</td><td>Dynamic signal path: embed another signal's value inside the path, e.g. <code>.Plant.{.ActiveLine}.Speed</code></td></tr>\n </table>\n </div>\n\n <div class=\"content-section\">\n <div class=\"section-title\"><span class=\"section-num\">3</span> Formula <span class=\"section-hint\">transform signal values with JavaScript</span></div>\n <div class=\"note\" style=\"margin-bottom:2px;\">Leave the formula empty to pass the first signal's value through unchanged.</div>\n <pre class=\"snippet\"><span style=\"color:#6a737d;font-style:italic\">// Access signal values by position or by name:</span>\n__0 * 100 <span style=\"color:#6a737d;font-style:italic\">// first signal \u00D7 100</span>\n__0 > 0 && __1 <span style=\"color:#6a737d;font-style:italic\">// combine two signals</span>\nspeed > limit <span style=\"color:#6a737d;font-style:italic\">// named variables</span>\n\n<span style=\"color:#6a737d;font-style:italic\">// Special variables available in the formula:</span>\n__ctx <span style=\"color:#6a737d;font-style:italic\">// the full binding context object</span>\n__res <span style=\"color:#6a737d;font-style:italic\">// the result of the previous evaluation</span></pre>\n <div class=\"note\">The formula must be a single JavaScript expression that returns a value (no <code>return</code> statement needed).</div>\n </div>\n\n <div class=\"content-section\">\n <div class=\"section-title\"><span class=\"section-num\">4</span> Write Back & Two-Way <span class=\"section-hint\">send values back to signals</span></div>\n <pre class=\"snippet\"><span style=\"color:#6a737d;font-style:italic\">// Write back signal</span>\n<span style=\"color:#6a737d;font-style:italic\">// \u2192 writes the formula result back to a signal whenever</span>\n<span style=\"color:#6a737d;font-style:italic\">// the element property changes (useful for derived values)</span>\n\n<span style=\"color:#6a737d;font-style:italic\">// Two-Way binding</span>\n<span style=\"color:#6a737d;font-style:italic\">// \u2192 also sets the signal when the element fires a DOM event</span>\n<span style=\"color:#6a737d;font-style:italic\">// (e.g. \"change\" for inputs). Enable \"events\" to configure</span>\n<span style=\"color:#6a737d;font-style:italic\">// which events trigger the write-back.</span>\n<span style=\"color:#6a737d;font-style:italic\">// \u2192 \"formula write back\" applies a reverse transformation</span>\n<span style=\"color:#6a737d;font-style:italic\">// before writing (useful when the formula changes the scale)</span></pre>\n <div class=\"note\">Two-Way is only available for <em>property</em> and <em>attribute</em> targets. Separate multiple event names with a semicolon.</div>\n </div>\n\n <div class=\"content-section\">\n <div class=\"section-title\"><span class=\"section-num\">5</span> Converter <span class=\"section-hint\">map values to display values</span></div>\n <div class=\"note\" style=\"margin-bottom:4px;\">Use the table to map specific conditions to output values. The <em>condition</em> column supports several matching modes:</div>\n <table class=\"ref-table\">\n <tr><th>Condition key</th><th>Matches when \u2026</th></tr>\n <tr><td>true / false</td><td>Signal value equals the boolean</td></tr>\n <tr><td>42</td><td>Signal value equals the number exactly</td></tr>\n <tr><td>running</td><td>Signal value equals the string \"running\"</td></tr>\n <tr><td>>10</td><td>Signal value is greater than 10</td></tr>\n <tr><td>>=5</td><td>Signal value is \u2265 5</td></tr>\n <tr><td><3</td><td>Signal value is < 3</td></tr>\n <tr><td>10-20</td><td>Signal value is in the range 10 \u2026 20 (inclusive)</td></tr>\n <tr><td>default</td><td>Fallback when no other key matches</td></tr>\n </table>\n <div class=\"note\" style=\"margin-top:4px;\">The value column supports template literals \u2014 use <code>${value}</code> to embed the original signal value in the output string.</div>\n <div class=\"note\" style=\"margin-top:4px;\"><strong>Named converter:</strong> enter a converter name in the <em>converter</em> field above the table to use a pre-registered converter instead of the inline table.</div>\n </div>\n\n</div>\n</body>\n</html>";
|
|
@@ -166,11 +166,15 @@ code {
|
|
|
166
166
|
<tr><th>Prefix / Pattern</th><th>What it accesses</th></tr>
|
|
167
167
|
<tr><td>(none)</td><td>The signal's current value directly</td></tr>
|
|
168
168
|
<tr><td>__name</td><td>Internal screen variable — local to the current screen, not connected to any external data source. Initial value is <code>null</code>. Useful for screen-local state like tab selection or panel visibility.</td></tr>
|
|
169
|
-
<tr><td>?name</td><td>A
|
|
170
|
-
<tr><td>??name</td><td>The value of a property
|
|
171
|
-
<tr><td
|
|
169
|
+
<tr><td>?name</td><td>A signal in a screen property</td></tr>
|
|
170
|
+
<tr><td>??name</td><td>The current value of a screen property</td></tr>
|
|
171
|
+
<tr><td>?$name</td><td>The signal object stored in a screen property</td></tr>
|
|
172
|
+
<tr><td>?@name</td><td>The current value of a screen attribute</td></tr>
|
|
173
|
+
<tr><td>#name</td><td>A signal in a property of the bound target element</td></tr>
|
|
172
174
|
<tr><td>##name</td><td>The current value of a property of the bound target element</td></tr>
|
|
173
|
-
<tr><td
|
|
175
|
+
<tr><td>#$name</td><td>The signal object stored in a property of the bound target element</td></tr>
|
|
176
|
+
<tr><td>#@name</td><td>The current value of an attribute of the bound target element</td></tr>
|
|
177
|
+
<tr><td>$objectId</td><td>The entire signal object</td></tr>
|
|
174
178
|
<tr><td>§name</td><td>A special framework-provided value (if supported)</td></tr>
|
|
175
179
|
<tr><td>{name}</td><td>Dynamic signal path: embed another signal's value inside the path, e.g. <code>.Plant.{.ActiveLine}.Speed</code></td></tr>
|
|
176
180
|
</table>
|
|
@@ -34,6 +34,7 @@ export declare class EventAssignment extends BaseCustomWebComponentConstructorAp
|
|
|
34
34
|
})[];
|
|
35
35
|
initialize(visualizationHandler: VisualizationHandler, visualizationShell: VisualizationShell, scriptCommandsTypeInfo: any, propertiesTypeInfo: any, blocklyToolbox: any, commandDescriptions?: Record<string, ScriptCommandHelp>): void;
|
|
36
36
|
set instanceServiceContainer(value: InstanceServiceContainer);
|
|
37
|
+
dispose(): void;
|
|
37
38
|
protected _createControlsForScript(eventItem: eventWithDesignItem): any;
|
|
38
39
|
protected _getScriptName(eventItem: IEvent): any;
|
|
39
40
|
protected _changeScriptName(e: KeyboardEvent, eventItem: IEvent): Promise<void>;
|
|
@@ -88,10 +88,13 @@ export class EventAssignment extends BaseCustomWebComponentConstructorAppend {
|
|
|
88
88
|
set instanceServiceContainer(value) {
|
|
89
89
|
this._instanceServiceContainer = value;
|
|
90
90
|
this._selectionChangedHandler?.dispose();
|
|
91
|
-
this._selectionChangedHandler = this._instanceServiceContainer
|
|
91
|
+
this._selectionChangedHandler = this._instanceServiceContainer?.selectionService.onSelectionChanged.on(e => {
|
|
92
92
|
this.selectedItems = e.selectedElements;
|
|
93
93
|
});
|
|
94
|
-
this.selectedItems = this._instanceServiceContainer
|
|
94
|
+
this.selectedItems = this._instanceServiceContainer?.selectionService.selectedElements ?? [];
|
|
95
|
+
}
|
|
96
|
+
dispose() {
|
|
97
|
+
this.instanceServiceContainer = null;
|
|
95
98
|
}
|
|
96
99
|
_createControlsForScript(eventItem) {
|
|
97
100
|
const st = this._getScriptType(eventItem);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VisualizationBinding } from "../interfaces/VisualizationBinding.js";
|
|
2
|
-
import { VisualizationHandler } from "../interfaces/VisualizationHandler.js";
|
|
2
|
+
import { State, VisualizationHandler } from "../interfaces/VisualizationHandler.js";
|
|
3
3
|
import { BindingTarget } from "@node-projects/web-component-designer/dist/elements/item/BindingTarget.js";
|
|
4
4
|
export type SpecialValueHandler = {
|
|
5
5
|
valueProvider: (propertyName: string, context: {
|
|
@@ -22,6 +22,8 @@ export declare const bindingPrefixInsideCss = "bind(";
|
|
|
22
22
|
export declare const bindingPrefixInsideCssVarName = "--tmpBinding_";
|
|
23
23
|
export declare const bindingsInCssRegex: RegExp;
|
|
24
24
|
export type namedBinding = [name: string, binding: VisualizationBinding];
|
|
25
|
+
type Cleanup = () => void;
|
|
26
|
+
type StateChangeCallback = (id: string, value: State) => void;
|
|
25
27
|
export declare function isLit(element: Element): boolean;
|
|
26
28
|
export declare function parseBindingString(id: string): {
|
|
27
29
|
parts: string[];
|
|
@@ -32,30 +34,40 @@ export declare class BindingsHelper {
|
|
|
32
34
|
#private;
|
|
33
35
|
_visualizationHandler: VisualizationHandler;
|
|
34
36
|
namedConverterCallback: (converter: string, value: any, element: Element, binding: namedBinding) => any;
|
|
37
|
+
private _stateSubscriptions;
|
|
38
|
+
private _scheduledUpdates;
|
|
39
|
+
private _updateFlushScheduled;
|
|
40
|
+
private _compiledConverters;
|
|
35
41
|
constructor(visualizationHandler: VisualizationHandler);
|
|
42
|
+
private scheduleUpdate;
|
|
36
43
|
getChangedEventName(element: Element, propertyName: string): string;
|
|
44
|
+
private getParsedTargetName;
|
|
37
45
|
parseBinding(element: Element, name: string, value: string, bindingTarget: BindingTarget, prefix: string): namedBinding;
|
|
38
46
|
serializeBinding(element: Element, targetName: string, binding: VisualizationBinding): [name: string, value: string];
|
|
47
|
+
private getShortBindingAttributeName;
|
|
48
|
+
private getJsonBindingAttributeName;
|
|
39
49
|
getBindingAttributeName(element: Element, propertyName: string, propertyTarget: BindingTarget): string;
|
|
40
50
|
getBindings(element: Element): Generator<namedBinding, void, unknown>;
|
|
41
51
|
applyAllBindings(rootElement: ParentNode, relativeSignalPath: string, root: HTMLElement, specialValueHandler?: SpecialValueHandler, skipChildrenFor?: (element: Element) => boolean): (() => void)[];
|
|
42
52
|
parseCssBindings(sheet: string, element: Element, relativeSignalPath: string, root: HTMLElement): Promise<[stylesheet: CSSStyleSheet, unsub: (() => void)[]]>;
|
|
43
53
|
parseCssBinding(value: string, element: Element, relativeSignalPath: string, root: HTMLElement, specialValueHandler?: SpecialValueHandler): [name: string, unsub: (() => void)[]];
|
|
54
|
+
/** @internal Shared fan-out avoids duplicate backend subscriptions and initial reads. */
|
|
55
|
+
subscribeToState(id: string, callback: StateChangeCallback): Cleanup;
|
|
44
56
|
/**
|
|
45
|
-
* ? =
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
* @param root
|
|
53
|
-
* @returns
|
|
54
|
-
*/
|
|
55
|
-
applyBinding(element: Element, binding: namedBinding, relativeSignalPath: string, root: HTMLElement, specialValueHandler?: SpecialValueHandler): () => void;
|
|
57
|
+
* ? = signal name from a root property; ?? = a root property value
|
|
58
|
+
* # = signal name from a target property; ## = a target property value
|
|
59
|
+
* ?$ = signal object from a root property; #$ = signal object from a target property
|
|
60
|
+
* ?@ = a root attribute value; #@ = a target attribute value
|
|
61
|
+
* $ = a signal configuration; § = a special value
|
|
62
|
+
*/
|
|
63
|
+
applyBinding(element: Element, binding: namedBinding, relativeSignalPath: string, root: HTMLElement, specialValueHandler?: SpecialValueHandler): Cleanup;
|
|
56
64
|
private addTwoWayBinding;
|
|
57
65
|
private static parseValueWithType;
|
|
58
|
-
|
|
66
|
+
private compileConverter;
|
|
67
|
+
private getCompiledConverter;
|
|
68
|
+
private applyCompiledConverter;
|
|
69
|
+
private createTargetWriter;
|
|
59
70
|
static camelToDotCase(text: string): string;
|
|
60
71
|
static dotToCamelCase(text: string): string;
|
|
61
72
|
}
|
|
73
|
+
export {};
|