@libs-ui/components-card 0.2.357-8 → 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 +9 -19
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -99,8 +99,8 @@ import { LibsUiComponentsCardComponent } from '@libs-ui/components-card';
|
|
|
99
99
|
export class ExampleComponent {
|
|
100
100
|
protected isCardHidden = signal<boolean>(false);
|
|
101
101
|
|
|
102
|
-
protected handlerChangeState(
|
|
103
|
-
|
|
102
|
+
protected handlerChangeState(isHidden: boolean): void {
|
|
103
|
+
console.log('Card is now:', isHidden ? 'hidden' : 'visible');
|
|
104
104
|
// isHidden signal đã được cập nhật tự động qua two-way binding
|
|
105
105
|
}
|
|
106
106
|
}
|
|
@@ -172,9 +172,8 @@ export class ExampleComponent {
|
|
|
172
172
|
private cardControls = signal<IFunctionControlCard | null>(null);
|
|
173
173
|
protected isCardHidden = signal<boolean>(false);
|
|
174
174
|
|
|
175
|
-
protected handlerReceiveFunctionsControl(
|
|
176
|
-
|
|
177
|
-
this.cardControls.set(event as unknown as IFunctionControlCard);
|
|
175
|
+
protected handlerReceiveFunctionsControl(controls: IFunctionControlCard): void {
|
|
176
|
+
this.cardControls.set(controls);
|
|
178
177
|
}
|
|
179
178
|
|
|
180
179
|
protected handlerToggleCard(event: Event): void {
|
|
@@ -182,14 +181,13 @@ export class ExampleComponent {
|
|
|
182
181
|
this.cardControls()?.changeHidden();
|
|
183
182
|
}
|
|
184
183
|
|
|
185
|
-
protected handlerChangeState(
|
|
186
|
-
|
|
187
|
-
this.isCardHidden.set(event as unknown as boolean);
|
|
184
|
+
protected handlerChangeState(isHidden: boolean): void {
|
|
185
|
+
this.isCardHidden.set(isHidden);
|
|
188
186
|
}
|
|
189
187
|
}
|
|
190
188
|
```
|
|
191
189
|
|
|
192
|
-
> **Lưu ý:** `outFunctionsControl` emit `IFunctionControlCard` (không phải DOM Event).
|
|
190
|
+
> **Lưu ý:** `outFunctionsControl` emit `IFunctionControlCard` và `outChangeStateShowContent` emit `boolean` (không phải DOM Event). `event.stopPropagation()` chỉ áp dụng cho handler của DOM event thật (ví dụ `(click)` trên nút bên ngoài), không áp dụng cho các `@Output()` của component.
|
|
193
191
|
|
|
194
192
|
### 5. Card với custom template header
|
|
195
193
|
|
|
@@ -296,8 +294,8 @@ export class ExampleComponent {
|
|
|
296
294
|
|
|
297
295
|
| Output | Type | Mô tả | Handler TS | Binding HTML |
|
|
298
296
|
|---|---|---|---|---|
|
|
299
|
-
| `(outChangeStateShowContent)` | `boolean` | Emit giá trị `isHidden` mỗi khi trạng thái ẩn/hiện thay đổi | `handlerChangeState(isHidden: boolean): void {
|
|
300
|
-
| `(outFunctionsControl)` | `IFunctionControlCard` | Emit object chứa các hàm điều khiển card; được emit một lần trong `ngOnInit` | `handlerReceiveFunctionsControl(controls: IFunctionControlCard): void {
|
|
297
|
+
| `(outChangeStateShowContent)` | `boolean` | Emit giá trị `isHidden` mỗi khi trạng thái ẩn/hiện thay đổi | `handlerChangeState(isHidden: boolean): void { this.isCardHidden.set(isHidden); }` | `(outChangeStateShowContent)="handlerChangeState($event)"` |
|
|
298
|
+
| `(outFunctionsControl)` | `IFunctionControlCard` | Emit object chứa các hàm điều khiển card; được emit một lần trong `ngOnInit` | `handlerReceiveFunctionsControl(controls: IFunctionControlCard): void { this.cardControls.set(controls); }` | `(outFunctionsControl)="handlerReceiveFunctionsControl($event)"` |
|
|
301
299
|
|
|
302
300
|
## @Input() — libs_ui-components-card-wrapper
|
|
303
301
|
|
|
@@ -375,11 +373,3 @@ interface ILabel {
|
|
|
375
373
|
⚠️ **CardWrapper tự động uppercase + i18n**: `labelConfig.labelLeft` được pipe qua `translate` rồi `uppercase` trong template của wrapper. Truyền i18n key nếu có, hoặc truyền chuỗi thường — kết quả sẽ luôn viết hoa.
|
|
376
374
|
|
|
377
375
|
⚠️ **isHidden là model() signal**: Hỗ trợ cú pháp two-way binding `[(isHidden)]`. Có thể dùng `[isHidden]` (one-way) hoặc `[(isHidden)]` (two-way) tùy nhu cầu.
|
|
378
|
-
|
|
379
|
-
## Demo
|
|
380
|
-
|
|
381
|
-
```bash
|
|
382
|
-
npx nx serve core-ui
|
|
383
|
-
```
|
|
384
|
-
|
|
385
|
-
Truy cập: http://localhost:4500/card
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libs-ui/components-card",
|
|
3
|
-
"version": "0.2.357-
|
|
3
|
+
"version": "0.2.357-9",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@angular/common": ">=18.0.0",
|
|
6
6
|
"@angular/core": ">=18.0.0",
|
|
7
|
-
"@libs-ui/components-label": "0.2.357-
|
|
8
|
-
"@libs-ui/interfaces-types": "0.2.357-
|
|
7
|
+
"@libs-ui/components-label": "0.2.357-9",
|
|
8
|
+
"@libs-ui/interfaces-types": "0.2.357-9",
|
|
9
9
|
"@ngx-translate/core": "^15.0.0"
|
|
10
10
|
},
|
|
11
11
|
"sideEffects": false,
|