@gridui/data-explorer 1.3.0 → 1.5.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 +79 -12
- package/dist/data-explorer/data-explorer.d.ts +1 -0
- package/dist/data-explorer-bulk-actions/data-explorer-bulk-actions.d.ts +4 -2
- package/dist/data-explorer-column-visibility/data-explorer-column-visibility.d.ts +11 -0
- package/dist/data-explorer-filter-control/data-explorer-filter-control.d.ts +11 -0
- package/dist/data-explorer-filters/data-explorer-filters.d.ts +11 -0
- package/dist/{data-explorer-toolbar → data-explorer-filters}/filter-editor.d.ts +1 -1
- package/dist/data-explorer-pagination/data-explorer-pagination.d.ts +4 -2
- package/dist/data-explorer-provider/data-explorer-provider.d.ts +13 -0
- package/dist/data-explorer-search/data-explorer-search.d.ts +11 -0
- package/dist/data-explorer-sort/data-explorer-sort.d.ts +11 -0
- package/dist/data-explorer-table/data-explorer-table.d.ts +4 -2
- package/dist/data-explorer-toolbar/data-explorer-toolbar.d.ts +5 -3
- package/dist/data-explorer-view/data-explorer-view.d.ts +12 -0
- package/dist/{data-explorer → data-explorer-view}/style.d.ts +1 -1
- package/dist/index.d.ts +17 -0
- package/dist/index.js +314 -372
- package/dist/index.js.map +4 -4
- package/dist/shared/controller.d.ts +32 -0
- package/dist/shared/explorer-context.d.ts +126 -71
- package/dist/shared/explorer-options.d.ts +22 -18
- package/dist/{data-explorer-toolbar/style.d.ts → shared/label-style.d.ts} +2 -2
- package/dist/shared/labels.d.ts +8 -0
- package/dist/styled.js +8 -0
- package/dist/styles.css +2911 -0
- package/dist/styles.local.css +114 -0
- package/docs/catalog.json +99 -1
- package/docs/reference/README.md +7 -0
- package/docs/reference/data-explorer-bulk-actions.md +4 -0
- package/docs/reference/data-explorer-column-visibility.md +27 -0
- package/docs/reference/data-explorer-filter-control.md +27 -0
- package/docs/reference/data-explorer-filters.md +23 -0
- package/docs/reference/data-explorer-pagination.md +4 -0
- package/docs/reference/data-explorer-provider.md +97 -0
- package/docs/reference/data-explorer-search.md +27 -0
- package/docs/reference/data-explorer-sort.md +27 -0
- package/docs/reference/data-explorer-table.md +4 -0
- package/docs/reference/data-explorer-toolbar.md +6 -0
- package/docs/reference/data-explorer-view.md +59 -0
- package/docs/reference/data-explorer.md +1 -1
- package/package.json +33 -15
package/dist/index.js
CHANGED
|
@@ -114,60 +114,88 @@ var resolveExplorerWidth = (column, width = column.width ?? 200) => {
|
|
|
114
114
|
return Math.max(min, Math.min(max, width));
|
|
115
115
|
};
|
|
116
116
|
|
|
117
|
-
// src/shared/
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
117
|
+
// src/shared/controller.ts
|
|
118
|
+
var createExplorerController = (options) => {
|
|
119
|
+
const {
|
|
120
|
+
rows,
|
|
121
|
+
columns,
|
|
122
|
+
state,
|
|
123
|
+
onStateChange,
|
|
124
|
+
filter,
|
|
125
|
+
pageSize = 10,
|
|
126
|
+
selectedIds = [],
|
|
127
|
+
onSelectionChange,
|
|
128
|
+
busy = false,
|
|
129
|
+
columnSettings
|
|
130
|
+
} = options;
|
|
122
131
|
const view = selectExplorerRows(rows, columns, state, pageSize, filter);
|
|
123
|
-
const existingRowIds = new Set(rows.map((row) =>
|
|
124
|
-
|
|
125
|
-
}));
|
|
126
|
-
const selectedRowIdSet = new Set(selectedIds.filter((id) => {
|
|
127
|
-
return existingRowIds.has(id);
|
|
128
|
-
}));
|
|
132
|
+
const existingRowIds = new Set(rows.map((row) => row.id));
|
|
133
|
+
const selectedRowIdSet = new Set(selectedIds.filter((id) => existingRowIds.has(id)));
|
|
129
134
|
const selectedRowIds = [...selectedRowIdSet];
|
|
130
|
-
const pageIds = view.rows.map((row) =>
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
135
|
+
const pageIds = view.rows.map((row) => row.id);
|
|
136
|
+
const selectedPageCount = pageIds.filter((id) => selectedRowIdSet.has(id)).length;
|
|
137
|
+
const visibleColumns = columns.filter((column) => !columnSettings?.hiddenKeys.includes(column.key));
|
|
138
|
+
if (columns.length > 0 && visibleColumns.length === 0) {
|
|
139
|
+
throw new RangeError("DataExplorer needs at least one visible column.");
|
|
140
|
+
}
|
|
136
141
|
const updateState = (changes) => {
|
|
137
142
|
if (!busy) {
|
|
138
|
-
onStateChange({
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
143
|
+
onStateChange({ ...state, ...changes });
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
const setQuery = (query) => void updateState({ query, page: 0 });
|
|
147
|
+
const setFilterValue = (filterValue) => void updateState({ filterValue, page: 0 });
|
|
148
|
+
const setSort = (sort) => void updateState({ sort, page: 0 });
|
|
149
|
+
const setFilters = (filters) => void updateState({ filters, page: 0 });
|
|
150
|
+
const updateSelection = (ids) => {
|
|
151
|
+
if (!busy) {
|
|
152
|
+
onSelectionChange?.([...new Set(ids.filter((id) => existingRowIds.has(id)))]);
|
|
142
153
|
}
|
|
143
154
|
};
|
|
144
|
-
const visibleColumns = columns.filter((column) => {
|
|
145
|
-
return !columnSettings?.hiddenKeys.includes(column.key);
|
|
146
|
-
});
|
|
147
|
-
if (columns.length > 0 && visibleColumns.length === 0) {
|
|
148
|
-
throw new RangeError("DataExplorer needs at least one visible column.");
|
|
149
|
-
}
|
|
150
155
|
return {
|
|
151
|
-
...options,
|
|
152
156
|
busy,
|
|
153
|
-
|
|
157
|
+
state,
|
|
158
|
+
columns,
|
|
159
|
+
visibleColumns,
|
|
154
160
|
view,
|
|
155
161
|
selectedRowIds,
|
|
156
162
|
selectedRowIdSet,
|
|
157
163
|
pageIds,
|
|
158
164
|
selectedPageCount,
|
|
159
165
|
updateState,
|
|
160
|
-
|
|
166
|
+
setQuery,
|
|
167
|
+
setFilterValue,
|
|
168
|
+
setSort,
|
|
169
|
+
setFilters,
|
|
170
|
+
updateSelection
|
|
161
171
|
};
|
|
162
172
|
};
|
|
173
|
+
|
|
174
|
+
// src/shared/explorer-context.ts
|
|
175
|
+
import { createContext, useContext, useId } from "react";
|
|
176
|
+
var useExplorerController = (options) => {
|
|
177
|
+
const tableId = useId();
|
|
178
|
+
const controller = createExplorerController(options);
|
|
179
|
+
return { ...options, ...controller, tableId, controller };
|
|
180
|
+
};
|
|
163
181
|
var explorerContext = createContext(null);
|
|
164
182
|
var useExplorer = () => {
|
|
165
183
|
const explorer = useContext(explorerContext);
|
|
166
184
|
if (!explorer) {
|
|
167
|
-
throw new Error("DataExplorer parts require a DataExplorer.");
|
|
185
|
+
throw new Error("DataExplorer parts require a DataExplorerProvider or DataExplorer.");
|
|
168
186
|
}
|
|
169
187
|
return explorer;
|
|
170
188
|
};
|
|
189
|
+
var useDataExplorer = () => useExplorer().controller;
|
|
190
|
+
|
|
191
|
+
// src/shared/labels.ts
|
|
192
|
+
var explorerLabel = (labels, key) => {
|
|
193
|
+
const value = labels?.[key];
|
|
194
|
+
if (value === void 0) {
|
|
195
|
+
throw new Error(`DataExplorer requires the "${key}" label for this part.`);
|
|
196
|
+
}
|
|
197
|
+
return value;
|
|
198
|
+
};
|
|
171
199
|
|
|
172
200
|
// src/data-explorer-bulk-actions/data-explorer-bulk-actions.tsx
|
|
173
201
|
import { Button } from "@gridui/button";
|
|
@@ -175,7 +203,8 @@ import { Checkbox } from "@gridui/choice";
|
|
|
175
203
|
import { cn } from "@gridui/style-utils";
|
|
176
204
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
177
205
|
var DataExplorerBulkActions = (props) => {
|
|
178
|
-
const { actions = [], busy, labels, onSelectionChange, pageIds, selectedPageCount, selectedRowIds } = useExplorer();
|
|
206
|
+
const { actions = [], busy, labels: inheritedLabels, onSelectionChange, pageIds, selectedPageCount, selectedRowIds } = useExplorer();
|
|
207
|
+
const labels = { ...inheritedLabels, ...props.labels };
|
|
179
208
|
if (!onSelectionChange) {
|
|
180
209
|
return null;
|
|
181
210
|
}
|
|
@@ -197,13 +226,13 @@ var DataExplorerBulkActions = (props) => {
|
|
|
197
226
|
}
|
|
198
227
|
),
|
|
199
228
|
" ",
|
|
200
|
-
labels
|
|
229
|
+
explorerLabel(labels, "selectPage")
|
|
201
230
|
] }),
|
|
202
231
|
/* @__PURE__ */ jsx(
|
|
203
232
|
"span",
|
|
204
233
|
{
|
|
205
234
|
role: "status",
|
|
206
|
-
children: labels
|
|
235
|
+
children: explorerLabel(labels, "selected")(selectedRowIds.length)
|
|
207
236
|
}
|
|
208
237
|
),
|
|
209
238
|
actions.map((action) => {
|
|
@@ -232,7 +261,8 @@ import { cva as cva2 } from "class-variance-authority";
|
|
|
232
261
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
233
262
|
var explorerFooterStyles = cva2("gridui-u-data-explorer--flex gridui-u-data-explorer--flex-wrap gridui-u-data-explorer--items-center gridui-u-data-explorer--justify-between gridui-u-data-explorer--gap-gridui-8 gridui-u-data-explorer--p-gridui-16");
|
|
234
263
|
var DataExplorerPagination = (props) => {
|
|
235
|
-
const { busy, labels, updateState, view } = useExplorer();
|
|
264
|
+
const { busy, labels: inheritedLabels, updateState, view } = useExplorer();
|
|
265
|
+
const labels = { ...inheritedLabels, ...props.labels };
|
|
236
266
|
return /* @__PURE__ */ jsxs2(
|
|
237
267
|
"div",
|
|
238
268
|
{
|
|
@@ -246,14 +276,14 @@ var DataExplorerPagination = (props) => {
|
|
|
246
276
|
onClick: () => {
|
|
247
277
|
updateState({ page: view.page - 1 });
|
|
248
278
|
},
|
|
249
|
-
children: labels
|
|
279
|
+
children: explorerLabel(labels, "previous")
|
|
250
280
|
}
|
|
251
281
|
),
|
|
252
282
|
/* @__PURE__ */ jsx2(
|
|
253
283
|
"span",
|
|
254
284
|
{
|
|
255
285
|
role: "status",
|
|
256
|
-
children: labels
|
|
286
|
+
children: explorerLabel(labels, "page")(view.page + 1, view.pageCount, view.total)
|
|
257
287
|
}
|
|
258
288
|
),
|
|
259
289
|
/* @__PURE__ */ jsx2(
|
|
@@ -264,7 +294,7 @@ var DataExplorerPagination = (props) => {
|
|
|
264
294
|
onClick: () => {
|
|
265
295
|
updateState({ page: view.page + 1 });
|
|
266
296
|
},
|
|
267
|
-
children: labels
|
|
297
|
+
children: explorerLabel(labels, "next")
|
|
268
298
|
}
|
|
269
299
|
)
|
|
270
300
|
]
|
|
@@ -272,6 +302,13 @@ var DataExplorerPagination = (props) => {
|
|
|
272
302
|
);
|
|
273
303
|
};
|
|
274
304
|
|
|
305
|
+
// src/data-explorer-provider/data-explorer-provider.tsx
|
|
306
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
307
|
+
function DataExplorerProvider({ children, ...options }) {
|
|
308
|
+
const explorer = useExplorerController(options);
|
|
309
|
+
return /* @__PURE__ */ jsx3(explorerContext.Provider, { value: explorer, children });
|
|
310
|
+
}
|
|
311
|
+
|
|
275
312
|
// src/data-explorer-table/column-layout.ts
|
|
276
313
|
var calculateStickyOffset = (columns, index) => {
|
|
277
314
|
const side = columns[index].column.sticky;
|
|
@@ -320,53 +357,28 @@ var calculateColumnLayout = (options) => {
|
|
|
320
357
|
};
|
|
321
358
|
|
|
322
359
|
// src/data-explorer-table/column-resize-handle.tsx
|
|
323
|
-
import { isComposingKeyEvent
|
|
324
|
-
import {
|
|
325
|
-
import {
|
|
360
|
+
import { isComposingKeyEvent } from "@gridui/interaction";
|
|
361
|
+
import { usePointerDrag } from "@gridui/react-utils";
|
|
362
|
+
import { useEffect } from "react";
|
|
363
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
326
364
|
var ColumnResizeHandle = (props) => {
|
|
327
365
|
const { column, width, label, disabled, onChange } = props;
|
|
328
|
-
const handle = useRef(null);
|
|
329
|
-
const drag = useRef(null);
|
|
330
366
|
const min = column.minWidth ?? 80;
|
|
331
367
|
const max = column.maxWidth ?? 1200;
|
|
332
368
|
const change = (next) => {
|
|
333
369
|
onChange(resolveExplorerWidth(column, Math.max(min, Math.min(max, next))));
|
|
334
370
|
};
|
|
335
|
-
const
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
if (current) {
|
|
339
|
-
current.cleanup();
|
|
340
|
-
change(current.width);
|
|
341
|
-
if (handle.current?.hasPointerCapture(current.pointer)) {
|
|
342
|
-
handle.current.releasePointerCapture(current.pointer);
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
};
|
|
346
|
-
const cancelLatest = useRef(cancelDrag);
|
|
347
|
-
useLayoutEffect(() => {
|
|
348
|
-
cancelLatest.current = cancelDrag;
|
|
349
|
-
});
|
|
371
|
+
const drag = usePointerDrag((current) => {
|
|
372
|
+
change(current.width);
|
|
373
|
+
}, { onUnmount: "finish" });
|
|
350
374
|
useEffect(() => {
|
|
351
375
|
if (disabled) {
|
|
352
|
-
|
|
376
|
+
drag.cancel();
|
|
353
377
|
}
|
|
354
|
-
}, [disabled]);
|
|
355
|
-
|
|
356
|
-
const element = handle.current;
|
|
357
|
-
return () => {
|
|
358
|
-
const current = drag.current;
|
|
359
|
-
drag.current = null;
|
|
360
|
-
current?.cleanup();
|
|
361
|
-
if (current && element?.hasPointerCapture(current.pointer)) {
|
|
362
|
-
element.releasePointerCapture(current.pointer);
|
|
363
|
-
}
|
|
364
|
-
};
|
|
365
|
-
}, []);
|
|
366
|
-
return /* @__PURE__ */ jsx3(
|
|
378
|
+
}, [disabled, drag]);
|
|
379
|
+
return /* @__PURE__ */ jsx4(
|
|
367
380
|
"div",
|
|
368
381
|
{
|
|
369
|
-
ref: handle,
|
|
370
382
|
role: "separator",
|
|
371
383
|
tabIndex: disabled ? -1 : 0,
|
|
372
384
|
"aria-orientation": "vertical",
|
|
@@ -377,47 +389,30 @@ var ColumnResizeHandle = (props) => {
|
|
|
377
389
|
"aria-disabled": disabled || void 0,
|
|
378
390
|
className: "gridui-explorer-resize gridui-u-data-explorer--min-h-11 gridui-u-data-explorer--w-gridui-16 gridui-u-data-explorer--shrink-0 gridui-u-data-explorer--cursor-col-resize gridui-u-data-explorer--touch-none gridui-u-data-explorer--border-s gridui-u-data-explorer--border-solid gridui-u-data-explorer--border-border",
|
|
379
391
|
onPointerDown: (event) => {
|
|
380
|
-
if (disabled ||
|
|
392
|
+
if (disabled || !drag.start(event, {
|
|
393
|
+
x: event.clientX,
|
|
394
|
+
width,
|
|
395
|
+
direction: getComputedStyle(event.currentTarget).direction === "rtl" ? -1 : 1
|
|
396
|
+
})) {
|
|
381
397
|
return;
|
|
382
398
|
}
|
|
383
399
|
event.preventDefault();
|
|
384
400
|
event.currentTarget.focus();
|
|
385
|
-
drag.current = {
|
|
386
|
-
pointer: event.pointerId,
|
|
387
|
-
x: event.clientX,
|
|
388
|
-
width,
|
|
389
|
-
direction: getComputedStyle(event.currentTarget).direction === "rtl" ? -1 : 1,
|
|
390
|
-
cleanup: listenForDragCancellation(event.currentTarget, () => {
|
|
391
|
-
cancelLatest.current();
|
|
392
|
-
})
|
|
393
|
-
};
|
|
394
|
-
event.currentTarget.setPointerCapture(event.pointerId);
|
|
395
401
|
},
|
|
396
402
|
onPointerMove: (event) => {
|
|
397
|
-
const current = drag.
|
|
398
|
-
if (!disabled && current
|
|
403
|
+
const current = drag.get(event.pointerId);
|
|
404
|
+
if (!disabled && current) {
|
|
399
405
|
change(current.width + (event.clientX - current.x) * current.direction);
|
|
400
406
|
}
|
|
401
407
|
},
|
|
402
408
|
onPointerUp: (event) => {
|
|
403
|
-
|
|
404
|
-
const current = drag.current;
|
|
405
|
-
drag.current = null;
|
|
406
|
-
current.cleanup();
|
|
407
|
-
if (event.currentTarget.hasPointerCapture(event.pointerId)) {
|
|
408
|
-
event.currentTarget.releasePointerCapture(event.pointerId);
|
|
409
|
-
}
|
|
410
|
-
}
|
|
409
|
+
drag.finish(event.pointerId);
|
|
411
410
|
},
|
|
412
411
|
onPointerCancel: (event) => {
|
|
413
|
-
|
|
414
|
-
cancelDrag();
|
|
415
|
-
}
|
|
412
|
+
drag.cancel(event.pointerId);
|
|
416
413
|
},
|
|
417
414
|
onLostPointerCapture: (event) => {
|
|
418
|
-
|
|
419
|
-
cancelDrag();
|
|
420
|
-
}
|
|
415
|
+
drag.cancel(event.pointerId);
|
|
421
416
|
},
|
|
422
417
|
onKeyDown: (event) => {
|
|
423
418
|
if (disabled || isComposingKeyEvent(event.nativeEvent) || ![
|
|
@@ -451,14 +446,14 @@ import { Split } from "@gridui/grid";
|
|
|
451
446
|
import { cn as cn3 } from "@gridui/style-utils";
|
|
452
447
|
import { DataTable } from "@gridui/table";
|
|
453
448
|
import { Children } from "react";
|
|
454
|
-
import { Fragment, jsx as
|
|
449
|
+
import { Fragment, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
455
450
|
var DataExplorerTable = (props) => {
|
|
456
|
-
const { className, ...presentation } = props;
|
|
451
|
+
const { className, labels: ownLabels, ...presentation } = props;
|
|
457
452
|
const {
|
|
458
453
|
busy,
|
|
459
454
|
columnSizing,
|
|
460
455
|
details,
|
|
461
|
-
labels,
|
|
456
|
+
labels: inheritedLabels,
|
|
462
457
|
notice,
|
|
463
458
|
onSelectionChange,
|
|
464
459
|
renderCell,
|
|
@@ -468,6 +463,7 @@ var DataExplorerTable = (props) => {
|
|
|
468
463
|
view,
|
|
469
464
|
visibleColumns
|
|
470
465
|
} = useExplorer();
|
|
466
|
+
const labels = { ...inheritedLabels, ...ownLabels };
|
|
471
467
|
const hasNotice = Children.toArray(notice).some((child) => {
|
|
472
468
|
return child !== "";
|
|
473
469
|
});
|
|
@@ -499,8 +495,8 @@ var DataExplorerTable = (props) => {
|
|
|
499
495
|
{
|
|
500
496
|
className: "gridui-u-data-explorer--flex gridui-u-data-explorer--min-w-0 gridui-u-data-explorer--items-center gridui-u-data-explorer--justify-between gridui-u-data-explorer--gap-gridui-8",
|
|
501
497
|
children: [
|
|
502
|
-
/* @__PURE__ */
|
|
503
|
-
/* @__PURE__ */
|
|
498
|
+
/* @__PURE__ */ jsx5("span", { children: column.label }),
|
|
499
|
+
/* @__PURE__ */ jsx5(
|
|
504
500
|
ColumnResizeHandle,
|
|
505
501
|
{
|
|
506
502
|
column,
|
|
@@ -524,7 +520,7 @@ var DataExplorerTable = (props) => {
|
|
|
524
520
|
if (onSelectionChange) {
|
|
525
521
|
tableColumns.unshift({
|
|
526
522
|
key: "control:selection",
|
|
527
|
-
label: labels
|
|
523
|
+
label: explorerLabel(labels, "selection"),
|
|
528
524
|
...fixedWidths ? { sizing: { width: selectionWidth } } : {}
|
|
529
525
|
});
|
|
530
526
|
}
|
|
@@ -547,10 +543,10 @@ var DataExplorerTable = (props) => {
|
|
|
547
543
|
return value ?? "";
|
|
548
544
|
});
|
|
549
545
|
if (onSelectionChange) {
|
|
550
|
-
cells.unshift(/* @__PURE__ */
|
|
546
|
+
cells.unshift(/* @__PURE__ */ jsx5(
|
|
551
547
|
Checkbox2,
|
|
552
548
|
{
|
|
553
|
-
"aria-label": labels
|
|
549
|
+
"aria-label": explorerLabel(labels, "selectRow")(row),
|
|
554
550
|
checked: selectedRowIdSet.has(row.id),
|
|
555
551
|
disabled: busy,
|
|
556
552
|
onCheckedChange: (checked) => {
|
|
@@ -563,7 +559,7 @@ var DataExplorerTable = (props) => {
|
|
|
563
559
|
}
|
|
564
560
|
if (details) {
|
|
565
561
|
const expanded = details.expandedIds.includes(row.id);
|
|
566
|
-
cells.unshift(/* @__PURE__ */
|
|
562
|
+
cells.unshift(/* @__PURE__ */ jsx5(
|
|
567
563
|
Button3,
|
|
568
564
|
{
|
|
569
565
|
variant: "quiet",
|
|
@@ -597,7 +593,7 @@ var DataExplorerTable = (props) => {
|
|
|
597
593
|
};
|
|
598
594
|
});
|
|
599
595
|
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
600
|
-
hasNotice && /* @__PURE__ */
|
|
596
|
+
hasNotice && /* @__PURE__ */ jsx5("div", { children: notice }),
|
|
601
597
|
/* @__PURE__ */ jsxs3(
|
|
602
598
|
Split,
|
|
603
599
|
{
|
|
@@ -605,11 +601,11 @@ var DataExplorerTable = (props) => {
|
|
|
605
601
|
"aria-busy": busy,
|
|
606
602
|
className: cn3(className),
|
|
607
603
|
children: [
|
|
608
|
-
/* @__PURE__ */
|
|
604
|
+
/* @__PURE__ */ jsx5("div", { children: /* @__PURE__ */ jsx5(
|
|
609
605
|
DataTable,
|
|
610
606
|
{
|
|
611
607
|
...presentation,
|
|
612
|
-
label: labels
|
|
608
|
+
label: explorerLabel(labels, "table"),
|
|
613
609
|
variant: "structured",
|
|
614
610
|
blockEdges: "none",
|
|
615
611
|
inlineEdges: "none",
|
|
@@ -624,11 +620,11 @@ var DataExplorerTable = (props) => {
|
|
|
624
620
|
} : {}
|
|
625
621
|
}
|
|
626
622
|
) }),
|
|
627
|
-
view.rows.length === 0 && !busy && /* @__PURE__ */
|
|
623
|
+
view.rows.length === 0 && !busy && /* @__PURE__ */ jsx5("div", { children: /* @__PURE__ */ jsx5(
|
|
628
624
|
"p",
|
|
629
625
|
{
|
|
630
626
|
className: "gridui-u-data-explorer--m-0 gridui-u-data-explorer--p-gridui-16",
|
|
631
|
-
children: labels
|
|
627
|
+
children: explorerLabel(labels, "empty")
|
|
632
628
|
}
|
|
633
629
|
) })
|
|
634
630
|
]
|
|
@@ -637,21 +633,73 @@ var DataExplorerTable = (props) => {
|
|
|
637
633
|
] });
|
|
638
634
|
};
|
|
639
635
|
|
|
640
|
-
// src/data-explorer-
|
|
636
|
+
// src/data-explorer-column-visibility/data-explorer-column-visibility.tsx
|
|
637
|
+
import { Checkbox as Checkbox3 } from "@gridui/choice";
|
|
638
|
+
import { cn as cn4 } from "@gridui/style-utils";
|
|
639
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
640
|
+
function DataExplorerColumnVisibility({ label, className }) {
|
|
641
|
+
const { busy, columnSettings, columns, visibleColumns } = useExplorer();
|
|
642
|
+
if (!columnSettings) {
|
|
643
|
+
return null;
|
|
644
|
+
}
|
|
645
|
+
return /* @__PURE__ */ jsxs4("details", { className: cn4("gridui-u-data-explorer--p-gridui-16", className), children: [
|
|
646
|
+
/* @__PURE__ */ jsx6("summary", { className: "gridui-u-data-explorer--cursor-pointer gridui-u-data-explorer--type-caption", children: label ?? columnSettings.label }),
|
|
647
|
+
/* @__PURE__ */ jsx6("div", { className: "gridui-u-data-explorer--flex gridui-u-data-explorer--flex-wrap gridui-u-data-explorer--gap-gridui-16 gridui-u-data-explorer--pt-gridui-16", children: columns.map((column) => {
|
|
648
|
+
const visible = !columnSettings.hiddenKeys.includes(column.key);
|
|
649
|
+
return /* @__PURE__ */ jsxs4("label", { className: "gridui-u-data-explorer--flex gridui-u-data-explorer--min-h-11 gridui-u-data-explorer--items-center gridui-u-data-explorer--gap-gridui-8", children: [
|
|
650
|
+
/* @__PURE__ */ jsx6(
|
|
651
|
+
Checkbox3,
|
|
652
|
+
{
|
|
653
|
+
checked: visible,
|
|
654
|
+
disabled: busy || visible && visibleColumns.length === 1,
|
|
655
|
+
onCheckedChange: (checked) => void columnSettings.onHiddenKeysChange(checked ? columnSettings.hiddenKeys.filter((key) => key !== column.key) : [.../* @__PURE__ */ new Set([...columnSettings.hiddenKeys, column.key])])
|
|
656
|
+
}
|
|
657
|
+
),
|
|
658
|
+
column.label
|
|
659
|
+
] }, column.key);
|
|
660
|
+
}) })
|
|
661
|
+
] });
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
// src/shared/label-style.ts
|
|
641
665
|
import { cva as cva3 } from "class-variance-authority";
|
|
642
666
|
var explorerLabelStyles = cva3("gridui-u-data-explorer--flex gridui-u-data-explorer--min-w-0 gridui-u-data-explorer--flex-[1_1_10rem] gridui-u-data-explorer--flex-col gridui-u-data-explorer--gap-gridui-4 gridui-u-data-explorer--text-muted gridui-u-data-explorer--type-caption");
|
|
643
667
|
|
|
644
|
-
// src/data-explorer-
|
|
668
|
+
// src/data-explorer-filter-control/data-explorer-filter-control.tsx
|
|
669
|
+
import { Select } from "@gridui/select";
|
|
670
|
+
import { cn as cn5 } from "@gridui/style-utils";
|
|
671
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
672
|
+
function DataExplorerFilterControl({ allLabel, className }) {
|
|
673
|
+
const { busy, filter, state, setFilterValue } = useExplorer();
|
|
674
|
+
if (!filter) {
|
|
675
|
+
return null;
|
|
676
|
+
}
|
|
677
|
+
return /* @__PURE__ */ jsxs5("label", { className: cn5(explorerLabelStyles(), className), children: [
|
|
678
|
+
filter.label,
|
|
679
|
+
/* @__PURE__ */ jsx7(
|
|
680
|
+
Select,
|
|
681
|
+
{
|
|
682
|
+
"aria-label": filter.label,
|
|
683
|
+
value: state.filterValue,
|
|
684
|
+
disabled: busy,
|
|
685
|
+
options: [{ value: "", label: allLabel }, ...filter.options],
|
|
686
|
+
onValueChange: setFilterValue
|
|
687
|
+
}
|
|
688
|
+
)
|
|
689
|
+
] });
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
// src/data-explorer-filters/filter-editor.tsx
|
|
645
693
|
import { Button as Button4 } from "@gridui/button";
|
|
646
694
|
import { Input } from "@gridui/input";
|
|
647
|
-
import { Select } from "@gridui/select";
|
|
648
|
-
import { useId as useId2, useRef
|
|
649
|
-
import { jsx as
|
|
695
|
+
import { Select as Select2 } from "@gridui/select";
|
|
696
|
+
import { useId as useId2, useRef } from "react";
|
|
697
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
650
698
|
var FilterEditor = (props) => {
|
|
651
699
|
const { filtering, conditions, disabled, onChange } = props;
|
|
652
700
|
const id = useId2();
|
|
653
|
-
const sequence =
|
|
654
|
-
const addButton =
|
|
701
|
+
const sequence = useRef(0);
|
|
702
|
+
const addButton = useRef(null);
|
|
655
703
|
const { definitions, labels } = filtering;
|
|
656
704
|
const first = definitions[0];
|
|
657
705
|
const change = (index, condition) => {
|
|
@@ -659,7 +707,7 @@ var FilterEditor = (props) => {
|
|
|
659
707
|
return currentIndex === index ? condition : current;
|
|
660
708
|
}));
|
|
661
709
|
};
|
|
662
|
-
return /* @__PURE__ */
|
|
710
|
+
return /* @__PURE__ */ jsxs6("div", { children: [
|
|
663
711
|
conditions.map((condition, index) => {
|
|
664
712
|
const definition = definitions.find((entry) => {
|
|
665
713
|
return entry.key === condition.key;
|
|
@@ -686,19 +734,19 @@ var FilterEditor = (props) => {
|
|
|
686
734
|
"empty"
|
|
687
735
|
];
|
|
688
736
|
}
|
|
689
|
-
return /* @__PURE__ */
|
|
737
|
+
return /* @__PURE__ */ jsxs6(
|
|
690
738
|
"div",
|
|
691
739
|
{
|
|
692
740
|
className: explorerControlRowStyles(),
|
|
693
741
|
children: [
|
|
694
|
-
/* @__PURE__ */
|
|
742
|
+
/* @__PURE__ */ jsxs6(
|
|
695
743
|
"label",
|
|
696
744
|
{
|
|
697
745
|
className: explorerLabelStyles(),
|
|
698
746
|
children: [
|
|
699
747
|
labels.field,
|
|
700
|
-
/* @__PURE__ */
|
|
701
|
-
|
|
748
|
+
/* @__PURE__ */ jsx8(
|
|
749
|
+
Select2,
|
|
702
750
|
{
|
|
703
751
|
"aria-label": labels.field,
|
|
704
752
|
disabled,
|
|
@@ -725,14 +773,14 @@ var FilterEditor = (props) => {
|
|
|
725
773
|
]
|
|
726
774
|
}
|
|
727
775
|
),
|
|
728
|
-
/* @__PURE__ */
|
|
776
|
+
/* @__PURE__ */ jsxs6(
|
|
729
777
|
"label",
|
|
730
778
|
{
|
|
731
779
|
className: explorerLabelStyles(),
|
|
732
780
|
children: [
|
|
733
781
|
labels.operator,
|
|
734
|
-
/* @__PURE__ */
|
|
735
|
-
|
|
782
|
+
/* @__PURE__ */ jsx8(
|
|
783
|
+
Select2,
|
|
736
784
|
{
|
|
737
785
|
"aria-label": labels.operator,
|
|
738
786
|
disabled,
|
|
@@ -759,14 +807,14 @@ var FilterEditor = (props) => {
|
|
|
759
807
|
]
|
|
760
808
|
}
|
|
761
809
|
),
|
|
762
|
-
condition.operator !== "empty" && /* @__PURE__ */
|
|
810
|
+
condition.operator !== "empty" && /* @__PURE__ */ jsxs6(
|
|
763
811
|
"label",
|
|
764
812
|
{
|
|
765
813
|
className: explorerLabelStyles(),
|
|
766
814
|
children: [
|
|
767
815
|
labels.value,
|
|
768
|
-
definition?.type === "enum" ? /* @__PURE__ */
|
|
769
|
-
|
|
816
|
+
definition?.type === "enum" ? /* @__PURE__ */ jsx8(
|
|
817
|
+
Select2,
|
|
770
818
|
{
|
|
771
819
|
"aria-label": labels.value,
|
|
772
820
|
disabled,
|
|
@@ -780,7 +828,7 @@ var FilterEditor = (props) => {
|
|
|
780
828
|
});
|
|
781
829
|
}
|
|
782
830
|
}
|
|
783
|
-
) : /* @__PURE__ */
|
|
831
|
+
) : /* @__PURE__ */ jsx8(
|
|
784
832
|
Input,
|
|
785
833
|
{
|
|
786
834
|
"aria-label": labels.value,
|
|
@@ -799,7 +847,7 @@ var FilterEditor = (props) => {
|
|
|
799
847
|
]
|
|
800
848
|
}
|
|
801
849
|
),
|
|
802
|
-
/* @__PURE__ */
|
|
850
|
+
/* @__PURE__ */ jsx8(
|
|
803
851
|
Button4,
|
|
804
852
|
{
|
|
805
853
|
variant: "quiet",
|
|
@@ -818,11 +866,11 @@ var FilterEditor = (props) => {
|
|
|
818
866
|
condition.id
|
|
819
867
|
);
|
|
820
868
|
}),
|
|
821
|
-
/* @__PURE__ */
|
|
869
|
+
/* @__PURE__ */ jsx8(
|
|
822
870
|
"div",
|
|
823
871
|
{
|
|
824
872
|
className: explorerControlRowStyles(),
|
|
825
|
-
children: /* @__PURE__ */
|
|
873
|
+
children: /* @__PURE__ */ jsx8(
|
|
826
874
|
Button4,
|
|
827
875
|
{
|
|
828
876
|
ref: addButton,
|
|
@@ -851,210 +899,111 @@ var FilterEditor = (props) => {
|
|
|
851
899
|
] });
|
|
852
900
|
};
|
|
853
901
|
|
|
854
|
-
// src/data-explorer-
|
|
855
|
-
import {
|
|
856
|
-
|
|
902
|
+
// src/data-explorer-filters/data-explorer-filters.tsx
|
|
903
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
904
|
+
function DataExplorerFilters({ labels }) {
|
|
905
|
+
const { busy, filtering, state, setFilters } = useExplorer();
|
|
906
|
+
if (!filtering) {
|
|
907
|
+
return null;
|
|
908
|
+
}
|
|
909
|
+
return /* @__PURE__ */ jsx9(
|
|
910
|
+
FilterEditor,
|
|
911
|
+
{
|
|
912
|
+
filtering: labels ? { ...filtering, labels } : filtering,
|
|
913
|
+
conditions: state.filters ?? [],
|
|
914
|
+
disabled: busy,
|
|
915
|
+
onChange: setFilters
|
|
916
|
+
}
|
|
917
|
+
);
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
// src/data-explorer-search/data-explorer-search.tsx
|
|
857
921
|
import { Input as Input2 } from "@gridui/input";
|
|
858
|
-
import {
|
|
859
|
-
import {
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
/* @__PURE__ */
|
|
865
|
-
|
|
922
|
+
import { cn as cn6 } from "@gridui/style-utils";
|
|
923
|
+
import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
924
|
+
function DataExplorerSearch({ label, className }) {
|
|
925
|
+
const { busy, state, setQuery } = useExplorer();
|
|
926
|
+
return /* @__PURE__ */ jsxs7("label", { className: cn6(explorerLabelStyles(), className), children: [
|
|
927
|
+
label,
|
|
928
|
+
/* @__PURE__ */ jsx10(
|
|
929
|
+
Input2,
|
|
866
930
|
{
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
/* @__PURE__ */ jsxs5(
|
|
870
|
-
"label",
|
|
871
|
-
{
|
|
872
|
-
className: explorerLabelStyles(),
|
|
873
|
-
children: [
|
|
874
|
-
labels.search,
|
|
875
|
-
/* @__PURE__ */ jsx6(
|
|
876
|
-
Input2,
|
|
877
|
-
{
|
|
878
|
-
type: "search",
|
|
879
|
-
value: state.query,
|
|
880
|
-
disabled: busy,
|
|
881
|
-
onValueChange: (query) => {
|
|
882
|
-
updateState({
|
|
883
|
-
query,
|
|
884
|
-
page: 0
|
|
885
|
-
});
|
|
886
|
-
}
|
|
887
|
-
}
|
|
888
|
-
)
|
|
889
|
-
]
|
|
890
|
-
}
|
|
891
|
-
),
|
|
892
|
-
filter && /* @__PURE__ */ jsxs5(
|
|
893
|
-
"label",
|
|
894
|
-
{
|
|
895
|
-
className: explorerLabelStyles(),
|
|
896
|
-
children: [
|
|
897
|
-
filter.label,
|
|
898
|
-
/* @__PURE__ */ jsx6(
|
|
899
|
-
Select2,
|
|
900
|
-
{
|
|
901
|
-
"aria-label": filter.label,
|
|
902
|
-
value: state.filterValue,
|
|
903
|
-
disabled: busy,
|
|
904
|
-
options: [
|
|
905
|
-
{
|
|
906
|
-
value: "",
|
|
907
|
-
label: labels.all
|
|
908
|
-
},
|
|
909
|
-
...filter.options
|
|
910
|
-
],
|
|
911
|
-
onValueChange: (filterValue) => {
|
|
912
|
-
updateState({
|
|
913
|
-
filterValue,
|
|
914
|
-
page: 0
|
|
915
|
-
});
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
)
|
|
919
|
-
]
|
|
920
|
-
}
|
|
921
|
-
),
|
|
922
|
-
/* @__PURE__ */ jsxs5(
|
|
923
|
-
"label",
|
|
924
|
-
{
|
|
925
|
-
className: explorerLabelStyles(),
|
|
926
|
-
children: [
|
|
927
|
-
labels.sort,
|
|
928
|
-
/* @__PURE__ */ jsx6(
|
|
929
|
-
Select2,
|
|
930
|
-
{
|
|
931
|
-
"aria-label": labels.sort,
|
|
932
|
-
value: state.sort?.key ?? "",
|
|
933
|
-
disabled: busy,
|
|
934
|
-
options: [
|
|
935
|
-
{
|
|
936
|
-
value: "",
|
|
937
|
-
label: labels.unsorted
|
|
938
|
-
},
|
|
939
|
-
...columns.map((column) => {
|
|
940
|
-
return {
|
|
941
|
-
value: column.key,
|
|
942
|
-
label: column.label
|
|
943
|
-
};
|
|
944
|
-
})
|
|
945
|
-
],
|
|
946
|
-
onValueChange: (key) => {
|
|
947
|
-
updateState({
|
|
948
|
-
sort: key ? {
|
|
949
|
-
key,
|
|
950
|
-
direction: "ascending"
|
|
951
|
-
} : null,
|
|
952
|
-
page: 0
|
|
953
|
-
});
|
|
954
|
-
}
|
|
955
|
-
}
|
|
956
|
-
)
|
|
957
|
-
]
|
|
958
|
-
}
|
|
959
|
-
),
|
|
960
|
-
/* @__PURE__ */ jsx6(
|
|
961
|
-
Button5,
|
|
962
|
-
{
|
|
963
|
-
variant: "secondary",
|
|
964
|
-
disabled: busy || !state.sort,
|
|
965
|
-
onClick: () => {
|
|
966
|
-
if (state.sort) {
|
|
967
|
-
updateState({
|
|
968
|
-
sort: {
|
|
969
|
-
...state.sort,
|
|
970
|
-
direction: state.sort.direction === "ascending" ? "descending" : "ascending"
|
|
971
|
-
},
|
|
972
|
-
page: 0
|
|
973
|
-
});
|
|
974
|
-
}
|
|
975
|
-
},
|
|
976
|
-
children: state.sort?.direction === "descending" ? labels.descending : labels.ascending
|
|
977
|
-
}
|
|
978
|
-
)
|
|
979
|
-
]
|
|
980
|
-
}
|
|
981
|
-
),
|
|
982
|
-
columnSettings && /* @__PURE__ */ jsxs5(
|
|
983
|
-
"details",
|
|
984
|
-
{
|
|
985
|
-
className: "gridui-u-data-explorer--p-gridui-16",
|
|
986
|
-
children: [
|
|
987
|
-
/* @__PURE__ */ jsx6(
|
|
988
|
-
"summary",
|
|
989
|
-
{
|
|
990
|
-
className: "gridui-u-data-explorer--cursor-pointer gridui-u-data-explorer--type-caption",
|
|
991
|
-
children: columnSettings.label
|
|
992
|
-
}
|
|
993
|
-
),
|
|
994
|
-
/* @__PURE__ */ jsx6(
|
|
995
|
-
"div",
|
|
996
|
-
{
|
|
997
|
-
className: "gridui-u-data-explorer--flex gridui-u-data-explorer--flex-wrap gridui-u-data-explorer--gap-gridui-16 gridui-u-data-explorer--pt-gridui-16",
|
|
998
|
-
children: columns.map((column) => {
|
|
999
|
-
const visible = !columnSettings.hiddenKeys.includes(column.key);
|
|
1000
|
-
return /* @__PURE__ */ jsxs5(
|
|
1001
|
-
"label",
|
|
1002
|
-
{
|
|
1003
|
-
className: "gridui-u-data-explorer--flex gridui-u-data-explorer--min-h-11 gridui-u-data-explorer--items-center gridui-u-data-explorer--gap-gridui-8",
|
|
1004
|
-
children: [
|
|
1005
|
-
/* @__PURE__ */ jsx6(
|
|
1006
|
-
Checkbox3,
|
|
1007
|
-
{
|
|
1008
|
-
checked: visible,
|
|
1009
|
-
disabled: busy || visible && visibleColumns.length === 1,
|
|
1010
|
-
onCheckedChange: (checked) => {
|
|
1011
|
-
columnSettings.onHiddenKeysChange(checked ? columnSettings.hiddenKeys.filter((key) => {
|
|
1012
|
-
return key !== column.key;
|
|
1013
|
-
}) : [
|
|
1014
|
-
.../* @__PURE__ */ new Set([
|
|
1015
|
-
...columnSettings.hiddenKeys,
|
|
1016
|
-
column.key
|
|
1017
|
-
])
|
|
1018
|
-
]);
|
|
1019
|
-
}
|
|
1020
|
-
}
|
|
1021
|
-
),
|
|
1022
|
-
column.label
|
|
1023
|
-
]
|
|
1024
|
-
},
|
|
1025
|
-
column.key
|
|
1026
|
-
);
|
|
1027
|
-
})
|
|
1028
|
-
}
|
|
1029
|
-
)
|
|
1030
|
-
]
|
|
1031
|
-
}
|
|
1032
|
-
),
|
|
1033
|
-
filtering && /* @__PURE__ */ jsx6(
|
|
1034
|
-
FilterEditor,
|
|
1035
|
-
{
|
|
1036
|
-
filtering,
|
|
1037
|
-
conditions: state.filters ?? [],
|
|
931
|
+
type: "search",
|
|
932
|
+
value: state.query,
|
|
1038
933
|
disabled: busy,
|
|
1039
|
-
|
|
1040
|
-
updateState({
|
|
1041
|
-
filters,
|
|
1042
|
-
page: 0
|
|
1043
|
-
});
|
|
1044
|
-
}
|
|
934
|
+
onValueChange: setQuery
|
|
1045
935
|
}
|
|
1046
936
|
)
|
|
1047
937
|
] });
|
|
1048
|
-
}
|
|
938
|
+
}
|
|
1049
939
|
|
|
1050
|
-
// src/data-explorer/
|
|
940
|
+
// src/data-explorer-sort/data-explorer-sort.tsx
|
|
941
|
+
import { Button as Button5 } from "@gridui/button";
|
|
942
|
+
import { Select as Select3 } from "@gridui/select";
|
|
943
|
+
import { cn as cn7 } from "@gridui/style-utils";
|
|
944
|
+
import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
945
|
+
function DataExplorerSort({ labels, className }) {
|
|
946
|
+
const { busy, columns, state, setSort } = useExplorer();
|
|
947
|
+
return /* @__PURE__ */ jsxs8(Fragment2, { children: [
|
|
948
|
+
/* @__PURE__ */ jsxs8("label", { className: cn7(explorerLabelStyles(), className), children: [
|
|
949
|
+
labels.sort,
|
|
950
|
+
/* @__PURE__ */ jsx11(
|
|
951
|
+
Select3,
|
|
952
|
+
{
|
|
953
|
+
"aria-label": labels.sort,
|
|
954
|
+
value: state.sort?.key ?? "",
|
|
955
|
+
disabled: busy,
|
|
956
|
+
options: [{ value: "", label: labels.unsorted }, ...columns.map((column) => ({ value: column.key, label: column.label }))],
|
|
957
|
+
onValueChange: (key) => void setSort(key ? { key, direction: "ascending" } : null)
|
|
958
|
+
}
|
|
959
|
+
)
|
|
960
|
+
] }),
|
|
961
|
+
/* @__PURE__ */ jsx11(Button5, { variant: "secondary", disabled: busy || !state.sort, onClick: () => {
|
|
962
|
+
if (state.sort) {
|
|
963
|
+
setSort({ ...state.sort, direction: state.sort.direction === "ascending" ? "descending" : "ascending" });
|
|
964
|
+
}
|
|
965
|
+
}, children: state.sort?.direction === "descending" ? labels.descending : labels.ascending })
|
|
966
|
+
] });
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
// src/data-explorer-toolbar/data-explorer-toolbar.tsx
|
|
970
|
+
import { cn as cn8 } from "@gridui/style-utils";
|
|
971
|
+
import { Fragment as Fragment3, jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
972
|
+
function DataExplorerToolbar({ className, children }) {
|
|
973
|
+
const { labels, filter } = useExplorer();
|
|
974
|
+
if (children !== void 0) {
|
|
975
|
+
return /* @__PURE__ */ jsx12("div", { className: cn8(explorerControlRowStyles(), className), children });
|
|
976
|
+
}
|
|
977
|
+
return /* @__PURE__ */ jsxs9(Fragment3, { children: [
|
|
978
|
+
/* @__PURE__ */ jsxs9("div", { className: cn8(explorerControlRowStyles(), className), children: [
|
|
979
|
+
/* @__PURE__ */ jsx12(DataExplorerSearch, { label: explorerLabel(labels, "search") }),
|
|
980
|
+
filter && /* @__PURE__ */ jsx12(DataExplorerFilterControl, { allLabel: explorerLabel(labels, "all") }),
|
|
981
|
+
/* @__PURE__ */ jsx12(DataExplorerSort, { labels: {
|
|
982
|
+
sort: explorerLabel(labels, "sort"),
|
|
983
|
+
unsorted: explorerLabel(labels, "unsorted"),
|
|
984
|
+
ascending: explorerLabel(labels, "ascending"),
|
|
985
|
+
descending: explorerLabel(labels, "descending")
|
|
986
|
+
} })
|
|
987
|
+
] }),
|
|
988
|
+
/* @__PURE__ */ jsx12(DataExplorerColumnVisibility, {}),
|
|
989
|
+
/* @__PURE__ */ jsx12(DataExplorerFilters, {})
|
|
990
|
+
] });
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
// src/data-explorer-view/style.ts
|
|
1051
994
|
import { cva as cva4 } from "class-variance-authority";
|
|
1052
995
|
var explorerStyles = cva4("gridui-u-data-explorer--min-w-0 gridui-u-data-explorer--border gridui-u-data-explorer--border-border gridui-u-data-explorer--bg-background gridui-u-data-explorer--text-foreground");
|
|
1053
996
|
|
|
1054
|
-
// src/data-explorer/data-explorer.tsx
|
|
997
|
+
// src/data-explorer-view/data-explorer-view.tsx
|
|
1055
998
|
import { Split as Split2 } from "@gridui/grid";
|
|
1056
|
-
import { cn as
|
|
1057
|
-
import {
|
|
999
|
+
import { cn as cn9 } from "@gridui/style-utils";
|
|
1000
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1001
|
+
function DataExplorerView({ label, className, children, ...rest }) {
|
|
1002
|
+
return /* @__PURE__ */ jsx13("section", { ...rest, "aria-label": label, className: cn9(explorerStyles(), className), children: /* @__PURE__ */ jsx13(Split2, { direction: "column", children }) });
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
// src/data-explorer/data-explorer.tsx
|
|
1006
|
+
import { Fragment as Fragment4, jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1058
1007
|
var DataExplorer = (props) => {
|
|
1059
1008
|
const {
|
|
1060
1009
|
rows,
|
|
@@ -1078,57 +1027,50 @@ var DataExplorer = (props) => {
|
|
|
1078
1027
|
children,
|
|
1079
1028
|
...restProps
|
|
1080
1029
|
} = props;
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
columns,
|
|
1084
|
-
state,
|
|
1085
|
-
onStateChange,
|
|
1086
|
-
filter,
|
|
1087
|
-
columnSettings,
|
|
1088
|
-
columnSizing,
|
|
1089
|
-
details,
|
|
1090
|
-
filtering,
|
|
1091
|
-
pageSize,
|
|
1092
|
-
selectedIds,
|
|
1093
|
-
onSelectionChange,
|
|
1094
|
-
actions,
|
|
1095
|
-
renderCell,
|
|
1096
|
-
busy,
|
|
1097
|
-
notice,
|
|
1098
|
-
labels
|
|
1099
|
-
});
|
|
1100
|
-
return /* @__PURE__ */ jsx7(
|
|
1101
|
-
explorerContext.Provider,
|
|
1030
|
+
return /* @__PURE__ */ jsx14(
|
|
1031
|
+
DataExplorerProvider,
|
|
1102
1032
|
{
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1033
|
+
...{
|
|
1034
|
+
rows,
|
|
1035
|
+
columns,
|
|
1036
|
+
state,
|
|
1037
|
+
onStateChange,
|
|
1038
|
+
filter,
|
|
1039
|
+
columnSettings,
|
|
1040
|
+
columnSizing,
|
|
1041
|
+
details,
|
|
1042
|
+
filtering,
|
|
1043
|
+
pageSize,
|
|
1044
|
+
selectedIds,
|
|
1045
|
+
onSelectionChange,
|
|
1046
|
+
actions,
|
|
1047
|
+
renderCell,
|
|
1048
|
+
busy,
|
|
1049
|
+
notice,
|
|
1050
|
+
labels
|
|
1051
|
+
},
|
|
1052
|
+
children: /* @__PURE__ */ jsx14(DataExplorerView, { ...restProps, label: labels.table, className, children: children ?? /* @__PURE__ */ jsxs10(Fragment4, { children: [
|
|
1053
|
+
/* @__PURE__ */ jsx14(DataExplorerToolbar, {}),
|
|
1054
|
+
/* @__PURE__ */ jsx14(DataExplorerBulkActions, {}),
|
|
1055
|
+
/* @__PURE__ */ jsx14(DataExplorerTable, {}),
|
|
1056
|
+
/* @__PURE__ */ jsx14(DataExplorerPagination, {})
|
|
1057
|
+
] }) })
|
|
1124
1058
|
}
|
|
1125
1059
|
);
|
|
1126
1060
|
};
|
|
1127
1061
|
export {
|
|
1128
1062
|
DataExplorer,
|
|
1129
1063
|
DataExplorerBulkActions,
|
|
1064
|
+
DataExplorerColumnVisibility,
|
|
1065
|
+
DataExplorerFilterControl,
|
|
1066
|
+
DataExplorerFilters,
|
|
1130
1067
|
DataExplorerPagination,
|
|
1068
|
+
DataExplorerProvider,
|
|
1069
|
+
DataExplorerSearch,
|
|
1070
|
+
DataExplorerSort,
|
|
1131
1071
|
DataExplorerTable,
|
|
1132
|
-
DataExplorerToolbar
|
|
1072
|
+
DataExplorerToolbar,
|
|
1073
|
+
DataExplorerView,
|
|
1074
|
+
useDataExplorer
|
|
1133
1075
|
};
|
|
1134
1076
|
//# sourceMappingURL=index.js.map
|