@zgfe/business-lib 1.0.6 → 1.0.9

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.
@@ -19,12 +19,17 @@ var RightContent = function RightContent() {
19
19
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h1", null, "right"));
20
20
  };
21
21
 
22
+ var onCollapse = function onCollapse(flag) {
23
+ console.log('是否收起', flag);
24
+ };
25
+
22
26
  var LayoutDemo = function LayoutDemo() {
23
27
  return /*#__PURE__*/React.createElement("div", {
24
28
  className: "root"
25
29
  }, /*#__PURE__*/React.createElement(BizAnalysisLayout, {
26
30
  leftPanel: /*#__PURE__*/React.createElement(LeftContent, null),
27
- leftHandle: /*#__PURE__*/React.createElement(Footer, null)
31
+ leftHandle: /*#__PURE__*/React.createElement(Footer, null),
32
+ onCollapse: onCollapse
28
33
  }, /*#__PURE__*/React.createElement(RightContent, null)));
29
34
  };
30
35
 
@@ -9,6 +9,7 @@ declare type AnalysisLayoutProps = {
9
9
  defaultLeftWidth?: number;
10
10
  minWidthOfLeft?: number;
11
11
  maxWidthOfLeft?: number;
12
+ onCollapse?: (flag: boolean) => void;
12
13
  };
13
14
  declare const BizAnalysisLayout: React.FC<AnalysisLayoutProps>;
14
15
  export default BizAnalysisLayout;
@@ -77,6 +77,7 @@ var BizAnalysisLayout = function BizAnalysisLayout(props) {
77
77
  };
78
78
 
79
79
  function onCollapse() {
80
+ if (props.onCollapse) props.onCollapse(showLeft);
80
81
  setShowLeft(function (show) {
81
82
  setWidth(show ? 56 : minWidthOfLeft);
82
83
  return !show;
@@ -42,7 +42,7 @@
42
42
  border-radius: @border-radius-normal;
43
43
  .__default-overflow();
44
44
 
45
- &:hover {
45
+ &:not(.disabled, .active):hover {
46
46
  .__default-hover();
47
47
  }
48
48
 
@@ -51,7 +51,7 @@
51
51
  background: @primary-color;
52
52
  }
53
53
 
54
- &.disabled {
54
+ &:not(.active).disabled {
55
55
  color: @disabled-color;
56
56
  cursor: not-allowed;
57
57
 
@@ -84,7 +84,8 @@ var StringList = function StringList(props) {
84
84
  platform: currentApp === null || currentApp === void 0 ? void 0 : currentApp.platform,
85
85
  limit: 10000,
86
86
  attr: (attrData === null || attrData === void 0 ? void 0 : attrData.propCategory) === PropCategory.EventProp ? attrData.id : 0,
87
- dimension_sub: (attrData === null || attrData === void 0 ? void 0 : attrData.propCategory) === PropCategory.EventProp ? 'event_attr' : attrData === null || attrData === void 0 ? void 0 : attrData.name
87
+ dimension_sub: (attrData === null || attrData === void 0 ? void 0 : attrData.propCategory) === PropCategory.EventProp ? 'event_attr' : attrData === null || attrData === void 0 ? void 0 : attrData.name,
88
+ v: ''
88
89
  };
89
90
 
90
91
  transformRequest = function transformRequest(params) {
@@ -19,7 +19,7 @@ import { Button } from 'antd';
19
19
  var conditions = [{
20
20
  propCategory: 'userProp',
21
21
  type: 2,
22
- operation: 'gt',
22
+ operator: 'gt',
23
23
  values: ['25200', '1'],
24
24
  attrName: 'duration',
25
25
  category: 'fixed',
@@ -27,7 +27,7 @@ var conditions = [{
27
27
  }, {
28
28
  propCategory: 'eventProp',
29
29
  type: 1,
30
- operation: 'equal',
30
+ operator: 'equal',
31
31
  values: ['Safari', 'Apple WebKit'],
32
32
  attrId: 30183426
33
33
  }];
@@ -25,7 +25,7 @@ export default (function () {
25
25
  condition: {
26
26
  propCategory: 'userProp',
27
27
  type: 2,
28
- operation: 'lt',
28
+ operator: 'lt',
29
29
  values: ['25200', '1'],
30
30
  subtype: 2,
31
31
  attrName: 'duration',
@@ -35,7 +35,7 @@ var BizConditionItem = function BizConditionItem(props) {
35
35
  attr = _useState2[0],
36
36
  setAttr = _useState2[1];
37
37
 
38
- var _useState3 = useState(((_props$defaultValue = props.defaultValue) === null || _props$defaultValue === void 0 ? void 0 : _props$defaultValue.operation) || ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.operation)),
38
+ var _useState3 = useState(((_props$defaultValue = props.defaultValue) === null || _props$defaultValue === void 0 ? void 0 : _props$defaultValue.operator) || ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.operator)),
39
39
  _useState4 = _slicedToArray(_useState3, 2),
40
40
  operate = _useState4[0],
41
41
  setOperate = _useState4[1];
@@ -94,7 +94,7 @@ var BizConditionItem = function BizConditionItem(props) {
94
94
  var responseData = {
95
95
  propCategory: attr.propCategory,
96
96
  type: attr.type,
97
- operation: operate,
97
+ operator: operate,
98
98
  values: values || []
99
99
  };
100
100
 
@@ -15,7 +15,7 @@ export declare namespace AttrConditionTypes {
15
15
  type?: PropType;
16
16
  propCategory?: 'userProp' | 'eventProp' | 'envProp';
17
17
  category?: 'fixed' | 'custom';
18
- operation?: string;
18
+ operator?: string;
19
19
  values?: string[];
20
20
  }
21
21
  interface GroupValue {
@@ -51,7 +51,7 @@ export default (function () {
51
51
  enableDelete: true,
52
52
  disableItemList: [{
53
53
  propCategory: 'eventProp',
54
- id: 30183424
54
+ id: 30183426
55
55
  }, {
56
56
  name: 'is_anonymous',
57
57
  propCategory: 'userProp'
@@ -16,7 +16,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
16
16
 
17
17
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
18
18
 
19
- import React, { useContext, useEffect, useState } from 'react';
19
+ import React, { useContext, useEffect, useRef, useState } from 'react';
20
20
  import './styles/index.less';
21
21
  import { Dropdown, Tooltip } from 'antd';
22
22
  import AttrListPanel from './listPanel';
@@ -49,7 +49,15 @@ var BizAttributeSelector = function BizAttributeSelector(props) {
49
49
  userPropList = _useContext.userPropList,
50
50
  eventEnvList = _useContext.eventEnvList;
51
51
 
52
+ var boxRef = useRef(null);
53
+
54
+ var _useState7 = useState(200),
55
+ _useState8 = _slicedToArray(_useState7, 2),
56
+ width = _useState8[0],
57
+ setWidth = _useState8[1];
58
+
52
59
  useEffect(function () {
60
+ setWidth(boxRef.current.width || 284);
53
61
  if (!props.defaultValue) return;
54
62
  setCurrentAttr(getValue(props.defaultValue));
55
63
  }, []);
@@ -108,7 +116,8 @@ var BizAttributeSelector = function BizAttributeSelector(props) {
108
116
  })),
109
117
  trigger: ['click'],
110
118
  overlayStyle: {
111
- minWidth: 0
119
+ minWidth: 284,
120
+ width: width
112
121
  },
113
122
  visible: visible,
114
123
  onVisibleChange: onVisibleChange
@@ -117,6 +126,7 @@ var BizAttributeSelector = function BizAttributeSelector(props) {
117
126
  width: '100%'
118
127
  }
119
128
  }, /*#__PURE__*/React.createElement(SelectHandle, {
129
+ ref: boxRef,
120
130
  theme: "secondary",
121
131
  border: false,
122
132
  label: currentAttr === null || currentAttr === void 0 ? void 0 : currentAttr.label,
@@ -20,7 +20,6 @@
20
20
  }
21
21
  }
22
22
  &-drowdown {
23
- width: 284px;
24
23
  .__select-panel();
25
24
  &.nodata {
26
25
  .__select-nodata();
@@ -1,10 +1,42 @@
1
- import React from 'react';
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+
3
+ 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."); }
4
+
5
+ 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); }
6
+
7
+ 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; }
8
+
9
+ 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; }
10
+
11
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
+
13
+ import React, { useRef, useState } from 'react';
2
14
  import { BizChart } from '@zgfe/business-lib';
3
15
  import chartData from './data/data';
16
+ import { Button, Image } from 'antd';
4
17
  export default (function () {
5
- return /*#__PURE__*/React.createElement(BizChart, {
18
+ var chartRef = useRef();
19
+
20
+ var _useState = useState(),
21
+ _useState2 = _slicedToArray(_useState, 2),
22
+ chartImg = _useState2[0],
23
+ setChartImg = _useState2[1];
24
+
25
+ var onClick = function onClick() {
26
+ var url = chartRef.current.instance.getDataURL();
27
+ setChartImg(url);
28
+ };
29
+
30
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(BizChart, {
6
31
  data: chartData,
7
32
  type: "line",
8
- legendPosition: "bottom"
9
- });
33
+ legendPosition: "bottom",
34
+ ref: chartRef
35
+ }), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Button, {
36
+ onClick: onClick
37
+ }, "\u83B7\u53D6\u56FE\u8868\u56FE\u7247"), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Image, {
38
+ src: chartImg,
39
+ width: "100%",
40
+ height: 300
41
+ }));
10
42
  });
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import './util/data/china.js';
3
3
  import { ChartTypes } from './types';
4
- declare const BizChart: React.FC<ChartTypes.Props>;
4
+ declare const BizChart: React.ForwardRefExoticComponent<ChartTypes.Props & React.RefAttributes<any>>;
5
5
  export default BizChart;
package/es/chart/index.js CHANGED
@@ -16,15 +16,14 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
16
16
 
17
17
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
18
18
 
19
- import React, { useEffect, useState } from 'react';
19
+ import React, { useEffect, useImperativeHandle, useState } from 'react';
20
20
  import ReactEChartsCore from 'echarts-for-react/lib/core';
21
21
  import * as echarts from 'echarts';
22
22
  import { getChartOption, getPieOption, getMapOption } from './util/chartOptionConfig';
23
23
  import { provinceSeries, citySeries, maxMinValue } from './util/mapUtil';
24
24
  import { formatPieData, formatChartData } from './util/formatData';
25
25
  import './util/data/china.js';
26
-
27
- var BizChart = function BizChart(props) {
26
+ var BizChart = /*#__PURE__*/React.forwardRef(function (props, ref) {
28
27
  var type = props.type,
29
28
  data = props.data,
30
29
  showList = props.showList,
@@ -50,6 +49,11 @@ var BizChart = function BizChart(props) {
50
49
  chartOption = _useState2[0],
51
50
  setChartOption = _useState2[1];
52
51
 
52
+ var _useState3 = useState(),
53
+ _useState4 = _slicedToArray(_useState3, 2),
54
+ instance = _useState4[0],
55
+ setInstance = _useState4[1];
56
+
53
57
  useEffect(function () {
54
58
  if (option) {
55
59
  setChartOption(function () {
@@ -82,7 +86,15 @@ var BizChart = function BizChart(props) {
82
86
  return _objectSpread({}, eOption);
83
87
  });
84
88
  }, [data, showAll, showList, reverseXAxis]);
89
+ useImperativeHandle(ref, function () {
90
+ return {
91
+ instance: instance
92
+ };
93
+ });
85
94
  return /*#__PURE__*/React.createElement(ReactEChartsCore, {
95
+ ref: function ref(e) {
96
+ setInstance(e === null || e === void 0 ? void 0 : e.getEchartsInstance());
97
+ },
86
98
  echarts: echarts,
87
99
  option: chartOption,
88
100
  notMerge: true,
@@ -92,8 +104,7 @@ var BizChart = function BizChart(props) {
92
104
  width: '100%'
93
105
  }
94
106
  });
95
- };
96
-
107
+ });
97
108
  BizChart.defaultProps = {
98
109
  showAll: false,
99
110
  reverseXAxis: false,
@@ -35,6 +35,7 @@ var BizTab = function BizTab(props) {
35
35
  }, /*#__PURE__*/React.createElement(Space, null, (_data$children = data.children) === null || _data$children === void 0 ? void 0 : _data$children.map(function (item) {
36
36
  return /*#__PURE__*/React.createElement(Radio, {
37
37
  key: item.value,
38
+ disabled: item.disabled,
38
39
  value: item.value,
39
40
  onClick: function onClick() {
40
41
  return onChange(data, item);
@@ -14,11 +14,17 @@ export declare const chartTypes: ({
14
14
  label: string;
15
15
  value: string;
16
16
  icon: string;
17
- children: {
17
+ children: ({
18
18
  label: string;
19
19
  value: string;
20
20
  icon: string;
21
- }[];
21
+ disabled?: undefined;
22
+ } | {
23
+ label: string;
24
+ value: string;
25
+ icon: string;
26
+ disabled: boolean;
27
+ })[];
22
28
  disabled?: undefined;
23
29
  })[];
24
30
  declare const _default: () => JSX.Element;
@@ -53,7 +53,8 @@ export var chartTypes = [{
53
53
  }, {
54
54
  label: '汇总图',
55
55
  value: 'bar',
56
- icon: 'huizongtu'
56
+ icon: 'huizongtu',
57
+ disabled: true
57
58
  }]
58
59
  }, {
59
60
  label: '分数',
@@ -1,4 +1,4 @@
1
- var _excluded = ["overlayWidth", "labelField", "keyField"];
1
+ var _excluded = ["overlayWidth", "minDropdownWidth", "labelField", "keyField"];
2
2
 
3
3
  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; }
4
4
 
@@ -32,6 +32,7 @@ export var classPrefix = 'biz-select';
32
32
 
33
33
  var BizSelect = function BizSelect(props) {
34
34
  var overlayWidth = props.overlayWidth,
35
+ minDropdownWidth = props.minDropdownWidth,
35
36
  labelField = props.labelField,
36
37
  keyField = props.keyField,
37
38
  res = _objectWithoutProperties(props, _excluded);
@@ -175,7 +176,7 @@ var BizSelect = function BizSelect(props) {
175
176
  disabled: props.disable,
176
177
  destroyPopupOnHide: true,
177
178
  overlayStyle: {
178
- minWidth: 0,
179
+ minWidth: minDropdownWidth || 0,
179
180
  width: overlayWidth || width
180
181
  },
181
182
  trigger: ['click'],
@@ -82,7 +82,7 @@ var SelectOverlay = function SelectOverlay(props) {
82
82
  list = getOptionDom(options, ids);
83
83
  }
84
84
 
85
- if (!list.flat().length) {
85
+ if (options.length && !list.flat().length) {
86
86
  var dom = /*#__PURE__*/React.createElement("div", {
87
87
  className: "".concat(classPrefix, "-notfound"),
88
88
  key: "notfound"
@@ -18,6 +18,7 @@ export declare namespace BizSelectTypes {
18
18
  size?: 'lg' | 'base' | 'sm';
19
19
  border?: boolean;
20
20
  multiple?: boolean;
21
+ minDropdownWidth?: number;
21
22
  options: Group[] | Option[];
22
23
  extra?: (option: Option) => ReactNode;
23
24
  dropdownExtra?: ReactNode;
@@ -26,7 +26,7 @@ var defaultValue = {
26
26
  conditions: [{
27
27
  propCategory: 'eventProp',
28
28
  type: 1,
29
- operation: 'equal',
29
+ operator: 'equal',
30
30
  values: ['Safari'],
31
31
  attrId: 30183430
32
32
  }]
@@ -89,7 +89,7 @@ var PropCondition = function PropCondition(props) {
89
89
  attrId = data.attrId,
90
90
  category = data.category,
91
91
  type = data.type,
92
- operation = data.operation,
92
+ operator = data.operator,
93
93
  values = data.values;
94
94
 
95
95
  var newAttrs = _toConsumableArray(attrs);
@@ -98,7 +98,7 @@ var PropCondition = function PropCondition(props) {
98
98
  attrName: attrName,
99
99
  attrId: attrId,
100
100
  category: category,
101
- operator: transformNumberOperate(operation),
101
+ operator: transformNumberOperate(operator),
102
102
  params: values,
103
103
  attrType: numAttrTypeMap[type]
104
104
  };
@@ -148,7 +148,7 @@ var PropCondition = function PropCondition(props) {
148
148
  props.defaultValue = {
149
149
  attrName: attrName,
150
150
  category: category || 'custom',
151
- operation: operator,
151
+ operator: operator,
152
152
  values: params || [],
153
153
  propCategory: getPropCategory(attrName),
154
154
  type: attrNumTypeMap[attrType]
@@ -44,7 +44,10 @@ var UserGroupDemo = function UserGroupDemo() {
44
44
  };
45
45
 
46
46
  return /*#__PURE__*/React.createElement("div", {
47
- className: "biz-user-group-demo"
47
+ className: "biz-user-group-demo",
48
+ style: {
49
+ width: '200px'
50
+ }
48
51
  }, /*#__PURE__*/React.createElement(BizUserGroup, {
49
52
  options: groupOptions,
50
53
  onChange: handleChange,
@@ -68,7 +68,7 @@ var BizUserGroup = function BizUserGroup(props) {
68
68
  border: false,
69
69
  disableItemList: props.disableItemList,
70
70
  onChange: onChange,
71
- overlayWidth: 284
71
+ minDropdownWidth: 284
72
72
  }), /*#__PURE__*/React.createElement(BizTargetOptionIcon, {
73
73
  name: "delete",
74
74
  icon: "qingchu",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/business-lib",
3
- "version": "1.0.6",
3
+ "version": "1.0.9",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -58,5 +58,5 @@
58
58
  "prettier": "^2.2.1",
59
59
  "yorkie": "^2.0.0"
60
60
  },
61
- "gitHead": "8d58fc9b49900c5dd30764910afe0846a0866a9e"
61
+ "gitHead": "745412d17d39bb923c36a927fe6735afbd77b384"
62
62
  }