@tdm-design/ui 0.0.14 → 0.0.16
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/@tdm-design/ui.js +113056 -0
- package/dist/@tdm-design/ui.js.map +1 -0
- package/dist/@tdm-design/ui.min.js +369 -0
- package/dist/@tdm-design/ui.min.js.LICENSE.txt +129 -0
- package/dist/@tdm-design/ui.min.js.map +1 -0
- package/dist/reset.css +246 -0
- package/dist/tdm-with-locales.js +369 -0
- package/dist/tdm-with-locales.js.LICENSE.txt +129 -0
- package/dist/tdm-with-locales.js.map +1 -0
- package/dist/tdm.css +1 -0
- package/es/config-provider/context.d.ts +1 -1
- package/es/drawer/style/index.js +5 -1
- package/es/index.d.ts +2 -2
- package/es/index.js +1 -1
- package/es/modal/style/confirm.js +6 -2
- package/es/modal/style/index.js +7 -2
- package/es/select/Select.d.ts +130 -0
- package/es/select/Select.js +333 -0
- package/es/select/SingleDisplaySelect.d.ts +5 -0
- package/es/select/SingleDisplaySelect.js +153 -0
- package/es/select/SortableSelect.d.ts +5 -0
- package/es/select/SortableSelect.js +173 -0
- package/es/select/index.d.ts +7 -124
- package/es/select/index.js +7 -274
- package/es/select/style/select-input-multiple.js +4 -1
- package/es/version/token.json +1 -1
- package/es/version/version.d.ts +1 -1
- package/es/version/version.js +1 -1
- package/lib/config-provider/context.d.ts +1 -1
- package/lib/drawer/style/index.js +5 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +14 -1
- package/lib/modal/style/confirm.js +6 -2
- package/lib/modal/style/index.js +7 -2
- package/lib/select/Select.d.ts +130 -0
- package/lib/select/Select.js +340 -0
- package/lib/select/SingleDisplaySelect.d.ts +5 -0
- package/lib/select/SingleDisplaySelect.js +160 -0
- package/lib/select/SortableSelect.d.ts +5 -0
- package/lib/select/SortableSelect.js +180 -0
- package/lib/select/index.d.ts +7 -124
- package/lib/select/index.js +32 -274
- package/lib/select/style/select-input-multiple.js +4 -1
- package/lib/version/token.json +1 -1
- package/lib/version/version.d.ts +1 -1
- package/lib/version/version.js +1 -1
- package/package.json +11 -4
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _Select = _interopRequireDefault(require("./Select"));
|
|
11
|
+
var _popover = _interopRequireDefault(require("../popover"));
|
|
12
|
+
var _tag = _interopRequireDefault(require("../tag"));
|
|
13
|
+
var _configProvider = require("../config-provider");
|
|
14
|
+
var _CloseOutlinedIcon = _interopRequireDefault(require("@tdm-design/icons/CloseOutlinedIcon"));
|
|
15
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
16
|
+
function extractValueId(val) {
|
|
17
|
+
if (typeof val === 'object' && val !== null) {
|
|
18
|
+
if ('key' in val && val.key !== undefined) return val.key;
|
|
19
|
+
if ('value' in val && val.value !== undefined) return val.value;
|
|
20
|
+
}
|
|
21
|
+
return val;
|
|
22
|
+
}
|
|
23
|
+
const SingleDisplaySelect = props => {
|
|
24
|
+
const {
|
|
25
|
+
value,
|
|
26
|
+
defaultValue,
|
|
27
|
+
onChange,
|
|
28
|
+
disabled,
|
|
29
|
+
tagRender,
|
|
30
|
+
maxTagPlaceholder,
|
|
31
|
+
prefixCls: customizePrefixCls,
|
|
32
|
+
...restProps
|
|
33
|
+
} = props;
|
|
34
|
+
const {
|
|
35
|
+
getPrefixCls
|
|
36
|
+
} = _react.default.useContext(_configProvider.ConfigContext);
|
|
37
|
+
const prefixCls = getPrefixCls('select', customizePrefixCls);
|
|
38
|
+
// Maintain internal state for uncontrolled usage
|
|
39
|
+
const [internalValue, setInternalValue] = (0, _react.useState)(() => {
|
|
40
|
+
if (value !== undefined) return value;
|
|
41
|
+
if (defaultValue !== undefined) return defaultValue;
|
|
42
|
+
return [];
|
|
43
|
+
});
|
|
44
|
+
// Keep track of the options to properly call onChange
|
|
45
|
+
const [internalOptions, setInternalOptions] = (0, _react.useState)([]);
|
|
46
|
+
// Sync with controlled value
|
|
47
|
+
(0, _react.useEffect)(() => {
|
|
48
|
+
if (value !== undefined) {
|
|
49
|
+
setInternalValue(value);
|
|
50
|
+
}
|
|
51
|
+
}, [value]);
|
|
52
|
+
// Sync internalOptions when value changes externally if possible
|
|
53
|
+
// In a real scenario we'd need to lookup options from the list if we don't have them
|
|
54
|
+
// For simplicity we just rely on onChange to provide them.
|
|
55
|
+
const handleChange = (val, opt) => {
|
|
56
|
+
if (value === undefined) {
|
|
57
|
+
setInternalValue(val);
|
|
58
|
+
}
|
|
59
|
+
setInternalOptions(opt);
|
|
60
|
+
onChange?.(val, opt);
|
|
61
|
+
};
|
|
62
|
+
const handleRemove = (itemValue, e) => {
|
|
63
|
+
e.preventDefault();
|
|
64
|
+
e.stopPropagation();
|
|
65
|
+
const prevArray = Array.isArray(internalValue) ? internalValue : [];
|
|
66
|
+
const newValue = prevArray.filter(v => extractValueId(v) !== itemValue);
|
|
67
|
+
// We try to filter internalOptions, if it's not maintained correctly, we might pass []
|
|
68
|
+
// which is better than passing the wrong options.
|
|
69
|
+
const newOptions = Array.isArray(internalOptions) ? internalOptions.filter(opt => extractValueId(opt.value) !== itemValue) : [];
|
|
70
|
+
handleChange(newValue, newOptions);
|
|
71
|
+
};
|
|
72
|
+
const defaultTagRender = (0, _react.useCallback)(tagProps => {
|
|
73
|
+
const {
|
|
74
|
+
label,
|
|
75
|
+
closable,
|
|
76
|
+
onClose,
|
|
77
|
+
disabled: itemDisabled
|
|
78
|
+
} = tagProps;
|
|
79
|
+
const onMouseDown = e => {
|
|
80
|
+
e.preventDefault();
|
|
81
|
+
e.stopPropagation();
|
|
82
|
+
};
|
|
83
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
84
|
+
className: `${prefixCls}-selection-item${itemDisabled ? ` ${prefixCls}-selection-item-disabled` : ''}`,
|
|
85
|
+
onMouseDown: onMouseDown
|
|
86
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
87
|
+
className: `${prefixCls}-selection-item-content`
|
|
88
|
+
}, label), closable && (/*#__PURE__*/_react.default.createElement("span", {
|
|
89
|
+
className: `${prefixCls}-selection-item-remove`,
|
|
90
|
+
onClick: e => {
|
|
91
|
+
e.stopPropagation();
|
|
92
|
+
onClose?.(e);
|
|
93
|
+
},
|
|
94
|
+
onMouseDown: onMouseDown
|
|
95
|
+
}, /*#__PURE__*/_react.default.createElement(_CloseOutlinedIcon.default, null))));
|
|
96
|
+
}, [prefixCls]);
|
|
97
|
+
const mergedTagRender = tagRender || defaultTagRender;
|
|
98
|
+
const defaultMaxTagPlaceholder = (0, _react.useCallback)(omittedValues => {
|
|
99
|
+
return /*#__PURE__*/_react.default.createElement(_popover.default, {
|
|
100
|
+
content: /*#__PURE__*/_react.default.createElement("div", {
|
|
101
|
+
style: {
|
|
102
|
+
display: 'flex',
|
|
103
|
+
flexWrap: 'wrap',
|
|
104
|
+
gap: 6,
|
|
105
|
+
maxWidth: 350,
|
|
106
|
+
padding: 8
|
|
107
|
+
}
|
|
108
|
+
}, omittedValues.map(v => (/*#__PURE__*/_react.default.createElement(_tag.default, {
|
|
109
|
+
key: extractValueId(v.value),
|
|
110
|
+
closable: !disabled && !v.disabled,
|
|
111
|
+
closeIcon: /*#__PURE__*/_react.default.createElement("span", {
|
|
112
|
+
style: {
|
|
113
|
+
fontSize: 10,
|
|
114
|
+
display: 'inline-flex',
|
|
115
|
+
alignItems: 'center',
|
|
116
|
+
marginLeft: 6
|
|
117
|
+
}
|
|
118
|
+
}, "\u2715"),
|
|
119
|
+
onClose: e => handleRemove(extractValueId(v.value), e),
|
|
120
|
+
style: {
|
|
121
|
+
margin: 0,
|
|
122
|
+
display: 'flex',
|
|
123
|
+
alignItems: 'center',
|
|
124
|
+
padding: '2px 6px',
|
|
125
|
+
borderRadius: 4
|
|
126
|
+
}
|
|
127
|
+
}, v.label)))),
|
|
128
|
+
placement: "top",
|
|
129
|
+
trigger: "hover"
|
|
130
|
+
}, /*#__PURE__*/_react.default.createElement("span", null, "+", omittedValues.length, " ..."));
|
|
131
|
+
}, [disabled, internalValue, internalOptions]);
|
|
132
|
+
const mergedMaxTagPlaceholder = maxTagPlaceholder || defaultMaxTagPlaceholder;
|
|
133
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("style", null, `
|
|
134
|
+
.tdm-single-display-select .${prefixCls}-selector {
|
|
135
|
+
align-items: center !important;
|
|
136
|
+
}
|
|
137
|
+
.tdm-single-display-select .${prefixCls}-selection-item {
|
|
138
|
+
margin-top: 0 !important;
|
|
139
|
+
margin-bottom: 0 !important;
|
|
140
|
+
max-width: 100% !important;
|
|
141
|
+
}
|
|
142
|
+
.tdm-single-display-select .${prefixCls}-content-item {
|
|
143
|
+
max-width: 100% !important;
|
|
144
|
+
}
|
|
145
|
+
.tdm-single-display-select .${prefixCls}-selection-overflow-item {
|
|
146
|
+
max-width: 100% !important;
|
|
147
|
+
}
|
|
148
|
+
`), /*#__PURE__*/_react.default.createElement(_Select.default, {
|
|
149
|
+
...restProps,
|
|
150
|
+
className: `tdm-single-display-select ${restProps.className || ''}`,
|
|
151
|
+
mode: restProps.mode || 'multiple',
|
|
152
|
+
value: internalValue,
|
|
153
|
+
onChange: handleChange,
|
|
154
|
+
disabled: disabled,
|
|
155
|
+
maxTagCount: restProps.maxTagCount !== undefined ? restProps.maxTagCount : 1,
|
|
156
|
+
tagRender: mergedTagRender,
|
|
157
|
+
maxTagPlaceholder: mergedMaxTagPlaceholder
|
|
158
|
+
}));
|
|
159
|
+
};
|
|
160
|
+
var _default = exports.default = SingleDisplaySelect;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { SelectProps, BaseOptionType, DefaultOptionType } from './Select';
|
|
3
|
+
export type SortableSelectProps<ValueType = any, OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType> = SelectProps<ValueType, OptionType>;
|
|
4
|
+
declare const SortableSelect: <ValueType extends any[] = any[], OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType>(props: SortableSelectProps<ValueType, OptionType>) => React.JSX.Element;
|
|
5
|
+
export default SortableSelect;
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _Select = _interopRequireDefault(require("./Select"));
|
|
11
|
+
var _core = require("@dnd-kit/core");
|
|
12
|
+
var _sortable = require("@dnd-kit/sortable");
|
|
13
|
+
var _utilities = require("@dnd-kit/utilities");
|
|
14
|
+
var _configProvider = require("../config-provider");
|
|
15
|
+
var _CloseOutlinedIcon = _interopRequireDefault(require("@tdm-design/icons/CloseOutlinedIcon"));
|
|
16
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
17
|
+
function extractValueId(val) {
|
|
18
|
+
if (typeof val === 'object' && val !== null) {
|
|
19
|
+
if ('key' in val && val.key !== undefined) return val.key;
|
|
20
|
+
if ('value' in val && val.value !== undefined) return val.value;
|
|
21
|
+
}
|
|
22
|
+
return val;
|
|
23
|
+
}
|
|
24
|
+
const DraggableTag = props => {
|
|
25
|
+
const {
|
|
26
|
+
value,
|
|
27
|
+
closable,
|
|
28
|
+
onClose,
|
|
29
|
+
label,
|
|
30
|
+
disabled,
|
|
31
|
+
prefixCls,
|
|
32
|
+
customTagRender
|
|
33
|
+
} = props;
|
|
34
|
+
const id = extractValueId(value);
|
|
35
|
+
const {
|
|
36
|
+
attributes,
|
|
37
|
+
listeners,
|
|
38
|
+
setNodeRef,
|
|
39
|
+
transform,
|
|
40
|
+
transition,
|
|
41
|
+
isDragging
|
|
42
|
+
} = (0, _sortable.useSortable)({
|
|
43
|
+
id,
|
|
44
|
+
disabled: disabled || !id
|
|
45
|
+
});
|
|
46
|
+
const mergedStyle = {
|
|
47
|
+
transform: _utilities.CSS.Transform.toString(transform),
|
|
48
|
+
transition,
|
|
49
|
+
opacity: isDragging ? 0.4 : undefined,
|
|
50
|
+
zIndex: isDragging ? 1 : undefined,
|
|
51
|
+
cursor: disabled || !id ? 'default' : 'move'
|
|
52
|
+
};
|
|
53
|
+
const onMouseDown = e => {
|
|
54
|
+
e.preventDefault();
|
|
55
|
+
e.stopPropagation();
|
|
56
|
+
};
|
|
57
|
+
if (customTagRender) {
|
|
58
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
59
|
+
ref: setNodeRef,
|
|
60
|
+
style: {
|
|
61
|
+
...mergedStyle,
|
|
62
|
+
display: 'inline-flex'
|
|
63
|
+
},
|
|
64
|
+
...attributes,
|
|
65
|
+
...listeners,
|
|
66
|
+
onMouseDown: onMouseDown
|
|
67
|
+
}, customTagRender(props));
|
|
68
|
+
}
|
|
69
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
70
|
+
ref: setNodeRef,
|
|
71
|
+
style: mergedStyle,
|
|
72
|
+
className: `${prefixCls}-selection-item${disabled ? ` ${prefixCls}-selection-item-disabled` : ''}`,
|
|
73
|
+
...attributes,
|
|
74
|
+
...listeners,
|
|
75
|
+
onMouseDown: onMouseDown
|
|
76
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
77
|
+
className: `${prefixCls}-selection-item-content`
|
|
78
|
+
}, label), closable && (/*#__PURE__*/_react.default.createElement("span", {
|
|
79
|
+
className: `${prefixCls}-selection-item-remove`,
|
|
80
|
+
onClick: e => {
|
|
81
|
+
e.stopPropagation();
|
|
82
|
+
onClose?.(e);
|
|
83
|
+
},
|
|
84
|
+
onMouseDown: e => {
|
|
85
|
+
e.preventDefault();
|
|
86
|
+
e.stopPropagation();
|
|
87
|
+
}
|
|
88
|
+
}, /*#__PURE__*/_react.default.createElement(_CloseOutlinedIcon.default, null))));
|
|
89
|
+
};
|
|
90
|
+
const SortableSelect = props => {
|
|
91
|
+
const {
|
|
92
|
+
value,
|
|
93
|
+
defaultValue,
|
|
94
|
+
onChange,
|
|
95
|
+
disabled,
|
|
96
|
+
prefixCls: customizePrefixCls,
|
|
97
|
+
tagRender: customTagRender,
|
|
98
|
+
...restProps
|
|
99
|
+
} = props;
|
|
100
|
+
const {
|
|
101
|
+
getPrefixCls
|
|
102
|
+
} = _react.default.useContext(_configProvider.ConfigContext);
|
|
103
|
+
const prefixCls = getPrefixCls('select', customizePrefixCls);
|
|
104
|
+
// Maintain internal state for uncontrolled usage
|
|
105
|
+
const [internalValue, setInternalValue] = (0, _react.useState)(() => {
|
|
106
|
+
if (value !== undefined) return value;
|
|
107
|
+
if (defaultValue !== undefined) return defaultValue;
|
|
108
|
+
return [];
|
|
109
|
+
});
|
|
110
|
+
// Sync with controlled value
|
|
111
|
+
(0, _react.useEffect)(() => {
|
|
112
|
+
if (value !== undefined) {
|
|
113
|
+
setInternalValue(value);
|
|
114
|
+
}
|
|
115
|
+
}, [value]);
|
|
116
|
+
const sensors = (0, _core.useSensors)((0, _core.useSensor)(_core.PointerSensor, {
|
|
117
|
+
activationConstraint: {
|
|
118
|
+
distance: 5
|
|
119
|
+
}
|
|
120
|
+
}), (0, _core.useSensor)(_core.KeyboardSensor, {
|
|
121
|
+
coordinateGetter: _sortable.sortableKeyboardCoordinates
|
|
122
|
+
}));
|
|
123
|
+
const handleDragEnd = (0, _react.useCallback)(event => {
|
|
124
|
+
const {
|
|
125
|
+
active,
|
|
126
|
+
over
|
|
127
|
+
} = event;
|
|
128
|
+
if (!over || active.id === over.id) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
setInternalValue(prev => {
|
|
132
|
+
const prevArray = Array.isArray(prev) ? prev : [];
|
|
133
|
+
const oldIndex = prevArray.findIndex(item => extractValueId(item) === active.id);
|
|
134
|
+
const newIndex = prevArray.findIndex(item => extractValueId(item) === over.id);
|
|
135
|
+
if (oldIndex !== -1 && newIndex !== -1) {
|
|
136
|
+
const newArray = (0, _sortable.arrayMove)(prevArray, oldIndex, newIndex);
|
|
137
|
+
// Only call onChange if the new array is actually different
|
|
138
|
+
onChange?.(newArray, []); // We skip options parameter for simplicity here
|
|
139
|
+
return newArray;
|
|
140
|
+
}
|
|
141
|
+
return prev;
|
|
142
|
+
});
|
|
143
|
+
}, [onChange]);
|
|
144
|
+
const handleChange = (val, opt) => {
|
|
145
|
+
if (value === undefined) {
|
|
146
|
+
setInternalValue(val);
|
|
147
|
+
}
|
|
148
|
+
onChange?.(val, opt);
|
|
149
|
+
};
|
|
150
|
+
const tagRender = (0, _react.useCallback)(tagProps => {
|
|
151
|
+
return /*#__PURE__*/_react.default.createElement(DraggableTag, {
|
|
152
|
+
...tagProps,
|
|
153
|
+
disabled: !!disabled,
|
|
154
|
+
prefixCls: prefixCls,
|
|
155
|
+
customTagRender: customTagRender
|
|
156
|
+
});
|
|
157
|
+
}, [disabled, prefixCls, customTagRender]);
|
|
158
|
+
// Extract sortable items
|
|
159
|
+
const items = Array.isArray(internalValue) ? internalValue.map(extractValueId) : [];
|
|
160
|
+
return /*#__PURE__*/_react.default.createElement(_core.DndContext, {
|
|
161
|
+
sensors: sensors,
|
|
162
|
+
collisionDetection: _core.closestCenter,
|
|
163
|
+
onDragEnd: handleDragEnd
|
|
164
|
+
}, /*#__PURE__*/_react.default.createElement(_sortable.SortableContext, {
|
|
165
|
+
items: items,
|
|
166
|
+
strategy: _sortable.horizontalListSortingStrategy
|
|
167
|
+
}, /*#__PURE__*/_react.default.createElement(_Select.default, {
|
|
168
|
+
...restProps,
|
|
169
|
+
mode: restProps.mode || 'multiple',
|
|
170
|
+
value: internalValue,
|
|
171
|
+
onChange: handleChange,
|
|
172
|
+
disabled: disabled,
|
|
173
|
+
prefixCls: customizePrefixCls,
|
|
174
|
+
tagRender: tagRender,
|
|
175
|
+
// Force disable maxTagCount & maxLines so all tags are rendered
|
|
176
|
+
maxTagCount: undefined,
|
|
177
|
+
maxLines: undefined
|
|
178
|
+
})));
|
|
179
|
+
};
|
|
180
|
+
var _default = exports.default = SortableSelect;
|
package/lib/select/index.d.ts
CHANGED
|
@@ -1,125 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import type { InputStatus } from '../_util/statusUtils';
|
|
9
|
-
import type { Variant } from '../config-provider';
|
|
10
|
-
import type { SizeType } from '../config-provider/SizeContext';
|
|
11
|
-
type RawValue = string | number;
|
|
12
|
-
export type { BaseOptionType, DefaultOptionType, OptionProps, BaseSelectRef as RefSelectProps };
|
|
13
|
-
export interface LabeledValue {
|
|
14
|
-
key?: string;
|
|
15
|
-
value: RawValue;
|
|
16
|
-
label: React.ReactNode;
|
|
17
|
-
}
|
|
18
|
-
export type SelectValue = RawValue | RawValue[] | LabeledValue | LabeledValue[] | undefined;
|
|
19
|
-
export interface InternalSelectProps<ValueType = any, OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType> extends Omit<RcSelectProps<ValueType, OptionType>, 'mode'> {
|
|
20
|
-
rootClassName?: string;
|
|
21
|
-
prefix?: React.ReactNode;
|
|
22
|
-
suffixIcon?: React.ReactNode;
|
|
23
|
-
size?: SizeType;
|
|
24
|
-
disabled?: boolean;
|
|
25
|
-
mode?: 'multiple' | 'tags' | 'SECRET_COMBOBOX_MODE_DO_NOT_USE' | 'combobox';
|
|
26
|
-
/** @deprecated Use `variant` instead. */
|
|
27
|
-
bordered?: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* @deprecated `showArrow` is deprecated which will be removed in next major version. It will be a
|
|
30
|
-
* default behavior, you can hide it by setting `suffixIcon` to null.
|
|
31
|
-
*/
|
|
32
|
-
showArrow?: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* @since 5.13.0
|
|
35
|
-
* @default "outlined"
|
|
36
|
-
*/
|
|
37
|
-
variant?: Variant;
|
|
38
|
-
classNames?: SelectSemanticClassNames & {
|
|
39
|
-
popup?: SelectPopupSemanticClassNames;
|
|
40
|
-
};
|
|
41
|
-
styles?: SelectSemanticStyles & {
|
|
42
|
-
popup?: SelectPopupSemanticStyles;
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* @description Whether the option is a filter item
|
|
46
|
-
* @default false
|
|
47
|
-
* @type boolean
|
|
48
|
-
* TDM_CUSTOM: custom select filter (BEGIN)
|
|
49
|
-
*/
|
|
50
|
-
isFilterItem?: boolean;
|
|
51
|
-
}
|
|
52
|
-
export type SelectSemanticName = keyof SelectSemanticClassNames & keyof SelectSemanticStyles;
|
|
53
|
-
export type SelectSemanticClassNames = {
|
|
54
|
-
root?: string;
|
|
55
|
-
prefix?: string;
|
|
56
|
-
suffix?: string;
|
|
57
|
-
input?: string;
|
|
58
|
-
placeholder?: string;
|
|
59
|
-
content?: string;
|
|
60
|
-
item?: string;
|
|
61
|
-
itemContent?: string;
|
|
62
|
-
itemRemove?: string;
|
|
63
|
-
clear?: string;
|
|
64
|
-
};
|
|
65
|
-
export type SelectSemanticStyles = {
|
|
66
|
-
root?: React.CSSProperties;
|
|
67
|
-
prefix?: React.CSSProperties;
|
|
68
|
-
suffix?: React.CSSProperties;
|
|
69
|
-
input?: React.CSSProperties;
|
|
70
|
-
placeholder?: React.CSSProperties;
|
|
71
|
-
content?: React.CSSProperties;
|
|
72
|
-
item?: React.CSSProperties;
|
|
73
|
-
itemContent?: React.CSSProperties;
|
|
74
|
-
itemRemove?: React.CSSProperties;
|
|
75
|
-
clear?: React.CSSProperties;
|
|
76
|
-
};
|
|
77
|
-
export type SelectPopupSemanticName = keyof SelectPopupSemanticClassNames & keyof SelectPopupSemanticStyles;
|
|
78
|
-
export type SelectPopupSemanticClassNames = {
|
|
79
|
-
root?: string;
|
|
80
|
-
listItem?: string;
|
|
81
|
-
list?: string;
|
|
82
|
-
};
|
|
83
|
-
export type SelectPopupSemanticStyles = {
|
|
84
|
-
root?: React.CSSProperties;
|
|
85
|
-
listItem?: React.CSSProperties;
|
|
86
|
-
list?: React.CSSProperties;
|
|
87
|
-
};
|
|
88
|
-
export type SelectClassNamesType = SemanticClassNamesType<SelectProps, SelectSemanticClassNames, {
|
|
89
|
-
popup?: SelectPopupSemanticClassNames;
|
|
90
|
-
}>;
|
|
91
|
-
export type SelectStylesType = SemanticStylesType<SelectProps, SelectSemanticStyles, {
|
|
92
|
-
popup?: SelectPopupSemanticStyles;
|
|
93
|
-
}>;
|
|
94
|
-
export interface SelectProps<ValueType = any, OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType> extends Omit<InternalSelectProps<ValueType, OptionType>, 'mode' | 'getInputElement' | 'getRawInputElement' | 'backfill' | 'placement' | 'dropdownClassName' | 'dropdownStyle'> {
|
|
95
|
-
placement?: SelectCommonPlacement;
|
|
96
|
-
mode?: 'multiple' | 'tags';
|
|
97
|
-
status?: InputStatus;
|
|
98
|
-
/** @deprecated Please use `classNames.popup.root` instead */
|
|
99
|
-
popupClassName?: string;
|
|
100
|
-
/** @deprecated Please use `classNames.popup.root` instead */
|
|
101
|
-
dropdownClassName?: string;
|
|
102
|
-
/** @deprecated Please use `styles.popup` instead */
|
|
103
|
-
dropdownStyle?: React.CSSProperties;
|
|
104
|
-
/** @deprecated Please use `popupRender` instead */
|
|
105
|
-
dropdownRender?: SelectProps['popupRender'];
|
|
106
|
-
/** @deprecated Please use `onOpenChange` instead */
|
|
107
|
-
onDropdownVisibleChange?: SelectProps['onPopupVisibleChange'];
|
|
108
|
-
/** @deprecated Please use `popupMatchSelectWidth` instead */
|
|
109
|
-
dropdownMatchSelectWidth?: boolean | number;
|
|
110
|
-
popupMatchSelectWidth?: boolean | number;
|
|
111
|
-
styles?: SelectStylesType;
|
|
112
|
-
classNames?: SelectClassNamesType;
|
|
113
|
-
onOpenChange?: (visible: boolean) => void;
|
|
114
|
-
}
|
|
115
|
-
declare const Select: (<ValueType = any, OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType>(props: React.PropsWithChildren<SelectProps<ValueType, OptionType>> & React.RefAttributes<BaseSelectRef>) => React.ReactElement) & {
|
|
116
|
-
displayName?: string;
|
|
117
|
-
SECRET_COMBOBOX_MODE_DO_NOT_USE: string;
|
|
118
|
-
/** @deprecated Please use `options` instead. */
|
|
119
|
-
Option: typeof Option;
|
|
120
|
-
/** @deprecated Please use `options` instead. */
|
|
121
|
-
OptGroup: typeof OptGroup;
|
|
122
|
-
_InternalPanelDoNotUseOrYouWillBeFired: typeof PurePanel;
|
|
123
|
-
};
|
|
124
|
-
declare const PurePanel: (props: import("../_util/type").AnyObject) => React.JSX.Element;
|
|
1
|
+
import Select from './Select';
|
|
2
|
+
import SortableSelect from './SortableSelect';
|
|
3
|
+
import SingleDisplaySelect from './SingleDisplaySelect';
|
|
4
|
+
export type { SortableSelectProps } from './SortableSelect';
|
|
5
|
+
export type { SingleDisplaySelectProps } from './SingleDisplaySelect';
|
|
6
|
+
export * from './Select';
|
|
7
|
+
export { SortableSelect, SingleDisplaySelect };
|
|
125
8
|
export default Select;
|