@supersoniks/concorde 1.1.42 → 1.1.44
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/components.js +2 -3
- package/concorde-core.bundle.js +37 -35
- package/concorde-core.es.js +5283 -4453
- package/core/_types/types.d.ts +31 -0
- package/core/_types/types.js +2 -0
- package/core/components/functional/date/date.d.ts +13 -5
- package/core/components/functional/date/date.js +57 -38
- 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 +45 -6
- 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 +44 -12
- package/core/components/functional/list/list.js +54 -49
- package/core/components/functional/mix/mix.d.ts +22 -0
- package/core/components/functional/mix/mix.js +102 -0
- package/core/components/functional/queue/queue.d.ts +27 -5
- package/core/components/functional/queue/queue.js +88 -26
- package/core/components/functional/router/redirect.d.ts +11 -2
- package/core/components/functional/router/redirect.js +7 -12
- package/core/components/functional/router/router.d.ts +15 -1
- package/core/components/functional/router/router.js +11 -16
- package/core/components/functional/sdui/SDUIDescriptorTransformer.d.ts +1 -2
- package/core/components/functional/sdui/SDUIDescriptorTransformer.js +56 -45
- 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 +21 -13
- package/core/components/functional/sdui/sdui.js +70 -44
- package/core/components/functional/sdui/types.d.ts +10 -8
- package/core/components/functional/states/states.d.ts +20 -4
- package/core/components/functional/states/states.js +15 -20
- package/core/components/functional/submit/submit.d.ts +16 -1
- package/core/components/functional/submit/submit.js +95 -25
- 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.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/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 +28 -23
- package/core/components/ui/button/button.js +60 -43
- package/core/components/ui/captcha/captcha.d.ts +14 -2
- package/core/components/ui/captcha/captcha.js +18 -13
- package/core/components/ui/card/card-footer.js +1 -8
- package/core/components/ui/card/card-header-descripton.js +3 -9
- package/core/components/ui/card/card-header.js +6 -7
- 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 +30 -12
- package/core/components/ui/divider/divider.d.ts +2 -0
- package/core/components/ui/divider/divider.js +43 -16
- package/core/components/ui/form/checkbox/checkbox.d.ts +86 -25
- package/core/components/ui/form/checkbox/checkbox.js +53 -28
- 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.js +0 -5
- package/core/components/ui/form/fieldset/legend.js +3 -6
- 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 +26 -24
- package/core/components/ui/form/input/input.js +87 -52
- package/core/components/ui/form/input/password-helper.d.ts +1 -1
- package/core/components/ui/form/input/password-helper.js +4 -3
- package/core/components/ui/form/input/same-value-helper.d.ts +1 -1
- package/core/components/ui/form/input/same-value-helper.js +3 -2
- package/core/components/ui/form/input-autocomplete/input-autocomplete.d.ts +2 -3
- package/core/components/ui/form/input-autocomplete/input-autocomplete.js +2 -6
- 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 +25 -8
- package/core/components/ui/form/select/select.js +72 -41
- package/core/components/ui/form/textarea/textarea.d.ts +21 -19
- package/core/components/ui/form/textarea/textarea.js +29 -36
- 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.js +25 -20
- package/core/components/ui/icon/icons.json +1 -1
- 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 +1 -1
- package/core/components/ui/loader/loader.js +3 -9
- 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 +182 -27
- 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.js +0 -5
- package/core/components/ui/modal/modal-subtitle.js +2 -6
- 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 +37 -37
- package/core/components/ui/pop/pop.d.ts +6 -5
- package/core/components/ui/pop/pop.js +57 -57
- package/core/components/ui/progress/progress.js +34 -32
- package/core/components/ui/table/table-caption.js +5 -10
- 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.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.js +1 -6
- 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/theme/theme-collection/core-variables.js +13 -11
- package/core/components/ui/theme/theme-collection/dark.js +1 -1
- package/core/components/ui/theme/theme.d.ts +1 -6
- package/core/components/ui/theme/theme.js +19 -46
- package/core/components/ui/toast/message-subscriber.d.ts +16 -7
- package/core/components/ui/toast/message-subscriber.js +10 -8
- package/core/components/ui/toast/toast-item.js +1 -1
- package/core/components/ui/toast/toast.d.ts +3 -2
- package/core/components/ui/toast/toast.js +33 -19
- package/core/components/ui/toast/types.d.ts +3 -2
- package/core/components/ui/tooltip/tooltip.d.ts +1 -0
- package/core/components/ui/tooltip/tooltip.js +36 -15
- package/core/components/ui/ui.d.ts +1 -1
- package/core/components/ui/ui.js +1 -4
- package/core/core.js +5 -6
- package/core/mixins/Fetcher.d.ts +20 -13
- package/core/mixins/Fetcher.js +44 -19
- package/core/mixins/FormCheckable.d.ts +25 -13
- package/core/mixins/FormCheckable.js +180 -23
- package/core/mixins/FormElement.d.ts +17 -9
- package/core/mixins/FormElement.js +56 -39
- package/core/mixins/FormInput.d.ts +22 -12
- package/core/mixins/FormInput.js +4 -3
- package/core/mixins/Subscriber.d.ts +12 -8
- package/core/mixins/Subscriber.js +51 -48
- package/core/mixins/TemplatesContainer.d.ts +2 -1
- package/core/mixins/TemplatesContainer.js +2 -2
- package/core/utils/Arrays.d.ts +15 -15
- package/core/utils/Arrays.js +12 -9
- package/core/utils/DataBindObserver.d.ts +18 -11
- package/core/utils/DataBindObserver.js +47 -54
- package/core/utils/Electron.d.ts +5 -1
- package/core/utils/Electron.js +4 -2
- package/core/utils/HTML.d.ts +9 -2
- package/core/utils/HTML.js +24 -5
- package/core/utils/LocationHandler.d.ts +6 -5
- package/core/utils/LocationHandler.js +27 -16
- package/core/utils/Objects.d.ts +7 -4
- package/core/utils/Objects.js +37 -9
- package/core/utils/{PublisherProxy.d.mts → PublisherProxy.d.ts} +49 -34
- package/core/utils/{PublisherProxy.mjs → PublisherProxy.js} +107 -77
- package/core/utils/Utils.d.ts +3 -0
- package/core/utils/Utils.js +18 -0
- package/core/utils/api.d.ts +26 -9
- package/core/utils/api.js +62 -45
- package/img/concorde-logo.svg +1 -0
- package/img/concorde.png +0 -0
- package/img/concorde_def.png +0 -0
- package/mixins.d.ts +53 -29
- package/mixins.js +3 -4
- package/package.json +51 -12
- 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
- package/core/components/ui/taxonomy/taxonomy.d.ts +0 -41
- package/core/components/ui/taxonomy/taxonomy.js +0 -115
|
@@ -4,17 +4,16 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { html, LitElement,
|
|
7
|
+
import { html, LitElement, nothing } from "lit";
|
|
8
8
|
import { customElement, property } from "lit/decorators.js";
|
|
9
9
|
import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
|
|
10
10
|
import Fetcher from "@supersoniks/concorde/core/mixins/Fetcher";
|
|
11
|
-
import { repeat } from "lit/directives/repeat.js";
|
|
12
11
|
import { templateContent } from "lit/directives/template-content.js";
|
|
13
12
|
import "@supersoniks/concorde/core/components/ui/loader/loader";
|
|
14
13
|
import "@supersoniks/concorde/core/components/functional/subscriber/subscriber";
|
|
15
14
|
import Objects from "@supersoniks/concorde/core/utils/Objects";
|
|
16
|
-
import { ifDefined } from "lit/directives/if-defined.js";
|
|
17
15
|
import TemplatesContainer from "@supersoniks/concorde/core/mixins/TemplatesContainer";
|
|
16
|
+
const tagName = "sonic-list";
|
|
18
17
|
/**
|
|
19
18
|
* ### List boucle sur sa propriété "props" et crée des éléments a partir des données en bouclant également sur ses templates.
|
|
20
19
|
*
|
|
@@ -32,11 +31,9 @@ import TemplatesContainer from "@supersoniks/concorde/core/mixins/TemplatesConta
|
|
|
32
31
|
* * On peut appler la methode invalidate() sur son publishe pour declencher le rechargement des données
|
|
33
32
|
* *
|
|
34
33
|
*/
|
|
35
|
-
const tagName = "sonic-list";
|
|
36
34
|
let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))) {
|
|
37
35
|
constructor() {
|
|
38
36
|
super(...arguments);
|
|
39
|
-
this.itemPropertyMap = null;
|
|
40
37
|
/**
|
|
41
38
|
* La propriété templateKey contient le nom de la propriété qui sera utilisé pour identifier le template à utiliser dans la donnée de la ligne.
|
|
42
39
|
* Par exemple si templateIdentifier = "name" et que la donnée de la ligne est {name: "myTemplate" ... }, alors le template possédant l'attribut data-value="myTemplate" sera utilisé.
|
|
@@ -62,14 +59,26 @@ let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))
|
|
|
62
59
|
: html `<sonic-loader mode="inline"></sonic-loader>`;
|
|
63
60
|
}
|
|
64
61
|
renderNoResultState() {
|
|
65
|
-
return html ` <div
|
|
66
|
-
|
|
62
|
+
return html ` <div
|
|
63
|
+
style="color: var(--sc-base-400);
|
|
64
|
+
font-size: 1.5em;
|
|
65
|
+
margin: 4rem 0;
|
|
66
|
+
display: flex;
|
|
67
|
+
gap: 0.5rem;"
|
|
68
|
+
>
|
|
69
|
+
<sonic-icon name="emoji-puzzled" size="lg"></sonic-icon
|
|
70
|
+
><span class="sonic-no-result-text"
|
|
71
|
+
>${typeof this.props === "string" && this.props == "" ? "Aucun résultat" : this.props}</span
|
|
72
|
+
>
|
|
67
73
|
</div>`;
|
|
68
74
|
}
|
|
69
75
|
formatProps() {
|
|
70
76
|
let props = this.props;
|
|
71
|
-
|
|
72
|
-
|
|
77
|
+
if (props == null) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
const response = props._sonic_http_response_;
|
|
81
|
+
const extractValues = this.hasAttribute("extractValues");
|
|
73
82
|
//si props n'est pas un tableau on l'adapte
|
|
74
83
|
if (!Array.isArray(props)) {
|
|
75
84
|
if (extractValues) {
|
|
@@ -83,7 +92,9 @@ let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))
|
|
|
83
92
|
}
|
|
84
93
|
}
|
|
85
94
|
}
|
|
86
|
-
props
|
|
95
|
+
props = props.filter((e) => e != null);
|
|
96
|
+
if (response)
|
|
97
|
+
props._sonic_http_response_ = response;
|
|
87
98
|
return props;
|
|
88
99
|
}
|
|
89
100
|
render() {
|
|
@@ -108,64 +119,63 @@ let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))
|
|
|
108
119
|
/**
|
|
109
120
|
* On format les props pour les rendre compatibles avec le fonctionnement du rendu en fonction du paramétrage du composant (cf : "extractValues" )
|
|
110
121
|
*/
|
|
111
|
-
|
|
122
|
+
const props = this.formatProps();
|
|
112
123
|
/**
|
|
113
124
|
* On peut définir un template spécifique si le résultat est un tableau vide
|
|
114
125
|
*/
|
|
115
|
-
if (props.length == 0 && this.templateParts["no-item"]) {
|
|
126
|
+
if (((props === null || props === void 0 ? void 0 : props.length) || 0) == 0 && this.templateParts["no-item"]) {
|
|
116
127
|
return templateContent(this.templateParts["no-item"]);
|
|
117
128
|
}
|
|
118
129
|
/**
|
|
119
130
|
* Rendu des lignes
|
|
120
131
|
* */
|
|
121
|
-
|
|
132
|
+
const templateCount = this.templateList.length;
|
|
122
133
|
let counter = -1;
|
|
123
|
-
|
|
134
|
+
const extractValues = this.hasAttribute("extractValues");
|
|
135
|
+
const separator = this.templateParts["separator"];
|
|
136
|
+
const length = (props === null || props === void 0 ? void 0 : props.length) || 0;
|
|
124
137
|
return html `
|
|
125
|
-
${
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
138
|
+
${props === null || props === void 0 ? void 0 : props.map((item, index) => {
|
|
139
|
+
if (item == null)
|
|
140
|
+
return nothing;
|
|
141
|
+
if (typeof item != "object" || Array.isArray(item))
|
|
142
|
+
return nothing;
|
|
143
|
+
const templatePartName = item[this.templateKey];
|
|
144
|
+
let templatePart = null;
|
|
145
|
+
if (templatePartName && typeof templatePartName == "string") {
|
|
146
|
+
templatePart = this.templateParts[templatePartName];
|
|
147
|
+
}
|
|
148
|
+
const key = extractValues ? item === null || item === void 0 ? void 0 : item[this.idKey] : index;
|
|
129
149
|
if (key == "_sonic_http_response_")
|
|
130
150
|
return nothing;
|
|
131
|
-
|
|
151
|
+
if (typeof key != "string" && typeof key != "number")
|
|
152
|
+
return nothing;
|
|
153
|
+
const pub = this.publisher[key];
|
|
132
154
|
pub._key_ = key + "";
|
|
133
155
|
counter++;
|
|
134
|
-
|
|
156
|
+
const isNotLast = index < length - 1;
|
|
157
|
+
if (templatePart)
|
|
135
158
|
counter = -1;
|
|
136
159
|
return (item &&
|
|
137
160
|
html `
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
161
|
+
<sonic-subscriber
|
|
162
|
+
?debug=${this.defferedDebug === true}
|
|
163
|
+
.bindPublisher=${function () {
|
|
141
164
|
return pub;
|
|
142
165
|
}}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
? templateContent(
|
|
166
|
+
.propertyMap?=${this.itemPropertyMap}
|
|
167
|
+
dataProvider="${this.dataProvider}/list-item/${key}"
|
|
168
|
+
>
|
|
169
|
+
${templatePart
|
|
170
|
+
? templateContent(templatePart)
|
|
148
171
|
: templateContent(this.templateList[counter % templateCount])}
|
|
149
|
-
|
|
150
|
-
|
|
172
|
+
</sonic-subscriber>
|
|
173
|
+
${separator && isNotLast ? templateContent(separator) : nothing}
|
|
174
|
+
`);
|
|
151
175
|
})}
|
|
152
176
|
`;
|
|
153
177
|
}
|
|
154
178
|
};
|
|
155
|
-
List.styles = [
|
|
156
|
-
css `
|
|
157
|
-
.sonic-no-result-container {
|
|
158
|
-
color: var(--sc-base-400);
|
|
159
|
-
font-size: 1.65rem;
|
|
160
|
-
}
|
|
161
|
-
sonic-icon {
|
|
162
|
-
margin-right: 0.25em;
|
|
163
|
-
}
|
|
164
|
-
span {
|
|
165
|
-
vertical-align: middle;
|
|
166
|
-
}
|
|
167
|
-
`,
|
|
168
|
-
];
|
|
169
179
|
__decorate([
|
|
170
180
|
property({ type: Object })
|
|
171
181
|
], List.prototype, "itemPropertyMap", void 0);
|
|
@@ -179,8 +189,3 @@ List = __decorate([
|
|
|
179
189
|
customElement(tagName)
|
|
180
190
|
], List);
|
|
181
191
|
export { List };
|
|
182
|
-
//Ajout pour custom-elements-manifest pour storybook notamment
|
|
183
|
-
try {
|
|
184
|
-
customElements.define(tagName, List);
|
|
185
|
-
}
|
|
186
|
-
catch (e) { }
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
import { PublisherInterface, PublisherContentType } from "@supersoniks/concorde/core/_types/types";
|
|
3
|
+
type Composition = Record<string, object | string>;
|
|
4
|
+
type Listener = {
|
|
5
|
+
publisher: PublisherInterface;
|
|
6
|
+
subscriber: <T>(v: T) => void;
|
|
7
|
+
};
|
|
8
|
+
declare const SonicMix_base: (new (...args: any[]) => import("../../../mixins/Subscriber").SubscriberInterface<import("@supersoniks/concorde/core/_types/types").CoreJSType>) & typeof LitElement;
|
|
9
|
+
export default class SonicMix extends SonicMix_base {
|
|
10
|
+
static styles: import("lit").CSSResult[];
|
|
11
|
+
private _composition;
|
|
12
|
+
get composition(): Composition;
|
|
13
|
+
set composition(value: Composition);
|
|
14
|
+
connectedCallback(): void;
|
|
15
|
+
disconnectedCallback(): void;
|
|
16
|
+
updateComposition(): void;
|
|
17
|
+
listeners: Listener[];
|
|
18
|
+
removePublisherListeners(): void;
|
|
19
|
+
parseComposition<T extends PublisherContentType = PublisherContentType>(composition: Composition, publisher: PublisherInterface<T>): void;
|
|
20
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { PublisherProxy } from "@supersoniks/concorde/core/utils/PublisherProxy";
|
|
8
|
+
import { Subscriber } from "@supersoniks/concorde/mixins";
|
|
9
|
+
import { Objects, PublisherManager } from "@supersoniks/concorde/utils";
|
|
10
|
+
import { LitElement, html, css } from "lit";
|
|
11
|
+
import { customElement, property } from "lit/decorators.js";
|
|
12
|
+
let SonicMix = class SonicMix extends Subscriber(LitElement) {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this._composition = {};
|
|
16
|
+
this.listeners = [];
|
|
17
|
+
}
|
|
18
|
+
get composition() {
|
|
19
|
+
return this._composition;
|
|
20
|
+
}
|
|
21
|
+
set composition(value) {
|
|
22
|
+
this._composition = value;
|
|
23
|
+
this.updateComposition();
|
|
24
|
+
}
|
|
25
|
+
connectedCallback() {
|
|
26
|
+
super.connectedCallback();
|
|
27
|
+
this.updateComposition();
|
|
28
|
+
}
|
|
29
|
+
disconnectedCallback() {
|
|
30
|
+
this.removePublisherListeners();
|
|
31
|
+
super.disconnectedCallback();
|
|
32
|
+
}
|
|
33
|
+
updateComposition() {
|
|
34
|
+
this.removePublisherListeners();
|
|
35
|
+
if (!this.publisher)
|
|
36
|
+
return;
|
|
37
|
+
this.publisher.set({});
|
|
38
|
+
this.parseComposition(this.composition, this.publisher);
|
|
39
|
+
}
|
|
40
|
+
removePublisherListeners() {
|
|
41
|
+
const listeners = this.listeners;
|
|
42
|
+
this.listeners = [];
|
|
43
|
+
listeners.forEach((listener) => {
|
|
44
|
+
this.publisher.offAssign(listener.subscriber);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
parseComposition(composition, publisher) {
|
|
48
|
+
if (!composition)
|
|
49
|
+
return;
|
|
50
|
+
for (const z in composition) {
|
|
51
|
+
const value = composition[z];
|
|
52
|
+
if (typeof value === "string") {
|
|
53
|
+
const split = value.split(".");
|
|
54
|
+
const first = split.shift();
|
|
55
|
+
if (!first)
|
|
56
|
+
continue;
|
|
57
|
+
let publisherSource = PublisherManager.get(first);
|
|
58
|
+
publisherSource = Objects.traverse(publisherSource, split);
|
|
59
|
+
const publisherSubscriber = {
|
|
60
|
+
publisher: publisherSource,
|
|
61
|
+
subscriber: (v) => {
|
|
62
|
+
publisher[z] = v;
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
this.listeners.push(publisherSubscriber);
|
|
66
|
+
publisherSource.onAssign(publisherSubscriber.subscriber);
|
|
67
|
+
publisher._proxies_.set(z, publisherSource);
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
this.publisher[z] = {};
|
|
71
|
+
const newPublisher = new PublisherProxy({}, publisher);
|
|
72
|
+
publisher._proxies_.set(z, newPublisher);
|
|
73
|
+
const publisherSubscriber = {
|
|
74
|
+
publisher: newPublisher,
|
|
75
|
+
subscriber: (v) => {
|
|
76
|
+
publisher[z] = v;
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
this.listeners.push(publisherSubscriber);
|
|
80
|
+
newPublisher.onAssign(publisherSubscriber.subscriber);
|
|
81
|
+
this.parseComposition(value, newPublisher);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
render() {
|
|
86
|
+
return html `<slot></slot>`;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
SonicMix.styles = [
|
|
90
|
+
css `
|
|
91
|
+
:host {
|
|
92
|
+
display: contents;
|
|
93
|
+
}
|
|
94
|
+
`,
|
|
95
|
+
];
|
|
96
|
+
__decorate([
|
|
97
|
+
property({ type: Object })
|
|
98
|
+
], SonicMix.prototype, "composition", null);
|
|
99
|
+
SonicMix = __decorate([
|
|
100
|
+
customElement("sonic-mix")
|
|
101
|
+
], SonicMix);
|
|
102
|
+
export default SonicMix;
|
|
@@ -1,24 +1,45 @@
|
|
|
1
1
|
import { LitElement, nothing } from "lit";
|
|
2
2
|
import "@supersoniks/concorde/core/components/functional/list/list";
|
|
3
|
-
import { PublisherProxy } from "@supersoniks/concorde/core/utils/PublisherProxy
|
|
4
|
-
|
|
3
|
+
import { PublisherProxy } from "@supersoniks/concorde/core/utils/PublisherProxy";
|
|
4
|
+
type QueueItem = {
|
|
5
|
+
id: string;
|
|
6
|
+
dataProvider: string;
|
|
7
|
+
offset: number;
|
|
8
|
+
limit: number;
|
|
9
|
+
};
|
|
10
|
+
type QueueProps = QueueItem[] & {
|
|
11
|
+
resultCount?: number;
|
|
12
|
+
};
|
|
13
|
+
declare const Queue_base: (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface<QueueProps>) & typeof LitElement;
|
|
14
|
+
/**
|
|
15
|
+
*### Une Queue charge du contenu par lot selon l'expression renseignée dans l'attribut *dataProviderExpression*.
|
|
16
|
+
* * Chaque lot est chargé par un composant [List](./?path=/docs/core-components-functional-list-list--basic) dont le dataProvider créé à partir de l'attribut dataProviderExpression
|
|
17
|
+
* * A l'initialisation elle regarde l'attribut dataFilterProvider qui donne l'adresse d'un [publisher](./?path=/docs/how-to-🥨-dialogue-inter-composant--page)
|
|
18
|
+
* Si cet attribut est touvé, Queue écoute le publisher fourni et se réinitialise à chaque modification du contenu de celui-ci.
|
|
19
|
+
* Les valeurs renseignées dans ce publisher sont ajoutées en get à chaque requête
|
|
20
|
+
* * la proriété *key* peut être utilisé pour cibler une propriété particulière du retour de l'api.
|
|
21
|
+
*/
|
|
5
22
|
export default class Queue extends Queue_base {
|
|
6
23
|
templates: Array<HTMLTemplateElement> | null;
|
|
7
24
|
lastRequestTime: number;
|
|
8
|
-
key:
|
|
9
|
-
itemPropertyMap:
|
|
25
|
+
key: string;
|
|
26
|
+
itemPropertyMap: object | null;
|
|
10
27
|
/**
|
|
11
28
|
* Durée cible en ms d'une requête pour afficher 1 lot.
|
|
12
29
|
*/
|
|
13
30
|
targetRequestDuration: number;
|
|
14
31
|
limit: number;
|
|
15
32
|
offset: number;
|
|
33
|
+
resultCount: number;
|
|
16
34
|
filteredFields: string;
|
|
35
|
+
disconnectedCallback(): void;
|
|
17
36
|
static instanceCounter: number;
|
|
18
37
|
connectedCallback(): void;
|
|
19
38
|
filterPublisher: PublisherProxy | null;
|
|
20
39
|
configFilter(): void;
|
|
21
|
-
filterTimeoutId
|
|
40
|
+
filterTimeoutId?: ReturnType<typeof setTimeout>;
|
|
41
|
+
searchHash: string;
|
|
42
|
+
requestId: number;
|
|
22
43
|
updateFilteredContent(): void;
|
|
23
44
|
/**
|
|
24
45
|
* Cette expression est utilisée comme modèle par le composant Queue pour renseigngner le dataProvider de la [liste](./?path=/docs/core-components-functional-list-list--basic) créée.
|
|
@@ -31,6 +52,7 @@ export default class Queue extends Queue_base {
|
|
|
31
52
|
currentScrollPosition: number | undefined;
|
|
32
53
|
resetDuration(): void;
|
|
33
54
|
listDataProviders: string[];
|
|
55
|
+
nextHadEvent: boolean;
|
|
34
56
|
next(e?: CustomEvent): void;
|
|
35
57
|
render(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
36
58
|
}
|
|
@@ -9,9 +9,10 @@ import { html, LitElement, nothing } from "lit";
|
|
|
9
9
|
import { customElement, property } from "lit/decorators.js";
|
|
10
10
|
import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
|
|
11
11
|
import { repeat } from "lit/directives/repeat.js";
|
|
12
|
-
import { PublisherManager } from "@supersoniks/concorde/core/utils/PublisherProxy
|
|
13
|
-
import { ifDefined } from "lit/directives/if-defined.js";
|
|
12
|
+
import { PublisherManager } from "@supersoniks/concorde/core/utils/PublisherProxy";
|
|
14
13
|
import "@supersoniks/concorde/core/components/functional/list/list";
|
|
14
|
+
import { HTML } from "@supersoniks/concorde/utils";
|
|
15
|
+
const tagName = "sonic-queue";
|
|
15
16
|
/**
|
|
16
17
|
*### Une Queue charge du contenu par lot selon l'expression renseignée dans l'attribut *dataProviderExpression*.
|
|
17
18
|
* * Chaque lot est chargé par un composant [List](./?path=/docs/core-components-functional-list-list--basic) dont le dataProvider créé à partir de l'attribut dataProviderExpression
|
|
@@ -20,8 +21,7 @@ import "@supersoniks/concorde/core/components/functional/list/list";
|
|
|
20
21
|
* Les valeurs renseignées dans ce publisher sont ajoutées en get à chaque requête
|
|
21
22
|
* * la proriété *key* peut être utilisé pour cibler une propriété particulière du retour de l'api.
|
|
22
23
|
*/
|
|
23
|
-
|
|
24
|
-
let Queue = Queue_1 = class Queue extends Subscriber(LitElement) {
|
|
24
|
+
let Queue = Queue_1 = class Queue extends Subscriber(LitElement, {}) {
|
|
25
25
|
constructor() {
|
|
26
26
|
super(...arguments);
|
|
27
27
|
this.templates = null;
|
|
@@ -38,9 +38,11 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement) {
|
|
|
38
38
|
*/
|
|
39
39
|
this.limit = 5;
|
|
40
40
|
this.offset = 0;
|
|
41
|
+
this.resultCount = 0;
|
|
41
42
|
this.filteredFields = "";
|
|
42
43
|
this.filterPublisher = null;
|
|
43
|
-
this.
|
|
44
|
+
this.searchHash = "";
|
|
45
|
+
this.requestId = 0;
|
|
44
46
|
/**
|
|
45
47
|
* Cette expression est utilisée comme modèle par le composant Queue pour renseigngner le dataProvider de la [liste](./?path=/docs/core-components-functional-list-list--basic) créée.
|
|
46
48
|
* * l'expression *$offset* est alors remplacée par le numéro de l'élément à partir duquel démarrer
|
|
@@ -51,10 +53,22 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement) {
|
|
|
51
53
|
this.idKey = "id";
|
|
52
54
|
this.currentScrollPosition = undefined;
|
|
53
55
|
this.listDataProviders = [];
|
|
56
|
+
this.nextHadEvent = false;
|
|
57
|
+
}
|
|
58
|
+
disconnectedCallback() {
|
|
59
|
+
for (const dataProvider of this.listDataProviders) {
|
|
60
|
+
PublisherManager.delete(dataProvider);
|
|
61
|
+
}
|
|
62
|
+
super.disconnectedCallback();
|
|
63
|
+
return;
|
|
54
64
|
}
|
|
55
65
|
connectedCallback() {
|
|
56
66
|
this.noShadowDom = "";
|
|
57
67
|
this.defferedDebug = this.hasAttribute("debug") || null;
|
|
68
|
+
/**Compat avec states et routing **/
|
|
69
|
+
if (!this.dataProviderExpression) {
|
|
70
|
+
this.dataProviderExpression = HTML.getAncestorAttributeValue(this.parentElement, "dataProvider") || "";
|
|
71
|
+
}
|
|
58
72
|
if (!this.dataProvider)
|
|
59
73
|
this.dataProvider = "sonic-queue-" + Queue_1.instanceCounter++;
|
|
60
74
|
this.configFilter();
|
|
@@ -63,11 +77,12 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement) {
|
|
|
63
77
|
if (!this.templates)
|
|
64
78
|
this.templates = Array.from(this.querySelectorAll("template"));
|
|
65
79
|
this.lastRequestTime = new Date().getTime();
|
|
66
|
-
|
|
80
|
+
let func = window.requestAnimationFrame;
|
|
81
|
+
func(() => this.next());
|
|
67
82
|
}
|
|
68
83
|
configFilter() {
|
|
69
84
|
var _a;
|
|
70
|
-
|
|
85
|
+
const dataFilterProvider = this.getAncestorAttributeValue("dataFilterProvider");
|
|
71
86
|
if (!dataFilterProvider)
|
|
72
87
|
return;
|
|
73
88
|
this.filterPublisher = PublisherManager.getInstance().get(dataFilterProvider);
|
|
@@ -79,13 +94,42 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement) {
|
|
|
79
94
|
});
|
|
80
95
|
}
|
|
81
96
|
updateFilteredContent() {
|
|
82
|
-
|
|
97
|
+
var _a;
|
|
98
|
+
/**
|
|
99
|
+
* On ne lance la recherche que si le hash de recherche est différent
|
|
100
|
+
*/
|
|
101
|
+
const dataProvider = this.dataProviderExpression;
|
|
102
|
+
const split = dataProvider.split("?");
|
|
103
|
+
split.shift();
|
|
104
|
+
let searchParams = new URLSearchParams(split.join("?"));
|
|
105
|
+
let filterData = (_a = this.filterPublisher) === null || _a === void 0 ? void 0 : _a.get();
|
|
106
|
+
let filteredFieldsArray = this.filteredFields.split(" ");
|
|
107
|
+
for (let f in filterData) {
|
|
108
|
+
let value = filterData[f];
|
|
109
|
+
if (Array.isArray(value))
|
|
110
|
+
value = value.filter((v) => v !== null);
|
|
111
|
+
if ((this.filteredFields && !filteredFieldsArray.includes(f)) || value == null || value.toString() === "")
|
|
112
|
+
continue;
|
|
113
|
+
searchParams.set(f, filterData[f].toString());
|
|
114
|
+
}
|
|
115
|
+
const searchHash = searchParams.toString();
|
|
116
|
+
if (searchHash == this.searchHash)
|
|
117
|
+
return;
|
|
118
|
+
this.searchHash = searchHash;
|
|
119
|
+
/**
|
|
120
|
+
* on reset les données avant de lancer la requète
|
|
121
|
+
*/
|
|
122
|
+
for (const dataProvider of this.listDataProviders) {
|
|
83
123
|
PublisherManager.delete(dataProvider);
|
|
84
124
|
}
|
|
85
125
|
this.listDataProviders = [];
|
|
86
126
|
clearTimeout(this.filterTimeoutId);
|
|
87
127
|
this.filterTimeoutId = setTimeout(() => {
|
|
128
|
+
const count = this.resultCount;
|
|
88
129
|
this.props = null;
|
|
130
|
+
//On garde le décompte au cas ou il n'y aurait pas rechargement
|
|
131
|
+
this.resultCount = count;
|
|
132
|
+
this.requestId++;
|
|
89
133
|
this.next();
|
|
90
134
|
}, 250);
|
|
91
135
|
}
|
|
@@ -97,13 +141,27 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement) {
|
|
|
97
141
|
let offset = this.offset;
|
|
98
142
|
const newTime = new Date().getTime();
|
|
99
143
|
const requestDuration = newTime - this.lastRequestTime;
|
|
144
|
+
/**
|
|
145
|
+
* Le rechargement n'est pas garanti si pas de changement dans les filtres
|
|
146
|
+
* Un ne repasse donc à 0 qu'à partir du premier chargement.
|
|
147
|
+
* */
|
|
148
|
+
if (!this.nextHadEvent && e) {
|
|
149
|
+
this.resultCount = 0;
|
|
150
|
+
}
|
|
151
|
+
this.nextHadEvent = !!e;
|
|
100
152
|
if (e) {
|
|
153
|
+
if (e.detail.requestId != this.requestId)
|
|
154
|
+
return;
|
|
155
|
+
this.resultCount += e.detail.props.length;
|
|
101
156
|
if (!e.detail.isFirstLoad || !e.detail.props.length || this.dataProviderExpression.indexOf("$offset") == -1) {
|
|
157
|
+
this.publisher.resultCount = this.resultCount;
|
|
102
158
|
return;
|
|
103
159
|
}
|
|
104
160
|
}
|
|
105
161
|
if (!Array.isArray(this.props)) {
|
|
106
|
-
|
|
162
|
+
const newProps = [];
|
|
163
|
+
newProps.resultCount = this.resultCount;
|
|
164
|
+
this.props = newProps;
|
|
107
165
|
}
|
|
108
166
|
else {
|
|
109
167
|
const props = this.props;
|
|
@@ -117,20 +175,22 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement) {
|
|
|
117
175
|
if (this.limit > 15)
|
|
118
176
|
this.limit = 15;
|
|
119
177
|
let dataProvider = this.dataProviderExpression.replace("$offset", offset + "").replace("$limit", this.limit + "");
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
for (
|
|
126
|
-
if (this.filteredFields && !filteredFieldsArray.includes(f))
|
|
178
|
+
const split = dataProvider.split("?");
|
|
179
|
+
const endpoint = split.shift();
|
|
180
|
+
const searchParams = new URLSearchParams(split.join("?"));
|
|
181
|
+
const filterData = (_a = this.filterPublisher) === null || _a === void 0 ? void 0 : _a.get();
|
|
182
|
+
const filteredFieldsArray = this.filteredFields.split(" ");
|
|
183
|
+
for (const f in filterData) {
|
|
184
|
+
if ((this.filteredFields && !filteredFieldsArray.includes(f)) || filterData[f] == null)
|
|
127
185
|
continue;
|
|
128
186
|
searchParams.set(f, filterData[f]);
|
|
129
187
|
}
|
|
188
|
+
if (!this.searchHash)
|
|
189
|
+
this.searchHash = searchParams.toString();
|
|
130
190
|
dataProvider = endpoint + "?" + searchParams.toString();
|
|
131
191
|
this.listDataProviders.push(dataProvider);
|
|
132
192
|
this.currentScrollPosition = (_b = document.scrollingElement) === null || _b === void 0 ? void 0 : _b.scrollTop;
|
|
133
|
-
|
|
193
|
+
const newProps = [
|
|
134
194
|
...this.props,
|
|
135
195
|
{
|
|
136
196
|
id: searchParams.toString() + "/" + this.props.length,
|
|
@@ -139,12 +199,14 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement) {
|
|
|
139
199
|
limit: this.limit,
|
|
140
200
|
},
|
|
141
201
|
];
|
|
202
|
+
newProps.resultCount = this.resultCount;
|
|
203
|
+
this.props = newProps;
|
|
142
204
|
this.lastRequestTime = new Date().getTime();
|
|
143
205
|
}
|
|
144
206
|
render() {
|
|
145
207
|
if (this.currentScrollPosition) {
|
|
146
208
|
window.requestAnimationFrame(() => {
|
|
147
|
-
if (document.scrollingElement)
|
|
209
|
+
if (document.scrollingElement && this.currentScrollPosition != undefined)
|
|
148
210
|
document.scrollingElement.scrollTop = this.currentScrollPosition;
|
|
149
211
|
this.currentScrollPosition = undefined;
|
|
150
212
|
});
|
|
@@ -154,13 +216,15 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement) {
|
|
|
154
216
|
return html `
|
|
155
217
|
${repeat(this.props, (item) => item.id, (item, index) => {
|
|
156
218
|
var _a;
|
|
157
|
-
|
|
219
|
+
const templates = index == 0 ? this.templates : (_a = this.templates) === null || _a === void 0 ? void 0 : _a.filter((elt) => elt.getAttribute("data-value") != "no-item");
|
|
158
220
|
return html `
|
|
159
221
|
<sonic-list
|
|
160
222
|
fetch
|
|
161
|
-
|
|
223
|
+
displayContents
|
|
224
|
+
lazyload
|
|
225
|
+
requestId=${this.requestId}
|
|
162
226
|
.itemPropertyMap=${this.itemPropertyMap}
|
|
163
|
-
debug=${
|
|
227
|
+
?debug=${this.defferedDebug === true}
|
|
164
228
|
@load=${this.next}
|
|
165
229
|
key=${this.key}
|
|
166
230
|
@loading=${this.resetDuration}
|
|
@@ -190,6 +254,9 @@ __decorate([
|
|
|
190
254
|
__decorate([
|
|
191
255
|
property()
|
|
192
256
|
], Queue.prototype, "offset", void 0);
|
|
257
|
+
__decorate([
|
|
258
|
+
property()
|
|
259
|
+
], Queue.prototype, "resultCount", void 0);
|
|
193
260
|
__decorate([
|
|
194
261
|
property()
|
|
195
262
|
], Queue.prototype, "filteredFields", void 0);
|
|
@@ -203,8 +270,3 @@ Queue = Queue_1 = __decorate([
|
|
|
203
270
|
customElement(tagName)
|
|
204
271
|
], Queue);
|
|
205
272
|
export default Queue;
|
|
206
|
-
//Ajout pour custom-elements-manifesy pour storybook notamment
|
|
207
|
-
try {
|
|
208
|
-
customElements.define(tagName, Queue);
|
|
209
|
-
}
|
|
210
|
-
catch (e) { }
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
|
-
declare const SonicRedirect_base: (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface) & typeof LitElement;
|
|
2
|
+
declare const SonicRedirect_base: (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface<import("../../../_types/types").CoreJSType>) & typeof LitElement;
|
|
3
|
+
/**
|
|
4
|
+
* sonic-redirect permet d'effectuer une redirection.
|
|
5
|
+
* * L'URL de redirection fournie dans l'attribut *to*.
|
|
6
|
+
* * La redirection est effectuée en fonction de la disponibilité d'une donnée issue du publisher à l'adresse fournie par l'attribut dataProvider
|
|
7
|
+
* * La donnée a trouver est renseignées via l'attribut *onData* qui peur repésenter un chemin dans la donnée via la dot syntaxe
|
|
8
|
+
* * Si la données est trouvée et qu'elle peut être évaluée à true alors la redirection est effectuée
|
|
9
|
+
* Par exemple : la données vaut {user:{id:2}} si onData="user.id"la redirection est effectuée.
|
|
10
|
+
* * Si l'attribut pushState est défini, alors la redirection est effectuée via pushState, sinon c'est document.location qui est modifié.
|
|
11
|
+
*/
|
|
3
12
|
export declare class SonicRedirect extends SonicRedirect_base {
|
|
4
|
-
udpateCallBack
|
|
13
|
+
udpateCallBack?: VoidFunction;
|
|
5
14
|
connectedCallback(): void;
|
|
6
15
|
disconnectedCallback(): void;
|
|
7
16
|
update(): void;
|
|
@@ -9,6 +9,7 @@ import { customElement } from "lit/decorators.js";
|
|
|
9
9
|
import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
|
|
10
10
|
import LocationHandler from "@supersoniks/concorde/core/utils/LocationHandler";
|
|
11
11
|
import Objects from "@supersoniks/concorde/core/utils/Objects";
|
|
12
|
+
const tagName = "sonic-redirect";
|
|
12
13
|
/**
|
|
13
14
|
* sonic-redirect permet d'effectuer une redirection.
|
|
14
15
|
* * L'URL de redirection fournie dans l'attribut *to*.
|
|
@@ -18,12 +19,7 @@ import Objects from "@supersoniks/concorde/core/utils/Objects";
|
|
|
18
19
|
* Par exemple : la données vaut {user:{id:2}} si onData="user.id"la redirection est effectuée.
|
|
19
20
|
* * Si l'attribut pushState est défini, alors la redirection est effectuée via pushState, sinon c'est document.location qui est modifié.
|
|
20
21
|
*/
|
|
21
|
-
const tagName = "sonic-redirect";
|
|
22
22
|
let SonicRedirect = class SonicRedirect extends Subscriber(LitElement) {
|
|
23
|
-
constructor() {
|
|
24
|
-
super(...arguments);
|
|
25
|
-
this.udpateCallBack = () => { };
|
|
26
|
-
}
|
|
27
23
|
connectedCallback() {
|
|
28
24
|
this.noShadowDom = "";
|
|
29
25
|
this.style.display = "none";
|
|
@@ -38,10 +34,14 @@ let SonicRedirect = class SonicRedirect extends Subscriber(LitElement) {
|
|
|
38
34
|
super.disconnectedCallback();
|
|
39
35
|
}
|
|
40
36
|
update() {
|
|
37
|
+
if (this.hasAttribute("onAdded")) {
|
|
38
|
+
LocationHandler.changeFromComponent(this);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
41
|
if (!this.props)
|
|
42
42
|
return;
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
const onDataPath = this.getAttribute("onData").split(".");
|
|
44
|
+
const searchedData = Objects.traverse(this.props, onDataPath);
|
|
45
45
|
if (searchedData && !(Objects.isObject(searchedData) && searchedData)) {
|
|
46
46
|
LocationHandler.changeFromComponent(this);
|
|
47
47
|
}
|
|
@@ -51,8 +51,3 @@ SonicRedirect = __decorate([
|
|
|
51
51
|
customElement(tagName)
|
|
52
52
|
], SonicRedirect);
|
|
53
53
|
export { SonicRedirect };
|
|
54
|
-
//Ajout pour la creation du cem notamment pour Storybook
|
|
55
|
-
try {
|
|
56
|
-
customElements.define(tagName, SonicRedirect);
|
|
57
|
-
}
|
|
58
|
-
catch (e) { }
|