@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.
@@ -6537,6 +6537,122 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
6537
6537
  }]
6538
6538
  }] });
6539
6539
 
6540
+ // eslint-disable max-classes-per-file
6541
+ // eslint-disable-next-line prefer-arrow/prefer-arrow-functions,jsdoc/require-jsdoc
6542
+ function removeFormatting(value) {
6543
+ if (value === undefined || value === null) {
6544
+ // It's important to return null as the backend will consider this as no value.
6545
+ return null;
6546
+ }
6547
+ return value
6548
+ .toString()
6549
+ .trim()
6550
+ .replace(new RegExp(THOUSANDS_SEPARATOR, 'g'), '');
6551
+ }
6552
+ // eslint-disable-next-line prefer-arrow/prefer-arrow-functions,jsdoc/require-jsdoc
6553
+ function formatWithThousandSeparators(value) {
6554
+ return value.replace(CURRENCY_REGEXP, THOUSANDS_SEPARATOR);
6555
+ }
6556
+ // eslint-disable-next-line prefer-arrow/prefer-arrow-functions,jsdoc/require-jsdoc
6557
+ function formatDecimalCurrency(value, maxDecimalCount, maxLength, allowFreeInput) {
6558
+ if (value === undefined || value === null || value === '') {
6559
+ return null;
6560
+ }
6561
+ const [intg, dec] = removeFormatting(value).split(DECIMALS_SEPARATOR);
6562
+ if (allowFreeInput) {
6563
+ return (formatWithThousandSeparators(intg) +
6564
+ DECIMALS_SEPARATOR +
6565
+ (dec || '0').padEnd(maxDecimalCount, '0'));
6566
+ }
6567
+ if (maxDecimalCount === 0 || !maxDecimalCount) {
6568
+ return formatWithThousandSeparators(intg);
6569
+ }
6570
+ const validEmptyEnd = '0'.repeat(maxDecimalCount);
6571
+ let newEnd = dec ? dec + validEmptyEnd : validEmptyEnd;
6572
+ if (newEnd && newEnd.length >= maxDecimalCount) {
6573
+ newEnd = newEnd.substring(0, maxDecimalCount);
6574
+ }
6575
+ let newDecimal = intg + DECIMALS_SEPARATOR + newEnd;
6576
+ if (newDecimal.length > maxLength) {
6577
+ newDecimal = newDecimal.substring(0, maxLength);
6578
+ }
6579
+ [, newEnd] = newDecimal.split(DECIMALS_SEPARATOR);
6580
+ if (!newEnd) {
6581
+ return formatWithThousandSeparators(intg);
6582
+ }
6583
+ return formatWithThousandSeparators(intg) + DECIMALS_SEPARATOR + newEnd;
6584
+ }
6585
+ // eslint-disable-next-line prefer-arrow/prefer-arrow-functions,jsdoc/require-jsdoc
6586
+ function formatNonDecimalCurrency(value) {
6587
+ if (value === undefined || value === null) {
6588
+ return null;
6589
+ }
6590
+ return formatWithThousandSeparators(removeFormatting(value));
6591
+ }
6592
+ // eslint-disable-next-line @angular-eslint/directive-selector
6593
+ class NumberCurrencyFormatterDirective {
6594
+ constructor(host, ngZone) {
6595
+ this.host = host;
6596
+ this.ngZone = ngZone;
6597
+ this.hasFocus = false;
6598
+ }
6599
+ onBlur(value) {
6600
+ this.hasFocus = false;
6601
+ this.setFormatting(value);
6602
+ }
6603
+ onFocus(value) {
6604
+ this.hasFocus = true;
6605
+ this.host.forceUpdateNgModel(removeFormatting(value));
6606
+ }
6607
+ onModelChange(value) {
6608
+ if (!!value && !this.hasFocus) {
6609
+ this.setFormatting(value);
6610
+ }
6611
+ }
6612
+ ngOnInit() {
6613
+ // sometimes, when the view is "simple" and doesn't require lot a processing
6614
+ // we arrive in this method with this.host.model not already initialized, so the formatting is not working
6615
+ this.ngZone.onMicrotaskEmpty.pipe(first()).subscribe(() => {
6616
+ this.setFormatting(this.host.model);
6617
+ });
6618
+ }
6619
+ setFormatting(value) {
6620
+ // Hooks on the inputs of the component to customize the behavior
6621
+ const formattedValue = this.host.allowDecimal
6622
+ ? formatDecimalCurrency(value, this.host.maxDecimalCount, this.host.maxlength, this.host.allowFreeInput)
6623
+ : formatNonDecimalCurrency(value);
6624
+ const newValueWithoutFormatting = removeFormatting(formattedValue);
6625
+ if (this.hasValueChanged(newValueWithoutFormatting)) {
6626
+ // Since we have altered the model (i.e. by removing some decimals), we have to update it
6627
+ this.host.updateNgModel(newValueWithoutFormatting);
6628
+ }
6629
+ // Due to ngModel being possibly updated, we need to wait for a micro task empty
6630
+ this.ngZone.onMicrotaskEmpty.pipe(first()).subscribe(() => {
6631
+ // We're injection non-decimal characters, hence the force.
6632
+ this.host.forceUpdateNgModel(formattedValue);
6633
+ });
6634
+ }
6635
+ hasValueChanged(newValueWithoutFormatting) {
6636
+ return (!this.host.model ||
6637
+ this.host.model.toString() !== newValueWithoutFormatting);
6638
+ }
6639
+ }
6640
+ 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 });
6641
+ 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 });
6642
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NumberCurrencyFormatterDirective, decorators: [{
6643
+ type: Directive,
6644
+ args: [{ selector: '[numberCurrencyFormatter]' }]
6645
+ }], ctorParameters: function () { return [{ type: FoehnInputNumberComponent }, { type: i0.NgZone }]; }, propDecorators: { onBlur: [{
6646
+ type: HostListener,
6647
+ args: ['blur', ['$event.target.value']]
6648
+ }], onFocus: [{
6649
+ type: HostListener,
6650
+ args: ['focus', ['$event.target.value']]
6651
+ }], onModelChange: [{
6652
+ type: HostListener,
6653
+ args: ['modelChange', ['$event']]
6654
+ }] } });
6655
+
6540
6656
  class FoehnInputNumberComponent extends FoehnInputStringComponent {
6541
6657
  constructor(currencyHelper, dictionaryService) {
6542
6658
  super();
@@ -6544,6 +6660,7 @@ class FoehnInputNumberComponent extends FoehnInputStringComponent {
6544
6660
  this.dictionaryService = dictionaryService;
6545
6661
  this.hideStandardHelpText = false;
6546
6662
  this.maxDecimalCount = 2;
6663
+ this.allowFreeInput = false;
6547
6664
  }
6548
6665
  get model() {
6549
6666
  // If the setter is overridden, it's critical to override the getter too.
@@ -6568,15 +6685,31 @@ class FoehnInputNumberComponent extends FoehnInputStringComponent {
6568
6685
  this.maxlength = !!this.maxlength ? this.maxlength : 9;
6569
6686
  this.manageHelpText();
6570
6687
  }
6688
+ getMaxLength() {
6689
+ if (this.allowFreeInput) {
6690
+ return null;
6691
+ }
6692
+ return super.getMaxLength();
6693
+ }
6571
6694
  updateNgModel(value) {
6572
6695
  if (this.isEmpty(value)) {
6573
6696
  this.setToEmpty(value);
6574
6697
  return;
6575
6698
  }
6576
- let cleanNumber = this.getCleanNumber(value.toString());
6577
- const isModelValid = this.isModelValid(cleanNumber);
6578
- if (!isModelValid) {
6579
- cleanNumber = this.model;
6699
+ let cleanNumber;
6700
+ if (!this.allowFreeInput) {
6701
+ cleanNumber = this.getCleanNumber(value.toString());
6702
+ const isModelValid = this.isModelValid(cleanNumber);
6703
+ if (!isModelValid) {
6704
+ cleanNumber = this.model;
6705
+ }
6706
+ }
6707
+ else {
6708
+ const noCommaString = this.replaceCommaWithDot(value);
6709
+ cleanNumber =
6710
+ noCommaString && typeof noCommaString === 'string'
6711
+ ? noCommaString.replace(CLEAN_NEGATIVE_AND_DECIMAL_NUMBERS_PATTERN, '')
6712
+ : noCommaString;
6580
6713
  }
6581
6714
  super.updateNgModel(cleanNumber);
6582
6715
  // Need to update HTML input value because we let user input what he wants and then we clean model
@@ -6711,7 +6844,6 @@ class FoehnInputNumberComponent extends FoehnInputStringComponent {
6711
6844
  maxAsString += `.${'9'.repeat(this.maxDecimalCount)}`;
6712
6845
  }
6713
6846
  }
6714
- const max = this.currencyHelper.formatCurrency(Number(maxAsString), '', this.allowDecimal ? this.maxDecimalCount : null, true);
6715
6847
  let minAsString;
6716
6848
  if (this.min) {
6717
6849
  minAsString = this.min;
@@ -6720,16 +6852,26 @@ class FoehnInputNumberComponent extends FoehnInputStringComponent {
6720
6852
  minAsString = this.allowNegative
6721
6853
  ? `-${'9'.repeat(maxIntegerCount - 1)}`
6722
6854
  : '0';
6723
- if (this.allowDecimal && this.allowNegative) {
6724
- minAsString += `.${'9'.repeat(this.maxDecimalCount)}`;
6855
+ if (this.allowDecimal) {
6856
+ minAsString += this.allowNegative
6857
+ ? `.${'9'.repeat(this.maxDecimalCount || 0)}`
6858
+ : `.${'0'.repeat(this.maxDecimalCount || 0)}`;
6725
6859
  }
6726
6860
  }
6727
- const min = this.currencyHelper.formatCurrency(Number(minAsString), '', this.allowDecimal ? this.maxDecimalCount : null, true);
6728
- this.helpText += this.dictionaryService.getKeySync('foehn-input-number.standard-help-text.label', { minValue: min, maxValue: max });
6861
+ this.helpText += this.dictionaryService.getKeySync('foehn-input-number.standard-help-text.label', {
6862
+ minValue: this.formatValue(minAsString),
6863
+ maxValue: this.formatValue(maxAsString)
6864
+ });
6865
+ }
6866
+ formatValue(value) {
6867
+ if (this.allowDecimal) {
6868
+ return formatDecimalCurrency(value?.toString(), this.maxDecimalCount, this.maxlength, this.allowFreeInput);
6869
+ }
6870
+ return formatNonDecimalCurrency(value?.toString());
6729
6871
  }
6730
6872
  }
6731
6873
  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 });
6732
- 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: [
6874
+ 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: [
6733
6875
  {
6734
6876
  provide: FoehnInputComponent,
6735
6877
  useExisting: forwardRef(() => FoehnInputNumberComponent),
@@ -6753,6 +6895,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
6753
6895
  type: Input
6754
6896
  }], maxDecimalCount: [{
6755
6897
  type: Input
6898
+ }], allowFreeInput: [{
6899
+ type: Input
6756
6900
  }], model: [{
6757
6901
  type: Input
6758
6902
  }] } });
@@ -7944,7 +8088,7 @@ FoehnDateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ver
7944
8088
  useExisting: forwardRef(() => FoehnDateComponent),
7945
8089
  multi: true
7946
8090
  }
7947
- ], 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 } });
8091
+ ], 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 } });
7948
8092
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: FoehnDateComponent, decorators: [{
7949
8093
  type: Component,
7950
8094
  args: [{ selector: 'foehn-input-date', providers: [
@@ -8023,7 +8167,7 @@ FoehnTimeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ver
8023
8167
  useExisting: forwardRef(() => FoehnTimeComponent),
8024
8168
  multi: true
8025
8169
  }
8026
- ], 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 } });
8170
+ ], 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 } });
8027
8171
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: FoehnTimeComponent, decorators: [{
8028
8172
  type: Component,
8029
8173
  args: [{ selector: 'foehn-input-time', providers: [
@@ -9216,7 +9360,7 @@ FoehnInputNav13Component.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0
9216
9360
  useExisting: forwardRef(() => FoehnInputNav13Component),
9217
9361
  multi: true
9218
9362
  }
9219
- ], 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 } });
9363
+ ], 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 } });
9220
9364
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: FoehnInputNav13Component, decorators: [{
9221
9365
  type: Component,
9222
9366
  args: [{ selector: 'foehn-input-nav13', providers: [
@@ -11468,117 +11612,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
11468
11612
  class FoehnConfirmModalContent {
11469
11613
  }
11470
11614
 
11471
- // eslint-disable max-classes-per-file
11472
- // eslint-disable-next-line prefer-arrow/prefer-arrow-functions,jsdoc/require-jsdoc
11473
- function removeFormatting(value) {
11474
- if (value === undefined || value === null) {
11475
- // It's important to return null as the backend will consider this as no value.
11476
- return null;
11477
- }
11478
- return value
11479
- .toString()
11480
- .trim()
11481
- .replace(new RegExp(THOUSANDS_SEPARATOR, 'g'), '');
11482
- }
11483
- // eslint-disable-next-line prefer-arrow/prefer-arrow-functions,jsdoc/require-jsdoc
11484
- function formatWithThousandSeparators(value) {
11485
- return value.replace(CURRENCY_REGEXP, THOUSANDS_SEPARATOR);
11486
- }
11487
- // eslint-disable-next-line prefer-arrow/prefer-arrow-functions,jsdoc/require-jsdoc
11488
- function formatDecimalCurrency(value, maxDecimalCount, maxLength) {
11489
- if (value === undefined || value === null || value === '') {
11490
- return null;
11491
- }
11492
- const [intg, dec] = removeFormatting(value).split(DECIMALS_SEPARATOR);
11493
- if (maxDecimalCount === 0) {
11494
- return formatWithThousandSeparators(intg);
11495
- }
11496
- const validEmptyEnd = '0'.repeat(maxDecimalCount);
11497
- let newEnd = dec ? dec + validEmptyEnd : validEmptyEnd;
11498
- if (newEnd && newEnd.length >= maxDecimalCount) {
11499
- newEnd = newEnd.substring(0, maxDecimalCount);
11500
- }
11501
- let newDecimal = intg + DECIMALS_SEPARATOR + newEnd;
11502
- if (newDecimal.length > maxLength) {
11503
- newDecimal = newDecimal.substring(0, maxLength);
11504
- }
11505
- [, newEnd] = newDecimal.split(DECIMALS_SEPARATOR);
11506
- if (!newEnd) {
11507
- return formatWithThousandSeparators(intg);
11508
- }
11509
- return formatWithThousandSeparators(intg) + DECIMALS_SEPARATOR + newEnd;
11510
- }
11511
- // eslint-disable-next-line prefer-arrow/prefer-arrow-functions,jsdoc/require-jsdoc
11512
- function formatNonDecimalCurrency(value) {
11513
- if (value === undefined || value === null) {
11514
- return null;
11515
- }
11516
- return formatWithThousandSeparators(removeFormatting(value));
11517
- }
11518
- // eslint-disable-next-line @angular-eslint/directive-selector
11519
- class NumberCurrencyFormatterDirective {
11520
- constructor(host, ngZone) {
11521
- this.host = host;
11522
- this.ngZone = ngZone;
11523
- this.hasFocus = false;
11524
- }
11525
- onBlur(value) {
11526
- this.hasFocus = false;
11527
- this.setFormatting(value);
11528
- }
11529
- onFocus(value) {
11530
- this.hasFocus = true;
11531
- this.host.forceUpdateNgModel(removeFormatting(value));
11532
- }
11533
- onModelChange(value) {
11534
- if (!!value && !this.hasFocus) {
11535
- this.setFormatting(value);
11536
- }
11537
- }
11538
- ngOnInit() {
11539
- // sometimes, when the view is "simple" and doesn't require lot a processing
11540
- // we arrive in this method with this.host.model not already initialized, so the formatting is not working
11541
- this.ngZone.onMicrotaskEmpty.pipe(first()).subscribe(() => {
11542
- this.setFormatting(this.host.model);
11543
- });
11544
- }
11545
- setFormatting(value) {
11546
- // Hooks on the inputs of the component to customize the behavior
11547
- const formattedValue = this.host.allowDecimal
11548
- ? formatDecimalCurrency(value, this.host.maxDecimalCount, this.host.maxlength)
11549
- : formatNonDecimalCurrency(value);
11550
- const newValueWithoutFormatting = removeFormatting(formattedValue);
11551
- if (this.hasValueChanged(newValueWithoutFormatting)) {
11552
- // Since we have altered the model (i.e. by removing some decimals), we have to update it
11553
- this.host.updateNgModel(newValueWithoutFormatting);
11554
- }
11555
- // Due to ngModel being possibly updated, we need to wait for a micro task empty
11556
- this.ngZone.onMicrotaskEmpty.pipe(first()).subscribe(() => {
11557
- // We're injection non-decimal characters, hence the force.
11558
- this.host.forceUpdateNgModel(formattedValue);
11559
- });
11560
- }
11561
- hasValueChanged(newValueWithoutFormatting) {
11562
- return (!this.host.model ||
11563
- this.host.model.toString() !== newValueWithoutFormatting);
11564
- }
11565
- }
11566
- 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 });
11567
- 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 });
11568
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImport: i0, type: NumberCurrencyFormatterDirective, decorators: [{
11569
- type: Directive,
11570
- args: [{ selector: '[numberCurrencyFormatter]' }]
11571
- }], ctorParameters: function () { return [{ type: FoehnInputNumberComponent }, { type: i0.NgZone }]; }, propDecorators: { onBlur: [{
11572
- type: HostListener,
11573
- args: ['blur', ['$event.target.value']]
11574
- }], onFocus: [{
11575
- type: HostListener,
11576
- args: ['focus', ['$event.target.value']]
11577
- }], onModelChange: [{
11578
- type: HostListener,
11579
- args: ['modelChange', ['$event']]
11580
- }] } });
11581
-
11582
11615
  const NO_CONTRIB_PATTERN = '^((\\d\\.?){0,7})(\\d)$';
11583
11616
  const NO_CONTRIB_PATTERN_WITH_NO_DOT = '^(\\d{1,2})$';
11584
11617
  const NO_CONTRIB_PATTERN_WITH_ONE_DOT = '^(\\d{1,3})(\\d{2})$';
@@ -12699,5 +12732,5 @@ class SelectedSlot {
12699
12732
  * Generated bundle index. Do not edit.
12700
12733
  */
12701
12734
 
12702
- 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 };
12735
+ 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 };
12703
12736
  //# sourceMappingURL=dsivd-prestations-ng.mjs.map