@equinor/apollo-components 3.1.8 → 3.2.0-beta.1
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.ts +49 -8
- package/dist/index.js +811 -739
- package/dist/index.mjs +785 -714
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -1,10 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
+
var __defProps = Object.defineProperties;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
7
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
9
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
10
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
+
var __spreadValues = (a, b) => {
|
|
14
|
+
for (var prop in b || (b = {}))
|
|
15
|
+
if (__hasOwnProp.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
if (__getOwnPropSymbols)
|
|
18
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
+
if (__propIsEnum.call(b, prop))
|
|
20
|
+
__defNormalProp(a, prop, b[prop]);
|
|
21
|
+
}
|
|
22
|
+
return a;
|
|
23
|
+
};
|
|
24
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
+
var __objRest = (source, exclude) => {
|
|
26
|
+
var target = {};
|
|
27
|
+
for (var prop in source)
|
|
28
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
if (source != null && __getOwnPropSymbols)
|
|
31
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
+
target[prop] = source[prop];
|
|
34
|
+
}
|
|
35
|
+
return target;
|
|
36
|
+
};
|
|
8
37
|
var __commonJS = (cb, mod) => function __require() {
|
|
9
38
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
39
|
};
|
|
@@ -21,6 +50,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
21
50
|
return to;
|
|
22
51
|
};
|
|
23
52
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
53
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
54
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
55
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
56
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
57
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
58
|
mod
|
|
26
59
|
));
|
|
@@ -1013,7 +1046,11 @@ var require_arrayLikeKeys = __commonJS({
|
|
|
1013
1046
|
function arrayLikeKeys(value, inherited) {
|
|
1014
1047
|
var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
|
|
1015
1048
|
for (var key in value) {
|
|
1016
|
-
if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes &&
|
|
1049
|
+
if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
1050
|
+
(key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
1051
|
+
isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
1052
|
+
isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
|
|
1053
|
+
isIndex(key, length)))) {
|
|
1017
1054
|
result.push(key);
|
|
1018
1055
|
}
|
|
1019
1056
|
}
|
|
@@ -2337,6 +2374,7 @@ var src_exports = {};
|
|
|
2337
2374
|
__export(src_exports, {
|
|
2338
2375
|
AppShell: () => AppShell,
|
|
2339
2376
|
AppSidebar: () => AppSidebar,
|
|
2377
|
+
CheckboxCell: () => CheckboxCell,
|
|
2340
2378
|
ChipsCell: () => ChipsCell,
|
|
2341
2379
|
ColumnSelect: () => ColumnSelect,
|
|
2342
2380
|
DataTable: () => DataTable,
|
|
@@ -2389,33 +2427,16 @@ var Wrapper = import_styled_components.default.div`
|
|
|
2389
2427
|
max-width: 100%;
|
|
2390
2428
|
}
|
|
2391
2429
|
`;
|
|
2392
|
-
var AppShell = ({ children, icon, title, sidebar }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Wrapper, {
|
|
2393
|
-
children: [
|
|
2394
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_eds_core_react.
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
children: title ?? "App Title"
|
|
2403
|
-
})
|
|
2404
|
-
]
|
|
2405
|
-
})
|
|
2406
|
-
}),
|
|
2407
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
2408
|
-
className: "--content-wrapper",
|
|
2409
|
-
children: [
|
|
2410
|
-
sidebar,
|
|
2411
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
2412
|
-
className: "--content-outlet",
|
|
2413
|
-
children
|
|
2414
|
-
})
|
|
2415
|
-
]
|
|
2416
|
-
})
|
|
2417
|
-
]
|
|
2418
|
-
});
|
|
2430
|
+
var AppShell = ({ children, icon, title, sidebar }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Wrapper, { children: [
|
|
2431
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_eds_core_react.TopBar, { sticky: false, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_eds_core_react.TopBar.Header, { children: [
|
|
2432
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_eds_core_react.Icon, { data: icon != null ? icon : import_eds_icons.apps }),
|
|
2433
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: title != null ? title : "App Title" })
|
|
2434
|
+
] }) }),
|
|
2435
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "--content-wrapper", children: [
|
|
2436
|
+
sidebar,
|
|
2437
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "--content-outlet", children })
|
|
2438
|
+
] })
|
|
2439
|
+
] });
|
|
2419
2440
|
|
|
2420
2441
|
// src/AppShell/AppSidebar.tsx
|
|
2421
2442
|
var import_eds_core_react2 = require("@equinor/eds-core-react");
|
|
@@ -2452,25 +2473,34 @@ var Wrapper2 = import_styled_components2.default.div`
|
|
|
2452
2473
|
`;
|
|
2453
2474
|
function AppSidebar() {
|
|
2454
2475
|
const [collapsed, setCollapsed] = (0, import_react.useState)(false);
|
|
2455
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Wrapper2, {
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
className: "collapse-button
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
children:
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2476
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Wrapper2, { collapsed, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "collapse-button-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
2477
|
+
import_eds_core_react2.Button,
|
|
2478
|
+
{
|
|
2479
|
+
className: "collapse-button",
|
|
2480
|
+
variant: collapsed ? "ghost_icon" : "ghost",
|
|
2481
|
+
onClick: () => setCollapsed(!collapsed),
|
|
2482
|
+
children: [
|
|
2483
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_eds_core_react2.Icon, { data: collapsed ? import_eds_icons2.last_page : import_eds_icons2.first_page }),
|
|
2484
|
+
!collapsed && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { children: "Collapse" })
|
|
2485
|
+
]
|
|
2486
|
+
}
|
|
2487
|
+
) }) });
|
|
2488
|
+
}
|
|
2489
|
+
|
|
2490
|
+
// src/cells/CheckboxCell.tsx
|
|
2491
|
+
var import_eds_core_react3 = require("@equinor/eds-core-react");
|
|
2492
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
2493
|
+
function CheckboxCell(context) {
|
|
2494
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2495
|
+
import_eds_core_react3.Checkbox,
|
|
2496
|
+
{
|
|
2497
|
+
enterKeyHint: "next",
|
|
2498
|
+
"aria-label": "readonly",
|
|
2499
|
+
readOnly: true,
|
|
2500
|
+
checked: context.getValue(),
|
|
2501
|
+
disabled: true
|
|
2502
|
+
}
|
|
2503
|
+
);
|
|
2474
2504
|
}
|
|
2475
2505
|
|
|
2476
2506
|
// src/cells/ChipsCell.tsx
|
|
@@ -2494,7 +2524,7 @@ function stopPropagation(handler) {
|
|
|
2494
2524
|
}
|
|
2495
2525
|
|
|
2496
2526
|
// src/cells/ChipsCell.tsx
|
|
2497
|
-
var
|
|
2527
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
2498
2528
|
var ChipsWrapper = import_styled_components3.default.div`
|
|
2499
2529
|
display: flex;
|
|
2500
2530
|
align-items: center;
|
|
@@ -2508,26 +2538,24 @@ var Chip = import_styled_components3.default.div`
|
|
|
2508
2538
|
line-height: 22px;
|
|
2509
2539
|
height: 22px;
|
|
2510
2540
|
padding: 0 6px;
|
|
2511
|
-
background-color: ${(props) =>
|
|
2541
|
+
background-color: ${(props) => {
|
|
2542
|
+
var _a;
|
|
2543
|
+
return (_a = props.backgroundColor) != null ? _a : import_eds_tokens2.tokens.colors.ui.background__medium.hex;
|
|
2544
|
+
}};
|
|
2512
2545
|
color: darkslategrey;
|
|
2513
2546
|
`;
|
|
2514
2547
|
var ChipsCell = (props) => {
|
|
2515
2548
|
var _a;
|
|
2516
|
-
return /* @__PURE__ */ (0,
|
|
2517
|
-
children: (_a = props.values) == null ? void 0 : _a.map((value) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Chip, {
|
|
2518
|
-
backgroundColor: stringToHslColor(value),
|
|
2519
|
-
children: value
|
|
2520
|
-
}, value))
|
|
2521
|
-
});
|
|
2549
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ChipsWrapper, { children: (_a = props.values) == null ? void 0 : _a.map((value) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Chip, { backgroundColor: stringToHslColor(value), children: value }, value)) });
|
|
2522
2550
|
};
|
|
2523
2551
|
|
|
2524
2552
|
// src/cells/DynamicCell.tsx
|
|
2525
|
-
var
|
|
2553
|
+
var import_eds_core_react5 = require("@equinor/eds-core-react");
|
|
2526
2554
|
var import_react_table = require("@tanstack/react-table");
|
|
2527
2555
|
var import_styled_components5 = __toESM(require("styled-components"));
|
|
2528
2556
|
|
|
2529
2557
|
// src/cells/StickyCell.tsx
|
|
2530
|
-
var
|
|
2558
|
+
var import_eds_core_react4 = require("@equinor/eds-core-react");
|
|
2531
2559
|
var import_styled_components4 = __toESM(require("styled-components"));
|
|
2532
2560
|
var leftCellShadow = import_styled_components4.css`
|
|
2533
2561
|
&:before {
|
|
@@ -2540,7 +2568,7 @@ var leftCellShadow = import_styled_components4.css`
|
|
|
2540
2568
|
width: 1px;
|
|
2541
2569
|
}
|
|
2542
2570
|
`;
|
|
2543
|
-
var StickyCell = (0, import_styled_components4.default)(
|
|
2571
|
+
var StickyCell = (0, import_styled_components4.default)(import_eds_core_react4.Table.Cell)`
|
|
2544
2572
|
position: sticky;
|
|
2545
2573
|
right: 0;
|
|
2546
2574
|
top: 0;
|
|
@@ -2553,43 +2581,59 @@ var StickyHeaderCell = (0, import_styled_components4.default)(StickyCell)`
|
|
|
2553
2581
|
`;
|
|
2554
2582
|
|
|
2555
2583
|
// src/cells/DynamicCell.tsx
|
|
2556
|
-
var
|
|
2584
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
2557
2585
|
var StyledStickyCell = (0, import_styled_components5.default)(StickyCell)`
|
|
2558
2586
|
background-color: ${({ backgroundColor: bg }) => bg ? `${bg} !important` : `inherit`};
|
|
2559
2587
|
`;
|
|
2560
|
-
var StyledCell = (0, import_styled_components5.default)(
|
|
2588
|
+
var StyledCell = (0, import_styled_components5.default)(import_eds_core_react5.Table.Cell)`
|
|
2561
2589
|
background-color: ${({ backgroundColor: bg }) => bg ? `${bg} !important` : `inherit`};
|
|
2562
2590
|
`;
|
|
2563
2591
|
function DynamicCell({ cell, highlight, getStickyCellColor }) {
|
|
2564
2592
|
var _a;
|
|
2565
2593
|
const cellContent = (0, import_react_table.flexRender)(cell.column.columnDef.cell, cell.getContext());
|
|
2566
2594
|
if ((_a = cell.column.columnDef.meta) == null ? void 0 : _a.sticky) {
|
|
2567
|
-
return /* @__PURE__ */ (0,
|
|
2568
|
-
backgroundColor: getStickyCellColor == null ? void 0 : getStickyCellColor(cell),
|
|
2569
|
-
"data-column": cell.column.id,
|
|
2570
|
-
children: cellContent
|
|
2571
|
-
});
|
|
2595
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(StyledStickyCell, { backgroundColor: getStickyCellColor == null ? void 0 : getStickyCellColor(cell), "data-column": cell.column.id, children: cellContent });
|
|
2572
2596
|
}
|
|
2573
|
-
return /* @__PURE__ */ (0,
|
|
2574
|
-
"data-column": cell.column.id,
|
|
2575
|
-
backgroundColor: highlight ? "#d5eaf4" : void 0,
|
|
2576
|
-
children: cellContent
|
|
2577
|
-
});
|
|
2597
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(StyledCell, { "data-column": cell.column.id, backgroundColor: highlight ? "#d5eaf4" : void 0, children: cellContent });
|
|
2578
2598
|
}
|
|
2579
2599
|
|
|
2580
2600
|
// src/cells/HeaderCell.tsx
|
|
2581
|
-
var
|
|
2601
|
+
var import_eds_core_react6 = require("@equinor/eds-core-react");
|
|
2582
2602
|
var import_eds_icons3 = require("@equinor/eds-icons");
|
|
2603
|
+
var import_eds_tokens3 = require("@equinor/eds-tokens");
|
|
2583
2604
|
var import_react_table2 = require("@tanstack/react-table");
|
|
2584
2605
|
var import_styled_components6 = __toESM(require("styled-components"));
|
|
2585
|
-
var
|
|
2586
|
-
var
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2606
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
2607
|
+
var resizeCellStyle = import_styled_components6.css`
|
|
2608
|
+
.resizer {
|
|
2609
|
+
position: absolute;
|
|
2610
|
+
right: 0;
|
|
2611
|
+
top: 0;
|
|
2612
|
+
height: 100%;
|
|
2613
|
+
width: 4px;
|
|
2614
|
+
opacity: 0;
|
|
2615
|
+
background: #aaa;
|
|
2616
|
+
cursor: col-resize;
|
|
2617
|
+
user-select: none;
|
|
2618
|
+
touch-action: none;
|
|
2619
|
+
}
|
|
2620
|
+
|
|
2621
|
+
.resizer.isResizing {
|
|
2622
|
+
background: ${import_eds_tokens3.tokens.colors.interactive.focus.hex};
|
|
2623
|
+
opacity: 1;
|
|
2624
|
+
}
|
|
2625
|
+
|
|
2626
|
+
&:hover .resizer {
|
|
2627
|
+
opacity: 1;
|
|
2628
|
+
}
|
|
2629
|
+
`;
|
|
2630
|
+
var StickyCell2 = (0, import_styled_components6.default)(StickyHeaderCell)`
|
|
2631
|
+
${resizeCellStyle}
|
|
2591
2632
|
`;
|
|
2592
|
-
var
|
|
2633
|
+
var Cell2 = (0, import_styled_components6.default)(import_eds_core_react6.Table.Cell)`
|
|
2634
|
+
${resizeCellStyle}
|
|
2635
|
+
`;
|
|
2636
|
+
var HeaderCell = ({ header, table }) => {
|
|
2593
2637
|
var _a;
|
|
2594
2638
|
const style = {
|
|
2595
2639
|
width: header.column.getSize(),
|
|
@@ -2602,39 +2646,40 @@ var HeaderCell = ({ header }) => {
|
|
|
2602
2646
|
colSpan: header.colSpan
|
|
2603
2647
|
};
|
|
2604
2648
|
if ((_a = header.column.columnDef.meta) == null ? void 0 : _a.sticky) {
|
|
2605
|
-
return /* @__PURE__ */ (0,
|
|
2606
|
-
...cellProps,
|
|
2607
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(HeaderContent, {
|
|
2608
|
-
header
|
|
2609
|
-
})
|
|
2610
|
-
}, header.id);
|
|
2649
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(StickyCell2, __spreadProps(__spreadValues({}, cellProps), { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(HeaderContent, { header, table }) }), header.id);
|
|
2611
2650
|
}
|
|
2612
|
-
return /* @__PURE__ */ (0,
|
|
2613
|
-
...cellProps,
|
|
2614
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(HeaderContent, {
|
|
2615
|
-
header
|
|
2616
|
-
})
|
|
2617
|
-
}, header.id);
|
|
2651
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Cell2, __spreadProps(__spreadValues({}, cellProps), { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(HeaderContent, { header, table }) }), header.id);
|
|
2618
2652
|
};
|
|
2619
|
-
|
|
2653
|
+
var HeaderDiv = import_styled_components6.default.div`
|
|
2654
|
+
display: flex;
|
|
2655
|
+
align-items: center;
|
|
2656
|
+
gap: 0.25rem;
|
|
2657
|
+
z-index: 5;
|
|
2658
|
+
`;
|
|
2659
|
+
function HeaderContent({ header, table }) {
|
|
2660
|
+
var _a;
|
|
2620
2661
|
if (header.isPlaceholder)
|
|
2621
2662
|
return null;
|
|
2622
|
-
return /* @__PURE__ */ (0,
|
|
2623
|
-
|
|
2624
|
-
|
|
2663
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(HeaderDiv, { children: [
|
|
2664
|
+
(0, import_react_table2.flexRender)(header.column.columnDef.header, header.getContext()),
|
|
2665
|
+
(_a = {
|
|
2666
|
+
asc: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_eds_core_react6.Icon, { data: import_eds_icons3.arrow_drop_up }),
|
|
2667
|
+
desc: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_eds_core_react6.Icon, { data: import_eds_icons3.arrow_drop_down }),
|
|
2668
|
+
none: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_eds_core_react6.Icon, { data: import_eds_icons3.arrow_drop_down })
|
|
2669
|
+
}[header.column.getIsSorted()]) != null ? _a : null,
|
|
2670
|
+
table.options.enableColumnResizing && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2671
|
+
"div",
|
|
2625
2672
|
{
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
]
|
|
2637
|
-
});
|
|
2673
|
+
onMouseDown: header.getResizeHandler(),
|
|
2674
|
+
onTouchStart: header.getResizeHandler(),
|
|
2675
|
+
onClick: (e) => e.stopPropagation(),
|
|
2676
|
+
className: `resizer ${header.column.getIsResizing() ? "isResizing" : ""}`,
|
|
2677
|
+
style: {
|
|
2678
|
+
transform: table.options.columnResizeMode === "onEnd" && header.column.getIsResizing() ? `translateX(${table.getState().columnSizingInfo.deltaOffset}px)` : ""
|
|
2679
|
+
}
|
|
2680
|
+
}
|
|
2681
|
+
)
|
|
2682
|
+
] });
|
|
2638
2683
|
}
|
|
2639
2684
|
function getSort({ column }) {
|
|
2640
2685
|
if (!column.getCanSort())
|
|
@@ -2650,46 +2695,39 @@ function getSort({ column }) {
|
|
|
2650
2695
|
}
|
|
2651
2696
|
|
|
2652
2697
|
// src/cells/HierarchyCell.tsx
|
|
2653
|
-
var
|
|
2698
|
+
var import_eds_tokens5 = require("@equinor/eds-tokens");
|
|
2654
2699
|
var import_styled_components8 = __toESM(require("styled-components"));
|
|
2655
2700
|
|
|
2656
2701
|
// src/cells/TypographyCustom.tsx
|
|
2657
|
-
var
|
|
2658
|
-
var
|
|
2702
|
+
var import_eds_core_react7 = require("@equinor/eds-core-react");
|
|
2703
|
+
var import_eds_tokens4 = require("@equinor/eds-tokens");
|
|
2659
2704
|
var import_styled_components7 = __toESM(require("styled-components"));
|
|
2660
|
-
var
|
|
2705
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
2661
2706
|
var truncateStyle = {
|
|
2662
2707
|
overflow: "hidden",
|
|
2663
2708
|
whiteSpace: "nowrap",
|
|
2664
2709
|
textOverflow: "ellipsis"
|
|
2665
2710
|
};
|
|
2666
2711
|
var TypographyCustom = (props) => {
|
|
2667
|
-
const { truncate, enableShowAllOnHover, style: styleFromProps,
|
|
2712
|
+
const _a = props, { truncate, enableShowAllOnHover, style: styleFromProps } = _a, edsTypographyProps = __objRest(_a, ["truncate", "enableShowAllOnHover", "style"]);
|
|
2668
2713
|
if (enableShowAllOnHover)
|
|
2669
|
-
return /* @__PURE__ */ (0,
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
style: {
|
|
2673
|
-
...styleFromProps,
|
|
2674
|
-
...truncateStyle
|
|
2675
|
-
}
|
|
2714
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(HoverCapture, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2715
|
+
import_eds_core_react7.Typography,
|
|
2716
|
+
__spreadProps(__spreadValues({}, edsTypographyProps), {
|
|
2717
|
+
style: __spreadValues(__spreadValues({}, styleFromProps), truncateStyle)
|
|
2676
2718
|
})
|
|
2677
|
-
});
|
|
2719
|
+
) });
|
|
2678
2720
|
if (truncate)
|
|
2679
|
-
return /* @__PURE__ */ (0,
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_eds_core_react6.Typography, {
|
|
2687
|
-
...edsTypographyProps,
|
|
2688
|
-
style: styleFromProps
|
|
2689
|
-
});
|
|
2721
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2722
|
+
import_eds_core_react7.Typography,
|
|
2723
|
+
__spreadProps(__spreadValues({}, edsTypographyProps), {
|
|
2724
|
+
style: __spreadValues(__spreadValues({}, styleFromProps), truncateStyle)
|
|
2725
|
+
})
|
|
2726
|
+
);
|
|
2727
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_eds_core_react7.Typography, __spreadProps(__spreadValues({}, edsTypographyProps), { style: styleFromProps }));
|
|
2690
2728
|
};
|
|
2691
2729
|
var HoverCapture = import_styled_components7.default.div`
|
|
2692
|
-
height: ${
|
|
2730
|
+
height: ${import_eds_tokens4.tokens.typography.table.cell_text.lineHeight};
|
|
2693
2731
|
background-color: inherit;
|
|
2694
2732
|
|
|
2695
2733
|
position: relative;
|
|
@@ -2715,7 +2753,7 @@ var HoverCapture = import_styled_components7.default.div`
|
|
|
2715
2753
|
`;
|
|
2716
2754
|
|
|
2717
2755
|
// src/cells/HierarchyCell.tsx
|
|
2718
|
-
var
|
|
2756
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
2719
2757
|
var CellWrapper = (0, import_styled_components8.default)(TypographyCustom)`
|
|
2720
2758
|
height: 100%;
|
|
2721
2759
|
display: flex;
|
|
@@ -2724,50 +2762,54 @@ var CellWrapper = (0, import_styled_components8.default)(TypographyCustom)`
|
|
|
2724
2762
|
${({ depth, expanded }) => expanded && depth === 0 && "font-weight: bold;"}
|
|
2725
2763
|
|
|
2726
2764
|
${({ depth }) => depth > 0 && import_styled_components8.css`
|
|
2727
|
-
border-left: 3px solid ${
|
|
2765
|
+
border-left: 3px solid ${import_eds_tokens5.tokens.colors.infographic.primary__moss_green_34.hex};
|
|
2728
2766
|
gap: 0.5rem;
|
|
2729
2767
|
.--divider {
|
|
2730
2768
|
width: ${depth * 32}px;
|
|
2731
|
-
background-color: ${
|
|
2769
|
+
background-color: ${import_eds_tokens5.tokens.colors.infographic.primary__moss_green_34.hex};
|
|
2732
2770
|
height: 3px;
|
|
2733
2771
|
border-radius: 0 5px 5px 0;
|
|
2734
2772
|
}
|
|
2735
2773
|
`}
|
|
2736
2774
|
`;
|
|
2737
2775
|
function HierarchyCell(cell, options = {}) {
|
|
2738
|
-
var _a, _b;
|
|
2739
|
-
return /* @__PURE__ */ (0,
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2776
|
+
var _a, _b, _c, _d;
|
|
2777
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
2778
|
+
CellWrapper,
|
|
2779
|
+
{
|
|
2780
|
+
depth: (_b = (_a = options.getRowDepth) == null ? void 0 : _a.call(options)) != null ? _b : cell.row.depth,
|
|
2781
|
+
expanded: cell.row.getIsExpanded(),
|
|
2782
|
+
children: [
|
|
2783
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "--divider" }),
|
|
2784
|
+
(_d = (_c = options.getDisplayName) == null ? void 0 : _c.call(options)) != null ? _d : cell.getValue()
|
|
2785
|
+
]
|
|
2786
|
+
}
|
|
2787
|
+
);
|
|
2749
2788
|
}
|
|
2750
2789
|
|
|
2751
2790
|
// src/cells/PopoverCell.tsx
|
|
2752
|
-
var
|
|
2791
|
+
var import_eds_core_react8 = require("@equinor/eds-core-react");
|
|
2753
2792
|
var import_react2 = require("react");
|
|
2754
|
-
var
|
|
2793
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
2755
2794
|
function PopoverCell(props) {
|
|
2795
|
+
var _a, _b;
|
|
2756
2796
|
const [open, setOpen] = (0, import_react2.useState)(false);
|
|
2757
2797
|
const anchorRef = (0, import_react2.useRef)(null);
|
|
2758
2798
|
const handleClick = () => setOpen(!open);
|
|
2759
2799
|
const handleClose = () => setOpen(false);
|
|
2760
|
-
return /* @__PURE__ */ (0,
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(TypographyCustom, {
|
|
2800
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { style: { position: "relative" }, ref: anchorRef, children: [
|
|
2801
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2802
|
+
TypographyCustom,
|
|
2803
|
+
{
|
|
2765
2804
|
onClick: stopPropagation(handleClick),
|
|
2766
2805
|
style: { cursor: "pointer" },
|
|
2767
2806
|
truncate: true,
|
|
2768
|
-
children: String(props.value)
|
|
2769
|
-
}
|
|
2770
|
-
|
|
2807
|
+
children: String((_a = props.value) != null ? _a : "")
|
|
2808
|
+
}
|
|
2809
|
+
),
|
|
2810
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2811
|
+
import_eds_core_react8.Popover,
|
|
2812
|
+
{
|
|
2771
2813
|
id: props.id,
|
|
2772
2814
|
open,
|
|
2773
2815
|
"aria-controls": "expand cell",
|
|
@@ -2775,27 +2817,19 @@ function PopoverCell(props) {
|
|
|
2775
2817
|
onClose: handleClose,
|
|
2776
2818
|
placement: "bottom",
|
|
2777
2819
|
children: [
|
|
2778
|
-
props.title && /* @__PURE__ */ (0,
|
|
2779
|
-
|
|
2780
|
-
children: props.title
|
|
2781
|
-
})
|
|
2782
|
-
}),
|
|
2783
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_eds_core_react7.Popover.Content, {
|
|
2784
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_eds_core_react7.Typography, {
|
|
2785
|
-
children: String(props.value)
|
|
2786
|
-
})
|
|
2787
|
-
})
|
|
2820
|
+
props.title && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_eds_core_react8.Popover.Title, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_eds_core_react8.Popover.Header, { children: props.title }) }),
|
|
2821
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_eds_core_react8.Popover.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_eds_core_react8.Typography, { children: String((_b = props.value) != null ? _b : "") }) })
|
|
2788
2822
|
]
|
|
2789
|
-
}
|
|
2790
|
-
|
|
2791
|
-
});
|
|
2823
|
+
}
|
|
2824
|
+
)
|
|
2825
|
+
] });
|
|
2792
2826
|
}
|
|
2793
2827
|
|
|
2794
2828
|
// src/cells/SelectColumnDef.tsx
|
|
2795
|
-
var
|
|
2829
|
+
var import_eds_core_react9 = require("@equinor/eds-core-react");
|
|
2796
2830
|
var import_eds_icons4 = require("@equinor/eds-icons");
|
|
2797
2831
|
var import_styled_components9 = __toESM(require("styled-components"));
|
|
2798
|
-
var
|
|
2832
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
2799
2833
|
var CellWrapper2 = import_styled_components9.default.div`
|
|
2800
2834
|
display: flex;
|
|
2801
2835
|
align-items: center;
|
|
@@ -2808,50 +2842,52 @@ function SelectColumnDef(props) {
|
|
|
2808
2842
|
return {
|
|
2809
2843
|
id: "select",
|
|
2810
2844
|
size: props.includeExpansionButton ? 96 : 48,
|
|
2811
|
-
header: ({ table }) => selectionMode !== "single" ? /* @__PURE__ */ (0,
|
|
2812
|
-
|
|
2845
|
+
header: ({ table }) => selectionMode !== "single" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CellWrapper2, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2846
|
+
import_eds_core_react9.Checkbox,
|
|
2847
|
+
{
|
|
2813
2848
|
checked: table.getIsAllRowsSelected(),
|
|
2814
2849
|
indeterminate: table.getIsSomeRowsSelected(),
|
|
2815
2850
|
"aria-label": table.getIsAllRowsSelected() ? "Deselect all rows" : "Select all rows",
|
|
2816
2851
|
onChange: table.getIsSomeRowsSelected() ? () => table.toggleAllRowsSelected(false) : table.getToggleAllRowsSelectedHandler()
|
|
2817
|
-
}
|
|
2818
|
-
}) : null,
|
|
2852
|
+
}
|
|
2853
|
+
) }) : null,
|
|
2819
2854
|
cell: ({ table, row }) => {
|
|
2820
2855
|
const paddingLeft = "0px";
|
|
2821
|
-
return /* @__PURE__ */ (0,
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
}
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2856
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CellWrapper2, { paddingLeft, rowDepth: row.depth, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
2857
|
+
selectionMode === "single" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2858
|
+
import_eds_core_react9.Radio,
|
|
2859
|
+
{
|
|
2860
|
+
checked: row.getIsSelected(),
|
|
2861
|
+
"aria-label": `Select row ${row.id}`,
|
|
2862
|
+
onChange: stopPropagation(row.getToggleSelectedHandler())
|
|
2863
|
+
}
|
|
2864
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2865
|
+
import_eds_core_react9.Checkbox,
|
|
2866
|
+
{
|
|
2867
|
+
checked: row.getIsSelected(),
|
|
2868
|
+
indeterminate: row.getIsSomeSelected(),
|
|
2869
|
+
"aria-label": `Select row ${row.id}`,
|
|
2870
|
+
onChange: stopPropagation(row.getToggleSelectedHandler())
|
|
2871
|
+
}
|
|
2872
|
+
),
|
|
2873
|
+
row.getCanExpand() && table.options.enableExpanding && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2874
|
+
import_eds_core_react9.Button,
|
|
2875
|
+
{
|
|
2876
|
+
variant: "ghost_icon",
|
|
2877
|
+
color: "secondary",
|
|
2878
|
+
"aria-label": row.getIsExpanded() ? "Close group" : "Expand group",
|
|
2879
|
+
onClick: stopPropagation(row.getToggleExpandedHandler()),
|
|
2880
|
+
style: { cursor: "pointer" },
|
|
2881
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_eds_core_react9.Icon, { data: row.getIsExpanded() ? import_eds_icons4.chevron_up : import_eds_icons4.chevron_down })
|
|
2882
|
+
}
|
|
2883
|
+
)
|
|
2884
|
+
] }) });
|
|
2849
2885
|
}
|
|
2850
2886
|
};
|
|
2851
2887
|
}
|
|
2852
2888
|
|
|
2853
2889
|
// src/DataTable/components/ColumnSelect.tsx
|
|
2854
|
-
var
|
|
2890
|
+
var import_eds_core_react10 = require("@equinor/eds-core-react");
|
|
2855
2891
|
var import_eds_icons5 = require("@equinor/eds-icons");
|
|
2856
2892
|
var import_react3 = require("react");
|
|
2857
2893
|
var import_styled_components10 = __toESM(require("styled-components"));
|
|
@@ -2886,7 +2922,7 @@ function getFunctionValueOrDefault(valueOrFn, fnProps, defaultValue) {
|
|
|
2886
2922
|
}
|
|
2887
2923
|
|
|
2888
2924
|
// src/DataTable/components/ColumnSelect.tsx
|
|
2889
|
-
var
|
|
2925
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
2890
2926
|
var ColumnSelectContent = import_styled_components10.default.div`
|
|
2891
2927
|
display: grid;
|
|
2892
2928
|
grid-template-columns: repeat(2, 1fr);
|
|
@@ -2902,92 +2938,76 @@ function ColumnSelect({ table }) {
|
|
|
2902
2938
|
const [isOpen, setIsOpen] = (0, import_react3.useState)(false);
|
|
2903
2939
|
const referenceElement = (0, import_react3.useRef)(null);
|
|
2904
2940
|
const selectableColumns = table.getAllLeafColumns().filter((column) => column.id !== "select");
|
|
2905
|
-
return /* @__PURE__ */ (0,
|
|
2906
|
-
children:
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
})
|
|
2923
|
-
}),
|
|
2924
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_eds_core_react9.Popover, {
|
|
2941
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
2942
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_eds_core_react10.Tooltip, { title: "Select columns", placement: "left", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2943
|
+
import_eds_core_react10.Button,
|
|
2944
|
+
{
|
|
2945
|
+
"aria-haspopup": true,
|
|
2946
|
+
id: "column-select-anchor",
|
|
2947
|
+
"aria-controls": "column-select-popover",
|
|
2948
|
+
"aria-expanded": isOpen,
|
|
2949
|
+
ref: referenceElement,
|
|
2950
|
+
variant: "ghost_icon",
|
|
2951
|
+
onClick: () => setIsOpen(true),
|
|
2952
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_eds_core_react10.Icon, { name: "view_column", data: import_eds_icons5.view_column })
|
|
2953
|
+
}
|
|
2954
|
+
) }),
|
|
2955
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
2956
|
+
import_eds_core_react10.Popover,
|
|
2957
|
+
{
|
|
2925
2958
|
open: isOpen,
|
|
2926
2959
|
id: "column-select-popover",
|
|
2927
2960
|
anchorEl: referenceElement.current,
|
|
2928
2961
|
placement: "bottom-end",
|
|
2929
2962
|
onClose: () => setIsOpen(false),
|
|
2930
2963
|
children: [
|
|
2931
|
-
/* @__PURE__ */ (0,
|
|
2932
|
-
children:
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_eds_core_react9.Button, {
|
|
2964
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_eds_core_react10.Popover.Header, { children: [
|
|
2965
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_eds_core_react10.Popover.Title, { children: "Column settings" }),
|
|
2966
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2967
|
+
import_eds_core_react10.Button,
|
|
2968
|
+
{
|
|
2937
2969
|
variant: "ghost_icon",
|
|
2938
2970
|
"aria-label": "Close column select",
|
|
2939
2971
|
onClick: () => setIsOpen(false),
|
|
2940
|
-
children: /* @__PURE__ */ (0,
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
children: "Reset to default"
|
|
2969
|
-
})
|
|
2970
|
-
})
|
|
2971
|
-
]
|
|
2972
|
-
})
|
|
2972
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_eds_core_react10.Icon, { name: "close", data: import_eds_icons5.close, size: 24 })
|
|
2973
|
+
}
|
|
2974
|
+
)
|
|
2975
|
+
] }),
|
|
2976
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_eds_core_react10.Popover.Content, { children: [
|
|
2977
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ColumnSelectContent, { children: selectableColumns.map((column) => {
|
|
2978
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2979
|
+
import_eds_core_react10.Checkbox,
|
|
2980
|
+
{
|
|
2981
|
+
checked: column.getIsVisible(),
|
|
2982
|
+
label: getColumnHeader(column),
|
|
2983
|
+
onChange: column.getToggleVisibilityHandler()
|
|
2984
|
+
},
|
|
2985
|
+
column.id
|
|
2986
|
+
);
|
|
2987
|
+
}) }),
|
|
2988
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_eds_core_react10.Divider, { variant: "small" }),
|
|
2989
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ActionsWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2990
|
+
import_eds_core_react10.Button,
|
|
2991
|
+
{
|
|
2992
|
+
color: "secondary",
|
|
2993
|
+
variant: "ghost",
|
|
2994
|
+
disabled: table.getIsAllColumnsVisible(),
|
|
2995
|
+
onClick: () => table.toggleAllColumnsVisible(true),
|
|
2996
|
+
children: "Reset to default"
|
|
2997
|
+
}
|
|
2998
|
+
) })
|
|
2999
|
+
] })
|
|
2973
3000
|
]
|
|
2974
|
-
}
|
|
2975
|
-
|
|
2976
|
-
});
|
|
3001
|
+
}
|
|
3002
|
+
)
|
|
3003
|
+
] });
|
|
2977
3004
|
}
|
|
2978
3005
|
|
|
2979
3006
|
// src/DataTable/components/TableHeader.tsx
|
|
2980
|
-
var
|
|
2981
|
-
var
|
|
3007
|
+
var import_eds_core_react11 = require("@equinor/eds-core-react");
|
|
3008
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2982
3009
|
function TableHeader({ table, sticky }) {
|
|
2983
|
-
return /* @__PURE__ */ (0,
|
|
2984
|
-
sticky,
|
|
2985
|
-
children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_eds_core_react10.Table.Row, {
|
|
2986
|
-
children: headerGroup.headers.map((header) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(HeaderCell, {
|
|
2987
|
-
header
|
|
2988
|
-
}, header.id))
|
|
2989
|
-
}, headerGroup.id))
|
|
2990
|
-
});
|
|
3010
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_eds_core_react11.Table.Head, { sticky, children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_eds_core_react11.Table.Row, { children: headerGroup.headers.map((header) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(HeaderCell, { header, table }, header.id)) }, headerGroup.id)) });
|
|
2991
3011
|
}
|
|
2992
3012
|
|
|
2993
3013
|
// src/DataTable/DataTable.tsx
|
|
@@ -2996,44 +3016,33 @@ var import_react7 = require("react");
|
|
|
2996
3016
|
var import_styled_components16 = __toESM(require("styled-components"));
|
|
2997
3017
|
|
|
2998
3018
|
// src/DataTable/components/BasicTable.tsx
|
|
2999
|
-
var
|
|
3019
|
+
var import_eds_core_react15 = require("@equinor/eds-core-react");
|
|
3000
3020
|
|
|
3001
3021
|
// src/DataTable/components/PlaceholderRow.tsx
|
|
3002
|
-
var
|
|
3022
|
+
var import_eds_core_react12 = require("@equinor/eds-core-react");
|
|
3003
3023
|
var import_styled_components11 = __toESM(require("styled-components"));
|
|
3004
|
-
var
|
|
3024
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
3005
3025
|
var PlaceholderTextWrapper = import_styled_components11.default.div`
|
|
3006
3026
|
display: flex;
|
|
3007
3027
|
justify-content: center;
|
|
3008
3028
|
`;
|
|
3009
3029
|
function PlaceholderRow({ isLoading }) {
|
|
3010
|
-
return /* @__PURE__ */ (0,
|
|
3011
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_eds_core_react11.Table.Cell, {
|
|
3012
|
-
colSpan: 100,
|
|
3013
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PlaceholderTextWrapper, {
|
|
3014
|
-
children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_eds_core_react11.DotProgress, {
|
|
3015
|
-
color: "primary"
|
|
3016
|
-
}) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_eds_core_react11.Typography, {
|
|
3017
|
-
children: "No data available"
|
|
3018
|
-
})
|
|
3019
|
-
})
|
|
3020
|
-
})
|
|
3021
|
-
});
|
|
3030
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_eds_core_react12.Table.Row, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_eds_core_react12.Table.Cell, { colSpan: 100, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(PlaceholderTextWrapper, { children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_eds_core_react12.DotProgress, { color: "primary" }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_eds_core_react12.Typography, { children: "No data available" }) }) }) });
|
|
3022
3031
|
}
|
|
3023
3032
|
|
|
3024
3033
|
// src/DataTable/components/TableBody.tsx
|
|
3025
|
-
var
|
|
3034
|
+
var import_eds_core_react13 = require("@equinor/eds-core-react");
|
|
3026
3035
|
var import_styled_components12 = __toESM(require("styled-components"));
|
|
3027
|
-
var TableBody = (0, import_styled_components12.default)(
|
|
3036
|
+
var TableBody = (0, import_styled_components12.default)(import_eds_core_react13.Table.Body)`
|
|
3028
3037
|
// The following attribute are important for fixed column width
|
|
3029
3038
|
// CHANGE THES WITH CAUTION
|
|
3030
3039
|
background: inherit;
|
|
3031
3040
|
`;
|
|
3032
3041
|
|
|
3033
3042
|
// src/DataTable/components/TableRow.tsx
|
|
3034
|
-
var
|
|
3043
|
+
var import_eds_core_react14 = require("@equinor/eds-core-react");
|
|
3035
3044
|
var import_styled_components13 = __toESM(require("styled-components"));
|
|
3036
|
-
var
|
|
3045
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
3037
3046
|
function TableRow({
|
|
3038
3047
|
row,
|
|
3039
3048
|
rowConfig,
|
|
@@ -3043,32 +3052,39 @@ function TableRow({
|
|
|
3043
3052
|
}) {
|
|
3044
3053
|
var _a;
|
|
3045
3054
|
const rowWrapper = rowConfig == null ? void 0 : rowConfig.rowWrapper;
|
|
3046
|
-
const tableRowContent = /* @__PURE__ */ (0,
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3055
|
+
const tableRowContent = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3056
|
+
StyledTableRow,
|
|
3057
|
+
{
|
|
3058
|
+
active: row.getIsSelected(),
|
|
3059
|
+
"data-index": index,
|
|
3060
|
+
ref: measureElement,
|
|
3061
|
+
style: {
|
|
3062
|
+
cursor: (rowConfig == null ? void 0 : rowConfig.onClick) ? "pointer" : "initial",
|
|
3063
|
+
backgroundColor: (_a = rowConfig == null ? void 0 : rowConfig.getRowBackground) == null ? void 0 : _a.call(rowConfig, row)
|
|
3064
|
+
},
|
|
3065
|
+
onClick: () => {
|
|
3066
|
+
var _a2;
|
|
3067
|
+
return (_a2 = rowConfig == null ? void 0 : rowConfig.onClick) == null ? void 0 : _a2.call(rowConfig, row);
|
|
3068
|
+
},
|
|
3069
|
+
onMouseEnter: handleRowEvent(row, rowConfig == null ? void 0 : rowConfig.onMouseEnter),
|
|
3070
|
+
onMouseLeave: handleRowEvent(row, rowConfig == null ? void 0 : rowConfig.onMouseLeave),
|
|
3071
|
+
children: row.getVisibleCells().map((cell) => {
|
|
3072
|
+
var _a2;
|
|
3073
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3074
|
+
DynamicCell,
|
|
3075
|
+
{
|
|
3076
|
+
cell,
|
|
3077
|
+
getStickyCellColor: cellConfig == null ? void 0 : cellConfig.getStickyCellColor,
|
|
3078
|
+
highlight: (_a2 = cellConfig == null ? void 0 : cellConfig.getShouldHighlight) == null ? void 0 : _a2.call(cellConfig, cell)
|
|
3079
|
+
},
|
|
3080
|
+
cell.id
|
|
3081
|
+
);
|
|
3082
|
+
})
|
|
3083
|
+
}
|
|
3084
|
+
);
|
|
3069
3085
|
return rowWrapper ? rowWrapper({ row, children: tableRowContent }) : tableRowContent;
|
|
3070
3086
|
}
|
|
3071
|
-
var StyledTableRow = (0, import_styled_components13.default)(
|
|
3087
|
+
var StyledTableRow = (0, import_styled_components13.default)(import_eds_core_react14.Table.Row)`
|
|
3072
3088
|
/* Background color must be inherited here. Does not work with inline styling */
|
|
3073
3089
|
${({ active }) => active ? "" : "background-color: inherit;"}
|
|
3074
3090
|
`;
|
|
@@ -3081,7 +3097,7 @@ function handleRowEvent(row, handler) {
|
|
|
3081
3097
|
}
|
|
3082
3098
|
|
|
3083
3099
|
// src/DataTable/components/BasicTable.tsx
|
|
3084
|
-
var
|
|
3100
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
3085
3101
|
function BasicTable({
|
|
3086
3102
|
table,
|
|
3087
3103
|
rowConfig,
|
|
@@ -3091,54 +3107,43 @@ function BasicTable({
|
|
|
3091
3107
|
tableCaption
|
|
3092
3108
|
}) {
|
|
3093
3109
|
const tableRows = table.getRowModel().rows;
|
|
3094
|
-
return /* @__PURE__ */ (0,
|
|
3095
|
-
children:
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
}),
|
|
3100
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TableHeader, {
|
|
3101
|
-
sticky: stickyHeader,
|
|
3102
|
-
table
|
|
3103
|
-
}),
|
|
3104
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TableBody, {
|
|
3105
|
-
children: tableRows.length ? tableRows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TableRow, {
|
|
3106
|
-
row,
|
|
3107
|
-
rowConfig,
|
|
3108
|
-
cellConfig
|
|
3109
|
-
}, row.id)) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PlaceholderRow, {
|
|
3110
|
-
isLoading
|
|
3111
|
-
})
|
|
3112
|
-
})
|
|
3113
|
-
]
|
|
3114
|
-
});
|
|
3110
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_eds_core_react15.Table, { children: [
|
|
3111
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_eds_core_react15.Table.Caption, { hidden: true, children: tableCaption }),
|
|
3112
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TableHeader, { sticky: stickyHeader, table }),
|
|
3113
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TableBody, { children: tableRows.length ? tableRows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TableRow, { row, rowConfig, cellConfig }, row.id)) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PlaceholderRow, { isLoading }) })
|
|
3114
|
+
] });
|
|
3115
3115
|
}
|
|
3116
3116
|
|
|
3117
3117
|
// src/DataTable/components/DataTableHeader.tsx
|
|
3118
|
-
var
|
|
3118
|
+
var import_eds_core_react17 = require("@equinor/eds-core-react");
|
|
3119
3119
|
var import_eds_icons7 = require("@equinor/eds-icons");
|
|
3120
3120
|
var import_styled_components15 = __toESM(require("styled-components"));
|
|
3121
3121
|
|
|
3122
3122
|
// src/DataTable/filters/DebouncedInput.tsx
|
|
3123
|
-
var
|
|
3123
|
+
var import_eds_core_react16 = require("@equinor/eds-core-react");
|
|
3124
3124
|
var import_eds_icons6 = require("@equinor/eds-icons");
|
|
3125
3125
|
var import_react4 = require("react");
|
|
3126
3126
|
var import_styled_components14 = __toESM(require("styled-components"));
|
|
3127
|
-
var
|
|
3127
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
3128
3128
|
var Wrapper3 = import_styled_components14.default.div`
|
|
3129
3129
|
width: 200px;
|
|
3130
3130
|
`;
|
|
3131
|
-
var CloseButton = (0, import_styled_components14.default)(
|
|
3131
|
+
var CloseButton = (0, import_styled_components14.default)(import_eds_core_react16.Button)`
|
|
3132
3132
|
width: 24px;
|
|
3133
3133
|
height: 24px;
|
|
3134
3134
|
`;
|
|
3135
|
-
function DebouncedInput({
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
}
|
|
3135
|
+
function DebouncedInput(_a) {
|
|
3136
|
+
var _b = _a, {
|
|
3137
|
+
value: initialValue,
|
|
3138
|
+
onChange,
|
|
3139
|
+
icon,
|
|
3140
|
+
debounce = 500
|
|
3141
|
+
} = _b, props = __objRest(_b, [
|
|
3142
|
+
"value",
|
|
3143
|
+
"onChange",
|
|
3144
|
+
"icon",
|
|
3145
|
+
"debounce"
|
|
3146
|
+
]);
|
|
3142
3147
|
const [value, setValue] = (0, import_react4.useState)(initialValue);
|
|
3143
3148
|
(0, import_react4.useEffect)(() => {
|
|
3144
3149
|
setValue(initialValue);
|
|
@@ -3149,30 +3154,15 @@ function DebouncedInput({
|
|
|
3149
3154
|
}, debounce);
|
|
3150
3155
|
return () => clearTimeout(timeout);
|
|
3151
3156
|
}, [value]);
|
|
3152
|
-
return /* @__PURE__ */ (0,
|
|
3153
|
-
|
|
3154
|
-
|
|
3157
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Wrapper3, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3158
|
+
import_eds_core_react16.Input,
|
|
3159
|
+
__spreadProps(__spreadValues({}, props), {
|
|
3155
3160
|
value,
|
|
3156
|
-
leftAdornments: icon && /* @__PURE__ */ (0,
|
|
3157
|
-
|
|
3158
|
-
data: icon,
|
|
3159
|
-
size: 18
|
|
3160
|
-
}),
|
|
3161
|
-
rightAdornments: !!value && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_eds_core_react15.Tooltip, {
|
|
3162
|
-
title: "Clear input",
|
|
3163
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CloseButton, {
|
|
3164
|
-
variant: "ghost_icon",
|
|
3165
|
-
onClick: () => setValue(""),
|
|
3166
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_eds_core_react15.Icon, {
|
|
3167
|
-
name: import_eds_icons6.close.name,
|
|
3168
|
-
data: import_eds_icons6.close,
|
|
3169
|
-
size: 18
|
|
3170
|
-
})
|
|
3171
|
-
})
|
|
3172
|
-
}),
|
|
3161
|
+
leftAdornments: icon && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_eds_core_react16.Icon, { name: icon.name, data: icon, size: 18 }),
|
|
3162
|
+
rightAdornments: !!value && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_eds_core_react16.Tooltip, { title: "Clear input", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CloseButton, { variant: "ghost_icon", onClick: () => setValue(""), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_eds_core_react16.Icon, { name: import_eds_icons6.close.name, data: import_eds_icons6.close, size: 18 }) }) }),
|
|
3173
3163
|
onChange: (event) => setValue(event.target.value)
|
|
3174
3164
|
})
|
|
3175
|
-
});
|
|
3165
|
+
) });
|
|
3176
3166
|
}
|
|
3177
3167
|
|
|
3178
3168
|
// src/DataTable/filters/functions.ts
|
|
@@ -3186,7 +3176,7 @@ var fuzzyFilter = (row, columnId, value, addMeta) => {
|
|
|
3186
3176
|
};
|
|
3187
3177
|
|
|
3188
3178
|
// src/DataTable/components/DataTableHeader.tsx
|
|
3189
|
-
var
|
|
3179
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3190
3180
|
var TableBannerWrapper = import_styled_components15.default.div`
|
|
3191
3181
|
display: flex;
|
|
3192
3182
|
align-items: center;
|
|
@@ -3206,79 +3196,63 @@ function TableBanner({
|
|
|
3206
3196
|
tableCaption,
|
|
3207
3197
|
globalFilter
|
|
3208
3198
|
}) {
|
|
3209
|
-
var _a;
|
|
3210
|
-
return /* @__PURE__ */ (0,
|
|
3211
|
-
className: "--
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
(
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
table
|
|
3237
|
-
}),
|
|
3238
|
-
(bannerConfig == null ? void 0 : bannerConfig.totalRowCount) && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", {
|
|
3239
|
-
children: [
|
|
3240
|
-
table.options.data.length.toLocaleString(),
|
|
3241
|
-
" /",
|
|
3242
|
-
" ",
|
|
3243
|
-
bannerConfig.totalRowCount.toLocaleString(),
|
|
3244
|
-
" rows"
|
|
3245
|
-
]
|
|
3246
|
-
})
|
|
3247
|
-
]
|
|
3248
|
-
})
|
|
3249
|
-
})
|
|
3250
|
-
]
|
|
3251
|
-
});
|
|
3199
|
+
var _a, _b, _c, _d, _e;
|
|
3200
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(TableBannerWrapper, { className: "--table-caption", padding: bannerConfig == null ? void 0 : bannerConfig.padding, children: [
|
|
3201
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(FilterContainer, { className: "--filter-container-left", children: [
|
|
3202
|
+
(bannerConfig == null ? void 0 : bannerConfig.enableTableCaption) && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_eds_core_react17.Typography, { variant: "h3", as: "h2", children: tableCaption }),
|
|
3203
|
+
(_c = (_a = bannerConfig == null ? void 0 : bannerConfig.customActionsLeft) == null ? void 0 : _a.call(bannerConfig, table)) != null ? _c : (_b = bannerConfig == null ? void 0 : bannerConfig.customActions) == null ? void 0 : _b.call(bannerConfig, table)
|
|
3204
|
+
] }),
|
|
3205
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FilterContainer, { className: "--filter-container-right", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
3206
|
+
(_d = bannerConfig == null ? void 0 : bannerConfig.customActionsRight) == null ? void 0 : _d.call(bannerConfig, table),
|
|
3207
|
+
(bannerConfig == null ? void 0 : bannerConfig.enableGlobalFilterInput) && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3208
|
+
DebouncedInput,
|
|
3209
|
+
{
|
|
3210
|
+
value: globalFilter.state,
|
|
3211
|
+
icon: import_eds_icons7.search,
|
|
3212
|
+
placeholder: (_e = bannerConfig.globalFilterPlaceholder) != null ? _e : "Search all columns",
|
|
3213
|
+
onChange: (value) => globalFilter.onChange(String(value))
|
|
3214
|
+
}
|
|
3215
|
+
),
|
|
3216
|
+
(bannerConfig == null ? void 0 : bannerConfig.enableColumnSelect) && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ColumnSelect, { table }),
|
|
3217
|
+
(bannerConfig == null ? void 0 : bannerConfig.totalRowCount) && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { children: [
|
|
3218
|
+
table.options.data.length.toLocaleString(),
|
|
3219
|
+
" /",
|
|
3220
|
+
" ",
|
|
3221
|
+
bannerConfig.totalRowCount.toLocaleString(),
|
|
3222
|
+
" rows"
|
|
3223
|
+
] })
|
|
3224
|
+
] }) })
|
|
3225
|
+
] });
|
|
3252
3226
|
}
|
|
3253
3227
|
|
|
3254
3228
|
// src/DataTable/components/VirtualTable.tsx
|
|
3255
|
-
var
|
|
3229
|
+
var import_eds_core_react19 = require("@equinor/eds-core-react");
|
|
3256
3230
|
var import_react_virtual = require("@tanstack/react-virtual");
|
|
3257
3231
|
|
|
3258
3232
|
// src/DataTable/components/PaddingRow.tsx
|
|
3259
|
-
var
|
|
3260
|
-
var
|
|
3233
|
+
var import_eds_core_react18 = require("@equinor/eds-core-react");
|
|
3234
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3261
3235
|
var PaddingRow = (props) => {
|
|
3262
3236
|
if (!props.height)
|
|
3263
3237
|
return null;
|
|
3264
|
-
return /* @__PURE__ */ (0,
|
|
3265
|
-
style: { pointerEvents: "none" },
|
|
3266
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_eds_core_react17.Table.Cell, {
|
|
3267
|
-
style: { height: `${props.height}px` }
|
|
3268
|
-
})
|
|
3269
|
-
});
|
|
3238
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_eds_core_react18.Table.Row, { style: { pointerEvents: "none" }, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_eds_core_react18.Table.Cell, { style: { height: `${props.height}px` } }) });
|
|
3270
3239
|
};
|
|
3271
3240
|
|
|
3272
3241
|
// src/DataTable/components/VirtualTable.tsx
|
|
3273
|
-
var
|
|
3274
|
-
function VirtualTable({
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
}
|
|
3281
|
-
|
|
3242
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3243
|
+
function VirtualTable(_a) {
|
|
3244
|
+
var _b = _a, {
|
|
3245
|
+
table,
|
|
3246
|
+
rowConfig,
|
|
3247
|
+
cellConfig,
|
|
3248
|
+
containerRef
|
|
3249
|
+
} = _b, props = __objRest(_b, [
|
|
3250
|
+
"table",
|
|
3251
|
+
"rowConfig",
|
|
3252
|
+
"cellConfig",
|
|
3253
|
+
"containerRef"
|
|
3254
|
+
]);
|
|
3255
|
+
var _a2, _b2;
|
|
3282
3256
|
const { rows } = table.getRowModel();
|
|
3283
3257
|
const rowVirtualizer = (0, import_react_virtual.useVirtualizer)({
|
|
3284
3258
|
count: rows.length,
|
|
@@ -3288,42 +3262,30 @@ function VirtualTable({
|
|
|
3288
3262
|
overscan: 20
|
|
3289
3263
|
});
|
|
3290
3264
|
const virtualRows = rowVirtualizer.getVirtualItems();
|
|
3291
|
-
const paddingTop = virtualRows.length > 0 ? ((
|
|
3292
|
-
const paddingBottom = virtualRows.length > 0 ? rowVirtualizer.getTotalSize() - (((
|
|
3293
|
-
return /* @__PURE__ */ (0,
|
|
3294
|
-
children:
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
measureElement: rowVirtualizer.measureElement
|
|
3316
|
-
}, row.id);
|
|
3317
|
-
}) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PlaceholderRow, {
|
|
3318
|
-
isLoading: props.isLoading
|
|
3319
|
-
}),
|
|
3320
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PaddingRow, {
|
|
3321
|
-
height: paddingBottom
|
|
3322
|
-
})
|
|
3323
|
-
]
|
|
3324
|
-
})
|
|
3325
|
-
]
|
|
3326
|
-
});
|
|
3265
|
+
const paddingTop = virtualRows.length > 0 ? ((_a2 = virtualRows == null ? void 0 : virtualRows[0]) == null ? void 0 : _a2.start) || 0 : 0;
|
|
3266
|
+
const paddingBottom = virtualRows.length > 0 ? rowVirtualizer.getTotalSize() - (((_b2 = virtualRows == null ? void 0 : virtualRows[virtualRows.length - 1]) == null ? void 0 : _b2.end) || 0) : 0;
|
|
3267
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_eds_core_react19.Table, { children: [
|
|
3268
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_eds_core_react19.Table.Caption, { hidden: true, children: props.tableCaption }),
|
|
3269
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TableHeader, { sticky: props.stickyHeader, table }),
|
|
3270
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(TableBody, { children: [
|
|
3271
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PaddingRow, { height: paddingTop }),
|
|
3272
|
+
rows.length ? virtualRows.map((virtualRow) => {
|
|
3273
|
+
const row = rows[virtualRow.index];
|
|
3274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3275
|
+
TableRow,
|
|
3276
|
+
{
|
|
3277
|
+
row,
|
|
3278
|
+
rowConfig,
|
|
3279
|
+
cellConfig,
|
|
3280
|
+
index: virtualRow.index,
|
|
3281
|
+
measureElement: rowVirtualizer.measureElement
|
|
3282
|
+
},
|
|
3283
|
+
row.id
|
|
3284
|
+
);
|
|
3285
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PlaceholderRow, { isLoading: props.isLoading }),
|
|
3286
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PaddingRow, { height: paddingBottom })
|
|
3287
|
+
] })
|
|
3288
|
+
] });
|
|
3327
3289
|
}
|
|
3328
3290
|
|
|
3329
3291
|
// src/DataTable/hooks/useFetchMoreOnBottomReached.tsx
|
|
@@ -3363,7 +3325,7 @@ function useForceRerender() {
|
|
|
3363
3325
|
}
|
|
3364
3326
|
|
|
3365
3327
|
// src/DataTable/DataTable.tsx
|
|
3366
|
-
var
|
|
3328
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
3367
3329
|
function canUseContainStrict(height) {
|
|
3368
3330
|
if (!height)
|
|
3369
3331
|
return false;
|
|
@@ -3376,10 +3338,16 @@ function canUseContainStrict(height) {
|
|
|
3376
3338
|
return true;
|
|
3377
3339
|
}
|
|
3378
3340
|
var DataTableWrapper = import_styled_components16.default.div`
|
|
3379
|
-
width: ${(props) =>
|
|
3341
|
+
width: ${(props) => {
|
|
3342
|
+
var _a;
|
|
3343
|
+
return (_a = props.width) != null ? _a : "100%";
|
|
3344
|
+
}};
|
|
3380
3345
|
|
|
3381
3346
|
.--table-container {
|
|
3382
|
-
height: ${(props) =>
|
|
3347
|
+
height: ${(props) => {
|
|
3348
|
+
var _a;
|
|
3349
|
+
return (_a = props.height) != null ? _a : "100%";
|
|
3350
|
+
}};
|
|
3383
3351
|
width: '100%';
|
|
3384
3352
|
overflow: auto;
|
|
3385
3353
|
${(props) => canUseContainStrict(props.height) ? "contain: strict;" : ""}
|
|
@@ -3389,41 +3357,44 @@ var DataTableWrapper = import_styled_components16.default.div`
|
|
|
3389
3357
|
|
|
3390
3358
|
// The following attribute is important for fixed column width
|
|
3391
3359
|
// CHANGE THIS WITH CAUTION
|
|
3392
|
-
table-layout: ${(props) =>
|
|
3360
|
+
table-layout: ${(props) => {
|
|
3361
|
+
var _a;
|
|
3362
|
+
return (_a = props.tableLayout) != null ? _a : "auto";
|
|
3363
|
+
}};
|
|
3393
3364
|
}
|
|
3394
3365
|
}
|
|
3395
3366
|
`;
|
|
3396
3367
|
function DataTable(props) {
|
|
3397
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
3368
|
+
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;
|
|
3398
3369
|
const { columns, data, bannerConfig, cellConfig, sorting } = props;
|
|
3399
3370
|
const [internalColumnVisibility, setInternalColumnVisibility] = (0, import_react7.useState)({});
|
|
3400
3371
|
const [columnVisibility, setColumnVisibility] = [
|
|
3401
|
-
((_a = props.columnVisibility) == null ? void 0 : _a.state)
|
|
3402
|
-
((
|
|
3372
|
+
(_b = (_a = props.columnVisibility) == null ? void 0 : _a.state) != null ? _b : internalColumnVisibility,
|
|
3373
|
+
(_d = (_c = props.columnVisibility) == null ? void 0 : _c.onChange) != null ? _d : setInternalColumnVisibility
|
|
3403
3374
|
];
|
|
3404
3375
|
const [internalGlobalFilterState, setInternalGlobalFilterState] = (0, import_react7.useState)("");
|
|
3405
3376
|
const [globalFilterState, setGlobalFilterState] = [
|
|
3406
|
-
((
|
|
3407
|
-
((
|
|
3377
|
+
(_f = (_e = props.globalFilter) == null ? void 0 : _e.state) != null ? _f : internalGlobalFilterState,
|
|
3378
|
+
(_h = (_g = props.globalFilter) == null ? void 0 : _g.onChange) != null ? _h : setInternalGlobalFilterState
|
|
3408
3379
|
];
|
|
3409
|
-
const shouldEnableGlobalFilter = ((
|
|
3380
|
+
const shouldEnableGlobalFilter = ((_i = props.bannerConfig) == null ? void 0 : _i.enableGlobalFilterInput) || Boolean(props.globalFilter);
|
|
3410
3381
|
function enableGlobalFilter(value) {
|
|
3411
3382
|
return enableOrUndefined(shouldEnableGlobalFilter, value);
|
|
3412
3383
|
}
|
|
3413
3384
|
const [internalSortingState, setInternalSortingState] = (0, import_react7.useState)([]);
|
|
3414
3385
|
const [sortingState, setSortingState] = [
|
|
3415
|
-
((
|
|
3416
|
-
((
|
|
3386
|
+
(_k = (_j = props.sorting) == null ? void 0 : _j.state) != null ? _k : internalSortingState,
|
|
3387
|
+
(_m = (_l = props.sorting) == null ? void 0 : _l.onChange) != null ? _m : setInternalSortingState
|
|
3417
3388
|
];
|
|
3418
3389
|
const [internalRowSelectionState, setInternalRowSelectionState] = (0, import_react7.useState)({});
|
|
3419
3390
|
const [rowSelectionState, setRowSelectionState] = [
|
|
3420
|
-
((
|
|
3421
|
-
((
|
|
3391
|
+
(_o = (_n = props.rowSelection) == null ? void 0 : _n.state) != null ? _o : internalRowSelectionState,
|
|
3392
|
+
(_q = (_p = props.rowSelection) == null ? void 0 : _p.onChange) != null ? _q : setInternalRowSelectionState
|
|
3422
3393
|
];
|
|
3423
3394
|
const [internalExpandedState, setInternalExpandedState] = (0, import_react7.useState)({});
|
|
3424
3395
|
const [expandedState, setExpandedState] = [
|
|
3425
|
-
((
|
|
3426
|
-
((
|
|
3396
|
+
(_s = (_r = props.expansion) == null ? void 0 : _r.state) != null ? _s : internalExpandedState,
|
|
3397
|
+
(_u = (_t = props.expansion) == null ? void 0 : _t.onChange) != null ? _u : setInternalExpandedState
|
|
3427
3398
|
];
|
|
3428
3399
|
const table = (0, import_react_table3.useReactTable)({
|
|
3429
3400
|
columns: prependSelectColumn(columns, props.rowSelection),
|
|
@@ -3432,25 +3403,23 @@ function DataTable(props) {
|
|
|
3432
3403
|
state: {
|
|
3433
3404
|
expanded: expandedState,
|
|
3434
3405
|
globalFilter: enableGlobalFilter(globalFilterState),
|
|
3435
|
-
sorting: ((
|
|
3406
|
+
sorting: ((_v = props.sorting) == null ? void 0 : _v.enableSorting) ? (_x = (_w = props.sorting) == null ? void 0 : _w.state) != null ? _x : sortingState : void 0,
|
|
3436
3407
|
rowSelection: rowSelectionState,
|
|
3437
3408
|
columnVisibility
|
|
3438
3409
|
},
|
|
3439
3410
|
defaultColumn: {
|
|
3440
3411
|
cell: ({ cell }) => {
|
|
3441
3412
|
const truncateMode = getFunctionValueOrDefault(cellConfig == null ? void 0 : cellConfig.truncateMode, cell, "hover");
|
|
3442
|
-
return /* @__PURE__ */ (0,
|
|
3443
|
-
truncate: truncateMode === "hover",
|
|
3444
|
-
enableShowAllOnHover: true,
|
|
3445
|
-
children: cell.getValue()
|
|
3446
|
-
});
|
|
3413
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TypographyCustom, { truncate: truncateMode === "hover", enableShowAllOnHover: true, children: cell.getValue() });
|
|
3447
3414
|
}
|
|
3448
3415
|
},
|
|
3416
|
+
enableColumnResizing: Boolean(props.columnResizing),
|
|
3417
|
+
columnResizeMode: typeof props.columnResizing === "boolean" ? "onChange" : props.columnResizing,
|
|
3449
3418
|
enableSorting: sorting == null ? void 0 : sorting.enableSorting,
|
|
3450
3419
|
manualSorting: sorting == null ? void 0 : sorting.manualSorting,
|
|
3451
3420
|
enableExpanding: Boolean(props.expansion),
|
|
3452
|
-
enableMultiRowSelection: ((
|
|
3453
|
-
enableSubRowSelection: ((
|
|
3421
|
+
enableMultiRowSelection: ((_y = props.rowSelection) == null ? void 0 : _y.mode) === "multiple",
|
|
3422
|
+
enableSubRowSelection: ((_z = props.rowSelection) == null ? void 0 : _z.mode) !== "single",
|
|
3454
3423
|
filterFromLeafRows: bannerConfig == null ? void 0 : bannerConfig.filterFromLeafRows,
|
|
3455
3424
|
getFilteredRowModel: enableGlobalFilter((0, import_react_table3.getFilteredRowModel)()),
|
|
3456
3425
|
getCoreRowModel: (0, import_react_table3.getCoreRowModel)(),
|
|
@@ -3458,7 +3427,7 @@ function DataTable(props) {
|
|
|
3458
3427
|
getSortedRowModel: (0, import_react_table3.getSortedRowModel)(),
|
|
3459
3428
|
onExpandedChange: setExpandedState,
|
|
3460
3429
|
onRowSelectionChange: setRowSelectionState,
|
|
3461
|
-
onSortingChange: (sorting == null ? void 0 : sorting.enableSorting) ? (sorting == null ? void 0 : sorting.onChange)
|
|
3430
|
+
onSortingChange: (sorting == null ? void 0 : sorting.enableSorting) ? (_A = sorting == null ? void 0 : sorting.onChange) != null ? _A : setSortingState : void 0,
|
|
3462
3431
|
onColumnVisibilityChange: setColumnVisibility,
|
|
3463
3432
|
onGlobalFilterChange: enableGlobalFilter(setGlobalFilterState),
|
|
3464
3433
|
getSubRows: props == null ? void 0 : props.getSubRows,
|
|
@@ -3469,7 +3438,7 @@ function DataTable(props) {
|
|
|
3469
3438
|
if ((_a2 = props.expansion) == null ? void 0 : _a2.expandAllByDefault) {
|
|
3470
3439
|
table.toggleAllRowsExpanded();
|
|
3471
3440
|
}
|
|
3472
|
-
}, [table, (
|
|
3441
|
+
}, [table, (_B = props.expansion) == null ? void 0 : _B.expandAllByDefault]);
|
|
3473
3442
|
const { isLoading, rowConfig } = props;
|
|
3474
3443
|
const tableContainerRef = (0, import_react7.useRef)(null);
|
|
3475
3444
|
const onTableContainerScroll = useFetchMoreOnBottomReached(
|
|
@@ -3481,21 +3450,21 @@ function DataTable(props) {
|
|
|
3481
3450
|
if (Boolean(tableContainerRef.current))
|
|
3482
3451
|
forceRerender();
|
|
3483
3452
|
}, [tableContainerRef.current === null]);
|
|
3484
|
-
return /* @__PURE__ */ (0,
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
children: [
|
|
3489
|
-
props.bannerConfig && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TableBanner, {
|
|
3453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(DataTableWrapper, { height: props == null ? void 0 : props.height, width: props == null ? void 0 : props.width, tableLayout: props == null ? void 0 : props.tableLayout, children: [
|
|
3454
|
+
props.bannerConfig && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3455
|
+
TableBanner,
|
|
3456
|
+
{
|
|
3490
3457
|
table,
|
|
3491
3458
|
bannerConfig: props.bannerConfig,
|
|
3492
3459
|
globalFilter: { state: globalFilterState, onChange: setGlobalFilterState },
|
|
3493
3460
|
tableCaption: props.tableCaption
|
|
3494
|
-
}
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3461
|
+
}
|
|
3462
|
+
),
|
|
3463
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3464
|
+
"div",
|
|
3465
|
+
__spreadProps(__spreadValues({}, props.tableContainerProps), {
|
|
3466
|
+
className: "--table-container " + ((_D = (_C = props.tableContainerProps) == null ? void 0 : _C.className) != null ? _D : ""),
|
|
3467
|
+
onScroll: (_F = (_E = props.tableContainerProps) == null ? void 0 : _E.onScroll) != null ? _F : onTableContainerScroll,
|
|
3499
3468
|
ref: (node) => {
|
|
3500
3469
|
var _a2;
|
|
3501
3470
|
if (node) {
|
|
@@ -3505,29 +3474,35 @@ function DataTable(props) {
|
|
|
3505
3474
|
}
|
|
3506
3475
|
}
|
|
3507
3476
|
},
|
|
3508
|
-
children: (props == null ? void 0 : props.virtual) ? /* @__PURE__ */ (0,
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3477
|
+
children: (props == null ? void 0 : props.virtual) ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3478
|
+
VirtualTable,
|
|
3479
|
+
{
|
|
3480
|
+
containerRef: tableContainerRef,
|
|
3481
|
+
tableCaption: props.tableCaption,
|
|
3482
|
+
table,
|
|
3483
|
+
rowConfig,
|
|
3484
|
+
cellConfig,
|
|
3485
|
+
isLoading,
|
|
3486
|
+
stickyHeader: props.stickyHeader
|
|
3487
|
+
}
|
|
3488
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3489
|
+
BasicTable,
|
|
3490
|
+
{
|
|
3491
|
+
tableCaption: props.tableCaption,
|
|
3492
|
+
table,
|
|
3493
|
+
rowConfig,
|
|
3494
|
+
cellConfig,
|
|
3495
|
+
isLoading,
|
|
3496
|
+
stickyHeader: props.stickyHeader
|
|
3497
|
+
}
|
|
3498
|
+
)
|
|
3524
3499
|
})
|
|
3525
|
-
|
|
3526
|
-
});
|
|
3500
|
+
)
|
|
3501
|
+
] });
|
|
3527
3502
|
}
|
|
3528
3503
|
|
|
3529
3504
|
// src/form-cells/EditableCheckboxCell.tsx
|
|
3530
|
-
var
|
|
3505
|
+
var import_eds_core_react20 = require("@equinor/eds-core-react");
|
|
3531
3506
|
var import_react_hook_form2 = require("react-hook-form");
|
|
3532
3507
|
|
|
3533
3508
|
// src/form-meta/utils.tsx
|
|
@@ -3539,16 +3514,21 @@ var formMeta = {
|
|
|
3539
3514
|
_hasRemoteChange: false
|
|
3540
3515
|
};
|
|
3541
3516
|
function useEditMode() {
|
|
3517
|
+
var _a;
|
|
3542
3518
|
const { watch } = (0, import_react_hook_form.useFormContext)();
|
|
3543
|
-
return watch("_editMode")
|
|
3519
|
+
return (_a = watch("_editMode")) != null ? _a : false;
|
|
3544
3520
|
}
|
|
3545
3521
|
function useHasRemoteChange() {
|
|
3522
|
+
var _a;
|
|
3546
3523
|
const { watch } = (0, import_react_hook_form.useFormContext)();
|
|
3547
|
-
return watch("_hasRemoteChange")
|
|
3524
|
+
return (_a = watch("_hasRemoteChange")) != null ? _a : false;
|
|
3548
3525
|
}
|
|
3549
3526
|
function useGetIsNew() {
|
|
3550
3527
|
const { getValues } = (0, import_react_hook_form.useFormContext)();
|
|
3551
|
-
return () =>
|
|
3528
|
+
return () => {
|
|
3529
|
+
var _a;
|
|
3530
|
+
return (_a = getValues("_isNew")) != null ? _a : false;
|
|
3531
|
+
};
|
|
3552
3532
|
}
|
|
3553
3533
|
function useSetFormMeta() {
|
|
3554
3534
|
const { setValue } = (0, import_react_hook_form.useFormContext)();
|
|
@@ -3561,42 +3541,46 @@ function removeFormMeta(withFormMeta) {
|
|
|
3561
3541
|
return (0, import_omit.default)(withFormMeta, Object.keys(formMeta));
|
|
3562
3542
|
}
|
|
3563
3543
|
function addFormMeta(withoutFormMeta) {
|
|
3564
|
-
return {
|
|
3544
|
+
return __spreadValues(__spreadValues({}, formMeta), withoutFormMeta);
|
|
3565
3545
|
}
|
|
3566
3546
|
|
|
3567
3547
|
// src/form-cells/EditableCheckboxCell.tsx
|
|
3568
|
-
var
|
|
3548
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3569
3549
|
function EditableCheckboxCell(context) {
|
|
3570
3550
|
const editMode = useEditMode();
|
|
3571
3551
|
if (!editMode)
|
|
3572
|
-
return /* @__PURE__ */ (0,
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3552
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3553
|
+
import_eds_core_react20.Checkbox,
|
|
3554
|
+
{
|
|
3555
|
+
enterKeyHint: "next",
|
|
3556
|
+
"aria-label": "readonly",
|
|
3557
|
+
readOnly: true,
|
|
3558
|
+
checked: context.getValue(),
|
|
3559
|
+
disabled: true
|
|
3560
|
+
}
|
|
3561
|
+
);
|
|
3562
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3563
|
+
import_react_hook_form2.Controller,
|
|
3564
|
+
{
|
|
3565
|
+
name: context.column.id,
|
|
3566
|
+
render: (_a) => {
|
|
3567
|
+
var { field: _b } = _a, _c = _b, { value } = _c, field = __objRest(_c, ["value"]);
|
|
3568
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_eds_core_react20.Checkbox, __spreadValues({ enterKeyHint: "send", "aria-label": "editable", checked: value }, field));
|
|
3569
|
+
}
|
|
3570
|
+
}
|
|
3571
|
+
);
|
|
3588
3572
|
}
|
|
3589
3573
|
|
|
3590
3574
|
// src/form-cells/EditableDateCell.tsx
|
|
3591
|
-
var
|
|
3575
|
+
var import_eds_core_react22 = require("@equinor/eds-core-react");
|
|
3592
3576
|
var import_react8 = require("react");
|
|
3593
3577
|
var import_react_hook_form3 = require("react-hook-form");
|
|
3594
3578
|
var import_styled_components17 = __toESM(require("styled-components"));
|
|
3595
3579
|
|
|
3596
3580
|
// src/form-cells/utils.tsx
|
|
3597
|
-
var
|
|
3581
|
+
var import_eds_core_react21 = require("@equinor/eds-core-react");
|
|
3598
3582
|
var import_eds_icons8 = require("@equinor/eds-icons");
|
|
3599
|
-
var
|
|
3583
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3600
3584
|
function getHelperTextProps({
|
|
3601
3585
|
error,
|
|
3602
3586
|
warning,
|
|
@@ -3606,19 +3590,13 @@ function getHelperTextProps({
|
|
|
3606
3590
|
return {
|
|
3607
3591
|
variant: "error",
|
|
3608
3592
|
helperText: error.message,
|
|
3609
|
-
helperIcon: /* @__PURE__ */ (0,
|
|
3610
|
-
data: import_eds_icons8.error_filled,
|
|
3611
|
-
size: 16
|
|
3612
|
-
})
|
|
3593
|
+
helperIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_eds_core_react21.Icon, { data: import_eds_icons8.error_filled, size: 16 })
|
|
3613
3594
|
};
|
|
3614
3595
|
if (warning)
|
|
3615
3596
|
return {
|
|
3616
3597
|
variant: "warning",
|
|
3617
3598
|
helperText: warning.message,
|
|
3618
|
-
helperIcon: /* @__PURE__ */ (0,
|
|
3619
|
-
data: import_eds_icons8.warning_filled,
|
|
3620
|
-
size: 16
|
|
3621
|
-
})
|
|
3599
|
+
helperIcon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_eds_core_react21.Icon, { data: import_eds_icons8.warning_filled, size: 16 })
|
|
3622
3600
|
};
|
|
3623
3601
|
return {
|
|
3624
3602
|
helperText,
|
|
@@ -3633,32 +3611,45 @@ function stopPropagation2(handler) {
|
|
|
3633
3611
|
}
|
|
3634
3612
|
|
|
3635
3613
|
// src/form-cells/EditableDateCell.tsx
|
|
3636
|
-
var
|
|
3637
|
-
function EditableDateCell(
|
|
3638
|
-
|
|
3614
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
3615
|
+
function EditableDateCell(_a) {
|
|
3616
|
+
var _b = _a, {
|
|
3617
|
+
dateStringFormatter,
|
|
3618
|
+
error: errorFromProps
|
|
3619
|
+
} = _b, context = __objRest(_b, [
|
|
3620
|
+
"dateStringFormatter",
|
|
3621
|
+
"error"
|
|
3622
|
+
]);
|
|
3639
3623
|
const rawValue = context.getValue();
|
|
3640
3624
|
const editMode = useEditMode();
|
|
3641
3625
|
const formattedValue = (0, import_react8.useMemo)(
|
|
3642
|
-
() =>
|
|
3626
|
+
() => {
|
|
3627
|
+
var _a2;
|
|
3628
|
+
return (_a2 = dateStringFormatter == null ? void 0 : dateStringFormatter(rawValue)) != null ? _a2 : rawValue;
|
|
3629
|
+
},
|
|
3643
3630
|
[rawValue, dateStringFormatter]
|
|
3644
3631
|
);
|
|
3645
3632
|
if (!editMode)
|
|
3646
|
-
return /* @__PURE__ */ (0,
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3633
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TypographyCustom, { truncate: true, children: formattedValue });
|
|
3634
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3635
|
+
import_react_hook_form3.Controller,
|
|
3636
|
+
{
|
|
3637
|
+
name: context.column.id,
|
|
3638
|
+
render: (_a2) => {
|
|
3639
|
+
var _b2 = _a2, { field: _c } = _b2, _d = _c, { value, onChange } = _d, field = __objRest(_d, ["value", "onChange"]), { fieldState: { error } } = _b2;
|
|
3640
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3641
|
+
InlineTextField,
|
|
3642
|
+
__spreadValues(__spreadValues({
|
|
3643
|
+
id: context.column.id,
|
|
3644
|
+
type: "date",
|
|
3645
|
+
autoComplete: "none",
|
|
3646
|
+
value: value ? parseISODate(value) : "",
|
|
3647
|
+
onChange: (e) => onChange(e.target.value ? parseISODate(e.target.value) : "")
|
|
3648
|
+
}, getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error })), field)
|
|
3649
|
+
);
|
|
3650
|
+
}
|
|
3651
|
+
}
|
|
3652
|
+
);
|
|
3662
3653
|
}
|
|
3663
3654
|
function parseISODate(dateString) {
|
|
3664
3655
|
const date = new Date(dateString);
|
|
@@ -3666,7 +3657,7 @@ function parseISODate(dateString) {
|
|
|
3666
3657
|
const dateWithoutOffset = new Date(date.getTime() - offset * 60 * 1e3);
|
|
3667
3658
|
return dateWithoutOffset.toISOString().split("T")[0];
|
|
3668
3659
|
}
|
|
3669
|
-
var InlineTextField = (0, import_styled_components17.default)(
|
|
3660
|
+
var InlineTextField = (0, import_styled_components17.default)(import_eds_core_react22.TextField)`
|
|
3670
3661
|
/*
|
|
3671
3662
|
TODO: Improve input based on feedback from UX
|
|
3672
3663
|
& > div {
|
|
@@ -3690,69 +3681,135 @@ var InlineTextField = (0, import_styled_components17.default)(import_eds_core_re
|
|
|
3690
3681
|
`;
|
|
3691
3682
|
|
|
3692
3683
|
// src/form-cells/EditableDropdownSingleCell.tsx
|
|
3693
|
-
var
|
|
3684
|
+
var import_eds_core_react24 = require("@equinor/eds-core-react");
|
|
3694
3685
|
var import_react_hook_form4 = require("react-hook-form");
|
|
3695
|
-
|
|
3686
|
+
|
|
3687
|
+
// src/form-cells/FormHelperText.tsx
|
|
3688
|
+
var import_eds_core_react23 = require("@equinor/eds-core-react");
|
|
3689
|
+
var import_eds_tokens6 = require("@equinor/eds-tokens");
|
|
3690
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
3691
|
+
var colors = {
|
|
3692
|
+
error: import_eds_tokens6.tokens.colors.interactive.danger__text.hex,
|
|
3693
|
+
warning: import_eds_tokens6.tokens.colors.interactive.warning__text.hex,
|
|
3694
|
+
success: import_eds_tokens6.tokens.colors.interactive.success__text.hex
|
|
3695
|
+
};
|
|
3696
|
+
function HelperText({ helperText, variant, helperIcon }) {
|
|
3697
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: helperText && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style: { marginTop: "8px", marginLeft: "8px" }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
3698
|
+
"div",
|
|
3699
|
+
{
|
|
3700
|
+
style: {
|
|
3701
|
+
display: "flex",
|
|
3702
|
+
alignItems: "flex-start",
|
|
3703
|
+
marginTop: "8px",
|
|
3704
|
+
color: variant ? colors[variant] : "inherit"
|
|
3705
|
+
},
|
|
3706
|
+
children: [
|
|
3707
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { style: { flexShrink: 0 }, children: helperIcon }),
|
|
3708
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3709
|
+
import_eds_core_react23.Typography,
|
|
3710
|
+
{
|
|
3711
|
+
style: {
|
|
3712
|
+
fontSize: "0.75rem",
|
|
3713
|
+
fontWeight: 500,
|
|
3714
|
+
lineHeight: "1.333em",
|
|
3715
|
+
letterSpacing: "0.013em",
|
|
3716
|
+
textAlign: "left",
|
|
3717
|
+
margin: "0 0 0 8px",
|
|
3718
|
+
color: "inherit"
|
|
3719
|
+
},
|
|
3720
|
+
children: helperText
|
|
3721
|
+
}
|
|
3722
|
+
)
|
|
3723
|
+
]
|
|
3724
|
+
}
|
|
3725
|
+
) }) });
|
|
3726
|
+
}
|
|
3727
|
+
|
|
3728
|
+
// src/form-cells/EditableDropdownSingleCell.tsx
|
|
3729
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3696
3730
|
function buildEmptyOption() {
|
|
3697
3731
|
return { label: "", value: "" };
|
|
3698
3732
|
}
|
|
3699
|
-
function EditableDropdownSingleCell(
|
|
3700
|
-
|
|
3733
|
+
function EditableDropdownSingleCell(_a) {
|
|
3734
|
+
var _b = _a, {
|
|
3735
|
+
options,
|
|
3736
|
+
error: errorFromProps
|
|
3737
|
+
} = _b, context = __objRest(_b, [
|
|
3738
|
+
"options",
|
|
3739
|
+
"error"
|
|
3740
|
+
]);
|
|
3701
3741
|
const editMode = useEditMode();
|
|
3702
3742
|
if (!editMode)
|
|
3703
|
-
return /* @__PURE__ */ (0,
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3743
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TypographyCustom, { truncate: true, children: context.getValue() });
|
|
3744
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3745
|
+
import_react_hook_form4.Controller,
|
|
3746
|
+
{
|
|
3747
|
+
name: context.column.id,
|
|
3748
|
+
render: (_a2) => {
|
|
3749
|
+
var _b2 = _a2, { field: _c } = _b2, _d = _c, { value, onChange } = _d, field = __objRest(_d, ["value", "onChange"]), { fieldState: { error } } = _b2;
|
|
3750
|
+
var _a3;
|
|
3751
|
+
const selectedOption = (_a3 = options.find((option) => option.value === value)) != null ? _a3 : buildEmptyOption();
|
|
3752
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
3753
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3754
|
+
import_eds_core_react24.Autocomplete,
|
|
3755
|
+
__spreadValues({
|
|
3756
|
+
label: "",
|
|
3757
|
+
selectedOptions: selectedOption && [selectedOption],
|
|
3758
|
+
options,
|
|
3759
|
+
optionLabel: (option) => {
|
|
3760
|
+
var _a4;
|
|
3761
|
+
return (_a4 = option == null ? void 0 : option.label) != null ? _a4 : "";
|
|
3762
|
+
},
|
|
3763
|
+
"aria-required": true,
|
|
3764
|
+
hideClearButton: true,
|
|
3765
|
+
"aria-autocomplete": "none",
|
|
3766
|
+
onOptionsChange: (changes) => {
|
|
3767
|
+
const [change] = changes.selectedItems;
|
|
3768
|
+
onChange(change == null ? void 0 : change.value);
|
|
3769
|
+
}
|
|
3770
|
+
}, field)
|
|
3771
|
+
),
|
|
3772
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(HelperText, __spreadValues({}, getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error })))
|
|
3773
|
+
] });
|
|
3774
|
+
}
|
|
3725
3775
|
}
|
|
3726
|
-
|
|
3776
|
+
);
|
|
3727
3777
|
}
|
|
3728
3778
|
|
|
3729
3779
|
// src/form-cells/EditableNumberCell.tsx
|
|
3730
|
-
var
|
|
3780
|
+
var import_eds_core_react25 = require("@equinor/eds-core-react");
|
|
3731
3781
|
var import_react_hook_form5 = require("react-hook-form");
|
|
3732
3782
|
var import_styled_components18 = __toESM(require("styled-components"));
|
|
3733
|
-
var
|
|
3734
|
-
function EditableNumberCell(
|
|
3783
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3784
|
+
function EditableNumberCell(_a) {
|
|
3785
|
+
var _b = _a, {
|
|
3786
|
+
error: errorFromProps
|
|
3787
|
+
} = _b, context = __objRest(_b, [
|
|
3788
|
+
"error"
|
|
3789
|
+
]);
|
|
3735
3790
|
const editMode = useEditMode();
|
|
3736
3791
|
if (!editMode)
|
|
3737
|
-
return /* @__PURE__ */ (0,
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3792
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TypographyCustom, { truncate: true, children: context.getValue() });
|
|
3793
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3794
|
+
import_react_hook_form5.Controller,
|
|
3795
|
+
{
|
|
3796
|
+
name: context.column.id,
|
|
3797
|
+
render: (_a2) => {
|
|
3798
|
+
var _b2 = _a2, { field: _c } = _b2, _d = _c, { onChange } = _d, field = __objRest(_d, ["onChange"]), { fieldState: { error } } = _b2;
|
|
3799
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3800
|
+
InlineTextField2,
|
|
3801
|
+
__spreadValues(__spreadValues({
|
|
3802
|
+
id: context.column.id,
|
|
3803
|
+
type: "number",
|
|
3804
|
+
autoComplete: "none",
|
|
3805
|
+
onChange: (e) => onChange(e.target.valueAsNumber)
|
|
3806
|
+
}, field), getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error }))
|
|
3807
|
+
) });
|
|
3808
|
+
}
|
|
3809
|
+
}
|
|
3810
|
+
);
|
|
3754
3811
|
}
|
|
3755
|
-
var InlineTextField2 = (0, import_styled_components18.default)(
|
|
3812
|
+
var InlineTextField2 = (0, import_styled_components18.default)(import_eds_core_react25.TextField)`
|
|
3756
3813
|
/*
|
|
3757
3814
|
TODO: Improve input based on feedback from UX
|
|
3758
3815
|
& > div {
|
|
@@ -3776,112 +3833,117 @@ var InlineTextField2 = (0, import_styled_components18.default)(import_eds_core_r
|
|
|
3776
3833
|
`;
|
|
3777
3834
|
|
|
3778
3835
|
// src/form-cells/EditableTextAreaCell.tsx
|
|
3779
|
-
var
|
|
3836
|
+
var import_eds_core_react26 = require("@equinor/eds-core-react");
|
|
3780
3837
|
var import_eds_icons9 = require("@equinor/eds-icons");
|
|
3781
3838
|
var import_react9 = require("react");
|
|
3782
3839
|
var import_react_hook_form6 = require("react-hook-form");
|
|
3783
3840
|
var import_styled_components19 = __toESM(require("styled-components"));
|
|
3784
|
-
var
|
|
3785
|
-
function EditableTextAreaCell(
|
|
3786
|
-
|
|
3841
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3842
|
+
function EditableTextAreaCell(_a) {
|
|
3843
|
+
var _b = _a, {
|
|
3844
|
+
title,
|
|
3845
|
+
error: errorFromProps
|
|
3846
|
+
} = _b, context = __objRest(_b, [
|
|
3847
|
+
"title",
|
|
3848
|
+
"error"
|
|
3849
|
+
]);
|
|
3787
3850
|
const [textareaValue, setTextareaValue] = (0, import_react9.useState)(context.getValue());
|
|
3788
3851
|
const [open, setOpen] = (0, import_react9.useState)(false);
|
|
3789
3852
|
const editMode = useEditMode();
|
|
3790
3853
|
const name = context.column.id;
|
|
3791
3854
|
if (!editMode)
|
|
3792
|
-
return /* @__PURE__ */ (0,
|
|
3793
|
-
id: name + "popover",
|
|
3794
|
-
value: context.getValue(),
|
|
3795
|
-
title
|
|
3796
|
-
});
|
|
3855
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(PopoverCell, { id: name + "popover", value: context.getValue(), title });
|
|
3797
3856
|
const openDialog = () => setOpen(true);
|
|
3798
3857
|
const closeDialog = () => setOpen(false);
|
|
3799
|
-
return /* @__PURE__ */ (0,
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
...field,
|
|
3815
|
-
...getHelperTextProps({ error })
|
|
3816
|
-
}),
|
|
3817
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(IconButton, {
|
|
3818
|
-
variant: "ghost_icon",
|
|
3819
|
-
onClick: stopPropagation2(openDialog),
|
|
3820
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_eds_core_react24.Icon, {
|
|
3821
|
-
data: import_eds_icons9.arrow_up,
|
|
3822
|
-
size: 24,
|
|
3823
|
-
style: { transform: "rotateZ(45deg)" }
|
|
3824
|
-
})
|
|
3825
|
-
})
|
|
3826
|
-
]
|
|
3827
|
-
}),
|
|
3828
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_eds_core_react24.Dialog, {
|
|
3829
|
-
open,
|
|
3830
|
-
onClose: () => {
|
|
3831
|
-
closeDialog();
|
|
3832
|
-
onChange(textareaValue);
|
|
3833
|
-
},
|
|
3834
|
-
isDismissable: true,
|
|
3835
|
-
style: { width: "min(50rem, calc(100vw - 4rem))" },
|
|
3836
|
-
children: [
|
|
3837
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_eds_core_react24.Dialog.Header, {
|
|
3838
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_eds_core_react24.Dialog.Title, {
|
|
3839
|
-
children: title
|
|
3840
|
-
})
|
|
3841
|
-
}),
|
|
3842
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_eds_core_react24.Dialog.Content, {
|
|
3843
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_eds_core_react24.TextField, {
|
|
3844
|
-
style: {
|
|
3845
|
-
maxWidth: "100%",
|
|
3846
|
-
marginTop: "1rem"
|
|
3847
|
-
},
|
|
3848
|
-
id: field.name + "modal",
|
|
3849
|
-
multiline: true,
|
|
3850
|
-
rows: 8,
|
|
3851
|
-
name: field.name + "modal",
|
|
3852
|
-
value: textareaValue,
|
|
3853
|
-
onChange: (e) => {
|
|
3854
|
-
setTextareaValue(e.target.value);
|
|
3855
|
-
}
|
|
3856
|
-
})
|
|
3857
|
-
}),
|
|
3858
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_eds_core_react24.Dialog.Actions, {
|
|
3859
|
-
style: { display: "flex", gap: "1rem" },
|
|
3858
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3859
|
+
import_react_hook_form6.Controller,
|
|
3860
|
+
{
|
|
3861
|
+
name,
|
|
3862
|
+
render: (_a2) => {
|
|
3863
|
+
var _b2 = _a2, { field: _c } = _b2, _d = _c, { onChange, ref } = _d, field = __objRest(_d, ["onChange", "ref"]), { fieldState: { error } } = _b2;
|
|
3864
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
3865
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
3866
|
+
"div",
|
|
3867
|
+
{
|
|
3868
|
+
style: {
|
|
3869
|
+
display: "flex",
|
|
3870
|
+
alignItems: "center",
|
|
3871
|
+
position: "relative"
|
|
3872
|
+
},
|
|
3860
3873
|
children: [
|
|
3861
|
-
/* @__PURE__ */ (0,
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
onClick: () => {
|
|
3871
|
-
closeDialog();
|
|
3872
|
-
setTextareaValue(context.getValue());
|
|
3873
|
-
},
|
|
3874
|
-
children: "Cancel"
|
|
3875
|
-
})
|
|
3874
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3875
|
+
StyledTextField,
|
|
3876
|
+
__spreadValues(__spreadValues({
|
|
3877
|
+
id: field.name,
|
|
3878
|
+
onChange,
|
|
3879
|
+
ref
|
|
3880
|
+
}, field), getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error }))
|
|
3881
|
+
),
|
|
3882
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(IconButton, { variant: "ghost_icon", onClick: stopPropagation2(openDialog), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_eds_core_react26.Icon, { data: import_eds_icons9.arrow_up, size: 24, style: { transform: "rotateZ(45deg)" } }) })
|
|
3876
3883
|
]
|
|
3877
|
-
}
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3884
|
+
}
|
|
3885
|
+
),
|
|
3886
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
3887
|
+
import_eds_core_react26.Dialog,
|
|
3888
|
+
{
|
|
3889
|
+
open,
|
|
3890
|
+
onClose: () => {
|
|
3891
|
+
closeDialog();
|
|
3892
|
+
onChange(textareaValue);
|
|
3893
|
+
},
|
|
3894
|
+
isDismissable: true,
|
|
3895
|
+
style: { width: "min(50rem, calc(100vw - 4rem))" },
|
|
3896
|
+
children: [
|
|
3897
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_eds_core_react26.Dialog.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_eds_core_react26.Dialog.Title, { children: title }) }),
|
|
3898
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_eds_core_react26.Dialog.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3899
|
+
import_eds_core_react26.TextField,
|
|
3900
|
+
{
|
|
3901
|
+
style: {
|
|
3902
|
+
maxWidth: "100%",
|
|
3903
|
+
marginTop: "1rem"
|
|
3904
|
+
},
|
|
3905
|
+
id: field.name + "modal",
|
|
3906
|
+
multiline: true,
|
|
3907
|
+
rows: 8,
|
|
3908
|
+
name: field.name + "modal",
|
|
3909
|
+
value: textareaValue,
|
|
3910
|
+
onChange: (e) => {
|
|
3911
|
+
setTextareaValue(e.target.value);
|
|
3912
|
+
}
|
|
3913
|
+
}
|
|
3914
|
+
) }),
|
|
3915
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_eds_core_react26.Dialog.Actions, { style: { display: "flex", gap: "1rem" }, children: [
|
|
3916
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3917
|
+
import_eds_core_react26.Button,
|
|
3918
|
+
{
|
|
3919
|
+
onClick: () => {
|
|
3920
|
+
closeDialog();
|
|
3921
|
+
onChange(textareaValue);
|
|
3922
|
+
},
|
|
3923
|
+
children: "Submit"
|
|
3924
|
+
}
|
|
3925
|
+
),
|
|
3926
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3927
|
+
import_eds_core_react26.Button,
|
|
3928
|
+
{
|
|
3929
|
+
variant: "ghost",
|
|
3930
|
+
onClick: () => {
|
|
3931
|
+
closeDialog();
|
|
3932
|
+
setTextareaValue(context.getValue());
|
|
3933
|
+
},
|
|
3934
|
+
children: "Cancel"
|
|
3935
|
+
}
|
|
3936
|
+
)
|
|
3937
|
+
] })
|
|
3938
|
+
]
|
|
3939
|
+
}
|
|
3940
|
+
)
|
|
3941
|
+
] });
|
|
3942
|
+
}
|
|
3943
|
+
}
|
|
3944
|
+
);
|
|
3883
3945
|
}
|
|
3884
|
-
var StyledTextField = (0, import_styled_components19.default)(
|
|
3946
|
+
var StyledTextField = (0, import_styled_components19.default)(import_eds_core_react26.TextField)`
|
|
3885
3947
|
& input {
|
|
3886
3948
|
padding-right: 40px;
|
|
3887
3949
|
letter-spacing: 0;
|
|
@@ -3890,7 +3952,7 @@ var StyledTextField = (0, import_styled_components19.default)(import_eds_core_re
|
|
|
3890
3952
|
text-overflow: ellipsis;
|
|
3891
3953
|
}
|
|
3892
3954
|
`;
|
|
3893
|
-
var IconButton = (0, import_styled_components19.default)(
|
|
3955
|
+
var IconButton = (0, import_styled_components19.default)(import_eds_core_react26.Button)`
|
|
3894
3956
|
position: absolute;
|
|
3895
3957
|
height: 32px;
|
|
3896
3958
|
width: 32px;
|
|
@@ -3898,29 +3960,38 @@ var IconButton = (0, import_styled_components19.default)(import_eds_core_react24
|
|
|
3898
3960
|
`;
|
|
3899
3961
|
|
|
3900
3962
|
// src/form-cells/EditableTextFieldCell.tsx
|
|
3901
|
-
var
|
|
3963
|
+
var import_eds_core_react27 = require("@equinor/eds-core-react");
|
|
3902
3964
|
var import_react_hook_form7 = require("react-hook-form");
|
|
3903
3965
|
var import_styled_components20 = __toESM(require("styled-components"));
|
|
3904
|
-
var
|
|
3905
|
-
function EditableTextFieldCell(
|
|
3966
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3967
|
+
function EditableTextFieldCell(_a) {
|
|
3968
|
+
var _b = _a, {
|
|
3969
|
+
error: errorFromProps
|
|
3970
|
+
} = _b, context = __objRest(_b, [
|
|
3971
|
+
"error"
|
|
3972
|
+
]);
|
|
3906
3973
|
const editMode = useEditMode();
|
|
3907
3974
|
if (!editMode)
|
|
3908
|
-
return /* @__PURE__ */ (0,
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3975
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TypographyCustom, { truncate: true, children: context.getValue() });
|
|
3976
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3977
|
+
import_react_hook_form7.Controller,
|
|
3978
|
+
{
|
|
3979
|
+
name: context.column.id,
|
|
3980
|
+
render: (_a2) => {
|
|
3981
|
+
var _b2 = _a2, { field: _c } = _b2, _d = _c, { value } = _d, field = __objRest(_d, ["value"]), { fieldState: { error } } = _b2;
|
|
3982
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3983
|
+
InlineTextField3,
|
|
3984
|
+
__spreadValues(__spreadValues({
|
|
3985
|
+
id: context.column.id,
|
|
3986
|
+
autoComplete: "none",
|
|
3987
|
+
value: String(value != null ? value : "")
|
|
3988
|
+
}, field), getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error }))
|
|
3989
|
+
);
|
|
3990
|
+
}
|
|
3991
|
+
}
|
|
3992
|
+
);
|
|
3922
3993
|
}
|
|
3923
|
-
var InlineTextField3 = (0, import_styled_components20.default)(
|
|
3994
|
+
var InlineTextField3 = (0, import_styled_components20.default)(import_eds_core_react27.TextField)`
|
|
3924
3995
|
/*
|
|
3925
3996
|
TODO: Improve input based on feedback from UX
|
|
3926
3997
|
& > div {
|
|
@@ -3946,6 +4017,7 @@ var InlineTextField3 = (0, import_styled_components20.default)(import_eds_core_r
|
|
|
3946
4017
|
0 && (module.exports = {
|
|
3947
4018
|
AppShell,
|
|
3948
4019
|
AppSidebar,
|
|
4020
|
+
CheckboxCell,
|
|
3949
4021
|
ChipsCell,
|
|
3950
4022
|
ColumnSelect,
|
|
3951
4023
|
DataTable,
|