@dsivd/prestations-ng 15.2.3-beta11 → 15.2.3-beta14

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.
@@ -6553,6 +6553,122 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
6553
6553
  }]
6554
6554
  }] });
6555
6555
 
6556
+ // eslint-disable max-classes-per-file
6557
+ // eslint-disable-next-line prefer-arrow/prefer-arrow-functions,jsdoc/require-jsdoc
6558
+ function removeFormatting(value) {
6559
+ if (value === undefined || value === null) {
6560
+ // It's important to return null as the backend will consider this as no value.
6561
+ return null;
6562
+ }
6563
+ return value
6564
+ .toString()
6565
+ .trim()
6566
+ .replace(new RegExp(THOUSANDS_SEPARATOR, 'g'), '');
6567
+ }
6568
+ // eslint-disable-next-line prefer-arrow/prefer-arrow-functions,jsdoc/require-jsdoc
6569
+ function formatWithThousandSeparators(value) {
6570
+ return value.replace(CURRENCY_REGEXP, THOUSANDS_SEPARATOR);
6571
+ }
6572
+ // eslint-disable-next-line prefer-arrow/prefer-arrow-functions,jsdoc/require-jsdoc
6573
+ function formatDecimalCurrency(value, maxDecimalCount, maxLength, allowFreeInput) {
6574
+ if (value === undefined || value === null || value === '') {
6575
+ return null;
6576
+ }
6577
+ const [intg, dec] = removeFormatting(value).split(DECIMALS_SEPARATOR);
6578
+ if (allowFreeInput) {
6579
+ return (formatWithThousandSeparators(intg) +
6580
+ DECIMALS_SEPARATOR +
6581
+ (dec || '0').padEnd(maxDecimalCount, '0'));
6582
+ }
6583
+ if (maxDecimalCount === 0 || !maxDecimalCount) {
6584
+ return formatWithThousandSeparators(intg);
6585
+ }
6586
+ const validEmptyEnd = '0'.repeat(maxDecimalCount);
6587
+ let newEnd = dec ? dec + validEmptyEnd : validEmptyEnd;
6588
+ if (newEnd && newEnd.length >= maxDecimalCount) {
6589
+ newEnd = newEnd.substring(0, maxDecimalCount);
6590
+ }
6591
+ let newDecimal = intg + DECIMALS_SEPARATOR + newEnd;
6592
+ if (newDecimal.length > maxLength) {
6593
+ newDecimal = newDecimal.substring(0, maxLength);
6594
+ }
6595
+ [, newEnd] = newDecimal.split(DECIMALS_SEPARATOR);
6596
+ if (!newEnd) {
6597
+ return formatWithThousandSeparators(intg);
6598
+ }
6599
+ return formatWithThousandSeparators(intg) + DECIMALS_SEPARATOR + newEnd;
6600
+ }
6601
+ // eslint-disable-next-line prefer-arrow/prefer-arrow-functions,jsdoc/require-jsdoc
6602
+ function formatNonDecimalCurrency(value) {
6603
+ if (value === undefined || value === null) {
6604
+ return null;
6605
+ }
6606
+ return formatWithThousandSeparators(removeFormatting(value));
6607
+ }
6608
+ // eslint-disable-next-line @angular-eslint/directive-selector
6609
+ class NumberCurrencyFormatterDirective {
6610
+ constructor(host, ngZone) {
6611
+ this.host = host;
6612
+ this.ngZone = ngZone;
6613
+ this.hasFocus = false;
6614
+ }
6615
+ onBlur(value) {
6616
+ this.hasFocus = false;
6617
+ this.setFormatting(value);
6618
+ }
6619
+ onFocus(value) {
6620
+ this.hasFocus = true;
6621
+ this.host.forceUpdateNgModel(removeFormatting(value));
6622
+ }
6623
+ onModelChange(value) {
6624
+ if (!!value && !this.hasFocus) {
6625
+ this.setFormatting(value);
6626
+ }
6627
+ }
6628
+ ngOnInit() {
6629
+ // sometimes, when the view is "simple" and doesn't require lot a processing
6630
+ // we arrive in this method with this.host.model not already initialized, so the formatting is not working
6631
+ this.ngZone.onMicrotaskEmpty.pipe(first()).subscribe(() => {
6632
+ this.setFormatting(this.host.model);
6633
+ });
6634
+ }
6635
+ setFormatting(value) {
6636
+ // Hooks on the inputs of the component to customize the behavior
6637
+ const formattedValue = this.host.allowDecimal
6638
+ ? formatDecimalCurrency(value, this.host.maxDecimalCount, this.host.maxlength, this.host.allowFreeInput)
6639
+ : formatNonDecimalCurrency(value);
6640
+ const newValueWithoutFormatting = removeFormatting(formattedValue);
6641
+ if (this.hasValueChanged(newValueWithoutFormatting)) {
6642
+ // Since we have altered the model (i.e. by removing some decimals), we have to update it
6643
+ this.host.updateNgModel(newValueWithoutFormatting);
6644
+ }
6645
+ // Due to ngModel being possibly updated, we need to wait for a micro task empty
6646
+ this.ngZone.onMicrotaskEmpty.pipe(first()).subscribe(() => {
6647
+ // We're injection non-decimal characters, hence the force.
6648
+ this.host.forceUpdateNgModel(formattedValue);
6649
+ });
6650
+ }
6651
+ hasValueChanged(newValueWithoutFormatting) {
6652
+ return (!this.host.model ||
6653
+ this.host.model.toString() !== newValueWithoutFormatting);
6654
+ }
6655
+ }
6656
+ NumberCurrencyFormatterDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NumberCurrencyFormatterDirective, deps: [{ token: FoehnInputNumberComponent }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
6657
+ NumberCurrencyFormatterDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: NumberCurrencyFormatterDirective, selector: "[numberCurrencyFormatter]", host: { listeners: { "blur": "onBlur($event.target.value)", "focus": "onFocus($event.target.value)", "modelChange": "onModelChange($event)" } }, ngImport: i0 });
6658
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NumberCurrencyFormatterDirective, decorators: [{
6659
+ type: Directive,
6660
+ args: [{ selector: '[numberCurrencyFormatter]' }]
6661
+ }], ctorParameters: function () { return [{ type: FoehnInputNumberComponent }, { type: i0.NgZone }]; }, propDecorators: { onBlur: [{
6662
+ type: HostListener,
6663
+ args: ['blur', ['$event.target.value']]
6664
+ }], onFocus: [{
6665
+ type: HostListener,
6666
+ args: ['focus', ['$event.target.value']]
6667
+ }], onModelChange: [{
6668
+ type: HostListener,
6669
+ args: ['modelChange', ['$event']]
6670
+ }] } });
6671
+
6556
6672
  class FoehnInputNumberComponent extends FoehnInputStringComponent {
6557
6673
  constructor(currencyHelper, dictionaryService) {
6558
6674
  super();
@@ -6560,6 +6676,7 @@ class FoehnInputNumberComponent extends FoehnInputStringComponent {
6560
6676
  this.dictionaryService = dictionaryService;
6561
6677
  this.hideStandardHelpText = false;
6562
6678
  this.maxDecimalCount = 2;
6679
+ this.allowFreeInput = false;
6563
6680
  }
6564
6681
  get model() {
6565
6682
  // If the setter is overridden, it's critical to override the getter too.
@@ -6584,15 +6701,31 @@ class FoehnInputNumberComponent extends FoehnInputStringComponent {
6584
6701
  this.maxlength = !!this.maxlength ? this.maxlength : 9;
6585
6702
  this.manageHelpText();
6586
6703
  }
6704
+ getMaxLength() {
6705
+ if (this.allowFreeInput) {
6706
+ return null;
6707
+ }
6708
+ return super.getMaxLength();
6709
+ }
6587
6710
  updateNgModel(value) {
6588
6711
  if (this.isEmpty(value)) {
6589
6712
  this.setToEmpty(value);
6590
6713
  return;
6591
6714
  }
6592
- let cleanNumber = this.getCleanNumber(value.toString());
6593
- const isModelValid = this.isModelValid(cleanNumber);
6594
- if (!isModelValid) {
6595
- cleanNumber = this.model;
6715
+ let cleanNumber;
6716
+ if (!this.allowFreeInput) {
6717
+ cleanNumber = this.getCleanNumber(value.toString());
6718
+ const isModelValid = this.isModelValid(cleanNumber);
6719
+ if (!isModelValid) {
6720
+ cleanNumber = this.model;
6721
+ }
6722
+ }
6723
+ else {
6724
+ const noCommaString = this.replaceCommaWithDot(value);
6725
+ cleanNumber =
6726
+ noCommaString && typeof noCommaString === 'string'
6727
+ ? noCommaString.replace(CLEAN_NEGATIVE_AND_DECIMAL_NUMBERS_PATTERN, '')
6728
+ : noCommaString;
6596
6729
  }
6597
6730
  super.updateNgModel(cleanNumber);
6598
6731
  // Need to update HTML input value because we let user input what he wants and then we clean model
@@ -6728,7 +6861,6 @@ class FoehnInputNumberComponent extends FoehnInputStringComponent {
6728
6861
  maxAsString += `.${'9'.repeat(this.maxDecimalCount)}`;
6729
6862
  }
6730
6863
  }
6731
- const max = this.currencyHelper.formatCurrency(Number(maxAsString), '', this.allowDecimal ? this.maxDecimalCount : null, true);
6732
6864
  let minAsString;
6733
6865
  if (this.min) {
6734
6866
  minAsString = this.min;
@@ -6737,16 +6869,26 @@ class FoehnInputNumberComponent extends FoehnInputStringComponent {
6737
6869
  minAsString = this.allowNegative
6738
6870
  ? `-${'9'.repeat(maxIntegerCount - 1)}`
6739
6871
  : '0';
6740
- if (this.allowDecimal && this.allowNegative) {
6741
- minAsString += `.${'9'.repeat(this.maxDecimalCount)}`;
6872
+ if (this.allowDecimal) {
6873
+ minAsString += this.allowNegative
6874
+ ? `.${'9'.repeat(this.maxDecimalCount || 0)}`
6875
+ : `.${'0'.repeat(this.maxDecimalCount || 0)}`;
6742
6876
  }
6743
6877
  }
6744
- const min = this.currencyHelper.formatCurrency(Number(minAsString), '', this.allowDecimal ? this.maxDecimalCount : null, true);
6745
- this.helpText += this.dictionaryService.getKeySync('foehn-input-number.standard-help-text.label', { minValue: min, maxValue: max });
6878
+ this.helpText += this.dictionaryService.getKeySync('foehn-input-number.standard-help-text.label', {
6879
+ minValue: this.formatValue(minAsString),
6880
+ maxValue: this.formatValue(maxAsString)
6881
+ });
6882
+ }
6883
+ formatValue(value) {
6884
+ if (this.allowDecimal) {
6885
+ return formatDecimalCurrency(value === null || value === void 0 ? void 0 : value.toString(), this.maxDecimalCount, this.maxlength, this.allowFreeInput);
6886
+ }
6887
+ return formatNonDecimalCurrency(value === null || value === void 0 ? void 0 : value.toString());
6746
6888
  }
6747
6889
  }
6748
6890
  FoehnInputNumberComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: FoehnInputNumberComponent, deps: [{ token: CurrencyHelper }, { token: SdkDictionaryService }], target: i0.ɵɵFactoryTarget.Component });
6749
- FoehnInputNumberComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: FoehnInputNumberComponent, selector: "foehn-input-number", inputs: { hideStandardHelpText: "hideStandardHelpText", allowDecimal: "allowDecimal", allowNegative: "allowNegative", maxDecimalCount: "maxDecimalCount", model: "model" }, providers: [
6891
+ FoehnInputNumberComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.11", type: FoehnInputNumberComponent, selector: "foehn-input-number", inputs: { hideStandardHelpText: "hideStandardHelpText", allowDecimal: "allowDecimal", allowNegative: "allowNegative", maxDecimalCount: "maxDecimalCount", allowFreeInput: "allowFreeInput", model: "model" }, providers: [
6750
6892
  {
6751
6893
  provide: FoehnInputComponent,
6752
6894
  useExisting: forwardRef(() => FoehnInputNumberComponent),
@@ -6770,6 +6912,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
6770
6912
  type: Input
6771
6913
  }], maxDecimalCount: [{
6772
6914
  type: Input
6915
+ }], allowFreeInput: [{
6916
+ type: Input
6773
6917
  }], model: [{
6774
6918
  type: Input
6775
6919
  }] } });
@@ -7961,7 +8105,7 @@ FoehnDateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ver
7961
8105
  useExisting: forwardRef(() => FoehnDateComponent),
7962
8106
  multi: true
7963
8107
  }
7964
- ], usesInheritance: true, ngImport: i0, template: "<div\n class=\"form-group\"\n [class.has-danger]=\"hasErrorsToDisplay()\"\n [class.vd-form-group-danger]=\"hasErrorsToDisplay()\"\n [attr.id]=\"buildId('Container')\"\n tabindex=\"-1\"\n>\n <fieldset\n class=\"mb-3\"\n [attr.aria-describedby]=\"getDescribedBy()\"\n [attr.aria-invalid]=\"hasErrorsToDisplay() || null\"\n >\n <legend *ngIf=\"!!label\" [ngClass]=\"isLabelSrOnly ? 'sr-only' : 'vd-p'\">\n <span [innerHTML]=\"label\"></span>\n <span\n *ngIf=\"!required && !hideNotRequiredExtraLabel\"\n aria-hidden=\"true\"\n >\n {{ 'foehn-input.optional' | fromDictionary }}\n </span>\n </legend>\n\n <foehn-validation-alerts [component]=\"this\"></foehn-validation-alerts>\n\n <small\n *ngIf=\"helpText\"\n [attr.id]=\"buildId() + 'Help'\"\n class=\"text-secondary\"\n [innerHTML]=\"helpText\"\n ></small>\n\n <ng-content></ng-content>\n\n <div class=\"vd-form-flex\">\n <div\n [ngClass]=\"{\n 'vd-form-flex__item--3-char-width':\n displayClearButton() | async,\n 'vd-form-flex__item--2-char-width': !(\n displayClearButton() | async\n )\n }\"\n class=\"vd-form-flex__item\"\n >\n <foehn-input-number\n [id]=\"buildId() + '_day'\"\n [name]=\"name + '_day'\"\n [label]=\"'foehn-input-date.day.label' | fromDictionary\"\n [(model)]=\"day\"\n (modelChange)=\"updateDate()\"\n [disabled]=\"disabled || disableDay\"\n [maxlength]=\"2\"\n [allowNegative]=\"false\"\n [max]=\"31\"\n [clearButton]=\"displayClearButton() | async\"\n [required]=\"required\"\n [hideNotRequiredExtraLabel]=\"true\"\n (userInput)=\"handleUserInput()\"\n [isErrorInherited]=\"hasErrorsToDisplay()\"\n [hideStandardHelpText]=\"true\"\n #entryComponent\n ></foehn-input-number>\n </div>\n <div\n [ngClass]=\"{\n 'vd-form-flex__item--3-char-width':\n displayClearButton() | async,\n 'vd-form-flex__item--2-char-width': !(\n displayClearButton() | async\n )\n }\"\n class=\"vd-form-flex__item\"\n >\n <foehn-input-number\n [id]=\"buildId() + '_month'\"\n [name]=\"name + '_month'\"\n [label]=\"'foehn-input-date.month.label' | fromDictionary\"\n [(model)]=\"month\"\n (modelChange)=\"updateDate()\"\n [disabled]=\"disabled || disableMonth\"\n [maxlength]=\"2\"\n [clearButton]=\"displayClearButton() | async\"\n [allowNegative]=\"false\"\n [max]=\"12\"\n [required]=\"required\"\n [hideNotRequiredExtraLabel]=\"true\"\n (userInput)=\"handleUserInput()\"\n [isErrorInherited]=\"hasErrorsToDisplay()\"\n [hideStandardHelpText]=\"true\"\n ></foehn-input-number>\n </div>\n <div\n class=\"vd-form-flex__item vd-form-flex__item--4-char-width\"\n [class.mr-0]=\"shouldDisplayDatePicker()\"\n >\n <foehn-input-number\n [id]=\"buildId() + '_year'\"\n [name]=\"name + '_year'\"\n [label]=\"'foehn-input-date.year.label' | fromDictionary\"\n [(model)]=\"year\"\n (modelChange)=\"updateDate()\"\n [disabled]=\"disabled || disableYear\"\n [allowNegative]=\"false\"\n [maxlength]=\"4\"\n [clearButton]=\"displayClearButton() | async\"\n [required]=\"required\"\n [hideNotRequiredExtraLabel]=\"true\"\n (userInput)=\"handleUserInput()\"\n [isErrorInherited]=\"hasErrorsToDisplay()\"\n [hideStandardHelpText]=\"true\"\n ></foehn-input-number>\n </div>\n <foehn-date-picker-button\n *ngIf=\"shouldDisplayDatePicker()\"\n [id]=\"buildId() + '_datePickerButton'\"\n [(model)]=\"datePickerModel\"\n (modelChange)=\"updateDateFromDatePicker($event)\"\n (userInput)=\"handleDatePickerUserInput($event)\"\n [displaySelectedDate]=\"false\"\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n class=\"align-self-center\"\n ></foehn-date-picker-button>\n </div>\n </fieldset>\n</div>\n", components: [{ type: FoehnValidationAlertsComponent, selector: "foehn-validation-alerts", inputs: ["component", "shouldErrorsBeLive"] }, { type: FoehnInputNumberComponent, selector: "foehn-input-number", inputs: ["hideStandardHelpText", "allowDecimal", "allowNegative", "maxDecimalCount", "model"] }, { type: FoehnDatePickerButtonComponent, selector: "foehn-date-picker-button", inputs: ["id", "name", "minYear", "maxYear", "minDate", "maxDate", "displaySelectedDate", "selectedDateSrOnlyLabelKey", "model"], outputs: ["modelChange", "userInput"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], pipes: { "fromDictionary": SdkDictionaryPipe, "async": i3.AsyncPipe } });
8108
+ ], usesInheritance: true, ngImport: i0, template: "<div\n class=\"form-group\"\n [class.has-danger]=\"hasErrorsToDisplay()\"\n [class.vd-form-group-danger]=\"hasErrorsToDisplay()\"\n [attr.id]=\"buildId('Container')\"\n tabindex=\"-1\"\n>\n <fieldset\n class=\"mb-3\"\n [attr.aria-describedby]=\"getDescribedBy()\"\n [attr.aria-invalid]=\"hasErrorsToDisplay() || null\"\n >\n <legend *ngIf=\"!!label\" [ngClass]=\"isLabelSrOnly ? 'sr-only' : 'vd-p'\">\n <span [innerHTML]=\"label\"></span>\n <span\n *ngIf=\"!required && !hideNotRequiredExtraLabel\"\n aria-hidden=\"true\"\n >\n {{ 'foehn-input.optional' | fromDictionary }}\n </span>\n </legend>\n\n <foehn-validation-alerts [component]=\"this\"></foehn-validation-alerts>\n\n <small\n *ngIf=\"helpText\"\n [attr.id]=\"buildId() + 'Help'\"\n class=\"text-secondary\"\n [innerHTML]=\"helpText\"\n ></small>\n\n <ng-content></ng-content>\n\n <div class=\"vd-form-flex\">\n <div\n [ngClass]=\"{\n 'vd-form-flex__item--3-char-width':\n displayClearButton() | async,\n 'vd-form-flex__item--2-char-width': !(\n displayClearButton() | async\n )\n }\"\n class=\"vd-form-flex__item\"\n >\n <foehn-input-number\n [id]=\"buildId() + '_day'\"\n [name]=\"name + '_day'\"\n [label]=\"'foehn-input-date.day.label' | fromDictionary\"\n [(model)]=\"day\"\n (modelChange)=\"updateDate()\"\n [disabled]=\"disabled || disableDay\"\n [maxlength]=\"2\"\n [allowNegative]=\"false\"\n [max]=\"31\"\n [clearButton]=\"displayClearButton() | async\"\n [required]=\"required\"\n [hideNotRequiredExtraLabel]=\"true\"\n (userInput)=\"handleUserInput()\"\n [isErrorInherited]=\"hasErrorsToDisplay()\"\n [hideStandardHelpText]=\"true\"\n #entryComponent\n ></foehn-input-number>\n </div>\n <div\n [ngClass]=\"{\n 'vd-form-flex__item--3-char-width':\n displayClearButton() | async,\n 'vd-form-flex__item--2-char-width': !(\n displayClearButton() | async\n )\n }\"\n class=\"vd-form-flex__item\"\n >\n <foehn-input-number\n [id]=\"buildId() + '_month'\"\n [name]=\"name + '_month'\"\n [label]=\"'foehn-input-date.month.label' | fromDictionary\"\n [(model)]=\"month\"\n (modelChange)=\"updateDate()\"\n [disabled]=\"disabled || disableMonth\"\n [maxlength]=\"2\"\n [clearButton]=\"displayClearButton() | async\"\n [allowNegative]=\"false\"\n [max]=\"12\"\n [required]=\"required\"\n [hideNotRequiredExtraLabel]=\"true\"\n (userInput)=\"handleUserInput()\"\n [isErrorInherited]=\"hasErrorsToDisplay()\"\n [hideStandardHelpText]=\"true\"\n ></foehn-input-number>\n </div>\n <div\n class=\"vd-form-flex__item vd-form-flex__item--4-char-width\"\n [class.mr-0]=\"shouldDisplayDatePicker()\"\n >\n <foehn-input-number\n [id]=\"buildId() + '_year'\"\n [name]=\"name + '_year'\"\n [label]=\"'foehn-input-date.year.label' | fromDictionary\"\n [(model)]=\"year\"\n (modelChange)=\"updateDate()\"\n [disabled]=\"disabled || disableYear\"\n [allowNegative]=\"false\"\n [maxlength]=\"4\"\n [clearButton]=\"displayClearButton() | async\"\n [required]=\"required\"\n [hideNotRequiredExtraLabel]=\"true\"\n (userInput)=\"handleUserInput()\"\n [isErrorInherited]=\"hasErrorsToDisplay()\"\n [hideStandardHelpText]=\"true\"\n ></foehn-input-number>\n </div>\n <foehn-date-picker-button\n *ngIf=\"shouldDisplayDatePicker()\"\n [id]=\"buildId() + '_datePickerButton'\"\n [(model)]=\"datePickerModel\"\n (modelChange)=\"updateDateFromDatePicker($event)\"\n (userInput)=\"handleDatePickerUserInput($event)\"\n [displaySelectedDate]=\"false\"\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n class=\"align-self-center\"\n ></foehn-date-picker-button>\n </div>\n </fieldset>\n</div>\n", components: [{ type: FoehnValidationAlertsComponent, selector: "foehn-validation-alerts", inputs: ["component", "shouldErrorsBeLive"] }, { type: FoehnInputNumberComponent, selector: "foehn-input-number", inputs: ["hideStandardHelpText", "allowDecimal", "allowNegative", "maxDecimalCount", "allowFreeInput", "model"] }, { type: FoehnDatePickerButtonComponent, selector: "foehn-date-picker-button", inputs: ["id", "name", "minYear", "maxYear", "minDate", "maxDate", "displaySelectedDate", "selectedDateSrOnlyLabelKey", "model"], outputs: ["modelChange", "userInput"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], pipes: { "fromDictionary": SdkDictionaryPipe, "async": i3.AsyncPipe } });
7965
8109
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: FoehnDateComponent, decorators: [{
7966
8110
  type: Component,
7967
8111
  args: [{ selector: 'foehn-input-date', providers: [
@@ -8040,7 +8184,7 @@ FoehnTimeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ver
8040
8184
  useExisting: forwardRef(() => FoehnTimeComponent),
8041
8185
  multi: true
8042
8186
  }
8043
- ], usesInheritance: true, ngImport: i0, template: "<div\n class=\"form-group\"\n [class.has-danger]=\"hasErrorsToDisplay()\"\n [class.vd-form-group-danger]=\"hasErrorsToDisplay()\"\n [attr.id]=\"buildId('Container')\"\n tabindex=\"-1\"\n>\n <fieldset\n class=\"mb-3\"\n [attr.aria-describedby]=\"getDescribedBy()\"\n [attr.aria-invalid]=\"hasErrorsToDisplay() || null\"\n >\n <legend *ngIf=\"!!label\" [ngClass]=\"isLabelSrOnly ? 'sr-only' : 'vd-p'\">\n <span [innerHTML]=\"label\"></span>\n <span\n *ngIf=\"!required && !hideNotRequiredExtraLabel\"\n aria-hidden=\"true\"\n >\n {{ 'foehn-input.optional' | fromDictionary }}\n </span>\n </legend>\n\n <foehn-validation-alerts [component]=\"this\"></foehn-validation-alerts>\n\n <small\n *ngIf=\"helpText\"\n [attr.id]=\"buildId() + 'Help'\"\n class=\"text-secondary\"\n [innerHTML]=\"helpText\"\n ></small>\n\n <ng-content></ng-content>\n\n <div class=\"vd-form-flex\">\n <div\n [ngClass]=\"{\n 'vd-form-flex__item--3-char-width':\n displayClearButton() | async,\n 'vd-form-flex__item--2-char-width': !(\n displayClearButton() | async\n )\n }\"\n class=\"vd-form-flex__item\"\n >\n <foehn-input-number\n [id]=\"buildId() + '_hours'\"\n [name]=\"name + '_hours'\"\n [label]=\"'foehn-input-time.hours.label' | fromDictionary\"\n [maxlength]=\"2\"\n [max]=\"24\"\n [(model)]=\"hour\"\n (focusout)=\"updateTime()\"\n [required]=\"required\"\n [hideNotRequiredExtraLabel]=\"true\"\n (userInput)=\"handleUserInput()\"\n [isErrorInherited]=\"hasErrorsToDisplay()\"\n [disabled]=\"disabled\"\n [hideStandardHelpText]=\"true\"\n #entryComponent\n ></foehn-input-number>\n </div>\n <div\n [ngClass]=\"{\n 'vd-form-flex__item--3-char-width':\n displayClearButton() | async,\n 'vd-form-flex__item--2-char-width': !(\n displayClearButton() | async\n )\n }\"\n class=\"vd-form-flex__item\"\n >\n <foehn-input-number\n [id]=\"buildId() + '_minutes'\"\n [name]=\"name + '_minutes'\"\n [label]=\"'foehn-input-time.minutes.label' | fromDictionary\"\n [maxlength]=\"2\"\n [max]=\"59\"\n [(model)]=\"minute\"\n (focusout)=\"updateTime()\"\n [required]=\"required\"\n [hideNotRequiredExtraLabel]=\"true\"\n (userInput)=\"handleUserInput()\"\n [isErrorInherited]=\"hasErrorsToDisplay()\"\n [disabled]=\"disabled\"\n [hideStandardHelpText]=\"true\"\n ></foehn-input-number>\n </div>\n </div>\n </fieldset>\n</div>\n", components: [{ type: FoehnValidationAlertsComponent, selector: "foehn-validation-alerts", inputs: ["component", "shouldErrorsBeLive"] }, { type: FoehnInputNumberComponent, selector: "foehn-input-number", inputs: ["hideStandardHelpText", "allowDecimal", "allowNegative", "maxDecimalCount", "model"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], pipes: { "fromDictionary": SdkDictionaryPipe, "async": i3.AsyncPipe } });
8187
+ ], usesInheritance: true, ngImport: i0, template: "<div\n class=\"form-group\"\n [class.has-danger]=\"hasErrorsToDisplay()\"\n [class.vd-form-group-danger]=\"hasErrorsToDisplay()\"\n [attr.id]=\"buildId('Container')\"\n tabindex=\"-1\"\n>\n <fieldset\n class=\"mb-3\"\n [attr.aria-describedby]=\"getDescribedBy()\"\n [attr.aria-invalid]=\"hasErrorsToDisplay() || null\"\n >\n <legend *ngIf=\"!!label\" [ngClass]=\"isLabelSrOnly ? 'sr-only' : 'vd-p'\">\n <span [innerHTML]=\"label\"></span>\n <span\n *ngIf=\"!required && !hideNotRequiredExtraLabel\"\n aria-hidden=\"true\"\n >\n {{ 'foehn-input.optional' | fromDictionary }}\n </span>\n </legend>\n\n <foehn-validation-alerts [component]=\"this\"></foehn-validation-alerts>\n\n <small\n *ngIf=\"helpText\"\n [attr.id]=\"buildId() + 'Help'\"\n class=\"text-secondary\"\n [innerHTML]=\"helpText\"\n ></small>\n\n <ng-content></ng-content>\n\n <div class=\"vd-form-flex\">\n <div\n [ngClass]=\"{\n 'vd-form-flex__item--3-char-width':\n displayClearButton() | async,\n 'vd-form-flex__item--2-char-width': !(\n displayClearButton() | async\n )\n }\"\n class=\"vd-form-flex__item\"\n >\n <foehn-input-number\n [id]=\"buildId() + '_hours'\"\n [name]=\"name + '_hours'\"\n [label]=\"'foehn-input-time.hours.label' | fromDictionary\"\n [maxlength]=\"2\"\n [max]=\"24\"\n [(model)]=\"hour\"\n (focusout)=\"updateTime()\"\n [required]=\"required\"\n [hideNotRequiredExtraLabel]=\"true\"\n (userInput)=\"handleUserInput()\"\n [isErrorInherited]=\"hasErrorsToDisplay()\"\n [disabled]=\"disabled\"\n [hideStandardHelpText]=\"true\"\n #entryComponent\n ></foehn-input-number>\n </div>\n <div\n [ngClass]=\"{\n 'vd-form-flex__item--3-char-width':\n displayClearButton() | async,\n 'vd-form-flex__item--2-char-width': !(\n displayClearButton() | async\n )\n }\"\n class=\"vd-form-flex__item\"\n >\n <foehn-input-number\n [id]=\"buildId() + '_minutes'\"\n [name]=\"name + '_minutes'\"\n [label]=\"'foehn-input-time.minutes.label' | fromDictionary\"\n [maxlength]=\"2\"\n [max]=\"59\"\n [(model)]=\"minute\"\n (focusout)=\"updateTime()\"\n [required]=\"required\"\n [hideNotRequiredExtraLabel]=\"true\"\n (userInput)=\"handleUserInput()\"\n [isErrorInherited]=\"hasErrorsToDisplay()\"\n [disabled]=\"disabled\"\n [hideStandardHelpText]=\"true\"\n ></foehn-input-number>\n </div>\n </div>\n </fieldset>\n</div>\n", components: [{ type: FoehnValidationAlertsComponent, selector: "foehn-validation-alerts", inputs: ["component", "shouldErrorsBeLive"] }, { type: FoehnInputNumberComponent, selector: "foehn-input-number", inputs: ["hideStandardHelpText", "allowDecimal", "allowNegative", "maxDecimalCount", "allowFreeInput", "model"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], pipes: { "fromDictionary": SdkDictionaryPipe, "async": i3.AsyncPipe } });
8044
8188
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: FoehnTimeComponent, decorators: [{
8045
8189
  type: Component,
8046
8190
  args: [{ selector: 'foehn-input-time', providers: [
@@ -9228,7 +9372,7 @@ FoehnInputNav13Component.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0
9228
9372
  useExisting: forwardRef(() => FoehnInputNav13Component),
9229
9373
  multi: true
9230
9374
  }
9231
- ], usesInheritance: true, ngImport: i0, template: "<div\n class=\"form-group\"\n [class.has-danger]=\"hasErrorsToDisplay()\"\n [class.vd-form-group-danger]=\"hasErrorsToDisplay()\"\n [attr.id]=\"buildId('Container')\"\n tabindex=\"-1\"\n>\n <fieldset\n class=\"mb-3\"\n [attr.aria-describedby]=\"getDescribedBy()\"\n [attr.aria-invalid]=\"hasErrorsToDisplay() || null\"\n >\n <legend\n [attr.for]=\"buildChildId()\"\n [ngClass]=\"isLabelSrOnly ? 'sr-only' : 'vd-p'\"\n >\n <span [innerHTML]=\"label\"></span>\n <span\n *ngIf=\"!required && !hideNotRequiredExtraLabel\"\n aria-hidden=\"true\"\n >\n {{ 'foehn-input.optional' | fromDictionary }}\n </span>\n </legend>\n\n <foehn-validation-alerts [component]=\"this\"></foehn-validation-alerts>\n\n <small\n *ngIf=\"helpText\"\n [attr.id]=\"buildId() + 'Help'\"\n class=\"form-text text-secondary\"\n [innerHTML]=\"helpText\"\n ></small>\n\n <ng-content></ng-content>\n\n <div class=\"vd-form-flex\">\n <div\n [ngClass]=\"{\n 'vd-form-flex__item--4-char-width':\n displayClearButton() | async,\n 'vd-form-flex__item--3-char-width': !(\n displayClearButton() | async\n )\n }\"\n class=\"vd-form-flex__item\"\n >\n <div class=\"form-group\">\n <label\n [attr.for]=\"buildId() + '_part1Child'\"\n class=\"sr-only\"\n >\n Code du pays\n </label>\n <small\n [id]=\"buildId() + '_part1ChildHelp'\"\n class=\"form-text text-secondary\"\n >\n <span class=\"sr-only\">\n Etant obligatoirement un num\u00E9ro AVS suisse, ce\n champs est pr\u00E9rempli\n </span>\n </small>\n\n <foehn-input-number\n [name]=\"name + '_part1'\"\n [id]=\"buildId() + '_part1'\"\n [model]=\"PREFIX_NAVS\"\n [maxlength]=\"3\"\n [autocomplete]=\"'off'\"\n [clearButton]=\"displayClearButton() | async\"\n [disabled]=\"true\"\n [hideStandardHelpText]=\"true\"\n ></foehn-input-number>\n </div>\n </div>\n\n <div class=\"vd-form-flex__item vd-form-flex__item--4-char-width\">\n <div class=\"form-group\">\n <label\n [attr.for]=\"buildId() + '_part2Child'\"\n class=\"sr-only\"\n >\n Premiers chiffres al\u00E9atoires et anonymes\n </label>\n <small\n [id]=\"buildId() + '_part2ChildHelp'\"\n class=\"form-text text-secondary\"\n >\n <span class=\"sr-only\">\n Saisir quatres chiffres :\n <abbr title=\"Exemple\">Ex.</abbr>\n : 1234\n </span>\n </small>\n\n <foehn-input-number\n [name]=\"name + '_part2'\"\n [id]=\"buildId() + '_part2'\"\n [(model)]=\"part2\"\n (modelChange)=\"updateNavs()\"\n [maxlength]=\"4\"\n [autocomplete]=\"'off'\"\n [clearButton]=\"displayClearButton() | async\"\n (userInput)=\"handleUserInput()\"\n [isErrorInherited]=\"hasErrorsToDisplay()\"\n [disabled]=\"disabled\"\n (paste)=\"onPaste($event)\"\n [hideStandardHelpText]=\"true\"\n ></foehn-input-number>\n </div>\n </div>\n\n <div class=\"vd-form-flex__item vd-form-flex__item--4-char-width\">\n <div class=\"form-group\">\n <label\n [attr.for]=\"buildId() + '_part3Child'\"\n class=\"sr-only\"\n >\n Deuxi\u00E8mes chiffres al\u00E9atoires et anonymes\n </label>\n <small\n [id]=\"buildId() + '_part3ChildHelp'\"\n class=\"form-text text-secondary\"\n >\n <span class=\"sr-only\">\n Saisir quatres chiffres :\n <abbr title=\"Exemple\">Ex.</abbr>\n : 5678\n </span>\n </small>\n\n <foehn-input-number\n [name]=\"name + '_part3'\"\n [id]=\"buildId() + '_part3'\"\n [(model)]=\"part3\"\n (modelChange)=\"updateNavs()\"\n [maxlength]=\"4\"\n [autocomplete]=\"'off'\"\n [clearButton]=\"displayClearButton() | async\"\n (userInput)=\"handleUserInput()\"\n [isErrorInherited]=\"hasErrorsToDisplay()\"\n [disabled]=\"disabled\"\n [hideStandardHelpText]=\"true\"\n ></foehn-input-number>\n </div>\n </div>\n\n <div\n [ngClass]=\"{\n 'vd-form-flex__item--3-char-width':\n displayClearButton() | async,\n 'vd-form-flex__item--2-char-width': !(\n displayClearButton() | async\n )\n }\"\n class=\"vd-form-flex__item vd-form-flex__item--3-char-width\"\n >\n <div class=\"form-group\">\n <label\n [attr.for]=\"buildId() + '_part4Child'\"\n class=\"sr-only\"\n >\n Chiffre al\u00E9atoire et anonyme et num\u00E9ro de contr\u00F4le\n </label>\n <small\n [id]=\"buildId() + '_part4ChildHelp'\"\n class=\"form-text text-secondary\"\n >\n <span class=\"sr-only\">\n Saisir deux chiffres :\n <abbr title=\"Exemple\">Ex.</abbr>\n : 97\n </span>\n </small>\n\n <foehn-input-number\n [name]=\"name + '_part4'\"\n [id]=\"buildId() + '_part4'\"\n [(model)]=\"part4\"\n (modelChange)=\"updateNavs()\"\n [maxlength]=\"2\"\n [autocomplete]=\"'off'\"\n [clearButton]=\"displayClearButton() | async\"\n (userInput)=\"handleUserInput()\"\n [isErrorInherited]=\"hasErrorsToDisplay()\"\n [disabled]=\"disabled\"\n [hideStandardHelpText]=\"true\"\n ></foehn-input-number>\n </div>\n </div>\n </div>\n </fieldset>\n</div>\n", components: [{ type: FoehnValidationAlertsComponent, selector: "foehn-validation-alerts", inputs: ["component", "shouldErrorsBeLive"] }, { type: FoehnInputNumberComponent, selector: "foehn-input-number", inputs: ["hideStandardHelpText", "allowDecimal", "allowNegative", "maxDecimalCount", "model"] }], directives: [{ type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "fromDictionary": SdkDictionaryPipe, "async": i3.AsyncPipe } });
9375
+ ], usesInheritance: true, ngImport: i0, template: "<div\n class=\"form-group\"\n [class.has-danger]=\"hasErrorsToDisplay()\"\n [class.vd-form-group-danger]=\"hasErrorsToDisplay()\"\n [attr.id]=\"buildId('Container')\"\n tabindex=\"-1\"\n>\n <fieldset\n class=\"mb-3\"\n [attr.aria-describedby]=\"getDescribedBy()\"\n [attr.aria-invalid]=\"hasErrorsToDisplay() || null\"\n >\n <legend\n [attr.for]=\"buildChildId()\"\n [ngClass]=\"isLabelSrOnly ? 'sr-only' : 'vd-p'\"\n >\n <span [innerHTML]=\"label\"></span>\n <span\n *ngIf=\"!required && !hideNotRequiredExtraLabel\"\n aria-hidden=\"true\"\n >\n {{ 'foehn-input.optional' | fromDictionary }}\n </span>\n </legend>\n\n <foehn-validation-alerts [component]=\"this\"></foehn-validation-alerts>\n\n <small\n *ngIf=\"helpText\"\n [attr.id]=\"buildId() + 'Help'\"\n class=\"form-text text-secondary\"\n [innerHTML]=\"helpText\"\n ></small>\n\n <ng-content></ng-content>\n\n <div class=\"vd-form-flex\">\n <div\n [ngClass]=\"{\n 'vd-form-flex__item--4-char-width':\n displayClearButton() | async,\n 'vd-form-flex__item--3-char-width': !(\n displayClearButton() | async\n )\n }\"\n class=\"vd-form-flex__item\"\n >\n <div class=\"form-group\">\n <label\n [attr.for]=\"buildId() + '_part1Child'\"\n class=\"sr-only\"\n >\n Code du pays\n </label>\n <small\n [id]=\"buildId() + '_part1ChildHelp'\"\n class=\"form-text text-secondary\"\n >\n <span class=\"sr-only\">\n Etant obligatoirement un num\u00E9ro AVS suisse, ce\n champs est pr\u00E9rempli\n </span>\n </small>\n\n <foehn-input-number\n [name]=\"name + '_part1'\"\n [id]=\"buildId() + '_part1'\"\n [model]=\"PREFIX_NAVS\"\n [maxlength]=\"3\"\n [autocomplete]=\"'off'\"\n [clearButton]=\"displayClearButton() | async\"\n [disabled]=\"true\"\n [hideStandardHelpText]=\"true\"\n ></foehn-input-number>\n </div>\n </div>\n\n <div class=\"vd-form-flex__item vd-form-flex__item--4-char-width\">\n <div class=\"form-group\">\n <label\n [attr.for]=\"buildId() + '_part2Child'\"\n class=\"sr-only\"\n >\n Premiers chiffres al\u00E9atoires et anonymes\n </label>\n <small\n [id]=\"buildId() + '_part2ChildHelp'\"\n class=\"form-text text-secondary\"\n >\n <span class=\"sr-only\">\n Saisir quatres chiffres :\n <abbr title=\"Exemple\">Ex.</abbr>\n : 1234\n </span>\n </small>\n\n <foehn-input-number\n [name]=\"name + '_part2'\"\n [id]=\"buildId() + '_part2'\"\n [(model)]=\"part2\"\n (modelChange)=\"updateNavs()\"\n [maxlength]=\"4\"\n [autocomplete]=\"'off'\"\n [clearButton]=\"displayClearButton() | async\"\n (userInput)=\"handleUserInput()\"\n [isErrorInherited]=\"hasErrorsToDisplay()\"\n [disabled]=\"disabled\"\n (paste)=\"onPaste($event)\"\n [hideStandardHelpText]=\"true\"\n ></foehn-input-number>\n </div>\n </div>\n\n <div class=\"vd-form-flex__item vd-form-flex__item--4-char-width\">\n <div class=\"form-group\">\n <label\n [attr.for]=\"buildId() + '_part3Child'\"\n class=\"sr-only\"\n >\n Deuxi\u00E8mes chiffres al\u00E9atoires et anonymes\n </label>\n <small\n [id]=\"buildId() + '_part3ChildHelp'\"\n class=\"form-text text-secondary\"\n >\n <span class=\"sr-only\">\n Saisir quatres chiffres :\n <abbr title=\"Exemple\">Ex.</abbr>\n : 5678\n </span>\n </small>\n\n <foehn-input-number\n [name]=\"name + '_part3'\"\n [id]=\"buildId() + '_part3'\"\n [(model)]=\"part3\"\n (modelChange)=\"updateNavs()\"\n [maxlength]=\"4\"\n [autocomplete]=\"'off'\"\n [clearButton]=\"displayClearButton() | async\"\n (userInput)=\"handleUserInput()\"\n [isErrorInherited]=\"hasErrorsToDisplay()\"\n [disabled]=\"disabled\"\n [hideStandardHelpText]=\"true\"\n ></foehn-input-number>\n </div>\n </div>\n\n <div\n [ngClass]=\"{\n 'vd-form-flex__item--3-char-width':\n displayClearButton() | async,\n 'vd-form-flex__item--2-char-width': !(\n displayClearButton() | async\n )\n }\"\n class=\"vd-form-flex__item vd-form-flex__item--3-char-width\"\n >\n <div class=\"form-group\">\n <label\n [attr.for]=\"buildId() + '_part4Child'\"\n class=\"sr-only\"\n >\n Chiffre al\u00E9atoire et anonyme et num\u00E9ro de contr\u00F4le\n </label>\n <small\n [id]=\"buildId() + '_part4ChildHelp'\"\n class=\"form-text text-secondary\"\n >\n <span class=\"sr-only\">\n Saisir deux chiffres :\n <abbr title=\"Exemple\">Ex.</abbr>\n : 97\n </span>\n </small>\n\n <foehn-input-number\n [name]=\"name + '_part4'\"\n [id]=\"buildId() + '_part4'\"\n [(model)]=\"part4\"\n (modelChange)=\"updateNavs()\"\n [maxlength]=\"2\"\n [autocomplete]=\"'off'\"\n [clearButton]=\"displayClearButton() | async\"\n (userInput)=\"handleUserInput()\"\n [isErrorInherited]=\"hasErrorsToDisplay()\"\n [disabled]=\"disabled\"\n [hideStandardHelpText]=\"true\"\n ></foehn-input-number>\n </div>\n </div>\n </div>\n </fieldset>\n</div>\n", components: [{ type: FoehnValidationAlertsComponent, selector: "foehn-validation-alerts", inputs: ["component", "shouldErrorsBeLive"] }, { type: FoehnInputNumberComponent, selector: "foehn-input-number", inputs: ["hideStandardHelpText", "allowDecimal", "allowNegative", "maxDecimalCount", "allowFreeInput", "model"] }], directives: [{ type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "fromDictionary": SdkDictionaryPipe, "async": i3.AsyncPipe } });
9232
9376
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: FoehnInputNav13Component, decorators: [{
9233
9377
  type: Component,
9234
9378
  args: [{ selector: 'foehn-input-nav13', providers: [
@@ -11482,117 +11626,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
11482
11626
  class FoehnConfirmModalContent {
11483
11627
  }
11484
11628
 
11485
- // eslint-disable max-classes-per-file
11486
- // eslint-disable-next-line prefer-arrow/prefer-arrow-functions,jsdoc/require-jsdoc
11487
- function removeFormatting(value) {
11488
- if (value === undefined || value === null) {
11489
- // It's important to return null as the backend will consider this as no value.
11490
- return null;
11491
- }
11492
- return value
11493
- .toString()
11494
- .trim()
11495
- .replace(new RegExp(THOUSANDS_SEPARATOR, 'g'), '');
11496
- }
11497
- // eslint-disable-next-line prefer-arrow/prefer-arrow-functions,jsdoc/require-jsdoc
11498
- function formatWithThousandSeparators(value) {
11499
- return value.replace(CURRENCY_REGEXP, THOUSANDS_SEPARATOR);
11500
- }
11501
- // eslint-disable-next-line prefer-arrow/prefer-arrow-functions,jsdoc/require-jsdoc
11502
- function formatDecimalCurrency(value, maxDecimalCount, maxLength) {
11503
- if (value === undefined || value === null || value === '') {
11504
- return null;
11505
- }
11506
- const [intg, dec] = removeFormatting(value).split(DECIMALS_SEPARATOR);
11507
- if (maxDecimalCount === 0) {
11508
- return formatWithThousandSeparators(intg);
11509
- }
11510
- const validEmptyEnd = '0'.repeat(maxDecimalCount);
11511
- let newEnd = dec ? dec + validEmptyEnd : validEmptyEnd;
11512
- if (newEnd && newEnd.length >= maxDecimalCount) {
11513
- newEnd = newEnd.substring(0, maxDecimalCount);
11514
- }
11515
- let newDecimal = intg + DECIMALS_SEPARATOR + newEnd;
11516
- if (newDecimal.length > maxLength) {
11517
- newDecimal = newDecimal.substring(0, maxLength);
11518
- }
11519
- [, newEnd] = newDecimal.split(DECIMALS_SEPARATOR);
11520
- if (!newEnd) {
11521
- return formatWithThousandSeparators(intg);
11522
- }
11523
- return formatWithThousandSeparators(intg) + DECIMALS_SEPARATOR + newEnd;
11524
- }
11525
- // eslint-disable-next-line prefer-arrow/prefer-arrow-functions,jsdoc/require-jsdoc
11526
- function formatNonDecimalCurrency(value) {
11527
- if (value === undefined || value === null) {
11528
- return null;
11529
- }
11530
- return formatWithThousandSeparators(removeFormatting(value));
11531
- }
11532
- // eslint-disable-next-line @angular-eslint/directive-selector
11533
- class NumberCurrencyFormatterDirective {
11534
- constructor(host, ngZone) {
11535
- this.host = host;
11536
- this.ngZone = ngZone;
11537
- this.hasFocus = false;
11538
- }
11539
- onBlur(value) {
11540
- this.hasFocus = false;
11541
- this.setFormatting(value);
11542
- }
11543
- onFocus(value) {
11544
- this.hasFocus = true;
11545
- this.host.forceUpdateNgModel(removeFormatting(value));
11546
- }
11547
- onModelChange(value) {
11548
- if (!!value && !this.hasFocus) {
11549
- this.setFormatting(value);
11550
- }
11551
- }
11552
- ngOnInit() {
11553
- // sometimes, when the view is "simple" and doesn't require lot a processing
11554
- // we arrive in this method with this.host.model not already initialized, so the formatting is not working
11555
- this.ngZone.onMicrotaskEmpty.pipe(first()).subscribe(() => {
11556
- this.setFormatting(this.host.model);
11557
- });
11558
- }
11559
- setFormatting(value) {
11560
- // Hooks on the inputs of the component to customize the behavior
11561
- const formattedValue = this.host.allowDecimal
11562
- ? formatDecimalCurrency(value, this.host.maxDecimalCount, this.host.maxlength)
11563
- : formatNonDecimalCurrency(value);
11564
- const newValueWithoutFormatting = removeFormatting(formattedValue);
11565
- if (this.hasValueChanged(newValueWithoutFormatting)) {
11566
- // Since we have altered the model (i.e. by removing some decimals), we have to update it
11567
- this.host.updateNgModel(newValueWithoutFormatting);
11568
- }
11569
- // Due to ngModel being possibly updated, we need to wait for a micro task empty
11570
- this.ngZone.onMicrotaskEmpty.pipe(first()).subscribe(() => {
11571
- // We're injection non-decimal characters, hence the force.
11572
- this.host.forceUpdateNgModel(formattedValue);
11573
- });
11574
- }
11575
- hasValueChanged(newValueWithoutFormatting) {
11576
- return (!this.host.model ||
11577
- this.host.model.toString() !== newValueWithoutFormatting);
11578
- }
11579
- }
11580
- NumberCurrencyFormatterDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NumberCurrencyFormatterDirective, deps: [{ token: FoehnInputNumberComponent }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Directive });
11581
- NumberCurrencyFormatterDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.11", type: NumberCurrencyFormatterDirective, selector: "[numberCurrencyFormatter]", host: { listeners: { "blur": "onBlur($event.target.value)", "focus": "onFocus($event.target.value)", "modelChange": "onModelChange($event)" } }, ngImport: i0 });
11582
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NumberCurrencyFormatterDirective, decorators: [{
11583
- type: Directive,
11584
- args: [{ selector: '[numberCurrencyFormatter]' }]
11585
- }], ctorParameters: function () { return [{ type: FoehnInputNumberComponent }, { type: i0.NgZone }]; }, propDecorators: { onBlur: [{
11586
- type: HostListener,
11587
- args: ['blur', ['$event.target.value']]
11588
- }], onFocus: [{
11589
- type: HostListener,
11590
- args: ['focus', ['$event.target.value']]
11591
- }], onModelChange: [{
11592
- type: HostListener,
11593
- args: ['modelChange', ['$event']]
11594
- }] } });
11595
-
11596
11629
  const NO_CONTRIB_PATTERN = '^((\\d\\.?){0,7})(\\d)$';
11597
11630
  const NO_CONTRIB_PATTERN_WITH_NO_DOT = '^(\\d{1,2})$';
11598
11631
  const NO_CONTRIB_PATTERN_WITH_ONE_DOT = '^(\\d{1,3})(\\d{2})$';
@@ -12713,5 +12746,5 @@ class SelectedSlot {
12713
12746
  * Generated bundle index. Do not edit.
12714
12747
  */
12715
12748
 
12716
- export { APP_INFO_API_URL, AbstractFoehnUploaderComponent, AbstractListDetailPageComponent, AbstractMenuPageComponent, AbstractPageComponent, AbstractPageFromMenuComponent, ActionStatut, Address, AddressTypeLight, ApplicationInfo, ApplicationInfoService, BAD_PARAMS_HELP_TEXT, BoDocumentError, BoDocumentsWithErrors, BoMultiUploadService, Breadcrumb, BreadcrumbEventService, BreadcrumbItem, CAPTCHA_ERROR_NAME, CURRENCY_REGEXP, Calendar, Canton, Captcha, ComponentError, Configuration, Country, CurrencyHelper, CurrentWeek, DECIMALS_SEPARATOR, DEFAULT_INTERNATIONAL_AND_NO_SWISS, DEFAULT_INTERNATIONAL_AND_NO_SWISS_MOBILE, DEFAULT_INTERNATIONAL_AND_NO_SWISS_PHONE, DEFAULT_INTERNATIONAL_HELP_TEXT, DEFAULT_SWISS_HELP_TEXT, DEFAULT_SWISS_MOBILE_PHONE_HELP_TEXT, DEFAULT_SWISS_PHONE_HELP_TEXT, DICTIONARY_BASE_URL, DateHelper, DatePickerHelper, DatePickerNavigationHelper, DayMonth, DaySlots, DisplayCurrencyPipe, DisplayDatePipe, DisplayLoginMessagesData, District, Document, DocumentError, DocumentReference, DocumentReferenceWithFile, DocumentsWithErrors, EPaymentService, EtapeInfo, FORM_SUPPORT_CYBER_TITLE_FALLBACK, FocusedDay, FoehnAbbrComponent, FoehnAddressModule, FoehnAgendaComponent, FoehnAgendaModule, FoehnAgendaNavigationComponent, FoehnAgendaTimeslotPanelComponent, FoehnAutocompleteComponent, FoehnAutocompleteModule, FoehnBoMultiUploadComponent, FoehnBoMultiUploadModule, FoehnBooleanCheckboxComponent, FoehnBooleanModule, FoehnBooleanRadioComponent, FoehnBreadcrumbComponent, FoehnBreadcrumbModule, FoehnCheckableGroupComponent, FoehnCheckablesModule, FoehnCheckboxComponent, FoehnConfirmModalComponent, FoehnConfirmModalContent, FoehnConfirmModalModule, FoehnConfirmModalService, FoehnDateComponent, FoehnDatePickerButtonComponent, FoehnDatePickerButtonModule, FoehnDatePickerComponent, FoehnDatePickerModule, FoehnDecisionElectroniqueComponent, FoehnDecisionElectroniqueModule, FoehnDisplayAddressComponent, FoehnErrorPillComponent, FoehnFormComponent, FoehnFormModule, FoehnHeaderComponent, FoehnHeaderModule, FoehnHelpModalComponent, FoehnHelpModalModule, FoehnIconCalendarComponent, FoehnIconCheckComponent, FoehnIconCheckSquareOComponent, FoehnIconChevronDownComponent, FoehnIconChevronLeftComponent, FoehnIconChevronRightComponent, FoehnIconChevronUpComponent, FoehnIconClockComponent, FoehnIconCommentDotsComponent, FoehnIconEditComponent, FoehnIconExternalLinkAltComponent, FoehnIconFilePdfComponent, FoehnIconInfoCircleComponent, FoehnIconLockComponent, FoehnIconMapMarkerComponent, FoehnIconMinusCircleComponent, FoehnIconPlusCircleComponent, FoehnIconPlusSquareComponent, FoehnIconSearchComponent, FoehnIconTimesComponent, FoehnIconTrashAltComponent, FoehnIconUnlockAltComponent, FoehnIconsModule, FoehnInputAddressComponent, FoehnInputComponent, FoehnInputEmailComponent, FoehnInputForeignLocalityComponent, FoehnInputForeignStreetComponent, FoehnInputHiddenComponent, FoehnInputModule, FoehnInputNav13Component, FoehnInputNav13Module, FoehnInputNumberComponent, FoehnInputPasswordComponent, FoehnInputPhoneComponent, FoehnInputStringComponent, FoehnInputTextComponent, FoehnInputTextareaComponent, FoehnListComponent, FoehnListItem, FoehnListModule, FoehnListSummaryComponent, FoehnMenuItemComponent, FoehnMenuItemTransmitComponent, FoehnMenuPrestationModule, FoehnMiscModule, FoehnModalComponent, FoehnModalModule, FoehnMultiUploadComponent, FoehnMultiUploadModule, FoehnMultiselectAutocompleteComponent, FoehnMultiselectAutocompleteModule, FoehnNavigationComponent, FoehnNavigationModule, FoehnNavigationService, FoehnNotFoundModule, FoehnNotfoundComponent, FoehnPageComponent, FoehnPageCounterComponent, FoehnPageModalComponent, FoehnPageModule, FoehnPageService, FoehnPictureUploadComponent, FoehnPictureUploadModule, FoehnRadioComponent, FoehnRecapSectionComponent, FoehnRecapSectionModule, FoehnRemainingAlertsSummaryComponent, FoehnRemainingAlertsSummaryModule, FoehnSelectComponent, FoehnSkipLinkComponent, FoehnStatusProgressBarComponent, FoehnStatusProgressBarModule, FoehnTableColumnConfiguration, FoehnTableComponent, FoehnTableModule, FoehnTablePageChangeEvent, FoehnTimeComponent, FoehnUserConnectedAsComponent, FoehnUserConnectedAsModule, FoehnValidationAlertSummaryComponent, FoehnValidationAlertSummaryModule, FoehnValidationAlertsComponent, FoehnValidationAlertsModule, FooterLink, FormMetadata, FormPostResponse, FormSelectOption, FormatIdePipe, FormatterModule, GESDEM_MAX_DATA_LENGTH, GesdemActionRecoveryLoginComponent, GesdemActionRecoveryModule, GesdemActionRecoveryRegistrationComponent, GesdemConfirmationComponent, GesdemConfirmationModule, GesdemErrorComponent, GesdemErrorModule, GesdemEventService, GesdemHandlerService, GesdemLoaderGuard, GesdemStatutUtils, GrowlBrokerService, GrowlMessage, GrowlType, I18nForm, IbanFormatterDirective, IdeFormatterDirective, Locality, MonthYear, MultiUploadService, Municipality, NDCFormatterDirective, NavigationDirection, NumberCurrencyFormatterDirective, ObjectHelper, PORTAIL_BASE_URL_INT, PageChangeEvent, PaginationWeek, PendingFiles, PendingUploadService, PipeModule, PlaceOfOrigin, Portail, PostalLocality, Preferences, PrestationsNgCoreModule, RECAPTCHA_API_URL, RecaptchaService, RedirectComponent, SESSION_INFO_API_URL, SWISS_ISO_ID, SdkDictionaryModule, SdkDictionaryPipe, SdkDictionaryService, SdkEpaymentComponent, SdkEpaymentModule, SdkRecaptchaComponent, SdkRecaptchaModule, SdkRedirectModule, SdkStatisticsService, SelectedSlot, ServiceLocator, SessionInfo, SessionInfoData, SessionInfoWithApplicationService, Street, StreetNumber, THOUSANDS_SEPARATOR, TableSort, UploaderHelper, ValidationHandlerService, replaceAll };
12749
+ export { APP_INFO_API_URL, AbstractFoehnUploaderComponent, AbstractListDetailPageComponent, AbstractMenuPageComponent, AbstractPageComponent, AbstractPageFromMenuComponent, ActionStatut, Address, AddressTypeLight, ApplicationInfo, ApplicationInfoService, BAD_PARAMS_HELP_TEXT, BoDocumentError, BoDocumentsWithErrors, BoMultiUploadService, Breadcrumb, BreadcrumbEventService, BreadcrumbItem, CAPTCHA_ERROR_NAME, CURRENCY_REGEXP, Calendar, Canton, Captcha, ComponentError, Configuration, Country, CurrencyHelper, CurrentWeek, DECIMALS_SEPARATOR, DEFAULT_INTERNATIONAL_AND_NO_SWISS, DEFAULT_INTERNATIONAL_AND_NO_SWISS_MOBILE, DEFAULT_INTERNATIONAL_AND_NO_SWISS_PHONE, DEFAULT_INTERNATIONAL_HELP_TEXT, DEFAULT_SWISS_HELP_TEXT, DEFAULT_SWISS_MOBILE_PHONE_HELP_TEXT, DEFAULT_SWISS_PHONE_HELP_TEXT, DICTIONARY_BASE_URL, DateHelper, DatePickerHelper, DatePickerNavigationHelper, DayMonth, DaySlots, DisplayCurrencyPipe, DisplayDatePipe, DisplayLoginMessagesData, District, Document, DocumentError, DocumentReference, DocumentReferenceWithFile, DocumentsWithErrors, EPaymentService, EtapeInfo, FORM_SUPPORT_CYBER_TITLE_FALLBACK, FocusedDay, FoehnAbbrComponent, FoehnAddressModule, FoehnAgendaComponent, FoehnAgendaModule, FoehnAgendaNavigationComponent, FoehnAgendaTimeslotPanelComponent, FoehnAutocompleteComponent, FoehnAutocompleteModule, FoehnBoMultiUploadComponent, FoehnBoMultiUploadModule, FoehnBooleanCheckboxComponent, FoehnBooleanModule, FoehnBooleanRadioComponent, FoehnBreadcrumbComponent, FoehnBreadcrumbModule, FoehnCheckableGroupComponent, FoehnCheckablesModule, FoehnCheckboxComponent, FoehnConfirmModalComponent, FoehnConfirmModalContent, FoehnConfirmModalModule, FoehnConfirmModalService, FoehnDateComponent, FoehnDatePickerButtonComponent, FoehnDatePickerButtonModule, FoehnDatePickerComponent, FoehnDatePickerModule, FoehnDecisionElectroniqueComponent, FoehnDecisionElectroniqueModule, FoehnDisplayAddressComponent, FoehnErrorPillComponent, FoehnFormComponent, FoehnFormModule, FoehnHeaderComponent, FoehnHeaderModule, FoehnHelpModalComponent, FoehnHelpModalModule, FoehnIconCalendarComponent, FoehnIconCheckComponent, FoehnIconCheckSquareOComponent, FoehnIconChevronDownComponent, FoehnIconChevronLeftComponent, FoehnIconChevronRightComponent, FoehnIconChevronUpComponent, FoehnIconClockComponent, FoehnIconCommentDotsComponent, FoehnIconEditComponent, FoehnIconExternalLinkAltComponent, FoehnIconFilePdfComponent, FoehnIconInfoCircleComponent, FoehnIconLockComponent, FoehnIconMapMarkerComponent, FoehnIconMinusCircleComponent, FoehnIconPlusCircleComponent, FoehnIconPlusSquareComponent, FoehnIconSearchComponent, FoehnIconTimesComponent, FoehnIconTrashAltComponent, FoehnIconUnlockAltComponent, FoehnIconsModule, FoehnInputAddressComponent, FoehnInputComponent, FoehnInputEmailComponent, FoehnInputForeignLocalityComponent, FoehnInputForeignStreetComponent, FoehnInputHiddenComponent, FoehnInputModule, FoehnInputNav13Component, FoehnInputNav13Module, FoehnInputNumberComponent, FoehnInputPasswordComponent, FoehnInputPhoneComponent, FoehnInputStringComponent, FoehnInputTextComponent, FoehnInputTextareaComponent, FoehnListComponent, FoehnListItem, FoehnListModule, FoehnListSummaryComponent, FoehnMenuItemComponent, FoehnMenuItemTransmitComponent, FoehnMenuPrestationModule, FoehnMiscModule, FoehnModalComponent, FoehnModalModule, FoehnMultiUploadComponent, FoehnMultiUploadModule, FoehnMultiselectAutocompleteComponent, FoehnMultiselectAutocompleteModule, FoehnNavigationComponent, FoehnNavigationModule, FoehnNavigationService, FoehnNotFoundModule, FoehnNotfoundComponent, FoehnPageComponent, FoehnPageCounterComponent, FoehnPageModalComponent, FoehnPageModule, FoehnPageService, FoehnPictureUploadComponent, FoehnPictureUploadModule, FoehnRadioComponent, FoehnRecapSectionComponent, FoehnRecapSectionModule, FoehnRemainingAlertsSummaryComponent, FoehnRemainingAlertsSummaryModule, FoehnSelectComponent, FoehnSkipLinkComponent, FoehnStatusProgressBarComponent, FoehnStatusProgressBarModule, FoehnTableColumnConfiguration, FoehnTableComponent, FoehnTableModule, FoehnTablePageChangeEvent, FoehnTimeComponent, FoehnUserConnectedAsComponent, FoehnUserConnectedAsModule, FoehnValidationAlertSummaryComponent, FoehnValidationAlertSummaryModule, FoehnValidationAlertsComponent, FoehnValidationAlertsModule, FooterLink, FormMetadata, FormPostResponse, FormSelectOption, FormatIdePipe, FormatterModule, GESDEM_MAX_DATA_LENGTH, GesdemActionRecoveryLoginComponent, GesdemActionRecoveryModule, GesdemActionRecoveryRegistrationComponent, GesdemConfirmationComponent, GesdemConfirmationModule, GesdemErrorComponent, GesdemErrorModule, GesdemEventService, GesdemHandlerService, GesdemLoaderGuard, GesdemStatutUtils, GrowlBrokerService, GrowlMessage, GrowlType, I18nForm, IbanFormatterDirective, IdeFormatterDirective, Locality, MonthYear, MultiUploadService, Municipality, NDCFormatterDirective, NavigationDirection, NumberCurrencyFormatterDirective, ObjectHelper, PORTAIL_BASE_URL_INT, PageChangeEvent, PaginationWeek, PendingFiles, PendingUploadService, PipeModule, PlaceOfOrigin, Portail, PostalLocality, Preferences, PrestationsNgCoreModule, RECAPTCHA_API_URL, RecaptchaService, RedirectComponent, SESSION_INFO_API_URL, SWISS_ISO_ID, SdkDictionaryModule, SdkDictionaryPipe, SdkDictionaryService, SdkEpaymentComponent, SdkEpaymentModule, SdkRecaptchaComponent, SdkRecaptchaModule, SdkRedirectModule, SdkStatisticsService, SelectedSlot, ServiceLocator, SessionInfo, SessionInfoData, SessionInfoWithApplicationService, Street, StreetNumber, THOUSANDS_SEPARATOR, TableSort, UploaderHelper, ValidationHandlerService, formatDecimalCurrency, formatNonDecimalCurrency, replaceAll };
12717
12750
  //# sourceMappingURL=dsivd-prestations-ng.mjs.map