@vuu-ui/vuu-table 2.1.19-beta.1 → 2.1.19-beta.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/package.json +12 -13
- package/src/CellFocusState.mjs +25 -0
- package/src/Row.mjs +83 -0
- package/src/Table.css.js +441 -0
- package/src/Table.mjs +297 -0
- package/src/VirtualColSpan.mjs +12 -0
- package/src/applyHighlighting.mjs +28 -0
- package/src/bulk-edit/BulkEditPanel.css.js +27 -0
- package/src/bulk-edit/BulkEditPanel.mjs +77 -0
- package/src/bulk-edit/ColumnCascadingUpdateEditor.css.js +86 -0
- package/src/bulk-edit/ColumnCascadingUpdateEditor.mjs +59 -0
- package/src/bulk-edit/InsertNewRowEditor.css.js +86 -0
- package/src/bulk-edit/InsertNewRowEditor.mjs +59 -0
- package/src/bulk-edit/useBulkEditPanel.mjs +61 -0
- package/src/bulk-edit/useColumnCascadingEditor.mjs +124 -0
- package/src/cell-block/CellBlock.css.js +95 -0
- package/src/cell-block/CellBlock.mjs +32 -0
- package/src/cell-block/cellblock-utils.mjs +114 -0
- package/src/cell-block/useCellBlockSelection.mjs +245 -0
- package/src/cell-renderers/checkbox-cell/CheckboxCell.css.js +16 -0
- package/src/cell-renderers/checkbox-cell/CheckboxCell.mjs +56 -0
- package/src/cell-renderers/checkbox-cell/index.mjs +1 -0
- package/src/cell-renderers/checkbox-row-selector/CheckboxRowSelectorCell.css.js +19 -0
- package/src/cell-renderers/checkbox-row-selector/CheckboxRowSelectorCell.mjs +34 -0
- package/src/cell-renderers/checkbox-row-selector/index.mjs +1 -0
- package/src/cell-renderers/index.mjs +4 -0
- package/src/cell-renderers/input-cell/InputCell.css.js +81 -0
- package/src/cell-renderers/input-cell/InputCell.mjs +73 -0
- package/src/cell-renderers/input-cell/index.mjs +1 -0
- package/src/cell-renderers/input-cell/useInputCell.mjs +199 -0
- package/src/cell-renderers/toggle-cell/ToggleCell.css.js +31 -0
- package/src/cell-renderers/toggle-cell/ToggleCell.mjs +47 -0
- package/src/cell-renderers/toggle-cell/index.mjs +1 -0
- package/src/column-header-pill/ColumnHeaderPill.css.js +34 -0
- package/src/column-header-pill/ColumnHeaderPill.mjs +39 -0
- package/src/column-header-pill/GroupColumnPill.css.js +10 -0
- package/src/column-header-pill/GroupColumnPill.mjs +33 -0
- package/src/column-header-pill/SortIndicator.css.js +15 -0
- package/src/column-header-pill/SortIndicator.mjs +29 -0
- package/src/column-header-pill/index.mjs +3 -0
- package/src/column-resizing/ColumnResizer.css.js +32 -0
- package/src/column-resizing/ColumnResizer.mjs +69 -0
- package/src/column-resizing/index.mjs +2 -0
- package/src/column-resizing/useTableColumnResize.mjs +57 -0
- package/src/data-row/DataRow.mjs +298 -0
- package/src/header-cell/GroupHeaderCell.css.js +91 -0
- package/src/header-cell/GroupHeaderCell.mjs +98 -0
- package/src/header-cell/HeaderCell.css.js +182 -0
- package/src/header-cell/HeaderCell.mjs +126 -0
- package/src/header-cell/index.mjs +2 -0
- package/src/index.mjs +20 -0
- package/src/pagination/PaginationControl.css.js +18 -0
- package/src/pagination/PaginationControl.mjs +34 -0
- package/src/pagination/index.mjs +1 -0
- package/src/pagination/usePagination.mjs +29 -0
- package/src/table-cell/TableCell.css.js +67 -0
- package/src/table-cell/TableCell.mjs +54 -0
- package/src/table-cell/TableGroupCell.css.js +91 -0
- package/src/table-cell/TableGroupCell.mjs +61 -0
- package/src/table-cell/index.mjs +2 -0
- package/src/table-config/useTableConfig.mjs +49 -0
- package/src/table-config.mjs +38 -0
- package/src/table-data-source/DataRowMovingWindow.mjs +66 -0
- package/src/table-data-source/useDataSource.mjs +177 -0
- package/src/table-dom-utils.mjs +162 -0
- package/src/table-header/HeaderProvider.mjs +14 -0
- package/src/table-header/TableHeader.mjs +182 -0
- package/src/table-header/index.mjs +2 -0
- package/src/table-header/useTableHeader.mjs +69 -0
- package/src/useCell.mjs +22 -0
- package/src/useCellEditing.mjs +58 -0
- package/src/useCellFocus.mjs +112 -0
- package/src/useControlledTableNavigation.mjs +34 -0
- package/src/useEditableCell.mjs +18 -0
- package/src/useInitialValue.mjs +6 -0
- package/src/useKeyboardNavigation.mjs +275 -0
- package/src/useMeasuredHeight.mjs +44 -0
- package/src/useResizeObserver.mjs +118 -0
- package/src/useRowClassNameGenerators.mjs +21 -0
- package/src/useSelection.mjs +101 -0
- package/src/useTable.mjs +588 -0
- package/src/useTableContextMenu.mjs +54 -0
- package/src/useTableModel.mjs +344 -0
- package/src/useTableScroll.mjs +382 -0
- package/src/useTableViewport.mjs +120 -0
package/src/Table.mjs
ADDED
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useForkRef } from "@salt-ds/core";
|
|
3
|
+
import { useComponentCssInjection } from "@salt-ds/styles";
|
|
4
|
+
import { useWindow } from "@salt-ds/window";
|
|
5
|
+
import { TableProvider } from "@vuu-ui/vuu-table-extras";
|
|
6
|
+
import { MeasuredContainer, reduceSizeHeight } from "@vuu-ui/vuu-ui-controls";
|
|
7
|
+
import { lowerCase, useId } from "@vuu-ui/vuu-utils";
|
|
8
|
+
import clsx from "clsx";
|
|
9
|
+
import { forwardRef, useCallback, useMemo, useRef, useState } from "react";
|
|
10
|
+
import { Row as external_Row_mjs_Row } from "./Row.mjs";
|
|
11
|
+
import { PaginationControl } from "./pagination/index.mjs";
|
|
12
|
+
import { TableHeader } from "./table-header/index.mjs";
|
|
13
|
+
import { useMeasuredHeight } from "./useMeasuredHeight.mjs";
|
|
14
|
+
import { useTable } from "./useTable.mjs";
|
|
15
|
+
import Table_0 from "./Table.css";
|
|
16
|
+
const classBase = "vuuTable";
|
|
17
|
+
const Table_RowProxy = /*#__PURE__*/ forwardRef(function({ className = "vuuTableRow", height }, forwardedRef) {
|
|
18
|
+
return /*#__PURE__*/ jsx("div", {
|
|
19
|
+
"aria-hidden": true,
|
|
20
|
+
className: clsx(className, "vuuRowProxy"),
|
|
21
|
+
ref: forwardedRef,
|
|
22
|
+
style: {
|
|
23
|
+
height
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
const TableCore = ({ EmptyDisplay, HeaderCell, Row = external_Row_mjs_Row, allowCellBlockSelection, allowDragColumnHeader = true, allowDragDrop, allowSelectAll, allowSelectCheckboxRow, autoSelectFirstRow, autoSelectRowKey, config, containerRef, customHeader, dataSource, disableFocus = false, groupToggleTarget, highlightedIndex: highlightedIndexProp, id: idProp, lowerCaseSearchPattern, navigationStyle = "cell", onConfigChange, onDragStart, onDrop, onHighlight, onRowClick: onRowClickProp, onSelect, onSelectCellBlock, onSelectionChange, renderBufferSize = 0, revealSelected, rowActionHandlers, rowHeight, scrollingApiRef, selectionModel = "extended", showColumnHeaders = true, showColumnHeaderMenus = true, showPaginationControls, size })=>{
|
|
28
|
+
const id = useId(idProp);
|
|
29
|
+
const { allRowsSelected, cellBlock, columns, dataRows, draggableRow, editSessionInProgress, focusCellPlaceholderKeyDown, focusCellPlaceholderRef, getRowOffset, handleColumnAction, headerState: { height: headerHeight, count: headerCount }, headings, highlightedIndex, onCheckBoxColumnHeaderClick, onHeaderHeightMeasured, onMoveColumn, onMoveGroupColumn, onRemoveGroupColumn, onResizeColumn, onRowClick, onSortColumn, onToggleGroup, rowClassNameGenerator, scrollProps, tableAttributes, tableBodyRef, tableConfig, viewportMeasurements, ...tableProps } = useTable({
|
|
30
|
+
allowCellBlockSelection,
|
|
31
|
+
allowDragDrop,
|
|
32
|
+
allowSelectCheckboxRow,
|
|
33
|
+
autoSelectFirstRow,
|
|
34
|
+
autoSelectRowKey,
|
|
35
|
+
config,
|
|
36
|
+
containerRef,
|
|
37
|
+
dataSource,
|
|
38
|
+
disableFocus,
|
|
39
|
+
highlightedIndex: highlightedIndexProp,
|
|
40
|
+
id,
|
|
41
|
+
navigationStyle,
|
|
42
|
+
onConfigChange,
|
|
43
|
+
onDragStart,
|
|
44
|
+
onDrop,
|
|
45
|
+
onHighlight,
|
|
46
|
+
onRowClick: onRowClickProp,
|
|
47
|
+
onSelect,
|
|
48
|
+
onSelectCellBlock,
|
|
49
|
+
onSelectionChange,
|
|
50
|
+
renderBufferSize,
|
|
51
|
+
revealSelected,
|
|
52
|
+
rowHeight,
|
|
53
|
+
scrollingApiRef,
|
|
54
|
+
selectionModel,
|
|
55
|
+
showColumnHeaders,
|
|
56
|
+
showPaginationControls,
|
|
57
|
+
size
|
|
58
|
+
});
|
|
59
|
+
const { selectionBookendWidth = 4 } = config;
|
|
60
|
+
const contentContainerClassName = clsx(`${classBase}-contentContainer`, {
|
|
61
|
+
[`${classBase}-colLines`]: tableAttributes.columnSeparators,
|
|
62
|
+
[`${classBase}-rowLines`]: tableAttributes.rowSeparators,
|
|
63
|
+
[`${classBase}-zebra`]: tableAttributes.zebraStripes
|
|
64
|
+
});
|
|
65
|
+
const cssScrollbarSize = {
|
|
66
|
+
"--horizontal-scrollbar-height": `${viewportMeasurements.horizontalScrollbarHeight}px`,
|
|
67
|
+
"--vertical-scrollbar-width": `${viewportMeasurements.verticalScrollbarWidth}px`
|
|
68
|
+
};
|
|
69
|
+
const cssVariables = {
|
|
70
|
+
...cssScrollbarSize,
|
|
71
|
+
"--content-height": `${viewportMeasurements.contentHeight}px`,
|
|
72
|
+
"--content-width": `${viewportMeasurements.contentWidth}px`,
|
|
73
|
+
"--pinned-width-left": `${viewportMeasurements.pinnedWidthLeft}px`,
|
|
74
|
+
"--pinned-width-right": `${viewportMeasurements.pinnedWidthRight}px`,
|
|
75
|
+
"--total-header-height": `${headerHeight}px`,
|
|
76
|
+
"--viewport-body-height": `${viewportMeasurements.viewportBodyHeight}px`,
|
|
77
|
+
"--table-selection-bookend-width": `${selectionBookendWidth}px`
|
|
78
|
+
};
|
|
79
|
+
const headersReady = false === showColumnHeaders || headerHeight > 0;
|
|
80
|
+
const readyToRenderTableBody = headersReady && dataRows.length > 0;
|
|
81
|
+
return /*#__PURE__*/ jsxs(TableProvider, {
|
|
82
|
+
dataSource: dataSource,
|
|
83
|
+
menuActionHandler: handleColumnAction,
|
|
84
|
+
rowActionHandlers: rowActionHandlers,
|
|
85
|
+
children: [
|
|
86
|
+
true !== showPaginationControls ? /*#__PURE__*/ jsx("div", {
|
|
87
|
+
className: `${classBase}-scrollbarContainer`,
|
|
88
|
+
ref: scrollProps.scrollbarContainerRef,
|
|
89
|
+
style: cssVariables,
|
|
90
|
+
tabIndex: -1,
|
|
91
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
92
|
+
className: `${classBase}-scrollbarContent`
|
|
93
|
+
})
|
|
94
|
+
}) : null,
|
|
95
|
+
0 === dataSource.size && EmptyDisplay ? /*#__PURE__*/ jsxs("div", {
|
|
96
|
+
className: `${classBase}-emptyDisplay`,
|
|
97
|
+
children: [
|
|
98
|
+
/*#__PURE__*/ jsx(EmptyDisplay, {}),
|
|
99
|
+
" "
|
|
100
|
+
]
|
|
101
|
+
}) : null,
|
|
102
|
+
/*#__PURE__*/ jsx("div", {
|
|
103
|
+
className: contentContainerClassName,
|
|
104
|
+
ref: scrollProps.contentContainerRef,
|
|
105
|
+
style: cssVariables,
|
|
106
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
107
|
+
...tableProps,
|
|
108
|
+
className: clsx(`${classBase}-table`, {
|
|
109
|
+
[`${classBase}-editing`]: editSessionInProgress
|
|
110
|
+
}),
|
|
111
|
+
role: "table",
|
|
112
|
+
tabIndex: disableFocus ? void 0 : -1,
|
|
113
|
+
children: [
|
|
114
|
+
showColumnHeaders ? /*#__PURE__*/ jsx(TableHeader, {
|
|
115
|
+
HeaderCell: HeaderCell,
|
|
116
|
+
allowDragColumnHeader: allowDragColumnHeader,
|
|
117
|
+
allowSelectAll: allowSelectAll && "checkbox-disabled" !== selectionModel,
|
|
118
|
+
allRowsSelected: allRowsSelected,
|
|
119
|
+
columns: columns,
|
|
120
|
+
customHeader: customHeader,
|
|
121
|
+
headings: headings,
|
|
122
|
+
onCheckBoxColumnHeaderClick: onCheckBoxColumnHeaderClick,
|
|
123
|
+
onHeightMeasured: onHeaderHeightMeasured,
|
|
124
|
+
onMoveColumn: onMoveColumn,
|
|
125
|
+
onMoveGroupColumn: onMoveGroupColumn,
|
|
126
|
+
onRemoveGroupColumn: onRemoveGroupColumn,
|
|
127
|
+
onResizeColumn: onResizeColumn,
|
|
128
|
+
onSortColumn: onSortColumn,
|
|
129
|
+
showBookends: selectionBookendWidth > 0,
|
|
130
|
+
showColumnHeaderMenus: showColumnHeaderMenus,
|
|
131
|
+
tableConfig: tableConfig,
|
|
132
|
+
tableId: id,
|
|
133
|
+
virtualColSpan: scrollProps.virtualColSpan
|
|
134
|
+
}) : null,
|
|
135
|
+
readyToRenderTableBody ? /*#__PURE__*/ jsxs("div", {
|
|
136
|
+
className: `${classBase}-body`,
|
|
137
|
+
ref: tableBodyRef,
|
|
138
|
+
children: [
|
|
139
|
+
dataRows.map((dataRow)=>{
|
|
140
|
+
const ariaRowIndex = dataRow.index + headerCount + 1;
|
|
141
|
+
return /*#__PURE__*/ jsx(Row, {
|
|
142
|
+
"aria-rowindex": ariaRowIndex,
|
|
143
|
+
classNameGenerator: rowClassNameGenerator,
|
|
144
|
+
columns: scrollProps.columnsWithinViewport,
|
|
145
|
+
"data-first-row": 0 === dataRow.index ? "true" : void 0,
|
|
146
|
+
dataRow: dataRow,
|
|
147
|
+
groupToggleTarget: groupToggleTarget,
|
|
148
|
+
highlighted: highlightedIndex === ariaRowIndex,
|
|
149
|
+
onClick: onRowClick,
|
|
150
|
+
offset: showPaginationControls ? 0 : getRowOffset(dataRow),
|
|
151
|
+
onToggleGroup: onToggleGroup,
|
|
152
|
+
showBookends: selectionBookendWidth > 0,
|
|
153
|
+
searchPattern: lowerCaseSearchPattern,
|
|
154
|
+
virtualColSpan: scrollProps.virtualColSpan,
|
|
155
|
+
zebraStripes: tableAttributes.zebraStripes
|
|
156
|
+
}, dataRow.renderIndex);
|
|
157
|
+
}),
|
|
158
|
+
/*#__PURE__*/ jsx("div", {
|
|
159
|
+
"aria-hidden": true,
|
|
160
|
+
className: `${classBase}-focusCellPlaceholder`,
|
|
161
|
+
onKeyDown: focusCellPlaceholderKeyDown,
|
|
162
|
+
ref: focusCellPlaceholderRef,
|
|
163
|
+
tabIndex: -1
|
|
164
|
+
}),
|
|
165
|
+
cellBlock
|
|
166
|
+
]
|
|
167
|
+
}) : null
|
|
168
|
+
]
|
|
169
|
+
})
|
|
170
|
+
}),
|
|
171
|
+
/*#__PURE__*/ jsx("div", {
|
|
172
|
+
className: `${classBase}-scrollbarFiller`,
|
|
173
|
+
style: cssScrollbarSize
|
|
174
|
+
}),
|
|
175
|
+
draggableRow
|
|
176
|
+
]
|
|
177
|
+
});
|
|
178
|
+
};
|
|
179
|
+
const Table_Table = /*#__PURE__*/ forwardRef(function({ EmptyDisplay, HeaderCell, Row, allowCellBlockSelection, allowDragColumnHeader, allowDragDrop, allowSelectAll, allowSelectCheckboxRow, autoSelectFirstRow, autoSelectRowKey, className: classNameProp, config, customHeader, dataSource, disableFocus, groupToggleTarget, colHeaderRowHeight: colHeaderRowHeightProp, height, highlightedIndex, id, maxViewportRowLimit, navigationStyle, onAvailableColumnsChange, onConfigChange, onDragStart, onDrop, onHighlight, onRowClick, onSelect, onSelectCellBlock, onSelectionChange, renderBufferSize, revealSelected, resizeStrategy, rowActionHandlers, rowHeight: rowHeightProp, rowSelectionBorder, scrollingApiRef, searchPattern = "", selectionModel, showColumnHeaders, showColumnHeaderMenus, showPaginationControls, style: styleProp, viewportRowLimit, width, ...htmlAttributes }, forwardedRef) {
|
|
180
|
+
const targetWindow = useWindow();
|
|
181
|
+
useComponentCssInjection({
|
|
182
|
+
testId: "vuu-table",
|
|
183
|
+
css: Table_0,
|
|
184
|
+
window: targetWindow
|
|
185
|
+
});
|
|
186
|
+
const containerRef = useRef(null);
|
|
187
|
+
const [size, _setSize] = useState();
|
|
188
|
+
const { measuredHeight: rowHeight, measuredRef: rowRef } = useMeasuredHeight({
|
|
189
|
+
height: rowHeightProp
|
|
190
|
+
});
|
|
191
|
+
const { measuredHeight: footerHeight, measuredRef: footerRef } = useMeasuredHeight({});
|
|
192
|
+
const rowLimit = maxViewportRowLimit ?? viewportRowLimit;
|
|
193
|
+
if (void 0 === config) throw Error("vuu Table requires config prop. Minimum config is list of Column Descriptors");
|
|
194
|
+
if (void 0 === dataSource) throw Error("vuu Table requires dataSource prop");
|
|
195
|
+
if (showPaginationControls && void 0 !== renderBufferSize) console.warn("Table: When pagination controls are used, renderBufferSize is ignored");
|
|
196
|
+
if (rowLimit && height && rowHeightProp) {
|
|
197
|
+
console.warn("Table: when viewportRowLimit, rowHeight and height are used in combination, height is ignored");
|
|
198
|
+
height = rowLimit * rowHeightProp;
|
|
199
|
+
} else if (rowLimit && rowHeightProp) height = rowLimit * rowHeightProp;
|
|
200
|
+
else if (rowLimit) height = rowLimit * rowHeight;
|
|
201
|
+
const sizeRef = useRef(void 0);
|
|
202
|
+
const setSize = useCallback((size)=>{
|
|
203
|
+
if (viewportRowLimit && !rowHeight) sizeRef.current = size;
|
|
204
|
+
else if (size.height !== sizeRef.current?.height || size.width !== sizeRef.current?.width) _setSize(size);
|
|
205
|
+
}, [
|
|
206
|
+
rowHeight,
|
|
207
|
+
viewportRowLimit
|
|
208
|
+
]);
|
|
209
|
+
useMemo(()=>{
|
|
210
|
+
if (sizeRef.current && rowHeight) {
|
|
211
|
+
const size = {
|
|
212
|
+
...sizeRef.current,
|
|
213
|
+
height: rowHeight * viewportRowLimit
|
|
214
|
+
};
|
|
215
|
+
sizeRef.current = size;
|
|
216
|
+
_setSize(size);
|
|
217
|
+
}
|
|
218
|
+
}, [
|
|
219
|
+
rowHeight,
|
|
220
|
+
viewportRowLimit
|
|
221
|
+
]);
|
|
222
|
+
return /*#__PURE__*/ jsxs(MeasuredContainer, {
|
|
223
|
+
...htmlAttributes,
|
|
224
|
+
className: clsx(classBase, classNameProp, {
|
|
225
|
+
[`${classBase}-pagination`]: showPaginationControls,
|
|
226
|
+
[`${classBase}-rowSelection-bordered`]: rowSelectionBorder,
|
|
227
|
+
[`${classBase}-maxViewportRowLimit`]: maxViewportRowLimit,
|
|
228
|
+
[`${classBase}-viewportRowLimit`]: viewportRowLimit
|
|
229
|
+
}),
|
|
230
|
+
height: height,
|
|
231
|
+
id: id,
|
|
232
|
+
onResize: setSize,
|
|
233
|
+
ref: useForkRef(containerRef, forwardedRef),
|
|
234
|
+
resizeStrategy: resizeStrategy,
|
|
235
|
+
style: {
|
|
236
|
+
...styleProp,
|
|
237
|
+
"--col-header-row-height-prop": "number" == typeof colHeaderRowHeightProp ? `${colHeaderRowHeightProp}px` : void 0,
|
|
238
|
+
"--row-height-prop": "number" == typeof rowHeightProp ? `${rowHeightProp}px` : void 0
|
|
239
|
+
},
|
|
240
|
+
width: width,
|
|
241
|
+
children: [
|
|
242
|
+
/*#__PURE__*/ jsx(Table_RowProxy, {
|
|
243
|
+
ref: rowRef,
|
|
244
|
+
height: rowHeightProp
|
|
245
|
+
}),
|
|
246
|
+
size && rowHeight && (footerHeight || true !== showPaginationControls) ? /*#__PURE__*/ jsx(TableCore, {
|
|
247
|
+
EmptyDisplay: EmptyDisplay,
|
|
248
|
+
HeaderCell: HeaderCell,
|
|
249
|
+
Row: Row,
|
|
250
|
+
allowCellBlockSelection: allowCellBlockSelection,
|
|
251
|
+
allowDragColumnHeader: allowDragColumnHeader,
|
|
252
|
+
allowDragDrop: allowDragDrop,
|
|
253
|
+
allowSelectAll: allowSelectAll,
|
|
254
|
+
allowSelectCheckboxRow: allowSelectCheckboxRow,
|
|
255
|
+
autoSelectFirstRow: autoSelectFirstRow,
|
|
256
|
+
autoSelectRowKey: autoSelectRowKey,
|
|
257
|
+
config: config,
|
|
258
|
+
containerRef: containerRef,
|
|
259
|
+
customHeader: customHeader,
|
|
260
|
+
dataSource: dataSource,
|
|
261
|
+
disableFocus: disableFocus,
|
|
262
|
+
groupToggleTarget: groupToggleTarget,
|
|
263
|
+
highlightedIndex: highlightedIndex,
|
|
264
|
+
id: id,
|
|
265
|
+
navigationStyle: navigationStyle,
|
|
266
|
+
onAvailableColumnsChange: onAvailableColumnsChange,
|
|
267
|
+
onConfigChange: onConfigChange,
|
|
268
|
+
onDragStart: onDragStart,
|
|
269
|
+
onDrop: onDrop,
|
|
270
|
+
onHighlight: onHighlight,
|
|
271
|
+
onRowClick: onRowClick,
|
|
272
|
+
onSelect: onSelect,
|
|
273
|
+
onSelectCellBlock: onSelectCellBlock,
|
|
274
|
+
onSelectionChange: onSelectionChange,
|
|
275
|
+
renderBufferSize: showPaginationControls ? 0 : Math.max(5, renderBufferSize ?? 0),
|
|
276
|
+
revealSelected: revealSelected,
|
|
277
|
+
rowActionHandlers: rowActionHandlers,
|
|
278
|
+
rowHeight: rowHeight,
|
|
279
|
+
scrollingApiRef: scrollingApiRef,
|
|
280
|
+
lowerCaseSearchPattern: lowerCase(searchPattern),
|
|
281
|
+
selectionModel: selectionModel,
|
|
282
|
+
showColumnHeaders: showColumnHeaders,
|
|
283
|
+
showColumnHeaderMenus: showColumnHeaderMenus,
|
|
284
|
+
showPaginationControls: showPaginationControls,
|
|
285
|
+
size: reduceSizeHeight(size, footerHeight)
|
|
286
|
+
}) : null,
|
|
287
|
+
showPaginationControls ? /*#__PURE__*/ jsx("div", {
|
|
288
|
+
className: `${classBase}-footer`,
|
|
289
|
+
ref: footerRef,
|
|
290
|
+
children: /*#__PURE__*/ jsx(PaginationControl, {
|
|
291
|
+
dataSource: dataSource
|
|
292
|
+
})
|
|
293
|
+
}) : null
|
|
294
|
+
]
|
|
295
|
+
});
|
|
296
|
+
});
|
|
297
|
+
export { Table_Table as Table };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from "react";
|
|
3
|
+
const VirtualColSpan_VirtualColSpan = /*#__PURE__*/ memo(function({ width }) {
|
|
4
|
+
return /*#__PURE__*/ jsx("div", {
|
|
5
|
+
className: "vuuVirtualColSpan",
|
|
6
|
+
style: {
|
|
7
|
+
display: "inline-block",
|
|
8
|
+
width
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
export { VirtualColSpan_VirtualColSpan as VirtualColSpan };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
const applyHighlighting = (value, pattern)=>{
|
|
3
|
+
if ("" === pattern) return value;
|
|
4
|
+
const lowercaseValue = value.toLowerCase();
|
|
5
|
+
let start = 0;
|
|
6
|
+
let end = lowercaseValue.indexOf(pattern);
|
|
7
|
+
if (-1 === end) return value;
|
|
8
|
+
const results = [];
|
|
9
|
+
while(-1 !== end){
|
|
10
|
+
results.push(value.slice(start, end));
|
|
11
|
+
start = end;
|
|
12
|
+
end = start + pattern.length;
|
|
13
|
+
results.push(/*#__PURE__*/ jsx("span", {
|
|
14
|
+
className: "vuuHighlight",
|
|
15
|
+
children: value.slice(start, end)
|
|
16
|
+
}, start));
|
|
17
|
+
start = end;
|
|
18
|
+
end = lowercaseValue.indexOf(pattern, start);
|
|
19
|
+
if (-1 === end && start < lowercaseValue.length) results.push(value.slice(start));
|
|
20
|
+
}
|
|
21
|
+
return /*#__PURE__*/ jsx("span", {
|
|
22
|
+
style: {
|
|
23
|
+
whiteSpace: "pre"
|
|
24
|
+
},
|
|
25
|
+
children: results
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
export { applyHighlighting };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const css = `
|
|
2
|
+
.vuuBulkEditPanel {
|
|
3
|
+
background-color: var(--salt-container-secondary-background);
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
display: flex;
|
|
6
|
+
|
|
7
|
+
& .vuuTable {
|
|
8
|
+
--table-background: var(--salt-container-secondary-background);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.vuuBulkEditPanel-toolbar {
|
|
13
|
+
background: var(--salt-container-primary-background);
|
|
14
|
+
border: solid 1px var(--salt-separable-tertiary-borderColor);
|
|
15
|
+
border-radius: 2px;
|
|
16
|
+
height: 42px;
|
|
17
|
+
display: flex;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.vuuBulkEditPanel-table {
|
|
21
|
+
flex: auto;
|
|
22
|
+
align-items: center;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
`;
|
|
27
|
+
export default css;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useComponentCssInjection } from "@salt-ds/styles";
|
|
3
|
+
import { useWindow } from "@salt-ds/window";
|
|
4
|
+
import clsx from "clsx";
|
|
5
|
+
import { useMemo } from "react";
|
|
6
|
+
import { Table } from "../Table.mjs";
|
|
7
|
+
import { ColumnCascadingUpdateEditor } from "./ColumnCascadingUpdateEditor.mjs";
|
|
8
|
+
import { InsertNewRowEditor } from "./InsertNewRowEditor.mjs";
|
|
9
|
+
import { useBulkEditPanel } from "./useBulkEditPanel.mjs";
|
|
10
|
+
import BulkEditPanel from "./BulkEditPanel.css";
|
|
11
|
+
const classBase = "vuuBulkEditPanel";
|
|
12
|
+
const BulkEditPanel_BulkEditPanel = ({ className, columns, sessionDs, showColumnCascadingUpdateEditor = false, showInsertNewRowEditor = false, parentDs, style, width = 600, ...htmlAttributes })=>{
|
|
13
|
+
const targetWindow = useWindow();
|
|
14
|
+
useComponentCssInjection({
|
|
15
|
+
testId: "vuu-checkbox-cell",
|
|
16
|
+
css: BulkEditPanel,
|
|
17
|
+
window: targetWindow
|
|
18
|
+
});
|
|
19
|
+
const { onBulkChange, onRowChange, tableConfig } = useBulkEditPanel({
|
|
20
|
+
columns,
|
|
21
|
+
sessionDs
|
|
22
|
+
});
|
|
23
|
+
const bulkEditRow = useMemo(()=>{
|
|
24
|
+
if (showColumnCascadingUpdateEditor && showInsertNewRowEditor) return [
|
|
25
|
+
/*#__PURE__*/ jsx(InsertNewRowEditor, {
|
|
26
|
+
onBulkChange: onBulkChange,
|
|
27
|
+
onRowChange: onRowChange
|
|
28
|
+
}, 1),
|
|
29
|
+
/*#__PURE__*/ jsx(ColumnCascadingUpdateEditor, {
|
|
30
|
+
onBulkChange: onBulkChange,
|
|
31
|
+
onRowChange: onRowChange
|
|
32
|
+
}, 2)
|
|
33
|
+
];
|
|
34
|
+
if (showColumnCascadingUpdateEditor) return /*#__PURE__*/ jsx(ColumnCascadingUpdateEditor, {
|
|
35
|
+
onBulkChange: onBulkChange,
|
|
36
|
+
onRowChange: onRowChange
|
|
37
|
+
});
|
|
38
|
+
if (showInsertNewRowEditor) return /*#__PURE__*/ jsx(ColumnCascadingUpdateEditor, {
|
|
39
|
+
onBulkChange: onBulkChange,
|
|
40
|
+
onRowChange: onRowChange
|
|
41
|
+
});
|
|
42
|
+
}, [
|
|
43
|
+
onBulkChange,
|
|
44
|
+
onRowChange,
|
|
45
|
+
showColumnCascadingUpdateEditor,
|
|
46
|
+
showInsertNewRowEditor
|
|
47
|
+
]);
|
|
48
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
49
|
+
...htmlAttributes,
|
|
50
|
+
className: clsx(classBase, className),
|
|
51
|
+
style: {
|
|
52
|
+
...style,
|
|
53
|
+
display: "flex",
|
|
54
|
+
flexDirection: "column"
|
|
55
|
+
},
|
|
56
|
+
children: [
|
|
57
|
+
/*#__PURE__*/ jsx("div", {
|
|
58
|
+
className: `${classBase}-toolbar`
|
|
59
|
+
}),
|
|
60
|
+
/*#__PURE__*/ jsx("div", {
|
|
61
|
+
className: `${classBase}-table`,
|
|
62
|
+
children: /*#__PURE__*/ jsx(Table, {
|
|
63
|
+
allowDragColumnHeader: false,
|
|
64
|
+
config: tableConfig,
|
|
65
|
+
customHeader: bulkEditRow,
|
|
66
|
+
dataSource: sessionDs,
|
|
67
|
+
height: 380,
|
|
68
|
+
width: width,
|
|
69
|
+
showColumnHeaderMenus: false,
|
|
70
|
+
selectionModel: "none",
|
|
71
|
+
maxViewportRowLimit: 10
|
|
72
|
+
})
|
|
73
|
+
})
|
|
74
|
+
]
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
export { BulkEditPanel_BulkEditPanel as BulkEditPanel };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
const css = `
|
|
2
|
+
.vuuBulkEditRow {
|
|
3
|
+
--filter-borderColor: var(--salt-separable-secondary-borderColor);
|
|
4
|
+
--filter-color: var(--salt-content-primary-foreground-disabled);
|
|
5
|
+
--filter-padding: 1px 1px 1px 0;
|
|
6
|
+
--item-content-height: 22px;
|
|
7
|
+
height: var(--salt-size-base);
|
|
8
|
+
|
|
9
|
+
& .vuuBulkEditRowCell:has(input:focus) {
|
|
10
|
+
--filter-borderColor: transparent;
|
|
11
|
+
--item-content-height: 20px;
|
|
12
|
+
outline-offset: -2px;
|
|
13
|
+
outline-width: 2px;
|
|
14
|
+
outline-style: dotted;
|
|
15
|
+
outline-color: var(--salt-focused-outlineColor);
|
|
16
|
+
--filter-padding: 0 2px;
|
|
17
|
+
--saltInput-paddingLeft: 2px;
|
|
18
|
+
|
|
19
|
+
& .saltInput-input {
|
|
20
|
+
outline: none;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
& .saltInput-focused {
|
|
24
|
+
border: none;
|
|
25
|
+
outline: none;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
& .saltComboBox-focused {
|
|
29
|
+
outline: none;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
& .vuuBulkEditRowCell:focus {
|
|
34
|
+
--filter-borderColor: transparent;
|
|
35
|
+
--item-content-height: 20px;
|
|
36
|
+
--filter-padding: 0 2px;
|
|
37
|
+
--saltInput-paddingLeft: 2px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
& .vuuBulkEditRowCell {
|
|
41
|
+
--saltInput-minHeight: var(--item-content-height);
|
|
42
|
+
--saltPillInput-minHeight: var(--item-content-height);
|
|
43
|
+
height: 100%;
|
|
44
|
+
padding: var(--filter-padding);
|
|
45
|
+
align-items: center;
|
|
46
|
+
display: inline-flex;
|
|
47
|
+
|
|
48
|
+
& .vuuTypeaheadInput {
|
|
49
|
+
border-style: solid;
|
|
50
|
+
border-color: var(--filter-borderColor);
|
|
51
|
+
height: var(--item-content-height);
|
|
52
|
+
border-width: 1px;
|
|
53
|
+
border-radius: 0;
|
|
54
|
+
|
|
55
|
+
& input::placeholder {
|
|
56
|
+
color: var(--filter-color);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
& .saltInput-primary.vuuInput {
|
|
61
|
+
border-style: solid;
|
|
62
|
+
border-color: var(--filter-borderColor);
|
|
63
|
+
height: var(--item-content-height);
|
|
64
|
+
min-height: var(--item-content-height);
|
|
65
|
+
border-width: 1px;
|
|
66
|
+
border-radius: 0;
|
|
67
|
+
|
|
68
|
+
& input::placeholder {
|
|
69
|
+
color: var(--filter-color);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
& .vuuBulkEditRow-virtualColSpan {
|
|
75
|
+
display: inline-block;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.vuuBulkEditRow:focus-within {
|
|
80
|
+
--filter-borderColor: var(--salt-separable-primary-borderColor);
|
|
81
|
+
--filter-color: var(--salt-content-primary-foreground);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
`;
|
|
86
|
+
export default css;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useComponentCssInjection } from "@salt-ds/styles";
|
|
3
|
+
import { useWindow } from "@salt-ds/window";
|
|
4
|
+
import { getDataItemEditControl } from "@vuu-ui/vuu-data-react";
|
|
5
|
+
import { isNotHidden } from "@vuu-ui/vuu-utils";
|
|
6
|
+
import clsx from "clsx";
|
|
7
|
+
import { VirtualColSpan } from "../VirtualColSpan.mjs";
|
|
8
|
+
import { useHeaderProps } from "../table-header/index.mjs";
|
|
9
|
+
import { useBulkEditRow } from "./useColumnCascadingEditor.mjs";
|
|
10
|
+
import ColumnCascadingUpdateEditor from "./ColumnCascadingUpdateEditor.css";
|
|
11
|
+
const classBase = "vuuBulkEditRow";
|
|
12
|
+
const ColumnCascadingUpdateEditor_ColumnCascadingUpdateEditor = ({ ariaRole, onBulkChange, onRowChange, ...htmlAttributes })=>{
|
|
13
|
+
const targetWindow = useWindow();
|
|
14
|
+
useComponentCssInjection({
|
|
15
|
+
testId: "vuu-bulk-edit-row",
|
|
16
|
+
css: ColumnCascadingUpdateEditor,
|
|
17
|
+
window: targetWindow
|
|
18
|
+
});
|
|
19
|
+
const { columns, virtualColSpan = 0 } = useHeaderProps();
|
|
20
|
+
const { errorMessages, formFieldsContainerRef, InputProps, onCommit, onFocus, onKeyDown } = useBulkEditRow({
|
|
21
|
+
descriptors: columns,
|
|
22
|
+
onBulkChange,
|
|
23
|
+
onRowChange
|
|
24
|
+
});
|
|
25
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
26
|
+
...htmlAttributes,
|
|
27
|
+
className: classBase,
|
|
28
|
+
onFocus: onFocus,
|
|
29
|
+
onKeyDown: onKeyDown,
|
|
30
|
+
ref: formFieldsContainerRef,
|
|
31
|
+
role: ariaRole,
|
|
32
|
+
children: [
|
|
33
|
+
/*#__PURE__*/ jsx(VirtualColSpan, {
|
|
34
|
+
width: virtualColSpan
|
|
35
|
+
}),
|
|
36
|
+
columns.filter(isNotHidden).map((column, i)=>{
|
|
37
|
+
const errorMessage = errorMessages[column.name];
|
|
38
|
+
return /*#__PURE__*/ jsx("div", {
|
|
39
|
+
"aria-colindex": i + 1,
|
|
40
|
+
className: clsx(`${classBase}Cell`, "vuuTableCell", {
|
|
41
|
+
"vuuTableCell-right": "right" === column.align
|
|
42
|
+
}),
|
|
43
|
+
"data-field": column.name,
|
|
44
|
+
role: "cell",
|
|
45
|
+
style: {
|
|
46
|
+
width: column.width
|
|
47
|
+
},
|
|
48
|
+
children: column.editable ? getDataItemEditControl({
|
|
49
|
+
InputProps,
|
|
50
|
+
dataDescriptor: column,
|
|
51
|
+
errorMessage,
|
|
52
|
+
onCommit
|
|
53
|
+
}) : null
|
|
54
|
+
}, column.name);
|
|
55
|
+
})
|
|
56
|
+
]
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
export { ColumnCascadingUpdateEditor_ColumnCascadingUpdateEditor as ColumnCascadingUpdateEditor };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
const css = `
|
|
2
|
+
.vuuBulkEditRow {
|
|
3
|
+
--filter-borderColor: var(--salt-separable-secondary-borderColor);
|
|
4
|
+
--filter-color: var(--salt-content-primary-foreground-disabled);
|
|
5
|
+
--filter-padding: 1px 1px 1px 0;
|
|
6
|
+
--item-content-height: 22px;
|
|
7
|
+
height: var(--salt-size-base);
|
|
8
|
+
|
|
9
|
+
& .vuuBulkEditRowCell:has(input:focus) {
|
|
10
|
+
--filter-borderColor: transparent;
|
|
11
|
+
--item-content-height: 20px;
|
|
12
|
+
outline-offset: -2px;
|
|
13
|
+
outline-width: 2px;
|
|
14
|
+
outline-style: dotted;
|
|
15
|
+
outline-color: var(--salt-focused-outlineColor);
|
|
16
|
+
--filter-padding: 0 2px;
|
|
17
|
+
--saltInput-paddingLeft: 2px;
|
|
18
|
+
|
|
19
|
+
& .saltInput-input {
|
|
20
|
+
outline: none;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
& .saltInput-focused {
|
|
24
|
+
border: none;
|
|
25
|
+
outline: none;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
& .saltComboBox-focused {
|
|
29
|
+
outline: none;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
& .vuuBulkEditRowCell:focus {
|
|
34
|
+
--filter-borderColor: transparent;
|
|
35
|
+
--item-content-height: 20px;
|
|
36
|
+
--filter-padding: 0 2px;
|
|
37
|
+
--saltInput-paddingLeft: 2px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
& .vuuBulkEditRowCell {
|
|
41
|
+
--saltInput-minHeight: var(--item-content-height);
|
|
42
|
+
--saltPillInput-minHeight: var(--item-content-height);
|
|
43
|
+
height: 100%;
|
|
44
|
+
padding: var(--filter-padding);
|
|
45
|
+
align-items: center;
|
|
46
|
+
display: inline-flex;
|
|
47
|
+
|
|
48
|
+
& .vuuTypeaheadInput {
|
|
49
|
+
border-style: solid;
|
|
50
|
+
border-color: var(--filter-borderColor);
|
|
51
|
+
height: var(--item-content-height);
|
|
52
|
+
border-width: 1px;
|
|
53
|
+
border-radius: 0;
|
|
54
|
+
|
|
55
|
+
& input::placeholder {
|
|
56
|
+
color: var(--filter-color);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
& .saltInput-primary.vuuInput {
|
|
61
|
+
border-style: solid;
|
|
62
|
+
border-color: var(--filter-borderColor);
|
|
63
|
+
height: var(--item-content-height);
|
|
64
|
+
min-height: var(--item-content-height);
|
|
65
|
+
border-width: 1px;
|
|
66
|
+
border-radius: 0;
|
|
67
|
+
|
|
68
|
+
& input::placeholder {
|
|
69
|
+
color: var(--filter-color);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
& .vuuBulkEditRow-virtualColSpan {
|
|
75
|
+
display: inline-block;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.vuuBulkEditRow:focus-within {
|
|
80
|
+
--filter-borderColor: var(--salt-separable-primary-borderColor);
|
|
81
|
+
--filter-color: var(--salt-content-primary-foreground);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
`;
|
|
86
|
+
export default css;
|