@zgfe/modules-dm 1.0.34-heyh.35 → 1.0.34-heyh.37
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.
- package/es/modules/dataCollection/components/eventItem.js +6 -1
- package/es/modules/dataCollection/styles/index.less +3 -0
- package/package.json +2 -2
- package/es/modules/dataCollection/components/sortableComponnet copy.d.ts +0 -3
- package/es/modules/dataCollection/components/sortableComponnet copy.js +0 -121
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { eventChecked } from '../../../utils';
|
|
4
4
|
import _ from 'lodash';
|
|
5
5
|
var EventItem = function EventItem(props) {
|
|
6
|
+
var classPrefix = 'EventItem';
|
|
6
7
|
var componnetData = props.componnetData,
|
|
7
8
|
componnetIndex = props.componnetIndex,
|
|
8
9
|
groupId = props.groupId,
|
|
@@ -21,6 +22,9 @@ var EventItem = function EventItem(props) {
|
|
|
21
22
|
}
|
|
22
23
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
23
24
|
title: "".concat(item.owner === 'zg_vtl' ? '虚拟事件' : '元事件', " | ").concat(name),
|
|
25
|
+
getPopupContainer: function getPopupContainer() {
|
|
26
|
+
return document.getElementById("".concat(EventItem, "-").concat(componnetIndex));
|
|
27
|
+
},
|
|
24
28
|
key: index
|
|
25
29
|
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
26
30
|
className: "checkbox-item ".concat(item.event_hidden ? 'event-hidden' : '', " column-").concat(groupId),
|
|
@@ -35,7 +39,8 @@ var EventItem = function EventItem(props) {
|
|
|
35
39
|
setGroupingData(_.cloneDeep(eventChecked(groupId, eventId, groupingData)));
|
|
36
40
|
};
|
|
37
41
|
return /*#__PURE__*/React.createElement("div", {
|
|
38
|
-
key: componnetIndex
|
|
42
|
+
key: componnetIndex,
|
|
43
|
+
id: "".concat(EventItem, "-").concat(componnetIndex)
|
|
39
44
|
}, componnetData.map(function (item, index) {
|
|
40
45
|
if (item.searchShow === 1) {
|
|
41
46
|
return SortableItem({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zgfe/modules-dm",
|
|
3
|
-
"version": "1.0.34-heyh.
|
|
3
|
+
"version": "1.0.34-heyh.37",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"module": "es/index.js",
|
|
6
6
|
"typings": "es/index.d.ts",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"umi-request": "^1.4.0",
|
|
52
52
|
"yorkie": "^2.0.0"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "43564b10b4a9bef8753d0c48e09d2158a17362c6",
|
|
55
55
|
"gitHooks": {
|
|
56
56
|
"pre-commit": "lint-staged"
|
|
57
57
|
}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { BizGlobalDataContext } from '@zgfe/business-lib';
|
|
2
|
-
import { Checkbox, Tooltip } from 'antd';
|
|
3
|
-
import request from '../../../utils/ajax';
|
|
4
|
-
import apis from '../../../constants/api';
|
|
5
|
-
import React, { useContext } from 'react';
|
|
6
|
-
import { getAppID, eventChecked } from '../../../utils';
|
|
7
|
-
import { arrayMoveImmutable } from 'array-move';
|
|
8
|
-
import _ from 'lodash';
|
|
9
|
-
import { SortableContainer, SortableElement } from 'react-sortable-hoc';
|
|
10
|
-
var SortableComponnet = function SortableComponnet(props) {
|
|
11
|
-
var classPrefix = 'sortable-componnet';
|
|
12
|
-
var _useContext = useContext(BizGlobalDataContext),
|
|
13
|
-
currentApp = _useContext.currentApp;
|
|
14
|
-
var componnetData = props.componnetData,
|
|
15
|
-
componnetIndex = props.componnetIndex,
|
|
16
|
-
groupId = props.groupId,
|
|
17
|
-
groupingData = props.groupingData,
|
|
18
|
-
setGroupingData = props.setGroupingData,
|
|
19
|
-
refresh = props.refresh,
|
|
20
|
-
searchData = props.searchData;
|
|
21
|
-
// 需要拖动的元素的容器
|
|
22
|
-
var SortableItem = SortableElement(function (data) {
|
|
23
|
-
var _data$value = data.value,
|
|
24
|
-
item = _data$value.item,
|
|
25
|
-
index = _data$value.index;
|
|
26
|
-
var name = item.alias_name ? item.alias_name : item.event_name;
|
|
27
|
-
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
28
|
-
title: "".concat(item.owner === 'zg_vtl' ? '虚拟事件' : '元事件', " | ").concat(name),
|
|
29
|
-
key: index
|
|
30
|
-
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
31
|
-
className: "checkbox-item ".concat(item.event_hidden ? 'event-hidden' : '', " column-").concat(groupId),
|
|
32
|
-
checked: item.checked,
|
|
33
|
-
key: index,
|
|
34
|
-
onChange: function onChange() {
|
|
35
|
-
return onChangeItem(groupId, item.event_id);
|
|
36
|
-
}
|
|
37
|
-
}, name));
|
|
38
|
-
});
|
|
39
|
-
// 不可拖动的元素(未分组数据)
|
|
40
|
-
var SortableItemNotDrag = function SortableItemNotDrag(data) {
|
|
41
|
-
var item = data.item,
|
|
42
|
-
index = data.index;
|
|
43
|
-
var name = item.alias_name ? "".concat(item.alias_name, "(").concat(item.event_name, ")") : item.event_name;
|
|
44
|
-
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
45
|
-
title: "".concat(item.owner === 'zg_vtl' ? '虚拟事件' : '元事件', " | ").concat(name),
|
|
46
|
-
key: index
|
|
47
|
-
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
48
|
-
className: "checkbox-item ".concat(item.event_hidden ? 'event-hidden' : '', " column-").concat(groupId),
|
|
49
|
-
checked: item.checked,
|
|
50
|
-
key: index,
|
|
51
|
-
onChange: function onChange() {
|
|
52
|
-
return onChangeItem(groupId, item.event_id);
|
|
53
|
-
}
|
|
54
|
-
}, name));
|
|
55
|
-
};
|
|
56
|
-
// const onScroll = (e: React.UIEvent<HTMLElement, UIEvent>) => {
|
|
57
|
-
// if (e.currentTarget.scrollHeight - e.currentTarget.scrollTop === 400) {
|
|
58
|
-
// }
|
|
59
|
-
// };
|
|
60
|
-
// 整个元素排序的容器
|
|
61
|
-
var SortableList = SortableContainer(function () {
|
|
62
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
63
|
-
key: componnetIndex
|
|
64
|
-
}, componnetData.map(function (item, index) {
|
|
65
|
-
if (item.searchShow === 1) {
|
|
66
|
-
if (groupId !== -1 && searchData === '') {
|
|
67
|
-
return /*#__PURE__*/React.createElement(SortableItem, {
|
|
68
|
-
key: "item-".concat(index),
|
|
69
|
-
index: index,
|
|
70
|
-
value: {
|
|
71
|
-
item: item,
|
|
72
|
-
index: index
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
} else {
|
|
76
|
-
return SortableItemNotDrag({
|
|
77
|
-
item: item,
|
|
78
|
-
index: index
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
} else {
|
|
82
|
-
return null;
|
|
83
|
-
}
|
|
84
|
-
}));
|
|
85
|
-
});
|
|
86
|
-
var onChangeItem = function onChangeItem(groupId, eventId) {
|
|
87
|
-
setGroupingData(_.cloneDeep(eventChecked(groupId, eventId, groupingData)));
|
|
88
|
-
};
|
|
89
|
-
var onSortEnd = function onSortEnd(data) {
|
|
90
|
-
var oldIndex = data.oldIndex,
|
|
91
|
-
newIndex = data.newIndex;
|
|
92
|
-
var eventList = arrayMoveImmutable(componnetData, oldIndex, newIndex);
|
|
93
|
-
var ids = [];
|
|
94
|
-
eventList.map(function (item) {
|
|
95
|
-
ids.push(item.event_id);
|
|
96
|
-
});
|
|
97
|
-
groupingData.map(function (item) {
|
|
98
|
-
if (item.groupId === groupId) {
|
|
99
|
-
item.eventList = eventList;
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
setGroupingData(_.cloneDeep(groupingData));
|
|
103
|
-
request(apis.orderEvent, {
|
|
104
|
-
method: 'post',
|
|
105
|
-
data: {
|
|
106
|
-
appId: getAppID(currentApp),
|
|
107
|
-
groupId: groupId,
|
|
108
|
-
ids: ids.join(',')
|
|
109
|
-
}
|
|
110
|
-
}).then(function () {
|
|
111
|
-
refresh();
|
|
112
|
-
});
|
|
113
|
-
};
|
|
114
|
-
return /*#__PURE__*/React.createElement(SortableList, {
|
|
115
|
-
distance: 5,
|
|
116
|
-
axis: 'xy',
|
|
117
|
-
helperClass: "".concat(classPrefix, "-sortableList"),
|
|
118
|
-
onSortEnd: onSortEnd
|
|
119
|
-
});
|
|
120
|
-
};
|
|
121
|
-
export default SortableComponnet;
|