@unicom-cloud/ui 0.8.106 → 0.8.108

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 (197) hide show
  1. package/App.js +7 -0
  2. package/BackTop.js +2 -4
  3. package/Calendar.js +2 -2
  4. package/ColorPicker.js +15 -14
  5. package/Constant.js +4 -0
  6. package/Copy.js +4 -3
  7. package/Countdown.js +25 -0
  8. package/Grid.js +8 -10
  9. package/LiquidFill.js +4 -3
  10. package/List.js +7 -6
  11. package/Marquee.js +4 -3
  12. package/Modal.js +4 -2
  13. package/PageHeader.js +3 -2
  14. package/QrCode.js +4 -3
  15. package/RowCol.js +8 -0
  16. package/Segmented.js +14 -4
  17. package/Statistic.js +5 -4
  18. package/Tour.js +4 -3
  19. package/Transfer.js +4 -2
  20. package/anchor/Link.js +1 -1
  21. package/app/App.js +26 -0
  22. package/app/context.js +9 -0
  23. package/app/index.js +9 -0
  24. package/app/interface.js +1 -0
  25. package/app/useApp.js +8 -0
  26. package/avatar/Group.js +1 -1
  27. package/back-top/index.js +44 -56
  28. package/button/index.js +52 -51
  29. package/calendar/Lunar.js +71 -0
  30. package/calendar/index.js +11 -11
  31. package/cascader/base/node.js +22 -20
  32. package/cascader/base/store.js +10 -10
  33. package/cascader/util.js +29 -27
  34. package/color-picker/Mode.js +8 -7
  35. package/color-picker/hooks/useColorPicker.js +56 -55
  36. package/color-picker/index.js +49 -48
  37. package/color-picker/utils.js +58 -57
  38. package/components/common/empty/index.js +2 -2
  39. package/components/common/flex/index.js +64 -55
  40. package/components/common/flex/interface.js +6 -6
  41. package/components/common/hooks/useInterval.js +6 -6
  42. package/components/common/icons/file/index.js +13 -11
  43. package/components/common/space/index.js +53 -53
  44. package/components/common/utils/dayjs.js +114 -126
  45. package/components/common/utils/is.js +98 -104
  46. package/components/common/utils/setDir.js +12 -0
  47. package/components/common/utils/setTheme.js +13 -13
  48. package/components/common/utils/toArray.js +7 -5
  49. package/config-provider/ConfigProvider.js +32 -30
  50. package/constant/index.js +4 -0
  51. package/copy/index.js +2 -1
  52. package/countdown/index.js +113 -0
  53. package/countdown/interface.js +1 -0
  54. package/countdown/util.js +29 -0
  55. package/descriptions/index.js +45 -45
  56. package/divider/index.js +28 -20
  57. package/dropdown/Button.js +1 -1
  58. package/empty/index.js +1 -1
  59. package/flex/index.js +30 -29
  60. package/form/FormItem.js +126 -122
  61. package/grid/Grid.js +56 -90
  62. package/grid/Item.js +44 -65
  63. package/grid/context.js +2 -6
  64. package/grid/index.js +6 -8
  65. package/grid/util.js +6 -44
  66. package/hooks/useResponsiveState.js +54 -0
  67. package/index.js +614 -605
  68. package/input/Button.js +12 -12
  69. package/input/Group.js +11 -12
  70. package/input/Input.js +112 -102
  71. package/input/InputElement.js +25 -24
  72. package/input/Search.js +24 -24
  73. package/layout/Sider.js +1 -1
  74. package/liquid-fill/index.js +4 -3
  75. package/list/Item.js +21 -21
  76. package/list/index.js +53 -52
  77. package/marquee/index.js +20 -19
  78. package/marquee-/index.js +4 -3
  79. package/mentions/util.js +9 -8
  80. package/modal/Confirm.js +17 -17
  81. package/modal/Modal.js +247 -237
  82. package/modal/index.js +4 -2
  83. package/modal/use-modal/index.js +2 -2
  84. package/package.json +1 -1
  85. package/page-header/index.js +57 -56
  86. package/pagination/Pagination.js +89 -92
  87. package/qr-code/index.js +4 -3
  88. package/radio/Group.js +1 -1
  89. package/row-col/Col-.js +88 -0
  90. package/row-col/Col.js +159 -0
  91. package/row-col/Row.js +73 -0
  92. package/row-col/context.js +5 -0
  93. package/row-col/index.js +11 -0
  94. package/row-col/interface.js +1 -0
  95. package/segmented/index.js +257 -206
  96. package/select/Select.js +191 -191
  97. package/select/util.js +50 -50
  98. package/select-view/Core.js +31 -28
  99. package/space/index.js +15 -13
  100. package/splitter/SplitBar.js +44 -46
  101. package/statistic/index.js +56 -55
  102. package/statistic/interface.js +4 -1
  103. package/style.css +1 -1
  104. package/table/Table.js +198 -210
  105. package/table/hook/useColumns.js +27 -26
  106. package/table/hook/useStickyClassNames.js +9 -8
  107. package/table/hook/useThResizable.js +4 -3
  108. package/table/th-resizable/index.js +2 -2
  109. package/table/thead/index.js +18 -16
  110. package/time-picker/util.js +20 -30
  111. package/timeline/Item.js +1 -1
  112. package/tour/index.js +4 -3
  113. package/transfer/index.js +93 -91
  114. package/trigger/index.js +66 -66
  115. package/types/common/development/interface.d.ts +3 -3
  116. package/types/common/flex/index.d.ts +3 -9
  117. package/types/common/flex/interface.d.ts +15 -4
  118. package/types/common/space/index.d.ts +3 -5
  119. package/types/common/space/interface.d.ts +2 -0
  120. package/types/common/utils/dayjs.d.ts +3 -1
  121. package/types/common/utils/is.d.ts +3 -4
  122. package/types/common/utils/setDir.d.ts +2 -0
  123. package/types/pc/app/App.d.ts +6 -0
  124. package/types/pc/app/context.d.ts +4 -0
  125. package/types/pc/app/index.d.ts +5 -0
  126. package/types/pc/app/interface.d.ts +17 -0
  127. package/types/pc/app/useApp.d.ts +3 -0
  128. package/types/pc/back-top/interface.d.ts +4 -17
  129. package/types/pc/button/interface.d.ts +2 -2
  130. package/types/pc/calendar/Lunar.d.ts +17 -0
  131. package/types/pc/calendar/index.d.ts +1 -1
  132. package/types/pc/config-provider/interface.d.ts +17 -12
  133. package/types/pc/constant/index.d.ts +1 -0
  134. package/types/pc/countdown/interface.d.ts +65 -0
  135. package/types/pc/countdown/util.d.ts +7 -0
  136. package/types/pc/divider/interface.d.ts +1 -0
  137. package/types/pc/flex/index.d.ts +8 -6
  138. package/types/pc/flex/interface.d.ts +3 -10
  139. package/types/pc/form/FormItem.d.ts +1 -1
  140. package/types/pc/form/interface.d.ts +1 -1
  141. package/types/pc/grid/Grid.d.ts +2 -4
  142. package/types/pc/grid/Item.d.ts +1 -5
  143. package/types/pc/grid/context.d.ts +4 -15
  144. package/types/pc/grid/index.d.ts +4 -6
  145. package/types/pc/grid/interface.d.ts +14 -142
  146. package/types/pc/grid/util.d.ts +1 -10
  147. package/types/pc/hooks/useResponsiveState.d.ts +3 -0
  148. package/types/pc/index.d.ts +10 -4
  149. package/types/pc/input/Button.d.ts +2 -2
  150. package/types/pc/list/interface.d.ts +2 -1
  151. package/types/pc/message/index.d.ts +1 -9
  152. package/types/pc/message/interface.d.ts +8 -0
  153. package/types/pc/message/useMessage.d.ts +1 -2
  154. package/types/pc/modal/Modal.d.ts +1 -0
  155. package/types/pc/modal/config.d.ts +1 -2
  156. package/types/pc/modal/index.d.ts +2 -1
  157. package/types/pc/modal/interface.d.ts +17 -5
  158. package/types/pc/notification/index.d.ts +2 -9
  159. package/types/pc/notification/interface.d.ts +7 -0
  160. package/types/pc/notification/useNotification.d.ts +1 -2
  161. package/types/pc/pagination/PageOption.d.ts +0 -1
  162. package/types/pc/pagination/interface.d.ts +5 -6
  163. package/types/pc/{grid → row-col}/Col-.d.ts +1 -1
  164. package/types/pc/{grid → row-col}/Col.d.ts +1 -2
  165. package/types/pc/{grid → row-col}/Row.d.ts +1 -2
  166. package/types/pc/row-col/context.d.ts +6 -0
  167. package/types/pc/row-col/index.d.ts +7 -0
  168. package/types/pc/row-col/interface.d.ts +112 -0
  169. package/types/pc/segmented/index.d.ts +3 -7
  170. package/types/pc/segmented/interface.d.ts +38 -5
  171. package/types/pc/select-view/Core.d.ts +1 -8
  172. package/types/pc/select-view/index.d.ts +1 -8
  173. package/types/pc/select-view/interface.d.ts +9 -2
  174. package/types/pc/space/index.d.ts +5 -7
  175. package/types/pc/space/interface.d.ts +3 -10
  176. package/types/pc/statistic/index.d.ts +1 -1
  177. package/types/pc/statistic/interface.d.ts +1 -49
  178. package/types/pc/utils/is.d.ts +1 -1
  179. package/types/pc/utils/names.d.ts +422 -111
  180. package/types/pc/utils/responsiveObserve.d.ts +8 -8
  181. package/typography/Ellipsis.js +5 -4
  182. package/typography/Operations.js +4 -3
  183. package/utils/dayjs.js +13 -11
  184. package/utils/index.js +245 -244
  185. package/utils/is.js +65 -66
  186. package/utils/names.js +309 -150
  187. package/utils/responsiveObserve.js +43 -36
  188. package/version/index.js +1 -1
  189. package/grid/Col-.js +0 -86
  190. package/grid/Col.js +0 -169
  191. package/grid/Row.js +0 -96
  192. package/grid/hook/useResponsiveState.js +0 -38
  193. package/statistic/Countdown.js +0 -56
  194. package/statistic/util.js +0 -33
  195. package/types/pc/grid/hook/useResponsiveState.d.ts +0 -2
  196. package/types/pc/statistic/util.d.ts +0 -1
  197. /package/types/pc/{statistic/Countdown.d.ts → countdown/index.d.ts} +0 -0
package/form/FormItem.js CHANGED
@@ -1,43 +1,42 @@
1
- import { jsx as i, jsxs as E, Fragment as ae } from "react/jsx-runtime";
2
- import U, { forwardRef as me, useContext as F, useState as W, useRef as de, useEffect as ce, useMemo as _, createElement as z, cloneElement as H } from "react";
3
- import pe from "lodash/isArray";
4
- import ue from "lodash/isFunction";
5
- import h from "lodash/isPlainObject";
1
+ import { jsx as i, jsxs as q, Fragment as ie } from "react/jsx-runtime";
2
+ import W, { forwardRef as ae, useContext as F, useState as _, useRef as me, useEffect as de, useMemo as z, createElement as H, cloneElement as K } from "react";
3
+ import ce from "lodash/isArray";
4
+ import pe from "lodash/isFunction";
5
+ import C from "lodash/isPlainObject";
6
6
  import x from "lodash/isUndefined";
7
7
  import "../config-provider/ConfigProvider.js";
8
- import "../grid/index.js";
9
- import fe from "../components/common/hooks/useMergeProps.js";
8
+ import ue from "../components/common/hooks/useMergeProps.js";
9
+ import fe from "../row-col/index.js";
10
10
  import { PqbCSSTransition as be } from "../components/common/utils/PqbCSSTransition.js";
11
- import C from "@unicom-cloud/utils/class-name";
12
- import { omit as ge } from "../components/common/utils/omit.js";
13
- import $ from "./Control.js";
14
- import he from "./FormLabel.js";
15
- import { FormItemContext as K, FormListContext as Ce, FormContext as B } from "./context.js";
16
- import { VALIDATE_STATUS as k } from "./interface.js";
11
+ import S from "@unicom-cloud/utils/class-name";
12
+ import { omit as he } from "../components/common/utils/omit.js";
13
+ import I from "./Control.js";
14
+ import ge from "./FormLabel.js";
15
+ import { FormItemContext as B, FormListContext as Ce, FormContext as G } from "./context.js";
16
+ import { VALIDATE_STATUS as T } from "./interface.js";
17
17
  import { formatValidateMsg as xe } from "./util.js";
18
18
  import ye from "../config-provider/context.js";
19
- import ve from "../grid/Row.js";
20
- import G from "../grid/Col.js";
21
- const we = ({
22
- prefixCls: f,
23
- help: b,
19
+ import J from "../row-col/Col.js";
20
+ const ve = ({
21
+ prefixCls: b,
22
+ help: h,
24
23
  errors: e,
25
- warnings: I
24
+ warnings: N
26
25
  }) => {
27
- const g = e.map((p, d) => {
28
- if (p)
29
- return /* @__PURE__ */ i("div", { role: "alert", children: p.message }, d);
30
- }), c = [];
31
- I.map((p, d) => {
32
- c.push(
33
- /* @__PURE__ */ i("div", { role: "alert", className: `${f}-message-help-warning`, children: p }, d)
26
+ const g = e.map((u, d) => {
27
+ if (u)
28
+ return /* @__PURE__ */ i("div", { role: "alert", children: u.message }, d);
29
+ }), p = [];
30
+ N.map((u, d) => {
31
+ p.push(
32
+ /* @__PURE__ */ i("div", { role: "alert", className: `${b}-message-help-warning`, children: u }, d)
34
33
  );
35
34
  });
36
- const y = !x(b) || !!c.length, u = y || !!g.length;
37
- return u && /* @__PURE__ */ i(
35
+ const y = !x(h) || !!p.length, f = y || !!g.length;
36
+ return f && /* @__PURE__ */ i(
38
37
  be,
39
38
  {
40
- in: u,
39
+ in: f,
41
40
  appear: !0,
42
41
  classNames: "formblink",
43
42
  timeout: 300,
@@ -45,109 +44,96 @@ const we = ({
45
44
  children: /* @__PURE__ */ i(
46
45
  "div",
47
46
  {
48
- className: C(`${f}-message`, {
49
- [`${f}-message-help`]: y
47
+ className: S(`${b}-message`, {
48
+ [`${b}-message-help`]: y
50
49
  }),
51
- children: x(b) ? /* @__PURE__ */ E(ae, { children: [
50
+ children: x(h) ? /* @__PURE__ */ q(ie, { children: [
52
51
  g.length > 0 && g,
53
- c.length > 0 && c
54
- ] }) : b
52
+ p.length > 0 && p
53
+ ] }) : h
55
54
  }
56
55
  )
57
56
  }
58
57
  );
59
- }, Fe = {
58
+ }, we = {
60
59
  trigger: "onChange",
61
60
  triggerPropName: "value"
62
- }, $e = (f, b) => {
63
- const e = fe(f, Fe), { getPrefixCls: I, prefixCls: g } = F(ye), c = F(K), y = F(Ce), [u, p] = W(null), [d, T] = W(null), r = F(B), l = r.prefixCls || I?.("form"), q = e.layout || r.layout, J = e.labelAlign || r.labelAlign, N = de(!1), A = !e.labelCol && !r.labelCol, D = !e.wrapperCol && !r.wrapperCol, Q = (n, t = {}) => {
64
- if (N.current)
61
+ }, $e = (b, h) => {
62
+ const e = ue(b, we), { getPrefixCls: N, prefixCls: g } = F(ye), p = F(B), y = F(Ce), [f, u] = _(null), [d, A] = _(null), r = F(G), c = r.prefixCls || N?.("form"), l = `${c}-item`, D = e.layout || r.layout, Q = e.labelAlign || r.labelAlign, P = me(!1), L = !e.labelCol && !r.labelCol, M = !e.wrapperCol && !r.wrapperCol, X = (n, o = {}) => {
63
+ if (P.current)
65
64
  return;
66
- const { errors: m, warnings: s } = t || {};
67
- p((o) => {
68
- const a = { ...o || {} };
65
+ const { errors: m, warnings: s } = o || {};
66
+ u((t) => {
67
+ const a = { ...t || {} };
69
68
  return m ? a[n] = m : delete a[n], a;
70
- }), T((o) => {
71
- const a = { ...o || {} };
69
+ }), A((t) => {
70
+ const a = { ...t || {} };
72
71
  return s && s.length ? a[n] = s : delete a[n], a;
73
72
  });
74
- }, X = h(e.noStyle) && e.noStyle.showErrorTip && c.updateFormItem ? c.updateFormItem : Q;
75
- ce(() => (N.current = !1, () => {
76
- N.current = !0, p(null), T(null);
73
+ }, Y = C(e.noStyle) && e.noStyle.showErrorTip && p.updateFormItem ? p.updateFormItem : X;
74
+ de(() => (P.current = !1, () => {
75
+ P.current = !0, u(null), A(null);
77
76
  }), []);
78
- const Y = {
77
+ const Z = {
79
78
  ...r,
80
79
  validateMessages: r.validateMessages && xe(r.validateMessages, {
81
80
  label: e.label
82
81
  }),
83
- prefixCls: l,
84
- updateFormItem: X,
82
+ prefixCls: c,
83
+ updateFormItem: Y,
85
84
  disabled: "disabled" in e ? e.disabled : r.disabled
86
- }, { label: L, extra: M, className: Z, style: ee, validateStatus: v, hidden: re, ...te } = e, oe = C(`${l}-label-item`, {
87
- [`${l}-label-item-left`]: J === "left"
88
- }), j = u ? Object.values(u) : [], S = d ? Object.values(d).reduce((n, t) => n.concat(t), []) : [], w = _(() => {
89
- if (v)
90
- return v;
91
- if (j.length)
92
- return k.error;
93
- if (S.length)
94
- return k.warning;
95
- }, [u, d, v]), V = _(() => !x(e.help) || S.length > 0, [e.help, d]), le = C(
96
- `${l}-item`,
97
- {
98
- [`${l}-item-error`]: V || !v && w === k.error,
99
- [`${l}-item-status-${w}`]: w,
100
- [`${l}-item-has-help`]: V,
101
- [`${l}-item-hidden`]: re,
102
- [`${l}-item-has-feedback`]: w && e.hasFeedback
103
- },
104
- `${l}-layout-${q}`,
105
- Z
106
- ), O = () => {
107
- const { field: n, children: t } = e, m = "disabled" in e ? e.disabled : r.disabled;
108
- if (ue(t)) {
109
- const { key: s, ...o } = e ?? {};
110
- return /* @__PURE__ */ z(
111
- $,
85
+ }, { label: v, extra: j, className: ee, style: re, validateStatus: w, hidden: oe, ...te } = e, V = f ? Object.values(f) : [], k = d ? Object.values(d).reduce((n, o) => n.concat(o), []) : [], $ = z(() => {
86
+ if (w)
87
+ return w;
88
+ if (V.length)
89
+ return T.error;
90
+ if (k.length)
91
+ return T.warning;
92
+ }, [f, d, w]), O = z(() => !x(e.help) || k.length > 0, [e.help, d]), R = () => {
93
+ const { field: n, children: o } = e, m = "disabled" in e ? e.disabled : r.disabled;
94
+ if (pe(o)) {
95
+ const { key: s, ...t } = e ?? {};
96
+ return /* @__PURE__ */ H(
97
+ I,
112
98
  {
113
99
  disabled: m,
114
- ...o,
100
+ ...t,
115
101
  key: n || s,
116
102
  _key: n || s
117
103
  },
118
- (...a) => t(
104
+ (...a) => o(
119
105
  ...a
120
106
  )
121
107
  );
122
108
  }
123
- if (pe(t)) {
124
- const s = U.Children.map(t, (o, a) => {
125
- const R = h(o) && o.key || a, se = h(o) && "disabled" in o.props, ie = !x(m) && !se ? { key: R, disabled: m } : { key: R };
126
- return h(o) ? H(o, ie) : o;
109
+ if (ce(o)) {
110
+ const s = W.Children.map(o, (t, a) => {
111
+ const U = C(t) && t.key || a, ne = C(t) && "disabled" in t.props, se = !x(m) && !ne ? { key: U, disabled: m } : { key: U };
112
+ return C(t) ? K(t, se) : t;
127
113
  });
128
- return /* @__PURE__ */ i($, { ...e, field: void 0, children: s });
114
+ return /* @__PURE__ */ i(I, { ...e, field: void 0, children: s });
129
115
  }
130
- if (U.Children.count(t) == 1) {
116
+ if (W.Children.count(o) == 1) {
131
117
  if (n) {
132
118
  const s = y?.getItemKey?.(n) || n;
133
- return /* @__PURE__ */ z($, { disabled: m, ...e, key: s, _key: s }, t);
119
+ return /* @__PURE__ */ H(I, { disabled: m, ...e, key: s, _key: s }, o);
134
120
  }
135
- if (h(t)) {
136
- if (t.type?.isFormControl)
137
- return t;
138
- const o = !("disabled" in t.props) && !x(m) ? { disabled: m } : null;
139
- return /* @__PURE__ */ i($, { ...e, field: void 0, children: o ? H(t, o) : t });
121
+ if (C(o)) {
122
+ if (o.type?.isFormControl)
123
+ return o;
124
+ const t = !("disabled" in o.props) && !x(m) ? { disabled: m } : null;
125
+ return /* @__PURE__ */ i(I, { ...e, field: void 0, children: t ? K(o, t) : o });
140
126
  }
141
127
  }
142
- return t;
143
- }, ne = K, P = {
128
+ return o;
129
+ }, le = B, E = {
144
130
  ...r
145
131
  };
146
- return e.noStyle || (P.wrapperCol = void 0, P.labelCol = void 0), /* @__PURE__ */ i(B.Provider, { value: P, children: /* @__PURE__ */ i(ne.Provider, { value: Y, children: e.noStyle ? O() : /* @__PURE__ */ E(
147
- ve,
132
+ return e.noStyle || (E.wrapperCol = void 0, E.labelCol = void 0), /* @__PURE__ */ i(G.Provider, { value: E, children: /* @__PURE__ */ i(le.Provider, { value: Z, children: e.noStyle ? R() : /* @__PURE__ */ q(
133
+ fe,
148
134
  {
149
- ref: b,
150
- ...ge(te, [
135
+ ref: h,
136
+ ...he(te, [
151
137
  "tooltip",
152
138
  "children",
153
139
  "prefixCls",
@@ -177,29 +163,43 @@ const we = ({
177
163
  "requiredSymbol",
178
164
  "isFormList"
179
165
  ]),
180
- className: le,
181
- div: q !== "horizontal",
182
- style: ee,
166
+ className: S(
167
+ l,
168
+ {
169
+ [`${l}-error`]: O || !w && $ === T.error,
170
+ [`${l}-status-${$}`]: $,
171
+ [`${l}-has-help`]: O,
172
+ [`${l}-hidden`]: oe,
173
+ [`${l}-has-feedback`]: $ && e.hasFeedback
174
+ },
175
+ `${c}-layout-${D}`,
176
+ v ? `${l}-has-label` : `${l}-no-label`,
177
+ ee
178
+ ),
179
+ div: D !== "horizontal",
180
+ style: re,
183
181
  children: [
184
- L ? /* @__PURE__ */ i(
185
- G,
182
+ !!v && /* @__PURE__ */ i(
183
+ J,
186
184
  {
187
- className: C(
188
- oe,
185
+ className: S(
186
+ `${l}-label`,
187
+ `${c}-label-item`,
189
188
  e.labelCol?.className,
190
189
  r.labelCol?.className,
191
190
  {
192
- [`${l}-label-item-flex`]: A
191
+ [`${c}-label-item-left`]: Q === "left",
192
+ [`${c}-label-item-flex`]: L
193
193
  }
194
194
  ),
195
- flex: A ? 0 : void 0,
195
+ flex: L ? 0 : void 0,
196
196
  ...e.labelCol || r.labelCol,
197
197
  children: /* @__PURE__ */ i(
198
- he,
198
+ ge,
199
199
  {
200
200
  tooltip: e.tooltip,
201
201
  htmlFor: e.field && r?.getFormElementId?.(e.field),
202
- label: L,
202
+ label: v,
203
203
  prefix: g,
204
204
  requiredSymbol: "requiredSymbol" in e ? e.requiredSymbol : r.requiredSymbol,
205
205
  required: e.required,
@@ -208,35 +208,39 @@ const we = ({
208
208
  }
209
209
  )
210
210
  }
211
- ) : null,
212
- /* @__PURE__ */ E(
213
- G,
211
+ ),
212
+ /* @__PURE__ */ q(
213
+ J,
214
214
  {
215
- className: C(`${l}-item-wrapper`, {
216
- [`${l}-item-wrapper-flex`]: D
217
- }),
218
- flex: D ? 1 : void 0,
215
+ className: S(
216
+ `${l}-wrapper`,
217
+ {
218
+ [`${l}-wrapper-flex`]: M
219
+ },
220
+ v ? `${l}-wrapper-has-label` : `${l}-wrapper-no-label`
221
+ ),
222
+ flex: M ? 1 : void 0,
219
223
  ...e.wrapperCol || r.wrapperCol,
220
224
  children: [
221
- O(),
225
+ R(),
222
226
  /* @__PURE__ */ i(
223
- we,
227
+ ve,
224
228
  {
225
- prefixCls: l,
229
+ prefixCls: c,
226
230
  help: e.help,
227
- errors: j,
228
- warnings: S
231
+ errors: V,
232
+ warnings: k
229
233
  }
230
234
  ),
231
- M && /* @__PURE__ */ i("div", { className: `${l}-extra`, children: M })
235
+ j && /* @__PURE__ */ i("div", { className: `${c}-extra`, children: j })
232
236
  ]
233
237
  }
234
238
  )
235
239
  ]
236
240
  }
237
241
  ) }) });
238
- }, Ie = me($e);
239
- Ie.displayName = "FormItem";
242
+ }, Fe = ae($e);
243
+ Fe.displayName = "FormItem";
240
244
  export {
241
- Ie as default
245
+ Fe as default
242
246
  };
package/grid/Grid.js CHANGED
@@ -1,108 +1,74 @@
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 O from "lodash/isArray";
3
+ import f from "lodash/isNil";
4
+ import { forwardRef as _, useContext as A } 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,
16
- cols: 24,
6
+ import { COLS as g } from "../constant/index.js";
7
+ import L from "../components/common/hooks/useMergeProps.js";
8
+ import { useResponsiveState as c } from "../hooks/useResponsiveState.js";
9
+ import M from "@unicom-cloud/utils/class-name";
10
+ import "../components/common/utils/is.js";
11
+ import { GridContext as k } from "./context.js";
12
+ import q from "../config-provider/context.js";
13
+ import { isString as z, isNumber as d, isPlainObject as B } from "@unicom-cloud/utils/is";
14
+ const D = {
15
+ cols: g,
17
16
  gap: 0
18
17
  };
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,
25
- N?.Grid
18
+ function E(u, C) {
19
+ const { getPrefixCls: N, componentConfig: P, rtl: y } = A(q), G = N?.("grid"), $ = L(
20
+ u,
21
+ D,
22
+ P?.Grid
26
23
  ), {
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(
24
+ style: w,
25
+ className: v,
26
+ children: S,
27
+ cols: R,
28
+ gap: r,
29
+ colGap: l,
30
+ rowGap: m
31
+ } = $;
32
+ let i = m, t = l;
33
+ const T = f(r), b = f(m), h = f(l);
34
+ T || (O(r) ? (i = r[0], t = r[1] ?? r[0]) : i = t = r), b || (i = m), h || (t = l);
35
+ const o = c(R, g), a = c(i, 0), n = c(t, 0), e = {};
36
+ if (a && (e.rowGap = a), n && (e.columnGap = n), z(o))
37
+ e.gridTemplateColumns = o;
38
+ else if (d(o))
39
+ e.gridTemplateColumns = `repeat(${o}, minmax(0px, 1fr))`;
40
+ else if (B(o) && "type" in o) {
41
+ const j = o.type;
42
+ let s = o.max ?? "1fr";
43
+ d(s) && (s = `${s}px`);
44
+ let p = o.min ?? "0px";
45
+ d(p) && (p = `${p}px`), e.gridTemplateColumns = `repeat(${j}, minmax(${p}, ${s}))`;
46
+ }
47
+ return /* @__PURE__ */ x(
58
48
  "div",
59
49
  {
60
- ref: _,
61
- className: b,
50
+ ref: C,
51
+ className: M(G, y && `${G}-rtl`, v),
62
52
  style: {
63
- ...E,
64
- ...M
53
+ ...e,
54
+ ...w
65
55
  },
66
- children: /* @__PURE__ */ i(
67
- F.Provider,
56
+ children: /* @__PURE__ */ x(
57
+ k.Provider,
68
58
  {
69
59
  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
- }
60
+ cols: o,
61
+ rowGap: a,
62
+ colGap: n
76
63
  },
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
- )
64
+ children: S
99
65
  }
100
66
  )
101
67
  }
102
68
  );
103
69
  }
104
- const W = Q(U);
105
- W.displayName = "Grid";
70
+ const F = _(E);
71
+ F.displayName = "Grid";
106
72
  export {
107
- W as default
73
+ F as default
108
74
  };
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 S } from "react/jsx-runtime";
2
+ import { forwardRef as v, useContext as i } 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,
14
- offset: 0,
15
- span: 1
16
- };
17
- function W($, g) {
18
- const { getPrefixCls: _, componentConfig: y, rtl: S } = p(K), a = q(
19
- $,
20
- U,
21
- y?.["Grid.Item"]
4
+ import R from "../components/common/hooks/useMergeProps.js";
5
+ import { useResponsiveState as a } from "../hooks/useResponsiveState.js";
6
+ import b from "@unicom-cloud/utils/class-name";
7
+ import "../components/common/utils/is.js";
8
+ import { GridContext as h } from "./context.js";
9
+ import { resolveItemData as j } from "./util.js";
10
+ import w from "../config-provider/context.js";
11
+ import { isNumber as t } from "@unicom-cloud/utils/is";
12
+ function D(c, l) {
13
+ const { getPrefixCls: d, componentConfig: u, rtl: C } = i(w), n = d?.("grid-item"), x = R(
14
+ c,
15
+ {
16
+ offset: 0,
17
+ span: 1
18
+ },
19
+ u?.GridItem
22
20
  ), {
23
- children: i,
24
- className: G,
25
- style: v,
26
- 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(
21
+ style: $,
22
+ className: g,
23
+ children: N,
24
+ offset: P,
25
+ span: m,
26
+ order: p
27
+ } = x, { colGap: e, cols: f } = i(h), G = a(P, 0), y = a(m, 1), { span: s, offset: r } = t(f) ? j(f, {
28
+ span: y,
29
+ offset: G
30
+ }) : {}, o = {};
31
+ if (t(p) && (o.order = p), t(s)) {
32
+ if (o.gridColumnStart = `span ${s}`, t(e) && t(r) && r > 0) {
33
+ const I = `(100% - ${e * (s - 1)}px) / ${s}`;
34
+ o.marginLeft = `calc(${I} * ${r} + ${e * r}px)`;
35
+ }
36
+ o.gridColumnEnd = `span ${m}`;
37
+ }
38
+ return /* @__PURE__ */ S(
56
39
  "div",
57
40
  {
58
- ref: g,
59
- className: b,
41
+ ref: l,
60
42
  style: {
61
- ...B,
62
- ...v
43
+ ...o,
44
+ ...$
63
45
  },
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)
46
+ className: b(n, C && `${n}-rtl`, g),
47
+ children: N
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 E = v(D);
52
+ E.displayName = "Grid.Item";
74
53
  export {
75
- I as default
54
+ E as default
76
55
  };
package/grid/context.js CHANGED
@@ -1,9 +1,5 @@
1
1
  import { createContext as t } from "react";
2
- const e = t({}), n = t({}), r = t(
3
- {}
4
- );
2
+ const e = t({});
5
3
  export {
6
- n as GridContext,
7
- r as GridDataCollectorContext,
8
- e as RowContext
4
+ e as GridContext
9
5
  };