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,1074 +0,0 @@
1
- <template>
2
- <div
3
- v-if="$slots.toolbar || useGridSetting"
4
- ref="toolbarRef"
5
- class="toolbar-wrapper"
6
- :style="`width: ${gridWidth};`"
7
- >
8
- <!-- Toolbar -->
9
- <toolbar>
10
- <template #toolbarWrapper>
11
- <grid-option-button
12
- v-if="useGridSetting"
13
- class="grid-setting__icon"
14
- @click="setGridSetting"
15
- />
16
- <slot
17
- name="toolbar"
18
- :item="{
19
- onSearch,
20
- }"
21
- />
22
- </template>
23
- </toolbar>
24
- </div>
25
- <div
26
- ref="grid-wrapper"
27
- v-resize="onResize"
28
- v-observe-visibility="{
29
- callback: onShow,
30
- once: true,
31
- }"
32
- :style="gridStyle"
33
- >
34
- <!-- Table -->
35
- <div
36
- v-cloak
37
- ref="grid"
38
- :class="gridClass"
39
- >
40
- <!-- Header -->
41
- <div
42
- v-show="showHeader"
43
- ref="header"
44
- :class="headerClass"
45
- >
46
- <ul class="column-list">
47
- <!-- Header Checkbox -->
48
- <li
49
- v-if="useCheckbox.use"
50
- :class="headerCheckboxClass"
51
- :style="{
52
- width: `${minWidth}px`,
53
- 'border-right': '1px solid #CFCFCF',
54
- }"
55
- >
56
- <ev-checkbox
57
- v-if="isHeaderCheckbox"
58
- v-model="isHeaderChecked"
59
- :disabled="isHeaderUncheckable"
60
- :indeterminate="isHeaderIndeterminate"
61
- @change="onCheckAll"
62
- />
63
- </li>
64
- <!-- Column List -->
65
- <template
66
- v-for="(column, index) in orderedColumns"
67
- :key="index"
68
- >
69
- <li
70
- v-if="!column.hide && !column.hiddenDisplay"
71
- :data-index="index"
72
- :class="getColumnClass(column)"
73
- :style="getColumnStyle(column, index)"
74
- >
75
- <!-- Custom Header -->
76
- <template v-if="column.customHeader && !!$slots.customHeader">
77
- <slot name="customHeader" />
78
- </template>
79
- <template v-else>
80
- <!-- Column Name -->
81
- <span
82
- :title="column.caption"
83
- :class="[
84
- 'column-name',
85
- { 'column-name--click' : useGridSetting }
86
- ]"
87
- @click="onColumnContextMenu($event, column)"
88
- @click.prevent="columnMenu.show"
89
- >
90
- {{ column.caption }}
91
- <!-- Sort Icon -->
92
- <span @click.stop="onSort(column)">
93
- <template v-if="!!$slots.sortIcon">
94
- <span
95
- v-if="$props.option?.useSort && !!column?.sortable"
96
- class="column-sort__icon column-sort__icon--basic"
97
- :style="{
98
- height: `${rowHeight}px`,
99
- 'line-height': `${rowHeight}px`,
100
- }"
101
- >
102
- <slot name="sortIcon" />
103
- </span>
104
- <span
105
- v-if="sortField === column.field"
106
- :class="sortIconClass(column)"
107
- :style="{
108
- height: `${rowHeight}px`,
109
- 'line-height': `${rowHeight}px`,
110
- }"
111
- >
112
- <slot :name="`sortIcon_${sortOrder}`" />
113
- </span>
114
- </template>
115
- <template v-else>
116
- <grid-sort-button
117
- v-if="$props.option?.useSort && !!column?.sortable"
118
- class="column-sort__icon column-sort__icon--basic"
119
- :icon="'basic'"
120
- :style="{
121
- height: `${rowHeight}px`,
122
- 'line-height': `${rowHeight}px`,
123
- }"
124
- />
125
- <grid-sort-button
126
- v-if="sortField === column.field"
127
- :class="sortIconClass(column)"
128
- :icon="sortOrder"
129
- :style="{
130
- height: `${rowHeight}px`,
131
- 'line-height': `${rowHeight}px`,
132
- visibility: !!sortOrder ? column.hidden : true,
133
- }"
134
- />
135
- </template>
136
- </span>
137
- </span>
138
- </template>
139
- <!-- Column Resize -->
140
- <span
141
- class="column-resize"
142
- @mousedown.stop.left="onColumnResize(index, $event)"
143
- />
144
- </li>
145
- </template>
146
- <!-- Row Contextmenu Column -->
147
- <li
148
- v-if="$props.option.customContextMenu?.length"
149
- :class="{
150
- column: true,
151
- 'non-border': !!borderStyle,
152
- }"
153
- :style="{
154
- width: '30px',
155
- 'min-width': '30px',
156
- 'margin-right': (hasVerticalScrollBar || hasHorizontalScrollBar)
157
- ? `${scrollWidth}px` : '0px',
158
- }"
159
- >
160
- </li>
161
- </ul>
162
- </div>
163
- <!-- Body -->
164
- <div
165
- ref="body"
166
- :class="bodyStyle"
167
- @scroll="onScroll"
168
- @contextmenu="onContextMenu($event)"
169
- @contextmenu.prevent="menu.show"
170
- >
171
- <!-- vScroll Top -->
172
- <div
173
- :style="`height: ${vScrollTopHeight}px;`"
174
- class="vscroll-spacer"
175
- />
176
- <table ref="table">
177
- <tbody>
178
- <tree-grid-node
179
- v-for="(node, idx) in viewStore"
180
- :key="idx"
181
- :selected-data="selectedRow"
182
- :node-data="node"
183
- :use-checkbox="useCheckbox"
184
- :ordered-columns="orderedColumns"
185
- :expand-icon="option.expandIcon"
186
- :collapse-icon="option.collapseIcon"
187
- :parent-icon="option.parentIcon"
188
- :child-icon="option.childIcon"
189
- :custom-context-menu="customContextMenu"
190
- :menu-ref="menu"
191
- :is-resize="isResize"
192
- :row-height="rowHeight"
193
- :min-width="minWidth"
194
- :highlight-index="highlightIdx"
195
- :border-style="borderStyle"
196
- @check-tree-data="onCheck"
197
- @expand-tree-data="handleExpand"
198
- @click-tree-data="onRowClick"
199
- @dbl-click-tree-data="onRowDblClick"
200
- @context-menu="onContextMenu"
201
- >
202
- <!-- Cell Renderer -->
203
- <template
204
- v-for="(column, cellIndex) in orderedColumns"
205
- :key="cellIndex"
206
- v-slot:[getSlotName(column.field)] = "{ item }"
207
- >
208
- <template v-if="!!$slots[column.field]">
209
- <slot
210
- :name="column.field"
211
- :item="{
212
- data: item.data,
213
- fieldName: column.field
214
- }"
215
- >
216
- </slot>
217
- </template>
218
- <template v-else>
219
- <span :title="getConvertValue(column, node[column.field])">
220
- {{ getConvertValue(column, node[column.field]) }}
221
- </span>
222
- </template>
223
- </template>
224
- <template
225
- v-if="$slots.contextmenuIcon"
226
- #contextmenuIconNode
227
- >
228
- <slot
229
- name="contextmenuIcon"
230
- />
231
- </template>
232
- </tree-grid-node>
233
- <tr v-if="!viewStore.length">
234
- <td class="is-empty">{{ emptyText }}</td>
235
- </tr>
236
- </tbody>
237
- </table>
238
- <!-- vScroll Bottom -->
239
- <div
240
- :style="`height: ${vScrollBottomHeight}px;`"
241
- class="vscroll-spacer"
242
- />
243
- <!-- Context Menu -->
244
- <ev-context-menu
245
- ref="menu"
246
- :custom-class="contextMenuClass"
247
- :items="contextMenuItems"
248
- />
249
- <ev-context-menu
250
- ref="columnMenu"
251
- :items="columnMenuItems"
252
- />
253
- <ev-context-menu
254
- ref="gridSettingMenu"
255
- :items="gridSettingContextMenuItems"
256
- :is-show-menu-on-click="isShowMenuOnClick"
257
- />
258
- </div>
259
- <!-- Resize Line -->
260
- <div
261
- v-show="showResizeLine"
262
- ref="resizeLine"
263
- class="table-resize-line"
264
- />
265
- </div>
266
- </div>
267
- <!-- Summary -->
268
- <grid-summary
269
- v-if="useSummary"
270
- :is-tree="true"
271
- :ordered-columns="orderedColumns"
272
- :stores="stores"
273
- :use-checkbox="useCheckbox.use"
274
- :style-option="{
275
- borderStyle,
276
- minWidth,
277
- rowHeight,
278
- }"
279
- :scroll-left="summaryScroll"
280
- />
281
- <!-- Pagination -->
282
- <grid-pagination
283
- v-if="usePage && !isInfinite"
284
- v-model="currentPage"
285
- :total="showTreeStore.length"
286
- :per-page="perPage"
287
- :visible-page="visiblePage"
288
- :show-page-info="showPageInfo"
289
- :order="order"
290
- />
291
- <!-- Column Setting -->
292
- <column-setting
293
- v-model:is-show="isShowColumnSetting"
294
- v-model:is-show-menu-on-click="isShowMenuOnClick"
295
- :columns="updatedColumns"
296
- :hidden-column="hiddenColumn"
297
- :position="columnSettingPosition"
298
- :text-info="columnSettingTextInfo"
299
- @apply-column="onApplyColumn"
300
- />
301
- </template>
302
-
303
- <script>
304
- import {
305
- reactive,
306
- toRefs,
307
- computed,
308
- watch,
309
- onActivated,
310
- nextTick,
311
- ref,
312
- onMounted,
313
- onUnmounted,
314
- } from 'vue';
315
- import { cloneDeep } from 'lodash-es';
316
- import TreeGridNode from './TreeGridNode';
317
- import Toolbar from './TreeGridToolbar';
318
- import GridPagination from '../grid/GridPagination';
319
- import GridSummary from '../grid/GridSummary';
320
- import ColumnSetting from '../grid/GridColumnSetting.vue';
321
- import GridSortButton from '../grid/icon/icon-sort-button';
322
- import GridOptionButton from '../grid/icon/icon-option-button.vue';
323
- import {
324
- commonFunctions,
325
- scrollEvent,
326
- resizeEvent,
327
- clickEvent,
328
- checkEvent,
329
- contextMenuEvent,
330
- treeEvent,
331
- filterEvent,
332
- pagingEvent,
333
- getUpdatedColumns,
334
- sortEvent,
335
- } from './uses';
336
- import {
337
- columnSettingEvent,
338
- } from '../grid/uses';
339
-
340
- export default {
341
- name: 'EvTreeGrid',
342
- components: {
343
- TreeGridNode,
344
- Toolbar,
345
- GridPagination,
346
- GridSummary,
347
- ColumnSetting,
348
- GridSortButton,
349
- GridOptionButton,
350
- },
351
- props: {
352
- columns: {
353
- type: [Array],
354
- default: () => [],
355
- },
356
- rows: {
357
- type: [Array, Object],
358
- default: () => null,
359
- },
360
- width: {
361
- type: [String, Number],
362
- default: '100%',
363
- },
364
- height: {
365
- type: [String, Number],
366
- default: '100%',
367
- },
368
- selected: {
369
- type: [Array],
370
- default: () => [],
371
- },
372
- checked: {
373
- type: [Array],
374
- default: () => [],
375
- },
376
- option: {
377
- type: Object,
378
- default: () => ({}),
379
- },
380
- expandIcon: {
381
- type: String,
382
- default: '',
383
- },
384
- collapseIcon: {
385
- type: String,
386
- default: '',
387
- },
388
- },
389
- emits: {
390
- 'update:selected': null,
391
- 'update:checked': null,
392
- 'click-row': null,
393
- 'dblclick-row': null,
394
- 'check-row': null,
395
- 'check-all': null,
396
- 'page-change': null,
397
- 'sort-column': null,
398
- 'toggle-row': null,
399
- 'resize-column': ({ column, columns }) => ({ column, columns }),
400
- 'change-column-status': ({ columns }) => ({ columns }),
401
- 'change-column-info': ({ type, columns }) => ({ type, columns }),
402
- },
403
- setup(props) {
404
- const toolbarRef = ref(null);
405
- const useGridSetting = computed(() => (props.option?.useGridSetting?.use || false));
406
- const useSummary = computed(() => (props.option?.useSummary || false));
407
- const emptyText = computed(() => (props.option.emptyText ?? 'No records'));
408
- const elementInfo = reactive({
409
- body: null,
410
- header: null,
411
- table: null,
412
- resizeLine: null,
413
- 'grid-wrapper': null,
414
- });
415
- const filterInfo = reactive({
416
- isSearch: false,
417
- searchWord: '',
418
- });
419
- const columnSettingInfo = reactive({
420
- isShowColumnSetting: false,
421
- isFilteringColumn: false, // hide된 컬럼이 있는지
422
- visibleColumnIdx: [], // 보여지는 컬럼의 인덱스 목록
423
- hiddenColumn: '',
424
- columnSettingPosition: {
425
- top: 0,
426
- left: 0,
427
- columnListMenuWidth: 0,
428
- },
429
- useDefaultColumnSetting: computed(
430
- () => props.option?.useGridSetting?.useDefaultColumnSetting ?? true,
431
- ),
432
- columnSettingTextInfo: {
433
- title: props.option?.useGridSetting?.columnMenuText ?? 'Column List',
434
- search: props.option?.useGridSetting?.searchText ?? 'Search',
435
- empty: props.option?.useGridSetting?.emptyText ?? 'No records',
436
- ok: props.option?.useGridSetting?.okBtnText ?? 'OK',
437
- },
438
- });
439
- const stores = reactive({
440
- treeStore: [],
441
- viewStore: [],
442
- filterStore: [],
443
- pagingStore: [],
444
- originStore: [],
445
- showTreeStore: computed(() => stores.treeStore.filter(item => item.show)),
446
- searchStore: computed(() => stores.treeStore.filter(item => item.isFilter)),
447
- store: computed(() => (filterInfo.isSearch ? stores.searchStore : stores.treeStore)),
448
- treeRows: props.rows,
449
- filteredColumns: [],
450
- originColumns: computed(() => props.columns.map((column, index) => ({
451
- index,
452
- hiddenDisplay: false,
453
- ...column,
454
- width: isFinite(column.width) ? column.width : undefined,
455
- sortOption: {
456
- sortType: column?.sortOption?.sortType || 'init',
457
- },
458
- }))),
459
- orderedColumns: computed(() => (stores.filteredColumns.length
460
- ? stores.filteredColumns : stores.originColumns)),
461
- updatedColumns: computed(() => getUpdatedColumns(stores)),
462
- });
463
- const pageInfo = reactive({
464
- usePage: computed(() => (props.option.page?.use || false)),
465
- useClient: props.option.page?.useClient || false,
466
- isInfinite: computed(() => (props.option.page?.isInfinite || false)),
467
- startIndex: 0,
468
- prevPage: 0,
469
- currentPage: 0,
470
- pageTotal: computed(() => (props.option.page?.total || 0)),
471
- perPage: computed(() => (props.option.page?.perPage || 20)),
472
- visiblePage: computed(() => (props.option.page?.visiblePage || 8)),
473
- order: computed(() => (props.option.page?.order || 'center')),
474
- showPageInfo: computed(() => (props.option.page?.showPageInfo || false)),
475
- isClientPaging: computed(() =>
476
- pageInfo.useClient && pageInfo.usePage && !pageInfo.isInfinite),
477
- isHighlight: false,
478
- highlightPage: 0,
479
- });
480
- const checkInfo = reactive({
481
- prevCheckedRow: [],
482
- isHeaderChecked: false,
483
- isHeaderUncheckable: false,
484
- isHeaderIndeterminate: false,
485
- checkedRows: props.checked,
486
- useCheckbox: computed(() => props.option.useCheckbox || {}),
487
- });
488
- const {
489
- isRenderer,
490
- getComponentName,
491
- getConvertValue,
492
- getColumnIndex,
493
- setPixelUnit,
494
- checkHeader,
495
- } = commonFunctions({ checkInfo });
496
- const scrollInfo = reactive({
497
- lastScroll: {
498
- top: 0,
499
- left: 0,
500
- },
501
- vScrollTopHeight: 0,
502
- vScrollBottomHeight: 0,
503
- hasVerticalScrollBar: false,
504
- hasHorizontalScrollBar: false,
505
- });
506
- const selectInfo = reactive({
507
- selectedRow: props.selected,
508
- useSelect: computed(() => props.option?.useSelection?.use ?? true),
509
- limitCount: computed(() => {
510
- let limit = props.option?.useSelection?.limitCount;
511
- limit = !!limit && limit >= 2 ? limit : 0;
512
- return limit;
513
- }),
514
- multiple: computed(() => props.option?.useSelection?.multiple ?? false),
515
- });
516
- const sortInfo = reactive({
517
- isSorting: false,
518
- sortField: '',
519
- sortOrder: '',
520
- sortColumn: {},
521
- sortFunction: props.option.customAscFunction ?? {},
522
- });
523
- const contextInfo = reactive({
524
- menu: null,
525
- contextMenuItems: [],
526
- contextMenuClass: props.option.customContextMenuClass || '',
527
- columnMenu: null,
528
- columnMenuItems: [],
529
- columnMenuTextInfo: props.option.columnMenuText || {},
530
- hiddenColumnMenuItem: props.option.hiddenColumnMenuItem || {},
531
- customContextMenu: props.option.customContextMenu || [],
532
- gridSettingMenu: null,
533
- gridSettingContextMenuItems: [],
534
- customGridSettingContextMenu: computed(
535
- () => props.option?.useGridSetting?.customContextMenu || [],
536
- ),
537
- isShowMenuOnClick: false,
538
- });
539
- const resizeInfo = reactive({
540
- minWidth: 40,
541
- rendererMinWidth: 80,
542
- showResizeLine: false,
543
- adjust: props.option.adjust || false,
544
- columnWidth: props.option.columnWidth || 80,
545
- scrollWidth: props.option.scrollWidth || 17,
546
- rowHeight: computed(() => props.option.rowHeight || 35),
547
- gridWidth: computed(() => (props.width ? setPixelUnit(props.width) : '100%')),
548
- gridHeight: computed(() => (props.height ? setPixelUnit(props.height) : '100%')),
549
- isResize: false,
550
- });
551
- const styleInfo = reactive({
552
- showHeader: computed(() =>
553
- (props.option.showHeader === undefined ? true : props.option.showHeader)),
554
- stripeStyle: computed(() => props.option.style?.stripe || false),
555
- borderStyle: computed(() => props.option.style?.border || ''),
556
- highlightIdx: computed(() => props.option.style?.highlight ?? -1),
557
- });
558
- const clearSelectInfo = () => {
559
- selectInfo.selectedRow.length = 0;
560
- stores.store.forEach((row) => {
561
- row.selected = false;
562
- });
563
- };
564
- const clearCheckInfo = () => {
565
- checkInfo.isHeaderChecked = false;
566
- checkInfo.isHeaderIndeterminate = false;
567
- checkInfo.checkedRows.length = 0;
568
- stores.store.forEach((row) => {
569
- row.checked = false;
570
- row.indeterminate = false;
571
- });
572
- };
573
- const {
574
- getPagingData,
575
- updatePagingInfo,
576
- changePage,
577
- } = pagingEvent({
578
- stores,
579
- pageInfo,
580
- sortInfo,
581
- filterInfo,
582
- elementInfo,
583
- clearCheckInfo,
584
- });
585
- const summaryScroll = ref(0);
586
- const {
587
- updateVScroll,
588
- updateHScroll,
589
- onScroll,
590
- } = scrollEvent({
591
- scrollInfo,
592
- stores,
593
- elementInfo,
594
- resizeInfo,
595
- pageInfo,
596
- summaryScroll,
597
- getPagingData,
598
- updatePagingInfo,
599
- });
600
-
601
- const {
602
- onRowClick,
603
- onRowDblClick,
604
- } = clickEvent(selectInfo);
605
-
606
- const {
607
- onCheck,
608
- onCheckAll,
609
- } = checkEvent({
610
- checkInfo,
611
- stores,
612
- checkHeader,
613
- pageInfo,
614
- getPagingData,
615
- updatePagingInfo,
616
- });
617
-
618
- const {
619
- calculatedColumn,
620
- onResize,
621
- onShow,
622
- onColumnResize,
623
- } = resizeEvent({
624
- resizeInfo,
625
- elementInfo,
626
- checkInfo,
627
- stores,
628
- isRenderer,
629
- updateVScroll,
630
- updateHScroll,
631
- contextInfo,
632
- });
633
-
634
- const {
635
- setTreeNodeStore,
636
- handleExpand,
637
- } = treeEvent({ stores, onResize });
638
-
639
- const {
640
- onSort,
641
- initSortInfo,
642
- setSortInfo,
643
- } = sortEvent({ sortInfo, stores, updatePagingInfo, setTreeNodeStore, onResize });
644
-
645
- const {
646
- onSearch,
647
- } = filterEvent({
648
- stores,
649
- filterInfo,
650
- pageInfo,
651
- getConvertValue,
652
- onResize,
653
- checkHeader,
654
- getPagingData,
655
- updatePagingInfo,
656
- });
657
-
658
- const {
659
- setPositionColumnSetting,
660
- initColumnSettingInfo,
661
- onApplyColumn,
662
- setColumnHidden,
663
- } = columnSettingEvent({
664
- stores,
665
- columnSettingInfo,
666
- contextInfo,
667
- onSearch,
668
- onResize,
669
- });
670
-
671
- const {
672
- setContextMenu,
673
- onContextMenu,
674
- onColumnContextMenu,
675
- onGridSettingContextMenu,
676
- } = contextMenuEvent({
677
- contextInfo,
678
- stores,
679
- selectInfo,
680
- useGridSetting,
681
- columnSettingInfo,
682
- setColumnHidden,
683
- onSort,
684
- });
685
-
686
- const setGridSetting = (e) => {
687
- contextInfo.gridSettingContextMenuItems.length = 0;
688
- if (contextInfo.customGridSettingContextMenu.length) {
689
- onGridSettingContextMenu(e);
690
- } else {
691
- columnSettingInfo.isShowColumnSetting = true;
692
- }
693
- };
694
-
695
- const onMouseWheel = (e) => {
696
- if (e.type === 'wheel') {
697
- contextInfo.menu?.hide(e);
698
- }
699
- if (e.type === 'scroll' && !e.target.classList?.contains('table-body')
700
- && !e.target.offsetParent?.classList?.contains('ev-grid-column-setting')) {
701
- columnSettingInfo.isShowColumnSetting = false;
702
- contextInfo.isShowMenuOnClick = false;
703
- contextInfo.columnMenu?.hide(e);
704
- contextInfo.gridSettingMenu?.hide();
705
- }
706
- };
707
-
708
- onMounted(() => {
709
- stores.treeStore = setTreeNodeStore();
710
- stores.originStore = cloneDeep(stores.treeStore);
711
- if (props.option?.useSort) {
712
- setSortInfo(props.columns, false);
713
- } else {
714
- const contextInfoHiddenColumnMenuItems = contextInfo.hiddenColumnMenuItem;
715
- contextInfoHiddenColumnMenuItems.ascending = true;
716
- contextInfoHiddenColumnMenuItems.descending = true;
717
- }
718
- document.addEventListener('wheel', onMouseWheel, { capture: false });
719
- document.addEventListener('scroll', onMouseWheel, { capture: true });
720
- });
721
-
722
- onUnmounted(() => {
723
- document.removeEventListener('wheel', onMouseWheel, { capture: false });
724
- document.removeEventListener('scroll', onMouseWheel, { capture: true });
725
- });
726
-
727
- onActivated(() => {
728
- onResize();
729
- });
730
-
731
- watch(() => props.option?.useSort, (use) => {
732
- const propsHiddenMenuItems = props.option.hiddenColumnMenuItem;
733
- const contextInfoHiddenMenuItems = contextInfo.hiddenColumnMenuItem;
734
-
735
- if (use) {
736
- contextInfoHiddenMenuItems.ascending = propsHiddenMenuItems?.ascending ?? false;
737
- contextInfoHiddenMenuItems.descending = propsHiddenMenuItems?.descending ?? false;
738
- setSortInfo(props.columns, false);
739
- } else {
740
- contextInfoHiddenMenuItems.ascending = true;
741
- contextInfoHiddenMenuItems.descending = true;
742
- initSortInfo(props.columns);
743
- }
744
- });
745
-
746
- watch(() => columnSettingInfo.isShowColumnSetting, (isShowColumnSetting) => {
747
- if (!isShowColumnSetting) {
748
- contextInfo.gridSettingMenu?.hide();
749
- return;
750
- }
751
- setPositionColumnSetting(toolbarRef.value);
752
- });
753
-
754
- watch(
755
- () => props.columns,
756
- () => {
757
- initColumnSettingInfo();
758
- }, { deep: true, immediate: true },
759
- );
760
- watch(
761
- () => props.checked,
762
- (value) => {
763
- checkInfo.checkedRows = value;
764
- },
765
- );
766
- watch(
767
- () => checkInfo.checkedRows,
768
- (value) => {
769
- checkInfo.isHeaderChecked = false;
770
- let store = stores.store;
771
- if (pageInfo.isClientPaging) {
772
- store = getPagingData();
773
- }
774
- if (store.length) {
775
- store.forEach((row) => {
776
- row.checked = !!value.find(checkedRow => checkedRow.index === row.index);
777
- });
778
- checkHeader(store);
779
- }
780
- updateVScroll();
781
- },
782
- );
783
- watch(
784
- () => props.selected,
785
- (value) => {
786
- if (selectInfo.useSelect) {
787
- selectInfo.selectedRow = value;
788
- }
789
- },
790
- );
791
- watch(
792
- () => selectInfo.selectedRow,
793
- (value) => {
794
- if (selectInfo.useSelect) {
795
- stores.store.forEach((row) => {
796
- row.selected = !!value.find(selectedRow => selectedRow.index === row.index);
797
- });
798
- updateVScroll();
799
- }
800
- }, { deep: true },
801
- );
802
- watch(
803
- () => styleInfo.highlightIdx,
804
- async (index) => {
805
- await nextTick();
806
- const setChildShow = (data) => {
807
- if (!data?.children) {
808
- return;
809
- }
810
- const { children } = data;
811
- children.forEach((node) => {
812
- const childNode = node;
813
- if (childNode.parent.show && childNode.parent.expand) {
814
- childNode.show = true;
815
- } else {
816
- childNode.show = false;
817
- }
818
- childNode.isFilter = true;
819
- if (childNode.hasChild) {
820
- setChildShow(childNode);
821
- }
822
- });
823
- };
824
- const setParentShow = (data) => {
825
- if (!data?.parent) {
826
- setChildShow(data);
827
- return;
828
- }
829
- const { parent } = data;
830
- parent.show = true;
831
- parent.isFilter = true;
832
- parent.expand = true;
833
- setChildShow(parent);
834
- setParentShow(parent);
835
- };
836
- if (index >= 0) {
837
- const highlightNode = stores.store.find(node => node.index === index);
838
- if (!highlightNode) {
839
- return;
840
- }
841
- // highlightNode parents 자동 펼치기
842
- highlightNode.show = true;
843
- highlightNode.isFilter = true;
844
- setParentShow(highlightNode);
845
- // tree 에 보여지는 데이터 기준으로 index 다시 구하기
846
- const highlightIndex = stores.showTreeStore
847
- .map(node => node.index)
848
- .indexOf(highlightNode.index);
849
- if (pageInfo.usePage && !pageInfo.isInfinite) {
850
- const page = Math.ceil(highlightIndex / pageInfo.perPage);
851
- pageInfo.highlightPage = highlightIndex === pageInfo.perPage ? page + 1 : page || 1;
852
- // 페이지 이동
853
- if (pageInfo.highlightPage !== pageInfo.currentPage) {
854
- pageInfo.currentPage = pageInfo.highlightPage;
855
- pageInfo.isHighlight = true;
856
- return;
857
- }
858
- }
859
- elementInfo.body.scrollTop = resizeInfo.rowHeight * highlightIndex;
860
- }
861
- },
862
- );
863
- watch(
864
- () => checkInfo.useCheckbox.mode,
865
- () => {
866
- checkInfo.checkedRows = [];
867
- checkInfo.isHeaderChecked = false;
868
- },
869
- );
870
- watch(
871
- () => selectInfo.useSelect,
872
- () => {
873
- clearSelectInfo();
874
- },
875
- );
876
- watch(
877
- () => selectInfo.multiple,
878
- () => {
879
- clearSelectInfo();
880
- },
881
- );
882
- watch(
883
- () => props.rows,
884
- (newData) => {
885
- stores.treeRows = newData;
886
- stores.treeStore = setTreeNodeStore();
887
- onResize();
888
- }, { deep: true },
889
- );
890
- watch(
891
- () => stores.treeStore.length,
892
- () => {
893
- checkHeader(stores.store);
894
- },
895
- );
896
- watch(
897
- () => [props.width, props.height, props.option.columnWidth],
898
- () => {
899
- if (props.option.columnWidth != null) resizeInfo.columnWidth = props.option.columnWidth;
900
- stores.orderedColumns.map((column) => {
901
- const item = column;
902
-
903
- if (!props.columns[column.index]?.width && !item.resized) {
904
- item.width = 0;
905
- }
906
-
907
- return item;
908
- });
909
- onResize();
910
- },
911
- );
912
- watch(
913
- () => props.option.searchValue,
914
- (value) => {
915
- nextTick(() => {
916
- if (value !== undefined) {
917
- onSearch(value?.value ?? value);
918
- if (pageInfo.isClientPaging) {
919
- clearCheckInfo();
920
- clearSelectInfo();
921
- }
922
- }
923
- });
924
- }, { immediate: true },
925
- );
926
- watch(
927
- () => props.option.page?.currentPage,
928
- (value) => {
929
- const current = !value ? 1 : value;
930
- pageInfo.currentPage = !props.option.page?.isInfinite ? current : 1;
931
- }, { immediate: true },
932
- );
933
- watch(
934
- () => pageInfo.currentPage,
935
- (current, before) => {
936
- nextTick(() => {
937
- changePage(before);
938
- if (pageInfo.isClientPaging && current !== before) {
939
- clearCheckInfo();
940
- clearSelectInfo();
941
- }
942
- updateVScroll();
943
- if (current === pageInfo.highlightPage && pageInfo.isHighlight) {
944
- const highlightIndex = stores.pagingStore
945
- .map(node => node.index)
946
- .indexOf(styleInfo.highlightIdx);
947
- elementInfo.body.scrollTop = resizeInfo.rowHeight * highlightIndex;
948
- pageInfo.isHighlight = !pageInfo.isHighlight;
949
- }
950
- });
951
- },
952
- );
953
-
954
- const sortIconClass = () => ({
955
- 'column-sort__icon': true,
956
- 'column-sort__icon--asc': sortInfo.sortOrder === 'asc',
957
- 'column-sort__icon--desc': sortInfo.sortOrder === 'desc',
958
- });
959
-
960
- const gridStyle = computed(() => ({
961
- width: resizeInfo.gridWidth,
962
- height: resizeInfo.gridHeight,
963
- }));
964
- const bodyStyle = computed(() => ({
965
- 'table-body': true,
966
- stripe: styleInfo.stripeStyle,
967
- 'bottom-border': !!stores.viewStore.length,
968
- 'non-border': !!styleInfo.borderStyle,
969
- }));
970
- const gridClass = computed(() => ({
971
- table: true,
972
- 'ev-grid': true,
973
- 'ev-tree-grid': true,
974
- adjust: resizeInfo.adjust,
975
- 'non-header': !styleInfo.showHeader,
976
- 'ev-tree-grid--empty': !stores.viewStore.length,
977
- }));
978
- const headerClass = computed(() => ({
979
- 'table-header': true,
980
- 'non-border': !!styleInfo.borderStyle,
981
- }));
982
- const headerCheckboxClass = computed(() => ({
983
- column: true,
984
- 'checkbox-all': true,
985
- 'non-border': !!styleInfo.borderStyle,
986
- }));
987
- const isHeaderCheckbox = computed(() => (
988
- checkInfo.useCheckbox.use
989
- && checkInfo.useCheckbox.headerCheck
990
- && checkInfo.useCheckbox.mode !== 'single'
991
- ));
992
- const getColumnClass = (column) => {
993
- const render = isRenderer(column);
994
- return {
995
- column: true,
996
- render,
997
- 'non-border': !!styleInfo.borderStyle,
998
- [column.field]: column.field,
999
- };
1000
- };
1001
- const getColumnStyle = (column, index) => {
1002
- const render = isRenderer(column);
1003
- return {
1004
- width: `${column.width}px`,
1005
- 'min-width': render ? `${resizeInfo.rendererMinWidth}px;` : `${resizeInfo.minWidth}px`,
1006
- 'margin-right': (stores.orderedColumns.length - 1 === index
1007
- && scrollInfo.hasVerticalScrollBar
1008
- && scrollInfo.hasHorizontalScrollBar) ? `${resizeInfo.scrollWidth}px` : '0px',
1009
- 'border-right': stores.orderedColumns.length - 1 === index ? 'none' : '1px solid #CFCFCF',
1010
- };
1011
- };
1012
- const getSlotName = column => `${column}Node`;
1013
-
1014
- return {
1015
- summaryScroll,
1016
- gridStyle,
1017
- gridClass,
1018
- headerClass,
1019
- headerCheckboxClass,
1020
- isHeaderCheckbox,
1021
- bodyStyle,
1022
- useSummary,
1023
- useGridSetting,
1024
- toolbarRef,
1025
- stores,
1026
- emptyText,
1027
- ...toRefs(styleInfo),
1028
- ...toRefs(elementInfo),
1029
- ...toRefs(stores),
1030
- ...toRefs(filterInfo),
1031
- ...toRefs(scrollInfo),
1032
- ...toRefs(resizeInfo),
1033
- ...toRefs(selectInfo),
1034
- ...toRefs(checkInfo),
1035
- ...toRefs(sortInfo),
1036
- ...toRefs(contextInfo),
1037
- ...toRefs(pageInfo),
1038
- ...toRefs(columnSettingInfo),
1039
- isRenderer,
1040
- getComponentName,
1041
- getConvertValue,
1042
- getColumnIndex,
1043
- setPixelUnit,
1044
- updateVScroll,
1045
- updateHScroll,
1046
- onScroll,
1047
- calculatedColumn,
1048
- onResize,
1049
- onShow,
1050
- onColumnResize,
1051
- onRowClick,
1052
- onRowDblClick,
1053
- onCheck,
1054
- onCheckAll,
1055
- setContextMenu,
1056
- onContextMenu,
1057
- onSearch,
1058
- handleExpand,
1059
- getColumnClass,
1060
- getColumnStyle,
1061
- getSlotName,
1062
- setGridSetting,
1063
- onApplyColumn,
1064
- onColumnContextMenu,
1065
- onSort,
1066
- sortIconClass,
1067
- };
1068
- },
1069
- };
1070
- </script>
1071
-
1072
- <style lang="scss" scoped>
1073
- @import './style/treeGrid.scss';
1074
- </style>