@equinor/apollo-components 3.1.1 → 3.1.2-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 +94 -31
- package/dist/index.js +694 -186
- package/dist/index.mjs +685 -186
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -736,10 +736,10 @@ var require_lodash = __commonJS({
|
|
|
736
736
|
}();
|
|
737
737
|
var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
|
|
738
738
|
var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : undefined2, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax = Math2.max, nativeMin = Math2.min, nativeNow = Date2.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse;
|
|
739
|
-
var DataView = getNative(context, "DataView"), Map = getNative(context, "Map"), Promise2 = getNative(context, "Promise"),
|
|
739
|
+
var DataView = getNative(context, "DataView"), Map = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set = getNative(context, "Set"), WeakMap = getNative(context, "WeakMap"), nativeCreate = getNative(Object2, "create");
|
|
740
740
|
var metaMap = WeakMap && new WeakMap();
|
|
741
741
|
var realNames = {};
|
|
742
|
-
var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map), promiseCtorString = toSource(Promise2), setCtorString = toSource(
|
|
742
|
+
var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set), weakMapCtorString = toSource(WeakMap);
|
|
743
743
|
var symbolProto = Symbol2 ? Symbol2.prototype : undefined2, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined2, symbolToString = symbolProto ? symbolProto.toString : undefined2;
|
|
744
744
|
function lodash(value) {
|
|
745
745
|
if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
|
|
@@ -2453,8 +2453,8 @@ var require_lodash = __commonJS({
|
|
|
2453
2453
|
return func(number);
|
|
2454
2454
|
};
|
|
2455
2455
|
}
|
|
2456
|
-
var createSet = !(
|
|
2457
|
-
return new
|
|
2456
|
+
var createSet = !(Set && 1 / setToArray(new Set([, -0]))[1] == INFINITY) ? noop : function(values2) {
|
|
2457
|
+
return new Set(values2);
|
|
2458
2458
|
};
|
|
2459
2459
|
function createToPairs(keysFunc) {
|
|
2460
2460
|
return function(object) {
|
|
@@ -2753,7 +2753,7 @@ var require_lodash = __commonJS({
|
|
|
2753
2753
|
return result2;
|
|
2754
2754
|
};
|
|
2755
2755
|
var getTag = baseGetTag;
|
|
2756
|
-
if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map && getTag(new Map()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag ||
|
|
2756
|
+
if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map && getTag(new Map()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set && getTag(new Set()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) {
|
|
2757
2757
|
getTag = function(value) {
|
|
2758
2758
|
var result2 = baseGetTag(value), Ctor = result2 == objectTag ? value.constructor : undefined2, ctorString = Ctor ? toSource(Ctor) : "";
|
|
2759
2759
|
if (ctorString) {
|
|
@@ -4107,7 +4107,7 @@ var require_lodash = __commonJS({
|
|
|
4107
4107
|
customizer = typeof customizer == "function" ? customizer : undefined2;
|
|
4108
4108
|
return baseIsMatch(object, source, getMatchData(source), customizer);
|
|
4109
4109
|
}
|
|
4110
|
-
function
|
|
4110
|
+
function isNaN(value) {
|
|
4111
4111
|
return isNumber(value) && value != +value;
|
|
4112
4112
|
}
|
|
4113
4113
|
function isNative(value) {
|
|
@@ -5184,7 +5184,7 @@ var require_lodash = __commonJS({
|
|
|
5184
5184
|
lodash.isMap = isMap;
|
|
5185
5185
|
lodash.isMatch = isMatch;
|
|
5186
5186
|
lodash.isMatchWith = isMatchWith;
|
|
5187
|
-
lodash.isNaN =
|
|
5187
|
+
lodash.isNaN = isNaN;
|
|
5188
5188
|
lodash.isNative = isNative;
|
|
5189
5189
|
lodash.isNil = isNil;
|
|
5190
5190
|
lodash.isNull = isNull;
|
|
@@ -5458,62 +5458,6 @@ var require_lodash = __commonJS({
|
|
|
5458
5458
|
}
|
|
5459
5459
|
});
|
|
5460
5460
|
|
|
5461
|
-
// src/index.ts
|
|
5462
|
-
export * from "apollo-common";
|
|
5463
|
-
|
|
5464
|
-
// ../apollo-utils/src/form-meta/utils.tsx
|
|
5465
|
-
var import_lodash = __toESM(require_lodash());
|
|
5466
|
-
|
|
5467
|
-
// ../../node_modules/react-hook-form/dist/index.esm.mjs
|
|
5468
|
-
import React from "react";
|
|
5469
|
-
var isWeb = typeof window !== "undefined" && typeof window.HTMLElement !== "undefined" && typeof document !== "undefined";
|
|
5470
|
-
var VALIDATION_MODE = {
|
|
5471
|
-
onBlur: "onBlur",
|
|
5472
|
-
onChange: "onChange",
|
|
5473
|
-
onSubmit: "onSubmit",
|
|
5474
|
-
onTouched: "onTouched",
|
|
5475
|
-
all: "all"
|
|
5476
|
-
};
|
|
5477
|
-
var HookFormContext = React.createContext(null);
|
|
5478
|
-
var useFormContext = () => React.useContext(HookFormContext);
|
|
5479
|
-
var defaultOptions = {
|
|
5480
|
-
mode: VALIDATION_MODE.onSubmit,
|
|
5481
|
-
reValidateMode: VALIDATION_MODE.onChange,
|
|
5482
|
-
shouldFocusError: true
|
|
5483
|
-
};
|
|
5484
|
-
|
|
5485
|
-
// ../apollo-utils/src/form-meta/utils.tsx
|
|
5486
|
-
var formMeta = {
|
|
5487
|
-
_editMode: false,
|
|
5488
|
-
_isNew: false,
|
|
5489
|
-
_hasRemoteChange: false
|
|
5490
|
-
};
|
|
5491
|
-
function useEditMode() {
|
|
5492
|
-
const { watch } = useFormContext();
|
|
5493
|
-
return watch("_editMode") ?? false;
|
|
5494
|
-
}
|
|
5495
|
-
function useHasRemoteChange() {
|
|
5496
|
-
const { watch } = useFormContext();
|
|
5497
|
-
return watch("_hasRemoteChange") ?? false;
|
|
5498
|
-
}
|
|
5499
|
-
function useGetIsNew() {
|
|
5500
|
-
const { getValues } = useFormContext();
|
|
5501
|
-
return () => getValues("_isNew") ?? false;
|
|
5502
|
-
}
|
|
5503
|
-
function useSetFormMeta() {
|
|
5504
|
-
const { setValue } = useFormContext();
|
|
5505
|
-
return (newValues) => objectKeys(newValues).forEach((key) => newValues[key] && setValue(key, newValues[key]));
|
|
5506
|
-
}
|
|
5507
|
-
function objectKeys(obj) {
|
|
5508
|
-
return Object.keys(obj);
|
|
5509
|
-
}
|
|
5510
|
-
function removeFormMeta(withFormMeta) {
|
|
5511
|
-
return (0, import_lodash.omit)(withFormMeta, Object.keys(formMeta));
|
|
5512
|
-
}
|
|
5513
|
-
function addFormMeta(withoutFormMeta) {
|
|
5514
|
-
return { ...formMeta, ...withoutFormMeta };
|
|
5515
|
-
}
|
|
5516
|
-
|
|
5517
5461
|
// src/AppShell/AppShell.tsx
|
|
5518
5462
|
import { Icon, TopBar } from "@equinor/eds-core-react";
|
|
5519
5463
|
import { apps } from "@equinor/eds-icons";
|
|
@@ -5630,6 +5574,12 @@ function stringToHslColor(str, s = 80, l = 85) {
|
|
|
5630
5574
|
const h = hash % 360;
|
|
5631
5575
|
return "hsl(" + h + ", " + s + "%, " + l + "%)";
|
|
5632
5576
|
}
|
|
5577
|
+
function stopPropagation(handler) {
|
|
5578
|
+
return (e) => {
|
|
5579
|
+
e.stopPropagation();
|
|
5580
|
+
handler(e);
|
|
5581
|
+
};
|
|
5582
|
+
}
|
|
5633
5583
|
|
|
5634
5584
|
// src/cells/ChipsCell.tsx
|
|
5635
5585
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
@@ -5788,11 +5738,67 @@ function getSort({ column }) {
|
|
|
5788
5738
|
}
|
|
5789
5739
|
|
|
5790
5740
|
// src/cells/HierarchyCell.tsx
|
|
5741
|
+
import { tokens as tokens4 } from "@equinor/eds-tokens";
|
|
5742
|
+
import styled8, { css as css3 } from "styled-components";
|
|
5743
|
+
|
|
5744
|
+
// src/cells/TypographyCustom.tsx
|
|
5745
|
+
import {
|
|
5746
|
+
Typography as EdsTypography
|
|
5747
|
+
} from "@equinor/eds-core-react";
|
|
5791
5748
|
import { tokens as tokens3 } from "@equinor/eds-tokens";
|
|
5792
|
-
import
|
|
5793
|
-
import
|
|
5794
|
-
|
|
5795
|
-
|
|
5749
|
+
import styled7 from "styled-components";
|
|
5750
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
5751
|
+
var truncateStyle = {
|
|
5752
|
+
overflow: "hidden",
|
|
5753
|
+
whiteSpace: "nowrap",
|
|
5754
|
+
textOverflow: "ellipsis"
|
|
5755
|
+
};
|
|
5756
|
+
var TypographyCustom = (props) => {
|
|
5757
|
+
const { truncate, style: styleFromProps, ...edsTypographyProps } = props;
|
|
5758
|
+
if (truncate)
|
|
5759
|
+
return /* @__PURE__ */ jsx6(HoverCapture, {
|
|
5760
|
+
children: /* @__PURE__ */ jsx6(EdsTypography, {
|
|
5761
|
+
...edsTypographyProps,
|
|
5762
|
+
style: {
|
|
5763
|
+
...styleFromProps,
|
|
5764
|
+
...truncateStyle
|
|
5765
|
+
}
|
|
5766
|
+
})
|
|
5767
|
+
});
|
|
5768
|
+
return /* @__PURE__ */ jsx6(EdsTypography, {
|
|
5769
|
+
...edsTypographyProps,
|
|
5770
|
+
style: styleFromProps
|
|
5771
|
+
});
|
|
5772
|
+
};
|
|
5773
|
+
var HoverCapture = styled7.div`
|
|
5774
|
+
height: ${tokens3.typography.table.cell_text.lineHeight};
|
|
5775
|
+
background-color: inherit;
|
|
5776
|
+
|
|
5777
|
+
position: relative;
|
|
5778
|
+
width: 100%;
|
|
5779
|
+
|
|
5780
|
+
&:hover {
|
|
5781
|
+
z-index: 1;
|
|
5782
|
+
}
|
|
5783
|
+
|
|
5784
|
+
& > * {
|
|
5785
|
+
width: inherit;
|
|
5786
|
+
position: absolute;
|
|
5787
|
+
}
|
|
5788
|
+
|
|
5789
|
+
&:hover > * {
|
|
5790
|
+
width: auto;
|
|
5791
|
+
z-index: 1;
|
|
5792
|
+
padding: 0.5em 1em;
|
|
5793
|
+
margin: -0.5em -1em;
|
|
5794
|
+
|
|
5795
|
+
background-color: inherit;
|
|
5796
|
+
}
|
|
5797
|
+
`;
|
|
5798
|
+
|
|
5799
|
+
// src/cells/HierarchyCell.tsx
|
|
5800
|
+
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
5801
|
+
var CellWrapper = styled8(TypographyCustom)`
|
|
5796
5802
|
height: 100%;
|
|
5797
5803
|
display: flex;
|
|
5798
5804
|
align-items: center;
|
|
@@ -5800,11 +5806,11 @@ var CellWrapper = styled7(TypographyCustom)`
|
|
|
5800
5806
|
${({ depth, expanded }) => expanded && depth === 0 && "font-weight: bold;"}
|
|
5801
5807
|
|
|
5802
5808
|
${({ depth }) => depth > 0 && css3`
|
|
5803
|
-
border-left: 3px solid ${
|
|
5809
|
+
border-left: 3px solid ${tokens4.colors.infographic.primary__moss_green_34.hex};
|
|
5804
5810
|
gap: 0.5rem;
|
|
5805
5811
|
.--divider {
|
|
5806
5812
|
width: ${depth * 32}px;
|
|
5807
|
-
background-color: ${
|
|
5813
|
+
background-color: ${tokens4.colors.infographic.primary__moss_green_34.hex};
|
|
5808
5814
|
height: 3px;
|
|
5809
5815
|
border-radius: 0 5px 5px 0;
|
|
5810
5816
|
}
|
|
@@ -5816,7 +5822,7 @@ function HierarchyCell(cell, options = {}) {
|
|
|
5816
5822
|
depth: ((_a = options.getRowDepth) == null ? void 0 : _a.call(options)) ?? cell.row.depth,
|
|
5817
5823
|
expanded: cell.row.getIsExpanded(),
|
|
5818
5824
|
children: [
|
|
5819
|
-
/* @__PURE__ */
|
|
5825
|
+
/* @__PURE__ */ jsx7("span", {
|
|
5820
5826
|
className: "--divider"
|
|
5821
5827
|
}),
|
|
5822
5828
|
((_b = options.getDisplayName) == null ? void 0 : _b.call(options)) ?? cell.getValue()
|
|
@@ -5824,13 +5830,54 @@ function HierarchyCell(cell, options = {}) {
|
|
|
5824
5830
|
});
|
|
5825
5831
|
}
|
|
5826
5832
|
|
|
5833
|
+
// src/cells/PopoverCell.tsx
|
|
5834
|
+
import { Popover, Typography } from "@equinor/eds-core-react";
|
|
5835
|
+
import { useRef, useState as useState2 } from "react";
|
|
5836
|
+
import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
5837
|
+
var PopoverCell = (props) => {
|
|
5838
|
+
const [open, setOpen] = useState2(false);
|
|
5839
|
+
const anchorRef = useRef(null);
|
|
5840
|
+
const handleClick = () => setOpen(!open);
|
|
5841
|
+
const handleClose = () => setOpen(false);
|
|
5842
|
+
return /* @__PURE__ */ jsxs5("div", {
|
|
5843
|
+
style: { position: "relative" },
|
|
5844
|
+
ref: anchorRef,
|
|
5845
|
+
children: [
|
|
5846
|
+
/* @__PURE__ */ jsx8(TypographyCustom, {
|
|
5847
|
+
truncate: true,
|
|
5848
|
+
onClick: stopPropagation(handleClick),
|
|
5849
|
+
children: String(props.value)
|
|
5850
|
+
}),
|
|
5851
|
+
/* @__PURE__ */ jsxs5(Popover, {
|
|
5852
|
+
id: props.id,
|
|
5853
|
+
open,
|
|
5854
|
+
"aria-controls": "expand cell",
|
|
5855
|
+
anchorEl: anchorRef.current,
|
|
5856
|
+
onClose: handleClose,
|
|
5857
|
+
placement: "bottom",
|
|
5858
|
+
children: [
|
|
5859
|
+
props.title && /* @__PURE__ */ jsx8(Popover.Title, {
|
|
5860
|
+
children: /* @__PURE__ */ jsx8(Popover.Header, {
|
|
5861
|
+
children: props.title
|
|
5862
|
+
})
|
|
5863
|
+
}),
|
|
5864
|
+
/* @__PURE__ */ jsx8(Popover.Content, {
|
|
5865
|
+
children: /* @__PURE__ */ jsx8(Typography, {
|
|
5866
|
+
children: String(props.value)
|
|
5867
|
+
})
|
|
5868
|
+
})
|
|
5869
|
+
]
|
|
5870
|
+
})
|
|
5871
|
+
]
|
|
5872
|
+
});
|
|
5873
|
+
};
|
|
5874
|
+
|
|
5827
5875
|
// src/cells/SelectColumnDef.tsx
|
|
5828
5876
|
import { Button as Button2, Checkbox, Icon as Icon4, Radio } from "@equinor/eds-core-react";
|
|
5829
5877
|
import { chevron_down, chevron_up } from "@equinor/eds-icons";
|
|
5830
|
-
import
|
|
5831
|
-
import
|
|
5832
|
-
|
|
5833
|
-
var CellWrapper2 = styled8.div`
|
|
5878
|
+
import styled9 from "styled-components";
|
|
5879
|
+
import { Fragment, jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
5880
|
+
var CellWrapper2 = styled9.div`
|
|
5834
5881
|
display: flex;
|
|
5835
5882
|
align-items: center;
|
|
5836
5883
|
width: 48px;
|
|
@@ -5842,8 +5889,8 @@ function SelectColumnDef(props) {
|
|
|
5842
5889
|
return {
|
|
5843
5890
|
id: "select",
|
|
5844
5891
|
size: props.includeExpansionButton ? 96 : 48,
|
|
5845
|
-
header: ({ table }) => selectionMode !== "single" ? /* @__PURE__ */
|
|
5846
|
-
children: /* @__PURE__ */
|
|
5892
|
+
header: ({ table }) => selectionMode !== "single" ? /* @__PURE__ */ jsx9(CellWrapper2, {
|
|
5893
|
+
children: /* @__PURE__ */ jsx9(Checkbox, {
|
|
5847
5894
|
checked: table.getIsAllRowsSelected(),
|
|
5848
5895
|
indeterminate: table.getIsSomeRowsSelected(),
|
|
5849
5896
|
"aria-label": table.getIsAllRowsSelected() ? "Deselect all rows" : "Select all rows",
|
|
@@ -5852,28 +5899,28 @@ function SelectColumnDef(props) {
|
|
|
5852
5899
|
}) : null,
|
|
5853
5900
|
cell: ({ table, row }) => {
|
|
5854
5901
|
const paddingLeft = "0px";
|
|
5855
|
-
return /* @__PURE__ */
|
|
5902
|
+
return /* @__PURE__ */ jsx9(CellWrapper2, {
|
|
5856
5903
|
paddingLeft,
|
|
5857
5904
|
rowDepth: row.depth,
|
|
5858
|
-
children: /* @__PURE__ */
|
|
5905
|
+
children: /* @__PURE__ */ jsxs6(Fragment, {
|
|
5859
5906
|
children: [
|
|
5860
|
-
selectionMode === "single" ? /* @__PURE__ */
|
|
5907
|
+
selectionMode === "single" ? /* @__PURE__ */ jsx9(Radio, {
|
|
5861
5908
|
checked: row.getIsSelected(),
|
|
5862
5909
|
"aria-label": `Select row ${row.id}`,
|
|
5863
5910
|
onChange: stopPropagation(row.getToggleSelectedHandler())
|
|
5864
|
-
}) : /* @__PURE__ */
|
|
5911
|
+
}) : /* @__PURE__ */ jsx9(Checkbox, {
|
|
5865
5912
|
checked: row.getIsSelected(),
|
|
5866
5913
|
indeterminate: row.getIsSomeSelected(),
|
|
5867
5914
|
"aria-label": `Select row ${row.id}`,
|
|
5868
5915
|
onChange: stopPropagation(row.getToggleSelectedHandler())
|
|
5869
5916
|
}),
|
|
5870
|
-
row.getCanExpand() && table.options.enableExpanding && /* @__PURE__ */
|
|
5917
|
+
row.getCanExpand() && table.options.enableExpanding && /* @__PURE__ */ jsx9(Button2, {
|
|
5871
5918
|
variant: "ghost_icon",
|
|
5872
5919
|
color: "secondary",
|
|
5873
5920
|
"aria-label": row.getIsExpanded() ? "Close group" : "Expand group",
|
|
5874
5921
|
onClick: stopPropagation(row.getToggleExpandedHandler()),
|
|
5875
5922
|
style: { cursor: "pointer" },
|
|
5876
|
-
children: /* @__PURE__ */
|
|
5923
|
+
children: /* @__PURE__ */ jsx9(Icon4, {
|
|
5877
5924
|
data: row.getIsExpanded() ? chevron_up : chevron_down
|
|
5878
5925
|
})
|
|
5879
5926
|
})
|
|
@@ -5885,10 +5932,10 @@ function SelectColumnDef(props) {
|
|
|
5885
5932
|
}
|
|
5886
5933
|
|
|
5887
5934
|
// src/DataTable/components/ColumnSelect.tsx
|
|
5888
|
-
import { Button as Button3, Checkbox as Checkbox2, Divider, Icon as Icon5, Popover, Tooltip } from "@equinor/eds-core-react";
|
|
5935
|
+
import { Button as Button3, Checkbox as Checkbox2, Divider, Icon as Icon5, Popover as Popover2, Tooltip } from "@equinor/eds-core-react";
|
|
5889
5936
|
import { close, view_column } from "@equinor/eds-icons";
|
|
5890
|
-
import { useRef, useState as
|
|
5891
|
-
import
|
|
5937
|
+
import { useRef as useRef2, useState as useState3 } from "react";
|
|
5938
|
+
import styled10 from "styled-components";
|
|
5892
5939
|
|
|
5893
5940
|
// src/DataTable/utils.tsx
|
|
5894
5941
|
function capitalizeHeader(context) {
|
|
@@ -5920,28 +5967,28 @@ function getFunctionValueOrDefault(valueOrFn, fnProps, defaultValue) {
|
|
|
5920
5967
|
}
|
|
5921
5968
|
|
|
5922
5969
|
// src/DataTable/components/ColumnSelect.tsx
|
|
5923
|
-
import { Fragment as Fragment2, jsx as
|
|
5924
|
-
var ColumnSelectContent =
|
|
5970
|
+
import { Fragment as Fragment2, jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
5971
|
+
var ColumnSelectContent = styled10.div`
|
|
5925
5972
|
display: grid;
|
|
5926
5973
|
grid-template-columns: repeat(2, 1fr);
|
|
5927
5974
|
grid-gap: 0.5rem;
|
|
5928
5975
|
`;
|
|
5929
|
-
var ActionsWrapper =
|
|
5976
|
+
var ActionsWrapper = styled10.div`
|
|
5930
5977
|
display: flex;
|
|
5931
5978
|
align-items: center;
|
|
5932
5979
|
justify-content: flex-end;
|
|
5933
5980
|
gap: 0.5rem;
|
|
5934
5981
|
`;
|
|
5935
5982
|
function ColumnSelect({ table }) {
|
|
5936
|
-
const [isOpen, setIsOpen] =
|
|
5937
|
-
const referenceElement =
|
|
5983
|
+
const [isOpen, setIsOpen] = useState3(false);
|
|
5984
|
+
const referenceElement = useRef2(null);
|
|
5938
5985
|
const selectableColumns = table.getAllLeafColumns().filter((column) => column.id !== "select");
|
|
5939
|
-
return /* @__PURE__ */
|
|
5986
|
+
return /* @__PURE__ */ jsxs7(Fragment2, {
|
|
5940
5987
|
children: [
|
|
5941
|
-
/* @__PURE__ */
|
|
5988
|
+
/* @__PURE__ */ jsx10(Tooltip, {
|
|
5942
5989
|
title: "Select columns",
|
|
5943
5990
|
placement: "left",
|
|
5944
|
-
children: /* @__PURE__ */
|
|
5991
|
+
children: /* @__PURE__ */ jsx10(Button3, {
|
|
5945
5992
|
"aria-haspopup": true,
|
|
5946
5993
|
id: "column-select-anchor",
|
|
5947
5994
|
"aria-controls": "column-select-popover",
|
|
@@ -5949,29 +5996,29 @@ function ColumnSelect({ table }) {
|
|
|
5949
5996
|
ref: referenceElement,
|
|
5950
5997
|
variant: "ghost_icon",
|
|
5951
5998
|
onClick: () => setIsOpen(true),
|
|
5952
|
-
children: /* @__PURE__ */
|
|
5999
|
+
children: /* @__PURE__ */ jsx10(Icon5, {
|
|
5953
6000
|
name: "view_column",
|
|
5954
6001
|
data: view_column
|
|
5955
6002
|
})
|
|
5956
6003
|
})
|
|
5957
6004
|
}),
|
|
5958
|
-
/* @__PURE__ */
|
|
6005
|
+
/* @__PURE__ */ jsxs7(Popover2, {
|
|
5959
6006
|
open: isOpen,
|
|
5960
6007
|
id: "column-select-popover",
|
|
5961
6008
|
anchorEl: referenceElement.current,
|
|
5962
6009
|
placement: "bottom-end",
|
|
5963
6010
|
onClose: () => setIsOpen(false),
|
|
5964
6011
|
children: [
|
|
5965
|
-
/* @__PURE__ */
|
|
6012
|
+
/* @__PURE__ */ jsxs7(Popover2.Header, {
|
|
5966
6013
|
children: [
|
|
5967
|
-
/* @__PURE__ */
|
|
6014
|
+
/* @__PURE__ */ jsx10(Popover2.Title, {
|
|
5968
6015
|
children: "Column settings"
|
|
5969
6016
|
}),
|
|
5970
|
-
/* @__PURE__ */
|
|
6017
|
+
/* @__PURE__ */ jsx10(Button3, {
|
|
5971
6018
|
variant: "ghost_icon",
|
|
5972
6019
|
"aria-label": "Close column select",
|
|
5973
6020
|
onClick: () => setIsOpen(false),
|
|
5974
|
-
children: /* @__PURE__ */
|
|
6021
|
+
children: /* @__PURE__ */ jsx10(Icon5, {
|
|
5975
6022
|
name: "close",
|
|
5976
6023
|
data: close,
|
|
5977
6024
|
size: 24
|
|
@@ -5979,22 +6026,22 @@ function ColumnSelect({ table }) {
|
|
|
5979
6026
|
})
|
|
5980
6027
|
]
|
|
5981
6028
|
}),
|
|
5982
|
-
/* @__PURE__ */
|
|
6029
|
+
/* @__PURE__ */ jsxs7(Popover2.Content, {
|
|
5983
6030
|
children: [
|
|
5984
|
-
/* @__PURE__ */
|
|
6031
|
+
/* @__PURE__ */ jsx10(ColumnSelectContent, {
|
|
5985
6032
|
children: selectableColumns.map((column) => {
|
|
5986
|
-
return /* @__PURE__ */
|
|
6033
|
+
return /* @__PURE__ */ jsx10(Checkbox2, {
|
|
5987
6034
|
checked: column.getIsVisible(),
|
|
5988
6035
|
label: getColumnHeader(column),
|
|
5989
6036
|
onChange: column.getToggleVisibilityHandler()
|
|
5990
6037
|
}, column.id);
|
|
5991
6038
|
})
|
|
5992
6039
|
}),
|
|
5993
|
-
/* @__PURE__ */
|
|
6040
|
+
/* @__PURE__ */ jsx10(Divider, {
|
|
5994
6041
|
variant: "small"
|
|
5995
6042
|
}),
|
|
5996
|
-
/* @__PURE__ */
|
|
5997
|
-
children: /* @__PURE__ */
|
|
6043
|
+
/* @__PURE__ */ jsx10(ActionsWrapper, {
|
|
6044
|
+
children: /* @__PURE__ */ jsx10(Button3, {
|
|
5998
6045
|
color: "secondary",
|
|
5999
6046
|
variant: "ghost",
|
|
6000
6047
|
disabled: table.getIsAllColumnsVisible(),
|
|
@@ -6012,12 +6059,12 @@ function ColumnSelect({ table }) {
|
|
|
6012
6059
|
|
|
6013
6060
|
// src/DataTable/components/TableHeader.tsx
|
|
6014
6061
|
import { Table as Table4 } from "@equinor/eds-core-react";
|
|
6015
|
-
import { jsx as
|
|
6062
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
6016
6063
|
function TableHeader({ table, sticky }) {
|
|
6017
|
-
return /* @__PURE__ */
|
|
6064
|
+
return /* @__PURE__ */ jsx11(Table4.Head, {
|
|
6018
6065
|
sticky,
|
|
6019
|
-
children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */
|
|
6020
|
-
children: headerGroup.headers.map((header) => /* @__PURE__ */
|
|
6066
|
+
children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx11(Table4.Row, {
|
|
6067
|
+
children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx11(HeaderCell, {
|
|
6021
6068
|
header
|
|
6022
6069
|
}, header.id))
|
|
6023
6070
|
}, headerGroup.id))
|
|
@@ -6032,29 +6079,28 @@ import {
|
|
|
6032
6079
|
getSortedRowModel,
|
|
6033
6080
|
useReactTable
|
|
6034
6081
|
} from "@tanstack/react-table";
|
|
6035
|
-
import {
|
|
6036
|
-
import
|
|
6037
|
-
import styled15 from "styled-components";
|
|
6082
|
+
import { useEffect as useEffect3, useRef as useRef3, useState as useState5 } from "react";
|
|
6083
|
+
import styled16 from "styled-components";
|
|
6038
6084
|
|
|
6039
6085
|
// src/DataTable/components/BasicTable.tsx
|
|
6040
6086
|
import { Table as EdsTable } from "@equinor/eds-core-react";
|
|
6041
6087
|
|
|
6042
6088
|
// src/DataTable/components/PlaceholderRow.tsx
|
|
6043
|
-
import { DotProgress, Table as Table5, Typography } from "@equinor/eds-core-react";
|
|
6044
|
-
import
|
|
6045
|
-
import { jsx as
|
|
6046
|
-
var PlaceholderTextWrapper =
|
|
6089
|
+
import { DotProgress, Table as Table5, Typography as Typography2 } from "@equinor/eds-core-react";
|
|
6090
|
+
import styled11 from "styled-components";
|
|
6091
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
6092
|
+
var PlaceholderTextWrapper = styled11.div`
|
|
6047
6093
|
display: flex;
|
|
6048
6094
|
justify-content: center;
|
|
6049
6095
|
`;
|
|
6050
6096
|
function PlaceholderRow({ isLoading }) {
|
|
6051
|
-
return /* @__PURE__ */
|
|
6052
|
-
children: /* @__PURE__ */
|
|
6097
|
+
return /* @__PURE__ */ jsx12(Table5.Row, {
|
|
6098
|
+
children: /* @__PURE__ */ jsx12(Table5.Cell, {
|
|
6053
6099
|
colSpan: 100,
|
|
6054
|
-
children: /* @__PURE__ */
|
|
6055
|
-
children: isLoading ? /* @__PURE__ */
|
|
6100
|
+
children: /* @__PURE__ */ jsx12(PlaceholderTextWrapper, {
|
|
6101
|
+
children: isLoading ? /* @__PURE__ */ jsx12(DotProgress, {
|
|
6056
6102
|
color: "primary"
|
|
6057
|
-
}) : /* @__PURE__ */
|
|
6103
|
+
}) : /* @__PURE__ */ jsx12(Typography2, {
|
|
6058
6104
|
children: "No data available"
|
|
6059
6105
|
})
|
|
6060
6106
|
})
|
|
@@ -6064,8 +6110,8 @@ function PlaceholderRow({ isLoading }) {
|
|
|
6064
6110
|
|
|
6065
6111
|
// src/DataTable/components/TableBody.tsx
|
|
6066
6112
|
import { Table as Table6 } from "@equinor/eds-core-react";
|
|
6067
|
-
import
|
|
6068
|
-
var TableBody =
|
|
6113
|
+
import styled12 from "styled-components";
|
|
6114
|
+
var TableBody = styled12(Table6.Body)`
|
|
6069
6115
|
// The following attribute are important for fixed column width
|
|
6070
6116
|
// CHANGE THES WITH CAUTION
|
|
6071
6117
|
background: inherit;
|
|
@@ -6073,12 +6119,12 @@ var TableBody = styled11(Table6.Body)`
|
|
|
6073
6119
|
|
|
6074
6120
|
// src/DataTable/components/TableRow.tsx
|
|
6075
6121
|
import { Table as Table7 } from "@equinor/eds-core-react";
|
|
6076
|
-
import
|
|
6077
|
-
import { jsx as
|
|
6122
|
+
import styled13 from "styled-components";
|
|
6123
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
6078
6124
|
function TableRow({ row, rowConfig, cellConfig }) {
|
|
6079
6125
|
var _a;
|
|
6080
6126
|
const rowWrapper = rowConfig == null ? void 0 : rowConfig.rowWrapper;
|
|
6081
|
-
const tableRowContent = /* @__PURE__ */
|
|
6127
|
+
const tableRowContent = /* @__PURE__ */ jsx13(StyledTableRow, {
|
|
6082
6128
|
active: row.getIsSelected(),
|
|
6083
6129
|
style: {
|
|
6084
6130
|
cursor: (rowConfig == null ? void 0 : rowConfig.onClick) ? "pointer" : "initial",
|
|
@@ -6092,7 +6138,7 @@ function TableRow({ row, rowConfig, cellConfig }) {
|
|
|
6092
6138
|
onMouseLeave: handleRowEvent(row, rowConfig == null ? void 0 : rowConfig.onMouseLeave),
|
|
6093
6139
|
children: row.getVisibleCells().map((cell) => {
|
|
6094
6140
|
var _a2;
|
|
6095
|
-
return /* @__PURE__ */
|
|
6141
|
+
return /* @__PURE__ */ jsx13(DynamicCell, {
|
|
6096
6142
|
cell,
|
|
6097
6143
|
getStickyCellColor: cellConfig == null ? void 0 : cellConfig.getStickyCellColor,
|
|
6098
6144
|
highlight: (_a2 = cellConfig == null ? void 0 : cellConfig.getShouldHighlight) == null ? void 0 : _a2.call(cellConfig, cell)
|
|
@@ -6101,7 +6147,7 @@ function TableRow({ row, rowConfig, cellConfig }) {
|
|
|
6101
6147
|
});
|
|
6102
6148
|
return rowWrapper ? rowWrapper({ row, children: tableRowContent }) : tableRowContent;
|
|
6103
6149
|
}
|
|
6104
|
-
var StyledTableRow =
|
|
6150
|
+
var StyledTableRow = styled13(Table7.Row)`
|
|
6105
6151
|
/* Background color must be inherited here. Does not work with inline styling */
|
|
6106
6152
|
${({ active }) => active ? "" : "background-color: inherit;"}
|
|
6107
6153
|
`;
|
|
@@ -6114,7 +6160,7 @@ function handleRowEvent(row, handler) {
|
|
|
6114
6160
|
}
|
|
6115
6161
|
|
|
6116
6162
|
// src/DataTable/components/BasicTable.tsx
|
|
6117
|
-
import { jsx as
|
|
6163
|
+
import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
6118
6164
|
function BasicTable({
|
|
6119
6165
|
table,
|
|
6120
6166
|
rowConfig,
|
|
@@ -6124,22 +6170,22 @@ function BasicTable({
|
|
|
6124
6170
|
tableCaption
|
|
6125
6171
|
}) {
|
|
6126
6172
|
const tableRows = table.getRowModel().rows;
|
|
6127
|
-
return /* @__PURE__ */
|
|
6173
|
+
return /* @__PURE__ */ jsxs8(EdsTable, {
|
|
6128
6174
|
children: [
|
|
6129
|
-
/* @__PURE__ */
|
|
6175
|
+
/* @__PURE__ */ jsx14(EdsTable.Caption, {
|
|
6130
6176
|
hidden: true,
|
|
6131
6177
|
children: tableCaption
|
|
6132
6178
|
}),
|
|
6133
|
-
/* @__PURE__ */
|
|
6179
|
+
/* @__PURE__ */ jsx14(TableHeader, {
|
|
6134
6180
|
sticky: stickyHeader,
|
|
6135
6181
|
table
|
|
6136
6182
|
}),
|
|
6137
|
-
/* @__PURE__ */
|
|
6138
|
-
children: tableRows.length ? tableRows.map((row) => /* @__PURE__ */
|
|
6183
|
+
/* @__PURE__ */ jsx14(TableBody, {
|
|
6184
|
+
children: tableRows.length ? tableRows.map((row) => /* @__PURE__ */ jsx14(TableRow, {
|
|
6139
6185
|
row,
|
|
6140
6186
|
rowConfig,
|
|
6141
6187
|
cellConfig
|
|
6142
|
-
}, row.id)) : /* @__PURE__ */
|
|
6188
|
+
}, row.id)) : /* @__PURE__ */ jsx14(PlaceholderRow, {
|
|
6143
6189
|
isLoading
|
|
6144
6190
|
})
|
|
6145
6191
|
})
|
|
@@ -6148,20 +6194,20 @@ function BasicTable({
|
|
|
6148
6194
|
}
|
|
6149
6195
|
|
|
6150
6196
|
// src/DataTable/components/DataTableHeader.tsx
|
|
6151
|
-
import { Typography as
|
|
6197
|
+
import { Typography as Typography3 } from "@equinor/eds-core-react";
|
|
6152
6198
|
import { search } from "@equinor/eds-icons";
|
|
6153
|
-
import
|
|
6199
|
+
import styled15 from "styled-components";
|
|
6154
6200
|
|
|
6155
6201
|
// src/DataTable/filters/DebouncedInput.tsx
|
|
6156
6202
|
import { Button as Button4, Icon as Icon6, Input, Tooltip as Tooltip2 } from "@equinor/eds-core-react";
|
|
6157
6203
|
import { close as close2 } from "@equinor/eds-icons";
|
|
6158
|
-
import { useEffect, useState as
|
|
6159
|
-
import
|
|
6160
|
-
import { jsx as
|
|
6161
|
-
var Wrapper3 =
|
|
6204
|
+
import { useEffect, useState as useState4 } from "react";
|
|
6205
|
+
import styled14 from "styled-components";
|
|
6206
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
6207
|
+
var Wrapper3 = styled14.div`
|
|
6162
6208
|
width: 200px;
|
|
6163
6209
|
`;
|
|
6164
|
-
var CloseButton =
|
|
6210
|
+
var CloseButton = styled14(Button4)`
|
|
6165
6211
|
width: 24px;
|
|
6166
6212
|
height: 24px;
|
|
6167
6213
|
`;
|
|
@@ -6172,7 +6218,7 @@ function DebouncedInput({
|
|
|
6172
6218
|
debounce = 500,
|
|
6173
6219
|
...props
|
|
6174
6220
|
}) {
|
|
6175
|
-
const [value, setValue] =
|
|
6221
|
+
const [value, setValue] = useState4(initialValue);
|
|
6176
6222
|
useEffect(() => {
|
|
6177
6223
|
setValue(initialValue);
|
|
6178
6224
|
}, [initialValue]);
|
|
@@ -6182,21 +6228,21 @@ function DebouncedInput({
|
|
|
6182
6228
|
}, debounce);
|
|
6183
6229
|
return () => clearTimeout(timeout);
|
|
6184
6230
|
}, [value]);
|
|
6185
|
-
return /* @__PURE__ */
|
|
6186
|
-
children: /* @__PURE__ */
|
|
6231
|
+
return /* @__PURE__ */ jsx15(Wrapper3, {
|
|
6232
|
+
children: /* @__PURE__ */ jsx15(Input, {
|
|
6187
6233
|
...props,
|
|
6188
6234
|
value,
|
|
6189
|
-
leftAdornments: icon && /* @__PURE__ */
|
|
6235
|
+
leftAdornments: icon && /* @__PURE__ */ jsx15(Icon6, {
|
|
6190
6236
|
name: icon.name,
|
|
6191
6237
|
data: icon,
|
|
6192
6238
|
size: 18
|
|
6193
6239
|
}),
|
|
6194
|
-
rightAdornments: !!value && /* @__PURE__ */
|
|
6240
|
+
rightAdornments: !!value && /* @__PURE__ */ jsx15(Tooltip2, {
|
|
6195
6241
|
title: "Clear input",
|
|
6196
|
-
children: /* @__PURE__ */
|
|
6242
|
+
children: /* @__PURE__ */ jsx15(CloseButton, {
|
|
6197
6243
|
variant: "ghost_icon",
|
|
6198
6244
|
onClick: () => setValue(""),
|
|
6199
|
-
children: /* @__PURE__ */
|
|
6245
|
+
children: /* @__PURE__ */ jsx15(Icon6, {
|
|
6200
6246
|
name: close2.name,
|
|
6201
6247
|
data: close2,
|
|
6202
6248
|
size: 18
|
|
@@ -6219,15 +6265,15 @@ var fuzzyFilter = (row, columnId, value, addMeta) => {
|
|
|
6219
6265
|
};
|
|
6220
6266
|
|
|
6221
6267
|
// src/DataTable/components/DataTableHeader.tsx
|
|
6222
|
-
import { Fragment as Fragment3, jsx as
|
|
6223
|
-
var TableBannerWrapper =
|
|
6268
|
+
import { Fragment as Fragment3, jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
6269
|
+
var TableBannerWrapper = styled15.div`
|
|
6224
6270
|
display: flex;
|
|
6225
6271
|
align-items: center;
|
|
6226
6272
|
justify-content: space-between;
|
|
6227
6273
|
gap: 0.5rem;
|
|
6228
6274
|
padding: ${(props) => props.padding || "1rem"};
|
|
6229
6275
|
`;
|
|
6230
|
-
var FilterContainer =
|
|
6276
|
+
var FilterContainer = styled15.div`
|
|
6231
6277
|
display: flex;
|
|
6232
6278
|
align-items: center;
|
|
6233
6279
|
gap: 1rem;
|
|
@@ -6240,14 +6286,14 @@ function TableBanner({
|
|
|
6240
6286
|
globalFilter
|
|
6241
6287
|
}) {
|
|
6242
6288
|
var _a;
|
|
6243
|
-
return /* @__PURE__ */
|
|
6289
|
+
return /* @__PURE__ */ jsxs9(TableBannerWrapper, {
|
|
6244
6290
|
className: "--table-caption",
|
|
6245
6291
|
padding: bannerConfig == null ? void 0 : bannerConfig.padding,
|
|
6246
6292
|
children: [
|
|
6247
|
-
/* @__PURE__ */
|
|
6293
|
+
/* @__PURE__ */ jsxs9(FilterContainer, {
|
|
6248
6294
|
className: "--filter-container-left",
|
|
6249
6295
|
children: [
|
|
6250
|
-
(bannerConfig == null ? void 0 : bannerConfig.enableTableCaption) && /* @__PURE__ */
|
|
6296
|
+
(bannerConfig == null ? void 0 : bannerConfig.enableTableCaption) && /* @__PURE__ */ jsx16(Typography3, {
|
|
6251
6297
|
variant: "h3",
|
|
6252
6298
|
as: "h2",
|
|
6253
6299
|
children: tableCaption
|
|
@@ -6255,20 +6301,20 @@ function TableBanner({
|
|
|
6255
6301
|
(_a = bannerConfig == null ? void 0 : bannerConfig.customActions) == null ? void 0 : _a.call(bannerConfig, table)
|
|
6256
6302
|
]
|
|
6257
6303
|
}),
|
|
6258
|
-
/* @__PURE__ */
|
|
6304
|
+
/* @__PURE__ */ jsx16(FilterContainer, {
|
|
6259
6305
|
className: "--filter-container-right",
|
|
6260
|
-
children: /* @__PURE__ */
|
|
6306
|
+
children: /* @__PURE__ */ jsxs9(Fragment3, {
|
|
6261
6307
|
children: [
|
|
6262
|
-
(bannerConfig == null ? void 0 : bannerConfig.enableGlobalFilterInput) && /* @__PURE__ */
|
|
6308
|
+
(bannerConfig == null ? void 0 : bannerConfig.enableGlobalFilterInput) && /* @__PURE__ */ jsx16(DebouncedInput, {
|
|
6263
6309
|
value: globalFilter.state,
|
|
6264
6310
|
icon: search,
|
|
6265
6311
|
placeholder: bannerConfig.globalFilterPlaceholder ?? "Search all columns",
|
|
6266
6312
|
onChange: (value) => globalFilter.onChange(String(value))
|
|
6267
6313
|
}),
|
|
6268
|
-
(bannerConfig == null ? void 0 : bannerConfig.enableColumnSelect) && /* @__PURE__ */
|
|
6314
|
+
(bannerConfig == null ? void 0 : bannerConfig.enableColumnSelect) && /* @__PURE__ */ jsx16(ColumnSelect, {
|
|
6269
6315
|
table
|
|
6270
6316
|
}),
|
|
6271
|
-
(bannerConfig == null ? void 0 : bannerConfig.totalRowCount) && /* @__PURE__ */
|
|
6317
|
+
(bannerConfig == null ? void 0 : bannerConfig.totalRowCount) && /* @__PURE__ */ jsxs9("span", {
|
|
6272
6318
|
children: [
|
|
6273
6319
|
table.options.data.length.toLocaleString(),
|
|
6274
6320
|
" /",
|
|
@@ -6290,19 +6336,19 @@ import { useVirtualizer } from "@tanstack/react-virtual";
|
|
|
6290
6336
|
|
|
6291
6337
|
// src/DataTable/components/PaddingRow.tsx
|
|
6292
6338
|
import { Table as Table8 } from "@equinor/eds-core-react";
|
|
6293
|
-
import { jsx as
|
|
6339
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
6294
6340
|
var PaddingRow = (props) => {
|
|
6295
6341
|
if (!props.height)
|
|
6296
6342
|
return null;
|
|
6297
|
-
return /* @__PURE__ */
|
|
6298
|
-
children: /* @__PURE__ */
|
|
6343
|
+
return /* @__PURE__ */ jsx17(Table8.Row, {
|
|
6344
|
+
children: /* @__PURE__ */ jsx17(Table8.Cell, {
|
|
6299
6345
|
style: { height: `${props.height}px` }
|
|
6300
6346
|
})
|
|
6301
6347
|
});
|
|
6302
6348
|
};
|
|
6303
6349
|
|
|
6304
6350
|
// src/DataTable/components/VirtualTable.tsx
|
|
6305
|
-
import { jsx as
|
|
6351
|
+
import { jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
6306
6352
|
function VirtualTable({
|
|
6307
6353
|
table,
|
|
6308
6354
|
rowConfig,
|
|
@@ -6321,32 +6367,32 @@ function VirtualTable({
|
|
|
6321
6367
|
const virtualRows = rowVirtualizer.getVirtualItems();
|
|
6322
6368
|
const paddingTop = virtualRows.length > 0 ? ((_a = virtualRows == null ? void 0 : virtualRows[0]) == null ? void 0 : _a.start) || 0 : 0;
|
|
6323
6369
|
const paddingBottom = virtualRows.length > 0 ? rowVirtualizer.getTotalSize() - (((_b = virtualRows == null ? void 0 : virtualRows[virtualRows.length - 1]) == null ? void 0 : _b.end) || 0) : 0;
|
|
6324
|
-
return /* @__PURE__ */
|
|
6370
|
+
return /* @__PURE__ */ jsxs10(Table9, {
|
|
6325
6371
|
children: [
|
|
6326
|
-
/* @__PURE__ */
|
|
6372
|
+
/* @__PURE__ */ jsx18(Table9.Caption, {
|
|
6327
6373
|
hidden: true,
|
|
6328
6374
|
children: props.tableCaption
|
|
6329
6375
|
}),
|
|
6330
|
-
/* @__PURE__ */
|
|
6376
|
+
/* @__PURE__ */ jsx18(TableHeader, {
|
|
6331
6377
|
sticky: props.stickyHeader,
|
|
6332
6378
|
table
|
|
6333
6379
|
}),
|
|
6334
|
-
/* @__PURE__ */
|
|
6380
|
+
/* @__PURE__ */ jsxs10(TableBody, {
|
|
6335
6381
|
children: [
|
|
6336
|
-
/* @__PURE__ */
|
|
6382
|
+
/* @__PURE__ */ jsx18(PaddingRow, {
|
|
6337
6383
|
height: paddingTop
|
|
6338
6384
|
}),
|
|
6339
6385
|
rows.length ? virtualRows.map((virtualRow) => {
|
|
6340
6386
|
const row = rows[virtualRow.index];
|
|
6341
|
-
return /* @__PURE__ */
|
|
6387
|
+
return /* @__PURE__ */ jsx18(TableRow, {
|
|
6342
6388
|
row,
|
|
6343
6389
|
rowConfig,
|
|
6344
6390
|
cellConfig
|
|
6345
6391
|
}, row.id);
|
|
6346
|
-
}) : /* @__PURE__ */
|
|
6392
|
+
}) : /* @__PURE__ */ jsx18(PlaceholderRow, {
|
|
6347
6393
|
isLoading: props.isLoading
|
|
6348
6394
|
}),
|
|
6349
|
-
/* @__PURE__ */
|
|
6395
|
+
/* @__PURE__ */ jsx18(PaddingRow, {
|
|
6350
6396
|
height: paddingBottom
|
|
6351
6397
|
})
|
|
6352
6398
|
]
|
|
@@ -6385,8 +6431,8 @@ function useFetchMoreOnBottomReached(tableContainerRef, infiniteScrollConfig) {
|
|
|
6385
6431
|
}
|
|
6386
6432
|
|
|
6387
6433
|
// src/DataTable/DataTable.tsx
|
|
6388
|
-
import { jsx as
|
|
6389
|
-
var DataTableWrapper =
|
|
6434
|
+
import { jsx as jsx19, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
6435
|
+
var DataTableWrapper = styled16.div`
|
|
6390
6436
|
width: ${(props) => props.width ?? "100%"};
|
|
6391
6437
|
|
|
6392
6438
|
.--table-container {
|
|
@@ -6406,12 +6452,12 @@ var DataTableWrapper = styled15.div`
|
|
|
6406
6452
|
function DataTable(props) {
|
|
6407
6453
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
6408
6454
|
const { columns, data, bannerConfig, cellConfig, sorting } = props;
|
|
6409
|
-
const [internalColumnVisibility, setInternalColumnVisibility] =
|
|
6455
|
+
const [internalColumnVisibility, setInternalColumnVisibility] = useState5({});
|
|
6410
6456
|
const [columnVisibility, setColumnVisibility] = [
|
|
6411
6457
|
((_a = props.columnVisibility) == null ? void 0 : _a.state) ?? internalColumnVisibility,
|
|
6412
6458
|
((_b = props.columnVisibility) == null ? void 0 : _b.onChange) ?? setInternalColumnVisibility
|
|
6413
6459
|
];
|
|
6414
|
-
const [internalGlobalFilterState, setInternalGlobalFilterState] =
|
|
6460
|
+
const [internalGlobalFilterState, setInternalGlobalFilterState] = useState5("");
|
|
6415
6461
|
const [globalFilterState, setGlobalFilterState] = [
|
|
6416
6462
|
((_c = props.globalFilter) == null ? void 0 : _c.state) ?? internalGlobalFilterState,
|
|
6417
6463
|
((_d = props.globalFilter) == null ? void 0 : _d.onChange) ?? setInternalGlobalFilterState
|
|
@@ -6420,17 +6466,17 @@ function DataTable(props) {
|
|
|
6420
6466
|
function enableGlobalFilter(value) {
|
|
6421
6467
|
return enableOrUndefined(shouldEnableGlobalFilter, value);
|
|
6422
6468
|
}
|
|
6423
|
-
const [internalSortingState, setInternalSortingState] =
|
|
6469
|
+
const [internalSortingState, setInternalSortingState] = useState5([]);
|
|
6424
6470
|
const [sortingState, setSortingState] = [
|
|
6425
6471
|
((_f = props.sorting) == null ? void 0 : _f.state) ?? internalSortingState,
|
|
6426
6472
|
((_g = props.sorting) == null ? void 0 : _g.onChange) ?? setInternalSortingState
|
|
6427
6473
|
];
|
|
6428
|
-
const [internalRowSelectionState, setInternalRowSelectionState] =
|
|
6474
|
+
const [internalRowSelectionState, setInternalRowSelectionState] = useState5({});
|
|
6429
6475
|
const [rowSelectionState, setRowSelectionState] = [
|
|
6430
6476
|
((_h = props.rowSelection) == null ? void 0 : _h.state) ?? internalRowSelectionState,
|
|
6431
6477
|
((_i = props.rowSelection) == null ? void 0 : _i.onChange) ?? setInternalRowSelectionState
|
|
6432
6478
|
];
|
|
6433
|
-
const [internalExpandedState, setInternalExpandedState] =
|
|
6479
|
+
const [internalExpandedState, setInternalExpandedState] = useState5({});
|
|
6434
6480
|
const [expandedState, setExpandedState] = [
|
|
6435
6481
|
((_j = props.expansion) == null ? void 0 : _j.state) ?? internalExpandedState,
|
|
6436
6482
|
((_k = props.expansion) == null ? void 0 : _k.onChange) ?? setInternalExpandedState
|
|
@@ -6449,7 +6495,7 @@ function DataTable(props) {
|
|
|
6449
6495
|
defaultColumn: {
|
|
6450
6496
|
cell: ({ cell }) => {
|
|
6451
6497
|
const truncateMode = getFunctionValueOrDefault(cellConfig == null ? void 0 : cellConfig.truncateMode, cell, "hover");
|
|
6452
|
-
return /* @__PURE__ */
|
|
6498
|
+
return /* @__PURE__ */ jsx19(TypographyCustom, {
|
|
6453
6499
|
truncate: truncateMode === "hover",
|
|
6454
6500
|
children: cell.getValue()
|
|
6455
6501
|
});
|
|
@@ -6480,23 +6526,23 @@ function DataTable(props) {
|
|
|
6480
6526
|
}
|
|
6481
6527
|
}, [table, (_p = props.expansion) == null ? void 0 : _p.expandAllByDefault]);
|
|
6482
6528
|
const { isLoading, rowConfig } = props;
|
|
6483
|
-
const tableContainerRef =
|
|
6529
|
+
const tableContainerRef = useRef3(null);
|
|
6484
6530
|
const onTableContainerScroll = useFetchMoreOnBottomReached(
|
|
6485
6531
|
tableContainerRef,
|
|
6486
6532
|
props.infiniteScroll
|
|
6487
6533
|
);
|
|
6488
|
-
return /* @__PURE__ */
|
|
6534
|
+
return /* @__PURE__ */ jsxs11(DataTableWrapper, {
|
|
6489
6535
|
height: props == null ? void 0 : props.height,
|
|
6490
6536
|
width: props == null ? void 0 : props.width,
|
|
6491
6537
|
tableLayout: props == null ? void 0 : props.tableLayout,
|
|
6492
6538
|
children: [
|
|
6493
|
-
props.bannerConfig && /* @__PURE__ */
|
|
6539
|
+
props.bannerConfig && /* @__PURE__ */ jsx19(TableBanner, {
|
|
6494
6540
|
table,
|
|
6495
6541
|
bannerConfig: props.bannerConfig,
|
|
6496
6542
|
globalFilter: { state: globalFilterState, onChange: setGlobalFilterState },
|
|
6497
6543
|
tableCaption: props.tableCaption
|
|
6498
6544
|
}),
|
|
6499
|
-
/* @__PURE__ */
|
|
6545
|
+
/* @__PURE__ */ jsx19("div", {
|
|
6500
6546
|
...props.tableContainerProps,
|
|
6501
6547
|
className: "--table-container " + ((_q = props.tableContainerProps) == null ? void 0 : _q.className),
|
|
6502
6548
|
onScroll: ((_r = props.tableContainerProps) == null ? void 0 : _r.onScroll) ?? onTableContainerScroll,
|
|
@@ -6509,7 +6555,7 @@ function DataTable(props) {
|
|
|
6509
6555
|
}
|
|
6510
6556
|
}
|
|
6511
6557
|
},
|
|
6512
|
-
children: (props == null ? void 0 : props.virtual) ? /* @__PURE__ */
|
|
6558
|
+
children: (props == null ? void 0 : props.virtual) ? /* @__PURE__ */ jsx19(VirtualTable, {
|
|
6513
6559
|
containerRef: tableContainerRef,
|
|
6514
6560
|
tableCaption: props.tableCaption,
|
|
6515
6561
|
table,
|
|
@@ -6517,7 +6563,7 @@ function DataTable(props) {
|
|
|
6517
6563
|
cellConfig,
|
|
6518
6564
|
isLoading,
|
|
6519
6565
|
stickyHeader: props.stickyHeader
|
|
6520
|
-
}) : /* @__PURE__ */
|
|
6566
|
+
}) : /* @__PURE__ */ jsx19(BasicTable, {
|
|
6521
6567
|
tableCaption: props.tableCaption,
|
|
6522
6568
|
table,
|
|
6523
6569
|
rowConfig,
|
|
@@ -6529,25 +6575,478 @@ function DataTable(props) {
|
|
|
6529
6575
|
]
|
|
6530
6576
|
});
|
|
6531
6577
|
}
|
|
6578
|
+
|
|
6579
|
+
// src/form-cells/EditableCheckboxCell.tsx
|
|
6580
|
+
import { Checkbox as Checkbox3, EdsProvider } from "@equinor/eds-core-react";
|
|
6581
|
+
import { Controller, useFormContext as useFormContext2 } from "react-hook-form";
|
|
6582
|
+
|
|
6583
|
+
// src/form-meta/utils.tsx
|
|
6584
|
+
var import_lodash = __toESM(require_lodash());
|
|
6585
|
+
import { useFormContext } from "react-hook-form";
|
|
6586
|
+
var formMeta = {
|
|
6587
|
+
_editMode: false,
|
|
6588
|
+
_isNew: false,
|
|
6589
|
+
_hasRemoteChange: false
|
|
6590
|
+
};
|
|
6591
|
+
function useEditMode() {
|
|
6592
|
+
const { watch } = useFormContext();
|
|
6593
|
+
return watch("_editMode") ?? false;
|
|
6594
|
+
}
|
|
6595
|
+
function useHasRemoteChange() {
|
|
6596
|
+
const { watch } = useFormContext();
|
|
6597
|
+
return watch("_hasRemoteChange") ?? false;
|
|
6598
|
+
}
|
|
6599
|
+
function useGetIsNew() {
|
|
6600
|
+
const { getValues } = useFormContext();
|
|
6601
|
+
return () => getValues("_isNew") ?? false;
|
|
6602
|
+
}
|
|
6603
|
+
function useSetFormMeta() {
|
|
6604
|
+
const { setValue } = useFormContext();
|
|
6605
|
+
return (newValues) => objectKeys(newValues).forEach((key) => newValues[key] && setValue(key, newValues[key]));
|
|
6606
|
+
}
|
|
6607
|
+
function objectKeys(obj) {
|
|
6608
|
+
return Object.keys(obj);
|
|
6609
|
+
}
|
|
6610
|
+
function removeFormMeta(withFormMeta) {
|
|
6611
|
+
return (0, import_lodash.omit)(withFormMeta, Object.keys(formMeta));
|
|
6612
|
+
}
|
|
6613
|
+
function addFormMeta(withoutFormMeta) {
|
|
6614
|
+
return { ...formMeta, ...withoutFormMeta };
|
|
6615
|
+
}
|
|
6616
|
+
|
|
6617
|
+
// src/form-cells/EditableCheckboxCell.tsx
|
|
6618
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
6619
|
+
function EditableCheckboxCell(context) {
|
|
6620
|
+
const editMode = useEditMode();
|
|
6621
|
+
const { control } = useFormContext2();
|
|
6622
|
+
if (!editMode)
|
|
6623
|
+
return /* @__PURE__ */ jsx20(EdsProvider, {
|
|
6624
|
+
density: "compact",
|
|
6625
|
+
children: /* @__PURE__ */ jsx20(Checkbox3, {
|
|
6626
|
+
enterKeyHint: "next",
|
|
6627
|
+
"aria-label": "readonly",
|
|
6628
|
+
readOnly: true,
|
|
6629
|
+
checked: context.getValue(),
|
|
6630
|
+
disabled: true
|
|
6631
|
+
})
|
|
6632
|
+
});
|
|
6633
|
+
return /* @__PURE__ */ jsx20(Controller, {
|
|
6634
|
+
control,
|
|
6635
|
+
name: context.column.id,
|
|
6636
|
+
render: ({ field: { value, ...field } }) => /* @__PURE__ */ jsx20(EdsProvider, {
|
|
6637
|
+
density: "compact",
|
|
6638
|
+
children: /* @__PURE__ */ jsx20(Checkbox3, {
|
|
6639
|
+
enterKeyHint: "send",
|
|
6640
|
+
"aria-label": "editable",
|
|
6641
|
+
checked: value,
|
|
6642
|
+
...field
|
|
6643
|
+
})
|
|
6644
|
+
})
|
|
6645
|
+
});
|
|
6646
|
+
}
|
|
6647
|
+
|
|
6648
|
+
// src/form-cells/EditableDateCell.tsx
|
|
6649
|
+
import { TextField } from "@equinor/eds-core-react";
|
|
6650
|
+
import { useMemo } from "react";
|
|
6651
|
+
import { Controller as Controller2, useFormContext as useFormContext3 } from "react-hook-form";
|
|
6652
|
+
import styled17 from "styled-components";
|
|
6653
|
+
|
|
6654
|
+
// src/form-cells/utils.tsx
|
|
6655
|
+
import { Icon as Icon7 } from "@equinor/eds-core-react";
|
|
6656
|
+
import { error_filled, warning_filled } from "@equinor/eds-icons";
|
|
6657
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
6658
|
+
function getHelperTextProps({
|
|
6659
|
+
error,
|
|
6660
|
+
warning,
|
|
6661
|
+
helperText
|
|
6662
|
+
}) {
|
|
6663
|
+
if (error)
|
|
6664
|
+
return {
|
|
6665
|
+
variant: "error",
|
|
6666
|
+
helperText: error.message,
|
|
6667
|
+
helperIcon: /* @__PURE__ */ jsx21(Icon7, {
|
|
6668
|
+
data: error_filled,
|
|
6669
|
+
size: 16
|
|
6670
|
+
})
|
|
6671
|
+
};
|
|
6672
|
+
if (warning)
|
|
6673
|
+
return {
|
|
6674
|
+
variant: "warning",
|
|
6675
|
+
helperText: warning.message,
|
|
6676
|
+
helperIcon: /* @__PURE__ */ jsx21(Icon7, {
|
|
6677
|
+
data: warning_filled,
|
|
6678
|
+
size: 16
|
|
6679
|
+
})
|
|
6680
|
+
};
|
|
6681
|
+
return {
|
|
6682
|
+
helperText,
|
|
6683
|
+
helperIcon: null
|
|
6684
|
+
};
|
|
6685
|
+
}
|
|
6686
|
+
function stopPropagation2(handler) {
|
|
6687
|
+
return (e) => {
|
|
6688
|
+
e.stopPropagation();
|
|
6689
|
+
handler(e);
|
|
6690
|
+
};
|
|
6691
|
+
}
|
|
6692
|
+
|
|
6693
|
+
// src/form-cells/EditableDateCell.tsx
|
|
6694
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
6695
|
+
function EditableDateCell(props) {
|
|
6696
|
+
const { dateStringFormatter, ...context } = props;
|
|
6697
|
+
const rawValue = context.getValue();
|
|
6698
|
+
const editMode = useEditMode();
|
|
6699
|
+
const { control } = useFormContext3();
|
|
6700
|
+
const formattedValue = useMemo(
|
|
6701
|
+
() => (dateStringFormatter == null ? void 0 : dateStringFormatter(rawValue)) ?? rawValue,
|
|
6702
|
+
[rawValue, dateStringFormatter]
|
|
6703
|
+
);
|
|
6704
|
+
if (!editMode)
|
|
6705
|
+
return /* @__PURE__ */ jsx22(TypographyCustom, {
|
|
6706
|
+
truncate: true,
|
|
6707
|
+
children: formattedValue
|
|
6708
|
+
});
|
|
6709
|
+
return /* @__PURE__ */ jsx22(Controller2, {
|
|
6710
|
+
control,
|
|
6711
|
+
name: context.column.id,
|
|
6712
|
+
render: ({ field: { value, onChange, ...field }, fieldState: { error } }) => /* @__PURE__ */ jsx22(InlineTextField, {
|
|
6713
|
+
id: context.column.id,
|
|
6714
|
+
type: "date",
|
|
6715
|
+
autoComplete: "none",
|
|
6716
|
+
value: value ? parseISODate(value) : "",
|
|
6717
|
+
onChange: (e) => onChange(e.target.value ? parseISODate(e.target.value) : ""),
|
|
6718
|
+
...getHelperTextProps({ error }),
|
|
6719
|
+
...field
|
|
6720
|
+
})
|
|
6721
|
+
});
|
|
6722
|
+
}
|
|
6723
|
+
function parseISODate(dateString) {
|
|
6724
|
+
const date = new Date(dateString);
|
|
6725
|
+
const offset = date.getTimezoneOffset();
|
|
6726
|
+
const dateWithoutOffset = new Date(date.getTime() - offset * 60 * 1e3);
|
|
6727
|
+
return dateWithoutOffset.toISOString().split("T")[0];
|
|
6728
|
+
}
|
|
6729
|
+
var InlineTextField = styled17(TextField)`
|
|
6730
|
+
/*
|
|
6731
|
+
TODO: Improve input based on feedback from UX
|
|
6732
|
+
& > div {
|
|
6733
|
+
background: transparent;
|
|
6734
|
+
margin: 0 -0.5rem;
|
|
6735
|
+
padding: 0 0.5rem;
|
|
6736
|
+
box-shadow: none;
|
|
6737
|
+
width: auto;
|
|
6738
|
+
}
|
|
6739
|
+
|
|
6740
|
+
input {
|
|
6741
|
+
padding: 0;
|
|
6742
|
+
letter-spacing: 0;
|
|
6743
|
+
font-weight: 400;
|
|
6744
|
+
color: inherit;
|
|
6745
|
+
|
|
6746
|
+
::placeholder {
|
|
6747
|
+
color: red;
|
|
6748
|
+
}
|
|
6749
|
+
} */
|
|
6750
|
+
`;
|
|
6751
|
+
|
|
6752
|
+
// src/form-cells/EditableDropdownCell.tsx
|
|
6753
|
+
import { Autocomplete } from "@equinor/eds-core-react";
|
|
6754
|
+
import { Controller as Controller3, useFormContext as useFormContext4 } from "react-hook-form";
|
|
6755
|
+
import styled18 from "styled-components";
|
|
6756
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
6757
|
+
function buildEmptyOption() {
|
|
6758
|
+
return { label: "", value: "" };
|
|
6759
|
+
}
|
|
6760
|
+
function EditableDropdownCell(props) {
|
|
6761
|
+
const { options, ...context } = props;
|
|
6762
|
+
const editMode = useEditMode();
|
|
6763
|
+
const { control } = useFormContext4();
|
|
6764
|
+
if (!editMode)
|
|
6765
|
+
return /* @__PURE__ */ jsx23(TypographyCustom, {
|
|
6766
|
+
truncate: true,
|
|
6767
|
+
children: context.getValue()
|
|
6768
|
+
});
|
|
6769
|
+
return /* @__PURE__ */ jsx23(Controller3, {
|
|
6770
|
+
control,
|
|
6771
|
+
name: context.column.id,
|
|
6772
|
+
render: ({ field: { value, onChange, ...field } }) => {
|
|
6773
|
+
const selectedOption = options.find((option) => option.value === value) ?? buildEmptyOption;
|
|
6774
|
+
return /* @__PURE__ */ jsx23(AutocompleteCustom, {
|
|
6775
|
+
label: "",
|
|
6776
|
+
selectedOptions: selectedOption && [selectedOption],
|
|
6777
|
+
options,
|
|
6778
|
+
optionLabel: (option) => (option == null ? void 0 : option.label) ?? "",
|
|
6779
|
+
"aria-required": true,
|
|
6780
|
+
hideClearButton: true,
|
|
6781
|
+
"aria-autocomplete": "none",
|
|
6782
|
+
onOptionsChange: (changes) => {
|
|
6783
|
+
const [change] = changes.selectedItems;
|
|
6784
|
+
onChange(change == null ? void 0 : change.value);
|
|
6785
|
+
},
|
|
6786
|
+
...field
|
|
6787
|
+
});
|
|
6788
|
+
}
|
|
6789
|
+
});
|
|
6790
|
+
}
|
|
6791
|
+
var AutocompleteCustom = styled18(Autocomplete)`
|
|
6792
|
+
input[type='text'] {
|
|
6793
|
+
overflow: hidden;
|
|
6794
|
+
white-space: nowrap;
|
|
6795
|
+
text-overflow: ellipsis;
|
|
6796
|
+
padding-right: ${({ hideClearButton }) => hideClearButton ? `calc(8px + (24px * 1))` : `calc(8px + (24px * 2))`};
|
|
6797
|
+
}
|
|
6798
|
+
`;
|
|
6799
|
+
|
|
6800
|
+
// src/form-cells/EditableNumberCell.tsx
|
|
6801
|
+
import { TextField as TextField2 } from "@equinor/eds-core-react";
|
|
6802
|
+
import { Controller as Controller4, useFormContext as useFormContext5 } from "react-hook-form";
|
|
6803
|
+
import styled19 from "styled-components";
|
|
6804
|
+
import { Fragment as Fragment4, jsx as jsx24 } from "react/jsx-runtime";
|
|
6805
|
+
function EditableNumberCell(context) {
|
|
6806
|
+
const editMode = useEditMode();
|
|
6807
|
+
const { control } = useFormContext5();
|
|
6808
|
+
if (!editMode)
|
|
6809
|
+
return /* @__PURE__ */ jsx24(TypographyCustom, {
|
|
6810
|
+
truncate: true,
|
|
6811
|
+
children: context.getValue()
|
|
6812
|
+
});
|
|
6813
|
+
return /* @__PURE__ */ jsx24(Controller4, {
|
|
6814
|
+
control,
|
|
6815
|
+
name: context.column.id,
|
|
6816
|
+
render: ({ field: { onChange, ...field }, fieldState: { error } }) => /* @__PURE__ */ jsx24(Fragment4, {
|
|
6817
|
+
children: /* @__PURE__ */ jsx24(InlineTextField2, {
|
|
6818
|
+
id: context.column.id,
|
|
6819
|
+
type: "number",
|
|
6820
|
+
autoComplete: "none",
|
|
6821
|
+
onChange: (e) => onChange(e.target.valueAsNumber),
|
|
6822
|
+
...field,
|
|
6823
|
+
...getHelperTextProps({ error })
|
|
6824
|
+
})
|
|
6825
|
+
})
|
|
6826
|
+
});
|
|
6827
|
+
}
|
|
6828
|
+
var InlineTextField2 = styled19(TextField2)`
|
|
6829
|
+
/*
|
|
6830
|
+
TODO: Improve input based on feedback from UX
|
|
6831
|
+
& > div {
|
|
6832
|
+
background: transparent;
|
|
6833
|
+
margin: 0 -0.5rem;
|
|
6834
|
+
padding: 0 0.5rem;
|
|
6835
|
+
box-shadow: none;
|
|
6836
|
+
width: auto;
|
|
6837
|
+
}
|
|
6838
|
+
|
|
6839
|
+
input {
|
|
6840
|
+
padding: 0;
|
|
6841
|
+
letter-spacing: 0;
|
|
6842
|
+
font-weight: 400;
|
|
6843
|
+
color: inherit;
|
|
6844
|
+
|
|
6845
|
+
::placeholder {
|
|
6846
|
+
color: red;
|
|
6847
|
+
}
|
|
6848
|
+
} */
|
|
6849
|
+
`;
|
|
6850
|
+
|
|
6851
|
+
// src/form-cells/EditableTextAreaCell.tsx
|
|
6852
|
+
import { Button as Button5, Dialog as EDS, Icon as Icon8, TextField as TextField3 } from "@equinor/eds-core-react";
|
|
6853
|
+
import { useState as useState6 } from "react";
|
|
6854
|
+
import { Controller as Controller5, useFormContext as useFormContext6 } from "react-hook-form";
|
|
6855
|
+
import styled20 from "styled-components";
|
|
6856
|
+
import { Fragment as Fragment5, jsx as jsx25, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
6857
|
+
function EditableTextAreaCell(props) {
|
|
6858
|
+
const { title, ...context } = props;
|
|
6859
|
+
const [textareaValue, setTextareaValue] = useState6(context.getValue());
|
|
6860
|
+
const [open, setOpen] = useState6(false);
|
|
6861
|
+
const editMode = useEditMode();
|
|
6862
|
+
const { control } = useFormContext6();
|
|
6863
|
+
const name = context.column.id;
|
|
6864
|
+
if (!editMode)
|
|
6865
|
+
return /* @__PURE__ */ jsx25(PopoverCell, {
|
|
6866
|
+
id: name + "popover",
|
|
6867
|
+
value: context.getValue(),
|
|
6868
|
+
title
|
|
6869
|
+
});
|
|
6870
|
+
const openDialog = () => setOpen(true);
|
|
6871
|
+
const closeDialog = () => setOpen(false);
|
|
6872
|
+
return /* @__PURE__ */ jsx25(Controller5, {
|
|
6873
|
+
control,
|
|
6874
|
+
name,
|
|
6875
|
+
render: ({ field: { onChange, ref, ...field }, fieldState: { error } }) => /* @__PURE__ */ jsxs12(Fragment5, {
|
|
6876
|
+
children: [
|
|
6877
|
+
/* @__PURE__ */ jsxs12("div", {
|
|
6878
|
+
style: {
|
|
6879
|
+
display: "flex",
|
|
6880
|
+
alignItems: "center",
|
|
6881
|
+
position: "relative"
|
|
6882
|
+
},
|
|
6883
|
+
children: [
|
|
6884
|
+
/* @__PURE__ */ jsx25(StyledTextField, {
|
|
6885
|
+
id: field.name,
|
|
6886
|
+
onChange,
|
|
6887
|
+
ref,
|
|
6888
|
+
...field,
|
|
6889
|
+
...getHelperTextProps({ error })
|
|
6890
|
+
}),
|
|
6891
|
+
/* @__PURE__ */ jsx25(IconButton, {
|
|
6892
|
+
variant: "ghost_icon",
|
|
6893
|
+
onClick: stopPropagation2(openDialog),
|
|
6894
|
+
children: /* @__PURE__ */ jsx25(Icon8, {
|
|
6895
|
+
name: "arrow_up",
|
|
6896
|
+
size: 24,
|
|
6897
|
+
style: { transform: "rotateZ(45deg)" }
|
|
6898
|
+
})
|
|
6899
|
+
})
|
|
6900
|
+
]
|
|
6901
|
+
}),
|
|
6902
|
+
/* @__PURE__ */ jsxs12(EDS, {
|
|
6903
|
+
open,
|
|
6904
|
+
onClose: () => {
|
|
6905
|
+
closeDialog();
|
|
6906
|
+
onChange(textareaValue);
|
|
6907
|
+
},
|
|
6908
|
+
isDismissable: true,
|
|
6909
|
+
style: { width: "min(50rem, calc(100vw - 4rem))" },
|
|
6910
|
+
children: [
|
|
6911
|
+
/* @__PURE__ */ jsx25(EDS.Header, {
|
|
6912
|
+
children: /* @__PURE__ */ jsx25(EDS.Title, {
|
|
6913
|
+
children: title
|
|
6914
|
+
})
|
|
6915
|
+
}),
|
|
6916
|
+
/* @__PURE__ */ jsx25(EDS.Content, {
|
|
6917
|
+
children: /* @__PURE__ */ jsx25(TextField3, {
|
|
6918
|
+
style: {
|
|
6919
|
+
maxWidth: "100%",
|
|
6920
|
+
marginTop: "1rem"
|
|
6921
|
+
},
|
|
6922
|
+
id: field.name + "modal",
|
|
6923
|
+
multiline: true,
|
|
6924
|
+
rows: 8,
|
|
6925
|
+
name: field.name + "modal",
|
|
6926
|
+
value: textareaValue,
|
|
6927
|
+
onChange: (e) => {
|
|
6928
|
+
setTextareaValue(e.target.value);
|
|
6929
|
+
}
|
|
6930
|
+
})
|
|
6931
|
+
}),
|
|
6932
|
+
/* @__PURE__ */ jsxs12(EDS.Actions, {
|
|
6933
|
+
style: { display: "flex", gap: "1rem" },
|
|
6934
|
+
children: [
|
|
6935
|
+
/* @__PURE__ */ jsx25(Button5, {
|
|
6936
|
+
onClick: () => {
|
|
6937
|
+
closeDialog();
|
|
6938
|
+
onChange(textareaValue);
|
|
6939
|
+
},
|
|
6940
|
+
children: "Submit"
|
|
6941
|
+
}),
|
|
6942
|
+
/* @__PURE__ */ jsx25(Button5, {
|
|
6943
|
+
variant: "ghost",
|
|
6944
|
+
onClick: () => {
|
|
6945
|
+
closeDialog();
|
|
6946
|
+
setTextareaValue(context.getValue());
|
|
6947
|
+
},
|
|
6948
|
+
children: "Cancel"
|
|
6949
|
+
})
|
|
6950
|
+
]
|
|
6951
|
+
})
|
|
6952
|
+
]
|
|
6953
|
+
})
|
|
6954
|
+
]
|
|
6955
|
+
})
|
|
6956
|
+
});
|
|
6957
|
+
}
|
|
6958
|
+
var StyledTextField = styled20(TextField3)`
|
|
6959
|
+
& input {
|
|
6960
|
+
padding-right: 40px;
|
|
6961
|
+
letter-spacing: 0;
|
|
6962
|
+
overflow: hidden;
|
|
6963
|
+
white-space: nowrap;
|
|
6964
|
+
text-overflow: ellipsis;
|
|
6965
|
+
}
|
|
6966
|
+
`;
|
|
6967
|
+
var IconButton = styled20(Button5)`
|
|
6968
|
+
position: absolute;
|
|
6969
|
+
height: 32px;
|
|
6970
|
+
width: 32px;
|
|
6971
|
+
right: 4px;
|
|
6972
|
+
`;
|
|
6973
|
+
|
|
6974
|
+
// src/form-cells/EditableTextFieldCell.tsx
|
|
6975
|
+
import { TextField as TextField4 } from "@equinor/eds-core-react";
|
|
6976
|
+
import { Controller as Controller6, useFormContext as useFormContext7 } from "react-hook-form";
|
|
6977
|
+
import styled21 from "styled-components";
|
|
6978
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
6979
|
+
function EditableTextFieldCell(context) {
|
|
6980
|
+
const { control } = useFormContext7();
|
|
6981
|
+
const editMode = useEditMode();
|
|
6982
|
+
if (!editMode)
|
|
6983
|
+
return /* @__PURE__ */ jsx26(TypographyCustom, {
|
|
6984
|
+
truncate: true,
|
|
6985
|
+
children: context.getValue()
|
|
6986
|
+
});
|
|
6987
|
+
return /* @__PURE__ */ jsx26(Controller6, {
|
|
6988
|
+
control,
|
|
6989
|
+
name: context.column.id,
|
|
6990
|
+
render: ({ field: { value, ...field }, fieldState: { error } }) => /* @__PURE__ */ jsx26(InlineTextField3, {
|
|
6991
|
+
id: context.column.id,
|
|
6992
|
+
autoComplete: "none",
|
|
6993
|
+
value: String(value ?? ""),
|
|
6994
|
+
...field,
|
|
6995
|
+
...getHelperTextProps({ error })
|
|
6996
|
+
})
|
|
6997
|
+
});
|
|
6998
|
+
}
|
|
6999
|
+
var InlineTextField3 = styled21(TextField4)`
|
|
7000
|
+
/*
|
|
7001
|
+
TODO: Improve input based on feedback from UX
|
|
7002
|
+
& > div {
|
|
7003
|
+
background: transparent;
|
|
7004
|
+
margin: 0 -0.5rem;
|
|
7005
|
+
padding: 0 0.5rem;
|
|
7006
|
+
box-shadow: none;
|
|
7007
|
+
width: auto;
|
|
7008
|
+
}
|
|
7009
|
+
|
|
7010
|
+
input {
|
|
7011
|
+
padding: 0;
|
|
7012
|
+
letter-spacing: 0;
|
|
7013
|
+
font-weight: 400;
|
|
7014
|
+
color: inherit;
|
|
7015
|
+
|
|
7016
|
+
::placeholder {
|
|
7017
|
+
color: red;
|
|
7018
|
+
}
|
|
7019
|
+
} */
|
|
7020
|
+
`;
|
|
6532
7021
|
export {
|
|
6533
7022
|
AppShell,
|
|
6534
7023
|
AppSidebar,
|
|
7024
|
+
AutocompleteCustom,
|
|
6535
7025
|
ChipsCell,
|
|
6536
7026
|
ColumnSelect,
|
|
6537
7027
|
DataTable,
|
|
6538
7028
|
DynamicCell,
|
|
7029
|
+
EditableCheckboxCell,
|
|
7030
|
+
EditableDateCell,
|
|
7031
|
+
EditableDropdownCell,
|
|
7032
|
+
EditableNumberCell,
|
|
7033
|
+
EditableTextAreaCell,
|
|
7034
|
+
EditableTextFieldCell,
|
|
6539
7035
|
HeaderCell,
|
|
6540
7036
|
HierarchyCell,
|
|
7037
|
+
PopoverCell,
|
|
6541
7038
|
SelectColumnDef,
|
|
6542
7039
|
StickyCell,
|
|
6543
7040
|
StickyHeaderCell,
|
|
6544
7041
|
StyledStickyCell,
|
|
6545
7042
|
TableHeader,
|
|
7043
|
+
TypographyCustom,
|
|
6546
7044
|
addFormMeta,
|
|
6547
7045
|
capitalizeHeader,
|
|
6548
7046
|
leftCellShadow,
|
|
6549
7047
|
prependSelectColumn,
|
|
6550
7048
|
removeFormMeta,
|
|
7049
|
+
stopPropagation,
|
|
6551
7050
|
stringToHslColor,
|
|
6552
7051
|
useEditMode,
|
|
6553
7052
|
useGetIsNew,
|