@aloudata/aloudata-design 0.1.0-beta.4 → 0.2.0-beta.10
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/es/Button/index.d.ts +0 -1
- package/es/Button/index.js +0 -1
- package/es/Button/style/index.less +23 -13
- package/es/Dropdown/Button.d.ts +0 -1
- package/es/Dropdown/Button.js +0 -1
- package/es/Dropdown/index.d.ts +1 -1
- package/es/Dropdown/index.js +0 -1
- package/es/Empty/index.d.ts +7 -0
- package/es/Empty/index.js +56 -0
- package/es/Empty/style/index.d.ts +1 -0
- package/es/Empty/style/index.js +1 -0
- package/es/Empty/style/index.less +24 -0
- package/es/Icon/iconfont/demo_index.html +49 -3
- package/es/Icon/iconfont/iconfont.css +11 -3
- package/es/Icon/iconfont/iconfont.js +5 -5
- package/es/Icon/iconfont/iconfont.json +14 -0
- package/es/Icon/iconfont/iconfont.ttf +0 -0
- package/es/Icon/iconfont/iconfont.woff +0 -0
- package/es/Icon/iconfont/iconfont.woff2 +0 -0
- package/es/Icon/index.js +3 -1
- package/es/Icon/index.less +2 -2
- package/es/Input/components/Group/index.d.ts +2 -2
- package/es/Input/components/Input/index.d.ts +61 -0
- package/es/Input/components/Input/index.js +37 -0
- package/es/Input/components/Password/index.d.ts +5 -4
- package/es/Input/components/Password/index.js +5 -4
- package/es/Input/components/TextArea/index.d.ts +9 -4
- package/es/Input/components/TextArea/index.js +16 -6
- package/es/Input/index.d.ts +14 -63
- package/es/Input/index.js +4 -41
- package/es/Input/style/index.less +5 -3
- package/es/Menu/Divider.d.ts +0 -1
- package/es/Menu/Divider.js +0 -1
- package/es/Menu/MenuItem.d.ts +7 -1
- package/es/Menu/MenuItem.js +0 -1
- package/es/Menu/SubMenu.d.ts +0 -1
- package/es/Menu/SubMenu.js +0 -1
- package/es/Menu/index.d.ts +1 -1
- package/es/Menu/index.js +0 -1
- package/es/Menu/style/index.less +4 -0
- package/es/Navigator/components/Menu/index.d.ts +19 -0
- package/es/Navigator/components/Menu/index.js +187 -0
- package/es/Navigator/index.d.ts +40 -0
- package/es/Navigator/index.js +44 -0
- package/es/Navigator/style/index.d.ts +2 -0
- package/es/Navigator/style/index.js +2 -0
- package/es/Navigator/style/index.less +228 -0
- package/es/Select/index.d.ts +0 -1
- package/es/Select/index.js +0 -1
- package/es/Table/index.d.ts +4 -0
- package/es/Table/index.js +350 -0
- package/es/Table/interface.d.ts +36 -0
- package/es/Table/interface.js +1 -0
- package/es/Table/react-table-config.d.ts +122 -0
- package/es/Table/style/index.d.ts +2 -0
- package/es/Table/style/index.js +2 -0
- package/es/Table/style/index.less +151 -0
- package/es/Tabs/index.d.ts +1 -1
- package/es/Tabs/index.js +0 -1
- package/es/Tooltip/index.d.ts +0 -1
- package/es/Tooltip/index.js +0 -1
- package/es/index.d.ts +12 -0
- package/es/index.js +3 -1
- package/es/style/themes/default/index.less +1 -1
- package/lib/Button/index.d.ts +0 -1
- package/lib/Button/index.js +0 -2
- package/lib/Button/style/index.less +23 -13
- package/lib/Dropdown/Button.d.ts +0 -1
- package/lib/Dropdown/Button.js +0 -2
- package/lib/Dropdown/index.d.ts +1 -1
- package/lib/Dropdown/index.js +0 -2
- package/lib/Empty/index.d.ts +7 -0
- package/lib/Empty/index.js +69 -0
- package/lib/Empty/style/index.d.ts +1 -0
- package/lib/Empty/style/index.js +3 -0
- package/lib/Empty/style/index.less +24 -0
- package/lib/Icon/iconfont/demo_index.html +49 -3
- package/lib/Icon/iconfont/iconfont.css +11 -3
- package/lib/Icon/iconfont/iconfont.js +5 -5
- package/lib/Icon/iconfont/iconfont.json +14 -0
- package/lib/Icon/iconfont/iconfont.ttf +0 -0
- package/lib/Icon/iconfont/iconfont.woff +0 -0
- package/lib/Icon/iconfont/iconfont.woff2 +0 -0
- package/lib/Icon/index.js +5 -3
- package/lib/Icon/index.less +2 -2
- package/lib/Input/components/Group/index.d.ts +2 -2
- package/lib/Input/components/Input/index.d.ts +61 -0
- package/lib/Input/components/Input/index.js +50 -0
- package/lib/Input/components/Password/index.d.ts +5 -4
- package/lib/Input/components/Password/index.js +10 -8
- package/lib/Input/components/TextArea/index.d.ts +9 -4
- package/lib/Input/components/TextArea/index.js +18 -7
- package/lib/Input/index.d.ts +14 -63
- package/lib/Input/index.js +4 -44
- package/lib/Input/style/index.less +5 -3
- package/lib/Menu/Divider.d.ts +0 -1
- package/lib/Menu/Divider.js +0 -2
- package/lib/Menu/MenuItem.d.ts +7 -1
- package/lib/Menu/MenuItem.js +0 -2
- package/lib/Menu/SubMenu.d.ts +0 -1
- package/lib/Menu/SubMenu.js +0 -2
- package/lib/Menu/index.d.ts +1 -1
- package/lib/Menu/index.js +0 -2
- package/lib/Menu/style/index.less +4 -0
- package/lib/Navigator/components/Menu/index.d.ts +19 -0
- package/lib/Navigator/components/Menu/index.js +205 -0
- package/lib/Navigator/index.d.ts +40 -0
- package/lib/Navigator/index.js +62 -0
- package/lib/Navigator/style/index.d.ts +2 -0
- package/lib/Navigator/style/index.js +5 -0
- package/lib/Navigator/style/index.less +228 -0
- package/lib/Select/index.d.ts +0 -1
- package/lib/Select/index.js +0 -2
- package/lib/Table/index.d.ts +4 -0
- package/lib/Table/index.js +375 -0
- package/lib/Table/interface.d.ts +36 -0
- package/lib/Table/interface.js +5 -0
- package/lib/Table/react-table-config.d.ts +122 -0
- package/lib/Table/style/index.d.ts +2 -0
- package/lib/Table/style/index.js +5 -0
- package/lib/Table/style/index.less +151 -0
- package/lib/Tabs/index.d.ts +1 -1
- package/lib/Tabs/index.js +0 -2
- package/lib/Tooltip/index.d.ts +0 -1
- package/lib/Tooltip/index.js +0 -2
- package/lib/index.d.ts +12 -0
- package/lib/index.js +16 -0
- package/lib/style/themes/default/index.less +1 -1
- package/package.json +19 -4
- package/es/Button/demo/Icon/index.d.ts +0 -3
- package/es/Button/demo/Icon/index.js +0 -67
- package/es/Button/demo/Icon/index.less +0 -6
- package/es/Button/demo/basic/index.d.ts +0 -4
- package/es/Button/demo/basic/index.js +0 -57
- package/es/Button/demo/basic/index.less +0 -6
- package/es/Button/demo/disable/index.d.ts +0 -3
- package/es/Button/demo/disable/index.js +0 -23
- package/es/Button/demo/disable/index.less +0 -0
- package/es/Button/demo/href/index.d.ts +0 -2
- package/es/Button/demo/href/index.js +0 -17
- package/es/Button/demo/loading/index.d.ts +0 -3
- package/es/Button/demo/loading/index.js +0 -37
- package/es/Button/demo/loading/index.less +0 -6
- package/es/Dropdown/demo/basic/index.d.ts +0 -4
- package/es/Dropdown/demo/basic/index.js +0 -18
- package/es/Dropdown/demo/button/index.d.ts +0 -3
- package/es/Dropdown/demo/button/index.js +0 -159
- package/es/Dropdown/demo/button/index.less +0 -9
- package/es/Dropdown/demo/placement/index.d.ts +0 -2
- package/es/Dropdown/demo/placement/index.js +0 -40
- package/es/Dropdown/demo/subMenu/index.d.ts +0 -2
- package/es/Dropdown/demo/subMenu/index.js +0 -42
- package/es/Dropdown/demo/trigger/index.d.ts +0 -2
- package/es/Dropdown/demo/trigger/index.js +0 -17
- package/es/Input/demo/allowClear/index.d.ts +0 -3
- package/es/Input/demo/allowClear/index.js +0 -11
- package/es/Input/demo/allowClear/index.less +0 -0
- package/es/Input/demo/basic/index.d.ts +0 -4
- package/es/Input/demo/basic/index.js +0 -65
- package/es/Input/demo/basic/index.less +0 -6
- package/es/Input/demo/gourp/index.d.ts +0 -2
- package/es/Input/demo/gourp/index.js +0 -67
- package/es/Input/demo/password/index.d.ts +0 -3
- package/es/Input/demo/password/index.js +0 -21
- package/es/Input/demo/password/index.less +0 -0
- package/es/Input/demo/prefix/index.d.ts +0 -3
- package/es/Input/demo/prefix/index.js +0 -17
- package/es/Input/demo/prefix/index.less +0 -0
- package/es/Input/demo/showCount/index.d.ts +0 -3
- package/es/Input/demo/showCount/index.js +0 -17
- package/es/Input/demo/showCount/index.less +0 -0
- package/es/Input/demo/textArea/autoSize.d.ts +0 -2
- package/es/Input/demo/textArea/autoSize.js +0 -50
- package/es/Select/demo/disabled/index.d.ts +0 -2
- package/es/Select/demo/disabled/index.js +0 -50
- package/es/Select/demo/multiple/index.d.ts +0 -2
- package/es/Select/demo/multiple/index.js +0 -140
- package/es/Select/demo/options/index.d.ts +0 -2
- package/es/Select/demo/options/index.js +0 -55
- package/es/Select/demo/single/index.d.ts +0 -3
- package/es/Select/demo/single/index.js +0 -89
- package/es/Select/demo/single/index.less +0 -5
- package/es/Tabs/demo/adaptHeight/index.d.ts +0 -3
- package/es/Tabs/demo/adaptHeight/index.js +0 -19
- package/es/Tabs/demo/adaptHeight/index.less +0 -3
- package/es/Tabs/demo/basic/index.d.ts +0 -4
- package/es/Tabs/demo/basic/index.js +0 -44
- package/es/Tabs/demo/basic/index.less +0 -5
- package/es/Tabs/demo/horizontalScroll/index.d.ts +0 -3
- package/es/Tabs/demo/horizontalScroll/index.js +0 -30
- package/es/Tabs/demo/horizontalScroll/index.less +0 -3
- package/es/Tooltip/demo/basic/index.d.ts +0 -2
- package/es/Tooltip/demo/basic/index.js +0 -7
- package/es/Tooltip/demo/overflow/index.d.ts +0 -2
- package/es/Tooltip/demo/overflow/index.js +0 -7
- package/es/Tooltip/demo/placement/index.d.ts +0 -6
- package/es/Tooltip/demo/placement/index.js +0 -70
- package/es/Tooltip/demo/placement/index.less +0 -7
- package/es/Tooltip/demo/trigger/index.d.ts +0 -3
- package/es/Tooltip/demo/trigger/index.js +0 -20
- package/es/Tooltip/demo/trigger/index.less +0 -5
- package/lib/Button/demo/Icon/index.d.ts +0 -3
- package/lib/Button/demo/Icon/index.js +0 -82
- package/lib/Button/demo/Icon/index.less +0 -6
- package/lib/Button/demo/basic/index.d.ts +0 -4
- package/lib/Button/demo/basic/index.js +0 -73
- package/lib/Button/demo/basic/index.less +0 -6
- package/lib/Button/demo/disable/index.d.ts +0 -3
- package/lib/Button/demo/disable/index.js +0 -37
- package/lib/Button/demo/disable/index.less +0 -0
- package/lib/Button/demo/href/index.d.ts +0 -2
- package/lib/Button/demo/href/index.js +0 -30
- package/lib/Button/demo/loading/index.d.ts +0 -3
- package/lib/Button/demo/loading/index.js +0 -51
- package/lib/Button/demo/loading/index.less +0 -6
- package/lib/Dropdown/demo/basic/index.d.ts +0 -4
- package/lib/Dropdown/demo/basic/index.js +0 -35
- package/lib/Dropdown/demo/button/index.d.ts +0 -3
- package/lib/Dropdown/demo/button/index.js +0 -182
- package/lib/Dropdown/demo/button/index.less +0 -9
- package/lib/Dropdown/demo/placement/index.d.ts +0 -2
- package/lib/Dropdown/demo/placement/index.js +0 -56
- package/lib/Dropdown/demo/subMenu/index.d.ts +0 -2
- package/lib/Dropdown/demo/subMenu/index.js +0 -59
- package/lib/Dropdown/demo/trigger/index.d.ts +0 -2
- package/lib/Dropdown/demo/trigger/index.js +0 -32
- package/lib/Input/demo/allowClear/index.d.ts +0 -3
- package/lib/Input/demo/allowClear/index.js +0 -25
- package/lib/Input/demo/allowClear/index.less +0 -0
- package/lib/Input/demo/basic/index.d.ts +0 -4
- package/lib/Input/demo/basic/index.js +0 -80
- package/lib/Input/demo/basic/index.less +0 -6
- package/lib/Input/demo/gourp/index.d.ts +0 -2
- package/lib/Input/demo/gourp/index.js +0 -81
- package/lib/Input/demo/password/index.d.ts +0 -3
- package/lib/Input/demo/password/index.js +0 -35
- package/lib/Input/demo/password/index.less +0 -0
- package/lib/Input/demo/prefix/index.d.ts +0 -3
- package/lib/Input/demo/prefix/index.js +0 -32
- package/lib/Input/demo/prefix/index.less +0 -0
- package/lib/Input/demo/showCount/index.d.ts +0 -3
- package/lib/Input/demo/showCount/index.js +0 -31
- package/lib/Input/demo/showCount/index.less +0 -0
- package/lib/Input/demo/textArea/autoSize.d.ts +0 -2
- package/lib/Input/demo/textArea/autoSize.js +0 -63
- package/lib/Select/demo/disabled/index.d.ts +0 -2
- package/lib/Select/demo/disabled/index.js +0 -64
- package/lib/Select/demo/multiple/index.d.ts +0 -2
- package/lib/Select/demo/multiple/index.js +0 -154
- package/lib/Select/demo/options/index.d.ts +0 -2
- package/lib/Select/demo/options/index.js +0 -69
- package/lib/Select/demo/single/index.d.ts +0 -3
- package/lib/Select/demo/single/index.js +0 -103
- package/lib/Select/demo/single/index.less +0 -5
- package/lib/Tabs/demo/adaptHeight/index.d.ts +0 -3
- package/lib/Tabs/demo/adaptHeight/index.js +0 -34
- package/lib/Tabs/demo/adaptHeight/index.less +0 -3
- package/lib/Tabs/demo/basic/index.d.ts +0 -4
- package/lib/Tabs/demo/basic/index.js +0 -67
- package/lib/Tabs/demo/basic/index.less +0 -5
- package/lib/Tabs/demo/horizontalScroll/index.d.ts +0 -3
- package/lib/Tabs/demo/horizontalScroll/index.js +0 -45
- package/lib/Tabs/demo/horizontalScroll/index.less +0 -3
- package/lib/Tooltip/demo/basic/index.d.ts +0 -2
- package/lib/Tooltip/demo/basic/index.js +0 -20
- package/lib/Tooltip/demo/overflow/index.d.ts +0 -2
- package/lib/Tooltip/demo/overflow/index.js +0 -20
- package/lib/Tooltip/demo/placement/index.d.ts +0 -6
- package/lib/Tooltip/demo/placement/index.js +0 -86
- package/lib/Tooltip/demo/placement/index.less +0 -7
- package/lib/Tooltip/demo/trigger/index.d.ts +0 -3
- package/lib/Tooltip/demo/trigger/index.js +0 -34
- package/lib/Tooltip/demo/trigger/index.less +0 -5
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import type { ShowCountProps, InputProps } from 'antd/lib/input/Input';
|
|
3
|
+
import AntdInput from 'antd/lib/input/Input';
|
|
4
|
+
export declare type TSize = 'small' | 'default' | 'large';
|
|
5
|
+
export declare type InputRef = React.Ref<AntdInput>;
|
|
6
|
+
declare type ChangeEventHandler = (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
7
|
+
export interface IInputProps extends Omit<InputProps, 'size' | 'id' | 'prefix' | 'allowClear' | 'disabled' | 'showCount' | 'maxLength' | 'value' | 'defaultValue' | 'onPressEnter' | 'onChange'> {
|
|
8
|
+
/**
|
|
9
|
+
* @description 输入框尺寸
|
|
10
|
+
* @default default
|
|
11
|
+
* @type 'small' | 'default' | 'large';
|
|
12
|
+
*/
|
|
13
|
+
size?: TSize;
|
|
14
|
+
/**
|
|
15
|
+
* @description 输入框id
|
|
16
|
+
*/
|
|
17
|
+
id?: string;
|
|
18
|
+
/**
|
|
19
|
+
* @description 提示文字
|
|
20
|
+
*/
|
|
21
|
+
prefix?: ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* @description 带标签的 input,设置前置标签
|
|
24
|
+
*/
|
|
25
|
+
allowClear?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* @description 可以点击清除图标删除内容
|
|
28
|
+
* @default true
|
|
29
|
+
*/
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* @description 提示文字
|
|
33
|
+
* @default false
|
|
34
|
+
* @type boolean | { formatter: (args: { count: number; maxLength?: number; }) => string; };
|
|
35
|
+
*/
|
|
36
|
+
showCount?: boolean | ShowCountProps;
|
|
37
|
+
/**
|
|
38
|
+
* @description 最大长度
|
|
39
|
+
*/
|
|
40
|
+
maxLength?: number;
|
|
41
|
+
/**
|
|
42
|
+
* @description 输入框内容
|
|
43
|
+
*/
|
|
44
|
+
value?: string;
|
|
45
|
+
/**
|
|
46
|
+
* @description 输入框默认内容
|
|
47
|
+
*/
|
|
48
|
+
defaultValue?: string;
|
|
49
|
+
/**
|
|
50
|
+
* @description 按下回车的回调
|
|
51
|
+
* @type (e) => void
|
|
52
|
+
*/
|
|
53
|
+
onPressEnter?: React.KeyboardEventHandler<HTMLInputElement>;
|
|
54
|
+
/**
|
|
55
|
+
* @description 输入框内容变化时的回调
|
|
56
|
+
* @type (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
57
|
+
*/
|
|
58
|
+
onChange?: ChangeEventHandler;
|
|
59
|
+
}
|
|
60
|
+
declare const Input: React.ForwardRefExoticComponent<IInputProps & React.RefAttributes<AntdInput>>;
|
|
61
|
+
export default Input;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
var _excluded = ["size"];
|
|
2
|
+
|
|
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
|
+
|
|
5
|
+
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; }
|
|
6
|
+
|
|
7
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
+
|
|
9
|
+
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; }
|
|
10
|
+
|
|
11
|
+
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; }
|
|
12
|
+
|
|
13
|
+
import React from 'react';
|
|
14
|
+
import AntdInput from 'antd/lib/input/Input';
|
|
15
|
+
var Input = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
16
|
+
var _props$size = props.size,
|
|
17
|
+
size = _props$size === void 0 ? 'default' : _props$size,
|
|
18
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
19
|
+
|
|
20
|
+
var getInputSize = function getInputSize(inputSize) {
|
|
21
|
+
if (inputSize === 'small' || inputSize === 'large') {
|
|
22
|
+
return inputSize;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return 'middle';
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return /*#__PURE__*/React.createElement(AntdInput, _objectSpread(_objectSpread({}, rest), {}, {
|
|
29
|
+
ref: ref,
|
|
30
|
+
size: getInputSize(size),
|
|
31
|
+
bordered: true,
|
|
32
|
+
addonAfter: null,
|
|
33
|
+
addonBefore: null,
|
|
34
|
+
suffix: null
|
|
35
|
+
}));
|
|
36
|
+
});
|
|
37
|
+
export default Input;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PasswordProps } from 'antd/lib/input/Password';
|
|
3
|
+
export interface IPasswordProps extends PasswordProps {
|
|
3
4
|
/**
|
|
4
5
|
* @description 是否显示切换按钮
|
|
5
6
|
* @default true
|
|
6
7
|
*/
|
|
7
8
|
visibilityToggle?: boolean;
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
-
export
|
|
10
|
+
declare const _default: React.ForwardRefExoticComponent<IPasswordProps & React.RefAttributes<any>>;
|
|
11
|
+
export default _default;
|
|
@@ -5,11 +5,12 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
5
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
6
|
|
|
7
7
|
import React from 'react';
|
|
8
|
-
import AntdInput from 'antd/lib/input';
|
|
9
8
|
import Icon from '../../../Icon';
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
import AntdPassword from 'antd/lib/input/Password'; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
|
+
|
|
11
|
+
export default /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
12
12
|
return /*#__PURE__*/React.createElement(AntdPassword, _objectSpread(_objectSpread({}, props), {}, {
|
|
13
|
+
ref: ref,
|
|
13
14
|
iconRender: function iconRender(visible) {
|
|
14
15
|
var type = visible ? 'eye' : 'eye_off';
|
|
15
16
|
return /*#__PURE__*/React.createElement(Icon, {
|
|
@@ -17,4 +18,4 @@ export default function Group(props) {
|
|
|
17
18
|
});
|
|
18
19
|
}
|
|
19
20
|
}));
|
|
20
|
-
}
|
|
21
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { TextAreaProps } from 'antd/lib/input';
|
|
3
|
-
interface ITextAreaProps extends Omit<TextAreaProps, 'onPressEnter'> {
|
|
2
|
+
import { TextAreaProps, TextAreaRef } from 'antd/lib/input/TextArea';
|
|
3
|
+
export interface ITextAreaProps extends Omit<TextAreaProps, 'onPressEnter'> {
|
|
4
4
|
/**
|
|
5
5
|
* @description 可以点击清除图标删除内容
|
|
6
6
|
* @default false
|
|
@@ -47,6 +47,11 @@ interface ITextAreaProps extends Omit<TextAreaProps, 'onPressEnter'> {
|
|
|
47
47
|
width: number;
|
|
48
48
|
height: number;
|
|
49
49
|
}) => void;
|
|
50
|
+
/**
|
|
51
|
+
* @description 是否有边框
|
|
52
|
+
* @type boolean
|
|
53
|
+
*/
|
|
54
|
+
border?: boolean;
|
|
50
55
|
}
|
|
51
|
-
|
|
52
|
-
export
|
|
56
|
+
declare const _default: React.ForwardRefExoticComponent<ITextAreaProps & React.RefAttributes<TextAreaRef>>;
|
|
57
|
+
export default _default;
|
|
@@ -1,14 +1,24 @@
|
|
|
1
|
+
var _excluded = ["bordered"];
|
|
2
|
+
|
|
1
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; }
|
|
2
4
|
|
|
3
5
|
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; }
|
|
4
6
|
|
|
5
7
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
8
|
|
|
9
|
+
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; }
|
|
10
|
+
|
|
11
|
+
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; }
|
|
12
|
+
|
|
7
13
|
import React from 'react';
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
14
|
+
import AntdTextArea from 'antd/lib/input/TextArea';
|
|
15
|
+
export default /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
16
|
+
var _props$bordered = props.bordered,
|
|
17
|
+
bordered = _props$bordered === void 0 ? true : _props$bordered,
|
|
18
|
+
rest = _objectWithoutProperties(props, _excluded);
|
|
19
|
+
|
|
20
|
+
return /*#__PURE__*/React.createElement(AntdTextArea, _objectSpread(_objectSpread({}, rest), {}, {
|
|
21
|
+
ref: ref,
|
|
22
|
+
bordered: bordered
|
|
13
23
|
}));
|
|
14
|
-
}
|
|
24
|
+
});
|
package/es/Input/index.d.ts
CHANGED
|
@@ -1,65 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import './
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
* @description 输入框id
|
|
15
|
-
*/
|
|
16
|
-
id?: string;
|
|
17
|
-
/**
|
|
18
|
-
* @description 提示文字
|
|
19
|
-
*/
|
|
20
|
-
prefix?: ReactNode;
|
|
21
|
-
/**
|
|
22
|
-
* @description 带标签的 input,设置前置标签
|
|
23
|
-
*/
|
|
24
|
-
allowClear?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* @description 可以点击清除图标删除内容
|
|
27
|
-
* @default true
|
|
28
|
-
*/
|
|
29
|
-
disabled?: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* @description 提示文字
|
|
32
|
-
* @default false
|
|
33
|
-
* @type boolean | { formatter: (args: { count: number; maxLength?: number; }) => string; };
|
|
34
|
-
*/
|
|
35
|
-
showCount?: boolean | ShowCountProps;
|
|
36
|
-
/**
|
|
37
|
-
* @description 最大长度
|
|
38
|
-
*/
|
|
39
|
-
maxLength?: number;
|
|
40
|
-
/**
|
|
41
|
-
* @description 输入框内容
|
|
42
|
-
*/
|
|
43
|
-
value?: string;
|
|
44
|
-
/**
|
|
45
|
-
* @description 输入框默认内容
|
|
46
|
-
*/
|
|
47
|
-
defaultValue?: string;
|
|
48
|
-
/**
|
|
49
|
-
* @description 按下回车的回调
|
|
50
|
-
* @type (e) => void
|
|
51
|
-
*/
|
|
52
|
-
onPressEnter?: React.KeyboardEventHandler<HTMLInputElement>;
|
|
53
|
-
/**
|
|
54
|
-
* @description 输入框内容变化时的回调
|
|
55
|
-
* @type (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
56
|
-
*/
|
|
57
|
-
onChange?: ChangeEventHandler;
|
|
58
|
-
}
|
|
59
|
-
declare function Input(props: IInputProps): JSX.Element;
|
|
60
|
-
declare namespace Input {
|
|
61
|
-
var TextArea: typeof import("./components/TextArea").default;
|
|
62
|
-
var Group: typeof import("./components/Group").default;
|
|
63
|
-
var Password: typeof import("./components/Password").default;
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IInputProps, InputRef } from './components/Input';
|
|
3
|
+
import Group from './components/Group';
|
|
4
|
+
import TextArea from './components/TextArea';
|
|
5
|
+
import Password from './components/Password';
|
|
6
|
+
export type { IInputProps, InputRef, TSize } from './components/Input';
|
|
7
|
+
export type { IGroupProps } from './components/Group';
|
|
8
|
+
export type { ITextAreaProps } from './components/TextArea';
|
|
9
|
+
export type { IPasswordProps } from './components/Password';
|
|
10
|
+
interface ICompoundedComponent extends React.ForwardRefExoticComponent<IInputProps & React.RefAttributes<InputRef>> {
|
|
11
|
+
Group: typeof Group;
|
|
12
|
+
TextArea: typeof TextArea;
|
|
13
|
+
Password: typeof Password;
|
|
64
14
|
}
|
|
15
|
+
declare const Input: ICompoundedComponent;
|
|
65
16
|
export default Input;
|
package/es/Input/index.js
CHANGED
|
@@ -1,46 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
var _excluded = ["size"];
|
|
4
|
-
|
|
5
|
-
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; }
|
|
6
|
-
|
|
7
|
-
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; }
|
|
8
|
-
|
|
9
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
10
|
-
|
|
11
|
-
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; }
|
|
12
|
-
|
|
13
|
-
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; }
|
|
14
|
-
|
|
15
|
-
import React from 'react';
|
|
1
|
+
import InternalInput from './components/Input';
|
|
2
|
+
import Group from './components/Group';
|
|
16
3
|
import TextArea from './components/TextArea';
|
|
17
4
|
import Password from './components/Password';
|
|
18
|
-
|
|
19
|
-
import './style'; // IInputProps 和 InputProps 类型合并,并去除InputProps中的重复属性
|
|
20
|
-
|
|
21
|
-
function Input(props) {
|
|
22
|
-
var _props$size = props.size,
|
|
23
|
-
size = _props$size === void 0 ? 'default' : _props$size,
|
|
24
|
-
rest = _objectWithoutProperties(props, _excluded);
|
|
25
|
-
|
|
26
|
-
var getInputSize = function getInputSize(inputSize) {
|
|
27
|
-
if (inputSize === 'small' || inputSize === 'large') {
|
|
28
|
-
return inputSize;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return 'middle';
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
return /*#__PURE__*/React.createElement(_Input, _objectSpread(_objectSpread({}, rest), {}, {
|
|
35
|
-
size: getInputSize(size),
|
|
36
|
-
bordered: true,
|
|
37
|
-
addonAfter: null,
|
|
38
|
-
addonBefore: null,
|
|
39
|
-
suffix: null
|
|
40
|
-
}));
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
Input.TextArea = TextArea;
|
|
5
|
+
var Input = InternalInput;
|
|
44
6
|
Input.Group = Group;
|
|
7
|
+
Input.TextArea = TextArea;
|
|
45
8
|
Input.Password = Password;
|
|
46
9
|
export default Input;
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
@ald-prefix:ant;
|
|
5
5
|
|
|
6
6
|
@ald-iconfont-css-prefix:anticon;
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
.ant-input {
|
|
8
9
|
color: @NL0;
|
|
9
10
|
border-radius: @border-radius-base;
|
|
10
11
|
|
|
@@ -48,7 +49,8 @@
|
|
|
48
49
|
&:hover {
|
|
49
50
|
box-shadow: unset;
|
|
50
51
|
}
|
|
51
|
-
|
|
52
|
+
|
|
53
|
+
.ant-input {
|
|
52
54
|
border-radius: 0;
|
|
53
55
|
caret-color: @B40;
|
|
54
56
|
}
|
|
@@ -59,7 +61,7 @@
|
|
|
59
61
|
}
|
|
60
62
|
}
|
|
61
63
|
.@{ald-iconfont-css-prefix} {
|
|
62
|
-
&.@{ald-iconfont-css-prefix}-close-circle,
|
|
64
|
+
&.@{ald-iconfont-css-prefix}-close-circle, &.ant-clear-icon {
|
|
63
65
|
.ald-iconfont('\e616');
|
|
64
66
|
}
|
|
65
67
|
}
|
package/es/Menu/Divider.d.ts
CHANGED
package/es/Menu/Divider.js
CHANGED
|
@@ -8,7 +8,6 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
8
8
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
9
|
|
|
10
10
|
import React from 'react';
|
|
11
|
-
import './style';
|
|
12
11
|
var AntdMenuDivider = _Menu.Divider;
|
|
13
12
|
export default function Menu(props) {
|
|
14
13
|
return /*#__PURE__*/React.createElement(AntdMenuDivider, _objectSpread({}, props));
|
package/es/Menu/MenuItem.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import '
|
|
2
|
+
import { MenuClickEventHandler } from 'rc-menu/lib/interface';
|
|
3
3
|
export interface IMenuItemProps {
|
|
4
4
|
/**
|
|
5
5
|
* @description 唯一标志
|
|
@@ -12,6 +12,12 @@ export interface IMenuItemProps {
|
|
|
12
12
|
* @default false
|
|
13
13
|
*/
|
|
14
14
|
disabled?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* @description 点击事件
|
|
17
|
+
* @type Function
|
|
18
|
+
* @default -
|
|
19
|
+
*/
|
|
20
|
+
onClick?: MenuClickEventHandler;
|
|
15
21
|
children?: React.ReactNode;
|
|
16
22
|
}
|
|
17
23
|
export default function Menu(props: IMenuItemProps): JSX.Element;
|
package/es/Menu/MenuItem.js
CHANGED
|
@@ -8,7 +8,6 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
8
8
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
9
|
|
|
10
10
|
import React from 'react';
|
|
11
|
-
import './style';
|
|
12
11
|
var AntdMenuItem = _Menu.Item;
|
|
13
12
|
export default function Menu(props) {
|
|
14
13
|
return /*#__PURE__*/React.createElement(AntdMenuItem, _objectSpread({}, props));
|
package/es/Menu/SubMenu.d.ts
CHANGED
package/es/Menu/SubMenu.js
CHANGED
|
@@ -14,7 +14,6 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
14
14
|
|
|
15
15
|
import classNames from 'classnames';
|
|
16
16
|
import React from 'react';
|
|
17
|
-
import './style';
|
|
18
17
|
var AntdSubMenu = _Menu.SubMenu;
|
|
19
18
|
export default function SubMenu(props) {
|
|
20
19
|
var popupClassName = props.popupClassName,
|
package/es/Menu/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import MenuItem from './MenuItem';
|
|
3
3
|
import type { MenuClickEventHandler } from 'rc-menu/lib/interface';
|
|
4
|
-
import './style';
|
|
5
4
|
export interface IMenuProps {
|
|
6
5
|
/**
|
|
7
6
|
* @description 点击 MenuItem 调用此函数
|
|
7
|
+
* @type Function
|
|
8
8
|
* @default -
|
|
9
9
|
*/
|
|
10
10
|
onClick?: MenuClickEventHandler;
|
package/es/Menu/index.js
CHANGED
|
@@ -17,7 +17,6 @@ import React from 'react';
|
|
|
17
17
|
import MenuItem from './MenuItem';
|
|
18
18
|
import Divider from './Divider';
|
|
19
19
|
import SubMenu from './SubMenu';
|
|
20
|
-
import './style';
|
|
21
20
|
export default function Menu(props) {
|
|
22
21
|
var className = props.className,
|
|
23
22
|
otherProps = _objectWithoutProperties(props, _excluded);
|
package/es/Menu/style/index.less
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare function Menu(props: IMenuProps & {
|
|
3
|
+
onMenuSelect?: (menuInfo: {
|
|
4
|
+
key: string;
|
|
5
|
+
path: string;
|
|
6
|
+
}) => void;
|
|
7
|
+
}): JSX.Element;
|
|
8
|
+
interface IMenuProps {
|
|
9
|
+
menuList: IMenuItem[];
|
|
10
|
+
selectedKey: string;
|
|
11
|
+
}
|
|
12
|
+
export interface IMenuItem {
|
|
13
|
+
title: string;
|
|
14
|
+
key: string;
|
|
15
|
+
path: string;
|
|
16
|
+
icon?: React.ReactNode;
|
|
17
|
+
children?: Omit<IMenuItem, 'children'>[];
|
|
18
|
+
}
|
|
19
|
+
export default Menu;
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
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; }
|
|
2
|
+
|
|
3
|
+
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; }
|
|
4
|
+
|
|
5
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
|
|
9
|
+
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."); }
|
|
10
|
+
|
|
11
|
+
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); }
|
|
12
|
+
|
|
13
|
+
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; }
|
|
14
|
+
|
|
15
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
16
|
+
|
|
17
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
|
+
|
|
19
|
+
import React, { useCallback, useState, useEffect, useMemo } from 'react';
|
|
20
|
+
import AntdMenu from 'antd/lib/menu';
|
|
21
|
+
import Icon from '../../../Icon';
|
|
22
|
+
|
|
23
|
+
function Menu(props) {
|
|
24
|
+
var menuList = props.menuList,
|
|
25
|
+
selectedKey = props.selectedKey,
|
|
26
|
+
onMenuSelect = props.onMenuSelect;
|
|
27
|
+
|
|
28
|
+
var _useMemo = useMemo(function () {
|
|
29
|
+
return getFlattenMenuByKey(menuList);
|
|
30
|
+
}, [menuList]),
|
|
31
|
+
flattenMenuByMenuKey = _useMemo.flattenMenuByMenuKey;
|
|
32
|
+
|
|
33
|
+
var _useState = useState(''),
|
|
34
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
35
|
+
openKey = _useState2[0],
|
|
36
|
+
setOpenKey = _useState2[1]; // 当前展开的菜单项
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
var _useState3 = useState(''),
|
|
40
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
41
|
+
currentSelectedKey = _useState4[0],
|
|
42
|
+
setCurrentSelectedKey = _useState4[1]; // 当前选中的菜单项
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
var renderExpandIcon = useCallback(function (renderIconInfo) {
|
|
46
|
+
var isOpen = renderIconInfo.isOpen;
|
|
47
|
+
|
|
48
|
+
if (isOpen) {
|
|
49
|
+
return /*#__PURE__*/React.createElement(Icon, {
|
|
50
|
+
type: "arrow_drop_down",
|
|
51
|
+
size: 20,
|
|
52
|
+
className: "ald-nav-menu-icon-right"
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return /*#__PURE__*/React.createElement(Icon, {
|
|
57
|
+
type: "arrow_drop_up",
|
|
58
|
+
size: 20,
|
|
59
|
+
className: "ald-nav-menu-icon-right"
|
|
60
|
+
});
|
|
61
|
+
}, []);
|
|
62
|
+
useEffect(function () {
|
|
63
|
+
setCurrentSelectedKey(selectedKey);
|
|
64
|
+
}, [selectedKey]);
|
|
65
|
+
/**
|
|
66
|
+
* 处理选中菜单项变化
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
var onMenuChange = useCallback(function (key) {
|
|
70
|
+
if (onMenuSelect && flattenMenuByMenuKey[key]) {
|
|
71
|
+
var path = flattenMenuByMenuKey[key].path;
|
|
72
|
+
var menuInfo = {
|
|
73
|
+
key: key,
|
|
74
|
+
path: path
|
|
75
|
+
};
|
|
76
|
+
onMenuSelect(menuInfo);
|
|
77
|
+
}
|
|
78
|
+
}, [flattenMenuByMenuKey, onMenuSelect]);
|
|
79
|
+
/**
|
|
80
|
+
* 根据当前选中的菜单项,设置展开的菜单项
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
useEffect(function () {
|
|
84
|
+
var _flattenMenuByMenuKey;
|
|
85
|
+
|
|
86
|
+
setOpenKey(((_flattenMenuByMenuKey = flattenMenuByMenuKey[currentSelectedKey]) === null || _flattenMenuByMenuKey === void 0 ? void 0 : _flattenMenuByMenuKey.openKey) || '');
|
|
87
|
+
}, [currentSelectedKey, flattenMenuByMenuKey, onMenuSelect]);
|
|
88
|
+
/**
|
|
89
|
+
* 父级菜单点击
|
|
90
|
+
*/
|
|
91
|
+
|
|
92
|
+
var onSupMenuClick = useCallback(function (key) {
|
|
93
|
+
if (key === openKey) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
var FIRST_INDEX = 0;
|
|
98
|
+
var firstChildrenKey = flattenMenuByMenuKey[key].children[FIRST_INDEX].key;
|
|
99
|
+
setCurrentSelectedKey(firstChildrenKey);
|
|
100
|
+
onMenuChange(firstChildrenKey);
|
|
101
|
+
}, [flattenMenuByMenuKey, openKey, onMenuChange]);
|
|
102
|
+
/**
|
|
103
|
+
* 子级菜单项或者一级菜单点击
|
|
104
|
+
*/
|
|
105
|
+
|
|
106
|
+
var onMenuItemClick = useCallback(function (key) {
|
|
107
|
+
if (key === currentSelectedKey) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
setCurrentSelectedKey(key);
|
|
112
|
+
onMenuChange(key);
|
|
113
|
+
}, [currentSelectedKey, onMenuChange]);
|
|
114
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
115
|
+
className: "ald-nav-menu-wrap"
|
|
116
|
+
}, /*#__PURE__*/React.createElement(AntdMenu, {
|
|
117
|
+
selectedKeys: [currentSelectedKey],
|
|
118
|
+
expandIcon: renderExpandIcon,
|
|
119
|
+
openKeys: [openKey],
|
|
120
|
+
mode: "inline",
|
|
121
|
+
style: {
|
|
122
|
+
padding: '0 12px'
|
|
123
|
+
}
|
|
124
|
+
}, Array.isArray(menuList) && menuList.map(function (item) {
|
|
125
|
+
if (item.children) {
|
|
126
|
+
return /*#__PURE__*/React.createElement(AntdMenu.SubMenu, {
|
|
127
|
+
key: item.key,
|
|
128
|
+
icon: item.icon,
|
|
129
|
+
title: item.title,
|
|
130
|
+
onTitleClick: function onTitleClick() {
|
|
131
|
+
return onSupMenuClick(item.key);
|
|
132
|
+
}
|
|
133
|
+
}, item.children.map(function (subItem) {
|
|
134
|
+
return /*#__PURE__*/React.createElement(AntdMenu.Item, {
|
|
135
|
+
onClick: function onClick() {
|
|
136
|
+
return onMenuItemClick(subItem.key);
|
|
137
|
+
},
|
|
138
|
+
key: subItem.key
|
|
139
|
+
}, subItem.title);
|
|
140
|
+
}));
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return /*#__PURE__*/React.createElement(AntdMenu.Item, {
|
|
144
|
+
key: item.key,
|
|
145
|
+
icon: item.icon,
|
|
146
|
+
onClick: function onClick() {
|
|
147
|
+
return onMenuItemClick(item.key);
|
|
148
|
+
}
|
|
149
|
+
}, item.title);
|
|
150
|
+
})));
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function getFlattenMenuByKey(menuList) {
|
|
154
|
+
var flattenMenuByMenuKey = {};
|
|
155
|
+
var menuKeys = []; // 存储所有的key 用来判断是否有重复的key
|
|
156
|
+
|
|
157
|
+
var menuInvalidFlag = true; // 传入的menuList是否有效
|
|
158
|
+
|
|
159
|
+
menuList.forEach(function (item) {
|
|
160
|
+
if (!item.key) {
|
|
161
|
+
menuInvalidFlag = false;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (item.children) {
|
|
165
|
+
flattenMenuByMenuKey[item.key] = _objectSpread(_objectSpread({}, item), {}, {
|
|
166
|
+
openKey: ''
|
|
167
|
+
});
|
|
168
|
+
item.children.forEach(function (childItem) {
|
|
169
|
+
flattenMenuByMenuKey[childItem.key] = _objectSpread(_objectSpread({}, childItem), {}, {
|
|
170
|
+
openKey: item.key
|
|
171
|
+
});
|
|
172
|
+
menuKeys.push(childItem.key);
|
|
173
|
+
});
|
|
174
|
+
} else {
|
|
175
|
+
flattenMenuByMenuKey[item.key] = _objectSpread(_objectSpread({}, item), {}, {
|
|
176
|
+
openKey: ''
|
|
177
|
+
});
|
|
178
|
+
menuKeys.push(item.key);
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
return {
|
|
182
|
+
menuInvalidFlag: menuInvalidFlag,
|
|
183
|
+
flattenMenuByMenuKey: flattenMenuByMenuKey
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export default Menu;
|