@aloudata/aloudata-design 0.1.0-beta.3 → 0.2.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/es/Button/demo/Icon/index.js +0 -3
- package/es/Button/demo/basic/index.js +1 -4
- package/es/Dropdown/demo/button/index.js +1 -1
- package/es/Empty/index.d.ts +8 -0
- package/es/Empty/index.js +57 -0
- package/es/Empty/style/index.d.ts +1 -0
- package/es/Empty/style/index.js +1 -0
- package/es/Empty/style/index.less +23 -0
- package/es/Icon/iconfont/demo_index.html +26 -3
- package/es/Icon/iconfont/iconfont.css +7 -3
- package/es/Icon/iconfont/iconfont.js +1 -1
- package/es/Icon/iconfont/iconfont.json +7 -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.less +2 -2
- package/es/Input/components/Group/index.d.ts +0 -1
- package/es/Input/components/Password/index.d.ts +0 -1
- package/es/Menu/Divider.d.ts +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/demo/basic/index.d.ts +4 -0
- package/es/Navigator/demo/basic/index.js +45 -0
- package/es/Navigator/demo/basic/index.less +3 -0
- package/es/Navigator/demo/example/index.d.ts +4 -0
- package/es/Navigator/demo/example/index.js +153 -0
- package/es/Navigator/demo/example/index.less +10 -0
- package/es/Navigator/demo/logo.png +0 -0
- package/es/Navigator/demo/menuWithFooter/index.d.ts +4 -0
- package/es/Navigator/demo/menuWithFooter/index.js +73 -0
- package/es/Navigator/demo/menuWithFooter/index.less +3 -0
- package/es/Navigator/demo/subMenu/index.d.ts +4 -0
- package/es/Navigator/demo/subMenu/index.js +71 -0
- package/es/Navigator/demo/subMenu/index.less +3 -0
- package/es/Navigator/index.d.ts +41 -0
- package/es/Navigator/index.js +45 -0
- package/es/Navigator/style/index.d.ts +2 -0
- package/es/Navigator/style/index.js +2 -0
- package/es/Navigator/style/index.less +224 -0
- package/es/Select/OptionsList/OptionItem/RenderTooltip.js +2 -3
- package/es/Select/OptionsList/Options.d.ts +2 -2
- package/es/Select/OptionsList/index.js +1 -1
- package/es/Select/Selector/index.d.ts +2 -2
- package/es/Select/Selector/index.js +9 -6
- package/es/Select/demo/single/index.d.ts +1 -0
- package/es/Select/demo/single/index.js +4 -1
- package/es/Select/demo/single/index.less +5 -0
- package/es/Select/interface.d.ts +1 -2
- package/es/Select/style/index.less +2 -10
- package/es/Table/demo/basic/createData.d.ts +9 -0
- package/es/Table/demo/basic/createData.js +18 -0
- package/es/Table/demo/basic/index.d.ts +2 -0
- package/es/Table/demo/basic/index.js +64 -0
- package/es/Table/demo/editCell/index.d.ts +2 -0
- package/es/Table/demo/editCell/index.js +39 -0
- package/es/Table/demo/renderHeaderRight/index.d.ts +2 -0
- package/es/Table/demo/renderHeaderRight/index.js +37 -0
- package/es/Table/demo/rowSelect/index.d.ts +2 -0
- package/es/Table/demo/rowSelect/index.js +40 -0
- package/es/Table/demo/virtualList/index.d.ts +2 -0
- package/es/Table/demo/virtualList/index.js +88 -0
- package/es/Table/index.d.ts +5 -0
- package/es/Table/index.js +201 -0
- package/es/Table/interface.d.ts +14 -0
- package/es/Table/interface.js +1 -0
- package/es/Table/style/index.d.ts +2 -0
- package/es/Table/style/index.js +2 -0
- package/es/Table/style/index.less +111 -0
- package/es/Tooltip/index.d.ts +1 -0
- package/es/Tooltip/index.js +3 -1
- package/es/index.d.ts +2 -0
- package/es/index.js +3 -1
- package/es/style/themes/default/index.less +1 -1
- package/es/style/themes/default/{themeColor.less → themeColor.module.less} +0 -0
- package/es/style/themes/default/themeColor.module.less.d.ts +108 -0
- package/lib/Button/demo/Icon/index.js +0 -3
- package/lib/Button/demo/basic/index.js +1 -4
- package/lib/Dropdown/demo/button/index.js +1 -1
- package/lib/Empty/index.d.ts +8 -0
- package/lib/Empty/index.js +71 -0
- package/lib/Empty/style/index.d.ts +1 -0
- package/lib/Empty/style/index.js +3 -0
- package/lib/Empty/style/index.less +23 -0
- package/lib/Icon/iconfont/demo_index.html +26 -3
- package/lib/Icon/iconfont/iconfont.css +7 -3
- package/lib/Icon/iconfont/iconfont.js +1 -1
- package/lib/Icon/iconfont/iconfont.json +7 -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.less +2 -2
- package/lib/Input/components/Group/index.d.ts +0 -1
- package/lib/Input/components/Password/index.d.ts +0 -1
- package/lib/Menu/Divider.d.ts +0 -1
- 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/demo/basic/index.d.ts +4 -0
- package/lib/Navigator/demo/basic/index.js +62 -0
- package/lib/Navigator/demo/basic/index.less +3 -0
- package/lib/Navigator/demo/example/index.d.ts +4 -0
- package/lib/Navigator/demo/example/index.js +179 -0
- package/lib/Navigator/demo/example/index.less +10 -0
- package/lib/Navigator/demo/logo.png +0 -0
- package/lib/Navigator/demo/menuWithFooter/index.d.ts +4 -0
- package/lib/Navigator/demo/menuWithFooter/index.js +92 -0
- package/lib/Navigator/demo/menuWithFooter/index.less +3 -0
- package/lib/Navigator/demo/subMenu/index.d.ts +4 -0
- package/lib/Navigator/demo/subMenu/index.js +88 -0
- package/lib/Navigator/demo/subMenu/index.less +3 -0
- package/lib/Navigator/index.d.ts +41 -0
- package/lib/Navigator/index.js +64 -0
- package/lib/Navigator/style/index.d.ts +2 -0
- package/lib/Navigator/style/index.js +5 -0
- package/lib/Navigator/style/index.less +224 -0
- package/lib/Select/OptionsList/OptionItem/RenderTooltip.js +3 -5
- package/lib/Select/OptionsList/Options.d.ts +2 -2
- package/lib/Select/OptionsList/index.js +1 -1
- package/lib/Select/Selector/index.d.ts +2 -2
- package/lib/Select/Selector/index.js +11 -8
- package/lib/Select/demo/single/index.d.ts +1 -0
- package/lib/Select/demo/single/index.js +5 -1
- package/lib/Select/demo/single/index.less +5 -0
- package/lib/Select/interface.d.ts +1 -2
- package/lib/Select/style/index.less +2 -10
- package/lib/Table/demo/basic/createData.d.ts +9 -0
- package/lib/Table/demo/basic/createData.js +23 -0
- package/lib/Table/demo/basic/index.d.ts +2 -0
- package/lib/Table/demo/basic/index.js +80 -0
- package/lib/Table/demo/editCell/index.d.ts +2 -0
- package/lib/Table/demo/editCell/index.js +54 -0
- package/lib/Table/demo/renderHeaderRight/index.d.ts +2 -0
- package/lib/Table/demo/renderHeaderRight/index.js +52 -0
- package/lib/Table/demo/rowSelect/index.d.ts +2 -0
- package/lib/Table/demo/rowSelect/index.js +55 -0
- package/lib/Table/demo/virtualList/index.d.ts +2 -0
- package/lib/Table/demo/virtualList/index.js +103 -0
- package/lib/Table/index.d.ts +5 -0
- package/lib/Table/index.js +225 -0
- package/lib/Table/interface.d.ts +14 -0
- package/lib/Table/interface.js +5 -0
- package/lib/Table/style/index.d.ts +2 -0
- package/lib/Table/style/index.js +5 -0
- package/lib/Table/style/index.less +111 -0
- package/lib/Tooltip/index.d.ts +1 -0
- package/lib/Tooltip/index.js +3 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +16 -0
- package/lib/style/themes/default/index.less +1 -1
- package/lib/style/themes/default/{themeColor.less → themeColor.module.less} +0 -0
- package/lib/style/themes/default/themeColor.module.less.d.ts +108 -0
- package/package.json +13 -5
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Navigator } from '@aloudata/aloudata-design';
|
|
3
|
+
import logoSrc from '../logo.png';
|
|
4
|
+
import Icon from '../../../Icon'; // import { IMenuItem } from '@aloudata/aloudata-design/lib/Navigator';
|
|
5
|
+
|
|
6
|
+
import '../../style/index.less';
|
|
7
|
+
import './index.less';
|
|
8
|
+
export default (function () {
|
|
9
|
+
var mockData = [{
|
|
10
|
+
title: '查询',
|
|
11
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
12
|
+
type: 'add'
|
|
13
|
+
}),
|
|
14
|
+
key: 'query',
|
|
15
|
+
path: '/query'
|
|
16
|
+
}, {
|
|
17
|
+
title: '数据',
|
|
18
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
19
|
+
type: 'add'
|
|
20
|
+
}),
|
|
21
|
+
key: 'data',
|
|
22
|
+
path: '/data'
|
|
23
|
+
}, {
|
|
24
|
+
title: '计算',
|
|
25
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
26
|
+
type: 'add'
|
|
27
|
+
}),
|
|
28
|
+
key: 'calculate',
|
|
29
|
+
path: '/calculate'
|
|
30
|
+
}, {
|
|
31
|
+
title: '测试',
|
|
32
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
33
|
+
type: 'add'
|
|
34
|
+
}),
|
|
35
|
+
key: 'test',
|
|
36
|
+
path: '/calculate'
|
|
37
|
+
}];
|
|
38
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
39
|
+
className: 'ald-nav-demo'
|
|
40
|
+
}, /*#__PURE__*/React.createElement(Navigator, {
|
|
41
|
+
menuList: mockData,
|
|
42
|
+
defaultSelectedKey: "dataSpace",
|
|
43
|
+
logoSrc: logoSrc
|
|
44
|
+
}));
|
|
45
|
+
});
|
|
@@ -0,0 +1,153 @@
|
|
|
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, { useState, useMemo } from 'react';
|
|
20
|
+
import { Navigator, Button } from '@aloudata/aloudata-design';
|
|
21
|
+
import Icon from '../../../Icon';
|
|
22
|
+
import logoSrc from '../logo.png';
|
|
23
|
+
import { useLocation } from 'umi';
|
|
24
|
+
import _ from 'lodash';
|
|
25
|
+
import '../../style/index.less';
|
|
26
|
+
import './index.less';
|
|
27
|
+
var mockData = [{
|
|
28
|
+
title: '查询',
|
|
29
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
30
|
+
type: 'add'
|
|
31
|
+
}),
|
|
32
|
+
key: 'query',
|
|
33
|
+
path: '/navigator#search'
|
|
34
|
+
}, {
|
|
35
|
+
title: '数据',
|
|
36
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
37
|
+
type: 'add'
|
|
38
|
+
}),
|
|
39
|
+
key: 'data',
|
|
40
|
+
path: '/navigator#data',
|
|
41
|
+
children: [{
|
|
42
|
+
title: '数据空间',
|
|
43
|
+
key: 'dataSpace',
|
|
44
|
+
path: '/navigator#dataSpace'
|
|
45
|
+
}, {
|
|
46
|
+
title: '数据源',
|
|
47
|
+
key: 'datasource',
|
|
48
|
+
path: '/navigator#datasource'
|
|
49
|
+
}]
|
|
50
|
+
}, {
|
|
51
|
+
title: '计算',
|
|
52
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
53
|
+
type: 'add'
|
|
54
|
+
}),
|
|
55
|
+
key: 'calculate',
|
|
56
|
+
path: '/navigator#calculate',
|
|
57
|
+
children: [{
|
|
58
|
+
title: '任务记录',
|
|
59
|
+
key: 'job',
|
|
60
|
+
path: '/navigator#job'
|
|
61
|
+
}, {
|
|
62
|
+
title: '查询引擎',
|
|
63
|
+
key: 'queryEngine',
|
|
64
|
+
path: '/navigator#queryEngine'
|
|
65
|
+
}]
|
|
66
|
+
}, {
|
|
67
|
+
title: '测试',
|
|
68
|
+
key: 'test',
|
|
69
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
70
|
+
type: 'add'
|
|
71
|
+
}),
|
|
72
|
+
path: '/navigator#calculate',
|
|
73
|
+
children: [{
|
|
74
|
+
title: '测试菜单1',
|
|
75
|
+
key: 'hello',
|
|
76
|
+
path: '/navigator#hello'
|
|
77
|
+
}, {
|
|
78
|
+
title: '测试菜单2',
|
|
79
|
+
key: 'hello2',
|
|
80
|
+
path: '/navigator#hello2'
|
|
81
|
+
}]
|
|
82
|
+
}];
|
|
83
|
+
export default (function () {
|
|
84
|
+
// 根据路由信息去匹配菜单信息
|
|
85
|
+
var _useLocation = useLocation(),
|
|
86
|
+
pathname = _useLocation.pathname;
|
|
87
|
+
|
|
88
|
+
var flattenMenuByMenuPath = useMemo(function () {
|
|
89
|
+
return getFlattenMenuByPath(mockData);
|
|
90
|
+
}, []);
|
|
91
|
+
|
|
92
|
+
var menuInfo = _.get(flattenMenuByMenuPath, pathname, {
|
|
93
|
+
path: '',
|
|
94
|
+
key: ''
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
var _useState = useState(menuInfo.key || ''),
|
|
98
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
99
|
+
selectedKey = _useState2[0],
|
|
100
|
+
setSelectedKey = _useState2[1];
|
|
101
|
+
|
|
102
|
+
var onMenuSelect = function onMenuSelect(menuInfo) {
|
|
103
|
+
console.log('menuInfo', menuInfo);
|
|
104
|
+
var path = menuInfo.path; // 进行路由跳转
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
var mockBtnClick = function mockBtnClick(key) {
|
|
108
|
+
setSelectedKey(key);
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
112
|
+
className: 'ald-nav-demo-example'
|
|
113
|
+
}, /*#__PURE__*/React.createElement(Navigator, {
|
|
114
|
+
menuList: mockData,
|
|
115
|
+
selectedKey: selectedKey,
|
|
116
|
+
footer: /*#__PURE__*/React.createElement("div", null, "Footer Wrap"),
|
|
117
|
+
logoSrc: logoSrc,
|
|
118
|
+
onMenuSelect: onMenuSelect
|
|
119
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
120
|
+
className: 'ald-nav-content'
|
|
121
|
+
}, /*#__PURE__*/React.createElement("p", null, "\u5F53\u524D\u83DC\u5355\uFF1A", selectedKey), /*#__PURE__*/React.createElement(Button, {
|
|
122
|
+
onClick: function onClick() {
|
|
123
|
+
return mockBtnClick('query');
|
|
124
|
+
}
|
|
125
|
+
}, "\u6A21\u62DF\u67E5\u8BE2\u9875\u9762\u5237\u65B0"), /*#__PURE__*/React.createElement(Button, {
|
|
126
|
+
onClick: function onClick() {
|
|
127
|
+
return mockBtnClick('dataSpace');
|
|
128
|
+
}
|
|
129
|
+
}, "\u6A21\u62DF\u6570\u636E\u7A7A\u95F4\u5237\u65B0"), /*#__PURE__*/React.createElement(Button, {
|
|
130
|
+
onClick: function onClick() {
|
|
131
|
+
return mockBtnClick('job');
|
|
132
|
+
}
|
|
133
|
+
}, "\u6A21\u62DF\u4EFB\u52A1\u8BB0\u5F55\u5237\u65B0")));
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
function getFlattenMenuByPath(menuList) {
|
|
137
|
+
var flattenMenuByMenuPath = {};
|
|
138
|
+
menuList.forEach(function (item) {
|
|
139
|
+
if (!item.path) {
|
|
140
|
+
console.error('path is required');
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (item.children) {
|
|
144
|
+
flattenMenuByMenuPath[item.path] = _objectSpread({}, item);
|
|
145
|
+
item.children.forEach(function (childItem) {
|
|
146
|
+
flattenMenuByMenuPath[childItem.path] = _objectSpread({}, childItem);
|
|
147
|
+
});
|
|
148
|
+
} else {
|
|
149
|
+
flattenMenuByMenuPath[item.path] = _objectSpread({}, item);
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
return flattenMenuByMenuPath;
|
|
153
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Navigator } from '@aloudata/aloudata-design';
|
|
3
|
+
import logoSrc from '../logo.png';
|
|
4
|
+
import Icon from '../../../Icon';
|
|
5
|
+
import '../../style/index.less';
|
|
6
|
+
import './index.less';
|
|
7
|
+
export default (function () {
|
|
8
|
+
var mockData = [{
|
|
9
|
+
title: '查询',
|
|
10
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
11
|
+
type: 'add'
|
|
12
|
+
}),
|
|
13
|
+
key: 'query',
|
|
14
|
+
path: '/query'
|
|
15
|
+
}, {
|
|
16
|
+
title: '数据',
|
|
17
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
18
|
+
type: 'add'
|
|
19
|
+
}),
|
|
20
|
+
key: 'data',
|
|
21
|
+
path: '/data',
|
|
22
|
+
children: [{
|
|
23
|
+
title: '数据空间',
|
|
24
|
+
key: 'dataSpace',
|
|
25
|
+
path: '/data/dataSpace'
|
|
26
|
+
}, {
|
|
27
|
+
title: '数据源',
|
|
28
|
+
key: 'datasource',
|
|
29
|
+
path: '/data/datasource'
|
|
30
|
+
}]
|
|
31
|
+
}, {
|
|
32
|
+
title: '计算',
|
|
33
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
34
|
+
type: 'add'
|
|
35
|
+
}),
|
|
36
|
+
key: 'calculate',
|
|
37
|
+
path: '/calculate',
|
|
38
|
+
children: [{
|
|
39
|
+
title: '任务记录',
|
|
40
|
+
key: 'job',
|
|
41
|
+
path: '/calculate/job'
|
|
42
|
+
}, {
|
|
43
|
+
title: '查询引擎',
|
|
44
|
+
key: 'queryEngine',
|
|
45
|
+
path: '/calculate/'
|
|
46
|
+
}]
|
|
47
|
+
}, {
|
|
48
|
+
title: '测试',
|
|
49
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
50
|
+
type: 'add'
|
|
51
|
+
}),
|
|
52
|
+
key: 'test',
|
|
53
|
+
path: '/calculate',
|
|
54
|
+
children: [{
|
|
55
|
+
title: '测试菜单1',
|
|
56
|
+
key: 'hello',
|
|
57
|
+
path: '/calculate/job'
|
|
58
|
+
}, {
|
|
59
|
+
title: '测试菜单2',
|
|
60
|
+
key: 'hello2',
|
|
61
|
+
path: '/calculate/'
|
|
62
|
+
}]
|
|
63
|
+
}];
|
|
64
|
+
var footer = /*#__PURE__*/React.createElement("div", null, "Footer Wrap");
|
|
65
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
66
|
+
className: 'ald-nav-demo'
|
|
67
|
+
}, /*#__PURE__*/React.createElement(Navigator, {
|
|
68
|
+
menuList: mockData,
|
|
69
|
+
defaultSelectedKey: "dataSpace",
|
|
70
|
+
footer: footer,
|
|
71
|
+
logoSrc: logoSrc
|
|
72
|
+
}));
|
|
73
|
+
});
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Navigator } from '@aloudata/aloudata-design';
|
|
3
|
+
import logoSrc from '../logo.png';
|
|
4
|
+
import Icon from '../../../Icon';
|
|
5
|
+
import '../../style/index.less';
|
|
6
|
+
import './index.less';
|
|
7
|
+
export default (function () {
|
|
8
|
+
var mockData = [{
|
|
9
|
+
title: '查询',
|
|
10
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
11
|
+
type: 'add'
|
|
12
|
+
}),
|
|
13
|
+
key: 'query',
|
|
14
|
+
path: '/query'
|
|
15
|
+
}, {
|
|
16
|
+
title: '数据',
|
|
17
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
18
|
+
type: 'add'
|
|
19
|
+
}),
|
|
20
|
+
key: 'data',
|
|
21
|
+
path: '/data',
|
|
22
|
+
children: [{
|
|
23
|
+
title: '数据空间',
|
|
24
|
+
key: 'dataSpace',
|
|
25
|
+
path: '/data/dataSpace'
|
|
26
|
+
}, {
|
|
27
|
+
title: '数据源',
|
|
28
|
+
key: 'datasource',
|
|
29
|
+
path: '/data/datasource'
|
|
30
|
+
}]
|
|
31
|
+
}, {
|
|
32
|
+
title: '计算',
|
|
33
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
34
|
+
type: 'add'
|
|
35
|
+
}),
|
|
36
|
+
key: 'calculate',
|
|
37
|
+
path: '/calculate',
|
|
38
|
+
children: [{
|
|
39
|
+
title: '任务记录',
|
|
40
|
+
key: 'job',
|
|
41
|
+
path: '/calculate/job'
|
|
42
|
+
}, {
|
|
43
|
+
title: '查询引擎',
|
|
44
|
+
key: 'queryEngine',
|
|
45
|
+
path: '/calculate/'
|
|
46
|
+
}]
|
|
47
|
+
}, {
|
|
48
|
+
title: '测试',
|
|
49
|
+
icon: /*#__PURE__*/React.createElement(Icon, {
|
|
50
|
+
type: 'add'
|
|
51
|
+
}),
|
|
52
|
+
key: 'test',
|
|
53
|
+
path: '/calculate',
|
|
54
|
+
children: [{
|
|
55
|
+
title: '测试菜单1',
|
|
56
|
+
key: 'hello',
|
|
57
|
+
path: '/calculate/job'
|
|
58
|
+
}, {
|
|
59
|
+
title: '测试菜单2',
|
|
60
|
+
key: 'hello2',
|
|
61
|
+
path: '/calculate/'
|
|
62
|
+
}]
|
|
63
|
+
}];
|
|
64
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
65
|
+
className: 'ald-nav-demo'
|
|
66
|
+
}, /*#__PURE__*/React.createElement(Navigator, {
|
|
67
|
+
menuList: mockData,
|
|
68
|
+
defaultSelectedKey: "dataSpace",
|
|
69
|
+
logoSrc: logoSrc
|
|
70
|
+
}));
|
|
71
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IMenuItem } from './components/Menu';
|
|
3
|
+
import './style';
|
|
4
|
+
export type { IMenuItem } from './components/Menu';
|
|
5
|
+
export interface INavigatorProps {
|
|
6
|
+
/**
|
|
7
|
+
* @description 菜单数据
|
|
8
|
+
* @default []
|
|
9
|
+
*/
|
|
10
|
+
menuList: IMenuItem[];
|
|
11
|
+
/**
|
|
12
|
+
* @description 当前选中的菜单项
|
|
13
|
+
* @default --
|
|
14
|
+
*/
|
|
15
|
+
selectedKey: string;
|
|
16
|
+
/**
|
|
17
|
+
* @description logo的地址 默认高度为24px
|
|
18
|
+
* @default --
|
|
19
|
+
*/
|
|
20
|
+
logoSrc: string;
|
|
21
|
+
/**
|
|
22
|
+
* @description logo的点击(可选)
|
|
23
|
+
* @default --
|
|
24
|
+
*/
|
|
25
|
+
onLogoClick?: () => void;
|
|
26
|
+
/**
|
|
27
|
+
* @description 导航底部信息 可自定义
|
|
28
|
+
* @default null
|
|
29
|
+
*/
|
|
30
|
+
footer?: React.ReactNode;
|
|
31
|
+
/**
|
|
32
|
+
* @description 菜单被选中时调用(可选)
|
|
33
|
+
* @default --
|
|
34
|
+
*/
|
|
35
|
+
onMenuSelect?: (menuInfo: {
|
|
36
|
+
key: string;
|
|
37
|
+
path: string;
|
|
38
|
+
}) => void;
|
|
39
|
+
}
|
|
40
|
+
declare function Navigator(props: INavigatorProps): JSX.Element;
|
|
41
|
+
export default Navigator;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import Menu from './components/Menu';
|
|
4
|
+
import './style';
|
|
5
|
+
|
|
6
|
+
function Navigator(props) {
|
|
7
|
+
var menuList = props.menuList,
|
|
8
|
+
selectedKey = props.selectedKey,
|
|
9
|
+
logoSrc = props.logoSrc,
|
|
10
|
+
_props$footer = props.footer,
|
|
11
|
+
footer = _props$footer === void 0 ? null : _props$footer,
|
|
12
|
+
onLogoClick = props.onLogoClick,
|
|
13
|
+
onMenuSelect = props.onMenuSelect;
|
|
14
|
+
var renderMenu = useCallback(function () {
|
|
15
|
+
return /*#__PURE__*/React.createElement(Menu, {
|
|
16
|
+
menuList: menuList,
|
|
17
|
+
selectedKey: selectedKey,
|
|
18
|
+
onMenuSelect: onMenuSelect
|
|
19
|
+
});
|
|
20
|
+
}, [selectedKey, menuList, onMenuSelect]);
|
|
21
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
22
|
+
className: classNames('ald-nav')
|
|
23
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
24
|
+
className: classNames('ald-nav-logo', {
|
|
25
|
+
'ald-nav-logo-able-click': onLogoClick
|
|
26
|
+
})
|
|
27
|
+
}, logoSrc && /*#__PURE__*/React.createElement("div", {
|
|
28
|
+
onClick: onLogoClick,
|
|
29
|
+
className: "ald-nav-logo-wrap"
|
|
30
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
31
|
+
src: logoSrc,
|
|
32
|
+
alt: "",
|
|
33
|
+
draggable: false
|
|
34
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
35
|
+
className: classNames('ald-nav-menu', {
|
|
36
|
+
'ald-nav-menu-has-footer': !!footer
|
|
37
|
+
})
|
|
38
|
+
}, renderMenu()), footer && /*#__PURE__*/React.createElement("div", {
|
|
39
|
+
className: "ald-nav-footer"
|
|
40
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
41
|
+
className: "ald-nav-footer-wrap"
|
|
42
|
+
}, footer)));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export default Navigator;
|