@zgfe/business-lib 1.1.29-alpha.2 → 1.1.29-event.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.
@@ -65,7 +65,6 @@ var BizConditionItem = function BizConditionItem(props) {
65
65
  propCategory: data.propCategory,
66
66
  type: data.type,
67
67
  key: data.attrId,
68
- label: data.label,
69
68
  dimensionSub: data.dimensionSub || 'event_attr'
70
69
  };
71
70
  }
@@ -75,7 +74,6 @@ var BizConditionItem = function BizConditionItem(props) {
75
74
  attrData = {
76
75
  id: aId,
77
76
  name: data.attrName,
78
- label: data.label,
79
77
  propCategory: data.propCategory,
80
78
  type: data.type,
81
79
  category: data.category,
@@ -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;
@@ -49,7 +49,6 @@ var EventDemo = function EventDemo() {
49
49
  eventGroupList: store.eventGroupList
50
50
  }
51
51
  }, /*#__PURE__*/React.createElement(BizEventSelector, {
52
- showBuiltInTarget: true,
53
52
  defaultValue: value,
54
53
  alias: "\u522B\u540D",
55
54
  onChange: onChange
@@ -16,7 +16,6 @@ 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';
20
19
  export var classPrefix = 'biz-event-select';
21
20
 
22
21
  var BizEventSelector = function BizEventSelector(props) {
@@ -56,7 +55,6 @@ var BizEventSelector = function BizEventSelector(props) {
56
55
  var _param$group, _param$event;
57
56
 
58
57
  var res = {};
59
- var allEvents = props.showBuiltInTarget ? eventGroupList === null || eventGroupList === void 0 ? void 0 : eventGroupList.concat(BuiltinIndicators) : eventGroupList;
60
58
 
61
59
  if (!((_param$group = param.group) === null || _param$group === void 0 ? void 0 : _param$group.id)) {
62
60
  res.group = {
@@ -64,7 +62,7 @@ var BizEventSelector = function BizEventSelector(props) {
64
62
  name: '所有分组',
65
63
  eventList: function () {
66
64
  var list = [];
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
  list = list.concat(group.eventList);
69
67
  });
70
68
  return list;
@@ -80,7 +78,7 @@ var BizEventSelector = function BizEventSelector(props) {
80
78
  };
81
79
  }
82
80
 
83
- allEvents === null || allEvents === void 0 ? void 0 : allEvents.forEach(function (group) {
81
+ eventGroupList === null || eventGroupList === void 0 ? void 0 : eventGroupList.forEach(function (group) {
84
82
  var _param$group2;
85
83
 
86
84
  if (group.id === ((_param$group2 = param.group) === null || _param$group2 === void 0 ? void 0 : _param$group2.id)) res.group = group;
@@ -133,7 +131,6 @@ var BizEventSelector = function BizEventSelector(props) {
133
131
  value: currentValue,
134
132
  onChange: onChange,
135
133
  showOverview: showAllEvent,
136
- showBuiltInTarget: props.showBuiltInTarget,
137
134
  defaultSelectAble: defaultSelectAble
138
135
  }),
139
136
  trigger: ['click'],
@@ -25,7 +25,6 @@ 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';
29
28
  import BizSearchInput from '../searchInput';
30
29
  import EventListOption from './option';
31
30
 
@@ -88,36 +87,15 @@ var EventListPanel = function EventListPanel(props) {
88
87
  }
89
88
  });
90
89
  });
91
- list = props.showBuiltInTarget ? [].concat(_toConsumableArray(BuiltinIndicators.eventList), markList, _toConsumableArray(list)) : [].concat(markList, _toConsumableArray(list));
90
+ list = [].concat(markList, _toConsumableArray(list));
92
91
  return list;
93
92
  }(),
94
93
  name: '所有分组'
95
94
  };
96
95
  setGroupList(function (list) {
97
- return props.showBuiltInTarget ? [group, BuiltinIndicators].concat(_toConsumableArray(list)) : [group].concat(_toConsumableArray(list));
98
- });
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;
96
+ return [group].concat(_toConsumableArray(list));
120
97
  });
98
+ setCurrentGroup(group);
121
99
  }, []);
122
100
  useEffect(function () {
123
101
  setCurrentValue(props.value);
@@ -218,12 +196,21 @@ var InfiniteScrollList = function InfiniteScrollList(_ref) {
218
196
  showList = _useState12[0],
219
197
  setShowList = _useState12[1];
220
198
 
199
+ var _useState13 = useState([]),
200
+ _useState14 = _slicedToArray(_useState13, 2),
201
+ canShowList = _useState14[0],
202
+ setCanShowList = _useState14[1];
203
+
221
204
  useEffect(function () {
222
- setShowList(searchEventList.slice(0, 10));
205
+ var data = searchEventList.filter(function (item) {
206
+ return item.eventHidden !== ShowStatus.hidden;
207
+ });
208
+ setCanShowList(data);
209
+ setShowList(data.slice(0, 10));
223
210
  }, [searchEventList]);
224
211
 
225
212
  var loadMoreData = function loadMoreData() {
226
- var moreData = searchEventList.slice(showList.length, showList.length + 10);
213
+ var moreData = canShowList.slice(showList.length, showList.length + 10);
227
214
  setShowList(function (list) {
228
215
  return [].concat(_toConsumableArray(list), _toConsumableArray(moreData));
229
216
  });
@@ -231,7 +218,7 @@ var InfiniteScrollList = function InfiniteScrollList(_ref) {
231
218
 
232
219
  return /*#__PURE__*/React.createElement(InfiniteScroll, {
233
220
  dataLength: showList.length,
234
- hasMore: showList.length < searchEventList.length,
221
+ hasMore: showList.length < canShowList.length,
235
222
  loader: /*#__PURE__*/React.createElement(Skeleton, {
236
223
  paragraph: {
237
224
  rows: 1
@@ -245,7 +232,6 @@ var InfiniteScrollList = function InfiniteScrollList(_ref) {
245
232
  }, showList.map(function (e) {
246
233
  var _currentValue$event2;
247
234
 
248
- if (e.eventHidden === ShowStatus.hidden) return null;
249
235
  return /*#__PURE__*/React.createElement(EventListOption, {
250
236
  label: e.alias || e.name,
251
237
  key: "".concat(currentGroup === null || currentGroup === void 0 ? void 0 : currentGroup.id, "-").concat(e.id),
@@ -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
  }
@@ -59,7 +59,6 @@ export default (function () {
59
59
  max: 3
60
60
  }, /*#__PURE__*/React.createElement(BizEventSelector, {
61
61
  showAllEvent: true,
62
- border: false,
63
- showBuiltInTarget: true
62
+ border: false
64
63
  }))), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("p", null, "\u5F53\u524D\u503C\uFF1A", JSON.stringify(target)));
65
64
  });
@@ -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, _targetData$value6, _targetData$value6$ev;
24
+ var _targetData$value2, _targetData$value2$ev, _targetData$value3, _targetData$value3$ev, _targetData$value4, _targetData$value4$ev, _targetData$value5, _targetData$value5$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, _targetData$value$eve2, _targetData$value$eve3;
95
+ var _targetData$value$eve;
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 || ((_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) {
100
+ if (((_targetData$value$eve = targetData.value.event) === null || _targetData$value$eve === void 0 ? void 0 : _targetData$value$eve.id) === -100) {
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$eve4;
178
+ var _target$value, _target$value$event, _targetData$value, _targetData$value$eve2;
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$eve4 = _targetData$value.event) === null || _targetData$value$eve4 === void 0 ? void 0 : _targetData$value$eve4.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$eve2 = _targetData$value.event) === null || _targetData$value$eve2 === void 0 ? void 0 : _targetData$value$eve2.id)) {
185
185
  filterData = undefined;
186
186
  setFilters(undefined);
187
187
  setIsAdd(false);
@@ -211,21 +211,20 @@ var BizTargetCondition = function BizTargetCondition(props) {
211
211
  onChange(dimension, targetData, data);
212
212
  };
213
213
 
214
- var onChange = function onChange(analysisDimension, target, filterData) {
214
+ var onChange = function onChange(analysisDimension, target, filterDatas) {
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
 
218
218
  if (!target || !target.value || !((_target$value$event2 = target.value.event) === null || _target$value$event2 === void 0 ? void 0 : _target$value$event2.id)) return;
219
219
  var data = {
220
- type: target.value.event.type || 'event',
220
+ type: 'event',
221
221
  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
222
  eventId: (_target$value$event4 = target.value.event) === null || _target$value$event4 === void 0 ? void 0 : _target$value$event4.id,
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: filterData,
227
- marked: target.value.event.marked,
228
- isBuiltIn: target.value.event.isBuiltIn
226
+ filters: filterDatas,
227
+ marked: target.value.event.marked
229
228
  };
230
229
  props.onChange(data);
231
230
  }
@@ -259,17 +258,17 @@ var BizTargetCondition = function BizTargetCondition(props) {
259
258
  onAdd: onAdd,
260
259
  onDelete: onDelete,
261
260
  onChange: onChangeTarget
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,
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,
264
263
  value: dimension,
265
264
  onChange: onChangeDimension
266
- }) : null), (filters || isAdd) && /*#__PURE__*/React.createElement(BizConditionGroup, {
265
+ })), (filters || isAdd) && /*#__PURE__*/React.createElement(BizConditionGroup, {
267
266
  ref: conditionRef,
268
267
  value: filters,
269
268
  onlyAnd: props.onlyAnd,
270
269
  enableEventProp: true,
271
270
  enableDelete: true,
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,
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,
273
272
  onChange: onChangeFilters,
274
273
  onConditionsCount: setCount
275
274
  })));
@@ -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.29-alpha.2",
3
+ "version": "1.1.29-event.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": "5fc87bd92fdba876713199dcb2b874c6156ea03c"
62
+ "gitHead": "c4a8d584a2272975b8bb38a2bca14aca7272012a"
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
- };