evui 3.3.62 → 3.3.63

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.
@@ -1,493 +0,0 @@
1
- <template>
2
- <div>
3
- <ev-window
4
- v-model:visible="showWindow"
5
- :title="`Setting Filter(${targetColumn.caption})`"
6
- >
7
- <!--Contents-->
8
- <div class="grid-filter">
9
- <div class="grid-filter-header">
10
- <!--Add Button-->
11
- <ev-button
12
- size="small"
13
- @click="onAdd"
14
- >
15
- Add
16
- </ev-button>
17
- <ev-button
18
- size="small"
19
- :disabled="!checked.length"
20
- @click="onDelete"
21
- >
22
- Delete
23
- </ev-button>
24
- </div>
25
- <div class="grid-filter-body">
26
- <!--Add Form-->
27
- <div
28
- v-if="showAddForm"
29
- class="grid-filter-add-wrap"
30
- >
31
- <div class="grid-filter-add-item">
32
- <div class="form-row-contents">
33
- <div class="form-row">
34
- <span class="form-row-title wide">Type</span>
35
- <div class="form-row-contents">
36
- <ev-select
37
- v-model="addInfo.type"
38
- :items="types"
39
- class="item-input"
40
- />
41
- </div>
42
- </div>
43
- <div class="form-row">
44
- <span class="form-row-title wide">Comparison</span>
45
- <div class="form-row-contents">
46
- <ev-select
47
- v-model="addInfo.comparison"
48
- :items="getList(targetColumn.type)"
49
- class="item-input"
50
- />
51
- </div>
52
- </div>
53
- <div class="form-row">
54
- <span class="form-row-title wide">Value</span>
55
- <div class="form-row-contents">
56
- <ev-text-field
57
- v-model.trim="addInfo.value"
58
- type="text"
59
- placeholder="Please enter the content"
60
- class="item-input"
61
- />
62
- </div>
63
- </div>
64
- </div>
65
- </div>
66
- <div class="split-line"/>
67
- <div class="confirm-wrap">
68
- <!--Save Button-->
69
- <ev-button
70
- size="small"
71
- @click="onSave"
72
- >
73
- Save
74
- </ev-button>
75
- <ev-button
76
- size="small"
77
- @click="onCancel"
78
- >
79
- Cancel
80
- </ev-button>
81
- </div>
82
- </div>
83
- <!--Grid-->
84
- <ev-grid
85
- v-model:checked="checked"
86
- :rows="tableData"
87
- :columns="columns"
88
- :width="`100%`"
89
- :height="gridHeight"
90
- :option="{
91
- adjust: true,
92
- useFilter: false,
93
- useCheckbox: {
94
- use: true,
95
- mode: 'multi',
96
- headerCheck: true,
97
- }
98
- }"
99
- />
100
- <!--Apply Button-->
101
- <ev-button
102
- class="applyBtn"
103
- type="primary"
104
- @click="onApply"
105
- >
106
- Apply
107
- </ev-button>
108
- </div>
109
- </div>
110
- </ev-window>
111
- </div>
112
- </template>
113
-
114
- <script>
115
- import { ref, reactive, toRefs, watch, computed } from 'vue';
116
-
117
- export default {
118
- name: 'EvGridFilterWindow',
119
- props: {
120
- /**
121
- * 필터 팝업 표시 유무
122
- */
123
- isShow: {
124
- type: Boolean,
125
- default: false,
126
- },
127
- /**
128
- * 필터 대상 컬럼 정보
129
- */
130
- targetColumn: {
131
- type: Object,
132
- default: () => ({}),
133
- },
134
- /**
135
- * 설정된 필터 목록
136
- */
137
- filterItems: {
138
- type: Array,
139
- default: () => [],
140
- },
141
- },
142
- emits: {
143
- 'apply-filter': null,
144
- 'before-close': null,
145
- },
146
- setup(props, { emit }) {
147
- const showAddForm = ref(false);
148
- const gridHeight = ref(320);
149
- const gridInfo = reactive({
150
- tableData: [],
151
- checked: [],
152
- columns: [
153
- { caption: 'Type', field: 'type', type: 'string', width: 60 },
154
- { caption: 'Comparison', field: 'comparison', type: 'string', width: 120 },
155
- { caption: 'Value', field: 'value', type: 'string' },
156
- ],
157
- addInfo: {
158
- type: 'AND',
159
- comparison: props.targetColumn.type === 'string' ? 'Equal' : '>',
160
- value: '',
161
- },
162
- types: [
163
- { name: 'OR', value: 'OR' },
164
- { name: 'AND', value: 'AND' },
165
- ],
166
- defaultComparison: {
167
- string: [
168
- { name: 'Equal', value: 'Equal' },
169
- { name: 'Not Equal', value: 'Not Equal' },
170
- { name: 'Like', value: 'Like' },
171
- { name: 'Not Like', value: 'Not Like' },
172
- ],
173
- number: [
174
- { name: '>', value: '>' },
175
- { name: '<', value: '<' },
176
- { name: '=', value: '=' },
177
- ],
178
- float: [
179
- { name: '>', value: '>' },
180
- { name: '<', value: '<' },
181
- { name: '=', value: '=' },
182
- ],
183
- },
184
- });
185
- const showWindow = computed({
186
- get: () => props.isShow,
187
- set: (val) => {
188
- if (!val) {
189
- gridInfo.checked.length = 0;
190
- gridInfo.tableData.length = 0;
191
- gridHeight.value = 320;
192
- showAddForm.value = false;
193
- /**
194
- * 필터 팝업 종료 전 이벤트
195
- */
196
- emit('before-close');
197
- }
198
- },
199
- });
200
- /**
201
- * 데이터 유형에 맞는 필터 목록을 반환한다.
202
- *
203
- * @param {string} type - 데이터 유형
204
- * @returns {array} 필터 목록
205
- */
206
- const getList = (type) => {
207
- let result = gridInfo.defaultComparison[type];
208
-
209
- if (!result) {
210
- result = gridInfo.defaultComparison.string;
211
- }
212
-
213
- return result;
214
- };
215
- /**
216
- * 선택한 필터를 테이블에 적용하도록 요청한다.
217
- */
218
- const onApply = () => {
219
- const filterItems = [];
220
- const rowList = gridInfo.tableData;
221
- const columnList = gridInfo.columns;
222
- const checkedItems = gridInfo.checked;
223
-
224
- for (let ix = 0; ix < rowList.length; ix++) {
225
- const row = rowList[ix];
226
- const item = columnList.reduce((acc, column, index) => {
227
- acc[column.field] = row[index];
228
- return acc;
229
- }, {});
230
-
231
- item.use = !!checkedItems.find(checkItem => checkItem === row);
232
-
233
- filterItems.push(item);
234
- }
235
-
236
- /**
237
- * 필터 적용 요청 이벤트
238
- *
239
- * @property {string} field - 컬럼 field
240
- * @property {array} filterItems - 필터 목록
241
- */
242
- if (props.targetColumn.field) {
243
- emit('apply-filter', props.targetColumn.field, filterItems);
244
- }
245
- /**
246
- * 필터 팝업 종료 전 이벤트
247
- */
248
- emit('before-close');
249
- };
250
- /**
251
- * 작성한 필터 정보를 저장한다.
252
- */
253
- const onSave = () => {
254
- const item = gridInfo.addInfo;
255
- const tempData = JSON.parse(JSON.stringify(gridInfo.tableData));
256
- tempData.push(gridInfo.columns.reduce((acc, column) => {
257
- acc.push(item[column.field]);
258
- return acc;
259
- }, []));
260
- gridInfo.tableData = tempData;
261
- gridHeight.value = 320;
262
- showAddForm.value = false;
263
- };
264
- /**
265
- * 새로운 필터 추가 양식을 표시한다.
266
- */
267
- const onAdd = () => {
268
- gridInfo.addInfo = {
269
- type: 'AND',
270
- comparison: props.targetColumn.type === 'string' ? 'Equal' : '>',
271
- value: '',
272
- };
273
- gridHeight.value = 153;
274
- showAddForm.value = true;
275
- };
276
- /**
277
- * 선택한 필터를 필터 목록에서 삭제한다.
278
- */
279
- const onDelete = () => {
280
- if (!gridInfo.checked.length) {
281
- return;
282
- }
283
-
284
- const checkList = gridInfo.checked;
285
- const rowList = gridInfo.tableData;
286
- const tempData = [];
287
- for (let ix = 0; ix < rowList.length; ix++) {
288
- const row = rowList[ix];
289
- if (checkList.indexOf(row) === -1) {
290
- tempData.push(row);
291
- }
292
- }
293
-
294
- gridInfo.checked.length = 0;
295
- gridInfo.tableData = tempData;
296
- };
297
- /**
298
- * 필터 추가 작성을 취소한다.
299
- */
300
- const onCancel = () => {
301
- gridHeight.value = 320;
302
- showAddForm.value = false;
303
- };
304
- /**
305
- * 필터 팝업을 종료한다.
306
- */
307
- const onCloseWindow = (state) => {
308
- if (!state) {
309
- gridInfo.checked.length = 0;
310
- gridInfo.tableData.length = 0;
311
- gridHeight.value = 320;
312
- showAddForm.value = false;
313
- /**
314
- * 필터 팝업 종료 전 이벤트
315
- */
316
- emit('before-close');
317
- }
318
- };
319
- watch(
320
- () => props.filterItems,
321
- (items) => {
322
- const columns = gridInfo.columns;
323
- const rowList = [];
324
- const checkList = [];
325
-
326
- for (let ix = 0; ix < items.length; ix++) {
327
- const item = items[ix];
328
- const value = columns.reduce((acc, column) => {
329
- acc.push(item[column.field]);
330
- return acc;
331
- }, []);
332
-
333
- if (item.use) {
334
- checkList.push(value);
335
- }
336
-
337
- rowList.push(value);
338
- }
339
-
340
- gridInfo.checked = checkList;
341
- gridInfo.tableData = rowList;
342
- },
343
- );
344
- return {
345
- showWindow,
346
- showAddForm,
347
- gridHeight,
348
- ...toRefs(gridInfo),
349
- getList,
350
- onApply,
351
- onSave,
352
- onAdd,
353
- onDelete,
354
- onCancel,
355
- onCloseWindow,
356
- };
357
- },
358
- };
359
- </script>
360
-
361
- <style lang="scss" scoped>
362
- @import '../../style/index.scss';
363
-
364
- .grid-filter {
365
- display: flex;
366
- width: 100%;
367
- height: 100%;
368
- flex-direction: column;
369
- text-align: initial;
370
-
371
- .grid-filter-header {
372
- height: 24px;
373
- margin-bottom: 12px;
374
- text-align: right;
375
-
376
- .ev-button {
377
- width: 70px;
378
- margin-left: 5px;
379
- }
380
- }
381
- }
382
-
383
- .grid-filter-body {
384
- display: flex;
385
- width: 100%;
386
- height: 100%;
387
- flex-direction: column;
388
- align-items: center;
389
-
390
- .ev-button {
391
- width: 100px;
392
- margin-top: 8px;
393
- }
394
-
395
- .applyBtn {
396
- position: absolute;
397
- bottom: 17px;
398
- }
399
- }
400
-
401
- .grid-filter-add-wrap {
402
- display: flex;
403
- width: 100%;
404
- //height: 100%;
405
- padding: 10px;
406
- background-color: lightgray;
407
- margin-bottom: 10px;
408
-
409
- @include evThemify() {
410
- background-color: evThemed('grid-filter-add-background');
411
- }
412
-
413
- .split-line {
414
- width: 1px;
415
- margin: 0 20px;
416
-
417
- @include evThemify() {
418
- background-color: evThemed('grid-filter-add-background');
419
- }
420
- }
421
-
422
- .confirm-wrap {
423
- display: flex;
424
- width: 70px;
425
- margin-right: 10px;
426
- flex-direction: column;
427
- align-items: center;
428
-
429
- .ev-button {
430
- width: 70px;
431
- }
432
- }
433
- }
434
-
435
- .grid-filter-add-item {
436
- display: flex;
437
- align-items: center;
438
- flex: 1;
439
-
440
- .item-labels {
441
- margin-right: 10px;
442
- list-style-type: none;
443
-
444
- li {
445
- height: 24px;
446
- line-height: 24px;
447
- margin-bottom: 8px;
448
- font-size: 13px;
449
-
450
- @include evThemify() {
451
- color: evThemed('grid-filter-add-label');
452
- }
453
-
454
- &:last-child {
455
- margin-bottom: 0;
456
- }
457
- }
458
- }
459
-
460
- .item-inputs {
461
- display: flex;
462
- flex-direction: column;
463
- flex: 1;
464
-
465
- .item-input {
466
- width: 100%;
467
- height: 24px;
468
- margin-bottom: 8px;
469
-
470
- &:last-child {
471
- margin-bottom: 0;
472
- }
473
- }
474
- }
475
-
476
- .form-row-contents {
477
- min-height: 35px;
478
- flex: 1;
479
- }
480
-
481
- .form-row {
482
- display: flex;
483
- width: 100%;
484
- margin: 8px 0;
485
- }
486
-
487
- .form-row-title.wide {
488
- width: 30%;
489
- line-height: 33px;
490
- vertical-align: middle;
491
- }
492
- }
493
- </style>