@supersoniks/concorde 1.1.44 → 1.1.46

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 (54) hide show
  1. package/README.md +9 -7
  2. package/concorde-core.bundle.js +39 -24
  3. package/concorde-core.es.js +907 -320
  4. package/core/components/functional/fetch/fetch.d.ts +2 -1
  5. package/core/components/functional/list/list.d.ts +3 -1
  6. package/core/components/functional/list/list.js +12 -7
  7. package/core/components/functional/queue/queue.d.ts +9 -2
  8. package/core/components/functional/queue/queue.js +131 -67
  9. package/core/components/functional/router/router.js +13 -4
  10. package/core/components/functional/sdui/sdui.d.ts +3 -2
  11. package/core/components/functional/sdui/sdui.js +1 -1
  12. package/core/components/functional/states/states.js +1 -0
  13. package/core/components/functional/value/value.js +3 -2
  14. package/core/components/ui/alert/alert.d.ts +3 -0
  15. package/core/components/ui/alert/alert.js +33 -1
  16. package/core/components/ui/badge/badge.d.ts +1 -1
  17. package/core/components/ui/badge/badge.js +9 -3
  18. package/core/components/ui/button/button.d.ts +1 -0
  19. package/core/components/ui/button/button.js +32 -28
  20. package/core/components/ui/form/checkbox/checkbox.d.ts +3 -0
  21. package/core/components/ui/form/checkbox/checkbox.js +14 -3
  22. package/core/components/ui/form/css/form-control.d.ts +1 -0
  23. package/core/components/ui/form/css/form-control.js +17 -0
  24. package/core/components/ui/form/input/input.d.ts +5 -3
  25. package/core/components/ui/form/input/input.js +47 -3
  26. package/core/components/ui/form/input-autocomplete/input-autocomplete.d.ts +93 -13
  27. package/core/components/ui/form/input-autocomplete/input-autocomplete.js +181 -52
  28. package/core/components/ui/form/select/select.js +16 -4
  29. package/core/components/ui/form/textarea/textarea.d.ts +1 -0
  30. package/core/components/ui/group/group.js +7 -1
  31. package/core/components/ui/icon/icon.js +1 -1
  32. package/core/components/ui/modal/modal-close.js +2 -3
  33. package/core/components/ui/modal/modal-content.js +1 -0
  34. package/core/components/ui/modal/modal.d.ts +8 -0
  35. package/core/components/ui/modal/modal.js +34 -6
  36. package/core/components/ui/pop/pop.d.ts +5 -4
  37. package/core/components/ui/pop/pop.js +85 -44
  38. package/core/components/ui/theme/theme-collection/core-variables.js +18 -9
  39. package/core/components/ui/theme/theme.js +8 -3
  40. package/core/components/ui/tooltip/tooltip.js +3 -3
  41. package/core/mixins/Fetcher.d.ts +2 -1
  42. package/core/mixins/Fetcher.js +42 -10
  43. package/core/mixins/FormCheckable.d.ts +1 -0
  44. package/core/mixins/FormElement.d.ts +1 -0
  45. package/core/mixins/FormElement.js +6 -2
  46. package/core/mixins/FormInput.d.ts +1 -0
  47. package/core/mixins/Subscriber.d.ts +1 -0
  48. package/core/mixins/Subscriber.js +17 -12
  49. package/core/utils/PublisherProxy.d.ts +30 -3
  50. package/core/utils/PublisherProxy.js +218 -6
  51. package/core/utils/api.d.ts +29 -3
  52. package/core/utils/api.js +117 -24
  53. package/mixins.d.ts +4 -1
  54. package/package.json +7 -2
@@ -19,7 +19,7 @@ declare const Fetch_base: {
19
19
  onInvalidate?: (() => void) | undefined;
20
20
  disconnectedCallback(): void;
21
21
  connectedCallback(): void;
22
- firstUpdated(): void;
22
+ handleLazyLoad(): void;
23
23
  onIntersection(entries: IntersectionObserverEntry[]): void;
24
24
  propertyMap: object;
25
25
  isConnected: boolean;
@@ -45,6 +45,7 @@ declare const Fetch_base: {
45
45
  requestUpdate(): void;
46
46
  getAttribute(name: string): string;
47
47
  hasAttribute(attributeName: string): boolean;
48
+ getBoundingClientRect(): DOMRect;
48
49
  };
49
50
  } & (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface<import("../../../_types/types").CoreJSType>) & typeof LitElement;
50
51
  /**
@@ -24,7 +24,7 @@ declare const List_base: {
24
24
  onInvalidate?: (() => void) | undefined;
25
25
  disconnectedCallback(): void;
26
26
  connectedCallback(): void;
27
- firstUpdated(): void;
27
+ handleLazyLoad(): void;
28
28
  onIntersection(entries: IntersectionObserverEntry[]): void;
29
29
  propertyMap: object;
30
30
  isConnected: boolean;
@@ -50,6 +50,7 @@ declare const List_base: {
50
50
  requestUpdate(): void;
51
51
  getAttribute(name: string): string;
52
52
  hasAttribute(attributeName: string): boolean;
53
+ getBoundingClientRect(): DOMRect;
53
54
  };
54
55
  } & (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/Subscriber").SubscriberInterface<import("../../../_types/types").CoreJSType>) & (new (...args: any[]) => import("@supersoniks/concorde/core/mixins/TemplatesContainer").TemplatesContainerInterface) & typeof LitElement;
55
56
  /**
@@ -81,6 +82,7 @@ export declare class List extends List_base {
81
82
  */
82
83
  idKey: string;
83
84
  connectedCallback(): void;
85
+ disconnectedCallback(): void;
84
86
  renderLoadingState(): DirectiveResult<typeof TemplateContentDirective> | TemplateResult;
85
87
  renderNoResultState(): TemplateResult<1>;
86
88
  formatProps(): (import("../../../_types/types").CoreJSType[] & {
@@ -53,6 +53,9 @@ let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))
53
53
  this.isLoading = true;
54
54
  super.connectedCallback();
55
55
  }
56
+ disconnectedCallback() {
57
+ super.disconnectedCallback();
58
+ }
56
59
  renderLoadingState() {
57
60
  return this.templateParts["skeleton"]
58
61
  ? templateContent(this.templateParts["skeleton"])
@@ -85,7 +88,7 @@ let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))
85
88
  props = Object.entries(props).map(([k, v]) => ({ key: k, value: v }));
86
89
  }
87
90
  else {
88
- if (!response || response.ok)
91
+ if (Objects.isObject(props) && Object.keys(props).length > 0 && (!response || response.ok))
89
92
  props = [props];
90
93
  else {
91
94
  props = [];
@@ -138,14 +141,16 @@ let List = class List extends Fetcher(Subscriber(TemplatesContainer(LitElement))
138
141
  ${props === null || props === void 0 ? void 0 : props.map((item, index) => {
139
142
  if (item == null)
140
143
  return nothing;
141
- if (typeof item != "object" || Array.isArray(item))
142
- return nothing;
143
- const templatePartName = item[this.templateKey];
144
144
  let templatePart = null;
145
- if (templatePartName && typeof templatePartName == "string") {
146
- templatePart = this.templateParts[templatePartName];
145
+ let key = index;
146
+ if (typeof item == "object" && !Array.isArray(item)) {
147
+ const templatePartName = item[this.templateKey];
148
+ if (templatePartName && typeof templatePartName == "string") {
149
+ templatePart = this.templateParts[templatePartName];
150
+ }
151
+ if (extractValues)
152
+ key = item === null || item === void 0 ? void 0 : item["key"];
147
153
  }
148
- const key = extractValues ? item === null || item === void 0 ? void 0 : item[this.idKey] : index;
149
154
  if (key == "_sonic_http_response_")
150
155
  return nothing;
151
156
  if (typeof key != "string" && typeof key != "number")
@@ -3,6 +3,7 @@ import "@supersoniks/concorde/core/components/functional/list/list";
3
3
  import { PublisherProxy } from "@supersoniks/concorde/core/utils/PublisherProxy";
4
4
  type QueueItem = {
5
5
  id: string;
6
+ endPoint: string;
6
7
  dataProvider: string;
7
8
  offset: number;
8
9
  limit: number;
@@ -14,7 +15,7 @@ declare const Queue_base: (new (...args: any[]) => import("@supersoniks/concorde
14
15
  /**
15
16
  *### Une Queue charge du contenu par lot selon l'expression renseignée dans l'attribut *dataProviderExpression*.
16
17
  * * Chaque lot est chargé par un composant [List](./?path=/docs/core-components-functional-list-list--basic) dont le dataProvider créé à partir de l'attribut dataProviderExpression
17
- * * A l'initialisation elle regarde l'attribut dataFilterProvider qui donne l'adresse d'un [publisher](./?path=/docs/how-to-🥨-dialogue-inter-composant--page)
18
+ * * A l'initialisation elle regarde l'attribut dataFilterProvider qui donne l'adresse d'un publisher
18
19
  * Si cet attribut est touvé, Queue écoute le publisher fourni et se réinitialise à chaque modification du contenu de celui-ci.
19
20
  * Les valeurs renseignées dans ce publisher sont ajoutées en get à chaque requête
20
21
  * * la proriété *key* peut être utilisé pour cibler une propriété particulière du retour de l'api.
@@ -27,19 +28,25 @@ export default class Queue extends Queue_base {
27
28
  /**
28
29
  * Durée cible en ms d'une requête pour afficher 1 lot.
29
30
  */
31
+ cache: RequestCache;
30
32
  targetRequestDuration: number;
31
33
  limit: number;
34
+ lazyBoundsRatio: number;
32
35
  offset: number;
33
36
  resultCount: number;
37
+ noLazyload: boolean;
34
38
  filteredFields: string;
35
39
  disconnectedCallback(): void;
36
40
  static instanceCounter: number;
37
- connectedCallback(): void;
41
+ instanceId: number;
42
+ localStorage: string;
43
+ connectedCallback(): Promise<void>;
38
44
  filterPublisher: PublisherProxy | null;
39
45
  configFilter(): void;
40
46
  filterTimeoutId?: ReturnType<typeof setTimeout>;
41
47
  searchHash: string;
42
48
  requestId: number;
49
+ isFirstRequest: boolean;
43
50
  updateFilteredContent(): void;
44
51
  /**
45
52
  * Cette expression est utilisée comme modèle par le composant Queue pour renseigngner le dataProvider de la [liste](./?path=/docs/core-components-functional-list-list--basic) créée.
@@ -4,11 +4,20 @@ 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
+ };
7
16
  var Queue_1;
8
17
  import { html, LitElement, nothing } from "lit";
9
18
  import { customElement, property } from "lit/decorators.js";
10
19
  import Subscriber from "@supersoniks/concorde/core/mixins/Subscriber";
11
- import { repeat } from "lit/directives/repeat.js";
20
+ import { map } from "lit/directives/map.js";
12
21
  import { PublisherManager } from "@supersoniks/concorde/core/utils/PublisherProxy";
13
22
  import "@supersoniks/concorde/core/components/functional/list/list";
14
23
  import { HTML } from "@supersoniks/concorde/utils";
@@ -16,7 +25,7 @@ const tagName = "sonic-queue";
16
25
  /**
17
26
  *### Une Queue charge du contenu par lot selon l'expression renseignée dans l'attribut *dataProviderExpression*.
18
27
  * * Chaque lot est chargé par un composant [List](./?path=/docs/core-components-functional-list-list--basic) dont le dataProvider créé à partir de l'attribut dataProviderExpression
19
- * * A l'initialisation elle regarde l'attribut dataFilterProvider qui donne l'adresse d'un [publisher](./?path=/docs/how-to-🥨-dialogue-inter-composant--page)
28
+ * * A l'initialisation elle regarde l'attribut dataFilterProvider qui donne l'adresse d'un publisher
20
29
  * Si cet attribut est touvé, Queue écoute le publisher fourni et se réinitialise à chaque modification du contenu de celui-ci.
21
30
  * Les valeurs renseignées dans ce publisher sont ajoutées en get à chaque requête
22
31
  * * la proriété *key* peut être utilisé pour cibler une propriété particulière du retour de l'api.
@@ -31,18 +40,24 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement, {}) {
31
40
  /**
32
41
  * Durée cible en ms d'une requête pour afficher 1 lot.
33
42
  */
43
+ this.cache = "default";
34
44
  this.targetRequestDuration = 500;
35
45
  /*
36
46
  * Quantité d'éléments devant être chargés dans le premier lot.
37
47
  * Cette valeur est mise à jour ensuite par Queue pour chauq lot pour se rapprocher tanque possible de *targetRequestDuration*
38
48
  */
39
49
  this.limit = 5;
50
+ this.lazyBoundsRatio = 1;
40
51
  this.offset = 0;
41
52
  this.resultCount = 0;
53
+ this.noLazyload = false;
42
54
  this.filteredFields = "";
55
+ this.instanceId = 0;
56
+ this.localStorage = "disabled";
43
57
  this.filterPublisher = null;
44
58
  this.searchHash = "";
45
59
  this.requestId = 0;
60
+ this.isFirstRequest = true;
46
61
  /**
47
62
  * Cette expression est utilisée comme modèle par le composant Queue pour renseigngner le dataProvider de la [liste](./?path=/docs/core-components-functional-list-list--basic) créée.
48
63
  * * l'expression *$offset* est alors remplacée par le numéro de l'élément à partir duquel démarrer
@@ -63,33 +78,47 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement, {}) {
63
78
  return;
64
79
  }
65
80
  connectedCallback() {
66
- this.noShadowDom = "";
67
- this.defferedDebug = this.hasAttribute("debug") || null;
68
- /**Compat avec states et routing **/
69
- if (!this.dataProviderExpression) {
70
- this.dataProviderExpression = HTML.getAncestorAttributeValue(this.parentElement, "dataProvider") || "";
71
- }
72
- if (!this.dataProvider)
73
- this.dataProvider = "sonic-queue-" + Queue_1.instanceCounter++;
74
- this.configFilter();
75
- super.connectedCallback();
76
- this.key = this.getAttribute("key");
77
- if (!this.templates)
78
- this.templates = Array.from(this.querySelectorAll("template"));
79
- this.lastRequestTime = new Date().getTime();
80
- let func = window.requestAnimationFrame;
81
- func(() => this.next());
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
+ });
82
111
  }
83
112
  configFilter() {
84
113
  var _a;
85
114
  const dataFilterProvider = this.getAncestorAttributeValue("dataFilterProvider");
86
- if (!dataFilterProvider)
115
+ if (!dataFilterProvider) {
116
+ this.next();
87
117
  return;
88
- this.filterPublisher = PublisherManager.getInstance().get(dataFilterProvider);
118
+ }
119
+ this.filterPublisher =
120
+ PublisherManager.getInstance().get(dataFilterProvider);
89
121
  (_a = this.filterPublisher) === null || _a === void 0 ? void 0 : _a.onInternalMutation(() => {
90
- var _a;
91
- if (Object.keys((_a = this.filterPublisher) === null || _a === void 0 ? void 0 : _a.get()).length == 0)
92
- return;
93
122
  this.updateFilteredContent();
94
123
  });
95
124
  }
@@ -101,19 +130,21 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement, {}) {
101
130
  const dataProvider = this.dataProviderExpression;
102
131
  const split = dataProvider.split("?");
103
132
  split.shift();
104
- let searchParams = new URLSearchParams(split.join("?"));
105
- let filterData = (_a = this.filterPublisher) === null || _a === void 0 ? void 0 : _a.get();
106
- let filteredFieldsArray = this.filteredFields.split(" ");
107
- for (let f in filterData) {
133
+ const searchParams = new URLSearchParams(split.join("?"));
134
+ const filterData = (_a = this.filterPublisher) === null || _a === void 0 ? void 0 : _a.get();
135
+ const filteredFieldsArray = this.filteredFields.split(" ");
136
+ for (const f in filterData) {
108
137
  let value = filterData[f];
109
138
  if (Array.isArray(value))
110
139
  value = value.filter((v) => v !== null);
111
- if ((this.filteredFields && !filteredFieldsArray.includes(f)) || value == null || value.toString() === "")
140
+ if ((this.filteredFields && !filteredFieldsArray.includes(f)) ||
141
+ value == null ||
142
+ value.toString() === "")
112
143
  continue;
113
144
  searchParams.set(f, filterData[f].toString());
114
145
  }
115
146
  const searchHash = searchParams.toString();
116
- if (searchHash == this.searchHash)
147
+ if (searchHash == this.searchHash && !this.isFirstRequest)
117
148
  return;
118
149
  this.searchHash = searchHash;
119
150
  /**
@@ -124,20 +155,22 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement, {}) {
124
155
  }
125
156
  this.listDataProviders = [];
126
157
  clearTimeout(this.filterTimeoutId);
127
- this.filterTimeoutId = setTimeout(() => {
158
+ this.filterTimeoutId = setTimeout(() => __awaiter(this, void 0, void 0, function* () {
128
159
  const count = this.resultCount;
129
160
  this.props = null;
130
161
  //On garde le décompte au cas ou il n'y aurait pas rechargement
131
- this.resultCount = count;
132
162
  this.requestId++;
133
- this.next();
134
- }, 250);
163
+ this.resultCount = count;
164
+ yield PublisherManager.getInstance().isLocalStrorageReady;
165
+ window.requestAnimationFrame(() => this.next());
166
+ }), this.isFirstRequest ? 0 : 400);
167
+ this.isFirstRequest = false;
135
168
  }
136
169
  resetDuration() {
137
170
  this.lastRequestTime = new Date().getTime();
138
171
  }
139
172
  next(e) {
140
- var _a, _b;
173
+ var _a;
141
174
  let offset = this.offset;
142
175
  const newTime = new Date().getTime();
143
176
  const requestDuration = newTime - this.lastRequestTime;
@@ -146,14 +179,17 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement, {}) {
146
179
  * Un ne repasse donc à 0 qu'à partir du premier chargement.
147
180
  * */
148
181
  if (!this.nextHadEvent && e) {
182
+ this.publisher.resultCount = 0;
149
183
  this.resultCount = 0;
150
184
  }
151
185
  this.nextHadEvent = !!e;
152
186
  if (e) {
153
- if (e.detail.requestId != this.requestId)
187
+ if (e.detail.requestId < this.requestId)
154
188
  return;
155
189
  this.resultCount += e.detail.props.length;
156
- if (!e.detail.isFirstLoad || !e.detail.props.length || this.dataProviderExpression.indexOf("$offset") == -1) {
190
+ if (!e.detail.isFirstLoad ||
191
+ !e.detail.props.length ||
192
+ this.dataProviderExpression.indexOf("$offset") == -1) {
157
193
  this.publisher.resultCount = this.resultCount;
158
194
  return;
159
195
  }
@@ -166,22 +202,27 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement, {}) {
166
202
  else {
167
203
  const props = this.props;
168
204
  const item = props[props.length - 1];
169
- offset = parseInt(item.offset.toString()) + parseInt(item.limit.toString());
205
+ offset =
206
+ parseInt(item.offset.toString()) + parseInt(item.limit.toString());
170
207
  }
171
- if (requestDuration > 0 && e)
208
+ if (requestDuration > 0 && e && !this.localStorage)
172
209
  this.limit = Math.round((this.limit / requestDuration) * this.targetRequestDuration);
173
210
  if (this.limit < 1)
174
211
  this.limit = 1;
175
212
  if (this.limit > 15)
176
213
  this.limit = 15;
177
- let dataProvider = this.dataProviderExpression.replace("$offset", offset + "").replace("$limit", this.limit + "");
214
+ let dataProvider = this.dataProviderExpression
215
+ .replace("$offset", offset + "")
216
+ .replace("$limit", this.limit + "");
178
217
  const split = dataProvider.split("?");
179
218
  const endpoint = split.shift();
180
219
  const searchParams = new URLSearchParams(split.join("?"));
181
220
  const filterData = (_a = this.filterPublisher) === null || _a === void 0 ? void 0 : _a.get();
182
221
  const filteredFieldsArray = this.filteredFields.split(" ");
183
222
  for (const f in filterData) {
184
- if ((this.filteredFields && !filteredFieldsArray.includes(f)) || filterData[f] == null)
223
+ if ((this.filteredFields && filteredFieldsArray.includes(f)) ||
224
+ filterData[f] == null ||
225
+ filterData[f] == "")
185
226
  continue;
186
227
  searchParams.set(f, filterData[f]);
187
228
  }
@@ -189,12 +230,13 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement, {}) {
189
230
  this.searchHash = searchParams.toString();
190
231
  dataProvider = endpoint + "?" + searchParams.toString();
191
232
  this.listDataProviders.push(dataProvider);
192
- this.currentScrollPosition = (_b = document.scrollingElement) === null || _b === void 0 ? void 0 : _b.scrollTop;
233
+ // this.currentScrollPosition = document.scrollingElement?.scrollTop;
193
234
  const newProps = [
194
235
  ...this.props,
195
236
  {
196
237
  id: searchParams.toString() + "/" + this.props.length,
197
- dataProvider: dataProvider,
238
+ dataProvider: dataProvider + "_item_from_queue_" + this.instanceId,
239
+ endPoint: dataProvider,
198
240
  offset: offset,
199
241
  limit: this.limit,
200
242
  },
@@ -204,36 +246,49 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement, {}) {
204
246
  this.lastRequestTime = new Date().getTime();
205
247
  }
206
248
  render() {
207
- if (this.currentScrollPosition) {
208
- window.requestAnimationFrame(() => {
209
- if (document.scrollingElement && this.currentScrollPosition != undefined)
210
- document.scrollingElement.scrollTop = this.currentScrollPosition;
211
- this.currentScrollPosition = undefined;
212
- });
213
- }
249
+ /**
250
+ * supression du retablisment de la scroll pos.
251
+ **/
252
+ // if (this.currentScrollPosition) {
253
+ // window.requestAnimationFrame(() => {
254
+ // if (document.scrollingElement && this.currentScrollPosition != undefined)
255
+ // document.scrollingElement.scrollTop = this.currentScrollPosition;
256
+ // this.currentScrollPosition = undefined;
257
+ // });
258
+ // }
214
259
  if (!Array.isArray(this.props))
215
260
  return nothing;
261
+ let lazyload = !this.noLazyload;
262
+ if (this.props.length == 1) {
263
+ lazyload = false;
264
+ }
216
265
  return html `
217
- ${repeat(this.props, (item) => item.id, (item, index) => {
266
+ ${map(this.props, (item, index) => {
218
267
  var _a;
219
- const templates = index == 0 ? this.templates : (_a = this.templates) === null || _a === void 0 ? void 0 : _a.filter((elt) => elt.getAttribute("data-value") != "no-item");
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");
220
271
  return html `
221
- <sonic-list
222
- fetch
223
- displayContents
224
- lazyload
225
- requestId=${this.requestId}
226
- .itemPropertyMap=${this.itemPropertyMap}
227
- ?debug=${this.defferedDebug === true}
228
- @load=${this.next}
229
- key=${this.key}
230
- @loading=${this.resetDuration}
231
- dataProvider="${item.dataProvider}"
232
- idKey=${this.idKey}
233
- .templates=${templates}
234
- >
235
- </sonic-list>
236
- `;
272
+ <sonic-list
273
+ fetch
274
+ cache=${this.cache}
275
+ displayContents
276
+ lazyBoundsRatio=${this.lazyBoundsRatio}
277
+ ?lazyload=${lazyload}
278
+ localStorage=${this.localStorage}
279
+ requestId=${this.requestId}
280
+ .itemPropertyMap=${this.itemPropertyMap}
281
+ ?debug=${this.defferedDebug === true}
282
+ @load=${this.next}
283
+ key=${this.key}
284
+ @loading=${this.resetDuration}
285
+ dataProvider="${item.dataProvider}"
286
+ endPoint="${item.endPoint}"
287
+ idKey=${this.idKey}
288
+ .templates=${templates}
289
+ >
290
+ </sonic-list>
291
+ `;
237
292
  })}
238
293
  `;
239
294
  }
@@ -245,18 +300,27 @@ __decorate([
245
300
  __decorate([
246
301
  property({ type: Object })
247
302
  ], Queue.prototype, "itemPropertyMap", void 0);
303
+ __decorate([
304
+ property()
305
+ ], Queue.prototype, "cache", void 0);
248
306
  __decorate([
249
307
  property()
250
308
  ], Queue.prototype, "targetRequestDuration", void 0);
251
309
  __decorate([
252
310
  property()
253
311
  ], Queue.prototype, "limit", void 0);
312
+ __decorate([
313
+ property()
314
+ ], Queue.prototype, "lazyBoundsRatio", void 0);
254
315
  __decorate([
255
316
  property()
256
317
  ], Queue.prototype, "offset", void 0);
257
318
  __decorate([
258
319
  property()
259
320
  ], Queue.prototype, "resultCount", void 0);
321
+ __decorate([
322
+ property({ type: Boolean })
323
+ ], Queue.prototype, "noLazyload", void 0);
260
324
  __decorate([
261
325
  property()
262
326
  ], Queue.prototype, "filteredFields", void 0);
@@ -54,13 +54,22 @@ let SonicRouter = class SonicRouter extends Subscriber(TemplatesContainer(LitEle
54
54
  for (const t of this.templatePartsList) {
55
55
  const path = t.getAttribute(this.templateValueAttribute) || "";
56
56
  const regexp = new RegExp(path);
57
- const urlPattern = new UrlPattern(path);
58
57
  if (regexp.test(this.location)) {
59
58
  templates.push(t);
60
59
  }
61
- else if (urlPattern.match(this.location)) {
62
- t.setAttribute("mode", "patternMatching");
63
- templates.push(t);
60
+ else {
61
+ try {
62
+ if (new UrlPattern(path).match(this.location)) {
63
+ t.setAttribute("mode", "patternMatching");
64
+ templates.push(t);
65
+ }
66
+ }
67
+ catch (e) {
68
+ if (this.location.indexOf(path.replace(document.location.origin, "")) != -1) {
69
+ templates.push(t);
70
+ }
71
+ ;
72
+ }
64
73
  }
65
74
  }
66
75
  return html `${repeat(templates, (template, index) => {
@@ -19,7 +19,7 @@ declare const SonicSDUI_base: {
19
19
  onInvalidate?: (() => void) | undefined;
20
20
  disconnectedCallback(): void;
21
21
  connectedCallback(): void;
22
- firstUpdated(): void;
22
+ handleLazyLoad(): void;
23
23
  onIntersection(entries: IntersectionObserverEntry[]): void;
24
24
  propertyMap: object;
25
25
  isConnected: boolean;
@@ -45,6 +45,7 @@ declare const SonicSDUI_base: {
45
45
  requestUpdate(): void;
46
46
  getAttribute(name: string): string;
47
47
  hasAttribute(attributeName: string): boolean;
48
+ getBoundingClientRect(): DOMRect;
48
49
  };
49
50
  } & (new (...args: any[]) => import("../../../mixins/Subscriber").SubscriberInterface<import("../../../_types/types").CoreJSType>) & typeof LitElement;
50
51
  /**
@@ -55,7 +56,7 @@ declare const SonicSDUI_base: {
55
56
  * * Si le composant possède un attribut *fetch*, il charge un contenu via un appel d'api web.<br>
56
57
  * Voir [fetcher](./?path=/docs/core-components-functional-fetch--basic) pour la configuration des autres attributs.
57
58
  * * Le format du JSON est décrit par le type SDUIDescriptor
58
- * * Un attribut supplémentaire `transformation` permet de transformer le json reçu avant la générationd e l'interface utilisateur<br>
59
+ * * Un attribut supplémentaire `transformation` permet de transformer le json reçu avant la génération de l'interface utilisateur<br>
59
60
  * Son format est décrit par le type SDUITransformDescription
60
61
  *
61
62
  * * Si le résultat de la requête est un objet, il est imbriqué dans un tableau pour garantir le fonctionnement.<br>
@@ -28,7 +28,7 @@ const tagName = "sonic-sdui"; // For Astro.build
28
28
  * * Si le composant possède un attribut *fetch*, il charge un contenu via un appel d'api web.<br>
29
29
  * Voir [fetcher](./?path=/docs/core-components-functional-fetch--basic) pour la configuration des autres attributs.
30
30
  * * Le format du JSON est décrit par le type SDUIDescriptor
31
- * * Un attribut supplémentaire `transformation` permet de transformer le json reçu avant la générationd e l'interface utilisateur<br>
31
+ * * Un attribut supplémentaire `transformation` permet de transformer le json reçu avant la génération de l'interface utilisateur<br>
32
32
  * Son format est décrit par le type SDUITransformDescription
33
33
  *
34
34
  * * Si le résultat de la requête est un objet, il est imbriqué dans un tableau pour garantir le fonctionnement.<br>
@@ -40,6 +40,7 @@ let SonicStates = class SonicStates extends Subscriber(TemplatesContainer(LitEle
40
40
  };
41
41
  }
42
42
  connectedCallback() {
43
+ this.noShadowDom = "";
43
44
  super.connectedCallback();
44
45
  if (this.hasAttribute("data-path")) {
45
46
  this.statePath = this.getAttribute("data-path");
@@ -15,9 +15,10 @@ let SonicValue = class SonicValue extends Subscriber(LitElement) {
15
15
  super.connectedCallback();
16
16
  }
17
17
  render() {
18
- if (typeof this.props !== "string")
18
+ if (typeof this.props === "object" || this.props === undefined)
19
19
  return html `<slot name="prefix"></slot><slot></slot><slot name="suffix"></slot>`;
20
- return html `${unsafeHTML(this.props)}<slot name="prefix"></slot><slot></slot><slot name="suffix"></slot>`;
20
+ return html `${unsafeHTML(this.props.toString())}<slot name="prefix"></slot><slot></slot
21
+ ><slot name="suffix"></slot>`;
21
22
  }
22
23
  };
23
24
  SonicValue = __decorate([
@@ -9,12 +9,15 @@ export declare class Alert extends LitElement {
9
9
  * Titre du message d'erreur
10
10
  */
11
11
  label: string;
12
+ noIcon: boolean;
12
13
  /**
13
14
  * Peut être renseigné dans le slot pour créer des messages plus complexes
14
15
  */
15
16
  text: string;
16
17
  size?: "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
18
+ dismissible: boolean;
17
19
  background: boolean;
18
20
  status: "default" | "error" | "warning" | "primary" | "info";
19
21
  render(): import("lit-html").TemplateResult<1>;
22
+ close(): void;
20
23
  }