@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.
Files changed (89) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/{QSubmitButton.vue_vue_type_script_setup_true_lang.fe90878f.js → QSubmitButton.vue_vue_type_script_setup_true_lang.65d6ac94.js} +7 -3
  3. package/dist/authentication.js +26 -8
  4. package/dist/en-US.d5751f99.js +217 -0
  5. package/dist/flags.js +5 -215
  6. package/dist/form.js +492 -0
  7. package/dist/general.js +341 -12
  8. package/dist/icons.js +2 -2
  9. package/dist/{nl.6b0aedb7.js → nl.1df15493.js} +1 -1
  10. package/dist/nl.7a710ba4.js +35 -0
  11. package/dist/style.css +2 -2
  12. package/dist/types/ui/authentication/ConsentList.vue.d.ts +2 -2
  13. package/dist/types/ui/authentication/EmailChangeForm.vue.d.ts +3 -3
  14. package/dist/types/ui/authentication/EmailChangeStepper.vue.d.ts +2 -2
  15. package/dist/types/ui/authentication/LoginButton.vue.d.ts +2 -2
  16. package/dist/types/ui/authentication/LoginForm.vue.d.ts +3 -3
  17. package/dist/types/ui/authentication/OtpInput.vue.d.ts +2 -2
  18. package/dist/types/ui/authentication/PasswordChangeForm.vue.d.ts +10 -10
  19. package/dist/types/ui/authentication/PasswordChangeStepper.vue.d.ts +2 -2
  20. package/dist/types/ui/authentication/RegisterForm.vue.d.ts +10 -10
  21. package/dist/types/ui/authentication/RequestOtpForm.vue.d.ts +3 -3
  22. package/dist/types/ui/authentication/UserMenuButton.vue.d.ts +2 -2
  23. package/dist/types/ui/authentication/VerificationSlider.vue.d.ts +2 -2
  24. package/dist/types/ui/form/BooleanItem.vue.d.ts +57 -0
  25. package/dist/types/ui/form/BooleanSelect.vue.d.ts +66 -0
  26. package/dist/types/ui/form/DateInput.vue.d.ts +61 -0
  27. package/dist/types/ui/form/FormInput.vue.d.ts +60 -0
  28. package/dist/types/ui/form/FormItem.vue.d.ts +64 -0
  29. package/dist/types/ui/form/GenderItem.vue.d.ts +57 -0
  30. package/dist/types/ui/form/GenderSelect.vue.d.ts +66 -0
  31. package/dist/types/ui/form/PostalCodeInput.vue.d.ts +67 -0
  32. package/dist/types/ui/form/TelephoneNumberInput.vue.d.ts +65 -0
  33. package/dist/types/ui/form/index.d.ts +9 -0
  34. package/dist/types/ui/form/lang/en-US.d.ts +3 -0
  35. package/dist/types/ui/form/lang/index.d.ts +68 -0
  36. package/dist/types/ui/form/lang/nl.d.ts +3 -0
  37. package/dist/types/ui/general/QLanguageSelect.vue.d.ts +58 -0
  38. package/dist/types/ui/general/QStyledCard.vue.d.ts +2 -2
  39. package/dist/types/ui/general/QStyledLayout.vue.d.ts +2 -2
  40. package/dist/types/ui/general/QSubmitButton.vue.d.ts +21 -1
  41. package/dist/types/ui/general/ResourcePage.vue.d.ts +159 -0
  42. package/dist/types/ui/general/ResponsiveDialog.vue.d.ts +108 -0
  43. package/dist/types/ui/general/index.d.ts +3 -0
  44. package/dist/types/virtualModules.d.ts +3 -0
  45. package/dist/types/vite-plugin.d.ts +3 -1
  46. package/dist/virtualModules.d.ts +3 -0
  47. package/dist/virtualModules.js +3 -0
  48. package/dist/vite-plugin.d.ts +3 -1
  49. package/dist/vite-plugin.js +61 -25
  50. package/package.json +13 -5
  51. package/src/ui/authentication/EmailChangeForm.vue +7 -2
  52. package/src/ui/authentication/EmailChangeStepper.vue +4 -0
  53. package/src/ui/authentication/LoginForm.vue +7 -2
  54. package/src/ui/authentication/PasswordChangeForm.vue +7 -2
  55. package/src/ui/authentication/PasswordChangeStepper.vue +4 -0
  56. package/src/ui/authentication/RegisterForm.vue +7 -2
  57. package/src/ui/authentication/RequestOtpForm.vue +2 -2
  58. package/src/ui/authentication/lang/en-US.ts +1 -2
  59. package/src/ui/authentication/lang/nl.ts +1 -2
  60. package/src/ui/flags/README.md +1 -1
  61. package/src/ui/form/BooleanItem.vue +34 -0
  62. package/src/ui/form/BooleanSelect.vue +55 -0
  63. package/src/ui/form/DateInput.vue +70 -0
  64. package/src/ui/form/FormInput.vue +44 -0
  65. package/src/ui/form/FormItem.vue +50 -0
  66. package/src/ui/form/GenderItem.vue +35 -0
  67. package/src/ui/form/GenderSelect.vue +59 -0
  68. package/src/ui/form/PostalCodeInput.vue +47 -0
  69. package/src/ui/form/TelephoneNumberInput.vue +35 -0
  70. package/src/ui/form/index.ts +9 -0
  71. package/src/ui/form/lang/en-US.ts +36 -0
  72. package/src/ui/form/lang/index.ts +70 -0
  73. package/src/ui/form/lang/nl.ts +36 -0
  74. package/src/ui/general/QLanguageSelect.vue +86 -0
  75. package/src/ui/general/QStyledCard.vue +1 -1
  76. package/src/ui/general/QSubmitButton.vue +7 -2
  77. package/src/ui/general/ResourcePage.vue +121 -0
  78. package/src/ui/general/ResponsiveDialog.vue +94 -0
  79. package/src/ui/general/index.ts +3 -0
  80. package/src/ui/icons/README.md +2 -0
  81. package/src/virtualModules.ts +113 -0
  82. package/src/vite-plugin.ts +60 -17
  83. package/tsconfig.build.plugin.json +1 -1
  84. package/tsconfig.node.json +1 -1
  85. package/vite.config.ts +93 -93
  86. package/dist/types/ui/index.d.ts +0 -2
  87. package/src/ui/index.ts +0 -2
  88. /package/dist/types/ui/icons/{icons.d.ts → labels.d.ts} +0 -0
  89. /package/src/ui/icons/{icons.ts → labels.ts} +0 -0
@@ -13,7 +13,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
13
13
  function verb(n) { return function (v) { return step([n, v]); }; }
14
14
  function step(op) {
15
15
  if (f) throw new TypeError("Generator is already executing.");
16
- while (_) try {
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
17
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
18
  if (y = 0, t) op = [op[0] & 2, t.value];
19
19
  switch (op[0]) {
@@ -34,33 +34,69 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
34
34
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
35
  }
36
36
  };
37
- export default function () {
37
+ import { promises } from 'fs';
38
+ import { Icon, FlagIcon } from './virtualModules.js';
39
+ var readFile = promises.readFile;
40
+ export default function (_a) {
41
+ var _b = _a === void 0 ? {} : _a, buildFromSrc = _b.buildFromSrc;
38
42
  return __awaiter(this, void 0, void 0, function () {
39
- return __generator(this, function (_a) {
40
- return [2 /*return*/, {
41
- name: '@simsustech/quasar-components-plugin',
42
- config: function (config, _a) {
43
- var mode = _a.mode;
44
- if (mode === 'development') {
45
- return {
46
- resolve: {
47
- alias: [
48
- {
49
- find: '@simsustech/quasar-components/flags',
50
- replacement: new URL('../src/ui/flags/index.ts', import.meta.url).pathname
51
- },
52
- {
53
- find: '@simsustech/quasar-components',
54
- replacement: new URL('../src/ui/index.ts', import.meta.url)
55
- .pathname
43
+ var pkgJson, _c, _d, exports, name;
44
+ return __generator(this, function (_e) {
45
+ switch (_e.label) {
46
+ case 0:
47
+ _d = (_c = JSON).parse;
48
+ return [4 /*yield*/, readFile(new URL('../package.json', import.meta.url).pathname, 'utf-8')];
49
+ case 1:
50
+ pkgJson = _d.apply(_c, [_e.sent()]);
51
+ exports = pkgJson.exports;
52
+ name = pkgJson.name;
53
+ return [2 /*return*/, {
54
+ name: "".concat(name, "-plugin"),
55
+ enforce: 'pre',
56
+ resolveId: function (id) {
57
+ if (id.includes('.flag'))
58
+ return id;
59
+ else if (id.includes('.icon'))
60
+ return id;
61
+ },
62
+ load: function (id) {
63
+ if (id.includes('.flag')) {
64
+ var locale = id.slice(0, -5);
65
+ var flag = FlagIcon(locale);
66
+ return flag;
67
+ }
68
+ else if (id.includes('.icon')) {
69
+ var iconId = id.slice(0, -5);
70
+ var icon = Icon(iconId);
71
+ return icon;
72
+ }
73
+ },
74
+ config: function (config, _a) {
75
+ var mode = _a.mode;
76
+ if (mode === 'development' || buildFromSrc) {
77
+ var alias = Object.entries(exports)
78
+ .filter(function (_a) {
79
+ var key = _a[0], val = _a[1];
80
+ return val.src;
81
+ })
82
+ .map(function (_a) {
83
+ var key = _a[0], val = _a[1];
84
+ return {
85
+ find: new RegExp("^".concat(name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + key.slice(1), "$")),
86
+ // name: name + key.slice(1),
87
+ replacement: new URL('.' + val.src, import.meta.url).pathname
88
+ };
89
+ });
90
+ return {
91
+ resolve: {
92
+ alias: alias
56
93
  }
57
- ]
94
+ };
58
95
  }
59
- };
60
- }
61
- return {};
62
- }
63
- }];
96
+ return {};
97
+ }
98
+ }];
99
+ }
64
100
  });
65
101
  });
66
102
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simsustech/quasar-components",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "author": "Stefan van Herwijnen",
5
5
  "description": "High level components for Quasar Framework",
6
6
  "license": "MIT",
@@ -14,21 +14,29 @@
14
14
  },
15
15
  "./authentication": {
16
16
  "types": "./dist/types/ui/authentication/index.d.ts",
17
- "import": "./dist/authentication.js"
17
+ "import": "./dist/authentication.js",
18
+ "src": "./src/ui/authentication/index.ts"
18
19
  },
19
20
  "./flags": {
20
21
  "types": "./dist/types/ui/flags/index.d.ts",
21
- "import": "./dist/flags.js"
22
+ "import": "./dist/flags.js",
23
+ "src": "./src/ui/flags/index.ts"
22
24
  },
23
25
  "./icons": {
24
26
  "types": "./dist/types/ui/icons/index.d.ts",
25
- "import": "./dist/icons.js"
27
+ "import": "./dist/icons.js",
28
+ "src": "./src/ui/icons/index.ts"
29
+ },
30
+ "./form": {
31
+ "types": "./dist/types/ui/form/index.d.ts",
32
+ "import": "./dist/form.js",
33
+ "src": "./src/ui/form/index.ts"
26
34
  },
27
35
  "./css": {
28
36
  "import": "./dist/style.css"
29
37
  },
30
38
  "./vite-plugin": {
31
- "types": "./dist/vite-plugin.d.ts",
39
+ "types": "./dist/types/vite-plugin.d.ts",
32
40
  "import": "./dist/vite-plugin.js"
33
41
  }
34
42
  },
@@ -1,5 +1,10 @@
1
1
  <template>
2
- <q-form ref="formRef" class="q-gutter-md" v-bind="form">
2
+ <q-form
3
+ ref="formRef"
4
+ class="q-gutter-md"
5
+ v-bind="form"
6
+ @submit="(e) => submit"
7
+ >
3
8
  <otp-input v-bind="input" v-model="otp" />
4
9
  <q-input
5
10
  v-bind="input"
@@ -41,7 +46,7 @@ import OtpInput from './OtpInput.vue'
41
46
 
42
47
  export interface Props {
43
48
  email: string
44
- form?: QFormProps & HTMLFormElement
49
+ form?: QFormProps & Partial<HTMLFormElement> & Partial<HTMLDivElement>
45
50
  input?: Omit<
46
51
  QInputProps,
47
52
  | 'id'
@@ -3,6 +3,7 @@
3
3
  <q-step name="requestOtp" :title="requestOtpHeader">
4
4
  <request-otp-form
5
5
  ref="requestOtpFormRef"
6
+ :form="{ id: 'requestOtpForm' }"
6
7
  :input="input"
7
8
  @submit="requestOtp"
8
9
  ></request-otp-form>
@@ -11,6 +12,7 @@
11
12
  <q-step name="changeEmail" :title="emailChangeHeader">
12
13
  <email-change-form
13
14
  ref="emailChangeFormRef"
15
+ :form="{ id: 'emailChangeForm' }"
14
16
  :email="email"
15
17
  :input="input"
16
18
  @submit="changeEmail"
@@ -22,10 +24,12 @@
22
24
  <q-submit-button
23
25
  v-if="step === 'requestOtp'"
24
26
  is-next-button
27
+ form="requestOtpForm"
25
28
  @submit="requestOtpFormRef?.functions.submit"
26
29
  ></q-submit-button>
27
30
  <q-submit-button
28
31
  v-if="step === 'changeEmail'"
32
+ form="emailChangeForm"
29
33
  @submit="emailChangeFormRef?.functions.submit"
30
34
  ></q-submit-button>
31
35
  </q-stepper-navigation>
@@ -1,5 +1,10 @@
1
1
  <template>
2
- <q-form ref="formRef" class="q-gutter-md" v-bind="form">
2
+ <q-form
3
+ ref="formRef"
4
+ class="q-gutter-md"
5
+ v-bind="form"
6
+ @submit="(e) => submit"
7
+ >
3
8
  <q-input
4
9
  v-if="!useUsername"
5
10
  v-bind="input"
@@ -71,7 +76,7 @@ import QSubmitButton from '../general/QSubmitButton.vue'
71
76
  export interface Props {
72
77
  useUsername?: boolean
73
78
  passwordForgotUrl?: string
74
- form?: QFormProps & HTMLFormElement
79
+ form?: QFormProps & Partial<HTMLFormElement> & Partial<HTMLDivElement>
75
80
  input?: Omit<
76
81
  QInputProps,
77
82
  | 'id'
@@ -1,5 +1,10 @@
1
1
  <template>
2
- <q-form ref="formRef" class="q-gutter-md" v-bind="form">
2
+ <q-form
3
+ ref="formRef"
4
+ class="q-gutter-md"
5
+ v-bind="form"
6
+ @submit="(e) => submit"
7
+ >
3
8
  <otp-input v-bind="input" v-model="otp" />
4
9
  <q-input
5
10
  v-bind="input"
@@ -61,7 +66,7 @@ import OtpInput from './OtpInput.vue'
61
66
  export interface Props {
62
67
  email: string
63
68
  minimumPasswordLength?: number
64
- form?: QFormProps & HTMLFormElement
69
+ form?: QFormProps & Partial<HTMLFormElement> & Partial<HTMLDivElement>
65
70
  input?: Omit<
66
71
  QInputProps,
67
72
  | 'id'
@@ -3,6 +3,7 @@
3
3
  <q-step name="requestOtp" :title="requestOtpHeader">
4
4
  <request-otp-form
5
5
  ref="requestOtpFormRef"
6
+ :form="{ id: 'requestOtpForm' }"
6
7
  :input="input"
7
8
  @submit="requestOtp"
8
9
  ></request-otp-form>
@@ -11,6 +12,7 @@
11
12
  <q-step name="changePassword" :title="passwordChangeHeader">
12
13
  <password-change-form
13
14
  ref="passwordChangeFormRef"
15
+ :form="{ id: 'passwordChangeForm' }"
14
16
  :email="email"
15
17
  :input="input"
16
18
  @submit="changePassword"
@@ -22,10 +24,12 @@
22
24
  <q-submit-button
23
25
  v-if="step === 'requestOtp'"
24
26
  is-next-button
27
+ form="requestOtpForm"
25
28
  @submit="requestOtpFormRef?.functions.submit"
26
29
  ></q-submit-button>
27
30
  <q-submit-button
28
31
  v-if="step === 'changePassword'"
32
+ form="passwordChangeForm"
29
33
  @submit="passwordChangeFormRef?.functions.submit"
30
34
  ></q-submit-button>
31
35
  </q-stepper-navigation>
@@ -1,5 +1,10 @@
1
1
  <template>
2
- <q-form ref="formRef" class="q-gutter-md" v-bind="form">
2
+ <q-form
3
+ ref="formRef"
4
+ class="q-gutter-md"
5
+ v-bind="form"
6
+ @submit="(e) => submit"
7
+ >
3
8
  <q-input
4
9
  v-if="!useUsername"
5
10
  v-bind="input"
@@ -97,7 +102,7 @@ export interface Props {
97
102
  rules?: ((val: string) => boolean)[]
98
103
  }[]
99
104
  minimumPasswordLength?: number
100
- form?: QFormProps & HTMLFormElement
105
+ form?: QFormProps & Partial<HTMLFormElement> & Partial<HTMLDivElement>
101
106
  input?: Omit<
102
107
  QInputProps,
103
108
  | 'id'
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <q-form ref="formRef" v-bind="form">
2
+ <q-form ref="formRef" v-bind="form" @submit="(e) => submit">
3
3
  <q-input
4
4
  v-bind="input"
5
5
  id="email"
@@ -29,7 +29,7 @@ import isEmail from 'validator/es/lib/isEmail.js'
29
29
  import QSubmitButton from '../general/QSubmitButton.vue'
30
30
 
31
31
  export interface Props {
32
- form?: QFormProps & HTMLFormElement
32
+ form?: QFormProps & Partial<HTMLFormElement> & Partial<HTMLDivElement>
33
33
  input?: Omit<
34
34
  QInputProps,
35
35
  | 'id'
@@ -86,8 +86,7 @@ const lang: Language = {
86
86
  alreadyRegistered: 'Email address is already registered.'
87
87
  },
88
88
  verification: {
89
- slider:
90
- 'Sleep a.u.b. de onderstaande balk helemaal naar rechts tot deze groen wordt.'
89
+ slider: 'Please drag the slider below all the way to the right.'
91
90
  }
92
91
  }
93
92
 
@@ -86,8 +86,7 @@ const lang: Language = {
86
86
  alreadyRegistered: 'Email adres is al geregistreerd.'
87
87
  },
88
88
  verification: {
89
- slider:
90
- 'Please drag the slider all the way to the right until it turns green.'
89
+ slider: 'Sleep a.u.b. het onderstaande bolletje helemaal naar rechts.'
91
90
  }
92
91
  }
93
92
 
@@ -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,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' | 'surname' | '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
+ | 'surname'
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>