@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.
- package/Upload.js +4 -4
- package/color-picker/Mode.js +6 -7
- package/index.js +171 -171
- package/package.json +1 -1
- package/tree/Node.js +72 -72
- package/tree/Tree.js +332 -332
- package/types/common/empty/index.d.ts +1 -1
- package/types/common/icons/file/index.d.ts +1 -1
- package/types/common/space/index.d.ts +1 -1
- package/types/pc/anchor/context.d.ts +1 -1
- package/types/pc/color-picker/InputHex.d.ts +1 -1
- package/types/pc/color-picker/InputRgb.d.ts +1 -1
- package/types/pc/color-picker/Mode.d.ts +1 -1
- package/types/pc/color-picker/Palette.d.ts +1 -1
- package/types/pc/color-picker/utils.d.ts +1 -1
- package/types/pc/config-provider/context.d.ts +1 -1
- package/types/pc/date-picker/Picker.d.ts +1 -1
- package/types/pc/date-picker/RangePicker.d.ts +1 -1
- package/types/pc/grid/context.d.ts +1 -1
- package/types/pc/grid/util.d.ts +1 -1
- package/types/pc/hooks/use-watermark/index.d.ts +1 -1
- package/types/pc/icons/file/index.d.ts +1 -1
- package/types/pc/input/index.d.ts +1 -1
- package/types/pc/message/index.d.ts +1 -2
- package/types/pc/message/useMessage.d.ts +1 -1
- package/types/pc/notification/useNotification.d.ts +1 -1
- package/types/pc/space/index.d.ts +1 -1
- package/types/pc/table/ColGroup.d.ts +1 -1
- package/types/pc/table/constant.d.ts +1 -1
- package/types/pc/tree/Context.d.ts +1 -2
- package/types/pc/tree/index.d.ts +1 -1
- package/types/pc/tree/interface.d.ts +5 -1
- package/types/pc/trigger/getPopupStyle.d.ts +1 -1
- package/types/pc/typography/EditContent.d.ts +1 -1
- package/types/pc/typography/Ellipsis.d.ts +1 -1
- package/types/pc/typography/Paragraph.d.ts +1 -1
- package/types/pc/typography/Title.d.ts +1 -1
- package/types/pc/upload/Upload.d.ts +2 -2
- package/types/pc/upload/constant.d.ts +4 -0
- package/types/pc/upload/index.d.ts +2 -0
- package/types/pc/upload/interface.d.ts +0 -3
- package/types/pc/upload/request.d.ts +1 -1
- package/types/pc/upload/util.d.ts +1 -1
- package/types/pc/verification-code/VerificationCode.d.ts +1 -1
- package/types/pc/verification-code/index.d.ts +1 -1
- package/types/pc/watermark/Watermark.d.ts +1 -1
- package/types/pc/watermark/index.d.ts +1 -1
- package/upload/Upload.js +52 -53
- package/upload/Uploader.js +1 -1
- package/upload/constant.js +9 -0
- package/upload/index.js +4 -4
- package/upload/interface.js +1 -9
- package/upload/list/PictureItem.js +1 -1
- package/upload/list/TextItem.js +1 -1
- package/upload/list/UploadProgress.js +1 -1
- package/upload/list/index.js +1 -1
- 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
|
|
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
|
|
7
|
-
import Q, { forwardRef as W, useContext as
|
|
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
|
|
10
|
+
import ne from "../icon-hover/index.js";
|
|
11
11
|
import b from "@unicom-cloud/utils/class-name";
|
|
12
|
-
import { throttleByRaf as
|
|
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
|
|
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:
|
|
23
|
+
_key: h = "",
|
|
24
24
|
title: Y,
|
|
25
|
-
icon:
|
|
26
|
-
checkable:
|
|
25
|
+
icon: p,
|
|
26
|
+
checkable: O,
|
|
27
27
|
selected: F,
|
|
28
28
|
disabled: N,
|
|
29
29
|
disableCheckbox: H,
|
|
30
30
|
isLeaf: P,
|
|
31
|
-
draggable:
|
|
32
|
-
expanded:
|
|
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`]:
|
|
41
|
+
[`${o}-expanded`]: d,
|
|
42
42
|
[`${o}-disabled-selectable`]: !T,
|
|
43
43
|
[`${o}-disabled`]: N,
|
|
44
|
-
[`${o}-draggable`]:
|
|
44
|
+
[`${o}-draggable`]: l
|
|
45
45
|
},
|
|
46
46
|
i.className
|
|
47
47
|
), c = (() => {
|
|
48
|
-
const e =
|
|
49
|
-
return { ...e, ...
|
|
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
|
|
53
|
-
e !==
|
|
52
|
+
var a;
|
|
53
|
+
e !== d && ((a = n.onExpand) == null || a.call(n, e, h));
|
|
54
54
|
},
|
|
55
|
-
[
|
|
55
|
+
[d, n.onExpand]
|
|
56
56
|
), A = I(async () => {
|
|
57
|
-
var
|
|
58
|
-
const { isLeaf: e, expanded:
|
|
59
|
-
e || (!((
|
|
60
|
-
}, [i, y,
|
|
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__ */
|
|
63
|
-
let e = null,
|
|
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__ */
|
|
65
|
+
v && (e = "switcherIcon" in c ? c.switcherIcon : /* @__PURE__ */ r(J, {}), a = !0);
|
|
66
66
|
else {
|
|
67
|
-
const
|
|
68
|
-
e = "switcherIcon" in c ? c.switcherIcon :
|
|
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__ */
|
|
71
|
+
return e = /* @__PURE__ */ r(
|
|
72
72
|
"span",
|
|
73
73
|
{
|
|
74
74
|
className: `${o}-switcher-icon`,
|
|
75
|
-
"aria-label":
|
|
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
|
-
),
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
var
|
|
85
|
-
const
|
|
86
|
-
if (!
|
|
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
|
|
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
|
-
}), (
|
|
94
|
+
}), (R = n.onNodeDragOver) == null || R.call(n, e, i, k);
|
|
95
95
|
}),
|
|
96
|
-
[
|
|
96
|
+
[n.onNodeDragOver]
|
|
97
97
|
);
|
|
98
|
-
function E(e,
|
|
99
|
-
var
|
|
100
|
-
const { disableCheckbox:
|
|
101
|
-
|
|
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":
|
|
112
|
+
"aria-expanded": d,
|
|
113
113
|
"aria-level": i._level,
|
|
114
114
|
children: [
|
|
115
|
-
/* @__PURE__ */
|
|
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[
|
|
119
|
+
[`${o}-indent-block-lineless`]: i._lineless && i._lineless[a]
|
|
120
120
|
})
|
|
121
121
|
},
|
|
122
|
-
|
|
122
|
+
a
|
|
123
123
|
)) }),
|
|
124
|
-
/* @__PURE__ */
|
|
124
|
+
/* @__PURE__ */ r(
|
|
125
125
|
"span",
|
|
126
126
|
{
|
|
127
127
|
className: b(`${o}-switcher`, {
|
|
128
|
-
[`${o}-switcher-expanded`]:
|
|
128
|
+
[`${o}-switcher-expanded`]: d
|
|
129
129
|
}),
|
|
130
130
|
children: B()
|
|
131
131
|
}
|
|
132
132
|
),
|
|
133
|
-
|
|
133
|
+
O ? /* @__PURE__ */ r(
|
|
134
134
|
ee,
|
|
135
135
|
{
|
|
136
136
|
disabled: H || N,
|
|
137
|
-
value:
|
|
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`]:
|
|
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:
|
|
157
|
+
const { onSelect: a, actionOnClick: s } = n;
|
|
158
158
|
if (!i.disabled) {
|
|
159
|
-
const
|
|
160
|
-
T &&
|
|
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:
|
|
163
|
+
draggable: l,
|
|
164
164
|
onDrop: (e) => {
|
|
165
|
-
var
|
|
166
|
-
e.stopPropagation(), e.preventDefault(), (
|
|
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
|
|
174
|
-
if (
|
|
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 (
|
|
179
|
-
console.error(
|
|
178
|
+
} catch (s) {
|
|
179
|
+
console.error(s);
|
|
180
180
|
}
|
|
181
|
-
(
|
|
181
|
+
(a = n.onNodeDragStart) == null || a.call(n, e, i);
|
|
182
182
|
}
|
|
183
183
|
},
|
|
184
184
|
onDragEnd: (e) => {
|
|
185
|
-
var
|
|
186
|
-
|
|
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(),
|
|
189
|
+
e.preventDefault(), e.stopPropagation(), e.persist(), u(e);
|
|
190
190
|
},
|
|
191
191
|
onDragLeave: (e) => {
|
|
192
|
-
var
|
|
193
|
-
|
|
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
|
-
|
|
197
|
-
/* @__PURE__ */
|
|
198
|
-
|
|
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
|
-
|
|
202
|
+
m(n.renderExtra) && n.renderExtra(i)
|
|
203
203
|
]
|
|
204
204
|
}
|
|
205
205
|
),
|
|
206
|
-
|
|
206
|
+
n.animation && /* @__PURE__ */ r(ie, { ...i })
|
|
207
207
|
] });
|
|
208
208
|
}
|
|
209
209
|
const S = W(re);
|