@supersoniks/concorde 1.1.45 → 1.1.46
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/concorde-core.bundle.js +39 -24
- package/concorde-core.es.js +701 -231
- package/core/components/functional/fetch/fetch.d.ts +2 -1
- package/core/components/functional/list/list.d.ts +3 -1
- package/core/components/functional/list/list.js +3 -1
- package/core/components/functional/queue/queue.d.ts +8 -1
- package/core/components/functional/queue/queue.js +126 -62
- package/core/components/functional/sdui/sdui.d.ts +2 -1
- package/core/components/ui/alert/alert.d.ts +3 -0
- package/core/components/ui/alert/alert.js +33 -1
- package/core/components/ui/badge/badge.d.ts +1 -1
- package/core/components/ui/badge/badge.js +9 -3
- package/core/components/ui/button/button.d.ts +1 -0
- package/core/components/ui/form/checkbox/checkbox.d.ts +3 -0
- package/core/components/ui/form/checkbox/checkbox.js +14 -3
- package/core/components/ui/form/css/form-control.d.ts +1 -0
- package/core/components/ui/form/css/form-control.js +17 -0
- package/core/components/ui/form/input/input.d.ts +5 -3
- package/core/components/ui/form/input/input.js +47 -3
- package/core/components/ui/form/input-autocomplete/input-autocomplete.d.ts +93 -13
- package/core/components/ui/form/input-autocomplete/input-autocomplete.js +181 -52
- package/core/components/ui/form/textarea/textarea.d.ts +1 -0
- package/core/components/ui/icon/icon.js +1 -1
- package/core/components/ui/modal/modal-close.js +2 -3
- package/core/components/ui/modal/modal-content.js +1 -0
- package/core/components/ui/modal/modal.d.ts +8 -0
- package/core/components/ui/modal/modal.js +34 -6
- package/core/components/ui/pop/pop.js +18 -7
- package/core/components/ui/theme/theme-collection/core-variables.js +18 -9
- package/core/components/ui/theme/theme.js +8 -3
- package/core/mixins/Fetcher.d.ts +2 -1
- package/core/mixins/Fetcher.js +42 -10
- package/core/mixins/FormCheckable.d.ts +1 -0
- package/core/mixins/FormElement.d.ts +1 -0
- package/core/mixins/FormElement.js +6 -2
- package/core/mixins/FormInput.d.ts +1 -0
- package/core/mixins/Subscriber.d.ts +1 -0
- package/core/mixins/Subscriber.js +12 -7
- package/core/utils/PublisherProxy.d.ts +30 -3
- package/core/utils/PublisherProxy.js +218 -6
- package/core/utils/api.d.ts +3 -0
- package/core/utils/api.js +3 -1
- package/mixins.d.ts +4 -1
- package/package.json +5 -1
package/core/mixins/Fetcher.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ declare const Fetcher: <T extends Constructor<SubscriberInterface<PropsType>>, P
|
|
|
54
54
|
/**
|
|
55
55
|
* Première update, le comportement de lazyload est géré ici a l'aide d'un intersection observer.
|
|
56
56
|
*/
|
|
57
|
-
|
|
57
|
+
handleLazyLoad(): void;
|
|
58
58
|
onIntersection(entries: IntersectionObserverEntry[]): void;
|
|
59
59
|
propertyMap: object;
|
|
60
60
|
isConnected: boolean;
|
|
@@ -80,6 +80,7 @@ declare const Fetcher: <T extends Constructor<SubscriberInterface<PropsType>>, P
|
|
|
80
80
|
requestUpdate(): void;
|
|
81
81
|
getAttribute(name: string): string;
|
|
82
82
|
hasAttribute(attributeName: string): boolean;
|
|
83
|
+
getBoundingClientRect(): DOMRect;
|
|
83
84
|
};
|
|
84
85
|
} & T;
|
|
85
86
|
export default Fetcher;
|
package/core/mixins/Fetcher.js
CHANGED
|
@@ -87,29 +87,46 @@ const Fetcher = (superClass, propsType) => {
|
|
|
87
87
|
return;
|
|
88
88
|
// if (!this.dataProvider) return;
|
|
89
89
|
this.dispatchEvent(new CustomEvent("loading", { detail: this }));
|
|
90
|
-
this.
|
|
91
|
-
|
|
90
|
+
if (this.getAttribute("localStorage") === "enabled") {
|
|
91
|
+
yield PublisherManager.getInstance().isLocalStrorageReady;
|
|
92
|
+
}
|
|
93
|
+
if (!this.isConnected)
|
|
94
|
+
return;
|
|
92
95
|
const hasLoader = this.isDefaultLoaderEnabled && !this.hasAttribute("noLoader");
|
|
93
|
-
if (hasLoader)
|
|
96
|
+
if (hasLoader) {
|
|
94
97
|
Loader.show();
|
|
98
|
+
}
|
|
95
99
|
const headerData = PublisherManager.getInstance()
|
|
96
100
|
.get(this.getAncestorAttributeValue("headersDataProvider"))
|
|
97
101
|
.get();
|
|
102
|
+
this.isLoading = true;
|
|
103
|
+
if (Objects.isObject(this.props) && Object.keys(this.props || {}).length > 0 && this.isFirstLoad) {
|
|
104
|
+
this.dispatchEvent(new CustomEvent("load", { detail: this }));
|
|
105
|
+
this.isFirstLoad = false;
|
|
106
|
+
this.isLoading = false;
|
|
107
|
+
}
|
|
98
108
|
let data = yield this.api.get(this.endPoint || this.dataProvider || "", headerData);
|
|
109
|
+
if (!this.isConnected) {
|
|
110
|
+
if (hasLoader)
|
|
111
|
+
Loader.hide();
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
99
114
|
// Je garde ça mais normalement ça n'arrive jamais
|
|
100
115
|
if (!data) {
|
|
101
116
|
SonicToast.add({ text: "Network Error", status: "error" });
|
|
102
117
|
this.isLoading = false;
|
|
103
|
-
if (hasLoader)
|
|
118
|
+
if (hasLoader) {
|
|
104
119
|
Loader.hide();
|
|
120
|
+
}
|
|
105
121
|
return;
|
|
106
122
|
}
|
|
107
123
|
// Si data ne contient que la réponse HTTP, avec un statut not ok, on affiche un message
|
|
108
124
|
else if (data._sonic_http_response_ && !data._sonic_http_response_.ok && Object.keys(data).length === 1) {
|
|
109
125
|
SonicToast.add({ text: "Network Error", status: "error" });
|
|
110
126
|
}
|
|
111
|
-
if (hasLoader)
|
|
127
|
+
if (hasLoader) {
|
|
112
128
|
Loader.hide();
|
|
129
|
+
}
|
|
113
130
|
if (this.key) {
|
|
114
131
|
const response = data._sonic_http_response_;
|
|
115
132
|
/* preserveOtherKeys s'exprime lorsque le paramètre "key" est défini
|
|
@@ -138,11 +155,10 @@ const Fetcher = (superClass, propsType) => {
|
|
|
138
155
|
connectedCallback() {
|
|
139
156
|
var _a;
|
|
140
157
|
// this.noShadowDom = "";
|
|
158
|
+
super.connectedCallback();
|
|
141
159
|
if (!this.isFetchEnabled) {
|
|
142
|
-
super.connectedCallback();
|
|
143
160
|
return;
|
|
144
161
|
}
|
|
145
|
-
super.connectedCallback();
|
|
146
162
|
this.key = this.getAttribute("key");
|
|
147
163
|
if (this.props) {
|
|
148
164
|
this.publisher.set(this.props);
|
|
@@ -153,25 +169,38 @@ const Fetcher = (superClass, propsType) => {
|
|
|
153
169
|
if (lazyLoad === null) {
|
|
154
170
|
this._fetchData();
|
|
155
171
|
}
|
|
172
|
+
else {
|
|
173
|
+
this.handleLazyLoad();
|
|
174
|
+
}
|
|
156
175
|
}
|
|
157
176
|
/**
|
|
158
177
|
* Première update, le comportement de lazyload est géré ici a l'aide d'un intersection observer.
|
|
159
178
|
*/
|
|
160
|
-
|
|
179
|
+
handleLazyLoad() {
|
|
161
180
|
const lazyLoad = this.getAttribute("lazyload");
|
|
162
181
|
if (lazyLoad === null) {
|
|
163
182
|
return;
|
|
164
183
|
}
|
|
184
|
+
const rect = this.getBoundingClientRect();
|
|
185
|
+
if (rect.x < window.innerWidth && rect.right > 0 && rect.y < window.innerHeight && rect.right > 0) {
|
|
186
|
+
this._fetchData();
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
const boundsRatio = parseFloat(this.getAttribute("lazyBoundsRatio") || "1");
|
|
165
190
|
const options = {
|
|
166
191
|
root: null,
|
|
167
|
-
rootMargin: Math.max(window.innerWidth, window.innerHeight) + "px",
|
|
192
|
+
rootMargin: Math.max(window.innerWidth * boundsRatio, window.innerHeight * boundsRatio) + "px",
|
|
168
193
|
};
|
|
169
194
|
this.iObserver = new IntersectionObserver((entries) => this.onIntersection(entries), options);
|
|
170
|
-
|
|
195
|
+
/**
|
|
196
|
+
* on retire cette partie car finalement on mets systématiquement un span pour la détection de l'intersection
|
|
197
|
+
*/
|
|
198
|
+
let elt = (this.shadowRoot ? this.shadowRoot.children[0] : this.children[0]);
|
|
171
199
|
if (elt && elt.nodeName.toLocaleLowerCase() == "slot")
|
|
172
200
|
elt = elt.children[0];
|
|
173
201
|
if (!elt || elt.nodeName.toLocaleLowerCase() == "template") {
|
|
174
202
|
elt = document.createElement("span");
|
|
203
|
+
// const elt = document.createElement("span");
|
|
175
204
|
this.appendChild(elt);
|
|
176
205
|
}
|
|
177
206
|
if (elt) {
|
|
@@ -182,9 +211,12 @@ const Fetcher = (superClass, propsType) => {
|
|
|
182
211
|
}
|
|
183
212
|
}
|
|
184
213
|
onIntersection(entries) {
|
|
214
|
+
var _a;
|
|
185
215
|
for (const e of entries) {
|
|
186
216
|
if (e.isIntersecting && this.isFirstLoad) {
|
|
187
217
|
this._fetchData();
|
|
218
|
+
(_a = this.iObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
219
|
+
break;
|
|
188
220
|
}
|
|
189
221
|
}
|
|
190
222
|
}
|
|
@@ -81,6 +81,7 @@ declare const Form: <T extends Constructor<FormElementInterface>>(superClass: T)
|
|
|
81
81
|
requestUpdate(): void;
|
|
82
82
|
getAttribute(name: string): string;
|
|
83
83
|
hasAttribute(attributeName: string): boolean;
|
|
84
|
+
getBoundingClientRect(): DOMRect;
|
|
84
85
|
};
|
|
85
86
|
} & T;
|
|
86
87
|
export default Form;
|
|
@@ -11,6 +11,7 @@ export interface FormElementInterface extends SubscriberInterface {
|
|
|
11
11
|
getValueForFormPublisher(): FormElementValue;
|
|
12
12
|
validateFormElement(): void;
|
|
13
13
|
focus?: () => void;
|
|
14
|
+
forceAutoFill: boolean;
|
|
14
15
|
shadowRoot?: ShadowRoot;
|
|
15
16
|
error: boolean;
|
|
16
17
|
autofocus: boolean;
|
|
@@ -74,7 +74,8 @@ const Form = (superClass) => {
|
|
|
74
74
|
}
|
|
75
75
|
getFormPublisher() {
|
|
76
76
|
if (!this.formDataProvider)
|
|
77
|
-
this.formDataProvider =
|
|
77
|
+
this.formDataProvider =
|
|
78
|
+
this.getAncestorAttributeValue("formDataProvider");
|
|
78
79
|
if (this.formDataProvider) {
|
|
79
80
|
return PublisherManager.get(this.formDataProvider);
|
|
80
81
|
}
|
|
@@ -120,7 +121,9 @@ const Form = (superClass) => {
|
|
|
120
121
|
}
|
|
121
122
|
initPublisher() {
|
|
122
123
|
let formPublisher = this.getFormPublisher();
|
|
123
|
-
const value = this.hasAncestorAttribute("initFromPublisher") &&
|
|
124
|
+
const value = this.hasAncestorAttribute("initFromPublisher") &&
|
|
125
|
+
this._name &&
|
|
126
|
+
formPublisher[this._name].get()
|
|
124
127
|
? formPublisher[this._name].get()
|
|
125
128
|
: this.getAttribute("value");
|
|
126
129
|
if (this._name && this.publisher)
|
|
@@ -219,6 +222,7 @@ const Form = (superClass) => {
|
|
|
219
222
|
if (elt && elt.focus) {
|
|
220
223
|
elt.focus();
|
|
221
224
|
e.preventDefault();
|
|
225
|
+
e.stopPropagation();
|
|
222
226
|
}
|
|
223
227
|
});
|
|
224
228
|
}
|
|
@@ -65,6 +65,7 @@ declare const Form: <T extends Constructor<FormElementInterface>>(superClass: T)
|
|
|
65
65
|
getAttribute(name: string): string;
|
|
66
66
|
hasAttribute(attributeName: string): boolean;
|
|
67
67
|
disconnectedCallback(): void;
|
|
68
|
+
getBoundingClientRect(): DOMRect;
|
|
68
69
|
};
|
|
69
70
|
} & T;
|
|
70
71
|
export default Form;
|
|
@@ -30,6 +30,7 @@ export interface SubscriberInterface<PropsType = CoreJSType> {
|
|
|
30
30
|
getAttribute(name: string): string;
|
|
31
31
|
hasAttribute(attributeName: string): boolean;
|
|
32
32
|
disconnectedCallback(): void;
|
|
33
|
+
getBoundingClientRect(): DOMRect;
|
|
33
34
|
}
|
|
34
35
|
declare const Subscriber: <PropsType = CoreJSType, T extends Constructor<LitElement> = Constructor<LitElement>>(superClass: T, type?: PropsType | undefined) => Constructor<SubscriberInterface<PropsType>> & T;
|
|
35
36
|
export default Subscriber;
|
|
@@ -141,18 +141,22 @@ const Subscriber = (superClass, type) => {
|
|
|
141
141
|
this.style.removeProperty("display");
|
|
142
142
|
}
|
|
143
143
|
connectedCallback() {
|
|
144
|
+
SubscriberElement.instanceCounter++;
|
|
144
145
|
if (this.hasAttribute("lazyRendering")) {
|
|
145
146
|
const options = {
|
|
146
147
|
root: null,
|
|
147
|
-
rootMargin: Math.max(window.innerWidth
|
|
148
|
+
rootMargin: Math.max(window.innerWidth, window.innerHeight) + "px",
|
|
148
149
|
};
|
|
149
150
|
let firstView = true;
|
|
150
151
|
const iObserver = new IntersectionObserver((entries) => {
|
|
151
152
|
for (const e of entries) {
|
|
152
153
|
if (firstView && e.isIntersecting) {
|
|
154
|
+
this.addDebugger();
|
|
153
155
|
firstView = false;
|
|
154
156
|
this.initWording();
|
|
155
157
|
this.initPublisher();
|
|
158
|
+
iObserver.disconnect();
|
|
159
|
+
break;
|
|
156
160
|
}
|
|
157
161
|
}
|
|
158
162
|
}, options);
|
|
@@ -161,10 +165,9 @@ const Subscriber = (superClass, type) => {
|
|
|
161
165
|
else {
|
|
162
166
|
this.initWording();
|
|
163
167
|
this.initPublisher();
|
|
168
|
+
this.addDebugger();
|
|
164
169
|
}
|
|
165
|
-
this.addDebugger();
|
|
166
170
|
super.connectedCallback();
|
|
167
|
-
SubscriberElement.instanceCounter++;
|
|
168
171
|
}
|
|
169
172
|
disconnectedCallback() {
|
|
170
173
|
var _a;
|
|
@@ -260,7 +263,8 @@ const Subscriber = (superClass, type) => {
|
|
|
260
263
|
password = this.getAncestorAttributeValue("password");
|
|
261
264
|
}
|
|
262
265
|
const credentials = this.getAncestorAttributeValue("credentials") || undefined;
|
|
263
|
-
|
|
266
|
+
const cache = (this.getAttribute("cache") || undefined) || undefined;
|
|
267
|
+
return { serviceURL, token, userName, password, authToken, tokenProvider, addHTTPResponse, credentials, cache };
|
|
264
268
|
}
|
|
265
269
|
initWording() {
|
|
266
270
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -274,16 +278,17 @@ const Subscriber = (superClass, type) => {
|
|
|
274
278
|
}
|
|
275
279
|
if (!hasWording)
|
|
276
280
|
return;
|
|
277
|
-
const publisher = PublisherManager.
|
|
281
|
+
const publisher = PublisherManager.get("sonic-wording");
|
|
278
282
|
const wordingProvider = this.getAncestorAttributeValue("wordingProvider");
|
|
279
283
|
const api = new API(this.getApiConfiguration());
|
|
280
284
|
if (wordingProvider) {
|
|
281
285
|
const wordings = [];
|
|
282
286
|
const wordingsAll = [];
|
|
287
|
+
const publisherValue = publisher.get();
|
|
283
288
|
for (const p of propNames) {
|
|
284
289
|
if (p.indexOf("wording_") == 0) {
|
|
285
290
|
const p8 = p.substring(8);
|
|
286
|
-
if (!
|
|
291
|
+
if (!publisherValue[p]) {
|
|
287
292
|
publisher[p] = "...";
|
|
288
293
|
wordings.push(p8);
|
|
289
294
|
}
|
|
@@ -334,7 +339,7 @@ const Subscriber = (superClass, type) => {
|
|
|
334
339
|
if (this.bindPublisher) {
|
|
335
340
|
mng.set(publisherId, this.bindPublisher());
|
|
336
341
|
}
|
|
337
|
-
let pub = mng.get(publisherId);
|
|
342
|
+
let pub = mng.get(publisherId, { localStorageMode: this.getAttribute("localStorage") || "disabled" });
|
|
338
343
|
this.dataProvider = publisherId;
|
|
339
344
|
if (this.hasAttribute("subDataProvider")) {
|
|
340
345
|
const dataPath = this.getAttribute("subDataProvider");
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Merci de laisser ce fichier sans la moindre dépendance en dehors de types du ceur.
|
|
4
4
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
5
5
|
* **/
|
|
6
|
-
import { CoreJSType, PublisherContentType } from "../_types/types";
|
|
6
|
+
import { PublisherInterface, CoreJSType, PublisherContentType } from "../_types/types";
|
|
7
7
|
type DynamicFillingListener = any;
|
|
8
8
|
type TemplateFillingListener = {
|
|
9
9
|
propertyMap: Record<string, string>;
|
|
@@ -12,15 +12,19 @@ type TemplateFillingListener = {
|
|
|
12
12
|
* Custom Proxy contient les méthodes des publishers retournés par PublisherManager.get(publisherId) qui seront utilisées couramment
|
|
13
13
|
*/
|
|
14
14
|
export declare class PublisherProxy<T = any> {
|
|
15
|
+
static instances: Map<number, PublisherProxy<any>>;
|
|
16
|
+
static instancesCounter: number;
|
|
15
17
|
_proxies_: Map<string, PublisherProxy>;
|
|
16
18
|
_value_: T;
|
|
17
19
|
_key_: string;
|
|
20
|
+
_is_savable_: boolean;
|
|
18
21
|
_invalidateListeners_: Set<VoidFunction>;
|
|
19
22
|
_assignListeners_: Set<(value: T) => void>;
|
|
20
23
|
_mutationListeners_: Set<VoidFunction>;
|
|
21
24
|
_fillListeners_: Set<Record<string, CoreJSType>>;
|
|
22
25
|
_templateFillListeners_: Set<any>;
|
|
23
26
|
_lockInternalMutationPublishing_: boolean;
|
|
27
|
+
_instanceCounter_: number;
|
|
24
28
|
parent: PublisherProxy | null;
|
|
25
29
|
root: PublisherProxy;
|
|
26
30
|
constructor(target: T, parentProxPub: PublisherProxy | null);
|
|
@@ -91,6 +95,10 @@ export declare class PublisherProxy<T = any> {
|
|
|
91
95
|
* Extraire la valeur actuelle du proxy
|
|
92
96
|
*/
|
|
93
97
|
get(): T;
|
|
98
|
+
/**
|
|
99
|
+
* retourner le webcomponent auquel le proxy est associé
|
|
100
|
+
*/
|
|
101
|
+
get $tag(): string;
|
|
94
102
|
}
|
|
95
103
|
/**
|
|
96
104
|
* Utilitaires de gestion des Publisher
|
|
@@ -98,9 +106,19 @@ export declare class PublisherProxy<T = any> {
|
|
|
98
106
|
*
|
|
99
107
|
*/
|
|
100
108
|
export declare class PublisherManager {
|
|
109
|
+
static changed: boolean;
|
|
110
|
+
static saving: boolean;
|
|
111
|
+
static saveId: number;
|
|
101
112
|
static instance: PublisherManager | null;
|
|
113
|
+
enabledLocaStorageProxies: string[];
|
|
102
114
|
publishers: Map<string, Publisher<PublisherContentType>>;
|
|
115
|
+
localStorageData: Record<string, {
|
|
116
|
+
lastModifiationMS: number;
|
|
117
|
+
data: PublisherContentType;
|
|
118
|
+
}>;
|
|
119
|
+
isLocalStrorageReady: Promise<boolean> | null;
|
|
103
120
|
constructor();
|
|
121
|
+
cleanStorageData(): Promise<unknown>;
|
|
104
122
|
/**
|
|
105
123
|
* PublisherManager est un singleton
|
|
106
124
|
*/
|
|
@@ -109,7 +127,9 @@ export declare class PublisherManager {
|
|
|
109
127
|
* shortcut static pour obtenir un publisher vias sont id/adresse sans taper getInstance.
|
|
110
128
|
* Si le publisher n'existe pas, il est créé.
|
|
111
129
|
*/
|
|
112
|
-
static get(id: string
|
|
130
|
+
static get(id: string, options?: {
|
|
131
|
+
localStorageMode?: string;
|
|
132
|
+
}): any;
|
|
113
133
|
/**
|
|
114
134
|
* shortcut static pour supprimer un publisher de la liste et appel également delete sur le publisher ce qui le supprime, de même que ses sous publishers
|
|
115
135
|
*/
|
|
@@ -118,7 +138,11 @@ export declare class PublisherManager {
|
|
|
118
138
|
* Obtenir un publisher vias sont id/adresse
|
|
119
139
|
* Si le publisher n'existe pas, il est créé.
|
|
120
140
|
*/
|
|
121
|
-
|
|
141
|
+
setLocalData(publisher: PublisherInterface, id: string): Promise<void>;
|
|
142
|
+
initialisedData: string[];
|
|
143
|
+
get(id: string, options?: {
|
|
144
|
+
localStorageMode?: string;
|
|
145
|
+
}): any;
|
|
122
146
|
/**
|
|
123
147
|
* Remplace un publisher pour l'id fourni par un autre.
|
|
124
148
|
* L'autre publisher n'est pas supprimé.
|
|
@@ -128,6 +152,9 @@ export declare class PublisherManager {
|
|
|
128
152
|
* supprimer un publisher de la liste et appel également delete sur le publisher ce qui le supprime, de même que ses sous publishers
|
|
129
153
|
*/
|
|
130
154
|
delete(id: string): boolean;
|
|
155
|
+
saveToLocalStorage(saveId?: number): Promise<void>;
|
|
156
|
+
compress(string: string, encoding: string): Promise<string>;
|
|
157
|
+
decompress(str: string, encoding: string): Promise<string>;
|
|
131
158
|
}
|
|
132
159
|
/**
|
|
133
160
|
* Le Proxy Javascript
|