@equinor/apollo-components 3.2.1 → 3.3.0
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 +28 -9
- package/dist/index.js +191 -86
- package/dist/index.mjs +180 -75
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { CellProps, TypographyProps as TypographyProps$1 } from '@equinor/eds-co
|
|
|
8
8
|
import { ColumnDef as ColumnDef$1 } from '@tanstack/table-core';
|
|
9
9
|
import { SetRequired } from 'type-fest';
|
|
10
10
|
import { TableOptions } from '@tanstack/table-core/build/lib/types';
|
|
11
|
+
import { FieldError } from 'react-hook-form';
|
|
11
12
|
|
|
12
13
|
interface AppShellProps {
|
|
13
14
|
children?: ReactNode;
|
|
@@ -161,7 +162,12 @@ interface DataTableProps<T> {
|
|
|
161
162
|
enableGlobalFilterInput?: boolean;
|
|
162
163
|
globalFilterPlaceholder?: string;
|
|
163
164
|
filterFromLeafRows?: boolean;
|
|
165
|
+
/**
|
|
166
|
+
* @deprecated Use `customActionsLeft` instead
|
|
167
|
+
*/
|
|
164
168
|
customActions?: <T>(table: Table<T>) => ReactNode;
|
|
169
|
+
customActionsLeft?: <T>(table: Table<T>) => ReactNode;
|
|
170
|
+
customActionsRight?: <T>(table: Table<T>) => ReactNode;
|
|
165
171
|
/**
|
|
166
172
|
* Default 1rem
|
|
167
173
|
* Accepts any CSS padding value
|
|
@@ -239,32 +245,45 @@ declare function useSetFormMeta<T extends FormMeta>(): (newValues: Partial<T>) =
|
|
|
239
245
|
declare function removeFormMeta<T extends FormMeta>(withFormMeta: T): Omit<T, keyof FormMeta>;
|
|
240
246
|
declare function addFormMeta<T>(withoutFormMeta: T): T & FormMeta;
|
|
241
247
|
|
|
242
|
-
|
|
248
|
+
interface EditableCellBaseProps<T extends FormMeta, Value> extends CellContext<T, Value> {
|
|
249
|
+
/**
|
|
250
|
+
* FieldError object used to overwrite react-hook-form validation result. It is prioritized over
|
|
251
|
+
* react-hook-form's validation.
|
|
252
|
+
*/
|
|
253
|
+
error?: FieldError;
|
|
254
|
+
/**
|
|
255
|
+
* Custom `onChange` called on input change after react-hook-form's `onChange`. E.g. used to trigger actions on change.
|
|
256
|
+
*/
|
|
257
|
+
onChange?: (value: Value) => void;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
declare function EditableCheckboxCell<T extends FormMeta>({ onChange: onChangeFromProps, ...context }: EditableCellBaseProps<T, boolean>): JSX.Element;
|
|
243
261
|
|
|
244
|
-
interface EditableDateCellProps<T extends FormMeta> extends
|
|
262
|
+
interface EditableDateCellProps<T extends FormMeta> extends EditableCellBaseProps<T, string> {
|
|
245
263
|
dateStringFormatter?: (date: string) => string;
|
|
246
264
|
}
|
|
247
|
-
declare function EditableDateCell<T extends FormMeta>(
|
|
265
|
+
declare function EditableDateCell<T extends FormMeta>({ dateStringFormatter, error: errorFromProps, onChange: onChangeFromProps, ...context }: EditableDateCellProps<T>): JSX.Element;
|
|
248
266
|
|
|
249
267
|
interface Option {
|
|
250
268
|
label: string;
|
|
251
269
|
value: string;
|
|
252
270
|
}
|
|
253
|
-
interface EditableDropdownSingleCellProps<T extends FormMeta> extends
|
|
271
|
+
interface EditableDropdownSingleCellProps<T extends FormMeta> extends Omit<EditableCellBaseProps<T, unknown>, 'onChange'> {
|
|
254
272
|
/**
|
|
255
273
|
* `Option.value` is used internally to get and update selection state. `Option.label` is *only* for visual purposes.
|
|
256
274
|
*/
|
|
257
275
|
options: Option[];
|
|
276
|
+
onChange?: (value: Option) => void;
|
|
258
277
|
}
|
|
259
|
-
declare function EditableDropdownSingleCell<T extends FormMeta>(
|
|
278
|
+
declare function EditableDropdownSingleCell<T extends FormMeta>({ options, error: errorFromProps, onChange: onChangeFromProps, ...context }: EditableDropdownSingleCellProps<T>): JSX.Element;
|
|
260
279
|
|
|
261
|
-
declare function EditableNumberCell<T extends FormMeta>(context:
|
|
280
|
+
declare function EditableNumberCell<T extends FormMeta>({ error: errorFromProps, ...context }: EditableCellBaseProps<T, number>): JSX.Element;
|
|
262
281
|
|
|
263
|
-
interface EdtiableTextAreaProps<T extends FormMeta> extends
|
|
282
|
+
interface EdtiableTextAreaProps<T extends FormMeta> extends EditableCellBaseProps<T, string> {
|
|
264
283
|
title: string;
|
|
265
284
|
}
|
|
266
|
-
declare function EditableTextAreaCell<T extends FormMeta>(
|
|
285
|
+
declare function EditableTextAreaCell<T extends FormMeta>({ title, error: errorFromProps, onChange: onChangeFromProps, ...context }: EdtiableTextAreaProps<T>): JSX.Element;
|
|
267
286
|
|
|
268
|
-
declare function EditableTextFieldCell<T extends FormMeta>(context:
|
|
287
|
+
declare function EditableTextFieldCell<T extends FormMeta>({ error: errorFromProps, ...context }: EditableCellBaseProps<T, string>): JSX.Element;
|
|
269
288
|
|
|
270
289
|
export { AppShell, AppSidebar, CellConfig, CheckboxCell, ChipsCell, ColumnSelect, DataTable, DataTableProps, DynamicCell, EditableCheckboxCell, EditableDateCell, EditableDateCellProps, EditableDropdownSingleCell, EditableDropdownSingleCellProps, EditableNumberCell, EditableTextAreaCell, EditableTextFieldCell, FormMeta, HTMLPropsRef, HeaderCell, HierarchyCell, InfiniteScrollConfig, Option, PopoverCell, RowConfig, RowSelectionMode, SelectColumnDef, SortConfig, StickyCell, StickyHeaderCell, StyledStickyCell, TableHeader, TableLayout, TableRowWrapper, TableRowWrapperProps, TruncateMode, TypographyCustom, TypographyProps, WithoutFormMeta, addFormMeta, capitalizeHeader, leftCellShadow, prependSelectColumn, removeFormMeta, stopPropagation, stringToHslColor, useEditMode, useGetIsNew, useHasRemoteChange, useSetFormMeta };
|
package/dist/index.js
CHANGED
|
@@ -3196,19 +3196,20 @@ function TableBanner({
|
|
|
3196
3196
|
tableCaption,
|
|
3197
3197
|
globalFilter
|
|
3198
3198
|
}) {
|
|
3199
|
-
var _a, _b;
|
|
3199
|
+
var _a, _b, _c, _d, _e;
|
|
3200
3200
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(TableBannerWrapper, { className: "--table-caption", padding: bannerConfig == null ? void 0 : bannerConfig.padding, children: [
|
|
3201
3201
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(FilterContainer, { className: "--filter-container-left", children: [
|
|
3202
3202
|
(bannerConfig == null ? void 0 : bannerConfig.enableTableCaption) && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_eds_core_react17.Typography, { variant: "h3", as: "h2", children: tableCaption }),
|
|
3203
|
-
(_a = bannerConfig == null ? void 0 : bannerConfig.
|
|
3203
|
+
(_c = (_a = bannerConfig == null ? void 0 : bannerConfig.customActionsLeft) == null ? void 0 : _a.call(bannerConfig, table)) != null ? _c : (_b = bannerConfig == null ? void 0 : bannerConfig.customActions) == null ? void 0 : _b.call(bannerConfig, table)
|
|
3204
3204
|
] }),
|
|
3205
3205
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FilterContainer, { className: "--filter-container-right", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
3206
|
+
(_d = bannerConfig == null ? void 0 : bannerConfig.customActionsRight) == null ? void 0 : _d.call(bannerConfig, table),
|
|
3206
3207
|
(bannerConfig == null ? void 0 : bannerConfig.enableGlobalFilterInput) && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3207
3208
|
DebouncedInput,
|
|
3208
3209
|
{
|
|
3209
3210
|
value: globalFilter.state,
|
|
3210
3211
|
icon: import_eds_icons7.search,
|
|
3211
|
-
placeholder: (
|
|
3212
|
+
placeholder: (_e = bannerConfig.globalFilterPlaceholder) != null ? _e : "Search all columns",
|
|
3212
3213
|
onChange: (value) => globalFilter.onChange(String(value))
|
|
3213
3214
|
}
|
|
3214
3215
|
),
|
|
@@ -3545,7 +3546,12 @@ function addFormMeta(withoutFormMeta) {
|
|
|
3545
3546
|
|
|
3546
3547
|
// src/form-cells/EditableCheckboxCell.tsx
|
|
3547
3548
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3548
|
-
function EditableCheckboxCell(
|
|
3549
|
+
function EditableCheckboxCell(_a) {
|
|
3550
|
+
var _b = _a, {
|
|
3551
|
+
onChange: onChangeFromProps
|
|
3552
|
+
} = _b, context = __objRest(_b, [
|
|
3553
|
+
"onChange"
|
|
3554
|
+
]);
|
|
3549
3555
|
const editMode = useEditMode();
|
|
3550
3556
|
if (!editMode)
|
|
3551
3557
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
@@ -3562,9 +3568,21 @@ function EditableCheckboxCell(context) {
|
|
|
3562
3568
|
import_react_hook_form2.Controller,
|
|
3563
3569
|
{
|
|
3564
3570
|
name: context.column.id,
|
|
3565
|
-
render: (
|
|
3566
|
-
var { field:
|
|
3567
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3571
|
+
render: (_a2) => {
|
|
3572
|
+
var { field: _b2 } = _a2, _c = _b2, { value, onChange } = _c, field = __objRest(_c, ["value", "onChange"]);
|
|
3573
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3574
|
+
import_eds_core_react20.Checkbox,
|
|
3575
|
+
__spreadProps(__spreadValues({
|
|
3576
|
+
enterKeyHint: "send",
|
|
3577
|
+
"aria-label": "editable",
|
|
3578
|
+
checked: value
|
|
3579
|
+
}, field), {
|
|
3580
|
+
onChange: (e) => {
|
|
3581
|
+
onChange(e);
|
|
3582
|
+
onChangeFromProps == null ? void 0 : onChangeFromProps(e.target.checked);
|
|
3583
|
+
}
|
|
3584
|
+
})
|
|
3585
|
+
);
|
|
3568
3586
|
}
|
|
3569
3587
|
}
|
|
3570
3588
|
);
|
|
@@ -3611,8 +3629,16 @@ function stopPropagation2(handler) {
|
|
|
3611
3629
|
|
|
3612
3630
|
// src/form-cells/EditableDateCell.tsx
|
|
3613
3631
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
3614
|
-
function EditableDateCell(
|
|
3615
|
-
|
|
3632
|
+
function EditableDateCell(_a) {
|
|
3633
|
+
var _b = _a, {
|
|
3634
|
+
dateStringFormatter,
|
|
3635
|
+
error: errorFromProps,
|
|
3636
|
+
onChange: onChangeFromProps
|
|
3637
|
+
} = _b, context = __objRest(_b, [
|
|
3638
|
+
"dateStringFormatter",
|
|
3639
|
+
"error",
|
|
3640
|
+
"onChange"
|
|
3641
|
+
]);
|
|
3616
3642
|
const rawValue = context.getValue();
|
|
3617
3643
|
const editMode = useEditMode();
|
|
3618
3644
|
const formattedValue = (0, import_react8.useMemo)(
|
|
@@ -3628,8 +3654,8 @@ function EditableDateCell(props) {
|
|
|
3628
3654
|
import_react_hook_form3.Controller,
|
|
3629
3655
|
{
|
|
3630
3656
|
name: context.column.id,
|
|
3631
|
-
render: (
|
|
3632
|
-
var
|
|
3657
|
+
render: (_a2) => {
|
|
3658
|
+
var _b2 = _a2, { field: _c } = _b2, _d = _c, { value, onChange } = _d, field = __objRest(_d, ["value", "onChange"]), { fieldState: { error } } = _b2;
|
|
3633
3659
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3634
3660
|
InlineTextField,
|
|
3635
3661
|
__spreadValues(__spreadValues({
|
|
@@ -3637,8 +3663,12 @@ function EditableDateCell(props) {
|
|
|
3637
3663
|
type: "date",
|
|
3638
3664
|
autoComplete: "none",
|
|
3639
3665
|
value: value ? parseISODate(value) : "",
|
|
3640
|
-
onChange: (e) =>
|
|
3641
|
-
|
|
3666
|
+
onChange: (e) => {
|
|
3667
|
+
const newDateString = e.target.value ? parseISODate(e.target.value) : "";
|
|
3668
|
+
onChange(newDateString);
|
|
3669
|
+
onChangeFromProps == null ? void 0 : onChangeFromProps(newDateString);
|
|
3670
|
+
}
|
|
3671
|
+
}, getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error })), field)
|
|
3642
3672
|
);
|
|
3643
3673
|
}
|
|
3644
3674
|
}
|
|
@@ -3674,78 +3704,138 @@ var InlineTextField = (0, import_styled_components17.default)(import_eds_core_re
|
|
|
3674
3704
|
`;
|
|
3675
3705
|
|
|
3676
3706
|
// src/form-cells/EditableDropdownSingleCell.tsx
|
|
3677
|
-
var
|
|
3707
|
+
var import_eds_core_react24 = require("@equinor/eds-core-react");
|
|
3678
3708
|
var import_react_hook_form4 = require("react-hook-form");
|
|
3709
|
+
|
|
3710
|
+
// src/form-cells/FormHelperText.tsx
|
|
3711
|
+
var import_eds_core_react23 = require("@equinor/eds-core-react");
|
|
3712
|
+
var import_eds_tokens6 = require("@equinor/eds-tokens");
|
|
3679
3713
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
3714
|
+
var colors = {
|
|
3715
|
+
error: import_eds_tokens6.tokens.colors.interactive.danger__text.hex,
|
|
3716
|
+
warning: import_eds_tokens6.tokens.colors.interactive.warning__text.hex,
|
|
3717
|
+
success: import_eds_tokens6.tokens.colors.interactive.success__text.hex
|
|
3718
|
+
};
|
|
3719
|
+
function HelperText({ helperText, variant, helperIcon }) {
|
|
3720
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: helperText && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style: { marginTop: "8px", marginLeft: "8px" }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
3721
|
+
"div",
|
|
3722
|
+
{
|
|
3723
|
+
style: {
|
|
3724
|
+
display: "flex",
|
|
3725
|
+
alignItems: "flex-start",
|
|
3726
|
+
marginTop: "8px",
|
|
3727
|
+
color: variant ? colors[variant] : "inherit"
|
|
3728
|
+
},
|
|
3729
|
+
children: [
|
|
3730
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { style: { flexShrink: 0 }, children: helperIcon }),
|
|
3731
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3732
|
+
import_eds_core_react23.Typography,
|
|
3733
|
+
{
|
|
3734
|
+
style: {
|
|
3735
|
+
fontSize: "0.75rem",
|
|
3736
|
+
fontWeight: 500,
|
|
3737
|
+
lineHeight: "1.333em",
|
|
3738
|
+
letterSpacing: "0.013em",
|
|
3739
|
+
textAlign: "left",
|
|
3740
|
+
margin: "0 0 0 8px",
|
|
3741
|
+
color: "inherit"
|
|
3742
|
+
},
|
|
3743
|
+
children: helperText
|
|
3744
|
+
}
|
|
3745
|
+
)
|
|
3746
|
+
]
|
|
3747
|
+
}
|
|
3748
|
+
) }) });
|
|
3749
|
+
}
|
|
3750
|
+
|
|
3751
|
+
// src/form-cells/EditableDropdownSingleCell.tsx
|
|
3752
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3680
3753
|
function buildEmptyOption() {
|
|
3681
3754
|
return { label: "", value: "" };
|
|
3682
3755
|
}
|
|
3683
|
-
function EditableDropdownSingleCell(
|
|
3684
|
-
|
|
3756
|
+
function EditableDropdownSingleCell(_a) {
|
|
3757
|
+
var _b = _a, {
|
|
3758
|
+
options,
|
|
3759
|
+
error: errorFromProps,
|
|
3760
|
+
onChange: onChangeFromProps
|
|
3761
|
+
} = _b, context = __objRest(_b, [
|
|
3762
|
+
"options",
|
|
3763
|
+
"error",
|
|
3764
|
+
"onChange"
|
|
3765
|
+
]);
|
|
3685
3766
|
const editMode = useEditMode();
|
|
3686
3767
|
if (!editMode)
|
|
3687
|
-
return /* @__PURE__ */ (0,
|
|
3688
|
-
return /* @__PURE__ */ (0,
|
|
3768
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TypographyCustom, { truncate: true, children: context.getValue() });
|
|
3769
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3689
3770
|
import_react_hook_form4.Controller,
|
|
3690
3771
|
{
|
|
3691
3772
|
name: context.column.id,
|
|
3692
|
-
render: (
|
|
3693
|
-
var { field: _c } =
|
|
3694
|
-
var
|
|
3695
|
-
const selectedOption = (
|
|
3696
|
-
return /* @__PURE__ */ (0,
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3773
|
+
render: (_a2) => {
|
|
3774
|
+
var _b2 = _a2, { field: _c } = _b2, _d = _c, { value, onChange } = _d, field = __objRest(_d, ["value", "onChange"]), { fieldState: { error } } = _b2;
|
|
3775
|
+
var _a3;
|
|
3776
|
+
const selectedOption = (_a3 = options.find((option) => option.value === value)) != null ? _a3 : buildEmptyOption();
|
|
3777
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
3778
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3779
|
+
import_eds_core_react24.Autocomplete,
|
|
3780
|
+
__spreadValues({
|
|
3781
|
+
label: "",
|
|
3782
|
+
selectedOptions: selectedOption && [selectedOption],
|
|
3783
|
+
options,
|
|
3784
|
+
optionLabel: (option) => {
|
|
3785
|
+
var _a4;
|
|
3786
|
+
return (_a4 = option == null ? void 0 : option.label) != null ? _a4 : "";
|
|
3787
|
+
},
|
|
3788
|
+
"aria-required": true,
|
|
3789
|
+
hideClearButton: true,
|
|
3790
|
+
"aria-autocomplete": "none",
|
|
3791
|
+
onOptionsChange: (changes) => {
|
|
3792
|
+
const [change] = changes.selectedItems;
|
|
3793
|
+
onChange(change == null ? void 0 : change.value);
|
|
3794
|
+
onChangeFromProps == null ? void 0 : onChangeFromProps(change);
|
|
3795
|
+
}
|
|
3796
|
+
}, field)
|
|
3797
|
+
),
|
|
3798
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(HelperText, __spreadValues({}, getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error })))
|
|
3799
|
+
] });
|
|
3715
3800
|
}
|
|
3716
3801
|
}
|
|
3717
3802
|
);
|
|
3718
3803
|
}
|
|
3719
3804
|
|
|
3720
3805
|
// src/form-cells/EditableNumberCell.tsx
|
|
3721
|
-
var
|
|
3806
|
+
var import_eds_core_react25 = require("@equinor/eds-core-react");
|
|
3722
3807
|
var import_react_hook_form5 = require("react-hook-form");
|
|
3723
3808
|
var import_styled_components18 = __toESM(require("styled-components"));
|
|
3724
|
-
var
|
|
3725
|
-
function EditableNumberCell(
|
|
3809
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3810
|
+
function EditableNumberCell(_a) {
|
|
3811
|
+
var _b = _a, {
|
|
3812
|
+
error: errorFromProps
|
|
3813
|
+
} = _b, context = __objRest(_b, [
|
|
3814
|
+
"error"
|
|
3815
|
+
]);
|
|
3726
3816
|
const editMode = useEditMode();
|
|
3727
3817
|
if (!editMode)
|
|
3728
|
-
return /* @__PURE__ */ (0,
|
|
3729
|
-
return /* @__PURE__ */ (0,
|
|
3818
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TypographyCustom, { truncate: true, children: context.getValue() });
|
|
3819
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3730
3820
|
import_react_hook_form5.Controller,
|
|
3731
3821
|
{
|
|
3732
3822
|
name: context.column.id,
|
|
3733
|
-
render: (
|
|
3734
|
-
var
|
|
3735
|
-
return /* @__PURE__ */ (0,
|
|
3823
|
+
render: (_a2) => {
|
|
3824
|
+
var _b2 = _a2, { field: _c } = _b2, _d = _c, { onChange } = _d, field = __objRest(_d, ["onChange"]), { fieldState: { error } } = _b2;
|
|
3825
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3736
3826
|
InlineTextField2,
|
|
3737
3827
|
__spreadValues(__spreadValues({
|
|
3738
3828
|
id: context.column.id,
|
|
3739
3829
|
type: "number",
|
|
3740
3830
|
autoComplete: "none",
|
|
3741
3831
|
onChange: (e) => onChange(e.target.valueAsNumber)
|
|
3742
|
-
}, field), getHelperTextProps({ error }))
|
|
3832
|
+
}, field), getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error }))
|
|
3743
3833
|
) });
|
|
3744
3834
|
}
|
|
3745
3835
|
}
|
|
3746
3836
|
);
|
|
3747
3837
|
}
|
|
3748
|
-
var InlineTextField2 = (0, import_styled_components18.default)(
|
|
3838
|
+
var InlineTextField2 = (0, import_styled_components18.default)(import_eds_core_react25.TextField)`
|
|
3749
3839
|
/*
|
|
3750
3840
|
TODO: Improve input based on feedback from UX
|
|
3751
3841
|
& > div {
|
|
@@ -3769,30 +3859,38 @@ var InlineTextField2 = (0, import_styled_components18.default)(import_eds_core_r
|
|
|
3769
3859
|
`;
|
|
3770
3860
|
|
|
3771
3861
|
// src/form-cells/EditableTextAreaCell.tsx
|
|
3772
|
-
var
|
|
3862
|
+
var import_eds_core_react26 = require("@equinor/eds-core-react");
|
|
3773
3863
|
var import_eds_icons9 = require("@equinor/eds-icons");
|
|
3774
3864
|
var import_react9 = require("react");
|
|
3775
3865
|
var import_react_hook_form6 = require("react-hook-form");
|
|
3776
3866
|
var import_styled_components19 = __toESM(require("styled-components"));
|
|
3777
|
-
var
|
|
3778
|
-
function EditableTextAreaCell(
|
|
3779
|
-
|
|
3867
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3868
|
+
function EditableTextAreaCell(_a) {
|
|
3869
|
+
var _b = _a, {
|
|
3870
|
+
title,
|
|
3871
|
+
error: errorFromProps,
|
|
3872
|
+
onChange: onChangeFromProps
|
|
3873
|
+
} = _b, context = __objRest(_b, [
|
|
3874
|
+
"title",
|
|
3875
|
+
"error",
|
|
3876
|
+
"onChange"
|
|
3877
|
+
]);
|
|
3780
3878
|
const [textareaValue, setTextareaValue] = (0, import_react9.useState)(context.getValue());
|
|
3781
3879
|
const [open, setOpen] = (0, import_react9.useState)(false);
|
|
3782
3880
|
const editMode = useEditMode();
|
|
3783
3881
|
const name = context.column.id;
|
|
3784
3882
|
if (!editMode)
|
|
3785
|
-
return /* @__PURE__ */ (0,
|
|
3883
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(PopoverCell, { id: name + "popover", value: context.getValue(), title });
|
|
3786
3884
|
const openDialog = () => setOpen(true);
|
|
3787
3885
|
const closeDialog = () => setOpen(false);
|
|
3788
|
-
return /* @__PURE__ */ (0,
|
|
3886
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3789
3887
|
import_react_hook_form6.Controller,
|
|
3790
3888
|
{
|
|
3791
3889
|
name,
|
|
3792
|
-
render: (
|
|
3793
|
-
var
|
|
3794
|
-
return /* @__PURE__ */ (0,
|
|
3795
|
-
/* @__PURE__ */ (0,
|
|
3890
|
+
render: (_a2) => {
|
|
3891
|
+
var _b2 = _a2, { field: _c } = _b2, _d = _c, { onChange, ref } = _d, field = __objRest(_d, ["onChange", "ref"]), { fieldState: { error } } = _b2;
|
|
3892
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
3893
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
3796
3894
|
"div",
|
|
3797
3895
|
{
|
|
3798
3896
|
style: {
|
|
@@ -3801,32 +3899,33 @@ function EditableTextAreaCell(props) {
|
|
|
3801
3899
|
position: "relative"
|
|
3802
3900
|
},
|
|
3803
3901
|
children: [
|
|
3804
|
-
/* @__PURE__ */ (0,
|
|
3902
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3805
3903
|
StyledTextField,
|
|
3806
3904
|
__spreadValues(__spreadValues({
|
|
3807
3905
|
id: field.name,
|
|
3808
3906
|
onChange,
|
|
3809
3907
|
ref
|
|
3810
|
-
}, field), getHelperTextProps({ error }))
|
|
3908
|
+
}, field), getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error }))
|
|
3811
3909
|
),
|
|
3812
|
-
/* @__PURE__ */ (0,
|
|
3910
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(IconButton, { variant: "ghost_icon", onClick: stopPropagation2(openDialog), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_eds_core_react26.Icon, { data: import_eds_icons9.arrow_up, size: 24, style: { transform: "rotateZ(45deg)" } }) })
|
|
3813
3911
|
]
|
|
3814
3912
|
}
|
|
3815
3913
|
),
|
|
3816
|
-
/* @__PURE__ */ (0,
|
|
3817
|
-
|
|
3914
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
3915
|
+
import_eds_core_react26.Dialog,
|
|
3818
3916
|
{
|
|
3819
3917
|
open,
|
|
3820
3918
|
onClose: () => {
|
|
3821
3919
|
closeDialog();
|
|
3822
3920
|
onChange(textareaValue);
|
|
3921
|
+
onChangeFromProps == null ? void 0 : onChangeFromProps(textareaValue);
|
|
3823
3922
|
},
|
|
3824
3923
|
isDismissable: true,
|
|
3825
3924
|
style: { width: "min(50rem, calc(100vw - 4rem))" },
|
|
3826
3925
|
children: [
|
|
3827
|
-
/* @__PURE__ */ (0,
|
|
3828
|
-
/* @__PURE__ */ (0,
|
|
3829
|
-
|
|
3926
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_eds_core_react26.Dialog.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_eds_core_react26.Dialog.Title, { children: title }) }),
|
|
3927
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_eds_core_react26.Dialog.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3928
|
+
import_eds_core_react26.TextField,
|
|
3830
3929
|
{
|
|
3831
3930
|
style: {
|
|
3832
3931
|
maxWidth: "100%",
|
|
@@ -3842,19 +3941,20 @@ function EditableTextAreaCell(props) {
|
|
|
3842
3941
|
}
|
|
3843
3942
|
}
|
|
3844
3943
|
) }),
|
|
3845
|
-
/* @__PURE__ */ (0,
|
|
3846
|
-
/* @__PURE__ */ (0,
|
|
3847
|
-
|
|
3944
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_eds_core_react26.Dialog.Actions, { style: { display: "flex", gap: "1rem" }, children: [
|
|
3945
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3946
|
+
import_eds_core_react26.Button,
|
|
3848
3947
|
{
|
|
3849
3948
|
onClick: () => {
|
|
3850
3949
|
closeDialog();
|
|
3851
3950
|
onChange(textareaValue);
|
|
3951
|
+
onChangeFromProps == null ? void 0 : onChangeFromProps(textareaValue);
|
|
3852
3952
|
},
|
|
3853
3953
|
children: "Submit"
|
|
3854
3954
|
}
|
|
3855
3955
|
),
|
|
3856
|
-
/* @__PURE__ */ (0,
|
|
3857
|
-
|
|
3956
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3957
|
+
import_eds_core_react26.Button,
|
|
3858
3958
|
{
|
|
3859
3959
|
variant: "ghost",
|
|
3860
3960
|
onClick: () => {
|
|
@@ -3873,7 +3973,7 @@ function EditableTextAreaCell(props) {
|
|
|
3873
3973
|
}
|
|
3874
3974
|
);
|
|
3875
3975
|
}
|
|
3876
|
-
var StyledTextField = (0, import_styled_components19.default)(
|
|
3976
|
+
var StyledTextField = (0, import_styled_components19.default)(import_eds_core_react26.TextField)`
|
|
3877
3977
|
& input {
|
|
3878
3978
|
padding-right: 40px;
|
|
3879
3979
|
letter-spacing: 0;
|
|
@@ -3882,7 +3982,7 @@ var StyledTextField = (0, import_styled_components19.default)(import_eds_core_re
|
|
|
3882
3982
|
text-overflow: ellipsis;
|
|
3883
3983
|
}
|
|
3884
3984
|
`;
|
|
3885
|
-
var IconButton = (0, import_styled_components19.default)(
|
|
3985
|
+
var IconButton = (0, import_styled_components19.default)(import_eds_core_react26.Button)`
|
|
3886
3986
|
position: absolute;
|
|
3887
3987
|
height: 32px;
|
|
3888
3988
|
width: 32px;
|
|
@@ -3890,33 +3990,38 @@ var IconButton = (0, import_styled_components19.default)(import_eds_core_react25
|
|
|
3890
3990
|
`;
|
|
3891
3991
|
|
|
3892
3992
|
// src/form-cells/EditableTextFieldCell.tsx
|
|
3893
|
-
var
|
|
3993
|
+
var import_eds_core_react27 = require("@equinor/eds-core-react");
|
|
3894
3994
|
var import_react_hook_form7 = require("react-hook-form");
|
|
3895
3995
|
var import_styled_components20 = __toESM(require("styled-components"));
|
|
3896
|
-
var
|
|
3897
|
-
function EditableTextFieldCell(
|
|
3996
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3997
|
+
function EditableTextFieldCell(_a) {
|
|
3998
|
+
var _b = _a, {
|
|
3999
|
+
error: errorFromProps
|
|
4000
|
+
} = _b, context = __objRest(_b, [
|
|
4001
|
+
"error"
|
|
4002
|
+
]);
|
|
3898
4003
|
const editMode = useEditMode();
|
|
3899
4004
|
if (!editMode)
|
|
3900
|
-
return /* @__PURE__ */ (0,
|
|
3901
|
-
return /* @__PURE__ */ (0,
|
|
4005
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TypographyCustom, { truncate: true, children: context.getValue() });
|
|
4006
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3902
4007
|
import_react_hook_form7.Controller,
|
|
3903
4008
|
{
|
|
3904
4009
|
name: context.column.id,
|
|
3905
|
-
render: (
|
|
3906
|
-
var
|
|
3907
|
-
return /* @__PURE__ */ (0,
|
|
4010
|
+
render: (_a2) => {
|
|
4011
|
+
var _b2 = _a2, { field: _c } = _b2, _d = _c, { value } = _d, field = __objRest(_d, ["value"]), { fieldState: { error } } = _b2;
|
|
4012
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3908
4013
|
InlineTextField3,
|
|
3909
4014
|
__spreadValues(__spreadValues({
|
|
3910
4015
|
id: context.column.id,
|
|
3911
4016
|
autoComplete: "none",
|
|
3912
4017
|
value: String(value != null ? value : "")
|
|
3913
|
-
}, field), getHelperTextProps({ error }))
|
|
4018
|
+
}, field), getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error }))
|
|
3914
4019
|
);
|
|
3915
4020
|
}
|
|
3916
4021
|
}
|
|
3917
4022
|
);
|
|
3918
4023
|
}
|
|
3919
|
-
var InlineTextField3 = (0, import_styled_components20.default)(
|
|
4024
|
+
var InlineTextField3 = (0, import_styled_components20.default)(import_eds_core_react27.TextField)`
|
|
3920
4025
|
/*
|
|
3921
4026
|
TODO: Improve input based on feedback from UX
|
|
3922
4027
|
& > div {
|
package/dist/index.mjs
CHANGED
|
@@ -3159,19 +3159,20 @@ function TableBanner({
|
|
|
3159
3159
|
tableCaption,
|
|
3160
3160
|
globalFilter
|
|
3161
3161
|
}) {
|
|
3162
|
-
var _a, _b;
|
|
3162
|
+
var _a, _b, _c, _d, _e;
|
|
3163
3163
|
return /* @__PURE__ */ jsxs9(TableBannerWrapper, { className: "--table-caption", padding: bannerConfig == null ? void 0 : bannerConfig.padding, children: [
|
|
3164
3164
|
/* @__PURE__ */ jsxs9(FilterContainer, { className: "--filter-container-left", children: [
|
|
3165
3165
|
(bannerConfig == null ? void 0 : bannerConfig.enableTableCaption) && /* @__PURE__ */ jsx17(Typography3, { variant: "h3", as: "h2", children: tableCaption }),
|
|
3166
|
-
(_a = bannerConfig == null ? void 0 : bannerConfig.
|
|
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
3167
|
] }),
|
|
3168
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),
|
|
3169
3170
|
(bannerConfig == null ? void 0 : bannerConfig.enableGlobalFilterInput) && /* @__PURE__ */ jsx17(
|
|
3170
3171
|
DebouncedInput,
|
|
3171
3172
|
{
|
|
3172
3173
|
value: globalFilter.state,
|
|
3173
3174
|
icon: search,
|
|
3174
|
-
placeholder: (
|
|
3175
|
+
placeholder: (_e = bannerConfig.globalFilterPlaceholder) != null ? _e : "Search all columns",
|
|
3175
3176
|
onChange: (value) => globalFilter.onChange(String(value))
|
|
3176
3177
|
}
|
|
3177
3178
|
),
|
|
@@ -3508,7 +3509,12 @@ function addFormMeta(withoutFormMeta) {
|
|
|
3508
3509
|
|
|
3509
3510
|
// src/form-cells/EditableCheckboxCell.tsx
|
|
3510
3511
|
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
3511
|
-
function EditableCheckboxCell(
|
|
3512
|
+
function EditableCheckboxCell(_a) {
|
|
3513
|
+
var _b = _a, {
|
|
3514
|
+
onChange: onChangeFromProps
|
|
3515
|
+
} = _b, context = __objRest(_b, [
|
|
3516
|
+
"onChange"
|
|
3517
|
+
]);
|
|
3512
3518
|
const editMode = useEditMode();
|
|
3513
3519
|
if (!editMode)
|
|
3514
3520
|
return /* @__PURE__ */ jsx21(
|
|
@@ -3525,9 +3531,21 @@ function EditableCheckboxCell(context) {
|
|
|
3525
3531
|
Controller,
|
|
3526
3532
|
{
|
|
3527
3533
|
name: context.column.id,
|
|
3528
|
-
render: (
|
|
3529
|
-
var { field:
|
|
3530
|
-
return /* @__PURE__ */ jsx21(
|
|
3534
|
+
render: (_a2) => {
|
|
3535
|
+
var { field: _b2 } = _a2, _c = _b2, { value, onChange } = _c, field = __objRest(_c, ["value", "onChange"]);
|
|
3536
|
+
return /* @__PURE__ */ jsx21(
|
|
3537
|
+
Checkbox4,
|
|
3538
|
+
__spreadProps(__spreadValues({
|
|
3539
|
+
enterKeyHint: "send",
|
|
3540
|
+
"aria-label": "editable",
|
|
3541
|
+
checked: value
|
|
3542
|
+
}, field), {
|
|
3543
|
+
onChange: (e) => {
|
|
3544
|
+
onChange(e);
|
|
3545
|
+
onChangeFromProps == null ? void 0 : onChangeFromProps(e.target.checked);
|
|
3546
|
+
}
|
|
3547
|
+
})
|
|
3548
|
+
);
|
|
3531
3549
|
}
|
|
3532
3550
|
}
|
|
3533
3551
|
);
|
|
@@ -3574,8 +3592,16 @@ function stopPropagation2(handler) {
|
|
|
3574
3592
|
|
|
3575
3593
|
// src/form-cells/EditableDateCell.tsx
|
|
3576
3594
|
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
3577
|
-
function EditableDateCell(
|
|
3578
|
-
|
|
3595
|
+
function EditableDateCell(_a) {
|
|
3596
|
+
var _b = _a, {
|
|
3597
|
+
dateStringFormatter,
|
|
3598
|
+
error: errorFromProps,
|
|
3599
|
+
onChange: onChangeFromProps
|
|
3600
|
+
} = _b, context = __objRest(_b, [
|
|
3601
|
+
"dateStringFormatter",
|
|
3602
|
+
"error",
|
|
3603
|
+
"onChange"
|
|
3604
|
+
]);
|
|
3579
3605
|
const rawValue = context.getValue();
|
|
3580
3606
|
const editMode = useEditMode();
|
|
3581
3607
|
const formattedValue = useMemo(
|
|
@@ -3591,8 +3617,8 @@ function EditableDateCell(props) {
|
|
|
3591
3617
|
Controller2,
|
|
3592
3618
|
{
|
|
3593
3619
|
name: context.column.id,
|
|
3594
|
-
render: (
|
|
3595
|
-
var
|
|
3620
|
+
render: (_a2) => {
|
|
3621
|
+
var _b2 = _a2, { field: _c } = _b2, _d = _c, { value, onChange } = _d, field = __objRest(_d, ["value", "onChange"]), { fieldState: { error } } = _b2;
|
|
3596
3622
|
return /* @__PURE__ */ jsx23(
|
|
3597
3623
|
InlineTextField,
|
|
3598
3624
|
__spreadValues(__spreadValues({
|
|
@@ -3600,8 +3626,12 @@ function EditableDateCell(props) {
|
|
|
3600
3626
|
type: "date",
|
|
3601
3627
|
autoComplete: "none",
|
|
3602
3628
|
value: value ? parseISODate(value) : "",
|
|
3603
|
-
onChange: (e) =>
|
|
3604
|
-
|
|
3629
|
+
onChange: (e) => {
|
|
3630
|
+
const newDateString = e.target.value ? parseISODate(e.target.value) : "";
|
|
3631
|
+
onChange(newDateString);
|
|
3632
|
+
onChangeFromProps == null ? void 0 : onChangeFromProps(newDateString);
|
|
3633
|
+
}
|
|
3634
|
+
}, getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error })), field)
|
|
3605
3635
|
);
|
|
3606
3636
|
}
|
|
3607
3637
|
}
|
|
@@ -3639,42 +3669,97 @@ var InlineTextField = styled17(TextField)`
|
|
|
3639
3669
|
// src/form-cells/EditableDropdownSingleCell.tsx
|
|
3640
3670
|
import { Autocomplete } from "@equinor/eds-core-react";
|
|
3641
3671
|
import { Controller as Controller3 } from "react-hook-form";
|
|
3642
|
-
|
|
3672
|
+
|
|
3673
|
+
// src/form-cells/FormHelperText.tsx
|
|
3674
|
+
import { Typography as Typography4 } from "@equinor/eds-core-react";
|
|
3675
|
+
import { tokens as tokens6 } from "@equinor/eds-tokens";
|
|
3676
|
+
import { Fragment as Fragment4, jsx as jsx24, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3677
|
+
var colors = {
|
|
3678
|
+
error: tokens6.colors.interactive.danger__text.hex,
|
|
3679
|
+
warning: tokens6.colors.interactive.warning__text.hex,
|
|
3680
|
+
success: tokens6.colors.interactive.success__text.hex
|
|
3681
|
+
};
|
|
3682
|
+
function HelperText({ helperText, variant, helperIcon }) {
|
|
3683
|
+
return /* @__PURE__ */ jsx24(Fragment4, { children: helperText && /* @__PURE__ */ jsx24("div", { style: { marginTop: "8px", marginLeft: "8px" }, children: /* @__PURE__ */ jsxs12(
|
|
3684
|
+
"div",
|
|
3685
|
+
{
|
|
3686
|
+
style: {
|
|
3687
|
+
display: "flex",
|
|
3688
|
+
alignItems: "flex-start",
|
|
3689
|
+
marginTop: "8px",
|
|
3690
|
+
color: variant ? colors[variant] : "inherit"
|
|
3691
|
+
},
|
|
3692
|
+
children: [
|
|
3693
|
+
/* @__PURE__ */ jsx24("span", { style: { flexShrink: 0 }, children: helperIcon }),
|
|
3694
|
+
/* @__PURE__ */ jsx24(
|
|
3695
|
+
Typography4,
|
|
3696
|
+
{
|
|
3697
|
+
style: {
|
|
3698
|
+
fontSize: "0.75rem",
|
|
3699
|
+
fontWeight: 500,
|
|
3700
|
+
lineHeight: "1.333em",
|
|
3701
|
+
letterSpacing: "0.013em",
|
|
3702
|
+
textAlign: "left",
|
|
3703
|
+
margin: "0 0 0 8px",
|
|
3704
|
+
color: "inherit"
|
|
3705
|
+
},
|
|
3706
|
+
children: helperText
|
|
3707
|
+
}
|
|
3708
|
+
)
|
|
3709
|
+
]
|
|
3710
|
+
}
|
|
3711
|
+
) }) });
|
|
3712
|
+
}
|
|
3713
|
+
|
|
3714
|
+
// src/form-cells/EditableDropdownSingleCell.tsx
|
|
3715
|
+
import { Fragment as Fragment5, jsx as jsx25, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3643
3716
|
function buildEmptyOption() {
|
|
3644
3717
|
return { label: "", value: "" };
|
|
3645
3718
|
}
|
|
3646
|
-
function EditableDropdownSingleCell(
|
|
3647
|
-
|
|
3719
|
+
function EditableDropdownSingleCell(_a) {
|
|
3720
|
+
var _b = _a, {
|
|
3721
|
+
options,
|
|
3722
|
+
error: errorFromProps,
|
|
3723
|
+
onChange: onChangeFromProps
|
|
3724
|
+
} = _b, context = __objRest(_b, [
|
|
3725
|
+
"options",
|
|
3726
|
+
"error",
|
|
3727
|
+
"onChange"
|
|
3728
|
+
]);
|
|
3648
3729
|
const editMode = useEditMode();
|
|
3649
3730
|
if (!editMode)
|
|
3650
|
-
return /* @__PURE__ */
|
|
3651
|
-
return /* @__PURE__ */
|
|
3731
|
+
return /* @__PURE__ */ jsx25(TypographyCustom, { truncate: true, children: context.getValue() });
|
|
3732
|
+
return /* @__PURE__ */ jsx25(
|
|
3652
3733
|
Controller3,
|
|
3653
3734
|
{
|
|
3654
3735
|
name: context.column.id,
|
|
3655
|
-
render: (
|
|
3656
|
-
var { field: _c } =
|
|
3657
|
-
var
|
|
3658
|
-
const selectedOption = (
|
|
3659
|
-
return /* @__PURE__ */
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3736
|
+
render: (_a2) => {
|
|
3737
|
+
var _b2 = _a2, { field: _c } = _b2, _d = _c, { value, onChange } = _d, field = __objRest(_d, ["value", "onChange"]), { fieldState: { error } } = _b2;
|
|
3738
|
+
var _a3;
|
|
3739
|
+
const selectedOption = (_a3 = options.find((option) => option.value === value)) != null ? _a3 : buildEmptyOption();
|
|
3740
|
+
return /* @__PURE__ */ jsxs13(Fragment5, { children: [
|
|
3741
|
+
/* @__PURE__ */ jsx25(
|
|
3742
|
+
Autocomplete,
|
|
3743
|
+
__spreadValues({
|
|
3744
|
+
label: "",
|
|
3745
|
+
selectedOptions: selectedOption && [selectedOption],
|
|
3746
|
+
options,
|
|
3747
|
+
optionLabel: (option) => {
|
|
3748
|
+
var _a4;
|
|
3749
|
+
return (_a4 = option == null ? void 0 : option.label) != null ? _a4 : "";
|
|
3750
|
+
},
|
|
3751
|
+
"aria-required": true,
|
|
3752
|
+
hideClearButton: true,
|
|
3753
|
+
"aria-autocomplete": "none",
|
|
3754
|
+
onOptionsChange: (changes) => {
|
|
3755
|
+
const [change] = changes.selectedItems;
|
|
3756
|
+
onChange(change == null ? void 0 : change.value);
|
|
3757
|
+
onChangeFromProps == null ? void 0 : onChangeFromProps(change);
|
|
3758
|
+
}
|
|
3759
|
+
}, field)
|
|
3760
|
+
),
|
|
3761
|
+
/* @__PURE__ */ jsx25(HelperText, __spreadValues({}, getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error })))
|
|
3762
|
+
] });
|
|
3678
3763
|
}
|
|
3679
3764
|
}
|
|
3680
3765
|
);
|
|
@@ -3684,25 +3769,30 @@ function EditableDropdownSingleCell(props) {
|
|
|
3684
3769
|
import { TextField as TextField2 } from "@equinor/eds-core-react";
|
|
3685
3770
|
import { Controller as Controller4 } from "react-hook-form";
|
|
3686
3771
|
import styled18 from "styled-components";
|
|
3687
|
-
import { Fragment as
|
|
3688
|
-
function EditableNumberCell(
|
|
3772
|
+
import { Fragment as Fragment6, jsx as jsx26 } from "react/jsx-runtime";
|
|
3773
|
+
function EditableNumberCell(_a) {
|
|
3774
|
+
var _b = _a, {
|
|
3775
|
+
error: errorFromProps
|
|
3776
|
+
} = _b, context = __objRest(_b, [
|
|
3777
|
+
"error"
|
|
3778
|
+
]);
|
|
3689
3779
|
const editMode = useEditMode();
|
|
3690
3780
|
if (!editMode)
|
|
3691
|
-
return /* @__PURE__ */
|
|
3692
|
-
return /* @__PURE__ */
|
|
3781
|
+
return /* @__PURE__ */ jsx26(TypographyCustom, { truncate: true, children: context.getValue() });
|
|
3782
|
+
return /* @__PURE__ */ jsx26(
|
|
3693
3783
|
Controller4,
|
|
3694
3784
|
{
|
|
3695
3785
|
name: context.column.id,
|
|
3696
|
-
render: (
|
|
3697
|
-
var
|
|
3698
|
-
return /* @__PURE__ */
|
|
3786
|
+
render: (_a2) => {
|
|
3787
|
+
var _b2 = _a2, { field: _c } = _b2, _d = _c, { onChange } = _d, field = __objRest(_d, ["onChange"]), { fieldState: { error } } = _b2;
|
|
3788
|
+
return /* @__PURE__ */ jsx26(Fragment6, { children: /* @__PURE__ */ jsx26(
|
|
3699
3789
|
InlineTextField2,
|
|
3700
3790
|
__spreadValues(__spreadValues({
|
|
3701
3791
|
id: context.column.id,
|
|
3702
3792
|
type: "number",
|
|
3703
3793
|
autoComplete: "none",
|
|
3704
3794
|
onChange: (e) => onChange(e.target.valueAsNumber)
|
|
3705
|
-
}, field), getHelperTextProps({ error }))
|
|
3795
|
+
}, field), getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error }))
|
|
3706
3796
|
) });
|
|
3707
3797
|
}
|
|
3708
3798
|
}
|
|
@@ -3737,25 +3827,33 @@ import { arrow_up } from "@equinor/eds-icons";
|
|
|
3737
3827
|
import { useState as useState7 } from "react";
|
|
3738
3828
|
import { Controller as Controller5 } from "react-hook-form";
|
|
3739
3829
|
import styled19 from "styled-components";
|
|
3740
|
-
import { Fragment as
|
|
3741
|
-
function EditableTextAreaCell(
|
|
3742
|
-
|
|
3830
|
+
import { Fragment as Fragment7, jsx as jsx27, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3831
|
+
function EditableTextAreaCell(_a) {
|
|
3832
|
+
var _b = _a, {
|
|
3833
|
+
title,
|
|
3834
|
+
error: errorFromProps,
|
|
3835
|
+
onChange: onChangeFromProps
|
|
3836
|
+
} = _b, context = __objRest(_b, [
|
|
3837
|
+
"title",
|
|
3838
|
+
"error",
|
|
3839
|
+
"onChange"
|
|
3840
|
+
]);
|
|
3743
3841
|
const [textareaValue, setTextareaValue] = useState7(context.getValue());
|
|
3744
3842
|
const [open, setOpen] = useState7(false);
|
|
3745
3843
|
const editMode = useEditMode();
|
|
3746
3844
|
const name = context.column.id;
|
|
3747
3845
|
if (!editMode)
|
|
3748
|
-
return /* @__PURE__ */
|
|
3846
|
+
return /* @__PURE__ */ jsx27(PopoverCell, { id: name + "popover", value: context.getValue(), title });
|
|
3749
3847
|
const openDialog = () => setOpen(true);
|
|
3750
3848
|
const closeDialog = () => setOpen(false);
|
|
3751
|
-
return /* @__PURE__ */
|
|
3849
|
+
return /* @__PURE__ */ jsx27(
|
|
3752
3850
|
Controller5,
|
|
3753
3851
|
{
|
|
3754
3852
|
name,
|
|
3755
|
-
render: (
|
|
3756
|
-
var
|
|
3757
|
-
return /* @__PURE__ */
|
|
3758
|
-
/* @__PURE__ */
|
|
3853
|
+
render: (_a2) => {
|
|
3854
|
+
var _b2 = _a2, { field: _c } = _b2, _d = _c, { onChange, ref } = _d, field = __objRest(_d, ["onChange", "ref"]), { fieldState: { error } } = _b2;
|
|
3855
|
+
return /* @__PURE__ */ jsxs14(Fragment7, { children: [
|
|
3856
|
+
/* @__PURE__ */ jsxs14(
|
|
3759
3857
|
"div",
|
|
3760
3858
|
{
|
|
3761
3859
|
style: {
|
|
@@ -3764,31 +3862,32 @@ function EditableTextAreaCell(props) {
|
|
|
3764
3862
|
position: "relative"
|
|
3765
3863
|
},
|
|
3766
3864
|
children: [
|
|
3767
|
-
/* @__PURE__ */
|
|
3865
|
+
/* @__PURE__ */ jsx27(
|
|
3768
3866
|
StyledTextField,
|
|
3769
3867
|
__spreadValues(__spreadValues({
|
|
3770
3868
|
id: field.name,
|
|
3771
3869
|
onChange,
|
|
3772
3870
|
ref
|
|
3773
|
-
}, field), getHelperTextProps({ error }))
|
|
3871
|
+
}, field), getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error }))
|
|
3774
3872
|
),
|
|
3775
|
-
/* @__PURE__ */
|
|
3873
|
+
/* @__PURE__ */ jsx27(IconButton, { variant: "ghost_icon", onClick: stopPropagation2(openDialog), children: /* @__PURE__ */ jsx27(Icon8, { data: arrow_up, size: 24, style: { transform: "rotateZ(45deg)" } }) })
|
|
3776
3874
|
]
|
|
3777
3875
|
}
|
|
3778
3876
|
),
|
|
3779
|
-
/* @__PURE__ */
|
|
3877
|
+
/* @__PURE__ */ jsxs14(
|
|
3780
3878
|
EDS,
|
|
3781
3879
|
{
|
|
3782
3880
|
open,
|
|
3783
3881
|
onClose: () => {
|
|
3784
3882
|
closeDialog();
|
|
3785
3883
|
onChange(textareaValue);
|
|
3884
|
+
onChangeFromProps == null ? void 0 : onChangeFromProps(textareaValue);
|
|
3786
3885
|
},
|
|
3787
3886
|
isDismissable: true,
|
|
3788
3887
|
style: { width: "min(50rem, calc(100vw - 4rem))" },
|
|
3789
3888
|
children: [
|
|
3790
|
-
/* @__PURE__ */
|
|
3791
|
-
/* @__PURE__ */
|
|
3889
|
+
/* @__PURE__ */ jsx27(EDS.Header, { children: /* @__PURE__ */ jsx27(EDS.Title, { children: title }) }),
|
|
3890
|
+
/* @__PURE__ */ jsx27(EDS.Content, { children: /* @__PURE__ */ jsx27(
|
|
3792
3891
|
TextField3,
|
|
3793
3892
|
{
|
|
3794
3893
|
style: {
|
|
@@ -3805,18 +3904,19 @@ function EditableTextAreaCell(props) {
|
|
|
3805
3904
|
}
|
|
3806
3905
|
}
|
|
3807
3906
|
) }),
|
|
3808
|
-
/* @__PURE__ */
|
|
3809
|
-
/* @__PURE__ */
|
|
3907
|
+
/* @__PURE__ */ jsxs14(EDS.Actions, { style: { display: "flex", gap: "1rem" }, children: [
|
|
3908
|
+
/* @__PURE__ */ jsx27(
|
|
3810
3909
|
Button5,
|
|
3811
3910
|
{
|
|
3812
3911
|
onClick: () => {
|
|
3813
3912
|
closeDialog();
|
|
3814
3913
|
onChange(textareaValue);
|
|
3914
|
+
onChangeFromProps == null ? void 0 : onChangeFromProps(textareaValue);
|
|
3815
3915
|
},
|
|
3816
3916
|
children: "Submit"
|
|
3817
3917
|
}
|
|
3818
3918
|
),
|
|
3819
|
-
/* @__PURE__ */
|
|
3919
|
+
/* @__PURE__ */ jsx27(
|
|
3820
3920
|
Button5,
|
|
3821
3921
|
{
|
|
3822
3922
|
variant: "ghost",
|
|
@@ -3856,24 +3956,29 @@ var IconButton = styled19(Button5)`
|
|
|
3856
3956
|
import { TextField as TextField4 } from "@equinor/eds-core-react";
|
|
3857
3957
|
import { Controller as Controller6 } from "react-hook-form";
|
|
3858
3958
|
import styled20 from "styled-components";
|
|
3859
|
-
import { jsx as
|
|
3860
|
-
function EditableTextFieldCell(
|
|
3959
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
3960
|
+
function EditableTextFieldCell(_a) {
|
|
3961
|
+
var _b = _a, {
|
|
3962
|
+
error: errorFromProps
|
|
3963
|
+
} = _b, context = __objRest(_b, [
|
|
3964
|
+
"error"
|
|
3965
|
+
]);
|
|
3861
3966
|
const editMode = useEditMode();
|
|
3862
3967
|
if (!editMode)
|
|
3863
|
-
return /* @__PURE__ */
|
|
3864
|
-
return /* @__PURE__ */
|
|
3968
|
+
return /* @__PURE__ */ jsx28(TypographyCustom, { truncate: true, children: context.getValue() });
|
|
3969
|
+
return /* @__PURE__ */ jsx28(
|
|
3865
3970
|
Controller6,
|
|
3866
3971
|
{
|
|
3867
3972
|
name: context.column.id,
|
|
3868
|
-
render: (
|
|
3869
|
-
var
|
|
3870
|
-
return /* @__PURE__ */
|
|
3973
|
+
render: (_a2) => {
|
|
3974
|
+
var _b2 = _a2, { field: _c } = _b2, _d = _c, { value } = _d, field = __objRest(_d, ["value"]), { fieldState: { error } } = _b2;
|
|
3975
|
+
return /* @__PURE__ */ jsx28(
|
|
3871
3976
|
InlineTextField3,
|
|
3872
3977
|
__spreadValues(__spreadValues({
|
|
3873
3978
|
id: context.column.id,
|
|
3874
3979
|
autoComplete: "none",
|
|
3875
3980
|
value: String(value != null ? value : "")
|
|
3876
|
-
}, field), getHelperTextProps({ error }))
|
|
3981
|
+
}, field), getHelperTextProps({ error: errorFromProps != null ? errorFromProps : error }))
|
|
3877
3982
|
);
|
|
3878
3983
|
}
|
|
3879
3984
|
}
|