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.
Files changed (162) hide show
  1. package/README.md +18 -33
  2. package/dist/404.html +44 -0
  3. package/dist/favicon.ico +0 -0
  4. package/dist/index.js +22738 -0
  5. package/dist/index.umd.cjs +28 -0
  6. package/dist/style.css +1 -0
  7. package/package.json +46 -43
  8. package/dist/evui.common.js +0 -63681
  9. package/dist/evui.common.js.map +0 -1
  10. package/dist/evui.umd.js +0 -63691
  11. package/dist/evui.umd.js.map +0 -1
  12. package/dist/evui.umd.min.js +0 -2
  13. package/dist/evui.umd.min.js.map +0 -1
  14. package/dist/img/EVUI.b82ee81a.svg +0 -293
  15. package/src/assets/logo.png +0 -0
  16. package/src/common/emitter.js +0 -20
  17. package/src/common/utils.bignumber.js +0 -67
  18. package/src/common/utils.debounce.js +0 -223
  19. package/src/common/utils.js +0 -151
  20. package/src/common/utils.table.js +0 -78
  21. package/src/common/utils.throttle.js +0 -83
  22. package/src/common/utils.tree.js +0 -18
  23. package/src/components/button/Button.vue +0 -195
  24. package/src/components/button/index.js +0 -7
  25. package/src/components/buttonGroup/ButtonGroup.vue +0 -11
  26. package/src/components/buttonGroup/index.js +0 -7
  27. package/src/components/calendar/Calendar.vue +0 -725
  28. package/src/components/calendar/index.js +0 -7
  29. package/src/components/calendar/uses.js +0 -1410
  30. package/src/components/chart/Chart.vue +0 -363
  31. package/src/components/chart/ChartToolbar.vue +0 -52
  32. package/src/components/chart/chart.core.js +0 -1170
  33. package/src/components/chart/chartZoom.core.js +0 -540
  34. package/src/components/chart/element/element.bar.js +0 -672
  35. package/src/components/chart/element/element.bar.time.js +0 -166
  36. package/src/components/chart/element/element.heatmap.js +0 -743
  37. package/src/components/chart/element/element.line.js +0 -611
  38. package/src/components/chart/element/element.pie.js +0 -197
  39. package/src/components/chart/element/element.scatter.js +0 -320
  40. package/src/components/chart/element/element.tip.js +0 -717
  41. package/src/components/chart/helpers/helpers.canvas.js +0 -265
  42. package/src/components/chart/helpers/helpers.constant.js +0 -235
  43. package/src/components/chart/helpers/helpers.util.js +0 -400
  44. package/src/components/chart/index.js +0 -9
  45. package/src/components/chart/model/index.js +0 -50
  46. package/src/components/chart/model/model.series.js +0 -125
  47. package/src/components/chart/model/model.store.js +0 -1427
  48. package/src/components/chart/plugins/plugins.interaction.js +0 -1659
  49. package/src/components/chart/plugins/plugins.legend.gradient.js +0 -606
  50. package/src/components/chart/plugins/plugins.legend.js +0 -1543
  51. package/src/components/chart/plugins/plugins.pie.js +0 -254
  52. package/src/components/chart/plugins/plugins.scrollbar.js +0 -732
  53. package/src/components/chart/plugins/plugins.title.js +0 -61
  54. package/src/components/chart/plugins/plugins.tooltip.js +0 -1041
  55. package/src/components/chart/scale/scale.js +0 -951
  56. package/src/components/chart/scale/scale.linear.js +0 -268
  57. package/src/components/chart/scale/scale.logarithmic.js +0 -135
  58. package/src/components/chart/scale/scale.step.js +0 -430
  59. package/src/components/chart/scale/scale.time.category.js +0 -338
  60. package/src/components/chart/scale/scale.time.js +0 -49
  61. package/src/components/chart/style/chart.scss +0 -405
  62. package/src/components/chart/uses.js +0 -721
  63. package/src/components/chartBrush/ChartBrush.vue +0 -323
  64. package/src/components/chartBrush/chartBrush.core.js +0 -691
  65. package/src/components/chartBrush/index.js +0 -9
  66. package/src/components/chartBrush/uses.js +0 -23
  67. package/src/components/chartGroup/ChartGroup.vue +0 -144
  68. package/src/components/chartGroup/index.js +0 -9
  69. package/src/components/chartGroup/style/chartGroup.scss +0 -5
  70. package/src/components/chartGroup/uses.js +0 -53
  71. package/src/components/checkbox/Checkbox.vue +0 -229
  72. package/src/components/checkbox/index.js +0 -7
  73. package/src/components/checkboxGroup/CheckboxGroup.vue +0 -44
  74. package/src/components/checkboxGroup/index.js +0 -7
  75. package/src/components/contextMenu/ContextMenu.vue +0 -95
  76. package/src/components/contextMenu/MenuList.vue +0 -182
  77. package/src/components/contextMenu/index.js +0 -7
  78. package/src/components/contextMenu/uses.js +0 -223
  79. package/src/components/datePicker/DatePicker.vue +0 -504
  80. package/src/components/datePicker/index.js +0 -7
  81. package/src/components/datePicker/uses.js +0 -460
  82. package/src/components/grid/Grid.vue +0 -1535
  83. package/src/components/grid/GridColumnSetting.vue +0 -358
  84. package/src/components/grid/GridFilterSetting.vue +0 -323
  85. package/src/components/grid/GridPagination.vue +0 -75
  86. package/src/components/grid/GridSummary.vue +0 -314
  87. package/src/components/grid/GridToolbar.vue +0 -35
  88. package/src/components/grid/icon/icon-option-button.vue +0 -17
  89. package/src/components/grid/icon/icon-sort-button.vue +0 -67
  90. package/src/components/grid/index.js +0 -11
  91. package/src/components/grid/style/grid.scss +0 -417
  92. package/src/components/grid/uses.js +0 -1629
  93. package/src/components/icon/Icon.vue +0 -53
  94. package/src/components/icon/index.js +0 -8
  95. package/src/components/inputNumber/InputNumber.vue +0 -212
  96. package/src/components/inputNumber/index.js +0 -7
  97. package/src/components/inputNumber/uses.js +0 -217
  98. package/src/components/loading/Loading.vue +0 -125
  99. package/src/components/loading/index.js +0 -7
  100. package/src/components/menu/Menu.vue +0 -79
  101. package/src/components/menu/MenuItem.vue +0 -201
  102. package/src/components/menu/index.js +0 -7
  103. package/src/components/message/Message.vue +0 -229
  104. package/src/components/message/index.js +0 -34
  105. package/src/components/messageBox/MessageBox.vue +0 -358
  106. package/src/components/messageBox/index.js +0 -22
  107. package/src/components/notification/Notification.vue +0 -316
  108. package/src/components/notification/index.js +0 -49
  109. package/src/components/pagination/Pagination.vue +0 -317
  110. package/src/components/pagination/index.js +0 -7
  111. package/src/components/pagination/pageButton.vue +0 -31
  112. package/src/components/progress/Progress.vue +0 -139
  113. package/src/components/progress/index.js +0 -7
  114. package/src/components/radio/Radio.vue +0 -159
  115. package/src/components/radio/index.js +0 -7
  116. package/src/components/radioGroup/RadioGroup.vue +0 -41
  117. package/src/components/radioGroup/index.js +0 -7
  118. package/src/components/scheduler/Scheduler.vue +0 -149
  119. package/src/components/scheduler/index.js +0 -7
  120. package/src/components/scheduler/uses.js +0 -183
  121. package/src/components/select/Select.vue +0 -556
  122. package/src/components/select/index.js +0 -7
  123. package/src/components/select/uses.js +0 -379
  124. package/src/components/slider/Slider.vue +0 -505
  125. package/src/components/slider/index.js +0 -7
  126. package/src/components/slider/uses.js +0 -391
  127. package/src/components/tabPanel/TabPanel.vue +0 -74
  128. package/src/components/tabPanel/index.js +0 -7
  129. package/src/components/tabs/Tabs.vue +0 -517
  130. package/src/components/tabs/index.js +0 -7
  131. package/src/components/textField/TextField.vue +0 -399
  132. package/src/components/textField/index.js +0 -7
  133. package/src/components/timePicker/TimePicker.vue +0 -364
  134. package/src/components/timePicker/index.js +0 -7
  135. package/src/components/toggle/Toggle.vue +0 -115
  136. package/src/components/toggle/index.js +0 -7
  137. package/src/components/tree/Tree.vue +0 -338
  138. package/src/components/tree/TreeNode.vue +0 -293
  139. package/src/components/tree/index.js +0 -7
  140. package/src/components/treeGrid/TreeGrid.vue +0 -1074
  141. package/src/components/treeGrid/TreeGridNode.vue +0 -349
  142. package/src/components/treeGrid/TreeGridToolbar.vue +0 -35
  143. package/src/components/treeGrid/icon/icon-tree.png +0 -0
  144. package/src/components/treeGrid/index.js +0 -9
  145. package/src/components/treeGrid/style/treeGrid.scss +0 -277
  146. package/src/components/treeGrid/uses.js +0 -1178
  147. package/src/components/window/Window.vue +0 -329
  148. package/src/components/window/index.js +0 -7
  149. package/src/components/window/uses.js +0 -908
  150. package/src/directives/clickoutside.js +0 -90
  151. package/src/main.js +0 -120
  152. package/src/style/components/input.scss +0 -108
  153. package/src/style/functions.scss +0 -3
  154. package/src/style/index.scss +0 -6
  155. package/src/style/lib/fonts/EVUI.eot +0 -0
  156. package/src/style/lib/fonts/EVUI.svg +0 -293
  157. package/src/style/lib/fonts/EVUI.ttf +0 -0
  158. package/src/style/lib/fonts/EVUI.woff +0 -0
  159. package/src/style/lib/icon.css +0 -888
  160. package/src/style/mixins.scss +0 -94
  161. package/src/style/themes.scss +0 -69
  162. package/src/style/variables.scss +0 -22
@@ -1,358 +0,0 @@
1
- <template>
2
- <template v-if="isShowColumnSetting">
3
- <teleport to="#ev-grid-column-setting-modal">
4
- <section
5
- ref="columnSettingWrapper"
6
- v-clickoutside="hideColumnSetting"
7
- class="ev-grid-column-setting"
8
- :style="columnSettingStyle"
9
- >
10
- <div class="ev-grid-column-setting__header">
11
- <p class="header-title"> {{ textInfo.title }} </p>
12
- <ev-text-field
13
- v-model="searchVm"
14
- type="search"
15
- :placeholder="textInfo.search"
16
- @input="onSearchColumn"
17
- />
18
- </div>
19
- <div class="ev-grid-column-setting__content">
20
- <template v-if="columnList.length">
21
- <ev-checkbox-group
22
- v-model="checkColumnGroup"
23
- @change="onCheckColumn"
24
- >
25
- <ev-checkbox
26
- v-for="(column, idx) in columnList"
27
- :key="`column_${idx}`"
28
- :label="column?.text"
29
- :disabled="!!column?.fixed"
30
- :tooltip-title="column?.label ?? ''"
31
- >
32
- {{ column?.label }}
33
- </ev-checkbox>
34
- </ev-checkbox-group>
35
- </template>
36
- <template v-else>
37
- <p class="is-empty"> {{ textInfo.empty }} </p>
38
- </template>
39
- </div>
40
- <div class="ev-grid-column-setting__footer">
41
- <ev-button
42
- type="primary"
43
- :disabled="isDisabled"
44
- @click="onApplyColumn"
45
- >
46
- {{ textInfo.ok }}
47
- </ev-button>
48
- </div>
49
- </section>
50
- </teleport>
51
- </template>
52
- </template>
53
-
54
- <script>
55
- import { clickoutside } from '@/directives/clickoutside';
56
- import {
57
- computed,
58
- nextTick,
59
- onBeforeMount,
60
- reactive,
61
- ref,
62
- watch,
63
- } from 'vue';
64
- import { cloneDeep } from 'lodash-es';
65
-
66
- export default {
67
- name: 'EVGridColumnSetting',
68
- directives: {
69
- clickoutside,
70
- },
71
- props: {
72
- isShow: {
73
- type: Boolean,
74
- default: false,
75
- },
76
- columns: {
77
- type: [Array],
78
- default: () => [],
79
- },
80
- hiddenColumn: {
81
- type: String,
82
- default: '',
83
- },
84
- position: {
85
- type: Object,
86
- default: () => ({
87
- top: 0,
88
- left: 0,
89
- columnListMenuWidth: 0,
90
- }),
91
- },
92
- isShowMenuOnClick: {
93
- type: Boolean,
94
- default: false,
95
- },
96
- textInfo: {
97
- type: Object,
98
- default: () => ({
99
- title: 'Column List',
100
- search: 'Search',
101
- empty: 'No records',
102
- ok: 'OK',
103
- }),
104
- },
105
- },
106
- emits: {
107
- 'update:isShow': [Boolean],
108
- 'update:isShowMenuOnClick': [Boolean],
109
- 'apply-column': null,
110
- },
111
- setup(props, { emit }) {
112
- const isShowColumnSetting = computed({
113
- get: () => props.isShow,
114
- set: val => emit('update:isShow', val),
115
- });
116
-
117
- const columnSettingWrapper = ref(null);
118
- const searchVm = ref('');
119
- const isSearch = ref(false);
120
- const checkColumnGroup = ref([]);
121
- const originColumnList = ref([]);
122
- const searchColumnList = ref([]);
123
- const applyColumnList = ref([]);
124
- const columnList = computed(() => (isSearch.value
125
- ? searchColumnList.value : originColumnList.value));
126
- const isDisabled = computed(() => !columnList.value.length);
127
- let timer = null;
128
- let lastCheckedColumn = null;
129
- const columnSettingStyle = reactive({
130
- top: null,
131
- left: null,
132
- });
133
- const computedIsShowMenuOnClick = computed({
134
- get: () => props.isShowMenuOnClick,
135
- set: val => emit('update:isShowMenuOnClick', val),
136
- });
137
-
138
- const onCheckColumn = (columns) => {
139
- if (columns?.length === 1) {
140
- lastCheckedColumn = columns[0];
141
- } else if (columns?.length < 1) { // 최소 한개 컬럼은 선택되도록
142
- if (lastCheckedColumn == null) {
143
- lastCheckedColumn = originColumnList.value[0]?.text;
144
- }
145
- checkColumnGroup.value.push(lastCheckedColumn);
146
- }
147
- };
148
-
149
- const onSearchColumn = (searchWord) => {
150
- if (timer) {
151
- clearTimeout(timer);
152
- }
153
-
154
- timer = setTimeout(() => {
155
- isSearch.value = false;
156
-
157
- if (searchWord) {
158
- const lowerCasedSearchWord = searchWord.toString().toLowerCase();
159
- searchColumnList.value = originColumnList.value.filter((column) => {
160
- const columnName = column.label.toString().toLowerCase();
161
- return columnName.includes(lowerCasedSearchWord);
162
- });
163
-
164
- isSearch.value = true;
165
- }
166
- }, 500);
167
- };
168
-
169
- const initSearchValue = () => {
170
- searchVm.value = '';
171
- isSearch.value = false;
172
- searchColumnList.value.length = 0;
173
- };
174
-
175
- const initValue = () => {
176
- const columns = applyColumnList.value.length ? applyColumnList.value : originColumnList.value;
177
-
178
- checkColumnGroup.value = columns
179
- .filter(col => col.originChecked)
180
- .map(col => col.text);
181
-
182
- initSearchValue();
183
- };
184
- const onApplyColumn = () => {
185
- applyColumnList.value = originColumnList.value
186
- .filter(col => checkColumnGroup.value.includes(col.text));
187
- const checkedColumns = applyColumnList.value.map(col => col.text);
188
-
189
- emit('apply-column', checkedColumns);
190
- isShowColumnSetting.value = false;
191
- computedIsShowMenuOnClick.value = false;
192
- };
193
-
194
- const prevColumns = ref();
195
- const prevCheckColumnGroup = ref();
196
- const setColumns = () => {
197
- prevCheckColumnGroup.value = cloneDeep(checkColumnGroup.value);
198
- originColumnList.value = props.columns
199
- .filter(col => !col.hide && col.caption)
200
- .map((col) => {
201
- const prevColumn = prevColumns.value?.find(c => c.field === col.field);
202
- let isChecked = false;
203
-
204
- if (prevColumn) {
205
- const isHiddenChanged = prevColumn?.hiddenDisplay !== col?.hiddenDisplay;
206
- isChecked = isHiddenChanged || !prevCheckColumnGroup.value?.length
207
- ? !col?.hiddenDisplay
208
- : prevCheckColumnGroup.value.includes(col.field);
209
- } else {
210
- isChecked = !col.hiddenDisplay;
211
- }
212
- return {
213
- label: col.caption,
214
- text: col.field,
215
- originChecked: !col.hiddenDisplay,
216
- checked: isChecked,
217
- fixed: col.fixed,
218
- };
219
- });
220
-
221
- checkColumnGroup.value = originColumnList.value
222
- .filter(col => col.checked)
223
- .map(col => col.text);
224
- applyColumnList.value.length = 0;
225
- prevColumns.value = cloneDeep(props.columns);
226
- };
227
-
228
- const hideColumnSetting = () => {
229
- isShowColumnSetting.value = false;
230
- computedIsShowMenuOnClick.value = false;
231
- };
232
-
233
- const initWrapperDiv = () => {
234
- const root = document.createElement('div');
235
- root.id = 'ev-grid-column-setting-modal';
236
- root.setAttribute('style', 'position: absolute; top: 0; left: 0;');
237
- const hasRoot = document.getElementById('ev-grid-column-setting-modal');
238
- if (!hasRoot) {
239
- document.body.appendChild(root);
240
- }
241
- };
242
-
243
- const setPosition = async () => {
244
- await nextTick();
245
-
246
- const docWidth = document.documentElement.clientWidth;
247
- const docHeight = document.documentElement.clientHeight;
248
- const columnSettingWrapperRect = columnSettingWrapper.value?.getBoundingClientRect();
249
- const columnSettingWidth = columnSettingWrapperRect?.width;
250
- const columnSettingHeight = columnSettingWrapperRect?.height;
251
-
252
- const { top, left, columnListMenuWidth } = props.position;
253
- let columnSettingLeft;
254
-
255
- if (columnListMenuWidth) { // 컨텍스트 메뉴일 때
256
- columnSettingLeft = left;
257
-
258
- if (docWidth < left + columnSettingWidth) {
259
- columnSettingLeft = left - columnSettingWidth - columnListMenuWidth;
260
- }
261
- } else {
262
- columnSettingLeft = left - columnSettingWidth;
263
- }
264
- const maximumPosY = docHeight - columnSettingHeight;
265
- columnSettingStyle.top = `${Math.min(top, maximumPosY) + document.documentElement.scrollTop}px`;
266
- columnSettingStyle.left = `${columnSettingLeft + document.documentElement.scrollLeft}px`;
267
- };
268
-
269
- onBeforeMount(() => initWrapperDiv());
270
-
271
- watch(() => props.columns, () => {
272
- setColumns();
273
- }, { immediate: true, deep: true });
274
-
275
- watch(() => isShowColumnSetting.value, async () => {
276
- initValue();
277
-
278
- if (isShowColumnSetting.value) {
279
- await setPosition();
280
- }
281
- });
282
-
283
- watch(() => props.hiddenColumn, (value) => {
284
- const filterColumns = applyColumnList.value.length
285
- ? applyColumnList.value.filter(col => col.text !== value)
286
- : originColumnList.value.filter(col => (col.text !== value && col.checked));
287
-
288
- applyColumnList.value = filterColumns;
289
- checkColumnGroup.value = filterColumns.map(col => col.text);
290
- });
291
-
292
- return {
293
- columnSettingWrapper,
294
- columnSettingStyle,
295
- isShowColumnSetting,
296
- checkColumnGroup,
297
- columnList,
298
- searchVm,
299
- isDisabled,
300
- onSearchColumn,
301
- onApplyColumn,
302
- onCheckColumn,
303
- hideColumnSetting,
304
- };
305
- },
306
- };
307
- </script>
308
-
309
- <style lang="scss">
310
- .ev-grid-column-setting {
311
- position: absolute;
312
- width: 180px;
313
- border: 1px solid #D0D0D0;
314
- background: #FFFFFF;
315
- font-size: 12px;
316
- z-index: 1;
317
- &__header {
318
- padding: 10px;
319
-
320
- .ev-text-field {
321
- margin-top: 10px;
322
- }
323
- }
324
-
325
- &__content {
326
- height: 120px;
327
- padding: 0 10px;
328
- border-top: 1px solid #CED4DA;
329
- border-bottom: 1px solid #CED4DA;
330
- overflow: auto;
331
-
332
- .ev-checkbox {
333
- display: block;
334
- padding: 10px 0;
335
-
336
- .ev-checkbox-label {
337
- width: 120px;
338
- overflow: hidden;
339
- text-overflow: ellipsis;
340
- white-space: nowrap;
341
- }
342
- }
343
- .is-empty {
344
- height: 30px;
345
- text-align: center;
346
- }
347
- }
348
-
349
- &__footer {
350
- display: flex;
351
- padding: 5px 10px;
352
-
353
- .ev-button {
354
- margin-left: auto;
355
- }
356
- }
357
- }
358
- </style>
@@ -1,323 +0,0 @@
1
- <template>
2
- <template v-if="isShowFilterSetting">
3
- <teleport to="#ev-grid-filter-setting-modal">
4
- <section
5
- v-clickoutside="() => { isShowFilterSetting = false }"
6
- class="ev-grid-filter-setting"
7
- :style="{
8
- top: $props.position.top,
9
- left: $props.position.left,
10
- }"
11
- >
12
- <div class="ev-grid-filter-setting__header">
13
- <ev-icon icon="ev-icon-filter-list"></ev-icon>
14
- <span class="header-title"> Filter ({{$props.column.caption}}) </span>
15
- </div>
16
- <div class="ev-grid-filter-setting__content">
17
- <div
18
- v-for="(item, idx) in filteringItems"
19
- :key="idx"
20
- class="ev-grid-filter-setting__row">
21
- <ev-select
22
- v-model="item.operator"
23
- class="ev-grid-filter-setting__row--operator"
24
- :title="getSelectTitle(items1, item.operator)"
25
- :items="items1"
26
- :disabled="idx > 1"
27
- :style="{
28
- visibility: idx > 0 ? 'visible' : 'hidden',
29
- }"
30
- @change="changeOperator"
31
- />
32
- <ev-select
33
- v-model="item.comparison"
34
- class="ev-grid-filter-setting__row--comparison"
35
- :title="getSelectTitle(items2, item.comparison)"
36
- :items="items2"
37
- @change="changeComparison(item.comparison, idx)"
38
- />
39
- <ev-select
40
- v-if="$props.column.type === 'boolean'"
41
- v-model="item.value"
42
- class="ev-grid-filter-setting__row--comparison"
43
- :items="booleanItems"
44
- />
45
- <ev-text-field
46
- v-else
47
- v-model="item.value"
48
- class="ev-grid-filter-setting__row--value"
49
- :disabled="item.comparison === 'isEmpty' || item.comparison === 'isNotEmpty'"
50
- @input="validateValue($props.column.type, item)"
51
- />
52
- <div
53
- class="ev-grid-filter-setting__row--button"
54
- >
55
- <ev-icon
56
- icon="ev-icon-trash2"
57
- @click="removeRow(idx)"
58
- />
59
- </div>
60
- </div>
61
- </div>
62
- <div class="ev-grid-filter-setting__footer">
63
- <ev-button
64
- type="primary"
65
- @click="applyFiltering"
66
- >
67
- OK
68
- </ev-button>
69
- </div>
70
- </section>
71
- </teleport>
72
- </template>
73
- </template>
74
-
75
- <script>
76
- import { clickoutside } from '@/directives/clickoutside';
77
- import { computed, onBeforeMount, ref, watch } from 'vue';
78
- import { cloneDeep } from 'lodash-es';
79
-
80
- export default {
81
- name: 'EVGridFilterSetting',
82
- directives: {
83
- clickoutside,
84
- },
85
- props: {
86
- isShow: {
87
- type: Boolean,
88
- default: false,
89
- },
90
- position: {
91
- type: Object,
92
- default: () => ({
93
- top: 0,
94
- left: 0,
95
- }),
96
- },
97
- column: {
98
- type: Object,
99
- default: () => ({}),
100
- },
101
- items: {
102
- type: Object,
103
- default: () => ({}),
104
- },
105
- },
106
- emits: {
107
- 'update:isShow': null,
108
- 'apply-filtering': null,
109
- },
110
- setup(props, { emit }) {
111
- const filteringItems = ref([]);
112
- const filteringColumn = computed(() => props.column);
113
- // const columnField = computed(() => {
114
- // console.log(props.column);
115
- // return props.column?.field;
116
- // });
117
- const items1 = [
118
- { name: 'AND', value: 'and' },
119
- { name: 'OR', value: 'or' },
120
- ];
121
- const booleanItems = [
122
- { name: 'true', value: 'true' },
123
- { name: 'false', value: 'false' },
124
- ];
125
- const numberItems = [
126
- { name: '=', value: '=' },
127
- { name: '!=', value: '!=' },
128
- { name: '<', value: '<' },
129
- { name: '>', value: '>' },
130
- { name: '<=', value: '<=' },
131
- { name: '>=', value: '>=' },
132
- ];
133
- const stringItems = [
134
- { name: 's%', value: 's%' }, // starts with
135
- { name: '%s', value: '%s' }, // ends with
136
- { name: '%s%', value: '%s%' }, // contains
137
- { name: 'Not Like', value: 'notLike' }, // does not contains
138
- { name: '=', value: '=' }, // is
139
- { name: '!=', value: '!=' }, // is not
140
- ];
141
- const commonItems = [
142
- { name: 'Is empty', value: 'isEmpty' },
143
- { name: 'Is not empty', value: 'isNotEmpty' },
144
- ];
145
- const getComparisonItems = (columnType) => {
146
- if (columnType === 'string' || columnType === 'stringNumber') {
147
- return [...stringItems, ...commonItems];
148
- } else if (columnType === 'number' || columnType === 'float') {
149
- return [...numberItems, ...commonItems];
150
- } else if (columnType === 'boolean') {
151
- return [
152
- { name: '=', value: '=' },
153
- ];
154
- }
155
- return [];
156
- };
157
- const items2 = computed(() => getComparisonItems(props.column.type));
158
- const isShowFilterSetting = computed({
159
- get: () => props.isShow,
160
- set: val => emit('update:isShow', val),
161
- });
162
- const addRow = () => {
163
- const operator = filteringItems.value.length >= 2 ? filteringItems.value[1].operator : 'and';
164
- filteringItems.value.push({
165
- comparison: '=',
166
- operator,
167
- value: '',
168
- caption: filteringColumn.value.caption,
169
- });
170
- };
171
- const removeRow = (idx) => {
172
- if (filteringItems.value.length > 1) {
173
- filteringItems.value.splice(idx, 1);
174
- } else if (idx === 0) {
175
- filteringItems.value[0].comparison = '=';
176
- filteringItems.value[0].value = '';
177
- }
178
- };
179
- const changeComparison = (comparison, idx) => {
180
- if (comparison === 'isEmpty' || comparison === 'isNotEmpty') {
181
- filteringItems.value[idx].value = '';
182
- }
183
- };
184
- const changeOperator = (val) => {
185
- filteringItems.value = filteringItems.value.map(item => ({ ...item, operator: val }));
186
- };
187
- const applyFiltering = () => {
188
- emit(
189
- 'apply-filtering',
190
- filteringColumn.value.field,
191
- filteringItems.value.filter(item => item.value
192
- || item.comparison === 'isEmpty' || item.comparison === 'isNotEmpty'),
193
- );
194
- };
195
- watch(
196
- () => props.isShow,
197
- (isShow) => {
198
- const rowList = [];
199
- const items = cloneDeep(props.items);
200
- if (isShow && filteringColumn.value.field) {
201
- if (!items[filteringColumn.value.field]?.length) {
202
- rowList.push({
203
- comparison: '=',
204
- operator: 'and',
205
- value: '',
206
- caption: filteringColumn.value.caption,
207
- });
208
- } else {
209
- items[filteringColumn.value.field].forEach((row) => {
210
- rowList.push(row);
211
- });
212
- }
213
- filteringItems.value = rowList;
214
- }
215
- },
216
- );
217
-
218
- const getSelectTitle = (items, title) => items.find(item => item.value === title)?.name || '';
219
-
220
- const initWrapperDiv = () => {
221
- const root = document.createElement('div');
222
- root.id = 'ev-grid-filter-setting-modal';
223
- root.setAttribute('style', 'position: absolute; top: 0; left: 0;');
224
- const hasRoot = document.getElementById('ev-grid-filter-setting-modal');
225
- if (!hasRoot) {
226
- document.body.appendChild(root);
227
- }
228
- };
229
-
230
- onBeforeMount(() => {
231
- initWrapperDiv();
232
- });
233
-
234
- const validateValue = (type, item) => {
235
- if (type === 'number' || type === 'float') {
236
- // 숫자, 마침표, 콤마만 입력 가능
237
- item.value = item.value.replace(/[^0-9.,]/g, '');
238
- }
239
- };
240
- return {
241
- filteringItems,
242
- isShowFilterSetting,
243
- items1,
244
- items2,
245
- booleanItems,
246
- addRow,
247
- removeRow,
248
- changeOperator,
249
- applyFiltering,
250
- changeComparison,
251
- getSelectTitle,
252
- validateValue,
253
- };
254
- },
255
- };
256
- </script>
257
-
258
- <style lang="scss">
259
- .ev-grid-filter-setting {
260
- position: absolute;
261
- width: auto;
262
- border: 1px solid #D0D0D0;
263
- background: #FFFFFF;
264
- font-size: 12px;
265
- z-index: 1;
266
- &__header {
267
- padding: 10px;
268
-
269
- .ev-text-field {
270
- margin-top: 10px;
271
- }
272
- }
273
- &__row {
274
- display: flex;
275
- width: 100%;
276
- padding: 6px 0;
277
- gap: 5px;
278
- .ev-select__wrapper {
279
- width: inherit;
280
- }
281
- &--operator {
282
- width: 80px;
283
- }
284
- &--comparison {
285
- width: 120px;
286
- }
287
- &--value {
288
- width: 120px;
289
- }
290
- &--button {
291
- display: flex;
292
- justify-content: center;
293
- align-items: center;
294
- &.add {
295
- padding: 6px 0;
296
- justify-content: end;
297
- }
298
- i {
299
- font-size: 22px;
300
- margin-left: 8px;
301
- &:hover {
302
- opacity: 0.6;
303
- cursor: pointer;
304
- }
305
- }
306
- }
307
- }
308
- &__content {
309
- padding: 0 10px;
310
- border-top: 1px solid #CED4DA;
311
- border-bottom: 1px solid #CED4DA;
312
- }
313
-
314
- &__footer {
315
- display: flex;
316
- padding: 5px 10px;
317
-
318
- .ev-button {
319
- margin-left: auto;
320
- }
321
- }
322
- }
323
- </style>