@zgfe/modules-event 0.0.2-event.9 → 0.1.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 (45) hide show
  1. package/es/components/eventFilter/index.js +49 -20
  2. package/es/components/eventFilter/styles/index.less +6 -3
  3. package/es/components/eventFilter/types.d.ts +4 -0
  4. package/es/components/index.d.ts +1 -2
  5. package/es/components/index.js +1 -2
  6. package/es/components/renderContent/index.d.ts +1 -1
  7. package/es/components/renderContent/index.js +19 -18
  8. package/es/components/renderContent/styles/index.less +3 -8
  9. package/es/components/renderContent/types.d.ts +0 -1
  10. package/es/components/searchPanel/index.js +24 -6
  11. package/es/components/searchPanel/types.d.ts +2 -0
  12. package/es/components/table/index.js +16 -20
  13. package/es/components/table/styles/index.less +73 -7
  14. package/es/components/table/types.d.ts +1 -0
  15. package/es/components/topBar/index.js +42 -27
  16. package/es/components/topBar/styles/index.less +14 -0
  17. package/es/components/topBar/types.d.ts +4 -1
  18. package/es/constants/fields.js +4 -4
  19. package/es/modules/chart/index.d.ts +1 -1
  20. package/es/modules/chart/index.js +53 -41
  21. package/es/modules/chart/types.d.ts +1 -0
  22. package/es/modules/content/index.js +72 -57
  23. package/es/modules/content/types.d.ts +1 -2
  24. package/es/modules/content/utils.d.ts +6 -1
  25. package/es/modules/content/utils.js +30 -3
  26. package/es/modules/home/demo/create.js +10 -2
  27. package/es/modules/home/demo/edit.js +56 -32
  28. package/es/modules/home/demo/index.js +4 -0
  29. package/es/modules/home/demo/scene.js +4 -0
  30. package/es/modules/home/index.js +67 -34
  31. package/es/modules/home/styles/index.less +7 -2
  32. package/es/modules/home/types.d.ts +5 -0
  33. package/es/modules/topPanel/index.js +39 -31
  34. package/es/modules/topPanel/styles/index.less +11 -1
  35. package/es/modules/topPanel/types.d.ts +7 -4
  36. package/es/style/index.less +6 -3
  37. package/es/types.d.ts +2 -0
  38. package/es/utils/formData.d.ts +8 -1
  39. package/es/utils/formData.js +139 -30
  40. package/package.json +3 -3
  41. package/es/components/common/index.d.ts +0 -6
  42. package/es/components/common/index.js +0 -17
  43. package/es/components/common/styles/index.less +0 -27
  44. package/es/components/table/images/empty.png +0 -0
  45. package/es/style/image/noData.png +0 -0
@@ -1,6 +1,7 @@
1
1
  import { util, IconFont } from '@zgfe/business-lib';
2
2
  import React from 'react';
3
3
  import { message } from 'antd';
4
+ import _ from 'lodash';
4
5
  import { CopyToClipboard } from 'react-copy-to-clipboard';
5
6
  import { chartColors } from '../constants/color';
6
7
  import { PropCategory } from '@zgfe/business-lib/es/attributeSelector/types';
@@ -8,7 +9,7 @@ import { Tooltip } from 'antd';
8
9
  import '../style/index.less';
9
10
  import { getValue } from '../modules/content/utils';
10
11
  var classPrefix = 'event-form-data';
11
- export function getColumns(eventGroupList, userPropList, eventEnvList, columnData, userGroup, searchData, showList, onShowCallback, onClickToDetailCallback) {
12
+ export function getColumns(eventGroupList, userPropList, eventEnvList, columnData, userGroup, searchData, showList, onShowCallback, onClickToDetailCallback, onSelectEvent) {
12
13
  var marketEventNameList = marketEventGroupList(eventGroupList);
13
14
  var data = [{
14
15
  title: '显示',
@@ -58,46 +59,61 @@ export function getColumns(eventGroupList, userPropList, eventEnvList, columnDat
58
59
  ellipsis: true,
59
60
  fixed: true,
60
61
  render: function render(val) {
61
- return /*#__PURE__*/React.createElement(Tooltip, {
62
+ return /*#__PURE__*/React.createElement("div", {
63
+ className: "tooltip-name-box"
64
+ }, /*#__PURE__*/React.createElement(Tooltip, {
62
65
  title: val
63
- }, util.strMiddleSplit(val, {
64
- maxLength: 20,
65
- beginLength: 10,
66
- endLength: 6,
67
- replaceStr: '...'
68
- }));
66
+ }, /*#__PURE__*/React.createElement("div", {
67
+ className: "tooltip-name-box-market"
68
+ }, val)), /*#__PURE__*/React.createElement(Tooltip, {
69
+ title: "\u590D\u5236"
70
+ }, /*#__PURE__*/React.createElement(CopyToClipboard, {
71
+ text: val,
72
+ onCopy: function onCopy() {
73
+ return message.success('复制成功!');
74
+ }
75
+ }, /*#__PURE__*/React.createElement(IconFont, {
76
+ type: "fuzhi1"
77
+ }))));
69
78
  }
70
79
  });
71
80
  }
72
81
  if (searchData.id && !searchData.dimension || !searchData.id) {
73
82
  data.push({
74
- title: '事件',
83
+ title: /*#__PURE__*/React.createElement("div", {
84
+ style: {
85
+ paddingLeft: '16px'
86
+ }
87
+ }, "\u4E8B\u4EF6"),
75
88
  width: 150,
76
89
  dataIndex: 'eventName',
77
90
  key: 'eventName',
78
91
  ellipsis: true,
79
92
  fixed: true,
80
93
  render: function render(val) {
81
- return /*#__PURE__*/React.createElement(Tooltip, {
82
- className: "event-name-box",
83
- title: val
94
+ var _val = val;
95
+ return /*#__PURE__*/React.createElement("div", {
96
+ className: "tooltip-name-box"
97
+ }, /*#__PURE__*/React.createElement(Tooltip, {
98
+ title: _val
84
99
  }, /*#__PURE__*/React.createElement("div", {
85
- className: "event-name-box-market"
86
- }, marketEventNameList.indexOf(val) !== -1 && /*#__PURE__*/React.createElement(IconFont, {
87
- type: "shoucang"
88
- }), util.strMiddleSplit(val, {
89
- maxLength: 20,
90
- beginLength: 10,
91
- endLength: 6,
92
- replaceStr: '...'
93
- })), /*#__PURE__*/React.createElement(CopyToClipboard, {
94
- text: val,
100
+ className: "tooltip-name-box-market",
101
+ onClick: function onClick() {
102
+ onSelectEvent && onSelectEvent(getEventAliasId(val, eventGroupList), val);
103
+ }
104
+ }, /*#__PURE__*/React.createElement(IconFont, {
105
+ type: "shoucang",
106
+ className: "".concat(marketEventNameList.indexOf(_val) === -1 ? 'notshoucang' : '')
107
+ }), _val)), /*#__PURE__*/React.createElement(Tooltip, {
108
+ title: "\u590D\u5236"
109
+ }, /*#__PURE__*/React.createElement(CopyToClipboard, {
110
+ text: _val,
95
111
  onCopy: function onCopy() {
96
112
  return message.success('复制成功!');
97
113
  }
98
114
  }, /*#__PURE__*/React.createElement(IconFont, {
99
115
  type: "fuzhi1"
100
- })));
116
+ }))));
101
117
  }
102
118
  });
103
119
  }
@@ -127,12 +143,13 @@ export function getColumns(eventGroupList, userPropList, eventEnvList, columnDat
127
143
  return a["field".concat(i)] - b["field".concat(i)];
128
144
  },
129
145
  render: function render(text, record) {
146
+ var click = text > 0 && (searchData.analysisIndex === 'number' ? true : false);
130
147
  return /*#__PURE__*/React.createElement("div", {
131
- className: "".concat(classPrefix, "-table-td-link"),
148
+ className: "".concat(classPrefix, "-table-td-link ").concat(click ? '' : 'not-to-detail'),
132
149
  onClick: function onClick() {
133
- return onClickToDetailCallback(record, columnData[i], text);
150
+ click ? onClickToDetailCallback(record, columnData[i], text) : null;
134
151
  }
135
- }, /*#__PURE__*/React.createElement(IconFont, {
152
+ }, click && /*#__PURE__*/React.createElement(IconFont, {
136
153
  type: "a-yanjingkai"
137
154
  }), text);
138
155
  }
@@ -143,6 +160,75 @@ export function getColumns(eventGroupList, userPropList, eventEnvList, columnDat
143
160
  }
144
161
  return data;
145
162
  }
163
+ export function getChartDataEventAliasName(dataSource, eventGroupList) {
164
+ var data = _.cloneDeep(dataSource);
165
+ var series = [];
166
+ data.series.map(function (item) {
167
+ item.originalNames = item.names;
168
+ item.names = item.names.length > 1 ? [item.names[0], getEventAliasName(item.names[1], eventGroupList)] : [getEventAliasName(item.names[0], eventGroupList)];
169
+ series.push(item);
170
+ });
171
+ data.series = series;
172
+ return data;
173
+ }
174
+ export function getEventAliasName(name, eventGroupList) {
175
+ var aliasName = '';
176
+ eventGroupList && eventGroupList.map(function (item) {
177
+ item.eventList.map(function (_item) {
178
+ if (_item.name === name) {
179
+ aliasName = _item.alias ? _item.alias : name;
180
+ }
181
+ });
182
+ });
183
+ return aliasName;
184
+ }
185
+ export function getEventAliasId(name, eventGroupList) {
186
+ var eventId = -1;
187
+ eventGroupList && eventGroupList.map(function (item) {
188
+ item.eventList.map(function (_item) {
189
+ if (_item.name === name) {
190
+ eventId = _item.id;
191
+ }
192
+ });
193
+ });
194
+ return eventId;
195
+ }
196
+ export function getSortData(data) {
197
+ var series = data.series;
198
+ var sort = function sort(obj1, obj2) {
199
+ var val1 = obj1.values[0];
200
+ var val2 = obj2.values[0];
201
+ if (val1 < val2) {
202
+ return 1;
203
+ } else if (val1 > val2) {
204
+ return -1;
205
+ } else {
206
+ return 0;
207
+ }
208
+ };
209
+ series.sort(sort);
210
+ return data;
211
+ }
212
+ export function getUserGroupsCompareData(data) {
213
+ if (data.series.length <= 0) {
214
+ return data;
215
+ } else {
216
+ var _data = _.cloneDeep(data);
217
+ var _series = [];
218
+ _data.series.map(function (item, index) {
219
+ _series.push(item);
220
+ _data.series.map(function (_item, _index) {
221
+ if (item.names[1] === _item.names[1] && index !== _index) {
222
+ _series.push(_item);
223
+ delete _data.series[_index];
224
+ }
225
+ });
226
+ delete _data.series[index];
227
+ });
228
+ _data.series = _series;
229
+ return _data;
230
+ }
231
+ }
146
232
  export function marketEventGroupList(eventGroupList) {
147
233
  var _marketName = [];
148
234
  eventGroupList && eventGroupList.map(function (item) {
@@ -150,9 +236,28 @@ export function marketEventGroupList(eventGroupList) {
150
236
  if (_item.marked) _marketName.push(_item.name);
151
237
  });
152
238
  });
153
- console.log(666, _marketName);
154
239
  return _marketName;
155
240
  }
241
+ export function getWarningId(searchData, eventData, eventGroupList) {
242
+ var id = -1;
243
+ if (eventData && eventData.series.length > 0) {
244
+ if (searchData === null || searchData === void 0 ? void 0 : searchData.id) {
245
+ id = searchData === null || searchData === void 0 ? void 0 : searchData.id;
246
+ } else {
247
+ if (eventGroupList && eventGroupList.length > 0 && eventData) {
248
+ eventGroupList.map(function (item) {
249
+ item.eventList.map(function (_item) {
250
+ var _name = eventData.series[0].names[searchData.userGroup.length > 1 ? 1 : 0];
251
+ if (_item.name === _name || _item.alias === _name) {
252
+ id = _item.id;
253
+ }
254
+ });
255
+ });
256
+ }
257
+ }
258
+ }
259
+ return id;
260
+ }
156
261
  export function getAttrLabel(attrData, eventGroupList, userPropList, eventEnvList) {
157
262
  if (!attrData) return;
158
263
  var type = attrData.propCategory;
@@ -185,7 +290,9 @@ export function formTableData(originalData, userGroups, attrNum, showList) {
185
290
  series.forEach(function (item, index) {
186
291
  var _item$names = item.names,
187
292
  names = _item$names === void 0 ? [] : _item$names,
188
- values = item.values;
293
+ values = item.values,
294
+ _item$originalNames = item.originalNames,
295
+ originalNames = _item$originalNames === void 0 ? [] : _item$originalNames;
189
296
  var nameStr = names.join(',');
190
297
  if (showList) {
191
298
  if (!showList.includes(nameStr)) {
@@ -195,6 +302,7 @@ export function formTableData(originalData, userGroups, attrNum, showList) {
195
302
  var len = names.length;
196
303
  var haveUserGroup = userGroups.length > 1 || userGroups[0] !== 0;
197
304
  var name = names[len - 1];
305
+ var originalName = originalNames[len - 1];
198
306
  var userGroup = haveUserGroup ? names[len - 2] : '所有用户';
199
307
  var nameGroup = names.join(',');
200
308
  var color = chartColors[index % 20];
@@ -206,9 +314,10 @@ export function formTableData(originalData, userGroups, attrNum, showList) {
206
314
  color: color
207
315
  };
208
316
  if (attrNum) {
209
- data["dimension"] = haveUserGroup ? names[1] : names[0];
317
+ data["dimension"] = name;
210
318
  } else {
211
- data["eventName"] = haveUserGroup ? names[1] : names[0];
319
+ data["eventName"] = name;
320
+ data["originalName"] = originalName;
212
321
  }
213
322
  values.forEach(function (item, index) {
214
323
  data["field".concat(index)] = item;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/modules-event",
3
- "version": "0.0.2-event.9",
3
+ "version": "0.1.1",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -36,7 +36,7 @@
36
36
  "@types/lodash": "^4.14.191",
37
37
  "@umijs/fabric": "^2.8.1",
38
38
  "@umijs/test": "^3.0.5",
39
- "@zgfe/business-lib": "1.1.76-event.8",
39
+ "@zgfe/business-lib": "1.1.84-panel.18",
40
40
  "antd": "^4.22.6",
41
41
  "dumi": "^1.1.0",
42
42
  "echarts": "^5.3.2",
@@ -49,7 +49,7 @@
49
49
  "react": "^16.12.0 || ^17.0.0",
50
50
  "yorkie": "^2.0.0"
51
51
  },
52
- "gitHead": "537899c594e6b6a292799f18f8743f45143017b9",
52
+ "gitHead": "96d14b116caa8b1c5df614c0f2409549bf8256c8",
53
53
  "dependencies": {
54
54
  "react-copy-to-clipboard": "^5.1.0",
55
55
  "react-highlight": "^0.15.0"
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- import './styles/index.less';
3
- export declare const MiSpin: React.FC;
4
- export declare const MiNone: React.FC<{
5
- label?: string;
6
- }>;
@@ -1,17 +0,0 @@
1
- import React from 'react';
2
- import './styles/index.less';
3
- var classPrefix = 'mi-common';
4
- export var MiSpin = function MiSpin() {
5
- return /*#__PURE__*/React.createElement("div", {
6
- className: "".concat(classPrefix, "-loading-icon")
7
- });
8
- };
9
- export var MiNone = function MiNone(props) {
10
- return /*#__PURE__*/React.createElement("div", {
11
- className: "".concat(classPrefix, "-none-container")
12
- }, /*#__PURE__*/React.createElement("div", {
13
- className: "".concat(classPrefix, "-none")
14
- }), /*#__PURE__*/React.createElement("span", {
15
- className: "".concat(classPrefix, "-none-text")
16
- }, " ", props.label));
17
- };
@@ -1,27 +0,0 @@
1
- @import '~@zgfe/business-lib/es/assets/styles/inner.less';
2
-
3
- .mi-common {
4
- &-loading-icon {
5
- z-index: 1000;
6
- display: inline-block;
7
- width: 40px;
8
- height: 40px;
9
- background: url('../../../style/image/ring.svg') no-repeat;
10
- background-size: contain;
11
- }
12
-
13
- &-none-text {
14
- color: @text-color;
15
- font-size: 16px;
16
- }
17
-
18
- &-none {
19
- width: 348px;
20
- height: 132px;
21
- background: url('../../../style/image/noData.png') no-repeat;
22
- }
23
-
24
- &-none-container {
25
- text-align: center;
26
- }
27
- }
Binary file