@simsustech/quasar-components 0.11.1 → 0.11.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @simsustech/quasar-components
2
2
 
3
+ ## 0.11.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 56d905c: feat(PostalCodeInput): use optional country prop instead of locale
8
+
3
9
  ## 0.11.1
4
10
 
5
11
  ### Patch 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, createSlots, renderList, toRefs, resolveDirective, createElementBlock, Fragment, resolveDynamicComponent, createElementVNode, withDirectives } from "vue";
1
+ import { ref, defineComponent, useAttrs, withAsyncContext, watch, openBlock, createBlock, unref, mergeProps, normalizeProps, guardReactiveProps, withCtx, createVNode, createTextVNode, toDisplayString, toRefs, computed, useSlots, renderSlot, createCommentVNode, createSlots, renderList, resolveDirective, createElementBlock, Fragment, resolveDynamicComponent, createElementVNode, withDirectives } from "vue";
2
2
  import { useQuasar, QSelect, QItem, QItemSection, QItemLabel, QInput, QDate, QIcon, QTooltip, QBtn, QPopupProxy, QField, QEditor } from "quasar";
3
3
  import { f as flags, u as useLang$1 } from "./index-DnmJt2wP.js";
4
4
  const lang$1 = {
@@ -197,7 +197,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
197
197
  __name: "PostalCodeInput",
198
198
  props: {
199
199
  modelValue: {},
200
- locale: {},
200
+ country: {},
201
201
  required: { type: Boolean }
202
202
  },
203
203
  emits: ["update:modelValue"],
@@ -205,24 +205,32 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
205
205
  const props = __props;
206
206
  const lang2 = useLang();
207
207
  const attrs = useAttrs();
208
+ const { country } = toRefs(props);
208
209
  const masks = ref({
209
- nl: "#### AA"
210
+ NL: "#### AA"
210
211
  });
211
212
  const validations = ref({
212
- nl: [
213
+ NL: [
213
214
  (val) => !val || // Do not check an empty string
214
215
  /^[1-9][0-9]{3} ?(?!sa|sd|ss)[a-z]{2}$/i.test(val) || lang2.value.postalCode.validations.invalidPostalCode
215
216
  ]
216
217
  });
218
+ const computedMask = computed(() => {
219
+ if (country.value && masks.value[country.value])
220
+ return masks.value[country.value];
221
+ return void 0;
222
+ });
217
223
  const computedValidations = computed(() => {
218
- const val = validations.value[props.locale];
224
+ const val = [];
225
+ if (country.value && validations.value[country.value])
226
+ val.push(...validations.value[country.value]);
219
227
  if (props.required)
220
228
  val.push((val2) => !!val2 || lang2.value.validations.fieldRequired);
221
229
  return val;
222
230
  });
223
231
  return (_ctx, _cache) => {
224
232
  return openBlock(), createBlock(unref(QInput), mergeProps(unref(attrs), {
225
- mask: masks.value[_ctx.locale],
233
+ mask: computedMask.value,
226
234
  rules: computedValidations.value,
227
235
  "model-value": _ctx.modelValue,
228
236
  label: `${unref(lang2).postalCode.postalCode}${_ctx.required ? "*" : ""}`,
@@ -26,7 +26,7 @@ declare const _default: <T extends Account>(__VLS_props: NonNullable<Awaited<typ
26
26
  }) => any) | undefined;
27
27
  readonly "onUpdate:pagination"?: ((pagination: Pagination) => any) | undefined;
28
28
  readonly "onUpdate:criteria"?: ((criteria: Criteria) => any) | undefined;
29
- } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onAddRole" | "onRemoveRole" | "onUpdate:pagination" | "onUpdate:criteria"> & {
29
+ } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onAddRole" | "onRemoveRole" | "onUpdate:pagination" | "onUpdate:criteria"> & Partial<{}> & {
30
30
  modelValue: T[];
31
31
  count: number;
32
32
  pagination: Pagination;
@@ -1,10 +1,9 @@
1
- declare const _default: import("vue").DefineComponent<{
1
+ type __VLS_Props = {
2
2
  modelValue: string;
3
- }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
3
+ };
4
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
4
5
  "update:modelValue": (...args: any[]) => void;
5
- }, string, import("vue").PublicProps, Readonly<{
6
- modelValue: string;
7
- }> & Readonly<{
6
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
8
7
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
9
8
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
9
  export default _default;
@@ -3,7 +3,7 @@ export interface Period {
3
3
  endDate: string;
4
4
  type: 'unavailable';
5
5
  }
6
- declare const _default: import("vue").DefineComponent<{
6
+ type __VLS_Props = {
7
7
  modelValue: string | null | undefined | {
8
8
  from: string;
9
9
  to: string;
@@ -11,20 +11,13 @@ declare const _default: import("vue").DefineComponent<{
11
11
  periods?: Period[];
12
12
  range?: boolean;
13
13
  options?: (date: string) => boolean;
14
- }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
14
+ };
15
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
15
16
  "update:modelValue": (val: string | {
16
17
  from: string;
17
18
  to: string;
18
19
  }) => any;
19
- }, string, import("vue").PublicProps, Readonly<{
20
- modelValue: string | null | undefined | {
21
- from: string;
22
- to: string;
23
- };
24
- periods?: Period[];
25
- range?: boolean;
26
- options?: (date: string) => boolean;
27
- }> & Readonly<{
20
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
28
21
  "onUpdate:modelValue"?: ((val: string | {
29
22
  from: string;
30
23
  to: string;
@@ -9,7 +9,7 @@ declare const _default: <T extends {
9
9
  done: (success?: boolean) => void;
10
10
  }) => any) | undefined;
11
11
  readonly "onUpdate:model-value"?: ((id: number) => any) | undefined;
12
- } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onFilter" | "onUpdate:model-value"> & {
12
+ } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onFilter" | "onUpdate:model-value"> & Partial<{}> & {
13
13
  modelValue?: number | number[] | null;
14
14
  labelKey: string;
15
15
  labelFunction?: (option: unknown) => string;
@@ -6,9 +6,10 @@ export interface Props {
6
6
  required?: boolean;
7
7
  }
8
8
  declare function __VLS_template(): {
9
+ attrs: Partial<{}>;
9
10
  slots: Partial<Record<NonNullable<string | number>, (_: any) => any>>;
10
11
  refs: {};
11
- attrs: Partial<{}>;
12
+ rootEl: any;
12
13
  };
13
14
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
14
15
  declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -5,12 +5,13 @@ export interface Props {
5
5
  field?: FormItems;
6
6
  }
7
7
  declare function __VLS_template(): {
8
+ attrs: Partial<{}>;
8
9
  slots: {
9
10
  avatar?(_: {}): any;
10
11
  side?(_: {}): any;
11
12
  };
12
13
  refs: {};
13
- attrs: Partial<{}>;
14
+ rootEl: any;
14
15
  };
15
16
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
16
17
  declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -1,7 +1,7 @@
1
- export type PostalCodeLocales = 'nl';
1
+ export type PostalCodeCountries = 'NL';
2
2
  export interface Props {
3
3
  modelValue?: string;
4
- locale: PostalCodeLocales;
4
+ country?: PostalCodeCountries;
5
5
  required?: boolean;
6
6
  }
7
7
  declare const _default: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
@@ -1,9 +1,10 @@
1
1
  declare function __VLS_template(): {
2
+ attrs: Partial<{}>;
2
3
  slots: {
3
4
  default?(_: {}): any;
4
5
  };
5
6
  refs: {};
6
- attrs: Partial<{}>;
7
+ rootEl: any;
7
8
  };
8
9
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
9
10
  declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simsustech/quasar-components",
3
- "version": "0.11.1",
3
+ "version": "0.11.2",
4
4
  "author": "Stefan van Herwijnen",
5
5
  "description": "High level components for Quasar Framework",
6
6
  "license": "MIT",
@@ -49,34 +49,34 @@
49
49
  "validator": "^13.12.0"
50
50
  },
51
51
  "peerDependencies": {
52
- "quasar": "^2.15.2"
52
+ "quasar": "^2.17.4"
53
53
  },
54
54
  "devDependencies": {
55
- "@types/node": "^22.7.5",
55
+ "@types/node": "^22.10.0",
56
56
  "@types/validator": "^13.12.2",
57
- "@types/ws": "^8.5.12",
58
- "@typescript-eslint/eslint-plugin": "^8.8.1",
59
- "@typescript-eslint/parser": "^8.8.1",
60
- "@vitejs/plugin-vue": "^5.1.4",
61
- "@vue/server-renderer": "^3.5.11",
62
- "eslint": "^9.12.0",
57
+ "@types/ws": "^8.5.13",
58
+ "@typescript-eslint/eslint-plugin": "^8.16.0",
59
+ "@typescript-eslint/parser": "^8.16.0",
60
+ "@vitejs/plugin-vue": "^5.2.1",
61
+ "@vue/server-renderer": "^3.5.13",
62
+ "eslint": "^9.15.0",
63
63
  "eslint-config-prettier": "^9.1.0",
64
64
  "eslint-plugin-prettier": "^5.2.1",
65
65
  "eslint-plugin-prettier-vue": "^5.0.0",
66
- "eslint-plugin-vue": "^9.28.0",
66
+ "eslint-plugin-vue": "^9.31.0",
67
67
  "glob": "^11.0.0",
68
- "local-pkg": "^0.5.0",
69
- "prettier": "^3.3.3",
70
- "quasar": "^2.17.0",
68
+ "local-pkg": "^0.5.1",
69
+ "prettier": "^3.4.1",
70
+ "quasar": "^2.17.4",
71
71
  "rimraf": "^6.0.1",
72
- "typescript": "^5.6.3",
73
- "typescript-eslint": "^8.8.1",
74
- "unplugin-vue-components": "^0.27.4",
75
- "vite": "^5.4.8",
76
- "vue": "^3.5.11",
72
+ "typescript": "5.6.3",
73
+ "typescript-eslint": "^8.16.0",
74
+ "unplugin-vue-components": "^0.27.5",
75
+ "vite": "^6.0.1",
76
+ "vue": "^3.5.13",
77
77
  "vue-eslint-parser": "^9.4.3",
78
- "vue-router": "^4.4.5",
79
- "vue-tsc": "^2.1.6"
78
+ "vue-router": "^4.5.0",
79
+ "vue-tsc": "^2.1.10"
80
80
  },
81
81
  "scripts": {
82
82
  "build:plugin": "vite build",
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <q-input
3
3
  v-bind="attrs"
4
- :mask="masks[locale]"
4
+ :mask="computedMask"
5
5
  :rules="computedValidations"
6
6
  :model-value="modelValue"
7
7
  :label="`${lang.postalCode.postalCode}${required ? '*' : ''}`"
@@ -10,27 +10,30 @@
10
10
  </template>
11
11
 
12
12
  <script setup lang="ts">
13
- import { computed, ref, useAttrs } from 'vue'
13
+ import { computed, ref, toRefs, useAttrs } from 'vue'
14
14
  import { QInput } from 'quasar'
15
15
  import { useLang } from './lang'
16
16
 
17
- export type PostalCodeLocales = 'nl'
17
+ export type PostalCodeCountries = 'NL'
18
18
 
19
19
  export interface Props {
20
20
  modelValue?: string
21
- locale: PostalCodeLocales
21
+ country?: PostalCodeCountries
22
22
  required?: boolean
23
23
  }
24
24
  const props = defineProps<Props>()
25
25
  const lang = useLang()
26
26
  const attrs = useAttrs()
27
+
28
+ const { country } = toRefs(props)
29
+
27
30
  const masks = ref({
28
- nl: '#### AA'
31
+ NL: '#### AA'
29
32
  })
30
33
  defineEmits(['update:modelValue'])
31
34
 
32
35
  const validations = ref({
33
- nl: [
36
+ NL: [
34
37
  (val: string) =>
35
38
  !val || // Do not check an empty string
36
39
  /^[1-9][0-9]{3} ?(?!sa|sd|ss)[a-z]{2}$/i.test(val) ||
@@ -38,8 +41,16 @@ const validations = ref({
38
41
  ]
39
42
  })
40
43
 
44
+ const computedMask = computed(() => {
45
+ if (country.value && masks.value[country.value])
46
+ return masks.value[country.value]
47
+ return undefined
48
+ })
49
+
41
50
  const computedValidations = computed(() => {
42
- const val = validations.value[props.locale]
51
+ const val = []
52
+ if (country.value && validations.value[country.value])
53
+ val.push(...validations.value[country.value])
43
54
  if (props.required)
44
55
  val.push((val: string) => !!val || lang.value.validations.fieldRequired)
45
56
  return val
File without changes