@zgfe/modules-interval 1.0.3-alpha.3 → 1.0.3-alpha.30

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.
@@ -10,7 +10,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
10
10
  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; }
11
11
  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; } }
12
12
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
- import { Switch, Tooltip, message } from 'antd';
13
+ import { Tooltip, message } from 'antd';
14
14
  import React, { useEffect, useRef, useState } from 'react';
15
15
  import { BizEventSelector, IconFont, BizAttrConditionGroup } from '@zgfe/business-lib';
16
16
  import "./styles/index.less";
@@ -137,9 +137,6 @@ var EventFilter = function EventFilter(props) {
137
137
  delete _dimension.key;
138
138
  _event.dimension = _dimension;
139
139
  }
140
- if (props.relevancy && relevancy !== undefined) {
141
- _event.relevancy = relevancy;
142
- }
143
140
  props.onChange && props.onChange(_event);
144
141
  }, [bizAttributeSelectorValue, filter, event, relevancy]);
145
142
  return /*#__PURE__*/React.createElement("div", {
@@ -177,28 +174,13 @@ var EventFilter = function EventFilter(props) {
177
174
  onClick: function onClick() {
178
175
  return onAdd();
179
176
  }
180
- }))), props !== null && props !== void 0 && props.relevancy ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Tooltip, {
181
- placement: "top",
182
- title: props.relevancyFl ? '请选择开始和结束事件' : ''
183
- }, /*#__PURE__*/React.createElement(Switch, {
184
- size: "default",
185
- style: {
186
- marginLeft: 24
187
- },
188
- checked: relevancy && !props.relevancyFl,
189
- disabled: props.relevancyFl,
190
- onChange: function onChange(checked) {
191
- return setRelevancy(checked);
192
- }
193
- })), /*#__PURE__*/React.createElement("span", {
194
- className: "switch-title"
195
- }, "\u8BBE\u7F6E\u5173\u8054\u5C5E\u6027")) : ''), (filter || isAdd) && /*#__PURE__*/React.createElement("div", {
177
+ })))), (filter || isAdd) && /*#__PURE__*/React.createElement("div", {
196
178
  className: "".concat(count > 0 ? 'attr-box-show' : '', " top")
197
179
  }, /*#__PURE__*/React.createElement(BizAttrConditionGroup, {
198
180
  ref: conditionRef,
199
181
  value: filter,
200
- onlyAnd: true,
201
182
  enableEventProp: true,
183
+ enableUserProp: props.analysisType === 'user',
202
184
  enableDelete: true,
203
185
  eventIdList: [event.id],
204
186
  onChange: onChangeFilters,
@@ -47,8 +47,7 @@ export interface ConditionsnProps {
47
47
  export interface EventFilterProps {
48
48
  id?: string;
49
49
  value?: eventProps;
50
- relevancyFl?: boolean;
51
- relevancy?: boolean;
52
50
  subject?: SubjectTypes.Subject;
53
- onChange?: (event: eventProps) => {};
51
+ analysisType?: 'user' | 'eventProp';
52
+ onChange?: (event: eventProps) => void;
54
53
  }
@@ -105,7 +105,7 @@ var TopBar = function TopBar(props) {
105
105
  appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
106
106
  module: 'interval'
107
107
  }, searchData), {}, {
108
- chartType: 'line'
108
+ chartType: 'boxplot'
109
109
  }),
110
110
  onOk: function onOk(data) {
111
111
  return _onOk('scene', data);
@@ -9,7 +9,8 @@ var Apis = {
9
9
  /**
10
10
  * 主体下钻
11
11
  */
12
- subjectDrill: '/interval/eventDrill'
12
+ subjectDrill: '/interval/eventDrill',
13
+ querySubjectDisplay: '/analysisSubject/querySubDisplay'
13
14
  };
14
15
  for (var key in Apis) {
15
16
  Apis[key] = "/zg/web/v2".concat(Apis[key]);
@@ -97,12 +97,13 @@ var IntervalEventChart = function IntervalEventChart(props) {
97
97
  dataSource: dataSource,
98
98
  showList: showList,
99
99
  dataSourceList: dataSourceList,
100
- params: params
101
- }), (params === null || params === void 0 ? void 0 : params.chartType) === 'line' ? /*#__PURE__*/React.createElement(EventTable, {
100
+ params: params,
101
+ onlyChart: props.onlyChart
102
+ }), !props.onlyChart && /*#__PURE__*/React.createElement(EventTable, {
102
103
  dataSource: dataSource,
103
104
  searchData: params,
104
105
  showList: [],
105
106
  changeShow: onChangeShow
106
- }) : null);
107
+ }));
107
108
  };
108
109
  export default IntervalEventChart;
@@ -87,7 +87,7 @@ var IntervalChart = function IntervalChart(props) {
87
87
  right: 3,
88
88
  height: 20 // 设置内置的dataZoom的高度
89
89
  }, {
90
- show: (params === null || params === void 0 ? void 0 : params.module) === 'interval' ? false : true,
90
+ show: props.onlyChart ? false : true,
91
91
  type: 'slider',
92
92
  bottom: '38px',
93
93
  xAxisIndex: [0],
@@ -13,6 +13,7 @@ export declare namespace eventChartProps {
13
13
  */
14
14
  dataSource?: ChartTypesProps;
15
15
  dataSourceList?: DisplaySetup[];
16
+ onlyChart?: boolean;
16
17
  /**
17
18
  * 查询条件
18
19
  */
@@ -56,14 +56,10 @@ var EventContent = function EventContent(props) {
56
56
  _useState12 = _slicedToArray(_useState11, 2),
57
57
  isCity = _useState12[0],
58
58
  setIsCity = _useState12[1];
59
- var _useState13 = useState(false),
59
+ var _useState13 = useState(-1),
60
60
  _useState14 = _slicedToArray(_useState13, 2),
61
- ajaxFlag = _useState14[0],
62
- setAjaxFlag = _useState14[1];
63
- var _useState15 = useState(-1),
64
- _useState16 = _slicedToArray(_useState15, 2),
65
- eventId = _useState16[0],
66
- setEventId = _useState16[1];
61
+ eventId = _useState14[0],
62
+ setEventId = _useState14[1];
67
63
  var _useContext2 = useContext(IntervalContext),
68
64
  searchData = _useContext2.searchData,
69
65
  setSearchData = _useContext2.setSearchData,
@@ -72,11 +68,17 @@ var EventContent = function EventContent(props) {
72
68
  userPropList = _useContext2.userPropList;
73
69
  var _useContext3 = useContext(BizTargetFromPanelContext),
74
70
  handleSearch = _useContext3.handleSearch;
71
+ var _useState15 = useState(),
72
+ _useState16 = _slicedToArray(_useState15, 2),
73
+ searchTimer = _useState16[0],
74
+ setSearchTimer = _useState16[1];
75
75
  var collapseRef = useRef();
76
76
  // 初始化
77
77
  useEffect(function () {
78
78
  if (props.defaultValue) {
79
79
  setEventId(props.defaultValue.id);
80
+ } else {
81
+ setLoading(false);
80
82
  }
81
83
  }, [props.defaultValue]);
82
84
  useEffect(function () {
@@ -88,42 +90,28 @@ var EventContent = function EventContent(props) {
88
90
  setIsCity(judgeIsCity(_attrName));
89
91
  }
90
92
  }
91
- if (timer) clearTimeout(timer);
92
- var flag = true;
93
- timer = setTimeout(function () {
94
- if (flag) {
95
- fetchRequest(false);
96
- }
97
- }, 500);
93
+ if (!searchData || !searchData.analysisModel) return;
94
+ if (searchTimer) clearTimeout(searchTimer);
95
+ setSearchTimer(setTimeout(function () {
96
+ fetchRequest();
97
+ }, 300));
98
98
  return function () {
99
- // 清理异步任务
100
- if (timer) clearTimeout(timer);
101
- flag = false;
99
+ clearTimeout(searchTimer);
102
100
  };
103
101
  }, [searchData]);
104
102
  useEffect(function () {
105
103
  handleSearch && handleSearch(loading);
106
104
  }, [loading]);
107
- useEffect(function () {
108
- if (ajaxFlag) {
109
- fetchRequest(true);
110
- }
111
- }, [ajaxFlag]);
105
+
112
106
  // 查询
113
- var fetchRequest = function fetchRequest(flag) {
107
+ var fetchRequest = function fetchRequest() {
114
108
  var _searchData$start, _searchData$end, _searchData$associate, _searchData$associate2, _searchData$associate3;
115
- if (flag !== undefined) setAjaxFlag(flag);
116
- if (!ajaxFlag) return;
117
109
  if ((searchData === null || searchData === void 0 ? void 0 : (_searchData$start = searchData.start) === null || _searchData$start === void 0 ? void 0 : _searchData$start.id) === null || (searchData === null || searchData === void 0 ? void 0 : (_searchData$end = searchData.end) === null || _searchData$end === void 0 ? void 0 : _searchData$end.id) === null) {
118
110
  setLoading(false);
119
111
  return;
120
112
  }
121
113
  setEventData(undefined);
122
114
  setLoading(true);
123
- // 取消上次未完成的请求
124
- // if (typeof cancel === 'function') {
125
- // cancel();
126
- // }
127
115
  if (searchData !== null && searchData !== void 0 && (_searchData$associate = searchData.associatedNextAttr) !== null && _searchData$associate !== void 0 && _searchData$associate.type && (searchData === null || searchData === void 0 ? void 0 : (_searchData$associate2 = searchData.associatedPreAttr) === null || _searchData$associate2 === void 0 ? void 0 : _searchData$associate2.type) !== (searchData === null || searchData === void 0 ? void 0 : (_searchData$associate3 = searchData.associatedNextAttr) === null || _searchData$associate3 === void 0 ? void 0 : _searchData$associate3.type)) {
128
116
  setLoading(false);
129
117
  return message.error('您查询的属性不一致,暂不支持查询');
@@ -159,7 +147,6 @@ var EventContent = function EventContent(props) {
159
147
  setSearchData(function (value) {
160
148
  return _objectSpread(_objectSpread({}, value), data);
161
149
  });
162
- setAjaxFlag(true);
163
150
  };
164
151
 
165
152
  // 改变显示内容
@@ -174,21 +161,19 @@ var EventContent = function EventContent(props) {
174
161
  platform: data
175
162
  });
176
163
  });
177
- setTimeout(function () {
178
- setAjaxFlag(true);
179
- }, 100);
180
164
  };
181
165
 
182
166
  // TopPanel组件数值变更
183
167
  var onChangeSearch = function onChangeSearch(data, flag) {
184
168
  data.id ? setEventId(data.id) : setEventId(-1);
185
169
  setSearchData(function (_searchData) {
186
- return _objectSpread(_objectSpread(_objectSpread({}, _searchData), data), {}, {
170
+ return _objectSpread(_objectSpread({}, data), {}, {
171
+ time: _searchData.time,
172
+ platform: _searchData.platform,
187
173
  userGroup: data.analysisSubject ? undefined : data.userGroup,
188
174
  analysisSubject: data.analysisSubject ? data.analysisSubject : undefined
189
175
  });
190
176
  });
191
- setAjaxFlag(false);
192
177
  };
193
178
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TopBar, {
194
179
  searchData: searchData,
@@ -205,11 +190,8 @@ var EventContent = function EventContent(props) {
205
190
  collapseRef: collapseRef,
206
191
  onChange: onChangeSearch,
207
192
  defaultValue: searchData,
208
- urlParam: props.urlParam,
209
- ajaxFlag: ajaxFlag,
210
193
  loading: loading,
211
- finalSearchData: finalSearchData,
212
- fetchRequest: fetchRequest
194
+ finalSearchData: finalSearchData
213
195
  })
214
196
  }, /*#__PURE__*/React.createElement("div", {
215
197
  className: classPrefix
@@ -10,7 +10,6 @@ export declare namespace EventContentProps {
10
10
  * 默认值
11
11
  */
12
12
  value: SearchValue;
13
- urlParam?: SearchValue;
14
13
  /**
15
14
  * 展示列表
16
15
  */
@@ -91,7 +91,7 @@ export function searchDataParams(params) {
91
91
  sub: (params === null || params === void 0 ? void 0 : (_params$dimension2 = params.dimension) === null || _params$dimension2 === void 0 ? void 0 : _params$dimension2.propCategory) === 'userProp' ? 'user_attr' : (params === null || params === void 0 ? void 0 : (_params$dimension3 = params.dimension) === null || _params$dimension3 === void 0 ? void 0 : _params$dimension3.propCategory) === 'eventProp' ? 'event_attr' : params === null || params === void 0 ? void 0 : (_params$dimension4 = params.dimension) === null || _params$dimension4 === void 0 ? void 0 : _params$dimension4.name,
92
92
  category: (params === null || params === void 0 ? void 0 : (_params$dimension5 = params.dimension) === null || _params$dimension5 === void 0 ? void 0 : _params$dimension5.category) || 'custom',
93
93
  attrId: params === null || params === void 0 ? void 0 : (_params$dimension6 = params.dimension) === null || _params$dimension6 === void 0 ? void 0 : _params$dimension6.id,
94
- userAttr: (params === null || params === void 0 ? void 0 : (_params$dimension7 = params.dimension) === null || _params$dimension7 === void 0 ? void 0 : _params$dimension7.propCategory) === 'userProp' ? params === null || params === void 0 ? void 0 : (_params$dimension8 = params.dimension) === null || _params$dimension8 === void 0 ? void 0 : _params$dimension8.dimensionSub : null,
94
+ userAttr: (params === null || params === void 0 ? void 0 : (_params$dimension7 = params.dimension) === null || _params$dimension7 === void 0 ? void 0 : _params$dimension7.propCategory) === 'userProp' ? params === null || params === void 0 ? void 0 : (_params$dimension8 = params.dimension) === null || _params$dimension8 === void 0 ? void 0 : _params$dimension8.name : null,
95
95
  eventAttr: (params === null || params === void 0 ? void 0 : (_params$dimension9 = params.dimension) === null || _params$dimension9 === void 0 ? void 0 : _params$dimension9.propCategory) === 'eventProp' ? params === null || params === void 0 ? void 0 : (_params$dimension10 = params.dimension) === null || _params$dimension10 === void 0 ? void 0 : _params$dimension10.label : null,
96
96
  event: (params === null || params === void 0 ? void 0 : (_params$dimension11 = params.dimension) === null || _params$dimension11 === void 0 ? void 0 : _params$dimension11.propCategory) !== 'envProp' ? params === null || params === void 0 ? void 0 : (_params$dimension12 = params.dimension) === null || _params$dimension12 === void 0 ? void 0 : _params$dimension12.eventId : null
97
97
  } : null,
@@ -17,7 +17,7 @@ var defaultValue = {
17
17
  panelId: 400900,
18
18
  panelType: 'edit',
19
19
  data: {
20
- chartType: 'line',
20
+ chartType: 'boxplot',
21
21
  analysisIndex: 'per',
22
22
  id: 7565,
23
23
  name: '测试6666',
@@ -17,17 +17,11 @@ export default (function () {
17
17
  isDetail = _useState2[0],
18
18
  setIsDetail = _useState2[1];
19
19
  var _useState3 = useState(),
20
- _useState4 = _slicedToArray(_useState3, 2),
21
- detailParams = _useState4[0],
22
- setDetailParams = _useState4[1];
20
+ _useState4 = _slicedToArray(_useState3, 1),
21
+ detailParams = _useState4[0];
23
22
  var _useState5 = useState(),
24
- _useState6 = _slicedToArray(_useState5, 2),
25
- searchParams = _useState6[0],
26
- setSearchParams = _useState6[1];
27
- var _useState7 = useState(),
28
- _useState8 = _slicedToArray(_useState7, 2),
29
- urlParam = _useState8[0],
30
- setUrlParam = _useState8[1];
23
+ _useState6 = _slicedToArray(_useState5, 1),
24
+ searchParams = _useState6[0];
31
25
  useEffect(function () {
32
26
  setGlobalConfig(requestConfig);
33
27
  }, []);
@@ -38,16 +32,207 @@ export default (function () {
38
32
  console.log('onUserDrill:111', data, searchData);
39
33
  };
40
34
  return /*#__PURE__*/React.createElement(DemoWrapper, {
41
- needMeta: true,
42
- defaultApp: 271
35
+ needMeta: true
43
36
  }, isDetail ? /*#__PURE__*/React.createElement("div", null, JSON.stringify(detailParams), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Button, {
44
37
  onClick: function onClick() {
45
38
  return setIsDetail(false);
46
39
  }
47
40
  }, "\u8FD4\u56DE")) : /*#__PURE__*/React.createElement(ModuleInterval, {
48
- defaultValue: searchParams,
49
- urlParam: urlParam,
50
41
  afterEditTarget: afterEditTarget,
51
- onUserDrill: onUserDrill
42
+ onUserDrill: onUserDrill,
43
+ defaultValue: {
44
+ data: {
45
+ analysisSubject: {
46
+ subjectId: 91,
47
+ subjectName: 'url',
48
+ subjectAlias: '网址',
49
+ unit: '达不溜'
50
+ },
51
+ start: {
52
+ alias: '页面访问',
53
+ attrList: [{
54
+ alias: '',
55
+ eventId: 18062,
56
+ id: 96068,
57
+ isHidden: 0,
58
+ key: 'eventProp-96068',
59
+ label: 'landing_page',
60
+ propCategory: 'eventProp',
61
+ type: 1,
62
+ realTime: true,
63
+ dimensionSub: 'event_attr'
64
+ }, {
65
+ alias: '',
66
+ eventId: 18062,
67
+ id: 96060,
68
+ isHidden: 0,
69
+ key: 'eventProp-96060',
70
+ label: 'url',
71
+ propCategory: 'eventProp',
72
+ type: 1,
73
+ realTime: true,
74
+ dimensionSub: 'event_attr'
75
+ }, {
76
+ alias: '',
77
+ eventId: 18062,
78
+ id: 96059,
79
+ isHidden: 0,
80
+ key: 'eventProp-96059',
81
+ label: 'page_url',
82
+ propCategory: 'eventProp',
83
+ type: 1,
84
+ realTime: true,
85
+ dimensionSub: 'event_attr'
86
+ }, {
87
+ alias: '',
88
+ eventId: 18062,
89
+ id: 96069,
90
+ isHidden: 0,
91
+ key: 'eventProp-96069',
92
+ label: 'page_title',
93
+ propCategory: 'eventProp',
94
+ type: 1,
95
+ realTime: true,
96
+ dimensionSub: 'event_attr'
97
+ }, {
98
+ alias: '',
99
+ eventId: 18062,
100
+ id: 96062,
101
+ isHidden: 0,
102
+ key: 'eventProp-96062',
103
+ label: 'ref',
104
+ propCategory: 'eventProp',
105
+ type: 1,
106
+ realTime: true,
107
+ dimensionSub: 'event_attr'
108
+ }],
109
+ id: 18062,
110
+ isDelete: 0,
111
+ isStop: 0,
112
+ name: 'pv',
113
+ eventHidden: 0,
114
+ marked: false,
115
+ clickAnalysis: true
116
+ },
117
+ end: {
118
+ alias: '收入',
119
+ attrList: [{
120
+ alias: '',
121
+ eventId: 18065,
122
+ id: 96079,
123
+ isHidden: 0,
124
+ key: 'eventProp-96079',
125
+ label: 'productQuantity',
126
+ propCategory: 'eventProp',
127
+ type: 2,
128
+ realTime: true,
129
+ dimensionSub: 'event_attr'
130
+ }, {
131
+ alias: '',
132
+ eventId: 18065,
133
+ id: 96081,
134
+ isHidden: 0,
135
+ key: 'eventProp-96081',
136
+ label: 'page_title',
137
+ propCategory: 'eventProp',
138
+ type: 1,
139
+ realTime: true,
140
+ dimensionSub: 'event_attr'
141
+ }, {
142
+ alias: '',
143
+ eventId: 18065,
144
+ id: 96083,
145
+ isHidden: 0,
146
+ key: 'eventProp-96083',
147
+ label: 'price',
148
+ propCategory: 'eventProp',
149
+ type: 2,
150
+ realTime: true,
151
+ dimensionSub: 'event_attr'
152
+ }, {
153
+ alias: '',
154
+ eventId: 18065,
155
+ id: 96082,
156
+ isHidden: 0,
157
+ key: 'eventProp-96082',
158
+ label: 'productID',
159
+ propCategory: 'eventProp',
160
+ type: 1,
161
+ realTime: true,
162
+ dimensionSub: 'event_attr'
163
+ }, {
164
+ alias: '',
165
+ eventId: 18065,
166
+ id: 96078,
167
+ isHidden: 0,
168
+ key: 'eventProp-96078',
169
+ label: 'total',
170
+ propCategory: 'eventProp',
171
+ type: 2,
172
+ realTime: true,
173
+ dimensionSub: 'event_attr'
174
+ }, {
175
+ alias: '',
176
+ eventId: 18065,
177
+ id: 96089,
178
+ isHidden: 0,
179
+ key: 'eventProp-96089',
180
+ label: 'page_url',
181
+ propCategory: 'eventProp',
182
+ type: 1,
183
+ realTime: true,
184
+ dimensionSub: 'event_attr'
185
+ }, {
186
+ alias: '',
187
+ eventId: 18065,
188
+ id: 96088,
189
+ isHidden: 0,
190
+ key: 'eventProp-96088',
191
+ label: 'ref',
192
+ propCategory: 'eventProp',
193
+ type: 1,
194
+ realTime: true,
195
+ dimensionSub: 'event_attr'
196
+ }, {
197
+ alias: '',
198
+ eventId: 18065,
199
+ id: 96084,
200
+ isHidden: 0,
201
+ key: 'eventProp-96084',
202
+ label: 'revenueType',
203
+ propCategory: 'eventProp',
204
+ type: 1,
205
+ realTime: true,
206
+ dimensionSub: 'event_attr'
207
+ }, {
208
+ alias: '',
209
+ eventId: 18065,
210
+ id: 96085,
211
+ isHidden: 0,
212
+ key: 'eventProp-96085',
213
+ label: 'url',
214
+ propCategory: 'eventProp',
215
+ type: 1,
216
+ realTime: true,
217
+ dimensionSub: 'event_attr'
218
+ }],
219
+ id: 18065,
220
+ isDelete: 0,
221
+ isStop: 0,
222
+ name: 'revenue',
223
+ eventHidden: 0,
224
+ marked: false,
225
+ clickAnalysis: false
226
+ },
227
+ analysisModel: 'commonInterval',
228
+ time: {
229
+ begin: '2023-10-25',
230
+ end: '2023-11-01',
231
+ relative: [7, 0],
232
+ unit: 'day'
233
+ }
234
+ }
235
+ },
236
+ onJumpWarning: function onJumpWarning() {}
52
237
  }));
53
238
  });
@@ -13,7 +13,7 @@ var defaultValue = {
13
13
  data: {
14
14
  module: 'event',
15
15
  analysisIndex: 'times',
16
- chartType: 'line',
16
+ chartType: 'boxplot',
17
17
  name: 'wqeqwe',
18
18
  time: {
19
19
  unit: 'day',