@taiga-ui/kit 2.36.0 → 2.37.0
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/abstract/input-slider.d.ts +22 -3
- package/abstract/taiga-ui-kit-abstract.metadata.json +1 -1
- package/bundles/taiga-ui-kit-abstract.umd.js +65 -17
- package/bundles/taiga-ui-kit-abstract.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-abstract.umd.min.js +2 -2
- package/bundles/taiga-ui-kit-abstract.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-accordion.umd.js +1 -1
- package/bundles/taiga-ui-kit-components-accordion.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-accordion.umd.min.js +1 -1
- package/bundles/taiga-ui-kit-components-accordion.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-arrow.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-arrow.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-badge.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-badge.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-badged-content.umd.js +1 -1
- package/bundles/taiga-ui-kit-components-badged-content.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-badged-content.umd.min.js +1 -1
- package/bundles/taiga-ui-kit-components-badged-content.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-combo-box.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-combo-box.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-data-list-wrapper.umd.js +4 -4
- package/bundles/taiga-ui-kit-components-data-list-wrapper.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-data-list-wrapper.umd.min.js +2 -2
- package/bundles/taiga-ui-kit-components-data-list-wrapper.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-files.umd.js +504 -0
- package/bundles/taiga-ui-kit-components-files.umd.js.map +1 -0
- package/bundles/taiga-ui-kit-components-files.umd.min.js +16 -0
- package/bundles/taiga-ui-kit-components-files.umd.min.js.map +1 -0
- package/bundles/taiga-ui-kit-components-input-count.umd.js +2 -2
- package/bundles/taiga-ui-kit-components-input-count.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-count.umd.min.js +1 -1
- package/bundles/taiga-ui-kit-components-input-count.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-date-range.umd.js +3 -1
- package/bundles/taiga-ui-kit-components-input-date-range.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-date-range.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-date-time.umd.js +1 -1
- package/bundles/taiga-ui-kit-components-input-date-time.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-date-time.umd.min.js +1 -1
- package/bundles/taiga-ui-kit-components-input-date-time.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-date.umd.js +4 -2
- package/bundles/taiga-ui-kit-components-input-date.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-date.umd.min.js +1 -1
- package/bundles/taiga-ui-kit-components-input-date.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-file.umd.js +43 -45
- package/bundles/taiga-ui-kit-components-input-file.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-file.umd.min.js +1 -1
- package/bundles/taiga-ui-kit-components-input-file.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-files.umd.js +490 -0
- package/bundles/taiga-ui-kit-components-input-files.umd.js.map +1 -0
- package/bundles/taiga-ui-kit-components-input-files.umd.min.js +16 -0
- package/bundles/taiga-ui-kit-components-input-files.umd.min.js.map +1 -0
- package/bundles/taiga-ui-kit-components-input-number.umd.js +16 -14
- package/bundles/taiga-ui-kit-components-input-number.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-number.umd.min.js +1 -1
- package/bundles/taiga-ui-kit-components-input-number.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-password.umd.js +2 -2
- package/bundles/taiga-ui-kit-components-input-password.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-password.umd.min.js +1 -1
- package/bundles/taiga-ui-kit-components-input-password.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-phone-international.umd.js +20 -8
- package/bundles/taiga-ui-kit-components-input-phone-international.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-phone-international.umd.min.js +2 -2
- package/bundles/taiga-ui-kit-components-input-phone-international.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-phone.umd.js +5 -4
- package/bundles/taiga-ui-kit-components-input-phone.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-phone.umd.min.js +1 -1
- package/bundles/taiga-ui-kit-components-input-phone.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-range.umd.js +16 -4
- package/bundles/taiga-ui-kit-components-input-range.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-range.umd.min.js +2 -2
- package/bundles/taiga-ui-kit-components-input-range.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-slider.umd.js +61 -14
- package/bundles/taiga-ui-kit-components-input-slider.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-slider.umd.min.js +2 -2
- package/bundles/taiga-ui-kit-components-input-slider.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-tag.umd.js +1 -1
- package/bundles/taiga-ui-kit-components-input-tag.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-tag.umd.min.js +1 -1
- package/bundles/taiga-ui-kit-components-input-tag.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-time.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-time.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-line-clamp.umd.js +2 -2
- package/bundles/taiga-ui-kit-components-line-clamp.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-line-clamp.umd.min.js +1 -1
- package/bundles/taiga-ui-kit-components-line-clamp.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-multi-select-option.umd.js +2 -2
- package/bundles/taiga-ui-kit-components-multi-select-option.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-multi-select-option.umd.min.js +1 -1
- package/bundles/taiga-ui-kit-components-multi-select-option.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-multi-select.umd.js +2 -2
- package/bundles/taiga-ui-kit-components-multi-select.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-multi-select.umd.min.js +1 -1
- package/bundles/taiga-ui-kit-components-multi-select.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-pagination.umd.js +1 -1
- package/bundles/taiga-ui-kit-components-pagination.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-pagination.umd.min.js +1 -1
- package/bundles/taiga-ui-kit-components-pagination.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-progress.umd.js +1 -1
- package/bundles/taiga-ui-kit-components-progress.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-progress.umd.min.js +1 -1
- package/bundles/taiga-ui-kit-components-progress.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-radio.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-radio.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-select.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-select.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-slider.umd.js +65 -20
- package/bundles/taiga-ui-kit-components-slider.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-slider.umd.min.js +2 -2
- package/bundles/taiga-ui-kit-components-slider.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-text-area.umd.js +1 -1
- package/bundles/taiga-ui-kit-components-text-area.umd.min.js +1 -1
- package/bundles/taiga-ui-kit-components-text-area.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components.umd.js +20 -4
- package/bundles/taiga-ui-kit-components.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components.umd.min.js +1 -1
- package/bundles/taiga-ui-kit-enums.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-enums.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-pipes-field-error.umd.js +10 -2
- package/bundles/taiga-ui-kit-pipes-field-error.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-pipes-field-error.umd.min.js +1 -1
- package/bundles/taiga-ui-kit-pipes-field-error.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-tokens.umd.js +8 -0
- package/bundles/taiga-ui-kit-tokens.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-tokens.umd.min.js +1 -1
- package/bundles/taiga-ui-kit-tokens.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-utils-files.umd.js +8 -0
- package/bundles/taiga-ui-kit-utils-files.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-utils-files.umd.min.js +1 -1
- package/bundles/taiga-ui-kit-utils-files.umd.min.js.map +1 -1
- package/components/arrow/arrow-options.d.ts +4 -2
- package/components/arrow/taiga-ui-kit-components-arrow.metadata.json +1 -1
- package/components/badge/badge.component.d.ts +2 -1
- package/components/badge/taiga-ui-kit-components-badge.metadata.json +1 -1
- package/components/combo-box/combo-box.component.d.ts +4 -4
- package/components/combo-box/taiga-ui-kit-components-combo-box.metadata.json +1 -1
- package/components/data-list-wrapper/taiga-ui-kit-components-data-list-wrapper.metadata.json +1 -1
- package/components/files/file/file.component.d.ts +42 -0
- package/components/files/files.component.d.ts +12 -0
- package/components/files/files.module.d.ts +2 -0
- package/components/files/index.d.ts +2 -0
- package/components/files/package.json +13 -0
- package/components/files/taiga-ui-kit-components-files.d.ts +5 -0
- package/components/files/taiga-ui-kit-components-files.metadata.json +1 -0
- package/components/index.d.ts +2 -0
- package/components/input/input.component.d.ts +2 -2
- package/components/input/taiga-ui-kit-components-input.metadata.json +1 -1
- package/components/input-count/input-count.component.d.ts +3 -2
- package/components/input-count/taiga-ui-kit-components-input-count.metadata.json +1 -1
- package/components/input-date/input-date.component.d.ts +5 -3
- package/components/input-date/taiga-ui-kit-components-input-date.metadata.json +1 -1
- package/components/input-date-range/input-date-range.component.d.ts +3 -2
- package/components/input-date-range/taiga-ui-kit-components-input-date-range.metadata.json +1 -1
- package/components/input-date-time/input-date-time.component.d.ts +7 -5
- package/components/input-date-time/taiga-ui-kit-components-input-date-time.metadata.json +1 -1
- package/components/input-file/file/file.component.d.ts +1 -1
- package/components/input-file/taiga-ui-kit-components-input-file.metadata.json +1 -1
- package/components/input-files/index.d.ts +2 -0
- package/components/input-files/input-files.component.d.ts +41 -0
- package/components/input-files/input-files.module.d.ts +2 -0
- package/components/input-files/package.json +13 -0
- package/components/input-files/taiga-ui-kit-components-input-files.d.ts +4 -0
- package/components/input-files/taiga-ui-kit-components-input-files.metadata.json +1 -0
- package/components/input-number/input-number.component.d.ts +3 -2
- package/components/input-number/taiga-ui-kit-components-input-number.metadata.json +1 -1
- package/components/input-password/input-password.component.d.ts +4 -3
- package/components/input-password/taiga-ui-kit-components-input-password.metadata.json +1 -1
- package/components/input-phone/input-phone.component.d.ts +5 -6
- package/components/input-phone/taiga-ui-kit-components-input-phone.metadata.json +1 -1
- package/components/input-phone-international/input-phone-international.component.d.ts +4 -2
- package/components/input-phone-international/taiga-ui-kit-components-input-phone-international.metadata.json +1 -1
- package/components/input-range/input-range.component.d.ts +2 -0
- package/components/input-range/taiga-ui-kit-components-input-range.metadata.json +1 -1
- package/components/input-slider/input-slider.component.d.ts +19 -3
- package/components/input-slider/taiga-ui-kit-components-input-slider.metadata.json +1 -1
- package/components/input-tag/input-tag.component.d.ts +2 -1
- package/components/input-tag/taiga-ui-kit-components-input-tag.metadata.json +1 -1
- package/components/input-time/input-time.component.d.ts +2 -2
- package/components/input-time/taiga-ui-kit-components-input-time.metadata.json +1 -1
- package/components/multi-select/multi-select.component.d.ts +5 -5
- package/components/multi-select/taiga-ui-kit-components-multi-select.metadata.json +1 -1
- package/components/multi-select-option/taiga-ui-kit-components-multi-select-option.metadata.json +1 -1
- package/components/pagination/taiga-ui-kit-components-pagination.metadata.json +1 -1
- package/components/progress/utils/calculate-color-segments.d.ts +0 -4
- package/components/radio/radio.component.d.ts +1 -1
- package/components/select/select.component.d.ts +4 -4
- package/components/select/taiga-ui-kit-components-select.metadata.json +1 -1
- package/components/slider/slider-key-steps.directive.d.ts +12 -2
- package/components/slider/slider-options.d.ts +1 -1
- package/components/slider/taiga-ui-kit-components-slider.metadata.json +1 -1
- package/components/taiga-ui-kit-components.metadata.json +1 -1
- package/components/text-area/taiga-ui-kit-components-text-area.metadata.json +1 -1
- package/enums/file-state.d.ts +1 -0
- package/enums/taiga-ui-kit-enums.metadata.json +1 -1
- package/esm2015/abstract/input-slider.js +43 -4
- package/esm2015/components/accordion/accordion.component.js +2 -2
- package/esm2015/components/arrow/arrow-options.js +1 -1
- package/esm2015/components/badge/badge.component.js +1 -1
- package/esm2015/components/badged-content/badged-content.component.js +3 -3
- package/esm2015/components/combo-box/combo-box.component.js +1 -1
- package/esm2015/components/data-list-wrapper/data-list-group-wrapper.component.js +3 -3
- package/esm2015/components/data-list-wrapper/data-list-wrapper.component.js +3 -3
- package/esm2015/components/files/file/file.component.js +164 -0
- package/esm2015/components/files/files.component.js +45 -0
- package/esm2015/components/files/files.module.js +29 -0
- package/esm2015/components/files/index.js +3 -0
- package/esm2015/components/files/taiga-ui-kit-components-files.js +6 -0
- package/esm2015/components/index.js +3 -1
- package/esm2015/components/input/input.component.js +1 -1
- package/esm2015/components/input-count/input-count.component.js +3 -3
- package/esm2015/components/input-date/input-date.component.js +5 -3
- package/esm2015/components/input-date-range/input-date-range.component.js +4 -2
- package/esm2015/components/input-date-time/input-date-time.component.js +2 -2
- package/esm2015/components/input-file/file/file.component.js +19 -19
- package/esm2015/components/input-file/input-file.component.js +7 -7
- package/esm2015/components/input-file/input-file.module.js +3 -3
- package/esm2015/components/input-files/index.js +3 -0
- package/esm2015/components/input-files/input-files.component.js +208 -0
- package/esm2015/components/input-files/input-files.module.js +34 -0
- package/esm2015/components/input-files/taiga-ui-kit-components-input-files.js +5 -0
- package/esm2015/components/input-number/input-number.component.js +5 -5
- package/esm2015/components/input-password/input-password.component.js +3 -3
- package/esm2015/components/input-phone/input-phone.component.js +6 -5
- package/esm2015/components/input-phone-international/input-phone-international.component.js +20 -6
- package/esm2015/components/input-range/input-range.component.js +18 -6
- package/esm2015/components/input-slider/input-slider.component.js +55 -11
- package/esm2015/components/input-slider/input-slider.module.js +10 -6
- package/esm2015/components/input-tag/input-tag.component.js +2 -2
- package/esm2015/components/input-time/input-time.component.js +1 -1
- package/esm2015/components/line-clamp/line-clamp.directive.js +4 -4
- package/esm2015/components/multi-select/multi-select-group/multi-select-group.component.js +3 -3
- package/esm2015/components/multi-select/multi-select.component.js +2 -2
- package/esm2015/components/multi-select-option/multi-select-option.component.js +3 -3
- package/esm2015/components/pagination/pagination.component.js +2 -2
- package/esm2015/components/progress/utils/calculate-color-segments.js +3 -2
- package/esm2015/components/radio/radio.component.js +1 -1
- package/esm2015/components/select/select.component.js +2 -2
- package/esm2015/components/slider/slider-key-steps.directive.js +33 -8
- package/esm2015/components/slider/slider-options.js +7 -5
- package/esm2015/components/slider/slider.module.js +14 -4
- package/esm2015/components/text-area/text-area.component.js +1 -1
- package/esm2015/enums/file-state.js +1 -1
- package/esm2015/pipes/field-error/field-error-content-pipe.js +11 -3
- package/esm2015/tokens/i18n.js +7 -1
- package/esm2015/utils/files/get-accept-array.js +7 -0
- package/esm2015/utils/files/index.js +2 -1
- package/esm5/abstract/input-slider.js +65 -16
- package/esm5/components/accordion/accordion.component.js +2 -2
- package/esm5/components/arrow/arrow-options.js +1 -1
- package/esm5/components/badge/badge.component.js +1 -1
- package/esm5/components/badged-content/badged-content.component.js +3 -3
- package/esm5/components/combo-box/combo-box.component.js +1 -1
- package/esm5/components/data-list-wrapper/data-list-group-wrapper.component.js +3 -3
- package/esm5/components/data-list-wrapper/data-list-wrapper.component.js +3 -3
- package/esm5/components/files/file/file.component.js +213 -0
- package/esm5/components/files/files.component.js +50 -0
- package/esm5/components/files/files.module.js +32 -0
- package/esm5/components/files/index.js +3 -0
- package/esm5/components/files/taiga-ui-kit-components-files.js +6 -0
- package/esm5/components/index.js +3 -1
- package/esm5/components/input/input.component.js +1 -1
- package/esm5/components/input-count/input-count.component.js +3 -3
- package/esm5/components/input-date/input-date.component.js +5 -3
- package/esm5/components/input-date-range/input-date-range.component.js +4 -2
- package/esm5/components/input-date-time/input-date-time.component.js +2 -2
- package/esm5/components/input-file/file/file.component.js +37 -37
- package/esm5/components/input-file/input-file.component.js +7 -9
- package/esm5/components/input-file/input-file.module.js +3 -3
- package/esm5/components/input-files/index.js +3 -0
- package/esm5/components/input-files/input-files.component.js +239 -0
- package/esm5/components/input-files/input-files.module.js +37 -0
- package/esm5/components/input-files/taiga-ui-kit-components-input-files.js +5 -0
- package/esm5/components/input-number/input-number.component.js +18 -16
- package/esm5/components/input-password/input-password.component.js +3 -3
- package/esm5/components/input-phone/input-phone.component.js +6 -5
- package/esm5/components/input-phone-international/input-phone-international.component.js +21 -9
- package/esm5/components/input-range/input-range.component.js +18 -6
- package/esm5/components/input-slider/input-slider.component.js +58 -11
- package/esm5/components/input-slider/input-slider.module.js +10 -6
- package/esm5/components/input-tag/input-tag.component.js +2 -2
- package/esm5/components/input-time/input-time.component.js +1 -1
- package/esm5/components/line-clamp/line-clamp.directive.js +4 -4
- package/esm5/components/multi-select/multi-select-group/multi-select-group.component.js +3 -3
- package/esm5/components/multi-select/multi-select.component.js +2 -2
- package/esm5/components/multi-select-option/multi-select-option.component.js +3 -3
- package/esm5/components/pagination/pagination.component.js +2 -2
- package/esm5/components/progress/utils/calculate-color-segments.js +3 -2
- package/esm5/components/radio/radio.component.js +1 -1
- package/esm5/components/select/select.component.js +2 -2
- package/esm5/components/slider/slider-key-steps.directive.js +48 -13
- package/esm5/components/slider/slider-options.js +7 -5
- package/esm5/components/slider/slider.module.js +14 -4
- package/esm5/components/text-area/text-area.component.js +1 -1
- package/esm5/enums/file-state.js +1 -1
- package/esm5/pipes/field-error/field-error-content-pipe.js +11 -3
- package/esm5/tokens/i18n.js +7 -1
- package/esm5/utils/files/get-accept-array.js +7 -0
- package/esm5/utils/files/index.js +2 -1
- package/fesm2015/taiga-ui-kit-abstract.js +42 -3
- package/fesm2015/taiga-ui-kit-abstract.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-accordion.js +1 -1
- package/fesm2015/taiga-ui-kit-components-accordion.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-arrow.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-badge.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-badged-content.js +2 -2
- package/fesm2015/taiga-ui-kit-components-badged-content.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-combo-box.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-data-list-wrapper.js +4 -4
- package/fesm2015/taiga-ui-kit-components-data-list-wrapper.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-files.js +232 -0
- package/fesm2015/taiga-ui-kit-components-files.js.map +1 -0
- package/fesm2015/taiga-ui-kit-components-input-count.js +2 -2
- package/fesm2015/taiga-ui-kit-components-input-count.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-input-date-range.js +3 -1
- package/fesm2015/taiga-ui-kit-components-input-date-range.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-input-date-time.js +1 -1
- package/fesm2015/taiga-ui-kit-components-input-date-time.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-input-date.js +4 -2
- package/fesm2015/taiga-ui-kit-components-input-date.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-input-file.js +25 -25
- package/fesm2015/taiga-ui-kit-components-input-file.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-input-files.js +242 -0
- package/fesm2015/taiga-ui-kit-components-input-files.js.map +1 -0
- package/fesm2015/taiga-ui-kit-components-input-number.js +4 -4
- package/fesm2015/taiga-ui-kit-components-input-number.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-input-password.js +3 -3
- package/fesm2015/taiga-ui-kit-components-input-password.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-input-phone-international.js +19 -5
- package/fesm2015/taiga-ui-kit-components-input-phone-international.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-input-phone.js +5 -4
- package/fesm2015/taiga-ui-kit-components-input-phone.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-input-range.js +17 -5
- package/fesm2015/taiga-ui-kit-components-input-range.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-input-slider.js +61 -15
- package/fesm2015/taiga-ui-kit-components-input-slider.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-input-tag.js +1 -1
- package/fesm2015/taiga-ui-kit-components-input-tag.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-input-time.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-input.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-line-clamp.js +3 -3
- package/fesm2015/taiga-ui-kit-components-line-clamp.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-multi-select-option.js +2 -2
- package/fesm2015/taiga-ui-kit-components-multi-select-option.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-multi-select.js +2 -2
- package/fesm2015/taiga-ui-kit-components-multi-select.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-pagination.js +1 -1
- package/fesm2015/taiga-ui-kit-components-pagination.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-progress.js +2 -2
- package/fesm2015/taiga-ui-kit-components-progress.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-radio.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-select.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-slider.js +50 -15
- package/fesm2015/taiga-ui-kit-components-slider.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-text-area.js +1 -1
- package/fesm2015/taiga-ui-kit-components.js +2 -0
- package/fesm2015/taiga-ui-kit-components.js.map +1 -1
- package/fesm2015/taiga-ui-kit-enums.js.map +1 -1
- package/fesm2015/taiga-ui-kit-pipes-field-error.js +10 -2
- package/fesm2015/taiga-ui-kit-pipes-field-error.js.map +1 -1
- package/fesm2015/taiga-ui-kit-tokens.js +7 -1
- package/fesm2015/taiga-ui-kit-tokens.js.map +1 -1
- package/fesm2015/taiga-ui-kit-utils-files.js +8 -1
- package/fesm2015/taiga-ui-kit-utils-files.js.map +1 -1
- package/fesm5/taiga-ui-kit-abstract.js +64 -15
- package/fesm5/taiga-ui-kit-abstract.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-accordion.js +1 -1
- package/fesm5/taiga-ui-kit-components-accordion.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-arrow.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-badge.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-badged-content.js +2 -2
- package/fesm5/taiga-ui-kit-components-badged-content.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-combo-box.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-data-list-wrapper.js +4 -4
- package/fesm5/taiga-ui-kit-components-data-list-wrapper.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-files.js +289 -0
- package/fesm5/taiga-ui-kit-components-files.js.map +1 -0
- package/fesm5/taiga-ui-kit-components-input-count.js +2 -2
- package/fesm5/taiga-ui-kit-components-input-count.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-input-date-range.js +3 -1
- package/fesm5/taiga-ui-kit-components-input-date-range.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-input-date-time.js +1 -1
- package/fesm5/taiga-ui-kit-components-input-date-time.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-input-date.js +4 -2
- package/fesm5/taiga-ui-kit-components-input-date.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-input-file.js +43 -45
- package/fesm5/taiga-ui-kit-components-input-file.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-input-files.js +276 -0
- package/fesm5/taiga-ui-kit-components-input-files.js.map +1 -0
- package/fesm5/taiga-ui-kit-components-input-number.js +17 -15
- package/fesm5/taiga-ui-kit-components-input-number.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-input-password.js +3 -3
- package/fesm5/taiga-ui-kit-components-input-password.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-input-phone-international.js +20 -8
- package/fesm5/taiga-ui-kit-components-input-phone-international.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-input-phone.js +5 -4
- package/fesm5/taiga-ui-kit-components-input-phone.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-input-range.js +17 -5
- package/fesm5/taiga-ui-kit-components-input-range.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-input-slider.js +65 -16
- package/fesm5/taiga-ui-kit-components-input-slider.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-input-tag.js +1 -1
- package/fesm5/taiga-ui-kit-components-input-tag.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-input-time.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-input.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-line-clamp.js +3 -3
- package/fesm5/taiga-ui-kit-components-line-clamp.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-multi-select-option.js +2 -2
- package/fesm5/taiga-ui-kit-components-multi-select-option.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-multi-select.js +2 -2
- package/fesm5/taiga-ui-kit-components-multi-select.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-pagination.js +1 -1
- package/fesm5/taiga-ui-kit-components-pagination.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-progress.js +2 -2
- package/fesm5/taiga-ui-kit-components-progress.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-radio.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-select.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-slider.js +65 -20
- package/fesm5/taiga-ui-kit-components-slider.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-text-area.js +1 -1
- package/fesm5/taiga-ui-kit-components.js +2 -0
- package/fesm5/taiga-ui-kit-components.js.map +1 -1
- package/fesm5/taiga-ui-kit-enums.js.map +1 -1
- package/fesm5/taiga-ui-kit-pipes-field-error.js +10 -2
- package/fesm5/taiga-ui-kit-pipes-field-error.js.map +1 -1
- package/fesm5/taiga-ui-kit-tokens.js +7 -1
- package/fesm5/taiga-ui-kit-tokens.js.map +1 -1
- package/fesm5/taiga-ui-kit-utils-files.js +8 -1
- package/fesm5/taiga-ui-kit-utils-files.js.map +1 -1
- package/package.json +4 -4
- package/pipes/field-error/field-error-content-pipe.d.ts +1 -0
- package/pipes/field-error/taiga-ui-kit-pipes-field-error.metadata.json +1 -1
- package/tokens/i18n.d.ts +2 -0
- package/tokens/taiga-ui-kit-tokens.metadata.json +1 -1
- package/utils/files/get-accept-array.d.ts +1 -0
- package/utils/files/index.d.ts +1 -0
- package/utils/files/taiga-ui-kit-utils-files.metadata.json +1 -1
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import { __extends, __spread, __decorate, __param } from 'tslib';
|
|
2
|
+
import { EventEmitter, Optional, Self, Inject, ChangeDetectorRef, ViewChild, Input, Output, Component, ChangeDetectionStrategy, ViewEncapsulation, forwardRef, NgModule } from '@angular/core';
|
|
3
|
+
import { NgControl } from '@angular/forms';
|
|
4
|
+
import { isNativeFocused, EMPTY_ARRAY, TUI_IS_MOBILE, tuiDefaultProp, tuiPure, TUI_FOCUSABLE_ITEM_ACCESSOR, AbstractTuiNullableControl, TuiLetModule, TuiFocusedModule, TuiFocusVisibleModule, TuiPressedModule, TuiHoveredModule, TuiFocusableModule, TuiDroppableModule } from '@taiga-ui/cdk';
|
|
5
|
+
import { MODE_PROVIDER, TuiWrapperModule, TuiSvgModule, TuiLinkModule, TuiLoaderModule, TuiButtonModule, TuiGroupModule } from '@taiga-ui/core';
|
|
6
|
+
import { TUI_INPUT_FILE_TEXTS, TUI_DIGITAL_INFORMATION_UNITS } from '@taiga-ui/kit/tokens';
|
|
7
|
+
import { formatSize, getAcceptArray } from '@taiga-ui/kit/utils/files';
|
|
8
|
+
import { of, Observable } from 'rxjs';
|
|
9
|
+
import { map } from 'rxjs/operators';
|
|
10
|
+
import { CommonModule } from '@angular/common';
|
|
11
|
+
import { PolymorpheusModule } from '@tinkoff/ng-polymorpheus';
|
|
12
|
+
|
|
13
|
+
var DEFAULT_MAX_SIZE = 30 * 1000 * 1000; // 30 MB
|
|
14
|
+
// @dynamic
|
|
15
|
+
var TuiInputFilesComponent = /** @class */ (function (_super) {
|
|
16
|
+
__extends(TuiInputFilesComponent, _super);
|
|
17
|
+
function TuiInputFilesComponent(control, changeDetectorRef, isMobile, inputFileTexts$, units$) {
|
|
18
|
+
var _this = _super.call(this, control, changeDetectorRef) || this;
|
|
19
|
+
_this.isMobile = isMobile;
|
|
20
|
+
_this.inputFileTexts$ = inputFileTexts$;
|
|
21
|
+
_this.units$ = units$;
|
|
22
|
+
_this.dataTransfer = null;
|
|
23
|
+
_this.link = '';
|
|
24
|
+
_this.label = '';
|
|
25
|
+
_this.accept = '';
|
|
26
|
+
_this.multiple = false;
|
|
27
|
+
_this.size = 'm';
|
|
28
|
+
_this.maxFileSize = DEFAULT_MAX_SIZE;
|
|
29
|
+
_this.reject = new EventEmitter();
|
|
30
|
+
return _this;
|
|
31
|
+
}
|
|
32
|
+
TuiInputFilesComponent_1 = TuiInputFilesComponent;
|
|
33
|
+
Object.defineProperty(TuiInputFilesComponent.prototype, "nativeFocusableElement", {
|
|
34
|
+
get: function () {
|
|
35
|
+
var _a;
|
|
36
|
+
return ((_a = this.input) === null || _a === void 0 ? void 0 : _a.nativeElement) || null;
|
|
37
|
+
},
|
|
38
|
+
enumerable: true,
|
|
39
|
+
configurable: true
|
|
40
|
+
});
|
|
41
|
+
Object.defineProperty(TuiInputFilesComponent.prototype, "focused", {
|
|
42
|
+
get: function () {
|
|
43
|
+
return isNativeFocused(this.nativeFocusableElement);
|
|
44
|
+
},
|
|
45
|
+
enumerable: true,
|
|
46
|
+
configurable: true
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(TuiInputFilesComponent.prototype, "computedLink$", {
|
|
49
|
+
get: function () {
|
|
50
|
+
return this.computeLink$(this.fileDragged, this.multiple, this.link);
|
|
51
|
+
},
|
|
52
|
+
enumerable: true,
|
|
53
|
+
configurable: true
|
|
54
|
+
});
|
|
55
|
+
Object.defineProperty(TuiInputFilesComponent.prototype, "computedLabel$", {
|
|
56
|
+
get: function () {
|
|
57
|
+
return this.computeLabel$(this.isMobile, this.fileDragged, this.multiple, this.label);
|
|
58
|
+
},
|
|
59
|
+
enumerable: true,
|
|
60
|
+
configurable: true
|
|
61
|
+
});
|
|
62
|
+
Object.defineProperty(TuiInputFilesComponent.prototype, "fileDragged", {
|
|
63
|
+
get: function () {
|
|
64
|
+
var _a;
|
|
65
|
+
return !!((_a = this.dataTransfer) === null || _a === void 0 ? void 0 : _a.types.includes('Files'));
|
|
66
|
+
},
|
|
67
|
+
enumerable: true,
|
|
68
|
+
configurable: true
|
|
69
|
+
});
|
|
70
|
+
Object.defineProperty(TuiInputFilesComponent.prototype, "arrayValue", {
|
|
71
|
+
get: function () {
|
|
72
|
+
return this.getValueArray(this.value);
|
|
73
|
+
},
|
|
74
|
+
enumerable: true,
|
|
75
|
+
configurable: true
|
|
76
|
+
});
|
|
77
|
+
TuiInputFilesComponent.prototype.onHovered = function (hovered) {
|
|
78
|
+
this.updateHovered(hovered);
|
|
79
|
+
};
|
|
80
|
+
TuiInputFilesComponent.prototype.onFocused = function (focused) {
|
|
81
|
+
this.updateFocused(focused);
|
|
82
|
+
};
|
|
83
|
+
TuiInputFilesComponent.prototype.onPressed = function (pressed) {
|
|
84
|
+
this.updatePressed(pressed);
|
|
85
|
+
};
|
|
86
|
+
TuiInputFilesComponent.prototype.onFilesSelected = function (input, texts, units) {
|
|
87
|
+
this.processSelectedFiles(input.files, texts, units);
|
|
88
|
+
input.value = '';
|
|
89
|
+
};
|
|
90
|
+
TuiInputFilesComponent.prototype.onDropped = function (event, texts, units) {
|
|
91
|
+
this.processSelectedFiles(event.files, texts, units);
|
|
92
|
+
};
|
|
93
|
+
TuiInputFilesComponent.prototype.onDragOver = function (dataTransfer) {
|
|
94
|
+
this.dataTransfer = dataTransfer;
|
|
95
|
+
};
|
|
96
|
+
TuiInputFilesComponent.prototype.removeFile = function (removedFile) {
|
|
97
|
+
this.updateValue(this.multiple ? this.arrayValue.filter(function (file) { return file !== removedFile; }) : null);
|
|
98
|
+
};
|
|
99
|
+
TuiInputFilesComponent.prototype.computeLink$ = function (fileDragged, multiple, link) {
|
|
100
|
+
return fileDragged
|
|
101
|
+
? of('')
|
|
102
|
+
: this.inputFileTexts$.pipe(map(function (texts) {
|
|
103
|
+
return multiple && link === ''
|
|
104
|
+
? texts.defaultLinkMultiple
|
|
105
|
+
: link || texts.defaultLinkSingle;
|
|
106
|
+
}));
|
|
107
|
+
};
|
|
108
|
+
TuiInputFilesComponent.prototype.computeLabel$ = function (isMobile, fileDragged, multiple, label) {
|
|
109
|
+
if (isMobile) {
|
|
110
|
+
return of('');
|
|
111
|
+
}
|
|
112
|
+
if (fileDragged) {
|
|
113
|
+
return this.inputFileTexts$.pipe(map(function (texts) { return (multiple ? texts.dropMultiple : texts.drop); }));
|
|
114
|
+
}
|
|
115
|
+
return this.inputFileTexts$.pipe(map(function (texts) {
|
|
116
|
+
return multiple && label === ''
|
|
117
|
+
? texts.defaultLabelMultiple
|
|
118
|
+
: label || texts.defaultLabelSingle;
|
|
119
|
+
}));
|
|
120
|
+
};
|
|
121
|
+
TuiInputFilesComponent.prototype.getValueArray = function (value) {
|
|
122
|
+
if (!value) {
|
|
123
|
+
return EMPTY_ARRAY;
|
|
124
|
+
}
|
|
125
|
+
return Array.isArray(value) ? value : [value];
|
|
126
|
+
};
|
|
127
|
+
TuiInputFilesComponent.prototype.processSelectedFiles = function (files, texts, units) {
|
|
128
|
+
var _this = this;
|
|
129
|
+
// IE11 after selecting a file through the open dialog generates a second event passing an empty FileList.
|
|
130
|
+
if (!(files === null || files === void 0 ? void 0 : files.length)) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
var newFiles = this.multiple ? Array.from(files) : [files[0]];
|
|
134
|
+
var tooBigFiles = newFiles.filter(function (file) { return file.size > _this.maxFileSize; });
|
|
135
|
+
var wrongFormatFiles = newFiles.filter(function (file) { return !_this.isFormatAcceptable(file) && !tooBigFiles.includes(file); });
|
|
136
|
+
var acceptedFiles = newFiles.filter(function (file) { return !tooBigFiles.includes(file) && !wrongFormatFiles.includes(file); });
|
|
137
|
+
if (tooBigFiles.length || wrongFormatFiles.length) {
|
|
138
|
+
this.rejectFiles(__spread(tooBigFiles.map(function (file) { return ({
|
|
139
|
+
name: file.name,
|
|
140
|
+
type: file.type,
|
|
141
|
+
size: file.size,
|
|
142
|
+
content: texts.maxSizeRejectionReason +
|
|
143
|
+
formatSize(units, _this.maxFileSize),
|
|
144
|
+
}); }), wrongFormatFiles.map(function (file) { return ({
|
|
145
|
+
name: file.name,
|
|
146
|
+
type: file.type,
|
|
147
|
+
size: file.size,
|
|
148
|
+
content: texts.formatRejectionReason,
|
|
149
|
+
}); })));
|
|
150
|
+
}
|
|
151
|
+
this.updateValue(this.multiple
|
|
152
|
+
? __spread(this.arrayValue, acceptedFiles) : acceptedFiles[0] || null);
|
|
153
|
+
};
|
|
154
|
+
TuiInputFilesComponent.prototype.isFormatAcceptable = function (file) {
|
|
155
|
+
if (!this.accept) {
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
var extension = "." + (file.name.split('.').pop() || '').toLowerCase();
|
|
159
|
+
return getAcceptArray(this.accept).some(function (format) {
|
|
160
|
+
return format === extension ||
|
|
161
|
+
format === file.type ||
|
|
162
|
+
(format.split('/')[1] === '*' &&
|
|
163
|
+
file.type.split('/')[0] === format.split('/')[0]);
|
|
164
|
+
});
|
|
165
|
+
};
|
|
166
|
+
TuiInputFilesComponent.prototype.rejectFiles = function (rejectedFiles) {
|
|
167
|
+
this.reject.emit(this.multiple ? rejectedFiles : rejectedFiles[0]);
|
|
168
|
+
};
|
|
169
|
+
var TuiInputFilesComponent_1;
|
|
170
|
+
TuiInputFilesComponent.ctorParameters = function () { return [
|
|
171
|
+
{ type: NgControl, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [NgControl,] }] },
|
|
172
|
+
{ type: ChangeDetectorRef, decorators: [{ type: Inject, args: [ChangeDetectorRef,] }] },
|
|
173
|
+
{ type: Boolean, decorators: [{ type: Inject, args: [TUI_IS_MOBILE,] }] },
|
|
174
|
+
{ type: Observable, decorators: [{ type: Inject, args: [TUI_INPUT_FILE_TEXTS,] }] },
|
|
175
|
+
{ type: Observable, decorators: [{ type: Inject, args: [TUI_DIGITAL_INFORMATION_UNITS,] }] }
|
|
176
|
+
]; };
|
|
177
|
+
__decorate([
|
|
178
|
+
ViewChild('input')
|
|
179
|
+
], TuiInputFilesComponent.prototype, "input", void 0);
|
|
180
|
+
__decorate([
|
|
181
|
+
Input(),
|
|
182
|
+
tuiDefaultProp()
|
|
183
|
+
], TuiInputFilesComponent.prototype, "link", void 0);
|
|
184
|
+
__decorate([
|
|
185
|
+
Input(),
|
|
186
|
+
tuiDefaultProp()
|
|
187
|
+
], TuiInputFilesComponent.prototype, "label", void 0);
|
|
188
|
+
__decorate([
|
|
189
|
+
Input(),
|
|
190
|
+
tuiDefaultProp()
|
|
191
|
+
], TuiInputFilesComponent.prototype, "accept", void 0);
|
|
192
|
+
__decorate([
|
|
193
|
+
Input(),
|
|
194
|
+
tuiDefaultProp()
|
|
195
|
+
], TuiInputFilesComponent.prototype, "multiple", void 0);
|
|
196
|
+
__decorate([
|
|
197
|
+
Input(),
|
|
198
|
+
tuiDefaultProp()
|
|
199
|
+
], TuiInputFilesComponent.prototype, "size", void 0);
|
|
200
|
+
__decorate([
|
|
201
|
+
Input(),
|
|
202
|
+
tuiDefaultProp()
|
|
203
|
+
], TuiInputFilesComponent.prototype, "maxFileSize", void 0);
|
|
204
|
+
__decorate([
|
|
205
|
+
Output()
|
|
206
|
+
], TuiInputFilesComponent.prototype, "reject", void 0);
|
|
207
|
+
__decorate([
|
|
208
|
+
tuiPure
|
|
209
|
+
], TuiInputFilesComponent.prototype, "computeLink$", null);
|
|
210
|
+
__decorate([
|
|
211
|
+
tuiPure
|
|
212
|
+
], TuiInputFilesComponent.prototype, "computeLabel$", null);
|
|
213
|
+
__decorate([
|
|
214
|
+
tuiPure
|
|
215
|
+
], TuiInputFilesComponent.prototype, "getValueArray", null);
|
|
216
|
+
TuiInputFilesComponent = TuiInputFilesComponent_1 = __decorate([
|
|
217
|
+
Component({
|
|
218
|
+
selector: 'tui-input-files',
|
|
219
|
+
template: "<tui-wrapper\n appearance=\"input-file\"\n class=\"t-wrapper\"\n [class._mobile]=\"isMobile\"\n [focused]=\"computedFocused\"\n [hovered]=\"computedHovered || fileDragged\"\n [pressed]=\"computedPressed\"\n [disabled]=\"computedDisabled\"\n>\n <label\n *ngIf=\"units$ | async as units\"\n automation-id=\"tui-input-file__label\"\n >\n <a tuiLink>\n <span\n polymorpheus-outlet\n class=\"t-inline\"\n [content]=\"computedLink$ | async\"\n ></span>\n </a>\n <ng-container *ngIf=\"computedLabel$ | async as computedLabel\">\n <span> </span>\n <span\n polymorpheus-outlet\n class=\"t-inline\"\n [content]=\"computedLabel\"\n ></span>\n </ng-container>\n <ng-container *ngIf=\"!readOnly && !computedDisabled\">\n <input\n *ngIf=\"inputFileTexts$ | async as texts\"\n #input\n type=\"file\"\n class=\"t-native\"\n [id]=\"id\"\n [accept]=\"accept\"\n [multiple]=\"multiple\"\n [tuiFocusable]=\"focusable\"\n (change)=\"onFilesSelected(input, texts, units)\"\n (tuiHoveredChange)=\"onHovered($event)\"\n (tuiFocusedChange)=\"onFocused($event)\"\n (tuiPressedChange)=\"onPressed($event)\"\n (tuiDroppableDropped)=\"onDropped($event, texts, units)\"\n (tuiDroppableDragOverChange)=\"onDragOver($event)\"\n (mousedown.prevent.silent)=\"0\"\n />\n </ng-container>\n </label>\n</tui-wrapper>\n",
|
|
220
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
221
|
+
encapsulation: ViewEncapsulation.None,
|
|
222
|
+
providers: [
|
|
223
|
+
MODE_PROVIDER,
|
|
224
|
+
{
|
|
225
|
+
provide: TUI_FOCUSABLE_ITEM_ACCESSOR,
|
|
226
|
+
useExisting: forwardRef(function () { return TuiInputFilesComponent_1; }),
|
|
227
|
+
},
|
|
228
|
+
],
|
|
229
|
+
styles: ["tui-input-files{display:block}tui-wrapper[data-appearance=input-file]{display:flex;background:0 0;font:var(--tui-font-text-m);word-wrap:break-word;color:var(--tui-text-02);flex:1;justify-content:center;align-items:center;min-height:var(--tui-height-l);border-radius:var(--tui-radius-m);padding:1rem .5rem;box-sizing:border-box}tui-wrapper[data-appearance=input-file]:after{border:1px dashed;color:var(--tui-link)}tui-wrapper[data-appearance=input-file]._mobile:after{border:1px solid}tui-wrapper[data-appearance=input-file][data-state=hovered]{background:var(--tui-secondary)}tui-wrapper[data-appearance=input-file][data-state=hovered]:after{color:var(--tui-link-hover)}tui-wrapper[data-appearance=input-file][data-state=pressed]{background:var(--tui-secondary-hover)}tui-wrapper[data-appearance=input-file][data-state=disabled]{opacity:var(--tui-disabled-opacity);pointer-events:none}tui-wrapper[data-appearance=input-file][data-state=disabled]:after{color:var(--tui-text-03)}tui-wrapper[data-appearance=input-file]._focused:after{border-style:solid;border-width:2px;color:var(--tui-focus)}tui-wrapper[data-appearance=input-file][data-mode=onDark],tui-wrapper[data-appearance=input-file][data-mode=onDark]._focused:after,tui-wrapper[data-appearance=input-file][data-mode=onDark]:after{color:var(--tui-text-01-night)}tui-wrapper[data-appearance=input-file][data-mode=onDark][data-state=hovered]{background:var(--tui-clear-inverse-hover)}tui-wrapper[data-appearance=input-file][data-mode=onDark][data-state=hovered]:after,tui-wrapper[data-appearance=input-file][data-mode=onDark][data-state=pressed]:after{color:var(--tui-text-03-night)}tui-wrapper[data-appearance=input-file][data-mode=onDark][data-state=pressed]{background:var(--tui-clear-inverse-active)}tui-wrapper[data-appearance=input-file][data-mode=onLight],tui-wrapper[data-appearance=input-file][data-mode=onLight]:after{color:var(--tui-text-01)}tui-wrapper[data-appearance=input-file][data-mode=onLight][data-state=hovered]{background:var(--tui-clear-hover)}tui-wrapper[data-appearance=input-file][data-mode=onLight][data-state=hovered]:after,tui-wrapper[data-appearance=input-file][data-mode=onLight][data-state=pressed]:after{color:var(--tui-text-03)}tui-wrapper[data-appearance=input-file][data-mode=onLight][data-state=pressed]{background:var(--tui-clear-active)}.t-native{position:absolute;top:0;left:0;width:100%;height:100%;opacity:0;cursor:pointer}.t-native::-webkit-file-upload-button{display:none}.t-inline{display:inline}"]
|
|
230
|
+
}),
|
|
231
|
+
__param(0, Optional()),
|
|
232
|
+
__param(0, Self()),
|
|
233
|
+
__param(0, Inject(NgControl)),
|
|
234
|
+
__param(1, Inject(ChangeDetectorRef)),
|
|
235
|
+
__param(2, Inject(TUI_IS_MOBILE)),
|
|
236
|
+
__param(3, Inject(TUI_INPUT_FILE_TEXTS)),
|
|
237
|
+
__param(4, Inject(TUI_DIGITAL_INFORMATION_UNITS))
|
|
238
|
+
], TuiInputFilesComponent);
|
|
239
|
+
return TuiInputFilesComponent;
|
|
240
|
+
}(AbstractTuiNullableControl));
|
|
241
|
+
|
|
242
|
+
var TuiInputFilesModule = /** @class */ (function () {
|
|
243
|
+
function TuiInputFilesModule() {
|
|
244
|
+
}
|
|
245
|
+
TuiInputFilesModule = __decorate([
|
|
246
|
+
NgModule({
|
|
247
|
+
imports: [
|
|
248
|
+
CommonModule,
|
|
249
|
+
PolymorpheusModule,
|
|
250
|
+
TuiLetModule,
|
|
251
|
+
TuiFocusedModule,
|
|
252
|
+
TuiFocusVisibleModule,
|
|
253
|
+
TuiPressedModule,
|
|
254
|
+
TuiHoveredModule,
|
|
255
|
+
TuiFocusableModule,
|
|
256
|
+
TuiDroppableModule,
|
|
257
|
+
TuiWrapperModule,
|
|
258
|
+
TuiSvgModule,
|
|
259
|
+
TuiLinkModule,
|
|
260
|
+
TuiLoaderModule,
|
|
261
|
+
TuiButtonModule,
|
|
262
|
+
TuiGroupModule,
|
|
263
|
+
],
|
|
264
|
+
declarations: [TuiInputFilesComponent],
|
|
265
|
+
exports: [TuiInputFilesComponent],
|
|
266
|
+
})
|
|
267
|
+
], TuiInputFilesModule);
|
|
268
|
+
return TuiInputFilesModule;
|
|
269
|
+
}());
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Generated bundle index. Do not edit.
|
|
273
|
+
*/
|
|
274
|
+
|
|
275
|
+
export { TuiInputFilesComponent, TuiInputFilesModule };
|
|
276
|
+
//# sourceMappingURL=taiga-ui-kit-components-input-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"taiga-ui-kit-components-input-files.js","sources":["ng://@taiga-ui/kit/components/input-files/input-files.component.ts","ng://@taiga-ui/kit/components/input-files/input-files.module.ts","ng://@taiga-ui/kit/components/input-files/taiga-ui-kit-components-input-files.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n EventEmitter,\n forwardRef,\n Inject,\n Input,\n Optional,\n Output,\n Self,\n ViewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport {NgControl} from '@angular/forms';\nimport {\n AbstractTuiNullableControl,\n EMPTY_ARRAY,\n isNativeFocused,\n TUI_FOCUSABLE_ITEM_ACCESSOR,\n TUI_IS_MOBILE,\n tuiDefaultProp,\n TuiFocusableElementAccessor,\n TuiNativeFocusableElement,\n tuiPure,\n} from '@taiga-ui/cdk';\nimport {MODE_PROVIDER, TuiSizeL} from '@taiga-ui/core';\nimport {TuiFileLike} from '@taiga-ui/kit/interfaces';\nimport {TUI_DIGITAL_INFORMATION_UNITS, TUI_INPUT_FILE_TEXTS} from '@taiga-ui/kit/tokens';\nimport {formatSize, getAcceptArray} from '@taiga-ui/kit/utils/files';\nimport {PolymorpheusContent} from '@tinkoff/ng-polymorpheus';\nimport {Observable, of} from 'rxjs';\nimport {map} from 'rxjs/operators';\n\nconst DEFAULT_MAX_SIZE = 30 * 1000 * 1000; // 30 MB\n\n// @dynamic\n@Component({\n selector: 'tui-input-files',\n templateUrl: './input-files.template.html',\n styleUrls: ['./input-files.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n providers: [\n MODE_PROVIDER,\n {\n provide: TUI_FOCUSABLE_ITEM_ACCESSOR,\n useExisting: forwardRef(() => TuiInputFilesComponent),\n },\n ],\n})\nexport class TuiInputFilesComponent\n extends AbstractTuiNullableControl<TuiFileLike | ReadonlyArray<TuiFileLike>>\n implements TuiFocusableElementAccessor\n{\n @ViewChild('input')\n private readonly input?: ElementRef<HTMLInputElement>;\n\n private dataTransfer: DataTransfer | null = null;\n\n @Input()\n @tuiDefaultProp()\n link: PolymorpheusContent = '';\n\n @Input()\n @tuiDefaultProp()\n label: PolymorpheusContent = '';\n\n @Input()\n @tuiDefaultProp()\n accept = '';\n\n @Input()\n @tuiDefaultProp()\n multiple = false;\n\n @Input()\n @tuiDefaultProp()\n size: TuiSizeL = 'm';\n\n @Input()\n @tuiDefaultProp()\n maxFileSize = DEFAULT_MAX_SIZE;\n\n @Output()\n reject = new EventEmitter<ReadonlyArray<TuiFileLike> | TuiFileLike>();\n\n constructor(\n @Optional()\n @Self()\n @Inject(NgControl)\n control: NgControl | null,\n @Inject(ChangeDetectorRef)\n changeDetectorRef: ChangeDetectorRef,\n @Inject(TUI_IS_MOBILE)\n readonly isMobile: boolean,\n @Inject(TUI_INPUT_FILE_TEXTS)\n readonly inputFileTexts$: Observable<\n Record<\n | 'defaultLabelSingle'\n | 'defaultLabelMultiple'\n | 'defaultLinkSingle'\n | 'defaultLinkMultiple'\n | 'maxSizeRejectionReason'\n | 'formatRejectionReason'\n | 'drop'\n | 'dropMultiple',\n string\n >\n >,\n @Inject(TUI_DIGITAL_INFORMATION_UNITS)\n readonly units$: Observable<[string, string, string]>,\n ) {\n super(control, changeDetectorRef);\n }\n\n get nativeFocusableElement(): TuiNativeFocusableElement | null {\n return this.input?.nativeElement || null;\n }\n\n get focused(): boolean {\n return isNativeFocused(this.nativeFocusableElement);\n }\n\n get computedLink$(): Observable<PolymorpheusContent> {\n return this.computeLink$(this.fileDragged, this.multiple, this.link);\n }\n\n get computedLabel$(): Observable<PolymorpheusContent> {\n return this.computeLabel$(\n this.isMobile,\n this.fileDragged,\n this.multiple,\n this.label,\n );\n }\n\n get fileDragged(): boolean {\n return !!this.dataTransfer?.types.includes('Files');\n }\n\n get arrayValue(): ReadonlyArray<TuiFileLike> {\n return this.getValueArray(this.value);\n }\n\n onHovered(hovered: boolean) {\n this.updateHovered(hovered);\n }\n\n onFocused(focused: boolean) {\n this.updateFocused(focused);\n }\n\n onPressed(pressed: boolean) {\n this.updatePressed(pressed);\n }\n\n onFilesSelected(\n input: HTMLInputElement,\n texts: Record<'maxSizeRejectionReason' | 'formatRejectionReason', string>,\n units: [string, string, string],\n ) {\n this.processSelectedFiles(input.files, texts, units);\n input.value = '';\n }\n\n onDropped(\n event: DataTransfer,\n texts: Record<'maxSizeRejectionReason' | 'formatRejectionReason', string>,\n units: [string, string, string],\n ) {\n this.processSelectedFiles(event.files, texts, units);\n }\n\n onDragOver(dataTransfer: DataTransfer | null) {\n this.dataTransfer = dataTransfer;\n }\n\n removeFile(removedFile: TuiFileLike) {\n this.updateValue(\n this.multiple ? this.arrayValue.filter(file => file !== removedFile) : null,\n );\n }\n\n @tuiPure\n private computeLink$(\n fileDragged: boolean,\n multiple: boolean,\n link: PolymorpheusContent,\n ): Observable<PolymorpheusContent> {\n return fileDragged\n ? of('')\n : this.inputFileTexts$.pipe(\n map(texts =>\n multiple && link === ''\n ? texts.defaultLinkMultiple\n : link || texts.defaultLinkSingle,\n ),\n );\n }\n\n @tuiPure\n private computeLabel$(\n isMobile: boolean,\n fileDragged: boolean,\n multiple: boolean,\n label: PolymorpheusContent,\n ): Observable<PolymorpheusContent> {\n if (isMobile) {\n return of('');\n }\n\n if (fileDragged) {\n return this.inputFileTexts$.pipe(\n map(texts => (multiple ? texts.dropMultiple : texts.drop)),\n );\n }\n\n return this.inputFileTexts$.pipe(\n map(texts =>\n multiple && label === ''\n ? texts.defaultLabelMultiple\n : label || texts.defaultLabelSingle,\n ),\n );\n }\n\n @tuiPure\n private getValueArray(\n value: TuiFileLike | ReadonlyArray<TuiFileLike> | null,\n ): ReadonlyArray<TuiFileLike> {\n if (!value) {\n return EMPTY_ARRAY;\n }\n\n return Array.isArray(value) ? value : [value];\n }\n\n private processSelectedFiles(\n files: FileList | null,\n texts: Record<'maxSizeRejectionReason' | 'formatRejectionReason', string>,\n units: [string, string, string],\n ) {\n // IE11 after selecting a file through the open dialog generates a second event passing an empty FileList.\n if (!files?.length) {\n return;\n }\n\n const newFiles = this.multiple ? Array.from(files) : [files[0]];\n const tooBigFiles = newFiles.filter(file => file.size > this.maxFileSize);\n const wrongFormatFiles = newFiles.filter(\n file => !this.isFormatAcceptable(file) && !tooBigFiles.includes(file),\n );\n const acceptedFiles = newFiles.filter(\n file => !tooBigFiles.includes(file) && !wrongFormatFiles.includes(file),\n );\n\n if (tooBigFiles.length || wrongFormatFiles.length) {\n this.rejectFiles([\n ...tooBigFiles.map(file => ({\n name: file.name,\n type: file.type,\n size: file.size,\n content:\n texts.maxSizeRejectionReason +\n formatSize(units, this.maxFileSize),\n })),\n ...wrongFormatFiles.map(file => ({\n name: file.name,\n type: file.type,\n size: file.size,\n content: texts.formatRejectionReason,\n })),\n ]);\n }\n\n this.updateValue(\n this.multiple\n ? [...this.arrayValue, ...acceptedFiles]\n : acceptedFiles[0] || null,\n );\n }\n\n private isFormatAcceptable(file: File): boolean {\n if (!this.accept) {\n return true;\n }\n\n const extension = `.${(file.name.split('.').pop() || '').toLowerCase()}`;\n\n return getAcceptArray(this.accept).some(\n format =>\n format === extension ||\n format === file.type ||\n (format.split('/')[1] === '*' &&\n file.type.split('/')[0] === format.split('/')[0]),\n );\n }\n\n private rejectFiles(rejectedFiles: ReadonlyArray<TuiFileLike>) {\n this.reject.emit(this.multiple ? rejectedFiles : rejectedFiles[0]);\n }\n}\n","import {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\nimport {\n TuiDroppableModule,\n TuiFocusableModule,\n TuiFocusedModule,\n TuiFocusVisibleModule,\n TuiHoveredModule,\n TuiLetModule,\n TuiPressedModule,\n} from '@taiga-ui/cdk';\nimport {\n TuiButtonModule,\n TuiGroupModule,\n TuiLinkModule,\n TuiLoaderModule,\n TuiSvgModule,\n TuiWrapperModule,\n} from '@taiga-ui/core';\nimport {PolymorpheusModule} from '@tinkoff/ng-polymorpheus';\n\nimport {TuiInputFilesComponent} from './input-files.component';\n\n@NgModule({\n imports: [\n CommonModule,\n PolymorpheusModule,\n TuiLetModule,\n TuiFocusedModule,\n TuiFocusVisibleModule,\n TuiPressedModule,\n TuiHoveredModule,\n TuiFocusableModule,\n TuiDroppableModule,\n TuiWrapperModule,\n TuiSvgModule,\n TuiLinkModule,\n TuiLoaderModule,\n TuiButtonModule,\n TuiGroupModule,\n ],\n declarations: [TuiInputFilesComponent],\n exports: [TuiInputFilesComponent],\n})\nexport class TuiInputFilesModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;AAmCA,IAAM,gBAAgB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAE1C;;IAgBY,0CAAoE;IAmC5E,gCAII,OAAyB,EAEzB,iBAAoC,EAE3B,QAAiB,EAEjB,eAYR,EAEQ,MAA4C;QAxBzD,YA0BI,kBAAM,OAAO,EAAE,iBAAiB,CAAC,SACpC;QAnBY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iBAAiB;YAC3B,+uDAA0C;YAE1C,eAAe,EAAE,uBAAuB,CAAC,MAAM;YAC/C,aAAa,EAAE,iBAAiB,CAAC,IAAI;YACrC,SAAS,EAAE;gBACP,aAAa;gBACb;oBACI,OAAO,EAAE,2BAA2B;oBACpC,WAAW,EAAE,UAAU,CAAC,cAAM,OAAA,wBAAsB,GAAA,CAAC;iBACxD;aACJ;;SACJ,CAAC;QAsCO,WAAA,QAAQ,EAAE,CAAA;QACV,WAAA,IAAI,EAAE,CAAA;QACN,WAAA,MAAM,CAAC,SAAS,CAAC,CAAA;QAEjB,WAAA,MAAM,CAAC,iBAAiB,CAAC,CAAA;QAEzB,WAAA,MAAM,CAAC,aAAa,CAAC,CAAA;QAErB,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;QAc5B,WAAA,MAAM,CAAC,6BAA6B,CAAC,CAAA;OA3DjC,sBAAsB,CA2PlC;IAAD,6BAAC;CAAA,CA1PW,0BAA0B;;;ICTtC;KAAmC;IAAtB,mBAAmB;QArB/B,QAAQ,CAAC;YACN,OAAO,EAAE;gBACL,YAAY;gBACZ,kBAAkB;gBAClB,YAAY;gBACZ,gBAAgB;gBAChB,qBAAqB;gBACrB,gBAAgB;gBAChB,gBAAgB;gBAChB,kBAAkB;gBAClB,kBAAkB;gBAClB,gBAAgB;gBAChB,YAAY;gBACZ,aAAa;gBACb,eAAe;gBACf,eAAe;gBACf,cAAc;aACjB;YACD,YAAY,EAAE,CAAC,sBAAsB,CAAC;YACtC,OAAO,EAAE,CAAC,sBAAsB,CAAC;SACpC,CAAC;OACW,mBAAmB,CAAG;IAAD,0BAAC;CAAnC;;AC5CA;;;;;;"}
|
|
@@ -2,7 +2,7 @@ import { __extends, __decorate, __param } from 'tslib';
|
|
|
2
2
|
import { Optional, Self, Inject, ChangeDetectorRef, ViewChild, Input, HostListener, Component, ChangeDetectionStrategy, forwardRef, Directive, NgModule } from '@angular/core';
|
|
3
3
|
import { NgControl } from '@angular/forms';
|
|
4
4
|
import { tuiDefaultProp, TUI_FOCUSABLE_ITEM_ACCESSOR, AbstractTuiControl, AbstractTuiNullableControl, TuiMapperPipeModule } from '@taiga-ui/cdk';
|
|
5
|
-
import { tuiCreateNumberMask, tuiCreateAutoCorrectedNumberPipe, getFractionPartPadded, formatNumber, maskedMoneyValueIsEmpty, maskedNumberStringToNumber, TUI_DECIMAL_SYMBOLS, TUI_NUMBER_FORMAT, TuiPrimitiveTextfieldComponent, TUI_TEXTFIELD_HOST, TuiAbstractTextfieldHost, TuiPrimitiveTextfieldModule, TuiTextfieldControllerModule, TuiTextfieldComponent } from '@taiga-ui/core';
|
|
5
|
+
import { tuiCreateNumberMask, tuiEnableAutoCorrectDecimalSymbol, tuiCreateAutoCorrectedNumberPipe, getFractionPartPadded, formatNumber, maskedMoneyValueIsEmpty, maskedNumberStringToNumber, TUI_DECIMAL_SYMBOLS, TUI_NUMBER_FORMAT, TuiPrimitiveTextfieldComponent, TUI_TEXTFIELD_HOST, TuiAbstractTextfieldHost, TuiPrimitiveTextfieldModule, TuiTextfieldControllerModule, TuiTextfieldComponent } from '@taiga-ui/core';
|
|
6
6
|
import { TuiValueAccessorModule } from '@taiga-ui/kit/directives';
|
|
7
7
|
import { TextMaskModule } from 'angular2-text-mask';
|
|
8
8
|
|
|
@@ -19,19 +19,21 @@ var TuiInputNumberComponent = /** @class */ (function (_super) {
|
|
|
19
19
|
_this.precision = 2;
|
|
20
20
|
_this.prefix = '';
|
|
21
21
|
_this.postfix = '';
|
|
22
|
-
_this.mask = function (allowNegative, decimal, decimalLimit, nativeFocusableElement) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
22
|
+
_this.mask = function (allowNegative, decimal, decimalLimit, nativeFocusableElement) {
|
|
23
|
+
return ({
|
|
24
|
+
mask: tuiCreateNumberMask({
|
|
25
|
+
allowNegative: allowNegative,
|
|
26
|
+
decimalLimit: decimalLimit,
|
|
27
|
+
allowDecimal: decimal !== 'never',
|
|
28
|
+
requireDecimal: decimal === 'always',
|
|
29
|
+
decimalSymbol: _this.numberFormat.decimalSeparator,
|
|
30
|
+
thousandSymbol: _this.numberFormat.thousandSeparator,
|
|
31
|
+
autoCorrectDecimalSymbol: tuiEnableAutoCorrectDecimalSymbol(_this.numberFormat),
|
|
32
|
+
}),
|
|
33
|
+
pipe: tuiCreateAutoCorrectedNumberPipe(decimal === 'always' ? decimalLimit : 0, _this.numberFormat.decimalSeparator, _this.numberFormat.thousandSeparator, nativeFocusableElement, allowNegative),
|
|
34
|
+
guide: false,
|
|
35
|
+
});
|
|
36
|
+
};
|
|
35
37
|
return _this;
|
|
36
38
|
}
|
|
37
39
|
TuiInputNumberComponent_1 = TuiInputNumberComponent;
|
|
@@ -132,7 +134,7 @@ var TuiInputNumberComponent = /** @class */ (function (_super) {
|
|
|
132
134
|
}
|
|
133
135
|
};
|
|
134
136
|
TuiInputNumberComponent.prototype.onKeyDown = function (event) {
|
|
135
|
-
if (TUI_DECIMAL_SYMBOLS.
|
|
137
|
+
if (!TUI_DECIMAL_SYMBOLS.includes(event.key)) {
|
|
136
138
|
return;
|
|
137
139
|
}
|
|
138
140
|
if (this.decimal === 'never') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-kit-components-input-number.js","sources":["ng://@taiga-ui/kit/components/input-number/input-number.component.ts","ng://@taiga-ui/kit/components/input-number/input-number.directive.ts","ng://@taiga-ui/kit/components/input-number/input-number.module.ts","ng://@taiga-ui/kit/components/input-number/taiga-ui-kit-components-input-number.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n forwardRef,\n HostListener,\n Inject,\n Input,\n Optional,\n Self,\n ViewChild,\n} from '@angular/core';\nimport {NgControl} from '@angular/forms';\nimport {\n AbstractTuiControl,\n AbstractTuiNullableControl,\n TUI_FOCUSABLE_ITEM_ACCESSOR,\n tuiDefaultProp,\n TuiFocusableElementAccessor,\n TuiInputModeT,\n TuiMapper,\n} from '@taiga-ui/cdk';\nimport {\n formatNumber,\n getFractionPartPadded,\n maskedMoneyValueIsEmpty,\n maskedNumberStringToNumber,\n NumberFormatSettings,\n TUI_DECIMAL_SYMBOLS,\n TUI_NUMBER_FORMAT,\n tuiCreateAutoCorrectedNumberPipe,\n tuiCreateNumberMask,\n TuiDecimalT,\n TuiPrimitiveTextfieldComponent,\n TuiTextMaskOptions,\n} from '@taiga-ui/core';\n\nconst DEFAULT_MAX_LENGTH = 18;\n\n// @dynamic\n@Component({\n selector: 'tui-input-number',\n templateUrl: './input-number.template.html',\n styleUrls: ['./input-number.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: TUI_FOCUSABLE_ITEM_ACCESSOR,\n useExisting: forwardRef(() => TuiInputNumberComponent),\n },\n {\n provide: AbstractTuiControl,\n useExisting: forwardRef(() => TuiInputNumberComponent),\n },\n ],\n})\nexport class TuiInputNumberComponent\n extends AbstractTuiNullableControl<number>\n implements TuiFocusableElementAccessor\n{\n @ViewChild(TuiPrimitiveTextfieldComponent)\n private readonly primitiveTextfield?: TuiPrimitiveTextfieldComponent;\n\n @Input()\n @tuiDefaultProp()\n min = -Infinity;\n\n @Input()\n @tuiDefaultProp()\n max = Infinity;\n\n @Input()\n @tuiDefaultProp()\n decimal: TuiDecimalT = 'not-zero';\n\n @Input()\n @tuiDefaultProp()\n precision = 2;\n\n @Input()\n @tuiDefaultProp()\n prefix = '';\n\n @Input()\n @tuiDefaultProp()\n postfix = '';\n\n constructor(\n @Optional()\n @Self()\n @Inject(NgControl)\n control: NgControl | null,\n @Inject(ChangeDetectorRef)\n changeDetectorRef: ChangeDetectorRef,\n @Inject(TUI_NUMBER_FORMAT)\n private readonly numberFormat: NumberFormatSettings,\n ) {\n super(control, changeDetectorRef);\n }\n\n get nativeFocusableElement(): HTMLInputElement | null {\n return !this.primitiveTextfield || this.computedDisabled\n ? null\n : this.primitiveTextfield.nativeFocusableElement;\n }\n\n get focused(): boolean {\n return !!this.primitiveTextfield && this.primitiveTextfield.focused;\n }\n\n get isNegativeAllowed(): boolean {\n return this.min < 0;\n }\n\n get inputMode(): TuiInputModeT {\n return this.decimal === 'never' ? 'numeric' : 'decimal';\n }\n\n get calculatedMaxLength(): number {\n const decimalPart =\n this.decimal !== 'never' &&\n this.nativeValue.includes(this.numberFormat.decimalSeparator);\n const precision = decimalPart ? this.precision + 1 : 0;\n const takeThousand = this.numberFormat.thousandSeparator.repeat(5).length;\n\n return DEFAULT_MAX_LENGTH + precision + takeThousand;\n }\n\n get formattedValue(): string {\n const value = this.value || 0;\n const absValue = Math.abs(value);\n const hasFraction = absValue % 1 > 0;\n let limit = this.decimal === 'always' || hasFraction ? this.precision : 0;\n\n const fraction = hasFraction ? getFractionPartPadded(value, this.precision) : '';\n\n if (this.focused && this.decimal !== 'always') {\n limit = fraction.length;\n }\n\n return formatNumber(\n value,\n limit,\n this.numberFormat.decimalSeparator,\n this.numberFormat.thousandSeparator,\n this.numberFormat.zeroPadding,\n );\n }\n\n get computedValue(): string {\n if (this.focused) {\n return this.nativeValue;\n }\n\n return this.value === null ? '' : this.formattedValue;\n }\n\n @HostListener('keydown.0', ['$event'])\n onZero(event: KeyboardEvent) {\n const decimal =\n this.nativeValue.split(this.numberFormat.decimalSeparator)[1] || '';\n const {nativeFocusableElement} = this;\n\n if (\n decimal.length < this.precision ||\n !nativeFocusableElement ||\n !nativeFocusableElement.selectionStart ||\n this.nativeValue[nativeFocusableElement.selectionStart] !== '0'\n ) {\n return;\n }\n\n event.preventDefault();\n nativeFocusableElement.selectionStart++;\n }\n\n mask: TuiMapper<boolean, TuiTextMaskOptions> = (\n allowNegative: boolean,\n decimal: TuiDecimalT,\n decimalLimit: number,\n nativeFocusableElement: HTMLInputElement | null,\n ) => ({\n mask: tuiCreateNumberMask({\n allowNegative,\n decimalLimit,\n allowDecimal: decimal !== 'never',\n requireDecimal: decimal === 'always',\n autoCorrectDecimalSymbol: false,\n decimalSymbol: this.numberFormat.decimalSeparator,\n thousandSymbol: this.numberFormat.thousandSeparator,\n }),\n pipe: tuiCreateAutoCorrectedNumberPipe(\n decimal === 'always' ? decimalLimit : 0,\n this.numberFormat.decimalSeparator,\n this.numberFormat.thousandSeparator,\n nativeFocusableElement || undefined,\n allowNegative,\n ),\n guide: false,\n });\n\n onValueChange(value: string) {\n if (maskedMoneyValueIsEmpty(value)) {\n this.updateValue(null);\n\n return;\n }\n\n if (this.isNativeValueNotFinished) {\n return;\n }\n\n const capped = this.absoluteCapInputValue(value);\n\n if (capped === null || isNaN(capped)) {\n return;\n }\n\n this.updateValue(capped);\n\n if (\n capped !==\n maskedNumberStringToNumber(\n value,\n this.numberFormat.decimalSeparator,\n this.numberFormat.thousandSeparator,\n )\n ) {\n this.nativeValue = this.formattedValue;\n }\n }\n\n onKeyDown(event: KeyboardEvent) {\n if (TUI_DECIMAL_SYMBOLS.indexOf(event.key) === -1) {\n return;\n }\n\n if (this.decimal === 'never') {\n event.preventDefault();\n\n return;\n }\n\n if (this.nativeValue.includes(this.numberFormat.decimalSeparator)) {\n event.preventDefault();\n this.setCaretAfterComma();\n }\n }\n\n onFocused(focused: boolean) {\n this.updateFocused(focused);\n\n if (focused) {\n return;\n }\n\n const nativeNumberValue = this.nativeNumberValue;\n\n if (isNaN(nativeNumberValue)) {\n this.clear();\n\n return;\n }\n\n const clamped = Math.min(this.max, Math.max(this.min, nativeNumberValue));\n\n this.updateValue(clamped);\n this.nativeValue = this.formattedValue;\n }\n\n onHovered(hovered: boolean) {\n this.updateHovered(hovered);\n }\n\n onPressed(pressed: boolean) {\n this.updatePressed(pressed);\n }\n\n private get isNativeValueNotFinished(): boolean {\n const nativeNumberValue = this.nativeNumberValue;\n\n return nativeNumberValue < 0\n ? nativeNumberValue > this.max\n : nativeNumberValue < this.min;\n }\n\n private get nativeValue(): string {\n return this.nativeFocusableElement ? this.nativeFocusableElement.value : '';\n }\n\n private get nativeNumberValue(): number {\n return maskedNumberStringToNumber(\n this.nativeValue,\n this.numberFormat.decimalSeparator,\n this.numberFormat.thousandSeparator,\n );\n }\n\n private set nativeValue(value: string) {\n if (!this.primitiveTextfield || !this.nativeFocusableElement) {\n return;\n }\n\n this.primitiveTextfield.value = value;\n this.nativeFocusableElement.value = value;\n }\n\n private clear() {\n this.nativeValue = '';\n this.updateValue(null);\n }\n\n private absoluteCapInputValue(inputValue: string): number | null {\n const value = maskedNumberStringToNumber(\n inputValue,\n this.numberFormat.decimalSeparator,\n this.numberFormat.thousandSeparator,\n );\n const capped =\n value < 0\n ? Math.max(Math.max(this.min, Number.MIN_SAFE_INTEGER), value)\n : Math.min(value, Math.min(this.max, Number.MAX_SAFE_INTEGER));\n const ineligibleValue = isNaN(capped) || capped < this.min || capped > this.max;\n\n return ineligibleValue ? null : capped;\n }\n\n private setCaretAfterComma() {\n if (!this.nativeFocusableElement) {\n return;\n }\n\n const afterCommaPosition = this.nativeValue.length - this.precision;\n\n this.nativeFocusableElement.setSelectionRange(\n afterCommaPosition,\n afterCommaPosition,\n );\n }\n}\n","import {Directive, DoCheck, forwardRef} from '@angular/core';\nimport {TUI_TEXTFIELD_HOST, TuiAbstractTextfieldHost} from '@taiga-ui/core';\n\nimport {TuiInputNumberComponent} from './input-number.component';\n\n@Directive({\n selector: 'tui-input-number',\n providers: [\n {\n provide: TUI_TEXTFIELD_HOST,\n useExisting: forwardRef(() => TuiInputNumberDirective),\n },\n ],\n})\nexport class TuiInputNumberDirective\n extends TuiAbstractTextfieldHost<TuiInputNumberComponent>\n implements DoCheck\n{\n input?: HTMLInputElement;\n\n get value(): string {\n return this.host.computedValue;\n }\n\n onValueChange(value: string) {\n this.host.onValueChange(value);\n }\n\n process(input: HTMLInputElement) {\n this.input = input;\n }\n\n ngDoCheck() {\n if (!this.input) {\n return;\n }\n\n this.input.maxLength = this.host.calculatedMaxLength;\n this.input.inputMode = 'decimal';\n }\n}\n","import {NgModule} from '@angular/core';\nimport {TuiMapperPipeModule} from '@taiga-ui/cdk';\nimport {\n TuiPrimitiveTextfieldModule,\n TuiTextfieldComponent,\n TuiTextfieldControllerModule,\n} from '@taiga-ui/core';\nimport {TuiValueAccessorModule} from '@taiga-ui/kit/directives';\nimport {TextMaskModule} from 'angular2-text-mask';\n\nimport {TuiInputNumberComponent} from './input-number.component';\nimport {TuiInputNumberDirective} from './input-number.directive';\n\n@NgModule({\n imports: [\n TextMaskModule,\n TuiMapperPipeModule,\n TuiPrimitiveTextfieldModule,\n TuiTextfieldControllerModule,\n TuiValueAccessorModule,\n ],\n declarations: [TuiInputNumberComponent, TuiInputNumberDirective],\n exports: [TuiInputNumberComponent, TuiInputNumberDirective, TuiTextfieldComponent],\n})\nexport class TuiInputNumberModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAqCA,IAAM,kBAAkB,GAAG,EAAE,CAAC;AAE9B;;IAkBY,2CAAkC;IA8B1C,iCAII,OAAyB,EAEzB,iBAAoC,EAEnB,YAAkC;QARvD,YAUI,kBAAM,OAAO,EAAE,iBAAiB,CAAC,SACpC;QAHoB,kBAAY,GAAZ,YAAY,CAAsB;QA9BvD,SAAG,GAAG,CAAC,QAAQ,CAAC;QAIhB,SAAG,GAAG,QAAQ,CAAC;QAIf,aAAO,GAAgB,UAAU,CAAC;QAIlC,eAAS,GAAG,CAAC,CAAC;QAId,YAAM,GAAG,EAAE,CAAC;QAIZ,aAAO,GAAG,EAAE,CAAC;QA2Fb,UAAI,GAA2C,UAC3C,aAAsB,EACtB,OAAoB,EACpB,YAAoB,EACpB,sBAA+C,IAC9C,QAAC;YACF,IAAI,EAAE,mBAAmB,CAAC;gBACtB,aAAa,eAAA;gBACb,YAAY,cAAA;gBACZ,YAAY,EAAE,OAAO,KAAK,OAAO;gBACjC,cAAc,EAAE,OAAO,KAAK,QAAQ;gBACpC,wBAAw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D;IAD7D;;KA0BC;gCA1BY,uBAAuB;IAMhC,sBAAI,0CAAK;aAAT;YACI,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC;SAClC;;;OAAA;IAED,+CAAa,GAAb,UAAc,KAAa;QACvB,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;KAClC;IAED,yCAAO,GAAP,UAAQ,KAAuB;QAC3B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;KACtB;IAED,2CAAS,GAAT;QACI,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;YACb,OAAO;SACV;QAED,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC;QACrD,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;KACpC;;IAzBQ,uBAAuB;QATnC,SAAS,CAAC;YACP,QAAQ,EAAE,kBAAkB;YAC5B,SAAS,EAAE;gBACP;oBACI,OAAO,EAAE,kBAAkB;oBAC3B,WAAW,EAAE,UAAU,CAAC,cAAM,OAAA,yBAAuB,GAAA,CAAC;iBACzD;aACJ;SACJ,CAAC;OACW,uBAAuB,CA0BnC;IAAD,8BAAC;CAAA,CAzBW,wBAAwB;;;ICSpC;KAAoC;IAAvB,oBAAoB;QAXhC,QAAQ,CAAC;YACN,OAAO,EAAE;gBACL,cAAc;gBACd,mBAAmB;gBACnB,2BAA2B;gBAC3B,4BAA4B;gBAC5B,sBAAsB;aACzB;YACD,YAAY,EAAE,CAAC,uBAAuB,EAAE,uBAAuB,CAAC;YAChE,OAAO,EAAE,CAAC,uBAAuB,EAAE,uBAAuB,EAAE,qBAAqB,CAAC;SACrF,CAAC;OACW,oBAAoB,CAAG;IAAD,2BAAC;CAApC;;ACxBA;;;;;;"}
|
|
1
|
+
{"version":3,"file":"taiga-ui-kit-components-input-number.js","sources":["ng://@taiga-ui/kit/components/input-number/input-number.component.ts","ng://@taiga-ui/kit/components/input-number/input-number.directive.ts","ng://@taiga-ui/kit/components/input-number/input-number.module.ts","ng://@taiga-ui/kit/components/input-number/taiga-ui-kit-components-input-number.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n forwardRef,\n HostListener,\n Inject,\n Input,\n Optional,\n Self,\n ViewChild,\n} from '@angular/core';\nimport {NgControl} from '@angular/forms';\nimport {\n AbstractTuiControl,\n AbstractTuiNullableControl,\n TUI_FOCUSABLE_ITEM_ACCESSOR,\n tuiDefaultProp,\n TuiFocusableElementAccessor,\n TuiInputModeT,\n TuiMapper,\n} from '@taiga-ui/cdk';\nimport {\n formatNumber,\n getFractionPartPadded,\n maskedMoneyValueIsEmpty,\n maskedNumberStringToNumber,\n NumberFormatSettings,\n TUI_DECIMAL_SYMBOLS,\n TUI_NUMBER_FORMAT,\n tuiCreateAutoCorrectedNumberPipe,\n tuiCreateNumberMask,\n TuiDecimalT,\n tuiEnableAutoCorrectDecimalSymbol,\n TuiPrimitiveTextfieldComponent,\n TuiTextMaskOptions,\n} from '@taiga-ui/core';\nimport {TextMaskConfig} from 'angular2-text-mask';\n\nconst DEFAULT_MAX_LENGTH = 18;\n\n// @dynamic\n@Component({\n selector: 'tui-input-number',\n templateUrl: './input-number.template.html',\n styleUrls: ['./input-number.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: TUI_FOCUSABLE_ITEM_ACCESSOR,\n useExisting: forwardRef(() => TuiInputNumberComponent),\n },\n {\n provide: AbstractTuiControl,\n useExisting: forwardRef(() => TuiInputNumberComponent),\n },\n ],\n})\nexport class TuiInputNumberComponent\n extends AbstractTuiNullableControl<number>\n implements TuiFocusableElementAccessor\n{\n @ViewChild(TuiPrimitiveTextfieldComponent)\n private readonly primitiveTextfield?: TuiPrimitiveTextfieldComponent;\n\n @Input()\n @tuiDefaultProp()\n min = -Infinity;\n\n @Input()\n @tuiDefaultProp()\n max = Infinity;\n\n @Input()\n @tuiDefaultProp()\n decimal: TuiDecimalT = 'not-zero';\n\n @Input()\n @tuiDefaultProp()\n precision = 2;\n\n @Input()\n @tuiDefaultProp()\n prefix = '';\n\n @Input()\n @tuiDefaultProp()\n postfix = '';\n\n constructor(\n @Optional()\n @Self()\n @Inject(NgControl)\n control: NgControl | null,\n @Inject(ChangeDetectorRef)\n changeDetectorRef: ChangeDetectorRef,\n @Inject(TUI_NUMBER_FORMAT)\n private readonly numberFormat: NumberFormatSettings,\n ) {\n super(control, changeDetectorRef);\n }\n\n get nativeFocusableElement(): HTMLInputElement | null {\n return !this.primitiveTextfield || this.computedDisabled\n ? null\n : this.primitiveTextfield.nativeFocusableElement;\n }\n\n get focused(): boolean {\n return !!this.primitiveTextfield && this.primitiveTextfield.focused;\n }\n\n get isNegativeAllowed(): boolean {\n return this.min < 0;\n }\n\n get inputMode(): TuiInputModeT {\n return this.decimal === 'never' ? 'numeric' : 'decimal';\n }\n\n get calculatedMaxLength(): number {\n const decimalPart =\n this.decimal !== 'never' &&\n this.nativeValue.includes(this.numberFormat.decimalSeparator);\n const precision = decimalPart ? this.precision + 1 : 0;\n const takeThousand = this.numberFormat.thousandSeparator.repeat(5).length;\n\n return DEFAULT_MAX_LENGTH + precision + takeThousand;\n }\n\n get formattedValue(): string {\n const value = this.value || 0;\n const absValue = Math.abs(value);\n const hasFraction = absValue % 1 > 0;\n let limit = this.decimal === 'always' || hasFraction ? this.precision : 0;\n\n const fraction = hasFraction ? getFractionPartPadded(value, this.precision) : '';\n\n if (this.focused && this.decimal !== 'always') {\n limit = fraction.length;\n }\n\n return formatNumber(\n value,\n limit,\n this.numberFormat.decimalSeparator,\n this.numberFormat.thousandSeparator,\n this.numberFormat.zeroPadding,\n );\n }\n\n get computedValue(): string {\n if (this.focused) {\n return this.nativeValue;\n }\n\n return this.value === null ? '' : this.formattedValue;\n }\n\n @HostListener('keydown.0', ['$event'])\n onZero(event: KeyboardEvent) {\n const decimal =\n this.nativeValue.split(this.numberFormat.decimalSeparator)[1] || '';\n const {nativeFocusableElement} = this;\n\n if (\n decimal.length < this.precision ||\n !nativeFocusableElement ||\n !nativeFocusableElement.selectionStart ||\n this.nativeValue[nativeFocusableElement.selectionStart] !== '0'\n ) {\n return;\n }\n\n event.preventDefault();\n nativeFocusableElement.selectionStart++;\n }\n\n mask: TuiMapper<boolean, TextMaskConfig> = (\n allowNegative: boolean,\n decimal: TuiDecimalT,\n decimalLimit: number,\n nativeFocusableElement: HTMLInputElement | null,\n ) =>\n ({\n mask: tuiCreateNumberMask({\n allowNegative,\n decimalLimit,\n allowDecimal: decimal !== 'never',\n requireDecimal: decimal === 'always',\n decimalSymbol: this.numberFormat.decimalSeparator,\n thousandSymbol: this.numberFormat.thousandSeparator,\n autoCorrectDecimalSymbol: tuiEnableAutoCorrectDecimalSymbol(\n this.numberFormat,\n ),\n }),\n pipe: tuiCreateAutoCorrectedNumberPipe(\n decimal === 'always' ? decimalLimit : 0,\n this.numberFormat.decimalSeparator,\n this.numberFormat.thousandSeparator,\n nativeFocusableElement,\n allowNegative,\n ),\n guide: false,\n } as TuiTextMaskOptions as unknown as TextMaskConfig);\n\n onValueChange(value: string) {\n if (maskedMoneyValueIsEmpty(value)) {\n this.updateValue(null);\n\n return;\n }\n\n if (this.isNativeValueNotFinished) {\n return;\n }\n\n const capped = this.absoluteCapInputValue(value);\n\n if (capped === null || isNaN(capped)) {\n return;\n }\n\n this.updateValue(capped);\n\n if (\n capped !==\n maskedNumberStringToNumber(\n value,\n this.numberFormat.decimalSeparator,\n this.numberFormat.thousandSeparator,\n )\n ) {\n this.nativeValue = this.formattedValue;\n }\n }\n\n onKeyDown(event: KeyboardEvent) {\n if (!TUI_DECIMAL_SYMBOLS.includes(event.key)) {\n return;\n }\n\n if (this.decimal === 'never') {\n event.preventDefault();\n\n return;\n }\n\n if (this.nativeValue.includes(this.numberFormat.decimalSeparator)) {\n event.preventDefault();\n this.setCaretAfterComma();\n }\n }\n\n onFocused(focused: boolean) {\n this.updateFocused(focused);\n\n if (focused) {\n return;\n }\n\n const nativeNumberValue = this.nativeNumberValue;\n\n if (isNaN(nativeNumberValue)) {\n this.clear();\n\n return;\n }\n\n const clamped = Math.min(this.max, Math.max(this.min, nativeNumberValue));\n\n this.updateValue(clamped);\n this.nativeValue = this.formattedValue;\n }\n\n onHovered(hovered: boolean) {\n this.updateHovered(hovered);\n }\n\n onPressed(pressed: boolean) {\n this.updatePressed(pressed);\n }\n\n private get isNativeValueNotFinished(): boolean {\n const nativeNumberValue = this.nativeNumberValue;\n\n return nativeNumberValue < 0\n ? nativeNumberValue > this.max\n : nativeNumberValue < this.min;\n }\n\n private get nativeValue(): string {\n return this.nativeFocusableElement ? this.nativeFocusableElement.value : '';\n }\n\n private get nativeNumberValue(): number {\n return maskedNumberStringToNumber(\n this.nativeValue,\n this.numberFormat.decimalSeparator,\n this.numberFormat.thousandSeparator,\n );\n }\n\n private set nativeValue(value: string) {\n if (!this.primitiveTextfield || !this.nativeFocusableElement) {\n return;\n }\n\n this.primitiveTextfield.value = value;\n this.nativeFocusableElement.value = value;\n }\n\n private clear() {\n this.nativeValue = '';\n this.updateValue(null);\n }\n\n private absoluteCapInputValue(inputValue: string): number | null {\n const value = maskedNumberStringToNumber(\n inputValue,\n this.numberFormat.decimalSeparator,\n this.numberFormat.thousandSeparator,\n );\n const capped =\n value < 0\n ? Math.max(Math.max(this.min, Number.MIN_SAFE_INTEGER), value)\n : Math.min(value, Math.min(this.max, Number.MAX_SAFE_INTEGER));\n const ineligibleValue = isNaN(capped) || capped < this.min || capped > this.max;\n\n return ineligibleValue ? null : capped;\n }\n\n private setCaretAfterComma() {\n if (!this.nativeFocusableElement) {\n return;\n }\n\n const afterCommaPosition = this.nativeValue.length - this.precision;\n\n this.nativeFocusableElement.setSelectionRange(\n afterCommaPosition,\n afterCommaPosition,\n );\n }\n}\n","import {Directive, DoCheck, forwardRef} from '@angular/core';\nimport {TUI_TEXTFIELD_HOST, TuiAbstractTextfieldHost} from '@taiga-ui/core';\n\nimport {TuiInputNumberComponent} from './input-number.component';\n\n@Directive({\n selector: 'tui-input-number',\n providers: [\n {\n provide: TUI_TEXTFIELD_HOST,\n useExisting: forwardRef(() => TuiInputNumberDirective),\n },\n ],\n})\nexport class TuiInputNumberDirective\n extends TuiAbstractTextfieldHost<TuiInputNumberComponent>\n implements DoCheck\n{\n input?: HTMLInputElement;\n\n get value(): string {\n return this.host.computedValue;\n }\n\n onValueChange(value: string) {\n this.host.onValueChange(value);\n }\n\n process(input: HTMLInputElement) {\n this.input = input;\n }\n\n ngDoCheck() {\n if (!this.input) {\n return;\n }\n\n this.input.maxLength = this.host.calculatedMaxLength;\n this.input.inputMode = 'decimal';\n }\n}\n","import {NgModule} from '@angular/core';\nimport {TuiMapperPipeModule} from '@taiga-ui/cdk';\nimport {\n TuiPrimitiveTextfieldModule,\n TuiTextfieldComponent,\n TuiTextfieldControllerModule,\n} from '@taiga-ui/core';\nimport {TuiValueAccessorModule} from '@taiga-ui/kit/directives';\nimport {TextMaskModule} from 'angular2-text-mask';\n\nimport {TuiInputNumberComponent} from './input-number.component';\nimport {TuiInputNumberDirective} from './input-number.directive';\n\n@NgModule({\n imports: [\n TextMaskModule,\n TuiMapperPipeModule,\n TuiPrimitiveTextfieldModule,\n TuiTextfieldControllerModule,\n TuiValueAccessorModule,\n ],\n declarations: [TuiInputNumberComponent, TuiInputNumberDirective],\n exports: [TuiInputNumberComponent, TuiInputNumberDirective, TuiTextfieldComponent],\n})\nexport class TuiInputNumberModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAuCA,IAAM,kBAAkB,GAAG,EAAE,CAAC;AAE9B;;IAkBY,2CAAkC;IA8B1C,iCAII,OAAyB,EAEzB,iBAAoC,EAEnB,YAAkC;QARvD,YAUI,kBAAM,OAAO,EAAE,iBAAiB,CAAC,SACpC;QAHoB,kBAAY,GAAZ,YAAY,CAAsB;QA9BvD,SAAG,GAAG,CAAC,QAAQ,CAAC;QAIhB,SAAG,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AC;YACN,OAAO,EAAE;gBACL,cAAc;gBACd,mBAAmB;gBACnB,2BAA2B;gBAC3B,4BAA4B;gBAC5B,sBAAsB;aACzB;YACD,YAAY,EAAE,CAAC,uBAAuB,EAAE,uBAAuB,CAAC;YAChE,OAAO,EAAE,CAAC,uBAAuB,EAAE,uBAAuB,EAAE,qBAAqB,CAAC;SACrF,CAAC;OACW,oBAAoB,CAAG;IAAD,2BAAC;CAApC;;ACxBA;;;;;;"}
|
|
@@ -5,7 +5,7 @@ import { tuiPure, TUI_FOCUSABLE_ITEM_ACCESSOR, AbstractTuiControl, TuiLetModule
|
|
|
5
5
|
import { TuiTextfieldSizeDirective, TUI_TEXTFIELD_SIZE, TuiHintControllerDirective, TUI_HINT_WATCHED_CONTROLLER, TUI_MODE, TuiPrimitiveTextfieldComponent, HINT_CONTROLLER_PROVIDER, MODE_PROVIDER, TUI_TEXTFIELD_HOST, TuiAbstractTextfieldHost, TuiSvgModule, TuiHintModule, TuiPrimitiveTextfieldModule, TuiTextfieldControllerModule, TuiTextfieldComponent } from '@taiga-ui/core';
|
|
6
6
|
import { TUI_PASSWORD_TEXTS } from '@taiga-ui/kit/tokens';
|
|
7
7
|
import { combineLatest, Observable } from 'rxjs';
|
|
8
|
-
import {
|
|
8
|
+
import { map, startWith } from 'rxjs/operators';
|
|
9
9
|
import { CommonModule } from '@angular/common';
|
|
10
10
|
import { PolymorpheusModule } from '@tinkoff/ng-polymorpheus';
|
|
11
11
|
|
|
@@ -45,7 +45,7 @@ var TuiInputPasswordComponent = /** @class */ (function (_super) {
|
|
|
45
45
|
_this.mode$ = mode$;
|
|
46
46
|
_this.isPasswordHidden = true;
|
|
47
47
|
_this.computedMode$ = combineLatest([
|
|
48
|
-
_this.mode
|
|
48
|
+
_this.mode$.pipe(map(function (val) { return (val === 'onDark' ? 'onDark' : null); })),
|
|
49
49
|
_this.hintController.change$.pipe(startWith(null), map(function () { return _this.hintController.mode; })),
|
|
50
50
|
]).pipe(map(function (_a) {
|
|
51
51
|
var _b = __read(_a, 2), mode = _b[0], controller = _b[1];
|
|
@@ -131,7 +131,7 @@ var TuiInputPasswordComponent = /** @class */ (function (_super) {
|
|
|
131
131
|
TuiInputPasswordComponent = TuiInputPasswordComponent_1 = __decorate([
|
|
132
132
|
Component({
|
|
133
133
|
selector: 'tui-input-password',
|
|
134
|
-
template: "<tui-primitive-textfield\n class=\"textfield\"\n [pseudoFocused]=\"pseudoFocused\"\n [pseudoHovered]=\"pseudoHovered\"\n [pseudoPressed]=\"pseudoPressed\"\n [invalid]=\"computedInvalid\"\n [focusable]=\"focusable\"\n [nativeId]=\"nativeId\"\n [tuiTextfieldType]=\"inputType\"\n [disabled]=\"computedDisabled\"\n [readOnly]=\"readOnly\"\n [iconContent]=\"interactive ? iconContent : null\"\n [value]=\"value\"\n (valueChange)=\"onValueChange($event)\"\n (focusedChange)=\"onFocused($event)\"\n (hoveredChange)=\"onHovered($event)\"\n (pressedChange)=\"onPressed($event)\"\n>\n <ng-content></ng-content>\n <ng-content select=\"input\" ngProjectAs=\"input\"></ng-content>\n</tui-primitive-textfield>\n\n<ng-template #iconContent=\"polymorpheus\" polymorpheus>\n <span\n *tuiLet=\"passwordTexts$ | async as texts\"\n polymorpheus-outlet\n [content]=\"icon\"\n [context]=\"context\"\n >\n <ng-template let-icon>\n <tui-svg\n automation-id=\"tui-password__icon\"\n tuiHintId=\"not_required\"\n class=\"icon\"\n [tuiHint]=\"texts[0] && texts[1] && hintContent\"\n [tuiHintDirection]=\"hintController.direction\"\n [tuiHintMode]=\"computedMode$ | async\"\n [src]=\"icon\"\n (click)=\"togglePasswordVisibility()\"\n ></tui-svg>\n </ng-template>\n\n <ng-template #hintContent=\"polymorpheus\" polymorpheus>\n {{ isPasswordHidden ? texts[0] : texts[1] }}\n </ng-template>\n </span>\n</ng-template>\n",
|
|
134
|
+
template: "<tui-primitive-textfield\n class=\"textfield\"\n [pseudoFocused]=\"pseudoFocused\"\n [pseudoHovered]=\"pseudoHovered\"\n [pseudoPressed]=\"pseudoPressed\"\n [invalid]=\"computedInvalid\"\n [focusable]=\"focusable\"\n [nativeId]=\"nativeId\"\n [tuiTextfieldType]=\"inputType\"\n [disabled]=\"computedDisabled\"\n [readOnly]=\"readOnly\"\n [iconContent]=\"interactive ? iconContent : null\"\n [value]=\"value\"\n (valueChange)=\"onValueChange($event)\"\n (focusedChange)=\"onFocused($event)\"\n (hoveredChange)=\"onHovered($event)\"\n (pressedChange)=\"onPressed($event)\"\n>\n <ng-content></ng-content>\n <ng-content select=\"input\" ngProjectAs=\"input\"></ng-content>\n</tui-primitive-textfield>\n\n<ng-template #iconContent=\"polymorpheus\" [polymorpheus]=\"type\">\n <span\n *tuiLet=\"passwordTexts$ | async as texts\"\n polymorpheus-outlet\n [content]=\"icon\"\n [context]=\"context\"\n >\n <ng-template let-icon>\n <tui-svg\n automation-id=\"tui-password__icon\"\n tuiHintId=\"not_required\"\n class=\"icon\"\n [tuiHint]=\"texts[0] && texts[1] && hintContent\"\n [tuiHintDirection]=\"hintController.direction\"\n [tuiHintMode]=\"computedMode$ | async\"\n [src]=\"icon\"\n (click)=\"togglePasswordVisibility()\"\n ></tui-svg>\n </ng-template>\n\n <ng-template #hintContent=\"polymorpheus\" polymorpheus>\n {{ isPasswordHidden ? texts[0] : texts[1] }}\n </ng-template>\n </span>\n</ng-template>\n",
|
|
135
135
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
136
136
|
providers: [
|
|
137
137
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-kit-components-input-password.js","sources":["ng://@taiga-ui/kit/components/input-password/input-password-options.ts","ng://@taiga-ui/kit/components/input-password/input-password.component.ts","ng://@taiga-ui/kit/components/input-password/input-password.directive.ts","ng://@taiga-ui/kit/components/input-password/input-password.module.ts","ng://@taiga-ui/kit/components/input-password/taiga-ui-kit-components-input-password.ts"],"sourcesContent":["import {InjectionToken, ValueProvider} from '@angular/core';\nimport {TuiContextWithImplicit} from '@taiga-ui/cdk';\nimport {TuiSizeL, TuiSizeS} from '@taiga-ui/core';\nimport {PolymorpheusContent} from '@tinkoff/ng-polymorpheus';\n\nexport interface TuiInputPasswordOptions {\n readonly icons: Readonly<{\n hide: PolymorpheusContent<TuiContextWithImplicit<TuiSizeS | TuiSizeL>>;\n show: PolymorpheusContent<TuiContextWithImplicit<TuiSizeS | TuiSizeL>>;\n }>;\n}\n\n/**\n * @deprecated: use TuiInputPasswordOptions instead\n * todo: remove in 3.0\n */\nexport type InputPasswordOptions = TuiInputPasswordOptions;\n\n// TODO: remove in ivy compilation\nexport const PASSWORD_ICON_HIDE = ({$implicit}: any) =>\n $implicit === 's' ? 'tuiIconEyeClosed' : 'tuiIconHideLarge';\nexport const PASSWORD_ICON_SHOW = ({$implicit}: any) =>\n $implicit === 's' ? 'tuiIconEyeOpen' : 'tuiIconShowLarge';\n\n/** Default values for the input password options. */\nexport const TUI_INPUT_PASSWORD_DEFAULT_OPTIONS: TuiInputPasswordOptions = {\n icons: {\n hide: PASSWORD_ICON_HIDE,\n show: PASSWORD_ICON_SHOW,\n },\n};\n\nexport const TUI_INPUT_PASSWORD_OPTIONS = new InjectionToken<TuiInputPasswordOptions>(\n 'Default parameters for input password component',\n {\n factory: () => TUI_INPUT_PASSWORD_DEFAULT_OPTIONS,\n },\n);\n\nexport const tuiInputPasswordOptionsProvider: (\n options: Partial<TuiInputPasswordOptions>,\n) => ValueProvider = (options: Partial<TuiInputPasswordOptions>) => ({\n provide: TUI_INPUT_PASSWORD_OPTIONS,\n useValue: {...TUI_INPUT_PASSWORD_DEFAULT_OPTIONS, ...options},\n});\n","import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n forwardRef,\n Inject,\n Optional,\n Self,\n ViewChild,\n} from '@angular/core';\nimport {NgControl} from '@angular/forms';\nimport {\n AbstractTuiControl,\n TUI_FOCUSABLE_ITEM_ACCESSOR,\n TuiContextWithImplicit,\n TuiFocusableElementAccessor,\n TuiNativeFocusableElement,\n tuiPure,\n} from '@taiga-ui/cdk';\nimport {\n HINT_CONTROLLER_PROVIDER,\n MODE_PROVIDER,\n TUI_HINT_WATCHED_CONTROLLER,\n TUI_MODE,\n TUI_TEXTFIELD_SIZE,\n TuiBrightness,\n TuiHintControllerDirective,\n TuiHintModeT,\n TuiPrimitiveTextfieldComponent,\n TuiSizeL,\n TuiSizeS,\n TuiTextfieldSizeDirective,\n} from '@taiga-ui/core';\nimport {TUI_PASSWORD_TEXTS} from '@taiga-ui/kit/tokens';\nimport {PolymorpheusContent} from '@tinkoff/ng-polymorpheus';\nimport {combineLatest, Observable} from 'rxjs';\nimport {map, startWith} from 'rxjs/operators';\n\nimport {\n TUI_INPUT_PASSWORD_OPTIONS,\n TuiInputPasswordOptions,\n} from './input-password-options';\n\n// @dynamic\n@Component({\n selector: 'tui-input-password',\n templateUrl: './input-password.template.html',\n styleUrls: ['./input-password.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: TUI_FOCUSABLE_ITEM_ACCESSOR,\n useExisting: forwardRef(() => TuiInputPasswordComponent),\n },\n {\n provide: AbstractTuiControl,\n useExisting: forwardRef(() => TuiInputPasswordComponent),\n },\n HINT_CONTROLLER_PROVIDER,\n MODE_PROVIDER,\n ],\n})\nexport class TuiInputPasswordComponent\n extends AbstractTuiControl<string>\n implements TuiFocusableElementAccessor\n{\n @ViewChild(TuiPrimitiveTextfieldComponent)\n private readonly textfield?: TuiPrimitiveTextfieldComponent;\n\n isPasswordHidden = true;\n\n readonly computedMode$: Observable<TuiBrightness | TuiHintModeT | null> =\n combineLatest([\n this.mode$,\n this.hintController.change$.pipe(\n startWith(null),\n map(() => this.hintController.mode),\n ),\n ]).pipe(\n map(([mode, controller]) => controller || mode),\n startWith(null),\n );\n\n constructor(\n @Optional()\n @Self()\n @Inject(NgControl)\n control: NgControl | null,\n @Inject(ChangeDetectorRef) changeDetectorRef: ChangeDetectorRef,\n @Inject(TUI_TEXTFIELD_SIZE)\n private readonly textfieldSize: TuiTextfieldSizeDirective,\n @Inject(TUI_PASSWORD_TEXTS)\n readonly passwordTexts$: Observable<[string, string]>,\n @Inject(TUI_INPUT_PASSWORD_OPTIONS)\n readonly options: TuiInputPasswordOptions,\n @Inject(TUI_HINT_WATCHED_CONTROLLER)\n readonly hintController: TuiHintControllerDirective,\n @Inject(TUI_MODE)\n private readonly mode$: Observable<TuiBrightness | null>,\n ) {\n super(control, changeDetectorRef);\n }\n\n get nativeFocusableElement(): TuiNativeFocusableElement | null {\n return this.computedDisabled || !this.textfield\n ? null\n : this.textfield.nativeFocusableElement;\n }\n\n get focused(): boolean {\n return !!this.textfield && this.textfield.focused;\n }\n\n get icon(): PolymorpheusContent<TuiContextWithImplicit<TuiSizeS | TuiSizeL>> {\n return this.isPasswordHidden ? this.options.icons.hide : this.options.icons.show;\n }\n\n get context(): TuiContextWithImplicit<TuiSizeS | TuiSizeL> {\n return this.getContext(this.textfieldSize.size);\n }\n\n get inputType(): string {\n return this.isPasswordHidden || !this.interactive ? 'password' : 'text';\n }\n\n onValueChange(textValue: string) {\n this.updateValue(textValue);\n }\n\n onFocused(focused: boolean) {\n this.updateFocused(focused);\n }\n\n onHovered(hovered: boolean) {\n this.updateHovered(hovered);\n }\n\n onPressed(pressed: boolean) {\n this.updatePressed(pressed);\n }\n\n togglePasswordVisibility() {\n this.isPasswordHidden = !this.isPasswordHidden;\n }\n\n protected getFallbackValue(): string {\n return '';\n }\n\n @tuiPure\n private getContext(\n $implicit: TuiSizeS | TuiSizeL,\n ): TuiContextWithImplicit<TuiSizeS | TuiSizeL> {\n return {$implicit};\n }\n}\n","import {Directive, forwardRef} from '@angular/core';\nimport {TUI_TEXTFIELD_HOST, TuiAbstractTextfieldHost} from '@taiga-ui/core';\n\nimport {TuiInputPasswordComponent} from './input-password.component';\n\n@Directive({\n selector: 'tui-input-password',\n providers: [\n {\n provide: TUI_TEXTFIELD_HOST,\n useExisting: forwardRef(() => TuiInputPasswordDirective),\n },\n ],\n})\nexport class TuiInputPasswordDirective extends TuiAbstractTextfieldHost<TuiInputPasswordComponent> {\n input?: HTMLInputElement;\n\n onValueChange(value: string) {\n this.host.onValueChange(value);\n }\n\n process(input: HTMLInputElement) {\n this.input = input;\n }\n\n ngDoCheck() {\n if (this.input) {\n this.input.type = this.host.isPasswordHidden ? 'password' : 'text';\n }\n }\n}\n","import {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\nimport {FormsModule} from '@angular/forms';\nimport {TuiLetModule} from '@taiga-ui/cdk';\nimport {\n TuiHintModule,\n TuiPrimitiveTextfieldModule,\n TuiSvgModule,\n TuiTextfieldComponent,\n TuiTextfieldControllerModule,\n} from '@taiga-ui/core';\nimport {PolymorpheusModule} from '@tinkoff/ng-polymorpheus';\n\nimport {TuiInputPasswordComponent} from './input-password.component';\nimport {TuiInputPasswordDirective} from './input-password.directive';\n\n@NgModule({\n imports: [\n CommonModule,\n FormsModule,\n PolymorpheusModule,\n TuiLetModule,\n TuiSvgModule,\n TuiHintModule,\n TuiPrimitiveTextfieldModule,\n TuiTextfieldControllerModule,\n ],\n declarations: [TuiInputPasswordComponent, TuiInputPasswordDirective],\n exports: [\n TuiInputPasswordComponent,\n TuiInputPasswordDirective,\n TuiTextfieldComponent,\n ],\n})\nexport class TuiInputPasswordModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;AAkBA;IACa,kBAAkB,GAAG,UAAC,EAAgB;QAAf,wBAAS;IACzC,OAAA,SAAS,KAAK,GAAG,GAAG,kBAAkB,GAAG,kBAAkB;AAA3D,EAA4D;IACnD,kBAAkB,GAAG,UAAC,EAAgB;QAAf,wBAAS;IACzC,OAAA,SAAS,KAAK,GAAG,GAAG,gBAAgB,GAAG,kBAAkB;AAAzD,EAA0D;AAE9D;IACa,kCAAkC,GAA4B;IACvE,KAAK,EAAE;QACH,IAAI,EAAE,kBAAkB;QACxB,IAAI,EAAE,kBAAkB;KAC3B;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AAP,UAAQ,KAAuB;QAC3B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;KACtB;IAED,6CAAS,GAAT;QACI,IAAI,IAAI,CAAC,KAAK,EAAE;YACZ,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,gBAAgB,GAAG,UAAU,GAAG,MAAM,CAAC;SACtE;KACJ;;IAfQ,yBAAyB;QATrC,SAAS,CAAC;YACP,QAAQ,EAAE,oBAAoB;YAC9B,SAAS,EAAE;gBACP;oBACI,OAAO,EAAE,kBAAkB;oBAC3B,WAAW,EAAE,UAAU,CAAC,cAAM,OAAA,2BAAyB,GAAA,CAAC;iBAC3D;aACJ;SACJ,CAAC;OACW,yBAAyB,CAgBrC;IAAD,gCAAC;CAAA,CAhB8C,wBAAwB;;;ICoBvE;KAAsC;IAAzB,sBAAsB;QAlBlC,QAAQ,CAAC;YACN,OAAO,EAAE;gBACL,YAAY;gBACZ,WAAW;gBACX,kBAAkB;gBAClB,YAAY;gBACZ,YAAY;gBACZ,aAAa;gBACb,2BAA2B;gBAC3B,4BAA4B;aAC/B;YACD,YAAY,EAAE,CAAC,yBAAyB,EAAE,yBAAyB,CAAC;YACpE,OAAO,EAAE;gBACL,yBAAyB;gBACzB,yBAAyB;gBACzB,qBAAqB;aACxB;SACJ,CAAC;OACW,sBAAsB,CAAG;IAAD,6BAAC;CAAtC;;AClCA;;;;;;"}
|
|
1
|
+
{"version":3,"file":"taiga-ui-kit-components-input-password.js","sources":["ng://@taiga-ui/kit/components/input-password/input-password-options.ts","ng://@taiga-ui/kit/components/input-password/input-password.component.ts","ng://@taiga-ui/kit/components/input-password/input-password.directive.ts","ng://@taiga-ui/kit/components/input-password/input-password.module.ts","ng://@taiga-ui/kit/components/input-password/taiga-ui-kit-components-input-password.ts"],"sourcesContent":["import {InjectionToken, ValueProvider} from '@angular/core';\nimport {TuiContextWithImplicit} from '@taiga-ui/cdk';\nimport {TuiSizeL, TuiSizeS} from '@taiga-ui/core';\nimport {PolymorpheusContent} from '@tinkoff/ng-polymorpheus';\n\nexport interface TuiInputPasswordOptions {\n readonly icons: Readonly<{\n hide: PolymorpheusContent<TuiContextWithImplicit<TuiSizeS | TuiSizeL>>;\n show: PolymorpheusContent<TuiContextWithImplicit<TuiSizeS | TuiSizeL>>;\n }>;\n}\n\n/**\n * @deprecated: use TuiInputPasswordOptions instead\n * todo: remove in 3.0\n */\nexport type InputPasswordOptions = TuiInputPasswordOptions;\n\n// TODO: remove in ivy compilation\nexport const PASSWORD_ICON_HIDE = ({$implicit}: any) =>\n $implicit === 's' ? 'tuiIconEyeClosed' : 'tuiIconHideLarge';\nexport const PASSWORD_ICON_SHOW = ({$implicit}: any) =>\n $implicit === 's' ? 'tuiIconEyeOpen' : 'tuiIconShowLarge';\n\n/** Default values for the input password options. */\nexport const TUI_INPUT_PASSWORD_DEFAULT_OPTIONS: TuiInputPasswordOptions = {\n icons: {\n hide: PASSWORD_ICON_HIDE,\n show: PASSWORD_ICON_SHOW,\n },\n};\n\nexport const TUI_INPUT_PASSWORD_OPTIONS = new InjectionToken<TuiInputPasswordOptions>(\n 'Default parameters for input password component',\n {\n factory: () => TUI_INPUT_PASSWORD_DEFAULT_OPTIONS,\n },\n);\n\nexport const tuiInputPasswordOptionsProvider: (\n options: Partial<TuiInputPasswordOptions>,\n) => ValueProvider = (options: Partial<TuiInputPasswordOptions>) => ({\n provide: TUI_INPUT_PASSWORD_OPTIONS,\n useValue: {...TUI_INPUT_PASSWORD_DEFAULT_OPTIONS, ...options},\n});\n","import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n forwardRef,\n Inject,\n Optional,\n Self,\n ViewChild,\n} from '@angular/core';\nimport {NgControl} from '@angular/forms';\nimport {\n AbstractTuiControl,\n TUI_FOCUSABLE_ITEM_ACCESSOR,\n TuiContextWithImplicit,\n TuiFocusableElementAccessor,\n TuiInputTypeT,\n TuiNativeFocusableElement,\n tuiPure,\n} from '@taiga-ui/cdk';\nimport {\n HINT_CONTROLLER_PROVIDER,\n MODE_PROVIDER,\n TUI_HINT_WATCHED_CONTROLLER,\n TUI_MODE,\n TUI_TEXTFIELD_SIZE,\n TuiBrightness,\n TuiHintControllerDirective,\n TuiHintModeT,\n TuiPrimitiveTextfieldComponent,\n TuiSizeL,\n TuiSizeS,\n TuiTextfieldSizeDirective,\n} from '@taiga-ui/core';\nimport {TUI_PASSWORD_TEXTS} from '@taiga-ui/kit/tokens';\nimport {PolymorpheusContent} from '@tinkoff/ng-polymorpheus';\nimport {combineLatest, Observable} from 'rxjs';\nimport {map, startWith} from 'rxjs/operators';\n\nimport {\n TUI_INPUT_PASSWORD_OPTIONS,\n TuiInputPasswordOptions,\n} from './input-password-options';\n\n// @dynamic\n@Component({\n selector: 'tui-input-password',\n templateUrl: './input-password.template.html',\n styleUrls: ['./input-password.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: TUI_FOCUSABLE_ITEM_ACCESSOR,\n useExisting: forwardRef(() => TuiInputPasswordComponent),\n },\n {\n provide: AbstractTuiControl,\n useExisting: forwardRef(() => TuiInputPasswordComponent),\n },\n HINT_CONTROLLER_PROVIDER,\n MODE_PROVIDER,\n ],\n})\nexport class TuiInputPasswordComponent\n extends AbstractTuiControl<string>\n implements TuiFocusableElementAccessor\n{\n @ViewChild(TuiPrimitiveTextfieldComponent)\n private readonly textfield?: TuiPrimitiveTextfieldComponent;\n\n isPasswordHidden = true;\n\n readonly computedMode$: Observable<TuiHintModeT | null> = combineLatest([\n this.mode$.pipe(map(val => (val === 'onDark' ? 'onDark' : null))),\n this.hintController.change$.pipe(\n startWith(null),\n map(() => this.hintController.mode),\n ),\n ]).pipe(\n map(([mode, controller]) => controller || mode),\n startWith(null),\n );\n\n readonly type!: TuiContextWithImplicit<TuiSizeS | TuiSizeL>;\n\n constructor(\n @Optional()\n @Self()\n @Inject(NgControl)\n control: NgControl | null,\n @Inject(ChangeDetectorRef) changeDetectorRef: ChangeDetectorRef,\n @Inject(TUI_TEXTFIELD_SIZE)\n private readonly textfieldSize: TuiTextfieldSizeDirective,\n @Inject(TUI_PASSWORD_TEXTS)\n readonly passwordTexts$: Observable<[string, string]>,\n @Inject(TUI_INPUT_PASSWORD_OPTIONS)\n readonly options: TuiInputPasswordOptions,\n @Inject(TUI_HINT_WATCHED_CONTROLLER)\n readonly hintController: TuiHintControllerDirective,\n @Inject(TUI_MODE)\n private readonly mode$: Observable<TuiBrightness | null>,\n ) {\n super(control, changeDetectorRef);\n }\n\n get nativeFocusableElement(): TuiNativeFocusableElement | null {\n return this.computedDisabled || !this.textfield\n ? null\n : this.textfield.nativeFocusableElement;\n }\n\n get focused(): boolean {\n return !!this.textfield && this.textfield.focused;\n }\n\n get icon(): PolymorpheusContent<TuiContextWithImplicit<TuiSizeS | TuiSizeL>> {\n return this.isPasswordHidden ? this.options.icons.hide : this.options.icons.show;\n }\n\n get context(): TuiContextWithImplicit<TuiSizeS | TuiSizeL> {\n return this.getContext(this.textfieldSize.size);\n }\n\n get inputType(): TuiInputTypeT {\n return this.isPasswordHidden || !this.interactive ? 'password' : 'text';\n }\n\n onValueChange(textValue: string) {\n this.updateValue(textValue);\n }\n\n onFocused(focused: boolean) {\n this.updateFocused(focused);\n }\n\n onHovered(hovered: boolean) {\n this.updateHovered(hovered);\n }\n\n onPressed(pressed: boolean) {\n this.updatePressed(pressed);\n }\n\n togglePasswordVisibility() {\n this.isPasswordHidden = !this.isPasswordHidden;\n }\n\n protected getFallbackValue(): string {\n return '';\n }\n\n @tuiPure\n private getContext(\n $implicit: TuiSizeS | TuiSizeL,\n ): TuiContextWithImplicit<TuiSizeS | TuiSizeL> {\n return {$implicit};\n }\n}\n","import {Directive, forwardRef} from '@angular/core';\nimport {TUI_TEXTFIELD_HOST, TuiAbstractTextfieldHost} from '@taiga-ui/core';\n\nimport {TuiInputPasswordComponent} from './input-password.component';\n\n@Directive({\n selector: 'tui-input-password',\n providers: [\n {\n provide: TUI_TEXTFIELD_HOST,\n useExisting: forwardRef(() => TuiInputPasswordDirective),\n },\n ],\n})\nexport class TuiInputPasswordDirective extends TuiAbstractTextfieldHost<TuiInputPasswordComponent> {\n input?: HTMLInputElement;\n\n onValueChange(value: string) {\n this.host.onValueChange(value);\n }\n\n process(input: HTMLInputElement) {\n this.input = input;\n }\n\n ngDoCheck() {\n if (this.input) {\n this.input.type = this.host.isPasswordHidden ? 'password' : 'text';\n }\n }\n}\n","import {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\nimport {FormsModule} from '@angular/forms';\nimport {TuiLetModule} from '@taiga-ui/cdk';\nimport {\n TuiHintModule,\n TuiPrimitiveTextfieldModule,\n TuiSvgModule,\n TuiTextfieldComponent,\n TuiTextfieldControllerModule,\n} from '@taiga-ui/core';\nimport {PolymorpheusModule} from '@tinkoff/ng-polymorpheus';\n\nimport {TuiInputPasswordComponent} from './input-password.component';\nimport {TuiInputPasswordDirective} from './input-password.directive';\n\n@NgModule({\n imports: [\n CommonModule,\n FormsModule,\n PolymorpheusModule,\n TuiLetModule,\n TuiSvgModule,\n TuiHintModule,\n TuiPrimitiveTextfieldModule,\n TuiTextfieldControllerModule,\n ],\n declarations: [TuiInputPasswordComponent, TuiInputPasswordDirective],\n exports: [\n TuiInputPasswordComponent,\n TuiInputPasswordDirective,\n TuiTextfieldComponent,\n ],\n})\nexport class TuiInputPasswordModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;AAkBA;IACa,kBAAkB,GAAG,UAAC,EAAgB;QAAf,wBAAS;IACzC,OAAA,SAAS,KAAK,GAAG,GAAG,kBAAkB,GAAG,kBAAkB;AAA3D,EAA4D;IACnD,kBAAkB,GAAG,UAAC,EAAgB;QAAf,wBAAS;IACzC,OAAA,SAAS,KAAK,GAAG,GAAG,gBAAgB,GAAG,kBAAkB;AAAzD,EAA0D;AAE9D;IACa,kCAAkC,GAA4B;IACvE,KAAK,EAAE;QACH,IAAI,EAA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B;;;IClDiB,6CAAmD;IAAlG;;KAgBC;kCAhBY,yBAAyB;IAGlC,iDAAa,GAAb,UAAc,KAAa;QACvB,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;KAClC;IAED,2CAAO,GAAP,UAAQ,KAAuB;QAC3B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;KACtB;IAED,6CAAS,GAAT;QACI,IAAI,IAAI,CAAC,KAAK,EAAE;YACZ,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,gBAAgB,GAAG,UAAU,GAAG,MAAM,CAAC;SACtE;KACJ;;IAfQ,yBAAyB;QATrC,SAAS,CAAC;YACP,QAAQ,EAAE,oBAAoB;YAC9B,SAAS,EAAE;gBACP;oBACI,OAAO,EAAE,kBAAkB;oBAC3B,WAAW,EAAE,UAAU,CAAC,cAAM,OAAA,2BAAyB,GAAA,CAAC;iBAC3D;aACJ;SACJ,CAAC;OACW,yBAAyB,CAgBrC;IAAD,gCAAC;CAAA,CAhB8C,wBAAwB;;;ICoBvE;KAAsC;IAAzB,sBAAsB;QAlBlC,QAAQ,CAAC;YACN,OAAO,EAAE;gBACL,YAAY;gBACZ,WAAW;gBACX,kBAAkB;gBAClB,YAAY;gBACZ,YAAY;gBACZ,aAAa;gBACb,2BAA2B;gBAC3B,4BAA4B;aAC/B;YACD,YAAY,EAAE,CAAC,yBAAyB,EAAE,yBAAyB,CAAC;YACpE,OAAO,EAAE;gBACL,yBAAyB;gBACzB,yBAAyB;gBACzB,qBAAqB;aACxB;SACJ,CAAC;OACW,sBAAsB,CAAG;IAAD,6BAAC;CAAtC;;AClCA;;;;;;"}
|
|
@@ -558,15 +558,16 @@ var TuiInputPhoneInternationalComponent = /** @class */ (function (_super) {
|
|
|
558
558
|
configurable: true
|
|
559
559
|
});
|
|
560
560
|
TuiInputPhoneInternationalComponent.prototype.onPaste = function (event) {
|
|
561
|
-
var
|
|
562
|
-
var
|
|
563
|
-
|
|
564
|
-
return
|
|
565
|
-
}
|
|
566
|
-
if (countryIsoCode) {
|
|
567
|
-
|
|
568
|
-
this.updateValue('+' + value.replace(TUI_NON_DIGITS_REGEXP, ''));
|
|
561
|
+
var value = extractValueFromEvent(event).replace(TUI_NON_DIGITS_REGEXP, '');
|
|
562
|
+
var countryIsoCode = this.extractCountryCode(value);
|
|
563
|
+
if (!countryIsoCode) {
|
|
564
|
+
return;
|
|
565
|
+
}
|
|
566
|
+
if (countryIsoCode === TuiCountryIsoCode$1.RU) {
|
|
567
|
+
value = value.replace(/^8/, '7');
|
|
569
568
|
}
|
|
569
|
+
this.updateCountryIsoCode(countryIsoCode);
|
|
570
|
+
this.updateValue("+" + value);
|
|
570
571
|
};
|
|
571
572
|
TuiInputPhoneInternationalComponent.prototype.getFlagPath = function (code) {
|
|
572
573
|
return "" + this.staticPath + code + ".png";
|
|
@@ -613,6 +614,17 @@ var TuiInputPhoneInternationalComponent = /** @class */ (function (_super) {
|
|
|
613
614
|
this.countryIsoCode = code;
|
|
614
615
|
this.countryIsoCodeChange.emit(code);
|
|
615
616
|
};
|
|
617
|
+
TuiInputPhoneInternationalComponent.prototype.extractCountryCode = function (value) {
|
|
618
|
+
var _this = this;
|
|
619
|
+
return this.countries.find(function (countryIsoCode) {
|
|
620
|
+
var ruCodeTest = countryIsoCode === TuiCountryIsoCode$1.RU &&
|
|
621
|
+
/^[7 | 8]/.test(value) &&
|
|
622
|
+
/^(?!880[1-9 ])/.test(value) &&
|
|
623
|
+
value.length + 1 === _this.getMaxAllowedLength(TuiCountryIsoCode$1.RU);
|
|
624
|
+
return (ruCodeTest ||
|
|
625
|
+
value.startsWith(_this.isoToCountryCode(countryIsoCode).replace('+', '')));
|
|
626
|
+
});
|
|
627
|
+
};
|
|
616
628
|
var TuiInputPhoneInternationalComponent_1;
|
|
617
629
|
TuiInputPhoneInternationalComponent.ctorParameters = function () { return [
|
|
618
630
|
{ type: NgControl, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [NgControl,] }] },
|