@zgfe/business-lib 1.1.34-insight.0 → 1.1.34-visual.10

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.
@@ -7,11 +7,12 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
7
  import React, { useRef, useState } from 'react';
8
8
  import { BizConditionGroup, DemoWrapper } from '@zgfe/business-lib';
9
9
  import { Button } from 'antd';
10
+ import { OperateTypes } from '../types';
10
11
  var conditions = [{
11
12
  propCategory: 'userProp',
12
13
  attrId: 0,
13
14
  type: 2,
14
- operator: 'gt',
15
+ operator: OperateTypes.GT,
15
16
  values: ['25200', '1'],
16
17
  attrName: 'duration',
17
18
  category: 'fixed',
@@ -19,7 +20,7 @@ var conditions = [{
19
20
  }, {
20
21
  propCategory: 'eventProp',
21
22
  type: 1,
22
- operator: 'equal',
23
+ operator: OperateTypes.Equal,
23
24
  values: ['Safari', 'Apple WebKit'],
24
25
  attrId: 30183426
25
26
  }];
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
+ import { AttributeSelect } from '../attributeSelector/types';
2
3
  import './styles/index.less';
3
- import { AttrConditionTypes } from './types';
4
+ import { AttrConditionTypes, OperateTypes } from './types';
4
5
  export declare const classPrefix = "biz-condition-item";
6
+ export declare function getCondition(attr: AttributeSelect.Value, operate: OperateTypes, values: string[]): AttrConditionTypes.ItemValue | undefined;
5
7
  declare const BizConditionItem: React.FC<AttrConditionTypes.ItemProp>;
6
8
  export default BizConditionItem;
@@ -12,6 +12,28 @@ import BizOperateList from './components/operateList';
12
12
  import ValuesList from './components/valuesList';
13
13
  import { Skeleton } from 'antd';
14
14
  export var classPrefix = 'biz-condition-item';
15
+ export function getCondition(attr, operate, values) {
16
+ if (!attr) return;
17
+ var responseData = {
18
+ attrId: attr.id,
19
+ propCategory: attr.propCategory,
20
+ type: attr.type,
21
+ operator: operate,
22
+ values: values || [],
23
+ dimensionSub: attr.dimensionSub,
24
+ label: attr.label
25
+ };
26
+ if (attr.propCategory === PropCategory.EventProp) {
27
+ responseData.attrName = attr.label;
28
+ } else {
29
+ responseData.attrName = attr.name;
30
+ responseData.category = attr.category;
31
+ if (attr.propCategory === PropCategory.UserProp && attr.subtype) {
32
+ responseData.subtype = attr.subtype;
33
+ }
34
+ }
35
+ return responseData;
36
+ }
15
37
  var BizConditionItem = function BizConditionItem(props) {
16
38
  var _props$defaultValue, _props$value, _props$defaultValue2, _props$value2;
17
39
  var defaultValue = props.defaultValue,
@@ -79,25 +101,7 @@ var BizConditionItem = function BizConditionItem(props) {
79
101
  useEffect(function () {
80
102
  if (props.onChange) {
81
103
  if (!attr) return;
82
- var responseData = {
83
- attrId: attr.id,
84
- propCategory: attr.propCategory,
85
- type: attr.type,
86
- operator: operate,
87
- values: values || [],
88
- dimensionSub: attr.dimensionSub,
89
- label: attr.alias || attr.label
90
- };
91
- if (attr.propCategory === PropCategory.EventProp) {
92
- responseData.attrName = attr.label;
93
- } else {
94
- responseData.attrName = attr.name;
95
- responseData.category = attr.category;
96
- if (attr.propCategory === PropCategory.UserProp && attr.subtype) {
97
- responseData.subtype = attr.subtype;
98
- }
99
- }
100
- props.onChange(responseData);
104
+ props.onChange(getCondition(attr, operate, values));
101
105
  }
102
106
  }, [attr, operate, values]);
103
107
  var onChangeAttr = function onChangeAttr(attrData) {
@@ -18,7 +18,7 @@ export declare namespace AttrConditionTypes {
18
18
  propCategory?: 'userProp' | 'eventProp' | 'envProp';
19
19
  category?: 'fixed' | 'custom';
20
20
  dimensionSub?: string;
21
- operator?: string;
21
+ operator?: OperateTypes;
22
22
  values?: string[];
23
23
  }
24
24
  interface GroupValue {
@@ -24,8 +24,6 @@ export interface AnalysisEvent {
24
24
  isOverview?: boolean;
25
25
  eventHidden?: ShowStatus;
26
26
  marked?: boolean;
27
- isBuiltIn?: boolean;
28
- type?: string;
29
27
  }
30
28
  export interface EventGroup {
31
29
  id: number;
@@ -63,6 +61,8 @@ export interface PropGroups {
63
61
  eventGroupList?: EventGroup[];
64
62
  userPropList?: UserProp[];
65
63
  envPropList?: EnvProp[];
64
+ eventNameMap?: Record<string, AnalysisEvent>;
65
+ eventIdMap?: Record<number, AnalysisEvent>;
66
66
  }
67
67
  export declare namespace AttributeSelect {
68
68
  type Value = EventProp | UserProp | EnvProp | null;
@@ -3,7 +3,9 @@ export default function convertAttributeData(store) {
3
3
  var res = {
4
4
  envPropList: [],
5
5
  eventGroupList: [],
6
- userPropList: []
6
+ userPropList: [],
7
+ eventNameMap: {},
8
+ eventIdMap: {}
7
9
  };
8
10
  (_store$eventList = store.eventList) === null || _store$eventList === void 0 ? void 0 : _store$eventList.forEach(function (group_) {
9
11
  var _res$eventGroupList;
@@ -39,6 +41,8 @@ export default function convertAttributeData(store) {
39
41
  eventHidden: e.event_hidden,
40
42
  marked: Boolean(e.mark_type)
41
43
  };
44
+ res.eventNameMap[event.name] = event;
45
+ res.eventIdMap[event.id] = event;
42
46
  if (event.marked) {
43
47
  markList.push(event);
44
48
  } else {
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { EventGroup, UserProp, EnvProp } from '../attributeSelector/types';
2
+ import { EventGroup, UserProp, EnvProp, AnalysisEvent } from '../attributeSelector/types';
3
3
  export interface AppInfoProps {
4
4
  appId?: string | number;
5
5
  platform?: string | number;
@@ -24,6 +24,8 @@ export interface Menu {
24
24
  export interface GlobalContextProps {
25
25
  userGroupList?: Array<any>;
26
26
  eventGroupList?: EventGroup[];
27
+ eventNameMap?: Record<string, AnalysisEvent>;
28
+ eventIdMap?: Record<number, AnalysisEvent>;
27
29
  userPropList?: UserProp[];
28
30
  eventEnvList?: EnvProp[];
29
31
  menuNameMap?: {
@@ -175,6 +175,8 @@ var DemoContent = function DemoContent(_ref3) {
175
175
  eventGroupList: store === null || store === void 0 ? void 0 : store.eventGroupList,
176
176
  userPropList: store === null || store === void 0 ? void 0 : store.userPropList,
177
177
  eventEnvList: store === null || store === void 0 ? void 0 : store.envPropList,
178
+ eventIdMap: store === null || store === void 0 ? void 0 : store.eventIdMap,
179
+ eventNameMap: store === null || store === void 0 ? void 0 : store.eventNameMap,
178
180
  userGroupList: userGroups
179
181
  }
180
182
  }, children));
@@ -39,7 +39,6 @@ var EventDemo = function EventDemo() {
39
39
  eventGroupList: store.eventGroupList
40
40
  }
41
41
  }, /*#__PURE__*/React.createElement(BizEventSelector, {
42
- showBuiltInTarget: true,
43
42
  defaultValue: value,
44
43
  alias: "\u522B\u540D",
45
44
  onChange: onChange
@@ -10,7 +10,6 @@ import SelectHandle from '../select/handle';
10
10
  import BizGlobalDataContext from '../context';
11
11
  import EventListPanel from './listPanel';
12
12
  import './styles/index.less';
13
- import { BuiltinIndicators } from '../constants/common';
14
13
  export var classPrefix = 'biz-event-select';
15
14
  var BizEventSelector = function BizEventSelector(props) {
16
15
  var alias = props.alias,
@@ -43,14 +42,13 @@ var BizEventSelector = function BizEventSelector(props) {
43
42
  var getValue = function getValue(param) {
44
43
  var _param$group, _param$event;
45
44
  var res = {};
46
- var allEvents = props.showBuiltInTarget ? eventGroupList === null || eventGroupList === void 0 ? void 0 : eventGroupList.concat(BuiltinIndicators) : eventGroupList;
47
45
  if (!((_param$group = param.group) === null || _param$group === void 0 ? void 0 : _param$group.id)) {
48
46
  res.group = {
49
47
  id: 0,
50
48
  name: '所有分组',
51
49
  eventList: function () {
52
50
  var list = [];
53
- allEvents === null || allEvents === void 0 ? void 0 : allEvents.forEach(function (group) {
51
+ eventGroupList === null || eventGroupList === void 0 ? void 0 : eventGroupList.forEach(function (group) {
54
52
  list = list.concat(group.eventList);
55
53
  });
56
54
  return list;
@@ -64,7 +62,7 @@ var BizEventSelector = function BizEventSelector(props) {
64
62
  attrList: []
65
63
  };
66
64
  }
67
- allEvents === null || allEvents === void 0 ? void 0 : allEvents.forEach(function (group) {
65
+ eventGroupList === null || eventGroupList === void 0 ? void 0 : eventGroupList.forEach(function (group) {
68
66
  var _param$group2;
69
67
  if (group.id === ((_param$group2 = param.group) === null || _param$group2 === void 0 ? void 0 : _param$group2.id)) res.group = group;
70
68
  group.eventList.forEach(function (event) {
@@ -106,7 +104,6 @@ var BizEventSelector = function BizEventSelector(props) {
106
104
  value: currentValue,
107
105
  onChange: onChange,
108
106
  showOverview: showAllEvent,
109
- showBuiltInTarget: props.showBuiltInTarget,
110
107
  defaultSelectAble: defaultSelectAble
111
108
  }),
112
109
  trigger: ['click'],
@@ -15,7 +15,6 @@ import InfiniteScroll from 'react-infinite-scroll-component';
15
15
  import { classPrefix } from '.';
16
16
  import { BizGlobalDataContext } from '..';
17
17
  import { ShowStatus } from '../attributeSelector/types';
18
- import { BuiltinIndicators } from '../constants/common';
19
18
  import BizSearchInput from '../searchInput';
20
19
  import EventListOption from './option';
21
20
  var EventListPanel = function EventListPanel(props) {
@@ -69,33 +68,15 @@ var EventListPanel = function EventListPanel(props) {
69
68
  }
70
69
  });
71
70
  });
72
- list = props.showBuiltInTarget ? [].concat(_toConsumableArray(BuiltinIndicators.eventList), markList, _toConsumableArray(list)) : [].concat(markList, _toConsumableArray(list));
71
+ list = [].concat(markList, _toConsumableArray(list));
73
72
  return list;
74
73
  }(),
75
74
  name: '所有分组'
76
75
  };
77
76
  setGroupList(function (list) {
78
- return props.showBuiltInTarget ? [group, BuiltinIndicators].concat(_toConsumableArray(list)) : [group].concat(_toConsumableArray(list));
79
- });
80
- setCurrentGroup(function () {
81
- var _props$value;
82
- if (props.defaultSelectAble && ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.group)) {
83
- if (props.showBuiltInTarget && props.value.group.id === -2) {
84
- return BuiltinIndicators;
85
- } else {
86
- var _currentGroup = group;
87
- eventGroupList === null || eventGroupList === void 0 ? void 0 : eventGroupList.forEach(function (eGroup) {
88
- var _props$value2, _props$value2$group;
89
- 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)) {
90
- _currentGroup = eGroup;
91
- return;
92
- }
93
- });
94
- return _currentGroup;
95
- }
96
- }
97
- return group;
77
+ return [group].concat(_toConsumableArray(list));
98
78
  });
79
+ setCurrentGroup(group);
99
80
  }, []);
100
81
  useEffect(function () {
101
82
  setCurrentValue(props.value);
@@ -23,7 +23,6 @@ export declare namespace EventSelectTypes {
23
23
  showAllEvent?: boolean;
24
24
  defaultSelectAble?: boolean;
25
25
  popupContainer?: boolean;
26
- showBuiltInTarget?: boolean;
27
26
  onVisibleChange?: (visible: boolean) => void;
28
27
  border?: boolean;
29
28
  theme?: string;
@@ -34,7 +33,6 @@ export declare namespace EventSelectTypes {
34
33
  interface DropdownProps {
35
34
  value?: Value;
36
35
  showOverview?: boolean;
37
- showBuiltInTarget?: boolean;
38
36
  defaultSelectAble?: boolean;
39
37
  onChange?: (value: Value, isOverview?: boolean) => void;
40
38
  }
@@ -8,11 +8,12 @@ declare class SocketClient {
8
8
  private showLog;
9
9
  private pingTimer?;
10
10
  private appkey?;
11
+ private token?;
11
12
  constructor(url: string, appkey: string, params?: Record<string, any>);
12
13
  emit(event: string, payload?: SocketClientTypes.Message['data']['payload']): void;
13
14
  on<T>(type: SocketClientTypes.EventType | string, handle: (data?: T) => void): void;
14
- onConnected(handle: () => void): void;
15
- onDisconnected(handle: () => void): void;
15
+ onConnected(handle: (data?: any) => void): void;
16
+ onDisconnected(handle: (data?: any) => void): void;
16
17
  onError(handle: (data?: Error) => void): void;
17
18
  private _onError;
18
19
  private _onClose;
@@ -21,11 +22,12 @@ declare class SocketClient {
21
22
  private ping;
22
23
  removeAllListeners(): void;
23
24
  removeListener(event: string, handle?: (data?: any) => void): void;
24
- private getToken;
25
+ private _getToken;
25
26
  open(url?: string, params?: Record<string, any>): void;
26
27
  close(): void;
27
28
  destroy(): void;
28
29
  private log;
29
30
  openLog(open: boolean): void;
31
+ getToken(): string | undefined;
30
32
  }
31
33
  export default SocketClient;
@@ -29,6 +29,7 @@ var SocketClient = /*#__PURE__*/function () {
29
29
  this.showLog = false;
30
30
  this.pingTimer = void 0;
31
31
  this.appkey = void 0;
32
+ this.token = void 0;
32
33
  this.appkey = appkey;
33
34
  this.url = url;
34
35
  this.params = params;
@@ -122,7 +123,7 @@ var SocketClient = /*#__PURE__*/function () {
122
123
  _this = this;
123
124
  this.log('info', 'socket连接成功', event);
124
125
  (_this$listeners$conne = this.listeners['connected']) === null || _this$listeners$conne === void 0 ? void 0 : _this$listeners$conne.forEach(function (handle) {
125
- handle.call(undefined);
126
+ handle.call(undefined, _this.token);
126
127
  });
127
128
  this.log('info', 'clear catch', this.catch);
128
129
  this.catch.forEach(function (_ref) {
@@ -137,7 +138,7 @@ var SocketClient = /*#__PURE__*/function () {
137
138
  }, {
138
139
  key: "onMessage",
139
140
  value: function onMessage(event) {
140
- var _this$listeners$Socke, _this$listeners$Socke2, _this$listeners$Socke3;
141
+ var _this$listeners$Socke, _this$listeners$Socke2, _this$listeners$Socke3, _this$listeners$unkno;
141
142
  var res = JSON.parse(event.data);
142
143
  if (res.code) {
143
144
  switch (Number(res.code)) {
@@ -158,6 +159,10 @@ var SocketClient = /*#__PURE__*/function () {
158
159
  break;
159
160
  case SocketClientTypes.ResponseCode.paramError:
160
161
  this._onError(new Error('参数缺失或错误'));
162
+ default:
163
+ (_this$listeners$unkno = this.listeners['unknownCode']) === null || _this$listeners$unkno === void 0 ? void 0 : _this$listeners$unkno.forEach(function (handle) {
164
+ handle.call(undefined, res);
165
+ });
161
166
  }
162
167
  } else if (res.type === SocketClientTypes.RequestType.pong) {
163
168
  return;
@@ -191,7 +196,8 @@ var SocketClient = /*#__PURE__*/function () {
191
196
  value: function removeListener(event, handle) {
192
197
  var _this3 = this;
193
198
  if (handle) {
194
- this.listeners[event].forEach(function (item, i) {
199
+ var _this$listeners$event;
200
+ (_this$listeners$event = this.listeners[event]) === null || _this$listeners$event === void 0 ? void 0 : _this$listeners$event.forEach(function (item, i) {
195
201
  if (item === handle) {
196
202
  _this3.listeners[event].splice(i, 1);
197
203
  }
@@ -201,9 +207,9 @@ var SocketClient = /*#__PURE__*/function () {
201
207
  }
202
208
  }
203
209
  }, {
204
- key: "getToken",
210
+ key: "_getToken",
205
211
  value: function () {
206
- var _getToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
212
+ var _getToken2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
207
213
  var res;
208
214
  return _regeneratorRuntime().wrap(function _callee$(_context) {
209
215
  while (1) switch (_context.prev = _context.next) {
@@ -224,21 +230,23 @@ var SocketClient = /*#__PURE__*/function () {
224
230
  }
225
231
  }, _callee, this);
226
232
  }));
227
- function getToken() {
228
- return _getToken.apply(this, arguments);
233
+ function _getToken() {
234
+ return _getToken2.apply(this, arguments);
229
235
  }
230
- return getToken;
236
+ return _getToken;
231
237
  }()
232
238
  }, {
233
239
  key: "open",
234
240
  value: function open(url, params) {
235
241
  var _this4 = this;
236
- this.getToken().then(function (token) {
242
+ this._getToken().then(function (token) {
237
243
  _this4.params = params || _this4.params;
244
+ _this4.token = token;
238
245
  if (_this4.client) _this4.close();
239
246
  var paramUrl = ["socketToken=".concat(token)];
240
247
  if (_this4.params) {
241
- Object.keys(_this4.params || {}).forEach(function (key) {
248
+ var _Object$keys;
249
+ (_Object$keys = Object.keys(_this4.params || {})) === null || _Object$keys === void 0 ? void 0 : _Object$keys.forEach(function (key) {
242
250
  if (_.isObject(_this4.params[key]) || _.isArray(_this4.params[key])) {
243
251
  paramUrl.push("".concat(key, "=").concat(JSON.stringify(_this4.params[key])));
244
252
  } else {
@@ -285,6 +293,11 @@ var SocketClient = /*#__PURE__*/function () {
285
293
  value: function openLog(open) {
286
294
  this.showLog = open;
287
295
  }
296
+ }, {
297
+ key: "getToken",
298
+ value: function getToken() {
299
+ return this.token;
300
+ }
288
301
  }]);
289
302
  return SocketClient;
290
303
  }();
@@ -43,6 +43,9 @@ export var attrOptions = [{
43
43
  }, {
44
44
  label: '均值',
45
45
  value: 'avg'
46
+ }, {
47
+ label: '分布',
48
+ value: 'duration_times'
46
49
  }, {
47
50
  label: '中位数',
48
51
  value: 'median'
@@ -51,7 +51,6 @@ export default (function () {
51
51
  max: 3
52
52
  }, /*#__PURE__*/React.createElement(BizEventSelector, {
53
53
  showAllEvent: true,
54
- border: false,
55
- showBuiltInTarget: true
54
+ border: false
56
55
  }))), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("p", null, "\u5F53\u524D\u503C\uFF1A", JSON.stringify(target)));
57
56
  });
@@ -1,9 +1,3 @@
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
- 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; }
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
- 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; }
5
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
- 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); }
7
1
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
2
  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."); }
9
3
  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); }
@@ -18,10 +12,9 @@ import BizConditionGroup from '../attrConditions/group';
18
12
  import { Skeleton } from 'antd';
19
13
  import _ from 'lodash';
20
14
  import BizGlobalDataContext from '../context';
21
- import { BuiltinIndicators } from '../constants/common';
22
15
  export var classPrefix = 'biz-target';
23
16
  var BizTargetCondition = function BizTargetCondition(props) {
24
- var _targetData$value2, _targetData$value2$gr, _targetData$value3, _targetData$value3$ev, _targetData$value4, _targetData$value4$ev, _targetData$value5, _targetData$value5$ev, _targetData$value6, _targetData$value6$ev, _targetData$value7, _targetData$value7$ev;
17
+ var _targetData$value2, _targetData$value2$ev, _targetData$value3, _targetData$value3$ev, _targetData$value4, _targetData$value4$ev, _targetData$value5, _targetData$value5$ev;
25
18
  var max = props.max;
26
19
  var _useState = useState(),
27
20
  _useState2 = _slicedToArray(_useState, 2),
@@ -76,14 +69,14 @@ var BizTargetCondition = function BizTargetCondition(props) {
76
69
  }, []);
77
70
  useEffect(function () {
78
71
  if (targetData === null || targetData === void 0 ? void 0 : targetData.value) {
79
- var _targetData$value$eve, _targetData$value$eve2, _targetData$value$eve3;
72
+ var _targetData$value$eve;
80
73
  var canAdd = true,
81
74
  canDelete = true;
82
- if (((_targetData$value$eve = targetData.value.event) === null || _targetData$value$eve === void 0 ? void 0 : _targetData$value$eve.id) === -100 || ((_targetData$value$eve2 = targetData.value.event) === null || _targetData$value$eve2 === void 0 ? void 0 : _targetData$value$eve2.id) === -204 || ((_targetData$value$eve3 = targetData.value.event) === null || _targetData$value$eve3 === void 0 ? void 0 : _targetData$value$eve3.id) === -205) {
83
- var _targetData$value$gro, _targetData$value$eve4;
75
+ if (((_targetData$value$eve = targetData.value.event) === null || _targetData$value$eve === void 0 ? void 0 : _targetData$value$eve.id) === -100) {
76
+ var _targetData$value$gro;
84
77
  canAdd = false;
85
78
  setFilters(undefined);
86
- if (!((_targetData$value$gro = targetData.value.group) === null || _targetData$value$gro === void 0 ? void 0 : _targetData$value$gro.id) && ((_targetData$value$eve4 = targetData.value.event) === null || _targetData$value$eve4 === void 0 ? void 0 : _targetData$value$eve4.id) === -100) {
79
+ if (!((_targetData$value$gro = targetData.value.group) === null || _targetData$value$gro === void 0 ? void 0 : _targetData$value$gro.id)) {
87
80
  canDelete = false;
88
81
  }
89
82
  } else {
@@ -116,55 +109,37 @@ var BizTargetCondition = function BizTargetCondition(props) {
116
109
  eventList: []
117
110
  };
118
111
  }
119
- var hasEvent = false;
120
- if (data.isBuiltIn || data.eventId < 0) {
121
- if (data.eventGroupId) {
122
- target.value.group = {
123
- id: data.eventGroupId,
124
- name: data.eventGroupId === -2 ? '整体' : '所有分组',
125
- eventList: []
126
- };
127
- }
128
- BuiltinIndicators.eventList.forEach(function (item) {
129
- if (item.id === data.eventId) {
130
- target.value.event = _objectSpread({}, item);
131
- hasEvent = true;
132
- }
133
- });
112
+ if (data.eventId === -100) {
113
+ target.value.event = {
114
+ id: -100,
115
+ name: '事件概览',
116
+ attrList: []
117
+ };
134
118
  }
135
- if (!hasEvent) {
136
- if (data.eventId === -100) {
137
- target.value.event = {
138
- id: -100,
139
- name: '事件概览',
140
- attrList: []
141
- };
142
- }
143
- for (var i = 0; i < eventGroupList.length; i++) {
144
- var group = eventGroupList[i];
145
- if (data.eventId !== -100) {
146
- for (var j = 0; j < group.eventList.length; j++) {
147
- var event = group.eventList[j];
148
- if (event.id === data.eventId) {
149
- target.value.event = event;
150
- break;
151
- }
119
+ for (var i = 0; i < eventGroupList.length; i++) {
120
+ var group = eventGroupList[i];
121
+ if (data.eventId !== -100) {
122
+ for (var j = 0; j < group.eventList.length; j++) {
123
+ var event = group.eventList[j];
124
+ if (event.id === data.eventId) {
125
+ target.value.event = event;
126
+ break;
152
127
  }
153
128
  }
154
- if (data.eventGroupId && data.eventGroupId === group.id) {
155
- target.value.group = group;
156
- break;
157
- }
129
+ }
130
+ if (data.eventGroupId && data.eventGroupId === group.id) {
131
+ target.value.group = group;
132
+ break;
158
133
  }
159
134
  }
160
135
  }
161
136
  return target;
162
137
  };
163
138
  var onChangeTarget = function onChangeTarget(target) {
164
- var _target$value, _target$value$event, _targetData$value, _targetData$value$eve5;
139
+ var _target$value, _target$value$event, _targetData$value, _targetData$value$eve2;
165
140
  setTargetData(target);
166
141
  var filterData = _.cloneDeep(filters);
167
- if (((_target$value = target.value) === null || _target$value === void 0 ? void 0 : (_target$value$event = _target$value.event) === null || _target$value$event === void 0 ? void 0 : _target$value$event.id) !== (targetData === null || targetData === void 0 ? void 0 : (_targetData$value = targetData.value) === null || _targetData$value === void 0 ? void 0 : (_targetData$value$eve5 = _targetData$value.event) === null || _targetData$value$eve5 === void 0 ? void 0 : _targetData$value$eve5.id)) {
142
+ if (((_target$value = target.value) === null || _target$value === void 0 ? void 0 : (_target$value$event = _target$value.event) === null || _target$value$event === void 0 ? void 0 : _target$value$event.id) !== (targetData === null || targetData === void 0 ? void 0 : (_targetData$value = targetData.value) === null || _targetData$value === void 0 ? void 0 : (_targetData$value$eve2 = _targetData$value.event) === null || _targetData$value$eve2 === void 0 ? void 0 : _targetData$value$eve2.id)) {
168
143
  filterData = undefined;
169
144
  setFilters(undefined);
170
145
  setIsAdd(false);
@@ -188,25 +163,19 @@ var BizTargetCondition = function BizTargetCondition(props) {
188
163
  setFilters(data);
189
164
  onChange(dimension, targetData, data);
190
165
  };
191
- var onChange = function onChange(analysisDimension, target, filterData) {
166
+ var onChange = function onChange(analysisDimension, target, filterDatas) {
192
167
  if (props.onChange) {
193
- var _target$value$event2, _target$value$event3, _target$value$event4, _target$value$event5, _target$value$event6, _target$value$group2;
168
+ var _target$value$event2, _target$value$event3, _target$value$event4, _target$value$event5, _target$value$event6, _target$value$group;
194
169
  if (!target || !target.value || !((_target$value$event2 = target.value.event) === null || _target$value$event2 === void 0 ? void 0 : _target$value$event2.id)) return;
195
- var type = target.value.event.type;
196
- if (!type) {
197
- var _target$value$group;
198
- type = ((_target$value$group = target.value.group) === null || _target$value$group === void 0 ? void 0 : _target$value$group.id) === -2 ? 'whole' : 'event';
199
- }
200
170
  var data = {
201
- type: type,
171
+ type: 'event',
202
172
  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) || '',
203
173
  eventId: (_target$value$event4 = target.value.event) === null || _target$value$event4 === void 0 ? void 0 : _target$value$event4.id,
204
174
  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),
205
- eventGroupId: (_target$value$group2 = target.value.group) === null || _target$value$group2 === void 0 ? void 0 : _target$value$group2.id,
175
+ eventGroupId: (_target$value$group = target.value.group) === null || _target$value$group === void 0 ? void 0 : _target$value$group.id,
206
176
  analysisDimension: analysisDimension,
207
- filters: filterData,
208
- marked: target.value.event.marked,
209
- isBuiltIn: target.value.event.isBuiltIn
177
+ filters: filterDatas,
178
+ marked: target.value.event.marked
210
179
  };
211
180
  props.onChange(data);
212
181
  }
@@ -237,8 +206,8 @@ var BizTargetCondition = function BizTargetCondition(props) {
237
206
  onAdd: onAdd,
238
207
  onDelete: onDelete,
239
208
  onChange: onChangeTarget
240
- }, props.children), (targetData === null || targetData === void 0 ? void 0 : (_targetData$value2 = targetData.value) === null || _targetData$value2 === void 0 ? void 0 : (_targetData$value2$gr = _targetData$value2.group) === null || _targetData$value2$gr === void 0 ? void 0 : _targetData$value2$gr.id) === -2 || (targetData === null || targetData === void 0 ? void 0 : (_targetData$value3 = targetData.value) === null || _targetData$value3 === void 0 ? void 0 : (_targetData$value3$ev = _targetData$value3.event) === null || _targetData$value3$ev === void 0 ? void 0 : _targetData$value3$ev.isBuiltIn) ? null : /*#__PURE__*/React.createElement(BizTargetDimension, {
241
- eventId: (targetData === null || targetData === void 0 ? void 0 : (_targetData$value4 = targetData.value) === null || _targetData$value4 === void 0 ? void 0 : (_targetData$value4$ev = _targetData$value4.event) === null || _targetData$value4$ev === void 0 ? void 0 : _targetData$value4$ev.id) ? targetData === null || targetData === void 0 ? void 0 : (_targetData$value5 = targetData.value) === null || _targetData$value5 === void 0 ? void 0 : (_targetData$value5$ev = _targetData$value5.event) === null || _targetData$value5$ev === void 0 ? void 0 : _targetData$value5$ev.id : undefined,
209
+ }, props.children), /*#__PURE__*/React.createElement(BizTargetDimension, {
210
+ eventId: (targetData === null || targetData === void 0 ? void 0 : (_targetData$value2 = targetData.value) === null || _targetData$value2 === void 0 ? void 0 : (_targetData$value2$ev = _targetData$value2.event) === null || _targetData$value2$ev === void 0 ? void 0 : _targetData$value2$ev.id) ? targetData === null || targetData === void 0 ? void 0 : (_targetData$value3 = targetData.value) === null || _targetData$value3 === void 0 ? void 0 : (_targetData$value3$ev = _targetData$value3.event) === null || _targetData$value3$ev === void 0 ? void 0 : _targetData$value3$ev.id : undefined,
242
211
  value: dimension,
243
212
  onChange: onChangeDimension
244
213
  })), (filters || isAdd) && /*#__PURE__*/React.createElement(BizConditionGroup, {
@@ -247,7 +216,7 @@ var BizTargetCondition = function BizTargetCondition(props) {
247
216
  onlyAnd: props.onlyAnd,
248
217
  enableEventProp: true,
249
218
  enableDelete: true,
250
- eventIdList: (targetData === null || targetData === void 0 ? void 0 : (_targetData$value6 = targetData.value) === null || _targetData$value6 === void 0 ? void 0 : (_targetData$value6$ev = _targetData$value6.event) === null || _targetData$value6$ev === void 0 ? void 0 : _targetData$value6$ev.id) ? [targetData === null || targetData === void 0 ? void 0 : (_targetData$value7 = targetData.value) === null || _targetData$value7 === void 0 ? void 0 : (_targetData$value7$ev = _targetData$value7.event) === null || _targetData$value7$ev === void 0 ? void 0 : _targetData$value7$ev.id] : undefined,
219
+ eventIdList: (targetData === null || targetData === void 0 ? void 0 : (_targetData$value4 = targetData.value) === null || _targetData$value4 === void 0 ? void 0 : (_targetData$value4$ev = _targetData$value4.event) === null || _targetData$value4$ev === void 0 ? void 0 : _targetData$value4$ev.id) ? [targetData === null || targetData === void 0 ? void 0 : (_targetData$value5 = targetData.value) === null || _targetData$value5 === void 0 ? void 0 : (_targetData$value5$ev = _targetData$value5.event) === null || _targetData$value5$ev === void 0 ? void 0 : _targetData$value5$ev.id] : undefined,
251
220
  onChange: onChangeFilters,
252
221
  onConditionsCount: setCount
253
222
  })));
@@ -20,7 +20,6 @@ export declare namespace TargetConditionTypes {
20
20
  eventId: number;
21
21
  eventName?: string;
22
22
  eventGroupId?: number;
23
- isBuiltIn?: boolean;
24
23
  }
25
24
  interface Props {
26
25
  defaultValue?: Value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/business-lib",
3
- "version": "1.1.34-insight.0",
3
+ "version": "1.1.34-visual.10",
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": "185b4ce5d7e0357c05227260e024659d88b31547"
62
+ "gitHead": "211636a80ee9071213fc580c4473aafef846f2a5"
63
63
  }
@@ -1,11 +0,0 @@
1
- export declare const BuiltinIndicators: {
2
- id: number;
3
- name: string;
4
- eventList: {
5
- name: string;
6
- id: number;
7
- type: string;
8
- isBuiltIn: boolean;
9
- attrList: never[];
10
- }[];
11
- };
@@ -1,35 +0,0 @@
1
- export var BuiltinIndicators = {
2
- id: -2,
3
- name: '整体',
4
- eventList: [{
5
- name: '新增用户',
6
- id: -201,
7
- type: 'add',
8
- isBuiltIn: true,
9
- attrList: []
10
- }, {
11
- name: '活跃用户',
12
- id: -202,
13
- type: 'active',
14
- isBuiltIn: true,
15
- attrList: []
16
- }, {
17
- name: '访问次数',
18
- id: -203,
19
- type: 'times',
20
- isBuiltIn: true,
21
- attrList: []
22
- }, {
23
- name: '平均使用时长',
24
- id: -204,
25
- type: 'duration_avg',
26
- isBuiltIn: true,
27
- attrList: []
28
- }, {
29
- name: '使用时长分布',
30
- id: -205,
31
- type: 'duration',
32
- isBuiltIn: true,
33
- attrList: []
34
- }]
35
- };