@dsivd/prestations-ng 15.3.1-beta6 → 15.3.1-beta7

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.
@@ -6811,6 +6811,19 @@ function formatWithThousandSeparators(value) {
6811
6811
  return value.replace(CURRENCY_REGEXP, THOUSANDS_SEPARATOR);
6812
6812
  }
6813
6813
  // eslint-disable-next-line prefer-arrow/prefer-arrow-functions,jsdoc/require-jsdoc
6814
+ function formatNumberAsGiven(value) {
6815
+ if (value === undefined || value === null || value === '') {
6816
+ return null;
6817
+ }
6818
+ const [intg, dec] = removeFormatting(value).split(DECIMALS_SEPARATOR);
6819
+ if (!!dec?.length && dec !== undefined) {
6820
+ return formatWithThousandSeparators(intg) + DECIMALS_SEPARATOR + dec;
6821
+ }
6822
+ else {
6823
+ return formatWithThousandSeparators(intg);
6824
+ }
6825
+ }
6826
+ // eslint-disable-next-line prefer-arrow/prefer-arrow-functions,jsdoc/require-jsdoc
6814
6827
  function formatDecimalCurrency(value, maxDecimalCount, maxLength, allowFreeInput) {
6815
6828
  if (value === undefined || value === null || value === '') {
6816
6829
  return null;
@@ -6875,7 +6888,7 @@ class NumberCurrencyFormatterDirective {
6875
6888
  }
6876
6889
  setFormatting(value) {
6877
6890
  // Hooks on the inputs of the component to customize the behavior
6878
- const formattedValue = this.host.allowDecimal
6891
+ const formattedValue = this.host.allowDecimal || this.host.allowFreeInput
6879
6892
  ? formatDecimalCurrency(value, this.host.maxDecimalCount, this.host.maxlength, this.host.allowFreeInput)
6880
6893
  : formatNonDecimalCurrency(value);
6881
6894
  const newValueWithoutFormatting = removeFormatting(formattedValue);
@@ -6910,6 +6923,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.11", ngImpo
6910
6923
  args: ['modelChange', ['$event']]
6911
6924
  }] } });
6912
6925
 
6926
+ const isDefined = (value) => value === 0 || !!value;
6913
6927
  class FoehnInputNumberComponent extends FoehnInputStringComponent {
6914
6928
  constructor(currencyHelper, dictionaryService) {
6915
6929
  super();
@@ -6967,6 +6981,11 @@ class FoehnInputNumberComponent extends FoehnInputStringComponent {
6967
6981
  noCommaString && typeof noCommaString === 'string'
6968
6982
  ? noCommaString.replace(CLEAN_NEGATIVE_AND_DECIMAL_NUMBERS_PATTERN, '')
6969
6983
  : noCommaString;
6984
+ // check that it is a number in any of its possible form
6985
+ // to avoid -3.14-23--534
6986
+ if (!NEGATIVE_AND_DECIMAL_NUMBERS_PATTERN.test(cleanNumber)) {
6987
+ cleanNumber = this.model;
6988
+ }
6970
6989
  }
6971
6990
  super.updateNgModel(cleanNumber);
6972
6991
  // Need to update HTML input value because we let user input what he wants and then we clean model
@@ -6981,35 +7000,11 @@ class FoehnInputNumberComponent extends FoehnInputStringComponent {
6981
7000
  this.model_ = value;
6982
7001
  this.updateInputElementValue(value);
6983
7002
  }
6984
- isValueInRange(value) {
6985
- if (this.allowNegative && value === '-') {
6986
- return true;
6987
- }
6988
- const valueAsNumber = this.toNumber(value);
6989
- if (!this.isEmpty(this.min) || !this.isEmpty(this.max)) {
6990
- if (isNaN(valueAsNumber)) {
6991
- return false;
6992
- }
6993
- if (!this.isEmpty(this.min) && !this.isEmpty(this.max)) {
6994
- return valueAsNumber >= this.min && valueAsNumber <= this.max;
6995
- }
6996
- if (!this.isEmpty(this.min)) {
6997
- return valueAsNumber >= this.min;
6998
- }
6999
- if (!this.isEmpty(this.max)) {
7000
- return valueAsNumber <= this.max;
7001
- }
7002
- }
7003
- return true;
7004
- }
7005
- toNumber(value) {
7006
- return this.allowDecimal ? parseFloat(value) : parseInt(value, 10);
7007
- }
7008
7003
  isStringAValidNumber(value) {
7009
7004
  return this.getValidationRegex().test(value);
7010
7005
  }
7011
7006
  isModelValid(value) {
7012
- return this.isStringAValidNumber(value) && this.isValueInRange(value);
7007
+ return this.isStringAValidNumber(value);
7013
7008
  }
7014
7009
  getValidationRegex(isForClean = false) {
7015
7010
  if (this.allowDecimal || this.allowNegative) {
@@ -7082,6 +7077,21 @@ class FoehnInputNumberComponent extends FoehnInputStringComponent {
7082
7077
  if (!!this.hideStandardHelpText) {
7083
7078
  return;
7084
7079
  }
7080
+ if (!this.allowFreeInput) {
7081
+ if (isDefined(this.min) && isDefined(this.max)) {
7082
+ if (!!this.helpText?.length) {
7083
+ this.helpText += '<br/>';
7084
+ }
7085
+ else {
7086
+ this.helpText = '';
7087
+ }
7088
+ this.helpText += this.dictionaryService.getKeySync('foehn-input-number.standard-help-text.label', {
7089
+ minValue: formatNumberAsGiven(this.min.toString()),
7090
+ maxValue: formatNumberAsGiven(this.max.toString())
7091
+ });
7092
+ }
7093
+ return;
7094
+ }
7085
7095
  if (!!this.helpText?.length) {
7086
7096
  this.helpText += '<br/>';
7087
7097
  }
@@ -12823,5 +12833,5 @@ class SelectedSlot {
12823
12833
  * Generated bundle index. Do not edit.
12824
12834
  */
12825
12835
 
12826
- 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 };
12836
+ 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, formatNumberAsGiven, replaceAll };
12827
12837
  //# sourceMappingURL=dsivd-prestations-ng.mjs.map