@rockshin/tao-ui 0.0.47 → 0.0.49
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 +20 -16
- package/dist/components/alert/alert.js +114 -99
- package/dist/components/app/app-modals.js +134 -96
- package/dist/components/app/app-notices.js +39 -23
- package/dist/components/auto-complete/auto-complete.js +21 -7
- package/dist/components/avatar/avatar.js +31 -11
- package/dist/components/badge/badge.css +1 -1
- package/dist/components/badge/badge.js +72 -257
- package/dist/components/border-beam/border-beam.js +21 -17
- package/dist/components/breadcrumb/breadcrumb.js +178 -159
- package/dist/components/button/button.js +61 -53
- package/dist/components/calendar/calendar.js +6 -4
- package/dist/components/card/card.js +24 -8
- package/dist/components/carousel/carousel.d.ts +1 -1
- package/dist/components/carousel/carousel.js +105 -68
- package/dist/components/cascader/cascader.js +54 -19
- package/dist/components/checkbox/checkbox.css +13 -2
- package/dist/components/checkbox/checkbox.d.ts +2 -0
- package/dist/components/checkbox/checkbox.js +320 -229
- package/dist/components/collapse/collapse-panels.d.ts +1 -1
- package/dist/components/collapse/collapse-panels.js +122 -113
- package/dist/components/collapse/collapse.js +98 -63
- package/dist/components/color-picker/color-picker.js +539 -441
- package/dist/components/color-picker/color.js +1 -1
- package/dist/components/context-menu/context-menu.d.ts +1 -1
- package/dist/components/context-menu/context-menu.js +108 -68
- package/dist/components/date-picker/calendar/calendar-grid.js +42 -39
- package/dist/components/date-picker/calendar/month-grid.d.ts +8 -1
- package/dist/components/date-picker/calendar/month-grid.js +79 -37
- package/dist/components/date-picker/calendar/time-panel.d.ts +2 -1
- package/dist/components/date-picker/calendar/time-panel.js +94 -89
- package/dist/components/date-picker/calendar/year-grid.d.ts +8 -1
- package/dist/components/date-picker/calendar/year-grid.js +66 -35
- package/dist/components/date-picker/date-picker.css +24 -1
- package/dist/components/date-picker/date-picker.js +99 -53
- package/dist/components/date-picker/presets.d.ts +2 -1
- package/dist/components/date-picker/presets.js +27 -24
- package/dist/components/date-picker/range-picker.js +308 -153
- package/dist/components/descriptions/descriptions.js +7 -3
- package/dist/components/divider/divider.css +1 -1
- package/dist/components/divider/divider.js +1 -1
- package/dist/components/drawer/drawer.js +201 -369
- package/dist/components/dropdown/dropdown.d.ts +1 -1
- package/dist/components/dropdown/dropdown.js +183 -279
- package/dist/components/empty/empty.js +57 -78
- package/dist/components/float-button/float-button.d.ts +1 -0
- package/dist/components/float-button/float-button.js +47 -30
- package/dist/components/form/field-control.d.ts +4 -2
- package/dist/components/form/field-control.js +17 -9
- package/dist/components/form/form-context.d.ts +8 -2
- package/dist/components/form/form-context.js +2 -1
- package/dist/components/form/form-item.js +85 -63
- package/dist/components/form/form.css +3 -2
- package/dist/components/form/use-form.d.ts +2 -1
- package/dist/components/form/use-form.js +2 -1
- package/dist/components/form-field/form-field-view.d.ts +3 -1
- package/dist/components/form-field/form-field-view.js +194 -141
- package/dist/components/form-section/form-section.d.ts +1 -1
- package/dist/components/form-section/form-section.js +52 -45
- package/dist/components/image/image.js +585 -477
- package/dist/components/input/base-input.js +8 -9
- package/dist/components/input/input-shared.d.ts +5 -2
- package/dist/components/input/input-shared.js +42 -18
- package/dist/components/input/otp.js +236 -217
- package/dist/components/input/password.js +2 -1
- package/dist/components/input/search.js +8 -7
- package/dist/components/list/list-pagination.js +41 -36
- package/dist/components/list/list.js +141 -125
- package/dist/components/listy/listy.js +175 -106
- package/dist/components/masonry/masonry.js +108 -85
- package/dist/components/mentions/mentions.js +12 -3
- package/dist/components/menu/menu-render.d.ts +9 -3
- package/dist/components/menu/menu-render.js +99 -36
- package/dist/components/modal/confirm-dialog.js +10 -4
- package/dist/components/modal/confirm.js +3 -7
- package/dist/components/modal/index.js +9 -3
- package/dist/components/modal/modal.js +390 -365
- package/dist/components/pagination/pagination.js +105 -96
- package/dist/components/popconfirm/popconfirm.d.ts +1 -1
- package/dist/components/popconfirm/popconfirm.js +219 -168
- package/dist/components/popover/popover.js +330 -243
- package/dist/components/progress/progress.css +2 -2
- package/dist/components/progress/progress.js +232 -458
- package/dist/components/qr-code/qr-code.js +72 -66
- package/dist/components/radio/radio.css +15 -4
- package/dist/components/radio/radio.d.ts +2 -1
- package/dist/components/radio/radio.js +260 -198
- package/dist/components/rate/rate.js +173 -113
- package/dist/components/scroll-area/scroll-area.js +241 -211
- package/dist/components/segmented/segmented.js +73 -41
- package/dist/components/select/mobile-select.d.ts +2 -1
- package/dist/components/select/mobile-select.js +24 -13
- package/dist/components/select/select-searchable-list.d.ts +2 -1
- package/dist/components/select/select-searchable-list.js +2 -3
- package/dist/components/select/select.js +49 -25
- package/dist/components/select/use-select-selection.d.ts +1 -1
- package/dist/components/select/use-select-selection.js +7 -4
- package/dist/components/skeleton/skeleton.js +56 -48
- package/dist/components/slider/slider.js +87 -212
- package/dist/components/sonner/sonner.js +109 -93
- package/dist/components/spinner/spinner.js +147 -138
- package/dist/components/splitter/splitter.js +222 -159
- package/dist/components/statistic/statistic.js +7 -6
- package/dist/components/steps/steps.js +88 -81
- package/dist/components/steps/use-display-steps.js +1 -1
- package/dist/components/switch/switch.js +89 -89
- package/dist/components/table/table-filter.js +66 -56
- package/dist/components/table/table-icons.d.ts +2 -1
- package/dist/components/table/table-icons.js +11 -9
- package/dist/components/table/table-model.js +1 -1
- package/dist/components/table/table.js +107 -83
- package/dist/components/table/use-table-data.d.ts +6 -3
- package/dist/components/table/use-table-data.js +166 -130
- package/dist/components/tabs/tabs.css +1 -1
- package/dist/components/tabs/tabs.js +236 -179
- package/dist/components/tag/tag.d.ts +2 -2
- package/dist/components/tag/tag.js +111 -108
- package/dist/components/textarea/textarea.js +22 -17
- package/dist/components/time-picker/time-picker.js +5 -3
- package/dist/components/timeline/timeline.css +6 -1
- package/dist/components/timeline/timeline.js +21 -11
- package/dist/components/tooltip/tooltip.d.ts +2 -2
- package/dist/components/tooltip/tooltip.js +123 -233
- package/dist/components/tour/tour.css +4 -0
- package/dist/components/tour/tour.js +400 -331
- package/dist/components/transfer/transfer-list.js +29 -11
- package/dist/components/transfer/transfer-parts.js +1 -1
- package/dist/components/transfer/transfer-types.d.ts +1 -0
- package/dist/components/transfer/transfer.js +29 -14
- package/dist/components/tree/tree-keyboard.d.ts +1 -1
- package/dist/components/tree/tree-keyboard.js +5 -3
- package/dist/components/tree/tree.js +74 -59
- package/dist/components/tree-select/select-engine.d.ts +3 -2
- package/dist/components/tree-select/select-engine.js +18 -16
- package/dist/components/tree-select/tree-select.js +21 -5
- package/dist/components/upload/upload.css +8 -0
- package/dist/components/upload/upload.js +160 -72
- package/dist/components/watermark/watermark.js +36 -29
- package/dist/number-input/use-number-input.js +129 -90
- package/dist/number-input/validate.js +32 -5
- package/dist/provider/merge-locale.js +12 -9
- package/dist/provider/tao-provider.d.ts +3 -1
- package/dist/provider/tao-provider.js +123 -86
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { c } from "react-compiler-runtime";
|
|
3
|
-
import { forwardRef, useImperativeHandle, useRef } from "react";
|
|
3
|
+
import { Children, forwardRef, useImperativeHandle, useRef } from "react";
|
|
4
4
|
import { useTaoConfig } from "../../provider/tao-provider.js";
|
|
5
5
|
import { cx } from "../../utils/semantic.js";
|
|
6
6
|
import "./empty.css";
|
|
@@ -78,7 +78,7 @@ const simpleImage = /*#__PURE__*/ jsx(EmptyImage, {
|
|
|
78
78
|
simple: true
|
|
79
79
|
});
|
|
80
80
|
const EmptyRoot = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
81
|
-
const $ = c(
|
|
81
|
+
const $ = c(52);
|
|
82
82
|
let children;
|
|
83
83
|
let className;
|
|
84
84
|
let classNames;
|
|
@@ -173,81 +173,60 @@ const EmptyRoot = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
173
173
|
$[25] = t8;
|
|
174
174
|
$[26] = t9;
|
|
175
175
|
} else t9 = $[26];
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
if ($[27] !== t10 || $[28] !== t11) {
|
|
180
|
-
t12 = cx(t10, t11);
|
|
181
|
-
$[27] = t10;
|
|
182
|
-
$[28] = t11;
|
|
183
|
-
$[29] = t12;
|
|
184
|
-
} else t12 = $[29];
|
|
185
|
-
const t13 = slots?.image;
|
|
186
|
-
let t14;
|
|
187
|
-
if ($[30] !== imageStyle || $[31] !== t13) {
|
|
188
|
-
t14 = {
|
|
189
|
-
...imageStyle,
|
|
190
|
-
...t13
|
|
191
|
-
};
|
|
192
|
-
$[30] = imageStyle;
|
|
193
|
-
$[31] = t13;
|
|
194
|
-
$[32] = t14;
|
|
195
|
-
} else t14 = $[32];
|
|
196
|
-
let t15;
|
|
197
|
-
if ($[33] !== shownImage || $[34] !== text) {
|
|
198
|
-
t15 = "string" == typeof shownImage ? /*#__PURE__*/ jsx("img", {
|
|
199
|
-
src: shownImage,
|
|
200
|
-
alt: "string" == typeof text ? text : "empty",
|
|
201
|
-
draggable: false
|
|
202
|
-
}) : shownImage;
|
|
203
|
-
$[33] = shownImage;
|
|
204
|
-
$[34] = text;
|
|
205
|
-
$[35] = t15;
|
|
206
|
-
} else t15 = $[35];
|
|
207
|
-
let t16;
|
|
208
|
-
if ($[36] !== t12 || $[37] !== t14 || $[38] !== t15) {
|
|
209
|
-
t16 = /*#__PURE__*/ jsx("div", {
|
|
176
|
+
let t10;
|
|
177
|
+
if ($[27] !== imageStyle || $[28] !== names?.image || $[29] !== prefixCls || $[30] !== shownImage || $[31] !== slots?.image || $[32] !== text) {
|
|
178
|
+
t10 = "boolean" != typeof shownImage && /*#__PURE__*/ jsx("div", {
|
|
210
179
|
"data-tao-empty-image": "",
|
|
211
|
-
className:
|
|
212
|
-
style:
|
|
213
|
-
|
|
180
|
+
className: cx(`${prefixCls}-image`, names?.image),
|
|
181
|
+
style: {
|
|
182
|
+
...imageStyle,
|
|
183
|
+
...slots?.image
|
|
184
|
+
},
|
|
185
|
+
children: "string" == typeof shownImage ? /*#__PURE__*/ jsx("img", {
|
|
186
|
+
src: shownImage,
|
|
187
|
+
alt: "string" == typeof text ? text : "empty",
|
|
188
|
+
draggable: false
|
|
189
|
+
}) : shownImage
|
|
214
190
|
});
|
|
215
|
-
$[
|
|
216
|
-
$[
|
|
217
|
-
$[
|
|
218
|
-
$[
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
191
|
+
$[27] = imageStyle;
|
|
192
|
+
$[28] = names?.image;
|
|
193
|
+
$[29] = prefixCls;
|
|
194
|
+
$[30] = shownImage;
|
|
195
|
+
$[31] = slots?.image;
|
|
196
|
+
$[32] = text;
|
|
197
|
+
$[33] = t10;
|
|
198
|
+
} else t10 = $[33];
|
|
199
|
+
let t11;
|
|
200
|
+
if ($[34] !== names?.description || $[35] !== prefixCls || $[36] !== slots?.description || $[37] !== text) {
|
|
201
|
+
t11 = null != text && "boolean" != typeof text && /*#__PURE__*/ jsx("div", {
|
|
223
202
|
"data-tao-empty-description": "",
|
|
224
203
|
className: cx(`${prefixCls}-description`, names?.description),
|
|
225
204
|
style: slots?.description,
|
|
226
205
|
children: text
|
|
227
206
|
});
|
|
228
|
-
$[
|
|
229
|
-
$[
|
|
230
|
-
$[
|
|
231
|
-
$[
|
|
232
|
-
$[
|
|
233
|
-
} else
|
|
234
|
-
let
|
|
235
|
-
if ($[
|
|
236
|
-
|
|
207
|
+
$[34] = names?.description;
|
|
208
|
+
$[35] = prefixCls;
|
|
209
|
+
$[36] = slots?.description;
|
|
210
|
+
$[37] = text;
|
|
211
|
+
$[38] = t11;
|
|
212
|
+
} else t11 = $[38];
|
|
213
|
+
let t12;
|
|
214
|
+
if ($[39] !== children || $[40] !== names?.footer || $[41] !== prefixCls || $[42] !== slots?.footer) {
|
|
215
|
+
t12 = Children.toArray(children).length > 0 && /*#__PURE__*/ jsx("div", {
|
|
237
216
|
"data-tao-empty-footer": "",
|
|
238
217
|
className: cx(`${prefixCls}-footer`, names?.footer),
|
|
239
218
|
style: slots?.footer,
|
|
240
219
|
children: children
|
|
241
220
|
});
|
|
242
|
-
$[
|
|
243
|
-
$[
|
|
244
|
-
$[
|
|
245
|
-
$[
|
|
246
|
-
$[
|
|
247
|
-
} else
|
|
248
|
-
let
|
|
249
|
-
if ($[
|
|
250
|
-
|
|
221
|
+
$[39] = children;
|
|
222
|
+
$[40] = names?.footer;
|
|
223
|
+
$[41] = prefixCls;
|
|
224
|
+
$[42] = slots?.footer;
|
|
225
|
+
$[43] = t12;
|
|
226
|
+
} else t12 = $[43];
|
|
227
|
+
let t13;
|
|
228
|
+
if ($[44] !== rest || $[45] !== t10 || $[46] !== t11 || $[47] !== t12 || $[48] !== t5 || $[49] !== t7 || $[50] !== t9) {
|
|
229
|
+
t13 = /*#__PURE__*/ jsxs("div", {
|
|
251
230
|
...rest,
|
|
252
231
|
ref: root,
|
|
253
232
|
"data-tao-empty": "",
|
|
@@ -255,21 +234,21 @@ const EmptyRoot = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
255
234
|
className: t7,
|
|
256
235
|
style: t9,
|
|
257
236
|
children: [
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
237
|
+
t10,
|
|
238
|
+
t11,
|
|
239
|
+
t12
|
|
261
240
|
]
|
|
262
241
|
});
|
|
263
|
-
$[
|
|
264
|
-
$[
|
|
265
|
-
$[
|
|
266
|
-
$[
|
|
267
|
-
$[
|
|
268
|
-
$[
|
|
269
|
-
$[
|
|
270
|
-
$[
|
|
271
|
-
} else
|
|
272
|
-
return
|
|
242
|
+
$[44] = rest;
|
|
243
|
+
$[45] = t10;
|
|
244
|
+
$[46] = t11;
|
|
245
|
+
$[47] = t12;
|
|
246
|
+
$[48] = t5;
|
|
247
|
+
$[49] = t7;
|
|
248
|
+
$[50] = t9;
|
|
249
|
+
$[51] = t13;
|
|
250
|
+
} else t13 = $[51];
|
|
251
|
+
return t13;
|
|
273
252
|
});
|
|
274
253
|
const empty_Empty = Object.assign(EmptyRoot, {
|
|
275
254
|
PRESENTED_IMAGE_DEFAULT: defaultImage,
|
|
@@ -33,6 +33,7 @@ export interface FloatButtonProps extends DOMAttributes<FloatButtonElement> {
|
|
|
33
33
|
target?: HTMLAttributeAnchorTarget;
|
|
34
34
|
badge?: FloatButtonBadgeProps;
|
|
35
35
|
disabled?: boolean;
|
|
36
|
+
tabIndex?: number;
|
|
36
37
|
htmlType?: 'button' | 'submit' | 'reset';
|
|
37
38
|
'aria-label'?: string;
|
|
38
39
|
}
|
|
@@ -64,7 +64,7 @@ const FloatButtonRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
64
64
|
type: href ? void 0 : htmlType,
|
|
65
65
|
disabled: href ? void 0 : disabled,
|
|
66
66
|
"aria-disabled": href && disabled || void 0,
|
|
67
|
-
tabIndex: href && disabled ? -1 :
|
|
67
|
+
tabIndex: href && disabled ? -1 : rest.tabIndex,
|
|
68
68
|
"aria-label": props['aria-label'] ?? (hasLabel ? void 0 : 'string' == typeof tooltip ? tooltip : 'Action'),
|
|
69
69
|
"data-tao-float-button": "",
|
|
70
70
|
"data-tao-type": type,
|
|
@@ -110,10 +110,10 @@ const FloatButtonRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
110
110
|
const tooltipProps = !tooltip || 'object' != typeof tooltip || Array.isArray(tooltip) || '$$typeof' in tooltip ? {
|
|
111
111
|
title: tooltip
|
|
112
112
|
} : tooltip;
|
|
113
|
-
return tooltip ? /*#__PURE__*/ jsx(Tooltip, {
|
|
113
|
+
return null == tooltip ? button : /*#__PURE__*/ jsx(Tooltip, {
|
|
114
114
|
...tooltipProps,
|
|
115
115
|
children: button
|
|
116
|
-
})
|
|
116
|
+
});
|
|
117
117
|
});
|
|
118
118
|
FloatButtonRoot.displayName = 'FloatButton';
|
|
119
119
|
const FloatButtonGroup = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
@@ -125,6 +125,7 @@ const FloatButtonGroup = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
125
125
|
const expanded = open ?? internal;
|
|
126
126
|
const root = useRef(null);
|
|
127
127
|
const triggerRef = useRef(null);
|
|
128
|
+
const pointerInside = useRef(false);
|
|
128
129
|
useImperativeHandle(ref, ()=>({
|
|
129
130
|
nativeElement: root.current
|
|
130
131
|
}));
|
|
@@ -138,12 +139,13 @@ const FloatButtonGroup = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
138
139
|
latestChange.current = change;
|
|
139
140
|
});
|
|
140
141
|
useEffect(()=>{
|
|
141
|
-
|
|
142
|
+
const owner = root.current?.ownerDocument;
|
|
143
|
+
if ('click' !== trigger || !owner) return;
|
|
142
144
|
const outside = (event)=>{
|
|
143
145
|
if (!root.current?.contains(event.target)) latestChange.current(false);
|
|
144
146
|
};
|
|
145
|
-
|
|
146
|
-
return ()=>
|
|
147
|
+
owner.addEventListener('click', outside, true);
|
|
148
|
+
return ()=>owner.removeEventListener('click', outside, true);
|
|
147
149
|
}, [
|
|
148
150
|
trigger
|
|
149
151
|
]);
|
|
@@ -199,12 +201,19 @@ const FloatButtonGroup = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
199
201
|
...style
|
|
200
202
|
},
|
|
201
203
|
onMouseEnter: ()=>{
|
|
204
|
+
pointerInside.current = true;
|
|
202
205
|
if ('hover' === trigger) change(true);
|
|
203
206
|
},
|
|
204
|
-
onMouseLeave: ()=>{
|
|
205
|
-
|
|
207
|
+
onMouseLeave: (event_0)=>{
|
|
208
|
+
pointerInside.current = false;
|
|
209
|
+
const group = event_0.currentTarget;
|
|
210
|
+
if ('hover' === trigger && !group.contains(group.ownerDocument.activeElement)) change(false);
|
|
211
|
+
},
|
|
212
|
+
onBlur: (event_1)=>{
|
|
213
|
+
if ('hover' === trigger && !pointerInside.current && !event_1.currentTarget.contains(event_1.relatedTarget)) change(false);
|
|
206
214
|
},
|
|
207
|
-
onKeyDown: (
|
|
215
|
+
onKeyDown: (event_2)=>{
|
|
216
|
+
if (event_2.defaultPrevented) return;
|
|
208
217
|
if ([
|
|
209
218
|
'ArrowUp',
|
|
210
219
|
'ArrowDown',
|
|
@@ -212,17 +221,17 @@ const FloatButtonGroup = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
212
221
|
'ArrowRight',
|
|
213
222
|
'Home',
|
|
214
223
|
'End'
|
|
215
|
-
].includes(
|
|
224
|
+
].includes(event_2.key)) {
|
|
216
225
|
const controls = Array.from(root.current.querySelectorAll('button:not(:disabled), a[href]'));
|
|
217
|
-
const current = controls.indexOf(
|
|
226
|
+
const current = controls.indexOf(event_2.target);
|
|
218
227
|
if (current >= 0) {
|
|
219
|
-
|
|
220
|
-
const next_0 = 'Home' ===
|
|
228
|
+
event_2.preventDefault();
|
|
229
|
+
const next_0 = 'Home' === event_2.key ? 0 : 'End' === event_2.key ? controls.length - 1 : (current + ('ArrowUp' === event_2.key || 'ArrowLeft' === event_2.key ? -1 : 1) + controls.length) % controls.length;
|
|
221
230
|
controls[next_0]?.focus();
|
|
222
231
|
}
|
|
223
232
|
}
|
|
224
|
-
if ('Escape' ===
|
|
225
|
-
|
|
233
|
+
if ('Escape' === event_2.key && expanded && trigger) {
|
|
234
|
+
event_2.preventDefault();
|
|
226
235
|
change(false);
|
|
227
236
|
triggerRef.current?.focus();
|
|
228
237
|
}
|
|
@@ -246,13 +255,13 @@ const FloatButtonGroup = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
246
255
|
icon: expanded ? closeIcon : icon,
|
|
247
256
|
disabled: disabled,
|
|
248
257
|
"aria-expanded": expanded,
|
|
249
|
-
onClick: (
|
|
250
|
-
|
|
251
|
-
|
|
258
|
+
onClick: (event_3)=>{
|
|
259
|
+
onClick?.(event_3);
|
|
260
|
+
if (!event_3.defaultPrevented && 'click' === trigger) change(!expanded);
|
|
252
261
|
},
|
|
253
|
-
onFocus: (
|
|
262
|
+
onFocus: (event_4)=>{
|
|
254
263
|
if ('hover' === trigger) change(true);
|
|
255
|
-
buttonProps.onFocus?.(
|
|
264
|
+
buttonProps.onFocus?.(event_4);
|
|
256
265
|
}
|
|
257
266
|
})
|
|
258
267
|
})
|
|
@@ -262,7 +271,9 @@ const FloatButtonGroup = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
262
271
|
FloatButtonGroup.displayName = 'FloatButton.Group';
|
|
263
272
|
const defaultTarget = ()=>document;
|
|
264
273
|
function scrollElement(target) {
|
|
265
|
-
|
|
274
|
+
if ('document' in target) return scrollElement(target.document);
|
|
275
|
+
if ('scrollingElement' in target) return target.scrollingElement ?? target.documentElement;
|
|
276
|
+
return target;
|
|
266
277
|
}
|
|
267
278
|
const BackTop = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
268
279
|
const { locale } = useTaoConfig();
|
|
@@ -275,16 +286,21 @@ const BackTop = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
275
286
|
});
|
|
276
287
|
const node = useRef(null);
|
|
277
288
|
const animation = useRef(0);
|
|
278
|
-
const
|
|
289
|
+
const [container, setContainer] = useState();
|
|
279
290
|
useImperativeHandle(ref, ()=>({
|
|
280
291
|
nativeElement: node.current
|
|
281
292
|
}));
|
|
282
293
|
useEffect(()=>()=>cancelAnimationFrame(animation.current), []);
|
|
283
294
|
useEffect(()=>{
|
|
284
|
-
const
|
|
285
|
-
if (
|
|
286
|
-
|
|
295
|
+
const next = target();
|
|
296
|
+
if (next === container) return;
|
|
297
|
+
cancelAnimationFrame(animation.current);
|
|
298
|
+
setContainer(next);
|
|
299
|
+
});
|
|
300
|
+
useEffect(()=>{
|
|
301
|
+
if (!container) return;
|
|
287
302
|
const element = scrollElement(container);
|
|
303
|
+
const view = element.ownerDocument.defaultView ?? window;
|
|
288
304
|
const update = ()=>{
|
|
289
305
|
const top = element.scrollTop;
|
|
290
306
|
const total = element.scrollHeight - element.clientHeight;
|
|
@@ -296,21 +312,23 @@ const BackTop = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
296
312
|
container.addEventListener('scroll', update, {
|
|
297
313
|
passive: true
|
|
298
314
|
});
|
|
299
|
-
|
|
315
|
+
view.addEventListener('resize', update);
|
|
300
316
|
const observer = new ResizeObserver(update);
|
|
301
317
|
observer.observe(element);
|
|
302
318
|
update();
|
|
303
319
|
return ()=>{
|
|
304
320
|
container.removeEventListener('scroll', update);
|
|
305
|
-
|
|
321
|
+
view.removeEventListener('resize', update);
|
|
306
322
|
observer.disconnect();
|
|
307
323
|
};
|
|
308
324
|
}, [
|
|
309
|
-
|
|
325
|
+
container,
|
|
310
326
|
visibilityHeight
|
|
311
327
|
]);
|
|
312
328
|
const click = (event)=>{
|
|
313
|
-
|
|
329
|
+
onClick?.(event);
|
|
330
|
+
if (!container || event.defaultPrevented) return;
|
|
331
|
+
const element_0 = scrollElement(container);
|
|
314
332
|
const start = element_0.scrollTop;
|
|
315
333
|
const time = performance.now();
|
|
316
334
|
cancelAnimationFrame(animation.current);
|
|
@@ -323,7 +341,6 @@ const BackTop = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
323
341
|
};
|
|
324
342
|
animation.current = requestAnimationFrame(tick);
|
|
325
343
|
}
|
|
326
|
-
onClick?.(event);
|
|
327
344
|
};
|
|
328
345
|
return scroll.visible ? /*#__PURE__*/ jsx(FloatButtonRoot, {
|
|
329
346
|
...rest,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { type ReactElement } from 'react';
|
|
2
|
+
import { type FormFieldChange } from './form-context.js';
|
|
2
3
|
/** Register the actual control, including noStyle and Form.List fields. */
|
|
3
|
-
export declare function FieldControl({ name, children, }: {
|
|
4
|
+
export declare function FieldControl({ name, children, valueChange, }: {
|
|
4
5
|
name: (string | number)[];
|
|
5
6
|
children: ReactElement<Record<string, unknown>>;
|
|
6
|
-
|
|
7
|
+
valueChange: FormFieldChange | null;
|
|
8
|
+
}): import("react").JSX.Element;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
1
2
|
import { getNodeRef, supportNodeRef } from "@rc-component/util/es/ref";
|
|
2
3
|
import useLayoutEffect from "@rc-component/util/es/hooks/useLayoutEffect";
|
|
3
4
|
import { cloneElement, useId, useMemo } from "react";
|
|
4
5
|
import { mergeRefs } from "../../utils/refs.js";
|
|
5
|
-
import { useFormLayout } from "./form-context.js";
|
|
6
|
+
import { FormFieldChangeContext, useFormLayout } from "./form-context.js";
|
|
6
7
|
import { fieldKey } from "./use-form.js";
|
|
7
|
-
function FieldControl({ name, children }) {
|
|
8
|
+
function FieldControl({ name, children, valueChange }) {
|
|
8
9
|
const { fields } = useFormLayout();
|
|
9
10
|
const generatedId = useId();
|
|
10
11
|
const id = 'string' == typeof children.props.id ? children.props.id : `${generatedId}-control`;
|
|
@@ -23,20 +24,27 @@ function FieldControl({ name, children }) {
|
|
|
23
24
|
childRef
|
|
24
25
|
]);
|
|
25
26
|
useLayoutEffect(()=>{
|
|
26
|
-
fields
|
|
27
|
+
if (!fields) return;
|
|
28
|
+
const targets = fields.get(key) ?? new Set();
|
|
29
|
+
targets.add(target);
|
|
30
|
+
fields.set(key, targets);
|
|
27
31
|
return ()=>{
|
|
28
|
-
|
|
32
|
+
targets.delete(target);
|
|
33
|
+
if (!targets.size) fields.delete(key);
|
|
29
34
|
};
|
|
30
35
|
}, [
|
|
31
36
|
fields,
|
|
32
37
|
key,
|
|
33
38
|
target
|
|
34
39
|
]);
|
|
35
|
-
return /*#__PURE__*/
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
return /*#__PURE__*/ jsx(FormFieldChangeContext.Provider, {
|
|
41
|
+
value: valueChange,
|
|
42
|
+
children: /*#__PURE__*/ cloneElement(children, {
|
|
43
|
+
id,
|
|
44
|
+
...supportNodeRef(children) ? {
|
|
45
|
+
ref
|
|
46
|
+
} : {}
|
|
47
|
+
})
|
|
40
48
|
});
|
|
41
49
|
}
|
|
42
50
|
export { FieldControl };
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import type { FormFieldLayout } from '../form-field/form-field-view.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { FieldRegistry, FormInstance } from './use-form.js';
|
|
3
3
|
export interface FormLayoutContextValue {
|
|
4
4
|
layout: FormFieldLayout;
|
|
5
5
|
form?: FormInstance;
|
|
6
|
-
fields?:
|
|
6
|
+
fields?: FieldRegistry;
|
|
7
7
|
}
|
|
8
8
|
/** Internal layout channel: Form → Form.Item. */
|
|
9
9
|
export declare const FormLayoutContext: import("react").Context<FormLayoutContextValue>;
|
|
10
|
+
export interface FormFieldChange {
|
|
11
|
+
onChange: unknown;
|
|
12
|
+
collect: (value: unknown) => void;
|
|
13
|
+
}
|
|
14
|
+
/** Lets a bound control update the store independently of consumer callbacks. */
|
|
15
|
+
export declare const FormFieldChangeContext: import("react").Context<FormFieldChange | null>;
|
|
10
16
|
export declare function useFormLayout(): FormLayoutContextValue;
|
|
@@ -2,7 +2,8 @@ import { createContext, useContext } from "react";
|
|
|
2
2
|
const FormLayoutContext = createContext({
|
|
3
3
|
layout: 'vertical'
|
|
4
4
|
});
|
|
5
|
+
const FormFieldChangeContext = createContext(null);
|
|
5
6
|
function useFormLayout() {
|
|
6
7
|
return useContext(FormLayoutContext);
|
|
7
8
|
}
|
|
8
|
-
export { FormLayoutContext, useFormLayout };
|
|
9
|
+
export { FormFieldChangeContext, FormLayoutContext, useFormLayout };
|