@uipath/apollo-react 7.17.1 → 7.17.3
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/components/Toolbox/ListView.cjs +7 -4
- package/dist/canvas/components/Toolbox/ListView.d.ts +2 -0
- package/dist/canvas/components/Toolbox/ListView.d.ts.map +1 -1
- package/dist/canvas/components/Toolbox/ListView.js +7 -4
- package/dist/canvas/components/Toolbox/Toolbox.cjs +1 -0
- package/dist/canvas/components/Toolbox/Toolbox.d.ts.map +1 -1
- package/dist/canvas/components/Toolbox/Toolbox.js +1 -0
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/dist/chat/styles/tailwind.chat.css +1 -1
- package/dist/decision-table/DecisionTable.cjs +232 -35
- package/dist/decision-table/DecisionTable.d.ts +6 -0
- package/dist/decision-table/DecisionTable.d.ts.map +1 -1
- package/dist/decision-table/DecisionTable.js +235 -38
- package/dist/decision-table/DragIndicator.cjs +47 -0
- package/dist/decision-table/DragIndicator.d.ts +6 -0
- package/dist/decision-table/DragIndicator.d.ts.map +1 -0
- package/dist/decision-table/DragIndicator.js +13 -0
- package/dist/decision-table/EdgeInsertButton.cjs +87 -0
- package/dist/decision-table/EdgeInsertButton.d.ts +11 -0
- package/dist/decision-table/EdgeInsertButton.d.ts.map +1 -0
- package/dist/decision-table/EdgeInsertButton.js +53 -0
- package/dist/decision-table/GridCell.cjs +2 -1
- package/dist/decision-table/GridCell.d.ts.map +1 -1
- package/dist/decision-table/GridCell.js +3 -2
- package/dist/decision-table/gridStyles.cjs +67 -23
- package/dist/decision-table/gridStyles.d.ts +14 -4
- package/dist/decision-table/gridStyles.d.ts.map +1 -1
- package/dist/decision-table/gridStyles.js +27 -13
- package/dist/decision-table/gridTypes.d.ts +9 -2
- package/dist/decision-table/gridTypes.d.ts.map +1 -1
- package/dist/decision-table/index.cjs +76 -68
- package/dist/decision-table/index.d.ts +4 -1
- package/dist/decision-table/index.d.ts.map +1 -1
- package/dist/decision-table/index.js +5 -2
- package/dist/decision-table/locales/de.cjs +36 -0
- package/dist/decision-table/locales/de.d.ts +3 -0
- package/dist/decision-table/locales/de.d.ts.map +1 -0
- package/dist/decision-table/locales/de.js +2 -0
- package/dist/decision-table/locales/en.cjs +36 -0
- package/dist/decision-table/locales/en.d.ts +3 -0
- package/dist/decision-table/locales/en.d.ts.map +1 -0
- package/dist/decision-table/locales/en.js +2 -0
- package/dist/decision-table/locales/es-MX.cjs +36 -0
- package/dist/decision-table/locales/es-MX.d.ts +3 -0
- package/dist/decision-table/locales/es-MX.d.ts.map +1 -0
- package/dist/decision-table/locales/es-MX.js +2 -0
- package/dist/decision-table/locales/es.cjs +36 -0
- package/dist/decision-table/locales/es.d.ts +3 -0
- package/dist/decision-table/locales/es.d.ts.map +1 -0
- package/dist/decision-table/locales/es.js +2 -0
- package/dist/decision-table/locales/fr.cjs +36 -0
- package/dist/decision-table/locales/fr.d.ts +3 -0
- package/dist/decision-table/locales/fr.d.ts.map +1 -0
- package/dist/decision-table/locales/fr.js +2 -0
- package/dist/decision-table/locales/ja.cjs +36 -0
- package/dist/decision-table/locales/ja.d.ts +3 -0
- package/dist/decision-table/locales/ja.d.ts.map +1 -0
- package/dist/decision-table/locales/ja.js +2 -0
- package/dist/decision-table/locales/ko.cjs +36 -0
- package/dist/decision-table/locales/ko.d.ts +3 -0
- package/dist/decision-table/locales/ko.d.ts.map +1 -0
- package/dist/decision-table/locales/ko.js +2 -0
- package/dist/decision-table/locales/pt-BR.cjs +36 -0
- package/dist/decision-table/locales/pt-BR.d.ts +3 -0
- package/dist/decision-table/locales/pt-BR.d.ts.map +1 -0
- package/dist/decision-table/locales/pt-BR.js +2 -0
- package/dist/decision-table/locales/pt.cjs +36 -0
- package/dist/decision-table/locales/pt.d.ts +3 -0
- package/dist/decision-table/locales/pt.d.ts.map +1 -0
- package/dist/decision-table/locales/pt.js +2 -0
- package/dist/decision-table/locales/ro.cjs +36 -0
- package/dist/decision-table/locales/ro.d.ts +3 -0
- package/dist/decision-table/locales/ro.d.ts.map +1 -0
- package/dist/decision-table/locales/ro.js +2 -0
- package/dist/decision-table/locales/ru.cjs +36 -0
- package/dist/decision-table/locales/ru.d.ts +3 -0
- package/dist/decision-table/locales/ru.d.ts.map +1 -0
- package/dist/decision-table/locales/ru.js +2 -0
- package/dist/decision-table/locales/tr.cjs +36 -0
- package/dist/decision-table/locales/tr.d.ts +3 -0
- package/dist/decision-table/locales/tr.d.ts.map +1 -0
- package/dist/decision-table/locales/tr.js +2 -0
- package/dist/decision-table/locales/zh-CN.cjs +36 -0
- package/dist/decision-table/locales/zh-CN.d.ts +3 -0
- package/dist/decision-table/locales/zh-CN.d.ts.map +1 -0
- package/dist/decision-table/locales/zh-CN.js +2 -0
- package/dist/decision-table/locales/zh-TW.cjs +36 -0
- package/dist/decision-table/locales/zh-TW.d.ts +3 -0
- package/dist/decision-table/locales/zh-TW.d.ts.map +1 -0
- package/dist/decision-table/locales/zh-TW.js +2 -0
- package/dist/decision-table/styles/tailwind.decision-table.css +1 -1
- package/dist/decision-table/useDragReorder.cjs +363 -52
- package/dist/decision-table/useDragReorder.d.ts +35 -5
- package/dist/decision-table/useDragReorder.d.ts.map +1 -1
- package/dist/decision-table/useDragReorder.js +342 -46
- package/dist/decision-table/useGridStrings.cjs +57 -0
- package/dist/decision-table/useGridStrings.d.ts +7 -0
- package/dist/decision-table/useGridStrings.d.ts.map +1 -0
- package/dist/decision-table/useGridStrings.js +23 -0
- package/dist/decision-table/useRowHover.cjs +89 -0
- package/dist/decision-table/useRowHover.d.ts +3 -0
- package/dist/decision-table/useRowHover.d.ts.map +1 -0
- package/dist/decision-table/useRowHover.js +55 -0
- package/dist/i18n/locale-registry.cjs +30 -0
- package/dist/i18n/locale-registry.d.ts.map +1 -1
- package/dist/i18n/locale-registry.js +32 -2
- package/package.json +4 -4
|
@@ -44,9 +44,13 @@ const external_react_namespaceObject = require("react");
|
|
|
44
44
|
var external_react_default = /*#__PURE__*/ __webpack_require__.n(external_react_namespaceObject);
|
|
45
45
|
const external_constants_cjs_namespaceObject = require("./constants.cjs");
|
|
46
46
|
const external_gridStyles_cjs_namespaceObject = require("./gridStyles.cjs");
|
|
47
|
+
const external_MarkGlyph_cjs_namespaceObject = require("./MarkGlyph.cjs");
|
|
47
48
|
const external_useDragReorder_cjs_namespaceObject = require("./useDragReorder.cjs");
|
|
48
49
|
const external_useGridClipboard_cjs_namespaceObject = require("./useGridClipboard.cjs");
|
|
49
50
|
const external_useGridLayout_cjs_namespaceObject = require("./useGridLayout.cjs");
|
|
51
|
+
const external_useRowHover_cjs_namespaceObject = require("./useRowHover.cjs");
|
|
52
|
+
const DRAG_SHIFT_TRANSITION = 'transform 150ms ease';
|
|
53
|
+
const visiblePositionOf = (visibleColumns, flexIndex)=>visibleColumns.findIndex((visible)=>'column' === visible.type && visible.flexIndex === flexIndex);
|
|
50
54
|
const groupBoundsOf = (columns)=>{
|
|
51
55
|
const bounds = new Map();
|
|
52
56
|
columns.forEach((column, flexIndex)=>{
|
|
@@ -121,44 +125,117 @@ const markGroupEdges = (groupBounds, runs)=>{
|
|
|
121
125
|
run.endsGroup = run.firstFlexIndex + run.count - 1 === bounds?.last;
|
|
122
126
|
}
|
|
123
127
|
};
|
|
124
|
-
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, columnGroupSizes, onRowMove, onColumnMove, retainedRowIndex = null, retainedColumnIndex = null, renderHeaderCell, renderRow, renderFooterRow, topLeftCorner = '#', trailingHeaderCell, trailingGroupCell, tableAriaLabel, clipboard, containerProps, dataTestId, labels, children }, ref)=>{
|
|
128
|
+
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, headerEdgeInserts = false, columnGroupSizes, onRowMove, onColumnMove, retainedRowIndex = null, retainedColumnIndex = null, renderHeaderCell, renderRow, renderFooterRow, topLeftCorner = '#', tableMark, trailingHeaderCell, trailingGroupCell, tableAriaLabel, clipboard, containerProps, dataTestId, labels, children }, ref)=>{
|
|
125
129
|
const containerRef = (0, external_react_namespaceObject.useRef)(null);
|
|
126
130
|
const layoutRef = (0, external_react_namespaceObject.useRef)(null);
|
|
127
131
|
const headerHeight = (0, external_react_namespaceObject.useCallback)(()=>layoutRef.current?.headerHeight() ?? 0, []);
|
|
128
132
|
const columnLeading = (0, external_react_namespaceObject.useCallback)(()=>layoutRef.current?.columnLeading() ?? 0, []);
|
|
129
133
|
const columnOffsets = (0, external_react_namespaceObject.useCallback)(()=>layoutRef.current?.columnOffsets ?? [], []);
|
|
134
|
+
const columnWidth = (0, external_react_namespaceObject.useCallback)((dataIndex)=>{
|
|
135
|
+
const flexIndex = (layoutRef.current?.pinnedColumnCount ?? 0) + dataIndex;
|
|
136
|
+
return layoutRef.current?.widths[flexIndex] ?? columns[flexIndex]?.defaultWidth ?? 0;
|
|
137
|
+
}, [
|
|
138
|
+
columns
|
|
139
|
+
]);
|
|
130
140
|
const onRowMoveRef = (0, external_react_namespaceObject.useRef)(onRowMove);
|
|
131
141
|
onRowMoveRef.current = onRowMove;
|
|
132
142
|
const onColumnMoveRef = (0, external_react_namespaceObject.useRef)(onColumnMove);
|
|
133
143
|
onColumnMoveRef.current = onColumnMove;
|
|
134
144
|
const sizesKey = (columnGroupSizes ?? []).join(',');
|
|
145
|
+
const windowedColumnCount = Math.max(0, columns.length - pinnedColumnCount);
|
|
135
146
|
const boundaries = external_react_default().useMemo(()=>{
|
|
136
147
|
const out = [
|
|
137
148
|
0
|
|
138
149
|
];
|
|
139
|
-
for (const size of columnGroupSizes ?? [])out.push(out[out.length - 1] + size);
|
|
150
|
+
for (const size of columnGroupSizes ?? [])out.push(Math.min(out[out.length - 1] + size, windowedColumnCount));
|
|
140
151
|
return out;
|
|
141
152
|
}, [
|
|
142
|
-
sizesKey
|
|
153
|
+
sizesKey,
|
|
154
|
+
windowedColumnCount
|
|
143
155
|
]);
|
|
144
|
-
const
|
|
156
|
+
const boundariesRef = (0, external_react_namespaceObject.useRef)(boundaries);
|
|
157
|
+
boundariesRef.current = boundaries;
|
|
158
|
+
const previewHostRef = (0, external_react_namespaceObject.useRef)(null);
|
|
159
|
+
const dropIndicatorRef = (0, external_react_namespaceObject.useRef)(null);
|
|
160
|
+
const dragSourcesRef = (0, external_react_namespaceObject.useRef)([]);
|
|
161
|
+
const clipColumnDrag = (0, external_react_namespaceObject.useCallback)((axis)=>{
|
|
162
|
+
const container = containerRef.current;
|
|
163
|
+
const head = container?.querySelector(':scope > table')?.tHead;
|
|
164
|
+
const labelRow = head?.rows[head.rows.length - 1];
|
|
165
|
+
const clipPath = 'column' === axis && container ? `inset(${container.scrollTop + (labelRow?.offsetTop ?? 0)}px -32px -32px)` : '';
|
|
166
|
+
for (const layer of [
|
|
167
|
+
previewHostRef.current,
|
|
168
|
+
dropIndicatorRef.current
|
|
169
|
+
])if (layer) layer.style.clipPath = clipPath;
|
|
170
|
+
}, []);
|
|
171
|
+
const dragLayoutRef = (0, external_react_namespaceObject.useRef)(null);
|
|
172
|
+
const shiftedRef = (0, external_react_namespaceObject.useRef)(new Map());
|
|
173
|
+
const settledRef = (0, external_react_namespaceObject.useRef)(false);
|
|
174
|
+
const snapDragShifts = (0, external_react_namespaceObject.useCallback)(()=>{
|
|
175
|
+
for (const element of shiftedRef.current.keys()){
|
|
176
|
+
element.style.transition = '';
|
|
177
|
+
element.style.transform = '';
|
|
178
|
+
}
|
|
179
|
+
shiftedRef.current.clear();
|
|
180
|
+
settledRef.current = true;
|
|
181
|
+
}, []);
|
|
182
|
+
const fillPreview = (0, external_react_namespaceObject.useCallback)((state)=>{
|
|
183
|
+
const host = previewHostRef.current;
|
|
184
|
+
const shape = dragLayoutRef.current;
|
|
185
|
+
if (!host || !shape) return false;
|
|
186
|
+
const dataIndex = 'column' === state.axis ? (boundariesRef.current[state.groupIndex] ?? 0) + state.from : 0;
|
|
187
|
+
const position = 'column' === state.axis ? visiblePositionOf(shape.visibleColumns, shape.pinnedCount + dataIndex) : 0;
|
|
188
|
+
const preview = 'row' === state.axis ? (0, external_useDragReorder_cjs_namespaceObject.buildRowPreview)(containerRef.current, state.from + shape.headerRowCount + 1) : position < 0 ? null : (0, external_useDragReorder_cjs_namespaceObject.buildColumnPreview)(containerRef.current, {
|
|
189
|
+
headerCellIndex: position + shape.headerLeading,
|
|
190
|
+
bodyCellIndex: position + shape.bodyLeading,
|
|
191
|
+
widthPx: columnWidth(dataIndex)
|
|
192
|
+
});
|
|
193
|
+
if (!preview) return false;
|
|
194
|
+
host.replaceChildren(preview.table);
|
|
195
|
+
for (const source of preview.sources)source.setAttribute('data-drag-source', '');
|
|
196
|
+
dragSourcesRef.current = preview.sources;
|
|
197
|
+
return true;
|
|
198
|
+
}, [
|
|
199
|
+
columnWidth
|
|
200
|
+
]);
|
|
201
|
+
const onDragMove = (0, external_react_namespaceObject.useCallback)((state, px)=>{
|
|
202
|
+
const host = previewHostRef.current;
|
|
203
|
+
const shape = dragLayoutRef.current;
|
|
204
|
+
if (!host || !shape) return;
|
|
205
|
+
if (null === px) {
|
|
206
|
+
host.replaceChildren();
|
|
207
|
+
host.style.transform = '';
|
|
208
|
+
clipColumnDrag(null);
|
|
209
|
+
for (const source of dragSourcesRef.current)source.removeAttribute('data-drag-source');
|
|
210
|
+
dragSourcesRef.current = [];
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
if (!host.firstChild && !fillPreview(state)) return;
|
|
214
|
+
host.style.transform = 'row' === state.axis ? `translateY(${px}px)` : `translateX(${px}px)`;
|
|
215
|
+
clipColumnDrag(state.axis);
|
|
216
|
+
}, [
|
|
217
|
+
fillPreview,
|
|
218
|
+
clipColumnDrag
|
|
219
|
+
]);
|
|
220
|
+
const { dragState, startRowDrag, startColumnDrag } = (0, external_useDragReorder_cjs_namespaceObject.useDragReorder)({
|
|
145
221
|
containerRef,
|
|
146
222
|
headerHeight,
|
|
147
223
|
columnLeading,
|
|
148
224
|
columnOffsets,
|
|
225
|
+
columnWidth,
|
|
149
226
|
rowHeightPx,
|
|
150
227
|
rowCount,
|
|
151
228
|
columnGroupBoundaries: boundaries,
|
|
152
|
-
onDropRow: (from, to)=>
|
|
153
|
-
|
|
229
|
+
onDropRow: (from, to)=>{
|
|
230
|
+
snapDragShifts();
|
|
231
|
+
onRowMoveRef.current?.(from, to);
|
|
232
|
+
},
|
|
233
|
+
onDropColumn: (groupIndex, from, to)=>{
|
|
234
|
+
snapDragShifts();
|
|
235
|
+
onColumnMoveRef.current?.(groupIndex, from, to);
|
|
236
|
+
},
|
|
237
|
+
onDragMove
|
|
154
238
|
});
|
|
155
|
-
const boundariesRef = (0, external_react_namespaceObject.useRef)(boundaries);
|
|
156
|
-
boundariesRef.current = boundaries;
|
|
157
|
-
const startColumnDrag = (0, external_react_namespaceObject.useCallback)((groupIndex, indexInGroup, event)=>{
|
|
158
|
-
if (boundariesRef.current.length >= 2) beginColumnDrag(groupIndex, indexInGroup, event);
|
|
159
|
-
}, [
|
|
160
|
-
beginColumnDrag
|
|
161
|
-
]);
|
|
162
239
|
const dragRetainedRow = dragState?.axis === 'row' ? dragState.from : null;
|
|
163
240
|
const dragRetainedColumn = dragState?.axis === 'column' ? (boundaries[dragState.groupIndex] ?? 0) + dragState.from : null;
|
|
164
241
|
const layout = (0, external_useGridLayout_cjs_namespaceObject.useGridLayout)({
|
|
@@ -188,8 +265,112 @@ const DecisionTable = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRe
|
|
|
188
265
|
className: external_gridStyles_cjs_namespaceObject.TOP_LEFT_CORNER_CELL_CLASS,
|
|
189
266
|
scope: "col",
|
|
190
267
|
"data-testid": `${dataTestId}-top-left-corner`,
|
|
191
|
-
children:
|
|
268
|
+
children: tableMark ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
269
|
+
className: "flex flex-col items-center justify-center gap-1",
|
|
270
|
+
children: [
|
|
271
|
+
topLeftCorner,
|
|
272
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
273
|
+
role: "img",
|
|
274
|
+
className: "inline-flex size-5 items-center justify-center",
|
|
275
|
+
"aria-label": tableMark.title,
|
|
276
|
+
"data-mark-title": tableMark.title,
|
|
277
|
+
"data-tone": tableMark.tone,
|
|
278
|
+
"data-testid": `${dataTestId}-table-mark`,
|
|
279
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_MarkGlyph_cjs_namespaceObject.MarkGlyph, {
|
|
280
|
+
tone: tableMark.tone,
|
|
281
|
+
className: "size-3"
|
|
282
|
+
})
|
|
283
|
+
})
|
|
284
|
+
]
|
|
285
|
+
}) : topLeftCorner
|
|
192
286
|
});
|
|
287
|
+
const bodyLeading = hasLeading ? 1 : 0;
|
|
288
|
+
const headerLeading = hasLeading && !hasGroupRow ? 1 : 0;
|
|
289
|
+
dragLayoutRef.current = {
|
|
290
|
+
headerRowCount,
|
|
291
|
+
visibleColumns,
|
|
292
|
+
pinnedCount: layout.pinnedColumnCount,
|
|
293
|
+
bodyLeading,
|
|
294
|
+
headerLeading
|
|
295
|
+
};
|
|
296
|
+
(0, external_react_namespaceObject.useLayoutEffect)(()=>{
|
|
297
|
+
const shifted = shiftedRef.current;
|
|
298
|
+
if (!dragState || settledRef.current) {
|
|
299
|
+
settledRef.current = null !== dragState;
|
|
300
|
+
for (const [element, shift] of shifted)if (0 !== shift) {
|
|
301
|
+
element.style.transition = DRAG_SHIFT_TRANSITION;
|
|
302
|
+
element.style.transform = '';
|
|
303
|
+
}
|
|
304
|
+
shifted.clear();
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
if (previewHostRef.current?.firstChild) fillPreview(dragState);
|
|
308
|
+
clipColumnDrag(dragState.axis);
|
|
309
|
+
const table = containerRef.current?.querySelector(':scope > table');
|
|
310
|
+
if (!(table instanceof HTMLTableElement)) return;
|
|
311
|
+
const to = (0, external_useDragReorder_cjs_namespaceObject.dropIndex)(dragState.from, dragState.boundary);
|
|
312
|
+
const placed = new Set();
|
|
313
|
+
const place = (element, shift, axis)=>{
|
|
314
|
+
placed.add(element);
|
|
315
|
+
const previous = shifted.get(element);
|
|
316
|
+
if (previous === shift) return;
|
|
317
|
+
element.style.transition = void 0 === previous ? '' : DRAG_SHIFT_TRANSITION;
|
|
318
|
+
element.style.transform = 0 === shift ? '' : `translate${axis}(${shift}px)`;
|
|
319
|
+
shifted.set(element, shift);
|
|
320
|
+
};
|
|
321
|
+
const bodyRows = Array.from(table.tBodies[0]?.rows ?? []).filter((row)=>row.hasAttribute('aria-rowindex'));
|
|
322
|
+
if ('row' === dragState.axis) {
|
|
323
|
+
const rowSize = ()=>rowHeightPx;
|
|
324
|
+
for (const row of bodyRows){
|
|
325
|
+
const index = Number(row.getAttribute('aria-rowindex')) - headerRowCount - 1;
|
|
326
|
+
if (index >= 0 && index < rowCount) place(row, (0, external_useDragReorder_cjs_namespaceObject.dragShiftPx)(index, dragState.from, to, rowSize), 'Y');
|
|
327
|
+
}
|
|
328
|
+
} else {
|
|
329
|
+
const start = boundaries[dragState.groupIndex] ?? 0;
|
|
330
|
+
const end = boundaries[dragState.groupIndex + 1] ?? start;
|
|
331
|
+
const { sizeAt } = (0, external_useDragReorder_cjs_namespaceObject.bandGeometry)(layout.columnOffsets, columnWidth, start);
|
|
332
|
+
const headerRow = table.tHead?.rows[table.tHead.rows.length - 1];
|
|
333
|
+
const cellRows = bodyRows.filter((row)=>row.cells.length > 1);
|
|
334
|
+
for(let index = 0; index < end - start; index++){
|
|
335
|
+
const position = visiblePositionOf(visibleColumns, layout.pinnedColumnCount + start + index);
|
|
336
|
+
if (position < 0) continue;
|
|
337
|
+
const shift = (0, external_useDragReorder_cjs_namespaceObject.dragShiftPx)(index, dragState.from, to, sizeAt);
|
|
338
|
+
const header = headerRow?.cells[position + headerLeading];
|
|
339
|
+
if (header) place(header, shift, 'X');
|
|
340
|
+
for (const row of cellRows){
|
|
341
|
+
const cell = row.cells[position + bodyLeading];
|
|
342
|
+
if (cell) place(cell, shift, 'X');
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
for (const element of shifted.keys())if (!placed.has(element)) {
|
|
347
|
+
element.style.transition = '';
|
|
348
|
+
element.style.transform = '';
|
|
349
|
+
shifted.delete(element);
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
const gapFrame = {
|
|
353
|
+
top: 0,
|
|
354
|
+
left: 0,
|
|
355
|
+
transition: DRAG_SHIFT_TRANSITION
|
|
356
|
+
};
|
|
357
|
+
const dropGapStyle = (state)=>{
|
|
358
|
+
const to = (0, external_useDragReorder_cjs_namespaceObject.dropIndex)(state.from, state.boundary);
|
|
359
|
+
if ('row' === state.axis) return {
|
|
360
|
+
...gapFrame,
|
|
361
|
+
transform: `translateY(${headerHeight() + to * rowHeightPx - 1}px)`,
|
|
362
|
+
width: totalWidth,
|
|
363
|
+
height: rowHeightPx + 2
|
|
364
|
+
};
|
|
365
|
+
const band = (0, external_useDragReorder_cjs_namespaceObject.bandGeometry)(layout.columnOffsets, columnWidth, boundaries[state.groupIndex] ?? 0);
|
|
366
|
+
const left = columnLeading() + band.left + (0, external_useDragReorder_cjs_namespaceObject.gapStartPx)(state.from, to, band.offsetOf, band.sizeAt);
|
|
367
|
+
return {
|
|
368
|
+
...gapFrame,
|
|
369
|
+
transform: `translateX(${left - 1}px)`,
|
|
370
|
+
width: band.sizeAt(state.from) + 2,
|
|
371
|
+
height: headerHeight() + rowCount * rowHeightPx
|
|
372
|
+
};
|
|
373
|
+
};
|
|
193
374
|
const gridClipboard = (0, external_useGridClipboard_cjs_namespaceObject.useGridClipboard)(clipboard, {
|
|
194
375
|
rowCount,
|
|
195
376
|
columnCount: columns.length
|
|
@@ -202,8 +383,8 @@ const DecisionTable = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRe
|
|
|
202
383
|
totalWidth: ()=>layoutRef.current?.totalWidth ?? 0,
|
|
203
384
|
scrollRowIntoView: (rowIndex)=>layoutRef.current?.scrollRowIntoView(rowIndex),
|
|
204
385
|
scrollColumnIntoView: (windowIndex)=>layoutRef.current?.scrollColumnIntoView(windowIndex),
|
|
205
|
-
startRowDrag,
|
|
206
|
-
startColumnDrag,
|
|
386
|
+
startRowDrag: (rowIndex, event)=>void 0 !== onRowMoveRef.current && startRowDrag(rowIndex, event),
|
|
387
|
+
startColumnDrag: (groupIndex, indexInGroup, event)=>void 0 !== onColumnMoveRef.current && startColumnDrag(groupIndex, indexInGroup, event),
|
|
207
388
|
clipboard: gridClipboard.actions
|
|
208
389
|
}), [
|
|
209
390
|
headerHeight,
|
|
@@ -230,6 +411,12 @@ const DecisionTable = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRe
|
|
|
230
411
|
});
|
|
231
412
|
return ()=>container.removeEventListener('scroll', markScrolled);
|
|
232
413
|
}, []);
|
|
414
|
+
const rowHoverRef = (0, external_react_namespaceObject.useRef)(null);
|
|
415
|
+
const rowTopPx = (0, external_react_namespaceObject.useCallback)((index)=>headerHeight() + index * rowHeightPx, [
|
|
416
|
+
headerHeight,
|
|
417
|
+
rowHeightPx
|
|
418
|
+
]);
|
|
419
|
+
(0, external_useRowHover_cjs_namespaceObject.useRowHover)(containerRef, rowHoverRef, rowTopPx, null === dragState);
|
|
233
420
|
const pinnedLeftPxOf = (flexIndex)=>{
|
|
234
421
|
if (flexIndex >= layout.pinnedColumnCount) return;
|
|
235
422
|
let offset = leadingColumnWidth;
|
|
@@ -240,7 +427,7 @@ const DecisionTable = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRe
|
|
|
240
427
|
if (!columnsResizable) return null;
|
|
241
428
|
if (column.id === columns[columns.length - 1]?.id) return null;
|
|
242
429
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
243
|
-
className: external_gridStyles_cjs_namespaceObject.RESIZE_HANDLE_CLASS,
|
|
430
|
+
className: (0, apollo_wind_namespaceObject.cn)(external_gridStyles_cjs_namespaceObject.RESIZE_HANDLE_CLASS, headerEdgeInserts && external_gridStyles_cjs_namespaceObject.RESIZE_HANDLE_BELOW_INSERT_CLASS),
|
|
244
431
|
role: "separator",
|
|
245
432
|
"aria-orientation": "vertical",
|
|
246
433
|
"aria-valuenow": Math.round(width),
|
|
@@ -260,14 +447,14 @@ const DecisionTable = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRe
|
|
|
260
447
|
});
|
|
261
448
|
};
|
|
262
449
|
const pinnedEdgePx = leadingColumnWidth + widths.slice(0, layout.pinnedColumnCount).reduce((sum, width)=>sum + width, 0);
|
|
263
|
-
const bodyColSpan =
|
|
450
|
+
const bodyColSpan = bodyLeading + visibleColumns.length + (hasTrailing ? 1 : 0);
|
|
264
451
|
const { onFocus: consumerFocus, onBlur: consumerBlur, onKeyDown: consumerKeyDown, onCopy: consumerCopy, onCut: consumerCut, onPaste: consumerPaste, ...restContainerProps } = containerProps ?? {};
|
|
265
452
|
const composeClipboard = (mine, theirs)=>(event)=>{
|
|
266
453
|
mine?.(event);
|
|
267
454
|
if (!event.defaultPrevented) theirs?.(event);
|
|
268
455
|
};
|
|
269
456
|
const scrollContainer = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
270
|
-
className: external_gridStyles_cjs_namespaceObject.GRID_FRAME_CLASS,
|
|
457
|
+
className: (0, apollo_wind_namespaceObject.cn)(external_gridStyles_cjs_namespaceObject.GRID_FRAME_CLASS, dragState && 'cursor-grabbing [&_*]:cursor-grabbing!'),
|
|
271
458
|
ref: layout.attachContainer,
|
|
272
459
|
tabIndex: 0,
|
|
273
460
|
onFocus: (event)=>{
|
|
@@ -289,7 +476,7 @@ const DecisionTable = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRe
|
|
|
289
476
|
...restContainerProps,
|
|
290
477
|
children: [
|
|
291
478
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("table", {
|
|
292
|
-
className: (0, apollo_wind_namespaceObject.cn)('table-fixed border-separate border-spacing-0 text-xs text-foreground', external_gridStyles_cjs_namespaceObject.TABLE_EDGE_CLASS, external_gridStyles_cjs_namespaceObject.TABLE_HUG_EDGE_CLASS),
|
|
479
|
+
className: (0, apollo_wind_namespaceObject.cn)('table-fixed border-separate border-spacing-0 text-xs text-foreground', external_gridStyles_cjs_namespaceObject.TABLE_EDGE_CLASS, external_gridStyles_cjs_namespaceObject.TABLE_HUG_EDGE_CLASS, external_gridStyles_cjs_namespaceObject.DRAG_SOURCE_CLASS),
|
|
293
480
|
ref: layout.setTableElement,
|
|
294
481
|
style: {
|
|
295
482
|
width: totalWidth,
|
|
@@ -357,7 +544,7 @@ const DecisionTable = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRe
|
|
|
357
544
|
}, `group-separator-${run.beforeColumnId}`);
|
|
358
545
|
if ('gutter' === run.type) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("td", {
|
|
359
546
|
"aria-hidden": "true",
|
|
360
|
-
className: (0, apollo_wind_namespaceObject.cn)(external_gridStyles_cjs_namespaceObject.GROUP_GUTTER_CLASS, void 0 !== run.pinnedLeftPx &&
|
|
547
|
+
className: (0, apollo_wind_namespaceObject.cn)(external_gridStyles_cjs_namespaceObject.GROUP_GUTTER_CLASS, void 0 !== run.pinnedLeftPx && external_gridStyles_cjs_namespaceObject.PINNED_HEADER_Z_CLASS),
|
|
361
548
|
style: void 0 !== run.pinnedLeftPx ? {
|
|
362
549
|
left: run.pinnedLeftPx
|
|
363
550
|
} : void 0,
|
|
@@ -373,7 +560,7 @@ const DecisionTable = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRe
|
|
|
373
560
|
const groupCellProps = run.group.cellProps?.(groupRun);
|
|
374
561
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("th", {
|
|
375
562
|
...groupCellProps,
|
|
376
|
-
className: (0, apollo_wind_namespaceObject.cn)(external_gridStyles_cjs_namespaceObject.GROUP_CELL_CLASS, run.group.toneClassName, groupCellProps?.className, void 0 !== run.pinnedLeftPx &&
|
|
563
|
+
className: (0, apollo_wind_namespaceObject.cn)(external_gridStyles_cjs_namespaceObject.GROUP_CELL_CLASS, run.group.toneClassName, groupCellProps?.className, void 0 !== run.pinnedLeftPx && external_gridStyles_cjs_namespaceObject.PINNED_HEADER_Z_CLASS),
|
|
377
564
|
style: void 0 !== run.pinnedLeftPx ? {
|
|
378
565
|
...groupCellProps?.style,
|
|
379
566
|
left: run.pinnedLeftPx
|
|
@@ -418,10 +605,12 @@ const DecisionTable = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRe
|
|
|
418
605
|
}
|
|
419
606
|
}, `header-spacer-${visible.coveredIds[0]}`);
|
|
420
607
|
const width = widths[visible.flexIndex] ?? visible.column.defaultWidth;
|
|
608
|
+
const pinnedLeftPx = pinnedLeftPxOf(visible.flexIndex);
|
|
421
609
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_default().Fragment, {
|
|
422
610
|
children: renderHeaderCell(visible.column, {
|
|
423
611
|
resizeHandle: renderResizeHandle(visible.column, width),
|
|
424
|
-
pinnedLeftPx
|
|
612
|
+
pinnedLeftPx,
|
|
613
|
+
pinnedClassName: void 0 === pinnedLeftPx ? void 0 : external_gridStyles_cjs_namespaceObject.PINNED_HEADER_Z_CLASS
|
|
425
614
|
})
|
|
426
615
|
}, visible.column.id);
|
|
427
616
|
}),
|
|
@@ -458,20 +647,28 @@ const DecisionTable = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRe
|
|
|
458
647
|
})
|
|
459
648
|
]
|
|
460
649
|
}),
|
|
650
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
651
|
+
ref: rowHoverRef,
|
|
652
|
+
"aria-hidden": "true",
|
|
653
|
+
className: external_gridStyles_cjs_namespaceObject.ROW_HOVER_OVERLAY_CLASS,
|
|
654
|
+
style: {
|
|
655
|
+
display: 'none',
|
|
656
|
+
width: totalWidth,
|
|
657
|
+
height: rowHeightPx
|
|
658
|
+
},
|
|
659
|
+
"data-testid": `${dataTestId}-row-hover`
|
|
660
|
+
}),
|
|
661
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
662
|
+
ref: previewHostRef,
|
|
663
|
+
"aria-hidden": "true",
|
|
664
|
+
className: external_gridStyles_cjs_namespaceObject.DRAG_PREVIEW_CLASS,
|
|
665
|
+
"data-testid": `${dataTestId}-drag-preview`
|
|
666
|
+
}),
|
|
461
667
|
dragState && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
462
|
-
|
|
668
|
+
ref: dropIndicatorRef,
|
|
669
|
+
className: (0, apollo_wind_namespaceObject.cn)('pointer-events-none absolute border-primary', 'row' === dragState.axis ? 'border-y-2' : 'border-x-2', external_gridStyles_cjs_namespaceObject.DROP_INDICATOR_Z_CLASS),
|
|
463
670
|
"data-testid": `${dataTestId}-drop-indicator`,
|
|
464
|
-
style:
|
|
465
|
-
top: headerHeight() + dragState.boundary * rowHeightPx - 1,
|
|
466
|
-
left: 0,
|
|
467
|
-
width: totalWidth,
|
|
468
|
-
height: 2
|
|
469
|
-
} : {
|
|
470
|
-
left: columnLeading() + (layout.columnOffsets[(boundaries[dragState.groupIndex] ?? 0) + dragState.boundary] ?? 0) - 1,
|
|
471
|
-
top: 0,
|
|
472
|
-
width: 2,
|
|
473
|
-
height: headerHeight() + rowCount * rowHeightPx
|
|
474
|
-
}
|
|
671
|
+
style: dropGapStyle(dragState)
|
|
475
672
|
}),
|
|
476
673
|
children
|
|
477
674
|
]
|
|
@@ -3,6 +3,7 @@ import type { GridClipboardProps, GridColumn, GridColumnGroup, GridGroupRun, Gri
|
|
|
3
3
|
export interface HeaderCellContext {
|
|
4
4
|
resizeHandle: React.ReactNode;
|
|
5
5
|
pinnedLeftPx?: number;
|
|
6
|
+
pinnedClassName?: string;
|
|
6
7
|
}
|
|
7
8
|
export interface DecisionTableProps {
|
|
8
9
|
columns: GridColumn[];
|
|
@@ -14,6 +15,7 @@ export interface DecisionTableProps {
|
|
|
14
15
|
initialColumnWidths?: Record<string, number> | Promise<Record<string, number>> | null;
|
|
15
16
|
onColumnWidthsChange?: (widths: Record<string, number>) => void;
|
|
16
17
|
columnsResizable?: boolean;
|
|
18
|
+
headerEdgeInserts?: boolean;
|
|
17
19
|
columnGroupSizes?: number[];
|
|
18
20
|
onRowMove?: (from: number, to: number) => void;
|
|
19
21
|
onColumnMove?: (groupIndex: number, from: number, to: number) => void;
|
|
@@ -23,6 +25,10 @@ export interface DecisionTableProps {
|
|
|
23
25
|
renderRow: (rowIndex: number, visibleColumns: VisibleGridColumn[]) => React.ReactNode;
|
|
24
26
|
renderFooterRow?: (colSpan: number) => React.ReactNode;
|
|
25
27
|
topLeftCorner?: React.ReactNode;
|
|
28
|
+
tableMark?: {
|
|
29
|
+
tone: 'error' | 'warning';
|
|
30
|
+
title: string;
|
|
31
|
+
};
|
|
26
32
|
trailingHeaderCell?: React.ReactNode;
|
|
27
33
|
trailingGroupCell?: React.ReactNode;
|
|
28
34
|
clipboard?: GridClipboardProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DecisionTable.d.ts","sourceRoot":"","sources":["../../src/decision-table/DecisionTable.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"DecisionTable.d.ts","sourceRoot":"","sources":["../../src/decision-table/DecisionTable.tsx"],"names":[],"mappings":"AAEA,OAAO,KAON,MAAM,OAAO,CAAC;AAsBf,OAAO,KAAK,EACV,kBAAkB,EAClB,UAAU,EACV,eAAe,E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