@zgfe/business-lib 1.2.5 → 1.2.6

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.
@@ -38,7 +38,8 @@ var EventDemo = function EventDemo() {
38
38
  id: -2,
39
39
  name: '会话结束',
40
40
  attrList: []
41
- }]
41
+ }],
42
+ disableVirtualEventShow: true
42
43
  }));
43
44
  };
44
45
  export default (function () {
@@ -35,30 +35,51 @@ var EventListPanel = function EventListPanel(props) {
35
35
  setSearchValue = _useState2[1];
36
36
  var _useContext = useContext(BizGlobalDataContext),
37
37
  eventGroupList = _useContext.eventGroupList;
38
- var _useState3 = useState(eventGroupList || []),
38
+ var _useState3 = useState([]),
39
39
  _useState4 = _slicedToArray(_useState3, 2),
40
- groupList = _useState4[0],
41
- setGroupList = _useState4[1];
42
- var _useState5 = useState(),
40
+ eventGroupListData = _useState4[0],
41
+ setEventGroupListData = _useState4[1];
42
+ useEffect(function () {
43
+ if (disableVirtualEventShow && eventGroupList) {
44
+ var _eventGroupList = _.cloneDeep(eventGroupList);
45
+ _eventGroupList && _eventGroupList.map(function (item) {
46
+ if (item.eventList.length > 0) {
47
+ item.eventList = item.eventList.filter(function (_item) {
48
+ return _item.owner !== 'zg_vtl';
49
+ });
50
+ }
51
+ });
52
+ setEventGroupListData(_eventGroupList);
53
+ setGroupList(_eventGroupList);
54
+ } else {
55
+ setEventGroupListData(eventGroupList || []);
56
+ setGroupList(eventGroupList || []);
57
+ }
58
+ }, [eventGroupList, disableVirtualEventShow]);
59
+ var _useState5 = useState([]),
43
60
  _useState6 = _slicedToArray(_useState5, 2),
44
- currentGroup = _useState6[0],
45
- setCurrentGroup = _useState6[1];
46
- var _useState7 = useState([]),
61
+ groupList = _useState6[0],
62
+ setGroupList = _useState6[1];
63
+ var _useState7 = useState(),
47
64
  _useState8 = _slicedToArray(_useState7, 2),
48
- searchEventList = _useState8[0],
49
- setSearchEventList = _useState8[1];
50
- var _useState9 = useState(props.multiple ? props.value : undefined),
65
+ currentGroup = _useState8[0],
66
+ setCurrentGroup = _useState8[1];
67
+ var _useState9 = useState([]),
51
68
  _useState10 = _slicedToArray(_useState9, 2),
52
- currentValue = _useState10[0],
53
- setCurrentValue = _useState10[1];
54
- var _useState11 = useState(props.multiple ? props.value || [] : []),
69
+ searchEventList = _useState10[0],
70
+ setSearchEventList = _useState10[1];
71
+ var _useState11 = useState(props.multiple ? props.value : undefined),
55
72
  _useState12 = _slicedToArray(_useState11, 2),
56
- checkedEventList = _useState12[0],
57
- setCheckedEventList = _useState12[1];
58
- var _useState13 = useState(false),
73
+ currentValue = _useState12[0],
74
+ setCurrentValue = _useState12[1];
75
+ var _useState13 = useState(props.multiple ? props.value || [] : []),
59
76
  _useState14 = _slicedToArray(_useState13, 2),
60
- ready = _useState14[0],
61
- setReady = _useState14[1];
77
+ checkedEventList = _useState14[0],
78
+ setCheckedEventList = _useState14[1];
79
+ var _useState15 = useState(false),
80
+ _useState16 = _slicedToArray(_useState15, 2),
81
+ ready = _useState16[0],
82
+ setReady = _useState16[1];
62
83
  var scrollableId = 'scrollableDiv' + Math.random();
63
84
  var overviewData = {
64
85
  id: -100,
@@ -67,15 +88,16 @@ var EventListPanel = function EventListPanel(props) {
67
88
  isOverview: true
68
89
  };
69
90
  useEffect(function () {
91
+ if (eventGroupListData.length <= 0) return;
70
92
  var group = {
71
93
  id: 0,
72
94
  eventList: function () {
73
95
  var list = [];
74
96
  var listObj = {};
75
97
  var markList = [];
76
- eventGroupList === null || eventGroupList === void 0 ? void 0 : eventGroupList.forEach(function (group) {
98
+ eventGroupListData === null || eventGroupListData === void 0 ? void 0 : eventGroupListData.forEach(function (group) {
77
99
  group.eventList.forEach(function (item) {
78
- if (!listObj[item.id] && (disableVirtualEventShow ? item.owner !== 'zg_vtl' : true)) {
100
+ if (!listObj[item.id]) {
79
101
  if (item.marked) {
80
102
  markList.push(item);
81
103
  } else {
@@ -100,7 +122,7 @@ var EventListPanel = function EventListPanel(props) {
100
122
  result.forEach(function (group) {
101
123
  var evtList = [];
102
124
  group.eventList.forEach(function (event) {
103
- if (disableVirtualEventShow && event.owner === 'zg_vtl') return;
125
+ if (disableVirtualEventShow) return;
104
126
  if (props.filter(event)) {
105
127
  evtList.push(event);
106
128
  }
@@ -123,7 +145,7 @@ var EventListPanel = function EventListPanel(props) {
123
145
  resultGroup = BuiltinIndicators;
124
146
  } else {
125
147
  var _currentGroup = group;
126
- eventGroupList === null || eventGroupList === void 0 ? void 0 : eventGroupList.forEach(function (eGroup) {
148
+ eventGroupListData === null || eventGroupListData === void 0 ? void 0 : eventGroupListData.forEach(function (eGroup) {
127
149
  var _props$value2, _props$value2$group;
128
150
  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)) {
129
151
  _currentGroup = eGroup;
@@ -141,7 +163,7 @@ var EventListPanel = function EventListPanel(props) {
141
163
  }
142
164
  });
143
165
  setReady(true);
144
- }, []);
166
+ }, [eventGroupListData]);
145
167
  useChanged(function () {
146
168
  if (props.multiple) {
147
169
  setCheckedEventList(_.cloneDeep(props.value) || []);
@@ -152,7 +174,7 @@ var EventListPanel = function EventListPanel(props) {
152
174
  useEffect(function () {
153
175
  var list = [];
154
176
  currentGroup === null || currentGroup === void 0 ? void 0 : currentGroup.eventList.forEach(function (event) {
155
- if (searchValue && !new RegExp(_.escapeRegExp(searchValue), 'i').test(event.alias || event.name)) return;
177
+ if (searchValue && !new RegExp(_.escapeRegExp(searchValue), 'i').test("".concat(event.owner === 'zg_vtl' ? '虚拟事件' : '元事件', " | ").concat(event.alias || event.name))) return;
156
178
  list.push(event);
157
179
  });
158
180
  if (showOverview) list.unshift(overviewData);
@@ -271,14 +293,14 @@ export var InfiniteScrollList = function InfiniteScrollList(_ref) {
271
293
  multiple = _ref.multiple,
272
294
  maxEventCount = _ref.maxEventCount,
273
295
  checkedIdList = _ref.checkedIdList;
274
- var _useState15 = useState([]),
275
- _useState16 = _slicedToArray(_useState15, 2),
276
- showList = _useState16[0],
277
- setShowList = _useState16[1];
278
296
  var _useState17 = useState([]),
279
297
  _useState18 = _slicedToArray(_useState17, 2),
280
- canShowList = _useState18[0],
281
- setCanShowList = _useState18[1];
298
+ showList = _useState18[0],
299
+ setShowList = _useState18[1];
300
+ var _useState19 = useState([]),
301
+ _useState20 = _slicedToArray(_useState19, 2),
302
+ canShowList = _useState20[0],
303
+ setCanShowList = _useState20[1];
282
304
  useEffect(function () {
283
305
  var data = searchEventList.filter(function (item) {
284
306
  return item.eventHidden !== ShowStatus.hidden;
@@ -321,7 +343,7 @@ export var InfiniteScrollList = function InfiniteScrollList(_ref) {
321
343
  _disable = true;
322
344
  }
323
345
  return /*#__PURE__*/React.createElement(EventListOption, {
324
- label: e.alias || e.name,
346
+ label: "".concat(e.owner === 'zg_vtl' ? '虚拟事件' : '元事件', " | ").concat(e.alias || e.name),
325
347
  key: "".concat(groupId, "-").concat(e.id),
326
348
  checked: multiple ? checkedIdList === null || checkedIdList === void 0 ? void 0 : checkedIdList.includes(e.id) : currentId === e.id,
327
349
  disable: _disable,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zgfe/business-lib",
3
- "version": "1.2.5",
3
+ "version": "1.2.6",
4
4
  "module": "es/index.js",
5
5
  "typings": "es/index.d.ts",
6
6
  "files": [
@@ -55,7 +55,7 @@
55
55
  "react": "^16.12.0 || ^17.0.0",
56
56
  "yorkie": "^2.0.0"
57
57
  },
58
- "gitHead": "bb5b2f8b3375ca2c9c2ee54d2261461471c36f3a",
58
+ "gitHead": "0ac381908b90c9ed5743655821fb348c6c7a645a",
59
59
  "gitHooks": {
60
60
  "pre-commit": "lint-staged"
61
61
  }