@baishuyun/ui-base 2.0.0 → 2.1.0
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/Card/{Card-DMXtN2pu.js → Card-CXULQNHa.js} +1 -1
- package/dist/Card/index.js +1 -1
- package/dist/CheckBox/CheckBox-Bu40TO29.js +84 -0
- package/dist/CheckBox/index.js +37 -0
- package/dist/ColorPicker/ColorPicker-CwFsihkL.js +207 -0
- package/dist/ColorPicker/index.js +1 -1
- package/dist/Icon/{Icon-C0bjP9U6.js → Icon-BlkVlKDd.js} +1 -1
- package/dist/Icon/index.js +1 -1
- package/dist/InputTag/index.js +2 -2
- package/dist/Modal/{Modal-C1LEJ6Y0.js → Modal-BZTEGGa0.js} +1 -1
- package/dist/Modal/index.js +1 -1
- package/dist/NotFoundContent/NotFoundContent-h0-oIXlk.js +6 -0
- package/dist/NotFoundContent/index.js +4 -0
- package/dist/Radio/index.js +105 -0
- package/dist/Segmented/Segmented-UgzW78Ey.js +75 -0
- package/dist/Segmented/index.js +4 -0
- package/dist/Select/Select-C3abXG27.js +855 -0
- package/dist/Select/index.js +6 -0
- package/dist/Tree/index.js +4 -0
- package/dist/Tree/utils/index.js +40 -0
- package/dist/components/CheckBox/CheckBox.d.ts +46 -0
- package/dist/components/CheckBox/CheckboxIcon.d.ts +6 -0
- package/dist/components/CheckBox/Group.d.ts +30 -0
- package/dist/components/CheckBox/constants.d.ts +11 -0
- package/dist/components/CheckBox/context/context.d.ts +8 -0
- package/dist/components/CheckBox/index.d.ts +9 -0
- package/dist/components/NotFoundContent/NotFoundContent.d.ts +9 -0
- package/dist/components/NotFoundContent/index.d.ts +1 -0
- package/dist/components/Radio/Group.d.ts +3 -0
- package/dist/components/Radio/Radio.d.ts +3 -0
- package/dist/components/Radio/constants.d.ts +6 -0
- package/dist/components/Radio/context/context.d.ts +9 -0
- package/dist/components/Radio/index.d.ts +7 -0
- package/dist/components/Radio/interface.d.ts +98 -0
- package/dist/components/Segmented/Segmented.d.ts +6 -0
- package/dist/components/Segmented/Segmented.type.d.ts +31 -0
- package/dist/components/Segmented/index.d.ts +2 -0
- package/dist/components/Select/HighlightText/HighlightText.d.ts +7 -0
- package/dist/components/Select/OptionList/MultOptionList/MultOptionList.d.ts +11 -0
- package/dist/components/Select/OptionList/OptionList.d.ts +6 -0
- package/dist/components/Select/OptionList/SingleOptionList/SingleOptionList.d.ts +11 -0
- package/dist/components/Select/OptionList/TreeOptionList/TreeOptionList.d.ts +21 -0
- package/dist/components/Select/OptionList/filter.d.ts +4 -0
- package/dist/components/Select/Select.d.ts +3 -0
- package/dist/components/Select/SelectInput/SelectInput.d.ts +10 -0
- package/dist/components/Select/SelectInput/SelectMultipleInput/OptionTag/OptionTag.d.ts +12 -0
- package/dist/components/Select/SelectInput/SelectMultipleInput/SelectMultipleInput.d.ts +8 -0
- package/dist/components/Select/SelectInput/SelectSingleInput/SelectSingleInput.d.ts +8 -0
- package/dist/components/Select/SelectInputSearch/SelectInputSearch.d.ts +6 -0
- package/dist/components/Select/SelectPanel/SelectPanel.d.ts +3 -0
- package/dist/components/Select/constants.d.ts +59 -0
- package/dist/components/Select/context/SelectContext.d.ts +52 -0
- package/dist/components/Select/index.d.ts +3 -0
- package/dist/components/Select/interface.d.ts +192 -0
- package/dist/components/Select/utils/fieldAccessor.d.ts +30 -0
- package/dist/components/Select/utils/tree.d.ts +2 -0
- package/dist/components/Tree/Tree.d.ts +6 -0
- package/dist/components/Tree/TreeNode/TreeNode.d.ts +21 -0
- package/dist/components/Tree/context/TreeContext.d.ts +15 -0
- package/dist/components/Tree/index.d.ts +3 -0
- package/dist/components/Tree/types/node.d.ts +12 -0
- package/dist/components/Tree/types/tree.d.ts +84 -0
- package/dist/components/Tree/utils/index.d.ts +11 -0
- package/dist/components/index.d.ts +5 -0
- package/dist/index.js +45 -35
- package/dist/style.css +1 -1
- package/dist/vendors/Tree-CCY2gtpG.js +225 -0
- package/dist/vendors/fuse.js-D1DCbUBb.js +1022 -0
- package/dist/vendors/index-ByQkttKA.js +59 -0
- package/dist/vendors/lodash-es-CZfJRWhO.js +305 -0
- package/dist/vendors/{simplebar-react-svBEsTVC.js → simplebar-react-Bf9Zq-21.js} +1 -1
- package/package.json +1 -1
- package/dist/ColorPicker/ColorPicker-CpPLwHR2.js +0 -253
- package/dist/vendors/fuse.js-l0sNRNKZ.js +0 -1
- package/dist/vendors/lodash-es-DP1ViCXF.js +0 -262
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { i as P } from "../../vendors/lodash-es-CZfJRWhO.js";
|
|
2
|
+
const g = (s, c, t, u = []) => {
|
|
3
|
+
var r;
|
|
4
|
+
for (const n of s) {
|
|
5
|
+
const o = [...u, n[t.value]];
|
|
6
|
+
if (n[t.value] === c)
|
|
7
|
+
return o;
|
|
8
|
+
if ((r = n[t.children]) != null && r.length) {
|
|
9
|
+
const h = g(
|
|
10
|
+
n[t.children],
|
|
11
|
+
c,
|
|
12
|
+
t,
|
|
13
|
+
o
|
|
14
|
+
);
|
|
15
|
+
if (h)
|
|
16
|
+
return h;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return null;
|
|
20
|
+
}, l = (s, c, t, u = []) => {
|
|
21
|
+
var n;
|
|
22
|
+
const r = [];
|
|
23
|
+
for (const o of s) {
|
|
24
|
+
const h = [...u, o[t.value]], e = o[t.title];
|
|
25
|
+
if (P(e) && e.toLowerCase().includes(c.toLowerCase()) && r.push(h), (n = o[t.children]) != null && n.length) {
|
|
26
|
+
const i = l(
|
|
27
|
+
o[t.children],
|
|
28
|
+
c,
|
|
29
|
+
t,
|
|
30
|
+
h
|
|
31
|
+
);
|
|
32
|
+
r.push(...i);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return r;
|
|
36
|
+
};
|
|
37
|
+
export {
|
|
38
|
+
l as getMatchingNodesPaths,
|
|
39
|
+
g as getNodePath
|
|
40
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface CheckboxProps {
|
|
3
|
+
/**
|
|
4
|
+
* @description 是否选中
|
|
5
|
+
*/
|
|
6
|
+
checked?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* @description 默认是否选中
|
|
9
|
+
*/
|
|
10
|
+
defaultChecked?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* @description 是否禁用
|
|
13
|
+
*/
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* @description 半选状态
|
|
17
|
+
*/
|
|
18
|
+
indeterminate?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* @description 值改变时的回调
|
|
21
|
+
*/
|
|
22
|
+
onChange?: (checked: boolean) => void;
|
|
23
|
+
/**
|
|
24
|
+
* @description 自定义类名
|
|
25
|
+
*/
|
|
26
|
+
className?: string;
|
|
27
|
+
/**
|
|
28
|
+
* @description 自定义样式
|
|
29
|
+
*/
|
|
30
|
+
style?: React.CSSProperties;
|
|
31
|
+
/**
|
|
32
|
+
* @description 子元素
|
|
33
|
+
*/
|
|
34
|
+
children?: React.ReactNode;
|
|
35
|
+
/**
|
|
36
|
+
* @description label 的位置,默认在右侧
|
|
37
|
+
* @default 'right'
|
|
38
|
+
*/
|
|
39
|
+
labelPosition?: 'left' | 'right';
|
|
40
|
+
/**
|
|
41
|
+
* @description checkbox 的值,用于 checkbox group
|
|
42
|
+
*/
|
|
43
|
+
value?: string | number;
|
|
44
|
+
}
|
|
45
|
+
declare const BsyCheckbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLDivElement>>;
|
|
46
|
+
export default BsyCheckbox;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Layout } from './constants';
|
|
2
|
+
export interface CheckboxGroupProps {
|
|
3
|
+
/**
|
|
4
|
+
* @description 选中的值
|
|
5
|
+
*/
|
|
6
|
+
value?: Array<string | number>;
|
|
7
|
+
/**
|
|
8
|
+
* @description 默认选中的值
|
|
9
|
+
*/
|
|
10
|
+
defaultValue?: Array<string | number>;
|
|
11
|
+
/**
|
|
12
|
+
* @description 值改变时的回调
|
|
13
|
+
*/
|
|
14
|
+
onChange?: (checkedValues: Array<string | number>) => void;
|
|
15
|
+
/**
|
|
16
|
+
* @description 是否禁用
|
|
17
|
+
*/
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* @description 布局方式
|
|
21
|
+
* @default 'none'
|
|
22
|
+
*/
|
|
23
|
+
layout?: Layout;
|
|
24
|
+
/**
|
|
25
|
+
* @description Checkbox 子元素
|
|
26
|
+
*/
|
|
27
|
+
children?: React.ReactNode;
|
|
28
|
+
}
|
|
29
|
+
declare const CheckboxGroup: React.FC<CheckboxGroupProps>;
|
|
30
|
+
export default CheckboxGroup;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const enum STATES {
|
|
2
|
+
UNCHECKED = 0,
|
|
3
|
+
CHECKED = 1,
|
|
4
|
+
INDETERMINATE = 2
|
|
5
|
+
}
|
|
6
|
+
export type Layout = 'none' | 'horizontal' | 'vertical';
|
|
7
|
+
export declare const enum LAYOUT {
|
|
8
|
+
NONE = "none",
|
|
9
|
+
HORIZONTAL = "horizontal",
|
|
10
|
+
VERTICAL = "vertical"
|
|
11
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Layout } from '../constants';
|
|
2
|
+
export interface CheckboxGroupContextProps {
|
|
3
|
+
value?: Array<string | number>;
|
|
4
|
+
onChange?: (value: Array<string | number>) => void;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
layout?: Layout;
|
|
7
|
+
}
|
|
8
|
+
export declare const CheckboxGroupContext: import('react').Context<CheckboxGroupContextProps | null>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as InternalCheckbox } from './CheckBox';
|
|
2
|
+
import { default as Group } from './Group';
|
|
3
|
+
type CompoundedComponent = typeof InternalCheckbox & {
|
|
4
|
+
Group: typeof Group;
|
|
5
|
+
};
|
|
6
|
+
declare const Checkbox: CompoundedComponent;
|
|
7
|
+
export default Checkbox;
|
|
8
|
+
export type { CheckboxProps } from './CheckBox';
|
|
9
|
+
export type { Layout } from './constants';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as NotFoundContent } from './NotFoundContent';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Layout } from '../constants';
|
|
2
|
+
export interface RadioGroupContextProps {
|
|
3
|
+
value?: string | number;
|
|
4
|
+
onChange?: (value: string | number) => void;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
layout?: Layout;
|
|
7
|
+
onDeselect?: (value: string | number) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const RadioGroupContext: import('react').Context<RadioGroupContextProps | null>;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { Layout } from './constants';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export interface RadioProps {
|
|
5
|
+
/**
|
|
6
|
+
* @description 是否选中
|
|
7
|
+
*/
|
|
8
|
+
checked?: boolean;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @description 默认是否选中
|
|
12
|
+
*/
|
|
13
|
+
defaultChecked?: boolean;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @description 是否禁用
|
|
17
|
+
*/
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @description 值改变时的回调
|
|
22
|
+
*/
|
|
23
|
+
onChange?: (checked: boolean) => void;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @description 自定义类名
|
|
27
|
+
*/
|
|
28
|
+
className?: string;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @description 自定义样式
|
|
32
|
+
*/
|
|
33
|
+
style?: React.CSSProperties;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @description 子元素
|
|
37
|
+
*/
|
|
38
|
+
children?: React.ReactNode;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @description label 的位置,默认在右侧
|
|
42
|
+
* @default 'right'
|
|
43
|
+
*/
|
|
44
|
+
labelPosition?: 'left' | 'right';
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @description radio 的值,用于 radio group
|
|
48
|
+
*/
|
|
49
|
+
value?: string | number;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface RadioGroupProps {
|
|
53
|
+
/**
|
|
54
|
+
* @description 选中的值
|
|
55
|
+
*/
|
|
56
|
+
value?: string | number;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @description 默认选中的值
|
|
60
|
+
*/
|
|
61
|
+
defaultValue?: string | number;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @description 值改变时的回调
|
|
65
|
+
*/
|
|
66
|
+
onChange?: (value: string | number) => void;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @description 值反选的回调
|
|
70
|
+
*/
|
|
71
|
+
onDeselect?: (value: string | number) => void;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* @description 是否禁用
|
|
75
|
+
*/
|
|
76
|
+
disabled?: boolean;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* @description 布局方式
|
|
80
|
+
* @default 'none'
|
|
81
|
+
*/
|
|
82
|
+
layout?: Layout;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* @description Radio 子元素
|
|
86
|
+
*/
|
|
87
|
+
children?: React.ReactNode;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @description 自定义类名
|
|
91
|
+
*/
|
|
92
|
+
className?: string;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* @description 自定义样式
|
|
96
|
+
*/
|
|
97
|
+
style?: React.CSSProperties;
|
|
98
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type SegmentedOption<T extends React.Key = string | number> = {
|
|
3
|
+
label: string | ReactNode;
|
|
4
|
+
value: T;
|
|
5
|
+
};
|
|
6
|
+
export type LayoutState = {
|
|
7
|
+
width: number;
|
|
8
|
+
left: number;
|
|
9
|
+
};
|
|
10
|
+
export type SegmentedProps<T extends React.Key = string | number> = {
|
|
11
|
+
/**
|
|
12
|
+
* @description 将宽度调整为父元素宽度的选项
|
|
13
|
+
*/
|
|
14
|
+
block?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* @description 数据化配置选项内容
|
|
17
|
+
*/
|
|
18
|
+
options: SegmentedOption<T>[];
|
|
19
|
+
/**
|
|
20
|
+
* @description 当前选中的值
|
|
21
|
+
*/
|
|
22
|
+
value?: T;
|
|
23
|
+
/**
|
|
24
|
+
* @description 选项变化时的回调函数
|
|
25
|
+
*/
|
|
26
|
+
onChange?: (value: T) => void;
|
|
27
|
+
/**
|
|
28
|
+
* @description 是否禁用
|
|
29
|
+
*/
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DefaultOptionType, FieldNames, SelectProps } from '../../interface';
|
|
2
|
+
type MultipleSelectProps<F extends FieldNames> = {
|
|
3
|
+
value?: Array<string | number>;
|
|
4
|
+
options: DefaultOptionType[];
|
|
5
|
+
searchValue?: string;
|
|
6
|
+
fieldNames: F;
|
|
7
|
+
onSelect: (value: Array<string | number>, options: DefaultOptionType[]) => void;
|
|
8
|
+
optionRender?: SelectProps['optionRender'];
|
|
9
|
+
};
|
|
10
|
+
declare const MultipleSelect: React.FC<MultipleSelectProps<FieldNames>>;
|
|
11
|
+
export default MultipleSelect;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SelectProps } from '../interface';
|
|
2
|
+
type OptionListProps = {
|
|
3
|
+
searchValue?: string;
|
|
4
|
+
} & Pick<SelectProps, 'options' | 'type' | 'filterOption' | 'optionRender' | 'optionStyle'>;
|
|
5
|
+
declare const OptionList: React.FC<OptionListProps>;
|
|
6
|
+
export default OptionList;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DefaultOptionType, FieldNames, SelectProps } from '../../interface';
|
|
2
|
+
type SingleSelectProps<F extends FieldNames> = {
|
|
3
|
+
value?: string | number;
|
|
4
|
+
options: DefaultOptionType[];
|
|
5
|
+
searchValue?: string;
|
|
6
|
+
fieldNames: F;
|
|
7
|
+
onSelect: (value: string | number, option: DefaultOptionType) => void;
|
|
8
|
+
optionRender?: SelectProps['optionRender'];
|
|
9
|
+
} & Pick<SelectProps, 'optionStyle'>;
|
|
10
|
+
declare const SingleSelect: React.FC<SingleSelectProps<FieldNames>>;
|
|
11
|
+
export default SingleSelect;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DefaultOptionType, SelectProps } from '../../interface';
|
|
2
|
+
interface BsyTreeSelectProps {
|
|
3
|
+
/**
|
|
4
|
+
* @description 节点图标
|
|
5
|
+
*/
|
|
6
|
+
nodeIcon?: React.ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* @description 过滤的文本值
|
|
9
|
+
*/
|
|
10
|
+
searchValue?: string;
|
|
11
|
+
/**
|
|
12
|
+
* @description 选中的节点
|
|
13
|
+
*/
|
|
14
|
+
value?: string | number;
|
|
15
|
+
/**
|
|
16
|
+
* @description 选中节点回调
|
|
17
|
+
*/
|
|
18
|
+
onSelect?: (value: string | number, node: DefaultOptionType) => void;
|
|
19
|
+
}
|
|
20
|
+
declare const BsyTreeSelect: React.FC<Pick<SelectProps, 'options' | 'value' | 'fieldNames'> & BsyTreeSelectProps>;
|
|
21
|
+
export default BsyTreeSelect;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { DefaultOptionType, FieldNames } from '../interface';
|
|
2
|
+
declare const getAllNodes: (nodes: DefaultOptionType[], fieldNames: FieldNames) => DefaultOptionType[];
|
|
3
|
+
declare const buildFilteredTree: (nodes: DefaultOptionType[], matchedIds: Set<string>, fieldNames: FieldNames) => DefaultOptionType[];
|
|
4
|
+
export { getAllNodes, buildFilteredTree };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Mode } from '../constants';
|
|
2
|
+
import { SelectProps } from '../interface';
|
|
3
|
+
type SelectInputProps = Pick<SelectProps, 'clearable' | 'onClear' | 'fieldNames' | 'disabled' | 'placeholder' | 'labelRender' | 'options' | 'type' | 'prefix' | 'suffixIcon' | 'ghost' | 'inputValueStyle' | 'tagStyle'> & {
|
|
4
|
+
/**
|
|
5
|
+
* @description 选择框的类型
|
|
6
|
+
*/
|
|
7
|
+
mode: Mode;
|
|
8
|
+
};
|
|
9
|
+
declare const SelectInput: React.FC<SelectInputProps>;
|
|
10
|
+
export default SelectInput;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PropsWithChildren, ReactNode } from 'react';
|
|
2
|
+
type OptionTagProps = {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
color?: string;
|
|
5
|
+
style?: React.CSSProperties;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
};
|
|
8
|
+
type OptionTagComponent = React.ForwardRefExoticComponent<OptionTagProps & React.RefAttributes<HTMLDivElement>> & {
|
|
9
|
+
Container: React.FC<PropsWithChildren>;
|
|
10
|
+
};
|
|
11
|
+
declare const OptionTag: OptionTagComponent;
|
|
12
|
+
export default OptionTag;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DefaultOptionType, SelectProps } from '../../interface';
|
|
2
|
+
type SelectMultipleInputProps = {
|
|
3
|
+
value: DefaultOptionType[];
|
|
4
|
+
labelRender?: SelectProps['labelRender'];
|
|
5
|
+
tagStyle?: SelectProps['tagStyle'];
|
|
6
|
+
};
|
|
7
|
+
declare const SelectMultipleInput: React.FC<SelectMultipleInputProps>;
|
|
8
|
+
export default SelectMultipleInput;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DefaultOptionType, SelectProps } from '../../interface';
|
|
2
|
+
type SelectSingleInputProps = {
|
|
3
|
+
value: DefaultOptionType[];
|
|
4
|
+
labelRender: SelectProps['labelRender'];
|
|
5
|
+
inputValueStyle?: SelectProps['inputValueStyle'];
|
|
6
|
+
};
|
|
7
|
+
declare const SelectSingleInput: React.FC<SelectSingleInputProps>;
|
|
8
|
+
export default SelectSingleInput;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SelectProps } from '../interface';
|
|
2
|
+
type SelectInputSearchProps = Pick<SelectProps, 'searchPlaceholder' | 'value'> & {
|
|
3
|
+
onChange: (value: string) => void;
|
|
4
|
+
};
|
|
5
|
+
declare const SelectInputSearch: React.FC<SelectInputSearchProps>;
|
|
6
|
+
export default SelectInputSearch;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export declare enum Mode {
|
|
2
|
+
/**
|
|
3
|
+
* @description 单选模式
|
|
4
|
+
*/
|
|
5
|
+
SINGLE = "single",
|
|
6
|
+
/**
|
|
7
|
+
* @description 多选模式
|
|
8
|
+
*/
|
|
9
|
+
MULTIPLE = "multiple"
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @description 不同业务场景下拉组件的类型
|
|
13
|
+
* @default SelectType.SINGLE
|
|
14
|
+
*/
|
|
15
|
+
export declare enum SelectType {
|
|
16
|
+
/**
|
|
17
|
+
* @description 单选下拉
|
|
18
|
+
*/
|
|
19
|
+
SINGLE = 0,
|
|
20
|
+
/**
|
|
21
|
+
* @description 多选(复选)下拉
|
|
22
|
+
*/
|
|
23
|
+
MULTIPLE = 1,
|
|
24
|
+
/**
|
|
25
|
+
* @description 树形下拉
|
|
26
|
+
*/
|
|
27
|
+
TREE = 2,
|
|
28
|
+
/**
|
|
29
|
+
* @description 树形复选下拉
|
|
30
|
+
* @todo 未实现-预留
|
|
31
|
+
*/
|
|
32
|
+
TREE_TAGS = 3,
|
|
33
|
+
/**
|
|
34
|
+
* @description 复选成员下拉
|
|
35
|
+
* @todo 未实现-预留
|
|
36
|
+
*/
|
|
37
|
+
MEMBER = 4,
|
|
38
|
+
/**
|
|
39
|
+
* @description 树形+复选部门下拉
|
|
40
|
+
* @todo 未实现-预留
|
|
41
|
+
*/
|
|
42
|
+
DEPARTEMENT = 5
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* SelectInput 框回填模式
|
|
46
|
+
*/
|
|
47
|
+
export declare const INPUT_MODE_MAP: {
|
|
48
|
+
0: Mode;
|
|
49
|
+
2: Mode;
|
|
50
|
+
1: Mode;
|
|
51
|
+
3: Mode;
|
|
52
|
+
4: Mode;
|
|
53
|
+
5: Mode;
|
|
54
|
+
};
|
|
55
|
+
export declare const DEFAULT_FIELD_NAMES: {
|
|
56
|
+
label: string;
|
|
57
|
+
value: string;
|
|
58
|
+
children: string;
|
|
59
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { DefaultOptionType, FieldNames } from '../interface';
|
|
2
|
+
export interface SelectStateContextType {
|
|
3
|
+
/**
|
|
4
|
+
* 当前选中的值
|
|
5
|
+
*/
|
|
6
|
+
value: string | number | Array<string | number> | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* 设置当前选中的值
|
|
9
|
+
*/
|
|
10
|
+
setValue: (value: string | number | Array<string | number> | undefined, options: DefaultOptionType | DefaultOptionType[]) => void;
|
|
11
|
+
/**
|
|
12
|
+
* 是否打开浮层面板
|
|
13
|
+
*/
|
|
14
|
+
isOpen: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* 设置是否打开浮层面板
|
|
17
|
+
*/
|
|
18
|
+
setIsOpen: (isOpen: boolean) => void;
|
|
19
|
+
}
|
|
20
|
+
declare const SelectStateContext: import('react').Context<SelectStateContextType>;
|
|
21
|
+
export interface SelectConfigContextType {
|
|
22
|
+
fieldNames: FieldNames;
|
|
23
|
+
disabled: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* 【其他】选项输入框的展示位置
|
|
26
|
+
*/
|
|
27
|
+
otherInputPosition?: 'bottom' | 'inline';
|
|
28
|
+
}
|
|
29
|
+
declare const SelectConfigContext: import('react').Context<SelectConfigContextType>;
|
|
30
|
+
export interface SelectOtherContextType {
|
|
31
|
+
/**
|
|
32
|
+
* 是否选中了【其他】选项
|
|
33
|
+
*/
|
|
34
|
+
isSelectedOtherOption?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* 【其他】选项的输入值
|
|
37
|
+
*/
|
|
38
|
+
otherOptionValue?: string;
|
|
39
|
+
/**
|
|
40
|
+
* 设置【其他】选项的输入值
|
|
41
|
+
*/
|
|
42
|
+
setOtherOptionValue?: (value: string) => void;
|
|
43
|
+
/**
|
|
44
|
+
* 【其他】选项输入变化回调
|
|
45
|
+
*/
|
|
46
|
+
onOtherInputChange?: (value: string) => void;
|
|
47
|
+
}
|
|
48
|
+
declare const SelectOtherContext: import('react').Context<SelectOtherContextType>;
|
|
49
|
+
export declare const useSelectStateContext: () => SelectStateContextType;
|
|
50
|
+
export declare const useSelectConfigContext: () => SelectConfigContextType;
|
|
51
|
+
export declare const useSelectOtherContext: () => SelectOtherContextType;
|
|
52
|
+
export { SelectStateContext, SelectConfigContext, SelectOtherContext };
|