@rozie-ui/data-table-solid 0.1.1 → 0.2.1
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 +1 -1
- package/dist/index.cjs +29 -281
- package/dist/index.d.cts +18 -18
- package/dist/index.d.mts +18 -18
- package/dist/index.mjs +4 -279
- package/package.json +5 -7
- package/src/Column.tsx +3 -3
- package/src/DataTable.tsx +7 -18
- package/src/EditorCheckbox.tsx +2 -2
- package/src/EditorDate.tsx +2 -2
- package/src/EditorNumber.tsx +2 -2
- package/src/EditorSelect.tsx +3 -3
- package/src/EditorText.tsx +2 -2
- package/src/FilterNumberRange.tsx +1 -1
- package/src/FilterSelect.tsx +2 -2
- package/src/FilterText.tsx +1 -1
- package/src/GroupBar.tsx +3 -3
- package/src/Popover.tsx +0 -416
- package/src/internal/middleware.ts +0 -54
package/dist/index.mjs
CHANGED
|
@@ -1,283 +1,9 @@
|
|
|
1
|
-
import { Show,
|
|
1
|
+
import { Show, createEffect, createSignal, mergeProps, on, onCleanup, onMount, splitProps, untrack, useContext } from "solid-js";
|
|
2
2
|
import { Key } from "@solid-primitives/keyed";
|
|
3
|
-
import { __rozieInjectStyle, createControllableSignal,
|
|
4
|
-
import
|
|
3
|
+
import { __rozieInjectStyle, createControllableSignal, parseInlineStyle, rozieAttr, rozieClass, rozieContext, rozieDisplay } from "@rozie/runtime-solid";
|
|
4
|
+
import Popover from "@rozie-ui/popover-solid";
|
|
5
5
|
import { createTable, getCoreRowModel, getExpandedRowModel, getFacetedMinMaxValues, getFacetedRowModel, getFacetedUniqueValues, getFilteredRowModel, getGroupedRowModel, getPaginationRowModel, getSortedRowModel } from "@tanstack/table-core";
|
|
6
6
|
import { Virtualizer, elementScroll, measureElement, observeElementOffset, observeElementRect } from "@tanstack/virtual-core";
|
|
7
|
-
//#region src/internal/middleware.ts
|
|
8
|
-
/**
|
|
9
|
-
* Build the ordered middleware array for `computePosition`. Pure — no engine
|
|
10
|
-
* import, no DOM read beyond the passed-in arrow element.
|
|
11
|
-
*/
|
|
12
|
-
function buildMiddleware(factories, config) {
|
|
13
|
-
const mw = [factories.offset(config.offset)];
|
|
14
|
-
if (!config.disableFlip) mw.push(factories.flip());
|
|
15
|
-
if (!config.disableShift) mw.push(factories.shift());
|
|
16
|
-
if (config.arrow && config.arrowEl) mw.push(factories.arrow({ element: config.arrowEl }));
|
|
17
|
-
return mw;
|
|
18
|
-
}
|
|
19
|
-
//#endregion
|
|
20
|
-
//#region src/Popover.tsx
|
|
21
|
-
__rozieInjectStyle("Popover-c6cf02ea", `.rozie-popover[data-rozie-s-c6cf02ea] {
|
|
22
|
-
display: contents;
|
|
23
|
-
}
|
|
24
|
-
.rozie-popover-anchor[data-rozie-s-c6cf02ea] {
|
|
25
|
-
display: inline-block;
|
|
26
|
-
}
|
|
27
|
-
.rozie-popover-floating[data-rozie-s-c6cf02ea] {
|
|
28
|
-
position: absolute;
|
|
29
|
-
left: 0;
|
|
30
|
-
top: 0;
|
|
31
|
-
z-index: var(--rozie-popover-z, 1000);
|
|
32
|
-
width: max-content;
|
|
33
|
-
max-width: var(--rozie-popover-max-width, calc(100vw - 16px));
|
|
34
|
-
background: var(--rozie-popover-bg, #fff);
|
|
35
|
-
color: var(--rozie-popover-color, inherit);
|
|
36
|
-
border: var(--rozie-popover-border, 1px solid rgba(0, 0, 0, 0.12));
|
|
37
|
-
border-radius: var(--rozie-popover-radius, 8px);
|
|
38
|
-
box-shadow: var(--rozie-popover-shadow, 0 8px 24px rgba(0, 0, 0, 0.12));
|
|
39
|
-
padding: var(--rozie-popover-padding, 8px 12px);
|
|
40
|
-
}
|
|
41
|
-
.rozie-popover-arrow[data-rozie-s-c6cf02ea] {
|
|
42
|
-
position: absolute;
|
|
43
|
-
width: var(--rozie-popover-arrow-size, 8px);
|
|
44
|
-
height: var(--rozie-popover-arrow-size, 8px);
|
|
45
|
-
background: var(--rozie-popover-bg, #fff);
|
|
46
|
-
border: var(--rozie-popover-border, 1px solid rgba(0, 0, 0, 0.12));
|
|
47
|
-
transform: rotate(45deg);
|
|
48
|
-
}`);
|
|
49
|
-
function Popover(_props) {
|
|
50
|
-
const [local, attrs] = splitProps(mergeProps({
|
|
51
|
-
placement: "bottom",
|
|
52
|
-
trigger: "click",
|
|
53
|
-
offset: 8,
|
|
54
|
-
disableFlip: false,
|
|
55
|
-
disableShift: false,
|
|
56
|
-
arrow: false,
|
|
57
|
-
disabled: false,
|
|
58
|
-
modal: false,
|
|
59
|
-
strategy: "absolute"
|
|
60
|
-
}, _props), [
|
|
61
|
-
"open",
|
|
62
|
-
"placement",
|
|
63
|
-
"trigger",
|
|
64
|
-
"offset",
|
|
65
|
-
"disableFlip",
|
|
66
|
-
"disableShift",
|
|
67
|
-
"arrow",
|
|
68
|
-
"disabled",
|
|
69
|
-
"modal",
|
|
70
|
-
"strategy",
|
|
71
|
-
"children",
|
|
72
|
-
"ref"
|
|
73
|
-
]);
|
|
74
|
-
const resolved = children(() => local.children);
|
|
75
|
-
onMount(() => {
|
|
76
|
-
local.ref?.({
|
|
77
|
-
show,
|
|
78
|
-
hide,
|
|
79
|
-
toggle,
|
|
80
|
-
reposition
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
const [open, setOpen] = createControllableSignal(_props, "open", false);
|
|
84
|
-
onMount(() => {
|
|
85
|
-
const _cleanup = (() => {
|
|
86
|
-
anchorNode = anchorElRef;
|
|
87
|
-
if (open() && !local.disabled) {
|
|
88
|
-
floatingNode = floatingElRef;
|
|
89
|
-
arrowNode = arrowElRef;
|
|
90
|
-
startTracking();
|
|
91
|
-
}
|
|
92
|
-
})();
|
|
93
|
-
if (_cleanup) onCleanup(_cleanup);
|
|
94
|
-
onCleanup(() => {
|
|
95
|
-
stopTracking();
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
createEffect(on(() => open(), (v) => untrack(() => ((isOpen) => {
|
|
99
|
-
if (isOpen && !local.disabled) queueMicrotask(() => {
|
|
100
|
-
if (!open() || local.disabled) return;
|
|
101
|
-
floatingNode = floatingElRef;
|
|
102
|
-
arrowNode = arrowElRef;
|
|
103
|
-
startTracking();
|
|
104
|
-
});
|
|
105
|
-
else stopTracking();
|
|
106
|
-
})(v)), { defer: true }));
|
|
107
|
-
createEffect(on(() => local.placement, (v) => untrack(() => (() => {
|
|
108
|
-
if (open()) position();
|
|
109
|
-
})()), { defer: true }));
|
|
110
|
-
createEffect(on(() => local.offset, (v) => untrack(() => (() => {
|
|
111
|
-
if (open()) position();
|
|
112
|
-
})()), { defer: true }));
|
|
113
|
-
createEffect(on(() => local.disableFlip, (v) => untrack(() => (() => {
|
|
114
|
-
if (open()) position();
|
|
115
|
-
})()), { defer: true }));
|
|
116
|
-
createEffect(on(() => local.disableShift, (v) => untrack(() => (() => {
|
|
117
|
-
if (open()) position();
|
|
118
|
-
})()), { defer: true }));
|
|
119
|
-
createEffect(on(() => local.strategy, (v) => untrack(() => (() => {
|
|
120
|
-
if (open()) position();
|
|
121
|
-
})()), { defer: true }));
|
|
122
|
-
let anchorElRef = null;
|
|
123
|
-
let floatingElRef = null;
|
|
124
|
-
let arrowElRef = null;
|
|
125
|
-
let anchorNode = null;
|
|
126
|
-
let floatingNode = null;
|
|
127
|
-
let arrowNode = null;
|
|
128
|
-
let stopAutoUpdate = null;
|
|
129
|
-
let lastFocusedEl = null;
|
|
130
|
-
function deepActiveElement() {
|
|
131
|
-
let el = document.activeElement;
|
|
132
|
-
while (el && el.shadowRoot && el.shadowRoot.activeElement) el = el.shadowRoot.activeElement;
|
|
133
|
-
return el;
|
|
134
|
-
}
|
|
135
|
-
function requestOpen(next) {
|
|
136
|
-
if (open() === next) return;
|
|
137
|
-
if (next && local.trigger === "click") lastFocusedEl = deepActiveElement();
|
|
138
|
-
setOpen(next);
|
|
139
|
-
_props.onChange?.(next);
|
|
140
|
-
if (!next && local.trigger === "click" && lastFocusedEl && lastFocusedEl.isConnected && typeof lastFocusedEl.focus === "function") lastFocusedEl.focus();
|
|
141
|
-
if (!next) lastFocusedEl = null;
|
|
142
|
-
}
|
|
143
|
-
function applyPosition(x, y, middlewareData) {
|
|
144
|
-
if (!floatingNode) return;
|
|
145
|
-
floatingNode.style.left = x + "px";
|
|
146
|
-
floatingNode.style.top = y + "px";
|
|
147
|
-
if (arrowNode && middlewareData && middlewareData.arrow) {
|
|
148
|
-
const ax = middlewareData.arrow.x;
|
|
149
|
-
const ay = middlewareData.arrow.y;
|
|
150
|
-
arrowNode.style.left = ax == null ? "" : ax + "px";
|
|
151
|
-
arrowNode.style.top = ay == null ? "" : ay + "px";
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
function position() {
|
|
155
|
-
if (!anchorNode || !floatingNode) return;
|
|
156
|
-
const middleware = buildMiddleware({
|
|
157
|
-
offset,
|
|
158
|
-
flip,
|
|
159
|
-
shift,
|
|
160
|
-
arrow
|
|
161
|
-
}, {
|
|
162
|
-
offset: local.offset,
|
|
163
|
-
disableFlip: local.disableFlip,
|
|
164
|
-
disableShift: local.disableShift,
|
|
165
|
-
arrow: local.arrow,
|
|
166
|
-
arrowEl: arrowNode
|
|
167
|
-
});
|
|
168
|
-
if (local.strategy === "fixed") floatingNode.style.position = "fixed";
|
|
169
|
-
else floatingNode.style.position = "";
|
|
170
|
-
let opts = null;
|
|
171
|
-
opts = {
|
|
172
|
-
placement: local.placement,
|
|
173
|
-
strategy: local.strategy,
|
|
174
|
-
middleware
|
|
175
|
-
};
|
|
176
|
-
computePosition(anchorNode, floatingNode, opts).then((result) => {
|
|
177
|
-
applyPosition(result.x, result.y, result.middlewareData);
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
function startTracking() {
|
|
181
|
-
if (!anchorNode || !floatingNode) return;
|
|
182
|
-
if (stopAutoUpdate) {
|
|
183
|
-
stopAutoUpdate();
|
|
184
|
-
stopAutoUpdate = null;
|
|
185
|
-
}
|
|
186
|
-
stopAutoUpdate = autoUpdate(anchorNode, floatingNode, position);
|
|
187
|
-
}
|
|
188
|
-
function stopTracking() {
|
|
189
|
-
if (stopAutoUpdate) {
|
|
190
|
-
stopAutoUpdate();
|
|
191
|
-
stopAutoUpdate = null;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
function onAnchorClick() {
|
|
195
|
-
if (local.disabled) return;
|
|
196
|
-
requestOpen(!open());
|
|
197
|
-
}
|
|
198
|
-
function onAnchorPointerEnter() {
|
|
199
|
-
if (local.disabled) return;
|
|
200
|
-
requestOpen(true);
|
|
201
|
-
}
|
|
202
|
-
function onAnchorPointerLeave() {
|
|
203
|
-
if (local.disabled) return;
|
|
204
|
-
requestOpen(false);
|
|
205
|
-
}
|
|
206
|
-
function onAnchorFocus() {
|
|
207
|
-
if (local.disabled) return;
|
|
208
|
-
requestOpen(true);
|
|
209
|
-
}
|
|
210
|
-
function onAnchorBlur() {
|
|
211
|
-
if (local.disabled) return;
|
|
212
|
-
requestOpen(false);
|
|
213
|
-
}
|
|
214
|
-
function dismiss() {
|
|
215
|
-
requestOpen(false);
|
|
216
|
-
}
|
|
217
|
-
function isTooltip() {
|
|
218
|
-
return local.trigger === "hover" || local.trigger === "focus";
|
|
219
|
-
}
|
|
220
|
-
function floatingRole() {
|
|
221
|
-
return isTooltip() ? "tooltip" : local.modal ? "dialog" : void 0;
|
|
222
|
-
}
|
|
223
|
-
function show() {
|
|
224
|
-
if (!local.disabled) requestOpen(true);
|
|
225
|
-
}
|
|
226
|
-
function hide() {
|
|
227
|
-
requestOpen(false);
|
|
228
|
-
}
|
|
229
|
-
function toggle() {
|
|
230
|
-
if (!local.disabled) requestOpen(!open());
|
|
231
|
-
}
|
|
232
|
-
function reposition() {
|
|
233
|
-
position();
|
|
234
|
-
}
|
|
235
|
-
createEffect(() => {
|
|
236
|
-
if (!open()) return;
|
|
237
|
-
const _rozieHandler = ($event) => {
|
|
238
|
-
if ($event.key !== "Escape") return;
|
|
239
|
-
dismiss();
|
|
240
|
-
};
|
|
241
|
-
document.addEventListener("keydown", _rozieHandler);
|
|
242
|
-
onCleanup(() => document.removeEventListener("keydown", _rozieHandler));
|
|
243
|
-
});
|
|
244
|
-
createOutsideClick([() => anchorElRef, () => floatingElRef], dismiss, () => open());
|
|
245
|
-
return <>
|
|
246
|
-
<div {...attrs} class={"rozie-popover" + (attrs.class ? " " + attrs.class : "")} data-rozie-s-c6cf02ea="">
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
<div aria-haspopup="dialog" aria-expanded={!!open()} aria-describedby={rozieAttr(isTooltip() && open() ? "rozie-popover-floating" : null)} class={"rozie-popover-anchor"} ref={(el) => {
|
|
250
|
-
anchorElRef = el;
|
|
251
|
-
}} onClick={($event) => {
|
|
252
|
-
local.trigger === "click" && onAnchorClick();
|
|
253
|
-
}} onPointerEnter={($event) => {
|
|
254
|
-
local.trigger === "hover" && onAnchorPointerEnter();
|
|
255
|
-
}} onPointerLeave={($event) => {
|
|
256
|
-
local.trigger === "hover" && onAnchorPointerLeave();
|
|
257
|
-
}} onFocusIn={($event) => {
|
|
258
|
-
local.trigger === "focus" && onAnchorFocus();
|
|
259
|
-
}} onFocusOut={($event) => {
|
|
260
|
-
local.trigger === "focus" && onAnchorBlur();
|
|
261
|
-
}} data-rozie-s-c6cf02ea="">
|
|
262
|
-
{(_props.anchorSlot ?? _props.slots?.["anchor"])?.({
|
|
263
|
-
open: open(),
|
|
264
|
-
toggle,
|
|
265
|
-
show,
|
|
266
|
-
hide
|
|
267
|
-
})}
|
|
268
|
-
</div>
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
{<Show when={open() && !local.disabled}><div class={"rozie-popover-floating"} ref={(el) => {
|
|
272
|
-
floatingElRef = el;
|
|
273
|
-
}} id="rozie-popover-floating" role={rozieAttr(floatingRole())} aria-modal={!!(floatingRole() === "dialog")} data-rozie-s-c6cf02ea="">
|
|
274
|
-
{<Show when={local.arrow}><div class={"rozie-popover-arrow"} ref={(el) => {
|
|
275
|
-
arrowElRef = el;
|
|
276
|
-
}} data-rozie-s-c6cf02ea="" /></Show>}{resolved()}
|
|
277
|
-
</div></Show>}</div>
|
|
278
|
-
</>;
|
|
279
|
-
}
|
|
280
|
-
//#endregion
|
|
281
7
|
//#region src/DataTable.tsx
|
|
282
8
|
__rozieInjectStyle("DataTable-d5dcab4c", `.rozie-data-table[data-rozie-s-d5dcab4c] {
|
|
283
9
|
border-collapse: collapse;
|
|
@@ -1719,8 +1445,7 @@ function DataTable(_props) {
|
|
|
1719
1445
|
const base = pinStyle(colId);
|
|
1720
1446
|
if (isExpanderColumn(colId) && row && row.depth) {
|
|
1721
1447
|
const pad = "padding-left:" + (.5 + row.depth * 1.25) + "rem";
|
|
1722
|
-
|
|
1723
|
-
return base ? base + sep + pad : pad;
|
|
1448
|
+
return base ? base + pad : pad;
|
|
1724
1449
|
}
|
|
1725
1450
|
return base;
|
|
1726
1451
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rozie-ui/data-table-solid",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
@@ -46,13 +46,13 @@
|
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@solid-primitives/keyed": "^1.5.3",
|
|
49
|
-
"@rozie/runtime-solid": "0.
|
|
49
|
+
"@rozie/runtime-solid": "0.2.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"solid-js": "^1.8",
|
|
53
53
|
"@tanstack/table-core": "^8.21",
|
|
54
54
|
"@tanstack/virtual-core": "^3",
|
|
55
|
-
"@
|
|
55
|
+
"@rozie-ui/popover-solid": "^0.1.0"
|
|
56
56
|
},
|
|
57
57
|
"peerDependenciesMeta": {
|
|
58
58
|
"solid-js": {
|
|
@@ -64,13 +64,11 @@
|
|
|
64
64
|
"@tanstack/virtual-core": {
|
|
65
65
|
"optional": false
|
|
66
66
|
},
|
|
67
|
-
"@
|
|
67
|
+
"@rozie-ui/popover-solid": {
|
|
68
68
|
"optional": false
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
|
-
"devDependencies": {
|
|
72
|
-
"@floating-ui/dom": "^1.7.2"
|
|
73
|
-
},
|
|
71
|
+
"devDependencies": {},
|
|
74
72
|
"publishConfig": {
|
|
75
73
|
"access": "public"
|
|
76
74
|
},
|
package/src/Column.tsx
CHANGED
|
@@ -44,7 +44,7 @@ interface ColumnProps {
|
|
|
44
44
|
/**
|
|
45
45
|
* The table-core aggregation for this column inside a group-header cell. Either a built-in name string — `'sum'` | `'min'` | `'max'` | `'extent'` | `'mean'` | `'median'` | `'unique'` | `'uniqueCount'` | `'count'` — or a custom function `(columnId, leafRows, childRows) => any` (defensively wrapped by the parent so a throw cannot crash grouping). Null → no aggregation (the group-header cell renders as a placeholder).
|
|
46
46
|
*/
|
|
47
|
-
aggregationFn?: (string | ((...args:
|
|
47
|
+
aggregationFn?: (string | ((...args: any[]) => any)) | null;
|
|
48
48
|
/**
|
|
49
49
|
* Whether this column's cells are editable (opt-in). Default `false` → the column is read-only and the display↔editor branch never mounts an editor. Bind `:editable="true"` (a bare attr only coerces on Vue+Lit).
|
|
50
50
|
*/
|
|
@@ -60,11 +60,11 @@ interface ColumnProps {
|
|
|
60
60
|
/**
|
|
61
61
|
* Synchronous per-column validator `(value, row) => true | string`. A string return is the error message (the editor stays open and the aria-live region announces it). Null → no validation. The parent wraps it defensively against a thrown/non-bool/non-string return.
|
|
62
62
|
*/
|
|
63
|
-
validate?: ((...args:
|
|
63
|
+
validate?: ((...args: any[]) => any) | null;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
export default function Column(_props: ColumnProps): JSX.Element {
|
|
67
|
-
const _merged = mergeProps({ id: '', field: '', header: '', sortable: false, filterable: false, pinned: '', width: '', expandable: false, groupable: true, aggregationFn: null, editable: false, editor: 'text', editorOptions: (() => [])(), validate: null }, _props);
|
|
67
|
+
const _merged = mergeProps({ id: '', field: '', header: '', sortable: false, filterable: false, pinned: '', width: '', expandable: false, groupable: true, aggregationFn: null, editable: false, editor: 'text', editorOptions: (() => [])() as any[], validate: null }, _props);
|
|
68
68
|
const [local, attrs] = splitProps(_merged, ['id', 'field', 'header', 'sortable', 'filterable', 'pinned', 'width', 'expandable', 'groupable', 'aggregationFn', 'editable', 'editor', 'editorOptions', 'validate']);
|
|
69
69
|
|
|
70
70
|
const registry = useContext(rozieContext("data-table:columns"));
|
package/src/DataTable.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import type { JSX } from 'solid-js';
|
|
|
2
2
|
import { Show, createEffect, createSignal, mergeProps, on, onCleanup, onMount, splitProps, untrack } from 'solid-js';
|
|
3
3
|
import { Key } from '@solid-primitives/keyed';
|
|
4
4
|
import { __rozieInjectStyle, createControllableSignal, parseInlineStyle, rozieAttr, rozieClass, rozieContext, rozieDisplay } from '@rozie/runtime-solid';
|
|
5
|
-
import Popover from '
|
|
5
|
+
import Popover from '@rozie-ui/popover-solid';
|
|
6
6
|
import { createTable, getCoreRowModel, getSortedRowModel, getFilteredRowModel, getPaginationRowModel, getExpandedRowModel, getGroupedRowModel,
|
|
7
7
|
// Faceted filtering (phase 50 reqs 8-9, D-03). All three are supplied UNCONDITIONALLY
|
|
8
8
|
// (mirrors the expand/group models) — inert until a consumer READS a column facet via the
|
|
@@ -23,11 +23,6 @@ getFacetedUniqueValues as makeFacetedUniqueValues, getFacetedMinMaxValues as mak
|
|
|
23
23
|
// by ALL virtual-core RUNTIME references sitting behind `if ($props.virtual)` / a `virtualizer`
|
|
24
24
|
// guard so they never execute when off — the import token is the only static virtual-core
|
|
25
25
|
// presence. NO per-framework adapter (the codegen guard forbids @tanstack/<fw>-virtual).
|
|
26
|
-
// Vertical row windowing (phase 53). A3: this static import line is emitted UNCONDITIONALLY
|
|
27
|
-
// (virtual-core is a peer dep the consumer installs); byte-identical-off (req-1) is satisfied
|
|
28
|
-
// by ALL virtual-core RUNTIME references sitting behind `if ($props.virtual)` / a `virtualizer`
|
|
29
|
-
// guard so they never execute when off — the import token is the only static virtual-core
|
|
30
|
-
// presence. NO per-framework adapter (the codegen guard forbids @tanstack/<fw>-virtual).
|
|
31
26
|
import { Virtualizer, elementScroll, observeElementRect, observeElementOffset, measureElement } from '@tanstack/virtual-core';
|
|
32
27
|
|
|
33
28
|
// table-core instance — top-level `let` referenced from hooks → React hoists to
|
|
@@ -425,7 +420,7 @@ interface DataTableProps {
|
|
|
425
420
|
/**
|
|
426
421
|
* Table-level child-row accessor `(originalRow, index) => TData[] | undefined` that drives nested sub-rows. When supplied (with `expandable`), table-core flattens the hierarchy and the expand seam reveals depth-indented child rows. Null → the `#detail` scoped slot is the expand mode.
|
|
427
422
|
*/
|
|
428
|
-
getSubRows?: ((...args:
|
|
423
|
+
getSubRows?: ((...args: any[]) => any) | null;
|
|
429
424
|
/**
|
|
430
425
|
* Opt-in gate for the **headless `#groupBar`** host region. Default `false` is byte-identical-off. `getGroupedRowModel` is wired unconditionally (inert when `grouping` is empty), so grouping is driven by the `grouping` model; this flag only gates the consumer-facing group-bar surface (the component ships **no** built-in drag UI).
|
|
431
426
|
*/
|
|
@@ -565,7 +560,7 @@ export interface DataTableHandle {
|
|
|
565
560
|
}
|
|
566
561
|
|
|
567
562
|
export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
568
|
-
const _merged = mergeProps({ columns: (() => [])(), selectionMode: 'none', manual: false, rowCount: null, pageCount: null, expandable: false, getSubRows: null, groupable: false, stickyHeader: false, interactionMode: 'table', singleClickEdit: false, undoable: false, undoLimit: 100, virtual: false, estimateRowHeight: 40, maxHeight: '' }, _props);
|
|
563
|
+
const _merged = mergeProps({ columns: (() => [])() as any[], selectionMode: 'none', manual: false, rowCount: null, pageCount: null, expandable: false, getSubRows: null, groupable: false, stickyHeader: false, interactionMode: 'table', singleClickEdit: false, undoable: false, undoLimit: 100, virtual: false, estimateRowHeight: 40, maxHeight: '' }, _props);
|
|
569
564
|
const [local, attrs] = splitProps(_merged, ['data', 'columns', 'selectionMode', 'sorting', 'globalFilter', 'columnFilters', 'pagination', 'manual', 'rowCount', 'pageCount', 'expandable', 'expanded', 'getSubRows', 'groupable', 'grouping', 'rowSelection', 'columnVisibility', 'columnSizing', 'columnOrder', 'columnPinning', 'stickyHeader', 'interactionMode', 'singleClickEdit', 'undoable', 'undoLimit', 'virtual', 'estimateRowHeight', 'maxHeight', 'children', 'ref']);
|
|
570
565
|
const resolved = () => local.children;
|
|
571
566
|
onMount(() => { local.ref?.({ sortColumn, clearSorting, toggleRowExpanded, expandAll, collapseAll, getExpandedRows, applyGrouping, clearGrouping, getFacetedUniqueValues, getFacetedMinMaxValues, getColumnDefs, toggleAllRows, clearSelection, getSelectedRows, setPage, setRowsPerPage, toggleColumnVisibility, applyColumnOrder, resetColumnSizing, pinColumn, focusCell, getActiveCell, clearActiveCell, getRowIndexRelativeToPage, editCell, commitEditing, editRow, getSelectedRange, cut, undo, redo, canUndo, canRedo, clearHistory }); });
|
|
@@ -579,8 +574,8 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
579
574
|
pageIndex: 0,
|
|
580
575
|
pageSize: 10
|
|
581
576
|
}))());
|
|
582
|
-
const [expanded, setExpanded] = createControllableSignal<Record<string, any> | boolean>(_props as unknown as Record<string, unknown>, 'expanded', null);
|
|
583
|
-
const [grouping, setGrouping] = createControllableSignal<any[]>(_props as unknown as Record<string, unknown>, 'grouping', null);
|
|
577
|
+
const [expanded, setExpanded] = createControllableSignal<Record<string, any> | boolean | null>(_props as unknown as Record<string, unknown>, 'expanded', null);
|
|
578
|
+
const [grouping, setGrouping] = createControllableSignal<any[] | null>(_props as unknown as Record<string, unknown>, 'grouping', null);
|
|
584
579
|
const [rowSelection, setRowSelection] = createControllableSignal<Record<string, any>>(_props as unknown as Record<string, unknown>, 'rowSelection', (() => ({}))());
|
|
585
580
|
const [columnVisibility, setColumnVisibility] = createControllableSignal<Record<string, any>>(_props as unknown as Record<string, unknown>, 'columnVisibility', (() => ({}))());
|
|
586
581
|
const [columnSizing, setColumnSizing] = createControllableSignal<Record<string, any>>(_props as unknown as Record<string, unknown>, 'columnSizing', (() => ({}))());
|
|
@@ -2606,15 +2601,9 @@ export default function DataTable(_props: DataTableProps): JSX.Element {
|
|
|
2606
2601
|
function bodyCellStyle(row: any, colId: any) {
|
|
2607
2602
|
const base = pinStyle(colId);
|
|
2608
2603
|
if (isExpanderColumn(colId) && row && row.depth) {
|
|
2604
|
+
// Only the expander column indents (the tree affordance lives here).
|
|
2609
2605
|
const pad = 'padding-left:' + (0.5 + row.depth * 1.25) + 'rem';
|
|
2610
|
-
|
|
2611
|
-
// second ';' produces a `;;` empty declaration. Browsers tolerate that in a
|
|
2612
|
-
// raw style attribute (React/Vue/Svelte/Lit) and Solid's cssText path does
|
|
2613
|
-
// too, but Angular's [style] binding parses the string via ɵɵstyleMap and
|
|
2614
|
-
// DROPS the declaration following the empty one — so the depth padding-left
|
|
2615
|
-
// silently vanished on Angular only. Emit a single, well-formed separator.
|
|
2616
|
-
const sep = base.endsWith(';') ? '' : ';';
|
|
2617
|
-
return base ? base + sep + pad : pad;
|
|
2606
|
+
return base ? base + pad : pad;
|
|
2618
2607
|
}
|
|
2619
2608
|
return base;
|
|
2620
2609
|
}
|
package/src/EditorCheckbox.tsx
CHANGED
|
@@ -21,11 +21,11 @@ interface EditorCheckboxProps {
|
|
|
21
21
|
/**
|
|
22
22
|
* `(value) => void` — commit the cell. This editor immediately commits the boolean checked state on `@change`. Null-guarded at call sites.
|
|
23
23
|
*/
|
|
24
|
-
commit?: ((...args:
|
|
24
|
+
commit?: ((...args: any[]) => any) | null;
|
|
25
25
|
/**
|
|
26
26
|
* `() => void` — revert the edit (Escape). Null-guarded at call sites.
|
|
27
27
|
*/
|
|
28
|
-
cancel?: ((...args:
|
|
28
|
+
cancel?: ((...args: any[]) => any) | null;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export default function EditorCheckbox(_props: EditorCheckboxProps): JSX.Element {
|
package/src/EditorDate.tsx
CHANGED
|
@@ -21,11 +21,11 @@ interface EditorDateProps {
|
|
|
21
21
|
/**
|
|
22
22
|
* `(value) => void` — commit the cell with the ISO `YYYY-MM-DD` string (Enter / blur). Null-guarded at call sites.
|
|
23
23
|
*/
|
|
24
|
-
commit?: ((...args:
|
|
24
|
+
commit?: ((...args: any[]) => any) | null;
|
|
25
25
|
/**
|
|
26
26
|
* `() => void` — revert the edit (Escape). Null-guarded at call sites.
|
|
27
27
|
*/
|
|
28
|
-
cancel?: ((...args:
|
|
28
|
+
cancel?: ((...args: any[]) => any) | null;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export default function EditorDate(_props: EditorDateProps): JSX.Element {
|
package/src/EditorNumber.tsx
CHANGED
|
@@ -21,11 +21,11 @@ interface EditorNumberProps {
|
|
|
21
21
|
/**
|
|
22
22
|
* `(value) => void` — commit the cell. The draft is coerced with `Number()` at commit time; an empty/whitespace or non-numeric draft commits `null` (never `NaN`). Null-guarded at call sites.
|
|
23
23
|
*/
|
|
24
|
-
commit?: ((...args:
|
|
24
|
+
commit?: ((...args: any[]) => any) | null;
|
|
25
25
|
/**
|
|
26
26
|
* `() => void` — revert the edit (Escape). Null-guarded at call sites.
|
|
27
27
|
*/
|
|
28
|
-
cancel?: ((...args:
|
|
28
|
+
cancel?: ((...args: any[]) => any) | null;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export default function EditorNumber(_props: EditorNumberProps): JSX.Element {
|
package/src/EditorSelect.tsx
CHANGED
|
@@ -23,11 +23,11 @@ interface EditorSelectProps {
|
|
|
23
23
|
/**
|
|
24
24
|
* `(value) => void` — commit the cell with the selected value (Enter / blur). Null-guarded at call sites.
|
|
25
25
|
*/
|
|
26
|
-
commit?: ((...args:
|
|
26
|
+
commit?: ((...args: any[]) => any) | null;
|
|
27
27
|
/**
|
|
28
28
|
* `() => void` — revert the edit (Escape). Null-guarded at call sites.
|
|
29
29
|
*/
|
|
30
|
-
cancel?: ((...args:
|
|
30
|
+
cancel?: ((...args: any[]) => any) | null;
|
|
31
31
|
/**
|
|
32
32
|
* The select options — `[{ value, label }]`. Mirrors `<Column editorOptions>`.
|
|
33
33
|
*/
|
|
@@ -35,7 +35,7 @@ interface EditorSelectProps {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
export default function EditorSelect(_props: EditorSelectProps): JSX.Element {
|
|
38
|
-
const _merged = mergeProps({ columnId: '', column: null, row: null, value: null, commit: null, cancel: null, options: (() => [])() }, _props);
|
|
38
|
+
const _merged = mergeProps({ columnId: '', column: null, row: null, value: null, commit: null, cancel: null, options: (() => [])() as any[] }, _props);
|
|
39
39
|
const [local, attrs] = splitProps(_merged, ['columnId', 'column', 'row', 'value', 'commit', 'cancel', 'options']);
|
|
40
40
|
|
|
41
41
|
const [draft, setDraft] = createSignal('');
|
package/src/EditorText.tsx
CHANGED
|
@@ -21,11 +21,11 @@ interface EditorTextProps {
|
|
|
21
21
|
/**
|
|
22
22
|
* `(value) => void` — commit the edited cell value (from the `#editor` slot scope). Null-guarded at call sites.
|
|
23
23
|
*/
|
|
24
|
-
commit?: ((...args:
|
|
24
|
+
commit?: ((...args: any[]) => any) | null;
|
|
25
25
|
/**
|
|
26
26
|
* `() => void` — revert the edit and close the editor (from the `#editor` slot scope). Null-guarded at call sites.
|
|
27
27
|
*/
|
|
28
|
-
cancel?: ((...args:
|
|
28
|
+
cancel?: ((...args: any[]) => any) | null;
|
|
29
29
|
/**
|
|
30
30
|
* Focus this editor's primary input when true — the host sets it for the one editor that should hold focus; reactive.
|
|
31
31
|
*/
|
|
@@ -18,7 +18,7 @@ interface FilterNumberRangeProps {
|
|
|
18
18
|
/**
|
|
19
19
|
* `(columnId, value) => void` — apply the column filter as a `[min, max]` tuple (each side coerced to a Number or `undefined`, so a one-sided range works); both empty clears the filter. Null-guarded at call sites.
|
|
20
20
|
*/
|
|
21
|
-
setFilter?: ((...args:
|
|
21
|
+
setFilter?: ((...args: any[]) => any) | null;
|
|
22
22
|
/**
|
|
23
23
|
* The faceted `[min, max]` bounds for this column (`[number, number]` or null) — drives the input placeholders only.
|
|
24
24
|
*/
|
package/src/FilterSelect.tsx
CHANGED
|
@@ -19,7 +19,7 @@ interface FilterSelectProps {
|
|
|
19
19
|
/**
|
|
20
20
|
* `(columnId, value) => void` — apply the column filter on change; the leading empty "All" option clears it. Null-guarded at call sites.
|
|
21
21
|
*/
|
|
22
|
-
setFilter?: ((...args:
|
|
22
|
+
setFilter?: ((...args: any[]) => any) | null;
|
|
23
23
|
/**
|
|
24
24
|
* The faceted distinct keys for this column (cross-filtered, keys only — no occurrence counts) used to build the `<option>` list.
|
|
25
25
|
*/
|
|
@@ -27,7 +27,7 @@ interface FilterSelectProps {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
export default function FilterSelect(_props: FilterSelectProps): JSX.Element {
|
|
30
|
-
const _merged = mergeProps({ columnId: '', column: null, value: null, setFilter: null, uniqueValues: (() => [])() }, _props);
|
|
30
|
+
const _merged = mergeProps({ columnId: '', column: null, value: null, setFilter: null, uniqueValues: (() => [])() as any[] }, _props);
|
|
31
31
|
const [local, attrs] = splitProps(_merged, ['columnId', 'column', 'value', 'setFilter', 'uniqueValues']);
|
|
32
32
|
|
|
33
33
|
// The <select> value binding coerced to a string. $props.value is typed `unknown`
|
package/src/FilterText.tsx
CHANGED
|
@@ -17,7 +17,7 @@ interface FilterTextProps {
|
|
|
17
17
|
/**
|
|
18
18
|
* `(columnId, value) => void` — apply the column filter (Enter / blur applies, Escape clears). Null-guarded at call sites.
|
|
19
19
|
*/
|
|
20
|
-
setFilter?: ((...args:
|
|
20
|
+
setFilter?: ((...args: any[]) => any) | null;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export default function FilterText(_props: FilterTextProps): JSX.Element {
|
package/src/GroupBar.tsx
CHANGED
|
@@ -73,15 +73,15 @@ interface GroupBarProps {
|
|
|
73
73
|
/**
|
|
74
74
|
* `(cols: string[]) => void` — the only add/reorder writer for the grouping order. Null-guarded at call sites.
|
|
75
75
|
*/
|
|
76
|
-
applyGrouping?: ((...args:
|
|
76
|
+
applyGrouping?: ((...args: any[]) => any) | null;
|
|
77
77
|
/**
|
|
78
78
|
* `() => void` — the only clear writer; resets grouping to empty. Null-guarded at call sites.
|
|
79
79
|
*/
|
|
80
|
-
clearGrouping?: ((...args:
|
|
80
|
+
clearGrouping?: ((...args: any[]) => any) | null;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
export default function GroupBar(_props: GroupBarProps): JSX.Element {
|
|
84
|
-
const _merged = mergeProps({ grouping: (() => [])(), groupableColumns: (() => [])(), applyGrouping: null, clearGrouping: null }, _props);
|
|
84
|
+
const _merged = mergeProps({ grouping: (() => [])() as any[], groupableColumns: (() => [])() as any[], applyGrouping: null, clearGrouping: null }, _props);
|
|
85
85
|
const [local, attrs] = splitProps(_merged, ['grouping', 'groupableColumns', 'applyGrouping', 'clearGrouping']);
|
|
86
86
|
|
|
87
87
|
const [draggingId, setDraggingId] = createSignal('');
|