bitz-react-admin-ui 1.7.9 → 1.8.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,36 +1,36 @@
1
1
  import { j as A } from "../../../node_modules/.store/react@18.2.0/node_modules/react/jsx-runtime.mjs";
2
- import G from "../../../hooks/useMergedState.mjs";
3
- import { createContext as B, useRef as U, useEffect as m, useMemo as D, useCallback as F } from "react";
2
+ import U from "../../../hooks/useMergedState.mjs";
3
+ import { createContext as B, useRef as q, useEffect as r, useMemo as D, useCallback as F } from "react";
4
4
  import { genColumnKey as H } from "./utils/index.mjs";
5
5
  import { getUuid as L } from "../../../utils/uuid.mjs";
6
- import r from "../../../node_modules/.store/lodash-es@4.17.21/node_modules/lodash-es/merge.mjs";
6
+ import d from "../../../node_modules/.store/lodash-es@4.17.21/node_modules/lodash-es/merge.mjs";
7
7
  function Q(e) {
8
- var C, T, V, v, O, J, M, N, b, x, I, j, P, E, R, k;
9
- const f = U(L()), w = U([]), { defaultSize: q = "lg" } = e, [h, g] = G(
8
+ var T, V, v, O, J, M, N, b, j, x, I, P, E, k, R, G;
9
+ const f = q(L()), w = q([]), { defaultSize: h = "lg" } = e, [g, C] = U(
10
10
  () => {
11
- var n, i, a, l;
11
+ var n, a, i, l;
12
12
  const { persistenceType: t, persistenceKey: c, onlineGet: u } = e.sizeState || {};
13
13
  if (c && t && typeof window < "u" && t !== "online") {
14
- const s = window[t];
14
+ const o = window[t];
15
15
  try {
16
- const o = s == null ? void 0 : s.getItem(c);
17
- if (o)
18
- return (n = e == null ? void 0 : e.sizeState) != null && n.defaultValue ? r(
19
- JSON.parse(o),
20
- (i = e == null ? void 0 : e.sizeState) == null ? void 0 : i.defaultValue
21
- ) : JSON.parse(o);
22
- } catch (o) {
23
- console.warn(o);
16
+ const s = o == null ? void 0 : o.getItem(c);
17
+ if (s)
18
+ return (n = e == null ? void 0 : e.sizeState) != null && n.defaultValue ? d(
19
+ JSON.parse(s),
20
+ (a = e == null ? void 0 : e.sizeState) == null ? void 0 : a.defaultValue
21
+ ) : JSON.parse(s);
22
+ } catch (s) {
23
+ console.warn(s);
24
24
  }
25
25
  }
26
- return e.size || ((a = e.sizeState) == null ? void 0 : a.value) || ((l = e.sizeState) == null ? void 0 : l.defaultValue) || q;
26
+ return e.size || ((i = e.sizeState) == null ? void 0 : i.value) || ((l = e.sizeState) == null ? void 0 : l.defaultValue) || h;
27
27
  },
28
28
  {
29
- value: ((C = e.sizeState) == null ? void 0 : C.value) || e.size,
30
- onChange: ((T = e.sizeState) == null ? void 0 : T.onChange) || e.onSizeChange
29
+ value: ((T = e.sizeState) == null ? void 0 : T.value) || e.size,
30
+ onChange: ((V = e.sizeState) == null ? void 0 : V.onChange) || e.onSizeChange
31
31
  }
32
32
  );
33
- m(() => {
33
+ r(() => {
34
34
  var u, n;
35
35
  if (!((u = e.sizeState) != null && u.persistenceKey) || !((n = e.sizeState) != null && n.persistenceType) || typeof window > "u")
36
36
  return;
@@ -40,90 +40,89 @@ function Q(e) {
40
40
  // onlineChange
41
41
  } = e.sizeState;
42
42
  if (t !== "online") {
43
- const i = window[t];
43
+ const a = window[t];
44
44
  try {
45
- i == null || i.setItem(c, JSON.stringify(d));
46
- } catch (a) {
47
- console.warn(a), z();
45
+ a == null || a.setItem(c, JSON.stringify(y));
46
+ } catch (i) {
47
+ console.warn(i), z();
48
48
  }
49
49
  }
50
50
  }, [
51
- (V = e.sizeState) == null ? void 0 : V.persistenceKey,
52
- h,
53
- (v = e.sizeState) == null ? void 0 : v.persistenceType
54
- ]), m(() => {
51
+ (v = e.sizeState) == null ? void 0 : v.persistenceKey,
52
+ g,
53
+ (O = e.sizeState) == null ? void 0 : O.persistenceType
54
+ ]), r(() => {
55
55
  var t, c, u;
56
56
  if ((t = e.sizeState) != null && t.persistenceKey && ((c = e.sizeState) == null ? void 0 : c.persistenceType) === "online") {
57
- const { onlineGet: n, persistenceKey: i } = e.sizeState;
57
+ const { onlineGet: n, persistenceKey: a } = e.sizeState;
58
58
  try {
59
- (u = n == null ? void 0 : n(i)) == null || u.then((a) => {
60
- var s;
61
- const l = r(a, (s = e == null ? void 0 : e.sizeState) == null ? void 0 : s.value);
62
- g(l ?? "lg");
59
+ (u = n == null ? void 0 : n(a)) == null || u.then((i) => {
60
+ var l;
61
+ C(i ?? ((l = e == null ? void 0 : e.sizeState) == null ? void 0 : l.value) ?? h);
63
62
  });
64
- } catch (a) {
65
- console.warn(a);
63
+ } catch (i) {
64
+ console.warn(i);
66
65
  }
67
66
  }
68
67
  }, []);
69
- const y = D(() => {
68
+ const S = D(() => {
70
69
  var c, u;
71
70
  if ((c = e == null ? void 0 : e.columnsState) != null && c.defaultValue)
72
71
  return e.columnsState.defaultValue;
73
72
  const t = {};
74
- return (u = e.columns) == null || u.forEach(({ key: n, dataIndex: i, fixed: a, disable: l }, s) => {
75
- const o = H(n ?? i, s);
76
- o && (t[o] = {
73
+ return (u = e.columns) == null || u.forEach(({ key: n, dataIndex: a, fixed: i, disable: l }, o) => {
74
+ const s = H(n ?? a, o);
75
+ s && (t[s] = {
77
76
  show: !0,
78
- fixed: a,
77
+ fixed: i,
79
78
  disable: l
80
79
  });
81
80
  }), t;
82
- }, [e.columns]), [d, S] = G(
81
+ }, [e.columns]), [y, m] = U(
83
82
  () => {
84
- var n, i, a, l;
83
+ var n, a, i, l;
85
84
  const { persistenceType: t, persistenceKey: c, onlineGet: u } = e.columnsState || {};
86
85
  if (c && t && typeof window < "u" && t !== "online") {
87
- const s = window[t];
86
+ const o = window[t];
88
87
  try {
89
- const o = s == null ? void 0 : s.getItem(c);
90
- if (o)
91
- return (n = e == null ? void 0 : e.columnsState) != null && n.defaultValue ? r(
92
- JSON.parse(o),
93
- (i = e == null ? void 0 : e.columnsState) == null ? void 0 : i.defaultValue
94
- ) : JSON.parse(o);
95
- } catch (o) {
96
- console.warn(o);
88
+ const s = o == null ? void 0 : o.getItem(c);
89
+ if (s)
90
+ return (n = e == null ? void 0 : e.columnsState) != null && n.defaultValue ? d(
91
+ JSON.parse(s),
92
+ (a = e == null ? void 0 : e.columnsState) == null ? void 0 : a.defaultValue
93
+ ) : JSON.parse(s);
94
+ } catch (s) {
95
+ console.warn(s);
97
96
  }
98
97
  }
99
- return e.columnsStateMap || ((a = e.columnsState) == null ? void 0 : a.value) || ((l = e.columnsState) == null ? void 0 : l.defaultValue) || y;
98
+ return e.columnsStateMap || ((i = e.columnsState) == null ? void 0 : i.value) || ((l = e.columnsState) == null ? void 0 : l.defaultValue) || S;
100
99
  },
101
100
  {
102
- value: ((O = e.columnsState) == null ? void 0 : O.value) || e.columnsStateMap,
103
- onChange: ((J = e.columnsState) == null ? void 0 : J.onChange) || e.onColumnsStateChange
101
+ value: ((J = e.columnsState) == null ? void 0 : J.value) || e.columnsStateMap,
102
+ onChange: ((M = e.columnsState) == null ? void 0 : M.onChange) || e.onColumnsStateChange
104
103
  }
105
104
  );
106
- m(() => {
107
- var n, i;
105
+ r(() => {
106
+ var n, a;
108
107
  const { persistenceType: t, persistenceKey: c, onlineGet: u } = e.columnsState || {};
109
108
  if (c && t && typeof window < "u" && t !== "online") {
110
- const a = window[t];
109
+ const i = window[t];
111
110
  try {
112
- const l = a == null ? void 0 : a.getItem(c);
113
- l ? (n = e == null ? void 0 : e.columnsState) != null && n.defaultValue ? S(
114
- r(
111
+ const l = i == null ? void 0 : i.getItem(c);
112
+ l ? (n = e == null ? void 0 : e.columnsState) != null && n.defaultValue ? m(
113
+ d(
115
114
  JSON.parse(l),
116
- (i = e == null ? void 0 : e.columnsState) == null ? void 0 : i.defaultValue
115
+ (a = e == null ? void 0 : e.columnsState) == null ? void 0 : a.defaultValue
117
116
  )
118
- ) : S(JSON.parse(l)) : S(y);
117
+ ) : m(JSON.parse(l)) : m(S);
119
118
  } catch (l) {
120
119
  console.warn(l);
121
120
  }
122
121
  }
123
122
  }, [
124
- (M = e.columnsState) == null ? void 0 : M.persistenceKey,
125
- (N = e.columnsState) == null ? void 0 : N.persistenceType,
126
- y
123
+ (N = e.columnsState) == null ? void 0 : N.persistenceKey,
124
+ (b = e.columnsState) == null ? void 0 : b.persistenceType,
125
+ S
127
126
  ]);
128
127
  const z = F(() => {
129
128
  const { persistenceType: t, persistenceKey: c } = e.columnsState || {};
@@ -136,7 +135,7 @@ function Q(e) {
136
135
  console.warn(n);
137
136
  }
138
137
  }, [e.columnsState]);
139
- m(() => {
138
+ r(() => {
140
139
  var u, n;
141
140
  if (!((u = e.columnsState) != null && u.persistenceKey) || !((n = e.columnsState) != null && n.persistenceType) || typeof window > "u")
142
141
  return;
@@ -146,51 +145,53 @@ function Q(e) {
146
145
  // onlineChange
147
146
  } = e.columnsState;
148
147
  if (t !== "online") {
149
- const i = window[t];
148
+ const a = window[t];
150
149
  try {
151
- i == null || i.setItem(c, JSON.stringify(d));
152
- } catch (a) {
153
- console.warn(a), z();
150
+ a == null || a.setItem(c, JSON.stringify(y));
151
+ } catch (i) {
152
+ console.warn(i), z();
154
153
  }
155
154
  }
156
155
  }, [
157
- (b = e.columnsState) == null ? void 0 : b.persistenceKey,
158
- d,
156
+ (j = e.columnsState) == null ? void 0 : j.persistenceKey,
157
+ y,
159
158
  (x = e.columnsState) == null ? void 0 : x.persistenceType
160
- ]), m(() => {
159
+ ]), r(() => {
161
160
  var t, c, u;
162
161
  if ((t = e.columnsState) != null && t.persistenceKey && ((c = e.columnsState) == null ? void 0 : c.persistenceType) === "online") {
163
- const { onlineGet: n, persistenceKey: i } = e.columnsState;
162
+ const { onlineGet: n, persistenceKey: a } = e.columnsState;
164
163
  try {
165
- (u = n == null ? void 0 : n(i)) == null || u.then((a) => {
166
- var s;
167
- const l = r(a, (s = e == null ? void 0 : e.columnsState) == null ? void 0 : s.value);
168
- S(l ?? {});
164
+ (u = n == null ? void 0 : n(a)) == null || u.then((i) => {
165
+ var o, s;
166
+ const l = d(i, (o = e == null ? void 0 : e.columnsState) == null ? void 0 : o.value);
167
+ m(
168
+ (s = Object.keys(l ?? {})) != null && s.length ? l ?? {} : S
169
+ );
169
170
  });
170
- } catch (a) {
171
- console.warn(a);
171
+ } catch (i) {
172
+ console.warn(i);
172
173
  }
173
174
  }
174
175
  }, []);
175
176
  const K = {
176
177
  uuid: f.current,
177
178
  persistenceType: (I = e.columnsState) == null ? void 0 : I.persistenceType,
178
- persistenceKey: (j = e.columnsState) == null ? void 0 : j.persistenceKey,
179
- onlineChange: (P = e.columnsState) == null ? void 0 : P.onlineChange,
179
+ persistenceKey: (P = e.columnsState) == null ? void 0 : P.persistenceKey,
180
+ onlineChange: (E = e.columnsState) == null ? void 0 : E.onlineChange,
180
181
  sortKeyColumns: w.current,
181
182
  setSortKeyColumns: (t) => {
182
183
  w.current = t;
183
184
  },
184
- columnsMap: d,
185
- setColumnsMap: S,
186
- setTableSize: g,
187
- tableSize: h,
188
- sizeStorageType: (E = e.sizeState) == null ? void 0 : E.persistenceType,
185
+ columnsMap: y,
186
+ setColumnsMap: m,
187
+ setTableSize: C,
188
+ tableSize: g,
189
+ sizeStorageType: (k = e.sizeState) == null ? void 0 : k.persistenceType,
189
190
  sizeStorageKey: (R = e.sizeState) == null ? void 0 : R.persistenceKey,
190
- onlineSizeChange: (k = e.sizeState) == null ? void 0 : k.onlineChange,
191
+ onlineSizeChange: (G = e.sizeState) == null ? void 0 : G.onlineChange,
191
192
  columns: e.columns,
192
193
  clearPersistenceStorage: z,
193
- defaultColumnKeyMap: y
194
+ defaultColumnKeyMap: S
194
195
  };
195
196
  return Object.defineProperty(K, "sortKeyColumns", {
196
197
  get: () => w.current