@zgfe/business-lib 1.1.29-alpha.1 → 1.1.29-alpha.3

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.
@@ -25,6 +25,7 @@ export interface AnalysisEvent {
25
25
  eventHidden?: ShowStatus;
26
26
  marked?: boolean;
27
27
  isBuiltIn?: boolean;
28
+ type?: string;
28
29
  }
29
30
  export interface EventGroup {
30
31
  id: number;
@@ -4,6 +4,7 @@ export declare const BuiltinIndicators: {
4
4
  eventList: {
5
5
  name: string;
6
6
  id: number;
7
+ type: string;
7
8
  isBuiltIn: boolean;
8
9
  attrList: never[];
9
10
  }[];
@@ -4,26 +4,31 @@ export var BuiltinIndicators = {
4
4
  eventList: [{
5
5
  name: '新增用户',
6
6
  id: -201,
7
+ type: 'add',
7
8
  isBuiltIn: true,
8
9
  attrList: []
9
10
  }, {
10
11
  name: '活跃用户',
11
12
  id: -202,
13
+ type: 'active',
12
14
  isBuiltIn: true,
13
15
  attrList: []
14
16
  }, {
15
17
  name: '访问次数',
16
18
  id: -203,
19
+ type: 'times',
17
20
  isBuiltIn: true,
18
21
  attrList: []
19
22
  }, {
20
23
  name: '平均使用时长',
21
24
  id: -204,
25
+ type: 'duration_avg',
22
26
  isBuiltIn: true,
23
27
  attrList: []
24
28
  }, {
25
29
  name: '使用时长分布',
26
30
  id: -205,
31
+ type: 'duration',
27
32
  isBuiltIn: true,
28
33
  attrList: []
29
34
  }]
@@ -96,7 +96,28 @@ var EventListPanel = function EventListPanel(props) {
96
96
  setGroupList(function (list) {
97
97
  return props.showBuiltInTarget ? [group, BuiltinIndicators].concat(_toConsumableArray(list)) : [group].concat(_toConsumableArray(list));
98
98
  });
99
- setCurrentGroup(group);
99
+ setCurrentGroup(function () {
100
+ var _props$value;
101
+
102
+ if (props.defaultSelectAble && ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.group)) {
103
+ if (props.showBuiltInTarget && props.value.group.id === -2) {
104
+ return BuiltinIndicators;
105
+ } else {
106
+ var _currentGroup = group;
107
+ eventGroupList === null || eventGroupList === void 0 ? void 0 : eventGroupList.forEach(function (eGroup) {
108
+ var _props$value2, _props$value2$group;
109
+
110
+ if (eGroup.id === ((_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : (_props$value2$group = _props$value2.group) === null || _props$value2$group === void 0 ? void 0 : _props$value2$group.id)) {
111
+ _currentGroup = eGroup;
112
+ return;
113
+ }
114
+ });
115
+ return _currentGroup;
116
+ }
117
+ }
118
+
119
+ return group;
120
+ });
100
121
  }, []);
101
122
  useEffect(function () {
102
123
  setCurrentValue(props.value);
@@ -1,3 +1,9 @@
1
+ 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; }
2
+
3
+ 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; }
4
+
5
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+
1
7
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
8
 
3
9
  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."); }
@@ -18,6 +24,7 @@ import BizConditionGroup from '../attrConditions/group';
18
24
  import { Skeleton } from 'antd';
19
25
  import _ from 'lodash';
20
26
  import BizGlobalDataContext from '../context';
27
+ import { BuiltinIndicators } from '../constants/common';
21
28
  export var classPrefix = 'biz-target';
22
29
 
23
30
  var BizTargetCondition = function BizTargetCondition(props) {
@@ -142,31 +149,52 @@ var BizTargetCondition = function BizTargetCondition(props) {
142
149
  };
143
150
  }
144
151
 
145
- if (data.eventId === -100) {
146
- target.value.event = {
147
- id: -100,
148
- name: '事件概览',
149
- attrList: []
150
- };
152
+ var hasEvent = false;
153
+
154
+ if (data.isBuiltIn || data.eventId < 0) {
155
+ if (data.eventGroupId) {
156
+ target.value.group = {
157
+ id: data.eventGroupId,
158
+ name: data.eventGroupId === -2 ? '整体' : '所有分组',
159
+ eventList: []
160
+ };
161
+ }
162
+
163
+ BuiltinIndicators.eventList.forEach(function (item) {
164
+ if (item.id === data.eventId) {
165
+ target.value.event = _objectSpread({}, item);
166
+ hasEvent = true;
167
+ }
168
+ });
151
169
  }
152
170
 
153
- for (var i = 0; i < eventGroupList.length; i++) {
154
- var group = eventGroupList[i];
171
+ if (!hasEvent) {
172
+ if (data.eventId === -100) {
173
+ target.value.event = {
174
+ id: -100,
175
+ name: '事件概览',
176
+ attrList: []
177
+ };
178
+ }
179
+
180
+ for (var i = 0; i < eventGroupList.length; i++) {
181
+ var group = eventGroupList[i];
155
182
 
156
- if (data.eventId !== -100) {
157
- for (var j = 0; j < group.eventList.length; j++) {
158
- var event = group.eventList[j];
183
+ if (data.eventId !== -100) {
184
+ for (var j = 0; j < group.eventList.length; j++) {
185
+ var event = group.eventList[j];
159
186
 
160
- if (event.id === data.eventId) {
161
- target.value.event = event;
162
- break;
187
+ if (event.id === data.eventId) {
188
+ target.value.event = event;
189
+ break;
190
+ }
163
191
  }
164
192
  }
165
- }
166
193
 
167
- if (data.eventGroupId && data.eventGroupId === group.id) {
168
- target.value.group = group;
169
- break;
194
+ if (data.eventGroupId && data.eventGroupId === group.id) {
195
+ target.value.group = group;
196
+ break;
197
+ }
170
198
  }
171
199
  }
172
200
  }
@@ -217,7 +245,7 @@ var BizTargetCondition = function BizTargetCondition(props) {
217
245
 
218
246
  if (!target || !target.value || !((_target$value$event2 = target.value.event) === null || _target$value$event2 === void 0 ? void 0 : _target$value$event2.id)) return;
219
247
  var data = {
220
- type: 'event',
248
+ type: target.value.event.type || 'event',
221
249
  alias: (target === null || target === void 0 ? void 0 : target.alias) || target.value.event.alias || ((_target$value$event3 = target.value.event) === null || _target$value$event3 === void 0 ? void 0 : _target$value$event3.name) || '',
222
250
  eventId: (_target$value$event4 = target.value.event) === null || _target$value$event4 === void 0 ? void 0 : _target$value$event4.id,
223
251
  eventName: ((_target$value$event5 = target.value.event) === null || _target$value$event5 === void 0 ? void 0 : _target$value$event5.alias) || ((_target$value$event6 = target.value.event) === null || _target$value$event6 === void 0 ? void 0 : _target$value$event6.name),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/business-lib",
3
- "version": "1.1.29-alpha.1",
3
+ "version": "1.1.29-alpha.3",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -59,5 +59,5 @@
59
59
  "react": "^16.12.0 || ^17.0.0",
60
60
  "yorkie": "^2.0.0"
61
61
  },
62
- "gitHead": "41e55686ba3560c69e9117772fd0a93fa413fe22"
62
+ "gitHead": "940068acefe01cd22f273ef59d3a51637919d5ff"
63
63
  }