@supersoniks/concorde 1.1.43 → 1.1.45
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 +9 -7
- package/concorde-core.bundle.js +20 -20
- package/concorde-core.es.js +987 -804
- package/core/_types/types.d.ts +13 -8
- package/core/_types/types.js +1 -0
- package/core/components/functional/date/date.d.ts +2 -2
- package/core/components/functional/date/date.js +10 -10
- package/core/components/functional/example/example.d.ts +1 -1
- package/core/components/functional/fetch/fetch.d.ts +8 -6
- package/core/components/functional/list/list.d.ts +16 -8
- package/core/components/functional/list/list.js +29 -14
- package/core/components/functional/mix/mix.d.ts +5 -5
- package/core/components/functional/mix/mix.js +11 -8
- package/core/components/functional/queue/queue.d.ts +13 -4
- package/core/components/functional/queue/queue.js +33 -27
- package/core/components/functional/router/redirect.d.ts +2 -2
- package/core/components/functional/router/redirect.js +2 -6
- package/core/components/functional/router/router.d.ts +1 -1
- package/core/components/functional/router/router.js +22 -13
- package/core/components/functional/sdui/SDUIDescriptorTransformer.d.ts +0 -1
- package/core/components/functional/sdui/SDUIDescriptorTransformer.js +35 -36
- package/core/components/functional/sdui/sdui-utils.js +11 -11
- package/core/components/functional/sdui/sdui.d.ts +11 -10
- package/core/components/functional/sdui/sdui.js +33 -34
- package/core/components/functional/sdui/types.d.ts +8 -8
- package/core/components/functional/states/states.d.ts +3 -3
- package/core/components/functional/states/states.js +9 -8
- package/core/components/functional/submit/submit.d.ts +1 -1
- package/core/components/functional/submit/submit.js +16 -16
- package/core/components/functional/subscriber/subscriber.d.ts +1 -1
- package/core/components/functional/value/value.d.ts +1 -1
- package/core/components/functional/value/value.js +3 -2
- package/core/components/ui/_css/size.d.ts +1 -1
- package/core/components/ui/button/button.d.ts +6 -4
- package/core/components/ui/button/button.js +34 -30
- package/core/components/ui/captcha/captcha.d.ts +2 -2
- package/core/components/ui/captcha/captcha.js +2 -2
- package/core/components/ui/card/card-header.js +5 -1
- package/core/components/ui/card/card.js +7 -5
- package/core/components/ui/form/checkbox/checkbox.d.ts +36 -12
- package/core/components/ui/form/fieldset/fieldset.d.ts +1 -1
- package/core/components/ui/form/form-layout/form-layout.d.ts +1 -1
- package/core/components/ui/form/input/input.d.ts +14 -9
- package/core/components/ui/form/input/input.js +2 -2
- package/core/components/ui/form/input/password-helper.d.ts +1 -1
- package/core/components/ui/form/input/password-helper.js +1 -1
- package/core/components/ui/form/input/same-value-helper.d.ts +1 -1
- package/core/components/ui/form/input/same-value-helper.js +2 -2
- package/core/components/ui/form/input-autocomplete/input-autocomplete.d.ts +1 -1
- package/core/components/ui/form/input-autocomplete/input-autocomplete.js +1 -1
- package/core/components/ui/form/select/select.d.ts +5 -4
- package/core/components/ui/form/select/select.js +24 -12
- package/core/components/ui/form/textarea/textarea.d.ts +11 -9
- package/core/components/ui/form/textarea/textarea.js +1 -1
- package/core/components/ui/group/group.js +8 -2
- package/core/components/ui/icon/icons.js +15 -13
- package/core/components/ui/loader/loader.d.ts +1 -1
- package/core/components/ui/loader/loader.js +1 -1
- package/core/components/ui/menu/menu.js +15 -16
- package/core/components/ui/modal/modal.d.ts +1 -1
- package/core/components/ui/modal/modal.js +1 -1
- package/core/components/ui/pop/pop.d.ts +6 -5
- package/core/components/ui/pop/pop.js +76 -46
- package/core/components/ui/table/table-tbody.js +1 -1
- package/core/components/ui/theme/theme.js +15 -13
- package/core/components/ui/toast/message-subscriber.d.ts +12 -9
- package/core/components/ui/toast/message-subscriber.js +10 -8
- package/core/components/ui/toast/toast.d.ts +1 -1
- package/core/components/ui/toast/toast.js +7 -8
- package/core/components/ui/toast/types.d.ts +3 -2
- package/core/components/ui/tooltip/tooltip.js +4 -4
- package/core/components/ui/ui.d.ts +1 -1
- package/core/components/ui/ui.js +1 -1
- package/core/mixins/Fetcher.d.ts +15 -17
- package/core/mixins/Fetcher.js +19 -10
- package/core/mixins/FormCheckable.d.ts +8 -5
- package/core/mixins/FormCheckable.js +21 -19
- package/core/mixins/FormElement.d.ts +10 -7
- package/core/mixins/FormElement.js +24 -23
- package/core/mixins/FormInput.d.ts +16 -10
- package/core/mixins/FormInput.js +1 -1
- package/core/mixins/Subscriber.d.ts +8 -6
- package/core/mixins/Subscriber.js +24 -23
- package/core/mixins/TemplatesContainer.d.ts +2 -1
- package/core/mixins/TemplatesContainer.js +2 -2
- package/core/utils/Arrays.js +12 -9
- package/core/utils/DataBindObserver.d.ts +4 -4
- package/core/utils/DataBindObserver.js +26 -28
- package/core/utils/HTML.d.ts +1 -1
- package/core/utils/HTML.js +2 -2
- package/core/utils/LocationHandler.js +10 -10
- package/core/utils/Objects.js +10 -4
- package/core/utils/PublisherProxy.d.ts +21 -15
- package/core/utils/PublisherProxy.js +67 -63
- package/core/utils/api.d.ts +40 -32
- package/core/utils/api.js +127 -32
- package/mixins.d.ts +25 -19
- package/package.json +11 -6
- package/core/components/ui/taxonomy/taxonomy.d.ts +0 -44
- package/core/components/ui/taxonomy/taxonomy.js +0 -115
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { PublisherInterface, PublisherContentType } from "@supersoniks/concorde/core/_types/types";
|
|
2
2
|
import { SearchableDomElement } from "@supersoniks/concorde/core/utils/HTML";
|
|
3
|
-
|
|
3
|
+
type BindedVariablesDescriptor = {
|
|
4
4
|
expression: string;
|
|
5
5
|
variables: Array<Array<string>>;
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
type DataBindItem = {
|
|
8
8
|
propertyToUpdate: string;
|
|
9
9
|
bindedVariablesDescriptor: BindedVariablesDescriptor;
|
|
10
10
|
};
|
|
11
|
-
|
|
11
|
+
type PublisherListenerConfig<ValueType extends PublisherContentType = PublisherContentType> = {
|
|
12
12
|
publisher: PublisherInterface<ValueType>;
|
|
13
13
|
onAssign: (value?: ValueType) => void;
|
|
14
14
|
};
|
|
@@ -73,7 +73,7 @@ export default class DataBindObserver {
|
|
|
73
73
|
* Ceci est un cas spécial, c'est pour ça qu'on utilisa pes Objects.traverse.
|
|
74
74
|
* Il y a toujours un publisher quelque soit l'adresse ce qui permet de cibler des valeurs qui n'existent pas encore
|
|
75
75
|
*/
|
|
76
|
-
static getSubPublisher<T extends PublisherContentType>(pub: PublisherInterface<T>, pathArray?: string[]):
|
|
76
|
+
static getSubPublisher<T extends PublisherContentType>(pub: PublisherInterface<T>, pathArray?: string[]): PublisherInterface;
|
|
77
77
|
/**
|
|
78
78
|
* La liaison avec le publisher est faite ici.
|
|
79
79
|
* TODO Sans doute factoriser
|
|
@@ -24,8 +24,8 @@ export default class DataBindObserver {
|
|
|
24
24
|
return;
|
|
25
25
|
if (DataBindObserver.observedElements.has(element))
|
|
26
26
|
return;
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
const obs = new MutationObserver(DataBindObserver.onMutation);
|
|
28
|
+
const opt = {};
|
|
29
29
|
opt.childList = true;
|
|
30
30
|
opt.subtree = true;
|
|
31
31
|
opt.attributes = true;
|
|
@@ -42,7 +42,7 @@ export default class DataBindObserver {
|
|
|
42
42
|
static unObserve(element) {
|
|
43
43
|
if (!element)
|
|
44
44
|
return;
|
|
45
|
-
|
|
45
|
+
const observer = this.observedElements.get(element);
|
|
46
46
|
if (!observer)
|
|
47
47
|
return;
|
|
48
48
|
observer.disconnect();
|
|
@@ -68,18 +68,16 @@ export default class DataBindObserver {
|
|
|
68
68
|
* Callback appelé par le MutationObserver
|
|
69
69
|
*/
|
|
70
70
|
static onMutation(list) {
|
|
71
|
-
for (
|
|
71
|
+
for (const l of list) {
|
|
72
72
|
switch (l.type) {
|
|
73
73
|
case "attributes":
|
|
74
74
|
DataBindObserver.addPublisherListeners(l.target);
|
|
75
75
|
break;
|
|
76
76
|
case "childList":
|
|
77
|
-
|
|
78
|
-
var removed = l.removedNodes;
|
|
79
|
-
added.forEach((elt) => {
|
|
77
|
+
l.addedNodes.forEach((elt) => {
|
|
80
78
|
DataBindObserver.onAdded(elt);
|
|
81
79
|
});
|
|
82
|
-
|
|
80
|
+
l.removedNodes.forEach((elt) => {
|
|
83
81
|
DataBindObserver.onRemoved(elt);
|
|
84
82
|
});
|
|
85
83
|
break;
|
|
@@ -90,7 +88,7 @@ export default class DataBindObserver {
|
|
|
90
88
|
* La liaison avec le publisher supprimée ici.
|
|
91
89
|
*/
|
|
92
90
|
static removePublisherListeners(target) {
|
|
93
|
-
|
|
91
|
+
const conf = DataBindObserver.publisherListeners.get(target);
|
|
94
92
|
if (!conf)
|
|
95
93
|
return;
|
|
96
94
|
DataBindObserver.publisherListeners.delete(target);
|
|
@@ -135,9 +133,9 @@ export default class DataBindObserver {
|
|
|
135
133
|
return Array.from(element.attributes)
|
|
136
134
|
.filter((attribute) => attribute.name.indexOf("::") == 0)
|
|
137
135
|
.map((e) => {
|
|
138
|
-
|
|
136
|
+
const name = e.name.substring(2);
|
|
139
137
|
return {
|
|
140
|
-
propertyToUpdate: name.replace(
|
|
138
|
+
propertyToUpdate: name.replace(/-((html)|\w)/g, (match) => match.substring(1).toUpperCase()),
|
|
141
139
|
bindedVariablesDescriptor: DataBindObserver.getVariablesDescriptor(e.value),
|
|
142
140
|
};
|
|
143
141
|
});
|
|
@@ -151,7 +149,7 @@ export default class DataBindObserver {
|
|
|
151
149
|
static getSubPublisher(pub, pathArray) {
|
|
152
150
|
if (!pathArray)
|
|
153
151
|
return pub;
|
|
154
|
-
for (
|
|
152
|
+
for (const key of pathArray) {
|
|
155
153
|
if (key == "_self_")
|
|
156
154
|
continue;
|
|
157
155
|
if (!pub)
|
|
@@ -169,12 +167,12 @@ export default class DataBindObserver {
|
|
|
169
167
|
/**
|
|
170
168
|
* On récupère le publisher viea le dataProvider d'un ancêtre de l'élément.
|
|
171
169
|
*/
|
|
172
|
-
|
|
170
|
+
const dataProviderId = HTML.getAncestorAttributeValue((target.parentNode || target.host || target), "dataProvider");
|
|
173
171
|
if (!dataProviderId)
|
|
174
172
|
return;
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
173
|
+
const publisher = PublisherManager.getInstance().get(dataProviderId);
|
|
174
|
+
const dataBindItems = DataBindObserver.getDataBindItems(target);
|
|
175
|
+
const conf = [];
|
|
178
176
|
/**
|
|
179
177
|
* Pour chaque attribut => dataBindItems on fait la liaison avec les (sous) publishers associés aux variables extraites
|
|
180
178
|
* Lorsqu'une assignation est faite sur un des publishers liés, on met à jour la propriété de target dont le nom est renseigne dans l'attribut "propertyToUpdate du databindItem".
|
|
@@ -183,17 +181,17 @@ export default class DataBindObserver {
|
|
|
183
181
|
* Attentions, les Objets/tableaus sont rendus en chaine avant l'interprétation dans ce cas.
|
|
184
182
|
*/
|
|
185
183
|
dataBindItems.forEach((dataBindItem) => {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
for (
|
|
189
|
-
|
|
184
|
+
const bindedVariablesDescriptor = dataBindItem.bindedVariablesDescriptor;
|
|
185
|
+
const propertyToUpdate = dataBindItem.propertyToUpdate;
|
|
186
|
+
for (const value of bindedVariablesDescriptor.variables) {
|
|
187
|
+
const publisherPathArray = value;
|
|
190
188
|
let pub = publisher;
|
|
191
189
|
pub = DataBindObserver.getSubPublisher(publisher, publisherPathArray);
|
|
192
|
-
|
|
193
|
-
|
|
190
|
+
const rec = target;
|
|
191
|
+
const currentConf = {
|
|
194
192
|
publisher: pub,
|
|
195
193
|
onAssign: () => {
|
|
196
|
-
|
|
194
|
+
const values = bindedVariablesDescriptor.variables.map((dataPath) => {
|
|
197
195
|
var _a;
|
|
198
196
|
return (_a = DataBindObserver.getSubPublisher(publisher, dataPath)) === null || _a === void 0 ? void 0 : _a.get();
|
|
199
197
|
});
|
|
@@ -221,7 +219,7 @@ export default class DataBindObserver {
|
|
|
221
219
|
*/
|
|
222
220
|
for (let i = 0; i < values.length; i++) {
|
|
223
221
|
let value = values[i];
|
|
224
|
-
|
|
222
|
+
const variable = bindedVariablesDescriptor.variables[i];
|
|
225
223
|
if (value === null) {
|
|
226
224
|
hasUndeterminatedValue = true;
|
|
227
225
|
value = undefined;
|
|
@@ -229,14 +227,14 @@ export default class DataBindObserver {
|
|
|
229
227
|
expression = expression.replace("$" + variable.join("."), value);
|
|
230
228
|
}
|
|
231
229
|
if (expression.indexOf("|") != -1) {
|
|
232
|
-
|
|
230
|
+
const funcDelimiterIdx = expression.indexOf("|");
|
|
233
231
|
if (funcDelimiterIdx == 0) {
|
|
234
232
|
expression = Format.js(expression.substring(1));
|
|
235
233
|
}
|
|
236
234
|
else {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
235
|
+
const funcName = expression.substring(0, funcDelimiterIdx);
|
|
236
|
+
const funcArgs = expression.substring(funcDelimiterIdx + 1);
|
|
237
|
+
const fmtFunc = Format[funcName];
|
|
240
238
|
expression = hasUndeterminatedValue ? "" : fmtFunc ? fmtFunc(funcArgs) : expression;
|
|
241
239
|
}
|
|
242
240
|
}
|
package/core/utils/HTML.d.ts
CHANGED
package/core/utils/HTML.js
CHANGED
|
@@ -63,7 +63,7 @@ class HTML {
|
|
|
63
63
|
static loadJS(src) {
|
|
64
64
|
return __awaiter(this, void 0, void 0, function* () {
|
|
65
65
|
const p = new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
|
|
66
|
-
|
|
66
|
+
const script = document.createElement("script");
|
|
67
67
|
script.src = src;
|
|
68
68
|
script.onload = () => resolve(true);
|
|
69
69
|
script.onerror = () => resolve(true);
|
|
@@ -78,7 +78,7 @@ class HTML {
|
|
|
78
78
|
static loadCSS(src) {
|
|
79
79
|
return __awaiter(this, void 0, void 0, function* () {
|
|
80
80
|
const p = new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
|
|
81
|
-
|
|
81
|
+
const cssnode = document.createElement("link");
|
|
82
82
|
cssnode.type = "text/css";
|
|
83
83
|
cssnode.rel = "stylesheet";
|
|
84
84
|
cssnode.href = src;
|
|
@@ -10,7 +10,7 @@ export default class LocationHandler {
|
|
|
10
10
|
if (!LocationHandler.listening) {
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
const newURL = (_a = document.location) === null || _a === void 0 ? void 0 : _a.href.replace(document.location.origin, "");
|
|
14
14
|
if (LocationHandler.prevURL && LocationHandler.prevURL != newURL) {
|
|
15
15
|
LocationHandler.prevURL = newURL;
|
|
16
16
|
LocationHandler.listeners.forEach((listener) => {
|
|
@@ -23,7 +23,7 @@ export default class LocationHandler {
|
|
|
23
23
|
* Arrête l'écoute des changements de location pour le listener fournit
|
|
24
24
|
*/
|
|
25
25
|
static offChange(listener) {
|
|
26
|
-
|
|
26
|
+
const idx = LocationHandler.listeners.indexOf(listener);
|
|
27
27
|
if (idx == -1)
|
|
28
28
|
return;
|
|
29
29
|
LocationHandler.listeners.splice(idx, 1);
|
|
@@ -54,7 +54,7 @@ export default class LocationHandler {
|
|
|
54
54
|
const referrer = document.referrer;
|
|
55
55
|
if (goBack !== null && goBack !== undefined) {
|
|
56
56
|
const origin = document.location.origin;
|
|
57
|
-
|
|
57
|
+
const urlDest = goBack || origin;
|
|
58
58
|
const isHTTP = referrer.indexOf("http") == 0;
|
|
59
59
|
const isNotSameOrigin = isHTTP ? new URL(referrer).origin != origin : false;
|
|
60
60
|
const isReferrerEmpty = referrer == "";
|
|
@@ -63,7 +63,7 @@ export default class LocationHandler {
|
|
|
63
63
|
const isNotSameURL = urlDest != document.location.href;
|
|
64
64
|
const goToURLDest = (isNotSameOrigin && isNotSameURL) || isFallbackNoReferer;
|
|
65
65
|
if (goToURLDest) {
|
|
66
|
-
|
|
66
|
+
const state = history.state || {};
|
|
67
67
|
state.concorde = state.concorde || {};
|
|
68
68
|
state.concorde.hasDoneHistoryBack = true;
|
|
69
69
|
history.pushState(state, document.title);
|
|
@@ -84,11 +84,11 @@ export default class LocationHandler {
|
|
|
84
84
|
document.location.hash = to.substring(1);
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
const url = new URL(to, document.location.href);
|
|
88
|
+
const split = url.pathname.split("/");
|
|
89
|
+
const newPathName = [];
|
|
90
90
|
let prevSp = "";
|
|
91
|
-
for (
|
|
91
|
+
for (const sp of split) {
|
|
92
92
|
if (sp != prevSp)
|
|
93
93
|
newPathName.push(sp);
|
|
94
94
|
prevSp = sp;
|
|
@@ -112,8 +112,8 @@ export default class LocationHandler {
|
|
|
112
112
|
if (component.autoActive == "disabled")
|
|
113
113
|
return;
|
|
114
114
|
if (component.href && component.href.indexOf("http") != 0) {
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
const url1 = new URL(component.href, document.location.href);
|
|
116
|
+
const url2 = new URL(component.location || "", document.location.origin);
|
|
117
117
|
let isActive = false;
|
|
118
118
|
if (component.autoActive == "strict") {
|
|
119
119
|
isActive = url1.pathname == url2.pathname && url1.hash == url2.hash && url1.search == url2.search;
|
package/core/utils/Objects.js
CHANGED
|
@@ -2,13 +2,14 @@ class Objects {
|
|
|
2
2
|
/**
|
|
3
3
|
* Effectue une comparaison d'égalité non profonde entre deux objets.
|
|
4
4
|
*/
|
|
5
|
+
/*eslint-disable @typescript-eslint/no-explicit-any*/
|
|
5
6
|
static shallowEqual(object1, object2, useStrictComparaison = true) {
|
|
6
7
|
const keys1 = Object.keys(object1);
|
|
7
8
|
const keys2 = Object.keys(object2);
|
|
8
9
|
if (keys1.length !== keys2.length && useStrictComparaison) {
|
|
9
10
|
return false;
|
|
10
11
|
}
|
|
11
|
-
for (
|
|
12
|
+
for (const key of keys1) {
|
|
12
13
|
const val1 = object1[key];
|
|
13
14
|
const val2 = object2[key];
|
|
14
15
|
const areEqual = useStrictComparaison ? val1 !== val2 : val1 != val2;
|
|
@@ -18,9 +19,11 @@ class Objects {
|
|
|
18
19
|
}
|
|
19
20
|
return true;
|
|
20
21
|
}
|
|
22
|
+
/*eslint-enable @typescript-eslint/no-explicit-any*/
|
|
21
23
|
/**
|
|
22
24
|
* Effectue une comparaison d'égalité profonde entre deux objets.
|
|
23
25
|
*/
|
|
26
|
+
/*eslint-disable @typescript-eslint/no-explicit-any*/
|
|
24
27
|
static deepEqual(object1, object2, useStrictComparaison = true) {
|
|
25
28
|
const keys1 = Object.keys(object1);
|
|
26
29
|
const keys2 = Object.keys(object2);
|
|
@@ -38,6 +41,7 @@ class Objects {
|
|
|
38
41
|
}
|
|
39
42
|
return true;
|
|
40
43
|
}
|
|
44
|
+
/*eslint-enable @typescript-eslint/no-explicit-any*/
|
|
41
45
|
/**
|
|
42
46
|
* @returns true si l'objet est un objet ou un tableau (qui est un objet). mais false si null (car sinon typeof null "object")
|
|
43
47
|
*/
|
|
@@ -54,9 +58,10 @@ class Objects {
|
|
|
54
58
|
* traverse l'objet pour obtenir la valeur a l'adresse donnée via le tableau de clés pathArray.
|
|
55
59
|
* 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.
|
|
56
60
|
*/
|
|
61
|
+
/*eslint-disable @typescript-eslint/no-explicit-any*/
|
|
57
62
|
static traverse(obj, pathArray, extendValues = false) {
|
|
58
|
-
for (
|
|
59
|
-
|
|
63
|
+
for (const key of pathArray) {
|
|
64
|
+
const newObj = obj[key];
|
|
60
65
|
if (newObj === undefined) {
|
|
61
66
|
return undefined;
|
|
62
67
|
}
|
|
@@ -69,10 +74,11 @@ class Objects {
|
|
|
69
74
|
}
|
|
70
75
|
return obj;
|
|
71
76
|
}
|
|
77
|
+
/*eslint-enable @typescript-eslint/no-explicit-any*/
|
|
72
78
|
static getURLSearchArray(sourceObject, prefix = "") {
|
|
73
79
|
let arr = [];
|
|
74
80
|
for (let key in sourceObject) {
|
|
75
|
-
|
|
81
|
+
const value = sourceObject[key];
|
|
76
82
|
if (prefix)
|
|
77
83
|
key = prefix + "[" + key + "]";
|
|
78
84
|
if (Objects.isObject(value)) {
|
|
@@ -1,19 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/**
|
|
2
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
3
|
+
* Merci de laisser ce fichier sans la moindre dépendance en dehors de types du ceur.
|
|
4
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
5
|
+
* **/
|
|
6
|
+
import { CoreJSType, PublisherContentType } from "../_types/types";
|
|
7
|
+
type DynamicFillingListener = any;
|
|
8
|
+
type TemplateFillingListener = {
|
|
9
|
+
propertyMap: Record<string, string>;
|
|
10
|
+
} & DynamicFillingListener;
|
|
5
11
|
/**
|
|
6
12
|
* Custom Proxy contient les méthodes des publishers retournés par PublisherManager.get(publisherId) qui seront utilisées couramment
|
|
7
13
|
*/
|
|
8
|
-
export declare class PublisherProxy<T
|
|
14
|
+
export declare class PublisherProxy<T = any> {
|
|
9
15
|
_proxies_: Map<string, PublisherProxy>;
|
|
10
16
|
_value_: T;
|
|
11
17
|
_key_: string;
|
|
12
18
|
_invalidateListeners_: Set<VoidFunction>;
|
|
13
19
|
_assignListeners_: Set<(value: T) => void>;
|
|
14
20
|
_mutationListeners_: Set<VoidFunction>;
|
|
15
|
-
_fillListeners_: Set<
|
|
16
|
-
_templateFillListeners_: Set<
|
|
21
|
+
_fillListeners_: Set<Record<string, CoreJSType>>;
|
|
22
|
+
_templateFillListeners_: Set<any>;
|
|
17
23
|
_lockInternalMutationPublishing_: boolean;
|
|
18
24
|
parent: PublisherProxy | null;
|
|
19
25
|
root: PublisherProxy;
|
|
@@ -30,8 +36,8 @@ export declare class PublisherProxy<T extends PublisherContentType = any> {
|
|
|
30
36
|
_publishInternalMutation_(lockInternalMutationsTransmission?: boolean): void;
|
|
31
37
|
_publishAssignement_(lockInternalMutationsTransmission?: boolean): void;
|
|
32
38
|
_publishInvalidation_(): void;
|
|
33
|
-
_publishDynamicFilling_(key: string, value:
|
|
34
|
-
_publishTemplateFilling_(key: string, value:
|
|
39
|
+
_publishDynamicFilling_(key: string, value: CoreJSType): void;
|
|
40
|
+
_publishTemplateFilling_(key: string, value: CoreJSType): void;
|
|
35
41
|
/**
|
|
36
42
|
* Appel la fonction "handler" (passée en paramettre) lorsque la valeur gérée par le proxy change par assignation
|
|
37
43
|
* hanlder reçois alors la nouvelle valeur interne du proxy en paramètre
|
|
@@ -66,17 +72,17 @@ export declare class PublisherProxy<T extends PublisherContentType = any> {
|
|
|
66
72
|
* Maintient le remplissage de l'objet / tableau "handler" passé en paramètre avec les valeurs du proxy
|
|
67
73
|
* Remplit uniquement les valeurs déjà présentes dans l'objet / tableau passé en paramètre
|
|
68
74
|
*/
|
|
69
|
-
startTemplateFilling(handler:
|
|
75
|
+
startTemplateFilling(handler: TemplateFillingListener): void;
|
|
70
76
|
/**
|
|
71
77
|
* Arrête de maintenir le remplissage de l'objet / tableau "handler" passé en paramètre avec les valeurs du proxy
|
|
72
78
|
*/
|
|
73
|
-
stopTemplateFilling(handler:
|
|
79
|
+
stopTemplateFilling(handler: TemplateFillingListener): void;
|
|
74
80
|
/**
|
|
75
81
|
* Maintient le remplissage de l'objet / tableau "handler" passé en paramètre avec les valeurs du proxy
|
|
76
82
|
* Remplit toute valeur qu'elle soit présente ou pas initialement dans l'objet
|
|
77
83
|
*/
|
|
78
|
-
startDynamicFilling(handler:
|
|
79
|
-
stopDynamicFilling(handler:
|
|
84
|
+
startDynamicFilling(handler: DynamicFillingListener): void;
|
|
85
|
+
stopDynamicFilling(handler: DynamicFillingListener): void;
|
|
80
86
|
/**
|
|
81
87
|
* Assigne une nouvelle valeur au proxy ce qui déclenche la transmission de la donnée en fonction des "écouteurs" associés
|
|
82
88
|
*/
|
|
@@ -93,7 +99,7 @@ export declare class PublisherProxy<T extends PublisherContentType = any> {
|
|
|
93
99
|
*/
|
|
94
100
|
export declare class PublisherManager {
|
|
95
101
|
static instance: PublisherManager | null;
|
|
96
|
-
publishers: Map<string, Publisher<
|
|
102
|
+
publishers: Map<string, Publisher<PublisherContentType>>;
|
|
97
103
|
constructor();
|
|
98
104
|
/**
|
|
99
105
|
* PublisherManager est un singleton
|
|
@@ -126,7 +132,7 @@ export declare class PublisherManager {
|
|
|
126
132
|
/**
|
|
127
133
|
* Le Proxy Javascript
|
|
128
134
|
*/
|
|
129
|
-
export default class Publisher<T
|
|
135
|
+
export default class Publisher<T = PublisherContentType> extends PublisherProxy<T> {
|
|
130
136
|
constructor(target: T, parentProxPub?: PublisherProxy | null);
|
|
131
137
|
getProperty<U, K extends keyof U>(o: U, propertyName: K): U[K];
|
|
132
138
|
}
|