one-design-next 0.0.105 → 0.0.107
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/_util/useLayoutEffect.d.ts +1 -1
- package/dist/_util/useLayoutEffect.js +1 -1
- package/dist/approval/index.d.ts +1 -1
- package/dist/approval/index.js +1 -1
- package/dist/avatar/primitive.d.ts +1 -1
- package/dist/avatar/primitive.js +1 -1
- package/dist/button/index.d.ts +1 -1
- package/dist/button/index.js +1 -1
- package/dist/card/header.d.ts +1 -1
- package/dist/card/header.js +5 -5
- package/dist/card/index.d.ts +1 -1
- package/dist/card/index.js +1 -1
- package/dist/cascader/Panel.d.ts +17 -1
- package/dist/cascader/Panel.js +36 -5
- package/dist/cascader/fork/Cascader.js +1 -1
- package/dist/cascader/fork/OptionList/Checkbox.d.ts +1 -1
- package/dist/cascader/fork/OptionList/Checkbox.js +1 -1
- package/dist/cascader/fork/OptionList/Column.d.ts +1 -1
- package/dist/cascader/fork/OptionList/Column.js +1 -1
- package/dist/cascader/fork/OptionList/List.js +1 -1
- package/dist/cascader/fork/OptionList/index.js +1 -1
- package/dist/cascader/fork/OptionList/useActive.js +1 -1
- package/dist/cascader/fork/Panel.js +19 -7
- package/dist/cascader/fork/hooks/useValues.js +2 -2
- package/dist/cascader/index.d.ts +1 -0
- package/dist/cascader/index.js +4 -21
- package/dist/cascader/search.d.ts +17 -0
- package/dist/cascader/search.js +54 -0
- package/dist/cascader/style/index.css +9 -1
- package/dist/chart/bar.d.ts +1 -1
- package/dist/chart/bar.js +1 -1
- package/dist/chart/bullet.d.ts +1 -1
- package/dist/chart/bullet.js +1 -1
- package/dist/chart/butterfly.d.ts +1 -1
- package/dist/chart/butterfly.js +1 -1
- package/dist/chart/dual-line.d.ts +1 -1
- package/dist/chart/dual-line.js +1 -1
- package/dist/chart/host.d.ts +1 -1
- package/dist/chart/host.js +1 -1
- package/dist/chart/line.d.ts +1 -1
- package/dist/chart/line.js +1 -1
- package/dist/chart/pie.d.ts +1 -1
- package/dist/chart/pie.js +1 -1
- package/dist/chart/quadrant.d.ts +1 -1
- package/dist/chart/quadrant.js +1 -1
- package/dist/chart/radar.d.ts +1 -1
- package/dist/chart/radar.js +1 -1
- package/dist/chart/ripple.d.ts +1 -1
- package/dist/chart/ripple.js +1 -1
- package/dist/chart/sankey.d.ts +1 -1
- package/dist/chart/sankey.js +1 -1
- package/dist/chart/symmetric.d.ts +1 -1
- package/dist/chart/symmetric.js +1 -1
- package/dist/chart/treemap.d.ts +1 -1
- package/dist/chart/treemap.js +1 -1
- package/dist/chart/word-cloud.d.ts +1 -1
- package/dist/chart/word-cloud.js +1 -1
- package/dist/checkbox/Context.d.ts +1 -1
- package/dist/checkbox/Context.js +1 -1
- package/dist/clarify-dock/index.d.ts +1 -1
- package/dist/clarify-dock/index.js +1 -2
- package/dist/collapse/primitive.d.ts +1 -1
- package/dist/collapse/primitive.js +1 -1
- package/dist/config-provider/index.d.ts +1 -1
- package/dist/config-provider/index.js +1 -1
- package/dist/dropdown/index.d.ts +1 -1
- package/dist/dropdown/index.js +1 -2
- package/dist/empty/index.d.ts +2 -2
- package/dist/empty/index.js +153 -27
- package/dist/form/index.d.ts +1 -1
- package/dist/form/index.js +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/link/index.d.ts +1 -1
- package/dist/link/index.js +1 -1
- package/dist/loading/index.d.ts +1 -1
- package/dist/loading/index.js +1 -1
- package/dist/pop-base/mergeProps.d.ts +1 -1
- package/dist/pop-base/mergeProps.js +2 -0
- package/dist/pop-base/useForkRef.d.ts +1 -1
- package/dist/pop-base/useForkRef.js +4 -4
- package/dist/radio/primitive.d.ts +2 -2
- package/dist/radio/primitive.js +2 -2
- package/dist/scroll-area/index.d.ts +1 -1
- package/dist/scroll-area/index.js +1 -1
- package/dist/select/useIcons.d.ts +5 -6
- package/dist/select/useIcons.js +3 -4
- package/dist/skill-card/index.d.ts +1 -1
- package/dist/skill-card/index.js +1 -1
- package/dist/switch/index.d.ts +1 -1
- package/dist/switch/index.js +2 -2
- package/dist/virtual-list/index.d.ts +1 -1
- package/dist/virtual-list/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
declare const useLayoutEffect: (callback: (mount: boolean) => void | VoidFunction, deps?: React.DependencyList) => void;
|
|
3
3
|
export declare const useLayoutUpdateEffect: typeof React.useEffect;
|
|
4
4
|
export default useLayoutEffect;
|
package/dist/approval/index.d.ts
CHANGED
package/dist/approval/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Avatar as AvatarPrimitive } from '@base-ui/react/avatar';
|
|
2
|
-
import
|
|
2
|
+
import React from 'react';
|
|
3
3
|
declare const AvatarRoot: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/avatar").AvatarRootProps, "ref"> & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
4
4
|
declare function AvatarImage(props: React.ComponentProps<typeof AvatarPrimitive.Image>): React.JSX.Element;
|
|
5
5
|
declare function AvatarFallback(props: React.ComponentProps<typeof AvatarPrimitive.Fallback>): React.JSX.Element;
|
package/dist/avatar/primitive.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import { Avatar as AvatarPrimitive } from '@base-ui/react/avatar';
|
|
5
|
-
import
|
|
5
|
+
import React from 'react';
|
|
6
6
|
var AvatarRoot = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
7
7
|
return /*#__PURE__*/React.createElement(AvatarPrimitive.Root, _extends({
|
|
8
8
|
ref: ref,
|
package/dist/button/index.d.ts
CHANGED
package/dist/button/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["className", "size", "intent", "light", "asChild", "disabled", "loading", "icon", "rightIcon", "children"];
|
|
4
4
|
import { Slot, Slottable } from '@radix-ui/react-slot';
|
|
5
|
-
import
|
|
5
|
+
import React from 'react';
|
|
6
6
|
import HoverFill from "../hover-fill";
|
|
7
7
|
import Icon from "../icon";
|
|
8
8
|
import "./style";
|
package/dist/card/header.d.ts
CHANGED
package/dist/card/header.js
CHANGED
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["className", "title", "subTitle", "topContent", "children", "size"];
|
|
4
4
|
import clsx from 'clsx';
|
|
5
|
-
import
|
|
5
|
+
import React from 'react';
|
|
6
6
|
var CardHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
7
7
|
var className = _ref.className,
|
|
8
8
|
title = _ref.title,
|
|
@@ -12,7 +12,7 @@ var CardHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
12
12
|
_ref$size = _ref.size,
|
|
13
13
|
size = _ref$size === void 0 ? 'small' : _ref$size,
|
|
14
14
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
15
|
-
var showTitleRow = title
|
|
15
|
+
var showTitleRow = title !== undefined && title !== null && title !== '';
|
|
16
16
|
return /*#__PURE__*/React.createElement("div", _extends({
|
|
17
17
|
ref: ref,
|
|
18
18
|
"data-odn-card-header": true,
|
|
@@ -24,11 +24,11 @@ var CardHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
24
24
|
"data-odn-card-header-top": true
|
|
25
25
|
}, /*#__PURE__*/React.createElement("div", {
|
|
26
26
|
"data-odn-card-title": true
|
|
27
|
-
}, title), subTitle
|
|
27
|
+
}, title), subTitle !== undefined && subTitle !== null && subTitle !== '' && /*#__PURE__*/React.createElement("div", {
|
|
28
28
|
"data-odn-card-subtitle": true
|
|
29
|
-
}, subTitle)), topContent
|
|
29
|
+
}, subTitle)), topContent !== undefined && topContent !== null && topContent !== '' && /*#__PURE__*/React.createElement("div", {
|
|
30
30
|
"data-odn-card-top-content": true
|
|
31
|
-
}, topContent)), children
|
|
31
|
+
}, topContent)), children !== undefined && children !== null && children !== '' && /*#__PURE__*/React.createElement("div", {
|
|
32
32
|
"data-odn-card-header-children": true
|
|
33
33
|
}, children));
|
|
34
34
|
});
|
package/dist/card/index.d.ts
CHANGED
package/dist/card/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["className", "elevation", "interactive", "children"];
|
|
4
4
|
import clsx from 'clsx';
|
|
5
|
-
import
|
|
5
|
+
import React from 'react';
|
|
6
6
|
import CardHeader from "./header";
|
|
7
7
|
import "./style";
|
|
8
8
|
/**
|
package/dist/cascader/Panel.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DefaultOptionType } from 'rc-cascader';
|
|
1
|
+
import type { DefaultOptionType, ShowSearchType } from 'rc-cascader';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { SHOW_CHILD, SHOW_PARENT } from './fork';
|
|
4
4
|
import { type FieldNames } from './utils';
|
|
@@ -41,6 +41,22 @@ export interface BaseCascaderPanelProps {
|
|
|
41
41
|
optionPopoverProps?: Record<string, unknown>;
|
|
42
42
|
/** 跨层级选择(见 Cascader.crossLevelSelect) */
|
|
43
43
|
crossLevelSelect?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* 搜索关键词。传入后默认启用路径扁平搜索(与 Cascader 搜索一致)。
|
|
46
|
+
* Panel 本身不渲染输入框,由外部 Input 受控传入。
|
|
47
|
+
*/
|
|
48
|
+
searchValue?: string;
|
|
49
|
+
/**
|
|
50
|
+
* 搜索回调(受控文档完整性)。Panel 不内建输入时通常由外部 Input onChange 驱动 searchValue。
|
|
51
|
+
*/
|
|
52
|
+
onSearch?: (value: string) => void;
|
|
53
|
+
/**
|
|
54
|
+
* 是否启用搜索 / 搜索配置。
|
|
55
|
+
* 默认:传入 searchValue 时自动启用(含默认 filter + 高亮 render)。
|
|
56
|
+
*/
|
|
57
|
+
showSearch?: boolean | ShowSearchType;
|
|
58
|
+
/** 搜索路径分隔符,默认 `/` */
|
|
59
|
+
separator?: string;
|
|
44
60
|
}
|
|
45
61
|
export type CascaderPanelProps<V = (string | number)[] | null> = BaseCascaderPanelProps & {
|
|
46
62
|
mode?: 'single' | 'multiple';
|
package/dist/cascader/Panel.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
2
3
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["value", "defaultValue", "onChange", "mode", "checkable", "prefixCls", "expandIcon", "loadingIcon", "options", "style", "autoMaxWidth", "fieldNames", "optionPopoverProps", "crossLevelSelect", "changeOnSelect"];
|
|
5
|
+
var _excluded = ["value", "defaultValue", "onChange", "mode", "checkable", "prefixCls", "expandIcon", "loadingIcon", "options", "style", "autoMaxWidth", "fieldNames", "optionPopoverProps", "crossLevelSelect", "changeOnSelect", "searchValue", "onSearch", "showSearch", "separator"];
|
|
5
6
|
import React from 'react';
|
|
6
7
|
import Icon from "../icon";
|
|
7
8
|
import RcCascader from "./fork";
|
|
9
|
+
import { getDefaultCascaderShowSearch } from "./search";
|
|
8
10
|
import { calculateOptionsDepth, DEFAULT_FIELD_NAMES, generateCommonStyle, processOptions } from "./utils";
|
|
9
11
|
function CascaderPanel(_ref) {
|
|
10
12
|
var value = _ref.value,
|
|
@@ -29,6 +31,11 @@ function CascaderPanel(_ref) {
|
|
|
29
31
|
_ref$crossLevelSelect = _ref.crossLevelSelect,
|
|
30
32
|
crossLevelSelect = _ref$crossLevelSelect === void 0 ? false : _ref$crossLevelSelect,
|
|
31
33
|
changeOnSelect = _ref.changeOnSelect,
|
|
34
|
+
searchValue = _ref.searchValue,
|
|
35
|
+
_onSearch = _ref.onSearch,
|
|
36
|
+
showSearch = _ref.showSearch,
|
|
37
|
+
_ref$separator = _ref.separator,
|
|
38
|
+
separator = _ref$separator === void 0 ? '/' : _ref$separator,
|
|
32
39
|
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
33
40
|
// 默认 fieldNames.label 为 labelWithPopover,与 Cascader 一致
|
|
34
41
|
var mergedFieldNames = React.useMemo(function () {
|
|
@@ -45,8 +52,8 @@ function CascaderPanel(_ref) {
|
|
|
45
52
|
return calculateOptionsDepth(processedOptions, mergedFieldNames);
|
|
46
53
|
}, [processedOptions, mergedFieldNames]);
|
|
47
54
|
|
|
48
|
-
// 根据 mode 自动设置 checkable
|
|
49
|
-
|
|
55
|
+
// 根据 mode 自动设置 checkable(保留既有语义;实际 checkable 由下方渲染分支决定)
|
|
56
|
+
void (checkable !== undefined ? checkable : mode === 'multiple');
|
|
50
57
|
var handleChange = function handleChange(rcValue, selectOptions) {
|
|
51
58
|
// 如果 value 是 undefined,传递 null
|
|
52
59
|
if (rcValue === undefined) {
|
|
@@ -90,11 +97,32 @@ function CascaderPanel(_ref) {
|
|
|
90
97
|
|
|
91
98
|
// 转换 value 类型以兼容 rc-cascader
|
|
92
99
|
var rcValue = value === null ? undefined : value;
|
|
93
|
-
var rcDefaultValue = defaultValue === null ? undefined :
|
|
100
|
+
var rcDefaultValue = defaultValue === null ? undefined : defaultValue;
|
|
94
101
|
|
|
95
102
|
// 生成公共样式
|
|
96
103
|
var commonStyle = generateCommonStyle(depth, autoMaxWidth, style);
|
|
97
104
|
|
|
105
|
+
// 搜索:传入 searchValue 时默认启用;true 时补齐默认 filter/render
|
|
106
|
+
var mergedShowSearch = React.useMemo(function () {
|
|
107
|
+
var defaults = getDefaultCascaderShowSearch(separator);
|
|
108
|
+
if (showSearch === false) {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
if (showSearch === true) {
|
|
112
|
+
return defaults;
|
|
113
|
+
}
|
|
114
|
+
if (showSearch && _typeof(showSearch) === 'object') {
|
|
115
|
+
return _objectSpread(_objectSpread({}, defaults), showSearch);
|
|
116
|
+
}
|
|
117
|
+
if (searchValue !== undefined) {
|
|
118
|
+
return defaults;
|
|
119
|
+
}
|
|
120
|
+
return false;
|
|
121
|
+
}, [showSearch, searchValue, separator]);
|
|
122
|
+
|
|
123
|
+
// onSearch 仅文档完整性;Panel 不内建输入
|
|
124
|
+
void _onSearch;
|
|
125
|
+
|
|
98
126
|
// 提取共同的 props
|
|
99
127
|
var commonProps = _objectSpread(_objectSpread({
|
|
100
128
|
prefixCls: prefixCls,
|
|
@@ -105,7 +133,10 @@ function CascaderPanel(_ref) {
|
|
|
105
133
|
style: commonStyle,
|
|
106
134
|
fieldNames: mergedFieldNames,
|
|
107
135
|
changeOnSelect: !!changeOnSelect || crossLevelSelect,
|
|
108
|
-
checkStrictly: crossLevelSelect
|
|
136
|
+
checkStrictly: crossLevelSelect,
|
|
137
|
+
searchValue: searchValue,
|
|
138
|
+
showSearch: mergedShowSearch,
|
|
139
|
+
dropdownPrefixCls: prefixCls
|
|
109
140
|
}, restProps), {}, {
|
|
110
141
|
className: [restProps.className, crossLevelSelect && 'odn-cascader-panel-cross-level'].filter(Boolean).join(' ')
|
|
111
142
|
});
|
|
@@ -16,7 +16,7 @@ import { BaseSelect } from 'rc-select';
|
|
|
16
16
|
import useId from 'rc-select/es/hooks/useId';
|
|
17
17
|
import useEvent from 'rc-util/es/hooks/useEvent';
|
|
18
18
|
import useMergedState from 'rc-util/es/hooks/useMergedState';
|
|
19
|
-
import
|
|
19
|
+
import React from 'react';
|
|
20
20
|
import useSelect from "./hooks/useSelect";
|
|
21
21
|
import useValues from "./hooks/useValues";
|
|
22
22
|
import OptionList from "./OptionList";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import CascaderContext from 'rc-cascader/es/context';
|
|
4
|
-
import
|
|
4
|
+
import React from 'react';
|
|
5
5
|
export default function Checkbox(_ref) {
|
|
6
6
|
var prefixCls = _ref.prefixCls,
|
|
7
7
|
checked = _ref.checked,
|
|
@@ -4,7 +4,7 @@ import clsx from 'clsx';
|
|
|
4
4
|
import CascaderContext from 'rc-cascader/es/context';
|
|
5
5
|
import { SEARCH_MARK } from 'rc-cascader/es/hooks/useSearchOptions';
|
|
6
6
|
import { isLeaf, toPathKey } from 'rc-cascader/es/utils/commonUtil';
|
|
7
|
-
import
|
|
7
|
+
import React from 'react';
|
|
8
8
|
import Checkbox from "./Checkbox";
|
|
9
9
|
export var FIX_LABEL = '__cascader_fix_label__';
|
|
10
10
|
export default function Column(_ref) {
|
|
@@ -10,7 +10,7 @@ import CacheContent from 'rc-cascader/es/OptionList/CacheContent';
|
|
|
10
10
|
import useKeyboard from 'rc-cascader/es/OptionList/useKeyboard';
|
|
11
11
|
import { getFullPathKeys, isLeaf, scrollIntoParentView, toPathKey, toPathKeys, toPathValueStr } from 'rc-cascader/es/utils/commonUtil';
|
|
12
12
|
import { toPathOptions } from 'rc-cascader/es/utils/treeUtil';
|
|
13
|
-
import
|
|
13
|
+
import React from 'react';
|
|
14
14
|
import Column, { FIX_LABEL } from "./Column";
|
|
15
15
|
import useActive from "./useActive";
|
|
16
16
|
var RawOptionList = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from '@babel/runtime/helpers/esm/extends';
|
|
2
2
|
import { useBaseProps } from 'rc-select';
|
|
3
|
-
import
|
|
3
|
+
import React from 'react';
|
|
4
4
|
import RawOptionList from "./List";
|
|
5
5
|
var RefOptionList = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
6
6
|
var baseProps = useBaseProps();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
2
|
import CascaderContext from 'rc-cascader/es/context';
|
|
3
|
-
import
|
|
3
|
+
import React from 'react';
|
|
4
4
|
var getStrictActivePath = function getStrictActivePath(path) {
|
|
5
5
|
if (!(path !== null && path !== void 0 && path.length)) {
|
|
6
6
|
return [];
|
|
@@ -4,10 +4,12 @@ import classNames from 'classnames';
|
|
|
4
4
|
import CascaderContext from 'rc-cascader/es/context';
|
|
5
5
|
import useMissingValues from 'rc-cascader/es/hooks/useMissingValues';
|
|
6
6
|
import useOptions from 'rc-cascader/es/hooks/useOptions';
|
|
7
|
+
import useSearchConfig from 'rc-cascader/es/hooks/useSearchConfig';
|
|
8
|
+
import useSearchOptions from 'rc-cascader/es/hooks/useSearchOptions';
|
|
7
9
|
import { fillFieldNames, toRawValues } from 'rc-cascader/es/utils/commonUtil';
|
|
8
10
|
import { toPathOptions } from 'rc-cascader/es/utils/treeUtil';
|
|
9
11
|
import { useEvent, useMergedState } from 'rc-util';
|
|
10
|
-
import
|
|
12
|
+
import React from 'react';
|
|
11
13
|
import useSelect from "./hooks/useSelect";
|
|
12
14
|
import useValues from "./hooks/useValues";
|
|
13
15
|
import RawOptionList from "./OptionList/List";
|
|
@@ -36,7 +38,10 @@ export default function Panel(props) {
|
|
|
36
38
|
_ref$notFoundContent = _ref.notFoundContent,
|
|
37
39
|
notFoundContent = _ref$notFoundContent === void 0 ? 'Not Found' : _ref$notFoundContent,
|
|
38
40
|
disabled = _ref.disabled,
|
|
39
|
-
checkStrictly = _ref.checkStrictly
|
|
41
|
+
checkStrictly = _ref.checkStrictly,
|
|
42
|
+
searchValue = _ref.searchValue,
|
|
43
|
+
showSearch = _ref.showSearch,
|
|
44
|
+
dropdownPrefixCls = _ref.dropdownPrefixCls;
|
|
40
45
|
|
|
41
46
|
// ======================== Multiple ========================
|
|
42
47
|
var multiple = !!checkable;
|
|
@@ -64,6 +69,13 @@ export default function Panel(props) {
|
|
|
64
69
|
getPathKeyEntities = _useOptions2[1],
|
|
65
70
|
getValueByKeyPath = _useOptions2[2];
|
|
66
71
|
|
|
72
|
+
// =========================== Search ===========================
|
|
73
|
+
var mergedSearchValue = searchValue || '';
|
|
74
|
+
var _useSearchConfig = useSearchConfig(showSearch),
|
|
75
|
+
_useSearchConfig2 = _slicedToArray(_useSearchConfig, 2),
|
|
76
|
+
searchConfig = _useSearchConfig2[1];
|
|
77
|
+
var searchOptions = useSearchOptions(mergedSearchValue, mergedOptions, mergedFieldNames, dropdownPrefixCls || prefixCls, searchConfig, mergedChangeOnSelect || multiple);
|
|
78
|
+
|
|
67
79
|
// ========================= Values =========================
|
|
68
80
|
var getMissingValues = useMissingValues(mergedOptions, mergedFieldNames);
|
|
69
81
|
|
|
@@ -109,19 +121,19 @@ export default function Panel(props) {
|
|
|
109
121
|
onSelect: onInternalSelect,
|
|
110
122
|
checkable: checkable,
|
|
111
123
|
checkStrictly: checkStrictly,
|
|
112
|
-
searchOptions:
|
|
113
|
-
dropdownPrefixCls:
|
|
124
|
+
searchOptions: searchOptions,
|
|
125
|
+
dropdownPrefixCls: dropdownPrefixCls || prefixCls,
|
|
114
126
|
loadData: loadData,
|
|
115
127
|
expandTrigger: expandTrigger,
|
|
116
128
|
expandIcon: expandIcon,
|
|
117
129
|
loadingIcon: loadingIcon,
|
|
118
130
|
dropdownMenuColumnStyle: undefined
|
|
119
131
|
};
|
|
120
|
-
}, [mergedOptions, mergedFieldNames, checkedValues, halfCheckedValues, mergedChangeOnSelect, onInternalSelect, checkable, checkStrictly, loadData, expandTrigger, expandIcon, loadingIcon]);
|
|
132
|
+
}, [mergedOptions, mergedFieldNames, checkedValues, halfCheckedValues, mergedChangeOnSelect, onInternalSelect, checkable, checkStrictly, searchOptions, dropdownPrefixCls, prefixCls, loadData, expandTrigger, expandIcon, loadingIcon]);
|
|
121
133
|
|
|
122
134
|
// ========================= Render =========================
|
|
123
135
|
var panelPrefixCls = ''.concat(prefixCls, '-panel');
|
|
124
|
-
var isEmpty = !mergedOptions.length;
|
|
136
|
+
var isEmpty = !(mergedSearchValue ? searchOptions : mergedOptions).length;
|
|
125
137
|
return /*#__PURE__*/React.createElement(CascaderContext.Provider, {
|
|
126
138
|
value: cascaderContext
|
|
127
139
|
}, /*#__PURE__*/React.createElement('div', {
|
|
@@ -129,7 +141,7 @@ export default function Panel(props) {
|
|
|
129
141
|
style: style
|
|
130
142
|
}, isEmpty ? notFoundContent : /*#__PURE__*/React.createElement(RawOptionList, {
|
|
131
143
|
prefixCls: prefixCls,
|
|
132
|
-
searchValue:
|
|
144
|
+
searchValue: mergedSearchValue,
|
|
133
145
|
multiple: multiple,
|
|
134
146
|
toggleOpen: noop,
|
|
135
147
|
open: true,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
-
import { conductCheck } from 'rc-tree/es/utils/conductUtil';
|
|
3
|
-
import * as React from 'react';
|
|
4
2
|
import { toPathKeys } from 'rc-cascader/es/utils/commonUtil';
|
|
3
|
+
import { conductCheck } from 'rc-tree/es/utils/conductUtil';
|
|
4
|
+
import React from 'react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @param {boolean} multiple
|
package/dist/cascader/index.d.ts
CHANGED
|
@@ -63,4 +63,5 @@ export interface CascaderComponent {
|
|
|
63
63
|
Panel: typeof CascaderPanel;
|
|
64
64
|
}
|
|
65
65
|
declare const Cascader: CascaderComponent;
|
|
66
|
+
export { defaultCascaderSearchFilter, defaultCascaderSearchRender, getDefaultCascaderShowSearch, useCascaderSearchOptions, } from './search';
|
|
66
67
|
export default Cascader;
|
package/dist/cascader/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
3
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
3
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
5
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
@@ -10,9 +9,9 @@ import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
|
10
9
|
import Icon from "../icon";
|
|
11
10
|
import "../select/style";
|
|
12
11
|
import useIcons from "../select/useIcons";
|
|
13
|
-
import { highlightKeyword } from "../select/utils";
|
|
14
12
|
import RcCascader, { SHOW_CHILD, SHOW_PARENT } from "./fork";
|
|
15
13
|
import CascaderPanel from "./Panel";
|
|
14
|
+
import { defaultCascaderSearchFilter, defaultCascaderSearchRender } from "./search";
|
|
16
15
|
import SelectedSummary from "./SelectedSummary";
|
|
17
16
|
import "./style";
|
|
18
17
|
import { DEFAULT_FIELD_NAMES, processOptions } from "./utils";
|
|
@@ -230,22 +229,7 @@ function CascaderInner(_ref) {
|
|
|
230
229
|
var rcValue = value === null ? undefined : value;
|
|
231
230
|
var rcDefaultValue = defaultValue === null ? undefined : defaultValue;
|
|
232
231
|
var defaultSearchRender = function defaultSearchRender(inputValue, path, prefixCls) {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
// We do lower here to save perf
|
|
236
|
-
var lower = inputValue.toLowerCase();
|
|
237
|
-
path.forEach(function (node, index) {
|
|
238
|
-
if (index !== 0) {
|
|
239
|
-
optionList.push(" ".concat(separator, " "));
|
|
240
|
-
}
|
|
241
|
-
var label = node.labelForSearch;
|
|
242
|
-
var type = _typeof(label);
|
|
243
|
-
if (type === 'string' || type === 'number') {
|
|
244
|
-
label = highlightKeyword(String(label), lower, prefixCls);
|
|
245
|
-
}
|
|
246
|
-
optionList.push(label);
|
|
247
|
-
});
|
|
248
|
-
return optionList;
|
|
232
|
+
return defaultCascaderSearchRender(inputValue, path, prefixCls, separator);
|
|
249
233
|
};
|
|
250
234
|
var mergedShowSearch = React.useMemo(function () {
|
|
251
235
|
if (!showInnerSearch && !showSearch) {
|
|
@@ -256,9 +240,7 @@ function CascaderInner(_ref) {
|
|
|
256
240
|
}
|
|
257
241
|
var searchConfig = {
|
|
258
242
|
filter: searchFilter || function (inputValue, path) {
|
|
259
|
-
return
|
|
260
|
-
return option.labelForSearch.toLowerCase().indexOf(inputValue.toLowerCase()) > -1;
|
|
261
|
-
});
|
|
243
|
+
return defaultCascaderSearchFilter(inputValue, path);
|
|
262
244
|
},
|
|
263
245
|
render: searchRender || defaultSearchRender,
|
|
264
246
|
limit: searchLimit
|
|
@@ -391,4 +373,5 @@ var Cascader = CascaderInner;
|
|
|
391
373
|
|
|
392
374
|
// 赋值 Panel 组件
|
|
393
375
|
Cascader.Panel = CascaderPanel;
|
|
376
|
+
export { defaultCascaderSearchFilter, defaultCascaderSearchRender, getDefaultCascaderShowSearch, useCascaderSearchOptions } from "./search";
|
|
394
377
|
export default Cascader;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { DefaultOptionType, ShowSearchType } from 'rc-cascader';
|
|
2
|
+
import useSearchOptions from 'rc-cascader/es/hooks/useSearchOptions';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
export type CascaderSearchOption = DefaultOptionType & {
|
|
5
|
+
labelForSearch?: string;
|
|
6
|
+
};
|
|
7
|
+
/** 与 Cascader 主组件默认 filter 一致:优先 labelForSearch,回退 label */
|
|
8
|
+
export declare function defaultCascaderSearchFilter(inputValue: string, path: CascaderSearchOption[]): boolean;
|
|
9
|
+
/** 路径扁平搜索项高亮渲染(复用 select/utils highlightKeyword) */
|
|
10
|
+
export declare function defaultCascaderSearchRender(inputValue: string, path: CascaderSearchOption[], prefixCls: string, separator?: string): React.ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* 薄封装 rc-cascader useSearchOptions,便于外部复用。
|
|
13
|
+
* 参数顺序与 rc-cascader 一致。
|
|
14
|
+
*/
|
|
15
|
+
export declare function useCascaderSearchOptions(search: string, options: DefaultOptionType[], fieldNames: Parameters<typeof useSearchOptions>[2], prefixCls: string, config: ShowSearchType, enableHalfPath?: boolean): DefaultOptionType[];
|
|
16
|
+
/** Panel / Cascader 共用的默认 showSearch 配置 */
|
|
17
|
+
export declare function getDefaultCascaderShowSearch(separator?: string, limit?: number | false): ShowSearchType;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
2
|
+
import useSearchOptions from 'rc-cascader/es/hooks/useSearchOptions';
|
|
3
|
+
import { highlightKeyword } from "../select/utils";
|
|
4
|
+
/** 与 Cascader 主组件默认 filter 一致:优先 labelForSearch,回退 label */
|
|
5
|
+
export function defaultCascaderSearchFilter(inputValue, path) {
|
|
6
|
+
var lower = inputValue.toLowerCase();
|
|
7
|
+
return path.some(function (option) {
|
|
8
|
+
var _option$labelForSearc;
|
|
9
|
+
var raw = (_option$labelForSearc = option.labelForSearch) !== null && _option$labelForSearc !== void 0 ? _option$labelForSearc : typeof option.label === 'string' || typeof option.label === 'number' ? String(option.label) : '';
|
|
10
|
+
return String(raw).toLowerCase().indexOf(lower) > -1;
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** 路径扁平搜索项高亮渲染(复用 select/utils highlightKeyword) */
|
|
15
|
+
export function defaultCascaderSearchRender(inputValue, path, prefixCls) {
|
|
16
|
+
var separator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '/';
|
|
17
|
+
var optionList = [];
|
|
18
|
+
var lower = inputValue.toLowerCase();
|
|
19
|
+
path.forEach(function (node, index) {
|
|
20
|
+
if (index !== 0) {
|
|
21
|
+
optionList.push(" ".concat(separator, " "));
|
|
22
|
+
}
|
|
23
|
+
var label = node.labelForSearch;
|
|
24
|
+
var type = _typeof(label);
|
|
25
|
+
if (type === 'string' || type === 'number') {
|
|
26
|
+
label = highlightKeyword(String(label), lower, prefixCls);
|
|
27
|
+
}
|
|
28
|
+
optionList.push(label);
|
|
29
|
+
});
|
|
30
|
+
return optionList;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* 薄封装 rc-cascader useSearchOptions,便于外部复用。
|
|
35
|
+
* 参数顺序与 rc-cascader 一致。
|
|
36
|
+
*/
|
|
37
|
+
export function useCascaderSearchOptions(search, options, fieldNames, prefixCls, config, enableHalfPath) {
|
|
38
|
+
return useSearchOptions(search, options, fieldNames, prefixCls, config, enableHalfPath);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Panel / Cascader 共用的默认 showSearch 配置 */
|
|
42
|
+
export function getDefaultCascaderShowSearch() {
|
|
43
|
+
var separator = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '/';
|
|
44
|
+
var limit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1000;
|
|
45
|
+
return {
|
|
46
|
+
limit: limit,
|
|
47
|
+
filter: function filter(inputValue, path) {
|
|
48
|
+
return defaultCascaderSearchFilter(inputValue, path);
|
|
49
|
+
},
|
|
50
|
+
render: function render(inputValue, path, prefixCls) {
|
|
51
|
+
return defaultCascaderSearchRender(inputValue, path, prefixCls, separator);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
}
|
|
@@ -554,11 +554,19 @@ html {
|
|
|
554
554
|
align-items: stretch;
|
|
555
555
|
}
|
|
556
556
|
|
|
557
|
+
/* Panel 列与下拉一致:固定高度 + 内部滚动(含搜索扁平列表) */
|
|
557
558
|
.odn-cascader-panel .odn-cascader-menu {
|
|
558
|
-
height:
|
|
559
|
+
height: var(--odn-cascader-dropdown-height);
|
|
560
|
+
overflow: auto;
|
|
559
561
|
}
|
|
560
562
|
|
|
561
563
|
.odn-cascader-panel-empty {
|
|
564
|
+
display: flex;
|
|
565
|
+
box-sizing: border-box;
|
|
566
|
+
width: 100%;
|
|
567
|
+
min-height: var(--odn-cascader-dropdown-height);
|
|
568
|
+
align-items: center;
|
|
569
|
+
justify-content: center;
|
|
562
570
|
padding: var(--odn-padding-xxs);
|
|
563
571
|
}
|
|
564
572
|
|
package/dist/chart/bar.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EChartsOption } from 'echarts';
|
|
2
|
-
import
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { type ChartHostProps } from './host';
|
|
4
4
|
import { type ChartSeries } from './option';
|
|
5
5
|
export interface ChartBarProps extends Omit<ChartHostProps, 'option'> {
|
package/dist/chart/bar.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["categories", "series", "option"];
|
|
4
|
-
import
|
|
4
|
+
import React from 'react';
|
|
5
5
|
import ChartHost from "./host";
|
|
6
6
|
import { cartesianOption, mergeOption } from "./option";
|
|
7
7
|
var ChartBar = function ChartBar(_ref) {
|
package/dist/chart/bullet.d.ts
CHANGED
package/dist/chart/bullet.js
CHANGED
|
@@ -5,7 +5,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
5
5
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
6
6
|
var _excluded = ["data", "nameLabel", "valueLabel", "rateLabel", "benchLabel", "nameWidth", "valueWidth", "hideValue", "hideAxisLabel", "hideTopBarBorder", "maxBodyHeight", "className", "style"];
|
|
7
7
|
import clsx from 'clsx';
|
|
8
|
-
import
|
|
8
|
+
import React from 'react';
|
|
9
9
|
import { createPortal } from 'react-dom';
|
|
10
10
|
import Empty from "../empty";
|
|
11
11
|
import HoverFill from "../hover-fill";
|
package/dist/chart/butterfly.js
CHANGED
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
4
4
|
var _excluded = ["categories", "leftValues", "rightValues", "leftLabel", "rightLabel", "leftReferenceValue", "leftReferenceLabel", "option"];
|
|
5
|
-
import
|
|
5
|
+
import React from 'react';
|
|
6
6
|
import ChartHost from "./host";
|
|
7
7
|
import { mergeOption } from "./option";
|
|
8
8
|
import { readToken } from "./tokens";
|
package/dist/chart/dual-line.js
CHANGED
|
@@ -7,7 +7,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
7
7
|
var _excluded = ["title", "titleForDate", "leftMetric", "rightMetric", "breakdown", "data", "leftLegend", "rightLegend", "leftAxisLabel", "rightAxisLabel", "showRight", "onHover", "renderDetail", "className", "style"];
|
|
8
8
|
import clsx from 'clsx';
|
|
9
9
|
import { motion } from 'motion/react';
|
|
10
|
-
import
|
|
10
|
+
import React from 'react';
|
|
11
11
|
import Button from "../button";
|
|
12
12
|
import "../button/style";
|
|
13
13
|
import Card from "../card";
|