@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,242 @@
|
|
|
1
|
+
import { __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 { AbstractTuiNullableControl, isNativeFocused, EMPTY_ARRAY, TUI_IS_MOBILE, tuiDefaultProp, tuiPure, TUI_FOCUSABLE_ITEM_ACCESSOR, 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 TuiInputFilesComponent_1;
|
|
14
|
+
const DEFAULT_MAX_SIZE = 30 * 1000 * 1000; // 30 MB
|
|
15
|
+
// @dynamic
|
|
16
|
+
let TuiInputFilesComponent = TuiInputFilesComponent_1 = class TuiInputFilesComponent extends AbstractTuiNullableControl {
|
|
17
|
+
constructor(control, changeDetectorRef, isMobile, inputFileTexts$, units$) {
|
|
18
|
+
super(control, changeDetectorRef);
|
|
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
|
+
}
|
|
31
|
+
get nativeFocusableElement() {
|
|
32
|
+
var _a;
|
|
33
|
+
return ((_a = this.input) === null || _a === void 0 ? void 0 : _a.nativeElement) || null;
|
|
34
|
+
}
|
|
35
|
+
get focused() {
|
|
36
|
+
return isNativeFocused(this.nativeFocusableElement);
|
|
37
|
+
}
|
|
38
|
+
get computedLink$() {
|
|
39
|
+
return this.computeLink$(this.fileDragged, this.multiple, this.link);
|
|
40
|
+
}
|
|
41
|
+
get computedLabel$() {
|
|
42
|
+
return this.computeLabel$(this.isMobile, this.fileDragged, this.multiple, this.label);
|
|
43
|
+
}
|
|
44
|
+
get fileDragged() {
|
|
45
|
+
var _a;
|
|
46
|
+
return !!((_a = this.dataTransfer) === null || _a === void 0 ? void 0 : _a.types.includes('Files'));
|
|
47
|
+
}
|
|
48
|
+
get arrayValue() {
|
|
49
|
+
return this.getValueArray(this.value);
|
|
50
|
+
}
|
|
51
|
+
onHovered(hovered) {
|
|
52
|
+
this.updateHovered(hovered);
|
|
53
|
+
}
|
|
54
|
+
onFocused(focused) {
|
|
55
|
+
this.updateFocused(focused);
|
|
56
|
+
}
|
|
57
|
+
onPressed(pressed) {
|
|
58
|
+
this.updatePressed(pressed);
|
|
59
|
+
}
|
|
60
|
+
onFilesSelected(input, texts, units) {
|
|
61
|
+
this.processSelectedFiles(input.files, texts, units);
|
|
62
|
+
input.value = '';
|
|
63
|
+
}
|
|
64
|
+
onDropped(event, texts, units) {
|
|
65
|
+
this.processSelectedFiles(event.files, texts, units);
|
|
66
|
+
}
|
|
67
|
+
onDragOver(dataTransfer) {
|
|
68
|
+
this.dataTransfer = dataTransfer;
|
|
69
|
+
}
|
|
70
|
+
removeFile(removedFile) {
|
|
71
|
+
this.updateValue(this.multiple ? this.arrayValue.filter(file => file !== removedFile) : null);
|
|
72
|
+
}
|
|
73
|
+
computeLink$(fileDragged, multiple, link) {
|
|
74
|
+
return fileDragged
|
|
75
|
+
? of('')
|
|
76
|
+
: this.inputFileTexts$.pipe(map(texts => multiple && link === ''
|
|
77
|
+
? texts.defaultLinkMultiple
|
|
78
|
+
: link || texts.defaultLinkSingle));
|
|
79
|
+
}
|
|
80
|
+
computeLabel$(isMobile, fileDragged, multiple, label) {
|
|
81
|
+
if (isMobile) {
|
|
82
|
+
return of('');
|
|
83
|
+
}
|
|
84
|
+
if (fileDragged) {
|
|
85
|
+
return this.inputFileTexts$.pipe(map(texts => (multiple ? texts.dropMultiple : texts.drop)));
|
|
86
|
+
}
|
|
87
|
+
return this.inputFileTexts$.pipe(map(texts => multiple && label === ''
|
|
88
|
+
? texts.defaultLabelMultiple
|
|
89
|
+
: label || texts.defaultLabelSingle));
|
|
90
|
+
}
|
|
91
|
+
getValueArray(value) {
|
|
92
|
+
if (!value) {
|
|
93
|
+
return EMPTY_ARRAY;
|
|
94
|
+
}
|
|
95
|
+
return Array.isArray(value) ? value : [value];
|
|
96
|
+
}
|
|
97
|
+
processSelectedFiles(files, texts, units) {
|
|
98
|
+
// IE11 after selecting a file through the open dialog generates a second event passing an empty FileList.
|
|
99
|
+
if (!(files === null || files === void 0 ? void 0 : files.length)) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
const newFiles = this.multiple ? Array.from(files) : [files[0]];
|
|
103
|
+
const tooBigFiles = newFiles.filter(file => file.size > this.maxFileSize);
|
|
104
|
+
const wrongFormatFiles = newFiles.filter(file => !this.isFormatAcceptable(file) && !tooBigFiles.includes(file));
|
|
105
|
+
const acceptedFiles = newFiles.filter(file => !tooBigFiles.includes(file) && !wrongFormatFiles.includes(file));
|
|
106
|
+
if (tooBigFiles.length || wrongFormatFiles.length) {
|
|
107
|
+
this.rejectFiles([
|
|
108
|
+
...tooBigFiles.map(file => ({
|
|
109
|
+
name: file.name,
|
|
110
|
+
type: file.type,
|
|
111
|
+
size: file.size,
|
|
112
|
+
content: texts.maxSizeRejectionReason +
|
|
113
|
+
formatSize(units, this.maxFileSize),
|
|
114
|
+
})),
|
|
115
|
+
...wrongFormatFiles.map(file => ({
|
|
116
|
+
name: file.name,
|
|
117
|
+
type: file.type,
|
|
118
|
+
size: file.size,
|
|
119
|
+
content: texts.formatRejectionReason,
|
|
120
|
+
})),
|
|
121
|
+
]);
|
|
122
|
+
}
|
|
123
|
+
this.updateValue(this.multiple
|
|
124
|
+
? [...this.arrayValue, ...acceptedFiles]
|
|
125
|
+
: acceptedFiles[0] || null);
|
|
126
|
+
}
|
|
127
|
+
isFormatAcceptable(file) {
|
|
128
|
+
if (!this.accept) {
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
const extension = `.${(file.name.split('.').pop() || '').toLowerCase()}`;
|
|
132
|
+
return getAcceptArray(this.accept).some(format => format === extension ||
|
|
133
|
+
format === file.type ||
|
|
134
|
+
(format.split('/')[1] === '*' &&
|
|
135
|
+
file.type.split('/')[0] === format.split('/')[0]));
|
|
136
|
+
}
|
|
137
|
+
rejectFiles(rejectedFiles) {
|
|
138
|
+
this.reject.emit(this.multiple ? rejectedFiles : rejectedFiles[0]);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
TuiInputFilesComponent.ctorParameters = () => [
|
|
142
|
+
{ type: NgControl, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [NgControl,] }] },
|
|
143
|
+
{ type: ChangeDetectorRef, decorators: [{ type: Inject, args: [ChangeDetectorRef,] }] },
|
|
144
|
+
{ type: Boolean, decorators: [{ type: Inject, args: [TUI_IS_MOBILE,] }] },
|
|
145
|
+
{ type: Observable, decorators: [{ type: Inject, args: [TUI_INPUT_FILE_TEXTS,] }] },
|
|
146
|
+
{ type: Observable, decorators: [{ type: Inject, args: [TUI_DIGITAL_INFORMATION_UNITS,] }] }
|
|
147
|
+
];
|
|
148
|
+
__decorate([
|
|
149
|
+
ViewChild('input')
|
|
150
|
+
], TuiInputFilesComponent.prototype, "input", void 0);
|
|
151
|
+
__decorate([
|
|
152
|
+
Input(),
|
|
153
|
+
tuiDefaultProp()
|
|
154
|
+
], TuiInputFilesComponent.prototype, "link", void 0);
|
|
155
|
+
__decorate([
|
|
156
|
+
Input(),
|
|
157
|
+
tuiDefaultProp()
|
|
158
|
+
], TuiInputFilesComponent.prototype, "label", void 0);
|
|
159
|
+
__decorate([
|
|
160
|
+
Input(),
|
|
161
|
+
tuiDefaultProp()
|
|
162
|
+
], TuiInputFilesComponent.prototype, "accept", void 0);
|
|
163
|
+
__decorate([
|
|
164
|
+
Input(),
|
|
165
|
+
tuiDefaultProp()
|
|
166
|
+
], TuiInputFilesComponent.prototype, "multiple", void 0);
|
|
167
|
+
__decorate([
|
|
168
|
+
Input(),
|
|
169
|
+
tuiDefaultProp()
|
|
170
|
+
], TuiInputFilesComponent.prototype, "size", void 0);
|
|
171
|
+
__decorate([
|
|
172
|
+
Input(),
|
|
173
|
+
tuiDefaultProp()
|
|
174
|
+
], TuiInputFilesComponent.prototype, "maxFileSize", void 0);
|
|
175
|
+
__decorate([
|
|
176
|
+
Output()
|
|
177
|
+
], TuiInputFilesComponent.prototype, "reject", void 0);
|
|
178
|
+
__decorate([
|
|
179
|
+
tuiPure
|
|
180
|
+
], TuiInputFilesComponent.prototype, "computeLink$", null);
|
|
181
|
+
__decorate([
|
|
182
|
+
tuiPure
|
|
183
|
+
], TuiInputFilesComponent.prototype, "computeLabel$", null);
|
|
184
|
+
__decorate([
|
|
185
|
+
tuiPure
|
|
186
|
+
], TuiInputFilesComponent.prototype, "getValueArray", null);
|
|
187
|
+
TuiInputFilesComponent = TuiInputFilesComponent_1 = __decorate([
|
|
188
|
+
Component({
|
|
189
|
+
selector: 'tui-input-files',
|
|
190
|
+
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",
|
|
191
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
192
|
+
encapsulation: ViewEncapsulation.None,
|
|
193
|
+
providers: [
|
|
194
|
+
MODE_PROVIDER,
|
|
195
|
+
{
|
|
196
|
+
provide: TUI_FOCUSABLE_ITEM_ACCESSOR,
|
|
197
|
+
useExisting: forwardRef(() => TuiInputFilesComponent_1),
|
|
198
|
+
},
|
|
199
|
+
],
|
|
200
|
+
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}"]
|
|
201
|
+
}),
|
|
202
|
+
__param(0, Optional()),
|
|
203
|
+
__param(0, Self()),
|
|
204
|
+
__param(0, Inject(NgControl)),
|
|
205
|
+
__param(1, Inject(ChangeDetectorRef)),
|
|
206
|
+
__param(2, Inject(TUI_IS_MOBILE)),
|
|
207
|
+
__param(3, Inject(TUI_INPUT_FILE_TEXTS)),
|
|
208
|
+
__param(4, Inject(TUI_DIGITAL_INFORMATION_UNITS))
|
|
209
|
+
], TuiInputFilesComponent);
|
|
210
|
+
|
|
211
|
+
let TuiInputFilesModule = class TuiInputFilesModule {
|
|
212
|
+
};
|
|
213
|
+
TuiInputFilesModule = __decorate([
|
|
214
|
+
NgModule({
|
|
215
|
+
imports: [
|
|
216
|
+
CommonModule,
|
|
217
|
+
PolymorpheusModule,
|
|
218
|
+
TuiLetModule,
|
|
219
|
+
TuiFocusedModule,
|
|
220
|
+
TuiFocusVisibleModule,
|
|
221
|
+
TuiPressedModule,
|
|
222
|
+
TuiHoveredModule,
|
|
223
|
+
TuiFocusableModule,
|
|
224
|
+
TuiDroppableModule,
|
|
225
|
+
TuiWrapperModule,
|
|
226
|
+
TuiSvgModule,
|
|
227
|
+
TuiLinkModule,
|
|
228
|
+
TuiLoaderModule,
|
|
229
|
+
TuiButtonModule,
|
|
230
|
+
TuiGroupModule,
|
|
231
|
+
],
|
|
232
|
+
declarations: [TuiInputFilesComponent],
|
|
233
|
+
exports: [TuiInputFilesComponent],
|
|
234
|
+
})
|
|
235
|
+
], TuiInputFilesModule);
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Generated bundle index. Do not edit.
|
|
239
|
+
*/
|
|
240
|
+
|
|
241
|
+
export { TuiInputFilesComponent, TuiInputFilesModule };
|
|
242
|
+
//# 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,MAAM,gBAAgB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAE1C;IAea,sBAAsB,8BAAnC,MAAa,sBACT,SAAQ,0BAAoE;IAmC5E,YAII,OAAyB,EAEzB,iBAAoC,EAE3B,QAAiB,EAEjB,eAYR,EAEQ,MAA4C;QAErD,KAAK,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;QAlBzB,a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IAEjB,WAAA,MAAM,CAAC,iBAAiB,CAAC,CAAA;IAEzB,WAAA,MAAM,CAAC,aAAa,CAAC,CAAA;IAErB,WAAA,MAAM,CAAC,oBAAoB,CAAC,CAAA;IAc5B,WAAA,MAAM,CAAC,6BAA6B,CAAC,CAAA;GA3DjC,sBAAsB,CA2PlC;;ICnQY,mBAAmB,GAAhC,MAAa,mBAAmB;EAAG;AAAtB,mBAAmB;IArB/B,QAAQ,CAAC;QACN,OAAO,EAAE;YACL,YAAY;YACZ,kBAAkB;YAClB,YAAY;YACZ,gBAAgB;YAChB,qBAAqB;YACrB,gBAAgB;YAChB,gBAAgB;YAChB,kBAAkB;YAClB,kBAAkB;YAClB,gBAAgB;YAChB,YAAY;YACZ,aAAa;YACb,eAAe;YACf,eAAe;YACf,cAAc;SACjB;QACD,YAAY,EAAE,CAAC,sBAAsB,CAAC;QACtC,OAAO,EAAE,CAAC,sBAAsB,CAAC;KACpC,CAAC;GACW,mBAAmB,CAAG;;AC5CnC;;;;;;"}
|
|
@@ -2,7 +2,7 @@ import { __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 { AbstractTuiNullableControl, tuiDefaultProp, TUI_FOCUSABLE_ITEM_ACCESSOR, AbstractTuiControl, TuiMapperPipeModule } from '@taiga-ui/cdk';
|
|
5
|
-
import { tuiCreateNumberMask, tuiCreateAutoCorrectedNumberPipe, getFractionPartPadded, formatNumber, maskedMoneyValueIsEmpty, maskedNumberStringToNumber, TUI_DECIMAL_SYMBOLS, TUI_NUMBER_FORMAT, TuiPrimitiveTextfieldComponent, TuiAbstractTextfieldHost, TUI_TEXTFIELD_HOST, TuiPrimitiveTextfieldModule, TuiTextfieldControllerModule, TuiTextfieldComponent } from '@taiga-ui/core';
|
|
5
|
+
import { tuiCreateNumberMask, tuiEnableAutoCorrectDecimalSymbol, tuiCreateAutoCorrectedNumberPipe, getFractionPartPadded, formatNumber, maskedMoneyValueIsEmpty, maskedNumberStringToNumber, TUI_DECIMAL_SYMBOLS, TUI_NUMBER_FORMAT, TuiPrimitiveTextfieldComponent, TuiAbstractTextfieldHost, TUI_TEXTFIELD_HOST, 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
|
|
|
@@ -25,11 +25,11 @@ let TuiInputNumberComponent = TuiInputNumberComponent_1 = class TuiInputNumberCo
|
|
|
25
25
|
decimalLimit,
|
|
26
26
|
allowDecimal: decimal !== 'never',
|
|
27
27
|
requireDecimal: decimal === 'always',
|
|
28
|
-
autoCorrectDecimalSymbol: false,
|
|
29
28
|
decimalSymbol: this.numberFormat.decimalSeparator,
|
|
30
29
|
thousandSymbol: this.numberFormat.thousandSeparator,
|
|
30
|
+
autoCorrectDecimalSymbol: tuiEnableAutoCorrectDecimalSymbol(this.numberFormat),
|
|
31
31
|
}),
|
|
32
|
-
pipe: tuiCreateAutoCorrectedNumberPipe(decimal === 'always' ? decimalLimit : 0, this.numberFormat.decimalSeparator, this.numberFormat.thousandSeparator, nativeFocusableElement
|
|
32
|
+
pipe: tuiCreateAutoCorrectedNumberPipe(decimal === 'always' ? decimalLimit : 0, this.numberFormat.decimalSeparator, this.numberFormat.thousandSeparator, nativeFocusableElement, allowNegative),
|
|
33
33
|
guide: false,
|
|
34
34
|
});
|
|
35
35
|
}
|
|
@@ -102,7 +102,7 @@ let TuiInputNumberComponent = TuiInputNumberComponent_1 = class TuiInputNumberCo
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
onKeyDown(event) {
|
|
105
|
-
if (TUI_DECIMAL_SYMBOLS.
|
|
105
|
+
if (!TUI_DECIMAL_SYMBOLS.includes(event.key)) {
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
108
108
|
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,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAE9B;IAiBa,uBAAuB,+BAApC,MAAa,uBACT,SAAQ,0BAAkC;IA8B1C,YAII,OAAyB,EAEzB,iBAAoC,EAEnB,YAAkC;QAEnD,KAA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xBpC;;;;;;"}
|
|
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,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAE9B;IAiBa,uBAAuB,+BAApC,MAAa,uBACT,SAAQ,0BAAkC;IA8B1C,YAII,OAAyB,EAEz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AAqB,CAAC;KACrF,CAAC;GACW,oBAAoB,CAAG;;ACxBpC;;;;;;"}
|
|
@@ -5,7 +5,7 @@ import { AbstractTuiControl, tuiPure, TUI_FOCUSABLE_ITEM_ACCESSOR, TuiLetModule
|
|
|
5
5
|
import { TuiTextfieldSizeDirective, TUI_TEXTFIELD_SIZE, TuiHintControllerDirective, TUI_HINT_WATCHED_CONTROLLER, TUI_MODE, TuiPrimitiveTextfieldComponent, HINT_CONTROLLER_PROVIDER, MODE_PROVIDER, TuiAbstractTextfieldHost, TUI_TEXTFIELD_HOST, 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
|
|
|
@@ -39,7 +39,7 @@ let TuiInputPasswordComponent = TuiInputPasswordComponent_1 = class TuiInputPass
|
|
|
39
39
|
this.mode$ = mode$;
|
|
40
40
|
this.isPasswordHidden = true;
|
|
41
41
|
this.computedMode$ = combineLatest([
|
|
42
|
-
this.mode
|
|
42
|
+
this.mode$.pipe(map(val => (val === 'onDark' ? 'onDark' : null))),
|
|
43
43
|
this.hintController.change$.pipe(startWith(null), map(() => this.hintController.mode)),
|
|
44
44
|
]).pipe(map(([mode, controller]) => controller || mode), startWith(null));
|
|
45
45
|
}
|
|
@@ -100,7 +100,7 @@ __decorate([
|
|
|
100
100
|
TuiInputPasswordComponent = TuiInputPasswordComponent_1 = __decorate([
|
|
101
101
|
Component({
|
|
102
102
|
selector: 'tui-input-password',
|
|
103
|
-
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",
|
|
103
|
+
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",
|
|
104
104
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
105
105
|
providers: [
|
|
106
106
|
{
|
|
@@ -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;MACa,kBAAkB,GAAG,CAAC,EAAC,SAAS,EAAM,KAC/C,SAAS,KAAK,GAAG,GAAG,kBAAkB,GAAG,mBAAmB;MACnD,kBAAkB,GAAG,CAAC,EAAC,SAAS,EAAM,KAC/C,SAAS,KAAK,GAAG,GAAG,gBAAgB,GAAG,mBAAmB;AAE9D;MACa,kCAAkC,GAA4B;IACvE,KAAK,EAAE;QACH,IAAI,EAAE,kBAAkB;QACxB,IAAI,EAAE,kBAAkB;KAC3B;EACH;MAEW,0BAA0B,GAAG,IAAI,cAAc,CACxD,iDAAiD,EACjD;IACI,OAAO,EAAE,MAAM,kCAAkC;CACpD,EACH;MAEW,+BAA+B,GAEvB,CAAC,OAAyC,MAAM;IACjE,OAAO,EAAE,0BAA0B;IACnC,QAAQ,kCAAM,kCAAkC,GAAK,OAAO,CAAC;CAChE;;;ACDD;IAmBa,yBAAyB,iCAAtC,MAAa,yBACT,SAAQ,kBAA0B;IAoBlC,YAII,OAAyB,EACE,iBAAoC,EAE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AY;YACZ,YAAY;YACZ,aAAa;YACb,2BAA2B;YAC3B,4BAA4B;SAC/B;QACD,YAAY,EAAE,CAAC,yBAAyB,EAAE,yBAAyB,CAAC;QACpE,OAAO,EAAE;YACL,yBAAyB;YACzB,yBAAyB;YACzB,qBAAqB;SACxB;KACJ,CAAC;GACW,sBAAsB,CAAG;;AClCtC;;;;;;"}
|
|
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;MACa,kBAAkB,GAAG,CAAC,EAAC,SAAS,EAAM,KAC/C,SAAS,KAAK,GAAG,GAAG,kBAAkB,GAAG,mBAAmB;MACnD,kBAAkB,GAAG,CAAC,EAAC,SAAS,EAAM,KAC/C,SAAS,KAAK,GAAG,GAAG,gBAAgB,GAAG,mBAAmB;AAE9D;MACa,kCAAkC,GAA4B;IACvE,KAAK,EAAE;QACH,IAAI,EAAE,kBAAkB;QACxB,IAAI,EAAE,kBAAkB;KAC3B;EACH;MAEW,0BAA0B,GAAG,IAAI,cAAc,CACxD,iDAAiD,EACjD;IACI,OAAO,EAAE,MAAM,kCAAkC;CACpD,EACH;MAEW,+BAA+B,GAEvB,CAAC,OAAyC,MAAM;IACjE,OAAO,EAAE,0BAA0B;IACnC,QAAQ,kCAAM,kCAAkC,GAAK,OAAO,CAAC;CAChE;;;ACAD;IAmBa,yBAAyB,iCAAtC,MAAa,yBACT,SAAQ,kBAA0B;IAqBlC,YAII,OAAyB,EACE,iBAAoC,EAE9C,aAAwC,EAEhD,cAA4C,EAE5C,OAAgC,EAEhC,cAA0C,EAElC,KAAuC;QAExD,KAAK,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;QAVjB,kBAAa,GAAb,aAAa,CAA2B;QAEhD,mBAAc,GAAd,cAAc,CAA8B;QAE5C,YAAO,GAAP,OAAO,CAAyB;QAEhC,mBAAc,GAAd,cAAc,CAA4B;QAElC,UAAK,GAAL,KAAK,CAAkC;QA9B5D,qBAAgB,GAAG,IAAI,CAAC;QAEf,kBAAa,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;;;;"}
|
|
@@ -528,12 +528,16 @@ let TuiInputPhoneInternationalComponent = TuiInputPhoneInternationalComponent_1
|
|
|
528
528
|
return this.getFlagPath(this.countryIsoCode);
|
|
529
529
|
}
|
|
530
530
|
onPaste(event) {
|
|
531
|
-
|
|
532
|
-
const countryIsoCode = this.
|
|
533
|
-
if (countryIsoCode) {
|
|
534
|
-
|
|
535
|
-
this.updateValue('+' + value.replace(TUI_NON_DIGITS_REGEXP, ''));
|
|
531
|
+
let value = extractValueFromEvent(event).replace(TUI_NON_DIGITS_REGEXP, '');
|
|
532
|
+
const countryIsoCode = this.extractCountryCode(value);
|
|
533
|
+
if (!countryIsoCode) {
|
|
534
|
+
return;
|
|
536
535
|
}
|
|
536
|
+
if (countryIsoCode === TuiCountryIsoCode$1.RU) {
|
|
537
|
+
value = value.replace(/^8/, '7');
|
|
538
|
+
}
|
|
539
|
+
this.updateCountryIsoCode(countryIsoCode);
|
|
540
|
+
this.updateValue(`+${value}`);
|
|
537
541
|
}
|
|
538
542
|
getFlagPath(code) {
|
|
539
543
|
return `${this.staticPath}${code}.png`;
|
|
@@ -580,6 +584,16 @@ let TuiInputPhoneInternationalComponent = TuiInputPhoneInternationalComponent_1
|
|
|
580
584
|
this.countryIsoCode = code;
|
|
581
585
|
this.countryIsoCodeChange.emit(code);
|
|
582
586
|
}
|
|
587
|
+
extractCountryCode(value) {
|
|
588
|
+
return this.countries.find(countryIsoCode => {
|
|
589
|
+
const ruCodeTest = countryIsoCode === TuiCountryIsoCode$1.RU &&
|
|
590
|
+
/^[7 | 8]/.test(value) &&
|
|
591
|
+
/^(?!880[1-9 ])/.test(value) &&
|
|
592
|
+
value.length + 1 === this.getMaxAllowedLength(TuiCountryIsoCode$1.RU);
|
|
593
|
+
return (ruCodeTest ||
|
|
594
|
+
value.startsWith(this.isoToCountryCode(countryIsoCode).replace('+', '')));
|
|
595
|
+
});
|
|
596
|
+
}
|
|
583
597
|
};
|
|
584
598
|
TuiInputPhoneInternationalComponent.ctorParameters = () => [
|
|
585
599
|
{ type: NgControl, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [NgControl,] }] },
|