evui 2.0.8 → 2.0.10

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 (126) hide show
  1. package/README.md +27 -27
  2. package/{src/webfonts/fa-regular-400.svg → dist/82f60bd0b94a1ed68b1e6e309ce2e8c3.svg} +366 -366
  3. package/{src/webfonts/EVUI.svg → dist/91c6092c0a9164541a69045d746b9e78.svg} +183 -183
  4. package/dist/{448f2aaa315fa9dce7b2cf6ce31caed6.svg → 962a1bf31c081691065fe333d9fa8105.svg} +1518 -1518
  5. package/dist/{65363c4d55617bbeb57d8ce6dcd46099.svg → a1a749e89f578a49306ec2b055c073da.svg} +1008 -1008
  6. package/dist/evui.min.js +178 -59366
  7. package/dist/evui.min.js.gz +0 -0
  8. package/dist/evui.min.js.map +1 -1
  9. package/dist/main.css +5161 -0
  10. package/dist/main.css.gz +0 -0
  11. package/dist/main.css.map +1 -0
  12. package/package.json +125 -136
  13. package/dist/8634884f932627fc43782e6963b64ccd.svg +0 -183
  14. package/dist/b551b554a67e86a840bc80cbb8066c30.svg +0 -366
  15. package/src/code/checkbox.js +0 -12
  16. package/src/common/utils.js +0 -95
  17. package/src/common/utils.table.js +0 -78
  18. package/src/components/button/button.vue +0 -318
  19. package/src/components/button/index.js +0 -3
  20. package/src/components/chart/chart.vue +0 -354
  21. package/src/components/chart/charts/chart.bar.js +0 -334
  22. package/src/components/chart/charts/chart.base.js +0 -1075
  23. package/src/components/chart/charts/chart.line.js +0 -262
  24. package/src/components/chart/charts/chart.pie.js +0 -383
  25. package/src/components/chart/charts/chart.scatter.js +0 -349
  26. package/src/components/chart/charts/chart.sunburst.js +0 -193
  27. package/src/components/chart/core/axis/axis.js +0 -217
  28. package/src/components/chart/core/axis/axis.scale.auto.js +0 -69
  29. package/src/components/chart/core/axis/axis.scale.fixed.js +0 -65
  30. package/src/components/chart/core/axis/axis.scale.steps.js +0 -149
  31. package/src/components/chart/core/core.constant.js +0 -91
  32. package/src/components/chart/core/core.legend.js +0 -473
  33. package/src/components/chart/core/core.util.js +0 -66
  34. package/src/components/chart/core/data/data.js +0 -412
  35. package/src/components/chart/core/data/data.pie.js +0 -70
  36. package/src/components/chart/core/data/data.stack.js +0 -222
  37. package/src/components/chart/core/data/data.sunburst.js +0 -172
  38. package/src/components/chart/index.js +0 -4
  39. package/src/components/checkbox/checkbox-group.vue +0 -57
  40. package/src/components/checkbox/checkbox.vue +0 -98
  41. package/src/components/checkbox/index.js +0 -3
  42. package/src/components/checkbox-group/index.js +0 -3
  43. package/src/components/codeview/code.vue +0 -242
  44. package/src/components/datepicker/calendar.core.js +0 -1829
  45. package/src/components/datepicker/calendar.vue +0 -86
  46. package/src/components/datepicker/datepicker.vue +0 -599
  47. package/src/components/datepicker/index.js +0 -3
  48. package/src/components/icon/icon.vue +0 -31
  49. package/src/components/icon/index.js +0 -3
  50. package/src/components/input/index.js +0 -3
  51. package/src/components/input/input.number.vue +0 -440
  52. package/src/components/label/index.js +0 -3
  53. package/src/components/label/label.vue +0 -86
  54. package/src/components/loadingmask/index.js +0 -3
  55. package/src/components/loadingmask/loadingmask.vue +0 -142
  56. package/src/components/menu/index.js +0 -5
  57. package/src/components/menu/menu.context.children.vue +0 -201
  58. package/src/components/menu/menu.context.vue +0 -144
  59. package/src/components/menu/menu.nav.vue +0 -123
  60. package/src/components/radio/index.js +0 -3
  61. package/src/components/radio/radio-group.vue +0 -48
  62. package/src/components/radio/radio.vue +0 -95
  63. package/src/components/radio-group/index.js +0 -3
  64. package/src/components/selectbox/dropdown.vue +0 -174
  65. package/src/components/selectbox/index.js +0 -3
  66. package/src/components/selectbox/listbox.vue +0 -106
  67. package/src/components/selectbox/option.vue +0 -11
  68. package/src/components/selectbox/selectbox.vue +0 -465
  69. package/src/components/slider/index.js +0 -3
  70. package/src/components/slider/slider-tooltip.vue +0 -119
  71. package/src/components/slider/slider.vue +0 -483
  72. package/src/components/summary/index.js +0 -3
  73. package/src/components/summary/summary.vue +0 -138
  74. package/src/components/table/data.json +0 -1000
  75. package/src/components/table/data2.json +0 -1000
  76. package/src/components/table/index.js +0 -3
  77. package/src/components/table/table.black.css +0 -547
  78. package/src/components/table/table.filter.lite.vue +0 -170
  79. package/src/components/table/table.filter.vue +0 -112
  80. package/src/components/table/table.grey.css +0 -539
  81. package/src/components/table/table.navy.css +0 -536
  82. package/src/components/table/table.vue +0 -1382
  83. package/src/components/tabs/index.js +0 -14
  84. package/src/components/tabs/jun/tab.vue +0 -123
  85. package/src/components/tabs/jun/tabs.vue +0 -484
  86. package/src/components/tabs/tab-panel.vue +0 -39
  87. package/src/components/tabs/tabs.vue +0 -446
  88. package/src/components/textfield/index.js +0 -3
  89. package/src/components/textfield/textfield.vue +0 -381
  90. package/src/components/timepicker/index.js +0 -3
  91. package/src/components/timepicker/spinner.vue +0 -205
  92. package/src/components/timepicker/timepicker.vue +0 -492
  93. package/src/components/toggle/index.js +0 -3
  94. package/src/components/toggle/toggle.vue +0 -355
  95. package/src/components/tree/index.js +0 -7
  96. package/src/components/tree/tree.table.black.css +0 -680
  97. package/src/components/tree/tree.table.grey.css +0 -675
  98. package/src/components/tree/tree.table.vue +0 -734
  99. package/src/components/tree/tree.util.js +0 -39
  100. package/src/components/window/index.js +0 -3
  101. package/src/components/window/window.vue +0 -606
  102. package/src/images/evui_icon.png +0 -0
  103. package/src/index.js +0 -78
  104. package/src/styles/all.css +0 -5
  105. package/src/styles/codemirror.css +0 -346
  106. package/src/styles/evui.css +0 -386
  107. package/src/styles/icon.css +0 -557
  108. package/src/webfonts/EVUI.eot +0 -0
  109. package/src/webfonts/EVUI.ttf +0 -0
  110. package/src/webfonts/EVUI.woff +0 -0
  111. package/src/webfonts/NanumGothic.ttf +0 -0
  112. package/src/webfonts/NanumGothicBold.ttf +0 -0
  113. package/src/webfonts/fa-brands-400.eot +0 -0
  114. package/src/webfonts/fa-brands-400.svg +0 -1008
  115. package/src/webfonts/fa-brands-400.ttf +0 -0
  116. package/src/webfonts/fa-brands-400.woff +0 -0
  117. package/src/webfonts/fa-brands-400.woff2 +0 -0
  118. package/src/webfonts/fa-regular-400.eot +0 -0
  119. package/src/webfonts/fa-regular-400.ttf +0 -0
  120. package/src/webfonts/fa-regular-400.woff +0 -0
  121. package/src/webfonts/fa-regular-400.woff2 +0 -0
  122. package/src/webfonts/fa-solid-900.eot +0 -0
  123. package/src/webfonts/fa-solid-900.svg +0 -1518
  124. package/src/webfonts/fa-solid-900.ttf +0 -0
  125. package/src/webfonts/fa-solid-900.woff +0 -0
  126. package/src/webfonts/fa-solid-900.woff2 +0 -0
@@ -1,734 +0,0 @@
1
- <template>
2
- <div
3
- :style="{} | gridStyleFilter({width: width, height: height})"
4
- >
5
- <div
6
- ref="evuiGrid"
7
- :style="{} | gridStyleFilter({width: width, height: height})"
8
- class="evui-table-reset evui-table"
9
- >
10
- <div
11
- class="evui-grid-box"
12
- style="width:100%;height:100%;"
13
- >
14
- <div
15
- ref="evuiGridBody"
16
- class="evui-table-body"
17
- style="top: 0; bottom: 0; left: 0; right: 0;"
18
- >
19
- <div
20
- ref="evuiGridRecords"
21
- :style="{ top: `${headerHeight + 1}px` }"
22
- class="evui-table-records"
23
- @scroll="scrollColumns"
24
- >
25
- <div
26
- ref="evuiRecordsTable"
27
- >
28
- <table>
29
- <tbody>
30
- <tr>
31
- <td
32
- class="evui-table-data evui-table-data-spacer"
33
- data-col="start"
34
- style="height: 0px; width: 0px;"
35
- />
36
-
37
- <template v-for="(column, index) in originColumns">
38
- <td
39
- :key="index"
40
- :data-col="index"
41
- :style="{height: '0px', width: column.width}"
42
- class="evui-table-data"
43
- />
44
- </template>
45
- </tr>
46
-
47
- <template v-for="(row, rowIndex) in resultData">
48
- <tr
49
- :key="rowIndex"
50
- :class="(rowIndex+1)%2 !== 0 ? 'evui-odd' : 'evui-even'"
51
- :style="{height: `${rowHeight}px`}"
52
- >
53
- <td
54
- class="evui-table-data-spacer"
55
- data-col="start"
56
- style="border-right: 0"
57
- />
58
-
59
- <template
60
- v-if="!elbow"
61
- >
62
- <td
63
- v-for="(col, colIndex) in originColumns"
64
- :key="colIndex"
65
- :data-col="colIndex"
66
- :style="{ textAlign: col.recordsAlign }"
67
- class="evui-table-data"
68
- >
69
- <div
70
- v-if="col.type === 'string' && col.cellRender === null"
71
- class="evui-table-records-col"
72
- style="max-height: 20px;"
73
- >
74
- <template v-if="treeGroupColumn === col.field">
75
- <i
76
- v-for="level in row.level"
77
- :key="level"
78
- class="evui-tree-empty"
79
- />
80
- <i
81
- v-if="!row.leaf"
82
- :class="row.expend ? 'evui-tree-minus':'evui-tree-plus'"
83
- @click="toggle(row, $event)"
84
- />
85
- <i
86
- v-else
87
- class="evui-tree-empty"
88
- />
89
- </template>
90
- <div
91
- :style="{ lineHeight: `${rowHeight}px` }"
92
- class="evui-table-records-text"
93
- >
94
- {{ row.data[col.field] }}
95
- </div>
96
- </div>
97
- <div
98
- v-else
99
- :class="col.type === 'number' ? 'evui-col-number' : ''"
100
- class="evui-table-records-col"
101
- style="max-height: 20px;"
102
- v-html="cellRender(row.data[col.field], col.type, col.cellRender, row)"
103
- />
104
- </td>
105
- </template>
106
-
107
- <template
108
- v-else
109
- >
110
- <td
111
- v-for="(col, colIndex) in originColumns"
112
- :key="colIndex"
113
- :data-col="colIndex"
114
- :style="{ textAlign: col.recordsAlign }"
115
- class="evui-table-data"
116
- >
117
- <div
118
- v-if="col.type === 'string' && col.cellRender === null"
119
- class="evui-table-records-col"
120
- style="max-height: 20px;"
121
- >
122
- <template
123
- v-if="treeGroupColumn === col.field"
124
- >
125
- <i
126
- v-for="(elbow, index) in row.elbow"
127
- :key="index"
128
- :class="elbow ? 'evui-tree-elbow-line':'evui-tree-empty'"
129
- />
130
- <i
131
- v-if="!row.leaf && !row.expend"
132
- :class="row.last ?
133
- 'evui-tree-elbow-plus-end':'evui-tree-elbow-plus'"
134
- @click="toggle(row, $event)"
135
- />
136
- <i
137
- v-if="!row.leaf && row.expend"
138
- :class="row.last ?
139
- 'evui-tree-elbow-minus-end':'evui-tree-elbow-minus'"
140
- @click="toggle(row, $event)"
141
- />
142
- <i
143
- v-if="row.leaf"
144
- :class="row.last ? 'evui-tree-elbow-end':'evui-tree-elbow'"
145
- />
146
- </template>
147
- <div
148
- :style="{ lineHeight: `${rowHeight}px` }"
149
- class="evui-table-records-text"
150
- >
151
- {{ row.data[col.field] }}
152
- </div>
153
- </div>
154
- <div
155
- v-else
156
- :class="col.type === 'number' ? 'evui-col-number' : ''"
157
- class="evui-table-records-col"
158
- style="max-height: 20px;"
159
- v-html="cellRender(row.data[col.field], col.type, col.cellRender)"
160
- />
161
- </td>
162
- </template>
163
- <td
164
- class="evui-table-data-last"
165
- data-col="end"
166
- />
167
- </tr>
168
- </template>
169
-
170
- <tr
171
- style="display: none"
172
- >
173
- <td
174
- colspan="2000"
175
- class="evui-table-load-more"
176
- />
177
- </tr>
178
- </tbody>
179
- </table>
180
- </div>
181
- </div>
182
- <div
183
- ref="gridColumns"
184
- class="evui-table-columns"
185
- style=""
186
- >
187
- <table>
188
- <tbody>
189
- <tr
190
- :style="{ height: `${headerHeight}px` }"
191
- >
192
- <td
193
- class="evui-table-columns-head"
194
- data-col="start"
195
- style="border-right: 0px; width: 0px;"
196
- />
197
- <template v-for="(column, index) in originColumns">
198
- <td
199
- :key="index"
200
- :data-col="index"
201
- :style="{width: column.width}"
202
- :ref="`${column.field}_col`"
203
- class="evui-table-columns-head"
204
- @mousedown.stop.prevent="columnMove(column, index, $event)"
205
- >
206
- <div
207
- :style="{
208
- height: '25px',
209
- marginLeft: `${(parseFloat(column.width)-6)}px`
210
- }"
211
- class="evui-table-columns-resizer"
212
- @mousedown.stop.prevent="columnResize(column, index, $event)"
213
- />
214
- <div class="evui-table-col-header">
215
- <div
216
- v-if="column.sortable"
217
- :ref="`${column.field}_sort`"
218
- />
219
- {{ column.caption }}
220
- <span
221
- v-if="filter"
222
- class="fa fa-filter"
223
- style="float: right; cursor: pointer;"
224
- @mousedown="clickFilter"
225
- @mouseup.stop.prevent
226
- />
227
- </div>
228
- </td>
229
- </template>
230
- <td
231
- :style="{width: `${endColWidth}px`}"
232
- class="evui-table-columns-head evui-table-columns-head-last"
233
- data-col="end"
234
- />
235
- </tr>
236
- </tbody>
237
- </table>
238
- </div>
239
- </div>
240
- </div>
241
- </div>
242
- </div>
243
- </template>
244
- <script>
245
- import util from '@/common/utils.table';
246
- import treeUtil from '@/components/tree/tree.util';
247
- import _ from 'lodash';
248
- import '@/styles/all.css';
249
-
250
- export default {
251
- filters: {
252
- gridStyleFilter(obj, style) {
253
- const styleObj = _.defaults(obj, style);
254
- styleObj.width = util.numberToPixel(style.width);
255
- styleObj.height = util.numberToPixel(style.height);
256
-
257
- return styleObj;
258
- },
259
- },
260
-
261
- props: {
262
- width: {
263
- type: [String, Number],
264
- default: '100%',
265
- },
266
- height: {
267
- type: [String, Number],
268
- default: '100%',
269
- },
270
- virtualScroll: {
271
- type: Boolean,
272
- default: false,
273
- },
274
- filter: {
275
- type: Boolean,
276
- default: false,
277
- },
278
- columns: {
279
- type: Array,
280
- default() {
281
- return [];
282
- },
283
- },
284
- records: {
285
- type: Array,
286
- default() {
287
- return [];
288
- },
289
- },
290
- elbow: {
291
- type: Boolean,
292
- default: false,
293
- },
294
- },
295
-
296
- data() {
297
- return {
298
- // originData
299
- originData: this.records,
300
- originColumns: this.columns,
301
-
302
- // sort 관련 데이터들
303
- sortColumns: [],
304
- sortedData: [],
305
- isSort: false,
306
-
307
- // 최종 데이터 담을 곳
308
- resultData: [],
309
-
310
- // 넓이 계산용
311
- gridBoxWidth: 0,
312
- gridBoxHeight: 0,
313
- gridRecordsHeight: 0,
314
- footerHeight: 24,
315
-
316
- // 컬럼들값보다 그리드가 클때 마지막 추가 컬럼 크기
317
- endColWidth: 0,
318
- scrollBarSize: 17,
319
-
320
- // 컬럼 정보 세팅
321
- columnDefaultProperty: {
322
- min: 20,
323
- max: null,
324
- size: null,
325
- width: 0,
326
- sortable: false,
327
- recordsAlign: 'left',
328
- type: 'string',
329
- cellRender: null,
330
- },
331
- rowHeight: 20,
332
-
333
- // 가상 스크롤 관련
334
- virtualRowCount: 0,
335
- virtualTop: 0,
336
- virtualBottom: 0,
337
- prevScrollTop: 0,
338
-
339
- // 그리드가 퍼센트인지 확인용
340
- isPercentSize: false,
341
- isWidthPercent: false,
342
- isHeightPercent: false,
343
- noSizeColList: [], // size value 안한 컬럼 갯수
344
- percentColList: [],
345
- sizeColSum: 0, // 구할수 없는 size 값 빼고 합
346
-
347
- verticalScroll: false,
348
-
349
- // 이벤트 관련 flag 값
350
- resizeFlag: false,
351
-
352
- treeGroupColumn: '',
353
-
354
- headerHeight: 30,
355
- };
356
- },
357
- computed: {
358
- },
359
- created() {
360
- window.addEventListener('resize', this.draw);
361
- if (!this.treeGroupColumn && this.originColumns[0]) {
362
- this.treeGroupColumn = this.originColumns[0].field;
363
- }
364
- },
365
- mounted() {
366
- // 그리드박스 높이 너비 가져오기
367
- this.gridBoxHeight = this.$refs.evuiGrid.clientHeight;
368
- this.gridBoxWidth = this.$refs.evuiGrid.clientWidth;
369
- this.gridRecordsHeight = this.$refs.evuiGridRecords.offsetHeight;
370
- // this.sortedData = this.originData.slice();
371
-
372
- this.$nextTick(() => {
373
- if (this.virtualScroll) {
374
- this.virtualRowCount = Math.ceil(this.gridRecordsHeight / this.rowHeight) + 1;
375
- // this.s
376
- this.virtualBottom = this.virtualRowCount;
377
- this.$refs.evuiRecordsTable.style.height = `${this.originData.length * this.rowHeight}px`;
378
-
379
- this.resultData = this.originData.slice(this.virtualTop, this.virtualBottom);
380
- } else {
381
- this.resultData = treeUtil.transformTreeToArray(this.originData);
382
- }
383
-
384
- // 그리드 sizeColSum 계산 및 size 값이 없는경우 빼고 값 설정
385
- for (let ix = 0, ixLen = this.originColumns.length; ix < ixLen; ix++) {
386
- // 초기화 먼저
387
- _.defaults(this.originColumns[ix], this.columnDefaultProperty);
388
- // 컬럼 너비랑, % 값인지를 가지고 있자
389
- const colWidth = util.quantity(this.originColumns[ix].size);
390
- const isPercentValue = colWidth ? colWidth.unit === '%' : false;
391
- const min = util.quantity(this.originColumns[ix].min).value;
392
- const max = this.originColumns[ix].max ?
393
- util.quantity(this.originColumns[ix].max).value : undefined;
394
-
395
- // 숫자로 넘어올때 px 붙여주기용 이상한 값 처리등 % 값일때 처리
396
- if (isPercentValue) {
397
- const percentToPixel = Math.floor(this.gridBoxWidth * (colWidth.value / 100));
398
- this.originColumns[ix].width = `${util.checkColSize(percentToPixel, min, max)}px`;
399
- this.sizeColSum += util.checkColSize(percentToPixel, min, max);
400
- } else if (colWidth === undefined) {
401
- this.noSizeColList.push(this.originColumns[ix]); // 얕은복사 % 숫자 px도 아닐때
402
- } else {
403
- this.originColumns[ix].width = `${util.checkColSize(colWidth.value, min, max)}px`; // px 숫자일때
404
- this.sizeColSum += util.checkColSize(colWidth.value, min, max);
405
- }
406
- }
407
-
408
- this.verticalScroll = this.gridRecordsHeight < (this.resultData.length * this.rowHeight);
409
- let leftSize;
410
- if (this.verticalScroll) {
411
- leftSize = this.gridBoxWidth - this.sizeColSum - this.scrollBarSize;
412
- this.endColWidth = this.scrollBarSize;
413
- } else {
414
- leftSize = this.gridBoxWidth - this.sizeColSum;
415
- this.endColWidth = 0;
416
- }
417
-
418
-
419
- // 그리드 크기 남은공간에 size 집어 넣기 size값 없는놈들
420
- const colSize = Math.floor(leftSize / this.noSizeColList.length);
421
- if (this.noSizeColList.length > 0) {
422
- for (let ix = 0, ixLen = this.noSizeColList.length; ix < ixLen; ix++) {
423
- const min = util.quantity(this.noSizeColList[ix].min).value;
424
- const max = this.noSizeColList[ix].max ?
425
- util.quantity(this.noSizeColList[ix].max).value : undefined;
426
- const isLastIndex = (ix + 1) === ixLen;
427
- if (!isLastIndex) {
428
- leftSize -= util.checkColSize(colSize, min, max);
429
- this.noSizeColList[ix].width = `${util.checkColSize(colSize, min, max)}px`;
430
- } else {
431
- this.noSizeColList[ix].width = `${util.checkColSize(leftSize, min, max)}px`;
432
- }
433
-
434
- this.sizeColSum += util.checkColSize(colSize, min, max);
435
- }
436
- } else if (leftSize > 0) {
437
- this.endColWidth = this.gridBoxWidth - this.sizeColSum;
438
- }
439
- });
440
- },
441
- beforeDestroy() {
442
- window.removeEventListener('resize', this.draw);
443
- },
444
- methods: {
445
- columnResize(column, index, event) {
446
- // 리사이즈 이벤트 처리
447
- const vm = this;
448
- // sort랑 이벤트 충돌때문에 flag값으로 처리
449
- this.resizeFlag = true;
450
- const startOffset = util.quantity(vm.originColumns[index].width).value - event.screenX;
451
- const min = util.quantity(vm.originColumns[index].min).value;
452
- const max = vm.originColumns[index].max ?
453
- util.quantity(vm.originColumns[index].max).value : undefined;
454
-
455
- function onMouseMove(e) {
456
- e.stopPropagation();
457
- e.preventDefault();
458
- const colWidth = util.checkColSize((e.screenX + startOffset), min, max);
459
- vm.sizeColSum -= util.quantity(vm.originColumns[index].width).value;
460
- vm.sizeColSum += colWidth;
461
- vm.originColumns[index].width = `${colWidth}px`;
462
- if (vm.gridBoxWidth > vm.sizeColSum) {
463
- vm.endColWidth = vm.gridBoxWidth - vm.sizeColSum;
464
- } else if (vm.verticalScroll) {
465
- vm.endColWidth = vm.scrollBarSize;
466
- } else {
467
- vm.endColWidth = 0;
468
- }
469
- vm.$forceUpdate();
470
- }
471
-
472
- function onMouseUp(e) {
473
- e.stopPropagation();
474
- e.preventDefault();
475
- vm.resizeFlag = false;
476
- document.removeEventListener('mousemove', onMouseMove);
477
- document.removeEventListener('mouseup', onMouseUp);
478
- }
479
-
480
- document.addEventListener('mousemove', onMouseMove);
481
- document.addEventListener('mouseup', onMouseUp);
482
- },
483
- columnMove(column, index, event) {
484
- // 컬럼 무브 처리
485
- event.stopPropagation();
486
- event.preventDefault();
487
- const vm = this;
488
- const clientRect = this.$refs.evuiGrid.getBoundingClientRect();
489
- const startClientX = clientRect.left;
490
- const startClientY = clientRect.top;
491
-
492
-
493
- let colIndex; // 드랍 할 컬럼 인덱스
494
-
495
- // 컬럼 고스트 무브
496
- function moveAt(clientX, clientY) {
497
- const posX = (clientX - startClientX) + 15;
498
- const posY = (clientY - startClientY) + 20;
499
- vm.$refs.headGhost.style.cssText =
500
- `top: ${posY}px; left: ${posX}px; display: block`;
501
- }
502
-
503
- // 컬럼 배열 변경
504
- function changeColumn(dragCol, dropCol, comlumnData) {
505
- if (dragCol === dropCol) {
506
- return;
507
- }
508
- if (dragCol < dropCol) {
509
- vm.originColumns.splice(dropCol, 0, comlumnData);
510
- vm.originColumns.splice(dragCol, 1);
511
- } else {
512
- vm.originColumns.splice(dragCol, 1);
513
- vm.originColumns.splice(dropCol, 0, comlumnData);
514
- }
515
- }
516
-
517
- // 마우스 이동할때 이벤트
518
- function onMouseMove(e) {
519
- moveAt(e.clientX, e.clientY);
520
-
521
- const targetEl = e.target;
522
- if (!targetEl) {
523
- return;
524
- }
525
-
526
- const targetCol = targetEl.closest('.evui-table-columns-head');
527
-
528
- if (!targetCol) {
529
- return;
530
- }
531
-
532
-
533
- if (targetCol.getAttribute('data-col') === 'start' || targetCol.getAttribute('data-col') === 'end') {
534
- return;
535
- }
536
-
537
- colIndex = +targetCol.getAttribute('data-col');
538
-
539
- const targetColHalfWidth = targetCol.offsetWidth / 2;
540
- const targetColPoint = e.pageX - targetCol.getBoundingClientRect().x;
541
-
542
- if (targetColHalfWidth > targetColPoint) {
543
- vm.$refs.marker.style.left = `${targetCol.offsetLeft}px`;
544
- } else {
545
- vm.$refs.marker.style.left = `${targetCol.offsetLeft + targetCol.offsetWidth}px`;
546
- colIndex += 1;
547
- }
548
- }
549
-
550
- // 마우스 업 이벤트
551
- function onMouseUp(e) {
552
- e.stopPropagation();
553
- e.preventDefault();
554
- vm.$refs.headGhost.style.display = 'none';
555
- vm.$refs.marker.style.display = 'none';
556
- document.removeEventListener('mousemove', onMouseMove);
557
- document.removeEventListener('mouseup', onMouseUp, true);
558
-
559
- if (colIndex !== undefined) {
560
- changeColumn(index, colIndex, vm.originColumns[index]);
561
- }
562
- }
563
- // sort랑 이벤트 충돌을 피하기 위해
564
- this.columnTimeout = setTimeout(() => {
565
- // this.$refs.headGhost.style.display = 'block';
566
- this.$refs.marker.style.display = 'block';
567
- this.$refs.headGhost.textContent = column.caption;
568
- document.addEventListener('mousemove', onMouseMove);
569
- document.addEventListener('mouseup', onMouseUp, true);
570
- moveAt(event.clientX, event.clientY);
571
- }, 200);
572
- },
573
- scrollColumns(e) {
574
- // horizontal 스크롤용
575
- const vm = this;
576
- this.$refs.gridColumns.scrollLeft = e.currentTarget.scrollLeft;
577
-
578
- if (!this.virtualScroll) {
579
- return;
580
- }
581
- // vertical 스크롤용
582
- const scrollTop = this.$refs.evuiGridRecords.scrollTop;
583
-
584
- function onJump() {
585
- vm.virtualTop = parseInt(scrollTop / vm.rowHeight, 10);
586
- vm.virtualBottom = vm.virtualTop + vm.virtualRowCount;
587
- vm.$refs.evuiRecordsTable.style.paddingTop = `${vm.virtualTop * vm.rowHeight}px`;
588
- if (vm.isSort) {
589
- vm.resultData = vm.sortedData.slice(vm.virtualTop, vm.virtualBottom);
590
- } else if (vm.isFilter) {
591
- vm.resultData = vm.filteredData.slice(vm.virtualTop, vm.virtualBottom);
592
- } else {
593
- vm.resultData = vm.originData.slice(vm.virtualTop, vm.virtualBottom);
594
- }
595
- vm.prevScrollTop = scrollTop;
596
- }
597
-
598
- function onNearScroll() {
599
- // 현재 스크롤된양
600
- const nextTop = parseInt(scrollTop / vm.rowHeight, 10);
601
-
602
- if (vm.virtualTop !== nextTop) {
603
- vm.virtualTop = nextTop;
604
- vm.virtualBottom = vm.virtualTop + vm.virtualRowCount;
605
- }
606
- vm.$refs.evuiRecordsTable.style.paddingTop = `${vm.virtualTop * vm.rowHeight}px`;
607
- if (vm.isSort) {
608
- vm.resultData = vm.sortedData.slice(vm.virtualTop, vm.virtualBottom);
609
- } else if (vm.isFilter) {
610
- vm.resultData = vm.filteredData.slice(vm.virtualTop, vm.virtualBottom);
611
- } else {
612
- vm.resultData = vm.originData.slice(vm.virtualTop, vm.virtualBottom);
613
- }
614
- vm.prevScrollTop = scrollTop;
615
- }
616
-
617
- if (Math.abs(scrollTop - vm.prevScrollTop) > vm.gridRecordsHeight) {
618
- onJump();
619
- } else {
620
- onNearScroll();
621
- }
622
- },
623
-
624
- draw() {
625
- // 그리드박스 높이 너비 가져오기
626
- this.gridBoxHeight = this.$refs.evuiGrid.clientHeight;
627
- this.gridBoxWidth = this.$refs.evuiGrid.clientWidth;
628
- this.gridRecordsHeight = this.$refs.evuiGridRecords.offsetHeight;
629
- // 초기화
630
- this.sizeColSum = 0;
631
- this.noSizeColList = [];
632
- this.endColWidth = 0;
633
-
634
- this.resultData = treeUtil.transformTreeToArray(this.originData);
635
-
636
- // 그리드 sizeColSum 계산 및 size 값이 없는경우 빼고 값 설정
637
- for (let ix = 0, ixLen = this.originColumns.length; ix < ixLen; ix++) {
638
- // 초기화 한번 시켜주고요
639
- _.defaults(this.originColumns[ix], this.columnDefaultProperty);
640
- // 컬럼 너비랑, % 값인지를 가지고 있자
641
- const colWidth = util.quantity(this.originColumns[ix].size);
642
- const isPercentValue = colWidth ? colWidth.unit === '%' : false;
643
- const min = util.quantity(this.originColumns[ix].min).value;
644
- const max = this.originColumns[ix].max ?
645
- util.quantity(this.originColumns[ix].max).value : undefined;
646
-
647
- // 숫자로 넘어올때 px 붙여주기용 이상한 값 처리등 % 값일때 처리
648
- if (isPercentValue) {
649
- const percentToPixel = Math.floor(this.gridBoxWidth * (colWidth.value / 100));
650
- this.originColumns[ix].width = `${util.checkColSize(percentToPixel, min, max)}px`;
651
- this.sizeColSum += util.checkColSize(percentToPixel, min, max);
652
- } else if (colWidth === undefined) {
653
- this.noSizeColList.push(this.originColumns[ix]); // 얕은복사 % 숫자 px도 아닐때
654
- } else {
655
- this.originColumns[ix].width = `${util.checkColSize(colWidth.value, min, max)}px`; // px 숫자일때
656
- this.sizeColSum += util.checkColSize(colWidth.value, min, max);
657
- }
658
- }
659
-
660
- if (this.isFilter) {
661
- this.verticalScroll = this.gridRecordsHeight <
662
- (this.filteredData.length * this.rowHeight);
663
- } else {
664
- this.verticalScroll = this.gridRecordsHeight <
665
- (this.resultData.length * this.rowHeight);
666
- }
667
-
668
- let leftSize;
669
- if (this.verticalScroll) {
670
- leftSize = this.gridBoxWidth - this.sizeColSum - this.scrollBarSize;
671
- this.endColWidth = this.scrollBarSize;
672
- } else {
673
- leftSize = this.gridBoxWidth - this.sizeColSum;
674
- this.endColWidth = 0;
675
- }
676
-
677
- // 그리드 크기 남은공간에 size 집어 넣기 size값 없는놈들
678
- const colSize = Math.floor(leftSize / this.noSizeColList.length);
679
- if (this.noSizeColList.length > 0) {
680
- for (let ix = 0, ixLen = this.noSizeColList.length; ix < ixLen; ix++) {
681
- // debugger;
682
- const min = util.quantity(this.noSizeColList[ix].min).value;
683
- const max = this.noSizeColList[ix].max ?
684
- util.quantity(this.noSizeColList[ix].max).value : undefined;
685
- const isLastIndex = (ix + 1) === ixLen;
686
- if (!isLastIndex) {
687
- leftSize -= util.checkColSize(colSize, min, max);
688
- this.noSizeColList[ix].width = `${util.checkColSize(colSize, min, max)}px`;
689
- } else {
690
- this.noSizeColList[ix].width = `${util.checkColSize(leftSize, min, max)}px`;
691
- }
692
-
693
- this.sizeColSum += util.checkColSize(colSize, min, max);
694
- }
695
- } else if (leftSize > 0) {
696
- this.endColWidth = this.gridBoxWidth - this.sizeColSum;
697
- }
698
- this.$forceUpdate();
699
- },
700
- setColumns(columns) {
701
- this.originColumns = columns;
702
- if (!this.treeGroupColumn && this.originColumns[0]) {
703
- this.treeGroupColumn = this.originColumns[0].field;
704
- }
705
- },
706
- setData(data) {
707
- this.originData = data;
708
- },
709
- cellRender(value, type, cellRender, row) {
710
- if (cellRender) {
711
- return cellRender(value, row);
712
- } else if (type === 'number') {
713
- return value ? Number(value).toLocaleString() : value;
714
- }
715
- return value;
716
- },
717
- clearData() {
718
- this.originData = [];
719
- this.sortedData = [];
720
- this.filteredData = [];
721
- this.virtualRowCount = 0;
722
- this.virtualTop = 0;
723
- this.virtualBottom = 0;
724
- this.prevScrollTop = 0;
725
- },
726
- toggle(row) {
727
- const rowData = row;
728
- rowData.expend = !rowData.expend;
729
- this.resultData = treeUtil.transformTreeToArray(this.originData);
730
- },
731
- },
732
- };
733
- </script>
734
- <style scoped src="@/components/tree/tree.table.grey.css"/>