@simsustech/quasar-components 0.4.0 → 0.4.2
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 +12 -0
- package/dist/form.js +19 -9
- package/dist/{nl-0cbc7f7b.js → nl-75035f8a.js} +1 -0
- package/dist/types/ui/form/DateInput.vue.d.ts +6 -2
- package/dist/types/ui/form/lang/index.d.ts +2 -0
- package/package.json +1 -1
- package/src/ui/form/DateInput.vue +15 -4
- package/src/ui/form/DatePicker.vue +1 -1
- package/src/ui/form/lang/en-US.ts +1 -0
- package/src/ui/form/lang/index.ts +1 -0
- package/src/ui/form/lang/nl.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @simsustech/quasar-components
|
|
2
2
|
|
|
3
|
+
## 0.4.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 7e6d8ea: fix(components): add DateInput placeholder translation and set null on empty value
|
|
8
|
+
|
|
9
|
+
## 0.4.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- a1de056: fix(components): fix DatePicker undefined value
|
|
14
|
+
|
|
3
15
|
## 0.4.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/form.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ref, defineComponent, useAttrs, withAsyncContext, watch, openBlock, createBlock, unref, mergeProps, normalizeProps, guardReactiveProps, withCtx, createVNode, createTextVNode, toDisplayString, computed, useSlots, renderSlot, createCommentVNode, resolveDirective, createElementVNode, withDirectives, createElementBlock, Fragment
|
|
1
|
+
import { ref, defineComponent, useAttrs, withAsyncContext, watch, openBlock, createBlock, unref, mergeProps, normalizeProps, guardReactiveProps, withCtx, createVNode, createTextVNode, toDisplayString, computed, useSlots, renderSlot, createCommentVNode, toRefs, resolveDirective, createElementVNode, withDirectives, createElementBlock, Fragment } from "vue";
|
|
2
2
|
import { useQuasar, QSelect, QItem, QItemSection, QItemLabel, QInput, QIcon, QBtn, QDate, QPopupProxy, QEditor } from "quasar";
|
|
3
3
|
const lang$1 = {
|
|
4
4
|
isoName: "en-US",
|
|
@@ -35,6 +35,7 @@ const lang$1 = {
|
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
datePicker: {
|
|
38
|
+
placeholder: "YYYY/MM/DD",
|
|
38
39
|
validations: {
|
|
39
40
|
unavailableRange: "The selected period contains unavailable dates."
|
|
40
41
|
}
|
|
@@ -47,7 +48,7 @@ const enUS = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty
|
|
|
47
48
|
const lang = ref(lang$1);
|
|
48
49
|
const locales = /* @__PURE__ */ Object.assign({
|
|
49
50
|
"./en-US.ts": () => Promise.resolve().then(() => enUS),
|
|
50
|
-
"./nl.ts": () => import("./nl-
|
|
51
|
+
"./nl.ts": () => import("./nl-75035f8a.js")
|
|
51
52
|
});
|
|
52
53
|
const useLang = () => {
|
|
53
54
|
return lang;
|
|
@@ -332,7 +333,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
332
333
|
clearable: { type: Boolean },
|
|
333
334
|
date: {}
|
|
334
335
|
},
|
|
335
|
-
|
|
336
|
+
emits: ["update:modelValue"],
|
|
337
|
+
setup(__props, { emit }) {
|
|
336
338
|
const props = __props;
|
|
337
339
|
const attrs = useAttrs();
|
|
338
340
|
const lang2 = useLang();
|
|
@@ -342,6 +344,14 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
342
344
|
watch($q.lang, () => {
|
|
343
345
|
loadLang($q.lang.isoName);
|
|
344
346
|
});
|
|
347
|
+
const { modelValue } = toRefs(props);
|
|
348
|
+
watch(
|
|
349
|
+
() => modelValue == null ? void 0 : modelValue.value,
|
|
350
|
+
(newVal) => {
|
|
351
|
+
if (newVal === "")
|
|
352
|
+
emit("update:modelValue", null);
|
|
353
|
+
}
|
|
354
|
+
);
|
|
345
355
|
const validations = ref([
|
|
346
356
|
(v) => {
|
|
347
357
|
if (v !== null)
|
|
@@ -361,9 +371,9 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
361
371
|
const _directive_close_popup = resolveDirective("close-popup");
|
|
362
372
|
return openBlock(), createBlock(unref(QInput), mergeProps(unref(attrs), {
|
|
363
373
|
rules: validations.value,
|
|
364
|
-
"model-value":
|
|
374
|
+
"model-value": unref(modelValue),
|
|
365
375
|
label: `${_ctx.label}${_ctx.required ? "*" : ""}`,
|
|
366
|
-
placeholder:
|
|
376
|
+
placeholder: unref(lang2).datePicker.placeholder,
|
|
367
377
|
mask: "date",
|
|
368
378
|
class: "q-pr-md",
|
|
369
379
|
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => _ctx.$emit("update:modelValue", $event))
|
|
@@ -373,7 +383,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
373
383
|
key: 0,
|
|
374
384
|
name: "clear",
|
|
375
385
|
class: "cursor-pointer",
|
|
376
|
-
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:modelValue",
|
|
386
|
+
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:modelValue", null))
|
|
377
387
|
})) : createCommentVNode("", true),
|
|
378
388
|
createVNode(_component_q_icon, {
|
|
379
389
|
name: "event",
|
|
@@ -387,7 +397,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
387
397
|
}, {
|
|
388
398
|
default: withCtx(() => [
|
|
389
399
|
createVNode(_component_q_date, mergeProps(_ctx.date, {
|
|
390
|
-
"model-value":
|
|
400
|
+
"model-value": unref(modelValue),
|
|
391
401
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.$emit("update:modelValue", $event))
|
|
392
402
|
}), {
|
|
393
403
|
default: withCtx(() => [
|
|
@@ -411,7 +421,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
411
421
|
})
|
|
412
422
|
]),
|
|
413
423
|
_: 1
|
|
414
|
-
}, 16, ["rules", "model-value", "label"]);
|
|
424
|
+
}, 16, ["rules", "model-value", "label", "placeholder"]);
|
|
415
425
|
};
|
|
416
426
|
}
|
|
417
427
|
});
|
|
@@ -560,7 +570,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
560
570
|
const { periods, range, options: parentOptions } = toRefs(props);
|
|
561
571
|
const update = (val) => {
|
|
562
572
|
var _a;
|
|
563
|
-
if (typeof val !== "string") {
|
|
573
|
+
if (val && typeof val !== "string") {
|
|
564
574
|
const parsedFrom = val.from.replaceAll("/", "-");
|
|
565
575
|
const parsedTo = val.to.replaceAll("/", "-");
|
|
566
576
|
const unavailablePeriods = (_a = periods == null ? void 0 : periods.value) == null ? void 0 : _a.filter(
|
|
@@ -22,7 +22,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
22
22
|
date: {
|
|
23
23
|
type: import("vue").PropType<Partial<QDateProps>>;
|
|
24
24
|
};
|
|
25
|
-
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
25
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
26
|
+
"update:modelValue": (val: string | null) => void;
|
|
27
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
26
28
|
modelValue: {
|
|
27
29
|
type: import("vue").PropType<string | null>;
|
|
28
30
|
};
|
|
@@ -38,5 +40,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
38
40
|
date: {
|
|
39
41
|
type: import("vue").PropType<Partial<QDateProps>>;
|
|
40
42
|
};
|
|
41
|
-
}
|
|
43
|
+
}>> & {
|
|
44
|
+
"onUpdate:modelValue"?: ((val: string | null) => any) | undefined;
|
|
45
|
+
}, {}, {}>;
|
|
42
46
|
export default _default;
|
|
@@ -33,6 +33,7 @@ export interface Language {
|
|
|
33
33
|
};
|
|
34
34
|
};
|
|
35
35
|
datePicker: {
|
|
36
|
+
placeholder: string;
|
|
36
37
|
validations: {
|
|
37
38
|
unavailableRange: string;
|
|
38
39
|
};
|
|
@@ -74,6 +75,7 @@ export declare const lang: Ref<{
|
|
|
74
75
|
};
|
|
75
76
|
};
|
|
76
77
|
datePicker: {
|
|
78
|
+
placeholder: string;
|
|
77
79
|
validations: {
|
|
78
80
|
unavailableRange: string;
|
|
79
81
|
};
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
:rules="validations"
|
|
5
5
|
:model-value="modelValue"
|
|
6
6
|
:label="`${label}${required ? '*' : ''}`"
|
|
7
|
-
placeholder="
|
|
7
|
+
:placeholder="lang.datePicker.placeholder"
|
|
8
8
|
mask="date"
|
|
9
9
|
class="q-pr-md"
|
|
10
10
|
@update:model-value="$emit('update:modelValue', $event)"
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
v-if="clearable"
|
|
15
15
|
name="clear"
|
|
16
16
|
class="cursor-pointer"
|
|
17
|
-
@click="$emit('update:modelValue',
|
|
17
|
+
@click="$emit('update:modelValue', null)"
|
|
18
18
|
/>
|
|
19
19
|
<q-icon name="event" class="cursor-pointer">
|
|
20
20
|
<q-popup-proxy cover transition-show="scale" transition-hide="scale">
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
</template>
|
|
40
40
|
|
|
41
41
|
<script setup lang="ts">
|
|
42
|
-
import { ref, watch, useAttrs } from 'vue'
|
|
42
|
+
import { ref, watch, useAttrs, toRefs } from 'vue'
|
|
43
43
|
import { QDateProps, QInput, useQuasar } from 'quasar'
|
|
44
44
|
import { useLang, loadLang } from './lang'
|
|
45
45
|
|
|
@@ -51,7 +51,9 @@ export interface Props {
|
|
|
51
51
|
date?: Partial<QDateProps>
|
|
52
52
|
}
|
|
53
53
|
const props = defineProps<Props>()
|
|
54
|
-
|
|
54
|
+
const emit = defineEmits<{
|
|
55
|
+
(e: 'update:modelValue', val: string | null): void
|
|
56
|
+
}>()
|
|
55
57
|
const attrs = useAttrs()
|
|
56
58
|
|
|
57
59
|
const lang = useLang()
|
|
@@ -62,6 +64,15 @@ watch($q.lang, () => {
|
|
|
62
64
|
loadLang($q.lang.isoName)
|
|
63
65
|
})
|
|
64
66
|
|
|
67
|
+
const { modelValue } = toRefs(props)
|
|
68
|
+
|
|
69
|
+
watch(
|
|
70
|
+
() => modelValue?.value,
|
|
71
|
+
(newVal) => {
|
|
72
|
+
if (newVal === '') emit('update:modelValue', null)
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
|
|
65
76
|
const validations = ref<((val: string) => boolean | string)[]>([
|
|
66
77
|
(v) => {
|
|
67
78
|
if (v !== null)
|
|
@@ -36,7 +36,7 @@ const lang = useLang()
|
|
|
36
36
|
const { periods, range, options: parentOptions } = toRefs(props)
|
|
37
37
|
|
|
38
38
|
const update = (val: { from: string; to: string } | string) => {
|
|
39
|
-
if (typeof val !== 'string') {
|
|
39
|
+
if (val && typeof val !== 'string') {
|
|
40
40
|
const parsedFrom = val.from.replaceAll('/', '-')
|
|
41
41
|
const parsedTo = val.to.replaceAll('/', '-')
|
|
42
42
|
const unavailablePeriods = periods?.value?.filter(
|