@supersoniks/concorde 1.1.43 → 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/concorde-core.bundle.js +18 -18
- package/concorde-core.es.js +805 -739
- 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 +25 -13
- 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 +12 -3
- package/core/components/functional/queue/queue.js +28 -22
- 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 +10 -10
- 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 +10 -9
- package/core/components/functional/sdui/sdui.js +32 -33
- 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 +8 -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/ui/_css/size.d.ts +1 -1
- package/core/components/ui/button/button.d.ts +6 -4
- package/core/components/ui/button/button.js +2 -2
- 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/select/select.d.ts +5 -4
- package/core/components/ui/form/select/select.js +8 -8
- 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 +1 -1
- 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 +1 -1
- package/core/components/ui/pop/pop.js +13 -13
- 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 +1 -1
- 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 +19 -18
- 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 +16 -31
- package/core/utils/api.js +26 -22
- package/mixins.d.ts +25 -19
- package/package.json +9 -5
- package/core/components/ui/taxonomy/taxonomy.d.ts +0 -44
- package/core/components/ui/taxonomy/taxonomy.js +0 -115
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any*/
|
|
1
2
|
function isComplex(value) {
|
|
2
3
|
return typeof value === "object" && value != null;
|
|
3
4
|
}
|
|
@@ -14,9 +15,9 @@ export class PublisherProxy {
|
|
|
14
15
|
this._fillListeners_ = new Set();
|
|
15
16
|
this._templateFillListeners_ = new Set();
|
|
16
17
|
this._lockInternalMutationPublishing_ = false;
|
|
17
|
-
this.root = this;
|
|
18
18
|
this._value_ = target;
|
|
19
19
|
this.parent = parentProxPub || null;
|
|
20
|
+
this.root = this;
|
|
20
21
|
while (this.root.parent) {
|
|
21
22
|
this.root = this.root.parent;
|
|
22
23
|
}
|
|
@@ -26,7 +27,7 @@ export class PublisherProxy {
|
|
|
26
27
|
* Supprime les écouteurs associés
|
|
27
28
|
*/
|
|
28
29
|
delete() {
|
|
29
|
-
for (
|
|
30
|
+
for (const proxy of this._proxies_.values()) {
|
|
30
31
|
proxy.delete();
|
|
31
32
|
}
|
|
32
33
|
this._invalidateListeners_.clear();
|
|
@@ -70,7 +71,7 @@ export class PublisherProxy {
|
|
|
70
71
|
}
|
|
71
72
|
_publishTemplateFilling_(key, value) {
|
|
72
73
|
this._templateFillListeners_.forEach((handler) => {
|
|
73
|
-
|
|
74
|
+
const desc = Object.getOwnPropertyDescriptor(handler, key);
|
|
74
75
|
if (desc && !desc.set && !desc.writable)
|
|
75
76
|
return;
|
|
76
77
|
if (handler.propertyMap && handler.propertyMap[key]) {
|
|
@@ -143,13 +144,16 @@ export class PublisherProxy {
|
|
|
143
144
|
*/
|
|
144
145
|
startTemplateFilling(handler) {
|
|
145
146
|
this._templateFillListeners_.add(handler);
|
|
146
|
-
|
|
147
|
+
if (typeof this._value_ != "object")
|
|
148
|
+
return;
|
|
149
|
+
for (const z in this._value_) {
|
|
150
|
+
let valueKey = z;
|
|
147
151
|
const value = this._value_[z];
|
|
148
152
|
if (handler.propertyMap && handler.propertyMap[z]) {
|
|
149
|
-
|
|
153
|
+
valueKey = handler.propertyMap[z];
|
|
150
154
|
}
|
|
151
155
|
if (typeof handler[z] != "undefined" && handler[z] !== value) {
|
|
152
|
-
handler[
|
|
156
|
+
handler[valueKey] = value;
|
|
153
157
|
}
|
|
154
158
|
}
|
|
155
159
|
}
|
|
@@ -165,7 +169,7 @@ export class PublisherProxy {
|
|
|
165
169
|
*/
|
|
166
170
|
startDynamicFilling(handler) {
|
|
167
171
|
this._fillListeners_.add(handler);
|
|
168
|
-
for (
|
|
172
|
+
for (const z in this._value_) {
|
|
169
173
|
const value = this._value_[z];
|
|
170
174
|
if (handler[z] !== value)
|
|
171
175
|
handler[z] = value;
|
|
@@ -187,9 +191,9 @@ export class PublisherProxy {
|
|
|
187
191
|
*/
|
|
188
192
|
if (this._value_ === newValue)
|
|
189
193
|
return true;
|
|
190
|
-
if (
|
|
191
|
-
|
|
192
|
-
|
|
194
|
+
if (this._value_ &&
|
|
195
|
+
Object.prototype.hasOwnProperty.call(this._value_, "__value") &&
|
|
196
|
+
Object.prototype.hasOwnProperty.call(newValue, "__value") &&
|
|
193
197
|
this._value_.__value === newValue.__value) {
|
|
194
198
|
return true;
|
|
195
199
|
}
|
|
@@ -202,7 +206,7 @@ export class PublisherProxy {
|
|
|
202
206
|
* Si il s'agit d'une valeur primitive (un entier, une chaine ) la valeure en renseignée par un objet contenant la vaeur {__value}
|
|
203
207
|
* On publie juste et on sen va.
|
|
204
208
|
*/
|
|
205
|
-
const isPrimitiveValue =
|
|
209
|
+
const isPrimitiveValue = Object.prototype.hasOwnProperty.call(this._value_, "__value");
|
|
206
210
|
if (isPrimitiveValue) {
|
|
207
211
|
this._publishAssignement_(lockInternalMutationsTransmission);
|
|
208
212
|
return true;
|
|
@@ -213,7 +217,7 @@ export class PublisherProxy {
|
|
|
213
217
|
* On met à jour leur valeur interne
|
|
214
218
|
* On publie les maj au fur et a mesure de modifications
|
|
215
219
|
*/
|
|
216
|
-
for (
|
|
220
|
+
for (const key in this._value_) {
|
|
217
221
|
if (typeof this._value_[key] === "undefined")
|
|
218
222
|
delete this._value_[key];
|
|
219
223
|
}
|
|
@@ -244,12 +248,12 @@ export class PublisherProxy {
|
|
|
244
248
|
* On renseigne les nouvelles valeurs internes des proxies
|
|
245
249
|
*/
|
|
246
250
|
if (isComplex(this._value_)) {
|
|
247
|
-
for (
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
+
for (const key in this._value_) {
|
|
252
|
+
const v = newValue[key];
|
|
253
|
+
const isVComplex = isComplex(v);
|
|
254
|
+
const valueV = isVComplex ? v : { __value: v };
|
|
251
255
|
if (!this._proxies_.has(key)) {
|
|
252
|
-
|
|
256
|
+
const newPublisher = new Publisher({}, this);
|
|
253
257
|
this._proxies_.set(key, newPublisher);
|
|
254
258
|
newPublisher._proxies_.set("_parent_", this);
|
|
255
259
|
}
|
|
@@ -263,9 +267,9 @@ export class PublisherProxy {
|
|
|
263
267
|
* Extraire la valeur actuelle du proxy
|
|
264
268
|
*/
|
|
265
269
|
get() {
|
|
266
|
-
if (
|
|
267
|
-
|
|
268
|
-
return v != undefined ? v : null;
|
|
270
|
+
if (Object.prototype.hasOwnProperty.call(this._value_, "__value")) {
|
|
271
|
+
const v = this._value_.__value;
|
|
272
|
+
return (v != undefined ? v : null);
|
|
269
273
|
}
|
|
270
274
|
return this._value_;
|
|
271
275
|
}
|
|
@@ -336,15 +340,13 @@ PublisherManager.instance = null;
|
|
|
336
340
|
export default class Publisher extends PublisherProxy {
|
|
337
341
|
constructor(target, parentProxPub = null) {
|
|
338
342
|
super(target, parentProxPub);
|
|
339
|
-
|
|
340
|
-
let thisProxy = new Proxy(this, {
|
|
343
|
+
const thisProxy = new Proxy(this, {
|
|
341
344
|
/**
|
|
342
345
|
* Lorsque l'on écrit monConteneur = publisher.maClef ou monConteneur = publisher["maClef"] monConteneur contient :
|
|
343
346
|
* Les methodes de PublisherProxy (onAssign... : voir liste dans kle tableaus si dessous), si la clef est une méthode de PublisherProxy,,
|
|
344
347
|
* Sinon un autre proxy qui a comme valeur interne la valeur corespondante à la clef dans l'objet.
|
|
345
348
|
*/
|
|
346
|
-
get: function (
|
|
347
|
-
oTarget;
|
|
349
|
+
get: function (publisherInstance, sKey) {
|
|
348
350
|
if ([
|
|
349
351
|
"invalidate",
|
|
350
352
|
"onInvalidate",
|
|
@@ -376,79 +378,81 @@ export default class Publisher extends PublisherProxy {
|
|
|
376
378
|
"_value_",
|
|
377
379
|
"_lockInternalMutationPublishing_",
|
|
378
380
|
].includes(sKey))
|
|
379
|
-
return
|
|
380
|
-
if (!
|
|
381
|
-
|
|
382
|
-
|
|
381
|
+
return publisherInstance[sKey];
|
|
382
|
+
if (!publisherInstance._proxies_.has(sKey)) {
|
|
383
|
+
const vValue = publisherInstance._value_[sKey];
|
|
384
|
+
const newPublisher = new Publisher(isComplex(vValue) ? vValue : { __value: vValue }, publisherInstance);
|
|
383
385
|
newPublisher._proxies_.set("_parent_", thisProxy);
|
|
384
|
-
|
|
386
|
+
publisherInstance._proxies_.set(sKey, newPublisher);
|
|
385
387
|
}
|
|
386
|
-
return
|
|
388
|
+
return publisherInstance._proxies_.get(sKey);
|
|
387
389
|
},
|
|
388
390
|
/**
|
|
389
391
|
* Lorsque l'on écrit publisher.maClef = value ou publisher["maClef"] = value, on assigne la valeur à la clef dans l'objet interne.
|
|
390
392
|
* Les gestionnairs associés sopnt déclenchés en conséquence de manière profonde et remontante si nécessaire.
|
|
391
393
|
*/
|
|
392
|
-
set: function (
|
|
394
|
+
set: function (publisherInstance, sKey, vValue) {
|
|
393
395
|
var _a;
|
|
394
396
|
//Fonctionnement pour la donnée interne pas de dispatch;
|
|
395
397
|
if (sKey == "_value_") {
|
|
396
|
-
|
|
397
|
-
return
|
|
398
|
+
publisherInstance._value_ = vValue;
|
|
399
|
+
// return publisherInstance._value_;
|
|
400
|
+
return true;
|
|
398
401
|
}
|
|
399
402
|
//Création du publisher si il n'existe pas
|
|
400
|
-
if (!
|
|
401
|
-
|
|
403
|
+
if (!publisherInstance._proxies_.has(sKey)) {
|
|
404
|
+
const newPublisher = new Publisher({}, publisherInstance);
|
|
402
405
|
newPublisher._proxies_.set("_parent_", thisProxy);
|
|
403
|
-
|
|
406
|
+
publisherInstance._proxies_.set(sKey, newPublisher);
|
|
404
407
|
}
|
|
405
408
|
//mis à jour et publication de la donnée si elle a changé
|
|
406
|
-
const prevValue =
|
|
409
|
+
const prevValue = publisherInstance._value_[sKey];
|
|
407
410
|
if (prevValue !== vValue) {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
(_a =
|
|
411
|
+
publisherInstance._value_[sKey] = vValue;
|
|
412
|
+
publisherInstance._publishDynamicFilling_(sKey, vValue);
|
|
413
|
+
(_a = publisherInstance._proxies_.get(sKey)) === null || _a === void 0 ? void 0 : _a.set(isComplex(vValue) ? vValue : { __value: vValue });
|
|
411
414
|
}
|
|
412
415
|
//on retourne le proxy pour pouvoir chainer les assignements
|
|
413
|
-
return
|
|
416
|
+
// return publisherInstance._proxies_.get(sKey);
|
|
417
|
+
return true;
|
|
414
418
|
},
|
|
415
419
|
/**
|
|
416
420
|
* Autres propriétés classiques d'un objet implémentées par le proxy
|
|
417
421
|
*/
|
|
418
|
-
deleteProperty: function (
|
|
419
|
-
|
|
420
|
-
//
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
return delete
|
|
422
|
+
deleteProperty: function (publisherInstance, sKey) {
|
|
423
|
+
publisherInstance;
|
|
424
|
+
// publisherInstance._proxies_.get(sKey).set(null);
|
|
425
|
+
publisherInstance._publishDynamicFilling_(sKey, null);
|
|
426
|
+
publisherInstance._proxies_.delete(sKey);
|
|
427
|
+
return delete publisherInstance._value_[sKey];
|
|
424
428
|
},
|
|
425
|
-
// enumerate: function (
|
|
426
|
-
// return
|
|
429
|
+
// enumerate: function (publisherInstance, sKey): CoreJSType {
|
|
430
|
+
// return publisherInstance._value_.keys();
|
|
427
431
|
// },
|
|
428
|
-
has: function (
|
|
429
|
-
|
|
430
|
-
return sKey in
|
|
432
|
+
has: function (publisherInstance, sKey) {
|
|
433
|
+
publisherInstance;
|
|
434
|
+
return sKey in publisherInstance._value_ && sKey != "_lockInternalMutationPublishing_";
|
|
431
435
|
},
|
|
432
|
-
defineProperty: function (
|
|
433
|
-
|
|
436
|
+
defineProperty: function (publisherInstance, sKey, oDesc) {
|
|
437
|
+
publisherInstance;
|
|
434
438
|
if (oDesc && "value" in oDesc) {
|
|
435
|
-
|
|
439
|
+
publisherInstance._value_[sKey] = oDesc.value;
|
|
436
440
|
}
|
|
437
|
-
return
|
|
441
|
+
return true;
|
|
442
|
+
// return publisherInstance._value_;
|
|
438
443
|
},
|
|
439
|
-
getOwnPropertyDescriptor: function (
|
|
440
|
-
|
|
444
|
+
getOwnPropertyDescriptor: function (publisherInstance, sKey) {
|
|
445
|
+
publisherInstance;
|
|
441
446
|
sKey;
|
|
442
447
|
return {
|
|
443
448
|
enumerable: true,
|
|
444
449
|
configurable: true,
|
|
445
450
|
};
|
|
446
451
|
},
|
|
447
|
-
ownKeys: function (
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
return Object.keys(that._value_);
|
|
452
|
+
ownKeys: function (publisherInstance) {
|
|
453
|
+
if (publisherInstance._value_.__value)
|
|
454
|
+
return Object.keys(publisherInstance._value_.__value);
|
|
455
|
+
return Object.keys(publisherInstance._value_);
|
|
452
456
|
},
|
|
453
457
|
});
|
|
454
458
|
return thisProxy;
|
package/core/utils/api.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { CoreJSType } from "@supersoniks/concorde/core/_types/types";
|
|
2
|
+
export type APIConfiguration = {
|
|
2
3
|
serviceURL: string | null;
|
|
3
4
|
token: string | null;
|
|
4
5
|
userName: string | null;
|
|
@@ -7,13 +8,15 @@ export declare type APIConfiguration = {
|
|
|
7
8
|
addHTTPResponse?: boolean;
|
|
8
9
|
credentials?: RequestCredentials;
|
|
9
10
|
};
|
|
10
|
-
|
|
11
|
+
export type ResultTypeInterface = CoreJSType & {
|
|
11
12
|
_sonic_http_response_?: Response;
|
|
12
|
-
|
|
13
|
+
text?: string;
|
|
14
|
+
};
|
|
15
|
+
declare class API {
|
|
13
16
|
/**
|
|
14
17
|
* Ce tableau static permet de ne pas appeler plusieurs fois le même service lors d'appel concurrents en GET.
|
|
15
18
|
*/
|
|
16
|
-
static loadingGetPromises: Map<string, Promise<
|
|
19
|
+
static loadingGetPromises: Map<string, Promise<unknown>>;
|
|
17
20
|
/**
|
|
18
21
|
* L'url de base du service sans endpoint
|
|
19
22
|
*/
|
|
@@ -45,18 +48,15 @@ declare class API<ResultType = any & {
|
|
|
45
48
|
/**
|
|
46
49
|
* Le endPoint pour obtenir le bearer token qui sera concaténé à l'url du service
|
|
47
50
|
*/
|
|
48
|
-
addHTTPResponse:
|
|
51
|
+
addHTTPResponse: boolean;
|
|
49
52
|
lastResult?: Response;
|
|
50
53
|
constructor(config: APIConfiguration);
|
|
51
|
-
handleResult(fetchResult
|
|
52
|
-
_sonic_http_response_?: Response | undefined;
|
|
53
|
-
text?: string | undefined;
|
|
54
|
-
}>;
|
|
54
|
+
handleResult(fetchResult?: Response): Promise<ResultTypeInterface>;
|
|
55
55
|
/**
|
|
56
56
|
* Basic auth
|
|
57
57
|
*/
|
|
58
58
|
auth(): Promise<void>;
|
|
59
|
-
get(path:
|
|
59
|
+
get<T>(path: string, additionalHeaders?: HeadersInit): Promise<T & ResultTypeInterface>;
|
|
60
60
|
/**
|
|
61
61
|
* Création du header, avec authentification si besoin
|
|
62
62
|
* ajout du language via le header accept-language qui contient le langue du navigateur
|
|
@@ -65,38 +65,23 @@ declare class API<ResultType = any & {
|
|
|
65
65
|
/**
|
|
66
66
|
* Concatène le serviceURL et le endpoint donné en paramètre
|
|
67
67
|
*/
|
|
68
|
-
computeURL(path:
|
|
69
|
-
send(path:
|
|
70
|
-
_sonic_http_response_?: Response | undefined;
|
|
71
|
-
text?: string | undefined;
|
|
72
|
-
}>;
|
|
68
|
+
computeURL(path: string): string;
|
|
69
|
+
send<T, SendType = CoreJSType>(path: string, data: SendType, method?: string, additionalHeaders?: HeadersInit): Promise<T & ResultTypeInterface>;
|
|
73
70
|
/**
|
|
74
71
|
* Agit comme une soumission de formulaire, mais attends un json en réponse
|
|
75
72
|
*/
|
|
76
|
-
submitFormData(path:
|
|
77
|
-
_sonic_http_response_?: Response | undefined;
|
|
78
|
-
text?: string | undefined;
|
|
79
|
-
}>;
|
|
73
|
+
submitFormData<T, SendType = CoreJSType>(path: string, data: SendType, method?: string, additionalHeaders?: HeadersInit): Promise<T & ResultTypeInterface>;
|
|
80
74
|
/**
|
|
81
75
|
* Appel send en utilisant le méthode PUT
|
|
82
76
|
*/
|
|
83
|
-
put(path:
|
|
84
|
-
_sonic_http_response_?: Response | undefined;
|
|
85
|
-
text?: string | undefined;
|
|
86
|
-
}>;
|
|
77
|
+
put<T, SendType = CoreJSType>(path: string, data: SendType, additionalHeaders?: HeadersInit): Promise<T & ResultTypeInterface>;
|
|
87
78
|
/**
|
|
88
79
|
* Appel send en utilisant le méthode POST
|
|
89
80
|
*/
|
|
90
|
-
post(path:
|
|
91
|
-
_sonic_http_response_?: Response | undefined;
|
|
92
|
-
text?: string | undefined;
|
|
93
|
-
}>;
|
|
81
|
+
post<T, SendType = CoreJSType>(path: string, data: SendType, additionalHeaders?: HeadersInit): Promise<T & ResultTypeInterface>;
|
|
94
82
|
/**
|
|
95
83
|
* Appel send en utilisant le méthode delete
|
|
96
84
|
*/
|
|
97
|
-
delete(path:
|
|
98
|
-
_sonic_http_response_?: Response | undefined;
|
|
99
|
-
text?: string | undefined;
|
|
100
|
-
}>;
|
|
85
|
+
delete<T, SendType = CoreJSType>(path: string, data: SendType, additionalHeaders?: HeadersInit): Promise<T & ResultTypeInterface>;
|
|
101
86
|
}
|
|
102
87
|
export default API;
|
package/core/utils/api.js
CHANGED
|
@@ -7,6 +7,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
+
// on désactive une regle eslint pour ce fichier
|
|
11
|
+
/* eslint no-async-promise-executor: 0 */ // --> OFF
|
|
10
12
|
import HTML from "@supersoniks/concorde/core/utils/HTML";
|
|
11
13
|
import Objects from "@supersoniks/concorde/core/utils/Objects";
|
|
12
14
|
class API {
|
|
@@ -29,15 +31,15 @@ class API {
|
|
|
29
31
|
var _a;
|
|
30
32
|
return __awaiter(this, void 0, void 0, function* () {
|
|
31
33
|
this.lastResult = fetchResult;
|
|
32
|
-
const contentType = (_a = fetchResult.headers.get("content-type")) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
34
|
+
const contentType = (_a = fetchResult === null || fetchResult === void 0 ? void 0 : fetchResult.headers.get("content-type")) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
33
35
|
let result = {};
|
|
34
36
|
if (contentType && contentType.indexOf("text/") == 0) {
|
|
35
|
-
|
|
37
|
+
const str = yield (fetchResult === null || fetchResult === void 0 ? void 0 : fetchResult.text());
|
|
36
38
|
result = { text: str };
|
|
37
39
|
}
|
|
38
40
|
else {
|
|
39
41
|
try {
|
|
40
|
-
result = yield fetchResult.json();
|
|
42
|
+
result = yield (fetchResult === null || fetchResult === void 0 ? void 0 : fetchResult.json());
|
|
41
43
|
}
|
|
42
44
|
catch (e) {
|
|
43
45
|
result = {};
|
|
@@ -62,34 +64,36 @@ class API {
|
|
|
62
64
|
}
|
|
63
65
|
if (!this.userName || !this.password || !this.tokenProvider)
|
|
64
66
|
return;
|
|
65
|
-
|
|
67
|
+
const headers = {
|
|
66
68
|
Authorization: "Basic " + window.btoa(unescape(encodeURIComponent(this.userName + ":" + this.password))),
|
|
67
69
|
};
|
|
68
|
-
|
|
70
|
+
const result = yield fetch(this.computeURL(this.tokenProvider), {
|
|
69
71
|
headers: headers,
|
|
70
72
|
credentials: this.credentials,
|
|
71
73
|
});
|
|
72
74
|
try {
|
|
73
|
-
|
|
75
|
+
const json = yield result.json();
|
|
74
76
|
this.token = json.token;
|
|
75
77
|
API.tokens.set(this.serviceURL, this.token);
|
|
76
78
|
}
|
|
77
|
-
catch (e) {
|
|
79
|
+
catch (e) {
|
|
80
|
+
console.log("Problème au moment du parsing du json au retour de l'authentification");
|
|
81
|
+
}
|
|
78
82
|
});
|
|
79
83
|
}
|
|
80
84
|
get(path, additionalHeaders) {
|
|
81
85
|
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
-
|
|
86
|
+
const headers = yield this.createHeaders(additionalHeaders);
|
|
83
87
|
const url = this.computeURL(path);
|
|
84
88
|
if (!API.loadingGetPromises.has(url)) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
89
|
+
const promise = new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
|
|
90
|
+
const result = yield fetch(url, { headers: headers, credentials: this.credentials });
|
|
91
|
+
const handledResult = yield this.handleResult(result);
|
|
88
92
|
resolve(handledResult);
|
|
89
93
|
}));
|
|
90
94
|
API.loadingGetPromises.set(url, promise);
|
|
91
95
|
}
|
|
92
|
-
|
|
96
|
+
const result = (yield API.loadingGetPromises.get(url));
|
|
93
97
|
API.loadingGetPromises.delete(url);
|
|
94
98
|
return result;
|
|
95
99
|
});
|
|
@@ -101,7 +105,7 @@ class API {
|
|
|
101
105
|
createHeaders(additionalHeaders) {
|
|
102
106
|
return __awaiter(this, void 0, void 0, function* () {
|
|
103
107
|
yield this.auth();
|
|
104
|
-
|
|
108
|
+
const headers = {};
|
|
105
109
|
if (this.token)
|
|
106
110
|
headers.Authorization = "Bearer " + this.token;
|
|
107
111
|
headers["Accept-Language"] = HTML.getLanguage();
|
|
@@ -115,23 +119,23 @@ class API {
|
|
|
115
119
|
* Concatène le serviceURL et le endpoint donné en paramètre
|
|
116
120
|
*/
|
|
117
121
|
computeURL(path) {
|
|
118
|
-
return (this.serviceURL + "/" + path).replace(/([^(https
|
|
122
|
+
return (this.serviceURL + "/" + path).replace(/([^(https?:)])\/{2,}/g, "$1/");
|
|
119
123
|
}
|
|
120
124
|
/*
|
|
121
125
|
* Envoie des données au endPoint passé en paramètre. par défaut en POST
|
|
122
126
|
*/
|
|
123
127
|
send(path, data, method = "POST", additionalHeaders) {
|
|
124
128
|
return __awaiter(this, void 0, void 0, function* () {
|
|
125
|
-
|
|
129
|
+
const headers = yield this.createHeaders(additionalHeaders);
|
|
126
130
|
headers["Accept"] = "application/json";
|
|
127
131
|
headers["Content-Type"] = "application/json";
|
|
128
|
-
|
|
132
|
+
const result = yield fetch(this.computeURL(path), {
|
|
129
133
|
headers: headers,
|
|
130
134
|
credentials: this.credentials,
|
|
131
135
|
method: method,
|
|
132
136
|
body: JSON.stringify(data),
|
|
133
137
|
});
|
|
134
|
-
return yield this.handleResult(result);
|
|
138
|
+
return (yield this.handleResult(result));
|
|
135
139
|
});
|
|
136
140
|
}
|
|
137
141
|
/**
|
|
@@ -139,19 +143,19 @@ class API {
|
|
|
139
143
|
*/
|
|
140
144
|
submitFormData(path, data, method = "POST", additionalHeaders) {
|
|
141
145
|
return __awaiter(this, void 0, void 0, function* () {
|
|
142
|
-
|
|
146
|
+
const headers = yield this.createHeaders(additionalHeaders);
|
|
143
147
|
headers["Accept"] = "application/json";
|
|
144
|
-
|
|
148
|
+
const formData = new FormData();
|
|
145
149
|
const dynamicData = data;
|
|
146
|
-
for (
|
|
150
|
+
for (const z in dynamicData)
|
|
147
151
|
formData.set(z, dynamicData[z]);
|
|
148
|
-
|
|
152
|
+
const result = yield fetch(this.computeURL(path), {
|
|
149
153
|
headers: headers,
|
|
150
154
|
credentials: this.credentials,
|
|
151
155
|
method: method,
|
|
152
156
|
body: formData,
|
|
153
157
|
});
|
|
154
|
-
return yield this.handleResult(result);
|
|
158
|
+
return (yield this.handleResult(result));
|
|
155
159
|
});
|
|
156
160
|
}
|
|
157
161
|
/**
|
package/mixins.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
export declare const Fetcher: <
|
|
2
|
+
export declare const Fetcher: <T extends new (...args: any[]) => mySubscriber.SubscriberInterface<PropsType>, PropsType extends import("./core/_types/types").PublisherContentType = import("./core/_types/types").PublisherContentType>(superClass: T, propsType?: PropsType | undefined) => {
|
|
3
3
|
new (...args: any[]): {
|
|
4
|
-
api: import("./core/utils/api").default
|
|
5
|
-
key:
|
|
4
|
+
api: import("./core/utils/api").default | null;
|
|
5
|
+
key: string;
|
|
6
6
|
isFirstLoad: boolean;
|
|
7
7
|
isLoading: boolean;
|
|
8
8
|
iObserver: IntersectionObserver | null;
|
|
9
9
|
isDefaultLoaderEnabled: boolean;
|
|
10
10
|
isFetchEnabled: boolean;
|
|
11
11
|
_endPoint: string;
|
|
12
|
+
props: (PropsType & import("./core/utils/api").ResultTypeInterface) | null;
|
|
12
13
|
endPoint: string;
|
|
13
14
|
requestId: number;
|
|
14
15
|
refetchEveryMs: number;
|
|
@@ -19,9 +20,10 @@ export declare const Fetcher: <PropsType = any, T extends new (...args: any[]) =
|
|
|
19
20
|
connectedCallback(): void;
|
|
20
21
|
firstUpdated(): void;
|
|
21
22
|
onIntersection(entries: IntersectionObserverEntry[]): void;
|
|
22
|
-
|
|
23
|
-
propertyMap: Object;
|
|
23
|
+
propertyMap: object;
|
|
24
24
|
isConnected: boolean;
|
|
25
|
+
children: HTMLCollection;
|
|
26
|
+
appendChild(node: Node): Node;
|
|
25
27
|
getAncestorAttributeValue(attributeName: string): string;
|
|
26
28
|
hasAncestorAttribute(attributeName: string): boolean;
|
|
27
29
|
querySelectorAll(selector: string): NodeListOf<Element>;
|
|
@@ -41,7 +43,7 @@ export declare const Fetcher: <PropsType = any, T extends new (...args: any[]) =
|
|
|
41
43
|
getApiConfiguration(): import("./core/utils/api").APIConfiguration;
|
|
42
44
|
requestUpdate(): void;
|
|
43
45
|
getAttribute(name: string): string;
|
|
44
|
-
hasAttribute(attributeName:
|
|
46
|
+
hasAttribute(attributeName: string): boolean;
|
|
45
47
|
};
|
|
46
48
|
} & T;
|
|
47
49
|
export declare const FormCheckable: <T extends new (...args: any[]) => myFormElement.FormElementInterface>(superClass: T) => {
|
|
@@ -79,9 +81,11 @@ export declare const FormCheckable: <T extends new (...args: any[]) => myFormEle
|
|
|
79
81
|
ariaLabel?: string | undefined;
|
|
80
82
|
_name: string;
|
|
81
83
|
name: string;
|
|
82
|
-
props:
|
|
83
|
-
propertyMap:
|
|
84
|
+
props: import("./core/_types/types").CoreJSType;
|
|
85
|
+
propertyMap: object;
|
|
84
86
|
isConnected: boolean;
|
|
87
|
+
children: HTMLCollection;
|
|
88
|
+
appendChild(node: Node): Node;
|
|
85
89
|
getAncestorAttributeValue(attributeName: string): string;
|
|
86
90
|
hasAncestorAttribute(attributeName: string): boolean;
|
|
87
91
|
querySelectorAll(selector: string): NodeListOf<Element>;
|
|
@@ -100,17 +104,17 @@ export declare const FormCheckable: <T extends new (...args: any[]) => myFormEle
|
|
|
100
104
|
getApiConfiguration(): import("./core/utils/api").APIConfiguration;
|
|
101
105
|
requestUpdate(): void;
|
|
102
106
|
getAttribute(name: string): string;
|
|
103
|
-
hasAttribute(attributeName:
|
|
107
|
+
hasAttribute(attributeName: string): boolean;
|
|
104
108
|
};
|
|
105
109
|
} & T;
|
|
106
110
|
import * as myFormElement from "@supersoniks/concorde/core/mixins/FormElement";
|
|
107
|
-
export declare const FormElement: <T extends new (...args: any[]) => mySubscriber.SubscriberInterface<
|
|
111
|
+
export declare const FormElement: <T extends new (...args: any[]) => mySubscriber.SubscriberInterface<import("./core/_types/types").CoreJSType>>(superClass: T) => (new (...args: any[]) => myFormElement.FormElementInterface) & T;
|
|
108
112
|
export declare const FormInput: <T extends new (...args: any[]) => myFormElement.FormElementInterface>(superClass: T) => {
|
|
109
113
|
new (...args: any[]): {
|
|
110
114
|
validateFormElement(): void;
|
|
111
115
|
forceAutoFill: boolean;
|
|
112
|
-
_type: "number" | "search" | "file" | "button" | "
|
|
113
|
-
type: "number" | "search" | "file" | "button" | "
|
|
116
|
+
_type: "number" | "search" | "file" | "button" | "url" | "color" | "hidden" | "time" | "image" | "text" | "reset" | "submit" | "month" | "week" | "checkbox" | "radio" | "range" | "tel" | "email" | "date" | "datetime-local" | "password";
|
|
117
|
+
type: "number" | "search" | "file" | "button" | "url" | "color" | "hidden" | "time" | "image" | "text" | "reset" | "submit" | "month" | "week" | "checkbox" | "radio" | "range" | "tel" | "email" | "date" | "datetime-local" | "password";
|
|
114
118
|
_description?: string | undefined;
|
|
115
119
|
description: string | undefined;
|
|
116
120
|
_label?: string | undefined;
|
|
@@ -121,7 +125,7 @@ export declare const FormInput: <T extends new (...args: any[]) => myFormElement
|
|
|
121
125
|
updateDataValue(): void;
|
|
122
126
|
handleChange(e?: Event | undefined): void;
|
|
123
127
|
handleBlur(e?: Event | undefined): void;
|
|
124
|
-
getValueForFormPublisher():
|
|
128
|
+
getValueForFormPublisher(): string | object | string[] | null | undefined;
|
|
125
129
|
focus?: (() => void) | undefined;
|
|
126
130
|
shadowRoot?: ShadowRoot | undefined;
|
|
127
131
|
error: boolean;
|
|
@@ -131,13 +135,15 @@ export declare const FormInput: <T extends new (...args: any[]) => myFormElement
|
|
|
131
135
|
formDataProvider: string;
|
|
132
136
|
ariaLabelledby?: string | undefined;
|
|
133
137
|
ariaLabel?: string | undefined;
|
|
134
|
-
_value: string | null;
|
|
135
|
-
value: string | null;
|
|
138
|
+
_value: string | object | string[] | null | undefined;
|
|
139
|
+
value: string | object | string[] | null | undefined;
|
|
136
140
|
_name: string;
|
|
137
141
|
name: string;
|
|
138
|
-
props:
|
|
139
|
-
propertyMap:
|
|
142
|
+
props: import("./core/_types/types").CoreJSType;
|
|
143
|
+
propertyMap: object;
|
|
140
144
|
isConnected: boolean;
|
|
145
|
+
children: HTMLCollection;
|
|
146
|
+
appendChild(node: Node): Node;
|
|
141
147
|
getAncestorAttributeValue(attributeName: string): string;
|
|
142
148
|
hasAncestorAttribute(attributeName: string): boolean;
|
|
143
149
|
querySelectorAll(selector: string): NodeListOf<Element>;
|
|
@@ -157,11 +163,11 @@ export declare const FormInput: <T extends new (...args: any[]) => myFormElement
|
|
|
157
163
|
connectedCallback(): void;
|
|
158
164
|
requestUpdate(): void;
|
|
159
165
|
getAttribute(name: string): string;
|
|
160
|
-
hasAttribute(attributeName:
|
|
166
|
+
hasAttribute(attributeName: string): boolean;
|
|
161
167
|
disconnectedCallback(): void;
|
|
162
168
|
};
|
|
163
169
|
} & T;
|
|
164
170
|
import * as mySubscriber from "@supersoniks/concorde/core/mixins/Subscriber";
|
|
165
|
-
export declare const Subscriber: <PropsType =
|
|
171
|
+
export declare const Subscriber: <PropsType = import("./core/_types/types").CoreJSType, T extends new (...args: any[]) => import("lit").LitElement = new (...args: any[]) => import("lit").LitElement>(superClass: T, type?: PropsType | undefined) => (new (...args: any[]) => mySubscriber.SubscriberInterface<PropsType>) & T;
|
|
166
172
|
import * as myTemplatesContainer from "@supersoniks/concorde/core/mixins/TemplatesContainer";
|
|
167
173
|
export declare const TemplatesContainer: <T extends new (...args: any[]) => import("lit").LitElement>(superClass: T) => (new (...args: any[]) => myTemplatesContainer.TemplatesContainerInterface) & T;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supersoniks/concorde",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.44",
|
|
4
4
|
"customElements": "custom-elements.json",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -23,10 +23,15 @@
|
|
|
23
23
|
"@types/intl": "^1.2.0",
|
|
24
24
|
"@types/jest": "^29.2.6",
|
|
25
25
|
"@types/node": "^18.11.18",
|
|
26
|
+
"@typescript-eslint/eslint-plugin": "^5.49.0",
|
|
27
|
+
"@typescript-eslint/parser": "^5.49.0",
|
|
28
|
+
"add": "^2.0.6",
|
|
26
29
|
"autoprefixer": "^10.4.5",
|
|
30
|
+
"eslint": "^8.32.0",
|
|
31
|
+
"eslint-config-prettier": "^8.6.0",
|
|
27
32
|
"intl": "^1.2.5",
|
|
28
33
|
"jest": "^29.3.1",
|
|
29
|
-
"jest-environment-jsdom": "^29.
|
|
34
|
+
"jest-environment-jsdom": "^29.4.1",
|
|
30
35
|
"postcss": "^8.4.12",
|
|
31
36
|
"rollup-plugin-minify-html-literals": "^1.2.6",
|
|
32
37
|
"rollup-plugin-postcss-lit": "^2.0.0",
|
|
@@ -36,7 +41,8 @@
|
|
|
36
41
|
"ts-node": "^10.9.1",
|
|
37
42
|
"typescript": "^4.6.4",
|
|
38
43
|
"vite": "^2.6.14",
|
|
39
|
-
"vite-jest": "^0.1.4"
|
|
44
|
+
"vite-jest": "^0.1.4",
|
|
45
|
+
"yarn": "^1.22.19"
|
|
40
46
|
},
|
|
41
47
|
"exports": {
|
|
42
48
|
"./components": "./components.js",
|
|
@@ -191,8 +197,6 @@
|
|
|
191
197
|
"./ui/table/table-tr": "./core/components/ui/table/table-tr.js",
|
|
192
198
|
"./core/components/ui/table/table": "./core/components/ui/table/table.js",
|
|
193
199
|
"./ui/table": "./core/components/ui/table/table.js",
|
|
194
|
-
"./core/components/ui/taxonomy/taxonomy": "./core/components/ui/taxonomy/taxonomy.js",
|
|
195
|
-
"./ui/taxonomy": "./core/components/ui/taxonomy/taxonomy.js",
|
|
196
200
|
"./core/components/ui/theme/theme-collection/core-variables": "./core/components/ui/theme/theme-collection/core-variables.js",
|
|
197
201
|
"./ui/theme/theme-collection/core-variables": "./core/components/ui/theme/theme-collection/core-variables.js",
|
|
198
202
|
"./core/components/ui/theme/theme-collection/dark": "./core/components/ui/theme/theme-collection/dark.js",
|