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
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, Pipe, inject, ElementRef,
|
|
2
|
+
import { Injectable, Pipe, inject, ElementRef, EventEmitter, Input, Output, HostBinding, ChangeDetectionStrategy, Component, ContentChildren, ContentChild, NgModule } from '@angular/core';
|
|
3
3
|
import { NgClass, NgStyle, NgTemplateOutlet, CommonModule } from '@angular/common';
|
|
4
|
-
import {
|
|
4
|
+
import { isString, coerceBooleanProperty } from 'ngx-tethys/util';
|
|
5
5
|
import { useHostRenderer } from '@tethys/cdk/dom';
|
|
6
6
|
import { ThyIcon, ThyIconModule } from 'ngx-tethys/icon';
|
|
7
7
|
import { UpdateHostClassService } from 'ngx-tethys/core';
|
|
8
|
+
import { Subject } from 'rxjs';
|
|
9
|
+
import { startWith, takeUntil } from 'rxjs/operators';
|
|
8
10
|
|
|
9
11
|
class ThyAvatarService {
|
|
10
12
|
constructor() {
|
|
@@ -134,100 +136,73 @@ class ThyAvatar {
|
|
|
134
136
|
constructor() {
|
|
135
137
|
this.thyAvatarService = inject(ThyAvatarService);
|
|
136
138
|
this.elementRef = inject(ElementRef);
|
|
139
|
+
this._showRemove = false;
|
|
140
|
+
this._isAvatar = true;
|
|
137
141
|
/**
|
|
138
142
|
* * 已废弃,请使用 thyRemove
|
|
139
143
|
* @deprecated
|
|
140
144
|
*/
|
|
141
|
-
this.thyOnRemove =
|
|
145
|
+
this.thyOnRemove = new EventEmitter();
|
|
142
146
|
/**
|
|
143
|
-
*
|
|
147
|
+
* 移除按钮的事件, 当 thyRemovable 为 true 时起作用
|
|
144
148
|
*/
|
|
145
|
-
this.thyRemove =
|
|
149
|
+
this.thyRemove = new EventEmitter();
|
|
146
150
|
/**
|
|
147
151
|
* 头像 img 加载 error 时触发
|
|
148
152
|
*/
|
|
149
|
-
this.thyError =
|
|
150
|
-
/**
|
|
151
|
-
* 是否展示人员名称
|
|
152
|
-
*/
|
|
153
|
-
this.thyShowName = input(false, { transform: coerceBooleanProperty });
|
|
154
|
-
/**
|
|
155
|
-
* 头像路径地址, 默认为全路径,如果不是全路径,可以通过自定义服务 ThyAvatarService,重写 srcTransform 方法实现转换
|
|
156
|
-
*/
|
|
157
|
-
this.thySrc = input();
|
|
158
|
-
this.src = computed(() => {
|
|
159
|
-
if (this.isAvatarImgError()) {
|
|
160
|
-
return null;
|
|
161
|
-
}
|
|
162
|
-
if (this.thySrc() && this.thyAvatarService.ignoreAvatarSrcPaths.indexOf(this.thySrc()) < 0) {
|
|
163
|
-
return this.thySrc();
|
|
164
|
-
}
|
|
165
|
-
return null;
|
|
166
|
-
});
|
|
167
|
-
/**
|
|
168
|
-
* 人员名称(可设置自定义名称,需通过自定义服务 ThyAvatarService,重写 nameTransform 方法去实现转换)
|
|
169
|
-
*/
|
|
170
|
-
this.thyName = input();
|
|
171
|
-
this.avatarName = computed(() => {
|
|
172
|
-
const name = this.thyAvatarService.nameTransform(this.thyName());
|
|
173
|
-
return isString(name) ? name : this.thyName();
|
|
174
|
-
});
|
|
175
|
-
this.avatarNameSafeHtml = computed(() => {
|
|
176
|
-
const name = this.thyAvatarService.nameTransform(this.thyName());
|
|
177
|
-
if (!isString(name)) {
|
|
178
|
-
return name;
|
|
179
|
-
}
|
|
180
|
-
return null;
|
|
181
|
-
});
|
|
182
|
-
/**
|
|
183
|
-
* 头像大小
|
|
184
|
-
* @type 16 | 22 | 24 | 28 | 32 | 36 | 44 | 48 | 68 | 110 | 160 | xxs(22px) | xs(24px) | sm(32px) | md(36px) | lg(48px)
|
|
185
|
-
* @default md
|
|
186
|
-
*/
|
|
187
|
-
this.thySize = model('md');
|
|
188
|
-
this.size = computed(() => {
|
|
189
|
-
const sizeKey = this.thySize();
|
|
190
|
-
if (thyAvatarSizeMap[sizeKey]) {
|
|
191
|
-
return thyAvatarSizeMap[sizeKey];
|
|
192
|
-
}
|
|
193
|
-
else {
|
|
194
|
-
const size = this.thySize() * 1;
|
|
195
|
-
return sizeArray.indexOf(size) > -1 ? size : this.findClosestSize(sizeArray, size);
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
/**
|
|
199
|
-
* 已废弃,请使用 thyRemovable
|
|
200
|
-
* @deprecated
|
|
201
|
-
*/
|
|
202
|
-
this.thyShowRemove = input(false, { transform: coerceBooleanProperty });
|
|
203
|
-
/**
|
|
204
|
-
* 是否展示移除按钮
|
|
205
|
-
*/
|
|
206
|
-
this.thyRemovable = input(false, { transform: coerceBooleanProperty });
|
|
207
|
-
this.showRemove = computed(() => this.thyRemovable() || this.thyShowRemove());
|
|
208
|
-
/**
|
|
209
|
-
* 图片自定义类
|
|
210
|
-
*/
|
|
211
|
-
this.thyImgClass = input();
|
|
212
|
-
/**
|
|
213
|
-
* 是否禁用
|
|
214
|
-
*/
|
|
215
|
-
this.thyDisabled = input(false, { transform: coerceBooleanProperty });
|
|
216
|
-
/**
|
|
217
|
-
* 图片加载策略
|
|
218
|
-
* @type eager(立即加载) | lazy(延迟加载)
|
|
219
|
-
*/
|
|
220
|
-
this.thyLoading = input();
|
|
221
|
-
/**
|
|
222
|
-
* 图片加载优先级
|
|
223
|
-
* @type auto(默认) | high(高) | low(低)
|
|
224
|
-
*/
|
|
225
|
-
this.thyFetchPriority = input();
|
|
226
|
-
this.isAvatarImgError = signal(false);
|
|
153
|
+
this.thyError = new EventEmitter();
|
|
227
154
|
this.hostRenderer = useHostRenderer();
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* 头像路径地址, 默认为全路径,如果不是全路径,可以通过自定义服务 ThyAvatarService,重写 srcTransform 方法实现转换
|
|
158
|
+
*
|
|
159
|
+
*/
|
|
160
|
+
set thySrc(value) {
|
|
161
|
+
this._setAvatarSrc(value);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* 人员名称(可设置自定义名称,需通过自定义服务 ThyAvatarService,重写 nameTransform 方法去实现转换)
|
|
165
|
+
*/
|
|
166
|
+
set thyName(value) {
|
|
167
|
+
// this._name = value;
|
|
168
|
+
this._setAvatarName(value);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* 头像大小
|
|
172
|
+
* @type 16 | 22 | 24 | 28 | 32 | 36 | 44 | 48 | 68 | 110 | 160 | xxs(22px) | xs(24px) | sm(32px) | md(36px) | lg(48px)
|
|
173
|
+
* @default md
|
|
174
|
+
*/
|
|
175
|
+
set thySize(value) {
|
|
176
|
+
if (thyAvatarSizeMap[value]) {
|
|
177
|
+
this._setAvatarSize(thyAvatarSizeMap[value]);
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
this._setAvatarSize(value * 1);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* 已废弃,请使用 thyRemovable
|
|
185
|
+
* @deprecated
|
|
186
|
+
* @default false
|
|
187
|
+
*/
|
|
188
|
+
set thyShowRemove(value) {
|
|
189
|
+
this._showRemove = value;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* 是否展示移除按钮
|
|
193
|
+
* @default false
|
|
194
|
+
*/
|
|
195
|
+
set thyRemovable(value) {
|
|
196
|
+
this._showRemove = value;
|
|
197
|
+
}
|
|
198
|
+
_setAvatarSize(size) {
|
|
199
|
+
if (sizeArray.indexOf(size) > -1) {
|
|
200
|
+
this._size = size;
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
this._size = this.findClosestSize(sizeArray, size);
|
|
204
|
+
}
|
|
205
|
+
this.hostRenderer.updateClass([`thy-avatar-${this._size}`]);
|
|
231
206
|
}
|
|
232
207
|
findClosestSize(sizeArray, currentSize) {
|
|
233
208
|
let closestValue = sizeArray[0];
|
|
@@ -241,23 +216,78 @@ class ThyAvatar {
|
|
|
241
216
|
}
|
|
242
217
|
return closestValue;
|
|
243
218
|
}
|
|
219
|
+
_setAvatarSrc(src) {
|
|
220
|
+
if (src && this.thyAvatarService.ignoreAvatarSrcPaths.indexOf(src) < 0) {
|
|
221
|
+
this._src = src;
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
this._src = null;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
_setAvatarName(value) {
|
|
228
|
+
const name = this.thyAvatarService.nameTransform(value);
|
|
229
|
+
if (isString(name)) {
|
|
230
|
+
this.avatarName = name;
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
this.avatarName = value;
|
|
234
|
+
this.avatarNameSafeHtml = name;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
ngOnInit() {
|
|
238
|
+
if (!this._size) {
|
|
239
|
+
this._setAvatarSize(DEFAULT_SIZE);
|
|
240
|
+
}
|
|
241
|
+
this.hostRenderer.updateClass([`thy-avatar-${this._size}`]);
|
|
242
|
+
}
|
|
244
243
|
remove($event) {
|
|
245
244
|
this.thyOnRemove.emit($event);
|
|
246
245
|
this.thyRemove.emit($event);
|
|
247
246
|
}
|
|
248
247
|
avatarImgError($event) {
|
|
249
|
-
this.
|
|
248
|
+
this._setAvatarSrc(null);
|
|
250
249
|
this.thyError.emit($event);
|
|
251
250
|
}
|
|
252
251
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyAvatar, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
253
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyAvatar, isStandalone: true, selector: "thy-avatar", inputs: { thyShowName:
|
|
252
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyAvatar, isStandalone: true, selector: "thy-avatar", inputs: { thyShowName: ["thyShowName", "thyShowName", coerceBooleanProperty], thySrc: "thySrc", thyName: "thyName", thySize: "thySize", thyShowRemove: ["thyShowRemove", "thyShowRemove", coerceBooleanProperty], thyRemovable: ["thyRemovable", "thyRemovable", coerceBooleanProperty], thyImgClass: "thyImgClass", thyDisabled: ["thyDisabled", "thyDisabled", coerceBooleanProperty], thyLoading: "thyLoading", thyFetchPriority: "thyFetchPriority" }, outputs: { thyOnRemove: "thyOnRemove", thyRemove: "thyRemove", thyError: "thyError" }, host: { properties: { "class.thy-avatar": "this._isAvatar" } }, ngImport: i0, template: "@if (_src) {\n <img\n [src]=\"_src | thyAvatarSrc: _size\"\n class=\"avatar-avatar\"\n [ngClass]=\"thyImgClass\"\n alt=\"{{ avatarName || '' }}\"\n [attr.loading]=\"thyLoading\"\n [attr.fetchpriority]=\"thyFetchPriority\"\n (error)=\"avatarImgError($event)\"\n />\n} @else {\n <span class=\"avatar-default\" [ngStyle]=\"avatarName | avatarBgColor\">\n <div>{{ avatarName | avatarShortName }}</div>\n </span>\n}\n\n\n@if (thyShowName) {\n @if (avatarNameSafeHtml) {\n <div class=\"avatar-name\" [innerHtml]=\"avatarNameSafeHtml\"></div>\n } @else {\n <div class=\"avatar-name\">{{ avatarName }}</div>\n }\n}\n\n@if (_showRemove) {\n <a (click)=\"remove($event)\" href=\"javascript:;\" class=\"remove-link avatar-remove\">\n <thy-icon class=\"remove-link-icon\" thyIconName=\"close-circle-bold-fill\"></thy-icon>\n </a>\n}\n@if (thyDisabled) {\n <div class=\"thy-avatar-disabled\">\n <thy-icon class=\"thy-avatar-disabled-icon\" thyIconName=\"ban\"></thy-icon>\n </div>\n}\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { kind: "pipe", type: AvatarShortNamePipe, name: "avatarShortName" }, { kind: "pipe", type: AvatarBgColorPipe, name: "avatarBgColor" }, { kind: "pipe", type: AvatarSrcPipe, name: "thyAvatarSrc" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
254
253
|
}
|
|
255
254
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyAvatar, decorators: [{
|
|
256
255
|
type: Component,
|
|
257
|
-
args: [{ selector: 'thy-avatar',
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
256
|
+
args: [{ selector: 'thy-avatar', changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgClass, NgStyle, ThyIcon, AvatarShortNamePipe, AvatarBgColorPipe, AvatarSrcPipe], template: "@if (_src) {\n <img\n [src]=\"_src | thyAvatarSrc: _size\"\n class=\"avatar-avatar\"\n [ngClass]=\"thyImgClass\"\n alt=\"{{ avatarName || '' }}\"\n [attr.loading]=\"thyLoading\"\n [attr.fetchpriority]=\"thyFetchPriority\"\n (error)=\"avatarImgError($event)\"\n />\n} @else {\n <span class=\"avatar-default\" [ngStyle]=\"avatarName | avatarBgColor\">\n <div>{{ avatarName | avatarShortName }}</div>\n </span>\n}\n\n\n@if (thyShowName) {\n @if (avatarNameSafeHtml) {\n <div class=\"avatar-name\" [innerHtml]=\"avatarNameSafeHtml\"></div>\n } @else {\n <div class=\"avatar-name\">{{ avatarName }}</div>\n }\n}\n\n@if (_showRemove) {\n <a (click)=\"remove($event)\" href=\"javascript:;\" class=\"remove-link avatar-remove\">\n <thy-icon class=\"remove-link-icon\" thyIconName=\"close-circle-bold-fill\"></thy-icon>\n </a>\n}\n@if (thyDisabled) {\n <div class=\"thy-avatar-disabled\">\n <thy-icon class=\"thy-avatar-disabled-icon\" thyIconName=\"ban\"></thy-icon>\n </div>\n}\n" }]
|
|
257
|
+
}], propDecorators: { _isAvatar: [{
|
|
258
|
+
type: HostBinding,
|
|
259
|
+
args: ['class.thy-avatar']
|
|
260
|
+
}], thyOnRemove: [{
|
|
261
|
+
type: Output
|
|
262
|
+
}], thyRemove: [{
|
|
263
|
+
type: Output
|
|
264
|
+
}], thyError: [{
|
|
265
|
+
type: Output
|
|
266
|
+
}], thyShowName: [{
|
|
267
|
+
type: Input,
|
|
268
|
+
args: [{ transform: coerceBooleanProperty }]
|
|
269
|
+
}], thySrc: [{
|
|
270
|
+
type: Input
|
|
271
|
+
}], thyName: [{
|
|
272
|
+
type: Input
|
|
273
|
+
}], thySize: [{
|
|
274
|
+
type: Input
|
|
275
|
+
}], thyShowRemove: [{
|
|
276
|
+
type: Input,
|
|
277
|
+
args: [{ transform: coerceBooleanProperty }]
|
|
278
|
+
}], thyRemovable: [{
|
|
279
|
+
type: Input,
|
|
280
|
+
args: [{ transform: coerceBooleanProperty }]
|
|
281
|
+
}], thyImgClass: [{
|
|
282
|
+
type: Input
|
|
283
|
+
}], thyDisabled: [{
|
|
284
|
+
type: Input,
|
|
285
|
+
args: [{ transform: coerceBooleanProperty }]
|
|
286
|
+
}], thyLoading: [{
|
|
287
|
+
type: Input
|
|
288
|
+
}], thyFetchPriority: [{
|
|
289
|
+
type: Input
|
|
290
|
+
}] } });
|
|
261
291
|
|
|
262
292
|
const THY_AVATAR_ITEM_SPACE = 4;
|
|
263
293
|
const THY_OVERLAP_AVATAR_ITEM_SPACE = -8;
|
|
@@ -268,50 +298,65 @@ const THY_OVERLAP_AVATAR_ITEM_SPACE = -8;
|
|
|
268
298
|
*/
|
|
269
299
|
class ThyAvatarList {
|
|
270
300
|
constructor() {
|
|
301
|
+
this.overlapMode = false;
|
|
271
302
|
this.avatarItems = [];
|
|
272
|
-
|
|
273
|
-
* 展示方式
|
|
274
|
-
* @type overlap | default
|
|
275
|
-
*/
|
|
276
|
-
this.thyMode = input("default" /* ThyAvatarListMode.default */);
|
|
277
|
-
this.isOverlapMode = computed(() => {
|
|
278
|
-
return this.thyMode() === "overlap" /* ThyAvatarListMode.overlap */;
|
|
279
|
-
});
|
|
303
|
+
this.ngUnsubscribe$ = new Subject();
|
|
280
304
|
/**
|
|
281
305
|
* 头像大小
|
|
282
306
|
* @type 16 | 22 | 24 | 28 | 32 | 36 | 44 | 48 | 68 | 110 | 160 | xxs(22px) | xs(24px) | sm(32px) | md(36px) | lg(48px)
|
|
283
307
|
* @default 36
|
|
284
308
|
*/
|
|
285
|
-
this.thyAvatarSize =
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
309
|
+
this.thyAvatarSize = DEFAULT_SIZE;
|
|
310
|
+
}
|
|
311
|
+
ngOnChanges(changes) {
|
|
312
|
+
if (changes.thyAvatarSize && !changes.thyAvatarSize.firstChange) {
|
|
313
|
+
this.updateAvatarItems();
|
|
314
|
+
}
|
|
315
|
+
if (changes.thyMode) {
|
|
316
|
+
this.overlapMode = changes.thyMode.currentValue === "overlap" /* ThyAvatarListMode.overlap */;
|
|
317
|
+
if (!changes.thyMode.firstChange) {
|
|
318
|
+
this.updateAvatarItems();
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
ngAfterContentInit() {
|
|
323
|
+
this.avatarComponents.changes.pipe(startWith(this.avatarComponents), takeUntil(this.ngUnsubscribe$)).subscribe(() => {
|
|
295
324
|
this.updateAvatarItems();
|
|
296
325
|
});
|
|
297
326
|
}
|
|
298
327
|
updateAvatarItems() {
|
|
299
|
-
this.avatarItems =
|
|
328
|
+
this.avatarItems = this.avatarComponents.toArray();
|
|
300
329
|
this.avatarItems.forEach((item, index) => {
|
|
301
|
-
item.thySize
|
|
330
|
+
item.thySize = this.thyAvatarSize;
|
|
302
331
|
item.elementRef.nativeElement.style.zIndex = this.avatarItems.length - index;
|
|
303
332
|
});
|
|
304
333
|
}
|
|
334
|
+
ngOnDestroy() {
|
|
335
|
+
this.ngUnsubscribe$.next();
|
|
336
|
+
this.ngUnsubscribe$.complete();
|
|
337
|
+
}
|
|
305
338
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyAvatarList, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
306
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyAvatarList, isStandalone: true, selector: "thy-avatar-list", inputs: { thyMode:
|
|
339
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyAvatarList, isStandalone: true, selector: "thy-avatar-list", inputs: { thyMode: "thyMode", thyAvatarSize: "thyAvatarSize" }, host: { properties: { "class.thy-avatar-list-overlap": "this.overlapMode" }, classAttribute: "thy-avatar-list" }, providers: [UpdateHostClassService], queries: [{ propertyName: "append", first: true, predicate: ["append"], descendants: true }, { propertyName: "avatarComponents", predicate: ThyAvatar }], usesOnChanges: true, ngImport: i0, template: "<ng-content></ng-content>\n\n@if (append) {\n <div class=\"thy-avatar-append\">\n <ng-container [ngTemplateOutlet]=\"append\"></ng-container>\n </div>\n}\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
|
|
307
340
|
}
|
|
308
341
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyAvatarList, decorators: [{
|
|
309
342
|
type: Component,
|
|
310
343
|
args: [{ selector: 'thy-avatar-list', host: {
|
|
311
|
-
class: 'thy-avatar-list'
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
344
|
+
class: 'thy-avatar-list'
|
|
345
|
+
}, providers: [UpdateHostClassService], imports: [NgTemplateOutlet], template: "<ng-content></ng-content>\n\n@if (append) {\n <div class=\"thy-avatar-append\">\n <ng-container [ngTemplateOutlet]=\"append\"></ng-container>\n </div>\n}\n" }]
|
|
346
|
+
}], ctorParameters: () => [], propDecorators: { overlapMode: [{
|
|
347
|
+
type: HostBinding,
|
|
348
|
+
args: ['class.thy-avatar-list-overlap']
|
|
349
|
+
}], thyMode: [{
|
|
350
|
+
type: Input
|
|
351
|
+
}], thyAvatarSize: [{
|
|
352
|
+
type: Input
|
|
353
|
+
}], append: [{
|
|
354
|
+
type: ContentChild,
|
|
355
|
+
args: ['append', { static: false }]
|
|
356
|
+
}], avatarComponents: [{
|
|
357
|
+
type: ContentChildren,
|
|
358
|
+
args: [ThyAvatar]
|
|
359
|
+
}] } });
|
|
315
360
|
|
|
316
361
|
class ThyAvatarModule {
|
|
317
362
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyAvatarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngx-tethys-avatar.mjs","sources":["../../../src/avatar/avatar.service.ts","../../../src/avatar/avatar.pipe.ts","../../../src/avatar/avatar.component.ts","../../../src/avatar/avatar.component.html","../../../src/avatar/avatar-list/avatar-list.component.ts","../../../src/avatar/avatar-list/avatar-list.component.html","../../../src/avatar/avatar.module.ts","../../../src/avatar/ngx-tethys-avatar.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { SafeHtml } from '@angular/platform-browser';\n\nexport abstract class ThyAvatarService {\n ignoreAvatarSrcPaths = [`default.png`];\n\n /**\n * @deprecated the avatarSrcTransform method will be deprecated, please use srcTransform.\n */\n abstract avatarSrcTransform(src: string, size: number): string;\n\n abstract srcTransform(src: string, size: number): string;\n\n abstract nameTransform(name: string): string | SafeHtml;\n}\n\n@Injectable()\nexport class ThyDefaultAvatarService extends ThyAvatarService {\n /**\n * @deprecated the avatarSrcTransform method will be deprecated, please use srcTransform.\n */\n avatarSrcTransform(src: string, size: number): string {\n return src;\n }\n\n srcTransform(src: string, size: number): string {\n return src;\n }\n\n nameTransform(name: string): string | SafeHtml {\n return name;\n }\n}\n","import { Pipe, PipeTransform, inject } from '@angular/core';\nimport { ThyAvatarService } from './avatar.service';\n\n/**\n * `\\u4e00`: https://www.compart.com/en/unicode/U+4E00\n * `\\u9fa5`: https://www.compart.com/en/unicode/U+9FA5\n */\nconst UNIFIED_IDEOGRAPHS_REGEX = /^[\\u4e00-\\u9fa5]+$/;\n\nconst SET_OF_LETTERS_REGEX = /^[a-zA-Z\\/ ]+$/;\n\n/**\n * @private\n */\n@Pipe({\n name: 'avatarShortName'\n})\nexport class AvatarShortNamePipe implements PipeTransform {\n transform(name: string | null | undefined): string {\n if (!name) {\n return '';\n }\n\n name = name.trim();\n\n if (UNIFIED_IDEOGRAPHS_REGEX.test(name) && name.length > 2) {\n return name.slice(name.length - 2);\n }\n\n if (SET_OF_LETTERS_REGEX.test(name) && name.indexOf(' ') > 0) {\n const words: string[] = name.split(' ');\n return (words[0].slice(0, 1) + words[1].slice(0, 1)).toUpperCase();\n }\n\n return name.length > 2 ? name.slice(0, 2).toUpperCase() : name.toUpperCase();\n }\n}\n\n/**\n * @private\n */\n@Pipe({\n name: 'avatarBgColor'\n})\nexport class AvatarBgColorPipe implements PipeTransform {\n transform(name: string) {\n if (!name) {\n return;\n }\n const colors = ['#56abfb', '#5dcfff', '#84e17e', '#73d897', '#ff9f73', '#fa8888', '#fb7fb7', '#9a7ef4', '#868af6'];\n const nameArray: string[] = name.split('');\n const code: number =\n name && name.length > 0\n ? nameArray.reduce(\n function (result, item) {\n result.value += item.charCodeAt(0);\n return result;\n },\n { value: 0 }\n ).value\n : 0;\n return {\n 'background-color': colors[code % 9]\n };\n }\n}\n\n/**\n * @private\n */\n@Pipe({\n name: 'thyAvatarSrc'\n})\nexport class AvatarSrcPipe implements PipeTransform {\n private thyAvatarService = inject(ThyAvatarService);\n\n transform(src: string, size: number) {\n return this.thyAvatarService.srcTransform\n ? this.thyAvatarService.srcTransform(src, size)\n : this.thyAvatarService.avatarSrcTransform(src, size);\n }\n}\n\nexport const AvatarPipes = [AvatarShortNamePipe, AvatarBgColorPipe, AvatarSrcPipe];\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n Signal,\n WritableSignal,\n computed,\n effect,\n inject,\n input,\n model,\n output,\n signal\n} from '@angular/core';\nimport { SafeHtml } from '@angular/platform-browser';\nimport { isString, coerceBooleanProperty } from 'ngx-tethys/util';\nimport { useHostRenderer } from '@tethys/cdk/dom';\nimport { ThyAvatarService } from './avatar.service';\nimport { AvatarShortNamePipe, AvatarBgColorPipe, AvatarSrcPipe } from './avatar.pipe';\nimport { ThyIcon } from 'ngx-tethys/icon';\nimport { NgClass, NgStyle } from '@angular/common';\n\nconst sizeArray = [16, 22, 24, 28, 32, 36, 44, 48, 68, 110, 160];\n\nexport const DEFAULT_SIZE = 36;\n\nexport const thyAvatarSizeMap = {\n xxs: 22,\n xs: 24,\n sm: 32,\n md: 36,\n lg: 48\n};\n\n/** https://html.spec.whatwg.org/multipage/embedded-content.html#attr-img-loading */\nexport type ThyAvatarLoading = 'eager' | 'lazy';\n\n/** https://wicg.github.io/priority-hints/#idl-index */\nexport type ThyAvatarFetchPriority = 'high' | 'low' | 'auto';\n\n/**\n * 头像组件\n * @name thy-avatar\n * @order 10\n */\n@Component({\n selector: 'thy-avatar',\n templateUrl: './avatar.component.html',\n host: {\n class: 'thy-avatar'\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [NgClass, NgStyle, ThyIcon, AvatarShortNamePipe, AvatarBgColorPipe, AvatarSrcPipe]\n})\nexport class ThyAvatar {\n private thyAvatarService = inject(ThyAvatarService);\n elementRef = inject(ElementRef);\n\n /**\n * * 已废弃,请使用 thyRemove\n * @deprecated\n */\n readonly thyOnRemove = output<Event>();\n\n /**\n * 移除按钮的事件,当 thyRemovable 为 true 时起作用\n */\n readonly thyRemove = output<Event>();\n\n /**\n * 头像 img 加载 error 时触发\n */\n readonly thyError = output<Event>();\n\n /**\n * 是否展示人员名称\n */\n readonly thyShowName = input<boolean, unknown>(false, { transform: coerceBooleanProperty });\n\n /**\n * 头像路径地址, 默认为全路径,如果不是全路径,可以通过自定义服务 ThyAvatarService,重写 srcTransform 方法实现转换\n */\n readonly thySrc = input<string>();\n\n src = computed(() => {\n if (this.isAvatarImgError()) {\n return null;\n }\n if (this.thySrc() && this.thyAvatarService.ignoreAvatarSrcPaths.indexOf(this.thySrc()) < 0) {\n return this.thySrc();\n }\n return null;\n });\n\n /**\n * 人员名称(可设置自定义名称,需通过自定义服务 ThyAvatarService,重写 nameTransform 方法去实现转换)\n */\n readonly thyName = input<string>();\n\n avatarName: Signal<string> = computed(() => {\n const name = this.thyAvatarService.nameTransform(this.thyName());\n return isString(name) ? name : this.thyName();\n });\n\n avatarNameSafeHtml: Signal<SafeHtml> = computed(() => {\n const name = this.thyAvatarService.nameTransform(this.thyName());\n if (!isString(name)) {\n return name;\n }\n return null;\n });\n\n /**\n * 头像大小\n * @type 16 | 22 | 24 | 28 | 32 | 36 | 44 | 48 | 68 | 110 | 160 | xxs(22px) | xs(24px) | sm(32px) | md(36px) | lg(48px)\n * @default md\n */\n readonly thySize = model<number | string>('md');\n\n size: Signal<number> = computed(() => {\n const sizeKey = this.thySize() as 'xxs' | 'xs' | 'sm' | 'md' | 'lg';\n if (thyAvatarSizeMap[sizeKey]) {\n return thyAvatarSizeMap[sizeKey];\n } else {\n const size = (this.thySize() as number) * 1;\n return sizeArray.indexOf(size) > -1 ? size : this.findClosestSize(sizeArray, size);\n }\n });\n\n /**\n * 已废弃,请使用 thyRemovable\n * @deprecated\n */\n readonly thyShowRemove = input<boolean, unknown>(false, { transform: coerceBooleanProperty });\n\n /**\n * 是否展示移除按钮\n */\n readonly thyRemovable = input<boolean, unknown>(false, { transform: coerceBooleanProperty });\n\n showRemove: Signal<boolean> = computed(() => this.thyRemovable() || this.thyShowRemove());\n\n /**\n * 图片自定义类\n */\n readonly thyImgClass = input<string>();\n\n /**\n * 是否禁用\n */\n readonly thyDisabled = input<boolean, unknown>(false, { transform: coerceBooleanProperty });\n\n /**\n * 图片加载策略\n * @type eager(立即加载) | lazy(延迟加载)\n */\n readonly thyLoading = input<ThyAvatarLoading>();\n\n /**\n * 图片加载优先级\n * @type auto(默认) | high(高) | low(低)\n */\n readonly thyFetchPriority = input<ThyAvatarFetchPriority>();\n\n private isAvatarImgError: WritableSignal<boolean> = signal(false);\n\n private hostRenderer = useHostRenderer();\n\n constructor() {\n effect(() => {\n this.hostRenderer.updateClass([`thy-avatar-${this.size()}`]);\n });\n }\n\n private findClosestSize(sizeArray: number[], currentSize: number): number {\n let closestValue = sizeArray[0];\n let closestDifference = Math.abs(closestValue - currentSize);\n\n for (let i = 1; i < sizeArray.length; i++) {\n const currentDifference = Math.abs(sizeArray[i] - currentSize);\n if (currentDifference <= closestDifference) {\n closestValue = sizeArray[i];\n closestDifference = currentDifference;\n }\n }\n\n return closestValue;\n }\n\n remove($event: Event) {\n this.thyOnRemove.emit($event);\n this.thyRemove.emit($event);\n }\n\n avatarImgError($event: Event) {\n this.isAvatarImgError.set(true);\n this.thyError.emit($event);\n }\n}\n","@if (src()) {\n <img\n [src]=\"src() | thyAvatarSrc: size()\"\n class=\"avatar-avatar\"\n [ngClass]=\"thyImgClass()\"\n alt=\"{{ avatarName() || '' }}\"\n [attr.loading]=\"thyLoading()\"\n [attr.fetchpriority]=\"thyFetchPriority()\"\n (error)=\"avatarImgError($event)\" />\n} @else {\n <span class=\"avatar-default\" [ngStyle]=\"avatarName() | avatarBgColor\">\n <div>{{ avatarName() | avatarShortName }}</div>\n </span>\n}\n\n@if (thyShowName()) {\n @if (avatarNameSafeHtml()) {\n <div class=\"avatar-name\" [innerHtml]=\"avatarNameSafeHtml()\"></div>\n } @else {\n <div class=\"avatar-name\">{{ avatarName() }}</div>\n }\n}\n\n@if (showRemove()) {\n <a (click)=\"remove($event)\" href=\"javascript:;\" class=\"remove-link avatar-remove\">\n <thy-icon class=\"remove-link-icon\" thyIconName=\"close-circle-bold-fill\"></thy-icon>\n </a>\n}\n@if (thyDisabled()) {\n <div class=\"thy-avatar-disabled\">\n <thy-icon class=\"thy-avatar-disabled-icon\" thyIconName=\"ban\"></thy-icon>\n </div>\n}\n","import { NgTemplateOutlet } from '@angular/common';\nimport { Component, computed, contentChild, effect, input, Signal, TemplateRef, contentChildren } from '@angular/core';\nimport { UpdateHostClassService } from 'ngx-tethys/core';\nimport { SafeAny } from 'ngx-tethys/types';\nimport { DEFAULT_SIZE, ThyAvatar } from '../avatar.component';\n\nexport const THY_AVATAR_ITEM_SPACE = 4;\n\nexport const THY_OVERLAP_AVATAR_ITEM_SPACE = -8;\n\nexport const enum ThyAvatarListMode {\n overlap = 'overlap',\n default = 'default'\n}\n\n/**\n * 头像列表组件\n * @name thy-avatar-list\n * @order 20\n */\n@Component({\n selector: 'thy-avatar-list',\n templateUrl: `./avatar-list.component.html`,\n host: {\n class: 'thy-avatar-list',\n '[class.thy-avatar-list-overlap]': 'isOverlapMode()'\n },\n providers: [UpdateHostClassService],\n imports: [NgTemplateOutlet]\n})\nexport class ThyAvatarList {\n public avatarItems: ThyAvatar[] = [];\n\n /**\n * 展示方式\n * @type overlap | default\n */\n readonly thyMode = input<ThyAvatarListMode>(ThyAvatarListMode.default);\n\n isOverlapMode: Signal<boolean> = computed(() => {\n return this.thyMode() === ThyAvatarListMode.overlap;\n });\n\n /**\n * 头像大小\n * @type 16 | 22 | 24 | 28 | 32 | 36 | 44 | 48 | 68 | 110 | 160 | xxs(22px) | xs(24px) | sm(32px) | md(36px) | lg(48px)\n * @default 36\n */\n readonly thyAvatarSize = input<number | string>(DEFAULT_SIZE);\n\n /**\n * append 自定义操作\n */\n readonly append = contentChild<TemplateRef<SafeAny>>('append');\n\n /**\n * @private\n */\n readonly avatarComponents = contentChildren<ThyAvatar>(ThyAvatar);\n\n constructor() {\n effect(() => {\n this.updateAvatarItems();\n });\n }\n\n private updateAvatarItems() {\n this.avatarItems = Array.from(this.avatarComponents());\n this.avatarItems.forEach((item, index) => {\n item.thySize.set(this.thyAvatarSize());\n item.elementRef.nativeElement.style.zIndex = this.avatarItems.length - index;\n });\n }\n}\n","<ng-content></ng-content>\n\n@if (append()) {\n <div class=\"thy-avatar-append\">\n <ng-container [ngTemplateOutlet]=\"append()\"></ng-container>\n </div>\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ThyAvatar } from './avatar.component';\nimport { AvatarPipes } from './avatar.pipe';\nimport { ThyAvatarService, ThyDefaultAvatarService } from './avatar.service';\nimport { ThyIconModule } from 'ngx-tethys/icon';\nimport { ThyAvatarList } from './avatar-list/avatar-list.component';\n\n@NgModule({\n imports: [CommonModule, ThyIconModule, ThyAvatar, ThyAvatarList, AvatarPipes],\n providers: [\n {\n provide: ThyAvatarService,\n useClass: ThyDefaultAvatarService\n }\n ],\n exports: [ThyAvatar, ThyAvatarList, AvatarPipes]\n})\nexport class ThyAvatarModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.AvatarShortNamePipe","i1.AvatarBgColorPipe","i1.AvatarSrcPipe"],"mappings":";;;;;;;;MAGsB,gBAAgB,CAAA;AAAtC,IAAA,WAAA,GAAA;AACI,QAAA,IAAA,CAAA,oBAAoB,GAAG,CAAC,CAAa,WAAA,CAAA,CAAC;;AAUzC;AAGK,MAAO,uBAAwB,SAAQ,gBAAgB,CAAA;AACzD;;AAEG;IACH,kBAAkB,CAAC,GAAW,EAAE,IAAY,EAAA;AACxC,QAAA,OAAO,GAAG;;IAGd,YAAY,CAAC,GAAW,EAAE,IAAY,EAAA;AAClC,QAAA,OAAO,GAAG;;AAGd,IAAA,aAAa,CAAC,IAAY,EAAA;AACtB,QAAA,OAAO,IAAI;;8GAbN,uBAAuB,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAAvB,uBAAuB,EAAA,CAAA,CAAA;;2FAAvB,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBADnC;;;ACbD;;;AAGG;AACH,MAAM,wBAAwB,GAAG,oBAAoB;AAErD,MAAM,oBAAoB,GAAG,gBAAgB;AAE7C;;AAEG;MAIU,mBAAmB,CAAA;AAC5B,IAAA,SAAS,CAAC,IAA+B,EAAA;QACrC,IAAI,CAAC,IAAI,EAAE;AACP,YAAA,OAAO,EAAE;;AAGb,QAAA,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE;AAElB,QAAA,IAAI,wBAAwB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;YACxD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;;AAGtC,QAAA,IAAI,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A,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,eAAe,EARb,SAAA,EAAA;AACP,YAAA;AACI,gBAAA,OAAO,EAAE,gBAAgB;AACzB,gBAAA,QAAQ,EAAE;AACb;AACJ,SAAA,EAAA,OAAA,EAAA,CANS,YAAY,EAAE,aAAa,EAAE,SAAS,CAAA,EAAA,CAAA,CAAA;;2FASvC,eAAe,EAAA,UAAA,EAAA,CAAA;kBAV3B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACN,OAAO,EAAE,CAAC,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,CAAC;AAC7E,oBAAA,SAAS,EAAE;AACP,wBAAA;AACI,4BAAA,OAAO,EAAE,gBAAgB;AACzB,4BAAA,QAAQ,EAAE;AACb;AACJ,qBAAA;AACD,oBAAA,OAAO,EAAE,CAAC,SAAS,EAAE,aAAa,EAAE,WAAW;AAClD,iBAAA;;;ACjBD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ngx-tethys-avatar.mjs","sources":["../../../src/avatar/avatar.service.ts","../../../src/avatar/avatar.pipe.ts","../../../src/avatar/avatar.component.ts","../../../src/avatar/avatar.component.html","../../../src/avatar/avatar-list/avatar-list.component.ts","../../../src/avatar/avatar-list/avatar-list.component.html","../../../src/avatar/avatar.module.ts","../../../src/avatar/ngx-tethys-avatar.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { SafeHtml } from '@angular/platform-browser';\n\nexport abstract class ThyAvatarService {\n ignoreAvatarSrcPaths = [`default.png`];\n\n /**\n * @deprecated the avatarSrcTransform method will be deprecated, please use srcTransform.\n */\n abstract avatarSrcTransform(src: string, size: number): string;\n\n abstract srcTransform(src: string, size: number): string;\n\n abstract nameTransform(name: string): string | SafeHtml;\n}\n\n@Injectable()\nexport class ThyDefaultAvatarService extends ThyAvatarService {\n /**\n * @deprecated the avatarSrcTransform method will be deprecated, please use srcTransform.\n */\n avatarSrcTransform(src: string, size: number): string {\n return src;\n }\n\n srcTransform(src: string, size: number): string {\n return src;\n }\n\n nameTransform(name: string): string | SafeHtml {\n return name;\n }\n}\n","import { Pipe, PipeTransform, inject } from '@angular/core';\nimport { ThyAvatarService } from './avatar.service';\n\n/**\n * `\\u4e00`: https://www.compart.com/en/unicode/U+4E00\n * `\\u9fa5`: https://www.compart.com/en/unicode/U+9FA5\n */\nconst UNIFIED_IDEOGRAPHS_REGEX = /^[\\u4e00-\\u9fa5]+$/;\n\nconst SET_OF_LETTERS_REGEX = /^[a-zA-Z\\/ ]+$/;\n\n/**\n * @private\n */\n@Pipe({\n name: 'avatarShortName'\n})\nexport class AvatarShortNamePipe implements PipeTransform {\n transform(name: string | null | undefined): string {\n if (!name) {\n return '';\n }\n\n name = name.trim();\n\n if (UNIFIED_IDEOGRAPHS_REGEX.test(name) && name.length > 2) {\n return name.slice(name.length - 2);\n }\n\n if (SET_OF_LETTERS_REGEX.test(name) && name.indexOf(' ') > 0) {\n const words: string[] = name.split(' ');\n return (words[0].slice(0, 1) + words[1].slice(0, 1)).toUpperCase();\n }\n\n return name.length > 2 ? name.slice(0, 2).toUpperCase() : name.toUpperCase();\n }\n}\n\n/**\n * @private\n */\n@Pipe({\n name: 'avatarBgColor'\n})\nexport class AvatarBgColorPipe implements PipeTransform {\n transform(name: string) {\n if (!name) {\n return;\n }\n const colors = ['#56abfb', '#5dcfff', '#84e17e', '#73d897', '#ff9f73', '#fa8888', '#fb7fb7', '#9a7ef4', '#868af6'];\n const nameArray: string[] = name.split('');\n const code: number =\n name && name.length > 0\n ? nameArray.reduce(\n function (result, item) {\n result.value += item.charCodeAt(0);\n return result;\n },\n { value: 0 }\n ).value\n : 0;\n return {\n 'background-color': colors[code % 9]\n };\n }\n}\n\n/**\n * @private\n */\n@Pipe({\n name: 'thyAvatarSrc'\n})\nexport class AvatarSrcPipe implements PipeTransform {\n private thyAvatarService = inject(ThyAvatarService);\n\n transform(src: string, size: number) {\n return this.thyAvatarService.srcTransform\n ? this.thyAvatarService.srcTransform(src, size)\n : this.thyAvatarService.avatarSrcTransform(src, size);\n }\n}\n\nexport const AvatarPipes = [AvatarShortNamePipe, AvatarBgColorPipe, AvatarSrcPipe];\n","import { ChangeDetectionStrategy, Component, ElementRef, EventEmitter, HostBinding, Input, OnInit, Output, inject } from '@angular/core';\nimport { SafeHtml } from '@angular/platform-browser';\nimport { isString, coerceBooleanProperty } from 'ngx-tethys/util';\nimport { useHostRenderer } from '@tethys/cdk/dom';\nimport { ThyAvatarService } from './avatar.service';\nimport { AvatarShortNamePipe, AvatarBgColorPipe, AvatarSrcPipe } from './avatar.pipe';\nimport { ThyIcon } from 'ngx-tethys/icon';\nimport { NgClass, NgStyle } from '@angular/common';\n\nconst sizeArray = [16, 22, 24, 28, 32, 36, 44, 48, 68, 110, 160];\n\nexport const DEFAULT_SIZE = 36;\n\nexport const thyAvatarSizeMap = {\n xxs: 22,\n xs: 24,\n sm: 32,\n md: 36,\n lg: 48\n};\n\n/** https://html.spec.whatwg.org/multipage/embedded-content.html#attr-img-loading */\nexport type ThyAvatarLoading = 'eager' | 'lazy';\n\n/** https://wicg.github.io/priority-hints/#idl-index */\nexport type ThyAvatarFetchPriority = 'high' | 'low' | 'auto';\n\n/**\n * 头像组件\n * @name thy-avatar\n * @order 10\n */\n@Component({\n selector: 'thy-avatar',\n templateUrl: './avatar.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [NgClass, NgStyle, ThyIcon, AvatarShortNamePipe, AvatarBgColorPipe, AvatarSrcPipe]\n})\nexport class ThyAvatar implements OnInit {\n private thyAvatarService = inject(ThyAvatarService);\n elementRef = inject(ElementRef);\n\n _src: string;\n _name: string;\n _size: number;\n _showRemove = false;\n\n public avatarSrc: string;\n public avatarName?: string;\n public avatarNameSafeHtml?: SafeHtml;\n\n @HostBinding('class.thy-avatar') _isAvatar = true;\n\n /**\n * * 已废弃,请使用 thyRemove\n * @deprecated\n */\n @Output() thyOnRemove = new EventEmitter();\n\n /**\n * 移除按钮的事件, 当 thyRemovable 为 true 时起作用\n */\n @Output() thyRemove = new EventEmitter();\n\n /**\n * 头像 img 加载 error 时触发\n */\n @Output() thyError: EventEmitter<Event> = new EventEmitter<Event>();\n\n /**\n * 是否展示人员名称\n * @default false\n */\n @Input({ transform: coerceBooleanProperty }) thyShowName: boolean;\n\n /**\n * 头像路径地址, 默认为全路径,如果不是全路径,可以通过自定义服务 ThyAvatarService,重写 srcTransform 方法实现转换\n *\n */\n @Input()\n set thySrc(value: string) {\n this._setAvatarSrc(value);\n }\n\n /**\n * 人员名称(可设置自定义名称,需通过自定义服务 ThyAvatarService,重写 nameTransform 方法去实现转换)\n */\n @Input()\n set thyName(value: string) {\n // this._name = value;\n this._setAvatarName(value);\n }\n\n /**\n * 头像大小\n * @type 16 | 22 | 24 | 28 | 32 | 36 | 44 | 48 | 68 | 110 | 160 | xxs(22px) | xs(24px) | sm(32px) | md(36px) | lg(48px)\n * @default md\n */\n @Input()\n set thySize(value: number | string) {\n if (thyAvatarSizeMap[value]) {\n this._setAvatarSize(thyAvatarSizeMap[value]);\n } else {\n this._setAvatarSize((value as number) * 1);\n }\n }\n\n /**\n * 已废弃,请使用 thyRemovable\n * @deprecated\n * @default false\n */\n @Input({ transform: coerceBooleanProperty })\n set thyShowRemove(value: boolean) {\n this._showRemove = value;\n }\n\n /**\n * 是否展示移除按钮\n * @default false\n */\n @Input({ transform: coerceBooleanProperty })\n set thyRemovable(value: boolean) {\n this._showRemove = value;\n }\n\n /**\n * 图片自定义类\n */\n @Input() thyImgClass: string;\n\n /**\n * 是否禁用\n * @default false\n */\n @Input({ transform: coerceBooleanProperty }) thyDisabled: boolean;\n\n /**\n * 图片加载策略\n * @type eager(立即加载) | lazy(延迟加载)\n */\n @Input() thyLoading?: ThyAvatarLoading;\n\n /**\n * 图片加载优先级\n * @type auto(默认) | high(高) | low(低)\n */\n @Input() thyFetchPriority?: ThyAvatarFetchPriority;\n\n private _setAvatarSize(size: number) {\n if (sizeArray.indexOf(size) > -1) {\n this._size = size;\n } else {\n this._size = this.findClosestSize(sizeArray, size);\n }\n this.hostRenderer.updateClass([`thy-avatar-${this._size}`]);\n }\n\n private findClosestSize(sizeArray: number[], currentSize: number): number {\n let closestValue = sizeArray[0];\n let closestDifference = Math.abs(closestValue - currentSize);\n\n for (let i = 1; i < sizeArray.length; i++) {\n const currentDifference = Math.abs(sizeArray[i] - currentSize);\n if (currentDifference <= closestDifference) {\n closestValue = sizeArray[i];\n closestDifference = currentDifference;\n }\n }\n\n return closestValue;\n }\n\n private _setAvatarSrc(src: string) {\n if (src && this.thyAvatarService.ignoreAvatarSrcPaths.indexOf(src) < 0) {\n this._src = src;\n } else {\n this._src = null;\n }\n }\n\n private _setAvatarName(value: string) {\n const name = this.thyAvatarService.nameTransform(value);\n if (isString(name)) {\n this.avatarName = name as string;\n } else {\n this.avatarName = value;\n this.avatarNameSafeHtml = name;\n }\n }\n\n private hostRenderer = useHostRenderer();\n\n ngOnInit() {\n if (!this._size) {\n this._setAvatarSize(DEFAULT_SIZE);\n }\n this.hostRenderer.updateClass([`thy-avatar-${this._size}`]);\n }\n\n remove($event: Event) {\n this.thyOnRemove.emit($event);\n this.thyRemove.emit($event);\n }\n\n avatarImgError($event: Event) {\n this._setAvatarSrc(null);\n this.thyError.emit($event);\n }\n}\n","@if (_src) {\n <img\n [src]=\"_src | thyAvatarSrc: _size\"\n class=\"avatar-avatar\"\n [ngClass]=\"thyImgClass\"\n alt=\"{{ avatarName || '' }}\"\n [attr.loading]=\"thyLoading\"\n [attr.fetchpriority]=\"thyFetchPriority\"\n (error)=\"avatarImgError($event)\"\n />\n} @else {\n <span class=\"avatar-default\" [ngStyle]=\"avatarName | avatarBgColor\">\n <div>{{ avatarName | avatarShortName }}</div>\n </span>\n}\n\n\n@if (thyShowName) {\n @if (avatarNameSafeHtml) {\n <div class=\"avatar-name\" [innerHtml]=\"avatarNameSafeHtml\"></div>\n } @else {\n <div class=\"avatar-name\">{{ avatarName }}</div>\n }\n}\n\n@if (_showRemove) {\n <a (click)=\"remove($event)\" href=\"javascript:;\" class=\"remove-link avatar-remove\">\n <thy-icon class=\"remove-link-icon\" thyIconName=\"close-circle-bold-fill\"></thy-icon>\n </a>\n}\n@if (thyDisabled) {\n <div class=\"thy-avatar-disabled\">\n <thy-icon class=\"thy-avatar-disabled-icon\" thyIconName=\"ban\"></thy-icon>\n </div>\n}\n","import { NgClass, NgStyle, NgTemplateOutlet } from '@angular/common';\nimport {\n AfterContentInit,\n Component,\n ContentChild,\n ContentChildren,\n HostBinding,\n Input,\n OnChanges,\n OnDestroy,\n QueryList,\n SimpleChanges,\n TemplateRef\n} from '@angular/core';\nimport { UpdateHostClassService } from 'ngx-tethys/core';\nimport { SafeAny } from 'ngx-tethys/types';\nimport { Subject } from 'rxjs';\nimport { DEFAULT_SIZE, ThyAvatar } from '../avatar.component';\nimport { takeUntil, startWith } from 'rxjs/operators';\n\nexport const THY_AVATAR_ITEM_SPACE = 4;\n\nexport const THY_OVERLAP_AVATAR_ITEM_SPACE = -8;\n\nexport const enum ThyAvatarListMode {\n overlap = 'overlap',\n default = 'default'\n}\n\n/**\n * 头像列表组件\n * @name thy-avatar-list\n * @order 20\n */\n@Component({\n selector: 'thy-avatar-list',\n templateUrl: `./avatar-list.component.html`,\n host: {\n class: 'thy-avatar-list'\n },\n providers: [UpdateHostClassService],\n imports: [NgTemplateOutlet]\n})\nexport class ThyAvatarList implements OnChanges, OnDestroy, AfterContentInit {\n @HostBinding('class.thy-avatar-list-overlap') overlapMode = false;\n\n public avatarItems: ThyAvatar[] = [];\n\n private ngUnsubscribe$ = new Subject<void>();\n\n /**\n * 展示方式\n * @type overlap | default\n * @default default\n */\n @Input() thyMode: ThyAvatarListMode;\n\n /**\n * 头像大小\n * @type 16 | 22 | 24 | 28 | 32 | 36 | 44 | 48 | 68 | 110 | 160 | xxs(22px) | xs(24px) | sm(32px) | md(36px) | lg(48px)\n * @default 36\n */\n @Input() thyAvatarSize: number | string = DEFAULT_SIZE;\n\n /**\n * append 自定义操作\n */\n @ContentChild('append', { static: false }) append: TemplateRef<SafeAny>;\n\n /**\n * @private\n */\n @ContentChildren(ThyAvatar) avatarComponents: QueryList<ThyAvatar>;\n\n constructor() {}\n\n ngOnChanges(changes: SimpleChanges) {\n if (changes.thyAvatarSize && !changes.thyAvatarSize.firstChange) {\n this.updateAvatarItems();\n }\n if (changes.thyMode) {\n this.overlapMode = changes.thyMode.currentValue === ThyAvatarListMode.overlap;\n if (!changes.thyMode.firstChange) {\n this.updateAvatarItems();\n }\n }\n }\n\n ngAfterContentInit() {\n this.avatarComponents.changes.pipe(startWith(this.avatarComponents), takeUntil(this.ngUnsubscribe$)).subscribe(() => {\n this.updateAvatarItems();\n });\n }\n\n private updateAvatarItems() {\n this.avatarItems = this.avatarComponents.toArray();\n this.avatarItems.forEach((item, index) => {\n item.thySize = this.thyAvatarSize;\n item.elementRef.nativeElement.style.zIndex = this.avatarItems.length - index;\n });\n }\n\n ngOnDestroy() {\n this.ngUnsubscribe$.next();\n this.ngUnsubscribe$.complete();\n }\n}\n","<ng-content></ng-content>\n\n@if (append) {\n <div class=\"thy-avatar-append\">\n <ng-container [ngTemplateOutlet]=\"append\"></ng-container>\n </div>\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ThyAvatar } from './avatar.component';\nimport { AvatarPipes } from './avatar.pipe';\nimport { ThyAvatarService, ThyDefaultAvatarService } from './avatar.service';\nimport { ThyIconModule } from 'ngx-tethys/icon';\nimport { ThyAvatarList } from './avatar-list/avatar-list.component';\n\n@NgModule({\n imports: [CommonModule, ThyIconModule, ThyAvatar, ThyAvatarList, AvatarPipes],\n providers: [\n {\n provide: ThyAvatarService,\n useClass: ThyDefaultAvatarService\n }\n ],\n exports: [ThyAvatar, ThyAvatarList, AvatarPipes]\n})\nexport class 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F,mBAAA,EAAAC,iBAAA,EAAAC,aAAA,CAAA,EAAA,CAAA,CAAA;AAEzB,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,EARb,SAAA,EAAA;AACP,YAAA;AACI,gBAAA,OAAO,EAAE,gBAAgB;AACzB,gBAAA,QAAQ,EAAE;AACb;AACJ,SAAA,EAAA,OAAA,EAAA,CANS,YAAY,EAAE,aAAa,EAAE,SAAS,CAAA,EAAA,CAAA,CAAA;;2FASvC,eAAe,EAAA,UAAA,EAAA,CAAA;kBAV3B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACN,OAAO,EAAE,CAAC,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,CAAC;AAC7E,oBAAA,SAAS,EAAE;AACP,wBAAA;AACI,4BAAA,OAAO,EAAE,gBAAgB;AACzB,4BAAA,QAAQ,EAAE;AACb;AACJ,qBAAA;AACD,oBAAA,OAAO,EAAE,CAAC,SAAS,EAAE,aAAa,EAAE,WAAW;AAClD,iBAAA;;;ACjBD;;AAEG;;;;"}
|
|
@@ -15,7 +15,7 @@ class ThyComment {
|
|
|
15
15
|
this.isTemplateRef = isTemplateRef;
|
|
16
16
|
}
|
|
17
17
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyComment, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
18
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyComment, isStandalone: true, selector: "thy-comment", inputs: { thyAuthor: "thyAuthor", thyDatetime: "thyDatetime", thyAvatar: "thyAvatar" }, host: { classAttribute: "thy-comment" }, ngImport: i0, template: "<div class=\"thy-comment-inner\">\n @if (isTemplateRef(this.thyAvatar)) {\n <ng-template [ngTemplateOutlet]=\"thyAvatar\"></ng-template>\n } @else {\n @if (thyAuthor || thyAvatar) {\n <div class=\"thy-comment-avatar\">\n <thy-avatar [thyName]=\"!isTemplateRef(thyAuthor) && thyAuthor\" thySize=\"28\" [thySrc]=\"thyAvatar || ''\"></thy-avatar>\n </div>\n }\n }\n\n <div class=\"thy-comment-body\">\n <div class=\"thy-comment-body-author\">\n <span class=\"thy-comment-body-author-name\">\n <ng-container *thyStringOrTemplateOutlet=\"thyAuthor\"></ng-container>\n </span>\n <span class=\"thy-comment-body-author-time\">\n <ng-container *thyStringOrTemplateOutlet=\"thyDatetime\"></ng-container>\n </span>\n </div>\n <ng-content select=\"[thyCommentContent]\"></ng-content>\n </div>\n <ng-content select=\"[thyCommentActions]\"></ng-content>\n</div>\n<div class=\"thy-comment-nested\">\n <ng-content></ng-content>\n</div>\n\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: ThyStringOrTemplateOutletDirective, selector: "[thyStringOrTemplateOutlet]", inputs: ["thyStringOrTemplateOutletContext", "thyStringOrTemplateOutlet"], exportAs: ["thyStringOrTemplateOutlet"] }, { kind: "component", type: ThyAvatar, selector: "thy-avatar", inputs: ["thyShowName", "thySrc", "thyName", "thySize", "thyShowRemove", "thyRemovable", "thyImgClass", "thyDisabled", "thyLoading", "thyFetchPriority"], outputs: ["thyOnRemove", "thyRemove", "thyError"
|
|
18
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyComment, isStandalone: true, selector: "thy-comment", inputs: { thyAuthor: "thyAuthor", thyDatetime: "thyDatetime", thyAvatar: "thyAvatar" }, host: { classAttribute: "thy-comment" }, ngImport: i0, template: "<div class=\"thy-comment-inner\">\n @if (isTemplateRef(this.thyAvatar)) {\n <ng-template [ngTemplateOutlet]=\"thyAvatar\"></ng-template>\n } @else {\n @if (thyAuthor || thyAvatar) {\n <div class=\"thy-comment-avatar\">\n <thy-avatar [thyName]=\"!isTemplateRef(thyAuthor) && thyAuthor\" thySize=\"28\" [thySrc]=\"thyAvatar || ''\"></thy-avatar>\n </div>\n }\n }\n\n <div class=\"thy-comment-body\">\n <div class=\"thy-comment-body-author\">\n <span class=\"thy-comment-body-author-name\">\n <ng-container *thyStringOrTemplateOutlet=\"thyAuthor\"></ng-container>\n </span>\n <span class=\"thy-comment-body-author-time\">\n <ng-container *thyStringOrTemplateOutlet=\"thyDatetime\"></ng-container>\n </span>\n </div>\n <ng-content select=\"[thyCommentContent]\"></ng-content>\n </div>\n <ng-content select=\"[thyCommentActions]\"></ng-content>\n</div>\n<div class=\"thy-comment-nested\">\n <ng-content></ng-content>\n</div>\n\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: ThyStringOrTemplateOutletDirective, selector: "[thyStringOrTemplateOutlet]", inputs: ["thyStringOrTemplateOutletContext", "thyStringOrTemplateOutlet"], exportAs: ["thyStringOrTemplateOutlet"] }, { kind: "component", type: ThyAvatar, selector: "thy-avatar", inputs: ["thyShowName", "thySrc", "thyName", "thySize", "thyShowRemove", "thyRemovable", "thyImgClass", "thyDisabled", "thyLoading", "thyFetchPriority"], outputs: ["thyOnRemove", "thyRemove", "thyError"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
19
19
|
}
|
|
20
20
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyComment, decorators: [{
|
|
21
21
|
type: Component,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngx-tethys-comment.mjs","sources":["../../../src/comment/comment.component.ts","../../../src/comment/comment.component.html","../../../src/comment/comment-content.directive.ts","../../../src/comment/comment-actions.directive.ts","../../../src/comment/comment.module.ts","../../../src/comment/ngx-tethys-comment.ts"],"sourcesContent":["import { isTemplateRef } from 'ngx-tethys/util';\nimport { SafeAny } from 'ngx-tethys/types';\nimport { ChangeDetectionStrategy, Component, Input, TemplateRef } from '@angular/core';\nimport { ThyAvatar } from 'ngx-tethys/avatar';\nimport { ThyStringOrTemplateOutletDirective } from 'ngx-tethys/shared';\nimport { NgTemplateOutlet } from '@angular/common';\n\n/**\n * 评论组件\n * @name thy-comment\n */\n@Component({\n selector: 'thy-comment',\n templateUrl: './comment.component.html',\n host: {\n class: 'thy-comment'\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [NgTemplateOutlet, ThyStringOrTemplateOutletDirective, ThyAvatar]\n})\nexport class ThyComment {\n /**\n * 展示评论作者\n */\n @Input() thyAuthor?: string | TemplateRef<SafeAny>;\n\n /**\n * 展示评论时间\n */\n @Input() thyDatetime?: string | TemplateRef<SafeAny>;\n\n /**\n * 展示评论作者头像\n */\n @Input() thyAvatar?: string | TemplateRef<SafeAny>;\n\n isTemplateRef = isTemplateRef;\n}\n","<div class=\"thy-comment-inner\">\n @if (isTemplateRef(this.thyAvatar)) {\n <ng-template [ngTemplateOutlet]=\"thyAvatar\"></ng-template>\n } @else {\n @if (thyAuthor || thyAvatar) {\n <div class=\"thy-comment-avatar\">\n <thy-avatar [thyName]=\"!isTemplateRef(thyAuthor) && thyAuthor\" thySize=\"28\" [thySrc]=\"thyAvatar || ''\"></thy-avatar>\n </div>\n }\n }\n\n <div class=\"thy-comment-body\">\n <div class=\"thy-comment-body-author\">\n <span class=\"thy-comment-body-author-name\">\n <ng-container *thyStringOrTemplateOutlet=\"thyAuthor\"></ng-container>\n </span>\n <span class=\"thy-comment-body-author-time\">\n <ng-container *thyStringOrTemplateOutlet=\"thyDatetime\"></ng-container>\n </span>\n </div>\n <ng-content select=\"[thyCommentContent]\"></ng-content>\n </div>\n <ng-content select=\"[thyCommentActions]\"></ng-content>\n</div>\n<div class=\"thy-comment-nested\">\n <ng-content></ng-content>\n</div>\n\n","import { Directive } from '@angular/core';\n\n/**\n * @private\n */\n@Directive({\n selector: '[thyCommentContent]',\n exportAs: 'thyCommentContent',\n host: { class: 'thy-comment-content' }\n})\nexport class ThyCommentContentDirective {}\n","import { Directive } from '@angular/core';\n\n/**\n * @private\n */\n@Directive({\n selector: '[thyCommentActions]',\n exportAs: 'thyCommentActions',\n host: { class: 'thy-comment-actions' }\n})\nexport class ThyCommentActionsDirective {}\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { ThySharedModule } from 'ngx-tethys/shared';\nimport { ThyComment } from './comment.component';\nimport { ThyIconModule } from 'ngx-tethys/icon';\nimport { ThyAvatarModule } from 'ngx-tethys/avatar';\nimport { ThyCommentContentDirective } from './comment-content.directive';\nimport { ThyCommentActionsDirective } from './comment-actions.directive';\n@NgModule({\n imports: [\n CommonModule,\n ThySharedModule,\n ThyIconModule,\n ThyAvatarModule,\n ThyComment,\n ThyCommentContentDirective,\n ThyCommentActionsDirective\n ],\n exports: [ThyComment, ThyCommentContentDirective, ThyCommentActionsDirective],\n providers: []\n})\nexport class ThyCommentModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAOA;;;AAGG;MAUU,UAAU,CAAA;AATvB,IAAA,WAAA,GAAA;QAyBI,IAAa,CAAA,aAAA,GAAG,aAAa;AAChC;8GAjBY,UAAU,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;AAAV,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAU,wMCpBvB,y+BA4BA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EDVc,gBAAgB,EAAE,QAAA,EAAA,oBAAA,EAAA,MAAA,EAAA,CAAA,yBAAA,EAAA,kBAAA,EAAA,0BAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAAA,kCAAkC,4LAAE,SAAS,EAAA,QAAA,EAAA,YAAA,EAAA,MAAA,EAAA,CAAA,aAAA,EAAA,QAAA,EAAA,SAAA,EAAA,SAAA,EAAA,eAAA,EAAA,cAAA,EAAA,aAAA,EAAA,aAAA,EAAA,YAAA,EAAA,kBAAA,CAAA,EAAA,OAAA,EAAA,CAAA,aAAA,EAAA,WAAA,EAAA,UAAA,
|
|
1
|
+
{"version":3,"file":"ngx-tethys-comment.mjs","sources":["../../../src/comment/comment.component.ts","../../../src/comment/comment.component.html","../../../src/comment/comment-content.directive.ts","../../../src/comment/comment-actions.directive.ts","../../../src/comment/comment.module.ts","../../../src/comment/ngx-tethys-comment.ts"],"sourcesContent":["import { isTemplateRef } from 'ngx-tethys/util';\nimport { SafeAny } from 'ngx-tethys/types';\nimport { ChangeDetectionStrategy, Component, Input, TemplateRef } from '@angular/core';\nimport { ThyAvatar } from 'ngx-tethys/avatar';\nimport { ThyStringOrTemplateOutletDirective } from 'ngx-tethys/shared';\nimport { NgTemplateOutlet } from '@angular/common';\n\n/**\n * 评论组件\n * @name thy-comment\n */\n@Component({\n selector: 'thy-comment',\n templateUrl: './comment.component.html',\n host: {\n class: 'thy-comment'\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [NgTemplateOutlet, ThyStringOrTemplateOutletDirective, ThyAvatar]\n})\nexport class ThyComment {\n /**\n * 展示评论作者\n */\n @Input() thyAuthor?: string | TemplateRef<SafeAny>;\n\n /**\n * 展示评论时间\n */\n @Input() thyDatetime?: string | TemplateRef<SafeAny>;\n\n /**\n * 展示评论作者头像\n */\n @Input() thyAvatar?: string | TemplateRef<SafeAny>;\n\n isTemplateRef = isTemplateRef;\n}\n","<div class=\"thy-comment-inner\">\n @if (isTemplateRef(this.thyAvatar)) {\n <ng-template [ngTemplateOutlet]=\"thyAvatar\"></ng-template>\n } @else {\n @if (thyAuthor || thyAvatar) {\n <div class=\"thy-comment-avatar\">\n <thy-avatar [thyName]=\"!isTemplateRef(thyAuthor) && thyAuthor\" thySize=\"28\" [thySrc]=\"thyAvatar || ''\"></thy-avatar>\n </div>\n }\n }\n\n <div class=\"thy-comment-body\">\n <div class=\"thy-comment-body-author\">\n <span class=\"thy-comment-body-author-name\">\n <ng-container *thyStringOrTemplateOutlet=\"thyAuthor\"></ng-container>\n </span>\n <span class=\"thy-comment-body-author-time\">\n <ng-container *thyStringOrTemplateOutlet=\"thyDatetime\"></ng-container>\n </span>\n </div>\n <ng-content select=\"[thyCommentContent]\"></ng-content>\n </div>\n <ng-content select=\"[thyCommentActions]\"></ng-content>\n</div>\n<div class=\"thy-comment-nested\">\n <ng-content></ng-content>\n</div>\n\n","import { Directive } from '@angular/core';\n\n/**\n * @private\n */\n@Directive({\n selector: '[thyCommentContent]',\n exportAs: 'thyCommentContent',\n host: { class: 'thy-comment-content' }\n})\nexport class ThyCommentContentDirective {}\n","import { Directive } from '@angular/core';\n\n/**\n * @private\n */\n@Directive({\n selector: '[thyCommentActions]',\n exportAs: 'thyCommentActions',\n host: { class: 'thy-comment-actions' }\n})\nexport class ThyCommentActionsDirective {}\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { ThySharedModule } from 'ngx-tethys/shared';\nimport { ThyComment } from './comment.component';\nimport { ThyIconModule } from 'ngx-tethys/icon';\nimport { ThyAvatarModule } from 'ngx-tethys/avatar';\nimport { ThyCommentContentDirective } from './comment-content.directive';\nimport { ThyCommentActionsDirective } from './comment-actions.directive';\n@NgModule({\n imports: [\n CommonModule,\n ThySharedModule,\n ThyIconModule,\n ThyAvatarModule,\n ThyComment,\n ThyCommentContentDirective,\n ThyCommentActionsDirective\n ],\n exports: [ThyComment, ThyCommentContentDirective, ThyCommentActionsDirective],\n providers: []\n})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= i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyListItemMeta, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
464
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyListItemMeta, isStandalone: true, selector: "thy-list-item-meta,[thy-list-item-meta]", inputs: { thyAvatar: "thyAvatar", thyTitle: "thyTitle", thyDescription: "thyDescription" }, host: { properties: { "class": "this.className" } }, queries: [{ propertyName: "avatarTemplateRef", first: true, predicate: ["metaAvatar"], descendants: true }, { propertyName: "titleTemplateRef", first: true, predicate: ["metaTitle"], descendants: true }, { propertyName: "descriptionTemplateRef", first: true, predicate: ["metaDescription"], descendants: true }], ngImport: i0, template: "<div class=\"thy-list-item-meta-avatar\">\n @if (thyAvatar) {\n <thy-avatar [thySrc]=\"thyAvatar\"></thy-avatar>\n } @else {\n <ng-template [ngTemplateOutlet]=\"avatarTemplateRef\"></ng-template>\n }\n</div>\n<div class=\"thy-list-item-meta-content\">\n <div class=\"thy-list-item-meta-title\">\n @if (thyTitle) {\n {{ thyTitle }}\n } @else {\n <ng-template [ngTemplateOutlet]=\"titleTemplateRef\"></ng-template>\n }\n </div>\n <div class=\"thy-list-item-meta-description\">\n @if (thyDescription) {\n {{ thyDescription }}\n } @else {\n <ng-template [ngTemplateOutlet]=\"descriptionTemplateRef\"></ng-template>\n }\n </div>\n</div>\n", dependencies: [{ kind: "component", type: ThyAvatar, selector: "thy-avatar", inputs: ["thyShowName", "thySrc", "thyName", "thySize", "thyShowRemove", "thyRemovable", "thyImgClass", "thyDisabled", "thyLoading", "thyFetchPriority"], outputs: ["thyOnRemove", "thyRemove", "thyError"
|
|
464
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyListItemMeta, isStandalone: true, selector: "thy-list-item-meta,[thy-list-item-meta]", inputs: { thyAvatar: "thyAvatar", thyTitle: "thyTitle", thyDescription: "thyDescription" }, host: { properties: { "class": "this.className" } }, queries: [{ propertyName: "avatarTemplateRef", first: true, predicate: ["metaAvatar"], descendants: true }, { propertyName: "titleTemplateRef", first: true, predicate: ["metaTitle"], descendants: true }, { propertyName: "descriptionTemplateRef", first: true, predicate: ["metaDescription"], descendants: true }], ngImport: i0, template: "<div class=\"thy-list-item-meta-avatar\">\n @if (thyAvatar) {\n <thy-avatar [thySrc]=\"thyAvatar\"></thy-avatar>\n } @else {\n <ng-template [ngTemplateOutlet]=\"avatarTemplateRef\"></ng-template>\n }\n</div>\n<div class=\"thy-list-item-meta-content\">\n <div class=\"thy-list-item-meta-title\">\n @if (thyTitle) {\n {{ thyTitle }}\n } @else {\n <ng-template [ngTemplateOutlet]=\"titleTemplateRef\"></ng-template>\n }\n </div>\n <div class=\"thy-list-item-meta-description\">\n @if (thyDescription) {\n {{ thyDescription }}\n } @else {\n <ng-template [ngTemplateOutlet]=\"descriptionTemplateRef\"></ng-template>\n }\n </div>\n</div>\n", dependencies: [{ kind: "component", type: ThyAvatar, selector: "thy-avatar", inputs: ["thyShowName", "thySrc", "thyName", "thySize", "thyShowRemove", "thyRemovable", "thyImgClass", "thyDisabled", "thyLoading", "thyFetchPriority"], outputs: ["thyOnRemove", "thyRemove", "thyError"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
465
465
|
}
|
|
466
466
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyListItemMeta, decorators: [{
|
|
467
467
|
type: Component,
|