asma-ui-core 3.97.0 → 3.98.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/asma-ui-core.css +1 -1
- package/dist/components/custom/widget/widget-title/StyledWidgetTitle.js +7 -7
- package/dist/components/custom/widget/widget-title/StyledWidgetTitle.module.js +1 -1
- package/dist/components/inputs/phone-field/StyledPhoneField.js +27 -26
- package/dist/src/components/custom/widget/widget-title/StyledWidgetTitle.d.ts +2 -1
- package/dist/src/table/types.d.ts +7 -0
- package/dist/table/components/StyledTable.module.js +53 -53
- package/dist/table/components/TableRow.js +66 -65
- package/dist/table/components/table-footer/TablePagination.js +21 -19
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { cn as i } from "../../../../helpers/cn.js";
|
|
2
|
-
import
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { jsx as
|
|
5
|
-
var
|
|
6
|
-
return /* @__PURE__ */
|
|
2
|
+
import l from "./StyledWidgetTitle.module.js";
|
|
3
|
+
import { forwardRef as r } from "react";
|
|
4
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
5
|
+
var c = r(function(e, t) {
|
|
6
|
+
return /* @__PURE__ */ d(e.component ?? "h2", {
|
|
7
7
|
ref: t,
|
|
8
|
-
className: i(
|
|
8
|
+
className: i(l["styled-widget-title"], e.className),
|
|
9
9
|
children: e.children
|
|
10
10
|
});
|
|
11
11
|
});
|
|
12
12
|
export {
|
|
13
|
-
|
|
13
|
+
c as StyledWidgetTitle
|
|
14
14
|
};
|
|
@@ -3,66 +3,67 @@ import { StyledInputField as M } from "../input-field/StyledInputField.js";
|
|
|
3
3
|
import { StyledLink as V } from "../../navigation/link/StyledLink.js";
|
|
4
4
|
import { CountryCodeSelect as W } from "./CountryCodeSelect.js";
|
|
5
5
|
import { useId as z } from "react";
|
|
6
|
-
import { jsx as t, jsxs as
|
|
7
|
-
var E = (e) => e.replace(/\D/g, ""), U = ({ dataTest: e, label: l, countries: h, country: n, onCountryChange: x, value: s, onChange: f, onBlur:
|
|
8
|
-
const B = z(), a = j ?? `${B}-phone`,
|
|
9
|
-
return /* @__PURE__ */
|
|
6
|
+
import { jsx as t, jsxs as d } from "react/jsx-runtime";
|
|
7
|
+
var E = (e) => e.replace(/\D/g, ""), U = ({ dataTest: e, label: l, countries: h, country: n, onCountryChange: x, value: s, onChange: f, onBlur: v, error: y, helperText: N, reserveHelperText: b = !0, disabled: i, readOnly: g, readOnlyText: m, readOnlyHref: c, required: p, placeholder: $, formatNationalNumber: I, renderFlag: C, selectCountryLabel: S, searchPlaceholder: F, id: j, name: P, size: k = "medium", fieldClassName: u, helperTextClassName: w, className: A }) => {
|
|
8
|
+
const B = z(), a = j ?? `${B}-phone`, o = `${a}-label`, r = I?.(s, n) ?? s;
|
|
9
|
+
return /* @__PURE__ */ d("div", {
|
|
10
10
|
className: L("flex flex-col", A),
|
|
11
11
|
"data-testid": `${e}-root`,
|
|
12
|
-
children: [l != null && /* @__PURE__ */
|
|
13
|
-
id:
|
|
12
|
+
children: [l != null && /* @__PURE__ */ d("label", {
|
|
13
|
+
id: o,
|
|
14
14
|
htmlFor: a,
|
|
15
15
|
className: "pb-1 text-base font-semibold text-delta-800",
|
|
16
|
-
children: [l,
|
|
16
|
+
children: [l, p === !0 && /* @__PURE__ */ t("span", {
|
|
17
17
|
"aria-hidden": "true",
|
|
18
18
|
children: " *"
|
|
19
19
|
})]
|
|
20
|
-
}),
|
|
20
|
+
}), g === !0 ? /* @__PURE__ */ t("span", {
|
|
21
21
|
className: "py-2 text-base text-delta-800",
|
|
22
|
-
children:
|
|
22
|
+
children: c === void 0 ? /* @__PURE__ */ t("span", {
|
|
23
23
|
"data-testid": `${e}-readonly`,
|
|
24
|
-
children:
|
|
24
|
+
children: m ?? r
|
|
25
25
|
}) : /* @__PURE__ */ t(V, {
|
|
26
26
|
dataTest: `${e}-readonly`,
|
|
27
|
-
href:
|
|
27
|
+
href: c,
|
|
28
28
|
className: "-ml-1",
|
|
29
|
-
contentNode:
|
|
29
|
+
contentNode: m ?? r
|
|
30
30
|
})
|
|
31
|
-
}) : /* @__PURE__ */
|
|
31
|
+
}) : /* @__PURE__ */ d("div", {
|
|
32
32
|
className: "flex items-start gap-2.5",
|
|
33
33
|
children: [/* @__PURE__ */ t(W, {
|
|
34
34
|
dataTest: `${e}-country`,
|
|
35
35
|
countries: h,
|
|
36
36
|
value: n,
|
|
37
37
|
onChange: x,
|
|
38
|
-
disabled:
|
|
38
|
+
disabled: i,
|
|
39
39
|
selectCountryLabel: S,
|
|
40
40
|
searchPlaceholder: F,
|
|
41
41
|
renderFlag: C,
|
|
42
|
-
labelledBy: l == null ? void 0 :
|
|
43
|
-
className:
|
|
42
|
+
labelledBy: l == null ? void 0 : o,
|
|
43
|
+
className: u
|
|
44
44
|
}), /* @__PURE__ */ t(M, {
|
|
45
45
|
dataTest: `${e}-number`,
|
|
46
46
|
className: "max-w-[200px]",
|
|
47
47
|
id: a,
|
|
48
48
|
name: P,
|
|
49
|
-
value:
|
|
49
|
+
value: r,
|
|
50
50
|
onChange: (D) => f(E(D.target.value)),
|
|
51
|
-
onBlur:
|
|
52
|
-
placeholder:
|
|
53
|
-
error:
|
|
54
|
-
disabled:
|
|
55
|
-
required:
|
|
51
|
+
onBlur: v,
|
|
52
|
+
placeholder: $,
|
|
53
|
+
error: y,
|
|
54
|
+
disabled: i,
|
|
55
|
+
required: p,
|
|
56
56
|
fullWidth: !0,
|
|
57
|
-
helperText:
|
|
58
|
-
reserveHelperText:
|
|
57
|
+
helperText: N,
|
|
58
|
+
reserveHelperText: b,
|
|
59
59
|
size: k,
|
|
60
60
|
slotProps: {
|
|
61
61
|
htmlInput: {
|
|
62
62
|
inputMode: "tel",
|
|
63
|
-
autoComplete: "tel"
|
|
63
|
+
autoComplete: "tel",
|
|
64
|
+
"aria-labelledby": l == null ? void 0 : o
|
|
64
65
|
},
|
|
65
|
-
input: { className:
|
|
66
|
+
input: { className: u },
|
|
66
67
|
formHelperText: { className: w }
|
|
67
68
|
}
|
|
68
69
|
})]
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export declare const StyledWidgetTitle: import('react').ForwardRefExoticComponent<{
|
|
6
6
|
className?: string;
|
|
7
|
+
component?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
|
|
7
8
|
} & {
|
|
8
9
|
children?: import('react').ReactNode | undefined;
|
|
9
|
-
} & import('react').RefAttributes<
|
|
10
|
+
} & import('react').RefAttributes<HTMLHeadingElement>>;
|
|
@@ -92,6 +92,13 @@ export type StyledTableProps<TData, TCustomData> = {
|
|
|
92
92
|
focusable?: boolean;
|
|
93
93
|
stickyHeader?: boolean;
|
|
94
94
|
getRowClassName?: (row: Row<TData>) => string;
|
|
95
|
+
/**
|
|
96
|
+
* The row the user is working with — e.g. the one whose preview is open beside the table — matched
|
|
97
|
+
* against `row.id`. Drawn in the Figma table-row **Focused** state (the 3px focus frame keyboard
|
|
98
|
+
* focus draws; with a ticked row, "Selected + focused"), and it stays drawn after focus moves on,
|
|
99
|
+
* which `:focus-visible` alone cannot do. Opt-in: tables that do not pass it are unchanged.
|
|
100
|
+
*/
|
|
101
|
+
activeRowId?: string | null;
|
|
95
102
|
onRowClick?: (e: MouseEvent<HTMLTableRowElement, globalThis.MouseEvent> | React.KeyboardEvent<HTMLTableRowElement>, row: Row<TData>) => void;
|
|
96
103
|
renderSubRows?: (props: {
|
|
97
104
|
rows: TCustomData[];
|
|
@@ -1,57 +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-content": "_table-
|
|
13
|
-
"table-header--sticky": "_table-header--
|
|
14
|
-
"table-hscroll": "_table-
|
|
15
|
-
"table-hscroll__content": "_table-
|
|
16
|
-
"no-rows-overlay-container": "_no-rows-overlay-
|
|
17
|
-
"no-rows-overlay-content": "_no-rows-overlay-
|
|
18
|
-
"styled-table": "_styled-
|
|
19
|
-
tbody:
|
|
20
|
-
"loading-icon": "_loading-
|
|
21
|
-
"t-row": "_t-
|
|
22
|
-
"t-cell": "_t-
|
|
23
|
-
"action-cell": "_action-
|
|
24
|
-
"fixed-cell": "_fixed-
|
|
25
|
-
"fixed-right-cell": "_fixed-right-
|
|
26
|
-
expanded_row:
|
|
1
|
+
var e = "_tbody_ewknl_124", l = "_expanded_row_ewknl_174", _ = "_selected_ewknl_192", t = "_shadowed_ewknl_217", a = "_resizer_ewknl_274", n = "_isResizing_ewknl_286", o = {
|
|
2
|
+
"asma-ui-table-styled-table": "_asma-ui-table-styled-table_ewknl_1",
|
|
3
|
+
"table-wrapper": "_table-wrapper_ewknl_26",
|
|
4
|
+
"table-shell": "_table-shell_ewknl_33",
|
|
5
|
+
"table-wrapper--no-rows": "_table-wrapper--no-rows_ewknl_39",
|
|
6
|
+
"table-wrapper--proxy": "_table-wrapper--proxy_ewknl_42",
|
|
7
|
+
"table-wrapper--proxy-bottom": "_table-wrapper--proxy-bottom_ewknl_43",
|
|
8
|
+
"table-wrapper-fetching": "_table-wrapper-fetching_ewknl_53",
|
|
9
|
+
"table-scroll": "_table-scroll_ewknl_56",
|
|
10
|
+
"table-x--fill-height": "_table-x--fill-height_ewknl_65",
|
|
11
|
+
"table-x": "_table-x_ewknl_65",
|
|
12
|
+
"table-content": "_table-content_ewknl_80",
|
|
13
|
+
"table-header--sticky": "_table-header--sticky_ewknl_85",
|
|
14
|
+
"table-hscroll": "_table-hscroll_ewknl_90",
|
|
15
|
+
"table-hscroll__content": "_table-hscroll__content_ewknl_100",
|
|
16
|
+
"no-rows-overlay-container": "_no-rows-overlay-container_ewknl_103",
|
|
17
|
+
"no-rows-overlay-content": "_no-rows-overlay-content_ewknl_111",
|
|
18
|
+
"styled-table": "_styled-table_ewknl_115",
|
|
19
|
+
tbody: e,
|
|
20
|
+
"loading-icon": "_loading-icon_ewknl_129",
|
|
21
|
+
"t-row": "_t-row_ewknl_136",
|
|
22
|
+
"t-cell": "_t-cell_ewknl_136",
|
|
23
|
+
"action-cell": "_action-cell_ewknl_146",
|
|
24
|
+
"fixed-cell": "_fixed-cell_ewknl_150",
|
|
25
|
+
"fixed-right-cell": "_fixed-right-cell_ewknl_153",
|
|
26
|
+
expanded_row: l,
|
|
27
27
|
selected: _,
|
|
28
|
-
"single-selection": "_single-
|
|
29
|
-
"action-cell--no-shadow": "_action-cell--no-
|
|
30
|
-
shadowed:
|
|
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-
|
|
37
|
-
resizer:
|
|
38
|
-
isResizing:
|
|
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__fixed": "_t-
|
|
46
|
-
"t-cell__fixed-right": "_t-cell__fixed-
|
|
47
|
-
"sort-icon": "_sort-
|
|
48
|
-
"header-content": "_header-
|
|
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-
|
|
54
|
-
"select-control": "_select-
|
|
28
|
+
"single-selection": "_single-selection_ewknl_195",
|
|
29
|
+
"action-cell--no-shadow": "_action-cell--no-shadow_ewknl_213",
|
|
30
|
+
shadowed: t,
|
|
31
|
+
"shadowed-right": "_shadowed-right_ewknl_253",
|
|
32
|
+
"is-loading": "_is-loading_ewknl_258",
|
|
33
|
+
"action-cell-default-background": "_action-cell-default-background_ewknl_261",
|
|
34
|
+
"fixed-cell-default-background": "_fixed-cell-default-background_ewknl_264",
|
|
35
|
+
"fixed-right-cell-default-background": "_fixed-right-cell-default-background_ewknl_267",
|
|
36
|
+
"sortable-column": "_sortable-column_ewknl_270",
|
|
37
|
+
resizer: a,
|
|
38
|
+
isResizing: n,
|
|
39
|
+
"hide-table-header": "_hide-table-header_ewknl_298",
|
|
40
|
+
"show-table-header": "_show-table-header_ewknl_302",
|
|
41
|
+
"table-header": "_table-header_ewknl_85",
|
|
42
|
+
"hide-header": "_hide-header_ewknl_338",
|
|
43
|
+
"t-cell__actions": "_t-cell__actions_ewknl_341",
|
|
44
|
+
"t-cell__actions--no-shadow": "_t-cell__actions--no-shadow_ewknl_350",
|
|
45
|
+
"t-cell__fixed": "_t-cell__fixed_ewknl_355",
|
|
46
|
+
"t-cell__fixed-right": "_t-cell__fixed-right_ewknl_363",
|
|
47
|
+
"sort-icon": "_sort-icon_ewknl_371",
|
|
48
|
+
"header-content": "_header-content_ewknl_375",
|
|
49
|
+
"table-footer--sticky": "_table-footer--sticky_ewknl_409",
|
|
50
|
+
"table-footer--inline": "_table-footer--inline_ewknl_420",
|
|
51
|
+
"table-bottom": "_table-bottom_ewknl_431",
|
|
52
|
+
"table-bottom--sticky": "_table-bottom--sticky_ewknl_445",
|
|
53
|
+
"cursor-not-allowed": "_cursor-not-allowed_ewknl_449",
|
|
54
|
+
"select-control": "_select-control_ewknl_453"
|
|
55
55
|
};
|
|
56
56
|
export {
|
|
57
57
|
o as default
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import { ACTIONS_COLUMN_ID as
|
|
2
|
-
import { useRootContext as
|
|
1
|
+
import { ACTIONS_COLUMN_ID as q } from "../types.js";
|
|
2
|
+
import { useRootContext as pe } from "../context/RootContext.js";
|
|
3
3
|
import n from "./StyledTable.module.js";
|
|
4
|
-
import { compact as
|
|
5
|
-
import
|
|
6
|
-
import { Fragment as
|
|
7
|
-
import { Fragment as
|
|
8
|
-
import { useSortable as
|
|
9
|
-
import { flexRender as
|
|
10
|
-
import { CSS as
|
|
11
|
-
var
|
|
4
|
+
import { compact as xe } from "../../helpers/arrays.js";
|
|
5
|
+
import K from "clsx";
|
|
6
|
+
import { Fragment as be, useCallback as G, useEffect as Ce, useLayoutEffect as Re, useMemo as m, useRef as Se, useState as De } from "react";
|
|
7
|
+
import { Fragment as ve, jsx as s, jsxs as C } from "react/jsx-runtime";
|
|
8
|
+
import { useSortable as ye } from "@dnd-kit/sortable";
|
|
9
|
+
import { flexRender as Ne } from "@tanstack/react-table";
|
|
10
|
+
import { CSS as Fe } from "@dnd-kit/utilities";
|
|
11
|
+
var ke = (R) => {
|
|
12
12
|
const t = R.closest("table");
|
|
13
13
|
if (!t) return !1;
|
|
14
14
|
const r = Array.from(document.querySelectorAll('a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])')).find((g) => !t.contains(g) && !!(t.compareDocumentPosition(g) & Node.DOCUMENT_POSITION_FOLLOWING));
|
|
15
15
|
return r ? (r.focus(), document.activeElement === r) : !1;
|
|
16
16
|
};
|
|
17
|
-
function
|
|
18
|
-
const { loading:
|
|
17
|
+
function We({ styledTableProps: R, row: t, index: r, hasFocusedRow: g, columnWindow: { paddingLeft: h, paddingRight: p, indexes: T } }) {
|
|
18
|
+
const { loading: V, getRowClassName: l, activeRowId: w, rowHeight: x, onRowClick: S, expandArrow: Y, enableDnd: A, disableDndForRow: J, tdClassName: B, customSubRowData: L, renderSubRows: Q, defaultExpanded: X, actions: D, customActionsNode: Z, textExpandArrow: M, enableMultiRowSelection: ee, enableRowSelection: te, singleSelectionRow: ne } = R, v = J?.(t), { transform: ie, transition: oe, setNodeRef: H, isDragging: O } = ye({
|
|
19
19
|
id: t.original.id,
|
|
20
|
-
disabled: !
|
|
21
|
-
}),
|
|
22
|
-
transform:
|
|
20
|
+
disabled: !A || v
|
|
21
|
+
}), se = {
|
|
22
|
+
transform: Fe.Transform.toString(ie),
|
|
23
23
|
transition: oe,
|
|
24
|
-
opacity:
|
|
25
|
-
zIndex:
|
|
24
|
+
opacity: O ? 0.8 : 1,
|
|
25
|
+
zIndex: O ? 1 : 0,
|
|
26
26
|
position: "relative"
|
|
27
|
-
}, { isResizing:
|
|
28
|
-
|
|
29
|
-
!y && b.current &&
|
|
27
|
+
}, { isResizing: le, disableResizingFlag: ae } = pe(), y = t.isExpanded(), b = Se(null), [ce, de] = De(void 0);
|
|
28
|
+
Re(() => {
|
|
29
|
+
!y && b.current && de(b.current.cells[0]?.clientHeight ?? b.current.offsetHeight);
|
|
30
30
|
}, [y]);
|
|
31
|
-
const
|
|
32
|
-
b.current = e, v ||
|
|
33
|
-
}, [v,
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
const re = G((e) => {
|
|
32
|
+
b.current = e, v || H(e);
|
|
33
|
+
}, [v, H]), U = y ? ce ?? x : x;
|
|
34
|
+
Ce(() => {
|
|
35
|
+
X && t.getCanExpand() && !t.getIsExpanded() && t.toggleExpand();
|
|
36
36
|
}, []);
|
|
37
|
-
const
|
|
38
|
-
t.getCanExpand() && !
|
|
39
|
-
const
|
|
40
|
-
!
|
|
41
|
-
}, re = (e) => {
|
|
42
|
-
e.target.classList.contains("MuiModal-backdrop") || e.target.nodeName === "INPUT" || e.target.nodeName === "BUTTON" || e.target.nodeName === "LI" || e.target.closest("li") || U(e);
|
|
37
|
+
const W = (e) => {
|
|
38
|
+
t.getCanExpand() && !Y && t.getToggleExpandedHandler()(), document.getElementById(t.id)?.focus();
|
|
39
|
+
const i = window.getSelection()?.type !== "Range" && !le, o = S instanceof Function;
|
|
40
|
+
!o && M && i ? t.toggleExpand() : o && i && S(e, t), ae();
|
|
43
41
|
}, ue = (e) => {
|
|
42
|
+
e.target.classList.contains("MuiModal-backdrop") || e.target.nodeName === "INPUT" || e.target.nodeName === "BUTTON" || e.target.nodeName === "LI" || e.target.closest("li") || W(e);
|
|
43
|
+
}, fe = (e) => {
|
|
44
44
|
if (e.target === e.currentTarget)
|
|
45
45
|
switch (e.key) {
|
|
46
46
|
case "Tab":
|
|
@@ -49,9 +49,9 @@ function Ue({ styledTableProps: R, row: t, index: r, hasFocusedRow: g, columnWin
|
|
|
49
49
|
e.preventDefault();
|
|
50
50
|
break;
|
|
51
51
|
}
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
} else (t.focusNextRow() ||
|
|
52
|
+
const i = e.currentTarget.closest("table")?.querySelector('thead tr[tabindex="0"]');
|
|
53
|
+
i && (e.preventDefault(), i.focus());
|
|
54
|
+
} else (t.focusNextRow() || ke(e.currentTarget)) && e.preventDefault();
|
|
55
55
|
break;
|
|
56
56
|
case "ArrowDown":
|
|
57
57
|
t.focusNextRow() && e.preventDefault();
|
|
@@ -60,29 +60,29 @@ function Ue({ styledTableProps: R, row: t, index: r, hasFocusedRow: g, columnWin
|
|
|
60
60
|
t.focusPrevRow() && e.preventDefault();
|
|
61
61
|
break;
|
|
62
62
|
case "Enter":
|
|
63
|
-
e.preventDefault(),
|
|
63
|
+
e.preventDefault(), W(e);
|
|
64
64
|
break;
|
|
65
65
|
}
|
|
66
|
-
}, u = t.getVisibleCells().map((e,
|
|
66
|
+
}, u = t.getVisibleCells().map((e, i, o) => ({
|
|
67
67
|
...e,
|
|
68
|
-
left:
|
|
69
|
-
})),
|
|
68
|
+
left: o.slice(0, i).reduce((c, d) => c + (d.column.getSize() ?? 0), 0)
|
|
69
|
+
})), _ = m(() => u.filter((e) => !e.column.columnDef.fixedLeft && !e.column.columnDef.fixedRight && e.column.id !== "actions"), [u]), a = m(() => u.filter((e) => !!e.column.columnDef.fixedRight || e.column.id === "actions").map((e, i, o) => ({
|
|
70
70
|
...e,
|
|
71
|
-
right:
|
|
72
|
-
})), [u]),
|
|
73
|
-
const
|
|
71
|
+
right: o.slice(i + 1).reduce((c, d) => c + (d.column.getSize() ?? 0), 0)
|
|
72
|
+
})), [u]), z = m(() => a.some((e) => e.column.id === q), [a]), P = !!D || !!Z, $ = m(() => a.some((e) => !!e.column.columnDef.fixedRight), [a]), f = m(() => u.filter((e) => e.column.columnDef.fixedLeft), [u]), N = !ee && !te && ne, F = t.getIsSelected() && N, k = S instanceof Function, j = T.length > 0 ? xe(T.map((e) => _[e])) : _, E = G((e, i) => {
|
|
73
|
+
const o = e.column.id === q, c = e.column.columnDef.fixedLeft, d = !!e.column.columnDef.fixedRight, me = e.id === f.at(-1)?.id, ge = e.id === a.at(0)?.id && !o, he = t.isExpanded(), I = i === 0;
|
|
74
74
|
return /* @__PURE__ */ s("td", {
|
|
75
|
-
className:
|
|
75
|
+
className: K(n["t-cell"], k && "cursor-pointer", B, o && n["action-cell"], o && (!P || $) && n["action-cell--no-shadow"], o && !!D && f.length && n.shadowed, o && (l?.(t) ? l?.(t) : n["action-cell-default-background"]), c && n["fixed-cell"], d && n["fixed-right-cell"], me && n.shadowed, ge && n["shadowed-right"], t.getIsSelected() && n.selected, c && (l?.(t) ? l?.(t) : n["fixed-cell-default-background"]), d && (l?.(t) ? l?.(t) : n["fixed-right-cell-default-background"]), he && n.expanded_row, !!F && n["single-selection"]),
|
|
76
76
|
style: {
|
|
77
77
|
left: c ? e.left : void 0,
|
|
78
|
-
right: d ? e.right + (
|
|
78
|
+
right: d ? e.right + (z ? -1 : 0) : void 0
|
|
79
79
|
},
|
|
80
80
|
children: /* @__PURE__ */ C("div", {
|
|
81
81
|
style: {
|
|
82
82
|
display: "flex",
|
|
83
83
|
alignItems: "center",
|
|
84
84
|
minWidth: I ? 32 : void 0,
|
|
85
|
-
minHeight:
|
|
85
|
+
minHeight: U,
|
|
86
86
|
position: "relative"
|
|
87
87
|
},
|
|
88
88
|
children: [I && F && /* @__PURE__ */ s("span", {
|
|
@@ -94,53 +94,54 @@ function Ue({ styledTableProps: R, row: t, index: r, hasFocusedRow: g, columnWin
|
|
|
94
94
|
top: "50%",
|
|
95
95
|
transform: "translateY(-50%)"
|
|
96
96
|
},
|
|
97
|
-
children: /* @__PURE__ */ s(
|
|
97
|
+
children: /* @__PURE__ */ s(Ee, {})
|
|
98
98
|
}), /* @__PURE__ */ s("span", {
|
|
99
99
|
style: {
|
|
100
100
|
marginLeft: I && N ? 30 : 0,
|
|
101
101
|
width: "100%"
|
|
102
102
|
},
|
|
103
|
-
children:
|
|
103
|
+
children: Ne(e.column.columnDef.cell, e.getContext())
|
|
104
104
|
})]
|
|
105
105
|
})
|
|
106
106
|
}, e.id);
|
|
107
107
|
}, [
|
|
108
108
|
F,
|
|
109
109
|
D,
|
|
110
|
-
|
|
110
|
+
U,
|
|
111
111
|
l,
|
|
112
112
|
k,
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
z,
|
|
114
|
+
$,
|
|
115
115
|
f,
|
|
116
116
|
a,
|
|
117
117
|
t,
|
|
118
|
-
|
|
118
|
+
P,
|
|
119
119
|
N,
|
|
120
|
-
|
|
120
|
+
B
|
|
121
121
|
]);
|
|
122
|
-
return /* @__PURE__ */ C(
|
|
122
|
+
return /* @__PURE__ */ C(be, { children: [/* @__PURE__ */ C("tr", {
|
|
123
123
|
"aria-selected": t.getIsSelected() || t.isFocused() ? "true" : "false",
|
|
124
124
|
tabIndex: t.isFocused() || r === 0 && !g ? 0 : -1,
|
|
125
125
|
"data-index": r,
|
|
126
126
|
"data-test": t.id,
|
|
127
|
+
"data-active": w != null && t.id === w ? "true" : void 0,
|
|
127
128
|
id: t.id,
|
|
128
|
-
className:
|
|
129
|
+
className: K(n["t-row"], V && n["is-loading"], l?.(t)),
|
|
129
130
|
style: {
|
|
130
131
|
height: x ? `${x}px` : "inherit",
|
|
131
|
-
...
|
|
132
|
+
...A && se
|
|
132
133
|
},
|
|
133
|
-
ref:
|
|
134
|
+
ref: re,
|
|
134
135
|
onFocus: (e) => {
|
|
135
136
|
e.target === e.currentTarget && !t.isFocused() && t.onChangeFocused(!0);
|
|
136
137
|
},
|
|
137
|
-
onMouseUp:
|
|
138
|
+
onMouseUp: ue,
|
|
138
139
|
onMouseDown: (e) => {
|
|
139
|
-
e.detail > 1 && !k &&
|
|
140
|
+
e.detail > 1 && !k && M && e.preventDefault();
|
|
140
141
|
},
|
|
141
|
-
onKeyDownCapture:
|
|
142
|
+
onKeyDownCapture: fe,
|
|
142
143
|
children: [
|
|
143
|
-
f.map((e,
|
|
144
|
+
f.map((e, i) => E(e, i)),
|
|
144
145
|
h > 0 && /* @__PURE__ */ s("td", {
|
|
145
146
|
"aria-hidden": !0,
|
|
146
147
|
className: n["t-cell"],
|
|
@@ -152,7 +153,7 @@ function Ue({ styledTableProps: R, row: t, index: r, hasFocusedRow: g, columnWin
|
|
|
152
153
|
border: "none"
|
|
153
154
|
}
|
|
154
155
|
}),
|
|
155
|
-
|
|
156
|
+
j.map((e, i) => E(e, f.length + i)),
|
|
156
157
|
p > 0 && /* @__PURE__ */ s("td", {
|
|
157
158
|
"aria-hidden": !0,
|
|
158
159
|
className: n["t-cell"],
|
|
@@ -164,14 +165,14 @@ function Ue({ styledTableProps: R, row: t, index: r, hasFocusedRow: g, columnWin
|
|
|
164
165
|
border: "none"
|
|
165
166
|
}
|
|
166
167
|
}),
|
|
167
|
-
a.map((e,
|
|
168
|
+
a.map((e, i) => E(e, f.length + j.length + i))
|
|
168
169
|
]
|
|
169
|
-
}), t.getIsExpanded() && /* @__PURE__ */ s(
|
|
170
|
-
rows:
|
|
170
|
+
}), t.getIsExpanded() && /* @__PURE__ */ s(ve, { children: L && Q?.({
|
|
171
|
+
rows: L.get(t.original.id.toString()) ?? [],
|
|
171
172
|
row: t.original
|
|
172
173
|
}) })] }, t.id);
|
|
173
174
|
}
|
|
174
|
-
var
|
|
175
|
+
var Ee = () => /* @__PURE__ */ C("svg", {
|
|
175
176
|
xmlns: "http://www.w3.org/2000/svg",
|
|
176
177
|
width: "20",
|
|
177
178
|
height: "20",
|
|
@@ -183,5 +184,5 @@ var ke = () => /* @__PURE__ */ C("svg", {
|
|
|
183
184
|
})]
|
|
184
185
|
});
|
|
185
186
|
export {
|
|
186
|
-
|
|
187
|
+
We as TableRow
|
|
187
188
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { ChevronRightIcon as
|
|
1
|
+
import { ChevronRightIcon as $ } from "../../../components/icons/chevron-right-icon/ChevronRightIcon.js";
|
|
2
2
|
import { ChevronLeftIcon as O } from "../../../components/icons/chevron-left-icon/ChevronLeftIcon.js";
|
|
3
3
|
import { StyledPopover as k } from "../../../components/utils/popover/StyledPopover.js";
|
|
4
4
|
import { StyledMenuList as z } from "../../../components/navigation/menu/StyledMenuList.js";
|
|
5
5
|
import { StyledSelectItem as D } from "../../../components/inputs/select/StyledSelectItem.js";
|
|
6
|
-
import
|
|
7
|
-
import { StyledTooltip as
|
|
8
|
-
import { ChevronDownIcon as
|
|
9
|
-
import { useKeyboardSelectMenu as
|
|
6
|
+
import h from "../StyledTable.module.js";
|
|
7
|
+
import { StyledTooltip as m } from "../../shared-components/tooltip/index.js";
|
|
8
|
+
import { ChevronDownIcon as F } from "../../shared-components/ChevronDownIcon.js";
|
|
9
|
+
import { useKeyboardSelectMenu as L } from "../../hooks/useToggleMenuVisibility.hook.js";
|
|
10
10
|
import { StyledButton as u } from "../../shared-components/button/StyledButton.js";
|
|
11
|
-
import { useCallback as I, useId as
|
|
11
|
+
import { useCallback as I, useId as R, useMemo as S, useRef as K } from "react";
|
|
12
12
|
import { Fragment as M, jsx as e, jsxs as f } from "react/jsx-runtime";
|
|
13
13
|
function U({ table: o, locale: y }) {
|
|
14
|
-
const v = K(null), r = y === "no", a =
|
|
14
|
+
const v = K(null), r = y === "no", a = R(), b = S(() => ({
|
|
15
15
|
anchorOrigin: {
|
|
16
16
|
vertical: -5,
|
|
17
17
|
horizontal: "center"
|
|
@@ -21,20 +21,20 @@ function U({ table: o, locale: y }) {
|
|
|
21
21
|
horizontal: "center"
|
|
22
22
|
}
|
|
23
23
|
}), []), l = I(() => {
|
|
24
|
-
const t =
|
|
24
|
+
const t = h["asma-ui-table-styled-table"], n = v.current?.closest(`.${t}`)?.querySelector(`.${h["table-scroll"]}, .${h["table-wrapper"]}`);
|
|
25
25
|
n && n.scrollTo({
|
|
26
26
|
top: 0,
|
|
27
27
|
behavior: "smooth"
|
|
28
28
|
});
|
|
29
29
|
}, []), s = o.getPageCount() || 1, i = o.getState().pagination.pageIndex + 1, c = S(() => Array.from({ length: s }, (t, n) => n + 1), [s]), P = I((t) => {
|
|
30
30
|
o.setPageIndex(t - 1), l();
|
|
31
|
-
}, [o, l]), { anchorEl: g, open: d, handleClose: x, handleOpen:
|
|
31
|
+
}, [o, l]), { anchorEl: g, open: d, handleClose: x, handleOpen: N, triggerRef: T, activeIndex: p, handleKeyDown: w } = L({
|
|
32
32
|
optionCount: c.length,
|
|
33
33
|
selectedIndex: i - 1,
|
|
34
34
|
onSelect: (t) => P(c[t])
|
|
35
35
|
});
|
|
36
36
|
return /* @__PURE__ */ f(M, { children: [
|
|
37
|
-
/* @__PURE__ */ e(
|
|
37
|
+
/* @__PURE__ */ e(m, {
|
|
38
38
|
title: r ? "Nåværende side" : "Current Page",
|
|
39
39
|
children: /* @__PURE__ */ e("div", {
|
|
40
40
|
ref: v,
|
|
@@ -42,15 +42,15 @@ function U({ table: o, locale: y }) {
|
|
|
42
42
|
dataTest: "current-page-button",
|
|
43
43
|
variant: "outlined",
|
|
44
44
|
size: "large",
|
|
45
|
-
refLink:
|
|
46
|
-
onClick:
|
|
47
|
-
onKeyDown:
|
|
45
|
+
refLink: T,
|
|
46
|
+
onClick: N,
|
|
47
|
+
onKeyDown: w,
|
|
48
48
|
role: "combobox",
|
|
49
49
|
"aria-haspopup": "listbox",
|
|
50
50
|
"aria-controls": d ? a : void 0,
|
|
51
51
|
"aria-expanded": d,
|
|
52
|
-
"aria-activedescendant":
|
|
53
|
-
endIcon: /* @__PURE__ */ e(
|
|
52
|
+
"aria-activedescendant": p === null ? void 0 : `${a}-option-${p}`,
|
|
53
|
+
endIcon: /* @__PURE__ */ e(F, {
|
|
54
54
|
className: `${d ? "flip-180" : "rotate-0"} transition-transform duration-300`,
|
|
55
55
|
height: 24,
|
|
56
56
|
width: 24
|
|
@@ -87,7 +87,7 @@ function U({ table: o, locale: y }) {
|
|
|
87
87
|
role: "listbox",
|
|
88
88
|
children: c.map((t, n) => /* @__PURE__ */ e(D, {
|
|
89
89
|
id: `${a}-option-${n}`,
|
|
90
|
-
active: n ===
|
|
90
|
+
active: n === p,
|
|
91
91
|
onClick: (C) => {
|
|
92
92
|
C.stopPropagation(), C.preventDefault(), P(t), x();
|
|
93
93
|
},
|
|
@@ -103,7 +103,7 @@ function U({ table: o, locale: y }) {
|
|
|
103
103
|
}, t))
|
|
104
104
|
})
|
|
105
105
|
}),
|
|
106
|
-
/* @__PURE__ */ e(
|
|
106
|
+
/* @__PURE__ */ e(m, {
|
|
107
107
|
title: i === 1 ? "" : r ? "Forrige side" : "Previous Page",
|
|
108
108
|
children: /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(u, {
|
|
109
109
|
dataTest: "prev-page-button",
|
|
@@ -113,13 +113,14 @@ function U({ table: o, locale: y }) {
|
|
|
113
113
|
},
|
|
114
114
|
size: "large",
|
|
115
115
|
disabled: !o.getCanPreviousPage(),
|
|
116
|
+
"aria-label": r ? "Forrige side" : "Previous page",
|
|
116
117
|
startIcon: /* @__PURE__ */ e(O, {
|
|
117
118
|
height: 24,
|
|
118
119
|
width: 24
|
|
119
120
|
})
|
|
120
121
|
}) })
|
|
121
122
|
}),
|
|
122
|
-
/* @__PURE__ */ e(
|
|
123
|
+
/* @__PURE__ */ e(m, {
|
|
123
124
|
title: i === s ? "" : r ? "Neste side" : "Next Page",
|
|
124
125
|
children: /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(u, {
|
|
125
126
|
dataTest: "next-page-button",
|
|
@@ -129,7 +130,8 @@ function U({ table: o, locale: y }) {
|
|
|
129
130
|
},
|
|
130
131
|
size: "large",
|
|
131
132
|
disabled: !o.getCanNextPage(),
|
|
132
|
-
|
|
133
|
+
"aria-label": r ? "Neste side" : "Next page",
|
|
134
|
+
startIcon: /* @__PURE__ */ e($, {
|
|
133
135
|
height: 24,
|
|
134
136
|
width: 24
|
|
135
137
|
})
|