@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.
Files changed (97) hide show
  1. package/concorde-core.bundle.js +18 -18
  2. package/concorde-core.es.js +805 -739
  3. package/core/_types/types.d.ts +13 -8
  4. package/core/_types/types.js +1 -0
  5. package/core/components/functional/date/date.d.ts +2 -2
  6. package/core/components/functional/date/date.js +10 -10
  7. package/core/components/functional/example/example.d.ts +1 -1
  8. package/core/components/functional/fetch/fetch.d.ts +8 -6
  9. package/core/components/functional/list/list.d.ts +16 -8
  10. package/core/components/functional/list/list.js +25 -13
  11. package/core/components/functional/mix/mix.d.ts +5 -5
  12. package/core/components/functional/mix/mix.js +11 -8
  13. package/core/components/functional/queue/queue.d.ts +12 -3
  14. package/core/components/functional/queue/queue.js +28 -22
  15. package/core/components/functional/router/redirect.d.ts +2 -2
  16. package/core/components/functional/router/redirect.js +2 -6
  17. package/core/components/functional/router/router.d.ts +1 -1
  18. package/core/components/functional/router/router.js +10 -10
  19. package/core/components/functional/sdui/SDUIDescriptorTransformer.d.ts +0 -1
  20. package/core/components/functional/sdui/SDUIDescriptorTransformer.js +35 -36
  21. package/core/components/functional/sdui/sdui-utils.js +11 -11
  22. package/core/components/functional/sdui/sdui.d.ts +10 -9
  23. package/core/components/functional/sdui/sdui.js +32 -33
  24. package/core/components/functional/sdui/types.d.ts +8 -8
  25. package/core/components/functional/states/states.d.ts +3 -3
  26. package/core/components/functional/states/states.js +8 -8
  27. package/core/components/functional/submit/submit.d.ts +1 -1
  28. package/core/components/functional/submit/submit.js +16 -16
  29. package/core/components/functional/subscriber/subscriber.d.ts +1 -1
  30. package/core/components/functional/value/value.d.ts +1 -1
  31. package/core/components/ui/_css/size.d.ts +1 -1
  32. package/core/components/ui/button/button.d.ts +6 -4
  33. package/core/components/ui/button/button.js +2 -2
  34. package/core/components/ui/captcha/captcha.d.ts +2 -2
  35. package/core/components/ui/captcha/captcha.js +2 -2
  36. package/core/components/ui/card/card-header.js +5 -1
  37. package/core/components/ui/card/card.js +7 -5
  38. package/core/components/ui/form/checkbox/checkbox.d.ts +36 -12
  39. package/core/components/ui/form/fieldset/fieldset.d.ts +1 -1
  40. package/core/components/ui/form/form-layout/form-layout.d.ts +1 -1
  41. package/core/components/ui/form/input/input.d.ts +14 -9
  42. package/core/components/ui/form/input/input.js +2 -2
  43. package/core/components/ui/form/input/password-helper.d.ts +1 -1
  44. package/core/components/ui/form/input/password-helper.js +1 -1
  45. package/core/components/ui/form/input/same-value-helper.d.ts +1 -1
  46. package/core/components/ui/form/input/same-value-helper.js +2 -2
  47. package/core/components/ui/form/input-autocomplete/input-autocomplete.d.ts +1 -1
  48. package/core/components/ui/form/select/select.d.ts +5 -4
  49. package/core/components/ui/form/select/select.js +8 -8
  50. package/core/components/ui/form/textarea/textarea.d.ts +11 -9
  51. package/core/components/ui/form/textarea/textarea.js +1 -1
  52. package/core/components/ui/group/group.js +1 -1
  53. package/core/components/ui/icon/icons.js +15 -13
  54. package/core/components/ui/loader/loader.d.ts +1 -1
  55. package/core/components/ui/loader/loader.js +1 -1
  56. package/core/components/ui/menu/menu.js +15 -16
  57. package/core/components/ui/modal/modal.d.ts +1 -1
  58. package/core/components/ui/modal/modal.js +1 -1
  59. package/core/components/ui/pop/pop.d.ts +1 -1
  60. package/core/components/ui/pop/pop.js +13 -13
  61. package/core/components/ui/table/table-tbody.js +1 -1
  62. package/core/components/ui/theme/theme.js +15 -13
  63. package/core/components/ui/toast/message-subscriber.d.ts +12 -9
  64. package/core/components/ui/toast/message-subscriber.js +10 -8
  65. package/core/components/ui/toast/toast.d.ts +1 -1
  66. package/core/components/ui/toast/toast.js +7 -8
  67. package/core/components/ui/toast/types.d.ts +3 -2
  68. package/core/components/ui/tooltip/tooltip.js +1 -1
  69. package/core/components/ui/ui.d.ts +1 -1
  70. package/core/components/ui/ui.js +1 -1
  71. package/core/mixins/Fetcher.d.ts +15 -17
  72. package/core/mixins/Fetcher.js +19 -10
  73. package/core/mixins/FormCheckable.d.ts +8 -5
  74. package/core/mixins/FormCheckable.js +21 -19
  75. package/core/mixins/FormElement.d.ts +10 -7
  76. package/core/mixins/FormElement.js +24 -23
  77. package/core/mixins/FormInput.d.ts +16 -10
  78. package/core/mixins/FormInput.js +1 -1
  79. package/core/mixins/Subscriber.d.ts +8 -6
  80. package/core/mixins/Subscriber.js +19 -18
  81. package/core/mixins/TemplatesContainer.d.ts +2 -1
  82. package/core/mixins/TemplatesContainer.js +2 -2
  83. package/core/utils/Arrays.js +12 -9
  84. package/core/utils/DataBindObserver.d.ts +4 -4
  85. package/core/utils/DataBindObserver.js +26 -28
  86. package/core/utils/HTML.d.ts +1 -1
  87. package/core/utils/HTML.js +2 -2
  88. package/core/utils/LocationHandler.js +10 -10
  89. package/core/utils/Objects.js +10 -4
  90. package/core/utils/PublisherProxy.d.ts +21 -15
  91. package/core/utils/PublisherProxy.js +67 -63
  92. package/core/utils/api.d.ts +16 -31
  93. package/core/utils/api.js +26 -22
  94. package/mixins.d.ts +25 -19
  95. package/package.json +9 -5
  96. package/core/components/ui/taxonomy/taxonomy.d.ts +0 -44
  97. 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 (let proxy of this._proxies_.values()) {
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
- let desc = Object.getOwnPropertyDescriptor(handler, key);
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
- for (var z in this._value_) {
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
- z = handler.propertyMap[z];
153
+ valueKey = handler.propertyMap[z];
150
154
  }
151
155
  if (typeof handler[z] != "undefined" && handler[z] !== value) {
152
- handler[z] = value;
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 (var z in this._value_) {
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 ("hasOwnProperty" in this._value_ &&
191
- this._value_.hasOwnProperty("__value") &&
192
- newValue.hasOwnProperty("__value") &&
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 = this._value_.hasOwnProperty("__value");
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 (let key in this._value_) {
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 (let key in this._value_) {
248
- let v = newValue[key];
249
- let isVComplex = isComplex(v);
250
- let valueV = isVComplex ? v : { __value: v };
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
- let newPublisher = new Publisher({}, this);
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 (this._value_.hasOwnProperty("__value")) {
267
- let v = this._value_.__value;
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
- let that = this;
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 (oTarget, sKey) {
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 that[sKey];
380
- if (!that._proxies_.has(sKey)) {
381
- let vValue = that._value_[sKey];
382
- let newPublisher = new Publisher(isComplex(vValue) ? vValue : { __value: vValue }, that);
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
- that._proxies_.set(sKey, newPublisher);
386
+ publisherInstance._proxies_.set(sKey, newPublisher);
385
387
  }
386
- return that._proxies_.get(sKey);
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 (oTarget, sKey, vValue) {
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
- oTarget._value_ = vValue;
397
- return oTarget._value_;
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 (!that._proxies_.has(sKey)) {
401
- let newPublisher = new Publisher({}, that);
403
+ if (!publisherInstance._proxies_.has(sKey)) {
404
+ const newPublisher = new Publisher({}, publisherInstance);
402
405
  newPublisher._proxies_.set("_parent_", thisProxy);
403
- that._proxies_.set(sKey, newPublisher);
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 = that._value_[sKey];
409
+ const prevValue = publisherInstance._value_[sKey];
407
410
  if (prevValue !== vValue) {
408
- that._value_[sKey] = vValue;
409
- that._publishDynamicFilling_(sKey, vValue);
410
- (_a = that._proxies_.get(sKey)) === null || _a === void 0 ? void 0 : _a.set(isComplex(vValue) ? vValue : { __value: vValue });
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 that._proxies_.get(sKey);
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 (oTarget, sKey) {
419
- oTarget;
420
- // that._proxies_.get(sKey).set(null);
421
- that._publishDynamicFilling_(sKey, null);
422
- that._proxies_.delete(sKey);
423
- return delete that._value_[sKey];
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 (oTarget, sKey): any {
426
- // return that._value_.keys();
429
+ // enumerate: function (publisherInstance, sKey): CoreJSType {
430
+ // return publisherInstance._value_.keys();
427
431
  // },
428
- has: function (oTarget, sKey) {
429
- oTarget;
430
- return sKey in that._value_ && sKey != "_lockInternalMutationPublishing_";
432
+ has: function (publisherInstance, sKey) {
433
+ publisherInstance;
434
+ return sKey in publisherInstance._value_ && sKey != "_lockInternalMutationPublishing_";
431
435
  },
432
- defineProperty: function (oTarget, sKey, oDesc) {
433
- oTarget;
436
+ defineProperty: function (publisherInstance, sKey, oDesc) {
437
+ publisherInstance;
434
438
  if (oDesc && "value" in oDesc) {
435
- that._value_[sKey] = oDesc.value;
439
+ publisherInstance._value_[sKey] = oDesc.value;
436
440
  }
437
- return that._value_;
441
+ return true;
442
+ // return publisherInstance._value_;
438
443
  },
439
- getOwnPropertyDescriptor: function (oTarget, sKey) {
440
- oTarget;
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 (target) {
448
- target;
449
- if (that._value_.__value)
450
- return Object.keys(that._value_.__value);
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;
@@ -1,4 +1,5 @@
1
- export declare type APIConfiguration = {
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
- declare class API<ResultType = any & {
11
+ export type ResultTypeInterface = CoreJSType & {
11
12
  _sonic_http_response_?: Response;
12
- }, SendType = any> {
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<any>>;
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: Boolean;
51
+ addHTTPResponse: boolean;
49
52
  lastResult?: Response;
50
53
  constructor(config: APIConfiguration);
51
- handleResult(fetchResult: Response): Promise<ResultType & {
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: String, additionalHeaders?: HeadersInit): Promise<ResultType>;
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: String): string;
69
- send(path: String, data: SendType, method?: string, additionalHeaders?: HeadersInit): Promise<ResultType & {
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: String, data: SendType | Record<string, string | Blob>, method?: string, additionalHeaders?: HeadersInit): Promise<ResultType & {
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: String, data: SendType, additionalHeaders?: HeadersInit): Promise<ResultType & {
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: String, data: SendType, additionalHeaders?: HeadersInit): Promise<ResultType & {
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: String, data: SendType, additionalHeaders?: HeadersInit): Promise<ResultType & {
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
- let str = yield fetchResult.text();
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
- let headers = {
67
+ const headers = {
66
68
  Authorization: "Basic " + window.btoa(unescape(encodeURIComponent(this.userName + ":" + this.password))),
67
69
  };
68
- let result = yield fetch(this.computeURL(this.tokenProvider), {
70
+ const result = yield fetch(this.computeURL(this.tokenProvider), {
69
71
  headers: headers,
70
72
  credentials: this.credentials,
71
73
  });
72
74
  try {
73
- let json = yield result.json();
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
- let headers = yield this.createHeaders(additionalHeaders);
86
+ const headers = yield this.createHeaders(additionalHeaders);
83
87
  const url = this.computeURL(path);
84
88
  if (!API.loadingGetPromises.has(url)) {
85
- let promise = new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
86
- let result = yield fetch(url, { headers: headers, credentials: this.credentials });
87
- let handledResult = yield this.handleResult(result);
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
- let result = yield API.loadingGetPromises.get(url);
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
- let headers = {};
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?\:)])\/{2,}/g, "$1/");
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
- let headers = yield this.createHeaders(additionalHeaders);
129
+ const headers = yield this.createHeaders(additionalHeaders);
126
130
  headers["Accept"] = "application/json";
127
131
  headers["Content-Type"] = "application/json";
128
- let result = yield fetch(this.computeURL(path), {
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
- let headers = yield this.createHeaders(additionalHeaders);
146
+ const headers = yield this.createHeaders(additionalHeaders);
143
147
  headers["Accept"] = "application/json";
144
- let formData = new FormData();
148
+ const formData = new FormData();
145
149
  const dynamicData = data;
146
- for (let z in dynamicData)
150
+ for (const z in dynamicData)
147
151
  formData.set(z, dynamicData[z]);
148
- let result = yield fetch(this.computeURL(path), {
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: <PropsType = any, T extends new (...args: any[]) => mySubscriber.SubscriberInterface<PropsType> = any>(superClass: T, propsType?: PropsType | undefined) => {
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<any, any> | null;
5
- key: String;
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
- props: PropsType | null;
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: String): boolean;
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: any;
83
- propertyMap: Object;
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: String): boolean;
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<any>>(superClass: T) => (new (...args: any[]) => myFormElement.FormElementInterface) & T;
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" | "password" | "url" | "color" | "hidden" | "time" | "image" | "text" | "reset" | "submit" | "month" | "week" | "checkbox" | "radio" | "range" | "tel" | "email" | "date" | "datetime-local";
113
- type: "number" | "search" | "file" | "button" | "password" | "url" | "color" | "hidden" | "time" | "image" | "text" | "reset" | "submit" | "month" | "week" | "checkbox" | "radio" | "range" | "tel" | "email" | "date" | "datetime-local";
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(): any;
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: any;
139
- propertyMap: Object;
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: String): boolean;
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 = any, T extends new (...args: any[]) => import("lit").LitElement = any>(superClass: T, type?: PropsType | undefined) => (new (...args: any[]) => mySubscriber.SubscriberInterface<PropsType>) & T;
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.43",
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.3.1",
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",