@zykj2024/much-library 1.0.9 → 1.0.10-beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. package/README.md +23 -23
  2. package/dist/McContainer/index.css +3 -2
  3. package/dist/McDateRange/index.d.ts +1 -1
  4. package/dist/McDateRange/index.js +1 -1
  5. package/dist/McLazyLoader/demo/basic.d.ts +2 -0
  6. package/dist/McLazyLoader/demo/basic.js +33 -0
  7. package/dist/McLazyLoader/demo/form.d.ts +2 -0
  8. package/dist/McLazyLoader/demo/form.js +38 -0
  9. package/dist/McLazyLoader/demo/has-root.d.ts +2 -0
  10. package/dist/McLazyLoader/demo/has-root.js +44 -0
  11. package/dist/McLazyLoader/index.d.ts +28 -0
  12. package/dist/McLazyLoader/index.js +69 -0
  13. package/dist/McProSelect/demo/async.d.ts +2 -0
  14. package/dist/McProSelect/demo/async.js +66 -0
  15. package/dist/McProSelect/demo/base.d.ts +2 -0
  16. package/dist/McProSelect/demo/base.js +29 -0
  17. package/dist/McProSelect/demo/exclusion-async-rename.d.ts +3 -0
  18. package/dist/McProSelect/demo/exclusion-async-rename.js +103 -0
  19. package/dist/McProSelect/demo/exclusion-rename.d.ts +3 -0
  20. package/dist/McProSelect/demo/exclusion-rename.js +74 -0
  21. package/dist/McProSelect/demo/exclusion.d.ts +3 -0
  22. package/dist/McProSelect/demo/exclusion.js +70 -0
  23. package/dist/McProSelect/demo/require.d.ts +2 -0
  24. package/dist/McProSelect/demo/require.js +82 -0
  25. package/dist/McProSelect/index.d.ts +35 -0
  26. package/dist/McProSelect/index.js +152 -0
  27. package/dist/McSelect/components/PanelSearchInput/index.css +6 -0
  28. package/dist/McSelect/components/PanelSearchInput/index.d.ts +12 -0
  29. package/dist/McSelect/components/PanelSearchInput/index.js +45 -0
  30. package/dist/McSelect/demo/exclusion.d.ts +3 -0
  31. package/dist/McSelect/demo/exclusion.js +64 -0
  32. package/dist/McSelect/demo/fetchOptions.js +1 -0
  33. package/dist/McSelect/index.d.ts +9 -2
  34. package/dist/McSelect/index.js +101 -15
  35. package/dist/McTag/demo/demo1.d.ts +2 -0
  36. package/dist/McTag/demo/demo1.js +18 -0
  37. package/dist/McTag/demo/demo2.d.ts +2 -0
  38. package/dist/McTag/demo/demo2.js +20 -0
  39. package/dist/McTag/demo/demo3.d.ts +2 -0
  40. package/dist/McTag/demo/demo3.js +19 -0
  41. package/dist/McTag/demo/demo4.d.ts +2 -0
  42. package/dist/McTag/demo/demo4.js +22 -0
  43. package/dist/McTag/index.d.ts +22 -0
  44. package/dist/McTag/index.js +59 -0
  45. package/dist/McThemeConfig/customToken.json +2 -1
  46. package/dist/McThemeConfig/demo/radio.js +39 -0
  47. package/dist/McThemeConfig/globalStyle.js +10 -4
  48. package/dist/McThemeConfig/themeToken.json +1 -1
  49. package/dist/Utils/index.d.ts +5 -4
  50. package/dist/Utils/index.js +6 -26
  51. package/dist/index.d.ts +5 -2
  52. package/dist/index.js +5 -2
  53. package/package.json +4 -2
@@ -0,0 +1,70 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ /**
3
+ * title: 静态option + 两个互斥的select
4
+ * description: select1中选择的选项会在select2中被排除,反之亦然。此方法同样支持远程select。
5
+ */
6
+ import { Form } from 'antd';
7
+ import { useForm } from 'antd/es/form/Form';
8
+ import { McProSelect } from "../..";
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ import { jsxs as _jsxs } from "react/jsx-runtime";
11
+ var options = [{
12
+ label: 'goldLabel',
13
+ value: 'gold'
14
+ }, {
15
+ label: 'limeLabel',
16
+ value: 'lime'
17
+ }, {
18
+ label: 'greenLabel',
19
+ value: 'green'
20
+ }, {
21
+ label: 'cyanLabel',
22
+ value: 'cyan'
23
+ }];
24
+ var App = function App() {
25
+ var _useForm = useForm(),
26
+ _useForm2 = _slicedToArray(_useForm, 1),
27
+ form = _useForm2[0];
28
+ return /*#__PURE__*/_jsxs(Form, {
29
+ form: form,
30
+ name: "exclusion2",
31
+ children: [/*#__PURE__*/_jsx(Form.Item, {
32
+ noStyle: true
33
+ // 也可以用dependencies
34
+ ,
35
+ shouldUpdate: function shouldUpdate(prev, next) {
36
+ return prev['select2'] !== next['select2'];
37
+ },
38
+ children: function children(_ref) {
39
+ var _getFieldValue;
40
+ var getFieldValue = _ref.getFieldValue;
41
+ return /*#__PURE__*/_jsx(McProSelect, {
42
+ label: "select1",
43
+ name: "select1",
44
+ tooltip: "\u7531JAVA spring\u6846\u67B6\u7BA1\u7406\u7684bean\u5B9E\u4F8B\u540D\u79F0",
45
+ excludeIds: [(_getFieldValue = getFieldValue('select2')) === null || _getFieldValue === void 0 ? void 0 : _getFieldValue.value],
46
+ fieldProps: {
47
+ options: options
48
+ }
49
+ });
50
+ }
51
+ }), /*#__PURE__*/_jsx(Form.Item, {
52
+ noStyle: true,
53
+ dependencies: ['select1'],
54
+ children: function children(_ref2) {
55
+ var _getFieldValue2;
56
+ var getFieldValue = _ref2.getFieldValue;
57
+ return /*#__PURE__*/_jsx(McProSelect, {
58
+ label: "select2",
59
+ name: "select2",
60
+ tooltip: "\u7531JAVA spring\u6846\u67B6\u7BA1\u7406\u7684bean\u5B9E\u4F8B\u540D\u79F02",
61
+ excludeIds: [(_getFieldValue2 = getFieldValue('select1')) === null || _getFieldValue2 === void 0 ? void 0 : _getFieldValue2.value],
62
+ fieldProps: {
63
+ options: options
64
+ }
65
+ });
66
+ }
67
+ })]
68
+ });
69
+ };
70
+ export default App;
@@ -0,0 +1,2 @@
1
+ declare const requireDemo: () => import("react/jsx-runtime").JSX.Element;
2
+ export default requireDemo;
@@ -0,0 +1,82 @@
1
+ /**
2
+ * title: 内置为空校验
3
+ * description: 为空校验。required为true时,会自动校验是否为空。可通过设置required为string类型,自定义提示信息。
4
+ */
5
+ import { Flex, Form } from 'antd';
6
+ import { McProSelect } from "../..";
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ import { jsxs as _jsxs } from "react/jsx-runtime";
9
+ var requireDemo = function requireDemo() {
10
+ return /*#__PURE__*/_jsx(Form, {
11
+ children: /*#__PURE__*/_jsxs(Flex, {
12
+ gap: "middle",
13
+ justify: "space-between",
14
+ children: [/*#__PURE__*/_jsx(McProSelect, {
15
+ name: "select1",
16
+ label: "select1",
17
+ fieldProps: {
18
+ defaultValue: 'lucy',
19
+ options: [{
20
+ value: 'jack',
21
+ label: 'Jack'
22
+ }, {
23
+ value: 'lucy',
24
+ label: 'Lucy'
25
+ }, {
26
+ value: 'Yiminghe',
27
+ label: 'yiminghe'
28
+ }, {
29
+ value: 'disabled',
30
+ label: 'Disabled',
31
+ disabled: true
32
+ }]
33
+ },
34
+ required: "\u8BF7\u9009\u62E9select1"
35
+ }), /*#__PURE__*/_jsx(McProSelect, {
36
+ name: "select2",
37
+ label: "select2",
38
+ fieldProps: {
39
+ defaultValue: 'lucy',
40
+ options: [{
41
+ value: 'jack',
42
+ label: 'Jack'
43
+ }, {
44
+ value: 'lucy',
45
+ label: 'Lucy'
46
+ }, {
47
+ value: 'Yiminghe',
48
+ label: 'yiminghe'
49
+ }, {
50
+ value: 'disabled',
51
+ label: 'Disabled',
52
+ disabled: true
53
+ }]
54
+ },
55
+ required: true
56
+ }), /*#__PURE__*/_jsx(McProSelect, {
57
+ name: "select3",
58
+ label: "select3",
59
+ multiple: true,
60
+ fieldProps: {
61
+ defaultValue: 'lucy',
62
+ options: [{
63
+ value: 'jack',
64
+ label: 'Jack'
65
+ }, {
66
+ value: 'lucy',
67
+ label: 'Lucy'
68
+ }, {
69
+ value: 'Yiminghe',
70
+ label: 'yiminghe'
71
+ }, {
72
+ value: 'disabled',
73
+ label: 'Disabled',
74
+ disabled: true
75
+ }]
76
+ },
77
+ required: true
78
+ })]
79
+ })
80
+ });
81
+ };
82
+ export default requireDemo;
@@ -0,0 +1,35 @@
1
+ import { FormItemProps } from 'antd/es/form/FormItem';
2
+ import { McSelectProps, Option } from '../McSelect';
3
+ type McProselectOptions<T> = (T & Partial<Pick<Option, 'title' | 'disabled'>> & {
4
+ extra?: T;
5
+ })[] | undefined;
6
+ type McProSelectProps<T = {
7
+ label: string;
8
+ value: string;
9
+ }> = Omit<FormItemProps, 'required'> & {
10
+ multiple?: boolean;
11
+ /** 默认为keyword */
12
+ searchKey?: string;
13
+ /** 为string时表示未填写时的提示文案 */
14
+ required?: boolean | string;
15
+ disabled?: boolean;
16
+ excludeIds?: (string | number)[];
17
+ fieldNames?: {
18
+ label?: keyof T;
19
+ value?: keyof T;
20
+ };
21
+ fieldProps?: Omit<McSelectProps, 'multiple' | 'fetchOption' | 'toFilterOptions' | 'options'> & {
22
+ options: McProselectOptions<T>;
23
+ };
24
+ request?: (params: {
25
+ current: number;
26
+ pageSize: number;
27
+ [key: string]: number | string;
28
+ }) => Promise<{
29
+ records: T[];
30
+ total: number;
31
+ [key: string]: any;
32
+ }>;
33
+ };
34
+ declare const McProSelect: <T extends Record<string, any>>({ label, name, fieldNames, required, request, multiple, disabled, searchKey, excludeIds, fieldProps, ...restProps }: McProSelectProps<T>) => import("react/jsx-runtime").JSX.Element;
35
+ export default McProSelect;
@@ -0,0 +1,152 @@
1
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
2
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
5
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
6
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
7
+ var _excluded = ["label", "name", "fieldNames", "required", "request", "multiple", "disabled", "searchKey", "excludeIds", "fieldProps"],
8
+ _excluded2 = ["options"],
9
+ _excluded3 = ["getValueFromEvent", "getValueProps", "rules"],
10
+ _excluded4 = ["current", "keyword"];
11
+ import { Form } from 'antd';
12
+ import { useMemo } from 'react';
13
+ import McSelect from "../McSelect";
14
+ import { isEmpty, isNil } from "../Utils";
15
+ import { jsx as _jsx } from "react/jsx-runtime";
16
+ var McProSelect = function McProSelect(_ref) {
17
+ var label = _ref.label,
18
+ name = _ref.name,
19
+ fieldNames = _ref.fieldNames,
20
+ required = _ref.required,
21
+ request = _ref.request,
22
+ multiple = _ref.multiple,
23
+ disabled = _ref.disabled,
24
+ _ref$searchKey = _ref.searchKey,
25
+ searchKey = _ref$searchKey === void 0 ? 'keyword' : _ref$searchKey,
26
+ excludeIds = _ref.excludeIds,
27
+ fieldProps = _ref.fieldProps,
28
+ restProps = _objectWithoutProperties(_ref, _excluded);
29
+ var labelKey = (fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.label) || 'label';
30
+ var valueKey = (fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value) || 'value';
31
+ var _ref2 = fieldProps !== null && fieldProps !== void 0 ? fieldProps : {},
32
+ optionsFromFieldProps = _ref2.options,
33
+ restFieldProps = _objectWithoutProperties(_ref2, _excluded2);
34
+ var customGetValueFromEvent = restProps.getValueFromEvent,
35
+ customGetValueProps = restProps.getValueProps,
36
+ rules = restProps.rules,
37
+ restFormItemProps = _objectWithoutProperties(restProps, _excluded3);
38
+
39
+ // 生成用fieldNames映射后的options
40
+ var createReflectedOptions = function createReflectedOptions(options) {
41
+ if (!options) return undefined;
42
+ return options.map(function (item) {
43
+ var _item$title;
44
+ return {
45
+ label: item[labelKey !== null && labelKey !== void 0 ? labelKey : 'label'],
46
+ value: item[valueKey !== null && valueKey !== void 0 ? valueKey : 'value'],
47
+ title: (_item$title = item.title) !== null && _item$title !== void 0 ? _item$title : '',
48
+ disabled: !!item.disabled,
49
+ extra: item
50
+ };
51
+ });
52
+ };
53
+
54
+ // 静态option
55
+ var staticOption = useMemo(function () {
56
+ // 非异步请求时,根据fieldNames转换为label&value格式
57
+ if (optionsFromFieldProps && optionsFromFieldProps.length > 0) {
58
+ return createReflectedOptions(optionsFromFieldProps);
59
+ }
60
+ return undefined;
61
+ }, [optionsFromFieldProps]);
62
+ var getValueProps = function getValueProps(value) {
63
+ var _label$value;
64
+ if (customGetValueProps) {
65
+ return customGetValueProps(value);
66
+ }
67
+ if (isNil(value)) return {
68
+ value: value
69
+ };
70
+ return {
71
+ value: multiple ? (value === null || value === void 0 ? void 0 : value.map(function (x) {
72
+ return {
73
+ label: x[labelKey],
74
+ value: x[valueKey]
75
+ };
76
+ })) || [] : (_label$value = {
77
+ label: value === null || value === void 0 ? void 0 : value[labelKey],
78
+ value: value === null || value === void 0 ? void 0 : value[valueKey]
79
+ }) !== null && _label$value !== void 0 ? _label$value : undefined
80
+ };
81
+ };
82
+ var getValueFromEvent = function getValueFromEvent(_selectedValues, options) {
83
+ var _options$map, _options$extra;
84
+ if (customGetValueFromEvent) return customGetValueFromEvent(_selectedValues, options);
85
+ if (!_selectedValues) return undefined;
86
+ // 如果其他业务要的value是number[], 不是option,需要修改这里。用到的时候再修改吧
87
+ if (multiple) return (_options$map = options === null || options === void 0 ? void 0 : options.map(function (item) {
88
+ var _item$extra;
89
+ return (_item$extra = item.extra) !== null && _item$extra !== void 0 ? _item$extra : item;
90
+ })) !== null && _options$map !== void 0 ? _options$map : [];
91
+ return (_options$extra = options === null || options === void 0 ? void 0 : options.extra) !== null && _options$extra !== void 0 ? _options$extra : options;
92
+ };
93
+ var requiredMsg = typeof required === 'string' ? required : '请选择';
94
+ return /*#__PURE__*/_jsx(Form.Item, _objectSpread(_objectSpread({
95
+ label: label,
96
+ name: name,
97
+ getValueProps: getValueProps,
98
+ getValueFromEvent: getValueFromEvent,
99
+ rules: required ? [{
100
+ required: true,
101
+ message: requiredMsg,
102
+ validator: function validator(_, value) {
103
+ if (isNil(value) || isEmpty(value)) return Promise.reject(new Error(requiredMsg));
104
+ return Promise.resolve();
105
+ }
106
+ }].concat(_toConsumableArray(restProps.rules || [])) : rules
107
+ }, restFormItemProps), {}, {
108
+ children: /*#__PURE__*/_jsx(McSelect, _objectSpread(_objectSpread({
109
+ multiple: multiple,
110
+ showSearch: true,
111
+ maxTagCount: undefined,
112
+ toFilterOptions: function toFilterOptions(options) {
113
+ if (!excludeIds || excludeIds.filter(Boolean).length === 0) return options;
114
+ return options.filter(function (option) {
115
+ return !excludeIds.includes(option.value);
116
+ });
117
+ },
118
+ fetchOptions: request ? ( /*#__PURE__*/function () {
119
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
120
+ var _createReflectedOptio, _result$total;
121
+ var current, keyword, rest, result;
122
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
123
+ while (1) switch (_context.prev = _context.next) {
124
+ case 0:
125
+ current = params.current, keyword = params.keyword, rest = _objectWithoutProperties(params, _excluded4);
126
+ _context.next = 3;
127
+ return request(_objectSpread(_objectSpread({}, rest), {}, _defineProperty({
128
+ current: current !== null && current !== void 0 ? current : 1
129
+ }, searchKey, keyword)));
130
+ case 3:
131
+ result = _context.sent;
132
+ return _context.abrupt("return", {
133
+ data: (_createReflectedOptio = createReflectedOptions(result === null || result === void 0 ? void 0 : result.records)) !== null && _createReflectedOptio !== void 0 ? _createReflectedOptio : [],
134
+ total: (_result$total = result === null || result === void 0 ? void 0 : result.total) !== null && _result$total !== void 0 ? _result$total : 0
135
+ });
136
+ case 5:
137
+ case "end":
138
+ return _context.stop();
139
+ }
140
+ }, _callee);
141
+ }));
142
+ return function (_x) {
143
+ return _ref3.apply(this, arguments);
144
+ };
145
+ }()) : undefined,
146
+ options: staticOption
147
+ }, restFieldProps), {}, {
148
+ disabled: disabled
149
+ }))
150
+ }));
151
+ };
152
+ export default McProSelect;
@@ -0,0 +1,6 @@
1
+ .mc-search-input__container {
2
+ margin: 8px;
3
+ }
4
+ .mc-search-input {
5
+ width: '100%';
6
+ }
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import './index.less';
3
+ interface PanelSearchInputProps {
4
+ placeholder: string | undefined;
5
+ searchValue: string | undefined;
6
+ onSearch: (e: string | undefined) => void;
7
+ }
8
+ export interface PanelSearchInputRef {
9
+ focus: () => void;
10
+ }
11
+ declare const _default: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<PanelSearchInputProps & import("react").RefAttributes<PanelSearchInputRef>>>;
12
+ export default _default;
@@ -0,0 +1,45 @@
1
+ import { SearchOutlined } from 'much-icons';
2
+ import { forwardRef, memo, useEffect, useImperativeHandle, useRef } from 'react';
3
+ import McInput from "../../../McInput";
4
+ import "./index.css";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ var PanelSearchInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
7
+ var placeholder = _ref.placeholder,
8
+ onSearch = _ref.onSearch,
9
+ searchValue = _ref.searchValue;
10
+ var inputRef = useRef(null);
11
+ var focus = function focus() {
12
+ if (inputRef.current) {
13
+ setTimeout(function () {
14
+ var _inputRef$current;
15
+ (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus({
16
+ cursor: 'all'
17
+ });
18
+ }, 200);
19
+ }
20
+ };
21
+ useEffect(focus, []);
22
+ useImperativeHandle(ref, function () {
23
+ return {
24
+ focus: focus
25
+ };
26
+ });
27
+ return /*#__PURE__*/_jsx("div", {
28
+ className: "mc-search-input__container",
29
+ children: /*#__PURE__*/_jsx(McInput, {
30
+ ref: inputRef,
31
+ className: "mc-search-input",
32
+ placeholder: placeholder || '请输入搜索内容',
33
+ value: searchValue,
34
+ onKeyDown: function onKeyDown(e) {
35
+ // 避免触发原select的keydown,比如删除选项等不符预期的操作
36
+ if (['Backspace', 'Delete', 'Enter'].includes(e.key)) {
37
+ e.stopPropagation();
38
+ }
39
+ },
40
+ onChange: onSearch,
41
+ suffix: /*#__PURE__*/_jsx(SearchOutlined, {})
42
+ })
43
+ });
44
+ });
45
+ export default /*#__PURE__*/memo(PanelSearchInput);
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const App: React.FC;
3
+ export default App;
@@ -0,0 +1,64 @@
1
+ /**
2
+ * title: 两个互斥的select
3
+ * description: select1中选择的选项会在select2中被排除,反之亦然。此方法同样支持远程select。
4
+ */
5
+ import { Form } from 'antd';
6
+ import { McSelect } from "../..";
7
+ import React from 'react';
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ import { jsxs as _jsxs } from "react/jsx-runtime";
10
+ var options = [{
11
+ value: 'gold'
12
+ }, {
13
+ value: 'lime'
14
+ }, {
15
+ value: 'green'
16
+ }, {
17
+ value: 'cyan'
18
+ }];
19
+ var App = function App() {
20
+ return /*#__PURE__*/_jsxs(Form, {
21
+ name: "exclusion1",
22
+ children: [/*#__PURE__*/_jsx(Form.Item, {
23
+ noStyle: true,
24
+ dependencies: ['select2'],
25
+ children: function children(_ref) {
26
+ var getFieldValue = _ref.getFieldValue;
27
+ return /*#__PURE__*/_jsx(Form.Item, {
28
+ name: "select1",
29
+ children: /*#__PURE__*/_jsx(McSelect, {
30
+ options: options,
31
+ label: "select1",
32
+ toFilterOptions: function toFilterOptions(options) {
33
+ return options.filter(function (option) {
34
+ return option.value !== getFieldValue('select2');
35
+ });
36
+ }
37
+ })
38
+ });
39
+ }
40
+ }), /*#__PURE__*/_jsx(Form.Item, {
41
+ noStyle: true,
42
+ dependencies: ['select1'],
43
+ children: function children(_ref2) {
44
+ var getFieldValue = _ref2.getFieldValue;
45
+ return /*#__PURE__*/_jsx(Form.Item, {
46
+ label: "select2",
47
+ name: "select2",
48
+ children: /*#__PURE__*/_jsx(McSelect, {
49
+ style: {
50
+ width: '100%'
51
+ },
52
+ options: options,
53
+ toFilterOptions: function toFilterOptions(options) {
54
+ return options.filter(function (option) {
55
+ return option.value !== getFieldValue('select1');
56
+ });
57
+ }
58
+ })
59
+ });
60
+ }
61
+ })]
62
+ });
63
+ };
64
+ export default App;
@@ -130,6 +130,7 @@ export default (function () {
130
130
  return _ref3.apply(this, arguments);
131
131
  };
132
132
  }()),
133
+ searchInPanel: true,
133
134
  multiple: true,
134
135
  onChange: setMultipleValue
135
136
  }), /*#__PURE__*/_jsx(McSelect, {
@@ -1,7 +1,7 @@
1
1
  import { SelectProps } from 'antd';
2
2
  import { CSSProperties, FC, ReactNode } from 'react';
3
3
  import './index.less';
4
- interface Option {
4
+ export interface Option {
5
5
  value: string | number;
6
6
  label?: React.ReactNode;
7
7
  title?: string;
@@ -25,6 +25,8 @@ export type FetchOptions = (params: {
25
25
  export type McSelectProps = Omit<SelectProps, 'mode' | 'fieldNames'> & {
26
26
  style?: CSSProperties;
27
27
  className?: string;
28
+ /** 外部控制展示的options */
29
+ toFilterOptions?: (options: Option[]) => Option[];
28
30
  name?: string;
29
31
  label?: ReactNode;
30
32
  multiple?: boolean;
@@ -34,7 +36,12 @@ export type McSelectProps = Omit<SelectProps, 'mode' | 'fieldNames'> & {
34
36
  pageSize?: number;
35
37
  extra?: any;
36
38
  options?: Option[];
37
- [key: string]: any;
39
+ /** 仅多选生效。默认为false,在下拉框中展示搜索框,会影响回车生成新标签等功能 */
40
+ searchInPanel?: boolean;
41
+ /** 搜索框提示文字 */
42
+ searchInPanelPlaceholder?: string;
43
+ /** 仅多选+("非远程"或"远程+labelvalue"")生效。默认为false,将选中项置顶。 */
44
+ pinSelectedOptions?: boolean;
38
45
  };
39
46
  declare const McSelect: FC<McSelectProps>;
40
47
  export default McSelect;