ngx-tethys 19.1.0-next.0 → 19.1.0-next.10
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 +126 -0
- package/README.md +0 -1
- package/action/action.component.d.ts +7 -8
- package/affix/affix.component.d.ts +3 -4
- package/arrow-switcher/arrow-switcher.component.d.ts +5 -1
- package/badge/badge.component.d.ts +1 -1
- package/button/button-group.component.d.ts +5 -12
- package/button/button-icon.component.d.ts +14 -28
- package/button/button.component.d.ts +17 -27
- package/color-picker/coordinates.directive.d.ts +1 -2
- package/date-picker/abstract-picker.component.d.ts +50 -52
- package/date-picker/abstract-picker.directive.d.ts +15 -40
- package/date-picker/base-picker.component.d.ts +12 -40
- package/date-picker/date-picker.config.d.ts +3 -0
- package/date-picker/lib/calendar/calendar-footer.component.d.ts +24 -19
- package/date-picker/lib/calendar/calendar-header.component.d.ts +15 -15
- package/date-picker/lib/calendar/calendar-table.component.d.ts +15 -16
- package/date-picker/lib/date/date-table-cell.component.d.ts +6 -3
- package/date-picker/lib/date/date-table.component.d.ts +2 -3
- package/date-picker/lib/date-carousel/date-carousel.component.d.ts +2 -3
- package/date-picker/lib/decade/decade-header.component.d.ts +2 -5
- package/date-picker/lib/decade/decade-table.component.d.ts +3 -5
- package/date-picker/lib/month/month-table.component.d.ts +1 -2
- package/date-picker/lib/popups/date-popup.component.d.ts +33 -34
- package/date-picker/lib/popups/inner-popup.component.d.ts +22 -29
- package/date-picker/lib/quarter/quarter-table.component.d.ts +1 -4
- package/date-picker/lib/year/year-header.component.d.ts +2 -4
- package/date-picker/lib/year/year-table.component.d.ts +2 -4
- package/date-picker/month-picker.component.d.ts +2 -2
- package/date-picker/picker.component.d.ts +31 -36
- package/date-picker/picker.pipes.d.ts +4 -5
- package/date-picker/picker.util.d.ts +5 -5
- package/date-picker/picker.validators.d.ts +4 -8
- package/date-picker/quarter-picker.component.d.ts +2 -3
- package/date-picker/styles/calendar.scss +1 -1
- package/date-picker/styles/range-picker.scss +1 -0
- package/date-picker/styles/week-picker.scss +1 -0
- package/date-picker/week-picker.component.d.ts +0 -1
- package/date-picker/year-picker.component.d.ts +2 -3
- package/dropdown/dropdown-active.directive.d.ts +4 -5
- package/dropdown/dropdown-menu-item.directive.d.ts +7 -15
- package/dropdown/dropdown-menu.component.d.ts +6 -13
- package/dropdown/dropdown-submenu.component.d.ts +2 -4
- package/dropdown/dropdown.directive.d.ts +15 -25
- package/empty/empty.component.d.ts +2 -1
- package/fesm2022/ngx-tethys-action.mjs +15 -16
- package/fesm2022/ngx-tethys-action.mjs.map +1 -1
- package/fesm2022/ngx-tethys-affix.mjs +14 -18
- package/fesm2022/ngx-tethys-affix.mjs.map +1 -1
- package/fesm2022/ngx-tethys-arrow-switcher.mjs +15 -3
- package/fesm2022/ngx-tethys-arrow-switcher.mjs.map +1 -1
- package/fesm2022/ngx-tethys-autocomplete.mjs +4 -4
- package/fesm2022/ngx-tethys-autocomplete.mjs.map +1 -1
- package/fesm2022/ngx-tethys-badge.mjs.map +1 -1
- package/fesm2022/ngx-tethys-button.mjs +225 -322
- package/fesm2022/ngx-tethys-button.mjs.map +1 -1
- package/fesm2022/ngx-tethys-carousel.mjs +1 -0
- package/fesm2022/ngx-tethys-carousel.mjs.map +1 -1
- package/fesm2022/ngx-tethys-cascader.mjs +1 -1
- package/fesm2022/ngx-tethys-cascader.mjs.map +1 -1
- package/fesm2022/ngx-tethys-checkbox.mjs +2 -2
- package/fesm2022/ngx-tethys-checkbox.mjs.map +1 -1
- package/fesm2022/ngx-tethys-collapse.mjs +2 -2
- package/fesm2022/ngx-tethys-collapse.mjs.map +1 -1
- package/fesm2022/ngx-tethys-color-picker.mjs +4 -6
- package/fesm2022/ngx-tethys-color-picker.mjs.map +1 -1
- package/fesm2022/ngx-tethys-copy.mjs +2 -2
- package/fesm2022/ngx-tethys-copy.mjs.map +1 -1
- package/fesm2022/ngx-tethys-date-picker.mjs +861 -1078
- package/fesm2022/ngx-tethys-date-picker.mjs.map +1 -1
- package/fesm2022/ngx-tethys-divider.mjs +5 -5
- package/fesm2022/ngx-tethys-divider.mjs.map +1 -1
- package/fesm2022/ngx-tethys-dropdown.mjs +159 -209
- package/fesm2022/ngx-tethys-dropdown.mjs.map +1 -1
- package/fesm2022/ngx-tethys-empty.mjs +5 -2
- package/fesm2022/ngx-tethys-empty.mjs.map +1 -1
- package/fesm2022/ngx-tethys-flexible-text.mjs +68 -88
- package/fesm2022/ngx-tethys-flexible-text.mjs.map +1 -1
- package/fesm2022/ngx-tethys-grid.mjs +10 -15
- package/fesm2022/ngx-tethys-grid.mjs.map +1 -1
- package/fesm2022/ngx-tethys-i18n.mjs +26 -6
- package/fesm2022/ngx-tethys-i18n.mjs.map +1 -1
- package/fesm2022/ngx-tethys-icon.mjs +44 -59
- package/fesm2022/ngx-tethys-icon.mjs.map +1 -1
- package/fesm2022/ngx-tethys-image.mjs +44 -42
- package/fesm2022/ngx-tethys-image.mjs.map +1 -1
- package/fesm2022/ngx-tethys-input-number.mjs.map +1 -1
- package/fesm2022/ngx-tethys-layout.mjs +291 -334
- package/fesm2022/ngx-tethys-layout.mjs.map +1 -1
- package/fesm2022/ngx-tethys-list.mjs +183 -217
- package/fesm2022/ngx-tethys-list.mjs.map +1 -1
- package/fesm2022/ngx-tethys-message.mjs +29 -36
- package/fesm2022/ngx-tethys-message.mjs.map +1 -1
- package/fesm2022/ngx-tethys-notify.mjs +33 -41
- package/fesm2022/ngx-tethys-notify.mjs.map +1 -1
- package/fesm2022/ngx-tethys-progress.mjs +7 -11
- package/fesm2022/ngx-tethys-progress.mjs.map +1 -1
- package/fesm2022/ngx-tethys-property.mjs +8 -19
- package/fesm2022/ngx-tethys-property.mjs.map +1 -1
- package/fesm2022/ngx-tethys-radio.mjs +46 -58
- package/fesm2022/ngx-tethys-radio.mjs.map +1 -1
- package/fesm2022/ngx-tethys-rate.mjs +115 -157
- package/fesm2022/ngx-tethys-rate.mjs.map +1 -1
- package/fesm2022/ngx-tethys-resizable.mjs +100 -143
- package/fesm2022/ngx-tethys-resizable.mjs.map +1 -1
- package/fesm2022/ngx-tethys-segment.mjs +84 -103
- package/fesm2022/ngx-tethys-segment.mjs.map +1 -1
- package/fesm2022/ngx-tethys-select.mjs +164 -228
- package/fesm2022/ngx-tethys-select.mjs.map +1 -1
- package/fesm2022/ngx-tethys-shared.mjs +423 -586
- package/fesm2022/ngx-tethys-shared.mjs.map +1 -1
- package/fesm2022/ngx-tethys-skeleton.mjs +1 -2
- package/fesm2022/ngx-tethys-skeleton.mjs.map +1 -1
- package/fesm2022/ngx-tethys-slide.mjs +37 -56
- package/fesm2022/ngx-tethys-slide.mjs.map +1 -1
- package/fesm2022/ngx-tethys-slider.mjs.map +1 -1
- package/fesm2022/ngx-tethys-space.mjs +2 -8
- package/fesm2022/ngx-tethys-space.mjs.map +1 -1
- package/fesm2022/ngx-tethys-stepper.mjs.map +1 -1
- package/fesm2022/ngx-tethys-strength.mjs +52 -66
- package/fesm2022/ngx-tethys-strength.mjs.map +1 -1
- package/fesm2022/ngx-tethys-table.mjs +1 -2
- package/fesm2022/ngx-tethys-table.mjs.map +1 -1
- package/fesm2022/ngx-tethys-time-picker.mjs +244 -271
- package/fesm2022/ngx-tethys-time-picker.mjs.map +1 -1
- package/fesm2022/ngx-tethys-tooltip.mjs +109 -93
- package/fesm2022/ngx-tethys-tooltip.mjs.map +1 -1
- package/fesm2022/ngx-tethys-transfer.mjs +98 -119
- package/fesm2022/ngx-tethys-transfer.mjs.map +1 -1
- package/fesm2022/ngx-tethys-tree-select.mjs +216 -284
- package/fesm2022/ngx-tethys-tree-select.mjs.map +1 -1
- package/fesm2022/ngx-tethys-tree.mjs +281 -401
- package/fesm2022/ngx-tethys-tree.mjs.map +1 -1
- package/fesm2022/ngx-tethys-upload.mjs +2 -2
- package/fesm2022/ngx-tethys-upload.mjs.map +1 -1
- package/fesm2022/ngx-tethys-vote.mjs +53 -99
- package/fesm2022/ngx-tethys-vote.mjs.map +1 -1
- package/fesm2022/ngx-tethys.mjs +1 -1
- package/fesm2022/ngx-tethys.mjs.map +1 -1
- package/flexible-text/flexible-text.component.d.ts +9 -15
- package/grid/flex.d.ts +1 -3
- package/grid/thy-row.directive.d.ts +1 -4
- package/i18n/i18n.d.ts +7 -2
- package/i18n/locales/de-de.d.ts +5 -1
- package/i18n/locales/en-us.d.ts +5 -1
- package/i18n/locales/ja-jp.d.ts +5 -1
- package/i18n/locales/zh-hans.d.ts +5 -1
- package/i18n/locales/zh-hant.d.ts +5 -1
- package/icon/icon.component.d.ts +10 -18
- package/image/image.directive.d.ts +10 -13
- package/image/image.token.d.ts +5 -5
- package/image/preview/image-preview.component.d.ts +2 -2
- package/input-number/input-number.component.d.ts +1 -1
- package/layout/header.component.d.ts +15 -19
- package/layout/layout.component.d.ts +3 -2
- package/layout/sidebar-header.component.d.ts +7 -8
- package/layout/sidebar.component.d.ts +32 -62
- package/list/list-item-meta.component.d.ts +7 -9
- package/list/list-item.component.d.ts +0 -2
- package/list/list.component.d.ts +2 -8
- package/list/selection/selection-list.d.ts +33 -46
- package/message/abstract/abstract-message.component.d.ts +2 -3
- package/message/message-container.component.d.ts +0 -1
- package/message/message.component.d.ts +1 -3
- package/notify/notify-container.component.d.ts +0 -1
- package/notify/notify.component.d.ts +7 -12
- package/package.json +1 -1
- package/progress/progress-circle.component.d.ts +3 -5
- package/progress/progress.component.d.ts +2 -4
- package/property/properties.component.d.ts +0 -2
- package/property/property-item.component.d.ts +3 -10
- package/radio/group/radio-group.component.d.ts +5 -9
- package/rate/rate-item.component.d.ts +8 -11
- package/rate/rate.component.d.ts +18 -29
- package/resizable/resizable.directive.d.ts +20 -32
- package/resizable/resize-handle.component.d.ts +6 -7
- package/resizable/resize-handles.component.d.ts +5 -9
- package/schematics/version.d.ts +1 -1
- package/schematics/version.js +1 -1
- package/segment/segment-item.component.d.ts +9 -15
- package/segment/segment.component.d.ts +11 -15
- package/segment/segment.token.d.ts +4 -3
- package/select/custom-select/custom-select.component.d.ts +33 -56
- package/select/native-select/native-select.component.d.ts +7 -13
- package/shared/base-form-check.component.d.ts +6 -8
- package/shared/directives/string-or-template-outlet.directive.d.ts +5 -6
- package/shared/directives/thy-autofocus.directive.d.ts +4 -6
- package/shared/directives/thy-contextmenu.directive.d.ts +2 -2
- package/shared/directives/thy-ctrl-enter.directive.d.ts +2 -2
- package/shared/directives/thy-enter.directive.d.ts +2 -2
- package/shared/directives/thy-scroll.directive.d.ts +5 -8
- package/shared/directives/thy-show.d.ts +5 -6
- package/shared/directives/thy-stop-propagation.directive.d.ts +4 -4
- package/shared/directives/view-outlet.directive.d.ts +6 -7
- package/shared/ng-transclude.directive.d.ts +2 -3
- package/shared/option/group/option-group.component.d.ts +5 -9
- package/shared/option/list-option/list-option.component.d.ts +9 -13
- package/shared/option/option.component.d.ts +10 -17
- package/shared/option/option.token.d.ts +4 -3
- package/shared/option/options-container.component.d.ts +1 -1
- package/shared/select/select-control/select-control.component.d.ts +38 -53
- package/slide/slide-body/slide-body-section.component.d.ts +2 -6
- package/slide/slide-header/slide-header.component.d.ts +6 -9
- package/space/space.component.d.ts +5 -11
- package/stepper/stepper.component.d.ts +1 -1
- package/strength/strength.component.d.ts +8 -13
- package/table/table-column.component.d.ts +15 -5
- package/time-picker/inner/inner-time-picker.class.d.ts +15 -13
- package/time-picker/inner/inner-time-picker.component.d.ts +26 -26
- package/time-picker/time-picker-panel.component.d.ts +18 -20
- package/time-picker/time-picker.component.d.ts +22 -30
- package/tooltip/tooltip.directive.d.ts +20 -22
- package/transfer/transfer-list.component.d.ts +15 -15
- package/transfer/transfer.component.d.ts +20 -23
- package/tree/tree-abstract.d.ts +5 -5
- package/tree/tree-node.component.d.ts +24 -37
- package/tree/tree.class.d.ts +4 -4
- package/tree/tree.component.d.ts +47 -75
- package/tree/tree.service.d.ts +3 -4
- package/tree-select/tree-select.component.d.ts +54 -71
- package/vote/vote.component.d.ts +13 -33
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { HostBinding, Directive,
|
|
2
|
+
import { HostBinding, Directive, viewChild, input, ChangeDetectionStrategy, ViewEncapsulation, Component, inject, ElementRef, NgZone, ChangeDetectorRef, ViewContainerRef, computed, numberAttribute, output, effect, HostListener, DestroyRef, ContentChildren, NgModule } from '@angular/core';
|
|
3
3
|
import { NgTemplateOutlet, CommonModule } from '@angular/common';
|
|
4
4
|
import { ThyPopover, ThyPopoverModule } from 'ngx-tethys/popover';
|
|
5
5
|
import { FocusMonitor } from '@angular/cdk/a11y';
|
|
6
6
|
import { Platform } from '@angular/cdk/platform';
|
|
7
|
-
import {
|
|
8
|
-
import { coerceBooleanProperty, coerceArray, isFunction, isTemplateRef, helpers, getElementOffset } from 'ngx-tethys/util';
|
|
9
|
-
import { __decorate, __metadata } from 'tslib';
|
|
10
|
-
import { fromEvent } from 'rxjs';
|
|
11
|
-
import { debounceTime, shareReplay, startWith, mergeMap } from 'rxjs/operators';
|
|
7
|
+
import { ThyOverlayDirectiveBase } from 'ngx-tethys/core';
|
|
8
|
+
import { coerceCssPixelValue, coerceBooleanProperty, isUndefinedOrNull, coerceArray, isFunction, isTemplateRef, helpers, getElementOffset } from 'ngx-tethys/util';
|
|
12
9
|
import { useHostRenderer } from '@tethys/cdk/dom';
|
|
13
|
-
import {
|
|
10
|
+
import { fromEvent, startWith, mergeMap } from 'rxjs';
|
|
11
|
+
import { debounceTime, shareReplay } from 'rxjs/operators';
|
|
12
|
+
import { takeUntilDestroyed, outputToObservable } from '@angular/core/rxjs-interop';
|
|
14
13
|
|
|
15
14
|
const THY_DROPDOWN_DEFAULT_WIDTH = '240px';
|
|
16
15
|
/**
|
|
@@ -35,28 +34,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
35
34
|
* @order 20
|
|
36
35
|
*/
|
|
37
36
|
class ThyDropdownMenuComponent {
|
|
38
|
-
get template() {
|
|
39
|
-
return this.templateRef;
|
|
40
|
-
}
|
|
41
37
|
constructor() {
|
|
38
|
+
this.templateRef = viewChild.required('dropdownMenu');
|
|
42
39
|
/**
|
|
43
40
|
* 设置菜单宽度
|
|
44
|
-
* @default 240px
|
|
45
41
|
*/
|
|
46
|
-
this.thyWidth = THY_DROPDOWN_DEFAULT_WIDTH;
|
|
42
|
+
this.thyWidth = input(THY_DROPDOWN_DEFAULT_WIDTH, { transform: coerceCssPixelValue });
|
|
47
43
|
/**
|
|
48
44
|
* 是否直接渲染 dropdown-menu 中的元素
|
|
49
|
-
* @default false
|
|
50
45
|
*/
|
|
51
|
-
this.thyImmediateRender = false;
|
|
46
|
+
this.thyImmediateRender = input(false, { transform: coerceBooleanProperty });
|
|
52
47
|
}
|
|
53
48
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyDropdownMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
54
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyDropdownMenuComponent, isStandalone: true, selector: "thy-dropdown-menu", inputs: { thyWidth: "thyWidth", thyImmediateRender:
|
|
55
|
-
@if (thyImmediateRender) {
|
|
49
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyDropdownMenuComponent, isStandalone: true, selector: "thy-dropdown-menu", inputs: { thyWidth: { classPropertyName: "thyWidth", publicName: "thyWidth", isSignal: true, isRequired: false, transformFunction: null }, thyImmediateRender: { classPropertyName: "thyImmediateRender", publicName: "thyImmediateRender", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.thy-dropdown-menu": "thyImmediateRender()", "style.width": "thyImmediateRender() ? thyWidth() : ''" } }, viewQueries: [{ propertyName: "templateRef", first: true, predicate: ["dropdownMenu"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
50
|
+
@if (thyImmediateRender()) {
|
|
56
51
|
<ng-container *ngTemplateOutlet="content"></ng-container>
|
|
57
52
|
}
|
|
58
53
|
<ng-template #dropdownMenu>
|
|
59
|
-
<div class="thy-dropdown-menu" [style.width]="thyWidth">
|
|
54
|
+
<div class="thy-dropdown-menu" [style.width]="thyWidth()">
|
|
60
55
|
<ng-container *ngTemplateOutlet="content"></ng-container>
|
|
61
56
|
</div>
|
|
62
57
|
</ng-template>
|
|
@@ -65,20 +60,16 @@ class ThyDropdownMenuComponent {
|
|
|
65
60
|
</ng-template>
|
|
66
61
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
67
62
|
}
|
|
68
|
-
__decorate([
|
|
69
|
-
InputCssPixel(),
|
|
70
|
-
__metadata("design:type", Object)
|
|
71
|
-
], ThyDropdownMenuComponent.prototype, "thyWidth", void 0);
|
|
72
63
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyDropdownMenuComponent, decorators: [{
|
|
73
64
|
type: Component,
|
|
74
65
|
args: [{
|
|
75
66
|
selector: 'thy-dropdown-menu',
|
|
76
67
|
template: `
|
|
77
|
-
@if (thyImmediateRender) {
|
|
68
|
+
@if (thyImmediateRender()) {
|
|
78
69
|
<ng-container *ngTemplateOutlet="content"></ng-container>
|
|
79
70
|
}
|
|
80
71
|
<ng-template #dropdownMenu>
|
|
81
|
-
<div class="thy-dropdown-menu" [style.width]="thyWidth">
|
|
72
|
+
<div class="thy-dropdown-menu" [style.width]="thyWidth()">
|
|
82
73
|
<ng-container *ngTemplateOutlet="content"></ng-container>
|
|
83
74
|
</div>
|
|
84
75
|
</ng-template>
|
|
@@ -89,36 +80,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
89
80
|
encapsulation: ViewEncapsulation.None,
|
|
90
81
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
91
82
|
host: {
|
|
92
|
-
'[class.thy-dropdown-menu]': 'thyImmediateRender',
|
|
93
|
-
'[style.width]': "thyImmediateRender ? thyWidth : ''"
|
|
83
|
+
'[class.thy-dropdown-menu]': 'thyImmediateRender()',
|
|
84
|
+
'[style.width]': "thyImmediateRender() ? thyWidth() : ''"
|
|
94
85
|
},
|
|
95
86
|
imports: [NgTemplateOutlet]
|
|
96
87
|
}]
|
|
97
|
-
}], ctorParameters: () => []
|
|
98
|
-
type: ViewChild,
|
|
99
|
-
args: ['dropdownMenu', { static: true }]
|
|
100
|
-
}], thyWidth: [{
|
|
101
|
-
type: Input
|
|
102
|
-
}], thyImmediateRender: [{
|
|
103
|
-
type: Input,
|
|
104
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
105
|
-
}] } });
|
|
88
|
+
}], ctorParameters: () => [] });
|
|
106
89
|
/**
|
|
107
90
|
* 下拉菜单分组
|
|
108
91
|
* @name thy-dropdown-menu-group
|
|
109
92
|
* @order 50
|
|
110
93
|
*/
|
|
111
94
|
class ThyDropdownMenuGroup {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
this.
|
|
95
|
+
constructor() {
|
|
96
|
+
/**
|
|
97
|
+
* 分组标题
|
|
98
|
+
*/
|
|
99
|
+
this.thyTitle = input();
|
|
117
100
|
}
|
|
118
|
-
constructor() { }
|
|
119
101
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyDropdownMenuGroup, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
120
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
121
|
-
<div class="dropdown-menu-group-title">{{
|
|
102
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.8", type: ThyDropdownMenuGroup, isStandalone: true, selector: "thy-dropdown-menu-group", inputs: { thyTitle: { classPropertyName: "thyTitle", publicName: "thyTitle", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "dropdown-menu-group" }, ngImport: i0, template: `
|
|
103
|
+
<div class="dropdown-menu-group-title">{{ thyTitle() }}</div>
|
|
122
104
|
<ng-content></ng-content>
|
|
123
105
|
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
124
106
|
}
|
|
@@ -127,7 +109,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
127
109
|
args: [{
|
|
128
110
|
selector: 'thy-dropdown-menu-group',
|
|
129
111
|
template: `
|
|
130
|
-
<div class="dropdown-menu-group-title">{{
|
|
112
|
+
<div class="dropdown-menu-group-title">{{ thyTitle() }}</div>
|
|
131
113
|
<ng-content></ng-content>
|
|
132
114
|
`,
|
|
133
115
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
@@ -135,9 +117,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
135
117
|
class: 'dropdown-menu-group'
|
|
136
118
|
}
|
|
137
119
|
}]
|
|
138
|
-
}], ctorParameters: () => []
|
|
139
|
-
type: Input
|
|
140
|
-
}] } });
|
|
120
|
+
}], ctorParameters: () => [] });
|
|
141
121
|
/**
|
|
142
122
|
* 下拉菜单分割线
|
|
143
123
|
* @name thy-dropdown-menu-divider
|
|
@@ -165,50 +145,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
165
145
|
* @order 10
|
|
166
146
|
*/
|
|
167
147
|
class ThyDropdownDirective extends ThyOverlayDirectiveBase {
|
|
168
|
-
/**
|
|
169
|
-
* Dropdown 下拉菜单,支持 thy-dropdown-menu 组件、TemplateRef 和自定义菜单组件
|
|
170
|
-
*/
|
|
171
|
-
set thyDropdownMenu(menu) {
|
|
172
|
-
this.menu = menu;
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Dropdown 下拉菜单组件,和 thyDropdownMenu 参与相同,快捷传下拉菜单组件参数
|
|
176
|
-
*/
|
|
177
|
-
set thyDropdown(menu) {
|
|
178
|
-
this.menu = menu;
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* 下拉菜单触发方式
|
|
182
|
-
* @type 'hover' | 'focus' | 'click' | string
|
|
183
|
-
* @default click
|
|
184
|
-
*/
|
|
185
|
-
set thyTrigger(value) {
|
|
186
|
-
this.trigger = value;
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* 打开延迟毫秒
|
|
190
|
-
* @default 100
|
|
191
|
-
*/
|
|
192
|
-
set thyShowDelay(value) {
|
|
193
|
-
this.showDelay = value;
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* 关闭延迟毫秒
|
|
197
|
-
* @default 100
|
|
198
|
-
*/
|
|
199
|
-
set thyHideDelay(value) {
|
|
200
|
-
this.hideDelay = value;
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* 弹出框 overlay panel 的类名
|
|
204
|
-
* @type string | string[]
|
|
205
|
-
*/
|
|
206
|
-
set thyPanelClass(value) {
|
|
207
|
-
this.innerPanelClassList = this.innerPanelClassList.concat(coerceArray(value));
|
|
208
|
-
}
|
|
209
|
-
get thyPanelClass() {
|
|
210
|
-
return this.innerPanelClassList;
|
|
211
|
-
}
|
|
212
148
|
constructor() {
|
|
213
149
|
const elementRef = inject(ElementRef);
|
|
214
150
|
const platform = inject(Platform);
|
|
@@ -218,46 +154,105 @@ class ThyDropdownDirective extends ThyOverlayDirectiveBase {
|
|
|
218
154
|
super(elementRef, platform, focusMonitor, ngZone, true, changeDetectorRef);
|
|
219
155
|
this.viewContainerRef = inject(ViewContainerRef);
|
|
220
156
|
this.popover = inject(ThyPopover);
|
|
221
|
-
this.
|
|
157
|
+
this.menu = computed(() => {
|
|
158
|
+
return (this.thyDropdownMenu() || this.thyDropdown());
|
|
159
|
+
});
|
|
222
160
|
this.popoverOpened = false;
|
|
161
|
+
/**
|
|
162
|
+
* Dropdown 下拉菜单,支持 thy-dropdown-menu 组件、TemplateRef 和自定义菜单组件
|
|
163
|
+
*/
|
|
164
|
+
this.thyDropdownMenu = input();
|
|
165
|
+
/**
|
|
166
|
+
* Dropdown 下拉菜单组件,和 thyDropdownMenu 参与相同,快捷传下拉菜单组件参数
|
|
167
|
+
*/
|
|
168
|
+
this.thyDropdown = input();
|
|
169
|
+
/**
|
|
170
|
+
* 下拉菜单触发方式
|
|
171
|
+
* @type 'hover' | 'focus' | 'click' | string
|
|
172
|
+
* @default click
|
|
173
|
+
*/
|
|
174
|
+
this.thyTrigger = input('click');
|
|
175
|
+
/**
|
|
176
|
+
* 打开延迟毫秒
|
|
177
|
+
*/
|
|
178
|
+
this.thyShowDelay = input(100, { transform: numberAttribute });
|
|
179
|
+
/**
|
|
180
|
+
* 关闭延迟毫秒
|
|
181
|
+
*/
|
|
182
|
+
this.thyHideDelay = input(100, { transform: numberAttribute });
|
|
223
183
|
/**
|
|
224
184
|
* 弹出菜单后的当前触发元素的激活样式类
|
|
225
185
|
*/
|
|
226
|
-
this.thyActiveClass = 'thy-dropdown-origin-active'
|
|
186
|
+
this.thyActiveClass = input('thy-dropdown-origin-active', {
|
|
187
|
+
transform: (value) => value || 'thy-dropdown-origin-active'
|
|
188
|
+
});
|
|
189
|
+
/**
|
|
190
|
+
* 弹出框的参数,底层使用 Popover 组件, 默认为`{ placement: "bottomLeft", insideClosable: true, minWidth: "240px", outsideClosable: true }`
|
|
191
|
+
*/
|
|
192
|
+
this.thyPopoverOptions = input();
|
|
193
|
+
/**
|
|
194
|
+
* 弹出框的显示位置,会覆盖 thyPopoverOptions 中的 placement,`top` | `topLeft` | `topRight` | `bottom` | `bottomLeft` | `bottomRight` | `left` | `leftTop` | `leftBottom` | `right` | `rightTop` | `rightBottom`
|
|
195
|
+
* @default bottomLeft
|
|
196
|
+
*/
|
|
197
|
+
this.thyPlacement = input();
|
|
198
|
+
/**
|
|
199
|
+
* 点击 dropdown-menu 内部是否关闭弹出框,会覆盖 thyPopoverOptions 中的 insideClosable
|
|
200
|
+
*/
|
|
201
|
+
this.thyMenuInsideClosable = input(true, { transform: coerceBooleanProperty });
|
|
202
|
+
/**
|
|
203
|
+
* 弹出框 overlay panel 的类名
|
|
204
|
+
* @type string | string[]
|
|
205
|
+
*/
|
|
206
|
+
this.thyPanelClass = input(['thy-dropdown-pane'], {
|
|
207
|
+
transform: (value) => (!isUndefinedOrNull(value) && ['thy-dropdown-pane'].concat(coerceArray(value))) || ['thy-dropdown-pane']
|
|
208
|
+
});
|
|
227
209
|
/**
|
|
228
210
|
* 菜单 Active 事件,打开菜单返回 true,关闭返回 false
|
|
229
211
|
*/
|
|
230
|
-
this.thyActiveChange =
|
|
212
|
+
this.thyActiveChange = output();
|
|
213
|
+
// TODO: 以下为 overlay 基类中参数,之后需统一修改
|
|
214
|
+
effect(() => {
|
|
215
|
+
this.trigger = (this.thyTrigger() || 'click');
|
|
216
|
+
});
|
|
217
|
+
effect(() => {
|
|
218
|
+
this.hideDelay = this.thyHideDelay() ?? 100;
|
|
219
|
+
});
|
|
220
|
+
effect(() => {
|
|
221
|
+
this.showDelay = this.thyShowDelay() ?? 100;
|
|
222
|
+
});
|
|
231
223
|
}
|
|
232
224
|
ngOnInit() {
|
|
233
225
|
this.initialize();
|
|
234
226
|
}
|
|
235
227
|
createOverlay() {
|
|
236
228
|
let componentTypeOrTemplateRef;
|
|
237
|
-
|
|
238
|
-
|
|
229
|
+
const menu = this.menu();
|
|
230
|
+
if (menu && menu instanceof ThyDropdownMenuComponent) {
|
|
231
|
+
componentTypeOrTemplateRef = menu?.templateRef();
|
|
239
232
|
}
|
|
240
|
-
else if (isFunction(
|
|
241
|
-
componentTypeOrTemplateRef =
|
|
233
|
+
else if (isFunction(menu) || isTemplateRef(menu)) {
|
|
234
|
+
componentTypeOrTemplateRef = menu;
|
|
242
235
|
}
|
|
243
236
|
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
244
237
|
if (!componentTypeOrTemplateRef) {
|
|
245
238
|
throw new Error(`thyDropdownMenu is required`);
|
|
246
239
|
}
|
|
247
240
|
}
|
|
248
|
-
const { placement, height, insideClosable, outsideClosable, minWidth } = Object.assign({ placement: 'bottomLeft', insideClosable: true, outsideClosable: true }, this.thyPopoverOptions);
|
|
241
|
+
const { placement, height, insideClosable, outsideClosable, minWidth } = Object.assign({ placement: 'bottomLeft', insideClosable: true, outsideClosable: true }, this.thyPopoverOptions());
|
|
242
|
+
const thyPlacement = this.thyPlacement();
|
|
243
|
+
const thyMenuInsideClosable = this.thyMenuInsideClosable();
|
|
249
244
|
const config = {
|
|
250
245
|
origin: this.elementRef.nativeElement,
|
|
251
246
|
hasBackdrop: false,
|
|
252
247
|
viewContainerRef: this.viewContainerRef,
|
|
253
248
|
offset: 0,
|
|
254
|
-
panelClass: this.thyPanelClass,
|
|
255
|
-
placement:
|
|
249
|
+
panelClass: this.thyPanelClass(),
|
|
250
|
+
placement: thyPlacement ? thyPlacement : placement,
|
|
256
251
|
height,
|
|
257
252
|
outsideClosable,
|
|
258
|
-
insideClosable: helpers.isUndefined(
|
|
253
|
+
insideClosable: helpers.isUndefined(thyMenuInsideClosable) ? insideClosable : thyMenuInsideClosable,
|
|
259
254
|
minWidth,
|
|
260
|
-
originActiveClass: this.thyActiveClass
|
|
255
|
+
originActiveClass: this.thyActiveClass()
|
|
261
256
|
};
|
|
262
257
|
this.popoverRef = this.popover.open(componentTypeOrTemplateRef, config);
|
|
263
258
|
this.popoverRef.afterOpened().subscribe(() => {
|
|
@@ -302,7 +297,7 @@ class ThyDropdownDirective extends ThyOverlayDirectiveBase {
|
|
|
302
297
|
}, delay);
|
|
303
298
|
}
|
|
304
299
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyDropdownDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
305
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
300
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: ThyDropdownDirective, isStandalone: true, selector: "[thyDropdown]", inputs: { thyDropdownMenu: { classPropertyName: "thyDropdownMenu", publicName: "thyDropdownMenu", isSignal: true, isRequired: false, transformFunction: null }, thyDropdown: { classPropertyName: "thyDropdown", publicName: "thyDropdown", isSignal: true, isRequired: false, transformFunction: null }, thyTrigger: { classPropertyName: "thyTrigger", publicName: "thyTrigger", isSignal: true, isRequired: false, transformFunction: null }, thyShowDelay: { classPropertyName: "thyShowDelay", publicName: "thyShowDelay", isSignal: true, isRequired: false, transformFunction: null }, thyHideDelay: { classPropertyName: "thyHideDelay", publicName: "thyHideDelay", isSignal: true, isRequired: false, transformFunction: null }, thyActiveClass: { classPropertyName: "thyActiveClass", publicName: "thyActiveClass", isSignal: true, isRequired: false, transformFunction: null }, thyPopoverOptions: { classPropertyName: "thyPopoverOptions", publicName: "thyPopoverOptions", isSignal: true, isRequired: false, transformFunction: null }, thyPlacement: { classPropertyName: "thyPlacement", publicName: "thyPlacement", isSignal: true, isRequired: false, transformFunction: null }, thyMenuInsideClosable: { classPropertyName: "thyMenuInsideClosable", publicName: "thyMenuInsideClosable", isSignal: true, isRequired: false, transformFunction: null }, thyPanelClass: { classPropertyName: "thyPanelClass", publicName: "thyPanelClass", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { thyActiveChange: "thyActiveChange" }, host: { classAttribute: "thy-dropdown" }, usesInheritance: true, ngImport: i0 }); }
|
|
306
301
|
}
|
|
307
302
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyDropdownDirective, decorators: [{
|
|
308
303
|
type: Directive,
|
|
@@ -312,32 +307,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
312
307
|
class: 'thy-dropdown'
|
|
313
308
|
}
|
|
314
309
|
}]
|
|
315
|
-
}], ctorParameters: () => []
|
|
316
|
-
type: Input
|
|
317
|
-
}], thyDropdown: [{
|
|
318
|
-
type: Input
|
|
319
|
-
}], thyTrigger: [{
|
|
320
|
-
type: Input
|
|
321
|
-
}], thyShowDelay: [{
|
|
322
|
-
type: Input,
|
|
323
|
-
args: [{ transform: numberAttribute }]
|
|
324
|
-
}], thyHideDelay: [{
|
|
325
|
-
type: Input,
|
|
326
|
-
args: [{ transform: numberAttribute }]
|
|
327
|
-
}], thyActiveClass: [{
|
|
328
|
-
type: Input
|
|
329
|
-
}], thyPopoverOptions: [{
|
|
330
|
-
type: Input
|
|
331
|
-
}], thyPlacement: [{
|
|
332
|
-
type: Input
|
|
333
|
-
}], thyMenuInsideClosable: [{
|
|
334
|
-
type: Input,
|
|
335
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
336
|
-
}], thyPanelClass: [{
|
|
337
|
-
type: Input
|
|
338
|
-
}], thyActiveChange: [{
|
|
339
|
-
type: Output
|
|
340
|
-
}] } });
|
|
310
|
+
}], ctorParameters: () => [] });
|
|
341
311
|
|
|
342
312
|
/**
|
|
343
313
|
* 菜单项
|
|
@@ -347,29 +317,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
347
317
|
class ThyDropdownMenuItemDirective {
|
|
348
318
|
constructor() {
|
|
349
319
|
this.elementRef = inject(ElementRef);
|
|
350
|
-
this.
|
|
351
|
-
this.
|
|
352
|
-
|
|
353
|
-
|
|
320
|
+
this.danger = computed(() => this.thyType() === 'danger' || false);
|
|
321
|
+
this.success = computed(() => this.thyType() === 'success' || false);
|
|
322
|
+
/**
|
|
323
|
+
* 菜单项类型
|
|
324
|
+
* @type 'default' | 'danger' | 'success' | ''
|
|
325
|
+
*/
|
|
326
|
+
this.thyType = input('default');
|
|
327
|
+
/**
|
|
328
|
+
* 菜单项是否处于禁用状态
|
|
329
|
+
*/
|
|
330
|
+
this.thyDisabled = input(false, { transform: coerceBooleanProperty });
|
|
354
331
|
this.hostRenderer = useHostRenderer();
|
|
355
332
|
}
|
|
356
|
-
/**
|
|
357
|
-
* 菜单项类型
|
|
358
|
-
* @type 'default' | 'danger' | 'success' | ''
|
|
359
|
-
* @default default
|
|
360
|
-
*/
|
|
361
|
-
set thyType(value) {
|
|
362
|
-
this[value] = true;
|
|
363
|
-
}
|
|
364
|
-
/**
|
|
365
|
-
* 菜单项是否处于禁用状态
|
|
366
|
-
* @default false
|
|
367
|
-
*/
|
|
368
|
-
set thyDisabled(value) {
|
|
369
|
-
this.disabled = value;
|
|
370
|
-
}
|
|
371
333
|
onClick(event) {
|
|
372
|
-
if (this.
|
|
334
|
+
if (this.thyDisabled()) {
|
|
373
335
|
event.stopPropagation();
|
|
374
336
|
event.preventDefault();
|
|
375
337
|
}
|
|
@@ -385,31 +347,20 @@ class ThyDropdownMenuItemDirective {
|
|
|
385
347
|
return fromEvent(this.elementRef.nativeElement, 'mouseenter').pipe(debounceTime(100), shareReplay());
|
|
386
348
|
}
|
|
387
349
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyDropdownMenuItemDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
388
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
350
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: ThyDropdownMenuItemDirective, isStandalone: true, selector: "[thyDropdownMenuItem]", inputs: { thyType: { classPropertyName: "thyType", publicName: "thyType", isSignal: true, isRequired: false, transformFunction: null }, thyDisabled: { classPropertyName: "thyDisabled", publicName: "thyDisabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "onClick($event)" }, properties: { "class.dropdown-menu-item--disabled": "thyDisabled()", "class.dropdown-menu-item--danger": "danger()", "class.dropdown-menu-item--success": "success()" }, classAttribute: "dropdown-menu-item" }, ngImport: i0 }); }
|
|
389
351
|
}
|
|
390
352
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyDropdownMenuItemDirective, decorators: [{
|
|
391
353
|
type: Directive,
|
|
392
354
|
args: [{
|
|
393
|
-
selector: '[thyDropdownMenuItem]'
|
|
355
|
+
selector: '[thyDropdownMenuItem]',
|
|
356
|
+
host: {
|
|
357
|
+
class: 'dropdown-menu-item',
|
|
358
|
+
'[class.dropdown-menu-item--disabled]': `thyDisabled()`,
|
|
359
|
+
'[class.dropdown-menu-item--danger]': 'danger()',
|
|
360
|
+
'[class.dropdown-menu-item--success]': 'success()'
|
|
361
|
+
}
|
|
394
362
|
}]
|
|
395
|
-
}], propDecorators: {
|
|
396
|
-
type: HostBinding,
|
|
397
|
-
args: ['class.dropdown-menu-item']
|
|
398
|
-
}], disabled: [{
|
|
399
|
-
type: HostBinding,
|
|
400
|
-
args: ['class.dropdown-menu-item--disabled']
|
|
401
|
-
}], danger: [{
|
|
402
|
-
type: HostBinding,
|
|
403
|
-
args: ['class.dropdown-menu-item--danger']
|
|
404
|
-
}], success: [{
|
|
405
|
-
type: HostBinding,
|
|
406
|
-
args: ['class.dropdown-menu-item--success']
|
|
407
|
-
}], thyType: [{
|
|
408
|
-
type: Input
|
|
409
|
-
}], thyDisabled: [{
|
|
410
|
-
type: Input,
|
|
411
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
412
|
-
}], onClick: [{
|
|
363
|
+
}], propDecorators: { onClick: [{
|
|
413
364
|
type: HostListener,
|
|
414
365
|
args: ['click', ['$event']]
|
|
415
366
|
}] } });
|
|
@@ -519,22 +470,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
519
470
|
* @order 70
|
|
520
471
|
*/
|
|
521
472
|
class ThyDropdownMenuItemActiveDirective {
|
|
522
|
-
constructor() {
|
|
473
|
+
constructor() {
|
|
474
|
+
/**
|
|
475
|
+
* 是否激活
|
|
476
|
+
* @type boolean | string
|
|
477
|
+
*/
|
|
478
|
+
this.thyDropdownMenuItemActive = input(false, { transform: coerceBooleanProperty });
|
|
479
|
+
}
|
|
523
480
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyDropdownMenuItemActiveDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
524
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
481
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: ThyDropdownMenuItemActiveDirective, isStandalone: true, selector: "[thyDropdownMenuItemActive]", inputs: { thyDropdownMenuItemActive: { classPropertyName: "thyDropdownMenuItemActive", publicName: "thyDropdownMenuItemActive", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.active": "thyDropdownMenuItemActive()" } }, ngImport: i0 }); }
|
|
525
482
|
}
|
|
526
483
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyDropdownMenuItemActiveDirective, decorators: [{
|
|
527
484
|
type: Directive,
|
|
528
485
|
args: [{
|
|
529
|
-
selector: '[thyDropdownMenuItemActive]'
|
|
486
|
+
selector: '[thyDropdownMenuItemActive]',
|
|
487
|
+
host: {
|
|
488
|
+
'[class.active]': `thyDropdownMenuItemActive()`
|
|
489
|
+
}
|
|
530
490
|
}]
|
|
531
|
-
}], ctorParameters: () => []
|
|
532
|
-
type: HostBinding,
|
|
533
|
-
args: ['class.active']
|
|
534
|
-
}, {
|
|
535
|
-
type: Input,
|
|
536
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
537
|
-
}] } });
|
|
491
|
+
}], ctorParameters: () => [] });
|
|
538
492
|
|
|
539
493
|
const SUBMENU_CLASS_PREFIX = 'dropdown-submenu';
|
|
540
494
|
/**
|
|
@@ -547,24 +501,24 @@ class ThyDropdownSubmenu {
|
|
|
547
501
|
this.dropdownMenuItem = inject(ThyDropdownMenuItemDirective);
|
|
548
502
|
this.elementRef = inject(ElementRef);
|
|
549
503
|
this.destroyRef = inject(DestroyRef);
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
504
|
+
/**
|
|
505
|
+
* 菜单方向
|
|
506
|
+
* @type left | right | auto
|
|
507
|
+
*/
|
|
508
|
+
this.thyDirection = input('right', {
|
|
509
|
+
transform: (value) => {
|
|
510
|
+
return value || 'right';
|
|
511
|
+
}
|
|
512
|
+
});
|
|
559
513
|
}
|
|
560
514
|
ngOnInit() {
|
|
561
|
-
let direction = this.
|
|
515
|
+
let direction = this.thyDirection();
|
|
562
516
|
this.updateClassByDirection(direction);
|
|
563
517
|
this.dropdownMenuItem
|
|
564
518
|
.bindMouseenterEvent()
|
|
565
519
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
566
520
|
.subscribe(() => {
|
|
567
|
-
if (this.
|
|
521
|
+
if (this.thyDirection() === 'auto') {
|
|
568
522
|
const element = this.dropdownMenuItem.getElement();
|
|
569
523
|
const offset = getElementOffset(element);
|
|
570
524
|
if (document.documentElement.clientWidth < offset.left + offset.width + offset.width) {
|
|
@@ -597,7 +551,7 @@ class ThyDropdownSubmenu {
|
|
|
597
551
|
}
|
|
598
552
|
}
|
|
599
553
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyDropdownSubmenu, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
600
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
554
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.8", type: ThyDropdownSubmenu, isStandalone: true, selector: "[thyDropdownSubmenu],thy-dropdown-submenu", inputs: { thyDirection: { classPropertyName: "thyDirection", publicName: "thyDirection", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "dropdown-submenu" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
601
555
|
}
|
|
602
556
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyDropdownSubmenu, decorators: [{
|
|
603
557
|
type: Component,
|
|
@@ -609,9 +563,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
609
563
|
},
|
|
610
564
|
changeDetection: ChangeDetectionStrategy.OnPush
|
|
611
565
|
}]
|
|
612
|
-
}]
|
|
613
|
-
type: Input
|
|
614
|
-
}] } });
|
|
566
|
+
}] });
|
|
615
567
|
|
|
616
568
|
/**
|
|
617
569
|
* 跟踪 Dropdown 菜单是否被打开处于激活状态,允许指定一个或多个CSS类,以便在菜单打开状态时添加到元素中
|
|
@@ -620,25 +572,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
620
572
|
*/
|
|
621
573
|
class ThyDropdownActiveDirective {
|
|
622
574
|
constructor() {
|
|
623
|
-
this.elementRef = inject(ElementRef);
|
|
624
575
|
this.trigger = inject(ThyDropdownDirective, { optional: true });
|
|
576
|
+
this.classes = computed(() => {
|
|
577
|
+
return coerceArray(this.thyDropdownActive()).filter(c => !!c);
|
|
578
|
+
});
|
|
625
579
|
this.hostRenderer = useHostRenderer();
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
set thyDropdownActive(data) {
|
|
632
|
-
this.classes = coerceArray(data).filter(c => !!c);
|
|
580
|
+
/**
|
|
581
|
+
* 设置 Active 样式类,可以是一个或多个CSS类
|
|
582
|
+
* @type string[] | string
|
|
583
|
+
*/
|
|
584
|
+
this.thyDropdownActive = input();
|
|
633
585
|
}
|
|
634
586
|
ngOnInit() { }
|
|
635
587
|
ngAfterContentInit() {
|
|
636
588
|
this.triggers.changes
|
|
637
589
|
.pipe(startWith(this.triggers.toArray()), mergeMap((triggers) => {
|
|
638
590
|
const result = triggers.map(item => {
|
|
639
|
-
return item.thyActiveChange;
|
|
591
|
+
return outputToObservable(item.thyActiveChange);
|
|
640
592
|
});
|
|
641
|
-
this.trigger && result.push(this.trigger.thyActiveChange);
|
|
593
|
+
this.trigger && result.push(outputToObservable(this.trigger.thyActiveChange));
|
|
642
594
|
return result;
|
|
643
595
|
}), mergeMap(result => {
|
|
644
596
|
return result;
|
|
@@ -648,7 +600,7 @@ class ThyDropdownActiveDirective {
|
|
|
648
600
|
});
|
|
649
601
|
}
|
|
650
602
|
update(active) {
|
|
651
|
-
this.classes.forEach(className => {
|
|
603
|
+
this.classes().forEach(className => {
|
|
652
604
|
if (active) {
|
|
653
605
|
this.hostRenderer.addClass(className);
|
|
654
606
|
}
|
|
@@ -658,16 +610,14 @@ class ThyDropdownActiveDirective {
|
|
|
658
610
|
});
|
|
659
611
|
}
|
|
660
612
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyDropdownActiveDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
661
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
613
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: ThyDropdownActiveDirective, isStandalone: true, selector: "[thyDropdownActive]", inputs: { thyDropdownActive: { classPropertyName: "thyDropdownActive", publicName: "thyDropdownActive", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "triggers", predicate: ThyDropdownDirective, descendants: true }], ngImport: i0 }); }
|
|
662
614
|
}
|
|
663
615
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyDropdownActiveDirective, decorators: [{
|
|
664
616
|
type: Directive,
|
|
665
617
|
args: [{
|
|
666
618
|
selector: '[thyDropdownActive]'
|
|
667
619
|
}]
|
|
668
|
-
}], propDecorators: {
|
|
669
|
-
type: Input
|
|
670
|
-
}], triggers: [{
|
|
620
|
+
}], propDecorators: { triggers: [{
|
|
671
621
|
type: ContentChildren,
|
|
672
622
|
args: [ThyDropdownDirective, { descendants: true }]
|
|
673
623
|
}] } });
|