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
|
@@ -11,13 +11,12 @@ export declare class ThyYearPicker extends BasePicker {
|
|
|
11
11
|
protected elementRef: ElementRef;
|
|
12
12
|
/**
|
|
13
13
|
* 展示的年份格式
|
|
14
|
-
* @type string
|
|
15
14
|
*/
|
|
16
|
-
thyFormat: string
|
|
15
|
+
readonly thyFormat: import("@angular/core").ModelSignal<string>;
|
|
17
16
|
isRange: boolean;
|
|
18
17
|
endPanelMode: ThyPanelMode;
|
|
19
18
|
private hostRenderer;
|
|
20
19
|
constructor();
|
|
21
20
|
static ɵfac: i0.ɵɵFactoryDeclaration<ThyYearPicker, never>;
|
|
22
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<ThyYearPicker, "thy-year-picker", ["thyYearPicker"], { "thyFormat": { "alias": "thyFormat"; "required": false; }; }, {}, never, never, true, never>;
|
|
21
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ThyYearPicker, "thy-year-picker", ["thyYearPicker"], { "thyFormat": { "alias": "thyFormat"; "required": false; "isSignal": true; }; }, { "thyFormat": "thyFormatChange"; }, never, never, true, never>;
|
|
23
22
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AfterContentInit, OnInit, QueryList, Signal } from '@angular/core';
|
|
2
2
|
import { ThyDropdownDirective } from './dropdown.directive';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
/**
|
|
@@ -7,15 +7,14 @@ import * as i0 from "@angular/core";
|
|
|
7
7
|
* @order 60
|
|
8
8
|
*/
|
|
9
9
|
export declare class ThyDropdownActiveDirective implements OnInit, AfterContentInit {
|
|
10
|
-
private elementRef;
|
|
11
10
|
private trigger;
|
|
12
|
-
classes: string[]
|
|
11
|
+
readonly classes: Signal<string[]>;
|
|
13
12
|
private hostRenderer;
|
|
14
13
|
/**
|
|
15
14
|
* 设置 Active 样式类,可以是一个或多个CSS类
|
|
16
15
|
* @type string[] | string
|
|
17
16
|
*/
|
|
18
|
-
|
|
17
|
+
readonly thyDropdownActive: import("@angular/core").InputSignal<string | string[]>;
|
|
19
18
|
/**
|
|
20
19
|
* @private
|
|
21
20
|
*/
|
|
@@ -24,5 +23,5 @@ export declare class ThyDropdownActiveDirective implements OnInit, AfterContentI
|
|
|
24
23
|
ngAfterContentInit(): void;
|
|
25
24
|
update(active: boolean): void;
|
|
26
25
|
static ɵfac: i0.ɵɵFactoryDeclaration<ThyDropdownActiveDirective, never>;
|
|
27
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<ThyDropdownActiveDirective, "[thyDropdownActive]", never, { "thyDropdownActive": { "alias": "thyDropdownActive"; "required": false; }; }, {}, ["triggers"], never, true, never>;
|
|
26
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ThyDropdownActiveDirective, "[thyDropdownActive]", never, { "thyDropdownActive": { "alias": "thyDropdownActive"; "required": false; "isSignal": true; }; }, {}, ["triggers"], never, true, never>;
|
|
28
27
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { OnInit } from '@angular/core';
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
|
-
import * as i1 from "ngx-tethys/util";
|
|
4
3
|
export type ThyDropdownMenuItemType = 'default' | 'danger' | 'success' | '';
|
|
5
4
|
/**
|
|
6
5
|
* 菜单项
|
|
@@ -9,21 +8,17 @@ export type ThyDropdownMenuItemType = 'default' | 'danger' | 'success' | '';
|
|
|
9
8
|
*/
|
|
10
9
|
export declare class ThyDropdownMenuItemDirective implements OnInit {
|
|
11
10
|
private elementRef;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
danger: boolean;
|
|
15
|
-
success: boolean;
|
|
11
|
+
readonly danger: import("@angular/core").Signal<boolean>;
|
|
12
|
+
readonly success: import("@angular/core").Signal<boolean>;
|
|
16
13
|
/**
|
|
17
14
|
* 菜单项类型
|
|
18
15
|
* @type 'default' | 'danger' | 'success' | ''
|
|
19
|
-
* @default default
|
|
20
16
|
*/
|
|
21
|
-
|
|
17
|
+
readonly thyType: import("@angular/core").InputSignal<ThyDropdownMenuItemType>;
|
|
22
18
|
/**
|
|
23
19
|
* 菜单项是否处于禁用状态
|
|
24
|
-
* @default false
|
|
25
20
|
*/
|
|
26
|
-
|
|
21
|
+
readonly thyDisabled: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
27
22
|
onClick(event: Event): void;
|
|
28
23
|
private hostRenderer;
|
|
29
24
|
ngOnInit(): void;
|
|
@@ -31,8 +26,7 @@ export declare class ThyDropdownMenuItemDirective implements OnInit {
|
|
|
31
26
|
getElement(): HTMLElement;
|
|
32
27
|
bindMouseenterEvent(): import("rxjs").Observable<Event>;
|
|
33
28
|
static ɵfac: i0.ɵɵFactoryDeclaration<ThyDropdownMenuItemDirective, never>;
|
|
34
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<ThyDropdownMenuItemDirective, "[thyDropdownMenuItem]", never, { "thyType": { "alias": "thyType"; "required": false; }; "thyDisabled": { "alias": "thyDisabled"; "required": false; }; }, {}, never, never, true, never>;
|
|
35
|
-
static ngAcceptInputType_thyDisabled: i1.ThyBooleanInput;
|
|
29
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ThyDropdownMenuItemDirective, "[thyDropdownMenuItem]", never, { "thyType": { "alias": "thyType"; "required": false; "isSignal": true; }; "thyDisabled": { "alias": "thyDisabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
36
30
|
}
|
|
37
31
|
/**
|
|
38
32
|
* 设置为菜单项图标
|
|
@@ -93,11 +87,9 @@ export declare class ThyDropdownMenuItemActiveDirective {
|
|
|
93
87
|
/**
|
|
94
88
|
* 是否激活
|
|
95
89
|
* @type boolean | string
|
|
96
|
-
* @default false
|
|
97
90
|
*/
|
|
98
|
-
thyDropdownMenuItemActive: boolean
|
|
91
|
+
readonly thyDropdownMenuItemActive: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
99
92
|
constructor();
|
|
100
93
|
static ɵfac: i0.ɵɵFactoryDeclaration<ThyDropdownMenuItemActiveDirective, never>;
|
|
101
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<ThyDropdownMenuItemActiveDirective, "[thyDropdownMenuItemActive]", never, { "thyDropdownMenuItemActive": { "alias": "thyDropdownMenuItemActive"; "required": false; }; }, {}, never, never, true, never>;
|
|
102
|
-
static ngAcceptInputType_thyDropdownMenuItemActive: i1.ThyBooleanInput;
|
|
94
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ThyDropdownMenuItemActiveDirective, "[thyDropdownMenuItemActive]", never, { "thyDropdownMenuItemActive": { "alias": "thyDropdownMenuItemActive"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
103
95
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { TemplateRef } from '@angular/core';
|
|
2
|
-
import { SafeAny } from 'ngx-tethys/types';
|
|
3
2
|
import * as i0 from "@angular/core";
|
|
4
|
-
import * as i1 from "ngx-tethys/util";
|
|
5
3
|
export type ThyDropdownMenuDividerType = 'default' | 'crossing' | '';
|
|
6
4
|
export declare const THY_DROPDOWN_DEFAULT_WIDTH = "240px";
|
|
7
5
|
/**
|
|
@@ -18,22 +16,18 @@ export declare class ThyDropdownAbstractMenu {
|
|
|
18
16
|
* @order 20
|
|
19
17
|
*/
|
|
20
18
|
export declare class ThyDropdownMenuComponent {
|
|
21
|
-
|
|
22
|
-
templateRef: TemplateRef<SafeAny>;
|
|
19
|
+
readonly templateRef: import("@angular/core").Signal<TemplateRef<any>>;
|
|
23
20
|
/**
|
|
24
21
|
* 设置菜单宽度
|
|
25
|
-
* @default 240px
|
|
26
22
|
*/
|
|
27
|
-
thyWidth:
|
|
23
|
+
readonly thyWidth: import("@angular/core").InputSignalWithTransform<string, string | number>;
|
|
28
24
|
/**
|
|
29
25
|
* 是否直接渲染 dropdown-menu 中的元素
|
|
30
|
-
* @default false
|
|
31
26
|
*/
|
|
32
|
-
thyImmediateRender: boolean
|
|
27
|
+
readonly thyImmediateRender: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
33
28
|
constructor();
|
|
34
29
|
static ɵfac: i0.ɵɵFactoryDeclaration<ThyDropdownMenuComponent, never>;
|
|
35
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<ThyDropdownMenuComponent, "thy-dropdown-menu", never, { "thyWidth": { "alias": "thyWidth"; "required": false; }; "thyImmediateRender": { "alias": "thyImmediateRender"; "required": false; }; }, {}, never, ["*"], true, never>;
|
|
36
|
-
static ngAcceptInputType_thyImmediateRender: i1.ThyBooleanInput;
|
|
30
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ThyDropdownMenuComponent, "thy-dropdown-menu", never, { "thyWidth": { "alias": "thyWidth"; "required": false; "isSignal": true; }; "thyImmediateRender": { "alias": "thyImmediateRender"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
37
31
|
}
|
|
38
32
|
/**
|
|
39
33
|
* 下拉菜单分组
|
|
@@ -41,14 +35,13 @@ export declare class ThyDropdownMenuComponent {
|
|
|
41
35
|
* @order 50
|
|
42
36
|
*/
|
|
43
37
|
export declare class ThyDropdownMenuGroup {
|
|
44
|
-
title: string;
|
|
45
38
|
/**
|
|
46
39
|
* 分组标题
|
|
47
40
|
*/
|
|
48
|
-
|
|
41
|
+
readonly thyTitle: import("@angular/core").InputSignal<string>;
|
|
49
42
|
constructor();
|
|
50
43
|
static ɵfac: i0.ɵɵFactoryDeclaration<ThyDropdownMenuGroup, never>;
|
|
51
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<ThyDropdownMenuGroup, "thy-dropdown-menu-group", never, { "thyTitle": { "alias": "thyTitle"; "required": false; }; }, {}, never, ["*"], true, never>;
|
|
44
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ThyDropdownMenuGroup, "thy-dropdown-menu-group", never, { "thyTitle": { "alias": "thyTitle"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
52
45
|
}
|
|
53
46
|
/**
|
|
54
47
|
* 下拉菜单分割线
|
|
@@ -10,16 +10,14 @@ export declare class ThyDropdownSubmenu implements OnInit {
|
|
|
10
10
|
private dropdownMenuItem;
|
|
11
11
|
private elementRef;
|
|
12
12
|
private readonly destroyRef;
|
|
13
|
-
private direction;
|
|
14
13
|
/**
|
|
15
14
|
* 菜单方向
|
|
16
15
|
* @type left | right | auto
|
|
17
|
-
* @default right
|
|
18
16
|
*/
|
|
19
|
-
|
|
17
|
+
readonly thyDirection: import("@angular/core").InputSignalWithTransform<ThyDropdownSubmenuDirection, ThyDropdownSubmenuDirection>;
|
|
20
18
|
ngOnInit(): void;
|
|
21
19
|
private updateClassByDirection;
|
|
22
20
|
private updateVerticalDirection;
|
|
23
21
|
static ɵfac: i0.ɵɵFactoryDeclaration<ThyDropdownSubmenu, never>;
|
|
24
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<ThyDropdownSubmenu, "[thyDropdownSubmenu],thy-dropdown-submenu", never, { "thyDirection": { "alias": "thyDirection"; "required": false; }; }, {}, never, ["*"], true, never>;
|
|
22
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ThyDropdownSubmenu, "[thyDropdownSubmenu],thy-dropdown-submenu", never, { "thyDirection": { "alias": "thyDirection"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
25
23
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { ComponentType, OverlayRef } from '@angular/cdk/overlay';
|
|
2
|
-
import {
|
|
3
|
-
import { ThyOverlayDirectiveBase,
|
|
2
|
+
import { OnInit, Signal, TemplateRef } from '@angular/core';
|
|
3
|
+
import { ThyOverlayDirectiveBase, ThyPlacement } from 'ngx-tethys/core';
|
|
4
4
|
import { ThyPopoverConfig } from 'ngx-tethys/popover';
|
|
5
5
|
import { SafeAny } from 'ngx-tethys/types';
|
|
6
6
|
import { ThyDropdownMenuComponent } from './dropdown-menu.component';
|
|
7
7
|
import * as i0 from "@angular/core";
|
|
8
|
-
import * as i1 from "ngx-tethys/util";
|
|
9
8
|
export type ThyDropdownTrigger = 'click' | 'hover';
|
|
10
9
|
type ThyDropdownMenu = ThyDropdownMenuComponent | TemplateRef<SafeAny> | ComponentType<SafeAny>;
|
|
11
10
|
/**
|
|
@@ -16,72 +15,63 @@ type ThyDropdownMenu = ThyDropdownMenuComponent | TemplateRef<SafeAny> | Compone
|
|
|
16
15
|
export declare class ThyDropdownDirective extends ThyOverlayDirectiveBase implements OnInit {
|
|
17
16
|
private viewContainerRef;
|
|
18
17
|
private popover;
|
|
19
|
-
menu: ThyDropdownMenu
|
|
18
|
+
readonly menu: Signal<ThyDropdownMenu>;
|
|
20
19
|
private popoverRef;
|
|
21
|
-
private innerPanelClassList;
|
|
22
20
|
popoverOpened: boolean;
|
|
23
21
|
/**
|
|
24
22
|
* Dropdown 下拉菜单,支持 thy-dropdown-menu 组件、TemplateRef 和自定义菜单组件
|
|
25
23
|
*/
|
|
26
|
-
|
|
24
|
+
readonly thyDropdownMenu: import("@angular/core").InputSignal<ThyDropdownMenu>;
|
|
27
25
|
/**
|
|
28
26
|
* Dropdown 下拉菜单组件,和 thyDropdownMenu 参与相同,快捷传下拉菜单组件参数
|
|
29
27
|
*/
|
|
30
|
-
|
|
28
|
+
readonly thyDropdown: import("@angular/core").InputSignal<ThyDropdownMenu>;
|
|
31
29
|
/**
|
|
32
30
|
* 下拉菜单触发方式
|
|
33
31
|
* @type 'hover' | 'focus' | 'click' | string
|
|
34
32
|
* @default click
|
|
35
33
|
*/
|
|
36
|
-
|
|
34
|
+
readonly thyTrigger: import("@angular/core").InputSignal<string>;
|
|
37
35
|
/**
|
|
38
36
|
* 打开延迟毫秒
|
|
39
|
-
* @default 100
|
|
40
37
|
*/
|
|
41
|
-
|
|
38
|
+
readonly thyShowDelay: import("@angular/core").InputSignalWithTransform<number, unknown>;
|
|
42
39
|
/**
|
|
43
40
|
* 关闭延迟毫秒
|
|
44
|
-
* @default 100
|
|
45
41
|
*/
|
|
46
|
-
|
|
42
|
+
readonly thyHideDelay: import("@angular/core").InputSignalWithTransform<number, unknown>;
|
|
47
43
|
/**
|
|
48
44
|
* 弹出菜单后的当前触发元素的激活样式类
|
|
49
45
|
*/
|
|
50
|
-
thyActiveClass: string
|
|
46
|
+
readonly thyActiveClass: import("@angular/core").InputSignalWithTransform<string, string>;
|
|
51
47
|
/**
|
|
52
48
|
* 弹出框的参数,底层使用 Popover 组件, 默认为`{ placement: "bottomLeft", insideClosable: true, minWidth: "240px", outsideClosable: true }`
|
|
53
|
-
* @default { placement: "bottomLeft", insideClosable: true, minWidth: "240px", outsideClosable: true }
|
|
54
49
|
*/
|
|
55
|
-
thyPopoverOptions: Pick<ThyPopoverConfig
|
|
50
|
+
readonly thyPopoverOptions: import("@angular/core").InputSignal<Pick<ThyPopoverConfig<unknown>, "height" | "minWidth" | "placement" | "insideClosable" | "outsideClosable">>;
|
|
56
51
|
/**
|
|
57
52
|
* 弹出框的显示位置,会覆盖 thyPopoverOptions 中的 placement,`top` | `topLeft` | `topRight` | `bottom` | `bottomLeft` | `bottomRight` | `left` | `leftTop` | `leftBottom` | `right` | `rightTop` | `rightBottom`
|
|
58
53
|
* @default bottomLeft
|
|
59
54
|
*/
|
|
60
|
-
thyPlacement: ThyPlacement
|
|
55
|
+
readonly thyPlacement: import("@angular/core").InputSignal<ThyPlacement>;
|
|
61
56
|
/**
|
|
62
57
|
* 点击 dropdown-menu 内部是否关闭弹出框,会覆盖 thyPopoverOptions 中的 insideClosable
|
|
63
|
-
* @default true
|
|
64
58
|
*/
|
|
65
|
-
thyMenuInsideClosable: boolean
|
|
59
|
+
readonly thyMenuInsideClosable: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
66
60
|
/**
|
|
67
61
|
* 弹出框 overlay panel 的类名
|
|
68
62
|
* @type string | string[]
|
|
69
63
|
*/
|
|
70
|
-
|
|
71
|
-
get thyPanelClass(): string | string[];
|
|
64
|
+
readonly thyPanelClass: import("@angular/core").InputSignalWithTransform<string | string[], string | string[]>;
|
|
72
65
|
/**
|
|
73
66
|
* 菜单 Active 事件,打开菜单返回 true,关闭返回 false
|
|
74
67
|
*/
|
|
75
|
-
thyActiveChange:
|
|
68
|
+
readonly thyActiveChange: import("@angular/core").OutputEmitterRef<boolean>;
|
|
76
69
|
constructor();
|
|
77
70
|
ngOnInit(): void;
|
|
78
71
|
createOverlay(): OverlayRef;
|
|
79
72
|
show(delay?: number): void;
|
|
80
73
|
hide(delay?: number): void;
|
|
81
74
|
static ɵfac: i0.ɵɵFactoryDeclaration<ThyDropdownDirective, never>;
|
|
82
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<ThyDropdownDirective, "[thyDropdown]", never, { "thyDropdownMenu": { "alias": "thyDropdownMenu"; "required": false; }; "thyDropdown": { "alias": "thyDropdown"; "required": false; }; "thyTrigger": { "alias": "thyTrigger"; "required": false; }; "thyShowDelay": { "alias": "thyShowDelay"; "required": false; }; "thyHideDelay": { "alias": "thyHideDelay"; "required": false; }; "thyActiveClass": { "alias": "thyActiveClass"; "required": false; }; "thyPopoverOptions": { "alias": "thyPopoverOptions"; "required": false; }; "thyPlacement": { "alias": "thyPlacement"; "required": false; }; "thyMenuInsideClosable": { "alias": "thyMenuInsideClosable"; "required": false; }; "thyPanelClass": { "alias": "thyPanelClass"; "required": false; }; }, { "thyActiveChange": "thyActiveChange"; }, never, never, true, never>;
|
|
83
|
-
static ngAcceptInputType_thyShowDelay: unknown;
|
|
84
|
-
static ngAcceptInputType_thyHideDelay: unknown;
|
|
85
|
-
static ngAcceptInputType_thyMenuInsideClosable: i1.ThyBooleanInput;
|
|
75
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ThyDropdownDirective, "[thyDropdown]", never, { "thyDropdownMenu": { "alias": "thyDropdownMenu"; "required": false; "isSignal": true; }; "thyDropdown": { "alias": "thyDropdown"; "required": false; "isSignal": true; }; "thyTrigger": { "alias": "thyTrigger"; "required": false; "isSignal": true; }; "thyShowDelay": { "alias": "thyShowDelay"; "required": false; "isSignal": true; }; "thyHideDelay": { "alias": "thyHideDelay"; "required": false; "isSignal": true; }; "thyActiveClass": { "alias": "thyActiveClass"; "required": false; "isSignal": true; }; "thyPopoverOptions": { "alias": "thyPopoverOptions"; "required": false; "isSignal": true; }; "thyPlacement": { "alias": "thyPlacement"; "required": false; "isSignal": true; }; "thyMenuInsideClosable": { "alias": "thyMenuInsideClosable"; "required": false; "isSignal": true; }; "thyPanelClass": { "alias": "thyPanelClass"; "required": false; "isSignal": true; }; }, { "thyActiveChange": "thyActiveChange"; }, never, never, true, never>;
|
|
86
76
|
}
|
|
87
77
|
export {};
|
|
@@ -81,7 +81,8 @@ export declare class ThyEmpty implements AfterViewInit {
|
|
|
81
81
|
*/
|
|
82
82
|
readonly extraTemplateRef: Signal<TemplateRef<any>>;
|
|
83
83
|
protected readonly presetSvg: Signal<import("@angular/platform-browser").SafeHtml>;
|
|
84
|
-
protected readonly displayText:
|
|
84
|
+
protected readonly displayText: import("@angular/core").WritableSignal<any>;
|
|
85
|
+
setMessage(text: string): void;
|
|
85
86
|
constructor();
|
|
86
87
|
private _calculatePosition;
|
|
87
88
|
updateClass(): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, ElementRef, Renderer2, ChangeDetectorRef, computed, input, ChangeDetectionStrategy, Component, contentChildren,
|
|
2
|
+
import { inject, ElementRef, Renderer2, ChangeDetectorRef, computed, input, effect, ChangeDetectionStrategy, Component, contentChildren, NgModule } from '@angular/core';
|
|
3
3
|
import { useHostRenderer } from '@tethys/cdk/dom';
|
|
4
4
|
import { ThyIcon, ThyIconModule } from 'ngx-tethys/icon';
|
|
5
5
|
import { coerceBooleanProperty } from 'ngx-tethys/util';
|
|
@@ -24,6 +24,12 @@ const defaultFeedbackOptions = {
|
|
|
24
24
|
* @name thy-action,[thyAction]
|
|
25
25
|
*/
|
|
26
26
|
class ThyAction {
|
|
27
|
+
ngOnInit() {
|
|
28
|
+
this.updateClasses();
|
|
29
|
+
}
|
|
30
|
+
ngAfterViewInit() {
|
|
31
|
+
this.wrapSpanForText(this.elementRef.nativeElement.childNodes);
|
|
32
|
+
}
|
|
27
33
|
constructor() {
|
|
28
34
|
this.elementRef = inject(ElementRef);
|
|
29
35
|
this.renderer = inject(Renderer2);
|
|
@@ -31,13 +37,14 @@ class ThyAction {
|
|
|
31
37
|
this.icon = computed(() => this.thyActionIcon() || this.thyIcon());
|
|
32
38
|
this.feedback = null;
|
|
33
39
|
this.active = computed(() => this.thyActionActive() || this.thyActive());
|
|
34
|
-
this.type = computed(() => this.thyType() || 'primary');
|
|
35
40
|
this.hostRenderer = useHostRenderer();
|
|
36
41
|
/**
|
|
37
42
|
* 操作图标的类型
|
|
38
43
|
* @type primary | success | danger | warning
|
|
39
44
|
*/
|
|
40
|
-
this.thyType = input('primary'
|
|
45
|
+
this.thyType = input('primary', {
|
|
46
|
+
transform: (value) => value || 'primary'
|
|
47
|
+
});
|
|
41
48
|
/**
|
|
42
49
|
* 操作图标,支持传参同时也支持在投影中写 thy-icon 组件
|
|
43
50
|
*/
|
|
@@ -67,17 +74,9 @@ class ThyAction {
|
|
|
67
74
|
* 是否处于禁用状态
|
|
68
75
|
*/
|
|
69
76
|
this.thyDisabled = input(false, { transform: coerceBooleanProperty });
|
|
70
|
-
|
|
71
|
-
ngOnInit() {
|
|
72
|
-
this.updateClasses();
|
|
73
|
-
}
|
|
74
|
-
ngAfterViewInit() {
|
|
75
|
-
this.wrapSpanForText(this.elementRef.nativeElement.childNodes);
|
|
76
|
-
}
|
|
77
|
-
ngOnChanges(changes) {
|
|
78
|
-
if ((changes.thyType && !changes.thyType.firstChange) || (changes.thyTheme && !changes.thyTheme.firstChange)) {
|
|
77
|
+
effect(() => {
|
|
79
78
|
this.updateClasses();
|
|
80
|
-
}
|
|
79
|
+
});
|
|
81
80
|
}
|
|
82
81
|
setMarginRight(marginRight) {
|
|
83
82
|
this.elementRef.nativeElement.style.marginRight = marginRight;
|
|
@@ -126,7 +125,7 @@ class ThyAction {
|
|
|
126
125
|
}
|
|
127
126
|
updateClasses() {
|
|
128
127
|
let classNames = [];
|
|
129
|
-
classNames.push(`action-${this.
|
|
128
|
+
classNames.push(`action-${this.thyType()}`);
|
|
130
129
|
if (this.thyTheme() === 'lite') {
|
|
131
130
|
classNames.push('thy-action-lite');
|
|
132
131
|
}
|
|
@@ -136,7 +135,7 @@ class ThyAction {
|
|
|
136
135
|
this.feedbackTimer?.unsubscribe();
|
|
137
136
|
}
|
|
138
137
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyAction, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
139
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyAction, isStandalone: true, selector: "thy-action, [thyAction]", inputs: { thyType: { classPropertyName: "thyType", publicName: "thyType", isSignal: true, isRequired: false, transformFunction: null }, thyIcon: { classPropertyName: "thyIcon", publicName: "thyIcon", isSignal: true, isRequired: false, transformFunction: null }, thyActionIcon: { classPropertyName: "thyActionIcon", publicName: "thyActionIcon", isSignal: true, isRequired: false, transformFunction: null }, thyActive: { classPropertyName: "thyActive", publicName: "thyActive", isSignal: true, isRequired: false, transformFunction: null }, thyActionActive: { classPropertyName: "thyActionActive", publicName: "thyActionActive", isSignal: true, isRequired: false, transformFunction: null }, thyTheme: { classPropertyName: "thyTheme", publicName: "thyTheme", isSignal: true, isRequired: false, transformFunction: null }, thyHoverIcon: { classPropertyName: "thyHoverIcon", publicName: "thyHoverIcon", isSignal: true, isRequired: false, transformFunction: null }, thyDisabled: { classPropertyName: "thyDisabled", publicName: "thyDisabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.active": "active()", "class.thy-action-hover-icon": "thyHoverIcon()", "class.thy-action-has-feedback": "!!feedback", "class.disabled": "thyDisabled()" }, classAttribute: "thy-action" },
|
|
138
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyAction, isStandalone: true, selector: "thy-action, [thyAction]", inputs: { thyType: { classPropertyName: "thyType", publicName: "thyType", isSignal: true, isRequired: false, transformFunction: null }, thyIcon: { classPropertyName: "thyIcon", publicName: "thyIcon", isSignal: true, isRequired: false, transformFunction: null }, thyActionIcon: { classPropertyName: "thyActionIcon", publicName: "thyActionIcon", isSignal: true, isRequired: false, transformFunction: null }, thyActive: { classPropertyName: "thyActive", publicName: "thyActive", isSignal: true, isRequired: false, transformFunction: null }, thyActionActive: { classPropertyName: "thyActionActive", publicName: "thyActionActive", isSignal: true, isRequired: false, transformFunction: null }, thyTheme: { classPropertyName: "thyTheme", publicName: "thyTheme", isSignal: true, isRequired: false, transformFunction: null }, thyHoverIcon: { classPropertyName: "thyHoverIcon", publicName: "thyHoverIcon", isSignal: true, isRequired: false, transformFunction: null }, thyDisabled: { classPropertyName: "thyDisabled", publicName: "thyDisabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.active": "active()", "class.thy-action-hover-icon": "thyHoverIcon()", "class.thy-action-has-feedback": "!!feedback", "class.disabled": "thyDisabled()" }, classAttribute: "thy-action" }, ngImport: i0, template: "@if (icon() && !feedback) {\n <thy-icon [thyIconName]=\"icon()\"></thy-icon>\n}\n@if (feedbackOptions?.icon) {\n <thy-icon [class]=\"feedbackOptions.class\" [thyIconName]=\"feedbackOptions.icon\"></thy-icon>\n}\n@if (thyHoverIcon()) {\n <thy-icon class=\"hover-icon\" [thyIconName]=\"thyHoverIcon()\"></thy-icon>\n}\n<ng-content></ng-content>\n", dependencies: [{ kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
140
139
|
}
|
|
141
140
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyAction, decorators: [{
|
|
142
141
|
type: Component,
|
|
@@ -147,7 +146,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
147
146
|
'[class.thy-action-has-feedback]': '!!feedback',
|
|
148
147
|
'[class.disabled]': 'thyDisabled()'
|
|
149
148
|
}, imports: [ThyIcon], template: "@if (icon() && !feedback) {\n <thy-icon [thyIconName]=\"icon()\"></thy-icon>\n}\n@if (feedbackOptions?.icon) {\n <thy-icon [class]=\"feedbackOptions.class\" [thyIconName]=\"feedbackOptions.icon\"></thy-icon>\n}\n@if (thyHoverIcon()) {\n <thy-icon class=\"hover-icon\" [thyIconName]=\"thyHoverIcon()\"></thy-icon>\n}\n<ng-content></ng-content>\n" }]
|
|
150
|
-
}] });
|
|
149
|
+
}], ctorParameters: () => [] });
|
|
151
150
|
|
|
152
151
|
/**
|
|
153
152
|
* Actions 组件
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngx-tethys-action.mjs","sources":["../../../src/action/action.component.ts","../../../src/action/action.component.html","../../../src/action/actions.component.ts","../../../src/action/action.module.ts","../../../src/action/ngx-tethys-action.ts"],"sourcesContent":["import {\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n OnChanges,\n OnDestroy,\n OnInit,\n Renderer2,\n Signal,\n SimpleChanges,\n computed,\n inject,\n input\n} from '@angular/core';\nimport { useHostRenderer } from '@tethys/cdk/dom';\nimport { ThyIcon } from 'ngx-tethys/icon';\n\nimport { coerceBooleanProperty } from 'ngx-tethys/util';\nimport { Subscription, timer } from 'rxjs';\n\nexport type ThyActionType = 'primary' | 'success' | 'danger' | 'warning';\n\nexport type ThyActionFeedback = 'success' | 'error';\n\nexport interface ThyActionFeedbackOptions {\n icon?: string;\n class?: string;\n duration?: number;\n}\n\nconst defaultFeedbackOptions: Record<ThyActionFeedback, ThyActionFeedbackOptions> = {\n success: {\n icon: 'check-circle-fill',\n class: 'text-success',\n duration: 3000\n },\n error: {\n icon: 'close-circle-fill',\n class: 'text-danger',\n duration: 3000\n }\n};\n/**\n * 立即操作组件\n * @name thy-action,[thyAction]\n */\n@Component({\n selector: 'thy-action, [thyAction]',\n templateUrl: './action.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'thy-action',\n '[class.active]': 'active()',\n '[class.thy-action-hover-icon]': 'thyHoverIcon()',\n '[class.thy-action-has-feedback]': '!!feedback',\n '[class.disabled]': 'thyDisabled()'\n },\n imports: [ThyIcon]\n})\nexport class ThyAction implements OnInit, AfterViewInit, OnChanges, OnDestroy {\n private elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n private renderer = inject(Renderer2);\n private cdr = inject(ChangeDetectorRef);\n\n public icon: Signal<string> = computed(() => this.thyActionIcon() || this.thyIcon());\n\n feedback: ThyActionFeedback = null;\n\n feedbackOptions: ThyActionFeedbackOptions;\n\n active: Signal<boolean> = computed(() => this.thyActionActive() || this.thyActive());\n\n private type: Signal<string> = computed(() => this.thyType() || 'primary');\n\n private hostRenderer = useHostRenderer();\n\n private feedbackTimer: Subscription;\n\n /**\n * 操作图标的类型\n * @type primary | success | danger | warning\n */\n readonly thyType = input<ThyActionType>('primary');\n\n /**\n * 操作图标,支持传参同时也支持在投影中写 thy-icon 组件\n */\n readonly thyIcon = input<string>('');\n\n /**\n * 操作图标,当 thyIcon 和其他指令参数名有冲突时使用 thyActionIcon\n */\n readonly thyActionIcon = input<string>('');\n\n /**\n * 操作的图标 Active 状态,设置为 true 时会在 Item 上添加 active class\n */\n readonly thyActive = input(false, { transform: coerceBooleanProperty });\n\n /**\n * 操作的图标 Active 状态,当 thyActive 和其他指令参数名有冲突时使用 thyActionActive\n */\n readonly thyActionActive = input(false, { transform: coerceBooleanProperty });\n\n /**\n * 操作图标的主题\n * @type fill(背景色填充) | lite(简单文本颜色变化)\n */\n readonly thyTheme = input<'fill' | 'lite'>('fill');\n\n /**\n * Hover 展示的图标\n */\n readonly thyHoverIcon = input<string>();\n\n /**\n * 是否处于禁用状态\n */\n readonly thyDisabled = input<boolean, boolean | string | number>(false, { transform: coerceBooleanProperty });\n\n ngOnInit(): void {\n this.updateClasses();\n }\n\n ngAfterViewInit() {\n this.wrapSpanForText(this.elementRef.nativeElement.childNodes);\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if ((changes.thyType && !changes.thyType.firstChange) || (changes.thyTheme && !changes.thyTheme.firstChange)) {\n this.updateClasses();\n }\n }\n\n setMarginRight(marginRight: string) {\n this.elementRef.nativeElement.style.marginRight = marginRight;\n }\n\n /**\n * 触发成功反馈操作\n */\n success(options?: ThyActionFeedbackOptions) {\n this.setFeedback('success', options);\n }\n\n /**\n * 触发失败反馈操作\n */\n error(options?: ThyActionFeedbackOptions) {\n this.setFeedback('error', options);\n }\n\n private setFeedback(feedback: ThyActionFeedback, options: ThyActionFeedbackOptions) {\n if (this.thyDisabled()) {\n return;\n }\n options = Object.assign({}, defaultFeedbackOptions[feedback], options);\n this.feedback = feedback;\n this.feedbackOptions = options;\n this.cdr.markForCheck();\n if (options.duration) {\n if (this.feedbackTimer) {\n this.feedbackTimer.unsubscribe();\n }\n this.feedbackTimer = timer(options.duration).subscribe(() => {\n this.feedback = null;\n this.feedbackOptions = null;\n this.cdr.markForCheck();\n });\n }\n }\n\n private wrapSpanForText(nodes: NodeList): void {\n nodes.forEach(node => {\n if (node.nodeName === '#text') {\n const span = this.renderer.createElement('span');\n const parent = this.renderer.parentNode(node);\n // this.renderer.addClass(span, 'thy-action-wrap-span');\n this.renderer.insertBefore(parent, span, node);\n this.renderer.appendChild(span, node);\n }\n });\n }\n\n private updateClasses() {\n let classNames: string[] = [];\n classNames.push(`action-${this.type()}`);\n if (this.thyTheme() === 'lite') {\n classNames.push('thy-action-lite');\n }\n this.hostRenderer.updateClass(classNames);\n }\n\n ngOnDestroy(): void {\n this.feedbackTimer?.unsubscribe();\n }\n}\n","@if (icon() && !feedback) {\n <thy-icon [thyIconName]=\"icon()\"></thy-icon>\n}\n@if (feedbackOptions?.icon) {\n <thy-icon [class]=\"feedbackOptions.class\" [thyIconName]=\"feedbackOptions.icon\"></thy-icon>\n}\n@if (thyHoverIcon()) {\n <thy-icon class=\"hover-icon\" [thyIconName]=\"thyHoverIcon()\"></thy-icon>\n}\n<ng-content></ng-content>\n","import { ChangeDetectionStrategy, Component, OnInit, contentChildren, effect, input } from '@angular/core';\nimport { ThySpacingSize, getNumericSize } from 'ngx-tethys/core';\nimport { ThyAction } from './action.component';\n\n/**\n * Actions 组件\n * @name thy-actions\n */\n@Component({\n selector: 'thy-actions',\n template: ` <ng-content></ng-content> `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'thy-actions'\n }\n})\nexport class ThyActions implements OnInit {\n readonly actions = contentChildren<ThyAction>(ThyAction);\n\n /**\n * 大小,支持 `zero` | `xxs` | `xs` | `sm` | `md` | `lg` | `xlg` 和自定义数字大小\n * @type string | number\n */\n readonly thySize = input<ThySpacingSize>('md');\n\n constructor() {\n effect(() => {\n this.setActionsSize();\n });\n }\n\n ngOnInit(): void {}\n\n private setActionsSize() {\n const actions: ThyAction[] = Array.from(this.actions());\n actions.forEach((action: ThyAction, index) => {\n // can't set marginRight value for last item\n if (index !== actions.length - 1) {\n action.setMarginRight(getNumericSize(this.thySize(), 'md') + 'px');\n }\n });\n }\n}\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\n\nimport { ThyIconModule } from 'ngx-tethys/icon';\nimport { ThyAction } from './action.component';\nimport { ThyActions } from './actions.component';\n\n@NgModule({\n imports: [CommonModule, ThyIconModule, ThyAction, ThyActions],\n exports: [ThyAction, ThyActions]\n})\nexport class ThyActionModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAgCA,MAAM,sBAAsB,GAAwD;AAChF,IAAA,OAAO,EAAE;AACL,QAAA,IAAI,EAAE,mBAAmB;AACzB,QAAA,KAAK,EAAE,cAAc;AACrB,QAAA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;2FAM9B,UAAU,EAAA,UAAA,EAAA,CAAA;kBARtB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,aAAa;AACvB,oBAAA,QAAQ,EAAE,CAA6B,2BAAA,CAAA;oBACvC,eAAe,EAAE,uBAAuB,CAAC,MAAM;AAC/C,oBAAA,IAAI,EAAE;AACF,wBAAA,KAAK,EAAE;AACV;AACJ,iBAAA;;;MCJY,eAAe,CAAA;8GAAf,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;+GAAf,eAAe,EAAA,OAAA,EAAA,CAHd,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,CAAA,EAAA,OAAA,EAAA,CAClD,SAAS,EAAE,UAAU,CAAA,EAAA,CAAA,CAAA;AAEtB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,eAAe,EAHd,OAAA,EAAA,CAAA,YAAY,EAAE,aAAa,EAAE,SAAS,CAAA,EAAA,CAAA,CAAA;;2FAGvC,eAAe,EAAA,UAAA,EAAA,CAAA;kBAJ3B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACN,OAAO,EAAE,CAAC,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,CAAC;AAC7D,oBAAA,OAAO,EAAE,CAAC,SAAS,EAAE,UAAU;AAClC,iBAAA;;;ACVD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ngx-tethys-action.mjs","sources":["../../../src/action/action.component.ts","../../../src/action/action.component.html","../../../src/action/actions.component.ts","../../../src/action/action.module.ts","../../../src/action/ngx-tethys-action.ts"],"sourcesContent":["import {\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ElementRef,\n OnDestroy,\n OnInit,\n Renderer2,\n Signal,\n computed,\n effect,\n inject,\n input\n} from '@angular/core';\nimport { useHostRenderer } from '@tethys/cdk/dom';\nimport { ThyIcon } from 'ngx-tethys/icon';\n\nimport { coerceBooleanProperty } from 'ngx-tethys/util';\nimport { Subscription, timer } from 'rxjs';\n\nexport type ThyActionType = 'primary' | 'success' | 'danger' | 'warning';\n\nexport type ThyActionFeedback = 'success' | 'error';\n\nexport interface ThyActionFeedbackOptions {\n icon?: string;\n class?: string;\n duration?: number;\n}\n\nconst defaultFeedbackOptions: Record<ThyActionFeedback, ThyActionFeedbackOptions> = {\n success: {\n icon: 'check-circle-fill',\n class: 'text-success',\n duration: 3000\n },\n error: {\n icon: 'close-circle-fill',\n class: 'text-danger',\n duration: 3000\n }\n};\n/**\n * 立即操作组件\n * @name thy-action,[thyAction]\n */\n@Component({\n selector: 'thy-action, [thyAction]',\n templateUrl: './action.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'thy-action',\n '[class.active]': 'active()',\n '[class.thy-action-hover-icon]': 'thyHoverIcon()',\n '[class.thy-action-has-feedback]': '!!feedback',\n '[class.disabled]': 'thyDisabled()'\n },\n imports: [ThyIcon]\n})\nexport class ThyAction implements OnInit, AfterViewInit, OnDestroy {\n private elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n private renderer = inject(Renderer2);\n private cdr = inject(ChangeDetectorRef);\n\n public readonly icon: Signal<string> = computed(() => this.thyActionIcon() || this.thyIcon());\n\n feedback: ThyActionFeedback = null;\n\n feedbackOptions: ThyActionFeedbackOptions;\n\n readonly active: Signal<boolean> = computed(() => this.thyActionActive() || this.thyActive());\n\n private hostRenderer = useHostRenderer();\n\n private feedbackTimer: Subscription;\n\n /**\n * 操作图标的类型\n * @type primary | success | danger | warning\n */\n readonly thyType = input<ThyActionType, ThyActionType>('primary', {\n transform: (value: ThyActionType) => value || 'primary'\n });\n\n /**\n * 操作图标,支持传参同时也支持在投影中写 thy-icon 组件\n */\n readonly thyIcon = input<string>('');\n\n /**\n * 操作图标,当 thyIcon 和其他指令参数名有冲突时使用 thyActionIcon\n */\n readonly thyActionIcon = input<string>('');\n\n /**\n * 操作的图标 Active 状态,设置为 true 时会在 Item 上添加 active class\n */\n readonly thyActive = input(false, { transform: coerceBooleanProperty });\n\n /**\n * 操作的图标 Active 状态,当 thyActive 和其他指令参数名有冲突时使用 thyActionActive\n */\n readonly thyActionActive = input(false, { transform: coerceBooleanProperty });\n\n /**\n * 操作图标的主题\n * @type fill(背景色填充) | lite(简单文本颜色变化)\n */\n readonly thyTheme = input<'fill' | 'lite'>('fill');\n\n /**\n * Hover 展示的图标\n */\n readonly thyHoverIcon = input<string>();\n\n /**\n * 是否处于禁用状态\n */\n readonly thyDisabled = input(false, { transform: coerceBooleanProperty });\n\n ngOnInit(): void {\n this.updateClasses();\n }\n\n ngAfterViewInit() {\n this.wrapSpanForText(this.elementRef.nativeElement.childNodes);\n }\n\n constructor() {\n effect(() => {\n this.updateClasses();\n });\n }\n\n setMarginRight(marginRight: string) {\n this.elementRef.nativeElement.style.marginRight = marginRight;\n }\n\n /**\n * 触发成功反馈操作\n */\n success(options?: ThyActionFeedbackOptions) {\n this.setFeedback('success', options);\n }\n\n /**\n * 触发失败反馈操作\n */\n error(options?: ThyActionFeedbackOptions) {\n this.setFeedback('error', options);\n }\n\n private setFeedback(feedback: ThyActionFeedback, options: ThyActionFeedbackOptions) {\n if (this.thyDisabled()) {\n return;\n }\n options = Object.assign({}, defaultFeedbackOptions[feedback], options);\n this.feedback = feedback;\n this.feedbackOptions = options;\n this.cdr.markForCheck();\n if (options.duration) {\n if (this.feedbackTimer) {\n this.feedbackTimer.unsubscribe();\n }\n this.feedbackTimer = timer(options.duration).subscribe(() => {\n this.feedback = null;\n this.feedbackOptions = null;\n this.cdr.markForCheck();\n });\n }\n }\n\n private wrapSpanForText(nodes: NodeList): void {\n nodes.forEach(node => {\n if (node.nodeName === '#text') {\n const span = this.renderer.createElement('span');\n const parent = this.renderer.parentNode(node);\n // this.renderer.addClass(span, 'thy-action-wrap-span');\n this.renderer.insertBefore(parent, span, node);\n this.renderer.appendChild(span, node);\n }\n });\n }\n\n private updateClasses() {\n let classNames: string[] = [];\n classNames.push(`action-${this.thyType()}`);\n if (this.thyTheme() === 'lite') {\n classNames.push('thy-action-lite');\n }\n this.hostRenderer.updateClass(classNames);\n }\n\n ngOnDestroy(): void {\n this.feedbackTimer?.unsubscribe();\n }\n}\n","@if (icon() && !feedback) {\n <thy-icon [thyIconName]=\"icon()\"></thy-icon>\n}\n@if (feedbackOptions?.icon) {\n <thy-icon [class]=\"feedbackOptions.class\" [thyIconName]=\"feedbackOptions.icon\"></thy-icon>\n}\n@if (thyHoverIcon()) {\n <thy-icon class=\"hover-icon\" [thyIconName]=\"thyHoverIcon()\"></thy-icon>\n}\n<ng-content></ng-content>\n","import { ChangeDetectionStrategy, Component, OnInit, contentChildren, effect, input } from '@angular/core';\nimport { ThySpacingSize, getNumericSize } from 'ngx-tethys/core';\nimport { ThyAction } from './action.component';\n\n/**\n * Actions 组件\n * @name thy-actions\n */\n@Component({\n selector: 'thy-actions',\n template: ` <ng-content></ng-content> `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'thy-actions'\n }\n})\nexport class ThyActions implements OnInit {\n readonly actions = contentChildren<ThyAction>(ThyAction);\n\n /**\n * 大小,支持 `zero` | `xxs` | `xs` | `sm` | `md` | `lg` | `xlg` 和自定义数字大小\n * @type string | number\n */\n readonly thySize = input<ThySpacingSize>('md');\n\n constructor() {\n effect(() => {\n this.setActionsSize();\n });\n }\n\n ngOnInit(): void {}\n\n private setActionsSize() {\n const actions: ThyAction[] = Array.from(this.actions());\n actions.forEach((action: ThyAction, index) => {\n // can't set marginRight value for last item\n if (index !== actions.length - 1) {\n action.setMarginRight(getNumericSize(this.thySize(), 'md') + 'px');\n }\n });\n }\n}\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\n\nimport { ThyIconModule } from 'ngx-tethys/icon';\nimport { ThyAction } from './action.component';\nimport { ThyActions } from './actions.component';\n\n@NgModule({\n imports: [CommonModule, ThyIconModule, ThyAction, ThyActions],\n exports: [ThyAction, ThyActions]\n})\nexport class ThyActionModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AA+BA,MAAM,sBAAsB,GAAwD;AAChF,IAAA,OAAO,EAAE;AACL,QAAA,IAAI,EAAE,mBAAmB;AACzB,QAAA,KAAK,EAAE,cAAc;AACrB,QAAA,QAAQ,EAAE;AACb,KAAA;AACD,IAAA,KAAK,EAAE;AACH,QAAA,IAAI,EAAE,mBAAmB;AACzB,QAAA,KAAK,EAAE,aAAa;AACpB,QAAA,QAAQ,EAAE;AACb;CACJ;AACD;;;AAGG;MAcU,SAAS,CAAA;IA6DlB,QAAQ,GAAA;QACJ,IAAI,CAAC,aAAa,EAAE;;IAGxB,eAAe,GAAA;QACX,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,UAAU,CAAC;;AAGlE,IAAA,WAAA,GAAA;AApEQ,QAAA,IAAA,CAAA,UAAU,GAAG,MAAM,CAA0B,UAAU,CAAC;AACxD,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,SAAS,CAAC;AAC5B,QAAA,IAAA,CAAA,GAAG,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAEvB,QAAA,IAAA,CAAA,IAAI,GAAmB,QAAQ,CAAC,MAAM,IAAI,CAAC,aAAa,EAAE,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QAE7F,IAAQ,CAAA,QAAA,GAAsB,IAAI;AAIzB,QAAA,IAAA,CAAA,MAAM,GAAoB,QAAQ,CAAC,MAAM,IAAI,CAAC,eAAe,EAAE,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;QAErF,IAAY,CAAA,YAAA,GAAG,eAAe,EAAE;AAI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formModule } from '@angular/cdk/platform';
|
|
2
2
|
import { DOCUMENT, CommonModule } from '@angular/common';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { inject, NgZone, Renderer2, viewChild, input, numberAttribute, output, ElementRef, ViewEncapsulation, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
|
|
4
|
+
import { inject, NgZone, Renderer2, viewChild, input, numberAttribute, output, computed, ElementRef, effect, ViewEncapsulation, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
|
|
5
5
|
import { ThyScrollService } from 'ngx-tethys/core';
|
|
6
6
|
import { dom, shallowEqual } from 'ngx-tethys/util';
|
|
7
7
|
import { Subscription, ReplaySubject, Subject, merge, fromEvent } from 'rxjs';
|
|
@@ -26,10 +26,6 @@ const THY_AFFIX_DEFAULT_SCROLL_TIME = 20;
|
|
|
26
26
|
* @order 10
|
|
27
27
|
*/
|
|
28
28
|
class ThyAffix {
|
|
29
|
-
get container() {
|
|
30
|
-
const el = this.thyContainer();
|
|
31
|
-
return (typeof el === 'string' ? this.document.querySelector(el) : el) || window;
|
|
32
|
-
}
|
|
33
29
|
constructor() {
|
|
34
30
|
this.scrollService = inject(ThyScrollService);
|
|
35
31
|
this.ngZone = inject(NgZone);
|
|
@@ -57,20 +53,20 @@ class ThyAffix {
|
|
|
57
53
|
this.positionChangeSubscription = Subscription.EMPTY;
|
|
58
54
|
this.offsetChanged$ = new ReplaySubject(1);
|
|
59
55
|
this.destroy$ = new Subject();
|
|
56
|
+
this.container = computed(() => {
|
|
57
|
+
const el = this.thyContainer();
|
|
58
|
+
return (typeof el === 'string' ? this.document.querySelector(el) : el) || window;
|
|
59
|
+
});
|
|
60
60
|
const el = inject(ElementRef);
|
|
61
61
|
const document = inject(DOCUMENT);
|
|
62
62
|
// The wrapper would stay at the original position as a placeholder.
|
|
63
63
|
this.placeholderNode = el.nativeElement;
|
|
64
64
|
this.document = document;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
if (thyContainer) {
|
|
72
|
-
this.registerListeners();
|
|
73
|
-
}
|
|
65
|
+
effect(() => {
|
|
66
|
+
if (this.thyOffsetBottom() || this.thyOffsetTop()) {
|
|
67
|
+
this.offsetChanged$.next(undefined);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
74
70
|
}
|
|
75
71
|
ngAfterViewInit() {
|
|
76
72
|
this.registerListeners();
|
|
@@ -81,7 +77,7 @@ class ThyAffix {
|
|
|
81
77
|
registerListeners() {
|
|
82
78
|
this.removeListeners();
|
|
83
79
|
this.positionChangeSubscription = this.ngZone.runOutsideAngular(() => {
|
|
84
|
-
return merge(...Object.keys(AffixRespondEvents).map(evName => fromEvent(this.container, evName)), this.offsetChanged$.pipe(takeUntil(this.destroy$), map(() => ({}))))
|
|
80
|
+
return merge(...Object.keys(AffixRespondEvents).map(evName => fromEvent(this.container(), evName)), this.offsetChanged$.pipe(takeUntil(this.destroy$), map(() => ({}))))
|
|
85
81
|
.pipe(auditTime(THY_AFFIX_DEFAULT_SCROLL_TIME))
|
|
86
82
|
.subscribe(e => this.updatePosition(e));
|
|
87
83
|
});
|
|
@@ -110,7 +106,7 @@ class ThyAffix {
|
|
|
110
106
|
}
|
|
111
107
|
setAffixStyle(e, affixStyle) {
|
|
112
108
|
const originalAffixStyle = this.affixStyle;
|
|
113
|
-
const isWindow = this.container === window;
|
|
109
|
+
const isWindow = this.container() === window;
|
|
114
110
|
if (e.type === 'scroll' && originalAffixStyle && affixStyle && isWindow) {
|
|
115
111
|
return;
|
|
116
112
|
}
|
|
@@ -159,7 +155,7 @@ class ThyAffix {
|
|
|
159
155
|
if (!this.platform.isBrowser) {
|
|
160
156
|
return;
|
|
161
157
|
}
|
|
162
|
-
const containerNode = this.container;
|
|
158
|
+
const containerNode = this.container();
|
|
163
159
|
let offsetTop = this.thyOffsetTop();
|
|
164
160
|
const scrollTop = this.scrollService.getScroll(containerNode, true);
|
|
165
161
|
const elementOffset = this.getOffset(this.placeholderNode, containerNode);
|
|
@@ -233,7 +229,7 @@ class ThyAffix {
|
|
|
233
229
|
}
|
|
234
230
|
}
|
|
235
231
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyAffix, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
236
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.8", type: ThyAffix, isStandalone: true, selector: "thy-affix", inputs: { thyContainer: { classPropertyName: "thyContainer", publicName: "thyContainer", isSignal: true, isRequired: false, transformFunction: null }, thyOffsetTop: { classPropertyName: "thyOffsetTop", publicName: "thyOffsetTop", isSignal: true, isRequired: false, transformFunction: null }, thyOffsetBottom: { classPropertyName: "thyOffsetBottom", publicName: "thyOffsetBottom", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { thyChange: "thyChange" }, viewQueries: [{ propertyName: "fixedElement", first: true, predicate: ["fixedElement"], descendants: true, isSignal: true }], exportAs: ["thyAffix"],
|
|
232
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.8", type: ThyAffix, isStandalone: true, selector: "thy-affix", inputs: { thyContainer: { classPropertyName: "thyContainer", publicName: "thyContainer", isSignal: true, isRequired: false, transformFunction: null }, thyOffsetTop: { classPropertyName: "thyOffsetTop", publicName: "thyOffsetTop", isSignal: true, isRequired: false, transformFunction: null }, thyOffsetBottom: { classPropertyName: "thyOffsetBottom", publicName: "thyOffsetBottom", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { thyChange: "thyChange" }, viewQueries: [{ propertyName: "fixedElement", first: true, predicate: ["fixedElement"], descendants: true, isSignal: true }], exportAs: ["thyAffix"], ngImport: i0, template: `
|
|
237
233
|
<div #fixedElement>
|
|
238
234
|
<ng-content></ng-content>
|
|
239
235
|
</div>
|