@simsustech/quasar-components 0.11.8 → 0.11.10

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 (31) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/authentication.js +70 -41
  3. package/dist/form.js +9 -5
  4. package/dist/general.js +144 -46
  5. package/dist/quasar-components.css +1 -4
  6. package/dist/types/ui/authentication/AccountsTable.vue.d.ts +5 -0
  7. package/dist/types/ui/authentication/ConsentList.vue.d.ts +3 -0
  8. package/dist/types/ui/authentication/LoginForm.vue.d.ts +4 -0
  9. package/dist/types/ui/authentication/PasswordChangeForm.vue.d.ts +8 -0
  10. package/dist/types/ui/authentication/RegisterForm.vue.d.ts +8 -0
  11. package/dist/types/ui/authentication/UserMenuButton.vue.d.ts +3 -0
  12. package/dist/types/ui/form/DateInput.vue.d.ts +8 -0
  13. package/dist/types/ui/general/QLanguageSelectBtn.vue.d.ts +11 -0
  14. package/dist/types/ui/general/ResourcePage.vue.d.ts +8 -0
  15. package/dist/types/ui/general/ResponsiveDialog.vue.d.ts +6 -2
  16. package/dist/types/ui/general/index.d.ts +1 -0
  17. package/package.json +1 -1
  18. package/src/ui/authentication/AccountsTable.vue +18 -9
  19. package/src/ui/authentication/ConsentList.vue +13 -18
  20. package/src/ui/authentication/LoginForm.vue +12 -3
  21. package/src/ui/authentication/PasswordChangeForm.vue +11 -3
  22. package/src/ui/authentication/RegisterForm.vue +11 -3
  23. package/src/ui/authentication/UserMenuButton.vue +9 -3
  24. package/src/ui/form/DateInput.vue +11 -3
  25. package/src/ui/general/QLanguageSelect.vue +1 -0
  26. package/src/ui/general/QLanguageSelectBtn.vue +99 -0
  27. package/src/ui/general/QStyledCard.vue +3 -19
  28. package/src/ui/general/ResourcePage.vue +13 -5
  29. package/src/ui/general/ResponsiveDialog.vue +10 -3
  30. package/src/ui/general/index.ts +1 -0
  31. package/vite.config.ts +0 -70
@@ -2,7 +2,7 @@
2
2
  <q-list>
3
3
  <q-item v-for="scope in scopes" :key="scope.name">
4
4
  <q-item-section avatar>
5
- <q-icon color="green" name="check" />
5
+ <q-icon color="green" :name="checkIcon" />
6
6
  </q-item-section>
7
7
  <q-item-section>
8
8
  {{ scope.name }}
@@ -10,7 +10,7 @@
10
10
  </q-item>
11
11
  <q-item v-for="claim in claims" :key="claim.name">
12
12
  <q-item-section avatar>
13
- <q-icon color="green" name="check" />
13
+ <q-icon color="green" :name="checkIcon" />
14
14
  </q-item-section>
15
15
  <q-item-section>
16
16
  {{ claim.name }}
@@ -18,7 +18,7 @@
18
18
  </q-item>
19
19
  <q-item v-for="resourceScope in resourceScopes" :key="resourceScope.name">
20
20
  <q-item-section avatar>
21
- <q-icon color="green" name="check" />
21
+ <q-icon color="green" :name="checkIcon" />
22
22
  </q-item-section>
23
23
  <q-item-section>
24
24
  {{ resourceScope.name }}
@@ -34,7 +34,7 @@ export default {
34
34
  </script>
35
35
 
36
36
  <script setup lang="ts">
37
- import { computed, ref, watch } from 'vue'
37
+ import { computed, ref, toRefs, watch } from 'vue'
38
38
  import { useQuasar } from 'quasar'
39
39
  import { useLang, loadLang } from './lang'
40
40
 
@@ -48,21 +48,14 @@ export interface Props {
48
48
  resourceScopes?: {
49
49
  name: string
50
50
  }[]
51
+ icons?: {
52
+ check: string
53
+ }
51
54
  }
52
- defineProps<Props>()
53
- // const attrs = useAttrs();
54
- // const emit = defineEmits<{
55
- // (
56
- // e: "asyncEmit",
57
- // {
58
- // value,
59
- // done,
60
- // }: {
61
- // value: string;
62
- // done: () => void;
63
- // }
64
- // ): void;
65
- // }>();
55
+ const props = defineProps<Props>()
56
+
57
+ const { icons } = toRefs(props)
58
+
66
59
  const $q = useQuasar()
67
60
  const lang = useLang()
68
61
  if (lang.value.isoName !== $q.lang.isoName) loadLang($q.lang.isoName)
@@ -74,6 +67,8 @@ const message = computed(() => lang.value.consent.message)
74
67
  const allow = computed(() => lang.value.consent.allow)
75
68
  const deny = computed(() => lang.value.consent.deny)
76
69
 
70
+ const checkIcon = icons.value?.check ?? 'check'
71
+
77
72
  const variables = ref({
78
73
  message,
79
74
  allow,
@@ -44,7 +44,7 @@
44
44
  >
45
45
  <template #append>
46
46
  <q-icon
47
- :name="showPassword ? 'visibility' : 'visibility_off'"
47
+ :name="showPassword ? visibilityIcon : visibilityOffIcon"
48
48
  class="cursor-pointer"
49
49
  @click="showPassword = !showPassword"
50
50
  />
@@ -69,7 +69,7 @@ export default {
69
69
  </script>
70
70
 
71
71
  <script setup lang="ts">
72
- import { ref, computed, watch } from 'vue'
72
+ import { ref, computed, watch, toRefs } from 'vue'
73
73
  import { useQuasar, QFormProps, QForm, QInputProps } from 'quasar'
74
74
  import { useLang, loadLang } from './lang'
75
75
  import isEmail from 'validator/es/lib/isEmail'
@@ -92,8 +92,14 @@ export interface Props {
92
92
  | 'autofocus'
93
93
  | ('label' & { style?: Partial<CSSStyleDeclaration> })
94
94
  >
95
+ icons?: {
96
+ visibility: string
97
+ visibilifyOff: string
98
+ }
95
99
  }
96
- defineProps<Props>()
100
+ const props = defineProps<Props>()
101
+ const { icons } = toRefs(props)
102
+
97
103
  // const attrs = useAttrs();
98
104
  const emit = defineEmits<{
99
105
  (
@@ -154,6 +160,9 @@ const submit: InstanceType<typeof QSubmitButton>['$props']['onSubmit'] = (
154
160
  })
155
161
  }
156
162
 
163
+ const visibilityIcon = icons.value?.visibility ?? 'visibility'
164
+ const visibilityOffIcon = icons.value?.visibilifyOff ?? 'visibility_off'
165
+
157
166
  const variables = ref({
158
167
  header,
159
168
  createAccount,
@@ -19,7 +19,7 @@
19
19
  >
20
20
  <template #append>
21
21
  <q-icon
22
- :name="showPassword ? 'visibility' : 'visibility_off'"
22
+ :name="showPassword ? icons.visibility : icons.visibilityOff"
23
23
  class="cursor-pointer"
24
24
  @click="showPassword = !showPassword"
25
25
  />
@@ -38,7 +38,7 @@
38
38
  >
39
39
  <template #append>
40
40
  <q-icon
41
- :name="showRepeatPassword ? 'visibility' : 'visibility_off'"
41
+ :name="showRepeatPassword ? icons.visibility : icons.visibilityOff"
42
42
  class="cursor-pointer"
43
43
  @click="showRepeatPassword = !showRepeatPassword"
44
44
  />
@@ -79,11 +79,19 @@ export interface Props {
79
79
  | 'autofocus'
80
80
  | ('label' & { style?: Partial<CSSStyleDeclaration> })
81
81
  >
82
+ icons?: {
83
+ visibility: string
84
+ visibilityOff: string
85
+ }
82
86
  }
83
87
  const props = withDefaults(defineProps<Props>(), {
84
88
  minimumPasswordLength: 8,
85
89
  form: undefined,
86
- input: undefined
90
+ input: undefined,
91
+ icons: () => ({
92
+ visibility: 'visibility',
93
+ visibilityOff: 'visibility_off'
94
+ })
87
95
  })
88
96
  // const attrs = useAttrs();
89
97
  const emit = defineEmits<{
@@ -50,7 +50,7 @@
50
50
  >
51
51
  <template #append>
52
52
  <q-icon
53
- :name="showPassword ? 'visibility' : 'visibility_off'"
53
+ :name="showPassword ? icons.visibility : icons.visibilityOff"
54
54
  class="cursor-pointer"
55
55
  @click="showPassword = !showPassword"
56
56
  />
@@ -68,7 +68,7 @@
68
68
  >
69
69
  <template #append>
70
70
  <q-icon
71
- :name="showPassword ? 'visibility' : 'visibility_off'"
71
+ :name="showPassword ? icons.visibility : icons.visibilityOff"
72
72
  class="cursor-pointer"
73
73
  @click="showPassword = !showPassword"
74
74
  />
@@ -115,12 +115,20 @@ export interface Props {
115
115
  | 'autofocus'
116
116
  | ('label' & { style?: Partial<CSSStyleDeclaration> })
117
117
  >
118
+ icons?: {
119
+ visibility: string
120
+ visibilityOff: string
121
+ }
118
122
  }
119
123
  const props = withDefaults(defineProps<Props>(), {
120
124
  minimumPasswordLength: 8,
121
125
  extraFields: undefined,
122
126
  form: undefined,
123
- input: undefined
127
+ input: undefined,
128
+ icons: () => ({
129
+ visibility: 'visibility',
130
+ visibilityOff: 'visibility_off'
131
+ })
124
132
  })
125
133
  // const attrs = useAttrs();
126
134
  const emit = defineEmits<{
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <q-btn icon="person">
2
+ <q-btn :icon="personIcon">
3
3
  <q-menu>
4
4
  <q-list>
5
5
  <q-item :to="userRoute">
@@ -21,15 +21,19 @@ export default {
21
21
  </script>
22
22
 
23
23
  <script setup lang="ts">
24
- import { ref, watch } from 'vue'
24
+ import { ref, toRefs, watch } from 'vue'
25
25
  import { useQuasar } from 'quasar'
26
26
  import { useLang, loadLang } from './lang'
27
27
  import type { RouteLocationRaw } from 'vue-router'
28
28
 
29
29
  export interface Props {
30
30
  userRoute: RouteLocationRaw
31
+ icons?: {
32
+ person: string
33
+ }
31
34
  }
32
- defineProps<Props>()
35
+ const props = defineProps<Props>()
36
+ const { icons } = toRefs(props)
33
37
  // const attrs = useAttrs();
34
38
  const emit = defineEmits<{
35
39
  (e: 'signOut'): void
@@ -41,6 +45,8 @@ watch($q.lang, (val) => {
41
45
  loadLang($q.lang.isoName)
42
46
  })
43
47
 
48
+ const personIcon = icons.value?.person ?? 'person'
49
+
44
50
  const variables = ref({
45
51
  // header: lang.value.some.nested.prop
46
52
  })
@@ -26,11 +26,11 @@
26
26
  <template #append>
27
27
  <q-icon
28
28
  v-if="clearable"
29
- name="clear"
29
+ :name="icons.clear"
30
30
  class="cursor-pointer"
31
31
  @click="emit('update:modelValue', null)"
32
32
  />
33
- <q-icon name="event" class="cursor-pointer">
33
+ <q-icon :name="icons.event" class="cursor-pointer">
34
34
  <q-tooltip v-if="formattedDate">
35
35
  {{ formattedDate }}
36
36
  </q-tooltip>
@@ -74,12 +74,20 @@ export interface Props {
74
74
  required?: boolean
75
75
  clearable?: boolean
76
76
  date?: Partial<QDateProps>
77
+ icons?: {
78
+ event: string
79
+ clear: string
80
+ }
77
81
  }
78
82
  const props = withDefaults(defineProps<Props>(), {
79
83
  format: 'YYYY-MM-DD',
80
84
  locale: 'en-US',
81
85
  label: '',
82
- date: () => ({})
86
+ date: () => ({}),
87
+ icons: () => ({
88
+ event: 'event',
89
+ clear: 'clear'
90
+ })
83
91
  })
84
92
  const emit = defineEmits<{
85
93
  (e: 'update:modelValue', val: string | null): void
@@ -3,6 +3,7 @@
3
3
  v-bind="attrs"
4
4
  :options="languageOptions"
5
5
  :model-value="modelValue"
6
+ borderless
6
7
  emit-value
7
8
  map-options
8
9
  >
@@ -0,0 +1,99 @@
1
+ <template>
2
+ <q-btn>
3
+ <div v-if="modelValue">
4
+ <component
5
+ :is="flags[modelValue.slice(-2).toLowerCase() as keyof typeof flags]"
6
+ />
7
+ </div>
8
+
9
+ <q-menu>
10
+ <q-list>
11
+ <q-item
12
+ v-for="option in languageOptions"
13
+ :key="option.value"
14
+ v-close-popup
15
+ clickable
16
+ @click="$emit('update:model-value', option.value)"
17
+ >
18
+ <q-item-section avatar>
19
+ <component
20
+ :is="
21
+ flags[
22
+ option.value.slice(-2).toLowerCase() as keyof typeof flags
23
+ ]
24
+ "
25
+ />
26
+ </q-item-section>
27
+ <q-item-section>
28
+ <q-item-label>
29
+ {{ option.label }}
30
+ </q-item-label>
31
+ </q-item-section>
32
+ </q-item>
33
+ </q-list>
34
+ </q-menu>
35
+ </q-btn>
36
+ </template>
37
+
38
+ <script setup lang="ts">
39
+ import { computed, watch } from 'vue'
40
+ import { useQuasar, QuasarLanguage } from 'quasar'
41
+ import * as flags from '../flags/index.js'
42
+ import { useLang as useFlagsLang } from '../flags/lang/index.js'
43
+
44
+ export interface Props {
45
+ modelValue: string
46
+ languageImports: Record<string, () => Promise<{ default: QuasarLanguage }>>
47
+ allowedCodes?: [keyof ReturnType<typeof useFlagsLang>['value']['languages']]
48
+ }
49
+ const {
50
+ modelValue,
51
+ allowedCodes = ['en-US', 'nl'],
52
+ languageImports
53
+ } = defineProps<Props>()
54
+ const $q = useQuasar()
55
+
56
+ const flagsLang = useFlagsLang()
57
+
58
+ const languageOptions = computed(() => {
59
+ const options = []
60
+ for (let lang of Object.keys(flagsLang.value.languages) as Array<
61
+ keyof (typeof flagsLang.value)['languages']
62
+ >) {
63
+ if (!allowedCodes.length || allowedCodes.includes(lang)) {
64
+ options.push({
65
+ label: flagsLang.value.languages[lang],
66
+ value: lang
67
+ })
68
+ }
69
+ }
70
+ return options
71
+ })
72
+
73
+ // const languageOptions = [
74
+ // {
75
+ // label: enUsLanguage.value,
76
+ // value: 'en-US'
77
+ // },
78
+ // {
79
+ // label: nlLanguage.value,
80
+ // value: 'nl'
81
+ // }
82
+ // ]
83
+
84
+ watch(
85
+ () => modelValue,
86
+ (langIso: string) => {
87
+ try {
88
+ languageImports[langIso]().then(
89
+ // langList[`../../../node_modules/quasar/lang/${langIso}.mjs`]().then(
90
+ (lang) => {
91
+ $q.lang.set(lang.default)
92
+ }
93
+ )
94
+ } catch (e) {
95
+ console.error(e)
96
+ }
97
+ }
98
+ )
99
+ </script>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <q-card ref="qCardRef" class="card">
2
+ <q-card ref="qCardRef">
3
3
  <slot name="image" />
4
4
 
5
5
  <q-card-section>
@@ -36,19 +36,7 @@ export interface Props {
36
36
  actions?: QCardActionsProps
37
37
  }
38
38
  defineProps<Props>()
39
- // const attrs = useAttrs();
40
- // const emit = defineEmits<{
41
- // (
42
- // e: "asyncEmit",
43
- // {
44
- // value,
45
- // done,
46
- // }: {
47
- // value: string;
48
- // done: () => void;
49
- // }
50
- // ): void;
51
- // }>();
39
+
52
40
  const $q = useQuasar()
53
41
  const lang = useLang()
54
42
  if (lang.value.isoName !== $q.lang.isoName) loadLang($q.lang.isoName)
@@ -70,8 +58,4 @@ defineExpose({
70
58
  })
71
59
  </script>
72
60
 
73
- <style lang="sass" scoped>
74
- .card
75
- width: 100%
76
- max-width: 300px
77
- </style>
61
+ <style lang="sass" scoped></style>
@@ -18,7 +18,7 @@
18
18
  round
19
19
  size="lg"
20
20
  dense
21
- icon="add"
21
+ :icon="icons.add"
22
22
  class="q-mr-sm bg-primary text-white"
23
23
  @click="create"
24
24
  />
@@ -30,7 +30,7 @@
30
30
  round
31
31
  size="lg"
32
32
  dense
33
- icon="edit"
33
+ :icon="icons.edit"
34
34
  class="q-mr-sm bg-primary text-white"
35
35
  @click="update"
36
36
  />
@@ -44,7 +44,7 @@
44
44
  v-if="type === 'create'"
45
45
  :disable="disabled"
46
46
  :label="lang.add"
47
- icon="add"
47
+ :icon="icons.add"
48
48
  outline
49
49
  @click="create"
50
50
  />
@@ -52,7 +52,7 @@
52
52
  v-else-if="type === 'update'"
53
53
  :disable="disabled"
54
54
  :label="lang.edit"
55
- icon="edit"
55
+ :icon="icons.edit"
56
56
  outline
57
57
  @click="update"
58
58
  />
@@ -80,12 +80,20 @@ export interface Props {
80
80
  disabled?: boolean
81
81
  topBarFab?: boolean
82
82
  topBarShrink?: boolean
83
+ icons?: {
84
+ add: string
85
+ edit: string
86
+ }
83
87
  }
84
88
  const props = withDefaults(defineProps<Props>(), {
85
89
  type: undefined,
86
90
  disabled: false,
87
91
  topBarFab: false,
88
- topBarShrink: true
92
+ topBarShrink: true,
93
+ icons: () => ({
94
+ add: 'add',
95
+ edit: 'edit'
96
+ })
89
97
  })
90
98
 
91
99
  const emit = defineEmits<{
@@ -8,7 +8,7 @@
8
8
  >
9
9
  <q-header class="bg-primary">
10
10
  <q-toolbar>
11
- <q-btn :icon="closeIcon" flat round dense @click="close" />
11
+ <q-btn :icon="icons.close" flat round dense @click="close" />
12
12
  <q-toolbar-title>
13
13
  <slot name="title" />
14
14
  </q-toolbar-title>
@@ -45,10 +45,17 @@ import QSubmitButton from './QSubmitButton.vue'
45
45
  export interface Props {
46
46
  display?: boolean
47
47
  buttonType?: 'submit' | 'send'
48
- closeIcon?: string
49
48
  padding?: boolean
49
+ icons?: {
50
+ close: string
51
+ }
50
52
  }
51
- withDefaults(defineProps<Props>(), { buttonType: 'submit', closeIcon: 'close' })
53
+ withDefaults(defineProps<Props>(), {
54
+ buttonType: 'submit',
55
+ icons: () => ({
56
+ close: 'close'
57
+ })
58
+ })
52
59
  // const attrs = useAttrs();
53
60
  const emit = defineEmits<{
54
61
  (
@@ -3,5 +3,6 @@ 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'
6
7
  export { default as QDrawerList } from './QDrawerList.vue'
7
8
  export { useLang, loadLang } from './lang/index.js'
package/vite.config.ts CHANGED
@@ -3,76 +3,6 @@ import vue from '@vitejs/plugin-vue'
3
3
  import Components from 'unplugin-vue-components/vite'
4
4
  import { QuasarResolver } from 'unplugin-vue-components/resolvers'
5
5
  import { FlagIcon, Icon } from './src/virtualModules.js'
6
- // export const FlagIcon = (locale) => `
7
- // import { computed, ref, watch, h } from 'vue'
8
- // import { QuasarLanguageCodes, useQuasar, QIcon } from 'quasar'
9
- // import { useLang, loadLang } from '${
10
- // new URL(`./src/ui/flags/lang`, import.meta.url).pathname
11
- // }'
12
- // import icon from '${
13
- // new URL(`./src/ui/flags/assets/${locale}.svg`, import.meta.url).pathname
14
- // }'
15
- // export default {
16
- // setup(props, context) {
17
- // const $q = useQuasar()
18
- // const lang = useLang()
19
- // if (lang.value.isoName !== $q.lang.isoName) loadLang($q.lang.isoName)
20
- // watch($q.lang, (val) => {
21
- // loadLang($q.lang.isoName)
22
- // })
23
-
24
- // const country = computed(
25
- // () => lang.value.countries['${locale}']
26
- // )
27
- // // @ts-ignore
28
- // const language = computed(() => lang.value.languages['${locale}'])
29
- // const variables = ref({
30
- // country,
31
- // language
32
- // // header: lang.value.some.nested.prop
33
- // })
34
- // const functions = ref({
35
- // // submit
36
- // })
37
-
38
- // context.expose({
39
- // variables,
40
- // functions
41
- // })
42
-
43
- // // return the render function
44
- // return () => h(QIcon, { name: \`img:\${icon}\` })
45
- // }}
46
- // `
47
-
48
- // export const Icon = (icon) => `
49
- // import { computed, ref, watch, h } from 'vue'
50
- // import { QuasarLanguageCodes, useQuasar, QIcon } from 'quasar'
51
- // import icon from '${
52
- // new URL(`./src/ui/icons/assets/${icon}.svg`, import.meta.url).pathname
53
- // }'
54
- // import icons from '${
55
- // new URL(`./src/ui/icons/icons.ts`, import.meta.url).pathname
56
- // }'
57
- // export default {
58
- // setup(props, context) {
59
- // const $q = useQuasar()
60
-
61
- // const variables = ref(icons['${icon}'])
62
-
63
- // const functions = ref({
64
- // // submit
65
- // })
66
-
67
- // context.expose({
68
- // variables,
69
- // functions
70
- // })
71
-
72
- // // return the render function
73
- // return () => h(QIcon, { name: \`img:\${icon}\` })
74
- // }}
75
- // `
76
6
 
77
7
  export const moduleTransformPlugin: Plugin = {
78
8
  name: 'module-tranform-plugin',