x-ui-design 0.6.45 → 0.6.47
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/esm/types/components/Select/Select.d.ts +3 -3
- package/dist/esm/types/index.d.ts +50 -1
- package/dist/index.d.ts +52 -2
- package/dist/index.esm.js +14 -13
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +13 -12
- package/dist/index.js.map +1 -1
- package/lib/components/Select/Select.tsx +15 -13
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React, { ReactElement } from 'react';
|
|
2
2
|
import { SelectProps } from '../../types/select';
|
|
3
3
|
import './style.css';
|
|
4
|
-
declare const
|
|
4
|
+
declare const _default: React.MemoExoticComponent<{
|
|
5
5
|
({ prefixCls, id, searchValue, autoClearSearchValue, filterOption, optionFilterProp, children, options, listHeight, menuItemSelectedIcon, mode, value, defaultValue, maxCount, disabled, loading, placeholder, allowClear, filterable, defaultOpen, size, error, dropdownClassName, className, suffixIcon, searchIcon, style, showSearch, open, closeFromParent, showArrow, notFoundContent, noStyle, feedbackIcons, placement, removeIcon, maxTagCount, onSearch, onSelect, onDeselect, onClear, onChange, onClose, tagRender, getPopupContainer, dropdownRender, onDropdownVisibleChange, ref }: SelectProps): ReactElement;
|
|
6
6
|
displayName: string;
|
|
7
7
|
} & {
|
|
8
8
|
Option: React.FC<import("../../types/select").OptionProps>;
|
|
9
|
-
}
|
|
10
|
-
export default
|
|
9
|
+
}>;
|
|
10
|
+
export default _default;
|
|
@@ -14,7 +14,56 @@ declare const Textarea: import("react").ComponentType<import("@/types/input").Te
|
|
|
14
14
|
declare const Radio: import("react").ComponentType<import("@/types/radio").RadioProps>;
|
|
15
15
|
declare const RadioButton: import("react").ComponentType<import("@/types/radio").RadioButtonProps>;
|
|
16
16
|
declare const RadioGroup: import("react").ComponentType<import("@/types/radio").RadioGroupProps>;
|
|
17
|
-
declare const Select: import("react").ComponentType<import("@/types
|
|
17
|
+
declare const Select: import("react").ComponentType<import("@/types").DefaultProps & {
|
|
18
|
+
id?: string;
|
|
19
|
+
searchValue?: string;
|
|
20
|
+
onSearch?: (value: string) => void;
|
|
21
|
+
autoClearSearchValue?: boolean;
|
|
22
|
+
onSelect?: (value: import("@/types").RuleTypes, option?: import("@/types/select").OptionType) => void;
|
|
23
|
+
onDeselect?: (value: string, option?: import("@/types/select").OptionType) => void;
|
|
24
|
+
filterOption?: boolean | ((input: string, option: import("@/types/select").OptionType) => boolean);
|
|
25
|
+
optionFilterProp?: string;
|
|
26
|
+
options?: import("@/types/select").OptionType[];
|
|
27
|
+
children?: import("react").ReactNode;
|
|
28
|
+
defaultActiveFirstOption?: boolean;
|
|
29
|
+
listHeight?: number;
|
|
30
|
+
menuItemSelectedIcon?: import("react").ReactNode;
|
|
31
|
+
mode?: "default" | "multiple" | "tags";
|
|
32
|
+
value?: import("@/types").RuleTypes;
|
|
33
|
+
defaultValue?: import("@/types").RuleTypes;
|
|
34
|
+
maxCount?: number;
|
|
35
|
+
onChange?: (e: import("@/types").RuleTypes, option?: import("@/types/select").OptionType) => void;
|
|
36
|
+
onClose?: () => void;
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
loading?: boolean;
|
|
39
|
+
placeholder?: string;
|
|
40
|
+
allowClear?: boolean;
|
|
41
|
+
filterable?: boolean;
|
|
42
|
+
defaultOpen?: boolean;
|
|
43
|
+
size?: "small" | "middle" | "large";
|
|
44
|
+
onClear?: () => void;
|
|
45
|
+
error?: boolean;
|
|
46
|
+
showSearch?: boolean;
|
|
47
|
+
tagRender?: ((props: import("@/types/select").CustomTagProps) => import("react").ReactElement) | undefined;
|
|
48
|
+
maxTagPlaceholder?: import("react").ReactNode | ((omittedValues: import("@/types/select").DisplayValueType[]) => import("react").ReactNode);
|
|
49
|
+
dropdownClassName?: string;
|
|
50
|
+
showArrow?: boolean;
|
|
51
|
+
onBlur?: import("react").FocusEventHandler<HTMLElement> | undefined;
|
|
52
|
+
onDropdownVisibleChange?: ((open: boolean, selected: import("@/types").RuleType) => void) | undefined;
|
|
53
|
+
showAction?: ("click" | "focus")[] | undefined;
|
|
54
|
+
suffixIcon?: import("react").ReactNode;
|
|
55
|
+
searchIcon?: import("react").ReactNode;
|
|
56
|
+
open?: boolean;
|
|
57
|
+
notFoundContent?: import("react").ReactNode;
|
|
58
|
+
getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
|
|
59
|
+
dropdownRender?: (menu: import("react").ReactNode) => import("react").ReactNode;
|
|
60
|
+
feedbackIcons?: boolean;
|
|
61
|
+
placement?: "bottomLeft" | "bottomRight" | "topLeft" | "topRight";
|
|
62
|
+
removeIcon?: import("react").ReactNode;
|
|
63
|
+
maxTagCount?: number | "responsive";
|
|
64
|
+
ref?: import("react").ForwardedRef<HTMLDivElement>;
|
|
65
|
+
closeFromParent?: boolean;
|
|
66
|
+
}>;
|
|
18
67
|
declare const Option: import("react").ComponentType<import("@/types/select").OptionProps>;
|
|
19
68
|
declare const Tag: import("react").ComponentType<import("@/types/select").CustomTagProps>;
|
|
20
69
|
declare const Skeleton: import("react").ComponentType<import("./types/skeleton").SkeletonProps>;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import * as react from 'react';
|
|
|
2
2
|
import { CSSProperties, ReactNode } from 'react';
|
|
3
3
|
import * as __types_select from '@/types/select';
|
|
4
4
|
export { CustomTagProps, DisplayValueType, OptionProps, OptionType, SelectProps, TagProps } from '@/types/select';
|
|
5
|
+
import * as __types from '@/types';
|
|
6
|
+
export { DefaultProps, MouseEventHandlerSelect, RuleType, RuleTypes, SyntheticBaseEvent, TargetProps } from '@/types';
|
|
5
7
|
import * as __types_radio from '@/types/radio';
|
|
6
8
|
export { RadioButtonProps, RadioGroupProps, RadioProps } from '@/types/radio';
|
|
7
9
|
import * as __types_input from '@/types/input';
|
|
@@ -19,7 +21,6 @@ export { BaseButtonProps, ButtonProps, ButtonType } from '@/types/button';
|
|
|
19
21
|
export { ArrowIcon, CalendarIcon, CheckIcon, ClearIcon, DateDistanceIcon, ErrorIcon, LoadingIcon, SearchIcon, SpinerIcon, StampleIcon, SuccessIcon, TimeIcon, TrashIcon } from '@/components/Icons';
|
|
20
22
|
export { useForm } from '@/hooks/useForm';
|
|
21
23
|
export { useWatch } from '@/hooks/useWatch';
|
|
22
|
-
export { DefaultProps, MouseEventHandlerSelect, RuleType, RuleTypes, SyntheticBaseEvent, TargetProps } from '@/types';
|
|
23
24
|
export { FormContext } from '@/components/Form/Form';
|
|
24
25
|
export { clsx, createArray, parseValue } from '@/helpers';
|
|
25
26
|
export { flattenChildren } from '@/helpers/flatten';
|
|
@@ -117,7 +118,56 @@ declare const Textarea: react.ComponentType<__types_input.TextareaProps>;
|
|
|
117
118
|
declare const Radio: react.ComponentType<__types_radio.RadioProps>;
|
|
118
119
|
declare const RadioButton: react.ComponentType<__types_radio.RadioButtonProps>;
|
|
119
120
|
declare const RadioGroup: react.ComponentType<__types_radio.RadioGroupProps>;
|
|
120
|
-
declare const Select: react.ComponentType<
|
|
121
|
+
declare const Select: react.ComponentType<__types.DefaultProps & {
|
|
122
|
+
id?: string;
|
|
123
|
+
searchValue?: string;
|
|
124
|
+
onSearch?: (value: string) => void;
|
|
125
|
+
autoClearSearchValue?: boolean;
|
|
126
|
+
onSelect?: (value: __types.RuleTypes, option?: __types_select.OptionType) => void;
|
|
127
|
+
onDeselect?: (value: string, option?: __types_select.OptionType) => void;
|
|
128
|
+
filterOption?: boolean | ((input: string, option: __types_select.OptionType) => boolean);
|
|
129
|
+
optionFilterProp?: string;
|
|
130
|
+
options?: __types_select.OptionType[];
|
|
131
|
+
children?: react.ReactNode;
|
|
132
|
+
defaultActiveFirstOption?: boolean;
|
|
133
|
+
listHeight?: number;
|
|
134
|
+
menuItemSelectedIcon?: react.ReactNode;
|
|
135
|
+
mode?: "default" | "multiple" | "tags";
|
|
136
|
+
value?: __types.RuleTypes;
|
|
137
|
+
defaultValue?: __types.RuleTypes;
|
|
138
|
+
maxCount?: number;
|
|
139
|
+
onChange?: (e: __types.RuleTypes, option?: __types_select.OptionType) => void;
|
|
140
|
+
onClose?: () => void;
|
|
141
|
+
disabled?: boolean;
|
|
142
|
+
loading?: boolean;
|
|
143
|
+
placeholder?: string;
|
|
144
|
+
allowClear?: boolean;
|
|
145
|
+
filterable?: boolean;
|
|
146
|
+
defaultOpen?: boolean;
|
|
147
|
+
size?: "small" | "middle" | "large";
|
|
148
|
+
onClear?: () => void;
|
|
149
|
+
error?: boolean;
|
|
150
|
+
showSearch?: boolean;
|
|
151
|
+
tagRender?: ((props: __types_select.CustomTagProps) => react.ReactElement) | undefined;
|
|
152
|
+
maxTagPlaceholder?: react.ReactNode | ((omittedValues: __types_select.DisplayValueType[]) => react.ReactNode);
|
|
153
|
+
dropdownClassName?: string;
|
|
154
|
+
showArrow?: boolean;
|
|
155
|
+
onBlur?: react.FocusEventHandler<HTMLElement> | undefined;
|
|
156
|
+
onDropdownVisibleChange?: ((open: boolean, selected: __types.RuleType) => void) | undefined;
|
|
157
|
+
showAction?: ("click" | "focus")[] | undefined;
|
|
158
|
+
suffixIcon?: react.ReactNode;
|
|
159
|
+
searchIcon?: react.ReactNode;
|
|
160
|
+
open?: boolean;
|
|
161
|
+
notFoundContent?: react.ReactNode;
|
|
162
|
+
getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
|
|
163
|
+
dropdownRender?: (menu: react.ReactNode) => react.ReactNode;
|
|
164
|
+
feedbackIcons?: boolean;
|
|
165
|
+
placement?: "bottomLeft" | "bottomRight" | "topLeft" | "topRight";
|
|
166
|
+
removeIcon?: react.ReactNode;
|
|
167
|
+
maxTagCount?: number | "responsive";
|
|
168
|
+
ref?: react.ForwardedRef<HTMLDivElement>;
|
|
169
|
+
closeFromParent?: boolean;
|
|
170
|
+
}>;
|
|
121
171
|
declare const Option: react.ComponentType<__types_select.OptionProps>;
|
|
122
172
|
declare const Tag: react.ComponentType<__types_select.CustomTagProps>;
|
|
123
173
|
declare const Skeleton: react.ComponentType<SkeletonProps>;
|
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import require$$1 from 'react/jsx-runtime';
|
|
2
|
-
import React, { useRef, useState, Children, isValidElement, Fragment, Suspense, useContext, useMemo, useEffect, createContext, useImperativeHandle, useCallback, useLayoutEffect } from 'react';
|
|
2
|
+
import React, { useRef, useState, Children, isValidElement, Fragment, Suspense, useContext, useMemo, useEffect, createContext, useImperativeHandle, memo, useCallback, useLayoutEffect } from 'react';
|
|
3
3
|
import { createPortal } from 'react-dom';
|
|
4
4
|
import ReactDOMServer from 'react-dom/server';
|
|
5
5
|
|
|
@@ -1340,7 +1340,7 @@ const RadioButton$1 = dynamic$1(() => Promise.resolve().then(function () { retur
|
|
|
1340
1340
|
const RadioGroup$1 = dynamic$1(() => Promise.resolve().then(function () { return Group; }), {
|
|
1341
1341
|
ssr: false
|
|
1342
1342
|
});
|
|
1343
|
-
const Select$
|
|
1343
|
+
const Select$3 = dynamic$1(() => Promise.resolve().then(function () { return Select$2; }), {
|
|
1344
1344
|
ssr: false
|
|
1345
1345
|
});
|
|
1346
1346
|
const Option$2 = dynamic$1(() => Promise.resolve().then(function () { return Option$1; }), {
|
|
@@ -3647,13 +3647,7 @@ const SelectComponent = ({
|
|
|
3647
3647
|
isOpen: isOpen
|
|
3648
3648
|
}));
|
|
3649
3649
|
}, [showArrow, showSearch, isOpen, suffixIcon, searchIcon]);
|
|
3650
|
-
const
|
|
3651
|
-
return children ? extractOptions(children) : Array.isArray(options) ? options : [];
|
|
3652
|
-
}, [children, children]);
|
|
3653
|
-
const triggerNode = useMemo(() => {
|
|
3654
|
-
return selectRef.current?.querySelector(`.${prefixCls}-trigger`);
|
|
3655
|
-
}, [prefixCls]);
|
|
3656
|
-
function extractOptions(children, options) {
|
|
3650
|
+
const extractOptions = useCallback((children, options) => {
|
|
3657
3651
|
const result = [];
|
|
3658
3652
|
const flatten = nodes => {
|
|
3659
3653
|
try {
|
|
@@ -3677,7 +3671,13 @@ const SelectComponent = ({
|
|
|
3677
3671
|
return result;
|
|
3678
3672
|
}
|
|
3679
3673
|
return options || [];
|
|
3680
|
-
}
|
|
3674
|
+
}, []);
|
|
3675
|
+
const extractedOptions = useMemo(() => {
|
|
3676
|
+
return children ? extractOptions(children) : Array.isArray(options) ? options : [];
|
|
3677
|
+
}, [children, children]);
|
|
3678
|
+
const triggerNode = useMemo(() => {
|
|
3679
|
+
return selectRef.current?.querySelector(`.${prefixCls}-trigger`);
|
|
3680
|
+
}, [prefixCls]);
|
|
3681
3681
|
const filteredOptions = extractedOptions.filter(option => {
|
|
3682
3682
|
if (typeof filterOption === 'function') {
|
|
3683
3683
|
return filterOption(searchQuery, option);
|
|
@@ -3915,10 +3915,11 @@ SelectComponent.displayName = 'Select';
|
|
|
3915
3915
|
const Select = Object.assign(SelectComponent, {
|
|
3916
3916
|
Option
|
|
3917
3917
|
});
|
|
3918
|
+
var Select$1 = /*#__PURE__*/memo(Select);
|
|
3918
3919
|
|
|
3919
|
-
var Select$
|
|
3920
|
+
var Select$2 = /*#__PURE__*/Object.freeze({
|
|
3920
3921
|
__proto__: null,
|
|
3921
|
-
default: Select
|
|
3922
|
+
default: Select$1
|
|
3922
3923
|
});
|
|
3923
3924
|
|
|
3924
3925
|
var css_248z$4 = "@keyframes xUi-skeleton-loading{0%{background-position:100% 50%}to{background-position:0 50%}}.xUi-skeleton-element{display:inline-block!important;width:auto!important}.xUi-skeleton-button{background:hsla(0,0%,75%,.2);border-radius:4px;display:inline-block;height:32px;line-height:32px;min-width:64px;vertical-align:top;width:64px}.xUi-skeleton-button-sm{height:24px;line-height:24px;min-width:48px;width:48px}.xUi-skeleton-button-lg{height:44px;line-height:44px;min-width:80px;width:80px}.xUi-skeleton-active .xUi-skeleton-button{animation:xUi-skeleton-loading 1.4s ease infinite;background:linear-gradient(90deg,hsla(0,0%,75%,.2) 25%,hsla(0,0%,51%,.24) 37%,hsla(0,0%,75%,.2) 63%);background-size:400% 100%}";
|
|
@@ -4142,5 +4143,5 @@ var Skeleton$1 = /*#__PURE__*/Object.freeze({
|
|
|
4142
4143
|
default: Skeleton
|
|
4143
4144
|
});
|
|
4144
4145
|
|
|
4145
|
-
export { ArrowIcon, Button$3 as Button, CalendarIcon, CheckIcon, Checkbox$2 as Checkbox, ClearIcon, DateDistanceIcon, DatePicker$2 as DatePicker, Empty$1 as Empty, ErrorIcon, Form, FormContext, FormItem, Input$3 as Input, LoadingIcon, Option$2 as Option, Radio$2 as Radio, RadioButton$1 as RadioButton, RadioGroup$1 as RadioGroup, RangePicker$2 as RangePicker, SearchIcon, Select$
|
|
4146
|
+
export { ArrowIcon, Button$3 as Button, CalendarIcon, CheckIcon, Checkbox$2 as Checkbox, ClearIcon, DateDistanceIcon, DatePicker$2 as DatePicker, Empty$1 as Empty, ErrorIcon, Form, FormContext, FormItem, Input$3 as Input, LoadingIcon, Option$2 as Option, Radio$2 as Radio, RadioButton$1 as RadioButton, RadioGroup$1 as RadioGroup, RangePicker$2 as RangePicker, SearchIcon, Select$3 as Select, Skeleton$2 as Skeleton, SkeletonAvatar$1 as SkeletonAvatar, SkeletonButton$1 as SkeletonButton, SkeletonImage$1 as SkeletonImage, SkeletonInput$1 as SkeletonInput, SpinerIcon, StampleIcon, SuccessIcon, Switch$2 as Switch, Tag$2 as Tag, Textarea$2 as Textarea, TimeIcon, TimePicker$2 as TimePicker, TrashIcon, Upload$2 as Upload, clsx, createArray, flattenChildren, parseValue, useForm, useWatch };
|
|
4146
4147
|
//# sourceMappingURL=index.esm.js.map
|