@anglr/common 20.0.0-beta.20240529082303 → 20.0.0-beta.20240530105358
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +68 -0
- package/es2022/date-fns/src/misc/utils.js.map +1 -1
- package/es2022/floating-ui/src/services/floatingUiDomPosition.service.js +3 -3
- package/es2022/floating-ui/src/services/floatingUiDomPosition.service.js.map +1 -1
- package/es2022/forms/src/components/defaultValidationErrors/defaultValidationErrors.component.js +14 -24
- package/es2022/forms/src/components/defaultValidationErrors/defaultValidationErrors.component.js.map +1 -1
- package/es2022/forms/src/components/defaultValidationErrorsContainer/defaultValidationErrorsContainer.component.js +4 -24
- package/es2022/forms/src/components/defaultValidationErrorsContainer/defaultValidationErrorsContainer.component.js.map +1 -1
- package/es2022/forms/src/components/reservedSpaceValidationErrorsContainer/reservedSpaceValidationErrorsContainer.component.js +4 -28
- package/es2022/forms/src/components/reservedSpaceValidationErrorsContainer/reservedSpaceValidationErrorsContainer.component.js.map +1 -1
- package/es2022/forms/src/directives/groupHasError/groupHasError.directive.js +14 -14
- package/es2022/forms/src/directives/groupHasError/groupHasError.directive.js.map +1 -1
- package/es2022/forms/src/directives/groupHasErrorContainer/groupHasErrorContainer.directive.js +5 -4
- package/es2022/forms/src/directives/groupHasErrorContainer/groupHasErrorContainer.directive.js.map +1 -1
- package/es2022/forms/src/directives/hasError/hasError.directive.js +72 -111
- package/es2022/forms/src/directives/hasError/hasError.directive.js.map +1 -1
- package/es2022/forms/src/directives/numberInput/maxValueNumberValidator.directive.js +7 -21
- package/es2022/forms/src/directives/numberInput/maxValueNumberValidator.directive.js.map +1 -1
- package/es2022/forms/src/directives/numberInput/minValueNumberValidator.directive.js +7 -21
- package/es2022/forms/src/directives/numberInput/minValueNumberValidator.directive.js.map +1 -1
- package/es2022/forms/src/directives/numberInput/numberInputControlValueAccessor.directive.js +13 -15
- package/es2022/forms/src/directives/numberInput/numberInputControlValueAccessor.directive.js.map +1 -1
- package/es2022/forms/src/directives/numberInput/numberInputValidator.directive.js +3 -3
- package/es2022/forms/src/directives/numberInput/numberInputValidator.directive.js.map +1 -1
- package/es2022/forms/src/directives/requiredClass/requiredClass.directive.js +32 -27
- package/es2022/forms/src/directives/requiredClass/requiredClass.directive.js.map +1 -1
- package/es2022/forms/src/directives/validationErrorsContainer/validationErrorsContainer.directive.js +5 -4
- package/es2022/forms/src/directives/validationErrorsContainer/validationErrorsContainer.directive.js.map +1 -1
- package/es2022/forms/src/index.js +0 -1
- package/es2022/forms/src/index.js.map +1 -1
- package/es2022/forms/src/misc/formModel/decorators/formGroupAsyncValidator.decorator.js.map +1 -1
- package/es2022/forms/src/misc/formModel/decorators/formGroupValidator.decorator.js.map +1 -1
- package/es2022/forms/src/misc/formModel/decorators/invalidateOnChange.decorator.js.map +1 -1
- package/es2022/forms/src/misc/formModel/decorators/modelPropertyMetadata.decorator.js.map +1 -1
- package/es2022/forms/src/misc/formModel/decorators/requiredIf.decorator.js.map +1 -1
- package/es2022/forms/src/misc/formModel/misc/currentValue.js +0 -1
- package/es2022/forms/src/misc/formModel/misc/currentValue.js.map +1 -1
- package/es2022/forms/src/misc/formModel/misc/utils.js.map +1 -1
- package/es2022/forms/src/misc/formModel/misc/validatorFactories.js +0 -4
- package/es2022/forms/src/misc/formModel/misc/validatorFactories.js.map +1 -1
- package/es2022/forms/src/misc/utils.js.map +1 -1
- package/es2022/forms/src/misc/validationErrorsContainerView.js +7 -9
- package/es2022/forms/src/misc/validationErrorsContainerView.js.map +1 -1
- package/es2022/forms/src/misc/validators.js.map +1 -1
- package/es2022/forms/src/modules/errorMessage/components/groupErrors/groupErrors.component.js +7 -29
- package/es2022/forms/src/modules/errorMessage/components/groupErrors/groupErrors.component.js.map +1 -1
- package/es2022/forms/src/modules/errorMessage/directives/errorMessage/errorMessage.directive.js +8 -20
- package/es2022/forms/src/modules/errorMessage/directives/errorMessage/errorMessage.directive.js.map +1 -1
- package/es2022/forms/src/modules/errorMessage/directives/groupErrorsTemplate/groupErrorsTemplate.directive.js +3 -4
- package/es2022/forms/src/modules/errorMessage/directives/groupErrorsTemplate/groupErrorsTemplate.directive.js.map +1 -1
- package/es2022/forms/src/modules/errorMessage/modules/errorMessage.module.js +6 -6
- package/es2022/forms/src/modules/errorMessage/modules/errorMessage.module.js.map +1 -1
- package/es2022/forms/src/modules/errorMessage/pipes/withErrorMessage/withErrorMessage.pipe.js +3 -4
- package/es2022/forms/src/modules/errorMessage/pipes/withErrorMessage/withErrorMessage.pipe.js.map +1 -1
- package/es2022/forms/src/modules/formPipes/modules/formPipes.module.js +5 -5
- package/es2022/forms/src/modules/formPipes/modules/formPipes.module.js.map +1 -1
- package/es2022/forms/src/modules/formPipes/pipes/asFormArray/asFormArray.pipe.js +3 -4
- package/es2022/forms/src/modules/formPipes/pipes/asFormArray/asFormArray.pipe.js.map +1 -1
- package/es2022/forms/src/modules/formPipes/pipes/asFormControl/asFormControl.pipe.js +3 -4
- package/es2022/forms/src/modules/formPipes/pipes/asFormControl/asFormControl.pipe.js.map +1 -1
- package/es2022/forms/src/modules/formPipes/pipes/asFormGroup/asFormGroup.pipe.js +3 -4
- package/es2022/forms/src/modules/formPipes/pipes/asFormGroup/asFormGroup.pipe.js.map +1 -1
- package/es2022/forms/src/modules/formPipes/pipes/getControl/getControl.pipe.js +3 -3
- package/es2022/forms/src/modules/formPipes/pipes/getControl/getControl.pipe.js.map +1 -1
- package/es2022/forms/src/modules/hasError.module.js +6 -17
- package/es2022/forms/src/modules/hasError.module.js.map +1 -1
- package/es2022/forms/src/modules/numberInput.module.js +5 -5
- package/es2022/forms/src/modules/numberInput.module.js.map +1 -1
- package/es2022/forms/src/services/errorMessagesExtractor/errorMessagesExtractor.service.js +3 -10
- package/es2022/forms/src/services/errorMessagesExtractor/errorMessagesExtractor.service.js.map +1 -1
- package/es2022/forms/src/services/formModelBuilder/formModelBuilder.service.js +3 -4
- package/es2022/forms/src/services/formModelBuilder/formModelBuilder.service.js.map +1 -1
- package/es2022/forms/src/services/submitted/submitted.service.js +14 -12
- package/es2022/forms/src/services/submitted/submitted.service.js.map +1 -1
- package/es2022/forms/src/services/validationErrorRenderer/validationErrorRenderer.service.js +3 -24
- package/es2022/forms/src/services/validationErrorRenderer/validationErrorRenderer.service.js.map +1 -1
- package/es2022/hotkeys/src/components/cheatSheet/cheatSheet.component.js +18 -21
- package/es2022/hotkeys/src/components/cheatSheet/cheatSheet.component.js.map +1 -1
- package/es2022/hotkeys/src/services/appHotkeys.service.js +20 -26
- package/es2022/hotkeys/src/services/appHotkeys.service.js.map +1 -1
- package/es2022/material/src/components/confirmationDialog/confirmationDialog.component.js +3 -10
- package/es2022/material/src/components/confirmationDialog/confirmationDialog.component.js.map +1 -1
- package/es2022/material/src/components/movableTitledDialog/movableTitledDialog.component.js +3 -3
- package/es2022/material/src/components/movableTitledDialog/movableTitledDialog.component.js.map +1 -1
- package/es2022/material/src/components/titledDialog/titledDialog.component.js +3 -10
- package/es2022/material/src/components/titledDialog/titledDialog.component.js.map +1 -1
- package/es2022/material/src/directives/confirmationDialog/confirmationDialog.directive.js +37 -38
- package/es2022/material/src/directives/confirmationDialog/confirmationDialog.directive.js.map +1 -1
- package/es2022/material/src/directives/debugDataCopyClick/debugDataCopyClick.directive.js +10 -16
- package/es2022/material/src/directives/debugDataCopyClick/debugDataCopyClick.directive.js.map +1 -1
- package/es2022/material/src/modules/confirmationDialog.module.js +6 -6
- package/es2022/material/src/modules/confirmationDialog.module.js.map +1 -1
- package/es2022/material/src/modules/debugDataCopyClick.module.js +5 -5
- package/es2022/material/src/modules/debugDataCopyClick.module.js.map +1 -1
- package/es2022/material/src/modules/movableTitledDialog.module.js +6 -6
- package/es2022/material/src/modules/movableTitledDialog.module.js.map +1 -1
- package/es2022/material/src/modules/titledDialog.module.js +6 -6
- package/es2022/material/src/modules/titledDialog.module.js.map +1 -1
- package/es2022/material/src/services/titledDialog/titledDialog.service.js +3 -5
- package/es2022/material/src/services/titledDialog/titledDialog.service.js.map +1 -1
- package/es2022/material/src/services/titledDialog/titledDialogService.options.js +5 -5
- package/es2022/material/src/services/titledDialog/titledDialogService.options.js.map +1 -1
- package/es2022/moment/src/misc/utils.js.map +1 -1
- package/es2022/moment/src/modules/moment.module.js +5 -5
- package/es2022/moment/src/modules/moment.module.js.map +1 -1
- package/es2022/moment/src/pipes/momentConvert/momentConvert.pipe.js +3 -3
- package/es2022/moment/src/pipes/momentConvert/momentConvert.pipe.js.map +1 -1
- package/es2022/moment/src/pipes/momentFormat/momentFormat.pipe.js +3 -3
- package/es2022/moment/src/pipes/momentFormat/momentFormat.pipe.js.map +1 -1
- package/es2022/router/src/decorators/componentRedirectRoute.decorator.js.map +1 -1
- package/es2022/router/src/decorators/componentRoute.decorator.js.map +1 -1
- package/es2022/router/src/decorators/moduleRoutes.decorator.js.map +1 -1
- package/es2022/router/src/misc/utils.js.map +1 -1
- package/es2022/router/src/services/routing/dataRouter.js +16 -17
- package/es2022/router/src/services/routing/dataRouter.js.map +1 -1
- package/es2022/router/src/services/routing/dataRouterData.js +3 -8
- package/es2022/router/src/services/routing/dataRouterData.js.map +1 -1
- package/es2022/src/components/collapsibleIcon/collapsibleIcon.component.js +20 -22
- package/es2022/src/components/collapsibleIcon/collapsibleIcon.component.js.map +1 -1
- package/es2022/src/components/collapsibleTitle/collapsibleTitle.component.js +18 -20
- package/es2022/src/components/collapsibleTitle/collapsibleTitle.component.js.map +1 -1
- package/es2022/src/decorators/asSignal/asSignal.decorator.js.map +1 -1
- package/es2022/src/decorators/componentHostStyle/componentHostStyle.decorator.js.map +1 -1
- package/es2022/src/decorators/typeProvider/typeProvider.decorator.js.map +1 -1
- package/es2022/src/directives/bodyRender/bodyRender.directive.js +4 -23
- package/es2022/src/directives/bodyRender/bodyRender.directive.js.map +1 -1
- package/es2022/src/directives/clickOutside/clickOutside.directive.js +27 -39
- package/es2022/src/directives/clickOutside/clickOutside.directive.js.map +1 -1
- package/es2022/src/directives/ellipsisTooltip/ellipsisTooltip.directive.js +33 -48
- package/es2022/src/directives/ellipsisTooltip/ellipsisTooltip.directive.js.map +1 -1
- package/es2022/src/directives/goBack/goBack.directive.js +4 -5
- package/es2022/src/directives/goBack/goBack.directive.js.map +1 -1
- package/es2022/src/directives/ngComponentOutletEx/ngComponentOutletEx.directive.js +13 -27
- package/es2022/src/directives/ngComponentOutletEx/ngComponentOutletEx.directive.js.map +1 -1
- package/es2022/src/directives/positionTo/positionTo.directive.js +20 -45
- package/es2022/src/directives/positionTo/positionTo.directive.js.map +1 -1
- package/es2022/src/modules/castPipes/modules/castPipes.module.js +5 -5
- package/es2022/src/modules/castPipes/modules/castPipes.module.js.map +1 -1
- package/es2022/src/modules/castPipes/pipes/asHtmlElement/asHtmlElement.pipe.js +3 -3
- package/es2022/src/modules/castPipes/pipes/asHtmlElement/asHtmlElement.pipe.js.map +1 -1
- package/es2022/src/modules/castPipes/pipes/asNgClassRequired/asNgClassRequired.pipe.js +3 -3
- package/es2022/src/modules/castPipes/pipes/asNgClassRequired/asNgClassRequired.pipe.js.map +1 -1
- package/es2022/src/modules/castPipes/pipes/asRequired/asRequired.pipe.js +3 -3
- package/es2022/src/modules/castPipes/pipes/asRequired/asRequired.pipe.js.map +1 -1
- package/es2022/src/modules/castPipes/pipes/castType/castType.pipe.js +8 -9
- package/es2022/src/modules/castPipes/pipes/castType/castType.pipe.js.map +1 -1
- package/es2022/src/modules/commonDynamic.module.js +4 -4
- package/es2022/src/modules/commonDynamic.module.js.map +1 -1
- package/es2022/src/modules/commonLocalize.module.js +4 -4
- package/es2022/src/modules/commonLocalize.module.js.map +1 -1
- package/es2022/src/modules/commonUtils.module.js +21 -21
- package/es2022/src/modules/commonUtils.module.js.map +1 -1
- package/es2022/src/modules/debugData/components/debugData/debugData.component.js +3 -5
- package/es2022/src/modules/debugData/components/debugData/debugData.component.js.map +1 -1
- package/es2022/src/modules/debugData/modules/debugData.module.js +4 -4
- package/es2022/src/modules/debugData/modules/debugData.module.js.map +1 -1
- package/es2022/src/modules/debugData/services/debugDataEnabled/debugDataEnabled.service.js +10 -8
- package/es2022/src/modules/debugData/services/debugDataEnabled/debugDataEnabled.service.js.map +1 -1
- package/es2022/src/modules/logger/components/console/console.component.js +16 -23
- package/es2022/src/modules/logger/components/console/console.component.js.map +1 -1
- package/es2022/src/modules/logger/decorators/loggerSink.decorator.js.map +1 -1
- package/es2022/src/modules/logger/misc/utils.js.map +1 -1
- package/es2022/src/modules/logger/services/console/consoleComponent.service.js +18 -16
- package/es2022/src/modules/logger/services/console/consoleComponent.service.js.map +1 -1
- package/es2022/src/modules/logger/services/console/consoleComponent.sink.js +7 -5
- package/es2022/src/modules/logger/services/console/consoleComponent.sink.js.map +1 -1
- package/es2022/src/modules/logger/services/console/consoleComponentService.options.js +8 -8
- package/es2022/src/modules/logger/services/console/consoleComponentService.options.js.map +1 -1
- package/es2022/src/modules/logger/services/developmentConsoleSink/developmentConsole.sink.js.map +1 -1
- package/es2022/src/modules/logger/services/logLevelEnricher/logLevelEnricher.enricher.js.map +1 -1
- package/es2022/src/modules/logger/services/logger/logger.service.js +3 -4
- package/es2022/src/modules/logger/services/logger/logger.service.js.map +1 -1
- package/es2022/src/modules/logger/services/rest/rest.sink.js +17 -21
- package/es2022/src/modules/logger/services/rest/rest.sink.js.map +1 -1
- package/es2022/src/modules/logger/services/rest/restSink.options.js +16 -16
- package/es2022/src/modules/logger/services/rest/restSink.options.js.map +1 -1
- package/es2022/src/modules/logger/services/subLoggerSink/subLogger.sink.js +0 -1
- package/es2022/src/modules/logger/services/subLoggerSink/subLogger.sink.js.map +1 -1
- package/es2022/src/modules/logger/types/loggerConfiguration.js +8 -17
- package/es2022/src/modules/logger/types/loggerConfiguration.js.map +1 -1
- package/es2022/src/modules/logger/types/loggerOptions.js +30 -28
- package/es2022/src/modules/logger/types/loggerOptions.js.map +1 -1
- package/es2022/src/modules/logger/types/messageLog.js +5 -18
- package/es2022/src/modules/logger/types/messageLog.js.map +1 -1
- package/es2022/src/modules/multiButton/components/multiButton/multiButton.component.js +33 -46
- package/es2022/src/modules/multiButton/components/multiButton/multiButton.component.js.map +1 -1
- package/es2022/src/modules/multiButton/modules/multiButton.module.js +4 -4
- package/es2022/src/modules/multiButton/modules/multiButton.module.js.map +1 -1
- package/es2022/src/modules/progressIndicator/components/progressIndicator/progressIndicator.component.js +9 -21
- package/es2022/src/modules/progressIndicator/components/progressIndicator/progressIndicator.component.js.map +1 -1
- package/es2022/src/modules/progressIndicator/directives/progressOverlay/progressOverlay.directive.js +7 -45
- package/es2022/src/modules/progressIndicator/directives/progressOverlay/progressOverlay.directive.js.map +1 -1
- package/es2022/src/modules/progressIndicator/interceptors/progressInterceptor.js +3 -4
- package/es2022/src/modules/progressIndicator/interceptors/progressInterceptor.js.map +1 -1
- package/es2022/src/modules/progressIndicator/modules/progressIndicator.module.js +6 -6
- package/es2022/src/modules/progressIndicator/modules/progressIndicator.module.js.map +1 -1
- package/es2022/src/modules/progressIndicator/services/progressIndicator.service.js +29 -30
- package/es2022/src/modules/progressIndicator/services/progressIndicator.service.js.map +1 -1
- package/es2022/src/modules/progressIndicator/services/progressIndicatorOptions.js +9 -9
- package/es2022/src/modules/progressIndicator/services/progressIndicatorOptions.js.map +1 -1
- package/es2022/src/modules/tooltip/components/tooltip/tooltip.component.js +16 -31
- package/es2022/src/modules/tooltip/components/tooltip/tooltip.component.js.map +1 -1
- package/es2022/src/modules/tooltip/directives/tooltip/tooltip.directive.js +20 -77
- package/es2022/src/modules/tooltip/directives/tooltip/tooltip.directive.js.map +1 -1
- package/es2022/src/modules/tooltip/directives/tooltipTemplate/tooltipTemplate.directive.js +3 -4
- package/es2022/src/modules/tooltip/directives/tooltipTemplate/tooltipTemplate.directive.js.map +1 -1
- package/es2022/src/modules/tooltip/modules/tooltip.module.js +5 -5
- package/es2022/src/modules/tooltip/modules/tooltip.module.js.map +1 -1
- package/es2022/src/pipes/displayProperties/displayProperties.pipe.js +4 -4
- package/es2022/src/pipes/displayProperties/displayProperties.pipe.js.map +1 -1
- package/es2022/src/pipes/firstUppercase/firstUppercase.pipe.js +3 -3
- package/es2022/src/pipes/firstUppercase/firstUppercase.pipe.js.map +1 -1
- package/es2022/src/pipes/firstUppercaseLocalize/firstUppercaseLocalize.pipe.js +3 -18
- package/es2022/src/pipes/firstUppercaseLocalize/firstUppercaseLocalize.pipe.js.map +1 -1
- package/es2022/src/pipes/index.js +1 -0
- package/es2022/src/pipes/index.js.map +1 -1
- package/es2022/src/pipes/isNaN/isNaN.pipe.js +4 -4
- package/es2022/src/pipes/isNaN/isNaN.pipe.js.map +1 -1
- package/es2022/src/pipes/isPresent/isPresent.pipe.js +4 -4
- package/es2022/src/pipes/isPresent/isPresent.pipe.js.map +1 -1
- package/es2022/src/pipes/keys/keys.pipe.js +4 -4
- package/es2022/src/pipes/keys/keys.pipe.js.map +1 -1
- package/es2022/src/pipes/localize/localize.pipe.js +3 -10
- package/es2022/src/pipes/localize/localize.pipe.js.map +1 -1
- package/es2022/src/pipes/mergeCssClasses/mergeCssClasses.pipe.js +3 -3
- package/es2022/src/pipes/mergeCssClasses/mergeCssClasses.pipe.js.map +1 -1
- package/es2022/{numeral/src/pipes → src/pipes/numeral}/numeral.pipe.js +8 -15
- package/es2022/src/pipes/numeral/numeral.pipe.js.map +1 -0
- package/es2022/src/pipes/trimText/trimText.pipe.js +3 -3
- package/es2022/src/pipes/trimText/trimText.pipe.js.map +1 -1
- package/es2022/src/pipes/urlEncode/urlEncode.pipe.js +4 -4
- package/es2022/src/pipes/urlEncode/urlEncode.pipe.js.map +1 -1
- package/es2022/src/services/cookies/cookies.service.js +8 -9
- package/es2022/src/services/cookies/cookies.service.js.map +1 -1
- package/es2022/src/services/notifications/defaultNotifications.service.js +24 -25
- package/es2022/src/services/notifications/defaultNotifications.service.js.map +1 -1
- package/es2022/src/services/notifications/notifications.interface.js +0 -3
- package/es2022/src/services/notifications/notifications.interface.js.map +1 -1
- package/es2022/src/services/notifications/notificationsOptions.js +5 -5
- package/es2022/src/services/notifications/notificationsOptions.js.map +1 -1
- package/es2022/src/services/permanentStorage/cookiePermanentStorage.service.js +3 -4
- package/es2022/src/services/permanentStorage/cookiePermanentStorage.service.js.map +1 -1
- package/es2022/src/services/position/position.interface.js.map +1 -1
- package/es2022/src/services/statusCode/statusCode.service.js +3 -8
- package/es2022/src/services/statusCode/statusCode.service.js.map +1 -1
- package/es2022/src/services/stringLocalization/noStringLocalization.service.js +10 -8
- package/es2022/src/services/stringLocalization/noStringLocalization.service.js.map +1 -1
- package/es2022/src/services/temporaryStorage/memoryTemporaryStorage.service.js +10 -8
- package/es2022/src/services/temporaryStorage/memoryTemporaryStorage.service.js.map +1 -1
- package/es2022/src/utils/index.js.map +1 -1
- package/es2022/store/src/services/permanentStorage/localPermanentStorage.service.js +3 -3
- package/es2022/store/src/services/permanentStorage/localPermanentStorage.service.js.map +1 -1
- package/es2022/store/src/services/temporaryStorage/sessionTemporaryStorage.service.js +3 -3
- package/es2022/store/src/services/temporaryStorage/sessionTemporaryStorage.service.js.map +1 -1
- package/floating-ui/src/services/floatingUiDomPosition.service.d.ts +5 -5
- package/floating-ui/src/services/floatingUiDomPosition.service.d.ts.map +1 -1
- package/forms/src/components/defaultValidationErrors/defaultValidationErrors.component.d.ts +1 -1
- package/forms/src/components/defaultValidationErrors/defaultValidationErrors.component.d.ts.map +1 -1
- package/forms/src/components/defaultValidationErrors/defaultValidationErrors.component.html +9 -3
- package/forms/src/components/defaultValidationErrorsContainer/defaultValidationErrorsContainer.component.d.ts +1 -1
- package/forms/src/components/defaultValidationErrorsContainer/defaultValidationErrorsContainer.component.d.ts.map +1 -1
- package/forms/src/components/reservedSpaceValidationErrorsContainer/reservedSpaceValidationErrorsContainer.component.d.ts +1 -1
- package/forms/src/components/reservedSpaceValidationErrorsContainer/reservedSpaceValidationErrorsContainer.component.d.ts.map +1 -1
- package/forms/src/directives/groupHasError/groupHasError.directive.d.ts +1 -1
- package/forms/src/directives/groupHasError/groupHasError.directive.d.ts.map +1 -1
- package/forms/src/directives/groupHasErrorContainer/groupHasErrorContainer.directive.d.ts +1 -1
- package/forms/src/directives/groupHasErrorContainer/groupHasErrorContainer.directive.d.ts.map +1 -1
- package/forms/src/directives/hasError/hasError.directive.d.ts +24 -32
- package/forms/src/directives/hasError/hasError.directive.d.ts.map +1 -1
- package/forms/src/directives/requiredClass/requiredClass.directive.d.ts +14 -12
- package/forms/src/directives/requiredClass/requiredClass.directive.d.ts.map +1 -1
- package/forms/src/directives/validationErrorsContainer/validationErrorsContainer.directive.d.ts +1 -1
- package/forms/src/directives/validationErrorsContainer/validationErrorsContainer.directive.d.ts.map +1 -1
- package/forms/src/index.d.ts +0 -1
- package/forms/src/index.d.ts.map +1 -1
- package/forms/src/modules/hasError.module.d.ts +1 -5
- package/forms/src/modules/hasError.module.d.ts.map +1 -1
- package/hotkeys/src/components/cheatSheet/cheatSheet.component.d.ts +3 -3
- package/hotkeys/src/components/cheatSheet/cheatSheet.component.d.ts.map +1 -1
- package/hotkeys/src/components/cheatSheet/cheatSheet.component.html +13 -7
- package/lerna.json +4 -0
- package/package.json +54 -57
- package/readme.md +0 -1
- package/router/src/decorators/moduleRoutes.decorator.d.ts.map +1 -1
- package/src/components/collapsibleIcon/collapsibleIcon.component.d.ts +3 -3
- package/src/components/collapsibleIcon/collapsibleIcon.component.d.ts.map +1 -1
- package/src/components/collapsibleTitle/collapsibleTitle.component.d.ts +3 -3
- package/src/components/collapsibleTitle/collapsibleTitle.component.d.ts.map +1 -1
- package/src/directives/bodyRender/bodyRender.directive.d.ts +3 -3
- package/src/directives/bodyRender/bodyRender.directive.d.ts.map +1 -1
- package/src/directives/ellipsisTooltip/ellipsisTooltip.directive.d.ts +3 -3
- package/src/directives/ellipsisTooltip/ellipsisTooltip.directive.d.ts.map +1 -1
- package/src/directives/goBack/goBack.directive.d.ts +3 -3
- package/src/directives/goBack/goBack.directive.d.ts.map +1 -1
- package/src/directives/positionTo/positionTo.directive.d.ts +2 -2
- package/src/directives/positionTo/positionTo.directive.d.ts.map +1 -1
- package/src/modules/commonUtils.module.d.ts +1 -1
- package/src/modules/tooltip/directives/tooltip/tooltip.directive.d.ts +3 -3
- package/src/modules/tooltip/directives/tooltip/tooltip.directive.d.ts.map +1 -1
- package/src/pipes/displayProperties/displayProperties.pipe.d.ts +3 -3
- package/src/pipes/displayProperties/displayProperties.pipe.d.ts.map +1 -1
- package/src/pipes/index.d.ts +1 -0
- package/src/pipes/index.d.ts.map +1 -1
- package/src/pipes/isNaN/isNaN.pipe.d.ts +3 -3
- package/src/pipes/isNaN/isNaN.pipe.d.ts.map +1 -1
- package/src/pipes/isPresent/isPresent.pipe.d.ts +3 -3
- package/src/pipes/isPresent/isPresent.pipe.d.ts.map +1 -1
- package/src/pipes/keys/keys.pipe.d.ts +3 -3
- package/src/pipes/keys/keys.pipe.d.ts.map +1 -1
- package/{numeral/src/pipes → src/pipes/numeral}/numeral.pipe.d.ts +4 -4
- package/{numeral/src/pipes → src/pipes/numeral}/numeral.pipe.d.ts.map +1 -1
- package/src/pipes/urlEncode/urlEncode.pipe.d.ts +3 -3
- package/src/pipes/urlEncode/urlEncode.pipe.d.ts.map +1 -1
- package/src/services/position/position.interface.d.ts +10 -10
- package/src/services/position/position.interface.d.ts.map +1 -1
- package/version.bak +1 -1
- package/es2022/forms/src/modules/requiredClass.module.js +0 -19
- package/es2022/forms/src/modules/requiredClass.module.js.map +0 -1
- package/es2022/numeral/src/index.js +0 -2
- package/es2022/numeral/src/index.js.map +0 -1
- package/es2022/numeral/src/pipes/numeral.pipe.js.map +0 -1
- package/forms/src/modules/requiredClass.module.d.ts +0 -11
- package/forms/src/modules/requiredClass.module.d.ts.map +0 -1
- package/numeral/package.json +0 -8
- package/numeral/src/index.d.ts +0 -2
- package/numeral/src/index.d.ts.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
|
-
import { Directive,
|
|
3
|
-
import { FormControlDirective, FormControlName, NgModel } from '@angular/forms';
|
|
2
|
+
import { Directive, Optional, SkipSelf, Inject, Input, Injector, ViewContainerRef, Type, TemplateRef } from '@angular/core';
|
|
3
|
+
import { FormControlDirective, FormControlName, NgModel, PristineChangeEvent } from '@angular/forms';
|
|
4
4
|
import { STRING_LOCALIZATION } from '@anglr/common';
|
|
5
5
|
import { generateId, BindThis } from '@jscrpt/common';
|
|
6
|
-
import { Subscription } from 'rxjs';
|
|
6
|
+
import { Subscription, filter } from 'rxjs';
|
|
7
7
|
import { ValidationErrorRendererFactory } from '../../services/validationErrorRenderer/validationErrorRenderer.service';
|
|
8
8
|
import { SubmittedService } from '../../services/submitted/submitted.service';
|
|
9
9
|
import { GroupHasErrorDirective } from '../groupHasError/groupHasError.directive';
|
|
@@ -14,94 +14,69 @@ import * as i2 from "../groupHasError/groupHasError.directive";
|
|
|
14
14
|
import * as i3 from "@angular/forms";
|
|
15
15
|
import * as i4 from "../../services/submitted/submitted.service";
|
|
16
16
|
import * as i5 from "../../misc/validationErrorsContainerView";
|
|
17
|
-
//TODO
|
|
17
|
+
//TODO: add support for setting renderer factory options using input
|
|
18
18
|
/**
|
|
19
19
|
* Directive that is attached to control element and handles css classes that are added to this element
|
|
20
20
|
*/
|
|
21
21
|
export class HasErrorDirective {
|
|
22
|
-
|
|
23
|
-
_rendererFactory;
|
|
24
|
-
_viewContainer;
|
|
25
|
-
_groupHasError;
|
|
26
|
-
_formControl;
|
|
27
|
-
_formControlName;
|
|
28
|
-
_ngModel;
|
|
29
|
-
_submittedSvc;
|
|
30
|
-
_containerView;
|
|
31
|
-
_stringLocalization;
|
|
32
|
-
_injector;
|
|
33
|
-
//######################### private fields #########################
|
|
34
|
-
/**
|
|
35
|
-
* Subscriptions that are destroyed with destruction of this directive
|
|
36
|
-
*/
|
|
37
|
-
_subscriptions = new Subscription();
|
|
38
|
-
/**
|
|
39
|
-
* Unique generated id of control
|
|
40
|
-
*/
|
|
41
|
-
_id = generateId(10);
|
|
42
|
-
/**
|
|
43
|
-
* Last value of control pristine attribute
|
|
44
|
-
*/
|
|
45
|
-
_previousDirty = false;
|
|
46
|
-
/**
|
|
47
|
-
* Indication whether currently are any errors rendered
|
|
48
|
-
*/
|
|
49
|
-
_hasErrors = false;
|
|
50
|
-
/**
|
|
51
|
-
* Mutation observer used for observing changes on class of element
|
|
52
|
-
*/
|
|
53
|
-
_observer;
|
|
54
|
-
//######################### private properties #########################
|
|
22
|
+
//######################### protected properties #########################
|
|
55
23
|
/**
|
|
56
24
|
* Gets control which was assigned to this element
|
|
57
25
|
*/
|
|
58
26
|
get control() {
|
|
59
|
-
return this.
|
|
27
|
+
return this.formControl?.control || this.formControlName?.control || this.ngModel?.control;
|
|
60
28
|
}
|
|
61
|
-
//######################### public properties #########################
|
|
62
|
-
/**
|
|
63
|
-
* Instance of validation error renderer
|
|
64
|
-
*/
|
|
65
|
-
renderer;
|
|
66
|
-
//######################### public propeties - inputs #########################
|
|
67
|
-
/**
|
|
68
|
-
* Customized error messages
|
|
69
|
-
*/
|
|
70
|
-
errorMessages;
|
|
71
|
-
/**
|
|
72
|
-
* Custom component used for rendering validation errors
|
|
73
|
-
*/
|
|
74
|
-
errorsComponent;
|
|
75
|
-
/**
|
|
76
|
-
* Custom template used for rendering validation errors
|
|
77
|
-
*/
|
|
78
|
-
errorsTemplate;
|
|
79
29
|
//######################### constructor #########################
|
|
80
|
-
constructor(
|
|
81
|
-
this.
|
|
82
|
-
this.
|
|
83
|
-
this.
|
|
84
|
-
this.
|
|
85
|
-
this.
|
|
86
|
-
this.
|
|
87
|
-
this.
|
|
88
|
-
this.
|
|
89
|
-
this.
|
|
90
|
-
this.
|
|
91
|
-
|
|
30
|
+
constructor(rendererFactory, viewContainer, groupHasError, formControl, formControlName, ngModel, submittedSvc, containerView, stringLocalization, injector) {
|
|
31
|
+
this.rendererFactory = rendererFactory;
|
|
32
|
+
this.viewContainer = viewContainer;
|
|
33
|
+
this.groupHasError = groupHasError;
|
|
34
|
+
this.formControl = formControl;
|
|
35
|
+
this.formControlName = formControlName;
|
|
36
|
+
this.ngModel = ngModel;
|
|
37
|
+
this.submittedSvc = submittedSvc;
|
|
38
|
+
this.containerView = containerView;
|
|
39
|
+
this.stringLocalization = stringLocalization;
|
|
40
|
+
this.injector = injector;
|
|
41
|
+
//######################### protected fields #########################
|
|
42
|
+
/**
|
|
43
|
+
* Subscriptions that are destroyed with destruction of this directive
|
|
44
|
+
*/
|
|
45
|
+
this.subscriptions = new Subscription();
|
|
46
|
+
/**
|
|
47
|
+
* Unique generated id of control
|
|
48
|
+
*/
|
|
49
|
+
this.id = generateId(10);
|
|
50
|
+
/**
|
|
51
|
+
* Last value of control pristine attribute
|
|
52
|
+
*/
|
|
53
|
+
this.previousDirty = false;
|
|
54
|
+
/**
|
|
55
|
+
* Indication whether currently are any errors rendered
|
|
56
|
+
*/
|
|
57
|
+
this.hasErrors = false;
|
|
92
58
|
}
|
|
93
59
|
//######################### public methods - implementation of OnInit #########################
|
|
94
60
|
/**
|
|
95
61
|
* Initialize component
|
|
96
62
|
*/
|
|
97
63
|
ngOnInit() {
|
|
98
|
-
this.
|
|
99
|
-
this.
|
|
100
|
-
this.
|
|
101
|
-
this.
|
|
102
|
-
this.
|
|
103
|
-
|
|
104
|
-
|
|
64
|
+
this.containerView ??= new ValidationErrorsContainerView();
|
|
65
|
+
this.containerView.viewContainer ??= this.viewContainer;
|
|
66
|
+
this.subscriptions.add(this.stringLocalization.textsChange.subscribe(() => this.updateStatus()));
|
|
67
|
+
this.subscriptions.add(this.control.statusChanges.subscribe(() => this.updateStatus()));
|
|
68
|
+
this.subscriptions.add(this.control
|
|
69
|
+
.events
|
|
70
|
+
.pipe(filter(itm => itm instanceof PristineChangeEvent))
|
|
71
|
+
.subscribe(event => {
|
|
72
|
+
const pristineEvent = event;
|
|
73
|
+
//only if dirty(pristine) is different
|
|
74
|
+
if (pristineEvent.pristine == this.previousDirty) {
|
|
75
|
+
this.updateStatus();
|
|
76
|
+
}
|
|
77
|
+
}));
|
|
78
|
+
if (this.submittedSvc) {
|
|
79
|
+
this.subscriptions.add(this.submittedSvc.submittedChange.subscribe(() => this.isSubmittedOrDirty(() => this.updateStatus())));
|
|
105
80
|
}
|
|
106
81
|
}
|
|
107
82
|
//######################### public methods - implementation of AfterViewInit #########################
|
|
@@ -109,24 +84,23 @@ export class HasErrorDirective {
|
|
|
109
84
|
* Called when view was initialized
|
|
110
85
|
*/
|
|
111
86
|
ngAfterViewInit() {
|
|
112
|
-
this.renderer = this.
|
|
113
|
-
this.
|
|
87
|
+
this.renderer = this.rendererFactory.create(this.control, this.containerView, this.injector, this.isSubmittedOrDirty);
|
|
88
|
+
this.updateStatus();
|
|
114
89
|
}
|
|
115
90
|
//######################### public methods - implementation of OnDestroy #########################
|
|
116
91
|
/**
|
|
117
92
|
* Called when component is destroyed
|
|
118
93
|
*/
|
|
119
94
|
ngOnDestroy() {
|
|
120
|
-
this.
|
|
121
|
-
this.
|
|
122
|
-
this._observer?.disconnect();
|
|
95
|
+
this.subscriptions.unsubscribe();
|
|
96
|
+
this.groupHasError?.unregisterControl(this.id);
|
|
123
97
|
this.renderer?.destroy();
|
|
124
98
|
}
|
|
125
|
-
//#########################
|
|
99
|
+
//######################### protected methods #########################
|
|
126
100
|
/**
|
|
127
101
|
* Updates status of control and css classes
|
|
128
102
|
*/
|
|
129
|
-
|
|
103
|
+
updateStatus() {
|
|
130
104
|
if (!this.renderer) {
|
|
131
105
|
return;
|
|
132
106
|
}
|
|
@@ -137,16 +111,16 @@ export class HasErrorDirective {
|
|
|
137
111
|
else if (this.errorsComponent) {
|
|
138
112
|
opts.component = this.errorsComponent;
|
|
139
113
|
}
|
|
140
|
-
this.
|
|
141
|
-
this.
|
|
142
|
-
this.
|
|
114
|
+
this.previousDirty = this.control.dirty;
|
|
115
|
+
this.hasErrors = this.renderer.update(opts, this.errorMessages);
|
|
116
|
+
this.toggleGroupHasError();
|
|
143
117
|
}
|
|
144
118
|
/**
|
|
145
119
|
* Toggles registration of control in parent group
|
|
146
120
|
*/
|
|
147
|
-
|
|
148
|
-
if (this.
|
|
149
|
-
this.
|
|
121
|
+
toggleGroupHasError() {
|
|
122
|
+
if (this.groupHasError) {
|
|
123
|
+
this.isSubmittedOrDirty(() => this.groupHasError.registerControl(this.id), () => this.groupHasError.unregisterControl(this.id), this.hasErrors);
|
|
150
124
|
}
|
|
151
125
|
}
|
|
152
126
|
/**
|
|
@@ -155,9 +129,9 @@ export class HasErrorDirective {
|
|
|
155
129
|
* @param falseAction - Action to be called when form is not submitted and control is not dirty
|
|
156
130
|
* @param additionalCondition - Additional condition to be evaluated
|
|
157
131
|
*/
|
|
158
|
-
|
|
132
|
+
isSubmittedOrDirty(action, falseAction = () => { }, additionalCondition = true) {
|
|
159
133
|
//submitted form or dirty control
|
|
160
|
-
if ((this.
|
|
134
|
+
if ((this.submittedSvc?.submitted ||
|
|
161
135
|
this.control?.dirty) &&
|
|
162
136
|
additionalCondition) {
|
|
163
137
|
action();
|
|
@@ -166,35 +140,22 @@ export class HasErrorDirective {
|
|
|
166
140
|
falseAction();
|
|
167
141
|
}
|
|
168
142
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
*/
|
|
172
|
-
_registerMutationObserver() {
|
|
173
|
-
this._observer = new MutationObserver(() => {
|
|
174
|
-
if (this.control.dirty != this._previousDirty) {
|
|
175
|
-
this._updateStatus();
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
this._observer.observe(this._element.nativeElement, {
|
|
179
|
-
attributeFilter: ['class'],
|
|
180
|
-
attributes: true
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.5", ngImport: i0, type: HasErrorDirective, deps: [{ token: i0.ElementRef }, { token: i1.ValidationErrorRendererFactory }, { token: i0.ViewContainerRef }, { token: i2.GroupHasErrorDirective, optional: true, skipSelf: true }, { token: i3.FormControlDirective, optional: true }, { token: i3.FormControlName, optional: true }, { token: i3.NgModel, optional: true }, { token: i4.SubmittedService, optional: true }, { token: i5.ValidationErrorsContainerView, optional: true }, { token: STRING_LOCALIZATION }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Directive });
|
|
184
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.0.5", type: HasErrorDirective, selector: "[hasError]", inputs: { errorMessages: "errorMessages", errorsComponent: "errorsComponent", errorsTemplate: "errorsTemplate" }, ngImport: i0 });
|
|
143
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: HasErrorDirective, deps: [{ token: i1.ValidationErrorRendererFactory }, { token: i0.ViewContainerRef }, { token: i2.GroupHasErrorDirective, optional: true, skipSelf: true }, { token: i3.FormControlDirective, optional: true }, { token: i3.FormControlName, optional: true }, { token: i3.NgModel, optional: true }, { token: i4.SubmittedService, optional: true }, { token: i5.ValidationErrorsContainerView, optional: true }, { token: STRING_LOCALIZATION }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
144
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.1", type: HasErrorDirective, isStandalone: true, selector: "[hasError][formControlName],[hasError][formControl],[hasError][ngModel]", inputs: { errorMessages: "errorMessages", errorsComponent: "errorsComponent", errorsTemplate: "errorsTemplate" }, ngImport: i0 }); }
|
|
185
145
|
}
|
|
186
146
|
__decorate([
|
|
187
147
|
BindThis,
|
|
188
148
|
__metadata("design:type", Function),
|
|
189
149
|
__metadata("design:paramtypes", [Function, Function, Boolean]),
|
|
190
150
|
__metadata("design:returntype", void 0)
|
|
191
|
-
], HasErrorDirective.prototype, "
|
|
192
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
151
|
+
], HasErrorDirective.prototype, "isSubmittedOrDirty", null);
|
|
152
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: HasErrorDirective, decorators: [{
|
|
193
153
|
type: Directive,
|
|
194
154
|
args: [{
|
|
195
|
-
selector: '[hasError]'
|
|
155
|
+
selector: '[hasError][formControlName],[hasError][formControl],[hasError][ngModel]',
|
|
156
|
+
standalone: true,
|
|
196
157
|
}]
|
|
197
|
-
}], ctorParameters: () => [{ type:
|
|
158
|
+
}], ctorParameters: () => [{ type: i1.ValidationErrorRendererFactory }, { type: i0.ViewContainerRef }, { type: i2.GroupHasErrorDirective, decorators: [{
|
|
198
159
|
type: Optional
|
|
199
160
|
}, {
|
|
200
161
|
type: SkipSelf
|
|
@@ -217,5 +178,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.5", ngImpor
|
|
|
217
178
|
type: Input
|
|
218
179
|
}], errorsTemplate: [{
|
|
219
180
|
type: Input
|
|
220
|
-
}],
|
|
181
|
+
}], isSubmittedOrDirty: [] } });
|
|
221
182
|
//# sourceMappingURL=hasError.directive.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hasError.directive.js","sourceRoot":"","sources":["../../../../../forms/src/directives/hasError/hasError.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAqB,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAiB,IAAI,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AACxK,OAAO,EAAC,oBAAoB,EAAE,eAAe,EAAe,OAAO,EAAC,MAAM,gBAAgB,CAAC;AAC3F,OAAO,EAAqB,mBAAmB,EAAC,MAAM,eAAe,CAAC;AACtE,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAmB,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAElC,OAAO,EAAC,8BAA8B,EAAC,MAAM,wEAAwE,CAAC;AAEtH,OAAO,EAAC,gBAAgB,EAAC,MAAM,4CAA4C,CAAC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a,EAAE,SAAS;YAC7B,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC;YACrB,mBAAmB,EACtB;YACI,MAAM,EAAE,CAAC;SACZ;aAED;YACI,WAAW,EAAE,CAAC;SACjB;IACL,CAAC;IAED;;OAEG;IACK,yBAAyB;QAE7B,IAAI,CAAC,SAAS,GAAG,IAAI,gBAAgB,CAAC,GAAG,EAAE;YAEvC,IAAG,IAAI,CAAC,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC,cAAc,EAC5C;gBACI,IAAI,CAAC,aAAa,EAAE,CAAC;aACxB;QACL,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,EAClD;YACI,eAAe,EAAE,CAAC,OAAO,CAAC;YAC1B,UAAU,EAAE,IAAI;SACnB,CAAC,CAAC;IACP,CAAC;uGApNQ,iBAAiB,ubA4EN,mBAAmB;2FA5E9B,iBAAiB;;AAmLlB;IADP,QAAQ;;;;4DAcR;2FAhMQ,iBAAiB;kBAJ7B,SAAS;mBACV;oBACI,QAAQ,EAAE,YAAY;iBACzB;;0BAuEgB,QAAQ;;0BAAI,QAAQ;;0BACpB,QAAQ;;0BACR,QAAQ;;0BACR,QAAQ;;0BACR,QAAQ;;0BACR,QAAQ;;0BACR,MAAM;2BAAC,mBAAmB;gEAxBhC,aAAa;sBADnB,KAAK;gBAOC,eAAe;sBADrB,KAAK;gBAOC,cAAc;sBADpB,KAAK;gBAoHE,mBAAmB","sourcesContent":["import {Directive, ElementRef, Optional, SkipSelf, OnInit, OnDestroy, Inject, Input, Injector, ViewContainerRef, AfterViewInit, Type, TemplateRef} from '@angular/core';\nimport {FormControlDirective, FormControlName, FormControl, NgModel} from '@angular/forms';\nimport {StringLocalization, STRING_LOCALIZATION} from '@anglr/common';\nimport {generateId, BindThis, StringDictionary} from '@jscrpt/common';\nimport {Subscription} from 'rxjs';\n\nimport {ValidationErrorRendererFactory} from '../../services/validationErrorRenderer/validationErrorRenderer.service';\nimport {ValidationErrorRenderer, ValidationErrorsComponent, ValidationErrorsRendererOptions, ValidationErrorsTemplateContext} from '../../services/validationErrorRenderer/validationErrorRenderer.interface';\nimport {SubmittedService} from '../../services/submitted/submitted.service';\nimport {GroupHasErrorDirective} from '../groupHasError/groupHasError.directive';\nimport {ValidationErrorsContainerView} from '../../misc/validationErrorsContainerView';\n\n//TODO - add support for setting renderer factory options using input\n\n/**\n * Directive that is attached to control element and handles css classes that are added to this element\n */\n@Directive(\n{\n selector: '[hasError]'\n})\nexport class HasErrorDirective implements OnInit, AfterViewInit, OnDestroy\n{\n //######################### private fields #########################\n\n /**\n * Subscriptions that are destroyed with destruction of this directive\n */\n private _subscriptions: Subscription = new Subscription();\n\n /**\n * Unique generated id of control\n */\n private _id: string = generateId(10);\n\n /**\n * Last value of control pristine attribute\n */\n private _previousDirty: boolean = false;\n\n /**\n * Indication whether currently are any errors rendered\n */\n private _hasErrors: boolean = false;\n\n /**\n * Mutation observer used for observing changes on class of element\n */\n private _observer: MutationObserver;\n\n //######################### private properties #########################\n\n /**\n * Gets control which was assigned to this element\n */\n private get control(): FormControl\n {\n return this._formControl?.control || this._formControlName?.control || this._ngModel?.control;\n }\n\n //######################### public properties #########################\n\n /**\n * Instance of validation error renderer\n */\n public renderer: ValidationErrorRenderer;\n\n //######################### public propeties - inputs #########################\n\n /**\n * Customized error messages\n */\n @Input()\n public errorMessages: StringDictionary;\n\n /**\n * Custom component used for rendering validation errors\n */\n @Input()\n public errorsComponent?: Type<ValidationErrorsComponent>;\n\n /**\n * Custom template used for rendering validation errors\n */\n @Input()\n public errorsTemplate?: TemplateRef<ValidationErrorsTemplateContext>;\n\n //######################### constructor #########################\n constructor(private _element: ElementRef<HTMLElement>,\n private _rendererFactory: ValidationErrorRendererFactory,\n private _viewContainer: ViewContainerRef,\n @Optional() @SkipSelf() private _groupHasError: GroupHasErrorDirective,\n @Optional() private _formControl: FormControlDirective,\n @Optional() private _formControlName: FormControlName,\n @Optional() private _ngModel: NgModel,\n @Optional() private _submittedSvc: SubmittedService,\n @Optional() private _containerView: ValidationErrorsContainerView,\n @Inject(STRING_LOCALIZATION) protected _stringLocalization: StringLocalization,\n protected _injector: Injector)\n {\n }\n\n //######################### public methods - implementation of OnInit #########################\n \n /**\n * Initialize component\n */\n public ngOnInit(): void\n {\n this._containerView ??= new ValidationErrorsContainerView();\n this._containerView.viewContainer ??= this._viewContainer;\n\n this._registerMutationObserver();\n\n this._subscriptions.add(this._stringLocalization.textsChange.subscribe(() => this._updateStatus()));\n this._subscriptions.add(this.control.statusChanges.subscribe(() => this._updateStatus()));\n\n if(this._submittedSvc)\n {\n this._subscriptions.add(this._submittedSvc.submittedChange.subscribe(() => this._isSubmittedOrDirty(() => this._updateStatus())));\n }\n }\n\n //######################### public methods - implementation of AfterViewInit #########################\n \n /**\n * Called when view was initialized\n */\n public ngAfterViewInit(): void\n {\n this.renderer = this._rendererFactory.create(this.control,\n this._containerView,\n this._injector,\n this._isSubmittedOrDirty);\n\n this._updateStatus();\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n \n /**\n * Called when component is destroyed\n */\n public ngOnDestroy(): void\n {\n this._subscriptions.unsubscribe();\n\n this._groupHasError?.unregisterControl(this._id);\n this._observer?.disconnect();\n this.renderer?.destroy();\n }\n\n //######################### private methods #########################\n\n /**\n * Updates status of control and css classes\n */\n private _updateStatus(): void\n {\n if(!this.renderer)\n {\n return;\n }\n\n const opts: ValidationErrorsRendererOptions = {};\n\n if(this.errorsTemplate)\n {\n opts.template = this.errorsTemplate;\n }\n else if(this.errorsComponent)\n {\n opts.component = this.errorsComponent;\n }\n\n this._previousDirty = this.control.dirty;\n this._hasErrors = this.renderer.update(opts, this.errorMessages);\n this._toggleGroupHasError();\n }\n\n /**\n * Toggles registration of control in parent group\n */\n private _toggleGroupHasError(): void\n {\n if(this._groupHasError)\n {\n this._isSubmittedOrDirty(() => this._groupHasError.registerControl(this._id),\n () => this._groupHasError.unregisterControl(this._id),\n this._hasErrors);\n }\n }\n\n /**\n * Calls action when form is submitted or control is dirty\n * @param action - Action to be called when form is submitted or control dirty\n * @param falseAction - Action to be called when form is not submitted and control is not dirty\n * @param additionalCondition - Additional condition to be evaluated\n */\n @BindThis\n private _isSubmittedOrDirty(action: () => void, falseAction: () => void = () => {}, additionalCondition: boolean = true): void\n {\n //submitted form or dirty control\n if((this._submittedSvc?.submitted ||\n this.control?.dirty) &&\n additionalCondition)\n {\n action();\n }\n else\n {\n falseAction();\n }\n }\n\n /**\n * Registers mutation observer which watch for changes of class list\n */\n private _registerMutationObserver(): void\n {\n this._observer = new MutationObserver(() =>\n {\n if(this.control.dirty != this._previousDirty)\n {\n this._updateStatus();\n }\n });\n\n this._observer.observe(this._element.nativeElement, \n {\n attributeFilter: ['class'],\n attributes: true\n });\n }\n}"]}
|
|
1
|
+
{"version":3,"file":"hasError.directive.js","sourceRoot":"","sources":["../../../../../forms/src/directives/hasError/hasError.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAqB,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAiB,IAAI,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AAC5J,OAAO,EAAC,oBAAoB,EAAE,eAAe,EAAe,OAAO,EAAE,mBAAmB,EAAC,MAAM,gBAAgB,CAAC;AAChH,OAAO,EAAqB,mBAAmB,EAAC,MAAM,eAAe,CAAC;AACtE,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAmB,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAC,YAAY,EAAE,MAAM,EAAC,MAAM,MAAM,CAAC;AAE1C,OAAO,EAAC,8BAA8B,EAAC,MAAM,wEAAwE,CAAC;AAEtH,OAAO,EAAC,gBAAgB,EAAC,MAAM,4CAA4C,CAAC;AAC5E,OAAO,EAAC,sBAAsB,EAAC,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAC,6BAA6B,EAA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AAC,OAAO,EAAE,KAAK,CAAC;YACrB,mBAAmB,EACtB,CAAC;YACG,MAAM,EAAE,CAAC;QACb,CAAC;aAED,CAAC;YACG,WAAW,EAAE,CAAC;QAClB,CAAC;IACL,CAAC;8GApMQ,iBAAiB,6ZAsEN,mBAAmB;kGAtE9B,iBAAiB;;AAuLhB;IADT,QAAQ;;;;2DAcR;2FApMQ,iBAAiB;kBAL7B,SAAS;mBACV;oBACI,QAAQ,EAAE,yEAAyE;oBACnF,UAAU,EAAE,IAAI;iBACnB;;0BAiEgB,QAAQ;;0BAAI,QAAQ;;0BACpB,QAAQ;;0BACR,QAAQ;;0BACR,QAAQ;;0BACR,QAAQ;;0BACR,QAAQ;;0BACR,MAAM;2BAAC,mBAAmB;gEAvBhC,aAAa;sBADnB,KAAK;gBAOC,eAAe;sBADrB,KAAK;gBAOC,cAAc;sBADpB,KAAK;gBA6HI,kBAAkB","sourcesContent":["import {Directive, Optional, SkipSelf, OnInit, OnDestroy, Inject, Input, Injector, ViewContainerRef, AfterViewInit, Type, TemplateRef} from '@angular/core';\nimport {FormControlDirective, FormControlName, FormControl, NgModel, PristineChangeEvent} from '@angular/forms';\nimport {StringLocalization, STRING_LOCALIZATION} from '@anglr/common';\nimport {generateId, BindThis, StringDictionary} from '@jscrpt/common';\nimport {Subscription, filter} from 'rxjs';\n\nimport {ValidationErrorRendererFactory} from '../../services/validationErrorRenderer/validationErrorRenderer.service';\nimport {ValidationErrorRenderer, ValidationErrorsComponent, ValidationErrorsRendererOptions, ValidationErrorsTemplateContext} from '../../services/validationErrorRenderer/validationErrorRenderer.interface';\nimport {SubmittedService} from '../../services/submitted/submitted.service';\nimport {GroupHasErrorDirective} from '../groupHasError/groupHasError.directive';\nimport {ValidationErrorsContainerView} from '../../misc/validationErrorsContainerView';\n\n//TODO: add support for setting renderer factory options using input\n\n/**\n * Directive that is attached to control element and handles css classes that are added to this element\n */\n@Directive(\n{\n selector: '[hasError][formControlName],[hasError][formControl],[hasError][ngModel]',\n standalone: true,\n})\nexport class HasErrorDirective implements OnInit, AfterViewInit, OnDestroy\n{\n //######################### protected fields #########################\n\n /**\n * Subscriptions that are destroyed with destruction of this directive\n */\n protected subscriptions: Subscription = new Subscription();\n\n /**\n * Unique generated id of control\n */\n protected id: string = generateId(10);\n\n /**\n * Last value of control pristine attribute\n */\n protected previousDirty: boolean = false;\n\n /**\n * Indication whether currently are any errors rendered\n */\n protected hasErrors: boolean = false;\n\n //######################### protected properties #########################\n\n /**\n * Gets control which was assigned to this element\n */\n protected get control(): FormControl\n {\n return this.formControl?.control || this.formControlName?.control || this.ngModel?.control;\n }\n\n //######################### public properties #########################\n\n /**\n * Instance of validation error renderer\n */\n public renderer: ValidationErrorRenderer;\n\n //######################### public propeties - inputs #########################\n\n /**\n * Customized error messages\n */\n @Input()\n public errorMessages: StringDictionary;\n\n /**\n * Custom component used for rendering validation errors\n */\n @Input()\n public errorsComponent?: Type<ValidationErrorsComponent>;\n\n /**\n * Custom template used for rendering validation errors\n */\n @Input()\n public errorsTemplate?: TemplateRef<ValidationErrorsTemplateContext>;\n\n //######################### constructor #########################\n constructor(protected rendererFactory: ValidationErrorRendererFactory,\n protected viewContainer: ViewContainerRef,\n @Optional() @SkipSelf() protected groupHasError: GroupHasErrorDirective,\n @Optional() protected formControl: FormControlDirective,\n @Optional() protected formControlName: FormControlName,\n @Optional() protected ngModel: NgModel,\n @Optional() protected submittedSvc: SubmittedService,\n @Optional() protected containerView: ValidationErrorsContainerView,\n @Inject(STRING_LOCALIZATION) protected stringLocalization: StringLocalization,\n protected injector: Injector,)\n {\n }\n\n //######################### public methods - implementation of OnInit #########################\n \n /**\n * Initialize component\n */\n public ngOnInit(): void\n {\n this.containerView ??= new ValidationErrorsContainerView();\n this.containerView.viewContainer ??= this.viewContainer;\n\n this.subscriptions.add(this.stringLocalization.textsChange.subscribe(() => this.updateStatus()));\n this.subscriptions.add(this.control.statusChanges.subscribe(() => this.updateStatus()));\n this.subscriptions.add(this.control\n .events\n .pipe(filter(itm => itm instanceof PristineChangeEvent))\n .subscribe(event =>\n {\n const pristineEvent = event as PristineChangeEvent;\n\n //only if dirty(pristine) is different\n if(pristineEvent.pristine == this.previousDirty)\n {\n this.updateStatus();\n }\n }));\n\n if(this.submittedSvc)\n {\n this.subscriptions.add(this.submittedSvc.submittedChange.subscribe(() => this.isSubmittedOrDirty(() => this.updateStatus())));\n }\n }\n\n //######################### public methods - implementation of AfterViewInit #########################\n \n /**\n * Called when view was initialized\n */\n public ngAfterViewInit(): void\n {\n this.renderer = this.rendererFactory.create(this.control,\n this.containerView,\n this.injector,\n this.isSubmittedOrDirty);\n\n this.updateStatus();\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n \n /**\n * Called when component is destroyed\n */\n public ngOnDestroy(): void\n {\n this.subscriptions.unsubscribe();\n\n this.groupHasError?.unregisterControl(this.id);\n this.renderer?.destroy();\n }\n\n //######################### protected methods #########################\n\n /**\n * Updates status of control and css classes\n */\n protected updateStatus(): void\n {\n if(!this.renderer)\n {\n return;\n }\n\n const opts: ValidationErrorsRendererOptions = {};\n\n if(this.errorsTemplate)\n {\n opts.template = this.errorsTemplate;\n }\n else if(this.errorsComponent)\n {\n opts.component = this.errorsComponent;\n }\n\n this.previousDirty = this.control.dirty;\n this.hasErrors = this.renderer.update(opts, this.errorMessages);\n this.toggleGroupHasError();\n }\n\n /**\n * Toggles registration of control in parent group\n */\n protected toggleGroupHasError(): void\n {\n if(this.groupHasError)\n {\n this.isSubmittedOrDirty(() => this.groupHasError.registerControl(this.id),\n () => this.groupHasError.unregisterControl(this.id),\n this.hasErrors);\n }\n }\n\n /**\n * Calls action when form is submitted or control is dirty\n * @param action - Action to be called when form is submitted or control dirty\n * @param falseAction - Action to be called when form is not submitted and control is not dirty\n * @param additionalCondition - Additional condition to be evaluated\n */\n @BindThis\n protected isSubmittedOrDirty(action: () => void, falseAction: () => void = () => {}, additionalCondition: boolean = true): void\n {\n //submitted form or dirty control\n if((this.submittedSvc?.submitted ||\n this.control?.dirty) &&\n additionalCondition)\n {\n action();\n }\n else\n {\n falseAction();\n }\n }\n}"]}
|
|
@@ -15,26 +15,12 @@ const MAX_NUMBER_VALIDATOR = {
|
|
|
15
15
|
* Directive injecting checking for number max value validator
|
|
16
16
|
*/
|
|
17
17
|
export class MaxValueNumberValidatorDirective {
|
|
18
|
-
//######################### private fields #########################
|
|
19
|
-
/**
|
|
20
|
-
* Current max value that is allowed
|
|
21
|
-
*/
|
|
22
|
-
_maxValue;
|
|
23
|
-
/**
|
|
24
|
-
* Function used for validations
|
|
25
|
-
*/
|
|
26
|
-
_validator;
|
|
27
|
-
/**
|
|
28
|
-
* Indication whether validator was initialized
|
|
29
|
-
*/
|
|
30
|
-
_initialized = false;
|
|
31
|
-
//######################### public properties - inputs #########################
|
|
32
|
-
/**
|
|
33
|
-
* Bound max value that is allowed, which overrides value set to attribute maxValue
|
|
34
|
-
*/
|
|
35
|
-
maxValue;
|
|
36
18
|
//######################### constructor #########################
|
|
37
19
|
constructor(maxValue) {
|
|
20
|
+
/**
|
|
21
|
+
* Indication whether validator was initialized
|
|
22
|
+
*/
|
|
23
|
+
this._initialized = false;
|
|
38
24
|
let value;
|
|
39
25
|
if (isBlank(maxValue) || maxValue.length < 1 || isNaN(value = parseFloat(maxValue.replace(',', '.')))) {
|
|
40
26
|
value = null;
|
|
@@ -60,10 +46,10 @@ export class MaxValueNumberValidatorDirective {
|
|
|
60
46
|
validate(control) {
|
|
61
47
|
return this._validator(control);
|
|
62
48
|
}
|
|
63
|
-
static
|
|
64
|
-
static
|
|
49
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: MaxValueNumberValidatorDirective, deps: [{ token: 'maxValue', attribute: true }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
50
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.1", type: MaxValueNumberValidatorDirective, selector: "input[number][maxValue][formControlName],input[number][maxValue][formControl],input[number][maxValue][ngModel]", inputs: { maxValue: "maxValue" }, providers: [MAX_NUMBER_VALIDATOR], usesOnChanges: true, ngImport: i0 }); }
|
|
65
51
|
}
|
|
66
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
52
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: MaxValueNumberValidatorDirective, decorators: [{
|
|
67
53
|
type: Directive,
|
|
68
54
|
args: [{
|
|
69
55
|
selector: 'input[number][maxValue][formControlName],input[number][maxValue][formControl],input[number][maxValue][ngModel]',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"maxValueNumberValidator.directive.js","sourceRoot":"","sources":["../../../../../forms/src/directives/numberInput/maxValueNumberValidator.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAA2B,MAAM,eAAe,CAAC;AAClH,OAAO,EAAC,aAAa,EAA4D,MAAM,gBAAgB,CAAC;AACxG,OAAO,EAAC,OAAO,EAAE,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAElD,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;;AAEjD;;GAEG;AACH,MAAM,oBAAoB,GAC1B;IACI,OAAO,EAAE,aAAa;IACtB,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,gCAAgC,CAAC;IAC/D,KAAK,EAAE,IAAI;CACd,CAAC;AAEF;;GAEG;AAMH,MAAM,OAAO,gCAAgC;
|
|
1
|
+
{"version":3,"file":"maxValueNumberValidator.directive.js","sourceRoot":"","sources":["../../../../../forms/src/directives/numberInput/maxValueNumberValidator.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAA2B,MAAM,eAAe,CAAC;AAClH,OAAO,EAAC,aAAa,EAA4D,MAAM,gBAAgB,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QAEpC,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;8GAnEQ,gCAAgC,kBA4BlB,UAAU;kGA5BxB,gCAAgC,2KAF9B,CAAC,oBAAoB,CAAC;;2FAExB,gCAAgC;kBAL5C,SAAS;mBACV;oBACI,QAAQ,EAAE,gHAAgH;oBAC1H,SAAS,EAAE,CAAC,oBAAoB,CAAC;iBACpC;;0BA6BgB,SAAS;2BAAC,UAAU;yCAH1B,QAAQ;sBADd,KAAK","sourcesContent":["import {ExistingProvider, Input, forwardRef, Directive, Attribute, OnChanges, SimpleChanges} from '@angular/core';\nimport {NG_VALIDATORS, AbstractControl, Validator, ValidatorFn, ValidationErrors} from '@angular/forms';\nimport {isBlank, isPresent} from '@jscrpt/common';\n\nimport {Validators} from '../../misc/validators';\n\n/**\n * Validator that is injected with directive MaxValueNumberValidatorDirective\n */\nconst MAX_NUMBER_VALIDATOR = <ExistingProvider>\n{\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => MaxValueNumberValidatorDirective),\n multi: true\n};\n\n/**\n * Directive injecting checking for number max value validator\n */\n@Directive(\n{\n selector: 'input[number][maxValue][formControlName],input[number][maxValue][formControl],input[number][maxValue][ngModel]',\n providers: [MAX_NUMBER_VALIDATOR]\n})\nexport class MaxValueNumberValidatorDirective implements Validator, OnChanges\n{\n //######################### private fields #########################\n\n /**\n * Current max value that is allowed\n */\n private _maxValue: number|null;\n\n /**\n * Function used for validations\n */\n private _validator: ValidatorFn;\n\n /**\n * Indication whether validator was initialized\n */\n private _initialized: boolean = false;\n\n //######################### public properties - inputs #########################\n\n /**\n * Bound max value that is allowed, which overrides value set to attribute maxValue\n */\n @Input()\n public maxValue?: number;\n\n //######################### constructor #########################\n constructor(@Attribute('maxValue') maxValue: string)\n {\n let value;\n\n if(isBlank(maxValue) || maxValue.length < 1 || isNaN(value = parseFloat(maxValue.replace(',', '.'))))\n {\n value = null;\n }\n\n this._maxValue = value;\n }\n\n //######################### public methods - implementation of OnChanges #########################\n\n public ngOnChanges(changes: SimpleChanges): void\n {\n if(!this._initialized)\n {\n this._initialized = true;\n\n this._validator = Validators.max(this._maxValue);\n }\n\n if ('maxValue' in changes)\n {\n this._validator = Validators.max(isPresent(this.maxValue) ? <number>this.maxValue! : this._maxValue);\n }\n }\n\n //######################### public methods - implementation of Validator #########################\n\n /**\n * Validates input and returns validation result\n * @param control - Control that is being validated\n * @returns validation results\n */\n public validate(control: AbstractControl): ValidationErrors|null\n {\n return this._validator(control);\n }\n}"]}
|
|
@@ -15,26 +15,12 @@ const MIN_NUMBER_VALIDATOR = {
|
|
|
15
15
|
* Directive injecting checking for number min value validator
|
|
16
16
|
*/
|
|
17
17
|
export class MinValueNumberValidatorDirective {
|
|
18
|
-
//######################### private fields #########################
|
|
19
|
-
/**
|
|
20
|
-
* Current min value that is allowed
|
|
21
|
-
*/
|
|
22
|
-
_minValue;
|
|
23
|
-
/**
|
|
24
|
-
* Function used for validations
|
|
25
|
-
*/
|
|
26
|
-
_validator;
|
|
27
|
-
/**
|
|
28
|
-
* Indication whether validator was initialized
|
|
29
|
-
*/
|
|
30
|
-
_initialized = false;
|
|
31
|
-
//######################### public properties - inputs #########################
|
|
32
|
-
/**
|
|
33
|
-
* Bound min value that is allowed, which overrides value set to attribute minValue
|
|
34
|
-
*/
|
|
35
|
-
minValue;
|
|
36
18
|
//######################### constructor #########################
|
|
37
19
|
constructor(minValue) {
|
|
20
|
+
/**
|
|
21
|
+
* Indication whether validator was initialized
|
|
22
|
+
*/
|
|
23
|
+
this._initialized = false;
|
|
38
24
|
let value;
|
|
39
25
|
if (isBlank(minValue) || minValue.length < 1 || isNaN(value = parseFloat(minValue.replace(',', '.')))) {
|
|
40
26
|
value = null;
|
|
@@ -60,10 +46,10 @@ export class MinValueNumberValidatorDirective {
|
|
|
60
46
|
validate(control) {
|
|
61
47
|
return this._validator(control);
|
|
62
48
|
}
|
|
63
|
-
static
|
|
64
|
-
static
|
|
49
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: MinValueNumberValidatorDirective, deps: [{ token: 'minValue', attribute: true }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
50
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.1", type: MinValueNumberValidatorDirective, selector: "input[number][minValue][formControlName],input[number][minValue][formControl],input[number][minValue][ngModel]", inputs: { minValue: "minValue" }, providers: [MIN_NUMBER_VALIDATOR], usesOnChanges: true, ngImport: i0 }); }
|
|
65
51
|
}
|
|
66
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
52
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: MinValueNumberValidatorDirective, decorators: [{
|
|
67
53
|
type: Directive,
|
|
68
54
|
args: [{
|
|
69
55
|
selector: 'input[number][minValue][formControlName],input[number][minValue][formControl],input[number][minValue][ngModel]',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"minValueNumberValidator.directive.js","sourceRoot":"","sources":["../../../../../forms/src/directives/numberInput/minValueNumberValidator.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAA6C,MAAM,eAAe,CAAC;AAClH,OAAO,EAAC,aAAa,EAA4D,MAAM,gBAAgB,CAAC;AACxG,OAAO,EAAC,OAAO,EAAE,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAElD,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;;AAEjD;;GAEG;AACH,MAAM,oBAAoB,GAC1B;IACI,OAAO,EAAE,aAAa;IACtB,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,gCAAgC,CAAC;IAC/D,KAAK,EAAE,IAAI;CACd,CAAC;AAEF;;GAEG;AAMH,MAAM,OAAO,gCAAgC;
|
|
1
|
+
{"version":3,"file":"minValueNumberValidator.directive.js","sourceRoot":"","sources":["../../../../../forms/src/directives/numberInput/minValueNumberValidator.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAA6C,MAAM,eAAe,CAAC;AAClH,OAAO,EAAC,aAAa,EAA4D,MAAM,gBAAgB,CAAC;AACxG,OAAO,EAAC,OAAO,EAAE,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAElD,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;;AAEjD;;GAEG;AACH,MAAM,oBAAoB,GAC1B;IACI,OAAO,EAAE,aAAa;IACtB,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,gCAAgC,CAAC;IAC/D,KAAK,EAAE,IAAI;CACd,CAAC;AAEF;;GAEG;AAMH,MAAM,OAAO,gCAAgC;IA0BzC,iEAAiE;IACjE,YAAmC,QAAgB;QAbnD;;WAEG;QACK,iBAAY,GAAY,KAAK,CAAC;QAYlC,IAAI,KAAK,CAAC;QAEV,IAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,EACpG,CAAC;YACG,KAAK,GAAG,IAAI,CAAC;QACjB,CAAC;QAED,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;IAC3B,CAAC;IAED,kGAAkG;IAE3F,WAAW,CAAC,OAAsB;QAErC,IAAG,CAAC,IAAI,CAAC,YAAY,EACrB,CAAC;YACG,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YAEzB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACrD,CAAC;QAED,IAAI,UAAU,IAAI,OAAO,EACzB,CAAC;YACG,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAS,IAAI,CAAC,QAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACzG,CAAC;IACL,CAAC;IAED,kGAAkG;IAElG;;;;OAIG;IACI,QAAQ,CAAC,OAAwB;QAEpC,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;8GAlEQ,gCAAgC,kBA2BlB,UAAU;kGA3BxB,gCAAgC,2KAF9B,CAAC,oBAAoB,CAAC;;2FAExB,gCAAgC;kBAL5C,SAAS;mBACV;oBACI,QAAQ,EAAE,gHAAgH;oBAC1H,SAAS,EAAE,CAAC,oBAAoB,CAAC;iBACpC;;0BA4BgB,SAAS;2BAAC,UAAU;yCAH1B,QAAQ;sBADd,KAAK","sourcesContent":["import {forwardRef, Directive, Attribute, Input, ExistingProvider, OnChanges, SimpleChanges} from '@angular/core';\nimport {NG_VALIDATORS, AbstractControl, Validator, ValidatorFn, ValidationErrors} from '@angular/forms';\nimport {isBlank, isPresent} from '@jscrpt/common';\n\nimport {Validators} from '../../misc/validators';\n\n/**\n * Validator that is injected with directive MinValueNumberValidatorDirective\n */\nconst MIN_NUMBER_VALIDATOR = <ExistingProvider>\n{\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => MinValueNumberValidatorDirective),\n multi: true\n};\n\n/**\n * Directive injecting checking for number min value validator\n */\n@Directive(\n{\n selector: 'input[number][minValue][formControlName],input[number][minValue][formControl],input[number][minValue][ngModel]',\n providers: [MIN_NUMBER_VALIDATOR]\n})\nexport class MinValueNumberValidatorDirective implements Validator, OnChanges\n{\n //######################### private fields #########################\n\n /**\n * Current min value that is allowed\n */\n private _minValue: number|null;\n\n /**\n * Function used for validations\n */\n private _validator: ValidatorFn;\n\n /**\n * Indication whether validator was initialized\n */\n private _initialized: boolean = false;\n\n //######################### public properties - inputs #########################\n /**\n * Bound min value that is allowed, which overrides value set to attribute minValue\n */\n @Input()\n public minValue?: number;\n\n //######################### constructor #########################\n constructor(@Attribute('minValue') minValue: string)\n {\n let value;\n\n if(isBlank(minValue) || minValue.length < 1 || isNaN(value = parseFloat(minValue.replace(',', '.'))))\n {\n value = null;\n }\n\n this._minValue = value;\n }\n\n //######################### public methods - implementation of OnChanges #########################\n\n public ngOnChanges(changes: SimpleChanges): void\n {\n if(!this._initialized)\n {\n this._initialized = true;\n\n this._validator = Validators.min(this._minValue);\n }\n\n if ('minValue' in changes)\n {\n this._validator = Validators.min(isPresent(this.minValue) ? <number>this.minValue! : this._minValue);\n }\n }\n\n //######################### public methods - implementation of Validator #########################\n\n /**\n * Validates input and returns validation result\n * @param control - Control that is being validated\n * @returns validation results\n */\n public validate(control: AbstractControl): ValidationErrors|null\n {\n return this._validator(control);\n }\n}"]}
|
package/es2022/forms/src/directives/numberInput/numberInputControlValueAccessor.directive.js
CHANGED
|
@@ -14,22 +14,20 @@ const NUMBER_INPUT_VALUE_ACCESSOR = {
|
|
|
14
14
|
* Value accessor for getting and setting values for number inputs
|
|
15
15
|
*/
|
|
16
16
|
export class NumberInputControlValueAccessor {
|
|
17
|
-
_renderer;
|
|
18
|
-
_elementRef;
|
|
19
|
-
//######################### public properties #########################
|
|
20
|
-
onChange = (_) => { };
|
|
21
|
-
/**
|
|
22
|
-
* Method that is called when picker was touched
|
|
23
|
-
*/
|
|
24
|
-
onTouched = () => { };
|
|
25
|
-
/**
|
|
26
|
-
* Indication whether is number input disabled
|
|
27
|
-
*/
|
|
28
|
-
disabled = false;
|
|
29
17
|
//######################### constructor #########################
|
|
30
18
|
constructor(_renderer, _elementRef) {
|
|
31
19
|
this._renderer = _renderer;
|
|
32
20
|
this._elementRef = _elementRef;
|
|
21
|
+
//######################### public properties #########################
|
|
22
|
+
this.onChange = (_) => { };
|
|
23
|
+
/**
|
|
24
|
+
* Method that is called when picker was touched
|
|
25
|
+
*/
|
|
26
|
+
this.onTouched = () => { };
|
|
27
|
+
/**
|
|
28
|
+
* Indication whether is number input disabled
|
|
29
|
+
*/
|
|
30
|
+
this.disabled = false;
|
|
33
31
|
}
|
|
34
32
|
//######################### public methods - implementation of ControlValueAccessor #########################
|
|
35
33
|
/**
|
|
@@ -68,10 +66,10 @@ export class NumberInputControlValueAccessor {
|
|
|
68
66
|
setDisabledState(isDisabled) {
|
|
69
67
|
this.disabled = isDisabled;
|
|
70
68
|
}
|
|
71
|
-
static
|
|
72
|
-
static
|
|
69
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: NumberInputControlValueAccessor, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
70
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.1", type: NumberInputControlValueAccessor, selector: "input[number][formControlName],input[number][formControl],input[number][ngModel]", host: { listeners: { "change": "onChange($event.target.value)", "input": "onChange($event.target.value)", "blur": "onTouched()" }, properties: { "disabled": "disabled" } }, providers: [NUMBER_INPUT_VALUE_ACCESSOR], ngImport: i0 }); }
|
|
73
71
|
}
|
|
74
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
72
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: NumberInputControlValueAccessor, decorators: [{
|
|
75
73
|
type: Directive,
|
|
76
74
|
args: [{
|
|
77
75
|
selector: 'input[number][formControlName],input[number][formControl],input[number][ngModel]',
|
package/es2022/forms/src/directives/numberInput/numberInputControlValueAccessor.directive.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"numberInputControlValueAccessor.directive.js","sourceRoot":"","sources":["../../../../../forms/src/directives/numberInput/numberInputControlValueAccessor.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAoB,UAAU,EAAE,SAAS,EAAE,UAAU,EAAC,MAAM,eAAe,CAAC;AAC7F,OAAO,EAAC,iBAAiB,EAAuB,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;;AAEvC;;GAEG;AACH,MAAM,2BAA2B,GACjC;IACI,OAAO,EAAE,iBAAiB;IAC1B,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,+BAA+B,CAAC;IAC9D,KAAK,EAAE,IAAI;CACd,CAAC;AAEF;;GAEG;AAaH,MAAM,OAAO,+BAA+B;
|
|
1
|
+
{"version":3,"file":"numberInputControlValueAccessor.directive.js","sourceRoot":"","sources":["../../../../../forms/src/directives/numberInput/numberInputControlValueAccessor.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAoB,UAAU,EAAE,SAAS,EAAE,UAAU,EAAC,MAAM,eAAe,CAAC;AAC7F,OAAO,EAAC,iBAAiB,EAAuB,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;;AAEvC;;GAEG;AACH,MAAM,2BAA2B,GACjC;IACI,OAAO,EAAE,iBAAiB;IAC1B,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,+BAA+B,CAAC;IAC9D,KAAK,EAAE,IAAI;CACd,CAAC;AAEF;;GAEG;AAaH,MAAM,OAAO,+BAA+B;IAgBxC,iEAAiE;IACjE,YAAoB,SAAoB,EAAU,WAAuB;QAArD,cAAS,GAAT,SAAS,CAAW;QAAU,gBAAW,GAAX,WAAW,CAAY;QAfzE,uEAAuE;QAEhE,aAAQ,GAAG,CAAC,CAAM,EAAE,EAAE,GAAE,CAAC,CAAC;QAEjC;;WAEG;QACI,cAAS,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;QAE5B;;WAEG;QACI,aAAQ,GAAY,KAAK,CAAC;IAKjC,CAAC;IAED,6GAA6G;IAE7G;;OAEG;IACI,UAAU,CAAC,KAAU;QAEx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} from '@angular/core';\nimport {NG_VALUE_ACCESSOR, ControlValueAccessor} from '@angular/forms';\nimport {isBlank} from '@jscrpt/common';\n\n/**\n * Value accessor provider for number inputs\n */\nconst NUMBER_INPUT_VALUE_ACCESSOR = <ExistingProvider>\n{\n provide: NG_VALUE_ACCESSOR, \n useExisting: forwardRef(() => NumberInputControlValueAccessor), \n multi: true\n};\n\n/**\n * Value accessor for getting and setting values for number inputs\n */\n@Directive(\n{\n selector: 'input[number][formControlName],input[number][formControl],input[number][ngModel]',\n providers: [NUMBER_INPUT_VALUE_ACCESSOR],\n host: \n {\n '(change)': 'onChange($event.target.value)',\n '(input)': 'onChange($event.target.value)',\n '(blur)': 'onTouched()',\n '[disabled]': 'disabled',\n }\n})\nexport class NumberInputControlValueAccessor implements ControlValueAccessor\n{\n //######################### public properties #########################\n \n public onChange = (_: any) => {};\n \n /**\n * Method that is called when picker was touched\n */\n public onTouched = () => {};\n\n /**\n * Indication whether is number input disabled\n */\n public disabled: boolean = false;\n \n //######################### constructor #########################\n constructor(private _renderer: Renderer2, private _elementRef: ElementRef)\n {\n }\n\n //######################### public methods - implementation of ControlValueAccessor #########################\n\n /**\n * @inheritdoc\n */\n public writeValue(value: any): void\n {\n this._renderer.setProperty(this._elementRef.nativeElement, 'value', value);\n }\n\n /**\n * @inheritdoc\n */\n public registerOnChange(fn: (data: any) => any): void\n {\n this.onChange = (value: string) => \n { \n if(isBlank(value) || value == '')\n {\n fn(null);\n \n return;\n }\n \n //removing all spaces\n value = value.replace(/\\s+/g, '');\n \n if(!/^[+-]?\\d+(?:[,.]\\d+)?$/g.test(value))\n {\n fn(NaN);\n \n return;\n }\n \n fn(parseFloat(value.replace(',', '.'))); \n };\n }\n\n /**\n * @inheritdoc\n */\n public registerOnTouched(fn: () => any): void\n {\n this.onTouched = fn;\n }\n\n /**\n * @inheritdoc\n */\n public setDisabledState?(isDisabled: boolean): void\n {\n this.disabled = isDisabled;\n }\n}\n"]}
|
|
@@ -23,10 +23,10 @@ export class NumberInputValidatorDirective {
|
|
|
23
23
|
validate(control) {
|
|
24
24
|
return Validators.number(control);
|
|
25
25
|
}
|
|
26
|
-
static
|
|
27
|
-
static
|
|
26
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: NumberInputValidatorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
27
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.0.1", type: NumberInputValidatorDirective, selector: "input[number][formControlName],input[number][formControl],input[number][ngModel]", providers: [NUMBER_VALIDATOR], ngImport: i0 }); }
|
|
28
28
|
}
|
|
29
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
29
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.1", ngImport: i0, type: NumberInputValidatorDirective, decorators: [{
|
|
30
30
|
type: Directive,
|
|
31
31
|
args: [{
|
|
32
32
|
selector: 'input[number][formControlName],input[number][formControl],input[number][ngModel]',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"numberInputValidator.directive.js","sourceRoot":"","sources":["../../../../../forms/src/directives/numberInput/numberInputValidator.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,UAAU,EAAE,SAAS,EAAC,MAAM,eAAe,CAAC;AACtE,OAAO,EAAC,aAAa,EAA+C,MAAM,gBAAgB,CAAC;AAE3F,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;;AAEjD;;GAEG;AACH,MAAM,gBAAgB,GACtB;IACI,OAAO,EAAE,aAAa;IACtB,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,6BAA6B,CAAC;IAC5D,KAAK,EAAE,IAAI;CACd,CAAC;AAEF;;GAEG;AAMH,MAAM,OAAO,6BAA6B;IAEtC,kGAAkG;IAElG;;;;OAIG;IACI,QAAQ,CAAC,OAAwB;QAEpC,OAAO,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;
|
|
1
|
+
{"version":3,"file":"numberInputValidator.directive.js","sourceRoot":"","sources":["../../../../../forms/src/directives/numberInput/numberInputValidator.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,UAAU,EAAE,SAAS,EAAC,MAAM,eAAe,CAAC;AACtE,OAAO,EAAC,aAAa,EAA+C,MAAM,gBAAgB,CAAC;AAE3F,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;;AAEjD;;GAEG;AACH,MAAM,gBAAgB,GACtB;IACI,OAAO,EAAE,aAAa;IACtB,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,6BAA6B,CAAC;IAC5D,KAAK,EAAE,IAAI;CACd,CAAC;AAEF;;GAEG;AAMH,MAAM,OAAO,6BAA6B;IAEtC,kGAAkG;IAElG;;;;OAIG;IACI,QAAQ,CAAC,OAAwB;QAEpC,OAAO,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;8GAZQ,6BAA6B;kGAA7B,6BAA6B,2GAF3B,CAAC,gBAAgB,CAAC;;2FAEpB,6BAA6B;kBALzC,SAAS;mBACV;oBACI,QAAQ,EAAE,kFAAkF;oBAC5F,SAAS,EAAE,CAAC,gBAAgB,CAAC;iBAChC","sourcesContent":["import {ExistingProvider, forwardRef, Directive} from '@angular/core';\nimport {NG_VALIDATORS, AbstractControl, Validator, ValidationErrors} from '@angular/forms';\n\nimport {Validators} from '../../misc/validators';\n\n/**\n * Validator that is injected with directive NumberInputValidatorDirective\n */\nconst NUMBER_VALIDATOR = <ExistingProvider>\n{\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => NumberInputValidatorDirective),\n multi: true\n};\n\n/**\n * Is number directive injecting checking for number validator\n */\n@Directive(\n{\n selector: 'input[number][formControlName],input[number][formControl],input[number][ngModel]',\n providers: [NUMBER_VALIDATOR]\n})\nexport class NumberInputValidatorDirective implements Validator\n{\n //######################### public methods - implementation of Validator #########################\n\n /**\n * Validates input and returns validation result\n * @param control - Control that is being validated\n * @returns validation results\n */\n public validate(control: AbstractControl): ValidationErrors|null\n {\n return Validators.number(control);\n }\n}"]}
|