@zgfe/business-lib 1.2.17 → 1.2.18
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/constants/apis.d.ts +1 -0
- package/es/constants/apis.js +2 -1
- package/es/layout/optionTitle/components/changePanelModal/index.d.ts +5 -0
- package/es/layout/optionTitle/components/changePanelModal/index.js +70 -0
- package/es/layout/optionTitle/components/changePanelModal/panelItem.d.ts +5 -0
- package/es/layout/optionTitle/components/changePanelModal/panelItem.js +155 -0
- package/es/layout/optionTitle/components/changePanelModal/styles/index.less +92 -0
- package/es/layout/optionTitle/components/changePanelModal/types.d.ts +6 -0
- package/es/layout/optionTitle/components/changePanelModal/types.js +1 -0
- package/es/layout/optionTitle/components/title/index.js +14 -5
- package/es/layout/optionTitle/components/title/index.less +1 -0
- package/es/layout/optionTitle/data.js +0 -31
- package/es/layout/optionTitle/demo/index.js +1 -1
- package/es/layout/optionTitle/index.js +6 -2
- package/es/layout/optionTitle/layout.js +35 -3
- package/es/layout/optionTitle/styles/layout.less +46 -0
- package/es/layout/optionTitle/types.d.ts +3 -0
- package/package.json +2 -2
package/es/constants/apis.d.ts
CHANGED
package/es/constants/apis.js
CHANGED
|
@@ -21,6 +21,7 @@ var Apis = {
|
|
|
21
21
|
getTagDetail: '/zg/web/v2/labelGroup/label/labelLayer',
|
|
22
22
|
queryUserGroup: '/zg/web/v2/userGroup/getAll',
|
|
23
23
|
queryAllTags: '/zg/web/v2/v4/userGroup/label/list',
|
|
24
|
-
querySubjectList: '/zg/web/v2/analysisSubject/queryAllSubject'
|
|
24
|
+
querySubjectList: '/zg/web/v2/analysisSubject/queryAllSubject',
|
|
25
|
+
queryPanels: '/zg/web/v2/apppanel/panels'
|
|
25
26
|
};
|
|
26
27
|
export default Apis;
|
|
@@ -0,0 +1,70 @@
|
|
|
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
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
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."); }
|
|
9
|
+
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); }
|
|
10
|
+
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; }
|
|
11
|
+
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; } }
|
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
import { Spin } from 'antd';
|
|
14
|
+
import React, { useState, useEffect, useContext } from 'react';
|
|
15
|
+
import { BizGlobalDataContext, BizTargetFromPanelContext } from '../../../..';
|
|
16
|
+
import PanelItem from './panelItem';
|
|
17
|
+
import './styles/index.less';
|
|
18
|
+
var classPrefix = 'change-panel-modal';
|
|
19
|
+
import request from '../../../../utils/ajax';
|
|
20
|
+
import Apis from '../../../../constants/apis';
|
|
21
|
+
var ChangePanelModal = function ChangePanelModal() {
|
|
22
|
+
var _useState = useState(true),
|
|
23
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
24
|
+
loading = _useState2[0],
|
|
25
|
+
setLoading = _useState2[1];
|
|
26
|
+
var _useState3 = useState([]),
|
|
27
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
28
|
+
eleArr = _useState4[0],
|
|
29
|
+
setEleArr = _useState4[1];
|
|
30
|
+
var _useContext = useContext(BizTargetFromPanelContext),
|
|
31
|
+
itemValue = _useContext.itemValue;
|
|
32
|
+
var _useContext2 = useContext(BizGlobalDataContext),
|
|
33
|
+
currentApp = _useContext2.currentApp;
|
|
34
|
+
useEffect(function () {
|
|
35
|
+
getData();
|
|
36
|
+
}, []);
|
|
37
|
+
var getData = function getData() {
|
|
38
|
+
request(Apis.queryPanels, {
|
|
39
|
+
method: 'post',
|
|
40
|
+
data: {
|
|
41
|
+
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
|
|
42
|
+
platform: (currentApp === null || currentApp === void 0 ? void 0 : currentApp.platform) || 0,
|
|
43
|
+
roleType: 3
|
|
44
|
+
}
|
|
45
|
+
}).then(function (res) {
|
|
46
|
+
var dealEleArr = [];
|
|
47
|
+
((res === null || res === void 0 ? void 0 : res.data) || []).map(function (item) {
|
|
48
|
+
item.elements.map(function (v) {
|
|
49
|
+
if (v.reqParam.data.module === (itemValue === null || itemValue === void 0 ? void 0 : itemValue.target.params.module)) {
|
|
50
|
+
dealEleArr.push(_objectSpread(_objectSpread({}, v), {}, {
|
|
51
|
+
panelId: item.id
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
setEleArr(dealEleArr);
|
|
57
|
+
setLoading(false);
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
return /*#__PURE__*/React.createElement("div", null, loading ? /*#__PURE__*/React.createElement(Spin, null) : eleArr.length > 0 ? eleArr.map(function (item) {
|
|
61
|
+
return /*#__PURE__*/React.createElement(PanelItem, {
|
|
62
|
+
data: item,
|
|
63
|
+
key: item.id,
|
|
64
|
+
onChangeItem: getData
|
|
65
|
+
});
|
|
66
|
+
}) : /*#__PURE__*/React.createElement("p", {
|
|
67
|
+
className: "".concat(classPrefix, "-empty-data")
|
|
68
|
+
}, "\u6682\u65E0\u6570\u636E"));
|
|
69
|
+
};
|
|
70
|
+
export default ChangePanelModal;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
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."); }
|
|
3
|
+
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); }
|
|
4
|
+
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; }
|
|
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
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import { Popover, Input, message } from 'antd';
|
|
8
|
+
import React, { useState, useContext, useRef } from 'react';
|
|
9
|
+
import { BizTargetFromPanelContext } from '../../types';
|
|
10
|
+
import { ajax, BizDialog, IconFont } from './../../../../';
|
|
11
|
+
import './styles/index.less';
|
|
12
|
+
import Apis from '../../../../constants/apis';
|
|
13
|
+
var classPrefix = 'modules-panel-item';
|
|
14
|
+
var PanelItem = function PanelItem(props) {
|
|
15
|
+
var data = props.data,
|
|
16
|
+
onChangeItem = props.onChangeItem;
|
|
17
|
+
var _useState = useState(false),
|
|
18
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
19
|
+
edit = _useState2[0],
|
|
20
|
+
setEdit = _useState2[1];
|
|
21
|
+
var _useState3 = useState(data.name),
|
|
22
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
23
|
+
value = _useState4[0],
|
|
24
|
+
setValue = _useState4[1];
|
|
25
|
+
var _useContext = useContext(BizTargetFromPanelContext),
|
|
26
|
+
itemValue = _useContext.itemValue,
|
|
27
|
+
afterEditTarget = _useContext.afterEditTarget;
|
|
28
|
+
var _useState5 = useState(false),
|
|
29
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
30
|
+
popoverShow = _useState6[0],
|
|
31
|
+
setPopoverShow = _useState6[1];
|
|
32
|
+
var _useState7 = useState(false),
|
|
33
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
34
|
+
dialogShow = _useState8[0],
|
|
35
|
+
setDialogShow = _useState8[1];
|
|
36
|
+
var inputRef = useRef(null);
|
|
37
|
+
var onChange = function onChange(e) {
|
|
38
|
+
setValue(e.currentTarget.value);
|
|
39
|
+
};
|
|
40
|
+
var onBlur = function onBlur() {
|
|
41
|
+
var _props$data, _props$data2;
|
|
42
|
+
ajax(Apis.updateElementName, {
|
|
43
|
+
method: 'post',
|
|
44
|
+
data: {
|
|
45
|
+
panelId: (_props$data = props.data) === null || _props$data === void 0 ? void 0 : _props$data.panelId,
|
|
46
|
+
elementId: (_props$data2 = props.data) === null || _props$data2 === void 0 ? void 0 : _props$data2.id,
|
|
47
|
+
name: value
|
|
48
|
+
}
|
|
49
|
+
}).then(function (res) {
|
|
50
|
+
if (res && res.code === '103000') {
|
|
51
|
+
message.success('修改指标名称成功');
|
|
52
|
+
onChangeItem && onChangeItem();
|
|
53
|
+
afterEditTarget === null || afterEditTarget === void 0 ? void 0 : afterEditTarget('renameItem');
|
|
54
|
+
} else {
|
|
55
|
+
message.success('修改指标名称失败');
|
|
56
|
+
}
|
|
57
|
+
}).catch(function () {
|
|
58
|
+
message.success('修改指标名称失败');
|
|
59
|
+
}).finally(function () {
|
|
60
|
+
setEdit(false);
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
var onDelete = function onDelete() {
|
|
64
|
+
setPopoverShow(false);
|
|
65
|
+
setDialogShow(true);
|
|
66
|
+
};
|
|
67
|
+
var delItem = function delItem() {
|
|
68
|
+
var _props$data3, _props$data4;
|
|
69
|
+
ajax(Apis.delPanelElement, {
|
|
70
|
+
method: 'post',
|
|
71
|
+
data: {
|
|
72
|
+
panelId: (_props$data3 = props.data) === null || _props$data3 === void 0 ? void 0 : _props$data3.panelId,
|
|
73
|
+
elementId: (_props$data4 = props.data) === null || _props$data4 === void 0 ? void 0 : _props$data4.id
|
|
74
|
+
}
|
|
75
|
+
}).then(function (res) {
|
|
76
|
+
if (!res) return;
|
|
77
|
+
message.success('删除成功');
|
|
78
|
+
onChangeItem && onChangeItem();
|
|
79
|
+
window.history.back();
|
|
80
|
+
afterEditTarget === null || afterEditTarget === void 0 ? void 0 : afterEditTarget('deleteItem');
|
|
81
|
+
}).catch(function () {
|
|
82
|
+
message.error('删除失败');
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
var onChangePanel = function onChangePanel() {
|
|
86
|
+
afterEditTarget === null || afterEditTarget === void 0 ? void 0 : afterEditTarget('changeItem', props.data);
|
|
87
|
+
};
|
|
88
|
+
var edteHandle = function edteHandle() {
|
|
89
|
+
setEdit(true);
|
|
90
|
+
setTimeout(function () {
|
|
91
|
+
inputRef.current.focus();
|
|
92
|
+
}, 0);
|
|
93
|
+
};
|
|
94
|
+
var onOpenChange = function onOpenChange(open) {
|
|
95
|
+
setPopoverShow(open);
|
|
96
|
+
};
|
|
97
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
98
|
+
className: "".concat(classPrefix, " ").concat(edit ? 'edit' : '', " ").concat(itemValue.target.id == data.id ? 'active' : ''),
|
|
99
|
+
key: data.id
|
|
100
|
+
}, !edit && /*#__PURE__*/React.createElement("span", {
|
|
101
|
+
className: "".concat(classPrefix, "-text"),
|
|
102
|
+
onClick: function onClick() {
|
|
103
|
+
return onChangePanel();
|
|
104
|
+
}
|
|
105
|
+
}, value), edit && /*#__PURE__*/React.createElement(Input, {
|
|
106
|
+
ref: inputRef,
|
|
107
|
+
value: value,
|
|
108
|
+
maxLength: 20,
|
|
109
|
+
onChange: onChange,
|
|
110
|
+
onBlur: onBlur
|
|
111
|
+
}), /*#__PURE__*/React.createElement(Popover, {
|
|
112
|
+
overlayClassName: "".concat(classPrefix, "-popover"),
|
|
113
|
+
open: popoverShow,
|
|
114
|
+
placement: "bottomLeft",
|
|
115
|
+
content: /*#__PURE__*/React.createElement("div", null, itemValue.target.id !== data.id && /*#__PURE__*/React.createElement("p", {
|
|
116
|
+
className: "text",
|
|
117
|
+
onClick: function onClick() {
|
|
118
|
+
edteHandle();
|
|
119
|
+
}
|
|
120
|
+
}, "\u7F16\u8F91\u540D\u79F0"), /*#__PURE__*/React.createElement("p", {
|
|
121
|
+
className: "text delete",
|
|
122
|
+
onClick: function onClick() {
|
|
123
|
+
onDelete();
|
|
124
|
+
}
|
|
125
|
+
}, "\u5220\u9664\u770B\u677F")),
|
|
126
|
+
onOpenChange: onOpenChange
|
|
127
|
+
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
128
|
+
onClick: function onClick() {
|
|
129
|
+
return setPopoverShow(true);
|
|
130
|
+
},
|
|
131
|
+
type: "gengduocaozuo"
|
|
132
|
+
})), /*#__PURE__*/React.createElement(BizDialog, {
|
|
133
|
+
zIndex: 10001,
|
|
134
|
+
title: /*#__PURE__*/React.createElement("div", {
|
|
135
|
+
className: "event-invitation"
|
|
136
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
137
|
+
style: {
|
|
138
|
+
fontSize: 22.5,
|
|
139
|
+
color: '#FD9F41',
|
|
140
|
+
marginRight: 8.75
|
|
141
|
+
},
|
|
142
|
+
className: "zhuge icon-tishi1"
|
|
143
|
+
}), "\u63D0\u793A"),
|
|
144
|
+
open: dialogShow,
|
|
145
|
+
closable: true,
|
|
146
|
+
onOk: function onOk() {
|
|
147
|
+
setDialogShow(false);
|
|
148
|
+
delItem();
|
|
149
|
+
},
|
|
150
|
+
onCancel: function onCancel() {
|
|
151
|
+
setDialogShow(false);
|
|
152
|
+
}
|
|
153
|
+
}, "\u786E\u8BA4\u5220\u9664\u6307\u6807\u5417\uFF1F"));
|
|
154
|
+
};
|
|
155
|
+
export default PanelItem;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// @import '../../../style/base.less';
|
|
2
|
+
|
|
3
|
+
.change-panel-modal {
|
|
4
|
+
&-add-panel {
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
height: 32px;
|
|
8
|
+
color: #165dff;
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
.tianjia1 {
|
|
11
|
+
margin-right: 8px;
|
|
12
|
+
font-weight: 800;
|
|
13
|
+
font-size: 14px;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
&-empty-data {
|
|
17
|
+
text-align: center;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.modules-panel-item {
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
justify-content: space-between;
|
|
25
|
+
height: 32px;
|
|
26
|
+
padding: 0px 8px;
|
|
27
|
+
color: #021429;
|
|
28
|
+
line-height: 32px;
|
|
29
|
+
background: #fff;
|
|
30
|
+
border-radius: 8px;
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
&-popover {
|
|
33
|
+
.ant-popover-arrow {
|
|
34
|
+
display: none;
|
|
35
|
+
}
|
|
36
|
+
.ant-popover-content {
|
|
37
|
+
margin-top: -27px;
|
|
38
|
+
margin-left: 0;
|
|
39
|
+
}
|
|
40
|
+
.ant-popover-inner-content {
|
|
41
|
+
padding: 4px 0;
|
|
42
|
+
}
|
|
43
|
+
.text {
|
|
44
|
+
height: 32px;
|
|
45
|
+
margin: 0;
|
|
46
|
+
padding: 0 16px;
|
|
47
|
+
line-height: 32px;
|
|
48
|
+
cursor: pointer;
|
|
49
|
+
}
|
|
50
|
+
.delete {
|
|
51
|
+
// color: #fb5547;
|
|
52
|
+
}
|
|
53
|
+
.text:hover {
|
|
54
|
+
background: #e8efff;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
&-text {
|
|
58
|
+
width: 100%;
|
|
59
|
+
// .__text-cut-one();
|
|
60
|
+
}
|
|
61
|
+
.gengduocaozuo {
|
|
62
|
+
display: none;
|
|
63
|
+
margin-left: 8px;
|
|
64
|
+
font-size: 16px !important;
|
|
65
|
+
}
|
|
66
|
+
.ant-input {
|
|
67
|
+
box-shadow: none !important;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
.modules-panel-item:hover {
|
|
71
|
+
color: #165dff;
|
|
72
|
+
background: #e8efff;
|
|
73
|
+
.gengduocaozuo {
|
|
74
|
+
display: block;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
.modules-panel-item.active {
|
|
78
|
+
padding: 0 8px;
|
|
79
|
+
color: #fff;
|
|
80
|
+
line-height: 40px;
|
|
81
|
+
background: #165dff;
|
|
82
|
+
.gengduocaozuo {
|
|
83
|
+
display: block;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
.modules-panel-item.edit {
|
|
87
|
+
height: 40px;
|
|
88
|
+
padding: 0 8px;
|
|
89
|
+
color: rgba(103, 114, 127, 1);
|
|
90
|
+
line-height: 40px;
|
|
91
|
+
background: #e8efff;
|
|
92
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,7 +4,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
4
4
|
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; }
|
|
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
|
-
import { Input, message } from 'antd';
|
|
7
|
+
import { Input, message, Tooltip } from 'antd';
|
|
8
8
|
import React, { useImperativeHandle, useRef, useState } from 'react';
|
|
9
9
|
import './index.less';
|
|
10
10
|
import { IconFont } from '../../../..';
|
|
@@ -83,15 +83,24 @@ var BizEditText = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
83
83
|
required: props.required,
|
|
84
84
|
disabled: !props.canEdit,
|
|
85
85
|
autoFocus: !curTitle,
|
|
86
|
-
|
|
86
|
+
maxLength: props.max,
|
|
87
87
|
placeholder: "\u8BF7\u8F93\u5165".concat(props.name || ''),
|
|
88
88
|
onBlur: onBlur,
|
|
89
89
|
onChange: onChange
|
|
90
90
|
}), errorText ? /*#__PURE__*/React.createElement("span", {
|
|
91
91
|
className: "".concat(classPrefix, "-error-tip")
|
|
92
|
-
}, errorText) : null) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
}, errorText) : null) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Tooltip, {
|
|
93
|
+
placement: "bottom",
|
|
94
|
+
title: '单击此处重命名'
|
|
95
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
96
|
+
className: "".concat(classPrefix, "-content"),
|
|
97
|
+
onClick: function onClick() {
|
|
98
|
+
props.isOnlyTxt && setIsEdit(true);
|
|
99
|
+
setTimeout(function () {
|
|
100
|
+
inputRef && inputRef.current.focus();
|
|
101
|
+
}, 0);
|
|
102
|
+
}
|
|
103
|
+
}, props.value)), props.canEdit && !props.isOnlyTxt ? /*#__PURE__*/React.createElement(IconFont, {
|
|
95
104
|
className: "".concat(classPrefix, "-icon"),
|
|
96
105
|
type: "bianji1",
|
|
97
106
|
onClick: function onClick() {
|
|
@@ -1,36 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { IconFont } from '../..';
|
|
3
|
-
import { classPrefix } from '.';
|
|
4
1
|
export var panelBtn = function panelBtn(callback, disabled) {
|
|
5
2
|
return [{
|
|
6
|
-
key: '11',
|
|
7
|
-
label: /*#__PURE__*/React.createElement("a", {
|
|
8
|
-
className: "".concat(classPrefix, "-btn-more")
|
|
9
|
-
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
10
|
-
type: "gengduocaozuo1"
|
|
11
|
-
})),
|
|
12
|
-
itemType: 'dropdown',
|
|
13
|
-
type: 'default',
|
|
14
|
-
children: [{
|
|
15
|
-
key: '110',
|
|
16
|
-
label: '编辑名称',
|
|
17
|
-
icon: /*#__PURE__*/React.createElement(IconFont, {
|
|
18
|
-
type: "bianji"
|
|
19
|
-
}),
|
|
20
|
-
onClick: function onClick() {
|
|
21
|
-
callback('edit');
|
|
22
|
-
}
|
|
23
|
-
}, {
|
|
24
|
-
key: '111',
|
|
25
|
-
label: '删除指标',
|
|
26
|
-
icon: /*#__PURE__*/React.createElement(IconFont, {
|
|
27
|
-
type: "shanchu"
|
|
28
|
-
}),
|
|
29
|
-
onClick: function onClick() {
|
|
30
|
-
callback('delete');
|
|
31
|
-
}
|
|
32
|
-
}]
|
|
33
|
-
}, {
|
|
34
3
|
key: '12',
|
|
35
4
|
label: '',
|
|
36
5
|
itemType: 'divider'
|
|
@@ -101,6 +101,7 @@ var BizTargetFromPanel = function BizTargetFromPanel(props) {
|
|
|
101
101
|
callback(true, '');
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
|
+
props.afterEditTarget && props.afterEditTarget('renameItem');
|
|
104
105
|
callback();
|
|
105
106
|
}).catch(function () {
|
|
106
107
|
callback(true, '');
|
|
@@ -133,7 +134,9 @@ var BizTargetFromPanel = function BizTargetFromPanel(props) {
|
|
|
133
134
|
}
|
|
134
135
|
return /*#__PURE__*/React.createElement(BizTargetFromPanelContext.Provider, {
|
|
135
136
|
value: {
|
|
136
|
-
handleSearch: setBtnOptions
|
|
137
|
+
handleSearch: setBtnOptions,
|
|
138
|
+
afterEditTarget: props.afterEditTarget,
|
|
139
|
+
itemValue: props.value
|
|
137
140
|
}
|
|
138
141
|
}, /*#__PURE__*/React.createElement(Spin, {
|
|
139
142
|
spinning: loading,
|
|
@@ -148,7 +151,8 @@ var BizTargetFromPanel = function BizTargetFromPanel(props) {
|
|
|
148
151
|
canEdit: props.value.target.id ? true : false,
|
|
149
152
|
onBack: function onBack() {
|
|
150
153
|
return onClick(BizOptionTitleProps.OptionTypes.CANCEL);
|
|
151
|
-
}
|
|
154
|
+
},
|
|
155
|
+
max: 20
|
|
152
156
|
}, props === null || props === void 0 ? void 0 : props.children, showDialog && /*#__PURE__*/React.createElement(BizAddToPanel, {
|
|
153
157
|
defaultValue: {
|
|
154
158
|
panel: {
|
|
@@ -1,10 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
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."); }
|
|
3
|
+
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); }
|
|
4
|
+
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; }
|
|
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
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import React, { useState } from 'react';
|
|
2
8
|
import { IconFont } from '../..';
|
|
3
9
|
import BizEditText from './components/title';
|
|
10
|
+
import { Popover, Tooltip } from 'antd';
|
|
4
11
|
import './styles/layout.less';
|
|
5
12
|
import BizBtnMenu from './components/btnMenu';
|
|
13
|
+
import ChangePanelModal from './components/changePanelModal';
|
|
6
14
|
var BizOptionLayout = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
7
15
|
var className = props.className;
|
|
16
|
+
var _useState = useState(false),
|
|
17
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
18
|
+
show = _useState2[0],
|
|
19
|
+
setShow = _useState2[1];
|
|
8
20
|
var classPrefix = 'biz-option-layout';
|
|
9
21
|
return /*#__PURE__*/React.createElement("div", {
|
|
10
22
|
className: "".concat(classPrefix, " ").concat(className || '')
|
|
@@ -24,11 +36,31 @@ var BizOptionLayout = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
24
36
|
name: props.name,
|
|
25
37
|
value: props.value,
|
|
26
38
|
max: props.max,
|
|
27
|
-
|
|
39
|
+
isOnlyTxt: true,
|
|
28
40
|
canEdit: props.canEdit,
|
|
29
41
|
onChange: props.onChange,
|
|
30
42
|
onService: props.onService
|
|
31
|
-
})
|
|
43
|
+
}), props.canEdit && /*#__PURE__*/React.createElement(Popover, {
|
|
44
|
+
overlayClassName: "".concat(classPrefix, "-panel-content"),
|
|
45
|
+
arrowPointAtCenter: true,
|
|
46
|
+
open: show,
|
|
47
|
+
content: /*#__PURE__*/React.createElement(ChangePanelModal, null),
|
|
48
|
+
trigger: "click",
|
|
49
|
+
placement: "bottomLeft",
|
|
50
|
+
onOpenChange: function onOpenChange(show) {
|
|
51
|
+
return setShow(show);
|
|
52
|
+
}
|
|
53
|
+
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
54
|
+
placement: "bottom",
|
|
55
|
+
title: '切换指标'
|
|
56
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
57
|
+
className: "".concat(classPrefix, "-header-title-icon"),
|
|
58
|
+
onClick: function onClick() {
|
|
59
|
+
return setShow(true);
|
|
60
|
+
}
|
|
61
|
+
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
62
|
+
type: "xiangxia"
|
|
63
|
+
}))))), props.extra, /*#__PURE__*/React.createElement(BizBtnMenu, {
|
|
32
64
|
className: props.optionClass,
|
|
33
65
|
menu: props.options || []
|
|
34
66
|
})), props.children && /*#__PURE__*/React.createElement("div", {
|
|
@@ -26,6 +26,22 @@
|
|
|
26
26
|
color: @primary-color;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
+
&-icon {
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
width: 20px;
|
|
34
|
+
height: 20px;
|
|
35
|
+
margin-left: 8px;
|
|
36
|
+
color: #5f6085;
|
|
37
|
+
font-size: 12px;
|
|
38
|
+
background: #f2f3f4;
|
|
39
|
+
border-radius: 10px;
|
|
40
|
+
}
|
|
41
|
+
&-icon:hover {
|
|
42
|
+
color: #165dff;
|
|
43
|
+
background: #e8efff;
|
|
44
|
+
}
|
|
29
45
|
}
|
|
30
46
|
&-option {
|
|
31
47
|
display: flex;
|
|
@@ -41,4 +57,34 @@
|
|
|
41
57
|
height: calc(100% - 64px);
|
|
42
58
|
overflow: auto;
|
|
43
59
|
}
|
|
60
|
+
|
|
61
|
+
&-panel-content {
|
|
62
|
+
z-index: 1000;
|
|
63
|
+
width: 284px;
|
|
64
|
+
max-height: 304px;
|
|
65
|
+
padding: 0;
|
|
66
|
+
overflow: auto;
|
|
67
|
+
background: #fff;
|
|
68
|
+
border-radius: 10px;
|
|
69
|
+
box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.1);
|
|
70
|
+
.ant-popover-arrow {
|
|
71
|
+
display: none !important;
|
|
72
|
+
}
|
|
73
|
+
.ant-popover-inner-content {
|
|
74
|
+
width: 100%;
|
|
75
|
+
padding: 8px;
|
|
76
|
+
}
|
|
77
|
+
.ant-tabs {
|
|
78
|
+
.ant-tabs-tab-btn {
|
|
79
|
+
font-size: 16px;
|
|
80
|
+
}
|
|
81
|
+
.ant-tabs-nav {
|
|
82
|
+
margin-bottom: 4px;
|
|
83
|
+
padding-left: 45px;
|
|
84
|
+
}
|
|
85
|
+
.ant-tabs-nav::before {
|
|
86
|
+
border: none !important;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
44
90
|
}
|
|
@@ -51,6 +51,7 @@ export declare namespace BizOptionTitleProps {
|
|
|
51
51
|
value?: string;
|
|
52
52
|
max?: number;
|
|
53
53
|
isInput?: boolean;
|
|
54
|
+
isOnlyTxt?: boolean;
|
|
54
55
|
canEdit?: boolean;
|
|
55
56
|
required?: boolean;
|
|
56
57
|
width?: number;
|
|
@@ -85,4 +86,6 @@ export declare namespace BizOptionTitleProps {
|
|
|
85
86
|
}
|
|
86
87
|
export declare const BizTargetFromPanelContext: React.Context<{
|
|
87
88
|
handleSearch?: ((isSearch?: boolean) => void) | undefined;
|
|
89
|
+
afterEditTarget?: ((type: string, value?: any) => void) | undefined;
|
|
90
|
+
itemValue?: BizOptionTitleProps.Value | undefined;
|
|
88
91
|
}>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zgfe/business-lib",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.18",
|
|
4
4
|
"module": "es/index.js",
|
|
5
5
|
"typings": "es/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"react": "^16.12.0 || ^17.0.0",
|
|
56
56
|
"yorkie": "^2.0.0"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "67889cfce811f97b0115547fdf59ae02caf1bcaa",
|
|
59
59
|
"gitHooks": {
|
|
60
60
|
"pre-commit": "lint-staged"
|
|
61
61
|
}
|