ngx-tethys 19.0.12 → 19.0.13

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