evui 3.4.206 → 3.4.208

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 +22645 -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 -63678
  9. package/dist/evui.common.js.map +0 -1
  10. package/dist/evui.umd.js +0 -63688
  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 -1655
  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,460 +0,0 @@
1
- import {
2
- ref, reactive, computed, watch,
3
- nextTick, getCurrentInstance,
4
- } from 'vue';
5
- import { getChangedValueByTimeFormat, getLastDateOfMonth } from '../calendar/uses';
6
-
7
- const dateReg = new RegExp(/[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/);
8
- const dateTimeReg = new RegExp(/[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1]) (2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9]/);
9
-
10
- export const useModel = () => {
11
- const { props, emit } = getCurrentInstance();
12
- const timeFormat = props.options?.timeFormat;
13
- const isRangeMode = ['dateTimeRange', 'dateRange', 'dateMulti'].includes(props.mode);
14
-
15
- /**
16
- * time 이 포함된 mode 인 경우 timeFormat 에 따라 값 변경
17
- * @returns {string | string[]}
18
- */
19
- const getDateTimeValue = (currValue) => {
20
- let dateTimeValue;
21
- if (props.mode === 'dateTime') {
22
- dateTimeValue = getChangedValueByTimeFormat(timeFormat, currValue);
23
- } else if (props.modelValue.length) {
24
- const [fromTimeFormat, toTimeFormat] = timeFormat;
25
- dateTimeValue = [
26
- getChangedValueByTimeFormat(fromTimeFormat, currValue[0]),
27
- getChangedValueByTimeFormat(toTimeFormat, currValue[1]),
28
- ];
29
- }
30
- return dateTimeValue;
31
- };
32
-
33
- // Select 컴포넌트의 v-model 값
34
- const mv = computed({
35
- get: () => {
36
- if (!props.modelValue) {
37
- return (props.mode === 'date' || props.mode === 'dateTime') ? '' : [];
38
- }
39
-
40
- if (['dateTime', 'dateTimeRange'].includes(props.mode) && timeFormat) {
41
- return getDateTimeValue(props.modelValue);
42
- }
43
-
44
- return isRangeMode ? [...props.modelValue] : props.modelValue;
45
- },
46
- set: (value) => {
47
- if (['dateTime', 'dateTimeRange'].includes(props.mode) && timeFormat) {
48
- emit('update:modelValue', getDateTimeValue(value));
49
- return;
50
- }
51
- emit('update:modelValue', value);
52
- },
53
- });
54
-
55
- // mode: 'date' or 'dateTime'시 input box의 입력된 텍스트값
56
- let currentValue;
57
- if (['dateTimeRange', 'dateTime'].includes(props.mode) && timeFormat) {
58
- if (props.mode === 'dateTimeRange' && Array.isArray(props.modelValue) && props.modelValue.length === 2) {
59
- const [fromDate, toDate] = props.modelValue;
60
- const [fromTimeFormat, toTimeFormat] = timeFormat;
61
-
62
- props.modelValue = [
63
- getChangedValueByTimeFormat(fromTimeFormat, fromDate),
64
- getChangedValueByTimeFormat(toTimeFormat, toDate),
65
- ];
66
- currentValue = ref([...props.modelValue]);
67
- } else if (props.mode === 'dateTime' && props.modelValue) {
68
- currentValue = ref(getChangedValueByTimeFormat(timeFormat, props.modelValue));
69
- } else {
70
- currentValue = ref(props.modelValue);
71
- }
72
- } else {
73
- currentValue = ref(isRangeMode ? [...props.modelValue] : props.modelValue);
74
- }
75
-
76
- /**
77
- * Datepicker valid 체크
78
- * @param curr
79
- */
80
- const validateValue = (curr) => {
81
- const dateRule = targetDate => !!(targetDate.length === 10 && dateReg.exec(targetDate));
82
- const dateTimeRule = targetDate => !!(targetDate.length === 19 && dateTimeReg.exec(targetDate));
83
- const checkValidDate = (targetDate) => {
84
- const dateValue = targetDate.split(' ')[0];
85
- const year = +dateValue.split('-')[0];
86
- const month = +dateValue.split('-')[1];
87
- const date = +dateValue.split('-')[2];
88
- const lastDateOfMonth = getLastDateOfMonth(year, month);
89
- return +date <= lastDateOfMonth && year >= new Date(0).getFullYear();
90
- };
91
-
92
- let isValid = true;
93
- if (props.mode === 'date') {
94
- isValid = dateRule(curr) && checkValidDate(curr);
95
- } else if (props.mode === 'dateTime') {
96
- isValid = dateTimeRule(curr) && checkValidDate(curr);
97
- } else if (props.mode === 'dateRange') {
98
- isValid = curr.every(value => dateRule(value) && checkValidDate(value));
99
- } else if (props.mode === 'dateTimeRange') {
100
- isValid = curr.every(value => dateTimeRule(value) && checkValidDate(value));
101
- }
102
-
103
- if (isValid) {
104
- mv.value = isRangeMode ? [...curr] : curr;
105
- }
106
-
107
- currentValue.value = isRangeMode ? [...mv.value] : mv.value;
108
- };
109
-
110
- // clearable 모드일 때, 항목(mv) 전체 삭제 아이콘 존재여부
111
- const isClearableIcon = computed(() => {
112
- if (props.mode === 'date' || props.mode === 'dateTime') {
113
- return mv.value;
114
- }
115
- return mv.value.length;
116
- });
117
-
118
- /**
119
- * clearable모드일 때 [x] 아이콘 클릭 시 mv값을 초기화
120
- */
121
- const removeAllMv = () => {
122
- if (props.mode === 'date' || props.mode === 'dateTime') {
123
- mv.value = null;
124
- } else {
125
- mv.value.splice(0);
126
- mv.value = [...mv.value];
127
- }
128
- };
129
-
130
- /**
131
- * mode: dateMulti, type: date인 경우 선택된 value를 mv에서 삭제하는 로직
132
- * @param val - tagWrapper에서 [x]클릭된 목록의 value
133
- */
134
- const removeMv = (val) => {
135
- if (!props.disabled) {
136
- const idx = mv.value.indexOf(val);
137
- mv.value.splice(idx, 1);
138
- mv.value = [...mv.value];
139
- }
140
- };
141
-
142
- /**
143
- * 해당 컴포넌트의 v-model값이 변경(change)되는 이벤트
144
- * @param e
145
- */
146
- const changeMv = async (e) => {
147
- await nextTick();
148
- emit('change', mv.value, e);
149
- };
150
-
151
- return {
152
- mv,
153
- currentValue,
154
- isClearableIcon,
155
- validateValue,
156
- removeAllMv,
157
- changeMv,
158
- removeMv,
159
- };
160
- };
161
-
162
- export const useDropdown = () => {
163
- const { props } = getCurrentInstance();
164
-
165
- const isDropbox = ref(false);
166
- const datePicker = ref(null);
167
- const datePickerWrapper = ref(null);
168
- const dropbox = ref(null);
169
- const itemWrapper = ref(null);
170
- const dropboxPosition = reactive({
171
- top: null,
172
- right: null,
173
- left: null,
174
- });
175
-
176
- /**
177
- * dropdown box 위치 변경하는 메소드
178
- */
179
- const changeDropboxPosition = async () => {
180
- await nextTick();
181
- const datePickerRect = datePickerWrapper.value?.getBoundingClientRect();
182
- const dropboxRect = dropbox.value?.getBoundingClientRect();
183
- const datePickerHeight = datePickerRect.height;
184
- const datePickerY = datePickerRect.y;
185
- const datePickerX = datePickerRect.x;
186
- const dropboxHeight = dropboxRect.height;
187
- const dropboxWidth = dropboxRect.width;
188
- const docHeight = document.documentElement.clientHeight;
189
- const docWidth = document.documentElement.clientWidth;
190
- if (docHeight < datePickerY + datePickerHeight + dropboxHeight) {
191
- // dropTop
192
- dropboxPosition.top = `-${dropboxHeight}px`;
193
- if (docWidth < datePickerX + dropboxWidth) {
194
- dropboxPosition.left = 'auto';
195
- dropboxPosition.right = '0px';
196
- } else {
197
- dropboxPosition.left = '0px';
198
- dropboxPosition.right = 'auto';
199
- }
200
- } else {
201
- // dropDown
202
- dropboxPosition.top = `${datePickerHeight}px`;
203
- if (docWidth < datePickerX + dropboxWidth) {
204
- dropboxPosition.left = 'auto';
205
- dropboxPosition.right = '0px';
206
- } else {
207
- dropboxPosition.left = '0px';
208
- dropboxPosition.right = 'auto';
209
- }
210
- }
211
- };
212
-
213
- /**
214
- * 인풋박스 클릭 이벤트
215
- * props로 받는 항목이 없는 경우 return처리
216
- * 인풋박스 위 클릭된 이벤트위치로 드롭박스의 사이즈, 위치를 계산
217
- */
218
- const clickSelectInput = async () => {
219
- if (!props.disabled) {
220
- isDropbox.value = props.enableTextInput ? true : !isDropbox.value;
221
- if (isDropbox.value) {
222
- await changeDropboxPosition();
223
- }
224
- }
225
- };
226
-
227
- /**
228
- * 드롭박스 외부 클릭 이벤트
229
- * filterable 모드인 경우는 필터링텍스트를 비운다.
230
- */
231
- const clickOutsideDropbox = () => {
232
- isDropbox.value = false;
233
- };
234
-
235
- return {
236
- isDropbox,
237
- datePicker,
238
- datePickerWrapper,
239
- dropbox,
240
- itemWrapper,
241
- dropboxPosition,
242
- clickSelectInput,
243
- clickOutsideDropbox,
244
- changeDropboxPosition,
245
- };
246
- };
247
-
248
- export const useShortcuts = (param) => {
249
- const { props } = getCurrentInstance();
250
- const { mv, currentValue, clickOutsideDropbox } = param;
251
-
252
- const usedShortcuts = reactive([]);
253
- props.shortcuts?.forEach(({ value, label, shortcutDate }) => {
254
- usedShortcuts.push({
255
- key: value,
256
- label,
257
- shortcutDate,
258
- isActive: false,
259
- });
260
- });
261
-
262
- /**
263
- * active 되어있는 shortcut 제거
264
- */
265
- const clearShortcuts = () => {
266
- const targetShortcut = usedShortcuts.find(shortcut => shortcut.isActive);
267
- if (targetShortcut) {
268
- targetShortcut.isActive = false;
269
- }
270
- };
271
-
272
- /**
273
- * targetKey에 해당하는 shortcut을 active
274
- * @param targetKey
275
- */
276
- const activeShortcut = (targetKey) => {
277
- const targetShortcut = usedShortcuts.find(shortcut => shortcut.key === targetKey);
278
- if (targetShortcut) {
279
- targetShortcut.isActive = true;
280
- }
281
- };
282
-
283
- /**
284
- * 월, 일을 두자리 숫자로 보정
285
- * @param num
286
- * @returns {string|*}
287
- */
288
- const lpadToTwoDigits = (num) => {
289
- if (num === null) {
290
- return '00';
291
- } else if (+num < 10) {
292
- return `0${num}`;
293
- }
294
- return num;
295
- };
296
-
297
- /**
298
- * 'YYYY-MM-DD' 형식으로 format
299
- * @param targetDate
300
- * @returns string
301
- */
302
- const formatDate = (targetDate) => {
303
- const dateValue = targetDate ? new Date(targetDate) : new Date();
304
- const year = dateValue.getFullYear();
305
- const month = dateValue.getMonth() + 1;
306
- const day = dateValue.getDate();
307
- return `${year}-${lpadToTwoDigits(month)}-${lpadToTwoDigits(day)}`;
308
- };
309
-
310
- /**
311
- * 'YYYY-MM-DD HH:mm:ss' 형식으로 format
312
- * @param targetDateTime
313
- * @returns string
314
- */
315
- const formatDateTime = (targetDateTime) => {
316
- const dateTimeValue = targetDateTime ? new Date(targetDateTime) : new Date();
317
- const hour = dateTimeValue.getHours();
318
- const min = dateTimeValue.getMinutes();
319
- const sec = dateTimeValue.getSeconds();
320
- return `${formatDate(dateTimeValue)} ${lpadToTwoDigits(hour)}:${lpadToTwoDigits(min)}:${lpadToTwoDigits(sec)}`;
321
- };
322
-
323
- /**
324
- * 초기 shortcut 세팅
325
- * 해당하는 날짜면 active
326
- */
327
- const setActiveShortcut = () => {
328
- clearShortcuts();
329
-
330
- const isRange = ['dateRange', 'dateTimeRange'].includes(props.mode);
331
-
332
- if (!usedShortcuts.length
333
- || (props.mode === 'dateMulti' && props.options?.multiType !== 'date')
334
- || (isRange && !mv.value.length)
335
- || (!isRange && !mv.value)
336
- ) {
337
- return;
338
- }
339
-
340
- let targetKey;
341
- if (isRange) {
342
- const timeFormat = props.options?.timeFormat;
343
- const [fromDate, toDate] = mv.value;
344
- let targetShortcut;
345
- if (props.mode === 'dateTimeRange' && timeFormat?.length) {
346
- targetShortcut = usedShortcuts.find(({ shortcutDate }) => {
347
- const [sFromDate, sToDate] = shortcutDate();
348
- const [fromTimeFormat, toTimeFormat] = timeFormat;
349
- const formatFromDate = getChangedValueByTimeFormat(
350
- fromTimeFormat,
351
- formatDateTime(sFromDate),
352
- );
353
- const formatToDate = getChangedValueByTimeFormat(
354
- toTimeFormat,
355
- formatDateTime(sToDate),
356
- );
357
- const isCorrectFromDate = formatFromDate === formatDateTime(fromDate);
358
- const isCorrectToDate = formatToDate === formatDateTime(toDate);
359
- return isCorrectFromDate && isCorrectToDate;
360
- });
361
- } else {
362
- targetShortcut = usedShortcuts.find(({ shortcutDate }) => {
363
- const [sFromDate, sToDate] = shortcutDate();
364
- const formatFunc = props.mode === 'dateTimeRange' ? formatDateTime : formatDate;
365
- const isCorrectFromDate = formatFunc(sFromDate) === formatFunc(fromDate);
366
- const isCorrectToDate = formatFunc(sToDate) === formatFunc(toDate);
367
- return isCorrectFromDate && isCorrectToDate;
368
- });
369
- }
370
- targetKey = targetShortcut?.key;
371
- } else {
372
- const formatFunc = props.mode === 'dateTime' ? formatDateTime : formatDate;
373
- const date = formatFunc(mv.value);
374
- const targetShortcut = usedShortcuts.find(({ shortcutDate }) => {
375
- const sDate = formatFunc(shortcutDate());
376
- return sDate === date;
377
- });
378
- targetKey = targetShortcut?.key;
379
- }
380
-
381
- if (targetKey) {
382
- activeShortcut(targetKey);
383
- }
384
- };
385
-
386
- /**
387
- * shortcut을 클릭했을 때 이벤트
388
- * @param targetKey
389
- */
390
- const clickShortcut = (targetKey) => {
391
- const isRange = ['dateRange', 'dateTimeRange'].includes(props.mode);
392
- const targetShortcut = usedShortcuts.find(({ key }) => key === targetKey);
393
-
394
- if (!targetShortcut) {
395
- return;
396
- }
397
-
398
- const shortcutDate = targetShortcut.shortcutDate;
399
- const timeFormat = props.options?.timeFormat;
400
-
401
- if (isRange) {
402
- const [fromDate, toDate] = shortcutDate();
403
- if (props.mode === 'dateTimeRange') {
404
- if (timeFormat?.length) {
405
- const [fromTimeFormat, toTimeFormat] = timeFormat;
406
-
407
- mv.value = [
408
- getChangedValueByTimeFormat(fromTimeFormat, formatDateTime(fromDate)),
409
- getChangedValueByTimeFormat(toTimeFormat, formatDateTime(toDate)),
410
- ];
411
- } else {
412
- mv.value = [formatDateTime(fromDate), formatDateTime(toDate)];
413
- }
414
- } else {
415
- mv.value = [formatDate(fromDate), formatDate(toDate)];
416
- }
417
- } else {
418
- const sDate = shortcutDate();
419
- mv.value = props.mode === 'dateTime'
420
- ? getChangedValueByTimeFormat(
421
- timeFormat,
422
- formatDateTime(sDate))
423
- : formatDate(sDate);
424
- }
425
-
426
- clearShortcuts();
427
- activeShortcut(targetKey);
428
- };
429
-
430
- watch(
431
- () => props.modelValue,
432
- (curr) => {
433
- setActiveShortcut();
434
- if (props.mode === 'dateMulti'
435
- && props?.options?.multiType === 'date'
436
- && props?.options?.multiDayLimit > curr.length
437
- ) {
438
- return;
439
- } else if (
440
- props.mode === 'dateRange'
441
- || props.mode === 'dateTimeRange'
442
- ) {
443
- currentValue.value = [...curr];
444
- return;
445
- } else if (props.mode === 'dateTime') {
446
- currentValue.value = curr;
447
- return;
448
- }
449
-
450
- currentValue.value = curr;
451
- clickOutsideDropbox();
452
- },
453
- );
454
-
455
- return {
456
- usedShortcuts,
457
- clickShortcut,
458
- setActiveShortcut,
459
- };
460
- };