@zgfe/business-lib 1.2.50-alpha.1 → 1.2.50-alpha.2

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,6 @@
1
+ import React from 'react';
2
+ declare const WholeChart: React.FC<{
3
+ options?: any[];
4
+ onChange?: (value: any) => void;
5
+ }>;
6
+ export default WholeChart;
@@ -0,0 +1,41 @@
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
+ setPptionList(options);
22
+ }, [options]);
23
+ useEffect(function () {
24
+ var _value = [];
25
+ optionList.map(function (item) {
26
+ if (item.select) _value.push(item.value);
27
+ });
28
+ setValue(_value);
29
+ onChange && onChange(_value);
30
+ }, [optionList]);
31
+ var onOptionChange = function onOptionChange(option) {
32
+ setValue(option);
33
+ onChange && onChange(option);
34
+ };
35
+ return /*#__PURE__*/React.createElement(Checkbox.Group, {
36
+ options: optionList,
37
+ value: value,
38
+ onChange: onOptionChange
39
+ });
40
+ };
41
+ export default WholeChart;
@@ -24,6 +24,7 @@ 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) {
29
30
  var refForm = useRef();
@@ -170,7 +171,7 @@ var BizAddToPanel = function BizAddToPanel(props) {
170
171
  }
171
172
  var showBox = function showBox(type, module) {
172
173
  if (module && ['duration_avg', 'active', 'add', 'duration'].includes(module)) {
173
- var _props$params;
174
+ var _props$styleOptions, _props$styleOptions$f, _props$params;
174
175
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Form.Item, {
175
176
  label: "\u663E\u793A",
176
177
  name: "extendTarget",
@@ -179,10 +180,12 @@ var BizAddToPanel = function BizAddToPanel(props) {
179
180
  required: true,
180
181
  message: '请选择显示'
181
182
  }]
182
- }, /*#__PURE__*/React.createElement(NumberChart, {
183
- options: props.styleOptions
183
+ }, /*#__PURE__*/React.createElement(WholeChart, {
184
+ options: (_props$styleOptions = props.styleOptions) === null || _props$styleOptions === void 0 ? void 0 : (_props$styleOptions$f = _props$styleOptions.find(function (item) {
185
+ return item.value == type;
186
+ })) === null || _props$styleOptions$f === void 0 ? void 0 : _props$styleOptions$f.optionList
184
187
  })), ((_props$params = props.params) === null || _props$params === void 0 ? void 0 : _props$params.dimension) && /*#__PURE__*/React.createElement(Form.Item, {
185
- label: "\u663E\u793A",
188
+ label: "",
186
189
  name: "showList",
187
190
  colon: false,
188
191
  rules: [{
@@ -51,6 +51,7 @@ declare namespace AddToPanel {
51
51
  }
52
52
  export interface TabItem extends TabItemChild {
53
53
  children?: Array<TabItemChild>;
54
+ optionList?: any[];
54
55
  }
55
56
  export {};
56
57
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/business-lib",
3
- "version": "1.2.50-alpha.1",
3
+ "version": "1.2.50-alpha.2",
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": "b68d2087298efade0f391fba51977ac4df0f148d",
58
+ "gitHead": "5a731ce235a78d7bfb68f1bb17d7f37ffa1275b4",
59
59
  "gitHooks": {
60
60
  "pre-commit": "lint-staged"
61
61
  }