@equinor/apollo-components 4.0.1 → 4.0.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/index.d.mts +7 -44
- package/dist/index.d.ts +7 -44
- package/dist/index.js +306 -390
- package/dist/index.mjs +306 -393
- package/package.json +33 -26
package/dist/index.mjs
CHANGED
|
@@ -1,35 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
var __objRest = (source, exclude) => {
|
|
21
|
-
var target = {};
|
|
22
|
-
for (var prop in source)
|
|
23
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
-
target[prop] = source[prop];
|
|
25
|
-
if (source != null && __getOwnPropSymbols)
|
|
26
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
}
|
|
30
|
-
return target;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
1
|
// src/AppShell/AppShell.tsx
|
|
34
2
|
import { Icon, TopBar } from "@equinor/eds-core-react";
|
|
35
3
|
import { apps } from "@equinor/eds-icons";
|
|
@@ -51,8 +19,8 @@ var Wrapper = styled.div`
|
|
|
51
19
|
`;
|
|
52
20
|
var AppShell = ({ children, icon, title, sidebar }) => /* @__PURE__ */ jsxs(Wrapper, { children: [
|
|
53
21
|
/* @__PURE__ */ jsx(TopBar, { sticky: false, children: /* @__PURE__ */ jsxs(TopBar.Header, { children: [
|
|
54
|
-
/* @__PURE__ */ jsx(Icon, { data: icon
|
|
55
|
-
/* @__PURE__ */ jsx("span", { children: title
|
|
22
|
+
/* @__PURE__ */ jsx(Icon, { data: icon ?? apps }),
|
|
23
|
+
/* @__PURE__ */ jsx("span", { children: title ?? "App Title" })
|
|
56
24
|
] }) }),
|
|
57
25
|
/* @__PURE__ */ jsxs("div", { className: "--content-wrapper", children: [
|
|
58
26
|
sidebar,
|
|
@@ -169,15 +137,11 @@ var Chip = styled3.div`
|
|
|
169
137
|
line-height: 22px;
|
|
170
138
|
height: 22px;
|
|
171
139
|
padding: 0 6px;
|
|
172
|
-
background-color: ${(props) =>
|
|
173
|
-
var _a;
|
|
174
|
-
return (_a = props.backgroundColor) != null ? _a : tokens2.colors.ui.background__medium.hex;
|
|
175
|
-
}};
|
|
140
|
+
background-color: ${(props) => props.backgroundColor ?? tokens2.colors.ui.background__medium.hex};
|
|
176
141
|
color: darkslategrey;
|
|
177
142
|
`;
|
|
178
143
|
var ChipsCell = (props) => {
|
|
179
|
-
|
|
180
|
-
return /* @__PURE__ */ jsx4(ChipsWrapper, { children: (_a = props.values) == null ? void 0 : _a.map((value) => /* @__PURE__ */ jsx4(Chip, { backgroundColor: stringToHslColor(value), children: value }, value)) });
|
|
144
|
+
return /* @__PURE__ */ jsx4(ChipsWrapper, { children: props.values?.map((value) => /* @__PURE__ */ jsx4(Chip, { backgroundColor: stringToHslColor(value), children: value }, value)) });
|
|
181
145
|
};
|
|
182
146
|
|
|
183
147
|
// src/cells/DynamicCell.tsx
|
|
@@ -221,35 +185,35 @@ var StyledCell = styled5(EdsTable.Cell)`
|
|
|
221
185
|
background-color: ${({ backgroundColor }) => backgroundColor ? `${backgroundColor} !important` : `inherit`};
|
|
222
186
|
`;
|
|
223
187
|
function DynamicCell({ cell, cellConfig }) {
|
|
224
|
-
var _a, _b, _c, _d, _e;
|
|
225
188
|
const cellContent = flexRender(cell.column.columnDef.cell, cell.getContext());
|
|
226
189
|
const columnPinningDirection = cell.column.getIsPinned();
|
|
227
|
-
const stickyCellColor =
|
|
228
|
-
const regularCellColor =
|
|
190
|
+
const stickyCellColor = cellConfig?.getStickyCellColor?.(cell);
|
|
191
|
+
const regularCellColor = cellConfig?.getCellColor?.(cell) ?? (cellConfig?.getShouldHighlight?.(cell) ? "#d5eaf4" : void 0);
|
|
229
192
|
if (columnPinningDirection) {
|
|
230
193
|
return /* @__PURE__ */ jsx5(
|
|
231
194
|
EdsTable.Cell,
|
|
232
195
|
{
|
|
233
196
|
"data-column": cell.column.id,
|
|
234
|
-
style:
|
|
197
|
+
style: {
|
|
235
198
|
position: "sticky",
|
|
236
199
|
top: 0,
|
|
237
|
-
backgroundColor: stickyCellColor
|
|
200
|
+
backgroundColor: stickyCellColor ?? "inherit",
|
|
238
201
|
zIndex: 5,
|
|
239
202
|
backgroundClip: "padding-box",
|
|
240
|
-
display: "table-cell"
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
203
|
+
display: "table-cell",
|
|
204
|
+
...columnPinningDirection === "left" ? {
|
|
205
|
+
left: `${cell.column.getStart("left")}px`,
|
|
206
|
+
borderRight: getIsLastLeftPinnedColumn(cell.getContext().table, cell.column) ? `1px solid ${tokens3.colors.ui.background__medium.hex}` : void 0
|
|
207
|
+
} : {
|
|
208
|
+
right: `${getTotalRight(cell.getContext().table, cell.column)}px`,
|
|
209
|
+
borderLeft: getIsFirstRightPinnedColumn(cell.column) ? `1px solid ${tokens3.colors.ui.background__medium.hex}` : void 0
|
|
210
|
+
}
|
|
211
|
+
},
|
|
248
212
|
children: cellContent
|
|
249
213
|
}
|
|
250
214
|
);
|
|
251
215
|
}
|
|
252
|
-
if (
|
|
216
|
+
if (cell.column.columnDef.meta?.sticky) {
|
|
253
217
|
return /* @__PURE__ */ jsx5(StyledStickyCell, { backgroundColor: stickyCellColor, "data-column": cell.column.id, children: cellContent });
|
|
254
218
|
}
|
|
255
219
|
return /* @__PURE__ */ jsx5(StyledCell, { "data-column": cell.column.id, backgroundColor: regularCellColor, children: cellContent });
|
|
@@ -292,7 +256,6 @@ var Cell2 = styled6(EdsTable2.Cell)`
|
|
|
292
256
|
${resizeCellStyle}
|
|
293
257
|
`;
|
|
294
258
|
var HeaderCell = ({ header, table }) => {
|
|
295
|
-
var _a;
|
|
296
259
|
const style = {
|
|
297
260
|
width: header.column.getSize(),
|
|
298
261
|
zIndex: 10
|
|
@@ -307,28 +270,31 @@ var HeaderCell = ({ header, table }) => {
|
|
|
307
270
|
if (columnPinningDirection) {
|
|
308
271
|
return /* @__PURE__ */ jsx6(
|
|
309
272
|
EdsTable2.Cell,
|
|
310
|
-
|
|
311
|
-
|
|
273
|
+
{
|
|
274
|
+
...cellProps,
|
|
275
|
+
style: {
|
|
276
|
+
...cellProps.style,
|
|
312
277
|
position: "sticky",
|
|
313
278
|
top: 0,
|
|
314
279
|
zIndex: 11,
|
|
315
280
|
backgroundClip: "padding-box",
|
|
316
|
-
display: "table-cell"
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
281
|
+
display: "table-cell",
|
|
282
|
+
...columnPinningDirection === "left" ? {
|
|
283
|
+
left: `${header.column.getStart("left")}px`,
|
|
284
|
+
borderRight: getIsLastLeftPinnedColumn(table, header.column) ? `1px solid ${tokens4.colors.ui.background__medium.hex}` : void 0
|
|
285
|
+
} : {
|
|
286
|
+
right: `${getTotalRight(table, header.column)}px`,
|
|
287
|
+
borderLeft: getIsFirstRightPinnedColumn(header.column) ? `1px solid ${tokens4.colors.ui.background__medium.hex}` : void 0
|
|
288
|
+
}
|
|
289
|
+
},
|
|
324
290
|
children: /* @__PURE__ */ jsx6(HeaderContent, { header, table })
|
|
325
|
-
}
|
|
291
|
+
}
|
|
326
292
|
);
|
|
327
293
|
}
|
|
328
|
-
if (
|
|
329
|
-
return /* @__PURE__ */ jsx6(StickyCell2,
|
|
294
|
+
if (header.column.columnDef.meta?.sticky) {
|
|
295
|
+
return /* @__PURE__ */ jsx6(StickyCell2, { ...cellProps, children: /* @__PURE__ */ jsx6(HeaderContent, { header, table }) }, header.id);
|
|
330
296
|
}
|
|
331
|
-
return /* @__PURE__ */ jsx6(Cell2,
|
|
297
|
+
return /* @__PURE__ */ jsx6(Cell2, { ...cellProps, children: /* @__PURE__ */ jsx6(HeaderContent, { header, table }) }, header.id);
|
|
332
298
|
};
|
|
333
299
|
var HeaderDiv = styled6.div`
|
|
334
300
|
display: flex;
|
|
@@ -337,15 +303,14 @@ var HeaderDiv = styled6.div`
|
|
|
337
303
|
z-index: 5;
|
|
338
304
|
`;
|
|
339
305
|
function HeaderContent({ header, table }) {
|
|
340
|
-
var _a;
|
|
341
306
|
if (header.isPlaceholder) return null;
|
|
342
307
|
return /* @__PURE__ */ jsxs3(HeaderDiv, { children: [
|
|
343
308
|
flexRender2(header.column.columnDef.header, header.getContext()),
|
|
344
|
-
|
|
309
|
+
{
|
|
345
310
|
asc: /* @__PURE__ */ jsx6(Icon3, { data: arrow_drop_up, style: { flexShrink: 0 } }),
|
|
346
311
|
desc: /* @__PURE__ */ jsx6(Icon3, { data: arrow_drop_down, style: { flexShrink: 0 } }),
|
|
347
312
|
none: /* @__PURE__ */ jsx6(Icon3, { data: arrow_drop_down, style: { flexShrink: 0 } })
|
|
348
|
-
}[header.column.getIsSorted()]
|
|
313
|
+
}[header.column.getIsSorted()] ?? null,
|
|
349
314
|
table.options.enableColumnResizing && /* @__PURE__ */ jsx6(
|
|
350
315
|
"div",
|
|
351
316
|
{
|
|
@@ -389,22 +354,30 @@ var truncateStyle = {
|
|
|
389
354
|
textOverflow: "ellipsis"
|
|
390
355
|
};
|
|
391
356
|
var TypographyCustom = (props) => {
|
|
392
|
-
const
|
|
357
|
+
const { truncate, enableShowAllOnHover, style: styleFromProps, ...edsTypographyProps } = props;
|
|
393
358
|
if (enableShowAllOnHover)
|
|
394
359
|
return /* @__PURE__ */ jsx7(HoverCapture, { children: /* @__PURE__ */ jsx7(
|
|
395
360
|
EdsTypography,
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
361
|
+
{
|
|
362
|
+
...edsTypographyProps,
|
|
363
|
+
style: {
|
|
364
|
+
...styleFromProps,
|
|
365
|
+
...truncateStyle
|
|
366
|
+
}
|
|
367
|
+
}
|
|
399
368
|
) });
|
|
400
369
|
if (truncate)
|
|
401
370
|
return /* @__PURE__ */ jsx7(
|
|
402
371
|
EdsTypography,
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
372
|
+
{
|
|
373
|
+
...edsTypographyProps,
|
|
374
|
+
style: {
|
|
375
|
+
...styleFromProps,
|
|
376
|
+
...truncateStyle
|
|
377
|
+
}
|
|
378
|
+
}
|
|
406
379
|
);
|
|
407
|
-
return /* @__PURE__ */ jsx7(EdsTypography,
|
|
380
|
+
return /* @__PURE__ */ jsx7(EdsTypography, { ...edsTypographyProps, style: styleFromProps });
|
|
408
381
|
};
|
|
409
382
|
var HoverCapture = styled7.div`
|
|
410
383
|
height: ${tokens5.typography.table.cell_text.lineHeight};
|
|
@@ -459,15 +432,14 @@ var CellWrapper = styled8(TypographyCustom)`
|
|
|
459
432
|
`}
|
|
460
433
|
`;
|
|
461
434
|
function HierarchyCell(cell, options = {}) {
|
|
462
|
-
var _a, _b, _c, _d;
|
|
463
435
|
return /* @__PURE__ */ jsxs4(
|
|
464
436
|
CellWrapper,
|
|
465
437
|
{
|
|
466
|
-
depth:
|
|
438
|
+
depth: options.getRowDepth?.() ?? cell.row.depth,
|
|
467
439
|
expanded: cell.row.getIsExpanded(),
|
|
468
440
|
children: [
|
|
469
441
|
/* @__PURE__ */ jsx8("span", { className: "--divider" }),
|
|
470
|
-
|
|
442
|
+
options.getDisplayName?.() ?? cell.getValue()
|
|
471
443
|
]
|
|
472
444
|
}
|
|
473
445
|
);
|
|
@@ -478,7 +450,6 @@ import { Popover, Typography } from "@equinor/eds-core-react";
|
|
|
478
450
|
import { useRef, useState as useState2 } from "react";
|
|
479
451
|
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
480
452
|
function PopoverCell(props) {
|
|
481
|
-
var _a, _b;
|
|
482
453
|
const [open, setOpen] = useState2(false);
|
|
483
454
|
const anchorRef = useRef(null);
|
|
484
455
|
const handleClick = () => setOpen(!open);
|
|
@@ -490,7 +461,7 @@ function PopoverCell(props) {
|
|
|
490
461
|
onClick: stopPropagation(handleClick),
|
|
491
462
|
style: { cursor: "pointer" },
|
|
492
463
|
truncate: true,
|
|
493
|
-
children: String(
|
|
464
|
+
children: String(props.value ?? "")
|
|
494
465
|
}
|
|
495
466
|
),
|
|
496
467
|
/* @__PURE__ */ jsxs5(
|
|
@@ -504,7 +475,7 @@ function PopoverCell(props) {
|
|
|
504
475
|
placement: "bottom",
|
|
505
476
|
children: [
|
|
506
477
|
props.title && /* @__PURE__ */ jsx9(Popover.Title, { children: /* @__PURE__ */ jsx9(Popover.Header, { children: props.title }) }),
|
|
507
|
-
/* @__PURE__ */ jsx9(Popover.Content, { children: /* @__PURE__ */ jsx9(Typography, { children: String(
|
|
478
|
+
/* @__PURE__ */ jsx9(Popover.Content, { children: /* @__PURE__ */ jsx9(Typography, { children: String(props.value ?? "") }) })
|
|
508
479
|
]
|
|
509
480
|
}
|
|
510
481
|
)
|
|
@@ -594,11 +565,11 @@ function getColumnHeader(column) {
|
|
|
594
565
|
}
|
|
595
566
|
function prependSelectColumnIfEnabled(columns, config) {
|
|
596
567
|
if (!config) return columns;
|
|
597
|
-
if (!
|
|
568
|
+
if (!config?.mode) return columns;
|
|
598
569
|
return prependSelectColumn(columns, config);
|
|
599
570
|
}
|
|
600
571
|
function prependSelectColumn(columns, config) {
|
|
601
|
-
if (!
|
|
572
|
+
if (!config?.selectColumn) return columns;
|
|
602
573
|
if (config.selectColumn === "default") return [SelectColumnDef(config), ...columns];
|
|
603
574
|
return [config.selectColumn(), ...columns];
|
|
604
575
|
}
|
|
@@ -754,9 +725,8 @@ function TableRow({
|
|
|
754
725
|
measureElement,
|
|
755
726
|
index
|
|
756
727
|
}) {
|
|
757
|
-
|
|
758
|
-
const
|
|
759
|
-
const dataIdValue = (_a = rowConfig == null ? void 0 : rowConfig.getDataIdAttribute) == null ? void 0 : _a.call(rowConfig, row);
|
|
728
|
+
const rowWrapper = rowConfig?.rowWrapper;
|
|
729
|
+
const dataIdValue = rowConfig?.getDataIdAttribute?.(row);
|
|
760
730
|
const tableRowContent = /* @__PURE__ */ jsx14(
|
|
761
731
|
StyledTableRow,
|
|
762
732
|
{
|
|
@@ -765,15 +735,12 @@ function TableRow({
|
|
|
765
735
|
"data-id": dataIdValue,
|
|
766
736
|
ref: measureElement,
|
|
767
737
|
style: {
|
|
768
|
-
cursor:
|
|
769
|
-
backgroundColor:
|
|
738
|
+
cursor: rowConfig?.onClick ? "pointer" : "initial",
|
|
739
|
+
backgroundColor: rowConfig?.getRowBackground?.(row)
|
|
770
740
|
},
|
|
771
|
-
onClick: () =>
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
},
|
|
775
|
-
onMouseEnter: handleRowEvent(row, rowConfig == null ? void 0 : rowConfig.onMouseEnter),
|
|
776
|
-
onMouseLeave: handleRowEvent(row, rowConfig == null ? void 0 : rowConfig.onMouseLeave),
|
|
741
|
+
onClick: () => rowConfig?.onClick?.(row),
|
|
742
|
+
onMouseEnter: handleRowEvent(row, rowConfig?.onMouseEnter),
|
|
743
|
+
onMouseLeave: handleRowEvent(row, rowConfig?.onMouseLeave),
|
|
777
744
|
children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx14(DynamicCell, { cell, cellConfig }, cell.id))
|
|
778
745
|
}
|
|
779
746
|
);
|
|
@@ -826,18 +793,13 @@ var CloseButton = styled14(Button4)`
|
|
|
826
793
|
width: 24px;
|
|
827
794
|
height: 24px;
|
|
828
795
|
`;
|
|
829
|
-
function DebouncedInput(
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
"value",
|
|
837
|
-
"onChange",
|
|
838
|
-
"icon",
|
|
839
|
-
"debounce"
|
|
840
|
-
]);
|
|
796
|
+
function DebouncedInput({
|
|
797
|
+
value: initialValue,
|
|
798
|
+
onChange,
|
|
799
|
+
icon,
|
|
800
|
+
debounce = 500,
|
|
801
|
+
...props
|
|
802
|
+
}) {
|
|
841
803
|
const [value, setValue] = useState4(initialValue);
|
|
842
804
|
useEffect(() => {
|
|
843
805
|
setValue(initialValue);
|
|
@@ -850,12 +812,13 @@ function DebouncedInput(_a) {
|
|
|
850
812
|
}, [value]);
|
|
851
813
|
return /* @__PURE__ */ jsx16(Wrapper3, { children: /* @__PURE__ */ jsx16(
|
|
852
814
|
Input,
|
|
853
|
-
|
|
815
|
+
{
|
|
816
|
+
...props,
|
|
854
817
|
value,
|
|
855
818
|
leftAdornments: icon && /* @__PURE__ */ jsx16(Icon6, { name: icon.name, data: icon, size: 18 }),
|
|
856
819
|
rightAdornments: !!value && /* @__PURE__ */ jsx16(Tooltip2, { title: "Clear input", children: /* @__PURE__ */ jsx16(CloseButton, { variant: "ghost_icon", onClick: () => setValue(""), children: /* @__PURE__ */ jsx16(Icon6, { name: close2.name, data: close2, size: 18 }) }) }),
|
|
857
820
|
onChange: (event) => setValue(event.target.value)
|
|
858
|
-
}
|
|
821
|
+
}
|
|
859
822
|
) });
|
|
860
823
|
}
|
|
861
824
|
|
|
@@ -890,25 +853,30 @@ function TableBanner({
|
|
|
890
853
|
tableCaption,
|
|
891
854
|
globalFilter
|
|
892
855
|
}) {
|
|
893
|
-
|
|
894
|
-
return /* @__PURE__ */ jsxs9(TableBannerWrapper, { className: "--table-caption", padding: bannerConfig == null ? void 0 : bannerConfig.padding, children: [
|
|
856
|
+
return /* @__PURE__ */ jsxs9(TableBannerWrapper, { className: "--table-caption", padding: bannerConfig?.padding, children: [
|
|
895
857
|
/* @__PURE__ */ jsxs9(FilterContainer, { className: "--filter-container-left", children: [
|
|
896
|
-
|
|
897
|
-
|
|
858
|
+
bannerConfig?.enableTableCaption && /* @__PURE__ */ jsx17(Typography3, { variant: "h3", as: "h2", children: tableCaption }),
|
|
859
|
+
bannerConfig?.customActionsLeft?.(table) ?? bannerConfig?.customActions?.(table)
|
|
898
860
|
] }),
|
|
899
861
|
/* @__PURE__ */ jsx17(FilterContainer, { className: "--filter-container-right", children: /* @__PURE__ */ jsxs9(Fragment3, { children: [
|
|
900
|
-
|
|
901
|
-
|
|
862
|
+
bannerConfig?.customActionsRight?.(table),
|
|
863
|
+
bannerConfig?.enableGlobalFilterInput && /* @__PURE__ */ jsx17(
|
|
902
864
|
DebouncedInput,
|
|
903
865
|
{
|
|
904
866
|
value: globalFilter.state,
|
|
905
867
|
icon: search,
|
|
906
|
-
placeholder:
|
|
868
|
+
placeholder: bannerConfig.globalFilterPlaceholder ?? "Search all columns",
|
|
907
869
|
onChange: (value) => globalFilter.onChange(String(value))
|
|
908
870
|
}
|
|
909
871
|
),
|
|
910
|
-
|
|
911
|
-
|
|
872
|
+
bannerConfig?.enableColumnSelect && /* @__PURE__ */ jsx17(
|
|
873
|
+
ColumnSelect,
|
|
874
|
+
{
|
|
875
|
+
table,
|
|
876
|
+
columnSelectPlaceholder: bannerConfig.columnSelectPlaceholder
|
|
877
|
+
}
|
|
878
|
+
),
|
|
879
|
+
bannerConfig?.totalRowCount && /* @__PURE__ */ jsxs9("span", { children: [
|
|
912
880
|
table.options.data.length.toLocaleString(),
|
|
913
881
|
" /",
|
|
914
882
|
" ",
|
|
@@ -933,30 +901,24 @@ var PaddingRow = (props) => {
|
|
|
933
901
|
|
|
934
902
|
// src/DataTable/components/VirtualTable.tsx
|
|
935
903
|
import { jsx as jsx19, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
936
|
-
function VirtualTable(
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
"table",
|
|
944
|
-
"rowConfig",
|
|
945
|
-
"cellConfig",
|
|
946
|
-
"containerRef"
|
|
947
|
-
]);
|
|
948
|
-
var _a2, _b2;
|
|
904
|
+
function VirtualTable({
|
|
905
|
+
table,
|
|
906
|
+
rowConfig,
|
|
907
|
+
cellConfig,
|
|
908
|
+
containerRef,
|
|
909
|
+
...props
|
|
910
|
+
}) {
|
|
949
911
|
const { rows } = table.getRowModel();
|
|
950
912
|
const rowVirtualizer = useVirtualizer({
|
|
951
913
|
count: rows.length,
|
|
952
914
|
estimateSize: () => 48,
|
|
953
915
|
getScrollElement: () => containerRef.current,
|
|
954
|
-
measureElement: (element) => element
|
|
916
|
+
measureElement: (element) => element?.getBoundingClientRect().height,
|
|
955
917
|
overscan: 20
|
|
956
918
|
});
|
|
957
919
|
const virtualRows = rowVirtualizer.getVirtualItems();
|
|
958
|
-
const paddingTop = virtualRows.length > 0 ?
|
|
959
|
-
const paddingBottom = virtualRows.length > 0 ? rowVirtualizer.getTotalSize() - (
|
|
920
|
+
const paddingTop = virtualRows.length > 0 ? virtualRows?.[0]?.start || 0 : 0;
|
|
921
|
+
const paddingBottom = virtualRows.length > 0 ? rowVirtualizer.getTotalSize() - (virtualRows?.[virtualRows.length - 1]?.end || 0) : 0;
|
|
960
922
|
return /* @__PURE__ */ jsxs10(Table8, { children: [
|
|
961
923
|
/* @__PURE__ */ jsx19(Table8.Caption, { hidden: true, children: props.tableCaption }),
|
|
962
924
|
/* @__PURE__ */ jsx19(TableHeader, { sticky: props.stickyHeader, table }),
|
|
@@ -1025,16 +987,10 @@ function canUseContainStrict(height) {
|
|
|
1025
987
|
return true;
|
|
1026
988
|
}
|
|
1027
989
|
var DataTableWrapper = styled16.div`
|
|
1028
|
-
width: ${(props) =>
|
|
1029
|
-
var _a;
|
|
1030
|
-
return (_a = props.width) != null ? _a : "100%";
|
|
1031
|
-
}};
|
|
990
|
+
width: ${(props) => props.width ?? "100%"};
|
|
1032
991
|
|
|
1033
992
|
.--table-container {
|
|
1034
|
-
height: ${(props) =>
|
|
1035
|
-
var _a;
|
|
1036
|
-
return (_a = props.height) != null ? _a : "100%";
|
|
1037
|
-
}};
|
|
993
|
+
height: ${(props) => props.height ?? "100%"};
|
|
1038
994
|
width: '100%';
|
|
1039
995
|
overflow: auto;
|
|
1040
996
|
${(props) => canUseContainStrict(props.height) ? "contain: strict;" : ""}
|
|
@@ -1044,44 +1000,40 @@ var DataTableWrapper = styled16.div`
|
|
|
1044
1000
|
|
|
1045
1001
|
// The following attribute is important for fixed column width
|
|
1046
1002
|
// CHANGE THIS WITH CAUTION
|
|
1047
|
-
table-layout: ${(props) =>
|
|
1048
|
-
var _a;
|
|
1049
|
-
return (_a = props.tableLayout) != null ? _a : "auto";
|
|
1050
|
-
}};
|
|
1003
|
+
table-layout: ${(props) => props.tableLayout ?? "auto"};
|
|
1051
1004
|
}
|
|
1052
1005
|
}
|
|
1053
1006
|
`;
|
|
1054
1007
|
function DataTable(props) {
|
|
1055
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F;
|
|
1056
1008
|
const { columns, data, bannerConfig, cellConfig, sorting } = props;
|
|
1057
1009
|
const [internalColumnVisibility, setInternalColumnVisibility] = useState6({});
|
|
1058
1010
|
const [columnVisibility, setColumnVisibility] = [
|
|
1059
|
-
|
|
1060
|
-
|
|
1011
|
+
props.columnVisibility?.state ?? internalColumnVisibility,
|
|
1012
|
+
props.columnVisibility?.onChange ?? setInternalColumnVisibility
|
|
1061
1013
|
];
|
|
1062
1014
|
const [internalGlobalFilterState, setInternalGlobalFilterState] = useState6("");
|
|
1063
1015
|
const [globalFilterState, setGlobalFilterState] = [
|
|
1064
|
-
|
|
1065
|
-
|
|
1016
|
+
props.globalFilter?.state ?? internalGlobalFilterState,
|
|
1017
|
+
props.globalFilter?.onChange ?? setInternalGlobalFilterState
|
|
1066
1018
|
];
|
|
1067
|
-
const shouldEnableGlobalFilter =
|
|
1019
|
+
const shouldEnableGlobalFilter = props.bannerConfig?.enableGlobalFilterInput || Boolean(props.globalFilter);
|
|
1068
1020
|
function enableGlobalFilter(value) {
|
|
1069
1021
|
return enableOrUndefined(shouldEnableGlobalFilter, value);
|
|
1070
1022
|
}
|
|
1071
1023
|
const [internalSortingState, setInternalSortingState] = useState6([]);
|
|
1072
1024
|
const [sortingState, setSortingState] = [
|
|
1073
|
-
|
|
1074
|
-
|
|
1025
|
+
props.sorting?.state ?? internalSortingState,
|
|
1026
|
+
props.sorting?.onChange ?? setInternalSortingState
|
|
1075
1027
|
];
|
|
1076
1028
|
const [internalRowSelectionState, setInternalRowSelectionState] = useState6({});
|
|
1077
1029
|
const [rowSelectionState, setRowSelectionState] = [
|
|
1078
|
-
|
|
1079
|
-
|
|
1030
|
+
props.rowSelection?.state ?? internalRowSelectionState,
|
|
1031
|
+
props.rowSelection?.onChange ?? setInternalRowSelectionState
|
|
1080
1032
|
];
|
|
1081
1033
|
const [internalExpandedState, setInternalExpandedState] = useState6({});
|
|
1082
1034
|
const [expandedState, setExpandedState] = [
|
|
1083
|
-
|
|
1084
|
-
|
|
1035
|
+
props.expansion?.state ?? internalExpandedState,
|
|
1036
|
+
props.expansion?.onChange ?? setInternalExpandedState
|
|
1085
1037
|
];
|
|
1086
1038
|
const [internalColumnPinning, setInternalColumnPinning] = useState6({});
|
|
1087
1039
|
const [columnPinning, setColumnPinning] = [
|
|
@@ -1095,25 +1047,25 @@ function DataTable(props) {
|
|
|
1095
1047
|
state: {
|
|
1096
1048
|
expanded: expandedState,
|
|
1097
1049
|
globalFilter: enableGlobalFilter(globalFilterState),
|
|
1098
|
-
sorting:
|
|
1050
|
+
sorting: props.sorting?.enableSorting ? props.sorting?.state ?? sortingState : void 0,
|
|
1099
1051
|
rowSelection: rowSelectionState,
|
|
1100
1052
|
columnVisibility,
|
|
1101
1053
|
columnPinning
|
|
1102
1054
|
},
|
|
1103
1055
|
defaultColumn: {
|
|
1104
1056
|
cell: ({ cell }) => {
|
|
1105
|
-
const truncateMode = getFunctionValueOrDefault(cellConfig
|
|
1057
|
+
const truncateMode = getFunctionValueOrDefault(cellConfig?.truncateMode, cell, "hover");
|
|
1106
1058
|
return /* @__PURE__ */ jsx20(TypographyCustom, { truncate: truncateMode === "hover", enableShowAllOnHover: true, children: cell.getValue() });
|
|
1107
1059
|
}
|
|
1108
1060
|
},
|
|
1109
1061
|
enableColumnResizing: Boolean(props.columnResizing),
|
|
1110
1062
|
columnResizeMode: typeof props.columnResizing === "boolean" ? "onChange" : props.columnResizing,
|
|
1111
|
-
enableSorting: sorting
|
|
1112
|
-
manualSorting: sorting
|
|
1063
|
+
enableSorting: sorting?.enableSorting,
|
|
1064
|
+
manualSorting: sorting?.manualSorting,
|
|
1113
1065
|
enableExpanding: Boolean(props.expansion),
|
|
1114
|
-
enableMultiRowSelection:
|
|
1115
|
-
enableSubRowSelection:
|
|
1116
|
-
filterFromLeafRows: bannerConfig
|
|
1066
|
+
enableMultiRowSelection: props.rowSelection?.mode === "multiple",
|
|
1067
|
+
enableSubRowSelection: props.rowSelection?.mode !== "single",
|
|
1068
|
+
filterFromLeafRows: bannerConfig?.filterFromLeafRows,
|
|
1117
1069
|
enablePinning: props.columnPinning !== void 0 && (typeof props.columnPinning === "boolean" ? props.columnPinning : props.columnPinning.enable),
|
|
1118
1070
|
getFilteredRowModel: enableGlobalFilter(getFilteredRowModel()),
|
|
1119
1071
|
getCoreRowModel: getCoreRowModel(),
|
|
@@ -1122,18 +1074,17 @@ function DataTable(props) {
|
|
|
1122
1074
|
onExpandedChange: setExpandedState,
|
|
1123
1075
|
onRowSelectionChange: setRowSelectionState,
|
|
1124
1076
|
onColumnPinningChange: setColumnPinning,
|
|
1125
|
-
onSortingChange:
|
|
1077
|
+
onSortingChange: sorting?.enableSorting ? sorting?.onChange ?? setSortingState : void 0,
|
|
1126
1078
|
onColumnVisibilityChange: setColumnVisibility,
|
|
1127
1079
|
onGlobalFilterChange: enableGlobalFilter(setGlobalFilterState),
|
|
1128
|
-
getSubRows: props
|
|
1129
|
-
getRowId: props
|
|
1080
|
+
getSubRows: props?.getSubRows,
|
|
1081
|
+
getRowId: props?.getRowId
|
|
1130
1082
|
});
|
|
1131
1083
|
useEffect3(() => {
|
|
1132
|
-
|
|
1133
|
-
if ((_a2 = props.expansion) == null ? void 0 : _a2.expandAllByDefault) {
|
|
1084
|
+
if (props.expansion?.expandAllByDefault) {
|
|
1134
1085
|
table.toggleAllRowsExpanded();
|
|
1135
1086
|
}
|
|
1136
|
-
}, [table,
|
|
1087
|
+
}, [table, props.expansion?.expandAllByDefault]);
|
|
1137
1088
|
const { isLoading, rowConfig } = props;
|
|
1138
1089
|
const tableContainerRef = useRef3(null);
|
|
1139
1090
|
const onTableContainerScroll = useFetchMoreOnBottomReached(
|
|
@@ -1144,7 +1095,7 @@ function DataTable(props) {
|
|
|
1144
1095
|
useEffect3(() => {
|
|
1145
1096
|
if (tableContainerRef.current) forceRerender();
|
|
1146
1097
|
}, [tableContainerRef.current === null]);
|
|
1147
|
-
return /* @__PURE__ */ jsxs11(DataTableWrapper, { height: props
|
|
1098
|
+
return /* @__PURE__ */ jsxs11(DataTableWrapper, { height: props?.height, width: props?.width, tableLayout: props?.tableLayout, children: [
|
|
1148
1099
|
props.bannerConfig && /* @__PURE__ */ jsx20(
|
|
1149
1100
|
TableBanner,
|
|
1150
1101
|
{
|
|
@@ -1156,19 +1107,19 @@ function DataTable(props) {
|
|
|
1156
1107
|
),
|
|
1157
1108
|
/* @__PURE__ */ jsx20(
|
|
1158
1109
|
"div",
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1110
|
+
{
|
|
1111
|
+
...props.tableContainerProps,
|
|
1112
|
+
className: "--table-container " + (props.tableContainerProps?.className ?? ""),
|
|
1113
|
+
onScroll: props.tableContainerProps?.onScroll ?? onTableContainerScroll,
|
|
1162
1114
|
ref: (node) => {
|
|
1163
|
-
var _a2;
|
|
1164
1115
|
if (node) {
|
|
1165
1116
|
tableContainerRef.current = node;
|
|
1166
|
-
if (
|
|
1117
|
+
if (props.tableContainerProps?.ref) {
|
|
1167
1118
|
props.tableContainerProps.ref.current = node;
|
|
1168
1119
|
}
|
|
1169
1120
|
}
|
|
1170
1121
|
},
|
|
1171
|
-
children:
|
|
1122
|
+
children: props?.virtual ? /* @__PURE__ */ jsx20(
|
|
1172
1123
|
VirtualTable,
|
|
1173
1124
|
{
|
|
1174
1125
|
containerRef: tableContainerRef,
|
|
@@ -1190,7 +1141,7 @@ function DataTable(props) {
|
|
|
1190
1141
|
stickyHeader: props.stickyHeader
|
|
1191
1142
|
}
|
|
1192
1143
|
)
|
|
1193
|
-
}
|
|
1144
|
+
}
|
|
1194
1145
|
)
|
|
1195
1146
|
] });
|
|
1196
1147
|
}
|
|
@@ -1208,21 +1159,16 @@ var formMeta = {
|
|
|
1208
1159
|
_hasRemoteChange: false
|
|
1209
1160
|
};
|
|
1210
1161
|
function useEditMode() {
|
|
1211
|
-
var _a;
|
|
1212
1162
|
const { watch } = useFormContext();
|
|
1213
|
-
return
|
|
1163
|
+
return watch("_editMode") ?? false;
|
|
1214
1164
|
}
|
|
1215
1165
|
function useHasRemoteChange() {
|
|
1216
|
-
var _a;
|
|
1217
1166
|
const { watch } = useFormContext();
|
|
1218
|
-
return
|
|
1167
|
+
return watch("_hasRemoteChange") ?? false;
|
|
1219
1168
|
}
|
|
1220
1169
|
function useGetIsNew() {
|
|
1221
1170
|
const { getValues } = useFormContext();
|
|
1222
|
-
return () =>
|
|
1223
|
-
var _a;
|
|
1224
|
-
return (_a = getValues("_isNew")) != null ? _a : false;
|
|
1225
|
-
};
|
|
1171
|
+
return () => getValues("_isNew") ?? false;
|
|
1226
1172
|
}
|
|
1227
1173
|
function useSetFormMeta() {
|
|
1228
1174
|
const { setValue } = useFormContext();
|
|
@@ -1235,17 +1181,15 @@ function removeFormMeta(withFormMeta) {
|
|
|
1235
1181
|
return omit(withFormMeta, Object.keys(formMeta));
|
|
1236
1182
|
}
|
|
1237
1183
|
function addFormMeta(withoutFormMeta) {
|
|
1238
|
-
return
|
|
1184
|
+
return { ...formMeta, ...withoutFormMeta };
|
|
1239
1185
|
}
|
|
1240
1186
|
|
|
1241
1187
|
// src/form-cells/EditableCheckboxCell.tsx
|
|
1242
1188
|
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
1243
|
-
function EditableCheckboxCell(
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
"onChange"
|
|
1248
|
-
]);
|
|
1189
|
+
function EditableCheckboxCell({
|
|
1190
|
+
onChange: onChangeFromProps,
|
|
1191
|
+
...context
|
|
1192
|
+
}) {
|
|
1249
1193
|
const editMode = useEditMode();
|
|
1250
1194
|
if (!editMode)
|
|
1251
1195
|
return /* @__PURE__ */ jsx21(
|
|
@@ -1262,22 +1206,19 @@ function EditableCheckboxCell(_a) {
|
|
|
1262
1206
|
Controller,
|
|
1263
1207
|
{
|
|
1264
1208
|
name: context.column.id,
|
|
1265
|
-
render: (
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
})
|
|
1279
|
-
);
|
|
1280
|
-
}
|
|
1209
|
+
render: ({ field: { value, onChange, ...field } }) => /* @__PURE__ */ jsx21(
|
|
1210
|
+
Checkbox4,
|
|
1211
|
+
{
|
|
1212
|
+
enterKeyHint: "send",
|
|
1213
|
+
"aria-label": "editable",
|
|
1214
|
+
checked: value,
|
|
1215
|
+
...field,
|
|
1216
|
+
onChange: (e) => {
|
|
1217
|
+
onChange(e);
|
|
1218
|
+
onChangeFromProps?.(e.target.checked);
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
)
|
|
1281
1222
|
}
|
|
1282
1223
|
);
|
|
1283
1224
|
}
|
|
@@ -1298,9 +1239,8 @@ function getHelperTextProps({
|
|
|
1298
1239
|
warning,
|
|
1299
1240
|
helperText
|
|
1300
1241
|
}) {
|
|
1301
|
-
var _a;
|
|
1302
1242
|
if (error) {
|
|
1303
|
-
if (
|
|
1243
|
+
if (error.message?.startsWith(WARNING_PREFIX)) {
|
|
1304
1244
|
return {
|
|
1305
1245
|
variant: "warning",
|
|
1306
1246
|
helperText: error.message.substring(WARNING_PREFIX.length),
|
|
@@ -1327,23 +1267,16 @@ function getHelperTextProps({
|
|
|
1327
1267
|
|
|
1328
1268
|
// src/form-cells/EditableDateCell.tsx
|
|
1329
1269
|
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
1330
|
-
function EditableDateCell(
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
"dateStringFormatter",
|
|
1337
|
-
"error",
|
|
1338
|
-
"onChange"
|
|
1339
|
-
]);
|
|
1270
|
+
function EditableDateCell({
|
|
1271
|
+
dateStringFormatter,
|
|
1272
|
+
error: errorFromProps,
|
|
1273
|
+
onChange: onChangeFromProps,
|
|
1274
|
+
...context
|
|
1275
|
+
}) {
|
|
1340
1276
|
const rawValue = context.getValue();
|
|
1341
1277
|
const editMode = useEditMode();
|
|
1342
1278
|
const formattedValue = useMemo(
|
|
1343
|
-
() =>
|
|
1344
|
-
var _a2;
|
|
1345
|
-
return (_a2 = dateStringFormatter == null ? void 0 : dateStringFormatter(rawValue)) != null ? _a2 : rawValue;
|
|
1346
|
-
},
|
|
1279
|
+
() => dateStringFormatter?.(rawValue) ?? rawValue,
|
|
1347
1280
|
[rawValue, dateStringFormatter]
|
|
1348
1281
|
);
|
|
1349
1282
|
if (!editMode) return /* @__PURE__ */ jsx23(TypographyCustom, { truncate: true, children: formattedValue });
|
|
@@ -1351,23 +1284,22 @@ function EditableDateCell(_a) {
|
|
|
1351
1284
|
Controller2,
|
|
1352
1285
|
{
|
|
1353
1286
|
name: context.column.id,
|
|
1354
|
-
render: (
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
onChange
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
}
|
|
1287
|
+
render: ({ field: { value, onChange, ...field }, fieldState: { error } }) => /* @__PURE__ */ jsx23(
|
|
1288
|
+
InlineTextField,
|
|
1289
|
+
{
|
|
1290
|
+
id: context.column.id,
|
|
1291
|
+
type: "date",
|
|
1292
|
+
autoComplete: "none",
|
|
1293
|
+
value: value ? parseISODate(value) : "",
|
|
1294
|
+
onChange: (e) => {
|
|
1295
|
+
const newDateString = e.target.value ? parseISODate(e.target.value) ?? "" : "";
|
|
1296
|
+
onChange(newDateString);
|
|
1297
|
+
onChangeFromProps?.(newDateString);
|
|
1298
|
+
},
|
|
1299
|
+
...getHelperTextProps({ error: errorFromProps ?? error }),
|
|
1300
|
+
...field
|
|
1301
|
+
}
|
|
1302
|
+
)
|
|
1371
1303
|
}
|
|
1372
1304
|
);
|
|
1373
1305
|
}
|
|
@@ -1447,18 +1379,13 @@ function HelperText({ helperText, variant, helperIcon }) {
|
|
|
1447
1379
|
|
|
1448
1380
|
// src/form-cells/EditableDropdownSingleCell.tsx
|
|
1449
1381
|
import { Fragment as Fragment5, jsx as jsx25, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1450
|
-
function EditableDropdownSingleCell(
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
"options",
|
|
1458
|
-
"error",
|
|
1459
|
-
"onChange",
|
|
1460
|
-
"label"
|
|
1461
|
-
]);
|
|
1382
|
+
function EditableDropdownSingleCell({
|
|
1383
|
+
options,
|
|
1384
|
+
error: errorFromProps,
|
|
1385
|
+
onChange: onChangeFromProps,
|
|
1386
|
+
label = "",
|
|
1387
|
+
...context
|
|
1388
|
+
}) {
|
|
1462
1389
|
const editMode = useEditMode();
|
|
1463
1390
|
if (!editMode)
|
|
1464
1391
|
return /* @__PURE__ */ jsx25(TypographyCustom, { truncate: true, children: context.getValue() });
|
|
@@ -1466,31 +1393,28 @@ function EditableDropdownSingleCell(_a) {
|
|
|
1466
1393
|
Controller3,
|
|
1467
1394
|
{
|
|
1468
1395
|
name: context.column.id,
|
|
1469
|
-
render: (
|
|
1470
|
-
var _b2 = _a2, { field: _c } = _b2, _d = _c, { value, onChange } = _d, field = __objRest(_d, ["value", "onChange"]), { fieldState: { error } } = _b2;
|
|
1396
|
+
render: ({ field: { value, onChange, ...field }, fieldState: { error } }) => {
|
|
1471
1397
|
const selectedOption = options.find((option) => option.value === value);
|
|
1472
1398
|
return /* @__PURE__ */ jsxs13(Fragment5, { children: [
|
|
1473
1399
|
/* @__PURE__ */ jsx25(
|
|
1474
1400
|
Autocomplete,
|
|
1475
|
-
|
|
1401
|
+
{
|
|
1476
1402
|
label,
|
|
1477
1403
|
selectedOptions: selectedOption ? [selectedOption] : [],
|
|
1478
1404
|
options,
|
|
1479
|
-
optionLabel: (option) =>
|
|
1480
|
-
var _a3;
|
|
1481
|
-
return (_a3 = option == null ? void 0 : option.label) != null ? _a3 : "";
|
|
1482
|
-
},
|
|
1405
|
+
optionLabel: (option) => option?.label ?? "",
|
|
1483
1406
|
"aria-required": true,
|
|
1484
1407
|
hideClearButton: true,
|
|
1485
1408
|
"aria-autocomplete": "none",
|
|
1486
1409
|
onOptionsChange: (changes) => {
|
|
1487
1410
|
const [change] = changes.selectedItems;
|
|
1488
|
-
onChange(change
|
|
1489
|
-
onChangeFromProps
|
|
1490
|
-
}
|
|
1491
|
-
|
|
1411
|
+
onChange(change?.value);
|
|
1412
|
+
onChangeFromProps?.(change);
|
|
1413
|
+
},
|
|
1414
|
+
...field
|
|
1415
|
+
}
|
|
1492
1416
|
),
|
|
1493
|
-
/* @__PURE__ */ jsx25(HelperText,
|
|
1417
|
+
/* @__PURE__ */ jsx25(HelperText, { ...getHelperTextProps({ error: errorFromProps ?? error }) })
|
|
1494
1418
|
] });
|
|
1495
1419
|
}
|
|
1496
1420
|
}
|
|
@@ -1502,30 +1426,27 @@ import { TextField as TextField2 } from "@equinor/eds-core-react";
|
|
|
1502
1426
|
import { Controller as Controller4 } from "react-hook-form";
|
|
1503
1427
|
import styled18 from "styled-components";
|
|
1504
1428
|
import { Fragment as Fragment6, jsx as jsx26 } from "react/jsx-runtime";
|
|
1505
|
-
function EditableNumberCell(
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
"error"
|
|
1510
|
-
]);
|
|
1429
|
+
function EditableNumberCell({
|
|
1430
|
+
error: errorFromProps,
|
|
1431
|
+
...context
|
|
1432
|
+
}) {
|
|
1511
1433
|
const editMode = useEditMode();
|
|
1512
1434
|
if (!editMode) return /* @__PURE__ */ jsx26(TypographyCustom, { truncate: true, children: context.getValue() });
|
|
1513
1435
|
return /* @__PURE__ */ jsx26(
|
|
1514
1436
|
Controller4,
|
|
1515
1437
|
{
|
|
1516
1438
|
name: context.column.id,
|
|
1517
|
-
render: (
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
}
|
|
1439
|
+
render: ({ field: { onChange, ...field }, fieldState: { error } }) => /* @__PURE__ */ jsx26(Fragment6, { children: /* @__PURE__ */ jsx26(
|
|
1440
|
+
InlineTextField2,
|
|
1441
|
+
{
|
|
1442
|
+
id: context.column.id,
|
|
1443
|
+
type: "number",
|
|
1444
|
+
autoComplete: "none",
|
|
1445
|
+
onChange: (e) => onChange(e.target.valueAsNumber),
|
|
1446
|
+
...field,
|
|
1447
|
+
...getHelperTextProps({ error: errorFromProps ?? error })
|
|
1448
|
+
}
|
|
1449
|
+
) })
|
|
1529
1450
|
}
|
|
1530
1451
|
);
|
|
1531
1452
|
}
|
|
@@ -1559,16 +1480,12 @@ import { useState as useState7 } from "react";
|
|
|
1559
1480
|
import { Controller as Controller5 } from "react-hook-form";
|
|
1560
1481
|
import styled19 from "styled-components";
|
|
1561
1482
|
import { Fragment as Fragment7, jsx as jsx27, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1562
|
-
function EditableTextAreaCell(
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
"title",
|
|
1569
|
-
"error",
|
|
1570
|
-
"onChange"
|
|
1571
|
-
]);
|
|
1483
|
+
function EditableTextAreaCell({
|
|
1484
|
+
title,
|
|
1485
|
+
error: errorFromProps,
|
|
1486
|
+
onChange: onChangeFromProps,
|
|
1487
|
+
...context
|
|
1488
|
+
}) {
|
|
1572
1489
|
const [textareaValue, setTextareaValue] = useState7(context.getValue());
|
|
1573
1490
|
const [open, setOpen] = useState7(false);
|
|
1574
1491
|
const editMode = useEditMode();
|
|
@@ -1581,88 +1498,87 @@ function EditableTextAreaCell(_a) {
|
|
|
1581
1498
|
Controller5,
|
|
1582
1499
|
{
|
|
1583
1500
|
name,
|
|
1584
|
-
render: (
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1501
|
+
render: ({ field: { onChange, ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ jsxs14(Fragment7, { children: [
|
|
1502
|
+
/* @__PURE__ */ jsxs14(
|
|
1503
|
+
"div",
|
|
1504
|
+
{
|
|
1505
|
+
style: {
|
|
1506
|
+
display: "flex",
|
|
1507
|
+
alignItems: "center",
|
|
1508
|
+
position: "relative"
|
|
1509
|
+
},
|
|
1510
|
+
children: [
|
|
1511
|
+
/* @__PURE__ */ jsx27(
|
|
1512
|
+
StyledTextField,
|
|
1513
|
+
{
|
|
1514
|
+
id: field.name,
|
|
1515
|
+
onChange,
|
|
1516
|
+
ref,
|
|
1517
|
+
...field,
|
|
1518
|
+
...getHelperTextProps({ error: errorFromProps ?? error })
|
|
1519
|
+
}
|
|
1520
|
+
),
|
|
1521
|
+
/* @__PURE__ */ jsx27(IconButton, { variant: "ghost_icon", onClick: stopPropagation(openDialog), children: /* @__PURE__ */ jsx27(Icon8, { data: arrow_up, size: 24, style: { transform: "rotateZ(45deg)" } }) })
|
|
1522
|
+
]
|
|
1523
|
+
}
|
|
1524
|
+
),
|
|
1525
|
+
/* @__PURE__ */ jsxs14(
|
|
1526
|
+
EDS,
|
|
1527
|
+
{
|
|
1528
|
+
open,
|
|
1529
|
+
onClose: () => {
|
|
1530
|
+
closeDialog();
|
|
1531
|
+
onChange(textareaValue);
|
|
1532
|
+
onChangeFromProps?.(textareaValue);
|
|
1533
|
+
},
|
|
1534
|
+
isDismissable: true,
|
|
1535
|
+
style: { width: "min(50rem, calc(100vw - 4rem))" },
|
|
1536
|
+
children: [
|
|
1537
|
+
/* @__PURE__ */ jsx27(EDS.Header, { children: /* @__PURE__ */ jsx27(EDS.Title, { children: title }) }),
|
|
1538
|
+
/* @__PURE__ */ jsx27(EDS.Content, { children: /* @__PURE__ */ jsx27(
|
|
1539
|
+
Textarea,
|
|
1540
|
+
{
|
|
1541
|
+
style: {
|
|
1542
|
+
maxWidth: "100%",
|
|
1543
|
+
marginTop: "1rem"
|
|
1544
|
+
},
|
|
1545
|
+
id: field.name + "modal",
|
|
1546
|
+
rows: 8,
|
|
1547
|
+
name: field.name + "modal",
|
|
1548
|
+
value: textareaValue,
|
|
1549
|
+
onChange: (e) => {
|
|
1550
|
+
setTextareaValue(e.target.value);
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
) }),
|
|
1554
|
+
/* @__PURE__ */ jsxs14(EDS.Actions, { style: { display: "flex", gap: "1rem" }, children: [
|
|
1596
1555
|
/* @__PURE__ */ jsx27(
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1556
|
+
Button5,
|
|
1557
|
+
{
|
|
1558
|
+
onClick: () => {
|
|
1559
|
+
closeDialog();
|
|
1560
|
+
onChange(textareaValue);
|
|
1561
|
+
onChangeFromProps?.(textareaValue);
|
|
1562
|
+
},
|
|
1563
|
+
children: "Submit"
|
|
1564
|
+
}
|
|
1603
1565
|
),
|
|
1604
|
-
/* @__PURE__ */ jsx27(
|
|
1605
|
-
|
|
1606
|
-
}
|
|
1607
|
-
),
|
|
1608
|
-
/* @__PURE__ */ jsxs14(
|
|
1609
|
-
EDS,
|
|
1610
|
-
{
|
|
1611
|
-
open,
|
|
1612
|
-
onClose: () => {
|
|
1613
|
-
closeDialog();
|
|
1614
|
-
onChange(textareaValue);
|
|
1615
|
-
onChangeFromProps == null ? void 0 : onChangeFromProps(textareaValue);
|
|
1616
|
-
},
|
|
1617
|
-
isDismissable: true,
|
|
1618
|
-
style: { width: "min(50rem, calc(100vw - 4rem))" },
|
|
1619
|
-
children: [
|
|
1620
|
-
/* @__PURE__ */ jsx27(EDS.Header, { children: /* @__PURE__ */ jsx27(EDS.Title, { children: title }) }),
|
|
1621
|
-
/* @__PURE__ */ jsx27(EDS.Content, { children: /* @__PURE__ */ jsx27(
|
|
1622
|
-
Textarea,
|
|
1566
|
+
/* @__PURE__ */ jsx27(
|
|
1567
|
+
Button5,
|
|
1623
1568
|
{
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1569
|
+
variant: "ghost",
|
|
1570
|
+
onClick: () => {
|
|
1571
|
+
closeDialog();
|
|
1572
|
+
setTextareaValue(context.getValue());
|
|
1627
1573
|
},
|
|
1628
|
-
|
|
1629
|
-
rows: 8,
|
|
1630
|
-
name: field.name + "modal",
|
|
1631
|
-
value: textareaValue,
|
|
1632
|
-
onChange: (e) => {
|
|
1633
|
-
setTextareaValue(e.target.value);
|
|
1634
|
-
}
|
|
1574
|
+
children: "Cancel"
|
|
1635
1575
|
}
|
|
1636
|
-
)
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
closeDialog();
|
|
1643
|
-
onChange(textareaValue);
|
|
1644
|
-
onChangeFromProps == null ? void 0 : onChangeFromProps(textareaValue);
|
|
1645
|
-
},
|
|
1646
|
-
children: "Submit"
|
|
1647
|
-
}
|
|
1648
|
-
),
|
|
1649
|
-
/* @__PURE__ */ jsx27(
|
|
1650
|
-
Button5,
|
|
1651
|
-
{
|
|
1652
|
-
variant: "ghost",
|
|
1653
|
-
onClick: () => {
|
|
1654
|
-
closeDialog();
|
|
1655
|
-
setTextareaValue(context.getValue());
|
|
1656
|
-
},
|
|
1657
|
-
children: "Cancel"
|
|
1658
|
-
}
|
|
1659
|
-
)
|
|
1660
|
-
] })
|
|
1661
|
-
]
|
|
1662
|
-
}
|
|
1663
|
-
)
|
|
1664
|
-
] });
|
|
1665
|
-
}
|
|
1576
|
+
)
|
|
1577
|
+
] })
|
|
1578
|
+
]
|
|
1579
|
+
}
|
|
1580
|
+
)
|
|
1581
|
+
] })
|
|
1666
1582
|
}
|
|
1667
1583
|
);
|
|
1668
1584
|
}
|
|
@@ -1687,12 +1603,10 @@ import { TextField as TextField4 } from "@equinor/eds-core-react";
|
|
|
1687
1603
|
import { Controller as Controller6 } from "react-hook-form";
|
|
1688
1604
|
import styled20 from "styled-components";
|
|
1689
1605
|
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
1690
|
-
function EditableTextFieldCell(
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
"error"
|
|
1695
|
-
]);
|
|
1606
|
+
function EditableTextFieldCell({
|
|
1607
|
+
error: errorFromProps,
|
|
1608
|
+
...context
|
|
1609
|
+
}) {
|
|
1696
1610
|
const editMode = useEditMode();
|
|
1697
1611
|
if (!editMode)
|
|
1698
1612
|
return /* @__PURE__ */ jsx28(TypographyCustom, { truncate: true, children: context.getValue() });
|
|
@@ -1700,17 +1614,16 @@ function EditableTextFieldCell(_a) {
|
|
|
1700
1614
|
Controller6,
|
|
1701
1615
|
{
|
|
1702
1616
|
name: context.column.id,
|
|
1703
|
-
render: (
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
}
|
|
1617
|
+
render: ({ field: { value, ...field }, fieldState: { error } }) => /* @__PURE__ */ jsx28(
|
|
1618
|
+
InlineTextField3,
|
|
1619
|
+
{
|
|
1620
|
+
id: context.column.id,
|
|
1621
|
+
autoComplete: "none",
|
|
1622
|
+
value: String(value ?? ""),
|
|
1623
|
+
...field,
|
|
1624
|
+
...getHelperTextProps({ error: errorFromProps ?? error })
|
|
1625
|
+
}
|
|
1626
|
+
)
|
|
1714
1627
|
}
|
|
1715
1628
|
);
|
|
1716
1629
|
}
|