ngx-tethys 19.1.0-next.0 → 19.1.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/README.md +0 -1
- package/action/action.component.d.ts +7 -8
- package/affix/affix.component.d.ts +3 -4
- 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/date-picker/styles/calendar.scss +1 -1
- package/date-picker/styles/week-picker.scss +1 -0
- 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 +14 -25
- 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-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-collapse.mjs +2 -2
- package/fesm2022/ngx-tethys-collapse.mjs.map +1 -1
- package/fesm2022/ngx-tethys-date-picker.mjs +6 -6
- package/fesm2022/ngx-tethys-date-picker.mjs.map +1 -1
- package/fesm2022/ngx-tethys-dropdown.mjs +155 -203
- package/fesm2022/ngx-tethys-dropdown.mjs.map +1 -1
- package/fesm2022/ngx-tethys-flexible-text.mjs +67 -86
- 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-icon.mjs +44 -59
- package/fesm2022/ngx-tethys-icon.mjs.map +1 -1
- package/fesm2022/ngx-tethys-image.mjs +40 -36
- package/fesm2022/ngx-tethys-image.mjs.map +1 -1
- package/fesm2022/ngx-tethys-input-number.mjs.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 +42 -54
- package/fesm2022/ngx-tethys-radio.mjs.map +1 -1
- package/fesm2022/ngx-tethys-rate.mjs +115 -157
- package/fesm2022/ngx-tethys-rate.mjs.map +1 -1
- package/fesm2022/ngx-tethys-resizable.mjs +111 -157
- package/fesm2022/ngx-tethys-resizable.mjs.map +1 -1
- package/fesm2022/ngx-tethys-segment.mjs +84 -103
- package/fesm2022/ngx-tethys-segment.mjs.map +1 -1
- package/fesm2022/ngx-tethys-shared.mjs +2 -1
- package/fesm2022/ngx-tethys-shared.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-strength.mjs +52 -66
- package/fesm2022/ngx-tethys-strength.mjs.map +1 -1
- package/fesm2022/ngx-tethys-transfer.mjs +98 -119
- package/fesm2022/ngx-tethys-transfer.mjs.map +1 -1
- package/fesm2022/ngx-tethys-tree-select.mjs +2 -4
- package/fesm2022/ngx-tethys-tree-select.mjs.map +1 -1
- package/fesm2022/ngx-tethys-tree.mjs +281 -401
- package/fesm2022/ngx-tethys-tree.mjs.map +1 -1
- package/fesm2022/ngx-tethys-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/icon/icon.component.d.ts +10 -18
- package/image/image.directive.d.ts +10 -13
- package/image/image.token.d.ts +5 -5
- package/input-number/input-number.component.d.ts +1 -1
- 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 +18 -31
- 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/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/strength/strength.component.d.ts +8 -13
- 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 +2 -2
- package/vote/vote.component.d.ts +13 -33
|
@@ -1,15 +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, EventEmitter, effect, Output, 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 {
|
|
10
|
-
import { fromEvent } from 'rxjs';
|
|
11
|
-
import { debounceTime, shareReplay, startWith, mergeMap } from 'rxjs/operators';
|
|
7
|
+
import { ThyOverlayDirectiveBase } from 'ngx-tethys/core';
|
|
8
|
+
import { coerceBooleanProperty, isUndefinedOrNull, coerceArray, isFunction, isTemplateRef, helpers, getElementOffset } from 'ngx-tethys/util';
|
|
9
|
+
import { coerceCssPixelValue } from '@angular/cdk/coercion';
|
|
12
10
|
import { useHostRenderer } from '@tethys/cdk/dom';
|
|
11
|
+
import { fromEvent, startWith, mergeMap } from 'rxjs';
|
|
12
|
+
import { debounceTime, shareReplay } from 'rxjs/operators';
|
|
13
13
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
14
14
|
|
|
15
15
|
const THY_DROPDOWN_DEFAULT_WIDTH = '240px';
|
|
@@ -35,28 +35,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
35
35
|
* @order 20
|
|
36
36
|
*/
|
|
37
37
|
class ThyDropdownMenuComponent {
|
|
38
|
-
get template() {
|
|
39
|
-
return this.templateRef;
|
|
40
|
-
}
|
|
41
38
|
constructor() {
|
|
39
|
+
this.templateRef = viewChild.required('dropdownMenu');
|
|
42
40
|
/**
|
|
43
41
|
* 设置菜单宽度
|
|
44
|
-
* @default 240px
|
|
45
42
|
*/
|
|
46
|
-
this.thyWidth = THY_DROPDOWN_DEFAULT_WIDTH;
|
|
43
|
+
this.thyWidth = input(THY_DROPDOWN_DEFAULT_WIDTH, { transform: coerceCssPixelValue });
|
|
47
44
|
/**
|
|
48
45
|
* 是否直接渲染 dropdown-menu 中的元素
|
|
49
|
-
* @default false
|
|
50
46
|
*/
|
|
51
|
-
this.thyImmediateRender = false;
|
|
47
|
+
this.thyImmediateRender = input(false, { transform: coerceBooleanProperty });
|
|
52
48
|
}
|
|
53
49
|
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) {
|
|
50
|
+
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: `
|
|
51
|
+
@if (thyImmediateRender()) {
|
|
56
52
|
<ng-container *ngTemplateOutlet="content"></ng-container>
|
|
57
53
|
}
|
|
58
54
|
<ng-template #dropdownMenu>
|
|
59
|
-
<div class="thy-dropdown-menu" [style.width]="thyWidth">
|
|
55
|
+
<div class="thy-dropdown-menu" [style.width]="thyWidth()">
|
|
60
56
|
<ng-container *ngTemplateOutlet="content"></ng-container>
|
|
61
57
|
</div>
|
|
62
58
|
</ng-template>
|
|
@@ -65,20 +61,16 @@ class ThyDropdownMenuComponent {
|
|
|
65
61
|
</ng-template>
|
|
66
62
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
67
63
|
}
|
|
68
|
-
__decorate([
|
|
69
|
-
InputCssPixel(),
|
|
70
|
-
__metadata("design:type", Object)
|
|
71
|
-
], ThyDropdownMenuComponent.prototype, "thyWidth", void 0);
|
|
72
64
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyDropdownMenuComponent, decorators: [{
|
|
73
65
|
type: Component,
|
|
74
66
|
args: [{
|
|
75
67
|
selector: 'thy-dropdown-menu',
|
|
76
68
|
template: `
|
|
77
|
-
@if (thyImmediateRender) {
|
|
69
|
+
@if (thyImmediateRender()) {
|
|
78
70
|
<ng-container *ngTemplateOutlet="content"></ng-container>
|
|
79
71
|
}
|
|
80
72
|
<ng-template #dropdownMenu>
|
|
81
|
-
<div class="thy-dropdown-menu" [style.width]="thyWidth">
|
|
73
|
+
<div class="thy-dropdown-menu" [style.width]="thyWidth()">
|
|
82
74
|
<ng-container *ngTemplateOutlet="content"></ng-container>
|
|
83
75
|
</div>
|
|
84
76
|
</ng-template>
|
|
@@ -89,36 +81,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
89
81
|
encapsulation: ViewEncapsulation.None,
|
|
90
82
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
91
83
|
host: {
|
|
92
|
-
'[class.thy-dropdown-menu]': 'thyImmediateRender',
|
|
93
|
-
'[style.width]': "thyImmediateRender ? thyWidth : ''"
|
|
84
|
+
'[class.thy-dropdown-menu]': 'thyImmediateRender()',
|
|
85
|
+
'[style.width]': "thyImmediateRender() ? thyWidth() : ''"
|
|
94
86
|
},
|
|
95
87
|
imports: [NgTemplateOutlet]
|
|
96
88
|
}]
|
|
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
|
-
}] } });
|
|
89
|
+
}], ctorParameters: () => [] });
|
|
106
90
|
/**
|
|
107
91
|
* 下拉菜单分组
|
|
108
92
|
* @name thy-dropdown-menu-group
|
|
109
93
|
* @order 50
|
|
110
94
|
*/
|
|
111
95
|
class ThyDropdownMenuGroup {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
this.
|
|
96
|
+
constructor() {
|
|
97
|
+
/**
|
|
98
|
+
* 分组标题
|
|
99
|
+
*/
|
|
100
|
+
this.thyTitle = input();
|
|
117
101
|
}
|
|
118
|
-
constructor() { }
|
|
119
102
|
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">{{
|
|
103
|
+
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: `
|
|
104
|
+
<div class="dropdown-menu-group-title">{{ thyTitle() }}</div>
|
|
122
105
|
<ng-content></ng-content>
|
|
123
106
|
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
124
107
|
}
|
|
@@ -127,7 +110,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
127
110
|
args: [{
|
|
128
111
|
selector: 'thy-dropdown-menu-group',
|
|
129
112
|
template: `
|
|
130
|
-
<div class="dropdown-menu-group-title">{{
|
|
113
|
+
<div class="dropdown-menu-group-title">{{ thyTitle() }}</div>
|
|
131
114
|
<ng-content></ng-content>
|
|
132
115
|
`,
|
|
133
116
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
@@ -135,9 +118,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
135
118
|
class: 'dropdown-menu-group'
|
|
136
119
|
}
|
|
137
120
|
}]
|
|
138
|
-
}], ctorParameters: () => []
|
|
139
|
-
type: Input
|
|
140
|
-
}] } });
|
|
121
|
+
}], ctorParameters: () => [] });
|
|
141
122
|
/**
|
|
142
123
|
* 下拉菜单分割线
|
|
143
124
|
* @name thy-dropdown-menu-divider
|
|
@@ -165,50 +146,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
165
146
|
* @order 10
|
|
166
147
|
*/
|
|
167
148
|
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
149
|
constructor() {
|
|
213
150
|
const elementRef = inject(ElementRef);
|
|
214
151
|
const platform = inject(Platform);
|
|
@@ -218,46 +155,104 @@ class ThyDropdownDirective extends ThyOverlayDirectiveBase {
|
|
|
218
155
|
super(elementRef, platform, focusMonitor, ngZone, true, changeDetectorRef);
|
|
219
156
|
this.viewContainerRef = inject(ViewContainerRef);
|
|
220
157
|
this.popover = inject(ThyPopover);
|
|
221
|
-
this.
|
|
158
|
+
this.menu = computed(() => {
|
|
159
|
+
return (this.thyDropdownMenu() || this.thyDropdown());
|
|
160
|
+
});
|
|
222
161
|
this.popoverOpened = false;
|
|
162
|
+
/**
|
|
163
|
+
* Dropdown 下拉菜单,支持 thy-dropdown-menu 组件、TemplateRef 和自定义菜单组件
|
|
164
|
+
*/
|
|
165
|
+
this.thyDropdownMenu = input();
|
|
166
|
+
/**
|
|
167
|
+
* Dropdown 下拉菜单组件,和 thyDropdownMenu 参与相同,快捷传下拉菜单组件参数
|
|
168
|
+
*/
|
|
169
|
+
this.thyDropdown = input();
|
|
170
|
+
/**
|
|
171
|
+
* 下拉菜单触发方式
|
|
172
|
+
* @type 'hover' | 'focus' | 'click' | string
|
|
173
|
+
* @default click
|
|
174
|
+
*/
|
|
175
|
+
this.thyTrigger = input('click');
|
|
176
|
+
/**
|
|
177
|
+
* 打开延迟毫秒
|
|
178
|
+
*/
|
|
179
|
+
this.thyShowDelay = input(100, { transform: numberAttribute });
|
|
180
|
+
/**
|
|
181
|
+
* 关闭延迟毫秒
|
|
182
|
+
*/
|
|
183
|
+
this.thyHideDelay = input(100, { transform: numberAttribute });
|
|
223
184
|
/**
|
|
224
185
|
* 弹出菜单后的当前触发元素的激活样式类
|
|
225
186
|
*/
|
|
226
|
-
this.thyActiveClass = 'thy-dropdown-origin-active'
|
|
187
|
+
this.thyActiveClass = input('thy-dropdown-origin-active', {
|
|
188
|
+
transform: (value) => value || 'thy-dropdown-origin-active'
|
|
189
|
+
});
|
|
190
|
+
/**
|
|
191
|
+
* 弹出框的参数,底层使用 Popover 组件, 默认为`{ placement: "bottomLeft", insideClosable: true, minWidth: "240px", outsideClosable: true }`
|
|
192
|
+
*/
|
|
193
|
+
this.thyPopoverOptions = input();
|
|
194
|
+
/**
|
|
195
|
+
* 弹出框的显示位置,会覆盖 thyPopoverOptions 中的 placement,`top` | `topLeft` | `topRight` | `bottom` | `bottomLeft` | `bottomRight` | `left` | `leftTop` | `leftBottom` | `right` | `rightTop` | `rightBottom`
|
|
196
|
+
*/
|
|
197
|
+
this.thyPlacement = input('bottomLeft', { transform: (value) => value || 'bottomLeft' });
|
|
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
212
|
this.thyActiveChange = new EventEmitter();
|
|
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,30 +307,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
312
307
|
class: 'thy-dropdown'
|
|
313
308
|
}
|
|
314
309
|
}]
|
|
315
|
-
}], ctorParameters: () => [], propDecorators: {
|
|
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: [{
|
|
310
|
+
}], ctorParameters: () => [], propDecorators: { thyActiveChange: [{
|
|
339
311
|
type: Output
|
|
340
312
|
}] } });
|
|
341
313
|
|
|
@@ -347,29 +319,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
347
319
|
class ThyDropdownMenuItemDirective {
|
|
348
320
|
constructor() {
|
|
349
321
|
this.elementRef = inject(ElementRef);
|
|
350
|
-
this.
|
|
351
|
-
this.
|
|
352
|
-
|
|
353
|
-
|
|
322
|
+
this.danger = computed(() => this.thyType() === 'danger' || false);
|
|
323
|
+
this.success = computed(() => this.thyType() === 'success' || false);
|
|
324
|
+
/**
|
|
325
|
+
* 菜单项类型
|
|
326
|
+
* @type 'default' | 'danger' | 'success' | ''
|
|
327
|
+
*/
|
|
328
|
+
this.thyType = input('default');
|
|
329
|
+
/**
|
|
330
|
+
* 菜单项是否处于禁用状态
|
|
331
|
+
*/
|
|
332
|
+
this.thyDisabled = input(false, { transform: coerceBooleanProperty });
|
|
354
333
|
this.hostRenderer = useHostRenderer();
|
|
355
334
|
}
|
|
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
335
|
onClick(event) {
|
|
372
|
-
if (this.
|
|
336
|
+
if (this.thyDisabled()) {
|
|
373
337
|
event.stopPropagation();
|
|
374
338
|
event.preventDefault();
|
|
375
339
|
}
|
|
@@ -385,31 +349,20 @@ class ThyDropdownMenuItemDirective {
|
|
|
385
349
|
return fromEvent(this.elementRef.nativeElement, 'mouseenter').pipe(debounceTime(100), shareReplay());
|
|
386
350
|
}
|
|
387
351
|
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: "
|
|
352
|
+
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
353
|
}
|
|
390
354
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyDropdownMenuItemDirective, decorators: [{
|
|
391
355
|
type: Directive,
|
|
392
356
|
args: [{
|
|
393
|
-
selector: '[thyDropdownMenuItem]'
|
|
357
|
+
selector: '[thyDropdownMenuItem]',
|
|
358
|
+
host: {
|
|
359
|
+
class: 'dropdown-menu-item',
|
|
360
|
+
'[class.dropdown-menu-item--disabled]': `thyDisabled()`,
|
|
361
|
+
'[class.dropdown-menu-item--danger]': 'danger()',
|
|
362
|
+
'[class.dropdown-menu-item--success]': 'success()'
|
|
363
|
+
}
|
|
394
364
|
}]
|
|
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: [{
|
|
365
|
+
}], propDecorators: { onClick: [{
|
|
413
366
|
type: HostListener,
|
|
414
367
|
args: ['click', ['$event']]
|
|
415
368
|
}] } });
|
|
@@ -519,22 +472,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
519
472
|
* @order 70
|
|
520
473
|
*/
|
|
521
474
|
class ThyDropdownMenuItemActiveDirective {
|
|
522
|
-
constructor() {
|
|
475
|
+
constructor() {
|
|
476
|
+
/**
|
|
477
|
+
* 是否激活
|
|
478
|
+
* @type boolean | string
|
|
479
|
+
*/
|
|
480
|
+
this.thyDropdownMenuItemActive = input(false, { transform: coerceBooleanProperty });
|
|
481
|
+
}
|
|
523
482
|
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: "
|
|
483
|
+
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
484
|
}
|
|
526
485
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyDropdownMenuItemActiveDirective, decorators: [{
|
|
527
486
|
type: Directive,
|
|
528
487
|
args: [{
|
|
529
|
-
selector: '[thyDropdownMenuItemActive]'
|
|
488
|
+
selector: '[thyDropdownMenuItemActive]',
|
|
489
|
+
host: {
|
|
490
|
+
'[class.active]': `thyDropdownMenuItemActive()`
|
|
491
|
+
}
|
|
530
492
|
}]
|
|
531
|
-
}], ctorParameters: () => []
|
|
532
|
-
type: HostBinding,
|
|
533
|
-
args: ['class.active']
|
|
534
|
-
}, {
|
|
535
|
-
type: Input,
|
|
536
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
537
|
-
}] } });
|
|
493
|
+
}], ctorParameters: () => [] });
|
|
538
494
|
|
|
539
495
|
const SUBMENU_CLASS_PREFIX = 'dropdown-submenu';
|
|
540
496
|
/**
|
|
@@ -547,24 +503,24 @@ class ThyDropdownSubmenu {
|
|
|
547
503
|
this.dropdownMenuItem = inject(ThyDropdownMenuItemDirective);
|
|
548
504
|
this.elementRef = inject(ElementRef);
|
|
549
505
|
this.destroyRef = inject(DestroyRef);
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
506
|
+
/**
|
|
507
|
+
* 菜单方向
|
|
508
|
+
* @type left | right | auto
|
|
509
|
+
*/
|
|
510
|
+
this.thyDirection = input('right', {
|
|
511
|
+
transform: (value) => {
|
|
512
|
+
return value || 'right';
|
|
513
|
+
}
|
|
514
|
+
});
|
|
559
515
|
}
|
|
560
516
|
ngOnInit() {
|
|
561
|
-
let direction = this.
|
|
517
|
+
let direction = this.thyDirection();
|
|
562
518
|
this.updateClassByDirection(direction);
|
|
563
519
|
this.dropdownMenuItem
|
|
564
520
|
.bindMouseenterEvent()
|
|
565
521
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
566
522
|
.subscribe(() => {
|
|
567
|
-
if (this.
|
|
523
|
+
if (this.thyDirection() === 'auto') {
|
|
568
524
|
const element = this.dropdownMenuItem.getElement();
|
|
569
525
|
const offset = getElementOffset(element);
|
|
570
526
|
if (document.documentElement.clientWidth < offset.left + offset.width + offset.width) {
|
|
@@ -597,7 +553,7 @@ class ThyDropdownSubmenu {
|
|
|
597
553
|
}
|
|
598
554
|
}
|
|
599
555
|
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: "
|
|
556
|
+
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
557
|
}
|
|
602
558
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyDropdownSubmenu, decorators: [{
|
|
603
559
|
type: Component,
|
|
@@ -609,9 +565,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
609
565
|
},
|
|
610
566
|
changeDetection: ChangeDetectionStrategy.OnPush
|
|
611
567
|
}]
|
|
612
|
-
}]
|
|
613
|
-
type: Input
|
|
614
|
-
}] } });
|
|
568
|
+
}] });
|
|
615
569
|
|
|
616
570
|
/**
|
|
617
571
|
* 跟踪 Dropdown 菜单是否被打开处于激活状态,允许指定一个或多个CSS类,以便在菜单打开状态时添加到元素中
|
|
@@ -620,16 +574,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
620
574
|
*/
|
|
621
575
|
class ThyDropdownActiveDirective {
|
|
622
576
|
constructor() {
|
|
623
|
-
this.elementRef = inject(ElementRef);
|
|
624
577
|
this.trigger = inject(ThyDropdownDirective, { optional: true });
|
|
578
|
+
this.classes = computed(() => {
|
|
579
|
+
return coerceArray(this.thyDropdownActive()).filter(c => !!c);
|
|
580
|
+
});
|
|
625
581
|
this.hostRenderer = useHostRenderer();
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
set thyDropdownActive(data) {
|
|
632
|
-
this.classes = coerceArray(data).filter(c => !!c);
|
|
582
|
+
/**
|
|
583
|
+
* 设置 Active 样式类,可以是一个或多个CSS类
|
|
584
|
+
* @type string[] | string
|
|
585
|
+
*/
|
|
586
|
+
this.thyDropdownActive = input();
|
|
633
587
|
}
|
|
634
588
|
ngOnInit() { }
|
|
635
589
|
ngAfterContentInit() {
|
|
@@ -648,7 +602,7 @@ class ThyDropdownActiveDirective {
|
|
|
648
602
|
});
|
|
649
603
|
}
|
|
650
604
|
update(active) {
|
|
651
|
-
this.classes.forEach(className => {
|
|
605
|
+
this.classes().forEach(className => {
|
|
652
606
|
if (active) {
|
|
653
607
|
this.hostRenderer.addClass(className);
|
|
654
608
|
}
|
|
@@ -658,16 +612,14 @@ class ThyDropdownActiveDirective {
|
|
|
658
612
|
});
|
|
659
613
|
}
|
|
660
614
|
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: "
|
|
615
|
+
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
616
|
}
|
|
663
617
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyDropdownActiveDirective, decorators: [{
|
|
664
618
|
type: Directive,
|
|
665
619
|
args: [{
|
|
666
620
|
selector: '[thyDropdownActive]'
|
|
667
621
|
}]
|
|
668
|
-
}], propDecorators: {
|
|
669
|
-
type: Input
|
|
670
|
-
}], triggers: [{
|
|
622
|
+
}], propDecorators: { triggers: [{
|
|
671
623
|
type: ContentChildren,
|
|
672
624
|
args: [ThyDropdownDirective, { descendants: true }]
|
|
673
625
|
}] } });
|