@supersoniks/concorde 1.1.48 → 2.0.0

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 (83) hide show
  1. package/README.md +0 -0
  2. package/cli.js +0 -0
  3. package/concorde-core.bundle.js +3288 -36
  4. package/concorde-core.es.js +13152 -9425
  5. package/core/components/functional/fetch/fetch.d.ts +2 -0
  6. package/core/components/functional/if/if.test.js +12 -21
  7. package/core/components/functional/list/list.d.ts +4 -0
  8. package/core/components/functional/list/list.js +24 -11
  9. package/core/components/functional/queue/queue.js +38 -70
  10. package/core/components/functional/router/router.js +1 -2
  11. package/core/components/functional/sdui/SDUIDescriptorTransformer.js +28 -43
  12. package/core/components/functional/sdui/sdui.d.ts +2 -0
  13. package/core/components/functional/sdui/sdui.js +24 -40
  14. package/core/components/functional/sonic-scope/sonic-scope.d.ts +1 -1
  15. package/core/components/functional/states/states.js +2 -4
  16. package/core/components/functional/submit/submit.js +106 -121
  17. package/core/components/ui/button/button.d.ts +2 -2
  18. package/core/components/ui/button/button.js +24 -41
  19. package/core/components/ui/captcha/captcha.js +3 -5
  20. package/core/components/ui/divider/divider.d.ts +1 -1
  21. package/core/components/ui/divider/divider.js +6 -6
  22. package/core/components/ui/form/checkbox/checkbox.d.ts +3 -23
  23. package/core/components/ui/form/checkbox/checkbox.js +7 -12
  24. package/core/components/ui/form/form-layout/form-layout.d.ts +1 -1
  25. package/core/components/ui/form/form-layout/form-layout.js +1 -1
  26. package/core/components/ui/form/input/input.d.ts +4 -6
  27. package/core/components/ui/form/input/input.js +12 -18
  28. package/core/components/ui/form/input-autocomplete/input-autocomplete.d.ts +4 -4
  29. package/core/components/ui/form/input-autocomplete/input-autocomplete.js +23 -50
  30. package/core/components/ui/form/select/select.d.ts +1 -1
  31. package/core/components/ui/form/select/select.js +15 -25
  32. package/core/components/ui/form/textarea/textarea.d.ts +3 -3
  33. package/core/components/ui/form/textarea/textarea.js +8 -17
  34. package/core/components/ui/group/group.js +7 -15
  35. package/core/components/ui/icon/icon.d.ts +6 -12
  36. package/core/components/ui/icon/icon.js +20 -53
  37. package/core/components/ui/icon/icons.js +28 -22
  38. package/core/components/ui/image/image.d.ts +1 -1
  39. package/core/components/ui/image/image.js +3 -3
  40. package/core/components/ui/menu/menu.js +2 -4
  41. package/core/components/ui/modal/modal-actions.d.ts +1 -1
  42. package/core/components/ui/modal/modal-actions.js +4 -4
  43. package/core/components/ui/modal/modal.js +10 -12
  44. package/core/components/ui/pop/pop.js +3 -4
  45. package/core/components/ui/table/table-td.js +5 -6
  46. package/core/components/ui/table/table-th.js +5 -6
  47. package/core/components/ui/table/table-tr.js +8 -1
  48. package/core/components/ui/table/table.d.ts +1 -0
  49. package/core/components/ui/table/table.js +9 -1
  50. package/core/components/ui/theme/css/tailwind.css +0 -0
  51. package/core/components/ui/theme/css/tailwind.d.ts +0 -0
  52. package/core/components/ui/theme/theme.js +5 -6
  53. package/core/components/ui/toast/message-subscriber.js +6 -8
  54. package/core/components/ui/toast/toast.js +15 -6
  55. package/core/components/ui/tooltip/tooltip.d.ts +1 -1
  56. package/core/core.js +9 -0
  57. package/core/decorators/Subscriber.d.ts +2 -1
  58. package/core/decorators/Subscriber.js +65 -19
  59. package/core/directives/DataProvider.d.ts +18 -0
  60. package/core/directives/DataProvider.js +87 -0
  61. package/core/mixins/Fetcher.d.ts +3 -3
  62. package/core/mixins/Fetcher.js +71 -82
  63. package/core/mixins/FormCheckable.js +2 -3
  64. package/core/mixins/FormElement.js +5 -7
  65. package/core/mixins/FormInput.d.ts +1 -1
  66. package/core/mixins/FormInput.js +1 -2
  67. package/core/mixins/Subscriber.js +43 -54
  68. package/core/utils/Arrays.js +2 -1
  69. package/core/utils/DataBindObserver.js +5 -6
  70. package/core/utils/Electron.js +1 -1
  71. package/core/utils/HTML.js +18 -31
  72. package/core/utils/LocationHandler.js +8 -13
  73. package/core/utils/PublisherProxy.d.ts +6 -1
  74. package/core/utils/PublisherProxy.js +129 -134
  75. package/core/utils/Utils.js +3 -14
  76. package/core/utils/api.js +137 -165
  77. package/img/concorde-logo.svg +0 -0
  78. package/img/concorde.png +0 -0
  79. package/img/concorde_def.png +0 -0
  80. package/mixins.d.ts +5 -3
  81. package/package.json +14 -12
  82. package/svg/regular/plane.svg +0 -0
  83. package/svg/solid/plane.svg +0 -0
@@ -6,6 +6,8 @@ declare const Fetch_base: {
6
6
  key: string;
7
7
  isFirstLoad: boolean;
8
8
  isLoading: boolean;
9
+ lazyLoad?: boolean | undefined;
10
+ noLoader?: boolean | undefined;
9
11
  iObserver: IntersectionObserver | null;
10
12
  isDefaultLoaderEnabled: boolean;
11
13
  isFetchEnabled: boolean;
@@ -1,44 +1,35 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
1
  import { expect } from "@jest/globals";
11
2
  import TestUtils from "@supersoniks/concorde/test-utils/TestUtils";
12
3
  import "./if";
13
4
  function create() {
14
5
  return TestUtils.bootstrap(`<sonic-if>Some Content</sonic-if>`)[0];
15
6
  }
16
- test("shows ''Some Content'' condition = true set by property accessor", () => __awaiter(void 0, void 0, void 0, function* () {
7
+ test("shows ''Some Content'' condition = true set by property accessor", async () => {
17
8
  const elt = create();
18
9
  elt.condition = true;
19
- yield elt.updated();
10
+ await elt.updated();
20
11
  const renderedText = elt.shadowRoot.children[0].assignedNodes()[0].textContent;
21
12
  expect(renderedText).toBe("Some Content");
22
- }));
23
- test("shows nothing condition = false set by property accessor", () => __awaiter(void 0, void 0, void 0, function* () {
13
+ });
14
+ test("shows nothing condition = false set by property accessor", async () => {
24
15
  const elt = create();
25
16
  elt.condition = false;
26
- yield elt.updated();
17
+ await elt.updated();
27
18
  const children = Array.from(elt.shadowRoot.children).filter((elt) => elt.nodeName.toLowerCase() != "style");
28
19
  const length = children.length;
29
20
  expect(length).toBe(0);
30
- }));
31
- test("shows ''Some Content'' condition = true set by attribute", () => __awaiter(void 0, void 0, void 0, function* () {
21
+ });
22
+ test("shows ''Some Content'' condition = true set by attribute", async () => {
32
23
  const elt = create();
33
24
  elt.setAttribute("condition", "");
34
- yield elt.updated();
25
+ await elt.updated();
35
26
  const renderedText = elt.shadowRoot.children[0].assignedNodes()[0].textContent;
36
27
  expect(renderedText).toBe("Some Content");
37
- }));
38
- test("shows nothing condition not set", () => __awaiter(void 0, void 0, void 0, function* () {
28
+ });
29
+ test("shows nothing condition not set", async () => {
39
30
  const elt = create();
40
- yield elt.updated();
31
+ await elt.updated();
41
32
  const children = Array.from(elt.shadowRoot.children).filter((elt) => elt.nodeName.toLowerCase() != "style");
42
33
  const length = children.length;
43
34
  expect(length).toBe(0);
44
- }));
35
+ });
@@ -43,6 +43,8 @@ declare const List_base: {
43
43
  key: string;
44
44
  isFirstLoad: boolean;
45
45
  isLoading: boolean;
46
+ lazyLoad?: boolean | undefined;
47
+ noLoader?: boolean | undefined;
46
48
  iObserver: IntersectionObserver | null;
47
49
  isDefaultLoaderEnabled: boolean;
48
50
  isFetchEnabled: boolean;
@@ -101,6 +103,8 @@ export declare class List extends List_base {
101
103
  * La propriété idKey est utilisé repérer les lignes de manière unique si pour les item de la liste item[this.idKey] n'existe pas, alors l'index est utilisé
102
104
  */
103
105
  idKey: string;
106
+ limit: number;
107
+ offset: number;
104
108
  connectedCallback(): void;
105
109
  disconnectedCallback(): void;
106
110
  renderLoadingState(): DirectiveResult<typeof TemplateContentDirective> | TemplateResult;
@@ -26,6 +26,8 @@ let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))
26
26
  * La propriété idKey est utilisé repérer les lignes de manière unique si pour les item de la liste item[this.idKey] n'existe pas, alors l'index est utilisé
27
27
  */
28
28
  this.idKey = "id";
29
+ this.limit = Number.POSITIVE_INFINITY;
30
+ this.offset = 0;
29
31
  }
30
32
  connectedCallback() {
31
33
  this.noShadowDom = "";
@@ -53,9 +55,7 @@ let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))
53
55
  gap: 0.5rem;"
54
56
  >
55
57
  <sonic-icon name="emoji-puzzled" size="lg"></sonic-icon
56
- ><span class="sonic-no-result-text"
57
- >${typeof this.props === "string" && this.props == "" ? "Aucun résultat" : this.props}</span
58
- >
58
+ ><span class="sonic-no-result-text">${typeof this.props === "string" && this.props == "" ? "Aucun résultat" : this.props}</span>
59
59
  </div>`;
60
60
  }
61
61
  formatProps() {
@@ -109,7 +109,7 @@ let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))
109
109
  /**
110
110
  * On peut définir un template spécifique si le résultat est un tableau vide
111
111
  */
112
- if (((props === null || props === void 0 ? void 0 : props.length) || 0) == 0 && this.templateParts["no-item"]) {
112
+ if ((props?.length || 0) == 0 && this.templateParts["no-item"]) {
113
113
  return templateContent(this.templateParts["no-item"]);
114
114
  }
115
115
  /**
@@ -119,9 +119,10 @@ let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))
119
119
  let counter = -1;
120
120
  const extractValues = this.hasAttribute("extractValues");
121
121
  const separator = this.templateParts["separator"];
122
- const length = (props === null || props === void 0 ? void 0 : props.length) || 0;
122
+ const length = props?.length || 0;
123
+ const items = props?.slice(this.offset, this.offset + this.limit);
123
124
  return html `
124
- ${props === null || props === void 0 ? void 0 : props.map((item, index) => {
125
+ ${items?.map((item, index) => {
125
126
  if (item == null)
126
127
  return nothing;
127
128
  let templatePart = null;
@@ -132,7 +133,7 @@ let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))
132
133
  templatePart = this.templateParts[templatePartName];
133
134
  }
134
135
  if (extractValues)
135
- key = item === null || item === void 0 ? void 0 : item["key"];
136
+ key = item?.["key"];
136
137
  }
137
138
  if (key == "_sonic_http_response_")
138
139
  return nothing;
@@ -147,7 +148,15 @@ let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))
147
148
  //La prop key est gardée pour le moment pour compatibilité
148
149
  //TODO : supprimer la prop key cquand c'est ok côté covoit.
149
150
  childPublisher._key_ = key + "";
150
- childPublisher._metadata_ = Object.assign(Object.assign({}, childPublisher._metadata_.get()), { key: key, even: indexMod2 == 0, odd: indexMod2 == 1, onlyChild: length == 1, firstChild: index == 0, lastChild: isLastChild });
151
+ childPublisher._metadata_ = {
152
+ ...childPublisher._metadata_.get(),
153
+ key: key,
154
+ even: indexMod2 == 0,
155
+ odd: indexMod2 == 1,
156
+ onlyChild: length == 1,
157
+ firstChild: index == 0,
158
+ lastChild: isLastChild,
159
+ };
151
160
  counter++;
152
161
  if (templatePart)
153
162
  counter = -1;
@@ -161,9 +170,7 @@ let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))
161
170
  .propertyMap?=${this.itemPropertyMap}
162
171
  dataProvider="${this.dataProvider}/list-item/${key}"
163
172
  >
164
- ${templatePart
165
- ? templateContent(templatePart)
166
- : templateContent(this.templateList[counter % templateCount])}
173
+ ${templatePart ? templateContent(templatePart) : templateContent(this.templateList[counter % templateCount])}
167
174
  </sonic-subscriber>
168
175
  ${separator && !isLastChild ? templateContent(separator) : nothing}
169
176
  `);
@@ -180,6 +187,12 @@ __decorate([
180
187
  __decorate([
181
188
  property({ type: String })
182
189
  ], List.prototype, "idKey", void 0);
190
+ __decorate([
191
+ property()
192
+ ], List.prototype, "limit", void 0);
193
+ __decorate([
194
+ property()
195
+ ], List.prototype, "offset", void 0);
183
196
  List = __decorate([
184
197
  customElement(tagName)
185
198
  ], List);
@@ -4,15 +4,6 @@ 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
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
8
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
9
- return new (P || (P = Promise))(function (resolve, reject) {
10
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
11
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
12
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
13
- step((generator = generator.apply(thisArg, _arguments || [])).next());
14
- });
15
- };
16
7
  var Queue_1;
17
8
  import { html, LitElement, nothing } from "lit";
18
9
  import { customElement, property } from "lit/decorators.js";
@@ -77,53 +68,38 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement, {}) {
77
68
  super.disconnectedCallback();
78
69
  return;
79
70
  }
80
- connectedCallback() {
81
- const _super = Object.create(null, {
82
- connectedCallback: { get: () => super.connectedCallback }
83
- });
84
- return __awaiter(this, void 0, void 0, function* () {
85
- this.instanceId = Queue_1.instanceCounter++;
86
- this.localStorage = this.getAttribute("localStorage") || this.localStorage;
87
- this.removeAttribute("localStorage");
88
- this.noShadowDom = "";
89
- this.defferedDebug = this.hasAttribute("debug") || null;
90
- /**Compat avec states et routing **/
91
- if (!this.dataProvider)
92
- this.dataProvider =
93
- this.dataProviderExpression ||
94
- "sonic-queue-" +
95
- this.instanceId +
96
- "-" +
97
- Math.random().toString(36).substring(7);
98
- if (!this.dataProviderExpression) {
99
- this.dataProviderExpression =
100
- HTML.getAncestorAttributeValue(this.parentElement, "dataProvider") ||
101
- "";
102
- }
103
- _super.connectedCallback.call(this);
104
- this.key = this.getAttribute("key");
105
- if (!this.templates)
106
- this.templates = Array.from(this.querySelectorAll("template"));
107
- this.lastRequestTime = new Date().getTime();
108
- yield PublisherManager.getInstance().isLocalStrorageReady;
109
- this.configFilter();
110
- });
71
+ async connectedCallback() {
72
+ this.instanceId = Queue_1.instanceCounter++;
73
+ this.localStorage = this.getAttribute("localStorage") || this.localStorage;
74
+ this.removeAttribute("localStorage");
75
+ this.noShadowDom = "";
76
+ this.defferedDebug = this.hasAttribute("debug") || null;
77
+ /**Compat avec states et routing **/
78
+ if (!this.dataProvider)
79
+ this.dataProvider = this.dataProviderExpression || "sonic-queue-" + this.instanceId + "-" + Math.random().toString(36).substring(7);
80
+ if (!this.dataProviderExpression) {
81
+ this.dataProviderExpression = HTML.getAncestorAttributeValue(this.parentElement, "dataProvider") || "";
82
+ }
83
+ super.connectedCallback();
84
+ this.key = this.getAttribute("key");
85
+ if (!this.templates)
86
+ this.templates = Array.from(this.querySelectorAll("template"));
87
+ this.lastRequestTime = new Date().getTime();
88
+ await PublisherManager.getInstance().isLocalStrorageReady;
89
+ this.configFilter();
111
90
  }
112
91
  configFilter() {
113
- var _a;
114
92
  const dataFilterProvider = this.getAncestorAttributeValue("dataFilterProvider");
115
93
  if (!dataFilterProvider) {
116
94
  this.next();
117
95
  return;
118
96
  }
119
- this.filterPublisher =
120
- PublisherManager.getInstance().get(dataFilterProvider);
121
- (_a = this.filterPublisher) === null || _a === void 0 ? void 0 : _a.onInternalMutation(() => {
97
+ this.filterPublisher = PublisherManager.getInstance().get(dataFilterProvider);
98
+ this.filterPublisher?.onInternalMutation(() => {
122
99
  this.updateFilteredContent();
123
100
  });
124
101
  }
125
102
  updateFilteredContent() {
126
- var _a;
127
103
  /**
128
104
  * On ne lance la recherche que si le hash de recherche est différent
129
105
  */
@@ -131,15 +107,13 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement, {}) {
131
107
  const split = dataProvider.split("?");
132
108
  split.shift();
133
109
  const searchParams = new URLSearchParams(split.join("?"));
134
- const filterData = (_a = this.filterPublisher) === null || _a === void 0 ? void 0 : _a.get();
110
+ const filterData = this.filterPublisher?.get();
135
111
  const filteredFieldsArray = this.filteredFields.split(" ");
136
112
  for (const f in filterData) {
137
113
  let value = filterData[f];
138
114
  if (Array.isArray(value))
139
115
  value = value.filter((v) => v !== null);
140
- if ((this.filteredFields && !filteredFieldsArray.includes(f)) ||
141
- value == null ||
142
- value.toString() === "")
116
+ if ((this.filteredFields && !filteredFieldsArray.includes(f)) || value == null || value.toString() === "")
143
117
  continue;
144
118
  searchParams.set(f, filterData[f].toString());
145
119
  }
@@ -155,22 +129,22 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement, {}) {
155
129
  }
156
130
  this.listDataProviders = [];
157
131
  clearTimeout(this.filterTimeoutId);
158
- this.filterTimeoutId = setTimeout(() => __awaiter(this, void 0, void 0, function* () {
132
+ this.filterTimeoutId = setTimeout(async () => {
159
133
  const count = this.resultCount;
160
134
  this.props = null;
161
135
  //On garde le décompte au cas ou il n'y aurait pas rechargement
162
136
  this.requestId++;
163
137
  this.resultCount = count;
164
- yield PublisherManager.getInstance().isLocalStrorageReady;
138
+ await PublisherManager.getInstance().isLocalStrorageReady;
165
139
  window.requestAnimationFrame(() => this.next());
166
- }), this.isFirstRequest ? 0 : 400);
140
+ }, this.isFirstRequest ? 0 : 400);
167
141
  this.isFirstRequest = false;
168
142
  }
169
143
  resetDuration() {
170
144
  this.lastRequestTime = new Date().getTime();
171
145
  }
172
146
  next(e) {
173
- var _a;
147
+ console.log("next", e);
174
148
  let offset = this.offset;
175
149
  const newTime = new Date().getTime();
176
150
  const requestDuration = newTime - this.lastRequestTime;
@@ -186,14 +160,15 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement, {}) {
186
160
  if (e) {
187
161
  if (e.detail.requestId < this.requestId)
188
162
  return;
163
+ console.log("next 2");
189
164
  this.resultCount += e.detail.props.length;
190
- if (!e.detail.isFirstLoad ||
191
- !e.detail.props.length ||
192
- this.dataProviderExpression.indexOf("$offset") == -1) {
165
+ if (!e.detail.isFirstLoad || !e.detail.props.length || this.dataProviderExpression.indexOf("$offset") == -1) {
193
166
  this.publisher.resultCount = this.resultCount;
194
167
  return;
195
168
  }
169
+ console.log("next 3");
196
170
  }
171
+ console.log("next 4");
197
172
  if (!Array.isArray(this.props)) {
198
173
  const newProps = [];
199
174
  newProps.resultCount = this.resultCount;
@@ -202,27 +177,23 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement, {}) {
202
177
  else {
203
178
  const props = this.props;
204
179
  const item = props[props.length - 1];
205
- offset =
206
- parseInt(item.offset.toString()) + parseInt(item.limit.toString());
180
+ offset = parseInt(item.offset.toString()) + parseInt(item.limit.toString());
207
181
  }
208
- if (requestDuration > 0 && e && !this.localStorage)
182
+ if (requestDuration > 0 && e && !this.localStorage) {
209
183
  this.limit = Math.round((this.limit / requestDuration) * this.targetRequestDuration);
184
+ }
210
185
  if (this.limit < 1)
211
186
  this.limit = 1;
212
187
  if (this.limit > 15)
213
188
  this.limit = 15;
214
- let dataProvider = this.dataProviderExpression
215
- .replace("$offset", offset + "")
216
- .replace("$limit", this.limit + "");
189
+ let dataProvider = this.dataProviderExpression.replace("$offset", offset + "").replace("$limit", this.limit + "");
217
190
  const split = dataProvider.split("?");
218
191
  const endpoint = split.shift();
219
192
  const searchParams = new URLSearchParams(split.join("?"));
220
- const filterData = (_a = this.filterPublisher) === null || _a === void 0 ? void 0 : _a.get();
193
+ const filterData = this.filterPublisher?.get();
221
194
  const filteredFieldsArray = this.filteredFields.split(" ");
222
195
  for (const f in filterData) {
223
- if ((this.filteredFields && filteredFieldsArray.includes(f)) ||
224
- filterData[f] == null ||
225
- filterData[f] == "")
196
+ if ((this.filteredFields && filteredFieldsArray.includes(f)) || filterData[f] == null || filterData[f] == "")
226
197
  continue;
227
198
  searchParams.set(f, filterData[f]);
228
199
  }
@@ -264,10 +235,7 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement, {}) {
264
235
  }
265
236
  return html `
266
237
  ${map(this.props, (item, index) => {
267
- var _a;
268
- const templates = index == 0
269
- ? this.templates
270
- : (_a = this.templates) === null || _a === void 0 ? void 0 : _a.filter((elt) => elt.getAttribute("data-value") != "no-item");
238
+ const templates = index == 0 ? this.templates : this.templates?.filter((elt) => elt.getAttribute("data-value") != "no-item");
271
239
  return html `
272
240
  <sonic-list
273
241
  fetch
@@ -76,7 +76,6 @@ let SonicRouter = class SonicRouter extends Subscriber(TemplatesContainer(LitEle
76
76
  template;
77
77
  return index + new Date().getTime();
78
78
  }, (template) => {
79
- var _a;
80
79
  if (template.title)
81
80
  document.title = template.title;
82
81
  if (template.hasAttribute("dataProviderExpression")) {
@@ -91,7 +90,7 @@ let SonicRouter = class SonicRouter extends Subscriber(TemplatesContainer(LitEle
91
90
  const regexp = new RegExp(template.getAttribute(this.templateValueAttribute) || "");
92
91
  const match = (this.location + "").match(regexp);
93
92
  if (match) {
94
- dataProvider = ((_a = match.shift()) === null || _a === void 0 ? void 0 : _a.replace(regexp, dataProviderExpression)) || "";
93
+ dataProvider = match.shift()?.replace(regexp, dataProviderExpression) || "";
95
94
  }
96
95
  }
97
96
  return html `<div style="display:contents" dataProvider="${dataProvider}">${templateContent(template)}</div>`;
@@ -1,12 +1,3 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
1
  export default class SDUIDescriptorTransformer {
11
2
  /**
12
3
  * Tranform un SDUIDescriptor via une SDUITransformDescription
@@ -16,18 +7,16 @@ export default class SDUIDescriptorTransformer {
16
7
  * * Ensuite des actions de transformations sont menées sur les nodes du SDUIDescriptor
17
8
  *
18
9
  */
19
- transform(sduiDescriptor, transformDescriptor) {
20
- return __awaiter(this, void 0, void 0, function* () {
21
- this.sduiDescriptor = sduiDescriptor;
22
- if (this.sduiDescriptor.library) {
23
- for (const key in transformDescriptor.library) {
24
- this.sduiDescriptor.library[key] = transformDescriptor.library[key];
25
- }
26
- }
27
- for (const item of transformDescriptor.transforms) {
28
- this.transformAction(item);
10
+ async transform(sduiDescriptor, transformDescriptor) {
11
+ this.sduiDescriptor = sduiDescriptor;
12
+ if (this.sduiDescriptor.library) {
13
+ for (const key in transformDescriptor.library) {
14
+ this.sduiDescriptor.library[key] = transformDescriptor.library[key];
29
15
  }
30
- });
16
+ }
17
+ for (const item of transformDescriptor.transforms) {
18
+ this.transformAction(item);
19
+ }
31
20
  }
32
21
  /**
33
22
  * Effectue une actions de transformation sur les noeuds (nodes) de la sduiDescriptor (SDUIDescriptor)
@@ -97,12 +86,11 @@ export default class SDUIDescriptorTransformer {
97
86
  * Pour chaque élément de la liste, remplace l'élément par ses enfants
98
87
  */
99
88
  unwrap(transformAction, list) {
100
- var _a, _b;
101
89
  transformAction;
102
90
  for (const item of list) {
103
- (_a = item.parent.nodes) === null || _a === void 0 ? void 0 : _a.splice(item.parent.nodes.indexOf(item.child), 1);
91
+ item.parent.nodes?.splice(item.parent.nodes.indexOf(item.child), 1);
104
92
  if (item.child.nodes) {
105
- (_b = item.parent.nodes) === null || _b === void 0 ? void 0 : _b.splice(item.parent.nodes.indexOf(item.child), 0, ...item.child.nodes);
93
+ item.parent.nodes?.splice(item.parent.nodes.indexOf(item.child), 0, ...item.child.nodes);
106
94
  }
107
95
  }
108
96
  }
@@ -111,31 +99,29 @@ export default class SDUIDescriptorTransformer {
111
99
  * L'élément créé est inséré en lieu et place du premier élément de la liste
112
100
  */
113
101
  wrap(transformAction, list) {
114
- var _a, _b, _c, _d, _e, _f;
115
- const wrapper = Object.assign({}, transformAction.ui);
102
+ const wrapper = { ...transformAction.ui };
116
103
  if (!wrapper.nodes)
117
104
  wrapper.nodes = [];
118
105
  let i = 0;
119
106
  for (const item of list) {
120
- (_a = wrapper.nodes) === null || _a === void 0 ? void 0 : _a.push(item.child);
107
+ wrapper.nodes?.push(item.child);
121
108
  if (i > 0) {
122
- (_b = item.parent.nodes) === null || _b === void 0 ? void 0 : _b.splice(item.parent.nodes.indexOf(item.child), 1);
109
+ item.parent.nodes?.splice(item.parent.nodes.indexOf(item.child), 1);
123
110
  }
124
111
  i++;
125
112
  }
126
- const idx = (_d = (_c = list[0]) === null || _c === void 0 ? void 0 : _c.parent.nodes) === null || _d === void 0 ? void 0 : _d.indexOf(list[0].child);
113
+ const idx = list[0]?.parent.nodes?.indexOf(list[0].child);
127
114
  if (idx) {
128
- (_e = list[0].parent.nodes) === null || _e === void 0 ? void 0 : _e.splice(idx, 1);
129
- (_f = list[0].parent.nodes) === null || _f === void 0 ? void 0 : _f.splice(idx, 0, wrapper);
115
+ list[0].parent.nodes?.splice(idx, 1);
116
+ list[0].parent.nodes?.splice(idx, 0, wrapper);
130
117
  }
131
118
  }
132
119
  /**
133
120
  * Déplace tous les noeuds de la liste avant ou après le noeuds sélectionné par pattern matching via l'attribut correspondant `before` ou `after`
134
121
  */
135
122
  move(transformAction, list) {
136
- var _a, _b;
137
123
  for (const item of list) {
138
- (_a = item.parent.nodes) === null || _a === void 0 ? void 0 : _a.splice(item.parent.nodes.indexOf(item.child), 1);
124
+ item.parent.nodes?.splice(item.parent.nodes.indexOf(item.child), 1);
139
125
  let list = [];
140
126
  if (transformAction.after)
141
127
  list = this.getNodesMatchingPatterns([transformAction.after], this.sduiDescriptor);
@@ -143,7 +129,7 @@ export default class SDUIDescriptorTransformer {
143
129
  list = this.getNodesMatchingPatterns([transformAction.before], this.sduiDescriptor);
144
130
  const element = list[0];
145
131
  if (element) {
146
- (_b = element.parent.nodes) === null || _b === void 0 ? void 0 : _b.splice(element.parent.nodes.indexOf(element.child) + (transformAction.after ? 1 : 0), 0, item.child);
132
+ element.parent.nodes?.splice(element.parent.nodes.indexOf(element.child) + (transformAction.after ? 1 : 0), 0, item.child);
147
133
  }
148
134
  }
149
135
  }
@@ -152,9 +138,8 @@ export default class SDUIDescriptorTransformer {
152
138
  * Les props attributs et autre props de chaque élément sont conservés si non remapés
153
139
  */
154
140
  remap(transformAction, list) {
155
- var _a, _b, _c;
156
141
  for (const item of list) {
157
- const newUI = Object.assign({}, transformAction.ui);
142
+ const newUI = { ...transformAction.ui };
158
143
  if (!newUI.attributes) {
159
144
  newUI.attributes = {};
160
145
  }
@@ -181,10 +166,10 @@ export default class SDUIDescriptorTransformer {
181
166
  newUI.nodes.push(node);
182
167
  }
183
168
  }
184
- const idx = ((_a = item.parent.nodes) === null || _a === void 0 ? void 0 : _a.indexOf(item.child)) || -1;
169
+ const idx = item.parent.nodes?.indexOf(item.child) || -1;
185
170
  if (idx != -1) {
186
- (_b = item.parent.nodes) === null || _b === void 0 ? void 0 : _b.splice(idx, 1);
187
- (_c = item.parent.nodes) === null || _c === void 0 ? void 0 : _c.splice(idx, 0, newUI);
171
+ item.parent.nodes?.splice(idx, 1);
172
+ item.parent.nodes?.splice(idx, 0, newUI);
188
173
  }
189
174
  }
190
175
  }
@@ -192,10 +177,9 @@ export default class SDUIDescriptorTransformer {
192
177
  * Supprime tous les éléments de la liste.
193
178
  */
194
179
  delete(transformAction, list) {
195
- var _a;
196
180
  transformAction;
197
181
  for (const item of list) {
198
- (_a = item.parent.nodes) === null || _a === void 0 ? void 0 : _a.splice(item.parent.nodes.indexOf(item.child), 1);
182
+ item.parent.nodes?.splice(item.parent.nodes.indexOf(item.child), 1);
199
183
  }
200
184
  }
201
185
  /**
@@ -203,7 +187,6 @@ export default class SDUIDescriptorTransformer {
203
187
  * La positione st déterminée par l'attribute before ou after ou in qui est un pattern permettant la sélection de l'élément de référence pur l'ajout
204
188
  */
205
189
  insert(transformAction, list) {
206
- var _a;
207
190
  const positionType = transformAction.after ? "after" : transformAction.before ? "before" : "in";
208
191
  list = [];
209
192
  if (transformAction.after) {
@@ -220,10 +203,12 @@ export default class SDUIDescriptorTransformer {
220
203
  if (positionType == "in") {
221
204
  if (!node.child.nodes)
222
205
  node.child.nodes = [];
223
- node.child.nodes.push(Object.assign({}, transformAction.ui));
206
+ node.child.nodes.push({ ...transformAction.ui });
224
207
  }
225
208
  else {
226
- (_a = node.parent.nodes) === null || _a === void 0 ? void 0 : _a.splice(node.parent.nodes.indexOf(node.child) + (positionType == "after" ? 1 : 0), 0, Object.assign({}, transformAction.ui));
209
+ node.parent.nodes?.splice(node.parent.nodes.indexOf(node.child) + (positionType == "after" ? 1 : 0), 0, {
210
+ ...transformAction.ui,
211
+ });
227
212
  }
228
213
  }
229
214
  }
@@ -6,6 +6,8 @@ declare const SonicSDUI_base: {
6
6
  key: string;
7
7
  isFirstLoad: boolean;
8
8
  isLoading: boolean;
9
+ lazyLoad?: boolean | undefined;
10
+ noLoader?: boolean | undefined;
9
11
  iObserver: IntersectionObserver | null;
10
12
  isDefaultLoaderEnabled: boolean;
11
13
  isFetchEnabled: boolean;