@supersoniks/concorde 2.0.2 → 2.0.3
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 +1 -0
- package/concorde-core.bundle.js +748 -690
- package/concorde-core.es.js +3897 -3116
- package/core/_types/types.d.ts +2 -4
- package/core/components/functional/date/date.d.ts +4 -2
- package/core/components/functional/date/date.js +28 -13
- package/core/components/functional/fetch/fetch.d.ts +9 -10
- package/core/components/functional/fetch/fetch.js +21 -5
- package/core/components/functional/list/list.d.ts +7 -10
- package/core/components/functional/list/list.js +19 -4
- package/core/components/functional/queue/queue.d.ts +3 -2
- package/core/components/functional/queue/queue.js +66 -61
- package/core/components/functional/router/router.d.ts +1 -0
- package/core/components/functional/router/router.js +12 -1
- package/core/components/functional/sdui/sdui.d.ts +2 -7
- package/core/components/functional/submit/submit.js +11 -4
- package/core/components/ui/_css/scroll.js +13 -11
- package/core/components/ui/_css/size.js +1 -1
- package/core/components/ui/alert/alert.d.ts +14 -3
- package/core/components/ui/alert/alert.js +34 -4
- package/core/components/ui/badge/badge.js +10 -3
- package/core/components/ui/button/button.d.ts +19 -10
- package/core/components/ui/button/button.js +77 -22
- package/core/components/ui/captcha/captcha.d.ts +5 -4
- package/core/components/ui/captcha/captcha.js +33 -9
- package/core/components/ui/divider/divider.d.ts +2 -0
- package/core/components/ui/divider/divider.js +17 -2
- package/core/components/ui/form/checkbox/checkbox.d.ts +24 -9
- package/core/components/ui/form/checkbox/checkbox.js +4 -6
- package/core/components/ui/form/css/form-control.js +40 -7
- package/core/components/ui/form/fieldset/fieldset.d.ts +1 -0
- package/core/components/ui/form/fieldset/fieldset.js +14 -1
- package/core/components/ui/form/fieldset/legend-description.js +3 -3
- package/core/components/ui/form/fieldset/legend.js +2 -8
- package/core/components/ui/form/input/input.d.ts +4 -5
- package/core/components/ui/form/input/input.js +17 -13
- package/core/components/ui/form/input-autocomplete/input-autocomplete.d.ts +3 -5
- package/core/components/ui/form/input-autocomplete/input-autocomplete.js +9 -9
- package/core/components/ui/form/select/select.d.ts +4 -1
- package/core/components/ui/form/select/select.js +25 -18
- package/core/components/ui/form/textarea/textarea.d.ts +4 -5
- package/core/components/ui/form/textarea/textarea.js +19 -10
- package/core/components/ui/group/group.js +3 -3
- package/core/components/ui/icon/icon.js +2 -1
- package/core/components/ui/icon/icons.d.ts +0 -4
- package/core/components/ui/icon/icons.js +3 -16
- package/core/components/ui/link/link.d.ts +5 -2
- package/core/components/ui/link/link.js +31 -2
- package/core/components/ui/loader/loader.d.ts +4 -1
- package/core/components/ui/loader/loader.js +11 -3
- package/core/components/ui/loader/styles/inline.js +14 -16
- package/core/components/ui/menu/menu-item.js +2 -1
- package/core/components/ui/menu/menu.js +6 -22
- package/core/components/ui/modal/modal-close.js +2 -1
- package/core/components/ui/modal/modal.d.ts +13 -1
- package/core/components/ui/modal/modal.js +70 -10
- package/core/components/ui/pop/pop.d.ts +9 -3
- package/core/components/ui/pop/pop.js +46 -23
- package/core/components/ui/table/table-tr.d.ts +10 -2
- package/core/components/ui/table/table-tr.js +30 -2
- package/core/components/ui/table/table.d.ts +1 -0
- package/core/components/ui/table/table.js +7 -1
- package/core/components/ui/theme/theme-collection/core-variables.js +8 -19
- package/core/components/ui/theme/theme.d.ts +6 -0
- package/core/components/ui/theme/theme.js +11 -13
- package/core/components/ui/toast/message-subscriber.d.ts +0 -8
- package/core/components/ui/toast/message-subscriber.js +0 -46
- package/core/components/ui/toast/toast-item.js +31 -40
- package/core/components/ui/toast/toast.d.ts +5 -1
- package/core/components/ui/toast/toast.js +80 -13
- package/core/components/ui/tooltip/tooltip.d.ts +3 -1
- package/core/components/ui/tooltip/tooltip.js +22 -0
- package/core/decorators/Subscriber.d.ts +3 -3
- package/core/decorators/Subscriber.js +64 -21
- package/core/directives/DataProvider.d.ts +12 -7
- package/core/directives/DataProvider.js +23 -8
- package/core/directives/Wording.d.ts +42 -0
- package/core/directives/Wording.js +202 -0
- package/core/mixins/Fetcher.d.ts +8 -11
- package/core/mixins/Fetcher.js +38 -22
- package/core/mixins/FormCheckable.d.ts +1 -4
- package/core/mixins/FormElement.d.ts +1 -0
- package/core/mixins/FormElement.js +3 -6
- package/core/mixins/FormInput.d.ts +3 -5
- package/core/mixins/FormInput.js +4 -0
- package/core/mixins/Subscriber.d.ts +0 -4
- package/core/mixins/Subscriber.js +13 -89
- package/core/mixins/TemplatesContainer.js +9 -0
- package/core/utils/Format.d.ts +1 -0
- package/core/utils/Format.js +16 -0
- package/core/utils/HTML.d.ts +13 -0
- package/core/utils/HTML.js +42 -3
- package/core/utils/Objects.d.ts +1 -0
- package/core/utils/Objects.js +5 -0
- package/core/utils/PublisherProxy.d.ts +16 -10
- package/core/utils/PublisherProxy.js +100 -64
- package/core/utils/Utils.d.ts +1 -0
- package/core/utils/Utils.js +5 -0
- package/core/utils/api.d.ts +26 -0
- package/core/utils/api.js +135 -3
- package/mixins.d.ts +6 -16
- package/package.json +7 -2
|
@@ -4,29 +4,14 @@ 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 API from "@supersoniks/concorde/core/utils/api";
|
|
8
7
|
import DataBindObserver from "@supersoniks/concorde/core/utils/DataBindObserver";
|
|
9
8
|
import HTML from "@supersoniks/concorde/core/utils/HTML";
|
|
10
9
|
import Objects from "@supersoniks/concorde/core/utils/Objects";
|
|
11
10
|
import { PublisherManager } from "@supersoniks/concorde/core/utils/PublisherProxy";
|
|
12
11
|
import { property } from "lit/decorators.js";
|
|
12
|
+
import WordingDirective from "../directives/Wording";
|
|
13
13
|
let keepDebugOnMouseOut = false;
|
|
14
14
|
let debugs = new Set();
|
|
15
|
-
//Pour référence
|
|
16
|
-
// export class Subscribable extends HTMLElement {
|
|
17
|
-
// constructor() {
|
|
18
|
-
// super();
|
|
19
|
-
// }
|
|
20
|
-
// requestUpdate(name?: PropertyKey, oldValue?: unknown, options?: PropertyDeclaration): void{name;oldValue;options;}
|
|
21
|
-
// protected updated(changedProperties: Map<string, PropertyDeclaration>): void {
|
|
22
|
-
// changedProperties;
|
|
23
|
-
// }
|
|
24
|
-
// connectedCallback(): void {}
|
|
25
|
-
// disconnectedCallback(): void {}
|
|
26
|
-
// protected createRenderRoot(): Element | ShadowRoot {
|
|
27
|
-
// return this.shadowRoot || this;
|
|
28
|
-
// }
|
|
29
|
-
// }
|
|
30
15
|
const Subscriber = (superClass, type) => {
|
|
31
16
|
/**
|
|
32
17
|
* La mixin Subscriber permet lier un composant à un publisher.
|
|
@@ -88,26 +73,6 @@ const Subscriber = (superClass, type) => {
|
|
|
88
73
|
};
|
|
89
74
|
args;
|
|
90
75
|
}
|
|
91
|
-
onConnected(callback) {
|
|
92
|
-
if (!this.connectedCallbackCalls)
|
|
93
|
-
this.connectedCallbackCalls = new Set();
|
|
94
|
-
this.connectedCallbackCalls.add(callback);
|
|
95
|
-
}
|
|
96
|
-
onDisconnected(callback) {
|
|
97
|
-
if (!this.disconnectedCallbackCalls)
|
|
98
|
-
this.disconnectedCallbackCalls = new Set();
|
|
99
|
-
this.disconnectedCallbackCalls.add(callback);
|
|
100
|
-
}
|
|
101
|
-
offConnected(callback) {
|
|
102
|
-
if (!this.connectedCallbackCalls)
|
|
103
|
-
this.connectedCallbackCalls = new Set();
|
|
104
|
-
this.connectedCallbackCalls.delete(callback);
|
|
105
|
-
}
|
|
106
|
-
offDisconnected(callback) {
|
|
107
|
-
if (!this.disconnectedCallbackCalls)
|
|
108
|
-
this.disconnectedCallbackCalls = new Set();
|
|
109
|
-
this.disconnectedCallbackCalls.delete(callback);
|
|
110
|
-
}
|
|
111
76
|
/**
|
|
112
77
|
* va de parent en parent pour trouver un attribut
|
|
113
78
|
* @param attributeName nom de l'attribut
|
|
@@ -157,7 +122,8 @@ const Subscriber = (superClass, type) => {
|
|
|
157
122
|
if (this.hasAttribute("lazyRendering")) {
|
|
158
123
|
const options = {
|
|
159
124
|
root: null,
|
|
160
|
-
rootMargin: Math.max(window.innerWidth, window.innerHeight) + "px",
|
|
125
|
+
// rootMargin: Math.max(window.innerWidth, window.innerHeight) + "px",
|
|
126
|
+
threshold: 0.9,
|
|
161
127
|
};
|
|
162
128
|
let firstView = true;
|
|
163
129
|
const iObserver = new IntersectionObserver((entries) => {
|
|
@@ -180,18 +146,15 @@ const Subscriber = (superClass, type) => {
|
|
|
180
146
|
this.addDebugger();
|
|
181
147
|
}
|
|
182
148
|
super.connectedCallback();
|
|
183
|
-
this.connectedCallbackCalls?.forEach((cb) => cb(this));
|
|
184
149
|
}
|
|
185
150
|
disconnectedCallback() {
|
|
186
|
-
this.disconnectedCallbackCalls?.forEach((cb) => cb(this));
|
|
187
151
|
this.removeDebugger();
|
|
188
152
|
super.disconnectedCallback();
|
|
189
153
|
if (this.publisher) {
|
|
190
154
|
this.publisher.stopTemplateFilling(this);
|
|
191
155
|
this.publisher.offInternalMutation(this.requestUpdate);
|
|
192
156
|
}
|
|
193
|
-
|
|
194
|
-
this.wordingPublisher.stopTemplateFilling(this);
|
|
157
|
+
WordingDirective.publisher.stopTemplateFilling(this);
|
|
195
158
|
if (this.onAssign)
|
|
196
159
|
this.publisher?.offAssign(this.onAssign);
|
|
197
160
|
}
|
|
@@ -262,61 +225,22 @@ const Subscriber = (superClass, type) => {
|
|
|
262
225
|
* A voir si on le bouge dans un utilitaire
|
|
263
226
|
*/
|
|
264
227
|
getApiConfiguration() {
|
|
265
|
-
|
|
266
|
-
const addHTTPResponse = this.getAncestorAttributeValue("addHTTPResponse") != null;
|
|
267
|
-
const serviceURL = this.getAncestorAttributeValue("serviceURL");
|
|
268
|
-
let userName = null;
|
|
269
|
-
let password = null;
|
|
270
|
-
const tokenProvider = this.getAncestorAttributeValue("tokenProvider");
|
|
271
|
-
const authToken = this.getAncestorAttributeValue("eventsApiToken");
|
|
272
|
-
if (!token) {
|
|
273
|
-
userName = this.getAncestorAttributeValue("userName");
|
|
274
|
-
password = this.getAncestorAttributeValue("password");
|
|
275
|
-
}
|
|
276
|
-
const credentials = this.getAncestorAttributeValue("credentials") || undefined;
|
|
277
|
-
const cache = (this.getAttribute("cache") || undefined) || undefined;
|
|
278
|
-
return { serviceURL, token, userName, password, authToken, tokenProvider, addHTTPResponse, credentials, cache };
|
|
228
|
+
return HTML.getApiConfiguration(this);
|
|
279
229
|
}
|
|
230
|
+
/**
|
|
231
|
+
* Initialise le remplisage automatique des traductions / du wording
|
|
232
|
+
* Un publisher spécifique est créé pour le composant à l'adresse "sonic-wording"
|
|
233
|
+
* Le composant recherche la valeur de l'attribute "wordingProvider" que contient le point d'accès à l'api de traduction / libellés
|
|
234
|
+
* Il utilise ce service et le publisher créé pour remplir automatiquement toutes les propriétés préfixées avec "wording_".
|
|
235
|
+
*/
|
|
280
236
|
async initWording() {
|
|
281
|
-
let hasWording = false;
|
|
282
237
|
const propNames = Object.getOwnPropertyNames(this.constructor.prototype);
|
|
283
238
|
for (const p of propNames) {
|
|
284
239
|
if (p.indexOf("wording_") == 0) {
|
|
285
|
-
|
|
286
|
-
break;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
if (!hasWording)
|
|
290
|
-
return;
|
|
291
|
-
const publisher = PublisherManager.get("sonic-wording", { localStorageMode: "enabled" });
|
|
292
|
-
await PublisherManager.getInstance().isLocalStrorageReady;
|
|
293
|
-
const wordingProvider = this.getAncestorAttributeValue("wordingProvider");
|
|
294
|
-
const api = new API(this.getApiConfiguration());
|
|
295
|
-
if (wordingProvider) {
|
|
296
|
-
const wordings = [];
|
|
297
|
-
const wordingsAll = [];
|
|
298
|
-
const publisherValue = publisher.get();
|
|
299
|
-
for (const p of propNames) {
|
|
300
|
-
if (p.indexOf("wording_") == 0) {
|
|
301
|
-
const p8 = p.substring(8);
|
|
302
|
-
if (!publisherValue[p]) {
|
|
303
|
-
publisher[p] = "...";
|
|
304
|
-
wordings.push(p8);
|
|
305
|
-
}
|
|
306
|
-
wordingsAll.push(p8);
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
if (wordings.length > 0) {
|
|
310
|
-
const calledURL = wordingProvider + "?labels[]=" + wordings.join("&labels[]=");
|
|
311
|
-
// const result = (await api.post(wordingProvider, {labels: wordings})) as Record<string, string>;
|
|
312
|
-
const result = (await api.get(calledURL));
|
|
313
|
-
for (const elt in result) {
|
|
314
|
-
publisher["wording_" + elt] = result[elt];
|
|
315
|
-
}
|
|
240
|
+
WordingDirective.callApi(this, p.substring(8));
|
|
316
241
|
}
|
|
317
|
-
publisher.startTemplateFilling(this);
|
|
318
|
-
this.wordingPublisher = publisher;
|
|
319
242
|
}
|
|
243
|
+
WordingDirective.publisher.startTemplateFilling(this);
|
|
320
244
|
}
|
|
321
245
|
/**
|
|
322
246
|
*
|
|
@@ -45,6 +45,15 @@ const TemplatesContainer = (superClass) => {
|
|
|
45
45
|
this.templateParts[t.getAttribute(this.templateValueAttribute)] = t;
|
|
46
46
|
this.templatePartsList.push(t);
|
|
47
47
|
}
|
|
48
|
+
if (t.hasAttribute("skeleton")) {
|
|
49
|
+
this.templateParts["skeleton"] = t;
|
|
50
|
+
}
|
|
51
|
+
if (t.hasAttribute("no-result")) {
|
|
52
|
+
this.templateParts["no-result"] = t;
|
|
53
|
+
}
|
|
54
|
+
if (t.hasAttribute("no-item")) {
|
|
55
|
+
this.templateParts["no-item"] = t;
|
|
56
|
+
}
|
|
48
57
|
}
|
|
49
58
|
this.templateList = templates.filter((t) => !t.getAttribute("data-value"));
|
|
50
59
|
if (this.templateList.length == 0)
|
package/core/utils/Format.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ declare class Format {
|
|
|
3
3
|
* Passe le premier caractère de la chaine en majuscule
|
|
4
4
|
*/
|
|
5
5
|
static ucFirst(str: string): string;
|
|
6
|
+
static minutesDuration(minutes: number, locale?: string, unitDisplay?: "long" | "short" | "narrow" | undefined): string;
|
|
6
7
|
/**
|
|
7
8
|
* Retourne le résultat de l'évaluation de la chaine fournie
|
|
8
9
|
*/
|
package/core/utils/Format.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import HTML from "@supersoniks/concorde/core/utils/HTML";
|
|
1
2
|
class Format {
|
|
2
3
|
/**
|
|
3
4
|
* Passe le premier caractère de la chaine en majuscule
|
|
@@ -7,6 +8,21 @@ class Format {
|
|
|
7
8
|
return str;
|
|
8
9
|
return str.charAt(0).toUpperCase() + str.substring(1);
|
|
9
10
|
}
|
|
11
|
+
static minutesDuration(minutes, locale = "", unitDisplay = "long") {
|
|
12
|
+
if (!locale)
|
|
13
|
+
locale = HTML.getLanguage();
|
|
14
|
+
const divMod = (n, m) => [Math.floor(n / m), n % m];
|
|
15
|
+
function timeUnitFormatter(locale, unit, unitDisplay) {
|
|
16
|
+
return Intl.NumberFormat(locale, { style: "unit", unit, unitDisplay }).format;
|
|
17
|
+
}
|
|
18
|
+
const [hrs, mins] = divMod(minutes, 60);
|
|
19
|
+
const list = [];
|
|
20
|
+
if (hrs)
|
|
21
|
+
list.push(timeUnitFormatter(locale, "hour", unitDisplay)(hrs));
|
|
22
|
+
if (mins)
|
|
23
|
+
list.push(timeUnitFormatter(locale, "minute", unitDisplay)(mins));
|
|
24
|
+
return new Intl.ListFormat(locale, { style: "long", type: "conjunction" }).format(list);
|
|
25
|
+
}
|
|
10
26
|
/**
|
|
11
27
|
* Retourne le résultat de l'évaluation de la chaine fournie
|
|
12
28
|
*/
|
package/core/utils/HTML.d.ts
CHANGED
|
@@ -1,16 +1,29 @@
|
|
|
1
1
|
export type SearchableDomElement = HTMLElement | ShadowRoot;
|
|
2
|
+
import { APIConfiguration } from "./api";
|
|
2
3
|
declare class HTML {
|
|
3
4
|
/**
|
|
4
5
|
* retourne la langue de la page courante telle que défini via l'attribut lang de la balise html
|
|
5
6
|
*/
|
|
6
7
|
static getLanguage(): string;
|
|
7
8
|
static getCookies(): Record<string, string>;
|
|
9
|
+
static everyAncestors(node: SearchableDomElement, callback: (node: SearchableDomElement) => boolean): void;
|
|
8
10
|
/**
|
|
9
11
|
* Va de parent en parent en partant de node pour trouver un attribut
|
|
10
12
|
* @param attributeName nom de l'attribut
|
|
11
13
|
* @returns valeur de l'attribut ou null si l'attribut n'est pas trouvé
|
|
12
14
|
*/
|
|
13
15
|
static getAncestorAttributeValue(node: SearchableDomElement | null, attributeName: string): string | null;
|
|
16
|
+
/**
|
|
17
|
+
* Petite fonction utilitaire pour retourner la configuration a passer à l'utilitaire API
|
|
18
|
+
* Utilisée pour la configuration du wording / de la traduction ainsi que par le mixin fetcher par exemple
|
|
19
|
+
*/
|
|
20
|
+
static getApiConfiguration(node: SearchableDomElement): APIConfiguration;
|
|
21
|
+
/**
|
|
22
|
+
* Va de parent en parent en partant de node pour trouver un attribut
|
|
23
|
+
* @param attributeName nom de l'attribut
|
|
24
|
+
* @returns valeur de l'attribut ou null si l'attribut n'est pas trouvé
|
|
25
|
+
*/
|
|
26
|
+
static getClosestElement(node: SearchableDomElement, selector: string): SearchableDomElement | null;
|
|
14
27
|
/**
|
|
15
28
|
* Va de parent en parent en partant de node pour trouver un attribut
|
|
16
29
|
* @param attributeName nom de l'attribut
|
package/core/utils/HTML.js
CHANGED
|
@@ -3,7 +3,9 @@ class HTML {
|
|
|
3
3
|
* retourne la langue de la page courante telle que défini via l'attribut lang de la balise html
|
|
4
4
|
*/
|
|
5
5
|
static getLanguage() {
|
|
6
|
-
|
|
6
|
+
const documentLanguage = document.documentElement.lang;
|
|
7
|
+
const selectedLanguage = localStorage.getItem("SonicSelectedLanguage");
|
|
8
|
+
return selectedLanguage || documentLanguage;
|
|
7
9
|
}
|
|
8
10
|
static getCookies() {
|
|
9
11
|
return document.cookie.split(";").reduce((previous, current) => {
|
|
@@ -12,6 +14,14 @@ class HTML {
|
|
|
12
14
|
return previous;
|
|
13
15
|
}, {});
|
|
14
16
|
}
|
|
17
|
+
static everyAncestors(node, callback) {
|
|
18
|
+
while (node) {
|
|
19
|
+
const result = callback(node);
|
|
20
|
+
if (!result)
|
|
21
|
+
return;
|
|
22
|
+
node = (node.parentNode || node.host);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
15
25
|
/**
|
|
16
26
|
* Va de parent en parent en partant de node pour trouver un attribut
|
|
17
27
|
* @param attributeName nom de l'attribut
|
|
@@ -31,13 +41,34 @@ class HTML {
|
|
|
31
41
|
}
|
|
32
42
|
return node.getAttribute(attributeName);
|
|
33
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Petite fonction utilitaire pour retourner la configuration a passer à l'utilitaire API
|
|
46
|
+
* Utilisée pour la configuration du wording / de la traduction ainsi que par le mixin fetcher par exemple
|
|
47
|
+
*/
|
|
48
|
+
static getApiConfiguration(node) {
|
|
49
|
+
const token = HTML.getAncestorAttributeValue(node, "token");
|
|
50
|
+
const addHTTPResponse = HTML.getAncestorAttributeValue(node, "addHTTPResponse") != null;
|
|
51
|
+
const serviceURL = HTML.getAncestorAttributeValue(node, "serviceURL");
|
|
52
|
+
let userName = null;
|
|
53
|
+
let password = null;
|
|
54
|
+
const tokenProvider = HTML.getAncestorAttributeValue(node, "tokenProvider");
|
|
55
|
+
const authToken = HTML.getAncestorAttributeValue(node, "eventsApiToken");
|
|
56
|
+
if (!token) {
|
|
57
|
+
userName = HTML.getAncestorAttributeValue(node, "userName");
|
|
58
|
+
password = HTML.getAncestorAttributeValue(node, "password");
|
|
59
|
+
}
|
|
60
|
+
const credentials = HTML.getAncestorAttributeValue(node, "credentials") || undefined;
|
|
61
|
+
const cache = node.getAttribute("cache");
|
|
62
|
+
const blockUntilDone = node.hasAttribute("blockUntilDone");
|
|
63
|
+
return { serviceURL, token, userName, password, authToken, tokenProvider, addHTTPResponse, credentials, cache, blockUntilDone };
|
|
64
|
+
}
|
|
34
65
|
/**
|
|
35
66
|
* Va de parent en parent en partant de node pour trouver un attribut
|
|
36
67
|
* @param attributeName nom de l'attribut
|
|
37
68
|
* @returns valeur de l'attribut ou null si l'attribut n'est pas trouvé
|
|
38
69
|
*/
|
|
39
|
-
static
|
|
40
|
-
while (!(node.nodeName && node.nodeName.toLowerCase() ===
|
|
70
|
+
static getClosestElement(node, selector) {
|
|
71
|
+
while (!(node.nodeName && node.nodeName.toLowerCase() === selector)) {
|
|
41
72
|
const newNode = node.parentNode || node.host;
|
|
42
73
|
if (!newNode)
|
|
43
74
|
break;
|
|
@@ -48,6 +79,14 @@ class HTML {
|
|
|
48
79
|
}
|
|
49
80
|
return node;
|
|
50
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Va de parent en parent en partant de node pour trouver un attribut
|
|
84
|
+
* @param attributeName nom de l'attribut
|
|
85
|
+
* @returns valeur de l'attribut ou null si l'attribut n'est pas trouvé
|
|
86
|
+
*/
|
|
87
|
+
static getClosestForm(node) {
|
|
88
|
+
return HTML.getClosestElement(node, "form");
|
|
89
|
+
}
|
|
51
90
|
/**
|
|
52
91
|
* Lance le chargement d'un js et retourne une promise qui resoud à true lorsque le chargement à réussi et à false, sinon.
|
|
53
92
|
* */
|
package/core/utils/Objects.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ declare class Objects {
|
|
|
16
16
|
* @returns true si l'argument est null ou undefined
|
|
17
17
|
*/
|
|
18
18
|
static isUndefindOrNull<T>(object: T): boolean;
|
|
19
|
+
static isEmpty(object: Record<string, unknown>): boolean;
|
|
19
20
|
/**
|
|
20
21
|
* traverse l'objet pour obtenir la valeur a l'adresse donnée via le tableau de clés pathArray.
|
|
21
22
|
* Si extendValues = true, les propriétés des objets parents sont copiées au fur et a mesure de la descente dans la hierarchie, avant l'assignation des propriétés de l'objet lui même.
|
package/core/utils/Objects.js
CHANGED
|
@@ -54,6 +54,11 @@ class Objects {
|
|
|
54
54
|
static isUndefindOrNull(object) {
|
|
55
55
|
return object === null || object === undefined;
|
|
56
56
|
}
|
|
57
|
+
static isEmpty(object) {
|
|
58
|
+
if (Objects.isUndefindOrNull(object))
|
|
59
|
+
return true;
|
|
60
|
+
return Object.keys(object).length === 0;
|
|
61
|
+
}
|
|
57
62
|
/**
|
|
58
63
|
* traverse l'objet pour obtenir la valeur a l'adresse donnée via le tableau de clés pathArray.
|
|
59
64
|
* Si extendValues = true, les propriétés des objets parents sont copiées au fur et a mesure de la descente dans la hierarchie, avant l'assignation des propriétés de l'objet lui même.
|
|
@@ -36,8 +36,9 @@ export declare class PublisherProxy<T = any> {
|
|
|
36
36
|
* Utile pour savoir si quelque chose est en écoute d'une modification sur le proxy via une des methodes associées
|
|
37
37
|
*/
|
|
38
38
|
hasListener(): boolean;
|
|
39
|
+
_assignmentId_: number;
|
|
39
40
|
_publishInternalMutation_(lockInternalMutationsTransmission?: boolean): void;
|
|
40
|
-
_publishAssignement_(lockInternalMutationsTransmission?: boolean): void
|
|
41
|
+
_publishAssignement_(lockInternalMutationsTransmission?: boolean): Promise<void>;
|
|
41
42
|
_publishInvalidation_(): void;
|
|
42
43
|
_publishDynamicFilling_(key: string, value: CoreJSType): void;
|
|
43
44
|
_publishTemplateFilling_(key: string, value: CoreJSType): void;
|
|
@@ -89,28 +90,25 @@ export declare class PublisherProxy<T = any> {
|
|
|
89
90
|
/**
|
|
90
91
|
* Assigne une nouvelle valeur au proxy ce qui déclenche la transmission de la donnée en fonction des "écouteurs" associés
|
|
91
92
|
*/
|
|
92
|
-
set(newValue: T, lockInternalMutationsTransmission?: boolean): boolean
|
|
93
|
+
set(newValue: T, lockInternalMutationsTransmission?: boolean): Promise<boolean>;
|
|
93
94
|
/**
|
|
94
95
|
* Extraire la valeur actuelle du proxy
|
|
95
96
|
*/
|
|
97
|
+
_cachedGet_?: T;
|
|
96
98
|
get(): T;
|
|
97
99
|
/**
|
|
98
100
|
* retourner le webcomponent auquel le proxy est associé
|
|
99
101
|
*/
|
|
100
102
|
get $tag(): string;
|
|
101
103
|
}
|
|
102
|
-
/**
|
|
103
|
-
* Utilitaires de gestion des Publisher
|
|
104
|
-
* Obtenir, replacer ou supprimer un Publisher
|
|
105
|
-
*
|
|
106
|
-
*/
|
|
107
104
|
export declare class PublisherManager {
|
|
105
|
+
static buildDate: string;
|
|
108
106
|
static changed: boolean;
|
|
109
107
|
static saving: boolean;
|
|
110
108
|
static saveId: number;
|
|
111
109
|
static instance: PublisherManager | null;
|
|
112
110
|
enabledLocaStorageProxies: string[];
|
|
113
|
-
publishers: Map<string, Publisher<
|
|
111
|
+
publishers: Map<string, Publisher<unknown>>;
|
|
114
112
|
localStorageData: Record<string, {
|
|
115
113
|
lastModifiationMS: number;
|
|
116
114
|
data: PublisherContentType;
|
|
@@ -135,7 +133,7 @@ export declare class PublisherManager {
|
|
|
135
133
|
/**
|
|
136
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
|
|
137
135
|
*/
|
|
138
|
-
static delete(id: string): boolean;
|
|
136
|
+
static delete(id: string | null): boolean;
|
|
139
137
|
/**
|
|
140
138
|
* Obtenir un publisher vias sont id/adresse
|
|
141
139
|
* Si le publisher n'existe pas, il est créé.
|
|
@@ -151,7 +149,15 @@ export declare class PublisherManager {
|
|
|
151
149
|
*/
|
|
152
150
|
set(id: string, publisher: Publisher): void;
|
|
153
151
|
/**
|
|
154
|
-
*
|
|
152
|
+
* @warning
|
|
153
|
+
* !!!!! ATTENTION !!!!!
|
|
154
|
+
* Il est fort à aprier que vous ne voulez pas utiliser cette methode
|
|
155
|
+
* Il s'agit d'une supression complete
|
|
156
|
+
* * du publisher de la liste
|
|
157
|
+
* * des bindings
|
|
158
|
+
* * de même que ses sous publishers
|
|
159
|
+
*
|
|
160
|
+
* UTILISEZ PLUTÔT la méthode publisher.set({}) pour réinitialiser un publisher sans perdre les ecouteurs
|
|
155
161
|
*/
|
|
156
162
|
delete(id: string): boolean;
|
|
157
163
|
saveToLocalStorage(saveId?: number): Promise<void>;
|