quasar-ui-sellmate-ui-kit 3.0.3 → 3.0.5
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 +3829 -3829
- 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,470 +1,470 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<q-input
|
|
3
|
-
class="s-date-range q-pa-none bg-white"
|
|
4
|
-
:class="{ 'has-label': insideLabel }"
|
|
5
|
-
dense
|
|
6
|
-
outlined
|
|
7
|
-
readonly
|
|
8
|
-
:disable="isDisable"
|
|
9
|
-
>
|
|
10
|
-
<template v-if="insideLabel" #before>
|
|
11
|
-
<div class="date-picker-label">
|
|
12
|
-
{{ insideLabel }}
|
|
13
|
-
</div>
|
|
14
|
-
</template>
|
|
15
|
-
|
|
16
|
-
<template #default>
|
|
17
|
-
<div
|
|
18
|
-
class="flex no-wrap items-center"
|
|
19
|
-
style="flex-grow: 1; justify-content: center"
|
|
20
|
-
>
|
|
21
|
-
<q-input
|
|
22
|
-
class="inner-input"
|
|
23
|
-
v-model="dateModel.from"
|
|
24
|
-
dense
|
|
25
|
-
borderless
|
|
26
|
-
mask="####-##-##"
|
|
27
|
-
autocomplete="off"
|
|
28
|
-
ref="fromInputRef"
|
|
29
|
-
>
|
|
30
|
-
<template #prepend>
|
|
31
|
-
<q-icon
|
|
32
|
-
:name="dateRangeIcon"
|
|
33
|
-
size="20px"
|
|
34
|
-
color="Grey_Darken-1"
|
|
35
|
-
class="cursor-pointer"
|
|
36
|
-
/>
|
|
37
|
-
</template>
|
|
38
|
-
|
|
39
|
-
<template #default>
|
|
40
|
-
<q-menu
|
|
41
|
-
ref="fromMenuRef"
|
|
42
|
-
class="s-date-menu"
|
|
43
|
-
no-focus
|
|
44
|
-
:offset="[0, 6]"
|
|
45
|
-
>
|
|
46
|
-
<div class="reset-btn-area flex justify-end">
|
|
47
|
-
<q-btn
|
|
48
|
-
class="reset-btn no-hover"
|
|
49
|
-
flat
|
|
50
|
-
label="오늘"
|
|
51
|
-
text-color="Grey_Darken-4"
|
|
52
|
-
:ripple="false"
|
|
53
|
-
@click="resetDate('from')"
|
|
54
|
-
/>
|
|
55
|
-
</div>
|
|
56
|
-
<q-date
|
|
57
|
-
v-model="dateModel.from"
|
|
58
|
-
minimal
|
|
59
|
-
square
|
|
60
|
-
noUnset
|
|
61
|
-
flat
|
|
62
|
-
color="positive"
|
|
63
|
-
class="q-pa-none"
|
|
64
|
-
mask="YYYY-MM-DD"
|
|
65
|
-
:locale="lang ? locale[lang] : {}"
|
|
66
|
-
:options="optionsStartFn"
|
|
67
|
-
@update:modelValue="fromMenuRef.hide()"
|
|
68
|
-
>
|
|
69
|
-
</q-date>
|
|
70
|
-
</q-menu>
|
|
71
|
-
</template>
|
|
72
|
-
</q-input>
|
|
73
|
-
<span class="q-mx-
|
|
74
|
-
<q-input
|
|
75
|
-
v-model="dateModel.to"
|
|
76
|
-
dense
|
|
77
|
-
borderless
|
|
78
|
-
mask="####-##-##"
|
|
79
|
-
autocomplete="off"
|
|
80
|
-
ref="toInputRef"
|
|
81
|
-
class="inner-input"
|
|
82
|
-
>
|
|
83
|
-
<template #prepend>
|
|
84
|
-
<q-icon
|
|
85
|
-
:name="dateRangeIcon"
|
|
86
|
-
size="20px"
|
|
87
|
-
color="Grey_Darken-1"
|
|
88
|
-
class="cursor-pointer"
|
|
89
|
-
/>
|
|
90
|
-
</template>
|
|
91
|
-
|
|
92
|
-
<template #default>
|
|
93
|
-
<q-menu
|
|
94
|
-
ref="toMenuRef"
|
|
95
|
-
class="s-date-menu"
|
|
96
|
-
no-focus
|
|
97
|
-
:offset="[0, 6]"
|
|
98
|
-
>
|
|
99
|
-
<div class="reset-btn-area flex justify-end">
|
|
100
|
-
<q-btn
|
|
101
|
-
class="reset-btn no-hover"
|
|
102
|
-
flat
|
|
103
|
-
label="오늘"
|
|
104
|
-
text-color="Grey_Darken-4"
|
|
105
|
-
:ripple="false"
|
|
106
|
-
@click="resetDate('to')"
|
|
107
|
-
/>
|
|
108
|
-
</div>
|
|
109
|
-
<q-date
|
|
110
|
-
v-model="dateModel.to"
|
|
111
|
-
minimal
|
|
112
|
-
square
|
|
113
|
-
noUnset
|
|
114
|
-
flat
|
|
115
|
-
color="positive"
|
|
116
|
-
class="q-pa-none"
|
|
117
|
-
mask="YYYY-MM-DD"
|
|
118
|
-
:locale="lang ? locale[lang] : {}"
|
|
119
|
-
:options="optionsEndFn"
|
|
120
|
-
@update:modelValue="toMenuRef.hide()"
|
|
121
|
-
/>
|
|
122
|
-
</q-menu>
|
|
123
|
-
</template>
|
|
124
|
-
</q-input>
|
|
125
|
-
</div>
|
|
126
|
-
</template>
|
|
127
|
-
<template v-if="useDelete" #append>
|
|
128
|
-
<q-icon
|
|
129
|
-
:name="closeIcon"
|
|
130
|
-
size="16px"
|
|
131
|
-
class="cursor-pointer"
|
|
132
|
-
@click="deleteDate"
|
|
133
|
-
/>
|
|
134
|
-
</template>
|
|
135
|
-
</q-input>
|
|
136
|
-
</template>
|
|
137
|
-
|
|
138
|
-
<script>
|
|
139
|
-
import { ref } from 'vue';
|
|
140
|
-
import { QIcon, QInput, QDate, QMenu, QBtn, date } from 'quasar';
|
|
141
|
-
import { dateRangeIcon, closeIcon } from '../assets/icons';
|
|
142
|
-
import { useModelBinder } from '../composables/modelBinder';
|
|
143
|
-
|
|
144
|
-
const locale = {
|
|
145
|
-
ko: {
|
|
146
|
-
daysShort: ['일', '월', '화', '수', '목', '금', '토'],
|
|
147
|
-
months: [
|
|
148
|
-
'1월',
|
|
149
|
-
'2월',
|
|
150
|
-
'3월',
|
|
151
|
-
'4월',
|
|
152
|
-
'5월',
|
|
153
|
-
'6월',
|
|
154
|
-
'7월',
|
|
155
|
-
'8월',
|
|
156
|
-
'9월',
|
|
157
|
-
'10월',
|
|
158
|
-
'11월',
|
|
159
|
-
'12월',
|
|
160
|
-
],
|
|
161
|
-
monthsShort: [
|
|
162
|
-
'1월',
|
|
163
|
-
'2월',
|
|
164
|
-
'3월',
|
|
165
|
-
'4월',
|
|
166
|
-
'5월',
|
|
167
|
-
'6월',
|
|
168
|
-
'7월',
|
|
169
|
-
'8월',
|
|
170
|
-
'9월',
|
|
171
|
-
'10월',
|
|
172
|
-
'11월',
|
|
173
|
-
'12월',
|
|
174
|
-
],
|
|
175
|
-
},
|
|
176
|
-
ja: {
|
|
177
|
-
today: '今日',
|
|
178
|
-
daysShort: ['日', '月', '火', '水', '木', '金', '土'],
|
|
179
|
-
months: [
|
|
180
|
-
'1月',
|
|
181
|
-
'2月',
|
|
182
|
-
'3月',
|
|
183
|
-
'4月',
|
|
184
|
-
'5月',
|
|
185
|
-
'6月',
|
|
186
|
-
'7月',
|
|
187
|
-
'8月',
|
|
188
|
-
'9月',
|
|
189
|
-
'10月',
|
|
190
|
-
'11月',
|
|
191
|
-
'12月',
|
|
192
|
-
],
|
|
193
|
-
monthsShort: [
|
|
194
|
-
'1月',
|
|
195
|
-
'2月',
|
|
196
|
-
'3月',
|
|
197
|
-
'4月',
|
|
198
|
-
'5月',
|
|
199
|
-
'6月',
|
|
200
|
-
'7月',
|
|
201
|
-
'8月',
|
|
202
|
-
'9月',
|
|
203
|
-
'10月',
|
|
204
|
-
'11月',
|
|
205
|
-
'12月',
|
|
206
|
-
],
|
|
207
|
-
},
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
export default {
|
|
211
|
-
name: 'SDateRange',
|
|
212
|
-
components: {
|
|
213
|
-
QDate,
|
|
214
|
-
QIcon,
|
|
215
|
-
QInput,
|
|
216
|
-
QMenu,
|
|
217
|
-
QBtn,
|
|
218
|
-
},
|
|
219
|
-
|
|
220
|
-
props: {
|
|
221
|
-
modelValue: {
|
|
222
|
-
type: Object,
|
|
223
|
-
},
|
|
224
|
-
isDisable: {
|
|
225
|
-
type: Boolean,
|
|
226
|
-
default: false,
|
|
227
|
-
},
|
|
228
|
-
insideLabel: {
|
|
229
|
-
type: String,
|
|
230
|
-
default: '',
|
|
231
|
-
},
|
|
232
|
-
lang: {
|
|
233
|
-
type: String,
|
|
234
|
-
default: 'ko',
|
|
235
|
-
},
|
|
236
|
-
useDelete: {
|
|
237
|
-
type: Boolean,
|
|
238
|
-
default: false,
|
|
239
|
-
},
|
|
240
|
-
rangeDate: { type: [Number, Object], default: () => 1 },
|
|
241
|
-
dateLimit: {
|
|
242
|
-
type: Object,
|
|
243
|
-
default: () => ({ from: '', to: '' }),
|
|
244
|
-
},
|
|
245
|
-
},
|
|
246
|
-
|
|
247
|
-
setup(props, { emit }) {
|
|
248
|
-
const dateModel = useModelBinder(props);
|
|
249
|
-
const fromInputRef = ref(null);
|
|
250
|
-
const toInputRef = ref(null);
|
|
251
|
-
const fromMenuRef = ref(null);
|
|
252
|
-
const toMenuRef = ref(null);
|
|
253
|
-
|
|
254
|
-
function resetDate(key) {
|
|
255
|
-
dateModel.value[key] = date.formatDate(new Date(), 'YYYY-MM-DD');
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
function optionsStartFn(day) {
|
|
259
|
-
const dayTo = date.formatDate(dateModel.value.to, 'YYYY/MM/DD');
|
|
260
|
-
let maxFromDate = date.formatDate(
|
|
261
|
-
date.subtractFromDate(
|
|
262
|
-
new Date(dateModel.value.to),
|
|
263
|
-
typeof props.rangeDate === 'number'
|
|
264
|
-
? { month: props.rangeDate }
|
|
265
|
-
: props.rangeDate,
|
|
266
|
-
),
|
|
267
|
-
'YYYY/MM/DD',
|
|
268
|
-
);
|
|
269
|
-
|
|
270
|
-
if (props.dateLimit.from) {
|
|
271
|
-
maxFromDate = date.formatDate(
|
|
272
|
-
new Date(
|
|
273
|
-
Math.max(new Date(maxFromDate), new Date(props.dateLimit.from)),
|
|
274
|
-
),
|
|
275
|
-
'YYYY/MM/DD',
|
|
276
|
-
);
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
if (!dateModel.value.to) {
|
|
280
|
-
return true;
|
|
281
|
-
}
|
|
282
|
-
return maxFromDate <= day && day <= dayTo;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
function optionsEndFn(day) {
|
|
286
|
-
const dayFrom = date.formatDate(dateModel.value.from, 'YYYY/MM/DD');
|
|
287
|
-
let maxToDate = date.formatDate(
|
|
288
|
-
date.addToDate(
|
|
289
|
-
new Date(dateModel.value.from),
|
|
290
|
-
typeof props.rangeDate === 'number'
|
|
291
|
-
? { month: props.rangeDate }
|
|
292
|
-
: props.rangeDate,
|
|
293
|
-
),
|
|
294
|
-
'YYYY/MM/DD',
|
|
295
|
-
);
|
|
296
|
-
|
|
297
|
-
if (props.dateLimit.to) {
|
|
298
|
-
maxToDate = date.formatDate(
|
|
299
|
-
new Date(
|
|
300
|
-
Math.min(new Date(maxToDate), new Date(props.dateLimit.to)),
|
|
301
|
-
),
|
|
302
|
-
'YYYY/MM/DD',
|
|
303
|
-
);
|
|
304
|
-
}
|
|
305
|
-
if (!dateModel.value.from) {
|
|
306
|
-
return true;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
return dayFrom <= day && day <= maxToDate;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
function deleteDate() {
|
|
313
|
-
if (dateModel.value.from && dateModel.value.to) {
|
|
314
|
-
dateModel.value.from = '';
|
|
315
|
-
dateModel.value.to = '';
|
|
316
|
-
emit('update:modelValue', dateModel.value);
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
return {
|
|
321
|
-
locale,
|
|
322
|
-
dateModel,
|
|
323
|
-
fromMenuRef,
|
|
324
|
-
toMenuRef,
|
|
325
|
-
fromInputRef,
|
|
326
|
-
toInputRef,
|
|
327
|
-
dateRangeIcon,
|
|
328
|
-
closeIcon,
|
|
329
|
-
console,
|
|
330
|
-
|
|
331
|
-
resetDate,
|
|
332
|
-
optionsStartFn,
|
|
333
|
-
optionsEndFn,
|
|
334
|
-
deleteDate,
|
|
335
|
-
};
|
|
336
|
-
},
|
|
337
|
-
};
|
|
338
|
-
</script>
|
|
339
|
-
|
|
340
|
-
<style lang="scss">
|
|
341
|
-
@import '../css/quasar.variables.scss';
|
|
342
|
-
|
|
343
|
-
.s-date-range {
|
|
344
|
-
width: fit-content;
|
|
345
|
-
height: $default-height;
|
|
346
|
-
border-radius: 4px;
|
|
347
|
-
|
|
348
|
-
&.has-label {
|
|
349
|
-
.q-field__inner {
|
|
350
|
-
.q-field__control {
|
|
351
|
-
border-radius: 0 2px 2px 0;
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
.q-field__before {
|
|
356
|
-
height: 100%;
|
|
357
|
-
padding: 4px 12px !important;
|
|
358
|
-
border: 1px solid $Grey_Lighten-1;
|
|
359
|
-
border-right: none;
|
|
360
|
-
border-radius: 2px 0 0 2px;
|
|
361
|
-
background: $Grey_Lighten-5;
|
|
362
|
-
|
|
363
|
-
.date-picker-label {
|
|
364
|
-
font-size: $default-font;
|
|
365
|
-
font-weight: $default-font-weight;
|
|
366
|
-
color: $Grey_Darken-4;
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
&.q-field--disabled {
|
|
372
|
-
.q-field__before {
|
|
373
|
-
border: 1px solid $Grey_Lighten-2;
|
|
374
|
-
border-right: none;
|
|
375
|
-
|
|
376
|
-
.date-picker-label {
|
|
377
|
-
color: $Grey_Default;
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
.q-field__inner {
|
|
382
|
-
.q-field__control {
|
|
383
|
-
&:after {
|
|
384
|
-
border: 1px solid $Grey_Lighten-2;
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
.q-field__inner {
|
|
391
|
-
font-size: 12px;
|
|
392
|
-
text-align: center;
|
|
393
|
-
.q-field__control {
|
|
394
|
-
padding: 4px 16px 4px 8px !important;
|
|
395
|
-
height: 100%;
|
|
396
|
-
|
|
397
|
-
&:after {
|
|
398
|
-
border: 1px solid $Grey_Lighten-1;
|
|
399
|
-
box-shadow: none;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
.q-field__prepend {
|
|
403
|
-
height: 20px;
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
.q-field__append {
|
|
407
|
-
height: 20px;
|
|
408
|
-
|
|
409
|
-
.q-icon {
|
|
410
|
-
margin-right: -8px;
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
&-container {
|
|
415
|
-
> input {
|
|
416
|
-
display: none;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
.inner-input {
|
|
420
|
-
width: auto !important;
|
|
421
|
-
// flex-grow: 1;
|
|
422
|
-
> .q-field__inner {
|
|
423
|
-
> .q-field__control {
|
|
424
|
-
width: 100%;
|
|
425
|
-
min-width: 72px;
|
|
426
|
-
height: 20px;
|
|
427
|
-
padding: 0px !important;
|
|
428
|
-
|
|
429
|
-
&::before,
|
|
430
|
-
&::after {
|
|
431
|
-
border: none;
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
.q-field__control-container {
|
|
435
|
-
justify-content: center;
|
|
436
|
-
input {
|
|
437
|
-
width: 72px;
|
|
438
|
-
display: block;
|
|
439
|
-
text-align: center;
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
.s-date-menu {
|
|
451
|
-
.reset-btn-area {
|
|
452
|
-
padding: 20px 24px 0px;
|
|
453
|
-
.reset-btn {
|
|
454
|
-
width: 26px;
|
|
455
|
-
height: 22px;
|
|
456
|
-
min-height: 22px;
|
|
457
|
-
padding: 0;
|
|
458
|
-
text-decoration: underline;
|
|
459
|
-
font-weight: 400;
|
|
460
|
-
|
|
461
|
-
&:hover {
|
|
462
|
-
.q-btn__content {
|
|
463
|
-
text-decoration: underline;
|
|
464
|
-
color: $positive;
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<q-input
|
|
3
|
+
class="s-date-range q-pa-none bg-white"
|
|
4
|
+
:class="{ 'has-label': insideLabel }"
|
|
5
|
+
dense
|
|
6
|
+
outlined
|
|
7
|
+
readonly
|
|
8
|
+
:disable="isDisable"
|
|
9
|
+
>
|
|
10
|
+
<template v-if="insideLabel" #before>
|
|
11
|
+
<div class="date-picker-label">
|
|
12
|
+
{{ insideLabel }}
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<template #default>
|
|
17
|
+
<div
|
|
18
|
+
class="flex no-wrap items-center"
|
|
19
|
+
style="flex-grow: 1; justify-content: center"
|
|
20
|
+
>
|
|
21
|
+
<q-input
|
|
22
|
+
class="inner-input"
|
|
23
|
+
v-model="dateModel.from"
|
|
24
|
+
dense
|
|
25
|
+
borderless
|
|
26
|
+
mask="####-##-##"
|
|
27
|
+
autocomplete="off"
|
|
28
|
+
ref="fromInputRef"
|
|
29
|
+
>
|
|
30
|
+
<template #prepend>
|
|
31
|
+
<q-icon
|
|
32
|
+
:name="dateRangeIcon"
|
|
33
|
+
size="20px"
|
|
34
|
+
color="Grey_Darken-1"
|
|
35
|
+
class="cursor-pointer"
|
|
36
|
+
/>
|
|
37
|
+
</template>
|
|
38
|
+
|
|
39
|
+
<template #default>
|
|
40
|
+
<q-menu
|
|
41
|
+
ref="fromMenuRef"
|
|
42
|
+
class="s-date-menu"
|
|
43
|
+
no-focus
|
|
44
|
+
:offset="[0, 6]"
|
|
45
|
+
>
|
|
46
|
+
<div class="reset-btn-area flex justify-end">
|
|
47
|
+
<q-btn
|
|
48
|
+
class="reset-btn no-hover"
|
|
49
|
+
flat
|
|
50
|
+
label="오늘"
|
|
51
|
+
text-color="Grey_Darken-4"
|
|
52
|
+
:ripple="false"
|
|
53
|
+
@click="resetDate('from')"
|
|
54
|
+
/>
|
|
55
|
+
</div>
|
|
56
|
+
<q-date
|
|
57
|
+
v-model="dateModel.from"
|
|
58
|
+
minimal
|
|
59
|
+
square
|
|
60
|
+
noUnset
|
|
61
|
+
flat
|
|
62
|
+
color="positive"
|
|
63
|
+
class="q-pa-none"
|
|
64
|
+
mask="YYYY-MM-DD"
|
|
65
|
+
:locale="lang ? locale[lang] : {}"
|
|
66
|
+
:options="optionsStartFn"
|
|
67
|
+
@update:modelValue="fromMenuRef.hide()"
|
|
68
|
+
>
|
|
69
|
+
</q-date>
|
|
70
|
+
</q-menu>
|
|
71
|
+
</template>
|
|
72
|
+
</q-input>
|
|
73
|
+
<span class="q-mx-xs">~</span>
|
|
74
|
+
<q-input
|
|
75
|
+
v-model="dateModel.to"
|
|
76
|
+
dense
|
|
77
|
+
borderless
|
|
78
|
+
mask="####-##-##"
|
|
79
|
+
autocomplete="off"
|
|
80
|
+
ref="toInputRef"
|
|
81
|
+
class="inner-input"
|
|
82
|
+
>
|
|
83
|
+
<template #prepend>
|
|
84
|
+
<q-icon
|
|
85
|
+
:name="dateRangeIcon"
|
|
86
|
+
size="20px"
|
|
87
|
+
color="Grey_Darken-1"
|
|
88
|
+
class="cursor-pointer"
|
|
89
|
+
/>
|
|
90
|
+
</template>
|
|
91
|
+
|
|
92
|
+
<template #default>
|
|
93
|
+
<q-menu
|
|
94
|
+
ref="toMenuRef"
|
|
95
|
+
class="s-date-menu"
|
|
96
|
+
no-focus
|
|
97
|
+
:offset="[0, 6]"
|
|
98
|
+
>
|
|
99
|
+
<div class="reset-btn-area flex justify-end">
|
|
100
|
+
<q-btn
|
|
101
|
+
class="reset-btn no-hover"
|
|
102
|
+
flat
|
|
103
|
+
label="오늘"
|
|
104
|
+
text-color="Grey_Darken-4"
|
|
105
|
+
:ripple="false"
|
|
106
|
+
@click="resetDate('to')"
|
|
107
|
+
/>
|
|
108
|
+
</div>
|
|
109
|
+
<q-date
|
|
110
|
+
v-model="dateModel.to"
|
|
111
|
+
minimal
|
|
112
|
+
square
|
|
113
|
+
noUnset
|
|
114
|
+
flat
|
|
115
|
+
color="positive"
|
|
116
|
+
class="q-pa-none"
|
|
117
|
+
mask="YYYY-MM-DD"
|
|
118
|
+
:locale="lang ? locale[lang] : {}"
|
|
119
|
+
:options="optionsEndFn"
|
|
120
|
+
@update:modelValue="toMenuRef.hide()"
|
|
121
|
+
/>
|
|
122
|
+
</q-menu>
|
|
123
|
+
</template>
|
|
124
|
+
</q-input>
|
|
125
|
+
</div>
|
|
126
|
+
</template>
|
|
127
|
+
<template v-if="useDelete" #append>
|
|
128
|
+
<q-icon
|
|
129
|
+
:name="closeIcon"
|
|
130
|
+
size="16px"
|
|
131
|
+
class="cursor-pointer"
|
|
132
|
+
@click="deleteDate"
|
|
133
|
+
/>
|
|
134
|
+
</template>
|
|
135
|
+
</q-input>
|
|
136
|
+
</template>
|
|
137
|
+
|
|
138
|
+
<script>
|
|
139
|
+
import { ref } from 'vue';
|
|
140
|
+
import { QIcon, QInput, QDate, QMenu, QBtn, date } from 'quasar';
|
|
141
|
+
import { dateRangeIcon, closeIcon } from '../assets/icons';
|
|
142
|
+
import { useModelBinder } from '../composables/modelBinder';
|
|
143
|
+
|
|
144
|
+
const locale = {
|
|
145
|
+
ko: {
|
|
146
|
+
daysShort: ['일', '월', '화', '수', '목', '금', '토'],
|
|
147
|
+
months: [
|
|
148
|
+
'1월',
|
|
149
|
+
'2월',
|
|
150
|
+
'3월',
|
|
151
|
+
'4월',
|
|
152
|
+
'5월',
|
|
153
|
+
'6월',
|
|
154
|
+
'7월',
|
|
155
|
+
'8월',
|
|
156
|
+
'9월',
|
|
157
|
+
'10월',
|
|
158
|
+
'11월',
|
|
159
|
+
'12월',
|
|
160
|
+
],
|
|
161
|
+
monthsShort: [
|
|
162
|
+
'1월',
|
|
163
|
+
'2월',
|
|
164
|
+
'3월',
|
|
165
|
+
'4월',
|
|
166
|
+
'5월',
|
|
167
|
+
'6월',
|
|
168
|
+
'7월',
|
|
169
|
+
'8월',
|
|
170
|
+
'9월',
|
|
171
|
+
'10월',
|
|
172
|
+
'11월',
|
|
173
|
+
'12월',
|
|
174
|
+
],
|
|
175
|
+
},
|
|
176
|
+
ja: {
|
|
177
|
+
today: '今日',
|
|
178
|
+
daysShort: ['日', '月', '火', '水', '木', '金', '土'],
|
|
179
|
+
months: [
|
|
180
|
+
'1月',
|
|
181
|
+
'2月',
|
|
182
|
+
'3月',
|
|
183
|
+
'4月',
|
|
184
|
+
'5月',
|
|
185
|
+
'6月',
|
|
186
|
+
'7月',
|
|
187
|
+
'8月',
|
|
188
|
+
'9月',
|
|
189
|
+
'10月',
|
|
190
|
+
'11月',
|
|
191
|
+
'12月',
|
|
192
|
+
],
|
|
193
|
+
monthsShort: [
|
|
194
|
+
'1月',
|
|
195
|
+
'2月',
|
|
196
|
+
'3月',
|
|
197
|
+
'4月',
|
|
198
|
+
'5月',
|
|
199
|
+
'6月',
|
|
200
|
+
'7月',
|
|
201
|
+
'8月',
|
|
202
|
+
'9月',
|
|
203
|
+
'10月',
|
|
204
|
+
'11月',
|
|
205
|
+
'12月',
|
|
206
|
+
],
|
|
207
|
+
},
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
export default {
|
|
211
|
+
name: 'SDateRange',
|
|
212
|
+
components: {
|
|
213
|
+
QDate,
|
|
214
|
+
QIcon,
|
|
215
|
+
QInput,
|
|
216
|
+
QMenu,
|
|
217
|
+
QBtn,
|
|
218
|
+
},
|
|
219
|
+
|
|
220
|
+
props: {
|
|
221
|
+
modelValue: {
|
|
222
|
+
type: Object,
|
|
223
|
+
},
|
|
224
|
+
isDisable: {
|
|
225
|
+
type: Boolean,
|
|
226
|
+
default: false,
|
|
227
|
+
},
|
|
228
|
+
insideLabel: {
|
|
229
|
+
type: String,
|
|
230
|
+
default: '',
|
|
231
|
+
},
|
|
232
|
+
lang: {
|
|
233
|
+
type: String,
|
|
234
|
+
default: 'ko',
|
|
235
|
+
},
|
|
236
|
+
useDelete: {
|
|
237
|
+
type: Boolean,
|
|
238
|
+
default: false,
|
|
239
|
+
},
|
|
240
|
+
rangeDate: { type: [Number, Object], default: () => 1 },
|
|
241
|
+
dateLimit: {
|
|
242
|
+
type: Object,
|
|
243
|
+
default: () => ({ from: '', to: '' }),
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
|
|
247
|
+
setup(props, { emit }) {
|
|
248
|
+
const dateModel = useModelBinder(props);
|
|
249
|
+
const fromInputRef = ref(null);
|
|
250
|
+
const toInputRef = ref(null);
|
|
251
|
+
const fromMenuRef = ref(null);
|
|
252
|
+
const toMenuRef = ref(null);
|
|
253
|
+
|
|
254
|
+
function resetDate(key) {
|
|
255
|
+
dateModel.value[key] = date.formatDate(new Date(), 'YYYY-MM-DD');
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
function optionsStartFn(day) {
|
|
259
|
+
const dayTo = date.formatDate(dateModel.value.to, 'YYYY/MM/DD');
|
|
260
|
+
let maxFromDate = date.formatDate(
|
|
261
|
+
date.subtractFromDate(
|
|
262
|
+
new Date(dateModel.value.to),
|
|
263
|
+
typeof props.rangeDate === 'number'
|
|
264
|
+
? { month: props.rangeDate }
|
|
265
|
+
: props.rangeDate,
|
|
266
|
+
),
|
|
267
|
+
'YYYY/MM/DD',
|
|
268
|
+
);
|
|
269
|
+
|
|
270
|
+
if (props.dateLimit.from) {
|
|
271
|
+
maxFromDate = date.formatDate(
|
|
272
|
+
new Date(
|
|
273
|
+
Math.max(new Date(maxFromDate), new Date(props.dateLimit.from)),
|
|
274
|
+
),
|
|
275
|
+
'YYYY/MM/DD',
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
if (!dateModel.value.to) {
|
|
280
|
+
return true;
|
|
281
|
+
}
|
|
282
|
+
return maxFromDate <= day && day <= dayTo;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
function optionsEndFn(day) {
|
|
286
|
+
const dayFrom = date.formatDate(dateModel.value.from, 'YYYY/MM/DD');
|
|
287
|
+
let maxToDate = date.formatDate(
|
|
288
|
+
date.addToDate(
|
|
289
|
+
new Date(dateModel.value.from),
|
|
290
|
+
typeof props.rangeDate === 'number'
|
|
291
|
+
? { month: props.rangeDate }
|
|
292
|
+
: props.rangeDate,
|
|
293
|
+
),
|
|
294
|
+
'YYYY/MM/DD',
|
|
295
|
+
);
|
|
296
|
+
|
|
297
|
+
if (props.dateLimit.to) {
|
|
298
|
+
maxToDate = date.formatDate(
|
|
299
|
+
new Date(
|
|
300
|
+
Math.min(new Date(maxToDate), new Date(props.dateLimit.to)),
|
|
301
|
+
),
|
|
302
|
+
'YYYY/MM/DD',
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
if (!dateModel.value.from) {
|
|
306
|
+
return true;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
return dayFrom <= day && day <= maxToDate;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
function deleteDate() {
|
|
313
|
+
if (dateModel.value.from && dateModel.value.to) {
|
|
314
|
+
dateModel.value.from = '';
|
|
315
|
+
dateModel.value.to = '';
|
|
316
|
+
emit('update:modelValue', dateModel.value);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
return {
|
|
321
|
+
locale,
|
|
322
|
+
dateModel,
|
|
323
|
+
fromMenuRef,
|
|
324
|
+
toMenuRef,
|
|
325
|
+
fromInputRef,
|
|
326
|
+
toInputRef,
|
|
327
|
+
dateRangeIcon,
|
|
328
|
+
closeIcon,
|
|
329
|
+
console,
|
|
330
|
+
|
|
331
|
+
resetDate,
|
|
332
|
+
optionsStartFn,
|
|
333
|
+
optionsEndFn,
|
|
334
|
+
deleteDate,
|
|
335
|
+
};
|
|
336
|
+
},
|
|
337
|
+
};
|
|
338
|
+
</script>
|
|
339
|
+
|
|
340
|
+
<style lang="scss">
|
|
341
|
+
@import '../css/quasar.variables.scss';
|
|
342
|
+
|
|
343
|
+
.s-date-range {
|
|
344
|
+
width: fit-content;
|
|
345
|
+
height: $default-height;
|
|
346
|
+
border-radius: 4px;
|
|
347
|
+
|
|
348
|
+
&.has-label {
|
|
349
|
+
.q-field__inner {
|
|
350
|
+
.q-field__control {
|
|
351
|
+
border-radius: 0 2px 2px 0;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
.q-field__before {
|
|
356
|
+
height: 100%;
|
|
357
|
+
padding: 4px 12px !important;
|
|
358
|
+
border: 1px solid $Grey_Lighten-1;
|
|
359
|
+
border-right: none;
|
|
360
|
+
border-radius: 2px 0 0 2px;
|
|
361
|
+
background: $Grey_Lighten-5;
|
|
362
|
+
|
|
363
|
+
.date-picker-label {
|
|
364
|
+
font-size: $default-font;
|
|
365
|
+
font-weight: $default-font-weight;
|
|
366
|
+
color: $Grey_Darken-4;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
&.q-field--disabled {
|
|
372
|
+
.q-field__before {
|
|
373
|
+
border: 1px solid $Grey_Lighten-2;
|
|
374
|
+
border-right: none;
|
|
375
|
+
|
|
376
|
+
.date-picker-label {
|
|
377
|
+
color: $Grey_Default;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
.q-field__inner {
|
|
382
|
+
.q-field__control {
|
|
383
|
+
&:after {
|
|
384
|
+
border: 1px solid $Grey_Lighten-2;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
.q-field__inner {
|
|
391
|
+
font-size: 12px;
|
|
392
|
+
text-align: center;
|
|
393
|
+
.q-field__control {
|
|
394
|
+
padding: 4px 16px 4px 8px !important;
|
|
395
|
+
height: 100%;
|
|
396
|
+
|
|
397
|
+
&:after {
|
|
398
|
+
border: 1px solid $Grey_Lighten-1;
|
|
399
|
+
box-shadow: none;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
.q-field__prepend {
|
|
403
|
+
height: 20px;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
.q-field__append {
|
|
407
|
+
height: 20px;
|
|
408
|
+
|
|
409
|
+
.q-icon {
|
|
410
|
+
margin-right: -8px;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
&-container {
|
|
415
|
+
> input {
|
|
416
|
+
display: none;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
.inner-input {
|
|
420
|
+
width: auto !important;
|
|
421
|
+
// flex-grow: 1;
|
|
422
|
+
> .q-field__inner {
|
|
423
|
+
> .q-field__control {
|
|
424
|
+
width: 100%;
|
|
425
|
+
min-width: 72px;
|
|
426
|
+
height: 20px;
|
|
427
|
+
padding: 0px !important;
|
|
428
|
+
|
|
429
|
+
&::before,
|
|
430
|
+
&::after {
|
|
431
|
+
border: none;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
.q-field__control-container {
|
|
435
|
+
justify-content: center;
|
|
436
|
+
input {
|
|
437
|
+
width: 72px;
|
|
438
|
+
display: block;
|
|
439
|
+
text-align: center;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
.s-date-menu {
|
|
451
|
+
.reset-btn-area {
|
|
452
|
+
padding: 20px 24px 0px;
|
|
453
|
+
.reset-btn {
|
|
454
|
+
width: 26px;
|
|
455
|
+
height: 22px;
|
|
456
|
+
min-height: 22px;
|
|
457
|
+
padding: 0;
|
|
458
|
+
text-decoration: underline;
|
|
459
|
+
font-weight: 400;
|
|
460
|
+
|
|
461
|
+
&:hover {
|
|
462
|
+
.q-btn__content {
|
|
463
|
+
text-decoration: underline;
|
|
464
|
+
color: $positive;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
</style>
|