@simsustech/quasar-components 0.1.3 → 0.3.0

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.
Files changed (85) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/{QSubmitButton.vue_vue_type_script_setup_true_lang.1d0c06eb.js → QSubmitButton.vue_vue_type_script_setup_true_lang-b5f452c6.js} +11 -4
  3. package/dist/authentication.js +53 -27
  4. package/dist/en-US-6cc72154.js +226 -0
  5. package/dist/flags.js +5 -215
  6. package/dist/form.js +543 -0
  7. package/dist/general.js +364 -14
  8. package/dist/icons.js +5 -3
  9. package/dist/nl-38cb2607.js +134 -0
  10. package/dist/{nl.6b0aedb7.js → nl-710ec15d.js} +1 -1
  11. package/dist/nl-ea9ab282.js +38 -0
  12. package/dist/style.css +2 -2
  13. package/dist/types/ui/authentication/ConsentList.vue.d.ts +2 -58
  14. package/dist/types/ui/authentication/EmailChangeForm.vue.d.ts +20 -112
  15. package/dist/types/ui/authentication/EmailChangeStepper.vue.d.ts +13 -131
  16. package/dist/types/ui/authentication/LoginButton.vue.d.ts +9 -54
  17. package/dist/types/ui/authentication/LoginForm.vue.d.ts +20 -118
  18. package/dist/types/ui/authentication/OtpInput.vue.d.ts +4 -56
  19. package/dist/types/ui/authentication/PasswordChangeForm.vue.d.ts +31 -140
  20. package/dist/types/ui/authentication/PasswordChangeStepper.vue.d.ts +13 -131
  21. package/dist/types/ui/authentication/RegisterForm.vue.d.ts +33 -167
  22. package/dist/types/ui/authentication/RequestOtpForm.vue.d.ts +18 -100
  23. package/dist/types/ui/authentication/UserMenuButton.vue.d.ts +11 -64
  24. package/dist/types/ui/authentication/VerificationSlider.vue.d.ts +4 -60
  25. package/dist/types/ui/form/BooleanItem.vue.d.ts +15 -0
  26. package/dist/types/ui/form/BooleanSelect.vue.d.ts +18 -0
  27. package/dist/types/ui/form/DateInput.vue.d.ts +19 -0
  28. package/dist/types/ui/form/EmailInput.vue.d.ts +24 -0
  29. package/dist/types/ui/form/FormInput.vue.d.ts +18 -0
  30. package/dist/types/ui/form/FormItem.vue.d.ts +25 -0
  31. package/dist/types/ui/form/GenderItem.vue.d.ts +15 -0
  32. package/dist/types/ui/form/GenderSelect.vue.d.ts +18 -0
  33. package/dist/types/ui/form/PostalCodeInput.vue.d.ts +19 -0
  34. package/dist/types/ui/form/TelephoneNumberInput.vue.d.ts +17 -0
  35. package/dist/types/ui/form/index.d.ts +10 -0
  36. package/dist/types/ui/form/lang/en-US.d.ts +3 -0
  37. package/dist/types/ui/form/lang/index.d.ts +74 -0
  38. package/dist/types/ui/form/lang/nl.d.ts +3 -0
  39. package/dist/types/ui/general/QLanguageSelect.vue.d.ts +16 -0
  40. package/dist/types/ui/general/QStyledCard.vue.d.ts +13 -58
  41. package/dist/types/ui/general/QStyledLayout.vue.d.ts +9 -54
  42. package/dist/types/ui/general/QSubmitButton.vue.d.ts +29 -114
  43. package/dist/types/ui/general/ResourcePage.vue.d.ts +61 -0
  44. package/dist/types/ui/general/ResponsiveDialog.vue.d.ts +37 -0
  45. package/dist/types/ui/general/index.d.ts +3 -0
  46. package/dist/types/virtualModules.d.ts +1 -0
  47. package/dist/virtualModules.d.ts +1 -0
  48. package/dist/virtualModules.js +3 -2
  49. package/dist/vite-plugin.js +26 -5
  50. package/package.json +28 -23
  51. package/src/ui/authentication/EmailChangeStepper.vue +2 -2
  52. package/src/ui/authentication/PasswordChangeStepper.vue +2 -2
  53. package/src/ui/authentication/lang/en-US.ts +1 -2
  54. package/src/ui/authentication/lang/nl.ts +1 -2
  55. package/src/ui/flags/README.md +1 -1
  56. package/src/ui/form/BooleanItem.vue +34 -0
  57. package/src/ui/form/BooleanSelect.vue +55 -0
  58. package/src/ui/form/DateInput.vue +70 -0
  59. package/src/ui/form/EmailInput.vue +50 -0
  60. package/src/ui/form/FormInput.vue +44 -0
  61. package/src/ui/form/FormItem.vue +50 -0
  62. package/src/ui/form/GenderItem.vue +35 -0
  63. package/src/ui/form/GenderSelect.vue +59 -0
  64. package/src/ui/form/PostalCodeInput.vue +47 -0
  65. package/src/ui/form/TelephoneNumberInput.vue +35 -0
  66. package/src/ui/form/index.ts +10 -0
  67. package/src/ui/form/lang/en-US.ts +39 -0
  68. package/src/ui/form/lang/index.ts +73 -0
  69. package/src/ui/form/lang/nl.ts +39 -0
  70. package/src/ui/general/QLanguageSelect.vue +86 -0
  71. package/src/ui/general/QStyledCard.vue +1 -1
  72. package/src/ui/general/QSubmitButton.vue +6 -1
  73. package/src/ui/general/ResourcePage.vue +121 -0
  74. package/src/ui/general/ResponsiveDialog.vue +94 -0
  75. package/src/ui/general/index.ts +3 -0
  76. package/src/ui/icons/README.md +2 -0
  77. package/src/virtualModules.ts +48 -5
  78. package/src/vite-plugin.ts +26 -6
  79. package/vite.config.ts +30 -30
  80. package/dist/nl.b1ad9de9.js +0 -134
  81. package/dist/types/ui/index.d.ts +0 -1
  82. package/src/ui/index.ts +0 -1
  83. /package/dist/{nl.7787ff31.js → nl-022c8c63.js} +0 -0
  84. /package/dist/types/ui/icons/{icons.d.ts → labels.d.ts} +0 -0
  85. /package/src/ui/icons/{icons.ts → labels.ts} +0 -0
@@ -16,7 +16,7 @@ Tree-shakeable flag icons for Quasar Framework built with Vite.
16
16
  </template>
17
17
 
18
18
  <script setup>
19
- import {enUsIcon} from '@simsustech/quasar-components/flags'
19
+ import {enUS} from '@simsustech/quasar-components/flags'
20
20
  ...
21
21
  </script>
22
22
  ```
@@ -0,0 +1,34 @@
1
+ <template>
2
+ <q-item v-bind="attrs">
3
+ <q-item-section>
4
+ <q-item-label overline>
5
+ {{ label }}
6
+ </q-item-label>
7
+ <q-item-label>
8
+ {{ modelValue ? lang.yes : lang.no }}
9
+ </q-item-label>
10
+ </q-item-section>
11
+ </q-item>
12
+ </template>
13
+
14
+ <script setup lang="ts">
15
+ import { watch, useAttrs } from 'vue'
16
+ import { QItem, QItemLabel, QItemSection, useQuasar } from 'quasar'
17
+ import { useLang, loadLang } from './lang'
18
+
19
+ export interface Props {
20
+ modelValue: boolean
21
+ label: string
22
+ }
23
+ defineProps<Props>()
24
+
25
+ const attrs = useAttrs()
26
+
27
+ const lang = useLang()
28
+
29
+ const $q = useQuasar()
30
+ if (lang.value.isoName !== $q.lang.isoName) loadLang($q.lang.isoName)
31
+ watch($q.lang, (val) => {
32
+ loadLang($q.lang.isoName)
33
+ })
34
+ </script>
@@ -0,0 +1,55 @@
1
+ <template>
2
+ <q-select
3
+ v-bind="attrs"
4
+ :rules="validations"
5
+ :model-value="modelValue"
6
+ :options="booleanOptions"
7
+ :label="`${label}${required ? '*' : ''}`"
8
+ emit-value
9
+ map-options
10
+ @update:model-value="$emit('update:modelValue', $event)"
11
+ ></q-select>
12
+ </template>
13
+
14
+ <script setup lang="ts">
15
+ import { watch, useAttrs, ref } from 'vue'
16
+ import { QSelect, useQuasar, ValidationRule } from 'quasar'
17
+ import { useLang, loadLang } from './lang'
18
+
19
+ export interface Props {
20
+ modelValue: boolean
21
+ label?: string
22
+ required?: boolean
23
+ }
24
+ const props = defineProps<Props>()
25
+
26
+ const attrs = useAttrs()
27
+
28
+ const lang = useLang()
29
+
30
+ const $q = useQuasar()
31
+ if (lang.value.isoName !== $q.lang.isoName) loadLang($q.lang.isoName)
32
+ watch($q.lang, (val) => {
33
+ loadLang($q.lang.isoName)
34
+ })
35
+
36
+ const booleanOptions = [
37
+ {
38
+ label: lang.value.yes,
39
+ value: true
40
+ },
41
+ {
42
+ label: lang.value.no,
43
+ value: false
44
+ }
45
+ ]
46
+
47
+ const validations = ref<ValidationRule[]>([])
48
+
49
+ if (props.required)
50
+ validations.value.push(
51
+ (val: { label: string; value: string }) =>
52
+ !!val || lang.value.validations.fieldRequired
53
+ )
54
+ defineEmits(['update:modelValue'])
55
+ </script>
@@ -0,0 +1,70 @@
1
+ <template>
2
+ <q-input
3
+ v-bind="attrs"
4
+ :rules="validations"
5
+ :model-value="modelValue"
6
+ :label="`${label}${required ? '*' : ''}`"
7
+ mask="date"
8
+ class="q-pr-md"
9
+ @update:model-value="$emit('update:modelValue', $event)"
10
+ >
11
+ <template v-slot:append>
12
+ <q-icon
13
+ v-if="clearable"
14
+ name="clear"
15
+ class="cursor-pointer"
16
+ @click="$emit('update:modelValue', '')"
17
+ />
18
+ <q-icon name="event" class="cursor-pointer">
19
+ <q-popup-proxy cover transition-show="scale" transition-hide="scale">
20
+ <q-date
21
+ v-bind="date"
22
+ :model-value="modelValue"
23
+ @update:model-value="$emit('update:modelValue', $event)"
24
+ >
25
+ <div class="row items-center justify-end">
26
+ <q-btn
27
+ v-close-popup
28
+ :label="lang.buttons.close"
29
+ color="primary"
30
+ flat
31
+ />
32
+ </div>
33
+ </q-date>
34
+ </q-popup-proxy>
35
+ </q-icon>
36
+ </template>
37
+ </q-input>
38
+ </template>
39
+
40
+ <script setup lang="ts">
41
+ import { ref, watch, useAttrs } from 'vue'
42
+ import { QDateProps, QInput, useQuasar } from 'quasar'
43
+ import { useLang, loadLang } from './lang'
44
+
45
+ export interface Props {
46
+ modelValue?: string | null
47
+ label?: string
48
+ required?: boolean
49
+ clearable?: boolean
50
+ date?: Partial<QDateProps>
51
+ }
52
+ const props = defineProps<Props>()
53
+
54
+ const attrs = useAttrs()
55
+
56
+ const lang = useLang()
57
+
58
+ const $q = useQuasar()
59
+ if (lang.value.isoName !== $q.lang.isoName) loadLang($q.lang.isoName)
60
+ watch($q.lang, (val) => {
61
+ loadLang($q.lang.isoName)
62
+ })
63
+
64
+ const validations = ref<((val: string) => boolean | string)[]>([])
65
+
66
+ if (props.required)
67
+ validations.value.push(
68
+ (val: string) => !!val || lang.value.validations.fieldRequired
69
+ )
70
+ </script>
@@ -0,0 +1,50 @@
1
+ <template>
2
+ <q-input
3
+ outlined
4
+ :placeholder="lang.email.subject"
5
+ :model-value="subject"
6
+ type="text"
7
+ @update:model-value="($event) => emit('update:subject', $event)"
8
+ />
9
+ <q-editor
10
+ :model-value="body"
11
+ @update:model-value="($event) => emit('update:body', $event)"
12
+ />
13
+ </template>
14
+
15
+ <script lang="ts">
16
+ export default {
17
+ name: 'EmailInput'
18
+ }
19
+ </script>
20
+
21
+ <script setup lang="ts">
22
+ import { ref, useAttrs, watch } from 'vue'
23
+ import { useQuasar } from 'quasar'
24
+ import { useLang, loadLang } from './lang'
25
+
26
+ export interface Props {
27
+ subject: string
28
+ body: string
29
+ }
30
+ const props = defineProps<Props>()
31
+ const attrs = useAttrs()
32
+ const emit = defineEmits<{
33
+ (e: 'update:subject', value: string | number | null): void
34
+ (e: 'update:body', value: string | null): void
35
+ }>()
36
+
37
+ const $q = useQuasar()
38
+ const lang = useLang()
39
+
40
+ const variables = ref({
41
+ // header: lang.value.some.nested.prop
42
+ })
43
+ const functions = ref({
44
+ // submit
45
+ })
46
+ defineExpose({
47
+ variables,
48
+ functions
49
+ })
50
+ </script>
@@ -0,0 +1,44 @@
1
+ <template>
2
+ <q-input
3
+ v-bind="attrs"
4
+ :rules="validations"
5
+ :model-value="modelValue"
6
+ :label="`${field ? lang.fields[field] : label ? label : ''}${
7
+ required ? '*' : ''
8
+ }`"
9
+ @update:model-value="$emit('update:modelValue', $event)"
10
+ ></q-input>
11
+ </template>
12
+
13
+ <script setup lang="ts">
14
+ import { ref, watch, useAttrs } from 'vue'
15
+ import { QInput, useQuasar, ValidationRule } from 'quasar'
16
+ import { useLang, loadLang } from './lang'
17
+
18
+ export type FormItems = 'name' | 'firstName' | 'lastName' | 'address' | 'city'
19
+
20
+ export interface Props {
21
+ modelValue?: string | null
22
+ field?: FormItems
23
+ label?: string
24
+ required?: boolean
25
+ }
26
+ const props = defineProps<Props>()
27
+
28
+ const attrs = useAttrs()
29
+
30
+ const lang = useLang()
31
+
32
+ const $q = useQuasar()
33
+ if (lang.value.isoName !== $q.lang.isoName) loadLang($q.lang.isoName)
34
+ watch($q.lang, (val) => {
35
+ loadLang($q.lang.isoName)
36
+ })
37
+
38
+ const validations = ref<ValidationRule[]>([])
39
+
40
+ if (props.required)
41
+ validations.value.push(
42
+ (val: string) => !!val || lang.value.validations.fieldRequired
43
+ )
44
+ </script>
@@ -0,0 +1,50 @@
1
+ <template>
2
+ <q-item v-bind="attrs">
3
+ <q-item-section v-if="slots.avatar" avatar>
4
+ <slot name="avatar" />
5
+ </q-item-section>
6
+ <q-item-section>
7
+ <q-item-label overline>
8
+ {{ label ? label : field ? lang.fields[field] : '' }}
9
+ </q-item-label>
10
+ <q-item-label>
11
+ {{ modelValue || '-' }}
12
+ </q-item-label>
13
+ </q-item-section>
14
+ <q-item-section v-if="slots.side" side>
15
+ <slot name="side" />
16
+ </q-item-section>
17
+ </q-item>
18
+ </template>
19
+
20
+ <script setup lang="ts">
21
+ import { watch, useAttrs, useSlots } from 'vue'
22
+ import { QItem, QItemLabel, QItemSection, useQuasar } from 'quasar'
23
+ import { useLang, loadLang } from './lang'
24
+
25
+ export type FormItems =
26
+ | 'name'
27
+ | 'firstName'
28
+ | 'lastName'
29
+ | 'address'
30
+ | 'city'
31
+ | 'postalCode'
32
+
33
+ export interface Props {
34
+ modelValue?: string
35
+ label?: string
36
+ field?: FormItems
37
+ }
38
+ defineProps<Props>()
39
+
40
+ const attrs = useAttrs()
41
+ const slots = useSlots()
42
+
43
+ const lang = useLang()
44
+
45
+ const $q = useQuasar()
46
+ if (lang.value.isoName !== $q.lang.isoName) loadLang($q.lang.isoName)
47
+ watch($q.lang, (val) => {
48
+ loadLang($q.lang.isoName)
49
+ })
50
+ </script>
@@ -0,0 +1,35 @@
1
+ <template>
2
+ <q-item v-bind="attrs">
3
+ <q-item-section>
4
+ <q-item-label overline>
5
+ {{ lang.gender.gender }}
6
+ </q-item-label>
7
+ <q-item-label>
8
+ {{ modelValue ? lang.gender[modelValue] : '' }}
9
+ </q-item-label>
10
+ </q-item-section>
11
+ </q-item>
12
+ </template>
13
+
14
+ <script setup lang="ts">
15
+ import { watch, useAttrs } from 'vue'
16
+ import { QItem, QItemLabel, QItemSection, useQuasar } from 'quasar'
17
+ import { useLang, loadLang } from './lang'
18
+
19
+ import type { Gender } from './GenderSelect.vue'
20
+
21
+ export interface Props {
22
+ modelValue: Gender
23
+ }
24
+ defineProps<Props>()
25
+
26
+ const attrs = useAttrs()
27
+
28
+ const lang = useLang()
29
+
30
+ const $q = useQuasar()
31
+ if (lang.value.isoName !== $q.lang.isoName) loadLang($q.lang.isoName)
32
+ watch($q.lang, (val) => {
33
+ loadLang($q.lang.isoName)
34
+ })
35
+ </script>
@@ -0,0 +1,59 @@
1
+ <template>
2
+ <q-select
3
+ v-bind="attrs"
4
+ :rules="validations"
5
+ :model-value="modelValue"
6
+ :options="genderOptions"
7
+ :label="`${lang.gender.gender}${required ? '*' : ''}`"
8
+ emit-value
9
+ map-options
10
+ @update:model-value="$emit('update:modelValue', $event)"
11
+ ></q-select>
12
+ </template>
13
+
14
+ <script setup lang="ts">
15
+ import { watch, useAttrs, ref } from 'vue'
16
+ import { QSelect, useQuasar, ValidationRule } from 'quasar'
17
+ import { useLang, loadLang } from './lang'
18
+
19
+ export type Gender = 'male' | 'female' | 'other' | null
20
+ export interface Props {
21
+ modelValue: Gender | null
22
+ required?: boolean
23
+ }
24
+ const props = defineProps<Props>()
25
+
26
+ const attrs = useAttrs()
27
+
28
+ const lang = useLang()
29
+
30
+ const $q = useQuasar()
31
+ if (lang.value.isoName !== $q.lang.isoName) loadLang($q.lang.isoName)
32
+ watch($q.lang, (val) => {
33
+ loadLang($q.lang.isoName)
34
+ })
35
+
36
+ const genderOptions = [
37
+ {
38
+ label: lang.value.gender.male,
39
+ value: 'male'
40
+ },
41
+ {
42
+ label: lang.value.gender.female,
43
+ value: 'female'
44
+ },
45
+ {
46
+ label: lang.value.gender.other,
47
+ value: 'other'
48
+ }
49
+ ]
50
+
51
+ const validations = ref<ValidationRule[]>([])
52
+
53
+ if (props.required)
54
+ validations.value.push(
55
+ (val: { label: string; value: string }) =>
56
+ !!val || lang.value.validations.fieldRequired
57
+ )
58
+ defineEmits(['update:modelValue'])
59
+ </script>
@@ -0,0 +1,47 @@
1
+ <template>
2
+ <q-input
3
+ v-bind="attrs"
4
+ :mask="masks[locale]"
5
+ :rules="computedValidations"
6
+ :model-value="modelValue"
7
+ :label="`${lang.postalCode.postalCode}${required ? '*' : ''}`"
8
+ @update:model-value="$emit('update:modelValue', $event)"
9
+ />
10
+ </template>
11
+
12
+ <script setup lang="ts">
13
+ import { computed, ref, useAttrs } from 'vue'
14
+ import { QInput } from 'quasar'
15
+ import { useLang } from './lang'
16
+
17
+ export type PostalCodeLocales = 'nl'
18
+
19
+ export interface Props {
20
+ modelValue: string
21
+ locale: PostalCodeLocales
22
+ required?: boolean
23
+ }
24
+ const props = defineProps<Props>()
25
+ const lang = useLang()
26
+ const attrs = useAttrs()
27
+ const masks = ref({
28
+ nl: '#### AA'
29
+ })
30
+ defineEmits(['update:modelValue'])
31
+
32
+ const validations = ref({
33
+ nl: [
34
+ (val: string) =>
35
+ !val || // Do not check an empty string
36
+ /^[1-9][0-9]{3} ?(?!sa|sd|ss)[a-z]{2}$/i.test(val) ||
37
+ lang.value.postalCode.validations.invalidPostalCode
38
+ ]
39
+ })
40
+
41
+ const computedValidations = computed(() => {
42
+ const val = validations.value[props.locale]
43
+ if (props.required)
44
+ val.push((val: string) => !!val || lang.value.validations.fieldRequired)
45
+ return val
46
+ })
47
+ </script>
@@ -0,0 +1,35 @@
1
+ <template>
2
+ <q-input
3
+ v-bind="attrs"
4
+ :rules="validations"
5
+ :model-value="modelValue"
6
+ :label="`${lang.fields.telephoneNumber}${required ? '*' : ''}`"
7
+ @update:model-value="$emit('update:modelValue', $event)"
8
+ />
9
+ </template>
10
+
11
+ <script setup lang="ts">
12
+ /**
13
+ * To do: add mask and country prefix
14
+ */
15
+ import { computed, ref, useAttrs } from 'vue'
16
+ import { QInput } from 'quasar'
17
+ import { useLang } from './lang'
18
+
19
+ export interface Props {
20
+ modelValue: string
21
+ required?: boolean
22
+ }
23
+ const props = defineProps<Props>()
24
+ const lang = useLang()
25
+ const attrs = useAttrs()
26
+
27
+ defineEmits(['update:modelValue'])
28
+
29
+ const validations = ref<((val: string) => boolean | string)[]>([])
30
+
31
+ if (props.required)
32
+ validations.value.push(
33
+ (val: string) => !!val || lang.value.validations.fieldRequired
34
+ )
35
+ </script>
@@ -0,0 +1,10 @@
1
+ export { default as GenderSelect } from './GenderSelect.vue'
2
+ export { default as GenderItem } from './GenderItem.vue'
3
+ export { default as PostalCodeInput } from './PostalCodeInput.vue'
4
+ export { default as FormItem } from './FormItem.vue'
5
+ export { default as FormInput } from './FormInput.vue'
6
+ export { default as TelephoneNumberInput } from './TelephoneNumberInput.vue'
7
+ export { default as DateInput } from './DateInput.vue'
8
+ export { default as BooleanSelect } from './BooleanSelect.vue'
9
+ export { default as BooleanItem } from './BooleanItem.vue'
10
+ export { default as EmailInput } from './EmailInput.vue'
@@ -0,0 +1,39 @@
1
+ import type { Language } from '../lang'
2
+
3
+ const lang: Language = {
4
+ isoName: 'en-US',
5
+ yes: 'Yes',
6
+ no: 'No',
7
+ buttons: {
8
+ close: 'Close'
9
+ },
10
+ email: {
11
+ subject: 'Subject'
12
+ },
13
+ fields: {
14
+ name: 'Name',
15
+ firstName: 'First name',
16
+ lastName: 'Last name',
17
+ address: 'Address',
18
+ postalCode: 'Postal code',
19
+ city: 'City',
20
+ telephoneNumber: 'Telephone number'
21
+ },
22
+ validations: {
23
+ fieldRequired: 'Field is required.'
24
+ },
25
+ gender: {
26
+ gender: 'Gender',
27
+ male: 'Male',
28
+ female: 'Female',
29
+ other: 'Other'
30
+ },
31
+ postalCode: {
32
+ postalCode: 'Postal code',
33
+ validations: {
34
+ invalidPostalCode: 'Invalid postal code'
35
+ }
36
+ }
37
+ }
38
+
39
+ export default lang
@@ -0,0 +1,73 @@
1
+ export interface Language {
2
+ isoName: string
3
+ yes: string
4
+ no: string
5
+ buttons: {
6
+ close: string
7
+ }
8
+ email: {
9
+ subject: string
10
+ }
11
+ fields: {
12
+ name: string
13
+ firstName: string
14
+ lastName: string
15
+ address: string
16
+ postalCode: string
17
+ city: string
18
+ telephoneNumber: string
19
+ }
20
+ validations: {
21
+ fieldRequired: string
22
+ }
23
+ gender: {
24
+ gender: string
25
+ male: string
26
+ female: string
27
+ other: string
28
+ }
29
+ postalCode: {
30
+ postalCode: string
31
+ validations: {
32
+ invalidPostalCode: string
33
+ }
34
+ }
35
+ }
36
+
37
+ import type { Ref } from 'vue'
38
+ import { ref } from 'vue'
39
+ import en from './en-US'
40
+ export const lang = ref(en)
41
+
42
+ const locales = import.meta.glob<{ default: Language }>([
43
+ './*.ts',
44
+ '!./index.ts'
45
+ ])
46
+
47
+ export const defineLang = (lang: Language) => {
48
+ return lang
49
+ }
50
+
51
+ export const useLang = () => {
52
+ return lang as Ref<Language>
53
+ }
54
+
55
+ let loadingLanguage = false
56
+ export const loadLang = async (isoName: string) => {
57
+ if (!loadingLanguage) {
58
+ loadingLanguage = true
59
+ try {
60
+ const data = (await locales[`./${isoName}.ts`]()).default
61
+
62
+ if (data) {
63
+ lang.value = data
64
+ }
65
+ } catch (e) {
66
+ if (import.meta.env.DEBUG) console.error(e)
67
+ throw new Error(
68
+ `[quasar-components] Failed to load ${isoName} language file.`
69
+ )
70
+ }
71
+ loadingLanguage = false
72
+ }
73
+ }
@@ -0,0 +1,39 @@
1
+ import type { Language } from '../lang'
2
+
3
+ const lang: Language = {
4
+ isoName: 'nl',
5
+ yes: 'Ja',
6
+ no: 'Nee',
7
+ buttons: {
8
+ close: 'Sluiten'
9
+ },
10
+ email: {
11
+ subject: 'Onderwerp'
12
+ },
13
+ fields: {
14
+ name: 'Naam',
15
+ firstName: 'Voornaam',
16
+ lastName: 'Achternaam',
17
+ address: 'Adres',
18
+ postalCode: 'Postcode',
19
+ city: 'Woonplaats',
20
+ telephoneNumber: 'Telefoonnumer'
21
+ },
22
+ validations: {
23
+ fieldRequired: 'Veld is vereist.'
24
+ },
25
+ gender: {
26
+ gender: 'Geslacht',
27
+ male: 'Man',
28
+ female: 'Vrouw',
29
+ other: 'Anders'
30
+ },
31
+ postalCode: {
32
+ postalCode: 'Postcode',
33
+ validations: {
34
+ invalidPostalCode: 'Ongeldige postcode'
35
+ }
36
+ }
37
+ }
38
+
39
+ export default lang