@libs-ui/components-table 0.2.356-21 → 0.2.356-22

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.
Files changed (2) hide show
  1. package/README.md +52 -0
  2. package/package.json +28 -28
package/README.md CHANGED
@@ -12,6 +12,7 @@
12
12
  - ✅ **Virtual Scrolling**: Tối ưu hiệu năng cho danh sách hàng ngàn bản ghi.
13
13
  - ✅ **Phân trang (Pagination)**: Hỗ trợ cả `scroll-infinity` và `click-pagination`.
14
14
  - ✅ **Custom Template**: Tùy biến hiển thị từng row và cell thông qua cấu hình `colTemplateConfig`.
15
+ - ✅ **Collapse/Expand Row**: Hỗ trợ mở rộng xem chi tiết dữ liệu cấp dưới (Hierarchical/Sub-table) bằng giao diện có thể tuỳ biến cao.
15
16
  - ✅ **Sorting**: Tích hợp sẵn logic sắp xếp dữ liệu.
16
17
  - ✅ **Checkbox Selection**: Hỗ trợ chọn một hoặc nhiều hàng cùng lúc.
17
18
  - ✅ **Angular Signals**: Hoạt động mượt mà với Signal-based state management.
@@ -78,6 +79,57 @@ Ghim các cột quan trọng bên trái bằng cách sử dụng `headerLeft`. C
78
79
  [httpRequestData]="userRequestConfig" />
79
80
  ```
80
81
 
82
+ ### 3. Hierarchical Data (Collapse/Expand Row)
83
+
84
+ Sử dụng `configTemplateItemCollapseExpand` để cấu hình hiển thị nội dung chi tiết mở rộng bên dưới mỗi hàng. Rất hữu ích cho các Sub-table (bảng con), Report nhiều lớp, v.v.
85
+
86
+ ```html
87
+ <libs_ui-components-table
88
+ [headerRight]="headerConfig"
89
+ [newData]="tableData"
90
+ [configTemplateItemCollapseExpand]="configCollapseExpand" />
91
+ ```
92
+
93
+ ```typescript
94
+ // Cấu hình Collapse/Expand Template
95
+ readonly configCollapseExpand: IConfigTemplateItemCollapseExpand = {
96
+ // Biến dùng để nhận diện nội dung mở rộng mảng object chứa dữ liệu
97
+ fieldGetDataExpand: 'expand_data',
98
+ colTemplateConfig: [
99
+ {
100
+ cssWrapper: 'flex w-full',
101
+ fieldsConfig: [
102
+ {
103
+ field: 'details',
104
+ parseValue: (data) => {
105
+ // Un-wrap Signal và trả về HTML động tuỳ ý hoặc Component con
106
+ const details = data.value() || [];
107
+ let htmlInner = '';
108
+ details.forEach(d => {
109
+ htmlInner += `<div>Row Child Detail: \${d.name}</div>`;
110
+ });
111
+ return of(\`<div class="p-4 bg-gray-50">\${htmlInner}</div>\`);
112
+ }
113
+ }
114
+ ]
115
+ }
116
+ ]
117
+ };
118
+
119
+ // Dữ liệu cần có cờ \`specificExpand\` để điều hướng state ẩn/hiện,
120
+ // và trường thông tin \`expand_data\` như đã định nghĩa ở trên.
121
+ readonly tableData = {
122
+ data: convertObjectToSignal([
123
+ {
124
+ id: 1,
125
+ name: 'Task Parent 1',
126
+ specificExpand: false, // Quản lý state đóng mở
127
+ expand_data: [{ details: [ {name: 'Sub Task A'}, {name: 'Sub Task B'} ] }]
128
+ }
129
+ ])
130
+ };
131
+ ```
132
+
81
133
  ## API Documentation
82
134
 
83
135
  ### Inputs
package/package.json CHANGED
@@ -1,39 +1,39 @@
1
1
  {
2
2
  "name": "@libs-ui/components-table",
3
- "version": "0.2.356-21",
3
+ "version": "0.2.356-22",
4
4
  "peerDependencies": {
5
5
  "@angular/common": ">=18.0.0",
6
6
  "@angular/core": ">=18.0.0",
7
- "@libs-ui/components-buttons-button": "0.2.356-21",
7
+ "@libs-ui/components-buttons-button": "0.2.356-22",
8
8
  "@iharbeck/ngx-virtual-scroller": "15.2.0",
9
- "@libs-ui/interfaces-types": "0.2.356-21",
10
- "@libs-ui/components-buttons-sort": "0.2.356-21",
11
- "@libs-ui/components-popover": "0.2.356-21",
12
- "@libs-ui/components-avatar": "0.2.356-21",
13
- "@libs-ui/components-dropdown": "0.2.356-21",
14
- "@libs-ui/components-line-clamp": "0.2.356-21",
15
- "@libs-ui/components-list": "0.2.356-21",
16
- "@libs-ui/components-switch": "0.2.356-21",
17
- "@libs-ui/services-http-request": "0.2.356-21",
9
+ "@libs-ui/interfaces-types": "0.2.356-22",
10
+ "@libs-ui/components-buttons-sort": "0.2.356-22",
11
+ "@libs-ui/components-popover": "0.2.356-22",
12
+ "@libs-ui/components-avatar": "0.2.356-22",
13
+ "@libs-ui/components-dropdown": "0.2.356-22",
14
+ "@libs-ui/components-line-clamp": "0.2.356-22",
15
+ "@libs-ui/components-list": "0.2.356-22",
16
+ "@libs-ui/components-switch": "0.2.356-22",
17
+ "@libs-ui/services-http-request": "0.2.356-22",
18
18
  "rxjs": "~7.8.0",
19
- "@libs-ui/components-checkbox-group": "0.2.356-21",
20
- "@libs-ui/components-checkbox-single": "0.2.356-21",
21
- "@libs-ui/components-scroll-overlay": "0.2.356-21",
22
- "@libs-ui/components-spinner": "0.2.356-21",
23
- "@libs-ui/icons": "0.2.356-21",
24
- "@libs-ui/pipes-call-function-in-template": "0.2.356-21",
25
- "@libs-ui/pipes-check-selected-by-key": "0.2.356-21",
26
- "@libs-ui/utils": "0.2.356-21",
19
+ "@libs-ui/components-checkbox-group": "0.2.356-22",
20
+ "@libs-ui/components-checkbox-single": "0.2.356-22",
21
+ "@libs-ui/components-scroll-overlay": "0.2.356-22",
22
+ "@libs-ui/components-spinner": "0.2.356-22",
23
+ "@libs-ui/icons": "0.2.356-22",
24
+ "@libs-ui/pipes-call-function-in-template": "0.2.356-22",
25
+ "@libs-ui/pipes-check-selected-by-key": "0.2.356-22",
26
+ "@libs-ui/utils": "0.2.356-22",
27
27
  "@ngx-translate/core": "^15.0.0",
28
- "@libs-ui/components-buttons-status": "0.2.356-21",
29
- "@libs-ui/pipes-clone-object": "0.2.356-21",
30
- "@libs-ui/pipes-security-trust": "0.2.356-21",
31
- "@libs-ui/components-badge": "0.2.356-21",
32
- "@libs-ui/pipes-convert-object-to-signal": "0.2.356-21",
33
- "@libs-ui/pipes-get-value-of-object": "0.2.356-21",
34
- "@libs-ui/components-component-outlet": "0.2.356-21",
35
- "@libs-ui/components-pagination": "0.2.356-21",
36
- "@libs-ui/components-scroll-measure-items-direction-horizontal": "0.2.356-21"
28
+ "@libs-ui/components-buttons-status": "0.2.356-22",
29
+ "@libs-ui/pipes-clone-object": "0.2.356-22",
30
+ "@libs-ui/pipes-security-trust": "0.2.356-22",
31
+ "@libs-ui/components-badge": "0.2.356-22",
32
+ "@libs-ui/pipes-convert-object-to-signal": "0.2.356-22",
33
+ "@libs-ui/pipes-get-value-of-object": "0.2.356-22",
34
+ "@libs-ui/components-component-outlet": "0.2.356-22",
35
+ "@libs-ui/components-pagination": "0.2.356-22",
36
+ "@libs-ui/components-scroll-measure-items-direction-horizontal": "0.2.356-22"
37
37
  },
38
38
  "sideEffects": false,
39
39
  "module": "fesm2022/libs-ui-components-table.mjs",