@zgfe/modules-attribution 1.0.1-alpha.8 → 1.0.2-alpha.0

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 (46) hide show
  1. package/es/components/option/index.js +12 -5
  2. package/es/components/option/types.d.ts +3 -6
  3. package/es/components/searchTime/index.js +12 -5
  4. package/es/components/tableList/index.d.ts +2 -2
  5. package/es/components/tableList/index.js +12 -3
  6. package/es/components/tableList/styles/index.less +9 -1
  7. package/es/components/title/index.js +6 -5
  8. package/es/constants/apis.d.ts +0 -4
  9. package/es/constants/apis.js +0 -4
  10. package/es/constants/fields.d.ts +0 -139
  11. package/es/constants/fields.js +1 -148
  12. package/es/constants/index.d.ts +2 -4
  13. package/es/constants/index.js +2 -4
  14. package/es/images/empty.png +0 -0
  15. package/es/modules/content/index.d.ts +3 -3
  16. package/es/modules/content/index.js +42 -44
  17. package/es/modules/content/types.d.ts +3 -3
  18. package/es/modules/content/utils.d.ts +0 -6
  19. package/es/modules/content/utils.js +0 -163
  20. package/es/modules/home/demo/create.js +5 -35
  21. package/es/modules/home/demo/edit.js +61 -105
  22. package/es/modules/home/demo/index.js +4 -36
  23. package/es/modules/home/demo/scene.js +4 -34
  24. package/es/modules/home/index.d.ts +2 -2
  25. package/es/modules/home/index.js +13 -17
  26. package/es/modules/home/styles/index.less +2 -1
  27. package/es/modules/home/types.d.ts +1 -5
  28. package/es/modules/searchPanel/components/attributableEvents.js +117 -54
  29. package/es/modules/searchPanel/components/globalAttribute.d.ts +3 -1
  30. package/es/modules/searchPanel/components/globalAttribute.js +8 -4
  31. package/es/modules/searchPanel/components/targetEvent.js +28 -21
  32. package/es/modules/searchPanel/index.d.ts +1 -1
  33. package/es/modules/searchPanel/index.js +120 -78
  34. package/es/modules/searchPanel/types.d.ts +24 -10
  35. package/es/modules/searchPanel/utils.d.ts +8 -5
  36. package/es/modules/searchPanel/utils.js +51 -102
  37. package/es/types.d.ts +29 -39
  38. package/package.json +3 -3
  39. package/es/constants/chart.d.ts +0 -2
  40. package/es/constants/chart.js +0 -24
  41. package/es/constants/color.d.ts +0 -1
  42. package/es/constants/color.js +0 -1
  43. package/es/modules/searchPanel/demo/index.d.ts +0 -2
  44. package/es/modules/searchPanel/demo/index.js +0 -28
  45. package/es/utils/transfer.d.ts +0 -65
  46. package/es/utils/transfer.js +0 -173
@@ -15,7 +15,8 @@ import './styles/index.less';
15
15
  import { AttributableContext } from '../../types';
16
16
  var classPrefix = 'option-group';
17
17
  var OptionGroup = /*#__PURE__*/React.forwardRef(function (props, ref) {
18
- var searchData = props.searchData;
18
+ var searchData = props.searchData,
19
+ _onGetSearchData = props.onGetSearchData;
19
20
  var _useState = useState(false),
20
21
  _useState2 = _slicedToArray(_useState, 2),
21
22
  showPanelDialog = _useState2[0],
@@ -38,6 +39,7 @@ var OptionGroup = /*#__PURE__*/React.forwardRef(function (props, ref) {
38
39
  panelId = _useContext2.panelId,
39
40
  panelName = _useContext2.panelName,
40
41
  elementId = _useContext2.elementId,
42
+ buttonDisable = _useContext2.buttonDisable,
41
43
  searching = _useContext2.searching,
42
44
  enableAddScene = _useContext2.enableAddScene,
43
45
  afterEditTarget = _useContext2.afterEditTarget;
@@ -63,6 +65,9 @@ var OptionGroup = /*#__PURE__*/React.forwardRef(function (props, ref) {
63
65
  setPanelValue(item);
64
66
  setShowPanelDialog(true);
65
67
  setPanelType('edit');
68
+ },
69
+ onGetSearchData: function onGetSearchData() {
70
+ _onGetSearchData && _onGetSearchData();
66
71
  }
67
72
  };
68
73
  });
@@ -86,22 +91,24 @@ var OptionGroup = /*#__PURE__*/React.forwardRef(function (props, ref) {
86
91
  return /*#__PURE__*/React.createElement("div", {
87
92
  className: classPrefix
88
93
  }, !panelId && enableAddScene && /*#__PURE__*/React.createElement(Button, {
89
- disabled: searching,
94
+ disabled: buttonDisable || searching,
90
95
  icon: /*#__PURE__*/React.createElement(IconFont, {
91
96
  className: "".concat(classPrefix, "-icon"),
92
97
  type: "tianjia2"
93
98
  }),
94
99
  onClick: function onClick() {
95
- return setShowSceneDialog(true);
100
+ _onGetSearchData && _onGetSearchData();
101
+ setShowSceneDialog(true);
96
102
  }
97
103
  }, "\u6DFB\u52A0\u5230\u5E38\u7528\u573A\u666F"), !panelId && /*#__PURE__*/React.createElement(Button, {
98
- disabled: searching,
104
+ disabled: buttonDisable || searching,
99
105
  icon: /*#__PURE__*/React.createElement(IconFont, {
100
106
  className: "".concat(classPrefix, "-icon"),
101
107
  type: "tianjia2"
102
108
  }),
103
109
  onClick: function onClick() {
104
- return setShowPanelDialog(true);
110
+ _onGetSearchData && _onGetSearchData();
111
+ setShowPanelDialog(true);
105
112
  }
106
113
  }, "\u6DFB\u52A0\u5230\u770B\u677F"), showSceneDialog && /*#__PURE__*/React.createElement(BizAddToScene, {
107
114
  params: _objectSpread({
@@ -1,8 +1,5 @@
1
+ import { SearchValueProps } from '../../types';
1
2
  export interface OptionGroupProps {
2
- value?: any;
3
- title?: string;
4
- searchData: any;
5
- result?: any;
6
- enableSelectChart?: boolean;
7
- onClickGenerateReport?: (value: any) => void;
3
+ searchData: SearchValueProps;
4
+ onGetSearchData?: Function;
8
5
  }
@@ -5,15 +5,15 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
5
5
  function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
6
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
7
  import { BizDatePicker } from '@zgfe/business-lib';
8
- import React, { useContext, useState } from 'react';
8
+ import React, { useContext, useState, useEffect } from 'react';
9
9
  import { getInitDate } from '../../constants';
10
10
  import { AttributableContext } from '../../types';
11
11
  import './styles/index.less';
12
+ import _ from 'lodash';
12
13
  var classPrefix = 'search-panel';
13
14
  var SearchTime = function SearchTime(props) {
14
15
  var _useContext = useContext(AttributableContext),
15
16
  includeToday = _useContext.includeToday;
16
- console.log('当前时间段', getInitDate(includeToday), props.time);
17
17
  var _useState = useState(props.time || getInitDate(includeToday)),
18
18
  _useState2 = _slicedToArray(_useState, 2),
19
19
  time = _useState2[0],
@@ -22,8 +22,14 @@ var SearchTime = function SearchTime(props) {
22
22
  _useState4 = _slicedToArray(_useState3, 2),
23
23
  timer = _useState4[0],
24
24
  setTimer = _useState4[1];
25
+ useEffect(function () {
26
+ if (props.time === undefined) {
27
+ var _time = props.time || getInitDate(includeToday);
28
+ setTime(_.cloneDeep(_time));
29
+ }
30
+ }, [props.time]);
25
31
  var onChangeTime = function onChangeTime(val) {
26
- console.log(333, val);
32
+ setTime(val);
27
33
  if (timer) clearTimeout(timer);
28
34
  setTimer(setTimeout(function () {
29
35
  setTime(val);
@@ -35,8 +41,9 @@ var SearchTime = function SearchTime(props) {
35
41
  return /*#__PURE__*/React.createElement("div", {
36
42
  className: classPrefix
37
43
  }, /*#__PURE__*/React.createElement(BizDatePicker, {
38
- defaultValue: time,
39
- onChange: onChangeTime
44
+ value: time,
45
+ onChange: onChangeTime,
46
+ selectRange: 365
40
47
  }));
41
48
  };
42
49
  export default SearchTime;
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import './styles/index.less';
3
- import { TableDataHandleProps } from '../../types';
3
+ import { TableDataProps } from '../../types';
4
4
  declare const TableList: React.FC<{
5
5
  total: number;
6
- tableDataList: TableDataHandleProps;
6
+ tableDataList: TableDataProps;
7
7
  }>;
8
8
  export default TableList;
@@ -1,13 +1,21 @@
1
- import React from 'react';
1
+ import React, { useContext } from 'react';
2
2
  import { Table } from 'antd';
3
3
  import './styles/index.less';
4
+ import { AttributableContext } from '../../types';
5
+ import empty from '../../images/empty.png';
4
6
  var TableList = function TableList(props) {
5
7
  var classPrefix = 'table-list';
6
8
  var tableDataList = props.tableDataList,
7
9
  total = props.total;
10
+ var _useContext = useContext(AttributableContext),
11
+ searching = _useContext.searching;
8
12
  return /*#__PURE__*/React.createElement("div", {
9
13
  className: classPrefix
10
- }, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Table, {
14
+ }, !tableDataList.dataSource && !searching && /*#__PURE__*/React.createElement("div", {
15
+ className: "".concat(classPrefix, "-empty-tips")
16
+ }, /*#__PURE__*/React.createElement("img", {
17
+ src: empty
18
+ }), /*#__PURE__*/React.createElement("p", null, "\u8BF7\u9009\u62E9\u6761\u4EF6\u8FDB\u884C\u67E5\u8BE2")), (tableDataList.dataSource || searching) && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Table, {
11
19
  dataSource: tableDataList.dataSource,
12
20
  columns: tableDataList.columns,
13
21
  rowKey: "key",
@@ -17,7 +25,8 @@ var TableList = function TableList(props) {
17
25
  },
18
26
  showQuickJumper: true,
19
27
  showSizeChanger: total > 10
20
- }
28
+ },
29
+ loading: searching
21
30
  })));
22
31
  };
23
32
  export default TableList;
@@ -1,7 +1,15 @@
1
1
  .table-list {
2
2
  margin-top: 25px;
3
3
  &-empty-tips {
4
- margin-top: 150px;
4
+ margin-top: 112px;
5
5
  text-align: center;
6
+ img{
7
+ width: 88px;
8
+ height: 88px;
9
+ }
10
+ p{
11
+ color: #354354;
12
+ line-height: 20px;
13
+ }
6
14
  }
7
15
  }
@@ -30,7 +30,8 @@ var EditTitle = function EditTitle(props) {
30
30
  panelName = _useContext.panelName,
31
31
  changeLoading = _useContext.changeLoading,
32
32
  afterEditTarget = _useContext.afterEditTarget,
33
- searching = _useContext.searching;
33
+ searching = _useContext.searching,
34
+ buttonDisable = _useContext.buttonDisable;
34
35
  var inputRef = useRef(null);
35
36
  var menu = /*#__PURE__*/React.createElement(Menu, {
36
37
  items: [{
@@ -65,7 +66,7 @@ var EditTitle = function EditTitle(props) {
65
66
  }
66
67
  }).then(function (res) {
67
68
  changeLoading(false);
68
- if (res.flag === 101) {
69
+ if ((res === null || res === void 0 ? void 0 : res.flag) === 101) {
69
70
  message.success('删除成功');
70
71
  callback('delete');
71
72
  } else {
@@ -157,12 +158,12 @@ var EditTitle = function EditTitle(props) {
157
158
  }
158
159
  }, "\u53D6\u6D88"), /*#__PURE__*/React.createElement(Button, {
159
160
  className: "attribution-btn",
160
- disabled: searching || !curTitle,
161
+ disabled: buttonDisable || searching || !curTitle,
161
162
  type: "primary",
162
163
  onClick: onSave
163
164
  }, "\u4FDD\u5B58"), /*#__PURE__*/React.createElement(Button, {
164
165
  className: "attribution-btn",
165
- disabled: searching,
166
+ disabled: buttonDisable || searching,
166
167
  type: "primary",
167
168
  onClick: onSaveAs
168
169
  }, "\u53E6\u5B58\u4E3A")) : /*#__PURE__*/React.createElement("div", {
@@ -175,7 +176,7 @@ var EditTitle = function EditTitle(props) {
175
176
  }
176
177
  }, "\u53D6\u6D88"), /*#__PURE__*/React.createElement(Button, {
177
178
  className: "attribution-btn",
178
- disabled: searching || !curTitle,
179
+ disabled: buttonDisable || searching || !curTitle,
179
180
  type: "primary",
180
181
  onClick: onSaveAs
181
182
  }, "\u4FDD\u5B58")));
@@ -1,10 +1,6 @@
1
1
  declare const Apis: {
2
2
  delPanelElement: string;
3
3
  updateElementName: string;
4
- eventAnalytics: string;
5
- download: string;
6
- queryScenesOfGroup: string;
7
- updateElemet: string;
8
4
  getAnalyseData: string;
9
5
  };
10
6
  export default Apis;
@@ -1,10 +1,6 @@
1
1
  var Apis = {
2
2
  delPanelElement: '/apppanel/delPanelElement.jsp',
3
3
  updateElementName: '/apppanel/updateElementName.jsp',
4
- eventAnalytics: '/zg/web/v2/insight/analysis',
5
- download: '/zg/web/v2/insight/download',
6
- queryScenesOfGroup: '/scene/queryScenesOfGroup.jsp',
7
- updateElemet: '/apppanel/updateElemet.jsp',
8
4
  getAnalyseData: '/zg/web/v2/attribution/getAnalyseData'
9
5
  };
10
6
  export default Apis;
@@ -4,143 +4,4 @@ export declare const chartTypes: {
4
4
  icon: string;
5
5
  value: string;
6
6
  }[];
7
- export declare const addPanelFields: ({
8
- label: string;
9
- name: string;
10
- extendName: string;
11
- type: string;
12
- options: never[];
13
- children: string[];
14
- fieldNames: {
15
- label: string;
16
- value: string;
17
- };
18
- rules: {
19
- required: boolean;
20
- message: string;
21
- }[];
22
- direction?: undefined;
23
- dependenceFields?: undefined;
24
- } | {
25
- label: string;
26
- name: string;
27
- type: string;
28
- rules: {
29
- required: boolean;
30
- message: string;
31
- }[];
32
- extendName?: undefined;
33
- options?: undefined;
34
- children?: undefined;
35
- fieldNames?: undefined;
36
- direction?: undefined;
37
- dependenceFields?: undefined;
38
- } | {
39
- label: string;
40
- name: string;
41
- type: string;
42
- options: {
43
- label: string;
44
- icon: string;
45
- value: string;
46
- }[];
47
- rules: {
48
- required: boolean;
49
- message: string;
50
- }[];
51
- extendName?: undefined;
52
- children?: undefined;
53
- fieldNames?: undefined;
54
- direction?: undefined;
55
- dependenceFields?: undefined;
56
- } | {
57
- label: string;
58
- name: string;
59
- type: string;
60
- direction: string;
61
- dependenceFields: {
62
- chart: string;
63
- };
64
- options: {
65
- label: string;
66
- value: string;
67
- }[];
68
- rules: {
69
- required: boolean;
70
- message: string;
71
- }[];
72
- extendName?: undefined;
73
- children?: undefined;
74
- fieldNames?: undefined;
75
- })[];
76
- export declare const editPanelFields: ({
77
- label: string;
78
- name: string;
79
- type: string;
80
- options: {
81
- label: string;
82
- icon: string;
83
- value: string;
84
- }[];
85
- rules: {
86
- required: boolean;
87
- message: string;
88
- }[];
89
- direction?: undefined;
90
- dependenceFields?: undefined;
91
- } | {
92
- label: string;
93
- name: string;
94
- type: string;
95
- direction: string;
96
- dependenceFields: {
97
- chart: string;
98
- };
99
- options: {
100
- label: string;
101
- value: string;
102
- }[];
103
- rules: {
104
- required: boolean;
105
- message: string;
106
- }[];
107
- })[];
108
- export declare const addSceneFields: ({
109
- label: string;
110
- name: string;
111
- type: string;
112
- options: never[];
113
- fieldNames: {
114
- label: string;
115
- value: string;
116
- };
117
- rules: {
118
- required: boolean;
119
- message: string;
120
- }[];
121
- } | {
122
- label: string;
123
- name: string;
124
- type: string;
125
- rules: {
126
- required: boolean;
127
- message: string;
128
- }[];
129
- options?: undefined;
130
- fieldNames?: undefined;
131
- })[];
132
7
  export declare const searchFields: SearchPanelTypes.FieldProp[];
133
- export declare const indexObject: {
134
- [key: string]: string;
135
- };
136
- export declare const BuiltinIndicators: {
137
- id: number;
138
- name: string;
139
- eventList: {
140
- name: string;
141
- id: number;
142
- type: string;
143
- isBuiltIn: boolean;
144
- attrList: never[];
145
- }[];
146
- };
@@ -3,109 +3,6 @@ export var chartTypes = [{
3
3
  icon: 'biaoge',
4
4
  value: 'grid'
5
5
  }];
6
- export var addPanelFields = [{
7
- label: '看板',
8
- name: 'panel',
9
- extendName: 'range',
10
- type: 'selectToInput',
11
- options: [],
12
- children: ['range'],
13
- fieldNames: {
14
- label: 'name',
15
- value: 'id'
16
- },
17
- rules: [{
18
- required: true,
19
- message: '请选择看板'
20
- }]
21
- }, {
22
- label: '名称',
23
- name: 'name',
24
- type: 'input',
25
- rules: [{
26
- required: true,
27
- message: '请输入名称'
28
- }]
29
- }, {
30
- label: '样式',
31
- name: 'chart',
32
- type: 'tab',
33
- options: chartTypes,
34
- rules: [{
35
- required: true,
36
- message: '请选择图表'
37
- }]
38
- }, {
39
- label: '显示',
40
- name: 'show',
41
- type: 'radio',
42
- direction: 'vertical',
43
- dependenceFields: {
44
- chart: 'line'
45
- },
46
- options: [{
47
- label: '动态显示数据最多的10个分组',
48
- value: 'dynamic'
49
- }, {
50
- label: '固定显示当前选择的分组',
51
- value: 'fix'
52
- }],
53
- rules: [{
54
- required: true,
55
- message: '请选择'
56
- }]
57
- }];
58
- export var editPanelFields = [{
59
- label: '样式',
60
- name: 'chart',
61
- type: 'tab',
62
- options: chartTypes,
63
- rules: [{
64
- required: true,
65
- message: '请选择图表'
66
- }]
67
- }, {
68
- label: '显示',
69
- name: 'show',
70
- type: 'radio',
71
- direction: 'vertical',
72
- dependenceFields: {
73
- chart: 'line'
74
- },
75
- options: [{
76
- label: '动态显示数据最多的10个分组',
77
- value: 'dynamic'
78
- }, {
79
- label: '固定显示当前选择的分组',
80
- value: 'fix'
81
- }],
82
- rules: [{
83
- required: true,
84
- message: '请选择'
85
- }]
86
- }];
87
- export var addSceneFields = [{
88
- label: '场景分类',
89
- name: 'class',
90
- type: 'selectToInput',
91
- options: [],
92
- fieldNames: {
93
- label: 'groupName',
94
- value: 'groupId'
95
- },
96
- rules: [{
97
- required: true,
98
- message: '请选择场景分类'
99
- }]
100
- }, {
101
- label: '场景名称',
102
- name: 'name',
103
- type: 'input',
104
- rules: [{
105
- required: true,
106
- message: '请输入场景名称'
107
- }]
108
- }];
109
6
  export var searchFields = [{
110
7
  key: 'mi-targetFilters',
111
8
  type: 'targetFilters',
@@ -132,48 +29,4 @@ export var searchFields = [{
132
29
  max: 5,
133
30
  addLabel: '添加属性',
134
31
  required: false
135
- }];
136
- export var indexObject = {
137
- number: '人数',
138
- times: '次数',
139
- per: '人均次数',
140
- sum: '总和',
141
- avg: '均值',
142
- duration_times: '分布',
143
- median: '中位数'
144
- };
145
- export var BuiltinIndicators = {
146
- id: -2,
147
- name: '整体',
148
- eventList: [{
149
- name: '新增用户',
150
- id: -201,
151
- type: 'add',
152
- isBuiltIn: true,
153
- attrList: []
154
- }, {
155
- name: '活跃用户',
156
- id: -202,
157
- type: 'active',
158
- isBuiltIn: true,
159
- attrList: []
160
- }, {
161
- name: '访问次数',
162
- id: -203,
163
- type: 'times',
164
- isBuiltIn: true,
165
- attrList: []
166
- }, {
167
- name: '平均使用时长',
168
- id: -204,
169
- type: 'duration_avg',
170
- isBuiltIn: true,
171
- attrList: []
172
- }, {
173
- name: '使用时长分布',
174
- id: -205,
175
- type: 'duration',
176
- isBuiltIn: true,
177
- attrList: []
178
- }]
179
- };
32
+ }];
@@ -1,6 +1,4 @@
1
1
  import Apis from './apis';
2
- import { chartTypeOptions } from './chart';
3
- import { chartColors } from './color';
4
- import { chartTypes, addPanelFields, editPanelFields, addSceneFields, searchFields } from './fields';
2
+ import { chartTypes, searchFields } from './fields';
5
3
  import { initTarget, initEvent, getInitDate } from './initData';
6
- export { Apis, chartTypeOptions, chartColors, chartTypes, addPanelFields, editPanelFields, addSceneFields, searchFields, initTarget, initEvent, getInitDate, };
4
+ export { Apis, chartTypes, searchFields, initTarget, initEvent, getInitDate, };
@@ -1,6 +1,4 @@
1
1
  import Apis from './apis';
2
- import { chartTypeOptions } from './chart';
3
- import { chartColors } from './color';
4
- import { chartTypes, addPanelFields, editPanelFields, addSceneFields, searchFields } from './fields';
2
+ import { chartTypes, searchFields } from './fields';
5
3
  import { initTarget, initEvent, getInitDate } from './initData';
6
- export { Apis, chartTypeOptions, chartColors, chartTypes, addPanelFields, editPanelFields, addSceneFields, searchFields, initTarget, initEvent, getInitDate };
4
+ export { Apis, chartTypes, searchFields, initTarget, initEvent, getInitDate };
Binary file
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { InsightContentProps } from './types';
2
+ import { attributionContentProps } from './types';
3
3
  import './styles/index.less';
4
- declare const InsightContent: React.ForwardRefExoticComponent<InsightContentProps.Props & React.RefAttributes<any>>;
5
- export default InsightContent;
4
+ declare const AttributionContent: React.ForwardRefExoticComponent<attributionContentProps.Props & React.RefAttributes<any>>;
5
+ export default AttributionContent;