chrv-components 1.12.144 → 1.12.146

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.
Binary file
@@ -4363,20 +4363,21 @@ class ChrInputComponent {
4363
4363
  };
4364
4364
  this.ensureDefaultDisplayValue = () => {
4365
4365
  const value = this.value() || this.ngControl()?.value;
4366
- const type = this.type();
4367
4366
  if (value === null || value === undefined) {
4368
4367
  this.displayValue.set('');
4369
- return;
4370
4368
  }
4369
+ else
4370
+ this.displayValue.set(this.formatValue(value));
4371
+ };
4372
+ this.formatValue = (value) => {
4373
+ const type = this.type();
4371
4374
  switch (type) {
4372
4375
  case 'date':
4373
- this.displayValue.set(formatDate$1(value, 'yyyy-MM-dd'));
4374
- break;
4376
+ return formatDate$1(value, 'yyyy-MM-dd');
4375
4377
  case 'datetime':
4376
- this.displayValue.set(formatDate$1(value, "yyyy-MM-dd'T'HH:mm"));
4377
- break;
4378
+ return formatDate$1(value, "yyyy-MM-dd'T'HH:mm");
4378
4379
  default:
4379
- this.displayValue.set(value);
4380
+ return value;
4380
4381
  }
4381
4382
  };
4382
4383
  this.onChange = (value) => {
@@ -4392,10 +4393,10 @@ class ChrInputComponent {
4392
4393
  }
4393
4394
  else
4394
4395
  this._changeSubject.next(value);
4395
- // this.input.emit(value);
4396
4396
  };
4397
4397
  this.writeValue = (value) => {
4398
4398
  this.value.set(value ?? null);
4399
+ this.displayValue.set(this.formatValue(value));
4399
4400
  };
4400
4401
  this.registerOnChange = (fn) => {
4401
4402
  this._onChange = (v) => {
@@ -4446,13 +4447,14 @@ class ChrInputComponent {
4446
4447
  : status;
4447
4448
  };
4448
4449
  this.ngControl.set(inject(NgControl, { optional: true, self: true }));
4450
+ this.ensureNgControl();
4449
4451
  }
4450
4452
  // public valueChanges = output<any>();
4451
4453
  /* CODE */
4452
4454
  ngOnInit() {
4453
4455
  this.configureDebouncing();
4454
4456
  this.configureEventListeners();
4455
- this.ensureNgControl();
4457
+ // this.ensureNgControl();
4456
4458
  this.ensureOutputType();
4457
4459
  this.ensureDefaultDisplayValue();
4458
4460
  }
@@ -4654,8 +4656,12 @@ class ChrSearchSelectInputComponent extends ChrInputComponent {
4654
4656
  ...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
4655
4657
  this.display = input((v) => v || '', /* @ts-ignore */
4656
4658
  ...(ngDevMode ? [{ debugName: "display" }] : /* istanbul ignore next */ []));
4657
- this.writeValue = (value) => {
4658
- this.value.set(value);
4659
+ this.formatValue = (value) => {
4660
+ const displayFn = this.display();
4661
+ const formated = displayFn(value);
4662
+ if (formated == undefined || formated == null)
4663
+ return '';
4664
+ return formated;
4659
4665
  };
4660
4666
  /**
4661
4667
  * Force the value to be null when the user types.
@@ -4673,13 +4679,6 @@ class ChrSearchSelectInputComponent extends ChrInputComponent {
4673
4679
  }
4674
4680
  ngOnInit() {
4675
4681
  super.ngOnInit();
4676
- const value = this.value();
4677
- const displayFn = this.display();
4678
- if (value === null || value === undefined) {
4679
- this.displayValue.set('');
4680
- }
4681
- else
4682
- this.displayValue.set(displayFn(value));
4683
4682
  }
4684
4683
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ChrSearchSelectInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
4685
4684
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: ChrSearchSelectInputComponent, isStandalone: true, selector: "chr-search-select-input", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, display: { classPropertyName: "display", publicName: "display", isSignal: true, isRequired: false, transformFunction: null } }, usesInheritance: true, ngImport: i0, template: "<div class=\"search-select-input-wrapper\">\n <chr-input [id]=\"id()\" [name]=\"name()\" type=\"text\" [label]=\"label()\" [displayValue]=\"displayValue()\"\n [value]=\"displayValue()\" (input)=\"dl.open();onInput($event);\">\n <chr-input-indicators>\n <!-- @if(isFocused()){ -->\n @if(value() == null){\n <span class=\"material-symbols selection-status-indicator error\">close</span>\n }@else {\n <span class=\"material-symbols selection-status-indicator success\">check</span>\n }\n <span class=\"selection-status-indicator\" style=\"width: 1rem; \"></span>\n <!-- } -->\n </chr-input-indicators>\n <chr-input-data-overlay>\n <chr-data-list #dl [for]=\"''+name()\" [suggestions]=\"data()\" [display]=\"display()\" [selectOnFullMatch]=\"true\"\n (optionSelected)=\"selectOption($event.value)\"></chr-data-list>\n </chr-input-data-overlay>\n </chr-input>\n</div>", styles: [":host{display:flex;flex-direction:column;flex:1 1 auto;justify-self:stretch;align-self:center;min-width:0}.search-select-input-wrapper{position:relative}.selection-status-indicator.success{color:var(--success-color)}.selection-status-indicator.error{color:var(--error-color)}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "component", type: ChrInputComponent, selector: "chr-input", inputs: ["label", "id", "name", "value", "displayValue", "type", "outputType", "step", "debounceTime", "isDisabled", "isFocused", "min", "max", "minLength", "maxLength", "ngControl", "tooltip", "tooltipPosition"], outputs: ["idChange", "nameChange", "valueChange", "displayValueChange", "outputTypeChange", "isDisabledChange", "isFocusedChange", "ngControlChange", "input", "debouncedInput", "focus", "enter", "blur"] }, { kind: "component", type: ChrInputIndicators, selector: "chr-input-indicators" }, { kind: "component", type: DataListComponent, selector: "chr-data-list", inputs: ["suggestions", "for", "allowStringify", "display", "targetElement", "blurOnSelect", "selectOnFullMatch"], outputs: ["optionSelected"] }, { kind: "component", type: ChrInputDataOverlay, selector: "chr-input-data-overlay" }] }); }
@@ -4705,8 +4704,8 @@ class ChrTagSelectInputComponent extends ChrInputComponent {
4705
4704
  ...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
4706
4705
  this.display = input((v) => v || '', /* @ts-ignore */
4707
4706
  ...(ngDevMode ? [{ debugName: "display" }] : /* istanbul ignore next */ []));
4708
- this.writeValue = (value) => {
4709
- this.value.set(value);
4707
+ this.formatValue = (value) => {
4708
+ return '';
4710
4709
  };
4711
4710
  /**
4712
4711
  * Signal calculé renvoyant le tableau d'éléments sélectionnés