ng-fusion-ui 0.7.0 → 0.7.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Ng-Fusion-Ui
2
2
 
3
- Angular - mobile friendly and type safe data-grid system and more..!
3
+ Angular - responsive and type safe data table!
4
4
 
5
5
  ## Documentation
6
6
 
@@ -18,57 +18,85 @@ For full documentation, visit [Fusion Ui](https://fusion-ui.up.railway.app).
18
18
 
19
19
  ```
20
20
 
21
- ## Basic Usage/Examples
22
-
23
- ```javascript
24
- <fu-table
25
- [tableLayout]="'auto'"
26
- [dataSource]="data"
27
- [totalCount]="totalCount"
28
- [expandable]="false"
29
- [expanded]="true"
30
- [isLoading]="loading"
31
- localStorageKey="fake"
32
- [firstPageOnInit]="false"
33
- [serverPagination]="true"
34
- [showFilter]="true"
35
- [showPaginator]="true"
36
- [quickPageJump]="true"
37
- (tableActions)="tableActions($event)"
38
- (selectRowAction)="selectRowAction($event)"
39
- variant="outlined"
40
- >
41
- <ng-container *fuHeaderTemplate="data; let key">
42
- <fu-thead-cell headerText="id" width="70px" />
43
- <fu-thead-cell headerText="name" />
44
- <fu-thead-cell headerText="image" />
45
- <fu-thead-cell headerText="phone" />
46
- <fu-thead-cell headerText="email" />
47
- <fu-thead-cell width="100px" />
48
- </ng-container>
49
-
50
- <ng-container *fuBodyTemplate="data; let row; keys as key">
51
- <fu-tbody-cell [cellValue]="row.id" />
52
- <fu-tbody-cell [cellValue]="row.name" />
53
- <fu-tbody-cell>
54
- <img [src]="row.image" />
55
- </fu-tbody-cell>
56
- <fu-tbody-cell [cellValue]="row.phone" [editKey]="key.phone" />
57
- <fu-tbody-cell [cellValue]="row.email" />
58
-
59
- <fu-tbody-actions
60
- [editRowData]="row"
61
- (editSaveAction)="editSaveAction($event)"
62
- />
63
- </ng-container>
64
-
65
- <ng-container *fuPopupTemplate>
66
- <button fuButton>Hello</button>
67
- <button fuButton>Hello world</button>
68
- </ng-container>
69
-
70
- <ng-container *fuExpandTemplate="data; let row">
71
- <div>expand content: {{ row.name }}</div>
72
- </ng-container>
73
- </fu-table>
21
+ **FuTable**
22
+
23
+ - **Selector:** `fu-table`
24
+ - **Module:** Import `FuTableModule` into your NgModule.
25
+
26
+ **Overview:**
27
+ A flexible data table component with client/server pagination, sorting, column visibility/reordering, inline editing, row expansion, search, and optional persistence to `localStorage`.
28
+
29
+ **Basic usage:**
30
+
31
+ ```html
32
+ <fu-table [dataSource]="users" [paginator]="true" (queryChanged)="load($event)">
33
+ <fu-column field="name" header="Name" sortable editable></fu-column>
34
+ <fu-column field="email" header="Email"></fu-column>
35
+ <fu-column field="age" header="Age" type="number"></fu-column>
36
+ </fu-table>
74
37
  ```
38
+
39
+ **Important Inputs**
40
+ - **dataSource:** (required) `T[]` — array of row objects to display.
41
+ - **totalItems:** `number` — total items for server-side pagination (default: `0`).
42
+ - **localStorageKey:** `string` — key to persist table state (optional).
43
+ - **columnsConfig:** `FuColumnConfig[]` — override column visibility/order (optional).
44
+ - **configPanel:** `boolean` — show configuration sidebar (default: `false`).
45
+ - **filterPanel:** `boolean` — enable search panel (default: `false`).
46
+ - **paginator:** `boolean` — show pagination controls (default: `true`).
47
+ - **loading:** `boolean` — show loading skeletons (default: `false`).
48
+ - **disablePaginator:** `boolean` — disable paginator interaction (default: `false`).
49
+ - **resetQuery:** `any` — change to reset pagination to first page.
50
+ - **responsive:** `boolean` — responsive layout (default: `true`).
51
+ - **scrollable:** `boolean` — enable fixed-height scrolling (default: `false`).
52
+ - **scrollHeight:** `number` — height in px when `scrollable` is true.
53
+ - **stickyHeader / stickyFirstColumn / stickyLastColumn:** `boolean` — sticky layout toggles.
54
+ - **rowState:** `'idle' | 'pending' | 'success' | 'error'` — reflect row save state.
55
+ - **rowClass:** `(row, index) => string | null` — function to set row CSS class.
56
+
57
+ **Outputs / Events**
58
+ - **queryChanged:** `FuTableQuery` — emitted for server-side requests (page, size, sort).
59
+ - **cellValueEdited:** `Record<string, unknown>` — column field -> new value when a cell is edited.
60
+ - **columnsChanged:** `FuColumnConfig[]` — emitted when column order/visibility changes.
61
+ - **rowEditSubmit:** `T` — emitted when an edited row is submitted.
62
+ - **rowClicked:** `T` — emitted when a row is clicked.
63
+
64
+ **Column definition**
65
+ Use `fu-column` inside `fu-table` to declare columns. Key inputs on `fu-column`:
66
+ - `field` (path in row object, dot-notation supported)
67
+ - `header` (display text)
68
+ - `sortable`, `editable`, `hideable`, `reorderable`
69
+ - `type` (control type for editors)
70
+ - `visible` (initial visibility)
71
+
72
+ You can provide templates inside `fu-column`:
73
+ - `ng-template` with `fuColumnCell` — custom cell content (let-value)
74
+ - `fuColumnHeader` — custom header
75
+ - `fuColumnHeaderAddon` — small addon in header
76
+ - `fuColumnActions` — action buttons for the column
77
+
78
+ **Content templates for `fu-table`**
79
+ - `<ng-template fuTableNoData>` — custom no-data template.
80
+ - `<ng-template fuTableExpandRow let-row>` — expanded row content.
81
+ - `<ng-template fuTableSidebar>` — custom sidebar content for the config panel.
82
+ - `<ng-template fuRowContextMenu>` — context menu template for rows.
83
+
84
+ **Notes & tips**
85
+ - If `totalItems > dataSource.length`, the table assumes server-side mode and will emit `queryChanged` for paging and sorting.
86
+ - Provide `localStorageKey` to persist UI state (columns, page, search, ui toggles).
87
+ - Use `columnsConfig` to programmatically control visible columns/order from outside the table.
88
+
89
+ **Example with server-side loading**
90
+
91
+ ```html
92
+ <fu-table
93
+ [dataSource]="pageRows"
94
+ [totalItems]="total"
95
+ [paginator]="true"
96
+ (queryChanged)="onQuery($event)">
97
+
98
+ <fu-column field="id" header="#" hideable="false"></fu-column>
99
+ <fu-column field="name" header="Name" sortable editable></fu-column>
100
+ <fu-column field="email" header="Email"></fu-column>
101
+ </fu-table>
102
+ ```