bitz-react-admin-ui 2.4.9 → 2.5.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.
@@ -27,9 +27,9 @@ const b = ({
27
27
  )
28
28
  ] }), _ = E(
29
29
  ({ loading: m, actionGroup: l, customActions: r }, p) => {
30
- const { loading: f, fullscreen: y } = L(W), o = C(() => m ?? f, [m, f]), {
30
+ const { loading: f, fullscreen: y } = L(W), a = C(() => m ?? f, [m, f]), {
31
31
  primaryBtnClassName: d,
32
- dangerBtnClassName: a,
32
+ dangerBtnClassName: o,
33
33
  secondaryBtnClassName: u,
34
34
  maskClassName: B,
35
35
  skeletonBtnClassName: h,
@@ -38,7 +38,7 @@ const b = ({
38
38
  const i = l.length >= 4 ? 2 : l.length, c = l.slice(0, i), t = [];
39
39
  if (c != null && c.length && c.forEach((e, s) => {
40
40
  t.push(
41
- o ? /* @__PURE__ */ n.jsx(
41
+ a ? /* @__PURE__ */ n.jsx(
42
42
  b,
43
43
  {
44
44
  className: h,
@@ -50,14 +50,14 @@ const b = ({
50
50
  x,
51
51
  {
52
52
  type: "text",
53
- className: e.danger ? a : d,
53
+ className: e.danger ? o : d,
54
54
  children: e == null ? void 0 : e.label
55
55
  }
56
56
  ) }, s) : /* @__PURE__ */ n.jsx(
57
57
  x,
58
58
  {
59
59
  type: "text",
60
- className: e.danger ? a : d,
60
+ className: e.danger ? o : d,
61
61
  onClick: e == null ? void 0 : e.onClick,
62
62
  children: e == null ? void 0 : e.label
63
63
  },
@@ -67,7 +67,7 @@ const b = ({
67
67
  }), i === 2 && l.length >= 4) {
68
68
  const e = l.slice(2, l.length);
69
69
  t.push(
70
- o ? /* @__PURE__ */ n.jsx(
70
+ a ? /* @__PURE__ */ n.jsx(
71
71
  b,
72
72
  {
73
73
  className: h,
@@ -79,7 +79,7 @@ const b = ({
79
79
  );
80
80
  }
81
81
  return t;
82
- }, [o, l]), k = C(() => {
82
+ }, [a, l]), k = C(() => {
83
83
  if (!(r != null && r.length))
84
84
  return;
85
85
  const i = r.map((t, e) => /* @__PURE__ */ n.jsx(
@@ -95,7 +95,7 @@ const b = ({
95
95
  x,
96
96
  {
97
97
  type: "text",
98
- className: t.danger ? a : d,
98
+ className: t.danger ? o : d,
99
99
  onClick: t.onClick,
100
100
  children: t == null ? void 0 : t.label
101
101
  },
@@ -114,9 +114,9 @@ const b = ({
114
114
  const N = t.render ?? ((z, S) => /* @__PURE__ */ n.jsx(M, { children: z }, S));
115
115
  return N == null ? void 0 : N(s, e);
116
116
  });
117
- return o ? i : c;
118
- }, [o, r]);
119
- return /* @__PURE__ */ n.jsxs("div", { onClick: (i) => i.stopPropagation(), children: [
117
+ return a ? i : c;
118
+ }, [a, r]);
119
+ return /* @__PURE__ */ n.jsxs("div", { onClick: (i) => i.stopPropagation(), style: { overflow: "hidden" }, children: [
120
120
  /* @__PURE__ */ n.jsx(I, { size: H, ref: p, className: "actionGroup", children: k ?? j }),
121
121
  /* @__PURE__ */ n.jsx("div", { className: B })
122
122
  ] });
@@ -124,7 +124,7 @@ const b = ({
124
124
  );
125
125
  function $(m) {
126
126
  var h;
127
- const { actionGroup: l, loading: r, customActions: p, defaultWidth: f, ...y } = m, o = ((h = P.useToken().token.Table) == null ? void 0 : h.cellPaddingInline) ?? O, d = D(null), a = T(d), u = C(() => a != null && a.width ? a.width + o * 2 + 1 : f ?? 141, [a, o, f]);
127
+ const { actionGroup: l, loading: r, customActions: p, defaultWidth: f, ...y } = m, a = ((h = P.useToken().token.Table) == null ? void 0 : h.cellPaddingInline) ?? O, d = D(null), o = T(d), u = C(() => o != null && o.width ? o.width + a * 2 + 1 : f ?? 141, [o, a, f]);
128
128
  return C(() => ({
129
129
  width: Math.floor(u),
130
130
  mobileHide: !0,
@@ -108,6 +108,7 @@ declare function useContainer(props: UseContainerProps): {
108
108
  persistenceType: "online" | "localStorage" | "sessionStorage" | undefined;
109
109
  persistenceKey: any;
110
110
  onlineChange: ((key: any, ColumnsState: Record<string, ColumnsConfigProps>) => void) | undefined;
111
+ finish: boolean;
111
112
  columnsMap: Record<string, ColumnsConfigProps>;
112
113
  setColumnsMap: (updater: Record<string, ColumnsConfigProps> | ((origin: Record<string, ColumnsConfigProps>) => Record<string, ColumnsConfigProps>), ignoreDestroy?: boolean | undefined) => void;
113
114
  defaultColumnKeyMap: Record<string, ColumnsConfigProps>;
@@ -147,6 +148,7 @@ declare const BitzTableContext: import("react").Context<{
147
148
  persistenceType: "online" | "localStorage" | "sessionStorage" | undefined;
148
149
  persistenceKey: any;
149
150
  onlineChange: ((key: any, ColumnsState: Record<string, ColumnsConfigProps>) => void) | undefined;
151
+ finish: boolean;
150
152
  columnsMap: Record<string, ColumnsConfigProps>;
151
153
  setColumnsMap: (updater: Record<string, ColumnsConfigProps> | ((origin: Record<string, ColumnsConfigProps>) => Record<string, ColumnsConfigProps>), ignoreDestroy?: boolean | undefined) => void;
152
154
  defaultColumnKeyMap: Record<string, ColumnsConfigProps>;
@@ -1,12 +1,12 @@
1
- import { j as Ke } from "../../../node_modules/.store/react@18.3.1/node_modules/react/jsx-runtime.mjs";
1
+ import { j as Ve } from "../../../node_modules/.store/react@18.3.1/node_modules/react/jsx-runtime.mjs";
2
2
  import { Table as le } from "antd";
3
- import V from "../../../hooks/useMergedState.mjs";
4
- import { createContext as Oe, useRef as Ve, useState as v, useContext as ve, useEffect as d, useMemo as g, useCallback as z } from "react";
3
+ import v from "../../../hooks/useMergedState.mjs";
4
+ import { createContext as ve, useRef as ze, useState as K, useContext as Ne, useEffect as d, useMemo as g, useCallback as z } from "react";
5
5
  import { genColumnKey as N } from "./utils/index.mjs";
6
- import { getUuid as ze } from "../../../utils/uuid.mjs";
7
- import { BitzConfigContext as Ne } from "../../BitzConfigProvider/context.mjs";
6
+ import { getUuid as Ee } from "../../../utils/uuid.mjs";
7
+ import { BitzConfigContext as Ie } from "../../BitzConfigProvider/context.mjs";
8
8
  import m from "../../../node_modules/.store/lodash-es@4.17.21/node_modules/lodash-es/merge.mjs";
9
- const Ee = {
9
+ const Je = {
10
10
  fixed: "left",
11
11
  className: "sorterCol",
12
12
  isDragSorterCol: !0,
@@ -16,18 +16,18 @@ const Ee = {
16
16
  onCell: () => ({
17
17
  "data-column-name": "dragSorterCell"
18
18
  })
19
- }, Ie = [
20
- Ee,
19
+ }, Be = [
20
+ Je,
21
21
  le.SELECTION_COLUMN,
22
22
  le.EXPAND_COLUMN
23
23
  ];
24
- function Je(e) {
25
- var k, H, R, L, P, U, D, _, G, W, Z, A, F, X, q, Q, Y, $, p, ee, te, ne, ie, ae, oe;
26
- const T = Ve(ze()), [fe, re] = v(!1), [se, ue] = v(!1), [de, ye] = v(0), s = ve(Ne).Table, Se = s == null ? void 0 : s.defaultSize, E = e.size ?? e.defaultSize ?? Se ?? "lg", Ce = e.zebra ?? e.defaultZebra ?? (s == null ? void 0 : s.zebra) ?? !0, ge = e.bordered ?? e.defaultBordered ?? (s == null ? void 0 : s.bordered) ?? "row-column", K = e.defaultStylesConfig || {
24
+ function je(e) {
25
+ var k, H, R, L, P, U, D, _, F, G, W, Z, A, X, q, Q, Y, $, p, ee, te, ne, ie, ae, oe;
26
+ const T = ze(Ee()), [fe, re] = K(!1), [se, ue] = K(!1), [de, ye] = K(0), s = Ne(Ie).Table, Se = s == null ? void 0 : s.defaultSize, E = e.size ?? e.defaultSize ?? Se ?? "lg", Ce = e.zebra ?? e.defaultZebra ?? (s == null ? void 0 : s.zebra) ?? !0, ge = e.bordered ?? e.defaultBordered ?? (s == null ? void 0 : s.bordered) ?? "row-column", O = e.defaultStylesConfig || {
27
27
  size: E,
28
28
  zebra: Ce,
29
29
  bordered: ge
30
- }, [y, I] = V(
30
+ }, [y, I] = v(
31
31
  () => {
32
32
  var n, c, l, a;
33
33
  const { persistenceType: t, persistenceKey: i, onlineGet: o } = e.stylesConfigState || {};
@@ -44,7 +44,7 @@ function Je(e) {
44
44
  console.warn(r);
45
45
  }
46
46
  }
47
- return e.stylesConfig || ((l = e.stylesConfigState) == null ? void 0 : l.value) || ((a = e.stylesConfigState) == null ? void 0 : a.defaultValue) || K;
47
+ return e.stylesConfig || ((l = e.stylesConfigState) == null ? void 0 : l.value) || ((a = e.stylesConfigState) == null ? void 0 : a.defaultValue) || O;
48
48
  },
49
49
  {
50
50
  value: ((k = e.stylesConfigState) == null ? void 0 : k.value) || e.stylesConfig,
@@ -81,7 +81,7 @@ function Je(e) {
81
81
  var f;
82
82
  const a = m(l ?? {}, (f = e == null ? void 0 : e.stylesConfigState) == null ? void 0 : f.value);
83
83
  I(
84
- Object.keys(a).length ? a : K
84
+ Object.keys(a).length ? a : O
85
85
  );
86
86
  });
87
87
  } catch (l) {
@@ -89,7 +89,7 @@ function Je(e) {
89
89
  }
90
90
  }
91
91
  }, []);
92
- const u = g(() => (e.columns ?? []).filter((t) => !Ie.includes(t)), [e.columns]), x = g(() => {
92
+ const u = g(() => (e.columns ?? []).filter((t) => !Be.includes(t)), [e.columns]), x = g(() => {
93
93
  var i;
94
94
  if ((i = e == null ? void 0 : e.exportConfigState) != null && i.defaultValue)
95
95
  return e.exportConfigState.defaultValue;
@@ -108,7 +108,7 @@ function Je(e) {
108
108
  show: !0
109
109
  });
110
110
  }), t;
111
- }, [u]), [O, h] = V(
111
+ }, [u]), [V, h] = v(
112
112
  () => {
113
113
  var n, c, l, a;
114
114
  const { persistenceType: t, persistenceKey: i, onlineGet: o } = e.exportConfigState || {};
@@ -165,15 +165,15 @@ function Je(e) {
165
165
  if (t !== "online") {
166
166
  const c = window[t];
167
167
  try {
168
- c == null || c.setItem(i, JSON.stringify(O));
168
+ c == null || c.setItem(i, JSON.stringify(V));
169
169
  } catch (l) {
170
170
  console.warn(l), j();
171
171
  }
172
172
  }
173
173
  }, [
174
- (G = e.exportConfigState) == null ? void 0 : G.persistenceKey,
175
- O,
176
- (W = e.exportConfigState) == null ? void 0 : W.persistenceType
174
+ (F = e.exportConfigState) == null ? void 0 : F.persistenceKey,
175
+ V,
176
+ (G = e.exportConfigState) == null ? void 0 : G.persistenceType
177
177
  ]), d(() => {
178
178
  var t, i, o;
179
179
  if ((t = e.exportConfigState) != null && t.persistenceKey && ((i = e.exportConfigState) == null ? void 0 : i.persistenceType) === "online") {
@@ -197,15 +197,20 @@ function Je(e) {
197
197
  return e.columnsState.defaultValue;
198
198
  const t = u.filter((a) => a.fixed === "left").map((a, f) => ({ ...a, order: f })), i = u.filter((a) => a.fixed === "right").map((a, f) => ({ ...a, order: f })), o = u.filter((a) => !["left", "right"].includes(a.fixed)).map((a, f) => ({ ...a, order: f })), n = [...t, ...o, ...i], c = {};
199
199
  return n.forEach((a, f) => {
200
- const { order: r, fixed: Te, disabled: be } = a, ce = N(a, f);
200
+ const {
201
+ order: r,
202
+ /*width,*/
203
+ fixed: Ke,
204
+ disabled: Oe
205
+ } = a, ce = N(a, f);
201
206
  ce && (c[ce] = {
202
207
  show: !0,
203
208
  order: r,
204
- fixed: Te,
205
- disabled: be
209
+ fixed: Ke,
210
+ disabled: Oe
206
211
  });
207
212
  }), c;
208
- }, [u]), [C, w] = V(
213
+ }, [u]), [me, we] = K(!1), [C, w] = v(
209
214
  () => {
210
215
  var n, c, l, a;
211
216
  const { persistenceType: t, persistenceKey: i, onlineGet: o } = e.columnsState || {};
@@ -225,8 +230,8 @@ function Je(e) {
225
230
  return e.columnsStateMap || ((l = e.columnsState) == null ? void 0 : l.value) || ((a = e.columnsState) == null ? void 0 : a.defaultValue) || {};
226
231
  },
227
232
  {
228
- value: ((Z = e.columnsState) == null ? void 0 : Z.value) || e.columnsStateMap,
229
- onChange: ((A = e.columnsState) == null ? void 0 : A.onChange) || e.onColumnsStateChange
233
+ value: ((W = e.columnsState) == null ? void 0 : W.value) || e.columnsStateMap,
234
+ onChange: ((Z = e.columnsState) == null ? void 0 : Z.onChange) || e.onColumnsStateChange
230
235
  }
231
236
  );
232
237
  d(() => {
@@ -247,7 +252,7 @@ function Je(e) {
247
252
  }
248
253
  }
249
254
  }, [
250
- (F = e.columnsState) == null ? void 0 : F.persistenceKey,
255
+ (A = e.columnsState) == null ? void 0 : A.persistenceKey,
251
256
  (X = e.columnsState) == null ? void 0 : X.persistenceType,
252
257
  S
253
258
  ]);
@@ -311,7 +316,7 @@ function Je(e) {
311
316
  (o = n == null ? void 0 : n(c)) == null || o.then((l) => {
312
317
  var f;
313
318
  const a = m(l ?? {}, (f = e == null ? void 0 : e.columnsState) == null ? void 0 : f.value);
314
- w(a);
319
+ w(a), we(!0);
315
320
  });
316
321
  } catch (l) {
317
322
  console.warn(l);
@@ -325,7 +330,7 @@ function Je(e) {
325
330
  !(((i = C == null ? void 0 : C[c]) == null ? void 0 : i.fixed) === ((o = S == null ? void 0 : S[c]) == null ? void 0 : o.fixed)) && Object.keys(C ?? {}).length === 0 && w(S);
326
331
  }
327
332
  }, [S, C]);
328
- const me = g(() => (e == null ? void 0 : e.rowHoverable) ?? (s == null ? void 0 : s.rowHoverable) ?? !0, [e == null ? void 0 : e.rowHoverable, s == null ? void 0 : s.rowHoverable]), we = g(() => e.zebra ?? y.zebra, [e.zebra, y.zebra]), b = g(() => e.bordered ?? y.bordered, [e.bordered, y.bordered]), xe = g(() => ["column", "row-column"].includes(b), [b]), he = g(() => {
333
+ const xe = g(() => (e == null ? void 0 : e.rowHoverable) ?? (s == null ? void 0 : s.rowHoverable) ?? !0, [e == null ? void 0 : e.rowHoverable, s == null ? void 0 : s.rowHoverable]), he = g(() => e.zebra ?? y.zebra, [e.zebra, y.zebra]), b = g(() => e.bordered ?? y.bordered, [e.bordered, y.bordered]), Te = g(() => ["column", "row-column"].includes(b), [b]), be = g(() => {
329
334
  let t = !1;
330
335
  return ["hide", "column"].includes(b) && (t = !0), t;
331
336
  }, [b]), M = {
@@ -342,6 +347,7 @@ function Je(e) {
342
347
  persistenceType: (Y = e.columnsState) == null ? void 0 : Y.persistenceType,
343
348
  persistenceKey: ($ = e.columnsState) == null ? void 0 : $.persistenceKey,
344
349
  onlineChange: (p = e.columnsState) == null ? void 0 : p.onlineChange,
350
+ finish: me,
345
351
  columnsMap: C,
346
352
  setColumnsMap: w,
347
353
  defaultColumnKeyMap: S,
@@ -354,30 +360,30 @@ function Je(e) {
354
360
  stylesStorageKey: (te = e.stylesConfigState) == null ? void 0 : te.persistenceKey,
355
361
  onlineStylesConfigChange: (ne = e.stylesConfigState) == null ? void 0 : ne.onlineChange,
356
362
  clearStylesConfigCache: B,
357
- defaultTableStylesConfig: K,
358
- exportConfig: O,
363
+ defaultTableStylesConfig: O,
364
+ exportConfig: V,
359
365
  setTableExportConfig: h,
360
366
  defaultTableExportConfig: x,
361
367
  exportStorageType: (ie = e.exportConfigState) == null ? void 0 : ie.persistenceType,
362
368
  exportStorageKey: (ae = e.exportConfigState) == null ? void 0 : ae.persistenceKey,
363
369
  onlineExportConfigChange: (oe = e.exportConfigState) == null ? void 0 : oe.onlineChange,
364
370
  clearExportConfigCache: j,
365
- zebra: we,
366
- rowHoverable: me,
367
- showColumnBorder: xe,
368
- hideRowBorder: he
371
+ zebra: he,
372
+ rowHoverable: xe,
373
+ showColumnBorder: Te,
374
+ hideRowBorder: be
369
375
  };
370
376
  return Object.defineProperty(M, "uuid", {
371
377
  get: () => T.current
372
378
  }), M;
373
379
  }
374
- const Be = Oe({}), De = (e) => {
375
- const T = Je(e.initValue);
376
- return /* @__PURE__ */ Ke.jsx(Be.Provider, { value: T, children: e.children });
380
+ const Me = ve({}), Fe = (e) => {
381
+ const T = je(e.initValue);
382
+ return /* @__PURE__ */ Ve.jsx(Me.Provider, { value: T, children: e.children });
377
383
  };
378
384
  export {
379
- Be as BitzTableContext,
380
- Ee as SORTER_COLUMN,
381
- De as default,
382
- Ie as toolCols
385
+ Me as BitzTableContext,
386
+ Je as SORTER_COLUMN,
387
+ Fe as default,
388
+ Be as toolCols
383
389
  };
@@ -1,10 +1,6 @@
1
1
  import { ColumnsConfigProps } from '../../';
2
2
  /** 删掉不应该显示的 */
3
- export declare const loopFilter: (columns: any[], columnsMap: any) => {
4
- filterColumns: any[];
5
- hiddenTotalWidth: number;
6
- autoWidthColLength: number;
7
- };
3
+ export declare const loopFilter: (columns: any[], columnsMap: any, finish: boolean) => any[];
8
4
  /**
9
5
  * 生成列唯一key
10
6
  *
@@ -1,42 +1,41 @@
1
- const u = (e, d) => {
2
- let o = 0, r = 0;
3
- return {
4
- filterColumns: ((i, l) => i.map((n) => {
5
- const t = h(n, n.index), s = l[t];
6
- return s && s.show === !1 ? (typeof n.width == "number" ? o += n.width : r += 1, !1) : { ...n, ...s };
7
- }))(e, d).filter(Boolean),
8
- hiddenTotalWidth: Math.floor(o),
9
- autoWidthColLength: r
1
+ const l = (e, i, x) => ((f, d) => f.map((t) => {
2
+ const s = u(t, t.index), o = d[s];
3
+ return o && o.show === !1 ? !1 : {
4
+ ...t,
5
+ ...o
6
+ // ...(item?.isOperationCol && !finish) && {
7
+ // width: item?.width,
8
+ // },
10
9
  };
11
- }, h = (e, d) => "key" in e && e.key !== void 0 && e.key !== null ? e.key : e.dataIndex ? Array.isArray(e.dataIndex) ? e.dataIndex.join("-") : e.dataIndex : `${d}`, c = (e) => (d, o) => {
12
- var t, s, x, y;
13
- const { fixed: r, index: a } = d, { fixed: f, index: i } = o;
14
- if (r === "left" && f !== "left" || f === "right" && r !== "right")
10
+ }))(e, i).filter(Boolean), u = (e, i) => "key" in e && e.key !== void 0 && e.key !== null ? e.key : e.dataIndex ? Array.isArray(e.dataIndex) ? e.dataIndex.join("-") : e.dataIndex : `${i}`, k = (e) => (i, x) => {
11
+ var r, y, a, c;
12
+ const { fixed: n, index: f } = i, { fixed: d, index: t } = x;
13
+ if (n === "left" && d !== "left" || d === "right" && n !== "right")
15
14
  return -2;
16
- if (f === "left" && r !== "left" || r === "right" && f !== "right")
15
+ if (d === "left" && n !== "left" || n === "right" && d !== "right")
17
16
  return 2;
18
- const l = d.key || `${a}`, n = o.key || `${i}`;
19
- return (t = e[l]) != null && t.order || (s = e[n]) != null && s.order ? (((x = e[l]) == null ? void 0 : x.order) || 0) - (((y = e[n]) == null ? void 0 : y.order) || 0) : (d.index || 0) - (o.index || 0);
17
+ const s = i.key || `${f}`, o = x.key || `${t}`;
18
+ return (r = e[s]) != null && r.order || (y = e[o]) != null && y.order ? (((a = e[s]) == null ? void 0 : a.order) || 0) - (((c = e[o]) == null ? void 0 : c.order) || 0) : (i.index || 0) - (x.index || 0);
20
19
  };
21
- function k(e, d, o) {
22
- const r = {};
23
- let a = "";
24
- const f = (i, l, n) => {
25
- for (const t in i)
26
- if (i.hasOwnProperty(t) && (typeof i[t] == "object" && i[t] !== null && (a = t, r[t] = { ...i[t] }, f(i[t], l, n)), t === l)) {
27
- const s = r[a];
28
- r[a] = {
29
- ...s,
30
- [l]: n
20
+ function h(e, i, x) {
21
+ const n = {};
22
+ let f = "";
23
+ const d = (t, s, o) => {
24
+ for (const r in t)
25
+ if (t.hasOwnProperty(r) && (typeof t[r] == "object" && t[r] !== null && (f = r, n[r] = { ...t[r] }, d(t[r], s, o)), r === s)) {
26
+ const y = n[f];
27
+ n[f] = {
28
+ ...y,
29
+ [s]: o
31
30
  // [prop]: current.disabled || current.fixed ? true : val,
32
- }, a = "";
31
+ }, f = "";
33
32
  }
34
33
  };
35
- return f(e, d, o), r;
34
+ return d(e, i, x), n;
36
35
  }
37
36
  export {
38
- c as columnSort,
39
- h as genColumnKey,
40
- u as loopFilter,
41
- k as updateNestedObject
37
+ k as columnSort,
38
+ u as genColumnKey,
39
+ l as loopFilter,
40
+ h as updateNestedObject
42
41
  };
@@ -1,67 +1,76 @@
1
- import { j as i } from "../../../node_modules/.store/react@18.3.1/node_modules/react/jsx-runtime.mjs";
2
- import { Resizable as W } from "../../../node_modules/.store/react-resizable@3.0.5/node_modules/react-resizable/index.mjs";
3
- import { useState as y, useMemo as z, useRef as a } from "react";
4
- import $ from "../../../node_modules/.store/classnames@2.5.1/node_modules/classnames/index.mjs";
5
- const f = 56, B = (p) => {
6
- const { hasScrollBar: g, scrollbarSize: S, onResize: w, width: r, datagridref: L, stretchref: u, ...P } = p, [j, m] = y(!1), x = z(() => {
7
- var t, n;
8
- const e = { ...P };
9
- return ((t = e.className) == null ? void 0 : t.includes("ant-table-cell-fix-right")) && !g && ((n = e.style) != null && n.right) && (e.style = { ...e.style ?? {} }, e.style.right = Number(e.style.right ?? 0) - (S || 0)), e;
10
- }, [p]), [R, b] = y(0), c = a(0), h = a(0), l = a(0), o = a(!1), d = z(() => c.current - r + f, [c.current, r]);
11
- if (!r)
12
- return /* @__PURE__ */ i.jsx("th", { ...x });
13
- const D = (e) => {
14
- let s = e.offsetLeft, t = e.offsetParent;
1
+ import { j as o } from "../../../node_modules/.store/react@18.3.1/node_modules/react/jsx-runtime.mjs";
2
+ import { Resizable as v } from "../../../node_modules/.store/react-resizable@3.0.5/node_modules/react-resizable/index.mjs";
3
+ import { useState as E, useMemo as R, useRef as i } from "react";
4
+ import O from "../../../node_modules/.store/classnames@2.5.1/node_modules/classnames/index.mjs";
5
+ const h = 56, H = (d) => {
6
+ const { hasScrollBar: b, scrollbarSize: x, onResize: y, width: n, datagridref: g, stretchref: a, ...S } = d, [P, p] = E(!1), m = R(() => {
7
+ var t, z;
8
+ const e = { ...S };
9
+ return ((t = e.className) == null ? void 0 : t.includes("ant-table-cell-fix-right")) && !b && ((z = e.style) != null && z.right) && (e.style = { ...e.style ?? {} }, e.style.right = Number(e.style.right ?? 0) - (x || 0)), e;
10
+ }, [d]), c = i(0), u = i(0), s = i(0), l = i(!1), f = R(() => c.current - n + h, [c.current, n]);
11
+ if (!n)
12
+ return /* @__PURE__ */ o.jsx("th", { ...m });
13
+ const j = (e) => {
14
+ let r = e.offsetLeft, t = e.offsetParent;
15
15
  for (; t !== null; )
16
- s += t.offsetLeft, t = t.offsetParent;
17
- return { x: s };
18
- }, N = (e, { size: s }) => {
19
- let t = s.width - r, n = c.current + t;
20
- if (l.current = e.clientX - h.current, r + n - c.current <= f || l.current < d) {
21
- o.current = !0;
16
+ r += t.offsetLeft, t = t.offsetParent;
17
+ return { x: r };
18
+ }, L = (e) => {
19
+ if (s.current = e.clientX - u.current, n + s.current - c.current <= h || s.current < f) {
20
+ l.current = !0;
22
21
  return;
23
22
  }
24
- const E = u.current;
25
- l.current >= d && o.current && (n = d, t = f - r, o.current = !1), E.style.left = `${n}px`, b(t);
26
- }, O = (e) => {
27
- m(!0);
28
- const s = u.current;
29
- s.style.opacity = 1, s.style.pointerEvents = "auto", h.current = D(L.current).x;
30
- const t = e.clientX - h.current;
31
- s.style.left = `${t}px`, c.current = t, l.current = t;
32
- }, X = (e, s) => {
33
- b(0), o.current = !1, m(!1);
34
- const t = u.current;
23
+ s.current >= f && l.current && (s.current = f, l.current = !1);
24
+ const t = a.current;
25
+ t.style.left = `${s.current}px`;
26
+ }, w = (e) => {
27
+ p(!0), s.current = 0;
28
+ const r = a.current;
29
+ r.style.opacity = 1, r.style.pointerEvents = "auto", u.current = j(g.current).x;
30
+ const t = e.clientX - u.current;
31
+ r.style.left = `${t}px`, c.current = t, s.current = t;
32
+ }, D = (e, r) => {
33
+ l.current = !1, p(!1);
34
+ const t = a.current;
35
35
  t.style.opacity = 0, t.style.pointerEvents = "none", setTimeout(() => {
36
36
  t.style.left = "0px";
37
- }, 200), w(e, { ...s, minWidth: f });
38
- }, v = /* @__PURE__ */ i.jsx(
37
+ }, 200), y(
38
+ e,
39
+ {
40
+ ...r,
41
+ minWidth: h,
42
+ size: {
43
+ ...r.size,
44
+ width: n + s.current - c.current
45
+ }
46
+ }
47
+ );
48
+ }, N = /* @__PURE__ */ o.jsx(
39
49
  "span",
40
50
  {
41
51
  className: "bitzResizableHandle",
42
- style: { transform: `translateX(${R}px)` },
43
52
  onClick: (e) => {
44
53
  e.stopPropagation(), e.preventDefault();
45
54
  }
46
55
  }
47
56
  );
48
- return /* @__PURE__ */ i.jsx(
49
- W,
57
+ return /* @__PURE__ */ o.jsx(
58
+ v,
50
59
  {
51
- width: r + R,
60
+ width: n,
52
61
  height: 0,
53
- handle: v,
54
- className: $("bitzResizable", {
55
- disabledUserSelect: j
62
+ handle: N,
63
+ className: O("bitzResizable", {
64
+ disabledUserSelect: P
56
65
  }),
57
- onResize: N,
58
- onResizeStart: O,
59
- onResizeStop: X,
66
+ onResize: L,
67
+ onResizeStart: w,
68
+ onResizeStop: D,
60
69
  draggableOpts: { enableUserSelectHack: !1 },
61
- children: /* @__PURE__ */ i.jsx("th", { ...x })
70
+ children: /* @__PURE__ */ o.jsx("th", { ...m })
62
71
  }
63
72
  );
64
73
  };
65
74
  export {
66
- B as default
75
+ H as default
67
76
  };
@@ -62,6 +62,8 @@ export interface BitzTableProps<RecordType = any> extends Omit<TableProps<Record
62
62
  enabledRowDragSort?: boolean;
63
63
  /** PC端:拖拽结束 */
64
64
  onRowDragEnd?: (newCols: RecordType[]) => void;
65
+ /** PC端:是否启用列宽拖拽 */
66
+ resizableColumns?: boolean;
65
67
  /** 移动端:操作按钮 */
66
68
  operationFilter?: ActionsFunType<RecordType>;
67
69
  /** 移动端:加载更多返回函数 */