@unicom-cloud/ui 0.8.91 → 0.8.93

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 (57) hide show
  1. package/Upload.js +4 -4
  2. package/color-picker/Mode.js +6 -7
  3. package/index.js +171 -171
  4. package/package.json +1 -1
  5. package/tree/Node.js +72 -72
  6. package/tree/Tree.js +332 -332
  7. package/types/common/empty/index.d.ts +1 -1
  8. package/types/common/icons/file/index.d.ts +1 -1
  9. package/types/common/space/index.d.ts +1 -1
  10. package/types/pc/anchor/context.d.ts +1 -1
  11. package/types/pc/color-picker/InputHex.d.ts +1 -1
  12. package/types/pc/color-picker/InputRgb.d.ts +1 -1
  13. package/types/pc/color-picker/Mode.d.ts +1 -1
  14. package/types/pc/color-picker/Palette.d.ts +1 -1
  15. package/types/pc/color-picker/utils.d.ts +1 -1
  16. package/types/pc/config-provider/context.d.ts +1 -1
  17. package/types/pc/date-picker/Picker.d.ts +1 -1
  18. package/types/pc/date-picker/RangePicker.d.ts +1 -1
  19. package/types/pc/grid/context.d.ts +1 -1
  20. package/types/pc/grid/util.d.ts +1 -1
  21. package/types/pc/hooks/use-watermark/index.d.ts +1 -1
  22. package/types/pc/icons/file/index.d.ts +1 -1
  23. package/types/pc/input/index.d.ts +1 -1
  24. package/types/pc/message/index.d.ts +1 -2
  25. package/types/pc/message/useMessage.d.ts +1 -1
  26. package/types/pc/notification/useNotification.d.ts +1 -1
  27. package/types/pc/space/index.d.ts +1 -1
  28. package/types/pc/table/ColGroup.d.ts +1 -1
  29. package/types/pc/table/constant.d.ts +1 -1
  30. package/types/pc/tree/Context.d.ts +1 -2
  31. package/types/pc/tree/index.d.ts +1 -1
  32. package/types/pc/tree/interface.d.ts +5 -1
  33. package/types/pc/trigger/getPopupStyle.d.ts +1 -1
  34. package/types/pc/typography/EditContent.d.ts +1 -1
  35. package/types/pc/typography/Ellipsis.d.ts +1 -1
  36. package/types/pc/typography/Paragraph.d.ts +1 -1
  37. package/types/pc/typography/Title.d.ts +1 -1
  38. package/types/pc/upload/Upload.d.ts +2 -2
  39. package/types/pc/upload/constant.d.ts +4 -0
  40. package/types/pc/upload/index.d.ts +2 -0
  41. package/types/pc/upload/interface.d.ts +0 -3
  42. package/types/pc/upload/request.d.ts +1 -1
  43. package/types/pc/upload/util.d.ts +1 -1
  44. package/types/pc/verification-code/VerificationCode.d.ts +1 -1
  45. package/types/pc/verification-code/index.d.ts +1 -1
  46. package/types/pc/watermark/Watermark.d.ts +1 -1
  47. package/types/pc/watermark/index.d.ts +1 -1
  48. package/upload/Upload.js +52 -53
  49. package/upload/Uploader.js +1 -1
  50. package/upload/constant.js +9 -0
  51. package/upload/index.js +4 -4
  52. package/upload/interface.js +1 -9
  53. package/upload/list/PictureItem.js +1 -1
  54. package/upload/list/TextItem.js +1 -1
  55. package/upload/list/UploadProgress.js +1 -1
  56. package/upload/list/index.js +1 -1
  57. package/version/index.js +1 -1
package/tree/Node.js CHANGED
@@ -1,35 +1,35 @@
1
- import { jsxs as w, Fragment as q, jsx as s } from "react/jsx-runtime";
1
+ import { jsxs as w, Fragment as q, jsx as r } from "react/jsx-runtime";
2
2
  import z from "@unicom-cloud/icons/IconUiCaretDown";
3
3
  import G from "@unicom-cloud/icons/IconUiDragDotVertical";
4
4
  import J from "@unicom-cloud/icons/IconUiFile";
5
5
  import K from "@unicom-cloud/icons/IconUiLoading";
6
- import u from "lodash/isFunction";
7
- import Q, { forwardRef as W, useContext as C, useRef as X, useState as Z, useCallback as I } from "react";
6
+ import m from "lodash/isFunction";
7
+ import Q, { forwardRef as W, useContext as _, useRef as X, useState as Z, useCallback as I } from "react";
8
8
  import ee from "../checkbox/Checkbox.js";
9
9
  import "../config-provider/ConfigProvider.js";
10
- import ae from "../icon-hover/index.js";
10
+ import ne from "../icon-hover/index.js";
11
11
  import b from "@unicom-cloud/utils/class-name";
12
- import { throttleByRaf as ne } from "../components/common/utils/throttleByRaf.js";
12
+ import { throttleByRaf as ae } from "../components/common/utils/throttleByRaf.js";
13
13
  import ie from "./Animation.js";
14
14
  import { TreeContext as oe } from "./Context.js";
15
15
  import te from "../config-provider/context.js";
16
16
  function re(i, U) {
17
- const a = C(oe), { getPrefixCls: $ } = C(te), x = X(), [t, f] = Z({
17
+ const n = _(oe), { getPrefixCls: $ } = _(te), x = X(), [t, f] = Z({
18
18
  isAllowDrop: !0,
19
19
  isDragOver: !1,
20
20
  dragPosition: 0,
21
21
  isDragging: !1
22
22
  }), {
23
- _key: m = "",
23
+ _key: h = "",
24
24
  title: Y,
25
- icon: O,
26
- checkable: p,
25
+ icon: p,
26
+ checkable: O,
27
27
  selected: F,
28
28
  disabled: N,
29
29
  disableCheckbox: H,
30
30
  isLeaf: P,
31
- draggable: d,
32
- expanded: g,
31
+ draggable: l,
32
+ expanded: d,
33
33
  showLine: v,
34
34
  loading: M,
35
35
  selectable: T = !0
@@ -38,67 +38,67 @@ function re(i, U) {
38
38
  {
39
39
  [`${o}-selected`]: F,
40
40
  [`${o}-is-leaf`]: P,
41
- [`${o}-expanded`]: g,
41
+ [`${o}-expanded`]: d,
42
42
  [`${o}-disabled-selectable`]: !T,
43
43
  [`${o}-disabled`]: N,
44
- [`${o}-draggable`]: d
44
+ [`${o}-draggable`]: l
45
45
  },
46
46
  i.className
47
47
  ), c = (() => {
48
- const e = u(a.icons) ? a.icons(i) : a.icons, n = u(i.icons) ? i.icons(i) : i.icons;
49
- return { ...e, ...n };
48
+ const e = m(n.icons) ? n.icons(i) : n.icons, a = m(i.icons) ? i.icons(i) : i.icons;
49
+ return { ...e, ...a };
50
50
  })(), y = I(
51
51
  (e) => {
52
- var n;
53
- e !== g && ((n = a.onExpand) == null || n.call(a, e, m));
52
+ var a;
53
+ e !== d && ((a = n.onExpand) == null || a.call(n, e, h));
54
54
  },
55
- [g, a.onExpand]
55
+ [d, n.onExpand]
56
56
  ), A = I(async () => {
57
- var r;
58
- const { isLeaf: e, expanded: n } = i;
59
- e || (!((r = i.childrenData) != null && r.length) && u(a.loadMore) && !n ? await a.loadMore(i) : y(!n));
60
- }, [i, y, a.loadMore]), B = () => {
57
+ var s;
58
+ const { isLeaf: e, expanded: a } = i;
59
+ e || (!((s = i.childrenData) != null && s.length) && m(n.loadMore) && !a ? await n.loadMore(i) : y(!a));
60
+ }, [i, y, n.loadMore]), B = () => {
61
61
  if (M)
62
- return "loadingIcon" in c ? c.loadingIcon : /* @__PURE__ */ s(K, {});
63
- let e = null, n = !1;
62
+ return "loadingIcon" in c ? c.loadingIcon : /* @__PURE__ */ r(K, {});
63
+ let e = null, a = !1;
64
64
  if (P)
65
- v && (e = "switcherIcon" in c ? c.switcherIcon : /* @__PURE__ */ s(J, {}), n = !0);
65
+ v && (e = "switcherIcon" in c ? c.switcherIcon : /* @__PURE__ */ r(J, {}), a = !0);
66
66
  else {
67
- const r = v ? /* @__PURE__ */ s("span", { className: `${o}-${g ? "minus" : "plus"}-icon` }) : /* @__PURE__ */ s(z, {});
68
- e = "switcherIcon" in c ? c.switcherIcon : r, n = !v;
67
+ const s = v ? /* @__PURE__ */ r("span", { className: `${o}-${d ? "minus" : "plus"}-icon` }) : /* @__PURE__ */ r(z, {});
68
+ e = "switcherIcon" in c ? c.switcherIcon : s, a = !v;
69
69
  }
70
70
  if (e)
71
- return e = /* @__PURE__ */ s(
71
+ return e = /* @__PURE__ */ r(
72
72
  "span",
73
73
  {
74
74
  className: `${o}-switcher-icon`,
75
- "aria-label": g ? "fold button" : "expand button",
75
+ "aria-label": d ? "fold button" : "expand button",
76
76
  role: "button",
77
77
  tabIndex: 0,
78
78
  onClick: A,
79
79
  children: e
80
80
  }
81
- ), n ? /* @__PURE__ */ s(ae, { prefix: o, children: e }) : e;
82
- }, D = I(
83
- ne((e) => {
84
- var _;
85
- const n = x.current;
86
- if (!n)
81
+ ), a ? /* @__PURE__ */ r(ne, { prefix: o, children: e }) : e;
82
+ }, u = I(
83
+ ae((e) => {
84
+ var R;
85
+ const a = x.current;
86
+ if (!a)
87
87
  return;
88
- const r = n.getBoundingClientRect(), h = window.pageYOffset + r.top, l = e.pageY, L = r.height / 4, R = l - h, k = R < L ? -1 : R < r.height - L ? 0 : 1, V = a.allowDrop(i, k);
88
+ const s = a.getBoundingClientRect(), g = window.pageYOffset + s.top, D = e.pageY, L = s.height / 4, C = D - g, k = C < L ? -1 : C < s.height - L ? 0 : 1, V = n.allowDrop(i, k);
89
89
  f({
90
90
  ...t,
91
91
  isAllowDrop: V,
92
92
  isDragOver: !0,
93
93
  dragPosition: k
94
- }), (_ = a.onNodeDragOver) == null || _.call(a, e, i, k);
94
+ }), (R = n.onNodeDragOver) == null || R.call(n, e, i, k);
95
95
  }),
96
- [a.onNodeDragOver]
96
+ [n.onNodeDragOver]
97
97
  );
98
- function E(e, n) {
99
- var l;
100
- const { disableCheckbox: r, disabled: h } = i;
101
- r || h || (l = a.onCheck) == null || l.call(a, e, m, n);
98
+ function E(e, a) {
99
+ var D;
100
+ const { disableCheckbox: s, disabled: g } = i;
101
+ s || g || (D = n.onCheck) == null || D.call(n, e, h, a);
102
102
  }
103
103
  return /* @__PURE__ */ w(q, { children: [
104
104
  /* @__PURE__ */ w(
@@ -109,32 +109,32 @@ function re(i, U) {
109
109
  ref: U,
110
110
  role: "treeitem",
111
111
  "aria-disabled": N,
112
- "aria-expanded": g,
112
+ "aria-expanded": d,
113
113
  "aria-level": i._level,
114
114
  children: [
115
- /* @__PURE__ */ s("span", { className: `${o}-indent`, "aria-hidden": !0, children: [...Array(i._level)].map((e, n) => /* @__PURE__ */ s(
115
+ /* @__PURE__ */ r("span", { className: `${o}-indent`, "aria-hidden": !0, children: [...Array(i._level)].map((e, a) => /* @__PURE__ */ r(
116
116
  "span",
117
117
  {
118
118
  className: b(`${o}-indent-block`, {
119
- [`${o}-indent-block-lineless`]: i._lineless && i._lineless[n]
119
+ [`${o}-indent-block-lineless`]: i._lineless && i._lineless[a]
120
120
  })
121
121
  },
122
- n
122
+ a
123
123
  )) }),
124
- /* @__PURE__ */ s(
124
+ /* @__PURE__ */ r(
125
125
  "span",
126
126
  {
127
127
  className: b(`${o}-switcher`, {
128
- [`${o}-switcher-expanded`]: g
128
+ [`${o}-switcher-expanded`]: d
129
129
  }),
130
130
  children: B()
131
131
  }
132
132
  ),
133
- p ? /* @__PURE__ */ s(
133
+ O ? /* @__PURE__ */ r(
134
134
  ee,
135
135
  {
136
136
  disabled: H || N,
137
- value: m,
137
+ value: h,
138
138
  indeterminate: i.indeterminated,
139
139
  checked: i.checked,
140
140
  onChange: E
@@ -146,7 +146,7 @@ function re(i, U) {
146
146
  "aria-grabbed": t.isDragging,
147
147
  ref: x,
148
148
  className: b(`${o}-title`, {
149
- [`${o}-title-draggable`]: d,
149
+ [`${o}-title-draggable`]: l,
150
150
  [`${o}-title-gap-top`]: t.isDragOver && t.isAllowDrop && t.dragPosition < 0,
151
151
  [`${o}-title-gap-bottom`]: t.isDragOver && t.isAllowDrop && t.dragPosition > 0,
152
152
  [`${o}-title-highlight`]: !t.isDragging && t.isDragOver && t.isAllowDrop && t.dragPosition === 0,
@@ -154,56 +154,56 @@ function re(i, U) {
154
154
  [`${o}-title-block`]: i.blockNode
155
155
  }),
156
156
  onClick: (e) => {
157
- const { onSelect: n, onNodeClick: r, actionOnClick: h } = a;
157
+ const { onSelect: a, actionOnClick: s } = n;
158
158
  if (!i.disabled) {
159
- const l = [].concat(h);
160
- T && l.indexOf("select") > -1 && (n == null || n(m, e)), l.indexOf("expand") > -1 && A(), p && l.indexOf("check") > -1 && E(!i.checked, e), r == null || r(m, i.dataRef, i);
159
+ const g = [].concat(s);
160
+ T && g.indexOf("select") > -1 && (a == null || a(h, e)), g.indexOf("expand") > -1 && A(), O && g.indexOf("check") > -1 && E(!i.checked, e);
161
161
  }
162
162
  },
163
- draggable: d,
163
+ draggable: l,
164
164
  onDrop: (e) => {
165
- var n;
166
- e.stopPropagation(), e.preventDefault(), (n = a.onNodeDrop) == null || n.call(a, e, i, t.dragPosition), D.cancel(), f({
165
+ var a;
166
+ e.stopPropagation(), e.preventDefault(), (a = n.onNodeDrop) == null || a.call(n, e, i, t.dragPosition), u.cancel(), f({
167
167
  ...t,
168
168
  isDragOver: !1,
169
169
  dragPosition: 0
170
170
  });
171
171
  },
172
172
  onDragStart: (e) => {
173
- var n;
174
- if (d) {
173
+ var a;
174
+ if (l) {
175
175
  e.stopPropagation(), f({ ...t, isDragging: !0 });
176
176
  try {
177
177
  e.dataTransfer.setData("text/plain", "");
178
- } catch (r) {
179
- console.error(r);
178
+ } catch (s) {
179
+ console.error(s);
180
180
  }
181
- (n = a.onNodeDragStart) == null || n.call(a, e, i);
181
+ (a = n.onNodeDragStart) == null || a.call(n, e, i);
182
182
  }
183
183
  },
184
184
  onDragEnd: (e) => {
185
- var n;
186
- d && (e.stopPropagation(), D.cancel(), f({ ...t, isDragOver: !1, isDragging: !1 }), (n = a.onNodeDragEnd) == null || n.call(a, e, i));
185
+ var a;
186
+ l && (e.stopPropagation(), u.cancel(), f({ ...t, isDragOver: !1, isDragging: !1 }), (a = n.onNodeDragEnd) == null || a.call(n, e, i));
187
187
  },
188
188
  onDragOver: (e) => {
189
- e.preventDefault(), e.stopPropagation(), e.persist(), D(e);
189
+ e.preventDefault(), e.stopPropagation(), e.persist(), u(e);
190
190
  },
191
191
  onDragLeave: (e) => {
192
- var n;
193
- d && (e.stopPropagation(), D.cancel(), f({ ...t, isDragOver: !1 }), (n = a.onNodeDragLeave) == null || n.call(a, e, i));
192
+ var a;
193
+ l && (e.stopPropagation(), u.cancel(), f({ ...t, isDragOver: !1 }), (a = n.onNodeDragLeave) == null || a.call(n, e, i));
194
194
  },
195
195
  children: [
196
- O && /* @__PURE__ */ s("span", { className: `${o}-icon ${o}-custom-icon`, children: O }),
197
- /* @__PURE__ */ s("span", { className: `${o}-title-text`, children: u(a.renderTitle) ? a.renderTitle(i) : Y }),
198
- d && /* @__PURE__ */ s("span", { className: `${o}-icon ${o}-drag-icon`, children: "dragIcon" in c ? c.dragIcon : /* @__PURE__ */ s(G, {}) })
196
+ p && /* @__PURE__ */ r("span", { className: `${o}-icon ${o}-custom-icon`, children: p }),
197
+ /* @__PURE__ */ r("span", { className: `${o}-title-text`, children: m(n.renderTitle) ? n.renderTitle(i) : Y }),
198
+ l && /* @__PURE__ */ r("span", { className: `${o}-icon ${o}-drag-icon`, children: "dragIcon" in c ? c.dragIcon : /* @__PURE__ */ r(G, {}) })
199
199
  ]
200
200
  }
201
201
  ),
202
- u(a.renderExtra) && a.renderExtra(i)
202
+ m(n.renderExtra) && n.renderExtra(i)
203
203
  ]
204
204
  }
205
205
  ),
206
- a.animation && /* @__PURE__ */ s(ie, { ...i })
206
+ n.animation && /* @__PURE__ */ r(ie, { ...i })
207
207
  ] });
208
208
  }
209
209
  const S = W(re);