@zgfe/business-lib 1.2.50-alpha.0 → 1.2.50-alpha.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.
|
@@ -0,0 +1,45 @@
|
|
|
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 { Checkbox } from 'antd';
|
|
8
|
+
import React, { useState, useEffect } from 'react';
|
|
9
|
+
var WholeChart = function WholeChart(props) {
|
|
10
|
+
var options = props.options,
|
|
11
|
+
onChange = props.onChange;
|
|
12
|
+
var _useState = useState([]),
|
|
13
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
14
|
+
optionList = _useState2[0],
|
|
15
|
+
setPptionList = _useState2[1];
|
|
16
|
+
var _useState3 = useState([]),
|
|
17
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
18
|
+
value = _useState4[0],
|
|
19
|
+
setValue = _useState4[1];
|
|
20
|
+
useEffect(function () {
|
|
21
|
+
if (options) {
|
|
22
|
+
setPptionList(options);
|
|
23
|
+
} else {
|
|
24
|
+
setPptionList([]);
|
|
25
|
+
}
|
|
26
|
+
}, [options]);
|
|
27
|
+
useEffect(function () {
|
|
28
|
+
var _value = [];
|
|
29
|
+
optionList.map(function (item) {
|
|
30
|
+
if (item.select) _value.push(item.value);
|
|
31
|
+
});
|
|
32
|
+
setValue(_value);
|
|
33
|
+
onChange && onChange(_value);
|
|
34
|
+
}, [optionList]);
|
|
35
|
+
var onOptionChange = function onOptionChange(option) {
|
|
36
|
+
setValue(option);
|
|
37
|
+
onChange && onChange(option);
|
|
38
|
+
};
|
|
39
|
+
return /*#__PURE__*/React.createElement(Checkbox.Group, {
|
|
40
|
+
options: optionList,
|
|
41
|
+
value: value,
|
|
42
|
+
onChange: onOptionChange
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
export default WholeChart;
|
package/es/addToPanel/index.js
CHANGED
|
@@ -24,8 +24,10 @@ import request from '../utils/ajax';
|
|
|
24
24
|
import Apis from '../constants/apis';
|
|
25
25
|
import BizGlobalDataContext from '../context';
|
|
26
26
|
import _ from 'lodash';
|
|
27
|
+
import WholeChart from './components/wholeChart';
|
|
27
28
|
export var classPrefix = 'biz-addtopanel';
|
|
28
29
|
var BizAddToPanel = function BizAddToPanel(props) {
|
|
30
|
+
var _props$params2;
|
|
29
31
|
var refForm = useRef();
|
|
30
32
|
var _useState = useState(false),
|
|
31
33
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -169,20 +171,23 @@ var BizAddToPanel = function BizAddToPanel(props) {
|
|
|
169
171
|
});
|
|
170
172
|
}
|
|
171
173
|
var showBox = function showBox(type, module) {
|
|
172
|
-
if (module &&
|
|
173
|
-
var _props$params;
|
|
174
|
+
if (module && ['duration_avg', 'active', 'add', 'duration'].includes(module)) {
|
|
175
|
+
var _props$styleOptions, _props$styleOptions$f, _props$params;
|
|
176
|
+
var options = (_props$styleOptions = props.styleOptions) === null || _props$styleOptions === void 0 ? void 0 : (_props$styleOptions$f = _props$styleOptions.find(function (item) {
|
|
177
|
+
return RegExp(item.value, 'g').test(type);
|
|
178
|
+
})) === null || _props$styleOptions$f === void 0 ? void 0 : _props$styleOptions$f.optionList;
|
|
174
179
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Form.Item, {
|
|
175
|
-
label: "\
|
|
180
|
+
label: "\u9644\u52A0",
|
|
176
181
|
name: "extendTarget",
|
|
177
182
|
colon: false,
|
|
178
183
|
rules: [{
|
|
179
184
|
required: true,
|
|
180
185
|
message: '请选择显示'
|
|
181
186
|
}]
|
|
182
|
-
}, /*#__PURE__*/React.createElement(
|
|
183
|
-
options:
|
|
184
|
-
})), ((_props$params = props.params) === null || _props$params === void 0 ? void 0 : _props$params.dimension) && /*#__PURE__*/React.createElement(Form.Item, {
|
|
185
|
-
label: "\
|
|
187
|
+
}, /*#__PURE__*/React.createElement(WholeChart, {
|
|
188
|
+
options: options
|
|
189
|
+
})), ((_props$params = props.params) === null || _props$params === void 0 ? void 0 : _props$params.dimension) && !RegExp('grid|map', 'g').test(type) && /*#__PURE__*/React.createElement(Form.Item, {
|
|
190
|
+
label: "\xA0\xA0\xA0\xA0\xA0\xA0",
|
|
186
191
|
name: "showList",
|
|
187
192
|
colon: false,
|
|
188
193
|
rules: [{
|
|
@@ -236,7 +241,10 @@ var BizAddToPanel = function BizAddToPanel(props) {
|
|
|
236
241
|
}, /*#__PURE__*/React.createElement(Form, {
|
|
237
242
|
ref: refForm,
|
|
238
243
|
onFinish: onSubmit,
|
|
239
|
-
initialValues: props.
|
|
244
|
+
initialValues: Object.assign(['duration_avg', 'active', 'add', 'duration'].includes((_props$params2 = props.params) === null || _props$params2 === void 0 ? void 0 : _props$params2.module) ? {
|
|
245
|
+
showList: 'dynamic',
|
|
246
|
+
chartType: 'line'
|
|
247
|
+
} : {}, props.defaultValue),
|
|
240
248
|
requiredMark: false
|
|
241
249
|
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
242
250
|
label: "\u770B\u677F",
|
|
@@ -304,10 +312,10 @@ var BizAddToPanel = function BizAddToPanel(props) {
|
|
|
304
312
|
noStyle: true,
|
|
305
313
|
shouldUpdate: true
|
|
306
314
|
}, function (_ref) {
|
|
307
|
-
var _props$
|
|
315
|
+
var _props$params3;
|
|
308
316
|
var getFieldValue = _ref.getFieldValue;
|
|
309
317
|
var type = getFieldValue('chartType');
|
|
310
|
-
return showBox(type, (_props$
|
|
318
|
+
return showBox(type, (_props$params3 = props.params) === null || _props$params3 === void 0 ? void 0 : _props$params3.module);
|
|
311
319
|
})));
|
|
312
320
|
};
|
|
313
321
|
BizAddToPanel.defaultProps = {
|
package/es/addToPanel/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zgfe/business-lib",
|
|
3
|
-
"version": "1.2.50-alpha.
|
|
3
|
+
"version": "1.2.50-alpha.10",
|
|
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": "d037a476c8853f407e0eef5c1f1ca8ba301746c0",
|
|
59
59
|
"gitHooks": {
|
|
60
60
|
"pre-commit": "lint-staged"
|
|
61
61
|
}
|