@tdm-design/ui 0.0.15 → 0.0.17
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 +113060 -0
- package/dist/@tdm-design/ui.js.map +1 -0
- package/dist/@tdm-design/ui.min.js +373 -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 +373 -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/index.d.ts +2 -2
- package/es/index.js +1 -1
- 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 +157 -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/index.d.ts +2 -2
- package/lib/index.js +14 -1
- 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 +164 -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 +10 -3
|
@@ -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;
|
package/lib/select/index.js
CHANGED
|
@@ -1,284 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
3
|
|
|
4
|
-
// TODO: 4.0 - codemod should help to change `filterOption` to support node props.
|
|
5
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
5
|
Object.defineProperty(exports, "__esModule", {
|
|
7
6
|
value: true
|
|
8
7
|
});
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var _statusUtils = require("../_util/statusUtils");
|
|
18
|
-
var _warning = require("../_util/warning");
|
|
19
|
-
var _configProvider = require("../config-provider");
|
|
20
|
-
var _context = require("../config-provider/context");
|
|
21
|
-
var _defaultRenderEmpty = _interopRequireDefault(require("../config-provider/defaultRenderEmpty"));
|
|
22
|
-
var _DisabledContext = _interopRequireDefault(require("../config-provider/DisabledContext"));
|
|
23
|
-
var _useCSSVarCls = _interopRequireDefault(require("../config-provider/hooks/useCSSVarCls"));
|
|
24
|
-
var _useSize = _interopRequireDefault(require("../config-provider/hooks/useSize"));
|
|
25
|
-
var _context2 = require("../form/context");
|
|
26
|
-
var _useVariants = _interopRequireDefault(require("../form/hooks/useVariants"));
|
|
27
|
-
var _Compact = require("../space/Compact");
|
|
28
|
-
var _internal = require("../theme/internal");
|
|
29
|
-
var _mergedBuiltinPlacements = _interopRequireDefault(require("./mergedBuiltinPlacements"));
|
|
30
|
-
var _style = _interopRequireDefault(require("./style"));
|
|
31
|
-
var _useIcons = _interopRequireDefault(require("./useIcons"));
|
|
32
|
-
var _usePopupRender = _interopRequireDefault(require("./usePopupRender"));
|
|
33
|
-
var _useShowArrow = _interopRequireDefault(require("./useShowArrow"));
|
|
34
|
-
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); }
|
|
35
|
-
const SECRET_COMBOBOX_MODE_DO_NOT_USE = 'SECRET_COMBOBOX_MODE_DO_NOT_USE';
|
|
36
|
-
const InternalSelect = (props, ref) => {
|
|
37
|
-
const {
|
|
38
|
-
prefixCls: customizePrefixCls,
|
|
39
|
-
bordered,
|
|
40
|
-
className,
|
|
41
|
-
rootClassName,
|
|
42
|
-
getPopupContainer,
|
|
43
|
-
popupClassName,
|
|
44
|
-
dropdownClassName,
|
|
45
|
-
listHeight = 256,
|
|
46
|
-
placement,
|
|
47
|
-
listItemHeight: customListItemHeight,
|
|
48
|
-
size: customizeSize,
|
|
49
|
-
disabled: customDisabled,
|
|
50
|
-
notFoundContent,
|
|
51
|
-
status: customStatus,
|
|
52
|
-
builtinPlacements,
|
|
53
|
-
dropdownMatchSelectWidth,
|
|
54
|
-
popupMatchSelectWidth,
|
|
55
|
-
direction: propDirection,
|
|
56
|
-
style,
|
|
57
|
-
allowClear,
|
|
58
|
-
variant: customizeVariant,
|
|
59
|
-
popupStyle,
|
|
60
|
-
dropdownStyle,
|
|
61
|
-
transitionName,
|
|
62
|
-
tagRender,
|
|
63
|
-
maxCount,
|
|
64
|
-
prefix,
|
|
65
|
-
dropdownRender,
|
|
66
|
-
/**
|
|
67
|
-
* @since 5.25.0
|
|
68
|
-
*/
|
|
69
|
-
popupRender,
|
|
70
|
-
onDropdownVisibleChange,
|
|
71
|
-
onOpenChange,
|
|
72
|
-
styles,
|
|
73
|
-
classNames,
|
|
74
|
-
isFilterItem,
|
|
75
|
-
// TDM_CUSTOM: custom select filter
|
|
76
|
-
optionFilterProp,
|
|
77
|
-
...rest
|
|
78
|
-
} = props;
|
|
79
|
-
const {
|
|
80
|
-
getPopupContainer: getContextPopupContainer,
|
|
81
|
-
getPrefixCls,
|
|
82
|
-
renderEmpty,
|
|
83
|
-
direction: contextDirection,
|
|
84
|
-
virtual,
|
|
85
|
-
popupMatchSelectWidth: contextPopupMatchSelectWidth,
|
|
86
|
-
popupOverflow
|
|
87
|
-
} = React.useContext(_configProvider.ConfigContext);
|
|
88
|
-
const {
|
|
89
|
-
showSearch,
|
|
90
|
-
optionFilterProp: contextOptionFilterProp,
|
|
91
|
-
style: contextStyle,
|
|
92
|
-
styles: contextStyles,
|
|
93
|
-
className: contextClassName,
|
|
94
|
-
classNames: contextClassNames
|
|
95
|
-
} = (0, _context.useComponentConfig)('select');
|
|
96
|
-
const [, token] = (0, _internal.useToken)();
|
|
97
|
-
const listItemHeight = customListItemHeight ?? token?.controlHeight;
|
|
98
|
-
const prefixCls = getPrefixCls('select', customizePrefixCls);
|
|
99
|
-
const rootPrefixCls = getPrefixCls();
|
|
100
|
-
const direction = propDirection ?? contextDirection;
|
|
101
|
-
const {
|
|
102
|
-
compactSize,
|
|
103
|
-
compactItemClassnames
|
|
104
|
-
} = (0, _Compact.useCompactItemContext)(prefixCls, direction);
|
|
105
|
-
const [variant, enableVariantCls] = (0, _useVariants.default)('select', customizeVariant, bordered);
|
|
106
|
-
const rootCls = (0, _useCSSVarCls.default)(prefixCls);
|
|
107
|
-
const [hashId, cssVarCls] = (0, _style.default)(prefixCls, rootCls);
|
|
108
|
-
const mode = React.useMemo(() => {
|
|
109
|
-
const {
|
|
110
|
-
mode: m
|
|
111
|
-
} = props;
|
|
112
|
-
if (m === 'combobox') {
|
|
113
|
-
return undefined;
|
|
114
|
-
}
|
|
115
|
-
if (m === SECRET_COMBOBOX_MODE_DO_NOT_USE) {
|
|
116
|
-
return 'combobox';
|
|
117
|
-
}
|
|
118
|
-
return m;
|
|
119
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
120
|
-
}, [props.mode]);
|
|
121
|
-
const isMultiple = mode === 'multiple' || mode === 'tags';
|
|
122
|
-
const showSuffixIcon = (0, _useShowArrow.default)(props.suffixIcon, props.showArrow);
|
|
123
|
-
const mergedPopupMatchSelectWidth = popupMatchSelectWidth ?? dropdownMatchSelectWidth ?? contextPopupMatchSelectWidth;
|
|
124
|
-
const mergedPopupRender = (0, _usePopupRender.default)(popupRender || dropdownRender);
|
|
125
|
-
const mergedOnOpenChange = onOpenChange || onDropdownVisibleChange;
|
|
126
|
-
// ===================== Form Status =====================
|
|
127
|
-
const {
|
|
128
|
-
status: contextStatus,
|
|
129
|
-
hasFeedback,
|
|
130
|
-
isFormItemInput,
|
|
131
|
-
feedbackIcon
|
|
132
|
-
} = React.useContext(_context2.FormItemInputContext);
|
|
133
|
-
const mergedStatus = (0, _statusUtils.getMergedStatus)(contextStatus, customStatus);
|
|
134
|
-
// ===================== Empty =====================
|
|
135
|
-
let mergedNotFound;
|
|
136
|
-
if (notFoundContent !== undefined) {
|
|
137
|
-
mergedNotFound = notFoundContent;
|
|
138
|
-
} else if (mode === 'combobox') {
|
|
139
|
-
mergedNotFound = null;
|
|
140
|
-
} else {
|
|
141
|
-
mergedNotFound = renderEmpty?.('Select') || /*#__PURE__*/React.createElement(_defaultRenderEmpty.default, {
|
|
142
|
-
componentName: "Select"
|
|
143
|
-
});
|
|
8
|
+
var _exportNames = {
|
|
9
|
+
SortableSelect: true,
|
|
10
|
+
SingleDisplaySelect: true
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "SingleDisplaySelect", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _SingleDisplaySelect.default;
|
|
144
16
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
clearIcon
|
|
151
|
-
} = (0, _useIcons.default)({
|
|
152
|
-
...rest,
|
|
153
|
-
multiple: isMultiple,
|
|
154
|
-
hasFeedback,
|
|
155
|
-
feedbackIcon,
|
|
156
|
-
showSuffixIcon,
|
|
157
|
-
prefixCls,
|
|
158
|
-
componentName: 'Select'
|
|
159
|
-
});
|
|
160
|
-
const mergedAllowClear = allowClear === true ? {
|
|
161
|
-
clearIcon
|
|
162
|
-
} : allowClear;
|
|
163
|
-
const selectProps = (0, _util.omit)(rest, ['suffixIcon', 'itemIcon']);
|
|
164
|
-
const mergedSize = (0, _useSize.default)(ctx => customizeSize ?? compactSize ?? ctx);
|
|
165
|
-
// ===================== Disabled =====================
|
|
166
|
-
const disabled = React.useContext(_DisabledContext.default);
|
|
167
|
-
const mergedDisabled = customDisabled ?? disabled;
|
|
168
|
-
// ========== Merged Props for Semantic ==================
|
|
169
|
-
const mergedProps = {
|
|
170
|
-
...props,
|
|
171
|
-
variant,
|
|
172
|
-
status: mergedStatus,
|
|
173
|
-
disabled: mergedDisabled,
|
|
174
|
-
size: mergedSize
|
|
175
|
-
};
|
|
176
|
-
const [mergedClassNames, mergedStyles] = (0, _hooks.useMergeSemantic)([contextClassNames, classNames], [contextStyles, styles], {
|
|
177
|
-
props: mergedProps
|
|
178
|
-
}, {
|
|
179
|
-
popup: {
|
|
180
|
-
_default: 'root'
|
|
181
|
-
}
|
|
182
|
-
});
|
|
183
|
-
const mergedPopupClassName = (0, _clsx.clsx)(mergedClassNames.popup?.root, popupClassName, dropdownClassName, {
|
|
184
|
-
[`${prefixCls}-dropdown-${direction}`]: direction === 'rtl'
|
|
185
|
-
}, rootClassName, cssVarCls, rootCls, hashId);
|
|
186
|
-
const mergedPopupStyle = {
|
|
187
|
-
...mergedStyles.popup?.root,
|
|
188
|
-
...(popupStyle ?? dropdownStyle)
|
|
189
|
-
};
|
|
190
|
-
const mergedClassName = (0, _clsx.clsx)({
|
|
191
|
-
[`${prefixCls}-lg`]: mergedSize === 'large',
|
|
192
|
-
[`${prefixCls}-sm`]: mergedSize === 'small',
|
|
193
|
-
[`${prefixCls}-rtl`]: direction === 'rtl',
|
|
194
|
-
[`${prefixCls}-${variant}`]: enableVariantCls,
|
|
195
|
-
[`${prefixCls}-in-form-item`]: isFormItemInput,
|
|
196
|
-
// TDM_CUSTOM: custom select filter
|
|
197
|
-
[`${prefixCls}-filter`]: isFilterItem
|
|
198
|
-
}, (0, _statusUtils.getStatusClassNames)(prefixCls, mergedStatus, hasFeedback), compactItemClassnames, contextClassName, className, mergedClassNames.root, rootClassName, cssVarCls, rootCls, hashId);
|
|
199
|
-
// ===================== Placement =====================
|
|
200
|
-
const memoPlacement = React.useMemo(() => {
|
|
201
|
-
if (placement !== undefined) {
|
|
202
|
-
return placement;
|
|
203
|
-
}
|
|
204
|
-
return direction === 'rtl' ? 'bottomRight' : 'bottomLeft';
|
|
205
|
-
}, [placement, direction]);
|
|
206
|
-
// ====================== Warning ======================
|
|
207
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
208
|
-
const warning = (0, _warning.devUseWarning)('Select');
|
|
209
|
-
const deprecatedProps = {
|
|
210
|
-
dropdownMatchSelectWidth: 'popupMatchSelectWidth',
|
|
211
|
-
dropdownStyle: 'styles.popup.root',
|
|
212
|
-
dropdownClassName: 'classNames.popup.root',
|
|
213
|
-
popupClassName: 'classNames.popup.root',
|
|
214
|
-
dropdownRender: 'popupRender',
|
|
215
|
-
onDropdownVisibleChange: 'onOpenChange',
|
|
216
|
-
bordered: 'variant'
|
|
217
|
-
};
|
|
218
|
-
Object.entries(deprecatedProps).forEach(([oldProp, newProp]) => {
|
|
219
|
-
warning.deprecated(!(oldProp in props), oldProp, newProp);
|
|
220
|
-
});
|
|
221
|
-
process.env.NODE_ENV !== "production" ? warning(!('showArrow' in props), 'deprecated', '`showArrow` is deprecated which will be removed in next major version. It will be a default behavior, you can hide it by setting `suffixIcon` to null.') : void 0;
|
|
222
|
-
process.env.NODE_ENV !== "production" ? warning(!(typeof maxCount !== 'undefined' && !isMultiple), 'usage', '`maxCount` only works with mode `multiple` or `tags`') : void 0;
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "SortableSelect", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _SortableSelect.default;
|
|
223
22
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
...mergedStyles.root,
|
|
237
|
-
...contextStyle,
|
|
238
|
-
...style
|
|
239
|
-
},
|
|
240
|
-
popupMatchSelectWidth: mergedPopupMatchSelectWidth,
|
|
241
|
-
transitionName: (0, _motion.getTransitionName)(rootPrefixCls, 'slide-up', transitionName),
|
|
242
|
-
builtinPlacements: (0, _mergedBuiltinPlacements.default)(builtinPlacements, popupOverflow),
|
|
243
|
-
listHeight: listHeight,
|
|
244
|
-
listItemHeight: listItemHeight,
|
|
245
|
-
mode: mode,
|
|
246
|
-
prefixCls: prefixCls,
|
|
247
|
-
placement: memoPlacement,
|
|
248
|
-
direction: direction,
|
|
249
|
-
prefix: prefix,
|
|
250
|
-
suffixIcon: suffixIcon,
|
|
251
|
-
menuItemSelectedIcon: itemIcon,
|
|
252
|
-
removeIcon: removeIcon,
|
|
253
|
-
allowClear: mergedAllowClear,
|
|
254
|
-
notFoundContent: mergedNotFound,
|
|
255
|
-
className: mergedClassName,
|
|
256
|
-
getPopupContainer: getPopupContainer || getContextPopupContainer,
|
|
257
|
-
popupClassName: mergedPopupClassName,
|
|
258
|
-
disabled: mergedDisabled,
|
|
259
|
-
popupStyle: {
|
|
260
|
-
...mergedStyles.popup?.root,
|
|
261
|
-
...mergedPopupStyle,
|
|
262
|
-
zIndex
|
|
263
|
-
},
|
|
264
|
-
maxCount: isMultiple ? maxCount : undefined,
|
|
265
|
-
tagRender: isMultiple ? tagRender : undefined,
|
|
266
|
-
popupRender: mergedPopupRender,
|
|
267
|
-
onPopupVisibleChange: mergedOnOpenChange
|
|
23
|
+
});
|
|
24
|
+
exports.default = void 0;
|
|
25
|
+
var _Select = _interopRequireWildcard(require("./Select"));
|
|
26
|
+
Object.keys(_Select).forEach(function (key) {
|
|
27
|
+
if (key === "default" || key === "__esModule") return;
|
|
28
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
29
|
+
if (key in exports && exports[key] === _Select[key]) return;
|
|
30
|
+
Object.defineProperty(exports, key, {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _Select[key];
|
|
34
|
+
}
|
|
268
35
|
});
|
|
269
|
-
};
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
const PurePanel = (0, _PurePanel.default)(Select, 'popupAlign');
|
|
277
|
-
Select.SECRET_COMBOBOX_MODE_DO_NOT_USE = SECRET_COMBOBOX_MODE_DO_NOT_USE;
|
|
278
|
-
Select.Option = _select.Option;
|
|
279
|
-
Select.OptGroup = _select.OptGroup;
|
|
280
|
-
Select._InternalPanelDoNotUseOrYouWillBeFired = PurePanel;
|
|
281
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
282
|
-
Select.displayName = 'Select';
|
|
283
|
-
}
|
|
284
|
-
var _default = exports.default = Select;
|
|
36
|
+
});
|
|
37
|
+
var _SortableSelect = _interopRequireDefault(require("./SortableSelect"));
|
|
38
|
+
var _SingleDisplaySelect = _interopRequireDefault(require("./SingleDisplaySelect"));
|
|
39
|
+
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); }
|
|
40
|
+
_Select.default.SortableSelect = _SortableSelect.default;
|
|
41
|
+
_Select.default.SingleDisplaySelect = _SingleDisplaySelect.default;
|
|
42
|
+
var _default = exports.default = _Select.default;
|
|
@@ -69,7 +69,10 @@ const genSelectInputMultipleStyle = token => {
|
|
|
69
69
|
},
|
|
70
70
|
'&-item': {
|
|
71
71
|
lineHeight: 1,
|
|
72
|
-
maxWidth: `calc(
|
|
72
|
+
maxWidth: `calc(50% - ${FIXED_INPUT_MIN_WIDTH}px)`
|
|
73
|
+
},
|
|
74
|
+
'&-item-suffix': {
|
|
75
|
+
maxWidth: '100%'
|
|
73
76
|
},
|
|
74
77
|
[`${componentCls}-content-item-prefix + ${componentCls}-content-item-suffix,
|
|
75
78
|
${componentCls}-content-item-suffix:first-child`]: {
|