@zgfe/business-lib 1.1.34-visual.10 → 1.1.34-visual.11

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.
@@ -165,7 +165,7 @@ var BizAddToPanel = function BizAddToPanel(props) {
165
165
  });
166
166
  }
167
167
  return /*#__PURE__*/React.createElement(BizDialog, {
168
- visible: true,
168
+ open: true,
169
169
  title: props.type === 'edit' ? '修改当前看板指标' : '向看板添加指标',
170
170
  width: 503,
171
171
  maskClosable: false,
@@ -215,6 +215,12 @@ var BizAddToPanel = function BizAddToPanel(props) {
215
215
  hidden: props.type === 'edit',
216
216
  rules: [{
217
217
  validator: function validator(_, value) {
218
+ if (props.type === 'edit') {
219
+ notification.error({
220
+ message: '指标名称不能为空'
221
+ });
222
+ return Promise.reject();
223
+ }
218
224
  if (!value || !/\S+/.test(value)) return Promise.reject('请输入指标名称!');
219
225
  if (!/^[\S\s]{1,20}$/.test(value)) return Promise.reject('指标名称最多为20个字符!');
220
226
  return Promise.resolve();
@@ -112,7 +112,7 @@ var BizAddToScene = function BizAddToScene(props) {
112
112
  }, []);
113
113
  return /*#__PURE__*/React.createElement(BizDialog, {
114
114
  title: "\u6DFB\u52A0\u5230\u5E38\u7528\u573A\u666F",
115
- visible: true,
115
+ open: true,
116
116
  maskClosable: false,
117
117
  onOk: onSave,
118
118
  onCancel: onCancel,
@@ -18,7 +18,6 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
18
18
  'box-shadow-base': '0px 4px 10px rgba(0, 0, 0, 0.1)',
19
19
  'btn-text-hover-bg': '#cacdd4',
20
20
  'warning-color': '#FD9F41',
21
- 'border-color-split': '#E8EFFF',
22
- 'icon-color': '#5F6085'
21
+ 'border-color-split': '#E8EFFF'
23
22
  };
24
23
  });
@@ -119,6 +119,7 @@ var ValuesList = function ValuesList(props) {
119
119
  labelField: "label",
120
120
  size: "middle",
121
121
  theme: props.theme,
122
+ overlayWidth: 60,
122
123
  className: "".concat(classPrefix, "-input-select"),
123
124
  onChange: onChangeUnit,
124
125
  options: propSubtype
@@ -87,19 +87,21 @@ var BizAttributeSelector = function BizAttributeSelector(props) {
87
87
  }, /*#__PURE__*/React.createElement("div", {
88
88
  className: "".concat(classPrefix, "-handle")
89
89
  }, /*#__PURE__*/React.createElement(Dropdown, {
90
- overlay: /*#__PURE__*/React.createElement(AttrListPanel, _objectSpread(_objectSpread({
91
- id: id
92
- }, props), {}, {
93
- value: currentAttr,
94
- onChange: onChange
95
- })),
90
+ dropdownRender: function dropdownRender() {
91
+ return /*#__PURE__*/React.createElement(AttrListPanel, _objectSpread(_objectSpread({
92
+ id: id
93
+ }, props), {}, {
94
+ value: currentAttr,
95
+ onChange: onChange
96
+ }));
97
+ },
96
98
  trigger: ['click'],
97
99
  overlayStyle: {
98
100
  minWidth: 284,
99
101
  width: width
100
102
  },
101
- visible: visible,
102
- onVisibleChange: onVisibleChange,
103
+ open: visible,
104
+ onOpenChange: onVisibleChange,
103
105
  destroyPopupOnHide: props.destroyPopupOnHide
104
106
  }, /*#__PURE__*/React.createElement("div", {
105
107
  style: {
@@ -24,6 +24,8 @@ export interface AnalysisEvent {
24
24
  isOverview?: boolean;
25
25
  eventHidden?: ShowStatus;
26
26
  marked?: boolean;
27
+ isBuiltIn?: boolean;
28
+ type?: string;
27
29
  }
28
30
  export interface EventGroup {
29
31
  id: number;
@@ -21,7 +21,7 @@ var tooltipFormatterDefault = function tooltipFormatterDefault(params) {
21
21
  } else {
22
22
  lineLabel = util.toThousands(lineLabel);
23
23
  }
24
- var name = (params.length > 1 ? item.seriesName : item.data && item.data.label ? item.data.label : item.name).trim();
24
+ var name = item.seriesName.trim();
25
25
  htmlArray.push("<div class=\"biz-chart-tooltip-item\">\n <div class=\"biz-chart-tooltip-content\">\n <span class=\"biz-tooltip-marker\" style=\"background:".concat(item.color, "\"></span>\n <div class=\"biz-tooltip-name\">").concat(name, "</div>\n </div> \n <span class=\"biz-chart-tooltip-value\">").concat(lineLabel, "</span>\n </div>"));
26
26
  });
27
27
  return htmlArray.join('');
@@ -0,0 +1,11 @@
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
+ };
@@ -0,0 +1,35 @@
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
+ };
@@ -69,21 +69,23 @@ var MonthDay = function MonthDay(props) {
69
69
  }
70
70
  return /*#__PURE__*/React.createElement(Dropdown, {
71
71
  disabled: disable,
72
- overlay: /*#__PURE__*/React.createElement("div", {
73
- className: "".concat(classPrefix, "-overlay")
74
- }, dayList.map(function (item) {
75
- return /*#__PURE__*/React.createElement("span", {
76
- key: item.value,
77
- className: "".concat(classPrefix, "-day ").concat(chosenDayList.map(function (v) {
78
- return v.value;
79
- }).indexOf(item.value) > -1 ? 'active' : '', " ").concat(item.value === 32 ? 'lastday' : ''),
80
- onClick: function onClick() {
81
- onClickMonthDay(item.value);
82
- }
83
- }, item.label);
84
- })),
85
- visible: visible,
86
- onVisibleChange: setVisible,
72
+ dropdownRender: function dropdownRender() {
73
+ return /*#__PURE__*/React.createElement("div", {
74
+ className: "".concat(classPrefix, "-overlay")
75
+ }, dayList.map(function (item) {
76
+ return /*#__PURE__*/React.createElement("span", {
77
+ key: item.value,
78
+ className: "".concat(classPrefix, "-day ").concat(chosenDayList.map(function (v) {
79
+ return v.value;
80
+ }).indexOf(item.value) > -1 ? 'active' : '', " ").concat(item.value === 32 ? 'lastday' : ''),
81
+ onClick: function onClick() {
82
+ onClickMonthDay(item.value);
83
+ }
84
+ }, item.label);
85
+ }));
86
+ },
87
+ open: visible,
88
+ onOpenChange: setVisible,
87
89
  trigger: ['click']
88
90
  }, /*#__PURE__*/React.createElement("div", {
89
91
  className: "".concat(classPrefix, "-wrapper")
@@ -39,6 +39,7 @@ var EventDemo = function EventDemo() {
39
39
  eventGroupList: store.eventGroupList
40
40
  }
41
41
  }, /*#__PURE__*/React.createElement(BizEventSelector, {
42
+ showBuiltInTarget: true,
42
43
  defaultValue: value,
43
44
  alias: "\u522B\u540D",
44
45
  onChange: onChange
@@ -10,6 +10,7 @@ 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';
13
14
  export var classPrefix = 'biz-event-select';
14
15
  var BizEventSelector = function BizEventSelector(props) {
15
16
  var alias = props.alias,
@@ -42,13 +43,14 @@ var BizEventSelector = function BizEventSelector(props) {
42
43
  var getValue = function getValue(param) {
43
44
  var _param$group, _param$event;
44
45
  var res = {};
46
+ var allEvents = props.showBuiltInTarget ? eventGroupList === null || eventGroupList === void 0 ? void 0 : eventGroupList.concat(BuiltinIndicators) : eventGroupList;
45
47
  if (!((_param$group = param.group) === null || _param$group === void 0 ? void 0 : _param$group.id)) {
46
48
  res.group = {
47
49
  id: 0,
48
50
  name: '所有分组',
49
51
  eventList: function () {
50
52
  var list = [];
51
- eventGroupList === null || eventGroupList === void 0 ? void 0 : eventGroupList.forEach(function (group) {
53
+ allEvents === null || allEvents === void 0 ? void 0 : allEvents.forEach(function (group) {
52
54
  list = list.concat(group.eventList);
53
55
  });
54
56
  return list;
@@ -62,7 +64,7 @@ var BizEventSelector = function BizEventSelector(props) {
62
64
  attrList: []
63
65
  };
64
66
  }
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
  var _param$group2;
67
69
  if (group.id === ((_param$group2 = param.group) === null || _param$group2 === void 0 ? void 0 : _param$group2.id)) res.group = group;
68
70
  group.eventList.forEach(function (event) {
@@ -100,19 +102,22 @@ var BizEventSelector = function BizEventSelector(props) {
100
102
  return /*#__PURE__*/React.createElement("div", {
101
103
  className: [classPrefix, border ? 'border' : ''].join(' ')
102
104
  }, /*#__PURE__*/React.createElement(Dropdown, {
103
- overlay: /*#__PURE__*/React.createElement(EventListPanel, {
104
- value: currentValue,
105
- onChange: onChange,
106
- showOverview: showAllEvent,
107
- defaultSelectAble: defaultSelectAble
108
- }),
105
+ dropdownRender: function dropdownRender() {
106
+ return /*#__PURE__*/React.createElement(EventListPanel, {
107
+ value: currentValue,
108
+ onChange: onChange,
109
+ showOverview: showAllEvent,
110
+ showBuiltInTarget: props.showBuiltInTarget,
111
+ defaultSelectAble: defaultSelectAble
112
+ });
113
+ },
109
114
  trigger: ['click'],
110
115
  overlayStyle: {
111
116
  minWidth: 0,
112
117
  paddingLeft: 8
113
118
  },
114
- visible: visible,
115
- onVisibleChange: onVisibleChange,
119
+ open: visible,
120
+ onOpenChange: onVisibleChange,
116
121
  getPopupContainer: props.popupContainer ? function () {
117
122
  return document.getElementById(selectId);
118
123
  } : undefined,
@@ -15,6 +15,7 @@ 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';
18
19
  import BizSearchInput from '../searchInput';
19
20
  import EventListOption from './option';
20
21
  var EventListPanel = function EventListPanel(props) {
@@ -68,15 +69,33 @@ var EventListPanel = function EventListPanel(props) {
68
69
  }
69
70
  });
70
71
  });
71
- list = [].concat(markList, _toConsumableArray(list));
72
+ list = props.showBuiltInTarget ? [].concat(_toConsumableArray(BuiltinIndicators.eventList), markList, _toConsumableArray(list)) : [].concat(markList, _toConsumableArray(list));
72
73
  return list;
73
74
  }(),
74
75
  name: '所有分组'
75
76
  };
76
77
  setGroupList(function (list) {
77
- return [group].concat(_toConsumableArray(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;
78
98
  });
79
- setCurrentGroup(group);
80
99
  }, []);
81
100
  useEffect(function () {
82
101
  setCurrentValue(props.value);
@@ -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
  }
@@ -67,7 +67,11 @@ var SelectHandle = /*#__PURE__*/React.forwardRef(function (props, ref) {
67
67
  }
68
68
  }, [focus]);
69
69
  var searchInputWidth = useMemo(function () {
70
- return textRef.current && searchValue ? textRef.current.offsetWidth : 3;
70
+ if (textRef.current && searchValue) {
71
+ textRef.current.innerText = searchValue;
72
+ return textRef.current.offsetWidth;
73
+ }
74
+ return 3;
71
75
  }, [searchValue]);
72
76
  var onDelete = function onDelete(data) {
73
77
  if (props.onDelete) props.onDelete(data);
@@ -122,7 +126,7 @@ var SelectHandle = /*#__PURE__*/React.forwardRef(function (props, ref) {
122
126
  }), /*#__PURE__*/React.createElement("span", {
123
127
  className: "".concat(classPrefix, "-temp"),
124
128
  ref: textRef
125
- }, searchValue));
129
+ }));
126
130
  }
127
131
  return /*#__PURE__*/React.createElement("div", {
128
132
  ref: handleRef,
@@ -146,15 +146,17 @@ var BizSelect = function BizSelect(props) {
146
146
  setVisible(true);
147
147
  };
148
148
  return /*#__PURE__*/React.createElement(Dropdown, {
149
- overlay: /*#__PURE__*/React.createElement(SelectOverlay, _objectSpread(_objectSpread({}, res), {}, {
150
- value: current,
151
- labelField: labelField,
152
- keyField: keyField,
153
- searchValue: searchValue,
154
- onChange: onChange,
155
- ref: overlayRef,
156
- searchPlaceholder: props.searchPlaceholder
157
- })),
149
+ dropdownRender: function dropdownRender() {
150
+ return /*#__PURE__*/React.createElement(SelectOverlay, _objectSpread(_objectSpread({}, res), {}, {
151
+ value: current,
152
+ labelField: labelField,
153
+ keyField: keyField,
154
+ searchValue: searchValue,
155
+ onChange: onChange,
156
+ ref: overlayRef,
157
+ searchPlaceholder: props.searchPlaceholder
158
+ }));
159
+ },
158
160
  disabled: props.disable,
159
161
  destroyPopupOnHide: props.destroyPopupOnHide,
160
162
  overlayStyle: {
@@ -165,8 +167,8 @@ var BizSelect = function BizSelect(props) {
165
167
  getPopupContainer: props.popupContainer ? function () {
166
168
  return document.getElementById(selectId);
167
169
  } : undefined,
168
- visible: visible,
169
- onVisibleChange: onVisibleChange
170
+ open: visible,
171
+ onOpenChange: onVisibleChange
170
172
  }, /*#__PURE__*/React.createElement("div", {
171
173
  className: "".concat(classPrefix, "-handle ").concat(props.className ? props.className : ''),
172
174
  ref: selectRef,
@@ -97,33 +97,35 @@ var BizTargetDimension = function BizTargetDimension(props) {
97
97
  overlayClassName: "".concat(classPrefix, "-dropmenu"),
98
98
  placement: "bottom",
99
99
  trigger: ['click'],
100
- overlay: /*#__PURE__*/React.createElement(Menu, null, options.map(function (item) {
101
- if (item.children) {
102
- return /*#__PURE__*/React.createElement(SubMenu, {
103
- popupClassName: "".concat(classPrefix, "-submenu"),
104
- key: item.label,
105
- title: item.label,
106
- className: "".concat((dimensionParent === null || dimensionParent === void 0 ? void 0 : dimensionParent.label) === item.label ? 'active' : '')
107
- }, item.children.map(function (sub) {
108
- return /*#__PURE__*/React.createElement(Menu.Item, {
109
- className: (dimensionParent === null || dimensionParent === void 0 ? void 0 : dimensionParent.value) === item.value && (dimension === null || dimension === void 0 ? void 0 : dimension.value) === sub.value ? 'active' : '',
110
- title: sub.label,
111
- key: "".concat(item.value, "-").concat(sub.value),
112
- onClick: function onClick() {
113
- return onChange(sub, item);
114
- }
115
- }, sub.label);
116
- }));
117
- }
118
- return /*#__PURE__*/React.createElement(Menu.Item, {
119
- className: (dimension === null || dimension === void 0 ? void 0 : dimension.value) === item.value ? 'active' : '',
120
- key: item.value,
121
- onClick: function onClick() {
122
- return onChange(item);
123
- },
124
- title: item.label
125
- }, item.label);
126
- }))
100
+ dropdownRender: function dropdownRender() {
101
+ return /*#__PURE__*/React.createElement(Menu, null, options.map(function (item) {
102
+ if (item.children) {
103
+ return /*#__PURE__*/React.createElement(SubMenu, {
104
+ popupClassName: "".concat(classPrefix, "-submenu"),
105
+ key: item.label,
106
+ title: item.label,
107
+ className: "".concat((dimensionParent === null || dimensionParent === void 0 ? void 0 : dimensionParent.label) === item.label ? 'active' : '')
108
+ }, item.children.map(function (sub) {
109
+ return /*#__PURE__*/React.createElement(Menu.Item, {
110
+ className: (dimensionParent === null || dimensionParent === void 0 ? void 0 : dimensionParent.value) === item.value && (dimension === null || dimension === void 0 ? void 0 : dimension.value) === sub.value ? 'active' : '',
111
+ title: sub.label,
112
+ key: "".concat(item.value, "-").concat(sub.value),
113
+ onClick: function onClick() {
114
+ return onChange(sub, item);
115
+ }
116
+ }, sub.label);
117
+ }));
118
+ }
119
+ return /*#__PURE__*/React.createElement(Menu.Item, {
120
+ className: (dimension === null || dimension === void 0 ? void 0 : dimension.value) === item.value ? 'active' : '',
121
+ key: item.value,
122
+ onClick: function onClick() {
123
+ return onChange(item);
124
+ },
125
+ title: item.label
126
+ }, item.label);
127
+ }));
128
+ }
127
129
  }, /*#__PURE__*/React.createElement("div", {
128
130
  className: "".concat(classPrefix, "-dimension")
129
131
  }, /*#__PURE__*/React.createElement(SelectHandle, {
@@ -43,9 +43,6 @@ export var attrOptions = [{
43
43
  }, {
44
44
  label: '均值',
45
45
  value: 'avg'
46
- }, {
47
- label: '分布',
48
- value: 'duration_times'
49
46
  }, {
50
47
  label: '中位数',
51
48
  value: 'median'
@@ -51,6 +51,7 @@ export default (function () {
51
51
  max: 3
52
52
  }, /*#__PURE__*/React.createElement(BizEventSelector, {
53
53
  showAllEvent: true,
54
- border: false
54
+ border: false,
55
+ showBuiltInTarget: true
55
56
  }))), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("p", null, "\u5F53\u524D\u503C\uFF1A", JSON.stringify(target)));
56
57
  });
@@ -1,3 +1,9 @@
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); }
1
7
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
8
  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."); }
3
9
  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); }
@@ -12,9 +18,10 @@ import BizConditionGroup from '../attrConditions/group';
12
18
  import { Skeleton } from 'antd';
13
19
  import _ from 'lodash';
14
20
  import BizGlobalDataContext from '../context';
21
+ import { BuiltinIndicators } from '../constants/common';
15
22
  export var classPrefix = 'biz-target';
16
23
  var BizTargetCondition = function BizTargetCondition(props) {
17
- 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$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;
18
25
  var max = props.max;
19
26
  var _useState = useState(),
20
27
  _useState2 = _slicedToArray(_useState, 2),
@@ -69,14 +76,14 @@ var BizTargetCondition = function BizTargetCondition(props) {
69
76
  }, []);
70
77
  useEffect(function () {
71
78
  if (targetData === null || targetData === void 0 ? void 0 : targetData.value) {
72
- var _targetData$value$eve;
79
+ var _targetData$value$eve, _targetData$value$eve2, _targetData$value$eve3;
73
80
  var canAdd = true,
74
81
  canDelete = true;
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;
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;
77
84
  canAdd = false;
78
85
  setFilters(undefined);
79
- if (!((_targetData$value$gro = targetData.value.group) === null || _targetData$value$gro === void 0 ? void 0 : _targetData$value$gro.id)) {
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) {
80
87
  canDelete = false;
81
88
  }
82
89
  } else {
@@ -109,37 +116,55 @@ var BizTargetCondition = function BizTargetCondition(props) {
109
116
  eventList: []
110
117
  };
111
118
  }
112
- if (data.eventId === -100) {
113
- target.value.event = {
114
- id: -100,
115
- name: '事件概览',
116
- attrList: []
117
- };
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
+ });
118
134
  }
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;
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
+ }
127
152
  }
128
153
  }
129
- }
130
- if (data.eventGroupId && data.eventGroupId === group.id) {
131
- target.value.group = group;
132
- break;
154
+ if (data.eventGroupId && data.eventGroupId === group.id) {
155
+ target.value.group = group;
156
+ break;
157
+ }
133
158
  }
134
159
  }
135
160
  }
136
161
  return target;
137
162
  };
138
163
  var onChangeTarget = function onChangeTarget(target) {
139
- var _target$value, _target$value$event, _targetData$value, _targetData$value$eve2;
164
+ var _target$value, _target$value$event, _targetData$value, _targetData$value$eve5;
140
165
  setTargetData(target);
141
166
  var filterData = _.cloneDeep(filters);
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)) {
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)) {
143
168
  filterData = undefined;
144
169
  setFilters(undefined);
145
170
  setIsAdd(false);
@@ -163,19 +188,25 @@ var BizTargetCondition = function BizTargetCondition(props) {
163
188
  setFilters(data);
164
189
  onChange(dimension, targetData, data);
165
190
  };
166
- var onChange = function onChange(analysisDimension, target, filterDatas) {
191
+ var onChange = function onChange(analysisDimension, target, filterData) {
167
192
  if (props.onChange) {
168
- var _target$value$event2, _target$value$event3, _target$value$event4, _target$value$event5, _target$value$event6, _target$value$group;
193
+ var _target$value$event2, _target$value$event3, _target$value$event4, _target$value$event5, _target$value$event6, _target$value$group2;
169
194
  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
+ }
170
200
  var data = {
171
- type: 'event',
201
+ type: type,
172
202
  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) || '',
173
203
  eventId: (_target$value$event4 = target.value.event) === null || _target$value$event4 === void 0 ? void 0 : _target$value$event4.id,
174
204
  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),
175
- eventGroupId: (_target$value$group = target.value.group) === null || _target$value$group === void 0 ? void 0 : _target$value$group.id,
205
+ eventGroupId: (_target$value$group2 = target.value.group) === null || _target$value$group2 === void 0 ? void 0 : _target$value$group2.id,
176
206
  analysisDimension: analysisDimension,
177
- filters: filterDatas,
178
- marked: target.value.event.marked
207
+ filters: filterData,
208
+ marked: target.value.event.marked,
209
+ isBuiltIn: target.value.event.isBuiltIn
179
210
  };
180
211
  props.onChange(data);
181
212
  }
@@ -206,8 +237,8 @@ var BizTargetCondition = function BizTargetCondition(props) {
206
237
  onAdd: onAdd,
207
238
  onDelete: onDelete,
208
239
  onChange: onChangeTarget
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,
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,
211
242
  value: dimension,
212
243
  onChange: onChangeDimension
213
244
  })), (filters || isAdd) && /*#__PURE__*/React.createElement(BizConditionGroup, {
@@ -216,7 +247,7 @@ var BizTargetCondition = function BizTargetCondition(props) {
216
247
  onlyAnd: props.onlyAnd,
217
248
  enableEventProp: true,
218
249
  enableDelete: true,
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,
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,
220
251
  onChange: onChangeFilters,
221
252
  onConditionsCount: setCount
222
253
  })));
@@ -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;
@@ -103,13 +103,15 @@ var BizTargetSelector = function BizTargetSelector(props) {
103
103
  enabled: enableDelete,
104
104
  onClick: onClickIcon
105
105
  }), targetData && /*#__PURE__*/React.createElement(Dropdown, {
106
- visible: visible,
107
- onVisibleChange: onVisibleChange,
108
- overlay: /*#__PURE__*/React.createElement(BizTargetOptionMenu, {
109
- onClick: onClickIcon,
110
- enableAdd: enableAdd,
111
- enableDelete: enableDelete
112
- }),
106
+ open: visible,
107
+ onOpenChange: onVisibleChange,
108
+ dropdownRender: function dropdownRender() {
109
+ return /*#__PURE__*/React.createElement(BizTargetOptionMenu, {
110
+ onClick: onClickIcon,
111
+ enableAdd: enableAdd,
112
+ enableDelete: enableDelete
113
+ });
114
+ },
113
115
  trigger: ['click']
114
116
  }, /*#__PURE__*/React.createElement(BizTargetOptionIcon, {
115
117
  name: "more",
@@ -81,13 +81,15 @@ var UserTagsSelect = function UserTagsSelect(props) {
81
81
  return /*#__PURE__*/React.createElement("div", {
82
82
  className: classPrefix
83
83
  }, /*#__PURE__*/React.createElement(Dropdown, {
84
- overlay: renderOverlay(),
84
+ dropdownRender: function dropdownRender() {
85
+ return renderOverlay();
86
+ },
85
87
  trigger: ['click'],
86
88
  overlayStyle: {
87
89
  minWidth: 0
88
90
  },
89
- onVisibleChange: onVisibleChange,
90
- visible: visible,
91
+ onOpenChange: onVisibleChange,
92
+ open: visible,
91
93
  destroyPopupOnHide: props.destroyPopupOnHide
92
94
  }, /*#__PURE__*/React.createElement("div", {
93
95
  className: "".concat(classPrefix, "-handle")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/business-lib",
3
- "version": "1.1.34-visual.10",
3
+ "version": "1.1.34-visual.11",
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": "211636a80ee9071213fc580c4473aafef846f2a5"
62
+ "gitHead": "c863c8612ff97c5bba6fdf11d161e7fa8098d613"
63
63
  }