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,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CdkConnectedOverlay, CdkOverlayOrigin, OverlayModule } from '@angular/cdk/overlay';
|
|
2
2
|
import { NgTemplateOutlet, NgClass, isPlatformBrowser, NgStyle, CommonModule } from '@angular/common';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import {
|
|
4
|
+
import { input, computed, output, ViewEncapsulation, ChangeDetectionStrategy, Component, HostListener, Injectable, inject, PLATFORM_ID, ChangeDetectorRef, ElementRef, NgZone, TemplateRef, numberAttribute, viewChildren, viewChild, effect, forwardRef, Input, NgModule } from '@angular/core';
|
|
5
5
|
import * as i1 from '@angular/forms';
|
|
6
6
|
import { FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
7
7
|
import { ThyCheckbox, ThyCheckboxModule } from 'ngx-tethys/checkbox';
|
|
@@ -14,8 +14,8 @@ import { ThyRadio } from 'ngx-tethys/radio';
|
|
|
14
14
|
import { coerceBooleanProperty, isEmpty, isArray, get, isUndefinedOrNull, helpers, set, elementMatchClosest } from 'ngx-tethys/util';
|
|
15
15
|
import { ThyBreadcrumb, ThyBreadcrumbItem } from 'ngx-tethys/breadcrumb';
|
|
16
16
|
import { useHostRenderer } from '@tethys/cdk/dom';
|
|
17
|
-
import { TabIndexDisabledControlValueAccessorMixin,
|
|
18
|
-
import { Subject,
|
|
17
|
+
import { TabIndexDisabledControlValueAccessorMixin, ThyClickDispatcher, injectPanelEmptyIcon, EXPANDED_DROPDOWN_POSITIONS, ScrollToService, DebounceTimeWrapper, scaleYMotion } from 'ngx-tethys/core';
|
|
18
|
+
import { Subject, BehaviorSubject, timer, Observable } from 'rxjs';
|
|
19
19
|
import { map, debounceTime, takeUntil, take, distinctUntilChanged, filter } from 'rxjs/operators';
|
|
20
20
|
import { ThyDivider } from 'ngx-tethys/divider';
|
|
21
21
|
import { SelectionModel } from '@angular/cdk/collections';
|
|
@@ -25,134 +25,78 @@ import { injectLocale } from 'ngx-tethys/i18n';
|
|
|
25
25
|
* @internal
|
|
26
26
|
*/
|
|
27
27
|
class ThyCascaderOptionComponent {
|
|
28
|
-
get disabled() {
|
|
29
|
-
return this.option.disabled;
|
|
30
|
-
}
|
|
31
|
-
get expand() {
|
|
32
|
-
return this.option && !this.option.isLeaf;
|
|
33
|
-
}
|
|
34
28
|
constructor() {
|
|
35
|
-
this.
|
|
36
|
-
this.
|
|
37
|
-
this.
|
|
38
|
-
this.
|
|
39
|
-
this.active = false;
|
|
40
|
-
this.halfSelected = false;
|
|
41
|
-
this.selected = false;
|
|
42
|
-
this.
|
|
43
|
-
this.
|
|
29
|
+
this.option = input();
|
|
30
|
+
this.multiple = input(false, { transform: coerceBooleanProperty });
|
|
31
|
+
this.isOnlySelectLeaf = input(true, { transform: coerceBooleanProperty });
|
|
32
|
+
this.optionRender = input();
|
|
33
|
+
this.active = input(false, { transform: coerceBooleanProperty });
|
|
34
|
+
this.halfSelected = input(false, { transform: coerceBooleanProperty });
|
|
35
|
+
this.selected = input(false, { transform: coerceBooleanProperty });
|
|
36
|
+
this.disabled = computed(() => this.option().disabled);
|
|
37
|
+
this.expand = computed(() => this.option() && !this.option().isLeaf);
|
|
38
|
+
this.labelProperty = input('label');
|
|
39
|
+
this.toggleSelectChange = output();
|
|
44
40
|
}
|
|
45
41
|
ngOnInit() { }
|
|
46
42
|
toggleOption(value) {
|
|
47
43
|
this.toggleSelectChange.emit(value);
|
|
48
44
|
}
|
|
49
45
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyCascaderOptionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
50
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyCascaderOptionComponent, isStandalone: true, selector: "[thy-cascader-option]", inputs: { option: "option", multiple:
|
|
46
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyCascaderOptionComponent, isStandalone: true, selector: "[thy-cascader-option]", inputs: { option: { classPropertyName: "option", publicName: "option", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, isOnlySelectLeaf: { classPropertyName: "isOnlySelectLeaf", publicName: "isOnlySelectLeaf", isSignal: true, isRequired: false, transformFunction: null }, optionRender: { classPropertyName: "optionRender", publicName: "optionRender", isSignal: true, isRequired: false, transformFunction: null }, active: { classPropertyName: "active", publicName: "active", isSignal: true, isRequired: false, transformFunction: null }, halfSelected: { classPropertyName: "halfSelected", publicName: "halfSelected", isSignal: true, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null }, labelProperty: { classPropertyName: "labelProperty", publicName: "labelProperty", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { toggleSelectChange: "toggleSelectChange" }, host: { properties: { "class.thy-cascader-menu-item-active": "active()", "class.thy-cascader-menu-item-disabled": "disabled()", "class.thy-cascader-menu-item-expand": "expand()" }, classAttribute: "d-flex thy-cascader-menu-item" }, ngImport: i0, template: "@if (!option().readonly) {\n <div thyStopPropagation>\n @if (multiple()) {\n <label\n class=\"mr-2\"\n thyCheckbox\n [disabled]=\"option().disabled\"\n [name]=\"option().value || option()._id\"\n [thyIndeterminate]=\"halfSelected()\"\n [ngModel]=\"selected()\"\n (ngModelChange)=\"toggleOption($event)\"></label>\n }\n @if (!multiple() && !isOnlySelectLeaf()) {\n <label\n class=\"mr-2\"\n thyRadio\n [disabled]=\"option().disabled\"\n [name]=\"option().value || option()._id\"\n [ngModel]=\"selected()\"\n (ngModelChange)=\"toggleOption($event)\"></label>\n }\n </div>\n}\n\n@if (!optionRender()) {\n <span thyFlexibleText [thyTooltipContent]=\"option()[labelProperty()] || ''\"> {{ option()[labelProperty()] || '' }}</span>\n} @else {\n <ng-template [ngTemplateOutlet]=\"optionRender()\" [ngTemplateOutletContext]=\"{ option: option() }\"></ng-template>\n}\n\n@if (!option().isLeaf || (option().children && option().children.length) || option().loading) {\n <span class=\"wtf wtf-angle-right thy-cascader-menu-item-expand-icon\"> </span>\n}\n", dependencies: [{ kind: "component", type: ThyFlexibleText, selector: "thy-flexible-text,[thyFlexibleText]", inputs: ["thyTooltipTrigger", "thyContainerClass", "thyTooltipContent", "thyTooltipPlacement", "thyTooltipOffset"], exportAs: ["thyFlexibleText"] }, { kind: "component", type: ThyCheckbox, selector: "thy-checkbox,[thy-checkbox],[thyCheckbox]", inputs: ["thyIndeterminate"] }, { kind: "component", type: ThyRadio, selector: "[thy-radio],[thyRadio]", inputs: ["thyValue"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: ThyStopPropagationDirective, selector: "[thyStopPropagation]", inputs: ["thyStopPropagation"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
51
47
|
}
|
|
52
48
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyCascaderOptionComponent, decorators: [{
|
|
53
49
|
type: Component,
|
|
54
|
-
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, selector: '[thy-cascader-option]', imports: [ThyFlexibleText, ThyCheckbox, ThyRadio, FormsModule, ThyStopPropagationDirective, NgTemplateOutlet],
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
type: Input,
|
|
62
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
63
|
-
}], optionRender: [{
|
|
64
|
-
type: Input
|
|
65
|
-
}], class: [{
|
|
66
|
-
type: HostBinding,
|
|
67
|
-
args: ['class']
|
|
68
|
-
}], item: [{
|
|
69
|
-
type: HostBinding,
|
|
70
|
-
args: ['class.thy-cascader-menu-item']
|
|
71
|
-
}], active: [{
|
|
72
|
-
type: HostBinding,
|
|
73
|
-
args: ['class.thy-cascader-menu-item-active']
|
|
74
|
-
}, {
|
|
75
|
-
type: Input,
|
|
76
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
77
|
-
}], halfSelected: [{
|
|
78
|
-
type: Input,
|
|
79
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
80
|
-
}], selected: [{
|
|
81
|
-
type: Input,
|
|
82
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
83
|
-
}], disabled: [{
|
|
84
|
-
type: HostBinding,
|
|
85
|
-
args: ['class.thy-cascader-menu-item-disabled']
|
|
86
|
-
}], expand: [{
|
|
87
|
-
type: HostBinding,
|
|
88
|
-
args: ['class.thy-cascader-menu-item-expand']
|
|
89
|
-
}], labelProperty: [{
|
|
90
|
-
type: Input
|
|
91
|
-
}], toggleSelectChange: [{
|
|
92
|
-
type: Output
|
|
93
|
-
}] } });
|
|
50
|
+
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, selector: '[thy-cascader-option]', imports: [ThyFlexibleText, ThyCheckbox, ThyRadio, FormsModule, ThyStopPropagationDirective, NgTemplateOutlet], host: {
|
|
51
|
+
class: 'd-flex thy-cascader-menu-item',
|
|
52
|
+
'[class.thy-cascader-menu-item-active]': 'active()',
|
|
53
|
+
'[class.thy-cascader-menu-item-disabled]': 'disabled()',
|
|
54
|
+
'[class.thy-cascader-menu-item-expand]': 'expand()'
|
|
55
|
+
}, template: "@if (!option().readonly) {\n <div thyStopPropagation>\n @if (multiple()) {\n <label\n class=\"mr-2\"\n thyCheckbox\n [disabled]=\"option().disabled\"\n [name]=\"option().value || option()._id\"\n [thyIndeterminate]=\"halfSelected()\"\n [ngModel]=\"selected()\"\n (ngModelChange)=\"toggleOption($event)\"></label>\n }\n @if (!multiple() && !isOnlySelectLeaf()) {\n <label\n class=\"mr-2\"\n thyRadio\n [disabled]=\"option().disabled\"\n [name]=\"option().value || option()._id\"\n [ngModel]=\"selected()\"\n (ngModelChange)=\"toggleOption($event)\"></label>\n }\n </div>\n}\n\n@if (!optionRender()) {\n <span thyFlexibleText [thyTooltipContent]=\"option()[labelProperty()] || ''\"> {{ option()[labelProperty()] || '' }}</span>\n} @else {\n <ng-template [ngTemplateOutlet]=\"optionRender()\" [ngTemplateOutletContext]=\"{ option: option() }\"></ng-template>\n}\n\n@if (!option().isLeaf || (option().children && option().children.length) || option().loading) {\n <span class=\"wtf wtf-angle-right thy-cascader-menu-item-expand-icon\"> </span>\n}\n" }]
|
|
56
|
+
}], ctorParameters: () => [] });
|
|
94
57
|
|
|
95
58
|
/**
|
|
96
59
|
* @internal
|
|
97
60
|
*/
|
|
98
61
|
class ThyCascaderSearchOptionComponent {
|
|
99
62
|
toggleClick($event) {
|
|
100
|
-
if (this.multiple) {
|
|
63
|
+
if (this.multiple()) {
|
|
101
64
|
return;
|
|
102
65
|
}
|
|
103
|
-
this.toggleSelectChange.emit(this.option);
|
|
66
|
+
this.toggleSelectChange.emit(this.option());
|
|
104
67
|
}
|
|
105
68
|
constructor() {
|
|
106
|
-
this.
|
|
107
|
-
this.
|
|
108
|
-
this.
|
|
109
|
-
this.active = false;
|
|
110
|
-
this.
|
|
69
|
+
this.option = input();
|
|
70
|
+
this.multiple = input(false, { transform: coerceBooleanProperty });
|
|
71
|
+
this.isOnlySelectLeaf = input(true, { transform: coerceBooleanProperty });
|
|
72
|
+
this.active = input(false, { transform: coerceBooleanProperty });
|
|
73
|
+
this.optionRender = input(undefined);
|
|
74
|
+
this.toggleSelectChange = output();
|
|
111
75
|
}
|
|
112
76
|
ngOnInit() { }
|
|
113
77
|
clickCheckbox(event) {
|
|
114
78
|
// 已选中的在搜索情况下不能取消选择
|
|
115
|
-
if (this.active) {
|
|
79
|
+
if (this.active()) {
|
|
116
80
|
event.preventDefault();
|
|
117
81
|
event.stopPropagation();
|
|
118
82
|
}
|
|
119
83
|
}
|
|
120
84
|
toggleOption(value) {
|
|
121
|
-
this.toggleSelectChange.emit(this.option);
|
|
85
|
+
this.toggleSelectChange.emit(this.option());
|
|
122
86
|
}
|
|
123
87
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyCascaderSearchOptionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
124
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyCascaderSearchOptionComponent, isStandalone: true, selector: "[thy-cascader-search-option]", inputs: { option: "option", multiple:
|
|
88
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyCascaderSearchOptionComponent, isStandalone: true, selector: "[thy-cascader-search-option]", inputs: { option: { classPropertyName: "option", publicName: "option", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, isOnlySelectLeaf: { classPropertyName: "isOnlySelectLeaf", publicName: "isOnlySelectLeaf", isSignal: true, isRequired: false, transformFunction: null }, active: { classPropertyName: "active", publicName: "active", isSignal: true, isRequired: false, transformFunction: null }, optionRender: { classPropertyName: "optionRender", publicName: "optionRender", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { toggleSelectChange: "toggleSelectChange" }, host: { listeners: { "click": "toggleClick($event)" }, properties: { "class.multiple": "multiple()", "class.active": "active()" }, classAttribute: "thy-cascader-search-list-item px-4 d-flex align-items-center cursor-pointer" }, ngImport: i0, template: "@if (multiple()) {\n <label\n class=\"mr-1\"\n thyCheckbox\n [disabled]=\"option().thyRowValue[option().thyRowValue.length - 1].disabled\"\n [ngModel]=\"active()\"\n (click)=\"clickCheckbox($event)\"\n (ngModelChange)=\"toggleOption($event)\"\n [thyLabelText]=\"''\"></label>\n}\n\n<thy-breadcrumb thySeparator=\"slash\">\n @for (label of option().labelList; track $index; let i = $index) {\n <thy-breadcrumb-item [ngClass]=\"{ 'text-muted': !(option().thyRowValue[i].isLeaf && isOnlySelectLeaf()) }\">\n @if (!optionRender()) {\n <span class=\"option-label-item\" thyFlexibleText [thyTooltipContent]=\"label\">{{ label }}</span>\n } @else {\n <ng-template [ngTemplateOutlet]=\"optionRender()\" [ngTemplateOutletContext]=\"{ option: option().thyRowValue[i] }\"> </ng-template>\n }\n </thy-breadcrumb-item>\n }\n</thy-breadcrumb>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: ThyFlexibleText, selector: "thy-flexible-text,[thyFlexibleText]", inputs: ["thyTooltipTrigger", "thyContainerClass", "thyTooltipContent", "thyTooltipPlacement", "thyTooltipOffset"], exportAs: ["thyFlexibleText"] }, { kind: "component", type: ThyCheckbox, selector: "thy-checkbox,[thy-checkbox],[thyCheckbox]", inputs: ["thyIndeterminate"] }, { kind: "component", type: ThyBreadcrumb, selector: "thy-breadcrumb", inputs: ["thyIcon", "thySeparator", "thyItems", "thyMaxCount", "thyExpandable"], exportAs: ["ThyBreadcrumb"] }, { kind: "component", type: ThyBreadcrumbItem, selector: "thy-breadcrumb-item,[thyBreadcrumbItem]", exportAs: ["ThyBreadcrumbItem"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
125
89
|
}
|
|
126
90
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyCascaderSearchOptionComponent, decorators: [{
|
|
127
91
|
type: Component,
|
|
128
|
-
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, selector: '[thy-cascader-search-option]', imports: [NgClass, ThyFlexibleText, ThyCheckbox, ThyBreadcrumb, ThyBreadcrumbItem, FormsModule, NgTemplateOutlet],
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}, {
|
|
135
|
-
type: Input,
|
|
136
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
137
|
-
}], isOnlySelectLeaf: [{
|
|
138
|
-
type: Input,
|
|
139
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
140
|
-
}], className: [{
|
|
141
|
-
type: HostBinding,
|
|
142
|
-
args: ['class']
|
|
143
|
-
}], active: [{
|
|
144
|
-
type: HostBinding,
|
|
145
|
-
args: ['class.active']
|
|
146
|
-
}, {
|
|
147
|
-
type: Input,
|
|
148
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
149
|
-
}], optionRender: [{
|
|
150
|
-
type: Input
|
|
151
|
-
}], toggleClick: [{
|
|
92
|
+
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, selector: '[thy-cascader-search-option]', imports: [NgClass, ThyFlexibleText, ThyCheckbox, ThyBreadcrumb, ThyBreadcrumbItem, FormsModule, NgTemplateOutlet], host: {
|
|
93
|
+
class: 'thy-cascader-search-list-item px-4 d-flex align-items-center cursor-pointer',
|
|
94
|
+
'[class.multiple]': 'multiple()',
|
|
95
|
+
'[class.active]': 'active()'
|
|
96
|
+
}, template: "@if (multiple()) {\n <label\n class=\"mr-1\"\n thyCheckbox\n [disabled]=\"option().thyRowValue[option().thyRowValue.length - 1].disabled\"\n [ngModel]=\"active()\"\n (click)=\"clickCheckbox($event)\"\n (ngModelChange)=\"toggleOption($event)\"\n [thyLabelText]=\"''\"></label>\n}\n\n<thy-breadcrumb thySeparator=\"slash\">\n @for (label of option().labelList; track $index; let i = $index) {\n <thy-breadcrumb-item [ngClass]=\"{ 'text-muted': !(option().thyRowValue[i].isLeaf && isOnlySelectLeaf()) }\">\n @if (!optionRender()) {\n <span class=\"option-label-item\" thyFlexibleText [thyTooltipContent]=\"label\">{{ label }}</span>\n } @else {\n <ng-template [ngTemplateOutlet]=\"optionRender()\" [ngTemplateOutletContext]=\"{ option: option().thyRowValue[i] }\"> </ng-template>\n }\n </thy-breadcrumb-item>\n }\n</thy-breadcrumb>\n" }]
|
|
97
|
+
}], ctorParameters: () => [], propDecorators: { toggleClick: [{
|
|
152
98
|
type: HostListener,
|
|
153
99
|
args: ['click', ['$event']]
|
|
154
|
-
}], toggleSelectChange: [{
|
|
155
|
-
type: Output
|
|
156
100
|
}] } });
|
|
157
101
|
|
|
158
102
|
const defaultDisplayRender = (label) => label.join(' / ');
|
|
@@ -712,72 +656,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
712
656
|
* @name thy-cascader
|
|
713
657
|
*/
|
|
714
658
|
class ThyCascader extends TabIndexDisabledControlValueAccessorMixin {
|
|
715
|
-
/**
|
|
716
|
-
* 数据项
|
|
717
|
-
* @type ThyCascaderOption[]
|
|
718
|
-
* @default []
|
|
719
|
-
*/
|
|
720
|
-
set thyOptions(options) {
|
|
721
|
-
const columns = options && options.length ? [options] : [];
|
|
722
|
-
this.thyCascaderService.initColumns(columns);
|
|
723
|
-
if (this.thyCascaderService.defaultValue && columns.length) {
|
|
724
|
-
this.thyCascaderService.initOptions(0);
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
|
-
/**
|
|
728
|
-
* 自定义选项
|
|
729
|
-
* @type ThyCascaderOption[]
|
|
730
|
-
* @default []
|
|
731
|
-
*/
|
|
732
|
-
set thyCustomOptions(options) {
|
|
733
|
-
this.thyCascaderService.customOptions = (options || []).map(item => ({ ...item }));
|
|
734
|
-
}
|
|
735
|
-
get thyCustomOptions() {
|
|
736
|
-
return this.thyCascaderService.customOptions;
|
|
737
|
-
}
|
|
738
|
-
/**
|
|
739
|
-
* 用户自定义模板
|
|
740
|
-
* @type TemplateRef
|
|
741
|
-
*/
|
|
742
|
-
set thyLabelRender(value) {
|
|
743
|
-
this.labelRenderTpl = value;
|
|
744
|
-
this.isLabelRenderTemplate = value instanceof TemplateRef;
|
|
745
|
-
this.thyCascaderService.setCascaderOptions({ isLabelRenderTemplate: this.isLabelRenderTemplate });
|
|
746
|
-
}
|
|
747
|
-
get thyLabelRender() {
|
|
748
|
-
return this.labelRenderTpl;
|
|
749
|
-
}
|
|
750
|
-
/**
|
|
751
|
-
* 用于动态加载选项
|
|
752
|
-
*/
|
|
753
|
-
set thyLoadData(value) {
|
|
754
|
-
this.thyCascaderService.setCascaderOptions({ loadData: value });
|
|
755
|
-
}
|
|
756
|
-
get thyLoadData() {
|
|
757
|
-
return this.thyCascaderService?.cascaderOptions?.loadData;
|
|
758
|
-
}
|
|
759
|
-
/**
|
|
760
|
-
* 自定义浮层类名
|
|
761
|
-
* @type string
|
|
762
|
-
*/
|
|
763
|
-
set thyMenuClassName(value) {
|
|
764
|
-
this.menuClassName = value;
|
|
765
|
-
this.setMenuClass();
|
|
766
|
-
}
|
|
767
|
-
get thyMenuClassName() {
|
|
768
|
-
return this.menuClassName;
|
|
769
|
-
}
|
|
770
|
-
/**
|
|
771
|
-
* 自定义浮层列类名
|
|
772
|
-
* @type string
|
|
773
|
-
*/
|
|
774
|
-
set thyColumnClassName(value) {
|
|
775
|
-
this.columnClassName = value;
|
|
776
|
-
this.setMenuClass();
|
|
777
|
-
}
|
|
778
|
-
get thyColumnClassName() {
|
|
779
|
-
return this.columnClassName;
|
|
780
|
-
}
|
|
781
659
|
/**
|
|
782
660
|
* 是否只读
|
|
783
661
|
* @default false
|
|
@@ -788,27 +666,8 @@ class ThyCascader extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
788
666
|
get thyDisabled() {
|
|
789
667
|
return this.disabled;
|
|
790
668
|
}
|
|
791
|
-
/**
|
|
792
|
-
* 空状态下的展示文字
|
|
793
|
-
* @default 暂无可选项
|
|
794
|
-
*/
|
|
795
|
-
set thyEmptyStateText(value) {
|
|
796
|
-
this.emptyStateText = value;
|
|
797
|
-
}
|
|
798
|
-
/**
|
|
799
|
-
* 是否多选
|
|
800
|
-
* @type boolean
|
|
801
|
-
* @default false
|
|
802
|
-
*/
|
|
803
|
-
set thyMultiple(value) {
|
|
804
|
-
this.isMultiple = value;
|
|
805
|
-
this.thyCascaderService.setCascaderOptions({ isMultiple: value });
|
|
806
|
-
}
|
|
807
|
-
get thyMultiple() {
|
|
808
|
-
return this.isMultiple;
|
|
809
|
-
}
|
|
810
669
|
get selected() {
|
|
811
|
-
return this.thyMultiple ? this.thyCascaderService.selectionModel.selected : this.thyCascaderService.selectionModel.selected[0];
|
|
670
|
+
return this.thyMultiple() ? this.thyCascaderService.selectionModel.selected : this.thyCascaderService.selectionModel.selected[0];
|
|
812
671
|
}
|
|
813
672
|
get searchResultList() {
|
|
814
673
|
return this.thyCascaderService.searchResultList;
|
|
@@ -819,22 +678,231 @@ class ThyCascader extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
819
678
|
get columns() {
|
|
820
679
|
return this.thyCascaderService.columns;
|
|
821
680
|
}
|
|
681
|
+
constructor() {
|
|
682
|
+
super();
|
|
683
|
+
this.platformId = inject(PLATFORM_ID);
|
|
684
|
+
this.cdr = inject(ChangeDetectorRef);
|
|
685
|
+
this.elementRef = inject(ElementRef);
|
|
686
|
+
this.thyClickDispatcher = inject(ThyClickDispatcher);
|
|
687
|
+
this.ngZone = inject(NgZone);
|
|
688
|
+
this.thyCascaderService = inject(ThyCascaderService);
|
|
689
|
+
this.locale = injectLocale('cascader');
|
|
690
|
+
this.emptyIcon = injectPanelEmptyIcon();
|
|
691
|
+
/**
|
|
692
|
+
* 选项的实际值的属性名
|
|
693
|
+
*/
|
|
694
|
+
this.thyValueProperty = input('value');
|
|
695
|
+
/**
|
|
696
|
+
* 选项的显示值的属性名
|
|
697
|
+
*/
|
|
698
|
+
this.thyLabelProperty = input('label');
|
|
699
|
+
/**
|
|
700
|
+
* 描述输入字段预期值的简短的提示信息
|
|
701
|
+
*/
|
|
702
|
+
this.thyPlaceholder = input(this.locale().placeholder);
|
|
703
|
+
/**
|
|
704
|
+
* 控制大小(5种)
|
|
705
|
+
* @type 'xs' | 'sm' | 'md' | 'lg' | ''
|
|
706
|
+
*/
|
|
707
|
+
this.thySize = input('');
|
|
708
|
+
/**
|
|
709
|
+
* 数据项
|
|
710
|
+
* @type ThyCascaderOption[]
|
|
711
|
+
*/
|
|
712
|
+
this.thyOptions = input([]);
|
|
713
|
+
/**
|
|
714
|
+
* 自定义选项
|
|
715
|
+
* @type ThyCascaderOption[]
|
|
716
|
+
*/
|
|
717
|
+
this.thyCustomOptions = input([]);
|
|
718
|
+
/**
|
|
719
|
+
* 点击父级菜单选项时,可通过该函数判断是否允许值的变化
|
|
720
|
+
*/
|
|
721
|
+
this.thyChangeOn = input();
|
|
722
|
+
/**
|
|
723
|
+
* 点击项时,表单是否动态展示数据项
|
|
724
|
+
* @type boolean
|
|
725
|
+
*/
|
|
726
|
+
this.thyChangeOnSelect = input(false, { transform: coerceBooleanProperty });
|
|
727
|
+
/**
|
|
728
|
+
* 显示输入框
|
|
729
|
+
* @type boolean
|
|
730
|
+
*/
|
|
731
|
+
this.thyShowInput = input(true, { transform: coerceBooleanProperty });
|
|
732
|
+
/**
|
|
733
|
+
* 用户自定义选项模板
|
|
734
|
+
* @type TemplateRef
|
|
735
|
+
*/
|
|
736
|
+
this.thyOptionRender = input();
|
|
737
|
+
/**
|
|
738
|
+
* 用户自定义模板
|
|
739
|
+
* @type TemplateRef
|
|
740
|
+
*/
|
|
741
|
+
this.thyLabelRender = input();
|
|
742
|
+
this.isLabelRenderTemplate = computed(() => {
|
|
743
|
+
return this.thyLabelRender() instanceof TemplateRef;
|
|
744
|
+
});
|
|
745
|
+
/**
|
|
746
|
+
/**
|
|
747
|
+
* 用于动态加载选项
|
|
748
|
+
*/
|
|
749
|
+
this.thyLoadData = input();
|
|
750
|
+
/**
|
|
751
|
+
* 控制触发状态, 支持 `click` | `hover`
|
|
752
|
+
* @type ThyCascaderTriggerType | ThyCascaderTriggerType[]
|
|
753
|
+
*/
|
|
754
|
+
this.thyTriggerAction = input(['click']);
|
|
755
|
+
/**
|
|
756
|
+
* 鼠标经过下方列表项时,是否自动展开列表,支持 `click` | `hover`
|
|
757
|
+
* @type ThyCascaderExpandTrigger | ThyCascaderExpandTrigger[]
|
|
758
|
+
*/
|
|
759
|
+
this.thyExpandTriggerAction = input(['click']);
|
|
760
|
+
/**
|
|
761
|
+
* 自定义浮层样式
|
|
762
|
+
*/
|
|
763
|
+
this.thyMenuStyle = input();
|
|
764
|
+
/**
|
|
765
|
+
* 自定义搜索样式
|
|
766
|
+
*/
|
|
767
|
+
this.thySearchListStyle = input();
|
|
768
|
+
/**
|
|
769
|
+
* 自定义浮层类名
|
|
770
|
+
* @type string
|
|
771
|
+
*/
|
|
772
|
+
this.thyMenuClassName = input();
|
|
773
|
+
/**
|
|
774
|
+
* 自定义浮层列类名
|
|
775
|
+
* @type string
|
|
776
|
+
*/
|
|
777
|
+
this.thyColumnClassName = input();
|
|
778
|
+
this.menuColumnCls = computed(() => {
|
|
779
|
+
return {
|
|
780
|
+
[`${this.prefixCls}-menu`]: true,
|
|
781
|
+
[`${this.thyColumnClassName()}`]: this.thyColumnClassName()
|
|
782
|
+
};
|
|
783
|
+
});
|
|
784
|
+
this.disabled = false;
|
|
785
|
+
/**
|
|
786
|
+
* 空状态下的展示文字
|
|
787
|
+
* @default 暂无可选项
|
|
788
|
+
*/
|
|
789
|
+
this.thyEmptyStateText = input();
|
|
790
|
+
/**
|
|
791
|
+
* 是否多选
|
|
792
|
+
* @type boolean
|
|
793
|
+
*/
|
|
794
|
+
this.thyMultiple = input(false, { transform: coerceBooleanProperty });
|
|
795
|
+
/**
|
|
796
|
+
* 设置多选时最大显示的标签数量,0 表示不限制
|
|
797
|
+
* @type number
|
|
798
|
+
*/
|
|
799
|
+
this.thyMaxTagCount = input(0, { transform: numberAttribute });
|
|
800
|
+
/**
|
|
801
|
+
* 是否仅允许选择叶子项
|
|
802
|
+
* @default true
|
|
803
|
+
*/
|
|
804
|
+
this.thyIsOnlySelectLeaf = input(true, { transform: coerceBooleanProperty });
|
|
805
|
+
/**
|
|
806
|
+
* 初始化时,是否展开面板
|
|
807
|
+
*/
|
|
808
|
+
this.thyAutoExpand = input(false, { transform: coerceBooleanProperty });
|
|
809
|
+
/**
|
|
810
|
+
* 是否支持搜索
|
|
811
|
+
*/
|
|
812
|
+
this.thyShowSearch = input(false, { transform: coerceBooleanProperty });
|
|
813
|
+
/**
|
|
814
|
+
* 多选选中项的展示方式,默认为空,渲染文字模板,传入tag,渲染展示模板,
|
|
815
|
+
*/
|
|
816
|
+
this.thyPreset = input('');
|
|
817
|
+
/**
|
|
818
|
+
* 是否有幕布
|
|
819
|
+
*/
|
|
820
|
+
this.thyHasBackdrop = input(true, { transform: coerceBooleanProperty });
|
|
821
|
+
/**
|
|
822
|
+
* 值发生变化时触发,返回选择项的值
|
|
823
|
+
* @type EventEmitter<any[]>
|
|
824
|
+
*/
|
|
825
|
+
this.thyChange = output();
|
|
826
|
+
/**
|
|
827
|
+
* 值发生变化时触发,返回选择项列表
|
|
828
|
+
* @type EventEmitter<ThyCascaderOption[]>
|
|
829
|
+
*/
|
|
830
|
+
this.thySelectionChange = output();
|
|
831
|
+
/**
|
|
832
|
+
* 选择选项时触发
|
|
833
|
+
*/
|
|
834
|
+
this.thySelect = output();
|
|
835
|
+
/**
|
|
836
|
+
* @private 暂无实现
|
|
837
|
+
*/
|
|
838
|
+
this.thyDeselect = output();
|
|
839
|
+
/**
|
|
840
|
+
* 清空选项时触发
|
|
841
|
+
*/
|
|
842
|
+
this.thyClear = output();
|
|
843
|
+
/**
|
|
844
|
+
* 下拉选项展开和折叠状态事件
|
|
845
|
+
*/
|
|
846
|
+
this.thyExpandStatusChange = output();
|
|
847
|
+
this.cascaderOptions = viewChildren('cascaderOptions', { read: ElementRef });
|
|
848
|
+
this.cascaderOptionContainers = viewChildren('cascaderOptionContainers', { read: ElementRef });
|
|
849
|
+
this.cdkConnectedOverlay = viewChild(CdkConnectedOverlay);
|
|
850
|
+
this.trigger = viewChild('trigger');
|
|
851
|
+
this.input = viewChild('input');
|
|
852
|
+
this.menu = viewChild('menu');
|
|
853
|
+
this.dropDownPosition = 'bottom';
|
|
854
|
+
this.menuVisible = false;
|
|
855
|
+
this.prefixCls = 'thy-cascader';
|
|
856
|
+
this.destroy$ = new Subject();
|
|
857
|
+
this.hostRenderer = useHostRenderer();
|
|
858
|
+
this.menuMinWidth = 122;
|
|
859
|
+
this.searchText$ = new BehaviorSubject('');
|
|
860
|
+
this.isShowSearchPanel = false;
|
|
861
|
+
/**
|
|
862
|
+
* 解决搜索&多选的情况下,点击搜索项会导致 panel 闪烁
|
|
863
|
+
* 由于点击后,thySelectedOptions变化,导致 thySelectControl
|
|
864
|
+
* 又会触发 searchFilter 函数,即 resetSearch 会执行
|
|
865
|
+
* 会导致恢复级联状态再变为搜索状态
|
|
866
|
+
*/
|
|
867
|
+
this.isSelectingSearchState = false;
|
|
868
|
+
this.selectOption = (option, index) => {
|
|
869
|
+
const isOnlySelectLeaf = this.thyIsOnlySelectLeaf();
|
|
870
|
+
if ((option.isLeaf || !isOnlySelectLeaf) && !this.thyMultiple()) {
|
|
871
|
+
this.afterChangeFn = () => {
|
|
872
|
+
this.setMenuVisible(false);
|
|
873
|
+
this.onTouchedFn();
|
|
874
|
+
};
|
|
875
|
+
}
|
|
876
|
+
this.thySelect.emit({ option, index });
|
|
877
|
+
const isOptionCanSelect = this.thyChangeOnSelect() && !this.thyMultiple();
|
|
878
|
+
if (option.isLeaf || !isOnlySelectLeaf || isOptionCanSelect || this.shouldPerformSelection(option, index)) {
|
|
879
|
+
this.thyCascaderService.selectOption(option, index);
|
|
880
|
+
}
|
|
881
|
+
};
|
|
882
|
+
effect(() => {
|
|
883
|
+
const options = this.thyOptions();
|
|
884
|
+
const columns = options && options.length ? [options] : [];
|
|
885
|
+
this.thyCascaderService.initColumns(columns);
|
|
886
|
+
if (this.thyCascaderService.defaultValue && columns.length) {
|
|
887
|
+
this.thyCascaderService.initOptions(0);
|
|
888
|
+
}
|
|
889
|
+
});
|
|
890
|
+
effect(() => {
|
|
891
|
+
this.thyCascaderService.customOptions = (this.thyCustomOptions() || []).map(item => ({ ...item }));
|
|
892
|
+
});
|
|
893
|
+
effect(() => {
|
|
894
|
+
this.setCascaderOptions();
|
|
895
|
+
});
|
|
896
|
+
effect(() => {
|
|
897
|
+
this.setMenuClass();
|
|
898
|
+
});
|
|
899
|
+
}
|
|
822
900
|
ngOnInit() {
|
|
823
901
|
this.setClassMap();
|
|
824
|
-
this.setMenuClass();
|
|
825
|
-
this.setMenuColumnClass();
|
|
826
902
|
this.setLabelClass();
|
|
827
903
|
this.initPosition();
|
|
828
904
|
this.initSearch();
|
|
829
|
-
|
|
830
|
-
labelProperty: this.thyLabelProperty,
|
|
831
|
-
valueProperty: this.thyValueProperty,
|
|
832
|
-
isMultiple: this.isMultiple,
|
|
833
|
-
isOnlySelectLeaf: this.thyIsOnlySelectLeaf,
|
|
834
|
-
isLabelRenderTemplate: this.isLabelRenderTemplate,
|
|
835
|
-
loadData: this.thyLoadData
|
|
836
|
-
};
|
|
837
|
-
this.thyCascaderService.setCascaderOptions(options);
|
|
905
|
+
this.setCascaderOptions();
|
|
838
906
|
this.thyCascaderService.cascaderValueChange().subscribe(options => {
|
|
839
907
|
if (!options.isValueEqual) {
|
|
840
908
|
this.onChangeFn(options.value);
|
|
@@ -855,7 +923,7 @@ class ThyCascader extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
855
923
|
.pipe(takeUntil(this.destroy$))
|
|
856
924
|
.subscribe(event => {
|
|
857
925
|
if (!this.elementRef.nativeElement.contains(event.target) &&
|
|
858
|
-
!this.menu?.nativeElement.contains(event.target) &&
|
|
926
|
+
!this.menu()?.nativeElement.contains(event.target) &&
|
|
859
927
|
this.menuVisible) {
|
|
860
928
|
this.ngZone.run(() => {
|
|
861
929
|
this.closeMenu();
|
|
@@ -866,17 +934,23 @@ class ThyCascader extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
866
934
|
}
|
|
867
935
|
}
|
|
868
936
|
ngAfterContentInit() {
|
|
869
|
-
if (this.thyAutoExpand) {
|
|
937
|
+
if (this.thyAutoExpand()) {
|
|
870
938
|
timer(0).subscribe(() => {
|
|
871
939
|
this.cdr.markForCheck();
|
|
872
940
|
this.setMenuVisible(true);
|
|
873
941
|
});
|
|
874
942
|
}
|
|
875
943
|
}
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
this.
|
|
879
|
-
|
|
944
|
+
setCascaderOptions() {
|
|
945
|
+
const options = {
|
|
946
|
+
labelProperty: this.thyLabelProperty(),
|
|
947
|
+
valueProperty: this.thyValueProperty(),
|
|
948
|
+
isMultiple: this.thyMultiple(),
|
|
949
|
+
isOnlySelectLeaf: this.thyIsOnlySelectLeaf(),
|
|
950
|
+
isLabelRenderTemplate: this.isLabelRenderTemplate(),
|
|
951
|
+
loadData: this.thyLoadData()
|
|
952
|
+
};
|
|
953
|
+
this.thyCascaderService.setCascaderOptions(options);
|
|
880
954
|
}
|
|
881
955
|
initPosition() {
|
|
882
956
|
const cascaderPosition = EXPANDED_DROPDOWN_POSITIONS.map(item => {
|
|
@@ -886,7 +960,7 @@ class ThyCascader extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
886
960
|
}
|
|
887
961
|
writeValue(value) {
|
|
888
962
|
this.thyCascaderService.writeCascaderValue(value);
|
|
889
|
-
if (this.
|
|
963
|
+
if (this.thyMultiple()) {
|
|
890
964
|
this.cdr.detectChanges();
|
|
891
965
|
}
|
|
892
966
|
}
|
|
@@ -911,17 +985,19 @@ class ThyCascader extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
911
985
|
}
|
|
912
986
|
attached() {
|
|
913
987
|
this.cdr.detectChanges();
|
|
914
|
-
this.cdkConnectedOverlay
|
|
988
|
+
this.cdkConnectedOverlay()
|
|
989
|
+
.positionChange.pipe(take(1), takeUntil(this.destroy$))
|
|
990
|
+
.subscribe(() => {
|
|
915
991
|
this.scrollActiveElementIntoView();
|
|
916
992
|
});
|
|
917
993
|
}
|
|
918
994
|
scrollActiveElementIntoView() {
|
|
919
995
|
if (!isEmpty(this.thyCascaderService.selectedOptions)) {
|
|
920
|
-
const activeOptions = this.cascaderOptions
|
|
996
|
+
const activeOptions = this.cascaderOptions()
|
|
921
997
|
.filter(item => item.nativeElement.classList.contains('thy-cascader-menu-item-active'))
|
|
922
998
|
// for multiple mode
|
|
923
|
-
.slice(-this.cascaderOptionContainers.length);
|
|
924
|
-
this.cascaderOptionContainers.forEach((item, index) => {
|
|
999
|
+
.slice(-this.cascaderOptionContainers().length);
|
|
1000
|
+
this.cascaderOptionContainers().forEach((item, index) => {
|
|
925
1001
|
if (index <= activeOptions.length - 1) {
|
|
926
1002
|
ScrollToService.scrollToElement(activeOptions[index].nativeElement, item.nativeElement);
|
|
927
1003
|
this.cdr.detectChanges();
|
|
@@ -936,7 +1012,7 @@ class ThyCascader extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
936
1012
|
this.setClassMap();
|
|
937
1013
|
this.setMenuClass();
|
|
938
1014
|
if (this.menuVisible) {
|
|
939
|
-
this.triggerRect = this.trigger.nativeElement.getBoundingClientRect();
|
|
1015
|
+
this.triggerRect = this.trigger().nativeElement.getBoundingClientRect();
|
|
940
1016
|
this.subscribeTriggerResize();
|
|
941
1017
|
}
|
|
942
1018
|
else {
|
|
@@ -945,31 +1021,16 @@ class ThyCascader extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
945
1021
|
this.thyExpandStatusChange.emit(menuVisible);
|
|
946
1022
|
}
|
|
947
1023
|
}
|
|
948
|
-
get menuCls() {
|
|
949
|
-
return this._menuCls;
|
|
950
|
-
}
|
|
951
1024
|
setMenuClass() {
|
|
952
|
-
this.
|
|
1025
|
+
this.menuCls = {
|
|
953
1026
|
[`${this.prefixCls}-menus`]: true,
|
|
954
1027
|
[`${this.prefixCls}-menus-hidden`]: !this.menuVisible,
|
|
955
|
-
[`${this.thyMenuClassName}`]: this.thyMenuClassName,
|
|
1028
|
+
[`${this.thyMenuClassName()}`]: this.thyMenuClassName(),
|
|
956
1029
|
[`w-100`]: this.columns.length === 0
|
|
957
1030
|
};
|
|
958
1031
|
}
|
|
959
|
-
get menuColumnCls() {
|
|
960
|
-
return this._menuColumnCls;
|
|
961
|
-
}
|
|
962
|
-
setMenuColumnClass() {
|
|
963
|
-
this._menuColumnCls = {
|
|
964
|
-
[`${this.prefixCls}-menu`]: true,
|
|
965
|
-
[`${this.thyColumnClassName}`]: this.thyColumnClassName
|
|
966
|
-
};
|
|
967
|
-
}
|
|
968
|
-
get labelCls() {
|
|
969
|
-
return this._labelCls;
|
|
970
|
-
}
|
|
971
1032
|
setLabelClass() {
|
|
972
|
-
this.
|
|
1033
|
+
this.labelCls = {
|
|
973
1034
|
[`${this.prefixCls}-picker-label`]: true,
|
|
974
1035
|
[`${this.prefixCls}-show-search`]: false,
|
|
975
1036
|
[`${this.prefixCls}-focused`]: false,
|
|
@@ -980,29 +1041,32 @@ class ThyCascader extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
980
1041
|
const classMap = {
|
|
981
1042
|
[`${this.prefixCls}`]: true,
|
|
982
1043
|
[`${this.prefixCls}-picker`]: true,
|
|
983
|
-
[`${this.prefixCls}-${this.thySize}`]: true,
|
|
1044
|
+
[`${this.prefixCls}-${this.thySize()}`]: true,
|
|
984
1045
|
[`${this.prefixCls}-picker-disabled`]: this.disabled,
|
|
985
1046
|
[`${this.prefixCls}-picker-open`]: this.menuVisible
|
|
986
1047
|
};
|
|
987
1048
|
this.hostRenderer.updateClassByMap(classMap);
|
|
988
1049
|
}
|
|
989
1050
|
isClickTriggerAction() {
|
|
990
|
-
|
|
991
|
-
|
|
1051
|
+
const thyTriggerAction = this.thyTriggerAction();
|
|
1052
|
+
if (typeof thyTriggerAction === 'string') {
|
|
1053
|
+
return thyTriggerAction === 'click';
|
|
992
1054
|
}
|
|
993
|
-
return
|
|
1055
|
+
return thyTriggerAction.indexOf('click') !== -1;
|
|
994
1056
|
}
|
|
995
1057
|
isHoverTriggerAction() {
|
|
996
|
-
|
|
997
|
-
|
|
1058
|
+
const thyTriggerAction = this.thyTriggerAction();
|
|
1059
|
+
if (typeof thyTriggerAction === 'string') {
|
|
1060
|
+
return thyTriggerAction === 'hover';
|
|
998
1061
|
}
|
|
999
|
-
return
|
|
1062
|
+
return thyTriggerAction.indexOf('hover') !== -1;
|
|
1000
1063
|
}
|
|
1001
1064
|
isHoverExpandTriggerAction() {
|
|
1002
|
-
|
|
1003
|
-
|
|
1065
|
+
const thyExpandTriggerAction = this.thyExpandTriggerAction();
|
|
1066
|
+
if (typeof thyExpandTriggerAction === 'string') {
|
|
1067
|
+
return thyExpandTriggerAction === 'hover';
|
|
1004
1068
|
}
|
|
1005
|
-
return
|
|
1069
|
+
return thyExpandTriggerAction.indexOf('hover') !== -1;
|
|
1006
1070
|
}
|
|
1007
1071
|
toggleClick($event) {
|
|
1008
1072
|
if (this.disabled) {
|
|
@@ -1041,11 +1105,11 @@ class ThyCascader extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
1041
1105
|
clickOption(option, index, event) {
|
|
1042
1106
|
this.thyCascaderService.removeCustomOption();
|
|
1043
1107
|
this.thyCascaderService.clickOption(option, index, event, this.selectOption);
|
|
1044
|
-
if (this.cdkConnectedOverlay && this.cdkConnectedOverlay.overlayRef) {
|
|
1108
|
+
if (this.cdkConnectedOverlay() && this.cdkConnectedOverlay().overlayRef) {
|
|
1045
1109
|
// Make sure to calculate and update the position after the submenu is opened
|
|
1046
1110
|
this.cdr.detectChanges();
|
|
1047
1111
|
// Update the position to prevent the submenu from appearing off-screen
|
|
1048
|
-
this.cdkConnectedOverlay.overlayRef.updatePosition();
|
|
1112
|
+
this.cdkConnectedOverlay().overlayRef.updatePosition();
|
|
1049
1113
|
this.cdr.markForCheck();
|
|
1050
1114
|
}
|
|
1051
1115
|
}
|
|
@@ -1053,10 +1117,10 @@ class ThyCascader extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
1053
1117
|
if (event) {
|
|
1054
1118
|
event.preventDefault();
|
|
1055
1119
|
}
|
|
1056
|
-
if (option && option.disabled && !this.
|
|
1120
|
+
if (option && option.disabled && !this.thyMultiple()) {
|
|
1057
1121
|
return;
|
|
1058
1122
|
}
|
|
1059
|
-
if (!this.isHoverExpandTriggerAction() && !(option && option.disabled && this.
|
|
1123
|
+
if (!this.isHoverExpandTriggerAction() && !(option && option.disabled && this.thyMultiple())) {
|
|
1060
1124
|
return;
|
|
1061
1125
|
}
|
|
1062
1126
|
this.setActiveOption(option, index, false);
|
|
@@ -1090,7 +1154,8 @@ class ThyCascader extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
1090
1154
|
this.thyCascaderService.removeSelectedItem(event?.item);
|
|
1091
1155
|
}
|
|
1092
1156
|
shouldPerformSelection(option, level) {
|
|
1093
|
-
|
|
1157
|
+
const thyChangeOn = this.thyChangeOn();
|
|
1158
|
+
return typeof thyChangeOn === 'function' ? thyChangeOn(option, level) === true : false;
|
|
1094
1159
|
}
|
|
1095
1160
|
clearSelection($event) {
|
|
1096
1161
|
if ($event) {
|
|
@@ -1102,136 +1167,6 @@ class ThyCascader extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
1102
1167
|
};
|
|
1103
1168
|
this.thyCascaderService.clearSelection();
|
|
1104
1169
|
}
|
|
1105
|
-
constructor() {
|
|
1106
|
-
super();
|
|
1107
|
-
this.platformId = inject(PLATFORM_ID);
|
|
1108
|
-
this.cdr = inject(ChangeDetectorRef);
|
|
1109
|
-
this.elementRef = inject(ElementRef);
|
|
1110
|
-
this.thyClickDispatcher = inject(ThyClickDispatcher);
|
|
1111
|
-
this.ngZone = inject(NgZone);
|
|
1112
|
-
this.thyCascaderService = inject(ThyCascaderService);
|
|
1113
|
-
this.locale = injectLocale('cascader');
|
|
1114
|
-
this.emptyIcon = injectPanelEmptyIcon();
|
|
1115
|
-
/**
|
|
1116
|
-
* 选项的实际值的属性名
|
|
1117
|
-
*/
|
|
1118
|
-
this.thyValueProperty = 'value';
|
|
1119
|
-
/**
|
|
1120
|
-
* 选项的显示值的属性名
|
|
1121
|
-
*/
|
|
1122
|
-
this.thyLabelProperty = 'label';
|
|
1123
|
-
/**
|
|
1124
|
-
* 描述输入字段预期值的简短的提示信息
|
|
1125
|
-
*/
|
|
1126
|
-
this.thyPlaceholder = this.locale().placeholder;
|
|
1127
|
-
/**
|
|
1128
|
-
* 控制大小(5种)
|
|
1129
|
-
* @type 'xs' | 'sm' | 'md' | 'lg' | ''
|
|
1130
|
-
*/
|
|
1131
|
-
this.thySize = '';
|
|
1132
|
-
/**
|
|
1133
|
-
* 点击项时,表单是否动态展示数据项
|
|
1134
|
-
* @type boolean
|
|
1135
|
-
*/
|
|
1136
|
-
this.thyChangeOnSelect = false;
|
|
1137
|
-
/**
|
|
1138
|
-
* 显示输入框
|
|
1139
|
-
* @type boolean
|
|
1140
|
-
*/
|
|
1141
|
-
this.thyShowInput = true;
|
|
1142
|
-
/**
|
|
1143
|
-
* 控制触发状态, 支持 `click` | `hover`
|
|
1144
|
-
* @type ThyCascaderTriggerType | ThyCascaderTriggerType[]
|
|
1145
|
-
*/
|
|
1146
|
-
this.thyTriggerAction = ['click'];
|
|
1147
|
-
/**
|
|
1148
|
-
* 鼠标经过下方列表项时,是否自动展开列表,支持 `click` | `hover`
|
|
1149
|
-
* @type ThyCascaderExpandTrigger | ThyCascaderExpandTrigger[]
|
|
1150
|
-
*/
|
|
1151
|
-
this.thyExpandTriggerAction = ['click'];
|
|
1152
|
-
this.disabled = false;
|
|
1153
|
-
/**
|
|
1154
|
-
* 设置多选时最大显示的标签数量,0 表示不限制
|
|
1155
|
-
* @type number
|
|
1156
|
-
*/
|
|
1157
|
-
this.thyMaxTagCount = 0;
|
|
1158
|
-
/**
|
|
1159
|
-
* 是否仅允许选择叶子项
|
|
1160
|
-
* @default true
|
|
1161
|
-
*/
|
|
1162
|
-
this.thyIsOnlySelectLeaf = true;
|
|
1163
|
-
/**
|
|
1164
|
-
* 是否支持搜索
|
|
1165
|
-
* @default false
|
|
1166
|
-
*/
|
|
1167
|
-
this.thyShowSearch = false;
|
|
1168
|
-
/**
|
|
1169
|
-
* 多选选中项的展示方式,默认为空,渲染文字模板,传入tag,渲染展示模板,
|
|
1170
|
-
* @default ''|tag
|
|
1171
|
-
*/
|
|
1172
|
-
this.thyPreset = '';
|
|
1173
|
-
/**
|
|
1174
|
-
* 是否有幕布
|
|
1175
|
-
*/
|
|
1176
|
-
this.thyHasBackdrop = true;
|
|
1177
|
-
/**
|
|
1178
|
-
* 值发生变化时触发,返回选择项的值
|
|
1179
|
-
* @type EventEmitter<any[]>
|
|
1180
|
-
*/
|
|
1181
|
-
this.thyChange = new EventEmitter();
|
|
1182
|
-
/**
|
|
1183
|
-
* 值发生变化时触发,返回选择项列表
|
|
1184
|
-
* @type EventEmitter<ThyCascaderOption[]>
|
|
1185
|
-
*/
|
|
1186
|
-
this.thySelectionChange = new EventEmitter();
|
|
1187
|
-
/**
|
|
1188
|
-
* 选择选项时触发
|
|
1189
|
-
*/
|
|
1190
|
-
this.thySelect = new EventEmitter();
|
|
1191
|
-
/**
|
|
1192
|
-
* @private 暂无实现
|
|
1193
|
-
*/
|
|
1194
|
-
this.thyDeselect = new EventEmitter();
|
|
1195
|
-
/**
|
|
1196
|
-
* 清空选项时触发
|
|
1197
|
-
*/
|
|
1198
|
-
this.thyClear = new EventEmitter();
|
|
1199
|
-
/**
|
|
1200
|
-
* 下拉选项展开和折叠状态事件
|
|
1201
|
-
*/
|
|
1202
|
-
this.thyExpandStatusChange = new EventEmitter();
|
|
1203
|
-
this.dropDownPosition = 'bottom';
|
|
1204
|
-
this.menuVisible = false;
|
|
1205
|
-
this.isLabelRenderTemplate = false;
|
|
1206
|
-
this.emptyStateText = this.locale().empty;
|
|
1207
|
-
this.prefixCls = 'thy-cascader';
|
|
1208
|
-
this.destroy$ = new Subject();
|
|
1209
|
-
this.hostRenderer = useHostRenderer();
|
|
1210
|
-
this.isMultiple = false;
|
|
1211
|
-
this.menuMinWidth = 122;
|
|
1212
|
-
this.searchText$ = new BehaviorSubject('');
|
|
1213
|
-
this.isShowSearchPanel = false;
|
|
1214
|
-
/**
|
|
1215
|
-
* 解决搜索&多选的情况下,点击搜索项会导致 panel 闪烁
|
|
1216
|
-
* 由于点击后,thySelectedOptions变化,导致 thySelectControl
|
|
1217
|
-
* 又会触发 searchFilter 函数,即 resetSearch 会执行
|
|
1218
|
-
* 会导致恢复级联状态再变为搜索状态
|
|
1219
|
-
*/
|
|
1220
|
-
this.isSelectingSearchState = false;
|
|
1221
|
-
this.selectOption = (option, index) => {
|
|
1222
|
-
if ((option.isLeaf || !this.thyIsOnlySelectLeaf) && !this.thyMultiple) {
|
|
1223
|
-
this.afterChangeFn = () => {
|
|
1224
|
-
this.setMenuVisible(false);
|
|
1225
|
-
this.onTouchedFn();
|
|
1226
|
-
};
|
|
1227
|
-
}
|
|
1228
|
-
this.thySelect.emit({ option, index });
|
|
1229
|
-
const isOptionCanSelect = this.thyChangeOnSelect && !this.isMultiple;
|
|
1230
|
-
if (option.isLeaf || !this.thyIsOnlySelectLeaf || isOptionCanSelect || this.shouldPerformSelection(option, index)) {
|
|
1231
|
-
this.thyCascaderService.selectOption(option, index);
|
|
1232
|
-
}
|
|
1233
|
-
};
|
|
1234
|
-
}
|
|
1235
1170
|
trackByFn(index, item) {
|
|
1236
1171
|
return item?.value || item?._id || index;
|
|
1237
1172
|
}
|
|
@@ -1263,7 +1198,7 @@ class ThyCascader extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
1263
1198
|
selectSearchResult(selectOptionData) {
|
|
1264
1199
|
const { thyRowValue: selectedOptions } = selectOptionData;
|
|
1265
1200
|
if (selectOptionData.selected) {
|
|
1266
|
-
if (!this.
|
|
1201
|
+
if (!this.thyMultiple()) {
|
|
1267
1202
|
this.closeMenu();
|
|
1268
1203
|
}
|
|
1269
1204
|
return;
|
|
@@ -1271,7 +1206,7 @@ class ThyCascader extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
1271
1206
|
selectedOptions.forEach((item, index) => {
|
|
1272
1207
|
this.setActiveOption(item, index, index === selectedOptions.length - 1);
|
|
1273
1208
|
});
|
|
1274
|
-
if (this.
|
|
1209
|
+
if (this.thyMultiple()) {
|
|
1275
1210
|
this.isSelectingSearchState = true;
|
|
1276
1211
|
selectOptionData.selected = true;
|
|
1277
1212
|
const originSearchResultList = this.searchResultList;
|
|
@@ -1293,12 +1228,12 @@ class ThyCascader extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
1293
1228
|
const resize = new ResizeObserver((entries) => {
|
|
1294
1229
|
observer.next(null);
|
|
1295
1230
|
});
|
|
1296
|
-
resize.observe(this.trigger.nativeElement);
|
|
1231
|
+
resize.observe(this.trigger().nativeElement);
|
|
1297
1232
|
}).subscribe(() => {
|
|
1298
1233
|
this.ngZone.run(() => {
|
|
1299
|
-
this.triggerRect = this.trigger.nativeElement.getBoundingClientRect();
|
|
1300
|
-
if (this.cdkConnectedOverlay && this.cdkConnectedOverlay.overlayRef) {
|
|
1301
|
-
this.cdkConnectedOverlay.overlayRef.updatePosition();
|
|
1234
|
+
this.triggerRect = this.trigger().nativeElement.getBoundingClientRect();
|
|
1235
|
+
if (this.cdkConnectedOverlay() && this.cdkConnectedOverlay().overlayRef) {
|
|
1236
|
+
this.cdkConnectedOverlay().overlayRef.updatePosition();
|
|
1302
1237
|
}
|
|
1303
1238
|
this.cdr.markForCheck();
|
|
1304
1239
|
});
|
|
@@ -1317,14 +1252,14 @@ class ThyCascader extends TabIndexDisabledControlValueAccessorMixin {
|
|
|
1317
1252
|
this.destroy$.complete();
|
|
1318
1253
|
}
|
|
1319
1254
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyCascader, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1320
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyCascader, isStandalone: true, selector: "thy-cascader,[thy-cascader]", inputs: { thyValueProperty: "thyValueProperty", thyLabelProperty: "thyLabelProperty", thyPlaceholder: "thyPlaceholder", thySize: "thySize", thyOptions: "thyOptions", thyCustomOptions: "thyCustomOptions", thyChangeOn: "thyChangeOn", thyChangeOnSelect:
|
|
1255
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyCascader, isStandalone: true, selector: "thy-cascader,[thy-cascader]", inputs: { thyValueProperty: { classPropertyName: "thyValueProperty", publicName: "thyValueProperty", isSignal: true, isRequired: false, transformFunction: null }, thyLabelProperty: { classPropertyName: "thyLabelProperty", publicName: "thyLabelProperty", isSignal: true, isRequired: false, transformFunction: null }, thyPlaceholder: { classPropertyName: "thyPlaceholder", publicName: "thyPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, thySize: { classPropertyName: "thySize", publicName: "thySize", isSignal: true, isRequired: false, transformFunction: null }, thyOptions: { classPropertyName: "thyOptions", publicName: "thyOptions", isSignal: true, isRequired: false, transformFunction: null }, thyCustomOptions: { classPropertyName: "thyCustomOptions", publicName: "thyCustomOptions", isSignal: true, isRequired: false, transformFunction: null }, thyChangeOn: { classPropertyName: "thyChangeOn", publicName: "thyChangeOn", isSignal: true, isRequired: false, transformFunction: null }, thyChangeOnSelect: { classPropertyName: "thyChangeOnSelect", publicName: "thyChangeOnSelect", isSignal: true, isRequired: false, transformFunction: null }, thyShowInput: { classPropertyName: "thyShowInput", publicName: "thyShowInput", isSignal: true, isRequired: false, transformFunction: null }, thyOptionRender: { classPropertyName: "thyOptionRender", publicName: "thyOptionRender", isSignal: true, isRequired: false, transformFunction: null }, thyLabelRender: { classPropertyName: "thyLabelRender", publicName: "thyLabelRender", isSignal: true, isRequired: false, transformFunction: null }, thyLoadData: { classPropertyName: "thyLoadData", publicName: "thyLoadData", isSignal: true, isRequired: false, transformFunction: null }, thyTriggerAction: { classPropertyName: "thyTriggerAction", publicName: "thyTriggerAction", isSignal: true, isRequired: false, transformFunction: null }, thyExpandTriggerAction: { classPropertyName: "thyExpandTriggerAction", publicName: "thyExpandTriggerAction", isSignal: true, isRequired: false, transformFunction: null }, thyMenuStyle: { classPropertyName: "thyMenuStyle", publicName: "thyMenuStyle", isSignal: true, isRequired: false, transformFunction: null }, thySearchListStyle: { classPropertyName: "thySearchListStyle", publicName: "thySearchListStyle", isSignal: true, isRequired: false, transformFunction: null }, thyMenuClassName: { classPropertyName: "thyMenuClassName", publicName: "thyMenuClassName", isSignal: true, isRequired: false, transformFunction: null }, thyColumnClassName: { classPropertyName: "thyColumnClassName", publicName: "thyColumnClassName", isSignal: true, isRequired: false, transformFunction: null }, thyDisabled: { classPropertyName: "thyDisabled", publicName: "thyDisabled", isSignal: false, isRequired: false, transformFunction: coerceBooleanProperty }, thyEmptyStateText: { classPropertyName: "thyEmptyStateText", publicName: "thyEmptyStateText", isSignal: true, isRequired: false, transformFunction: null }, thyMultiple: { classPropertyName: "thyMultiple", publicName: "thyMultiple", isSignal: true, isRequired: false, transformFunction: null }, thyMaxTagCount: { classPropertyName: "thyMaxTagCount", publicName: "thyMaxTagCount", isSignal: true, isRequired: false, transformFunction: null }, thyIsOnlySelectLeaf: { classPropertyName: "thyIsOnlySelectLeaf", publicName: "thyIsOnlySelectLeaf", isSignal: true, isRequired: false, transformFunction: null }, thyAutoExpand: { classPropertyName: "thyAutoExpand", publicName: "thyAutoExpand", isSignal: true, isRequired: false, transformFunction: null }, thyShowSearch: { classPropertyName: "thyShowSearch", publicName: "thyShowSearch", isSignal: true, isRequired: false, transformFunction: null }, thyPreset: { classPropertyName: "thyPreset", publicName: "thyPreset", isSignal: true, isRequired: false, transformFunction: null }, thyHasBackdrop: { classPropertyName: "thyHasBackdrop", publicName: "thyHasBackdrop", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { thyChange: "thyChange", thySelectionChange: "thySelectionChange", thySelect: "thySelect", thyDeselect: "thyDeselect", thyClear: "thyClear", thyExpandStatusChange: "thyExpandStatusChange" }, host: { listeners: { "focus": "onFocus($event)", "blur": "onBlur($event)", "click": "toggleClick($event)", "mouseenter": "toggleMouseEnter($event)", "mouseleave": "toggleMouseLeave($event)" }, properties: { "attr.tabindex": "tabIndex" } }, providers: [
|
|
1321
1256
|
{
|
|
1322
1257
|
provide: NG_VALUE_ACCESSOR,
|
|
1323
1258
|
useExisting: forwardRef(() => ThyCascader),
|
|
1324
1259
|
multi: true
|
|
1325
1260
|
},
|
|
1326
1261
|
ThyCascaderService
|
|
1327
|
-
], viewQueries: [{ propertyName: "
|
|
1262
|
+
], viewQueries: [{ propertyName: "cascaderOptions", predicate: ["cascaderOptions"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "cascaderOptionContainers", predicate: ["cascaderOptionContainers"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "cdkConnectedOverlay", first: true, predicate: CdkConnectedOverlay, descendants: true, isSignal: true }, { propertyName: "trigger", first: true, predicate: ["trigger"], descendants: true, isSignal: true }, { propertyName: "input", first: true, predicate: ["input"], descendants: true, isSignal: true }, { propertyName: "menu", first: true, predicate: ["menu"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div cdkOverlayOrigin #origin=\"cdkOverlayOrigin\" #trigger>\n @if (thyShowInput()) {\n <div\n thySelectControl\n [thyShowSearch]=\"thyShowSearch()\"\n [thySize]=\"thySize()\"\n [thyAllowClear]=\"true\"\n [thySelectedOptions]=\"selected\"\n [thyMaxTagCount]=\"thyMaxTagCount()\"\n (thyOnRemove)=\"removeSelectedItem($event)\"\n (thyOnClear)=\"clearSelection($event)\"\n (thyOnBlur)=\"onBlur($event)\"\n (thyOnSearch)=\"searchFilter($event)\"\n [thyDisabled]=\"disabled\"\n [thyIsMultiple]=\"thyMultiple()\"\n [thyPanelOpened]=\"menuVisible\"\n [thyPlaceholder]=\"thyPlaceholder()\"\n [customDisplayTemplate]=\"customDisplayTemplate\"\n [thyPreset]=\"thyPreset()\">\n <ng-template #customDisplayTemplate let-value>\n @if (!isLabelRenderTemplate()) {\n <span [ngClass]=\"labelCls\">{{ value.labelText }}</span>\n } @else {\n <span [ngClass]=\"labelCls\">\n <ng-template [ngTemplateOutlet]=\"thyLabelRender()\" [ngTemplateOutletContext]=\"value.labelRenderContext\"></ng-template>\n </span>\n }\n </ng-template>\n </div>\n }\n</div>\n\n<ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayHasBackdrop]=\"thyHasBackdrop()\"\n cdkConnectedOverlayBackdropClass=\"thy-cascader-backdrop\"\n [cdkConnectedOverlayOrigin]=\"origin\"\n [cdkConnectedOverlayPositions]=\"positions\"\n [cdkConnectedOverlayMinWidth]=\"menuMinWidth\"\n cdkConnectedOverlayTransformOriginOn=\".thy-cascader-menus\"\n (backdropClick)=\"closeMenu()\"\n (detach)=\"closeMenu()\"\n (attach)=\"attached()\"\n (positionChange)=\"positionChange($event)\"\n [cdkConnectedOverlayOpen]=\"menuVisible\">\n <div\n [attr.tabindex]=\"-1\"\n #menu\n [ngClass]=\"menuCls\"\n [ngStyle]=\"thyMenuStyle()\"\n (mouseleave)=\"toggleMouseLeave($event)\"\n [@scaleYMotion]=\"'enter'\">\n @if (!isShowSearchPanel) {\n @if (columns.length > 0) {\n @for (options of columns; track $index; let i = $index; let isFirst = $first) {\n <ul #cascaderOptionContainers [ngClass]=\"menuColumnCls()\">\n @if (thyCascaderService.customOptions && thyCascaderService.customOptions.length > 0 && isFirst) {\n @for (customOpt of thyCascaderService.customOptions; track trackByFn($index, customOpt)) {\n <li\n #cascaderOptions\n thy-cascader-option\n [option]=\"customOpt\"\n [multiple]=\"thyMultiple()\"\n [isOnlySelectLeaf]=\"thyIsOnlySelectLeaf()\"\n [labelProperty]=\"thyLabelProperty()\"\n [active]=\"isActivatedOption(customOpt, 0)\"\n [halfSelected]=\"isHalfSelectedOption(customOpt, 0)\"\n [selected]=\"isSelectedOption(customOpt, 0)\"\n (toggleSelectChange)=\"clickCustomOption(customOpt, 0, $event)\"\n (click)=\"clickCustomOption(customOpt, 0, $event)\"\n (mouseover)=\"mouseoverOption(customOpt, 0, $event)\"></li>\n }\n <thy-divider class=\"my-1 mx-4\"></thy-divider>\n }\n @for (option of options; track trackByFn($index, option)) {\n <li\n #cascaderOptions\n thy-cascader-option\n [option]=\"option\"\n [multiple]=\"thyMultiple()\"\n [isOnlySelectLeaf]=\"thyIsOnlySelectLeaf()\"\n [labelProperty]=\"thyLabelProperty()\"\n [active]=\"isActivatedOption(option, i)\"\n [halfSelected]=\"isHalfSelectedOption(option, i)\"\n [selected]=\"isSelectedOption(option, i)\"\n [optionRender]=\"thyOptionRender()\"\n (toggleSelectChange)=\"clickOption(option, i, $event)\"\n (click)=\"clickOption(option, i, $event)\"\n (mouseover)=\"mouseoverOption(option, i, $event)\"></li>\n }\n </ul>\n }\n } @else {\n <div class=\"thy-cascader-empty-container\" [ngStyle]=\"{ 'width.px': triggerRect?.width }\">\n <thy-empty\n class=\"thy-select-empty-content\"\n thySize=\"sm\"\n [thyMessage]=\"thyEmptyStateText()\"\n [thyIconName]=\"emptyIcon()\"></thy-empty>\n </div>\n }\n }\n @if (isShowSearchPanel) {\n @if (searchResultList.length) {\n <ul class=\"thy-cascader-search-list py-3\" [ngStyle]=\"thySearchListStyle()\">\n @for (item of searchResultList; track $index) {\n <li\n thy-cascader-search-option\n [multiple]=\"thyMultiple()\"\n [isOnlySelectLeaf]=\"thyIsOnlySelectLeaf()\"\n [option]=\"item\"\n [active]=\"item.selected\"\n [optionRender]=\"thyOptionRender()\"\n (toggleSelectChange)=\"selectSearchResult($event)\"></li>\n }\n </ul>\n } @else {\n <div class=\"thy-cascader-empty-container\" [ngStyle]=\"{ 'width.px': triggerRect?.width }\">\n <thy-empty\n class=\"thy-select-empty-content\"\n thySize=\"sm\"\n [thyMessage]=\"thyEmptyStateText()\"\n [thyIconName]=\"emptyIcon()\"></thy-empty>\n </div>\n }\n }\n </div>\n</ng-template>\n", dependencies: [{ kind: "directive", type: CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }, { kind: "component", type: ThySelectControl, selector: "thy-select-control,[thySelectControl]", inputs: ["thyPanelOpened", "thyIsMultiple", "thyShowSearch", "thySelectedOptions", "thyDisabled", "customDisplayTemplate", "thyAllowClear", "thyPlaceholder", "thySize", "thyMaxTagCount", "thyBorderless", "thyPreset"], outputs: ["thyOnSearch", "thyOnRemove", "thyOnClear", "thyOnBlur"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: ThyCascaderOptionComponent, selector: "[thy-cascader-option]", inputs: ["option", "multiple", "isOnlySelectLeaf", "optionRender", "active", "halfSelected", "selected", "labelProperty"], outputs: ["toggleSelectChange"] }, { kind: "component", type: ThyCascaderSearchOptionComponent, selector: "[thy-cascader-search-option]", inputs: ["option", "multiple", "isOnlySelectLeaf", "active", "optionRender"], outputs: ["toggleSelectChange"] }, { kind: "component", type: ThyEmpty, selector: "thy-empty", inputs: ["thyMessage", "thyTranslationKey", "thyTranslationValues", "thyEntityName", "thyEntityNameTranslateKey", "thyIconName", "thySize", "thyMarginTop", "thyTopAuto", "thyContainer", "thyImageUrl", "thyImageLoading", "thyImageFetchPriority", "thyDescription"] }, { kind: "component", type: ThyDivider, selector: "thy-divider", inputs: ["thyVertical", "thyStyle", "thyColor", "thyText", "thyTextDirection", "thyDeeper"] }], animations: [scaleYMotion] }); }
|
|
1328
1263
|
}
|
|
1329
1264
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyCascader, decorators: [{
|
|
1330
1265
|
type: Component,
|
|
@@ -1350,100 +1285,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
1350
1285
|
ThyCascaderSearchOptionComponent,
|
|
1351
1286
|
ThyEmpty,
|
|
1352
1287
|
ThyDivider
|
|
1353
|
-
], animations: [scaleYMotion], template: "<div cdkOverlayOrigin #origin=\"cdkOverlayOrigin\" #trigger>\n @if (thyShowInput) {\n <div\n thySelectControl\n [thyShowSearch]=\"thyShowSearch\"\n [thySize]=\"thySize\"\n [thyAllowClear]=\"true\"\n [thySelectedOptions]=\"selected\"\n [thyMaxTagCount]=\"thyMaxTagCount\"\n (thyOnRemove)=\"removeSelectedItem($event)\"\n (thyOnClear)=\"clearSelection($event)\"\n (thyOnBlur)=\"onBlur($event)\"\n (thyOnSearch)=\"searchFilter($event)\"\n [thyDisabled]=\"disabled\"\n [thyIsMultiple]=\"thyMultiple\"\n [thyPanelOpened]=\"menuVisible\"\n [thyPlaceholder]=\"thyPlaceholder\"\n [customDisplayTemplate]=\"customDisplayTemplate\"\n [thyPreset]=\"thyPreset\">\n <ng-template #customDisplayTemplate let-value>\n @if (!isLabelRenderTemplate) {\n <span [ngClass]=\"labelCls\">{{ value.labelText }}</span>\n } @else {\n <span [ngClass]=\"labelCls\">\n <ng-template [ngTemplateOutlet]=\"thyLabelRender\" [ngTemplateOutletContext]=\"value.labelRenderContext\"></ng-template>\n </span>\n }\n </ng-template>\n </div>\n }\n</div>\n\n<ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayHasBackdrop]=\"thyHasBackdrop\"\n cdkConnectedOverlayBackdropClass=\"thy-cascader-backdrop\"\n [cdkConnectedOverlayOrigin]=\"origin\"\n [cdkConnectedOverlayPositions]=\"positions\"\n [cdkConnectedOverlayMinWidth]=\"menuMinWidth\"\n cdkConnectedOverlayTransformOriginOn=\".thy-cascader-menus\"\n (backdropClick)=\"closeMenu()\"\n (detach)=\"closeMenu()\"\n (attach)=\"attached()\"\n (positionChange)=\"positionChange($event)\"\n [cdkConnectedOverlayOpen]=\"menuVisible\">\n <div\n [attr.tabindex]=\"-1\"\n #menu\n [ngClass]=\"menuCls\"\n [ngStyle]=\"thyMenuStyle\"\n (mouseleave)=\"toggleMouseLeave($event)\"\n [@scaleYMotion]=\"'enter'\">\n @if (!isShowSearchPanel) {\n @if (columns.length > 0) {\n @for (options of columns; track $index; let i = $index; let isFirst = $first) {\n <ul #cascaderOptionContainers [ngClass]=\"menuColumnCls\">\n @if (
|
|
1354
|
-
}], ctorParameters: () => [], propDecorators: {
|
|
1355
|
-
type: Input
|
|
1356
|
-
}], thyLabelProperty: [{
|
|
1357
|
-
type: Input
|
|
1358
|
-
}], thyPlaceholder: [{
|
|
1359
|
-
type: Input
|
|
1360
|
-
}], thySize: [{
|
|
1361
|
-
type: Input
|
|
1362
|
-
}], thyOptions: [{
|
|
1363
|
-
type: Input
|
|
1364
|
-
}], thyCustomOptions: [{
|
|
1365
|
-
type: Input
|
|
1366
|
-
}], thyChangeOn: [{
|
|
1367
|
-
type: Input
|
|
1368
|
-
}], thyChangeOnSelect: [{
|
|
1369
|
-
type: Input,
|
|
1370
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
1371
|
-
}], thyShowInput: [{
|
|
1372
|
-
type: Input,
|
|
1373
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
1374
|
-
}], thyOptionRender: [{
|
|
1375
|
-
type: Input
|
|
1376
|
-
}], thyLabelRender: [{
|
|
1377
|
-
type: Input
|
|
1378
|
-
}], thyLoadData: [{
|
|
1379
|
-
type: Input
|
|
1380
|
-
}], thyTriggerAction: [{
|
|
1381
|
-
type: Input
|
|
1382
|
-
}], thyExpandTriggerAction: [{
|
|
1383
|
-
type: Input
|
|
1384
|
-
}], thyMenuStyle: [{
|
|
1385
|
-
type: Input
|
|
1386
|
-
}], thySearchListStyle: [{
|
|
1387
|
-
type: Input
|
|
1388
|
-
}], thyMenuClassName: [{
|
|
1389
|
-
type: Input
|
|
1390
|
-
}], thyColumnClassName: [{
|
|
1391
|
-
type: Input
|
|
1392
|
-
}], thyDisabled: [{
|
|
1393
|
-
type: Input,
|
|
1394
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
1395
|
-
}], thyEmptyStateText: [{
|
|
1396
|
-
type: Input
|
|
1397
|
-
}], thyMultiple: [{
|
|
1398
|
-
type: Input,
|
|
1399
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
1400
|
-
}], thyMaxTagCount: [{
|
|
1401
|
-
type: Input,
|
|
1402
|
-
args: [{ transform: numberAttribute }]
|
|
1403
|
-
}], thyIsOnlySelectLeaf: [{
|
|
1404
|
-
type: Input,
|
|
1405
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
1406
|
-
}], thyAutoExpand: [{
|
|
1407
|
-
type: Input,
|
|
1408
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
1409
|
-
}], thyShowSearch: [{
|
|
1410
|
-
type: Input,
|
|
1411
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
1412
|
-
}], thyPreset: [{
|
|
1413
|
-
type: Input
|
|
1414
|
-
}], thyHasBackdrop: [{
|
|
1288
|
+
], animations: [scaleYMotion], template: "<div cdkOverlayOrigin #origin=\"cdkOverlayOrigin\" #trigger>\n @if (thyShowInput()) {\n <div\n thySelectControl\n [thyShowSearch]=\"thyShowSearch()\"\n [thySize]=\"thySize()\"\n [thyAllowClear]=\"true\"\n [thySelectedOptions]=\"selected\"\n [thyMaxTagCount]=\"thyMaxTagCount()\"\n (thyOnRemove)=\"removeSelectedItem($event)\"\n (thyOnClear)=\"clearSelection($event)\"\n (thyOnBlur)=\"onBlur($event)\"\n (thyOnSearch)=\"searchFilter($event)\"\n [thyDisabled]=\"disabled\"\n [thyIsMultiple]=\"thyMultiple()\"\n [thyPanelOpened]=\"menuVisible\"\n [thyPlaceholder]=\"thyPlaceholder()\"\n [customDisplayTemplate]=\"customDisplayTemplate\"\n [thyPreset]=\"thyPreset()\">\n <ng-template #customDisplayTemplate let-value>\n @if (!isLabelRenderTemplate()) {\n <span [ngClass]=\"labelCls\">{{ value.labelText }}</span>\n } @else {\n <span [ngClass]=\"labelCls\">\n <ng-template [ngTemplateOutlet]=\"thyLabelRender()\" [ngTemplateOutletContext]=\"value.labelRenderContext\"></ng-template>\n </span>\n }\n </ng-template>\n </div>\n }\n</div>\n\n<ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayHasBackdrop]=\"thyHasBackdrop()\"\n cdkConnectedOverlayBackdropClass=\"thy-cascader-backdrop\"\n [cdkConnectedOverlayOrigin]=\"origin\"\n [cdkConnectedOverlayPositions]=\"positions\"\n [cdkConnectedOverlayMinWidth]=\"menuMinWidth\"\n cdkConnectedOverlayTransformOriginOn=\".thy-cascader-menus\"\n (backdropClick)=\"closeMenu()\"\n (detach)=\"closeMenu()\"\n (attach)=\"attached()\"\n (positionChange)=\"positionChange($event)\"\n [cdkConnectedOverlayOpen]=\"menuVisible\">\n <div\n [attr.tabindex]=\"-1\"\n #menu\n [ngClass]=\"menuCls\"\n [ngStyle]=\"thyMenuStyle()\"\n (mouseleave)=\"toggleMouseLeave($event)\"\n [@scaleYMotion]=\"'enter'\">\n @if (!isShowSearchPanel) {\n @if (columns.length > 0) {\n @for (options of columns; track $index; let i = $index; let isFirst = $first) {\n <ul #cascaderOptionContainers [ngClass]=\"menuColumnCls()\">\n @if (thyCascaderService.customOptions && thyCascaderService.customOptions.length > 0 && isFirst) {\n @for (customOpt of thyCascaderService.customOptions; track trackByFn($index, customOpt)) {\n <li\n #cascaderOptions\n thy-cascader-option\n [option]=\"customOpt\"\n [multiple]=\"thyMultiple()\"\n [isOnlySelectLeaf]=\"thyIsOnlySelectLeaf()\"\n [labelProperty]=\"thyLabelProperty()\"\n [active]=\"isActivatedOption(customOpt, 0)\"\n [halfSelected]=\"isHalfSelectedOption(customOpt, 0)\"\n [selected]=\"isSelectedOption(customOpt, 0)\"\n (toggleSelectChange)=\"clickCustomOption(customOpt, 0, $event)\"\n (click)=\"clickCustomOption(customOpt, 0, $event)\"\n (mouseover)=\"mouseoverOption(customOpt, 0, $event)\"></li>\n }\n <thy-divider class=\"my-1 mx-4\"></thy-divider>\n }\n @for (option of options; track trackByFn($index, option)) {\n <li\n #cascaderOptions\n thy-cascader-option\n [option]=\"option\"\n [multiple]=\"thyMultiple()\"\n [isOnlySelectLeaf]=\"thyIsOnlySelectLeaf()\"\n [labelProperty]=\"thyLabelProperty()\"\n [active]=\"isActivatedOption(option, i)\"\n [halfSelected]=\"isHalfSelectedOption(option, i)\"\n [selected]=\"isSelectedOption(option, i)\"\n [optionRender]=\"thyOptionRender()\"\n (toggleSelectChange)=\"clickOption(option, i, $event)\"\n (click)=\"clickOption(option, i, $event)\"\n (mouseover)=\"mouseoverOption(option, i, $event)\"></li>\n }\n </ul>\n }\n } @else {\n <div class=\"thy-cascader-empty-container\" [ngStyle]=\"{ 'width.px': triggerRect?.width }\">\n <thy-empty\n class=\"thy-select-empty-content\"\n thySize=\"sm\"\n [thyMessage]=\"thyEmptyStateText()\"\n [thyIconName]=\"emptyIcon()\"></thy-empty>\n </div>\n }\n }\n @if (isShowSearchPanel) {\n @if (searchResultList.length) {\n <ul class=\"thy-cascader-search-list py-3\" [ngStyle]=\"thySearchListStyle()\">\n @for (item of searchResultList; track $index) {\n <li\n thy-cascader-search-option\n [multiple]=\"thyMultiple()\"\n [isOnlySelectLeaf]=\"thyIsOnlySelectLeaf()\"\n [option]=\"item\"\n [active]=\"item.selected\"\n [optionRender]=\"thyOptionRender()\"\n (toggleSelectChange)=\"selectSearchResult($event)\"></li>\n }\n </ul>\n } @else {\n <div class=\"thy-cascader-empty-container\" [ngStyle]=\"{ 'width.px': triggerRect?.width }\">\n <thy-empty\n class=\"thy-select-empty-content\"\n thySize=\"sm\"\n [thyMessage]=\"thyEmptyStateText()\"\n [thyIconName]=\"emptyIcon()\"></thy-empty>\n </div>\n }\n }\n </div>\n</ng-template>\n" }]
|
|
1289
|
+
}], ctorParameters: () => [], propDecorators: { thyDisabled: [{
|
|
1415
1290
|
type: Input,
|
|
1416
1291
|
args: [{ transform: coerceBooleanProperty }]
|
|
1417
|
-
}], thyChange: [{
|
|
1418
|
-
type: Output
|
|
1419
|
-
}], thySelectionChange: [{
|
|
1420
|
-
type: Output
|
|
1421
|
-
}], thySelect: [{
|
|
1422
|
-
type: Output
|
|
1423
|
-
}], thyDeselect: [{
|
|
1424
|
-
type: Output
|
|
1425
|
-
}], thyClear: [{
|
|
1426
|
-
type: Output
|
|
1427
|
-
}], thyExpandStatusChange: [{
|
|
1428
|
-
type: Output
|
|
1429
|
-
}], cascaderOptions: [{
|
|
1430
|
-
type: ViewChildren,
|
|
1431
|
-
args: ['cascaderOptions', { read: ElementRef }]
|
|
1432
|
-
}], cascaderOptionContainers: [{
|
|
1433
|
-
type: ViewChildren,
|
|
1434
|
-
args: ['cascaderOptionContainers', { read: ElementRef }]
|
|
1435
|
-
}], cdkConnectedOverlay: [{
|
|
1436
|
-
type: ViewChild,
|
|
1437
|
-
args: [CdkConnectedOverlay, { static: true }]
|
|
1438
|
-
}], trigger: [{
|
|
1439
|
-
type: ViewChild,
|
|
1440
|
-
args: ['trigger', { read: ElementRef, static: true }]
|
|
1441
|
-
}], input: [{
|
|
1442
|
-
type: ViewChild,
|
|
1443
|
-
args: ['input']
|
|
1444
|
-
}], menu: [{
|
|
1445
|
-
type: ViewChild,
|
|
1446
|
-
args: ['menu']
|
|
1447
1292
|
}], toggleClick: [{
|
|
1448
1293
|
type: HostListener,
|
|
1449
1294
|
args: ['click', ['$event']]
|