asma-ui-core 3.137.1 → 3.138.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/src/table/custom-features/order-columns/types.d.ts +1 -1
- package/dist/src/table/custom-features/order-columns/usePersistColumnOrder.d.ts +2 -1
- package/dist/src/table/hooks/usePersistedSorting.d.ts +25 -3
- package/dist/src/table/hooks/usePersistedStateWriter.d.ts +4 -0
- package/dist/src/table/hooks/useTranslations.d.ts +2 -2
- package/dist/src/table/types.d.ts +15 -4
- package/dist/table/components/columns/action-column/components/HeaderActionMenu.js +113 -96
- package/dist/table/components/columns/action-column/components/HeaderActionMenu.module.js +7 -5
- package/dist/table/custom-features/order-columns/usePersistColumnOrder.js +10 -10
- package/dist/table/hooks/useColumnLayoutPersistence.js +37 -37
- package/dist/table/hooks/usePersistedSorting.js +21 -20
- package/dist/table/hooks/usePersistedStateWriter.js +18 -18
- package/dist/table/hooks/useStyledTable.js +113 -108
- package/dist/table/hooks/useTranslations.js +2 -2
- package/package.json +1 -1
|
@@ -21,7 +21,7 @@ export interface ColumnLayoutDefaults {
|
|
|
21
21
|
export interface ColumnSettingsInstance {
|
|
22
22
|
/**
|
|
23
23
|
* Reset columns (ASMA-8597): puts the column order and the widths back to the table's defaults, and the
|
|
24
|
-
* sorting too when the table
|
|
24
|
+
* sorting too when the table saves it (a `uniqueKey`, unless `persistSorting={false}` or the app owns the sorting). It removes the saved entries of what it resets. On a table
|
|
25
25
|
* with `persistColumnLayout` (ASMA-8695, OQ-02) it also puts the visibility back to the default, unhiding what
|
|
26
26
|
* the user hid and hiding what is hidden by default; any other table never touches visibility. Set by
|
|
27
27
|
* `StyledTable`, which knows the defaults.
|
|
@@ -2,6 +2,7 @@ import { Table } from '@tanstack/react-table';
|
|
|
2
2
|
/**
|
|
3
3
|
* Saves the column order under `key` when it changes. An order that is `[]` or that matches the live
|
|
4
4
|
* definition order removes the entry instead (ASMA-8597, REQ-004), so a table the user has put back to its
|
|
5
|
-
* defaults stores nothing. Mounting never writes.
|
|
5
|
+
* defaults stores nothing. Mounting never writes. A table with no key does no work per render (ASMA-8698), and whether the
|
|
6
|
+
* order is the default is worked out only when it is about to be saved.
|
|
6
7
|
*/
|
|
7
8
|
export declare function usePersistColumnOrder<TData = unknown>(table: Table<TData>, key?: string | null): void;
|
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
import { OnChangeFn, SortingState } from '@tanstack/react-table';
|
|
2
2
|
export declare const getSortingStorageKey: (uniqueKey?: string) => string | undefined;
|
|
3
|
+
/** What decides whether `StyledTable` saves a table's sorting: the props that matter, read from the table's own. */
|
|
4
|
+
export interface SortingPersistenceInput {
|
|
5
|
+
uniqueKey?: string;
|
|
6
|
+
/** The `persistSorting` prop as the app wrote it; `undefined` when it did not. */
|
|
7
|
+
persistSorting?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* The app owns the sorting state: it passes `state.sorting`, or `onSortingChange`. TanStack hands every change to that
|
|
10
|
+
* handler instead of updating the table's own state, so a handler alone is as much the app's state as `state.sorting`.
|
|
11
|
+
*/
|
|
12
|
+
controlled: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Whether `StyledTable` reads and writes the sorting under `${uniqueKey}:sorting` (ASMA-8698, DEC-8698-OPTOUT).
|
|
16
|
+
*
|
|
17
|
+
* - No `uniqueKey`: never.
|
|
18
|
+
* - `persistSorting={false}`: never, the opt-out for tables whose order is the user's own (drag and drop).
|
|
19
|
+
* - `persistSorting={true}`: yes, even when the app owns the sorting state. That is how such an app lets `StyledTable` be the
|
|
20
|
+
* only writer of the sort it reads back with `usePersistedSorting`.
|
|
21
|
+
* - Not written: yes, unless the app owns the sorting state. A saved sort could not be applied to a state the table does not
|
|
22
|
+
* own, and an app that persists its own sort would have two writers fighting over it.
|
|
23
|
+
*/
|
|
24
|
+
export declare const savesSorting: ({ uniqueKey, persistSorting, controlled }: SortingPersistenceInput) => boolean;
|
|
3
25
|
/** What a saved sort is checked against: the columns that can sort, and the multi-sort rules. */
|
|
4
26
|
export interface SortingRules {
|
|
5
27
|
sortableColumns: readonly {
|
|
@@ -27,7 +49,7 @@ export interface PersistedSortingOptions {
|
|
|
27
49
|
maxMultiSortColCount?: number;
|
|
28
50
|
}
|
|
29
51
|
/**
|
|
30
|
-
* Reads the sorting `StyledTable` saved for `uniqueKey
|
|
52
|
+
* Reads the sorting `StyledTable` saved for `uniqueKey`, checked against the columns
|
|
31
53
|
* the caller can sort by. Synchronous and pure, so a table that owns its sorting state (for example because
|
|
32
54
|
* the server sorts) can use the saved sort for its first request. Returns `undefined` when nothing valid is
|
|
33
55
|
* saved, and `[]` when the user turned sorting off.
|
|
@@ -36,8 +58,8 @@ export declare const readPersistedSorting: (uniqueKey: string | undefined, optio
|
|
|
36
58
|
/**
|
|
37
59
|
* Sorting state for a table that owns `state.sorting`: the saved sort on the first render (before the first
|
|
38
60
|
* request), `defaultSorting` when nothing valid is saved, and the new key's sort after `uniqueKey` changes.
|
|
39
|
-
* It never writes: `StyledTable`
|
|
40
|
-
* from `initialState.sorting`, which Reset columns restores.
|
|
61
|
+
* It never writes: `StyledTable` is the only writer, and it saves a sort the app owns only with `persistSorting` written
|
|
62
|
+
* on the table (see `savesSorting`). It takes the same default from `initialState.sorting`, which Reset columns restores.
|
|
41
63
|
*
|
|
42
64
|
* ```tsx
|
|
43
65
|
* const { sorting, onSortingChange } = usePersistedSorting({ uniqueKey, defaultSorting, sortableColumnIds })
|
|
@@ -25,6 +25,10 @@ interface PersistedStateWriterOptions<T> {
|
|
|
25
25
|
* entry is never touched, so the old value can't be copied over the new key.
|
|
26
26
|
* - When the key goes away (`undefined`), the table goes back to the app's defaults and writes nothing, so
|
|
27
27
|
* one user's values are not left on screen for whoever is shown next.
|
|
28
|
+
*
|
|
29
|
+
* It costs a table that does not save the setting nothing per render (ASMA-8698): the value's signature is computed only
|
|
30
|
+
* while there is a key (the render that loses the key reads it in the layout effect), and the default's only when a write
|
|
31
|
+
* or a reset needs it.
|
|
28
32
|
*/
|
|
29
33
|
export declare const usePersistedStateWriter: <T>(options: PersistedStateWriterOptions<T>) => void;
|
|
30
34
|
export {};
|
|
@@ -2,7 +2,7 @@ declare const translations: {
|
|
|
2
2
|
en: {
|
|
3
3
|
column_reorder: string;
|
|
4
4
|
column_hidden: string;
|
|
5
|
-
|
|
5
|
+
column_unhideable: string;
|
|
6
6
|
reset_columns: string;
|
|
7
7
|
columns_reset: string;
|
|
8
8
|
column_settings: string;
|
|
@@ -11,7 +11,7 @@ declare const translations: {
|
|
|
11
11
|
no: {
|
|
12
12
|
column_reorder: string;
|
|
13
13
|
column_hidden: string;
|
|
14
|
-
|
|
14
|
+
column_unhideable: string;
|
|
15
15
|
reset_columns: string;
|
|
16
16
|
columns_reset: string;
|
|
17
17
|
column_settings: string;
|
|
@@ -158,10 +158,21 @@ export type StyledTableProps<TData, TCustomData> = {
|
|
|
158
158
|
*/
|
|
159
159
|
uniqueKey?: string;
|
|
160
160
|
/**
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
161
|
+
* Whether the table saves and restores its sorting under `${uniqueKey}:sorting`, and lets Reset columns reset it
|
|
162
|
+
* (ASMA-8698). It does by default: a table with a `uniqueKey` remembers each user's sort, like their column widths. Without
|
|
163
|
+
* `uniqueKey` nothing is saved.
|
|
164
|
+
*
|
|
165
|
+
* - `false` is the opt-out, for a table whose order is the user's own (drag and drop rows) or that must always open as the
|
|
166
|
+
* app declares it. Nothing is read or written for sorting then.
|
|
167
|
+
* - Leaving it out, or `true`, saves a sort that `StyledTable` owns. `true` is the default spelled out: nothing changes
|
|
168
|
+
* for a table that has it (it will not be removed before the next major version).
|
|
169
|
+
* - A table whose app owns the sorting state (`state.sorting`, or `onSortingChange`, which TanStack calls instead of
|
|
170
|
+
* updating the table's own state) is **not** saved by default: the saved sort could not be applied to a state the table
|
|
171
|
+
* does not own, and an app with its own persistence would have two writers. Such a table that wants it saved writes
|
|
172
|
+
* `persistSorting` (`true`), makes `StyledTable` the only writer, and reads the sort back with `usePersistedSorting`.
|
|
173
|
+
*
|
|
174
|
+
* A saved sort of a column that is gone or cannot sort is ignored, and so is storage that is corrupt, full or blocked: the
|
|
175
|
+
* table opens with its `initialState.sorting`, which Reset columns also returns to.
|
|
165
176
|
*/
|
|
166
177
|
persistSorting?: boolean;
|
|
167
178
|
/**
|
|
@@ -1,157 +1,174 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import { StyledBadge as
|
|
3
|
-
import { PinIcon as
|
|
4
|
-
import { StyledPopover as
|
|
5
|
-
import { message as
|
|
6
|
-
import { INTERNAL_COLUMN_IDS as
|
|
7
|
-
import { hasChangedColumnLayout as
|
|
8
|
-
import { StyledCheckbox as
|
|
9
|
-
import { StyledTooltip as
|
|
10
|
-
import { useToggleMenuVisibility as
|
|
1
|
+
import { cn as k } from "../../../../../helpers/cn.js";
|
|
2
|
+
import { StyledBadge as R } from "../../../../../components/data-display/badge/StyledBadge.js";
|
|
3
|
+
import { PinIcon as w } from "../../../../../components/icons/pin-icon/PinIcon.js";
|
|
4
|
+
import { StyledPopover as A } from "../../../../../components/utils/popover/StyledPopover.js";
|
|
5
|
+
import { message as O } from "../../../../../components/feedback/snack-bar/message.js";
|
|
6
|
+
import { INTERNAL_COLUMN_IDS as H } from "../../../../types.js";
|
|
7
|
+
import { hasChangedColumnLayout as M } from "../../../../custom-features/order-columns/columnLayout.js";
|
|
8
|
+
import { StyledCheckbox as P } from "../../../../shared-components/StyledCheckbox.js";
|
|
9
|
+
import { StyledTooltip as y } from "../../../../shared-components/tooltip/index.js";
|
|
10
|
+
import { useToggleMenuVisibility as E } from "../../../../hooks/useToggleMenuVisibility.hook.js";
|
|
11
11
|
import f from "./TableActions.module.js";
|
|
12
|
-
import
|
|
13
|
-
import { DotsHorizontalIcon as
|
|
14
|
-
import { headerLabelText as
|
|
15
|
-
import { useTranslations as
|
|
16
|
-
import { StyledButton as
|
|
17
|
-
import { compact as
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
12
|
+
import s from "./HeaderActionMenu.module.js";
|
|
13
|
+
import { DotsHorizontalIcon as V } from "../../../../shared-components/DotsHorizontalIcon.js";
|
|
14
|
+
import { headerLabelText as W } from "../../../../helpers/headerLabel.js";
|
|
15
|
+
import { useTranslations as z } from "../../../../hooks/useTranslations.js";
|
|
16
|
+
import { StyledButton as B } from "../../../../shared-components/button/StyledButton.js";
|
|
17
|
+
import { compact as $ } from "../../../../../helpers/arrays.js";
|
|
18
|
+
import { useId as j } from "react";
|
|
19
|
+
import { jsx as t, jsxs as u } from "react/jsx-runtime";
|
|
20
|
+
import { DndContext as U, PointerSensor as F, closestCenter as Y, useSensor as q, useSensors as G } from "@dnd-kit/core";
|
|
21
|
+
import { restrictToParentElement as J, restrictToVerticalAxis as K } from "@dnd-kit/modifiers";
|
|
22
|
+
import { SortableContext as Q, arrayMove as X, useSortable as Z, verticalListSortingStrategy as ee } from "@dnd-kit/sortable";
|
|
23
|
+
import { CSS as te } from "@dnd-kit/utilities";
|
|
24
|
+
function oe({ id: r, disabled: p, children: h }) {
|
|
25
|
+
const { attributes: d, listeners: b, setNodeRef: g, transform: x, transition: c } = Z({
|
|
26
|
+
id: r,
|
|
26
27
|
disabled: p
|
|
27
28
|
});
|
|
28
|
-
return /* @__PURE__ */
|
|
29
|
+
return /* @__PURE__ */ t("div", {
|
|
29
30
|
ref: g,
|
|
30
31
|
style: {
|
|
31
|
-
transform:
|
|
32
|
-
transition:
|
|
32
|
+
transform: te.Transform.toString(x),
|
|
33
|
+
transition: c
|
|
33
34
|
},
|
|
34
|
-
className:
|
|
35
|
+
className: s["drag-item"],
|
|
35
36
|
children: h({
|
|
36
|
-
attributes:
|
|
37
|
+
attributes: d,
|
|
37
38
|
listeners: b
|
|
38
39
|
})
|
|
39
40
|
});
|
|
40
41
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
var ie = (r) => {
|
|
43
|
+
r.target.closest('label, [role="button"]') || r.preventDefault();
|
|
44
|
+
};
|
|
45
|
+
function Ie({ headerData: r, locale: p }) {
|
|
46
|
+
const { anchorEl: h, open: d, handleClose: b, handleOpen: g } = E(), x = j(), c = M(r.table), C = r.table.getAllLeafColumns(), N = (e) => {
|
|
47
|
+
const { active: l, over: o } = e;
|
|
48
|
+
!l || !o || l.id === o.id || C.find((i) => i.id === o.id)?.columnDef.fixedLeft || C.find((i) => i.id === o.id)?.columnDef.fixedRight || r.table.setColumnOrder((i) => {
|
|
49
|
+
const a = $(i ?? []).length ? i : r.table.getAllLeafColumns().map((m) => m.id);
|
|
50
|
+
return X(a, a.indexOf(l.id), a.indexOf(o.id));
|
|
47
51
|
});
|
|
48
|
-
},
|
|
52
|
+
}, _ = G(q(F, { activationConstraint: { distance: 8 } })), n = z(p), S = C.filter((e) => !H.includes(e.id) && !!e.columnDef.header);
|
|
49
53
|
return /* @__PURE__ */ u("div", {
|
|
50
54
|
className: f["actions-header-wrapper"],
|
|
51
55
|
children: [/* @__PURE__ */ u("button", {
|
|
52
56
|
type: "button",
|
|
53
|
-
"aria-label":
|
|
57
|
+
"aria-label": c ? n.column_settings_changed : n.column_settings,
|
|
54
58
|
"aria-haspopup": "true",
|
|
55
|
-
"aria-expanded":
|
|
56
|
-
tabIndex:
|
|
59
|
+
"aria-expanded": d,
|
|
60
|
+
tabIndex: r.table.options.meta?.hideHeader ? -1 : void 0,
|
|
57
61
|
className: f["actions-header"],
|
|
58
62
|
onClick: g,
|
|
59
|
-
children: [/* @__PURE__ */
|
|
63
|
+
children: [/* @__PURE__ */ t(w, { className: f["pin-icon"] }), c && /* @__PURE__ */ t(R, {
|
|
60
64
|
dataTest: "column-settings-dot",
|
|
61
65
|
variant: "dot",
|
|
62
66
|
purpose: "filter",
|
|
63
67
|
className: f["pin-dot"]
|
|
64
68
|
})]
|
|
65
|
-
}), /* @__PURE__ */ u(
|
|
69
|
+
}), /* @__PURE__ */ u(A, {
|
|
66
70
|
anchorEl: h,
|
|
67
71
|
anchorOrigin: {
|
|
68
72
|
horizontal: "left",
|
|
69
73
|
vertical: "bottom"
|
|
70
74
|
},
|
|
71
|
-
open:
|
|
75
|
+
open: d,
|
|
72
76
|
onClose: b,
|
|
73
77
|
slotProps: { paper: { sx: {
|
|
74
78
|
maxHeight: "calc(7 * 40px)",
|
|
75
79
|
overflowY: "auto",
|
|
76
80
|
scrollbarWidth: "thin"
|
|
77
81
|
} } },
|
|
78
|
-
children: [/* @__PURE__ */
|
|
79
|
-
modifiers: [
|
|
80
|
-
onDragEnd:
|
|
81
|
-
collisionDetection: (e) =>
|
|
82
|
-
const
|
|
83
|
-
return !
|
|
82
|
+
children: [/* @__PURE__ */ t(U, {
|
|
83
|
+
modifiers: [K, J],
|
|
84
|
+
onDragEnd: N,
|
|
85
|
+
collisionDetection: (e) => Y(e).filter((l) => {
|
|
86
|
+
const o = S.find((i) => i.id === l.id);
|
|
87
|
+
return !o?.columnDef.fixedLeft && !o?.columnDef.fixedRight;
|
|
84
88
|
}),
|
|
85
|
-
sensors:
|
|
86
|
-
children: /* @__PURE__ */
|
|
87
|
-
items:
|
|
88
|
-
strategy:
|
|
89
|
-
children:
|
|
90
|
-
const
|
|
91
|
-
let
|
|
92
|
-
|
|
89
|
+
sensors: _,
|
|
90
|
+
children: /* @__PURE__ */ t(Q, {
|
|
91
|
+
items: S.map((e) => e.id),
|
|
92
|
+
strategy: ee,
|
|
93
|
+
children: S.map((e, l) => {
|
|
94
|
+
const o = !!e.columnDef.fixedLeft || !!e.columnDef.fixedRight, i = e.columnDef.enableHiding === !1, a = o ? n.column_reorder : null;
|
|
95
|
+
let m = null;
|
|
96
|
+
i && (m = o ? n.column_hidden : n.column_unhideable);
|
|
97
|
+
const D = W(e.columnDef) ?? e.id, v = `${x}-column-${l}-name`;
|
|
98
|
+
return /* @__PURE__ */ t(oe, {
|
|
93
99
|
id: e.id,
|
|
94
|
-
disabled:
|
|
95
|
-
children: ({ listeners:
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
height: 20,
|
|
108
|
-
...C,
|
|
109
|
-
...a,
|
|
110
|
-
style: {
|
|
111
|
-
touchAction: "none",
|
|
112
|
-
WebkitUserSelect: "none",
|
|
113
|
-
userSelect: "none",
|
|
114
|
-
WebkitTouchCallout: "none"
|
|
115
|
-
},
|
|
116
|
-
className: v(d["drag-icon"], r ? d["drag-icon--disabled"] : d["drag-icon--enabled"])
|
|
117
|
-
}),
|
|
118
|
-
/* @__PURE__ */ i("span", {
|
|
119
|
-
className: "px-2",
|
|
120
|
-
children: /* @__PURE__ */ i(A, {
|
|
121
|
-
readOnly: t,
|
|
100
|
+
disabled: o,
|
|
101
|
+
children: ({ listeners: L, attributes: T }) => /* @__PURE__ */ u("div", {
|
|
102
|
+
role: "presentation",
|
|
103
|
+
className: s["table-action-item"],
|
|
104
|
+
onMouseDown: ie,
|
|
105
|
+
children: [
|
|
106
|
+
/* @__PURE__ */ t(y, {
|
|
107
|
+
title: m,
|
|
108
|
+
arrow: !0,
|
|
109
|
+
children: /* @__PURE__ */ t("span", {
|
|
110
|
+
className: "px-1",
|
|
111
|
+
children: /* @__PURE__ */ t(P, {
|
|
112
|
+
readOnly: i,
|
|
122
113
|
dataTest: `${e.id}-column-visibility-checkbox`,
|
|
123
114
|
size: "small",
|
|
124
115
|
disableRipple: !0,
|
|
125
116
|
checked: e.getIsVisible(),
|
|
126
117
|
hideWrapper: !0,
|
|
127
|
-
className: "
|
|
118
|
+
className: s["column-checkbox"],
|
|
119
|
+
"aria-labelledby": v,
|
|
120
|
+
"aria-readonly": i || void 0,
|
|
121
|
+
onChange: (re, I) => {
|
|
122
|
+
i || e.toggleVisibility(I);
|
|
123
|
+
}
|
|
124
|
+
})
|
|
125
|
+
})
|
|
126
|
+
}),
|
|
127
|
+
/* @__PURE__ */ t(y, {
|
|
128
|
+
title: a,
|
|
129
|
+
arrow: !0,
|
|
130
|
+
children: /* @__PURE__ */ t("span", {
|
|
131
|
+
className: s["drag-slot"],
|
|
132
|
+
children: /* @__PURE__ */ t(V, {
|
|
133
|
+
width: 20,
|
|
134
|
+
height: 20,
|
|
135
|
+
...T,
|
|
136
|
+
...L,
|
|
137
|
+
style: {
|
|
138
|
+
touchAction: "none",
|
|
139
|
+
WebkitUserSelect: "none",
|
|
140
|
+
userSelect: "none",
|
|
141
|
+
WebkitTouchCallout: "none"
|
|
142
|
+
},
|
|
143
|
+
className: k(s["drag-icon"], o ? s["drag-icon--disabled"] : s["drag-icon--enabled"])
|
|
128
144
|
})
|
|
129
|
-
}),
|
|
130
|
-
/* @__PURE__ */ i("span", {
|
|
131
|
-
className: "font-roboto text-base text-delta-700",
|
|
132
|
-
children: R(e.columnDef) ?? e.id
|
|
133
145
|
})
|
|
134
|
-
|
|
135
|
-
|
|
146
|
+
}),
|
|
147
|
+
/* @__PURE__ */ t("span", {
|
|
148
|
+
id: v,
|
|
149
|
+
className: "font-roboto text-base text-delta-700",
|
|
150
|
+
children: D
|
|
151
|
+
})
|
|
152
|
+
]
|
|
136
153
|
})
|
|
137
154
|
}, e.id);
|
|
138
155
|
})
|
|
139
156
|
})
|
|
140
|
-
}), /* @__PURE__ */
|
|
157
|
+
}), /* @__PURE__ */ t("div", {
|
|
141
158
|
className: "pb-2 pl-2",
|
|
142
|
-
children: /* @__PURE__ */
|
|
159
|
+
children: /* @__PURE__ */ t(B, {
|
|
143
160
|
dataTest: "reset-order-button",
|
|
144
161
|
variant: "text",
|
|
145
162
|
className: "h-10",
|
|
146
163
|
onClick: () => {
|
|
147
|
-
|
|
164
|
+
r.table.resetColumnSettings(), O.info(n.columns_reset, { closeButton: !0 });
|
|
148
165
|
},
|
|
149
|
-
children:
|
|
166
|
+
children: n.reset_columns
|
|
150
167
|
})
|
|
151
168
|
})]
|
|
152
169
|
})]
|
|
153
170
|
});
|
|
154
171
|
}
|
|
155
172
|
export {
|
|
156
|
-
|
|
173
|
+
Ie as HeaderActionMenu
|
|
157
174
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
var a = {
|
|
2
|
-
"table-action-item": "_table-action-
|
|
3
|
-
"drag-item": "_drag-
|
|
4
|
-
"
|
|
5
|
-
"drag-
|
|
6
|
-
"drag-icon
|
|
2
|
+
"table-action-item": "_table-action-item_1u7jy_1",
|
|
3
|
+
"drag-item": "_drag-item_1u7jy_19",
|
|
4
|
+
"column-checkbox": "_column-checkbox_1u7jy_23",
|
|
5
|
+
"drag-slot": "_drag-slot_1u7jy_28",
|
|
6
|
+
"drag-icon": "_drag-icon_1u7jy_33",
|
|
7
|
+
"drag-icon--disabled": "_drag-icon--disabled_1u7jy_38",
|
|
8
|
+
"drag-icon--enabled": "_drag-icon--enabled_1u7jy_43"
|
|
7
9
|
};
|
|
8
10
|
export {
|
|
9
11
|
a as default
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { tableStorage as
|
|
2
|
-
import { isDefaultColumnOrder as
|
|
3
|
-
import { useEffect as
|
|
4
|
-
function
|
|
5
|
-
const o = n.getState().columnOrder, t = JSON.stringify(o ?? [])
|
|
6
|
-
|
|
7
|
-
if (
|
|
8
|
-
|
|
1
|
+
import { tableStorage as s } from "../../helpers/tableStorage.js";
|
|
2
|
+
import { isDefaultColumnOrder as c } from "./columnLayout.js";
|
|
3
|
+
import { useEffect as i, useRef as f } from "react";
|
|
4
|
+
function g(n, r) {
|
|
5
|
+
const o = n.getState().columnOrder, t = r ? JSON.stringify(o ?? []) : "", u = f(r), e = f(t);
|
|
6
|
+
i(() => {
|
|
7
|
+
if (u.current !== r) {
|
|
8
|
+
u.current = r, e.current = t;
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
|
-
!r || t === e.current || (e.current = t, c ?
|
|
11
|
+
!r || t === e.current || (e.current = t, !o?.length || c(n) ? s.remove(r) : s.set(r, t));
|
|
12
12
|
}, [t, r]);
|
|
13
13
|
}
|
|
14
14
|
export {
|
|
15
|
-
|
|
15
|
+
g as usePersistColumnOrder
|
|
16
16
|
};
|
|
@@ -16,30 +16,30 @@ var F = ":column-order", M = ":column-visibility", f = 1, k = (e) => e ? `${e}${
|
|
|
16
16
|
const i = C(e);
|
|
17
17
|
return i.length > 0 ? i : void 0;
|
|
18
18
|
}, T = (e, i, t) => {
|
|
19
|
-
if (!S(e) || !Object.values(e).every((
|
|
20
|
-
const r = K(Object.fromEntries(Object.entries(e).filter(([
|
|
19
|
+
if (!S(e) || !Object.values(e).every((s) => typeof s == "boolean")) return;
|
|
20
|
+
const r = K(Object.fromEntries(Object.entries(e).filter(([s]) => p(s, i))), t);
|
|
21
21
|
return Object.keys(r).length > 0 ? r : void 0;
|
|
22
22
|
}, U = (e) => {
|
|
23
|
-
const { enabled: i, uniqueKey: t, legacyOrderKey: r, legacyVisibilityKey:
|
|
23
|
+
const { enabled: i, uniqueKey: t, legacyOrderKey: r, legacyVisibilityKey: s, columns: o, defaultOrder: g, defaultVisibility: n } = e, d = i ? k(t) : void 0, a = i ? E(t) : void 0, l = o.map((y) => y.id), c = [];
|
|
24
24
|
let b, u;
|
|
25
|
-
if (
|
|
26
|
-
if (v.get(
|
|
25
|
+
if (d) {
|
|
26
|
+
if (v.get(d) !== null) b = D(O(d));
|
|
27
27
|
else if (r && v.get(r) !== null) {
|
|
28
|
-
const
|
|
29
|
-
|
|
28
|
+
const y = x(O(r)), I = y === void 0 || m(j(y, l), l).join() === m(g, l).join();
|
|
29
|
+
y && !I && (b = y), c.push({
|
|
30
30
|
legacyKey: r,
|
|
31
|
-
...
|
|
32
|
-
key:
|
|
31
|
+
...y && !I && { write: {
|
|
32
|
+
key: d,
|
|
33
33
|
value: JSON.stringify({
|
|
34
34
|
v: f,
|
|
35
|
-
order:
|
|
35
|
+
order: y
|
|
36
36
|
})
|
|
37
37
|
} }
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
return a && (v.get(a) !== null ? u = $(O(a),
|
|
42
|
-
legacyKey:
|
|
41
|
+
return a && (v.get(a) !== null ? u = $(O(a), o) : s && v.get(s) !== null && (u = T(O(s), o, n), c.push({
|
|
42
|
+
legacyKey: s,
|
|
43
43
|
...u && { write: {
|
|
44
44
|
key: a,
|
|
45
45
|
value: JSON.stringify({
|
|
@@ -48,18 +48,18 @@ var F = ":column-order", M = ":column-visibility", f = 1, k = (e) => e ? `${e}${
|
|
|
48
48
|
})
|
|
49
49
|
} }
|
|
50
50
|
}))), {
|
|
51
|
-
orderKey:
|
|
51
|
+
orderKey: d,
|
|
52
52
|
visibilityKey: a,
|
|
53
53
|
order: b,
|
|
54
54
|
visibility: u,
|
|
55
55
|
migration: c
|
|
56
56
|
};
|
|
57
57
|
}, W = (e, i, t) => {
|
|
58
|
-
const r = e.visibility && Object.fromEntries(Object.entries(e.visibility).filter(([
|
|
58
|
+
const r = e.visibility && Object.fromEntries(Object.entries(e.visibility).filter(([s]) => p(s, i)));
|
|
59
59
|
return {
|
|
60
60
|
orderKey: e.orderKey,
|
|
61
61
|
visibilityKey: e.visibilityKey,
|
|
62
|
-
order: e.order && j(e.order, i.map((
|
|
62
|
+
order: e.order && j(e.order, i.map((s) => s.id)),
|
|
63
63
|
visibility: r && Object.keys(r).length > 0 ? {
|
|
64
64
|
...t,
|
|
65
65
|
...r
|
|
@@ -77,41 +77,41 @@ var F = ":column-order", M = ":column-visibility", f = 1, k = (e) => e ? `${e}${
|
|
|
77
77
|
r && !v.set(r.key, r.value) || v.remove(t);
|
|
78
78
|
}, [i]), W(i, e.columns, e.defaultVisibility);
|
|
79
79
|
}, V = /* @__PURE__ */ new WeakMap(), Y = (e, i) => [.../* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(i)])].every((t) => (e[t] ?? !0) === (i[t] ?? !0)), G = (e, i) => {
|
|
80
|
-
const { enabled: t, definitionIds: r, defaultOrder:
|
|
81
|
-
signature: JSON.stringify([
|
|
80
|
+
const { enabled: t, definitionIds: r, defaultOrder: s, defaultVisibility: o, controlledVisibility: g } = i, n = {
|
|
81
|
+
signature: t ? JSON.stringify([
|
|
82
82
|
r,
|
|
83
|
-
|
|
84
|
-
Object.entries(
|
|
85
|
-
]),
|
|
83
|
+
s,
|
|
84
|
+
Object.entries(o).sort()
|
|
85
|
+
]) : "",
|
|
86
86
|
definitionIds: r,
|
|
87
|
-
defaultOrder:
|
|
88
|
-
defaultVisibility:
|
|
89
|
-
},
|
|
87
|
+
defaultOrder: s,
|
|
88
|
+
defaultVisibility: o
|
|
89
|
+
}, d = V.get(e) ?? n, a = t && d.signature !== "" && d.signature !== n.signature;
|
|
90
90
|
return R(() => {
|
|
91
|
-
const
|
|
92
|
-
if (V.set(e,
|
|
93
|
-
const c = e.getState().columnOrder, b = m(c,
|
|
91
|
+
const l = V.get(e);
|
|
92
|
+
if (V.set(e, n), !t || !l || l.signature === "" || l.signature === n.signature) return;
|
|
93
|
+
const c = e.getState().columnOrder, b = m(c, l.definitionIds).join() === m(l.defaultOrder, l.definitionIds).join() ? s : j(c, r);
|
|
94
94
|
if (e.setColumnOrder(b), !g) {
|
|
95
|
-
const u = e.getState().columnVisibility,
|
|
96
|
-
...
|
|
97
|
-
...K(u,
|
|
95
|
+
const u = e.getState().columnVisibility, y = {
|
|
96
|
+
...o,
|
|
97
|
+
...K(u, l.defaultVisibility)
|
|
98
98
|
};
|
|
99
|
-
Y(
|
|
99
|
+
Y(y, u) || e.setColumnVisibility(y);
|
|
100
100
|
}
|
|
101
101
|
}, [
|
|
102
102
|
e,
|
|
103
103
|
t,
|
|
104
|
-
|
|
104
|
+
n.signature
|
|
105
105
|
]), a;
|
|
106
106
|
}, Q = (e, i) => {
|
|
107
|
-
const { saved: t, reconciling: r, defaultOrder:
|
|
107
|
+
const { saved: t, reconciling: r, defaultOrder: s, defaultVisibility: o, controlledVisibility: g } = i;
|
|
108
108
|
L({
|
|
109
109
|
storageKey: t.orderKey,
|
|
110
110
|
state: e.getState().columnOrder,
|
|
111
|
-
defaultValue:
|
|
111
|
+
defaultValue: s,
|
|
112
112
|
saved: t.order,
|
|
113
113
|
settled: !r,
|
|
114
|
-
toSignature: (n) => JSON.stringify(m(n,
|
|
114
|
+
toSignature: (n) => JSON.stringify(m(n, A(e))),
|
|
115
115
|
toStorage: (n) => JSON.stringify({
|
|
116
116
|
v: f,
|
|
117
117
|
order: C(n)
|
|
@@ -120,14 +120,14 @@ var F = ":column-order", M = ":column-visibility", f = 1, k = (e) => e ? `${e}${
|
|
|
120
120
|
}), L({
|
|
121
121
|
storageKey: t.visibilityKey,
|
|
122
122
|
state: e.getState().columnVisibility,
|
|
123
|
-
defaultValue:
|
|
123
|
+
defaultValue: o,
|
|
124
124
|
saved: t.visibility,
|
|
125
125
|
settled: !r,
|
|
126
126
|
controlled: g,
|
|
127
|
-
toSignature: (n) => h(n,
|
|
127
|
+
toSignature: (n) => h(n, o),
|
|
128
128
|
toStorage: (n) => JSON.stringify({
|
|
129
129
|
v: f,
|
|
130
|
-
visibility: K(n,
|
|
130
|
+
visibility: K(n, o)
|
|
131
131
|
}),
|
|
132
132
|
applyState: (n) => e.setColumnVisibility(n)
|
|
133
133
|
});
|