@libs-ui/services-notification 0.2.357-7 → 0.2.357-9
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/README.md +12 -28
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -280,27 +280,20 @@ export class PushSetupComponent {
|
|
|
280
280
|
|
|
281
281
|
## Types & Interfaces
|
|
282
282
|
|
|
283
|
-
|
|
284
|
-
import {
|
|
285
|
-
INotificationTextPublicConfig,
|
|
286
|
-
INotificationTextConfig,
|
|
287
|
-
INotificationQueue,
|
|
288
|
-
INotificationPushFromIFrame,
|
|
289
|
-
} from '@libs-ui/services-notification';
|
|
290
|
-
```
|
|
283
|
+
⚠️ Các interface dưới đây **KHÔNG được export** từ `@libs-ui/services-notification` (package chỉ export `LibsUiNotificationService`). Tham khảo shape để biết cấu trúc tham số — khi cần type tường minh trong code, tự khai báo `type` cục bộ tương ứng.
|
|
291
284
|
|
|
292
|
-
### INotificationTextPublicConfig
|
|
293
|
-
|
|
294
|
-
Config truyền vào các method `showCompTypeText*()`:
|
|
285
|
+
### Config truyền vào `showCompTypeText*()` (tương đương `INotificationTextPublicConfig`)
|
|
295
286
|
|
|
296
287
|
```typescript
|
|
288
|
+
// Không import được — đây là shape tham khảo của tham số config
|
|
297
289
|
interface INotificationTextPublicConfig {
|
|
290
|
+
interpolateParams?: Record<string, any>; // Params ngx-translate (tự động escaped)
|
|
298
291
|
title?: string; // Tiêu đề hiển thị trên toast
|
|
299
|
-
timeRemove?: number; // ms — tự động đóng (default: 3000)
|
|
300
292
|
positionRight?: number; // px từ phải màn hình (default: 12)
|
|
293
|
+
zIndex?: number; // CSS z-index
|
|
294
|
+
timeRemove?: number; // ms — tự động đóng (default: 3000)
|
|
301
295
|
eventName?: 'click' | 'mouseenter'; // Event trigger callback
|
|
302
296
|
callback?: () => void; // Hàm gọi khi user tương tác
|
|
303
|
-
interpolateParams?: Record<string, any>; // Params ngx-translate (tự động escaped)
|
|
304
297
|
}
|
|
305
298
|
```
|
|
306
299
|
|
|
@@ -309,28 +302,25 @@ interface INotificationTextPublicConfig {
|
|
|
309
302
|
| `title` | `string` | `undefined` | Tiêu đề hiển thị phía trên message trong toast | `title: 'Thành công'` |
|
|
310
303
|
| `timeRemove` | `number` (ms) | `3000` | Thời gian tự động đóng tính bằng milliseconds | `timeRemove: 5000` |
|
|
311
304
|
| `positionRight` | `number` (px) | `12` | Khoảng cách từ phải màn hình tính bằng pixel | `positionRight: 24` |
|
|
305
|
+
| `zIndex` | `number` | `undefined` | CSS z-index của toast | `zIndex: 3000` |
|
|
312
306
|
| `eventName` | `'click' \| 'mouseenter'` | `undefined` | Event DOM sẽ trigger `callback` | `eventName: 'click'` |
|
|
313
307
|
| `callback` | `() => void` | `undefined` | Hàm gọi khi user thực hiện event tương ứng | `callback: () => router.navigate(['/'])` |
|
|
314
308
|
| `interpolateParams` | `Record<string, any>` | `undefined` | Params truyền vào ngx-translate interpolation, tự động escape HTML | `interpolateParams: { name: 'An' }` |
|
|
315
309
|
|
|
316
|
-
###
|
|
317
|
-
|
|
318
|
-
Config nội bộ dùng khi tạo component động — thường không dùng trực tiếp:
|
|
310
|
+
### Config nội bộ (Internal — không export, dùng khi tạo component động)
|
|
319
311
|
|
|
320
312
|
```typescript
|
|
321
313
|
interface INotificationTextConfig {
|
|
322
314
|
type: 'success' | 'info' | 'error' | 'warn'; // Kiểu toast
|
|
323
|
-
timeRemove: number; // ms
|
|
324
315
|
positionRight?: number; // px
|
|
325
|
-
zIndex?: number; // CSS z-index
|
|
316
|
+
zIndex?: number; // CSS z-index
|
|
317
|
+
timeRemove: number; // ms
|
|
326
318
|
eventName?: 'click' | 'mouseenter';
|
|
327
319
|
callback?: () => void;
|
|
328
320
|
}
|
|
329
321
|
```
|
|
330
322
|
|
|
331
|
-
###
|
|
332
|
-
|
|
333
|
-
Payload nhận từ child iFrame qua PostMessage:
|
|
323
|
+
### Payload từ child iFrame (Internal — không export)
|
|
334
324
|
|
|
335
325
|
```typescript
|
|
336
326
|
interface INotificationPushFromIFrame {
|
|
@@ -355,10 +345,4 @@ interface INotificationPushFromIFrame {
|
|
|
355
345
|
|
|
356
346
|
⚠️ **Dynamic stacking dùng getBoundingClientRect()**: Vị trí top/right của các toast được tính lại sau mỗi add/remove thông qua `setTimeout` để đảm bảo DOM đã render. Tránh can thiệp vào style inline `top`/`right` của các element toast từ bên ngoài.
|
|
357
347
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
```bash
|
|
361
|
-
npx nx serve core-ui
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
Truy cập: http://localhost:4500/services/notification
|
|
348
|
+
⚠️ **Interfaces config KHÔNG export**: `INotificationTextPublicConfig` và các interface khác không nằm trong public API của package. Khi gọi `showCompTypeTextSuccess(message, { ... })`, TypeScript tự suy luận type từ object literal — không cần (và không thể) import type tường minh.
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libs-ui/services-notification",
|
|
3
|
-
"version": "0.2.357-
|
|
3
|
+
"version": "0.2.357-9",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@angular/core": ">=18.0.0",
|
|
6
6
|
"rxjs": "~7.8.0",
|
|
7
7
|
"@ngx-translate/core": "^15.0.0",
|
|
8
|
-
"@libs-ui/services-dynamic-component": "0.2.357-
|
|
9
|
-
"@libs-ui/utils": "0.2.357-
|
|
8
|
+
"@libs-ui/services-dynamic-component": "0.2.357-9",
|
|
9
|
+
"@libs-ui/utils": "0.2.357-9"
|
|
10
10
|
},
|
|
11
11
|
"sideEffects": false,
|
|
12
12
|
"module": "fesm2022/libs-ui-services-notification.mjs",
|