@zgfe/business-lib 1.1.27 → 1.1.29-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.
@@ -176,7 +176,7 @@ var StringList = function StringList(props) {
176
176
  className: "".concat(classPrefix, "-multi-select"),
177
177
  value: current,
178
178
  multiple: true,
179
- enableCreate: false,
179
+ enableCreate: true,
180
180
  theme: props.theme,
181
181
  size: "middle",
182
182
  disable: props.operate === OperateTypes.IsNull || props.operate === OperateTypes.IsNotNull,
@@ -24,6 +24,7 @@ export interface AnalysisEvent {
24
24
  isOverview?: boolean;
25
25
  eventHidden?: ShowStatus;
26
26
  marked?: boolean;
27
+ isBuiltIn?: boolean;
27
28
  }
28
29
  export interface EventGroup {
29
30
  id: number;
@@ -0,0 +1,10 @@
1
+ export declare const BuiltinIndicators: {
2
+ id: number;
3
+ name: string;
4
+ eventList: {
5
+ name: string;
6
+ id: number;
7
+ isBuiltIn: boolean;
8
+ attrList: never[];
9
+ }[];
10
+ };
@@ -0,0 +1,30 @@
1
+ export var BuiltinIndicators = {
2
+ id: -2,
3
+ name: '整体',
4
+ eventList: [{
5
+ name: '新增用户',
6
+ id: -201,
7
+ isBuiltIn: true,
8
+ attrList: []
9
+ }, {
10
+ name: '活跃用户',
11
+ id: -202,
12
+ isBuiltIn: true,
13
+ attrList: []
14
+ }, {
15
+ name: '访问次数',
16
+ id: -203,
17
+ isBuiltIn: true,
18
+ attrList: []
19
+ }, {
20
+ name: '平均使用时长',
21
+ id: -204,
22
+ isBuiltIn: true,
23
+ attrList: []
24
+ }, {
25
+ name: '使用时长分布',
26
+ id: -205,
27
+ isBuiltIn: true,
28
+ attrList: []
29
+ }]
30
+ };
@@ -49,6 +49,7 @@ var EventDemo = function EventDemo() {
49
49
  eventGroupList: store.eventGroupList
50
50
  }
51
51
  }, /*#__PURE__*/React.createElement(BizEventSelector, {
52
+ showBuiltInTarget: true,
52
53
  defaultValue: value,
53
54
  alias: "\u522B\u540D",
54
55
  onChange: onChange
@@ -16,6 +16,7 @@ import SelectHandle from '../select/handle';
16
16
  import BizGlobalDataContext from '../context';
17
17
  import EventListPanel from './listPanel';
18
18
  import './styles/index.less';
19
+ import { BuiltinIndicators } from '../constants/common';
19
20
  export var classPrefix = 'biz-event-select';
20
21
 
21
22
  var BizEventSelector = function BizEventSelector(props) {
@@ -55,6 +56,7 @@ var BizEventSelector = function BizEventSelector(props) {
55
56
  var _param$group, _param$event;
56
57
 
57
58
  var res = {};
59
+ var allEvents = props.showBuiltInTarget ? eventGroupList === null || eventGroupList === void 0 ? void 0 : eventGroupList.concat(BuiltinIndicators) : eventGroupList;
58
60
 
59
61
  if (!((_param$group = param.group) === null || _param$group === void 0 ? void 0 : _param$group.id)) {
60
62
  res.group = {
@@ -62,7 +64,7 @@ var BizEventSelector = function BizEventSelector(props) {
62
64
  name: '所有分组',
63
65
  eventList: function () {
64
66
  var list = [];
65
- eventGroupList === null || eventGroupList === void 0 ? void 0 : eventGroupList.forEach(function (group) {
67
+ allEvents === null || allEvents === void 0 ? void 0 : allEvents.forEach(function (group) {
66
68
  list = list.concat(group.eventList);
67
69
  });
68
70
  return list;
@@ -78,7 +80,7 @@ var BizEventSelector = function BizEventSelector(props) {
78
80
  };
79
81
  }
80
82
 
81
- eventGroupList === null || eventGroupList === void 0 ? void 0 : eventGroupList.forEach(function (group) {
83
+ allEvents === null || allEvents === void 0 ? void 0 : allEvents.forEach(function (group) {
82
84
  var _param$group2;
83
85
 
84
86
  if (group.id === ((_param$group2 = param.group) === null || _param$group2 === void 0 ? void 0 : _param$group2.id)) res.group = group;
@@ -131,6 +133,7 @@ var BizEventSelector = function BizEventSelector(props) {
131
133
  value: currentValue,
132
134
  onChange: onChange,
133
135
  showOverview: showAllEvent,
136
+ showBuiltInTarget: props.showBuiltInTarget,
134
137
  defaultSelectAble: defaultSelectAble
135
138
  }),
136
139
  trigger: ['click'],
@@ -25,6 +25,7 @@ import InfiniteScroll from 'react-infinite-scroll-component';
25
25
  import { classPrefix } from '.';
26
26
  import { BizGlobalDataContext } from '..';
27
27
  import { ShowStatus } from '../attributeSelector/types';
28
+ import { BuiltinIndicators } from '../constants/common';
28
29
  import BizSearchInput from '../searchInput';
29
30
  import EventListOption from './option';
30
31
 
@@ -87,13 +88,13 @@ var EventListPanel = function EventListPanel(props) {
87
88
  }
88
89
  });
89
90
  });
90
- list = [].concat(markList, _toConsumableArray(list));
91
+ list = props.showBuiltInTarget ? [].concat(_toConsumableArray(BuiltinIndicators.eventList), markList, _toConsumableArray(list)) : [].concat(markList, _toConsumableArray(list));
91
92
  return list;
92
93
  }(),
93
94
  name: '所有分组'
94
95
  };
95
96
  setGroupList(function (list) {
96
- return [group].concat(_toConsumableArray(list));
97
+ return props.showBuiltInTarget ? [group, BuiltinIndicators].concat(_toConsumableArray(list)) : [group].concat(_toConsumableArray(list));
97
98
  });
98
99
  setCurrentGroup(group);
99
100
  }, []);
@@ -23,6 +23,7 @@ export declare namespace EventSelectTypes {
23
23
  showAllEvent?: boolean;
24
24
  defaultSelectAble?: boolean;
25
25
  popupContainer?: boolean;
26
+ showBuiltInTarget?: boolean;
26
27
  onVisibleChange?: (visible: boolean) => void;
27
28
  border?: boolean;
28
29
  theme?: string;
@@ -33,6 +34,7 @@ export declare namespace EventSelectTypes {
33
34
  interface DropdownProps {
34
35
  value?: Value;
35
36
  showOverview?: boolean;
37
+ showBuiltInTarget?: boolean;
36
38
  defaultSelectAble?: boolean;
37
39
  onChange?: (value: Value, isOverview?: boolean) => void;
38
40
  }
@@ -59,6 +59,7 @@ export default (function () {
59
59
  max: 3
60
60
  }, /*#__PURE__*/React.createElement(BizEventSelector, {
61
61
  showAllEvent: true,
62
- border: false
62
+ border: false,
63
+ showBuiltInTarget: true
63
64
  }))), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("p", null, "\u5F53\u524D\u503C\uFF1A", JSON.stringify(target)));
64
65
  });
@@ -21,7 +21,7 @@ import BizGlobalDataContext from '../context';
21
21
  export var classPrefix = 'biz-target';
22
22
 
23
23
  var BizTargetCondition = function BizTargetCondition(props) {
24
- var _targetData$value2, _targetData$value2$ev, _targetData$value3, _targetData$value3$ev, _targetData$value4, _targetData$value4$ev, _targetData$value5, _targetData$value5$ev;
24
+ var _targetData$value2, _targetData$value2$ev, _targetData$value3, _targetData$value3$ev, _targetData$value4, _targetData$value4$ev, _targetData$value5, _targetData$value5$ev, _targetData$value6, _targetData$value6$ev;
25
25
 
26
26
  var max = props.max;
27
27
 
@@ -92,12 +92,12 @@ var BizTargetCondition = function BizTargetCondition(props) {
92
92
  }, []);
93
93
  useEffect(function () {
94
94
  if (targetData === null || targetData === void 0 ? void 0 : targetData.value) {
95
- var _targetData$value$eve;
95
+ var _targetData$value$eve, _targetData$value$eve2, _targetData$value$eve3;
96
96
 
97
97
  var canAdd = true,
98
98
  canDelete = true;
99
99
 
100
- if (((_targetData$value$eve = targetData.value.event) === null || _targetData$value$eve === void 0 ? void 0 : _targetData$value$eve.id) === -100) {
100
+ 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) {
101
101
  var _targetData$value$gro;
102
102
 
103
103
  canAdd = false;
@@ -175,13 +175,13 @@ var BizTargetCondition = function BizTargetCondition(props) {
175
175
  };
176
176
 
177
177
  var onChangeTarget = function onChangeTarget(target) {
178
- var _target$value, _target$value$event, _targetData$value, _targetData$value$eve2;
178
+ var _target$value, _target$value$event, _targetData$value, _targetData$value$eve4;
179
179
 
180
180
  setTargetData(target);
181
181
 
182
182
  var filterData = _.cloneDeep(filters);
183
183
 
184
- 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)) {
184
+ 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$eve4 = _targetData$value.event) === null || _targetData$value$eve4 === void 0 ? void 0 : _targetData$value$eve4.id)) {
185
185
  filterData = undefined;
186
186
  setFilters(undefined);
187
187
  setIsAdd(false);
@@ -211,7 +211,7 @@ var BizTargetCondition = function BizTargetCondition(props) {
211
211
  onChange(dimension, targetData, data);
212
212
  };
213
213
 
214
- var onChange = function onChange(analysisDimension, target, filterDatas) {
214
+ var onChange = function onChange(analysisDimension, target, filterData) {
215
215
  if (props.onChange) {
216
216
  var _target$value$event2, _target$value$event3, _target$value$event4, _target$value$event5, _target$value$event6, _target$value$group;
217
217
 
@@ -223,8 +223,9 @@ var BizTargetCondition = function BizTargetCondition(props) {
223
223
  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),
224
224
  eventGroupId: (_target$value$group = target.value.group) === null || _target$value$group === void 0 ? void 0 : _target$value$group.id,
225
225
  analysisDimension: analysisDimension,
226
- filters: filterDatas,
227
- marked: target.value.event.marked
226
+ filters: filterData,
227
+ marked: target.value.event.marked,
228
+ isBuiltIn: target.value.event.isBuiltIn
228
229
  };
229
230
  props.onChange(data);
230
231
  }
@@ -258,17 +259,17 @@ var BizTargetCondition = function BizTargetCondition(props) {
258
259
  onAdd: onAdd,
259
260
  onDelete: onDelete,
260
261
  onChange: onChangeTarget
261
- }, props.children), /*#__PURE__*/React.createElement(BizTargetDimension, {
262
- 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,
262
+ }, props.children), !(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.isBuiltIn) ? /*#__PURE__*/React.createElement(BizTargetDimension, {
263
+ eventId: (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) ? 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 : undefined,
263
264
  value: dimension,
264
265
  onChange: onChangeDimension
265
- })), (filters || isAdd) && /*#__PURE__*/React.createElement(BizConditionGroup, {
266
+ }) : null), (filters || isAdd) && /*#__PURE__*/React.createElement(BizConditionGroup, {
266
267
  ref: conditionRef,
267
268
  value: filters,
268
269
  onlyAnd: props.onlyAnd,
269
270
  enableEventProp: true,
270
271
  enableDelete: true,
271
- 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,
272
+ eventIdList: (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) ? [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] : undefined,
272
273
  onChange: onChangeFilters,
273
274
  onConditionsCount: setCount
274
275
  })));
@@ -20,6 +20,7 @@ export declare namespace TargetConditionTypes {
20
20
  eventId: number;
21
21
  eventName?: string;
22
22
  eventGroupId?: number;
23
+ isBuiltIn?: boolean;
23
24
  }
24
25
  interface Props {
25
26
  defaultValue?: Value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/business-lib",
3
- "version": "1.1.27",
3
+ "version": "1.1.29-alpha.0",
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": "4c17bc0cf0313657940b5c4a14b866ec200f6fcd"
62
+ "gitHead": "82c988eaa3782ab52001ddcbf335fb3d2e05056f"
63
63
  }