@zgfe/modules-interval 1.0.2 → 1.0.3-alpha.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.
Files changed (36) hide show
  1. package/dist/esm/components/eventFilter/index.js +14 -0
  2. package/dist/esm/components/eventFilter/types.d.ts +2 -0
  3. package/dist/esm/components/searchPanel/index.js +1 -2
  4. package/dist/esm/components/table/index.js +3 -2
  5. package/dist/esm/constants/apis.d.ts +1 -5
  6. package/dist/esm/constants/apis.js +14 -4
  7. package/dist/esm/modules/content/index.js +4 -1
  8. package/dist/esm/modules/content/utils.d.ts +2 -0
  9. package/dist/esm/modules/content/utils.js +3 -1
  10. package/dist/esm/modules/home/demo/index.js +1 -1
  11. package/dist/esm/modules/home/types.d.ts +1 -1
  12. package/dist/esm/modules/topPanel/index.js +70 -7
  13. package/dist/esm/modules/topPanel/styles/index.less +23 -2
  14. package/dist/esm/modules/topPanel/types.d.ts +6 -0
  15. package/dist/esm/modules/topPanel/types.js +5 -1
  16. package/dist/esm/style/index.less +14 -0
  17. package/dist/esm/types.d.ts +12 -15
  18. package/dist/esm/utils/formData.d.ts +4 -1
  19. package/dist/esm/utils/formData.js +49 -12
  20. package/package.json +9 -4
  21. package/dist/esm/assets/business/demo.css +0 -539
  22. package/dist/esm/assets/business/demo_index.html +0 -3316
  23. package/dist/esm/assets/business/iconfont.css +0 -559
  24. package/dist/esm/assets/business/iconfont.js +0 -43
  25. package/dist/esm/assets/business/iconfont.json +0 -961
  26. package/dist/esm/assets/business/iconfont.ttf +0 -0
  27. package/dist/esm/assets/business/iconfont.woff +0 -0
  28. package/dist/esm/assets/business/iconfont.woff2 +0 -0
  29. package/dist/esm/assets/icons/demo.css +0 -539
  30. package/dist/esm/assets/icons/demo_index.html +0 -9618
  31. package/dist/esm/assets/icons/iconfont.css +0 -1655
  32. package/dist/esm/assets/icons/iconfont.js +0 -43
  33. package/dist/esm/assets/icons/iconfont.json +0 -2879
  34. package/dist/esm/assets/icons/iconfont.ttf +0 -0
  35. package/dist/esm/assets/icons/iconfont.woff +0 -0
  36. package/dist/esm/assets/icons/iconfont.woff2 +0 -0
@@ -149,10 +149,24 @@ var EventFilter = function EventFilter(props) {
149
149
  showBuiltInTarget: false,
150
150
  popupContainer: false,
151
151
  defaultSelectAble: false,
152
+ destroyPopupOnHide: true,
152
153
  value: {
153
154
  event: event
154
155
  },
155
156
  onChange: onChangeEvent,
157
+ filter: function filter(event) {
158
+ if (!props.subject) return true;
159
+ var propMatch = false;
160
+ for (var i = 0; i < event.attrList.length; i++) {
161
+ var _props$subject;
162
+ var attr = event.attrList[i];
163
+ if (attr.label === ((_props$subject = props.subject) === null || _props$subject === void 0 ? void 0 : _props$subject.subjectName)) {
164
+ propMatch = true;
165
+ break;
166
+ }
167
+ }
168
+ return propMatch;
169
+ },
156
170
  placeholder: "\u8BF7\u9009\u62E9\u4E8B\u4EF6"
157
171
  }), /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Tooltip, {
158
172
  placement: "top",
@@ -1,3 +1,4 @@
1
+ import SubjectTypes from '@zgfe/business-lib/es/hooks/types/subject';
1
2
  import { eventProps } from '../../types';
2
3
  /**
3
4
  * 事件属性
@@ -48,5 +49,6 @@ export interface EventFilterProps {
48
49
  value?: eventProps;
49
50
  relevancyFl?: boolean;
50
51
  relevancy?: boolean;
52
+ subject?: SubjectTypes.Subject;
51
53
  onChange?: (event: eventProps) => {};
52
54
  }
@@ -105,9 +105,8 @@ var SearchPanel = function SearchPanel(props) {
105
105
  display: 'flex'
106
106
  }
107
107
  }, /*#__PURE__*/React.createElement(BizDatePicker, {
108
- dateTypeList: ['day', 'week', 'month'],
108
+ dateTypeList: ['day', 'week', 'month', 'custom'],
109
109
  value: time,
110
- mode: "simple",
111
110
  includeToday: true,
112
111
  onChange: onChangeTime,
113
112
  selectRange: 365
@@ -36,7 +36,8 @@ var EventTable = function EventTable(props) {
36
36
  eventEnvList = _useContext.eventEnvList,
37
37
  userPropList = _useContext.userPropList;
38
38
  var _useContext2 = useContext(EventContext),
39
- panelName = _useContext2.panelName;
39
+ panelName = _useContext2.panelName,
40
+ onUserDrill = _useContext2.onUserDrill;
40
41
 
41
42
  // 按属性排序后的数据(用于合并行)
42
43
  var _useState3 = useState({
@@ -69,7 +70,7 @@ var EventTable = function EventTable(props) {
69
70
  var _dataSource$appData;
70
71
  var _searchData$userGroup = searchData.userGroup,
71
72
  userGroup = _searchData$userGroup === void 0 ? [0] : _searchData$userGroup;
72
- var _getColumns = getColumns(eventGroupList, userPropList, eventEnvList, (dataSource === null || dataSource === void 0 ? void 0 : (_dataSource$appData = dataSource.appData) === null || _dataSource$appData === void 0 ? void 0 : _dataSource$appData.x_axis) || [], dataSource, userGroup, searchData, showList);
73
+ var _getColumns = getColumns(eventGroupList, userPropList, eventEnvList, (dataSource === null || dataSource === void 0 ? void 0 : (_dataSource$appData = dataSource.appData) === null || _dataSource$appData === void 0 ? void 0 : _dataSource$appData.x_axis) || [], dataSource, userGroup, searchData, showList, onUserDrill);
73
74
  return _getColumns;
74
75
  }, [dataSource === null || dataSource === void 0 ? void 0 : (_dataSource$appData2 = dataSource.appData) === null || _dataSource$appData2 === void 0 ? void 0 : _dataSource$appData2.x_axis, showList, sortTable, panelName]);
75
76
 
@@ -1,6 +1,2 @@
1
- declare const Apis: {
2
- dataList: string;
3
- getEventDataSql: string;
4
- eventDownloadReport: string;
5
- };
1
+ declare const Apis: Record<string, string>;
6
2
  export default Apis;
@@ -1,7 +1,17 @@
1
1
  var Apis = {
2
- // dataList: '/zg/web/v2/data/eventDataList',
3
- dataList: '/zg/web/v2/interval/intervalData',
4
- getEventDataSql: '/zg/web/v2/dataSql/getEventDataSql',
5
- eventDownloadReport: '/zg/web/v2/interval/downLoadintervalData'
2
+ dataList: '/interval/intervalData',
3
+ getEventDataSql: '/dataSql/getEventDataSql',
4
+ eventDownloadReport: '/interval/downLoadintervalData',
5
+ /**
6
+ * 用户下钻
7
+ */
8
+ userDrill: '/interval/userDrill',
9
+ /**
10
+ * 主体下钻
11
+ */
12
+ subjectDrill: '/interval/eventDrill'
6
13
  };
14
+ for (var key in Apis) {
15
+ Apis[key] = "/zg/web/v2".concat(Apis[key]);
16
+ }
7
17
  export default Apis;
@@ -183,7 +183,10 @@ var EventContent = function EventContent(props) {
183
183
  var onChangeSearch = function onChangeSearch(data, flag) {
184
184
  data.id ? setEventId(data.id) : setEventId(-1);
185
185
  setSearchData(function (_searchData) {
186
- return _objectSpread(_objectSpread({}, _searchData), data);
186
+ return _objectSpread(_objectSpread(_objectSpread({}, _searchData), data), {}, {
187
+ userGroup: data.analysisSubject ? undefined : data.userGroup,
188
+ analysisSubject: data.analysisSubject ? data.analysisSubject : undefined
189
+ });
187
190
  });
188
191
  setAjaxFlag(false);
189
192
  };
@@ -51,5 +51,7 @@ export declare function searchDataParams(params: any): {
51
51
  } | null;
52
52
  associatedPreAttr: any;
53
53
  associatedNextAttr: any;
54
+ analysisModel: any;
55
+ analysisSubject: any;
54
56
  };
55
57
  export declare function transformData(data: any[][]): string[];
@@ -96,7 +96,9 @@ export function searchDataParams(params) {
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,
98
98
  associatedPreAttr: params === null || params === void 0 ? void 0 : (_params$associatedPre = params.associatedPreAttr) === null || _params$associatedPre === void 0 ? void 0 : _params$associatedPre.id,
99
- associatedNextAttr: params === null || params === void 0 ? void 0 : (_params$associatedNex = params.associatedNextAttr) === null || _params$associatedNex === void 0 ? void 0 : _params$associatedNex.id
99
+ associatedNextAttr: params === null || params === void 0 ? void 0 : (_params$associatedNex = params.associatedNextAttr) === null || _params$associatedNex === void 0 ? void 0 : _params$associatedNex.id,
100
+ analysisModel: params.analysisModel,
101
+ analysisSubject: params.analysisSubject
100
102
  };
101
103
  }
102
104
  export function transformData(data) {
@@ -39,7 +39,7 @@ export default (function () {
39
39
  };
40
40
  return /*#__PURE__*/React.createElement(DemoWrapper, {
41
41
  needMeta: true,
42
- defaultApp: 204
42
+ defaultApp: 271
43
43
  }, isDetail ? /*#__PURE__*/React.createElement("div", null, JSON.stringify(detailParams), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Button, {
44
44
  onClick: function onClick() {
45
45
  return setIsDetail(false);
@@ -23,7 +23,7 @@ export declare namespace EventProps {
23
23
  /**
24
24
  * 用户钻取
25
25
  */
26
- onUserDrill: (data: UserDrillParamsProp, searchData: SearchValue) => void;
26
+ onUserDrill: (data: UserDrillParamsProp) => void;
27
27
  }
28
28
  interface Value {
29
29
  /**
@@ -11,10 +11,11 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
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
13
  import React, { useState } from 'react';
14
- import { Form, Button } from 'antd';
15
- import { BizAttributeSelector, BizUserGroupHeader } from '@zgfe/business-lib';
14
+ import { Form, Button, Radio } from 'antd';
15
+ import { BizAttributeSelector, BizSelect, BizUserGroupHeader, useSubject } from '@zgfe/business-lib';
16
16
  import EventFilter from "../../components/eventFilter";
17
17
  import "./styles/index.less";
18
+ import { AnalysisMode } from "./types";
18
19
  var classPrefix = 'top-panel-interval';
19
20
  var TopPanel = function TopPanel(props) {
20
21
  var _props$urlParam, _props$urlParam2, _defaultValue$associa, _defaultValue$associa2, _finalSearchData$asso, _finalSearchData$asso2, _defaultValue$associa3, _finalSearchData$asso3, _defaultValue$associa4, _finalSearchData$asso4, _defaultValue$associa5, _finalSearchData$asso5, _defaultValue$associa6, _finalSearchData$asso6, _defaultValue$associa7, _finalSearchData$asso7, _defaultValue$associa8, _finalSearchData$asso8, _defaultValue$associa9, _finalSearchData$asso9, _defaultValue$associa10, _finalSearchData$asso10, _defaultValue$dimensi, _finalSearchData$dime, _defaultValue$dimensi2, _finalSearchData$dime2, _defaultValue$dimensi3, _finalSearchData$dime3, _defaultValue$dimensi4, _finalSearchData$dime4;
@@ -43,6 +44,9 @@ var TopPanel = function TopPanel(props) {
43
44
  _useState8 = _slicedToArray(_useState7, 2),
44
45
  relevancyFl = _useState8[0],
45
46
  setRelevancyFl = _useState8[1];
47
+ var _useSubject = useSubject(),
48
+ subjectList = _useSubject.subjectList,
49
+ subjectLoading = _useSubject.loading;
46
50
  var _ref = defaultValue,
47
51
  userGroup = _ref.userGroup;
48
52
  // 细分属性初始值
@@ -50,6 +54,14 @@ var TopPanel = function TopPanel(props) {
50
54
  _useState10 = _slicedToArray(_useState9, 2),
51
55
  bizAttributeSelectorValue = _useState10[0],
52
56
  setBizAttributeSelectorValue = _useState10[1];
57
+ var _useState11 = useState('user'),
58
+ _useState12 = _slicedToArray(_useState11, 2),
59
+ analysisType = _useState12[0],
60
+ setAnalysisType = _useState12[1];
61
+ var _useState13 = useState(),
62
+ _useState14 = _slicedToArray(_useState13, 2),
63
+ currentSubject = _useState14[0],
64
+ setCurrentSubject = _useState14[1];
53
65
  // 用户组和事件变更
54
66
  var onValuesChange = function onValuesChange(data, allData) {
55
67
  var _data = {};
@@ -76,7 +88,14 @@ var TopPanel = function TopPanel(props) {
76
88
  _data.userGroup = allData.userGroup;
77
89
  if (_data.userGroup.length <= 0) _data.userGroup = [0];
78
90
  }
79
- props.onChange(allData, (finalSearchData === null || finalSearchData === void 0 ? void 0 : finalSearchData.chartType) === 'boxplot' ? true : false);
91
+ props.onChange(_objectSpread(_objectSpread({}, allData), {}, {
92
+ analysisSubject: allData.analysisSubject ? {
93
+ subjectId: allData.analysisSubject.id,
94
+ subjectName: allData.analysisSubject.subjectName,
95
+ subjectAlias: allData.analysisSubject.subjectAlias,
96
+ unit: allData.analysisSubject.unit
97
+ } : undefined
98
+ }), (finalSearchData === null || finalSearchData === void 0 ? void 0 : finalSearchData.chartType) === 'boxplot' ? true : false);
80
99
  };
81
100
  var resetting = function resetting() {
82
101
  form.resetFields();
@@ -90,6 +109,7 @@ var TopPanel = function TopPanel(props) {
90
109
  associatedNextAttr: undefined
91
110
  });
92
111
  setRelevancy(false);
112
+ setCurrentSubject(undefined);
93
113
  props.onChange({
94
114
  userGroup: [0],
95
115
  start: undefined,
@@ -172,11 +192,43 @@ var TopPanel = function TopPanel(props) {
172
192
  isHidden: (defaultValue === null || defaultValue === void 0 ? void 0 : (_defaultValue$dimensi2 = defaultValue.dimension) === null || _defaultValue$dimensi2 === void 0 ? void 0 : _defaultValue$dimensi2.is_hidden) || (finalSearchData === null || finalSearchData === void 0 ? void 0 : (_finalSearchData$dime2 = finalSearchData.dimension) === null || _finalSearchData$dime2 === void 0 ? void 0 : _finalSearchData$dime2.isHidden),
173
193
  propCategory: (defaultValue === null || defaultValue === void 0 ? void 0 : (_defaultValue$dimensi3 = defaultValue.dimension) === null || _defaultValue$dimensi3 === void 0 ? void 0 : _defaultValue$dimensi3.prop_category) || (finalSearchData === null || finalSearchData === void 0 ? void 0 : (_finalSearchData$dime3 = finalSearchData.dimension) === null || _finalSearchData$dime3 === void 0 ? void 0 : _finalSearchData$dime3.propCategory),
174
194
  eventId: (defaultValue === null || defaultValue === void 0 ? void 0 : (_defaultValue$dimensi4 = defaultValue.dimension) === null || _defaultValue$dimensi4 === void 0 ? void 0 : _defaultValue$dimensi4.event_id) || (finalSearchData === null || finalSearchData === void 0 ? void 0 : (_finalSearchData$dime4 = finalSearchData.dimension) === null || _finalSearchData$dime4 === void 0 ? void 0 : _finalSearchData$dime4.eventId)
175
- })
195
+ }),
196
+ analysisModel: (defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.analysisModel) || AnalysisMode.common
176
197
  },
177
198
  scrollToFirstError: true,
178
199
  onValuesChange: onValuesChange
179
200
  }, /*#__PURE__*/React.createElement(Form.Item, {
201
+ label: "\u5206\u6790\u4E3B\u4F53",
202
+ className: "panel-form-interval-item"
203
+ }, /*#__PURE__*/React.createElement(BizSelect, {
204
+ options: [{
205
+ label: '用户',
206
+ value: 'user'
207
+ }, {
208
+ label: '事件属性',
209
+ value: 'eventProp'
210
+ }],
211
+ keyField: "value",
212
+ defaultValue: {
213
+ value: analysisType
214
+ },
215
+ onChange: function onChange(val) {
216
+ setAnalysisType(val.value);
217
+ resetting();
218
+ }
219
+ })), analysisType === 'eventProp' && /*#__PURE__*/React.createElement(Form.Item, {
220
+ label: "\u4E3B\u4F53\u540D\u79F0",
221
+ name: "analysisSubject",
222
+ className: "panel-form-interval-item"
223
+ }, /*#__PURE__*/React.createElement(BizSelect, {
224
+ options: subjectList,
225
+ aliasField: "subjectAlias",
226
+ labelField: "subjectName",
227
+ keyField: "id",
228
+ onChange: function onChange(val) {
229
+ setCurrentSubject(val);
230
+ }
231
+ })), analysisType === 'user' && /*#__PURE__*/React.createElement(Form.Item, {
180
232
  label: "",
181
233
  name: "userGroup",
182
234
  className: "space-item interval-item",
@@ -193,6 +245,7 @@ var TopPanel = function TopPanel(props) {
193
245
  label: "\u5F00\u59CB\u4E8B\u4EF6",
194
246
  name: "start"
195
247
  }, /*#__PURE__*/React.createElement(EventFilter, {
248
+ subject: currentSubject,
196
249
  relevancyFl: relevancyFl,
197
250
  relevancy: true
198
251
  })), relevancy ? /*#__PURE__*/React.createElement(Form.Item, {
@@ -257,7 +310,9 @@ var TopPanel = function TopPanel(props) {
257
310
  })) : '', /*#__PURE__*/React.createElement(Form.Item, {
258
311
  label: "\u7ED3\u675F\u4E8B\u4EF6",
259
312
  name: "end"
260
- }, /*#__PURE__*/React.createElement(EventFilter, null)), /*#__PURE__*/React.createElement(Form.Item, {
313
+ }, /*#__PURE__*/React.createElement(EventFilter, {
314
+ subject: currentSubject
315
+ })), /*#__PURE__*/React.createElement(Form.Item, {
261
316
  label: "\u6309\u5C5E\u6027\u7EC6\u5206",
262
317
  name: "dimension",
263
318
  className: "dimension-interval"
@@ -272,12 +327,20 @@ var TopPanel = function TopPanel(props) {
272
327
  onDelete: function onDelete() {
273
328
  onChangeAttr(undefined, 'dimension');
274
329
  }
275
- })), /*#__PURE__*/React.createElement("div", {
330
+ })), /*#__PURE__*/React.createElement(Form.Item, {
331
+ label: "\u5206\u6790\u6A21\u578B",
332
+ name: "analysisModel",
333
+ className: "panel-form-interval-item"
334
+ }, /*#__PURE__*/React.createElement(Radio.Group, null, /*#__PURE__*/React.createElement(Radio, {
335
+ value: AnalysisMode.common
336
+ }, "\u5E38\u89C4\u95F4\u9694\u5206\u6790"), /*#__PURE__*/React.createElement(Radio, {
337
+ value: AnalysisMode.firstAndLast
338
+ }, "\u9996\u672B\u6B21\u95F4\u9694\u5206\u6790"))), /*#__PURE__*/React.createElement("div", {
276
339
  className: "".concat(classPrefix, "-form-botton-box")
277
340
  }, /*#__PURE__*/React.createElement(Button, {
278
341
  onClick: resetting
279
342
  }, "\u91CD\u7F6E"), /*#__PURE__*/React.createElement(Button, {
280
- loading: loading,
343
+ loading: loading || subjectLoading,
281
344
  disabled: loading || !startId || !endId || relevancy && !(defaultValue !== null && defaultValue !== void 0 && defaultValue.associatedNextAttr) && !(defaultValue !== null && defaultValue !== void 0 && defaultValue.associatedNextAttr),
282
345
  type: "primary",
283
346
  onClick: function onClick() {
@@ -1,5 +1,4 @@
1
- @import '../../../assets/icons/iconfont.css';
2
- @import '../../../assets/business/iconfont.css';
1
+ @import '~@zgfe/business-lib/es/assets/styles/inner.less';
3
2
 
4
3
  .top-panel-interval {
5
4
  &-form-botton-box {
@@ -18,6 +17,28 @@
18
17
  }
19
18
 
20
19
  .panel-form-interval {
20
+ &-item {
21
+ .ant-form-item-label {
22
+ padding-left: 24px;
23
+ font-weight: 500;
24
+ }
25
+ .ant-form-item-control-input-content {
26
+ height: 40px;
27
+ padding: 0 24px;
28
+ line-height: 40px;
29
+ .biz-select-handle {
30
+ display: inline-block;
31
+ width: 208px;
32
+ }
33
+ span.ant-radio + * {
34
+ padding-right: 40px;
35
+ padding-left: 12px;
36
+ }
37
+ &:hover {
38
+ background-color: #e8efff;
39
+ }
40
+ }
41
+ }
21
42
  .interval-item {
22
43
  margin-top: -2px;
23
44
  .ant-space-vertical {
@@ -1,5 +1,10 @@
1
1
  import { AttrConditionTypes } from '@zgfe/business-lib';
2
2
  import { bizAttributeSelectorValueProp, SearchValue } from '../../types';
3
+ import SubjectTypes from '@zgfe/business-lib/es/hooks/types/subject';
4
+ export declare enum AnalysisMode {
5
+ common = "commonInterval",
6
+ firstAndLast = "firstLastInterval"
7
+ }
3
8
  export interface start {
4
9
  eventId?: number;
5
10
  id?: number;
@@ -24,6 +29,7 @@ export interface FormDataProps {
24
29
  dimension?: bizAttributeSelectorValueProp;
25
30
  associatedPreAttr?: bizAttributeSelectorValueProp;
26
31
  associatedNextAttr?: bizAttributeSelectorValueProp;
32
+ analysisSubject?: SubjectTypes.Subject;
27
33
  }
28
34
  export interface FormHandelDataProps extends start {
29
35
  /**
@@ -1 +1,5 @@
1
- export {};
1
+ export var AnalysisMode = /*#__PURE__*/function (AnalysisMode) {
2
+ AnalysisMode["common"] = "commonInterval";
3
+ AnalysisMode["firstAndLast"] = "firstLastInterval";
4
+ return AnalysisMode;
5
+ }({});
@@ -51,3 +51,17 @@
51
51
  }
52
52
  }
53
53
  }
54
+ .interval-drill {
55
+ display: block;
56
+ .bsicon {
57
+ display: none;
58
+ margin-right: 4px;
59
+ }
60
+ &:hover {
61
+ color: @primary-color;
62
+ cursor: pointer;
63
+ .bsicon {
64
+ display: inline;
65
+ }
66
+ }
67
+ }
@@ -1,7 +1,7 @@
1
1
  import { AttrConditionTypes } from '@zgfe/business-lib';
2
2
  import { DatePickerTypes } from '@zgfe/business-lib/es/datePicker/types';
3
3
  import { ReactNode } from 'react';
4
- import { FormDataProps, start } from './modules/topPanel/types';
4
+ import { AnalysisMode, FormDataProps, start } from './modules/topPanel/types';
5
5
  /**
6
6
  * 属性选择器 默认值
7
7
  */
@@ -117,24 +117,25 @@ export interface SearchValue {
117
117
  * @description 分类
118
118
  */
119
119
  module?: string;
120
- }
121
- export interface UserDrillParamsProp {
122
120
  /**
123
- * @description 应用id
121
+ * 分析模型
124
122
  */
125
- appId: number;
123
+ analysisModel?: AnalysisMode;
126
124
  /**
127
- * @description 平台
125
+ * 分析主体
128
126
  */
129
- platform: number;
127
+ analysisSubject?: {
128
+ subjectId: number;
129
+ subjectName: string;
130
+ subjectAlias?: string;
131
+ unit: string;
132
+ };
133
+ }
134
+ export interface UserDrillParamsProp {
130
135
  /**
131
136
  * @description 用户数量
132
137
  */
133
138
  count: number;
134
- /**
135
- * @description 模型类型 整体|事件|漏斗|留存|获取|粘性|崩溃|微信生态-整体|微信生态-小程序
136
- */
137
- source: string;
138
139
  /**
139
140
  * @description 查询接口
140
141
  */
@@ -143,10 +144,6 @@ export interface UserDrillParamsProp {
143
144
  * @description 查询对象
144
145
  */
145
146
  params?: Record<string, any>;
146
- /**
147
- * @description 间隔分析,数据格式与其他业务不一致,间隔分析单独提出来了,其他业务在data里面
148
- */
149
- module?: string;
150
147
  }
151
148
  export type EventChartTypes = 'line' | 'bar' | 'pie' | 'map' | 'boxplot';
152
149
  /**
@@ -9,7 +9,7 @@ import { DisplaySetup } from '../components/searchPanel/types';
9
9
  * @param columnData xAxis
10
10
  * @returns column fields
11
11
  */
12
- export declare function getColumns(eventGroupList: EventGroup[] | undefined, userPropList: UserProp[] | undefined, eventEnvList: EnvProp[] | undefined, columnData: string[], dataSource: ResponseDataProps, userGroup: number[], searchData: SearchValue, showList: string[]): ColumnsType<EventProps.ColumnsDataType>;
12
+ export declare function getColumns(eventGroupList: EventGroup[] | undefined, userPropList: UserProp[] | undefined, eventEnvList: EnvProp[] | undefined, columnData: string[], dataSource: ResponseDataProps, userGroup: number[], searchData: SearchValue, showList: string[], onUserDrill: EventProps.Props['onUserDrill']): ColumnsType<EventProps.ColumnsDataType>;
13
13
  /**
14
14
  * 获取属性的label
15
15
  * @param attrData 当前属性
@@ -35,6 +35,7 @@ export declare function formTableData(originalData: ChartData): {
35
35
  Q3: number;
36
36
  min: number;
37
37
  perValue: number;
38
+ total: number;
38
39
  peopleNum: number;
39
40
  }[] | {
40
41
  key: number;
@@ -45,6 +46,7 @@ export declare function formTableData(originalData: ChartData): {
45
46
  Q3: number;
46
47
  min: number;
47
48
  perValue: number;
49
+ total: number;
48
50
  peopleNum: number;
49
51
  children: {
50
52
  key: string;
@@ -55,6 +57,7 @@ export declare function formTableData(originalData: ChartData): {
55
57
  Q3: number;
56
58
  min: number;
57
59
  perValue: number;
60
+ total: number;
58
61
  peopleNum: number;
59
62
  }[];
60
63
  }[] | undefined;
@@ -1,19 +1,21 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
2
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
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
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
5
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
7
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
8
3
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
9
4
  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."); }
10
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); }
11
6
  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; }
12
7
  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; } }
13
8
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
9
+ 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; }
10
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
11
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
12
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
13
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
14
14
  import React from 'react';
15
15
  import { chartColors } from "../constants/color";
16
16
  import "../style/index.less";
17
+ import { IconFont } from '@zgfe/business-lib';
18
+ import { Apis } from "../constants";
17
19
  var classPrefix = 'interval-form-data';
18
20
  function convertToHMS(seconds) {
19
21
  var hours = Math.floor(seconds / 3600);
@@ -29,7 +31,7 @@ function convertToHMS(seconds) {
29
31
  * @param columnData xAxis
30
32
  * @returns column fields
31
33
  */
32
- export function getColumns(eventGroupList, userPropList, eventEnvList, columnData, dataSource, userGroup, searchData, showList
34
+ export function getColumns(eventGroupList, userPropList, eventEnvList, columnData, dataSource, userGroup, searchData, showList, onUserDrill
33
35
  // onClickToDetailCallback: Function,
34
36
  ) {
35
37
  var _dataSource$appData, _dataSource$appData$s, _searchData$dimension;
@@ -121,7 +123,7 @@ export function getColumns(eventGroupList, userPropList, eventEnvList, columnDat
121
123
  return /*#__PURE__*/React.createElement("span", null, " ", convertToHMS(text));
122
124
  }
123
125
  }, {
124
- title: '人均值',
126
+ title: '均值',
125
127
  width: 148,
126
128
  ellipsis: true,
127
129
  align: 'right',
@@ -136,7 +138,17 @@ export function getColumns(eventGroupList, userPropList, eventEnvList, columnDat
136
138
  return /*#__PURE__*/React.createElement("span", null, " ", convertToHMS(text));
137
139
  }
138
140
  }, {
139
- title: '人数',
141
+ title: '合计',
142
+ width: 148,
143
+ ellipsis: true,
144
+ align: 'right',
145
+ dataIndex: 'total',
146
+ key: 'total',
147
+ render: function render(text, record) {
148
+ return /*#__PURE__*/React.createElement("span", null, " ", convertToHMS(text));
149
+ }
150
+ }, {
151
+ title: searchData.analysisSubject ? "".concat(searchData.analysisSubject.subjectAlias || searchData.analysisSubject.subjectName, "\u6570") : '人数',
140
152
  width: 148,
141
153
  ellipsis: true,
142
154
  align: 'right',
@@ -148,7 +160,30 @@ export function getColumns(eventGroupList, userPropList, eventEnvList, columnDat
148
160
  key: 'peopleNum',
149
161
  className: "".concat(classPrefix, "-table-td"),
150
162
  render: function render(text, record) {
151
- return /*#__PURE__*/React.createElement("span", null, " ", text);
163
+ return /*#__PURE__*/React.createElement("span", {
164
+ className: "interval-drill",
165
+ onClick: function onClick() {
166
+ var params;
167
+ // 主体下钻
168
+ if (searchData.analysisSubject) {
169
+ params = {
170
+ url: Apis.subjectDrill,
171
+ count: Number(text),
172
+ params: _objectSpread({}, searchData)
173
+ };
174
+ } else {
175
+ // 用户下钻
176
+ params = {
177
+ url: Apis.userDrill,
178
+ count: Number(text),
179
+ params: _objectSpread({}, searchData)
180
+ };
181
+ }
182
+ onUserDrill === null || onUserDrill === void 0 ? void 0 : onUserDrill(params);
183
+ }
184
+ }, /*#__PURE__*/React.createElement(IconFont, {
185
+ type: "a-yanjingkai"
186
+ }), " ", text);
152
187
  }
153
188
  }];
154
189
  return data;
@@ -192,7 +227,8 @@ function createNewArray(data) {
192
227
  Q3: item.total[3] || 0,
193
228
  min: item.total[4] || 0,
194
229
  perValue: item.total[5] || 0,
195
- peopleNum: item.total[6] || 0,
230
+ total: item.total[6] || 0,
231
+ peopleNum: item.total[7] || 0,
196
232
  children: getChildrenData(data, i)
197
233
  };
198
234
  });
@@ -221,7 +257,7 @@ export function convertDateArray(params, dateArray) {
221
257
  var resultArray = dateArray.map(function (date) {
222
258
  var dateObj = new Date(date);
223
259
  var weekday = weekdays[dateObj.getDay()];
224
- return "".concat(date, " (").concat(weekday, ")");
260
+ return "".concat(date).concat(weekday ? " (".concat(weekday, ")") : '');
225
261
  });
226
262
  return resultArray;
227
263
  break;
@@ -245,7 +281,8 @@ function getChildrenData(data, index) {
245
281
  Q3: values[i][3] || 0,
246
282
  min: values[i][4] || 0,
247
283
  perValue: values[i][5] || 0,
248
- peopleNum: values[i][6] || 0
284
+ total: values[i][6] || 0,
285
+ peopleNum: values[i][7] || 0
249
286
  };
250
287
  });
251
288
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/modules-interval",
3
- "version": "1.0.2",
3
+ "version": "1.0.3-alpha.1",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -9,12 +9,16 @@
9
9
  "deploy": "npm run docs:build && npm run docs:deploy",
10
10
  "prettier": "prettier --write \"**/*.{js,jsx,tsx,ts,less,md,json}\"",
11
11
  "test": "umi-test",
12
+ "pub": "lerna publish",
12
13
  "test:coverage": "umi-test --coverage",
13
14
  "prepublishOnly": "npm run build"
14
15
  },
15
16
  "files": [
16
17
  "dist"
17
18
  ],
19
+ "publishConfig": {
20
+ "access": "public"
21
+ },
18
22
  "module": "dist/esm/index.js",
19
23
  "typings": "dist/esm/index.d.ts",
20
24
  "gitHooks": {
@@ -43,7 +47,7 @@
43
47
  "@types/uuid": "^9.0.2",
44
48
  "@umijs/fabric": "^2.8.1",
45
49
  "@umijs/test": "^3.0.5",
46
- "@zgfe/business-lib": "1.1.84-panel.6",
50
+ "@zgfe/business-lib": "1.1.89-qirui.10",
47
51
  "@zgfe/modules-demo-manage": "^1.0.1",
48
52
  "antd": "^4.22.6",
49
53
  "dumi": "^1.1.0",
@@ -51,11 +55,12 @@
51
55
  "echarts-for-react": "^3.0.2",
52
56
  "father-build": "^1.17.2",
53
57
  "gh-pages": "^3.0.0",
54
- "lerna": "^5.1.7",
58
+ "lerna": "5.1.8",
55
59
  "lint-staged": "^10.0.7",
56
60
  "lodash": "^4.17.21",
57
61
  "prettier": "^2.2.1",
58
62
  "umi-request": "^1.4.0",
59
63
  "yorkie": "^2.0.0"
60
- }
64
+ },
65
+ "gitHead": "e7b84465ea7400217d91c9140e2f7a2773ba6383"
61
66
  }