@aloudata/aloudata-design 2.19.0-beta.5 → 2.19.1

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.
Files changed (41) hide show
  1. package/dist/AldSelect/style/color.less +2 -1
  2. package/dist/Button/style/variables.less +1 -1
  3. package/dist/MemberPicker/components/MemberSelection.d.ts +6 -0
  4. package/dist/MemberPicker/components/MemberSelection.js +37 -13
  5. package/dist/MemberPicker/components/Panel.d.ts +8 -0
  6. package/dist/MemberPicker/components/Panel.js +14 -7
  7. package/dist/MemberPicker/components/PanelWrapper.d.ts +9 -1
  8. package/dist/MemberPicker/components/PanelWrapper.js +6 -2
  9. package/dist/MemberPicker/components/SelectedMemberTags.d.ts +2 -1
  10. package/dist/MemberPicker/components/SelectedMemberTags.js +7 -2
  11. package/dist/MemberPicker/components/UserGroupSelection.d.ts +8 -1
  12. package/dist/MemberPicker/components/UserGroupSelection.js +32 -20
  13. package/dist/MemberPicker/index.js +6 -2
  14. package/dist/MemberPicker/interface.d.ts +8 -0
  15. package/dist/Table/components/DndWrapper.d.ts +10 -0
  16. package/dist/Table/components/DndWrapper.js +38 -0
  17. package/dist/Table/hooks/useRowDnd.js +12 -3
  18. package/dist/Table/index.js +26 -11
  19. package/dist/Tabs/style/index.less +1 -0
  20. package/dist/ald.min.css +1 -1
  21. package/dist/index.d.ts +0 -2
  22. package/dist/index.js +0 -1
  23. package/dist/index.less +0 -1
  24. package/dist/notification/index.js +1 -1
  25. package/package.json +1 -1
  26. package/dist/Select/components/Option.d.ts +0 -11
  27. package/dist/Select/components/Option.js +0 -31
  28. package/dist/Select/components/SingleOption.d.ts +0 -11
  29. package/dist/Select/components/SingleOption.js +0 -28
  30. package/dist/Select/index.d.ts +0 -19
  31. package/dist/Select/index.js +0 -484
  32. package/dist/Select/style/emptyShowAll.less +0 -27
  33. package/dist/Select/style/index.d.ts +0 -2
  34. package/dist/Select/style/index.js +0 -2
  35. package/dist/Select/style/index.less +0 -176
  36. package/dist/Select/style/layout.less +0 -44
  37. package/dist/Select/style/option.less +0 -39
  38. package/dist/Select/style/selectDropdown.less +0 -16
  39. package/dist/Select/style/size.less +0 -426
  40. package/dist/Select/style/status.less +0 -137
  41. package/dist/Select/style/variables.less +0 -31
package/dist/index.d.ts CHANGED
@@ -72,8 +72,6 @@ export { default as Result } from './Result';
72
72
  export { default as Row } from './Row';
73
73
  export type { RowProps } from './Row';
74
74
  export { default as ScrollArea } from './ScrollArea';
75
- export { default as Select } from './Select';
76
- export type { IRefSelectProps as RefSelectProps, ISelectProps as SelectProps, } from './Select';
77
75
  export { default as Skeleton } from './Skeleton';
78
76
  export type { SkeletonProps } from './Skeleton';
79
77
  export { default as Slider } from './Slider';
package/dist/index.js CHANGED
@@ -43,7 +43,6 @@ export { default as RenameInput } from "./RenameInput";
43
43
  export { default as Result } from "./Result";
44
44
  export { default as Row } from "./Row";
45
45
  export { default as ScrollArea } from "./ScrollArea";
46
- export { default as Select } from "./Select";
47
46
  export { default as Skeleton } from "./Skeleton";
48
47
  export { default as Slider } from "./Slider";
49
48
  export { default as Space } from "./Space";
package/dist/index.less CHANGED
@@ -34,7 +34,6 @@
34
34
  @import './Result/style/index.less';
35
35
  @import './Row/style/index.less';
36
36
  @import './ScrollArea/style/index.less';
37
- @import './Select/style/index.less';
38
37
  @import './Skeleton/style/index.less';
39
38
  @import './Space/style/index.less';
40
39
  @import './Spin/style/index.less';
@@ -51,7 +51,7 @@ var iconMap = {
51
51
  error: /*#__PURE__*/React.createElement("div", {
52
52
  className: "ald-notification-notice-icon"
53
53
  }, /*#__PURE__*/React.createElement(DangerFill, {
54
- color: "var(--alias-colors-icon-error)",
54
+ color: "var(--alias-colors-icon-danger)",
55
55
  size: 24
56
56
  })),
57
57
  warning: /*#__PURE__*/React.createElement("div", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aloudata/aloudata-design",
3
- "version": "2.19.0-beta.5",
3
+ "version": "2.19.1",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import { SelectOptionType } from '../index';
3
- interface IMultipleOptionProps {
4
- selected: boolean;
5
- disabled?: boolean;
6
- option: SelectOptionType;
7
- onChange?: (selected: boolean) => void;
8
- className?: string;
9
- }
10
- export default function MultipleList(params: IMultipleOptionProps): React.JSX.Element;
11
- export {};
@@ -1,31 +0,0 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
- import classnames from 'classnames';
3
- import React from 'react';
4
- import { CheckLightLine } from "../../Icon";
5
- export default function MultipleList(params) {
6
- var disabled = params.disabled,
7
- option = params.option,
8
- selected = params.selected,
9
- onChange = params.onChange,
10
- className = params.className;
11
- var label = option.label,
12
- icon = option.icon;
13
- var onClick = function onClick() {
14
- if (disabled) return;
15
- onChange === null || onChange === void 0 ? void 0 : onChange(!selected);
16
- };
17
- return /*#__PURE__*/React.createElement("div", {
18
- className: classnames('ald-option', className, {
19
- 'ald-option-disabled': disabled,
20
- 'ald-option-selected': selected
21
- }),
22
- onClick: onClick
23
- }, icon && /*#__PURE__*/React.createElement("div", {
24
- className: "ald-option-icon-wrap"
25
- }, icon), /*#__PURE__*/React.createElement("span", {
26
- className: "ald-option-label",
27
- title: _typeof(label) !== 'object' ? label === null || label === void 0 ? void 0 : label.toString() : ''
28
- }, label), selected && /*#__PURE__*/React.createElement(CheckLightLine, {
29
- size: 16
30
- }));
31
- }
@@ -1,11 +0,0 @@
1
- import { DefaultOptionType } from 'antd/lib/select';
2
- import React from 'react';
3
- interface ISelectProps {
4
- selected: boolean;
5
- disabled?: boolean;
6
- option: DefaultOptionType;
7
- onChange?: (selected: boolean) => void;
8
- className?: string;
9
- }
10
- export default function SingleOption(params: ISelectProps): React.JSX.Element;
11
- export {};
@@ -1,28 +0,0 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
- import classnames from 'classnames';
3
- import React from 'react';
4
- export default function SingleOption(params) {
5
- var _option$label;
6
- var disabled = params.disabled,
7
- selected = params.selected,
8
- option = params.option,
9
- _params$onChange = params.onChange,
10
- onChange = _params$onChange === void 0 ? function () {} : _params$onChange,
11
- className = params.className;
12
- var onClick = function onClick() {
13
- if (disabled) return;
14
- onChange(!selected);
15
- };
16
- return /*#__PURE__*/React.createElement("div", {
17
- className: classnames('ald-single-option', className, {
18
- 'ald-single-option-disabled': disabled,
19
- 'ald-single-option-selected': selected
20
- }),
21
- onClick: onClick
22
- }, /*#__PURE__*/React.createElement("span", {
23
- className: "ald-single-option-text",
24
- title: _typeof(option.label) !== 'object' ? (_option$label = option.label) === null || _option$label === void 0 ? void 0 : _option$label.toString() : ''
25
- }, option.label), /*#__PURE__*/React.createElement("div", {
26
- className: "ald-checked"
27
- }));
28
- }
@@ -1,19 +0,0 @@
1
- import { RefSelectProps, SelectProps } from 'antd';
2
- import { type DefaultOptionType } from 'antd/lib/select';
3
- import React from 'react';
4
- export interface ISelectProps extends Omit<SelectProps, 'mode'> {
5
- prefix?: React.ReactNode;
6
- prefixWidth?: number;
7
- mode?: 'multiple';
8
- type?: 'primary' | 'secondary';
9
- }
10
- export type IRefSelectProps = RefSelectProps;
11
- export interface SelectOptionType extends DefaultOptionType {
12
- icon?: React.ReactNode;
13
- }
14
- export type IAldRefSelectProps = IRefSelectProps & {
15
- open: () => void;
16
- close: () => void;
17
- };
18
- declare const Select: React.ForwardRefExoticComponent<ISelectProps & React.RefAttributes<IAldRefSelectProps>>;
19
- export default Select;
@@ -1,484 +0,0 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
- var _excluded = ["mode", "options", "dropdownRender", "onDropdownVisibleChange", "defaultValue", "onChange", "open", "defaultOpen", "prefix", "prefixWidth", "className", "popupClassName", "listHeight", "notFoundContent", "value", "type", "tagRender", "style", "autoFocus", "showSearch", "size", "status", "disabled", "prefixCls", "placeholder", "dropdownStyle", "virtual", "showArrow"];
3
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
8
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
10
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
11
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
12
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
13
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
14
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
15
- function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
16
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
18
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
19
- import { Select as AntdSelect } from 'antd';
20
- import { getMergedStatus } from 'antd/lib/_util/statusUtils';
21
- import DisabledContext from 'antd/lib/config-provider/DisabledContext';
22
- import { FormItemInputContext } from 'antd/lib/form/context';
23
- import useStyle from 'antd/lib/select/style';
24
- import { useCompactItemContext } from 'antd/lib/space/Compact';
25
- import classNames from 'classnames';
26
- import _ from 'lodash';
27
- import List from 'rc-virtual-list';
28
- import React, { forwardRef, useContext, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
29
- import { ConfigContext } from "../ConfigProvider";
30
- import SizeContext from "../ConfigProvider/sizeContext";
31
- import Empty from "../Empty";
32
- import { ArrowDownFill, TimesLightLine } from "../Icon";
33
- import { LocaleContext, getTranslator } from "../locale/default";
34
- import Option from "./components/Option";
35
- var defaultDropdownStyle = {
36
- minWidth: 192
37
- };
38
- var DEFAULT_LIST_ITEM_HEIGHT = 36;
39
- var getSelectedOptionsFromValue = function getSelectedOptionsFromValue(isMultiple, options, value, defaultValue, prevSelectOptions) {
40
- if (typeof value !== 'undefined' || prevSelectOptions !== null && prevSelectOptions !== void 0 && prevSelectOptions.length) {
41
- if (isMultiple) {
42
- if (Array.isArray(value)) {
43
- var _newOptions = [];
44
- value.forEach(function (currentValue) {
45
- var newOption = options === null || options === void 0 ? void 0 : options.find(function (option) {
46
- return option.value === currentValue;
47
- });
48
- if (newOption) {
49
- _newOptions.push(newOption);
50
- } else {
51
- var prevOption = prevSelectOptions === null || prevSelectOptions === void 0 ? void 0 : prevSelectOptions.find(function (option) {
52
- return option.value === currentValue;
53
- });
54
- if (prevOption) {
55
- _newOptions.push(prevOption);
56
- }
57
- }
58
- });
59
- return _newOptions;
60
- } else {
61
- return prevSelectOptions || [];
62
- }
63
- } else {
64
- var newOptions = options === null || options === void 0 ? void 0 : options.filter(function (option) {
65
- return option.value === value;
66
- });
67
- return newOptions || [];
68
- }
69
- return [];
70
- }
71
- if (typeof defaultValue !== 'undefined') {
72
- if (isMultiple) {
73
- if (Array.isArray(defaultValue)) {
74
- var _newOptions2 = options === null || options === void 0 ? void 0 : options.filter(function (option) {
75
- return defaultValue.includes(option.value);
76
- });
77
- return _newOptions2 || [];
78
- }
79
- } else {
80
- var _newOptions3 = options === null || options === void 0 ? void 0 : options.filter(function (option) {
81
- return option.value === defaultValue;
82
- });
83
- return _newOptions3 || [];
84
- }
85
- return [];
86
- }
87
- return [];
88
- };
89
- var Select = /*#__PURE__*/forwardRef(function (props, ref) {
90
- var _classNames;
91
- var _useContext = useContext(LocaleContext),
92
- locale = _useContext.locale;
93
- var t = getTranslator(locale);
94
- var mode = props.mode,
95
- options = props.options,
96
- dropdownRender = props.dropdownRender,
97
- _onDropdownVisibleChange = props.onDropdownVisibleChange,
98
- defaultValue = props.defaultValue,
99
- onChange = props.onChange,
100
- _open = props.open,
101
- defaultOpen = props.defaultOpen,
102
- prefix = props.prefix,
103
- prefixWidth = props.prefixWidth,
104
- className = props.className,
105
- popupClassName = props.popupClassName,
106
- listHeight = props.listHeight,
107
- _props$notFoundConten = props.notFoundContent,
108
- notFoundContent = _props$notFoundConten === void 0 ? /*#__PURE__*/React.createElement(Empty, {
109
- image: Empty.PRESENTED_IMAGE_SEARCH_SMALL,
110
- size: "small",
111
- title: t.Select.noSearchResult
112
- }) : _props$notFoundConten,
113
- value = props.value,
114
- _props$type = props.type,
115
- type = _props$type === void 0 ? 'secondary' : _props$type,
116
- tagRender = props.tagRender,
117
- _props$style = props.style,
118
- style = _props$style === void 0 ? {} : _props$style,
119
- autoFocus = props.autoFocus,
120
- _props$showSearch = props.showSearch,
121
- showSearch = _props$showSearch === void 0 ? false : _props$showSearch,
122
- customSize = props.size,
123
- customStatus = props.status,
124
- customDisabled = props.disabled,
125
- customizePrefixCls = props.prefixCls,
126
- propsPlaceholder = props.placeholder,
127
- dropdownStyle = props.dropdownStyle,
128
- virtual = props.virtual,
129
- _props$showArrow = props.showArrow,
130
- showArrow = _props$showArrow === void 0 ? true : _props$showArrow,
131
- restProps = _objectWithoutProperties(props, _excluded);
132
- var placeholder = type === 'primary' ? t.Select.all : propsPlaceholder;
133
- var contentSize = useContext(SizeContext);
134
- var defaultValueRef = React.useRef(defaultValue);
135
- var _React$useContext = React.useContext(ConfigContext),
136
- getPrefixCls = _React$useContext.getPrefixCls,
137
- direction = _React$useContext.direction;
138
- var prefixCls = getPrefixCls('select', customizePrefixCls);
139
- // ===================== Compact Item =====================
140
- var _useCompactItemContex = useCompactItemContext(prefixCls, direction),
141
- compactSize = _useCompactItemContex.compactSize,
142
- compactItemClassnames = _useCompactItemContex.compactItemClassnames;
143
- var size = compactSize || customSize || contentSize || 'middle';
144
- var _React$useContext2 = React.useContext(FormItemInputContext),
145
- contextStatus = _React$useContext2.status;
146
- var _useStyle = useStyle(prefixCls),
147
- _useStyle2 = _slicedToArray(_useStyle, 2),
148
- hashId = _useStyle2[1];
149
- var mergedStatus = getMergedStatus(contextStatus, customStatus);
150
- // ===================== Disabled =====================
151
- var disabled = React.useContext(DisabledContext);
152
- var mergedDisabled = customDisabled !== null && customDisabled !== void 0 ? customDisabled : disabled;
153
- var isMultiple = mode === 'multiple';
154
- var listItemHeight = typeof props.listItemHeight === 'number' ? props.listItemHeight : DEFAULT_LIST_ITEM_HEIGHT;
155
- var innerOptions = options;
156
- var _React$useState = React.useState(getSelectedOptionsFromValue(isMultiple, innerOptions, value, defaultValueRef.current)),
157
- _React$useState2 = _slicedToArray(_React$useState, 2),
158
- selectedOptions = _React$useState2[0],
159
- setSelectedOptions = _React$useState2[1];
160
- var dropDownTimeRef = React.useRef(0);
161
- var _React$useState3 = React.useState(typeof _open === 'boolean' ? _open : defaultOpen),
162
- _React$useState4 = _slicedToArray(_React$useState3, 2),
163
- isOpen = _React$useState4[0],
164
- setIsOpen = _React$useState4[1];
165
- var _React$useState5 = React.useState(typeof autoFocus === 'boolean' ? autoFocus : false),
166
- _React$useState6 = _slicedToArray(_React$useState5, 2),
167
- isFocus = _React$useState6[0],
168
- setIsFocus = _React$useState6[1];
169
- var prefixRef = React.useRef(null);
170
- var sizeInPrefix = useMemo(function () {
171
- var isJSX = /*#__PURE__*/React.isValidElement(prefix);
172
- if (isJSX) {
173
- var _prefix$props$style;
174
- var _size = prefix.props.size;
175
- var width = (_prefix$props$style = prefix.props.style) === null || _prefix$props$style === void 0 ? void 0 : _prefix$props$style.width;
176
- return width || _size;
177
- } else {
178
- return 0;
179
- }
180
- }, [prefix]);
181
- var _React$useState7 = React.useState(sizeInPrefix),
182
- _React$useState8 = _slicedToArray(_React$useState7, 2),
183
- prefixW = _React$useState8[0],
184
- setPrefixWidth = _React$useState8[1];
185
- var mergedPrefixWidth = prefixWidth || prefixW;
186
- var updatedRef = useRef(false);
187
- var selectRef = useRef(null);
188
-
189
- // 处理 ref 方法
190
- useImperativeHandle(ref, function () {
191
- return {
192
- focus: function focus() {
193
- var _selectRef$current;
194
- (_selectRef$current = selectRef.current) === null || _selectRef$current === void 0 ? void 0 : _selectRef$current.focus();
195
- },
196
- blur: function blur() {
197
- var _selectRef$current2;
198
- (_selectRef$current2 = selectRef.current) === null || _selectRef$current2 === void 0 ? void 0 : _selectRef$current2.blur();
199
- },
200
- scrollTo: function scrollTo(index) {
201
- var _selectRef$current3;
202
- (_selectRef$current3 = selectRef.current) === null || _selectRef$current3 === void 0 ? void 0 : _selectRef$current3.scrollTo(index);
203
- },
204
- open: function open() {
205
- var _selectRef$current4;
206
- if (_open) return;
207
- setIsOpen(true);
208
- (_selectRef$current4 = selectRef.current) === null || _selectRef$current4 === void 0 ? void 0 : _selectRef$current4.focus();
209
- },
210
- close: function close() {
211
- var _selectRef$current5;
212
- if (!_open) return;
213
- setIsOpen(false);
214
- (_selectRef$current5 = selectRef.current) === null || _selectRef$current5 === void 0 ? void 0 : _selectRef$current5.blur();
215
- }
216
- };
217
- });
218
- var onMultipleOptionChange = function onMultipleOptionChange(option, selected) {
219
- var newOptions = [];
220
- if (selected) {
221
- var _props$onSelect;
222
- if (option.__IS_INNER_ALL_OPTION) {
223
- newOptions = (innerOptions === null || innerOptions === void 0 ? void 0 : innerOptions.filter(function (item) {
224
- return !item.__IS_INNER_ALL_OPTION && !item.disabled;
225
- })) || [];
226
- } else {
227
- newOptions = [].concat(_toConsumableArray(selectedOptions), [option]);
228
- }
229
- (_props$onSelect = props.onSelect) === null || _props$onSelect === void 0 ? void 0 : _props$onSelect.call(props, option.value, option);
230
- } else {
231
- var _props$onDeselect;
232
- (_props$onDeselect = props.onDeselect) === null || _props$onDeselect === void 0 ? void 0 : _props$onDeselect.call(props, option.value, option);
233
- if (option.__IS_INNER_ALL_OPTION) {
234
- newOptions = [];
235
- } else {
236
- newOptions = selectedOptions.filter(function (item) {
237
- return item.value !== option.value;
238
- });
239
- }
240
- }
241
- if (typeof value === 'undefined') {
242
- setSelectedOptions(newOptions);
243
- }
244
- onChange === null || onChange === void 0 ? void 0 : onChange(newOptions.map(function (item) {
245
- return item.value;
246
- }), newOptions);
247
- };
248
- var getListHeight = function getListHeight() {
249
- if (typeof listHeight === 'number' && innerOptions !== null && innerOptions !== void 0 && innerOptions.length) {
250
- if (listHeight <= innerOptions.length * listItemHeight) {
251
- return listHeight;
252
- }
253
- }
254
- return 256;
255
- };
256
- var multipleRender = function multipleRender() {
257
- return /*#__PURE__*/React.createElement("div", {
258
- className: "ald-option-list"
259
- }, /*#__PURE__*/React.createElement(List, {
260
- data: innerOptions || [],
261
- "data-id": "list",
262
- height: getListHeight(),
263
- itemHeight: listItemHeight,
264
- itemKey: "value",
265
- virtual: virtual,
266
- fullHeight: false
267
- }, function (option) {
268
- var isSelected = false;
269
- if (option.__IS_INNER_ALL_OPTION) {
270
- isSelected = selectedOptions.length === (innerOptions === null || innerOptions === void 0 ? void 0 : innerOptions.filter(function (option) {
271
- return !option.__IS_INNER_ALL_OPTION && !option.disabled;
272
- }).length);
273
- } else {
274
- isSelected = selectedOptions.some(function (selectedOption) {
275
- return selectedOption.value === option.value;
276
- });
277
- }
278
- return /*#__PURE__*/React.createElement(Option, {
279
- key: option.value,
280
- selected: isSelected,
281
- className: option.className,
282
- option: option,
283
- disabled: option.disabled,
284
- onChange: function onChange(selected) {
285
- onMultipleOptionChange(option, selected);
286
- }
287
- });
288
- }));
289
- };
290
- var onSingleOptionChange = function onSingleOptionChange(option) {
291
- var _props$onSelect2;
292
- if (typeof value === 'undefined') {
293
- setSelectedOptions([option]);
294
- }
295
- onChange === null || onChange === void 0 ? void 0 : onChange(option.value, option);
296
- (_props$onSelect2 = props.onSelect) === null || _props$onSelect2 === void 0 ? void 0 : _props$onSelect2.call(props, option.value, option);
297
- setIsOpen(false);
298
- };
299
- var singleRender = function singleRender() {
300
- return /*#__PURE__*/React.createElement("div", {
301
- className: "ald-option-list"
302
- }, /*#__PURE__*/React.createElement(List, {
303
- data: innerOptions || [],
304
- "data-id": "list",
305
- height: getListHeight(),
306
- itemHeight: listItemHeight,
307
- itemKey: "value",
308
- virtual: virtual,
309
- fullHeight: false
310
- }, function (option) {
311
- var isSelected = selectedOptions.some(function (selectedOption) {
312
- return selectedOption.value === option.value;
313
- });
314
- return /*#__PURE__*/React.createElement(Option, {
315
- key: option.value,
316
- selected: isSelected,
317
- className: option.className,
318
- option: option,
319
- disabled: option.disabled,
320
- onChange: function onChange() {
321
- onSingleOptionChange(option);
322
- }
323
- });
324
- }));
325
- };
326
- var getDropdownRender = function getDropdownRender() {
327
- if (dropdownRender) {
328
- if (isMultiple) {
329
- var menu = multipleRender();
330
- return function () {
331
- return dropdownRender(menu);
332
- };
333
- } else {
334
- var _menu = singleRender();
335
- return function () {
336
- return dropdownRender(_menu);
337
- };
338
- }
339
- } else if (Array.isArray(innerOptions) && innerOptions.length > 0) {
340
- if (!isMultiple) {
341
- return singleRender;
342
- } else {
343
- return multipleRender;
344
- }
345
- } else {
346
- return function () {
347
- return /*#__PURE__*/React.createElement(React.Fragment, null, notFoundContent);
348
- };
349
- }
350
- };
351
- // todo: 隐藏已选择项
352
- // todo: 分组
353
- var currentValue = useMemo(function () {
354
- if (isMultiple) {
355
- return selectedOptions.map(function (option) {
356
- return option.value;
357
- });
358
- } else {
359
- var _selectedOptions$;
360
- return (_selectedOptions$ = selectedOptions[0]) === null || _selectedOptions$ === void 0 ? void 0 : _selectedOptions$.value;
361
- }
362
- }, [selectedOptions, isMultiple]);
363
- useEffect(function () {
364
- if (prefixRef.current && prefix) {
365
- setPrefixWidth(prefixRef.current.offsetWidth);
366
- } else {
367
- setPrefixWidth(0);
368
- }
369
- }, [size, prefix]);
370
- var styleVar = {
371
- '--ald-select-prefix-width': "".concat(mergedPrefixWidth, "px")
372
- };
373
- var defaultTagRender = function defaultTagRender(props) {
374
- var label = props.label;
375
- return /*#__PURE__*/React.createElement("span", {
376
- className: "ald-select-multiple-tag-default"
377
- }, label);
378
- };
379
- var maxTagPlaceholder = function maxTagPlaceholder(omittedValues) {
380
- return /*#__PURE__*/React.createElement(React.Fragment, null, "+", omittedValues.length);
381
- };
382
- useEffect(function () {
383
- if (updatedRef.current) {
384
- setSelectedOptions(function (prev) {
385
- return getSelectedOptionsFromValue(isMultiple, innerOptions, value, undefined, prev);
386
- });
387
- } else {
388
- updatedRef.current = true;
389
- }
390
- }, [value, innerOptions, isMultiple]);
391
- var wrapRef = useRef(null);
392
- useEffect(function () {
393
- var observer = new MutationObserver(function m(mutations) {
394
- mutations.forEach(function (m) {
395
- var target = m.target;
396
- var classList = target.classList;
397
- if (classList.contains('ant-select')) {
398
- if (classList.contains('ant-select-focused')) {
399
- setIsFocus(true);
400
- } else {
401
- setIsFocus(false);
402
- }
403
- }
404
- return;
405
- });
406
- });
407
- // 以上述配置开始观察目标节点
408
- if (wrapRef && wrapRef.current) {
409
- observer.observe(wrapRef.current, {
410
- attributeFilter: ['class'],
411
- subtree: true,
412
- attributeOldValue: true
413
- });
414
- }
415
- return function () {
416
- observer.disconnect();
417
- };
418
- }, [selectRef]);
419
- return /*#__PURE__*/React.createElement("div", {
420
- ref: wrapRef,
421
- onMouseDown: function onMouseDown() {
422
- if (disabled) return;
423
- if (!isOpen && Date.now() - dropDownTimeRef.current > 300) {
424
- setIsOpen(!isOpen);
425
- }
426
- },
427
- className: classNames('ald-select', className, (_classNames = {}, _defineProperty(_classNames, "ald-select-".concat(type), type === 'primary' || type === 'secondary'), _defineProperty(_classNames, 'ald-select-multiple', isMultiple), _defineProperty(_classNames, 'ald-select-single', !isMultiple), _defineProperty(_classNames, 'ald-select-large', size === 'large'), _defineProperty(_classNames, 'ald-select-small', size === 'small'), _defineProperty(_classNames, 'ald-select-disabled', mergedDisabled), _defineProperty(_classNames, 'ald-select-middle', size !== 'large' && size !== 'small'), _defineProperty(_classNames, 'ald-select-open', typeof _open === 'boolean' ? _open : isOpen), _defineProperty(_classNames, 'ald-select-focused', isFocus && type === 'secondary'), _defineProperty(_classNames, "ald-select-status-".concat(mergedStatus), mergedStatus), _defineProperty(_classNames, 'ald-select-empty-show-all', type === 'primary'), _defineProperty(_classNames, 'ald-select-has-value', !_.isEmpty(value) || !_.isEmpty(currentValue)), _classNames), compactItemClassnames, hashId),
428
- spellCheck: false,
429
- style: Object.assign(styleVar, style)
430
- }, !!prefix && /*#__PURE__*/React.createElement("span", {
431
- ref: prefixRef,
432
- className: classNames('ald-select-prefix', _defineProperty({}, "ald-select-prefix-".concat(isMultiple ? 'multiple' : 'single'), isMultiple))
433
- }, prefix), /*#__PURE__*/React.createElement(AntdSelect, _extends({}, restProps, {
434
- // @ts-ignore
435
- status: mergedStatus,
436
- placeholder: placeholder,
437
- showSearch: showSearch,
438
- options: innerOptions,
439
- virtual: virtual,
440
- showArrow: isMultiple && type === 'primary' ? false : showArrow,
441
- mode: isMultiple ? 'multiple' : undefined,
442
- bordered: false,
443
- open: typeof _open === 'boolean' ? _open : isOpen,
444
- disabled: mergedDisabled,
445
- maxTagCount: type === 'secondary' ? 'responsive' : 1,
446
- ref: selectRef,
447
- tagRender: tagRender || defaultTagRender,
448
- onChange: onChange,
449
- popupClassName: classNames('ald-select-popup', popupClassName),
450
- maxTagPlaceholder: maxTagPlaceholder,
451
- className: classNames({
452
- 'ald-select-prefix-select': !!prefix || prefix === 0
453
- }),
454
- dropdownStyle: dropdownStyle || defaultDropdownStyle,
455
- clearIcon: /*#__PURE__*/React.createElement(TimesLightLine, {
456
- className: "ald-select-clear-icon",
457
- color: "var(--alias-colors-icon-subtle)"
458
- }),
459
- style: {
460
- width: '100%'
461
- },
462
- suffixIcon: props.suffixIcon || /*#__PURE__*/React.createElement(ArrowDownFill, {
463
- className: "ald-select-suffix-icon"
464
- }),
465
- onDropdownVisibleChange: function onDropdownVisibleChange(open) {
466
- setIsOpen(open);
467
- if (!open) {
468
- dropDownTimeRef.current = Date.now();
469
- }
470
- _onDropdownVisibleChange === null || _onDropdownVisibleChange === void 0 ? void 0 : _onDropdownVisibleChange(open);
471
- },
472
- value: value !== null && value !== void 0 ? value : currentValue,
473
- dropdownRender: getDropdownRender(),
474
- autoFocus: isFocus,
475
- onFocus: function onFocus() {
476
- setIsFocus(true);
477
- },
478
- onBlur: function onBlur(e) {
479
- var _props$onBlur;
480
- (_props$onBlur = props.onBlur) === null || _props$onBlur === void 0 ? void 0 : _props$onBlur.call(props, e);
481
- }
482
- })));
483
- });
484
- export default Select;
@@ -1,27 +0,0 @@
1
- .ald-select.ald-select-empty-show-all:not(.ald-select-disabled) {
2
- .ant-select {
3
- .ant-select-selector {
4
- .ant-select-selection-placeholder {
5
- color: var(--alias-colors-text-default);
6
- font-weight: 500;
7
- }
8
- }
9
- }
10
- }
11
-
12
- .ald-select.ald-select-empty-show-all:not(.ald-select-has-value) {
13
- .ant-select {
14
- .ant-select-selector {
15
- .ant-select-selection-placeholder {
16
- right: auto;
17
- padding-right: 0;
18
- }
19
-
20
- .ant-select-selection-overflow {
21
- right: auto;
22
- min-width: 24px;
23
- padding-right: 0;
24
- }
25
- }
26
- }
27
- }
@@ -1,2 +0,0 @@
1
- import '../../style';
2
- import './index.less';