evui 3.4.21 → 3.4.22
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/dist/evui.common.js +898 -691
- package/dist/evui.common.js.map +1 -1
- package/dist/evui.umd.js +898 -691
- package/dist/evui.umd.js.map +1 -1
- package/dist/evui.umd.min.js +1 -1
- package/dist/evui.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/chart/Chart.vue +22 -1
- package/src/components/chart/plugins/plugins.legend.js +6 -0
- package/src/components/chartBrush/ChartBrush.vue +22 -1
- package/src/components/checkbox/Checkbox.vue +1 -1
- package/src/components/grid/Grid.vue +11 -10
- package/src/components/grid/{grid.columnSetting.vue → GridColumnSetting.vue} +17 -6
- package/src/components/grid/style/grid.scss +5 -7
- package/src/components/grid/uses.js +21 -5
- package/src/components/select/Select.vue +152 -40
- package/src/components/select/uses.js +21 -0
- package/src/components/treeGrid/TreeGrid.vue +10 -10
- package/src/components/treeGrid/TreeGridNode.vue +5 -5
- package/src/components/treeGrid/uses.js +2 -1
- /package/src/components/grid/{grid.filterSetting.vue → GridFilterSetting.vue} +0 -0
- /package/src/components/grid/{grid.pagination.vue → GridPagination.vue} +0 -0
- /package/src/components/grid/{grid.summary.vue → GridSummary.vue} +0 -0
- /package/src/components/grid/{grid.toolbar.vue → GridToolbar.vue} +0 -0
- /package/src/components/grid/{grid.optionButton.vue → icon/icon-option-button.vue} +0 -0
- /package/src/components/grid/{grid.sortButton.vue → icon/icon-sort-button.vue} +0 -0
- /package/src/components/treeGrid/{treeGrid.toolbar.vue → TreeGridToolbar.vue} +0 -0
- /package/src/components/treeGrid/{tree_icon.png → icon/icon-tree.png} +0 -0
package/package.json
CHANGED
|
@@ -18,7 +18,17 @@
|
|
|
18
18
|
</template>
|
|
19
19
|
|
|
20
20
|
<script>
|
|
21
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
onMounted,
|
|
23
|
+
onBeforeUnmount,
|
|
24
|
+
onActivated,
|
|
25
|
+
onDeactivated,
|
|
26
|
+
inject,
|
|
27
|
+
watch,
|
|
28
|
+
ref,
|
|
29
|
+
toRef,
|
|
30
|
+
computed,
|
|
31
|
+
} from 'vue';
|
|
22
32
|
import { cloneDeep, isEqual, debounce } from 'lodash-es';
|
|
23
33
|
import EvChart from './chart.core';
|
|
24
34
|
import EvChartToolbar from './ChartToolbar';
|
|
@@ -76,6 +86,7 @@
|
|
|
76
86
|
],
|
|
77
87
|
setup(props) {
|
|
78
88
|
let evChart = null;
|
|
89
|
+
const isMounted = ref(false);
|
|
79
90
|
const injectIsChartGroup = inject('isChartGroup', false);
|
|
80
91
|
const injectBrushSeries = inject('brushSeries', { list: [], chartIdx: null });
|
|
81
92
|
const injectGroupSelectedLabel = inject('groupSelectedLabel', null);
|
|
@@ -242,6 +253,8 @@
|
|
|
242
253
|
|
|
243
254
|
await createChart();
|
|
244
255
|
await drawChart();
|
|
256
|
+
|
|
257
|
+
isMounted.value = true;
|
|
245
258
|
});
|
|
246
259
|
|
|
247
260
|
onBeforeUnmount(() => {
|
|
@@ -252,6 +265,8 @@
|
|
|
252
265
|
if (injectEvChartPropsInGroup?.value?.length) {
|
|
253
266
|
injectEvChartPropsInGroup.value.length = 0;
|
|
254
267
|
}
|
|
268
|
+
|
|
269
|
+
isMounted.value = false;
|
|
255
270
|
});
|
|
256
271
|
|
|
257
272
|
onDeactivated(() => {
|
|
@@ -275,6 +290,12 @@
|
|
|
275
290
|
}
|
|
276
291
|
}, props.resizeTimeout);
|
|
277
292
|
|
|
293
|
+
onActivated(() => {
|
|
294
|
+
if (isMounted.value) {
|
|
295
|
+
onResize();
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
|
|
278
299
|
return {
|
|
279
300
|
wrapper,
|
|
280
301
|
wrapperStyle,
|
|
@@ -234,6 +234,9 @@ const modules = {
|
|
|
234
234
|
*/
|
|
235
235
|
this.onLegendBoxClick = (e) => {
|
|
236
236
|
const { legend: opt } = this.options;
|
|
237
|
+
if (opt?.stopClickEvt) {
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
237
240
|
const { chartIdx } = this.data;
|
|
238
241
|
|
|
239
242
|
const targetDOM = this.getContainerDOM(e);
|
|
@@ -369,6 +372,9 @@ const modules = {
|
|
|
369
372
|
*/
|
|
370
373
|
this.onLegendBoxClick = (e) => {
|
|
371
374
|
const opt = this.options.legend;
|
|
375
|
+
if (opt?.stopClickEvt) {
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
372
378
|
const series = Object.values(this.seriesList)[0];
|
|
373
379
|
|
|
374
380
|
const targetDOM = this.getContainerDOM(e);
|
|
@@ -9,7 +9,17 @@
|
|
|
9
9
|
</template>
|
|
10
10
|
|
|
11
11
|
<script>
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
inject,
|
|
14
|
+
watch,
|
|
15
|
+
ref,
|
|
16
|
+
computed,
|
|
17
|
+
onMounted,
|
|
18
|
+
onBeforeUnmount,
|
|
19
|
+
onDeactivated,
|
|
20
|
+
onActivated,
|
|
21
|
+
onUpdated,
|
|
22
|
+
} from 'vue';
|
|
13
23
|
import { cloneDeep, debounce, isEqual } from 'lodash-es';
|
|
14
24
|
import EvChart from '../chart/chart.core';
|
|
15
25
|
import { useModel, useWrapper } from '../chart/uses';
|
|
@@ -28,6 +38,7 @@ export default {
|
|
|
28
38
|
let evChart = null;
|
|
29
39
|
let evChartBrush = null;
|
|
30
40
|
|
|
41
|
+
const isMounted = ref(false);
|
|
31
42
|
const injectEvChartClone = inject('evChartClone', { data: [] });
|
|
32
43
|
const injectEvChartInfo = inject('evChartInfo', { props: { options: [] } });
|
|
33
44
|
const injectBrushIdx = inject('brushIdx', {
|
|
@@ -235,6 +246,8 @@ export default {
|
|
|
235
246
|
createChartBrush();
|
|
236
247
|
drawChartBrush();
|
|
237
248
|
}
|
|
249
|
+
|
|
250
|
+
isMounted.value = true;
|
|
238
251
|
});
|
|
239
252
|
|
|
240
253
|
onUpdated(async () => {
|
|
@@ -266,6 +279,8 @@ export default {
|
|
|
266
279
|
if (evChartBrush) {
|
|
267
280
|
evChartBrush.destroy();
|
|
268
281
|
}
|
|
282
|
+
|
|
283
|
+
isMounted.value = false;
|
|
269
284
|
});
|
|
270
285
|
|
|
271
286
|
onDeactivated(() => {
|
|
@@ -291,6 +306,12 @@ export default {
|
|
|
291
306
|
}
|
|
292
307
|
}, 0);
|
|
293
308
|
|
|
309
|
+
onActivated(() => {
|
|
310
|
+
if (isMounted.value) {
|
|
311
|
+
onResize();
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
|
|
294
315
|
return {
|
|
295
316
|
evChartBrushOptions,
|
|
296
317
|
evChartBrushRef,
|
|
@@ -220,7 +220,7 @@
|
|
|
220
220
|
>
|
|
221
221
|
<!-- Header -->
|
|
222
222
|
<li
|
|
223
|
-
v-if="!column.hide"
|
|
223
|
+
v-if="!column.hide && !column.hiddenDisplay"
|
|
224
224
|
:data-index="index"
|
|
225
225
|
:class="{
|
|
226
226
|
column: true,
|
|
@@ -387,7 +387,7 @@
|
|
|
387
387
|
:key="cellIndex"
|
|
388
388
|
>
|
|
389
389
|
<td
|
|
390
|
-
v-if="!column.hide"
|
|
390
|
+
v-if="!column.hide && !column.hiddenDisplay"
|
|
391
391
|
:data-name="column.field"
|
|
392
392
|
:data-index="column.index"
|
|
393
393
|
:class="{
|
|
@@ -532,13 +532,13 @@ import {
|
|
|
532
532
|
} from 'vue';
|
|
533
533
|
import { clickoutside } from '@/directives/clickoutside';
|
|
534
534
|
import { cloneDeep } from 'lodash-es';
|
|
535
|
-
import Toolbar from './
|
|
536
|
-
import GridPagination from './
|
|
537
|
-
import GridSummary from './
|
|
538
|
-
import ColumnSetting from './
|
|
539
|
-
import
|
|
540
|
-
import GridSortButton from './
|
|
541
|
-
import GridOptionButton from './
|
|
535
|
+
import Toolbar from './GridToolbar';
|
|
536
|
+
import GridPagination from './GridPagination';
|
|
537
|
+
import GridSummary from './GridSummary';
|
|
538
|
+
import ColumnSetting from './GridColumnSetting.vue';
|
|
539
|
+
import FilterSetting from './GridFilterSetting.vue';
|
|
540
|
+
import GridSortButton from './icon/icon-sort-button';
|
|
541
|
+
import GridOptionButton from './icon/icon-option-button.vue';
|
|
542
542
|
import {
|
|
543
543
|
commonFunctions,
|
|
544
544
|
scrollEvent,
|
|
@@ -564,7 +564,7 @@ export default {
|
|
|
564
564
|
GridPagination,
|
|
565
565
|
GridSummary,
|
|
566
566
|
ColumnSetting,
|
|
567
|
-
|
|
567
|
+
FilterSetting,
|
|
568
568
|
GridSortButton,
|
|
569
569
|
GridOptionButton,
|
|
570
570
|
},
|
|
@@ -606,6 +606,7 @@ export default {
|
|
|
606
606
|
'check-row': null,
|
|
607
607
|
'check-all': null,
|
|
608
608
|
'page-change': null,
|
|
609
|
+
'sort-column': null,
|
|
609
610
|
},
|
|
610
611
|
setup(props) {
|
|
611
612
|
// const ROW_INDEX = 0;
|
|
@@ -136,14 +136,22 @@ export default {
|
|
|
136
136
|
|
|
137
137
|
const initValue = () => {
|
|
138
138
|
const columns = applyColumnList.value.length ? applyColumnList.value : originColumnList.value;
|
|
139
|
-
checkColumnGroup.value = columns
|
|
140
|
-
|
|
139
|
+
checkColumnGroup.value = columns
|
|
140
|
+
.filter(col => !col.checked)
|
|
141
|
+
.map(col => col.label);
|
|
141
142
|
initSearchValue();
|
|
142
143
|
};
|
|
143
|
-
|
|
144
144
|
const onApplyColumn = () => {
|
|
145
145
|
applyColumnList.value = originColumnList.value
|
|
146
|
-
.filter(col =>
|
|
146
|
+
.filter((col) => {
|
|
147
|
+
if (checkColumnGroup.value.includes(col.label)) {
|
|
148
|
+
if (col?.checked) {
|
|
149
|
+
col.checked = false;
|
|
150
|
+
}
|
|
151
|
+
return true;
|
|
152
|
+
}
|
|
153
|
+
return false;
|
|
154
|
+
});
|
|
147
155
|
const checkedColumns = applyColumnList.value.map(col => col.text);
|
|
148
156
|
|
|
149
157
|
emit('apply-column', checkedColumns);
|
|
@@ -157,8 +165,11 @@ export default {
|
|
|
157
165
|
.map(col => ({
|
|
158
166
|
label: col.caption,
|
|
159
167
|
text: col.field,
|
|
168
|
+
checked: col.hiddenDisplay,
|
|
160
169
|
}));
|
|
161
|
-
checkColumnGroup.value = originColumnList.value
|
|
170
|
+
checkColumnGroup.value = originColumnList.value
|
|
171
|
+
.filter(col => !col.checked)
|
|
172
|
+
.map(col => col.label);
|
|
162
173
|
applyColumnList.value.length = 0;
|
|
163
174
|
};
|
|
164
175
|
|
|
@@ -204,7 +215,7 @@ export default {
|
|
|
204
215
|
watch(() => props.hiddenColumn, (value) => {
|
|
205
216
|
const filterColumns = applyColumnList.value.length
|
|
206
217
|
? applyColumnList.value.filter(col => col.text !== value)
|
|
207
|
-
: originColumnList.value.filter(col => col.text !== value);
|
|
218
|
+
: originColumnList.value.filter(col => (col.text !== value && !col.checked));
|
|
208
219
|
|
|
209
220
|
applyColumnList.value = filterColumns;
|
|
210
221
|
checkColumnGroup.value = filterColumns.map(col => col.label);
|
|
@@ -269,6 +269,10 @@
|
|
|
269
269
|
max-height: 120px;
|
|
270
270
|
background: none;
|
|
271
271
|
|
|
272
|
+
&--used {
|
|
273
|
+
padding-top: 16px;
|
|
274
|
+
}
|
|
275
|
+
|
|
272
276
|
&__hidden-items {
|
|
273
277
|
max-height: 106px;
|
|
274
278
|
overflow-y: auto;
|
|
@@ -344,15 +348,9 @@
|
|
|
344
348
|
}
|
|
345
349
|
&--operator {
|
|
346
350
|
width: 80px;
|
|
347
|
-
|
|
348
|
-
.ev-input {
|
|
351
|
+
:deep(.ev-input) {
|
|
349
352
|
height: 26px !important;
|
|
350
353
|
}
|
|
351
|
-
&:hover {
|
|
352
|
-
cursor: initial;
|
|
353
|
-
margin: inherit;
|
|
354
|
-
border: none;
|
|
355
|
-
}
|
|
356
354
|
}
|
|
357
355
|
&.non-display {
|
|
358
356
|
display: none;
|
|
@@ -182,7 +182,7 @@ export const resizeEvent = (params) => {
|
|
|
182
182
|
const scrollWidth = elWidth - bodyEl.clientWidth;
|
|
183
183
|
|
|
184
184
|
const result = stores.orderedColumns.reduce((acc, cur) => {
|
|
185
|
-
if (cur.hide) {
|
|
185
|
+
if (cur.hide || cur.hiddenDisplay) {
|
|
186
186
|
return acc;
|
|
187
187
|
}
|
|
188
188
|
if (cur.width) {
|
|
@@ -292,6 +292,7 @@ export const resizeEvent = (params) => {
|
|
|
292
292
|
const startMouseLeft = event.clientX;
|
|
293
293
|
const startColumnLeft = columnRect.left - headerLeft;
|
|
294
294
|
|
|
295
|
+
bodyEl.style.overflow = 'auto';
|
|
295
296
|
resizeLineEl.style.left = `${startLeft}px`;
|
|
296
297
|
|
|
297
298
|
resizeInfo.showResizeLine = true;
|
|
@@ -527,6 +528,7 @@ export const checkEvent = (params) => {
|
|
|
527
528
|
|
|
528
529
|
export const sortEvent = (params) => {
|
|
529
530
|
const { sortInfo, stores, updatePagingInfo } = params;
|
|
531
|
+
const { emit } = getCurrentInstance();
|
|
530
532
|
function OrderQueue() {
|
|
531
533
|
this.orders = ['asc', 'desc', 'init'];
|
|
532
534
|
this.dequeue = () => this.orders.shift();
|
|
@@ -559,6 +561,11 @@ export const sortEvent = (params) => {
|
|
|
559
561
|
|
|
560
562
|
sortInfo.isSorting = true;
|
|
561
563
|
updatePagingInfo({ onSort: true });
|
|
564
|
+
emit('sort-column', {
|
|
565
|
+
field: sortInfo.sortField,
|
|
566
|
+
order: sortInfo.sortOrder,
|
|
567
|
+
column: sortInfo.sortColumn,
|
|
568
|
+
});
|
|
562
569
|
}
|
|
563
570
|
};
|
|
564
571
|
/**
|
|
@@ -1143,7 +1150,8 @@ export const columnSettingEvent = (params) => {
|
|
|
1143
1150
|
const setFilteringColumn = () => {
|
|
1144
1151
|
columnSettingInfo.visibleColumnIdx = stores.filteredColumns.map(col => col.index);
|
|
1145
1152
|
|
|
1146
|
-
const originColumnIdx = stores.originColumns.filter(col => !col.hide
|
|
1153
|
+
const originColumnIdx = stores.originColumns.filter(col => (!col.hide || col.hiddenDisplay))
|
|
1154
|
+
.map(col => col.index);
|
|
1147
1155
|
const visibleColumnIdx = columnSettingInfo.visibleColumnIdx;
|
|
1148
1156
|
|
|
1149
1157
|
columnSettingInfo.isFilteringColumn = (visibleColumnIdx.length !== originColumnIdx.length);
|
|
@@ -1155,7 +1163,7 @@ export const columnSettingEvent = (params) => {
|
|
|
1155
1163
|
onResize();
|
|
1156
1164
|
};
|
|
1157
1165
|
const onApplyColumn = (columnNames) => {
|
|
1158
|
-
const columns = stores.orderedColumns.filter(col => !col.hide);
|
|
1166
|
+
const columns = stores.orderedColumns.filter(col => !col.hide && !col.hiddenDisplay);
|
|
1159
1167
|
const isSameColumn = columnNames.length === columns.length
|
|
1160
1168
|
&& columns.every(col => columnNames.includes(col.field));
|
|
1161
1169
|
|
|
@@ -1164,12 +1172,20 @@ export const columnSettingEvent = (params) => {
|
|
|
1164
1172
|
}
|
|
1165
1173
|
|
|
1166
1174
|
stores.filteredColumns = stores.originColumns
|
|
1167
|
-
.filter(
|
|
1175
|
+
.filter((col) => {
|
|
1176
|
+
if (columnNames.includes(col.field) || !col.caption) {
|
|
1177
|
+
if (col?.hiddenDisplay) {
|
|
1178
|
+
col.hiddenDisplay = false;
|
|
1179
|
+
}
|
|
1180
|
+
return true;
|
|
1181
|
+
}
|
|
1182
|
+
return false;
|
|
1183
|
+
});
|
|
1168
1184
|
columnSettingInfo.hiddenColumn = '';
|
|
1169
1185
|
setFilteringColumn();
|
|
1170
1186
|
};
|
|
1171
1187
|
const setColumnHidden = (val) => {
|
|
1172
|
-
const columns = stores.orderedColumns.filter(col => !col.hide);
|
|
1188
|
+
const columns = stores.orderedColumns.filter(col => !col.hide && !col.hiddenDisplay);
|
|
1173
1189
|
|
|
1174
1190
|
if (columns.length === 1) {
|
|
1175
1191
|
return;
|
|
@@ -110,64 +110,158 @@
|
|
|
110
110
|
</span>
|
|
111
111
|
</template>
|
|
112
112
|
<div class="ev-select-dropbox-wrapper">
|
|
113
|
-
<div
|
|
114
|
-
v-if="isDropbox"
|
|
115
|
-
ref="dropbox"
|
|
116
|
-
class="ev-select-dropbox"
|
|
117
|
-
:style="dropboxPosition"
|
|
118
|
-
>
|
|
119
|
-
<input
|
|
120
|
-
v-if="filterable"
|
|
121
|
-
type="text"
|
|
122
|
-
class="ev-input-query"
|
|
123
|
-
:placeholder="searchPlaceholder"
|
|
124
|
-
:value="filterTextRef"
|
|
125
|
-
@input="changeFilterText"
|
|
126
|
-
/>
|
|
127
113
|
<div
|
|
128
|
-
|
|
129
|
-
|
|
114
|
+
v-if="isDropbox"
|
|
115
|
+
ref="dropbox"
|
|
116
|
+
class="ev-select-dropbox"
|
|
117
|
+
:style="dropboxPosition"
|
|
130
118
|
>
|
|
131
|
-
<
|
|
132
|
-
v-if="
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
119
|
+
<input
|
|
120
|
+
v-if="filterable"
|
|
121
|
+
type="text"
|
|
122
|
+
class="ev-input-query"
|
|
123
|
+
:placeholder="searchPlaceholder"
|
|
124
|
+
:value="filterTextRef"
|
|
125
|
+
@input="changeFilterText"
|
|
126
|
+
/>
|
|
127
|
+
<template v-if="checkable">
|
|
128
|
+
<div
|
|
129
|
+
v-if="multiple"
|
|
130
|
+
class="ev-select-dropbox-item all-check"
|
|
139
131
|
:class="{
|
|
140
|
-
|
|
141
|
-
disabled: item.disabled
|
|
132
|
+
selected: allCheck
|
|
142
133
|
}"
|
|
143
|
-
|
|
144
|
-
@click.stop.prevent="[clickItem(item.value), changeDropboxPosition()]"
|
|
134
|
+
@click.self.prevent="[changeAllCheck(false), changeDropboxPosition()]"
|
|
145
135
|
>
|
|
146
|
-
<
|
|
147
|
-
v-
|
|
148
|
-
:
|
|
136
|
+
<ev-checkbox
|
|
137
|
+
v-model="allCheck"
|
|
138
|
+
:label="allCheckLabel"
|
|
139
|
+
@change="[changeAllCheck(true), changeDropboxPosition()]"
|
|
149
140
|
/>
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
141
|
+
</div>
|
|
142
|
+
<div
|
|
143
|
+
ref="itemWrapper"
|
|
144
|
+
class="ev-select-dropbox-list"
|
|
145
|
+
>
|
|
146
|
+
<template v-if="multiple">
|
|
147
|
+
<ev-checkbox-group
|
|
148
|
+
v-model="mv"
|
|
149
|
+
>
|
|
150
|
+
<ul
|
|
151
|
+
v-if="filteredItems.length"
|
|
152
|
+
class="ev-select-dropbox-ul"
|
|
153
|
+
>
|
|
154
|
+
<li
|
|
155
|
+
v-for="(item, idx) in filteredItems"
|
|
156
|
+
:key="`${item.value}_${idx}`"
|
|
157
|
+
class="ev-select-dropbox-item"
|
|
158
|
+
:class="{
|
|
159
|
+
selected: selectedItemClass(item.value),
|
|
160
|
+
disabled: item.disabled
|
|
161
|
+
}"
|
|
162
|
+
:title="item.name"
|
|
163
|
+
@click.self.prevent="[clickItem(item.value), changeDropboxPosition()]"
|
|
164
|
+
>
|
|
165
|
+
<ev-checkbox
|
|
166
|
+
:label="item.value"
|
|
167
|
+
>
|
|
168
|
+
<i
|
|
169
|
+
v-if="item.iconClass"
|
|
170
|
+
:class="item.iconClass"
|
|
171
|
+
/>
|
|
172
|
+
{{ item.name }}
|
|
173
|
+
</ev-checkbox>
|
|
174
|
+
</li>
|
|
175
|
+
</ul>
|
|
176
|
+
<ul v-else>
|
|
177
|
+
<li class="ev-select-dropbox-item disabled">
|
|
178
|
+
{{ noMatchingText }}
|
|
179
|
+
</li>
|
|
180
|
+
</ul>
|
|
181
|
+
</ev-checkbox-group>
|
|
182
|
+
</template>
|
|
183
|
+
<template v-else>
|
|
184
|
+
<ul
|
|
185
|
+
v-if="filteredItems.length"
|
|
186
|
+
class="ev-select-dropbox-ul"
|
|
187
|
+
>
|
|
188
|
+
<li
|
|
189
|
+
v-for="(item, idx) in filteredItems"
|
|
190
|
+
:key="`${item.value}_${idx}`"
|
|
191
|
+
class="ev-select-dropbox-item"
|
|
192
|
+
:class="{
|
|
193
|
+
selected: selectedItemClass(item.value),
|
|
194
|
+
disabled: item.disabled
|
|
195
|
+
}"
|
|
196
|
+
:title="item.name"
|
|
197
|
+
@click.stop.prevent="[clickItem(item.value), changeDropboxPosition()]"
|
|
198
|
+
>
|
|
199
|
+
<ev-checkbox
|
|
200
|
+
:model-value="mv === item.value"
|
|
201
|
+
>
|
|
202
|
+
<i
|
|
203
|
+
v-if="item.iconClass"
|
|
204
|
+
:class="item.iconClass"
|
|
205
|
+
/>
|
|
206
|
+
{{ item.name }}
|
|
207
|
+
</ev-checkbox>
|
|
208
|
+
</li>
|
|
209
|
+
</ul>
|
|
210
|
+
</template>
|
|
211
|
+
</div>
|
|
212
|
+
</template>
|
|
213
|
+
<template v-else>
|
|
214
|
+
<div
|
|
215
|
+
ref="itemWrapper"
|
|
216
|
+
class="ev-select-dropbox-list"
|
|
217
|
+
>
|
|
218
|
+
<ul
|
|
219
|
+
v-if="filteredItems.length"
|
|
220
|
+
class="ev-select-dropbox-ul"
|
|
221
|
+
>
|
|
222
|
+
<li
|
|
223
|
+
v-for="(item, idx) in filteredItems"
|
|
224
|
+
:key="`${item.value}_${idx}`"
|
|
225
|
+
class="ev-select-dropbox-item"
|
|
226
|
+
:class="{
|
|
227
|
+
selected: selectedItemClass(item.value),
|
|
228
|
+
disabled: item.disabled
|
|
229
|
+
}"
|
|
230
|
+
:title="item.name"
|
|
231
|
+
@click.stop.prevent="[clickItem(item.value), changeDropboxPosition()]"
|
|
232
|
+
>
|
|
233
|
+
<i
|
|
234
|
+
v-if="item.iconClass"
|
|
235
|
+
:class="item.iconClass"
|
|
236
|
+
/>
|
|
237
|
+
{{ item.name }}
|
|
238
|
+
</li>
|
|
239
|
+
</ul>
|
|
240
|
+
<ul v-else>
|
|
241
|
+
<li class="ev-select-dropbox-item disabled">
|
|
242
|
+
{{ noMatchingText }}
|
|
243
|
+
</li>
|
|
244
|
+
</ul>
|
|
245
|
+
</div>
|
|
246
|
+
</template>
|
|
158
247
|
</div>
|
|
159
248
|
</div>
|
|
160
249
|
</div>
|
|
161
|
-
</div>
|
|
162
250
|
</div>
|
|
163
251
|
</template>
|
|
164
252
|
|
|
165
253
|
<script>
|
|
166
254
|
import { selectClickoutside as clickoutside } from '@/directives/clickoutside';
|
|
255
|
+
import EvCheckboxGroup from '@/components/checkboxGroup/CheckboxGroup';
|
|
256
|
+
import EvCheckbox from '@/components/checkbox/Checkbox';
|
|
167
257
|
import { useModel, useDropdown } from './uses';
|
|
168
258
|
|
|
169
259
|
export default {
|
|
170
260
|
name: 'EvSelect',
|
|
261
|
+
components: {
|
|
262
|
+
EvCheckbox,
|
|
263
|
+
EvCheckboxGroup,
|
|
264
|
+
},
|
|
171
265
|
directives: {
|
|
172
266
|
clickoutside,
|
|
173
267
|
},
|
|
@@ -204,6 +298,10 @@ export default {
|
|
|
204
298
|
type: Boolean,
|
|
205
299
|
default: false,
|
|
206
300
|
},
|
|
301
|
+
checkable: {
|
|
302
|
+
type: Boolean,
|
|
303
|
+
default: false,
|
|
304
|
+
},
|
|
207
305
|
collapseTags: {
|
|
208
306
|
type: Boolean,
|
|
209
307
|
default: false,
|
|
@@ -216,6 +314,10 @@ export default {
|
|
|
216
314
|
type: String,
|
|
217
315
|
default: '',
|
|
218
316
|
},
|
|
317
|
+
allCheckLabel: {
|
|
318
|
+
type: String,
|
|
319
|
+
default: 'Select All',
|
|
320
|
+
},
|
|
219
321
|
},
|
|
220
322
|
emits: {
|
|
221
323
|
'update:modelValue': null,
|
|
@@ -247,6 +349,8 @@ export default {
|
|
|
247
349
|
changeDropboxPosition,
|
|
248
350
|
clickItem,
|
|
249
351
|
selectedItemClass,
|
|
352
|
+
allCheck,
|
|
353
|
+
changeAllCheck,
|
|
250
354
|
} = useDropdown({ mv, changeMv });
|
|
251
355
|
|
|
252
356
|
return {
|
|
@@ -272,6 +376,8 @@ export default {
|
|
|
272
376
|
changeDropboxPosition,
|
|
273
377
|
clickItem,
|
|
274
378
|
selectedItemClass,
|
|
379
|
+
allCheck,
|
|
380
|
+
changeAllCheck,
|
|
275
381
|
};
|
|
276
382
|
},
|
|
277
383
|
};
|
|
@@ -437,4 +543,10 @@ export default {
|
|
|
437
543
|
color: #C0C4CC;
|
|
438
544
|
}
|
|
439
545
|
}
|
|
546
|
+
|
|
547
|
+
.all-check {
|
|
548
|
+
height: 35px;
|
|
549
|
+
line-height: 38px;
|
|
550
|
+
border-bottom: 1px solid;
|
|
551
|
+
}
|
|
440
552
|
</style>
|
|
@@ -226,6 +226,17 @@ export const useDropdown = (param) => {
|
|
|
226
226
|
isDropbox.value = false;
|
|
227
227
|
};
|
|
228
228
|
|
|
229
|
+
const allCheck = ref(false);
|
|
230
|
+
const changeAllCheck = (isCheckBoxLabel) => {
|
|
231
|
+
if (!isCheckBoxLabel) {
|
|
232
|
+
allCheck.value = !allCheck.value;
|
|
233
|
+
}
|
|
234
|
+
if (allCheck.value) {
|
|
235
|
+
mv.value = filteredItems.value.map(item => item.value);
|
|
236
|
+
} else {
|
|
237
|
+
mv.value = [];
|
|
238
|
+
}
|
|
239
|
+
};
|
|
229
240
|
/**
|
|
230
241
|
* 항목 클릭하여 선택하는 이벤트
|
|
231
242
|
* 항목 내 disabled인 경우 클릭 로직을 타지 않게 한다.
|
|
@@ -250,6 +261,7 @@ export const useDropdown = (param) => {
|
|
|
250
261
|
const idx = mv.value.indexOf(val);
|
|
251
262
|
mv.value.splice(idx, 1);
|
|
252
263
|
}
|
|
264
|
+
allCheck.value = mv.value.length === filteredItems.value.length;
|
|
253
265
|
changeMv();
|
|
254
266
|
};
|
|
255
267
|
const clickItem = !props.multiple ? singleClickItem : multipleClickItem;
|
|
@@ -263,6 +275,13 @@ export const useDropdown = (param) => {
|
|
|
263
275
|
const multipleSelectedCls = val => mv.value.includes(val);
|
|
264
276
|
const selectedItemClass = !props.multiple ? singleSelectedCls : multipleSelectedCls;
|
|
265
277
|
|
|
278
|
+
watch(() => mv.value, (curr) => {
|
|
279
|
+
if (props.multiple && props.checkable) {
|
|
280
|
+
allCheck.value = curr.length === filteredItems.value.length;
|
|
281
|
+
changeDropboxPosition();
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
|
|
266
285
|
return {
|
|
267
286
|
select,
|
|
268
287
|
selectWrapper,
|
|
@@ -278,5 +297,7 @@ export const useDropdown = (param) => {
|
|
|
278
297
|
changeDropboxPosition,
|
|
279
298
|
clickItem,
|
|
280
299
|
selectedItemClass,
|
|
300
|
+
allCheck,
|
|
301
|
+
changeAllCheck,
|
|
281
302
|
};
|
|
282
303
|
};
|