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,349 +1,349 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<q-input
|
|
3
|
-
dense
|
|
4
|
-
outlined
|
|
5
|
-
:class="{
|
|
6
|
-
'text-Grey_Default bg-Grey_Lighten-5': isDisable,
|
|
7
|
-
}"
|
|
8
|
-
class="q-pa-none s-date-time-picker"
|
|
9
|
-
:placeholder="modelValue"
|
|
10
|
-
v-model="inputValue"
|
|
11
|
-
:disable="isDisable"
|
|
12
|
-
mask="####-##-## ##:##:##"
|
|
13
|
-
@update:modelValue="onInputUpdated"
|
|
14
|
-
@click="dateTimePopupRef.show()"
|
|
15
|
-
@keyup.enter="dateTimePopupRef.hide()"
|
|
16
|
-
>
|
|
17
|
-
<template v-slot:prepend>
|
|
18
|
-
<q-icon
|
|
19
|
-
name="event"
|
|
20
|
-
class="cursor-pointer"
|
|
21
|
-
size="20px"
|
|
22
|
-
@click="dateTimePopupRef[openPopup ? 'hide' : 'show']()"
|
|
23
|
-
/>
|
|
24
|
-
</template>
|
|
25
|
-
|
|
26
|
-
<q-popup-proxy
|
|
27
|
-
v-model="openPopup"
|
|
28
|
-
ref="dateTimePopupRef"
|
|
29
|
-
transition-show="scale"
|
|
30
|
-
transition-hide="scale"
|
|
31
|
-
:offset="[0, 4]"
|
|
32
|
-
no-focus
|
|
33
|
-
no-parent-event
|
|
34
|
-
>
|
|
35
|
-
<div
|
|
36
|
-
class="date-time-picker-wrapper flex column"
|
|
37
|
-
style="overflow: hidden"
|
|
38
|
-
>
|
|
39
|
-
<q-date
|
|
40
|
-
v-model="dateValue"
|
|
41
|
-
mask="YYYY-MM-DD"
|
|
42
|
-
minimal
|
|
43
|
-
flat
|
|
44
|
-
:locale="lang ? locale[lang] : {}"
|
|
45
|
-
color="positive"
|
|
46
|
-
:options="optionsFn"
|
|
47
|
-
noUnset
|
|
48
|
-
/>
|
|
49
|
-
<q-separator color="Grey_Lighten-4" />
|
|
50
|
-
<time-picker-card
|
|
51
|
-
v-model="timeValue"
|
|
52
|
-
:lang="lang"
|
|
53
|
-
useSecond
|
|
54
|
-
style="width: 290px"
|
|
55
|
-
/>
|
|
56
|
-
</div>
|
|
57
|
-
</q-popup-proxy>
|
|
58
|
-
</q-input>
|
|
59
|
-
</template>
|
|
60
|
-
|
|
61
|
-
<script>
|
|
62
|
-
import { ref, watch } from 'vue';
|
|
63
|
-
import { QInput, QDate, QIcon, date, QPopupProxy, QSeparator } from 'quasar';
|
|
64
|
-
import TimePickerCard from './TimePickerCard.vue';
|
|
65
|
-
|
|
66
|
-
const locale = {
|
|
67
|
-
ko: {
|
|
68
|
-
daysShort: ['일', '월', '화', '수', '목', '금', '토'],
|
|
69
|
-
months: [
|
|
70
|
-
'1월',
|
|
71
|
-
'2월',
|
|
72
|
-
'3월',
|
|
73
|
-
'4월',
|
|
74
|
-
'5월',
|
|
75
|
-
'6월',
|
|
76
|
-
'7월',
|
|
77
|
-
'8월',
|
|
78
|
-
'9월',
|
|
79
|
-
'10월',
|
|
80
|
-
'11월',
|
|
81
|
-
'12월',
|
|
82
|
-
],
|
|
83
|
-
monthsShort: [
|
|
84
|
-
'1월',
|
|
85
|
-
'2월',
|
|
86
|
-
'3월',
|
|
87
|
-
'4월',
|
|
88
|
-
'5월',
|
|
89
|
-
'6월',
|
|
90
|
-
'7월',
|
|
91
|
-
'8월',
|
|
92
|
-
'9월',
|
|
93
|
-
'10월',
|
|
94
|
-
'11월',
|
|
95
|
-
'12월',
|
|
96
|
-
],
|
|
97
|
-
},
|
|
98
|
-
en: {
|
|
99
|
-
daysShort: ['SUN', 'MON', 'TUE', 'WEN', 'THU', 'FRI', 'SAT'],
|
|
100
|
-
months: [
|
|
101
|
-
'January',
|
|
102
|
-
'February',
|
|
103
|
-
'March',
|
|
104
|
-
'April',
|
|
105
|
-
'May',
|
|
106
|
-
'June',
|
|
107
|
-
'July',
|
|
108
|
-
'August',
|
|
109
|
-
'September',
|
|
110
|
-
'October',
|
|
111
|
-
'November',
|
|
112
|
-
'December',
|
|
113
|
-
],
|
|
114
|
-
monthsShort: [
|
|
115
|
-
'Jan',
|
|
116
|
-
'Feb',
|
|
117
|
-
'Mar',
|
|
118
|
-
'Apr',
|
|
119
|
-
'May',
|
|
120
|
-
'Jun',
|
|
121
|
-
'Jul',
|
|
122
|
-
'Ago',
|
|
123
|
-
'Sep',
|
|
124
|
-
'Oct',
|
|
125
|
-
'Nov',
|
|
126
|
-
'Dec',
|
|
127
|
-
],
|
|
128
|
-
},
|
|
129
|
-
ja: {
|
|
130
|
-
today: '今日',
|
|
131
|
-
daysShort: ['日', '月', '火', '水', '木', '金', '土'],
|
|
132
|
-
months: [
|
|
133
|
-
'1月',
|
|
134
|
-
'2月',
|
|
135
|
-
'3月',
|
|
136
|
-
'4月',
|
|
137
|
-
'5月',
|
|
138
|
-
'6月',
|
|
139
|
-
'7月',
|
|
140
|
-
'8月',
|
|
141
|
-
'9月',
|
|
142
|
-
'10月',
|
|
143
|
-
'11月',
|
|
144
|
-
'12月',
|
|
145
|
-
],
|
|
146
|
-
monthsShort: [
|
|
147
|
-
'1月',
|
|
148
|
-
'2月',
|
|
149
|
-
'3月',
|
|
150
|
-
'4月',
|
|
151
|
-
'5月',
|
|
152
|
-
'6月',
|
|
153
|
-
'7月',
|
|
154
|
-
'8月',
|
|
155
|
-
'9月',
|
|
156
|
-
'10月',
|
|
157
|
-
'11月',
|
|
158
|
-
'12月',
|
|
159
|
-
],
|
|
160
|
-
},
|
|
161
|
-
};
|
|
162
|
-
export default {
|
|
163
|
-
name: 'SDateTimePicker',
|
|
164
|
-
components: {
|
|
165
|
-
QInput,
|
|
166
|
-
QDate,
|
|
167
|
-
QIcon,
|
|
168
|
-
TimePickerCard,
|
|
169
|
-
QPopupProxy,
|
|
170
|
-
QSeparator,
|
|
171
|
-
},
|
|
172
|
-
props: {
|
|
173
|
-
modelValue: {
|
|
174
|
-
type: String,
|
|
175
|
-
default: '',
|
|
176
|
-
require: true,
|
|
177
|
-
},
|
|
178
|
-
isDisable: Boolean,
|
|
179
|
-
lang: {
|
|
180
|
-
type: String,
|
|
181
|
-
default: 'ko',
|
|
182
|
-
require: false,
|
|
183
|
-
},
|
|
184
|
-
monthAgoLimit: {
|
|
185
|
-
type: [Number, null],
|
|
186
|
-
default: null,
|
|
187
|
-
},
|
|
188
|
-
},
|
|
189
|
-
setup(props, { emit }) {
|
|
190
|
-
const dateValue = ref(props.modelValue.match(/\d{4}-\d{2}-\d{2}/)[0]);
|
|
191
|
-
const timeValue = ref(props.modelValue.match(/(\d{2}):(\d{2}):(\d{2})/)[0]);
|
|
192
|
-
const inputValue = ref(`${dateValue.value} ${timeValue.value}`);
|
|
193
|
-
const dateTimePopupRef = ref(null);
|
|
194
|
-
|
|
195
|
-
watch(
|
|
196
|
-
() => props.modelValue,
|
|
197
|
-
newValue => {
|
|
198
|
-
inputValue.value = `${newValue.match(/\d{4}-\d{2}-\d{2}/)[0]} ${
|
|
199
|
-
newValue.match(/(\d{2}):(\d{2}):(\d{2})/)[0]
|
|
200
|
-
}`;
|
|
201
|
-
dateValue.value = `${
|
|
202
|
-
newValue.match(/\d{4}-\d{2}-\d{2}/)[0]
|
|
203
|
-
}`;
|
|
204
|
-
timeValue.value = `${
|
|
205
|
-
newValue.match(/(\d{2}):(\d{2}):(\d{2})/)[0]
|
|
206
|
-
}`;
|
|
207
|
-
},
|
|
208
|
-
);
|
|
209
|
-
|
|
210
|
-
function onInputUpdated(val) {
|
|
211
|
-
const matchedInput = val.match(/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/);
|
|
212
|
-
|
|
213
|
-
if (!matchedInput) { return; }
|
|
214
|
-
const validInput = matchedInput[0];
|
|
215
|
-
if (
|
|
216
|
-
Number.isNaN(+new Date(validInput.match(/\d{4}-\d{2}-\d{2}/)[0]))
|
|
217
|
-
) {
|
|
218
|
-
dateValue.value = date.formatDate(new Date(), 'YYYY-MM-DD');
|
|
219
|
-
inputValue.value = `${dateValue.value} ${timeValue.value}`;
|
|
220
|
-
} else {
|
|
221
|
-
[dateValue.value] = validInput.match(/\d{4}-\d{2}-\d{2}/);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
[timeValue.value] = validInput.match(/(\d{2}):(\d{2}):(\d{2})/);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
function updateInputValue() {
|
|
228
|
-
const formattedDate = date.formatDate(dateValue.value, 'YYYY-MM-DD');
|
|
229
|
-
const formattedTime = timeValue.value.match(/\d{2}:\d{2}:\d{2}/)[0];
|
|
230
|
-
|
|
231
|
-
inputValue.value = `${formattedDate} ${formattedTime}`;
|
|
232
|
-
|
|
233
|
-
emit('update:modelValue', inputValue.value);
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
function optionsFn(dateStr) {
|
|
237
|
-
if (props.monthAgoLimit === null) return true;
|
|
238
|
-
|
|
239
|
-
const minDate = date.formatDate(
|
|
240
|
-
date.subtractFromDate(new Date(), { month: props.monthAgoLimit }),
|
|
241
|
-
'YYYY/MM/DD',
|
|
242
|
-
);
|
|
243
|
-
return dateStr > minDate;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
watch(dateValue, updateInputValue);
|
|
247
|
-
watch(timeValue, updateInputValue);
|
|
248
|
-
|
|
249
|
-
return {
|
|
250
|
-
console,
|
|
251
|
-
dateValue,
|
|
252
|
-
timeValue,
|
|
253
|
-
inputValue,
|
|
254
|
-
dateTimePopupRef,
|
|
255
|
-
locale,
|
|
256
|
-
optionsFn,
|
|
257
|
-
onInputUpdated,
|
|
258
|
-
openPopup: ref(false),
|
|
259
|
-
};
|
|
260
|
-
},
|
|
261
|
-
};
|
|
262
|
-
</script>
|
|
263
|
-
|
|
264
|
-
<style lang="scss">
|
|
265
|
-
@import '../css/quasar.variables.scss';
|
|
266
|
-
|
|
267
|
-
.s-date-time-picker {
|
|
268
|
-
width: fit-content;
|
|
269
|
-
height: $default-height;
|
|
270
|
-
|
|
271
|
-
.q-field__before {
|
|
272
|
-
padding: 0;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
.q-field__inner {
|
|
276
|
-
.q-field__control {
|
|
277
|
-
padding: 4px 8px !important;
|
|
278
|
-
align-items: center;
|
|
279
|
-
height: 100%;
|
|
280
|
-
|
|
281
|
-
&:after {
|
|
282
|
-
border: 1px solid $Grey_Lighten-1;
|
|
283
|
-
box-shadow: none;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
&:hover,
|
|
287
|
-
&:active {
|
|
288
|
-
background: $Grey_Lighten-5;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
.q-field__prepend {
|
|
292
|
-
.q-icon {
|
|
293
|
-
width: 20px;
|
|
294
|
-
height: 20px;
|
|
295
|
-
color: $Grey_Darken-1;
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
.q-field__prepend {
|
|
300
|
-
height: $default-content-height;
|
|
301
|
-
padding: 0;
|
|
302
|
-
|
|
303
|
-
> div {
|
|
304
|
-
min-height: 0;
|
|
305
|
-
height: 100%;
|
|
306
|
-
display: flex !important;
|
|
307
|
-
align-items: center;
|
|
308
|
-
justify-content: center;
|
|
309
|
-
|
|
310
|
-
.q-btn {
|
|
311
|
-
width: $default-content-size;
|
|
312
|
-
height: $default-content-size;
|
|
313
|
-
min-height: $default-content-size;
|
|
314
|
-
|
|
315
|
-
.q-icon {
|
|
316
|
-
font-size: $icon-size-lg;
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
&-container {
|
|
323
|
-
height: $default-content-height;
|
|
324
|
-
|
|
325
|
-
.q-field__native {
|
|
326
|
-
height: 100%;
|
|
327
|
-
line-height: $default-line-height;
|
|
328
|
-
text-align: center;
|
|
329
|
-
padding: 0 !important;
|
|
330
|
-
|
|
331
|
-
font: {
|
|
332
|
-
size: $default-font;
|
|
333
|
-
weight: $default-font-weight;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
input::placeholder {
|
|
337
|
-
color: $Grey_Darken-4;
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
.date-time-picker-wrapper {
|
|
345
|
-
.time-picker-card {
|
|
346
|
-
box-shadow: none;
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<q-input
|
|
3
|
+
dense
|
|
4
|
+
outlined
|
|
5
|
+
:class="{
|
|
6
|
+
'text-Grey_Default bg-Grey_Lighten-5': isDisable,
|
|
7
|
+
}"
|
|
8
|
+
class="q-pa-none s-date-time-picker"
|
|
9
|
+
:placeholder="modelValue"
|
|
10
|
+
v-model="inputValue"
|
|
11
|
+
:disable="isDisable"
|
|
12
|
+
mask="####-##-## ##:##:##"
|
|
13
|
+
@update:modelValue="onInputUpdated"
|
|
14
|
+
@click="dateTimePopupRef.show()"
|
|
15
|
+
@keyup.enter="dateTimePopupRef.hide()"
|
|
16
|
+
>
|
|
17
|
+
<template v-slot:prepend>
|
|
18
|
+
<q-icon
|
|
19
|
+
name="event"
|
|
20
|
+
class="cursor-pointer"
|
|
21
|
+
size="20px"
|
|
22
|
+
@click="dateTimePopupRef[openPopup ? 'hide' : 'show']()"
|
|
23
|
+
/>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<q-popup-proxy
|
|
27
|
+
v-model="openPopup"
|
|
28
|
+
ref="dateTimePopupRef"
|
|
29
|
+
transition-show="scale"
|
|
30
|
+
transition-hide="scale"
|
|
31
|
+
:offset="[0, 4]"
|
|
32
|
+
no-focus
|
|
33
|
+
no-parent-event
|
|
34
|
+
>
|
|
35
|
+
<div
|
|
36
|
+
class="date-time-picker-wrapper flex column"
|
|
37
|
+
style="overflow: hidden"
|
|
38
|
+
>
|
|
39
|
+
<q-date
|
|
40
|
+
v-model="dateValue"
|
|
41
|
+
mask="YYYY-MM-DD"
|
|
42
|
+
minimal
|
|
43
|
+
flat
|
|
44
|
+
:locale="lang ? locale[lang] : {}"
|
|
45
|
+
color="positive"
|
|
46
|
+
:options="optionsFn"
|
|
47
|
+
noUnset
|
|
48
|
+
/>
|
|
49
|
+
<q-separator color="Grey_Lighten-4" />
|
|
50
|
+
<time-picker-card
|
|
51
|
+
v-model="timeValue"
|
|
52
|
+
:lang="lang"
|
|
53
|
+
useSecond
|
|
54
|
+
style="width: 290px"
|
|
55
|
+
/>
|
|
56
|
+
</div>
|
|
57
|
+
</q-popup-proxy>
|
|
58
|
+
</q-input>
|
|
59
|
+
</template>
|
|
60
|
+
|
|
61
|
+
<script>
|
|
62
|
+
import { ref, watch } from 'vue';
|
|
63
|
+
import { QInput, QDate, QIcon, date, QPopupProxy, QSeparator } from 'quasar';
|
|
64
|
+
import TimePickerCard from './TimePickerCard.vue';
|
|
65
|
+
|
|
66
|
+
const locale = {
|
|
67
|
+
ko: {
|
|
68
|
+
daysShort: ['일', '월', '화', '수', '목', '금', '토'],
|
|
69
|
+
months: [
|
|
70
|
+
'1월',
|
|
71
|
+
'2월',
|
|
72
|
+
'3월',
|
|
73
|
+
'4월',
|
|
74
|
+
'5월',
|
|
75
|
+
'6월',
|
|
76
|
+
'7월',
|
|
77
|
+
'8월',
|
|
78
|
+
'9월',
|
|
79
|
+
'10월',
|
|
80
|
+
'11월',
|
|
81
|
+
'12월',
|
|
82
|
+
],
|
|
83
|
+
monthsShort: [
|
|
84
|
+
'1월',
|
|
85
|
+
'2월',
|
|
86
|
+
'3월',
|
|
87
|
+
'4월',
|
|
88
|
+
'5월',
|
|
89
|
+
'6월',
|
|
90
|
+
'7월',
|
|
91
|
+
'8월',
|
|
92
|
+
'9월',
|
|
93
|
+
'10월',
|
|
94
|
+
'11월',
|
|
95
|
+
'12월',
|
|
96
|
+
],
|
|
97
|
+
},
|
|
98
|
+
en: {
|
|
99
|
+
daysShort: ['SUN', 'MON', 'TUE', 'WEN', 'THU', 'FRI', 'SAT'],
|
|
100
|
+
months: [
|
|
101
|
+
'January',
|
|
102
|
+
'February',
|
|
103
|
+
'March',
|
|
104
|
+
'April',
|
|
105
|
+
'May',
|
|
106
|
+
'June',
|
|
107
|
+
'July',
|
|
108
|
+
'August',
|
|
109
|
+
'September',
|
|
110
|
+
'October',
|
|
111
|
+
'November',
|
|
112
|
+
'December',
|
|
113
|
+
],
|
|
114
|
+
monthsShort: [
|
|
115
|
+
'Jan',
|
|
116
|
+
'Feb',
|
|
117
|
+
'Mar',
|
|
118
|
+
'Apr',
|
|
119
|
+
'May',
|
|
120
|
+
'Jun',
|
|
121
|
+
'Jul',
|
|
122
|
+
'Ago',
|
|
123
|
+
'Sep',
|
|
124
|
+
'Oct',
|
|
125
|
+
'Nov',
|
|
126
|
+
'Dec',
|
|
127
|
+
],
|
|
128
|
+
},
|
|
129
|
+
ja: {
|
|
130
|
+
today: '今日',
|
|
131
|
+
daysShort: ['日', '月', '火', '水', '木', '金', '土'],
|
|
132
|
+
months: [
|
|
133
|
+
'1月',
|
|
134
|
+
'2月',
|
|
135
|
+
'3月',
|
|
136
|
+
'4月',
|
|
137
|
+
'5月',
|
|
138
|
+
'6月',
|
|
139
|
+
'7月',
|
|
140
|
+
'8月',
|
|
141
|
+
'9月',
|
|
142
|
+
'10月',
|
|
143
|
+
'11月',
|
|
144
|
+
'12月',
|
|
145
|
+
],
|
|
146
|
+
monthsShort: [
|
|
147
|
+
'1月',
|
|
148
|
+
'2月',
|
|
149
|
+
'3月',
|
|
150
|
+
'4月',
|
|
151
|
+
'5月',
|
|
152
|
+
'6月',
|
|
153
|
+
'7月',
|
|
154
|
+
'8月',
|
|
155
|
+
'9月',
|
|
156
|
+
'10月',
|
|
157
|
+
'11月',
|
|
158
|
+
'12月',
|
|
159
|
+
],
|
|
160
|
+
},
|
|
161
|
+
};
|
|
162
|
+
export default {
|
|
163
|
+
name: 'SDateTimePicker',
|
|
164
|
+
components: {
|
|
165
|
+
QInput,
|
|
166
|
+
QDate,
|
|
167
|
+
QIcon,
|
|
168
|
+
TimePickerCard,
|
|
169
|
+
QPopupProxy,
|
|
170
|
+
QSeparator,
|
|
171
|
+
},
|
|
172
|
+
props: {
|
|
173
|
+
modelValue: {
|
|
174
|
+
type: String,
|
|
175
|
+
default: '',
|
|
176
|
+
require: true,
|
|
177
|
+
},
|
|
178
|
+
isDisable: Boolean,
|
|
179
|
+
lang: {
|
|
180
|
+
type: String,
|
|
181
|
+
default: 'ko',
|
|
182
|
+
require: false,
|
|
183
|
+
},
|
|
184
|
+
monthAgoLimit: {
|
|
185
|
+
type: [Number, null],
|
|
186
|
+
default: null,
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
setup(props, { emit }) {
|
|
190
|
+
const dateValue = ref(props.modelValue.match(/\d{4}-\d{2}-\d{2}/)[0]);
|
|
191
|
+
const timeValue = ref(props.modelValue.match(/(\d{2}):(\d{2}):(\d{2})/)[0]);
|
|
192
|
+
const inputValue = ref(`${dateValue.value} ${timeValue.value}`);
|
|
193
|
+
const dateTimePopupRef = ref(null);
|
|
194
|
+
|
|
195
|
+
watch(
|
|
196
|
+
() => props.modelValue,
|
|
197
|
+
newValue => {
|
|
198
|
+
inputValue.value = `${newValue.match(/\d{4}-\d{2}-\d{2}/)[0]} ${
|
|
199
|
+
newValue.match(/(\d{2}):(\d{2}):(\d{2})/)[0]
|
|
200
|
+
}`;
|
|
201
|
+
dateValue.value = `${
|
|
202
|
+
newValue.match(/\d{4}-\d{2}-\d{2}/)[0]
|
|
203
|
+
}`;
|
|
204
|
+
timeValue.value = `${
|
|
205
|
+
newValue.match(/(\d{2}):(\d{2}):(\d{2})/)[0]
|
|
206
|
+
}`;
|
|
207
|
+
},
|
|
208
|
+
);
|
|
209
|
+
|
|
210
|
+
function onInputUpdated(val) {
|
|
211
|
+
const matchedInput = val.match(/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/);
|
|
212
|
+
|
|
213
|
+
if (!matchedInput) { return; }
|
|
214
|
+
const validInput = matchedInput[0];
|
|
215
|
+
if (
|
|
216
|
+
Number.isNaN(+new Date(validInput.match(/\d{4}-\d{2}-\d{2}/)[0]))
|
|
217
|
+
) {
|
|
218
|
+
dateValue.value = date.formatDate(new Date(), 'YYYY-MM-DD');
|
|
219
|
+
inputValue.value = `${dateValue.value} ${timeValue.value}`;
|
|
220
|
+
} else {
|
|
221
|
+
[dateValue.value] = validInput.match(/\d{4}-\d{2}-\d{2}/);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
[timeValue.value] = validInput.match(/(\d{2}):(\d{2}):(\d{2})/);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function updateInputValue() {
|
|
228
|
+
const formattedDate = date.formatDate(dateValue.value, 'YYYY-MM-DD');
|
|
229
|
+
const formattedTime = timeValue.value.match(/\d{2}:\d{2}:\d{2}/)[0];
|
|
230
|
+
|
|
231
|
+
inputValue.value = `${formattedDate} ${formattedTime}`;
|
|
232
|
+
|
|
233
|
+
emit('update:modelValue', inputValue.value);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
function optionsFn(dateStr) {
|
|
237
|
+
if (props.monthAgoLimit === null) return true;
|
|
238
|
+
|
|
239
|
+
const minDate = date.formatDate(
|
|
240
|
+
date.subtractFromDate(new Date(), { month: props.monthAgoLimit }),
|
|
241
|
+
'YYYY/MM/DD',
|
|
242
|
+
);
|
|
243
|
+
return dateStr > minDate;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
watch(dateValue, updateInputValue);
|
|
247
|
+
watch(timeValue, updateInputValue);
|
|
248
|
+
|
|
249
|
+
return {
|
|
250
|
+
console,
|
|
251
|
+
dateValue,
|
|
252
|
+
timeValue,
|
|
253
|
+
inputValue,
|
|
254
|
+
dateTimePopupRef,
|
|
255
|
+
locale,
|
|
256
|
+
optionsFn,
|
|
257
|
+
onInputUpdated,
|
|
258
|
+
openPopup: ref(false),
|
|
259
|
+
};
|
|
260
|
+
},
|
|
261
|
+
};
|
|
262
|
+
</script>
|
|
263
|
+
|
|
264
|
+
<style lang="scss">
|
|
265
|
+
@import '../css/quasar.variables.scss';
|
|
266
|
+
|
|
267
|
+
.s-date-time-picker {
|
|
268
|
+
width: fit-content;
|
|
269
|
+
height: $default-height;
|
|
270
|
+
|
|
271
|
+
.q-field__before {
|
|
272
|
+
padding: 0;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.q-field__inner {
|
|
276
|
+
.q-field__control {
|
|
277
|
+
padding: 4px 8px !important;
|
|
278
|
+
align-items: center;
|
|
279
|
+
height: 100%;
|
|
280
|
+
|
|
281
|
+
&:after {
|
|
282
|
+
border: 1px solid $Grey_Lighten-1;
|
|
283
|
+
box-shadow: none;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
&:hover,
|
|
287
|
+
&:active {
|
|
288
|
+
background: $Grey_Lighten-5;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.q-field__prepend {
|
|
292
|
+
.q-icon {
|
|
293
|
+
width: 20px;
|
|
294
|
+
height: 20px;
|
|
295
|
+
color: $Grey_Darken-1;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.q-field__prepend {
|
|
300
|
+
height: $default-content-height;
|
|
301
|
+
padding: 0;
|
|
302
|
+
|
|
303
|
+
> div {
|
|
304
|
+
min-height: 0;
|
|
305
|
+
height: 100%;
|
|
306
|
+
display: flex !important;
|
|
307
|
+
align-items: center;
|
|
308
|
+
justify-content: center;
|
|
309
|
+
|
|
310
|
+
.q-btn {
|
|
311
|
+
width: $default-content-size;
|
|
312
|
+
height: $default-content-size;
|
|
313
|
+
min-height: $default-content-size;
|
|
314
|
+
|
|
315
|
+
.q-icon {
|
|
316
|
+
font-size: $icon-size-lg;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
&-container {
|
|
323
|
+
height: $default-content-height;
|
|
324
|
+
|
|
325
|
+
.q-field__native {
|
|
326
|
+
height: 100%;
|
|
327
|
+
line-height: $default-line-height;
|
|
328
|
+
text-align: center;
|
|
329
|
+
padding: 0 !important;
|
|
330
|
+
|
|
331
|
+
font: {
|
|
332
|
+
size: $default-font;
|
|
333
|
+
weight: $default-font-weight;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
input::placeholder {
|
|
337
|
+
color: $Grey_Darken-4;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
.date-time-picker-wrapper {
|
|
345
|
+
.time-picker-card {
|
|
346
|
+
box-shadow: none;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
</style>
|