@supersoniks/concorde 1.1.41 → 1.1.43

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 (234) hide show
  1. package/README.md +0 -0
  2. package/cli.js +0 -0
  3. package/components.d.ts +0 -0
  4. package/components.js +2 -3
  5. package/concorde-core.bundle.js +37 -42
  6. package/concorde-core.es.js +5702 -4823
  7. package/core/_types/types.d.ts +26 -0
  8. package/core/_types/types.js +1 -0
  9. package/core/components/functional/date/date.d.ts +13 -5
  10. package/core/components/functional/date/date.js +48 -29
  11. package/core/components/functional/example/example.d.ts +1 -1
  12. package/core/components/functional/example/example.js +1 -1
  13. package/core/components/functional/fetch/fetch.d.ts +40 -3
  14. package/core/components/functional/fetch/fetch.js +2 -6
  15. package/core/components/functional/functional.d.ts +2 -0
  16. package/core/components/functional/functional.js +2 -0
  17. package/core/components/functional/if/if.d.ts +3 -0
  18. package/core/components/functional/if/if.js +6 -12
  19. package/core/components/functional/if/if.test.d.ts +1 -0
  20. package/core/components/functional/if/if.test.js +44 -0
  21. package/core/components/functional/list/list.d.ts +32 -8
  22. package/core/components/functional/list/list.js +33 -40
  23. package/core/components/functional/mix/mix.d.ts +22 -0
  24. package/core/components/functional/mix/mix.js +99 -0
  25. package/core/components/functional/queue/queue.d.ts +16 -3
  26. package/core/components/functional/queue/queue.js +71 -15
  27. package/core/components/functional/router/redirect.d.ts +10 -1
  28. package/core/components/functional/router/redirect.js +5 -6
  29. package/core/components/functional/router/router.d.ts +15 -1
  30. package/core/components/functional/router/router.js +1 -6
  31. package/core/components/functional/sdui/SDUIDescriptorTransformer.d.ts +1 -1
  32. package/core/components/functional/sdui/SDUIDescriptorTransformer.js +24 -12
  33. package/core/components/functional/sdui/default-library.json +108 -0
  34. package/core/components/functional/sdui/sdui-utils.d.ts +5 -0
  35. package/core/components/functional/sdui/sdui-utils.js +63 -0
  36. package/core/components/functional/sdui/sdui.d.ts +20 -9
  37. package/core/components/functional/sdui/sdui.js +64 -24
  38. package/core/components/functional/sdui/types.d.ts +4 -2
  39. package/core/components/functional/sdui/types.js +0 -0
  40. package/core/components/functional/sonic-scope/sonic-scope.d.ts +0 -0
  41. package/core/components/functional/sonic-scope/sonic-scope.js +0 -0
  42. package/core/components/functional/states/states.d.ts +19 -3
  43. package/core/components/functional/states/states.js +7 -12
  44. package/core/components/functional/submit/submit.d.ts +16 -1
  45. package/core/components/functional/submit/submit.js +87 -17
  46. package/core/components/functional/subscriber/subscriber.d.ts +4 -1
  47. package/core/components/functional/subscriber/subscriber.js +1 -6
  48. package/core/components/functional/value/value.d.ts +7 -0
  49. package/core/components/functional/value/value.js +26 -0
  50. package/core/components/ui/_css/scroll.d.ts +0 -0
  51. package/core/components/ui/_css/scroll.js +6 -7
  52. package/core/components/ui/_css/size.d.ts +1 -0
  53. package/core/components/ui/_css/size.js +3 -1
  54. package/core/components/ui/_css/type.d.ts +0 -0
  55. package/core/components/ui/_css/type.js +0 -0
  56. package/core/components/ui/alert/alert.d.ts +2 -2
  57. package/core/components/ui/alert/alert.js +11 -16
  58. package/core/components/ui/badge/badge.d.ts +3 -1
  59. package/core/components/ui/badge/badge.js +36 -22
  60. package/core/components/ui/button/button.d.ts +23 -20
  61. package/core/components/ui/button/button.js +59 -42
  62. package/core/components/ui/captcha/captcha.d.ts +14 -2
  63. package/core/components/ui/captcha/captcha.js +17 -12
  64. package/core/components/ui/card/card-footer.d.ts +0 -0
  65. package/core/components/ui/card/card-footer.js +1 -8
  66. package/core/components/ui/card/card-header-descripton.d.ts +0 -0
  67. package/core/components/ui/card/card-header-descripton.js +3 -9
  68. package/core/components/ui/card/card-header.d.ts +0 -0
  69. package/core/components/ui/card/card-header.js +1 -6
  70. package/core/components/ui/card/card-main.d.ts +0 -0
  71. package/core/components/ui/card/card-main.js +0 -5
  72. package/core/components/ui/card/card.d.ts +1 -1
  73. package/core/components/ui/card/card.js +28 -12
  74. package/core/components/ui/divider/divider.d.ts +2 -0
  75. package/core/components/ui/divider/divider.js +44 -17
  76. package/core/components/ui/form/checkbox/checkbox.d.ts +53 -16
  77. package/core/components/ui/form/checkbox/checkbox.js +54 -29
  78. package/core/components/ui/form/css/form-control.d.ts +2 -0
  79. package/core/components/ui/form/css/form-control.js +145 -67
  80. package/core/components/ui/form/fieldset/fieldset.d.ts +8 -1
  81. package/core/components/ui/form/fieldset/fieldset.js +45 -8
  82. package/core/components/ui/form/fieldset/legend-description.d.ts +0 -0
  83. package/core/components/ui/form/fieldset/legend-description.js +0 -5
  84. package/core/components/ui/form/fieldset/legend.d.ts +0 -0
  85. package/core/components/ui/form/fieldset/legend.js +4 -7
  86. package/core/components/ui/form/form-actions/form-actions.d.ts +2 -0
  87. package/core/components/ui/form/form-actions/form-actions.js +26 -11
  88. package/core/components/ui/form/form-layout/form-layout.d.ts +5 -2
  89. package/core/components/ui/form/form-layout/form-layout.js +31 -9
  90. package/core/components/ui/form/input/input.d.ts +15 -18
  91. package/core/components/ui/form/input/input.js +89 -54
  92. package/core/components/ui/form/input/password-helper.d.ts +7 -1
  93. package/core/components/ui/form/input/password-helper.js +33 -10
  94. package/core/components/ui/form/input/same-value-helper.d.ts +1 -1
  95. package/core/components/ui/form/input/same-value-helper.js +1 -0
  96. package/core/components/ui/form/input-autocomplete/input-autocomplete.d.ts +34 -0
  97. package/core/components/ui/form/input-autocomplete/input-autocomplete.js +133 -0
  98. package/core/components/ui/form/radio/radio.d.ts +6 -0
  99. package/core/components/ui/form/radio/radio.js +7 -12
  100. package/core/components/ui/form/select/select.d.ts +23 -7
  101. package/core/components/ui/form/select/select.js +71 -40
  102. package/core/components/ui/form/textarea/textarea.d.ts +13 -13
  103. package/core/components/ui/form/textarea/textarea.js +31 -38
  104. package/core/components/ui/group/group.d.ts +11 -1
  105. package/core/components/ui/group/group.js +79 -17
  106. package/core/components/ui/icon/icon.d.ts +10 -3
  107. package/core/components/ui/icon/icon.js +16 -15
  108. package/core/components/ui/icon/icons.d.ts +0 -0
  109. package/core/components/ui/icon/icons.js +11 -8
  110. package/core/components/ui/icon/icons.json +1 -1
  111. package/core/components/ui/image/image.d.ts +0 -0
  112. package/core/components/ui/image/image.js +0 -5
  113. package/core/components/ui/link/link.d.ts +1 -1
  114. package/core/components/ui/link/link.js +2 -6
  115. package/core/components/ui/loader/loader.d.ts +0 -0
  116. package/core/components/ui/loader/loader.js +2 -8
  117. package/core/components/ui/loader/styles/fixed.d.ts +0 -0
  118. package/core/components/ui/loader/styles/fixed.js +0 -0
  119. package/core/components/ui/loader/styles/inline.d.ts +0 -0
  120. package/core/components/ui/loader/styles/inline.js +0 -0
  121. package/core/components/ui/menu/menu-item.d.ts +0 -0
  122. package/core/components/ui/menu/menu-item.js +4 -9
  123. package/core/components/ui/menu/menu.d.ts +9 -1
  124. package/core/components/ui/menu/menu.js +183 -27
  125. package/core/components/ui/modal/modal-actions.d.ts +0 -0
  126. package/core/components/ui/modal/modal-actions.js +1 -6
  127. package/core/components/ui/modal/modal-close.d.ts +1 -0
  128. package/core/components/ui/modal/modal-close.js +14 -10
  129. package/core/components/ui/modal/modal-content.d.ts +0 -0
  130. package/core/components/ui/modal/modal-content.js +0 -5
  131. package/core/components/ui/modal/modal-subtitle.d.ts +0 -0
  132. package/core/components/ui/modal/modal-subtitle.js +2 -6
  133. package/core/components/ui/modal/modal-title.d.ts +0 -0
  134. package/core/components/ui/modal/modal-title.js +0 -5
  135. package/core/components/ui/modal/modal.d.ts +7 -7
  136. package/core/components/ui/modal/modal.js +36 -36
  137. package/core/components/ui/pop/pop.d.ts +2 -1
  138. package/core/components/ui/pop/pop.js +11 -10
  139. package/core/components/ui/progress/progress.d.ts +0 -0
  140. package/core/components/ui/progress/progress.js +34 -32
  141. package/core/components/ui/table/table-caption.d.ts +0 -0
  142. package/core/components/ui/table/table-caption.js +5 -10
  143. package/core/components/ui/table/table-tbody.d.ts +0 -0
  144. package/core/components/ui/table/table-tbody.js +10 -14
  145. package/core/components/ui/table/table-td.d.ts +2 -0
  146. package/core/components/ui/table/table-td.js +8 -5
  147. package/core/components/ui/table/table-tfoot.d.ts +0 -0
  148. package/core/components/ui/table/table-tfoot.js +5 -7
  149. package/core/components/ui/table/table-th.d.ts +2 -0
  150. package/core/components/ui/table/table-th.js +12 -9
  151. package/core/components/ui/table/table-thead.d.ts +0 -0
  152. package/core/components/ui/table/table-thead.js +1 -6
  153. package/core/components/ui/table/table-tr.d.ts +0 -0
  154. package/core/components/ui/table/table-tr.js +4 -6
  155. package/core/components/ui/table/table.d.ts +0 -3
  156. package/core/components/ui/table/table.js +14 -31
  157. package/core/components/ui/taxonomy/taxonomy.d.ts +6 -3
  158. package/core/components/ui/taxonomy/taxonomy.js +9 -9
  159. package/core/components/ui/theme/css/tailwind.css +0 -0
  160. package/core/components/ui/theme/css/tailwind.d.ts +0 -0
  161. package/core/components/ui/theme/theme-collection/core-variables.d.ts +0 -0
  162. package/core/components/ui/theme/theme-collection/core-variables.js +13 -11
  163. package/core/components/ui/theme/theme-collection/dark.d.ts +0 -0
  164. package/core/components/ui/theme/theme-collection/dark.js +1 -1
  165. package/core/components/ui/theme/theme-collection/light.d.ts +0 -0
  166. package/core/components/ui/theme/theme-collection/light.js +0 -0
  167. package/core/components/ui/theme/theme.d.ts +1 -6
  168. package/core/components/ui/theme/theme.js +7 -36
  169. package/core/components/ui/toast/message-subscriber.d.ts +13 -7
  170. package/core/components/ui/toast/message-subscriber.js +0 -0
  171. package/core/components/ui/toast/toast-item.d.ts +0 -0
  172. package/core/components/ui/toast/toast-item.js +1 -1
  173. package/core/components/ui/toast/toast.d.ts +2 -1
  174. package/core/components/ui/toast/toast.js +29 -14
  175. package/core/components/ui/toast/types.d.ts +0 -0
  176. package/core/components/ui/toast/types.js +0 -0
  177. package/core/components/ui/tooltip/tooltip.d.ts +1 -0
  178. package/core/components/ui/tooltip/tooltip.js +35 -14
  179. package/core/components/ui/ui.d.ts +1 -0
  180. package/core/components/ui/ui.js +1 -3
  181. package/core/core.d.ts +0 -0
  182. package/core/core.js +5 -6
  183. package/core/mixins/Fetcher.d.ts +19 -10
  184. package/core/mixins/Fetcher.js +26 -10
  185. package/core/mixins/FormCheckable.d.ts +17 -8
  186. package/core/mixins/FormCheckable.js +177 -22
  187. package/core/mixins/FormElement.d.ts +12 -7
  188. package/core/mixins/FormElement.js +42 -26
  189. package/core/mixins/FormInput.d.ts +8 -4
  190. package/core/mixins/FormInput.js +4 -3
  191. package/core/mixins/Subscriber.d.ts +7 -5
  192. package/core/mixins/Subscriber.js +34 -32
  193. package/core/mixins/TemplatesContainer.d.ts +0 -0
  194. package/core/mixins/TemplatesContainer.js +0 -0
  195. package/core/mixins/mixins.d.ts +0 -0
  196. package/core/mixins/mixins.js +0 -0
  197. package/core/utils/Arrays.d.ts +15 -15
  198. package/core/utils/Arrays.js +0 -0
  199. package/core/utils/DataBindObserver.d.ts +16 -9
  200. package/core/utils/DataBindObserver.js +23 -28
  201. package/core/utils/Electron.d.ts +5 -1
  202. package/core/utils/Electron.js +4 -2
  203. package/core/utils/Format.d.ts +0 -0
  204. package/core/utils/Format.js +0 -0
  205. package/core/utils/HTML.d.ts +9 -2
  206. package/core/utils/HTML.js +22 -3
  207. package/core/utils/LocationHandler.d.ts +6 -5
  208. package/core/utils/LocationHandler.js +19 -8
  209. package/core/utils/Objects.d.ts +7 -4
  210. package/core/utils/Objects.js +28 -6
  211. package/core/utils/{PublisherProxy.d.mts → PublisherProxy.d.ts} +40 -31
  212. package/core/utils/{PublisherProxy.mjs → PublisherProxy.js} +54 -28
  213. package/core/utils/Utils.d.ts +3 -0
  214. package/core/utils/Utils.js +18 -0
  215. package/core/utils/api.d.ts +39 -7
  216. package/core/utils/api.js +45 -32
  217. package/img/concorde-logo.svg +1 -0
  218. package/img/concorde.png +0 -0
  219. package/img/concorde_def.png +0 -0
  220. package/mixins.d.ts +36 -18
  221. package/mixins.js +3 -4
  222. package/package.json +47 -10
  223. package/svg/regular/plane.svg +1 -0
  224. package/svg/solid/plane.svg +1 -0
  225. package/test-utils/TestUtils.d.ts +4 -0
  226. package/test-utils/TestUtils.js +12 -0
  227. package/utils.d.ts +3 -1
  228. package/utils.js +7 -5
  229. package/core/components/functional/configuration/configuration.d.ts +0 -5
  230. package/core/components/functional/configuration/configuration.js +0 -22
  231. package/core/components/ui/tabs/tab.d.ts +0 -6
  232. package/core/components/ui/tabs/tab.js +0 -46
  233. package/core/components/ui/tabs/tabs.d.ts +0 -15
  234. package/core/components/ui/tabs/tabs.js +0 -129
@@ -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();
@@ -165,18 +166,20 @@ const Subscriber = (superClass) => {
165
166
  SubscriberElement.instanceCounter++;
166
167
  }
167
168
  disconnectedCallback() {
169
+ var _a;
168
170
  this.removeDebugger();
169
171
  super.disconnectedCallback();
170
172
  if (this.publisher) {
171
173
  this.publisher.stopTemplateFilling(this);
172
- this.publisher.offInternalMutation(this.requestUpdate());
174
+ this.publisher.offInternalMutation(this.requestUpdate);
173
175
  }
174
176
  if (this.wordingPublisher)
175
177
  this.wordingPublisher.stopTemplateFilling(this);
176
178
  if (this.onAssign)
177
- this.publisher.offAssign(this.onAssign);
179
+ (_a = this.publisher) === null || _a === void 0 ? void 0 : _a.offAssign(this.onAssign);
178
180
  }
179
181
  addDebugger() {
182
+ var _a;
180
183
  if (this.hasAttribute("debug") && !this.defferedDebug) {
181
184
  if (!this.debug) {
182
185
  this.debug = document.createElement("div");
@@ -195,10 +198,11 @@ const Subscriber = (superClass) => {
195
198
  style.zIndex = "99999999";
196
199
  style.maxHeight = "calc(100vh - 32px)";
197
200
  style.fontFamily = "Consolas, monospace";
198
- style.maxWidth = "50vw";
201
+ style.maxWidth = "min(50vw,25rem)";
199
202
  style.fontSize = "12px";
200
203
  style.minWidth = "300px";
201
204
  style.overflowWrap = "break-word";
205
+ style.resize = "vertical";
202
206
  }
203
207
  this.addEventListener("click", (e) => {
204
208
  if (!e.ctrlKey)
@@ -207,8 +211,7 @@ const Subscriber = (superClass) => {
207
211
  keepDebugOnMouseOut = !keepDebugOnMouseOut;
208
212
  });
209
213
  if (this.dataProvider) {
210
- let win = window;
211
- win[this.dataProvider] = this.publisher;
214
+ window[this.dataProvider] = this.publisher;
212
215
  }
213
216
  this.addEventListener("mouseover", () => {
214
217
  if (!keepDebugOnMouseOut)
@@ -220,13 +223,14 @@ const Subscriber = (superClass) => {
220
223
  if (!keepDebugOnMouseOut)
221
224
  this.removeDebugger();
222
225
  });
223
- this.publisher.onInternalMutation(() => {
226
+ (_a = this.publisher) === null || _a === void 0 ? void 0 : _a.onInternalMutation(() => {
227
+ var _a;
224
228
  this.debug.innerHTML = `🤖 DataProvider : "<b style="font-weight:bold;color:#fff;">${this.dataProvider}</b>"<br>
225
229
  <div style="font-size:10px;border-top:1px dashed;margin-top:5px;padding-left:23px;opacity:.6;padding-top:5px;">
226
230
  Variable disponible dans la console<br>
227
231
  ctrl + Clique : épingler / désépingler
228
232
  </div>
229
- <pre style="margin-top:10px;background:transparent;padding:0;font-size:inherit;color:inherit;">${JSON.stringify(this.publisher.get(), null, " ")}</pre>`;
233
+ <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
234
  });
231
235
  }
232
236
  }
@@ -244,6 +248,7 @@ const Subscriber = (superClass) => {
244
248
  */
245
249
  getApiConfiguration() {
246
250
  const token = this.getAncestorAttributeValue("token");
251
+ let addHTTPResponse = this.getAncestorAttributeValue("addHTTPResponse") != null;
247
252
  let serviceURL = this.getAncestorAttributeValue("serviceURL");
248
253
  let userName = null;
249
254
  let password = null;
@@ -253,7 +258,8 @@ const Subscriber = (superClass) => {
253
258
  password = this.getAncestorAttributeValue("password");
254
259
  tokenProvider = this.getAncestorAttributeValue("tokenProvider");
255
260
  }
256
- return { serviceURL, token, userName, password, tokenProvider };
261
+ let credentials = this.getAncestorAttributeValue("credentials") || undefined;
262
+ return { serviceURL, token, userName, password, tokenProvider, addHTTPResponse, credentials };
257
263
  }
258
264
  initWording() {
259
265
  return __awaiter(this, void 0, void 0, function* () {
@@ -339,17 +345,14 @@ const Subscriber = (superClass) => {
339
345
  this.publisher = pub;
340
346
  }
341
347
  if (this.publisher) {
342
- this.onAssign = () => {
343
- this.requestUpdate();
344
- };
345
- this.publisher.onAssign(this.onAssign);
348
+ if (this._props) {
349
+ this.publisher.set(this._props);
350
+ }
346
351
  if (!this.noAutoFill)
347
352
  this.publisher.startTemplateFilling(this);
348
353
  if (this.renderOnPropsInternalChange)
349
354
  this.publisher.onInternalMutation(this.requestUpdate);
350
- if (this._props) {
351
- this.publisher.set(this._props);
352
- }
355
+ this.publisher.onAssign(this.onAssign);
353
356
  }
354
357
  }
355
358
  }
@@ -381,6 +384,5 @@ const Subscriber = (superClass) => {
381
384
  return SubscriberElement;
382
385
  };
383
386
  export default Subscriber;
384
- let win = window;
385
- if (!win.SonicPublisherManager)
386
- win.SonicPublisherManager = PublisherManager;
387
+ if (!window.SonicPublisherManager)
388
+ window.SonicPublisherManager = PublisherManager;
File without changes
File without changes
File without changes
File without changes
@@ -2,19 +2,19 @@ declare class Arrays {
2
2
  /**
3
3
  * Vérifie si les deux tableaux ont le même contenu
4
4
  */
5
- static areEqual(array1: Array<any>, array2: Array<any>): boolean;
5
+ static areEqual<U>(array1: Array<U>, array2: Array<U>): boolean;
6
6
  /**
7
7
  * Fournie une fonction to1D qui transforme un tableau 2D en un tableau 1D par concaténation
8
8
  */
9
- static from2d(source: Array<Array<Record<string, any>>>): {
9
+ static from2d(source: any): {
10
10
  to1D: () => {
11
11
  /**Obtenir le tableau final*/
12
- get: () => Record<string, any>[];
12
+ get: () => any;
13
13
  everyItem: () => {
14
14
  has: () => {
15
15
  same: () => {
16
16
  value: () => {
17
- forKey: (key: string) => boolean;
17
+ forKey: (key: string) => any;
18
18
  };
19
19
  };
20
20
  };
@@ -28,10 +28,10 @@ declare class Arrays {
28
28
  };
29
29
  };
30
30
  map: (f: (elt: Record<string, any>) => any) => any;
31
- filter: (f: (elt: Record<string, any>) => any) => any;
32
- find: (f: (elt: Record<string, any>) => any) => Record<string, any> | undefined;
33
- some: (f: (elt: Record<string, any>) => any) => boolean;
34
- every: (f: (elt: Record<string, any>) => any) => boolean;
31
+ filter: (f: (elt: any) => any) => any;
32
+ find: (f: (elt: Record<string, any>) => any) => any;
33
+ some: (f: (elt: Record<string, any>) => any) => any;
34
+ every: (f: (elt: Record<string, any>) => any) => any;
35
35
  group: () => {
36
36
  byKey: (key: string) => any;
37
37
  };
@@ -54,14 +54,14 @@ declare class Arrays {
54
54
  * puis data.everyItem().has().same().value().forkey("key");
55
55
  * Peu mieux faire. ou voir a remplacer un jour par loadHash par exemple.
56
56
  **/
57
- static from(source: Array<Record<string, any>>): {
57
+ static from(source: any): {
58
58
  /**Obtenir le tableau final*/
59
- get: () => Record<string, any>[];
59
+ get: () => any;
60
60
  everyItem: () => {
61
61
  has: () => {
62
62
  same: () => {
63
63
  value: () => {
64
- forKey: (key: string) => boolean;
64
+ forKey: (key: string) => any;
65
65
  };
66
66
  };
67
67
  };
@@ -75,10 +75,10 @@ declare class Arrays {
75
75
  };
76
76
  };
77
77
  map: (f: (elt: Record<string, any>) => any) => any;
78
- filter: (f: (elt: Record<string, any>) => any) => any;
79
- find: (f: (elt: Record<string, any>) => any) => Record<string, any> | undefined;
80
- some: (f: (elt: Record<string, any>) => any) => boolean;
81
- every: (f: (elt: Record<string, any>) => any) => boolean;
78
+ filter: (f: (elt: any) => any) => any;
79
+ find: (f: (elt: Record<string, any>) => any) => any;
80
+ some: (f: (elt: Record<string, any>) => any) => any;
81
+ every: (f: (elt: Record<string, any>) => any) => any;
82
82
  group: () => {
83
83
  byKey: (key: string) => any;
84
84
  };
File without changes
@@ -1,12 +1,19 @@
1
+ import { PublisherInterface, PublisherContentType } from "@supersoniks/concorde/core/_types/types";
2
+ import { SearchableDomElement } from "@supersoniks/concorde/core/utils/HTML";
1
3
  declare type BindedVariablesDescriptor = {
2
- expression: String;
4
+ expression: string;
3
5
  variables: Array<Array<string>>;
4
6
  };
5
7
  declare type DataBindItem = {
6
8
  propertyToUpdate: string;
7
9
  bindedVariablesDescriptor: BindedVariablesDescriptor;
8
10
  };
11
+ declare type PublisherListenerConfig<ValueType extends PublisherContentType = any> = {
12
+ publisher: PublisherInterface<ValueType>;
13
+ onAssign: (value?: ValueType) => void;
14
+ };
9
15
  /**
16
+ *
10
17
  * En appelant DataBindObserver.observe(HTMLElement) sun un élément html, tout les éléments peuvent être liés à au publisher a l'adresse déterminée parl'attribut dataProvider de l'un de ses ancêtres.
11
18
  * Pour cela un MutationObserver est créé pour observer les changements d'attributs de l'élément.
12
19
  * On peut alors ecrire ce genre de choses de manière a lier dynamiquement les données du publisher à l'élément html.
@@ -18,28 +25,28 @@ export default class DataBindObserver {
18
25
  /**
19
26
  * Maintient la liste des éléments observés de manière à pouvoir les désinscrire quand ils sont supprimés.
20
27
  */
21
- static observedElements: Map<Node, MutationObserver>;
28
+ static observedElements: Map<SearchableDomElement, MutationObserver>;
22
29
  /**
23
30
  * Commencer à observer un élément html.
24
31
  */
25
32
  static enabled: boolean;
26
33
  static disable(): void;
27
- static observe(element: HTMLElement): void;
34
+ static observe(element: SearchableDomElement): void;
28
35
  /**
29
36
  * Arrêter à observer un élément html.
30
37
  */
31
- static unObserve(element: HTMLElement): void;
38
+ static unObserve(element: SearchableDomElement): void;
32
39
  static onAdded(elt: HTMLElement): void;
33
40
  static onRemoved(elt: HTMLElement): void;
34
41
  /**
35
42
  * Callback appelé par le MutationObserver
36
43
  */
37
44
  static onMutation(list: MutationRecord[]): void;
38
- static publisherListeners: Map<HTMLElement, any[]>;
45
+ static publisherListeners: Map<SearchableDomElement, PublisherListenerConfig[]>;
39
46
  /**
40
47
  * La liaison avec le publisher supprimée ici.
41
48
  */
42
- static removePublisherListeners(target: HTMLElement): void;
49
+ static removePublisherListeners(target: SearchableDomElement): void;
43
50
  /**
44
51
  *
45
52
  * Cette fonction prend l'expression fournie et trouves toutes les occurences du type $.clef1.clef2.clef3 ou $a.b par exemple.
@@ -59,18 +66,18 @@ export default class DataBindObserver {
59
66
  * Cela représente la propriété à mettre à jour sur l'élément lors de la modification d'une des variables liées dans le publicheur.
60
67
  * * Propriété "bindedVariablesDescriptor" du DataBindItem : voir la fonction getVariablesDescriptor
61
68
  */
62
- static getDataBindItems(element: HTMLElement): DataBindItem[];
69
+ static getDataBindItems(element: SearchableDomElement): DataBindItem[];
63
70
  /**
64
71
  * Cette fonction récuperer le (sous) publisher a l'adresse donnée.
65
72
  * Si l'une des clef de l'adresse est _self_, on garde le publisher courant et on passe à la suite.
66
73
  * Ceci est un cas spécial, c'est pour ça qu'on utilisa pes Objects.traverse.
67
74
  * Il y a toujours un publisher quelque soit l'adresse ce qui permet de cibler des valeurs qui n'existent pas encore
68
75
  */
69
- static getSubPublisher(pub: any, pathArray: string[]): any;
76
+ static getSubPublisher<T extends PublisherContentType>(pub: PublisherInterface<T>, pathArray?: string[]): any;
70
77
  /**
71
78
  * La liaison avec le publisher est faite ici.
72
79
  * TODO Sans doute factoriser
73
80
  */
74
- static addPublisherListeners(target: HTMLElement): void;
81
+ static addPublisherListeners(target: SearchableDomElement): void;
75
82
  }
76
83
  export {};
@@ -1,7 +1,8 @@
1
1
  import Format from "@supersoniks/concorde/core/utils/Format";
2
2
  import HTML from "@supersoniks/concorde/core/utils/HTML";
3
- import { PublisherManager } from "@supersoniks/concorde/core/utils/PublisherProxy.mjs";
3
+ import { PublisherManager } from "@supersoniks/concorde/core/utils/PublisherProxy";
4
4
  /**
5
+ *
5
6
  * En appelant DataBindObserver.observe(HTMLElement) sun un élément html, tout les éléments peuvent être liés à au publisher a l'adresse déterminée parl'attribut dataProvider de l'un de ses ancêtres.
6
7
  * Pour cela un MutationObserver est créé pour observer les changements d'attributs de l'élément.
7
8
  * On peut alors ecrire ce genre de choses de manière a lier dynamiquement les données du publisher à l'élément html.
@@ -30,7 +31,9 @@ export default class DataBindObserver {
30
31
  opt.attributes = true;
31
32
  opt.attributeFilter = ["data-bind"];
32
33
  obs.observe(element, opt);
33
- element.querySelectorAll("[data-bind]").forEach((e) => DataBindObserver.addPublisherListeners(e));
34
+ element
35
+ .querySelectorAll("[data-bind]")
36
+ .forEach((e) => DataBindObserver.addPublisherListeners(e));
34
37
  DataBindObserver.observedElements.set(element, obs);
35
38
  }
36
39
  /**
@@ -57,9 +60,7 @@ export default class DataBindObserver {
57
60
  if (elt.hasAttribute && elt.hasAttribute("data-bind"))
58
61
  DataBindObserver.removePublisherListeners(elt);
59
62
  if (elt.querySelectorAll)
60
- elt
61
- .querySelectorAll("[data-bind]")
62
- .forEach((e) => DataBindObserver.removePublisherListeners(e));
63
+ elt.querySelectorAll("[data-bind]").forEach((e) => DataBindObserver.removePublisherListeners(e));
63
64
  else
64
65
  elt.childNodes.forEach((elt) => DataBindObserver.onRemoved(elt));
65
66
  }
@@ -94,7 +95,8 @@ export default class DataBindObserver {
94
95
  return;
95
96
  DataBindObserver.publisherListeners.delete(target);
96
97
  conf.forEach((currentConf) => {
97
- currentConf.publisher.offAssign(currentConf.onAssign);
98
+ var _a;
99
+ (_a = currentConf.publisher) === null || _a === void 0 ? void 0 : _a.offAssign(currentConf.onAssign);
98
100
  });
99
101
  }
100
102
  /**
@@ -128,6 +130,8 @@ export default class DataBindObserver {
128
130
  * * Propriété "bindedVariablesDescriptor" du DataBindItem : voir la fonction getVariablesDescriptor
129
131
  */
130
132
  static getDataBindItems(element) {
133
+ if (!("attributes" in element))
134
+ return [];
131
135
  return Array.from(element.attributes)
132
136
  .filter((attribute) => attribute.name.indexOf("::") == 0)
133
137
  .map((e) => {
@@ -145,9 +149,13 @@ export default class DataBindObserver {
145
149
  * Il y a toujours un publisher quelque soit l'adresse ce qui permet de cibler des valeurs qui n'existent pas encore
146
150
  */
147
151
  static getSubPublisher(pub, pathArray) {
152
+ if (!pathArray)
153
+ return pub;
148
154
  for (let key of pathArray) {
149
155
  if (key == "_self_")
150
156
  continue;
157
+ if (!pub)
158
+ return null;
151
159
  pub = pub[key];
152
160
  }
153
161
  return pub;
@@ -161,8 +169,7 @@ export default class DataBindObserver {
161
169
  /**
162
170
  * On récupère le publisher viea le dataProvider d'un ancêtre de l'élément.
163
171
  */
164
- let node = target;
165
- let dataProviderId = HTML.getAncestorAttributeValue(node.parentNode || node.host || node, "dataProvider");
172
+ let dataProviderId = HTML.getAncestorAttributeValue((target.parentNode || target.host || target), "dataProvider");
166
173
  if (!dataProviderId)
167
174
  return;
168
175
  let publisher = PublisherManager.getInstance().get(dataProviderId);
@@ -187,7 +194,8 @@ export default class DataBindObserver {
187
194
  publisher: pub,
188
195
  onAssign: () => {
189
196
  let values = bindedVariablesDescriptor.variables.map((dataPath) => {
190
- return DataBindObserver.getSubPublisher(publisher, dataPath).get();
197
+ var _a;
198
+ return (_a = DataBindObserver.getSubPublisher(publisher, dataPath)) === null || _a === void 0 ? void 0 : _a.get();
191
199
  });
192
200
  let expression = bindedVariablesDescriptor.expression;
193
201
  let hasUndeterminatedValue = false;
@@ -214,24 +222,12 @@ export default class DataBindObserver {
214
222
  for (let i = 0; i < values.length; i++) {
215
223
  let value = values[i];
216
224
  let variable = bindedVariablesDescriptor.variables[i];
217
- if (value === null
218
- // Objects.isObject(value) &&
219
- // value.hasOwnProperty("__value") &&
220
- // Objects.isUndefindOrNull(value.__value)
221
- ) {
225
+ if (value === null) {
222
226
  hasUndeterminatedValue = true;
223
227
  value = undefined;
224
228
  }
225
229
  expression = expression.replace("$" + variable.join("."), value);
226
230
  }
227
- /**
228
- * Ce bout de code doit être un relicat
229
- */
230
- // if (Objects.isObject(expression) && !expression.hasOwnProperty("__value")) {
231
- // rec[propertyToUpdate] = expression;
232
- // return;
233
- // } else if (Objects.isObject(expression) && !expression.__value) expression = "";
234
- // else
235
231
  if (expression.indexOf("|") != -1) {
236
232
  let funcDelimiterIdx = expression.indexOf("|");
237
233
  if (funcDelimiterIdx == 0) {
@@ -240,8 +236,8 @@ export default class DataBindObserver {
240
236
  else {
241
237
  let funcName = expression.substring(0, funcDelimiterIdx);
242
238
  let funcArgs = expression.substring(funcDelimiterIdx + 1);
243
- let fmt = Format;
244
- expression = hasUndeterminatedValue ? "" : fmt[funcName] ? fmt[funcName](funcArgs) : expression;
239
+ let fmtFunc = Format[funcName];
240
+ expression = hasUndeterminatedValue ? "" : fmtFunc ? fmtFunc(funcArgs) : expression;
245
241
  }
246
242
  }
247
243
  else {
@@ -250,7 +246,7 @@ export default class DataBindObserver {
250
246
  rec[propertyToUpdate] = expression;
251
247
  },
252
248
  };
253
- pub.onAssign(currentConf.onAssign);
249
+ pub === null || pub === void 0 ? void 0 : pub.onAssign(currentConf.onAssign);
254
250
  conf.push(currentConf);
255
251
  }
256
252
  });
@@ -267,6 +263,5 @@ DataBindObserver.observedElements = new Map();
267
263
  DataBindObserver.enabled = true;
268
264
  DataBindObserver.publisherListeners = new Map();
269
265
  DataBindObserver.observe(document.documentElement);
270
- let win = window;
271
- if (!win.SonicDataBindObserver)
272
- win.SonicDataBindObserver = DataBindObserver;
266
+ if (!window.SonicDataBindObserver)
267
+ window.SonicDataBindObserver = DataBindObserver;
@@ -1,3 +1,7 @@
1
1
  export default class Electron {
2
- static fixBlankLink(link: any): void;
2
+ static fixBlankLink(link: {
3
+ target: string | null;
4
+ href: string;
5
+ addEventListener: (type: string, callback: (e?: Event) => void) => void;
6
+ }): void;
3
7
  }
@@ -1,9 +1,11 @@
1
1
  export default class Electron {
2
2
  static fixBlankLink(link) {
3
3
  const electronStr = "electron";
4
- const electron = typeof require == 'undefined' ? null : require(electronStr);
4
+ const electron = typeof require == "undefined" ? null : require(electronStr);
5
5
  if (typeof electron && link.target == "_blank") {
6
- link.addEventListener("click", () => { electron === null || electron === void 0 ? void 0 : electron.shell.openExternal(link.href); });
6
+ link.addEventListener("click", () => {
7
+ electron === null || electron === void 0 ? void 0 : electron.shell.openExternal(link.href);
8
+ });
7
9
  }
8
10
  }
9
11
  }
File without changes
File without changes
@@ -1,15 +1,22 @@
1
+ export declare type SearchableDomElement = HTMLElement | ShadowRoot;
1
2
  declare class HTML {
2
3
  /**
3
4
  * retourne la langue de la page courante telle que défini via l'attribut lang de la balise html
4
5
  */
5
6
  static getLanguage(): string;
6
- static getCookies(): any;
7
+ static getCookies(): Record<string, string>;
7
8
  /**
8
9
  * Va de parent en parent en partant de node pour trouver un attribut
9
10
  * @param attributeName nom de l'attribut
10
11
  * @returns valeur de l'attribut ou null si l'attribut n'est pas trouvé
11
12
  */
12
- static getAncestorAttributeValue(node: any, attributeName: string): string | null;
13
+ static getAncestorAttributeValue(node: SearchableDomElement | null, attributeName: string): string | null;
14
+ /**
15
+ * Va de parent en parent en partant de node pour trouver un attribut
16
+ * @param attributeName nom de l'attribut
17
+ * @returns valeur de l'attribut ou null si l'attribut n'est pas trouvé
18
+ */
19
+ static getClosestForm(node: SearchableDomElement): SearchableDomElement | null;
13
20
  /**
14
21
  * Lance le chargement d'un js et retourne une promise qui resoud à true lorsque le chargement à réussi et à false, sinon.
15
22
  * */
@@ -27,17 +27,36 @@ class HTML {
27
27
  * @returns valeur de l'attribut ou null si l'attribut n'est pas trouvé
28
28
  */
29
29
  static getAncestorAttributeValue(node, attributeName) {
30
- while (!(node.hasAttribute && node.hasAttribute(attributeName))) {
30
+ if (!node)
31
+ return null;
32
+ while (!("hasAttribute" in node && node.hasAttribute(attributeName))) {
31
33
  const newNode = node.parentNode || node.host;
32
34
  if (!newNode)
33
35
  break;
34
- node = node.parentNode || node.host;
36
+ node = (node.parentNode || node.host);
35
37
  }
36
- if (!node.hasAttribute) {
38
+ if (!("hasAttribute" in node)) {
37
39
  return null;
38
40
  }
39
41
  return node.getAttribute(attributeName);
40
42
  }
43
+ /**
44
+ * Va de parent en parent en partant de node pour trouver un attribut
45
+ * @param attributeName nom de l'attribut
46
+ * @returns valeur de l'attribut ou null si l'attribut n'est pas trouvé
47
+ */
48
+ static getClosestForm(node) {
49
+ while (!(node.nodeName && node.nodeName.toLowerCase() === "form")) {
50
+ const newNode = node.parentNode || node.host;
51
+ if (!newNode)
52
+ break;
53
+ node = (node.parentNode || node.host);
54
+ }
55
+ if (!node.nodeName) {
56
+ return null;
57
+ }
58
+ return node;
59
+ }
41
60
  /**
42
61
  * Lance le chargement d'un js et retourne une promise qui resoud à true lorsque le chargement à réussi et à false, sinon.
43
62
  * */
@@ -1,10 +1,11 @@
1
1
  declare type Listener = {
2
2
  location: string;
3
3
  };
4
- declare type ActivableLink = {
5
- location: string;
6
- href: string;
7
- autoActive: "strict" | "partial" | "disabled";
4
+ declare type ActivableLink = HTMLElement & {
5
+ location?: string;
6
+ href?: string;
7
+ goBack?: string | null;
8
+ autoActive?: "strict" | "partial" | "disabled";
8
9
  setAttribute(name: string, value: string): void;
9
10
  removeAttribute(name: string): void;
10
11
  };
@@ -34,7 +35,7 @@ export default class LocationHandler {
34
35
  * Si l'attribut replaceState est présent la naviguation se fait via un replaceState
35
36
  * Voir link et button pour les exemples d'implémentation
36
37
  **/
37
- static changeFromComponent(component: any): void;
38
+ static changeFromComponent(component: ActivableLink): void;
38
39
  /**
39
40
  *
40
41
  * @param component ActivableLink