@zgfe/modules-interval 1.0.0-interval.5 → 1.0.0-interval.6

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.
@@ -15,7 +15,7 @@ import React, { useEffect, useRef, useState } from 'react';
15
15
  import { BizEventSelector, IconFont, BizAttrConditionGroup } from '@zgfe/business-lib';
16
16
  import "./styles/index.less";
17
17
  import _ from 'lodash';
18
- var classPrefix = 'eventfilter-box';
18
+ var classPrefix = 'interval-box';
19
19
  var EventFilter = function EventFilter(props) {
20
20
  // 筛选条件个数
21
21
  var _useState = useState(0),
@@ -1,4 +1,4 @@
1
- .eventfilter-box {
1
+ .interval-box {
2
2
  > :nth-child(1) {
3
3
  display: flex;
4
4
  display: flex;
@@ -6,7 +6,7 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
6
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
7
  import { Spin } from 'antd';
8
8
  import React, { useEffect, useState } from 'react';
9
- import { MiSpin } from '..';
9
+ import { MiNone, MiSpin } from '..';
10
10
  import "./styles/index.less";
11
11
  import EventChart from "../../modules/chart";
12
12
  var classPrefix = 'render-content';
@@ -39,11 +39,17 @@ var ContentPanel = function ContentPanel(props) {
39
39
  }
40
40
  return /*#__PURE__*/React.createElement("div", {
41
41
  className: classPrefix
42
+ }, /*#__PURE__*/React.createElement("div", {
43
+ className: "".concat(classPrefix, "-chart-container")
42
44
  }, eventData && (_eventData$app_data = eventData.app_data) !== null && _eventData$app_data !== void 0 && (_eventData$app_data$s = _eventData$app_data.series) !== null && _eventData$app_data$s !== void 0 && _eventData$app_data$s.length ? /*#__PURE__*/React.createElement(EventChart, {
43
45
  type: "grid",
44
46
  dataSource: eventData,
45
47
  params: searchData,
46
48
  onChangeShow: onChangeShow
47
- }) : null);
49
+ }) : /*#__PURE__*/React.createElement("div", {
50
+ className: "".concat(classPrefix, "-MiNone")
51
+ }, /*#__PURE__*/React.createElement(MiNone, {
52
+ label: "\u6682\u65E0\u6570\u636E"
53
+ }))));
48
54
  };
49
55
  export default ContentPanel;
@@ -13,6 +13,17 @@
13
13
  }
14
14
  }
15
15
 
16
+ &-MiNone {
17
+ display: flex;
18
+ align-items: center;
19
+ justify-content: center;
20
+ width: 100%;
21
+ height: 368px;
22
+ padding: 24px 16px;
23
+ border: 1px solid #ecedf0;
24
+ border-radius: 8px;
25
+ }
26
+
16
27
  &-spin-container {
17
28
  display: flex;
18
29
  align-items: center;
@@ -110,6 +110,7 @@ var SearchPanel = function SearchPanel(props) {
110
110
  onChange: onChangeTime
111
111
  }), /*#__PURE__*/React.createElement(BizSelect, {
112
112
  multiple: true,
113
+ disable: displaySetupList.length === 0,
113
114
  onChange: onDimensionChange,
114
115
  className: "".concat(classPrefix, "-select"),
115
116
  placeholder: "\u8BF7\u9009\u62E9\u663E\u793A\u8BBE\u7F6E",
@@ -12,7 +12,6 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
12
12
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
13
  import { ajax, BizGlobalDataContext, BizTable, IconFont } from '@zgfe/business-lib';
14
14
  import React, { useContext, useEffect, useMemo, useState } from 'react';
15
- // import 'highlight.js/styles/vs.css';
16
15
  import base64 from "../../utils/base64";
17
16
  import { Apis } from "../../constants";
18
17
  import { message } from 'antd';
@@ -20,7 +19,7 @@ import { formTableData, getColumns } from "../../utils/formData";
20
19
  import "./styles/index.less";
21
20
  import { getValue, searchDataParams } from "../../modules/content/utils";
22
21
  import { EventContext } from "../../types";
23
- var classPrefix = 'mi-table';
22
+ var classPrefix = 'mi-interval-table';
24
23
  var EventTable = function EventTable(props) {
25
24
  var _dataSource$app_data2;
26
25
  var dataSource = props.dataSource,
@@ -63,7 +62,7 @@ var EventTable = function EventTable(props) {
63
62
  var sortData = formTableData(dataSource);
64
63
  setSearchTable(sortData);
65
64
  setSortTable(sortData);
66
- setTableData(sortData === null || sortData === void 0 ? void 0 : sortData.slice(0, 10));
65
+ setTableData(sortData);
67
66
  }, [dataSource]);
68
67
 
69
68
  // 表格column
@@ -71,73 +70,16 @@ var EventTable = function EventTable(props) {
71
70
  var _dataSource$app_data;
72
71
  var _searchData$userGroup = searchData.userGroup,
73
72
  userGroup = _searchData$userGroup === void 0 ? [0] : _searchData$userGroup;
74
-
75
- // // 用户钻取
76
- // const onClickToDetail = (item: EventProps.ColumnsDataType, time: string, count: number) => {
77
- // let _time = time.split('|');
78
- // let groupValue = '';
79
- // // 有细分属性
80
- // if (searchData.dimension && item.dimension) {
81
- // groupValue = item.dimension;
82
- // } else {
83
- // // 有事件,无细分属性 || 事件概览
84
- // eventGroupList?.forEach((group) => {
85
- // group.eventList?.forEach((event) => {
86
- // if (event.name === item.name) {
87
- // groupValue = event.id.toString();
88
- // }
89
- // });
90
- // });
91
- // }
92
-
93
- // onUserDrill &&
94
- // onUserDrill(
95
- // {
96
- // appId: currentApp?.appId,
97
- // platform: currentApp?.platform || 0,
98
- // count,
99
- // module: 'event',
100
- // params: {
101
- // groupValue,
102
- // id: searchData.id,
103
- // userGroup: searchData.userGroup,
104
- // chartType: searchData.chartType,
105
- // conditions: searchData.filters?.conditions,
106
- // dimension: searchData.dimension,
107
- // dataType: searchData.id ? 'event' : 'overview',
108
- // time: {
109
- // ...searchData.time,
110
- // begin: _time[0],
111
- // end: _time.length > 1 ? _time[1] : _time[0],
112
- // },
113
- // },
114
- // source: 'EVENT',
115
- // url: '/zg/web/v2/data/appEventBatch',
116
- // },
117
- // {
118
- // source: 'EVENT',
119
- // ...defaultSearch,
120
- // name: panelName,
121
- // data: searchData,
122
- // },
123
- // );
124
- // };
125
- var _getColumns = getColumns(eventGroupList, userPropList, eventEnvList, (dataSource === null || dataSource === void 0 ? void 0 : (_dataSource$app_data = dataSource.app_data) === null || _dataSource$app_data === void 0 ? void 0 : _dataSource$app_data.x_axis) || [], dataSource, userGroup, searchData, showList
126
- // onClickToDetail,
127
- );
128
-
73
+ var _getColumns = getColumns(eventGroupList, userPropList, eventEnvList, (dataSource === null || dataSource === void 0 ? void 0 : (_dataSource$app_data = dataSource.app_data) === null || _dataSource$app_data === void 0 ? void 0 : _dataSource$app_data.x_axis) || [], dataSource, userGroup, searchData, showList);
129
74
  return _getColumns;
130
75
  }, [dataSource === null || dataSource === void 0 ? void 0 : (_dataSource$app_data2 = dataSource.app_data) === null || _dataSource$app_data2 === void 0 ? void 0 : _dataSource$app_data2.x_axis, showList, sortTable, panelName]);
131
76
 
132
77
  // 监听分页变化,如果页码发生变化则调用合并行方法
133
78
  var onChangeTable = function onChangeTable(pagination) {
134
- var startNum = (pagination.current - 1) * pagination.pageSize;
135
- var endNum = pagination.current * pagination.pageSize;
136
79
  setPageData({
137
80
  pageSize: pagination.pageSize,
138
81
  current: pagination.current
139
82
  });
140
- setTableData(searchTable === null || searchTable === void 0 ? void 0 : searchTable.slice(startNum, endNum));
141
83
  };
142
84
 
143
85
  // 下载数据
@@ -191,7 +133,7 @@ var EventTable = function EventTable(props) {
191
133
  rowKey: "key",
192
134
  scroll: {
193
135
  x: 800,
194
- y: 200
136
+ y: 550
195
137
  },
196
138
  onChange: onChangeTable
197
139
  }));
@@ -1,4 +1,4 @@
1
- .mi-table {
1
+ .mi-interval-table {
2
2
  width: 100%;
3
3
  margin-top: 16px;
4
4
 
@@ -16,7 +16,7 @@ import { BizAddToPanel, BizAddToScene, BizGlobalDataContext } from '@zgfe/busine
16
16
  import "./styles/index.less";
17
17
  import { EventContext } from "../../types";
18
18
  import { chartTypes, platformOption } from "../../constants/fields";
19
- var classPrefix = 'modules-event-topbar';
19
+ var classPrefix = 'modules-interval-topbar';
20
20
  var TopBar = function TopBar(props) {
21
21
  // console.log('TopBar', props);
22
22
  var _useContext = useContext(EventContext),
@@ -1,6 +1,6 @@
1
1
  @import '~@zgfe/business-lib/es/assets/styles/inner.less';
2
2
 
3
- .modules-event-topbar {
3
+ .modules-interval-topbar {
4
4
  display: flex;
5
5
  justify-content: flex-end;
6
6
  margin: 8px 0;
@@ -18,8 +18,7 @@ import { Apis } from "../../constants";
18
18
  import { Spin } from 'antd';
19
19
  import IntervalChart from "./intervalChart";
20
20
  var EventChart = function EventChart(props) {
21
- var _dataSource$app_data, _dataSource$app_data$;
22
- console.log(888811111, props);
21
+ var _dataSource$app_data;
23
22
  var params = props.params;
24
23
  // 显示内容
25
24
  var _useState = useState(),
@@ -82,7 +81,7 @@ var EventChart = function EventChart(props) {
82
81
  className: "spin-container"
83
82
  });
84
83
  }
85
- if (!dataSource || !(dataSource !== null && dataSource !== void 0 && (_dataSource$app_data = dataSource.app_data) !== null && _dataSource$app_data !== void 0 && (_dataSource$app_data$ = _dataSource$app_data.series) !== null && _dataSource$app_data$ !== void 0 && _dataSource$app_data$.length)) {
84
+ if (!dataSource || !(dataSource !== null && dataSource !== void 0 && (_dataSource$app_data = dataSource.app_data) !== null && _dataSource$app_data !== void 0 && _dataSource$app_data.series.length)) {
86
85
  return /*#__PURE__*/React.createElement(MiNone, {
87
86
  label: "\u6682\u65E0\u6570\u636E"
88
87
  });
@@ -25,7 +25,7 @@ var timer = 0;
25
25
  var ajaxFlag = true;
26
26
  var CancelToken = Request.CancelToken;
27
27
  var cancel;
28
- var classPrefix = 'event-content';
28
+ var classPrefix = 'interval-content';
29
29
  var EventContent = function EventContent(props) {
30
30
  // console.log('EventContent', props);
31
31
  // 最后的查询数据(防止图表在还没查询时就改变了类型)
@@ -117,8 +117,10 @@ var EventContent = function EventContent(props) {
117
117
  return message.error('您查询的属性不一致,暂不支持查询');
118
118
  }
119
119
  var params = searchDataParams(searchData);
120
- // const params = {"app_id":177,"platform":0,"user_group":0,"time":{"dimension_date":"week","begin_date":"2023-08-07","end_date":"2023-09-05"},"start":{"operator":"and","event_id":16530,"event_name":"查看商品A"},"end":{"operator":"and","event_id":16530,"event_name":"查看商品A"},"dimension":{"sub":"user_attr","category":"fixed","user_attr":"name"}}
120
+
121
+ // const params = {"app_id":501909,"platform":0,"user_group":0,"time":{"dimension_date":"day","begin_date":"2023-08-08","end_date":"2023-09-07"},"start":{"operator":"and","event_id":48618641,"event_name":"Webhook事件"},"end":{"operator":"and","event_id":48618641,"event_name":"Webhook事件"}}
121
122
  props.onChange && props.onChange(searchData);
123
+ console.log(77771111, searchData, params);
122
124
  ajax(Apis.dataList, {
123
125
  method: 'post',
124
126
  data: _objectSpread({
@@ -1,4 +1,4 @@
1
- .event-content {
1
+ .interval-content {
2
2
  &-options {
3
3
  display: flex;
4
4
  justify-content: flex-end;
@@ -18,7 +18,7 @@ import { EventContext } from "../../types";
18
18
  import { getInitDate } from "../../constants/initData";
19
19
  import EventContent from "../content";
20
20
  import { chartTypes } from "../../constants";
21
- var classPrefix = 'event-container';
21
+ var classPrefix = 'interval-container';
22
22
  var ModuleInterval = function ModuleInterval(props) {
23
23
  // 属性
24
24
  var _useContext = useContext(BizGlobalDataContext),
@@ -3,7 +3,7 @@
3
3
  padding: 0;
4
4
  }
5
5
 
6
- .event-container {
6
+ .interval-container {
7
7
  width: 100%;
8
8
  min-width: 1000px;
9
9
  height: 100%;
@@ -1,7 +1,11 @@
1
- .event-form-data {
1
+ .interval-form-data {
2
2
  &-table-td {
3
3
  padding: 0 !important;
4
4
 
5
+ .ant-table-column-sorters {
6
+ justify-content: end !important;
7
+ }
8
+
5
9
  &-show {
6
10
  display: flex;
7
11
  align-items: center;
@@ -9,6 +13,7 @@
9
13
  min-width: 60px;
10
14
  height: 48px;
11
15
  cursor: pointer;
16
+
12
17
  span {
13
18
  width: 10px;
14
19
  height: 10px;
@@ -20,6 +25,7 @@
20
25
  &-name {
21
26
  display: flex;
22
27
  align-items: center;
28
+
23
29
  .bsicon {
24
30
  margin-right: 4px;
25
31
  color: #fd9f41;
@@ -37,6 +43,7 @@
37
43
 
38
44
  &-link {
39
45
  cursor: pointer;
46
+
40
47
  &:hover {
41
48
  color: #165dff;
42
49
  text-decoration: underline;
@@ -70,9 +70,9 @@ type ChartData = {
70
70
  };
71
71
  export declare function convertDateArray(params: SearchValue | undefined, dateArray: string[]): string[] | undefined;
72
72
  /**
73
- * 获取查询结果的前10条
73
+ * 获取查询结果
74
74
  * @param source 结果数据
75
- * @returns 获取查询结果的前10条
75
+ * @returns 获取查询结果
76
76
  */
77
77
  export declare function getDefaultShow(source: ResponseDataProps, data: DisplaySetup[]): never[] | {
78
78
  app_data: any;
@@ -14,7 +14,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
14
  import React from 'react';
15
15
  import { chartColors } from "../constants/color";
16
16
  import "../style/index.less";
17
- var classPrefix = 'event-form-data';
17
+ var classPrefix = 'interval-form-data';
18
18
  function convertToHMS(seconds) {
19
19
  var hours = Math.floor(seconds / 3600);
20
20
  var h = hours ? hours + '时' : '';
@@ -49,9 +49,13 @@ export function getColumns(eventGroupList, userPropList, eventEnvList, columnDat
49
49
  title: '最大值',
50
50
  width: 148,
51
51
  ellipsis: true,
52
- align: 'center',
52
+ align: 'right',
53
53
  dataIndex: 'min',
54
54
  key: 'min',
55
+ sorter: function sorter(a, b) {
56
+ var _a$min, _b$min;
57
+ return ((_a$min = a === null || a === void 0 ? void 0 : a.min) !== null && _a$min !== void 0 ? _a$min : 0) - ((_b$min = b === null || b === void 0 ? void 0 : b.min) !== null && _b$min !== void 0 ? _b$min : 0);
58
+ },
55
59
  className: "".concat(classPrefix, "-table-td"),
56
60
  render: function render(text, record) {
57
61
  return /*#__PURE__*/React.createElement("span", null, " ", convertToHMS(text));
@@ -60,9 +64,13 @@ export function getColumns(eventGroupList, userPropList, eventEnvList, columnDat
60
64
  title: '上四分位',
61
65
  width: 148,
62
66
  ellipsis: true,
63
- align: 'center',
67
+ align: 'right',
64
68
  key: 'Q1',
65
69
  dataIndex: 'Q1',
70
+ sorter: function sorter(a, b) {
71
+ var _a$min2, _b$min2;
72
+ return ((_a$min2 = a === null || a === void 0 ? void 0 : a.min) !== null && _a$min2 !== void 0 ? _a$min2 : 0) - ((_b$min2 = b === null || b === void 0 ? void 0 : b.min) !== null && _b$min2 !== void 0 ? _b$min2 : 0);
73
+ },
66
74
  className: "".concat(classPrefix, "-table-td"),
67
75
  render: function render(text, record) {
68
76
  return /*#__PURE__*/React.createElement("span", null, " ", convertToHMS(text));
@@ -71,8 +79,12 @@ export function getColumns(eventGroupList, userPropList, eventEnvList, columnDat
71
79
  title: '中位数',
72
80
  width: 148,
73
81
  ellipsis: true,
74
- align: 'center',
82
+ align: 'right',
75
83
  dataIndex: 'median',
84
+ sorter: function sorter(a, b) {
85
+ var _a$min3, _b$min3;
86
+ return ((_a$min3 = a === null || a === void 0 ? void 0 : a.min) !== null && _a$min3 !== void 0 ? _a$min3 : 0) - ((_b$min3 = b === null || b === void 0 ? void 0 : b.min) !== null && _b$min3 !== void 0 ? _b$min3 : 0);
87
+ },
76
88
  key: 'median',
77
89
  className: "".concat(classPrefix, "-table-td"),
78
90
  render: function render(text, record) {
@@ -82,8 +94,12 @@ export function getColumns(eventGroupList, userPropList, eventEnvList, columnDat
82
94
  title: '下四分位',
83
95
  width: 148,
84
96
  ellipsis: true,
85
- align: 'center',
97
+ align: 'right',
86
98
  dataIndex: 'Q3',
99
+ sorter: function sorter(a, b) {
100
+ var _a$min4, _b$min4;
101
+ return ((_a$min4 = a === null || a === void 0 ? void 0 : a.min) !== null && _a$min4 !== void 0 ? _a$min4 : 0) - ((_b$min4 = b === null || b === void 0 ? void 0 : b.min) !== null && _b$min4 !== void 0 ? _b$min4 : 0);
102
+ },
87
103
  key: 'Q3',
88
104
  className: "".concat(classPrefix, "-table-td"),
89
105
  render: function render(text, record) {
@@ -93,8 +109,12 @@ export function getColumns(eventGroupList, userPropList, eventEnvList, columnDat
93
109
  title: '最小值',
94
110
  width: 148,
95
111
  ellipsis: true,
96
- align: 'center',
112
+ align: 'right',
97
113
  key: 'max',
114
+ sorter: function sorter(a, b) {
115
+ var _a$min5, _b$min5;
116
+ return ((_a$min5 = a === null || a === void 0 ? void 0 : a.min) !== null && _a$min5 !== void 0 ? _a$min5 : 0) - ((_b$min5 = b === null || b === void 0 ? void 0 : b.min) !== null && _b$min5 !== void 0 ? _b$min5 : 0);
117
+ },
98
118
  dataIndex: 'max',
99
119
  className: "".concat(classPrefix, "-table-td"),
100
120
  render: function render(text, record) {
@@ -104,8 +124,12 @@ export function getColumns(eventGroupList, userPropList, eventEnvList, columnDat
104
124
  title: '人均值',
105
125
  width: 148,
106
126
  ellipsis: true,
107
- align: 'center',
127
+ align: 'right',
108
128
  dataIndex: 'perValue',
129
+ sorter: function sorter(a, b) {
130
+ var _a$min6, _b$min6;
131
+ return ((_a$min6 = a === null || a === void 0 ? void 0 : a.min) !== null && _a$min6 !== void 0 ? _a$min6 : 0) - ((_b$min6 = b === null || b === void 0 ? void 0 : b.min) !== null && _b$min6 !== void 0 ? _b$min6 : 0);
132
+ },
109
133
  key: 'perValue',
110
134
  className: "".concat(classPrefix, "-table-td"),
111
135
  render: function render(text, record) {
@@ -115,8 +139,12 @@ export function getColumns(eventGroupList, userPropList, eventEnvList, columnDat
115
139
  title: '人数',
116
140
  width: 148,
117
141
  ellipsis: true,
118
- align: 'center',
142
+ align: 'right',
119
143
  dataIndex: 'peopleNum',
144
+ sorter: function sorter(a, b) {
145
+ var _a$min7, _b$min7;
146
+ return ((_a$min7 = a === null || a === void 0 ? void 0 : a.min) !== null && _a$min7 !== void 0 ? _a$min7 : 0) - ((_b$min7 = b === null || b === void 0 ? void 0 : b.min) !== null && _b$min7 !== void 0 ? _b$min7 : 0);
147
+ },
120
148
  key: 'peopleNum',
121
149
  className: "".concat(classPrefix, "-table-td"),
122
150
  render: function render(text, record) {
@@ -223,17 +251,21 @@ function getChildrenData(data, index) {
223
251
  return [];
224
252
  }
225
253
  /**
226
- * 获取查询结果的前10条
254
+ * 获取查询结果
227
255
  * @param source 结果数据
228
- * @returns 获取查询结果的前10条
256
+ * @returns 获取查询结果
229
257
  */
230
258
  export function getDefaultShow(source, data) {
231
259
  if (source.app_data.series) {
232
260
  var filteredArr = source.app_data.series.filter(function (obj) {
233
261
  var names = obj.names;
234
- return data.some(function (item) {
235
- return names.includes(item.label);
236
- });
262
+ if (!names) {
263
+ return data.some(function (item) {
264
+ return names.includes(item.label);
265
+ });
266
+ } else {
267
+ return obj;
268
+ }
237
269
  });
238
270
  return _objectSpread(_objectSpread({}, source), {}, {
239
271
  app_data: _objectSpread(_objectSpread({}, source.app_data), {}, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/modules-interval",
3
- "version": "1.0.0-interval.5",
3
+ "version": "1.0.0-interval.6",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",