@simsustech/quasar-components 0.4.8 → 0.5.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/CHANGELOG.md +13 -0
- package/dist/{QSubmitButton.vue_vue_type_script_setup_true_lang-3DA1OTeA.js → QSubmitButton.vue_vue_type_script_setup_true_lang-DAnZaTMl.js} +1 -1
- package/dist/authentication.js +8 -5
- package/dist/{en-US-Ub0VDpRf.js → en-US-Duo_j_eL.js} +1 -1
- package/dist/flags.js +1 -3
- package/dist/form.js +161 -51
- package/dist/general.js +2 -2
- package/dist/{nl-VodfMDVb.js → nl-BjtwxTCz.js} +3 -0
- package/dist/style.css +14 -1
- package/dist/types/ui/form/DateInput.vue.d.ts +30 -5
- package/dist/types/ui/form/lang/index.d.ts +6 -0
- package/dist/vite-plugin.js +6 -6
- package/package.json +11 -11
- package/src/ui/authentication/LoginForm.vue +3 -0
- package/src/ui/form/DateInput.vue +178 -32
- package/src/ui/form/lang/en-US.ts +3 -0
- package/src/ui/form/lang/index.ts +3 -0
- package/src/ui/form/lang/nl.ts +3 -0
- /package/dist/{nl-Y-pHriZy.js → nl-CBxnt0JS.js} +0 -0
- /package/dist/{nl-w63lODNM.js → nl-iCAs4ELa.js} +0 -0
- /package/dist/{nl-ddFMi2cz.js → nl-vB00g7s2.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @simsustech/quasar-components
|
|
2
2
|
|
|
3
|
+
## 0.5.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4d55fc8: feat(DateInput): add stack-label; fix(DateInput): set year to undefined on invalid values
|
|
8
|
+
|
|
9
|
+
## 0.5.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 401bf7b: feat: change DateInput to separate input fields for year, month and day
|
|
14
|
+
- fa4989f: feat: add autocomplete attributes to LoginForm
|
|
15
|
+
|
|
3
16
|
## 0.4.8
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -14,7 +14,7 @@ var define_import_meta_env_default = { BASE_URL: "/", MODE: "production", DEV: f
|
|
|
14
14
|
const lang = ref(lang$1);
|
|
15
15
|
const locales = /* @__PURE__ */ Object.assign({
|
|
16
16
|
"./en-US.ts": () => Promise.resolve().then(() => enUS),
|
|
17
|
-
"./nl.ts": () => import("./nl-
|
|
17
|
+
"./nl.ts": () => import("./nl-vB00g7s2.js")
|
|
18
18
|
});
|
|
19
19
|
const useLang = () => {
|
|
20
20
|
return lang;
|
package/dist/authentication.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useQuasar, QForm, QInput, QStep, QStepperNavigation, QStepper, QIcon, QBtn, QSlider, QItemSection, QItem, QList, QMenu } from "quasar";
|
|
2
2
|
import { ref, defineComponent, watch, computed, openBlock, createBlock, unref, mergeProps, withCtx, createVNode, renderSlot, toRef, createCommentVNode, createElementBlock, Fragment, renderList, createTextVNode, toDisplayString } from "vue";
|
|
3
|
-
import { _ as _sfc_main$c } from "./QSubmitButton.vue_vue_type_script_setup_true_lang-
|
|
3
|
+
import { _ as _sfc_main$c } from "./QSubmitButton.vue_vue_type_script_setup_true_lang-DAnZaTMl.js";
|
|
4
4
|
const lang$1 = {
|
|
5
5
|
isoName: "en-US",
|
|
6
6
|
myAccount: "Account",
|
|
@@ -98,7 +98,7 @@ var define_import_meta_env_default = { BASE_URL: "/", MODE: "production", DEV: f
|
|
|
98
98
|
const lang = ref(lang$1);
|
|
99
99
|
const locales = /* @__PURE__ */ Object.assign({
|
|
100
100
|
"./en-US.ts": () => Promise.resolve().then(() => enUS),
|
|
101
|
-
"./nl.ts": () => import("./nl-
|
|
101
|
+
"./nl.ts": () => import("./nl-CBxnt0JS.js")
|
|
102
102
|
});
|
|
103
103
|
const useLang = () => {
|
|
104
104
|
return lang;
|
|
@@ -1059,7 +1059,8 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
1059
1059
|
label: unref(lang2).login.fields.email,
|
|
1060
1060
|
"bottom-slots": "",
|
|
1061
1061
|
rules: validations.value["email"],
|
|
1062
|
-
"lazy-rules": ""
|
|
1062
|
+
"lazy-rules": "",
|
|
1063
|
+
autcomplete: "email"
|
|
1063
1064
|
}), null, 16, ["modelValue", "label", "rules"])) : createCommentVNode("", true),
|
|
1064
1065
|
_ctx.useUsername ? (openBlock(), createBlock(_component_q_input, mergeProps({ key: 1 }, _ctx.input, {
|
|
1065
1066
|
id: "username",
|
|
@@ -1069,7 +1070,8 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
1069
1070
|
label: unref(lang2).login.fields.username,
|
|
1070
1071
|
"bottom-slots": "",
|
|
1071
1072
|
rules: validations.value["username"],
|
|
1072
|
-
"lazy-rules": ""
|
|
1073
|
+
"lazy-rules": "",
|
|
1074
|
+
autocomplete: "username"
|
|
1073
1075
|
}), null, 16, ["modelValue", "label", "rules"])) : createCommentVNode("", true),
|
|
1074
1076
|
createVNode(_component_q_input, mergeProps({
|
|
1075
1077
|
id: "password",
|
|
@@ -1082,7 +1084,8 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
1082
1084
|
label: unref(lang2).login.fields.password,
|
|
1083
1085
|
rules: validations.value["password"],
|
|
1084
1086
|
"lazy-rules": "",
|
|
1085
|
-
"bottom-slots": ""
|
|
1087
|
+
"bottom-slots": "",
|
|
1088
|
+
autcomplete: "current-password"
|
|
1086
1089
|
}), {
|
|
1087
1090
|
append: withCtx(() => [
|
|
1088
1091
|
createVNode(_component_q_icon, {
|
|
@@ -139,7 +139,7 @@ var define_import_meta_env_default = { BASE_URL: "/", MODE: "production", DEV: f
|
|
|
139
139
|
const lang = ref(lang$1);
|
|
140
140
|
const locales = /* @__PURE__ */ Object.assign({
|
|
141
141
|
"./en-US.ts": () => Promise.resolve().then(() => enUS),
|
|
142
|
-
"./nl.ts": () => import("./nl-
|
|
142
|
+
"./nl.ts": () => import("./nl-iCAs4ELa.js")
|
|
143
143
|
});
|
|
144
144
|
const useLang = () => {
|
|
145
145
|
return lang;
|
package/dist/flags.js
CHANGED
package/dist/form.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ref, defineComponent, useAttrs, withAsyncContext, watch, openBlock, createBlock, unref, mergeProps, normalizeProps, guardReactiveProps, withCtx, createVNode, createTextVNode, toDisplayString, computed, useSlots, renderSlot, createCommentVNode, toRefs, resolveDirective,
|
|
2
|
-
import { useQuasar, QSelect, QItem, QItemSection, QItemLabel, QInput, QIcon,
|
|
1
|
+
import { ref, defineComponent, useAttrs, withAsyncContext, watch, openBlock, createBlock, unref, mergeProps, normalizeProps, guardReactiveProps, withCtx, createVNode, createTextVNode, toDisplayString, computed, useSlots, renderSlot, createCommentVNode, toRefs, resolveDirective, createElementBlock, Fragment, renderList, resolveDynamicComponent, createElementVNode, withDirectives } from "vue";
|
|
2
|
+
import { useQuasar, QSelect, QItem, QItemSection, QItemLabel, QInput, QDate, QIcon, QTooltip, QBtn, QPopupProxy, QField, QEditor } from "quasar";
|
|
3
3
|
const lang$1 = {
|
|
4
4
|
isoName: "en-US",
|
|
5
5
|
yes: "Yes",
|
|
@@ -36,6 +36,9 @@ const lang$1 = {
|
|
|
36
36
|
},
|
|
37
37
|
datePicker: {
|
|
38
38
|
placeholder: "YYYY/MM/DD",
|
|
39
|
+
YYYY: "YYYY",
|
|
40
|
+
MM: "MM",
|
|
41
|
+
DD: "DD",
|
|
39
42
|
validations: {
|
|
40
43
|
unavailableRange: "The selected period contains unavailable dates."
|
|
41
44
|
}
|
|
@@ -49,7 +52,7 @@ var define_import_meta_env_default = { BASE_URL: "/", MODE: "production", DEV: f
|
|
|
49
52
|
const lang = ref(lang$1);
|
|
50
53
|
const locales = /* @__PURE__ */ Object.assign({
|
|
51
54
|
"./en-US.ts": () => Promise.resolve().then(() => enUS),
|
|
52
|
-
"./nl.ts": () => import("./nl-
|
|
55
|
+
"./nl.ts": () => import("./nl-BjtwxTCz.js")
|
|
53
56
|
});
|
|
54
57
|
const useLang = () => {
|
|
55
58
|
return lang;
|
|
@@ -329,39 +332,130 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
329
332
|
__name: "DateInput",
|
|
330
333
|
props: {
|
|
331
334
|
modelValue: {},
|
|
332
|
-
|
|
335
|
+
format: { default: "YYYY-MM-DD" },
|
|
336
|
+
locale: { default: "en-US" },
|
|
337
|
+
label: { default: "" },
|
|
333
338
|
required: { type: Boolean },
|
|
334
339
|
clearable: { type: Boolean },
|
|
335
|
-
date: {}
|
|
340
|
+
date: { default: () => ({}) }
|
|
336
341
|
},
|
|
337
342
|
emits: ["update:modelValue"],
|
|
338
343
|
setup(__props, { emit: __emit }) {
|
|
339
344
|
const props = __props;
|
|
340
345
|
const emit = __emit;
|
|
341
|
-
const attrs = useAttrs();
|
|
342
346
|
const lang2 = useLang();
|
|
343
|
-
const
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
347
|
+
const { modelValue, format, locale } = toRefs(props);
|
|
348
|
+
const year = ref();
|
|
349
|
+
const month = ref();
|
|
350
|
+
const day = ref();
|
|
351
|
+
const setYear = (val) => {
|
|
352
|
+
const nr = Number(val);
|
|
353
|
+
if (nr && nr > 1e3 && nr < 1e4)
|
|
354
|
+
year.value = nr;
|
|
355
|
+
else
|
|
356
|
+
year.value = void 0;
|
|
357
|
+
};
|
|
358
|
+
const setMonth = (val) => {
|
|
359
|
+
const nr = Number(val);
|
|
360
|
+
if (nr && nr > 0 && nr < 13)
|
|
361
|
+
month.value = nr;
|
|
362
|
+
else
|
|
363
|
+
month.value = void 0;
|
|
364
|
+
};
|
|
365
|
+
const setDay = (val) => {
|
|
366
|
+
const nr = Number(val);
|
|
367
|
+
if (nr && nr > 0 && nr < 32)
|
|
368
|
+
day.value = nr;
|
|
369
|
+
else
|
|
370
|
+
day.value = void 0;
|
|
371
|
+
};
|
|
372
|
+
const setInternalDate = (dateString, separator = "-") => {
|
|
373
|
+
if (dateString) {
|
|
374
|
+
const [yearPart, monthPart, dayPart] = dateString.split(separator);
|
|
375
|
+
if (yearPart && monthPart && dayPart) {
|
|
376
|
+
year.value = Number(yearPart);
|
|
377
|
+
month.value = Number(monthPart);
|
|
378
|
+
day.value = Number(dayPart);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
};
|
|
382
|
+
const setDate = (value) => {
|
|
383
|
+
setInternalDate(value, "/");
|
|
384
|
+
};
|
|
385
|
+
watch([year, month, day], () => {
|
|
386
|
+
const date = `${year.value}-${String(month.value).padStart(2, "0")}-${String(day.value).padStart(2, "0")}`;
|
|
387
|
+
if (Date.parse(date)) {
|
|
388
|
+
emit("update:modelValue", date);
|
|
389
|
+
} else {
|
|
390
|
+
emit("update:modelValue", "");
|
|
391
|
+
}
|
|
348
392
|
});
|
|
349
|
-
const
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
393
|
+
const formattedDate = computed(() => {
|
|
394
|
+
if (modelValue.value)
|
|
395
|
+
return new Date(Date.parse(modelValue.value)).toLocaleDateString(
|
|
396
|
+
locale.value,
|
|
397
|
+
{
|
|
398
|
+
weekday: "long",
|
|
399
|
+
year: "numeric",
|
|
400
|
+
month: "short",
|
|
401
|
+
day: "numeric"
|
|
402
|
+
}
|
|
403
|
+
);
|
|
404
|
+
return "";
|
|
405
|
+
});
|
|
406
|
+
watch(modelValue, (newVal) => {
|
|
407
|
+
if (newVal)
|
|
408
|
+
setInternalDate(newVal);
|
|
409
|
+
else if (newVal === null) {
|
|
410
|
+
year.value = void 0;
|
|
411
|
+
month.value = void 0;
|
|
412
|
+
day.value = void 0;
|
|
413
|
+
}
|
|
414
|
+
});
|
|
415
|
+
setInternalDate(modelValue.value);
|
|
416
|
+
const goToNextElement = (e) => {
|
|
417
|
+
var _a, _b, _c, _d;
|
|
418
|
+
if (["Minus", "Slash"].includes(e.code)) {
|
|
419
|
+
e.preventDefault();
|
|
420
|
+
const next = (_d = (_c = (_b = (_a = e.currentTarget.parentElement) == null ? void 0 : _a.parentElement) == null ? void 0 : _b.parentElement) == null ? void 0 : _c.parentElement) == null ? void 0 : _d.nextElementSibling;
|
|
421
|
+
if (next) {
|
|
422
|
+
next.focus();
|
|
423
|
+
}
|
|
424
|
+
}
|
|
353
425
|
};
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
426
|
+
const dateProps = computed(() => ({
|
|
427
|
+
YYYY: {
|
|
428
|
+
modelValue: year.value,
|
|
429
|
+
placeholder: lang2.value.datePicker.YYYY,
|
|
430
|
+
style: "max-width: 6ch",
|
|
431
|
+
suffix: format.value === "YYYY-MM-DD" ? "-" : void 0,
|
|
432
|
+
class: format.value !== "YYYY-MM-DD" ? "q-mb-none q-ml-xs" : void 0,
|
|
433
|
+
"onUpdate:modelValue": setYear,
|
|
434
|
+
onKeydown: goToNextElement
|
|
435
|
+
},
|
|
436
|
+
MM: {
|
|
437
|
+
modelValue: month.value ? String(month.value).padStart(2, "0") : "",
|
|
438
|
+
placeholder: lang2.value.datePicker.MM,
|
|
439
|
+
style: "max-width: 4ch",
|
|
440
|
+
suffix: "-",
|
|
441
|
+
class: "q-ml-xs",
|
|
442
|
+
"onUpdate:modelValue": setMonth,
|
|
443
|
+
onKeydown: goToNextElement
|
|
444
|
+
},
|
|
445
|
+
DD: {
|
|
446
|
+
modelValue: day.value ? String(day.value).padStart(2, "0") : "",
|
|
447
|
+
placeholder: lang2.value.datePicker.DD,
|
|
448
|
+
style: "max-width: 4ch",
|
|
449
|
+
suffix: format.value === "DD-MM-YYYY" ? "-" : void 0,
|
|
450
|
+
class: format.value === "YYYY-MM-DD" ? "q-ml-xs" : void 0,
|
|
451
|
+
"onUpdate:modelValue": setDay,
|
|
452
|
+
onKeydown: goToNextElement
|
|
359
453
|
}
|
|
360
|
-
);
|
|
454
|
+
}));
|
|
361
455
|
const validations = ref([
|
|
362
456
|
(v) => {
|
|
363
457
|
if (v !== null)
|
|
364
|
-
return /^\d{4}
|
|
458
|
+
return /^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$/.test(v);
|
|
365
459
|
return true;
|
|
366
460
|
}
|
|
367
461
|
]);
|
|
@@ -371,55 +465,71 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
371
465
|
);
|
|
372
466
|
return (_ctx, _cache) => {
|
|
373
467
|
const _component_q_icon = QIcon;
|
|
468
|
+
const _component_q_tooltip = QTooltip;
|
|
374
469
|
const _component_q_btn = QBtn;
|
|
375
|
-
const _component_q_date = QDate;
|
|
376
470
|
const _component_q_popup_proxy = QPopupProxy;
|
|
471
|
+
const _component_q_field = QField;
|
|
377
472
|
const _directive_close_popup = resolveDirective("close-popup");
|
|
378
|
-
return openBlock(), createBlock(
|
|
379
|
-
rules: validations.value,
|
|
473
|
+
return openBlock(), createBlock(_component_q_field, {
|
|
380
474
|
"model-value": unref(modelValue),
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
475
|
+
"bottom-slots": "",
|
|
476
|
+
rules: validations.value,
|
|
477
|
+
label: _ctx.label,
|
|
478
|
+
"stack-label": ""
|
|
479
|
+
}, {
|
|
480
|
+
control: withCtx(() => [
|
|
481
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(format).split("-"), (part) => {
|
|
482
|
+
return openBlock(), createBlock(resolveDynamicComponent(unref(QInput)), mergeProps({
|
|
483
|
+
key: part,
|
|
484
|
+
borderless: ""
|
|
485
|
+
}, dateProps.value[part]), null, 16);
|
|
486
|
+
}), 128))
|
|
487
|
+
]),
|
|
387
488
|
append: withCtx(() => [
|
|
388
489
|
_ctx.clearable ? (openBlock(), createBlock(_component_q_icon, {
|
|
389
490
|
key: 0,
|
|
390
491
|
name: "clear",
|
|
391
492
|
class: "cursor-pointer",
|
|
392
|
-
onClick: _cache[0] || (_cache[0] = ($event) =>
|
|
493
|
+
onClick: _cache[0] || (_cache[0] = ($event) => emit("update:modelValue", null))
|
|
393
494
|
})) : createCommentVNode("", true),
|
|
394
495
|
createVNode(_component_q_icon, {
|
|
395
496
|
name: "event",
|
|
396
497
|
class: "cursor-pointer"
|
|
397
498
|
}, {
|
|
398
499
|
default: withCtx(() => [
|
|
500
|
+
formattedDate.value ? (openBlock(), createBlock(_component_q_tooltip, { key: 0 }, {
|
|
501
|
+
default: withCtx(() => [
|
|
502
|
+
createTextVNode(toDisplayString(formattedDate.value), 1)
|
|
503
|
+
]),
|
|
504
|
+
_: 1
|
|
505
|
+
})) : createCommentVNode("", true),
|
|
399
506
|
createVNode(_component_q_popup_proxy, {
|
|
400
507
|
cover: "",
|
|
401
508
|
"transition-show": "scale",
|
|
402
509
|
"transition-hide": "scale"
|
|
403
510
|
}, {
|
|
404
|
-
default: withCtx(() =>
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
511
|
+
default: withCtx(() => {
|
|
512
|
+
var _a;
|
|
513
|
+
return [
|
|
514
|
+
createVNode(unref(QDate), mergeProps(_ctx.date, {
|
|
515
|
+
"model-value": (_a = unref(modelValue)) == null ? void 0 : _a.replaceAll("-", "/"),
|
|
516
|
+
"onUpdate:modelValue": setDate
|
|
517
|
+
}), {
|
|
518
|
+
default: withCtx(() => [
|
|
519
|
+
createElementVNode("div", _hoisted_1, [
|
|
520
|
+
withDirectives(createVNode(_component_q_btn, {
|
|
521
|
+
label: unref(lang2).buttons.close,
|
|
522
|
+
color: "primary",
|
|
523
|
+
flat: ""
|
|
524
|
+
}, null, 8, ["label"]), [
|
|
525
|
+
[_directive_close_popup]
|
|
526
|
+
])
|
|
417
527
|
])
|
|
418
|
-
])
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
528
|
+
]),
|
|
529
|
+
_: 1
|
|
530
|
+
}, 16, ["model-value"])
|
|
531
|
+
];
|
|
532
|
+
}),
|
|
423
533
|
_: 1
|
|
424
534
|
})
|
|
425
535
|
]),
|
|
@@ -427,7 +537,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
427
537
|
})
|
|
428
538
|
]),
|
|
429
539
|
_: 1
|
|
430
|
-
},
|
|
540
|
+
}, 8, ["model-value", "rules", "label"]);
|
|
431
541
|
};
|
|
432
542
|
}
|
|
433
543
|
});
|
package/dist/general.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { l as loadLang, u as useLang, _ as _sfc_main$4 } from "./QSubmitButton.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
import { l as loadLang, u as useLang, _ as _sfc_main$4 } from "./QSubmitButton.vue_vue_type_script_setup_true_lang-DAnZaTMl.js";
|
|
2
2
|
import { useQuasar, QCard, QCardSection, QCardActions, QDialog, QBtn, QToolbarTitle, QToolbar, QHeader, QPage, QPageContainer, QLayout, QSpace, QPageSticky, QSelect, QItemSection, QItemLabel, QItem } from "quasar";
|
|
3
3
|
import { defineComponent, watch, ref, openBlock, createBlock, unref, withCtx, renderSlot, createVNode, createElementVNode, normalizeProps, guardReactiveProps, normalizeClass, createCommentVNode, toRefs, useAttrs, computed, mergeProps, createTextVNode, toDisplayString } from "vue";
|
|
4
|
-
import { e as enUs, n as nl } from "./en-US-
|
|
4
|
+
import { e as enUs, n as nl } from "./en-US-Duo_j_eL.js";
|
|
5
5
|
const _hoisted_1$1 = { class: "text-h6" };
|
|
6
6
|
const _hoisted_2 = { class: "text-subtitle2" };
|
|
7
7
|
const __default__$2 = {
|
package/dist/style.css
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
.card[data-v-302df27a] {
|
|
2
2
|
width: 100%;
|
|
3
3
|
max-width: 300px;
|
|
4
|
-
}
|
|
4
|
+
}
|
|
5
|
+
.q-field--auto-height .q-field__control,
|
|
6
|
+
.q-field--auto-height .q-field__native {
|
|
7
|
+
min-height: 1em;
|
|
8
|
+
}
|
|
9
|
+
.q-field--borderless .q-field__bottom,
|
|
10
|
+
.q-field--borderless.q-field--dense .q-field__control,
|
|
11
|
+
.q-field--standard .q-field__bottom,
|
|
12
|
+
.q-field--standard.q-field--dense .q-field__control {
|
|
13
|
+
padding-top: 0;
|
|
14
|
+
}
|
|
15
|
+
.q-field--auto-height.q-field--labeled .q-field__control-container {
|
|
16
|
+
padding-top: 13px;
|
|
17
|
+
}
|
|
@@ -1,16 +1,33 @@
|
|
|
1
|
-
import { QDateProps } from 'quasar';
|
|
1
|
+
import { QDateProps, QuasarLanguageCodes } from 'quasar';
|
|
2
2
|
export interface Props {
|
|
3
|
-
modelValue
|
|
3
|
+
modelValue: string | null;
|
|
4
|
+
format?: 'YYYY-MM-DD' | 'DD-MM-YYYY' | 'MM-DD-YYYY';
|
|
5
|
+
locale?: QuasarLanguageCodes;
|
|
4
6
|
label?: string;
|
|
5
7
|
required?: boolean;
|
|
6
8
|
clearable?: boolean;
|
|
7
9
|
date?: Partial<QDateProps>;
|
|
8
10
|
}
|
|
9
|
-
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<Props>, {
|
|
11
|
+
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
|
|
12
|
+
format: string;
|
|
13
|
+
locale: string;
|
|
14
|
+
label: string;
|
|
15
|
+
date: () => {};
|
|
16
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
17
|
"update:modelValue": (val: string | null) => void;
|
|
11
|
-
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<Props
|
|
18
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<Props>, {
|
|
19
|
+
format: string;
|
|
20
|
+
locale: string;
|
|
21
|
+
label: string;
|
|
22
|
+
date: () => {};
|
|
23
|
+
}>>> & {
|
|
12
24
|
"onUpdate:modelValue"?: ((val: string | null) => any) | undefined;
|
|
13
|
-
}, {
|
|
25
|
+
}, {
|
|
26
|
+
label: string;
|
|
27
|
+
date: Partial<QDateProps>;
|
|
28
|
+
format: "YYYY-MM-DD" | "DD-MM-YYYY" | "MM-DD-YYYY";
|
|
29
|
+
locale: keyof import("quasar").QuasarLanguageCodesHolder;
|
|
30
|
+
}, {}>;
|
|
14
31
|
export default _default;
|
|
15
32
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
16
33
|
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
@@ -21,3 +38,11 @@ type __VLS_TypePropsToRuntimeProps<T> = {
|
|
|
21
38
|
required: true;
|
|
22
39
|
};
|
|
23
40
|
};
|
|
41
|
+
type __VLS_WithDefaults<P, D> = {
|
|
42
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
43
|
+
default: D[K];
|
|
44
|
+
}> : P[K];
|
|
45
|
+
};
|
|
46
|
+
type __VLS_Prettify<T> = {
|
|
47
|
+
[K in keyof T]: T[K];
|
|
48
|
+
} & {};
|
|
@@ -34,6 +34,9 @@ export interface Language {
|
|
|
34
34
|
};
|
|
35
35
|
datePicker: {
|
|
36
36
|
placeholder: string;
|
|
37
|
+
YYYY: string;
|
|
38
|
+
MM: string;
|
|
39
|
+
DD: string;
|
|
37
40
|
validations: {
|
|
38
41
|
unavailableRange: string;
|
|
39
42
|
};
|
|
@@ -76,6 +79,9 @@ export declare const lang: Ref<{
|
|
|
76
79
|
};
|
|
77
80
|
datePicker: {
|
|
78
81
|
placeholder: string;
|
|
82
|
+
YYYY: string;
|
|
83
|
+
MM: string;
|
|
84
|
+
DD: string;
|
|
79
85
|
validations: {
|
|
80
86
|
unavailableRange: string;
|
|
81
87
|
};
|
package/dist/vite-plugin.js
CHANGED
|
@@ -37,17 +37,17 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
37
|
import { promises } from 'fs';
|
|
38
38
|
import { Icon, FlagIcon } from './virtualModules.js';
|
|
39
39
|
var readFile = promises.readFile;
|
|
40
|
-
export default function (
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
var
|
|
40
|
+
export default function () {
|
|
41
|
+
return __awaiter(this, arguments, void 0, function (_a) {
|
|
42
|
+
var pkgJson, _b, _c, exports, name;
|
|
43
|
+
var _d = _a === void 0 ? {} : _a, buildFromSrc = _d.buildFromSrc;
|
|
44
44
|
return __generator(this, function (_e) {
|
|
45
45
|
switch (_e.label) {
|
|
46
46
|
case 0:
|
|
47
|
-
|
|
47
|
+
_c = (_b = JSON).parse;
|
|
48
48
|
return [4 /*yield*/, readFile(new URL('../package.json', import.meta.url).pathname, 'utf-8')];
|
|
49
49
|
case 1:
|
|
50
|
-
pkgJson =
|
|
50
|
+
pkgJson = _c.apply(_b, [_e.sent()]);
|
|
51
51
|
exports = pkgJson.exports;
|
|
52
52
|
name = pkgJson.name;
|
|
53
53
|
return [2 /*return*/, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simsustech/quasar-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"author": "Stefan van Herwijnen",
|
|
5
5
|
"description": "High level components for Quasar Framework",
|
|
6
6
|
"license": "MIT",
|
|
@@ -52,26 +52,26 @@
|
|
|
52
52
|
"quasar": "^2.9.2"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@types/node": "^20.11.
|
|
56
|
-
"@types/validator": "^13.11.
|
|
55
|
+
"@types/node": "^20.11.19",
|
|
56
|
+
"@types/validator": "^13.11.9",
|
|
57
57
|
"@types/ws": "^8.5.10",
|
|
58
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
59
|
-
"@typescript-eslint/parser": "^
|
|
60
|
-
"@vitejs/plugin-vue": "^5.0.
|
|
61
|
-
"@vue/server-renderer": "^3.4.
|
|
58
|
+
"@typescript-eslint/eslint-plugin": "^7.0.1",
|
|
59
|
+
"@typescript-eslint/parser": "^7.0.1",
|
|
60
|
+
"@vitejs/plugin-vue": "^5.0.4",
|
|
61
|
+
"@vue/server-renderer": "^3.4.19",
|
|
62
62
|
"eslint": "^8.56.0",
|
|
63
63
|
"eslint-config-prettier": "^9.1.0",
|
|
64
64
|
"eslint-plugin-prettier-vue": "^5.0.0",
|
|
65
65
|
"eslint-plugin-vue": "^9.21.1",
|
|
66
66
|
"glob": "^10.3.10",
|
|
67
67
|
"local-pkg": "^0.5.0",
|
|
68
|
-
"prettier": "^3.2.
|
|
69
|
-
"quasar": "^2.14.
|
|
68
|
+
"prettier": "^3.2.5",
|
|
69
|
+
"quasar": "^2.14.4",
|
|
70
70
|
"rimraf": "^5.0.5",
|
|
71
71
|
"typescript": "^5.3.3",
|
|
72
72
|
"unplugin-vue-components": "^0.26.0",
|
|
73
|
-
"vite": "^5.
|
|
74
|
-
"vue": "^3.4.
|
|
73
|
+
"vite": "^5.1.3",
|
|
74
|
+
"vue": "^3.4.19",
|
|
75
75
|
"vue-router": "^4.2.5",
|
|
76
76
|
"vue-tsc": "^1.8.27"
|
|
77
77
|
},
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
bottom-slots
|
|
16
16
|
:rules="validations['email']"
|
|
17
17
|
lazy-rules
|
|
18
|
+
autcomplete="email"
|
|
18
19
|
/>
|
|
19
20
|
<q-input
|
|
20
21
|
v-if="useUsername"
|
|
@@ -26,6 +27,7 @@
|
|
|
26
27
|
bottom-slots
|
|
27
28
|
:rules="validations['username']"
|
|
28
29
|
lazy-rules
|
|
30
|
+
autocomplete="username"
|
|
29
31
|
/>
|
|
30
32
|
<q-input
|
|
31
33
|
id="password"
|
|
@@ -38,6 +40,7 @@
|
|
|
38
40
|
:rules="validations['password']"
|
|
39
41
|
lazy-rules
|
|
40
42
|
bottom-slots
|
|
43
|
+
autcomplete="current-password"
|
|
41
44
|
>
|
|
42
45
|
<template #append>
|
|
43
46
|
<q-icon
|
|
@@ -1,27 +1,37 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<q-
|
|
3
|
-
v-bind="attrs"
|
|
4
|
-
:rules="validations"
|
|
2
|
+
<q-field
|
|
5
3
|
:model-value="modelValue"
|
|
6
|
-
|
|
7
|
-
:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
@update:model-value="update"
|
|
4
|
+
bottom-slots
|
|
5
|
+
:rules="validations"
|
|
6
|
+
:label="label"
|
|
7
|
+
stack-label
|
|
11
8
|
>
|
|
12
|
-
<template
|
|
9
|
+
<template #control>
|
|
10
|
+
<component
|
|
11
|
+
:is="QInput"
|
|
12
|
+
v-for="part in format.split('-')"
|
|
13
|
+
:key="part"
|
|
14
|
+
borderless
|
|
15
|
+
v-bind="dateProps[part]"
|
|
16
|
+
/>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<template #append>
|
|
13
20
|
<q-icon
|
|
14
21
|
v-if="clearable"
|
|
15
22
|
name="clear"
|
|
16
23
|
class="cursor-pointer"
|
|
17
|
-
@click="
|
|
24
|
+
@click="emit('update:modelValue', null)"
|
|
18
25
|
/>
|
|
19
26
|
<q-icon name="event" class="cursor-pointer">
|
|
27
|
+
<q-tooltip v-if="formattedDate">
|
|
28
|
+
{{ formattedDate }}
|
|
29
|
+
</q-tooltip>
|
|
20
30
|
<q-popup-proxy cover transition-show="scale" transition-hide="scale">
|
|
21
31
|
<q-date
|
|
22
32
|
v-bind="date"
|
|
23
|
-
:model-value="modelValue"
|
|
24
|
-
@update:model-value="
|
|
33
|
+
:model-value="modelValue?.replaceAll('-', '/')"
|
|
34
|
+
@update:model-value="setDate"
|
|
25
35
|
>
|
|
26
36
|
<div class="row items-center justify-end">
|
|
27
37
|
<q-btn
|
|
@@ -35,51 +45,171 @@
|
|
|
35
45
|
</q-popup-proxy>
|
|
36
46
|
</q-icon>
|
|
37
47
|
</template>
|
|
38
|
-
</q-
|
|
48
|
+
</q-field>
|
|
39
49
|
</template>
|
|
40
50
|
|
|
41
51
|
<script setup lang="ts">
|
|
42
|
-
import { ref, watch,
|
|
43
|
-
import {
|
|
44
|
-
|
|
52
|
+
import { ref, watch, toRefs, computed } from 'vue'
|
|
53
|
+
import {
|
|
54
|
+
QDate,
|
|
55
|
+
QDateProps,
|
|
56
|
+
QInput,
|
|
57
|
+
QInputProps,
|
|
58
|
+
QuasarLanguageCodes
|
|
59
|
+
} from 'quasar'
|
|
60
|
+
import { useLang } from './lang'
|
|
45
61
|
|
|
46
62
|
export interface Props {
|
|
47
|
-
modelValue
|
|
63
|
+
modelValue: string | null
|
|
64
|
+
format?: 'YYYY-MM-DD' | 'DD-MM-YYYY' | 'MM-DD-YYYY'
|
|
65
|
+
locale?: QuasarLanguageCodes
|
|
48
66
|
label?: string
|
|
49
67
|
required?: boolean
|
|
50
68
|
clearable?: boolean
|
|
51
69
|
date?: Partial<QDateProps>
|
|
52
70
|
}
|
|
53
|
-
const props = defineProps<Props>()
|
|
71
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
72
|
+
format: 'YYYY-MM-DD',
|
|
73
|
+
locale: 'en-US',
|
|
74
|
+
label: '',
|
|
75
|
+
date: () => ({})
|
|
76
|
+
})
|
|
54
77
|
const emit = defineEmits<{
|
|
55
78
|
(e: 'update:modelValue', val: string | null): void
|
|
56
79
|
}>()
|
|
57
|
-
const attrs = useAttrs()
|
|
80
|
+
// const attrs = useAttrs()
|
|
58
81
|
|
|
59
82
|
const lang = useLang()
|
|
60
83
|
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
84
|
+
const { modelValue, format, locale } = toRefs(props)
|
|
85
|
+
|
|
86
|
+
const year = ref<number>()
|
|
87
|
+
const month = ref<number>()
|
|
88
|
+
const day = ref<number>()
|
|
89
|
+
|
|
90
|
+
const setYear: InstanceType<typeof QInput>['$props']['onUpdate:modelValue'] = (
|
|
91
|
+
val
|
|
92
|
+
) => {
|
|
93
|
+
const nr = Number(val)
|
|
94
|
+
if (nr && nr > 1e3 && nr < 1e4) year.value = nr
|
|
95
|
+
else year.value = undefined
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const setMonth: InstanceType<typeof QInput>['$props']['onUpdate:modelValue'] = (
|
|
99
|
+
val
|
|
100
|
+
) => {
|
|
101
|
+
const nr = Number(val)
|
|
102
|
+
if (nr && nr > 0 && nr < 13) month.value = nr
|
|
103
|
+
else month.value = undefined
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const setDay: InstanceType<typeof QInput>['$props']['onUpdate:modelValue'] = (
|
|
107
|
+
val
|
|
108
|
+
) => {
|
|
109
|
+
const nr = Number(val)
|
|
110
|
+
if (nr && nr > 0 && nr < 32) day.value = nr
|
|
111
|
+
else day.value = undefined
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const setInternalDate = (
|
|
115
|
+
dateString?: string | null,
|
|
116
|
+
separator: '-' | '/' = '-'
|
|
117
|
+
) => {
|
|
118
|
+
if (dateString) {
|
|
119
|
+
const [yearPart, monthPart, dayPart] = dateString.split(separator)
|
|
120
|
+
if (yearPart && monthPart && dayPart) {
|
|
121
|
+
year.value = Number(yearPart)
|
|
122
|
+
month.value = Number(monthPart)
|
|
123
|
+
day.value = Number(dayPart)
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const setDate: InstanceType<typeof QDate>['$props']['onUpdate:modelValue'] = (
|
|
129
|
+
value
|
|
130
|
+
) => {
|
|
131
|
+
setInternalDate(value, '/')
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
watch([year, month, day], () => {
|
|
135
|
+
const date = `${year.value}-${String(month.value).padStart(2, '0')}-${String(day.value).padStart(2, '0')}`
|
|
136
|
+
if (Date.parse(date)) {
|
|
137
|
+
emit('update:modelValue', date)
|
|
138
|
+
} else {
|
|
139
|
+
emit('update:modelValue', '')
|
|
140
|
+
}
|
|
65
141
|
})
|
|
66
142
|
|
|
67
|
-
const
|
|
143
|
+
const formattedDate = computed(() => {
|
|
144
|
+
if (modelValue.value)
|
|
145
|
+
return new Date(Date.parse(modelValue.value)).toLocaleDateString(
|
|
146
|
+
locale.value,
|
|
147
|
+
{
|
|
148
|
+
weekday: 'long',
|
|
149
|
+
year: 'numeric',
|
|
150
|
+
month: 'short',
|
|
151
|
+
day: 'numeric'
|
|
152
|
+
}
|
|
153
|
+
)
|
|
154
|
+
return ''
|
|
155
|
+
})
|
|
68
156
|
|
|
69
|
-
|
|
70
|
-
if (
|
|
157
|
+
watch(modelValue, (newVal) => {
|
|
158
|
+
if (newVal) setInternalDate(newVal)
|
|
159
|
+
else if (newVal === null) {
|
|
160
|
+
year.value = undefined
|
|
161
|
+
month.value = undefined
|
|
162
|
+
day.value = undefined
|
|
163
|
+
}
|
|
164
|
+
})
|
|
165
|
+
setInternalDate(modelValue.value)
|
|
166
|
+
|
|
167
|
+
const goToNextElement = (e: KeyboardEvent) => {
|
|
168
|
+
if (['Minus', 'Slash'].includes(e.code)) {
|
|
169
|
+
e.preventDefault()
|
|
170
|
+
const next = (e.currentTarget as HTMLElement).parentElement?.parentElement
|
|
171
|
+
?.parentElement?.parentElement?.nextElementSibling
|
|
172
|
+
if (next) {
|
|
173
|
+
;(next as HTMLElement).focus()
|
|
174
|
+
}
|
|
175
|
+
}
|
|
71
176
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
177
|
+
|
|
178
|
+
const dateProps = computed<Record<string, QInputProps>>(() => ({
|
|
179
|
+
YYYY: {
|
|
180
|
+
modelValue: year.value,
|
|
181
|
+
placeholder: lang.value.datePicker.YYYY,
|
|
182
|
+
style: 'max-width: 6ch',
|
|
183
|
+
suffix: format.value === 'YYYY-MM-DD' ? '-' : undefined,
|
|
184
|
+
class: format.value !== 'YYYY-MM-DD' ? 'q-mb-none q-ml-xs' : undefined,
|
|
185
|
+
'onUpdate:modelValue': setYear,
|
|
186
|
+
onKeydown: goToNextElement
|
|
187
|
+
},
|
|
188
|
+
MM: {
|
|
189
|
+
modelValue: month.value ? String(month.value).padStart(2, '0') : '',
|
|
190
|
+
placeholder: lang.value.datePicker.MM,
|
|
191
|
+
style: 'max-width: 4ch',
|
|
192
|
+
suffix: '-',
|
|
193
|
+
class: 'q-ml-xs',
|
|
194
|
+
'onUpdate:modelValue': setMonth,
|
|
195
|
+
onKeydown: goToNextElement
|
|
196
|
+
},
|
|
197
|
+
DD: {
|
|
198
|
+
modelValue: day.value ? String(day.value).padStart(2, '0') : '',
|
|
199
|
+
placeholder: lang.value.datePicker.DD,
|
|
200
|
+
style: 'max-width: 4ch',
|
|
201
|
+
suffix: format.value === 'DD-MM-YYYY' ? '-' : undefined,
|
|
202
|
+
class: format.value === 'YYYY-MM-DD' ? 'q-ml-xs' : undefined,
|
|
203
|
+
'onUpdate:modelValue': setDay,
|
|
204
|
+
onKeydown: goToNextElement
|
|
76
205
|
}
|
|
77
|
-
)
|
|
206
|
+
}))
|
|
78
207
|
|
|
79
208
|
const validations = ref<((val: string) => boolean | string)[]>([
|
|
80
209
|
(v) => {
|
|
81
210
|
if (v !== null)
|
|
82
|
-
return /^\d{4}\/(0?[1-9]|1[012])\/(0?[1-9]|[12][0-9]|3[01])$/.test(v)
|
|
211
|
+
// return /^\d{4}\/(0?[1-9]|1[012])\/(0?[1-9]|[12][0-9]|3[01])$/.test(v)
|
|
212
|
+
return /^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$/.test(v)
|
|
83
213
|
return true
|
|
84
214
|
}
|
|
85
215
|
])
|
|
@@ -89,3 +219,19 @@ if (props.required)
|
|
|
89
219
|
(val: string) => !!val || lang.value.validations.fieldRequired
|
|
90
220
|
)
|
|
91
221
|
</script>
|
|
222
|
+
|
|
223
|
+
<style>
|
|
224
|
+
.q-field--auto-height .q-field__control,
|
|
225
|
+
.q-field--auto-height .q-field__native {
|
|
226
|
+
min-height: 1em;
|
|
227
|
+
}
|
|
228
|
+
.q-field--borderless .q-field__bottom,
|
|
229
|
+
.q-field--borderless.q-field--dense .q-field__control,
|
|
230
|
+
.q-field--standard .q-field__bottom,
|
|
231
|
+
.q-field--standard.q-field--dense .q-field__control {
|
|
232
|
+
padding-top: 0;
|
|
233
|
+
}
|
|
234
|
+
.q-field--auto-height.q-field--labeled .q-field__control-container {
|
|
235
|
+
padding-top: 13px;
|
|
236
|
+
}
|
|
237
|
+
</style>
|
package/src/ui/form/lang/nl.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|