laif-ds 1.0.0 → 1.0.2-app-data-grid.76
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/dist/CHANGELOG.md +282 -0
- package/dist/_virtual/index7.js +5 -2
- package/dist/_virtual/index8.js +2 -5
- package/dist/agent-docs/adoption-report.json +164 -83
- package/dist/agent-docs/components/AppBottomNav.md +180 -49
- package/dist/agent-docs/components/AppCard.md +25 -21
- package/dist/agent-docs/components/AppDataGrid.md +2602 -0
- package/dist/agent-docs/components/AppEditor.md +18 -13
- package/dist/agent-docs/components/AppSelect.md +50 -0
- package/dist/agent-docs/components/AppSidebar.md +504 -11
- package/dist/agent-docs/components/DataTable.md +34 -3
- package/dist/agent-docs/components/DatePicker.md +7 -7
- package/dist/agent-docs/components/FileUploader.md +12 -12
- package/dist/agent-docs/components/GridFilterPanel.md +112 -0
- package/dist/agent-docs/components/Sidebar.md +72 -1
- package/dist/agent-docs/components/SidebarMenuBadge.md +87 -0
- package/dist/agent-docs/components-list.md +47 -2
- package/dist/agent-docs/manifest.json +310 -36
- package/dist/components/design-tokens.js +138 -66
- package/dist/components/nav-tokens.js +41 -0
- package/dist/components/ui/app-bottom-nav.js +125 -130
- package/dist/components/ui/app-data-grid/app-data-grid.js +874 -0
- package/dist/components/ui/app-data-grid/engine/use-grid-column-resize.js +110 -0
- package/dist/components/ui/app-data-grid/engine/use-grid-engine.js +598 -0
- package/dist/components/ui/app-data-grid/engine/use-grid-infinite-loader.js +50 -0
- package/dist/components/ui/app-data-grid/engine/use-grid-virtualizer.js +90 -0
- package/dist/components/ui/app-data-grid/grid-aggregate.js +5 -0
- package/dist/components/ui/app-data-grid/grid-column-registry.js +28 -0
- package/dist/components/ui/app-data-grid/grid-columns.js +204 -0
- package/dist/components/ui/app-data-grid/grid-filter-compile.js +33 -0
- package/dist/components/ui/app-data-grid/grid-filter-operators.js +139 -0
- package/dist/components/ui/app-data-grid/grid-grouping.js +104 -0
- package/dist/components/ui/app-data-grid/grid-header-matrix.js +112 -0
- package/dist/components/ui/app-data-grid/grid-i18n.js +207 -0
- package/dist/components/ui/app-data-grid/grid-mount-count.js +8 -0
- package/dist/components/ui/app-data-grid/grid-reducer.js +200 -0
- package/dist/components/ui/app-data-grid/grid-result-scope.js +35 -0
- package/dist/components/ui/app-data-grid/grid-tokens.js +169 -0
- package/dist/components/ui/app-data-grid/grid-view-preset.js +97 -0
- package/dist/components/ui/app-data-grid/parts/grid-actions-row.js +86 -0
- package/dist/components/ui/app-data-grid/parts/grid-cell-text.js +67 -0
- package/dist/components/ui/app-data-grid/parts/grid-column-registry-panel.js +320 -0
- package/dist/components/ui/app-data-grid/parts/grid-density-control.js +88 -0
- package/dist/components/ui/app-data-grid/parts/grid-filter-chips.js +224 -0
- package/dist/components/ui/app-data-grid/parts/grid-filter-editor.js +197 -0
- package/dist/components/ui/app-data-grid/parts/grid-filter-panel.js +386 -0
- package/dist/components/ui/app-data-grid/parts/grid-filter-row.js +273 -0
- package/dist/components/ui/app-data-grid/parts/grid-fullscreen-toggle.js +29 -0
- package/dist/components/ui/app-data-grid/parts/grid-group-row.js +135 -0
- package/dist/components/ui/app-data-grid/parts/grid-header.js +338 -0
- package/dist/components/ui/app-data-grid/parts/grid-pagination-control.js +218 -0
- package/dist/components/ui/app-data-grid/parts/grid-row.js +181 -0
- package/dist/components/ui/app-data-grid/parts/grid-scroll-area.js +186 -0
- package/dist/components/ui/app-data-grid/parts/grid-selection-bar.js +195 -0
- package/dist/components/ui/app-data-grid/parts/grid-status-surface.js +66 -0
- package/dist/components/ui/app-data-grid/parts/grid-table.js +482 -0
- package/dist/components/ui/app-data-grid/parts/grid-toolbar-slots.js +192 -0
- package/dist/components/ui/app-data-grid/use-grid-filters.js +173 -0
- package/dist/components/ui/app-select.js +332 -222
- package/dist/components/ui/app-sidebar-mobile.js +119 -104
- package/dist/components/ui/app-sidebar.js +516 -313
- package/dist/components/ui/button.js +2 -1
- package/dist/components/ui/gantt/components/Chart/Chart.js +1 -1
- package/dist/components/ui/nav-badge.js +66 -0
- package/dist/components/ui/sidebar.js +272 -207
- package/dist/components/ui/tables/data-cross-table/data-cross-table.js +6 -6
- package/dist/components/ui/tables/data-table/data-table-constants.js +36 -16
- package/dist/components/ui/tables/data-table/data-table-i18n.js +135 -1
- package/dist/css-for-template.css +27 -0
- package/dist/index.d.ts +5872 -144
- package/dist/index.js +473 -406
- package/dist/node_modules/eventemitter3/index2.js +1 -1
- package/dist/styles.css +2 -1
- package/dist/styles.v3.css +1 -1
- package/package.json +25 -7
- /package/dist/agent-docs/components/{truncated-cell.md → TruncatedCell.md} +0 -0
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useState as F, useRef as f, useEffect as te, useMemo as v, useCallback as d } from "react";
|
|
3
|
+
import { buildGridSearchFilter as g } from "./grid-filter-compile.js";
|
|
4
|
+
import { getGridFilterTypeOptions as re, getGridFilterEditor as ne, isGridFilterType as ie } from "./grid-filter-operators.js";
|
|
5
|
+
import { gridDefaultDebounceTime as k } from "./grid-tokens.js";
|
|
6
|
+
const ae = (e) => e.flatMap(
|
|
7
|
+
(r) => r.accessorKey === void 0 ? [] : [
|
|
8
|
+
{
|
|
9
|
+
id: r.id,
|
|
10
|
+
accessorKey: r.accessorKey,
|
|
11
|
+
label: r.headerLabel,
|
|
12
|
+
columnType: r.columnType,
|
|
13
|
+
filterable: r.filterable,
|
|
14
|
+
// ⚠️ LE DUE RIGHE CHE RENDONO VIVE LE DUE PROP. Senza di loro il
|
|
15
|
+
// tipo le dichiara, il pannello non le vede mai e l'editor resta
|
|
16
|
+
// un campo di testo per tutti: e' la stessa meta' mancante che la
|
|
17
|
+
// Fase 5 ha misurato su `aggregate`, dove il campo type-checkava
|
|
18
|
+
// sul config pubblico e veniva SCARTATO nel builder.
|
|
19
|
+
filterType: r.filterType,
|
|
20
|
+
options: r.options
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
), se = (e) => e.filterType ?? (ie(e.columnType) ? e.columnType : void 0), fe = (e, r) => {
|
|
24
|
+
const l = se(e);
|
|
25
|
+
if (l !== void 0)
|
|
26
|
+
return {
|
|
27
|
+
filterType: l,
|
|
28
|
+
editor: ne(l),
|
|
29
|
+
operators: re(l, r),
|
|
30
|
+
options: e.options ?? []
|
|
31
|
+
};
|
|
32
|
+
}, oe = "grid-custom-filter:", me = (e, r, l, O) => {
|
|
33
|
+
const m = e.describe(r, l), B = e.toFragment(r, { field: e.type });
|
|
34
|
+
return {
|
|
35
|
+
id: O,
|
|
36
|
+
kind: "custom",
|
|
37
|
+
customKey: e.type,
|
|
38
|
+
customLabel: m,
|
|
39
|
+
customFragment: B ?? void 0,
|
|
40
|
+
columnId: `${oe}${e.type}`,
|
|
41
|
+
columnAccessorKey: e.type,
|
|
42
|
+
columnLabel: e.type,
|
|
43
|
+
columnType: "other",
|
|
44
|
+
operator: "eq",
|
|
45
|
+
value: r
|
|
46
|
+
};
|
|
47
|
+
}, C = (e, r) => e.kind === "custom" || r.has(e.columnId), pe = (e) => {
|
|
48
|
+
const {
|
|
49
|
+
initialBadges: r,
|
|
50
|
+
initialColumnVisibility: l,
|
|
51
|
+
initialPanelOpen: O = !1,
|
|
52
|
+
columns: m,
|
|
53
|
+
onFiltersChange: B,
|
|
54
|
+
debounceTime: D
|
|
55
|
+
} = e, [S, x] = F(
|
|
56
|
+
() => r ?? []
|
|
57
|
+
), [b, K] = F(() => l ?? {}), [P, U] = F(O), [$, L] = F(0), [M, q] = F(() => r ?? []), a = f(null), G = f(k);
|
|
58
|
+
G.current = D ?? k, te(
|
|
59
|
+
() => () => {
|
|
60
|
+
a.current !== null && window.clearTimeout(a.current);
|
|
61
|
+
},
|
|
62
|
+
[]
|
|
63
|
+
);
|
|
64
|
+
const w = f(B);
|
|
65
|
+
w.current = B;
|
|
66
|
+
const p = v(() => {
|
|
67
|
+
const t = /* @__PURE__ */ new Set();
|
|
68
|
+
for (const n of m)
|
|
69
|
+
b[n.id] !== !1 && t.add(n.id);
|
|
70
|
+
return t;
|
|
71
|
+
}, [m, b]), N = f(p);
|
|
72
|
+
N.current = p;
|
|
73
|
+
const u = f(S);
|
|
74
|
+
u.current = S;
|
|
75
|
+
const R = f(b);
|
|
76
|
+
R.current = b;
|
|
77
|
+
const A = f(m);
|
|
78
|
+
A.current = m;
|
|
79
|
+
const h = v(
|
|
80
|
+
() => S.filter((t) => C(t, p)),
|
|
81
|
+
[S, p]
|
|
82
|
+
), X = v(
|
|
83
|
+
() => M.filter((t) => C(t, p)),
|
|
84
|
+
[M, p]
|
|
85
|
+
), j = v(() => g(h), [h]), c = d(
|
|
86
|
+
(t, n = !1) => {
|
|
87
|
+
const s = u.current, i = t(s);
|
|
88
|
+
u.current = i, x(i);
|
|
89
|
+
const y = (o) => C(o, N.current), I = g(s.filter(y)), E = g(i.filter(y)), V = JSON.stringify(I) !== JSON.stringify(E), T = () => {
|
|
90
|
+
q(u.current), V && (L((o) => o + 1), w.current?.(
|
|
91
|
+
g(u.current.filter(y))
|
|
92
|
+
));
|
|
93
|
+
};
|
|
94
|
+
if (a.current !== null && (window.clearTimeout(a.current), a.current = null), !n || G.current <= 0) {
|
|
95
|
+
T();
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
a.current = window.setTimeout(() => {
|
|
99
|
+
a.current = null, T();
|
|
100
|
+
}, G.current);
|
|
101
|
+
},
|
|
102
|
+
[]
|
|
103
|
+
), z = d(
|
|
104
|
+
(t) => {
|
|
105
|
+
c((n) => [...n, t]);
|
|
106
|
+
},
|
|
107
|
+
[c]
|
|
108
|
+
), H = d(
|
|
109
|
+
(t) => {
|
|
110
|
+
t.length !== 0 && c((n) => [...n, ...t]);
|
|
111
|
+
},
|
|
112
|
+
[c]
|
|
113
|
+
), Q = d(
|
|
114
|
+
(t, n) => {
|
|
115
|
+
c(
|
|
116
|
+
(s) => s.map(
|
|
117
|
+
(i) => i.id === t ? { ...i, ...n } : i
|
|
118
|
+
),
|
|
119
|
+
!0
|
|
120
|
+
);
|
|
121
|
+
},
|
|
122
|
+
[c]
|
|
123
|
+
), W = d(
|
|
124
|
+
(t) => {
|
|
125
|
+
c((n) => n.filter((s) => s.id !== t));
|
|
126
|
+
},
|
|
127
|
+
[c]
|
|
128
|
+
), Y = d(() => c(() => []), [c]), Z = d(
|
|
129
|
+
(t, n) => {
|
|
130
|
+
const s = [...t], i = { ...n };
|
|
131
|
+
u.current = s, R.current = i, x(s), K(i);
|
|
132
|
+
},
|
|
133
|
+
[]
|
|
134
|
+
), ee = d((t, n) => {
|
|
135
|
+
const s = R.current, i = { ...s, [t]: n };
|
|
136
|
+
R.current = i, K(i);
|
|
137
|
+
const y = (o) => {
|
|
138
|
+
const J = /* @__PURE__ */ new Set();
|
|
139
|
+
for (const _ of A.current)
|
|
140
|
+
o[_.id] !== !1 && J.add(_.id);
|
|
141
|
+
return J;
|
|
142
|
+
}, I = y(s), E = y(i), V = g(
|
|
143
|
+
u.current.filter((o) => C(o, I))
|
|
144
|
+
), T = g(
|
|
145
|
+
u.current.filter((o) => C(o, E))
|
|
146
|
+
);
|
|
147
|
+
JSON.stringify(V) !== JSON.stringify(T) && (L((o) => o + 1), w.current?.(T));
|
|
148
|
+
}, []);
|
|
149
|
+
return {
|
|
150
|
+
badges: h,
|
|
151
|
+
committedBadges: X,
|
|
152
|
+
emissions: $,
|
|
153
|
+
columnVisibility: b,
|
|
154
|
+
panelOpen: P,
|
|
155
|
+
computedFilter: j,
|
|
156
|
+
addBadge: z,
|
|
157
|
+
addBadges: H,
|
|
158
|
+
updateBadge: Q,
|
|
159
|
+
removeBadge: W,
|
|
160
|
+
clearBadges: Y,
|
|
161
|
+
restore: Z,
|
|
162
|
+
setColumnVisible: ee,
|
|
163
|
+
setPanelOpen: U
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
export {
|
|
167
|
+
oe as GRID_CUSTOM_FILTER_COLUMN_PREFIX,
|
|
168
|
+
me as createGridCustomFilterBadge,
|
|
169
|
+
fe as gridColumnFilterControl,
|
|
170
|
+
se as resolveGridFilterType,
|
|
171
|
+
ae as toGridFilterColumns,
|
|
172
|
+
pe as useGridFilters
|
|
173
|
+
};
|