asma-ui-core 3.138.2 → 3.140.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.
@@ -1,170 +1,171 @@
1
- import { SELECT_COLUMN_ID as H } from "../types.js";
2
- import { ExpandedRowsFeature as Q } from "../custom-features/expand-rows/ExpandRowsFeature.js";
3
- import { FocusedRowsFeature as X } from "../custom-features/focus-rows/FocusRowsFeature.js";
4
- import { OrderColumnsFeature as $ } from "../custom-features/order-columns/OrderColumnsFeature.js";
1
+ import { SELECT_COLUMN_ID as G } from "../types.js";
2
+ import { ExpandedRowsFeature as X } from "../custom-features/expand-rows/ExpandRowsFeature.js";
3
+ import { FocusedRowsFeature as $ } from "../custom-features/focus-rows/FocusRowsFeature.js";
4
+ import { OrderColumnsFeature as ee } from "../custom-features/order-columns/OrderColumnsFeature.js";
5
5
  import { tableStorage as h } from "../helpers/tableStorage.js";
6
- import { normalizeDefaultColumnOrder as ee } from "../custom-features/order-columns/columnLayout.js";
7
- import { usePersistColumnOrder as te } from "../custom-features/order-columns/usePersistColumnOrder.js";
8
- import { usePersistedColumnOrder as oe } from "../custom-features/order-columns/usePersistedColumnOrder.js";
9
- import { getPersistedPageSizeKey as ie, usePersistedPageSize as ne } from "./usePersistedPageSize.js";
10
- import { columnSizingSignature as re, getColumnSizingStorageKey as le, serializeColumnSizing as se, usePersistedColumnSizing as ae } from "./useColumnSizingPersistence.js";
11
- import { getSortingStorageKey as ue, readSortingFromStorage as de, serializeSorting as ge, sortingSignature as me } from "./usePersistedSorting.js";
12
- import { usePersistedStateWriter as U } from "./usePersistedStateWriter.js";
13
- import { useColumnLayoutReconcile as Se, useColumnLayoutWriter as ce, useSavedColumnLayout as fe } from "./useColumnLayoutPersistence.js";
14
- import { RowSelectionTooltipFeature as ye } from "../custom-features/row-selection-tooltip/RowSelectionTooltipFeature.js";
15
- import { getLeafColumnInfos as Ce } from "../helpers/columnIds.js";
16
- import { resolveColumnSizingDefaults as be } from "../helpers/columnSizingDefaults.js";
17
- import { STYLED_DEFAULT_SORTING_FN as pe, createStyledDefaultSortingFn as ve, resolveSortUndefinedDefaults as ze } from "../helpers/defaultSortingFn.js";
18
- import { useEffect as C, useMemo as b, useRef as I } from "react";
19
- import { getCoreRowModel as Re, getExpandedRowModel as Oe, getFilteredRowModel as Ke, getPaginationRowModel as Ve, getSortedRowModel as Me, useReactTable as Ie } from "@tanstack/react-table";
20
- var Le = [], Fe = {}, we = [], _e = { [H]: !1 }, Qe = (p) => {
21
- const { columns: v, data: G, initialState: s, pageSize: W, enableRowSelection: A, tableInstanceRef: L, locale: B, persistColumnOrderKey: g, uniqueKey: a, persistSorting: Y, persistColumnLayout: j, legacyColumnVisibilityKey: F, defaultColumn: r, ...t } = p, w = s?.sorting ?? Le, z = s?.columnSizing ?? Fe, R = p.enableColumnResizing ?? !0, q = p.enableColumnResizing === !0, J = b(() => ze(be(v, {
6
+ import { normalizeDefaultColumnOrder as te } from "../custom-features/order-columns/columnLayout.js";
7
+ import { usePersistColumnOrder as oe } from "../custom-features/order-columns/usePersistColumnOrder.js";
8
+ import { usePersistedColumnOrder as ie } from "../custom-features/order-columns/usePersistedColumnOrder.js";
9
+ import { getPersistedPageSizeKey as ne, usePersistedPageSize as re } from "./usePersistedPageSize.js";
10
+ import { columnSizingSignature as le, getColumnSizingStorageKey as se, serializeColumnSizing as ae, usePersistedColumnSizing as ue } from "./useColumnSizingPersistence.js";
11
+ import { getSortingStorageKey as de, readSortingFromStorage as ge, serializeSorting as me, sortingSignature as Se } from "./usePersistedSorting.js";
12
+ import { usePersistedStateWriter as A } from "./usePersistedStateWriter.js";
13
+ import { useColumnLayoutReconcile as ce, useColumnLayoutWriter as fe, useSavedColumnLayout as ye } from "./useColumnLayoutPersistence.js";
14
+ import { RowSelectionTooltipFeature as Ce } from "../custom-features/row-selection-tooltip/RowSelectionTooltipFeature.js";
15
+ import { getLeafColumnInfos as be } from "../helpers/columnIds.js";
16
+ import { resolveColumnSizingDefaults as pe } from "../helpers/columnSizingDefaults.js";
17
+ import { STYLED_DEFAULT_SORTING_FN as ve, createStyledDefaultSortingFn as ze, resolveSortUndefinedDefaults as Re } from "../helpers/defaultSortingFn.js";
18
+ import { useEffect as C, useMemo as b, useRef as p } from "react";
19
+ import { getCoreRowModel as Oe, getExpandedRowModel as Ke, getFilteredRowModel as Le, getPaginationRowModel as Ve, getSortedRowModel as Ie, useReactTable as Me } from "@tanstack/react-table";
20
+ var Fe = [], _e = {}, we = [], Pe = { [G]: !1 }, $e = (v) => {
21
+ const { columns: z, data: H, initialState: a, pageSize: B, enableRowSelection: W, tableInstanceRef: F, locale: Y, persistColumnOrderKey: m, uniqueKey: u, persistSorting: Z, persistColumnLayout: j, legacyColumnVisibilityKey: _, defaultColumn: r, ...t } = v, w = a?.sorting ?? Fe, R = a?.columnSizing ?? _e, O = v.enableColumnResizing ?? !0, q = v.enableColumnResizing === !0, J = b(() => Re(pe(z, {
22
22
  defaultColumn: r,
23
23
  enableSorting: t.enableSorting,
24
- canResize: R
24
+ canResize: O
25
25
  }), r), [
26
- v,
26
+ z,
27
27
  r,
28
28
  t.enableSorting,
29
- R
30
- ]), O = Ce(v, {
29
+ O
30
+ ]), K = be(z, {
31
31
  defaultColumn: r,
32
32
  enableSorting: t.enableSorting,
33
33
  enableMultiSort: t.enableMultiSort,
34
34
  enableHiding: t.enableHiding
35
- }), i = j === !0, _ = O.map((o) => o.id), l = ee(s?.columnOrder ?? we, _), m = s?.columnVisibility ?? _e, n = fe({
35
+ }), i = j === !0, P = K.map((o) => o.id), l = te(a?.columnOrder ?? we, P), S = a?.columnVisibility ?? Pe, n = ye({
36
36
  enabled: i,
37
- uniqueKey: a,
38
- legacyOrderKey: g,
39
- legacyVisibilityKey: F,
40
- columns: O,
37
+ uniqueKey: u,
38
+ legacyOrderKey: m,
39
+ legacyVisibilityKey: _,
40
+ columns: K,
41
41
  defaultOrder: l,
42
- defaultVisibility: m
43
- }), D = oe(i ? void 0 : g), P = q ? a : void 0, N = le(P), K = ae(P, z), S = Y ? ue(a) : void 0, V = b(() => S ? de(a, {
44
- sortableColumns: O.filter((o) => o.canSort),
42
+ defaultVisibility: S
43
+ }), D = ie(i ? void 0 : m), E = q ? u : void 0, T = se(E), L = ue(E, R), c = Z ? de(u) : void 0, V = b(() => c ? ge(u, {
44
+ sortableColumns: K.filter((o) => o.canSort),
45
45
  maxMultiSortColCount: t.maxMultiSortColCount
46
- }) : void 0, [S]), u = ne(a) ?? W ?? 50, T = I(void 0), Z = b(() => ve(() => T.current), []), k = b(() => ({
46
+ }) : void 0, [c]), d = re(u) ?? B ?? 50, N = p(void 0), k = b(() => ze(() => N.current), []), Q = b(() => ({
47
47
  ...r,
48
48
  sortingFn: r?.sortingFn ?? "styledDefault"
49
- }), [r]), e = Ie({
49
+ }), [r]), e = Me({
50
50
  _features: [
51
- Q,
52
51
  X,
53
52
  $,
54
- ye
53
+ ee,
54
+ Ce
55
55
  ],
56
56
  columns: J,
57
- data: G,
57
+ data: H,
58
58
  meta: {
59
- locale: B ?? "en",
59
+ locale: Y ?? "en",
60
60
  hideHeader: !!t.hideHeader
61
61
  },
62
62
  initialState: {
63
63
  pagination: {
64
64
  pageIndex: 0,
65
- pageSize: u
65
+ pageSize: d
66
66
  },
67
67
  columnVisibility: {
68
- ...s?.columnVisibility,
69
- [H]: !1
68
+ ...a?.columnVisibility,
69
+ [G]: !1
70
70
  },
71
71
  ...D && { columnOrder: D },
72
- ...s,
72
+ ...a,
73
73
  ...i && l.length > 0 && { columnOrder: l },
74
74
  ...n.order && { columnOrder: n.order },
75
75
  ...n.visibility && { columnVisibility: n.visibility },
76
- ...K && { columnSizing: K },
76
+ ...L && { columnSizing: L },
77
77
  ...V !== void 0 && { sorting: V }
78
78
  },
79
- enableRowSelection: A,
80
- getCoreRowModel: Re(),
81
- getExpandedRowModel: Oe(),
82
- getFilteredRowModel: Ke(),
83
- getSortedRowModel: Me(),
79
+ enableRowSelection: W,
80
+ getCoreRowModel: Oe(),
81
+ getExpandedRowModel: Ke(),
82
+ getFilteredRowModel: Le(),
83
+ getSortedRowModel: Ie(),
84
84
  getPaginationRowModel: Ve(),
85
- getRowId: t.getRowId ?? ((o, x, c) => c ? [c.id, o.id].join(".") : o.id.toString()),
86
- defaultColumn: k,
85
+ getRowId: t.getRowId ?? ((o, U, f) => f ? [f.id, o.id].join(".") : o.id.toString()),
86
+ defaultColumn: Q,
87
87
  ...t,
88
- enableColumnResizing: R,
88
+ enableColumnResizing: O,
89
89
  sortingFns: {
90
- [pe]: Z,
90
+ [ve]: k,
91
91
  ...t.sortingFns
92
92
  }
93
93
  });
94
- T.current = e;
95
- const f = e.options.meta?.locale, E = I(f);
94
+ N.current = e;
95
+ const y = e.options.meta?.locale, x = p(y);
96
96
  C(() => {
97
- E.current !== f && (E.current = f, e.getState().sorting.length > 0 && e.setSorting((o) => [...o]));
98
- }, [f, e]), L && (L.current = e), te(e, i ? void 0 : g), ce(e, {
97
+ x.current !== y && (x.current = y, e.getState().sorting.length > 0 && e.setSorting((o) => [...o]));
98
+ }, [y, e]), F && (F.current = e), oe(e, i ? void 0 : m), fe(e, {
99
99
  saved: n,
100
- reconciling: Se(e, {
100
+ reconciling: ce(e, {
101
101
  enabled: i,
102
- definitionIds: _,
102
+ definitionIds: P,
103
103
  defaultOrder: l,
104
- defaultVisibility: m,
104
+ defaultVisibility: S,
105
105
  controlledVisibility: t.state?.columnVisibility !== void 0
106
106
  }),
107
107
  defaultOrder: l,
108
- defaultVisibility: m,
108
+ defaultVisibility: S,
109
109
  controlledVisibility: t.state?.columnVisibility !== void 0
110
110
  }), C(() => {
111
- }, [i, t.state?.columnVisibility !== void 0 || t.onColumnVisibilityChange !== void 0]), U({
112
- storageKey: S,
111
+ }, [i, t.state?.columnVisibility !== void 0 || t.onColumnVisibilityChange !== void 0]), A({
112
+ storageKey: c,
113
113
  state: e.getState().sorting,
114
114
  defaultValue: w,
115
115
  saved: V,
116
116
  controlled: t.state?.sorting !== void 0,
117
- toSignature: me,
118
- toStorage: ge,
117
+ toSignature: Se,
118
+ toStorage: me,
119
119
  applyState: (o) => e.setSorting(o)
120
- }), U({
121
- storageKey: N,
120
+ }), A({
121
+ storageKey: T,
122
122
  state: e.getState().columnSizing,
123
- defaultValue: z,
124
- saved: K,
123
+ defaultValue: R,
124
+ saved: L,
125
125
  settled: !e.getState().columnSizingInfo.isResizingColumn,
126
- toSignature: re,
127
- toStorage: se,
126
+ toSignature: le,
127
+ toStorage: ae,
128
128
  applyState: (o) => e.setColumnSizing(o)
129
129
  }), e.columnLayoutDefaults = i ? {
130
130
  order: l,
131
- visibility: m
131
+ visibility: S
132
132
  } : void 0, e.resetColumnSettings = () => {
133
- e.setColumnOrder(i ? l : []), e.setColumnSizing(z), i && e.setColumnVisibility(m), S && e.setSorting(w);
133
+ e.setColumnOrder(i ? l : []), e.setColumnSizing(R), i && e.setColumnVisibility(S), c && e.setSorting(w);
134
134
  const o = i && n.orderKey !== void 0 ? [
135
135
  n.orderKey,
136
136
  n.visibilityKey,
137
- g,
138
- F
139
- ] : [], x = i ? void 0 : g;
140
- for (const c of [
141
- S,
142
- N,
143
- x,
137
+ m,
138
+ _
139
+ ] : [], U = i ? void 0 : m;
140
+ for (const f of [
141
+ c,
142
+ T,
143
+ U,
144
144
  ...o
145
- ]) c && h.remove(c);
145
+ ]) f && h.remove(f);
146
146
  };
147
- const d = ie(a), y = e.getState().pagination?.pageSize, M = I(void 0);
147
+ const g = ne(u), s = e.getState().pagination?.pageSize, I = p(void 0), M = p(void 0);
148
148
  return C(() => {
149
- M.current = void 0, e.getState().pagination?.pageSize !== u && (e.setPageIndex(0), e.setPageSize(u));
149
+ I.current = void 0, e.getState().pagination?.pageSize !== d && (e.setPageIndex(0), e.setPageSize(d));
150
150
  }, [
151
- u,
152
151
  d,
152
+ g,
153
153
  e
154
154
  ]), C(() => {
155
- if (!(!d || y == null)) {
156
- if (M.current !== d) {
157
- if (y !== u) return;
158
- M.current = d;
155
+ if (!(!g || s == null)) {
156
+ if (I.current !== g) {
157
+ if (s !== d) return;
158
+ I.current = g, M.current = s;
159
+ return;
159
160
  }
160
- h.set(d, JSON.stringify(y));
161
+ s !== M.current && (M.current = s, h.set(g, JSON.stringify(s)));
161
162
  }
162
163
  }, [
163
- y,
164
- u,
165
- d
164
+ s,
165
+ d,
166
+ g
166
167
  ]), { table: e };
167
168
  };
168
169
  export {
169
- Qe as useStyledTable
170
+ $e as useStyledTable
170
171
  };
@@ -1,8 +1,11 @@
1
1
  import "./types.js";
2
+ import "./hooks/usePersistedPageSize.js";
2
3
  import "./hooks/usePersistedSorting.js";
3
4
  import "./components/columns/dndHandleColumn.js";
4
5
  import "./components/StyledTableIndex.js";
5
- import { createColumnHelper as S } from "@tanstack/react-table";
6
+ import "./helpers/migrateLegacyTableSettings.js";
7
+ import "./hooks/useLegacyTableSettingsMigration.js";
8
+ import { createColumnHelper as A } from "@tanstack/react-table";
6
9
  export {
7
- S as createColumnHelper
10
+ A as createColumnHelper
8
11
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "3.138.2",
6
+ "version": "3.140.0",
7
7
  "type": "module",
8
8
  "sideEffects": [
9
9
  "**/*.css",