@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.mjs
CHANGED
|
@@ -1,9 +1,38 @@
|
|
|
1
1
|
var __create = Object.create;
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
8
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
9
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __objRest = (source, exclude) => {
|
|
25
|
+
var target = {};
|
|
26
|
+
for (var prop in source)
|
|
27
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
if (source != null && __getOwnPropSymbols)
|
|
30
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
31
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
32
|
+
target[prop] = source[prop];
|
|
33
|
+
}
|
|
34
|
+
return target;
|
|
35
|
+
};
|
|
7
36
|
var __commonJS = (cb, mod) => function __require() {
|
|
8
37
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
38
|
};
|
|
@@ -16,6 +45,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
45
|
return to;
|
|
17
46
|
};
|
|
18
47
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
48
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
49
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
50
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
51
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
19
52
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
20
53
|
mod
|
|
21
54
|
));
|
|
@@ -1007,7 +1040,11 @@ var require_arrayLikeKeys = __commonJS({
|
|
|
1007
1040
|
function arrayLikeKeys(value, inherited) {
|
|
1008
1041
|
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;
|
|
1009
1042
|
for (var key in value) {
|
|
1010
|
-
if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes &&
|
|
1043
|
+
if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
1044
|
+
(key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
1045
|
+
isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
1046
|
+
isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
|
|
1047
|
+
isIndex(key, length)))) {
|
|
1011
1048
|
result.push(key);
|
|
1012
1049
|
}
|
|
1013
1050
|
}
|
|
@@ -2345,33 +2382,16 @@ var Wrapper = styled.div`
|
|
|
2345
2382
|
max-width: 100%;
|
|
2346
2383
|
}
|
|
2347
2384
|
`;
|
|
2348
|
-
var AppShell = ({ children, icon, title, sidebar }) => /* @__PURE__ */ jsxs(Wrapper, {
|
|
2349
|
-
children: [
|
|
2350
|
-
/* @__PURE__ */ jsx(
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
children: title ?? "App Title"
|
|
2359
|
-
})
|
|
2360
|
-
]
|
|
2361
|
-
})
|
|
2362
|
-
}),
|
|
2363
|
-
/* @__PURE__ */ jsxs("div", {
|
|
2364
|
-
className: "--content-wrapper",
|
|
2365
|
-
children: [
|
|
2366
|
-
sidebar,
|
|
2367
|
-
/* @__PURE__ */ jsx("div", {
|
|
2368
|
-
className: "--content-outlet",
|
|
2369
|
-
children
|
|
2370
|
-
})
|
|
2371
|
-
]
|
|
2372
|
-
})
|
|
2373
|
-
]
|
|
2374
|
-
});
|
|
2385
|
+
var AppShell = ({ children, icon, title, sidebar }) => /* @__PURE__ */ jsxs(Wrapper, { children: [
|
|
2386
|
+
/* @__PURE__ */ jsx(TopBar, { sticky: false, children: /* @__PURE__ */ jsxs(TopBar.Header, { children: [
|
|
2387
|
+
/* @__PURE__ */ jsx(Icon, { data: icon != null ? icon : apps }),
|
|
2388
|
+
/* @__PURE__ */ jsx("span", { children: title != null ? title : "App Title" })
|
|
2389
|
+
] }) }),
|
|
2390
|
+
/* @__PURE__ */ jsxs("div", { className: "--content-wrapper", children: [
|
|
2391
|
+
sidebar,
|
|
2392
|
+
/* @__PURE__ */ jsx("div", { className: "--content-outlet", children })
|
|
2393
|
+
] })
|
|
2394
|
+
] });
|
|
2375
2395
|
|
|
2376
2396
|
// src/AppShell/AppSidebar.tsx
|
|
2377
2397
|
import { Button, Icon as Icon2 } from "@equinor/eds-core-react";
|
|
@@ -2408,25 +2428,34 @@ var Wrapper2 = styled2.div`
|
|
|
2408
2428
|
`;
|
|
2409
2429
|
function AppSidebar() {
|
|
2410
2430
|
const [collapsed, setCollapsed] = useState(false);
|
|
2411
|
-
return /* @__PURE__ */ jsx2(Wrapper2, {
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
className: "collapse-button
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
children:
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2431
|
+
return /* @__PURE__ */ jsx2(Wrapper2, { collapsed, children: /* @__PURE__ */ jsx2("div", { className: "collapse-button-wrapper", children: /* @__PURE__ */ jsxs2(
|
|
2432
|
+
Button,
|
|
2433
|
+
{
|
|
2434
|
+
className: "collapse-button",
|
|
2435
|
+
variant: collapsed ? "ghost_icon" : "ghost",
|
|
2436
|
+
onClick: () => setCollapsed(!collapsed),
|
|
2437
|
+
children: [
|
|
2438
|
+
/* @__PURE__ */ jsx2(Icon2, { data: collapsed ? last_page : first_page }),
|
|
2439
|
+
!collapsed && /* @__PURE__ */ jsx2("div", { children: "Collapse" })
|
|
2440
|
+
]
|
|
2441
|
+
}
|
|
2442
|
+
) }) });
|
|
2443
|
+
}
|
|
2444
|
+
|
|
2445
|
+
// src/cells/CheckboxCell.tsx
|
|
2446
|
+
import { Checkbox } from "@equinor/eds-core-react";
|
|
2447
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
2448
|
+
function CheckboxCell(context) {
|
|
2449
|
+
return /* @__PURE__ */ jsx3(
|
|
2450
|
+
Checkbox,
|
|
2451
|
+
{
|
|
2452
|
+
enterKeyHint: "next",
|
|
2453
|
+
"aria-label": "readonly",
|
|
2454
|
+
readOnly: true,
|
|
2455
|
+
checked: context.getValue(),
|
|
2456
|
+
disabled: true
|
|
2457
|
+
}
|
|
2458
|
+
);
|
|
2430
2459
|
}
|
|
2431
2460
|
|
|
2432
2461
|
// src/cells/ChipsCell.tsx
|
|
@@ -2450,7 +2479,7 @@ function stopPropagation(handler) {
|
|
|
2450
2479
|
}
|
|
2451
2480
|
|
|
2452
2481
|
// src/cells/ChipsCell.tsx
|
|
2453
|
-
import { jsx as
|
|
2482
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
2454
2483
|
var ChipsWrapper = styled3.div`
|
|
2455
2484
|
display: flex;
|
|
2456
2485
|
align-items: center;
|
|
@@ -2464,17 +2493,15 @@ var Chip = styled3.div`
|
|
|
2464
2493
|
line-height: 22px;
|
|
2465
2494
|
height: 22px;
|
|
2466
2495
|
padding: 0 6px;
|
|
2467
|
-
background-color: ${(props) =>
|
|
2496
|
+
background-color: ${(props) => {
|
|
2497
|
+
var _a;
|
|
2498
|
+
return (_a = props.backgroundColor) != null ? _a : tokens2.colors.ui.background__medium.hex;
|
|
2499
|
+
}};
|
|
2468
2500
|
color: darkslategrey;
|
|
2469
2501
|
`;
|
|
2470
2502
|
var ChipsCell = (props) => {
|
|
2471
2503
|
var _a;
|
|
2472
|
-
return /* @__PURE__ */
|
|
2473
|
-
children: (_a = props.values) == null ? void 0 : _a.map((value) => /* @__PURE__ */ jsx3(Chip, {
|
|
2474
|
-
backgroundColor: stringToHslColor(value),
|
|
2475
|
-
children: value
|
|
2476
|
-
}, value))
|
|
2477
|
-
});
|
|
2504
|
+
return /* @__PURE__ */ jsx4(ChipsWrapper, { children: (_a = props.values) == null ? void 0 : _a.map((value) => /* @__PURE__ */ jsx4(Chip, { backgroundColor: stringToHslColor(value), children: value }, value)) });
|
|
2478
2505
|
};
|
|
2479
2506
|
|
|
2480
2507
|
// src/cells/DynamicCell.tsx
|
|
@@ -2509,7 +2536,7 @@ var StickyHeaderCell = styled4(StickyCell)`
|
|
|
2509
2536
|
`;
|
|
2510
2537
|
|
|
2511
2538
|
// src/cells/DynamicCell.tsx
|
|
2512
|
-
import { jsx as
|
|
2539
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
2513
2540
|
var StyledStickyCell = styled5(StickyCell)`
|
|
2514
2541
|
background-color: ${({ backgroundColor: bg }) => bg ? `${bg} !important` : `inherit`};
|
|
2515
2542
|
`;
|
|
@@ -2520,32 +2547,48 @@ function DynamicCell({ cell, highlight, getStickyCellColor }) {
|
|
|
2520
2547
|
var _a;
|
|
2521
2548
|
const cellContent = flexRender(cell.column.columnDef.cell, cell.getContext());
|
|
2522
2549
|
if ((_a = cell.column.columnDef.meta) == null ? void 0 : _a.sticky) {
|
|
2523
|
-
return /* @__PURE__ */
|
|
2524
|
-
backgroundColor: getStickyCellColor == null ? void 0 : getStickyCellColor(cell),
|
|
2525
|
-
"data-column": cell.column.id,
|
|
2526
|
-
children: cellContent
|
|
2527
|
-
});
|
|
2550
|
+
return /* @__PURE__ */ jsx5(StyledStickyCell, { backgroundColor: getStickyCellColor == null ? void 0 : getStickyCellColor(cell), "data-column": cell.column.id, children: cellContent });
|
|
2528
2551
|
}
|
|
2529
|
-
return /* @__PURE__ */
|
|
2530
|
-
"data-column": cell.column.id,
|
|
2531
|
-
backgroundColor: highlight ? "#d5eaf4" : void 0,
|
|
2532
|
-
children: cellContent
|
|
2533
|
-
});
|
|
2552
|
+
return /* @__PURE__ */ jsx5(StyledCell, { "data-column": cell.column.id, backgroundColor: highlight ? "#d5eaf4" : void 0, children: cellContent });
|
|
2534
2553
|
}
|
|
2535
2554
|
|
|
2536
2555
|
// src/cells/HeaderCell.tsx
|
|
2537
|
-
import { Icon as Icon3, Table as
|
|
2556
|
+
import { Icon as Icon3, Table as EdsTable } from "@equinor/eds-core-react";
|
|
2538
2557
|
import { arrow_drop_down, arrow_drop_up } from "@equinor/eds-icons";
|
|
2558
|
+
import { tokens as tokens3 } from "@equinor/eds-tokens";
|
|
2539
2559
|
import { flexRender as flexRender2 } from "@tanstack/react-table";
|
|
2540
|
-
import styled6 from "styled-components";
|
|
2541
|
-
import { jsx as
|
|
2542
|
-
var
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2560
|
+
import styled6, { css as css3 } from "styled-components";
|
|
2561
|
+
import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
2562
|
+
var resizeCellStyle = css3`
|
|
2563
|
+
.resizer {
|
|
2564
|
+
position: absolute;
|
|
2565
|
+
right: 0;
|
|
2566
|
+
top: 0;
|
|
2567
|
+
height: 100%;
|
|
2568
|
+
width: 4px;
|
|
2569
|
+
opacity: 0;
|
|
2570
|
+
background: #aaa;
|
|
2571
|
+
cursor: col-resize;
|
|
2572
|
+
user-select: none;
|
|
2573
|
+
touch-action: none;
|
|
2574
|
+
}
|
|
2575
|
+
|
|
2576
|
+
.resizer.isResizing {
|
|
2577
|
+
background: ${tokens3.colors.interactive.focus.hex};
|
|
2578
|
+
opacity: 1;
|
|
2579
|
+
}
|
|
2580
|
+
|
|
2581
|
+
&:hover .resizer {
|
|
2582
|
+
opacity: 1;
|
|
2583
|
+
}
|
|
2547
2584
|
`;
|
|
2548
|
-
var
|
|
2585
|
+
var StickyCell2 = styled6(StickyHeaderCell)`
|
|
2586
|
+
${resizeCellStyle}
|
|
2587
|
+
`;
|
|
2588
|
+
var Cell2 = styled6(EdsTable.Cell)`
|
|
2589
|
+
${resizeCellStyle}
|
|
2590
|
+
`;
|
|
2591
|
+
var HeaderCell = ({ header, table }) => {
|
|
2549
2592
|
var _a;
|
|
2550
2593
|
const style = {
|
|
2551
2594
|
width: header.column.getSize(),
|
|
@@ -2558,39 +2601,40 @@ var HeaderCell = ({ header }) => {
|
|
|
2558
2601
|
colSpan: header.colSpan
|
|
2559
2602
|
};
|
|
2560
2603
|
if ((_a = header.column.columnDef.meta) == null ? void 0 : _a.sticky) {
|
|
2561
|
-
return /* @__PURE__ */
|
|
2562
|
-
...cellProps,
|
|
2563
|
-
children: /* @__PURE__ */ jsx5(HeaderContent, {
|
|
2564
|
-
header
|
|
2565
|
-
})
|
|
2566
|
-
}, header.id);
|
|
2604
|
+
return /* @__PURE__ */ jsx6(StickyCell2, __spreadProps(__spreadValues({}, cellProps), { children: /* @__PURE__ */ jsx6(HeaderContent, { header, table }) }), header.id);
|
|
2567
2605
|
}
|
|
2568
|
-
return /* @__PURE__ */
|
|
2569
|
-
...cellProps,
|
|
2570
|
-
children: /* @__PURE__ */ jsx5(HeaderContent, {
|
|
2571
|
-
header
|
|
2572
|
-
})
|
|
2573
|
-
}, header.id);
|
|
2606
|
+
return /* @__PURE__ */ jsx6(Cell2, __spreadProps(__spreadValues({}, cellProps), { children: /* @__PURE__ */ jsx6(HeaderContent, { header, table }) }), header.id);
|
|
2574
2607
|
};
|
|
2575
|
-
|
|
2608
|
+
var HeaderDiv = styled6.div`
|
|
2609
|
+
display: flex;
|
|
2610
|
+
align-items: center;
|
|
2611
|
+
gap: 0.25rem;
|
|
2612
|
+
z-index: 5;
|
|
2613
|
+
`;
|
|
2614
|
+
function HeaderContent({ header, table }) {
|
|
2615
|
+
var _a;
|
|
2576
2616
|
if (header.isPlaceholder)
|
|
2577
2617
|
return null;
|
|
2578
|
-
return /* @__PURE__ */ jsxs3(HeaderDiv, {
|
|
2579
|
-
|
|
2580
|
-
|
|
2618
|
+
return /* @__PURE__ */ jsxs3(HeaderDiv, { children: [
|
|
2619
|
+
flexRender2(header.column.columnDef.header, header.getContext()),
|
|
2620
|
+
(_a = {
|
|
2621
|
+
asc: /* @__PURE__ */ jsx6(Icon3, { data: arrow_drop_up }),
|
|
2622
|
+
desc: /* @__PURE__ */ jsx6(Icon3, { data: arrow_drop_down }),
|
|
2623
|
+
none: /* @__PURE__ */ jsx6(Icon3, { data: arrow_drop_down })
|
|
2624
|
+
}[header.column.getIsSorted()]) != null ? _a : null,
|
|
2625
|
+
table.options.enableColumnResizing && /* @__PURE__ */ jsx6(
|
|
2626
|
+
"div",
|
|
2581
2627
|
{
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
]
|
|
2593
|
-
});
|
|
2628
|
+
onMouseDown: header.getResizeHandler(),
|
|
2629
|
+
onTouchStart: header.getResizeHandler(),
|
|
2630
|
+
onClick: (e) => e.stopPropagation(),
|
|
2631
|
+
className: `resizer ${header.column.getIsResizing() ? "isResizing" : ""}`,
|
|
2632
|
+
style: {
|
|
2633
|
+
transform: table.options.columnResizeMode === "onEnd" && header.column.getIsResizing() ? `translateX(${table.getState().columnSizingInfo.deltaOffset}px)` : ""
|
|
2634
|
+
}
|
|
2635
|
+
}
|
|
2636
|
+
)
|
|
2637
|
+
] });
|
|
2594
2638
|
}
|
|
2595
2639
|
function getSort({ column }) {
|
|
2596
2640
|
if (!column.getCanSort())
|
|
@@ -2606,48 +2650,41 @@ function getSort({ column }) {
|
|
|
2606
2650
|
}
|
|
2607
2651
|
|
|
2608
2652
|
// src/cells/HierarchyCell.tsx
|
|
2609
|
-
import { tokens as
|
|
2610
|
-
import styled8, { css as
|
|
2653
|
+
import { tokens as tokens5 } from "@equinor/eds-tokens";
|
|
2654
|
+
import styled8, { css as css4 } from "styled-components";
|
|
2611
2655
|
|
|
2612
2656
|
// src/cells/TypographyCustom.tsx
|
|
2613
2657
|
import {
|
|
2614
2658
|
Typography as EdsTypography
|
|
2615
2659
|
} from "@equinor/eds-core-react";
|
|
2616
|
-
import { tokens as
|
|
2660
|
+
import { tokens as tokens4 } from "@equinor/eds-tokens";
|
|
2617
2661
|
import styled7 from "styled-components";
|
|
2618
|
-
import { jsx as
|
|
2662
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
2619
2663
|
var truncateStyle = {
|
|
2620
2664
|
overflow: "hidden",
|
|
2621
2665
|
whiteSpace: "nowrap",
|
|
2622
2666
|
textOverflow: "ellipsis"
|
|
2623
2667
|
};
|
|
2624
2668
|
var TypographyCustom = (props) => {
|
|
2625
|
-
const { truncate, enableShowAllOnHover, style: styleFromProps,
|
|
2669
|
+
const _a = props, { truncate, enableShowAllOnHover, style: styleFromProps } = _a, edsTypographyProps = __objRest(_a, ["truncate", "enableShowAllOnHover", "style"]);
|
|
2626
2670
|
if (enableShowAllOnHover)
|
|
2627
|
-
return /* @__PURE__ */
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
style: {
|
|
2631
|
-
...styleFromProps,
|
|
2632
|
-
...truncateStyle
|
|
2633
|
-
}
|
|
2671
|
+
return /* @__PURE__ */ jsx7(HoverCapture, { children: /* @__PURE__ */ jsx7(
|
|
2672
|
+
EdsTypography,
|
|
2673
|
+
__spreadProps(__spreadValues({}, edsTypographyProps), {
|
|
2674
|
+
style: __spreadValues(__spreadValues({}, styleFromProps), truncateStyle)
|
|
2634
2675
|
})
|
|
2635
|
-
});
|
|
2676
|
+
) });
|
|
2636
2677
|
if (truncate)
|
|
2637
|
-
return /* @__PURE__ */
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
return /* @__PURE__ */ jsx6(EdsTypography, {
|
|
2645
|
-
...edsTypographyProps,
|
|
2646
|
-
style: styleFromProps
|
|
2647
|
-
});
|
|
2678
|
+
return /* @__PURE__ */ jsx7(
|
|
2679
|
+
EdsTypography,
|
|
2680
|
+
__spreadProps(__spreadValues({}, edsTypographyProps), {
|
|
2681
|
+
style: __spreadValues(__spreadValues({}, styleFromProps), truncateStyle)
|
|
2682
|
+
})
|
|
2683
|
+
);
|
|
2684
|
+
return /* @__PURE__ */ jsx7(EdsTypography, __spreadProps(__spreadValues({}, edsTypographyProps), { style: styleFromProps }));
|
|
2648
2685
|
};
|
|
2649
2686
|
var HoverCapture = styled7.div`
|
|
2650
|
-
height: ${
|
|
2687
|
+
height: ${tokens4.typography.table.cell_text.lineHeight};
|
|
2651
2688
|
background-color: inherit;
|
|
2652
2689
|
|
|
2653
2690
|
position: relative;
|
|
@@ -2673,7 +2710,7 @@ var HoverCapture = styled7.div`
|
|
|
2673
2710
|
`;
|
|
2674
2711
|
|
|
2675
2712
|
// src/cells/HierarchyCell.tsx
|
|
2676
|
-
import { jsx as
|
|
2713
|
+
import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2677
2714
|
var CellWrapper = styled8(TypographyCustom)`
|
|
2678
2715
|
height: 100%;
|
|
2679
2716
|
display: flex;
|
|
@@ -2681,51 +2718,55 @@ var CellWrapper = styled8(TypographyCustom)`
|
|
|
2681
2718
|
|
|
2682
2719
|
${({ depth, expanded }) => expanded && depth === 0 && "font-weight: bold;"}
|
|
2683
2720
|
|
|
2684
|
-
${({ depth }) => depth > 0 &&
|
|
2685
|
-
border-left: 3px solid ${
|
|
2721
|
+
${({ depth }) => depth > 0 && css4`
|
|
2722
|
+
border-left: 3px solid ${tokens5.colors.infographic.primary__moss_green_34.hex};
|
|
2686
2723
|
gap: 0.5rem;
|
|
2687
2724
|
.--divider {
|
|
2688
2725
|
width: ${depth * 32}px;
|
|
2689
|
-
background-color: ${
|
|
2726
|
+
background-color: ${tokens5.colors.infographic.primary__moss_green_34.hex};
|
|
2690
2727
|
height: 3px;
|
|
2691
2728
|
border-radius: 0 5px 5px 0;
|
|
2692
2729
|
}
|
|
2693
2730
|
`}
|
|
2694
2731
|
`;
|
|
2695
2732
|
function HierarchyCell(cell, options = {}) {
|
|
2696
|
-
var _a, _b;
|
|
2697
|
-
return /* @__PURE__ */ jsxs4(
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2733
|
+
var _a, _b, _c, _d;
|
|
2734
|
+
return /* @__PURE__ */ jsxs4(
|
|
2735
|
+
CellWrapper,
|
|
2736
|
+
{
|
|
2737
|
+
depth: (_b = (_a = options.getRowDepth) == null ? void 0 : _a.call(options)) != null ? _b : cell.row.depth,
|
|
2738
|
+
expanded: cell.row.getIsExpanded(),
|
|
2739
|
+
children: [
|
|
2740
|
+
/* @__PURE__ */ jsx8("span", { className: "--divider" }),
|
|
2741
|
+
(_d = (_c = options.getDisplayName) == null ? void 0 : _c.call(options)) != null ? _d : cell.getValue()
|
|
2742
|
+
]
|
|
2743
|
+
}
|
|
2744
|
+
);
|
|
2707
2745
|
}
|
|
2708
2746
|
|
|
2709
2747
|
// src/cells/PopoverCell.tsx
|
|
2710
2748
|
import { Popover, Typography } from "@equinor/eds-core-react";
|
|
2711
2749
|
import { useRef, useState as useState2 } from "react";
|
|
2712
|
-
import { jsx as
|
|
2750
|
+
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
2713
2751
|
function PopoverCell(props) {
|
|
2752
|
+
var _a, _b;
|
|
2714
2753
|
const [open, setOpen] = useState2(false);
|
|
2715
2754
|
const anchorRef = useRef(null);
|
|
2716
2755
|
const handleClick = () => setOpen(!open);
|
|
2717
2756
|
const handleClose = () => setOpen(false);
|
|
2718
|
-
return /* @__PURE__ */ jsxs5("div", {
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
/* @__PURE__ */ jsx8(TypographyCustom, {
|
|
2757
|
+
return /* @__PURE__ */ jsxs5("div", { style: { position: "relative" }, ref: anchorRef, children: [
|
|
2758
|
+
/* @__PURE__ */ jsx9(
|
|
2759
|
+
TypographyCustom,
|
|
2760
|
+
{
|
|
2723
2761
|
onClick: stopPropagation(handleClick),
|
|
2724
2762
|
style: { cursor: "pointer" },
|
|
2725
2763
|
truncate: true,
|
|
2726
|
-
children: String(props.value)
|
|
2727
|
-
}
|
|
2728
|
-
|
|
2764
|
+
children: String((_a = props.value) != null ? _a : "")
|
|
2765
|
+
}
|
|
2766
|
+
),
|
|
2767
|
+
/* @__PURE__ */ jsxs5(
|
|
2768
|
+
Popover,
|
|
2769
|
+
{
|
|
2729
2770
|
id: props.id,
|
|
2730
2771
|
open,
|
|
2731
2772
|
"aria-controls": "expand cell",
|
|
@@ -2733,27 +2774,19 @@ function PopoverCell(props) {
|
|
|
2733
2774
|
onClose: handleClose,
|
|
2734
2775
|
placement: "bottom",
|
|
2735
2776
|
children: [
|
|
2736
|
-
props.title && /* @__PURE__ */
|
|
2737
|
-
|
|
2738
|
-
children: props.title
|
|
2739
|
-
})
|
|
2740
|
-
}),
|
|
2741
|
-
/* @__PURE__ */ jsx8(Popover.Content, {
|
|
2742
|
-
children: /* @__PURE__ */ jsx8(Typography, {
|
|
2743
|
-
children: String(props.value)
|
|
2744
|
-
})
|
|
2745
|
-
})
|
|
2777
|
+
props.title && /* @__PURE__ */ jsx9(Popover.Title, { children: /* @__PURE__ */ jsx9(Popover.Header, { children: props.title }) }),
|
|
2778
|
+
/* @__PURE__ */ jsx9(Popover.Content, { children: /* @__PURE__ */ jsx9(Typography, { children: String((_b = props.value) != null ? _b : "") }) })
|
|
2746
2779
|
]
|
|
2747
|
-
}
|
|
2748
|
-
|
|
2749
|
-
});
|
|
2780
|
+
}
|
|
2781
|
+
)
|
|
2782
|
+
] });
|
|
2750
2783
|
}
|
|
2751
2784
|
|
|
2752
2785
|
// src/cells/SelectColumnDef.tsx
|
|
2753
|
-
import { Button as Button2, Checkbox, Icon as Icon4, Radio } from "@equinor/eds-core-react";
|
|
2786
|
+
import { Button as Button2, Checkbox as Checkbox2, Icon as Icon4, Radio } from "@equinor/eds-core-react";
|
|
2754
2787
|
import { chevron_down, chevron_up } from "@equinor/eds-icons";
|
|
2755
2788
|
import styled9 from "styled-components";
|
|
2756
|
-
import { Fragment, jsx as
|
|
2789
|
+
import { Fragment, jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2757
2790
|
var CellWrapper2 = styled9.div`
|
|
2758
2791
|
display: flex;
|
|
2759
2792
|
align-items: center;
|
|
@@ -2766,50 +2799,52 @@ function SelectColumnDef(props) {
|
|
|
2766
2799
|
return {
|
|
2767
2800
|
id: "select",
|
|
2768
2801
|
size: props.includeExpansionButton ? 96 : 48,
|
|
2769
|
-
header: ({ table }) => selectionMode !== "single" ? /* @__PURE__ */
|
|
2770
|
-
|
|
2802
|
+
header: ({ table }) => selectionMode !== "single" ? /* @__PURE__ */ jsx10(CellWrapper2, { children: /* @__PURE__ */ jsx10(
|
|
2803
|
+
Checkbox2,
|
|
2804
|
+
{
|
|
2771
2805
|
checked: table.getIsAllRowsSelected(),
|
|
2772
2806
|
indeterminate: table.getIsSomeRowsSelected(),
|
|
2773
2807
|
"aria-label": table.getIsAllRowsSelected() ? "Deselect all rows" : "Select all rows",
|
|
2774
2808
|
onChange: table.getIsSomeRowsSelected() ? () => table.toggleAllRowsSelected(false) : table.getToggleAllRowsSelectedHandler()
|
|
2775
|
-
}
|
|
2776
|
-
}) : null,
|
|
2809
|
+
}
|
|
2810
|
+
) }) : null,
|
|
2777
2811
|
cell: ({ table, row }) => {
|
|
2778
2812
|
const paddingLeft = "0px";
|
|
2779
|
-
return /* @__PURE__ */
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
}
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2813
|
+
return /* @__PURE__ */ jsx10(CellWrapper2, { paddingLeft, rowDepth: row.depth, children: /* @__PURE__ */ jsxs6(Fragment, { children: [
|
|
2814
|
+
selectionMode === "single" ? /* @__PURE__ */ jsx10(
|
|
2815
|
+
Radio,
|
|
2816
|
+
{
|
|
2817
|
+
checked: row.getIsSelected(),
|
|
2818
|
+
"aria-label": `Select row ${row.id}`,
|
|
2819
|
+
onChange: stopPropagation(row.getToggleSelectedHandler())
|
|
2820
|
+
}
|
|
2821
|
+
) : /* @__PURE__ */ jsx10(
|
|
2822
|
+
Checkbox2,
|
|
2823
|
+
{
|
|
2824
|
+
checked: row.getIsSelected(),
|
|
2825
|
+
indeterminate: row.getIsSomeSelected(),
|
|
2826
|
+
"aria-label": `Select row ${row.id}`,
|
|
2827
|
+
onChange: stopPropagation(row.getToggleSelectedHandler())
|
|
2828
|
+
}
|
|
2829
|
+
),
|
|
2830
|
+
row.getCanExpand() && table.options.enableExpanding && /* @__PURE__ */ jsx10(
|
|
2831
|
+
Button2,
|
|
2832
|
+
{
|
|
2833
|
+
variant: "ghost_icon",
|
|
2834
|
+
color: "secondary",
|
|
2835
|
+
"aria-label": row.getIsExpanded() ? "Close group" : "Expand group",
|
|
2836
|
+
onClick: stopPropagation(row.getToggleExpandedHandler()),
|
|
2837
|
+
style: { cursor: "pointer" },
|
|
2838
|
+
children: /* @__PURE__ */ jsx10(Icon4, { data: row.getIsExpanded() ? chevron_up : chevron_down })
|
|
2839
|
+
}
|
|
2840
|
+
)
|
|
2841
|
+
] }) });
|
|
2807
2842
|
}
|
|
2808
2843
|
};
|
|
2809
2844
|
}
|
|
2810
2845
|
|
|
2811
2846
|
// src/DataTable/components/ColumnSelect.tsx
|
|
2812
|
-
import { Button as Button3, Checkbox as
|
|
2847
|
+
import { Button as Button3, Checkbox as Checkbox3, Divider, Icon as Icon5, Popover as Popover2, Tooltip } from "@equinor/eds-core-react";
|
|
2813
2848
|
import { close, view_column } from "@equinor/eds-icons";
|
|
2814
2849
|
import { useRef as useRef2, useState as useState3 } from "react";
|
|
2815
2850
|
import styled10 from "styled-components";
|
|
@@ -2844,7 +2879,7 @@ function getFunctionValueOrDefault(valueOrFn, fnProps, defaultValue) {
|
|
|
2844
2879
|
}
|
|
2845
2880
|
|
|
2846
2881
|
// src/DataTable/components/ColumnSelect.tsx
|
|
2847
|
-
import { Fragment as Fragment2, jsx as
|
|
2882
|
+
import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2848
2883
|
var ColumnSelectContent = styled10.div`
|
|
2849
2884
|
display: grid;
|
|
2850
2885
|
grid-template-columns: repeat(2, 1fr);
|
|
@@ -2860,92 +2895,76 @@ function ColumnSelect({ table }) {
|
|
|
2860
2895
|
const [isOpen, setIsOpen] = useState3(false);
|
|
2861
2896
|
const referenceElement = useRef2(null);
|
|
2862
2897
|
const selectableColumns = table.getAllLeafColumns().filter((column) => column.id !== "select");
|
|
2863
|
-
return /* @__PURE__ */ jsxs7(Fragment2, {
|
|
2864
|
-
children:
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
})
|
|
2881
|
-
}),
|
|
2882
|
-
/* @__PURE__ */ jsxs7(Popover2, {
|
|
2898
|
+
return /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
2899
|
+
/* @__PURE__ */ jsx11(Tooltip, { title: "Select columns", placement: "left", children: /* @__PURE__ */ jsx11(
|
|
2900
|
+
Button3,
|
|
2901
|
+
{
|
|
2902
|
+
"aria-haspopup": true,
|
|
2903
|
+
id: "column-select-anchor",
|
|
2904
|
+
"aria-controls": "column-select-popover",
|
|
2905
|
+
"aria-expanded": isOpen,
|
|
2906
|
+
ref: referenceElement,
|
|
2907
|
+
variant: "ghost_icon",
|
|
2908
|
+
onClick: () => setIsOpen(true),
|
|
2909
|
+
children: /* @__PURE__ */ jsx11(Icon5, { name: "view_column", data: view_column })
|
|
2910
|
+
}
|
|
2911
|
+
) }),
|
|
2912
|
+
/* @__PURE__ */ jsxs7(
|
|
2913
|
+
Popover2,
|
|
2914
|
+
{
|
|
2883
2915
|
open: isOpen,
|
|
2884
2916
|
id: "column-select-popover",
|
|
2885
2917
|
anchorEl: referenceElement.current,
|
|
2886
2918
|
placement: "bottom-end",
|
|
2887
2919
|
onClose: () => setIsOpen(false),
|
|
2888
2920
|
children: [
|
|
2889
|
-
/* @__PURE__ */ jsxs7(Popover2.Header, {
|
|
2890
|
-
children:
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
/* @__PURE__ */ jsx10(Button3, {
|
|
2921
|
+
/* @__PURE__ */ jsxs7(Popover2.Header, { children: [
|
|
2922
|
+
/* @__PURE__ */ jsx11(Popover2.Title, { children: "Column settings" }),
|
|
2923
|
+
/* @__PURE__ */ jsx11(
|
|
2924
|
+
Button3,
|
|
2925
|
+
{
|
|
2895
2926
|
variant: "ghost_icon",
|
|
2896
2927
|
"aria-label": "Close column select",
|
|
2897
2928
|
onClick: () => setIsOpen(false),
|
|
2898
|
-
children: /* @__PURE__ */
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
children: "Reset to default"
|
|
2927
|
-
})
|
|
2928
|
-
})
|
|
2929
|
-
]
|
|
2930
|
-
})
|
|
2929
|
+
children: /* @__PURE__ */ jsx11(Icon5, { name: "close", data: close, size: 24 })
|
|
2930
|
+
}
|
|
2931
|
+
)
|
|
2932
|
+
] }),
|
|
2933
|
+
/* @__PURE__ */ jsxs7(Popover2.Content, { children: [
|
|
2934
|
+
/* @__PURE__ */ jsx11(ColumnSelectContent, { children: selectableColumns.map((column) => {
|
|
2935
|
+
return /* @__PURE__ */ jsx11(
|
|
2936
|
+
Checkbox3,
|
|
2937
|
+
{
|
|
2938
|
+
checked: column.getIsVisible(),
|
|
2939
|
+
label: getColumnHeader(column),
|
|
2940
|
+
onChange: column.getToggleVisibilityHandler()
|
|
2941
|
+
},
|
|
2942
|
+
column.id
|
|
2943
|
+
);
|
|
2944
|
+
}) }),
|
|
2945
|
+
/* @__PURE__ */ jsx11(Divider, { variant: "small" }),
|
|
2946
|
+
/* @__PURE__ */ jsx11(ActionsWrapper, { children: /* @__PURE__ */ jsx11(
|
|
2947
|
+
Button3,
|
|
2948
|
+
{
|
|
2949
|
+
color: "secondary",
|
|
2950
|
+
variant: "ghost",
|
|
2951
|
+
disabled: table.getIsAllColumnsVisible(),
|
|
2952
|
+
onClick: () => table.toggleAllColumnsVisible(true),
|
|
2953
|
+
children: "Reset to default"
|
|
2954
|
+
}
|
|
2955
|
+
) })
|
|
2956
|
+
] })
|
|
2931
2957
|
]
|
|
2932
|
-
}
|
|
2933
|
-
|
|
2934
|
-
});
|
|
2958
|
+
}
|
|
2959
|
+
)
|
|
2960
|
+
] });
|
|
2935
2961
|
}
|
|
2936
2962
|
|
|
2937
2963
|
// src/DataTable/components/TableHeader.tsx
|
|
2938
2964
|
import { Table as Table4 } from "@equinor/eds-core-react";
|
|
2939
|
-
import { jsx as
|
|
2965
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
2940
2966
|
function TableHeader({ table, sticky }) {
|
|
2941
|
-
return /* @__PURE__ */
|
|
2942
|
-
sticky,
|
|
2943
|
-
children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx11(Table4.Row, {
|
|
2944
|
-
children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx11(HeaderCell, {
|
|
2945
|
-
header
|
|
2946
|
-
}, header.id))
|
|
2947
|
-
}, headerGroup.id))
|
|
2948
|
-
});
|
|
2967
|
+
return /* @__PURE__ */ jsx12(Table4.Head, { sticky, children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx12(Table4.Row, { children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx12(HeaderCell, { header, table }, header.id)) }, headerGroup.id)) });
|
|
2949
2968
|
}
|
|
2950
2969
|
|
|
2951
2970
|
// src/DataTable/DataTable.tsx
|
|
@@ -2960,29 +2979,18 @@ import { useEffect as useEffect3, useRef as useRef3, useState as useState6 } fro
|
|
|
2960
2979
|
import styled16 from "styled-components";
|
|
2961
2980
|
|
|
2962
2981
|
// src/DataTable/components/BasicTable.tsx
|
|
2963
|
-
import { Table as
|
|
2982
|
+
import { Table as EdsTable2 } from "@equinor/eds-core-react";
|
|
2964
2983
|
|
|
2965
2984
|
// src/DataTable/components/PlaceholderRow.tsx
|
|
2966
2985
|
import { DotProgress, Table as Table5, Typography as Typography2 } from "@equinor/eds-core-react";
|
|
2967
2986
|
import styled11 from "styled-components";
|
|
2968
|
-
import { jsx as
|
|
2987
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
2969
2988
|
var PlaceholderTextWrapper = styled11.div`
|
|
2970
2989
|
display: flex;
|
|
2971
2990
|
justify-content: center;
|
|
2972
2991
|
`;
|
|
2973
2992
|
function PlaceholderRow({ isLoading }) {
|
|
2974
|
-
return /* @__PURE__ */
|
|
2975
|
-
children: /* @__PURE__ */ jsx12(Table5.Cell, {
|
|
2976
|
-
colSpan: 100,
|
|
2977
|
-
children: /* @__PURE__ */ jsx12(PlaceholderTextWrapper, {
|
|
2978
|
-
children: isLoading ? /* @__PURE__ */ jsx12(DotProgress, {
|
|
2979
|
-
color: "primary"
|
|
2980
|
-
}) : /* @__PURE__ */ jsx12(Typography2, {
|
|
2981
|
-
children: "No data available"
|
|
2982
|
-
})
|
|
2983
|
-
})
|
|
2984
|
-
})
|
|
2985
|
-
});
|
|
2993
|
+
return /* @__PURE__ */ jsx13(Table5.Row, { children: /* @__PURE__ */ jsx13(Table5.Cell, { colSpan: 100, children: /* @__PURE__ */ jsx13(PlaceholderTextWrapper, { children: isLoading ? /* @__PURE__ */ jsx13(DotProgress, { color: "primary" }) : /* @__PURE__ */ jsx13(Typography2, { children: "No data available" }) }) }) });
|
|
2986
2994
|
}
|
|
2987
2995
|
|
|
2988
2996
|
// src/DataTable/components/TableBody.tsx
|
|
@@ -2997,7 +3005,7 @@ var TableBody = styled12(Table6.Body)`
|
|
|
2997
3005
|
// src/DataTable/components/TableRow.tsx
|
|
2998
3006
|
import { Table as Table7 } from "@equinor/eds-core-react";
|
|
2999
3007
|
import styled13 from "styled-components";
|
|
3000
|
-
import { jsx as
|
|
3008
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
3001
3009
|
function TableRow({
|
|
3002
3010
|
row,
|
|
3003
3011
|
rowConfig,
|
|
@@ -3007,29 +3015,36 @@ function TableRow({
|
|
|
3007
3015
|
}) {
|
|
3008
3016
|
var _a;
|
|
3009
3017
|
const rowWrapper = rowConfig == null ? void 0 : rowConfig.rowWrapper;
|
|
3010
|
-
const tableRowContent = /* @__PURE__ */
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3018
|
+
const tableRowContent = /* @__PURE__ */ jsx14(
|
|
3019
|
+
StyledTableRow,
|
|
3020
|
+
{
|
|
3021
|
+
active: row.getIsSelected(),
|
|
3022
|
+
"data-index": index,
|
|
3023
|
+
ref: measureElement,
|
|
3024
|
+
style: {
|
|
3025
|
+
cursor: (rowConfig == null ? void 0 : rowConfig.onClick) ? "pointer" : "initial",
|
|
3026
|
+
backgroundColor: (_a = rowConfig == null ? void 0 : rowConfig.getRowBackground) == null ? void 0 : _a.call(rowConfig, row)
|
|
3027
|
+
},
|
|
3028
|
+
onClick: () => {
|
|
3029
|
+
var _a2;
|
|
3030
|
+
return (_a2 = rowConfig == null ? void 0 : rowConfig.onClick) == null ? void 0 : _a2.call(rowConfig, row);
|
|
3031
|
+
},
|
|
3032
|
+
onMouseEnter: handleRowEvent(row, rowConfig == null ? void 0 : rowConfig.onMouseEnter),
|
|
3033
|
+
onMouseLeave: handleRowEvent(row, rowConfig == null ? void 0 : rowConfig.onMouseLeave),
|
|
3034
|
+
children: row.getVisibleCells().map((cell) => {
|
|
3035
|
+
var _a2;
|
|
3036
|
+
return /* @__PURE__ */ jsx14(
|
|
3037
|
+
DynamicCell,
|
|
3038
|
+
{
|
|
3039
|
+
cell,
|
|
3040
|
+
getStickyCellColor: cellConfig == null ? void 0 : cellConfig.getStickyCellColor,
|
|
3041
|
+
highlight: (_a2 = cellConfig == null ? void 0 : cellConfig.getShouldHighlight) == null ? void 0 : _a2.call(cellConfig, cell)
|
|
3042
|
+
},
|
|
3043
|
+
cell.id
|
|
3044
|
+
);
|
|
3045
|
+
})
|
|
3046
|
+
}
|
|
3047
|
+
);
|
|
3033
3048
|
return rowWrapper ? rowWrapper({ row, children: tableRowContent }) : tableRowContent;
|
|
3034
3049
|
}
|
|
3035
3050
|
var StyledTableRow = styled13(Table7.Row)`
|
|
@@ -3045,7 +3060,7 @@ function handleRowEvent(row, handler) {
|
|
|
3045
3060
|
}
|
|
3046
3061
|
|
|
3047
3062
|
// src/DataTable/components/BasicTable.tsx
|
|
3048
|
-
import { jsx as
|
|
3063
|
+
import { jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3049
3064
|
function BasicTable({
|
|
3050
3065
|
table,
|
|
3051
3066
|
rowConfig,
|
|
@@ -3055,27 +3070,11 @@ function BasicTable({
|
|
|
3055
3070
|
tableCaption
|
|
3056
3071
|
}) {
|
|
3057
3072
|
const tableRows = table.getRowModel().rows;
|
|
3058
|
-
return /* @__PURE__ */ jsxs8(
|
|
3059
|
-
children:
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
}),
|
|
3064
|
-
/* @__PURE__ */ jsx14(TableHeader, {
|
|
3065
|
-
sticky: stickyHeader,
|
|
3066
|
-
table
|
|
3067
|
-
}),
|
|
3068
|
-
/* @__PURE__ */ jsx14(TableBody, {
|
|
3069
|
-
children: tableRows.length ? tableRows.map((row) => /* @__PURE__ */ jsx14(TableRow, {
|
|
3070
|
-
row,
|
|
3071
|
-
rowConfig,
|
|
3072
|
-
cellConfig
|
|
3073
|
-
}, row.id)) : /* @__PURE__ */ jsx14(PlaceholderRow, {
|
|
3074
|
-
isLoading
|
|
3075
|
-
})
|
|
3076
|
-
})
|
|
3077
|
-
]
|
|
3078
|
-
});
|
|
3073
|
+
return /* @__PURE__ */ jsxs8(EdsTable2, { children: [
|
|
3074
|
+
/* @__PURE__ */ jsx15(EdsTable2.Caption, { hidden: true, children: tableCaption }),
|
|
3075
|
+
/* @__PURE__ */ jsx15(TableHeader, { sticky: stickyHeader, table }),
|
|
3076
|
+
/* @__PURE__ */ jsx15(TableBody, { children: tableRows.length ? tableRows.map((row) => /* @__PURE__ */ jsx15(TableRow, { row, rowConfig, cellConfig }, row.id)) : /* @__PURE__ */ jsx15(PlaceholderRow, { isLoading }) })
|
|
3077
|
+
] });
|
|
3079
3078
|
}
|
|
3080
3079
|
|
|
3081
3080
|
// src/DataTable/components/DataTableHeader.tsx
|
|
@@ -3088,7 +3087,7 @@ import { Button as Button4, Icon as Icon6, Input, Tooltip as Tooltip2 } from "@e
|
|
|
3088
3087
|
import { close as close2 } from "@equinor/eds-icons";
|
|
3089
3088
|
import { useEffect, useState as useState4 } from "react";
|
|
3090
3089
|
import styled14 from "styled-components";
|
|
3091
|
-
import { jsx as
|
|
3090
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
3092
3091
|
var Wrapper3 = styled14.div`
|
|
3093
3092
|
width: 200px;
|
|
3094
3093
|
`;
|
|
@@ -3096,13 +3095,18 @@ var CloseButton = styled14(Button4)`
|
|
|
3096
3095
|
width: 24px;
|
|
3097
3096
|
height: 24px;
|
|
3098
3097
|
`;
|
|
3099
|
-
function DebouncedInput({
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
}
|
|
3098
|
+
function DebouncedInput(_a) {
|
|
3099
|
+
var _b = _a, {
|
|
3100
|
+
value: initialValue,
|
|
3101
|
+
onChange,
|
|
3102
|
+
icon,
|
|
3103
|
+
debounce = 500
|
|
3104
|
+
} = _b, props = __objRest(_b, [
|
|
3105
|
+
"value",
|
|
3106
|
+
"onChange",
|
|
3107
|
+
"icon",
|
|
3108
|
+
"debounce"
|
|
3109
|
+
]);
|
|
3106
3110
|
const [value, setValue] = useState4(initialValue);
|
|
3107
3111
|
useEffect(() => {
|
|
3108
3112
|
setValue(initialValue);
|
|
@@ -3113,30 +3117,15 @@ function DebouncedInput({
|
|
|
3113
3117
|
}, debounce);
|
|
3114
3118
|
return () => clearTimeout(timeout);
|
|
3115
3119
|
}, [value]);
|
|
3116
|
-
return /* @__PURE__ */
|
|
3117
|
-
|
|
3118
|
-
|
|
3120
|
+
return /* @__PURE__ */ jsx16(Wrapper3, { children: /* @__PURE__ */ jsx16(
|
|
3121
|
+
Input,
|
|
3122
|
+
__spreadProps(__spreadValues({}, props), {
|
|
3119
3123
|
value,
|
|
3120
|
-
leftAdornments: icon && /* @__PURE__ */
|
|
3121
|
-
|
|
3122
|
-
data: icon,
|
|
3123
|
-
size: 18
|
|
3124
|
-
}),
|
|
3125
|
-
rightAdornments: !!value && /* @__PURE__ */ jsx15(Tooltip2, {
|
|
3126
|
-
title: "Clear input",
|
|
3127
|
-
children: /* @__PURE__ */ jsx15(CloseButton, {
|
|
3128
|
-
variant: "ghost_icon",
|
|
3129
|
-
onClick: () => setValue(""),
|
|
3130
|
-
children: /* @__PURE__ */ jsx15(Icon6, {
|
|
3131
|
-
name: close2.name,
|
|
3132
|
-
data: close2,
|
|
3133
|
-
size: 18
|
|
3134
|
-
})
|
|
3135
|
-
})
|
|
3136
|
-
}),
|
|
3124
|
+
leftAdornments: icon && /* @__PURE__ */ jsx16(Icon6, { name: icon.name, data: icon, size: 18 }),
|
|
3125
|
+
rightAdornments: !!value && /* @__PURE__ */ jsx16(Tooltip2, { title: "Clear input", children: /* @__PURE__ */ jsx16(CloseButton, { variant: "ghost_icon", onClick: () => setValue(""), children: /* @__PURE__ */ jsx16(Icon6, { name: close2.name, data: close2, size: 18 }) }) }),
|
|
3137
3126
|
onChange: (event) => setValue(event.target.value)
|
|
3138
3127
|
})
|
|
3139
|
-
});
|
|
3128
|
+
) });
|
|
3140
3129
|
}
|
|
3141
3130
|
|
|
3142
3131
|
// src/DataTable/filters/functions.ts
|
|
@@ -3150,7 +3139,7 @@ var fuzzyFilter = (row, columnId, value, addMeta) => {
|
|
|
3150
3139
|
};
|
|
3151
3140
|
|
|
3152
3141
|
// src/DataTable/components/DataTableHeader.tsx
|
|
3153
|
-
import { Fragment as Fragment3, jsx as
|
|
3142
|
+
import { Fragment as Fragment3, jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3154
3143
|
var TableBannerWrapper = styled15.div`
|
|
3155
3144
|
display: flex;
|
|
3156
3145
|
align-items: center;
|
|
@@ -3170,49 +3159,33 @@ function TableBanner({
|
|
|
3170
3159
|
tableCaption,
|
|
3171
3160
|
globalFilter
|
|
3172
3161
|
}) {
|
|
3173
|
-
var _a;
|
|
3174
|
-
return /* @__PURE__ */ jsxs9(TableBannerWrapper, {
|
|
3175
|
-
className: "--
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
(
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
table
|
|
3201
|
-
}),
|
|
3202
|
-
(bannerConfig == null ? void 0 : bannerConfig.totalRowCount) && /* @__PURE__ */ jsxs9("span", {
|
|
3203
|
-
children: [
|
|
3204
|
-
table.options.data.length.toLocaleString(),
|
|
3205
|
-
" /",
|
|
3206
|
-
" ",
|
|
3207
|
-
bannerConfig.totalRowCount.toLocaleString(),
|
|
3208
|
-
" rows"
|
|
3209
|
-
]
|
|
3210
|
-
})
|
|
3211
|
-
]
|
|
3212
|
-
})
|
|
3213
|
-
})
|
|
3214
|
-
]
|
|
3215
|
-
});
|
|
3162
|
+
var _a, _b, _c, _d, _e;
|
|
3163
|
+
return /* @__PURE__ */ jsxs9(TableBannerWrapper, { className: "--table-caption", padding: bannerConfig == null ? void 0 : bannerConfig.padding, children: [
|
|
3164
|
+
/* @__PURE__ */ jsxs9(FilterContainer, { className: "--filter-container-left", children: [
|
|
3165
|
+
(bannerConfig == null ? void 0 : bannerConfig.enableTableCaption) && /* @__PURE__ */ jsx17(Typography3, { variant: "h3", as: "h2", children: tableCaption }),
|
|
3166
|
+
(_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)
|
|
3167
|
+
] }),
|
|
3168
|
+
/* @__PURE__ */ jsx17(FilterContainer, { className: "--filter-container-right", children: /* @__PURE__ */ jsxs9(Fragment3, { children: [
|
|
3169
|
+
(_d = bannerConfig == null ? void 0 : bannerConfig.customActionsRight) == null ? void 0 : _d.call(bannerConfig, table),
|
|
3170
|
+
(bannerConfig == null ? void 0 : bannerConfig.enableGlobalFilterInput) && /* @__PURE__ */ jsx17(
|
|
3171
|
+
DebouncedInput,
|
|
3172
|
+
{
|
|
3173
|
+
value: globalFilter.state,
|
|
3174
|
+
icon: search,
|
|
3175
|
+
placeholder: (_e = bannerConfig.globalFilterPlaceholder) != null ? _e : "Search all columns",
|
|
3176
|
+
onChange: (value) => globalFilter.onChange(String(value))
|
|
3177
|
+
}
|
|
3178
|
+
),
|
|
3179
|
+
(bannerConfig == null ? void 0 : bannerConfig.enableColumnSelect) && /* @__PURE__ */ jsx17(ColumnSelect, { table }),
|
|
3180
|
+
(bannerConfig == null ? void 0 : bannerConfig.totalRowCount) && /* @__PURE__ */ jsxs9("span", { children: [
|
|
3181
|
+
table.options.data.length.toLocaleString(),
|
|
3182
|
+
" /",
|
|
3183
|
+
" ",
|
|
3184
|
+
bannerConfig.totalRowCount.toLocaleString(),
|
|
3185
|
+
" rows"
|
|
3186
|
+
] })
|
|
3187
|
+
] }) })
|
|
3188
|
+
] });
|
|
3216
3189
|
}
|
|
3217
3190
|
|
|
3218
3191
|
// src/DataTable/components/VirtualTable.tsx
|
|
@@ -3221,28 +3194,28 @@ import { useVirtualizer } from "@tanstack/react-virtual";
|
|
|
3221
3194
|
|
|
3222
3195
|
// src/DataTable/components/PaddingRow.tsx
|
|
3223
3196
|
import { Table as Table8 } from "@equinor/eds-core-react";
|
|
3224
|
-
import { jsx as
|
|
3197
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
3225
3198
|
var PaddingRow = (props) => {
|
|
3226
3199
|
if (!props.height)
|
|
3227
3200
|
return null;
|
|
3228
|
-
return /* @__PURE__ */
|
|
3229
|
-
style: { pointerEvents: "none" },
|
|
3230
|
-
children: /* @__PURE__ */ jsx17(Table8.Cell, {
|
|
3231
|
-
style: { height: `${props.height}px` }
|
|
3232
|
-
})
|
|
3233
|
-
});
|
|
3201
|
+
return /* @__PURE__ */ jsx18(Table8.Row, { style: { pointerEvents: "none" }, children: /* @__PURE__ */ jsx18(Table8.Cell, { style: { height: `${props.height}px` } }) });
|
|
3234
3202
|
};
|
|
3235
3203
|
|
|
3236
3204
|
// src/DataTable/components/VirtualTable.tsx
|
|
3237
|
-
import { jsx as
|
|
3238
|
-
function VirtualTable({
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
}
|
|
3245
|
-
|
|
3205
|
+
import { jsx as jsx19, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3206
|
+
function VirtualTable(_a) {
|
|
3207
|
+
var _b = _a, {
|
|
3208
|
+
table,
|
|
3209
|
+
rowConfig,
|
|
3210
|
+
cellConfig,
|
|
3211
|
+
containerRef
|
|
3212
|
+
} = _b, props = __objRest(_b, [
|
|
3213
|
+
"table",
|
|
3214
|
+
"rowConfig",
|
|
3215
|
+
"cellConfig",
|
|
3216
|
+
"containerRef"
|
|
3217
|
+
]);
|
|
3218
|
+
var _a2, _b2;
|
|
3246
3219
|
const { rows } = table.getRowModel();
|
|
3247
3220
|
const rowVirtualizer = useVirtualizer({
|
|
3248
3221
|
count: rows.length,
|
|
@@ -3252,42 +3225,30 @@ function VirtualTable({
|
|
|
3252
3225
|
overscan: 20
|
|
3253
3226
|
});
|
|
3254
3227
|
const virtualRows = rowVirtualizer.getVirtualItems();
|
|
3255
|
-
const paddingTop = virtualRows.length > 0 ? ((
|
|
3256
|
-
const paddingBottom = virtualRows.length > 0 ? rowVirtualizer.getTotalSize() - (((
|
|
3257
|
-
return /* @__PURE__ */ jsxs10(Table9, {
|
|
3258
|
-
children:
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
measureElement: rowVirtualizer.measureElement
|
|
3280
|
-
}, row.id);
|
|
3281
|
-
}) : /* @__PURE__ */ jsx18(PlaceholderRow, {
|
|
3282
|
-
isLoading: props.isLoading
|
|
3283
|
-
}),
|
|
3284
|
-
/* @__PURE__ */ jsx18(PaddingRow, {
|
|
3285
|
-
height: paddingBottom
|
|
3286
|
-
})
|
|
3287
|
-
]
|
|
3288
|
-
})
|
|
3289
|
-
]
|
|
3290
|
-
});
|
|
3228
|
+
const paddingTop = virtualRows.length > 0 ? ((_a2 = virtualRows == null ? void 0 : virtualRows[0]) == null ? void 0 : _a2.start) || 0 : 0;
|
|
3229
|
+
const paddingBottom = virtualRows.length > 0 ? rowVirtualizer.getTotalSize() - (((_b2 = virtualRows == null ? void 0 : virtualRows[virtualRows.length - 1]) == null ? void 0 : _b2.end) || 0) : 0;
|
|
3230
|
+
return /* @__PURE__ */ jsxs10(Table9, { children: [
|
|
3231
|
+
/* @__PURE__ */ jsx19(Table9.Caption, { hidden: true, children: props.tableCaption }),
|
|
3232
|
+
/* @__PURE__ */ jsx19(TableHeader, { sticky: props.stickyHeader, table }),
|
|
3233
|
+
/* @__PURE__ */ jsxs10(TableBody, { children: [
|
|
3234
|
+
/* @__PURE__ */ jsx19(PaddingRow, { height: paddingTop }),
|
|
3235
|
+
rows.length ? virtualRows.map((virtualRow) => {
|
|
3236
|
+
const row = rows[virtualRow.index];
|
|
3237
|
+
return /* @__PURE__ */ jsx19(
|
|
3238
|
+
TableRow,
|
|
3239
|
+
{
|
|
3240
|
+
row,
|
|
3241
|
+
rowConfig,
|
|
3242
|
+
cellConfig,
|
|
3243
|
+
index: virtualRow.index,
|
|
3244
|
+
measureElement: rowVirtualizer.measureElement
|
|
3245
|
+
},
|
|
3246
|
+
row.id
|
|
3247
|
+
);
|
|
3248
|
+
}) : /* @__PURE__ */ jsx19(PlaceholderRow, { isLoading: props.isLoading }),
|
|
3249
|
+
/* @__PURE__ */ jsx19(PaddingRow, { height: paddingBottom })
|
|
3250
|
+
] })
|
|
3251
|
+
] });
|
|
3291
3252
|
}
|
|
3292
3253
|
|
|
3293
3254
|
// src/DataTable/hooks/useFetchMoreOnBottomReached.tsx
|
|
@@ -3327,7 +3288,7 @@ function useForceRerender() {
|
|
|
3327
3288
|
}
|
|
3328
3289
|
|
|
3329
3290
|
// src/DataTable/DataTable.tsx
|
|
3330
|
-
import { jsx as
|
|
3291
|
+
import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3331
3292
|
function canUseContainStrict(height) {
|
|
3332
3293
|
if (!height)
|
|
3333
3294
|
return false;
|
|
@@ -3340,10 +3301,16 @@ function canUseContainStrict(height) {
|
|
|
3340
3301
|
return true;
|
|
3341
3302
|
}
|
|
3342
3303
|
var DataTableWrapper = styled16.div`
|
|
3343
|
-
width: ${(props) =>
|
|
3304
|
+
width: ${(props) => {
|
|
3305
|
+
var _a;
|
|
3306
|
+
return (_a = props.width) != null ? _a : "100%";
|
|
3307
|
+
}};
|
|
3344
3308
|
|
|
3345
3309
|
.--table-container {
|
|
3346
|
-
height: ${(props) =>
|
|
3310
|
+
height: ${(props) => {
|
|
3311
|
+
var _a;
|
|
3312
|
+
return (_a = props.height) != null ? _a : "100%";
|
|
3313
|
+
}};
|
|
3347
3314
|
width: '100%';
|
|
3348
3315
|
overflow: auto;
|
|
3349
3316
|
${(props) => canUseContainStrict(props.height) ? "contain: strict;" : ""}
|
|
@@ -3353,41 +3320,44 @@ var DataTableWrapper = styled16.div`
|
|
|
3353
3320
|
|
|
3354
3321
|
// The following attribute is important for fixed column width
|
|
3355
3322
|
// CHANGE THIS WITH CAUTION
|
|
3356
|
-
table-layout: ${(props) =>
|
|
3323
|
+
table-layout: ${(props) => {
|
|
3324
|
+
var _a;
|
|
3325
|
+
return (_a = props.tableLayout) != null ? _a : "auto";
|
|
3326
|
+
}};
|
|
3357
3327
|
}
|
|
3358
3328
|
}
|
|
3359
3329
|
`;
|
|
3360
3330
|
function DataTable(props) {
|
|
3361
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
3331
|
+
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;
|
|
3362
3332
|
const { columns, data, bannerConfig, cellConfig, sorting } = props;
|
|
3363
3333
|
const [internalColumnVisibility, setInternalColumnVisibility] = useState6({});
|
|
3364
3334
|
const [columnVisibility, setColumnVisibility] = [
|
|
3365
|
-
((_a = props.columnVisibility) == null ? void 0 : _a.state)
|
|
3366
|
-
((
|
|
3335
|
+
(_b = (_a = props.columnVisibility) == null ? void 0 : _a.state) != null ? _b : internalColumnVisibility,
|
|
3336
|
+
(_d = (_c = props.columnVisibility) == null ? void 0 : _c.onChange) != null ? _d : setInternalColumnVisibility
|
|
3367
3337
|
];
|
|
3368
3338
|
const [internalGlobalFilterState, setInternalGlobalFilterState] = useState6("");
|
|
3369
3339
|
const [globalFilterState, setGlobalFilterState] = [
|
|
3370
|
-
((
|
|
3371
|
-
((
|
|
3340
|
+
(_f = (_e = props.globalFilter) == null ? void 0 : _e.state) != null ? _f : internalGlobalFilterState,
|
|
3341
|
+
(_h = (_g = props.globalFilter) == null ? void 0 : _g.onChange) != null ? _h : setInternalGlobalFilterState
|
|
3372
3342
|
];
|
|
3373
|
-
const shouldEnableGlobalFilter = ((
|
|
3343
|
+
const shouldEnableGlobalFilter = ((_i = props.bannerConfig) == null ? void 0 : _i.enableGlobalFilterInput) || Boolean(props.globalFilter);
|
|
3374
3344
|
function enableGlobalFilter(value) {
|
|
3375
3345
|
return enableOrUndefined(shouldEnableGlobalFilter, value);
|
|
3376
3346
|
}
|
|
3377
3347
|
const [internalSortingState, setInternalSortingState] = useState6([]);
|
|
3378
3348
|
const [sortingState, setSortingState] = [
|
|
3379
|
-
((
|
|
3380
|
-
((
|
|
3349
|
+
(_k = (_j = props.sorting) == null ? void 0 : _j.state) != null ? _k : internalSortingState,
|
|
3350
|
+
(_m = (_l = props.sorting) == null ? void 0 : _l.onChange) != null ? _m : setInternalSortingState
|
|
3381
3351
|
];
|
|
3382
3352
|
const [internalRowSelectionState, setInternalRowSelectionState] = useState6({});
|
|
3383
3353
|
const [rowSelectionState, setRowSelectionState] = [
|
|
3384
|
-
((
|
|
3385
|
-
((
|
|
3354
|
+
(_o = (_n = props.rowSelection) == null ? void 0 : _n.state) != null ? _o : internalRowSelectionState,
|
|
3355
|
+
(_q = (_p = props.rowSelection) == null ? void 0 : _p.onChange) != null ? _q : setInternalRowSelectionState
|
|
3386
3356
|
];
|
|
3387
3357
|
const [internalExpandedState, setInternalExpandedState] = useState6({});
|
|
3388
3358
|
const [expandedState, setExpandedState] = [
|
|
3389
|
-
((
|
|
3390
|
-
((
|
|
3359
|
+
(_s = (_r = props.expansion) == null ? void 0 : _r.state) != null ? _s : internalExpandedState,
|
|
3360
|
+
(_u = (_t = props.expansion) == null ? void 0 : _t.onChange) != null ? _u : setInternalExpandedState
|
|
3391
3361
|
];
|
|
3392
3362
|
const table = useReactTable({
|
|
3393
3363
|
columns: prependSelectColumn(columns, props.rowSelection),
|
|
@@ -3396,25 +3366,23 @@ function DataTable(props) {
|
|
|
3396
3366
|
state: {
|
|
3397
3367
|
expanded: expandedState,
|
|
3398
3368
|
globalFilter: enableGlobalFilter(globalFilterState),
|
|
3399
|
-
sorting: ((
|
|
3369
|
+
sorting: ((_v = props.sorting) == null ? void 0 : _v.enableSorting) ? (_x = (_w = props.sorting) == null ? void 0 : _w.state) != null ? _x : sortingState : void 0,
|
|
3400
3370
|
rowSelection: rowSelectionState,
|
|
3401
3371
|
columnVisibility
|
|
3402
3372
|
},
|
|
3403
3373
|
defaultColumn: {
|
|
3404
3374
|
cell: ({ cell }) => {
|
|
3405
3375
|
const truncateMode = getFunctionValueOrDefault(cellConfig == null ? void 0 : cellConfig.truncateMode, cell, "hover");
|
|
3406
|
-
return /* @__PURE__ */
|
|
3407
|
-
truncate: truncateMode === "hover",
|
|
3408
|
-
enableShowAllOnHover: true,
|
|
3409
|
-
children: cell.getValue()
|
|
3410
|
-
});
|
|
3376
|
+
return /* @__PURE__ */ jsx20(TypographyCustom, { truncate: truncateMode === "hover", enableShowAllOnHover: true, children: cell.getValue() });
|
|
3411
3377
|
}
|
|
3412
3378
|
},
|
|
3379
|
+
enableColumnResizing: Boolean(props.columnResizing),
|
|
3380
|
+
columnResizeMode: typeof props.columnResizing === "boolean" ? "onChange" : props.columnResizing,
|
|
3413
3381
|
enableSorting: sorting == null ? void 0 : sorting.enableSorting,
|
|
3414
3382
|
manualSorting: sorting == null ? void 0 : sorting.manualSorting,
|
|
3415
3383
|
enableExpanding: Boolean(props.expansion),
|
|
3416
|
-
enableMultiRowSelection: ((
|
|
3417
|
-
enableSubRowSelection: ((
|
|
3384
|
+
enableMultiRowSelection: ((_y = props.rowSelection) == null ? void 0 : _y.mode) === "multiple",
|
|
3385
|
+
enableSubRowSelection: ((_z = props.rowSelection) == null ? void 0 : _z.mode) !== "single",
|
|
3418
3386
|
filterFromLeafRows: bannerConfig == null ? void 0 : bannerConfig.filterFromLeafRows,
|
|
3419
3387
|
getFilteredRowModel: enableGlobalFilter(getFilteredRowModel()),
|
|
3420
3388
|
getCoreRowModel: getCoreRowModel(),
|
|
@@ -3422,7 +3390,7 @@ function DataTable(props) {
|
|
|
3422
3390
|
getSortedRowModel: getSortedRowModel(),
|
|
3423
3391
|
onExpandedChange: setExpandedState,
|
|
3424
3392
|
onRowSelectionChange: setRowSelectionState,
|
|
3425
|
-
onSortingChange: (sorting == null ? void 0 : sorting.enableSorting) ? (sorting == null ? void 0 : sorting.onChange)
|
|
3393
|
+
onSortingChange: (sorting == null ? void 0 : sorting.enableSorting) ? (_A = sorting == null ? void 0 : sorting.onChange) != null ? _A : setSortingState : void 0,
|
|
3426
3394
|
onColumnVisibilityChange: setColumnVisibility,
|
|
3427
3395
|
onGlobalFilterChange: enableGlobalFilter(setGlobalFilterState),
|
|
3428
3396
|
getSubRows: props == null ? void 0 : props.getSubRows,
|
|
@@ -3433,7 +3401,7 @@ function DataTable(props) {
|
|
|
3433
3401
|
if ((_a2 = props.expansion) == null ? void 0 : _a2.expandAllByDefault) {
|
|
3434
3402
|
table.toggleAllRowsExpanded();
|
|
3435
3403
|
}
|
|
3436
|
-
}, [table, (
|
|
3404
|
+
}, [table, (_B = props.expansion) == null ? void 0 : _B.expandAllByDefault]);
|
|
3437
3405
|
const { isLoading, rowConfig } = props;
|
|
3438
3406
|
const tableContainerRef = useRef3(null);
|
|
3439
3407
|
const onTableContainerScroll = useFetchMoreOnBottomReached(
|
|
@@ -3445,21 +3413,21 @@ function DataTable(props) {
|
|
|
3445
3413
|
if (Boolean(tableContainerRef.current))
|
|
3446
3414
|
forceRerender();
|
|
3447
3415
|
}, [tableContainerRef.current === null]);
|
|
3448
|
-
return /* @__PURE__ */ jsxs11(DataTableWrapper, {
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
children: [
|
|
3453
|
-
props.bannerConfig && /* @__PURE__ */ jsx19(TableBanner, {
|
|
3416
|
+
return /* @__PURE__ */ jsxs11(DataTableWrapper, { height: props == null ? void 0 : props.height, width: props == null ? void 0 : props.width, tableLayout: props == null ? void 0 : props.tableLayout, children: [
|
|
3417
|
+
props.bannerConfig && /* @__PURE__ */ jsx20(
|
|
3418
|
+
TableBanner,
|
|
3419
|
+
{
|
|
3454
3420
|
table,
|
|
3455
3421
|
bannerConfig: props.bannerConfig,
|
|
3456
3422
|
globalFilter: { state: globalFilterState, onChange: setGlobalFilterState },
|
|
3457
3423
|
tableCaption: props.tableCaption
|
|
3458
|
-
}
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3424
|
+
}
|
|
3425
|
+
),
|
|
3426
|
+
/* @__PURE__ */ jsx20(
|
|
3427
|
+
"div",
|
|
3428
|
+
__spreadProps(__spreadValues({}, props.tableContainerProps), {
|
|
3429
|
+
className: "--table-container " + ((_D = (_C = props.tableContainerProps) == null ? void 0 : _C.className) != null ? _D : ""),
|
|
3430
|
+
onScroll: (_F = (_E = props.tableContainerProps) == null ? void 0 : _E.onScroll) != null ? _F : onTableContainerScroll,
|
|
3463
3431
|
ref: (node) => {
|
|
3464
3432
|
var _a2;
|
|
3465
3433
|
if (node) {
|
|
@@ -3469,29 +3437,35 @@ function DataTable(props) {
|
|
|
3469
3437
|
}
|
|
3470
3438
|
}
|
|
3471
3439
|
},
|
|
3472
|
-
children: (props == null ? void 0 : props.virtual) ? /* @__PURE__ */
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3440
|
+
children: (props == null ? void 0 : props.virtual) ? /* @__PURE__ */ jsx20(
|
|
3441
|
+
VirtualTable,
|
|
3442
|
+
{
|
|
3443
|
+
containerRef: tableContainerRef,
|
|
3444
|
+
tableCaption: props.tableCaption,
|
|
3445
|
+
table,
|
|
3446
|
+
rowConfig,
|
|
3447
|
+
cellConfig,
|
|
3448
|
+
isLoading,
|
|
3449
|
+
stickyHeader: props.stickyHeader
|
|
3450
|
+
}
|
|
3451
|
+
) : /* @__PURE__ */ jsx20(
|
|
3452
|
+
BasicTable,
|
|
3453
|
+
{
|
|
3454
|
+
tableCaption: props.tableCaption,
|
|
3455
|
+
table,
|
|
3456
|
+
rowConfig,
|
|
3457
|
+
cellConfig,
|
|
3458
|
+
isLoading,
|
|
3459
|
+
stickyHeader: props.stickyHeader
|
|
3460
|
+
}
|
|
3461
|
+
)
|
|
3488
3462
|
})
|
|
3489
|
-
|
|
3490
|
-
});
|
|
3463
|
+
)
|
|
3464
|
+
] });
|
|
3491
3465
|
}
|
|
3492
3466
|
|
|
3493
3467
|
// src/form-cells/EditableCheckboxCell.tsx
|
|
3494
|
-
import { Checkbox as
|
|
3468
|
+
import { Checkbox as Checkbox4 } from "@equinor/eds-core-react";
|
|
3495
3469
|
import { Controller } from "react-hook-form";
|
|
3496
3470
|
|
|
3497
3471
|
// src/form-meta/utils.tsx
|
|
@@ -3503,16 +3477,21 @@ var formMeta = {
|
|
|
3503
3477
|
_hasRemoteChange: false
|
|
3504
3478
|
};
|
|
3505
3479
|
function useEditMode() {
|
|
3480
|
+
var _a;
|
|
3506
3481
|
const { watch } = useFormContext();
|
|
3507
|
-
return watch("_editMode")
|
|
3482
|
+
return (_a = watch("_editMode")) != null ? _a : false;
|
|
3508
3483
|
}
|
|
3509
3484
|
function useHasRemoteChange() {
|
|
3485
|
+
var _a;
|
|
3510
3486
|
const { watch } = useFormContext();
|
|
3511
|
-
return watch("_hasRemoteChange")
|
|
3487
|
+
return (_a = watch("_hasRemoteChange")) != null ? _a : false;
|
|
3512
3488
|
}
|
|
3513
3489
|
function useGetIsNew() {
|
|
3514
3490
|
const { getValues } = useFormContext();
|
|
3515
|
-
return () =>
|
|
3491
|
+
return () => {
|
|
3492
|
+
var _a;
|
|
3493
|
+
return (_a = getValues("_isNew")) != null ? _a : false;
|
|
3494
|
+
};
|
|
3516
3495
|
}
|
|
3517
3496
|
function useSetFormMeta() {
|
|
3518
3497
|
const { setValue } = useFormContext();
|
|
@@ -3525,30 +3504,34 @@ function removeFormMeta(withFormMeta) {
|
|
|
3525
3504
|
return (0, import_omit.default)(withFormMeta, Object.keys(formMeta));
|
|
3526
3505
|
}
|
|
3527
3506
|
function addFormMeta(withoutFormMeta) {
|
|
3528
|
-
return {
|
|
3507
|
+
return __spreadValues(__spreadValues({}, formMeta), withoutFormMeta);
|
|
3529
3508
|
}
|
|
3530
3509
|
|
|
3531
3510
|
// src/form-cells/EditableCheckboxCell.tsx
|
|
3532
|
-
import { jsx as
|
|
3511
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
3533
3512
|
function EditableCheckboxCell(context) {
|
|
3534
3513
|
const editMode = useEditMode();
|
|
3535
3514
|
if (!editMode)
|
|
3536
|
-
return /* @__PURE__ */
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3515
|
+
return /* @__PURE__ */ jsx21(
|
|
3516
|
+
Checkbox4,
|
|
3517
|
+
{
|
|
3518
|
+
enterKeyHint: "next",
|
|
3519
|
+
"aria-label": "readonly",
|
|
3520
|
+
readOnly: true,
|
|
3521
|
+
checked: context.getValue(),
|
|
3522
|
+
disabled: true
|
|
3523
|
+
}
|
|
3524
|
+
);
|
|
3525
|
+
return /* @__PURE__ */ jsx21(
|
|
3526
|
+
Controller,
|
|
3527
|
+
{
|
|
3528
|
+
name: context.column.id,
|
|
3529
|
+
render: (_a) => {
|
|
3530
|
+
var { field: _b } = _a, _c = _b, { value } = _c, field = __objRest(_c, ["value"]);
|
|
3531
|
+
return /* @__PURE__ */ jsx21(Checkbox4, __spreadValues({ enterKeyHint: "send", "aria-label": "editable", checked: value }, field));
|
|
3532
|
+
}
|
|
3533
|
+
}
|
|
3534
|
+
);
|
|
3552
3535
|
}
|
|
3553
3536
|
|
|
3554
3537
|
// src/form-cells/EditableDateCell.tsx
|
|
@@ -3560,7 +3543,7 @@ import styled17 from "styled-components";
|
|
|
3560
3543
|
// src/form-cells/utils.tsx
|
|
3561
3544
|
import { Icon as Icon7 } from "@equinor/eds-core-react";
|
|
3562
3545
|
import { error_filled, warning_filled } from "@equinor/eds-icons";
|
|
3563
|
-
import { jsx as
|
|
3546
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
3564
3547
|
function getHelperTextProps({
|
|
3565
3548
|
error,
|
|
3566
3549
|
warning,
|
|
@@ -3570,19 +3553,13 @@ function getHelperTextProps({
|
|
|
3570
3553
|
return {
|
|
3571
3554
|
variant: "error",
|
|
3572
3555
|
helperText: error.message,
|
|
3573
|
-
helperIcon: /* @__PURE__ */
|
|
3574
|
-
data: error_filled,
|
|
3575
|
-
size: 16
|
|
3576
|
-
})
|
|
3556
|
+
helperIcon: /* @__PURE__ */ jsx22(Icon7, { data: error_filled, size: 16 })
|
|
3577
3557
|
};
|
|
3578
3558
|
if (warning)
|
|
3579
3559
|
return {
|
|
3580
3560
|
variant: "warning",
|
|
3581
3561
|
helperText: warning.message,
|
|
3582
|
-
helperIcon: /* @__PURE__ */
|
|
3583
|
-
data: warning_filled,
|
|
3584
|
-
size: 16
|
|
3585
|
-
})
|
|
3562
|
+
helperIcon: /* @__PURE__ */ jsx22(Icon7, { data: warning_filled, size: 16 })
|
|
3586
3563
|
};
|
|
3587
3564
|
return {
|
|
3588
3565
|
helperText,
|
|
@@ -3597,32 +3574,45 @@ function stopPropagation2(handler) {
|
|
|
3597
3574
|
}
|
|
3598
3575
|
|
|
3599
3576
|
// src/form-cells/EditableDateCell.tsx
|
|
3600
|
-
import { jsx as
|
|
3601
|
-
function EditableDateCell(
|
|
3602
|
-
|
|
3577
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
3578
|
+
function EditableDateCell(_a) {
|
|
3579
|
+
var _b = _a, {
|
|
3580
|
+
dateStringFormatter,
|
|
3581
|
+
error: errorFromProps
|
|
3582
|
+
} = _b, context = __objRest(_b, [
|
|
3583
|
+
"dateStringFormatter",
|
|
3584
|
+
"error"
|
|
3585
|
+
]);
|
|
3603
3586
|
const rawValue = context.getValue();
|
|
3604
3587
|
const editMode = useEditMode();
|
|
3605
3588
|
const formattedValue = useMemo(
|
|
3606
|
-
() =>
|
|
3589
|
+
() => {
|
|
3590
|
+
var _a2;
|
|
3591
|
+
return (_a2 = dateStringFormatter == null ? void 0 : dateStringFormatter(rawValue)) != null ? _a2 : rawValue;
|
|
3592
|
+
},
|
|
3607
3593
|
[rawValue, dateStringFormatter]
|
|
3608
3594
|
);
|
|
3609
3595
|
if (!editMode)
|
|
3610
|
-
return /* @__PURE__ */
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3596
|
+
return /* @__PURE__ */ jsx23(TypographyCustom, { truncate: true, children: formattedValue });
|
|
3597
|
+
return /* @__PURE__ */ jsx23(
|
|
3598
|
+
Controller2,
|
|
3599
|
+
{
|
|
3600
|
+
name: context.column.id,
|
|
3601
|
+
render: (_a2) => {
|
|
3602
|
+
var _b2 = _a2, { field: _c } = _b2, _d = _c, { value, onChange } = _d, field = __objRest(_d, ["value", "onChange"]), { fieldState: { error } } = _b2;
|
|
3603
|
+
return /* @__PURE__ */ jsx23(
|
|
3604
|
+
InlineTextField,
|
|
3605
|
+
__spreadValues(__spreadValues({
|
|
3606
|
+
id: context.column.id,
|
|
3607
|
+
type: "date",
|
|
3608
|
+
autoComplete: "none",
|
|
3609
|
+
value: value ? parseISODate(value) : "",
|
|
3610
|
+
onChange: (e) => onChange(e.target.value ? parseISODate(e.target.value) : "")
|
|
3611
|
+
}, getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error })), field)
|
|
3612
|
+
);
|
|
3613
|
+
}
|
|
3614
|
+
}
|
|
3615
|
+
);
|
|
3626
3616
|
}
|
|
3627
3617
|
function parseISODate(dateString) {
|
|
3628
3618
|
const date = new Date(dateString);
|
|
@@ -3656,65 +3646,131 @@ var InlineTextField = styled17(TextField)`
|
|
|
3656
3646
|
// src/form-cells/EditableDropdownSingleCell.tsx
|
|
3657
3647
|
import { Autocomplete } from "@equinor/eds-core-react";
|
|
3658
3648
|
import { Controller as Controller3 } from "react-hook-form";
|
|
3659
|
-
|
|
3649
|
+
|
|
3650
|
+
// src/form-cells/FormHelperText.tsx
|
|
3651
|
+
import { Typography as Typography4 } from "@equinor/eds-core-react";
|
|
3652
|
+
import { tokens as tokens6 } from "@equinor/eds-tokens";
|
|
3653
|
+
import { Fragment as Fragment4, jsx as jsx24, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3654
|
+
var colors = {
|
|
3655
|
+
error: tokens6.colors.interactive.danger__text.hex,
|
|
3656
|
+
warning: tokens6.colors.interactive.warning__text.hex,
|
|
3657
|
+
success: tokens6.colors.interactive.success__text.hex
|
|
3658
|
+
};
|
|
3659
|
+
function HelperText({ helperText, variant, helperIcon }) {
|
|
3660
|
+
return /* @__PURE__ */ jsx24(Fragment4, { children: helperText && /* @__PURE__ */ jsx24("div", { style: { marginTop: "8px", marginLeft: "8px" }, children: /* @__PURE__ */ jsxs12(
|
|
3661
|
+
"div",
|
|
3662
|
+
{
|
|
3663
|
+
style: {
|
|
3664
|
+
display: "flex",
|
|
3665
|
+
alignItems: "flex-start",
|
|
3666
|
+
marginTop: "8px",
|
|
3667
|
+
color: variant ? colors[variant] : "inherit"
|
|
3668
|
+
},
|
|
3669
|
+
children: [
|
|
3670
|
+
/* @__PURE__ */ jsx24("span", { style: { flexShrink: 0 }, children: helperIcon }),
|
|
3671
|
+
/* @__PURE__ */ jsx24(
|
|
3672
|
+
Typography4,
|
|
3673
|
+
{
|
|
3674
|
+
style: {
|
|
3675
|
+
fontSize: "0.75rem",
|
|
3676
|
+
fontWeight: 500,
|
|
3677
|
+
lineHeight: "1.333em",
|
|
3678
|
+
letterSpacing: "0.013em",
|
|
3679
|
+
textAlign: "left",
|
|
3680
|
+
margin: "0 0 0 8px",
|
|
3681
|
+
color: "inherit"
|
|
3682
|
+
},
|
|
3683
|
+
children: helperText
|
|
3684
|
+
}
|
|
3685
|
+
)
|
|
3686
|
+
]
|
|
3687
|
+
}
|
|
3688
|
+
) }) });
|
|
3689
|
+
}
|
|
3690
|
+
|
|
3691
|
+
// src/form-cells/EditableDropdownSingleCell.tsx
|
|
3692
|
+
import { Fragment as Fragment5, jsx as jsx25, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3660
3693
|
function buildEmptyOption() {
|
|
3661
3694
|
return { label: "", value: "" };
|
|
3662
3695
|
}
|
|
3663
|
-
function EditableDropdownSingleCell(
|
|
3664
|
-
|
|
3696
|
+
function EditableDropdownSingleCell(_a) {
|
|
3697
|
+
var _b = _a, {
|
|
3698
|
+
options,
|
|
3699
|
+
error: errorFromProps
|
|
3700
|
+
} = _b, context = __objRest(_b, [
|
|
3701
|
+
"options",
|
|
3702
|
+
"error"
|
|
3703
|
+
]);
|
|
3665
3704
|
const editMode = useEditMode();
|
|
3666
3705
|
if (!editMode)
|
|
3667
|
-
return /* @__PURE__ */
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3706
|
+
return /* @__PURE__ */ jsx25(TypographyCustom, { truncate: true, children: context.getValue() });
|
|
3707
|
+
return /* @__PURE__ */ jsx25(
|
|
3708
|
+
Controller3,
|
|
3709
|
+
{
|
|
3710
|
+
name: context.column.id,
|
|
3711
|
+
render: (_a2) => {
|
|
3712
|
+
var _b2 = _a2, { field: _c } = _b2, _d = _c, { value, onChange } = _d, field = __objRest(_d, ["value", "onChange"]), { fieldState: { error } } = _b2;
|
|
3713
|
+
var _a3;
|
|
3714
|
+
const selectedOption = (_a3 = options.find((option) => option.value === value)) != null ? _a3 : buildEmptyOption();
|
|
3715
|
+
return /* @__PURE__ */ jsxs13(Fragment5, { children: [
|
|
3716
|
+
/* @__PURE__ */ jsx25(
|
|
3717
|
+
Autocomplete,
|
|
3718
|
+
__spreadValues({
|
|
3719
|
+
label: "",
|
|
3720
|
+
selectedOptions: selectedOption && [selectedOption],
|
|
3721
|
+
options,
|
|
3722
|
+
optionLabel: (option) => {
|
|
3723
|
+
var _a4;
|
|
3724
|
+
return (_a4 = option == null ? void 0 : option.label) != null ? _a4 : "";
|
|
3725
|
+
},
|
|
3726
|
+
"aria-required": true,
|
|
3727
|
+
hideClearButton: true,
|
|
3728
|
+
"aria-autocomplete": "none",
|
|
3729
|
+
onOptionsChange: (changes) => {
|
|
3730
|
+
const [change] = changes.selectedItems;
|
|
3731
|
+
onChange(change == null ? void 0 : change.value);
|
|
3732
|
+
}
|
|
3733
|
+
}, field)
|
|
3734
|
+
),
|
|
3735
|
+
/* @__PURE__ */ jsx25(HelperText, __spreadValues({}, getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error })))
|
|
3736
|
+
] });
|
|
3737
|
+
}
|
|
3689
3738
|
}
|
|
3690
|
-
|
|
3739
|
+
);
|
|
3691
3740
|
}
|
|
3692
3741
|
|
|
3693
3742
|
// src/form-cells/EditableNumberCell.tsx
|
|
3694
3743
|
import { TextField as TextField2 } from "@equinor/eds-core-react";
|
|
3695
3744
|
import { Controller as Controller4 } from "react-hook-form";
|
|
3696
3745
|
import styled18 from "styled-components";
|
|
3697
|
-
import { Fragment as
|
|
3698
|
-
function EditableNumberCell(
|
|
3746
|
+
import { Fragment as Fragment6, jsx as jsx26 } from "react/jsx-runtime";
|
|
3747
|
+
function EditableNumberCell(_a) {
|
|
3748
|
+
var _b = _a, {
|
|
3749
|
+
error: errorFromProps
|
|
3750
|
+
} = _b, context = __objRest(_b, [
|
|
3751
|
+
"error"
|
|
3752
|
+
]);
|
|
3699
3753
|
const editMode = useEditMode();
|
|
3700
3754
|
if (!editMode)
|
|
3701
|
-
return /* @__PURE__ */
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3755
|
+
return /* @__PURE__ */ jsx26(TypographyCustom, { truncate: true, children: context.getValue() });
|
|
3756
|
+
return /* @__PURE__ */ jsx26(
|
|
3757
|
+
Controller4,
|
|
3758
|
+
{
|
|
3759
|
+
name: context.column.id,
|
|
3760
|
+
render: (_a2) => {
|
|
3761
|
+
var _b2 = _a2, { field: _c } = _b2, _d = _c, { onChange } = _d, field = __objRest(_d, ["onChange"]), { fieldState: { error } } = _b2;
|
|
3762
|
+
return /* @__PURE__ */ jsx26(Fragment6, { children: /* @__PURE__ */ jsx26(
|
|
3763
|
+
InlineTextField2,
|
|
3764
|
+
__spreadValues(__spreadValues({
|
|
3765
|
+
id: context.column.id,
|
|
3766
|
+
type: "number",
|
|
3767
|
+
autoComplete: "none",
|
|
3768
|
+
onChange: (e) => onChange(e.target.valueAsNumber)
|
|
3769
|
+
}, field), getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error }))
|
|
3770
|
+
) });
|
|
3771
|
+
}
|
|
3772
|
+
}
|
|
3773
|
+
);
|
|
3718
3774
|
}
|
|
3719
3775
|
var InlineTextField2 = styled18(TextField2)`
|
|
3720
3776
|
/*
|
|
@@ -3745,105 +3801,110 @@ import { arrow_up } from "@equinor/eds-icons";
|
|
|
3745
3801
|
import { useState as useState7 } from "react";
|
|
3746
3802
|
import { Controller as Controller5 } from "react-hook-form";
|
|
3747
3803
|
import styled19 from "styled-components";
|
|
3748
|
-
import { Fragment as
|
|
3749
|
-
function EditableTextAreaCell(
|
|
3750
|
-
|
|
3804
|
+
import { Fragment as Fragment7, jsx as jsx27, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3805
|
+
function EditableTextAreaCell(_a) {
|
|
3806
|
+
var _b = _a, {
|
|
3807
|
+
title,
|
|
3808
|
+
error: errorFromProps
|
|
3809
|
+
} = _b, context = __objRest(_b, [
|
|
3810
|
+
"title",
|
|
3811
|
+
"error"
|
|
3812
|
+
]);
|
|
3751
3813
|
const [textareaValue, setTextareaValue] = useState7(context.getValue());
|
|
3752
3814
|
const [open, setOpen] = useState7(false);
|
|
3753
3815
|
const editMode = useEditMode();
|
|
3754
3816
|
const name = context.column.id;
|
|
3755
3817
|
if (!editMode)
|
|
3756
|
-
return /* @__PURE__ */
|
|
3757
|
-
id: name + "popover",
|
|
3758
|
-
value: context.getValue(),
|
|
3759
|
-
title
|
|
3760
|
-
});
|
|
3818
|
+
return /* @__PURE__ */ jsx27(PopoverCell, { id: name + "popover", value: context.getValue(), title });
|
|
3761
3819
|
const openDialog = () => setOpen(true);
|
|
3762
3820
|
const closeDialog = () => setOpen(false);
|
|
3763
|
-
return /* @__PURE__ */
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
...field,
|
|
3779
|
-
...getHelperTextProps({ error })
|
|
3780
|
-
}),
|
|
3781
|
-
/* @__PURE__ */ jsx25(IconButton, {
|
|
3782
|
-
variant: "ghost_icon",
|
|
3783
|
-
onClick: stopPropagation2(openDialog),
|
|
3784
|
-
children: /* @__PURE__ */ jsx25(Icon8, {
|
|
3785
|
-
data: arrow_up,
|
|
3786
|
-
size: 24,
|
|
3787
|
-
style: { transform: "rotateZ(45deg)" }
|
|
3788
|
-
})
|
|
3789
|
-
})
|
|
3790
|
-
]
|
|
3791
|
-
}),
|
|
3792
|
-
/* @__PURE__ */ jsxs12(EDS, {
|
|
3793
|
-
open,
|
|
3794
|
-
onClose: () => {
|
|
3795
|
-
closeDialog();
|
|
3796
|
-
onChange(textareaValue);
|
|
3797
|
-
},
|
|
3798
|
-
isDismissable: true,
|
|
3799
|
-
style: { width: "min(50rem, calc(100vw - 4rem))" },
|
|
3800
|
-
children: [
|
|
3801
|
-
/* @__PURE__ */ jsx25(EDS.Header, {
|
|
3802
|
-
children: /* @__PURE__ */ jsx25(EDS.Title, {
|
|
3803
|
-
children: title
|
|
3804
|
-
})
|
|
3805
|
-
}),
|
|
3806
|
-
/* @__PURE__ */ jsx25(EDS.Content, {
|
|
3807
|
-
children: /* @__PURE__ */ jsx25(TextField3, {
|
|
3808
|
-
style: {
|
|
3809
|
-
maxWidth: "100%",
|
|
3810
|
-
marginTop: "1rem"
|
|
3811
|
-
},
|
|
3812
|
-
id: field.name + "modal",
|
|
3813
|
-
multiline: true,
|
|
3814
|
-
rows: 8,
|
|
3815
|
-
name: field.name + "modal",
|
|
3816
|
-
value: textareaValue,
|
|
3817
|
-
onChange: (e) => {
|
|
3818
|
-
setTextareaValue(e.target.value);
|
|
3819
|
-
}
|
|
3820
|
-
})
|
|
3821
|
-
}),
|
|
3822
|
-
/* @__PURE__ */ jsxs12(EDS.Actions, {
|
|
3823
|
-
style: { display: "flex", gap: "1rem" },
|
|
3821
|
+
return /* @__PURE__ */ jsx27(
|
|
3822
|
+
Controller5,
|
|
3823
|
+
{
|
|
3824
|
+
name,
|
|
3825
|
+
render: (_a2) => {
|
|
3826
|
+
var _b2 = _a2, { field: _c } = _b2, _d = _c, { onChange, ref } = _d, field = __objRest(_d, ["onChange", "ref"]), { fieldState: { error } } = _b2;
|
|
3827
|
+
return /* @__PURE__ */ jsxs14(Fragment7, { children: [
|
|
3828
|
+
/* @__PURE__ */ jsxs14(
|
|
3829
|
+
"div",
|
|
3830
|
+
{
|
|
3831
|
+
style: {
|
|
3832
|
+
display: "flex",
|
|
3833
|
+
alignItems: "center",
|
|
3834
|
+
position: "relative"
|
|
3835
|
+
},
|
|
3824
3836
|
children: [
|
|
3825
|
-
/* @__PURE__ */
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
onClick: () => {
|
|
3835
|
-
closeDialog();
|
|
3836
|
-
setTextareaValue(context.getValue());
|
|
3837
|
-
},
|
|
3838
|
-
children: "Cancel"
|
|
3839
|
-
})
|
|
3837
|
+
/* @__PURE__ */ jsx27(
|
|
3838
|
+
StyledTextField,
|
|
3839
|
+
__spreadValues(__spreadValues({
|
|
3840
|
+
id: field.name,
|
|
3841
|
+
onChange,
|
|
3842
|
+
ref
|
|
3843
|
+
}, field), getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error }))
|
|
3844
|
+
),
|
|
3845
|
+
/* @__PURE__ */ jsx27(IconButton, { variant: "ghost_icon", onClick: stopPropagation2(openDialog), children: /* @__PURE__ */ jsx27(Icon8, { data: arrow_up, size: 24, style: { transform: "rotateZ(45deg)" } }) })
|
|
3840
3846
|
]
|
|
3841
|
-
}
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
+
}
|
|
3848
|
+
),
|
|
3849
|
+
/* @__PURE__ */ jsxs14(
|
|
3850
|
+
EDS,
|
|
3851
|
+
{
|
|
3852
|
+
open,
|
|
3853
|
+
onClose: () => {
|
|
3854
|
+
closeDialog();
|
|
3855
|
+
onChange(textareaValue);
|
|
3856
|
+
},
|
|
3857
|
+
isDismissable: true,
|
|
3858
|
+
style: { width: "min(50rem, calc(100vw - 4rem))" },
|
|
3859
|
+
children: [
|
|
3860
|
+
/* @__PURE__ */ jsx27(EDS.Header, { children: /* @__PURE__ */ jsx27(EDS.Title, { children: title }) }),
|
|
3861
|
+
/* @__PURE__ */ jsx27(EDS.Content, { children: /* @__PURE__ */ jsx27(
|
|
3862
|
+
TextField3,
|
|
3863
|
+
{
|
|
3864
|
+
style: {
|
|
3865
|
+
maxWidth: "100%",
|
|
3866
|
+
marginTop: "1rem"
|
|
3867
|
+
},
|
|
3868
|
+
id: field.name + "modal",
|
|
3869
|
+
multiline: true,
|
|
3870
|
+
rows: 8,
|
|
3871
|
+
name: field.name + "modal",
|
|
3872
|
+
value: textareaValue,
|
|
3873
|
+
onChange: (e) => {
|
|
3874
|
+
setTextareaValue(e.target.value);
|
|
3875
|
+
}
|
|
3876
|
+
}
|
|
3877
|
+
) }),
|
|
3878
|
+
/* @__PURE__ */ jsxs14(EDS.Actions, { style: { display: "flex", gap: "1rem" }, children: [
|
|
3879
|
+
/* @__PURE__ */ jsx27(
|
|
3880
|
+
Button5,
|
|
3881
|
+
{
|
|
3882
|
+
onClick: () => {
|
|
3883
|
+
closeDialog();
|
|
3884
|
+
onChange(textareaValue);
|
|
3885
|
+
},
|
|
3886
|
+
children: "Submit"
|
|
3887
|
+
}
|
|
3888
|
+
),
|
|
3889
|
+
/* @__PURE__ */ jsx27(
|
|
3890
|
+
Button5,
|
|
3891
|
+
{
|
|
3892
|
+
variant: "ghost",
|
|
3893
|
+
onClick: () => {
|
|
3894
|
+
closeDialog();
|
|
3895
|
+
setTextareaValue(context.getValue());
|
|
3896
|
+
},
|
|
3897
|
+
children: "Cancel"
|
|
3898
|
+
}
|
|
3899
|
+
)
|
|
3900
|
+
] })
|
|
3901
|
+
]
|
|
3902
|
+
}
|
|
3903
|
+
)
|
|
3904
|
+
] });
|
|
3905
|
+
}
|
|
3906
|
+
}
|
|
3907
|
+
);
|
|
3847
3908
|
}
|
|
3848
3909
|
var StyledTextField = styled19(TextField3)`
|
|
3849
3910
|
& input {
|
|
@@ -3865,24 +3926,33 @@ var IconButton = styled19(Button5)`
|
|
|
3865
3926
|
import { TextField as TextField4 } from "@equinor/eds-core-react";
|
|
3866
3927
|
import { Controller as Controller6 } from "react-hook-form";
|
|
3867
3928
|
import styled20 from "styled-components";
|
|
3868
|
-
import { jsx as
|
|
3869
|
-
function EditableTextFieldCell(
|
|
3929
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
3930
|
+
function EditableTextFieldCell(_a) {
|
|
3931
|
+
var _b = _a, {
|
|
3932
|
+
error: errorFromProps
|
|
3933
|
+
} = _b, context = __objRest(_b, [
|
|
3934
|
+
"error"
|
|
3935
|
+
]);
|
|
3870
3936
|
const editMode = useEditMode();
|
|
3871
3937
|
if (!editMode)
|
|
3872
|
-
return /* @__PURE__ */
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3938
|
+
return /* @__PURE__ */ jsx28(TypographyCustom, { truncate: true, children: context.getValue() });
|
|
3939
|
+
return /* @__PURE__ */ jsx28(
|
|
3940
|
+
Controller6,
|
|
3941
|
+
{
|
|
3942
|
+
name: context.column.id,
|
|
3943
|
+
render: (_a2) => {
|
|
3944
|
+
var _b2 = _a2, { field: _c } = _b2, _d = _c, { value } = _d, field = __objRest(_d, ["value"]), { fieldState: { error } } = _b2;
|
|
3945
|
+
return /* @__PURE__ */ jsx28(
|
|
3946
|
+
InlineTextField3,
|
|
3947
|
+
__spreadValues(__spreadValues({
|
|
3948
|
+
id: context.column.id,
|
|
3949
|
+
autoComplete: "none",
|
|
3950
|
+
value: String(value != null ? value : "")
|
|
3951
|
+
}, field), getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error }))
|
|
3952
|
+
);
|
|
3953
|
+
}
|
|
3954
|
+
}
|
|
3955
|
+
);
|
|
3886
3956
|
}
|
|
3887
3957
|
var InlineTextField3 = styled20(TextField4)`
|
|
3888
3958
|
/*
|
|
@@ -3909,6 +3979,7 @@ var InlineTextField3 = styled20(TextField4)`
|
|
|
3909
3979
|
export {
|
|
3910
3980
|
AppShell,
|
|
3911
3981
|
AppSidebar,
|
|
3982
|
+
CheckboxCell,
|
|
3912
3983
|
ChipsCell,
|
|
3913
3984
|
ColumnSelect,
|
|
3914
3985
|
DataTable,
|