@simsustech/quasar-components 0.11.10 → 0.11.12

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 (69) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/LocaleSelect.vue_vue_type_script_setup_true_lang-Du4fNbTV.js +573 -0
  3. package/dist/authentication.js +152 -66
  4. package/dist/form.js +155 -300
  5. package/dist/general.js +44 -195
  6. package/dist/md3.js +459 -0
  7. package/dist/{nl-BTgHOvpQ.js → nl-BJwNz421.js} +70 -0
  8. package/dist/{nl-jHKPHlmh.js → nl-CneFq5NZ.js} +4 -0
  9. package/dist/nl-NLgZUAKl.js +6 -0
  10. package/dist/types/ui/authentication/EmailChangeForm.vue.d.ts +2 -2
  11. package/dist/types/ui/authentication/LoginButton.vue.d.ts +1 -1
  12. package/dist/types/ui/authentication/LoginForm.vue.d.ts +2 -2
  13. package/dist/types/ui/authentication/LogoutButton.vue.d.ts +12 -0
  14. package/dist/types/ui/authentication/LogoutForm.vue.d.ts +18 -0
  15. package/dist/types/ui/authentication/PasswordChangeForm.vue.d.ts +2 -2
  16. package/dist/types/ui/authentication/RegisterForm.vue.d.ts +2 -2
  17. package/dist/types/ui/authentication/RequestOtpForm.vue.d.ts +2 -2
  18. package/dist/types/ui/authentication/UserMenuButton.vue.d.ts +1 -1
  19. package/dist/types/ui/authentication/index.d.ts +2 -0
  20. package/dist/types/ui/authentication/lang/index.d.ts +12 -0
  21. package/dist/types/ui/form/DateInput.vue.d.ts +11 -1
  22. package/dist/types/ui/form/FormInput.vue.d.ts +2 -15
  23. package/dist/types/ui/form/FormItem.vue.d.ts +2 -19
  24. package/dist/types/ui/form/LocaleSelect.vue.d.ts +6 -4
  25. package/dist/types/ui/form/lang/index.d.ts +1131 -0
  26. package/dist/types/ui/general/QDrawerList.vue.d.ts +2 -7
  27. package/dist/types/ui/general/QLanguageSelect.vue.d.ts +7 -4
  28. package/dist/types/ui/general/QStyledCard.vue.d.ts +9 -5
  29. package/dist/types/ui/general/QStyledLayout.vue.d.ts +1 -1
  30. package/dist/types/ui/general/QSubmitButton.vue.d.ts +1 -1
  31. package/dist/types/ui/general/ResourcePage.vue.d.ts +9 -5
  32. package/dist/types/ui/general/ResponsiveDialog.vue.d.ts +3 -2
  33. package/dist/types/ui/general/index.d.ts +0 -1
  34. package/dist/types/ui/md3/Md3Layout.vue.d.ts +31 -0
  35. package/dist/types/ui/md3/NavigationRailFabs.vue.d.ts +15 -0
  36. package/dist/types/ui/md3/index.d.ts +3 -0
  37. package/dist/types/ui/md3/lang/en-US.d.ts +3 -0
  38. package/dist/types/ui/md3/lang/index.d.ts +12 -0
  39. package/dist/types/ui/md3/lang/nl.d.ts +3 -0
  40. package/package.json +21 -14
  41. package/src/ui/authentication/LogoutButton.vue +31 -0
  42. package/src/ui/authentication/LogoutForm.vue +49 -0
  43. package/src/ui/authentication/UserMenuButton.vue +1 -1
  44. package/src/ui/authentication/index.ts +2 -0
  45. package/src/ui/authentication/lang/en-US.ts +4 -0
  46. package/src/ui/authentication/lang/index.ts +4 -0
  47. package/src/ui/authentication/lang/nl.ts +4 -0
  48. package/src/ui/form/DateInput.vue +42 -23
  49. package/src/ui/form/LocaleSelect.vue +29 -43
  50. package/src/ui/form/lang/en-US.ts +377 -0
  51. package/src/ui/form/lang/index.ts +377 -0
  52. package/src/ui/form/lang/nl.ts +377 -0
  53. package/src/ui/general/QLanguageSelect.vue +30 -106
  54. package/src/ui/general/{QLanguageSelectBtn.vue → QLanguageSelectBtn.vue.bak} +1 -1
  55. package/src/ui/general/QStyledCard.vue +2 -2
  56. package/src/ui/general/ResponsiveDialog.vue +14 -4
  57. package/src/ui/general/index.ts +1 -1
  58. package/src/ui/md3/Md3Layout.vue +142 -0
  59. package/src/ui/md3/NavigationRailFabs.vue +89 -0
  60. package/src/ui/md3/index.ts +3 -0
  61. package/src/ui/md3/lang/en-US.ts +7 -0
  62. package/src/ui/md3/lang/index.ts +41 -0
  63. package/src/ui/md3/lang/nl.ts +7 -0
  64. package/vite.config.ts +4 -3
  65. package/dist/flags.js +0 -255
  66. package/dist/icons.js +0 -25
  67. package/dist/index-DnmJt2wP.js +0 -7921
  68. package/dist/nl-BL9hHEHL.js +0 -76
  69. package/dist/types/ui/general/QLanguageSelectBtn.vue.d.ts +0 -11
@@ -1,12 +1,7 @@
1
- import { QList } from 'quasar';
2
- declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
3
1
  declare var __VLS_6: {};
4
- type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
2
+ type __VLS_Slots = {} & {
5
3
  default?: (props: typeof __VLS_6) => any;
6
- }>;
7
- declare const __VLS_self: import("vue").DefineComponent<{}, {
8
- QList: typeof QList;
9
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
4
+ };
10
5
  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>;
11
6
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
12
7
  export default _default;
@@ -1,11 +1,14 @@
1
1
  import { QuasarLanguage } from 'quasar';
2
- import { useLang as useFlagsLang } from '../flags/lang/index.js';
2
+ import type { Language as FormLanguage } from '../form/lang/index.js';
3
3
  export interface Props {
4
- modelValue: string;
5
- languageImports: Record<string, () => Promise<{
4
+ modelValue: keyof FormLanguage['countries'];
5
+ languageImports: Record<keyof FormLanguage['countries'], () => Promise<{
6
6
  default: QuasarLanguage;
7
7
  }>>;
8
- allowedCodes?: [keyof ReturnType<typeof useFlagsLang>['value']['languages']];
8
+ locales: {
9
+ icon: string;
10
+ isoName: keyof FormLanguage['languages'];
11
+ }[];
9
12
  }
10
13
  declare const _default: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
14
  export default _default;
@@ -6,11 +6,15 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props, {
6
6
  variables: import("vue").Ref<{}, {}>;
7
7
  functions: import("vue").Ref<{}, {}>;
8
8
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
9
- image?: ((props: {}) => any) | undefined;
10
- title?: ((props: {}) => any) | undefined;
11
- subtitle?: ((props: {}) => any) | undefined;
12
- default?: ((props: {}) => any) | undefined;
13
- actions?: ((props: {}) => any) | undefined;
9
+ image?: (props: {}) => any;
10
+ } & {
11
+ title?: (props: {}) => any;
12
+ } & {
13
+ subtitle?: (props: {}) => any;
14
+ } & {
15
+ default?: (props: {}) => any;
16
+ } & {
17
+ actions?: (props: {}) => any;
14
18
  }>;
15
19
  export default _default;
16
20
  type __VLS_WithSlots<T, S> = T & {
@@ -5,7 +5,7 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props, {
5
5
  variables: import("vue").Ref<{}, {}>;
6
6
  functions: import("vue").Ref<{}, {}>;
7
7
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
8
- leftDrawerItems?: ((props: {}) => any) | undefined;
8
+ leftDrawerItems?: (props: {}) => any;
9
9
  }>;
10
10
  export default _default;
11
11
  type __VLS_WithSlots<T, S> = T & {
@@ -20,7 +20,7 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props, {},
20
20
  color: string;
21
21
  loading: boolean;
22
22
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
23
- default?: ((props: {}) => any) | undefined;
23
+ default?: (props: {}) => any;
24
24
  }>;
25
25
  export default _default;
26
26
  type __VLS_WithSlots<T, S> = T & {
@@ -36,11 +36,15 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props, {},
36
36
  topBarFab: boolean;
37
37
  topBarShrink: boolean;
38
38
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
39
- default?: ((props: {}) => any) | undefined;
40
- fab?: ((props: {}) => any) | undefined;
41
- header?: ((props: {}) => any) | undefined;
42
- 'top-bar-buttons'?: ((props: {}) => any) | undefined;
43
- 'header-side'?: ((props: {}) => any) | undefined;
39
+ default?: (props: {}) => any;
40
+ } & {
41
+ fab?: (props: {}) => any;
42
+ } & {
43
+ header?: (props: {}) => any;
44
+ } & {
45
+ 'top-bar-buttons'?: (props: {}) => any;
46
+ } & {
47
+ 'header-side'?: (props: {}) => any;
44
48
  }>;
45
49
  export default _default;
46
50
  type __VLS_WithSlots<T, S> = T & {
@@ -35,8 +35,9 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<Props, {
35
35
  };
36
36
  buttonType: "submit" | "send";
37
37
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
38
- title?: ((props: {}) => any) | undefined;
39
- default?: ((props: {}) => any) | undefined;
38
+ title?: (props: {}) => any;
39
+ } & {
40
+ default?: (props: {}) => any;
40
41
  }>;
41
42
  export default _default;
42
43
  type __VLS_WithSlots<T, S> = T & {
@@ -3,6 +3,5 @@ export { default as QStyledCard } from './QStyledCard.vue';
3
3
  export { default as ResponsiveDialog } from './ResponsiveDialog.vue';
4
4
  export { default as ResourcePage } from './ResourcePage.vue';
5
5
  export { default as QLanguageSelect } from './QLanguageSelect.vue';
6
- export { default as QLanguageSelectBtn } from './QLanguageSelectBtn.vue';
7
6
  export { default as QDrawerList } from './QDrawerList.vue';
8
7
  export { useLang, loadLang } from './lang/index.js';
@@ -0,0 +1,31 @@
1
+ interface Props {
2
+ ready?: boolean;
3
+ }
4
+ declare var __VLS_22: {}, __VLS_44: {
5
+ showSticky: boolean;
6
+ }, __VLS_46: {}, __VLS_48: {}, __VLS_54: {}, __VLS_64: {
7
+ showSticky: boolean;
8
+ };
9
+ type __VLS_Slots = {} & {
10
+ 'header-toolbar'?: (props: typeof __VLS_22) => any;
11
+ } & {
12
+ fabs?: (props: typeof __VLS_44) => any;
13
+ } & {
14
+ 'drawer-mini-navigation'?: (props: typeof __VLS_46) => any;
15
+ } & {
16
+ drawer?: (props: typeof __VLS_48) => any;
17
+ } & {
18
+ footer?: (props: typeof __VLS_54) => any;
19
+ } & {
20
+ fabs?: (props: typeof __VLS_64) => any;
21
+ };
22
+ declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
23
+ ready: boolean;
24
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
25
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
26
+ export default _default;
27
+ type __VLS_WithSlots<T, S> = T & {
28
+ new (): {
29
+ $slots: S;
30
+ };
31
+ };
@@ -0,0 +1,15 @@
1
+ interface Props {
2
+ type?: 'add' | 'edit';
3
+ showSticky?: boolean;
4
+ seekAttention?: boolean;
5
+ busEmits: {
6
+ add?: string;
7
+ edit?: string;
8
+ };
9
+ icons?: {
10
+ add: string;
11
+ edit: string;
12
+ };
13
+ }
14
+ declare const _default: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
15
+ export default _default;
@@ -0,0 +1,3 @@
1
+ export { default as NavigationRailFabs } from './NavigationRailFabs.vue';
2
+ export { default as Md3Layout } from './Md3Layout.vue';
3
+ export { useLang, loadLang } from './lang/index.js';
@@ -0,0 +1,3 @@
1
+ import type { Language } from '../lang';
2
+ declare const lang: Language;
3
+ export default lang;
@@ -0,0 +1,12 @@
1
+ export interface Language {
2
+ isoName: string;
3
+ }
4
+ import type { Ref } from 'vue';
5
+ export declare const lang: Ref<{
6
+ isoName: string;
7
+ }, Language | {
8
+ isoName: string;
9
+ }>;
10
+ export declare const defineLang: (lang: Language) => Language;
11
+ export declare const useLang: () => Ref<Language>;
12
+ export declare const loadLang: (isoName: string) => Promise<void>;
@@ -0,0 +1,3 @@
1
+ import type { Language } from '../lang';
2
+ declare const lang: Language;
3
+ export default lang;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simsustech/quasar-components",
3
- "version": "0.11.10",
3
+ "version": "0.11.12",
4
4
  "author": "Stefan van Herwijnen",
5
5
  "description": "High level components for Quasar Framework",
6
6
  "license": "MIT",
@@ -32,6 +32,11 @@
32
32
  "import": "./dist/form.js",
33
33
  "src": "./src/ui/form/index.ts"
34
34
  },
35
+ "./md3": {
36
+ "types": "./dist/types/ui/md3/index.d.ts",
37
+ "import": "./dist/md3.js",
38
+ "src": "./src/ui/md3/index.ts"
39
+ },
35
40
  "./css": {
36
41
  "import": "./dist/quasar-components.css"
37
42
  },
@@ -46,37 +51,39 @@
46
51
  },
47
52
  "bugs": "https://github.com/simsusech/quasar-components/issues",
48
53
  "dependencies": {
54
+ "@vueuse/core": "^13.1.0",
49
55
  "validator": "^13.15.0"
50
56
  },
51
57
  "peerDependencies": {
52
58
  "quasar": "^2.18.1"
53
59
  },
54
60
  "devDependencies": {
55
- "@types/node": "^22.14.0",
56
- "@types/validator": "^13.12.3",
61
+ "@iconify-json/flagpack": "^1.2.2",
62
+ "@types/node": "^22.15.3",
63
+ "@types/validator": "^13.15.0",
57
64
  "@types/ws": "^8.18.1",
58
- "@typescript-eslint/eslint-plugin": "^8.29.0",
59
- "@typescript-eslint/parser": "^8.29.0",
65
+ "@typescript-eslint/eslint-plugin": "^8.31.1",
66
+ "@typescript-eslint/parser": "^8.31.1",
60
67
  "@vitejs/plugin-vue": "^5.2.3",
61
68
  "@vue/server-renderer": "^3.5.13",
62
- "eslint": "^9.24.0",
63
- "eslint-config-prettier": "^10.1.1",
69
+ "eslint": "^9.25.1",
70
+ "eslint-config-prettier": "^10.1.2",
64
71
  "eslint-plugin-prettier": "^5.2.6",
65
72
  "eslint-plugin-prettier-vue": "^5.0.0",
66
- "eslint-plugin-vue": "^10.0.0",
67
- "glob": "^11.0.1",
73
+ "eslint-plugin-vue": "^10.1.0",
74
+ "glob": "^11.0.2",
68
75
  "local-pkg": "^1.1.1",
69
76
  "prettier": "^3.5.3",
70
77
  "quasar": "^2.18.1",
71
78
  "rimraf": "^6.0.1",
72
79
  "typescript": "5.8.3",
73
- "typescript-eslint": "^8.29.0",
74
- "unplugin-vue-components": "^28.4.1",
75
- "vite": "^6.2.5",
80
+ "typescript-eslint": "^8.31.1",
81
+ "unplugin-vue-components": "^28.5.0",
82
+ "vite": "^6.3.4",
76
83
  "vue": "^3.5.13",
77
84
  "vue-eslint-parser": "^10.1.3",
78
- "vue-router": "^4.5.0",
79
- "vue-tsc": "^2.2.8"
85
+ "vue-router": "^4.5.1",
86
+ "vue-tsc": "^2.2.10"
80
87
  },
81
88
  "scripts": {
82
89
  "build:plugin": "vite build",
@@ -0,0 +1,31 @@
1
+ <template>
2
+ <q-submit-button>
3
+ <slot name="icon" />
4
+ {{ lang.logout.logout }}
5
+ </q-submit-button>
6
+ </template>
7
+
8
+ <script lang="ts">
9
+ export default {
10
+ name: 'LogoutButton'
11
+ }
12
+ </script>
13
+
14
+ <script setup lang="ts">
15
+ import { watch } from 'vue'
16
+ import { useQuasar } from 'quasar'
17
+ import { useLang, loadLang } from './lang/index.js'
18
+ import QSubmitButton from '../general/QSubmitButton.vue'
19
+
20
+ export interface Props {
21
+ withNetwork?: string
22
+ }
23
+ defineProps<Props>()
24
+
25
+ const $q = useQuasar()
26
+ const lang = useLang()
27
+ if (lang.value.isoName !== $q.lang.isoName) loadLang($q.lang.isoName)
28
+ watch($q.lang, (val) => {
29
+ loadLang($q.lang.isoName)
30
+ })
31
+ </script>
@@ -0,0 +1,49 @@
1
+ <template>
2
+ {{ lang.logout.confirmation }}
3
+ <q-form
4
+ ref="formRef"
5
+ data-allow-mismatch="props"
6
+ class="q-gutter-md"
7
+ v-bind="form"
8
+ method="post"
9
+ :action="action"
10
+ >
11
+ <input type="hidden" name="xsrf" :value="xsrfSecret" />
12
+ <slot name="default" />
13
+ </q-form>
14
+ </template>
15
+
16
+ <script lang="ts">
17
+ export default {
18
+ name: 'LoginForm'
19
+ }
20
+ </script>
21
+
22
+ <script setup lang="ts">
23
+ import { ref, watch } from 'vue'
24
+ import { useQuasar, QFormProps, QForm } from 'quasar'
25
+ import { useLang, loadLang } from './lang'
26
+
27
+ export interface Props {
28
+ form?: QFormProps & Partial<HTMLFormElement> & Partial<HTMLDivElement>
29
+ action: string
30
+ xsrfSecret: string
31
+ }
32
+ defineProps<Props>()
33
+
34
+ const $q = useQuasar()
35
+ const lang = useLang()
36
+ if (lang.value.isoName !== $q.lang.isoName) loadLang($q.lang.isoName)
37
+ watch($q.lang, (val) => {
38
+ loadLang($q.lang.isoName)
39
+ })
40
+
41
+ const formRef = ref<QForm>()
42
+
43
+ const variables = ref({})
44
+ const functions = ref({})
45
+ defineExpose({
46
+ variables,
47
+ functions
48
+ })
49
+ </script>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <q-btn :icon="personIcon">
2
+ <q-btn :icon="personIcon" round>
3
3
  <q-menu>
4
4
  <q-list>
5
5
  <q-item :to="userRoute">
@@ -11,4 +11,6 @@ export { default as ConsentList } from './ConsentList.vue'
11
11
  export { default as UserMenuButton } from './UserMenuButton.vue'
12
12
  export { default as LoginButton } from './LoginButton.vue'
13
13
  export { default as AccountsTable } from './AccountsTable.vue'
14
+ export { default as LogoutForm } from './LogoutForm.vue'
15
+ export { default as LogoutButton } from './LogoutButton.vue'
14
16
  export { useLang, loadLang } from './lang/index.js'
@@ -108,6 +108,10 @@ const lang: Language = {
108
108
  removeRole: ({ email }) =>
109
109
  `Select the role which you want to remove from ${email}.`
110
110
  }
111
+ },
112
+ logout: {
113
+ confirmation: 'Are you sure you want to log out?',
114
+ logout: 'Log out'
111
115
  }
112
116
  }
113
117
 
@@ -102,6 +102,10 @@ export interface Language {
102
102
  removeRole: ({ email }: { email: string }) => string
103
103
  }
104
104
  }
105
+ logout: {
106
+ confirmation: string
107
+ logout: string
108
+ }
105
109
  }
106
110
 
107
111
  import type { Ref } from 'vue'
@@ -108,6 +108,10 @@ const lang: Language = {
108
108
  removeRole: ({ email }) =>
109
109
  `Selecteer de rol die u wilt verwijderen van ${email}.`
110
110
  }
111
+ },
112
+ logout: {
113
+ confirmation: 'Weet u zeker dat u wilt uitloggen?',
114
+ logout: 'Log uit'
111
115
  }
112
116
  }
113
117
 
@@ -7,20 +7,26 @@
7
7
  stack-label
8
8
  >
9
9
  <template #control>
10
- <component
11
- :is="QInput"
12
- v-for="(part, index) in format.split('-')"
13
- :key="part"
14
- borderless
15
- v-bind="dateProps[part]"
16
- inputmode="numeric"
17
- >
18
- <template #after>
19
- <a v-if="index < 2" style="margin-left: -0.75em; margin-top: 0.75em"
20
- >-</a
21
- >
22
- </template>
23
- </component>
10
+ <div class="row">
11
+ <component
12
+ :is="QInput"
13
+ v-for="(part, index) in format.split('-')"
14
+ :key="part"
15
+ class="col-auto"
16
+ borderless
17
+ :filled="false"
18
+ :outlined="false"
19
+ :standout="false"
20
+ :rounded="false"
21
+ v-bind="dateProps[part]"
22
+ inputmode="numeric"
23
+ dense
24
+ >
25
+ <template #after>
26
+ <a v-if="index < 2" style="margin-top: 1em; width: 1ch">-</a>
27
+ </template>
28
+ </component>
29
+ </div>
24
30
  </template>
25
31
 
26
32
  <template #append>
@@ -52,6 +58,10 @@
52
58
  </q-popup-proxy>
53
59
  </q-icon>
54
60
  </template>
61
+
62
+ <template v-for="(_, slot) in $slots" #[slot]="scope">
63
+ <slot :name="slot" v-bind="scope || {}" />
64
+ </template>
55
65
  </q-field>
56
66
  </template>
57
67
 
@@ -195,12 +205,15 @@ const dateProps = computed<Record<string, QInputProps>>(() => ({
195
205
  modelValue: year.value,
196
206
  placeholder: lang.value.datePicker.YYYY,
197
207
  style: {
198
- width: format.value === 'YYYY-MM-DD' ? '8ch' : '6ch',
199
- 'margin-top': '-2em',
200
- 'margin-bottom': '-0.5em'
208
+ 'max-width': format.value === 'YYYY-MM-DD' ? '8ch' : '7ch',
209
+ 'margin-top': '-1.75em',
210
+ 'margin-bottom': '-0.5em',
211
+ background: 'transparent',
212
+ border: 0
201
213
  },
202
214
  // suffix: format.value === 'YYYY-MM-DD' ? '-' : undefined,
203
215
  class: format.value !== 'YYYY-MM-DD' ? 'q-mb-none q-ml-none' : undefined,
216
+ inputClass: 'text-center',
204
217
  'onUpdate:modelValue': setYear,
205
218
  onKeydown: goToNextElement
206
219
  },
@@ -208,12 +221,15 @@ const dateProps = computed<Record<string, QInputProps>>(() => ({
208
221
  modelValue: month.value ? String(month.value).padStart(2, '0') : '',
209
222
  placeholder: lang.value.datePicker.MM,
210
223
  style: {
211
- width: '6ch',
212
- 'margin-top': '-2em',
213
- 'margin-bottom': '-0.5em'
224
+ 'max-width': '7ch',
225
+ 'margin-top': '-1.75em',
226
+ 'margin-bottom': '-0.5em',
227
+ background: 'transparent',
228
+ border: 0
214
229
  },
215
230
  // suffix: '-',
216
231
  class: 'q-ml-none',
232
+ inputClass: 'text-center',
217
233
  'onUpdate:modelValue': setMonth,
218
234
  onKeydown: goToNextElement
219
235
  },
@@ -221,12 +237,15 @@ const dateProps = computed<Record<string, QInputProps>>(() => ({
221
237
  modelValue: day.value ? String(day.value).padStart(2, '0') : '',
222
238
  placeholder: lang.value.datePicker.DD,
223
239
  style: {
224
- width: format.value === 'DD-MM-YYYY' ? '6ch' : '4ch',
225
- 'margin-top': '-2em',
226
- 'margin-bottom': '-0.5em'
240
+ 'max-width': format.value === 'DD-MM-YYYY' ? '7ch' : '4ch',
241
+ 'margin-top': '-1.75em',
242
+ 'margin-bottom': '-0.5em',
243
+ background: 'transparent',
244
+ border: 0
227
245
  },
228
246
  // suffix: format.value === 'DD-MM-YYYY' ? '-' : undefined,
229
247
  class: format.value === 'YYYY-MM-DD' ? 'q-ml-none' : undefined,
248
+ inputClass: 'text-center',
230
249
  'onUpdate:modelValue': setDay,
231
250
  onKeydown: goToNextElement
232
251
  }
@@ -3,32 +3,27 @@
3
3
  v-bind="attrs"
4
4
  :options="languageOptions"
5
5
  :model-value="modelValue"
6
- :label="`${lang.locale.locale}${required ? '*' : ''}`"
6
+ :filled="false"
7
+ borderless
7
8
  emit-value
8
9
  map-options
9
10
  >
10
- <template #selected>
11
- <div v-if="modelValue">
12
- <component
13
- :is="flags[modelValue.slice(-2).toLowerCase() as keyof typeof flags]"
14
- />
15
- {{
16
- flagsLang.languages[
17
- modelValue as keyof (typeof flagsLang)['languages']
18
- ]
19
- }}
11
+ <template #selected-item="scope">
12
+ <div v-if="scope.opt">
13
+ <q-item>
14
+ <q-item-section avatar>
15
+ <q-icon :name="scope.opt.icon" />
16
+ </q-item-section>
17
+ <q-item-section label>
18
+ {{ scope.opt.label }}
19
+ </q-item-section>
20
+ </q-item>
20
21
  </div>
21
22
  </template>
22
23
  <template #option="scope">
23
24
  <q-item v-bind="scope.itemProps">
24
25
  <q-item-section avatar>
25
- <component
26
- :is="
27
- flags[
28
- scope.opt.value.slice(-2).toLowerCase() as keyof typeof flags
29
- ]
30
- "
31
- />
26
+ <q-icon :name="scope.opt.icon" />
32
27
  </q-item-section>
33
28
  <q-item-section>
34
29
  <q-item-label>
@@ -41,39 +36,30 @@
41
36
  </template>
42
37
 
43
38
  <script setup lang="ts">
44
- import { useAttrs, computed } from 'vue'
39
+ import { useAttrs, computed, toRefs } from 'vue'
45
40
  import { QSelect } from 'quasar'
46
- import * as flags from '../flags/index.js'
47
- import { useLang as useFlagsLang } from '../flags/lang/index.js'
48
- import { useLang } from './lang/index.js'
41
+ import { Language, useLang } from './lang/index.js'
49
42
 
50
43
  export interface Props {
51
- modelValue?: string | null
52
- required?: boolean
53
- allowedCodes?: [keyof ReturnType<typeof useFlagsLang>['value']['languages']]
44
+ modelValue: keyof Language['countries']
45
+ locales: {
46
+ icon: string
47
+ isoName: keyof Language['languages']
48
+ }[]
54
49
  }
55
- const {
56
- modelValue,
57
- required,
58
- allowedCodes = ['en-US', 'nl']
59
- } = defineProps<Props>()
60
- const attrs = useAttrs()
50
+ const props = defineProps<Props>()
51
+ const { modelValue, locales } = toRefs(props)
61
52
 
62
53
  const lang = useLang()
63
- const flagsLang = useFlagsLang()
54
+ const attrs = useAttrs()
64
55
 
65
56
  const languageOptions = computed(() => {
66
- const options = []
67
- for (let lang of Object.keys(flagsLang.value.languages) as Array<
68
- keyof (typeof flagsLang.value)['languages']
69
- >) {
70
- if (!allowedCodes?.length || allowedCodes.includes(lang)) {
71
- options.push({
72
- label: flagsLang.value.languages[lang],
73
- value: lang
74
- })
75
- }
76
- }
57
+ const options = locales.value.map((locale) => ({
58
+ label: lang.value.languages[locale.isoName],
59
+ value: locale.isoName,
60
+ icon: locale.icon
61
+ }))
62
+
77
63
  return options
78
64
  })
79
65
  </script>