@aloudata/aloudata-design 2.14.6 → 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 +7 -3
- package/dist/AldSelect/SelectTrigger.d.ts +0 -1
- package/dist/AldSelect/SelectTrigger.js +3 -8
- package/dist/AldSelect/Selector/MultipleResponsiveSelectedSection.d.ts +2 -0
- package/dist/AldSelect/Selector/MultipleResponsiveSelectedSection.js +29 -13
- package/dist/AldSelect/Selector/MultipleSelector.js +13 -10
- 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/style/index.less +7 -4
- 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/LogicTree/components/LogicItem/index.js +55 -16
- 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/Tag/index.d.ts +4 -0
- package/dist/Tag/index.js +4 -2
- package/dist/ald.min.css +1 -1
- package/dist/locale/zh_CN.js +1 -1
- package/package.json +1 -1
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/Tag/index.d.ts
CHANGED
package/dist/Tag/index.js
CHANGED
|
@@ -20,7 +20,8 @@ export default function Tag(props) {
|
|
|
20
20
|
mode = props.mode,
|
|
21
21
|
disabled = props.disabled,
|
|
22
22
|
maxWidth = props.maxWidth,
|
|
23
|
-
className = props.className
|
|
23
|
+
className = props.className,
|
|
24
|
+
title = props.title;
|
|
24
25
|
var tagColor = getColor(color, status);
|
|
25
26
|
var bgColor = mode === 'border' ? '#fff' : convertHexToRGBA(tagColor, mode === 'fill' ? 0.16 : 0.06);
|
|
26
27
|
var onTagClick = useCallback(function (e) {
|
|
@@ -36,6 +37,7 @@ export default function Tag(props) {
|
|
|
36
37
|
onClose === null || onClose === void 0 ? void 0 : onClose(e);
|
|
37
38
|
}, [disabled, onClose]);
|
|
38
39
|
var DEFAULT_MAX_WIDTH = 160;
|
|
40
|
+
var domTitle = title !== undefined ? title : typeof children === 'string' ? children : '';
|
|
39
41
|
return /*#__PURE__*/React.createElement("span", {
|
|
40
42
|
className: classNames(prefixCls('container'), (_classNames = {}, _defineProperty(_classNames, prefixCls('small'), size === 'small'), _defineProperty(_classNames, prefixCls('large'), size === 'large'), _defineProperty(_classNames, prefixCls('clickable'), typeof onClick === 'function'), _defineProperty(_classNames, prefixCls('disabled'), disabled), _classNames), className || ''),
|
|
41
43
|
style: {
|
|
@@ -49,7 +51,7 @@ export default function Tag(props) {
|
|
|
49
51
|
className: prefixCls('icon')
|
|
50
52
|
}, icon), /*#__PURE__*/React.createElement("span", {
|
|
51
53
|
className: prefixCls('content'),
|
|
52
|
-
title:
|
|
54
|
+
title: domTitle
|
|
53
55
|
}, children), suffixIcon && /*#__PURE__*/React.createElement("span", {
|
|
54
56
|
className: prefixCls('suffix-icon')
|
|
55
57
|
}, suffixIcon), closable ? /*#__PURE__*/React.createElement("span", {
|