evui 3.3.36 → 3.3.39
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.
- package/LICENSE +21 -21
- package/README.md +40 -40
- package/dist/evui.common.js +1907 -1832
- package/dist/evui.common.js.map +1 -1
- package/dist/evui.umd.js +1907 -1832
- package/dist/evui.umd.js.map +1 -1
- package/dist/evui.umd.min.js +1 -1
- package/dist/evui.umd.min.js.map +1 -1
- package/dist/img/{EVUI.7f3588fb.svg → EVUI.b82ee81a.svg} +292 -292
- package/dist/img/{icon_mysql.7ea26d5d.svg → icon_mysql.1085fdc9.svg} +78 -78
- package/dist/img/{icon_oracle.9009b108.svg → icon_oracle.0572d3ee.svg} +13 -13
- package/dist/img/{icon_postgresql.f8fffba9.svg → icon_postgresql.ee12bde8.svg} +58 -58
- package/package.json +61 -61
- package/src/common/emitter.js +20 -20
- package/src/common/utils.debounce.js +223 -223
- package/src/common/utils.js +134 -134
- package/src/common/utils.table.js +78 -78
- package/src/common/utils.throttle.js +83 -83
- package/src/common/utils.tree.js +18 -18
- package/src/components/button/Button.vue +198 -198
- package/src/components/button/index.js +7 -7
- package/src/components/buttonGroup/ButtonGroup.vue +11 -11
- package/src/components/buttonGroup/index.js +7 -7
- package/src/components/calendar/Calendar.vue +661 -661
- package/src/components/calendar/index.js +7 -7
- package/src/components/calendar/uses.js +1272 -1272
- package/src/components/chart/Chart.vue +189 -192
- package/src/components/chart/chart.core.js +870 -870
- package/src/components/chart/element/element.bar.js +524 -524
- package/src/components/chart/element/element.bar.time.js +156 -156
- package/src/components/chart/element/element.heatmap.js +533 -533
- package/src/components/chart/element/element.line.js +339 -339
- package/src/components/chart/element/element.pie.js +197 -197
- package/src/components/chart/element/element.scatter.js +184 -184
- package/src/components/chart/element/element.tip.js +550 -542
- package/src/components/chart/helpers/helpers.canvas.js +265 -265
- package/src/components/chart/helpers/helpers.constant.js +206 -206
- package/src/components/chart/helpers/helpers.util.js +346 -338
- package/src/components/chart/index.js +9 -9
- package/src/components/chart/model/index.js +4 -4
- package/src/components/chart/model/model.series.js +93 -93
- package/src/components/chart/model/model.store.js +977 -967
- package/src/components/chart/plugins/plugins.interaction.js +769 -769
- package/src/components/chart/plugins/plugins.legend.gradient.js +602 -602
- package/src/components/chart/plugins/plugins.legend.js +1155 -1151
- package/src/components/chart/plugins/plugins.pie.js +254 -254
- package/src/components/chart/plugins/plugins.title.js +56 -56
- package/src/components/chart/plugins/plugins.tooltip.js +692 -692
- package/src/components/chart/scale/scale.js +848 -848
- package/src/components/chart/scale/scale.linear.js +38 -38
- package/src/components/chart/scale/scale.logarithmic.js +128 -128
- package/src/components/chart/scale/scale.step.js +336 -336
- package/src/components/chart/scale/scale.time.category.js +277 -277
- package/src/components/chart/scale/scale.time.js +48 -48
- package/src/components/chart/style/chart.scss +312 -312
- package/src/components/chart/uses.js +264 -252
- package/src/components/checkbox/Checkbox.vue +200 -200
- package/src/components/checkbox/index.js +7 -7
- package/src/components/checkboxGroup/CheckboxGroup.vue +44 -44
- package/src/components/checkboxGroup/index.js +7 -7
- package/src/components/contextMenu/ContextMenu.vue +80 -80
- package/src/components/contextMenu/MenuList.vue +149 -149
- package/src/components/contextMenu/index.js +7 -7
- package/src/components/contextMenu/uses.js +203 -203
- package/src/components/datePicker/DatePicker.vue +437 -437
- package/src/components/datePicker/index.js +7 -7
- package/src/components/datePicker/uses.js +419 -419
- package/src/components/grid/Grid.vue +827 -827
- package/src/components/grid/grid.filter.window.vue +493 -493
- package/src/components/grid/grid.pagination.vue +75 -75
- package/src/components/grid/grid.summary.vue +265 -265
- package/src/components/grid/grid.toolbar.vue +26 -26
- package/src/components/grid/index.js +11 -11
- package/src/components/grid/style/grid.scss +263 -263
- package/src/components/grid/uses.js +1002 -1007
- package/src/components/icon/Icon.vue +49 -49
- package/src/components/icon/index.js +8 -8
- package/src/components/inputNumber/InputNumber.vue +212 -212
- package/src/components/inputNumber/index.js +7 -7
- package/src/components/inputNumber/uses.js +217 -217
- package/src/components/loading/Loading.vue +125 -125
- package/src/components/loading/index.js +7 -7
- package/src/components/menu/Menu.vue +68 -68
- package/src/components/menu/MenuItem.vue +187 -187
- package/src/components/menu/index.js +7 -7
- package/src/components/message/Message.vue +223 -223
- package/src/components/message/index.js +31 -31
- package/src/components/messageBox/MessageBox.vue +358 -358
- package/src/components/messageBox/index.js +22 -22
- package/src/components/notification/Notification.vue +316 -316
- package/src/components/notification/index.js +49 -49
- package/src/components/pagination/Pagination.vue +271 -271
- package/src/components/pagination/index.js +7 -7
- package/src/components/pagination/pageButton.vue +30 -30
- package/src/components/progress/Progress.vue +139 -139
- package/src/components/progress/index.js +7 -7
- package/src/components/radio/Radio.vue +159 -159
- package/src/components/radio/index.js +7 -7
- package/src/components/radioGroup/RadioGroup.vue +41 -41
- package/src/components/radioGroup/index.js +7 -7
- package/src/components/scheduler/Scheduler.vue +149 -149
- package/src/components/scheduler/index.js +7 -7
- package/src/components/scheduler/uses.js +183 -183
- package/src/components/select/Select.vue +440 -440
- package/src/components/select/index.js +7 -7
- package/src/components/select/uses.js +270 -270
- package/src/components/slider/Slider.vue +505 -505
- package/src/components/slider/index.js +7 -7
- package/src/components/slider/uses.js +390 -390
- package/src/components/tabPanel/TabPanel.vue +74 -74
- package/src/components/tabPanel/index.js +7 -7
- package/src/components/tabs/Tabs.vue +517 -517
- package/src/components/tabs/index.js +7 -7
- package/src/components/textField/TextField.vue +375 -375
- package/src/components/textField/index.js +7 -7
- package/src/components/timePicker/TimePicker.vue +352 -352
- package/src/components/timePicker/index.js +7 -7
- package/src/components/toggle/Toggle.vue +115 -115
- package/src/components/toggle/index.js +7 -7
- package/src/components/tree/Tree.vue +313 -313
- package/src/components/tree/TreeNode.vue +293 -293
- package/src/components/tree/index.js +7 -7
- package/src/components/treeGrid/TreeGrid.vue +758 -758
- package/src/components/treeGrid/TreeGridNode.vue +275 -275
- package/src/components/treeGrid/index.js +9 -9
- package/src/components/treeGrid/style/treeGrid.scss +261 -261
- package/src/components/treeGrid/treeGrid.toolbar.vue +26 -26
- package/src/components/treeGrid/uses.js +867 -867
- package/src/components/window/Window.vue +329 -329
- package/src/components/window/index.js +7 -7
- package/src/components/window/uses.js +899 -899
- package/src/directives/clickoutside.js +90 -90
- package/src/main.js +116 -116
- package/src/style/components/input.scss +108 -108
- package/src/style/functions.scss +3 -3
- package/src/style/index.scss +6 -6
- package/src/style/lib/fonts/EVUI.svg +292 -292
- package/src/style/lib/icon.css +888 -888
- package/src/style/mixins.scss +94 -94
- package/src/style/themes.scss +67 -67
- package/src/style/variables.scss +22 -22
|
@@ -1,217 +1,217 @@
|
|
|
1
|
-
import { ref, watch, onBeforeMount, getCurrentInstance } from 'vue';
|
|
2
|
-
import { getPrecision } from '@/common/utils';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* step 사용 시, up-down 및 값 입력할 때 step에 해당하는 값 반환
|
|
6
|
-
* @param val - 현재값
|
|
7
|
-
* @param { min, max, step } - 현재 컴포넌트의 최소값, 최대값, step 값
|
|
8
|
-
* - inputNumber, slider 컴포넌트 공통 사용
|
|
9
|
-
* @return number - 입력된 val에 가까운 step 값 반환
|
|
10
|
-
* */
|
|
11
|
-
export function getValueCloseToStep(val, { min, max, step }) {
|
|
12
|
-
const quotient = Math.floor((val - min) / step); // 몫
|
|
13
|
-
const remainder = (val - min) % step; // 나머지
|
|
14
|
-
const maxQuotient = Math.floor((max - min) / step);
|
|
15
|
-
const maxPrecision = Math.max(getPrecision(step), getPrecision(min));
|
|
16
|
-
let preventStep = false;
|
|
17
|
-
/**
|
|
18
|
-
* 클릭 & 드래그 & 입력한 값이 step 범위의 절반 보다 클 경우 한 스텝 위의 값
|
|
19
|
-
* 작을 경우 한 스텝 아래의 값으로 설정
|
|
20
|
-
* maxPrecision: 소수 자리수 확인
|
|
21
|
-
*/
|
|
22
|
-
let result;
|
|
23
|
-
if (maxPrecision) {
|
|
24
|
-
// 소수점 값일 경우
|
|
25
|
-
let multipleValue = +parseFloat(step * quotient).toFixed(maxPrecision);
|
|
26
|
-
result = +(multipleValue + min).toFixed(maxPrecision);
|
|
27
|
-
preventStep = quotient === maxQuotient
|
|
28
|
-
&& +(max - result).toFixed(maxPrecision) !== step;
|
|
29
|
-
|
|
30
|
-
if (remainder > (step / 2) && !preventStep) {
|
|
31
|
-
result = +(result + step).toFixed(maxPrecision);
|
|
32
|
-
}
|
|
33
|
-
if (result > max) {
|
|
34
|
-
multipleValue = +parseFloat(step * maxQuotient).toFixed(maxPrecision);
|
|
35
|
-
result = +(multipleValue + min).toFixed(maxPrecision);
|
|
36
|
-
} else if (result < min) {
|
|
37
|
-
result = min;
|
|
38
|
-
}
|
|
39
|
-
} else {
|
|
40
|
-
// 소수점 아닐 경우
|
|
41
|
-
result = (step * quotient) + min;
|
|
42
|
-
preventStep = quotient === maxQuotient && (max - result) !== step;
|
|
43
|
-
if (remainder > (step / 2) && !preventStep) {
|
|
44
|
-
result += step;
|
|
45
|
-
}
|
|
46
|
-
if (result > max) {
|
|
47
|
-
result = (step * maxQuotient) + min;
|
|
48
|
-
} else if (result < min) {
|
|
49
|
-
result = min;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return result;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export function useModel() {
|
|
57
|
-
const { props, emit } = getCurrentInstance();
|
|
58
|
-
const currentValue = ref(props.modelValue);
|
|
59
|
-
const previousValue = ref(props.modelValue);
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* 고정 소수점 사용 시, 해당하는 소수점 값 반환
|
|
63
|
-
* */
|
|
64
|
-
const getPrecisionValue = val => (
|
|
65
|
-
props.precision && (val || val === 0) ? Number(val).toFixed(props.precision) : val
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* input 값 validate
|
|
70
|
-
* @param val - input 현재 값
|
|
71
|
-
* */
|
|
72
|
-
const validateValue = (val) => {
|
|
73
|
-
let result = val;
|
|
74
|
-
|
|
75
|
-
if (!val && val !== 0) {
|
|
76
|
-
// 값이 없을 경우
|
|
77
|
-
result = props.stepStrictly ? previousValue.value : null;
|
|
78
|
-
} else if (isNaN(val)) {
|
|
79
|
-
// 숫자 아닐 경우 - 문자열 들어 왔을 경우
|
|
80
|
-
result = previousValue.value;
|
|
81
|
-
} else if (props.stepStrictly) {
|
|
82
|
-
// step 유지
|
|
83
|
-
if (props.min === -Infinity) {
|
|
84
|
-
props.min = 0;
|
|
85
|
-
}
|
|
86
|
-
result = getValueCloseToStep(val, {
|
|
87
|
-
min: props.min,
|
|
88
|
-
max: props.max,
|
|
89
|
-
step: props.step,
|
|
90
|
-
});
|
|
91
|
-
} else if ((props.min || props.min === 0)
|
|
92
|
-
&& result < props.min
|
|
93
|
-
) {
|
|
94
|
-
// 최소값보다 작을 경우
|
|
95
|
-
result = props.min;
|
|
96
|
-
} else if ((props.max || props.max === 0)
|
|
97
|
-
&& result > props.max
|
|
98
|
-
) {
|
|
99
|
-
// 최대값보다 클 경우
|
|
100
|
-
result = props.max;
|
|
101
|
-
} else {
|
|
102
|
-
result = +result;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
currentValue.value = getPrecisionValue(result);
|
|
106
|
-
previousValue.value = getPrecisionValue(result);
|
|
107
|
-
emit('update:modelValue', result);
|
|
108
|
-
emit('change', result);
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
// input 이벤트 발생 시
|
|
112
|
-
const focusInput = (e) => {
|
|
113
|
-
emit('focus', e);
|
|
114
|
-
};
|
|
115
|
-
const blurInput = (e) => {
|
|
116
|
-
emit('blur', e);
|
|
117
|
-
};
|
|
118
|
-
const changeMv = (e) => {
|
|
119
|
-
validateValue(e.target.value);
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
watch(() => props.modelValue, (curr, prev) => {
|
|
123
|
-
if (curr !== prev) {
|
|
124
|
-
currentValue.value = getPrecisionValue(curr);
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
return {
|
|
129
|
-
currentValue,
|
|
130
|
-
validateValue,
|
|
131
|
-
focusInput,
|
|
132
|
-
blurInput,
|
|
133
|
-
changeMv,
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
export function useStep(params) {
|
|
137
|
-
const { props } = getCurrentInstance();
|
|
138
|
-
const { currentValue, validateValue } = params;
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* 화살표 및 키보드 방향키 통해 값 up-down할 경우
|
|
142
|
-
* @param type - 'up', 'down'
|
|
143
|
-
* */
|
|
144
|
-
const stepValue = (type) => {
|
|
145
|
-
if (props.readonly || props.disabled) {
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
let result;
|
|
150
|
-
if (!currentValue.value && currentValue.value !== 0) {
|
|
151
|
-
result = props.min === -Infinity ? 0 : props.min;
|
|
152
|
-
} else {
|
|
153
|
-
const newValue = +currentValue.value;
|
|
154
|
-
const convertedStep = type === 'up' ? props.step : props.step * -1;
|
|
155
|
-
const maxPrecision = Math.max(getPrecision(newValue), getPrecision(props.step));
|
|
156
|
-
const squaredValue = 10 ** maxPrecision;
|
|
157
|
-
result = (Math.round(newValue * squaredValue)
|
|
158
|
-
+ Math.round(convertedStep * squaredValue)) / squaredValue;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
if (result >= props.min && result <= props.max) {
|
|
162
|
-
validateValue(result);
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
return {
|
|
167
|
-
stepValue,
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
export function useInit(params) {
|
|
171
|
-
const { props } = getCurrentInstance();
|
|
172
|
-
const { currentValue, validateValue } = params;
|
|
173
|
-
const hasMaxProps = props.max || props.max === 0;
|
|
174
|
-
const hasMinProps = props.min || props.min === 0;
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* props validate
|
|
178
|
-
* */
|
|
179
|
-
const validateProps = () => {
|
|
180
|
-
if (hasMaxProps && hasMinProps) {
|
|
181
|
-
if (props.max <= props.min) {
|
|
182
|
-
console.warn('[EVUI][InputNumber] Max value must be greater than min value.');
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
if (props.step && (props.precision || props.precision === 0)) {
|
|
187
|
-
if (getPrecision(props.step) > props.precision) {
|
|
188
|
-
console.warn('[EVUI][InputNumber] It cannot be calculated because the step is smaller than the precision setting.');
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* 초기 modelValue 값 사용자 입력 시 validate
|
|
195
|
-
* */
|
|
196
|
-
const initValue = () => {
|
|
197
|
-
let modelValue = currentValue.value;
|
|
198
|
-
|
|
199
|
-
if (isNaN(currentValue.value)) {
|
|
200
|
-
modelValue = 0;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
if (modelValue || modelValue === 0) {
|
|
204
|
-
if (hasMaxProps && modelValue > props.max) {
|
|
205
|
-
modelValue = props.max;
|
|
206
|
-
} else if (hasMinProps && modelValue < props.min) {
|
|
207
|
-
modelValue = props.min;
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
validateValue(modelValue);
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
onBeforeMount(() => {
|
|
214
|
-
validateProps();
|
|
215
|
-
initValue();
|
|
216
|
-
});
|
|
217
|
-
}
|
|
1
|
+
import { ref, watch, onBeforeMount, getCurrentInstance } from 'vue';
|
|
2
|
+
import { getPrecision } from '@/common/utils';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* step 사용 시, up-down 및 값 입력할 때 step에 해당하는 값 반환
|
|
6
|
+
* @param val - 현재값
|
|
7
|
+
* @param { min, max, step } - 현재 컴포넌트의 최소값, 최대값, step 값
|
|
8
|
+
* - inputNumber, slider 컴포넌트 공통 사용
|
|
9
|
+
* @return number - 입력된 val에 가까운 step 값 반환
|
|
10
|
+
* */
|
|
11
|
+
export function getValueCloseToStep(val, { min, max, step }) {
|
|
12
|
+
const quotient = Math.floor((val - min) / step); // 몫
|
|
13
|
+
const remainder = (val - min) % step; // 나머지
|
|
14
|
+
const maxQuotient = Math.floor((max - min) / step);
|
|
15
|
+
const maxPrecision = Math.max(getPrecision(step), getPrecision(min));
|
|
16
|
+
let preventStep = false;
|
|
17
|
+
/**
|
|
18
|
+
* 클릭 & 드래그 & 입력한 값이 step 범위의 절반 보다 클 경우 한 스텝 위의 값
|
|
19
|
+
* 작을 경우 한 스텝 아래의 값으로 설정
|
|
20
|
+
* maxPrecision: 소수 자리수 확인
|
|
21
|
+
*/
|
|
22
|
+
let result;
|
|
23
|
+
if (maxPrecision) {
|
|
24
|
+
// 소수점 값일 경우
|
|
25
|
+
let multipleValue = +parseFloat(step * quotient).toFixed(maxPrecision);
|
|
26
|
+
result = +(multipleValue + min).toFixed(maxPrecision);
|
|
27
|
+
preventStep = quotient === maxQuotient
|
|
28
|
+
&& +(max - result).toFixed(maxPrecision) !== step;
|
|
29
|
+
|
|
30
|
+
if (remainder > (step / 2) && !preventStep) {
|
|
31
|
+
result = +(result + step).toFixed(maxPrecision);
|
|
32
|
+
}
|
|
33
|
+
if (result > max) {
|
|
34
|
+
multipleValue = +parseFloat(step * maxQuotient).toFixed(maxPrecision);
|
|
35
|
+
result = +(multipleValue + min).toFixed(maxPrecision);
|
|
36
|
+
} else if (result < min) {
|
|
37
|
+
result = min;
|
|
38
|
+
}
|
|
39
|
+
} else {
|
|
40
|
+
// 소수점 아닐 경우
|
|
41
|
+
result = (step * quotient) + min;
|
|
42
|
+
preventStep = quotient === maxQuotient && (max - result) !== step;
|
|
43
|
+
if (remainder > (step / 2) && !preventStep) {
|
|
44
|
+
result += step;
|
|
45
|
+
}
|
|
46
|
+
if (result > max) {
|
|
47
|
+
result = (step * maxQuotient) + min;
|
|
48
|
+
} else if (result < min) {
|
|
49
|
+
result = min;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function useModel() {
|
|
57
|
+
const { props, emit } = getCurrentInstance();
|
|
58
|
+
const currentValue = ref(props.modelValue);
|
|
59
|
+
const previousValue = ref(props.modelValue);
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* 고정 소수점 사용 시, 해당하는 소수점 값 반환
|
|
63
|
+
* */
|
|
64
|
+
const getPrecisionValue = val => (
|
|
65
|
+
props.precision && (val || val === 0) ? Number(val).toFixed(props.precision) : val
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* input 값 validate
|
|
70
|
+
* @param val - input 현재 값
|
|
71
|
+
* */
|
|
72
|
+
const validateValue = (val) => {
|
|
73
|
+
let result = val;
|
|
74
|
+
|
|
75
|
+
if (!val && val !== 0) {
|
|
76
|
+
// 값이 없을 경우
|
|
77
|
+
result = props.stepStrictly ? previousValue.value : null;
|
|
78
|
+
} else if (isNaN(val)) {
|
|
79
|
+
// 숫자 아닐 경우 - 문자열 들어 왔을 경우
|
|
80
|
+
result = previousValue.value;
|
|
81
|
+
} else if (props.stepStrictly) {
|
|
82
|
+
// step 유지
|
|
83
|
+
if (props.min === -Infinity) {
|
|
84
|
+
props.min = 0;
|
|
85
|
+
}
|
|
86
|
+
result = getValueCloseToStep(val, {
|
|
87
|
+
min: props.min,
|
|
88
|
+
max: props.max,
|
|
89
|
+
step: props.step,
|
|
90
|
+
});
|
|
91
|
+
} else if ((props.min || props.min === 0)
|
|
92
|
+
&& result < props.min
|
|
93
|
+
) {
|
|
94
|
+
// 최소값보다 작을 경우
|
|
95
|
+
result = props.min;
|
|
96
|
+
} else if ((props.max || props.max === 0)
|
|
97
|
+
&& result > props.max
|
|
98
|
+
) {
|
|
99
|
+
// 최대값보다 클 경우
|
|
100
|
+
result = props.max;
|
|
101
|
+
} else {
|
|
102
|
+
result = +result;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
currentValue.value = getPrecisionValue(result);
|
|
106
|
+
previousValue.value = getPrecisionValue(result);
|
|
107
|
+
emit('update:modelValue', result);
|
|
108
|
+
emit('change', result);
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
// input 이벤트 발생 시
|
|
112
|
+
const focusInput = (e) => {
|
|
113
|
+
emit('focus', e);
|
|
114
|
+
};
|
|
115
|
+
const blurInput = (e) => {
|
|
116
|
+
emit('blur', e);
|
|
117
|
+
};
|
|
118
|
+
const changeMv = (e) => {
|
|
119
|
+
validateValue(e.target.value);
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
watch(() => props.modelValue, (curr, prev) => {
|
|
123
|
+
if (curr !== prev) {
|
|
124
|
+
currentValue.value = getPrecisionValue(curr);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
return {
|
|
129
|
+
currentValue,
|
|
130
|
+
validateValue,
|
|
131
|
+
focusInput,
|
|
132
|
+
blurInput,
|
|
133
|
+
changeMv,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
export function useStep(params) {
|
|
137
|
+
const { props } = getCurrentInstance();
|
|
138
|
+
const { currentValue, validateValue } = params;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* 화살표 및 키보드 방향키 통해 값 up-down할 경우
|
|
142
|
+
* @param type - 'up', 'down'
|
|
143
|
+
* */
|
|
144
|
+
const stepValue = (type) => {
|
|
145
|
+
if (props.readonly || props.disabled) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
let result;
|
|
150
|
+
if (!currentValue.value && currentValue.value !== 0) {
|
|
151
|
+
result = props.min === -Infinity ? 0 : props.min;
|
|
152
|
+
} else {
|
|
153
|
+
const newValue = +currentValue.value;
|
|
154
|
+
const convertedStep = type === 'up' ? props.step : props.step * -1;
|
|
155
|
+
const maxPrecision = Math.max(getPrecision(newValue), getPrecision(props.step));
|
|
156
|
+
const squaredValue = 10 ** maxPrecision;
|
|
157
|
+
result = (Math.round(newValue * squaredValue)
|
|
158
|
+
+ Math.round(convertedStep * squaredValue)) / squaredValue;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (result >= props.min && result <= props.max) {
|
|
162
|
+
validateValue(result);
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
return {
|
|
167
|
+
stepValue,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
export function useInit(params) {
|
|
171
|
+
const { props } = getCurrentInstance();
|
|
172
|
+
const { currentValue, validateValue } = params;
|
|
173
|
+
const hasMaxProps = props.max || props.max === 0;
|
|
174
|
+
const hasMinProps = props.min || props.min === 0;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* props validate
|
|
178
|
+
* */
|
|
179
|
+
const validateProps = () => {
|
|
180
|
+
if (hasMaxProps && hasMinProps) {
|
|
181
|
+
if (props.max <= props.min) {
|
|
182
|
+
console.warn('[EVUI][InputNumber] Max value must be greater than min value.');
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (props.step && (props.precision || props.precision === 0)) {
|
|
187
|
+
if (getPrecision(props.step) > props.precision) {
|
|
188
|
+
console.warn('[EVUI][InputNumber] It cannot be calculated because the step is smaller than the precision setting.');
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* 초기 modelValue 값 사용자 입력 시 validate
|
|
195
|
+
* */
|
|
196
|
+
const initValue = () => {
|
|
197
|
+
let modelValue = currentValue.value;
|
|
198
|
+
|
|
199
|
+
if (isNaN(currentValue.value)) {
|
|
200
|
+
modelValue = 0;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if (modelValue || modelValue === 0) {
|
|
204
|
+
if (hasMaxProps && modelValue > props.max) {
|
|
205
|
+
modelValue = props.max;
|
|
206
|
+
} else if (hasMinProps && modelValue < props.min) {
|
|
207
|
+
modelValue = props.min;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
validateValue(modelValue);
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
onBeforeMount(() => {
|
|
214
|
+
validateProps();
|
|
215
|
+
initValue();
|
|
216
|
+
});
|
|
217
|
+
}
|
|
@@ -1,125 +1,125 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<template v-if="fullscreen">
|
|
3
|
-
<teleport to="body">
|
|
4
|
-
<div
|
|
5
|
-
v-if="modelValue"
|
|
6
|
-
class="ev-loading full-screen"
|
|
7
|
-
@[`${clickEventName}`]="closeLoading"
|
|
8
|
-
>
|
|
9
|
-
<div class="ev-loading-spinner">
|
|
10
|
-
<template v-if="$slots.default">
|
|
11
|
-
<slot />
|
|
12
|
-
</template>
|
|
13
|
-
<template v-else>
|
|
14
|
-
<i
|
|
15
|
-
:class="iconClass || 'ev-icon-refresh2'"
|
|
16
|
-
class="ev-loading-icon"
|
|
17
|
-
:style="iconStyle"
|
|
18
|
-
/>
|
|
19
|
-
</template>
|
|
20
|
-
</div>
|
|
21
|
-
</div>
|
|
22
|
-
</teleport>
|
|
23
|
-
</template>
|
|
24
|
-
<template v-else>
|
|
25
|
-
<div
|
|
26
|
-
v-if="modelValue"
|
|
27
|
-
class="ev-loading"
|
|
28
|
-
@[`${clickEventName}`]="closeLoading"
|
|
29
|
-
>
|
|
30
|
-
<div class="ev-loading-spinner">
|
|
31
|
-
<template v-if="$slots.default">
|
|
32
|
-
<slot />
|
|
33
|
-
</template>
|
|
34
|
-
<template v-else>
|
|
35
|
-
<i
|
|
36
|
-
:class="iconClass || 'ev-icon-refresh2'"
|
|
37
|
-
class="ev-loading-icon"
|
|
38
|
-
:style="iconStyle"
|
|
39
|
-
/>
|
|
40
|
-
</template>
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
</template>
|
|
44
|
-
</template>
|
|
45
|
-
|
|
46
|
-
<script>
|
|
47
|
-
import { computed } from 'vue';
|
|
48
|
-
|
|
49
|
-
export default {
|
|
50
|
-
name: 'EvLoading',
|
|
51
|
-
props: {
|
|
52
|
-
modelValue: {
|
|
53
|
-
type: Boolean,
|
|
54
|
-
default: false,
|
|
55
|
-
},
|
|
56
|
-
fullscreen: {
|
|
57
|
-
type: Boolean,
|
|
58
|
-
default: false,
|
|
59
|
-
},
|
|
60
|
-
clickOutside: {
|
|
61
|
-
type: Boolean,
|
|
62
|
-
default: false,
|
|
63
|
-
},
|
|
64
|
-
iconClass: {
|
|
65
|
-
type: String,
|
|
66
|
-
default: null,
|
|
67
|
-
},
|
|
68
|
-
iconStyle: {
|
|
69
|
-
type: Object,
|
|
70
|
-
default: () => {},
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
emits: {
|
|
74
|
-
'update:modelValue': [Boolean],
|
|
75
|
-
},
|
|
76
|
-
setup(props, { emit }) {
|
|
77
|
-
const clickEventName = computed(() => (props.clickOutside ? 'click' : null));
|
|
78
|
-
|
|
79
|
-
const closeLoading = () => emit('update:modelValue', false);
|
|
80
|
-
|
|
81
|
-
return {
|
|
82
|
-
clickEventName,
|
|
83
|
-
closeLoading,
|
|
84
|
-
};
|
|
85
|
-
},
|
|
86
|
-
};
|
|
87
|
-
</script>
|
|
88
|
-
|
|
89
|
-
<style lang="scss">
|
|
90
|
-
@import '../../style/index.scss';
|
|
91
|
-
|
|
92
|
-
.ev-loading {
|
|
93
|
-
position: absolute;
|
|
94
|
-
top: 0;
|
|
95
|
-
left: 0;
|
|
96
|
-
width: 100%;
|
|
97
|
-
height: 100%;
|
|
98
|
-
background-color: #000000;
|
|
99
|
-
opacity: 0.5;
|
|
100
|
-
&.full-screen {
|
|
101
|
-
position: fixed;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
.ev-loading-spinner {
|
|
105
|
-
position: absolute;
|
|
106
|
-
top: 50%;
|
|
107
|
-
width: 100%;
|
|
108
|
-
color: #409EFF;
|
|
109
|
-
text-align: center;
|
|
110
|
-
}
|
|
111
|
-
.ev-loading-icon {
|
|
112
|
-
display: inline-block;
|
|
113
|
-
font-size: 25px;
|
|
114
|
-
animation: rotating 2s linear infinite;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
@keyframes rotating {
|
|
118
|
-
from {
|
|
119
|
-
transform: rotate(360deg);
|
|
120
|
-
}
|
|
121
|
-
to {
|
|
122
|
-
transform: rotate(0);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<template v-if="fullscreen">
|
|
3
|
+
<teleport to="body">
|
|
4
|
+
<div
|
|
5
|
+
v-if="modelValue"
|
|
6
|
+
class="ev-loading full-screen"
|
|
7
|
+
@[`${clickEventName}`]="closeLoading"
|
|
8
|
+
>
|
|
9
|
+
<div class="ev-loading-spinner">
|
|
10
|
+
<template v-if="$slots.default">
|
|
11
|
+
<slot />
|
|
12
|
+
</template>
|
|
13
|
+
<template v-else>
|
|
14
|
+
<i
|
|
15
|
+
:class="iconClass || 'ev-icon-refresh2'"
|
|
16
|
+
class="ev-loading-icon"
|
|
17
|
+
:style="iconStyle"
|
|
18
|
+
/>
|
|
19
|
+
</template>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
</teleport>
|
|
23
|
+
</template>
|
|
24
|
+
<template v-else>
|
|
25
|
+
<div
|
|
26
|
+
v-if="modelValue"
|
|
27
|
+
class="ev-loading"
|
|
28
|
+
@[`${clickEventName}`]="closeLoading"
|
|
29
|
+
>
|
|
30
|
+
<div class="ev-loading-spinner">
|
|
31
|
+
<template v-if="$slots.default">
|
|
32
|
+
<slot />
|
|
33
|
+
</template>
|
|
34
|
+
<template v-else>
|
|
35
|
+
<i
|
|
36
|
+
:class="iconClass || 'ev-icon-refresh2'"
|
|
37
|
+
class="ev-loading-icon"
|
|
38
|
+
:style="iconStyle"
|
|
39
|
+
/>
|
|
40
|
+
</template>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
</template>
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
|
+
<script>
|
|
47
|
+
import { computed } from 'vue';
|
|
48
|
+
|
|
49
|
+
export default {
|
|
50
|
+
name: 'EvLoading',
|
|
51
|
+
props: {
|
|
52
|
+
modelValue: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: false,
|
|
55
|
+
},
|
|
56
|
+
fullscreen: {
|
|
57
|
+
type: Boolean,
|
|
58
|
+
default: false,
|
|
59
|
+
},
|
|
60
|
+
clickOutside: {
|
|
61
|
+
type: Boolean,
|
|
62
|
+
default: false,
|
|
63
|
+
},
|
|
64
|
+
iconClass: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: null,
|
|
67
|
+
},
|
|
68
|
+
iconStyle: {
|
|
69
|
+
type: Object,
|
|
70
|
+
default: () => {},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
emits: {
|
|
74
|
+
'update:modelValue': [Boolean],
|
|
75
|
+
},
|
|
76
|
+
setup(props, { emit }) {
|
|
77
|
+
const clickEventName = computed(() => (props.clickOutside ? 'click' : null));
|
|
78
|
+
|
|
79
|
+
const closeLoading = () => emit('update:modelValue', false);
|
|
80
|
+
|
|
81
|
+
return {
|
|
82
|
+
clickEventName,
|
|
83
|
+
closeLoading,
|
|
84
|
+
};
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
</script>
|
|
88
|
+
|
|
89
|
+
<style lang="scss">
|
|
90
|
+
@import '../../style/index.scss';
|
|
91
|
+
|
|
92
|
+
.ev-loading {
|
|
93
|
+
position: absolute;
|
|
94
|
+
top: 0;
|
|
95
|
+
left: 0;
|
|
96
|
+
width: 100%;
|
|
97
|
+
height: 100%;
|
|
98
|
+
background-color: #000000;
|
|
99
|
+
opacity: 0.5;
|
|
100
|
+
&.full-screen {
|
|
101
|
+
position: fixed;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
.ev-loading-spinner {
|
|
105
|
+
position: absolute;
|
|
106
|
+
top: 50%;
|
|
107
|
+
width: 100%;
|
|
108
|
+
color: #409EFF;
|
|
109
|
+
text-align: center;
|
|
110
|
+
}
|
|
111
|
+
.ev-loading-icon {
|
|
112
|
+
display: inline-block;
|
|
113
|
+
font-size: 25px;
|
|
114
|
+
animation: rotating 2s linear infinite;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
@keyframes rotating {
|
|
118
|
+
from {
|
|
119
|
+
transform: rotate(360deg);
|
|
120
|
+
}
|
|
121
|
+
to {
|
|
122
|
+
transform: rotate(0);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
</style>
|