@unicom-cloud/ui 0.8.106 → 0.8.107

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.
Files changed (84) hide show
  1. package/App.js +7 -0
  2. package/BackTop.js +2 -4
  3. package/Calendar.js +2 -2
  4. package/Modal.js +4 -2
  5. package/app/App.js +26 -0
  6. package/app/context.js +9 -0
  7. package/app/index.js +9 -0
  8. package/app/interface.js +1 -0
  9. package/app/useApp.js +8 -0
  10. package/back-top/index.js +44 -56
  11. package/calendar/Lunar.js +71 -0
  12. package/calendar/index.js +11 -11
  13. package/color-picker/index.js +34 -34
  14. package/components/common/flex/index.js +4 -4
  15. package/components/common/icons/file/index.js +13 -11
  16. package/components/common/utils/dayjs.js +99 -124
  17. package/components/common/utils/is.js +98 -104
  18. package/components/common/utils/setDir.js +12 -0
  19. package/components/common/utils/setTheme.js +13 -13
  20. package/config-provider/ConfigProvider.js +32 -30
  21. package/descriptions/index.js +32 -32
  22. package/divider/index.js +28 -20
  23. package/empty/index.js +1 -1
  24. package/grid/Grid.js +55 -88
  25. package/grid/Item.js +40 -61
  26. package/grid/context.js +1 -4
  27. package/grid/hook/useResponsiveState.js +22 -25
  28. package/grid/util.js +6 -44
  29. package/index.js +462 -457
  30. package/input/Button.js +12 -12
  31. package/input/Group.js +11 -12
  32. package/input/Input.js +112 -102
  33. package/input/Search.js +24 -24
  34. package/modal/Confirm.js +17 -17
  35. package/modal/Modal.js +247 -237
  36. package/modal/index.js +4 -2
  37. package/modal/use-modal/index.js +2 -2
  38. package/package.json +1 -1
  39. package/select-view/Core.js +31 -28
  40. package/splitter/SplitBar.js +44 -46
  41. package/style.css +1 -1
  42. package/table/Table.js +198 -210
  43. package/table/th-resizable/index.js +9 -10
  44. package/time-picker/util.js +20 -30
  45. package/types/common/development/interface.d.ts +3 -3
  46. package/types/common/utils/is.d.ts +3 -4
  47. package/types/common/utils/setDir.d.ts +2 -0
  48. package/types/pc/app/App.d.ts +6 -0
  49. package/types/pc/app/context.d.ts +4 -0
  50. package/types/pc/app/index.d.ts +5 -0
  51. package/types/pc/app/interface.d.ts +17 -0
  52. package/types/pc/app/useApp.d.ts +3 -0
  53. package/types/pc/back-top/interface.d.ts +4 -17
  54. package/types/pc/calendar/Lunar.d.ts +17 -0
  55. package/types/pc/calendar/index.d.ts +1 -1
  56. package/types/pc/config-provider/interface.d.ts +1 -1
  57. package/types/pc/divider/interface.d.ts +1 -0
  58. package/types/pc/grid/Grid.d.ts +1 -2
  59. package/types/pc/grid/Item.d.ts +2 -5
  60. package/types/pc/grid/context.d.ts +4 -10
  61. package/types/pc/grid/hook/useResponsiveState.d.ts +2 -2
  62. package/types/pc/grid/interface.d.ts +9 -19
  63. package/types/pc/grid/util.d.ts +1 -10
  64. package/types/pc/index.d.ts +3 -1
  65. package/types/pc/input/Button.d.ts +2 -2
  66. package/types/pc/message/index.d.ts +1 -9
  67. package/types/pc/message/interface.d.ts +8 -0
  68. package/types/pc/message/useMessage.d.ts +1 -2
  69. package/types/pc/modal/Modal.d.ts +1 -0
  70. package/types/pc/modal/config.d.ts +1 -2
  71. package/types/pc/modal/index.d.ts +2 -1
  72. package/types/pc/modal/interface.d.ts +17 -5
  73. package/types/pc/notification/index.d.ts +2 -9
  74. package/types/pc/notification/interface.d.ts +7 -0
  75. package/types/pc/notification/useNotification.d.ts +1 -2
  76. package/types/pc/select-view/Core.d.ts +1 -8
  77. package/types/pc/select-view/index.d.ts +1 -8
  78. package/types/pc/select-view/interface.d.ts +9 -2
  79. package/types/pc/utils/is.d.ts +1 -1
  80. package/types/pc/utils/names.d.ts +303 -0
  81. package/utils/index.js +58 -59
  82. package/utils/is.js +65 -66
  83. package/utils/names.js +298 -144
  84. package/version/index.js +1 -1
@@ -1,58 +1,60 @@
1
- import { jsx as u } from "react/jsx-runtime";
1
+ import { jsx as a } from "react/jsx-runtime";
2
2
  import b from "@unicom-cloud/icons/context";
3
3
  import { UI_PC_PREFIX as e } from "@unicom-cloud/utils/constant/ui";
4
- import a from "lodash/merge";
4
+ import d from "lodash/merge";
5
5
  import { useEffect as t } from "react";
6
+ import { setDir as D } from "../components/common/utils/setDir.js";
6
7
  import { setTheme as E } from "../components/common/utils/setTheme.js";
7
8
  import G from "../components/common/hooks/useMergeProps.js";
8
9
  import R from "../message/index.js";
9
10
  import { setConfigProviderProps as _ } from "../modal/config.js";
10
11
  import $ from "../notification/index.js";
11
- import f, { ConfigProviderDefaultProps as j } from "./context.js";
12
+ import n, { ConfigProviderDefaultProps as j } from "./context.js";
12
13
  const k = j;
13
- let i = {};
14
+ let f = {};
14
15
  const y = {};
15
- function d(P) {
16
- const n = G(
17
- P,
16
+ function P(x) {
17
+ const m = G(
18
+ x,
18
19
  k,
19
20
  y
20
21
  ), {
21
- theme: m,
22
+ theme: s,
22
23
  prefixCls: o = e,
23
- locale: s,
24
+ locale: p,
24
25
  rtl: r,
25
26
  effectGlobalNotice: c = !0,
26
- effectGlobalModal: p = !0
27
- } = n, {
28
- children: l,
29
- isRootConfig: v,
30
- keepConfig: x,
27
+ effectGlobalModal: l = !0
28
+ } = m, {
29
+ children: C,
30
+ isRootConfig: i,
31
+ keepConfig: v,
31
32
  // 潘启宝添加
32
- ...C
33
- } = n;
34
- (v || x) && (i = a({}, i, C));
35
- const h = a({}, i, C, {
33
+ ...g
34
+ } = m;
35
+ (i || v) && (f = d({}, f, g));
36
+ const h = d({}, f, g, {
36
37
  getPrefixCls: I
37
38
  });
38
39
  function I(M, N) {
39
40
  return `${N || o || e}-${M}`;
40
41
  }
41
- t(() => (E({ prefix: e, theme: m }), () => {
42
- }), [m]), t(() => {
42
+ t(() => (i && D({ prefix: e, dir: r ? "rtl" : "ltr" }), () => {
43
+ }), [i, r]), t(() => (E({ prefix: e, ...s }), () => {
44
+ }), [s]), t(() => {
43
45
  c && (R.config({ prefixCls: o, rtl: r }), $.config({ prefixCls: o, rtl: r }));
44
46
  }, [o, r, c]), t(() => {
45
- p && _({ locale: s, prefixCls: o, rtl: r });
46
- }, [s, o, r, p]);
47
- let g = l;
48
- return o && o !== e && (g = /* @__PURE__ */ u(b.Provider, { value: { prefixCls: o }, children: l })), /* @__PURE__ */ u(f.Provider, { value: h, children: g });
47
+ l && _({ locale: p, prefixCls: o, rtl: r });
48
+ }, [p, o, r, l]);
49
+ let u = C;
50
+ return o && o !== e && (u = /* @__PURE__ */ a(b.Provider, { value: { prefixCls: o }, children: C })), /* @__PURE__ */ a(n.Provider, { value: h, children: u });
49
51
  }
50
- d.ConfigContext = f;
51
- d.displayName = "ConfigProvider";
52
- const J = f.Consumer;
52
+ P.ConfigContext = n;
53
+ P.displayName = "ConfigProvider";
54
+ const L = n.Consumer;
53
55
  export {
54
- J as ConfigConsumer,
55
- f as ConfigContext,
56
+ L as ConfigConsumer,
57
+ n as ConfigContext,
56
58
  j as ConfigProviderDefaultProps,
57
- d as default
59
+ P as default
58
60
  };
@@ -1,4 +1,4 @@
1
- import { jsxs as c, jsx as r } from "react/jsx-runtime";
1
+ import { jsxs as c, jsx as a } from "react/jsx-runtime";
2
2
  import C from "lodash/isArray";
3
3
  import V from "lodash/isNumber";
4
4
  import q from "lodash/isPlainObject";
@@ -30,8 +30,8 @@ function Y(u) {
30
30
  title: v,
31
31
  data: b,
32
32
  border: O,
33
- labelStyle: y,
34
- valueStyle: $,
33
+ labelStyle: $,
34
+ valueStyle: y,
35
35
  colon: N,
36
36
  layout: m,
37
37
  size: g,
@@ -53,20 +53,20 @@ function Y(u) {
53
53
  const i = [];
54
54
  if (C(b) && b.length > 0 && l) {
55
55
  b.forEach((e) => {
56
- const o = i[i.length - 1], a = z(o);
57
- a === 0 ? i.push([
56
+ const o = i[i.length - 1], r = z(o);
57
+ r === 0 ? i.push([
58
58
  {
59
59
  ...e,
60
60
  span: e.span ? e.span > l ? l : e.span : 1
61
61
  }
62
- ]) : a === l ? i.push([
62
+ ]) : r === l ? i.push([
63
63
  {
64
64
  ...e,
65
65
  span: e.span ? e.span > l ? l : e.span : 1
66
66
  }
67
67
  ]) : o.push({
68
68
  ...e,
69
- span: e.span ? e.span + a > l ? l - a : e.span : 1
69
+ span: e.span ? e.span + r > l ? l - r : e.span : 1
70
70
  });
71
71
  });
72
72
  const s = i[i.length - 1], t = z(s);
@@ -74,14 +74,14 @@ function Y(u) {
74
74
  }
75
75
  function F(s, t) {
76
76
  return /* @__PURE__ */ c(x, { children: [
77
- /* @__PURE__ */ r("tr", { className: `${n}-row`, children: s.map((e, o) => {
78
- const a = e.span > 1 ? { colSpan: e.span } : {};
77
+ /* @__PURE__ */ a("tr", { className: `${n}-row`, children: s.map((e, o) => {
78
+ const r = e.span > 1 ? { colSpan: e.span } : {};
79
79
  return /* @__PURE__ */ c(
80
80
  "td",
81
81
  {
82
82
  className: `${n}-item-label`,
83
- ...a,
84
- style: y,
83
+ ...r,
84
+ style: $,
85
85
  children: [
86
86
  e.label,
87
87
  N
@@ -90,14 +90,14 @@ function Y(u) {
90
90
  `${e.key || o}_label`
91
91
  );
92
92
  }) }),
93
- /* @__PURE__ */ r("tr", { className: `${n}-row`, children: s.map((e, o) => {
94
- const a = e.span > 1 ? { colSpan: e.span } : {};
95
- return /* @__PURE__ */ r(
93
+ /* @__PURE__ */ a("tr", { className: `${n}-row`, children: s.map((e, o) => {
94
+ const r = e.span > 1 ? { colSpan: e.span } : {};
95
+ return /* @__PURE__ */ a(
96
96
  "td",
97
97
  {
98
98
  className: `${n}-item-value`,
99
- ...a,
100
- style: $,
99
+ ...r,
100
+ style: y,
101
101
  children: e.value
102
102
  },
103
103
  `${e.key || o}_value`
@@ -106,19 +106,19 @@ function Y(u) {
106
106
  ] }, t);
107
107
  }
108
108
  function H(s, t) {
109
- return /* @__PURE__ */ r("tr", { className: `${n}-row`, children: s.map((e, o) => {
110
- const a = e.span > 1 ? { colSpan: e.span * 2 - 1 } : {};
109
+ return /* @__PURE__ */ a("tr", { className: `${n}-row`, children: s.map((e, o) => {
110
+ const r = e.span > 1 ? { colSpan: e.span * 2 - 1 } : {};
111
111
  return /* @__PURE__ */ c(x, { children: [
112
- /* @__PURE__ */ c("td", { className: `${n}-item-label`, style: y, children: [
112
+ /* @__PURE__ */ c("td", { className: `${n}-item-label`, style: $, children: [
113
113
  e.label,
114
114
  N
115
115
  ] }),
116
- /* @__PURE__ */ r(
116
+ /* @__PURE__ */ a(
117
117
  "td",
118
118
  {
119
119
  className: `${n}-item-value`,
120
- ...a,
121
- style: $,
120
+ ...r,
121
+ style: y,
122
122
  children: e.value
123
123
  }
124
124
  )
@@ -126,30 +126,30 @@ function Y(u) {
126
126
  }) }, t);
127
127
  }
128
128
  function M(s, t) {
129
- return /* @__PURE__ */ r("tr", { className: `${n}-row`, children: s.map((e, o) => {
130
- const a = e.span > 1 ? { colSpan: e.span } : {};
129
+ return /* @__PURE__ */ a("tr", { className: `${n}-row`, children: s.map((e, o) => {
130
+ const r = e.span > 1 ? { colSpan: e.span } : {};
131
131
  return /* @__PURE__ */ c(
132
132
  "td",
133
133
  {
134
- ...a,
134
+ ...r,
135
135
  className: `${n}-item`,
136
136
  children: [
137
137
  /* @__PURE__ */ c(
138
138
  "div",
139
139
  {
140
140
  className: `${n}-item-label-inline`,
141
- style: y,
141
+ style: $,
142
142
  children: [
143
143
  e.label,
144
144
  N
145
145
  ]
146
146
  }
147
147
  ),
148
- /* @__PURE__ */ r(
148
+ /* @__PURE__ */ a(
149
149
  "div",
150
150
  {
151
151
  className: `${n}-item-value-inline`,
152
- style: $,
152
+ style: y,
153
153
  children: e.value
154
154
  }
155
155
  )
@@ -168,14 +168,14 @@ function Y(u) {
168
168
  [`${n}-border`]: O,
169
169
  [`${n}-layout-${m}`]: m,
170
170
  [`${n}-size-${g || d}`]: g || d,
171
- [`${n}-table-layout-fixed`]: j === "fixed",
172
- [`${n}-rtl`]: I
171
+ [`${n}-table-layout-fixed`]: j === "fixed"
173
172
  },
173
+ I ? `${n}-rtl` : `${n}-ltr`,
174
174
  L
175
175
  );
176
176
  return /* @__PURE__ */ c("div", { className: T, style: D, children: [
177
- v && /* @__PURE__ */ r("div", { className: `${n}-title`, children: v }),
178
- /* @__PURE__ */ r("div", { className: `${n}-body`, children: /* @__PURE__ */ r("table", { className: `${n}-table`, cellPadding: 0, cellSpacing: 0, children: /* @__PURE__ */ r("tbody", { children: i.map((s, t) => R(s, t)) }) }) })
177
+ v && /* @__PURE__ */ a("div", { className: `${n}-title`, children: v }),
178
+ /* @__PURE__ */ a("div", { className: `${n}-body`, children: /* @__PURE__ */ a("table", { className: `${n}-table`, cellPadding: 0, cellSpacing: 0, children: /* @__PURE__ */ a("tbody", { children: i.map((s, t) => R(s, t)) }) }) })
179
179
  ] });
180
180
  }
181
181
  Y.displayName = "Descriptions";
package/divider/index.js CHANGED
@@ -1,38 +1,39 @@
1
1
  import { jsx as c } from "react/jsx-runtime";
2
- import { forwardRef as f, useContext as b, useMemo as D } from "react";
2
+ import { forwardRef as f, useContext as D, useMemo as g } from "react";
3
3
  import "../config-provider/ConfigProvider.js";
4
- import g from "../components/common/hooks/useMergeProps.js";
5
- import P from "@unicom-cloud/utils/class-name";
4
+ import P from "../components/common/hooks/useMergeProps.js";
5
+ import S from "@unicom-cloud/utils/class-name";
6
6
  import w from "../config-provider/context.js";
7
7
  const z = {
8
8
  type: "horizontal",
9
9
  orientation: "center"
10
10
  };
11
- function S(n, a) {
12
- const { getPrefixCls: u, componentConfig: x } = b(w), h = g(
11
+ function V(n, l) {
12
+ const { getPrefixCls: x, componentConfig: u } = D(w), h = P(
13
13
  n,
14
14
  z,
15
- x?.Divider
15
+ u?.Divider
16
16
  ), {
17
17
  children: o,
18
18
  style: m,
19
- className: $,
19
+ textStyle: $,
20
+ className: v,
20
21
  type: p,
21
- orientation: l,
22
+ orientation: a,
22
23
  borderStyle: r,
23
24
  // 潘启宝添加
24
25
  borderWidth: i,
25
26
  // 潘启宝添加
26
- ...v
27
- } = h, s = p === "horizontal", t = u?.("divider"), N = P(
27
+ ...N
28
+ } = h, s = p === "horizontal", t = x?.("divider"), C = S(
28
29
  t,
29
30
  `${t}-${p}`,
30
31
  {
31
32
  [`${t}-with-text`]: o,
32
- [`${t}-with-text-${l}`]: o && l
33
+ [`${t}-with-text-${a}`]: o && a
33
34
  },
34
- $
35
- ), C = D(() => {
35
+ v
36
+ ), b = g(() => {
36
37
  const e = { ...m };
37
38
  return r && (s ? e.borderBottomStyle = r : e.borderLeftStyle = r), i && (s ? e.borderBottomWidth = i : e.borderLeftWidth = i), e;
38
39
  }, [r, i, s, m]);
@@ -40,19 +41,26 @@ function S(n, a) {
40
41
  "div",
41
42
  {
42
43
  role: "separator",
43
- ref: a,
44
- style: C,
45
- className: N,
46
- ...v,
47
- children: o && s ? /* @__PURE__ */ c("span", { className: `${t}-text ${t}-text-${l}`, children: o }) : null
44
+ ref: l,
45
+ style: b,
46
+ className: C,
47
+ ...N,
48
+ children: o && s ? /* @__PURE__ */ c(
49
+ "span",
50
+ {
51
+ style: $,
52
+ className: `${t}-text ${t}-text-${a}`,
53
+ children: o
54
+ }
55
+ ) : null
48
56
  }
49
57
  );
50
58
  }
51
59
  const d = f(
52
- S
60
+ V
53
61
  );
54
62
  d.displayName = "Divider";
55
- const y = f((n, a) => /* @__PURE__ */ c(d, { ref: a, type: "vertical", ...n }));
63
+ const y = f((n, l) => /* @__PURE__ */ c(d, { ref: l, type: "vertical", ...n }));
56
64
  y.displayName = "DividerVertical";
57
65
  d.Vertical = y;
58
66
  export {
package/empty/index.js CHANGED
@@ -13,7 +13,7 @@ function E(o, t) {
13
13
  o,
14
14
  {},
15
15
  e?.Empty
16
- ), { ...n } = p, s = m?.("empty"), i = r.Empty.noData;
16
+ ), { ...n } = p, s = m?.("empty"), i = r?.Empty?.noData;
17
17
  return /* @__PURE__ */ a(y, { ref: t, prefixCls: s, description: i, ...n });
18
18
  }
19
19
  const g = f(c(E));
package/grid/Grid.js CHANGED
@@ -1,108 +1,75 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- import A from "lodash/get";
3
- import B from "lodash/isArray";
4
- import n from "lodash/isNil";
5
- import g, { forwardRef as Q, useState as V, useContext as k } from "react";
1
+ import { jsx as x } from "react/jsx-runtime";
2
+ import _ from "lodash/isArray";
3
+ import c from "lodash/isNil";
4
+ import { forwardRef as A, useContext as M } from "react";
6
5
  import "../config-provider/ConfigProvider.js";
7
- import q from "../components/common/hooks/useMergeProps.js";
8
- import z from "@unicom-cloud/utils/class-name";
9
- import { GridDataCollectorContext as F, GridContext as H } from "./context.js";
10
- import { useResponsiveState as m } from "./hook/useResponsiveState.js";
11
- import { setItemVisible as J } from "./util.js";
12
- import K from "../config-provider/context.js";
13
- const O = {
14
- collapsed: !1,
15
- collapsedRows: 1,
6
+ import O from "../components/common/hooks/useMergeProps.js";
7
+ import k from "@unicom-cloud/utils/class-name";
8
+ import "../components/common/utils/is.js";
9
+ import { GridContext as q } from "./context.js";
10
+ import { useResponsiveState as f } from "./hook/useResponsiveState.js";
11
+ import z from "../config-provider/context.js";
12
+ import { isNumber as G, isPlainObject as B } from "@unicom-cloud/utils/is";
13
+ const D = {
16
14
  cols: 24,
17
15
  gap: 0
18
16
  };
19
- function U(w, _) {
20
- const [o, c] = V(
21
- /* @__PURE__ */ new Map()
22
- ), { getPrefixCls: I, componentConfig: N, rtl: D } = k(K), v = q(
23
- w,
24
- O,
17
+ function E(C, u) {
18
+ const { getPrefixCls: g, componentConfig: N, rtl: $ } = M(z), y = O(
19
+ C,
20
+ D,
25
21
  N?.Grid
26
22
  ), {
27
- children: y,
28
- className: R,
29
- style: M,
30
- cols: P,
31
- gap: t,
32
- colGap: f,
33
- rowGap: d,
34
- collapsed: G,
35
- collapsedRows: $
36
- } = v;
37
- let r, a;
38
- const L = n(t), h = n(d), S = n(f);
39
- L || (B(t) ? (r = t[0], a = t[1] ?? t[0]) : r = a = t), h || (r = d), S || (a = f);
40
- const l = m(P, 24), u = m(a, 0), E = {
41
- gap: `${m(r, 0)}px ${u}px`,
42
- gridTemplateColumns: `repeat(${l}, minmax(0px, 1fr))`
43
- }, x = I?.("grid"), T = {
44
- [`${x}`]: !0,
45
- [`${x}-rtl`]: D
46
- }, b = z(T, R), j = (() => {
47
- const e = [];
48
- for (const [s, p] of o.entries())
49
- e[s] = p;
50
- return e;
51
- })(), C = J({
52
- cols: l,
53
- collapsed: G,
54
- collapsedRows: $,
55
- itemDataList: j
56
- });
57
- return /* @__PURE__ */ i(
23
+ children: w,
24
+ className: P,
25
+ style: v,
26
+ cols: R,
27
+ gap: e,
28
+ colGap: l,
29
+ rowGap: m
30
+ } = y;
31
+ let t = m, s = l;
32
+ const b = c(e), h = c(m), j = c(l);
33
+ b || (_(e) ? (t = e[0], s = e[1] ?? e[0]) : t = s = e), h || (t = m), j || (s = l);
34
+ const o = f(R, 24), a = f(t, 0), n = f(s, 0), r = {};
35
+ if (a && (r.rowGap = a), n && (r.columnGap = n), G(o))
36
+ r.gridTemplateColumns = `repeat(${o}, minmax(0px, 1fr))`;
37
+ else if (o && B(o) && "type" in o) {
38
+ const T = o.type;
39
+ let i = o.max ?? "1fr";
40
+ G(i) && (i = `${i}px`);
41
+ let p = o.min ?? "0px";
42
+ G(p) && (p = `${p}px`), r.gridTemplateColumns = `repeat(${T}, minmax(${p}, ${i}))`;
43
+ }
44
+ const d = g?.("grid"), S = {
45
+ [`${d}`]: !0,
46
+ [`${d}-rtl`]: $
47
+ };
48
+ return /* @__PURE__ */ x(
58
49
  "div",
59
50
  {
60
- ref: _,
61
- className: b,
51
+ ref: u,
52
+ className: k(S, P),
62
53
  style: {
63
- ...E,
64
- ...M
54
+ ...r,
55
+ ...v
65
56
  },
66
- children: /* @__PURE__ */ i(
67
- F.Provider,
57
+ children: /* @__PURE__ */ x(
58
+ q.Provider,
68
59
  {
69
60
  value: {
70
- collectItemData(e, s) {
71
- o.set(e, s), c(new Map([...o]));
72
- },
73
- removeItemData(e) {
74
- o.delete(e), c(new Map([...o]));
75
- }
61
+ cols: o,
62
+ rowGap: a,
63
+ colGap: n
76
64
  },
77
- children: /* @__PURE__ */ i(
78
- H.Provider,
79
- {
80
- value: {
81
- cols: l,
82
- colGap: u,
83
- collapsed: G,
84
- overflow: C.overflow,
85
- displayIndexList: C.displayIndexList
86
- },
87
- children: g.Children.map(y, (e, s) => {
88
- if (e) {
89
- const p = {
90
- __index__: s,
91
- ...e.props
92
- };
93
- return g.cloneElement(e, p);
94
- }
95
- return null;
96
- }).filter((e) => A(e, "type.__PQB_GRID_ITEM__"))
97
- }
98
- )
65
+ children: w
99
66
  }
100
67
  )
101
68
  }
102
69
  );
103
70
  }
104
- const W = Q(U);
105
- W.displayName = "Grid";
71
+ const F = A(E);
72
+ F.displayName = "Grid";
106
73
  export {
107
- W as default
74
+ F as default
108
75
  };
package/grid/Item.js CHANGED
@@ -1,76 +1,55 @@
1
- import { jsx as O } from "react/jsx-runtime";
2
- import Q from "lodash/isFunction";
3
- import T from "lodash/isString";
4
- import m, { forwardRef as V, useContext as p, useMemo as c, useEffect as k } from "react";
1
+ import { jsx as R } from "react/jsx-runtime";
2
+ import { forwardRef as w, useContext as p } from "react";
5
3
  import "../config-provider/ConfigProvider.js";
6
- import q from "../components/common/hooks/useMergeProps.js";
7
- import z from "@unicom-cloud/utils/class-name";
8
- import { GridContext as A, GridDataCollectorContext as H } from "./context.js";
9
- import { useResponsiveState as C } from "./hook/useResponsiveState.js";
10
- import { resolveItemData as J } from "./util.js";
11
- import K from "../config-provider/context.js";
12
- const U = {
13
- suffix: !1,
4
+ import O from "../components/common/hooks/useMergeProps.js";
5
+ import b from "@unicom-cloud/utils/class-name";
6
+ import "../components/common/utils/is.js";
7
+ import { GridContext as h } from "./context.js";
8
+ import { useResponsiveState as a } from "./hook/useResponsiveState.js";
9
+ import { resolveItemData as j } from "./util.js";
10
+ import D from "../config-provider/context.js";
11
+ import { isNumber as e } from "@unicom-cloud/utils/is";
12
+ const E = {
14
13
  offset: 0,
15
14
  span: 1
16
15
  };
17
- function W($, g) {
18
- const { getPrefixCls: _, componentConfig: y, rtl: S } = p(K), a = q(
19
- $,
20
- U,
21
- y?.["Grid.Item"]
16
+ function F(f, c) {
17
+ const { getPrefixCls: l, componentConfig: d, rtl: C } = p(D), g = O(
18
+ f,
19
+ E,
20
+ d?.["Grid.Item"]
22
21
  ), {
23
- children: i,
24
- className: G,
25
- style: v,
22
+ children: u,
23
+ className: x,
24
+ style: $,
26
25
  offset: N,
27
- span: D,
28
- __index__: s
29
- } = a, n = p(A), { collectItemData: R, removeItemData: E } = p(
30
- H
31
- ), { colGap: f, cols: l, displayIndexList: P, overflow: u } = n, d = C(N, 0), r = C(D, 1), x = _?.("grid-item"), w = P?.includes(s), M = {
32
- [`${x}`]: !0,
33
- [`${x}-rtl`]: S
34
- }, b = z(M, G), e = c(() => J(n.cols, {
35
- suffix: !!a.suffix,
36
- span: r,
37
- offset: d
38
- }), [n.cols, a.suffix, r, d]);
39
- k(() => (R(s, e), () => {
40
- E(s);
41
- }), [s, e]);
42
- const F = c(() => {
43
- const { offset: t, span: o } = e;
44
- return t > 0 ? {
45
- marginLeft: `calc((${`(100% - ${f * (o - 1)}px) / ${o}`} * ${t}) + ${f * t}px)`
46
- } : {};
47
- }, [e, f]), L = c(() => {
48
- const { suffix: t, span: o } = e;
49
- return t ? `${l - o + 1}` : `span ${o}`;
50
- }, [e, l]), j = !w || r === 0 ? { display: "none" } : {}, B = {
51
- gridColumn: `${L} / span ${r}`,
52
- ...F,
53
- ...j
54
- };
55
- return /* @__PURE__ */ O(
26
+ span: n
27
+ } = g, G = p(h), { colGap: r, cols: m } = G, I = a(N, 0), S = a(n, 1), { span: t, offset: o } = e(m) ? j(m, {
28
+ span: S,
29
+ offset: I
30
+ }) : {}, i = l?.("grid-item"), y = {
31
+ [`${i}`]: !0,
32
+ [`${i}-rtl`]: C
33
+ }, v = b(y, x), s = {};
34
+ if (e(t) && (s.gridColumnStart = `span ${t}`, e(r) && e(o) && o > 0)) {
35
+ const P = `(100% - ${r * (t - 1)}px) / ${t}`;
36
+ s.marginLeft = `calc(${P} * ${o} + ${r * o}px)`;
37
+ }
38
+ return s.gridColumnEnd = `span ${n}`, /* @__PURE__ */ R(
56
39
  "div",
57
40
  {
58
- ref: g,
59
- className: b,
41
+ ref: c,
42
+ className: v,
60
43
  style: {
61
- ...B,
62
- ...v
44
+ ...s,
45
+ ...$
63
46
  },
64
- children: Q(i) ? i({ overflow: u }) : m.Children.map(i, (t) => t && n.collapsed && m.isValidElement(t) && !T(t.type) ? m.cloneElement(t, {
65
- overflow: u,
66
- ...t.props
67
- }) : t)
47
+ children: u
68
48
  }
69
49
  );
70
50
  }
71
- const X = V(W), I = X;
72
- I.displayName = "Grid.Item";
73
- I.__PQB_GRID_ITEM__ = !0;
51
+ const L = w(F), M = L;
52
+ M.displayName = "Grid.Item";
74
53
  export {
75
- I as default
54
+ M as default
76
55
  };
package/grid/context.js CHANGED
@@ -1,9 +1,6 @@
1
1
  import { createContext as t } from "react";
2
- const e = t({}), n = t({}), r = t(
3
- {}
4
- );
2
+ const e = t({}), n = t({});
5
3
  export {
6
4
  n as GridContext,
7
- r as GridDataCollectorContext,
8
5
  e as RowContext
9
6
  };