quasar-ui-sellmate-ui-kit 3.0.3 → 3.0.4
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/.prettierrc +25 -25
- package/README.md +156 -156
- package/dist/index.common.js +2 -2
- package/dist/index.css +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/index.min.css +1 -1
- package/dist/index.rtl.css +1 -1
- package/dist/index.rtl.min.css +1 -1
- package/dist/index.umd.js +3826 -3826
- package/dist/index.umd.min.js +2 -2
- package/package.json +83 -83
- package/src/assets/icons.js +28 -28
- package/src/components/SBreadcrumbs.vue +55 -55
- package/src/components/SButton.vue +206 -206
- package/src/components/SButtonGroup.vue +41 -41
- package/src/components/SButtonToggle.vue +200 -200
- package/src/components/SCaution.vue +102 -102
- package/src/components/SCheckbox.vue +123 -123
- package/src/components/SChip.vue +99 -99
- package/src/components/SDate.vue +717 -717
- package/src/components/SDateAutoRangePicker.vue +341 -341
- package/src/components/SDatePicker.vue +472 -472
- package/src/components/SDateRange.vue +470 -470
- package/src/components/SDateRangePicker.vue +660 -660
- package/src/components/SDateTimePicker.vue +349 -349
- package/src/components/SDialog.vue +250 -250
- package/src/components/SDropdown.vue +216 -216
- package/src/components/SEditor.vue +490 -490
- package/src/components/SFilePicker.vue +207 -207
- package/src/components/SHelp.vue +146 -146
- package/src/components/SInput.vue +343 -343
- package/src/components/SInputCounter.vue +46 -46
- package/src/components/SInputNumber.vue +179 -179
- package/src/components/SList.vue +29 -29
- package/src/components/SMarkupTable.vue +141 -141
- package/src/components/SPagination.vue +266 -266
- package/src/components/SRadio.vue +78 -78
- package/src/components/SRouteTab.vue +67 -67
- package/src/components/SSelect.vue +294 -294
- package/src/components/SSelectCheckbox.vue +222 -222
- package/src/components/SSelectCustom.vue +189 -189
- package/src/components/SSelectGroupCheckbox.vue +235 -235
- package/src/components/SSelectSearch.vue +261 -261
- package/src/components/SSelectSearchAutoComplete.vue +172 -172
- package/src/components/SSelectSearchCheckbox.vue +356 -356
- package/src/components/SStringToInput.vue +66 -66
- package/src/components/STab.vue +77 -77
- package/src/components/STable.vue +425 -425
- package/src/components/STableTree.vue +210 -210
- package/src/components/STabs.vue +32 -32
- package/src/components/STimePicker.vue +159 -159
- package/src/components/SToggle.vue +68 -68
- package/src/components/STooltip.vue +209 -209
- package/src/components/SelelctItem.vue +21 -21
- package/src/components/TimePickerCard.vue +352 -352
- package/src/composables/date.js +11 -11
- package/src/composables/modelBinder.js +13 -13
- package/src/composables/table/use-navigator.js +110 -110
- package/src/composables/table/use-resizable.js +80 -80
- package/src/css/app.scss +90 -90
- package/src/css/default.scss +875 -875
- package/src/css/extends.scss +154 -154
- package/src/css/quasar.variables.scss +189 -189
- package/src/directives/Directive.js +7 -7
- package/src/index.scss +3 -3
- package/src/vue-plugin.js +91 -91
- package/tsconfig.json +35 -35
|
@@ -1,341 +1,341 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<q-input
|
|
3
|
-
dense
|
|
4
|
-
outlined
|
|
5
|
-
:class="{
|
|
6
|
-
'text-Grey_Default bg-Grey_Lighten-5': disable,
|
|
7
|
-
's-date-auto-range-picker--inside': insideLabel,
|
|
8
|
-
's-date-auto-range-picker--use-icon': useDelete,
|
|
9
|
-
}"
|
|
10
|
-
readonly
|
|
11
|
-
class="q-pa-none s-date-auto-range-picker bg-white"
|
|
12
|
-
:disable="disable"
|
|
13
|
-
@click="calendarOpen = true"
|
|
14
|
-
data-cy="autoRangeCalendar"
|
|
15
|
-
v-model="inputDate"
|
|
16
|
-
>
|
|
17
|
-
<template v-slot:before v-if="insideLabel">
|
|
18
|
-
<div
|
|
19
|
-
class="date-picker-label s-px-sm q-py-xs text-Grey_Darken-4 bg-Grey_Lighten-5"
|
|
20
|
-
:class="disable
|
|
21
|
-
? 's-border-Grey_Lighten-2'
|
|
22
|
-
: 's-border-Grey_Lighten-1'"
|
|
23
|
-
>
|
|
24
|
-
{{ insideLabel }}
|
|
25
|
-
</div>
|
|
26
|
-
</template>
|
|
27
|
-
<template v-slot:prepend>
|
|
28
|
-
<q-icon
|
|
29
|
-
:name="dateRangeIcon"
|
|
30
|
-
class="cursor-pointer q-pa-none no-hover"
|
|
31
|
-
size="20px"
|
|
32
|
-
:color="disable ? 'Grey_Default' : 'Grey_Darken-1'"
|
|
33
|
-
>
|
|
34
|
-
<q-menu v-model="calendarOpen" fit class="date-picker-range-wrapper" ref="dateMenuRef">
|
|
35
|
-
<q-date
|
|
36
|
-
v-model="dateModel.from"
|
|
37
|
-
minimal
|
|
38
|
-
square
|
|
39
|
-
color="positive"
|
|
40
|
-
class="q-pa-none"
|
|
41
|
-
mask="YYYY-MM-DD"
|
|
42
|
-
:locale="lang ? locale[lang] : {}"
|
|
43
|
-
:options="optionsStartFn"
|
|
44
|
-
@update:model-value="(value) => updateDate(value, 'from')"
|
|
45
|
-
/>
|
|
46
|
-
<q-separator vertical />
|
|
47
|
-
<q-date
|
|
48
|
-
v-model="dateModel.to"
|
|
49
|
-
minimal
|
|
50
|
-
square
|
|
51
|
-
color="positive"
|
|
52
|
-
class="q-pa-none"
|
|
53
|
-
mask="YYYY-MM-DD"
|
|
54
|
-
:locale="lang ? locale[lang] : {}"
|
|
55
|
-
:options="optionsEndFn"
|
|
56
|
-
@update:model-value="(value) => updateDate(value, 'to')"
|
|
57
|
-
>
|
|
58
|
-
<q-btn
|
|
59
|
-
class="reset-to-today-btn no-shadow no-hover"
|
|
60
|
-
unelevated
|
|
61
|
-
text-color="black"
|
|
62
|
-
label="오늘"
|
|
63
|
-
@click="resetDate"
|
|
64
|
-
/>
|
|
65
|
-
</q-date>
|
|
66
|
-
</q-menu>
|
|
67
|
-
</q-icon>
|
|
68
|
-
</template>
|
|
69
|
-
<template v-slot:default>
|
|
70
|
-
<span class="text-center date-str">{{
|
|
71
|
-
dateModel.from
|
|
72
|
-
}}</span>~<span class="text-center date-str">{{
|
|
73
|
-
dateModel.to
|
|
74
|
-
}}</span>
|
|
75
|
-
</template>
|
|
76
|
-
<template v-slot:append v-if="useDelete">
|
|
77
|
-
<q-icon
|
|
78
|
-
:name="closeIcon"
|
|
79
|
-
size="16px"
|
|
80
|
-
class="cursor-pointer"
|
|
81
|
-
@click="deleteDate"
|
|
82
|
-
data-cy="delete-icon"
|
|
83
|
-
/>
|
|
84
|
-
</template>
|
|
85
|
-
</q-input>
|
|
86
|
-
</template>
|
|
87
|
-
|
|
88
|
-
<script>
|
|
89
|
-
// @ts-check
|
|
90
|
-
import { defineComponent, ref, computed, watch } from 'vue';
|
|
91
|
-
import { QInput, QBtn, QDate, QMenu, QIcon, QSeparator, date } from 'quasar';
|
|
92
|
-
import { dateRangeIcon, closeIcon } from '../assets/icons.js';
|
|
93
|
-
|
|
94
|
-
const locale = {
|
|
95
|
-
ko: {
|
|
96
|
-
daysShort: ['일', '월', '화', '수', '목', '금', '토'],
|
|
97
|
-
months: [
|
|
98
|
-
'1월',
|
|
99
|
-
'2월',
|
|
100
|
-
'3월',
|
|
101
|
-
'4월',
|
|
102
|
-
'5월',
|
|
103
|
-
'6월',
|
|
104
|
-
'7월',
|
|
105
|
-
'8월',
|
|
106
|
-
'9월',
|
|
107
|
-
'10월',
|
|
108
|
-
'11월',
|
|
109
|
-
'12월',
|
|
110
|
-
],
|
|
111
|
-
monthsShort: [
|
|
112
|
-
'1월',
|
|
113
|
-
'2월',
|
|
114
|
-
'3월',
|
|
115
|
-
'4월',
|
|
116
|
-
'5월',
|
|
117
|
-
'6월',
|
|
118
|
-
'7월',
|
|
119
|
-
'8월',
|
|
120
|
-
'9월',
|
|
121
|
-
'10월',
|
|
122
|
-
'11월',
|
|
123
|
-
'12월',
|
|
124
|
-
],
|
|
125
|
-
},
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
export default defineComponent({
|
|
129
|
-
name: 'SDateAutoRangePicker',
|
|
130
|
-
components: {
|
|
131
|
-
QInput,
|
|
132
|
-
QBtn,
|
|
133
|
-
QDate,
|
|
134
|
-
QMenu,
|
|
135
|
-
QIcon,
|
|
136
|
-
QSeparator,
|
|
137
|
-
},
|
|
138
|
-
props: {
|
|
139
|
-
disable: {
|
|
140
|
-
type: Boolean,
|
|
141
|
-
default: false,
|
|
142
|
-
},
|
|
143
|
-
insideLabel: {
|
|
144
|
-
type: String,
|
|
145
|
-
default: '',
|
|
146
|
-
},
|
|
147
|
-
modelValue: {
|
|
148
|
-
type: Object,
|
|
149
|
-
/**
|
|
150
|
-
* @returns {{ from: null | string; to: null | string; }}
|
|
151
|
-
*/
|
|
152
|
-
default: () => ({ from: null, to: null }),
|
|
153
|
-
require: true,
|
|
154
|
-
},
|
|
155
|
-
useDelete: {
|
|
156
|
-
type: Boolean,
|
|
157
|
-
default: false,
|
|
158
|
-
},
|
|
159
|
-
lang: {
|
|
160
|
-
type: String,
|
|
161
|
-
default: 'ko',
|
|
162
|
-
},
|
|
163
|
-
dateLimit: {
|
|
164
|
-
type: [Object, Number, null],
|
|
165
|
-
/**
|
|
166
|
-
* number 일 경우, 기본 값 date
|
|
167
|
-
* @returns {null | number | { ['date' | 'month' | 'year']: number; }}
|
|
168
|
-
*/
|
|
169
|
-
default: null,
|
|
170
|
-
},
|
|
171
|
-
width: {
|
|
172
|
-
type: String,
|
|
173
|
-
default: 'fit-content',
|
|
174
|
-
},
|
|
175
|
-
},
|
|
176
|
-
setup(props, { emit }) {
|
|
177
|
-
const todayReset = date.formatDate(new Date(), 'YYYY/MM/DD');
|
|
178
|
-
|
|
179
|
-
const dateModel = ref({ from: todayReset, to: todayReset });
|
|
180
|
-
watch(() => props.modelValue, (newValue) => {
|
|
181
|
-
dateModel.value = newValue;
|
|
182
|
-
}, { immediate: true });
|
|
183
|
-
|
|
184
|
-
function resetDate() {
|
|
185
|
-
dateModel.value.from = date.formatDate(todayReset, 'YYYY-MM-DD');
|
|
186
|
-
dateModel.value.to = date.formatDate(todayReset, 'YYYY-MM-DD');
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
function deleteDate() {
|
|
190
|
-
dateModel.value = { from: null, to: null };
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
const limit = ref('');
|
|
194
|
-
function optionsStartFn() {
|
|
195
|
-
if (dateModel.value.from && props.dateLimit) {
|
|
196
|
-
limit.value = '';
|
|
197
|
-
limit.value = date.formatDate(date.addToDate(new Date(dateModel.value.from), typeof props.dateLimit === 'number'
|
|
198
|
-
? { date: props.dateLimit }
|
|
199
|
-
: props.dateLimit), 'YYYY-MM-DD');
|
|
200
|
-
}
|
|
201
|
-
return true;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
function optionsEndFn(to = '') {
|
|
205
|
-
if (!dateModel.value.from) {
|
|
206
|
-
dateModel.value.to = null;
|
|
207
|
-
return false;
|
|
208
|
-
}
|
|
209
|
-
if (!props.dateLimit) {
|
|
210
|
-
return true;
|
|
211
|
-
}
|
|
212
|
-
const formatTo = date.formatDate(to, 'YYYY-MM-DD');
|
|
213
|
-
return formatTo >= dateModel.value.from && formatTo <= limit.value;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* @param {string} model
|
|
218
|
-
* @param {'from' | 'to'} position
|
|
219
|
-
*/
|
|
220
|
-
function updateDate(model, position = 'from') {
|
|
221
|
-
dateModel.value[position] = model;
|
|
222
|
-
emit('update:modelValue', dateModel.value);
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
return {
|
|
226
|
-
dateRangeIcon,
|
|
227
|
-
closeIcon,
|
|
228
|
-
locale,
|
|
229
|
-
dateModel,
|
|
230
|
-
calendarOpen: ref(false),
|
|
231
|
-
inputDate: computed({
|
|
232
|
-
get() {
|
|
233
|
-
return `${dateModel.value.from} ~ ${dateModel.value.to}`;
|
|
234
|
-
},
|
|
235
|
-
set() {
|
|
236
|
-
return `${dateModel.value.from} ~ ${dateModel.value.to}`;
|
|
237
|
-
},
|
|
238
|
-
}),
|
|
239
|
-
dateWidth: computed(() => props.width || 'fit-content'),
|
|
240
|
-
resetDate,
|
|
241
|
-
deleteDate,
|
|
242
|
-
updateDate,
|
|
243
|
-
optionsStartFn,
|
|
244
|
-
optionsEndFn,
|
|
245
|
-
};
|
|
246
|
-
},
|
|
247
|
-
});
|
|
248
|
-
</script>
|
|
249
|
-
|
|
250
|
-
<style lang="scss">
|
|
251
|
-
@import '../css/quasar.variables.scss';
|
|
252
|
-
|
|
253
|
-
.s-date-auto-range-picker {
|
|
254
|
-
width: v-bind(dateWidth);
|
|
255
|
-
.q-field__control {
|
|
256
|
-
max-height: $default-height;
|
|
257
|
-
height: $default-height;
|
|
258
|
-
padding: 0;
|
|
259
|
-
&:before {
|
|
260
|
-
border: 1px solid $Grey_Lighten-1 !important;
|
|
261
|
-
}
|
|
262
|
-
&:after {
|
|
263
|
-
border-color: transparent !important;
|
|
264
|
-
box-shadow: none !important;
|
|
265
|
-
}
|
|
266
|
-
&:hover,
|
|
267
|
-
&:active {
|
|
268
|
-
box-sizing: none;
|
|
269
|
-
background-color: $Grey_Lighten-5;
|
|
270
|
-
}
|
|
271
|
-
.q-field__prepend {
|
|
272
|
-
padding: 0;
|
|
273
|
-
margin: 0 4px 0 8px;
|
|
274
|
-
height: 28px;
|
|
275
|
-
width: 20px;
|
|
276
|
-
}
|
|
277
|
-
&-container {
|
|
278
|
-
align-items: center;
|
|
279
|
-
padding: 0;
|
|
280
|
-
margin: 0 16px 0 8px;
|
|
281
|
-
.q-field__native {
|
|
282
|
-
display: none;
|
|
283
|
-
}
|
|
284
|
-
.date-str {
|
|
285
|
-
min-width:
|
|
286
|
-
line-height: $default-height;
|
|
287
|
-
font-size: $default-font;
|
|
288
|
-
display: block;
|
|
289
|
-
color: $Grey_Darken-4;
|
|
290
|
-
height: 100%;
|
|
291
|
-
user-select: none;
|
|
292
|
-
&:first-of-type {
|
|
293
|
-
margin-right: $between-margin-sm;
|
|
294
|
-
}
|
|
295
|
-
&:last-of-type {
|
|
296
|
-
margin-left: $between-margin-sm;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
.q-field__append {
|
|
301
|
-
height: $default-height;
|
|
302
|
-
padding: 0;
|
|
303
|
-
margin: 0 8px 0 0;
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
&.q-field--disabled {
|
|
307
|
-
.q-field__control {
|
|
308
|
-
&:before {
|
|
309
|
-
border: 1px solid $Grey_Lighten-2 !important;
|
|
310
|
-
}
|
|
311
|
-
&-container {
|
|
312
|
-
.date-str {
|
|
313
|
-
color: $Grey_Default;
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
&--inside {
|
|
319
|
-
.q-field__before {
|
|
320
|
-
height: $default-height;
|
|
321
|
-
line-height: $default-content-height;
|
|
322
|
-
padding: 0;
|
|
323
|
-
.date-picker-label {
|
|
324
|
-
border-right: none !important;
|
|
325
|
-
border-radius: $generic-border-radius 0 0 $generic-border-radius;
|
|
326
|
-
height: $default-height;
|
|
327
|
-
font-size: $default-font;
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
.q-field__control {
|
|
331
|
-
border-top-left-radius: 0;
|
|
332
|
-
border-bottom-left-radius: 0;
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
&--use-icon {
|
|
336
|
-
.q-field__control-container {
|
|
337
|
-
margin: 0 8px 0 4px;
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<q-input
|
|
3
|
+
dense
|
|
4
|
+
outlined
|
|
5
|
+
:class="{
|
|
6
|
+
'text-Grey_Default bg-Grey_Lighten-5': disable,
|
|
7
|
+
's-date-auto-range-picker--inside': insideLabel,
|
|
8
|
+
's-date-auto-range-picker--use-icon': useDelete,
|
|
9
|
+
}"
|
|
10
|
+
readonly
|
|
11
|
+
class="q-pa-none s-date-auto-range-picker bg-white"
|
|
12
|
+
:disable="disable"
|
|
13
|
+
@click="calendarOpen = true"
|
|
14
|
+
data-cy="autoRangeCalendar"
|
|
15
|
+
v-model="inputDate"
|
|
16
|
+
>
|
|
17
|
+
<template v-slot:before v-if="insideLabel">
|
|
18
|
+
<div
|
|
19
|
+
class="date-picker-label s-px-sm q-py-xs text-Grey_Darken-4 bg-Grey_Lighten-5"
|
|
20
|
+
:class="disable
|
|
21
|
+
? 's-border-Grey_Lighten-2'
|
|
22
|
+
: 's-border-Grey_Lighten-1'"
|
|
23
|
+
>
|
|
24
|
+
{{ insideLabel }}
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
27
|
+
<template v-slot:prepend>
|
|
28
|
+
<q-icon
|
|
29
|
+
:name="dateRangeIcon"
|
|
30
|
+
class="cursor-pointer q-pa-none no-hover"
|
|
31
|
+
size="20px"
|
|
32
|
+
:color="disable ? 'Grey_Default' : 'Grey_Darken-1'"
|
|
33
|
+
>
|
|
34
|
+
<q-menu v-model="calendarOpen" fit class="date-picker-range-wrapper" ref="dateMenuRef">
|
|
35
|
+
<q-date
|
|
36
|
+
v-model="dateModel.from"
|
|
37
|
+
minimal
|
|
38
|
+
square
|
|
39
|
+
color="positive"
|
|
40
|
+
class="q-pa-none"
|
|
41
|
+
mask="YYYY-MM-DD"
|
|
42
|
+
:locale="lang ? locale[lang] : {}"
|
|
43
|
+
:options="optionsStartFn"
|
|
44
|
+
@update:model-value="(value) => updateDate(value, 'from')"
|
|
45
|
+
/>
|
|
46
|
+
<q-separator vertical />
|
|
47
|
+
<q-date
|
|
48
|
+
v-model="dateModel.to"
|
|
49
|
+
minimal
|
|
50
|
+
square
|
|
51
|
+
color="positive"
|
|
52
|
+
class="q-pa-none"
|
|
53
|
+
mask="YYYY-MM-DD"
|
|
54
|
+
:locale="lang ? locale[lang] : {}"
|
|
55
|
+
:options="optionsEndFn"
|
|
56
|
+
@update:model-value="(value) => updateDate(value, 'to')"
|
|
57
|
+
>
|
|
58
|
+
<q-btn
|
|
59
|
+
class="reset-to-today-btn no-shadow no-hover"
|
|
60
|
+
unelevated
|
|
61
|
+
text-color="black"
|
|
62
|
+
label="오늘"
|
|
63
|
+
@click="resetDate"
|
|
64
|
+
/>
|
|
65
|
+
</q-date>
|
|
66
|
+
</q-menu>
|
|
67
|
+
</q-icon>
|
|
68
|
+
</template>
|
|
69
|
+
<template v-slot:default>
|
|
70
|
+
<span class="text-center date-str">{{
|
|
71
|
+
dateModel.from
|
|
72
|
+
}}</span>~<span class="text-center date-str">{{
|
|
73
|
+
dateModel.to
|
|
74
|
+
}}</span>
|
|
75
|
+
</template>
|
|
76
|
+
<template v-slot:append v-if="useDelete">
|
|
77
|
+
<q-icon
|
|
78
|
+
:name="closeIcon"
|
|
79
|
+
size="16px"
|
|
80
|
+
class="cursor-pointer"
|
|
81
|
+
@click="deleteDate"
|
|
82
|
+
data-cy="delete-icon"
|
|
83
|
+
/>
|
|
84
|
+
</template>
|
|
85
|
+
</q-input>
|
|
86
|
+
</template>
|
|
87
|
+
|
|
88
|
+
<script>
|
|
89
|
+
// @ts-check
|
|
90
|
+
import { defineComponent, ref, computed, watch } from 'vue';
|
|
91
|
+
import { QInput, QBtn, QDate, QMenu, QIcon, QSeparator, date } from 'quasar';
|
|
92
|
+
import { dateRangeIcon, closeIcon } from '../assets/icons.js';
|
|
93
|
+
|
|
94
|
+
const locale = {
|
|
95
|
+
ko: {
|
|
96
|
+
daysShort: ['일', '월', '화', '수', '목', '금', '토'],
|
|
97
|
+
months: [
|
|
98
|
+
'1월',
|
|
99
|
+
'2월',
|
|
100
|
+
'3월',
|
|
101
|
+
'4월',
|
|
102
|
+
'5월',
|
|
103
|
+
'6월',
|
|
104
|
+
'7월',
|
|
105
|
+
'8월',
|
|
106
|
+
'9월',
|
|
107
|
+
'10월',
|
|
108
|
+
'11월',
|
|
109
|
+
'12월',
|
|
110
|
+
],
|
|
111
|
+
monthsShort: [
|
|
112
|
+
'1월',
|
|
113
|
+
'2월',
|
|
114
|
+
'3월',
|
|
115
|
+
'4월',
|
|
116
|
+
'5월',
|
|
117
|
+
'6월',
|
|
118
|
+
'7월',
|
|
119
|
+
'8월',
|
|
120
|
+
'9월',
|
|
121
|
+
'10월',
|
|
122
|
+
'11월',
|
|
123
|
+
'12월',
|
|
124
|
+
],
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export default defineComponent({
|
|
129
|
+
name: 'SDateAutoRangePicker',
|
|
130
|
+
components: {
|
|
131
|
+
QInput,
|
|
132
|
+
QBtn,
|
|
133
|
+
QDate,
|
|
134
|
+
QMenu,
|
|
135
|
+
QIcon,
|
|
136
|
+
QSeparator,
|
|
137
|
+
},
|
|
138
|
+
props: {
|
|
139
|
+
disable: {
|
|
140
|
+
type: Boolean,
|
|
141
|
+
default: false,
|
|
142
|
+
},
|
|
143
|
+
insideLabel: {
|
|
144
|
+
type: String,
|
|
145
|
+
default: '',
|
|
146
|
+
},
|
|
147
|
+
modelValue: {
|
|
148
|
+
type: Object,
|
|
149
|
+
/**
|
|
150
|
+
* @returns {{ from: null | string; to: null | string; }}
|
|
151
|
+
*/
|
|
152
|
+
default: () => ({ from: null, to: null }),
|
|
153
|
+
require: true,
|
|
154
|
+
},
|
|
155
|
+
useDelete: {
|
|
156
|
+
type: Boolean,
|
|
157
|
+
default: false,
|
|
158
|
+
},
|
|
159
|
+
lang: {
|
|
160
|
+
type: String,
|
|
161
|
+
default: 'ko',
|
|
162
|
+
},
|
|
163
|
+
dateLimit: {
|
|
164
|
+
type: [Object, Number, null],
|
|
165
|
+
/**
|
|
166
|
+
* number 일 경우, 기본 값 date
|
|
167
|
+
* @returns {null | number | { ['date' | 'month' | 'year']: number; }}
|
|
168
|
+
*/
|
|
169
|
+
default: null,
|
|
170
|
+
},
|
|
171
|
+
width: {
|
|
172
|
+
type: String,
|
|
173
|
+
default: 'fit-content',
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
setup(props, { emit }) {
|
|
177
|
+
const todayReset = date.formatDate(new Date(), 'YYYY/MM/DD');
|
|
178
|
+
|
|
179
|
+
const dateModel = ref({ from: todayReset, to: todayReset });
|
|
180
|
+
watch(() => props.modelValue, (newValue) => {
|
|
181
|
+
dateModel.value = newValue;
|
|
182
|
+
}, { immediate: true });
|
|
183
|
+
|
|
184
|
+
function resetDate() {
|
|
185
|
+
dateModel.value.from = date.formatDate(todayReset, 'YYYY-MM-DD');
|
|
186
|
+
dateModel.value.to = date.formatDate(todayReset, 'YYYY-MM-DD');
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function deleteDate() {
|
|
190
|
+
dateModel.value = { from: null, to: null };
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const limit = ref('');
|
|
194
|
+
function optionsStartFn() {
|
|
195
|
+
if (dateModel.value.from && props.dateLimit) {
|
|
196
|
+
limit.value = '';
|
|
197
|
+
limit.value = date.formatDate(date.addToDate(new Date(dateModel.value.from), typeof props.dateLimit === 'number'
|
|
198
|
+
? { date: props.dateLimit }
|
|
199
|
+
: props.dateLimit), 'YYYY-MM-DD');
|
|
200
|
+
}
|
|
201
|
+
return true;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function optionsEndFn(to = '') {
|
|
205
|
+
if (!dateModel.value.from) {
|
|
206
|
+
dateModel.value.to = null;
|
|
207
|
+
return false;
|
|
208
|
+
}
|
|
209
|
+
if (!props.dateLimit) {
|
|
210
|
+
return true;
|
|
211
|
+
}
|
|
212
|
+
const formatTo = date.formatDate(to, 'YYYY-MM-DD');
|
|
213
|
+
return formatTo >= dateModel.value.from && formatTo <= limit.value;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* @param {string} model
|
|
218
|
+
* @param {'from' | 'to'} position
|
|
219
|
+
*/
|
|
220
|
+
function updateDate(model, position = 'from') {
|
|
221
|
+
dateModel.value[position] = model;
|
|
222
|
+
emit('update:modelValue', dateModel.value);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
return {
|
|
226
|
+
dateRangeIcon,
|
|
227
|
+
closeIcon,
|
|
228
|
+
locale,
|
|
229
|
+
dateModel,
|
|
230
|
+
calendarOpen: ref(false),
|
|
231
|
+
inputDate: computed({
|
|
232
|
+
get() {
|
|
233
|
+
return `${dateModel.value.from} ~ ${dateModel.value.to}`;
|
|
234
|
+
},
|
|
235
|
+
set() {
|
|
236
|
+
return `${dateModel.value.from} ~ ${dateModel.value.to}`;
|
|
237
|
+
},
|
|
238
|
+
}),
|
|
239
|
+
dateWidth: computed(() => props.width || 'fit-content'),
|
|
240
|
+
resetDate,
|
|
241
|
+
deleteDate,
|
|
242
|
+
updateDate,
|
|
243
|
+
optionsStartFn,
|
|
244
|
+
optionsEndFn,
|
|
245
|
+
};
|
|
246
|
+
},
|
|
247
|
+
});
|
|
248
|
+
</script>
|
|
249
|
+
|
|
250
|
+
<style lang="scss">
|
|
251
|
+
@import '../css/quasar.variables.scss';
|
|
252
|
+
|
|
253
|
+
.s-date-auto-range-picker {
|
|
254
|
+
width: v-bind(dateWidth);
|
|
255
|
+
.q-field__control {
|
|
256
|
+
max-height: $default-height;
|
|
257
|
+
height: $default-height;
|
|
258
|
+
padding: 0;
|
|
259
|
+
&:before {
|
|
260
|
+
border: 1px solid $Grey_Lighten-1 !important;
|
|
261
|
+
}
|
|
262
|
+
&:after {
|
|
263
|
+
border-color: transparent !important;
|
|
264
|
+
box-shadow: none !important;
|
|
265
|
+
}
|
|
266
|
+
&:hover,
|
|
267
|
+
&:active {
|
|
268
|
+
box-sizing: none;
|
|
269
|
+
background-color: $Grey_Lighten-5;
|
|
270
|
+
}
|
|
271
|
+
.q-field__prepend {
|
|
272
|
+
padding: 0;
|
|
273
|
+
margin: 0 4px 0 8px;
|
|
274
|
+
height: 28px;
|
|
275
|
+
width: 20px;
|
|
276
|
+
}
|
|
277
|
+
&-container {
|
|
278
|
+
align-items: center;
|
|
279
|
+
padding: 0;
|
|
280
|
+
margin: 0 16px 0 8px;
|
|
281
|
+
.q-field__native {
|
|
282
|
+
display: none;
|
|
283
|
+
}
|
|
284
|
+
.date-str {
|
|
285
|
+
min-width: fit-content;
|
|
286
|
+
line-height: $default-height;
|
|
287
|
+
font-size: $default-font;
|
|
288
|
+
display: block;
|
|
289
|
+
color: $Grey_Darken-4;
|
|
290
|
+
height: 100%;
|
|
291
|
+
user-select: none;
|
|
292
|
+
&:first-of-type {
|
|
293
|
+
margin-right: $between-margin-sm;
|
|
294
|
+
}
|
|
295
|
+
&:last-of-type {
|
|
296
|
+
margin-left: $between-margin-sm;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
.q-field__append {
|
|
301
|
+
height: $default-height;
|
|
302
|
+
padding: 0;
|
|
303
|
+
margin: 0 8px 0 0;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
&.q-field--disabled {
|
|
307
|
+
.q-field__control {
|
|
308
|
+
&:before {
|
|
309
|
+
border: 1px solid $Grey_Lighten-2 !important;
|
|
310
|
+
}
|
|
311
|
+
&-container {
|
|
312
|
+
.date-str {
|
|
313
|
+
color: $Grey_Default;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
&--inside {
|
|
319
|
+
.q-field__before {
|
|
320
|
+
height: $default-height;
|
|
321
|
+
line-height: $default-content-height;
|
|
322
|
+
padding: 0;
|
|
323
|
+
.date-picker-label {
|
|
324
|
+
border-right: none !important;
|
|
325
|
+
border-radius: $generic-border-radius 0 0 $generic-border-radius;
|
|
326
|
+
height: $default-height;
|
|
327
|
+
font-size: $default-font;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
.q-field__control {
|
|
331
|
+
border-top-left-radius: 0;
|
|
332
|
+
border-bottom-left-radius: 0;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
&--use-icon {
|
|
336
|
+
.q-field__control-container {
|
|
337
|
+
margin: 0 8px 0 4px;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
</style>
|