ngx-tethys 19.0.13 → 19.1.0-next.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/CHANGELOG.md +29 -2
- package/action/action.component.d.ts +12 -20
- package/action/actions.component.d.ts +5 -7
- package/affix/affix.component.d.ts +7 -10
- 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-icon.component.d.ts +3 -2
- package/button/button.component.d.ts +3 -2
- 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-menu-item.directive.d.ts +3 -2
- package/dropdown/dropdown-menu.component.d.ts +2 -1
- package/dropdown/dropdown.directive.d.ts +2 -1
- package/empty/empty.component.d.ts +21 -27
- package/fesm2022/ngx-tethys-action.mjs +54 -91
- package/fesm2022/ngx-tethys-action.mjs.map +1 -1
- package/fesm2022/ngx-tethys-affix.mjs +29 -26
- 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-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 +82 -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-empty.mjs +107 -95
- package/fesm2022/ngx-tethys-empty.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 +160 -152
- 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-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 +196 -244
- package/fesm2022/ngx-tethys-progress.mjs.map +1 -1
- package/fesm2022/ngx-tethys-property.mjs +102 -105
- package/fesm2022/ngx-tethys-property.mjs.map +1 -1
- package/fesm2022/ngx-tethys-radio.mjs +34 -38
- package/fesm2022/ngx-tethys-radio.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-skeleton.mjs +339 -342
- package/fesm2022/ngx-tethys-skeleton.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 +26 -46
- 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-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-typography.mjs +36 -33
- package/fesm2022/ngx-tethys-typography.mjs.map +1 -1
- package/fesm2022/ngx-tethys-upload.mjs +91 -130
- package/fesm2022/ngx-tethys-upload.mjs.map +1 -1
- package/fesm2022/ngx-tethys-util.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/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 +14 -19
- 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 +12 -12
- package/icon/icon.component.d.ts +3 -2
- package/image/image.directive.d.ts +3 -2
- 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 +32 -21
- package/progress/progress-strip.component.d.ts +10 -14
- package/progress/progress.component.d.ts +15 -23
- package/property/examples/single/single.component.scss +6 -0
- package/property/properties.component.d.ts +6 -13
- package/property/property-item.component.d.ts +21 -26
- 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 +8 -7
- package/radio/radio.component.d.ts +2 -2
- package/radio/radio.token.d.ts +2 -2
- package/rate/rate-item.component.d.ts +2 -1
- package/rate/rate.component.d.ts +4 -3
- package/resizable/resizable.directive.d.ts +4 -9
- package/resizable/resize-handle.component.d.ts +2 -1
- package/resizable/resize-handles.component.d.ts +2 -1
- 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 +2 -1
- package/segment/segment.component.d.ts +2 -1
- 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 -1
- package/slider/slider.component.d.ts +17 -24
- package/space/space.component.d.ts +8 -8
- 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/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/tree/tree-node.component.d.ts +6 -15
- package/tree/tree.component.d.ts +8 -7
- package/tree-select/tree-select.component.d.ts +8 -7
- 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 +4 -3
- package/watermark/watermark.directive.d.ts +7 -9
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ThyTooltipDirective, ThyTooltipModule } from 'ngx-tethys/tooltip';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { inject, ChangeDetectorRef,
|
|
3
|
+
import { inject, ChangeDetectorRef, signal, output, input, numberAttribute, computed, forwardRef, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
|
|
4
4
|
import { CommonModule } from '@angular/common';
|
|
5
5
|
import { ThyButtonIcon, ThyButtonModule } from 'ngx-tethys/button';
|
|
6
6
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
@@ -15,52 +15,50 @@ import { ThyAction, ThyActionModule } from 'ngx-tethys/action';
|
|
|
15
15
|
class ThyArrowSwitcher {
|
|
16
16
|
constructor() {
|
|
17
17
|
this.cd = inject(ChangeDetectorRef);
|
|
18
|
-
this.
|
|
19
|
-
this._isSmallSize = false;
|
|
20
|
-
this.theme = 'default';
|
|
18
|
+
this.disabled = signal(false);
|
|
21
19
|
/**
|
|
22
20
|
* 点击上一条事件
|
|
23
21
|
*/
|
|
24
|
-
this.thyPrevious =
|
|
22
|
+
this.thyPrevious = output();
|
|
25
23
|
/**
|
|
26
24
|
* 点击下一条事件
|
|
27
25
|
*/
|
|
28
|
-
this.thyNext =
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
this.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
26
|
+
this.thyNext = output();
|
|
27
|
+
/**
|
|
28
|
+
* 设置上一条 Hover Tooltip 提示
|
|
29
|
+
*/
|
|
30
|
+
this.thyPreviousTooltip = input();
|
|
31
|
+
/**
|
|
32
|
+
* 设置下一条 Hover Tooltip 提示
|
|
33
|
+
*/
|
|
34
|
+
this.thyNextTooltip = input();
|
|
35
|
+
/**
|
|
36
|
+
* 展示主题
|
|
37
|
+
* @type default | lite
|
|
38
|
+
*/
|
|
39
|
+
this.thyTheme = input('default');
|
|
40
|
+
/**
|
|
41
|
+
* 总条数
|
|
42
|
+
*/
|
|
43
|
+
this.thyTotal = input(undefined, { transform: numberAttribute });
|
|
44
|
+
/**
|
|
45
|
+
* 尺寸大小,默认尺寸为大号,取值为`sm`时展示小号
|
|
46
|
+
*/
|
|
47
|
+
this.thySize = input();
|
|
48
|
+
this.isSmallSize = computed(() => {
|
|
49
|
+
return this.thySize() === 'sm';
|
|
50
|
+
});
|
|
51
|
+
this.index = signal(0);
|
|
52
|
+
this.previousDisabled = computed(() => {
|
|
53
|
+
return this.index() <= 0 || this.disabled();
|
|
54
|
+
});
|
|
55
|
+
this.nextDisabled = computed(() => {
|
|
56
|
+
return this.index() >= this.thyTotal() - 1 || this.disabled();
|
|
57
|
+
});
|
|
58
58
|
}
|
|
59
|
-
ngOnInit() { }
|
|
60
59
|
writeValue(value) {
|
|
61
60
|
if (value >= 0) {
|
|
62
|
-
this.index
|
|
63
|
-
this.getDisabled();
|
|
61
|
+
this.index.set(value);
|
|
64
62
|
}
|
|
65
63
|
this.cd.markForCheck();
|
|
66
64
|
}
|
|
@@ -71,64 +69,40 @@ class ThyArrowSwitcher {
|
|
|
71
69
|
this.onModelTouched = fn;
|
|
72
70
|
}
|
|
73
71
|
setDisabledState(isDisable) {
|
|
74
|
-
this.disabled
|
|
75
|
-
}
|
|
76
|
-
getDisabled() {
|
|
77
|
-
this.previousDisabled = this.index <= 0 || this.disabled;
|
|
78
|
-
this.nextDisabled = this.index >= this.total - 1 || this.disabled;
|
|
72
|
+
this.disabled.set(isDisable);
|
|
79
73
|
}
|
|
80
74
|
onPreviousClick(event) {
|
|
81
|
-
this.index
|
|
82
|
-
this.onModelChange(this.index);
|
|
83
|
-
this.
|
|
84
|
-
this.thyPrevious.emit({ index: this.index, event });
|
|
75
|
+
this.index.set(this.index() - 1);
|
|
76
|
+
this.onModelChange(this.index());
|
|
77
|
+
this.thyPrevious.emit({ index: this.index(), event });
|
|
85
78
|
}
|
|
86
79
|
onNextClick(event) {
|
|
87
|
-
this.index
|
|
88
|
-
this.onModelChange(this.index);
|
|
89
|
-
this.
|
|
90
|
-
this.thyNext.emit({ index: this.index, event });
|
|
80
|
+
this.index.set(this.index() + 1);
|
|
81
|
+
this.onModelChange(this.index());
|
|
82
|
+
this.thyNext.emit({ index: this.index(), event });
|
|
91
83
|
}
|
|
92
84
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyArrowSwitcher, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
93
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyArrowSwitcher, isStandalone: true, selector: "thy-arrow-switcher", inputs: { thyPreviousTooltip: "thyPreviousTooltip", thyNextTooltip: "thyNextTooltip", thyTheme: "thyTheme", thyTotal:
|
|
85
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyArrowSwitcher, isStandalone: true, selector: "thy-arrow-switcher", inputs: { thyPreviousTooltip: { classPropertyName: "thyPreviousTooltip", publicName: "thyPreviousTooltip", isSignal: true, isRequired: false, transformFunction: null }, thyNextTooltip: { classPropertyName: "thyNextTooltip", publicName: "thyNextTooltip", isSignal: true, isRequired: false, transformFunction: null }, thyTheme: { classPropertyName: "thyTheme", publicName: "thyTheme", isSignal: true, isRequired: false, transformFunction: null }, thyTotal: { classPropertyName: "thyTotal", publicName: "thyTotal", isSignal: true, isRequired: false, transformFunction: null }, thySize: { classPropertyName: "thySize", publicName: "thySize", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { thyPrevious: "thyPrevious", thyNext: "thyNext" }, host: { properties: { "class.thy-arrow-switcher-small": "isSmallSize()" }, classAttribute: "thy-arrow-switcher" }, providers: [
|
|
94
86
|
{
|
|
95
87
|
provide: NG_VALUE_ACCESSOR,
|
|
96
88
|
useExisting: forwardRef(() => ThyArrowSwitcher),
|
|
97
89
|
multi: true
|
|
98
90
|
}
|
|
99
|
-
], ngImport: i0, template: "@if (
|
|
91
|
+
], ngImport: i0, template: "@if (thyTheme() === 'lite') {\n <div class=\"switcher-wrapper\">\n <a\n thyAction\n [thyTooltip]=\"thyPreviousTooltip()\"\n href=\"javascript:;\"\n [thyDisabled]=\"previousDisabled()\"\n class=\"mr-2\"\n (click)=\"onPreviousClick($event)\"\n ><thy-icon thyIconName=\"angle-up\"></thy-icon\n ></a>\n <a thyAction [thyTooltip]=\"thyNextTooltip()\" href=\"javascript:;\" [thyDisabled]=\"nextDisabled()\" (click)=\"onNextClick($event)\"\n ><thy-icon thyIconName=\"angle-down\"></thy-icon\n ></a>\n </div>\n} @else {\n <div class=\"switcher-wrapper\">\n <button\n thyButtonIcon=\"angle-left\"\n [thyTooltip]=\"thyPreviousTooltip()\"\n [disabled]=\"previousDisabled()\"\n (click)=\"onPreviousClick($event)\"></button>\n <span>{{ index() + 1 }} / {{ thyTotal() }}</span>\n <button thyButtonIcon=\"angle-right\" [thyTooltip]=\"thyNextTooltip()\" [disabled]=\"nextDisabled()\" (click)=\"onNextClick($event)\"></button>\n </div>\n}\n", dependencies: [{ kind: "component", type: ThyAction, selector: "thy-action, [thyAction]", inputs: ["thyType", "thyIcon", "thyActionIcon", "thyActive", "thyActionActive", "thyTheme", "thyHoverIcon", "thyDisabled"] }, { kind: "directive", type: ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { kind: "component", type: ThyButtonIcon, selector: "thy-button-icon,[thy-button-icon],[thyButtonIcon]", inputs: ["thySize", "thyIcon", "thyButtonIcon", "thyShape", "thyLight", "thyActive", "thyTheme", "thyColor"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
100
92
|
}
|
|
101
93
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyArrowSwitcher, decorators: [{
|
|
102
94
|
type: Component,
|
|
103
|
-
args: [{ selector: 'thy-arrow-switcher',
|
|
95
|
+
args: [{ selector: 'thy-arrow-switcher', host: {
|
|
96
|
+
class: 'thy-arrow-switcher',
|
|
97
|
+
'[class.thy-arrow-switcher-small]': 'isSmallSize()'
|
|
98
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
104
99
|
{
|
|
105
100
|
provide: NG_VALUE_ACCESSOR,
|
|
106
101
|
useExisting: forwardRef(() => ThyArrowSwitcher),
|
|
107
102
|
multi: true
|
|
108
103
|
}
|
|
109
|
-
], imports: [ThyAction, ThyTooltipDirective, ThyIcon, ThyButtonIcon], template: "@if (
|
|
110
|
-
}]
|
|
111
|
-
type: HostBinding,
|
|
112
|
-
args: ['class.thy-arrow-switcher']
|
|
113
|
-
}], _isSmallSize: [{
|
|
114
|
-
type: HostBinding,
|
|
115
|
-
args: ['class.thy-arrow-switcher-small']
|
|
116
|
-
}], thyPrevious: [{
|
|
117
|
-
type: Output
|
|
118
|
-
}], thyNext: [{
|
|
119
|
-
type: Output
|
|
120
|
-
}], thyPreviousTooltip: [{
|
|
121
|
-
type: Input
|
|
122
|
-
}], thyNextTooltip: [{
|
|
123
|
-
type: Input
|
|
124
|
-
}], thyTheme: [{
|
|
125
|
-
type: Input
|
|
126
|
-
}], thyTotal: [{
|
|
127
|
-
type: Input,
|
|
128
|
-
args: [{ transform: numberAttribute }]
|
|
129
|
-
}], thySize: [{
|
|
130
|
-
type: Input
|
|
131
|
-
}] } });
|
|
104
|
+
], imports: [ThyAction, ThyTooltipDirective, ThyIcon, ThyButtonIcon], template: "@if (thyTheme() === 'lite') {\n <div class=\"switcher-wrapper\">\n <a\n thyAction\n [thyTooltip]=\"thyPreviousTooltip()\"\n href=\"javascript:;\"\n [thyDisabled]=\"previousDisabled()\"\n class=\"mr-2\"\n (click)=\"onPreviousClick($event)\"\n ><thy-icon thyIconName=\"angle-up\"></thy-icon\n ></a>\n <a thyAction [thyTooltip]=\"thyNextTooltip()\" href=\"javascript:;\" [thyDisabled]=\"nextDisabled()\" (click)=\"onNextClick($event)\"\n ><thy-icon thyIconName=\"angle-down\"></thy-icon\n ></a>\n </div>\n} @else {\n <div class=\"switcher-wrapper\">\n <button\n thyButtonIcon=\"angle-left\"\n [thyTooltip]=\"thyPreviousTooltip()\"\n [disabled]=\"previousDisabled()\"\n (click)=\"onPreviousClick($event)\"></button>\n <span>{{ index() + 1 }} / {{ thyTotal() }}</span>\n <button thyButtonIcon=\"angle-right\" [thyTooltip]=\"thyNextTooltip()\" [disabled]=\"nextDisabled()\" (click)=\"onNextClick($event)\"></button>\n </div>\n}\n" }]
|
|
105
|
+
}] });
|
|
132
106
|
|
|
133
107
|
class ThyArrowSwitcherModule {
|
|
134
108
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyArrowSwitcherModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngx-tethys-arrow-switcher.mjs","sources":["../../../src/arrow-switcher/arrow-switcher.component.ts","../../../src/arrow-switcher/arrow-switcher.component.html","../../../src/arrow-switcher/module.ts","../../../src/arrow-switcher/ngx-tethys-arrow-switcher.ts"],"sourcesContent":["import {\n Component,\n HostBinding,\n Input,\n Output,\n EventEmitter,\n ChangeDetectionStrategy,\n OnInit,\n ChangeDetectorRef,\n forwardRef,\n numberAttribute,\n inject\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { ThyButtonIcon } from 'ngx-tethys/button';\nimport { ThyIcon } from 'ngx-tethys/icon';\nimport { ThyTooltipDirective } from 'ngx-tethys/tooltip';\nimport { ThyAction } from 'ngx-tethys/action';\n\nexport type ThyArrowSwitcherTheme = 'default' | 'lite';\nexport interface ThyArrowSwitcherEvent {\n index: number;\n event: Event;\n}\n\n/**\n * 上下条切换组件\n * @name thy-arrow-switcher\n * @order 10\n */\n@Component({\n selector: 'thy-arrow-switcher',\n templateUrl: './arrow-switcher.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => ThyArrowSwitcher),\n multi: true\n }\n ],\n imports: [ThyAction, ThyTooltipDirective, ThyIcon, ThyButtonIcon]\n})\nexport class ThyArrowSwitcher implements OnInit, ControlValueAccessor {\n private cd = inject(ChangeDetectorRef);\n\n @HostBinding('class.thy-arrow-switcher') _isArrowSwitcher = true;\n\n @HostBinding('class.thy-arrow-switcher-small') _isSmallSize = false;\n\n total: number;\n\n theme: ThyArrowSwitcherTheme = 'default';\n\n /**\n * 点击上一条事件\n */\n @Output() thyPrevious = new EventEmitter<ThyArrowSwitcherEvent>();\n\n /**\n * 点击下一条事件\n */\n @Output() thyNext = new EventEmitter<ThyArrowSwitcherEvent>();\n\n /**\n * 设置上一条 Hover Tooltip 提示\n */\n @Input() thyPreviousTooltip: string;\n\n /**\n * 设置下一条 Hover Tooltip 提示\n */\n @Input() thyNextTooltip: string;\n\n /**\n * 展示主题\n * @type default | lite\n * @default default\n */\n @Input() set thyTheme(value: ThyArrowSwitcherTheme) {\n this.theme = value;\n }\n\n /**\n * 总条数\n */\n @Input({ transform: numberAttribute })\n set thyTotal(value: number) {\n if (value) {\n this.total = value;\n this.getDisabled();\n }\n }\n\n /**\n * 尺寸大小,默认尺寸为大号,取值为`sm`时展示小号\n */\n @Input()\n set thySize(size: string) {\n if (size === 'sm') {\n this._isSmallSize = true;\n }\n }\n\n index = 0;\n\n disabled = false;\n\n previousDisabled = false;\n\n nextDisabled = false;\n\n private onModelChange: (value: number) => void;\n\n private onModelTouched: () => void;\n\n ngOnInit() {}\n\n writeValue(value: number): void {\n if (value >= 0) {\n this.index = value;\n this.getDisabled();\n }\n this.cd.markForCheck();\n }\n\n registerOnChange(fn: () => void) {\n this.onModelChange = fn;\n }\n\n registerOnTouched(fn: () => void) {\n this.onModelTouched = fn;\n }\n\n setDisabledState(isDisable: boolean) {\n this.disabled = isDisable;\n }\n\n getDisabled() {\n this.previousDisabled = this.index <= 0 || this.disabled;\n this.nextDisabled = this.index >= this.total - 1 || this.disabled;\n }\n\n onPreviousClick(event: Event) {\n this.index--;\n this.onModelChange(this.index);\n this.getDisabled();\n this.thyPrevious.emit({ index: this.index, event });\n }\n\n onNextClick(event: Event) {\n this.index++;\n this.onModelChange(this.index);\n this.getDisabled();\n this.thyNext.emit({ index: this.index, event });\n }\n}\n","@if (theme === 'lite') {\n <div class=\"switcher-wrapper\">\n <a\n thyAction\n [thyTooltip]=\"thyPreviousTooltip\"\n href=\"javascript:;\"\n [thyDisabled]=\"previousDisabled\"\n class=\"mr-2\"\n (click)=\"onPreviousClick($event)\"\n ><thy-icon thyIconName=\"angle-up\"></thy-icon\n ></a>\n <a thyAction [thyTooltip]=\"thyNextTooltip\" href=\"javascript:;\" [thyDisabled]=\"nextDisabled\" (click)=\"onNextClick($event)\"\n ><thy-icon thyIconName=\"angle-down\"></thy-icon\n ></a>\n </div>\n} @else {\n <div class=\"switcher-wrapper\">\n <button\n thyButtonIcon=\"angle-left\"\n [thyTooltip]=\"thyPreviousTooltip\"\n [disabled]=\"previousDisabled\"\n (click)=\"onPreviousClick($event)\"\n ></button>\n <span>{{ index + 1 }} / {{ total }}</span>\n <button thyButtonIcon=\"angle-right\" [thyTooltip]=\"thyNextTooltip\" [disabled]=\"nextDisabled\" (click)=\"onNextClick($event)\"></button>\n </div>\n}\n\n","import { ThyTooltipModule } from 'ngx-tethys/tooltip';\nimport { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ThyButtonModule } from 'ngx-tethys/button';\nimport { ThyArrowSwitcher } from './arrow-switcher.component';\nimport { ThyIconModule } from 'ngx-tethys/icon';\nimport { ThyActionModule } from 'ngx-tethys/action';\n\n@NgModule({\n imports: [CommonModule, ThyButtonModule, ThyIconModule, ThyActionModule, ThyTooltipModule, ThyArrowSwitcher],\n exports: [ThyArrowSwitcher]\n})\nexport class ThyArrowSwitcherModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAyBA;;;;AAIG;MAcU,gBAAgB,CAAA;AAb7B,IAAA,WAAA,GAAA;AAcY,QAAA,IAAA,CAAA,EAAE,GAAG,MAAM,CAAC,iBAAiB,CAAC;QAEG,IAAgB,CAAA,gBAAA,GAAG,IAAI;QAEjB,IAAY,CAAA,YAAA,GAAG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CAAC,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,eAAe,EAAE,gBAAgB,EAAE,gBAAgB,CAAC;oBAC5G,OAAO,EAAE,CAAC,gBAAgB;AAC7B,iBAAA;;;ACXD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ngx-tethys-arrow-switcher.mjs","sources":["../../../src/arrow-switcher/arrow-switcher.component.ts","../../../src/arrow-switcher/arrow-switcher.component.html","../../../src/arrow-switcher/module.ts","../../../src/arrow-switcher/ngx-tethys-arrow-switcher.ts"],"sourcesContent":["import {\n Component,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n forwardRef,\n numberAttribute,\n inject,\n input,\n output,\n computed,\n Signal,\n WritableSignal,\n signal\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { ThyButtonIcon } from 'ngx-tethys/button';\nimport { ThyIcon } from 'ngx-tethys/icon';\nimport { ThyTooltipDirective } from 'ngx-tethys/tooltip';\nimport { ThyAction } from 'ngx-tethys/action';\n\nexport type ThyArrowSwitcherTheme = 'default' | 'lite';\nexport interface ThyArrowSwitcherEvent {\n index: number;\n event: Event;\n}\n\n/**\n * 上下条切换组件\n * @name thy-arrow-switcher\n * @order 10\n */\n@Component({\n selector: 'thy-arrow-switcher',\n templateUrl: './arrow-switcher.component.html',\n host: {\n class: 'thy-arrow-switcher',\n '[class.thy-arrow-switcher-small]': 'isSmallSize()'\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => ThyArrowSwitcher),\n multi: true\n }\n ],\n imports: [ThyAction, ThyTooltipDirective, ThyIcon, ThyButtonIcon]\n})\nexport class ThyArrowSwitcher implements ControlValueAccessor {\n private cd = inject(ChangeDetectorRef);\n\n private disabled: WritableSignal<boolean> = signal(false);\n\n /**\n * 点击上一条事件\n */\n readonly thyPrevious = output<ThyArrowSwitcherEvent>();\n\n /**\n * 点击下一条事件\n */\n readonly thyNext = output<ThyArrowSwitcherEvent>();\n\n /**\n * 设置上一条 Hover Tooltip 提示\n */\n readonly thyPreviousTooltip = input<string>();\n\n /**\n * 设置下一条 Hover Tooltip 提示\n */\n readonly thyNextTooltip = input<string>();\n\n /**\n * 展示主题\n * @type default | lite\n */\n readonly thyTheme = input<ThyArrowSwitcherTheme>('default');\n\n /**\n * 总条数\n */\n readonly thyTotal = input<number, unknown>(undefined, { transform: numberAttribute });\n\n /**\n * 尺寸大小,默认尺寸为大号,取值为`sm`时展示小号\n */\n readonly thySize = input<string>();\n\n readonly isSmallSize: Signal<boolean> = computed(() => {\n return this.thySize() === 'sm';\n });\n\n index: WritableSignal<number> = signal(0);\n\n readonly previousDisabled = computed(() => {\n return this.index() <= 0 || this.disabled();\n });\n\n readonly nextDisabled = computed(() => {\n return this.index() >= this.thyTotal() - 1 || this.disabled();\n });\n\n private onModelChange: (value: number) => void;\n\n private onModelTouched: () => void;\n\n writeValue(value: number): void {\n if (value >= 0) {\n this.index.set(value);\n }\n this.cd.markForCheck();\n }\n\n registerOnChange(fn: () => void) {\n this.onModelChange = fn;\n }\n\n registerOnTouched(fn: () => void) {\n this.onModelTouched = fn;\n }\n\n setDisabledState(isDisable: boolean) {\n this.disabled.set(isDisable);\n }\n\n onPreviousClick(event: Event) {\n this.index.set(this.index() - 1);\n this.onModelChange(this.index());\n\n this.thyPrevious.emit({ index: this.index(), event });\n }\n\n onNextClick(event: Event) {\n this.index.set(this.index() + 1);\n this.onModelChange(this.index());\n\n this.thyNext.emit({ index: this.index(), event });\n }\n}\n","@if (thyTheme() === 'lite') {\n <div class=\"switcher-wrapper\">\n <a\n thyAction\n [thyTooltip]=\"thyPreviousTooltip()\"\n href=\"javascript:;\"\n [thyDisabled]=\"previousDisabled()\"\n class=\"mr-2\"\n (click)=\"onPreviousClick($event)\"\n ><thy-icon thyIconName=\"angle-up\"></thy-icon\n ></a>\n <a thyAction [thyTooltip]=\"thyNextTooltip()\" href=\"javascript:;\" [thyDisabled]=\"nextDisabled()\" (click)=\"onNextClick($event)\"\n ><thy-icon thyIconName=\"angle-down\"></thy-icon\n ></a>\n </div>\n} @else {\n <div class=\"switcher-wrapper\">\n <button\n thyButtonIcon=\"angle-left\"\n [thyTooltip]=\"thyPreviousTooltip()\"\n [disabled]=\"previousDisabled()\"\n (click)=\"onPreviousClick($event)\"></button>\n <span>{{ index() + 1 }} / {{ thyTotal() }}</span>\n <button thyButtonIcon=\"angle-right\" [thyTooltip]=\"thyNextTooltip()\" [disabled]=\"nextDisabled()\" (click)=\"onNextClick($event)\"></button>\n </div>\n}\n","import { ThyTooltipModule } from 'ngx-tethys/tooltip';\nimport { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ThyButtonModule } from 'ngx-tethys/button';\nimport { ThyArrowSwitcher } from './arrow-switcher.component';\nimport { ThyIconModule } from 'ngx-tethys/icon';\nimport { ThyActionModule } from 'ngx-tethys/action';\n\n@NgModule({\n imports: [CommonModule, ThyButtonModule, ThyIconModule, ThyActionModule, ThyTooltipModule, ThyArrowSwitcher],\n exports: [ThyArrowSwitcher]\n})\nexport class ThyArrowSwitcherModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AA0BA;;;;AAIG;MAkBU,gBAAgB,CAAA;AAjB7B,IAAA,WAAA,GAAA;AAkBY,QAAA,IAAA,CAAA,EAAE,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAE9B,QAAA,IAAA,CAAA,QAAQ,GAA4B,MAAM,CAAC,KAAK,CAAC;AAEzD;;AAEG;QACM,IAAW,CAAA,WAAA,GAAG,MAAM,EAAyB;AAEtD;;AAEG;QACM,IAAO,CAAA,OAAA,GAAG,MAAM,EAAyB;AAElD;;AAEG;QACM,IAAkB,CAAA,kBAAA,GAAG,KAAK,EAAU;AAE7C;;AAEG;QACM,IAAc,CAAA,cAAA,GAAG,KAAK,EAAU;AAEzC;;;AAGG;AACM,QA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A,EAAA,CAAA,CAAA;+GAEjB,sBAAsB,EAAA,OAAA,EAAA,CAHrB,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,eAAe,EAAE,gBAAgB,EAAE,gBAAgB,CAAA,EAAA,CAAA,CAAA;;2FAGlG,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBAJlC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE,CAAC,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,eAAe,EAAE,gBAAgB,EAAE,gBAAgB,CAAC;oBAC5G,OAAO,EAAE,CAAC,gBAAgB;AAC7B,iBAAA;;;ACXD;;AAEG;;;;"}
|
|
@@ -2,7 +2,7 @@ import { FlexibleConnectedPositionStrategy, Overlay, ScrollDispatcher, OverlayCo
|
|
|
2
2
|
import { PortalModule, ComponentPortal } from '@angular/cdk/portal';
|
|
3
3
|
import { NgClass, DOCUMENT, CommonModule } from '@angular/common';
|
|
4
4
|
import * as i0 from '@angular/core';
|
|
5
|
-
import { inject, NgZone, ChangeDetectorRef,
|
|
5
|
+
import { inject, NgZone, ChangeDetectorRef, viewChild, input, output, ContentChildren, ChangeDetectionStrategy, Component, InjectionToken, ElementRef, EventEmitter, ViewChild, Injector, Injectable, ViewContainerRef, computed, numberAttribute, HostBinding, Directive, NgModule } from '@angular/core';
|
|
6
6
|
import { FormsModule } from '@angular/forms';
|
|
7
7
|
import { ThyEmpty, ThyEmptyModule } from 'ngx-tethys/empty';
|
|
8
8
|
import { ThyIconModule } from 'ngx-tethys/icon';
|
|
@@ -13,7 +13,7 @@ import { Subject, defer, merge, timer, of, fromEvent } from 'rxjs';
|
|
|
13
13
|
import { take, switchMap, startWith, takeUntil, filter, map, delay } from 'rxjs/operators';
|
|
14
14
|
import { SelectionModel } from '@angular/cdk/collections';
|
|
15
15
|
import { ActiveDescendantKeyManager } from '@angular/cdk/a11y';
|
|
16
|
-
import { coerceBooleanProperty,
|
|
16
|
+
import { coerceBooleanProperty, ESCAPE, ENTER, UP_ARROW, DOWN_ARROW, TAB } from 'ngx-tethys/util';
|
|
17
17
|
import { injectLocale } from 'ngx-tethys/i18n';
|
|
18
18
|
import { injectPanelEmptyIcon, ThyAbstractOverlayConfig, ThyAbstractOverlayContainer, ThyClickDispatcher, ThyPortalOutlet, ThyAbstractOverlayRef, ThyAbstractInternalOverlayRef, ThyAbstractOverlayService, getFlexiblePositions, ScrollToService } from 'ngx-tethys/core';
|
|
19
19
|
import { Directionality } from '@angular/cdk/bidi';
|
|
@@ -21,6 +21,7 @@ import { coerceElement, coerceArray } from '@angular/cdk/coercion';
|
|
|
21
21
|
import { Platform } from '@angular/cdk/platform';
|
|
22
22
|
import { ViewportRuler } from '@angular/cdk/scrolling';
|
|
23
23
|
import { state, style, trigger } from '@angular/animations';
|
|
24
|
+
import { outputToObservable } from '@angular/core/rxjs-interop';
|
|
24
25
|
|
|
25
26
|
/**
|
|
26
27
|
* 自动完成组件
|
|
@@ -37,6 +38,9 @@ class ThyAutocomplete {
|
|
|
37
38
|
this.mode = '';
|
|
38
39
|
this.isEmptyOptions = false;
|
|
39
40
|
this.isOpened = false;
|
|
41
|
+
this.contentTemplateRef = viewChild('contentTemplate');
|
|
42
|
+
// scroll element container
|
|
43
|
+
this.optionsContainer = viewChild('panel');
|
|
40
44
|
this.optionSelectionChanges = defer(() => {
|
|
41
45
|
if (this.options) {
|
|
42
46
|
return merge(...this.options.map(option => option.selectionChange));
|
|
@@ -47,28 +51,28 @@ class ThyAutocomplete {
|
|
|
47
51
|
* 空选项时的文本
|
|
48
52
|
* @default 没有任何数据
|
|
49
53
|
*/
|
|
50
|
-
this.thyEmptyText = this.locale().empty;
|
|
54
|
+
this.thyEmptyText = input(this.locale().empty);
|
|
55
|
+
/**
|
|
56
|
+
* 是否默认高亮第一个选项
|
|
57
|
+
*/
|
|
58
|
+
this.thyAutoActiveFirstOption = input(false, { transform: coerceBooleanProperty });
|
|
51
59
|
/**
|
|
52
60
|
* 被选中时调用,参数包含选中项的 value 值
|
|
53
|
-
* @type EventEmitter<ThyOptionSelectionChangeEvent>
|
|
54
61
|
*/
|
|
55
|
-
this.thyOptionSelected =
|
|
62
|
+
this.thyOptionSelected = output();
|
|
56
63
|
/**
|
|
57
64
|
* 只读,展开下拉菜单的回调
|
|
58
|
-
* @type EventEmitter<void>
|
|
59
65
|
*/
|
|
60
|
-
this.thyOpened =
|
|
66
|
+
this.thyOpened = output();
|
|
61
67
|
/**
|
|
62
68
|
* 只读,关闭下拉菜单的回调
|
|
63
|
-
* @type EventEmitter<void>
|
|
64
69
|
*/
|
|
65
|
-
this.thyClosed =
|
|
70
|
+
this.thyClosed = output();
|
|
66
71
|
/** Emits whenever an option is activated using the keyboard. */
|
|
67
72
|
/**
|
|
68
73
|
* 只读,option 激活状态变化时,调用此函数
|
|
69
|
-
* @type EventEmitter<ThyAutocompleteActivatedEvent>
|
|
70
74
|
*/
|
|
71
|
-
this.thyOptionActivated =
|
|
75
|
+
this.thyOptionActivated = output();
|
|
72
76
|
}
|
|
73
77
|
ngOnInit() {
|
|
74
78
|
this.setDropDownClass();
|
|
@@ -153,12 +157,12 @@ class ThyAutocomplete {
|
|
|
153
157
|
this.ngUnsubscribe$.complete();
|
|
154
158
|
}
|
|
155
159
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyAutocomplete, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
156
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyAutocomplete, isStandalone: true, selector: "thy-autocomplete", inputs: { thyEmptyText: "thyEmptyText", thyAutoActiveFirstOption:
|
|
160
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyAutocomplete, isStandalone: true, selector: "thy-autocomplete", inputs: { thyEmptyText: { classPropertyName: "thyEmptyText", publicName: "thyEmptyText", isSignal: true, isRequired: false, transformFunction: null }, thyAutoActiveFirstOption: { classPropertyName: "thyAutoActiveFirstOption", publicName: "thyAutoActiveFirstOption", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { thyOptionSelected: "thyOptionSelected", thyOpened: "thyOpened", thyClosed: "thyClosed", thyOptionActivated: "thyOptionActivated" }, providers: [
|
|
157
161
|
{
|
|
158
162
|
provide: THY_OPTION_PARENT_COMPONENT,
|
|
159
163
|
useExisting: ThyAutocomplete
|
|
160
164
|
}
|
|
161
|
-
], queries: [{ propertyName: "options", predicate: ThyOption, descendants: true }], viewQueries: [{ propertyName: "contentTemplateRef", first: true, predicate: ["contentTemplate"], descendants: true,
|
|
165
|
+
], queries: [{ propertyName: "options", predicate: ThyOption, descendants: true }], viewQueries: [{ propertyName: "contentTemplateRef", first: true, predicate: ["contentTemplate"], descendants: true, isSignal: true }, { propertyName: "optionsContainer", first: true, predicate: ["panel"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template #contentTemplate>\n <div thyStopPropagation [ngClass]=\"dropDownClass\">\n <div #panel class=\"thy-select-dropdown-options\">\n <ng-content></ng-content>\n @if (isEmptyOptions) {\n <thy-empty [thyMessage]=\"thyEmptyText()\" [thyIconName]=\"emptyIcon()\"></thy-empty>\n }\n </div>\n </div>\n</ng-template>\n", dependencies: [{ kind: "directive", type: ThyStopPropagationDirective, selector: "[thyStopPropagation]", inputs: ["thyStopPropagation"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: ThyEmpty, selector: "thy-empty", inputs: ["thyMessage", "thyTranslationKey", "thyTranslationValues", "thyEntityName", "thyEntityNameTranslateKey", "thyIconName", "thySize", "thyMarginTop", "thyTopAuto", "thyContainer", "thyImageUrl", "thyImageLoading", "thyImageFetchPriority", "thyDescription"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
162
166
|
}
|
|
163
167
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyAutocomplete, decorators: [{
|
|
164
168
|
type: Component,
|
|
@@ -167,29 +171,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
167
171
|
provide: THY_OPTION_PARENT_COMPONENT,
|
|
168
172
|
useExisting: ThyAutocomplete
|
|
169
173
|
}
|
|
170
|
-
], imports: [ThyStopPropagationDirective, NgClass, ThyEmpty], template: "<ng-template #contentTemplate>\n <div thyStopPropagation [ngClass]=\"dropDownClass\">\n <div #panel class=\"thy-select-dropdown-options\">\n <ng-content></ng-content>\n @if (isEmptyOptions) {\n <thy-empty [thyMessage]=\"thyEmptyText\" [thyIconName]=\"emptyIcon()\"></thy-empty>\n }\n </div>\n </div>\n</ng-template>\n" }]
|
|
171
|
-
}], propDecorators: {
|
|
172
|
-
type: ViewChild,
|
|
173
|
-
args: ['contentTemplate', { static: true }]
|
|
174
|
-
}], optionsContainer: [{
|
|
175
|
-
type: ViewChild,
|
|
176
|
-
args: ['panel']
|
|
177
|
-
}], options: [{
|
|
174
|
+
], imports: [ThyStopPropagationDirective, NgClass, ThyEmpty], template: "<ng-template #contentTemplate>\n <div thyStopPropagation [ngClass]=\"dropDownClass\">\n <div #panel class=\"thy-select-dropdown-options\">\n <ng-content></ng-content>\n @if (isEmptyOptions) {\n <thy-empty [thyMessage]=\"thyEmptyText()\" [thyIconName]=\"emptyIcon()\"></thy-empty>\n }\n </div>\n </div>\n</ng-template>\n" }]
|
|
175
|
+
}], propDecorators: { options: [{
|
|
178
176
|
type: ContentChildren,
|
|
179
177
|
args: [ThyOption, { descendants: true }]
|
|
180
|
-
}], thyEmptyText: [{
|
|
181
|
-
type: Input
|
|
182
|
-
}], thyAutoActiveFirstOption: [{
|
|
183
|
-
type: Input,
|
|
184
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
185
|
-
}], thyOptionSelected: [{
|
|
186
|
-
type: Output
|
|
187
|
-
}], thyOpened: [{
|
|
188
|
-
type: Output
|
|
189
|
-
}], thyClosed: [{
|
|
190
|
-
type: Output
|
|
191
|
-
}], thyOptionActivated: [{
|
|
192
|
-
type: Output
|
|
193
178
|
}] } });
|
|
194
179
|
|
|
195
180
|
const animationBody = [state('void, exit', style({ opacity: 0, transform: 'scale(0.1)' })), state('enter', style({ transform: 'none' }))];
|
|
@@ -420,57 +405,51 @@ class ThyAutocompleteTriggerDirective {
|
|
|
420
405
|
this.cdr = inject(ChangeDetectorRef);
|
|
421
406
|
this.closeKeyEventStream = new Subject();
|
|
422
407
|
this.panelOpened = false;
|
|
408
|
+
/**
|
|
409
|
+
* 下拉菜单组件实例。已废弃,请使用 thyAutocomplete
|
|
410
|
+
* @type thyAutocompleteComponent
|
|
411
|
+
* @deprecated
|
|
412
|
+
*/
|
|
413
|
+
this.thyAutocompleteComponent = input();
|
|
414
|
+
/**
|
|
415
|
+
* 下拉菜单组件实例
|
|
416
|
+
* @type thyAutocompleteComponent
|
|
417
|
+
*/
|
|
418
|
+
this.thyAutocomplete = input();
|
|
419
|
+
this.autocompleteComponent = computed(() => {
|
|
420
|
+
return this.thyAutocomplete() || this.thyAutocompleteComponent();
|
|
421
|
+
});
|
|
423
422
|
/**
|
|
424
423
|
* 弹出框默认 offset
|
|
425
|
-
* @type number
|
|
426
424
|
*/
|
|
427
|
-
this.thyOffset = 4;
|
|
425
|
+
this.thyOffset = input(4, { transform: numberAttribute });
|
|
426
|
+
/**
|
|
427
|
+
* 下拉菜单的宽度,不设置默认与输入框同宽
|
|
428
|
+
*/
|
|
429
|
+
this.thyAutocompleteWidth = input(undefined, { transform: numberAttribute });
|
|
428
430
|
/**
|
|
429
431
|
* 下拉菜单的显示位置,'top' | 'topLeft' | 'topRight' | 'bottom' | 'bottomLeft' | 'bottomRight' | 'left' | 'leftTop' | 'leftBottom' | 'right' | 'rightTop' | 'rightBottom'
|
|
430
|
-
* @type string
|
|
431
432
|
*/
|
|
432
|
-
this.thyPlacement = 'bottomLeft';
|
|
433
|
+
this.thyPlacement = input('bottomLeft');
|
|
433
434
|
/**
|
|
434
435
|
* 是否允许聚焦时打开下拉菜单
|
|
435
|
-
* @type boolean
|
|
436
436
|
*/
|
|
437
|
-
this.thyIsFocusOpen = true;
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
set autocompleteComponent(data) {
|
|
445
|
-
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
446
|
-
warnDeprecation(`The property thyAutocompleteComponent will be deprecated, please use thyAutocomplete instead.`);
|
|
447
|
-
}
|
|
448
|
-
this._autocompleteComponent = data;
|
|
449
|
-
}
|
|
450
|
-
/**
|
|
451
|
-
* 下拉菜单组件实例
|
|
452
|
-
* @type thyAutocompleteComponent
|
|
453
|
-
*/
|
|
454
|
-
set autocomplete(data) {
|
|
455
|
-
this._autocompleteComponent = data;
|
|
456
|
-
}
|
|
457
|
-
get autocompleteComponent() {
|
|
458
|
-
return this._autocompleteComponent;
|
|
459
|
-
}
|
|
460
|
-
get activeOption() {
|
|
461
|
-
if (this.autocompleteComponent && this.autocompleteComponent.keyManager) {
|
|
462
|
-
return this.autocompleteComponent.keyManager.activeItem;
|
|
463
|
-
}
|
|
464
|
-
return null;
|
|
437
|
+
this.thyIsFocusOpen = input(true, { transform: coerceBooleanProperty });
|
|
438
|
+
this.activeOption = computed(() => {
|
|
439
|
+
if (this.autocompleteComponent() && this.autocompleteComponent().keyManager) {
|
|
440
|
+
return this.autocompleteComponent().keyManager.activeItem;
|
|
441
|
+
}
|
|
442
|
+
return null;
|
|
443
|
+
});
|
|
465
444
|
}
|
|
466
445
|
get panelClosingActions() {
|
|
467
|
-
return merge(this.autocompleteComponent.thyOptionSelected, this.autocompleteComponent.keyManager.tabOut.pipe(filter(() => this.panelOpened)), this.closeKeyEventStream, this.getOutsideClickStream(), this.overlayRef ? this.overlayRef.detachments().pipe(filter(() => this.panelOpened)) : of()).pipe(
|
|
446
|
+
return merge(outputToObservable(this.autocompleteComponent().thyOptionSelected), this.autocompleteComponent().keyManager.tabOut.pipe(filter(() => this.panelOpened)), this.closeKeyEventStream, this.getOutsideClickStream(), this.overlayRef ? this.overlayRef.detachments().pipe(filter(() => this.panelOpened)) : of()).pipe(
|
|
468
447
|
// Normalize the output so we return a consistent type.
|
|
469
448
|
map(event => (event instanceof ThyOptionSelectionChangeEvent ? event : null)));
|
|
470
449
|
}
|
|
471
450
|
ngOnInit() { }
|
|
472
451
|
onFocus() {
|
|
473
|
-
if (this.canOpen() && this.thyIsFocusOpen) {
|
|
452
|
+
if (this.canOpen() && this.thyIsFocusOpen()) {
|
|
474
453
|
this.openPanel();
|
|
475
454
|
}
|
|
476
455
|
}
|
|
@@ -483,23 +462,24 @@ class ThyAutocompleteTriggerDirective {
|
|
|
483
462
|
if (keyCode === ESCAPE) {
|
|
484
463
|
event.preventDefault();
|
|
485
464
|
}
|
|
486
|
-
|
|
487
|
-
|
|
465
|
+
const autocompleteComponent = this.autocompleteComponent();
|
|
466
|
+
if (this.activeOption() && keyCode === ENTER && this.panelOpened) {
|
|
467
|
+
this.activeOption().selectViaInteraction();
|
|
488
468
|
this.resetActiveItem();
|
|
489
469
|
event.preventDefault();
|
|
490
470
|
}
|
|
491
|
-
else if (
|
|
492
|
-
const prevActiveItem =
|
|
471
|
+
else if (autocompleteComponent) {
|
|
472
|
+
const prevActiveItem = autocompleteComponent.keyManager.activeItem;
|
|
493
473
|
const isArrowKey = keyCode === UP_ARROW || keyCode === DOWN_ARROW;
|
|
494
474
|
if (this.panelOpened || keyCode === TAB) {
|
|
495
|
-
|
|
475
|
+
autocompleteComponent.keyManager.onKeydown(event);
|
|
496
476
|
}
|
|
497
477
|
else if (isArrowKey && this.canOpen()) {
|
|
498
478
|
this.openPanel();
|
|
499
479
|
}
|
|
500
|
-
if ((isArrowKey ||
|
|
501
|
-
|
|
502
|
-
ScrollToService.scrollToElement(
|
|
480
|
+
if ((isArrowKey || autocompleteComponent.keyManager.activeItem !== prevActiveItem) &&
|
|
481
|
+
autocompleteComponent.keyManager.activeItem) {
|
|
482
|
+
ScrollToService.scrollToElement(autocompleteComponent.keyManager.activeItem.element.nativeElement, autocompleteComponent.optionsContainer().nativeElement);
|
|
503
483
|
}
|
|
504
484
|
}
|
|
505
485
|
}
|
|
@@ -527,7 +507,7 @@ class ThyAutocompleteTriggerDirective {
|
|
|
527
507
|
}
|
|
528
508
|
});
|
|
529
509
|
this.panelOpened = true;
|
|
530
|
-
this.autocompleteComponent.open();
|
|
510
|
+
this.autocompleteComponent().open();
|
|
531
511
|
}
|
|
532
512
|
closePanel() {
|
|
533
513
|
if (this.autocompleteRef) {
|
|
@@ -540,15 +520,16 @@ class ThyAutocompleteTriggerDirective {
|
|
|
540
520
|
const config = Object.assign({
|
|
541
521
|
origin: this.elementRef.nativeElement,
|
|
542
522
|
viewContainerRef: this.viewContainerRef,
|
|
543
|
-
placement: this.thyPlacement,
|
|
544
|
-
offset: this.thyOffset,
|
|
523
|
+
placement: this.thyPlacement(),
|
|
524
|
+
offset: this.thyOffset(),
|
|
545
525
|
scrollStrategy: this.overlay.scrollStrategies.reposition(),
|
|
546
|
-
width: this.thyAutocompleteWidth || this.elementRef.nativeElement.clientWidth
|
|
526
|
+
width: this.thyAutocompleteWidth() || this.elementRef.nativeElement.clientWidth
|
|
547
527
|
});
|
|
548
|
-
|
|
528
|
+
const autocompleteComponent = this.autocompleteComponent();
|
|
529
|
+
this.autocompleteRef = this.autocompleteService.open(autocompleteComponent.contentTemplateRef(), config);
|
|
549
530
|
this.autocompleteRef.afterClosed().subscribe(() => {
|
|
550
531
|
this.panelOpened = false;
|
|
551
|
-
|
|
532
|
+
autocompleteComponent.close();
|
|
552
533
|
});
|
|
553
534
|
// delay 200ms to prevent emit document click rightnow
|
|
554
535
|
this.autocompleteRef
|
|
@@ -565,7 +546,7 @@ class ThyAutocompleteTriggerDirective {
|
|
|
565
546
|
*/
|
|
566
547
|
subscribeToClosingActions() {
|
|
567
548
|
const firstStable = this.ngZone.onStable.asObservable().pipe(take(1));
|
|
568
|
-
const optionChanges = this.autocompleteComponent.options.changes.pipe(
|
|
549
|
+
const optionChanges = this.autocompleteComponent().options.changes.pipe(
|
|
569
550
|
// Defer emitting to the stream until the next tick, because changing
|
|
570
551
|
// bindings in here will cause "changed after checked" errors.
|
|
571
552
|
delay(0));
|
|
@@ -618,7 +599,9 @@ class ThyAutocompleteTriggerDirective {
|
|
|
618
599
|
return !element.readOnly && !element.disabled;
|
|
619
600
|
}
|
|
620
601
|
resetActiveItem() {
|
|
621
|
-
this.autocompleteComponent
|
|
602
|
+
const autocompleteComponent = this.autocompleteComponent();
|
|
603
|
+
const index = autocompleteComponent.thyAutoActiveFirstOption() ? 0 : -1;
|
|
604
|
+
autocompleteComponent.keyManager.setActiveItem(index);
|
|
622
605
|
}
|
|
623
606
|
destroyPanel() {
|
|
624
607
|
if (this.overlayRef) {
|
|
@@ -632,7 +615,7 @@ class ThyAutocompleteTriggerDirective {
|
|
|
632
615
|
this.destroyPanel();
|
|
633
616
|
}
|
|
634
617
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyAutocompleteTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
635
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
618
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: ThyAutocompleteTriggerDirective, isStandalone: true, selector: "input[thyAutocompleteTrigger], textarea[thyAutocompleteTrigger], thy-input[thyAutocompleteTrigger], thy-input-search[thyAutocompleteTrigger], input[thyAutocomplete], textarea[thyAutocomplete], thy-input[thyAutocomplete], thy-input-search[thyAutocomplete]", inputs: { thyAutocompleteComponent: { classPropertyName: "thyAutocompleteComponent", publicName: "thyAutocompleteComponent", isSignal: true, isRequired: false, transformFunction: null }, thyAutocomplete: { classPropertyName: "thyAutocomplete", publicName: "thyAutocomplete", isSignal: true, isRequired: false, transformFunction: null }, thyOffset: { classPropertyName: "thyOffset", publicName: "thyOffset", isSignal: true, isRequired: false, transformFunction: null }, thyAutocompleteWidth: { classPropertyName: "thyAutocompleteWidth", publicName: "thyAutocompleteWidth", isSignal: true, isRequired: false, transformFunction: null }, thyPlacement: { classPropertyName: "thyPlacement", publicName: "thyPlacement", isSignal: true, isRequired: false, transformFunction: null }, thyIsFocusOpen: { classPropertyName: "thyIsFocusOpen", publicName: "thyIsFocusOpen", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "input": "handleInput($event)", "focusin": "onFocus()", "keydown": "onKeydown($event)" }, properties: { "class.thy-autocomplete-opened": "this.panelOpened" } }, exportAs: ["thyAutocompleteTrigger", "thyAutocomplete"], ngImport: i0 }); }
|
|
636
619
|
}
|
|
637
620
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyAutocompleteTriggerDirective, decorators: [{
|
|
638
621
|
type: Directive,
|
|
@@ -648,23 +631,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
648
631
|
}], propDecorators: { panelOpened: [{
|
|
649
632
|
type: HostBinding,
|
|
650
633
|
args: [`class.thy-autocomplete-opened`]
|
|
651
|
-
}], autocompleteComponent: [{
|
|
652
|
-
type: Input,
|
|
653
|
-
args: ['thyAutocompleteComponent']
|
|
654
|
-
}], autocomplete: [{
|
|
655
|
-
type: Input,
|
|
656
|
-
args: ['thyAutocomplete']
|
|
657
|
-
}], thyOffset: [{
|
|
658
|
-
type: Input,
|
|
659
|
-
args: [{ transform: numberAttribute }]
|
|
660
|
-
}], thyAutocompleteWidth: [{
|
|
661
|
-
type: Input,
|
|
662
|
-
args: [{ transform: numberAttribute }]
|
|
663
|
-
}], thyPlacement: [{
|
|
664
|
-
type: Input
|
|
665
|
-
}], thyIsFocusOpen: [{
|
|
666
|
-
type: Input,
|
|
667
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
668
634
|
}] } });
|
|
669
635
|
|
|
670
636
|
class ThyAutocompleteModule {
|