@supersoniks/concorde 1.1.41 → 1.1.43
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/README.md +0 -0
- package/cli.js +0 -0
- package/components.d.ts +0 -0
- package/components.js +2 -3
- package/concorde-core.bundle.js +37 -42
- package/concorde-core.es.js +5702 -4823
- package/core/_types/types.d.ts +26 -0
- package/core/_types/types.js +1 -0
- package/core/components/functional/date/date.d.ts +13 -5
- package/core/components/functional/date/date.js +48 -29
- package/core/components/functional/example/example.d.ts +1 -1
- package/core/components/functional/example/example.js +1 -1
- package/core/components/functional/fetch/fetch.d.ts +40 -3
- package/core/components/functional/fetch/fetch.js +2 -6
- package/core/components/functional/functional.d.ts +2 -0
- package/core/components/functional/functional.js +2 -0
- package/core/components/functional/if/if.d.ts +3 -0
- package/core/components/functional/if/if.js +6 -12
- package/core/components/functional/if/if.test.d.ts +1 -0
- package/core/components/functional/if/if.test.js +44 -0
- package/core/components/functional/list/list.d.ts +32 -8
- package/core/components/functional/list/list.js +33 -40
- package/core/components/functional/mix/mix.d.ts +22 -0
- package/core/components/functional/mix/mix.js +99 -0
- package/core/components/functional/queue/queue.d.ts +16 -3
- package/core/components/functional/queue/queue.js +71 -15
- package/core/components/functional/router/redirect.d.ts +10 -1
- package/core/components/functional/router/redirect.js +5 -6
- package/core/components/functional/router/router.d.ts +15 -1
- package/core/components/functional/router/router.js +1 -6
- package/core/components/functional/sdui/SDUIDescriptorTransformer.d.ts +1 -1
- package/core/components/functional/sdui/SDUIDescriptorTransformer.js +24 -12
- package/core/components/functional/sdui/default-library.json +108 -0
- package/core/components/functional/sdui/sdui-utils.d.ts +5 -0
- package/core/components/functional/sdui/sdui-utils.js +63 -0
- package/core/components/functional/sdui/sdui.d.ts +20 -9
- package/core/components/functional/sdui/sdui.js +64 -24
- package/core/components/functional/sdui/types.d.ts +4 -2
- package/core/components/functional/sdui/types.js +0 -0
- package/core/components/functional/sonic-scope/sonic-scope.d.ts +0 -0
- package/core/components/functional/sonic-scope/sonic-scope.js +0 -0
- package/core/components/functional/states/states.d.ts +19 -3
- package/core/components/functional/states/states.js +7 -12
- package/core/components/functional/submit/submit.d.ts +16 -1
- package/core/components/functional/submit/submit.js +87 -17
- package/core/components/functional/subscriber/subscriber.d.ts +4 -1
- package/core/components/functional/subscriber/subscriber.js +1 -6
- package/core/components/functional/value/value.d.ts +7 -0
- package/core/components/functional/value/value.js +26 -0
- package/core/components/ui/_css/scroll.d.ts +0 -0
- package/core/components/ui/_css/scroll.js +6 -7
- package/core/components/ui/_css/size.d.ts +1 -0
- package/core/components/ui/_css/size.js +3 -1
- package/core/components/ui/_css/type.d.ts +0 -0
- package/core/components/ui/_css/type.js +0 -0
- package/core/components/ui/alert/alert.d.ts +2 -2
- package/core/components/ui/alert/alert.js +11 -16
- package/core/components/ui/badge/badge.d.ts +3 -1
- package/core/components/ui/badge/badge.js +36 -22
- package/core/components/ui/button/button.d.ts +23 -20
- package/core/components/ui/button/button.js +59 -42
- package/core/components/ui/captcha/captcha.d.ts +14 -2
- package/core/components/ui/captcha/captcha.js +17 -12
- package/core/components/ui/card/card-footer.d.ts +0 -0
- package/core/components/ui/card/card-footer.js +1 -8
- package/core/components/ui/card/card-header-descripton.d.ts +0 -0
- package/core/components/ui/card/card-header-descripton.js +3 -9
- package/core/components/ui/card/card-header.d.ts +0 -0
- package/core/components/ui/card/card-header.js +1 -6
- package/core/components/ui/card/card-main.d.ts +0 -0
- package/core/components/ui/card/card-main.js +0 -5
- package/core/components/ui/card/card.d.ts +1 -1
- package/core/components/ui/card/card.js +28 -12
- package/core/components/ui/divider/divider.d.ts +2 -0
- package/core/components/ui/divider/divider.js +44 -17
- package/core/components/ui/form/checkbox/checkbox.d.ts +53 -16
- package/core/components/ui/form/checkbox/checkbox.js +54 -29
- package/core/components/ui/form/css/form-control.d.ts +2 -0
- package/core/components/ui/form/css/form-control.js +145 -67
- package/core/components/ui/form/fieldset/fieldset.d.ts +8 -1
- package/core/components/ui/form/fieldset/fieldset.js +45 -8
- package/core/components/ui/form/fieldset/legend-description.d.ts +0 -0
- package/core/components/ui/form/fieldset/legend-description.js +0 -5
- package/core/components/ui/form/fieldset/legend.d.ts +0 -0
- package/core/components/ui/form/fieldset/legend.js +4 -7
- package/core/components/ui/form/form-actions/form-actions.d.ts +2 -0
- package/core/components/ui/form/form-actions/form-actions.js +26 -11
- package/core/components/ui/form/form-layout/form-layout.d.ts +5 -2
- package/core/components/ui/form/form-layout/form-layout.js +31 -9
- package/core/components/ui/form/input/input.d.ts +15 -18
- package/core/components/ui/form/input/input.js +89 -54
- package/core/components/ui/form/input/password-helper.d.ts +7 -1
- package/core/components/ui/form/input/password-helper.js +33 -10
- package/core/components/ui/form/input/same-value-helper.d.ts +1 -1
- package/core/components/ui/form/input/same-value-helper.js +1 -0
- package/core/components/ui/form/input-autocomplete/input-autocomplete.d.ts +34 -0
- package/core/components/ui/form/input-autocomplete/input-autocomplete.js +133 -0
- package/core/components/ui/form/radio/radio.d.ts +6 -0
- package/core/components/ui/form/radio/radio.js +7 -12
- package/core/components/ui/form/select/select.d.ts +23 -7
- package/core/components/ui/form/select/select.js +71 -40
- package/core/components/ui/form/textarea/textarea.d.ts +13 -13
- package/core/components/ui/form/textarea/textarea.js +31 -38
- package/core/components/ui/group/group.d.ts +11 -1
- package/core/components/ui/group/group.js +79 -17
- package/core/components/ui/icon/icon.d.ts +10 -3
- package/core/components/ui/icon/icon.js +16 -15
- package/core/components/ui/icon/icons.d.ts +0 -0
- package/core/components/ui/icon/icons.js +11 -8
- package/core/components/ui/icon/icons.json +1 -1
- package/core/components/ui/image/image.d.ts +0 -0
- package/core/components/ui/image/image.js +0 -5
- package/core/components/ui/link/link.d.ts +1 -1
- package/core/components/ui/link/link.js +2 -6
- package/core/components/ui/loader/loader.d.ts +0 -0
- package/core/components/ui/loader/loader.js +2 -8
- package/core/components/ui/loader/styles/fixed.d.ts +0 -0
- package/core/components/ui/loader/styles/fixed.js +0 -0
- package/core/components/ui/loader/styles/inline.d.ts +0 -0
- package/core/components/ui/loader/styles/inline.js +0 -0
- package/core/components/ui/menu/menu-item.d.ts +0 -0
- package/core/components/ui/menu/menu-item.js +4 -9
- package/core/components/ui/menu/menu.d.ts +9 -1
- package/core/components/ui/menu/menu.js +183 -27
- package/core/components/ui/modal/modal-actions.d.ts +0 -0
- package/core/components/ui/modal/modal-actions.js +1 -6
- package/core/components/ui/modal/modal-close.d.ts +1 -0
- package/core/components/ui/modal/modal-close.js +14 -10
- package/core/components/ui/modal/modal-content.d.ts +0 -0
- package/core/components/ui/modal/modal-content.js +0 -5
- package/core/components/ui/modal/modal-subtitle.d.ts +0 -0
- package/core/components/ui/modal/modal-subtitle.js +2 -6
- package/core/components/ui/modal/modal-title.d.ts +0 -0
- package/core/components/ui/modal/modal-title.js +0 -5
- package/core/components/ui/modal/modal.d.ts +7 -7
- package/core/components/ui/modal/modal.js +36 -36
- package/core/components/ui/pop/pop.d.ts +2 -1
- package/core/components/ui/pop/pop.js +11 -10
- package/core/components/ui/progress/progress.d.ts +0 -0
- package/core/components/ui/progress/progress.js +34 -32
- package/core/components/ui/table/table-caption.d.ts +0 -0
- package/core/components/ui/table/table-caption.js +5 -10
- package/core/components/ui/table/table-tbody.d.ts +0 -0
- package/core/components/ui/table/table-tbody.js +10 -14
- package/core/components/ui/table/table-td.d.ts +2 -0
- package/core/components/ui/table/table-td.js +8 -5
- package/core/components/ui/table/table-tfoot.d.ts +0 -0
- package/core/components/ui/table/table-tfoot.js +5 -7
- package/core/components/ui/table/table-th.d.ts +2 -0
- package/core/components/ui/table/table-th.js +12 -9
- package/core/components/ui/table/table-thead.d.ts +0 -0
- package/core/components/ui/table/table-thead.js +1 -6
- package/core/components/ui/table/table-tr.d.ts +0 -0
- package/core/components/ui/table/table-tr.js +4 -6
- package/core/components/ui/table/table.d.ts +0 -3
- package/core/components/ui/table/table.js +14 -31
- package/core/components/ui/taxonomy/taxonomy.d.ts +6 -3
- package/core/components/ui/taxonomy/taxonomy.js +9 -9
- package/core/components/ui/theme/css/tailwind.css +0 -0
- package/core/components/ui/theme/css/tailwind.d.ts +0 -0
- package/core/components/ui/theme/theme-collection/core-variables.d.ts +0 -0
- package/core/components/ui/theme/theme-collection/core-variables.js +13 -11
- package/core/components/ui/theme/theme-collection/dark.d.ts +0 -0
- package/core/components/ui/theme/theme-collection/dark.js +1 -1
- package/core/components/ui/theme/theme-collection/light.d.ts +0 -0
- package/core/components/ui/theme/theme-collection/light.js +0 -0
- package/core/components/ui/theme/theme.d.ts +1 -6
- package/core/components/ui/theme/theme.js +7 -36
- package/core/components/ui/toast/message-subscriber.d.ts +13 -7
- package/core/components/ui/toast/message-subscriber.js +0 -0
- package/core/components/ui/toast/toast-item.d.ts +0 -0
- package/core/components/ui/toast/toast-item.js +1 -1
- package/core/components/ui/toast/toast.d.ts +2 -1
- package/core/components/ui/toast/toast.js +29 -14
- package/core/components/ui/toast/types.d.ts +0 -0
- package/core/components/ui/toast/types.js +0 -0
- package/core/components/ui/tooltip/tooltip.d.ts +1 -0
- package/core/components/ui/tooltip/tooltip.js +35 -14
- package/core/components/ui/ui.d.ts +1 -0
- package/core/components/ui/ui.js +1 -3
- package/core/core.d.ts +0 -0
- package/core/core.js +5 -6
- package/core/mixins/Fetcher.d.ts +19 -10
- package/core/mixins/Fetcher.js +26 -10
- package/core/mixins/FormCheckable.d.ts +17 -8
- package/core/mixins/FormCheckable.js +177 -22
- package/core/mixins/FormElement.d.ts +12 -7
- package/core/mixins/FormElement.js +42 -26
- package/core/mixins/FormInput.d.ts +8 -4
- package/core/mixins/FormInput.js +4 -3
- package/core/mixins/Subscriber.d.ts +7 -5
- package/core/mixins/Subscriber.js +34 -32
- package/core/mixins/TemplatesContainer.d.ts +0 -0
- package/core/mixins/TemplatesContainer.js +0 -0
- package/core/mixins/mixins.d.ts +0 -0
- package/core/mixins/mixins.js +0 -0
- package/core/utils/Arrays.d.ts +15 -15
- package/core/utils/Arrays.js +0 -0
- package/core/utils/DataBindObserver.d.ts +16 -9
- package/core/utils/DataBindObserver.js +23 -28
- package/core/utils/Electron.d.ts +5 -1
- package/core/utils/Electron.js +4 -2
- package/core/utils/Format.d.ts +0 -0
- package/core/utils/Format.js +0 -0
- package/core/utils/HTML.d.ts +9 -2
- package/core/utils/HTML.js +22 -3
- package/core/utils/LocationHandler.d.ts +6 -5
- package/core/utils/LocationHandler.js +19 -8
- package/core/utils/Objects.d.ts +7 -4
- package/core/utils/Objects.js +28 -6
- package/core/utils/{PublisherProxy.d.mts → PublisherProxy.d.ts} +40 -31
- package/core/utils/{PublisherProxy.mjs → PublisherProxy.js} +54 -28
- package/core/utils/Utils.d.ts +3 -0
- package/core/utils/Utils.js +18 -0
- package/core/utils/api.d.ts +39 -7
- package/core/utils/api.js +45 -32
- package/img/concorde-logo.svg +1 -0
- package/img/concorde.png +0 -0
- package/img/concorde_def.png +0 -0
- package/mixins.d.ts +36 -18
- package/mixins.js +3 -4
- package/package.json +47 -10
- package/svg/regular/plane.svg +1 -0
- package/svg/solid/plane.svg +1 -0
- package/test-utils/TestUtils.d.ts +4 -0
- package/test-utils/TestUtils.js +12 -0
- package/utils.d.ts +3 -1
- package/utils.js +7 -5
- package/core/components/functional/configuration/configuration.d.ts +0 -5
- package/core/components/functional/configuration/configuration.js +0 -22
- package/core/components/ui/tabs/tab.d.ts +0 -6
- package/core/components/ui/tabs/tab.js +0 -46
- package/core/components/ui/tabs/tabs.d.ts +0 -15
- package/core/components/ui/tabs/tabs.js +0 -129
|
@@ -87,7 +87,7 @@ export default class SDUIDescriptorTransformer {
|
|
|
87
87
|
return false;
|
|
88
88
|
if (patternAttributes) {
|
|
89
89
|
for (let name in patternAttributes) {
|
|
90
|
-
if (!this.stringMatchesExpression(nodeAttributes[name], patternAttributes[name])) {
|
|
90
|
+
if (!nodeAttributes || !this.stringMatchesExpression(nodeAttributes[name], patternAttributes[name])) {
|
|
91
91
|
return false;
|
|
92
92
|
}
|
|
93
93
|
}
|
|
@@ -97,7 +97,7 @@ export default class SDUIDescriptorTransformer {
|
|
|
97
97
|
/**
|
|
98
98
|
* Pour chaque élément de la liste, remplace l'élément par ses enfants
|
|
99
99
|
*/
|
|
100
|
-
|
|
100
|
+
unwrap(transformAction, list) {
|
|
101
101
|
var _a, _b;
|
|
102
102
|
transformAction;
|
|
103
103
|
for (let item of list) {
|
|
@@ -112,7 +112,7 @@ export default class SDUIDescriptorTransformer {
|
|
|
112
112
|
* L'élément créé est inséré en lieu et place du premier élément de la liste
|
|
113
113
|
*/
|
|
114
114
|
wrap(transformAction, list) {
|
|
115
|
-
var _a, _b, _c, _d, _e;
|
|
115
|
+
var _a, _b, _c, _d, _e, _f;
|
|
116
116
|
let wrapper = Object.assign({}, transformAction.ui);
|
|
117
117
|
if (!wrapper.nodes)
|
|
118
118
|
wrapper.nodes = [];
|
|
@@ -124,10 +124,10 @@ export default class SDUIDescriptorTransformer {
|
|
|
124
124
|
}
|
|
125
125
|
i++;
|
|
126
126
|
}
|
|
127
|
-
let idx = (_c = list[0].parent.nodes) === null ||
|
|
127
|
+
let idx = (_d = (_c = list[0]) === null || _c === void 0 ? void 0 : _c.parent.nodes) === null || _d === void 0 ? void 0 : _d.indexOf(list[0].child);
|
|
128
128
|
if (idx) {
|
|
129
|
-
(
|
|
130
|
-
(
|
|
129
|
+
(_e = list[0].parent.nodes) === null || _e === void 0 ? void 0 : _e.splice(idx, 1);
|
|
130
|
+
(_f = list[0].parent.nodes) === null || _f === void 0 ? void 0 : _f.splice(idx, 0, wrapper);
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
/**
|
|
@@ -137,10 +137,14 @@ export default class SDUIDescriptorTransformer {
|
|
|
137
137
|
var _a, _b;
|
|
138
138
|
for (let item of list) {
|
|
139
139
|
(_a = item.parent.nodes) === null || _a === void 0 ? void 0 : _a.splice(item.parent.nodes.indexOf(item.child), 1);
|
|
140
|
-
let
|
|
141
|
-
|
|
140
|
+
let list = [];
|
|
141
|
+
if (transformAction.after)
|
|
142
|
+
list = this.getNodesMatchingPatterns([transformAction.after], this.sduiDescriptor);
|
|
143
|
+
if (transformAction.before)
|
|
144
|
+
list = this.getNodesMatchingPatterns([transformAction.before], this.sduiDescriptor);
|
|
145
|
+
let element = list[0];
|
|
142
146
|
if (element) {
|
|
143
|
-
(_b = element.parent.nodes) === null || _b === void 0 ? void 0 : _b.splice(element.parent.nodes.indexOf(element.child) + (
|
|
147
|
+
(_b = element.parent.nodes) === null || _b === void 0 ? void 0 : _b.splice(element.parent.nodes.indexOf(element.child) + (transformAction.after ? 1 : 0), 0, item.child);
|
|
144
148
|
}
|
|
145
149
|
}
|
|
146
150
|
}
|
|
@@ -150,7 +154,6 @@ export default class SDUIDescriptorTransformer {
|
|
|
150
154
|
*/
|
|
151
155
|
remap(transformAction, list) {
|
|
152
156
|
var _a, _b, _c;
|
|
153
|
-
console.log(list);
|
|
154
157
|
for (let item of list) {
|
|
155
158
|
let newUI = Object.assign({}, transformAction.ui);
|
|
156
159
|
if (!newUI.attributes) {
|
|
@@ -202,9 +205,18 @@ export default class SDUIDescriptorTransformer {
|
|
|
202
205
|
*/
|
|
203
206
|
insert(transformAction, list) {
|
|
204
207
|
var _a;
|
|
205
|
-
list;
|
|
206
208
|
let positionType = transformAction.after ? "after" : transformAction.before ? "before" : "in";
|
|
207
|
-
|
|
209
|
+
list = [];
|
|
210
|
+
if (transformAction.after) {
|
|
211
|
+
list = this.getNodesMatchingPatterns([transformAction.after], this.sduiDescriptor);
|
|
212
|
+
}
|
|
213
|
+
else if (transformAction.before) {
|
|
214
|
+
list = this.getNodesMatchingPatterns([transformAction.before], this.sduiDescriptor);
|
|
215
|
+
}
|
|
216
|
+
else if (transformAction.in) {
|
|
217
|
+
list = this.getNodesMatchingPatterns([transformAction.in], this.sduiDescriptor);
|
|
218
|
+
}
|
|
219
|
+
let node = list[0];
|
|
208
220
|
if (node) {
|
|
209
221
|
if (positionType == "in") {
|
|
210
222
|
if (!node.child.nodes)
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
{
|
|
2
|
+
"checkbox": {
|
|
3
|
+
"tagName": "sonic-checkbox"
|
|
4
|
+
},
|
|
5
|
+
"date": {
|
|
6
|
+
"tagName": "sonic-input",
|
|
7
|
+
"attributes": {
|
|
8
|
+
"type": "date"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"fieldset": {
|
|
12
|
+
"tagName": "sonic-fieldset",
|
|
13
|
+
"nodes": [{ "libraryKey": "formLayout" }],
|
|
14
|
+
"contentElementSelector": "sonic-form-layout"
|
|
15
|
+
},
|
|
16
|
+
"managed_file": {
|
|
17
|
+
"tagName": "sonic-input",
|
|
18
|
+
"attributes": {
|
|
19
|
+
"variant": "ghost",
|
|
20
|
+
"type": "file"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"password": {
|
|
24
|
+
"tagName": "sonic-input",
|
|
25
|
+
"attributes": {
|
|
26
|
+
"type": "password"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"radio": {
|
|
30
|
+
"tagName": "sonic-radio"
|
|
31
|
+
},
|
|
32
|
+
"select": {
|
|
33
|
+
"tagName": "sonic-select"
|
|
34
|
+
},
|
|
35
|
+
"textarea": {
|
|
36
|
+
"tagName": "sonic-textarea"
|
|
37
|
+
},
|
|
38
|
+
"textfield": {
|
|
39
|
+
"tagName": "sonic-input",
|
|
40
|
+
"attributes": {
|
|
41
|
+
"type": "text"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"hidden": {
|
|
45
|
+
"tagName": "sonic-input",
|
|
46
|
+
"attributes": {
|
|
47
|
+
"type": "hidden"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"button": {
|
|
51
|
+
"tagName": "sonic-button"
|
|
52
|
+
},
|
|
53
|
+
"form": {
|
|
54
|
+
"tagName": "sonic-submit",
|
|
55
|
+
"attributes": {
|
|
56
|
+
"onEnterKey": true
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"submit": {
|
|
60
|
+
"tagName": "sonic-submit",
|
|
61
|
+
"attributes": {
|
|
62
|
+
"onClick": true
|
|
63
|
+
},
|
|
64
|
+
"contentElementSelector": "sonic-button",
|
|
65
|
+
"nodes": [
|
|
66
|
+
{
|
|
67
|
+
"libraryKey": "button",
|
|
68
|
+
"attributes": { "type": "success" },
|
|
69
|
+
"nodes": [
|
|
70
|
+
{
|
|
71
|
+
"tagName": "sonic-icon",
|
|
72
|
+
"attributes": {
|
|
73
|
+
"name": "check",
|
|
74
|
+
"slot": "prefix"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
"email": {
|
|
82
|
+
"tagName": "sonic-input",
|
|
83
|
+
"attributes": {
|
|
84
|
+
"type": "email"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"formItemContainer": {
|
|
88
|
+
"tagName": "div",
|
|
89
|
+
"attributes": {
|
|
90
|
+
"class": "form-item-container"
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"formLayout": {
|
|
94
|
+
"tagName": "sonic-form-layout"
|
|
95
|
+
},
|
|
96
|
+
"formActions": {
|
|
97
|
+
"tagName": "sonic-form-actions"
|
|
98
|
+
},
|
|
99
|
+
"passwordHelper": {
|
|
100
|
+
"tagName": "sonic-password-helper"
|
|
101
|
+
},
|
|
102
|
+
"sameValueHelper": {
|
|
103
|
+
"tagName": "sonic-same-value-helper"
|
|
104
|
+
},
|
|
105
|
+
"divider": {
|
|
106
|
+
"tagName": "sonic-divider"
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export default class SDUIUtils {
|
|
2
|
+
static toJson(nodes) {
|
|
3
|
+
const desc = {};
|
|
4
|
+
desc.nodes = [];
|
|
5
|
+
for (let node of nodes) {
|
|
6
|
+
const parsedChild = SDUIUtils.parseNode(node);
|
|
7
|
+
if (parsedChild) {
|
|
8
|
+
desc.nodes.push(parsedChild);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
let dataStr = "data:text/json;charset=utf-8," + encodeURIComponent(JSON.stringify(desc, null, 2));
|
|
12
|
+
let dlAnchorElem = document.createElement("a");
|
|
13
|
+
dlAnchorElem.setAttribute("href", dataStr);
|
|
14
|
+
dlAnchorElem.setAttribute("download", "sdui.json");
|
|
15
|
+
document.body.appendChild(dlAnchorElem);
|
|
16
|
+
dlAnchorElem.click();
|
|
17
|
+
dlAnchorElem.remove();
|
|
18
|
+
return JSON.stringify(desc, null, 4);
|
|
19
|
+
}
|
|
20
|
+
static parseNode(node) {
|
|
21
|
+
let sdui = {};
|
|
22
|
+
let nodeType = node.nodeType;
|
|
23
|
+
if (nodeType == Node.ELEMENT_NODE) {
|
|
24
|
+
let name = node.nodeName.toLowerCase();
|
|
25
|
+
sdui.tagName = name;
|
|
26
|
+
let element = node;
|
|
27
|
+
sdui.attributes = {};
|
|
28
|
+
const attributes = element.attributes;
|
|
29
|
+
const attrLength = attributes.length;
|
|
30
|
+
for (let i = 0; i < attrLength; i++) {
|
|
31
|
+
let attribute = attributes.item(i);
|
|
32
|
+
if (attribute)
|
|
33
|
+
sdui.attributes[attribute.name] = attribute.value;
|
|
34
|
+
}
|
|
35
|
+
let childNodes = element.childNodes;
|
|
36
|
+
let children = element.children;
|
|
37
|
+
if (name == "template") {
|
|
38
|
+
let template = node;
|
|
39
|
+
childNodes = template.content.childNodes;
|
|
40
|
+
children = template.content.children;
|
|
41
|
+
}
|
|
42
|
+
if (children.length > 0) {
|
|
43
|
+
sdui.nodes = [];
|
|
44
|
+
for (let ch of childNodes) {
|
|
45
|
+
const parsedChild = SDUIUtils.parseNode(ch);
|
|
46
|
+
if (parsedChild) {
|
|
47
|
+
sdui.nodes.push(parsedChild);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
else if (element.innerHTML) {
|
|
52
|
+
sdui.innerHTML = element.innerHTML;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (nodeType == Node.TEXT_NODE) {
|
|
56
|
+
let content = (node.textContent || "").trim();
|
|
57
|
+
if (!content)
|
|
58
|
+
return null;
|
|
59
|
+
sdui.markup = content;
|
|
60
|
+
}
|
|
61
|
+
return sdui;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import { LitElement } from "lit";
|
|
2
|
-
import { SDUIDescriptor } from "@supersoniks/concorde/core/components/functional/sdui/types";
|
|
3
3
|
declare const SonicSDUI_base: {
|
|
4
4
|
new (...args: any[]): {
|
|
5
|
-
api: import("../../../utils/api").default | null;
|
|
5
|
+
api: import("../../../utils/api").default<any, any> | null;
|
|
6
6
|
key: String;
|
|
7
7
|
isFirstLoad: boolean;
|
|
8
8
|
isLoading: boolean;
|
|
@@ -11,8 +11,11 @@ declare const SonicSDUI_base: {
|
|
|
11
11
|
isFetchEnabled: boolean;
|
|
12
12
|
_endPoint: string;
|
|
13
13
|
endPoint: string;
|
|
14
|
+
requestId: number;
|
|
15
|
+
refetchEveryMs: number;
|
|
16
|
+
refetchTimeOutId?: NodeJS.Timeout | undefined;
|
|
14
17
|
_fetchData(): Promise<void>;
|
|
15
|
-
onInvalidate
|
|
18
|
+
onInvalidate?: (() => void) | undefined;
|
|
16
19
|
disconnectedCallback(): void;
|
|
17
20
|
connectedCallback(): void;
|
|
18
21
|
firstUpdated(): void;
|
|
@@ -29,6 +32,7 @@ declare const SonicSDUI_base: {
|
|
|
29
32
|
debug: HTMLElement | null;
|
|
30
33
|
defferedDebug: boolean | null;
|
|
31
34
|
displayContents: boolean;
|
|
35
|
+
shadowRoot?: ShadowRoot | undefined;
|
|
32
36
|
dispatchEvent(event: Event): void;
|
|
33
37
|
setAttribute(name: string, value: string): void;
|
|
34
38
|
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
@@ -40,7 +44,7 @@ declare const SonicSDUI_base: {
|
|
|
40
44
|
getAttribute(name: string): string;
|
|
41
45
|
hasAttribute(attributeName: String): boolean;
|
|
42
46
|
};
|
|
43
|
-
} & (new (...args: any[]) => import("../../../mixins/Subscriber").SubscriberInterface) & typeof LitElement;
|
|
47
|
+
} & (new (...args: any[]) => import("../../../mixins/Subscriber").SubscriberInterface<any>) & typeof LitElement;
|
|
44
48
|
/**
|
|
45
49
|
* ### sonic-sdui (Server Driven User Interface) est un fetcher chargant un JSON décrivant une interface utilisateur
|
|
46
50
|
*
|
|
@@ -60,13 +64,16 @@ declare const SonicSDUI_base: {
|
|
|
60
64
|
*/
|
|
61
65
|
export declare class SonicSDUI extends SonicSDUI_base {
|
|
62
66
|
connectedCallback(): void;
|
|
67
|
+
sduiKey?: string;
|
|
68
|
+
messagesKey?: string;
|
|
69
|
+
private sduiDescriptor;
|
|
63
70
|
/**
|
|
64
71
|
* On peut passer la description sous form de props, sinon il faut utiliser l'attribut fetch
|
|
65
72
|
*/
|
|
66
|
-
get props():
|
|
67
|
-
set props(value:
|
|
73
|
+
get props(): any;
|
|
74
|
+
set props(value: any);
|
|
68
75
|
/**
|
|
69
|
-
* updateContents est déclenché quand les
|
|
76
|
+
* updateContents est déclenché quand les sduiDescriptor sont renseignées
|
|
70
77
|
* Le contenu du composant est regénéré en fonction du descripteur fourni
|
|
71
78
|
*/
|
|
72
79
|
updateContents(): Promise<void>;
|
|
@@ -79,9 +86,13 @@ export declare class SonicSDUI extends SonicSDUI_base {
|
|
|
79
86
|
**/
|
|
80
87
|
private loadAssets;
|
|
81
88
|
/**
|
|
82
|
-
* Transformation de la data fournie via
|
|
89
|
+
* Transformation de la data fournie via sduiDescriptor si il y a un attribut transformation
|
|
83
90
|
* */
|
|
84
91
|
private transformSDUIDescriptor;
|
|
92
|
+
/**
|
|
93
|
+
* Charge la library à utiliser
|
|
94
|
+
* */
|
|
95
|
+
private loadLibrary;
|
|
85
96
|
/**
|
|
86
97
|
* Point d'entrée : transformation des noeuds fournis en éléments graphiques
|
|
87
98
|
**/
|
|
@@ -91,7 +102,7 @@ export declare class SonicSDUI extends SonicSDUI_base {
|
|
|
91
102
|
*/
|
|
92
103
|
private parseChild;
|
|
93
104
|
/**
|
|
94
|
-
* Si le noeud courant a des propriétés prefix et ou suffix il est entouré des markups fournis dans ces
|
|
105
|
+
* Si le noeud courant a des propriétés prefix et ou suffix il est entouré des markups fournis dans ces sduiDescriptor.
|
|
95
106
|
* Le tout est inclu dans une div en display contents
|
|
96
107
|
*/
|
|
97
108
|
private handlePrefixSuffix;
|
|
@@ -13,12 +13,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
13
13
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
|
-
import
|
|
17
|
-
import
|
|
16
|
+
import default_library from "@supersoniks/concorde/core/components/functional/sdui/default-library.json";
|
|
17
|
+
import SDUIDescriptorTransformer from "@supersoniks/concorde/core/components/functional/sdui/SDUIDescriptorTransformer";
|
|
18
18
|
import { Fetcher, Subscriber } from "@supersoniks/concorde/mixins";
|
|
19
19
|
import { HTML, Objects } from "@supersoniks/concorde/utils";
|
|
20
|
+
import { LitElement } from "lit";
|
|
21
|
+
import { customElement, property } from "lit/decorators.js";
|
|
20
22
|
const tagName = "sonic-sdui"; // For Astro.build
|
|
21
|
-
import SDUIDescriptorTransformer from "@supersoniks/concorde/core/components/functional/sdui/SDUIDescriptorTransformer";
|
|
22
23
|
/**
|
|
23
24
|
* ### sonic-sdui (Server Driven User Interface) est un fetcher chargant un JSON décrivant une interface utilisateur
|
|
24
25
|
*
|
|
@@ -37,6 +38,10 @@ import SDUIDescriptorTransformer from "@supersoniks/concorde/core/components/fun
|
|
|
37
38
|
* *
|
|
38
39
|
*/
|
|
39
40
|
let SonicSDUI = class SonicSDUI extends Fetcher(Subscriber(LitElement)) {
|
|
41
|
+
constructor() {
|
|
42
|
+
super(...arguments);
|
|
43
|
+
this.sduiDescriptor = {};
|
|
44
|
+
}
|
|
40
45
|
connectedCallback() {
|
|
41
46
|
this.noShadowDom = "";
|
|
42
47
|
this.displayContents = true;
|
|
@@ -50,19 +55,28 @@ let SonicSDUI = class SonicSDUI extends Fetcher(Subscriber(LitElement)) {
|
|
|
50
55
|
return super.props;
|
|
51
56
|
}
|
|
52
57
|
set props(value) {
|
|
58
|
+
if (value === this.props)
|
|
59
|
+
return;
|
|
53
60
|
super.props = value;
|
|
61
|
+
let newSduiDescriptor = this.sduiKey ? value[this.sduiKey] : value;
|
|
62
|
+
if (this.sduiDescriptor == newSduiDescriptor)
|
|
63
|
+
return;
|
|
64
|
+
this.sduiDescriptor = newSduiDescriptor;
|
|
54
65
|
this.updateContents();
|
|
55
66
|
}
|
|
56
67
|
/**
|
|
57
|
-
* updateContents est déclenché quand les
|
|
68
|
+
* updateContents est déclenché quand les sduiDescriptor sont renseignées
|
|
58
69
|
* Le contenu du composant est regénéré en fonction du descripteur fourni
|
|
59
70
|
*/
|
|
60
71
|
updateContents() {
|
|
61
72
|
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
-
this.
|
|
63
|
-
if (!this.props)
|
|
73
|
+
if (!this.sduiDescriptor)
|
|
64
74
|
return;
|
|
75
|
+
let library = {};
|
|
76
|
+
Object.assign(library, default_library, this.sduiDescriptor.library);
|
|
77
|
+
this.sduiDescriptor.library = library;
|
|
65
78
|
this.loadAssets();
|
|
79
|
+
yield this.loadLibrary();
|
|
66
80
|
yield this.transformSDUIDescriptor();
|
|
67
81
|
this.parseRootNodes();
|
|
68
82
|
});
|
|
@@ -79,19 +93,19 @@ let SonicSDUI = class SonicSDUI extends Fetcher(Subscriber(LitElement)) {
|
|
|
79
93
|
* Chargement de fichiers js et css associés si besoin
|
|
80
94
|
**/
|
|
81
95
|
loadAssets() {
|
|
82
|
-
if (!this.
|
|
96
|
+
if (!this.sduiDescriptor)
|
|
83
97
|
return;
|
|
84
|
-
if (this.
|
|
85
|
-
for (const src of this.
|
|
98
|
+
if (this.sduiDescriptor.js) {
|
|
99
|
+
for (const src of this.sduiDescriptor.js)
|
|
86
100
|
HTML.loadJS(src);
|
|
87
101
|
}
|
|
88
|
-
if (this.
|
|
89
|
-
for (const src of this.
|
|
102
|
+
if (this.sduiDescriptor.css) {
|
|
103
|
+
for (const src of this.sduiDescriptor.css)
|
|
90
104
|
HTML.loadCSS(src);
|
|
91
105
|
}
|
|
92
106
|
}
|
|
93
107
|
/**
|
|
94
|
-
* Transformation de la data fournie via
|
|
108
|
+
* Transformation de la data fournie via sduiDescriptor si il y a un attribut transformation
|
|
95
109
|
* */
|
|
96
110
|
transformSDUIDescriptor() {
|
|
97
111
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -100,18 +114,36 @@ let SonicSDUI = class SonicSDUI extends Fetcher(Subscriber(LitElement)) {
|
|
|
100
114
|
let result = yield fetch(this.getAttribute("transformation"));
|
|
101
115
|
let json = yield result.json();
|
|
102
116
|
let transformer = new SDUIDescriptorTransformer();
|
|
103
|
-
yield transformer.transform(this.
|
|
117
|
+
yield transformer.transform(this.sduiDescriptor, json);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Charge la library à utiliser
|
|
122
|
+
* */
|
|
123
|
+
loadLibrary() {
|
|
124
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
125
|
+
if (!this.hasAttribute("library"))
|
|
126
|
+
return;
|
|
127
|
+
let result = yield fetch(this.getAttribute("library"));
|
|
128
|
+
let json = yield result.json();
|
|
129
|
+
this.sduiDescriptor.library = json;
|
|
104
130
|
});
|
|
105
131
|
}
|
|
106
132
|
/**
|
|
107
133
|
* Point d'entrée : transformation des noeuds fournis en éléments graphiques
|
|
108
134
|
**/
|
|
109
135
|
parseRootNodes() {
|
|
110
|
-
|
|
136
|
+
this.removeChildren();
|
|
137
|
+
if (!this.sduiDescriptor)
|
|
111
138
|
return;
|
|
112
|
-
let nodes = this.
|
|
139
|
+
let nodes = this.sduiDescriptor.nodes;
|
|
113
140
|
if (!nodes)
|
|
114
|
-
|
|
141
|
+
nodes = [];
|
|
142
|
+
let messageProvider = { tagName: "sonic-toast-message-subscriber", attributes: {} };
|
|
143
|
+
if (this.messagesKey) {
|
|
144
|
+
messageProvider.attributes = { subDataProvider: this.messagesKey };
|
|
145
|
+
}
|
|
146
|
+
nodes.push(messageProvider);
|
|
115
147
|
nodes.forEach((node) => this.appendChild(this.parseChild(node)));
|
|
116
148
|
}
|
|
117
149
|
/**
|
|
@@ -133,7 +165,7 @@ let SonicSDUI = class SonicSDUI extends Fetcher(Subscriber(LitElement)) {
|
|
|
133
165
|
return element;
|
|
134
166
|
}
|
|
135
167
|
/**
|
|
136
|
-
* Si le noeud courant a des propriétés prefix et ou suffix il est entouré des markups fournis dans ces
|
|
168
|
+
* Si le noeud courant a des propriétés prefix et ou suffix il est entouré des markups fournis dans ces sduiDescriptor.
|
|
137
169
|
* Le tout est inclu dans une div en display contents
|
|
138
170
|
*/
|
|
139
171
|
handlePrefixSuffix(node, element) {
|
|
@@ -157,6 +189,10 @@ let SonicSDUI = class SonicSDUI extends Fetcher(Subscriber(LitElement)) {
|
|
|
157
189
|
}
|
|
158
190
|
if (nodeToAppendOn.shadowRoot)
|
|
159
191
|
nodeToAppendOn.shadowRoot.appendChild(childElement);
|
|
192
|
+
else if (nodeToAppendOn.tagName.toLocaleLowerCase() == "template") {
|
|
193
|
+
let template = nodeToAppendOn;
|
|
194
|
+
template.content.appendChild(childElement);
|
|
195
|
+
}
|
|
160
196
|
else
|
|
161
197
|
nodeToAppendOn.appendChild(childElement);
|
|
162
198
|
}
|
|
@@ -172,9 +208,9 @@ let SonicSDUI = class SonicSDUI extends Fetcher(Subscriber(LitElement)) {
|
|
|
172
208
|
handleLibrary(node, tagName) {
|
|
173
209
|
let element;
|
|
174
210
|
let contentElement;
|
|
175
|
-
if (node.libraryKey && this.
|
|
176
|
-
element = this.parseChild(this.
|
|
177
|
-
let selector = (this.
|
|
211
|
+
if (node.libraryKey && this.sduiDescriptor.library) {
|
|
212
|
+
element = this.parseChild(this.sduiDescriptor.library[node.libraryKey] || { tagName: "div" });
|
|
213
|
+
let selector = (this.sduiDescriptor.library[node.libraryKey] || {}).contentElementSelector;
|
|
178
214
|
if (selector)
|
|
179
215
|
contentElement = element.querySelector(selector);
|
|
180
216
|
}
|
|
@@ -188,10 +224,8 @@ let SonicSDUI = class SonicSDUI extends Fetcher(Subscriber(LitElement)) {
|
|
|
188
224
|
handleAttributes(node, element) {
|
|
189
225
|
let attributes = node.attributes;
|
|
190
226
|
for (let k in attributes) {
|
|
191
|
-
let
|
|
192
|
-
|
|
193
|
-
attr = JSON.stringify(attr);
|
|
194
|
-
}
|
|
227
|
+
let attrData = attributes[k];
|
|
228
|
+
let attr = Objects.isObject(attrData) ? JSON.stringify(attrData) : attrData;
|
|
195
229
|
element.setAttribute(k, attr);
|
|
196
230
|
}
|
|
197
231
|
}
|
|
@@ -225,6 +259,12 @@ let SonicSDUI = class SonicSDUI extends Fetcher(Subscriber(LitElement)) {
|
|
|
225
259
|
}
|
|
226
260
|
}
|
|
227
261
|
};
|
|
262
|
+
__decorate([
|
|
263
|
+
property()
|
|
264
|
+
], SonicSDUI.prototype, "sduiKey", void 0);
|
|
265
|
+
__decorate([
|
|
266
|
+
property()
|
|
267
|
+
], SonicSDUI.prototype, "messagesKey", void 0);
|
|
228
268
|
__decorate([
|
|
229
269
|
property()
|
|
230
270
|
], SonicSDUI.prototype, "props", null);
|
|
@@ -8,7 +8,7 @@ export declare type SDUINode = {
|
|
|
8
8
|
libraryKey?: string;
|
|
9
9
|
markup?: string;
|
|
10
10
|
tagName?: string;
|
|
11
|
-
attributes
|
|
11
|
+
attributes?: Record<string, string>;
|
|
12
12
|
nodes?: Array<SDUINode>;
|
|
13
13
|
innerHTML?: string;
|
|
14
14
|
prefix?: string;
|
|
@@ -20,8 +20,10 @@ export declare type SDUITransformDescription = {
|
|
|
20
20
|
library?: Record<string, SDUINode>;
|
|
21
21
|
transforms: Array<SDUITransformAction>;
|
|
22
22
|
};
|
|
23
|
+
export declare type SDUITransformActionName = "remap" | "unwrap" | "wrap" | "delete" | "insert" | "move";
|
|
24
|
+
export declare type SDUITransformActionFunction = (transformAction: SDUITransformAction, list: SDUITransformList) => void;
|
|
23
25
|
export declare type SDUITransformAction = {
|
|
24
|
-
action:
|
|
26
|
+
action: SDUITransformActionName;
|
|
25
27
|
patterns?: Array<SDUINode>;
|
|
26
28
|
after?: SDUINode;
|
|
27
29
|
before?: SDUINode;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,11 +1,27 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
|
-
|
|
2
|
+
import { PublisherInterface, TypeAndRecordOfType } from "@supersoniks/concorde/core/_types/types";
|
|
3
|
+
declare const SonicStates_base: (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface<any>) & (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/TemplatesContainer").TemplatesContainerInterface) & typeof LitElement;
|
|
4
|
+
/**
|
|
5
|
+
* ### sonic-states affiche des états différents en fonction de la valeur d'une sous propriété de son dataProvider (attribut data-path en dot notation):
|
|
6
|
+
* * Il boucle sur ses template enfants et test si la regexp contenue dans l'attribut *data-value* match la valeur de la propriété
|
|
7
|
+
* * Si oui le contenu du template correspontant est affiché comme état.
|
|
8
|
+
* * Si l'attribut dataProviderExpression est fourni le contenu est entouré d'une div :
|
|
9
|
+
* * L'attribut "dataProvider" de cette div est le resultat de l'appel à la fonction replace sur valeur de la propriété avec comme paramettres la regexp et dataproviderExpression.
|
|
10
|
+
* * Les subscribers/fetch... du template se réfèrerons à ce dataProvider
|
|
11
|
+
* * On peut également utiliser les des expressions du type url-pattern pour les paramètres de la route voir les exemples
|
|
12
|
+
*
|
|
13
|
+
* **Exemples**
|
|
14
|
+
* Avec ma.propriete= 2 :
|
|
15
|
+
* * RegExp data-value = (\d+) et dataproviderExpression = /user/$1 l'attribut dataProvider vaudra "/user/2"
|
|
16
|
+
* * url-pattern data-value = :id et dataproviderExpression = /user/:id l'attribut dataProvider vaudra "/user/2"
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
3
19
|
export declare class SonicStates extends SonicStates_base {
|
|
4
20
|
state: string;
|
|
5
21
|
inverted: Boolean;
|
|
6
22
|
statePath: string;
|
|
7
|
-
onAssign: (
|
|
8
|
-
statePublisher
|
|
23
|
+
onAssign: (value: string) => void;
|
|
24
|
+
statePublisher?: TypeAndRecordOfType<PublisherInterface<string & Record<string, any>>>;
|
|
9
25
|
connectedCallback(): void;
|
|
10
26
|
disconnectedCallback(): void;
|
|
11
27
|
render(): import("lit-html").TemplateResult<1>;
|
|
@@ -12,6 +12,7 @@ import { repeat } from "lit/directives/repeat.js";
|
|
|
12
12
|
import Objects from "@supersoniks/concorde/core/utils/Objects";
|
|
13
13
|
import UrlPattern from "url-pattern";
|
|
14
14
|
import TemplatesContainer from "@supersoniks/concorde/core/mixins/TemplatesContainer";
|
|
15
|
+
const tagName = "sonic-states";
|
|
15
16
|
/**
|
|
16
17
|
* ### sonic-states affiche des états différents en fonction de la valeur d'une sous propriété de son dataProvider (attribut data-path en dot notation):
|
|
17
18
|
* * Il boucle sur ses template enfants et test si la regexp contenue dans l'attribut *data-value* match la valeur de la propriété
|
|
@@ -27,14 +28,16 @@ import TemplatesContainer from "@supersoniks/concorde/core/mixins/TemplatesConta
|
|
|
27
28
|
* * url-pattern data-value = :id et dataproviderExpression = /user/:id l'attribut dataProvider vaudra "/user/2"
|
|
28
29
|
*
|
|
29
30
|
*/
|
|
30
|
-
const tagName = "sonic-states";
|
|
31
31
|
let SonicStates = class SonicStates extends Subscriber(TemplatesContainer(LitElement)) {
|
|
32
32
|
constructor() {
|
|
33
33
|
super(...arguments);
|
|
34
34
|
this.state = "";
|
|
35
35
|
this.inverted = false;
|
|
36
36
|
this.statePath = "";
|
|
37
|
-
this.onAssign =
|
|
37
|
+
this.onAssign = (value) => {
|
|
38
|
+
this.state = value;
|
|
39
|
+
this.requestUpdate();
|
|
40
|
+
};
|
|
38
41
|
}
|
|
39
42
|
connectedCallback() {
|
|
40
43
|
super.connectedCallback();
|
|
@@ -47,16 +50,13 @@ let SonicStates = class SonicStates extends Subscriber(TemplatesContainer(LitEle
|
|
|
47
50
|
for (let s of split) {
|
|
48
51
|
this.statePublisher = this.statePublisher[s];
|
|
49
52
|
}
|
|
50
|
-
this.onAssign = (value) => {
|
|
51
|
-
this.state = value;
|
|
52
|
-
this.requestUpdate();
|
|
53
|
-
};
|
|
54
53
|
this.statePublisher.onAssign(this.onAssign);
|
|
55
54
|
}
|
|
56
55
|
}
|
|
57
56
|
disconnectedCallback() {
|
|
57
|
+
var _a;
|
|
58
58
|
if (this.statePath)
|
|
59
|
-
this.statePublisher.offAssign(this.onAssign);
|
|
59
|
+
(_a = this.statePublisher) === null || _a === void 0 ? void 0 : _a.offAssign(this.onAssign);
|
|
60
60
|
super.disconnectedCallback();
|
|
61
61
|
}
|
|
62
62
|
render() {
|
|
@@ -133,8 +133,3 @@ SonicStates = __decorate([
|
|
|
133
133
|
customElement(tagName)
|
|
134
134
|
], SonicStates);
|
|
135
135
|
export { SonicStates };
|
|
136
|
-
//Ajout pour custom-elements-manifesy pour storybook notamment
|
|
137
|
-
try {
|
|
138
|
-
customElements.define(tagName, SonicStates);
|
|
139
|
-
}
|
|
140
|
-
catch (e) { }
|