@uipath/apollo-react 7.15.0 → 7.15.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/README.md +3 -2
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/dist/chat/headless/markdown/citation-parser.cjs +57 -9
- package/dist/chat/headless/markdown/citation-parser.d.ts.map +1 -1
- package/dist/chat/headless/markdown/citation-parser.js +57 -9
- package/dist/chat/styles/tailwind.chat.css +1 -1
- package/dist/decision-table/DecisionTable.cjs +82 -36
- package/dist/decision-table/DecisionTable.d.ts +28 -2
- package/dist/decision-table/DecisionTable.d.ts.map +1 -1
- package/dist/decision-table/DecisionTable.js +76 -36
- package/dist/decision-table/GridCell.cjs +1 -1
- package/dist/decision-table/GridCell.d.ts.map +1 -1
- package/dist/decision-table/GridCell.js +2 -2
- package/dist/decision-table/GridMenu.cjs +2 -2
- package/dist/decision-table/GridMenu.d.ts +1 -0
- package/dist/decision-table/GridMenu.d.ts.map +1 -1
- package/dist/decision-table/GridMenu.js +2 -2
- package/dist/decision-table/constants.cjs +1 -1
- package/dist/decision-table/constants.d.ts +1 -1
- package/dist/decision-table/constants.js +1 -1
- package/dist/decision-table/gridEvents.cjs +1 -1
- package/dist/decision-table/gridEvents.d.ts.map +1 -1
- package/dist/decision-table/gridEvents.js +1 -1
- package/dist/decision-table/gridStyles.cjs +59 -29
- package/dist/decision-table/gridStyles.d.ts +15 -9
- package/dist/decision-table/gridStyles.d.ts.map +1 -1
- package/dist/decision-table/gridStyles.js +26 -11
- package/dist/decision-table/gridTypes.d.ts +9 -6
- package/dist/decision-table/gridTypes.d.ts.map +1 -1
- package/dist/decision-table/index.cjs +37 -21
- package/dist/decision-table/index.d.ts +1 -1
- package/dist/decision-table/index.d.ts.map +1 -1
- package/dist/decision-table/index.js +2 -2
- package/dist/decision-table/styles/tailwind.decision-table.css +1 -1
- package/dist/decision-table/useGridLayout.cjs +6 -15
- package/dist/decision-table/useGridLayout.d.ts +1 -2
- package/dist/decision-table/useGridLayout.d.ts.map +1 -1
- package/dist/decision-table/useGridLayout.js +6 -15
- package/package.json +3 -3
|
@@ -33,7 +33,9 @@ var __webpack_require__ = {};
|
|
|
33
33
|
var __webpack_exports__ = {};
|
|
34
34
|
__webpack_require__.r(__webpack_exports__);
|
|
35
35
|
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
-
DecisionTable: ()=>DecisionTable
|
|
36
|
+
DecisionTable: ()=>DecisionTable,
|
|
37
|
+
groupColumnRuns: ()=>groupColumnRuns,
|
|
38
|
+
groupBoundsOf: ()=>groupBoundsOf
|
|
37
39
|
});
|
|
38
40
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
39
41
|
const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
|
|
@@ -45,7 +47,20 @@ const external_gridStyles_cjs_namespaceObject = require("./gridStyles.cjs");
|
|
|
45
47
|
const external_useDragReorder_cjs_namespaceObject = require("./useDragReorder.cjs");
|
|
46
48
|
const external_useGridClipboard_cjs_namespaceObject = require("./useGridClipboard.cjs");
|
|
47
49
|
const external_useGridLayout_cjs_namespaceObject = require("./useGridLayout.cjs");
|
|
48
|
-
const
|
|
50
|
+
const groupBoundsOf = (columns)=>{
|
|
51
|
+
const bounds = new Map();
|
|
52
|
+
columns.forEach((column, flexIndex)=>{
|
|
53
|
+
if (!column.group) return;
|
|
54
|
+
const groupBounds = bounds.get(column.group.id);
|
|
55
|
+
if (groupBounds) groupBounds.last = flexIndex;
|
|
56
|
+
else bounds.set(column.group.id, {
|
|
57
|
+
first: flexIndex,
|
|
58
|
+
last: flexIndex
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
return bounds;
|
|
62
|
+
};
|
|
63
|
+
const groupColumnRuns = (groupBounds, visibleColumns, pinnedLeftPxOf)=>{
|
|
49
64
|
const runs = [];
|
|
50
65
|
const openedGroups = new Set();
|
|
51
66
|
for (const visible of visibleColumns){
|
|
@@ -88,14 +103,25 @@ const groupColumnRuns = (visibleColumns, pinnedLeftPxOf)=>{
|
|
|
88
103
|
firstFlexIndex: flexIndex,
|
|
89
104
|
count: 1,
|
|
90
105
|
pinnedLeftPx,
|
|
91
|
-
isFirstRunOfGroup: !openedGroups.has(column.group.id)
|
|
106
|
+
isFirstRunOfGroup: !openedGroups.has(column.group.id),
|
|
107
|
+
startsGroup: false,
|
|
108
|
+
endsGroup: false
|
|
92
109
|
});
|
|
93
110
|
openedGroups.add(column.group.id);
|
|
94
111
|
}
|
|
95
112
|
}
|
|
113
|
+
markGroupEdges(groupBounds, runs);
|
|
96
114
|
return runs;
|
|
97
115
|
};
|
|
98
|
-
const
|
|
116
|
+
const markGroupEdges = (groupBounds, runs)=>{
|
|
117
|
+
for (const run of runs){
|
|
118
|
+
if ('group' !== run.type) continue;
|
|
119
|
+
const bounds = groupBounds.get(run.group.id);
|
|
120
|
+
run.startsGroup = run.firstFlexIndex === bounds?.first;
|
|
121
|
+
run.endsGroup = run.firstFlexIndex + run.count - 1 === bounds?.last;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
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)=>{
|
|
99
125
|
const containerRef = (0, external_react_namespaceObject.useRef)(null);
|
|
100
126
|
const layoutRef = (0, external_react_namespaceObject.useRef)(null);
|
|
101
127
|
const headerHeight = (0, external_react_namespaceObject.useCallback)(()=>layoutRef.current?.headerHeight() ?? 0, []);
|
|
@@ -146,16 +172,24 @@ const DecisionTable = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRe
|
|
|
146
172
|
onColumnWidthsChange,
|
|
147
173
|
containerRef,
|
|
148
174
|
retainedRowIndex: retainedRowIndex ?? dragRetainedRow,
|
|
149
|
-
retainedColumnIndex: retainedColumnIndex ?? dragRetainedColumn
|
|
150
|
-
framedByHost
|
|
175
|
+
retainedColumnIndex: retainedColumnIndex ?? dragRetainedColumn
|
|
151
176
|
});
|
|
152
177
|
layoutRef.current = layout;
|
|
153
178
|
const { visibleColumns, widths, totalWidth } = layout;
|
|
154
179
|
const hasTrailing = trailingColumnWidth > 0;
|
|
155
180
|
const hasLeading = leadingColumnWidth > 0;
|
|
181
|
+
const groupBounds = external_react_default().useMemo(()=>groupBoundsOf(columns), [
|
|
182
|
+
columns
|
|
183
|
+
]);
|
|
156
184
|
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
185
|
const headerRowCount = hasGroupRow ? 2 : 1;
|
|
186
|
+
const topLeftCornerCell = hasLeading && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("th", {
|
|
187
|
+
rowSpan: headerRowCount,
|
|
188
|
+
className: external_gridStyles_cjs_namespaceObject.TOP_LEFT_CORNER_CELL_CLASS,
|
|
189
|
+
scope: "col",
|
|
190
|
+
"data-testid": `${dataTestId}-top-left-corner`,
|
|
191
|
+
children: topLeftCorner
|
|
192
|
+
});
|
|
159
193
|
const gridClipboard = (0, external_useGridClipboard_cjs_namespaceObject.useGridClipboard)(clipboard, {
|
|
160
194
|
rowCount,
|
|
161
195
|
columnCount: columns.length
|
|
@@ -183,6 +217,19 @@ const DecisionTable = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRe
|
|
|
183
217
|
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
184
218
|
if (focusWithinRef.current && document.activeElement === document.body) containerRef.current?.focus();
|
|
185
219
|
});
|
|
220
|
+
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
221
|
+
const container = containerRef.current;
|
|
222
|
+
if (!container) return;
|
|
223
|
+
const markScrolled = ()=>{
|
|
224
|
+
const scrolled = container.scrollTop > 0 ? 'true' : 'false';
|
|
225
|
+
if (container.dataset.scrolled !== scrolled) container.dataset.scrolled = scrolled;
|
|
226
|
+
};
|
|
227
|
+
markScrolled();
|
|
228
|
+
container.addEventListener('scroll', markScrolled, {
|
|
229
|
+
passive: true
|
|
230
|
+
});
|
|
231
|
+
return ()=>container.removeEventListener('scroll', markScrolled);
|
|
232
|
+
}, []);
|
|
186
233
|
const pinnedLeftPxOf = (flexIndex)=>{
|
|
187
234
|
if (flexIndex >= layout.pinnedColumnCount) return;
|
|
188
235
|
let offset = leadingColumnWidth;
|
|
@@ -220,7 +267,7 @@ const DecisionTable = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRe
|
|
|
220
267
|
if (!event.defaultPrevented) theirs?.(event);
|
|
221
268
|
};
|
|
222
269
|
const scrollContainer = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
223
|
-
className:
|
|
270
|
+
className: external_gridStyles_cjs_namespaceObject.GRID_FRAME_CLASS,
|
|
224
271
|
ref: layout.attachContainer,
|
|
225
272
|
tabIndex: 0,
|
|
226
273
|
onFocus: (event)=>{
|
|
@@ -235,16 +282,14 @@ const DecisionTable = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRe
|
|
|
235
282
|
if (!gridClipboard.handleKeyDown(event)) consumerKeyDown?.(event);
|
|
236
283
|
},
|
|
237
284
|
"data-testid": dataTestId,
|
|
285
|
+
"data-grid": true,
|
|
238
286
|
onCopy: composeClipboard(gridClipboard.containerProps.onCopy, consumerCopy),
|
|
239
287
|
onCut: composeClipboard(gridClipboard.containerProps.onCut, consumerCut),
|
|
240
288
|
onPaste: composeClipboard(gridClipboard.containerProps.onPaste, consumerPaste),
|
|
241
289
|
...restContainerProps,
|
|
242
290
|
children: [
|
|
243
291
|
/*#__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',
|
|
245
|
-
external_gridStyles_cjs_namespaceObject.TABLE_EDGE_CLASS,
|
|
246
|
-
external_gridStyles_cjs_namespaceObject.TABLE_HUG_EDGE_CLASS
|
|
247
|
-
]),
|
|
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),
|
|
248
293
|
ref: layout.setTableElement,
|
|
249
294
|
style: {
|
|
250
295
|
width: totalWidth,
|
|
@@ -292,16 +337,12 @@ const DecisionTable = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRe
|
|
|
292
337
|
children: [
|
|
293
338
|
hasGroupRow && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("tr", {
|
|
294
339
|
"aria-rowindex": 1,
|
|
295
|
-
className: (0, apollo_wind_namespaceObject.cn)(framedByHost && '[&>*:last-child]:border-r-0'),
|
|
296
340
|
children: [
|
|
297
|
-
|
|
298
|
-
|
|
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)=>{
|
|
341
|
+
topLeftCornerCell,
|
|
342
|
+
groupColumnRuns(groupBounds, visibleColumns, pinnedLeftPxOf).map((run)=>{
|
|
302
343
|
if ('spacer' === run.type) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("td", {
|
|
303
344
|
"aria-hidden": "true",
|
|
304
|
-
className:
|
|
345
|
+
className: external_gridStyles_cjs_namespaceObject.GROUP_GUTTER_CLASS,
|
|
305
346
|
style: {
|
|
306
347
|
width: run.widthPx
|
|
307
348
|
}
|
|
@@ -309,51 +350,52 @@ const DecisionTable = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRe
|
|
|
309
350
|
if ('separator' === run.type) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("td", {
|
|
310
351
|
"aria-hidden": "true",
|
|
311
352
|
"data-separator": "group",
|
|
312
|
-
className:
|
|
353
|
+
className: external_gridStyles_cjs_namespaceObject.SEPARATOR_GROUP_CELL_CLASS,
|
|
313
354
|
style: {
|
|
314
355
|
width: run.widthPx
|
|
315
356
|
}
|
|
316
357
|
}, `group-separator-${run.beforeColumnId}`);
|
|
317
358
|
if ('gutter' === run.type) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("td", {
|
|
318
359
|
"aria-hidden": "true",
|
|
319
|
-
className: (0, apollo_wind_namespaceObject.cn)(external_gridStyles_cjs_namespaceObject.GROUP_GUTTER_CLASS, void 0 !== run.pinnedLeftPx && 'z-3'
|
|
360
|
+
className: (0, apollo_wind_namespaceObject.cn)(external_gridStyles_cjs_namespaceObject.GROUP_GUTTER_CLASS, void 0 !== run.pinnedLeftPx && 'z-3'),
|
|
320
361
|
style: void 0 !== run.pinnedLeftPx ? {
|
|
321
362
|
left: run.pinnedLeftPx
|
|
322
363
|
} : void 0,
|
|
323
364
|
colSpan: run.count
|
|
324
365
|
}, `group-gutter-${run.firstFlexIndex}`);
|
|
325
|
-
const
|
|
366
|
+
const groupRun = {
|
|
367
|
+
first: run.first,
|
|
368
|
+
firstFlexIndex: run.firstFlexIndex,
|
|
369
|
+
isFirstRunOfGroup: run.isFirstRunOfGroup,
|
|
370
|
+
startsGroup: run.startsGroup,
|
|
371
|
+
endsGroup: run.endsGroup
|
|
372
|
+
};
|
|
373
|
+
const groupCellProps = run.group.cellProps?.(groupRun);
|
|
326
374
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("th", {
|
|
327
375
|
...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'
|
|
376
|
+
className: (0, apollo_wind_namespaceObject.cn)(external_gridStyles_cjs_namespaceObject.GROUP_CELL_CLASS, run.group.toneClassName, groupCellProps?.className, void 0 !== run.pinnedLeftPx && 'z-3'),
|
|
329
377
|
style: void 0 !== run.pinnedLeftPx ? {
|
|
378
|
+
...groupCellProps?.style,
|
|
330
379
|
left: run.pinnedLeftPx
|
|
331
|
-
} :
|
|
380
|
+
} : groupCellProps?.style,
|
|
332
381
|
scope: "colgroup",
|
|
333
382
|
colSpan: run.count,
|
|
334
383
|
children: run.group.renderLabel ? run.group.renderLabel({
|
|
335
|
-
|
|
336
|
-
firstFlexIndex: run.firstFlexIndex,
|
|
337
|
-
isFirstRunOfGroup: run.isFirstRunOfGroup,
|
|
384
|
+
...groupRun,
|
|
338
385
|
label: run.group.label
|
|
339
386
|
}) : run.group.label
|
|
340
387
|
}, `group-${run.group.id}-${run.firstFlexIndex}`);
|
|
341
388
|
}),
|
|
342
389
|
hasTrailing && (trailingGroupCell ?? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("td", {
|
|
343
390
|
"aria-hidden": "true",
|
|
344
|
-
className:
|
|
391
|
+
className: external_gridStyles_cjs_namespaceObject.FROZEN_RIGHT_GROUP_CELL_CLASS
|
|
345
392
|
}))
|
|
346
393
|
]
|
|
347
394
|
}),
|
|
348
395
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("tr", {
|
|
349
396
|
"aria-rowindex": headerRowCount,
|
|
350
|
-
className: (0, apollo_wind_namespaceObject.cn)(framedByHost && '[&>*:last-child]:border-r-0'),
|
|
351
397
|
children: [
|
|
352
|
-
|
|
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
|
-
}),
|
|
398
|
+
!hasGroupRow && topLeftCornerCell,
|
|
357
399
|
visibleColumns.map((visible)=>{
|
|
358
400
|
if ('separator' === visible.type) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("td", {
|
|
359
401
|
"aria-hidden": "true",
|
|
@@ -434,10 +476,10 @@ const DecisionTable = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRe
|
|
|
434
476
|
children
|
|
435
477
|
]
|
|
436
478
|
});
|
|
437
|
-
if (framedByHost) return scrollContainer;
|
|
438
479
|
const consumerPointerDown = restContainerProps.onPointerDown;
|
|
439
480
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
440
481
|
className: external_gridStyles_cjs_namespaceObject.GRID_PANE_CLASS,
|
|
482
|
+
"data-grid": true,
|
|
441
483
|
onPointerDown: (event)=>{
|
|
442
484
|
if (event.target === event.currentTarget) consumerPointerDown?.(event);
|
|
443
485
|
},
|
|
@@ -446,8 +488,12 @@ const DecisionTable = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRe
|
|
|
446
488
|
});
|
|
447
489
|
DecisionTable.displayName = 'DecisionTable';
|
|
448
490
|
exports.DecisionTable = __webpack_exports__.DecisionTable;
|
|
491
|
+
exports.groupBoundsOf = __webpack_exports__.groupBoundsOf;
|
|
492
|
+
exports.groupColumnRuns = __webpack_exports__.groupColumnRuns;
|
|
449
493
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
450
|
-
"DecisionTable"
|
|
494
|
+
"DecisionTable",
|
|
495
|
+
"groupBoundsOf",
|
|
496
|
+
"groupColumnRuns"
|
|
451
497
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
452
498
|
Object.defineProperty(exports, '__esModule', {
|
|
453
499
|
value: true
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { GridClipboardProps, GridColumn, GridHandle, GridLabels, VisibleGridColumn } from './gridTypes';
|
|
2
|
+
import type { GridClipboardProps, GridColumn, GridColumnGroup, GridGroupRun, GridHandle, GridLabels, VisibleGridColumn } from './gridTypes';
|
|
3
3
|
export interface HeaderCellContext {
|
|
4
4
|
resizeHandle: React.ReactNode;
|
|
5
5
|
pinnedLeftPx?: number;
|
|
@@ -14,7 +14,6 @@ export interface DecisionTableProps {
|
|
|
14
14
|
initialColumnWidths?: Record<string, number> | Promise<Record<string, number>> | null;
|
|
15
15
|
onColumnWidthsChange?: (widths: Record<string, number>) => void;
|
|
16
16
|
columnsResizable?: boolean;
|
|
17
|
-
framedByHost?: boolean;
|
|
18
17
|
columnGroupSizes?: number[];
|
|
19
18
|
onRowMove?: (from: number, to: number) => void;
|
|
20
19
|
onColumnMove?: (groupIndex: number, from: number, to: number) => void;
|
|
@@ -23,6 +22,7 @@ export interface DecisionTableProps {
|
|
|
23
22
|
renderHeaderCell: (column: GridColumn, context: HeaderCellContext) => React.ReactNode;
|
|
24
23
|
renderRow: (rowIndex: number, visibleColumns: VisibleGridColumn[]) => React.ReactNode;
|
|
25
24
|
renderFooterRow?: (colSpan: number) => React.ReactNode;
|
|
25
|
+
topLeftCorner?: React.ReactNode;
|
|
26
26
|
trailingHeaderCell?: React.ReactNode;
|
|
27
27
|
trailingGroupCell?: React.ReactNode;
|
|
28
28
|
clipboard?: GridClipboardProps;
|
|
@@ -32,5 +32,31 @@ export interface DecisionTableProps {
|
|
|
32
32
|
labels: GridLabels;
|
|
33
33
|
children?: React.ReactNode;
|
|
34
34
|
}
|
|
35
|
+
type ColumnRun = (GridGroupRun & {
|
|
36
|
+
type: 'group';
|
|
37
|
+
group: GridColumnGroup;
|
|
38
|
+
count: number;
|
|
39
|
+
pinnedLeftPx?: number;
|
|
40
|
+
}) | {
|
|
41
|
+
type: 'gutter';
|
|
42
|
+
count: number;
|
|
43
|
+
firstFlexIndex: number;
|
|
44
|
+
pinnedLeftPx?: number;
|
|
45
|
+
} | {
|
|
46
|
+
type: 'spacer';
|
|
47
|
+
widthPx: number;
|
|
48
|
+
firstCoveredId: string;
|
|
49
|
+
} | {
|
|
50
|
+
type: 'separator';
|
|
51
|
+
widthPx: number;
|
|
52
|
+
beforeColumnId: string;
|
|
53
|
+
};
|
|
54
|
+
type GroupBounds = ReadonlyMap<string, {
|
|
55
|
+
first: number;
|
|
56
|
+
last: number;
|
|
57
|
+
}>;
|
|
58
|
+
export declare const groupBoundsOf: (columns: GridColumn[]) => GroupBounds;
|
|
59
|
+
export declare const groupColumnRuns: (groupBounds: GroupBounds, visibleColumns: VisibleGridColumn[], pinnedLeftPxOf: (flexIndex: number) => number | undefined) => ColumnRun[];
|
|
35
60
|
export declare const DecisionTable: React.ForwardRefExoticComponent<DecisionTableProps & React.RefAttributes<GridHandle>>;
|
|
61
|
+
export {};
|
|
36
62
|
//# sourceMappingURL=DecisionTable.d.ts.map
|
|
@@ -1 +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,
|
|
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,EACV,eAAe,EACf,YAAY,EACZ,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;IAKj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,MAAM,GAAG,SAAS,KACxD,SAAS,EAyDX,CAAC;AAmBF,eAAO,MAAM,aAAa,uFAikBzB,CAAC"}
|
|
@@ -3,11 +3,24 @@ import { cn } from "@uipath/apollo-wind";
|
|
|
3
3
|
import { ArrowRight } from "lucide-react";
|
|
4
4
|
import react, { forwardRef, useCallback, useEffect, useImperativeHandle, useRef } from "react";
|
|
5
5
|
import { BODY_ROW_HEIGHT_PX, MIN_COLUMN_WIDTH } from "./constants.js";
|
|
6
|
-
import { GRID_FRAME_CLASS, GRID_PANE_CLASS, GROUP_CELL_CLASS, GROUP_GUTTER_CLASS, HEADER_CELL_CLASS,
|
|
6
|
+
import { FROZEN_RIGHT_GROUP_CELL_CLASS, GRID_FRAME_CLASS, GRID_PANE_CLASS, GROUP_CELL_CLASS, GROUP_GUTTER_CLASS, HEADER_CELL_CLASS, RESIZE_HANDLE_CLASS, SEPARATOR_GROUP_CELL_CLASS, SEPARATOR_HEADER_CELL_CLASS, TABLE_EDGE_CLASS, TABLE_HUG_EDGE_CLASS, TOP_LEFT_CORNER_CELL_CLASS } from "./gridStyles.js";
|
|
7
7
|
import { useDragReorder } from "./useDragReorder.js";
|
|
8
8
|
import { useGridClipboard } from "./useGridClipboard.js";
|
|
9
9
|
import { useGridLayout } from "./useGridLayout.js";
|
|
10
|
-
const
|
|
10
|
+
const groupBoundsOf = (columns)=>{
|
|
11
|
+
const bounds = new Map();
|
|
12
|
+
columns.forEach((column, flexIndex)=>{
|
|
13
|
+
if (!column.group) return;
|
|
14
|
+
const groupBounds = bounds.get(column.group.id);
|
|
15
|
+
if (groupBounds) groupBounds.last = flexIndex;
|
|
16
|
+
else bounds.set(column.group.id, {
|
|
17
|
+
first: flexIndex,
|
|
18
|
+
last: flexIndex
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
return bounds;
|
|
22
|
+
};
|
|
23
|
+
const groupColumnRuns = (groupBounds, visibleColumns, pinnedLeftPxOf)=>{
|
|
11
24
|
const runs = [];
|
|
12
25
|
const openedGroups = new Set();
|
|
13
26
|
for (const visible of visibleColumns){
|
|
@@ -50,14 +63,25 @@ const groupColumnRuns = (visibleColumns, pinnedLeftPxOf)=>{
|
|
|
50
63
|
firstFlexIndex: flexIndex,
|
|
51
64
|
count: 1,
|
|
52
65
|
pinnedLeftPx,
|
|
53
|
-
isFirstRunOfGroup: !openedGroups.has(column.group.id)
|
|
66
|
+
isFirstRunOfGroup: !openedGroups.has(column.group.id),
|
|
67
|
+
startsGroup: false,
|
|
68
|
+
endsGroup: false
|
|
54
69
|
});
|
|
55
70
|
openedGroups.add(column.group.id);
|
|
56
71
|
}
|
|
57
72
|
}
|
|
73
|
+
markGroupEdges(groupBounds, runs);
|
|
58
74
|
return runs;
|
|
59
75
|
};
|
|
60
|
-
const
|
|
76
|
+
const markGroupEdges = (groupBounds, runs)=>{
|
|
77
|
+
for (const run of runs){
|
|
78
|
+
if ('group' !== run.type) continue;
|
|
79
|
+
const bounds = groupBounds.get(run.group.id);
|
|
80
|
+
run.startsGroup = run.firstFlexIndex === bounds?.first;
|
|
81
|
+
run.endsGroup = run.firstFlexIndex + run.count - 1 === bounds?.last;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
const DecisionTable = /*#__PURE__*/ forwardRef(({ columns, rowCount, rowHeightPx = 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)=>{
|
|
61
85
|
const containerRef = useRef(null);
|
|
62
86
|
const layoutRef = useRef(null);
|
|
63
87
|
const headerHeight = useCallback(()=>layoutRef.current?.headerHeight() ?? 0, []);
|
|
@@ -108,16 +132,24 @@ const DecisionTable = /*#__PURE__*/ forwardRef(({ columns, rowCount, rowHeightPx
|
|
|
108
132
|
onColumnWidthsChange,
|
|
109
133
|
containerRef,
|
|
110
134
|
retainedRowIndex: retainedRowIndex ?? dragRetainedRow,
|
|
111
|
-
retainedColumnIndex: retainedColumnIndex ?? dragRetainedColumn
|
|
112
|
-
framedByHost
|
|
135
|
+
retainedColumnIndex: retainedColumnIndex ?? dragRetainedColumn
|
|
113
136
|
});
|
|
114
137
|
layoutRef.current = layout;
|
|
115
138
|
const { visibleColumns, widths, totalWidth } = layout;
|
|
116
139
|
const hasTrailing = trailingColumnWidth > 0;
|
|
117
140
|
const hasLeading = leadingColumnWidth > 0;
|
|
141
|
+
const groupBounds = react.useMemo(()=>groupBoundsOf(columns), [
|
|
142
|
+
columns
|
|
143
|
+
]);
|
|
118
144
|
const hasGroupRow = columns.some((column)=>void 0 !== column.group) || void 0 !== trailingGroupCell;
|
|
119
|
-
const hostTopEdge = framedByHost && OMIT_BORDER_CLASS.top;
|
|
120
145
|
const headerRowCount = hasGroupRow ? 2 : 1;
|
|
146
|
+
const topLeftCornerCell = hasLeading && /*#__PURE__*/ jsx("th", {
|
|
147
|
+
rowSpan: headerRowCount,
|
|
148
|
+
className: TOP_LEFT_CORNER_CELL_CLASS,
|
|
149
|
+
scope: "col",
|
|
150
|
+
"data-testid": `${dataTestId}-top-left-corner`,
|
|
151
|
+
children: topLeftCorner
|
|
152
|
+
});
|
|
121
153
|
const gridClipboard = useGridClipboard(clipboard, {
|
|
122
154
|
rowCount,
|
|
123
155
|
columnCount: columns.length
|
|
@@ -145,6 +177,19 @@ const DecisionTable = /*#__PURE__*/ forwardRef(({ columns, rowCount, rowHeightPx
|
|
|
145
177
|
useEffect(()=>{
|
|
146
178
|
if (focusWithinRef.current && document.activeElement === document.body) containerRef.current?.focus();
|
|
147
179
|
});
|
|
180
|
+
useEffect(()=>{
|
|
181
|
+
const container = containerRef.current;
|
|
182
|
+
if (!container) return;
|
|
183
|
+
const markScrolled = ()=>{
|
|
184
|
+
const scrolled = container.scrollTop > 0 ? 'true' : 'false';
|
|
185
|
+
if (container.dataset.scrolled !== scrolled) container.dataset.scrolled = scrolled;
|
|
186
|
+
};
|
|
187
|
+
markScrolled();
|
|
188
|
+
container.addEventListener('scroll', markScrolled, {
|
|
189
|
+
passive: true
|
|
190
|
+
});
|
|
191
|
+
return ()=>container.removeEventListener('scroll', markScrolled);
|
|
192
|
+
}, []);
|
|
148
193
|
const pinnedLeftPxOf = (flexIndex)=>{
|
|
149
194
|
if (flexIndex >= layout.pinnedColumnCount) return;
|
|
150
195
|
let offset = leadingColumnWidth;
|
|
@@ -182,7 +227,7 @@ const DecisionTable = /*#__PURE__*/ forwardRef(({ columns, rowCount, rowHeightPx
|
|
|
182
227
|
if (!event.defaultPrevented) theirs?.(event);
|
|
183
228
|
};
|
|
184
229
|
const scrollContainer = /*#__PURE__*/ jsxs("div", {
|
|
185
|
-
className:
|
|
230
|
+
className: GRID_FRAME_CLASS,
|
|
186
231
|
ref: layout.attachContainer,
|
|
187
232
|
tabIndex: 0,
|
|
188
233
|
onFocus: (event)=>{
|
|
@@ -197,16 +242,14 @@ const DecisionTable = /*#__PURE__*/ forwardRef(({ columns, rowCount, rowHeightPx
|
|
|
197
242
|
if (!gridClipboard.handleKeyDown(event)) consumerKeyDown?.(event);
|
|
198
243
|
},
|
|
199
244
|
"data-testid": dataTestId,
|
|
245
|
+
"data-grid": true,
|
|
200
246
|
onCopy: composeClipboard(gridClipboard.containerProps.onCopy, consumerCopy),
|
|
201
247
|
onCut: composeClipboard(gridClipboard.containerProps.onCut, consumerCut),
|
|
202
248
|
onPaste: composeClipboard(gridClipboard.containerProps.onPaste, consumerPaste),
|
|
203
249
|
...restContainerProps,
|
|
204
250
|
children: [
|
|
205
251
|
/*#__PURE__*/ jsxs("table", {
|
|
206
|
-
className: cn('table-fixed border-separate border-spacing-0 text-xs text-foreground',
|
|
207
|
-
TABLE_EDGE_CLASS,
|
|
208
|
-
TABLE_HUG_EDGE_CLASS
|
|
209
|
-
]),
|
|
252
|
+
className: cn('table-fixed border-separate border-spacing-0 text-xs text-foreground', TABLE_EDGE_CLASS, TABLE_HUG_EDGE_CLASS),
|
|
210
253
|
ref: layout.setTableElement,
|
|
211
254
|
style: {
|
|
212
255
|
width: totalWidth,
|
|
@@ -254,16 +297,12 @@ const DecisionTable = /*#__PURE__*/ forwardRef(({ columns, rowCount, rowHeightPx
|
|
|
254
297
|
children: [
|
|
255
298
|
hasGroupRow && /*#__PURE__*/ jsxs("tr", {
|
|
256
299
|
"aria-rowindex": 1,
|
|
257
|
-
className: cn(framedByHost && '[&>*:last-child]:border-r-0'),
|
|
258
300
|
children: [
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
className: cn(GROUP_GUTTER_CLASS, 'left-0 z-3', hostTopEdge)
|
|
262
|
-
}),
|
|
263
|
-
groupColumnRuns(visibleColumns, pinnedLeftPxOf).map((run)=>{
|
|
301
|
+
topLeftCornerCell,
|
|
302
|
+
groupColumnRuns(groupBounds, visibleColumns, pinnedLeftPxOf).map((run)=>{
|
|
264
303
|
if ('spacer' === run.type) return /*#__PURE__*/ jsx("td", {
|
|
265
304
|
"aria-hidden": "true",
|
|
266
|
-
className:
|
|
305
|
+
className: GROUP_GUTTER_CLASS,
|
|
267
306
|
style: {
|
|
268
307
|
width: run.widthPx
|
|
269
308
|
}
|
|
@@ -271,51 +310,52 @@ const DecisionTable = /*#__PURE__*/ forwardRef(({ columns, rowCount, rowHeightPx
|
|
|
271
310
|
if ('separator' === run.type) return /*#__PURE__*/ jsx("td", {
|
|
272
311
|
"aria-hidden": "true",
|
|
273
312
|
"data-separator": "group",
|
|
274
|
-
className:
|
|
313
|
+
className: SEPARATOR_GROUP_CELL_CLASS,
|
|
275
314
|
style: {
|
|
276
315
|
width: run.widthPx
|
|
277
316
|
}
|
|
278
317
|
}, `group-separator-${run.beforeColumnId}`);
|
|
279
318
|
if ('gutter' === run.type) return /*#__PURE__*/ jsx("td", {
|
|
280
319
|
"aria-hidden": "true",
|
|
281
|
-
className: cn(GROUP_GUTTER_CLASS, void 0 !== run.pinnedLeftPx && 'z-3'
|
|
320
|
+
className: cn(GROUP_GUTTER_CLASS, void 0 !== run.pinnedLeftPx && 'z-3'),
|
|
282
321
|
style: void 0 !== run.pinnedLeftPx ? {
|
|
283
322
|
left: run.pinnedLeftPx
|
|
284
323
|
} : void 0,
|
|
285
324
|
colSpan: run.count
|
|
286
325
|
}, `group-gutter-${run.firstFlexIndex}`);
|
|
287
|
-
const
|
|
326
|
+
const groupRun = {
|
|
327
|
+
first: run.first,
|
|
328
|
+
firstFlexIndex: run.firstFlexIndex,
|
|
329
|
+
isFirstRunOfGroup: run.isFirstRunOfGroup,
|
|
330
|
+
startsGroup: run.startsGroup,
|
|
331
|
+
endsGroup: run.endsGroup
|
|
332
|
+
};
|
|
333
|
+
const groupCellProps = run.group.cellProps?.(groupRun);
|
|
288
334
|
return /*#__PURE__*/ jsx("th", {
|
|
289
335
|
...groupCellProps,
|
|
290
|
-
className: cn(GROUP_CELL_CLASS, run.group.toneClassName, groupCellProps?.className, void 0 !== run.pinnedLeftPx && 'z-3'
|
|
336
|
+
className: cn(GROUP_CELL_CLASS, run.group.toneClassName, groupCellProps?.className, void 0 !== run.pinnedLeftPx && 'z-3'),
|
|
291
337
|
style: void 0 !== run.pinnedLeftPx ? {
|
|
338
|
+
...groupCellProps?.style,
|
|
292
339
|
left: run.pinnedLeftPx
|
|
293
|
-
} :
|
|
340
|
+
} : groupCellProps?.style,
|
|
294
341
|
scope: "colgroup",
|
|
295
342
|
colSpan: run.count,
|
|
296
343
|
children: run.group.renderLabel ? run.group.renderLabel({
|
|
297
|
-
|
|
298
|
-
firstFlexIndex: run.firstFlexIndex,
|
|
299
|
-
isFirstRunOfGroup: run.isFirstRunOfGroup,
|
|
344
|
+
...groupRun,
|
|
300
345
|
label: run.group.label
|
|
301
346
|
}) : run.group.label
|
|
302
347
|
}, `group-${run.group.id}-${run.firstFlexIndex}`);
|
|
303
348
|
}),
|
|
304
349
|
hasTrailing && (trailingGroupCell ?? /*#__PURE__*/ jsx("td", {
|
|
305
350
|
"aria-hidden": "true",
|
|
306
|
-
className:
|
|
351
|
+
className: FROZEN_RIGHT_GROUP_CELL_CLASS
|
|
307
352
|
}))
|
|
308
353
|
]
|
|
309
354
|
}),
|
|
310
355
|
/*#__PURE__*/ jsxs("tr", {
|
|
311
356
|
"aria-rowindex": headerRowCount,
|
|
312
|
-
className: cn(framedByHost && '[&>*:last-child]:border-r-0'),
|
|
313
357
|
children: [
|
|
314
|
-
|
|
315
|
-
className: cn(HEADER_CELL_CLASS, 'left-0 z-3 text-center align-middle'),
|
|
316
|
-
scope: "col",
|
|
317
|
-
children: labels.rowNumberHeader ?? '#'
|
|
318
|
-
}),
|
|
358
|
+
!hasGroupRow && topLeftCornerCell,
|
|
319
359
|
visibleColumns.map((visible)=>{
|
|
320
360
|
if ('separator' === visible.type) return /*#__PURE__*/ jsx("td", {
|
|
321
361
|
"aria-hidden": "true",
|
|
@@ -396,10 +436,10 @@ const DecisionTable = /*#__PURE__*/ forwardRef(({ columns, rowCount, rowHeightPx
|
|
|
396
436
|
children
|
|
397
437
|
]
|
|
398
438
|
});
|
|
399
|
-
if (framedByHost) return scrollContainer;
|
|
400
439
|
const consumerPointerDown = restContainerProps.onPointerDown;
|
|
401
440
|
return /*#__PURE__*/ jsx("div", {
|
|
402
441
|
className: GRID_PANE_CLASS,
|
|
442
|
+
"data-grid": true,
|
|
403
443
|
onPointerDown: (event)=>{
|
|
404
444
|
if (event.target === event.currentTarget) consumerPointerDown?.(event);
|
|
405
445
|
},
|
|
@@ -407,4 +447,4 @@ const DecisionTable = /*#__PURE__*/ forwardRef(({ columns, rowCount, rowHeightPx
|
|
|
407
447
|
});
|
|
408
448
|
});
|
|
409
449
|
DecisionTable.displayName = 'DecisionTable';
|
|
410
|
-
export { DecisionTable };
|
|
450
|
+
export { DecisionTable, groupBoundsOf, groupColumnRuns };
|
|
@@ -68,7 +68,7 @@ const GridCell = ({ value, restingValue, placeholder, mono, readOnly, pinnedLeft
|
|
|
68
68
|
};
|
|
69
69
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("td", {
|
|
70
70
|
ref: cellRef,
|
|
71
|
-
className: (0, apollo_wind_namespaceObject.cn)(external_gridStyles_cjs_namespaceObject.BODY_CELL_CLASS, omitBorders?.map((edge)=>external_gridStyles_cjs_namespaceObject.OMIT_BORDER_CLASS[edge]), mono &&
|
|
71
|
+
className: (0, apollo_wind_namespaceObject.cn)(external_gridStyles_cjs_namespaceObject.BODY_CELL_CLASS, omitBorders?.map((edge)=>external_gridStyles_cjs_namespaceObject.OMIT_BORDER_CLASS[edge]), mono && external_gridStyles_cjs_namespaceObject.MONO_CELL_TEXT_CLASS, 'font-normal', selected && 'shadow-[inset_0_0_0_2px_var(--color-primary)]', isEditing && 'select-text', inRange && external_gridStyles_cjs_namespaceObject.IN_RANGE_CLASS, void 0 !== pinnedLeft && 'sticky z-1 bg-background', !isEditing && external_gridStyles_cjs_namespaceObject.ROW_HOVER_CLASS, className, external_gridStyles_cjs_namespaceObject.CELL_MARK_CLASS),
|
|
72
72
|
style: void 0 !== pinnedLeft ? {
|
|
73
73
|
left: pinnedLeft
|
|
74
74
|
} : void 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GridCell.d.ts","sourceRoot":"","sources":["../../src/decision-table/GridCell.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"GridCell.d.ts","sourceRoot":"","sources":["../../src/decision-table/GridCell.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAc/B,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAQpC,MAAM,WAAW,qBAAqB;IACpC,KAAK,E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C;IACxB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,KAAK,IAAI,CAAC;IACvD,QAAQ,EAAE,MAAM,IAAI,CAAC;IAErB,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAGD,eAAO,MAAM,wBAAwB,GACnC,OAAO,MAAM,EACb,aAAa,MAAM,GAAG,SAAS,KAC9B,KAAK,CAAC,SAKR,CAAC;AAMF,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAwL5C,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { cn } from "@uipath/apollo-wind";
|
|
|
3
3
|
import { useLayoutEffect, useRef } from "react";
|
|
4
4
|
import { showTitleIfClipped } from "./clippedTitle.js";
|
|
5
5
|
import { commitMoveFor } from "./gridEvents.js";
|
|
6
|
-
import { BODY_CELL_CLASS, CELL_EDITOR_CLASS, CELL_MARK_CLASS, CELL_SURFACE_CLASS, IN_RANGE_CLASS, OMIT_BORDER_CLASS } from "./gridStyles.js";
|
|
6
|
+
import { BODY_CELL_CLASS, CELL_EDITOR_CLASS, CELL_MARK_CLASS, CELL_SURFACE_CLASS, IN_RANGE_CLASS, MONO_CELL_TEXT_CLASS, OMIT_BORDER_CLASS, ROW_HOVER_CLASS } from "./gridStyles.js";
|
|
7
7
|
import { MarkGlyph } from "./MarkGlyph.js";
|
|
8
8
|
const renderRestingCellContent = (value, placeholder)=>{
|
|
9
9
|
if (value) return value;
|
|
@@ -39,7 +39,7 @@ const GridCell = ({ value, restingValue, placeholder, mono, readOnly, pinnedLeft
|
|
|
39
39
|
};
|
|
40
40
|
return /*#__PURE__*/ jsxs("td", {
|
|
41
41
|
ref: cellRef,
|
|
42
|
-
className: cn(BODY_CELL_CLASS, omitBorders?.map((edge)=>OMIT_BORDER_CLASS[edge]), mono &&
|
|
42
|
+
className: cn(BODY_CELL_CLASS, omitBorders?.map((edge)=>OMIT_BORDER_CLASS[edge]), mono && MONO_CELL_TEXT_CLASS, 'font-normal', selected && 'shadow-[inset_0_0_0_2px_var(--color-primary)]', isEditing && 'select-text', inRange && IN_RANGE_CLASS, void 0 !== pinnedLeft && 'sticky z-1 bg-background', !isEditing && ROW_HOVER_CLASS, className, CELL_MARK_CLASS),
|
|
43
43
|
style: void 0 !== pinnedLeft ? {
|
|
44
44
|
left: pinnedLeft
|
|
45
45
|
} : void 0,
|
|
@@ -90,7 +90,7 @@ const useGridMenuItems = (entries, open, dataTestId)=>{
|
|
|
90
90
|
onCloseAutoFocus
|
|
91
91
|
};
|
|
92
92
|
};
|
|
93
|
-
const GridContextMenu = ({ label, dataTestId, state, entries, onClose })=>{
|
|
93
|
+
const GridContextMenu = ({ label, dataTestId, state, entries, onClose, className })=>{
|
|
94
94
|
const { items, onCloseAutoFocus } = useGridMenuItems(state ? entries() : [], !!state, dataTestId);
|
|
95
95
|
if (!state) return null;
|
|
96
96
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(apollo_wind_namespaceObject.DropdownMenu, {
|
|
@@ -116,7 +116,7 @@ const GridContextMenu = ({ label, dataTestId, state, entries, onClose })=>{
|
|
|
116
116
|
align: "start",
|
|
117
117
|
side: "bottom",
|
|
118
118
|
"aria-label": label,
|
|
119
|
-
className:
|
|
119
|
+
className: (0, apollo_wind_namespaceObject.cn)('min-w-52', className),
|
|
120
120
|
"data-testid": `${dataTestId}-context-menu`,
|
|
121
121
|
onCloseAutoFocus: onCloseAutoFocus,
|
|
122
122
|
onClick: (event)=>event.stopPropagation(),
|
|
@@ -25,6 +25,7 @@ export interface GridContextMenuProps {
|
|
|
25
25
|
state: GridContextMenuState | null;
|
|
26
26
|
entries: () => GridMenuEntry[];
|
|
27
27
|
onClose: () => void;
|
|
28
|
+
className?: string;
|
|
28
29
|
}
|
|
29
30
|
export declare const GridContextMenu: React.FC<GridContextMenuProps>;
|
|
30
31
|
//# sourceMappingURL=GridMenu.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GridMenu.d.ts","sourceRoot":"","sources":["../../src/decision-table/GridMenu.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAMvB,OAAO,CAAC,EAAE,KAAK,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAKlB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG;IAAE,OAAO,EAAE,IAAI,CAAA;CAAE,CAAC;AAsF7D,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAClC;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IAEd,UAAU,EAAE,MAAM,CAAC;IAEnB,KAAK,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACnC,OAAO,EAAE,MAAM,aAAa,EAAE,CAAC;IAC/B,OAAO,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"GridMenu.d.ts","sourceRoot":"","sources":["../../src/decision-table/GridMenu.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,IAAI,CAAC,EAAE,KAAK,C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