asma-ui-core 3.20.1 → 3.21.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/asma-ui-core.css +1 -1
- package/dist/components/inputs/input-field/StyledInputField.js +6 -6
- package/dist/components/utils/accordion/base-ui/StyledAccordionSummary.js +20 -18
- package/dist/src/table/components/columns/action-column/actionColumn.d.ts +1 -1
- package/dist/src/table/components/columns/action-column/components/HeaderActionMenu.d.ts +1 -1
- package/dist/src/table/components/columns/action-column/components/RowActionMenu.d.ts +1 -1
- package/dist/src/table/components/columns/selectColumn.d.ts +2 -2
- package/dist/src/table/types.d.ts +5 -1
- package/dist/table/components/StyledTable.module.js +51 -50
- package/dist/table/components/StyledTableIndex.js +67 -68
- package/dist/table/components/columns/selectColumn.js +52 -23
- package/dist/table/helpers/injectColumns.js +6 -6
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { CloseIcon as
|
|
1
|
+
import { CloseIcon as d } from "../../icons/close-icon/CloseIcon.js";
|
|
2
2
|
import { ErrorOutlineIcon as p } from "../../icons/error-outline-icon/ErrorOutlineIcon.js";
|
|
3
3
|
import { TextField as c } from "@mui/material";
|
|
4
4
|
import { jsx as o, jsxs as m } from "react/jsx-runtime";
|
|
5
|
-
var h = ({ allowClear: l, onClear: n, readOnly: t, disabled: u, error: e, helperText: a, dataTest:
|
|
5
|
+
var h = ({ allowClear: l, onClear: n, readOnly: t, disabled: u, error: e, helperText: a, dataTest: s, ...r }) => /* @__PURE__ */ o(c, {
|
|
6
6
|
...r,
|
|
7
|
-
"data-testid":
|
|
7
|
+
"data-testid": s,
|
|
8
8
|
disabled: (u ?? !1) || (t ?? !1),
|
|
9
9
|
error: e,
|
|
10
|
-
helperText: t ? null : e ? /* @__PURE__ */ m("
|
|
11
|
-
className: "flex items-center gap-1",
|
|
10
|
+
helperText: t ? null : e ? /* @__PURE__ */ m("span", {
|
|
11
|
+
className: "inline-flex items-center gap-1",
|
|
12
12
|
children: [/* @__PURE__ */ o(p, {
|
|
13
13
|
width: 20,
|
|
14
14
|
height: 20,
|
|
@@ -24,7 +24,7 @@ var h = ({ allowClear: l, onClear: n, readOnly: t, disabled: u, error: e, helper
|
|
|
24
24
|
onClick: (i) => {
|
|
25
25
|
i.stopPropagation(), i.preventDefault(), n?.();
|
|
26
26
|
},
|
|
27
|
-
children: /* @__PURE__ */ o(
|
|
27
|
+
children: /* @__PURE__ */ o(d, {
|
|
28
28
|
width: 18,
|
|
29
29
|
height: 18
|
|
30
30
|
})
|
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
import { ChevronDownIcon as a } from "../../../icons/chevron-down-icon/ChevronDownIcon.js";
|
|
2
2
|
import r from "./StyledAccordion.module.js";
|
|
3
|
-
import
|
|
3
|
+
import o from "clsx";
|
|
4
4
|
import "react";
|
|
5
|
-
import { Fragment as
|
|
6
|
-
import { Accordion as
|
|
7
|
-
var
|
|
8
|
-
const
|
|
9
|
-
"--trigger-height":
|
|
10
|
-
"--trigger-padding-x":
|
|
11
|
-
"--trigger-font-size":
|
|
12
|
-
"--chevron-size":
|
|
5
|
+
import { Fragment as n, jsx as e, jsxs as s } from "react/jsx-runtime";
|
|
6
|
+
import { Accordion as c } from "@base-ui/react/accordion";
|
|
7
|
+
var N = ({ size: g = "large", expandChevronRight: m, className: l, headerClassName: d, sx: p, children: i, ...x }) => {
|
|
8
|
+
const t = g === "small", f = {
|
|
9
|
+
"--trigger-height": t ? "48px" : "72px",
|
|
10
|
+
"--trigger-padding-x": t ? "8px" : "16px",
|
|
11
|
+
"--trigger-font-size": t ? "14px" : "18px",
|
|
12
|
+
"--chevron-size": t ? "20px" : "24px",
|
|
13
13
|
...p
|
|
14
14
|
};
|
|
15
|
-
return /* @__PURE__ */
|
|
16
|
-
className:
|
|
17
|
-
children: /* @__PURE__ */
|
|
15
|
+
return /* @__PURE__ */ e(c.Header, {
|
|
16
|
+
className: o(r.Header, d),
|
|
17
|
+
children: /* @__PURE__ */ e(c.Trigger, {
|
|
18
18
|
...x,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
nativeButton: !1,
|
|
20
|
+
render: /* @__PURE__ */ e("div", {}),
|
|
21
|
+
className: o(r.Trigger, l),
|
|
22
|
+
style: f,
|
|
23
|
+
children: m ? /* @__PURE__ */ s(n, { children: [i, /* @__PURE__ */ e(a, {
|
|
24
|
+
className: o(r.TriggerIcon, r.TriggerIconRight),
|
|
23
25
|
"data-state-icon": !0
|
|
24
|
-
})] }) : /* @__PURE__ */
|
|
26
|
+
})] }) : /* @__PURE__ */ s(n, { children: [/* @__PURE__ */ e(a, {
|
|
25
27
|
className: r.TriggerIcon,
|
|
26
28
|
"data-state-icon": !0
|
|
27
29
|
}), i] })
|
|
@@ -29,5 +31,5 @@ var S = ({ size: m = "large", expandChevronRight: n, className: l, headerClassNa
|
|
|
29
31
|
});
|
|
30
32
|
};
|
|
31
33
|
export {
|
|
32
|
-
|
|
34
|
+
N as StyledAccordionSummary
|
|
33
35
|
};
|
|
@@ -4,7 +4,7 @@ import { ColumnDef, IAction, ICustomAction, RowActionsState } from '../../../typ
|
|
|
4
4
|
export declare function generateActionsColumn<TData>(options: {
|
|
5
5
|
headerPin: boolean;
|
|
6
6
|
actions?: (row: Row<TData>) => (IAction<TData> | ICustomAction<TData>)[];
|
|
7
|
-
customActionsNode?: (row: CellContext<TData,
|
|
7
|
+
customActionsNode?: (row: CellContext<TData, unknown>) => ReactNode;
|
|
8
8
|
rowHeight?: number;
|
|
9
9
|
customActionsColumnProps?: Partial<ColumnDef<TData, unknown>>;
|
|
10
10
|
rowActionsState?: (row: Row<TData>) => RowActionsState | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CellContext, Row } from '@tanstack/react-table';
|
|
2
2
|
import { IAction, ICustomAction, RowActionsState } from '../../../../types';
|
|
3
3
|
export declare function RowActionMenu<TData>({ tableData, actions, rowActionsState, }: {
|
|
4
|
-
tableData: CellContext<TData,
|
|
4
|
+
tableData: CellContext<TData, unknown>;
|
|
5
5
|
actions: (row: Row<TData>) => (IAction<TData> | ICustomAction<TData>)[];
|
|
6
6
|
rowActionsState?: (row: Row<TData>) => RowActionsState | undefined;
|
|
7
7
|
}): JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ColumnDef } from '
|
|
2
|
-
export declare function selectColumn<TData>(isFixed: boolean, rowHeight?: number): ColumnDef<TData, unknown>;
|
|
1
|
+
import { ColumnDef } from '@tanstack/react-table';
|
|
2
|
+
export declare function selectColumn<TData>(isFixed: boolean, rowHeight?: number, locale?: 'en' | 'no'): ColumnDef<TData, unknown>;
|
|
@@ -70,7 +70,11 @@ export type StyledTableProps<TData, TCustomData> = {
|
|
|
70
70
|
locale?: 'no' | 'en';
|
|
71
71
|
height?: string | number;
|
|
72
72
|
actions?: (row: Row<TData>) => (IAction<TData> | ICustomAction<TData>)[];
|
|
73
|
-
|
|
73
|
+
/**
|
|
74
|
+
* Receives the actions cell context for the internal actions column.
|
|
75
|
+
* Use row.original and the row APIs instead of getValue(), because this column stores an unknown accessor value.
|
|
76
|
+
*/
|
|
77
|
+
customActionsNode?: (row: CellContext<TData, unknown>) => ReactNode;
|
|
74
78
|
customSubRowData?: Map<string, TCustomData[]>;
|
|
75
79
|
headerPin?: boolean;
|
|
76
80
|
expandArrow?: boolean;
|
|
@@ -1,56 +1,57 @@
|
|
|
1
|
-
var
|
|
2
|
-
"asma-ui-table-styled-table": "_asma-ui-table-styled-
|
|
3
|
-
"table-wrapper": "_table-
|
|
4
|
-
"table-shell": "_table-
|
|
5
|
-
"table-wrapper--no-rows": "_table-wrapper--no-
|
|
6
|
-
"table-wrapper--proxy": "_table-wrapper--
|
|
7
|
-
"table-wrapper--proxy-bottom": "_table-wrapper--proxy-
|
|
8
|
-
"table-wrapper-fetching": "_table-wrapper-
|
|
9
|
-
"table-scroll": "_table-
|
|
10
|
-
"table-x--fill-height": "_table-x--fill-
|
|
11
|
-
"table-x": "_table-
|
|
12
|
-
"table-
|
|
13
|
-
"table-
|
|
14
|
-
"table-
|
|
15
|
-
"
|
|
16
|
-
"no-rows-overlay-
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
"t-
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"fixed-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
"action-cell--
|
|
1
|
+
var e = "_tbody_1u0xz_124", _ = "_expanded_row_1u0xz_187", l = "_selected_1u0xz_205", t = "_shadowed_1u0xz_234", a = "_resizer_1u0xz_288", o = "_isResizing_1u0xz_300", r = {
|
|
2
|
+
"asma-ui-table-styled-table": "_asma-ui-table-styled-table_1u0xz_1",
|
|
3
|
+
"table-wrapper": "_table-wrapper_1u0xz_26",
|
|
4
|
+
"table-shell": "_table-shell_1u0xz_33",
|
|
5
|
+
"table-wrapper--no-rows": "_table-wrapper--no-rows_1u0xz_39",
|
|
6
|
+
"table-wrapper--proxy": "_table-wrapper--proxy_1u0xz_42",
|
|
7
|
+
"table-wrapper--proxy-bottom": "_table-wrapper--proxy-bottom_1u0xz_43",
|
|
8
|
+
"table-wrapper-fetching": "_table-wrapper-fetching_1u0xz_53",
|
|
9
|
+
"table-scroll": "_table-scroll_1u0xz_56",
|
|
10
|
+
"table-x--fill-height": "_table-x--fill-height_1u0xz_65",
|
|
11
|
+
"table-x": "_table-x_1u0xz_65",
|
|
12
|
+
"table-content": "_table-content_1u0xz_80",
|
|
13
|
+
"table-header--sticky": "_table-header--sticky_1u0xz_85",
|
|
14
|
+
"table-hscroll": "_table-hscroll_1u0xz_90",
|
|
15
|
+
"table-hscroll__content": "_table-hscroll__content_1u0xz_100",
|
|
16
|
+
"no-rows-overlay-container": "_no-rows-overlay-container_1u0xz_103",
|
|
17
|
+
"no-rows-overlay-content": "_no-rows-overlay-content_1u0xz_111",
|
|
18
|
+
"styled-table": "_styled-table_1u0xz_115",
|
|
19
|
+
tbody: e,
|
|
20
|
+
"loading-icon": "_loading-icon_1u0xz_129",
|
|
21
|
+
"t-row": "_t-row_1u0xz_136",
|
|
22
|
+
"t-cell": "_t-cell_1u0xz_136",
|
|
23
|
+
"action-cell": "_action-cell_1u0xz_146",
|
|
24
|
+
"fixed-cell": "_fixed-cell_1u0xz_150",
|
|
25
|
+
"fixed-right-cell": "_fixed-right-cell_1u0xz_153",
|
|
26
|
+
expanded_row: _,
|
|
27
|
+
selected: l,
|
|
28
|
+
"single-selection": "_single-selection_1u0xz_208",
|
|
29
|
+
"action-cell--no-shadow": "_action-cell--no-shadow_1u0xz_225",
|
|
30
|
+
"action-cell--not-fixed": "_action-cell--not-fixed_1u0xz_228",
|
|
30
31
|
shadowed: t,
|
|
31
|
-
"shadowed-right": "_shadowed-
|
|
32
|
-
"is-loading": "_is-
|
|
33
|
-
"action-cell-default-background": "_action-cell-default-
|
|
34
|
-
"fixed-cell-default-background": "_fixed-cell-default-
|
|
35
|
-
"fixed-right-cell-default-background": "_fixed-right-cell-default-
|
|
36
|
-
"sortable-column": "_sortable-
|
|
32
|
+
"shadowed-right": "_shadowed-right_1u0xz_268",
|
|
33
|
+
"is-loading": "_is-loading_1u0xz_272",
|
|
34
|
+
"action-cell-default-background": "_action-cell-default-background_1u0xz_275",
|
|
35
|
+
"fixed-cell-default-background": "_fixed-cell-default-background_1u0xz_278",
|
|
36
|
+
"fixed-right-cell-default-background": "_fixed-right-cell-default-background_1u0xz_281",
|
|
37
|
+
"sortable-column": "_sortable-column_1u0xz_284",
|
|
37
38
|
resizer: a,
|
|
38
39
|
isResizing: o,
|
|
39
|
-
"hide-table-header": "_hide-table-
|
|
40
|
-
"show-table-header": "_show-table-
|
|
41
|
-
"table-header": "_table-
|
|
42
|
-
"hide-header": "_hide-
|
|
43
|
-
"t-cell__actions": "_t-
|
|
44
|
-
"t-cell__actions--no-shadow": "_t-cell__actions--no-
|
|
45
|
-
"t-cell__actions--not-fixed": "_t-cell__actions--not-
|
|
46
|
-
"t-cell__fixed": "_t-
|
|
47
|
-
"t-cell__fixed-right": "_t-cell__fixed-
|
|
48
|
-
"sort-icon": "_sort-
|
|
49
|
-
"table-footer--sticky": "_table-footer--
|
|
50
|
-
"table-footer--inline": "_table-footer--
|
|
51
|
-
"table-bottom": "_table-
|
|
52
|
-
"table-bottom--sticky": "_table-bottom--
|
|
53
|
-
"cursor-not-allowed": "_cursor-not-
|
|
40
|
+
"hide-table-header": "_hide-table-header_1u0xz_312",
|
|
41
|
+
"show-table-header": "_show-table-header_1u0xz_316",
|
|
42
|
+
"table-header": "_table-header_1u0xz_85",
|
|
43
|
+
"hide-header": "_hide-header_1u0xz_341",
|
|
44
|
+
"t-cell__actions": "_t-cell__actions_1u0xz_344",
|
|
45
|
+
"t-cell__actions--no-shadow": "_t-cell__actions--no-shadow_1u0xz_352",
|
|
46
|
+
"t-cell__actions--not-fixed": "_t-cell__actions--not-fixed_1u0xz_355",
|
|
47
|
+
"t-cell__fixed": "_t-cell__fixed_1u0xz_362",
|
|
48
|
+
"t-cell__fixed-right": "_t-cell__fixed-right_1u0xz_369",
|
|
49
|
+
"sort-icon": "_sort-icon_1u0xz_376",
|
|
50
|
+
"table-footer--sticky": "_table-footer--sticky_1u0xz_379",
|
|
51
|
+
"table-footer--inline": "_table-footer--inline_1u0xz_390",
|
|
52
|
+
"table-bottom": "_table-bottom_1u0xz_401",
|
|
53
|
+
"table-bottom--sticky": "_table-bottom--sticky_1u0xz_415",
|
|
54
|
+
"cursor-not-allowed": "_cursor-not-allowed_1u0xz_419"
|
|
54
55
|
};
|
|
55
56
|
export {
|
|
56
57
|
r as default
|
|
@@ -2,7 +2,7 @@ import { cn as p } from "../helpers/cn.js";
|
|
|
2
2
|
import { RootContextProvider as te } from "../context/RootContext.js";
|
|
3
3
|
import { mobileView as oe, useWindowWidthSize as re } from "../hooks/useWindowWidthSize.hook.js";
|
|
4
4
|
import { useStyledTable as ne } from "../hooks/useStyledTable.js";
|
|
5
|
-
import
|
|
5
|
+
import e from "./StyledTable.module.js";
|
|
6
6
|
import { injectColumns as le } from "../helpers/injectColumns.js";
|
|
7
7
|
import { TableHeader as se } from "./table-header/TableHeader.js";
|
|
8
8
|
import { TableBody as ie } from "./TableBody.js";
|
|
@@ -12,38 +12,38 @@ import { useProxyHorizontalScrollSync as ce } from "./columns/helpers/useProxyHo
|
|
|
12
12
|
import { useElementHeightPx as $ } from "./columns/helpers/useElementHeightPx.js";
|
|
13
13
|
import { useColumnVirtualizer as de } from "../hooks/useColumnVirtualizer.js";
|
|
14
14
|
import { useLayoutEffect as q, useMemo as O, useRef as L, useState as me } from "react";
|
|
15
|
-
import { Fragment as X, jsx as
|
|
15
|
+
import { Fragment as X, jsx as t, jsxs as w } from "react/jsx-runtime";
|
|
16
16
|
import { DndContext as fe, closestCenter as he } from "@dnd-kit/core";
|
|
17
17
|
import { restrictToParentElement as be, restrictToVerticalAxis as ue } from "@dnd-kit/modifiers";
|
|
18
18
|
import { arrayMove as pe } from "@dnd-kit/sortable";
|
|
19
|
-
function we({ enabled: l, data:
|
|
20
|
-
const
|
|
19
|
+
function we({ enabled: l, data: o, setData: i, children: v }) {
|
|
20
|
+
const y = O(() => o.map((c) => c.id), [o]), S = (c) => {
|
|
21
21
|
if (!l || !i) return;
|
|
22
22
|
const { active: m, over: f } = c;
|
|
23
|
-
!m || !f || m.id === f.id || i((
|
|
23
|
+
!m || !f || m.id === f.id || i((g) => pe(g, y.indexOf(m.id), y.indexOf(f.id)));
|
|
24
24
|
};
|
|
25
|
-
return l ? /* @__PURE__ */
|
|
25
|
+
return l ? /* @__PURE__ */ t(fe, {
|
|
26
26
|
collisionDetection: he,
|
|
27
27
|
modifiers: [ue, be],
|
|
28
28
|
onDragEnd: S,
|
|
29
|
-
children:
|
|
30
|
-
}) : /* @__PURE__ */
|
|
29
|
+
children: v
|
|
30
|
+
}) : /* @__PURE__ */ t(X, { children: v });
|
|
31
31
|
}
|
|
32
|
-
function ve({ enabled: l, className:
|
|
33
|
-
return l ? /* @__PURE__ */
|
|
34
|
-
className:
|
|
32
|
+
function ve({ enabled: l, className: o, children: i }) {
|
|
33
|
+
return l ? /* @__PURE__ */ t("div", {
|
|
34
|
+
className: o,
|
|
35
35
|
children: i
|
|
36
|
-
}) : /* @__PURE__ */
|
|
36
|
+
}) : /* @__PURE__ */ t(X, { children: i });
|
|
37
37
|
}
|
|
38
38
|
var Ve = (l) => {
|
|
39
|
-
const
|
|
39
|
+
const o = O(() => ({
|
|
40
40
|
...l,
|
|
41
41
|
rowHeight: l.rowHeight ?? 48
|
|
42
|
-
}), [l]), { className: i, tableClassName:
|
|
43
|
-
le(
|
|
44
|
-
const { table: a } = ne(
|
|
42
|
+
}), [l]), { className: i, tableClassName: v, height: y, noRowsOverlay: S, data: c, enableDnd: m, setData: f, loading: g } = o;
|
|
43
|
+
le(o);
|
|
44
|
+
const { table: a } = ne(o), C = c.length > 0, F = C && !!g, h = !C && !g, z = oe(re()), r = !!o.stickyFooter && !z, [G, M] = me(!1), x = L(null), W = L(null), P = o.hideHeader ? 0 : 32, { tableScrollRef: R, tableXRef: H, hScrollRef: J, hScrollContentRef: K } = ce(!r);
|
|
45
45
|
q(() => {
|
|
46
|
-
const n = r ?
|
|
46
|
+
const n = r ? x.current : H.current ?? R.current;
|
|
47
47
|
if (!n) {
|
|
48
48
|
M(!1);
|
|
49
49
|
return;
|
|
@@ -60,26 +60,26 @@ var Ve = (l) => {
|
|
|
60
60
|
}, [
|
|
61
61
|
r,
|
|
62
62
|
H,
|
|
63
|
-
|
|
63
|
+
R
|
|
64
64
|
]);
|
|
65
|
-
const { ref: Q, heightPx: k } = $(), { ref: U, heightPx: D } = $(),
|
|
66
|
-
if (
|
|
65
|
+
const { ref: Q, heightPx: k } = $(), { ref: U, heightPx: D } = $(), N = o.rowHeight ?? 48, E = a.getRowModel().rows.length, V = o.hideHeader ? 0 : 32, _ = 12, Y = O(() => {
|
|
66
|
+
if (N <= 0) return 0;
|
|
67
67
|
const n = r ? 0 : V + D + _, s = Math.max(0, k - n);
|
|
68
|
-
return Math.floor(s /
|
|
68
|
+
return Math.floor(s / N);
|
|
69
69
|
}, [
|
|
70
70
|
r,
|
|
71
71
|
D,
|
|
72
72
|
V,
|
|
73
73
|
_,
|
|
74
|
-
|
|
74
|
+
N,
|
|
75
75
|
k
|
|
76
|
-
]),
|
|
76
|
+
]), T = !r && E > 0 && E <= Y, Z = p(r ? e["table-wrapper"] : T || !r && h ? e["table-wrapper--proxy-bottom"] : e["table-wrapper--proxy"], F && e["table-wrapper-fetching"], h && e["table-wrapper--no-rows"], i), { columnWindow: j } = de({
|
|
77
77
|
table: a,
|
|
78
|
-
scrollRef: r ?
|
|
78
|
+
scrollRef: r ? x : R,
|
|
79
79
|
isMobileView: z
|
|
80
80
|
});
|
|
81
81
|
q(() => {
|
|
82
|
-
const n =
|
|
82
|
+
const n = x.current, s = W.current, b = () => n?.style.removeProperty("--no-rows-content-height");
|
|
83
83
|
if (!n || !h || !s) {
|
|
84
84
|
b();
|
|
85
85
|
return;
|
|
@@ -91,83 +91,82 @@ var Ve = (l) => {
|
|
|
91
91
|
u.disconnect(), b();
|
|
92
92
|
};
|
|
93
93
|
}, [h, P]);
|
|
94
|
-
const A = /* @__PURE__ */
|
|
95
|
-
className:
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
94
|
+
const A = /* @__PURE__ */ w("div", {
|
|
95
|
+
className: e["table-content"],
|
|
96
|
+
children: [/* @__PURE__ */ w("table", {
|
|
97
|
+
className: e["styled-table"],
|
|
98
|
+
style: {
|
|
99
|
+
width: a.getTotalSize(),
|
|
100
|
+
minWidth: "100%"
|
|
101
|
+
},
|
|
102
|
+
children: [/* @__PURE__ */ t(se, {
|
|
102
103
|
table: a,
|
|
103
|
-
styledTableProps:
|
|
104
|
-
tableCanResize: !!
|
|
104
|
+
styledTableProps: o,
|
|
105
|
+
tableCanResize: !!o.enableColumnResizing,
|
|
105
106
|
tableWidth: null,
|
|
106
107
|
columnWindow: j
|
|
107
|
-
}),
|
|
108
|
-
/* @__PURE__ */ e(ae, { fetching: !!F }),
|
|
109
|
-
/* @__PURE__ */ e(ie, {
|
|
108
|
+
}), /* @__PURE__ */ t(ie, {
|
|
110
109
|
table: a,
|
|
111
|
-
styledTableProps:
|
|
110
|
+
styledTableProps: o,
|
|
112
111
|
columnWindow: j
|
|
113
|
-
})
|
|
114
|
-
]
|
|
115
|
-
}), ee = h ? /* @__PURE__ */
|
|
116
|
-
className:
|
|
112
|
+
})]
|
|
113
|
+
}), /* @__PURE__ */ t(ae, { fetching: !!F })]
|
|
114
|
+
}), ee = h ? /* @__PURE__ */ t("div", {
|
|
115
|
+
className: e["no-rows-overlay-container"],
|
|
117
116
|
style: { top: P },
|
|
118
|
-
children: /* @__PURE__ */
|
|
117
|
+
children: /* @__PURE__ */ t("div", {
|
|
119
118
|
ref: W,
|
|
120
|
-
className:
|
|
119
|
+
className: e["no-rows-overlay-content"],
|
|
121
120
|
children: S
|
|
122
121
|
})
|
|
123
122
|
}) : null;
|
|
124
|
-
return /* @__PURE__ */
|
|
123
|
+
return /* @__PURE__ */ t(te, { children: /* @__PURE__ */ t(we, {
|
|
125
124
|
enabled: !!m,
|
|
126
125
|
data: c,
|
|
127
126
|
setData: f,
|
|
128
|
-
children: /* @__PURE__ */
|
|
127
|
+
children: /* @__PURE__ */ w("div", {
|
|
129
128
|
ref: Q,
|
|
130
|
-
className: p(
|
|
129
|
+
className: p(e["asma-ui-table-styled-table"], v),
|
|
131
130
|
"data-x-overflow": G ? "true" : "false",
|
|
132
|
-
style: { height:
|
|
133
|
-
children: [/* @__PURE__ */
|
|
131
|
+
style: { height: y },
|
|
132
|
+
children: [/* @__PURE__ */ t(ve, {
|
|
134
133
|
enabled: r,
|
|
135
|
-
className:
|
|
136
|
-
children: /* @__PURE__ */
|
|
137
|
-
ref:
|
|
134
|
+
className: e["table-shell"],
|
|
135
|
+
children: /* @__PURE__ */ w("div", {
|
|
136
|
+
ref: x,
|
|
138
137
|
className: Z,
|
|
139
|
-
children: [r ? A : /* @__PURE__ */
|
|
140
|
-
ref:
|
|
141
|
-
className: p(
|
|
138
|
+
children: [r ? A : /* @__PURE__ */ w("div", {
|
|
139
|
+
ref: R,
|
|
140
|
+
className: p(e["table-scroll"]),
|
|
142
141
|
children: [
|
|
143
|
-
/* @__PURE__ */
|
|
142
|
+
/* @__PURE__ */ t("div", {
|
|
144
143
|
ref: H,
|
|
145
|
-
className: p(
|
|
144
|
+
className: p(e["table-x"], !T && e["table-x--fill-height"]),
|
|
146
145
|
children: A
|
|
147
146
|
}),
|
|
148
|
-
/* @__PURE__ */
|
|
147
|
+
/* @__PURE__ */ t("div", {
|
|
149
148
|
ref: J,
|
|
150
|
-
className:
|
|
151
|
-
children: /* @__PURE__ */
|
|
149
|
+
className: e["table-hscroll"],
|
|
150
|
+
children: /* @__PURE__ */ t("div", {
|
|
152
151
|
ref: K,
|
|
153
|
-
className:
|
|
152
|
+
className: e["table-hscroll__content"]
|
|
154
153
|
})
|
|
155
154
|
}),
|
|
156
|
-
/* @__PURE__ */
|
|
155
|
+
/* @__PURE__ */ t("div", {
|
|
157
156
|
ref: U,
|
|
158
|
-
className: p(
|
|
159
|
-
children: /* @__PURE__ */
|
|
157
|
+
className: p(e["table-bottom"], T && e["table-bottom--sticky"]),
|
|
158
|
+
children: /* @__PURE__ */ t(B, {
|
|
160
159
|
table: a,
|
|
161
|
-
styledTableProps:
|
|
160
|
+
styledTableProps: o,
|
|
162
161
|
canShowStickyFooter: !1
|
|
163
162
|
})
|
|
164
163
|
})
|
|
165
164
|
]
|
|
166
165
|
}), ee]
|
|
167
166
|
})
|
|
168
|
-
}), r && /* @__PURE__ */
|
|
167
|
+
}), r && /* @__PURE__ */ t(B, {
|
|
169
168
|
table: a,
|
|
170
|
-
styledTableProps:
|
|
169
|
+
styledTableProps: o,
|
|
171
170
|
canShowStickyFooter: !0
|
|
172
171
|
})]
|
|
173
172
|
})
|
|
@@ -1,59 +1,88 @@
|
|
|
1
|
-
import { SELECT_COLUMN_ID as
|
|
2
|
-
import
|
|
3
|
-
import { StyledCheckbox as
|
|
4
|
-
import { StyledTooltip as
|
|
5
|
-
import { jsx as
|
|
6
|
-
|
|
1
|
+
import { SELECT_COLUMN_ID as u } from "../../types.js";
|
|
2
|
+
import m from "../StyledTable.module.js";
|
|
3
|
+
import { StyledCheckbox as n } from "../../shared-components/StyledCheckbox.js";
|
|
4
|
+
import { StyledTooltip as p } from "../../shared-components/tooltip/index.js";
|
|
5
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
6
|
+
var s = (t) => {
|
|
7
|
+
t.preventDefault(), t.stopPropagation();
|
|
8
|
+
}, i = (t, o) => {
|
|
9
|
+
t.key !== "Enter" && t.key !== " " || (t.preventDefault(), t.stopPropagation(), o());
|
|
10
|
+
}, w = (t) => t === "no" ? {
|
|
11
|
+
selectAll: "Velg alle rader",
|
|
12
|
+
selectRow: (o) => `Velg rad ${o}`
|
|
13
|
+
} : {
|
|
14
|
+
selectAll: "Select all rows",
|
|
15
|
+
selectRow: (o) => `Select row ${o}`
|
|
16
|
+
};
|
|
17
|
+
function k(t, o, c) {
|
|
18
|
+
const a = w(c);
|
|
7
19
|
return {
|
|
8
|
-
id:
|
|
20
|
+
id: u,
|
|
9
21
|
minSize: 38,
|
|
10
22
|
maxSize: 38,
|
|
11
23
|
size: 38,
|
|
12
|
-
header: ({ table: e }) => /* @__PURE__ */
|
|
13
|
-
|
|
24
|
+
header: ({ table: e }) => /* @__PURE__ */ r("div", {
|
|
25
|
+
role: "checkbox",
|
|
26
|
+
tabIndex: 0,
|
|
27
|
+
"aria-label": a.selectAll,
|
|
28
|
+
"aria-checked": e.getIsSomeRowsSelected() ? "mixed" : e.getIsAllRowsSelected(),
|
|
14
29
|
className: "flex size-full items-center justify-start pl-2",
|
|
15
30
|
onClick: () => e.toggleAllRowsSelected(),
|
|
16
|
-
|
|
31
|
+
onMouseDown: s,
|
|
32
|
+
onMouseUp: s,
|
|
33
|
+
onKeyDown: (l) => i(l, () => e.toggleAllRowsSelected()),
|
|
34
|
+
children: /* @__PURE__ */ r(n, {
|
|
17
35
|
size: "small",
|
|
18
36
|
dataTest: "cell-select-all",
|
|
37
|
+
"aria-hidden": !0,
|
|
38
|
+
tabIndex: -1,
|
|
19
39
|
checked: e.getIsAllRowsSelected(),
|
|
20
40
|
indeterminate: e.getIsSomeRowsSelected(),
|
|
41
|
+
className: "pointer-events-none",
|
|
21
42
|
hideWrapper: !0
|
|
22
43
|
})
|
|
23
44
|
}),
|
|
24
45
|
cell: ({ cell: e }) => {
|
|
25
46
|
const l = !e.row.getCanSelect();
|
|
26
|
-
return /* @__PURE__ */
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
47
|
+
return /* @__PURE__ */ r("div", {
|
|
48
|
+
role: "checkbox",
|
|
49
|
+
tabIndex: l ? -1 : 0,
|
|
50
|
+
"aria-label": a.selectRow(e.row.index + 1),
|
|
51
|
+
"aria-checked": e.row.getIsSelected(),
|
|
30
52
|
"aria-disabled": l,
|
|
53
|
+
style: { height: o ?? "auto" },
|
|
54
|
+
className: "m-0 flex w-full items-center justify-start p-0 pl-2",
|
|
31
55
|
onClick: () => {
|
|
32
56
|
l || e.row.toggleSelected();
|
|
33
57
|
},
|
|
34
|
-
|
|
58
|
+
onMouseDown: s,
|
|
59
|
+
onMouseUp: s,
|
|
60
|
+
onKeyDown: (d) => {
|
|
61
|
+
l || i(d, () => e.row.toggleSelected());
|
|
62
|
+
},
|
|
63
|
+
children: /* @__PURE__ */ r(p, {
|
|
35
64
|
arrow: !0,
|
|
36
65
|
placement: "top-start",
|
|
37
66
|
title: e.row.getRowSelectionTooltip(),
|
|
38
|
-
children: /* @__PURE__ */
|
|
39
|
-
className: l ?
|
|
40
|
-
children: /* @__PURE__ */
|
|
67
|
+
children: /* @__PURE__ */ r("span", {
|
|
68
|
+
className: l ? m["cursor-not-allowed"] : void 0,
|
|
69
|
+
children: /* @__PURE__ */ r(n, {
|
|
41
70
|
size: "small",
|
|
42
71
|
dataTest: "cell-select",
|
|
72
|
+
"aria-hidden": !0,
|
|
73
|
+
tabIndex: -1,
|
|
43
74
|
checked: e.row.getIsSelected(),
|
|
44
75
|
hideWrapper: !0,
|
|
45
76
|
disabled: l,
|
|
46
|
-
|
|
47
|
-
o.preventDefault(), o.stopPropagation();
|
|
48
|
-
}
|
|
77
|
+
className: "pointer-events-none"
|
|
49
78
|
})
|
|
50
79
|
})
|
|
51
80
|
})
|
|
52
81
|
});
|
|
53
82
|
},
|
|
54
|
-
fixedLeft:
|
|
83
|
+
fixedLeft: t
|
|
55
84
|
};
|
|
56
85
|
}
|
|
57
86
|
export {
|
|
58
|
-
|
|
87
|
+
k as selectColumn
|
|
59
88
|
};
|
|
@@ -4,17 +4,17 @@ import { generateExpandColumn as h } from "../components/columns/expandColumn.js
|
|
|
4
4
|
import { generateActionsColumn as x } from "../components/columns/action-column/actionColumn.js";
|
|
5
5
|
import { generateDndHandleColumn as _ } from "../components/columns/dndHandleColumn.js";
|
|
6
6
|
import { generateShowFullTextColumn as A } from "../components/columns/showTextColumn.js";
|
|
7
|
-
var T = (
|
|
8
|
-
const { columns: o, actions: i, customActionsNode: r, headerPin: d = !0, enableRowSelection:
|
|
7
|
+
var T = (f) => {
|
|
8
|
+
const { columns: o, actions: i, customActionsNode: r, headerPin: d = !0, enableRowSelection: l, expandArrow: u, enableDnd: a, customDndColumnProps: c, rowHeight: e, textExpandArrow: m, customActionsColumnProps: p, rowActionsState: C, locale: s } = f, t = o.some((n) => n.fixedLeft === !0);
|
|
9
9
|
!o.find((n) => n.id === "actions") && (i || r || d) && o.push(x({
|
|
10
10
|
headerPin: d,
|
|
11
11
|
actions: i,
|
|
12
12
|
customActionsNode: r,
|
|
13
13
|
rowHeight: e,
|
|
14
|
-
customActionsColumnProps:
|
|
15
|
-
rowActionsState:
|
|
16
|
-
locale:
|
|
17
|
-
})), m && !o.find((n) => n.id === "show-full-text") && o.unshift(A(t, e)),
|
|
14
|
+
customActionsColumnProps: p,
|
|
15
|
+
rowActionsState: C,
|
|
16
|
+
locale: s
|
|
17
|
+
})), m && !o.find((n) => n.id === "show-full-text") && o.unshift(A(t, e)), u && !m && !o.find((n) => n.id === "expand-column-id") && o.unshift(h(t, e)), a && !o.find((n) => n.id === "dnd-handle") && o.unshift(_(c, e)), l && !o.find((n) => n.id === "select") && o.unshift(D(t, e, s));
|
|
18
18
|
};
|
|
19
19
|
export {
|
|
20
20
|
T as injectColumns
|