@rockshin/tao-ui 0.0.43 → 0.0.45
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/README.md +7 -1
- package/component-manifest.json +10 -3
- package/dist/components/auto-complete/auto-complete.js +12 -3
- package/dist/components/breadcrumb/breadcrumb.css +4 -0
- package/dist/components/breadcrumb/breadcrumb.js +1 -0
- package/dist/components/calendar/calendar.d.ts +1 -0
- package/dist/components/calendar/calendar.js +10 -3
- package/dist/components/card/card-tabs.js +204 -182
- package/dist/components/card/card.js +1 -1
- package/dist/components/carousel/carousel.js +11 -5
- package/dist/components/cascader/cascader.js +16 -4
- package/dist/components/collapse/collapse.css +8 -0
- package/dist/components/context-menu/context-menu.d.ts +2 -1
- package/dist/components/context-menu/context-menu.js +57 -44
- package/dist/components/date-picker/calendar/calendar-grid.js +3 -2
- package/dist/components/date-picker/date-picker.css +4 -0
- package/dist/components/date-picker/date-picker.d.ts +1 -0
- package/dist/components/date-picker/date-picker.js +13 -3
- package/dist/components/date-picker/range-picker.d.ts +1 -0
- package/dist/components/date-picker/range-picker.js +13 -3
- package/dist/components/drawer/drawer.d.ts +2 -1
- package/dist/components/drawer/drawer.js +32 -20
- package/dist/components/dropdown/dropdown.d.ts +1 -0
- package/dist/components/dropdown/dropdown.js +139 -123
- package/dist/components/form/field-control.d.ts +6 -0
- package/dist/components/form/field-control.js +42 -0
- package/dist/components/form/form-context.d.ts +3 -0
- package/dist/components/form/form-item.d.ts +2 -1
- package/dist/components/form/form-item.js +55 -42
- package/dist/components/form/form.d.ts +5 -5
- package/dist/components/form/form.js +86 -68
- package/dist/components/form/index.d.ts +1 -0
- package/dist/components/form/use-form.d.ts +16 -0
- package/dist/components/form/use-form.js +69 -0
- package/dist/components/form-field/form-field-view.d.ts +4 -2
- package/dist/components/form-field/form-field-view.js +42 -35
- package/dist/components/mentions/mentions.js +6 -2
- package/dist/components/modal/modal.d.ts +2 -1
- package/dist/components/modal/modal.js +14 -4
- package/dist/components/pagination/pagination.css +4 -0
- package/dist/components/popover/popover.d.ts +2 -1
- package/dist/components/popover/popover.js +185 -176
- package/dist/components/rate/rate.js +114 -88
- package/dist/components/scroll-area/scroll-area.js +127 -118
- package/dist/components/segmented/segmented.js +52 -29
- package/dist/components/select/mobile-select.d.ts +2 -1
- package/dist/components/select/mobile-select.js +52 -47
- package/dist/components/select/select-types.d.ts +1 -0
- package/dist/components/select/select.js +19 -6
- package/dist/components/slider/slider.js +136 -133
- package/dist/components/splitter/splitter.css +4 -0
- package/dist/components/splitter/splitter.js +5 -3
- package/dist/components/table/table.css +29 -11
- package/dist/components/table/table.js +383 -547
- package/dist/components/tabs/tabs.js +3 -2
- package/dist/components/time-picker/time-picker.js +21 -7
- package/dist/components/tooltip/tooltip.d.ts +2 -1
- package/dist/components/tooltip/tooltip.js +82 -71
- package/dist/components/transfer/transfer-parts.js +12 -2
- package/dist/components/transfer/transfer.js +10 -4
- package/dist/components/tree/tree-keyboard.d.ts +6 -0
- package/dist/components/tree/tree-keyboard.js +27 -0
- package/dist/components/tree/tree.js +14 -3
- package/dist/components/tree-select/select-engine.d.ts +2 -1
- package/dist/components/tree-select/select-engine.js +23 -15
- package/dist/components/tree-select/tree-select.js +20 -10
- package/dist/docs/components/form.doc.js +3 -1
- package/dist/docs/components/tao-provider.doc.js +6 -1
- package/dist/entries/form.d.ts +2 -2
- package/dist/entries/provider.d.ts +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/provider/tao-provider.d.ts +10 -3
- package/dist/provider/tao-provider.js +198 -88
- package/dist/utils/scroll-left.d.ts +3 -0
- package/dist/utils/scroll-left.js +7 -0
- package/llms.txt +3 -3
- package/package.json +4 -2
|
@@ -77,10 +77,11 @@ function Tabs(t0) {
|
|
|
77
77
|
const focusedKey = e.target.closest("[data-tao-tab-key]")?.getAttribute("data-tao-tab-key") ?? focusKey;
|
|
78
78
|
const idx = enabledItems.findIndex((item_3)=>item_3.key === focusedKey);
|
|
79
79
|
let next;
|
|
80
|
-
|
|
80
|
+
const rtl = "rtl" === getComputedStyle(e.currentTarget).direction;
|
|
81
|
+
if (e.key === (rtl ? "ArrowLeft" : "ArrowRight") || "ArrowDown" === e.key) {
|
|
81
82
|
e.preventDefault();
|
|
82
83
|
next = enabledItems[(idx + 1) % enabledItems.length];
|
|
83
|
-
} else if ("
|
|
84
|
+
} else if (e.key === (rtl ? "ArrowRight" : "ArrowLeft") || "ArrowUp" === e.key) {
|
|
84
85
|
e.preventDefault();
|
|
85
86
|
next = enabledItems[(idx - 1 + enabledItems.length) % enabledItems.length];
|
|
86
87
|
} else if ("Home" === e.key) {
|
|
@@ -4,9 +4,10 @@ import picker, { RangePicker } from "@rc-component/picker";
|
|
|
4
4
|
import dayjs from "@rc-component/picker/generate/dayjs";
|
|
5
5
|
import en_US from "@rc-component/picker/locale/en_US";
|
|
6
6
|
import zh_CN from "@rc-component/picker/locale/zh_CN";
|
|
7
|
+
import { forwardRef, useImperativeHandle, useMemo, useRef } from "react";
|
|
8
|
+
import { TaoPortalScope, useTaoConfig, useTaoDirection, useTaoInternalConfig } from "../../provider/tao-provider.js";
|
|
9
|
+
import { mergeRefs } from "../../utils/refs.js";
|
|
7
10
|
import "dayjs/locale/zh-cn";
|
|
8
|
-
import { forwardRef, useImperativeHandle, useRef } from "react";
|
|
9
|
-
import { TaoPortalScope, useTaoConfig, useTaoInternalConfig } from "../../provider/tao-provider.js";
|
|
10
11
|
import { cx } from "../../utils/semantic.js";
|
|
11
12
|
import { Button } from "../button/button.js";
|
|
12
13
|
import "./time-picker.css";
|
|
@@ -192,9 +193,10 @@ function useAppearance(props, classNames, styles) {
|
|
|
192
193
|
} else t14 = $[34];
|
|
193
194
|
return t14;
|
|
194
195
|
}
|
|
195
|
-
function scopedPanel(panel, render) {
|
|
196
|
+
function scopedPanel(panel, render, direction) {
|
|
196
197
|
return /*#__PURE__*/ jsx(TaoPortalScope, {
|
|
197
198
|
asChild: true,
|
|
199
|
+
direction: direction,
|
|
198
200
|
children: /*#__PURE__*/ jsx("div", {
|
|
199
201
|
"data-tao-time-popup": "",
|
|
200
202
|
children: render ? render(panel) : panel
|
|
@@ -203,6 +205,10 @@ function scopedPanel(panel, render) {
|
|
|
203
205
|
}
|
|
204
206
|
const SingleTimePicker = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
205
207
|
const rootRef = useRef(null);
|
|
208
|
+
const [direction, directionRef] = useTaoDirection(props.direction);
|
|
209
|
+
const mergedRootRef = useMemo(()=>mergeRefs(rootRef, directionRef), [
|
|
210
|
+
directionRef
|
|
211
|
+
]);
|
|
206
212
|
const pickerRef = useRef(null);
|
|
207
213
|
useImperativeHandle(ref, ()=>({
|
|
208
214
|
get nativeElement () {
|
|
@@ -227,7 +233,8 @@ const SingleTimePicker = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
227
233
|
...'object' == typeof allowClear ? allowClear : {}
|
|
228
234
|
};
|
|
229
235
|
return /*#__PURE__*/ jsx("div", {
|
|
230
|
-
ref:
|
|
236
|
+
ref: mergedRootRef,
|
|
237
|
+
dir: direction,
|
|
231
238
|
"data-tao-time-picker": "",
|
|
232
239
|
"data-tao-control": "",
|
|
233
240
|
"data-tao-size": appearance.size,
|
|
@@ -243,6 +250,7 @@ const SingleTimePicker = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
243
250
|
children: /*#__PURE__*/ jsx(picker, {
|
|
244
251
|
...rest,
|
|
245
252
|
ref: pickerRef,
|
|
253
|
+
direction: direction,
|
|
246
254
|
picker: "time",
|
|
247
255
|
generateConfig: dayjs,
|
|
248
256
|
locale: appearance.locale,
|
|
@@ -266,7 +274,7 @@ const SingleTimePicker = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
266
274
|
okButton: components?.button ?? ConfirmButton,
|
|
267
275
|
...components
|
|
268
276
|
},
|
|
269
|
-
panelRender: (panel)=>scopedPanel(panel, panelRender),
|
|
277
|
+
panelRender: (panel)=>scopedPanel(panel, panelRender, direction),
|
|
270
278
|
renderExtraFooter: renderExtraFooter ?? addon,
|
|
271
279
|
onChange: (date, text)=>onChange?.(date, text),
|
|
272
280
|
onOk: (date_0)=>onOk?.(date_0),
|
|
@@ -280,6 +288,10 @@ const SingleTimePicker = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
280
288
|
SingleTimePicker.displayName = 'TimePicker';
|
|
281
289
|
const TimeRangePicker = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
282
290
|
const rootRef = useRef(null);
|
|
291
|
+
const [direction, directionRef] = useTaoDirection(props.direction);
|
|
292
|
+
const mergedRootRef = useMemo(()=>mergeRefs(rootRef, directionRef), [
|
|
293
|
+
directionRef
|
|
294
|
+
]);
|
|
283
295
|
const pickerRef = useRef(null);
|
|
284
296
|
useImperativeHandle(ref, ()=>({
|
|
285
297
|
get nativeElement () {
|
|
@@ -304,7 +316,8 @@ const TimeRangePicker = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
304
316
|
...'object' == typeof allowClear ? allowClear : {}
|
|
305
317
|
};
|
|
306
318
|
return /*#__PURE__*/ jsx("div", {
|
|
307
|
-
ref:
|
|
319
|
+
ref: mergedRootRef,
|
|
320
|
+
dir: direction,
|
|
308
321
|
"data-tao-time-picker": "range",
|
|
309
322
|
"data-tao-control": "",
|
|
310
323
|
"data-tao-size": appearance.size,
|
|
@@ -320,6 +333,7 @@ const TimeRangePicker = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
320
333
|
children: /*#__PURE__*/ jsx(RangePicker, {
|
|
321
334
|
...rest,
|
|
322
335
|
ref: pickerRef,
|
|
336
|
+
direction: direction,
|
|
323
337
|
picker: "time",
|
|
324
338
|
generateConfig: dayjs,
|
|
325
339
|
locale: appearance.locale,
|
|
@@ -345,7 +359,7 @@ const TimeRangePicker = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
345
359
|
okButton: components?.button ?? ConfirmButton,
|
|
346
360
|
...components
|
|
347
361
|
},
|
|
348
|
-
panelRender: (panel)=>scopedPanel(panel, panelRender)
|
|
362
|
+
panelRender: (panel)=>scopedPanel(panel, panelRender, direction)
|
|
349
363
|
})
|
|
350
364
|
});
|
|
351
365
|
});
|
|
@@ -4,6 +4,7 @@ import './tooltip.css';
|
|
|
4
4
|
export type TooltipSemanticPart = 'content' | 'arrow';
|
|
5
5
|
export type TooltipPlacement = 'top' | 'bottom' | 'left' | 'right';
|
|
6
6
|
export interface TooltipProps {
|
|
7
|
+
direction?: 'ltr' | 'rtl';
|
|
7
8
|
/** Tooltip content. Renders nothing (and disables the tooltip) when null/undefined/''. */
|
|
8
9
|
title?: ReactNode;
|
|
9
10
|
/** Popup side relative to the trigger. Defaults to 'top'. */
|
|
@@ -30,4 +31,4 @@ export interface TooltipProps {
|
|
|
30
31
|
/** Exactly one trigger element. */
|
|
31
32
|
children: ReactNode;
|
|
32
33
|
}
|
|
33
|
-
export declare function Tooltip({ title, placement, arrow, open, defaultOpen, onOpenChange, mouseEnterDelay, mouseLeaveDelay, color, className, style, classNames, styles, children, }: TooltipProps): import("react").JSX.Element;
|
|
34
|
+
export declare function Tooltip({ direction: directionProp, title, placement, arrow, open, defaultOpen, onOpenChange, mouseEnterDelay, mouseLeaveDelay, color, className, style, classNames, styles, children, }: TooltipProps): import("react").JSX.Element;
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { c } from "react-compiler-runtime";
|
|
3
3
|
import { useEffect, useRef } from "react";
|
|
4
|
-
import { TaoPortalScope } from "../../provider/tao-provider.js";
|
|
4
|
+
import { TaoPortalScope, useTaoDirection } from "../../provider/tao-provider.js";
|
|
5
5
|
import { asTriggerChild, useControlledOpen } from "../../utils/overlay.js";
|
|
6
6
|
import { cx } from "../../utils/semantic.js";
|
|
7
7
|
import "./tooltip.css";
|
|
8
8
|
import * as __rspack_external__radix_ui_react_tooltip_b301f25d from "@radix-ui/react-tooltip";
|
|
9
9
|
function Tooltip(t0) {
|
|
10
|
-
const $ = c(
|
|
11
|
-
const { title, placement: t1, arrow: t2, open, defaultOpen, onOpenChange, mouseEnterDelay: t3, mouseLeaveDelay: t4, color, className, style, classNames, styles, children } = t0;
|
|
10
|
+
const $ = c(57);
|
|
11
|
+
const { direction: directionProp, title, placement: t1, arrow: t2, open, defaultOpen, onOpenChange, mouseEnterDelay: t3, mouseLeaveDelay: t4, color, className, style, classNames, styles, children } = t0;
|
|
12
12
|
const placement = void 0 === t1 ? "top" : t1;
|
|
13
13
|
const arrow = void 0 === t2 ? true : t2;
|
|
14
14
|
const mouseEnterDelay = void 0 === t3 ? 0.1 : t3;
|
|
15
15
|
const mouseLeaveDelay = void 0 === t4 ? 0.1 : t4;
|
|
16
|
+
const [direction, directionRef] = useTaoDirection(directionProp, "self");
|
|
16
17
|
let t5;
|
|
17
18
|
if ($[0] !== defaultOpen || $[1] !== onOpenChange || $[2] !== open) {
|
|
18
19
|
t5 = {
|
|
@@ -124,47 +125,49 @@ function Tooltip(t0) {
|
|
|
124
125
|
$[21] = t15;
|
|
125
126
|
} else t15 = $[21];
|
|
126
127
|
let t16;
|
|
127
|
-
if ($[22] !==
|
|
128
|
+
if ($[22] !== directionRef || $[23] !== hoverProps || $[24] !== t15) {
|
|
128
129
|
t16 = /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_tooltip_b301f25d.Trigger, {
|
|
130
|
+
ref: directionRef,
|
|
129
131
|
asChild: true,
|
|
130
132
|
...hoverProps,
|
|
131
133
|
onBlur: t14,
|
|
132
134
|
children: t15
|
|
133
135
|
});
|
|
134
|
-
$[22] =
|
|
135
|
-
$[23] =
|
|
136
|
-
$[24] =
|
|
137
|
-
|
|
136
|
+
$[22] = directionRef;
|
|
137
|
+
$[23] = hoverProps;
|
|
138
|
+
$[24] = t15;
|
|
139
|
+
$[25] = t16;
|
|
140
|
+
} else t16 = $[25];
|
|
138
141
|
const t17 = classNames?.content;
|
|
139
142
|
let t18;
|
|
140
|
-
if ($[
|
|
143
|
+
if ($[26] !== className || $[27] !== t17) {
|
|
141
144
|
t18 = cx(t17, className);
|
|
142
|
-
$[
|
|
143
|
-
$[
|
|
144
|
-
$[
|
|
145
|
-
} else t18 = $[
|
|
145
|
+
$[26] = className;
|
|
146
|
+
$[27] = t17;
|
|
147
|
+
$[28] = t18;
|
|
148
|
+
} else t18 = $[28];
|
|
146
149
|
const t19 = styles?.content;
|
|
147
150
|
let t20;
|
|
148
|
-
if ($[
|
|
151
|
+
if ($[29] !== colorStyle || $[30] !== style || $[31] !== t19) {
|
|
149
152
|
t20 = {
|
|
150
153
|
...colorStyle,
|
|
151
154
|
...t19,
|
|
152
155
|
...style
|
|
153
156
|
};
|
|
154
|
-
$[
|
|
155
|
-
$[
|
|
156
|
-
$[
|
|
157
|
-
$[
|
|
158
|
-
} else t20 = $[
|
|
157
|
+
$[29] = colorStyle;
|
|
158
|
+
$[30] = style;
|
|
159
|
+
$[31] = t19;
|
|
160
|
+
$[32] = t20;
|
|
161
|
+
} else t20 = $[32];
|
|
159
162
|
let t21;
|
|
160
|
-
if ($[
|
|
163
|
+
if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
|
|
161
164
|
t21 = ()=>{
|
|
162
165
|
pointerDriven.current = false;
|
|
163
166
|
};
|
|
164
|
-
$[
|
|
165
|
-
} else t21 = $[
|
|
167
|
+
$[33] = t21;
|
|
168
|
+
} else t21 = $[33];
|
|
166
169
|
let t22;
|
|
167
|
-
if ($[
|
|
170
|
+
if ($[34] !== arrow || $[35] !== classNames?.arrow || $[36] !== color || $[37] !== styles?.arrow) {
|
|
168
171
|
t22 = arrow && /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_tooltip_b301f25d.Arrow, {
|
|
169
172
|
asChild: true,
|
|
170
173
|
children: /*#__PURE__*/ jsx("span", {
|
|
@@ -178,65 +181,73 @@ function Tooltip(t0) {
|
|
|
178
181
|
}
|
|
179
182
|
})
|
|
180
183
|
});
|
|
181
|
-
$[
|
|
182
|
-
$[
|
|
183
|
-
$[
|
|
184
|
-
$[
|
|
185
|
-
$[
|
|
186
|
-
} else t22 = $[
|
|
184
|
+
$[34] = arrow;
|
|
185
|
+
$[35] = classNames?.arrow;
|
|
186
|
+
$[36] = color;
|
|
187
|
+
$[37] = styles?.arrow;
|
|
188
|
+
$[38] = t22;
|
|
189
|
+
} else t22 = $[38];
|
|
187
190
|
let t23;
|
|
188
|
-
if ($[
|
|
189
|
-
t23 = /*#__PURE__*/
|
|
191
|
+
if ($[39] !== hoverProps || $[40] !== placement || $[41] !== t18 || $[42] !== t20 || $[43] !== t22 || $[44] !== title) {
|
|
192
|
+
t23 = /*#__PURE__*/ jsxs(__rspack_external__radix_ui_react_tooltip_b301f25d.Content, {
|
|
193
|
+
"data-tao-tooltip-content": "",
|
|
194
|
+
className: t18,
|
|
195
|
+
style: t20,
|
|
196
|
+
side: placement,
|
|
197
|
+
sideOffset: 4,
|
|
198
|
+
onEscapeKeyDown: t21,
|
|
199
|
+
...hoverProps,
|
|
200
|
+
children: [
|
|
201
|
+
title,
|
|
202
|
+
t22
|
|
203
|
+
]
|
|
204
|
+
});
|
|
205
|
+
$[39] = hoverProps;
|
|
206
|
+
$[40] = placement;
|
|
207
|
+
$[41] = t18;
|
|
208
|
+
$[42] = t20;
|
|
209
|
+
$[43] = t22;
|
|
210
|
+
$[44] = title;
|
|
211
|
+
$[45] = t23;
|
|
212
|
+
} else t23 = $[45];
|
|
213
|
+
let t24;
|
|
214
|
+
if ($[46] !== direction || $[47] !== t23) {
|
|
215
|
+
t24 = /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_tooltip_b301f25d.Portal, {
|
|
190
216
|
children: /*#__PURE__*/ jsx(TaoPortalScope, {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
className: t18,
|
|
194
|
-
style: t20,
|
|
195
|
-
side: placement,
|
|
196
|
-
sideOffset: 4,
|
|
197
|
-
onEscapeKeyDown: t21,
|
|
198
|
-
...hoverProps,
|
|
199
|
-
children: [
|
|
200
|
-
title,
|
|
201
|
-
t22
|
|
202
|
-
]
|
|
203
|
-
})
|
|
217
|
+
direction: direction,
|
|
218
|
+
children: t23
|
|
204
219
|
})
|
|
205
220
|
});
|
|
206
|
-
$[
|
|
207
|
-
$[
|
|
208
|
-
$[
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
} else t23 = $[44];
|
|
214
|
-
let t24;
|
|
215
|
-
if ($[45] !== handleOpenChange || $[46] !== realOpen || $[47] !== t16 || $[48] !== t23) {
|
|
216
|
-
t24 = /*#__PURE__*/ jsxs(__rspack_external__radix_ui_react_tooltip_b301f25d.Root, {
|
|
221
|
+
$[46] = direction;
|
|
222
|
+
$[47] = t23;
|
|
223
|
+
$[48] = t24;
|
|
224
|
+
} else t24 = $[48];
|
|
225
|
+
let t25;
|
|
226
|
+
if ($[49] !== handleOpenChange || $[50] !== realOpen || $[51] !== t16 || $[52] !== t24) {
|
|
227
|
+
t25 = /*#__PURE__*/ jsxs(__rspack_external__radix_ui_react_tooltip_b301f25d.Root, {
|
|
217
228
|
open: realOpen,
|
|
218
229
|
onOpenChange: handleOpenChange,
|
|
219
230
|
children: [
|
|
220
231
|
t16,
|
|
221
|
-
|
|
232
|
+
t24
|
|
222
233
|
]
|
|
223
234
|
});
|
|
224
|
-
$[
|
|
225
|
-
$[
|
|
226
|
-
$[
|
|
227
|
-
$[
|
|
228
|
-
$[
|
|
229
|
-
} else
|
|
230
|
-
let
|
|
231
|
-
if ($[
|
|
232
|
-
|
|
235
|
+
$[49] = handleOpenChange;
|
|
236
|
+
$[50] = realOpen;
|
|
237
|
+
$[51] = t16;
|
|
238
|
+
$[52] = t24;
|
|
239
|
+
$[53] = t25;
|
|
240
|
+
} else t25 = $[53];
|
|
241
|
+
let t26;
|
|
242
|
+
if ($[54] !== t13 || $[55] !== t25) {
|
|
243
|
+
t26 = /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_tooltip_b301f25d.Provider, {
|
|
233
244
|
delayDuration: t13,
|
|
234
|
-
children:
|
|
245
|
+
children: t25
|
|
235
246
|
});
|
|
236
|
-
$[
|
|
237
|
-
$[
|
|
238
|
-
$[
|
|
239
|
-
} else
|
|
240
|
-
return
|
|
247
|
+
$[54] = t13;
|
|
248
|
+
$[55] = t25;
|
|
249
|
+
$[56] = t26;
|
|
250
|
+
} else t26 = $[56];
|
|
251
|
+
return t26;
|
|
241
252
|
}
|
|
242
253
|
export { Tooltip };
|
|
@@ -100,9 +100,19 @@ function TransferOperation(t0) {
|
|
|
100
100
|
disabled: inactive,
|
|
101
101
|
onClick: handler,
|
|
102
102
|
"aria-label": label,
|
|
103
|
-
icon: /*#__PURE__*/ jsx("
|
|
103
|
+
icon: /*#__PURE__*/ jsx("svg", {
|
|
104
104
|
"aria-hidden": "true",
|
|
105
|
-
|
|
105
|
+
width: "16",
|
|
106
|
+
height: "16",
|
|
107
|
+
viewBox: "0 0 16 16",
|
|
108
|
+
fill: "none",
|
|
109
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
110
|
+
d: right !== ("rtl" === direction) ? "m6 4 4 4-4 4" : "m10 4-4 4 4 4",
|
|
111
|
+
stroke: "currentColor",
|
|
112
|
+
strokeWidth: "1.5",
|
|
113
|
+
strokeLinecap: "round",
|
|
114
|
+
strokeLinejoin: "round"
|
|
115
|
+
})
|
|
106
116
|
}),
|
|
107
117
|
children: content
|
|
108
118
|
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef, useImperativeHandle, useRef, useState } from "react";
|
|
3
|
-
import { useTaoConfig } from "../../provider/tao-provider.js";
|
|
2
|
+
import { forwardRef, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { useTaoConfig, useTaoDirection } from "../../provider/tao-provider.js";
|
|
4
4
|
import { cx } from "../../utils/semantic.js";
|
|
5
|
+
import { mergeRefs } from "../../utils/refs.js";
|
|
5
6
|
import { TransferList } from "./transfer-list.js";
|
|
6
7
|
import { TransferOperation, TransferSearch } from "./transfer-parts.js";
|
|
7
8
|
import "./transfer.css";
|
|
@@ -41,6 +42,10 @@ function TransferRoot(props, ref) {
|
|
|
41
42
|
props: mergedProps
|
|
42
43
|
}) : styles;
|
|
43
44
|
const root = useRef(null);
|
|
45
|
+
const [direction, directionRef] = useTaoDirection('auto' === rest.dir || 'rtl' === rest.dir || 'ltr' === rest.dir ? rest.dir : void 0);
|
|
46
|
+
const mergedRootRef = useMemo(()=>mergeRefs(root, directionRef), [
|
|
47
|
+
directionRef
|
|
48
|
+
]);
|
|
44
49
|
useImperativeHandle(ref, ()=>({
|
|
45
50
|
nativeElement: root.current
|
|
46
51
|
}));
|
|
@@ -166,7 +171,8 @@ function TransferRoot(props, ref) {
|
|
|
166
171
|
};
|
|
167
172
|
return /*#__PURE__*/ jsxs("div", {
|
|
168
173
|
...rest,
|
|
169
|
-
ref:
|
|
174
|
+
ref: mergedRootRef,
|
|
175
|
+
dir: 'auto' === rest.dir ? 'auto' : direction,
|
|
170
176
|
"data-tao-transfer": "",
|
|
171
177
|
"data-tao-disabled": resolvedDisabled ? '' : void 0,
|
|
172
178
|
"data-tao-status": status,
|
|
@@ -185,7 +191,7 @@ function TransferRoot(props, ref) {
|
|
|
185
191
|
rightActive: sourceSelected.some((key_8)=>!recordMap.get(key_8)?.disabled),
|
|
186
192
|
disabled: resolvedDisabled,
|
|
187
193
|
oneWay: oneWay,
|
|
188
|
-
direction:
|
|
194
|
+
direction: direction,
|
|
189
195
|
className: classes?.actions,
|
|
190
196
|
style: {
|
|
191
197
|
...operationStyle,
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type KeyboardEvent, type ReactElement } from 'react';
|
|
2
|
+
/** rc-tree's horizontal key handler uses LTR semantics even with direction="rtl". */
|
|
3
|
+
export declare function treeKeyboardEvent<T extends Element>(event: KeyboardEvent<T>, direction?: 'ltr' | 'rtl'): KeyboardEvent<T>;
|
|
4
|
+
export declare function originalTreeKeyboardEvent<T extends Element>(event: KeyboardEvent<T>): KeyboardEvent<T>;
|
|
5
|
+
/** Adapt only rc-select's internal OptionList handle; its public events stay intact. */
|
|
6
|
+
export declare function treeKeyboardPopup(menu: ReactElement, direction: 'ltr' | 'rtl'): ReactElement;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { getNodeRef } from "@rc-component/util";
|
|
2
|
+
import { cloneElement } from "react";
|
|
3
|
+
import { mergeRefs } from "../../utils/refs.js";
|
|
4
|
+
const originalEvents = new WeakMap();
|
|
5
|
+
function treeKeyboardEvent(event, direction) {
|
|
6
|
+
if ('rtl' !== direction || 'ArrowLeft' !== event.key && 'ArrowRight' !== event.key) return event;
|
|
7
|
+
const mapped = Object.create(event);
|
|
8
|
+
mapped.key = 'ArrowLeft' === event.key ? 'ArrowRight' : 'ArrowLeft';
|
|
9
|
+
mapped.preventDefault = ()=>event.preventDefault();
|
|
10
|
+
mapped.stopPropagation = ()=>event.stopPropagation();
|
|
11
|
+
originalEvents.set(mapped, event);
|
|
12
|
+
return mapped;
|
|
13
|
+
}
|
|
14
|
+
function originalTreeKeyboardEvent(event) {
|
|
15
|
+
return originalEvents.get(event) ?? event;
|
|
16
|
+
}
|
|
17
|
+
function treeKeyboardPopup(menu, direction) {
|
|
18
|
+
if ('rtl' !== direction) return menu;
|
|
19
|
+
const forwardRef = mergeRefs(getNodeRef(menu) ?? void 0);
|
|
20
|
+
return cloneElement(menu, {
|
|
21
|
+
ref: (handle)=>forwardRef(handle && {
|
|
22
|
+
...handle,
|
|
23
|
+
onKeyDown: (event)=>handle.onKeyDown(treeKeyboardEvent(event, direction))
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export { originalTreeKeyboardEvent, treeKeyboardEvent, treeKeyboardPopup };
|
|
@@ -2,13 +2,21 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { c } from "react-compiler-runtime";
|
|
3
3
|
import tree, { TreeNode, conductExpandParent, convertDataToEntities, convertTreeToData, useTree } from "@rc-component/tree";
|
|
4
4
|
import { forwardRef, useRef, useState } from "react";
|
|
5
|
-
import { useTaoConfig } from "../../provider/tao-provider.js";
|
|
5
|
+
import { useTaoConfig, useTaoDirection } from "../../provider/tao-provider.js";
|
|
6
6
|
import { cx } from "../../utils/semantic.js";
|
|
7
7
|
import { Spinner } from "../spinner/spinner.js";
|
|
8
8
|
import { TreeCheck } from "./tree-check.js";
|
|
9
|
+
import { originalTreeKeyboardEvent, treeKeyboardEvent } from "./tree-keyboard.js";
|
|
9
10
|
import "./tree.css";
|
|
10
11
|
import { interopDefault } from "../../utils/interop-default.js";
|
|
11
12
|
const RcTreeComponent = /*#__PURE__*/ interopDefault(tree);
|
|
13
|
+
class DirectionalRcTree extends RcTreeComponent {
|
|
14
|
+
constructor(props){
|
|
15
|
+
super(props);
|
|
16
|
+
const onKeyDown = this.onKeyDown;
|
|
17
|
+
this.onKeyDown = (event)=>onKeyDown(treeKeyboardEvent(event, this.props.direction));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
12
20
|
function TreeGlyph(t0) {
|
|
13
21
|
const $ = c(16);
|
|
14
22
|
const { kind } = t0;
|
|
@@ -99,7 +107,8 @@ function TreeGlyph(t0) {
|
|
|
99
107
|
}
|
|
100
108
|
const TreeBase = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
101
109
|
const config = useTaoConfig();
|
|
102
|
-
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, ...rest } = props;
|
|
110
|
+
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 [direction, directionRef] = useTaoDirection(directionProp);
|
|
103
112
|
const mergedProps = {
|
|
104
113
|
...props,
|
|
105
114
|
disabled,
|
|
@@ -173,6 +182,7 @@ const TreeBase = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
173
182
|
});
|
|
174
183
|
}
|
|
175
184
|
return /*#__PURE__*/ jsx("div", {
|
|
185
|
+
ref: directionRef,
|
|
176
186
|
"data-tao-tree": "",
|
|
177
187
|
"data-tao-block": blockNode || void 0,
|
|
178
188
|
"data-tao-show-line": Boolean(showLine) || void 0,
|
|
@@ -185,11 +195,12 @@ const TreeBase = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
185
195
|
...rootStyle,
|
|
186
196
|
...semanticStyles?.root
|
|
187
197
|
},
|
|
188
|
-
children: /*#__PURE__*/ jsx(
|
|
198
|
+
children: /*#__PURE__*/ jsx(DirectionalRcTree, {
|
|
189
199
|
...rest,
|
|
190
200
|
ref: ref,
|
|
191
201
|
prefixCls: prefixCls,
|
|
192
202
|
direction: direction,
|
|
203
|
+
onKeyDown: (event)=>onKeyDown?.(originalTreeKeyboardEvent(event)),
|
|
193
204
|
showLine: Boolean(showLine),
|
|
194
205
|
showIcon: showIcon,
|
|
195
206
|
disabled: disabled,
|
|
@@ -11,7 +11,8 @@ export declare function selectAllowClear(allowClear: BaseSelectPropsWithoutPriva
|
|
|
11
11
|
clearIcon: string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined> | null;
|
|
12
12
|
label: string;
|
|
13
13
|
};
|
|
14
|
-
export declare function SelectEnginePopup({ children, tree, treeLine, size, style, }: {
|
|
14
|
+
export declare function SelectEnginePopup({ direction, children, tree, treeLine, size, style, }: {
|
|
15
|
+
direction?: 'ltr' | 'rtl';
|
|
15
16
|
children: ReactNode;
|
|
16
17
|
tree?: boolean;
|
|
17
18
|
treeLine?: boolean;
|
|
@@ -11,26 +11,23 @@ function selectAllowClear(allowClear, clearIcon, label) {
|
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
13
|
function SelectEnginePopup(t0) {
|
|
14
|
-
const $ = c(
|
|
15
|
-
const { children, tree, treeLine, size, style } = t0;
|
|
14
|
+
const $ = c(11);
|
|
15
|
+
const { direction, children, tree, treeLine, size, style } = t0;
|
|
16
16
|
const t1 = tree ? "" : void 0;
|
|
17
17
|
const t2 = treeLine || void 0;
|
|
18
18
|
const t3 = tree || void 0;
|
|
19
19
|
const t4 = tree || void 0;
|
|
20
20
|
let t5;
|
|
21
21
|
if ($[0] !== children || $[1] !== size || $[2] !== style || $[3] !== t1 || $[4] !== t2 || $[5] !== t3 || $[6] !== t4) {
|
|
22
|
-
t5 = /*#__PURE__*/ jsx(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
style: style,
|
|
32
|
-
children: children
|
|
33
|
-
})
|
|
22
|
+
t5 = /*#__PURE__*/ jsx("div", {
|
|
23
|
+
"data-tao-select-engine-popup": "",
|
|
24
|
+
"data-tao-size": size,
|
|
25
|
+
"data-tao-tree": t1,
|
|
26
|
+
"data-tao-show-line": t2,
|
|
27
|
+
"data-tao-selectable": t3,
|
|
28
|
+
"data-tao-block": t4,
|
|
29
|
+
style: style,
|
|
30
|
+
children: children
|
|
34
31
|
});
|
|
35
32
|
$[0] = children;
|
|
36
33
|
$[1] = size;
|
|
@@ -41,6 +38,17 @@ function SelectEnginePopup(t0) {
|
|
|
41
38
|
$[6] = t4;
|
|
42
39
|
$[7] = t5;
|
|
43
40
|
} else t5 = $[7];
|
|
44
|
-
|
|
41
|
+
let t6;
|
|
42
|
+
if ($[8] !== direction || $[9] !== t5) {
|
|
43
|
+
t6 = /*#__PURE__*/ jsx(TaoPortalScope, {
|
|
44
|
+
asChild: true,
|
|
45
|
+
direction: direction,
|
|
46
|
+
children: t5
|
|
47
|
+
});
|
|
48
|
+
$[8] = direction;
|
|
49
|
+
$[9] = t5;
|
|
50
|
+
$[10] = t6;
|
|
51
|
+
} else t6 = $[10];
|
|
52
|
+
return t6;
|
|
45
53
|
}
|
|
46
54
|
export { SelectEnginePopup, selectAllowClear };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { treeKeyboardPopup } from "../tree/tree-keyboard.js";
|
|
2
3
|
import tree_select, { SHOW_ALL, SHOW_CHILD, SHOW_PARENT, TreeNode } from "@rc-component/tree-select";
|
|
3
|
-
import { forwardRef, useRef } from "react";
|
|
4
|
-
import { useTaoInternalConfig } from "../../provider/tao-provider.js";
|
|
4
|
+
import { forwardRef, useMemo, useRef } from "react";
|
|
5
|
+
import { useTaoDirection, useTaoInternalConfig } from "../../provider/tao-provider.js";
|
|
6
|
+
import { mergeRefs } from "../../utils/refs.js";
|
|
5
7
|
import { cx } from "../../utils/semantic.js";
|
|
6
8
|
import { ChevronDownIcon, CloseIcon } from "../select/select-icons.js";
|
|
7
9
|
import { Spinner } from "../spinner/spinner.js";
|
|
@@ -39,10 +41,17 @@ function InternalTreeSelect(props, ref) {
|
|
|
39
41
|
props: resolvedProps
|
|
40
42
|
}) : styles;
|
|
41
43
|
const renderPopup = popupRender ?? dropdownRender;
|
|
44
|
+
const [direction, directionRef] = useTaoDirection(props.direction);
|
|
45
|
+
const mergedRef = useMemo(()=>mergeRefs(ref, (node_0)=>directionRef(node_0?.nativeElement ?? null)), [
|
|
46
|
+
ref,
|
|
47
|
+
directionRef
|
|
48
|
+
]);
|
|
42
49
|
const selectionLimit = props.showCheckedStrategy !== SHOW_PARENT && (props.showCheckedStrategy !== SHOW_ALL || props.treeCheckStrictly) ? maxCount : void 0;
|
|
43
50
|
return /*#__PURE__*/ jsx(RcTreeSelectComponent, {
|
|
44
51
|
...rest,
|
|
45
|
-
ref:
|
|
52
|
+
ref: mergedRef,
|
|
53
|
+
direction: direction,
|
|
54
|
+
dir: direction,
|
|
46
55
|
prefixCls: prefixCls,
|
|
47
56
|
"data-tao-tree-select": "",
|
|
48
57
|
"data-tao-select-engine": "",
|
|
@@ -65,20 +74,20 @@ function InternalTreeSelect(props, ref) {
|
|
|
65
74
|
treeLine: !!treeLine,
|
|
66
75
|
treeIcon: treeIcon,
|
|
67
76
|
showTreeIcon: !!treeIcon,
|
|
68
|
-
switcherIcon: (
|
|
69
|
-
const custom = 'function' == typeof switcherIcon ? switcherIcon(
|
|
77
|
+
switcherIcon: (node_1)=>{
|
|
78
|
+
const custom = 'function' == typeof switcherIcon ? switcherIcon(node_1) : switcherIcon;
|
|
70
79
|
const leaf = 'object' == typeof treeLine && treeLine.showLeafIcon;
|
|
71
80
|
return /*#__PURE__*/ jsx("span", {
|
|
72
81
|
"data-tao-tree-select-switcher": "",
|
|
73
82
|
"data-tao-tree-switcher": "",
|
|
74
83
|
"data-tao-custom": "",
|
|
75
|
-
"data-tao-expanded":
|
|
76
|
-
"data-tao-leaf":
|
|
84
|
+
"data-tao-expanded": node_1.expanded || void 0,
|
|
85
|
+
"data-tao-leaf": node_1.isLeaf || void 0,
|
|
77
86
|
className: classes?.popup?.itemSwitcher,
|
|
78
87
|
style: semanticStyles?.popup?.itemSwitcher,
|
|
79
|
-
children:
|
|
88
|
+
children: node_1.loading ? /*#__PURE__*/ jsx(Spinner, {
|
|
80
89
|
size: "small"
|
|
81
|
-
}) : void 0 !== custom ? custom :
|
|
90
|
+
}) : void 0 !== custom ? custom : node_1.isLeaf ? 'function' == typeof leaf ? leaf(node_1) : true === leaf ? /*#__PURE__*/ jsx("span", {
|
|
82
91
|
children: "\xb7"
|
|
83
92
|
}) : leaf || null : /*#__PURE__*/ jsx(ChevronDownIcon, {})
|
|
84
93
|
});
|
|
@@ -112,10 +121,11 @@ function InternalTreeSelect(props, ref) {
|
|
|
112
121
|
...semanticStyles?.popup?.root
|
|
113
122
|
},
|
|
114
123
|
popupRender: (menu)=>/*#__PURE__*/ jsx(SelectEnginePopup, {
|
|
124
|
+
direction: direction,
|
|
115
125
|
tree: true,
|
|
116
126
|
treeLine: !!treeLine,
|
|
117
127
|
size: size,
|
|
118
|
-
children: renderPopup ? renderPopup(menu) : menu
|
|
128
|
+
children: renderPopup ? renderPopup(treeKeyboardPopup(menu, direction)) : treeKeyboardPopup(menu, direction)
|
|
119
129
|
}),
|
|
120
130
|
onPopupVisibleChange: onOpenChange ?? onDropdownVisibleChange ?? onPopupVisibleChange
|
|
121
131
|
});
|