@anglr/common 21.3.0 → 22.0.0-beta.20250123101532
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 +20 -0
- package/es2022/floating-ui/src/services/floatingUiDomPosition.service.js +5 -4
- package/es2022/floating-ui/src/services/floatingUiDomPosition.service.js.map +1 -1
- package/es2022/forms/src/components/defaultValidationErrors/defaultValidationErrors.component.js +4 -4
- package/es2022/forms/src/components/defaultValidationErrors/defaultValidationErrors.component.js.map +1 -1
- package/es2022/forms/src/components/defaultValidationErrorsContainer/defaultValidationErrorsContainer.component.js +4 -4
- package/es2022/forms/src/components/defaultValidationErrorsContainer/defaultValidationErrorsContainer.component.js.map +1 -1
- package/es2022/forms/src/components/reservedSpaceValidationErrorsContainer/reservedSpaceValidationErrorsContainer.component.js +4 -4
- package/es2022/forms/src/components/reservedSpaceValidationErrorsContainer/reservedSpaceValidationErrorsContainer.component.js.map +1 -1
- package/es2022/forms/src/directives/groupHasError/groupHasError.directive.js +4 -5
- package/es2022/forms/src/directives/groupHasError/groupHasError.directive.js.map +1 -1
- package/es2022/forms/src/directives/groupHasErrorContainer/groupHasErrorContainer.directive.js +3 -4
- package/es2022/forms/src/directives/groupHasErrorContainer/groupHasErrorContainer.directive.js.map +1 -1
- package/es2022/forms/src/directives/hasError/hasError.directive.js +3 -4
- package/es2022/forms/src/directives/hasError/hasError.directive.js.map +1 -1
- package/es2022/forms/src/directives/numberInput/maxValueNumberValidator.directive.js +5 -5
- package/es2022/forms/src/directives/numberInput/maxValueNumberValidator.directive.js.map +1 -1
- package/es2022/forms/src/directives/numberInput/minValueNumberValidator.directive.js +5 -5
- package/es2022/forms/src/directives/numberInput/minValueNumberValidator.directive.js.map +1 -1
- package/es2022/forms/src/directives/numberInput/numberInputControlValueAccessor.directive.js +4 -4
- package/es2022/forms/src/directives/numberInput/numberInputControlValueAccessor.directive.js.map +1 -1
- package/es2022/forms/src/directives/numberInput/numberInputValidator.directive.js +5 -5
- package/es2022/forms/src/directives/numberInput/numberInputValidator.directive.js.map +1 -1
- package/es2022/forms/src/directives/requiredClass/requiredClass.directive.js +3 -4
- package/es2022/forms/src/directives/requiredClass/requiredClass.directive.js.map +1 -1
- package/es2022/forms/src/directives/validationErrorsContainer/validationErrorsContainer.directive.js +3 -4
- package/es2022/forms/src/directives/validationErrorsContainer/validationErrorsContainer.directive.js.map +1 -1
- package/es2022/forms/src/misc/utils.js +2 -1
- package/es2022/forms/src/misc/utils.js.map +1 -1
- package/es2022/forms/src/modules/errorMessage/components/groupErrors/groupErrors.component.js +14 -9
- 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 +4 -4
- 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 +4 -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 +5 -13
- 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 -3
- 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 -3
- package/es2022/forms/src/modules/formPipes/pipes/asFormControl/asFormControl.pipe.js +3 -3
- package/es2022/forms/src/modules/formPipes/pipes/asFormGroup/asFormGroup.pipe.js +3 -3
- package/es2022/forms/src/modules/formPipes/pipes/getControl/getControl.pipe.js +3 -3
- package/es2022/forms/src/modules/hasError.module.js +4 -4
- package/es2022/forms/src/modules/numberInput.module.js +7 -7
- package/es2022/forms/src/modules/numberInput.module.js.map +1 -1
- package/es2022/forms/src/services/errorMessagesExtractor/errorMessagesExtractor.service.js +5 -4
- package/es2022/forms/src/services/errorMessagesExtractor/errorMessagesExtractor.service.js.map +1 -1
- package/es2022/forms/src/services/formModelBuilder/formModelBuilder.service.js +3 -3
- package/es2022/forms/src/services/submitted/submitted.service.js +3 -3
- package/es2022/forms/src/services/validationErrorRenderer/validationErrorRenderer.service.js +4 -4
- package/es2022/forms/src/services/validationErrorRenderer/validationErrorRenderer.service.js.map +1 -1
- package/es2022/hotkeys/src/components/cheatSheet/cheatSheet.component.js +4 -4
- package/es2022/hotkeys/src/components/cheatSheet/cheatSheet.component.js.map +1 -1
- package/es2022/hotkeys/src/services/appHotkeys.service.js +3 -3
- package/es2022/material/src/components/confirmationDialog/confirmationDialog.component.js +10 -7
- package/es2022/material/src/components/confirmationDialog/confirmationDialog.component.js.map +1 -1
- package/es2022/material/src/components/movableTitledDialog/movableTitledDialog.component.js +12 -7
- package/es2022/material/src/components/movableTitledDialog/movableTitledDialog.component.js.map +1 -1
- package/es2022/material/src/components/titledDialog/titledDialog.component.js +9 -6
- package/es2022/material/src/components/titledDialog/titledDialog.component.js.map +1 -1
- package/es2022/material/src/directives/confirmationDialog/confirmationDialog.directive.js +3 -4
- package/es2022/material/src/directives/confirmationDialog/confirmationDialog.directive.js.map +1 -1
- package/es2022/material/src/directives/debugDataCopyClick/debugDataCopyClick.directive.js +3 -4
- package/es2022/material/src/directives/debugDataCopyClick/debugDataCopyClick.directive.js.map +1 -1
- package/es2022/material/src/modules/confirmationDialog.module.js +6 -15
- package/es2022/material/src/modules/confirmationDialog.module.js.map +1 -1
- package/es2022/material/src/modules/debugDataCopyClick.module.js +4 -4
- package/es2022/material/src/modules/movableTitledDialog.module.js +7 -8
- package/es2022/material/src/modules/movableTitledDialog.module.js.map +1 -1
- package/es2022/material/src/modules/titledDialog.module.js +5 -16
- package/es2022/material/src/modules/titledDialog.module.js.map +1 -1
- package/es2022/material/src/services/titledDialog/titledDialog.service.js +3 -3
- package/es2022/router/src/services/routing/dataRouter.js +3 -3
- package/es2022/router/src/services/routing/dataRouterData.js +3 -3
- package/es2022/src/components/collapsibleIcon/collapsibleIcon.component.js +6 -6
- package/es2022/src/components/collapsibleIcon/collapsibleIcon.component.js.map +1 -1
- package/es2022/src/components/collapsibleTitle/collapsibleTitle.component.js +4 -4
- 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/componentDisplay/componentDisplay.decorator.js.map +1 -1
- package/es2022/src/decorators/componentDisplayBlock/componentDisplayBlock.decorator.js.map +1 -1
- package/es2022/src/decorators/componentDisplayFlex/componentDisplayFlex.decorator.js.map +1 -1
- package/es2022/src/decorators/componentHostStyle/componentHostStyle.decorator.js.map +1 -1
- package/es2022/src/decorators/scrollableContent/scrollableContent.decorator.js.map +1 -1
- package/es2022/src/decorators/typeProvider/typeProvider.decorator.js +0 -1
- package/es2022/src/decorators/typeProvider/typeProvider.decorator.js.map +1 -1
- package/es2022/src/decorators/withFullscreenContentCssClass/withFullscreenContentCssClass.decorator.js.map +1 -1
- package/es2022/src/directives/bodyRender/bodyRender.directive.js +3 -4
- package/es2022/src/directives/bodyRender/bodyRender.directive.js.map +1 -1
- package/es2022/src/directives/clickOutside/clickOutside.directive.js +4 -5
- package/es2022/src/directives/clickOutside/clickOutside.directive.js.map +1 -1
- package/es2022/src/directives/ellipsisTooltip/ellipsisTooltip.directive.js +3 -4
- package/es2022/src/directives/ellipsisTooltip/ellipsisTooltip.directive.js.map +1 -1
- package/es2022/src/directives/goBack/goBack.directive.js +3 -4
- package/es2022/src/directives/goBack/goBack.directive.js.map +1 -1
- package/es2022/src/directives/ngComponentOutletEx/ngComponentOutletEx.directive.js +3 -4
- package/es2022/src/directives/ngComponentOutletEx/ngComponentOutletEx.directive.js.map +1 -1
- package/es2022/src/directives/positionTo/positionTo.directive.js +4 -5
- 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/asNgClassRequired/asNgClassRequired.pipe.js +3 -3
- package/es2022/src/modules/castPipes/pipes/asRequired/asRequired.pipe.js +3 -3
- package/es2022/src/modules/castPipes/pipes/castType/castType.pipe.js +3 -3
- package/es2022/src/modules/commonDynamic.module.js +4 -4
- package/es2022/src/modules/commonLocalize.module.js +7 -7
- package/es2022/src/modules/commonLocalize.module.js.map +1 -1
- package/es2022/src/modules/commonUtils.module.js +9 -9
- package/es2022/src/modules/commonUtils.module.js.map +1 -1
- package/es2022/src/modules/debugData/components/debugData/debugData.component.js +4 -4
- 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/services/debugDataEnabled/debugDataEnabled.service.js +3 -3
- package/es2022/src/modules/file/components/file/file.component.js +4 -4
- package/es2022/src/modules/file/components/file/file.component.js.map +1 -1
- package/es2022/src/modules/file/components/fileInput/fileInput.component.js +7 -7
- package/es2022/src/modules/file/components/fileInput/fileInput.component.js.map +1 -1
- package/es2022/src/modules/file/components/uploadButton/uploadButton.component.js +7 -7
- package/es2022/src/modules/file/components/uploadButton/uploadButton.component.js.map +1 -1
- package/es2022/src/modules/file/directive/fileInput/fileInput.directive.js +3 -4
- package/es2022/src/modules/file/directive/fileInput/fileInput.directive.js.map +1 -1
- package/es2022/src/modules/file/directive/fileTemplate/fileTemplate.directive.js +3 -4
- package/es2022/src/modules/file/directive/fileTemplate/fileTemplate.directive.js.map +1 -1
- package/es2022/src/modules/file/modules/file.module.js +4 -4
- package/es2022/src/modules/logger/components/console/console.component.js +5 -5
- package/es2022/src/modules/logger/components/console/console.component.js.map +1 -1
- package/es2022/src/modules/logger/services/console/consoleComponent.service.js +3 -3
- package/es2022/src/modules/logger/services/console/consoleComponentService.options.js +3 -3
- package/es2022/src/modules/logger/services/logger/logger.service.js +3 -3
- package/es2022/src/modules/logger/services/rest/restSink.options.js +3 -3
- package/es2022/src/modules/logger/types/loggerOptions.js +3 -3
- package/es2022/src/modules/multiButton/components/multiButton/multiButton.component.js +9 -7
- package/es2022/src/modules/multiButton/components/multiButton/multiButton.component.js.map +1 -1
- package/es2022/src/modules/multiButton/modules/multiButton.module.js +5 -9
- package/es2022/src/modules/multiButton/modules/multiButton.module.js.map +1 -1
- package/es2022/src/modules/progressIndicator/components/progressIndicator/progressIndicator.component.js +9 -6
- package/es2022/src/modules/progressIndicator/components/progressIndicator/progressIndicator.component.js.map +1 -1
- package/es2022/src/modules/progressIndicator/directives/progressOverlay/progressOverlay.directive.js +4 -4
- package/es2022/src/modules/progressIndicator/directives/progressOverlay/progressOverlay.directive.js.map +1 -1
- package/es2022/src/modules/progressIndicator/interceptors/progressInterceptor.js +4 -4
- package/es2022/src/modules/progressIndicator/interceptors/progressInterceptor.js.map +1 -1
- package/es2022/src/modules/progressIndicator/modules/progressIndicator.module.js +7 -15
- package/es2022/src/modules/progressIndicator/modules/progressIndicator.module.js.map +1 -1
- package/es2022/src/modules/progressIndicator/services/progressIndicator.service.js +3 -3
- package/es2022/src/modules/progressIndicator/services/progressIndicatorOptions.js.map +1 -1
- package/es2022/src/modules/tooltip/components/tooltip/tooltip.component.js +7 -5
- package/es2022/src/modules/tooltip/components/tooltip/tooltip.component.js.map +1 -1
- package/es2022/src/modules/tooltip/directives/tooltip/tooltip.directive.js +5 -5
- package/es2022/src/modules/tooltip/directives/tooltip/tooltip.directive.js.map +1 -1
- package/es2022/src/modules/tooltip/directives/tooltipTemplate/tooltipTemplate.directive.js +3 -3
- package/es2022/src/modules/tooltip/modules/tooltip.module.js +6 -10
- package/es2022/src/modules/tooltip/modules/tooltip.module.js.map +1 -1
- package/es2022/src/pipes/displayProperties/displayProperties.pipe.js +3 -4
- package/es2022/src/pipes/displayProperties/displayProperties.pipe.js.map +1 -1
- package/es2022/src/pipes/firstUppercase/firstUppercase.pipe.js +4 -5
- package/es2022/src/pipes/firstUppercase/firstUppercase.pipe.js.map +1 -1
- package/es2022/src/pipes/firstUppercaseLocalize/firstUppercaseLocalize.pipe.js +8 -9
- package/es2022/src/pipes/firstUppercaseLocalize/firstUppercaseLocalize.pipe.js.map +1 -1
- package/es2022/src/pipes/isNaN/isNaN.pipe.js +3 -4
- package/es2022/src/pipes/isNaN/isNaN.pipe.js.map +1 -1
- package/es2022/src/pipes/isPresent/isPresent.pipe.js +3 -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 +4 -5
- package/es2022/src/pipes/localize/localize.pipe.js.map +1 -1
- package/es2022/src/pipes/mergeCssClasses/mergeCssClasses.pipe.js +5 -5
- package/es2022/src/pipes/mergeCssClasses/mergeCssClasses.pipe.js.map +1 -1
- package/es2022/src/pipes/numeral/numeral.pipe.js +4 -4
- package/es2022/src/pipes/numeral/numeral.pipe.js.map +1 -1
- package/es2022/src/pipes/trimText/trimText.pipe.js +4 -4
- 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 +3 -3
- package/es2022/src/services/notifications/defaultNotifications.service.js +3 -3
- package/es2022/src/services/permanentStorage/cookiePermanentStorage.service.js +3 -3
- package/es2022/src/services/statusCode/statusCode.service.js +3 -3
- package/es2022/src/services/stringLocalization/noStringLocalization.service.js +3 -3
- package/es2022/src/services/temporaryStorage/memoryTemporaryStorage.service.js +3 -3
- package/es2022/store/src/services/permanentStorage/localPermanentStorage.service.js +3 -3
- package/es2022/store/src/services/temporaryStorage/sessionTemporaryStorage.service.js +3 -3
- package/eslint.config.js +6 -0
- package/floating-ui/src/services/floatingUiDomPosition.service.d.ts.map +1 -1
- package/forms/src/components/defaultValidationErrors/defaultValidationErrors.component.d.ts.map +1 -1
- package/forms/src/components/defaultValidationErrorsContainer/defaultValidationErrorsContainer.component.d.ts.map +1 -1
- package/forms/src/components/reservedSpaceValidationErrorsContainer/reservedSpaceValidationErrorsContainer.component.d.ts.map +1 -1
- package/forms/src/components/reservedSpaceValidationErrorsContainer/reservedSpaceValidationErrorsContainer.component.html +1 -1
- package/forms/src/directives/groupHasError/groupHasError.directive.d.ts.map +1 -1
- package/forms/src/directives/groupHasErrorContainer/groupHasErrorContainer.directive.d.ts.map +1 -1
- package/forms/src/directives/hasError/hasError.directive.d.ts.map +1 -1
- package/forms/src/directives/numberInput/maxValueNumberValidator.directive.d.ts +1 -1
- package/forms/src/directives/numberInput/minValueNumberValidator.directive.d.ts +1 -1
- package/forms/src/directives/numberInput/numberInputControlValueAccessor.directive.d.ts +1 -1
- package/forms/src/directives/numberInput/numberInputValidator.directive.d.ts +1 -1
- package/forms/src/directives/requiredClass/requiredClass.directive.d.ts.map +1 -1
- package/forms/src/directives/validationErrorsContainer/validationErrorsContainer.directive.d.ts.map +1 -1
- package/forms/src/misc/utils.d.ts.map +1 -1
- package/forms/src/modules/errorMessage/components/groupErrors/groupErrors.component.d.ts +1 -1
- package/forms/src/modules/errorMessage/components/groupErrors/groupErrors.component.d.ts.map +1 -1
- package/forms/src/modules/errorMessage/components/groupErrors/groupErrors.component.html +4 -3
- package/forms/src/modules/errorMessage/directives/errorMessage/errorMessage.directive.d.ts +1 -1
- package/forms/src/modules/errorMessage/directives/groupErrorsTemplate/groupErrorsTemplate.directive.d.ts +1 -1
- package/forms/src/modules/errorMessage/modules/errorMessage.module.d.ts +1 -3
- package/forms/src/modules/errorMessage/modules/errorMessage.module.d.ts.map +1 -1
- package/forms/src/modules/errorMessage/pipes/withErrorMessage/withErrorMessage.pipe.d.ts +1 -1
- package/forms/src/modules/formPipes/modules/formPipes.module.d.ts +1 -1
- package/forms/src/modules/formPipes/pipes/asFormArray/asFormArray.pipe.d.ts +1 -1
- package/forms/src/modules/formPipes/pipes/asFormControl/asFormControl.pipe.d.ts +1 -1
- package/forms/src/modules/formPipes/pipes/asFormGroup/asFormGroup.pipe.d.ts +1 -1
- package/forms/src/modules/formPipes/pipes/getControl/getControl.pipe.d.ts +1 -1
- package/forms/src/modules/numberInput.module.d.ts +1 -1
- package/forms/src/services/errorMessagesExtractor/errorMessagesExtractor.service.d.ts.map +1 -1
- package/forms/src/services/validationErrorRenderer/validationErrorRenderer.service.d.ts.map +1 -1
- package/hotkeys/src/components/cheatSheet/cheatSheet.component.d.ts.map +1 -1
- package/material/src/components/confirmationDialog/confirmationDialog.component.d.ts +1 -1
- package/material/src/components/confirmationDialog/confirmationDialog.component.d.ts.map +1 -1
- package/material/src/components/movableTitledDialog/movableTitledDialog.component.d.ts +1 -1
- package/material/src/components/movableTitledDialog/movableTitledDialog.component.d.ts.map +1 -1
- package/material/src/components/movableTitledDialog/movableTitledDialog.component.html +1 -1
- package/material/src/components/titledDialog/titledDialog.component.d.ts +1 -1
- package/material/src/components/titledDialog/titledDialog.component.d.ts.map +1 -1
- package/material/src/components/titledDialog/titledDialog.component.html +2 -2
- package/material/src/directives/confirmationDialog/confirmationDialog.directive.d.ts.map +1 -1
- package/material/src/directives/debugDataCopyClick/debugDataCopyClick.directive.d.ts.map +1 -1
- package/material/src/modules/confirmationDialog.module.d.ts +4 -6
- package/material/src/modules/confirmationDialog.module.d.ts.map +1 -1
- package/material/src/modules/movableTitledDialog.module.d.ts +5 -5
- package/material/src/modules/movableTitledDialog.module.d.ts.map +1 -1
- package/material/src/modules/titledDialog.module.d.ts +2 -4
- package/material/src/modules/titledDialog.module.d.ts.map +1 -1
- package/package.json +44 -44
- package/router/src/decorators/moduleRoutes.decorator.d.ts.map +1 -1
- package/src/components/collapsibleIcon/collapsibleIcon.component.d.ts.map +1 -1
- package/src/components/collapsibleTitle/collapsibleTitle.component.d.ts.map +1 -1
- package/src/decorators/typeProvider/typeProvider.decorator.d.ts.map +1 -1
- package/src/directives/bodyRender/bodyRender.directive.d.ts.map +1 -1
- package/src/directives/clickOutside/clickOutside.directive.d.ts +3 -3
- package/src/directives/clickOutside/clickOutside.directive.d.ts.map +1 -1
- package/src/directives/ellipsisTooltip/ellipsisTooltip.directive.d.ts.map +1 -1
- package/src/directives/goBack/goBack.directive.d.ts.map +1 -1
- package/src/directives/ngComponentOutletEx/ngComponentOutletEx.directive.d.ts.map +1 -1
- package/src/directives/positionTo/positionTo.directive.d.ts +3 -3
- package/src/directives/positionTo/positionTo.directive.d.ts.map +1 -1
- package/src/modules/castPipes/modules/castPipes.module.d.ts +1 -1
- package/src/modules/castPipes/pipes/asHtmlElement/asHtmlElement.pipe.d.ts +1 -1
- package/src/modules/castPipes/pipes/asNgClassRequired/asNgClassRequired.pipe.d.ts +1 -1
- package/src/modules/castPipes/pipes/asRequired/asRequired.pipe.d.ts +1 -1
- package/src/modules/castPipes/pipes/castType/castType.pipe.d.ts +1 -1
- package/src/modules/commonLocalize.module.d.ts +1 -1
- package/src/modules/commonUtils.module.d.ts +1 -1
- package/src/modules/debugData/components/debugData/debugData.component.d.ts.map +1 -1
- package/src/modules/file/components/file/file.component.d.ts.map +1 -1
- package/src/modules/file/components/fileInput/fileInput.component.d.ts.map +1 -1
- package/src/modules/file/components/uploadButton/uploadButton.component.d.ts.map +1 -1
- package/src/modules/file/directive/fileInput/fileInput.directive.d.ts.map +1 -1
- package/src/modules/file/directive/fileTemplate/fileTemplate.directive.d.ts.map +1 -1
- package/src/modules/logger/components/console/console.component.d.ts +3 -3
- package/src/modules/logger/components/console/console.component.d.ts.map +1 -1
- package/src/modules/multiButton/components/multiButton/multiButton.component.d.ts +1 -1
- package/src/modules/multiButton/components/multiButton/multiButton.component.d.ts.map +1 -1
- package/src/modules/multiButton/components/multiButton/multiButton.component.html +1 -1
- package/src/modules/multiButton/modules/multiButton.module.d.ts +1 -2
- package/src/modules/multiButton/modules/multiButton.module.d.ts.map +1 -1
- package/src/modules/progressIndicator/components/progressIndicator/progressIndicator.component.d.ts +1 -1
- package/src/modules/progressIndicator/components/progressIndicator/progressIndicator.component.d.ts.map +1 -1
- package/src/modules/progressIndicator/components/progressIndicator/progressIndicator.component.html +4 -1
- package/src/modules/progressIndicator/directives/progressOverlay/progressOverlay.directive.d.ts +1 -1
- package/src/modules/progressIndicator/directives/progressOverlay/progressOverlay.directive.d.ts.map +1 -1
- package/src/modules/progressIndicator/modules/progressIndicator.module.d.ts +1 -3
- package/src/modules/progressIndicator/modules/progressIndicator.module.d.ts.map +1 -1
- package/src/modules/tooltip/components/tooltip/tooltip.component.d.ts +1 -1
- package/src/modules/tooltip/components/tooltip/tooltip.component.d.ts.map +1 -1
- package/src/modules/tooltip/components/tooltip/tooltip.component.html +13 -5
- package/src/modules/tooltip/directives/tooltip/tooltip.directive.d.ts.map +1 -1
- package/src/modules/tooltip/directives/tooltipTemplate/tooltipTemplate.directive.d.ts +1 -1
- package/src/modules/tooltip/modules/tooltip.module.d.ts +4 -5
- package/src/modules/tooltip/modules/tooltip.module.d.ts.map +1 -1
- package/src/pipes/displayProperties/displayProperties.pipe.d.ts.map +1 -1
- package/src/pipes/firstUppercase/firstUppercase.pipe.d.ts +3 -3
- package/src/pipes/firstUppercase/firstUppercase.pipe.d.ts.map +1 -1
- package/src/pipes/firstUppercaseLocalize/firstUppercaseLocalize.pipe.d.ts +7 -7
- package/src/pipes/firstUppercaseLocalize/firstUppercaseLocalize.pipe.d.ts.map +1 -1
- package/src/pipes/isNaN/isNaN.pipe.d.ts.map +1 -1
- package/src/pipes/isPresent/isPresent.pipe.d.ts.map +1 -1
- package/src/pipes/localize/localize.pipe.d.ts +3 -3
- package/src/pipes/localize/localize.pipe.d.ts.map +1 -1
- package/src/pipes/mergeCssClasses/mergeCssClasses.pipe.d.ts +3 -3
- package/src/pipes/mergeCssClasses/mergeCssClasses.pipe.d.ts.map +1 -1
- package/version.bak +1 -1
package/changelog.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Version 22.0.0 (2025-01-23)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- all *components*, *directives*, *pipes* are now standalone
|
|
8
|
+
|
|
9
|
+
### BREAKING CHANGES
|
|
10
|
+
|
|
11
|
+
- minimal supported version of `@angular` packages is `19.1.0`
|
|
12
|
+
- minimal supported version of `@jscrpt/common` is `7.0.0`
|
|
13
|
+
- minimal supported version of `@floating-ui/dom` is `1.6.13`
|
|
14
|
+
- minimal supported version of `date-fns` is `4.1.0`
|
|
15
|
+
- renamed `ClickOutsideSADirective` directive to `ClickOutsideDirective`
|
|
16
|
+
- renamed `PositionToSADirective` directive to `PositionToDirective`
|
|
17
|
+
- renamed `ConsoleSAComponent` component to `ConsoleComponent`
|
|
18
|
+
- renamed `FirstUppercaseSAPipe` pipe to `FirstUppercasePipe`
|
|
19
|
+
- renamed `FirstUppercaseLocalizeSAPipe` pipe to `FirstUppercaseLocalizePipe`
|
|
20
|
+
- renamed `LocalizeSAPipe` pipe to `LocalizePipe`
|
|
21
|
+
- renamed `MergeCssClassesSAPipe` pipe to `MergeCssClassesPipe`
|
|
22
|
+
|
|
3
23
|
## Version 21.3.0 (2024-11-15)
|
|
4
24
|
|
|
5
25
|
### Bug Fixes
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { Injectable, forwardRef } from '@angular/core';
|
|
3
3
|
import { PositionOffset, PositionPlacement, POSITION, TypeProvider } from '@anglr/common';
|
|
4
|
-
import { extend
|
|
4
|
+
import { extend } from '@jscrpt/common/extend';
|
|
5
|
+
import { isEmptyObject, isFunction, isJsObject, isNumber, nameof } from '@jscrpt/common';
|
|
5
6
|
import { computePosition, autoUpdate, offset, flip, shift } from '@floating-ui/dom';
|
|
6
7
|
import { Observable } from 'rxjs';
|
|
7
8
|
import * as i0 from "@angular/core";
|
|
@@ -232,14 +233,14 @@ let FloatingUiDomPosition = class FloatingUiDomPosition {
|
|
|
232
233
|
}
|
|
233
234
|
}
|
|
234
235
|
}
|
|
235
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
236
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
236
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: FloatingUiDomPosition, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
237
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: FloatingUiDomPosition }); }
|
|
237
238
|
};
|
|
238
239
|
FloatingUiDomPosition = __decorate([
|
|
239
240
|
TypeProvider({ provide: POSITION, useClass: forwardRef(() => FloatingUiDomPosition) })
|
|
240
241
|
], FloatingUiDomPosition);
|
|
241
242
|
export { FloatingUiDomPosition };
|
|
242
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
243
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: FloatingUiDomPosition, decorators: [{
|
|
243
244
|
type: Injectable
|
|
244
245
|
}] });
|
|
245
246
|
//# sourceMappingURL=floatingUiDomPosition.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"floatingUiDomPosition.service.js","sourceRoot":"","sources":["../../../../floating-ui/src/services/floatingUiDomPosition.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,UAAU,EAAE,UAAU,EAAC,MAAM,eAAe,CAAC;AACrD,OAAO,EAA4C,cAAc,EAAE,iBAAiB,EAAqB,QAAQ,EAA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AAC;gBACxB,CAAC;YACD,KAAK,iBAAiB,CAAC,IAAI;gBAC3B,CAAC;oBACG,OAAO,MAAM,CAAC;gBAClB,CAAC;YACD,KAAK,iBAAiB,CAAC,SAAS;gBAChC,CAAC;oBACG,OAAO,YAAY,CAAC;gBACxB,CAAC;YACD,KAAK,iBAAiB,CAAC,OAAO;gBAC9B,CAAC;oBACG,OAAO,UAAU,CAAC;gBACtB,CAAC;YACD,KAAK,iBAAiB,CAAC,KAAK;gBAC5B,CAAC;oBACG,OAAO,OAAO,CAAC;gBACnB,CAAC;YACD,KAAK,iBAAiB,CAAC,UAAU;gBACjC,CAAC;oBACG,OAAO,aAAa,CAAC;gBACzB,CAAC;YACD,KAAK,iBAAiB,CAAC,QAAQ;gBAC/B,CAAC;oBACG,OAAO,WAAW,CAAC;gBACvB,CAAC;QACL,CAAC;IACL,CAAC;8GAvRQ,qBAAqB;kHAArB,qBAAqB;;AAArB,qBAAqB;IADjC,YAAY,CAAC,EAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,qBAAqB,CAAC,EAAC,CAAC;GACxE,qBAAqB,CAwRjC;;2FAxRY,qBAAqB;kBAFjC,UAAU","sourcesContent":["import {Injectable, forwardRef} from '@angular/core';\nimport {Position, PositionResult, PositionOptions, PositionOffset, PositionPlacement, AutoUpdateOptions, POSITION, PositionOffsetString, PositionOffsets, TypeProvider} from '@anglr/common';\nimport {extend, isEmptyObject, isFunction, isJsObject, isNumber, nameof} from '@jscrpt/common';\nimport {computePosition, Placement, autoUpdate, Middleware, offset, flip, shift, VirtualElement} from '@floating-ui/dom';\nimport {Observable} from 'rxjs';\n\n/**\n * Default options for `FloatingUiDomPosition` implementation\n */\nconst defaultOptions: PositionOptions<VirtualElement> =\n{\n autoUpdate: false,\n flip: false,\n offset: nameof<typeof PositionOffset>('None') as PositionOffsetString,\n placement: PositionPlacement.TopStart,\n};\n\n/**\n * Service that is used for positioning two elements against each other, using floating-ui dom implementation\n */\n@Injectable()\n@TypeProvider({provide: POSITION, useClass: forwardRef(() => FloatingUiDomPosition)})\nexport class FloatingUiDomPosition implements Position\n{\n //######################### public methods - implementation of Position #########################\n\n /**\n * @inheritdoc\n */\n public placeElement(target: Element, source: Element, options?: Partial<PositionOptions<VirtualElement>>): Observable<PositionResult>\n {\n return new Observable(subscriber =>\n {\n (async () =>\n {\n const computedOptions = extend({}, defaultOptions, options);\n const middlewares: Middleware[] = [];\n\n this._setOffset(middlewares, computedOptions);\n this._setFlip(middlewares, computedOptions);\n middlewares.push(shift());\n\n const runComputation = async () =>\n {\n const result = await computePosition(source,\n target as HTMLElement,\n {\n placement: this._getPlacement(computedOptions),\n middleware: middlewares,\n });\n\n if(computedOptions.autoUpdate)\n {\n subscriber.next(\n {\n target,\n dispose,\n flip: !!result.middlewareData.flip && !isEmptyObject(result.middlewareData.flip),\n x: result.x,\n y: result.y\n });\n }\n\n return result;\n };\n\n let dispose = () => {};\n\n if(computedOptions.autoUpdate)\n {\n let options: AutoUpdateOptions;\n\n if(computedOptions.autoUpdate === true)\n {\n options =\n {\n ancestorResize: true,\n ancestorScroll: true,\n elementResize: true\n };\n }\n else\n {\n options = computedOptions.autoUpdate;\n }\n\n dispose = autoUpdate(source,\n target as HTMLElement,\n runComputation,\n options);\n }\n\n const result = await runComputation();\n\n subscriber.next(\n {\n target,\n dispose,\n flip: !!result.middlewareData.flip && !isEmptyObject(result.middlewareData.flip),\n x: result.x,\n y: result.y\n });\n\n if(!computedOptions.autoUpdate)\n {\n subscriber.complete();\n }\n })();\n });\n }\n\n //######################### protected methods #########################\n\n /**\n * Sets flip middleware\n * @param middlewares - Array of middlewares that will set\n * @param options - Options that contains definition of flip\n */\n protected _setFlip(middlewares: Middleware[], options: PositionOptions<VirtualElement>): void\n {\n if(options.flip)\n {\n middlewares.push(flip());\n }\n }\n\n /**\n * Sets offset middleware\n * @param middlewares - Array of middlewares that will set\n * @param options - Options that contains definition of offset\n */\n protected _setOffset(middlewares: Middleware[], options: PositionOptions<VirtualElement>): void\n {\n //no offset\n if(options.offset === PositionOffset[PositionOffset.None])\n {\n return;\n }\n\n if(options.offset === PositionOffset[PositionOffset.MouseEnter])\n {\n //fallback if not supported placement used\n if(options.placement == PositionPlacement.Left ||\n options.placement == PositionPlacement.LeftStart ||\n options.placement == PositionPlacement.LeftEnd ||\n options.placement == PositionPlacement.Right ||\n options.placement == PositionPlacement.RightStart ||\n options.placement == PositionPlacement.RightEnd ||\n options.placement == PositionPlacement.Bottom ||\n options.placement == PositionPlacement.BottomEnd ||\n options.placement == PositionPlacement.Top ||\n options.placement == PositionPlacement.TopEnd)\n {\n options.placement = PositionPlacement.TopEnd;\n }\n }\n\n middlewares.push(offset(({elements, placement, x, y}) =>\n {\n //offset is function\n if(isFunction(options.offset))\n {\n return options.offset({elements, x, y});\n }\n\n const floating = elements.floating as Element;\n\n if(options.offset === PositionOffset[PositionOffset.MouseEnter] && options.mouseEvent)\n {\n const targetBoundingRect = (options.mouseEvent.target as HTMLElement).getBoundingClientRect();\n const floatingBoundingRect = (elements.floating as HTMLElement).getBoundingClientRect();\n\n return {\n crossAxis: options.mouseEvent.x - targetBoundingRect.right + floatingBoundingRect.width\n };\n }\n\n const stringOffset = options.offset as PositionOffsetString|number;\n\n //offset is object\n if(isJsObject(options.offset))\n {\n return options.offset as PositionOffsets;\n }\n\n //offset is skidding number\n if(isNumber(stringOffset))\n {\n return {\n crossAxis: stringOffset,\n };\n }\n\n let dimension: number;\n\n if(placement == 'bottom' || placement == 'bottom-start' || placement == 'bottom-end' ||\n placement == 'top' || placement == 'top-start' || placement == 'top-end')\n {\n dimension = floating.clientWidth;\n }\n else\n {\n dimension = floating.clientHeight;\n }\n\n switch(stringOffset)\n {\n default:\n {\n dimension = 0;\n\n break;\n }\n case PositionOffset[PositionOffset.Full]:\n {\n break;\n }\n case PositionOffset[PositionOffset.Half]:\n {\n dimension /= 2;\n\n break;\n }\n case PositionOffset[PositionOffset.NegativeFull]:\n {\n dimension *= -1;\n\n break;\n }\n case PositionOffset[PositionOffset.NegativeHalf]:\n {\n dimension *= -.5;\n\n break;\n }\n }\n\n return {\n crossAxis: dimension\n };\n }));\n }\n\n /**\n * Gets floating ui placement from position placement\n * @param options - Options containing position placement\n */\n protected _getPlacement(options: PositionOptions<VirtualElement>): Placement\n {\n switch(options.placement)\n {\n default:\n // case PositionPlacement.Top:\n {\n return 'top';\n }\n case PositionPlacement.TopStart:\n {\n return 'top-start';\n }\n case PositionPlacement.TopEnd:\n {\n return 'top-end';\n }\n case PositionPlacement.Bottom:\n {\n return 'bottom';\n }\n case PositionPlacement.BottomStart:\n {\n return 'bottom-start';\n }\n case PositionPlacement.BottomEnd:\n {\n return 'bottom-end';\n }\n case PositionPlacement.Left:\n {\n return 'left';\n }\n case PositionPlacement.LeftStart:\n {\n return 'left-start';\n }\n case PositionPlacement.LeftEnd:\n {\n return 'left-end';\n }\n case PositionPlacement.Right:\n {\n return 'right';\n }\n case PositionPlacement.RightStart:\n {\n return 'right-start';\n }\n case PositionPlacement.RightEnd:\n {\n return 'right-end';\n }\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"floatingUiDomPosition.service.js","sourceRoot":"","sources":["../../../../floating-ui/src/services/floatingUiDomPosition.service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,UAAU,EAAE,UAAU,EAAC,MAAM,eAAe,CAAC;AACrD,OAAO,EAA4C,cAAc,EAAE,iBAAiB,EAAqB,QAAQ,EAAyC,YAAY,EAAC,MAAM,eAAe,CAAC;AAC7L,OAAO,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAC,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AACvF,OAAO,EAAC,eAAe,EAAa,UAAU,EAAc,MAAM,EAAE,IAAI,EAAE,KAAK,EAAiB,MAAM,kBAAkB,CAAC;AACzH,OAAO,EAAC,UAAU,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AAK,iBAAiB,CAAC,KAAK;gBAC5B,CAAC;oBACG,OAAO,OAAO,CAAC;gBACnB,CAAC;YACD,KAAK,iBAAiB,CAAC,UAAU;gBACjC,CAAC;oBACG,OAAO,aAAa,CAAC;gBACzB,CAAC;YACD,KAAK,iBAAiB,CAAC,QAAQ;gBAC/B,CAAC;oBACG,OAAO,WAAW,CAAC;gBACvB,CAAC;QACL,CAAC;IACL,CAAC;8GAvRQ,qBAAqB;kHAArB,qBAAqB;;AAArB,qBAAqB;IADjC,YAAY,CAAC,EAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,qBAAqB,CAAC,EAAC,CAAC;GACxE,qBAAqB,CAwRjC;;2FAxRY,qBAAqB;kBAFjC,UAAU","sourcesContent":["import {Injectable, forwardRef} from '@angular/core';\nimport {Position, PositionResult, PositionOptions, PositionOffset, PositionPlacement, AutoUpdateOptions, POSITION, PositionOffsetString, PositionOffsets, TypeProvider} from '@anglr/common';\nimport {extend} from '@jscrpt/common/extend';\nimport {isEmptyObject, isFunction, isJsObject, isNumber, nameof} from '@jscrpt/common';\nimport {computePosition, Placement, autoUpdate, Middleware, offset, flip, shift, VirtualElement} from '@floating-ui/dom';\nimport {Observable} from 'rxjs';\n\n/**\n * Default options for `FloatingUiDomPosition` implementation\n */\nconst defaultOptions: PositionOptions<VirtualElement> =\n{\n autoUpdate: false,\n flip: false,\n offset: nameof<typeof PositionOffset>('None') as PositionOffsetString,\n placement: PositionPlacement.TopStart,\n};\n\n/**\n * Service that is used for positioning two elements against each other, using floating-ui dom implementation\n */\n@Injectable()\n@TypeProvider({provide: POSITION, useClass: forwardRef(() => FloatingUiDomPosition)})\nexport class FloatingUiDomPosition implements Position\n{\n //######################### public methods - implementation of Position #########################\n\n /**\n * @inheritdoc\n */\n public placeElement(target: Element, source: Element, options?: Partial<PositionOptions<VirtualElement>>): Observable<PositionResult>\n {\n return new Observable(subscriber =>\n {\n (async () =>\n {\n const computedOptions = extend({}, defaultOptions, options);\n const middlewares: Middleware[] = [];\n\n this._setOffset(middlewares, computedOptions);\n this._setFlip(middlewares, computedOptions);\n middlewares.push(shift());\n\n const runComputation = async () =>\n {\n const result = await computePosition(source,\n target as HTMLElement,\n {\n placement: this._getPlacement(computedOptions),\n middleware: middlewares,\n });\n\n if(computedOptions.autoUpdate)\n {\n subscriber.next(\n {\n target,\n dispose,\n flip: !!result.middlewareData.flip && !isEmptyObject(result.middlewareData.flip),\n x: result.x,\n y: result.y\n });\n }\n\n return result;\n };\n\n let dispose = () => {};\n\n if(computedOptions.autoUpdate)\n {\n let options: AutoUpdateOptions;\n\n if(computedOptions.autoUpdate === true)\n {\n options =\n {\n ancestorResize: true,\n ancestorScroll: true,\n elementResize: true\n };\n }\n else\n {\n options = computedOptions.autoUpdate;\n }\n\n dispose = autoUpdate(source,\n target as HTMLElement,\n runComputation,\n options);\n }\n\n const result = await runComputation();\n\n subscriber.next(\n {\n target,\n dispose,\n flip: !!result.middlewareData.flip && !isEmptyObject(result.middlewareData.flip),\n x: result.x,\n y: result.y\n });\n\n if(!computedOptions.autoUpdate)\n {\n subscriber.complete();\n }\n })();\n });\n }\n\n //######################### protected methods #########################\n\n /**\n * Sets flip middleware\n * @param middlewares - Array of middlewares that will set\n * @param options - Options that contains definition of flip\n */\n protected _setFlip(middlewares: Middleware[], options: PositionOptions<VirtualElement>): void\n {\n if(options.flip)\n {\n middlewares.push(flip());\n }\n }\n\n /**\n * Sets offset middleware\n * @param middlewares - Array of middlewares that will set\n * @param options - Options that contains definition of offset\n */\n protected _setOffset(middlewares: Middleware[], options: PositionOptions<VirtualElement>): void\n {\n //no offset\n if(options.offset === PositionOffset[PositionOffset.None])\n {\n return;\n }\n\n if(options.offset === PositionOffset[PositionOffset.MouseEnter])\n {\n //fallback if not supported placement used\n if(options.placement == PositionPlacement.Left ||\n options.placement == PositionPlacement.LeftStart ||\n options.placement == PositionPlacement.LeftEnd ||\n options.placement == PositionPlacement.Right ||\n options.placement == PositionPlacement.RightStart ||\n options.placement == PositionPlacement.RightEnd ||\n options.placement == PositionPlacement.Bottom ||\n options.placement == PositionPlacement.BottomEnd ||\n options.placement == PositionPlacement.Top ||\n options.placement == PositionPlacement.TopEnd)\n {\n options.placement = PositionPlacement.TopEnd;\n }\n }\n\n middlewares.push(offset(({elements, placement, x, y}) =>\n {\n //offset is function\n if(isFunction(options.offset))\n {\n return options.offset({elements, x, y});\n }\n\n const floating = elements.floating as Element;\n\n if(options.offset === PositionOffset[PositionOffset.MouseEnter] && options.mouseEvent)\n {\n const targetBoundingRect = (options.mouseEvent.target as HTMLElement).getBoundingClientRect();\n const floatingBoundingRect = (elements.floating as HTMLElement).getBoundingClientRect();\n\n return {\n crossAxis: options.mouseEvent.x - targetBoundingRect.right + floatingBoundingRect.width\n };\n }\n\n const stringOffset = options.offset as PositionOffsetString|number;\n\n //offset is object\n if(isJsObject(options.offset))\n {\n return options.offset as PositionOffsets;\n }\n\n //offset is skidding number\n if(isNumber(stringOffset))\n {\n return {\n crossAxis: stringOffset,\n };\n }\n\n let dimension: number;\n\n if(placement == 'bottom' || placement == 'bottom-start' || placement == 'bottom-end' ||\n placement == 'top' || placement == 'top-start' || placement == 'top-end')\n {\n dimension = floating.clientWidth;\n }\n else\n {\n dimension = floating.clientHeight;\n }\n\n switch(stringOffset)\n {\n default:\n {\n dimension = 0;\n\n break;\n }\n case PositionOffset[PositionOffset.Full]:\n {\n break;\n }\n case PositionOffset[PositionOffset.Half]:\n {\n dimension /= 2;\n\n break;\n }\n case PositionOffset[PositionOffset.NegativeFull]:\n {\n dimension *= -1;\n\n break;\n }\n case PositionOffset[PositionOffset.NegativeHalf]:\n {\n dimension *= -.5;\n\n break;\n }\n }\n\n return {\n crossAxis: dimension\n };\n }));\n }\n\n /**\n * Gets floating ui placement from position placement\n * @param options - Options containing position placement\n */\n protected _getPlacement(options: PositionOptions<VirtualElement>): Placement\n {\n switch(options.placement)\n {\n default:\n // case PositionPlacement.Top:\n {\n return 'top';\n }\n case PositionPlacement.TopStart:\n {\n return 'top-start';\n }\n case PositionPlacement.TopEnd:\n {\n return 'top-end';\n }\n case PositionPlacement.Bottom:\n {\n return 'bottom';\n }\n case PositionPlacement.BottomStart:\n {\n return 'bottom-start';\n }\n case PositionPlacement.BottomEnd:\n {\n return 'bottom-end';\n }\n case PositionPlacement.Left:\n {\n return 'left';\n }\n case PositionPlacement.LeftStart:\n {\n return 'left-start';\n }\n case PositionPlacement.LeftEnd:\n {\n return 'left-end';\n }\n case PositionPlacement.Right:\n {\n return 'right';\n }\n case PositionPlacement.RightStart:\n {\n return 'right-start';\n }\n case PositionPlacement.RightEnd:\n {\n return 'right-end';\n }\n }\n }\n}\n"]}
|
package/es2022/forms/src/components/defaultValidationErrors/defaultValidationErrors.component.js
CHANGED
|
@@ -24,15 +24,15 @@ export class DefaultValidationErrorsComponent {
|
|
|
24
24
|
this.options = options;
|
|
25
25
|
this._changeDetector.detectChanges();
|
|
26
26
|
}
|
|
27
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
28
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
27
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: DefaultValidationErrorsComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
28
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.1.0", type: DefaultValidationErrorsComponent, isStandalone: true, selector: "default-validation-errors", host: { properties: { "@animateChildren": "this.animate" } }, ngImport: i0, template: "@if(errors?.errorMessages?.length)\n{\n <div [ngClass]=\"options?.wrapperDivClass\" @slideInOut>\n @for(error of errors?.errorMessages; track error)\n {\n <div>{{error}}</div>\n }\n </div>\n}", styles: [":host\n{\n display: contents;\n}"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], animations: [
|
|
29
29
|
slideInOutTrigger,
|
|
30
30
|
animateChildrenTrigger
|
|
31
31
|
], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
32
32
|
}
|
|
33
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
33
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: DefaultValidationErrorsComponent, decorators: [{
|
|
34
34
|
type: Component,
|
|
35
|
-
args: [{ selector: 'default-validation-errors',
|
|
35
|
+
args: [{ selector: 'default-validation-errors', imports: [
|
|
36
36
|
NgClass,
|
|
37
37
|
], animations: [
|
|
38
38
|
slideInOutTrigger,
|
package/es2022/forms/src/components/defaultValidationErrors/defaultValidationErrors.component.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultValidationErrors.component.js","sourceRoot":"","sources":["../../../../../forms/src/components/defaultValidationErrors/defaultValidationErrors.component.ts","../../../../../forms/src/components/defaultValidationErrors/defaultValidationErrors.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AACjG,OAAO,EAAC,OAAO,EAAC,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAC,iBAAiB,EAAE,sBAAsB,EAAC,MAAM,mBAAmB,CAAC;;AAK5E;;GAEG;
|
|
1
|
+
{"version":3,"file":"defaultValidationErrors.component.js","sourceRoot":"","sources":["../../../../../forms/src/components/defaultValidationErrors/defaultValidationErrors.component.ts","../../../../../forms/src/components/defaultValidationErrors/defaultValidationErrors.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AACjG,OAAO,EAAC,OAAO,EAAC,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAC,iBAAiB,EAAE,sBAAsB,EAAC,MAAM,mBAAmB,CAAC;;AAK5E;;GAEG;AAiBH,MAAM,OAAO,gCAAgC;IAwBzC,iEAAiE;IACjE,YAAsB,eAAkC;QAAlC,oBAAe,GAAf,eAAe,CAAmB;QATxD,8EAA8E;QAE9E;;WAEG;QAEI,YAAO,GAAY,IAAI,CAAC;IAK/B,CAAC;IAED,kHAAkH;IAElH;;OAEG;IACI,IAAI,CAAC,MAA8B,EAAE,OAAgC;QAExE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,IAAI,CAAC,eAAe,CAAC,aAAa,EAAE,CAAC;IACzC,CAAC;8GAxCQ,gCAAgC;kGAAhC,gCAAgC,mJC1B7C,uOAQC,6FDSO,OAAO,sEAGX;YACI,iBAAiB;YACjB,sBAAsB;SACzB;;2FAGQ,gCAAgC;kBAhB5C,SAAS;+BAEI,2BAA2B,WAIrC;wBACI,OAAO;qBACV,cAED;wBACI,iBAAiB;wBACjB,sBAAsB;qBACzB,mBACgB,uBAAuB,CAAC,MAAM;sFAwBxC,OAAO;sBADb,WAAW;uBAAC,kBAAkB","sourcesContent":["import {Component, ChangeDetectionStrategy, ChangeDetectorRef, HostBinding} from '@angular/core';\nimport {NgClass} from '@angular/common';\nimport {slideInOutTrigger, animateChildrenTrigger} from '@anglr/animations';\n\nimport {ValidationErrorsResult} from '../../services/errorMessagesExtractor/errorMessagesExtractor.interface';\nimport {ValidationErrorsComponent, ValidationErrorsOptions} from '../../services/validationErrorRenderer/validationErrorRenderer.interface';\n\n/**\n * Default validation errors component, displaying validation errors\n */\n@Component(\n{\n selector: 'default-validation-errors',\n templateUrl: 'defaultValidationErrors.component.html',\n styleUrl: 'defaultValidationErrors.component.css',\n imports:\n [\n NgClass,\n ],\n animations: \n [\n slideInOutTrigger,\n animateChildrenTrigger\n ],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class DefaultValidationErrorsComponent implements ValidationErrorsComponent\n{\n //######################### public properties - template bindings #########################\n\n /**\n * Errors to be shown\n * @internal\n */\n public errors: ValidationErrorsResult;\n \n /**\n * Options used for displaying validation errors\n * @internal\n */\n public options: ValidationErrorsOptions;\n\n //######################### public properties - host #########################\n\n /**\n * Enables leave animations for internal stuff\n */\n @HostBinding('@animateChildren')\n public animate: boolean = true;\n\n //######################### constructor #########################\n constructor(protected _changeDetector: ChangeDetectorRef)\n {\n }\n\n //######################### public methods - implementation of ValidationErrorsComponent #########################\n\n /**\n * @inheritdoc\n */\n public show(errors: ValidationErrorsResult, options: ValidationErrorsOptions): void\n {\n this.errors = errors;\n this.options = options;\n\n this._changeDetector.detectChanges();\n }\n}","@if(errors?.errorMessages?.length)\n{\n <div [ngClass]=\"options?.wrapperDivClass\" @slideInOut>\n @for(error of errors?.errorMessages; track error)\n {\n <div>{{error}}</div>\n }\n </div>\n}"]}
|
|
@@ -65,11 +65,11 @@ export class DefaultValidationErrorsContainerComponent {
|
|
|
65
65
|
this._template.detectChanges();
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
69
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
68
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: DefaultValidationErrorsContainerComponent, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
69
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.0", type: DefaultValidationErrorsContainerComponent, isStandalone: true, selector: "default-validation-errors-container", ngImport: i0, template: '', isInline: true, styles: [":host\n{\n display: contents;\n}"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
70
70
|
}
|
|
71
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
71
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: DefaultValidationErrorsContainerComponent, decorators: [{
|
|
72
72
|
type: Component,
|
|
73
|
-
args: [{ selector: 'default-validation-errors-container', template: '',
|
|
73
|
+
args: [{ selector: 'default-validation-errors-container', template: '', changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host\n{\n display: contents;\n}"] }]
|
|
74
74
|
}], ctorParameters: () => [{ type: i0.ViewContainerRef }] });
|
|
75
75
|
//# sourceMappingURL=defaultValidationErrorsContainer.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultValidationErrorsContainer.component.js","sourceRoot":"","sources":["../../../../../forms/src/components/defaultValidationErrorsContainer/defaultValidationErrorsContainer.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,gBAAgB,EAAgC,MAAM,eAAe,CAAC;;AAKlH;;GAEG;
|
|
1
|
+
{"version":3,"file":"defaultValidationErrorsContainer.component.js","sourceRoot":"","sources":["../../../../../forms/src/components/defaultValidationErrorsContainer/defaultValidationErrorsContainer.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,gBAAgB,EAAgC,MAAM,eAAe,CAAC;;AAKlH;;GAEG;AAQH,MAAM,OAAO,yCAAyC;IA0BlD,iEAAiE;IACjE,YAAsB,cAAgC;QAAhC,mBAAc,GAAd,cAAc,CAAkB;IAEtD,CAAC;IAED,yFAAyF;IAEzF;;;;;OAKG;IACI,IAAI,CAAC,MAA8B,EAAE,OAAyC;QAEjF,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QAExB,IAAG,OAAO,CAAC,QAAQ,EACnB,CAAC;YACG,IAAI,CAAC,eAAe,EAAE,CAAC;QAC3B,CAAC;aACI,IAAG,OAAO,CAAC,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EI,qCAAqC,YACrC,EAAE,mBAEK,uBAAuB,CAAC,MAAM","sourcesContent":["import {Component, ChangeDetectionStrategy, ViewContainerRef, ComponentRef, EmbeddedViewRef} from '@angular/core';\n\nimport {ValidationErrorsResult} from '../../services/errorMessagesExtractor/errorMessagesExtractor.interface';\nimport {ValidationErrorsComponent, ValidationErrorsContainerComponent, ValidationErrorsContainerOptions, ValidationErrorsTemplateContext} from '../../services/validationErrorRenderer/validationErrorRenderer.interface';\n\n/**\n * Component that serves as container for validation errors, either component or templates\n */\n@Component(\n{\n selector: 'default-validation-errors-container',\n template: '',\n styleUrl: 'defaultValidationErrorsContainer.component.css',\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class DefaultValidationErrorsContainerComponent implements ValidationErrorsContainerComponent\n{\n //######################### protected fields #########################\n\n /**\n * Errors to be shown\n * @internal\n */\n protected _errors: ValidationErrorsResult;\n \n /**\n * Options used for displaying validation errors\n * @internal\n */\n protected _options: ValidationErrorsContainerOptions;\n\n /**\n * Instance of component reference for rendered errors\n */\n protected _component: ComponentRef<ValidationErrorsComponent>;\n\n /**\n * Instance of template reference for rendered errors\n */\n protected _template: EmbeddedViewRef<ValidationErrorsTemplateContext>;\n\n //######################### constructor #########################\n constructor(protected _viewContainer: ViewContainerRef)\n {\n }\n\n //######################### public methods - implementation of #########################\n\n /**\n * Shows validation errors\n * @param errors - Errors to be shown\n * @param options - Options used for displaying validation errors\n * @param errorClasses - Array of css error classes\n */\n public show(errors: ValidationErrorsResult, options: ValidationErrorsContainerOptions): void\n {\n this._errors = errors;\n this._options = options;\n\n if(options.template)\n {\n this._renderTemplate();\n }\n else if(options.component)\n {\n this._renderComponent();\n }\n else\n {\n throw new Error('Missing template or component for rendering validation errors!');\n }\n }\n\n /**\n * Hides validation errors\n */\n public hide(): void\n {\n this._viewContainer.clear();\n this._component = null;\n this._template = null;\n }\n\n //######################### protected methods #########################\n\n /**\n * Renders validation errors component\n */\n protected _renderComponent(): void\n {\n if(!this._component)\n {\n this._component = this._viewContainer.createComponent(this._options.component);\n }\n\n this._component.instance.show(this._errors, this._options);\n }\n\n /**\n * Renders validation errors template\n */\n protected _renderTemplate(): void\n {\n if(!this._template)\n {\n this._template = this._viewContainer.createEmbeddedView(this._options.template,\n {\n $implicit: this._errors,\n options: this._options\n });\n }\n else\n {\n this._template.context =\n {\n $implicit: this._errors,\n options: this._options\n };\n\n this._template.detectChanges();\n }\n }\n}"]}
|
|
@@ -62,12 +62,12 @@ export class ReservedSpaceValidationErrorsContainerComponent {
|
|
|
62
62
|
this._template.detectChanges();
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
66
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
65
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: ReservedSpaceValidationErrorsContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
66
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.0", type: ReservedSpaceValidationErrorsContainerComponent, isStandalone: true, selector: "reserved-space-validation-errors-container", viewQueries: [{ propertyName: "viewContainer", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "<div>\n <ng-container #container/>\n</div>", styles: [":host\n{\n display: contents;\n}"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
67
67
|
}
|
|
68
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
68
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: ReservedSpaceValidationErrorsContainerComponent, decorators: [{
|
|
69
69
|
type: Component,
|
|
70
|
-
args: [{ selector: 'reserved-space-validation-errors-container',
|
|
70
|
+
args: [{ selector: 'reserved-space-validation-errors-container', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div>\n <ng-container #container/>\n</div>", styles: [":host\n{\n display: contents;\n}"] }]
|
|
71
71
|
}], propDecorators: { viewContainer: [{
|
|
72
72
|
type: ViewChild,
|
|
73
73
|
args: ['container', { static: true, read: ViewContainerRef }]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reservedSpaceValidationErrorsContainer.component.js","sourceRoot":"","sources":["../../../../../forms/src/components/reservedSpaceValidationErrorsContainer/reservedSpaceValidationErrorsContainer.component.ts","../../../../../forms/src/components/reservedSpaceValidationErrorsContainer/reservedSpaceValidationErrorsContainer.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,gBAAgB,EAAiC,SAAS,EAAC,MAAM,eAAe,CAAC;;AAK7H,8BAA8B;AAE9B;;GAEG;
|
|
1
|
+
{"version":3,"file":"reservedSpaceValidationErrorsContainer.component.js","sourceRoot":"","sources":["../../../../../forms/src/components/reservedSpaceValidationErrorsContainer/reservedSpaceValidationErrorsContainer.component.ts","../../../../../forms/src/components/reservedSpaceValidationErrorsContainer/reservedSpaceValidationErrorsContainer.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,gBAAgB,EAAiC,SAAS,EAAC,MAAM,eAAe,CAAC;;AAK7H,8BAA8B;AAE9B;;GAEG;AAQH,MAAM,OAAO,+CAA+C;IAkCxD,yFAAyF;IAEzF;;;;;OAKG;IACI,IAAI,CAAC,MAA8B,EAAE,OAAyC;QAEjF,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QAExB,IAAG,OAAO,CAAC,QAAQ,EACnB,CAAC;YACG,IAAI,CAAC,eAAe,EAAE,CAAC;QAC3B,CAAC;aACI,IAAG,OAAO,CAAC,SAAS,EACzB,CAAC;YACG,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC5B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AkCxC,aAAa;sBADnB,SAAS;uBAAC,WAAW,EAAE,EAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,gBAAgB,EAAC","sourcesContent":["import {Component, ChangeDetectionStrategy, ViewContainerRef, ComponentRef, EmbeddedViewRef, ViewChild} from '@angular/core';\n\nimport {ValidationErrorsResult} from '../../services/errorMessagesExtractor/errorMessagesExtractor.interface';\nimport {ValidationErrorsComponent, ValidationErrorsContainerComponent, ValidationErrorsContainerOptions, ValidationErrorsTemplateContext} from '../../services/validationErrorRenderer/validationErrorRenderer.interface';\n\n//TODO: optimize duplicit code\n\n/**\n * Component that serves as container for validation errors, either component or templates with reserved space for errors\n */\n@Component(\n{\n selector: 'reserved-space-validation-errors-container',\n templateUrl: 'reservedSpaceValidationErrorsContainer.component.html',\n styleUrl: 'reservedSpaceValidationErrorsContainer.component.css',\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class ReservedSpaceValidationErrorsContainerComponent implements ValidationErrorsContainerComponent\n{\n //######################### protected fields #########################\n\n /**\n * Errors to be shown\n * @internal\n */\n protected _errors: ValidationErrorsResult;\n \n /**\n * Options used for displaying validation errors\n * @internal\n */\n protected _options: ValidationErrorsContainerOptions;\n\n /**\n * Instance of component reference for rendered errors\n */\n protected _component: ComponentRef<ValidationErrorsComponent>;\n\n /**\n * Instance of template reference for rendered errors\n */\n protected _template: EmbeddedViewRef<ValidationErrorsTemplateContext>;\n\n //######################### public properties - children #########################\n\n /**\n * View container for rendering validation errors\n */\n @ViewChild('container', {static: true, read: ViewContainerRef})\n public viewContainer: ViewContainerRef;\n\n //######################### public methods - implementation of #########################\n\n /**\n * Shows validation errors\n * @param errors - Errors to be shown\n * @param options - Options used for displaying validation errors\n * @param errorClasses - Array of css error classes\n */\n public show(errors: ValidationErrorsResult, options: ValidationErrorsContainerOptions): void\n {\n this._errors = errors;\n this._options = options;\n\n if(options.template)\n {\n this._renderTemplate();\n }\n else if(options.component)\n {\n this._renderComponent();\n }\n else\n {\n throw new Error('Missing template or component for rendering validation errors!');\n }\n }\n\n /**\n * Hides validation errors\n */\n public hide(): void\n {\n this.viewContainer.clear();\n this._component = null;\n this._template = null;\n }\n\n //######################### protected methods #########################\n\n /**\n * Renders validation errors component\n */\n protected _renderComponent(): void\n {\n if(!this._component)\n {\n this._component = this.viewContainer.createComponent(this._options.component);\n }\n\n this._component.instance.show(this._errors, this._options);\n }\n\n /**\n * Renders validation errors template\n */\n protected _renderTemplate(): void\n {\n if(!this._template)\n {\n this._template = this.viewContainer.createEmbeddedView(this._options.template,\n {\n $implicit: this._errors,\n options: this._options\n });\n }\n else\n {\n this._template.context =\n {\n $implicit: this._errors,\n options: this._options\n };\n\n this._template.detectChanges();\n }\n }\n}","<div>\n <ng-container #container/>\n</div>"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Directive, ElementRef } from '@angular/core';
|
|
2
|
-
import { extend } from '@jscrpt/common';
|
|
2
|
+
import { extend } from '@jscrpt/common/extend';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
/**
|
|
5
5
|
* Default options for GroupHasErrorDirective
|
|
@@ -60,14 +60,13 @@ export class GroupHasErrorDirective {
|
|
|
60
60
|
this._element.nativeElement.classList.remove(this._options.cssClass);
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
64
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
63
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: GroupHasErrorDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
64
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.0", type: GroupHasErrorDirective, isStandalone: true, selector: "[groupHasError]", ngImport: i0 }); }
|
|
65
65
|
}
|
|
66
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
66
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: GroupHasErrorDirective, decorators: [{
|
|
67
67
|
type: Directive,
|
|
68
68
|
args: [{
|
|
69
69
|
selector: '[groupHasError]',
|
|
70
|
-
standalone: true,
|
|
71
70
|
}]
|
|
72
71
|
}], ctorParameters: () => [{ type: i0.ElementRef }] });
|
|
73
72
|
//# sourceMappingURL=groupHasError.directive.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"groupHasError.directive.js","sourceRoot":"","sources":["../../../../../forms/src/directives/groupHasError/groupHasError.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,UAAU,EAAC,MAAM,eAAe,CAAC;AACpD,OAAO,EAAC,MAAM,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"groupHasError.directive.js","sourceRoot":"","sources":["../../../../../forms/src/directives/groupHasError/groupHasError.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,UAAU,EAAC,MAAM,eAAe,CAAC;AACpD,OAAO,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;;AAE7C;;GAEG;AACH,MAAM,cAAc,GACpB;IACI,QAAQ,EAAE,WAAW;CACxB,CAAC;AAaF;;GAEG;AAKH,MAAM,OAAO,sBAAsB;IAc/B,iEAAiE;IACjE,YAAoB,QAAiC;QAAjC,aAAQ,GAAR,QAAQ,CAAyB;QAbrD,oEAAoE;QAEpE;;WAEG;QACK,aAAQ,GAAyB,IAAI,CAAC;QAE9C;;WAEG;QACK,qBAAgB,GAAa,EAAE,CAAC;QAKpC,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,IAAI,EAAE,EAAE,EAAE,cAAc,CAAC,CAAC;IACrD,CAAC;IAED,oEAAoE;IAEpE;;;OAGG;IACI,eAAe,CAAC,EAAU;QAE7B,+BAA+B;QAC/B,IAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAChD,CAAC;YACG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACnC,CAAC;QAED,IAAI,CAAC,aAAa,EAAE,CAAC;IACzB,CAAC;IAED;;;OAGG;IACI,iBAAiB,CAAC,EAAU;QAE/B,gCAAgC;QAChC,IAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAC/C,CAAC;YACG,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACvE,CAAC;QAED,IAAI,CAAC,aAAa,EAAE,CAAC;IACzB,CAAC;IAED,qEAAqE;IAErE;;OAEG;IACK,aAAa;QAEjB,IAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAC/B,CAAC;YACG,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACtE,CAAC;aAED,CAAC;YACG,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACzE,CAAC;IACL,CAAC;8GAnEQ,sBAAsB;kGAAtB,sBAAsB;;2FAAtB,sBAAsB;kBAJlC,SAAS;mBACV;oBACI,QAAQ,EAAE,iBAAiB;iBAC9B","sourcesContent":["import {Directive, ElementRef} from '@angular/core';\nimport {extend} from '@jscrpt/common/extend';\n\n/**\n * Default options for GroupHasErrorDirective\n */\nconst defaultOptions: GroupHasErrorOptions =\n{\n cssClass: 'has-error'\n};\n\n/**\n * Options for GroupHasErrorDirective\n */\nexport interface GroupHasErrorOptions\n{\n /**\n * Css class applied to element when there is an error\n */\n cssClass?: string;\n}\n\n/**\n * Directive that is attached to parent element of inputs group and handles css class that is added to this element\n */\n@Directive(\n{\n selector: '[groupHasError]',\n})\nexport class GroupHasErrorDirective\n{\n //######################### private fields #########################\n\n /**\n * Options for this directive\n */\n private _options: GroupHasErrorOptions = null;\n\n /**\n * Array of invalid controls\n */\n private _invalidControls: string[] = [];\n\n //######################### constructor #########################\n constructor(private _element: ElementRef<HTMLElement>)\n {\n this._options = extend(true, {}, defaultOptions);\n }\n\n //######################### public methods #########################\n\n /**\n * Registers control as invalid control\n * @param id - Name of control to be registered\n */\n public registerControl(id: string): void\n {\n //control is not registered yet\n if(!this._invalidControls.find(itm => itm == id))\n {\n this._invalidControls.push(id);\n }\n\n this._updateStatus();\n }\n\n /**\n * Unregisters control from invalid controls\n * @param id - Id of control to be unregistered\n */\n public unregisterControl(id: string): void\n {\n //control was registered already\n if(this._invalidControls.find(itm => itm == id))\n {\n this._invalidControls.splice(this._invalidControls.indexOf(id), 1);\n }\n\n this._updateStatus();\n }\n\n //######################### private methods #########################\n\n /**\n * Updates status of element (css classes)\n */\n private _updateStatus(): void\n {\n if(this._invalidControls.length)\n {\n this._element.nativeElement.classList.add(this._options.cssClass);\n }\n else\n {\n this._element.nativeElement.classList.remove(this._options.cssClass);\n }\n }\n}"]}
|
package/es2022/forms/src/directives/groupHasErrorContainer/groupHasErrorContainer.directive.js
CHANGED
|
@@ -6,8 +6,8 @@ import * as i0 from "@angular/core";
|
|
|
6
6
|
* Directive that is attached to parent element of inputs group and handles css class that is added to this element and registers provider for ValidationErrorsContainerView
|
|
7
7
|
*/
|
|
8
8
|
export class GroupHasErrorContainerDirective extends GroupHasErrorDirective {
|
|
9
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
10
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
9
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: GroupHasErrorContainerDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
|
|
10
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.0", type: GroupHasErrorContainerDirective, isStandalone: true, selector: "[groupHasErrorContainer]", providers: [
|
|
11
11
|
{
|
|
12
12
|
provide: GroupHasErrorDirective,
|
|
13
13
|
useExisting: GroupHasErrorContainerDirective
|
|
@@ -15,11 +15,10 @@ export class GroupHasErrorContainerDirective extends GroupHasErrorDirective {
|
|
|
15
15
|
ValidationErrorsContainerView
|
|
16
16
|
], usesInheritance: true, ngImport: i0 }); }
|
|
17
17
|
}
|
|
18
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
18
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: GroupHasErrorContainerDirective, decorators: [{
|
|
19
19
|
type: Directive,
|
|
20
20
|
args: [{
|
|
21
21
|
selector: '[groupHasErrorContainer]',
|
|
22
|
-
standalone: true,
|
|
23
22
|
providers: [
|
|
24
23
|
{
|
|
25
24
|
provide: GroupHasErrorDirective,
|
package/es2022/forms/src/directives/groupHasErrorContainer/groupHasErrorContainer.directive.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"groupHasErrorContainer.directive.js","sourceRoot":"","sources":["../../../../../forms/src/directives/groupHasErrorContainer/groupHasErrorContainer.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAmB,MAAM,eAAe,CAAC;AAE1D,OAAO,EAAC,6BAA6B,EAAC,MAAM,0CAA0C,CAAC;AACvF,OAAO,EAAC,sBAAsB,EAAC,MAAM,0CAA0C,CAAC;;AAEhF;;GAEG;
|
|
1
|
+
{"version":3,"file":"groupHasErrorContainer.directive.js","sourceRoot":"","sources":["../../../../../forms/src/directives/groupHasErrorContainer/groupHasErrorContainer.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAmB,MAAM,eAAe,CAAC;AAE1D,OAAO,EAAC,6BAA6B,EAAC,MAAM,0CAA0C,CAAC;AACvF,OAAO,EAAC,sBAAsB,EAAC,MAAM,0CAA0C,CAAC;;AAEhF;;GAEG;AAcH,MAAM,OAAO,+BAAgC,SAAQ,sBAAsB;8GAA9D,+BAA+B;kGAA/B,+BAA+B,uEATxC;YAEI;gBACI,OAAO,EAAE,sBAAsB;gBAC/B,WAAW,EAAE,+BAA+B;aAC/C;YACD,6BAA6B;SAChC;;2FAEQ,+BAA+B;kBAb3C,SAAS;mBACV;oBACI,QAAQ,EAAE,0BAA0B;oBACpC,SAAS,EACT;wBAEI;4BACI,OAAO,EAAE,sBAAsB;4BAC/B,WAAW,iCAAiC;yBAC/C;wBACD,6BAA6B;qBAChC;iBACJ","sourcesContent":["import {Directive, ExistingProvider} from '@angular/core';\n\nimport {ValidationErrorsContainerView} from '../../misc/validationErrorsContainerView';\nimport {GroupHasErrorDirective} from '../groupHasError/groupHasError.directive';\n\n/**\n * Directive that is attached to parent element of inputs group and handles css class that is added to this element and registers provider for ValidationErrorsContainerView\n */\n@Directive(\n{\n selector: '[groupHasErrorContainer]',\n providers:\n [\n <ExistingProvider>\n {\n provide: GroupHasErrorDirective,\n useExisting: GroupHasErrorContainerDirective\n },\n ValidationErrorsContainerView\n ]\n})\nexport class GroupHasErrorContainerDirective extends GroupHasErrorDirective\n{\n}"]}
|
|
@@ -140,8 +140,8 @@ export class HasErrorDirective {
|
|
|
140
140
|
falseAction();
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
144
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
143
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", 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: "19.1.0", type: HasErrorDirective, isStandalone: true, selector: "[hasError][formControlName],[hasError][formControl],[hasError][ngModel]", inputs: { errorMessages: "errorMessages", errorsComponent: "errorsComponent", errorsTemplate: "errorsTemplate" }, ngImport: i0 }); }
|
|
145
145
|
}
|
|
146
146
|
__decorate([
|
|
147
147
|
BindThis,
|
|
@@ -149,11 +149,10 @@ __decorate([
|
|
|
149
149
|
__metadata("design:paramtypes", [Function, Function, Boolean]),
|
|
150
150
|
__metadata("design:returntype", void 0)
|
|
151
151
|
], HasErrorDirective.prototype, "isSubmittedOrDirty", null);
|
|
152
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
152
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: HasErrorDirective, decorators: [{
|
|
153
153
|
type: Directive,
|
|
154
154
|
args: [{
|
|
155
155
|
selector: '[hasError][formControlName],[hasError][formControl],[hasError][ngModel]',
|
|
156
|
-
standalone: true,
|
|
157
156
|
}]
|
|
158
157
|
}], ctorParameters: () => [{ type: i1.ValidationErrorRendererFactory }, { type: i0.ViewContainerRef }, { type: i2.GroupHasErrorDirective, decorators: [{
|
|
159
158
|
type: Optional
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hasError.directive.js","sourceRoot":"","sources":["../../../../../forms/src/directives/hasError/hasError.directive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, 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}"]}
|
|
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,OAA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C;IAED;;;;;OAKG;IAEO,kBAAkB,CAAC,MAAkB,EAAE,cAA0B,GAAG,EAAE,GAAE,CAAC,EAAE,sBAA+B,IAAI;QAEpH,iCAAiC;QACjC,IAAG,CAAC,IAAI,CAAC,YAAY,EAAE,SAAS;YAC5B,IAAI,CAAC,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;kBAJ7B,SAAS;mBACV;oBACI,QAAQ,EAAE,yEAAyE;iBACtF;;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})\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}"]}
|
|
@@ -9,7 +9,7 @@ import * as i0 from "@angular/core";
|
|
|
9
9
|
const MAX_NUMBER_VALIDATOR = {
|
|
10
10
|
provide: NG_VALIDATORS,
|
|
11
11
|
useExisting: forwardRef(() => MaxValueNumberValidatorDirective),
|
|
12
|
-
multi: true
|
|
12
|
+
multi: true,
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
15
|
* Directive injecting checking for number max value validator
|
|
@@ -46,14 +46,14 @@ export class MaxValueNumberValidatorDirective {
|
|
|
46
46
|
validate(control) {
|
|
47
47
|
return this._validator(control);
|
|
48
48
|
}
|
|
49
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
50
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
49
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: MaxValueNumberValidatorDirective, deps: [{ token: 'maxValue', attribute: true }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
50
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.0", type: MaxValueNumberValidatorDirective, isStandalone: true, selector: "input[number][maxValue][formControlName],input[number][maxValue][formControl],input[number][maxValue][ngModel]", inputs: { maxValue: "maxValue" }, providers: [MAX_NUMBER_VALIDATOR], usesOnChanges: true, ngImport: i0 }); }
|
|
51
51
|
}
|
|
52
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
52
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: MaxValueNumberValidatorDirective, decorators: [{
|
|
53
53
|
type: Directive,
|
|
54
54
|
args: [{
|
|
55
55
|
selector: 'input[number][maxValue][formControlName],input[number][maxValue][formControl],input[number][maxValue][ngModel]',
|
|
56
|
-
providers: [MAX_NUMBER_VALIDATOR]
|
|
56
|
+
providers: [MAX_NUMBER_VALIDATOR],
|
|
57
57
|
}]
|
|
58
58
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
59
59
|
type: Attribute,
|
|
@@ -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;IA2BzC,iEAAiE;IACjE,YAAmC,QAAgB;QAdnD;;WAEG;QACK,iBAAY,GAAY,KAAK,CAAC;QAalC,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;8GAnEQ,gCAAgC,kBA4BlB,UAAU;kGA5BxB,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,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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AC,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}"]}
|
|
@@ -9,7 +9,7 @@ import * as i0 from "@angular/core";
|
|
|
9
9
|
const MIN_NUMBER_VALIDATOR = {
|
|
10
10
|
provide: NG_VALIDATORS,
|
|
11
11
|
useExisting: forwardRef(() => MinValueNumberValidatorDirective),
|
|
12
|
-
multi: true
|
|
12
|
+
multi: true,
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
15
|
* Directive injecting checking for number min value validator
|
|
@@ -46,14 +46,14 @@ export class MinValueNumberValidatorDirective {
|
|
|
46
46
|
validate(control) {
|
|
47
47
|
return this._validator(control);
|
|
48
48
|
}
|
|
49
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
50
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
49
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: MinValueNumberValidatorDirective, deps: [{ token: 'minValue', attribute: true }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
50
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.1.0", type: MinValueNumberValidatorDirective, isStandalone: true, selector: "input[number][minValue][formControlName],input[number][minValue][formControl],input[number][minValue][ngModel]", inputs: { minValue: "minValue" }, providers: [MIN_NUMBER_VALIDATOR], usesOnChanges: true, ngImport: i0 }); }
|
|
51
51
|
}
|
|
52
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
52
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.0", ngImport: i0, type: MinValueNumberValidatorDirective, decorators: [{
|
|
53
53
|
type: Directive,
|
|
54
54
|
args: [{
|
|
55
55
|
selector: 'input[number][minValue][formControlName],input[number][minValue][formControl],input[number][minValue][ngModel]',
|
|
56
|
-
providers: [MIN_NUMBER_VALIDATOR]
|
|
56
|
+
providers: [MIN_NUMBER_VALIDATOR],
|
|
57
57
|
}]
|
|
58
58
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
59
59
|
type: Attribute,
|
|
@@ -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;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,
|
|
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,+LAF9B,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}"]}
|