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 +2 -8
- package/action/action.component.d.ts +20 -12
- package/action/actions.component.d.ts +7 -5
- package/affix/affix.component.d.ts +10 -7
- package/avatar/avatar-list/avatar-list.component.d.ts +14 -8
- package/avatar/avatar.component.d.ts +39 -25
- package/fesm2022/ngx-tethys-action.mjs +91 -54
- package/fesm2022/ngx-tethys-action.mjs.map +1 -1
- package/fesm2022/ngx-tethys-affix.mjs +26 -29
- package/fesm2022/ngx-tethys-affix.mjs.map +1 -1
- package/fesm2022/ngx-tethys-avatar.mjs +162 -117
- package/fesm2022/ngx-tethys-avatar.mjs.map +1 -1
- package/fesm2022/ngx-tethys-comment.mjs +1 -1
- package/fesm2022/ngx-tethys-comment.mjs.map +1 -1
- package/fesm2022/ngx-tethys-list.mjs +1 -1
- package/fesm2022/ngx-tethys-list.mjs.map +1 -1
- package/fesm2022/ngx-tethys-mention.mjs +73 -51
- package/fesm2022/ngx-tethys-mention.mjs.map +1 -1
- package/fesm2022/ngx-tethys.mjs +1 -1
- package/fesm2022/ngx-tethys.mjs.map +1 -1
- package/mention/mention.directive.d.ts +7 -6
- package/mention/suggestions/suggestions.component.d.ts +9 -8
- package/package.json +1 -1
- package/schematics/version.d.ts +1 -1
- package/schematics/version.js +1 -1
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.
|
|
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)) ([
|
|
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,
|
|
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:
|
|
18
|
+
icon: string;
|
|
19
19
|
feedback: ThyActionFeedback;
|
|
20
20
|
feedbackOptions: ThyActionFeedbackOptions;
|
|
21
|
-
active:
|
|
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
|
-
|
|
30
|
+
set thyType(value: ThyActionType);
|
|
30
31
|
/**
|
|
31
32
|
* 操作图标,支持传参同时也支持在投影中写 thy-icon 组件
|
|
32
33
|
*/
|
|
33
|
-
|
|
34
|
+
set thyIcon(icon: string);
|
|
34
35
|
/**
|
|
35
36
|
* 操作图标,当 thyIcon 和其他指令参数名有冲突时使用 thyActionIcon
|
|
36
37
|
*/
|
|
37
|
-
|
|
38
|
+
set thyActionIcon(icon: string);
|
|
38
39
|
/**
|
|
39
40
|
* 操作的图标 Active 状态,设置为 true 时会在 Item 上添加 active class
|
|
41
|
+
* @default false
|
|
40
42
|
*/
|
|
41
|
-
|
|
43
|
+
set thyActive(value: boolean);
|
|
42
44
|
/**
|
|
43
45
|
* 操作的图标 Active 状态,当 thyActive 和其他指令参数名有冲突时使用 thyActionActive
|
|
46
|
+
* @default false
|
|
44
47
|
*/
|
|
45
|
-
|
|
48
|
+
set thyActionActive(value: boolean);
|
|
46
49
|
/**
|
|
47
50
|
* 操作图标的主题
|
|
48
51
|
* @type fill(背景色填充) | lite(简单文本颜色变化)
|
|
49
52
|
*/
|
|
50
|
-
|
|
53
|
+
thyTheme: 'fill' | 'lite';
|
|
51
54
|
/**
|
|
52
55
|
* Hover 展示的图标
|
|
53
56
|
*/
|
|
54
|
-
|
|
57
|
+
thyHoverIcon: string;
|
|
55
58
|
/**
|
|
56
59
|
* 是否处于禁用状态
|
|
60
|
+
* @default false
|
|
57
61
|
*/
|
|
58
|
-
|
|
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;
|
|
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
|
-
|
|
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
|
-
|
|
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;
|
|
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
|
|
14
|
+
private fixedElement;
|
|
15
15
|
/**
|
|
16
16
|
* 设置 thy-affix 需要监听其滚动事件的元素,值为一个返回对应 DOM 元素的函数
|
|
17
17
|
* @default window
|
|
18
18
|
* @type string | Element | Window
|
|
19
19
|
*/
|
|
20
|
-
|
|
20
|
+
thyContainer?: string | Element | Window;
|
|
21
21
|
/**
|
|
22
22
|
* 距离窗口顶部缓冲的偏移量阈值
|
|
23
|
+
* @default 0
|
|
23
24
|
*/
|
|
24
|
-
|
|
25
|
+
thyOffsetTop?: null | number;
|
|
25
26
|
/**
|
|
26
27
|
* 距离窗口底部缓冲的偏移量阈值
|
|
27
28
|
*/
|
|
28
|
-
|
|
29
|
+
thyOffsetBottom?: null | number;
|
|
29
30
|
/**
|
|
30
31
|
* 固定状态改变时触发的回调函数
|
|
31
32
|
*/
|
|
32
|
-
readonly thyChange:
|
|
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;
|
|
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 {
|
|
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
|
-
|
|
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
|
-
|
|
31
|
+
thyAvatarSize: number | string;
|
|
29
32
|
/**
|
|
30
33
|
* append 自定义操作
|
|
31
34
|
*/
|
|
32
|
-
|
|
35
|
+
append: TemplateRef<SafeAny>;
|
|
33
36
|
/**
|
|
34
37
|
* @private
|
|
35
38
|
*/
|
|
36
|
-
|
|
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;
|
|
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,
|
|
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
|
-
|
|
36
|
+
thyOnRemove: EventEmitter<any>;
|
|
29
37
|
/**
|
|
30
|
-
*
|
|
38
|
+
* 移除按钮的事件, 当 thyRemovable 为 true 时起作用
|
|
31
39
|
*/
|
|
32
|
-
|
|
40
|
+
thyRemove: EventEmitter<any>;
|
|
33
41
|
/**
|
|
34
42
|
* 头像 img 加载 error 时触发
|
|
35
43
|
*/
|
|
36
|
-
|
|
44
|
+
thyError: EventEmitter<Event>;
|
|
37
45
|
/**
|
|
38
46
|
* 是否展示人员名称
|
|
47
|
+
* @default false
|
|
39
48
|
*/
|
|
40
|
-
|
|
49
|
+
thyShowName: boolean;
|
|
41
50
|
/**
|
|
42
51
|
* 头像路径地址, 默认为全路径,如果不是全路径,可以通过自定义服务 ThyAvatarService,重写 srcTransform 方法实现转换
|
|
52
|
+
*
|
|
43
53
|
*/
|
|
44
|
-
|
|
45
|
-
src: Signal<string>;
|
|
54
|
+
set thySrc(value: string);
|
|
46
55
|
/**
|
|
47
56
|
* 人员名称(可设置自定义名称,需通过自定义服务 ThyAvatarService,重写 nameTransform 方法去实现转换)
|
|
48
57
|
*/
|
|
49
|
-
|
|
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
|
-
|
|
58
|
-
size: Signal<number>;
|
|
64
|
+
set thySize(value: number | string);
|
|
59
65
|
/**
|
|
60
66
|
* 已废弃,请使用 thyRemovable
|
|
61
67
|
* @deprecated
|
|
68
|
+
* @default false
|
|
62
69
|
*/
|
|
63
|
-
|
|
70
|
+
set thyShowRemove(value: boolean);
|
|
64
71
|
/**
|
|
65
72
|
* 是否展示移除按钮
|
|
73
|
+
* @default false
|
|
66
74
|
*/
|
|
67
|
-
|
|
68
|
-
showRemove: Signal<boolean>;
|
|
75
|
+
set thyRemovable(value: boolean);
|
|
69
76
|
/**
|
|
70
77
|
* 图片自定义类
|
|
71
78
|
*/
|
|
72
|
-
|
|
79
|
+
thyImgClass: string;
|
|
73
80
|
/**
|
|
74
81
|
* 是否禁用
|
|
82
|
+
* @default false
|
|
75
83
|
*/
|
|
76
|
-
|
|
84
|
+
thyDisabled: boolean;
|
|
77
85
|
/**
|
|
78
86
|
* 图片加载策略
|
|
79
87
|
* @type eager(立即加载) | lazy(延迟加载)
|
|
80
88
|
*/
|
|
81
|
-
|
|
89
|
+
thyLoading?: ThyAvatarLoading;
|
|
82
90
|
/**
|
|
83
91
|
* 图片加载优先级
|
|
84
92
|
* @type auto(默认) | high(高) | low(低)
|
|
85
93
|
*/
|
|
86
|
-
|
|
87
|
-
private
|
|
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;
|
|
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,
|
|
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 =
|
|
34
|
-
this.type =
|
|
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 =
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
this.
|
|
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
|
|
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:
|
|
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
|
|
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 =
|
|
164
|
-
effect(() => {
|
|
165
|
-
this.setActionsSize();
|
|
166
|
-
});
|
|
188
|
+
this.thySize = 'md';
|
|
167
189
|
}
|
|
168
190
|
ngOnInit() { }
|
|
169
|
-
|
|
170
|
-
|
|
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
|
|
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: "
|
|
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 }); }
|