ngx-tethys 19.0.16 → 19.1.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -11
- package/README.md +0 -1
- package/action/action.component.d.ts +14 -23
- package/action/actions.component.d.ts +5 -7
- package/affix/affix.component.d.ts +9 -13
- package/alert/alert.component.d.ts +1 -1
- package/anchor/anchor-link.component.d.ts +8 -8
- package/anchor/anchor.component.d.ts +15 -21
- package/arrow-switcher/arrow-switcher.component.d.ts +15 -22
- package/autocomplete/autocomplete.component.d.ts +10 -17
- package/autocomplete/autocomplete.trigger.directive.d.ts +10 -18
- package/avatar/avatar-list/avatar-list.component.d.ts +8 -14
- package/avatar/avatar.component.d.ts +25 -39
- package/back-top/back-top.component.d.ts +9 -12
- package/badge/badge.component.d.ts +19 -59
- package/breadcrumb/breadcrumb.component.d.ts +15 -20
- package/button/button-group.component.d.ts +5 -12
- package/button/button-icon.component.d.ts +14 -27
- package/button/button.component.d.ts +17 -26
- package/calendar/calendar-header.component.d.ts +9 -8
- package/calendar/calendar.component.d.ts +16 -16
- package/card/card.component.d.ts +5 -11
- package/card/content.component.d.ts +3 -8
- package/card/header.component.d.ts +7 -8
- package/carousel/carousel.component.d.ts +22 -27
- package/cascader/cascader-li.component.d.ts +13 -21
- package/cascader/cascader-search-option.component.d.ts +8 -16
- package/cascader/cascader.component.d.ts +58 -80
- package/checkbox/checkbox.component.d.ts +2 -5
- package/collapse/collapse-item.component.d.ts +12 -19
- package/collapse/collapse.component.d.ts +6 -12
- package/collapse/collapse.token.d.ts +3 -3
- package/color-picker/color-picker-custom-panel.component.d.ts +5 -5
- package/color-picker/color-picker-panel.component.d.ts +7 -11
- package/color-picker/color-picker.component.d.ts +19 -35
- package/color-picker/parts/alpha/alpha.component.d.ts +8 -8
- package/color-picker/parts/hue/hue.component.d.ts +6 -6
- package/color-picker/parts/indicator/indicator.component.d.ts +4 -3
- package/color-picker/parts/inputs/inputs.component.d.ts +9 -9
- package/color-picker/parts/saturation/saturation.component.d.ts +9 -9
- package/comment/comment.component.d.ts +4 -5
- package/copy/copy.directive.d.ts +8 -9
- package/date-picker/abstract-picker.component.d.ts +8 -7
- package/date-picker/lib/calendar/calendar-footer.component.d.ts +2 -1
- package/date-picker/lib/popups/inner-popup.component.d.ts +2 -1
- package/date-picker/picker.component.d.ts +2 -1
- package/date-range/date-range.component.d.ts +2 -2
- package/dialog/body/dialog-body.component.d.ts +2 -6
- package/dialog/confirm/confirm.component.d.ts +2 -2
- package/dialog/footer/dialog-footer.component.d.ts +6 -9
- package/dialog/header/dialog-header.component.d.ts +9 -11
- package/divider/divider.component.d.ts +12 -16
- package/dot/dot.component.d.ts +5 -13
- package/drag-drop/drag-handle.directive.d.ts +2 -1
- package/drag-drop/drag.directive.d.ts +2 -1
- package/drag-drop/drop-container.directive.d.ts +2 -1
- package/dropdown/dropdown-active.directive.d.ts +4 -5
- package/dropdown/dropdown-menu-item.directive.d.ts +7 -14
- package/dropdown/dropdown-menu.component.d.ts +6 -12
- package/dropdown/dropdown-submenu.component.d.ts +2 -4
- package/dropdown/dropdown.directive.d.ts +14 -24
- package/empty/empty.component.d.ts +21 -27
- package/fesm2022/ngx-tethys-action.mjs +63 -101
- package/fesm2022/ngx-tethys-action.mjs.map +1 -1
- package/fesm2022/ngx-tethys-affix.mjs +40 -41
- package/fesm2022/ngx-tethys-affix.mjs.map +1 -1
- package/fesm2022/ngx-tethys-anchor.mjs +91 -118
- package/fesm2022/ngx-tethys-anchor.mjs.map +1 -1
- package/fesm2022/ngx-tethys-arrow-switcher.mjs +51 -77
- package/fesm2022/ngx-tethys-arrow-switcher.mjs.map +1 -1
- package/fesm2022/ngx-tethys-autocomplete.mjs +69 -103
- package/fesm2022/ngx-tethys-autocomplete.mjs.map +1 -1
- package/fesm2022/ngx-tethys-avatar.mjs +117 -162
- package/fesm2022/ngx-tethys-avatar.mjs.map +1 -1
- package/fesm2022/ngx-tethys-back-top.mjs +33 -46
- package/fesm2022/ngx-tethys-back-top.mjs.map +1 -1
- package/fesm2022/ngx-tethys-badge.mjs +104 -208
- package/fesm2022/ngx-tethys-badge.mjs.map +1 -1
- package/fesm2022/ngx-tethys-breadcrumb.mjs +66 -70
- package/fesm2022/ngx-tethys-breadcrumb.mjs.map +1 -1
- package/fesm2022/ngx-tethys-button.mjs +225 -322
- package/fesm2022/ngx-tethys-button.mjs.map +1 -1
- package/fesm2022/ngx-tethys-calendar.mjs +85 -87
- package/fesm2022/ngx-tethys-calendar.mjs.map +1 -1
- package/fesm2022/ngx-tethys-card.mjs +72 -77
- package/fesm2022/ngx-tethys-card.mjs.map +1 -1
- package/fesm2022/ngx-tethys-carousel.mjs +83 -99
- package/fesm2022/ngx-tethys-carousel.mjs.map +1 -1
- package/fesm2022/ngx-tethys-cascader.mjs +313 -468
- package/fesm2022/ngx-tethys-cascader.mjs.map +1 -1
- package/fesm2022/ngx-tethys-checkbox.mjs +10 -17
- package/fesm2022/ngx-tethys-checkbox.mjs.map +1 -1
- package/fesm2022/ngx-tethys-collapse.mjs +66 -71
- package/fesm2022/ngx-tethys-collapse.mjs.map +1 -1
- package/fesm2022/ngx-tethys-color-picker.mjs +187 -246
- package/fesm2022/ngx-tethys-color-picker.mjs.map +1 -1
- package/fesm2022/ngx-tethys-comment.mjs +16 -10
- package/fesm2022/ngx-tethys-comment.mjs.map +1 -1
- package/fesm2022/ngx-tethys-copy.mjs +25 -28
- package/fesm2022/ngx-tethys-copy.mjs.map +1 -1
- package/fesm2022/ngx-tethys-dialog.mjs +81 -82
- package/fesm2022/ngx-tethys-dialog.mjs.map +1 -1
- package/fesm2022/ngx-tethys-divider.mjs +49 -58
- package/fesm2022/ngx-tethys-divider.mjs.map +1 -1
- package/fesm2022/ngx-tethys-dot.mjs +45 -68
- package/fesm2022/ngx-tethys-dot.mjs.map +1 -1
- package/fesm2022/ngx-tethys-dropdown.mjs +155 -203
- package/fesm2022/ngx-tethys-dropdown.mjs.map +1 -1
- package/fesm2022/ngx-tethys-empty.mjs +107 -95
- package/fesm2022/ngx-tethys-empty.mjs.map +1 -1
- package/fesm2022/ngx-tethys-flexible-text.mjs +67 -86
- package/fesm2022/ngx-tethys-flexible-text.mjs.map +1 -1
- package/fesm2022/ngx-tethys-form.mjs +161 -200
- package/fesm2022/ngx-tethys-form.mjs.map +1 -1
- package/fesm2022/ngx-tethys-fullscreen.mjs +21 -23
- package/fesm2022/ngx-tethys-fullscreen.mjs.map +1 -1
- package/fesm2022/ngx-tethys-grid.mjs +161 -158
- package/fesm2022/ngx-tethys-grid.mjs.map +1 -1
- package/fesm2022/ngx-tethys-i18n.mjs +25 -25
- package/fesm2022/ngx-tethys-i18n.mjs.map +1 -1
- package/fesm2022/ngx-tethys-icon.mjs +44 -59
- package/fesm2022/ngx-tethys-icon.mjs.map +1 -1
- package/fesm2022/ngx-tethys-image.mjs +40 -36
- package/fesm2022/ngx-tethys-image.mjs.map +1 -1
- package/fesm2022/ngx-tethys-input-number.mjs +101 -114
- package/fesm2022/ngx-tethys-input-number.mjs.map +1 -1
- package/fesm2022/ngx-tethys-input.mjs +268 -271
- package/fesm2022/ngx-tethys-input.mjs.map +1 -1
- package/fesm2022/ngx-tethys-list.mjs +1 -1
- package/fesm2022/ngx-tethys-list.mjs.map +1 -1
- package/fesm2022/ngx-tethys-loading.mjs +17 -35
- package/fesm2022/ngx-tethys-loading.mjs.map +1 -1
- package/fesm2022/ngx-tethys-mention.mjs +52 -74
- package/fesm2022/ngx-tethys-mention.mjs.map +1 -1
- package/fesm2022/ngx-tethys-menu.mjs +106 -179
- package/fesm2022/ngx-tethys-menu.mjs.map +1 -1
- package/fesm2022/ngx-tethys-nav.mjs +169 -201
- package/fesm2022/ngx-tethys-nav.mjs.map +1 -1
- package/fesm2022/ngx-tethys-pagination.mjs +230 -294
- package/fesm2022/ngx-tethys-pagination.mjs.map +1 -1
- package/fesm2022/ngx-tethys-popover.mjs +67 -70
- package/fesm2022/ngx-tethys-popover.mjs.map +1 -1
- package/fesm2022/ngx-tethys-progress.mjs +194 -246
- package/fesm2022/ngx-tethys-progress.mjs.map +1 -1
- package/fesm2022/ngx-tethys-property.mjs +99 -113
- package/fesm2022/ngx-tethys-property.mjs.map +1 -1
- package/fesm2022/ngx-tethys-radio.mjs +60 -76
- package/fesm2022/ngx-tethys-radio.mjs.map +1 -1
- package/fesm2022/ngx-tethys-rate.mjs +115 -157
- package/fesm2022/ngx-tethys-rate.mjs.map +1 -1
- package/fesm2022/ngx-tethys-resizable.mjs +111 -157
- package/fesm2022/ngx-tethys-resizable.mjs.map +1 -1
- package/fesm2022/ngx-tethys-result.mjs +46 -28
- package/fesm2022/ngx-tethys-result.mjs.map +1 -1
- package/fesm2022/ngx-tethys-segment.mjs +84 -103
- package/fesm2022/ngx-tethys-segment.mjs.map +1 -1
- package/fesm2022/ngx-tethys-skeleton.mjs +339 -342
- package/fesm2022/ngx-tethys-skeleton.mjs.map +1 -1
- package/fesm2022/ngx-tethys-slide.mjs +37 -56
- package/fesm2022/ngx-tethys-slide.mjs.map +1 -1
- package/fesm2022/ngx-tethys-slider.mjs +75 -108
- package/fesm2022/ngx-tethys-slider.mjs.map +1 -1
- package/fesm2022/ngx-tethys-space.mjs +25 -51
- package/fesm2022/ngx-tethys-space.mjs.map +1 -1
- package/fesm2022/ngx-tethys-statistic.mjs +114 -151
- package/fesm2022/ngx-tethys-statistic.mjs.map +1 -1
- package/fesm2022/ngx-tethys-stepper.mjs +74 -107
- package/fesm2022/ngx-tethys-stepper.mjs.map +1 -1
- package/fesm2022/ngx-tethys-strength.mjs +52 -66
- package/fesm2022/ngx-tethys-strength.mjs.map +1 -1
- package/fesm2022/ngx-tethys-switch.mjs +80 -140
- package/fesm2022/ngx-tethys-switch.mjs.map +1 -1
- package/fesm2022/ngx-tethys-table.mjs +1 -1
- package/fesm2022/ngx-tethys-table.mjs.map +1 -1
- package/fesm2022/ngx-tethys-tabs.mjs +69 -87
- package/fesm2022/ngx-tethys-tabs.mjs.map +1 -1
- package/fesm2022/ngx-tethys-tag.mjs +42 -64
- package/fesm2022/ngx-tethys-tag.mjs.map +1 -1
- package/fesm2022/ngx-tethys-timeline.mjs +104 -129
- package/fesm2022/ngx-tethys-timeline.mjs.map +1 -1
- package/fesm2022/ngx-tethys-transfer.mjs +98 -119
- package/fesm2022/ngx-tethys-transfer.mjs.map +1 -1
- package/fesm2022/ngx-tethys-tree-select.mjs +2 -4
- package/fesm2022/ngx-tethys-tree-select.mjs.map +1 -1
- package/fesm2022/ngx-tethys-tree.mjs +281 -401
- package/fesm2022/ngx-tethys-tree.mjs.map +1 -1
- package/fesm2022/ngx-tethys-typography.mjs +36 -33
- package/fesm2022/ngx-tethys-typography.mjs.map +1 -1
- package/fesm2022/ngx-tethys-upload.mjs +93 -132
- package/fesm2022/ngx-tethys-upload.mjs.map +1 -1
- package/fesm2022/ngx-tethys-util.mjs.map +1 -1
- package/fesm2022/ngx-tethys-vote.mjs +53 -99
- package/fesm2022/ngx-tethys-vote.mjs.map +1 -1
- package/fesm2022/ngx-tethys-watermark.mjs +36 -40
- package/fesm2022/ngx-tethys-watermark.mjs.map +1 -1
- package/fesm2022/ngx-tethys.mjs +1 -1
- package/fesm2022/ngx-tethys.mjs.map +1 -1
- package/flexible-text/flexible-text.component.d.ts +9 -15
- package/form/form-group-error/form-group-error.component.d.ts +2 -3
- package/form/form-group-label.directive.d.ts +2 -1
- package/form/form-group.component.d.ts +17 -24
- package/form/form-submit.directive.d.ts +2 -2
- package/form/form.directive.d.ts +6 -8
- package/form/from-group-footer/form-group-footer.component.d.ts +2 -2
- package/form/validator/confirm-validator.directive.d.ts +2 -2
- package/form/validator/unique-validator.directive.d.ts +2 -2
- package/fullscreen/fullscreen.component.d.ts +7 -7
- package/grid/flex.d.ts +13 -20
- package/grid/thy-col.directive.d.ts +6 -9
- package/grid/thy-grid-item.component.d.ts +3 -4
- package/grid/thy-grid.component.d.ts +11 -12
- package/grid/thy-row.directive.d.ts +11 -14
- package/icon/icon.component.d.ts +10 -17
- package/image/image.directive.d.ts +10 -12
- package/image/image.token.d.ts +5 -5
- package/input/input-count.component.d.ts +4 -5
- package/input/input-group.component.d.ts +20 -20
- package/input/input-search.component.d.ts +15 -20
- package/input/input.component.d.ts +20 -21
- package/input/input.directive.d.ts +4 -6
- package/input-number/input-number.component.d.ts +21 -29
- package/layout/header.component.d.ts +4 -9
- package/layout/sidebar-header.component.d.ts +2 -1
- package/layout/sidebar.component.d.ts +8 -7
- package/list/list.component.d.ts +2 -1
- package/list/selection/selection-list.d.ts +4 -3
- package/loading/loading.component.d.ts +4 -10
- package/mention/mention.directive.d.ts +6 -7
- package/mention/suggestions/suggestions.component.d.ts +8 -9
- package/menu/group/menu-group.component.d.ts +16 -33
- package/menu/item/action/menu-item-action.component.d.ts +7 -8
- package/menu/item/icon/menu-item-icon.component.d.ts +2 -2
- package/menu/item/menu-item.component.d.ts +4 -4
- package/menu/item/name/menu-item-name.component.d.ts +2 -3
- package/menu/menu.component.d.ts +3 -7
- package/nav/icon-nav/icon-nav-link.directive.d.ts +3 -7
- package/nav/icon-nav/icon-nav.component.d.ts +3 -8
- package/nav/nav-ink-bar.directive.d.ts +4 -6
- package/nav/nav-item.directive.d.ts +7 -10
- package/nav/nav.component.d.ts +20 -48
- package/package.json +1 -1
- package/pagination/pagination.component.d.ts +48 -109
- package/popover/header/popover-header.component.d.ts +7 -6
- package/popover/popover.directive.d.ts +11 -18
- package/progress/progress-circle.component.d.ts +35 -26
- package/progress/progress-strip.component.d.ts +10 -14
- package/progress/progress.component.d.ts +16 -26
- package/property/examples/single/single.component.scss +6 -0
- package/property/properties.component.d.ts +6 -15
- package/property/property-item.component.d.ts +22 -34
- package/property/styles/properties.scss +124 -52
- package/property-operation/property-operation.component.d.ts +6 -5
- package/radio/button/radio-button.component.d.ts +2 -2
- package/radio/group/radio-group.component.d.ts +13 -16
- package/radio/radio.component.d.ts +2 -2
- package/radio/radio.token.d.ts +2 -2
- package/rate/rate-item.component.d.ts +8 -10
- package/rate/rate.component.d.ts +20 -30
- package/resizable/resizable.directive.d.ts +18 -36
- package/resizable/resize-handle.component.d.ts +6 -6
- package/resizable/resize-handles.component.d.ts +5 -8
- package/result/result.component.d.ts +9 -10
- package/schematics/version.d.ts +1 -1
- package/schematics/version.js +1 -1
- package/segment/segment-item.component.d.ts +9 -14
- package/segment/segment.component.d.ts +11 -14
- package/segment/segment.token.d.ts +4 -3
- package/select/custom-select/custom-select.component.d.ts +11 -10
- package/select/native-select/native-select.component.d.ts +2 -1
- package/shared/base-form-check.component.d.ts +3 -2
- package/shared/directives/thy-autofocus.directive.d.ts +3 -2
- package/shared/directives/thy-scroll.directive.d.ts +2 -1
- package/shared/directives/thy-show.d.ts +2 -1
- package/shared/option/group/option-group.component.d.ts +2 -1
- package/shared/option/list-option/list-option.component.d.ts +2 -7
- package/shared/option/option.component.d.ts +2 -1
- package/shared/select/select-control/select-control.component.d.ts +7 -6
- package/skeleton/skeleton-circle.component.d.ts +16 -19
- package/skeleton/skeleton-rectangle.component.d.ts +20 -23
- package/skeleton/skeleton.component.d.ts +5 -6
- package/skeleton/stylized/bullet-list.component.d.ts +11 -13
- package/skeleton/stylized/list.component.d.ts +10 -12
- package/skeleton/stylized/paragraph.component.d.ts +12 -14
- package/slide/slide-body/slide-body-section.component.d.ts +2 -5
- package/slide/slide-header/slide-header.component.d.ts +6 -9
- package/slider/slider.component.d.ts +17 -24
- package/space/space.component.d.ts +10 -16
- package/statistic/statistic.component.d.ts +35 -40
- package/stepper/step-header.component.d.ts +6 -10
- package/stepper/step.component.d.ts +6 -6
- package/stepper/stepper.component.d.ts +15 -20
- package/strength/strength.component.d.ts +8 -13
- package/switch/switch.component.d.ts +24 -35
- package/table/table-column.component.d.ts +6 -5
- package/table/table-skeleton.component.d.ts +3 -10
- package/table/table.component.d.ts +11 -10
- package/tabs/tab-content.component.d.ts +4 -4
- package/tabs/tab.component.d.ts +4 -5
- package/tabs/tabs.component.d.ts +13 -15
- package/tag/tag.component.d.ts +10 -16
- package/time-picker/time-picker-panel.component.d.ts +3 -2
- package/time-picker/time-picker.component.d.ts +6 -5
- package/timeline/timeline-item.component.d.ts +9 -13
- package/timeline/timeline.component.d.ts +13 -17
- package/tooltip/tooltip.directive.d.ts +3 -2
- package/transfer/transfer-list.component.d.ts +15 -15
- package/transfer/transfer.component.d.ts +20 -23
- package/tree/tree-abstract.d.ts +5 -5
- package/tree/tree-node.component.d.ts +24 -46
- package/tree/tree.class.d.ts +4 -4
- package/tree/tree.component.d.ts +47 -74
- package/tree/tree.service.d.ts +3 -4
- package/tree-select/tree-select.component.d.ts +10 -9
- package/typography/bg-color.directive.d.ts +3 -3
- package/typography/text/text.component.d.ts +2 -2
- package/typography/text-color.directive.d.ts +3 -3
- package/upload/file-drop.directive.d.ts +9 -11
- package/upload/file-select-base.d.ts +6 -10
- package/upload/file-select.component.d.ts +10 -20
- package/util/helpers/helpers.d.ts +2 -1
- package/vote/vote.component.d.ts +13 -32
- package/watermark/watermark.directive.d.ts +7 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngx-tethys-typography.mjs","sources":["../../../src/typography/text/text.component.ts","../../../src/typography/text/text.component.html","../../../src/typography/text-color.directive.ts","../../../src/typography/bg-color.directive.ts","../../../src/typography/module.ts","../../../src/typography/ngx-tethys-typography.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component,
|
|
1
|
+
{"version":3,"file":"ngx-tethys-typography.mjs","sources":["../../../src/typography/text/text.component.ts","../../../src/typography/text/text.component.html","../../../src/typography/text-color.directive.ts","../../../src/typography/bg-color.directive.ts","../../../src/typography/module.ts","../../../src/typography/ngx-tethys-typography.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, OnInit, input } from '@angular/core';\nimport { ThyIcon } from 'ngx-tethys/icon';\n\n/**\n * 文本组件\n * @name thy-text,[thyText]\n * @order 10\n */\n@Component({\n selector: 'thy-text, [thyText]:not(thy-divider)',\n templateUrl: './text.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'thy-text'\n },\n imports: [ThyIcon]\n})\nexport class ThyText implements OnInit {\n /**\n * 前置图标\n */\n readonly thyIcon = input<string>(undefined);\n\n constructor() {}\n\n ngOnInit(): void {}\n}\n","@if (thyIcon()) {\n <thy-icon [thyIconName]=\"thyIcon()\"></thy-icon>\n}\n<ng-content></ng-content>\n","import { Directive, ElementRef, OnInit, effect, inject, input } from '@angular/core';\nimport { isTextColor, isThemeColor, ThyTextColor, ThyThemeColor } from 'ngx-tethys/core';\nimport { useHostRenderer } from '@tethys/cdk/dom';\n\n/**\n * @name thyTextColor\n * @order 20\n */\n@Directive({\n selector: '[thyTextColor]',\n exportAs: 'thyTextColor'\n})\nexport class ThyTextColorDirective implements OnInit {\n private elementRef = inject(ElementRef);\n\n private color: ThyThemeColor | ThyTextColor | string = '';\n\n private hostRenderer = useHostRenderer();\n\n /**\n * @type ThyThemeColor | ThyTextColor | string\n * @description 文本颜色,支持设置主题色和自定义颜色值,主题色为 `default`、`primary`、`success`、`info`、`warning`、`danger`、`light`、`secondary`、`muted`、`desc`、`placeholder`\n */\n readonly thyTextColor = input<ThyThemeColor | ThyTextColor | string>(undefined);\n\n constructor() {\n effect(() => {\n const color = this.thyTextColor();\n this.clearColor();\n this.color = color;\n this.setColor();\n });\n }\n\n ngOnInit(): void {}\n\n private setColor() {\n if (isThemeColor(this.color) || isTextColor(this.color)) {\n this.hostRenderer.addClass(`text-${this.color}`);\n } else {\n this.hostRenderer.setStyle('color', this.color);\n }\n }\n\n private clearColor() {\n this.hostRenderer.setStyle('color', '');\n if (isThemeColor(this.color) || isTextColor(this.color)) {\n this.hostRenderer.removeClass(`text-${this.color}`);\n }\n }\n}\n","import { Directive, ElementRef, effect, inject, input } from '@angular/core';\nimport { isBgColor, isThemeColor, ThyBgColor, ThyThemeColor } from 'ngx-tethys/core';\nimport { useHostRenderer } from '@tethys/cdk/dom';\n\n/**\n * @name thyBgColor\n * @order 30\n */\n@Directive({\n selector: '[thyBgColor]',\n exportAs: 'thyBgColor'\n})\nexport class ThyBackgroundColorDirective {\n private elementRef = inject(ElementRef);\n\n private bgColor: ThyThemeColor | ThyBgColor | string = '';\n\n private hostRenderer = useHostRenderer();\n\n /**\n * @type ThyThemeColor | ThyBgColor | string\n * @description 背景颜色,支持设置主题色和自定义颜色值,主题色为 `primary`、`success`、`info`、`danger`、`warning`、`dark`、`secondary`、`light`、`lighter`、`bright`、`content`、`white`、`transparent`\n */\n readonly thyBgColor = input<ThyThemeColor | ThyBgColor | string>(undefined);\n\n constructor() {\n effect(() => {\n const bgColor = this.thyBgColor();\n this.clearBgColor();\n this.bgColor = bgColor;\n this.setBgColor();\n });\n }\n\n private setBgColor() {\n if (isThemeColor(this.bgColor) || isBgColor(this.bgColor)) {\n this.hostRenderer.addClass(`bg-${this.bgColor}`);\n } else {\n this.hostRenderer.setStyle('background-color', this.bgColor);\n }\n }\n\n private clearBgColor() {\n this.hostRenderer.setStyle('background-color', '');\n if (isThemeColor(this.bgColor) || isBgColor(this.bgColor)) {\n this.hostRenderer.removeClass(`bg-${this.bgColor}`);\n }\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ThyIconModule } from 'ngx-tethys/icon';\nimport { ThyText } from './text/text.component';\nimport { ThyTextColorDirective } from './text-color.directive';\nimport { ThyBackgroundColorDirective } from './bg-color.directive';\n\n@NgModule({\n imports: [CommonModule, ThyIconModule, ThyText, ThyTextColorDirective, ThyBackgroundColorDirective],\n exports: [ThyText, ThyTextColorDirective, ThyBackgroundColorDirective],\n providers: []\n})\nexport class ThyTypographyModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAGA;;;;AAIG;MAUU,OAAO,CAAA;AAMhB,IAAA,WAAA,GAAA;AALA;;AAEG;AACM,QAAA,IAAA,CAAA,OAAO,GAAG,KAAK,CAAS,SAAS,CAAC;;AAI3C,IAAA,QAAQ;8GARC,OAAO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A,EAAA,mBAAmB,EAJlB,OAAA,EAAA,CAAA,YAAY,EAAE,aAAa,EAAE,OAAO,CAAA,EAAA,CAAA,CAAA;;2FAIrC,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAL/B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACN,OAAO,EAAE,CAAC,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,qBAAqB,EAAE,2BAA2B,CAAC;AACnG,oBAAA,OAAO,EAAE,CAAC,OAAO,EAAE,qBAAqB,EAAE,2BAA2B,CAAC;AACtE,oBAAA,SAAS,EAAE;AACd,iBAAA;;;ACXD;;AAEG;;;;"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { XhrFactory, CommonModule } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { InjectionToken,
|
|
3
|
+
import { InjectionToken, input, numberAttribute, Inject, Directive, signal, output, inject, DestroyRef, viewChild, effect, Component, Injectable, NgModule } from '@angular/core';
|
|
4
4
|
import { isArray, isString, isNumber, isEmpty, coerceBooleanProperty, TinyDate, coerceArray, humanizeBytes } from 'ngx-tethys/util';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { fromEvent, Observable, from } from 'rxjs';
|
|
6
|
+
import { tap, filter, mergeMap, map } from 'rxjs/operators';
|
|
7
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
7
8
|
|
|
8
9
|
const THY_UPLOAD_DEFAULT_OPTIONS = new InjectionToken('thy-uploader-default-options');
|
|
9
10
|
const THY_UPLOAD_DEFAULT_OPTIONS_PROVIDER = {
|
|
@@ -95,8 +96,8 @@ const MIME_Map = {
|
|
|
95
96
|
'.z': 'application/x-compress',
|
|
96
97
|
'.zip': 'application/x-zip-compressed',
|
|
97
98
|
'.ico': 'image/vnd.microsoft.icon',
|
|
98
|
-
'.md': 'text/markdown
|
|
99
|
-
'.markdown': 'text/markdown
|
|
99
|
+
'.md': 'text/markdown',
|
|
100
|
+
'.markdown': 'text/markdown',
|
|
100
101
|
'': '*/*'
|
|
101
102
|
};
|
|
102
103
|
|
|
@@ -129,46 +130,51 @@ function mimeTypeConvert(value) {
|
|
|
129
130
|
* @private
|
|
130
131
|
*/
|
|
131
132
|
class FileSelectBaseDirective {
|
|
132
|
-
set thySizeThreshold(value) {
|
|
133
|
-
const sizeThreshold = value;
|
|
134
|
-
if (isNumber(sizeThreshold)) {
|
|
135
|
-
this.sizeThreshold = sizeThreshold;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
set thySizeExceedsHandler(value) {
|
|
139
|
-
if (value) {
|
|
140
|
-
this.sizeExceedsHandler = value;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* 指定文件后缀类型(MIME_Map),例如".xls,xlsx","[".doc",".docx"]"
|
|
145
|
-
*/
|
|
146
|
-
set thyAcceptType(value) {
|
|
147
|
-
this.acceptType = mimeTypeConvert(value);
|
|
148
|
-
}
|
|
149
133
|
constructor(elementRef, defaultConfig) {
|
|
150
134
|
this.elementRef = elementRef;
|
|
151
135
|
this.defaultConfig = defaultConfig;
|
|
152
|
-
this.
|
|
153
|
-
|
|
154
|
-
|
|
136
|
+
this.thySizeThreshold = input(this.defaultConfig.sizeThreshold, {
|
|
137
|
+
transform: (inputValue) => {
|
|
138
|
+
const sizeThreshold = numberAttribute(inputValue);
|
|
139
|
+
if (isNumber(sizeThreshold)) {
|
|
140
|
+
return sizeThreshold;
|
|
141
|
+
}
|
|
142
|
+
return this.defaultConfig.sizeThreshold;
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
this.thySizeExceedsHandler = input(this.defaultConfig.sizeExceedsHandler, {
|
|
146
|
+
transform: (inputValue) => {
|
|
147
|
+
if (inputValue) {
|
|
148
|
+
return inputValue;
|
|
149
|
+
}
|
|
150
|
+
return this.defaultConfig.sizeExceedsHandler;
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
/**
|
|
154
|
+
* 指定文件后缀类型(MIME_Map),例如".xls,xlsx","[".doc",".docx"]"
|
|
155
|
+
*/
|
|
156
|
+
this.thyAcceptType = input(mimeTypeConvert(this.defaultConfig.acceptType), {
|
|
157
|
+
transform: (inputValue) => {
|
|
158
|
+
return mimeTypeConvert(inputValue);
|
|
159
|
+
}
|
|
160
|
+
});
|
|
155
161
|
}
|
|
156
162
|
handleSizeExceeds(event, files) {
|
|
157
|
-
let sizeExceedsFiles = files.filter(item => item.size / 1024 > this.
|
|
163
|
+
let sizeExceedsFiles = files.filter(item => item.size / 1024 > this.thySizeThreshold());
|
|
158
164
|
if (sizeExceedsFiles.length > 0) {
|
|
159
165
|
const sizeExceedContext = {
|
|
160
166
|
files: files,
|
|
161
167
|
exceedsFiles: sizeExceedsFiles,
|
|
162
168
|
nativeEvent: event,
|
|
163
|
-
sizeThreshold: this.
|
|
169
|
+
sizeThreshold: this.thySizeThreshold()
|
|
164
170
|
};
|
|
165
|
-
return this.
|
|
171
|
+
return this.thySizeExceedsHandler()(sizeExceedContext);
|
|
166
172
|
}
|
|
167
173
|
return files;
|
|
168
174
|
}
|
|
169
175
|
selectFiles(event, files, eventEmitter) {
|
|
170
176
|
let successFiles = files;
|
|
171
|
-
if (this.
|
|
177
|
+
if (this.thySizeThreshold() && this.thySizeThreshold() > 0) {
|
|
172
178
|
successFiles = this.handleSizeExceeds(event, files);
|
|
173
179
|
}
|
|
174
180
|
if (successFiles) {
|
|
@@ -179,48 +185,39 @@ class FileSelectBaseDirective {
|
|
|
179
185
|
}
|
|
180
186
|
}
|
|
181
187
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: FileSelectBaseDirective, deps: [{ token: i0.ElementRef }, { token: THY_UPLOAD_DEFAULT_OPTIONS }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
182
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
188
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: FileSelectBaseDirective, isStandalone: true, inputs: { thySizeThreshold: { classPropertyName: "thySizeThreshold", publicName: "thySizeThreshold", isSignal: true, isRequired: false, transformFunction: null }, thySizeExceedsHandler: { classPropertyName: "thySizeExceedsHandler", publicName: "thySizeExceedsHandler", isSignal: true, isRequired: false, transformFunction: null }, thyAcceptType: { classPropertyName: "thyAcceptType", publicName: "thyAcceptType", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
|
|
183
189
|
}
|
|
184
190
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: FileSelectBaseDirective, decorators: [{
|
|
185
191
|
type: Directive
|
|
186
192
|
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: undefined, decorators: [{
|
|
187
193
|
type: Inject,
|
|
188
194
|
args: [THY_UPLOAD_DEFAULT_OPTIONS]
|
|
189
|
-
}] }]
|
|
190
|
-
type: Input,
|
|
191
|
-
args: [{ transform: numberAttribute }]
|
|
192
|
-
}], thySizeExceedsHandler: [{
|
|
193
|
-
type: Input
|
|
194
|
-
}], thyAcceptType: [{
|
|
195
|
-
type: Input
|
|
196
|
-
}] } });
|
|
195
|
+
}] }] });
|
|
197
196
|
|
|
198
197
|
/**
|
|
199
198
|
* @name thyFileDrop
|
|
200
199
|
*/
|
|
201
200
|
class ThyFileDropDirective extends FileSelectBaseDirective {
|
|
202
|
-
set thyFileDropClassName(value) {
|
|
203
|
-
this.dragOverCustomClass = value;
|
|
204
|
-
}
|
|
205
201
|
constructor(elementRef, renderer, ngZone, defaultConfig) {
|
|
206
202
|
super(elementRef, defaultConfig);
|
|
207
203
|
this.elementRef = elementRef;
|
|
208
204
|
this.renderer = renderer;
|
|
209
205
|
this.ngZone = ngZone;
|
|
210
206
|
this.defaultConfig = defaultConfig;
|
|
211
|
-
this.isDragOver = false;
|
|
212
|
-
this.
|
|
207
|
+
this.isDragOver = signal(false);
|
|
208
|
+
this.thyFileDropClassName = input();
|
|
209
|
+
this.thyOnDrop = output();
|
|
213
210
|
/**
|
|
214
211
|
* 当拖拽的文件中有不符合 thyAcceptType 中定义的类型时触发
|
|
215
212
|
* @description.en-us It is triggered when there are files in the dragged files that do not conform to the types defined in thyAcceptType.
|
|
216
213
|
*/
|
|
217
|
-
this.thyFilesReject =
|
|
218
|
-
this.
|
|
214
|
+
this.thyFilesReject = output();
|
|
215
|
+
this.destroyRef = inject(DestroyRef);
|
|
219
216
|
}
|
|
220
217
|
ngOnInit() {
|
|
221
218
|
this.ngZone.runOutsideAngular(() => {
|
|
222
219
|
fromEvent(this.elementRef.nativeElement, 'dragenter')
|
|
223
|
-
.pipe(
|
|
220
|
+
.pipe(takeUntilDestroyed(this.destroyRef), tap((event) => {
|
|
224
221
|
event.preventDefault();
|
|
225
222
|
}), filter(event => event.dataTransfer.items && event.dataTransfer.items.length > 0))
|
|
226
223
|
.subscribe((event) => {
|
|
@@ -228,19 +225,19 @@ class ThyFileDropDirective extends FileSelectBaseDirective {
|
|
|
228
225
|
const files = this.filterFilesOrItems(Array.from(event.dataTransfer.items));
|
|
229
226
|
if (!isEmpty(files)) {
|
|
230
227
|
this.ngZone.run(() => {
|
|
231
|
-
this.isDragOver
|
|
228
|
+
this.isDragOver.set(true);
|
|
232
229
|
this.toggleDropOverClassName();
|
|
233
230
|
});
|
|
234
231
|
}
|
|
235
232
|
}
|
|
236
233
|
});
|
|
237
234
|
fromEvent(this.elementRef.nativeElement, 'dragover')
|
|
238
|
-
.pipe(
|
|
235
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
239
236
|
.subscribe((event) => {
|
|
240
237
|
event.preventDefault();
|
|
241
238
|
});
|
|
242
239
|
fromEvent(this.elementRef.nativeElement, 'dragleave')
|
|
243
|
-
.pipe(
|
|
240
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
244
241
|
.subscribe((event) => {
|
|
245
242
|
this.ngZone.run(() => {
|
|
246
243
|
if (!this.elementRef.nativeElement.contains(event.fromElement)) {
|
|
@@ -250,7 +247,7 @@ class ThyFileDropDirective extends FileSelectBaseDirective {
|
|
|
250
247
|
});
|
|
251
248
|
});
|
|
252
249
|
fromEvent(this.elementRef.nativeElement, 'drop')
|
|
253
|
-
.pipe(
|
|
250
|
+
.pipe(takeUntilDestroyed(this.destroyRef), tap((event) => {
|
|
254
251
|
event.preventDefault();
|
|
255
252
|
}))
|
|
256
253
|
.subscribe((event) => {
|
|
@@ -298,10 +295,11 @@ class ThyFileDropDirective extends FileSelectBaseDirective {
|
|
|
298
295
|
return entry;
|
|
299
296
|
}
|
|
300
297
|
filterFilesOrItems(items) {
|
|
301
|
-
|
|
298
|
+
const acceptType = this.thyAcceptType();
|
|
299
|
+
if (acceptType && acceptType != '*/*') {
|
|
302
300
|
return items.filter(item => {
|
|
303
301
|
const isValidType = isString(item.type) && item.type.length > 0;
|
|
304
|
-
return isValidType &&
|
|
302
|
+
return isValidType && acceptType.includes(item.type);
|
|
305
303
|
});
|
|
306
304
|
}
|
|
307
305
|
else {
|
|
@@ -309,49 +307,35 @@ class ThyFileDropDirective extends FileSelectBaseDirective {
|
|
|
309
307
|
}
|
|
310
308
|
}
|
|
311
309
|
toggleDropOverClassName() {
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
310
|
+
const dragOverCustomClass = this.thyFileDropClassName();
|
|
311
|
+
if (dragOverCustomClass) {
|
|
312
|
+
if (this.isDragOver()) {
|
|
313
|
+
this.renderer.addClass(this.elementRef.nativeElement, dragOverCustomClass);
|
|
315
314
|
}
|
|
316
315
|
else {
|
|
317
|
-
this.renderer.removeClass(this.elementRef.nativeElement,
|
|
316
|
+
this.renderer.removeClass(this.elementRef.nativeElement, dragOverCustomClass);
|
|
318
317
|
}
|
|
319
318
|
}
|
|
320
319
|
}
|
|
321
|
-
setDragOverState(isDragOver) {
|
|
322
|
-
this.isDragOver = isDragOver;
|
|
323
|
-
}
|
|
324
320
|
resetDragOver() {
|
|
325
|
-
this.
|
|
326
|
-
}
|
|
327
|
-
ngOnDestroy() {
|
|
328
|
-
this.ngUnsubscribe$.next();
|
|
329
|
-
this.ngUnsubscribe$.complete();
|
|
321
|
+
this.isDragOver.set(false);
|
|
330
322
|
}
|
|
331
323
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyFileDropDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }, { token: THY_UPLOAD_DEFAULT_OPTIONS }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
332
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
324
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: ThyFileDropDirective, isStandalone: true, selector: "[thyFileDrop]", inputs: { thyFileDropClassName: { classPropertyName: "thyFileDropClassName", publicName: "thyFileDropClassName", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { thyOnDrop: "thyOnDrop", thyFilesReject: "thyFilesReject" }, host: { properties: { "class.thy-drop-over": "isDragOver()", "class.drop-over": "isDragOver()" } }, usesInheritance: true, ngImport: i0 }); }
|
|
333
325
|
}
|
|
334
326
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyFileDropDirective, decorators: [{
|
|
335
327
|
type: Directive,
|
|
336
328
|
args: [{
|
|
337
|
-
selector: '[thyFileDrop]'
|
|
329
|
+
selector: '[thyFileDrop]',
|
|
330
|
+
host: {
|
|
331
|
+
'[class.thy-drop-over]': 'isDragOver()',
|
|
332
|
+
'[class.drop-over]': 'isDragOver()'
|
|
333
|
+
}
|
|
338
334
|
}]
|
|
339
335
|
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }, { type: undefined, decorators: [{
|
|
340
336
|
type: Inject,
|
|
341
337
|
args: [THY_UPLOAD_DEFAULT_OPTIONS]
|
|
342
|
-
}] }]
|
|
343
|
-
type: HostBinding,
|
|
344
|
-
args: ['class.drop-over']
|
|
345
|
-
}, {
|
|
346
|
-
type: HostBinding,
|
|
347
|
-
args: ['class.thy-drop-over']
|
|
348
|
-
}], thyFileDropClassName: [{
|
|
349
|
-
type: Input
|
|
350
|
-
}], thyOnDrop: [{
|
|
351
|
-
type: Output
|
|
352
|
-
}], thyFilesReject: [{
|
|
353
|
-
type: Output
|
|
354
|
-
}] } });
|
|
338
|
+
}] }] });
|
|
355
339
|
|
|
356
340
|
/**
|
|
357
341
|
* 文件上传组件
|
|
@@ -359,19 +343,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
359
343
|
* @order 10
|
|
360
344
|
*/
|
|
361
345
|
class ThyFileSelect extends FileSelectBaseDirective {
|
|
362
|
-
/**
|
|
363
|
-
* 指定文件后缀类型(MIME_Map),例如".xls,xlsx","[".doc",".docx"]"
|
|
364
|
-
* @type Array<string> | string
|
|
365
|
-
*/
|
|
366
|
-
set thyAcceptType(value) {
|
|
367
|
-
this.acceptType = mimeTypeConvert(value);
|
|
368
|
-
}
|
|
369
|
-
/**
|
|
370
|
-
* 文件上传大小限制,单位`kb`,`0`表示没有任何限制
|
|
371
|
-
*/
|
|
372
|
-
set thySizeThreshold(value) {
|
|
373
|
-
this.sizeThreshold = value;
|
|
374
|
-
}
|
|
375
346
|
constructor(elementRef, defaultConfig, ngZone) {
|
|
376
347
|
super(elementRef, defaultConfig);
|
|
377
348
|
this.elementRef = elementRef;
|
|
@@ -380,68 +351,58 @@ class ThyFileSelect extends FileSelectBaseDirective {
|
|
|
380
351
|
/**
|
|
381
352
|
* 文件选择事件
|
|
382
353
|
*/
|
|
383
|
-
this.thyOnFileSelect =
|
|
384
|
-
this.
|
|
354
|
+
this.thyOnFileSelect = output();
|
|
355
|
+
this.fileInput = viewChild('fileInput');
|
|
356
|
+
/**
|
|
357
|
+
* 文件是否多选
|
|
358
|
+
* @default false
|
|
359
|
+
*/
|
|
360
|
+
this.thyMultiple = input(false, { transform: coerceBooleanProperty });
|
|
361
|
+
/**
|
|
362
|
+
* 是否接受文件夹
|
|
363
|
+
*/
|
|
364
|
+
this.thyAcceptFolder = input(false, { transform: coerceBooleanProperty });
|
|
365
|
+
this.destroyRef = inject(DestroyRef);
|
|
385
366
|
this.ngZone.runOutsideAngular(() => fromEvent(this.elementRef.nativeElement, 'click')
|
|
386
|
-
.pipe(
|
|
367
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
387
368
|
.subscribe(() => {
|
|
388
|
-
this.fileInput.nativeElement.click();
|
|
369
|
+
this.fileInput().nativeElement.click();
|
|
389
370
|
}));
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
371
|
+
effect(() => {
|
|
372
|
+
const multiple = this.thyMultiple();
|
|
373
|
+
const acceptFolder = this.thyAcceptFolder();
|
|
374
|
+
const inputElement = this.fileInput().nativeElement;
|
|
375
|
+
if (multiple) {
|
|
376
|
+
inputElement.setAttribute('multiple', '');
|
|
395
377
|
}
|
|
396
378
|
else {
|
|
397
|
-
|
|
379
|
+
inputElement.removeAttribute('multiple');
|
|
398
380
|
}
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
if (changes.thyAcceptFolder.currentValue) {
|
|
402
|
-
this.fileInput.nativeElement.setAttribute('webkitdirectory', '');
|
|
381
|
+
if (acceptFolder) {
|
|
382
|
+
inputElement.setAttribute('webkitdirectory', '');
|
|
403
383
|
}
|
|
404
384
|
else {
|
|
405
|
-
|
|
385
|
+
inputElement.removeAttribute('webkitdirectory');
|
|
406
386
|
}
|
|
407
|
-
}
|
|
387
|
+
});
|
|
408
388
|
}
|
|
409
389
|
selectFile($event) {
|
|
410
|
-
const files = this.fileInput.nativeElement.files;
|
|
390
|
+
const files = this.fileInput().nativeElement.files;
|
|
411
391
|
if (files && files.length > 0) {
|
|
412
392
|
this.selectFiles($event, Array.from(files), this.thyOnFileSelect);
|
|
413
|
-
this.fileInput.nativeElement.value = '';
|
|
393
|
+
this.fileInput().nativeElement.value = '';
|
|
414
394
|
}
|
|
415
395
|
}
|
|
416
|
-
ngOnDestroy() {
|
|
417
|
-
this.destroy$.next();
|
|
418
|
-
}
|
|
419
396
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyFileSelect, deps: [{ token: i0.ElementRef }, { token: THY_UPLOAD_DEFAULT_OPTIONS }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
420
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
397
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.8", type: ThyFileSelect, isStandalone: true, selector: "[thyFileSelect],thy-file-select", inputs: { thyMultiple: { classPropertyName: "thyMultiple", publicName: "thyMultiple", isSignal: true, isRequired: false, transformFunction: null }, thyAcceptFolder: { classPropertyName: "thyAcceptFolder", publicName: "thyAcceptFolder", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { thyOnFileSelect: "thyOnFileSelect" }, viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<ng-content></ng-content>\n<input\n style=\"width: 0; height: 0\"\n thyStopPropagation=\"true\"\n [hidden]=\"'true'\"\n #fileInput\n type=\"file\"\n (change)=\"selectFile($event)\"\n [attr.accept]=\"thyAcceptType()\"\n/>\n" }); }
|
|
421
398
|
}
|
|
422
399
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyFileSelect, decorators: [{
|
|
423
400
|
type: Component,
|
|
424
|
-
args: [{ selector: '[thyFileSelect],thy-file-select', template: "<ng-content></ng-content>\n<input\n style=\"width: 0; height: 0\"\n thyStopPropagation=\"true\"\n [hidden]=\"'true'\"\n #fileInput\n type=\"file\"\n (change)=\"selectFile($event)\"\n [attr.accept]=\"
|
|
401
|
+
args: [{ selector: '[thyFileSelect],thy-file-select', template: "<ng-content></ng-content>\n<input\n style=\"width: 0; height: 0\"\n thyStopPropagation=\"true\"\n [hidden]=\"'true'\"\n #fileInput\n type=\"file\"\n (change)=\"selectFile($event)\"\n [attr.accept]=\"thyAcceptType()\"\n/>\n" }]
|
|
425
402
|
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: undefined, decorators: [{
|
|
426
403
|
type: Inject,
|
|
427
404
|
args: [THY_UPLOAD_DEFAULT_OPTIONS]
|
|
428
|
-
}] }, { type: i0.NgZone }]
|
|
429
|
-
type: Output
|
|
430
|
-
}], fileInput: [{
|
|
431
|
-
type: ViewChild,
|
|
432
|
-
args: ['fileInput', { static: true }]
|
|
433
|
-
}], thyMultiple: [{
|
|
434
|
-
type: Input,
|
|
435
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
436
|
-
}], thyAcceptFolder: [{
|
|
437
|
-
type: Input,
|
|
438
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
439
|
-
}], thyAcceptType: [{
|
|
440
|
-
type: Input
|
|
441
|
-
}], thySizeThreshold: [{
|
|
442
|
-
type: Input,
|
|
443
|
-
args: [{ transform: numberAttribute }]
|
|
444
|
-
}] } });
|
|
405
|
+
}] }, { type: i0.NgZone }] });
|
|
445
406
|
|
|
446
407
|
var ThyUploadStatus;
|
|
447
408
|
(function (ThyUploadStatus) {
|