@nubitio/ui 1.3.1 → 2.0.0
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 +44 -0
- package/dist/index.cjs +668 -150
- package/dist/index.d.cts +202 -240
- package/dist/index.d.mts +202 -240
- package/dist/index.mjs +663 -148
- package/dist/style.css +150 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -59,6 +59,50 @@ consumers do not need to rewrite existing components. Source design:
|
|
|
59
59
|
- **Layout** — `AppToolbar`
|
|
60
60
|
- **Selection and navigation** — `Checkbox` (native, including mixed state), `RadioGroup` (native radios), `Tabs` (controlled, keyboard navigation)
|
|
61
61
|
- **Loading** — `Spinner`, `Progress` (native determinate or indeterminate progress)
|
|
62
|
+
- **Hierarchical data** — `TreeList` (flat `parentId` or nested data, expansion, lazy child loading, selection, filtering, sorting, row actions, inline edit hooks and row move callbacks)
|
|
63
|
+
|
|
64
|
+
### TreeList
|
|
65
|
+
|
|
66
|
+
`TreeList` is a framework-owned, renderer-neutral hierarchical table. It has no
|
|
67
|
+
DevExtreme dependency. Give it flat parent-linked records, nested records, or
|
|
68
|
+
independent roots in either shape:
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
<TreeList
|
|
72
|
+
ariaLabel="Chart of accounts"
|
|
73
|
+
items={accounts}
|
|
74
|
+
getId={(account) => account.id}
|
|
75
|
+
getParentId={(account) => account.parentId}
|
|
76
|
+
columns={[
|
|
77
|
+
{ id: 'code', header: 'Code', sortable: true },
|
|
78
|
+
{ id: 'name', header: 'Account', sortable: true },
|
|
79
|
+
]}
|
|
80
|
+
hasChildren={(account) => account.hasChildren}
|
|
81
|
+
loadChildren={(account, { signal }) => accountStore.loadChildren(account.id, { signal })}
|
|
82
|
+
withParent={(child, parent) => ({ ...child, parentId: parent.id })}
|
|
83
|
+
selectionMode="multiple"
|
|
84
|
+
onMove={({ item, newParent, index }) => moveAccount(item, newParent, index)}
|
|
85
|
+
/>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Flat records need unique IDs and a parent ID for every non-root node. Missing
|
|
89
|
+
parents, duplicate IDs and cycles throw instead of silently hiding records.
|
|
90
|
+
Nested records use `getChildren`; do not supply both nested children and a
|
|
91
|
+
`parentId` relationship for the same node. Lazy loading receives an
|
|
92
|
+
`AbortSignal`; pass `withParent` when returned flat children do not include their
|
|
93
|
+
own parent ID. Expansion and selection can be controlled by the consumer or
|
|
94
|
+
managed internally.
|
|
95
|
+
|
|
96
|
+
Selection can include loaded descendants. Sorting and search apply to loaded
|
|
97
|
+
records; server-backed query semantics remain the responsibility of the CRUD
|
|
98
|
+
resource integration. `editable` and `onEdit` provide an inline-edit hook, while
|
|
99
|
+
`onMove` reports a proposed parent and index—the application/backend must
|
|
100
|
+
validate and persist the move. This keeps domain rules (such as account posting
|
|
101
|
+
levels or warehouse constraints) out of the visual component.
|
|
102
|
+
|
|
103
|
+
The component uses semantic table/treegrid markup, keyboard row navigation,
|
|
104
|
+
theme tokens, density settings and localized UI strings. Custom cell renderers
|
|
105
|
+
and row action menus allow applications to establish their own visual language.
|
|
62
106
|
|
|
63
107
|
### Selection, tabs and loading
|
|
64
108
|
|