@supersoniks/concorde 3.1.16 → 3.1.19
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/build-infos.json +1 -1
- package/concorde-core.bundle.js +3725 -0
- package/concorde-core.es.js +11916 -0
- package/dist/concorde-core.bundle.js +3725 -0
- package/dist/concorde-core.es.js +11916 -0
- package/dist/css/docs.css +0 -0
- package/dist/fonts/ClashGrotesk-Bold.eot +0 -0
- package/dist/fonts/ClashGrotesk-Bold.ttf +0 -0
- package/dist/fonts/ClashGrotesk-Bold.woff +0 -0
- package/dist/fonts/ClashGrotesk-Bold.woff2 +0 -0
- package/dist/fonts/ClashGrotesk-Extralight.eot +0 -0
- package/dist/fonts/ClashGrotesk-Extralight.ttf +0 -0
- package/dist/fonts/ClashGrotesk-Extralight.woff +0 -0
- package/dist/fonts/ClashGrotesk-Extralight.woff2 +0 -0
- package/dist/fonts/ClashGrotesk-Light.eot +0 -0
- package/dist/fonts/ClashGrotesk-Light.ttf +0 -0
- package/dist/fonts/ClashGrotesk-Light.woff +0 -0
- package/dist/fonts/ClashGrotesk-Light.woff2 +0 -0
- package/dist/fonts/ClashGrotesk-Medium.eot +0 -0
- package/dist/fonts/ClashGrotesk-Medium.ttf +0 -0
- package/dist/fonts/ClashGrotesk-Medium.woff +0 -0
- package/dist/fonts/ClashGrotesk-Medium.woff2 +0 -0
- package/dist/fonts/ClashGrotesk-Regular.eot +0 -0
- package/dist/fonts/ClashGrotesk-Regular.ttf +0 -0
- package/dist/fonts/ClashGrotesk-Regular.woff +0 -0
- package/dist/fonts/ClashGrotesk-Regular.woff2 +0 -0
- package/dist/fonts/ClashGrotesk-Semibold.eot +0 -0
- package/dist/fonts/ClashGrotesk-Semibold.ttf +0 -0
- package/dist/fonts/ClashGrotesk-Semibold.woff +0 -0
- package/dist/fonts/ClashGrotesk-Semibold.woff2 +0 -0
- package/dist/fonts/ClashGrotesk-Variable.eot +0 -0
- package/dist/fonts/ClashGrotesk-Variable.ttf +0 -0
- package/dist/fonts/ClashGrotesk-Variable.woff +0 -0
- package/dist/fonts/ClashGrotesk-Variable.woff2 +0 -0
- package/dist/img/concorde-icon.svg +5 -0
- package/dist/img/concorde-logo.svg +1 -0
- package/dist/img/concorde.png +0 -0
- package/dist/img/concorde_def.png +0 -0
- package/dist/img/concorde_seuil.png.webp +0 -0
- package/dist/img/concorde_seuil_invert.png +0 -0
- package/dist/img/paul_metrand.jpg +0 -0
- package/dist/img/paul_metrand_xs.jpg +0 -0
- package/dist/svg/regular/plane.svg +1 -0
- package/dist/svg/solid/plane.svg +1 -0
- package/package.json +3 -2
- package/scripts/pre-publish.mjs +24 -0
- package/src/core/components/functional/submit/submit.md +35 -0
- package/src/core/components/functional/submit/submit.ts +12 -1
- package/src/core/components/ui/button/button.ts +94 -43
- package/src/core/components/ui/form/fieldset/fieldset.ts +0 -0
- package/src/core/components/ui/form/input/password-helper.ts +32 -12
- package/src/core/components/ui/form/input/same-value-helper.ts +32 -13
- package/src/core/components/ui/form/input-autocomplete/input-autocomplete.ts +5 -1
- package/src/core/components/ui/form/select/select.ts +1 -4
- package/src/core/components/ui/modal/modal.ts +0 -0
- package/src/core/mixins/FormCheckable.ts +57 -33
- package/src/core/mixins/FormElement.ts +44 -12
- package/src/core/utils/LocationHandler.ts +28 -12
- package/src/core/utils/Objects.ts +10 -0
- package/src/core/utils/PublisherProxy.ts +111 -21
- package/src/docs/search/docs-search.json +30 -0
|
@@ -54,6 +54,7 @@ export class PublisherProxy<T = any> {
|
|
|
54
54
|
_value_: T;
|
|
55
55
|
_is_savable_ = false;
|
|
56
56
|
_invalidateListeners_ = new Set<VoidFunction>();
|
|
57
|
+
_formInvalidateListeners_ = new Set<VoidFunction>();
|
|
57
58
|
_assignListeners_ = new Set<(value: T) => void>();
|
|
58
59
|
_mutationListeners_ = new Set<VoidFunction>();
|
|
59
60
|
_fillListeners_ = new Set<Record<string, CoreJSType>>();
|
|
@@ -61,11 +62,17 @@ export class PublisherProxy<T = any> {
|
|
|
61
62
|
_lockInternalMutationPublishing_ = false;
|
|
62
63
|
_instanceCounter_ = 0;
|
|
63
64
|
parent: PublisherProxy | null;
|
|
65
|
+
_parentKey_?: string;
|
|
64
66
|
root: PublisherProxy;
|
|
65
67
|
|
|
66
|
-
constructor(
|
|
68
|
+
constructor(
|
|
69
|
+
target: T,
|
|
70
|
+
parentProxPub: PublisherProxy | null,
|
|
71
|
+
parentKey?: string
|
|
72
|
+
) {
|
|
67
73
|
this._value_ = target;
|
|
68
74
|
this.parent = parentProxPub || null;
|
|
75
|
+
this._parentKey_ = parentKey;
|
|
69
76
|
this.root = this;
|
|
70
77
|
this._instanceCounter_ = 0;
|
|
71
78
|
while (this.root.parent) {
|
|
@@ -82,6 +89,7 @@ export class PublisherProxy<T = any> {
|
|
|
82
89
|
this._proxies_.get(key)?.delete();
|
|
83
90
|
}
|
|
84
91
|
this._invalidateListeners_.clear();
|
|
92
|
+
this._formInvalidateListeners_.clear();
|
|
85
93
|
this._assignListeners_.clear();
|
|
86
94
|
this._mutationListeners_.clear();
|
|
87
95
|
this._fillListeners_.clear();
|
|
@@ -97,6 +105,7 @@ export class PublisherProxy<T = any> {
|
|
|
97
105
|
this._templateFillListeners_.size > 0 ||
|
|
98
106
|
this._assignListeners_.size > 0 ||
|
|
99
107
|
this._invalidateListeners_.size > 0 ||
|
|
108
|
+
this._formInvalidateListeners_.size > 0 ||
|
|
100
109
|
this._mutationListeners_.size > 0 ||
|
|
101
110
|
this._fillListeners_.size > 0
|
|
102
111
|
);
|
|
@@ -126,15 +135,22 @@ export class PublisherProxy<T = any> {
|
|
|
126
135
|
await queueTaskPromise();
|
|
127
136
|
if (currentId !== this._assignmentId_) return;
|
|
128
137
|
const newValue = this.get();
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
138
|
+
|
|
139
|
+
this._assignListeners_.forEach((handler: (value: T) => void) => {
|
|
140
|
+
handler(newValue);
|
|
141
|
+
});
|
|
132
142
|
this._publishInternalMutation_(lockInternalMutationsTransmission);
|
|
133
143
|
}
|
|
134
144
|
|
|
135
145
|
_publishInvalidation_() {
|
|
136
146
|
this._invalidateListeners_.forEach((handler: VoidFunction) => handler());
|
|
137
147
|
}
|
|
148
|
+
|
|
149
|
+
_publishFormInvalidation_() {
|
|
150
|
+
this._formInvalidateListeners_.forEach((handler: VoidFunction) =>
|
|
151
|
+
handler()
|
|
152
|
+
);
|
|
153
|
+
}
|
|
138
154
|
_publishDynamicFilling_(key: string, value: CoreJSType) {
|
|
139
155
|
this._fillListeners_.forEach((handler) => {
|
|
140
156
|
if (handler[key] !== value) handler[key] = value;
|
|
@@ -187,6 +203,7 @@ export class PublisherProxy<T = any> {
|
|
|
187
203
|
if (typeof handler != "function") return;
|
|
188
204
|
this._invalidateListeners_.delete(handler);
|
|
189
205
|
}
|
|
206
|
+
|
|
190
207
|
/**
|
|
191
208
|
* Flag les données comme étant invalides
|
|
192
209
|
*/
|
|
@@ -194,6 +211,25 @@ export class PublisherProxy<T = any> {
|
|
|
194
211
|
this._publishInvalidation_();
|
|
195
212
|
}
|
|
196
213
|
|
|
214
|
+
/**
|
|
215
|
+
* Appel la fonction "handler" (passée en paramettre) lorsque la donnée est flaggée comme invalide
|
|
216
|
+
*/
|
|
217
|
+
onFormInvalidate(handler: VoidFunction | undefined) {
|
|
218
|
+
if (typeof handler != "function") return;
|
|
219
|
+
this._formInvalidateListeners_.add(handler);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Stop les appels de la fonction "handler" (passée en paramettre) lorsque la donnée est flaggée comme invalide
|
|
223
|
+
*/
|
|
224
|
+
offFormInvalidate(handler: VoidFunction | undefined) {
|
|
225
|
+
if (typeof handler != "function") return;
|
|
226
|
+
this._formInvalidateListeners_.delete(handler);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
invalidateForm() {
|
|
230
|
+
this._publishFormInvalidation_();
|
|
231
|
+
}
|
|
232
|
+
|
|
197
233
|
/**
|
|
198
234
|
* Appel la fonction "handler" (passée en paramettre) lorsque quelque chose change la valeur gérée par le proxy quelque soit la profondeur de la donnée
|
|
199
235
|
*
|
|
@@ -272,14 +308,17 @@ export class PublisherProxy<T = any> {
|
|
|
272
308
|
) {
|
|
273
309
|
return true;
|
|
274
310
|
}
|
|
311
|
+
|
|
275
312
|
/**
|
|
276
313
|
* On assigne la nouvelle valeur
|
|
277
314
|
*/
|
|
315
|
+
|
|
278
316
|
const prevValue = this._value_ as any;
|
|
279
317
|
this._value_ = isComplex(newValue)
|
|
280
318
|
? newValue
|
|
281
319
|
: ({ __value: newValue } as any);
|
|
282
320
|
this._cachedGet_ = undefined;
|
|
321
|
+
|
|
283
322
|
/**
|
|
284
323
|
* Si il s'agit d'une valeur primitive (un entier, une chaine ) la valeure en renseignée par un objet contenant la vaeur {__value}
|
|
285
324
|
* On publie juste et on sen va.
|
|
@@ -288,8 +327,36 @@ export class PublisherProxy<T = any> {
|
|
|
288
327
|
this._value_,
|
|
289
328
|
"__value"
|
|
290
329
|
);
|
|
330
|
+
|
|
331
|
+
if (this._parentKey_ && this.parent) {
|
|
332
|
+
//si le parent n'a pas de valeur, on la crée en renseignant this.value et on retourne.
|
|
333
|
+
const valueTosetInParent = isPrimitiveValue
|
|
334
|
+
? (this._value_ as any).__value
|
|
335
|
+
: this._value_;
|
|
336
|
+
if (this.parent?.get() == null && this.parent?.get() == undefined) {
|
|
337
|
+
//if _parentKey_ is a number, we assume it's an array
|
|
338
|
+
if (!isNaN(Number(this._parentKey_))) {
|
|
339
|
+
const parent = [];
|
|
340
|
+
parent[Number(this._parentKey_)] = valueTosetInParent;
|
|
341
|
+
this.parent.set(parent);
|
|
342
|
+
} else {
|
|
343
|
+
this.parent.set({ [this._parentKey_]: valueTosetInParent });
|
|
344
|
+
}
|
|
345
|
+
// return;
|
|
346
|
+
} else {
|
|
347
|
+
//on mets à jour la valeur de la clef dans l'objet parnet pour refléter le changement au ca sou elle n'existait pas
|
|
348
|
+
this.parent._value_[this._parentKey_] = valueTosetInParent;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
291
352
|
if (isPrimitiveValue) {
|
|
292
|
-
await
|
|
353
|
+
//await //await here gives better performance but can cause issues with some listeners
|
|
354
|
+
this._publishAssignement_(lockInternalMutationsTransmission);
|
|
355
|
+
if (this.parent && this._parentKey_)
|
|
356
|
+
this.parent._publishDynamicFilling_(
|
|
357
|
+
this._parentKey_,
|
|
358
|
+
(this._value_ as any).__value
|
|
359
|
+
);
|
|
293
360
|
return true;
|
|
294
361
|
}
|
|
295
362
|
/**
|
|
@@ -318,7 +385,8 @@ export class PublisherProxy<T = any> {
|
|
|
318
385
|
/**
|
|
319
386
|
* On prévient les écouteurs que la valeur a changé
|
|
320
387
|
*/
|
|
321
|
-
await
|
|
388
|
+
//await //await here gives better performance but can cause issues with some listeners
|
|
389
|
+
this._publishAssignement_();
|
|
322
390
|
/**
|
|
323
391
|
* Si la donnée est complexe (objet, tableau)
|
|
324
392
|
* on crée les proxys pour les sous-éléments qui n'en on pas
|
|
@@ -339,7 +407,8 @@ export class PublisherProxy<T = any> {
|
|
|
339
407
|
this._publishDynamicFilling_(key, v);
|
|
340
408
|
continue;
|
|
341
409
|
}
|
|
342
|
-
await
|
|
410
|
+
//await //await here gives better performance but can cause issues with some listeners
|
|
411
|
+
this._proxies_.get(key)?.set(valueV, true);
|
|
343
412
|
this._publishDynamicFilling_(key, v);
|
|
344
413
|
}
|
|
345
414
|
}
|
|
@@ -640,6 +709,9 @@ const internalProps: Set<string> = new Set([
|
|
|
640
709
|
"invalidate",
|
|
641
710
|
"onInvalidate",
|
|
642
711
|
"offInvalidate",
|
|
712
|
+
"invalidateForm",
|
|
713
|
+
"onFormInvalidate",
|
|
714
|
+
"offFormInvalidate",
|
|
643
715
|
"onAssign",
|
|
644
716
|
"offAssign",
|
|
645
717
|
"startDynamicFilling",
|
|
@@ -656,16 +728,19 @@ const internalProps: Set<string> = new Set([
|
|
|
656
728
|
"_fillListeners_",
|
|
657
729
|
"_assignListeners_",
|
|
658
730
|
"_invalidateListeners_",
|
|
731
|
+
"_formInvalidateListeners_",
|
|
659
732
|
"_publishInternalMutation_",
|
|
660
733
|
"hasListener",
|
|
661
734
|
"delete",
|
|
662
735
|
"_mutationListeners_",
|
|
663
736
|
"_publishDynamicFilling_",
|
|
664
737
|
"_publishInvalidation_",
|
|
738
|
+
"_publishFormInvalidation_",
|
|
665
739
|
"_publishTemplateFilling_",
|
|
666
740
|
"_publishAssignement_",
|
|
667
741
|
"_proxies_",
|
|
668
742
|
"parent",
|
|
743
|
+
"_parentKey_",
|
|
669
744
|
"_value_",
|
|
670
745
|
"_is_savable_",
|
|
671
746
|
"_lockInternalMutationPublishing_",
|
|
@@ -679,24 +754,38 @@ const internalProps: Set<string> = new Set([
|
|
|
679
754
|
export default class Publisher<
|
|
680
755
|
T = PublisherContentType
|
|
681
756
|
> extends PublisherProxy<T> {
|
|
682
|
-
constructor(
|
|
683
|
-
|
|
684
|
-
|
|
757
|
+
constructor(
|
|
758
|
+
target: T,
|
|
759
|
+
parentProxPub: PublisherProxy | null = null,
|
|
760
|
+
parentKey?: string
|
|
761
|
+
) {
|
|
762
|
+
super(target, parentProxPub, parentKey);
|
|
763
|
+
|
|
764
|
+
const thisProxy: any = new Proxy(this, {
|
|
685
765
|
/**
|
|
686
766
|
* Lorsque l'on écrit monConteneur = publisher.maClef ou monConteneur = publisher["maClef"] monConteneur contient :
|
|
687
767
|
* Les methodes de PublisherProxy (onAssign... : voir liste dans kle tableaus si dessous), si la clef est une méthode de PublisherProxy,,
|
|
688
768
|
* Sinon un autre proxy qui a comme valeur interne la valeur corespondante à la clef dans l'objet.
|
|
689
769
|
*/
|
|
690
770
|
get: function (publisherInstance: PublisherProxy<T>, sKey: any) {
|
|
771
|
+
if (internalProps.has(sKey)) return (publisherInstance as any)[sKey];
|
|
691
772
|
if (sKey == Symbol.toPrimitive) {
|
|
692
773
|
return () => thisProxy.get();
|
|
693
774
|
}
|
|
694
|
-
|
|
775
|
+
|
|
776
|
+
// Support de la notation à points (rigolo mais pas intuitif)
|
|
777
|
+
// if (sKey.includes(".")) {
|
|
778
|
+
// const keys = sKey.split(".");
|
|
779
|
+
// return thisProxy[keys.shift()][keys.join(".")];
|
|
780
|
+
// }
|
|
781
|
+
|
|
695
782
|
if (!publisherInstance._proxies_.has(sKey)) {
|
|
696
783
|
const vValue = (publisherInstance._value_ as any)[sKey];
|
|
784
|
+
|
|
697
785
|
const newPublisher = new Publisher(
|
|
698
786
|
isComplex(vValue) ? vValue : { __value: vValue },
|
|
699
|
-
publisherInstance
|
|
787
|
+
publisherInstance,
|
|
788
|
+
sKey
|
|
700
789
|
);
|
|
701
790
|
newPublisher._proxies_.set("_parent_", thisProxy);
|
|
702
791
|
publisherInstance._proxies_.set(sKey, newPublisher);
|
|
@@ -731,14 +820,23 @@ export default class Publisher<
|
|
|
731
820
|
return true;
|
|
732
821
|
}
|
|
733
822
|
|
|
823
|
+
// Support de la notation à points (rigolo mais pas intuitif)
|
|
824
|
+
// if (sKey.includes(".")) {
|
|
825
|
+
// const keys = sKey.split(".");
|
|
826
|
+
// thisProxy[keys.shift() || ""][keys.join(".")].set(vValue);
|
|
827
|
+
// return true;
|
|
828
|
+
// }
|
|
829
|
+
|
|
734
830
|
//Création du publisher si il n'existe pas
|
|
735
831
|
if (!publisherInstance._proxies_.has(sKey)) {
|
|
736
|
-
const newPublisher = new Publisher({}, publisherInstance);
|
|
832
|
+
const newPublisher = new Publisher({}, publisherInstance, sKey);
|
|
737
833
|
newPublisher._proxies_.set("_parent_", thisProxy);
|
|
738
834
|
publisherInstance._proxies_.set(sKey, newPublisher);
|
|
739
835
|
}
|
|
740
836
|
//mis à jour et publication de la donnée si elle a changé
|
|
837
|
+
|
|
741
838
|
const prevValue = (publisherInstance._value_ as any)[sKey];
|
|
839
|
+
|
|
742
840
|
if (prevValue !== vValue) {
|
|
743
841
|
(publisherInstance._value_ as any)[sKey] = vValue;
|
|
744
842
|
publisherInstance._publishDynamicFilling_(sKey, vValue);
|
|
@@ -798,14 +896,6 @@ export default class Publisher<
|
|
|
798
896
|
return thisProxy as any;
|
|
799
897
|
}
|
|
800
898
|
|
|
801
|
-
toString() {
|
|
802
|
-
return "hey";
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
valueOf() {
|
|
806
|
-
return 2;
|
|
807
|
-
}
|
|
808
|
-
|
|
809
899
|
getProperty<U, K extends keyof U>(o: U, propertyName: K): U[K] {
|
|
810
900
|
return o[propertyName]; // o[propertyName] is of type T[K]
|
|
811
901
|
}
|
|
@@ -1269,6 +1269,36 @@
|
|
|
1269
1269
|
}
|
|
1270
1270
|
}
|
|
1271
1271
|
},
|
|
1272
|
+
{
|
|
1273
|
+
"search": "You can write the folowing code where the name attribute is written in dot notation.\n",
|
|
1274
|
+
"files": {
|
|
1275
|
+
"core/components/functional/submit/submit.md": {
|
|
1276
|
+
"title": "Submit",
|
|
1277
|
+
"hashes": {
|
|
1278
|
+
"dot-notation": {
|
|
1279
|
+
"count": 1,
|
|
1280
|
+
"title": "dot notation",
|
|
1281
|
+
"type": "paragraph"
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
},
|
|
1287
|
+
{
|
|
1288
|
+
"search": "The data will be stored in the following format:\n",
|
|
1289
|
+
"files": {
|
|
1290
|
+
"core/components/functional/submit/submit.md": {
|
|
1291
|
+
"title": "Submit",
|
|
1292
|
+
"hashes": {
|
|
1293
|
+
"dot-notation": {
|
|
1294
|
+
"count": 1,
|
|
1295
|
+
"title": "dot notation",
|
|
1296
|
+
"type": "paragraph"
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
}
|
|
1301
|
+
},
|
|
1272
1302
|
{
|
|
1273
1303
|
"search": "Subscriber",
|
|
1274
1304
|
"files": {
|