@aloudata/aloudata-design 2.14.7 → 2.14.9

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.
@@ -1,4 +1,4 @@
1
- var _excluded = ["id", "className", "displayValues", "onDisplayValuesChange", "displayMenu", "notFoundContent", "onClear", "width", "mode", "status", "onOptionSelect", "onClick", "size", "borderLess", "disabled", "placeholder", "open", "defaultOpen", "onOpenChange", "showSearch", "innerSearchValue", "setInnerSearchValue", "allowClear", "showArrow", "prefix", "suffixIcon", "dropdownRender", "overlayStyle", "dropdownStyle", "popupMatchSelectWidth", "placement", "popupClassName", "style", "listHeight"];
1
+ var _excluded = ["id", "className", "displayValues", "onDisplayValuesChange", "displayMenu", "notFoundContent", "onClear", "width", "mode", "status", "onOptionSelect", "onClick", "size", "borderLess", "disabled", "placeholder", "open", "defaultOpen", "onOpenChange", "showSearch", "innerSearchValue", "setInnerSearchValue", "allowClear", "showArrow", "prefix", "suffixIcon", "dropdownRender", "overlayStyle", "dropdownStyle", "popupMatchSelectWidth", "placement", "popupClassName", "style"];
2
2
  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); }
3
3
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
4
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -72,7 +72,6 @@ var BaseSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
72
72
  placement = props.placement,
73
73
  popupClassName = props.popupClassName,
74
74
  style = props.style,
75
- listHeight = props.listHeight,
76
75
  restProps = _objectWithoutProperties(props, _excluded);
77
76
  var setClassNames = prefixCls('select');
78
77
  var selectRef = useRef(null);
@@ -105,6 +104,7 @@ var BaseSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
105
104
  return onToggleOpen(true);
106
105
  },
107
106
  close: function close() {
107
+ console.log('ref close');
108
108
  onToggleOpen(false);
109
109
  }
110
110
  };
@@ -127,6 +127,7 @@ var BaseSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
127
127
  setInnerOpen = _useMergedState2[1];
128
128
  var mergedOpen = innerOpen;
129
129
  var onToggleOpen = React.useCallback(function (newOpen) {
130
+ console.log('toggle', newOpen);
130
131
  var nextOpen = newOpen !== undefined ? newOpen : !mergedOpen;
131
132
  if (!nextOpen) {
132
133
  setShowResponsiveSelectedSection(false);
@@ -170,6 +171,7 @@ var BaseSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
170
171
  var _displayMenu$onClick;
171
172
  displayMenu === null || displayMenu === void 0 ? void 0 : (_displayMenu$onClick = displayMenu.onClick) === null || _displayMenu$onClick === void 0 ? void 0 : _displayMenu$onClick.call(displayMenu, info);
172
173
  if (displayMenu && !isMultipleMode) {
174
+ console.log('menu onClick', info);
173
175
  onToggleOpen(false);
174
176
  setFocus(false);
175
177
  }
@@ -204,9 +206,9 @@ var BaseSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
204
206
  ,
205
207
  dropdownRender: dropdownRender,
206
208
  overlayStyle: overlayStyle || dropdownStyle,
207
- listHeight: listHeight,
208
209
  placement: placement,
209
210
  onOpenChange: function onOpenChange(open) {
211
+ console.log('onOpenChange', open);
210
212
  if (isResponsiveMode) {
211
213
  if (!mergedOpen && !showResponsiveSelectedSection && displayValues.length > 0) {
212
214
  setShowResponsiveSelectedSection(true);
@@ -237,6 +239,7 @@ var BaseSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
237
239
  allowClear: allowClear,
238
240
  isHover: isHover,
239
241
  onClear: function onClear() {
242
+ console.log('onClear');
240
243
  onToggleOpen(false);
241
244
  onDisplayValuesChange([], {
242
245
  type: 'clear',
@@ -18,7 +18,6 @@ export interface SelectTriggerProps extends IDropdownProps {
18
18
  searchValue?: string;
19
19
  setInnerSearchValue?: (value: string) => void;
20
20
  filterOption?: (inputValue: string, option: SelectOptionType) => boolean;
21
- listHeight?: number;
22
21
  }
23
22
  declare const RefSelectTrigger: React.ForwardRefExoticComponent<SelectTriggerProps & React.RefAttributes<RefTriggerProps>>;
24
23
  export default RefSelectTrigger;
@@ -1,4 +1,4 @@
1
- var _excluded = ["overlayStyle", "disabled", "open", "children", "dropdownRender", "getPopupContainer", "onOpenChange", "showSearch", "searchValue", "setInnerSearchValue", "menu", "overlayClassName", "placement", "popupMatchSelectWidth", "listHeight", "notFoundContent"];
1
+ var _excluded = ["overlayStyle", "disabled", "open", "children", "dropdownRender", "getPopupContainer", "onOpenChange", "showSearch", "searchValue", "setInnerSearchValue", "menu", "overlayClassName", "placement", "popupMatchSelectWidth", "notFoundContent"];
2
2
  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); }
3
3
  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; }
4
4
  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; }
@@ -24,7 +24,6 @@ var RefSelectTrigger = /*#__PURE__*/React.forwardRef(function (props, ref) {
24
24
  _props$placement = props.placement,
25
25
  placement = _props$placement === void 0 ? 'bottom-start' : _props$placement,
26
26
  popupMatchSelectWidth = props.popupMatchSelectWidth,
27
- listHeight = props.listHeight,
28
27
  _props$notFoundConten = props.notFoundContent,
29
28
  notFoundContent = _props$notFoundConten === void 0 ? /*#__PURE__*/React.createElement(Empty, {
30
29
  size: "small"
@@ -43,11 +42,7 @@ var RefSelectTrigger = /*#__PURE__*/React.forwardRef(function (props, ref) {
43
42
  var customDropdownRender = useCallback(function (menu) {
44
43
  return /*#__PURE__*/React.createElement("div", {
45
44
  className: "beta-ald-select-popup",
46
- ref: popupRef,
47
- style: {
48
- height: listHeight,
49
- overflow: 'auto'
50
- }
45
+ ref: popupRef
51
46
  }, /*#__PURE__*/React.createElement(SearchBox, {
52
47
  showSearch: showSearch,
53
48
  value: searchValue,
@@ -60,7 +55,7 @@ var RefSelectTrigger = /*#__PURE__*/React.forwardRef(function (props, ref) {
60
55
  dropdownRender: dropdownRender,
61
56
  menuProps: menuProps
62
57
  }));
63
- }, [dropdownRender, listHeight, menuProps, notFoundContent, searchValue, setInnerSearchValue, showSearch]);
58
+ }, [dropdownRender, menuProps, notFoundContent, searchValue, setInnerSearchValue, showSearch]);
64
59
  return /*#__PURE__*/React.createElement(Dropdown, _extends({}, restProps, {
65
60
  disabled: disabled,
66
61
  open: open,
@@ -10,25 +10,25 @@ export default function MultipleResponsiveSelectedSection(params) {
10
10
  suffixIcon = params.suffixIcon;
11
11
  var multipleSelectedSectionRef = useRef(null);
12
12
  useEffect(function () {
13
- function getSelect() {
14
- var _multipleSelectedSect, _multipleSelectedSect2, _multipleSelectedSect3;
15
- var select = (_multipleSelectedSect = multipleSelectedSectionRef.current) === null || _multipleSelectedSect === void 0 ? void 0 : (_multipleSelectedSect2 = _multipleSelectedSect.parentElement) === null || _multipleSelectedSect2 === void 0 ? void 0 : (_multipleSelectedSect3 = _multipleSelectedSect2.parentElement) === null || _multipleSelectedSect3 === void 0 ? void 0 : _multipleSelectedSect3.parentElement;
16
- if (select && select.classList.contains('beta-ald-select')) {
17
- return select;
13
+ function isAncestorElement(ancestorClass, target) {
14
+ var currentElement = target;
15
+ while (currentElement) {
16
+ if (currentElement.classList.contains(ancestorClass)) {
17
+ return true;
18
+ }
19
+ currentElement = currentElement.parentElement;
18
20
  }
19
- return null;
21
+ return false;
20
22
  }
21
23
  function close(e) {
22
- var _dropdownRef$current, _dropdownRef$current$;
23
24
  var target = e.target;
24
- var select = getSelect();
25
- if (select && !select.contains(target) && !((_dropdownRef$current = dropdownRef.current) !== null && _dropdownRef$current !== void 0 && (_dropdownRef$current$ = _dropdownRef$current.getPopupElement()) !== null && _dropdownRef$current$ !== void 0 && _dropdownRef$current$.contains(target))) {
25
+ if (!isAncestorElement('beta-ald-select', target) && !isAncestorElement('beta-ald-select-popup', target)) {
26
26
  onToggleOpen(false);
27
27
  }
28
28
  }
29
- document.addEventListener('click', close);
29
+ document.addEventListener('mousedown', close);
30
30
  return function () {
31
- document.removeEventListener('click', close);
31
+ document.removeEventListener('mousedown', close);
32
32
  };
33
33
  }, [onToggleOpen, dropdownRef]);
34
34
  return /*#__PURE__*/React.createElement("div", {
@@ -12,6 +12,7 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
12
12
  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; }
13
13
  import { useCallback, useMemo } from 'react';
14
14
  import { isDivideMenuItem, isHeaderMenuItem, isSubMenuItem } from "../../Menu";
15
+ import { toString } from "../utils/commonUtil";
15
16
  export default function useDisplayMenu(menu, filterOptions, innerSearchValue) {
16
17
  var items = menu.items;
17
18
  var filter = useCallback(function (inputValue, option) {
@@ -19,7 +20,7 @@ export default function useDisplayMenu(menu, filterOptions, innerSearchValue) {
19
20
  return filterOptions(inputValue, option);
20
21
  }
21
22
  var toBeSearched = option.label || option.value || '';
22
- return toBeSearched.toString().includes(inputValue);
23
+ return toString(toBeSearched).includes(inputValue);
23
24
  }, [filterOptions]);
24
25
  var findFilteredItems = useCallback(function (currentItems) {
25
26
  return currentItems.filter(function (item) {
@@ -5,7 +5,13 @@ export declare function isRawValue(value: DraftValueType): value is RawValueType
5
5
  * Parse `children` to `options` if `options` is not provided.
6
6
  * Then flatten the `options`.
7
7
  */
8
- export default function useOptions<OptionType extends DefaultOptionType>(menu?: SelectMenuProps, options?: OptionType[], value?: DraftValueType, optionLabelProp?: string): {
8
+ export default function useOptions<OptionType extends DefaultOptionType>({ menu, options, value, optionLabelProp, listHeight, }: {
9
+ menu?: SelectMenuProps;
10
+ options?: OptionType[];
11
+ value?: DraftValueType;
12
+ optionLabelProp?: string;
13
+ listHeight?: number;
14
+ }): {
9
15
  menu: SelectMenuProps;
10
16
  keyMenuItems: Map<string, SelectItemType>;
11
17
  labelMenuItems: Map<React.ReactNode, SelectMenuItemType>;
@@ -6,7 +6,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
6
6
  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); }
7
7
  import * as React from 'react';
8
8
  import { isDivideMenuItem, isHeaderMenuItem, isSubMenuItem } from "../../Menu";
9
- import { convertOptionsToMenu, toArray } from "../utils/commonUtil";
9
+ import { convertOptionsToMenu, toArray, toString } from "../utils/commonUtil";
10
10
  export function isRawValue(value) {
11
11
  return !value || _typeof(value) !== 'object';
12
12
  }
@@ -14,18 +14,23 @@ export function isRawValue(value) {
14
14
  * Parse `children` to `options` if `options` is not provided.
15
15
  * Then flatten the `options`.
16
16
  */
17
- export default function useOptions(menu, options, value, optionLabelProp) {
17
+ export default function useOptions(_ref) {
18
+ var menu = _ref.menu,
19
+ options = _ref.options,
20
+ value = _ref.value,
21
+ optionLabelProp = _ref.optionLabelProp,
22
+ listHeight = _ref.listHeight;
18
23
  return React.useMemo(function () {
19
24
  var selectedKeys = [];
20
25
  if (value) {
21
26
  var valueList = toArray(value);
22
27
  valueList.forEach(function (val) {
23
28
  if (isRawValue(val)) {
24
- selectedKeys.push(val.toString());
29
+ selectedKeys.push(toString(val));
25
30
  } else {
26
31
  var key = val.value;
27
32
  if (key) {
28
- selectedKeys.push(key.toString());
33
+ selectedKeys.push(toString(key));
29
34
  }
30
35
  }
31
36
  });
@@ -55,10 +60,15 @@ export default function useOptions(menu, options, value, optionLabelProp) {
55
60
  }
56
61
  }
57
62
  dig(mergedMenu.items || []);
63
+ if (listHeight) {
64
+ mergedMenu.menuStyle = {
65
+ maxHeight: listHeight
66
+ };
67
+ }
58
68
  return {
59
69
  menu: mergedMenu,
60
70
  keyMenuItems: keyMenuItems,
61
71
  labelMenuItems: labelMenuItems
62
72
  };
63
- }, [value, menu, options, optionLabelProp]);
73
+ }, [value, menu, options, optionLabelProp, listHeight]);
64
74
  }
@@ -23,6 +23,7 @@ import useCache from "./hooks/useCache";
23
23
  import BaseSelect, { isMultiple } from "./BaseSelect";
24
24
  import { injectPropsWithOption } from "./utils/valueUtil";
25
25
  import useDisplayMenu from "./hooks/useDisplayMenu";
26
+ import { toString } from "./utils/commonUtil";
26
27
  export default /*#__PURE__*/forwardRef(function AldSelect(props, ref) {
27
28
  var value = props.value,
28
29
  defaultValue = props.defaultValue,
@@ -35,7 +36,8 @@ export default /*#__PURE__*/forwardRef(function AldSelect(props, ref) {
35
36
  labelInValue = props.labelInValue,
36
37
  filterOption = props.filterOption,
37
38
  searchValue = props.searchValue,
38
- optionLabelProp = props.optionLabelProp;
39
+ optionLabelProp = props.optionLabelProp,
40
+ listHeight = props.listHeight;
39
41
 
40
42
  // =========================== Values ===========================
41
43
  var _useMergedState = useMergedState(defaultValue, {
@@ -44,7 +46,13 @@ export default /*#__PURE__*/forwardRef(function AldSelect(props, ref) {
44
46
  _useMergedState2 = _slicedToArray(_useMergedState, 2),
45
47
  internalValue = _useMergedState2[0],
46
48
  setInternalValue = _useMergedState2[1];
47
- var parsedOptions = useOptions(menu, options, internalValue);
49
+ var parsedOptions = useOptions({
50
+ menu: menu,
51
+ options: options,
52
+ value: internalValue,
53
+ optionLabelProp: optionLabelProp,
54
+ listHeight: listHeight
55
+ });
48
56
  var mergedMenu = parsedOptions.menu,
49
57
  keyMenuItems = parsedOptions.keyMenuItems;
50
58
  var multiple = mode && isMultiple(mode);
@@ -73,7 +81,7 @@ export default /*#__PURE__*/forwardRef(function AldSelect(props, ref) {
73
81
  // @ts-ignore val.key是为了兼容存在key的情况
74
82
  rawValue = (_ref = val.value) !== null && _ref !== void 0 ? _ref : val.key;
75
83
  }
76
- var menuItem = keyMenuItems.get(rawValue.toString());
84
+ var menuItem = keyMenuItems.get(toString(rawValue));
77
85
  if (menuItem) {
78
86
  // Fill missing props
79
87
  if (rawLabel === undefined) {
@@ -169,7 +177,7 @@ export default /*#__PURE__*/forwardRef(function AldSelect(props, ref) {
169
177
  // Used for OptionList selection
170
178
  var onOptionSelect = function onOptionSelect(val) {
171
179
  var selected = displayValues.find(function (item) {
172
- return item.value.toString() === val;
180
+ return toString(item.value) === toString(val);
173
181
  });
174
182
  if (isMultiple(mode)) {
175
183
  if (!selected) {
@@ -200,10 +208,10 @@ export default /*#__PURE__*/forwardRef(function AldSelect(props, ref) {
200
208
  var _mergedMenu$onClick;
201
209
  if (mode && isMultiple(mode)) {
202
210
  if (displayValues.find(function (item) {
203
- return item.value.toString() === menuInfo.key;
211
+ return toString(item.value) === menuInfo.key;
204
212
  })) {
205
213
  triggerChange(displayValues.filter(function (item) {
206
- return item.value.toString() !== menuInfo.key;
214
+ return toString(item.value) !== menuInfo.key;
207
215
  }).map(function (item) {
208
216
  return item.value;
209
217
  }));
@@ -2,6 +2,7 @@
2
2
  import { DefaultOptionType, SelectMenuProps } from '../interface';
3
3
  export declare function toArray<T>(value: T | T[]): T[];
4
4
  export declare const isClient: false | HTMLElement;
5
+ export declare const toString: (value: any) => string;
5
6
  /** Is client side and not jsdom */
6
7
  export declare const isBrowserClient: false | HTMLElement;
7
8
  export declare function convertOptionsToMenu(options: DefaultOptionType[], selectedKeys: React.Key[]): SelectMenuProps;
@@ -4,6 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
4
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
5
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
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
+ import _ from 'lodash';
7
8
  export function toArray(value) {
8
9
  if (Array.isArray(value)) {
9
10
  return value;
@@ -11,16 +12,17 @@ export function toArray(value) {
11
12
  return value !== undefined ? [value] : [];
12
13
  }
13
14
  export var isClient = typeof window !== 'undefined' && window.document && window.document.documentElement;
14
-
15
+ export var toString = function toString(value) {
16
+ return _.toString(value);
17
+ };
15
18
  /** Is client side and not jsdom */
16
19
  export var isBrowserClient = process.env.NODE_ENV !== 'test' && isClient;
17
20
  export function convertOptionsToMenu(options, selectedKeys) {
18
21
  return {
19
22
  items: options.map(function (option) {
20
- var _option$value;
21
23
  return _objectSpread(_objectSpread({}, option), {}, {
22
24
  label: option.label,
23
- key: ((_option$value = option.value) === null || _option$value === void 0 ? void 0 : _option$value.toString()) || '',
25
+ key: toString(option.value),
24
26
  disabled: option.disabled,
25
27
  onClick: option.onClick,
26
28
  className: option.className,
@@ -5,6 +5,6 @@ declare const DoubleCircleIcon: (props: {
5
5
  size?: number | undefined;
6
6
  innerColor?: string | undefined;
7
7
  children: React.ReactNode;
8
- type?: "success" | "error" | "info" | "warning" | undefined;
8
+ type?: "error" | "warning" | "success" | "info" | undefined;
9
9
  }) => React.JSX.Element;
10
10
  export default DoubleCircleIcon;
@@ -42,7 +42,8 @@ export default function Dropdown(props) {
42
42
  delay = _props$delay === void 0 ? 0 : _props$delay,
43
43
  _props$autoUpdatePos = props.autoUpdatePos,
44
44
  autoUpdatePos = _props$autoUpdatePos === void 0 ? false : _props$autoUpdatePos,
45
- initialFocus = props.initialFocus,
45
+ _props$initialFocus = props.initialFocus,
46
+ initialFocus = _props$initialFocus === void 0 ? -1 : _props$initialFocus,
46
47
  _props$popupMatchTrig = props.popupMatchTriggerWidth,
47
48
  popupMatchTriggerWidth = _props$popupMatchTrig === void 0 ? false : _props$popupMatchTrig;
48
49
  var _useState = useState(open || false),
@@ -18,7 +18,7 @@ interface IFormItemProps extends FormItemProps {
18
18
  declare const AldFormItem: {
19
19
  (props: IFormItemProps): React.JSX.Element;
20
20
  useStatus: () => {
21
- status?: "" | "success" | "error" | "warning" | "validating" | undefined;
21
+ status?: "" | "error" | "warning" | "success" | "validating" | undefined;
22
22
  errors: React.ReactNode[];
23
23
  warnings: React.ReactNode[];
24
24
  };
@@ -13,6 +13,7 @@ import classnames from 'classnames';
13
13
  import React, { useContext } from 'react';
14
14
  import { ConfigContext } from "../../../ConfigProvider";
15
15
  import { CloseCircleFill } from "../../../Icon";
16
+ import useFormItemStatus from 'antd/lib/form/hooks/useFormItemStatus';
16
17
  export function getSizeType(sizeType) {
17
18
  if (['small', 'middle', 'large'].includes(sizeType || '')) {
18
19
  return sizeType;
@@ -38,9 +39,15 @@ var Input = /*#__PURE__*/React.forwardRef(function (props, ref) {
38
39
  compactSize = _useCompactItemContex.compactSize,
39
40
  compactItemClassnames = _useCompactItemContex.compactItemClassnames;
40
41
  var contentSize = useContext(SizeContext);
42
+ var _useFormItemStatus = useFormItemStatus(),
43
+ formItemStatus = _useFormItemStatus.status;
44
+ var mergedStatus = status || formItemStatus;
41
45
  var size = compactSize || customSize || contentSize || 'middle';
42
46
  return /*#__PURE__*/React.createElement(AntdInput, _extends({}, rest, {
43
- ref: ref,
47
+ ref: ref
48
+ // @ts-ignore
49
+ ,
50
+ status: mergedStatus,
44
51
  bordered: bordered,
45
52
  disabled: disabled,
46
53
  autoComplete: "off",
@@ -51,7 +58,7 @@ var Input = /*#__PURE__*/React.forwardRef(function (props, ref) {
51
58
  })
52
59
  } : undefined,
53
60
  spellCheck: false,
54
- className: classnames('ald-input', "ald-input-".concat(getSizeType(size)), (_classnames = {}, _defineProperty(_classnames, "ald-input-".concat(status), status), _defineProperty(_classnames, "ald-input-disabled", disabled), _classnames), className, compactItemClassnames)
61
+ className: classnames('ald-input', "ald-input-".concat(getSizeType(size)), (_classnames = {}, _defineProperty(_classnames, "ald-input-".concat(mergedStatus), mergedStatus), _defineProperty(_classnames, "ald-input-disabled", disabled), _classnames), className, compactItemClassnames)
55
62
  }));
56
63
  });
57
64
  export default Input;
@@ -2,7 +2,7 @@
2
2
  @input-height-large: 36px;
3
3
  @input-padding-large: var(--alias-padding-75-minus-1, 6px)
4
4
  var(--alias-padding-150-minus-1, 12px);
5
- @input-font-size-large: 16px;
5
+ @input-font-size-large: 14px;
6
6
  @input-border-radius-large: 8px;
7
7
  @input-prefix-margin-right-large: var(--alias-spacing-100, 8px);
8
8
  @input-clear-icon-large: 20px;
@@ -8,5 +8,6 @@ interface IProps {
8
8
  size?: 'small' | 'middle' | 'large';
9
9
  initWidth?: number;
10
10
  defaultValue?: string;
11
+ inputMode?: boolean;
11
12
  }
12
13
  export {};
@@ -11,12 +11,13 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
11
  import { useDebounceFn } from 'ahooks';
12
12
  import classnames from 'classnames';
13
13
  import _ from 'lodash';
14
- import React, { useCallback, useContext, useState } from 'react';
14
+ import React, { useCallback, useContext, useMemo, useState } from 'react';
15
15
  import { SearchLine } from "../Icon";
16
16
  import Input from "../Input";
17
17
  import { LocaleContext, getTranslator } from "../locale/default";
18
18
  var DEFAULT_WIDTH = 68;
19
19
  export default function InputSearch(props) {
20
+ var _classnames, _classnames2;
20
21
  var _useContext = useContext(LocaleContext),
21
22
  locale = _useContext.locale;
22
23
  var t = getTranslator(locale);
@@ -29,7 +30,9 @@ export default function InputSearch(props) {
29
30
  size = _props$size === void 0 ? 'small' : _props$size,
30
31
  _props$initWidth = props.initWidth,
31
32
  initWidth = _props$initWidth === void 0 ? DEFAULT_WIDTH : _props$initWidth,
32
- defaultValue = props.defaultValue;
33
+ defaultValue = props.defaultValue,
34
+ _props$inputMode = props.inputMode,
35
+ inputMode = _props$inputMode === void 0 ? false : _props$inputMode;
33
36
  var _useState = useState(defaultValue || ''),
34
37
  _useState2 = _slicedToArray(_useState, 2),
35
38
  searchValue = _useState2[0],
@@ -51,18 +54,27 @@ export default function InputSearch(props) {
51
54
  }
52
55
  setSearchValue(newValue);
53
56
  }, [debounceSearch, debounce]);
57
+ var iconSize = useMemo(function () {
58
+ if (size === 'middle' || size === 'large') {
59
+ return 20;
60
+ }
61
+ return 16;
62
+ }, [size]);
54
63
  return /*#__PURE__*/React.createElement("div", {
55
- className: 'ald-input-search',
64
+ className: classnames('ald-input-search', (_classnames = {}, _defineProperty(_classnames, 'input-search-size-small', size === 'small'), _defineProperty(_classnames, 'input-search-size-middle', size === 'middle'), _defineProperty(_classnames, 'input-search-size-large', size === 'large'), _classnames)),
56
65
  style: {
57
66
  '--init-width': initWidth + 'px'
58
67
  }
59
68
  }, /*#__PURE__*/React.createElement(Input, {
60
- className: classnames(className, _defineProperty({}, 'input-search-has-value', searchValue.length !== 0)),
61
- size: size,
69
+ className: classnames(className, (_classnames2 = {}, _defineProperty(_classnames2, 'input-search-has-value', searchValue.length !== 0 || inputMode), _defineProperty(_classnames2, 'inputMode', inputMode), _classnames2)),
70
+ size: size
71
+ // @ts-ignore
72
+ ,
73
+ status: 'success',
62
74
  onChange: onChangeValue,
63
75
  onPressEnter: onPressEnter,
64
76
  prefix: /*#__PURE__*/React.createElement(SearchLine, {
65
- size: 16
77
+ size: iconSize
66
78
  }),
67
79
  placeholder: placeholder || t.InputSearch.search,
68
80
  allowClear: true,
@@ -15,13 +15,26 @@
15
15
  display: none;
16
16
  }
17
17
 
18
+ &.input-search-size-small {
19
+ ::placeholder {
20
+ font-size: 12px;
21
+ line-height: 16px; /* 133.333% */
22
+ }
23
+ }
24
+
25
+ &.input-search-size-middle,
26
+ &.input-search-size-large {
27
+ ::placeholder {
28
+ font-size: 14px;
29
+ line-height: 20px;
30
+ }
31
+ }
32
+
18
33
  ::placeholder {
19
34
  color: var(--alias-colors-text-default, #1f2937);
20
- font-size: 12px;
21
35
  font-style: normal;
22
36
  font-weight: 500;
23
37
  background-color: var(--alias-colors-bg-skeleton-subtle, #f9fafb);
24
- line-height: 16px; /* 133.333% */
25
38
  }
26
39
 
27
40
  &.ant-input-affix-wrapper-focused,
@@ -31,6 +44,10 @@
31
44
  transition: all 0.2s ease 0.1s !important;
32
45
  background-color: var(--alias-colors-bg-skeleton-subtler, #fff);
33
46
 
47
+ &.inputMode {
48
+ width: 100% !important;
49
+ }
50
+
34
51
  input {
35
52
  background-color: #fff;
36
53
  }
@@ -4,6 +4,7 @@ export interface MenuProps {
4
4
  className?: string;
5
5
  items: MenuItemType[];
6
6
  selectedKeys?: string[];
7
+ menuStyle?: React.CSSProperties;
7
8
  }
8
9
  export default function Menu(props: MenuProps): React.JSX.Element;
9
10
  export declare function isHeaderMenuItem(menuItem: MenuItemType): menuItem is MenuHeaderType;
@@ -13,7 +13,8 @@ export default function Menu(props) {
13
13
  var className = props.className,
14
14
  items = props.items,
15
15
  onMenuClick = props.onClick,
16
- selectedKeys = props.selectedKeys;
16
+ selectedKeys = props.selectedKeys,
17
+ menuStyle = props.menuStyle;
17
18
  var getMenuItems = function getMenuItems(items) {
18
19
  var parentPath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
19
20
  return items.map(function (item, index) {
@@ -92,6 +93,7 @@ export default function Menu(props) {
92
93
  ref: ref
93
94
  }), /*#__PURE__*/React.createElement(ControlledMenu, {
94
95
  state: "open",
96
+ menuStyle: menuStyle,
95
97
  anchorRef: ref,
96
98
  className: classNames(className, 'ald-menu'),
97
99
  position: "auto",
@@ -107,7 +109,7 @@ export function isDivideMenuItem(menuItem) {
107
109
  return 'type' in menuItem && menuItem.type === 'divider';
108
110
  }
109
111
  export function isSubMenuItem(menuItem) {
110
- return 'children' in menuItem;
112
+ return 'children' in menuItem && !!menuItem.children;
111
113
  }
112
114
  export function isLeafMenu(menuItems) {
113
115
  return !_.some(menuItems, function (item) {
@@ -10,6 +10,7 @@ interface IProps {
10
10
  maxLength?: number;
11
11
  distance?: [left: number, right: number];
12
12
  validateValue?: (value: string) => boolean;
13
+ readonly?: boolean;
13
14
  }
14
- declare const RenameInput: ({ value: propsValue, onConfirm, className, width, fontStyle, focus, maxLength, validateValue, onError, }: IProps) => React.JSX.Element;
15
+ declare const RenameInput: ({ value: propsValue, onConfirm, className, width, fontStyle, focus, maxLength, validateValue, onError, readonly, }: IProps) => React.JSX.Element;
15
16
  export default RenameInput;