@supersoniks/concorde 3.1.78 → 3.1.79

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supersoniks/concorde",
3
- "version": "3.1.78",
3
+ "version": "3.1.79",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "",
@@ -182,6 +182,32 @@ export class Input extends FormInput(FormElement(Subscriber(LitElement))) {
182
182
  // this.type = this.isPassword ? "password" : "text";
183
183
  }
184
184
 
185
+ /**
186
+ * Code a réfléchir et tester a l'occasion :
187
+ * le changement programmatique de la valeur de l'input ne renvoie pas d'événement change.
188
+ * On pourrait le faire en surchargeant la propriété value de l'input.
189
+ */
190
+ // protected firstUpdated(_changedProperties: PropertyValues): void {
191
+ // super.firstUpdated(_changedProperties);
192
+ // const descriptor = Object.getOwnPropertyDescriptor(
193
+ // HTMLInputElement.prototype,
194
+ // "value"
195
+ // );
196
+ // const that = this;
197
+ // Object.defineProperty(this.input, "value", {
198
+ // get() {
199
+ // return descriptor?.get?.call(this);
200
+ // },
201
+ // set(val) {
202
+ // const oldValue = this.value;
203
+ // if (val !== oldValue) {
204
+ // descriptor?.set?.call(this, val);
205
+ // that.input.dispatchEvent(new Event("input"));
206
+ // }
207
+ // },
208
+ // });
209
+ // }
210
+
185
211
  render() {
186
212
  const slotClasses = {
187
213
  "has-prefix": this.hasPrefix,
@@ -23,7 +23,6 @@ import { Input } from "@supersoniks/concorde/core/components/ui/form/input/input
23
23
  import { customScroll } from "@supersoniks/concorde/core/components/ui/_css/scroll";
24
24
  import { ResizeController } from "@lit-labs/observers/resize-controller.js";
25
25
  import { traverseDotNotation } from "@supersoniks/concorde/core/utils/Objects";
26
- import { FormElementValue } from "@supersoniks/concorde/core/mixins/FormElement";
27
26
 
28
27
  type ListItem = Record<string, string>;
29
28
 
@@ -87,6 +86,7 @@ export class InputAutocomplete extends TemplatesContainer(
87
86
  private initSearchDataProvider = "";
88
87
  private queueDataProvider = "";
89
88
  private initQueueDataProvider = "";
89
+ @state()
90
90
  private lastValidSearch: ListItem | string = "";
91
91
  private searchPublisher?: PublisherProxy;
92
92
  private countPublisher?: PublisherProxy;
@@ -100,15 +100,6 @@ export class InputAutocomplete extends TemplatesContainer(
100
100
  this.hasInputPrefix = !!this.slotInputPrefixNodes?.length;
101
101
  }
102
102
 
103
- override get value() {
104
- return super.value;
105
- }
106
-
107
- override set value(value: FormElementValue) {
108
- this.searchPublisher?.set(value);
109
- super.value = value;
110
- }
111
-
112
103
  /**
113
104
  * Run when the formDataProvider's field is updated
114
105
  *
@@ -126,15 +117,16 @@ export class InputAutocomplete extends TemplatesContainer(
126
117
  );
127
118
  // Si la liste de this.queueDataProvider est bien initialisée, mais qu'aucun item ne correspond à la recherche
128
119
  // On affiche quand même la valeur dans le champ de recherche, car il provient directement du formDataProvider
129
- if (
130
- found === false &&
131
- (!this.searchParameter || this.searchParameter === this.name)
132
- ) {
120
+ if (found === false && this.isSearchParameter()) {
133
121
  this.lastValidSearch = value;
134
122
  this.searchPublisher?.set(this.lastValidSearch);
135
123
  }
136
124
  };
137
125
 
126
+ private isSearchParameter() {
127
+ return !this.searchParameter || this.searchParameter === this.name;
128
+ }
129
+
138
130
  private updatePopContentVisibility = (value: string) => {
139
131
  this.isPopVisible = (value?.length || 0) >= this.minSearchLength;
140
132
  };
@@ -176,7 +168,9 @@ export class InputAutocomplete extends TemplatesContainer(
176
168
  this.propertyName === "_self"
177
169
  ? listItem
178
170
  : listItem[this.searchParameter || this.propertyName || this.name];
179
- this.searchPublisher?.set(this.lastValidSearch);
171
+ if (this.isSearchParameter()) {
172
+ this.searchPublisher?.set(this.lastValidSearch);
173
+ }
180
174
  };
181
175
  private updateActiveSelection = () => {
182
176
  this.queryQueueListItem(
@@ -310,12 +304,19 @@ export class InputAutocomplete extends TemplatesContainer(
310
304
  if (!this.select) return;
311
305
  if (this.searchPublisher?.get() == "") {
312
306
  this.lastValidSearch = "";
313
- this.formValuePublisher?.set("");
307
+ this.formValuePublisher?.set("")
314
308
  return;
315
309
  }
316
310
  this.searchPublisher?.set(this.lastValidSearch);
317
311
  }
318
312
 
313
+ getInputValue() {
314
+ if (!this.isSearchParameter()) {
315
+ return this.lastValidSearch;
316
+ }
317
+ return this.searchPublisher?.get();
318
+ }
319
+
319
320
  render() {
320
321
  return html`
321
322
  <sonic-pop noToggle style="display:block;" @hide=${this.handleHide}>
@@ -328,13 +329,14 @@ export class InputAutocomplete extends TemplatesContainer(
328
329
  label="${ifDefined(this.label)}"
329
330
  description="${ifDefined(this.description)}"
330
331
  name="${ifDefined(this.searchParameter || this.name)}"
332
+ ?required=${this.required}
331
333
  placeholder="${ifDefined(this.placeholder)}"
332
334
  ?readonly="${this.readonly}"
333
335
  autocomplete="off"
334
336
  clearable
335
337
  inlineContent
336
338
  size=${this.size}
337
- value="${ifDefined(this.searchPublisher?.get() || this.value)}"
339
+ value=${ifDefined(this.getInputValue())}
338
340
  >
339
341
  <slot
340
342
  name="prefix"
@@ -181,7 +181,9 @@ const Form = <T extends Constructor<SubscriberInterface>>(superClass: T) => {
181
181
  (value as { _value?: CoreJSType })._value == undefined
182
182
  )
183
183
  value = "";
184
- if (this._value == value) return;
184
+ if (this._value == value) {
185
+ return;
186
+ }
185
187
  this._value = value;
186
188
  this.updateDataValue();
187
189
  this.requestUpdate();
@@ -1 +1 @@
1
- {"root":["./components.ts","./concorde-loaded.ts","./decorators.ts","./directives.ts","./index.ts","./mixins.ts","./utils.ts","./core/core.ts","./core/_types/types.ts","./core/components/functional/functional.ts","./core/components/functional/date/date.ts","./core/components/functional/example/example.ts","./core/components/functional/fetch/fetch.ts","./core/components/functional/if/if.test.ts","./core/components/functional/if/if.ts","./core/components/functional/list/list.demo.ts","./core/components/functional/list/list.spec.ts","./core/components/functional/list/list.ts","./core/components/functional/mix/mix.ts","./core/components/functional/queue/queue.demo.ts","./core/components/functional/queue/queue.ts","./core/components/functional/router/redirect.ts","./core/components/functional/router/router.demo.ts","./core/components/functional/router/router.spec.ts","./core/components/functional/router/router.ts","./core/components/functional/sdui/SDUIDescriptorTransformer.ts","./core/components/functional/sdui/sdui-utils.ts","./core/components/functional/sdui/sdui.ts","./core/components/functional/sdui/types.ts","./core/components/functional/sonic-scope/sonic-scope.ts","./core/components/functional/states/states.demo.ts","./core/components/functional/states/states.spec.ts","./core/components/functional/states/states.ts","./core/components/functional/submit/submit.ts","./core/components/functional/subscriber/subscriber.ts","./core/components/functional/translation/translation.ts","./core/components/functional/value/value.ts","./core/components/ui/ui.ts","./core/components/ui/_css/scroll.ts","./core/components/ui/_css/shadow.ts","./core/components/ui/_css/size.ts","./core/components/ui/_css/type.ts","./core/components/ui/alert/alert.ts","./core/components/ui/alert-messages/alert-messages.ts","./core/components/ui/badge/badge.ts","./core/components/ui/button/button.ts","./core/components/ui/captcha/captcha.ts","./core/components/ui/card/card-footer.ts","./core/components/ui/card/card-header-descripton.ts","./core/components/ui/card/card-header.ts","./core/components/ui/card/card-main.ts","./core/components/ui/card/card.ts","./core/components/ui/divider/divider.ts","./core/components/ui/form/checkbox/checkbox.ts","./core/components/ui/form/css/form-control.ts","./core/components/ui/form/fieldset/fieldset.ts","./core/components/ui/form/fieldset/legend-description.ts","./core/components/ui/form/fieldset/legend.ts","./core/components/ui/form/form-actions/form-actions.ts","./core/components/ui/form/form-layout/form-layout.ts","./core/components/ui/form/input/input.ts","./core/components/ui/form/input/password-helper.ts","./core/components/ui/form/input/same-value-helper.ts","./core/components/ui/form/input-autocomplete/input-autocomplete.ts","./core/components/ui/form/radio/radio.ts","./core/components/ui/form/select/select.ts","./core/components/ui/form/switch/switch.ts","./core/components/ui/form/textarea/textarea.ts","./core/components/ui/group/group.ts","./core/components/ui/icon/icon.stories.ts","./core/components/ui/icon/icon.ts","./core/components/ui/icon/icons.ts","./core/components/ui/image/image.ts","./core/components/ui/link/link.ts","./core/components/ui/loader/loader.stories.ts","./core/components/ui/loader/loader.ts","./core/components/ui/loader/styles/fixed.ts","./core/components/ui/loader/styles/inline.ts","./core/components/ui/menu/menu-item.ts","./core/components/ui/menu/menu.ts","./core/components/ui/modal/modal-actions.ts","./core/components/ui/modal/modal-close.ts","./core/components/ui/modal/modal-content.ts","./core/components/ui/modal/modal-subtitle.ts","./core/components/ui/modal/modal-title.ts","./core/components/ui/modal/modal.stories.ts","./core/components/ui/modal/modal.ts","./core/components/ui/pop/pop.ts","./core/components/ui/progress/progress.ts","./core/components/ui/table/table-caption.ts","./core/components/ui/table/table-tbody.ts","./core/components/ui/table/table-td.ts","./core/components/ui/table/table-tfoot.ts","./core/components/ui/table/table-th.ts","./core/components/ui/table/table-thead.ts","./core/components/ui/table/table-tr.ts","./core/components/ui/table/table.ts","./core/components/ui/theme/theme.ts","./core/components/ui/theme/theme-collection/core-variables.ts","./core/components/ui/theme/theme-collection/dark.ts","./core/components/ui/theme/theme-collection/light.ts","./core/components/ui/toast/message-subscriber.stories.ts","./core/components/ui/toast/message-subscriber.ts","./core/components/ui/toast/toast-item.ts","./core/components/ui/toast/toast.ts","./core/components/ui/toast/types.ts","./core/components/ui/tooltip/tooltip.ts","./core/decorators/Subscriber.ts","./core/directives/DataProvider.ts","./core/directives/Wording.ts","./core/mixins/Fetcher.ts","./core/mixins/FormCheckable.ts","./core/mixins/FormElement.ts","./core/mixins/FormInput.ts","./core/mixins/Subscriber.ts","./core/mixins/TemplatesContainer.ts","./core/mixins/mixins.ts","./core/utils/Arrays.ts","./core/utils/DataBindObserver.ts","./core/utils/Electron.ts","./core/utils/Format.ts","./core/utils/HTML.ts","./core/utils/LocationHandler.ts","./core/utils/Objects.ts","./core/utils/PublisherProxy.ts","./core/utils/Utils.ts","./core/utils/aesCrypto.ts","./core/utils/api.ts","./core/utils/route.spec.ts","./core/utils/route.ts","./core/utils/url-pattern.ts","./test-utils/TestUtils.ts"],"version":"5.6.3"}
1
+ {"root":["./components.ts","./concorde-loaded.ts","./decorators.ts","./directives.ts","./index.ts","./mixins.ts","./utils.ts","./core/core.ts","./core/_types/types.ts","./core/components/functional/functional.ts","./core/components/functional/date/date.ts","./core/components/functional/example/example.ts","./core/components/functional/fetch/fetch.ts","./core/components/functional/if/if.test.ts","./core/components/functional/if/if.ts","./core/components/functional/list/list.demo.ts","./core/components/functional/list/list.spec.ts","./core/components/functional/list/list.ts","./core/components/functional/mix/mix.ts","./core/components/functional/queue/queue.demo.ts","./core/components/functional/queue/queue.ts","./core/components/functional/router/redirect.ts","./core/components/functional/router/router.demo.ts","./core/components/functional/router/router.spec.ts","./core/components/functional/router/router.ts","./core/components/functional/sdui/SDUIDescriptorTransformer.ts","./core/components/functional/sdui/sdui-utils.ts","./core/components/functional/sdui/sdui.ts","./core/components/functional/sdui/types.ts","./core/components/functional/sonic-scope/sonic-scope.ts","./core/components/functional/states/states.demo.ts","./core/components/functional/states/states.spec.ts","./core/components/functional/states/states.ts","./core/components/functional/submit/submit.ts","./core/components/functional/subscriber/subscriber.ts","./core/components/functional/translation/translation.ts","./core/components/functional/value/value.ts","./core/components/ui/ui.ts","./core/components/ui/_css/scroll.ts","./core/components/ui/_css/shadow.ts","./core/components/ui/_css/size.ts","./core/components/ui/_css/type.ts","./core/components/ui/alert/alert.ts","./core/components/ui/alert-messages/alert-messages.ts","./core/components/ui/badge/badge.ts","./core/components/ui/button/button.ts","./core/components/ui/captcha/captcha.ts","./core/components/ui/card/card-footer.ts","./core/components/ui/card/card-header-descripton.ts","./core/components/ui/card/card-header.ts","./core/components/ui/card/card-main.ts","./core/components/ui/card/card.ts","./core/components/ui/divider/divider.ts","./core/components/ui/form/checkbox/checkbox.ts","./core/components/ui/form/css/form-control.ts","./core/components/ui/form/fieldset/fieldset.ts","./core/components/ui/form/fieldset/legend-description.ts","./core/components/ui/form/fieldset/legend.ts","./core/components/ui/form/form-actions/form-actions.ts","./core/components/ui/form/form-layout/form-layout.ts","./core/components/ui/form/input/input.ts","./core/components/ui/form/input/password-helper.ts","./core/components/ui/form/input/same-value-helper.ts","./core/components/ui/form/input-autocomplete/input-autocomplete.ts","./core/components/ui/form/radio/radio.ts","./core/components/ui/form/select/select.ts","./core/components/ui/form/switch/switch.ts","./core/components/ui/form/textarea/textarea.ts","./core/components/ui/group/group.ts","./core/components/ui/icon/icon.stories.ts","./core/components/ui/icon/icon.ts","./core/components/ui/icon/icons.ts","./core/components/ui/image/image.ts","./core/components/ui/link/link.ts","./core/components/ui/loader/loader.stories.ts","./core/components/ui/loader/loader.ts","./core/components/ui/loader/styles/fixed.ts","./core/components/ui/loader/styles/inline.ts","./core/components/ui/menu/menu-item.ts","./core/components/ui/menu/menu.ts","./core/components/ui/modal/modal-actions.ts","./core/components/ui/modal/modal-close.ts","./core/components/ui/modal/modal-content.ts","./core/components/ui/modal/modal-subtitle.ts","./core/components/ui/modal/modal-title.ts","./core/components/ui/modal/modal.stories.ts","./core/components/ui/modal/modal.ts","./core/components/ui/pop/pop.ts","./core/components/ui/progress/progress.ts","./core/components/ui/table/table-caption.ts","./core/components/ui/table/table-tbody.ts","./core/components/ui/table/table-td.ts","./core/components/ui/table/table-tfoot.ts","./core/components/ui/table/table-th.ts","./core/components/ui/table/table-thead.ts","./core/components/ui/table/table-tr.ts","./core/components/ui/table/table.ts","./core/components/ui/theme/theme.ts","./core/components/ui/theme/theme-collection/core-variables.ts","./core/components/ui/theme/theme-collection/dark.ts","./core/components/ui/theme/theme-collection/light.ts","./core/components/ui/toast/message-subscriber.stories.ts","./core/components/ui/toast/message-subscriber.ts","./core/components/ui/toast/toast-item.ts","./core/components/ui/toast/toast.ts","./core/components/ui/toast/types.ts","./core/components/ui/tooltip/tooltip.ts","./core/decorators/Subscriber.ts","./core/directives/DataProvider.ts","./core/directives/Wording.ts","./core/mixins/Fetcher.ts","./core/mixins/FormCheckable.ts","./core/mixins/FormElement.ts","./core/mixins/FormInput.ts","./core/mixins/Subscriber.ts","./core/mixins/TemplatesContainer.ts","./core/mixins/mixins.ts","./core/utils/Arrays.ts","./core/utils/DataBindObserver.ts","./core/utils/Electron.ts","./core/utils/Format.ts","./core/utils/HTML.ts","./core/utils/LocationHandler.ts","./core/utils/Objects.ts","./core/utils/PublisherProxy.ts","./core/utils/Utils.ts","./core/utils/aesCrypto.ts","./core/utils/api.ts","./core/utils/route.spec.ts","./core/utils/route.ts","./core/utils/url-pattern.ts","./test-utils/TestUtils.ts"],"errors":true,"version":"5.6.3"}