@taiga-ui/kit 2.34.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-calendar-month.umd.js +2 -2
- package/bundles/taiga-ui-kit-components-calendar-month.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-calendar-month.umd.min.js +2 -2
- package/bundles/taiga-ui-kit-components-calendar-month.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-combo-box.umd.js +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 +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-month-range.umd.js +64 -41
- package/bundles/taiga-ui-kit-components-input-month-range.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-month-range.umd.min.js +2 -2
- package/bundles/taiga-ui-kit-components-input-month-range.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-month.umd.js +57 -32
- package/bundles/taiga-ui-kit-components-input-month.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-month.umd.min.js +2 -2
- package/bundles/taiga-ui-kit-components-input-month.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-number.umd.js +24 -16
- 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 +13 -6
- package/bundles/taiga-ui-kit-components-input-phone.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-phone.umd.min.js +2 -2
- 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 +16 -9
- package/bundles/taiga-ui-kit-components-input-tag.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-input-tag.umd.min.js +2 -2
- 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 +27 -16
- 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 +23 -9
- package/bundles/taiga-ui-kit-components-multi-select.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-multi-select.umd.min.js +2 -2
- 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 +140 -73
- package/bundles/taiga-ui-kit-components-progress.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-components-progress.umd.min.js +2 -2
- 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 +205 -30
- 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 +50 -13
- package/bundles/taiga-ui-kit-components-text-area.umd.js.map +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-directives-dropdown-selection.umd.js +22 -5
- package/bundles/taiga-ui-kit-directives-dropdown-selection.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-directives-dropdown-selection.umd.min.js +1 -1
- package/bundles/taiga-ui-kit-directives-dropdown-selection.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-directives-lazy-loading.umd.js +1 -1
- package/bundles/taiga-ui-kit-directives-lazy-loading.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 +46 -6
- package/bundles/taiga-ui-kit-pipes-field-error.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-pipes-field-error.umd.min.js +2 -2
- package/bundles/taiga-ui-kit-pipes-field-error.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-providers.umd.js +29 -12
- package/bundles/taiga-ui-kit-providers.umd.js.map +1 -1
- package/bundles/taiga-ui-kit-providers.umd.min.js +1 -1
- package/bundles/taiga-ui-kit-providers.umd.min.js.map +1 -1
- package/bundles/taiga-ui-kit-tokens.umd.js +11 -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/calendar-month/taiga-ui-kit-components-calendar-month.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-month/index.d.ts +1 -0
- package/components/input-month/input-month.component.d.ts +6 -4
- package/components/input-month/input-month.directive.d.ts +8 -1
- package/components/input-month/input-month.providers.d.ts +2 -0
- package/components/input-month/taiga-ui-kit-components-input-month.metadata.json +1 -1
- package/components/input-month-range/index.d.ts +1 -0
- package/components/input-month-range/input-month-range.component.d.ts +6 -7
- package/components/input-month-range/input-month-range.directive.d.ts +8 -1
- package/components/input-month-range/input-month-range.providers.d.ts +2 -0
- package/components/input-month-range/taiga-ui-kit-components-input-month-range.metadata.json +1 -1
- package/components/input-number/input-number.component.d.ts +3 -2
- package/components/input-number/input-number.directive.d.ts +4 -1
- 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/input-phone.directive.d.ts +4 -1
- 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 +6 -4
- 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/line-clamp/line-clamp.component.d.ts +7 -3
- package/components/line-clamp/taiga-ui-kit-components-line-clamp.metadata.json +1 -1
- package/components/multi-select/hide-selected.pipe.d.ts +1 -1
- package/components/multi-select/multi-select.component.d.ts +8 -6
- 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/index.d.ts +4 -3
- package/components/progress/progress-bar/progress-color-segments.directive.d.ts +11 -0
- package/components/progress/taiga-ui-kit-components-progress.metadata.json +1 -1
- package/components/progress/{pipes → utils}/abstract-color-segments.d.ts +0 -0
- package/components/progress/utils/calculate-color-segments.d.ts +1 -0
- package/components/progress/{pipes → utils}/progress-color-segments-async.pipe.d.ts +5 -0
- package/components/progress/utils/progress-color-segments.pipe.d.ts +9 -0
- 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/index.d.ts +2 -0
- package/components/slider/slider-key-steps.directive.d.ts +27 -0
- package/components/slider/slider-options.d.ts +9 -0
- package/components/slider/slider.component.d.ts +8 -6
- 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/index.d.ts +1 -0
- package/components/text-area/taiga-ui-kit-components-text-area.metadata.json +1 -1
- package/components/text-area/text-area.component.d.ts +2 -1
- package/components/text-area/text-area.directive.d.ts +5 -0
- package/directives/dropdown-selection/dropdown-selection.directive.d.ts +2 -2
- package/directives/dropdown-selection/taiga-ui-kit-directives-dropdown-selection.metadata.json +1 -1
- package/directives/lazy-loading/index.d.ts +1 -0
- package/directives/lazy-loading/taiga-ui-kit-directives-lazy-loading.d.ts +0 -1
- package/directives/lazy-loading/taiga-ui-kit-directives-lazy-loading.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/calendar-month/calendar-month.component.js +3 -3
- package/esm2015/components/combo-box/combo-box.component.js +2 -2
- 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-month/index.js +2 -1
- package/esm2015/components/input-month/input-month.component.js +19 -25
- package/esm2015/components/input-month/input-month.directive.js +32 -7
- package/esm2015/components/input-month/input-month.module.js +4 -4
- package/esm2015/components/input-month/input-month.providers.js +19 -0
- package/esm2015/components/input-month-range/index.js +2 -1
- package/esm2015/components/input-month-range/input-month-range.component.js +21 -37
- package/esm2015/components/input-month-range/input-month-range.directive.js +37 -7
- package/esm2015/components/input-month-range/input-month-range.module.js +3 -2
- package/esm2015/components/input-month-range/input-month-range.providers.js +19 -0
- package/esm2015/components/input-number/input-number.component.js +5 -5
- package/esm2015/components/input-number/input-number.directive.js +9 -3
- 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/input-phone.directive.js +9 -3
- 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 +17 -10
- package/esm2015/components/input-time/input-time.component.js +1 -1
- package/esm2015/components/line-clamp/line-clamp.component.js +25 -15
- package/esm2015/components/line-clamp/line-clamp.directive.js +5 -4
- package/esm2015/components/multi-select/hide-selected.pipe.js +4 -3
- package/esm2015/components/multi-select/multi-select-group/multi-select-group.component.js +3 -3
- package/esm2015/components/multi-select/multi-select.component.js +16 -6
- 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/index.js +5 -4
- package/esm2015/components/progress/progress-bar/progress-color-segments.directive.js +48 -0
- package/esm2015/components/progress/progress.module.js +6 -3
- package/esm2015/components/progress/utils/abstract-color-segments.js +32 -0
- package/esm2015/components/progress/utils/calculate-color-segments.js +11 -0
- package/esm2015/components/progress/utils/progress-color-segments-async.pipe.js +21 -0
- package/esm2015/components/progress/utils/progress-color-segments.pipe.js +19 -0
- package/esm2015/components/radio/radio.component.js +1 -1
- package/esm2015/components/select/select.component.js +2 -2
- package/esm2015/components/slider/index.js +3 -1
- package/esm2015/components/slider/slider-key-steps.directive.js +106 -0
- package/esm2015/components/slider/slider-options.js +13 -0
- package/esm2015/components/slider/slider.component.js +48 -26
- package/esm2015/components/slider/slider.module.js +14 -3
- package/esm2015/components/text-area/index.js +2 -1
- package/esm2015/components/text-area/text-area.component.js +21 -13
- package/esm2015/components/text-area/text-area.directive.js +22 -0
- package/esm2015/components/text-area/text-area.module.js +7 -6
- package/esm2015/components/text-area/text-area.providers.js +6 -2
- package/esm2015/directives/dropdown-selection/dropdown-selection.directive.js +23 -6
- package/esm2015/directives/lazy-loading/index.js +2 -1
- package/esm2015/directives/lazy-loading/taiga-ui-kit-directives-lazy-loading.js +1 -2
- package/esm2015/enums/file-state.js +1 -1
- package/esm2015/pipes/field-error/field-error-content-pipe.js +43 -0
- package/esm2015/pipes/field-error/field-error.module.js +4 -3
- package/esm2015/pipes/field-error/index.js +2 -1
- package/esm2015/providers/index.js +2 -1
- package/esm2015/providers/month-formatter.provider.js +17 -0
- package/esm2015/providers/value-accessor.provider.js +2 -2
- package/esm2015/tokens/i18n.js +7 -1
- package/esm2015/tokens/index.js +2 -1
- package/esm2015/tokens/month-formatter.js +3 -0
- 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/calendar-month/calendar-month.component.js +3 -3
- package/esm5/components/combo-box/combo-box.component.js +2 -2
- 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-month/index.js +2 -1
- package/esm5/components/input-month/input-month.component.js +18 -25
- package/esm5/components/input-month/input-month.directive.js +32 -9
- package/esm5/components/input-month/input-month.module.js +4 -4
- package/esm5/components/input-month/input-month.providers.js +19 -0
- package/esm5/components/input-month-range/index.js +2 -1
- package/esm5/components/input-month-range/input-month-range.component.js +20 -38
- package/esm5/components/input-month-range/input-month-range.directive.js +38 -8
- package/esm5/components/input-month-range/input-month-range.module.js +3 -2
- package/esm5/components/input-month-range/input-month-range.providers.js +19 -0
- package/esm5/components/input-number/input-number.component.js +18 -16
- package/esm5/components/input-number/input-number.directive.js +9 -3
- 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/input-phone.directive.js +9 -3
- 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 +17 -10
- package/esm5/components/input-time/input-time.component.js +1 -1
- package/esm5/components/line-clamp/line-clamp.component.js +26 -16
- package/esm5/components/line-clamp/line-clamp.directive.js +5 -4
- package/esm5/components/multi-select/hide-selected.pipe.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 +20 -6
- 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/index.js +5 -4
- package/esm5/components/progress/progress-bar/progress-color-segments.directive.js +56 -0
- package/esm5/components/progress/progress.module.js +6 -3
- package/esm5/components/progress/utils/abstract-color-segments.js +33 -0
- package/esm5/components/progress/utils/calculate-color-segments.js +13 -0
- package/esm5/components/progress/utils/progress-color-segments-async.pipe.js +27 -0
- package/esm5/components/progress/utils/progress-color-segments.pipe.js +24 -0
- package/esm5/components/radio/radio.component.js +1 -1
- package/esm5/components/select/select.component.js +2 -2
- package/esm5/components/slider/index.js +3 -1
- package/esm5/components/slider/slider-key-steps.directive.js +137 -0
- package/esm5/components/slider/slider-options.js +14 -0
- package/esm5/components/slider/slider.component.js +49 -27
- package/esm5/components/slider/slider.module.js +14 -3
- package/esm5/components/text-area/index.js +2 -1
- package/esm5/components/text-area/text-area.component.js +21 -13
- package/esm5/components/text-area/text-area.directive.js +28 -0
- package/esm5/components/text-area/text-area.module.js +7 -6
- package/esm5/components/text-area/text-area.providers.js +6 -2
- package/esm5/directives/dropdown-selection/dropdown-selection.directive.js +23 -6
- package/esm5/directives/lazy-loading/index.js +2 -1
- package/esm5/directives/lazy-loading/taiga-ui-kit-directives-lazy-loading.js +1 -2
- package/esm5/enums/file-state.js +1 -1
- package/esm5/pipes/field-error/field-error-content-pipe.js +44 -0
- package/esm5/pipes/field-error/field-error.module.js +4 -3
- package/esm5/pipes/field-error/index.js +2 -1
- package/esm5/providers/index.js +2 -1
- package/esm5/providers/month-formatter.provider.js +19 -0
- package/esm5/providers/value-accessor.provider.js +2 -2
- package/esm5/tokens/i18n.js +7 -1
- package/esm5/tokens/index.js +2 -1
- package/esm5/tokens/month-formatter.js +3 -0
- 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-calendar-month.js +2 -2
- package/fesm2015/taiga-ui-kit-components-calendar-month.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-combo-box.js +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-month-range.js +67 -41
- package/fesm2015/taiga-ui-kit-components-input-month-range.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-input-month.js +61 -31
- package/fesm2015/taiga-ui-kit-components-input-month.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-input-number.js +12 -6
- 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 +13 -6
- 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 +16 -9
- 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 +28 -17
- 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 +20 -9
- 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 +113 -55
- 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 +169 -28
- package/fesm2015/taiga-ui-kit-components-slider.js.map +1 -1
- package/fesm2015/taiga-ui-kit-components-text-area.js +47 -17
- package/fesm2015/taiga-ui-kit-components-text-area.js.map +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-directives-dropdown-selection.js +22 -5
- package/fesm2015/taiga-ui-kit-directives-dropdown-selection.js.map +1 -1
- package/fesm2015/taiga-ui-kit-directives-lazy-loading.js +1 -1
- package/fesm2015/taiga-ui-kit-directives-lazy-loading.js.map +1 -1
- package/fesm2015/taiga-ui-kit-enums.js.map +1 -1
- package/fesm2015/taiga-ui-kit-pipes-field-error.js +43 -4
- package/fesm2015/taiga-ui-kit-pipes-field-error.js.map +1 -1
- package/fesm2015/taiga-ui-kit-providers.js +18 -4
- package/fesm2015/taiga-ui-kit-providers.js.map +1 -1
- package/fesm2015/taiga-ui-kit-tokens.js +9 -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-calendar-month.js +2 -2
- package/fesm5/taiga-ui-kit-components-calendar-month.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-combo-box.js +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-month-range.js +68 -44
- package/fesm5/taiga-ui-kit-components-input-month-range.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-input-month.js +60 -33
- package/fesm5/taiga-ui-kit-components-input-month.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-input-number.js +25 -17
- 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 +13 -6
- 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 +16 -9
- 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 +29 -18
- 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 +24 -10
- 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 +135 -69
- 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 +202 -30
- package/fesm5/taiga-ui-kit-components-slider.js.map +1 -1
- package/fesm5/taiga-ui-kit-components-text-area.js +53 -17
- package/fesm5/taiga-ui-kit-components-text-area.js.map +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-directives-dropdown-selection.js +22 -5
- package/fesm5/taiga-ui-kit-directives-dropdown-selection.js.map +1 -1
- package/fesm5/taiga-ui-kit-directives-lazy-loading.js +1 -1
- package/fesm5/taiga-ui-kit-directives-lazy-loading.js.map +1 -1
- package/fesm5/taiga-ui-kit-enums.js.map +1 -1
- package/fesm5/taiga-ui-kit-pipes-field-error.js +44 -4
- package/fesm5/taiga-ui-kit-pipes-field-error.js.map +1 -1
- package/fesm5/taiga-ui-kit-providers.js +20 -4
- package/fesm5/taiga-ui-kit-providers.js.map +1 -1
- package/fesm5/taiga-ui-kit-tokens.js +9 -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 +12 -0
- package/pipes/field-error/index.d.ts +1 -0
- package/pipes/field-error/taiga-ui-kit-pipes-field-error.metadata.json +1 -1
- package/providers/index.d.ts +1 -0
- package/providers/month-formatter.provider.d.ts +6 -0
- package/providers/taiga-ui-kit-providers.metadata.json +1 -1
- package/tokens/i18n.d.ts +2 -0
- package/tokens/index.d.ts +1 -0
- package/tokens/month-formatter.d.ts +4 -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
- package/components/progress/pipes/progress-color-segments.pipe.d.ts +0 -9
- package/esm2015/components/progress/pipes/abstract-color-segments.js +0 -32
- package/esm2015/components/progress/pipes/progress-color-segments-async.pipe.js +0 -15
- package/esm2015/components/progress/pipes/progress-color-segments.pipe.js +0 -18
- package/esm5/components/progress/pipes/abstract-color-segments.js +0 -35
- package/esm5/components/progress/pipes/progress-color-segments-async.pipe.js +0 -21
- package/esm5/components/progress/pipes/progress-color-segments.pipe.js +0 -23
|
@@ -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,EAA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EAAE;YACP,aAAa;YACb;gBACI,OAAO,EAAE,2BAA2B;gBACpC,WAAW,EAAE,UAAU,CAAC,MAAM,wBAAsB,CAAC;aACxD;SACJ;;KACJ,CAAC;IAsCO,WAAA,QAAQ,EAAE,CAAA;IACV,WAAA,IAAI,EAAE,CAAA;IACN,WAAA,MAAM,CAAC,SAAS,CAAC,CAAA;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;;;;;;"}
|
|
@@ -1,19 +1,34 @@
|
|
|
1
1
|
import { __decorate, __param } from 'tslib';
|
|
2
|
-
import { Optional, Self, Inject, ChangeDetectorRef, ViewChild, Input, Component,
|
|
2
|
+
import { forwardRef, Optional, Self, Inject, ChangeDetectorRef, ViewChild, Input, Component, ChangeDetectionStrategy, Directive, NgModule } from '@angular/core';
|
|
3
3
|
import { NgControl } from '@angular/forms';
|
|
4
|
-
import { AbstractTuiNullableControl, TUI_FIRST_DAY, TUI_LAST_DAY, ALWAYS_FALSE_HANDLER, TuiMonthRange, tuiDefaultProp,
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { TUI_FOCUSABLE_ITEM_ACCESSOR, AbstractTuiControl, AbstractTuiNullableControl, TUI_FIRST_DAY, TUI_LAST_DAY, ALWAYS_FALSE_HANDLER, TuiMonthRange, tuiDefaultProp, TuiDestroyService, TuiPreventDefaultModule, TuiActiveZoneModule, TuiMapperPipeModule } from '@taiga-ui/cdk';
|
|
5
|
+
import { TuiMonthPipe, sizeBigger, TuiTextfieldSizeDirective, TUI_TEXTFIELD_SIZE, TuiPrimitiveTextfieldComponent, TuiAbstractTextfieldHost, TUI_TEXTFIELD_HOST, TuiHostedDropdownModule, TuiPrimitiveTextfieldModule, TuiSvgModule, TuiTextfieldComponent } from '@taiga-ui/core';
|
|
6
|
+
import { TUI_MONTH_FORMATTER } from '@taiga-ui/kit/tokens';
|
|
7
|
+
import { LEFT_ALIGNED_DROPDOWN_CONTROLLER_PROVIDER, TUI_MONTH_FORMATTER_PROVIDER } from '@taiga-ui/kit/providers';
|
|
8
|
+
import { Subject, combineLatest, Observable } from 'rxjs';
|
|
9
|
+
import { distinctUntilChanged, switchMap, takeUntil } from 'rxjs/operators';
|
|
8
10
|
import { CommonModule } from '@angular/common';
|
|
9
11
|
import { TuiCalendarMonthModule } from '@taiga-ui/kit/components/calendar-month';
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
const TUI_INPUT_MONTH_RANGE_PROVIDERS = [
|
|
14
|
+
{
|
|
15
|
+
provide: TUI_FOCUSABLE_ITEM_ACCESSOR,
|
|
16
|
+
useExisting: forwardRef(() => TuiInputMonthRangeComponent),
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
provide: AbstractTuiControl,
|
|
20
|
+
useExisting: forwardRef(() => TuiInputMonthRangeComponent),
|
|
21
|
+
},
|
|
22
|
+
LEFT_ALIGNED_DROPDOWN_CONTROLLER_PROVIDER,
|
|
23
|
+
TUI_MONTH_FORMATTER_PROVIDER,
|
|
24
|
+
TuiMonthPipe,
|
|
25
|
+
];
|
|
26
|
+
|
|
12
27
|
// @dynamic
|
|
13
|
-
let TuiInputMonthRangeComponent =
|
|
14
|
-
constructor(control, changeDetectorRef,
|
|
28
|
+
let TuiInputMonthRangeComponent = class TuiInputMonthRangeComponent extends AbstractTuiNullableControl {
|
|
29
|
+
constructor(control, changeDetectorRef, formatter, textfieldSize) {
|
|
15
30
|
super(control, changeDetectorRef);
|
|
16
|
-
this.
|
|
31
|
+
this.formatter = formatter;
|
|
17
32
|
this.textfieldSize = textfieldSize;
|
|
18
33
|
this.min = TUI_FIRST_DAY;
|
|
19
34
|
this.max = TUI_LAST_DAY;
|
|
@@ -31,18 +46,16 @@ let TuiInputMonthRangeComponent = TuiInputMonthRangeComponent_1 = class TuiInput
|
|
|
31
46
|
? 'tuiIconCalendarLarge'
|
|
32
47
|
: 'tuiIconCalendar';
|
|
33
48
|
}
|
|
34
|
-
computeValue(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
const formattedValueTo = !value.isSingleMonth || !focused ? this.formatMonth(value.to, months) : '';
|
|
39
|
-
return `${this.formatMonth(value.from, months)} — ${formattedValueTo}`;
|
|
49
|
+
computeValue(from, to) {
|
|
50
|
+
const formattedTo = from === to && this.focused ? '' : to;
|
|
51
|
+
return `${from} — ${formattedTo}`;
|
|
40
52
|
}
|
|
41
53
|
onValueChange(value) {
|
|
42
|
-
if (value
|
|
43
|
-
|
|
44
|
-
this.onOpenChange(true);
|
|
54
|
+
if (value) {
|
|
55
|
+
return;
|
|
45
56
|
}
|
|
57
|
+
this.updateValue(null);
|
|
58
|
+
this.onOpenChange(true);
|
|
46
59
|
}
|
|
47
60
|
onMonthClick(month) {
|
|
48
61
|
if (this.value === null || !this.value.isSingleMonth) {
|
|
@@ -71,9 +84,6 @@ let TuiInputMonthRangeComponent = TuiInputMonthRangeComponent_1 = class TuiInput
|
|
|
71
84
|
super.setDisabledState();
|
|
72
85
|
this.close();
|
|
73
86
|
}
|
|
74
|
-
formatMonth({ month, formattedYear }, months) {
|
|
75
|
-
return `${months[month]} ${formattedYear}`;
|
|
76
|
-
}
|
|
77
87
|
close() {
|
|
78
88
|
this.open = false;
|
|
79
89
|
}
|
|
@@ -81,7 +91,7 @@ let TuiInputMonthRangeComponent = TuiInputMonthRangeComponent_1 = class TuiInput
|
|
|
81
91
|
TuiInputMonthRangeComponent.ctorParameters = () => [
|
|
82
92
|
{ type: NgControl, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [NgControl,] }] },
|
|
83
93
|
{ type: ChangeDetectorRef, decorators: [{ type: Inject, args: [ChangeDetectorRef,] }] },
|
|
84
|
-
{ type:
|
|
94
|
+
{ type: undefined, decorators: [{ type: Inject, args: [TUI_MONTH_FORMATTER,] }] },
|
|
85
95
|
{ type: TuiTextfieldSizeDirective, decorators: [{ type: Inject, args: [TUI_TEXTFIELD_SIZE,] }] }
|
|
86
96
|
];
|
|
87
97
|
__decorate([
|
|
@@ -99,21 +109,11 @@ __decorate([
|
|
|
99
109
|
Input(),
|
|
100
110
|
tuiDefaultProp()
|
|
101
111
|
], TuiInputMonthRangeComponent.prototype, "disabledItemHandler", void 0);
|
|
102
|
-
TuiInputMonthRangeComponent =
|
|
112
|
+
TuiInputMonthRangeComponent = __decorate([
|
|
103
113
|
Component({
|
|
104
114
|
selector: 'tui-input-month-range',
|
|
105
|
-
template: "<tui-hosted-dropdown\n class=\"hosted\"\n [canOpen]=\"interactive\"\n [content]=\"dropdown\"\n [open]=\"open && interactive\"\n (openChange)=\"onOpenChange($event)\"\n (tuiActiveZoneChange)=\"onActiveZone($event)\"\n>\n <tui-primitive-textfield\n
|
|
106
|
-
providers:
|
|
107
|
-
{
|
|
108
|
-
provide: TUI_FOCUSABLE_ITEM_ACCESSOR,
|
|
109
|
-
useExisting: forwardRef(() => TuiInputMonthRangeComponent_1),
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
provide: AbstractTuiControl,
|
|
113
|
-
useExisting: forwardRef(() => TuiInputMonthRangeComponent_1),
|
|
114
|
-
},
|
|
115
|
-
LEFT_ALIGNED_DROPDOWN_CONTROLLER_PROVIDER,
|
|
116
|
-
],
|
|
115
|
+
template: "<tui-hosted-dropdown\n class=\"hosted\"\n [canOpen]=\"interactive\"\n [content]=\"dropdown\"\n [open]=\"open && interactive\"\n (openChange)=\"onOpenChange($event)\"\n (tuiActiveZoneChange)=\"onActiveZone($event)\"\n>\n <tui-primitive-textfield\n class=\"textfield\"\n [editable]=\"false\"\n [disabled]=\"computedDisabled\"\n [nativeId]=\"nativeId\"\n [readOnly]=\"readOnly\"\n [iconContent]=\"calendarIcon\"\n [pseudoFocused]=\"pseudoFocused\"\n [pseudoHovered]=\"pseudoHovered\"\n [invalid]=\"computedInvalid\"\n [value]=\"value ? computeValue(value.from | tuiMapper : formatter | async, value.to | tuiMapper : formatter | async) : ''\"\n (valueChange)=\"onValueChange($event)\"\n (hoveredChange)=\"onHovered($event)\"\n >\n <ng-content></ng-content>\n <ng-content select=\"input\" ngProjectAs=\"input\"></ng-content>\n </tui-primitive-textfield>\n\n <ng-template #dropdown>\n <tui-calendar-month\n tuiPreventDefault=\"mousedown\"\n [disabledItemHandler]=\"disabledItemHandler\"\n [min]=\"min\"\n [max]=\"max\"\n [value]=\"value\"\n (monthClick)=\"onMonthClick($event)\"\n ></tui-calendar-month>\n </ng-template>\n</tui-hosted-dropdown>\n",
|
|
116
|
+
providers: TUI_INPUT_MONTH_RANGE_PROVIDERS,
|
|
117
117
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
118
118
|
styles: [":host{display:block;border-radius:var(--tui-radius-m);text-align:left}.hosted{display:block;border-radius:inherit}.textfield{border-radius:inherit;text-align:inherit}.icon{position:relative;cursor:pointer}"]
|
|
119
119
|
}),
|
|
@@ -121,24 +121,45 @@ TuiInputMonthRangeComponent = TuiInputMonthRangeComponent_1 = __decorate([
|
|
|
121
121
|
__param(0, Self()),
|
|
122
122
|
__param(0, Inject(NgControl)),
|
|
123
123
|
__param(1, Inject(ChangeDetectorRef)),
|
|
124
|
-
__param(2, Inject(
|
|
124
|
+
__param(2, Inject(TUI_MONTH_FORMATTER)),
|
|
125
125
|
__param(3, Inject(TUI_TEXTFIELD_SIZE))
|
|
126
126
|
], TuiInputMonthRangeComponent);
|
|
127
127
|
|
|
128
128
|
var TuiInputMonthRangeDirective_1;
|
|
129
129
|
let TuiInputMonthRangeDirective = TuiInputMonthRangeDirective_1 = class TuiInputMonthRangeDirective extends TuiAbstractTextfieldHost {
|
|
130
|
+
constructor(host, formatter, destroy$) {
|
|
131
|
+
super(host);
|
|
132
|
+
this.value$ = new Subject();
|
|
133
|
+
this.localizedValue = ['', ''];
|
|
134
|
+
this.value$
|
|
135
|
+
.pipe(distinctUntilChanged(), switchMap((value) => combineLatest([
|
|
136
|
+
formatter(value && value.from),
|
|
137
|
+
formatter(value && value.to),
|
|
138
|
+
])), takeUntil(destroy$))
|
|
139
|
+
.subscribe(localizedValue => {
|
|
140
|
+
this.localizedValue = localizedValue;
|
|
141
|
+
});
|
|
142
|
+
}
|
|
130
143
|
get readOnly() {
|
|
131
144
|
return true;
|
|
132
145
|
}
|
|
133
|
-
// TODO: Fix change detection
|
|
134
146
|
get value() {
|
|
135
|
-
|
|
136
|
-
|
|
147
|
+
return this.localizedValue[0]
|
|
148
|
+
? this.host.computeValue(...this.localizedValue)
|
|
149
|
+
: '';
|
|
150
|
+
}
|
|
151
|
+
ngDoCheck() {
|
|
152
|
+
this.value$.next(this.host.value);
|
|
137
153
|
}
|
|
138
154
|
onValueChange(value) {
|
|
139
155
|
this.host.onValueChange(value);
|
|
140
156
|
}
|
|
141
157
|
};
|
|
158
|
+
TuiInputMonthRangeDirective.ctorParameters = () => [
|
|
159
|
+
{ type: TuiInputMonthRangeComponent, decorators: [{ type: Inject, args: [AbstractTuiControl,] }] },
|
|
160
|
+
{ type: undefined, decorators: [{ type: Inject, args: [TUI_MONTH_FORMATTER,] }] },
|
|
161
|
+
{ type: Observable, decorators: [{ type: Self }, { type: Inject, args: [TuiDestroyService,] }] }
|
|
162
|
+
];
|
|
142
163
|
TuiInputMonthRangeDirective = TuiInputMonthRangeDirective_1 = __decorate([
|
|
143
164
|
Directive({
|
|
144
165
|
selector: 'tui-input-month-range',
|
|
@@ -147,8 +168,12 @@ TuiInputMonthRangeDirective = TuiInputMonthRangeDirective_1 = __decorate([
|
|
|
147
168
|
provide: TUI_TEXTFIELD_HOST,
|
|
148
169
|
useExisting: forwardRef(() => TuiInputMonthRangeDirective_1),
|
|
149
170
|
},
|
|
171
|
+
TuiDestroyService,
|
|
150
172
|
],
|
|
151
|
-
})
|
|
173
|
+
}),
|
|
174
|
+
__param(0, Inject(AbstractTuiControl)),
|
|
175
|
+
__param(1, Inject(TUI_MONTH_FORMATTER)),
|
|
176
|
+
__param(2, Self()), __param(2, Inject(TuiDestroyService))
|
|
152
177
|
], TuiInputMonthRangeDirective);
|
|
153
178
|
|
|
154
179
|
let TuiInputMonthRangeModule = class TuiInputMonthRangeModule {
|
|
@@ -163,6 +188,7 @@ TuiInputMonthRangeModule = __decorate([
|
|
|
163
188
|
TuiSvgModule,
|
|
164
189
|
TuiPreventDefaultModule,
|
|
165
190
|
TuiActiveZoneModule,
|
|
191
|
+
TuiMapperPipeModule,
|
|
166
192
|
],
|
|
167
193
|
declarations: [TuiInputMonthRangeComponent, TuiInputMonthRangeDirective],
|
|
168
194
|
exports: [
|
|
@@ -177,5 +203,5 @@ TuiInputMonthRangeModule = __decorate([
|
|
|
177
203
|
* Generated bundle index. Do not edit.
|
|
178
204
|
*/
|
|
179
205
|
|
|
180
|
-
export { TuiInputMonthRangeComponent, TuiInputMonthRangeDirective, TuiInputMonthRangeModule };
|
|
206
|
+
export { TUI_INPUT_MONTH_RANGE_PROVIDERS, TuiInputMonthRangeComponent, TuiInputMonthRangeDirective, TuiInputMonthRangeModule };
|
|
181
207
|
//# sourceMappingURL=taiga-ui-kit-components-input-month-range.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-kit-components-input-month-range.js","sources":["ng://@taiga-ui/kit/components/input-month-range/input-month-range.component.ts","ng://@taiga-ui/kit/components/input-month-range/input-month-range.directive.ts","ng://@taiga-ui/kit/components/input-month-range/input-month-range.module.ts","ng://@taiga-ui/kit/components/input-month-range/taiga-ui-kit-components-input-month-range.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n forwardRef,\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 ALWAYS_FALSE_HANDLER,\n TUI_FIRST_DAY,\n TUI_FOCUSABLE_ITEM_ACCESSOR,\n TUI_LAST_DAY,\n tuiDefaultProp,\n TuiFocusableElementAccessor,\n TuiMonth,\n TuiMonthRange,\n} from '@taiga-ui/cdk';\nimport {\n sizeBigger,\n TUI_MONTHS,\n TUI_TEXTFIELD_SIZE,\n TuiPrimitiveTextfieldComponent,\n TuiTextfieldSizeDirective,\n TuiWithOptionalMinMax,\n} from '@taiga-ui/core';\nimport {TuiMonthContext} from '@taiga-ui/kit/interfaces';\nimport {LEFT_ALIGNED_DROPDOWN_CONTROLLER_PROVIDER} from '@taiga-ui/kit/providers';\nimport {TuiBooleanHandlerWithContext} from '@taiga-ui/kit/types';\nimport {Observable} from 'rxjs';\n\n// @dynamic\n@Component({\n selector: 'tui-input-month-range',\n templateUrl: './input-month-range.template.html',\n styleUrls: ['./input-month-range.style.less'],\n providers: [\n {\n provide: TUI_FOCUSABLE_ITEM_ACCESSOR,\n useExisting: forwardRef(() => TuiInputMonthRangeComponent),\n },\n {\n provide: AbstractTuiControl,\n useExisting: forwardRef(() => TuiInputMonthRangeComponent),\n },\n LEFT_ALIGNED_DROPDOWN_CONTROLLER_PROVIDER,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TuiInputMonthRangeComponent\n extends AbstractTuiNullableControl<TuiMonthRange>\n implements TuiWithOptionalMinMax<TuiMonth>, TuiFocusableElementAccessor\n{\n @ViewChild(TuiPrimitiveTextfieldComponent)\n readonly textfield?: TuiPrimitiveTextfieldComponent;\n\n @Input()\n @tuiDefaultProp()\n min: TuiMonth = TUI_FIRST_DAY;\n\n @Input()\n @tuiDefaultProp()\n max: TuiMonth = TUI_LAST_DAY;\n\n @Input()\n @tuiDefaultProp()\n disabledItemHandler: TuiBooleanHandlerWithContext<TuiMonth, TuiMonthContext> =\n ALWAYS_FALSE_HANDLER;\n\n open = false;\n\n constructor(\n @Optional()\n @Self()\n @Inject(NgControl)\n control: NgControl | null,\n @Inject(ChangeDetectorRef) changeDetectorRef: ChangeDetectorRef,\n @Inject(TUI_MONTHS) readonly months$: Observable<readonly string[]>,\n @Inject(TUI_TEXTFIELD_SIZE)\n private readonly textfieldSize: TuiTextfieldSizeDirective,\n ) {\n super(control, changeDetectorRef);\n }\n\n get nativeFocusableElement(): HTMLInputElement | null {\n return this.textfield ? this.textfield.nativeFocusableElement : null;\n }\n\n get focused(): boolean {\n return !!this.textfield && this.textfield.focused;\n }\n\n get calendarIcon(): string {\n return sizeBigger(this.textfieldSize.size)\n ? 'tuiIconCalendarLarge'\n : 'tuiIconCalendar';\n }\n\n computeValue(\n value: TuiMonthRange | null,\n focused: boolean,\n months: readonly string[],\n ): string {\n if (value === null) {\n return '';\n }\n\n const formattedValueTo =\n !value.isSingleMonth || !focused ? this.formatMonth(value.to, months) : '';\n\n return `${this.formatMonth(value.from, months)} — ${formattedValueTo}`;\n }\n\n onValueChange(value: string) {\n if (value === '') {\n this.updateValue(null);\n this.onOpenChange(true);\n }\n }\n\n onMonthClick(month: TuiMonth) {\n if (this.value === null || !this.value.isSingleMonth) {\n this.writeValue(new TuiMonthRange(month, month));\n\n return;\n }\n\n this.updateValue(TuiMonthRange.sort(this.value.from, month));\n this.close();\n }\n\n onHovered(hovered: boolean) {\n this.updateHovered(hovered);\n }\n\n onOpenChange(open: boolean) {\n this.open = open;\n }\n\n onActiveZone(focused: boolean) {\n this.updateFocused(focused);\n\n if (focused) {\n return;\n }\n\n if (this.value && this.value.isSingleMonth) {\n this.updateValue(new TuiMonthRange(this.value.from, this.value.from));\n }\n }\n\n setDisabledState() {\n super.setDisabledState();\n this.close();\n }\n\n private formatMonth(\n {month, formattedYear}: TuiMonth,\n months: readonly string[],\n ): string {\n return `${months[month]} ${formattedYear}`;\n }\n\n private close() {\n this.open = false;\n }\n}\n","import {Directive, forwardRef} from '@angular/core';\nimport {TUI_TEXTFIELD_HOST, TuiAbstractTextfieldHost} from '@taiga-ui/core';\n\nimport {TuiInputMonthRangeComponent} from './input-month-range.component';\n\n@Directive({\n selector: 'tui-input-month-range',\n providers: [\n {\n provide: TUI_TEXTFIELD_HOST,\n useExisting: forwardRef(() => TuiInputMonthRangeDirective),\n },\n ],\n})\nexport class TuiInputMonthRangeDirective extends TuiAbstractTextfieldHost<TuiInputMonthRangeComponent> {\n get readOnly(): boolean {\n return true;\n }\n\n // TODO: Fix change detection\n get value(): string {\n return this.host.textfield?.value || '';\n }\n\n onValueChange(value: string) {\n this.host.onValueChange(value);\n }\n}\n","import {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\nimport {TuiActiveZoneModule, TuiPreventDefaultModule} from '@taiga-ui/cdk';\nimport {\n TuiHostedDropdownModule,\n TuiPrimitiveTextfieldModule,\n TuiSvgModule,\n TuiTextfieldComponent,\n} from '@taiga-ui/core';\nimport {TuiCalendarMonthModule} from '@taiga-ui/kit/components/calendar-month';\n\nimport {TuiInputMonthRangeComponent} from './input-month-range.component';\nimport {TuiInputMonthRangeDirective} from './input-month-range.directive';\n\n@NgModule({\n imports: [\n CommonModule,\n TuiCalendarMonthModule,\n TuiHostedDropdownModule,\n TuiPrimitiveTextfieldModule,\n TuiSvgModule,\n TuiPreventDefaultModule,\n TuiActiveZoneModule,\n ],\n declarations: [TuiInputMonthRangeComponent, TuiInputMonthRangeDirective],\n exports: [\n TuiInputMonthRangeComponent,\n TuiInputMonthRangeDirective,\n TuiTextfieldComponent,\n ],\n})\nexport class TuiInputMonthRangeModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;AAqCA;IAkBa,2BAA2B,mCAAxC,MAAa,2BACT,SAAQ,0BAAyC;IAqBjD,YAII,OAAyB,EACE,iBAAoC,EAClC,OAAsC,EAElD,aAAwC;QAEzD,KAAK,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;QAJL,YAAO,GAAP,OAAO,CAA+B;QAElD,kBAAa,GAAb,aAAa,CAA2B;QArB7D,QAAG,GAAa,aAAa,CAAC;QAI9B,QAAG,GAAa,YAAY,CAAC;QAI7B,wBAAmB,GACf,oBAAoB,CAAC;QAEzB,SAAI,GAAG,KAAK,CAAC;KAaZ;IAED,IAAI,sBAAsB;QACtB,OAAO,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,sBAAsB,GAAG,IAAI,CAAC;KACxE;IAED,IAAI,OAAO;QACP,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;KACrD;IAED,IAAI,YAAY;QACZ,OAAO,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC;cACpC,sBAAsB;cACtB,iBAAiB,CAAC;KAC3B;IAED,YAAY,CACR,KAA2B,EAC3B,OAAgB,EAChB,MAAyB;QAEzB,IAAI,KAAK,KAAK,IAAI,EAAE;YAChB,OAAO,EAAE,CAAC;SACb;QAED,MAAM,gBAAgB,GAClB,CAAC,KAAK,CAAC,aAAa,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,EAAE,MAAM,CAAC,GAAG,EAAE,CAAC;QAE/E,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,gBAAgB,EAAE,CAAC;KAC1E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I,CAAC,SAAS,0CAAE,KAAK,KAAI,EAAE,CAAC;KAC3C;IAED,aAAa,CAAC,KAAa;QACvB,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;KAClC;EACJ;AAbY,2BAA2B;IATvC,SAAS,CAAC;QACP,QAAQ,EAAE,uBAAuB;QACjC,SAAS,EAAE;YACP;gBACI,OAAO,EAAE,kBAAkB;gBAC3B,WAAW,EAAE,UAAU,CAAC,MAAM,6BAA2B,CAAC;aAC7D;SACJ;KACJ,CAAC;GACW,2BAA2B,CAavC;;ICIY,wBAAwB,GAArC,MAAa,wBAAwB;EAAG;AAA3B,wBAAwB;IAjBpC,QAAQ,CAAC;QACN,OAAO,EAAE;YACL,YAAY;YACZ,sBAAsB;YACtB,uBAAuB;YACvB,2BAA2B;YAC3B,YAAY;YACZ,uBAAuB;YACvB,mBAAmB;SACtB;QACD,YAAY,EAAE,CAAC,2BAA2B,EAAE,2BAA2B,CAAC;QACxE,OAAO,EAAE;YACL,2BAA2B;YAC3B,2BAA2B;YAC3B,qBAAqB;SACxB;KACJ,CAAC;GACW,wBAAwB,CAAG;;AC/BxC;;;;;;"}
|
|
1
|
+
{"version":3,"file":"taiga-ui-kit-components-input-month-range.js","sources":["ng://@taiga-ui/kit/components/input-month-range/input-month-range.providers.ts","ng://@taiga-ui/kit/components/input-month-range/input-month-range.component.ts","ng://@taiga-ui/kit/components/input-month-range/input-month-range.directive.ts","ng://@taiga-ui/kit/components/input-month-range/input-month-range.module.ts","ng://@taiga-ui/kit/components/input-month-range/taiga-ui-kit-components-input-month-range.ts"],"sourcesContent":["import {forwardRef, Provider} from '@angular/core';\nimport {AbstractTuiControl, TUI_FOCUSABLE_ITEM_ACCESSOR} from '@taiga-ui/cdk';\nimport {TuiMonthPipe} from '@taiga-ui/core';\nimport {\n LEFT_ALIGNED_DROPDOWN_CONTROLLER_PROVIDER,\n TUI_MONTH_FORMATTER_PROVIDER,\n} from '@taiga-ui/kit/providers';\n\nimport {TuiInputMonthRangeComponent} from './input-month-range.component';\n\nexport const TUI_INPUT_MONTH_RANGE_PROVIDERS: Provider[] = [\n {\n provide: TUI_FOCUSABLE_ITEM_ACCESSOR,\n useExisting: forwardRef(() => TuiInputMonthRangeComponent),\n },\n {\n provide: AbstractTuiControl,\n useExisting: forwardRef(() => TuiInputMonthRangeComponent),\n },\n LEFT_ALIGNED_DROPDOWN_CONTROLLER_PROVIDER,\n TUI_MONTH_FORMATTER_PROVIDER,\n TuiMonthPipe,\n];\n","import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n Inject,\n Input,\n Optional,\n Self,\n ViewChild,\n} from '@angular/core';\nimport {NgControl} from '@angular/forms';\nimport {\n AbstractTuiNullableControl,\n ALWAYS_FALSE_HANDLER,\n TUI_FIRST_DAY,\n TUI_LAST_DAY,\n tuiDefaultProp,\n TuiFocusableElementAccessor,\n TuiHandler,\n TuiMonth,\n TuiMonthRange,\n} from '@taiga-ui/cdk';\nimport {\n sizeBigger,\n TUI_TEXTFIELD_SIZE,\n TuiPrimitiveTextfieldComponent,\n TuiTextfieldSizeDirective,\n TuiWithOptionalMinMax,\n} from '@taiga-ui/core';\nimport {TuiMonthContext} from '@taiga-ui/kit/interfaces';\nimport {TUI_MONTH_FORMATTER} from '@taiga-ui/kit/tokens';\nimport {TuiBooleanHandlerWithContext} from '@taiga-ui/kit/types';\nimport {Observable} from 'rxjs';\n\nimport {TUI_INPUT_MONTH_RANGE_PROVIDERS} from './input-month-range.providers';\n\n// @dynamic\n@Component({\n selector: 'tui-input-month-range',\n templateUrl: './input-month-range.template.html',\n styleUrls: ['./input-month-range.style.less'],\n providers: TUI_INPUT_MONTH_RANGE_PROVIDERS,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class TuiInputMonthRangeComponent\n extends AbstractTuiNullableControl<TuiMonthRange>\n implements TuiWithOptionalMinMax<TuiMonth>, TuiFocusableElementAccessor\n{\n @ViewChild(TuiPrimitiveTextfieldComponent)\n private readonly textfield?: TuiPrimitiveTextfieldComponent;\n\n @Input()\n @tuiDefaultProp()\n min: TuiMonth = TUI_FIRST_DAY;\n\n @Input()\n @tuiDefaultProp()\n max: TuiMonth = TUI_LAST_DAY;\n\n @Input()\n @tuiDefaultProp()\n disabledItemHandler: TuiBooleanHandlerWithContext<TuiMonth, TuiMonthContext> =\n ALWAYS_FALSE_HANDLER;\n\n open = false;\n\n constructor(\n @Optional()\n @Self()\n @Inject(NgControl)\n control: NgControl | null,\n @Inject(ChangeDetectorRef) changeDetectorRef: ChangeDetectorRef,\n @Inject(TUI_MONTH_FORMATTER)\n readonly formatter: TuiHandler<TuiMonth | null, Observable<string>>,\n @Inject(TUI_TEXTFIELD_SIZE)\n private readonly textfieldSize: TuiTextfieldSizeDirective,\n ) {\n super(control, changeDetectorRef);\n }\n\n get nativeFocusableElement(): HTMLInputElement | null {\n return this.textfield ? this.textfield.nativeFocusableElement : null;\n }\n\n get focused(): boolean {\n return !!this.textfield && this.textfield.focused;\n }\n\n get calendarIcon(): string {\n return sizeBigger(this.textfieldSize.size)\n ? 'tuiIconCalendarLarge'\n : 'tuiIconCalendar';\n }\n\n computeValue(from: string | null, to: string | null): string {\n const formattedTo = from === to && this.focused ? '' : to;\n\n return `${from} — ${formattedTo}`;\n }\n\n onValueChange(value: string) {\n if (value) {\n return;\n }\n\n this.updateValue(null);\n this.onOpenChange(true);\n }\n\n onMonthClick(month: TuiMonth) {\n if (this.value === null || !this.value.isSingleMonth) {\n this.writeValue(new TuiMonthRange(month, month));\n\n return;\n }\n\n this.updateValue(TuiMonthRange.sort(this.value.from, month));\n this.close();\n }\n\n onHovered(hovered: boolean) {\n this.updateHovered(hovered);\n }\n\n onOpenChange(open: boolean) {\n this.open = open;\n }\n\n onActiveZone(focused: boolean) {\n this.updateFocused(focused);\n\n if (focused) {\n return;\n }\n\n if (this.value && this.value.isSingleMonth) {\n this.updateValue(new TuiMonthRange(this.value.from, this.value.from));\n }\n }\n\n setDisabledState() {\n super.setDisabledState();\n this.close();\n }\n\n private close() {\n this.open = false;\n }\n}\n","import {Directive, DoCheck, forwardRef, Inject, Self} from '@angular/core';\nimport {\n AbstractTuiControl,\n TuiDestroyService,\n TuiHandler,\n TuiMonth,\n TuiMonthRange,\n} from '@taiga-ui/cdk';\nimport {TUI_TEXTFIELD_HOST, TuiAbstractTextfieldHost} from '@taiga-ui/core';\nimport {TUI_MONTH_FORMATTER} from '@taiga-ui/kit/tokens';\nimport {combineLatest, Observable, Subject} from 'rxjs';\nimport {distinctUntilChanged, switchMap, takeUntil} from 'rxjs/operators';\n\nimport {TuiInputMonthRangeComponent} from './input-month-range.component';\n\n@Directive({\n selector: 'tui-input-month-range',\n providers: [\n {\n provide: TUI_TEXTFIELD_HOST,\n useExisting: forwardRef(() => TuiInputMonthRangeDirective),\n },\n TuiDestroyService,\n ],\n})\nexport class TuiInputMonthRangeDirective\n extends TuiAbstractTextfieldHost<TuiInputMonthRangeComponent>\n implements DoCheck\n{\n private readonly value$ = new Subject<TuiMonthRange | null>();\n\n private localizedValue: [string, string] = ['', ''];\n\n constructor(\n @Inject(AbstractTuiControl) host: TuiInputMonthRangeComponent,\n @Inject(TUI_MONTH_FORMATTER)\n formatter: TuiHandler<TuiMonth | null, Observable<string>>,\n @Self() @Inject(TuiDestroyService) destroy$: Observable<unknown>,\n ) {\n super(host);\n\n this.value$\n .pipe(\n distinctUntilChanged(),\n switchMap((value: TuiMonthRange | null) =>\n combineLatest([\n formatter(value && value.from),\n formatter(value && value.to),\n ]),\n ),\n takeUntil(destroy$),\n )\n .subscribe(localizedValue => {\n this.localizedValue = localizedValue;\n });\n }\n\n get readOnly(): boolean {\n return true;\n }\n\n get value(): string {\n return this.localizedValue[0]\n ? this.host.computeValue(...this.localizedValue)\n : '';\n }\n\n ngDoCheck() {\n this.value$.next(this.host.value);\n }\n\n onValueChange(value: string) {\n this.host.onValueChange(value);\n }\n}\n","import {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\nimport {\n TuiActiveZoneModule,\n TuiMapperPipeModule,\n TuiPreventDefaultModule,\n} from '@taiga-ui/cdk';\nimport {\n TuiHostedDropdownModule,\n TuiPrimitiveTextfieldModule,\n TuiSvgModule,\n TuiTextfieldComponent,\n} from '@taiga-ui/core';\nimport {TuiCalendarMonthModule} from '@taiga-ui/kit/components/calendar-month';\n\nimport {TuiInputMonthRangeComponent} from './input-month-range.component';\nimport {TuiInputMonthRangeDirective} from './input-month-range.directive';\n\n@NgModule({\n imports: [\n CommonModule,\n TuiCalendarMonthModule,\n TuiHostedDropdownModule,\n TuiPrimitiveTextfieldModule,\n TuiSvgModule,\n TuiPreventDefaultModule,\n TuiActiveZoneModule,\n TuiMapperPipeModule,\n ],\n declarations: [TuiInputMonthRangeComponent, TuiInputMonthRangeDirective],\n exports: [\n TuiInputMonthRangeComponent,\n TuiInputMonthRangeDirective,\n TuiTextfieldComponent,\n ],\n})\nexport class TuiInputMonthRangeModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;MAUa,+BAA+B,GAAe;IACvD;QACI,OAAO,EAAE,2BAA2B;QACpC,WAAW,EAAE,UAAU,CAAC,MAAM,2BAA2B,CAAC;KAC7D;IACD;QACI,OAAO,EAAE,kBAAkB;QAC3B,WAAW,EAAE,UAAU,CAAC,MAAM,2BAA2B,CAAC;KAC7D;IACD,yCAAyC;IACzC,4BAA4B;IAC5B,YAAY;;;ACehB;IAQa,2BAA2B,GAAxC,MAAa,2BACT,SAAQ,0BAAyC;IAqBjD,YAII,OAAyB,EACE,iBAAoC,EAEtD,SAA0D,EAElD,aAAwC;QAEzD,KAAK,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;QAJzB,cAAS,GAAT,SAAS,CAAiD;QAElD,kBAAa,GAAb,aAAa,CAA2B;QAtB7D,QAAG,GAAa,aAAa,CAAC;QAI9B,QAAG,GAAa,YAAY,CAAC;QAI7B,wBAAmB,GACf,oBAAoB,CA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