@simsustech/quasar-components 0.1.2 → 0.2.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.
- package/CHANGELOG.md +12 -0
- package/dist/{QSubmitButton.vue_vue_type_script_setup_true_lang.fe90878f.js → QSubmitButton.vue_vue_type_script_setup_true_lang.65d6ac94.js} +7 -3
- package/dist/authentication.js +26 -8
- package/dist/en-US.d5751f99.js +217 -0
- package/dist/flags.js +5 -215
- package/dist/form.js +492 -0
- package/dist/general.js +341 -12
- package/dist/icons.js +2 -2
- package/dist/{nl.6b0aedb7.js → nl.1df15493.js} +1 -1
- package/dist/nl.7a710ba4.js +35 -0
- package/dist/style.css +2 -2
- package/dist/types/ui/authentication/ConsentList.vue.d.ts +2 -2
- package/dist/types/ui/authentication/EmailChangeForm.vue.d.ts +3 -3
- package/dist/types/ui/authentication/EmailChangeStepper.vue.d.ts +2 -2
- package/dist/types/ui/authentication/LoginButton.vue.d.ts +2 -2
- package/dist/types/ui/authentication/LoginForm.vue.d.ts +3 -3
- package/dist/types/ui/authentication/OtpInput.vue.d.ts +2 -2
- package/dist/types/ui/authentication/PasswordChangeForm.vue.d.ts +10 -10
- package/dist/types/ui/authentication/PasswordChangeStepper.vue.d.ts +2 -2
- package/dist/types/ui/authentication/RegisterForm.vue.d.ts +10 -10
- package/dist/types/ui/authentication/RequestOtpForm.vue.d.ts +3 -3
- package/dist/types/ui/authentication/UserMenuButton.vue.d.ts +2 -2
- package/dist/types/ui/authentication/VerificationSlider.vue.d.ts +2 -2
- package/dist/types/ui/form/BooleanItem.vue.d.ts +57 -0
- package/dist/types/ui/form/BooleanSelect.vue.d.ts +66 -0
- package/dist/types/ui/form/DateInput.vue.d.ts +61 -0
- package/dist/types/ui/form/FormInput.vue.d.ts +60 -0
- package/dist/types/ui/form/FormItem.vue.d.ts +64 -0
- package/dist/types/ui/form/GenderItem.vue.d.ts +57 -0
- package/dist/types/ui/form/GenderSelect.vue.d.ts +66 -0
- package/dist/types/ui/form/PostalCodeInput.vue.d.ts +67 -0
- package/dist/types/ui/form/TelephoneNumberInput.vue.d.ts +65 -0
- package/dist/types/ui/form/index.d.ts +9 -0
- package/dist/types/ui/form/lang/en-US.d.ts +3 -0
- package/dist/types/ui/form/lang/index.d.ts +68 -0
- package/dist/types/ui/form/lang/nl.d.ts +3 -0
- package/dist/types/ui/general/QLanguageSelect.vue.d.ts +58 -0
- package/dist/types/ui/general/QStyledCard.vue.d.ts +2 -2
- package/dist/types/ui/general/QStyledLayout.vue.d.ts +2 -2
- package/dist/types/ui/general/QSubmitButton.vue.d.ts +21 -1
- package/dist/types/ui/general/ResourcePage.vue.d.ts +159 -0
- package/dist/types/ui/general/ResponsiveDialog.vue.d.ts +108 -0
- package/dist/types/ui/general/index.d.ts +3 -0
- package/dist/types/virtualModules.d.ts +3 -0
- package/dist/types/vite-plugin.d.ts +3 -1
- package/dist/virtualModules.d.ts +3 -0
- package/dist/virtualModules.js +3 -0
- package/dist/vite-plugin.d.ts +3 -1
- package/dist/vite-plugin.js +61 -25
- package/package.json +13 -5
- package/src/ui/authentication/EmailChangeForm.vue +7 -2
- package/src/ui/authentication/EmailChangeStepper.vue +4 -0
- package/src/ui/authentication/LoginForm.vue +7 -2
- package/src/ui/authentication/PasswordChangeForm.vue +7 -2
- package/src/ui/authentication/PasswordChangeStepper.vue +4 -0
- package/src/ui/authentication/RegisterForm.vue +7 -2
- package/src/ui/authentication/RequestOtpForm.vue +2 -2
- package/src/ui/authentication/lang/en-US.ts +1 -2
- package/src/ui/authentication/lang/nl.ts +1 -2
- package/src/ui/flags/README.md +1 -1
- package/src/ui/form/BooleanItem.vue +34 -0
- package/src/ui/form/BooleanSelect.vue +55 -0
- package/src/ui/form/DateInput.vue +70 -0
- package/src/ui/form/FormInput.vue +44 -0
- package/src/ui/form/FormItem.vue +50 -0
- package/src/ui/form/GenderItem.vue +35 -0
- package/src/ui/form/GenderSelect.vue +59 -0
- package/src/ui/form/PostalCodeInput.vue +47 -0
- package/src/ui/form/TelephoneNumberInput.vue +35 -0
- package/src/ui/form/index.ts +9 -0
- package/src/ui/form/lang/en-US.ts +36 -0
- package/src/ui/form/lang/index.ts +70 -0
- package/src/ui/form/lang/nl.ts +36 -0
- package/src/ui/general/QLanguageSelect.vue +86 -0
- package/src/ui/general/QStyledCard.vue +1 -1
- package/src/ui/general/QSubmitButton.vue +7 -2
- package/src/ui/general/ResourcePage.vue +121 -0
- package/src/ui/general/ResponsiveDialog.vue +94 -0
- package/src/ui/general/index.ts +3 -0
- package/src/ui/icons/README.md +2 -0
- package/src/virtualModules.ts +113 -0
- package/src/vite-plugin.ts +60 -17
- package/tsconfig.build.plugin.json +1 -1
- package/tsconfig.node.json +1 -1
- package/vite.config.ts +93 -93
- package/dist/types/ui/index.d.ts +0 -2
- package/src/ui/index.ts +0 -2
- /package/dist/types/ui/icons/{icons.d.ts → labels.d.ts} +0 -0
- /package/src/ui/icons/{icons.ts → labels.ts} +0 -0
|
@@ -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,9 @@
|
|
|
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'
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
fields: {
|
|
11
|
+
name: 'Name',
|
|
12
|
+
firstName: 'First name',
|
|
13
|
+
surname: 'Surname',
|
|
14
|
+
address: 'Address',
|
|
15
|
+
postalCode: 'Postal code',
|
|
16
|
+
city: 'City',
|
|
17
|
+
telephoneNumber: 'Telephone number'
|
|
18
|
+
},
|
|
19
|
+
validations: {
|
|
20
|
+
fieldRequired: 'Field is required.'
|
|
21
|
+
},
|
|
22
|
+
gender: {
|
|
23
|
+
gender: 'Gender',
|
|
24
|
+
male: 'Male',
|
|
25
|
+
female: 'Female',
|
|
26
|
+
other: 'Other'
|
|
27
|
+
},
|
|
28
|
+
postalCode: {
|
|
29
|
+
postalCode: 'Postal code',
|
|
30
|
+
validations: {
|
|
31
|
+
invalidPostalCode: 'Invalid postal code'
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default lang
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export interface Language {
|
|
2
|
+
isoName: string
|
|
3
|
+
yes: string
|
|
4
|
+
no: string
|
|
5
|
+
buttons: {
|
|
6
|
+
close: string
|
|
7
|
+
}
|
|
8
|
+
fields: {
|
|
9
|
+
name: string
|
|
10
|
+
firstName: string
|
|
11
|
+
surname: string
|
|
12
|
+
address: string
|
|
13
|
+
postalCode: string
|
|
14
|
+
city: string
|
|
15
|
+
telephoneNumber: string
|
|
16
|
+
}
|
|
17
|
+
validations: {
|
|
18
|
+
fieldRequired: string
|
|
19
|
+
}
|
|
20
|
+
gender: {
|
|
21
|
+
gender: string
|
|
22
|
+
male: string
|
|
23
|
+
female: string
|
|
24
|
+
other: string
|
|
25
|
+
}
|
|
26
|
+
postalCode: {
|
|
27
|
+
postalCode: string
|
|
28
|
+
validations: {
|
|
29
|
+
invalidPostalCode: string
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
import type { Ref } from 'vue'
|
|
35
|
+
import { ref } from 'vue'
|
|
36
|
+
import en from './en-US'
|
|
37
|
+
export const lang = ref(en)
|
|
38
|
+
|
|
39
|
+
const locales = import.meta.glob<{ default: Language }>([
|
|
40
|
+
'./*.ts',
|
|
41
|
+
'!./index.ts'
|
|
42
|
+
])
|
|
43
|
+
|
|
44
|
+
export const defineLang = (lang: Language) => {
|
|
45
|
+
return lang
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const useLang = () => {
|
|
49
|
+
return lang as Ref<Language>
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
let loadingLanguage = false
|
|
53
|
+
export const loadLang = async (isoName: string) => {
|
|
54
|
+
if (!loadingLanguage) {
|
|
55
|
+
loadingLanguage = true
|
|
56
|
+
try {
|
|
57
|
+
const data = (await locales[`./${isoName}.ts`]()).default
|
|
58
|
+
|
|
59
|
+
if (data) {
|
|
60
|
+
lang.value = data
|
|
61
|
+
}
|
|
62
|
+
} catch (e) {
|
|
63
|
+
if (import.meta.env.DEBUG) console.error(e)
|
|
64
|
+
throw new Error(
|
|
65
|
+
`[quasar-components] Failed to load ${isoName} language file.`
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
loadingLanguage = false
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
fields: {
|
|
11
|
+
name: 'Naam',
|
|
12
|
+
firstName: 'Voornaam',
|
|
13
|
+
surname: 'Achternaam',
|
|
14
|
+
address: 'Adres',
|
|
15
|
+
postalCode: 'Postcode',
|
|
16
|
+
city: 'Woonplaats',
|
|
17
|
+
telephoneNumber: 'Telefoonnumer'
|
|
18
|
+
},
|
|
19
|
+
validations: {
|
|
20
|
+
fieldRequired: 'Veld is vereist.'
|
|
21
|
+
},
|
|
22
|
+
gender: {
|
|
23
|
+
gender: 'Geslacht',
|
|
24
|
+
male: 'Man',
|
|
25
|
+
female: 'Vrouw',
|
|
26
|
+
other: 'Anders'
|
|
27
|
+
},
|
|
28
|
+
postalCode: {
|
|
29
|
+
postalCode: 'Postcode',
|
|
30
|
+
validations: {
|
|
31
|
+
invalidPostalCode: 'Ongeldige postcode'
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default lang
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<q-select
|
|
3
|
+
v-bind="attrs"
|
|
4
|
+
:options="languageOptions"
|
|
5
|
+
:model-value="modelValue"
|
|
6
|
+
emit-value
|
|
7
|
+
map-options
|
|
8
|
+
>
|
|
9
|
+
<template #selected>
|
|
10
|
+
<en-us v-if="modelValue === 'en-US'" />
|
|
11
|
+
<nl v-if="modelValue === 'nl'" />
|
|
12
|
+
</template>
|
|
13
|
+
<template #option="scope">
|
|
14
|
+
<q-item v-if="scope.opt.value === 'en-US'" v-bind="scope.itemProps">
|
|
15
|
+
<q-item-section avatar>
|
|
16
|
+
<en-us ref="enUsRef" />
|
|
17
|
+
</q-item-section>
|
|
18
|
+
<q-item-section>
|
|
19
|
+
<q-item-label>
|
|
20
|
+
{{ enUsLanguage }}
|
|
21
|
+
</q-item-label>
|
|
22
|
+
</q-item-section>
|
|
23
|
+
</q-item>
|
|
24
|
+
<q-item v-if="scope.opt.value === 'nl'" v-bind="scope.itemProps">
|
|
25
|
+
<q-item-section avatar>
|
|
26
|
+
<nl ref="nlRef" />
|
|
27
|
+
</q-item-section>
|
|
28
|
+
<q-item-section>
|
|
29
|
+
<q-item-label>
|
|
30
|
+
{{ nlLanguage }}
|
|
31
|
+
</q-item-label>
|
|
32
|
+
</q-item-section>
|
|
33
|
+
</q-item>
|
|
34
|
+
</template>
|
|
35
|
+
</q-select>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<script setup lang="ts">
|
|
39
|
+
import { ref, useAttrs, computed, toRefs, watch } from 'vue'
|
|
40
|
+
import { useQuasar, QSelect, QuasarLanguage } from 'quasar'
|
|
41
|
+
import { nl, enUs } from '../flags/index.js'
|
|
42
|
+
|
|
43
|
+
export interface Props {
|
|
44
|
+
modelValue: string
|
|
45
|
+
languageImports: Record<string, () => Promise<QuasarLanguage>>
|
|
46
|
+
}
|
|
47
|
+
const props = defineProps<Props>()
|
|
48
|
+
const $q = useQuasar()
|
|
49
|
+
const { modelValue } = toRefs(props)
|
|
50
|
+
const attrs = useAttrs()
|
|
51
|
+
|
|
52
|
+
// const langList = import.meta.glob('../../../node_modules/quasar/lang/*.mjs')
|
|
53
|
+
|
|
54
|
+
const nlRef = ref<typeof nl>()
|
|
55
|
+
const nlCountry = computed(() => nlRef.value?.variables.country)
|
|
56
|
+
const nlLanguage = computed(() => nlRef.value?.variables.language)
|
|
57
|
+
|
|
58
|
+
const enUsRef = ref<typeof enUs>()
|
|
59
|
+
const enUsCountry = computed(() => enUsRef.value?.variables.country)
|
|
60
|
+
const enUsLanguage = computed(() => enUsRef.value?.variables.language)
|
|
61
|
+
|
|
62
|
+
const languageOptions = [
|
|
63
|
+
{
|
|
64
|
+
label: enUsLanguage.value,
|
|
65
|
+
value: 'en-US'
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
label: nlLanguage.value,
|
|
69
|
+
value: 'nl'
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
|
|
73
|
+
watch(modelValue, (langIso: string) => {
|
|
74
|
+
try {
|
|
75
|
+
props.languageImports[langIso]().then(
|
|
76
|
+
// langList[`../../../node_modules/quasar/lang/${langIso}.mjs`]().then(
|
|
77
|
+
(lang) => {
|
|
78
|
+
// @ts-ignore
|
|
79
|
+
$q.lang.set(lang.default)
|
|
80
|
+
}
|
|
81
|
+
)
|
|
82
|
+
} catch (e) {
|
|
83
|
+
console.error(e)
|
|
84
|
+
}
|
|
85
|
+
})
|
|
86
|
+
</script>
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
<q-btn
|
|
3
3
|
v-bind="attrs"
|
|
4
4
|
:label="isNextButton ? lang.next : lang.submit"
|
|
5
|
-
color="
|
|
5
|
+
:color="color"
|
|
6
6
|
:loading="loading || loadingInternal"
|
|
7
|
-
|
|
7
|
+
type="submit"
|
|
8
8
|
@click="submit"
|
|
9
9
|
/>
|
|
10
10
|
</template>
|
|
@@ -24,6 +24,7 @@ export interface Props {
|
|
|
24
24
|
loading?: boolean
|
|
25
25
|
useForm?: boolean
|
|
26
26
|
isNextButton?: boolean
|
|
27
|
+
color?: string
|
|
27
28
|
}
|
|
28
29
|
const props = defineProps({
|
|
29
30
|
loading: {
|
|
@@ -35,6 +36,10 @@ const props = defineProps({
|
|
|
35
36
|
},
|
|
36
37
|
isNextButton: {
|
|
37
38
|
type: Boolean
|
|
39
|
+
},
|
|
40
|
+
color: {
|
|
41
|
+
type: String,
|
|
42
|
+
default: 'primary'
|
|
38
43
|
}
|
|
39
44
|
})
|
|
40
45
|
const attrs = useAttrs()
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<q-page class="q-ma-md">
|
|
3
|
+
<div style="margin-top: 80px">
|
|
4
|
+
<slot name="default" />
|
|
5
|
+
</div>
|
|
6
|
+
<q-page-sticky expand position="top">
|
|
7
|
+
<q-toolbar
|
|
8
|
+
class="shadow-2"
|
|
9
|
+
:class="{ 'bg-dark': $q.dark.isActive, 'bg-white': !$q.dark.isActive }"
|
|
10
|
+
>
|
|
11
|
+
<q-btn
|
|
12
|
+
v-if="type === 'create'"
|
|
13
|
+
:disable="disabled"
|
|
14
|
+
flat
|
|
15
|
+
style="margin-bottom: -50px; z-index: 5"
|
|
16
|
+
round
|
|
17
|
+
size="lg"
|
|
18
|
+
dense
|
|
19
|
+
icon="add"
|
|
20
|
+
class="q-mr-sm bg-primary text-white"
|
|
21
|
+
@click="create"
|
|
22
|
+
/>
|
|
23
|
+
<q-btn
|
|
24
|
+
v-else
|
|
25
|
+
:disable="disabled"
|
|
26
|
+
flat
|
|
27
|
+
style="margin-bottom: -50px; z-index: 5"
|
|
28
|
+
round
|
|
29
|
+
size="lg"
|
|
30
|
+
dense
|
|
31
|
+
icon="edit"
|
|
32
|
+
class="q-mr-sm bg-primary text-white"
|
|
33
|
+
@click="update"
|
|
34
|
+
/>
|
|
35
|
+
<q-toolbar-title shrink>
|
|
36
|
+
<slot name="header" />
|
|
37
|
+
</q-toolbar-title>
|
|
38
|
+
<q-space />
|
|
39
|
+
</q-toolbar>
|
|
40
|
+
</q-page-sticky>
|
|
41
|
+
</q-page>
|
|
42
|
+
</template>
|
|
43
|
+
|
|
44
|
+
<script lang="ts">
|
|
45
|
+
export default {
|
|
46
|
+
name: 'ResourcePage'
|
|
47
|
+
}
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<script setup lang="ts">
|
|
51
|
+
import { ref, toRefs, watch } from 'vue'
|
|
52
|
+
import { useQuasar } from 'quasar'
|
|
53
|
+
import { useLang, loadLang } from './lang'
|
|
54
|
+
|
|
55
|
+
export interface Props {
|
|
56
|
+
type?: 'create' | 'update'
|
|
57
|
+
disabled?: boolean
|
|
58
|
+
}
|
|
59
|
+
// const props = defineProps<Props>()
|
|
60
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
61
|
+
type: 'create',
|
|
62
|
+
disabled: false
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
// const attrs = useAttrs();
|
|
66
|
+
const emit = defineEmits<{
|
|
67
|
+
(
|
|
68
|
+
e: 'create',
|
|
69
|
+
{
|
|
70
|
+
data,
|
|
71
|
+
done
|
|
72
|
+
}: {
|
|
73
|
+
data?: any
|
|
74
|
+
done: (success?: boolean) => void
|
|
75
|
+
}
|
|
76
|
+
): void
|
|
77
|
+
(
|
|
78
|
+
e: 'update',
|
|
79
|
+
{
|
|
80
|
+
data,
|
|
81
|
+
done
|
|
82
|
+
}: {
|
|
83
|
+
data?: any
|
|
84
|
+
done: (success?: boolean) => void
|
|
85
|
+
}
|
|
86
|
+
): void
|
|
87
|
+
}>()
|
|
88
|
+
const $q = useQuasar()
|
|
89
|
+
const lang = useLang()
|
|
90
|
+
if (lang.value.isoName !== $q.lang.isoName) loadLang($q.lang.isoName)
|
|
91
|
+
watch($q.lang, (val) => {
|
|
92
|
+
loadLang($q.lang.isoName)
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
const { disabled } = toRefs(props)
|
|
96
|
+
|
|
97
|
+
const done = () => ''
|
|
98
|
+
const create = (evt: unknown) =>
|
|
99
|
+
disabled.value
|
|
100
|
+
? () => {
|
|
101
|
+
//
|
|
102
|
+
}
|
|
103
|
+
: emit('create', { done })
|
|
104
|
+
const update = (evt: unknown) =>
|
|
105
|
+
disabled.value
|
|
106
|
+
? () => {
|
|
107
|
+
//
|
|
108
|
+
}
|
|
109
|
+
: emit('update', { done })
|
|
110
|
+
|
|
111
|
+
const variables = ref({
|
|
112
|
+
// header: lang.value.some.nested.prop
|
|
113
|
+
})
|
|
114
|
+
const functions = ref({
|
|
115
|
+
// submit
|
|
116
|
+
})
|
|
117
|
+
defineExpose({
|
|
118
|
+
variables,
|
|
119
|
+
functions
|
|
120
|
+
})
|
|
121
|
+
</script>
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<q-dialog :model-value="modelValue" :maximized="$q.screen.lt.md">
|
|
3
|
+
<q-layout
|
|
4
|
+
view="LHh lpR fff"
|
|
5
|
+
container
|
|
6
|
+
:class="{ 'bg-dark': $q.dark.isActive, 'bg-white': !$q.dark.isActive }"
|
|
7
|
+
style="min-width: 85vw"
|
|
8
|
+
>
|
|
9
|
+
<q-header class="bg-primary">
|
|
10
|
+
<q-toolbar>
|
|
11
|
+
<q-btn icon="close" flat round dense @click="close" />
|
|
12
|
+
<q-toolbar-title>
|
|
13
|
+
<slot name="title" />
|
|
14
|
+
</q-toolbar-title>
|
|
15
|
+
<q-submit-button
|
|
16
|
+
v-if="!display"
|
|
17
|
+
color="accent"
|
|
18
|
+
@submit="submit"
|
|
19
|
+
></q-submit-button>
|
|
20
|
+
</q-toolbar>
|
|
21
|
+
</q-header>
|
|
22
|
+
|
|
23
|
+
<q-page-container style="padding-bottom: -50px">
|
|
24
|
+
<q-page class="q-pa-md q-pb-xl">
|
|
25
|
+
<slot></slot>
|
|
26
|
+
</q-page>
|
|
27
|
+
</q-page-container>
|
|
28
|
+
</q-layout>
|
|
29
|
+
</q-dialog>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<script lang="ts">
|
|
33
|
+
export default {
|
|
34
|
+
name: 'ResponsiveDialog'
|
|
35
|
+
}
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<script setup lang="ts">
|
|
39
|
+
import { ref, watch } from 'vue'
|
|
40
|
+
import { useQuasar } from 'quasar'
|
|
41
|
+
import { useLang, loadLang } from './lang'
|
|
42
|
+
import QSubmitButton from './QSubmitButton.vue'
|
|
43
|
+
|
|
44
|
+
export interface Props {
|
|
45
|
+
display?: boolean
|
|
46
|
+
}
|
|
47
|
+
const props = defineProps<Props>()
|
|
48
|
+
// const attrs = useAttrs();
|
|
49
|
+
const modelValue = ref(false)
|
|
50
|
+
const emit = defineEmits<{
|
|
51
|
+
(
|
|
52
|
+
e: 'submit',
|
|
53
|
+
{
|
|
54
|
+
done
|
|
55
|
+
}: {
|
|
56
|
+
done: (success?: boolean) => void
|
|
57
|
+
}
|
|
58
|
+
): void
|
|
59
|
+
}>()
|
|
60
|
+
const $q = useQuasar()
|
|
61
|
+
const lang = useLang()
|
|
62
|
+
if (lang.value.isoName !== $q.lang.isoName) loadLang($q.lang.isoName)
|
|
63
|
+
watch($q.lang, (val) => {
|
|
64
|
+
loadLang($q.lang.isoName)
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
const submit: InstanceType<typeof QSubmitButton>['$props']['onSubmit'] = (
|
|
68
|
+
evt
|
|
69
|
+
) => {
|
|
70
|
+
emit('submit', {
|
|
71
|
+
done: (success = true) => {
|
|
72
|
+
evt.done()
|
|
73
|
+
if (success) modelValue.value = false
|
|
74
|
+
}
|
|
75
|
+
})
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const open = () => (modelValue.value = true)
|
|
79
|
+
const close = () => (modelValue.value = false)
|
|
80
|
+
const toggle = () => (modelValue.value = !modelValue.value)
|
|
81
|
+
|
|
82
|
+
const variables = ref({
|
|
83
|
+
// header: lang.value.some.nested.prop
|
|
84
|
+
})
|
|
85
|
+
const functions = ref({
|
|
86
|
+
open,
|
|
87
|
+
close,
|
|
88
|
+
toggle
|
|
89
|
+
})
|
|
90
|
+
defineExpose({
|
|
91
|
+
variables,
|
|
92
|
+
functions
|
|
93
|
+
})
|
|
94
|
+
</script>
|
package/src/ui/general/index.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
export { default as QSubmitButton } from './QSubmitButton.vue'
|
|
2
2
|
export { default as QStyledCard } from './QStyledCard.vue'
|
|
3
|
+
export { default as ResponsiveDialog } from './ResponsiveDialog.vue'
|
|
4
|
+
export { default as ResourcePage } from './ResourcePage.vue'
|
|
5
|
+
export { default as QLanguageSelect } from './QLanguageSelect.vue'
|