@rockshin/tao-ui 0.0.44 → 0.0.46
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 +9 -1
- package/component-manifest.json +38 -4
- package/dist/components/alert/alert.js +20 -17
- package/dist/components/auto-complete/auto-complete.js +12 -3
- package/dist/components/avatar/avatar.js +2 -1
- package/dist/components/breadcrumb/breadcrumb.css +4 -0
- package/dist/components/breadcrumb/breadcrumb.js +82 -77
- package/dist/components/calendar/calendar.d.ts +1 -1
- package/dist/components/calendar/calendar.js +51 -33
- 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/color-picker/color-picker.js +273 -269
- 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 +13 -6
- package/dist/components/date-picker/calendar/use-calendar.d.ts +2 -2
- package/dist/components/date-picker/calendar/use-calendar.js +2 -3
- package/dist/components/date-picker/date-localization.d.ts +3 -0
- package/dist/components/date-picker/date-localization.js +76 -0
- 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 +48 -30
- package/dist/components/date-picker/range-picker.d.ts +1 -0
- package/dist/components/date-picker/range-picker.js +41 -23
- 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 +160 -143
- package/dist/components/float-button/float-button.js +3 -2
- package/dist/components/form/form.js +88 -103
- package/dist/components/image/image.js +202 -137
- package/dist/components/list/list-pagination.js +148 -147
- package/dist/components/mentions/mentions.js +6 -2
- package/dist/components/modal/confirm-dialog.js +4 -2
- package/dist/components/modal/modal.d.ts +2 -1
- package/dist/components/modal/modal.js +387 -375
- package/dist/components/pagination/pagination.css +4 -0
- package/dist/components/pagination/pagination.js +115 -110
- package/dist/components/popconfirm/popconfirm.js +109 -107
- package/dist/components/popover/popover.d.ts +2 -1
- package/dist/components/popover/popover.js +185 -176
- package/dist/components/qr-code/qr-code.js +22 -21
- package/dist/components/rate/rate.js +114 -88
- package/dist/components/scroll-area/scroll-area.js +132 -120
- package/dist/components/segmented/segmented.js +52 -29
- package/dist/components/select/mobile-select.d.ts +3 -2
- package/dist/components/select/mobile-select.js +54 -48
- 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/sonner/sonner.js +10 -10
- package/dist/components/spinner/spinner.js +1 -1
- package/dist/components/splitter/splitter.css +4 -0
- package/dist/components/splitter/splitter.js +29 -24
- package/dist/components/statistic/statistic.d.ts +2 -0
- package/dist/components/statistic/statistic.js +203 -187
- package/dist/components/table/table-filter.js +61 -52
- package/dist/components/table/table-icons.js +3 -1
- package/dist/components/table/table.css +29 -11
- package/dist/components/table/table.d.ts +1 -1
- package/dist/components/table/table.js +384 -547
- package/dist/components/tabs/tabs.js +3 -2
- package/dist/components/tag/tag.js +22 -19
- package/dist/components/time-picker/time-picker.d.ts +0 -1
- package/dist/components/time-picker/time-picker.js +160 -103
- package/dist/components/tooltip/tooltip.d.ts +2 -1
- package/dist/components/tooltip/tooltip.js +82 -71
- package/dist/components/transfer/transfer-list.js +224 -488
- package/dist/components/transfer/transfer-parts.js +14 -4
- package/dist/components/transfer/transfer-types.d.ts +1 -0
- package/dist/components/transfer/transfer.js +23 -20
- 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/components/upload/upload.js +30 -26
- package/dist/docs/component-docs.d.ts +13 -2
- package/dist/docs/components/headless-input-number.doc.d.ts +5 -0
- package/dist/docs/components/headless-input-number.doc.js +7 -0
- package/dist/docs/components/input-number.doc.d.ts +5 -0
- package/dist/docs/components/input-number.doc.js +7 -0
- package/dist/docs/components/statistic.doc.d.ts +5 -0
- package/dist/docs/components/statistic.doc.js +7 -0
- package/dist/docs/components/tao-provider.doc.d.ts +8 -2
- package/dist/docs/components/tao-provider.doc.js +16 -3
- package/dist/docs/components/tooltip.doc.d.ts +2 -2
- package/dist/entries/provider.d.ts +2 -1
- package/dist/entries/provider.js +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/dist/locales/ar-EG.d.ts +3 -0
- package/dist/locales/ar-EG.js +199 -0
- package/dist/locales/create-locale.d.ts +41 -0
- package/dist/locales/create-locale.js +88 -0
- package/dist/locales/de-DE.d.ts +3 -0
- package/dist/locales/de-DE.js +195 -0
- package/dist/locales/en-US.d.ts +2 -0
- package/dist/locales/en-US.js +194 -0
- package/dist/locales/es-ES.d.ts +3 -0
- package/dist/locales/es-ES.js +195 -0
- package/dist/locales/fr-FR.d.ts +3 -0
- package/dist/locales/fr-FR.js +195 -0
- package/dist/locales/hi-IN.d.ts +3 -0
- package/dist/locales/hi-IN.js +194 -0
- package/dist/locales/id-ID.d.ts +3 -0
- package/dist/locales/id-ID.js +194 -0
- package/dist/locales/index.d.ts +18 -0
- package/dist/locales/index.js +17 -0
- package/dist/locales/it-IT.d.ts +3 -0
- package/dist/locales/it-IT.js +195 -0
- package/dist/locales/ja-JP.d.ts +3 -0
- package/dist/locales/ja-JP.js +194 -0
- package/dist/locales/ko-KR.d.ts +3 -0
- package/dist/locales/ko-KR.js +194 -0
- package/dist/locales/pt-BR.d.ts +3 -0
- package/dist/locales/pt-BR.js +195 -0
- package/dist/locales/ru-RU.d.ts +3 -0
- package/dist/locales/ru-RU.js +197 -0
- package/dist/locales/th-TH.d.ts +3 -0
- package/dist/locales/th-TH.js +194 -0
- package/dist/locales/tr-TR.d.ts +3 -0
- package/dist/locales/tr-TR.js +194 -0
- package/dist/locales/types.d.ts +176 -0
- package/dist/locales/types.js +0 -0
- package/dist/locales/vi-VN.d.ts +3 -0
- package/dist/locales/vi-VN.js +194 -0
- package/dist/locales/zh-CN.d.ts +3 -0
- package/dist/locales/zh-CN.js +194 -0
- package/dist/locales/zh-TW.d.ts +3 -0
- package/dist/locales/zh-TW.js +194 -0
- package/dist/number-input/format.d.ts +4 -3
- package/dist/number-input/format.js +9 -7
- package/dist/number-input/locale.d.ts +19 -0
- package/dist/number-input/locale.js +44 -0
- package/dist/number-input/number-input.js +1 -0
- package/dist/number-input/use-number-input.d.ts +2 -0
- package/dist/number-input/use-number-input.js +180 -176
- package/dist/provider/locale.d.ts +3 -65
- package/dist/provider/locale.js +2 -146
- package/dist/provider/merge-locale.d.ts +8 -0
- package/dist/provider/merge-locale.js +53 -0
- package/dist/provider/tao-provider.d.ts +16 -5
- package/dist/provider/tao-provider.js +200 -92
- 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 +5 -1
|
@@ -38,7 +38,7 @@ function TransferSearch(t0) {
|
|
|
38
38
|
"data-tao-transfer-clear": "",
|
|
39
39
|
type: "button",
|
|
40
40
|
disabled: disabled,
|
|
41
|
-
"aria-label": locale.
|
|
41
|
+
"aria-label": locale.messages.clearSearch,
|
|
42
42
|
onClick: handleClear,
|
|
43
43
|
children: "\xd7"
|
|
44
44
|
}) : void 0;
|
|
@@ -94,15 +94,25 @@ function TransferOperation(t0) {
|
|
|
94
94
|
}
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
|
-
const label =
|
|
97
|
+
const label = right ? locale.messages.moveToTarget : locale.messages.moveToSource;
|
|
98
98
|
return /*#__PURE__*/ jsx(Button, {
|
|
99
99
|
size: "small",
|
|
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";
|
|
@@ -9,25 +10,22 @@ function TransferRoot(props, ref) {
|
|
|
9
10
|
const { prefixCls = 'tao-transfer', rootClassName, className, classNames, style, styles, listStyle, operationStyle, disabled, dataSource = [], targetKeys = [], selectedKeys, render, onChange, onSelectChange, titles, operations, actions, showSearch, filterOption, locale, footer, rowKey, onSearch, onScroll, children, showSelectAll = true, selectAllLabels = [], oneWay, pagination, status, selectionsIcon, ...rest } = props;
|
|
10
11
|
const config = useTaoConfig();
|
|
11
12
|
const resolvedDisabled = disabled ?? config.disabled;
|
|
12
|
-
const chinese = config.locale.locale?.startsWith('zh');
|
|
13
13
|
const text = {
|
|
14
|
-
titles:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
] : [
|
|
18
|
-
'Source',
|
|
19
|
-
'Target'
|
|
14
|
+
titles: [
|
|
15
|
+
config.locale.messages.source,
|
|
16
|
+
config.locale.messages.target
|
|
20
17
|
],
|
|
21
18
|
searchPlaceholder: config.locale.searchPlaceholder,
|
|
22
|
-
itemUnit:
|
|
23
|
-
itemsUnit:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
19
|
+
itemUnit: config.locale.messages.itemUnit,
|
|
20
|
+
itemsUnit: config.locale.messages.itemsUnit,
|
|
21
|
+
itemCount: locale?.itemUnit !== void 0 || locale?.itemsUnit !== void 0 ? void 0 : config.locale.messages.itemCount,
|
|
22
|
+
remove: config.locale.remove('').trim(),
|
|
23
|
+
selectAll: config.locale.messages.selectAll,
|
|
24
|
+
deselectAll: config.locale.messages.deselectAll,
|
|
25
|
+
selectCurrent: config.locale.messages.selectCurrent,
|
|
26
|
+
selectInvert: config.locale.messages.invertCurrent,
|
|
27
|
+
removeAll: config.locale.messages.removeAll,
|
|
28
|
+
removeCurrent: config.locale.messages.removeCurrent,
|
|
31
29
|
...locale
|
|
32
30
|
};
|
|
33
31
|
const mergedProps = {
|
|
@@ -41,6 +39,10 @@ function TransferRoot(props, ref) {
|
|
|
41
39
|
props: mergedProps
|
|
42
40
|
}) : styles;
|
|
43
41
|
const root = useRef(null);
|
|
42
|
+
const [direction, directionRef] = useTaoDirection('auto' === rest.dir || 'rtl' === rest.dir || 'ltr' === rest.dir ? rest.dir : void 0);
|
|
43
|
+
const mergedRootRef = useMemo(()=>mergeRefs(root, directionRef), [
|
|
44
|
+
directionRef
|
|
45
|
+
]);
|
|
44
46
|
useImperativeHandle(ref, ()=>({
|
|
45
47
|
nativeElement: root.current
|
|
46
48
|
}));
|
|
@@ -166,7 +168,8 @@ function TransferRoot(props, ref) {
|
|
|
166
168
|
};
|
|
167
169
|
return /*#__PURE__*/ jsxs("div", {
|
|
168
170
|
...rest,
|
|
169
|
-
ref:
|
|
171
|
+
ref: mergedRootRef,
|
|
172
|
+
dir: 'auto' === rest.dir ? 'auto' : direction,
|
|
170
173
|
"data-tao-transfer": "",
|
|
171
174
|
"data-tao-disabled": resolvedDisabled ? '' : void 0,
|
|
172
175
|
"data-tao-status": status,
|
|
@@ -185,7 +188,7 @@ function TransferRoot(props, ref) {
|
|
|
185
188
|
rightActive: sourceSelected.some((key_8)=>!recordMap.get(key_8)?.disabled),
|
|
186
189
|
disabled: resolvedDisabled,
|
|
187
190
|
oneWay: oneWay,
|
|
188
|
-
direction:
|
|
191
|
+
direction: direction,
|
|
189
192
|
className: classes?.actions,
|
|
190
193
|
style: {
|
|
191
194
|
...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
|
});
|
|
@@ -23,29 +23,30 @@ function toFile(file) {
|
|
|
23
23
|
percent: 0
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
function readPreview(file) {
|
|
26
|
+
function readPreview(file, failureMessage) {
|
|
27
27
|
return new Promise((resolve, reject)=>{
|
|
28
28
|
const reader = new FileReader();
|
|
29
29
|
reader.onload = ()=>resolve(String(reader.result));
|
|
30
|
-
reader.onerror = ()=>reject(reader.error ?? new Error(
|
|
30
|
+
reader.onerror = ()=>reject(reader.error ?? new Error(failureMessage));
|
|
31
31
|
reader.readAsDataURL(file);
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
function FilePreview(t0) {
|
|
35
|
-
const $ = c(
|
|
35
|
+
const $ = c(13);
|
|
36
36
|
const { file, previewFile } = t0;
|
|
37
|
+
const { locale } = useTaoConfig();
|
|
37
38
|
const [preview, setPreview] = useState();
|
|
38
39
|
const [error, setError] = useState();
|
|
39
40
|
let t1;
|
|
40
41
|
let t2;
|
|
41
|
-
if ($[0] !== file.originFileObj || $[1] !== file.thumbUrl || $[2] !== file.url || $[3] !== previewFile) {
|
|
42
|
+
if ($[0] !== file.originFileObj || $[1] !== file.thumbUrl || $[2] !== file.url || $[3] !== locale.messages.previewUnavailable || $[4] !== locale.messages.readFileError || $[5] !== previewFile) {
|
|
42
43
|
t1 = ()=>{
|
|
43
44
|
if (file.thumbUrl || file.url || !file.originFileObj) return;
|
|
44
45
|
let active = true;
|
|
45
|
-
Promise.resolve(
|
|
46
|
+
Promise.resolve(previewFile ? previewFile(file.originFileObj) : readPreview(file.originFileObj, locale.messages.readFileError)).then((value)=>{
|
|
46
47
|
if (active) setPreview(value);
|
|
47
48
|
}, (reason)=>{
|
|
48
|
-
if (active) setError(reason instanceof Error ? reason.message :
|
|
49
|
+
if (active) setError(reason instanceof Error ? reason.message : locale.messages.previewUnavailable);
|
|
49
50
|
});
|
|
50
51
|
return ()=>{
|
|
51
52
|
active = false;
|
|
@@ -55,22 +56,26 @@ function FilePreview(t0) {
|
|
|
55
56
|
file.originFileObj,
|
|
56
57
|
file.thumbUrl,
|
|
57
58
|
file.url,
|
|
58
|
-
previewFile
|
|
59
|
+
previewFile,
|
|
60
|
+
locale.messages.readFileError,
|
|
61
|
+
locale.messages.previewUnavailable
|
|
59
62
|
];
|
|
60
63
|
$[0] = file.originFileObj;
|
|
61
64
|
$[1] = file.thumbUrl;
|
|
62
65
|
$[2] = file.url;
|
|
63
|
-
$[3] =
|
|
64
|
-
$[4] =
|
|
65
|
-
$[5] =
|
|
66
|
+
$[3] = locale.messages.previewUnavailable;
|
|
67
|
+
$[4] = locale.messages.readFileError;
|
|
68
|
+
$[5] = previewFile;
|
|
69
|
+
$[6] = t1;
|
|
70
|
+
$[7] = t2;
|
|
66
71
|
} else {
|
|
67
|
-
t1 = $[
|
|
68
|
-
t2 = $[
|
|
72
|
+
t1 = $[6];
|
|
73
|
+
t2 = $[7];
|
|
69
74
|
}
|
|
70
75
|
useEffect(t1, t2);
|
|
71
76
|
const src = file.thumbUrl ?? file.url ?? preview;
|
|
72
77
|
let t3;
|
|
73
|
-
if ($[
|
|
78
|
+
if ($[8] !== error || $[9] !== file.crossOrigin || $[10] !== file.name || $[11] !== src) {
|
|
74
79
|
t3 = error ? /*#__PURE__*/ jsx("span", {
|
|
75
80
|
role: "status",
|
|
76
81
|
children: error
|
|
@@ -82,12 +87,12 @@ function FilePreview(t0) {
|
|
|
82
87
|
"aria-hidden": "true",
|
|
83
88
|
children: "▧"
|
|
84
89
|
});
|
|
85
|
-
$[
|
|
86
|
-
$[
|
|
87
|
-
$[
|
|
88
|
-
$[
|
|
89
|
-
$[
|
|
90
|
-
} else t3 = $[
|
|
90
|
+
$[8] = error;
|
|
91
|
+
$[9] = file.crossOrigin;
|
|
92
|
+
$[10] = file.name;
|
|
93
|
+
$[11] = src;
|
|
94
|
+
$[12] = t3;
|
|
95
|
+
} else t3 = $[12];
|
|
91
96
|
return t3;
|
|
92
97
|
}
|
|
93
98
|
function FileIcon(t0) {
|
|
@@ -144,12 +149,11 @@ const UploadRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
144
149
|
disabled
|
|
145
150
|
}
|
|
146
151
|
}) : props.styles;
|
|
147
|
-
const chinese = 'zh_CN' === config.locale.locale;
|
|
148
152
|
const locale = {
|
|
149
|
-
removeFile:
|
|
150
|
-
previewFile:
|
|
151
|
-
downloadFile:
|
|
152
|
-
uploadError:
|
|
153
|
+
removeFile: config.locale.messages.removeFile,
|
|
154
|
+
previewFile: config.locale.messages.previewFile,
|
|
155
|
+
downloadFile: config.locale.messages.downloadFile,
|
|
156
|
+
uploadError: config.locale.messages.uploadError,
|
|
153
157
|
...props.locale
|
|
154
158
|
};
|
|
155
159
|
const current = ()=>propsRef.current.fileList ?? filesRef.current;
|
|
@@ -232,7 +236,7 @@ const UploadRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
232
236
|
}, items_0.filter((item_5)=>item_5.uid !== file_6.uid));
|
|
233
237
|
setRemoveError(void 0);
|
|
234
238
|
} catch (error_0) {
|
|
235
|
-
setRemoveError(error_0 instanceof Error ? error_0.message :
|
|
239
|
+
setRemoveError(error_0 instanceof Error ? error_0.message : config.locale.messages.removeFileError);
|
|
236
240
|
}
|
|
237
241
|
};
|
|
238
242
|
const download = (file_7)=>{
|
|
@@ -303,7 +307,7 @@ const UploadRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
303
307
|
setDragging(false);
|
|
304
308
|
props.onDrop?.(event_3);
|
|
305
309
|
},
|
|
306
|
-
children: props.children ?? ('drag' === type ?
|
|
310
|
+
children: props.children ?? ('drag' === type ? config.locale.messages.uploadDrop : config.locale.messages.uploadFile)
|
|
307
311
|
})
|
|
308
312
|
}),
|
|
309
313
|
false !== props.showUploadList && /*#__PURE__*/ jsx("span", {
|
|
@@ -98,6 +98,11 @@ export declare const componentDocs: ({
|
|
|
98
98
|
tests: string[];
|
|
99
99
|
keywords: string[];
|
|
100
100
|
related: string[];
|
|
101
|
+
props: {
|
|
102
|
+
name: string;
|
|
103
|
+
type: string;
|
|
104
|
+
description: string;
|
|
105
|
+
}[];
|
|
101
106
|
usage: {
|
|
102
107
|
description: string;
|
|
103
108
|
bestPractices: string[];
|
|
@@ -131,11 +136,17 @@ export declare const componentDocs: ({
|
|
|
131
136
|
bestPractices: string[];
|
|
132
137
|
avoid: string[];
|
|
133
138
|
};
|
|
134
|
-
props: {
|
|
139
|
+
props: ({
|
|
135
140
|
name: string;
|
|
136
141
|
type: string;
|
|
142
|
+
defaultValue: string;
|
|
137
143
|
description: string;
|
|
138
|
-
}
|
|
144
|
+
} | {
|
|
145
|
+
defaultValue?: undefined;
|
|
146
|
+
name: string;
|
|
147
|
+
type: string;
|
|
148
|
+
description: string;
|
|
149
|
+
})[];
|
|
139
150
|
} | {
|
|
140
151
|
name: string;
|
|
141
152
|
displayName: string;
|
|
@@ -25,6 +25,13 @@ const headlessInputNumberDoc = {
|
|
|
25
25
|
related: [
|
|
26
26
|
'InputNumber'
|
|
27
27
|
],
|
|
28
|
+
props: [
|
|
29
|
+
{
|
|
30
|
+
name: 'locale',
|
|
31
|
+
type: 'string',
|
|
32
|
+
description: 'BCP 47 numeric locale, also accepted by useNumberInput. Inherits TaoProvider numberLocale; explicit separators win. Canonical values and callbacks remain exact ASCII strings.'
|
|
33
|
+
}
|
|
34
|
+
],
|
|
28
35
|
usage: {
|
|
29
36
|
description: 'Use the headless API when tao-ui styling is not appropriate but number formatting behavior should stay consistent.',
|
|
30
37
|
bestPractices: [
|
|
@@ -10,6 +10,11 @@ export declare const inputNumberDoc: {
|
|
|
10
10
|
semanticParts: string[];
|
|
11
11
|
keywords: string[];
|
|
12
12
|
related: string[];
|
|
13
|
+
props: {
|
|
14
|
+
name: string;
|
|
15
|
+
type: string;
|
|
16
|
+
description: string;
|
|
17
|
+
}[];
|
|
13
18
|
usage: {
|
|
14
19
|
description: string;
|
|
15
20
|
bestPractices: string[];
|
|
@@ -26,6 +26,13 @@ const inputNumberDoc = {
|
|
|
26
26
|
'HeadlessInputNumber',
|
|
27
27
|
'Input'
|
|
28
28
|
],
|
|
29
|
+
props: [
|
|
30
|
+
{
|
|
31
|
+
name: 'locale',
|
|
32
|
+
type: 'string',
|
|
33
|
+
description: 'BCP 47 numeric locale. Inherits TaoProvider numberLocale; explicit decimalSeparator/thousandsSeparator override regional symbols. Callbacks keep exact canonical ASCII strings.'
|
|
34
|
+
}
|
|
35
|
+
],
|
|
29
36
|
usage: {
|
|
30
37
|
description: 'Use InputNumber for numeric values that need min, max, step, precision, or formatted display.',
|
|
31
38
|
bestPractices: [
|
|
@@ -11,6 +11,13 @@ const statisticDoc = {
|
|
|
11
11
|
tests: [
|
|
12
12
|
'tests/statistic/statistic.test.tsx'
|
|
13
13
|
],
|
|
14
|
+
props: [
|
|
15
|
+
{
|
|
16
|
+
name: 'locale',
|
|
17
|
+
type: 'string',
|
|
18
|
+
description: 'BCP 47 numeric locale. Inherits TaoProvider numberLocale. Explicit separators and formatter take precedence; string precision and truncation semantics are preserved.'
|
|
19
|
+
}
|
|
20
|
+
],
|
|
14
21
|
semanticParts: [
|
|
15
22
|
'root',
|
|
16
23
|
'header',
|
|
@@ -14,9 +14,15 @@ export declare const taoProviderDoc: {
|
|
|
14
14
|
bestPractices: string[];
|
|
15
15
|
avoid: string[];
|
|
16
16
|
};
|
|
17
|
-
props: {
|
|
17
|
+
props: ({
|
|
18
18
|
name: string;
|
|
19
19
|
type: string;
|
|
20
|
+
defaultValue: string;
|
|
20
21
|
description: string;
|
|
21
|
-
}
|
|
22
|
+
} | {
|
|
23
|
+
defaultValue?: undefined;
|
|
24
|
+
name: string;
|
|
25
|
+
type: string;
|
|
26
|
+
description: string;
|
|
27
|
+
})[];
|
|
22
28
|
};
|