@uipath/apollo-react 7.11.4 → 7.12.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/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/dist/chat/styles/tailwind.chat.css +1 -1
- package/dist/decision-table/DecisionTable.cjs +454 -0
- package/dist/decision-table/DecisionTable.d.ts +36 -0
- package/dist/decision-table/DecisionTable.d.ts.map +1 -0
- package/dist/decision-table/DecisionTable.js +410 -0
- package/dist/decision-table/GridCell.cjs +153 -0
- package/dist/decision-table/GridCell.d.ts +43 -0
- package/dist/decision-table/GridCell.d.ts.map +1 -0
- package/dist/decision-table/GridCell.js +116 -0
- package/dist/decision-table/GridMenu.cjs +135 -0
- package/dist/decision-table/GridMenu.d.ts +30 -0
- package/dist/decision-table/GridMenu.d.ts.map +1 -0
- package/dist/decision-table/GridMenu.js +101 -0
- package/dist/decision-table/MarkGlyph.cjs +51 -0
- package/dist/decision-table/MarkGlyph.d.ts +7 -0
- package/dist/decision-table/MarkGlyph.d.ts.map +1 -0
- package/dist/decision-table/MarkGlyph.js +17 -0
- package/dist/decision-table/clipboardCodec.cjs +123 -0
- package/dist/decision-table/clipboardCodec.d.ts +8 -0
- package/dist/decision-table/clipboardCodec.d.ts.map +1 -0
- package/dist/decision-table/clipboardCodec.js +80 -0
- package/dist/decision-table/clippedTitle.cjs +39 -0
- package/dist/decision-table/clippedTitle.d.ts +3 -0
- package/dist/decision-table/clippedTitle.d.ts.map +1 -0
- package/dist/decision-table/clippedTitle.js +5 -0
- package/dist/decision-table/columnSizing.cjs +92 -0
- package/dist/decision-table/columnSizing.d.ts +13 -0
- package/dist/decision-table/columnSizing.d.ts.map +1 -0
- package/dist/decision-table/columnSizing.js +52 -0
- package/dist/decision-table/constants.cjs +84 -0
- package/dist/decision-table/constants.d.ts +14 -0
- package/dist/decision-table/constants.d.ts.map +1 -0
- package/dist/decision-table/constants.js +14 -0
- package/dist/decision-table/gridClipboard.cjs +129 -0
- package/dist/decision-table/gridClipboard.d.ts +19 -0
- package/dist/decision-table/gridClipboard.d.ts.map +1 -0
- package/dist/decision-table/gridClipboard.js +89 -0
- package/dist/decision-table/gridEvents.cjs +72 -0
- package/dist/decision-table/gridEvents.d.ts +14 -0
- package/dist/decision-table/gridEvents.d.ts.map +1 -0
- package/dist/decision-table/gridEvents.js +23 -0
- package/dist/decision-table/gridStyles.cjs +196 -0
- package/dist/decision-table/gridStyles.d.ts +47 -0
- package/dist/decision-table/gridStyles.d.ts.map +1 -0
- package/dist/decision-table/gridStyles.js +54 -0
- package/dist/decision-table/gridTypes.cjs +18 -0
- package/dist/decision-table/gridTypes.d.ts +93 -0
- package/dist/decision-table/gridTypes.d.ts.map +1 -0
- package/dist/decision-table/gridTypes.js +0 -0
- package/dist/decision-table/index.cjs +271 -0
- package/dist/decision-table/index.d.ts +13 -0
- package/dist/decision-table/index.d.ts.map +1 -0
- package/dist/decision-table/index.js +12 -0
- package/dist/decision-table/marks.cjs +39 -0
- package/dist/decision-table/marks.d.ts +20 -0
- package/dist/decision-table/marks.d.ts.map +1 -0
- package/dist/decision-table/marks.js +5 -0
- package/dist/decision-table/styles/tailwind.decision-table.css +2 -0
- package/dist/decision-table/useColumnWidths.cjs +313 -0
- package/dist/decision-table/useColumnWidths.d.ts +21 -0
- package/dist/decision-table/useColumnWidths.d.ts.map +1 -0
- package/dist/decision-table/useColumnWidths.js +279 -0
- package/dist/decision-table/useDragReorder.cjs +229 -0
- package/dist/decision-table/useDragReorder.d.ts +31 -0
- package/dist/decision-table/useDragReorder.d.ts.map +1 -0
- package/dist/decision-table/useDragReorder.js +186 -0
- package/dist/decision-table/useDragSelection.cjs +75 -0
- package/dist/decision-table/useDragSelection.d.ts +18 -0
- package/dist/decision-table/useDragSelection.d.ts.map +1 -0
- package/dist/decision-table/useDragSelection.js +41 -0
- package/dist/decision-table/useGridClipboard.cjs +195 -0
- package/dist/decision-table/useGridClipboard.d.ts +13 -0
- package/dist/decision-table/useGridClipboard.d.ts.map +1 -0
- package/dist/decision-table/useGridClipboard.js +161 -0
- package/dist/decision-table/useGridLayout.cjs +248 -0
- package/dist/decision-table/useGridLayout.d.ts +50 -0
- package/dist/decision-table/useGridLayout.d.ts.map +1 -0
- package/dist/decision-table/useGridLayout.js +211 -0
- package/dist/decision-table/useGridNavigation.cjs +441 -0
- package/dist/decision-table/useGridNavigation.d.ts +67 -0
- package/dist/decision-table/useGridNavigation.d.ts.map +1 -0
- package/dist/decision-table/useGridNavigation.js +404 -0
- package/dist/decision-table/useVirtualizedAxis.cjs +256 -0
- package/dist/decision-table/useVirtualizedAxis.d.ts +34 -0
- package/dist/decision-table/useVirtualizedAxis.d.ts.map +1 -0
- package/dist/decision-table/useVirtualizedAxis.js +219 -0
- package/dist/test/setup.d.ts.map +1 -1
- package/package.json +20 -10
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: definition[key]
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
+
})();
|
|
23
|
+
(()=>{
|
|
24
|
+
__webpack_require__.r = (exports1)=>{
|
|
25
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
+
value: 'Module'
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
+
value: true
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
var __webpack_exports__ = {};
|
|
34
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
DecisionTable: ()=>DecisionTable
|
|
37
|
+
});
|
|
38
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
39
|
+
const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
|
|
40
|
+
const external_lucide_react_namespaceObject = require("lucide-react");
|
|
41
|
+
const external_react_namespaceObject = require("react");
|
|
42
|
+
var external_react_default = /*#__PURE__*/ __webpack_require__.n(external_react_namespaceObject);
|
|
43
|
+
const external_constants_cjs_namespaceObject = require("./constants.cjs");
|
|
44
|
+
const external_gridStyles_cjs_namespaceObject = require("./gridStyles.cjs");
|
|
45
|
+
const external_useDragReorder_cjs_namespaceObject = require("./useDragReorder.cjs");
|
|
46
|
+
const external_useGridClipboard_cjs_namespaceObject = require("./useGridClipboard.cjs");
|
|
47
|
+
const external_useGridLayout_cjs_namespaceObject = require("./useGridLayout.cjs");
|
|
48
|
+
const groupColumnRuns = (visibleColumns, pinnedLeftPxOf)=>{
|
|
49
|
+
const runs = [];
|
|
50
|
+
const openedGroups = new Set();
|
|
51
|
+
for (const visible of visibleColumns){
|
|
52
|
+
if ('spacer' === visible.type) {
|
|
53
|
+
runs.push({
|
|
54
|
+
type: 'spacer',
|
|
55
|
+
widthPx: visible.widthPx,
|
|
56
|
+
firstCoveredId: visible.coveredIds[0]
|
|
57
|
+
});
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
if ('separator' === visible.type) {
|
|
61
|
+
runs.push({
|
|
62
|
+
type: 'separator',
|
|
63
|
+
widthPx: visible.widthPx,
|
|
64
|
+
beforeColumnId: visible.beforeColumnId
|
|
65
|
+
});
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
const { column, flexIndex } = visible;
|
|
69
|
+
const last = runs[runs.length - 1];
|
|
70
|
+
const pinnedLeftPx = pinnedLeftPxOf(flexIndex);
|
|
71
|
+
const samePinning = (previous)=>void 0 !== previous.pinnedLeftPx === (void 0 !== pinnedLeftPx);
|
|
72
|
+
if (!column.group) {
|
|
73
|
+
if (last?.type === 'gutter' && samePinning(last)) last.count += 1;
|
|
74
|
+
else runs.push({
|
|
75
|
+
type: 'gutter',
|
|
76
|
+
count: 1,
|
|
77
|
+
firstFlexIndex: flexIndex,
|
|
78
|
+
pinnedLeftPx
|
|
79
|
+
});
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
if (last?.type === 'group' && last.group.id === column.group.id && samePinning(last)) last.count += 1;
|
|
83
|
+
else {
|
|
84
|
+
runs.push({
|
|
85
|
+
type: 'group',
|
|
86
|
+
group: column.group,
|
|
87
|
+
first: column,
|
|
88
|
+
firstFlexIndex: flexIndex,
|
|
89
|
+
count: 1,
|
|
90
|
+
pinnedLeftPx,
|
|
91
|
+
isFirstRunOfGroup: !openedGroups.has(column.group.id)
|
|
92
|
+
});
|
|
93
|
+
openedGroups.add(column.group.id);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return runs;
|
|
97
|
+
};
|
|
98
|
+
const DecisionTable = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRef)(({ columns, rowCount, rowHeightPx = external_constants_cjs_namespaceObject.BODY_ROW_HEIGHT_PX, leadingColumnWidth = 0, trailingColumnWidth = 0, pinnedColumnCount = 0, initialColumnWidths = {}, onColumnWidthsChange, columnsResizable = false, framedByHost = false, columnGroupSizes, onRowMove, onColumnMove, retainedRowIndex = null, retainedColumnIndex = null, renderHeaderCell, renderRow, renderFooterRow, trailingHeaderCell, trailingGroupCell, tableAriaLabel, clipboard, containerProps, dataTestId, labels, children }, ref)=>{
|
|
99
|
+
const containerRef = (0, external_react_namespaceObject.useRef)(null);
|
|
100
|
+
const layoutRef = (0, external_react_namespaceObject.useRef)(null);
|
|
101
|
+
const headerHeight = (0, external_react_namespaceObject.useCallback)(()=>layoutRef.current?.headerHeight() ?? 0, []);
|
|
102
|
+
const columnLeading = (0, external_react_namespaceObject.useCallback)(()=>layoutRef.current?.columnLeading() ?? 0, []);
|
|
103
|
+
const columnOffsets = (0, external_react_namespaceObject.useCallback)(()=>layoutRef.current?.columnOffsets ?? [], []);
|
|
104
|
+
const onRowMoveRef = (0, external_react_namespaceObject.useRef)(onRowMove);
|
|
105
|
+
onRowMoveRef.current = onRowMove;
|
|
106
|
+
const onColumnMoveRef = (0, external_react_namespaceObject.useRef)(onColumnMove);
|
|
107
|
+
onColumnMoveRef.current = onColumnMove;
|
|
108
|
+
const sizesKey = (columnGroupSizes ?? []).join(',');
|
|
109
|
+
const boundaries = external_react_default().useMemo(()=>{
|
|
110
|
+
const out = [
|
|
111
|
+
0
|
|
112
|
+
];
|
|
113
|
+
for (const size of columnGroupSizes ?? [])out.push(out[out.length - 1] + size);
|
|
114
|
+
return out;
|
|
115
|
+
}, [
|
|
116
|
+
sizesKey
|
|
117
|
+
]);
|
|
118
|
+
const { dragState, startRowDrag, startColumnDrag: beginColumnDrag } = (0, external_useDragReorder_cjs_namespaceObject.useDragReorder)({
|
|
119
|
+
containerRef,
|
|
120
|
+
headerHeight,
|
|
121
|
+
columnLeading,
|
|
122
|
+
columnOffsets,
|
|
123
|
+
rowHeightPx,
|
|
124
|
+
rowCount,
|
|
125
|
+
columnGroupBoundaries: boundaries,
|
|
126
|
+
onDropRow: (from, to)=>onRowMoveRef.current?.(from, to),
|
|
127
|
+
onDropColumn: (groupIndex, from, to)=>onColumnMoveRef.current?.(groupIndex, from, to)
|
|
128
|
+
});
|
|
129
|
+
const boundariesRef = (0, external_react_namespaceObject.useRef)(boundaries);
|
|
130
|
+
boundariesRef.current = boundaries;
|
|
131
|
+
const startColumnDrag = (0, external_react_namespaceObject.useCallback)((groupIndex, indexInGroup, event)=>{
|
|
132
|
+
if (boundariesRef.current.length >= 2) beginColumnDrag(groupIndex, indexInGroup, event);
|
|
133
|
+
}, [
|
|
134
|
+
beginColumnDrag
|
|
135
|
+
]);
|
|
136
|
+
const dragRetainedRow = dragState?.axis === 'row' ? dragState.from : null;
|
|
137
|
+
const dragRetainedColumn = dragState?.axis === 'column' ? (boundaries[dragState.groupIndex] ?? 0) + dragState.from : null;
|
|
138
|
+
const layout = (0, external_useGridLayout_cjs_namespaceObject.useGridLayout)({
|
|
139
|
+
columns,
|
|
140
|
+
rowCount,
|
|
141
|
+
rowHeightPx,
|
|
142
|
+
leadingColumnWidth,
|
|
143
|
+
trailingColumnWidth,
|
|
144
|
+
pinnedColumnCount,
|
|
145
|
+
initialColumnWidths,
|
|
146
|
+
onColumnWidthsChange,
|
|
147
|
+
containerRef,
|
|
148
|
+
retainedRowIndex: retainedRowIndex ?? dragRetainedRow,
|
|
149
|
+
retainedColumnIndex: retainedColumnIndex ?? dragRetainedColumn,
|
|
150
|
+
framedByHost
|
|
151
|
+
});
|
|
152
|
+
layoutRef.current = layout;
|
|
153
|
+
const { visibleColumns, widths, totalWidth } = layout;
|
|
154
|
+
const hasTrailing = trailingColumnWidth > 0;
|
|
155
|
+
const hasLeading = leadingColumnWidth > 0;
|
|
156
|
+
const hasGroupRow = columns.some((column)=>void 0 !== column.group) || void 0 !== trailingGroupCell;
|
|
157
|
+
const hostTopEdge = framedByHost && external_gridStyles_cjs_namespaceObject.OMIT_BORDER_CLASS.top;
|
|
158
|
+
const headerRowCount = hasGroupRow ? 2 : 1;
|
|
159
|
+
const gridClipboard = (0, external_useGridClipboard_cjs_namespaceObject.useGridClipboard)(clipboard, {
|
|
160
|
+
rowCount,
|
|
161
|
+
columnCount: columns.length
|
|
162
|
+
});
|
|
163
|
+
(0, external_react_namespaceObject.useImperativeHandle)(ref, ()=>({
|
|
164
|
+
container: ()=>containerRef.current,
|
|
165
|
+
headerHeight,
|
|
166
|
+
columnLeading,
|
|
167
|
+
columnOffsets,
|
|
168
|
+
totalWidth: ()=>layoutRef.current?.totalWidth ?? 0,
|
|
169
|
+
scrollRowIntoView: (rowIndex)=>layoutRef.current?.scrollRowIntoView(rowIndex),
|
|
170
|
+
scrollColumnIntoView: (windowIndex)=>layoutRef.current?.scrollColumnIntoView(windowIndex),
|
|
171
|
+
startRowDrag,
|
|
172
|
+
startColumnDrag,
|
|
173
|
+
clipboard: gridClipboard.actions
|
|
174
|
+
}), [
|
|
175
|
+
headerHeight,
|
|
176
|
+
columnLeading,
|
|
177
|
+
columnOffsets,
|
|
178
|
+
startRowDrag,
|
|
179
|
+
startColumnDrag,
|
|
180
|
+
gridClipboard.actions
|
|
181
|
+
]);
|
|
182
|
+
const focusWithinRef = (0, external_react_namespaceObject.useRef)(false);
|
|
183
|
+
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
184
|
+
if (focusWithinRef.current && document.activeElement === document.body) containerRef.current?.focus();
|
|
185
|
+
});
|
|
186
|
+
const pinnedLeftPxOf = (flexIndex)=>{
|
|
187
|
+
if (flexIndex >= layout.pinnedColumnCount) return;
|
|
188
|
+
let offset = leadingColumnWidth;
|
|
189
|
+
for(let index = 0; index < flexIndex; index += 1)offset += widths[index] ?? 0;
|
|
190
|
+
return offset;
|
|
191
|
+
};
|
|
192
|
+
const renderResizeHandle = (column, width)=>{
|
|
193
|
+
if (!columnsResizable) return null;
|
|
194
|
+
if (column.id === columns[columns.length - 1]?.id) return null;
|
|
195
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
196
|
+
className: external_gridStyles_cjs_namespaceObject.RESIZE_HANDLE_CLASS,
|
|
197
|
+
role: "separator",
|
|
198
|
+
"aria-orientation": "vertical",
|
|
199
|
+
"aria-valuenow": Math.round(width),
|
|
200
|
+
"aria-valuemin": external_constants_cjs_namespaceObject.MIN_COLUMN_WIDTH,
|
|
201
|
+
"aria-valuemax": Math.round(totalWidth),
|
|
202
|
+
tabIndex: 0,
|
|
203
|
+
"data-testid": `${dataTestId}-resize-${column.id}`,
|
|
204
|
+
"aria-label": labels.resizeColumn(column.name),
|
|
205
|
+
title: labels.resetColumnWidth,
|
|
206
|
+
onPointerDown: (event)=>layout.onResizeStart(column.id, event),
|
|
207
|
+
onKeyDown: (event)=>layout.onResizeKeyDown(column.id, event),
|
|
208
|
+
onDoubleClick: (event)=>{
|
|
209
|
+
event.stopPropagation();
|
|
210
|
+
layout.onResizeReset(column.id);
|
|
211
|
+
},
|
|
212
|
+
onClick: (event)=>event.stopPropagation()
|
|
213
|
+
});
|
|
214
|
+
};
|
|
215
|
+
const pinnedEdgePx = leadingColumnWidth + widths.slice(0, layout.pinnedColumnCount).reduce((sum, width)=>sum + width, 0);
|
|
216
|
+
const bodyColSpan = (hasLeading ? 1 : 0) + visibleColumns.length + (hasTrailing ? 1 : 0);
|
|
217
|
+
const { onFocus: consumerFocus, onBlur: consumerBlur, onKeyDown: consumerKeyDown, onCopy: consumerCopy, onCut: consumerCut, onPaste: consumerPaste, ...restContainerProps } = containerProps ?? {};
|
|
218
|
+
const composeClipboard = (mine, theirs)=>(event)=>{
|
|
219
|
+
mine?.(event);
|
|
220
|
+
if (!event.defaultPrevented) theirs?.(event);
|
|
221
|
+
};
|
|
222
|
+
const scrollContainer = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
223
|
+
className: framedByHost ? external_gridStyles_cjs_namespaceObject.HOST_FRAMED_CONTAINER_CLASS : external_gridStyles_cjs_namespaceObject.GRID_FRAME_CLASS,
|
|
224
|
+
ref: layout.attachContainer,
|
|
225
|
+
tabIndex: 0,
|
|
226
|
+
onFocus: (event)=>{
|
|
227
|
+
focusWithinRef.current = true;
|
|
228
|
+
consumerFocus?.(event);
|
|
229
|
+
},
|
|
230
|
+
onBlur: (event)=>{
|
|
231
|
+
if (!(event.relatedTarget instanceof Node) || !event.currentTarget.contains(event.relatedTarget)) focusWithinRef.current = false;
|
|
232
|
+
consumerBlur?.(event);
|
|
233
|
+
},
|
|
234
|
+
onKeyDown: (event)=>{
|
|
235
|
+
if (!gridClipboard.handleKeyDown(event)) consumerKeyDown?.(event);
|
|
236
|
+
},
|
|
237
|
+
"data-testid": dataTestId,
|
|
238
|
+
onCopy: composeClipboard(gridClipboard.containerProps.onCopy, consumerCopy),
|
|
239
|
+
onCut: composeClipboard(gridClipboard.containerProps.onCut, consumerCut),
|
|
240
|
+
onPaste: composeClipboard(gridClipboard.containerProps.onPaste, consumerPaste),
|
|
241
|
+
...restContainerProps,
|
|
242
|
+
children: [
|
|
243
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("table", {
|
|
244
|
+
className: (0, apollo_wind_namespaceObject.cn)('table-fixed border-separate border-spacing-0 text-xs text-foreground', !framedByHost && [
|
|
245
|
+
external_gridStyles_cjs_namespaceObject.TABLE_EDGE_CLASS,
|
|
246
|
+
external_gridStyles_cjs_namespaceObject.TABLE_HUG_EDGE_CLASS
|
|
247
|
+
]),
|
|
248
|
+
ref: layout.setTableElement,
|
|
249
|
+
style: {
|
|
250
|
+
width: totalWidth,
|
|
251
|
+
'--grid-row-height': `${rowHeightPx}px`,
|
|
252
|
+
'--grid-pinned-left': `${pinnedEdgePx}px`
|
|
253
|
+
},
|
|
254
|
+
"aria-label": tableAriaLabel,
|
|
255
|
+
"aria-rowcount": rowCount + headerRowCount + (renderFooterRow ? 1 : 0),
|
|
256
|
+
children: [
|
|
257
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("colgroup", {
|
|
258
|
+
children: [
|
|
259
|
+
hasLeading && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("col", {
|
|
260
|
+
style: {
|
|
261
|
+
width: leadingColumnWidth
|
|
262
|
+
}
|
|
263
|
+
}),
|
|
264
|
+
visibleColumns.map((visible)=>{
|
|
265
|
+
if ('separator' === visible.type) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("col", {
|
|
266
|
+
style: {
|
|
267
|
+
width: visible.widthPx
|
|
268
|
+
}
|
|
269
|
+
}, `col-separator-${visible.beforeColumnId}`);
|
|
270
|
+
if ('spacer' === visible.type) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("col", {
|
|
271
|
+
ref: (element)=>layout.setSpacerElement(`colgroup-spacer-${visible.coveredIds[0]}`, visible.coveredIds, element, visible.separatorPx),
|
|
272
|
+
style: {
|
|
273
|
+
width: visible.widthPx
|
|
274
|
+
}
|
|
275
|
+
}, `col-spacer-${visible.coveredIds[0]}`);
|
|
276
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("col", {
|
|
277
|
+
ref: (element)=>layout.setColElement(visible.column.id, element),
|
|
278
|
+
style: {
|
|
279
|
+
width: widths[visible.flexIndex]
|
|
280
|
+
}
|
|
281
|
+
}, visible.column.id);
|
|
282
|
+
}),
|
|
283
|
+
hasTrailing && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("col", {
|
|
284
|
+
style: {
|
|
285
|
+
width: trailingColumnWidth
|
|
286
|
+
}
|
|
287
|
+
})
|
|
288
|
+
]
|
|
289
|
+
}),
|
|
290
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("thead", {
|
|
291
|
+
ref: layout.theadRef,
|
|
292
|
+
children: [
|
|
293
|
+
hasGroupRow && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("tr", {
|
|
294
|
+
"aria-rowindex": 1,
|
|
295
|
+
className: (0, apollo_wind_namespaceObject.cn)(framedByHost && '[&>*:last-child]:border-r-0'),
|
|
296
|
+
children: [
|
|
297
|
+
hasLeading && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("td", {
|
|
298
|
+
"aria-hidden": "true",
|
|
299
|
+
className: (0, apollo_wind_namespaceObject.cn)(external_gridStyles_cjs_namespaceObject.GROUP_GUTTER_CLASS, 'left-0 z-3', hostTopEdge)
|
|
300
|
+
}),
|
|
301
|
+
groupColumnRuns(visibleColumns, pinnedLeftPxOf).map((run)=>{
|
|
302
|
+
if ('spacer' === run.type) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("td", {
|
|
303
|
+
"aria-hidden": "true",
|
|
304
|
+
className: (0, apollo_wind_namespaceObject.cn)(external_gridStyles_cjs_namespaceObject.GROUP_GUTTER_CLASS, hostTopEdge),
|
|
305
|
+
style: {
|
|
306
|
+
width: run.widthPx
|
|
307
|
+
}
|
|
308
|
+
}, `group-spacer-${run.firstCoveredId}`);
|
|
309
|
+
if ('separator' === run.type) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("td", {
|
|
310
|
+
"aria-hidden": "true",
|
|
311
|
+
"data-separator": "group",
|
|
312
|
+
className: (0, apollo_wind_namespaceObject.cn)(external_gridStyles_cjs_namespaceObject.SEPARATOR_GROUP_CELL_CLASS, hostTopEdge),
|
|
313
|
+
style: {
|
|
314
|
+
width: run.widthPx
|
|
315
|
+
}
|
|
316
|
+
}, `group-separator-${run.beforeColumnId}`);
|
|
317
|
+
if ('gutter' === run.type) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("td", {
|
|
318
|
+
"aria-hidden": "true",
|
|
319
|
+
className: (0, apollo_wind_namespaceObject.cn)(external_gridStyles_cjs_namespaceObject.GROUP_GUTTER_CLASS, void 0 !== run.pinnedLeftPx && 'z-3', hostTopEdge),
|
|
320
|
+
style: void 0 !== run.pinnedLeftPx ? {
|
|
321
|
+
left: run.pinnedLeftPx
|
|
322
|
+
} : void 0,
|
|
323
|
+
colSpan: run.count
|
|
324
|
+
}, `group-gutter-${run.firstFlexIndex}`);
|
|
325
|
+
const groupCellProps = run.group.cellProps?.(run.first, run.firstFlexIndex);
|
|
326
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("th", {
|
|
327
|
+
...groupCellProps,
|
|
328
|
+
className: (0, apollo_wind_namespaceObject.cn)(external_gridStyles_cjs_namespaceObject.GROUP_CELL_CLASS, run.group.toneClassName, groupCellProps?.className, void 0 !== run.pinnedLeftPx && 'z-3', hostTopEdge),
|
|
329
|
+
style: void 0 !== run.pinnedLeftPx ? {
|
|
330
|
+
left: run.pinnedLeftPx
|
|
331
|
+
} : void 0,
|
|
332
|
+
scope: "colgroup",
|
|
333
|
+
colSpan: run.count,
|
|
334
|
+
children: run.group.renderLabel ? run.group.renderLabel({
|
|
335
|
+
first: run.first,
|
|
336
|
+
firstFlexIndex: run.firstFlexIndex,
|
|
337
|
+
isFirstRunOfGroup: run.isFirstRunOfGroup,
|
|
338
|
+
label: run.group.label
|
|
339
|
+
}) : run.group.label
|
|
340
|
+
}, `group-${run.group.id}-${run.firstFlexIndex}`);
|
|
341
|
+
}),
|
|
342
|
+
hasTrailing && (trailingGroupCell ?? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("td", {
|
|
343
|
+
"aria-hidden": "true",
|
|
344
|
+
className: (0, apollo_wind_namespaceObject.cn)(external_gridStyles_cjs_namespaceObject.GROUP_GUTTER_CLASS, 'right-0 z-3')
|
|
345
|
+
}))
|
|
346
|
+
]
|
|
347
|
+
}),
|
|
348
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("tr", {
|
|
349
|
+
"aria-rowindex": headerRowCount,
|
|
350
|
+
className: (0, apollo_wind_namespaceObject.cn)(framedByHost && '[&>*:last-child]:border-r-0'),
|
|
351
|
+
children: [
|
|
352
|
+
hasLeading && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("th", {
|
|
353
|
+
className: (0, apollo_wind_namespaceObject.cn)(external_gridStyles_cjs_namespaceObject.HEADER_CELL_CLASS, 'left-0 z-3 text-center align-middle'),
|
|
354
|
+
scope: "col",
|
|
355
|
+
children: labels.rowNumberHeader ?? '#'
|
|
356
|
+
}),
|
|
357
|
+
visibleColumns.map((visible)=>{
|
|
358
|
+
if ('separator' === visible.type) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("td", {
|
|
359
|
+
"aria-hidden": "true",
|
|
360
|
+
"data-separator": "header",
|
|
361
|
+
"data-testid": `${dataTestId}-separator-${visible.beforeColumnId}`,
|
|
362
|
+
className: external_gridStyles_cjs_namespaceObject.SEPARATOR_HEADER_CELL_CLASS,
|
|
363
|
+
style: {
|
|
364
|
+
width: visible.widthPx
|
|
365
|
+
},
|
|
366
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.ArrowRight, {
|
|
367
|
+
"aria-hidden": true,
|
|
368
|
+
className: "inline-block size-3.5"
|
|
369
|
+
})
|
|
370
|
+
}, `header-separator-${visible.beforeColumnId}`);
|
|
371
|
+
if ('spacer' === visible.type) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("td", {
|
|
372
|
+
"aria-hidden": "true",
|
|
373
|
+
className: external_gridStyles_cjs_namespaceObject.HEADER_CELL_CLASS,
|
|
374
|
+
style: {
|
|
375
|
+
width: visible.widthPx
|
|
376
|
+
}
|
|
377
|
+
}, `header-spacer-${visible.coveredIds[0]}`);
|
|
378
|
+
const width = widths[visible.flexIndex] ?? visible.column.defaultWidth;
|
|
379
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_default().Fragment, {
|
|
380
|
+
children: renderHeaderCell(visible.column, {
|
|
381
|
+
resizeHandle: renderResizeHandle(visible.column, width),
|
|
382
|
+
pinnedLeftPx: pinnedLeftPxOf(visible.flexIndex)
|
|
383
|
+
})
|
|
384
|
+
}, visible.column.id);
|
|
385
|
+
}),
|
|
386
|
+
hasTrailing && trailingHeaderCell
|
|
387
|
+
]
|
|
388
|
+
})
|
|
389
|
+
]
|
|
390
|
+
}),
|
|
391
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("tbody", {
|
|
392
|
+
children: [
|
|
393
|
+
(()=>{
|
|
394
|
+
let nextRowIndex = 0;
|
|
395
|
+
return layout.rowSegments.flatMap((segment)=>{
|
|
396
|
+
if ('spacer' === segment.type) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("tr", {
|
|
397
|
+
role: "presentation",
|
|
398
|
+
"data-testid": `${dataTestId}-row-spacer`,
|
|
399
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("td", {
|
|
400
|
+
colSpan: bodyColSpan,
|
|
401
|
+
style: {
|
|
402
|
+
padding: 0,
|
|
403
|
+
border: 'none',
|
|
404
|
+
height: segment.sizePx
|
|
405
|
+
}
|
|
406
|
+
})
|
|
407
|
+
}, `spacer-${nextRowIndex}`);
|
|
408
|
+
const rows = [];
|
|
409
|
+
for(let rowIndex = segment.from; rowIndex < segment.to; rowIndex++)rows.push(renderRow(rowIndex, visibleColumns));
|
|
410
|
+
nextRowIndex = segment.to;
|
|
411
|
+
return rows;
|
|
412
|
+
});
|
|
413
|
+
})(),
|
|
414
|
+
renderFooterRow?.(bodyColSpan)
|
|
415
|
+
]
|
|
416
|
+
})
|
|
417
|
+
]
|
|
418
|
+
}),
|
|
419
|
+
dragState && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
420
|
+
className: "pointer-events-none absolute z-4 bg-primary",
|
|
421
|
+
"data-testid": `${dataTestId}-drop-indicator`,
|
|
422
|
+
style: 'row' === dragState.axis ? {
|
|
423
|
+
top: headerHeight() + dragState.boundary * rowHeightPx - 1,
|
|
424
|
+
left: 0,
|
|
425
|
+
width: totalWidth,
|
|
426
|
+
height: 2
|
|
427
|
+
} : {
|
|
428
|
+
left: columnLeading() + (layout.columnOffsets[(boundaries[dragState.groupIndex] ?? 0) + dragState.boundary] ?? 0) - 1,
|
|
429
|
+
top: 0,
|
|
430
|
+
width: 2,
|
|
431
|
+
height: headerHeight() + rowCount * rowHeightPx
|
|
432
|
+
}
|
|
433
|
+
}),
|
|
434
|
+
children
|
|
435
|
+
]
|
|
436
|
+
});
|
|
437
|
+
if (framedByHost) return scrollContainer;
|
|
438
|
+
const consumerPointerDown = restContainerProps.onPointerDown;
|
|
439
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
440
|
+
className: external_gridStyles_cjs_namespaceObject.GRID_PANE_CLASS,
|
|
441
|
+
onPointerDown: (event)=>{
|
|
442
|
+
if (event.target === event.currentTarget) consumerPointerDown?.(event);
|
|
443
|
+
},
|
|
444
|
+
children: scrollContainer
|
|
445
|
+
});
|
|
446
|
+
});
|
|
447
|
+
DecisionTable.displayName = 'DecisionTable';
|
|
448
|
+
exports.DecisionTable = __webpack_exports__.DecisionTable;
|
|
449
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
450
|
+
"DecisionTable"
|
|
451
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
452
|
+
Object.defineProperty(exports, '__esModule', {
|
|
453
|
+
value: true
|
|
454
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { GridClipboardProps, GridColumn, GridHandle, GridLabels, VisibleGridColumn } from './gridTypes';
|
|
3
|
+
export interface HeaderCellContext {
|
|
4
|
+
resizeHandle: React.ReactNode;
|
|
5
|
+
pinnedLeftPx?: number;
|
|
6
|
+
}
|
|
7
|
+
export interface DecisionTableProps {
|
|
8
|
+
columns: GridColumn[];
|
|
9
|
+
rowCount: number;
|
|
10
|
+
rowHeightPx?: number;
|
|
11
|
+
leadingColumnWidth?: number;
|
|
12
|
+
trailingColumnWidth?: number;
|
|
13
|
+
pinnedColumnCount?: number;
|
|
14
|
+
initialColumnWidths?: Record<string, number> | Promise<Record<string, number>> | null;
|
|
15
|
+
onColumnWidthsChange?: (widths: Record<string, number>) => void;
|
|
16
|
+
columnsResizable?: boolean;
|
|
17
|
+
framedByHost?: boolean;
|
|
18
|
+
columnGroupSizes?: number[];
|
|
19
|
+
onRowMove?: (from: number, to: number) => void;
|
|
20
|
+
onColumnMove?: (groupIndex: number, from: number, to: number) => void;
|
|
21
|
+
retainedRowIndex?: number | null;
|
|
22
|
+
retainedColumnIndex?: number | null;
|
|
23
|
+
renderHeaderCell: (column: GridColumn, context: HeaderCellContext) => React.ReactNode;
|
|
24
|
+
renderRow: (rowIndex: number, visibleColumns: VisibleGridColumn[]) => React.ReactNode;
|
|
25
|
+
renderFooterRow?: (colSpan: number) => React.ReactNode;
|
|
26
|
+
trailingHeaderCell?: React.ReactNode;
|
|
27
|
+
trailingGroupCell?: React.ReactNode;
|
|
28
|
+
clipboard?: GridClipboardProps;
|
|
29
|
+
tableAriaLabel?: string;
|
|
30
|
+
containerProps?: React.HTMLAttributes<HTMLDivElement> & Record<`data-${string}`, string | undefined>;
|
|
31
|
+
dataTestId: string;
|
|
32
|
+
labels: GridLabels;
|
|
33
|
+
children?: React.ReactNode;
|
|
34
|
+
}
|
|
35
|
+
export declare const DecisionTable: React.ForwardRefExoticComponent<DecisionTableProps & React.RefAttributes<GridHandle>>;
|
|
36
|
+
//# sourceMappingURL=DecisionTable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DecisionTable.d.ts","sourceRoot":"","sources":["../../src/decision-table/DecisionTable.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA0E,MAAM,OAAO,CAAC;AAgB/F,OAAO,KAAK,EACV,kBAAkB,EAClB,UAAU,EAEV,UAAU,EACV,UAAU,EACV,iBAAiB,EAClB,MAAM,aAAa,CAAC;AAMrB,MAAM,WAAW,iBAAiB;IAEhC,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC;IAE9B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,kBAAkB;IAKjC,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IAEjB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAO3B,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC;IAEtF,oBAAoB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;IAEhE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B,YAAY,CAAC,EAAE,OAAO,CAAC;IAOvB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE5B,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAE/C,YAAY,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAEtE,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEjC,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEpC,gBAAgB,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,iBAAiB,KAAK,KAAK,CAAC,SAAS,CAAC;IAMtF,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,iBAAiB,EAAE,KAAK,KAAK,CAAC,SAAS,CAAC;IAEtF,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC;IAEvD,kBAAkB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAErC,iBAAiB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAKpC,SAAS,CAAC,EAAE,kBAAkB,CAAC;IAE/B,cAAc,CAAC,EAAE,MAAM,CAAC;IAKxB,cAAc,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,GACnD,MAAM,CAAC,QAAQ,MAAM,EAAE,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IAG/C,UAAU,EAAE,MAAM,CAAC;IAEnB,MAAM,EAAE,UAAU,CAAC;IAEnB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAmFD,eAAO,MAAM,aAAa,uFAyjBzB,CAAC"}
|