@supersoniks/concorde 1.1.42 → 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 (189) hide show
  1. package/components.js +2 -3
  2. package/concorde-core.bundle.js +37 -35
  3. package/concorde-core.es.js +5283 -4453
  4. package/core/_types/types.d.ts +31 -0
  5. package/core/_types/types.js +2 -0
  6. package/core/components/functional/date/date.d.ts +13 -5
  7. package/core/components/functional/date/date.js +57 -38
  8. package/core/components/functional/example/example.d.ts +1 -1
  9. package/core/components/functional/example/example.js +1 -1
  10. package/core/components/functional/fetch/fetch.d.ts +45 -6
  11. package/core/components/functional/fetch/fetch.js +2 -6
  12. package/core/components/functional/functional.d.ts +2 -0
  13. package/core/components/functional/functional.js +2 -0
  14. package/core/components/functional/if/if.d.ts +3 -0
  15. package/core/components/functional/if/if.js +6 -12
  16. package/core/components/functional/if/if.test.d.ts +1 -0
  17. package/core/components/functional/if/if.test.js +44 -0
  18. package/core/components/functional/list/list.d.ts +44 -12
  19. package/core/components/functional/list/list.js +54 -49
  20. package/core/components/functional/mix/mix.d.ts +22 -0
  21. package/core/components/functional/mix/mix.js +102 -0
  22. package/core/components/functional/queue/queue.d.ts +27 -5
  23. package/core/components/functional/queue/queue.js +88 -26
  24. package/core/components/functional/router/redirect.d.ts +11 -2
  25. package/core/components/functional/router/redirect.js +7 -12
  26. package/core/components/functional/router/router.d.ts +15 -1
  27. package/core/components/functional/router/router.js +11 -16
  28. package/core/components/functional/sdui/SDUIDescriptorTransformer.d.ts +1 -2
  29. package/core/components/functional/sdui/SDUIDescriptorTransformer.js +56 -45
  30. package/core/components/functional/sdui/default-library.json +108 -0
  31. package/core/components/functional/sdui/sdui-utils.d.ts +5 -0
  32. package/core/components/functional/sdui/sdui-utils.js +63 -0
  33. package/core/components/functional/sdui/sdui.d.ts +21 -13
  34. package/core/components/functional/sdui/sdui.js +70 -44
  35. package/core/components/functional/sdui/types.d.ts +10 -8
  36. package/core/components/functional/states/states.d.ts +20 -4
  37. package/core/components/functional/states/states.js +15 -20
  38. package/core/components/functional/submit/submit.d.ts +16 -1
  39. package/core/components/functional/submit/submit.js +95 -25
  40. package/core/components/functional/subscriber/subscriber.d.ts +4 -1
  41. package/core/components/functional/subscriber/subscriber.js +1 -6
  42. package/core/components/functional/value/value.d.ts +7 -0
  43. package/core/components/functional/value/value.js +26 -0
  44. package/core/components/ui/_css/scroll.js +6 -7
  45. package/core/components/ui/_css/size.d.ts +1 -0
  46. package/core/components/ui/_css/size.js +3 -1
  47. package/core/components/ui/alert/alert.d.ts +2 -2
  48. package/core/components/ui/alert/alert.js +11 -16
  49. package/core/components/ui/badge/badge.d.ts +3 -1
  50. package/core/components/ui/badge/badge.js +36 -22
  51. package/core/components/ui/button/button.d.ts +28 -23
  52. package/core/components/ui/button/button.js +60 -43
  53. package/core/components/ui/captcha/captcha.d.ts +14 -2
  54. package/core/components/ui/captcha/captcha.js +18 -13
  55. package/core/components/ui/card/card-footer.js +1 -8
  56. package/core/components/ui/card/card-header-descripton.js +3 -9
  57. package/core/components/ui/card/card-header.js +6 -7
  58. package/core/components/ui/card/card-main.js +0 -5
  59. package/core/components/ui/card/card.d.ts +1 -1
  60. package/core/components/ui/card/card.js +30 -12
  61. package/core/components/ui/divider/divider.d.ts +2 -0
  62. package/core/components/ui/divider/divider.js +43 -16
  63. package/core/components/ui/form/checkbox/checkbox.d.ts +86 -25
  64. package/core/components/ui/form/checkbox/checkbox.js +53 -28
  65. package/core/components/ui/form/css/form-control.d.ts +2 -0
  66. package/core/components/ui/form/css/form-control.js +145 -67
  67. package/core/components/ui/form/fieldset/fieldset.d.ts +8 -1
  68. package/core/components/ui/form/fieldset/fieldset.js +45 -8
  69. package/core/components/ui/form/fieldset/legend-description.js +0 -5
  70. package/core/components/ui/form/fieldset/legend.js +3 -6
  71. package/core/components/ui/form/form-actions/form-actions.d.ts +2 -0
  72. package/core/components/ui/form/form-actions/form-actions.js +26 -11
  73. package/core/components/ui/form/form-layout/form-layout.d.ts +5 -2
  74. package/core/components/ui/form/form-layout/form-layout.js +31 -9
  75. package/core/components/ui/form/input/input.d.ts +26 -24
  76. package/core/components/ui/form/input/input.js +87 -52
  77. package/core/components/ui/form/input/password-helper.d.ts +1 -1
  78. package/core/components/ui/form/input/password-helper.js +4 -3
  79. package/core/components/ui/form/input/same-value-helper.d.ts +1 -1
  80. package/core/components/ui/form/input/same-value-helper.js +3 -2
  81. package/core/components/ui/form/input-autocomplete/input-autocomplete.d.ts +2 -3
  82. package/core/components/ui/form/input-autocomplete/input-autocomplete.js +2 -6
  83. package/core/components/ui/form/radio/radio.d.ts +6 -0
  84. package/core/components/ui/form/radio/radio.js +7 -12
  85. package/core/components/ui/form/select/select.d.ts +25 -8
  86. package/core/components/ui/form/select/select.js +72 -41
  87. package/core/components/ui/form/textarea/textarea.d.ts +21 -19
  88. package/core/components/ui/form/textarea/textarea.js +29 -36
  89. package/core/components/ui/group/group.d.ts +11 -1
  90. package/core/components/ui/group/group.js +79 -17
  91. package/core/components/ui/icon/icon.d.ts +10 -3
  92. package/core/components/ui/icon/icon.js +16 -15
  93. package/core/components/ui/icon/icons.js +25 -20
  94. package/core/components/ui/icon/icons.json +1 -1
  95. package/core/components/ui/image/image.js +0 -5
  96. package/core/components/ui/link/link.d.ts +1 -1
  97. package/core/components/ui/link/link.js +2 -6
  98. package/core/components/ui/loader/loader.d.ts +1 -1
  99. package/core/components/ui/loader/loader.js +3 -9
  100. package/core/components/ui/menu/menu-item.js +4 -9
  101. package/core/components/ui/menu/menu.d.ts +9 -1
  102. package/core/components/ui/menu/menu.js +182 -27
  103. package/core/components/ui/modal/modal-actions.js +1 -6
  104. package/core/components/ui/modal/modal-close.d.ts +1 -0
  105. package/core/components/ui/modal/modal-close.js +14 -10
  106. package/core/components/ui/modal/modal-content.js +0 -5
  107. package/core/components/ui/modal/modal-subtitle.js +2 -6
  108. package/core/components/ui/modal/modal-title.js +0 -5
  109. package/core/components/ui/modal/modal.d.ts +7 -7
  110. package/core/components/ui/modal/modal.js +37 -37
  111. package/core/components/ui/pop/pop.d.ts +6 -5
  112. package/core/components/ui/pop/pop.js +57 -57
  113. package/core/components/ui/progress/progress.js +34 -32
  114. package/core/components/ui/table/table-caption.js +5 -10
  115. package/core/components/ui/table/table-tbody.js +10 -14
  116. package/core/components/ui/table/table-td.d.ts +2 -0
  117. package/core/components/ui/table/table-td.js +8 -5
  118. package/core/components/ui/table/table-tfoot.js +5 -7
  119. package/core/components/ui/table/table-th.d.ts +2 -0
  120. package/core/components/ui/table/table-th.js +12 -9
  121. package/core/components/ui/table/table-thead.js +1 -6
  122. package/core/components/ui/table/table-tr.js +4 -6
  123. package/core/components/ui/table/table.d.ts +0 -3
  124. package/core/components/ui/table/table.js +14 -31
  125. package/core/components/ui/theme/theme-collection/core-variables.js +13 -11
  126. package/core/components/ui/theme/theme-collection/dark.js +1 -1
  127. package/core/components/ui/theme/theme.d.ts +1 -6
  128. package/core/components/ui/theme/theme.js +19 -46
  129. package/core/components/ui/toast/message-subscriber.d.ts +16 -7
  130. package/core/components/ui/toast/message-subscriber.js +10 -8
  131. package/core/components/ui/toast/toast-item.js +1 -1
  132. package/core/components/ui/toast/toast.d.ts +3 -2
  133. package/core/components/ui/toast/toast.js +33 -19
  134. package/core/components/ui/toast/types.d.ts +3 -2
  135. package/core/components/ui/tooltip/tooltip.d.ts +1 -0
  136. package/core/components/ui/tooltip/tooltip.js +36 -15
  137. package/core/components/ui/ui.d.ts +1 -1
  138. package/core/components/ui/ui.js +1 -4
  139. package/core/core.js +5 -6
  140. package/core/mixins/Fetcher.d.ts +20 -13
  141. package/core/mixins/Fetcher.js +44 -19
  142. package/core/mixins/FormCheckable.d.ts +25 -13
  143. package/core/mixins/FormCheckable.js +180 -23
  144. package/core/mixins/FormElement.d.ts +17 -9
  145. package/core/mixins/FormElement.js +56 -39
  146. package/core/mixins/FormInput.d.ts +22 -12
  147. package/core/mixins/FormInput.js +4 -3
  148. package/core/mixins/Subscriber.d.ts +12 -8
  149. package/core/mixins/Subscriber.js +51 -48
  150. package/core/mixins/TemplatesContainer.d.ts +2 -1
  151. package/core/mixins/TemplatesContainer.js +2 -2
  152. package/core/utils/Arrays.d.ts +15 -15
  153. package/core/utils/Arrays.js +12 -9
  154. package/core/utils/DataBindObserver.d.ts +18 -11
  155. package/core/utils/DataBindObserver.js +47 -54
  156. package/core/utils/Electron.d.ts +5 -1
  157. package/core/utils/Electron.js +4 -2
  158. package/core/utils/HTML.d.ts +9 -2
  159. package/core/utils/HTML.js +24 -5
  160. package/core/utils/LocationHandler.d.ts +6 -5
  161. package/core/utils/LocationHandler.js +27 -16
  162. package/core/utils/Objects.d.ts +7 -4
  163. package/core/utils/Objects.js +37 -9
  164. package/core/utils/{PublisherProxy.d.mts → PublisherProxy.d.ts} +49 -34
  165. package/core/utils/{PublisherProxy.mjs → PublisherProxy.js} +107 -77
  166. package/core/utils/Utils.d.ts +3 -0
  167. package/core/utils/Utils.js +18 -0
  168. package/core/utils/api.d.ts +26 -9
  169. package/core/utils/api.js +62 -45
  170. package/img/concorde-logo.svg +1 -0
  171. package/img/concorde.png +0 -0
  172. package/img/concorde_def.png +0 -0
  173. package/mixins.d.ts +53 -29
  174. package/mixins.js +3 -4
  175. package/package.json +51 -12
  176. package/svg/regular/plane.svg +1 -0
  177. package/svg/solid/plane.svg +1 -0
  178. package/test-utils/TestUtils.d.ts +4 -0
  179. package/test-utils/TestUtils.js +12 -0
  180. package/utils.d.ts +3 -1
  181. package/utils.js +7 -5
  182. package/core/components/functional/configuration/configuration.d.ts +0 -5
  183. package/core/components/functional/configuration/configuration.js +0 -22
  184. package/core/components/ui/tabs/tab.d.ts +0 -6
  185. package/core/components/ui/tabs/tab.js +0 -46
  186. package/core/components/ui/tabs/tabs.d.ts +0 -15
  187. package/core/components/ui/tabs/tabs.js +0 -129
  188. package/core/components/ui/taxonomy/taxonomy.d.ts +0 -41
  189. package/core/components/ui/taxonomy/taxonomy.js +0 -115
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { PublisherManager } from "@supersoniks/concorde/core/utils/PublisherProxy.mjs";
7
+ import { PublisherManager } from "@supersoniks/concorde/core/utils/PublisherProxy";
8
8
  import { property } from "lit/decorators.js";
9
9
  import Objects from "@supersoniks/concorde/core/utils/Objects";
10
10
  const keyboardLoops = new Map();
@@ -26,9 +26,6 @@ const Form = (superClass) => {
26
26
  this.required = false;
27
27
  this.forceAutoFill = false;
28
28
  this.disabled = null;
29
- this.onValueAssign = null;
30
- this.onFormValueAssign = null;
31
- this.onFormDataInValidate = null;
32
29
  this.formDataProvider = "";
33
30
  /**
34
31
  * Le nom du champ avec des caractéristiques similaire à un input html classique.
@@ -46,7 +43,8 @@ const Form = (superClass) => {
46
43
  this.setFormValueFromPublisher(value);
47
44
  };
48
45
  this.onFormDataInValidate = () => {
49
- if (!this.getFormPublisher().isFormValid.get()) {
46
+ const formPublisher = this.getFormPublisher();
47
+ if (!(formPublisher && formPublisher.isFormValid.get())) {
50
48
  return;
51
49
  }
52
50
  this.validateFormElement();
@@ -61,25 +59,27 @@ const Form = (superClass) => {
61
59
  this._name = value;
62
60
  this.requestUpdate();
63
61
  }
64
- validateFormElement() { }
62
+ validateFormElement() {
63
+ //Implémentation dans une sous classe
64
+ }
65
65
  updateDataValue() {
66
- if (this._name) {
67
- let formPublisher = this.getFormPublisher();
66
+ const name = this.getAttribute("name");
67
+ if (name) {
68
+ const formPublisher = this.getFormPublisher();
68
69
  if (formPublisher) {
69
- formPublisher[this._name] = this.getValueForFormPublisher();
70
- this.setFormValueFromPublisher(formPublisher[this.name].get());
70
+ formPublisher[name] = this.getValueForFormPublisher();
71
+ this.setFormValueFromPublisher(formPublisher[name].get());
71
72
  }
72
73
  }
73
74
  }
74
75
  getFormPublisher() {
75
- if (!this.formDataProvider) {
76
+ if (!this.formDataProvider)
76
77
  this.formDataProvider = this.getAncestorAttributeValue("formDataProvider");
77
- }
78
78
  if (this.formDataProvider) {
79
79
  return PublisherManager.get(this.formDataProvider);
80
80
  }
81
- else
82
- return this.publisher;
81
+ return null;
82
+ //else return this.publisher;
83
83
  }
84
84
  /**
85
85
  * Mise en forme de la valeur fournie au formPublisher associé au composant
@@ -106,10 +106,12 @@ const Form = (superClass) => {
106
106
  return this._value;
107
107
  }
108
108
  set value(value) {
109
- if (Objects.isObject(value) && value.hasOwnProperty("__value") && value.value == undefined)
110
- return;
111
109
  if (value == null)
112
- return;
110
+ value = "";
111
+ if (Objects.isObject(value) &&
112
+ Object.prototype.hasOwnProperty.call(value, "__value") &&
113
+ value._value == undefined)
114
+ value = "";
113
115
  if (this._value == value)
114
116
  return;
115
117
  this._value = value;
@@ -117,9 +119,12 @@ const Form = (superClass) => {
117
119
  this.requestUpdate();
118
120
  }
119
121
  initPublisher() {
122
+ let formPublisher = this.getFormPublisher();
123
+ const value = this.hasAncestorAttribute("initFromPublisher") && this._name && formPublisher[this._name].get()
124
+ ? formPublisher[this._name].get()
125
+ : this.getAttribute("value");
120
126
  if (this._name && this.publisher)
121
127
  this.publisher[this._name].offAssign(this.onValueAssign);
122
- let formPublisher = this.getFormPublisher();
123
128
  if (this._name && formPublisher)
124
129
  formPublisher[this._name].offAssign(this.onFormValueAssign);
125
130
  super.initPublisher();
@@ -127,15 +132,17 @@ const Form = (superClass) => {
127
132
  this._name = this.getAttribute("name");
128
133
  if (!this.value)
129
134
  this._value = this.getAttribute("value");
130
- this.updateDataValue();
131
135
  if (this.publisher && this._name) {
132
136
  this.publisher[this._name].onAssign(this.onValueAssign);
133
137
  }
134
138
  formPublisher = this.getFormPublisher();
135
139
  if (this._name && formPublisher) {
136
140
  formPublisher[this._name].onAssign(this.onFormValueAssign);
137
- formPublisher.onInvalidate((this.onFormDataInValidate));
141
+ formPublisher.onInvalidate(this.onFormDataInValidate);
138
142
  }
143
+ this.updateDataValue();
144
+ if (value)
145
+ this.value = value;
139
146
  }
140
147
  handleBlur() {
141
148
  this.touched = true;
@@ -154,32 +161,35 @@ const Form = (superClass) => {
154
161
  * En appuyant sur la touche "Up", le déplacement inverse est effectué.
155
162
  */
156
163
  addKeyboardNavigation() {
157
- let keyboardLoopIds = this.getAncestorAttributeValue("data-keyboard-nav");
164
+ const keyboardLoopIds = this.getAncestorAttributeValue("data-keyboard-nav");
158
165
  if (!keyboardLoopIds)
159
166
  return;
160
- let split = keyboardLoopIds.split(" ");
161
- let keyboardLoopId = split[0];
167
+ const split = keyboardLoopIds.split(" ");
168
+ const keyboardLoopId = split[0];
162
169
  if (!keyboardLoopId)
163
170
  return;
164
- for (let keyboardLoopId2 of split) {
171
+ for (const keyboardLoopId2 of split) {
165
172
  if (!keyboardLoops.has(keyboardLoopId2)) {
166
173
  keyboardLoops.set(keyboardLoopId2, []);
167
174
  }
168
- let keyboardLoop = keyboardLoops.get(keyboardLoopId2);
169
- if (keyboardLoop.indexOf(this) == -1) {
175
+ const keyboardLoop = keyboardLoops.get(keyboardLoopId2);
176
+ if ((keyboardLoop === null || keyboardLoop === void 0 ? void 0 : keyboardLoop.indexOf(this)) == -1) {
170
177
  keyboardLoop.push(this);
171
178
  }
172
179
  }
173
- let keyboardLoop = keyboardLoops.get(keyboardLoopId);
180
+ const keyboardLoop = keyboardLoops.get(keyboardLoopId);
174
181
  this.addEventListener("keydown", (e) => {
175
- if (!["ArrowDown", "ArrowUp"].includes(e.key))
182
+ var _a;
183
+ const keyboardEvent = e;
184
+ if (!["ArrowDown", "ArrowUp"].includes(keyboardEvent.key))
176
185
  return;
177
- let selector = "input:not([disabled]), button:not([disabled]), select:not([disabled]), textarea:not([disabled])";
178
- let loop = keyboardLoop.filter((el) => {
179
- let child = el.shadowRoot.querySelector(selector);
186
+ const selector = "input:not([disabled]), button:not([disabled]), select:not([disabled]), textarea:not([disabled])";
187
+ const loop = keyboardLoop === null || keyboardLoop === void 0 ? void 0 : keyboardLoop.filter((el) => {
188
+ var _a;
189
+ const child = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(selector);
180
190
  if (!child)
181
191
  return false;
182
- let cpStyle = window.getComputedStyle(child);
192
+ const cpStyle = window.getComputedStyle(child);
183
193
  return (cpStyle.display !== "none" &&
184
194
  cpStyle.display !== "" &&
185
195
  cpStyle.pointerEvents != "none" &&
@@ -187,8 +197,8 @@ const Form = (superClass) => {
187
197
  child.getBoundingClientRect().width > 0);
188
198
  });
189
199
  let next = null;
190
- if (e.key == "ArrowDown") {
191
- let index = loop.indexOf(this);
200
+ if (keyboardEvent.key == "ArrowDown" && loop) {
201
+ const index = loop.indexOf(this);
192
202
  if (index == loop.length - 1) {
193
203
  next = loop[0];
194
204
  }
@@ -196,8 +206,8 @@ const Form = (superClass) => {
196
206
  next = loop[index + 1];
197
207
  }
198
208
  }
199
- else if (e.key == "ArrowUp") {
200
- let index = loop.indexOf(this);
209
+ else if (keyboardEvent.key == "ArrowUp" && loop) {
210
+ const index = loop.indexOf(this);
201
211
  if (index == 0) {
202
212
  next = loop[loop.length - 1];
203
213
  }
@@ -205,14 +215,15 @@ const Form = (superClass) => {
205
215
  next = loop[index - 1];
206
216
  }
207
217
  }
208
- let elt = next.shadowRoot.querySelector(selector);
209
- if (elt) {
218
+ const elt = (_a = next === null || next === void 0 ? void 0 : next.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(selector);
219
+ if (elt && elt.focus) {
210
220
  elt.focus();
211
221
  e.preventDefault();
212
222
  }
213
223
  });
214
224
  }
215
225
  connectedCallback() {
226
+ this.formDataProvider = this.getAncestorAttributeValue("formDataProvider");
216
227
  super.connectedCallback();
217
228
  this.addKeyboardNavigation();
218
229
  }
@@ -220,7 +231,7 @@ const Form = (superClass) => {
220
231
  super.disconnectedCallback();
221
232
  if (this._name && this.publisher)
222
233
  this.publisher[this._name].offAssign(this.onValueAssign);
223
- let formPublisher = this.getFormPublisher();
234
+ const formPublisher = this.getFormPublisher();
224
235
  if (this._name && formPublisher) {
225
236
  formPublisher[this._name].offAssign(this.onFormValueAssign);
226
237
  formPublisher.offInvalidate(this.onFormDataInValidate);
@@ -245,6 +256,12 @@ const Form = (superClass) => {
245
256
  __decorate([
246
257
  property({ type: Boolean })
247
258
  ], FormElement.prototype, "disabled", void 0);
259
+ __decorate([
260
+ property({ type: String, attribute: "data-aria-label" })
261
+ ], FormElement.prototype, "ariaLabel", void 0);
262
+ __decorate([
263
+ property({ type: String, attribute: "data-aria-labelledby" })
264
+ ], FormElement.prototype, "ariaLabelledby", void 0);
248
265
  __decorate([
249
266
  property()
250
267
  ], FormElement.prototype, "name", null);
@@ -1,8 +1,9 @@
1
1
  import { FormElementInterface } from "@supersoniks/concorde/core/mixins/FormElement";
2
- declare type Constructor<T> = new (...args: any[]) => T;
3
- declare type Type = "button" | "checkbox" | "color" | "date" | "datetime-local" | "email" | "file" | "hidden" | "image" | "month" | "number" | "password" | "radio" | "range" | "reset" | "search" | "submit" | "tel" | "text" | "time" | "url" | "week";
2
+ import { MixinArgsType } from "../_types/types";
3
+ type Constructor<T> = new (...args: MixinArgsType[]) => T;
4
+ type Type = "button" | "checkbox" | "color" | "date" | "datetime-local" | "email" | "file" | "hidden" | "image" | "month" | "number" | "password" | "radio" | "range" | "reset" | "search" | "submit" | "tel" | "text" | "time" | "url" | "week";
4
5
  declare const Form: <T extends Constructor<FormElementInterface>>(superClass: T) => {
5
- new (...args: any[]): {
6
+ new (...args: MixinArgsType[]): {
6
7
  validateFormElement(): void;
7
8
  forceAutoFill: boolean;
8
9
  /**
@@ -19,23 +20,32 @@ declare const Form: <T extends Constructor<FormElementInterface>>(superClass: T)
19
20
  autocomplete?: "url" | "name" | "language" | "on" | "tel" | "email" | "honorific-prefix" | "given-name" | "additional-name" | "family-name" | "honorific-suffix" | "nickname" | "username" | "new-password" | "current-password" | "one-time-code" | "organization-title" | "organization" | "street-address" | "address-line1" | "address-line2" | "address-line3" | "address-level4" | "address-level3" | "address-level2" | "address-level1" | "country" | "country-name" | "postal-code" | "cc-name" | "cc-given-name" | "cc-additional-name" | "cc-family-name" | "cc-number" | "cc-exp" | "cc-exp-month" | "cc-exp-year" | "cc-csc" | "cc-type" | "transaction-currency" | "transaction-amount" | "bday" | "bday-day" | "bday-month" | "bday-year" | "sex" | "tel-country-code" | "tel-national" | "tel-area-code" | "tel-local" | "tel-extension" | "impp" | "photo" | undefined;
20
21
  getFormPublisher(): any;
21
22
  updateDataValue(): void;
22
- handleChange(e?: any): void;
23
- handleBlur(e?: any): void;
24
- getValueForFormPublisher(): any;
23
+ handleChange(e?: Event | undefined): void;
24
+ handleBlur(e?: Event | undefined): void;
25
+ getValueForFormPublisher(): string | object | string[] | null | undefined;
26
+ focus?: (() => void) | undefined;
27
+ shadowRoot?: ShadowRoot | undefined;
25
28
  error: boolean;
26
29
  autofocus: boolean;
27
30
  required: boolean;
28
31
  disabled: true | null;
29
32
  formDataProvider: string;
30
- _value: any;
31
- value: any;
33
+ ariaLabelledby?: string | undefined;
34
+ ariaLabel?: string | undefined;
35
+ _value: string | object | string[] | null | undefined;
36
+ value: string | object | string[] | null | undefined;
32
37
  _name: string;
33
38
  name: string;
34
- props: any;
35
- propertyMap: Object;
39
+ props: import("../_types/types").CoreJSType;
40
+ propertyMap: object;
36
41
  isConnected: boolean;
42
+ children: HTMLCollection;
43
+ appendChild(node: Node): Node;
37
44
  getAncestorAttributeValue(attributeName: string): string;
38
- hasAncestorAttribute(attributeName: string): boolean;
45
+ hasAncestorAttribute(attributeName: string): boolean; /**
46
+ * Le type De l'input, comme en html cependant tous les types ne sont pas actuellements compatibles en raison du style en vigueur
47
+ * On peut essayer text, date, color, email par exemple, mais pas radio/checkbox/range a priori
48
+ */
39
49
  querySelectorAll(selector: string): NodeListOf<Element>;
40
50
  publisher: any;
41
51
  dataProvider: string | null;
@@ -53,7 +63,7 @@ declare const Form: <T extends Constructor<FormElementInterface>>(superClass: T)
53
63
  connectedCallback(): void;
54
64
  requestUpdate(): void;
55
65
  getAttribute(name: string): string;
56
- hasAttribute(attributeName: String): boolean;
66
+ hasAttribute(attributeName: string): boolean;
57
67
  disconnectedCallback(): void;
58
68
  };
59
69
  } & T;
@@ -19,11 +19,12 @@ const Form = (superClass) => {
19
19
  }
20
20
  validateFormElement() {
21
21
  var _a;
22
- const that = this;
23
- const input = (_a = that.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector("input");
22
+ const input = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector("input");
24
23
  if (!input || input.checkValidity())
25
24
  return;
26
- this.getFormPublisher().isFormValid = false;
25
+ const formPublisher = this.getFormPublisher();
26
+ if (formPublisher)
27
+ formPublisher.isFormValid = false;
27
28
  input.reportValidity();
28
29
  }
29
30
  set type(value) {
@@ -1,19 +1,23 @@
1
- import { LitElement } from "lit";
2
1
  import { APIConfiguration } from "@supersoniks/concorde/core/utils/api";
3
- declare type Constructor<T> = new (...args: any[]) => T;
4
- export interface SubscriberInterface {
5
- props: any;
6
- propertyMap: Object;
2
+ import { LitElement } from "lit";
3
+ import { PublisherInterface, TypeAndRecordOfType, MixinArgsType, CoreJSType } from "@supersoniks/concorde/core/_types/types";
4
+ type Constructor<T> = new (...args: MixinArgsType[]) => T;
5
+ export interface SubscriberInterface<PropsType = CoreJSType> {
6
+ props: PropsType | null;
7
+ propertyMap: object;
7
8
  isConnected: boolean;
9
+ children: HTMLCollection;
10
+ appendChild(node: Node): Node;
8
11
  getAncestorAttributeValue(attributeName: string): string;
9
12
  hasAncestorAttribute(attributeName: string): boolean;
10
13
  querySelectorAll(selector: string): NodeListOf<Element>;
11
- publisher: any;
14
+ publisher: TypeAndRecordOfType<PublisherInterface<PropsType>>;
12
15
  dataProvider: string | null;
13
16
  noShadowDom: string | null;
14
17
  debug: HTMLElement | null;
15
18
  defferedDebug: boolean | null;
16
19
  displayContents: boolean;
20
+ shadowRoot?: ShadowRoot;
17
21
  dispatchEvent(event: Event): void;
18
22
  setAttribute(name: string, value: string): void;
19
23
  addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
@@ -24,8 +28,8 @@ export interface SubscriberInterface {
24
28
  connectedCallback(): void;
25
29
  requestUpdate(): void;
26
30
  getAttribute(name: string): string;
27
- hasAttribute(attributeName: String): boolean;
31
+ hasAttribute(attributeName: string): boolean;
28
32
  disconnectedCallback(): void;
29
33
  }
30
- declare const Subscriber: <T extends Constructor<LitElement>>(superClass: T) => Constructor<SubscriberInterface> & T;
34
+ declare const Subscriber: <PropsType = CoreJSType, T extends Constructor<LitElement> = Constructor<LitElement>>(superClass: T, type?: PropsType | undefined) => Constructor<SubscriberInterface<PropsType>> & T;
31
35
  export default Subscriber;
@@ -13,12 +13,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
13
13
  step((generator = generator.apply(thisArg, _arguments || [])).next());
14
14
  });
15
15
  };
16
- import { PublisherManager } from "@supersoniks/concorde/core/utils/PublisherProxy.mjs";
17
- import { property } from "lit/decorators.js";
18
16
  import API from "@supersoniks/concorde/core/utils/api";
19
- import HTML from "@supersoniks/concorde/core/utils/HTML";
20
17
  import DataBindObserver from "@supersoniks/concorde/core/utils/DataBindObserver";
18
+ import HTML from "@supersoniks/concorde/core/utils/HTML";
21
19
  import Objects from "@supersoniks/concorde/core/utils/Objects";
20
+ import { PublisherManager } from "@supersoniks/concorde/core/utils/PublisherProxy";
21
+ import { property } from "lit/decorators.js";
22
22
  let keepDebugOnMouseOut = false;
23
23
  let debugs = new Set();
24
24
  //Pour référence
@@ -36,13 +36,14 @@ let debugs = new Set();
36
36
  // return this.shadowRoot || this;
37
37
  // }
38
38
  // }
39
- const Subscriber = (superClass) => {
39
+ const Subscriber = (superClass, type) => {
40
40
  /**
41
41
  * La mixin Subscriber permet lier un composant à un publisher.
42
42
  * La liaison à un publisher se fait via l'attribut *dataProvider* du composant qui représente ce que l'on obtient en appellant PublisherManager.get(dataProvider).
43
43
  * les propriétés du composant sont automatiquement remplies avec les propriétés du même nom dans les données du publisher.
44
44
  * Le composant est automatiquement mis à jour lorsque les données du publisher sont mises à jour.
45
45
  */
46
+ type;
46
47
  class SubscriberElement extends superClass {
47
48
  constructor(...args) {
48
49
  super();
@@ -90,8 +91,10 @@ const Subscriber = (superClass) => {
90
91
  /**
91
92
  * On assign est enregistré car c'est un écouteur du publisher qui doit être délié lorsque l'objet est déconnecté du dom.
92
93
  */
93
- this.onAssign = null;
94
- this.args = args;
94
+ this.onAssign = (v) => {
95
+ this.props = v;
96
+ };
97
+ args;
95
98
  }
96
99
  /**
97
100
  * va de parent en parent pour trouver un attribut
@@ -107,11 +110,10 @@ const Subscriber = (superClass) => {
107
110
  * @returns valeur de l'attribut ou null si l'attribut n'est pas trouvé
108
111
  */
109
112
  getAncestorAttributeValue(attributeName) {
110
- let node = this;
111
- return HTML.getAncestorAttributeValue(node, attributeName);
113
+ return HTML.getAncestorAttributeValue(this, attributeName);
112
114
  }
113
115
  get props() {
114
- if (!this.publisher)
116
+ if (this._props !== null || !this.publisher)
115
117
  return this._props;
116
118
  return this.publisher.get();
117
119
  }
@@ -119,12 +121,11 @@ const Subscriber = (superClass) => {
119
121
  if (typeof value == "string" && ["{", "["].includes(value.trim().charAt(0))) {
120
122
  value = JSON.parse(value);
121
123
  }
122
- if (value == null || value === "")
123
- value = {};
124
- if (!this.publisher)
125
- this.initPublisher();
124
+ if (value == this._props)
125
+ return;
126
126
  this._props = value;
127
- if (this.publisher) {
127
+ // if (!this.publisher) this.initPublisher();
128
+ if (this.publisher && this.publisher.get() != value) {
128
129
  this.publisher.set(value);
129
130
  }
130
131
  this.requestUpdate();
@@ -132,7 +133,8 @@ const Subscriber = (superClass) => {
132
133
  updated(_changedProperties) {
133
134
  super.updated(_changedProperties);
134
135
  let ref = this.shadowRoot || this;
135
- let display = this.displayContents ? "contents" : ref.children.length == 0 ? "none" : null;
136
+ const children = [...ref.children].filter((child) => child.tagName != "STYLE");
137
+ let display = this.displayContents ? "contents" : children.length == 0 ? "none" : null;
136
138
  if (display)
137
139
  this.style.display = display;
138
140
  else
@@ -140,12 +142,12 @@ const Subscriber = (superClass) => {
140
142
  }
141
143
  connectedCallback() {
142
144
  if (this.hasAttribute("lazyRendering")) {
143
- let options = {
145
+ const options = {
144
146
  root: null,
145
147
  rootMargin: Math.max(window.innerWidth * 0.1, window.innerHeight * 0.1) + "px",
146
148
  };
147
149
  let firstView = true;
148
- let iObserver = new IntersectionObserver((entries) => {
150
+ const iObserver = new IntersectionObserver((entries) => {
149
151
  for (const e of entries) {
150
152
  if (firstView && e.isIntersecting) {
151
153
  firstView = false;
@@ -165,22 +167,24 @@ const Subscriber = (superClass) => {
165
167
  SubscriberElement.instanceCounter++;
166
168
  }
167
169
  disconnectedCallback() {
170
+ var _a;
168
171
  this.removeDebugger();
169
172
  super.disconnectedCallback();
170
173
  if (this.publisher) {
171
174
  this.publisher.stopTemplateFilling(this);
172
- this.publisher.offInternalMutation(this.requestUpdate());
175
+ this.publisher.offInternalMutation(this.requestUpdate);
173
176
  }
174
177
  if (this.wordingPublisher)
175
178
  this.wordingPublisher.stopTemplateFilling(this);
176
179
  if (this.onAssign)
177
- this.publisher.offAssign(this.onAssign);
180
+ (_a = this.publisher) === null || _a === void 0 ? void 0 : _a.offAssign(this.onAssign);
178
181
  }
179
182
  addDebugger() {
183
+ var _a;
180
184
  if (this.hasAttribute("debug") && !this.defferedDebug) {
181
185
  if (!this.debug) {
182
186
  this.debug = document.createElement("div");
183
- let style = this.debug.style;
187
+ const style = this.debug.style;
184
188
  style.position = "fixed";
185
189
  style.top = "0";
186
190
  style.right = "0";
@@ -195,10 +199,11 @@ const Subscriber = (superClass) => {
195
199
  style.zIndex = "99999999";
196
200
  style.maxHeight = "calc(100vh - 32px)";
197
201
  style.fontFamily = "Consolas, monospace";
198
- style.maxWidth = "50vw";
202
+ style.maxWidth = "min(50vw,25rem)";
199
203
  style.fontSize = "12px";
200
204
  style.minWidth = "300px";
201
205
  style.overflowWrap = "break-word";
206
+ style.resize = "vertical";
202
207
  }
203
208
  this.addEventListener("click", (e) => {
204
209
  if (!e.ctrlKey)
@@ -207,8 +212,7 @@ const Subscriber = (superClass) => {
207
212
  keepDebugOnMouseOut = !keepDebugOnMouseOut;
208
213
  });
209
214
  if (this.dataProvider) {
210
- let win = window;
211
- win[this.dataProvider] = this.publisher;
215
+ window[this.dataProvider] = this.publisher;
212
216
  }
213
217
  this.addEventListener("mouseover", () => {
214
218
  if (!keepDebugOnMouseOut)
@@ -220,13 +224,14 @@ const Subscriber = (superClass) => {
220
224
  if (!keepDebugOnMouseOut)
221
225
  this.removeDebugger();
222
226
  });
223
- this.publisher.onInternalMutation(() => {
227
+ (_a = this.publisher) === null || _a === void 0 ? void 0 : _a.onInternalMutation(() => {
228
+ var _a;
224
229
  this.debug.innerHTML = `🤖 DataProvider : "<b style="font-weight:bold;color:#fff;">${this.dataProvider}</b>"<br>
225
230
  <div style="font-size:10px;border-top:1px dashed;margin-top:5px;padding-left:23px;opacity:.6;padding-top:5px;">
226
231
  Variable disponible dans la console<br>
227
232
  ctrl + Clique : épingler / désépingler
228
233
  </div>
229
- <pre style="margin-top:10px;background:transparent;padding:0;font-size:inherit;color:inherit;">${JSON.stringify(this.publisher.get(), null, " ")}</pre>`;
234
+ <pre style="margin-top:10px;background:transparent;padding:0;font-size:inherit;color:inherit;">${JSON.stringify((_a = this.publisher) === null || _a === void 0 ? void 0 : _a.get(), null, " ")}</pre>`;
230
235
  });
231
236
  }
232
237
  }
@@ -244,7 +249,8 @@ const Subscriber = (superClass) => {
244
249
  */
245
250
  getApiConfiguration() {
246
251
  const token = this.getAncestorAttributeValue("token");
247
- let serviceURL = this.getAncestorAttributeValue("serviceURL");
252
+ const addHTTPResponse = this.getAncestorAttributeValue("addHTTPResponse") != null;
253
+ const serviceURL = this.getAncestorAttributeValue("serviceURL");
248
254
  let userName = null;
249
255
  let password = null;
250
256
  let tokenProvider = null;
@@ -253,13 +259,14 @@ const Subscriber = (superClass) => {
253
259
  password = this.getAncestorAttributeValue("password");
254
260
  tokenProvider = this.getAncestorAttributeValue("tokenProvider");
255
261
  }
256
- return { serviceURL, token, userName, password, tokenProvider };
262
+ const credentials = this.getAncestorAttributeValue("credentials") || undefined;
263
+ return { serviceURL, token, userName, password, tokenProvider, addHTTPResponse, credentials };
257
264
  }
258
265
  initWording() {
259
266
  return __awaiter(this, void 0, void 0, function* () {
260
267
  let hasWording = false;
261
268
  const propNames = Object.getOwnPropertyNames(this.constructor.prototype);
262
- for (let p of propNames) {
269
+ for (const p of propNames) {
263
270
  if (p.indexOf("wording_") == 0) {
264
271
  hasWording = true;
265
272
  break;
@@ -267,15 +274,15 @@ const Subscriber = (superClass) => {
267
274
  }
268
275
  if (!hasWording)
269
276
  return;
270
- let publisher = PublisherManager.getInstance().get("sonic-wording");
271
- let wordingProvider = this.getAncestorAttributeValue("wordingProvider");
277
+ const publisher = PublisherManager.getInstance().get("sonic-wording");
278
+ const wordingProvider = this.getAncestorAttributeValue("wordingProvider");
272
279
  const api = new API(this.getApiConfiguration());
273
280
  if (wordingProvider) {
274
- let wordings = [];
275
- let wordingsAll = [];
276
- for (let p of propNames) {
281
+ const wordings = [];
282
+ const wordingsAll = [];
283
+ for (const p of propNames) {
277
284
  if (p.indexOf("wording_") == 0) {
278
- let p8 = p.substring(8);
285
+ const p8 = p.substring(8);
279
286
  if (!publisher.get()[p]) {
280
287
  publisher[p] = "...";
281
288
  wordings.push(p8);
@@ -284,8 +291,8 @@ const Subscriber = (superClass) => {
284
291
  }
285
292
  }
286
293
  if (wordings.length > 0) {
287
- let result = yield api.post(wordingProvider, { labels: wordings });
288
- for (let elt in result) {
294
+ const result = (yield api.post(wordingProvider, { labels: wordings }));
295
+ for (const elt in result) {
289
296
  publisher["wording_" + elt] = result[elt];
290
297
  }
291
298
  }
@@ -303,7 +310,7 @@ const Subscriber = (superClass) => {
303
310
  if (this.noShadowDom === "" || this.getAttribute("noShadowDom") === "") {
304
311
  return this;
305
312
  }
306
- let shadowRoot = super.createRenderRoot();
313
+ const shadowRoot = super.createRenderRoot();
307
314
  DataBindObserver.observe(shadowRoot);
308
315
  return shadowRoot;
309
316
  }
@@ -330,7 +337,7 @@ const Subscriber = (superClass) => {
330
337
  let pub = mng.get(publisherId);
331
338
  this.dataProvider = publisherId;
332
339
  if (this.hasAttribute("subDataProvider")) {
333
- let dataPath = this.getAttribute("subDataProvider");
340
+ const dataPath = this.getAttribute("subDataProvider");
334
341
  this.dataProvider = publisherId + "/" + dataPath;
335
342
  pub = Objects.traverse(pub, dataPath.split("."));
336
343
  mng.set(this.dataProvider, pub);
@@ -339,17 +346,14 @@ const Subscriber = (superClass) => {
339
346
  this.publisher = pub;
340
347
  }
341
348
  if (this.publisher) {
342
- this.onAssign = () => {
343
- this.requestUpdate();
344
- };
345
- this.publisher.onAssign(this.onAssign);
349
+ if (this._props) {
350
+ this.publisher.set(this._props);
351
+ }
346
352
  if (!this.noAutoFill)
347
353
  this.publisher.startTemplateFilling(this);
348
354
  if (this.renderOnPropsInternalChange)
349
355
  this.publisher.onInternalMutation(this.requestUpdate);
350
- if (this._props) {
351
- this.publisher.set(this._props);
352
- }
356
+ this.publisher.onAssign(this.onAssign);
353
357
  }
354
358
  }
355
359
  }
@@ -381,6 +385,5 @@ const Subscriber = (superClass) => {
381
385
  return SubscriberElement;
382
386
  };
383
387
  export default Subscriber;
384
- let win = window;
385
- if (!win.SonicPublisherManager)
386
- win.SonicPublisherManager = PublisherManager;
388
+ if (!window.SonicPublisherManager)
389
+ window.SonicPublisherManager = PublisherManager;
@@ -1,5 +1,6 @@
1
1
  import { LitElement } from "lit";
2
- declare type Constructor<T> = new (...args: any[]) => T;
2
+ import { MixinArgsType } from "../_types/types";
3
+ type Constructor<T> = new (...args: MixinArgsType[]) => T;
3
4
  export declare class TemplatesContainerInterface extends LitElement {
4
5
  connectedCallback(): void;
5
6
  templateParts: Record<string, HTMLTemplateElement>;
@@ -39,8 +39,8 @@ const TemplatesContainer = (superClass) => {
39
39
  this.templatePartsList = [];
40
40
  }
41
41
  connectedCallback() {
42
- let templates = this.templates || [...this.querySelectorAll("template")];
43
- for (let t of templates) {
42
+ const templates = this.templates || [...this.querySelectorAll("template")];
43
+ for (const t of templates) {
44
44
  if (t.hasAttribute(this.templateValueAttribute)) {
45
45
  this.templateParts[t.getAttribute(this.templateValueAttribute)] = t;
46
46
  this.templatePartsList.push(t);