ngx-tethys 19.0.11 → 19.0.12

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 CHANGED
@@ -2,6 +2,21 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
4
4
 
5
+ ## [19.0.12](https://github.com/atinc/ngx-tethys/compare/19.0.11...19.0.12) (2025-05-14)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **shared:** update input value handling and search emission logic #TINFR-2053 ([#3408](https://github.com/atinc/ngx-tethys/issues/3408)) ([5c7850b](https://github.com/atinc/ngx-tethys/commit/5c7850b105e53cebace4c1dd3d41c51696053199)), closes [#TINFR-2053](https://github.com/atinc/ngx-tethys/issues/TINFR-2053)
11
+
12
+
13
+ ### Features
14
+
15
+ * **action:** migrate to signal for action [@wumeimin](https://github.com/wumeimin) ([#3414](https://github.com/atinc/ngx-tethys/issues/3414)) ([d787b04](https://github.com/atinc/ngx-tethys/commit/d787b04cfe18048f14c9e710d6b5ada905c0bc80))
16
+ * **affix:** migrate to signal for affix [@wumeimin](https://github.com/wumeimin) ([#3413](https://github.com/atinc/ngx-tethys/issues/3413)) ([d7ea93f](https://github.com/atinc/ngx-tethys/commit/d7ea93f60ba1dc1908c10b0a981e91c31f87e05c))
17
+
18
+
19
+
5
20
  ## [19.0.11](https://github.com/atinc/ngx-tethys/compare/19.0.10...19.0.11) (2025-05-08)
6
21
 
7
22
 
@@ -1,4 +1,4 @@
1
- import { OnInit, AfterViewInit, OnChanges, SimpleChanges, OnDestroy } from '@angular/core';
1
+ import { AfterViewInit, OnChanges, OnDestroy, OnInit, Signal, SimpleChanges } from '@angular/core';
2
2
  import * as i0 from "@angular/core";
3
3
  export type ThyActionType = 'primary' | 'success' | 'danger' | 'warning';
4
4
  export type ThyActionFeedback = 'success' | 'error';
@@ -15,51 +15,47 @@ export declare class ThyAction implements OnInit, AfterViewInit, OnChanges, OnDe
15
15
  private elementRef;
16
16
  private renderer;
17
17
  private cdr;
18
- icon: string;
18
+ icon: Signal<string>;
19
19
  feedback: ThyActionFeedback;
20
20
  feedbackOptions: ThyActionFeedbackOptions;
21
- active: boolean;
21
+ active: Signal<boolean>;
22
22
  private type;
23
23
  private hostRenderer;
24
24
  private feedbackTimer;
25
25
  /**
26
26
  * 操作图标的类型
27
27
  * @type primary | success | danger | warning
28
- * @default primary
29
28
  */
30
- set thyType(value: ThyActionType);
29
+ readonly thyType: import("@angular/core").InputSignal<ThyActionType>;
31
30
  /**
32
31
  * 操作图标,支持传参同时也支持在投影中写 thy-icon 组件
33
32
  */
34
- set thyIcon(icon: string);
33
+ readonly thyIcon: import("@angular/core").InputSignal<string>;
35
34
  /**
36
35
  * 操作图标,当 thyIcon 和其他指令参数名有冲突时使用 thyActionIcon
37
36
  */
38
- set thyActionIcon(icon: string);
37
+ readonly thyActionIcon: import("@angular/core").InputSignal<string>;
39
38
  /**
40
39
  * 操作的图标 Active 状态,设置为 true 时会在 Item 上添加 active class
41
- * @default false
42
40
  */
43
- set thyActive(value: boolean);
41
+ readonly thyActive: import("@angular/core").InputSignalWithTransform<boolean, string | number | boolean>;
44
42
  /**
45
43
  * 操作的图标 Active 状态,当 thyActive 和其他指令参数名有冲突时使用 thyActionActive
46
- * @default false
47
44
  */
48
- set thyActionActive(value: boolean);
45
+ readonly thyActionActive: import("@angular/core").InputSignalWithTransform<boolean, string | number | boolean>;
49
46
  /**
50
47
  * 操作图标的主题
51
48
  * @type fill(背景色填充) | lite(简单文本颜色变化)
52
49
  */
53
- thyTheme: 'fill' | 'lite';
50
+ readonly thyTheme: import("@angular/core").InputSignal<"fill" | "lite">;
54
51
  /**
55
52
  * Hover 展示的图标
56
53
  */
57
- thyHoverIcon: string;
54
+ readonly thyHoverIcon: import("@angular/core").InputSignal<string>;
58
55
  /**
59
56
  * 是否处于禁用状态
60
- * @default false
61
57
  */
62
- thyDisabled: boolean;
58
+ readonly thyDisabled: import("@angular/core").InputSignalWithTransform<boolean, string | number | boolean>;
63
59
  ngOnInit(): void;
64
60
  ngAfterViewInit(): void;
65
61
  ngOnChanges(changes: SimpleChanges): void;
@@ -74,12 +70,8 @@ export declare class ThyAction implements OnInit, AfterViewInit, OnChanges, OnDe
74
70
  error(options?: ThyActionFeedbackOptions): void;
75
71
  private setFeedback;
76
72
  private wrapSpanForText;
77
- private setActionType;
78
73
  private updateClasses;
79
74
  ngOnDestroy(): void;
80
75
  static ɵfac: i0.ɵɵFactoryDeclaration<ThyAction, never>;
81
- static ɵcmp: i0.ɵɵComponentDeclaration<ThyAction, "thy-action, [thyAction]", never, { "thyType": { "alias": "thyType"; "required": false; }; "thyIcon": { "alias": "thyIcon"; "required": false; }; "thyActionIcon": { "alias": "thyActionIcon"; "required": false; }; "thyActive": { "alias": "thyActive"; "required": false; }; "thyActionActive": { "alias": "thyActionActive"; "required": false; }; "thyTheme": { "alias": "thyTheme"; "required": false; }; "thyHoverIcon": { "alias": "thyHoverIcon"; "required": false; }; "thyDisabled": { "alias": "thyDisabled"; "required": false; }; }, {}, never, ["*"], true, never>;
82
- static ngAcceptInputType_thyActive: boolean | string | number;
83
- static ngAcceptInputType_thyActionActive: boolean | string | number;
84
- static ngAcceptInputType_thyDisabled: boolean | string | number;
76
+ static ɵcmp: i0.ɵɵComponentDeclaration<ThyAction, "thy-action, [thyAction]", never, { "thyType": { "alias": "thyType"; "required": false; "isSignal": true; }; "thyIcon": { "alias": "thyIcon"; "required": false; "isSignal": true; }; "thyActionIcon": { "alias": "thyActionIcon"; "required": false; "isSignal": true; }; "thyActive": { "alias": "thyActive"; "required": false; "isSignal": true; }; "thyActionActive": { "alias": "thyActionActive"; "required": false; "isSignal": true; }; "thyTheme": { "alias": "thyTheme"; "required": false; "isSignal": true; }; "thyHoverIcon": { "alias": "thyHoverIcon"; "required": false; "isSignal": true; }; "thyDisabled": { "alias": "thyDisabled"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
85
77
  }
@@ -1,4 +1,4 @@
1
- import { OnInit, OnChanges, QueryList, AfterContentInit, SimpleChanges } from '@angular/core';
1
+ import { OnInit } from '@angular/core';
2
2
  import { ThySpacingSize } from 'ngx-tethys/core';
3
3
  import { ThyAction } from './action.component';
4
4
  import * as i0 from "@angular/core";
@@ -6,18 +6,16 @@ import * as i0 from "@angular/core";
6
6
  * Actions 组件
7
7
  * @name thy-actions
8
8
  */
9
- export declare class ThyActions implements OnInit, AfterContentInit, OnChanges {
10
- actions: QueryList<ThyAction>;
9
+ export declare class ThyActions implements OnInit {
10
+ readonly actions: import("@angular/core").Signal<readonly ThyAction[]>;
11
11
  /**
12
12
  * 大小,支持 `zero` | `xxs` | `xs` | `sm` | `md` | `lg` | `xlg` 和自定义数字大小
13
13
  * @type string | number
14
14
  */
15
- thySize: ThySpacingSize;
15
+ readonly thySize: import("@angular/core").InputSignal<ThySpacingSize>;
16
16
  constructor();
17
17
  ngOnInit(): void;
18
- ngOnChanges(changes: SimpleChanges): void;
19
- ngAfterContentInit(): void;
20
18
  private setActionsSize;
21
19
  static ɵfac: i0.ɵɵFactoryDeclaration<ThyActions, never>;
22
- static ɵcmp: i0.ɵɵComponentDeclaration<ThyActions, "thy-actions", never, { "thySize": { "alias": "thySize"; "required": false; }; }, {}, ["actions"], ["*"], true, never>;
20
+ static ɵcmp: i0.ɵɵComponentDeclaration<ThyActions, "thy-actions", never, { "thySize": { "alias": "thySize"; "required": false; "isSignal": true; }; }, {}, ["actions"], ["*"], true, never>;
23
21
  }
@@ -1,5 +1,5 @@
1
1
  import { SimpleRect } from 'ngx-tethys/util';
2
- import { AfterViewInit, EventEmitter, OnChanges, OnDestroy, SimpleChanges } from '@angular/core';
2
+ import { AfterViewInit, OnChanges, OnDestroy, SimpleChanges } from '@angular/core';
3
3
  import * as i0 from "@angular/core";
4
4
  /**
5
5
  * 固钉组件
@@ -11,26 +11,25 @@ export declare class ThyAffix implements AfterViewInit, OnChanges, OnDestroy {
11
11
  private ngZone;
12
12
  private platform;
13
13
  private renderer;
14
- private fixedElement;
14
+ private readonly fixedElement;
15
15
  /**
16
16
  * 设置 thy-affix 需要监听其滚动事件的元素,值为一个返回对应 DOM 元素的函数
17
17
  * @default window
18
18
  * @type string | Element | Window
19
19
  */
20
- thyContainer?: string | Element | Window;
20
+ readonly thyContainer: import("@angular/core").InputSignal<string | Element | Window>;
21
21
  /**
22
22
  * 距离窗口顶部缓冲的偏移量阈值
23
- * @default 0
24
23
  */
25
- thyOffsetTop?: null | number;
24
+ readonly thyOffsetTop: import("@angular/core").InputSignalWithTransform<number, unknown>;
26
25
  /**
27
26
  * 距离窗口底部缓冲的偏移量阈值
28
27
  */
29
- thyOffsetBottom?: null | number;
28
+ readonly thyOffsetBottom: import("@angular/core").InputSignalWithTransform<number, unknown>;
30
29
  /**
31
30
  * 固定状态改变时触发的回调函数
32
31
  */
33
- readonly thyChange: EventEmitter<boolean>;
32
+ readonly thyChange: import("@angular/core").OutputEmitterRef<boolean>;
34
33
  private readonly placeholderNode;
35
34
  private affixStyle?;
36
35
  private placeholderStyle?;
@@ -52,7 +51,5 @@ export declare class ThyAffix implements AfterViewInit, OnChanges, OnDestroy {
52
51
  private syncPlaceholderStyle;
53
52
  updatePosition(e: Event): void;
54
53
  static ɵfac: i0.ɵɵFactoryDeclaration<ThyAffix, never>;
55
- static ɵcmp: i0.ɵɵComponentDeclaration<ThyAffix, "thy-affix", ["thyAffix"], { "thyContainer": { "alias": "thyContainer"; "required": false; }; "thyOffsetTop": { "alias": "thyOffsetTop"; "required": false; }; "thyOffsetBottom": { "alias": "thyOffsetBottom"; "required": false; }; }, { "thyChange": "thyChange"; }, never, ["*"], true, never>;
56
- static ngAcceptInputType_thyOffsetTop: unknown;
57
- static ngAcceptInputType_thyOffsetBottom: unknown;
54
+ static ɵcmp: i0.ɵɵComponentDeclaration<ThyAffix, "thy-affix", ["thyAffix"], { "thyContainer": { "alias": "thyContainer"; "required": false; "isSignal": true; }; "thyOffsetTop": { "alias": "thyOffsetTop"; "required": false; "isSignal": true; }; "thyOffsetBottom": { "alias": "thyOffsetBottom"; "required": false; "isSignal": true; }; }, { "thyChange": "thyChange"; }, never, ["*"], true, never>;
58
55
  }
@@ -1,5 +1,4 @@
1
- import { AfterContentInit, OnChanges, OnDestroy, QueryList, SimpleChanges, TemplateRef } from '@angular/core';
2
- import { SafeAny } from 'ngx-tethys/types';
1
+ import { Signal, TemplateRef } from '@angular/core';
3
2
  import { ThyAvatar } from '../avatar.component';
4
3
  import * as i0 from "@angular/core";
5
4
  export declare const THY_AVATAR_ITEM_SPACE = 4;
@@ -13,35 +12,30 @@ export declare const enum ThyAvatarListMode {
13
12
  * @name thy-avatar-list
14
13
  * @order 20
15
14
  */
16
- export declare class ThyAvatarList implements OnChanges, OnDestroy, AfterContentInit {
17
- overlapMode: boolean;
15
+ export declare class ThyAvatarList {
18
16
  avatarItems: ThyAvatar[];
19
- private ngUnsubscribe$;
20
17
  /**
21
18
  * 展示方式
22
19
  * @type overlap | default
23
- * @default default
24
20
  */
25
- thyMode: ThyAvatarListMode;
21
+ readonly thyMode: import("@angular/core").InputSignal<ThyAvatarListMode>;
22
+ isOverlapMode: Signal<boolean>;
26
23
  /**
27
24
  * 头像大小
28
25
  * @type 16 | 22 | 24 | 28 | 32 | 36 | 44 | 48 | 68 | 110 | 160 | xxs(22px) | xs(24px) | sm(32px) | md(36px) | lg(48px)
29
26
  * @default 36
30
27
  */
31
- thyAvatarSize: number | string;
28
+ readonly thyAvatarSize: import("@angular/core").InputSignal<string | number>;
32
29
  /**
33
30
  * append 自定义操作
34
31
  */
35
- append: TemplateRef<SafeAny>;
32
+ readonly append: Signal<TemplateRef<any>>;
36
33
  /**
37
34
  * @private
38
35
  */
39
- avatarComponents: QueryList<ThyAvatar>;
36
+ readonly avatarComponents: Signal<readonly ThyAvatar[]>;
40
37
  constructor();
41
- ngOnChanges(changes: SimpleChanges): void;
42
- ngAfterContentInit(): void;
43
38
  private updateAvatarItems;
44
- ngOnDestroy(): void;
45
39
  static ɵfac: i0.ɵɵFactoryDeclaration<ThyAvatarList, never>;
46
- static ɵcmp: i0.ɵɵComponentDeclaration<ThyAvatarList, "thy-avatar-list", never, { "thyMode": { "alias": "thyMode"; "required": false; }; "thyAvatarSize": { "alias": "thyAvatarSize"; "required": false; }; }, {}, ["append", "avatarComponents"], ["*"], true, never>;
40
+ static ɵcmp: i0.ɵɵComponentDeclaration<ThyAvatarList, "thy-avatar-list", never, { "thyMode": { "alias": "thyMode"; "required": false; "isSignal": true; }; "thyAvatarSize": { "alias": "thyAvatarSize"; "required": false; "isSignal": true; }; }, {}, ["append", "avatarComponents"], ["*"], true, never>;
47
41
  }
@@ -1,4 +1,4 @@
1
- import { ElementRef, EventEmitter, OnInit } from '@angular/core';
1
+ import { ElementRef, Signal } from '@angular/core';
2
2
  import { SafeHtml } from '@angular/platform-browser';
3
3
  import * as i0 from "@angular/core";
4
4
  export declare const DEFAULT_SIZE = 36;
@@ -18,92 +18,78 @@ export type ThyAvatarFetchPriority = 'high' | 'low' | 'auto';
18
18
  * @name thy-avatar
19
19
  * @order 10
20
20
  */
21
- export declare class ThyAvatar implements OnInit {
21
+ export declare class ThyAvatar {
22
22
  private thyAvatarService;
23
23
  elementRef: ElementRef<any>;
24
- _src: string;
25
- _name: string;
26
- _size: number;
27
- _showRemove: boolean;
28
- avatarSrc: string;
29
- avatarName?: string;
30
- avatarNameSafeHtml?: SafeHtml;
31
- _isAvatar: boolean;
32
24
  /**
33
25
  * * 已废弃,请使用 thyRemove
34
26
  * @deprecated
35
27
  */
36
- thyOnRemove: EventEmitter<any>;
28
+ readonly thyOnRemove: import("@angular/core").OutputEmitterRef<Event>;
37
29
  /**
38
- * 移除按钮的事件, thyRemovable 为 true 时起作用
30
+ * 移除按钮的事件,当 thyRemovable 为 true 时起作用
39
31
  */
40
- thyRemove: EventEmitter<any>;
32
+ readonly thyRemove: import("@angular/core").OutputEmitterRef<Event>;
41
33
  /**
42
34
  * 头像 img 加载 error 时触发
43
35
  */
44
- thyError: EventEmitter<Event>;
36
+ readonly thyError: import("@angular/core").OutputEmitterRef<Event>;
45
37
  /**
46
38
  * 是否展示人员名称
47
- * @default false
48
39
  */
49
- thyShowName: boolean;
40
+ readonly thyShowName: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
50
41
  /**
51
42
  * 头像路径地址, 默认为全路径,如果不是全路径,可以通过自定义服务 ThyAvatarService,重写 srcTransform 方法实现转换
52
- *
53
43
  */
54
- set thySrc(value: string);
44
+ readonly thySrc: import("@angular/core").InputSignal<string>;
45
+ src: Signal<string>;
55
46
  /**
56
47
  * 人员名称(可设置自定义名称,需通过自定义服务 ThyAvatarService,重写 nameTransform 方法去实现转换)
57
48
  */
58
- set thyName(value: string);
49
+ readonly thyName: import("@angular/core").InputSignal<string>;
50
+ avatarName: Signal<string>;
51
+ avatarNameSafeHtml: Signal<SafeHtml>;
59
52
  /**
60
53
  * 头像大小
61
54
  * @type 16 | 22 | 24 | 28 | 32 | 36 | 44 | 48 | 68 | 110 | 160 | xxs(22px) | xs(24px) | sm(32px) | md(36px) | lg(48px)
62
55
  * @default md
63
56
  */
64
- set thySize(value: number | string);
57
+ readonly thySize: import("@angular/core").ModelSignal<string | number>;
58
+ size: Signal<number>;
65
59
  /**
66
60
  * 已废弃,请使用 thyRemovable
67
61
  * @deprecated
68
- * @default false
69
62
  */
70
- set thyShowRemove(value: boolean);
63
+ readonly thyShowRemove: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
71
64
  /**
72
65
  * 是否展示移除按钮
73
- * @default false
74
66
  */
75
- set thyRemovable(value: boolean);
67
+ readonly thyRemovable: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
68
+ showRemove: Signal<boolean>;
76
69
  /**
77
70
  * 图片自定义类
78
71
  */
79
- thyImgClass: string;
72
+ readonly thyImgClass: import("@angular/core").InputSignal<string>;
80
73
  /**
81
74
  * 是否禁用
82
- * @default false
83
75
  */
84
- thyDisabled: boolean;
76
+ readonly thyDisabled: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
85
77
  /**
86
78
  * 图片加载策略
87
79
  * @type eager(立即加载) | lazy(延迟加载)
88
80
  */
89
- thyLoading?: ThyAvatarLoading;
81
+ readonly thyLoading: import("@angular/core").InputSignal<ThyAvatarLoading>;
90
82
  /**
91
83
  * 图片加载优先级
92
84
  * @type auto(默认) | high(高) | low(低)
93
85
  */
94
- thyFetchPriority?: ThyAvatarFetchPriority;
95
- private _setAvatarSize;
96
- private findClosestSize;
97
- private _setAvatarSrc;
98
- private _setAvatarName;
86
+ readonly thyFetchPriority: import("@angular/core").InputSignal<ThyAvatarFetchPriority>;
87
+ private isAvatarImgError;
99
88
  private hostRenderer;
100
- ngOnInit(): void;
89
+ constructor();
90
+ private findClosestSize;
101
91
  remove($event: Event): void;
102
92
  avatarImgError($event: Event): void;
103
93
  static ɵfac: i0.ɵɵFactoryDeclaration<ThyAvatar, never>;
104
- static ɵcmp: i0.ɵɵComponentDeclaration<ThyAvatar, "thy-avatar", never, { "thyShowName": { "alias": "thyShowName"; "required": false; }; "thySrc": { "alias": "thySrc"; "required": false; }; "thyName": { "alias": "thyName"; "required": false; }; "thySize": { "alias": "thySize"; "required": false; }; "thyShowRemove": { "alias": "thyShowRemove"; "required": false; }; "thyRemovable": { "alias": "thyRemovable"; "required": false; }; "thyImgClass": { "alias": "thyImgClass"; "required": false; }; "thyDisabled": { "alias": "thyDisabled"; "required": false; }; "thyLoading": { "alias": "thyLoading"; "required": false; }; "thyFetchPriority": { "alias": "thyFetchPriority"; "required": false; }; }, { "thyOnRemove": "thyOnRemove"; "thyRemove": "thyRemove"; "thyError": "thyError"; }, never, never, true, never>;
105
- static ngAcceptInputType_thyShowName: boolean | string | number;
106
- static ngAcceptInputType_thyShowRemove: boolean | string | number;
107
- static ngAcceptInputType_thyRemovable: boolean | string | number;
108
- static ngAcceptInputType_thyDisabled: boolean | string | number;
94
+ static ɵcmp: i0.ɵɵComponentDeclaration<ThyAvatar, "thy-avatar", never, { "thyShowName": { "alias": "thyShowName"; "required": false; "isSignal": true; }; "thySrc": { "alias": "thySrc"; "required": false; "isSignal": true; }; "thyName": { "alias": "thyName"; "required": false; "isSignal": true; }; "thySize": { "alias": "thySize"; "required": false; "isSignal": true; }; "thyShowRemove": { "alias": "thyShowRemove"; "required": false; "isSignal": true; }; "thyRemovable": { "alias": "thyRemovable"; "required": false; "isSignal": true; }; "thyImgClass": { "alias": "thyImgClass"; "required": false; "isSignal": true; }; "thyDisabled": { "alias": "thyDisabled"; "required": false; "isSignal": true; }; "thyLoading": { "alias": "thyLoading"; "required": false; "isSignal": true; }; "thyFetchPriority": { "alias": "thyFetchPriority"; "required": false; "isSignal": true; }; }, { "thyOnRemove": "thyOnRemove"; "thyRemove": "thyRemove"; "thyError": "thyError"; "thySize": "thySizeChange"; }, never, never, true, never>;
109
95
  }
@@ -1,9 +1,9 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, ElementRef, Renderer2, ChangeDetectorRef, Input, ChangeDetectionStrategy, Component, ContentChildren, NgModule } from '@angular/core';
2
+ import { inject, ElementRef, Renderer2, ChangeDetectorRef, computed, input, ChangeDetectionStrategy, Component, contentChildren, effect, NgModule } from '@angular/core';
3
3
  import { useHostRenderer } from '@tethys/cdk/dom';
4
4
  import { ThyIcon, ThyIconModule } from 'ngx-tethys/icon';
5
- import { timer } from 'rxjs';
6
5
  import { coerceBooleanProperty } from 'ngx-tethys/util';
6
+ import { timer } from 'rxjs';
7
7
  import { getNumericSize } from 'ngx-tethys/core';
8
8
  import { CommonModule } from '@angular/common';
9
9
 
@@ -28,49 +28,45 @@ class ThyAction {
28
28
  this.elementRef = inject(ElementRef);
29
29
  this.renderer = inject(Renderer2);
30
30
  this.cdr = inject(ChangeDetectorRef);
31
+ this.icon = computed(() => this.thyActionIcon() || this.thyIcon());
31
32
  this.feedback = null;
32
- this.active = false;
33
- this.type = 'primary';
33
+ this.active = computed(() => this.thyActionActive() || this.thyActive());
34
+ this.type = computed(() => this.thyType() || 'primary');
34
35
  this.hostRenderer = useHostRenderer();
36
+ /**
37
+ * 操作图标的类型
38
+ * @type primary | success | danger | warning
39
+ */
40
+ this.thyType = input('primary');
41
+ /**
42
+ * 操作图标,支持传参同时也支持在投影中写 thy-icon 组件
43
+ */
44
+ this.thyIcon = input('');
45
+ /**
46
+ * 操作图标,当 thyIcon 和其他指令参数名有冲突时使用 thyActionIcon
47
+ */
48
+ this.thyActionIcon = input('');
49
+ /**
50
+ * 操作的图标 Active 状态,设置为 true 时会在 Item 上添加 active class
51
+ */
52
+ this.thyActive = input(false, { transform: coerceBooleanProperty });
53
+ /**
54
+ * 操作的图标 Active 状态,当 thyActive 和其他指令参数名有冲突时使用 thyActionActive
55
+ */
56
+ this.thyActionActive = input(false, { transform: coerceBooleanProperty });
35
57
  /**
36
58
  * 操作图标的主题
37
59
  * @type fill(背景色填充) | lite(简单文本颜色变化)
38
60
  */
39
- this.thyTheme = 'fill';
40
- }
41
- /**
42
- * 操作图标的类型
43
- * @type primary | success | danger | warning
44
- * @default primary
45
- */
46
- set thyType(value) {
47
- this.setActionType(value || 'primary');
48
- }
49
- /**
50
- * 操作图标,支持传参同时也支持在投影中写 thy-icon 组件
51
- */
52
- set thyIcon(icon) {
53
- this.icon = icon;
54
- }
55
- /**
56
- * 操作图标,当 thyIcon 和其他指令参数名有冲突时使用 thyActionIcon
57
- */
58
- set thyActionIcon(icon) {
59
- this.icon = icon;
60
- }
61
- /**
62
- * 操作的图标 Active 状态,设置为 true 时会在 Item 上添加 active class
63
- * @default false
64
- */
65
- set thyActive(value) {
66
- this.active = value;
67
- }
68
- /**
69
- * 操作的图标 Active 状态,当 thyActive 和其他指令参数名有冲突时使用 thyActionActive
70
- * @default false
71
- */
72
- set thyActionActive(value) {
73
- this.active = value;
61
+ this.thyTheme = input('fill');
62
+ /**
63
+ * Hover 展示的图标
64
+ */
65
+ this.thyHoverIcon = input();
66
+ /**
67
+ * 是否处于禁用状态
68
+ */
69
+ this.thyDisabled = input(false, { transform: coerceBooleanProperty });
74
70
  }
75
71
  ngOnInit() {
76
72
  this.updateClasses();
@@ -99,7 +95,7 @@ class ThyAction {
99
95
  this.setFeedback('error', options);
100
96
  }
101
97
  setFeedback(feedback, options) {
102
- if (this.thyDisabled) {
98
+ if (this.thyDisabled()) {
103
99
  return;
104
100
  }
105
101
  options = Object.assign({}, defaultFeedbackOptions[feedback], options);
@@ -128,13 +124,10 @@ class ThyAction {
128
124
  }
129
125
  });
130
126
  }
131
- setActionType(value) {
132
- this.type = value;
133
- }
134
127
  updateClasses() {
135
128
  let classNames = [];
136
- classNames.push(`action-${this.type}`);
137
- if (this.thyTheme === 'lite') {
129
+ classNames.push(`action-${this.type()}`);
130
+ if (this.thyTheme() === 'lite') {
138
131
  classNames.push('thy-action-lite');
139
132
  }
140
133
  this.hostRenderer.updateClass(classNames);
@@ -143,37 +136,18 @@ class ThyAction {
143
136
  this.feedbackTimer?.unsubscribe();
144
137
  }
145
138
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyAction, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
146
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyAction, isStandalone: true, selector: "thy-action, [thyAction]", inputs: { thyType: "thyType", thyIcon: "thyIcon", thyActionIcon: "thyActionIcon", thyActive: ["thyActive", "thyActive", coerceBooleanProperty], thyActionActive: ["thyActionActive", "thyActionActive", coerceBooleanProperty], thyTheme: "thyTheme", thyHoverIcon: "thyHoverIcon", thyDisabled: ["thyDisabled", "thyDisabled", coerceBooleanProperty] }, host: { properties: { "class.active": "active", "class.thy-action-hover-icon": "thyHoverIcon", "class.thy-action-has-feedback": "!!feedback", "class.disabled": "thyDisabled" }, classAttribute: "thy-action" }, usesOnChanges: true, 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 }); }
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" }, usesOnChanges: true, 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 }); }
147
140
  }
148
141
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyAction, decorators: [{
149
142
  type: Component,
150
143
  args: [{ selector: 'thy-action, [thyAction]', changeDetection: ChangeDetectionStrategy.OnPush, host: {
151
144
  class: 'thy-action',
152
- '[class.active]': 'active',
153
- '[class.thy-action-hover-icon]': 'thyHoverIcon',
145
+ '[class.active]': 'active()',
146
+ '[class.thy-action-hover-icon]': 'thyHoverIcon()',
154
147
  '[class.thy-action-has-feedback]': '!!feedback',
155
- '[class.disabled]': 'thyDisabled'
156
- }, 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" }]
157
- }], propDecorators: { thyType: [{
158
- type: Input
159
- }], thyIcon: [{
160
- type: Input
161
- }], thyActionIcon: [{
162
- type: Input
163
- }], thyActive: [{
164
- type: Input,
165
- args: [{ transform: coerceBooleanProperty }]
166
- }], thyActionActive: [{
167
- type: Input,
168
- args: [{ transform: coerceBooleanProperty }]
169
- }], thyTheme: [{
170
- type: Input
171
- }], thyHoverIcon: [{
172
- type: Input
173
- }], thyDisabled: [{
174
- type: Input,
175
- args: [{ transform: coerceBooleanProperty }]
176
- }] } });
148
+ '[class.disabled]': 'thyDisabled()'
149
+ }, 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
+ }] });
177
151
 
178
152
  /**
179
153
  * Actions 组件
@@ -181,34 +155,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
181
155
  */
182
156
  class ThyActions {
183
157
  constructor() {
158
+ this.actions = contentChildren(ThyAction);
184
159
  /**
185
160
  * 大小,支持 `zero` | `xxs` | `xs` | `sm` | `md` | `lg` | `xlg` 和自定义数字大小
186
161
  * @type string | number
187
162
  */
188
- this.thySize = 'md';
189
- }
190
- ngOnInit() { }
191
- ngOnChanges(changes) {
192
- if (changes.thySize && !changes.thySize.firstChange && this.actions) {
193
- this.setActionsSize(this.actions.toArray());
194
- }
195
- }
196
- ngAfterContentInit() {
197
- this.actions.changes.subscribe((actions) => {
198
- this.setActionsSize(actions);
163
+ this.thySize = input('md');
164
+ effect(() => {
165
+ this.setActionsSize();
199
166
  });
200
- this.setActionsSize(this.actions.toArray());
201
167
  }
202
- setActionsSize(actions) {
168
+ ngOnInit() { }
169
+ setActionsSize() {
170
+ const actions = Array.from(this.actions());
203
171
  actions.forEach((action, index) => {
204
172
  // can't set marginRight value for last item
205
173
  if (index !== actions.length - 1) {
206
- action.setMarginRight(getNumericSize(this.thySize, 'md') + 'px');
174
+ action.setMarginRight(getNumericSize(this.thySize(), 'md') + 'px');
207
175
  }
208
176
  });
209
177
  }
210
178
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyActions, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
211
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.8", type: ThyActions, isStandalone: true, selector: "thy-actions", inputs: { thySize: "thySize" }, host: { classAttribute: "thy-actions" }, queries: [{ propertyName: "actions", predicate: ThyAction }], usesOnChanges: true, ngImport: i0, template: ` <ng-content></ng-content> `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
179
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.8", type: ThyActions, isStandalone: true, selector: "thy-actions", inputs: { thySize: { classPropertyName: "thySize", publicName: "thySize", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "thy-actions" }, queries: [{ propertyName: "actions", predicate: ThyAction, isSignal: true }], ngImport: i0, template: ` <ng-content></ng-content> `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
212
180
  }
213
181
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyActions, decorators: [{
214
182
  type: Component,
@@ -220,12 +188,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
220
188
  class: 'thy-actions'
221
189
  }
222
190
  }]
223
- }], ctorParameters: () => [], propDecorators: { actions: [{
224
- type: ContentChildren,
225
- args: [ThyAction]
226
- }], thySize: [{
227
- type: Input
228
- }] } });
191
+ }], ctorParameters: () => [] });
229
192
 
230
193
  class ThyActionModule {
231
194
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyActionModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }