@compas-oscd/open-scd 0.34.17 → 0.34.19
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/WizardDivider.d.ts +8 -8
- package/dist/WizardDivider.js +26 -26
- package/dist/Wizarding.js +36 -36
- package/dist/Wizarding.js.map +1 -1
- package/dist/action-icon.d.ts +25 -25
- package/dist/action-icon.js +51 -51
- package/dist/action-pane.d.ts +25 -25
- package/dist/action-pane.js +86 -86
- package/dist/addons/Editor.d.ts +25 -25
- package/dist/addons/Editor.js +105 -105
- package/dist/addons/Editor.js.map +1 -1
- package/dist/addons/History.d.ts +86 -93
- package/dist/addons/History.js +301 -302
- package/dist/addons/History.js.map +1 -1
- package/dist/addons/Layout.d.ts +96 -96
- package/dist/addons/Layout.js +448 -448
- package/dist/addons/Layout.js.map +1 -1
- package/dist/addons/Settings.d.ts +68 -68
- package/dist/addons/Settings.js +272 -272
- package/dist/addons/Settings.js.map +1 -1
- package/dist/addons/Waiter.d.ts +14 -14
- package/dist/addons/Waiter.js +40 -40
- package/dist/addons/Waiter.js.map +1 -1
- package/dist/addons/Wizards.d.ts +15 -15
- package/dist/addons/Wizards.js +46 -46
- package/dist/addons/editor/edit-action-to-v1-converter.d.ts +3 -3
- package/dist/addons/editor/edit-action-to-v1-converter.js +95 -95
- package/dist/addons/editor/edit-action-to-v1-converter.js.map +1 -1
- package/dist/addons/editor/edit-v1-to-v2-converter.d.ts +2 -2
- package/dist/addons/editor/edit-v1-to-v2-converter.js +36 -36
- package/dist/addons/editor/edit-v1-to-v2-converter.js.map +1 -1
- package/dist/addons/history/get-log-text.d.ts +5 -5
- package/dist/addons/history/get-log-text.js +25 -25
- package/dist/addons/history/get-log-text.js.map +1 -1
- package/dist/addons/menu-tabs/menu-tabs.d.ts +22 -22
- package/dist/addons/menu-tabs/menu-tabs.js +59 -59
- package/dist/addons/plugin-manager/custom-plugin-dialog.d.ts +28 -28
- package/dist/addons/plugin-manager/custom-plugin-dialog.js +71 -71
- package/dist/addons/plugin-manager/plugin-manager.d.ts +20 -20
- package/dist/addons/plugin-manager/plugin-manager.js +77 -77
- package/dist/core/api/api.js +7 -0
- package/dist/core/api/api.js.map +1 -0
- package/dist/core/api/editor/subject.js +22 -0
- package/dist/core/api/editor/subject.js.map +1 -0
- package/dist/core/api/editor/xml-editor.js +82 -0
- package/dist/core/api/editor/xml-editor.js.map +1 -0
- package/dist/core/api/plugin-state-api.js +27 -0
- package/dist/core/api/plugin-state-api.js.map +1 -0
- package/dist/core/foundation/cyrb64.js +26 -0
- package/dist/core/foundation/cyrb64.js.map +1 -0
- package/dist/core/foundation/deprecated/edit-event.js +44 -0
- package/dist/core/foundation/deprecated/edit-event.js.map +1 -0
- package/dist/core/foundation/deprecated/editor.js +94 -0
- package/dist/core/foundation/deprecated/editor.js.map +1 -0
- package/dist/core/foundation/deprecated/history.js +17 -0
- package/dist/core/foundation/deprecated/history.js.map +1 -0
- package/dist/core/foundation/deprecated/open-event.js +9 -0
- package/dist/core/foundation/deprecated/open-event.js.map +1 -0
- package/dist/core/foundation/deprecated/settings.js +19 -0
- package/dist/core/foundation/deprecated/settings.js.map +1 -0
- package/dist/core/foundation/deprecated/validation.js +8 -0
- package/dist/core/foundation/deprecated/validation.js.map +1 -0
- package/dist/core/foundation/deprecated/waiter.js +12 -0
- package/dist/core/foundation/deprecated/waiter.js.map +1 -0
- package/dist/core/foundation/edit-completed-event.js +11 -0
- package/dist/core/foundation/edit-completed-event.js.map +1 -0
- package/dist/core/foundation/edit-event.js +8 -0
- package/dist/core/foundation/edit-event.js.map +1 -0
- package/dist/core/foundation/edit.js +31 -0
- package/dist/core/foundation/edit.js.map +1 -0
- package/dist/core/foundation/handle-edit.js +151 -0
- package/dist/core/foundation/handle-edit.js.map +1 -0
- package/dist/core/foundation/open-event.js +8 -0
- package/dist/core/foundation/open-event.js.map +1 -0
- package/dist/core/foundation/plugin.js +2 -0
- package/dist/core/foundation/plugin.js.map +1 -0
- package/dist/core/foundation.js +14 -0
- package/dist/core/foundation.js.map +1 -0
- package/dist/core/locales.js +21 -0
- package/dist/core/locales.js.map +1 -0
- package/dist/filtered-list.d.ts +27 -27
- package/dist/filtered-list.js +118 -118
- package/dist/finder-list.d.ts +37 -37
- package/dist/finder-list.js +153 -153
- package/dist/foundation/compare.d.ts +79 -79
- package/dist/foundation/compare.js +216 -216
- package/dist/foundation/dai.d.ts +30 -30
- package/dist/foundation/dai.js +126 -126
- package/dist/foundation/generators.d.ts +13 -13
- package/dist/foundation/generators.js +66 -66
- package/dist/foundation/ied.d.ts +22 -22
- package/dist/foundation/ied.js +83 -83
- package/dist/foundation/ied.js.map +1 -1
- package/dist/foundation/nsd.d.ts +4 -4
- package/dist/foundation/nsd.js +12 -12
- package/dist/foundation/nsdoc.d.ts +14 -14
- package/dist/foundation/nsdoc.js +178 -178
- package/dist/foundation/scl.d.ts +1 -1
- package/dist/foundation/scl.js +63 -63
- package/dist/foundation.d.ts +230 -230
- package/dist/foundation.js +1921 -1921
- package/dist/foundation.js.map +1 -1
- package/dist/icons/compare.d.ts +3 -3
- package/dist/icons/compare.js +4 -4
- package/dist/icons/icons.d.ts +41 -41
- package/dist/icons/icons.js +92 -92
- package/dist/icons/ied-icons.d.ts +3 -3
- package/dist/icons/ied-icons.js +4 -4
- package/dist/icons/lnode.d.ts +16 -16
- package/dist/icons/lnode.js +17 -17
- package/dist/open-scd.d.ts +131 -131
- package/dist/open-scd.js +438 -438
- package/dist/open-scd.js.map +1 -1
- package/dist/openscd/src/WizardDivider.js +37 -0
- package/dist/openscd/src/WizardDivider.js.map +1 -0
- package/dist/openscd/src/Wizarding.js +38 -0
- package/dist/openscd/src/Wizarding.js.map +1 -0
- package/dist/openscd/src/action-icon.js +220 -0
- package/dist/openscd/src/action-icon.js.map +1 -0
- package/dist/openscd/src/action-pane.js +176 -0
- package/dist/openscd/src/action-pane.js.map +1 -0
- package/dist/openscd/src/addons/Editor.js +106 -0
- package/dist/openscd/src/addons/Editor.js.map +1 -0
- package/dist/openscd/src/addons/History.js +490 -0
- package/dist/openscd/src/addons/History.js.map +1 -0
- package/dist/openscd/src/addons/Layout.js +619 -0
- package/dist/openscd/src/addons/Layout.js.map +1 -0
- package/dist/openscd/src/addons/Settings.js +465 -0
- package/dist/openscd/src/addons/Settings.js.map +1 -0
- package/dist/openscd/src/addons/Waiter.js +45 -0
- package/dist/openscd/src/addons/Waiter.js.map +1 -0
- package/dist/openscd/src/addons/Wizards.js +48 -0
- package/dist/openscd/src/addons/Wizards.js.map +1 -0
- package/dist/openscd/src/addons/editor/edit-action-to-v1-converter.js +96 -0
- package/dist/openscd/src/addons/editor/edit-action-to-v1-converter.js.map +1 -0
- package/dist/openscd/src/addons/editor/edit-v1-to-v2-converter.js +37 -0
- package/dist/openscd/src/addons/editor/edit-v1-to-v2-converter.js.map +1 -0
- package/dist/openscd/src/addons/history/get-log-text.js +26 -0
- package/dist/openscd/src/addons/history/get-log-text.js.map +1 -0
- package/dist/openscd/src/addons/menu-tabs/menu-tabs.js +74 -0
- package/dist/openscd/src/addons/menu-tabs/menu-tabs.js.map +1 -0
- package/dist/openscd/src/addons/plugin-manager/custom-plugin-dialog.js +177 -0
- package/dist/openscd/src/addons/plugin-manager/custom-plugin-dialog.js.map +1 -0
- package/dist/openscd/src/addons/plugin-manager/plugin-manager.js +165 -0
- package/dist/openscd/src/addons/plugin-manager/plugin-manager.js.map +1 -0
- package/dist/openscd/src/filtered-list.js +168 -0
- package/dist/openscd/src/filtered-list.js.map +1 -0
- package/dist/openscd/src/finder-list.js +207 -0
- package/dist/openscd/src/finder-list.js.map +1 -0
- package/dist/openscd/src/foundation/compare.js +273 -0
- package/dist/openscd/src/foundation/compare.js.map +1 -0
- package/dist/openscd/src/foundation/dai.js +127 -0
- package/dist/openscd/src/foundation/dai.js.map +1 -0
- package/dist/openscd/src/foundation/generators.js +67 -0
- package/dist/openscd/src/foundation/generators.js.map +1 -0
- package/dist/openscd/src/foundation/ied.js +84 -0
- package/dist/openscd/src/foundation/ied.js.map +1 -0
- package/dist/openscd/src/foundation/nsd.js +13 -0
- package/dist/openscd/src/foundation/nsd.js.map +1 -0
- package/dist/openscd/src/foundation/nsdoc.js +180 -0
- package/dist/openscd/src/foundation/nsdoc.js.map +1 -0
- package/dist/openscd/src/foundation/scl.js +64 -0
- package/dist/openscd/src/foundation/scl.js.map +1 -0
- package/dist/openscd/src/foundation.js +1922 -0
- package/dist/openscd/src/foundation.js.map +1 -0
- package/dist/openscd/src/icons/compare.js +11 -0
- package/dist/openscd/src/icons/compare.js.map +1 -0
- package/dist/openscd/src/icons/icons.js +611 -0
- package/dist/openscd/src/icons/icons.js.map +1 -0
- package/dist/openscd/src/icons/ied-icons.js +11 -0
- package/dist/openscd/src/icons/ied-icons.js.map +1 -0
- package/dist/openscd/src/icons/lnode.js +50 -0
- package/dist/openscd/src/icons/lnode.js.map +1 -0
- package/dist/openscd/src/open-scd.js +483 -0
- package/dist/openscd/src/open-scd.js.map +1 -0
- package/dist/openscd/src/oscd-filter-button.js +89 -0
- package/dist/openscd/src/oscd-filter-button.js.map +1 -0
- package/dist/openscd/src/plain-compare-list.js +132 -0
- package/dist/openscd/src/plain-compare-list.js.map +1 -0
- package/dist/openscd/src/plugin-tag.js +23 -0
- package/dist/openscd/src/plugin-tag.js.map +1 -0
- package/dist/openscd/src/plugin.events.js +12 -0
- package/dist/openscd/src/plugin.events.js.map +1 -0
- package/dist/openscd/src/plugin.js +2 -0
- package/dist/openscd/src/plugin.js.map +1 -0
- package/dist/openscd/src/plugins.js +256 -0
- package/dist/openscd/src/plugins.js.map +1 -0
- package/dist/openscd/src/schemas.js +9325 -0
- package/dist/openscd/src/schemas.js.map +1 -0
- package/dist/openscd/src/themes.js +122 -0
- package/dist/openscd/src/themes.js.map +1 -0
- package/dist/openscd/src/translations/de.js +954 -0
- package/dist/openscd/src/translations/de.js.map +1 -0
- package/dist/openscd/src/translations/en.js +950 -0
- package/dist/openscd/src/translations/en.js.map +1 -0
- package/dist/openscd/src/translations/loader.js +10 -0
- package/dist/openscd/src/translations/loader.js.map +1 -0
- package/dist/openscd/src/wizard-checkbox.js +152 -0
- package/dist/openscd/src/wizard-checkbox.js.map +1 -0
- package/dist/openscd/src/wizard-dialog.js +374 -0
- package/dist/openscd/src/wizard-dialog.js.map +1 -0
- package/dist/openscd/src/wizard-select.js +115 -0
- package/dist/openscd/src/wizard-select.js.map +1 -0
- package/dist/openscd/src/wizard-textfield.js +191 -0
- package/dist/openscd/src/wizard-textfield.js.map +1 -0
- package/dist/openscd/src/wizards.js +196 -0
- package/dist/openscd/src/wizards.js.map +1 -0
- package/dist/oscd-filter-button.d.ts +27 -27
- package/dist/oscd-filter-button.js +59 -59
- package/dist/plain-compare-list.d.ts +36 -36
- package/dist/plain-compare-list.js +70 -70
- package/dist/plugin-tag.d.ts +6 -6
- package/dist/plugin-tag.js +22 -22
- package/dist/plugin.d.ts +23 -23
- package/dist/plugin.events.d.ts +15 -15
- package/dist/plugin.events.js +11 -11
- package/dist/plugin.js +1 -1
- package/dist/plugin.js.map +1 -1
- package/dist/plugins.d.ts +3 -3
- package/dist/plugins.js +255 -255
- package/dist/schemas.d.ts +58 -58
- package/dist/schemas.js +59 -59
- package/dist/themes.d.ts +3 -3
- package/dist/themes.js +13 -13
- package/dist/themes.js.map +1 -1
- package/dist/translations/de.d.ts +2 -2
- package/dist/translations/de.js +952 -952
- package/dist/translations/en.d.ts +963 -963
- package/dist/translations/en.js +948 -948
- package/dist/translations/loader.d.ts +12 -12
- package/dist/translations/loader.js +9 -9
- package/dist/translations/loader.js.map +1 -1
- package/dist/wizard-checkbox.d.ts +37 -37
- package/dist/wizard-checkbox.js +130 -130
- package/dist/wizard-dialog.d.ts +45 -45
- package/dist/wizard-dialog.js +235 -235
- package/dist/wizard-dialog.js.map +1 -1
- package/dist/wizard-select.d.ts +31 -31
- package/dist/wizard-select.js +102 -102
- package/dist/wizard-textfield.d.ts +50 -50
- package/dist/wizard-textfield.js +162 -162
- package/dist/wizards.d.ts +23 -23
- package/dist/wizards.js +148 -148
- package/dist/wizards.js.map +1 -1
- package/dist/xml/src/foundation.js +67 -0
- package/dist/xml/src/foundation.js.map +1 -0
- package/dist/xml/src/index.js +2 -0
- package/dist/xml/src/index.js.map +1 -0
- package/package.json +38 -127
- package/dist/Wizarding.d.ts +0 -10
package/dist/wizard-textfield.js
CHANGED
|
@@ -1,107 +1,107 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
import { customElement, html, state, property, query, } from 'lit-element';
|
|
3
|
-
import { get } from 'lit-translate';
|
|
4
|
-
import '@material/mwc-icon-button';
|
|
5
|
-
import '@material/mwc-list/mwc-list-item';
|
|
6
|
-
import '@material/mwc-menu';
|
|
7
|
-
import '@material/mwc-switch';
|
|
8
|
-
import { TextField } from '@material/mwc-textfield';
|
|
9
|
-
/** A potentially `nullable` `TextField` that allows for selection of an SI
|
|
10
|
-
* `multiplier` if an SI `unit` is given.
|
|
11
|
-
*
|
|
12
|
-
* NB: Use `maybeValue: string | null` instead of `value` if `nullable`!*/
|
|
13
|
-
let WizardTextField = class WizardTextField extends TextField {
|
|
14
|
-
get multiplier() {
|
|
15
|
-
if (this.unit == '')
|
|
16
|
-
return null;
|
|
17
|
-
return (this.multipliers[this.multiplierIndex] ?? this.multipliers[0] ?? null);
|
|
18
|
-
}
|
|
19
|
-
set multiplier(value) {
|
|
20
|
-
const index = this.multipliers.indexOf(value);
|
|
21
|
-
if (index >= 0)
|
|
22
|
-
this.multiplierIndex = index;
|
|
23
|
-
this.suffix = (this.multiplier ?? '') + this.unit;
|
|
24
|
-
}
|
|
25
|
-
get null() {
|
|
26
|
-
return this.nullable && this.isNull;
|
|
27
|
-
}
|
|
28
|
-
set null(value) {
|
|
29
|
-
if (!this.nullable || value === this.isNull)
|
|
30
|
-
return;
|
|
31
|
-
this.isNull = value;
|
|
32
|
-
if (this.null)
|
|
33
|
-
this.disable();
|
|
34
|
-
else
|
|
35
|
-
this.enable();
|
|
36
|
-
}
|
|
37
|
-
/** Replacement for `value`, can only be `null` if [[`nullable`]]. */
|
|
38
|
-
get maybeValue() {
|
|
39
|
-
return this.null ? null : this.value;
|
|
40
|
-
}
|
|
41
|
-
set maybeValue(value) {
|
|
42
|
-
if (value === null)
|
|
43
|
-
this.null = true;
|
|
44
|
-
else {
|
|
45
|
-
this.null = false;
|
|
46
|
-
this.value = value;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
selectMultiplier(se) {
|
|
50
|
-
this.multiplier = this.multipliers[se.detail.index];
|
|
51
|
-
}
|
|
52
|
-
enable() {
|
|
53
|
-
if (this.nulled === null)
|
|
54
|
-
return;
|
|
55
|
-
this.value = this.nulled;
|
|
56
|
-
this.nulled = null;
|
|
57
|
-
this.helperPersistent = false;
|
|
58
|
-
this.disabled = false;
|
|
59
|
-
}
|
|
60
|
-
disable() {
|
|
61
|
-
if (this.nulled !== null)
|
|
62
|
-
return;
|
|
63
|
-
this.nulled = this.value;
|
|
64
|
-
this.value = this.defaultValue;
|
|
65
|
-
this.helperPersistent = true;
|
|
66
|
-
this.disabled = true;
|
|
67
|
-
}
|
|
68
|
-
async firstUpdated() {
|
|
69
|
-
await super.firstUpdated();
|
|
70
|
-
if (this.multiplierMenu)
|
|
71
|
-
this.multiplierMenu.anchor =
|
|
72
|
-
this.multiplierButton ?? null;
|
|
73
|
-
}
|
|
74
|
-
checkValidity() {
|
|
75
|
-
if (this.reservedValues &&
|
|
76
|
-
this.reservedValues.some(array => array === this.value)) {
|
|
77
|
-
this.setCustomValidity(get('textfield.unique'));
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
this.setCustomValidity(''); //Reset. Otherwise super.checkValidity always falseM
|
|
81
|
-
return super.checkValidity();
|
|
82
|
-
}
|
|
83
|
-
constructor() {
|
|
84
|
-
super();
|
|
85
|
-
/** Whether [[`maybeValue`]] may be `null` */
|
|
86
|
-
this.nullable = false;
|
|
87
|
-
/** Selectable SI multipliers for a non-empty [[`unit`]]. */
|
|
88
|
-
this.multipliers = [null, ''];
|
|
89
|
-
this.multiplierIndex = 0;
|
|
90
|
-
/** SI Unit, must be non-empty to allow for selecting a [[`multiplier`]].
|
|
91
|
-
* Overrides `suffix`. */
|
|
92
|
-
this.unit = '';
|
|
93
|
-
this.isNull = false;
|
|
94
|
-
/** The default `value` displayed if [[`maybeValue`]] is `null`. */
|
|
95
|
-
this.defaultValue = '';
|
|
96
|
-
/** Additional values that cause validation to fail. */
|
|
97
|
-
this.reservedValues = [];
|
|
98
|
-
// FIXME: workaround to allow disable of the whole component - need basic refactor
|
|
99
|
-
this.disabledSwitch = false;
|
|
100
|
-
this.nulled = null;
|
|
101
|
-
this.disabledSwitch = this.hasAttribute('disabled');
|
|
102
|
-
}
|
|
103
|
-
renderUnitSelector() {
|
|
104
|
-
if (this.multipliers.length && this.unit)
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { customElement, html, state, property, query, } from 'lit-element';
|
|
3
|
+
import { get } from 'lit-translate';
|
|
4
|
+
import '@material/mwc-icon-button';
|
|
5
|
+
import '@material/mwc-list/mwc-list-item';
|
|
6
|
+
import '@material/mwc-menu';
|
|
7
|
+
import '@material/mwc-switch';
|
|
8
|
+
import { TextField } from '@material/mwc-textfield';
|
|
9
|
+
/** A potentially `nullable` `TextField` that allows for selection of an SI
|
|
10
|
+
* `multiplier` if an SI `unit` is given.
|
|
11
|
+
*
|
|
12
|
+
* NB: Use `maybeValue: string | null` instead of `value` if `nullable`!*/
|
|
13
|
+
let WizardTextField = class WizardTextField extends TextField {
|
|
14
|
+
get multiplier() {
|
|
15
|
+
if (this.unit == '')
|
|
16
|
+
return null;
|
|
17
|
+
return (this.multipliers[this.multiplierIndex] ?? this.multipliers[0] ?? null);
|
|
18
|
+
}
|
|
19
|
+
set multiplier(value) {
|
|
20
|
+
const index = this.multipliers.indexOf(value);
|
|
21
|
+
if (index >= 0)
|
|
22
|
+
this.multiplierIndex = index;
|
|
23
|
+
this.suffix = (this.multiplier ?? '') + this.unit;
|
|
24
|
+
}
|
|
25
|
+
get null() {
|
|
26
|
+
return this.nullable && this.isNull;
|
|
27
|
+
}
|
|
28
|
+
set null(value) {
|
|
29
|
+
if (!this.nullable || value === this.isNull)
|
|
30
|
+
return;
|
|
31
|
+
this.isNull = value;
|
|
32
|
+
if (this.null)
|
|
33
|
+
this.disable();
|
|
34
|
+
else
|
|
35
|
+
this.enable();
|
|
36
|
+
}
|
|
37
|
+
/** Replacement for `value`, can only be `null` if [[`nullable`]]. */
|
|
38
|
+
get maybeValue() {
|
|
39
|
+
return this.null ? null : this.value;
|
|
40
|
+
}
|
|
41
|
+
set maybeValue(value) {
|
|
42
|
+
if (value === null)
|
|
43
|
+
this.null = true;
|
|
44
|
+
else {
|
|
45
|
+
this.null = false;
|
|
46
|
+
this.value = value;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
selectMultiplier(se) {
|
|
50
|
+
this.multiplier = this.multipliers[se.detail.index];
|
|
51
|
+
}
|
|
52
|
+
enable() {
|
|
53
|
+
if (this.nulled === null)
|
|
54
|
+
return;
|
|
55
|
+
this.value = this.nulled;
|
|
56
|
+
this.nulled = null;
|
|
57
|
+
this.helperPersistent = false;
|
|
58
|
+
this.disabled = false;
|
|
59
|
+
}
|
|
60
|
+
disable() {
|
|
61
|
+
if (this.nulled !== null)
|
|
62
|
+
return;
|
|
63
|
+
this.nulled = this.value;
|
|
64
|
+
this.value = this.defaultValue;
|
|
65
|
+
this.helperPersistent = true;
|
|
66
|
+
this.disabled = true;
|
|
67
|
+
}
|
|
68
|
+
async firstUpdated() {
|
|
69
|
+
await super.firstUpdated();
|
|
70
|
+
if (this.multiplierMenu)
|
|
71
|
+
this.multiplierMenu.anchor =
|
|
72
|
+
this.multiplierButton ?? null;
|
|
73
|
+
}
|
|
74
|
+
checkValidity() {
|
|
75
|
+
if (this.reservedValues &&
|
|
76
|
+
this.reservedValues.some(array => array === this.value)) {
|
|
77
|
+
this.setCustomValidity(get('textfield.unique'));
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
this.setCustomValidity(''); //Reset. Otherwise super.checkValidity always falseM
|
|
81
|
+
return super.checkValidity();
|
|
82
|
+
}
|
|
83
|
+
constructor() {
|
|
84
|
+
super();
|
|
85
|
+
/** Whether [[`maybeValue`]] may be `null` */
|
|
86
|
+
this.nullable = false;
|
|
87
|
+
/** Selectable SI multipliers for a non-empty [[`unit`]]. */
|
|
88
|
+
this.multipliers = [null, ''];
|
|
89
|
+
this.multiplierIndex = 0;
|
|
90
|
+
/** SI Unit, must be non-empty to allow for selecting a [[`multiplier`]].
|
|
91
|
+
* Overrides `suffix`. */
|
|
92
|
+
this.unit = '';
|
|
93
|
+
this.isNull = false;
|
|
94
|
+
/** The default `value` displayed if [[`maybeValue`]] is `null`. */
|
|
95
|
+
this.defaultValue = '';
|
|
96
|
+
/** Additional values that cause validation to fail. */
|
|
97
|
+
this.reservedValues = [];
|
|
98
|
+
// FIXME: workaround to allow disable of the whole component - need basic refactor
|
|
99
|
+
this.disabledSwitch = false;
|
|
100
|
+
this.nulled = null;
|
|
101
|
+
this.disabledSwitch = this.hasAttribute('disabled');
|
|
102
|
+
}
|
|
103
|
+
renderUnitSelector() {
|
|
104
|
+
if (this.multipliers.length && this.unit)
|
|
105
105
|
return html `<div style="position:relative;">
|
|
106
106
|
<mwc-icon-button
|
|
107
107
|
style="margin:5px;"
|
|
@@ -115,31 +115,31 @@ let WizardTextField = class WizardTextField extends TextField {
|
|
|
115
115
|
.anchor=${this.multiplierButton ?? null}
|
|
116
116
|
>${this.renderMulplierList()}</mwc-menu
|
|
117
117
|
>
|
|
118
|
-
</div>`;
|
|
119
|
-
else
|
|
120
|
-
return html ``;
|
|
121
|
-
}
|
|
122
|
-
renderMulplierList() {
|
|
118
|
+
</div>`;
|
|
119
|
+
else
|
|
120
|
+
return html ``;
|
|
121
|
+
}
|
|
122
|
+
renderMulplierList() {
|
|
123
123
|
return html `${this.multipliers.map(multiplier => html `<mwc-list-item ?selected=${multiplier === this.multiplier}
|
|
124
|
-
>${multiplier === null
|
|
125
|
-
? get('textfield.noMultiplier')
|
|
124
|
+
>${multiplier === null
|
|
125
|
+
? get('textfield.noMultiplier')
|
|
126
126
|
: multiplier}</mwc-list-item
|
|
127
|
-
>`)}`;
|
|
128
|
-
}
|
|
129
|
-
renderSwitch() {
|
|
130
|
-
if (this.nullable) {
|
|
127
|
+
>`)}`;
|
|
128
|
+
}
|
|
129
|
+
renderSwitch() {
|
|
130
|
+
if (this.nullable) {
|
|
131
131
|
return html `<mwc-switch
|
|
132
132
|
style="margin-left: 12px;"
|
|
133
133
|
?checked=${!this.null}
|
|
134
134
|
?disabled=${this.disabledSwitch}
|
|
135
|
-
@change=${() => {
|
|
136
|
-
this.null = !this.nullSwitch.checked;
|
|
135
|
+
@change=${() => {
|
|
136
|
+
this.null = !this.nullSwitch.checked;
|
|
137
137
|
}}
|
|
138
|
-
></mwc-switch>`;
|
|
139
|
-
}
|
|
140
|
-
return html ``;
|
|
141
|
-
}
|
|
142
|
-
render() {
|
|
138
|
+
></mwc-switch>`;
|
|
139
|
+
}
|
|
140
|
+
return html ``;
|
|
141
|
+
}
|
|
142
|
+
render() {
|
|
143
143
|
return html `
|
|
144
144
|
<div style="display: flex; flex-direction: row;">
|
|
145
145
|
<div style="flex: auto;">${super.render()}</div>
|
|
@@ -148,44 +148,44 @@ let WizardTextField = class WizardTextField extends TextField {
|
|
|
148
148
|
${this.renderSwitch()}
|
|
149
149
|
</div>
|
|
150
150
|
</div>
|
|
151
|
-
`;
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
__decorate([
|
|
155
|
-
property({ type: Boolean })
|
|
156
|
-
], WizardTextField.prototype, "nullable", void 0);
|
|
157
|
-
__decorate([
|
|
158
|
-
property({ type: Array })
|
|
159
|
-
], WizardTextField.prototype, "multipliers", void 0);
|
|
160
|
-
__decorate([
|
|
161
|
-
property({ type: String })
|
|
162
|
-
], WizardTextField.prototype, "multiplier", null);
|
|
163
|
-
__decorate([
|
|
164
|
-
property({ type: String })
|
|
165
|
-
], WizardTextField.prototype, "unit", void 0);
|
|
166
|
-
__decorate([
|
|
167
|
-
state()
|
|
168
|
-
], WizardTextField.prototype, "null", null);
|
|
169
|
-
__decorate([
|
|
170
|
-
property({ type: String })
|
|
171
|
-
], WizardTextField.prototype, "maybeValue", null);
|
|
172
|
-
__decorate([
|
|
173
|
-
property({ type: String })
|
|
174
|
-
], WizardTextField.prototype, "defaultValue", void 0);
|
|
175
|
-
__decorate([
|
|
176
|
-
property({ type: Array })
|
|
177
|
-
], WizardTextField.prototype, "reservedValues", void 0);
|
|
178
|
-
__decorate([
|
|
179
|
-
query('mwc-switch')
|
|
180
|
-
], WizardTextField.prototype, "nullSwitch", void 0);
|
|
181
|
-
__decorate([
|
|
182
|
-
query('mwc-menu')
|
|
183
|
-
], WizardTextField.prototype, "multiplierMenu", void 0);
|
|
184
|
-
__decorate([
|
|
185
|
-
query('mwc-icon-button')
|
|
186
|
-
], WizardTextField.prototype, "multiplierButton", void 0);
|
|
187
|
-
WizardTextField = __decorate([
|
|
188
|
-
customElement('wizard-textfield')
|
|
189
|
-
], WizardTextField);
|
|
190
|
-
export { WizardTextField };
|
|
151
|
+
`;
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
__decorate([
|
|
155
|
+
property({ type: Boolean })
|
|
156
|
+
], WizardTextField.prototype, "nullable", void 0);
|
|
157
|
+
__decorate([
|
|
158
|
+
property({ type: Array })
|
|
159
|
+
], WizardTextField.prototype, "multipliers", void 0);
|
|
160
|
+
__decorate([
|
|
161
|
+
property({ type: String })
|
|
162
|
+
], WizardTextField.prototype, "multiplier", null);
|
|
163
|
+
__decorate([
|
|
164
|
+
property({ type: String })
|
|
165
|
+
], WizardTextField.prototype, "unit", void 0);
|
|
166
|
+
__decorate([
|
|
167
|
+
state()
|
|
168
|
+
], WizardTextField.prototype, "null", null);
|
|
169
|
+
__decorate([
|
|
170
|
+
property({ type: String })
|
|
171
|
+
], WizardTextField.prototype, "maybeValue", null);
|
|
172
|
+
__decorate([
|
|
173
|
+
property({ type: String })
|
|
174
|
+
], WizardTextField.prototype, "defaultValue", void 0);
|
|
175
|
+
__decorate([
|
|
176
|
+
property({ type: Array })
|
|
177
|
+
], WizardTextField.prototype, "reservedValues", void 0);
|
|
178
|
+
__decorate([
|
|
179
|
+
query('mwc-switch')
|
|
180
|
+
], WizardTextField.prototype, "nullSwitch", void 0);
|
|
181
|
+
__decorate([
|
|
182
|
+
query('mwc-menu')
|
|
183
|
+
], WizardTextField.prototype, "multiplierMenu", void 0);
|
|
184
|
+
__decorate([
|
|
185
|
+
query('mwc-icon-button')
|
|
186
|
+
], WizardTextField.prototype, "multiplierButton", void 0);
|
|
187
|
+
WizardTextField = __decorate([
|
|
188
|
+
customElement('wizard-textfield')
|
|
189
|
+
], WizardTextField);
|
|
190
|
+
export { WizardTextField };
|
|
191
191
|
//# sourceMappingURL=wizard-textfield.js.map
|
package/dist/wizards.d.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import '@material/mwc-icon';
|
|
2
|
-
import '@material/mwc-list';
|
|
3
|
-
import '@material/mwc-list/mwc-check-list-item';
|
|
4
|
-
import '@material/mwc-list/mwc-list-item';
|
|
5
|
-
import { Wizard } from './foundation.js';
|
|
6
|
-
interface MergeOptions {
|
|
7
|
-
title?: string;
|
|
8
|
-
selected?: (diff: Diff<Element | string>) => boolean;
|
|
9
|
-
disabled?: (diff: Diff<Element | string>) => boolean;
|
|
10
|
-
auto?: (sink: Element, source: Element) => boolean;
|
|
11
|
-
}
|
|
12
|
-
export type Diff<T> = {
|
|
13
|
-
ours: T;
|
|
14
|
-
theirs: null;
|
|
15
|
-
} | {
|
|
16
|
-
ours: null;
|
|
17
|
-
theirs: T;
|
|
18
|
-
} | {
|
|
19
|
-
ours: T;
|
|
20
|
-
theirs: T;
|
|
21
|
-
};
|
|
22
|
-
export declare function mergeWizard(sink: Element, source: Element, options?: MergeOptions): Wizard;
|
|
23
|
-
export {};
|
|
1
|
+
import '@material/mwc-icon';
|
|
2
|
+
import '@material/mwc-list';
|
|
3
|
+
import '@material/mwc-list/mwc-check-list-item';
|
|
4
|
+
import '@material/mwc-list/mwc-list-item';
|
|
5
|
+
import { Wizard } from './foundation.js';
|
|
6
|
+
interface MergeOptions {
|
|
7
|
+
title?: string;
|
|
8
|
+
selected?: (diff: Diff<Element | string>) => boolean;
|
|
9
|
+
disabled?: (diff: Diff<Element | string>) => boolean;
|
|
10
|
+
auto?: (sink: Element, source: Element) => boolean;
|
|
11
|
+
}
|
|
12
|
+
export type Diff<T> = {
|
|
13
|
+
ours: T;
|
|
14
|
+
theirs: null;
|
|
15
|
+
} | {
|
|
16
|
+
ours: null;
|
|
17
|
+
theirs: T;
|
|
18
|
+
} | {
|
|
19
|
+
ours: T;
|
|
20
|
+
theirs: T;
|
|
21
|
+
};
|
|
22
|
+
export declare function mergeWizard(sink: Element, source: Element, options?: MergeOptions): Wizard;
|
|
23
|
+
export {};
|