@zgfe/modules-event 1.0.5 → 1.0.7

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.
@@ -102,7 +102,6 @@ var EventFilter = function EventFilter(props) {
102
102
  }
103
103
  }, [selectEventData]);
104
104
  var onAdd = function onAdd() {
105
- var _conditionRef$current;
106
105
  if ((event === null || event === void 0 ? void 0 : event.id) === -1) {
107
106
  return;
108
107
  }
@@ -110,7 +109,10 @@ var EventFilter = function EventFilter(props) {
110
109
  return;
111
110
  }
112
111
  setIsAdd(true);
113
- conditionRef === null || conditionRef === void 0 ? void 0 : (_conditionRef$current = conditionRef.current) === null || _conditionRef$current === void 0 ? void 0 : _conditionRef$current.add();
112
+ setTimeout(function () {
113
+ var _conditionRef$current;
114
+ conditionRef === null || conditionRef === void 0 ? void 0 : (_conditionRef$current = conditionRef.current) === null || _conditionRef$current === void 0 ? void 0 : _conditionRef$current.add();
115
+ }, 0);
114
116
  };
115
117
  var onChangeFilters = function onChangeFilters(data) {
116
118
  setFilter(data);
@@ -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'];
@@ -71,13 +71,17 @@ var EventContent = function EventContent(props) {
71
71
  _useState14 = _slicedToArray(_useState13, 2),
72
72
  subDisplay = _useState14[0],
73
73
  setSubDisplay = _useState14[1];
74
- var _useState15 = useState({
74
+ var _useState15 = useState(true),
75
+ _useState16 = _slicedToArray(_useState15, 2),
76
+ isFirst = _useState16[0],
77
+ setIsFirst = _useState16[1];
78
+ var _useState17 = useState({
75
79
  analysisIndex: ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.analysisIndex) || 'number',
76
80
  analysisAttr: (_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.analysisAttr
77
81
  }),
78
- _useState16 = _slicedToArray(_useState15, 2),
79
- dimension = _useState16[0],
80
- setDimension = _useState16[1];
82
+ _useState18 = _slicedToArray(_useState17, 2),
83
+ dimension = _useState18[0],
84
+ setDimension = _useState18[1];
81
85
  useEffect(function () {
82
86
  if (timer) clearTimeout(timer);
83
87
  var flag = true;
@@ -131,22 +135,27 @@ var EventContent = function EventContent(props) {
131
135
  cancel = c;
132
136
  })
133
137
  }).then(function (res) {
134
- var _searchData$userGroup;
138
+ var _searchData$userGroup, _props$show;
135
139
  if (!res) {
136
140
  setLoading(false);
137
141
  return;
138
142
  }
139
143
  var result = res.data;
140
144
  var _data = searchData.dimension ? result : getChartDataEventAliasName(result, eventGroupList);
141
- setShowList(_data ? getDefaultShow(_data) : []);
142
145
  if (['bar', 'pie', 'map'].indexOf(searchData.chartType) !== -1) {
143
146
  _data = getSortData(_data);
144
147
  }
145
148
  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) {
146
- setEventData(getUserGroupsCompareData(_data));
149
+ _data = getUserGroupsCompareData(_data);
150
+ }
151
+ if (isFirst && ((_props$show = props.show) === null || _props$show === void 0 ? void 0 : _props$show.length)) {
152
+ setIsFirst(false);
147
153
  } else {
148
- setEventData(_data);
154
+ var list = _data ? getDefaultShow(_data) : [];
155
+ setShowList(list);
156
+ props.onChangeShow && props.onChangeShow(list);
149
157
  }
158
+ setEventData(_data);
150
159
  onChangeUrlParam(searchData);
151
160
  setLoading(false);
152
161
  });
@@ -162,6 +171,7 @@ var EventContent = function EventContent(props) {
162
171
  };
163
172
  var onChangeShow = function onChangeShow(data) {
164
173
  setShowList(data);
174
+ props.onChangeShow && props.onChangeShow(data);
165
175
  };
166
176
  var platformChange = function platformChange(data) {
167
177
  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);
@@ -121,7 +121,8 @@ var ModuleEvent = function ModuleEvent(props) {
121
121
  params: _objectSpread({
122
122
  app_id: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
123
123
  module: 'event'
124
- }, searchData)
124
+ }, searchData),
125
+ showList: showList
125
126
  }
126
127
  } : undefined,
127
128
  disabled: props === null || props === void 0 ? void 0 : props.panelDisabled,
@@ -155,7 +156,8 @@ var ModuleEvent = function ModuleEvent(props) {
155
156
  elementId: elementId,
156
157
  value: searchData,
157
158
  show: showList,
158
- initSearch: initSearch
159
+ initSearch: initSearch,
160
+ onChangeShow: setShowList
159
161
  })));
160
162
  };
161
163
  ModuleEvent.defaultProps = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/modules-event",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
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": "b3d13b1509334739bcf179bbd3aaf64829c82c48",
52
+ "gitHead": "a7640c96df44330387ccda9e32fe8846317f4710",
53
53
  "dependencies": {
54
54
  "react-copy-to-clipboard": "^5.1.0",
55
55
  "react-highlight": "^0.15.0"