@zgfe/modules-event 1.0.4 → 1.0.5-bug.1

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.
File without changes
@@ -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 { Empty } from 'antd';
8
- import React, { useState, useContext } from 'react';
8
+ import React, { useState, useContext, useEffect } from 'react';
9
9
  import { BizLoading } from '@zgfe/business-lib';
10
10
  import { EventContext } from '../../types';
11
11
  import './styles/index.less';
@@ -21,6 +21,9 @@ var ContentPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
21
21
  _useState2 = _slicedToArray(_useState, 2),
22
22
  showList = _useState2[0],
23
23
  setShowList = _useState2[1];
24
+ useEffect(function () {
25
+ setShowList(props.showList);
26
+ }, [eventData]);
24
27
  var onChangeShow = function onChangeShow(names) {
25
28
  setShowList(names);
26
29
  if (props.onChangeShow) props.onChangeShow(names);
@@ -1 +1 @@
1
- export var chartColors = ['#165DFF', '#80E1D9', '#65789B', '#F8BC3B', '#6F66ED', '#66AFED', '#9661BC', '#FF7557', '#4DB273', '#F08BB4', '#CDDBFD', '#CDF3F0', '#CED4DE', '#FCE7B9', '#D1CEFD', '#D3E7F9', '#DFCFEA', '#FFD1C7', '#BBDEC8', '#FFE0ED'];
1
+ export var chartColors = ['#457DFF', '#80E1D9', '#65789B', '#F8BC3B', '#6F66ED', '#66AFED', '#9661BC', '#FF7557', '#4DB273', '#F08BB4', '#CDDBFD', '#CDF3F0', '#CED4DE', '#FCE7B9', '#D1CEFD', '#D3E7F9', '#DFCFEA', '#FFD1C7', '#BBDEC8', '#FFE0ED'];
@@ -73,13 +73,17 @@ var EventContent = function EventContent(props) {
73
73
  _useState14 = _slicedToArray(_useState13, 2),
74
74
  subDisplay = _useState14[0],
75
75
  setSubDisplay = _useState14[1];
76
- var _useState15 = useState({
76
+ var _useState15 = useState(true),
77
+ _useState16 = _slicedToArray(_useState15, 2),
78
+ isFirst = _useState16[0],
79
+ setIsFirst = _useState16[1];
80
+ var _useState17 = useState({
77
81
  analysisIndex: ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.analysisIndex) || 'number',
78
82
  analysisAttr: (_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.analysisAttr
79
83
  }),
80
- _useState16 = _slicedToArray(_useState15, 2),
81
- dimension = _useState16[0],
82
- setDimension = _useState16[1];
84
+ _useState18 = _slicedToArray(_useState17, 2),
85
+ dimension = _useState18[0],
86
+ setDimension = _useState18[1];
83
87
  useEffect(function () {
84
88
  if (timer) clearTimeout(timer);
85
89
  var flag = true;
@@ -133,22 +137,27 @@ var EventContent = function EventContent(props) {
133
137
  cancel = c;
134
138
  })
135
139
  }).then(function (res) {
136
- var _searchData$userGroup;
140
+ var _searchData$userGroup, _props$show;
137
141
  if (!res) {
138
142
  setLoading(false);
139
143
  return;
140
144
  }
141
145
  var result = res.data;
142
146
  var _data = searchData.dimension ? result : getChartDataEventAliasName(result, eventGroupList);
143
- setShowList(_data ? getDefaultShow(_data) : []);
144
147
  if (['bar', 'pie', 'map'].indexOf(searchData.chartType) !== -1) {
145
148
  _data = getSortData(_data);
146
149
  }
147
150
  if (searchData && (searchData === null || searchData === void 0 ? void 0 : searchData.userGroup) && (searchData === null || searchData === void 0 ? void 0 : (_searchData$userGroup = searchData.userGroup) === null || _searchData$userGroup === void 0 ? void 0 : _searchData$userGroup.length) > 1) {
148
- setEventData(getUserGroupsCompareData(_data));
151
+ _data = getUserGroupsCompareData(_data);
152
+ }
153
+ if (isFirst && ((_props$show = props.show) === null || _props$show === void 0 ? void 0 : _props$show.length)) {
154
+ setIsFirst(false);
149
155
  } else {
150
- setEventData(_data);
156
+ var list = _data ? getDefaultShow(_data) : [];
157
+ setShowList(list);
158
+ props.onChangeShow && props.onChangeShow(list);
151
159
  }
160
+ setEventData(_data);
152
161
  setFinalSearchData(_objectSpread({}, searchData));
153
162
  onChangeUrlParam(searchData);
154
163
  setTimeout(function () {
@@ -169,6 +178,7 @@ var EventContent = function EventContent(props) {
169
178
  };
170
179
  var onChangeShow = function onChangeShow(data) {
171
180
  setShowList(data);
181
+ props.onChangeShow && props.onChangeShow(data);
172
182
  };
173
183
  var platformChange = function platformChange(data) {
174
184
  ajaxFlag = true;
@@ -6,5 +6,6 @@ export declare namespace EventContentProps {
6
6
  show?: string[];
7
7
  onSearching?: (flag: boolean) => void;
8
8
  initSearch?: () => void;
9
+ onChangeShow?: (data: string[]) => void;
9
10
  }
10
11
  }
@@ -10,59 +10,25 @@ import { ModuleEvent } from '../../../index';
10
10
  import { requestConfig } from '../../../utils/ajaxConfig';
11
11
  import { Button } from 'antd';
12
12
  var defaultValue = {
13
- enlarged: 0,
14
- id: 247329,
15
- isPerfect: 1,
16
- name: '事件分析-饼图和表格',
13
+ panelId: 402605,
14
+ id: 249641,
15
+ name: '事件',
17
16
  data: {
18
- appId: 461,
19
- platform: 0,
17
+ app_id: 502391,
20
18
  module: 'event',
19
+ appId: 502391,
20
+ platform: 0,
21
21
  userGroup: [0],
22
22
  time: {
23
- begin: '2023-10-13',
24
- end: '2023-10-20',
25
- relative: [7, 0],
23
+ begin: '2023-12-12',
24
+ end: '2024-01-11',
25
+ relative: [30, 0],
26
26
  unit: 'day'
27
27
  },
28
- chartType: 'pie,grid',
29
- dimension: {
30
- propCategory: 'userProp',
31
- category: 'fixed',
32
- value: 'current_area',
33
- id: 0
34
- },
35
- id: 24292408,
36
- name: '免费注册-点击选择职位',
28
+ chartType: 'line',
37
29
  analysisIndex: 'number'
38
30
  },
39
- reqParam: {
40
- data: {
41
- appId: 461,
42
- platform: 0,
43
- module: 'event',
44
- userGroup: [0],
45
- time: {
46
- begin: '2023-10-13',
47
- end: '2023-10-20',
48
- relative: [7, 0],
49
- unit: 'day'
50
- },
51
- chartType: 'pie,grid',
52
- dimension: {
53
- propCategory: 'userProp',
54
- category: 'fixed',
55
- value: 'current_area',
56
- id: 0
57
- },
58
- id: 24292408,
59
- name: '免费注册-点击选择职位',
60
- analysisIndex: 'number'
61
- },
62
- chosen_data: []
63
- },
64
- type: 0,
65
- unExistEvent: ''
31
+ chosen_data: ['订单支付页-支付订单', '订单详情页-查看订单', '收入']
66
32
  };
67
33
  export default (function () {
68
34
  var _useState = useState(false),
@@ -94,7 +60,7 @@ export default (function () {
94
60
  };
95
61
  return /*#__PURE__*/React.createElement(DemoWrapper, {
96
62
  needMeta: true,
97
- defaultApp: 461
63
+ defaultApp: 502391
98
64
  }, isDetail ? /*#__PURE__*/React.createElement("div", null, JSON.stringify(detailParams), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Button, {
99
65
  onClick: function onClick() {
100
66
  return setIsDetail(false);
@@ -127,7 +127,8 @@ var ModuleEvent = function ModuleEvent(props) {
127
127
  params: _objectSpread({
128
128
  app_id: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
129
129
  module: 'event'
130
- }, searchData)
130
+ }, searchData),
131
+ showList: showList
131
132
  }
132
133
  } : undefined,
133
134
  disabled: props === null || props === void 0 ? void 0 : props.panelDisabled,
@@ -163,7 +164,8 @@ var ModuleEvent = function ModuleEvent(props) {
163
164
  elementId: elementId,
164
165
  value: searchData,
165
166
  show: showList,
166
- initSearch: initSearch
167
+ initSearch: initSearch,
168
+ onChangeShow: setShowList
167
169
  })));
168
170
  };
169
171
  ModuleEvent.defaultProps = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/modules-event",
3
- "version": "1.0.4",
3
+ "version": "1.0.5-bug.1",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -49,7 +49,7 @@
49
49
  "react": "^16.12.0 || ^17.0.0",
50
50
  "yorkie": "^2.0.0"
51
51
  },
52
- "gitHead": "f03dec4f9f77be83b16da1a9ab6ac83b67506443",
52
+ "gitHead": "c547470b1d32499155edbb36a23e1d9677ea2503",
53
53
  "dependencies": {
54
54
  "react-copy-to-clipboard": "^5.1.0",
55
55
  "react-highlight": "^0.15.0"