@rockshin/tao-ui 0.0.58 → 0.0.59
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/dist/components/affix/affix.js +38 -4
- package/dist/components/app/app-modals.js +11 -6
- package/dist/components/app/app-notices.js +105 -47
- package/dist/components/auto-complete/auto-complete.js +9 -2
- package/dist/components/calendar/calendar.js +22 -18
- package/dist/components/carousel/carousel.js +27 -14
- package/dist/components/cascader/cascader.js +17 -12
- package/dist/components/checkbox/checkbox.d.ts +3 -1
- package/dist/components/checkbox/checkbox.js +65 -58
- package/dist/components/color-picker/color-picker.js +383 -360
- package/dist/components/date-picker/calendar/calendar-grid.d.ts +5 -3
- package/dist/components/date-picker/calendar/calendar-grid.js +9 -4
- package/dist/components/date-picker/calendar/month-grid.d.ts +2 -1
- package/dist/components/date-picker/calendar/month-grid.js +61 -45
- package/dist/components/date-picker/calendar/time-panel.d.ts +8 -1
- package/dist/components/date-picker/calendar/time-panel.js +89 -88
- package/dist/components/date-picker/calendar/year-grid.d.ts +2 -1
- package/dist/components/date-picker/calendar/year-grid.js +60 -44
- package/dist/components/date-picker/date-picker.css +9 -0
- package/dist/components/date-picker/date-picker.js +22 -13
- package/dist/components/date-picker/range-picker.d.ts +2 -0
- package/dist/components/date-picker/range-picker.js +127 -70
- package/dist/components/date-picker/types.js +1 -1
- package/dist/components/drawer/drawer.d.ts +1 -1
- package/dist/components/drawer/drawer.js +4 -3
- package/dist/components/dropdown/dropdown.js +11 -9
- package/dist/components/float-button/float-button.js +4 -4
- package/dist/components/form/form-item.d.ts +1 -1
- package/dist/components/form/form-item.js +160 -120
- package/dist/components/form-field/form-field-view.d.ts +2 -1
- package/dist/components/form-field/form-field-view.js +173 -108
- package/dist/components/input/input-shared.js +3 -2
- package/dist/components/input/otp.js +114 -110
- package/dist/components/input/password.js +55 -61
- package/dist/components/input/search.js +8 -4
- package/dist/components/mentions/mentions.js +1 -0
- package/dist/components/menu/menu-render.js +1 -0
- package/dist/components/modal/confirm-dialog.js +11 -4
- package/dist/components/modal/modal.js +320 -315
- package/dist/components/pagination/pagination.d.ts +1 -0
- package/dist/components/pagination/pagination.js +1 -0
- package/dist/components/popover/popover.js +325 -289
- package/dist/components/qr-code/qr-code.js +157 -150
- package/dist/components/radio/radio.d.ts +3 -1
- package/dist/components/radio/radio.js +73 -64
- package/dist/components/select/mobile-select.js +6 -3
- package/dist/components/select/select-model.js +2 -2
- package/dist/components/select/select.js +78 -39
- package/dist/components/select/use-select-selection.js +58 -58
- package/dist/components/slider/slider.d.ts +2 -2
- package/dist/components/slider/slider.js +13 -2
- package/dist/components/sonner/sonner.js +2 -2
- package/dist/components/splitter/splitter.css +1 -0
- package/dist/components/splitter/splitter.js +152 -126
- package/dist/components/switch/switch.js +45 -39
- package/dist/components/table/table.js +1 -0
- package/dist/components/table/use-table-data.js +2 -2
- package/dist/components/time-picker/time-picker.js +31 -1
- package/dist/components/tooltip/tooltip.js +237 -99
- package/dist/components/tree/tree.js +31 -3
- package/dist/components/tree-select/tree-select.js +1 -1
- package/dist/components/upload/upload.js +67 -40
- package/dist/locales/ar-EG.js +2 -0
- package/dist/locales/de-DE.js +2 -0
- package/dist/locales/en-US.js +2 -0
- package/dist/locales/es-ES.js +2 -0
- package/dist/locales/fr-FR.js +2 -0
- package/dist/locales/hi-IN.js +2 -0
- package/dist/locales/id-ID.js +2 -0
- package/dist/locales/it-IT.js +2 -0
- package/dist/locales/ja-JP.js +2 -0
- package/dist/locales/ko-KR.js +2 -0
- package/dist/locales/pt-BR.js +2 -0
- package/dist/locales/ru-RU.js +2 -0
- package/dist/locales/th-TH.js +2 -0
- package/dist/locales/tr-TR.js +2 -0
- package/dist/locales/types.d.ts +2 -0
- package/dist/locales/vi-VN.js +2 -0
- package/dist/locales/zh-CN.js +2 -0
- package/dist/locales/zh-TW.js +2 -0
- package/dist/number-input/format.js +1 -1
- package/dist/number-input/use-number-input.js +166 -321
- package/dist/number-input/validate.d.ts +1 -0
- package/dist/number-input/validate.js +1 -1
- package/dist/provider/tao-provider.d.ts +2 -2
- package/dist/provider/tao-provider.js +49 -49
- package/dist/utils/composed-parent.d.ts +1 -0
- package/dist/utils/composed-parent.js +7 -0
- package/dist/utils/portal.d.ts +5 -0
- package/dist/utils/portal.js +7 -1
- package/dist/utils/refs.d.ts +3 -1
- package/dist/utils/refs.js +25 -1
- package/package.json +1 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { c } from "react-compiler-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { useEffect, useRef } from "react";
|
|
4
4
|
import { TaoPortalScope, useTaoDirection } from "../../provider/tao-provider.js";
|
|
5
5
|
import { asTriggerChild, useControlledOpen } from "../../utils/overlay.js";
|
|
6
|
+
import { useCommittedRef } from "../../utils/refs.js";
|
|
6
7
|
import { cx } from "../../utils/semantic.js";
|
|
7
8
|
import "./tooltip.css";
|
|
8
9
|
import * as __rspack_external__radix_ui_react_tooltip_b301f25d from "@radix-ui/react-tooltip";
|
|
@@ -30,114 +31,251 @@ function Tooltip(props) {
|
|
|
30
31
|
} else t0 = $[3];
|
|
31
32
|
return t0;
|
|
32
33
|
}
|
|
33
|
-
function ActiveTooltip(
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
34
|
+
function ActiveTooltip(t0) {
|
|
35
|
+
const $ = c(58);
|
|
36
|
+
const { direction: directionProp, title, placement: t1, arrow: t2, open, defaultOpen, onOpenChange, mouseEnterDelay: t3, mouseLeaveDelay: t4, color, className, style, classNames, styles, children } = t0;
|
|
37
|
+
const placement = void 0 === t1 ? "top" : t1;
|
|
38
|
+
const arrow = void 0 === t2 ? true : t2;
|
|
39
|
+
const mouseEnterDelay = void 0 === t3 ? 0.1 : t3;
|
|
40
|
+
const mouseLeaveDelay = void 0 === t4 ? 0.1 : t4;
|
|
41
|
+
const [direction, directionRef] = useTaoDirection(directionProp, "self");
|
|
42
|
+
let t5;
|
|
43
|
+
if ($[0] !== defaultOpen || $[1] !== onOpenChange || $[2] !== open) {
|
|
44
|
+
t5 = {
|
|
45
|
+
open,
|
|
46
|
+
defaultOpen,
|
|
47
|
+
onOpenChange
|
|
48
|
+
};
|
|
49
|
+
$[0] = defaultOpen;
|
|
50
|
+
$[1] = onOpenChange;
|
|
51
|
+
$[2] = open;
|
|
52
|
+
$[3] = t5;
|
|
53
|
+
} else t5 = $[3];
|
|
54
|
+
const [realOpen, setOpen] = useControlledOpen(t5);
|
|
55
|
+
const latestSetOpen = useCommittedRef(setOpen);
|
|
42
56
|
const closeTimer = useRef(void 0);
|
|
43
57
|
const pointerDriven = useRef(false);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
58
|
+
let t6;
|
|
59
|
+
let t7;
|
|
60
|
+
if ($[4] !== realOpen) {
|
|
61
|
+
t6 = ()=>{
|
|
62
|
+
if (!realOpen) return;
|
|
63
|
+
return ()=>{
|
|
64
|
+
clearTimeout(closeTimer.current);
|
|
65
|
+
pointerDriven.current = false;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
t7 = [
|
|
69
|
+
realOpen
|
|
70
|
+
];
|
|
71
|
+
$[4] = realOpen;
|
|
72
|
+
$[5] = t6;
|
|
73
|
+
$[6] = t7;
|
|
74
|
+
} else {
|
|
75
|
+
t6 = $[5];
|
|
76
|
+
t7 = $[6];
|
|
77
|
+
}
|
|
78
|
+
useEffect(t6, t7);
|
|
79
|
+
let t8;
|
|
80
|
+
if ($[7] !== latestSetOpen || $[8] !== mouseLeaveDelay || $[9] !== setOpen) {
|
|
81
|
+
t8 = ()=>{
|
|
47
82
|
clearTimeout(closeTimer.current);
|
|
48
|
-
|
|
83
|
+
if (mouseLeaveDelay <= 0) return void setOpen(false);
|
|
84
|
+
closeTimer.current = setTimeout(()=>{
|
|
85
|
+
pointerDriven.current = false;
|
|
86
|
+
latestSetOpen.current(false);
|
|
87
|
+
}, 1000 * mouseLeaveDelay);
|
|
49
88
|
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
89
|
+
$[7] = latestSetOpen;
|
|
90
|
+
$[8] = mouseLeaveDelay;
|
|
91
|
+
$[9] = setOpen;
|
|
92
|
+
$[10] = t8;
|
|
93
|
+
} else t8 = $[10];
|
|
94
|
+
const schedulePointerClose = t8;
|
|
95
|
+
let t9;
|
|
96
|
+
if ($[11] !== schedulePointerClose || $[12] !== setOpen) {
|
|
97
|
+
t9 = (next)=>{
|
|
98
|
+
if (!next && pointerDriven.current) return void schedulePointerClose();
|
|
99
|
+
clearTimeout(closeTimer.current);
|
|
57
100
|
pointerDriven.current = false;
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
]
|
|
64
|
-
const handleOpenChange =
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}, [
|
|
70
|
-
schedulePointerClose,
|
|
71
|
-
setOpen
|
|
72
|
-
]);
|
|
73
|
-
const hoverProps = {
|
|
74
|
-
onPointerEnter: (event)=>{
|
|
75
|
-
if ('touch' === event.pointerType) return;
|
|
101
|
+
setOpen(next);
|
|
102
|
+
};
|
|
103
|
+
$[11] = schedulePointerClose;
|
|
104
|
+
$[12] = setOpen;
|
|
105
|
+
$[13] = t9;
|
|
106
|
+
} else t9 = $[13];
|
|
107
|
+
const handleOpenChange = t9;
|
|
108
|
+
let t10;
|
|
109
|
+
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
|
|
110
|
+
t10 = (event)=>{
|
|
111
|
+
if ("touch" === event.pointerType) return;
|
|
76
112
|
pointerDriven.current = false;
|
|
77
113
|
clearTimeout(closeTimer.current);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
114
|
+
};
|
|
115
|
+
$[14] = t10;
|
|
116
|
+
} else t10 = $[14];
|
|
117
|
+
let t11;
|
|
118
|
+
if ($[15] !== realOpen || $[16] !== schedulePointerClose) {
|
|
119
|
+
t11 = {
|
|
120
|
+
onPointerEnter: t10,
|
|
121
|
+
onPointerLeave: (event_0)=>{
|
|
122
|
+
if (!realOpen || "touch" === event_0.pointerType) return;
|
|
123
|
+
pointerDriven.current = true;
|
|
124
|
+
schedulePointerClose();
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
$[15] = realOpen;
|
|
128
|
+
$[16] = schedulePointerClose;
|
|
129
|
+
$[17] = t11;
|
|
130
|
+
} else t11 = $[17];
|
|
131
|
+
const hoverProps = t11;
|
|
132
|
+
let t12;
|
|
133
|
+
if ($[18] !== color) {
|
|
134
|
+
t12 = color ? {
|
|
135
|
+
background: color
|
|
136
|
+
} : void 0;
|
|
137
|
+
$[18] = color;
|
|
138
|
+
$[19] = t12;
|
|
139
|
+
} else t12 = $[19];
|
|
140
|
+
const colorStyle = t12;
|
|
141
|
+
const t13 = 1000 * mouseEnterDelay;
|
|
142
|
+
let t14;
|
|
143
|
+
if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
|
|
144
|
+
t14 = ()=>{
|
|
145
|
+
pointerDriven.current = false;
|
|
146
|
+
};
|
|
147
|
+
$[20] = t14;
|
|
148
|
+
} else t14 = $[20];
|
|
149
|
+
let t15;
|
|
150
|
+
if ($[21] !== children) {
|
|
151
|
+
t15 = asTriggerChild(children);
|
|
152
|
+
$[21] = children;
|
|
153
|
+
$[22] = t15;
|
|
154
|
+
} else t15 = $[22];
|
|
155
|
+
let t16;
|
|
156
|
+
if ($[23] !== directionRef || $[24] !== hoverProps || $[25] !== t15) {
|
|
157
|
+
t16 = /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_tooltip_b301f25d.Trigger, {
|
|
158
|
+
ref: directionRef,
|
|
159
|
+
asChild: true,
|
|
160
|
+
...hoverProps,
|
|
161
|
+
onBlur: t14,
|
|
162
|
+
children: t15
|
|
163
|
+
});
|
|
164
|
+
$[23] = directionRef;
|
|
165
|
+
$[24] = hoverProps;
|
|
166
|
+
$[25] = t15;
|
|
167
|
+
$[26] = t16;
|
|
168
|
+
} else t16 = $[26];
|
|
169
|
+
const t17 = classNames?.content;
|
|
170
|
+
let t18;
|
|
171
|
+
if ($[27] !== className || $[28] !== t17) {
|
|
172
|
+
t18 = cx(t17, className);
|
|
173
|
+
$[27] = className;
|
|
174
|
+
$[28] = t17;
|
|
175
|
+
$[29] = t18;
|
|
176
|
+
} else t18 = $[29];
|
|
177
|
+
const t19 = styles?.content;
|
|
178
|
+
let t20;
|
|
179
|
+
if ($[30] !== colorStyle || $[31] !== style || $[32] !== t19) {
|
|
180
|
+
t20 = {
|
|
181
|
+
...colorStyle,
|
|
182
|
+
...t19,
|
|
183
|
+
...style
|
|
184
|
+
};
|
|
185
|
+
$[30] = colorStyle;
|
|
186
|
+
$[31] = style;
|
|
187
|
+
$[32] = t19;
|
|
188
|
+
$[33] = t20;
|
|
189
|
+
} else t20 = $[33];
|
|
190
|
+
let t21;
|
|
191
|
+
if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
|
|
192
|
+
t21 = ()=>{
|
|
193
|
+
pointerDriven.current = false;
|
|
194
|
+
};
|
|
195
|
+
$[34] = t21;
|
|
196
|
+
} else t21 = $[34];
|
|
197
|
+
let t22;
|
|
198
|
+
if ($[35] !== arrow || $[36] !== classNames?.arrow || $[37] !== color || $[38] !== styles?.arrow) {
|
|
199
|
+
t22 = arrow && /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_tooltip_b301f25d.Arrow, {
|
|
200
|
+
asChild: true,
|
|
201
|
+
children: /*#__PURE__*/ jsx("span", {
|
|
202
|
+
"data-tao-tooltip-arrow": "",
|
|
203
|
+
className: cx(classNames?.arrow),
|
|
204
|
+
style: {
|
|
205
|
+
...color ? {
|
|
206
|
+
"--tao-tooltip-arrow-bg": color
|
|
207
|
+
} : void 0,
|
|
208
|
+
...styles?.arrow
|
|
209
|
+
}
|
|
210
|
+
})
|
|
211
|
+
});
|
|
212
|
+
$[35] = arrow;
|
|
213
|
+
$[36] = classNames?.arrow;
|
|
214
|
+
$[37] = color;
|
|
215
|
+
$[38] = styles?.arrow;
|
|
216
|
+
$[39] = t22;
|
|
217
|
+
} else t22 = $[39];
|
|
218
|
+
let t23;
|
|
219
|
+
if ($[40] !== hoverProps || $[41] !== placement || $[42] !== t18 || $[43] !== t20 || $[44] !== t22 || $[45] !== title) {
|
|
220
|
+
t23 = /*#__PURE__*/ jsxs(__rspack_external__radix_ui_react_tooltip_b301f25d.Content, {
|
|
221
|
+
"data-tao-tooltip-content": "",
|
|
222
|
+
className: t18,
|
|
223
|
+
style: t20,
|
|
224
|
+
side: placement,
|
|
225
|
+
sideOffset: 4,
|
|
226
|
+
onEscapeKeyDown: t21,
|
|
227
|
+
...hoverProps,
|
|
228
|
+
children: [
|
|
229
|
+
title,
|
|
230
|
+
t22
|
|
231
|
+
]
|
|
232
|
+
});
|
|
233
|
+
$[40] = hoverProps;
|
|
234
|
+
$[41] = placement;
|
|
235
|
+
$[42] = t18;
|
|
236
|
+
$[43] = t20;
|
|
237
|
+
$[44] = t22;
|
|
238
|
+
$[45] = title;
|
|
239
|
+
$[46] = t23;
|
|
240
|
+
} else t23 = $[46];
|
|
241
|
+
let t24;
|
|
242
|
+
if ($[47] !== direction || $[48] !== t23) {
|
|
243
|
+
t24 = /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_tooltip_b301f25d.Portal, {
|
|
244
|
+
children: /*#__PURE__*/ jsx(TaoPortalScope, {
|
|
245
|
+
direction: direction,
|
|
246
|
+
children: t23
|
|
247
|
+
})
|
|
248
|
+
});
|
|
249
|
+
$[47] = direction;
|
|
250
|
+
$[48] = t23;
|
|
251
|
+
$[49] = t24;
|
|
252
|
+
} else t24 = $[49];
|
|
253
|
+
let t25;
|
|
254
|
+
if ($[50] !== handleOpenChange || $[51] !== realOpen || $[52] !== t16 || $[53] !== t24) {
|
|
255
|
+
t25 = /*#__PURE__*/ jsxs(__rspack_external__radix_ui_react_tooltip_b301f25d.Root, {
|
|
91
256
|
open: realOpen,
|
|
92
257
|
onOpenChange: handleOpenChange,
|
|
93
258
|
children: [
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
asChild: true,
|
|
97
|
-
...hoverProps,
|
|
98
|
-
onBlur: ()=>{
|
|
99
|
-
pointerDriven.current = false;
|
|
100
|
-
},
|
|
101
|
-
children: asTriggerChild(children)
|
|
102
|
-
}),
|
|
103
|
-
/*#__PURE__*/ jsx(__rspack_external__radix_ui_react_tooltip_b301f25d.Portal, {
|
|
104
|
-
children: /*#__PURE__*/ jsx(TaoPortalScope, {
|
|
105
|
-
direction: direction,
|
|
106
|
-
children: /*#__PURE__*/ jsxs(__rspack_external__radix_ui_react_tooltip_b301f25d.Content, {
|
|
107
|
-
"data-tao-tooltip-content": "",
|
|
108
|
-
className: cx(classNames?.content, className),
|
|
109
|
-
style: {
|
|
110
|
-
...colorStyle,
|
|
111
|
-
...styles?.content,
|
|
112
|
-
...style
|
|
113
|
-
},
|
|
114
|
-
side: placement,
|
|
115
|
-
sideOffset: 4,
|
|
116
|
-
onEscapeKeyDown: ()=>{
|
|
117
|
-
pointerDriven.current = false;
|
|
118
|
-
},
|
|
119
|
-
...hoverProps,
|
|
120
|
-
children: [
|
|
121
|
-
title,
|
|
122
|
-
arrow && /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_tooltip_b301f25d.Arrow, {
|
|
123
|
-
asChild: true,
|
|
124
|
-
children: /*#__PURE__*/ jsx("span", {
|
|
125
|
-
"data-tao-tooltip-arrow": "",
|
|
126
|
-
className: cx(classNames?.arrow),
|
|
127
|
-
style: {
|
|
128
|
-
...color ? {
|
|
129
|
-
'--tao-tooltip-arrow-bg': color
|
|
130
|
-
} : void 0,
|
|
131
|
-
...styles?.arrow
|
|
132
|
-
}
|
|
133
|
-
})
|
|
134
|
-
})
|
|
135
|
-
]
|
|
136
|
-
})
|
|
137
|
-
})
|
|
138
|
-
})
|
|
259
|
+
t16,
|
|
260
|
+
t24
|
|
139
261
|
]
|
|
140
|
-
})
|
|
141
|
-
|
|
262
|
+
});
|
|
263
|
+
$[50] = handleOpenChange;
|
|
264
|
+
$[51] = realOpen;
|
|
265
|
+
$[52] = t16;
|
|
266
|
+
$[53] = t24;
|
|
267
|
+
$[54] = t25;
|
|
268
|
+
} else t25 = $[54];
|
|
269
|
+
let t26;
|
|
270
|
+
if ($[55] !== t13 || $[56] !== t25) {
|
|
271
|
+
t26 = /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_tooltip_b301f25d.Provider, {
|
|
272
|
+
delayDuration: t13,
|
|
273
|
+
children: t25
|
|
274
|
+
});
|
|
275
|
+
$[55] = t13;
|
|
276
|
+
$[56] = t25;
|
|
277
|
+
$[57] = t26;
|
|
278
|
+
} else t26 = $[57];
|
|
279
|
+
return t26;
|
|
142
280
|
}
|
|
143
281
|
export { Tooltip };
|
|
@@ -108,7 +108,7 @@ function TreeGlyph(t0) {
|
|
|
108
108
|
}
|
|
109
109
|
const TreeBase = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
110
110
|
const config = useTaoConfig();
|
|
111
|
-
const { prefixCls = 'tao-tree', className, rootClassName, rootStyle, classNames, styles, showLine = false, showIcon = false, checkable = false, selectable = true, blockNode = false, disabled = config.disabled, switcherIcon, switcherLoadingIcon, draggable, filterAntTreeNode, filterTreeNode = filterAntTreeNode, itemHeight = 32, dropIndicatorRender, direction: directionProp, onKeyDown, ...rest } = props;
|
|
111
|
+
const { prefixCls = 'tao-tree', className, rootClassName, rootStyle, classNames, styles, showLine = false, showIcon = false, checkable = false, selectable = true, blockNode = false, disabled = config.disabled, switcherIcon, switcherLoadingIcon, draggable, filterAntTreeNode, filterTreeNode = filterAntTreeNode, itemHeight = 32, dropIndicatorRender, direction: directionProp, onKeyDown, onSelect, onCheck, onExpand, onLoad, ...rest } = props;
|
|
112
112
|
const [direction, directionRef] = useTaoDirection(directionProp);
|
|
113
113
|
const mergedProps = {
|
|
114
114
|
...props,
|
|
@@ -202,6 +202,30 @@ const TreeBase = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
202
202
|
prefixCls: prefixCls,
|
|
203
203
|
direction: direction,
|
|
204
204
|
onKeyDown: (event)=>onKeyDown?.(originalTreeKeyboardEvent(event)),
|
|
205
|
+
onSelect: onSelect && ((keys, info)=>onSelect([
|
|
206
|
+
...keys
|
|
207
|
+
], info)),
|
|
208
|
+
onCheck: onCheck && ((keys_0, info_0)=>onCheck(Array.isArray(keys_0) ? [
|
|
209
|
+
...keys_0
|
|
210
|
+
] : {
|
|
211
|
+
checked: [
|
|
212
|
+
...keys_0.checked
|
|
213
|
+
],
|
|
214
|
+
halfChecked: [
|
|
215
|
+
...keys_0.halfChecked
|
|
216
|
+
]
|
|
217
|
+
}, info_0.halfCheckedKeys ? {
|
|
218
|
+
...info_0,
|
|
219
|
+
halfCheckedKeys: [
|
|
220
|
+
...info_0.halfCheckedKeys
|
|
221
|
+
]
|
|
222
|
+
} : info_0)),
|
|
223
|
+
onExpand: onExpand && ((keys_1, info_1)=>onExpand([
|
|
224
|
+
...keys_1
|
|
225
|
+
], info_1)),
|
|
226
|
+
onLoad: onLoad && ((keys_2, info_2)=>onLoad([
|
|
227
|
+
...keys_2
|
|
228
|
+
], info_2)),
|
|
205
229
|
showLine: Boolean(showLine),
|
|
206
230
|
showIcon: showIcon,
|
|
207
231
|
disabled: disabled,
|
|
@@ -337,7 +361,9 @@ const DirectoryTreeBase = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
337
361
|
}
|
|
338
362
|
lastRequestedSelection.current = selection;
|
|
339
363
|
if (void 0 === props.selectedKeys) setSelected(selection);
|
|
340
|
-
props.onSelect?.(
|
|
364
|
+
props.onSelect?.([
|
|
365
|
+
...selection
|
|
366
|
+
], {
|
|
341
367
|
...info,
|
|
342
368
|
selected: selection.includes(key_0),
|
|
343
369
|
selectedNodes: ordered.filter((item)=>selection.includes(item.key)).map(_temp4)
|
|
@@ -354,7 +380,9 @@ const DirectoryTreeBase = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
354
380
|
if ($[24] !== props) {
|
|
355
381
|
t10 = (keys_0, info_0)=>{
|
|
356
382
|
if (void 0 === props.expandedKeys) setExpanded(keys_0);
|
|
357
|
-
props.onExpand?.(
|
|
383
|
+
props.onExpand?.([
|
|
384
|
+
...keys_0
|
|
385
|
+
], info_0);
|
|
358
386
|
};
|
|
359
387
|
$[24] = props;
|
|
360
388
|
$[25] = t10;
|
|
@@ -76,7 +76,7 @@ function InternalTreeSelect(props, ref) {
|
|
|
76
76
|
classNames: classes,
|
|
77
77
|
styles: semanticStyles,
|
|
78
78
|
multiple: !!(treeCheckable || multiple),
|
|
79
|
-
treeCheckable: treeCheckable ? /*#__PURE__*/ jsx(TreeCheck, {}) : false,
|
|
79
|
+
treeCheckable: treeCheckable || props.treeCheckStrictly ? /*#__PURE__*/ jsx(TreeCheck, {}) : false,
|
|
80
80
|
treeLine: !!treeLine,
|
|
81
81
|
treeIcon: treeIcon,
|
|
82
82
|
showTreeIcon: !!treeIcon,
|
|
@@ -4,6 +4,7 @@ import upload from "@rc-component/upload";
|
|
|
4
4
|
import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from "react";
|
|
5
5
|
import { flushSync } from "react-dom";
|
|
6
6
|
import { useTaoConfig } from "../../provider/tao-provider.js";
|
|
7
|
+
import { useCommittedRef } from "../../utils/refs.js";
|
|
7
8
|
import { cx } from "../../utils/semantic.js";
|
|
8
9
|
import { Button } from "../button/button.js";
|
|
9
10
|
import { Modal } from "../modal/modal.js";
|
|
@@ -54,19 +55,22 @@ function FilePreview(t0) {
|
|
|
54
55
|
const $ = c(13);
|
|
55
56
|
const { file, previewFile } = t0;
|
|
56
57
|
const { locale } = useTaoConfig();
|
|
58
|
+
const source = file.originFileObj;
|
|
57
59
|
const [preview, setPreview] = useState();
|
|
58
60
|
const [error, setError] = useState();
|
|
59
61
|
let t1;
|
|
60
62
|
let t2;
|
|
61
|
-
if ($[0] !== file.
|
|
63
|
+
if ($[0] !== file.thumbUrl || $[1] !== file.url || $[2] !== locale.messages.previewUnavailable || $[3] !== locale.messages.readFileError || $[4] !== previewFile || $[5] !== source) {
|
|
62
64
|
t1 = ()=>{
|
|
63
|
-
setPreview(void 0);
|
|
64
65
|
setError(void 0);
|
|
65
|
-
if (file.thumbUrl || file.url || !
|
|
66
|
+
if (file.thumbUrl || file.url || !source) return void setPreview(void 0);
|
|
66
67
|
let active = true;
|
|
67
|
-
const load = async (
|
|
68
|
-
load(
|
|
69
|
-
if (active) setPreview(
|
|
68
|
+
const load = async (source_0)=>previewFile ? previewFile(source_0) : readPreview(source_0, locale.messages.readFileError);
|
|
69
|
+
load(source).then((value)=>{
|
|
70
|
+
if (active) setPreview({
|
|
71
|
+
source,
|
|
72
|
+
url: value
|
|
73
|
+
});
|
|
70
74
|
}, (reason)=>{
|
|
71
75
|
if (active) setError(reason instanceof Error ? reason.message : locale.messages.previewUnavailable);
|
|
72
76
|
});
|
|
@@ -75,19 +79,19 @@ function FilePreview(t0) {
|
|
|
75
79
|
};
|
|
76
80
|
};
|
|
77
81
|
t2 = [
|
|
78
|
-
|
|
82
|
+
source,
|
|
79
83
|
file.thumbUrl,
|
|
80
84
|
file.url,
|
|
81
85
|
previewFile,
|
|
82
86
|
locale.messages.readFileError,
|
|
83
87
|
locale.messages.previewUnavailable
|
|
84
88
|
];
|
|
85
|
-
$[0] = file.
|
|
86
|
-
$[1] = file.
|
|
87
|
-
$[2] =
|
|
88
|
-
$[3] = locale.messages.
|
|
89
|
-
$[4] =
|
|
90
|
-
$[5] =
|
|
89
|
+
$[0] = file.thumbUrl;
|
|
90
|
+
$[1] = file.url;
|
|
91
|
+
$[2] = locale.messages.previewUnavailable;
|
|
92
|
+
$[3] = locale.messages.readFileError;
|
|
93
|
+
$[4] = previewFile;
|
|
94
|
+
$[5] = source;
|
|
91
95
|
$[6] = t1;
|
|
92
96
|
$[7] = t2;
|
|
93
97
|
} else {
|
|
@@ -95,7 +99,7 @@ function FilePreview(t0) {
|
|
|
95
99
|
t2 = $[7];
|
|
96
100
|
}
|
|
97
101
|
useEffect(t1, t2);
|
|
98
|
-
const src = file.thumbUrl
|
|
102
|
+
const src = file.thumbUrl || file.url || preview?.source === source && preview?.url;
|
|
99
103
|
let t3;
|
|
100
104
|
if ($[8] !== error || $[9] !== file.crossOrigin || $[10] !== file.name || $[11] !== src) {
|
|
101
105
|
t3 = error ? /*#__PURE__*/ jsx("span", {
|
|
@@ -208,12 +212,11 @@ const UploadRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
208
212
|
const config = useTaoConfig();
|
|
209
213
|
const [localFiles, setFiles] = useState(props.defaultFileList ?? []);
|
|
210
214
|
const files = 'fileList' in props ? props.fileList ?? [] : localFiles;
|
|
211
|
-
const filesRef =
|
|
212
|
-
|
|
213
|
-
const propsRef = useRef(props);
|
|
214
|
-
propsRef.current = props;
|
|
215
|
+
const filesRef = useCommittedRef(files);
|
|
216
|
+
const propsRef = useCommittedRef(props);
|
|
215
217
|
const root = useRef(null), uploader = useRef(null);
|
|
216
218
|
const ignored = useRef(new Set());
|
|
219
|
+
const normalizedBatches = useRef(new WeakSet());
|
|
217
220
|
const preparations = useRef(new WeakMap());
|
|
218
221
|
const requestOrigins = useRef(new WeakMap());
|
|
219
222
|
const settledRequests = useRef(new WeakSet());
|
|
@@ -258,29 +261,35 @@ const UploadRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
258
261
|
filesRef.current = limited;
|
|
259
262
|
setFiles(limited);
|
|
260
263
|
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
...
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
264
|
+
const onChange = propsRef.current.onChange;
|
|
265
|
+
if (onChange && ('removed' === file.status || limited.some((item_0)=>item_0.uid === file.uid))) {
|
|
266
|
+
const changed = {
|
|
267
|
+
...file
|
|
268
|
+
};
|
|
269
|
+
onChange({
|
|
270
|
+
file: changed,
|
|
271
|
+
fileList: limited.map((item)=>item === file ? changed : {
|
|
272
|
+
...item
|
|
273
|
+
}),
|
|
274
|
+
...event ? {
|
|
275
|
+
event
|
|
276
|
+
} : {}
|
|
277
|
+
});
|
|
278
|
+
}
|
|
270
279
|
});
|
|
271
280
|
};
|
|
272
281
|
const update = (file_0, patch, event_0)=>{
|
|
273
282
|
if (settledRequests.current.has(file_0)) return;
|
|
274
|
-
const items = current(), found = items.find((
|
|
283
|
+
const items = current(), found = items.find((item_1)=>item_1.uid === file_0.uid);
|
|
275
284
|
if (!found) return;
|
|
276
285
|
const origin = requestOrigins.current.get(file_0);
|
|
277
286
|
if (origin && found.originFileObj && found.originFileObj !== origin) return;
|
|
278
287
|
if ('done' === patch.status || 'error' === patch.status) settledRequests.current.add(file_0);
|
|
279
|
-
const
|
|
288
|
+
const changed_0 = {
|
|
280
289
|
...found,
|
|
281
290
|
...patch
|
|
282
291
|
};
|
|
283
|
-
emit(
|
|
292
|
+
emit(changed_0, items.map((item_2)=>item_2.uid === file_0.uid ? changed_0 : item_2), event_0);
|
|
284
293
|
};
|
|
285
294
|
const onSuccess = (response, file_1, xhr)=>update(file_1, {
|
|
286
295
|
status: 'done',
|
|
@@ -299,10 +308,22 @@ const UploadRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
299
308
|
});
|
|
300
309
|
const customRequest = props.customRequest;
|
|
301
310
|
const request = customRequest ? (options, info)=>{
|
|
311
|
+
let finished = false;
|
|
302
312
|
try {
|
|
303
|
-
|
|
313
|
+
const handle = customRequest({
|
|
314
|
+
...options,
|
|
315
|
+
onSuccess: (...args)=>{
|
|
316
|
+
finished = true;
|
|
317
|
+
options.onSuccess?.(...args);
|
|
318
|
+
},
|
|
319
|
+
onError: (...args_0)=>{
|
|
320
|
+
finished = true;
|
|
321
|
+
options.onError?.(...args_0);
|
|
322
|
+
}
|
|
323
|
+
}, info);
|
|
324
|
+
return finished ? void 0 : handle;
|
|
304
325
|
} catch (reason) {
|
|
305
|
-
if (
|
|
326
|
+
if (finished) throw reason;
|
|
306
327
|
options.onError?.(asError(reason));
|
|
307
328
|
}
|
|
308
329
|
} : void 0;
|
|
@@ -327,11 +348,11 @@ const UploadRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
327
348
|
} : {}
|
|
328
349
|
};
|
|
329
350
|
});
|
|
330
|
-
for (const
|
|
331
|
-
...next_0.filter((old)=>old.uid !==
|
|
332
|
-
|
|
351
|
+
for (const item_3 of additions)next_0 = [
|
|
352
|
+
...next_0.filter((old)=>old.uid !== item_3.uid),
|
|
353
|
+
item_3
|
|
333
354
|
];
|
|
334
|
-
for (const
|
|
355
|
+
for (const item_4 of additions)emit(item_4, next_0);
|
|
335
356
|
};
|
|
336
357
|
useImperativeHandle(ref, ()=>({
|
|
337
358
|
onBatchStart,
|
|
@@ -351,16 +372,16 @@ const UploadRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
351
372
|
try {
|
|
352
373
|
if (await propsRef.current.onRemove?.(file_7) === false) return;
|
|
353
374
|
const items_0 = current();
|
|
354
|
-
const latest = items_0.find((
|
|
375
|
+
const latest = items_0.find((item_6)=>item_6.uid === file_7.uid);
|
|
355
376
|
if (!latest || !isCurrent(latest)) return;
|
|
356
377
|
uploader.current?.abort(file_7);
|
|
357
378
|
emit({
|
|
358
379
|
...latest,
|
|
359
380
|
status: 'removed'
|
|
360
|
-
}, items_0.filter((
|
|
381
|
+
}, items_0.filter((item_7)=>item_7.uid !== file_7.uid));
|
|
361
382
|
setRemoveError(void 0);
|
|
362
383
|
} catch (error_1) {
|
|
363
|
-
if (!isCurrent(current().find((
|
|
384
|
+
if (!isCurrent(current().find((item_5)=>item_5.uid === file_7.uid))) return;
|
|
364
385
|
setRemoveError(error_1 instanceof Error ? error_1.message : config.locale.messages.removeFileError);
|
|
365
386
|
} finally{
|
|
366
387
|
if (pending.get(file_7.uid) === file_7) pending.delete(file_7.uid);
|
|
@@ -409,6 +430,12 @@ const UploadRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
409
430
|
openFileDialogOnClick: props.openFileDialogOnClick,
|
|
410
431
|
hasControlInside: props.hasControlInside ?? (!!props.children || !isCard && 'drag' !== type),
|
|
411
432
|
beforeUpload: async (file_13, list)=>{
|
|
433
|
+
if (!normalizedBatches.current.has(list)) {
|
|
434
|
+
for (const item_8 of list)if (!('lastModifiedDate' in item_8)) Object.assign(item_8, {
|
|
435
|
+
lastModifiedDate: new Date(item_8.lastModified)
|
|
436
|
+
});
|
|
437
|
+
normalizedBatches.current.add(list);
|
|
438
|
+
}
|
|
412
439
|
preparations.current.delete(file_13);
|
|
413
440
|
const result = await props.beforeUpload?.(file_13, list);
|
|
414
441
|
if (result === LIST_IGNORE) {
|
|
@@ -495,7 +522,7 @@ const UploadRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
495
522
|
size: "small"
|
|
496
523
|
}) : /*#__PURE__*/ jsx(FileIcon, {}));
|
|
497
524
|
const localPreview = image && !!file_15.originFileObj;
|
|
498
|
-
const previewUrl = file_15.url
|
|
525
|
+
const previewUrl = file_15.url || file_15.thumbUrl;
|
|
499
526
|
const actions = {
|
|
500
527
|
preview: ()=>{
|
|
501
528
|
if (props.onPreview) props.onPreview(file_15);
|
package/dist/locales/ar-EG.js
CHANGED
package/dist/locales/de-DE.js
CHANGED
|
@@ -28,6 +28,8 @@ const deDE = createLocale({
|
|
|
28
28
|
dateRange: 'Zeitraum auswählen',
|
|
29
29
|
startDate: 'Startdatum',
|
|
30
30
|
endDate: 'Enddatum',
|
|
31
|
+
selectStartDate: 'Wählen Sie ein Startdatum.',
|
|
32
|
+
selectEndDate: 'Wählen Sie ein Enddatum.',
|
|
31
33
|
now: 'Jetzt',
|
|
32
34
|
ok: 'OK',
|
|
33
35
|
cancel: 'Abbrechen',
|