@aloudata/aloudata-design 2.14.7 → 2.14.8
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/AldSelect/BaseSelect.js +6 -3
- package/dist/AldSelect/SelectTrigger.d.ts +0 -1
- package/dist/AldSelect/SelectTrigger.js +3 -8
- package/dist/AldSelect/Selector/MultipleResponsiveSelectedSection.js +11 -11
- package/dist/AldSelect/hooks/useDisplayMenu.js +2 -1
- package/dist/AldSelect/hooks/useOptions.d.ts +7 -1
- package/dist/AldSelect/hooks/useOptions.js +15 -5
- package/dist/AldSelect/index.js +14 -6
- package/dist/AldSelect/utils/commonUtil.d.ts +1 -0
- package/dist/AldSelect/utils/commonUtil.js +5 -3
- package/dist/DoubleCircleIcon/index.d.ts +1 -1
- package/dist/Dropdown/index.js +2 -1
- package/dist/Form/index.d.ts +1 -1
- package/dist/InputSearch/index.d.ts +1 -0
- package/dist/InputSearch/index.js +5 -2
- package/dist/InputSearch/style/index.less +4 -0
- package/dist/Menu/index.d.ts +1 -0
- package/dist/Menu/index.js +4 -2
- package/dist/RenameInput/index.d.ts +2 -1
- package/dist/RenameInput/index.js +67 -48
- package/dist/RenameInput/style/index.less +9 -0
- package/dist/Table/helper.d.ts +1 -1
- package/dist/Tag/index.d.ts +4 -0
- package/dist/Tag/index.js +4 -2
- package/dist/ald.min.css +1 -1
- package/dist/locale/default.d.ts +1 -1
- package/package.json +1 -1
|
@@ -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"
|
|
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", "
|
|
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,
|
|
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
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
|
21
|
+
return false;
|
|
20
22
|
}
|
|
21
23
|
function close(e) {
|
|
22
|
-
var _dropdownRef$current, _dropdownRef$current$;
|
|
23
24
|
var target = e.target;
|
|
24
|
-
|
|
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('
|
|
29
|
+
document.addEventListener('mousedown', close);
|
|
30
30
|
return function () {
|
|
31
|
-
document.removeEventListener('
|
|
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
|
|
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
|
|
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(
|
|
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(
|
|
29
|
+
selectedKeys.push(toString(val));
|
|
25
30
|
} else {
|
|
26
31
|
var key = val.value;
|
|
27
32
|
if (key) {
|
|
28
|
-
selectedKeys.push(
|
|
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
|
}
|
package/dist/AldSelect/index.js
CHANGED
|
@@ -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(
|
|
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(
|
|
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
|
|
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
|
|
211
|
+
return toString(item.value) === menuInfo.key;
|
|
204
212
|
})) {
|
|
205
213
|
triggerChange(displayValues.filter(function (item) {
|
|
206
|
-
return item.value
|
|
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: (
|
|
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?: "
|
|
8
|
+
type?: "error" | "warning" | "success" | "info" | undefined;
|
|
9
9
|
}) => React.JSX.Element;
|
|
10
10
|
export default DoubleCircleIcon;
|
package/dist/Dropdown/index.js
CHANGED
|
@@ -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),
|
package/dist/Form/index.d.ts
CHANGED
|
@@ -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?: "" | "
|
|
21
|
+
status?: "" | "error" | "warning" | "success" | "validating" | undefined;
|
|
22
22
|
errors: React.ReactNode[];
|
|
23
23
|
warnings: React.ReactNode[];
|
|
24
24
|
};
|
|
@@ -17,6 +17,7 @@ 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;
|
|
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],
|
|
@@ -57,7 +60,7 @@ export default function InputSearch(props) {
|
|
|
57
60
|
'--init-width': initWidth + 'px'
|
|
58
61
|
}
|
|
59
62
|
}, /*#__PURE__*/React.createElement(Input, {
|
|
60
|
-
className: classnames(className,
|
|
63
|
+
className: classnames(className, (_classnames = {}, _defineProperty(_classnames, 'input-search-has-value', searchValue.length !== 0 || inputMode), _defineProperty(_classnames, 'inputMode', inputMode), _classnames)),
|
|
61
64
|
size: size,
|
|
62
65
|
onChange: onChangeValue,
|
|
63
66
|
onPressEnter: onPressEnter,
|
package/dist/Menu/index.d.ts
CHANGED
|
@@ -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;
|
package/dist/Menu/index.js
CHANGED
|
@@ -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;
|
|
@@ -13,6 +13,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
13
13
|
import classNames from 'classnames';
|
|
14
14
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
15
15
|
var defaultWidth = 20;
|
|
16
|
+
var PADDING_WIDTH = 2;
|
|
16
17
|
var RenameInput = function RenameInput(_ref) {
|
|
17
18
|
var propsValue = _ref.value,
|
|
18
19
|
onConfirm = _ref.onConfirm,
|
|
@@ -23,11 +24,17 @@ var RenameInput = function RenameInput(_ref) {
|
|
|
23
24
|
focus = _ref$focus === void 0 ? false : _ref$focus,
|
|
24
25
|
maxLength = _ref.maxLength,
|
|
25
26
|
validateValue = _ref.validateValue,
|
|
26
|
-
onError = _ref.onError
|
|
27
|
-
|
|
27
|
+
onError = _ref.onError,
|
|
28
|
+
_ref$readonly = _ref.readonly,
|
|
29
|
+
readonly = _ref$readonly === void 0 ? false : _ref$readonly;
|
|
30
|
+
var _useState = useState(false),
|
|
28
31
|
_useState2 = _slicedToArray(_useState, 2),
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
isEdit = _useState2[0],
|
|
33
|
+
setIsEdit = _useState2[1];
|
|
34
|
+
var _useState3 = useState(propsValue),
|
|
35
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
36
|
+
value = _useState4[0],
|
|
37
|
+
setValue = _useState4[1];
|
|
31
38
|
var divRef = useRef(null);
|
|
32
39
|
var inputRef = useRef(null);
|
|
33
40
|
var handleBlur = useCallback(function () {
|
|
@@ -39,60 +46,72 @@ var RenameInput = function RenameInput(_ref) {
|
|
|
39
46
|
if (!width && divRef.current && inputRef.current) {
|
|
40
47
|
var _divRef$current;
|
|
41
48
|
var tempWidth = ((_divRef$current = divRef.current) === null || _divRef$current === void 0 ? void 0 : _divRef$current.offsetWidth) || defaultWidth;
|
|
42
|
-
inputRef.current.style.width = tempWidth + 'px';
|
|
49
|
+
inputRef.current.style.width = tempWidth + PADDING_WIDTH + 'px';
|
|
43
50
|
}
|
|
44
|
-
}, [width, value]);
|
|
45
|
-
useEffect(function () {
|
|
46
|
-
setValue(propsValue);
|
|
47
|
-
}, [propsValue]);
|
|
51
|
+
}, [width, value, isEdit]);
|
|
48
52
|
useEffect(function () {
|
|
49
53
|
if (focus && inputRef.current) {
|
|
50
54
|
inputRef.current.select();
|
|
51
55
|
}
|
|
52
56
|
}, [focus]);
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
onError === null || onError === void 0 ? void 0 : onError(value);
|
|
70
|
-
setValue(propsValue);
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
autoFocus: focus,
|
|
74
|
-
onFocus: function onFocus() {
|
|
75
|
-
var _inputRef$current2;
|
|
76
|
-
(_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.select();
|
|
77
|
-
},
|
|
78
|
-
maxLength: maxLength,
|
|
79
|
-
onKeyUp: function onKeyUp(e) {
|
|
80
|
-
if (e.key === 'Enter') {
|
|
81
|
-
var _inputRef$current3;
|
|
82
|
-
if (!validateValue || validateValue(((_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : _inputRef$current3.value.trim()) || '')) {
|
|
83
|
-
var _inputRef$current4;
|
|
84
|
-
(_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0 ? void 0 : _inputRef$current4.blur();
|
|
57
|
+
if (isEdit && !readonly) {
|
|
58
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
59
|
+
className: "ald-rename-input"
|
|
60
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
61
|
+
className: classNames(className, 'ald-rename-input-wrapper'),
|
|
62
|
+
style: _objectSpread(_objectSpread({}, fontStyle), {}, {
|
|
63
|
+
width: width
|
|
64
|
+
}),
|
|
65
|
+
value: value,
|
|
66
|
+
ref: inputRef,
|
|
67
|
+
onChange: function onChange(e) {
|
|
68
|
+
return setValue(e.target.value);
|
|
69
|
+
},
|
|
70
|
+
onBlur: function onBlur(e) {
|
|
71
|
+
if (!validateValue || validateValue(e.target.value.trim())) {
|
|
72
|
+
handleBlur();
|
|
85
73
|
} else {
|
|
86
|
-
|
|
87
|
-
onError === null || onError === void 0 ? void 0 : onError(((_inputRef$current5 = inputRef.current) === null || _inputRef$current5 === void 0 ? void 0 : _inputRef$current5.value.trim()) || '');
|
|
74
|
+
onError === null || onError === void 0 ? void 0 : onError(value);
|
|
88
75
|
setValue(propsValue);
|
|
89
76
|
}
|
|
77
|
+
setIsEdit(false);
|
|
78
|
+
},
|
|
79
|
+
autoFocus: focus,
|
|
80
|
+
onFocus: function onFocus() {
|
|
81
|
+
var _inputRef$current2;
|
|
82
|
+
(_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.select();
|
|
83
|
+
},
|
|
84
|
+
maxLength: maxLength,
|
|
85
|
+
onKeyUp: function onKeyUp(e) {
|
|
86
|
+
if (e.key === 'Enter') {
|
|
87
|
+
var _inputRef$current3;
|
|
88
|
+
if (!validateValue || validateValue(((_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : _inputRef$current3.value.trim()) || '')) {
|
|
89
|
+
var _inputRef$current4;
|
|
90
|
+
(_inputRef$current4 = inputRef.current) === null || _inputRef$current4 === void 0 ? void 0 : _inputRef$current4.blur();
|
|
91
|
+
} else {
|
|
92
|
+
var _inputRef$current5;
|
|
93
|
+
onError === null || onError === void 0 ? void 0 : onError(((_inputRef$current5 = inputRef.current) === null || _inputRef$current5 === void 0 ? void 0 : _inputRef$current5.value.trim()) || '');
|
|
94
|
+
setValue(propsValue);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
90
97
|
}
|
|
98
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
99
|
+
ref: divRef,
|
|
100
|
+
className: "ald-rename-input-div",
|
|
101
|
+
style: fontStyle
|
|
102
|
+
}, value));
|
|
103
|
+
}
|
|
104
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
105
|
+
className: classNames(className, 'ald-rename-input-text'),
|
|
106
|
+
style: fontStyle,
|
|
107
|
+
onMouseEnter: function onMouseEnter() {
|
|
108
|
+
setIsEdit(true);
|
|
109
|
+
},
|
|
110
|
+
onClick: function onClick() {
|
|
111
|
+
var _inputRef$current6;
|
|
112
|
+
setValue(propsValue);
|
|
113
|
+
(_inputRef$current6 = inputRef.current) === null || _inputRef$current6 === void 0 ? void 0 : _inputRef$current6.select();
|
|
91
114
|
}
|
|
92
|
-
}
|
|
93
|
-
ref: divRef,
|
|
94
|
-
className: "ald-rename-input-div",
|
|
95
|
-
style: _objectSpread({}, fontStyle)
|
|
96
|
-
}, value));
|
|
115
|
+
}, propsValue);
|
|
97
116
|
};
|
|
98
117
|
export default RenameInput;
|
|
@@ -9,6 +9,15 @@
|
|
|
9
9
|
border: 1px solid transparent;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
.ald-rename-input-text {
|
|
13
|
+
height: 22px;
|
|
14
|
+
font-size: 13px;
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
padding: 2px;
|
|
18
|
+
border: 1px solid transparent;
|
|
19
|
+
}
|
|
20
|
+
|
|
12
21
|
.ald-rename-input-wrapper {
|
|
13
22
|
box-sizing: border-box;
|
|
14
23
|
height: 24px;
|
package/dist/Table/helper.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export declare function getTableColumns<TDataItem extends object>({ columns, con
|
|
|
23
23
|
render?: ((text: any, record: TDataItem, rowIndex: number) => import("react").ReactNode) | undefined;
|
|
24
24
|
ellipsis?: boolean | undefined;
|
|
25
25
|
noPadding?: boolean | undefined;
|
|
26
|
-
align?: "
|
|
26
|
+
align?: "center" | "left" | "right" | undefined;
|
|
27
27
|
fixed?: "left" | "right" | undefined;
|
|
28
28
|
sortOrder?: "ascend" | "descend" | null | undefined;
|
|
29
29
|
};
|