quasar-ui-sellmate-ui-kit 2.2.33 → 2.3.1
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/README.md +142 -142
- package/dist/index.common.js +3 -3
- package/dist/index.css +2 -2
- package/dist/index.esm.js +3 -3
- package/dist/index.min.css +2 -2
- package/dist/index.rtl.css +2 -2
- package/dist/index.rtl.min.css +2 -2
- package/dist/index.umd.js +3558 -3550
- package/dist/index.umd.min.js +3 -3
- package/package.json +75 -75
- package/src/components/SBreadcrumbs.vue +55 -55
- package/src/components/SButton.vue +206 -206
- package/src/components/SButtonGroup.vue +41 -41
- 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 -225
- package/src/components/SSelectCustom.vue +25 -17
- 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 +80 -80
- package/src/components/STableTree.vue +208 -208
- 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/extends.scss +154 -154
- package/src/css/quasar.variables.scss +189 -189
- package/src/index.common.js +1 -1
- package/src/index.esm.js +4 -4
- package/src/index.scss +9 -9
- package/src/index.umd.js +3 -3
- package/src/vue-plugin.js +92 -92
|
@@ -1,472 +1,472 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<q-input
|
|
3
|
-
dense
|
|
4
|
-
outlined
|
|
5
|
-
:class="{
|
|
6
|
-
's-date-picker-range': range,
|
|
7
|
-
'text-Grey_Default bg-Grey_Lighten-5': isDisable,
|
|
8
|
-
's-date-picker-inside': insideLabel,
|
|
9
|
-
}"
|
|
10
|
-
readonly
|
|
11
|
-
class="q-pa-none s-date-picker"
|
|
12
|
-
:placeholder="dateText"
|
|
13
|
-
v-model="inputDate"
|
|
14
|
-
:disable="isDisable"
|
|
15
|
-
@click="calendarOpen = true"
|
|
16
|
-
:name="name"
|
|
17
|
-
:type="type"
|
|
18
|
-
>
|
|
19
|
-
<template #before v-if="insideLabel">
|
|
20
|
-
<div class="date-picker-label">
|
|
21
|
-
{{ label }}
|
|
22
|
-
</div>
|
|
23
|
-
</template>
|
|
24
|
-
<template #prepend>
|
|
25
|
-
<div v-if="!range">
|
|
26
|
-
<q-btn
|
|
27
|
-
:icon="dateRangeIcon"
|
|
28
|
-
dense
|
|
29
|
-
:ripple="false"
|
|
30
|
-
flat
|
|
31
|
-
color="Grey_Darken-4"
|
|
32
|
-
class="q-pa-none no-hover"
|
|
33
|
-
:nativeEl="{
|
|
34
|
-
'aria-label': 'date-button'
|
|
35
|
-
}"
|
|
36
|
-
>
|
|
37
|
-
<q-menu v-model="calendarOpen" fit class="date-picker-wrapper" :offset="[12, 12]">
|
|
38
|
-
<q-date
|
|
39
|
-
v-model="dateValue"
|
|
40
|
-
color="positive"
|
|
41
|
-
minimal
|
|
42
|
-
no-unset
|
|
43
|
-
@update:modelValue="dateUpdate"
|
|
44
|
-
:options="optionsFn"
|
|
45
|
-
/>
|
|
46
|
-
</q-menu>
|
|
47
|
-
</q-btn>
|
|
48
|
-
</div>
|
|
49
|
-
<div v-else>
|
|
50
|
-
<q-btn
|
|
51
|
-
:icon="dateRangeIcon"
|
|
52
|
-
dense
|
|
53
|
-
:ripple="false"
|
|
54
|
-
flat
|
|
55
|
-
class="q-pa-none no-hover"
|
|
56
|
-
@click="clickDateIcon"
|
|
57
|
-
color="Grey_Darken-4"
|
|
58
|
-
aria-label="date-button"
|
|
59
|
-
>
|
|
60
|
-
<q-menu v-model="calendarOpen" fit class="date-picker-wrapper" :offset="[12, 12]">
|
|
61
|
-
<q-date
|
|
62
|
-
v-model="dateValue"
|
|
63
|
-
minimal
|
|
64
|
-
range
|
|
65
|
-
square
|
|
66
|
-
color="positive"
|
|
67
|
-
class="q-pa-none"
|
|
68
|
-
:options="optionsFn"
|
|
69
|
-
@range-start="getRangeStartDay"
|
|
70
|
-
@update:modelValue="dateUpdate"
|
|
71
|
-
/>
|
|
72
|
-
</q-menu>
|
|
73
|
-
</q-btn>
|
|
74
|
-
</div>
|
|
75
|
-
</template>
|
|
76
|
-
<template #append v-if="useDelete">
|
|
77
|
-
<q-icon
|
|
78
|
-
:name="closeIcon"
|
|
79
|
-
size="16px"
|
|
80
|
-
color="Grey_Lighten-1"
|
|
81
|
-
class="cursor-pointer"
|
|
82
|
-
@click="deleteDate"
|
|
83
|
-
aria-label="close-button"
|
|
84
|
-
/>
|
|
85
|
-
</template>
|
|
86
|
-
</q-input>
|
|
87
|
-
</template>
|
|
88
|
-
|
|
89
|
-
<script>
|
|
90
|
-
import { defineComponent, ref, watch } from 'vue';
|
|
91
|
-
import { QInput, QBtn, QDate, QMenu, QIcon, date } from 'quasar';
|
|
92
|
-
import { dateRangeIcon, closeIcon } from '../assets/icons.js';
|
|
93
|
-
|
|
94
|
-
export default defineComponent({
|
|
95
|
-
name: 'SDatePicker',
|
|
96
|
-
components: {
|
|
97
|
-
QInput,
|
|
98
|
-
QBtn,
|
|
99
|
-
QDate,
|
|
100
|
-
QMenu,
|
|
101
|
-
QIcon,
|
|
102
|
-
},
|
|
103
|
-
props: {
|
|
104
|
-
range: { type: Boolean, default: false },
|
|
105
|
-
isDisable: { type: Boolean, default: false },
|
|
106
|
-
insideLabel: { type: Boolean, default: false },
|
|
107
|
-
label: { type: String, default: '' },
|
|
108
|
-
name: { type: String, default: '' },
|
|
109
|
-
type: { type: String, default: 'text' },
|
|
110
|
-
modelValue: {
|
|
111
|
-
type: [String, Object],
|
|
112
|
-
required: true,
|
|
113
|
-
default: () => ({ from: '', to: '' }),
|
|
114
|
-
},
|
|
115
|
-
dateText: String,
|
|
116
|
-
subtractDate: {
|
|
117
|
-
years: Number,
|
|
118
|
-
months: Number,
|
|
119
|
-
days: Number,
|
|
120
|
-
},
|
|
121
|
-
addDate: {
|
|
122
|
-
years: Number,
|
|
123
|
-
months: Number,
|
|
124
|
-
days: Number,
|
|
125
|
-
},
|
|
126
|
-
unlimited: {
|
|
127
|
-
type: Boolean,
|
|
128
|
-
default: false,
|
|
129
|
-
},
|
|
130
|
-
afterToday: {
|
|
131
|
-
type: Boolean,
|
|
132
|
-
default: false,
|
|
133
|
-
},
|
|
134
|
-
selectableFrom: {
|
|
135
|
-
type: [String, null],
|
|
136
|
-
default: '',
|
|
137
|
-
},
|
|
138
|
-
useDelete: {
|
|
139
|
-
type: Boolean,
|
|
140
|
-
default: false,
|
|
141
|
-
},
|
|
142
|
-
},
|
|
143
|
-
setup(props, { emit }) {
|
|
144
|
-
const calendarOpen = ref(false);
|
|
145
|
-
const inputDate = ref(props.dateText);
|
|
146
|
-
watch(
|
|
147
|
-
() => props.dateText,
|
|
148
|
-
val => {
|
|
149
|
-
inputDate.value = val;
|
|
150
|
-
},
|
|
151
|
-
);
|
|
152
|
-
|
|
153
|
-
const dateValue = ref(props.modelValue);
|
|
154
|
-
function dateUpdate() {
|
|
155
|
-
if (props.range) {
|
|
156
|
-
if (typeof dateValue.value === 'string') {
|
|
157
|
-
dateValue.value = {
|
|
158
|
-
from: dateValue.value.replaceAll('/', '-'),
|
|
159
|
-
to: dateValue.value.replaceAll('/', '-'),
|
|
160
|
-
};
|
|
161
|
-
} else {
|
|
162
|
-
dateValue.value.from = date.formatDate(dateValue.value.from, 'YYYY-MM-DD');
|
|
163
|
-
dateValue.value.to = date.formatDate(dateValue.value.to, 'YYYY-MM-DD');
|
|
164
|
-
}
|
|
165
|
-
inputDate.value = `${dateValue.value.from} ~ ${dateValue.value.to}`;
|
|
166
|
-
} else {
|
|
167
|
-
dateValue.value = date.formatDate(dateValue.value, 'YYYY-MM-DD');
|
|
168
|
-
inputDate.value = dateValue.value;
|
|
169
|
-
}
|
|
170
|
-
calendarOpen.value = false;
|
|
171
|
-
emit('update:modelValue', dateValue.value);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
watch(
|
|
175
|
-
() => props.modelValue,
|
|
176
|
-
val => {
|
|
177
|
-
dateValue.value = val;
|
|
178
|
-
},
|
|
179
|
-
);
|
|
180
|
-
|
|
181
|
-
function deleteDate() {
|
|
182
|
-
inputDate.value = ' ';
|
|
183
|
-
emit('update:modelValue', '');
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
watch(
|
|
187
|
-
() => props.isDisable,
|
|
188
|
-
val => {
|
|
189
|
-
calendarOpen.value = !val;
|
|
190
|
-
inputDate.value = val ? null : inputDate.value;
|
|
191
|
-
},
|
|
192
|
-
);
|
|
193
|
-
|
|
194
|
-
const today = date.formatDate(new Date(), 'YYYY/MM/DD');
|
|
195
|
-
const startDate = ref(null);
|
|
196
|
-
function getRangeStartDay(from) {
|
|
197
|
-
startDate.value = from;
|
|
198
|
-
}
|
|
199
|
-
function optionsFn(day) {
|
|
200
|
-
// props.subtractDate : 클릭 한 날짜 이전 언제까지
|
|
201
|
-
// props.addDate : 클릭 이후 이후 날짜 언제까지
|
|
202
|
-
// 오늘 이전과 클릭 후 설정한 날짜 까지 (전, 후)
|
|
203
|
-
if (props.selectableFrom) {
|
|
204
|
-
const dayFrom = date.formatDate(props.selectableFrom, 'YYYY/MM/DD');
|
|
205
|
-
return day >= dayFrom;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
const clickDate = startDate.value
|
|
209
|
-
? `${startDate.value.year}/${startDate.value.month}/${startDate.value.day}`
|
|
210
|
-
: '';
|
|
211
|
-
if (clickDate) {
|
|
212
|
-
let dateAgo = date.subtractFromDate(clickDate, props.subtractDate);
|
|
213
|
-
dateAgo = date.addToDate(dateAgo, { days: 1 });
|
|
214
|
-
const dateLater = date.addToDate(clickDate, props.addDate);
|
|
215
|
-
const agoformatted = date.formatDate(dateAgo, 'YYYY/MM/DD');
|
|
216
|
-
const laterformatted = date.formatDate(dateLater, 'YYYY/MM/DD');
|
|
217
|
-
const todayDiff = startDate.value ? date.getDateDiff(clickDate, today) : null;
|
|
218
|
-
const laterDiff = startDate.value ? date.getDateDiff(clickDate, laterformatted) : null;
|
|
219
|
-
if (!props.unlimited && todayDiff > laterDiff) {
|
|
220
|
-
return agoformatted <= day && day <= today;
|
|
221
|
-
}
|
|
222
|
-
if (!props.unlimited && todayDiff < laterDiff) {
|
|
223
|
-
return agoformatted <= day && day < laterformatted;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
return !props.unlimited && !props.afterToday
|
|
227
|
-
? day <= today
|
|
228
|
-
: !props.unlimited && props.afterToday
|
|
229
|
-
? day >= today
|
|
230
|
-
: true;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
function getThisDayForth() {
|
|
234
|
-
// 오늘 이후의 날짜
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
function clickDateIcon() {
|
|
238
|
-
// 아이콘 클릭 시 원래 데이터 초기화
|
|
239
|
-
dateValue.value = {};
|
|
240
|
-
startDate.value = {};
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
return {
|
|
244
|
-
dateRangeIcon,
|
|
245
|
-
calendarOpen,
|
|
246
|
-
dateValue,
|
|
247
|
-
inputDate,
|
|
248
|
-
dateUpdate,
|
|
249
|
-
getRangeStartDay,
|
|
250
|
-
optionsFn,
|
|
251
|
-
clickDateIcon,
|
|
252
|
-
closeIcon,
|
|
253
|
-
getThisDayForth,
|
|
254
|
-
deleteDate,
|
|
255
|
-
};
|
|
256
|
-
},
|
|
257
|
-
});
|
|
258
|
-
</script>
|
|
259
|
-
|
|
260
|
-
<style lang="scss">
|
|
261
|
-
@import '../css/quasar.variables.scss';
|
|
262
|
-
|
|
263
|
-
.s-date-picker {
|
|
264
|
-
height: $default-height;
|
|
265
|
-
.q-field__before {
|
|
266
|
-
padding: 0;
|
|
267
|
-
}
|
|
268
|
-
.q-field__inner {
|
|
269
|
-
.q-field__control {
|
|
270
|
-
padding: 4px 8px !important;
|
|
271
|
-
align-items: center;
|
|
272
|
-
height: 100%;
|
|
273
|
-
align-items: center;
|
|
274
|
-
&:after {
|
|
275
|
-
border: 1px solid $Grey_Lighten-1;
|
|
276
|
-
box-shadow: none;
|
|
277
|
-
}
|
|
278
|
-
&:hover,
|
|
279
|
-
&:active {
|
|
280
|
-
background: $Grey_Lighten-5;
|
|
281
|
-
}
|
|
282
|
-
.q-field__prepend {
|
|
283
|
-
.q-icon {
|
|
284
|
-
width: 20px;
|
|
285
|
-
height: 20px;
|
|
286
|
-
color: $Grey_Darken-1;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
.q-field__prepend {
|
|
290
|
-
height: $default-content-height;
|
|
291
|
-
padding: 0;
|
|
292
|
-
> div {
|
|
293
|
-
min-height: 0;
|
|
294
|
-
height: 100%;
|
|
295
|
-
display: flex !important;
|
|
296
|
-
align-items: center;
|
|
297
|
-
justify-content: center;
|
|
298
|
-
.q-btn {
|
|
299
|
-
width: $default-content-size;
|
|
300
|
-
height: $default-content-size;
|
|
301
|
-
min-height: $default-content-size;
|
|
302
|
-
.q-icon {
|
|
303
|
-
font-size: $icon-size-lg;
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
&-container {
|
|
309
|
-
height: $default-content-height;
|
|
310
|
-
.q-field__native {
|
|
311
|
-
height: 100%;
|
|
312
|
-
line-height: $default-line-height;
|
|
313
|
-
text-align: center;
|
|
314
|
-
padding: 0 !important;
|
|
315
|
-
font: {
|
|
316
|
-
size: $default-font;
|
|
317
|
-
weight: $default-font-weight;
|
|
318
|
-
}
|
|
319
|
-
input::placeholder {
|
|
320
|
-
color: $Grey_Darken-4;
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
.q-field--disabled.s-date-picker {
|
|
328
|
-
color: $Grey_Default !important;
|
|
329
|
-
.q-field__inner {
|
|
330
|
-
color: $Grey_Default !important;
|
|
331
|
-
.q-field__control {
|
|
332
|
-
color: $Grey_Default !important;
|
|
333
|
-
opacity: 1 !important;
|
|
334
|
-
&:after {
|
|
335
|
-
border: 1px solid $Grey_Lighten-2;
|
|
336
|
-
}
|
|
337
|
-
.q-field__prepend {
|
|
338
|
-
opacity: 1 !important;
|
|
339
|
-
.q-icon {
|
|
340
|
-
color: $Grey_Default;
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
&-container {
|
|
344
|
-
opacity: 1 !important;
|
|
345
|
-
.q-field__native {
|
|
346
|
-
color: $Grey_Default !important;
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
&.q-field--float {
|
|
352
|
-
color: $Grey_Default !important;
|
|
353
|
-
opacity: 0.9 !important;
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
.s-date-picker-inside {
|
|
357
|
-
width: fit-content !important;
|
|
358
|
-
height: 28px;
|
|
359
|
-
.q-field__before {
|
|
360
|
-
height: 100%;
|
|
361
|
-
line-height: $default-content-height;
|
|
362
|
-
padding: 4px 12px;
|
|
363
|
-
border: 1px solid $Grey_Lighten-1;
|
|
364
|
-
background-color: $Grey_Lighten-5;
|
|
365
|
-
border-right: none;
|
|
366
|
-
border-radius: 2px 0 0 2px;
|
|
367
|
-
.date-picker-label {
|
|
368
|
-
font-size: $default-font;
|
|
369
|
-
font-weight: $default-font-weight;
|
|
370
|
-
color: $Grey_Darken-4;
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
.q-field__inner {
|
|
374
|
-
.q-field__control {
|
|
375
|
-
border-radius: 0 2px 2px 0;
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
&.q-field--disabled {
|
|
379
|
-
.q-field__before {
|
|
380
|
-
border: 1px solid $Grey_Lighten-2;
|
|
381
|
-
border-right: none;
|
|
382
|
-
.date-picker-label {
|
|
383
|
-
color: $Grey_Default;
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
.s-date-picker-range {
|
|
390
|
-
width: 226px;
|
|
391
|
-
.q-field__inner {
|
|
392
|
-
.q-field__control {
|
|
393
|
-
.q-field__prepend {
|
|
394
|
-
padding: 0;
|
|
395
|
-
}
|
|
396
|
-
&-container {
|
|
397
|
-
.q-field__native {
|
|
398
|
-
text-align: center;
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
.date-picker-wrapper.q-menu {
|
|
406
|
-
width: 290px;
|
|
407
|
-
height: 288px;
|
|
408
|
-
min-width: 0 !important;
|
|
409
|
-
min-height: 0 !important;
|
|
410
|
-
.q-date {
|
|
411
|
-
height: 288px;
|
|
412
|
-
&__main {
|
|
413
|
-
.q-date__content {
|
|
414
|
-
.q-date__view {
|
|
415
|
-
min-height: 0 !important;
|
|
416
|
-
.q-date__navigation {
|
|
417
|
-
div {
|
|
418
|
-
height: 28px;
|
|
419
|
-
.q-btn {
|
|
420
|
-
.q-icon {
|
|
421
|
-
font-size: $default-font;
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
.relative-position {
|
|
426
|
-
div {
|
|
427
|
-
.q-btn--dense {
|
|
428
|
-
padding: 0 !important;
|
|
429
|
-
.q-btn__content {
|
|
430
|
-
> span {
|
|
431
|
-
font-size: 14px;
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
.q-date__calendar-days-container {
|
|
439
|
-
.q-date__calendar-days {
|
|
440
|
-
.q-date__calendar-item {
|
|
441
|
-
.q-btn {
|
|
442
|
-
padding: 0;
|
|
443
|
-
.q-btn__content {
|
|
444
|
-
> span {
|
|
445
|
-
font-size: 14px;
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
&:hover {
|
|
449
|
-
.q-focus-helper {
|
|
450
|
-
background: $positive;
|
|
451
|
-
opacity: 1;
|
|
452
|
-
&:before,
|
|
453
|
-
&:after {
|
|
454
|
-
display: none;
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
.q-btn__content {
|
|
458
|
-
> span {
|
|
459
|
-
color: white;
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<q-input
|
|
3
|
+
dense
|
|
4
|
+
outlined
|
|
5
|
+
:class="{
|
|
6
|
+
's-date-picker-range': range,
|
|
7
|
+
'text-Grey_Default bg-Grey_Lighten-5': isDisable,
|
|
8
|
+
's-date-picker-inside': insideLabel,
|
|
9
|
+
}"
|
|
10
|
+
readonly
|
|
11
|
+
class="q-pa-none s-date-picker"
|
|
12
|
+
:placeholder="dateText"
|
|
13
|
+
v-model="inputDate"
|
|
14
|
+
:disable="isDisable"
|
|
15
|
+
@click="calendarOpen = true"
|
|
16
|
+
:name="name"
|
|
17
|
+
:type="type"
|
|
18
|
+
>
|
|
19
|
+
<template #before v-if="insideLabel">
|
|
20
|
+
<div class="date-picker-label">
|
|
21
|
+
{{ label }}
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
24
|
+
<template #prepend>
|
|
25
|
+
<div v-if="!range">
|
|
26
|
+
<q-btn
|
|
27
|
+
:icon="dateRangeIcon"
|
|
28
|
+
dense
|
|
29
|
+
:ripple="false"
|
|
30
|
+
flat
|
|
31
|
+
color="Grey_Darken-4"
|
|
32
|
+
class="q-pa-none no-hover"
|
|
33
|
+
:nativeEl="{
|
|
34
|
+
'aria-label': 'date-button'
|
|
35
|
+
}"
|
|
36
|
+
>
|
|
37
|
+
<q-menu v-model="calendarOpen" fit class="date-picker-wrapper" :offset="[12, 12]">
|
|
38
|
+
<q-date
|
|
39
|
+
v-model="dateValue"
|
|
40
|
+
color="positive"
|
|
41
|
+
minimal
|
|
42
|
+
no-unset
|
|
43
|
+
@update:modelValue="dateUpdate"
|
|
44
|
+
:options="optionsFn"
|
|
45
|
+
/>
|
|
46
|
+
</q-menu>
|
|
47
|
+
</q-btn>
|
|
48
|
+
</div>
|
|
49
|
+
<div v-else>
|
|
50
|
+
<q-btn
|
|
51
|
+
:icon="dateRangeIcon"
|
|
52
|
+
dense
|
|
53
|
+
:ripple="false"
|
|
54
|
+
flat
|
|
55
|
+
class="q-pa-none no-hover"
|
|
56
|
+
@click="clickDateIcon"
|
|
57
|
+
color="Grey_Darken-4"
|
|
58
|
+
aria-label="date-button"
|
|
59
|
+
>
|
|
60
|
+
<q-menu v-model="calendarOpen" fit class="date-picker-wrapper" :offset="[12, 12]">
|
|
61
|
+
<q-date
|
|
62
|
+
v-model="dateValue"
|
|
63
|
+
minimal
|
|
64
|
+
range
|
|
65
|
+
square
|
|
66
|
+
color="positive"
|
|
67
|
+
class="q-pa-none"
|
|
68
|
+
:options="optionsFn"
|
|
69
|
+
@range-start="getRangeStartDay"
|
|
70
|
+
@update:modelValue="dateUpdate"
|
|
71
|
+
/>
|
|
72
|
+
</q-menu>
|
|
73
|
+
</q-btn>
|
|
74
|
+
</div>
|
|
75
|
+
</template>
|
|
76
|
+
<template #append v-if="useDelete">
|
|
77
|
+
<q-icon
|
|
78
|
+
:name="closeIcon"
|
|
79
|
+
size="16px"
|
|
80
|
+
color="Grey_Lighten-1"
|
|
81
|
+
class="cursor-pointer"
|
|
82
|
+
@click="deleteDate"
|
|
83
|
+
aria-label="close-button"
|
|
84
|
+
/>
|
|
85
|
+
</template>
|
|
86
|
+
</q-input>
|
|
87
|
+
</template>
|
|
88
|
+
|
|
89
|
+
<script>
|
|
90
|
+
import { defineComponent, ref, watch } from 'vue';
|
|
91
|
+
import { QInput, QBtn, QDate, QMenu, QIcon, date } from 'quasar';
|
|
92
|
+
import { dateRangeIcon, closeIcon } from '../assets/icons.js';
|
|
93
|
+
|
|
94
|
+
export default defineComponent({
|
|
95
|
+
name: 'SDatePicker',
|
|
96
|
+
components: {
|
|
97
|
+
QInput,
|
|
98
|
+
QBtn,
|
|
99
|
+
QDate,
|
|
100
|
+
QMenu,
|
|
101
|
+
QIcon,
|
|
102
|
+
},
|
|
103
|
+
props: {
|
|
104
|
+
range: { type: Boolean, default: false },
|
|
105
|
+
isDisable: { type: Boolean, default: false },
|
|
106
|
+
insideLabel: { type: Boolean, default: false },
|
|
107
|
+
label: { type: String, default: '' },
|
|
108
|
+
name: { type: String, default: '' },
|
|
109
|
+
type: { type: String, default: 'text' },
|
|
110
|
+
modelValue: {
|
|
111
|
+
type: [String, Object],
|
|
112
|
+
required: true,
|
|
113
|
+
default: () => ({ from: '', to: '' }),
|
|
114
|
+
},
|
|
115
|
+
dateText: String,
|
|
116
|
+
subtractDate: {
|
|
117
|
+
years: Number,
|
|
118
|
+
months: Number,
|
|
119
|
+
days: Number,
|
|
120
|
+
},
|
|
121
|
+
addDate: {
|
|
122
|
+
years: Number,
|
|
123
|
+
months: Number,
|
|
124
|
+
days: Number,
|
|
125
|
+
},
|
|
126
|
+
unlimited: {
|
|
127
|
+
type: Boolean,
|
|
128
|
+
default: false,
|
|
129
|
+
},
|
|
130
|
+
afterToday: {
|
|
131
|
+
type: Boolean,
|
|
132
|
+
default: false,
|
|
133
|
+
},
|
|
134
|
+
selectableFrom: {
|
|
135
|
+
type: [String, null],
|
|
136
|
+
default: '',
|
|
137
|
+
},
|
|
138
|
+
useDelete: {
|
|
139
|
+
type: Boolean,
|
|
140
|
+
default: false,
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
setup(props, { emit }) {
|
|
144
|
+
const calendarOpen = ref(false);
|
|
145
|
+
const inputDate = ref(props.dateText);
|
|
146
|
+
watch(
|
|
147
|
+
() => props.dateText,
|
|
148
|
+
val => {
|
|
149
|
+
inputDate.value = val;
|
|
150
|
+
},
|
|
151
|
+
);
|
|
152
|
+
|
|
153
|
+
const dateValue = ref(props.modelValue);
|
|
154
|
+
function dateUpdate() {
|
|
155
|
+
if (props.range) {
|
|
156
|
+
if (typeof dateValue.value === 'string') {
|
|
157
|
+
dateValue.value = {
|
|
158
|
+
from: dateValue.value.replaceAll('/', '-'),
|
|
159
|
+
to: dateValue.value.replaceAll('/', '-'),
|
|
160
|
+
};
|
|
161
|
+
} else {
|
|
162
|
+
dateValue.value.from = date.formatDate(dateValue.value.from, 'YYYY-MM-DD');
|
|
163
|
+
dateValue.value.to = date.formatDate(dateValue.value.to, 'YYYY-MM-DD');
|
|
164
|
+
}
|
|
165
|
+
inputDate.value = `${dateValue.value.from} ~ ${dateValue.value.to}`;
|
|
166
|
+
} else {
|
|
167
|
+
dateValue.value = date.formatDate(dateValue.value, 'YYYY-MM-DD');
|
|
168
|
+
inputDate.value = dateValue.value;
|
|
169
|
+
}
|
|
170
|
+
calendarOpen.value = false;
|
|
171
|
+
emit('update:modelValue', dateValue.value);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
watch(
|
|
175
|
+
() => props.modelValue,
|
|
176
|
+
val => {
|
|
177
|
+
dateValue.value = val;
|
|
178
|
+
},
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
function deleteDate() {
|
|
182
|
+
inputDate.value = ' ';
|
|
183
|
+
emit('update:modelValue', '');
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
watch(
|
|
187
|
+
() => props.isDisable,
|
|
188
|
+
val => {
|
|
189
|
+
calendarOpen.value = !val;
|
|
190
|
+
inputDate.value = val ? null : inputDate.value;
|
|
191
|
+
},
|
|
192
|
+
);
|
|
193
|
+
|
|
194
|
+
const today = date.formatDate(new Date(), 'YYYY/MM/DD');
|
|
195
|
+
const startDate = ref(null);
|
|
196
|
+
function getRangeStartDay(from) {
|
|
197
|
+
startDate.value = from;
|
|
198
|
+
}
|
|
199
|
+
function optionsFn(day) {
|
|
200
|
+
// props.subtractDate : 클릭 한 날짜 이전 언제까지
|
|
201
|
+
// props.addDate : 클릭 이후 이후 날짜 언제까지
|
|
202
|
+
// 오늘 이전과 클릭 후 설정한 날짜 까지 (전, 후)
|
|
203
|
+
if (props.selectableFrom) {
|
|
204
|
+
const dayFrom = date.formatDate(props.selectableFrom, 'YYYY/MM/DD');
|
|
205
|
+
return day >= dayFrom;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const clickDate = startDate.value
|
|
209
|
+
? `${startDate.value.year}/${startDate.value.month}/${startDate.value.day}`
|
|
210
|
+
: '';
|
|
211
|
+
if (clickDate) {
|
|
212
|
+
let dateAgo = date.subtractFromDate(clickDate, props.subtractDate);
|
|
213
|
+
dateAgo = date.addToDate(dateAgo, { days: 1 });
|
|
214
|
+
const dateLater = date.addToDate(clickDate, props.addDate);
|
|
215
|
+
const agoformatted = date.formatDate(dateAgo, 'YYYY/MM/DD');
|
|
216
|
+
const laterformatted = date.formatDate(dateLater, 'YYYY/MM/DD');
|
|
217
|
+
const todayDiff = startDate.value ? date.getDateDiff(clickDate, today) : null;
|
|
218
|
+
const laterDiff = startDate.value ? date.getDateDiff(clickDate, laterformatted) : null;
|
|
219
|
+
if (!props.unlimited && todayDiff > laterDiff) {
|
|
220
|
+
return agoformatted <= day && day <= today;
|
|
221
|
+
}
|
|
222
|
+
if (!props.unlimited && todayDiff < laterDiff) {
|
|
223
|
+
return agoformatted <= day && day < laterformatted;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
return !props.unlimited && !props.afterToday
|
|
227
|
+
? day <= today
|
|
228
|
+
: !props.unlimited && props.afterToday
|
|
229
|
+
? day >= today
|
|
230
|
+
: true;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function getThisDayForth() {
|
|
234
|
+
// 오늘 이후의 날짜
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function clickDateIcon() {
|
|
238
|
+
// 아이콘 클릭 시 원래 데이터 초기화
|
|
239
|
+
dateValue.value = {};
|
|
240
|
+
startDate.value = {};
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
return {
|
|
244
|
+
dateRangeIcon,
|
|
245
|
+
calendarOpen,
|
|
246
|
+
dateValue,
|
|
247
|
+
inputDate,
|
|
248
|
+
dateUpdate,
|
|
249
|
+
getRangeStartDay,
|
|
250
|
+
optionsFn,
|
|
251
|
+
clickDateIcon,
|
|
252
|
+
closeIcon,
|
|
253
|
+
getThisDayForth,
|
|
254
|
+
deleteDate,
|
|
255
|
+
};
|
|
256
|
+
},
|
|
257
|
+
});
|
|
258
|
+
</script>
|
|
259
|
+
|
|
260
|
+
<style lang="scss">
|
|
261
|
+
@import '../css/quasar.variables.scss';
|
|
262
|
+
|
|
263
|
+
.s-date-picker {
|
|
264
|
+
height: $default-height;
|
|
265
|
+
.q-field__before {
|
|
266
|
+
padding: 0;
|
|
267
|
+
}
|
|
268
|
+
.q-field__inner {
|
|
269
|
+
.q-field__control {
|
|
270
|
+
padding: 4px 8px !important;
|
|
271
|
+
align-items: center;
|
|
272
|
+
height: 100%;
|
|
273
|
+
align-items: center;
|
|
274
|
+
&:after {
|
|
275
|
+
border: 1px solid $Grey_Lighten-1;
|
|
276
|
+
box-shadow: none;
|
|
277
|
+
}
|
|
278
|
+
&:hover,
|
|
279
|
+
&:active {
|
|
280
|
+
background: $Grey_Lighten-5;
|
|
281
|
+
}
|
|
282
|
+
.q-field__prepend {
|
|
283
|
+
.q-icon {
|
|
284
|
+
width: 20px;
|
|
285
|
+
height: 20px;
|
|
286
|
+
color: $Grey_Darken-1;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
.q-field__prepend {
|
|
290
|
+
height: $default-content-height;
|
|
291
|
+
padding: 0;
|
|
292
|
+
> div {
|
|
293
|
+
min-height: 0;
|
|
294
|
+
height: 100%;
|
|
295
|
+
display: flex !important;
|
|
296
|
+
align-items: center;
|
|
297
|
+
justify-content: center;
|
|
298
|
+
.q-btn {
|
|
299
|
+
width: $default-content-size;
|
|
300
|
+
height: $default-content-size;
|
|
301
|
+
min-height: $default-content-size;
|
|
302
|
+
.q-icon {
|
|
303
|
+
font-size: $icon-size-lg;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
&-container {
|
|
309
|
+
height: $default-content-height;
|
|
310
|
+
.q-field__native {
|
|
311
|
+
height: 100%;
|
|
312
|
+
line-height: $default-line-height;
|
|
313
|
+
text-align: center;
|
|
314
|
+
padding: 0 !important;
|
|
315
|
+
font: {
|
|
316
|
+
size: $default-font;
|
|
317
|
+
weight: $default-font-weight;
|
|
318
|
+
}
|
|
319
|
+
input::placeholder {
|
|
320
|
+
color: $Grey_Darken-4;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
.q-field--disabled.s-date-picker {
|
|
328
|
+
color: $Grey_Default !important;
|
|
329
|
+
.q-field__inner {
|
|
330
|
+
color: $Grey_Default !important;
|
|
331
|
+
.q-field__control {
|
|
332
|
+
color: $Grey_Default !important;
|
|
333
|
+
opacity: 1 !important;
|
|
334
|
+
&:after {
|
|
335
|
+
border: 1px solid $Grey_Lighten-2;
|
|
336
|
+
}
|
|
337
|
+
.q-field__prepend {
|
|
338
|
+
opacity: 1 !important;
|
|
339
|
+
.q-icon {
|
|
340
|
+
color: $Grey_Default;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
&-container {
|
|
344
|
+
opacity: 1 !important;
|
|
345
|
+
.q-field__native {
|
|
346
|
+
color: $Grey_Default !important;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
&.q-field--float {
|
|
352
|
+
color: $Grey_Default !important;
|
|
353
|
+
opacity: 0.9 !important;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
.s-date-picker-inside {
|
|
357
|
+
width: fit-content !important;
|
|
358
|
+
height: 28px;
|
|
359
|
+
.q-field__before {
|
|
360
|
+
height: 100%;
|
|
361
|
+
line-height: $default-content-height;
|
|
362
|
+
padding: 4px 12px;
|
|
363
|
+
border: 1px solid $Grey_Lighten-1;
|
|
364
|
+
background-color: $Grey_Lighten-5;
|
|
365
|
+
border-right: none;
|
|
366
|
+
border-radius: 2px 0 0 2px;
|
|
367
|
+
.date-picker-label {
|
|
368
|
+
font-size: $default-font;
|
|
369
|
+
font-weight: $default-font-weight;
|
|
370
|
+
color: $Grey_Darken-4;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
.q-field__inner {
|
|
374
|
+
.q-field__control {
|
|
375
|
+
border-radius: 0 2px 2px 0;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
&.q-field--disabled {
|
|
379
|
+
.q-field__before {
|
|
380
|
+
border: 1px solid $Grey_Lighten-2;
|
|
381
|
+
border-right: none;
|
|
382
|
+
.date-picker-label {
|
|
383
|
+
color: $Grey_Default;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
.s-date-picker-range {
|
|
390
|
+
width: 226px;
|
|
391
|
+
.q-field__inner {
|
|
392
|
+
.q-field__control {
|
|
393
|
+
.q-field__prepend {
|
|
394
|
+
padding: 0;
|
|
395
|
+
}
|
|
396
|
+
&-container {
|
|
397
|
+
.q-field__native {
|
|
398
|
+
text-align: center;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
.date-picker-wrapper.q-menu {
|
|
406
|
+
width: 290px;
|
|
407
|
+
height: 288px;
|
|
408
|
+
min-width: 0 !important;
|
|
409
|
+
min-height: 0 !important;
|
|
410
|
+
.q-date {
|
|
411
|
+
height: 288px;
|
|
412
|
+
&__main {
|
|
413
|
+
.q-date__content {
|
|
414
|
+
.q-date__view {
|
|
415
|
+
min-height: 0 !important;
|
|
416
|
+
.q-date__navigation {
|
|
417
|
+
div {
|
|
418
|
+
height: 28px;
|
|
419
|
+
.q-btn {
|
|
420
|
+
.q-icon {
|
|
421
|
+
font-size: $default-font;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
.relative-position {
|
|
426
|
+
div {
|
|
427
|
+
.q-btn--dense {
|
|
428
|
+
padding: 0 !important;
|
|
429
|
+
.q-btn__content {
|
|
430
|
+
> span {
|
|
431
|
+
font-size: 14px;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
.q-date__calendar-days-container {
|
|
439
|
+
.q-date__calendar-days {
|
|
440
|
+
.q-date__calendar-item {
|
|
441
|
+
.q-btn {
|
|
442
|
+
padding: 0;
|
|
443
|
+
.q-btn__content {
|
|
444
|
+
> span {
|
|
445
|
+
font-size: 14px;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
&:hover {
|
|
449
|
+
.q-focus-helper {
|
|
450
|
+
background: $positive;
|
|
451
|
+
opacity: 1;
|
|
452
|
+
&:before,
|
|
453
|
+
&:after {
|
|
454
|
+
display: none;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
.q-btn__content {
|
|
458
|
+
> span {
|
|
459
|
+
color: white;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
</style>
|