evui 3.4.207 → 3.4.209
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/README.md +18 -33
- package/dist/404.html +44 -0
- package/dist/favicon.ico +0 -0
- package/dist/index.js +22738 -0
- package/dist/index.umd.cjs +28 -0
- package/dist/style.css +1 -0
- package/package.json +46 -43
- package/dist/evui.common.js +0 -63681
- package/dist/evui.common.js.map +0 -1
- package/dist/evui.umd.js +0 -63691
- package/dist/evui.umd.js.map +0 -1
- package/dist/evui.umd.min.js +0 -2
- package/dist/evui.umd.min.js.map +0 -1
- package/dist/img/EVUI.b82ee81a.svg +0 -293
- package/src/assets/logo.png +0 -0
- package/src/common/emitter.js +0 -20
- package/src/common/utils.bignumber.js +0 -67
- package/src/common/utils.debounce.js +0 -223
- package/src/common/utils.js +0 -151
- package/src/common/utils.table.js +0 -78
- package/src/common/utils.throttle.js +0 -83
- package/src/common/utils.tree.js +0 -18
- package/src/components/button/Button.vue +0 -195
- package/src/components/button/index.js +0 -7
- package/src/components/buttonGroup/ButtonGroup.vue +0 -11
- package/src/components/buttonGroup/index.js +0 -7
- package/src/components/calendar/Calendar.vue +0 -725
- package/src/components/calendar/index.js +0 -7
- package/src/components/calendar/uses.js +0 -1410
- package/src/components/chart/Chart.vue +0 -363
- package/src/components/chart/ChartToolbar.vue +0 -52
- package/src/components/chart/chart.core.js +0 -1170
- package/src/components/chart/chartZoom.core.js +0 -540
- package/src/components/chart/element/element.bar.js +0 -672
- package/src/components/chart/element/element.bar.time.js +0 -166
- package/src/components/chart/element/element.heatmap.js +0 -743
- package/src/components/chart/element/element.line.js +0 -611
- package/src/components/chart/element/element.pie.js +0 -197
- package/src/components/chart/element/element.scatter.js +0 -320
- package/src/components/chart/element/element.tip.js +0 -717
- package/src/components/chart/helpers/helpers.canvas.js +0 -265
- package/src/components/chart/helpers/helpers.constant.js +0 -235
- package/src/components/chart/helpers/helpers.util.js +0 -400
- package/src/components/chart/index.js +0 -9
- package/src/components/chart/model/index.js +0 -50
- package/src/components/chart/model/model.series.js +0 -125
- package/src/components/chart/model/model.store.js +0 -1427
- package/src/components/chart/plugins/plugins.interaction.js +0 -1659
- package/src/components/chart/plugins/plugins.legend.gradient.js +0 -606
- package/src/components/chart/plugins/plugins.legend.js +0 -1543
- package/src/components/chart/plugins/plugins.pie.js +0 -254
- package/src/components/chart/plugins/plugins.scrollbar.js +0 -732
- package/src/components/chart/plugins/plugins.title.js +0 -61
- package/src/components/chart/plugins/plugins.tooltip.js +0 -1041
- package/src/components/chart/scale/scale.js +0 -951
- package/src/components/chart/scale/scale.linear.js +0 -268
- package/src/components/chart/scale/scale.logarithmic.js +0 -135
- package/src/components/chart/scale/scale.step.js +0 -430
- package/src/components/chart/scale/scale.time.category.js +0 -338
- package/src/components/chart/scale/scale.time.js +0 -49
- package/src/components/chart/style/chart.scss +0 -405
- package/src/components/chart/uses.js +0 -721
- package/src/components/chartBrush/ChartBrush.vue +0 -323
- package/src/components/chartBrush/chartBrush.core.js +0 -691
- package/src/components/chartBrush/index.js +0 -9
- package/src/components/chartBrush/uses.js +0 -23
- package/src/components/chartGroup/ChartGroup.vue +0 -144
- package/src/components/chartGroup/index.js +0 -9
- package/src/components/chartGroup/style/chartGroup.scss +0 -5
- package/src/components/chartGroup/uses.js +0 -53
- package/src/components/checkbox/Checkbox.vue +0 -229
- package/src/components/checkbox/index.js +0 -7
- package/src/components/checkboxGroup/CheckboxGroup.vue +0 -44
- package/src/components/checkboxGroup/index.js +0 -7
- package/src/components/contextMenu/ContextMenu.vue +0 -95
- package/src/components/contextMenu/MenuList.vue +0 -182
- package/src/components/contextMenu/index.js +0 -7
- package/src/components/contextMenu/uses.js +0 -223
- package/src/components/datePicker/DatePicker.vue +0 -504
- package/src/components/datePicker/index.js +0 -7
- package/src/components/datePicker/uses.js +0 -460
- package/src/components/grid/Grid.vue +0 -1535
- package/src/components/grid/GridColumnSetting.vue +0 -358
- package/src/components/grid/GridFilterSetting.vue +0 -323
- package/src/components/grid/GridPagination.vue +0 -75
- package/src/components/grid/GridSummary.vue +0 -314
- package/src/components/grid/GridToolbar.vue +0 -35
- package/src/components/grid/icon/icon-option-button.vue +0 -17
- package/src/components/grid/icon/icon-sort-button.vue +0 -67
- package/src/components/grid/index.js +0 -11
- package/src/components/grid/style/grid.scss +0 -417
- package/src/components/grid/uses.js +0 -1629
- package/src/components/icon/Icon.vue +0 -53
- package/src/components/icon/index.js +0 -8
- package/src/components/inputNumber/InputNumber.vue +0 -212
- package/src/components/inputNumber/index.js +0 -7
- package/src/components/inputNumber/uses.js +0 -217
- package/src/components/loading/Loading.vue +0 -125
- package/src/components/loading/index.js +0 -7
- package/src/components/menu/Menu.vue +0 -79
- package/src/components/menu/MenuItem.vue +0 -201
- package/src/components/menu/index.js +0 -7
- package/src/components/message/Message.vue +0 -229
- package/src/components/message/index.js +0 -34
- package/src/components/messageBox/MessageBox.vue +0 -358
- package/src/components/messageBox/index.js +0 -22
- package/src/components/notification/Notification.vue +0 -316
- package/src/components/notification/index.js +0 -49
- package/src/components/pagination/Pagination.vue +0 -317
- package/src/components/pagination/index.js +0 -7
- package/src/components/pagination/pageButton.vue +0 -31
- package/src/components/progress/Progress.vue +0 -139
- package/src/components/progress/index.js +0 -7
- package/src/components/radio/Radio.vue +0 -159
- package/src/components/radio/index.js +0 -7
- package/src/components/radioGroup/RadioGroup.vue +0 -41
- package/src/components/radioGroup/index.js +0 -7
- package/src/components/scheduler/Scheduler.vue +0 -149
- package/src/components/scheduler/index.js +0 -7
- package/src/components/scheduler/uses.js +0 -183
- package/src/components/select/Select.vue +0 -556
- package/src/components/select/index.js +0 -7
- package/src/components/select/uses.js +0 -379
- package/src/components/slider/Slider.vue +0 -505
- package/src/components/slider/index.js +0 -7
- package/src/components/slider/uses.js +0 -391
- package/src/components/tabPanel/TabPanel.vue +0 -74
- package/src/components/tabPanel/index.js +0 -7
- package/src/components/tabs/Tabs.vue +0 -517
- package/src/components/tabs/index.js +0 -7
- package/src/components/textField/TextField.vue +0 -399
- package/src/components/textField/index.js +0 -7
- package/src/components/timePicker/TimePicker.vue +0 -364
- package/src/components/timePicker/index.js +0 -7
- package/src/components/toggle/Toggle.vue +0 -115
- package/src/components/toggle/index.js +0 -7
- package/src/components/tree/Tree.vue +0 -338
- package/src/components/tree/TreeNode.vue +0 -293
- package/src/components/tree/index.js +0 -7
- package/src/components/treeGrid/TreeGrid.vue +0 -1074
- package/src/components/treeGrid/TreeGridNode.vue +0 -349
- package/src/components/treeGrid/TreeGridToolbar.vue +0 -35
- package/src/components/treeGrid/icon/icon-tree.png +0 -0
- package/src/components/treeGrid/index.js +0 -9
- package/src/components/treeGrid/style/treeGrid.scss +0 -277
- package/src/components/treeGrid/uses.js +0 -1178
- package/src/components/window/Window.vue +0 -329
- package/src/components/window/index.js +0 -7
- package/src/components/window/uses.js +0 -908
- package/src/directives/clickoutside.js +0 -90
- package/src/main.js +0 -120
- package/src/style/components/input.scss +0 -108
- package/src/style/functions.scss +0 -3
- package/src/style/index.scss +0 -6
- package/src/style/lib/fonts/EVUI.eot +0 -0
- package/src/style/lib/fonts/EVUI.svg +0 -293
- package/src/style/lib/fonts/EVUI.ttf +0 -0
- package/src/style/lib/fonts/EVUI.woff +0 -0
- package/src/style/lib/icon.css +0 -888
- package/src/style/mixins.scss +0 -94
- package/src/style/themes.scss +0 -69
- package/src/style/variables.scss +0 -22
|
@@ -1,338 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="ev-tree-view">
|
|
3
|
-
<tree-node
|
|
4
|
-
v-for="(item, i) in treeNodeData"
|
|
5
|
-
:key="i"
|
|
6
|
-
:data="item"
|
|
7
|
-
:use-checkbox="useCheckbox"
|
|
8
|
-
:expand-icon="expandIcon"
|
|
9
|
-
:collapse-icon="collapseIcon"
|
|
10
|
-
:comp="component"
|
|
11
|
-
@update-checked-info="updateCheckedInfo"
|
|
12
|
-
@click-node="clickContent"
|
|
13
|
-
@dblclick-node="dblClickContent"
|
|
14
|
-
@show-context-menu="getContextMenuFlag"
|
|
15
|
-
@contextmenu.prevent="showContextMenu"
|
|
16
|
-
/>
|
|
17
|
-
<div v-if="isShowEmptyText">{{ emptyText }}</div>
|
|
18
|
-
<ev-context-menu
|
|
19
|
-
v-if="contextMenuItems.length"
|
|
20
|
-
ref="contextMenu"
|
|
21
|
-
:items="contextMenuItems"
|
|
22
|
-
/>
|
|
23
|
-
</div>
|
|
24
|
-
</template>
|
|
25
|
-
|
|
26
|
-
<script>
|
|
27
|
-
import { ref, watch, onMounted, onBeforeUnmount, computed } from 'vue';
|
|
28
|
-
import TreeNode from './TreeNode';
|
|
29
|
-
|
|
30
|
-
export default {
|
|
31
|
-
name: 'EvTree',
|
|
32
|
-
components: { TreeNode },
|
|
33
|
-
props: {
|
|
34
|
-
data: {
|
|
35
|
-
type: Array,
|
|
36
|
-
default: () => [],
|
|
37
|
-
},
|
|
38
|
-
useCheckbox: {
|
|
39
|
-
type: Boolean,
|
|
40
|
-
default: false,
|
|
41
|
-
},
|
|
42
|
-
emptyText: {
|
|
43
|
-
type: String,
|
|
44
|
-
default: 'No Data',
|
|
45
|
-
},
|
|
46
|
-
expandIcon: {
|
|
47
|
-
type: String,
|
|
48
|
-
default: '',
|
|
49
|
-
},
|
|
50
|
-
collapseIcon: {
|
|
51
|
-
type: String,
|
|
52
|
-
default: '',
|
|
53
|
-
},
|
|
54
|
-
contextMenuItems: {
|
|
55
|
-
type: Array,
|
|
56
|
-
default: () => [],
|
|
57
|
-
},
|
|
58
|
-
searchWord: {
|
|
59
|
-
type: String,
|
|
60
|
-
default: '',
|
|
61
|
-
},
|
|
62
|
-
searchIncludeChildren: {
|
|
63
|
-
type: Boolean,
|
|
64
|
-
default: false,
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
emits: {
|
|
68
|
-
'click-node': null,
|
|
69
|
-
'dblclick-node': null,
|
|
70
|
-
check: Array,
|
|
71
|
-
},
|
|
72
|
-
setup(props, { emit }) {
|
|
73
|
-
const treeNodeData = ref(props.data);
|
|
74
|
-
let allNodeInfo = [];
|
|
75
|
-
const contextMenu = ref(null);
|
|
76
|
-
let contextMenuFlag = false; // flag for showing contextMenu or not
|
|
77
|
-
const component = TreeNode;
|
|
78
|
-
|
|
79
|
-
function updateTreeUp(nodeKey) {
|
|
80
|
-
const parentKey = allNodeInfo[nodeKey].parent;
|
|
81
|
-
if (typeof parentKey === 'undefined') {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
const node = allNodeInfo[nodeKey].node;
|
|
85
|
-
const parent = allNodeInfo[parentKey].node;
|
|
86
|
-
if (node.checked === parent.checked && node.indeterminate === parent.indeterminate) {
|
|
87
|
-
return; // no need to update upwards
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if (node.checked) {
|
|
91
|
-
parent.checked = parent.children.every(n => n.checked);
|
|
92
|
-
parent.indeterminate = !parent.checked;
|
|
93
|
-
} else {
|
|
94
|
-
const fn = n => n.checked || node.indeterminate;
|
|
95
|
-
parent.checked = false;
|
|
96
|
-
parent.indeterminate = parent.children.some(fn);
|
|
97
|
-
}
|
|
98
|
-
updateTreeUp(parentKey);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function updateTreeDown(node, changes = {}) {
|
|
102
|
-
const keys = Object.keys(changes);
|
|
103
|
-
for (let ix = 0; ix < keys.length; ix++) {
|
|
104
|
-
node[keys[ix]] = changes[keys[ix]]; // eslint-disable-line no-param-reassign
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (node.children) {
|
|
108
|
-
node.children.forEach((child) => {
|
|
109
|
-
updateTreeDown(child, changes);
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
function getAllNodeInfo() { // return the array to easily search parents and children
|
|
115
|
-
let keyCounter = 0;
|
|
116
|
-
const flatTree = [];
|
|
117
|
-
const valueArr = [];
|
|
118
|
-
|
|
119
|
-
function flattenChildren(n, parent) {
|
|
120
|
-
const node = n;
|
|
121
|
-
node.nodeKey = keyCounter++;
|
|
122
|
-
|
|
123
|
-
// add 'selected' property for highlighting clicked node
|
|
124
|
-
if (!Object.hasOwnProperty.call(node, 'selected')) {
|
|
125
|
-
node.selected = false;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// add 'visible' property for filtering node
|
|
129
|
-
if (!Object.hasOwnProperty.call(node, 'visible')) {
|
|
130
|
-
node.visible = true;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
// check 'value' property and add nodeKey if same value already exists
|
|
134
|
-
if ('value' in node && valueArr.includes(node.value)) {
|
|
135
|
-
console.warn('The \'value\' of data should be unique.');
|
|
136
|
-
node.value += node.nodeKey;
|
|
137
|
-
} else if (!('value' in node)) {
|
|
138
|
-
node.value = node.title + node.nodeKey;
|
|
139
|
-
}
|
|
140
|
-
valueArr.push(node.value);
|
|
141
|
-
|
|
142
|
-
flatTree[node.nodeKey] = { node, nodeKey: node.nodeKey };
|
|
143
|
-
if (typeof parent !== 'undefined') {
|
|
144
|
-
flatTree[node.nodeKey].parent = parent.nodeKey;
|
|
145
|
-
flatTree[parent.nodeKey].children.push(node.nodeKey);
|
|
146
|
-
}
|
|
147
|
-
if (node.children) {
|
|
148
|
-
flatTree[node.nodeKey].children = [];
|
|
149
|
-
node.children.forEach(child => flattenChildren(child, node));
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
if (treeNodeData.value.length) {
|
|
154
|
-
flattenChildren(treeNodeData.value[0]);
|
|
155
|
-
}
|
|
156
|
-
return flatTree;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
allNodeInfo = getAllNodeInfo();
|
|
160
|
-
|
|
161
|
-
function getCheckedNodes() {
|
|
162
|
-
return allNodeInfo.filter(obj => obj.node.checked).map(obj => obj.node);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
function rebuildTree() { // rebuild the tree through checked nodes
|
|
166
|
-
const checkedNodes = getCheckedNodes();
|
|
167
|
-
checkedNodes.forEach((node) => {
|
|
168
|
-
updateTreeDown(node, { checked: true });
|
|
169
|
-
// propagate upwards
|
|
170
|
-
const parentKey = allNodeInfo[node.nodeKey].parent;
|
|
171
|
-
if (!parentKey && parentKey !== 0) {
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
const parent = allNodeInfo[parentKey].node;
|
|
175
|
-
const childHasCheckSetter = typeof node.checked !== 'undefined' && node.checked;
|
|
176
|
-
if (childHasCheckSetter && parent.checked !== node.checked) {
|
|
177
|
-
updateTreeUp(node.nodeKey); // update tree upwards
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
function updateCheckedInfo({ nodeKey, isChecked }) {
|
|
183
|
-
const node = allNodeInfo[nodeKey].node;
|
|
184
|
-
node.checked = isChecked;
|
|
185
|
-
node.indeterminate = false;
|
|
186
|
-
updateTreeUp(nodeKey); // propagate up
|
|
187
|
-
updateTreeDown(node, { checked: isChecked, indeterminate: false }); // reset `indeterminate`
|
|
188
|
-
const checkedNodes = getCheckedNodes();
|
|
189
|
-
emit('check', checkedNodes);
|
|
190
|
-
rebuildTree();
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
function clickContent(nodeKey) {
|
|
194
|
-
const clickedNode = allNodeInfo[nodeKey].node;
|
|
195
|
-
// reset other selected node to false
|
|
196
|
-
for (let ix = 0; ix < allNodeInfo.length; ix++) {
|
|
197
|
-
if (allNodeInfo[ix].node.nodeKey !== nodeKey) {
|
|
198
|
-
allNodeInfo[ix].node.selected = false;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
emit('click-node', { title: clickedNode.title, value: clickedNode.value });
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
function dblClickContent(nodeKey) {
|
|
205
|
-
const dbClickedContent = allNodeInfo[nodeKey].node;
|
|
206
|
-
emit('dblclick-node', { title: dbClickedContent.title, value: dbClickedContent.value });
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
const showContextMenu = (e) => {
|
|
210
|
-
if (props.contextMenuItems.length && contextMenuFlag) {
|
|
211
|
-
contextMenu.value.show(e);
|
|
212
|
-
contextMenuFlag = false; // reset contextmenuFlag
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
const getContextMenuFlag = (isShow, e) => {
|
|
217
|
-
contextMenuFlag = isShow;
|
|
218
|
-
showContextMenu(e);
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
const isIncluded = (value, searchWord) => value.toLowerCase()
|
|
222
|
-
.includes(searchWord.toLowerCase());
|
|
223
|
-
|
|
224
|
-
const makeChildrenVisible = (node) => {
|
|
225
|
-
if (node.children) {
|
|
226
|
-
const isSearchedChildren = !!(node.children
|
|
227
|
-
.filter(child => isIncluded(child.title, props.searchWord))?.length);
|
|
228
|
-
node.children.forEach((child) => {
|
|
229
|
-
makeChildrenVisible(child);
|
|
230
|
-
child.visible = (isSearchedChildren && isIncluded(child.title, props.searchWord))
|
|
231
|
-
|| !isSearchedChildren;
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
function makeChildrenInvisible(node) {
|
|
237
|
-
if (node.children) {
|
|
238
|
-
node.children.forEach((child) => {
|
|
239
|
-
child.visible = false; // eslint-disable-line no-param-reassign
|
|
240
|
-
makeChildrenInvisible(child);
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
function makeParentVisible(parentKey) {
|
|
246
|
-
if (!parentKey && parentKey !== 0) {
|
|
247
|
-
return;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
const parent = allNodeInfo[parentKey];
|
|
251
|
-
parent.node.visible = true;
|
|
252
|
-
if (parent.parent !== undefined) {
|
|
253
|
-
makeParentVisible(parent.parent);
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
function filterNode(value) {
|
|
258
|
-
allNodeInfo.forEach((nodeObj) => {
|
|
259
|
-
const node = nodeObj.node;
|
|
260
|
-
node.visible = false;
|
|
261
|
-
});
|
|
262
|
-
|
|
263
|
-
const filteredNodes = allNodeInfo
|
|
264
|
-
.filter(nodeObj => isIncluded(nodeObj.node.title, value));
|
|
265
|
-
|
|
266
|
-
filteredNodes.forEach((nodeObj) => {
|
|
267
|
-
const node = nodeObj.node;
|
|
268
|
-
node.visible = true;
|
|
269
|
-
if (props.searchIncludeChildren) {
|
|
270
|
-
makeChildrenVisible(node);
|
|
271
|
-
} else {
|
|
272
|
-
// make children invisible, traverse down
|
|
273
|
-
makeChildrenInvisible(node);
|
|
274
|
-
}
|
|
275
|
-
// make parent visible, traverse up
|
|
276
|
-
const parentKey = allNodeInfo[node.nodeKey].parent;
|
|
277
|
-
makeParentVisible(parentKey);
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
const isShowEmptyText = computed(() => !treeNodeData.value.length
|
|
282
|
-
|| treeNodeData.value.every(node => !node.visible));
|
|
283
|
-
|
|
284
|
-
watch(() => props.data, (newData) => {
|
|
285
|
-
treeNodeData.value = newData;
|
|
286
|
-
allNodeInfo = getAllNodeInfo();
|
|
287
|
-
}, {
|
|
288
|
-
deep: true,
|
|
289
|
-
});
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
let timer;
|
|
293
|
-
watch(() => props.searchWord, (newSearchWord) => {
|
|
294
|
-
if (timer) {
|
|
295
|
-
clearTimeout(timer);
|
|
296
|
-
}
|
|
297
|
-
timer = setTimeout(() => {
|
|
298
|
-
if (newSearchWord) {
|
|
299
|
-
filterNode(newSearchWord);
|
|
300
|
-
} else {
|
|
301
|
-
allNodeInfo.forEach((nodeObj) => {
|
|
302
|
-
const node = nodeObj.node;
|
|
303
|
-
node.visible = true;
|
|
304
|
-
});
|
|
305
|
-
}
|
|
306
|
-
}, 200);
|
|
307
|
-
});
|
|
308
|
-
|
|
309
|
-
onMounted(() => {
|
|
310
|
-
rebuildTree();
|
|
311
|
-
const checkedNodes = getCheckedNodes();
|
|
312
|
-
if (checkedNodes.length) {
|
|
313
|
-
emit('check', checkedNodes);
|
|
314
|
-
}
|
|
315
|
-
});
|
|
316
|
-
onBeforeUnmount(() => {
|
|
317
|
-
if (timer) {
|
|
318
|
-
clearTimeout(timer);
|
|
319
|
-
}
|
|
320
|
-
});
|
|
321
|
-
|
|
322
|
-
return {
|
|
323
|
-
treeNodeData,
|
|
324
|
-
contextMenu,
|
|
325
|
-
component,
|
|
326
|
-
isShowEmptyText,
|
|
327
|
-
updateCheckedInfo,
|
|
328
|
-
clickContent,
|
|
329
|
-
dblClickContent,
|
|
330
|
-
showContextMenu,
|
|
331
|
-
getContextMenuFlag,
|
|
332
|
-
};
|
|
333
|
-
},
|
|
334
|
-
};
|
|
335
|
-
</script>
|
|
336
|
-
|
|
337
|
-
<style lang="scss">
|
|
338
|
-
</style>
|
|
@@ -1,293 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<ul
|
|
3
|
-
v-show="treeData.visible"
|
|
4
|
-
class="ev-tree-children"
|
|
5
|
-
>
|
|
6
|
-
<li>
|
|
7
|
-
<span
|
|
8
|
-
:class="{ expand: treeData.expand }"
|
|
9
|
-
class="ev-tree-toggle"
|
|
10
|
-
>
|
|
11
|
-
<ev-icon
|
|
12
|
-
v-if="showExpandIcon"
|
|
13
|
-
:icon="expandIconClasses"
|
|
14
|
-
@click="handleExpand"
|
|
15
|
-
/>
|
|
16
|
-
</span>
|
|
17
|
-
<div class="ev-tree-node">
|
|
18
|
-
<ev-checkbox
|
|
19
|
-
v-if="useCheckbox"
|
|
20
|
-
v-model="treeData.checked"
|
|
21
|
-
:indeterminate="treeData.indeterminate"
|
|
22
|
-
:disabled="treeData.disabled"
|
|
23
|
-
@change="handleCheck(treeData.checked, treeData.nodeKey)"
|
|
24
|
-
/>
|
|
25
|
-
<ev-icon
|
|
26
|
-
v-if="treeData.iconClass"
|
|
27
|
-
:icon="treeData.iconClass"
|
|
28
|
-
class="ev-tree-icon"
|
|
29
|
-
/>
|
|
30
|
-
<span
|
|
31
|
-
:class="{
|
|
32
|
-
'ev-tree-title-selected': treeData.selected,
|
|
33
|
-
'ev-tree-title-disabled': treeData.disabled,
|
|
34
|
-
}"
|
|
35
|
-
class="ev-tree-title"
|
|
36
|
-
@contextmenu="handleContextmenu"
|
|
37
|
-
@click="clickTreeContent"
|
|
38
|
-
@dblclick="dblClickTreeContent"
|
|
39
|
-
>
|
|
40
|
-
{{ treeData.title }}
|
|
41
|
-
</span>
|
|
42
|
-
</div>
|
|
43
|
-
<transition-group name="fade">
|
|
44
|
-
<component
|
|
45
|
-
:is="comp"
|
|
46
|
-
v-for="(child, i) in childrenInfo"
|
|
47
|
-
v-if="treeData.expand"
|
|
48
|
-
:key="`${child.value}-${i}`"
|
|
49
|
-
:data="child"
|
|
50
|
-
:use-checkbox="useCheckbox"
|
|
51
|
-
:expand-icon="expandIcon"
|
|
52
|
-
:collapse-icon="collapseIcon"
|
|
53
|
-
:comp="comp"
|
|
54
|
-
@update-checked-info="emitCheckedInfo"
|
|
55
|
-
@click-node="emitClickedContent"
|
|
56
|
-
@dblclick-node="emitDblClickedContent"
|
|
57
|
-
@show-context-menu="emitContextMenuFlag"
|
|
58
|
-
/>
|
|
59
|
-
</transition-group>
|
|
60
|
-
</li>
|
|
61
|
-
</ul>
|
|
62
|
-
</template>
|
|
63
|
-
|
|
64
|
-
<script>
|
|
65
|
-
import { reactive, computed } from 'vue';
|
|
66
|
-
|
|
67
|
-
export default {
|
|
68
|
-
name: 'TreeNode',
|
|
69
|
-
props: {
|
|
70
|
-
data: {
|
|
71
|
-
type: Object,
|
|
72
|
-
require: true,
|
|
73
|
-
default: () => ({}),
|
|
74
|
-
},
|
|
75
|
-
useCheckbox: {
|
|
76
|
-
type: Boolean,
|
|
77
|
-
default: false,
|
|
78
|
-
},
|
|
79
|
-
expandIcon: {
|
|
80
|
-
type: String,
|
|
81
|
-
default: '',
|
|
82
|
-
},
|
|
83
|
-
collapseIcon: {
|
|
84
|
-
type: String,
|
|
85
|
-
default: '',
|
|
86
|
-
},
|
|
87
|
-
comp: {
|
|
88
|
-
type: Object,
|
|
89
|
-
default: () => {},
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
emits: {
|
|
93
|
-
'update-checked-info': null,
|
|
94
|
-
'click-node': null,
|
|
95
|
-
'dblclick-node': null,
|
|
96
|
-
'show-context-menu': null,
|
|
97
|
-
},
|
|
98
|
-
setup(props, { emit }) {
|
|
99
|
-
const treeData = reactive(props.data);
|
|
100
|
-
const showExpandIcon = computed(() =>
|
|
101
|
-
(props.data.children && props.data.children.length));
|
|
102
|
-
|
|
103
|
-
const expandIconClasses = computed(() => {
|
|
104
|
-
const expandIcon = props.expandIcon ? props.expandIcon : 'ev-icon-s-play';
|
|
105
|
-
const collapseIcon = props.expandIcon ? props.collapseIcon : 'ev-icon-s-play';
|
|
106
|
-
return props.data.expand ? collapseIcon : expandIcon;
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
const childrenInfo = computed(() => props.data.children);
|
|
110
|
-
|
|
111
|
-
function handleCheck(isChecked, nodeKey) {
|
|
112
|
-
emit('update-checked-info', { nodeKey, isChecked });
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
function emitCheckedInfo({ nodeKey, isChecked }) {
|
|
116
|
-
emit('update-checked-info', { nodeKey, isChecked });
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
function handleExpand() {
|
|
120
|
-
treeData.expand = !treeData.expand;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function clickTreeContent() {
|
|
124
|
-
if (treeData.disabled) {
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
treeData.selected = !treeData.selected; // for highlighting clicked title
|
|
128
|
-
emit('click-node', treeData.nodeKey);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function emitClickedContent(nodeKey) {
|
|
132
|
-
emit('click-node', nodeKey);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
function dblClickTreeContent() {
|
|
136
|
-
if (treeData.disabled) {
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
emit('dblclick-node', treeData.nodeKey);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
function emitDblClickedContent(nodeKey) {
|
|
143
|
-
emit('dblclick-node', nodeKey);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
function handleContextmenu(e) {
|
|
147
|
-
emit('show-context-menu', true, e);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
const emitContextMenuFlag = (isShow, e) => {
|
|
151
|
-
emit('show-context-menu', isShow, e);
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
return {
|
|
155
|
-
expandIconClasses,
|
|
156
|
-
showExpandIcon,
|
|
157
|
-
treeData,
|
|
158
|
-
childrenInfo,
|
|
159
|
-
handleCheck,
|
|
160
|
-
emitCheckedInfo,
|
|
161
|
-
handleExpand,
|
|
162
|
-
clickTreeContent,
|
|
163
|
-
emitClickedContent,
|
|
164
|
-
dblClickTreeContent,
|
|
165
|
-
emitDblClickedContent,
|
|
166
|
-
handleContextmenu,
|
|
167
|
-
emitContextMenuFlag,
|
|
168
|
-
};
|
|
169
|
-
},
|
|
170
|
-
};
|
|
171
|
-
</script>
|
|
172
|
-
|
|
173
|
-
<style lang="scss">
|
|
174
|
-
$expand-toggle-icon-size: 13px;
|
|
175
|
-
|
|
176
|
-
@import '../../style/index.scss';
|
|
177
|
-
|
|
178
|
-
.ev-tree-view {
|
|
179
|
-
li {
|
|
180
|
-
ul {
|
|
181
|
-
padding: 0 0 0 18px;
|
|
182
|
-
margin: 0;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
ul {
|
|
187
|
-
list-style: none;
|
|
188
|
-
padding: 0;
|
|
189
|
-
margin: 0;
|
|
190
|
-
font-size: 12px;
|
|
191
|
-
|
|
192
|
-
li {
|
|
193
|
-
list-style: none;
|
|
194
|
-
padding: 3px 0;
|
|
195
|
-
margin: 0;
|
|
196
|
-
text-align: start;
|
|
197
|
-
white-space: nowrap;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
.ev-tree-toggle {
|
|
203
|
-
display: inline-block;
|
|
204
|
-
width: $expand-toggle-icon-size; // icon font size와 동일
|
|
205
|
-
margin-right: 2px;
|
|
206
|
-
text-align: center;
|
|
207
|
-
vertical-align: middle;
|
|
208
|
-
|
|
209
|
-
.ev-icon-s-play {
|
|
210
|
-
transition-property: transform;
|
|
211
|
-
transition-duration: 0.4s;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
&.expand > .ev-icon-s-play {
|
|
215
|
-
transform: rotate(90deg);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
i {
|
|
219
|
-
display: inline-block;
|
|
220
|
-
position: relative;
|
|
221
|
-
cursor: pointer;
|
|
222
|
-
font-size: $expand-toggle-icon-size;
|
|
223
|
-
vertical-align: middle;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
.ev-tree-title {
|
|
228
|
-
cursor: pointer;
|
|
229
|
-
vertical-align: middle;
|
|
230
|
-
|
|
231
|
-
&:hover, &-selected {
|
|
232
|
-
@include evThemify() {
|
|
233
|
-
color: evThemed('primary') !important;
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
&-disabled, &-disabled:hover {
|
|
238
|
-
cursor: not-allowed;
|
|
239
|
-
user-select: none;
|
|
240
|
-
|
|
241
|
-
@include evThemify() {
|
|
242
|
-
color: evThemed('disabled') !important;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
.ev-tree-icon {
|
|
248
|
-
margin: 0 5px;
|
|
249
|
-
font-size: 16px;
|
|
250
|
-
vertical-align: middle;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
.ev-tree-node {
|
|
254
|
-
display: inline-block;
|
|
255
|
-
width: calc(100% - (#{$expand-toggle-icon-size} + 3px * 2));
|
|
256
|
-
padding: 7px 0;
|
|
257
|
-
vertical-align: middle;
|
|
258
|
-
|
|
259
|
-
.ev-checkbox {
|
|
260
|
-
display: inline-block;
|
|
261
|
-
padding: 5px 5px 0;
|
|
262
|
-
margin: 0;
|
|
263
|
-
vertical-align: middle;
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
.fade {
|
|
268
|
-
&-enter-active {
|
|
269
|
-
animation: fade 0.3s ease-in-out;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
&-leave-active {
|
|
273
|
-
animation: fade 0.3s ease-in-out reverse;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
@keyframes fade {
|
|
277
|
-
0% {
|
|
278
|
-
opacity: 0;
|
|
279
|
-
height: 0;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
50% {
|
|
283
|
-
opacity: 0.3;
|
|
284
|
-
height: 20%;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
100% {
|
|
288
|
-
opacity: 1;
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
</style>
|