@zgfe/business-lib 1.1.41-attribution.4 → 1.1.41-attribution.5
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/config.js +41 -0
- package/es/addToPanel/demo/edit.d.ts +2 -1
- package/es/addToPanel/demo/edit.js +5 -3
- package/es/addToPanel/demo/index.d.ts +2 -1
- package/es/addToPanel/index.js +1 -4
- package/es/addToPanel/types.d.ts +2 -2
- package/es/addToScene/demo/index.d.ts +2 -1
- package/es/assets/demo/input.d.ts +2 -1
- package/es/attrCondition/demo/group.d.ts +2 -1
- package/es/attrCondition/demo/index.d.ts +2 -1
- package/es/attrConditions/demo/group.d.ts +2 -1
- package/es/attrConditions/demo/index.d.ts +2 -1
- package/es/attributeSelector/demo/disable.d.ts +2 -1
- package/es/attributeSelector/demo/index.d.ts +2 -1
- package/es/chart/demo/bar.d.ts +2 -1
- package/es/chart/demo/index.d.ts +2 -1
- package/es/chart/demo/map.d.ts +2 -1
- package/es/chart/demo/pie.d.ts +2 -1
- package/es/colorIcon/demo/index.d.ts +2 -1
- package/es/constants/apis.d.ts +2 -0
- package/es/constants/apis.js +2 -0
- package/es/context/index.d.ts +1 -0
- package/es/cycleTime/demo/disable.d.ts +2 -1
- package/es/cycleTime/demo/index.d.ts +2 -1
- package/es/cycleTime/demo/multi.d.ts +2 -1
- package/es/datePicker/demo/customType.d.ts +2 -1
- package/es/datePicker/demo/day.d.ts +2 -1
- package/es/datePicker/demo/index.d.ts +2 -1
- package/es/demoWrapper/content.d.ts +2 -1
- package/es/demoWrapper/content.js +4 -3
- package/es/demoWrapper/demo/index.d.ts +2 -1
- package/es/demoWrapper/index.js +4 -2
- package/es/demoWrapper/types.d.ts +2 -0
- package/es/dialog/demo/index.d.ts +2 -1
- package/es/dnd/demo/data.d.ts +2 -1
- package/es/dnd/demo/handle.d.ts +2 -1
- package/es/dnd/demo/index.d.ts +2 -1
- package/es/eventSelector/demo/index.d.ts +2 -1
- package/es/icon/demo/index.d.ts +2 -1
- package/es/icon/demo/list.d.ts +2 -1
- package/es/index.d.ts +3 -1
- package/es/index.js +3 -1
- package/es/layout/analysisLayout/demo/index.d.ts +2 -1
- package/es/layout/detail/demo/index.d.ts +2 -1
- package/es/layout/optionTitle/components/btnMenu/api.d.ts +4 -0
- package/es/layout/optionTitle/components/btnMenu/api.js +7 -0
- package/es/layout/optionTitle/components/btnMenu/demo.d.ts +3 -0
- package/es/layout/optionTitle/components/btnMenu/demo.js +80 -0
- package/es/layout/optionTitle/components/btnMenu/index.d.ts +5 -0
- package/es/layout/optionTitle/components/btnMenu/index.js +48 -0
- package/es/layout/optionTitle/components/btnMenu/index.less +18 -0
- package/es/layout/optionTitle/components/title/demo.d.ts +3 -0
- package/es/layout/optionTitle/components/title/demo.js +50 -0
- package/es/layout/optionTitle/components/title/index.d.ts +5 -0
- package/es/layout/optionTitle/components/title/index.js +106 -0
- package/es/layout/optionTitle/components/title/index.less +42 -0
- package/es/layout/optionTitle/data.d.ts +3 -0
- package/es/layout/optionTitle/data.js +77 -0
- package/es/layout/optionTitle/demo/index.d.ts +3 -0
- package/es/layout/optionTitle/demo/index.js +116 -0
- package/es/layout/optionTitle/demo/index.less +12 -0
- package/es/layout/optionTitle/demo/layout.d.ts +4 -0
- package/es/layout/optionTitle/demo/layout.js +41 -0
- package/es/layout/optionTitle/demo/panelCreate.d.ts +3 -0
- package/es/layout/optionTitle/demo/panelCreate.js +114 -0
- package/es/layout/optionTitle/index.d.ts +6 -0
- package/es/layout/optionTitle/index.js +155 -0
- package/es/layout/optionTitle/layout.d.ts +5 -0
- package/es/layout/optionTitle/layout.js +38 -0
- package/es/layout/optionTitle/styles/index.less +19 -0
- package/es/layout/optionTitle/styles/layout.less +43 -0
- package/es/layout/optionTitle/styles/search.less +27 -0
- package/es/layout/optionTitle/types.d.ts +85 -0
- package/es/layout/optionTitle/types.js +15 -0
- package/es/layout/optionTitle/typesValue.d.ts +4 -0
- package/es/layout/optionTitle/typesValue.js +7 -0
- package/es/loginForm/demo/index.d.ts +2 -1
- package/es/searchInput/demo/index.d.ts +2 -1
- package/es/select/demo/children.d.ts +2 -1
- package/es/select/demo/customLabel.d.ts +2 -1
- package/es/select/demo/group.d.ts +2 -1
- package/es/select/demo/index.d.ts +2 -1
- package/es/select/demo/loading.d.ts +2 -1
- package/es/select/demo/multiple.d.ts +2 -1
- package/es/socket/demo/demo.d.ts +2 -1
- package/es/table/demo/index.d.ts +2 -1
- package/es/table/demo/index2.d.ts +2 -1
- package/es/table/demo/index3.d.ts +2 -1
- package/es/targetConditionGroup/demo/group.d.ts +2 -1
- package/es/targetConditionGroup/demo/index.d.ts +2 -1
- package/es/targetSelector/demo/index.d.ts +2 -1
- package/es/userCondition/demo/business.d.ts +2 -1
- package/es/userCondition/demo/index.d.ts +2 -1
- package/es/userGroup/demo/group.d.ts +2 -1
- package/es/userGroup/demo/index.d.ts +2 -1
- package/es/userTagsSelector/demo/index.d.ts +2 -1
- package/package.json +4 -3
package/config.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 对关键配置信息进行本地化存储,避免多人项目配置代码冲突
|
|
6
|
+
* @param defaultConfig
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
function getConfig(defaultConfig, basePath) {
|
|
10
|
+
const configPath = path.resolve(basePath, '.config.json');
|
|
11
|
+
let resConfig = defaultConfig;
|
|
12
|
+
try {
|
|
13
|
+
if (fs.existsSync(configPath)) {
|
|
14
|
+
const config = fs.readFileSync(configPath, 'utf-8');
|
|
15
|
+
if (!config || config === '{}') {
|
|
16
|
+
throw new Error('配置文件为空');
|
|
17
|
+
}
|
|
18
|
+
const configObj = JSON.parse(config);
|
|
19
|
+
// 如果读取的配置文件,数据结构与默认配置不一致,则更新配置文件,更新规则:以默认配置为准,保留用户自定义配置
|
|
20
|
+
const isSame = Object.keys(defaultConfig).every((key) => {
|
|
21
|
+
return configObj.hasOwnProperty(key);
|
|
22
|
+
});
|
|
23
|
+
if (!isSame) {
|
|
24
|
+
resConfig = Object.assign({}, defaultConfig, configObj);
|
|
25
|
+
throw new Error('配置文件数据结构不一致');
|
|
26
|
+
}
|
|
27
|
+
resConfig = configObj;
|
|
28
|
+
} else {
|
|
29
|
+
throw new Error('配置文件不存在');
|
|
30
|
+
}
|
|
31
|
+
} catch (e) {
|
|
32
|
+
console.log(e.message);
|
|
33
|
+
fs.writeFileSync(configPath, JSON.stringify(resConfig, null, 2));
|
|
34
|
+
}
|
|
35
|
+
console.log('配置详情', resConfig);
|
|
36
|
+
return resConfig;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
module.exports = {
|
|
40
|
+
getConfig,
|
|
41
|
+
};
|
|
@@ -5,7 +5,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5
5
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
import React, { useState } from 'react';
|
|
8
|
-
import { BizAddToPanel } from '@zgfe/business-lib';
|
|
8
|
+
import { BizAddToPanel, DemoWrapper } from '@zgfe/business-lib';
|
|
9
9
|
import { Button } from 'antd';
|
|
10
10
|
var chartTypes = [{
|
|
11
11
|
label: '趋势图',
|
|
@@ -53,7 +53,9 @@ export default (function () {
|
|
|
53
53
|
_useState2 = _slicedToArray(_useState, 2),
|
|
54
54
|
showDialog = _useState2[0],
|
|
55
55
|
setShowDialog = _useState2[1];
|
|
56
|
-
return /*#__PURE__*/React.createElement(
|
|
56
|
+
return /*#__PURE__*/React.createElement(DemoWrapper, {
|
|
57
|
+
needMeta: true
|
|
58
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Button, {
|
|
57
59
|
onClick: function onClick() {
|
|
58
60
|
setShowDialog(true);
|
|
59
61
|
}
|
|
@@ -69,5 +71,5 @@ export default (function () {
|
|
|
69
71
|
onOk: function onOk() {
|
|
70
72
|
setShowDialog(false);
|
|
71
73
|
}
|
|
72
|
-
}));
|
|
74
|
+
})));
|
|
73
75
|
});
|
package/es/addToPanel/index.js
CHANGED
|
@@ -216,10 +216,7 @@ var BizAddToPanel = function BizAddToPanel(props) {
|
|
|
216
216
|
rules: [{
|
|
217
217
|
validator: function validator(_, value) {
|
|
218
218
|
if (props.type === 'edit') {
|
|
219
|
-
|
|
220
|
-
message: '指标名称不能为空'
|
|
221
|
-
});
|
|
222
|
-
return Promise.reject();
|
|
219
|
+
return Promise.resolve();
|
|
223
220
|
}
|
|
224
221
|
if (!value || !/\S+/.test(value)) return Promise.reject('请输入指标名称!');
|
|
225
222
|
if (!/^[\S\s]{1,20}$/.test(value)) return Promise.reject('指标名称最多为20个字符!');
|
package/es/addToPanel/types.d.ts
CHANGED
package/es/chart/demo/bar.d.ts
CHANGED
package/es/chart/demo/index.d.ts
CHANGED
package/es/chart/demo/map.d.ts
CHANGED
package/es/chart/demo/pie.d.ts
CHANGED
package/es/constants/apis.d.ts
CHANGED
package/es/constants/apis.js
CHANGED
|
@@ -5,6 +5,8 @@ var Apis = {
|
|
|
5
5
|
addPanel: '/apppanel/addPanelElement.jsp',
|
|
6
6
|
updatePanelTarget: '/apppanel/updateElemet.jsp',
|
|
7
7
|
queryPanelGroup: '/apppanel/panels.jsp',
|
|
8
|
+
delPanelElement: '/apppanel/delPanelElement.jsp',
|
|
9
|
+
updateElementName: '/apppanel/updateElementName.jsp',
|
|
8
10
|
queryDatasetList: '/zg/web/cdp/inner/dataset/list',
|
|
9
11
|
queryDatasetDetail: '/zg/web/cdp/inner/dataset/detail',
|
|
10
12
|
getSocketToken: '/zg/web/v2/tracking/view/websocket/token',
|
package/es/context/index.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export interface GlobalContextProps {
|
|
|
39
39
|
router?: any;
|
|
40
40
|
routes?: any;
|
|
41
41
|
envs?: Record<string, any>;
|
|
42
|
+
onMessage?: (type: string, data?: any, callback?: Function) => void;
|
|
42
43
|
system?: string;
|
|
43
44
|
}
|
|
44
45
|
declare const BizGlobalDataContext: import("react").Context<GlobalContextProps>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
import { AppInfoProps } from '../context';
|
|
2
|
+
import { AppInfoProps, GlobalContextProps } from '../context';
|
|
3
3
|
declare const DemoContent: React.FC<{
|
|
4
4
|
children?: ReactNode;
|
|
5
5
|
needMeta?: boolean;
|
|
6
6
|
currentApp?: AppInfoProps;
|
|
7
|
+
contextProps?: GlobalContextProps;
|
|
7
8
|
}>;
|
|
8
9
|
export default DemoContent;
|
|
@@ -49,7 +49,8 @@ function ajax(url, options) {
|
|
|
49
49
|
var DemoContent = function DemoContent(_ref3) {
|
|
50
50
|
var children = _ref3.children,
|
|
51
51
|
currentApp = _ref3.currentApp,
|
|
52
|
-
needMeta = _ref3.needMeta
|
|
52
|
+
needMeta = _ref3.needMeta,
|
|
53
|
+
contextProps = _ref3.contextProps;
|
|
53
54
|
var _useState = useState([]),
|
|
54
55
|
_useState2 = _slicedToArray(_useState, 2),
|
|
55
56
|
eventGroups = _useState2[0],
|
|
@@ -168,7 +169,7 @@ var DemoContent = function DemoContent(_ref3) {
|
|
|
168
169
|
});
|
|
169
170
|
}
|
|
170
171
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(BizGlobalDataContext.Provider, {
|
|
171
|
-
value: {
|
|
172
|
+
value: _objectSpread({
|
|
172
173
|
currentApp: _objectSpread(_objectSpread({}, currentApp), {}, {
|
|
173
174
|
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.id
|
|
174
175
|
}),
|
|
@@ -178,7 +179,7 @@ var DemoContent = function DemoContent(_ref3) {
|
|
|
178
179
|
eventIdMap: store === null || store === void 0 ? void 0 : store.eventIdMap,
|
|
179
180
|
eventNameMap: store === null || store === void 0 ? void 0 : store.eventNameMap,
|
|
180
181
|
userGroupList: userGroups
|
|
181
|
-
}
|
|
182
|
+
}, contextProps)
|
|
182
183
|
}, children));
|
|
183
184
|
};
|
|
184
185
|
export default DemoContent;
|
package/es/demoWrapper/index.js
CHANGED
|
@@ -15,7 +15,8 @@ var DemoWrapper = function DemoWrapper(_ref) {
|
|
|
15
15
|
var children = _ref.children,
|
|
16
16
|
className = _ref.className,
|
|
17
17
|
defaultApp = _ref.defaultApp,
|
|
18
|
-
needMeta = _ref.needMeta
|
|
18
|
+
needMeta = _ref.needMeta,
|
|
19
|
+
contextProps = _ref.contextProps;
|
|
19
20
|
var _useState = useState(true),
|
|
20
21
|
_useState2 = _slicedToArray(_useState, 2),
|
|
21
22
|
loading = _useState2[0],
|
|
@@ -70,7 +71,8 @@ var DemoWrapper = function DemoWrapper(_ref) {
|
|
|
70
71
|
}) : /*#__PURE__*/React.createElement(DemoContent, {
|
|
71
72
|
currentApp: app,
|
|
72
73
|
needMeta: needMeta,
|
|
73
|
-
key: app === null || app === void 0 ? void 0 : app.appId
|
|
74
|
+
key: app === null || app === void 0 ? void 0 : app.appId,
|
|
75
|
+
contextProps: contextProps
|
|
74
76
|
}, children));
|
|
75
77
|
};
|
|
76
78
|
export default DemoWrapper;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
+
import { GlobalContextProps } from '../context';
|
|
2
3
|
declare namespace DemoWrapperTypes {
|
|
3
4
|
interface Props {
|
|
4
5
|
className?: string;
|
|
5
6
|
defaultApp?: number;
|
|
6
7
|
needMeta?: boolean;
|
|
7
8
|
children?: ReactNode;
|
|
9
|
+
contextProps?: GlobalContextProps;
|
|
8
10
|
}
|
|
9
11
|
}
|
|
10
12
|
export declare const Props: React.FC<DemoWrapperTypes.Props>;
|
package/es/dnd/demo/data.d.ts
CHANGED
package/es/dnd/demo/handle.d.ts
CHANGED
package/es/dnd/demo/index.d.ts
CHANGED
package/es/icon/demo/index.d.ts
CHANGED
package/es/icon/demo/list.d.ts
CHANGED
package/es/index.d.ts
CHANGED
|
@@ -32,7 +32,9 @@ import DemoWrapper from './demoWrapper';
|
|
|
32
32
|
import SocketClient from './socket';
|
|
33
33
|
import BizAttrCondition from './attrCondition';
|
|
34
34
|
import BizAttrConditionGroup from './attrCondition/group';
|
|
35
|
-
|
|
35
|
+
import BizTargetFromPanel from './layout/optionTitle';
|
|
36
|
+
import { BizTargetFromPanelContext } from './layout/optionTitle/types';
|
|
37
|
+
export { BizTargetFromPanel, BizSearchInput, BizSelect, BizDialog, BizChart, BizTable, BizAnalysisLayout, BizDetailLayout, BizUserGroup, IconFont, ColorIcon, BizTargetSelector, BizEventSelector, BizAttributeSelector, BizGlobalDataContext, BizTargetFromPanelContext, BizTargetCondition, BizDatePicker, BizConditionItem, BizConditionGroup, BizAttrCondition, BizAttrConditionGroup, BizUserCondition, BizAddToScene, BizAddToPanel, BizCycleTime, BizDnd, BizLoginForm, DemoWrapper, SocketClient, ajax, util, theme, convertAttributeData, BizUserTagsSelect, setGlobalConfig, };
|
|
36
38
|
export type { UserGroupTypes } from './userGroup/types';
|
|
37
39
|
export type { BizSelectTypes } from './select/types';
|
|
38
40
|
export type { AttributeSelect } from './attributeSelector/types';
|
package/es/index.js
CHANGED
|
@@ -31,4 +31,6 @@ import DemoWrapper from './demoWrapper';
|
|
|
31
31
|
import SocketClient from './socket';
|
|
32
32
|
import BizAttrCondition from './attrCondition';
|
|
33
33
|
import BizAttrConditionGroup from './attrCondition/group';
|
|
34
|
-
|
|
34
|
+
import BizTargetFromPanel from './layout/optionTitle';
|
|
35
|
+
import { BizTargetFromPanelContext } from './layout/optionTitle/types';
|
|
36
|
+
export { BizTargetFromPanel, BizSearchInput, BizSelect, BizDialog, BizChart, BizTable, BizAnalysisLayout, BizDetailLayout, BizUserGroup, IconFont, ColorIcon, BizTargetSelector, BizEventSelector, BizAttributeSelector, BizGlobalDataContext, BizTargetFromPanelContext, BizTargetCondition, BizDatePicker, BizConditionItem, BizConditionGroup, BizAttrCondition, BizAttrConditionGroup, BizUserCondition, BizAddToScene, BizAddToPanel, BizCycleTime, BizDnd, BizLoginForm, DemoWrapper, SocketClient, ajax, util, theme, convertAttributeData, BizUserTagsSelect, setGlobalConfig };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export var BtnMenuProps_ = function BtnMenuProps_() {
|
|
3
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
4
|
+
};
|
|
5
|
+
export var BtnItem_ = function BtnItem_() {
|
|
6
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
7
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import BizBtnMenu from '.';
|
|
3
|
+
import { IconFont } from '../../../..';
|
|
4
|
+
var menu = [{
|
|
5
|
+
key: '10',
|
|
6
|
+
label: '下载',
|
|
7
|
+
itemType: 'dropdownBtn',
|
|
8
|
+
type: 'default',
|
|
9
|
+
children: [{
|
|
10
|
+
key: '100',
|
|
11
|
+
label: 'JPG',
|
|
12
|
+
onClick: function onClick() {
|
|
13
|
+
console.log('JPG');
|
|
14
|
+
}
|
|
15
|
+
}, {
|
|
16
|
+
key: '101',
|
|
17
|
+
label: 'PNG',
|
|
18
|
+
onClick: function onClick() {
|
|
19
|
+
console.log('PNG');
|
|
20
|
+
}
|
|
21
|
+
}]
|
|
22
|
+
}, {
|
|
23
|
+
key: '11',
|
|
24
|
+
label: /*#__PURE__*/React.createElement("a", {
|
|
25
|
+
style: {
|
|
26
|
+
width: 32,
|
|
27
|
+
height: 32,
|
|
28
|
+
color: '#5f6085',
|
|
29
|
+
fontSize: 16,
|
|
30
|
+
textAlign: 'center',
|
|
31
|
+
transform: 'rotate(90deg)'
|
|
32
|
+
}
|
|
33
|
+
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
34
|
+
type: "gengduocaozuo1"
|
|
35
|
+
})),
|
|
36
|
+
itemType: 'dropdown',
|
|
37
|
+
type: 'default',
|
|
38
|
+
children: [{
|
|
39
|
+
key: '110',
|
|
40
|
+
label: '编辑',
|
|
41
|
+
onClick: function onClick() {
|
|
42
|
+
console.log('编辑');
|
|
43
|
+
}
|
|
44
|
+
}, {
|
|
45
|
+
key: '111',
|
|
46
|
+
label: '删除',
|
|
47
|
+
onClick: function onClick() {
|
|
48
|
+
console.log('删除');
|
|
49
|
+
}
|
|
50
|
+
}]
|
|
51
|
+
}, {
|
|
52
|
+
key: '12',
|
|
53
|
+
label: '',
|
|
54
|
+
itemType: 'divider'
|
|
55
|
+
}, {
|
|
56
|
+
key: '1',
|
|
57
|
+
label: '测试按钮1',
|
|
58
|
+
onClick: function onClick() {
|
|
59
|
+
console.log('测试按钮1');
|
|
60
|
+
}
|
|
61
|
+
}, {
|
|
62
|
+
key: '2',
|
|
63
|
+
label: '测试按钮2',
|
|
64
|
+
type: 'text',
|
|
65
|
+
onClick: function onClick() {
|
|
66
|
+
console.log('测试按钮2');
|
|
67
|
+
}
|
|
68
|
+
}, {
|
|
69
|
+
key: '3',
|
|
70
|
+
label: '测试按钮3',
|
|
71
|
+
disabled: true,
|
|
72
|
+
onClick: function onClick() {
|
|
73
|
+
console.log('测试按钮3');
|
|
74
|
+
}
|
|
75
|
+
}];
|
|
76
|
+
export default (function () {
|
|
77
|
+
return /*#__PURE__*/React.createElement(BizBtnMenu, {
|
|
78
|
+
menu: menu
|
|
79
|
+
});
|
|
80
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
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; }
|
|
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
|
+
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
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
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 { Button, Dropdown } from 'antd';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import './index.less';
|
|
10
|
+
export var BizBtnMenu = function BizBtnMenu(props) {
|
|
11
|
+
var classPrefix = 'btn-menu';
|
|
12
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
13
|
+
className: "".concat(classPrefix, " ").concat(props.className || '')
|
|
14
|
+
}, props.menu.map(function (item) {
|
|
15
|
+
var config = {
|
|
16
|
+
key: item.key,
|
|
17
|
+
type: item.type || 'primary',
|
|
18
|
+
disabled: item.disabled,
|
|
19
|
+
icon: item.icon,
|
|
20
|
+
className: "".concat(classPrefix, "-btn ").concat(item.className || ''),
|
|
21
|
+
onClick: item.onClick
|
|
22
|
+
};
|
|
23
|
+
switch (item.itemType) {
|
|
24
|
+
case 'dropdownBtn':
|
|
25
|
+
return /*#__PURE__*/React.createElement(Dropdown.Button, _objectSpread(_objectSpread({}, config), {}, {
|
|
26
|
+
overlayClassName: "".concat(item.overlayClassName || ''),
|
|
27
|
+
menu: {
|
|
28
|
+
items: item.children
|
|
29
|
+
}
|
|
30
|
+
}), item.label);
|
|
31
|
+
case 'dropdown':
|
|
32
|
+
return /*#__PURE__*/React.createElement(Dropdown, _objectSpread(_objectSpread({}, config), {}, {
|
|
33
|
+
overlayClassName: "".concat(item.overlayClassName || ''),
|
|
34
|
+
menu: {
|
|
35
|
+
items: item.children
|
|
36
|
+
}
|
|
37
|
+
}), item.label);
|
|
38
|
+
case 'divider':
|
|
39
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
40
|
+
key: item.key,
|
|
41
|
+
className: "".concat(classPrefix, "-divider ").concat(item.className || '')
|
|
42
|
+
});
|
|
43
|
+
default:
|
|
44
|
+
return /*#__PURE__*/React.createElement(Button, _objectSpread({}, config), item.label);
|
|
45
|
+
}
|
|
46
|
+
}));
|
|
47
|
+
};
|
|
48
|
+
export default BizBtnMenu;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
@import '~@zgfe/business-lib/es/assets/styles/variable.less';
|
|
2
|
+
.btn-menu {
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
|
|
6
|
+
&-btn {
|
|
7
|
+
margin-right: 16px;
|
|
8
|
+
border-radius: @border-radius-small;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
&-divider {
|
|
12
|
+
width: 1px;
|
|
13
|
+
height: 32px;
|
|
14
|
+
margin-right: 32px;
|
|
15
|
+
margin-left: 16px;
|
|
16
|
+
background-color: #ecedf0;
|
|
17
|
+
}
|
|
18
|
+
}
|