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