bitz-react-admin-ui 2.4.3 → 2.4.5

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,5 +1,7 @@
1
1
  import { BitzTableColumnsType } from '..';
2
2
  /** build skeleton */
3
3
  export declare function loopBuildSkeleton<T>(columns: BitzTableColumnsType<T>): BitzTableColumnsType<T>;
4
+ /** 重置 tbody 的滚动条位置 */
5
+ export declare const resetScroll: (ref: any) => void;
4
6
  /** 设置复选框列、展开列的位置 */
5
7
  export declare function getColumnsWithTool<T>(cols: any, sortCols: any, enabledRowDragSort: any, showRowSelection: any, showExpandable: any): BitzTableColumnsType<T>;
@@ -1,47 +1,56 @@
1
- import { j as p } from "../../../node_modules/.store/react@18.3.1/node_modules/react/jsx-runtime.mjs";
2
- import { Skeleton as a, Table as s } from "antd";
3
- import { toolCols as I, SORTER_COLUMN as x } from "../Store/index.mjs";
4
- function O(l) {
5
- return l == null ? void 0 : l.map((o) => {
6
- const e = { ...o };
7
- return o != null && o.isOperationCol || o != null && o.isCheckboxCol || o != null && o.isExpandIconCol || I.includes(o) ? o : (e != null && e.children && (e.children = O(e == null ? void 0 : e.children)), {
8
- ...e,
1
+ import { j as a } from "../../../node_modules/.store/react@18.3.1/node_modules/react/jsx-runtime.mjs";
2
+ import { Skeleton as p, Table as d } from "antd";
3
+ import { toolCols as u, SORTER_COLUMN as x } from "../Store/index.mjs";
4
+ function I(t) {
5
+ return t == null ? void 0 : t.map((e) => {
6
+ const o = { ...e };
7
+ return e != null && e.isOperationCol || e != null && e.isCheckboxCol || e != null && e.isExpandIconCol || u.includes(e) ? e : (o != null && o.children && (o.children = I(o == null ? void 0 : o.children)), {
8
+ ...o,
9
9
  sorter: !1,
10
- render: (c, d, t) => /* @__PURE__ */ p.jsx(
11
- a,
10
+ render: (r, i, l) => /* @__PURE__ */ a.jsx(
11
+ p,
12
12
  {
13
13
  active: !0,
14
14
  title: !1,
15
15
  paragraph: {
16
16
  rows: 1,
17
- width: (t + 1) % 2 === 0 ? "100%" : "60%"
17
+ width: (l + 1) % 2 === 0 ? "100%" : "60%"
18
18
  }
19
19
  }
20
20
  )
21
21
  });
22
22
  });
23
23
  }
24
- const u = 0, E = 1, h = 2;
25
- function k(l, o, e, c, d) {
26
- const t = [...l ?? []], i = [...o];
27
- let r = u;
28
- if (e) {
29
- const n = t.indexOf(x);
30
- n >= 0 && (r = n), i.splice(r, 0, x);
24
+ const L = (t) => {
25
+ var o, r, i, l;
26
+ let e = (r = (o = t.current) == null ? void 0 : o.nativeElement) == null ? void 0 : r.querySelector(".ant-table-content");
27
+ e || (e = (l = (i = t.current) == null ? void 0 : i.nativeElement) == null ? void 0 : l.querySelector(".ant-table-body")), e && e.scroll({
28
+ top: 0,
29
+ left: 0
30
+ // behavior: 'smooth'
31
+ });
32
+ }, E = 0, O = 1, h = 2;
33
+ function b(t, e, o, r, i) {
34
+ const l = [...t ?? []], c = [...e];
35
+ let f = E;
36
+ if (o) {
37
+ const n = l.indexOf(x);
38
+ n >= 0 && (f = n), c.splice(f, 0, x);
31
39
  }
32
- let f = 0;
33
- if (c) {
34
- const n = t.indexOf(s.SELECTION_COLUMN);
35
- n >= 0 && (f = n), e && r === 0 && n === -1 && (f = E), i.splice(f, 0, s.SELECTION_COLUMN);
40
+ let s = 0;
41
+ if (r) {
42
+ const n = l.indexOf(d.SELECTION_COLUMN);
43
+ n >= 0 && (s = n), o && f === 0 && n === -1 && (s = O), c.splice(s, 0, d.SELECTION_COLUMN);
36
44
  }
37
- if (d) {
45
+ if (i) {
38
46
  let n = 0;
39
- const C = t.indexOf(s.EXPAND_COLUMN);
40
- C >= 0 && (n = C), e && r === 0 && C === -1 && (n = 1), c && f === 1 && C === -1 && (n = h), i.splice(n, 0, s.EXPAND_COLUMN);
47
+ const C = l.indexOf(d.EXPAND_COLUMN);
48
+ C >= 0 && (n = C), o && f === 0 && C === -1 && (n = 1), r && s === 1 && C === -1 && (n = h), c.splice(n, 0, d.EXPAND_COLUMN);
41
49
  }
42
- return i;
50
+ return c;
43
51
  }
44
52
  export {
45
- k as getColumnsWithTool,
46
- O as loopBuildSkeleton
53
+ b as getColumnsWithTool,
54
+ I as loopBuildSkeleton,
55
+ L as resetScroll
47
56
  };
@@ -40,10 +40,12 @@ type ActionGroupFunType<T> = (record: T, index: number) => Action<T>[];
40
40
  type CustomActionsProps<T> = {
41
41
  custom: CustomActionsFunType<T>;
42
42
  request?: (record: T, index: number) => Promise<CustomAction[]>;
43
+ onClick?: (key: any) => void;
43
44
  };
44
45
  type ActionsFunType<T> = ActionGroupFunType<T> | CustomActionsProps<T>;
45
46
  /** ActionCol hook参数 */
46
47
  interface BitzTableActionColProps<T> extends Pick<BitzTableActionProps<T>, 'loading'>, Omit<BitzTableColumnType<T>, 'width' | 'render'> {
48
+ defaultWidth?: number;
47
49
  actionGroup?: ActionGroupFunType<T>;
48
50
  customActions?: CustomActionsFunType<T>;
49
51
  }
@@ -5,5 +5,5 @@ export interface SelectProps<T extends BaseOptionType> extends Omit<BitzTableSel
5
5
  onChange?: (value: Key[], options: T[]) => void;
6
6
  }
7
7
  /** 下拉表格组件 */
8
- declare function TableSelect<T extends BaseOptionType>({ value, options: dataRows, columns, tableData, total, loading, loadingFailed, loadAgain, page, onPageChange, searchInput, showToolTagSelect, toolTags, onToolTagChange, lrLayout, parentRender, mode, placeholder, fieldNames, onChange, onOpenChange, ...rest }: SelectProps<T>): import("react/jsx-runtime").JSX.Element;
8
+ declare function TableSelect<T extends BaseOptionType>({ value, options: dataRows, columns, tableData, total, loading, loadingFailed, loadAgain, page, onPageChange, searchInput, showToolTagSelect, toolTags, onToolTagChange, lrLayout, parentRender, mode, placeholder, fieldNames, onChange, onPopupVisibleChange, ...rest }: SelectProps<T>): import("react/jsx-runtime").JSX.Element;
9
9
  export default TableSelect;
@@ -1,85 +1,85 @@
1
- import { j as b } from "../../../node_modules/.store/react@18.3.1/node_modules/react/jsx-runtime.mjs";
2
- import { useState as o, useEffect as x } from "react";
1
+ import { j as x } from "../../../node_modules/.store/react@18.3.1/node_modules/react/jsx-runtime.mjs";
2
+ import { useState as o, useEffect as b } from "react";
3
3
  import { Select as M } from "antd";
4
4
  import Q from "../SelectPopup/index.mjs";
5
5
  function Z({
6
- value: s,
7
- options: t,
8
- columns: V,
9
- tableData: j,
10
- total: w,
11
- loading: T,
12
- loadingFailed: a,
13
- loadAgain: k,
14
- page: y,
15
- onPageChange: E,
16
- searchInput: A,
17
- showToolTagSelect: B,
18
- toolTags: D,
19
- onToolTagChange: P,
20
- lrLayout: d,
21
- parentRender: v,
22
- mode: F = "multiple",
23
- placeholder: N = "请选择",
6
+ value: l,
7
+ options: r,
8
+ columns: j,
9
+ tableData: w,
10
+ total: T,
11
+ loading: a,
12
+ loadingFailed: k,
13
+ loadAgain: y,
14
+ page: E,
15
+ onPageChange: A,
16
+ searchInput: B,
17
+ showToolTagSelect: D,
18
+ toolTags: V,
19
+ onToolTagChange: d,
20
+ lrLayout: v,
21
+ parentRender: F,
22
+ mode: N = "multiple",
23
+ placeholder: O = "请选择",
24
24
  fieldNames: p,
25
25
  onChange: e,
26
- onOpenChange: c,
26
+ onPopupVisibleChange: f,
27
27
  ...$
28
28
  }) {
29
- const [u, q] = o([]), [S, i] = o([]), [f, m] = o(!1), [z, G] = o(!1), H = () => {
30
- i([]), e == null || e([], []);
31
- }, I = (l, r, L) => {
32
- L === "confirm" ? m(!1) : (i([...r]), e == null || e([...l], [...r]));
33
- }, J = (l, r) => {
34
- i(r), e == null || e(l, r);
35
- }, K = (l) => {
36
- !f && l && m(!0), !z && !l && f && m(!1), c == null || c(l);
29
+ const [S, q] = o([]), [u, c] = o([]), [i, m] = o(!1), [z, G] = o(!1), H = () => {
30
+ c([]), e == null || e([], []);
31
+ }, I = (t, s, L) => {
32
+ L === "confirm" ? m(!1) : (c([...s]), e == null || e([...t], [...s]));
33
+ }, J = (t, s) => {
34
+ c(s), e == null || e(t, s);
35
+ }, K = (t) => {
36
+ !i && t && m(!0), !z && !t && i && m(!1), f == null || f(t);
37
37
  };
38
- return x(() => {
39
- if (s && !Array.isArray(s))
38
+ return b(() => {
39
+ if (l && !Array.isArray(l))
40
40
  throw new Error(
41
- `form表单在使用setFieldValue给TableSelect组件赋值时请确认值为数组类型, \`value\`: ${s}`
41
+ `form表单在使用setFieldValue给TableSelect组件赋值时请确认值为数组类型, \`value\`: ${l}`
42
42
  );
43
- q(s ?? []);
44
- }, [s]), x(() => {
45
- t != null && t.length && i(t);
46
- }, [t]), /* @__PURE__ */ b.jsx(
43
+ q(l ?? []);
44
+ }, [l]), b(() => {
45
+ r != null && r.length && c(r);
46
+ }, [r]), /* @__PURE__ */ x.jsx(
47
47
  M,
48
48
  {
49
49
  allowClear: !0,
50
50
  className: "tableSelectBlock",
51
51
  mode: "multiple",
52
52
  maxTagCount: "responsive",
53
- value: u,
54
- options: S,
53
+ value: S,
54
+ options: u,
55
55
  fieldNames: p,
56
56
  showSearch: !1,
57
- open: f,
58
- placeholder: N,
57
+ open: i,
58
+ placeholder: O,
59
59
  popupClassName: "tableSelectPopupBlock",
60
- dropdownRender: () => /* @__PURE__ */ b.jsx(
60
+ dropdownRender: () => /* @__PURE__ */ x.jsx(
61
61
  Q,
62
62
  {
63
- columns: V,
64
- tableData: j,
65
- total: w,
66
- page: y,
67
- onPageChange: E,
68
- searchInput: A,
69
- loading: T,
70
- loadingFailed: a,
71
- loadAgain: k,
72
- keys: u,
73
- rows: S,
63
+ columns: j,
64
+ tableData: w,
65
+ total: T,
66
+ page: E,
67
+ onPageChange: A,
68
+ searchInput: B,
69
+ loading: a,
70
+ loadingFailed: k,
71
+ loadAgain: y,
72
+ keys: S,
73
+ rows: u,
74
74
  fieldNames: p,
75
75
  onChange: I,
76
76
  onDropdownVisibleChange: G,
77
- showToolTagSelect: B,
78
- toolTags: D,
79
- onToolTagChange: P,
80
- lrLayout: d,
81
- parentRender: v,
82
- mode: F
77
+ showToolTagSelect: D,
78
+ toolTags: V,
79
+ onToolTagChange: d,
80
+ lrLayout: v,
81
+ parentRender: F,
82
+ mode: N
83
83
  }
84
84
  ),
85
85
  onClear: H,
@@ -10,7 +10,7 @@ const R = (o, n, e) => {
10
10
  const f = (n == null ? void 0 : n.length) === 1 ? !1 : g + 1 > ((n == null ? void 0 : n.length) || 0) / 2;
11
11
  if (r != null && r.render) {
12
12
  const s = r.render(t, c, g);
13
- if (typeof s == "object")
13
+ if (typeof s == "object" && s !== null)
14
14
  return s;
15
15
  if (["boolean", "number", "bigint", "string"].includes(
16
16
  typeof s
@@ -3,5 +3,5 @@ import { BaseOptionType } from 'antd/es/select';
3
3
  export interface SingleSelectProps<T extends BaseOptionType> extends Omit<BitzTableSelectProps<T, any>, 'offsetWidth'> {
4
4
  }
5
5
  /** 下拉表格组件 */
6
- declare function TableSingleSelect<T extends BaseOptionType>({ value, options: dataRows, columns, tableData, total, loading, loadingFailed, loadAgain, page, onPageChange, searchInput, showToolTagSelect, toolTags, onToolTagChange, lrLayout, parentRender, mode, placeholder, fieldNames, onChange, onOpenChange, ...rest }: SingleSelectProps<T>): import("react/jsx-runtime").JSX.Element;
6
+ declare function TableSingleSelect<T extends BaseOptionType>({ value, options: dataRows, columns, tableData, total, loading, loadingFailed, loadAgain, page, onPageChange, searchInput, showToolTagSelect, toolTags, onToolTagChange, lrLayout, parentRender, mode, placeholder, fieldNames, onChange, onPopupVisibleChange, ...rest }: SingleSelectProps<T>): import("react/jsx-runtime").JSX.Element;
7
7
  export default TableSingleSelect;
@@ -1,76 +1,76 @@
1
- import { j as b } from "../../../node_modules/.store/react@18.3.1/node_modules/react/jsx-runtime.mjs";
2
- import { useState as c, useEffect as x } from "react";
1
+ import { j as x } from "../../../node_modules/.store/react@18.3.1/node_modules/react/jsx-runtime.mjs";
2
+ import { useState as c, useEffect as b } from "react";
3
3
  import { Select as W } from "antd";
4
4
  import X from "../SelectPopup/index.mjs";
5
5
  function a({
6
- value: m,
7
- options: e,
8
- columns: V,
9
- tableData: j,
10
- total: k,
11
- loading: v,
12
- loadingFailed: w,
13
- loadAgain: B,
14
- page: D,
15
- onPageChange: E,
16
- searchInput: P,
17
- showToolTagSelect: T,
18
- toolTags: y,
19
- onToolTagChange: N,
6
+ value: S,
7
+ options: l,
8
+ columns: j,
9
+ tableData: k,
10
+ total: v,
11
+ loading: w,
12
+ loadingFailed: B,
13
+ loadAgain: D,
14
+ page: E,
15
+ onPageChange: T,
16
+ searchInput: y,
17
+ showToolTagSelect: N,
18
+ toolTags: O,
19
+ onToolTagChange: V,
20
20
  lrLayout: q,
21
21
  parentRender: z,
22
22
  mode: A = "single",
23
23
  placeholder: F = "请选择",
24
- fieldNames: u,
25
- onChange: l,
26
- onOpenChange: i,
24
+ fieldNames: p,
25
+ onChange: e,
26
+ onPopupVisibleChange: f,
27
27
  ...G
28
28
  }) {
29
- const [o, H] = c(), [S, r] = c(), [f, p] = c(!1), [I, J] = c(!1), K = () => {
30
- r([]), l == null || l([], []);
31
- }, L = (s, t, U) => {
32
- U === "confirm" ? p(!1) : (r(t), l == null || l(s, t));
33
- }, M = (s, t) => {
34
- r(t), l == null || l(s, t);
35
- }, Q = (s) => {
36
- !f && s && p(!0), !I && !s && f && p(!1), i == null || i(s);
29
+ const [o, H] = c(), [u, r] = c(), [i, m] = c(!1), [I, J] = c(!1), K = () => {
30
+ r([]), e == null || e([], []);
31
+ }, L = (t, s, U) => {
32
+ U === "confirm" ? m(!1) : (r(s), e == null || e(t, s));
33
+ }, M = (t, s) => {
34
+ r(s), e == null || e(t, s);
35
+ }, Q = (t) => {
36
+ !i && t && m(!0), !I && !t && i && m(!1), f == null || f(t);
37
37
  };
38
- return x(() => {
39
- H(m);
40
- }, [m]), x(() => {
41
- e != null && e.length && r(e);
42
- }, [e]), /* @__PURE__ */ b.jsx(
38
+ return b(() => {
39
+ H(S);
40
+ }, [S]), b(() => {
41
+ l != null && l.length && r(l);
42
+ }, [l]), /* @__PURE__ */ x.jsx(
43
43
  W,
44
44
  {
45
45
  allowClear: !0,
46
46
  className: "tableSelectBlock",
47
47
  value: o,
48
- options: S,
49
- fieldNames: u,
48
+ options: u,
49
+ fieldNames: p,
50
50
  showSearch: !1,
51
- open: f,
51
+ open: i,
52
52
  placeholder: F,
53
53
  popupClassName: "tableSelectPopupBlock",
54
- dropdownRender: () => /* @__PURE__ */ b.jsx(
54
+ dropdownRender: () => /* @__PURE__ */ x.jsx(
55
55
  X,
56
56
  {
57
- columns: V,
58
- tableData: j,
59
- total: k,
60
- page: D,
61
- onPageChange: E,
62
- searchInput: P,
63
- loading: v,
64
- loadingFailed: w,
65
- loadAgain: B,
57
+ columns: j,
58
+ tableData: k,
59
+ total: v,
60
+ page: E,
61
+ onPageChange: T,
62
+ searchInput: y,
63
+ loading: w,
64
+ loadingFailed: B,
65
+ loadAgain: D,
66
66
  keys: o ? [o] : [],
67
- rows: S,
68
- fieldNames: u,
67
+ rows: u,
68
+ fieldNames: p,
69
69
  onChange: L,
70
70
  onDropdownVisibleChange: J,
71
- showToolTagSelect: T,
72
- toolTags: y,
73
- onToolTagChange: N,
71
+ showToolTagSelect: N,
72
+ toolTags: O,
73
+ onToolTagChange: V,
74
74
  lrLayout: q,
75
75
  parentRender: z,
76
76
  mode: A
@@ -62,8 +62,8 @@ export interface BitzTableSelectProps<T extends BaseOptionType, ValueType extend
62
62
  onChange?: (value: Key | Key[], options: T | T[]) => void;
63
63
  /** 计算popup总宽度的追加值 */
64
64
  popupAppendWidth?: number;
65
- /** select dropdown 显隐切换的 callback */
66
- onOpenChange?: (open: boolean) => void;
65
+ /** select 弹出层显隐切换的 callback */
66
+ onPopupVisibleChange?: (open: boolean) => void;
67
67
  }
68
68
  /** 下拉表格组件 */
69
69
  declare function BitzTableSelect<T extends BaseOptionType>({ columns, tableData, loading, loadingFailed, loadAgain, total, page, onPageChange, onSearch, showToolTagSelect, placeholder, mode, fieldNames, onChange, popupAppendWidth: w, ...rest }: BitzTableSelectProps<T>): import("react/jsx-runtime").JSX.Element;