@ramathibodi/nuxt-commons 0.1.14 → 0.1.16

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 (54) hide show
  1. package/README.md +96 -96
  2. package/dist/module.json +1 -1
  3. package/dist/runtime/components/Alert.vue +53 -53
  4. package/dist/runtime/components/BarcodeReader.vue +98 -98
  5. package/dist/runtime/components/ExportCSV.vue +55 -55
  6. package/dist/runtime/components/FileBtn.vue +62 -62
  7. package/dist/runtime/components/ImportCSV.vue +64 -64
  8. package/dist/runtime/components/SplitterPanel.vue +59 -59
  9. package/dist/runtime/components/TabsGroup.vue +32 -32
  10. package/dist/runtime/components/TextBarcode.vue +52 -52
  11. package/dist/runtime/components/dialog/Confirm.vue +100 -100
  12. package/dist/runtime/components/dialog/Index.vue +72 -72
  13. package/dist/runtime/components/dialog/Loading.vue +39 -39
  14. package/dist/runtime/components/document/TemplateBuilder.vue +203 -216
  15. package/dist/runtime/components/form/Birthdate.vue +216 -216
  16. package/dist/runtime/components/form/CodeEditor.vue +37 -37
  17. package/dist/runtime/components/form/Date.vue +163 -163
  18. package/dist/runtime/components/form/DateTime.vue +107 -107
  19. package/dist/runtime/components/form/Dialog.vue +138 -138
  20. package/dist/runtime/components/form/File.vue +187 -187
  21. package/dist/runtime/components/form/Hidden.vue +32 -32
  22. package/dist/runtime/components/form/Login.vue +131 -131
  23. package/dist/runtime/components/form/Pad.vue +217 -217
  24. package/dist/runtime/components/form/SignPad.vue +186 -186
  25. package/dist/runtime/components/form/Table.vue +294 -266
  26. package/dist/runtime/components/form/Time.vue +158 -158
  27. package/dist/runtime/components/form/images/Capture.vue +230 -230
  28. package/dist/runtime/components/form/images/Edit.vue +114 -114
  29. package/dist/runtime/components/label/Date.vue +29 -29
  30. package/dist/runtime/components/label/Field.vue +42 -42
  31. package/dist/runtime/components/label/FormatMoney.vue +29 -29
  32. package/dist/runtime/components/label/Mask.vue +38 -38
  33. package/dist/runtime/components/master/Autocomplete.vue +159 -159
  34. package/dist/runtime/components/master/Combobox.vue +84 -84
  35. package/dist/runtime/components/master/RadioGroup.vue +78 -78
  36. package/dist/runtime/components/master/Select.vue +82 -82
  37. package/dist/runtime/components/model/Pad.vue +122 -122
  38. package/dist/runtime/components/model/Table.vue +242 -240
  39. package/dist/runtime/components/model/iterator.vue +312 -312
  40. package/dist/runtime/components/pdf/Print.vue +63 -63
  41. package/dist/runtime/components/pdf/View.vue +104 -104
  42. package/dist/runtime/composables/graphqlModel.mjs +1 -1
  43. package/dist/runtime/labs/Calendar.vue +99 -99
  44. package/dist/runtime/labs/form/EditMobile.vue +152 -152
  45. package/dist/runtime/labs/form/TextFieldMask.vue +43 -43
  46. package/dist/runtime/types/alert.d.ts +11 -11
  47. package/dist/runtime/types/formDialog.d.ts +4 -4
  48. package/dist/runtime/types/graphqlOperation.d.ts +23 -23
  49. package/dist/runtime/types/menu.d.ts +25 -25
  50. package/dist/runtime/types/modules.d.ts +7 -7
  51. package/package.json +120 -119
  52. package/scripts/postInstall.cjs +70 -70
  53. package/templates/.codegen/codegen.ts +32 -32
  54. package/templates/.codegen/plugin-schema-object.js +161 -154
@@ -1,32 +1,32 @@
1
- <script lang="ts" setup>
2
- import { watch } from 'vue'
3
- import { cloneDeep } from 'lodash-es'
4
-
5
- interface Props {
6
- itemValue?: any
7
- hook?: Function
8
- modelValue?: any
9
- }
10
-
11
- const props = defineProps<Props>()
12
- const emit = defineEmits(['update:modelValue'])
13
-
14
- watch(() => props.itemValue, (newValue) => {
15
- const resultValue = cloneDeep(newValue)
16
- if (props.hook) {
17
- Promise.resolve(props.hook(resultValue, props.modelValue)).then((result) => {
18
- emit('update:modelValue', result)
19
- }).catch(e => void e)
20
- }
21
- else {
22
- emit('update:modelValue', resultValue)
23
- }
24
- }, { deep: true, immediate: true })
25
- </script>
26
-
27
- <template>
28
- <input
29
- type="hidden"
30
- v-bind="$attrs"
31
- >
32
- </template>
1
+ <script lang="ts" setup>
2
+ import { watch } from 'vue'
3
+ import { cloneDeep } from 'lodash-es'
4
+
5
+ interface Props {
6
+ itemValue?: any
7
+ hook?: Function
8
+ modelValue?: any
9
+ }
10
+
11
+ const props = defineProps<Props>()
12
+ const emit = defineEmits(['update:modelValue'])
13
+
14
+ watch(() => props.itemValue, (newValue) => {
15
+ const resultValue = cloneDeep(newValue)
16
+ if (props.hook) {
17
+ Promise.resolve(props.hook(resultValue, props.modelValue)).then((result) => {
18
+ emit('update:modelValue', result)
19
+ }).catch(e => void e)
20
+ }
21
+ else {
22
+ emit('update:modelValue', resultValue)
23
+ }
24
+ }, { deep: true, immediate: true })
25
+ </script>
26
+
27
+ <template>
28
+ <input
29
+ type="hidden"
30
+ v-bind="$attrs"
31
+ >
32
+ </template>
@@ -1,131 +1,131 @@
1
- <script lang="ts" setup>
2
- import { ref, watch, withDefaults } from 'vue'
3
-
4
- interface Props {
5
- title?: string
6
- btnSubmit?: string
7
- imgLogo?: string
8
- errorMessages?: string
9
- loading?: boolean
10
- hint?: string
11
- }
12
-
13
- const props = withDefaults(defineProps<Props>(), {
14
- title: 'Login Ramathibodi',
15
- btnSubmit: 'เข้าสู่ระบบ',
16
- imgLogo: '',
17
- errorMessages: '',
18
- loading: false,
19
- hint: '',
20
- })
21
-
22
- interface LoginData {
23
- username: string
24
- password: string
25
- }
26
-
27
- const formValid = ref<boolean>(false)
28
- const loginData = ref<LoginData>({ username: '', password: '' })
29
- const emit = defineEmits(['update:modelValue'])
30
-
31
- const errorText = ref<string>('')
32
-
33
- const clearErrorMessages = () => {
34
- errorText.value = ''
35
- }
36
-
37
- watch(() => props.errorMessages, (newVal) => {
38
- if (errorText.value !== newVal) {
39
- errorText.value = newVal
40
- }
41
- })
42
-
43
- const onSubmit = () => {
44
- if (!formValid.value) return
45
- emit('update:modelValue', { ...loginData.value })
46
- }
47
- </script>
48
-
49
- <template>
50
- <v-row
51
- justify="center"
52
- align="center"
53
- >
54
- <v-col
55
- cols="12"
56
- xs="12"
57
- sm="8"
58
- md="6"
59
- lg="6"
60
- xl="4"
61
- align-self="center"
62
- >
63
- <v-sheet
64
- class="pa-3"
65
- rounded
66
- >
67
- <v-card class="mx-auto px-6 py-6">
68
- <v-img
69
- :src="props.imgLogo"
70
- cover
71
- />
72
- <v-card-title class="text-primary text-center">
73
- {{ props.title }}
74
- </v-card-title>
75
- <v-form
76
- v-model="formValid"
77
- @submit.prevent="onSubmit"
78
- >
79
- <form-pad
80
- ref="formPadTemplate"
81
- v-model="loginData"
82
- >
83
- <template #default="{ data, rules }">
84
- <v-text-field
85
- ref="usernameField"
86
- v-model="data.username"
87
- color="primary"
88
- label="ชื่อผู้ใช้งาน (Username)"
89
- clearable
90
- :rules="[rules.require('กรุณาระบุ')]"
91
- autofocus
92
- @update:model-value="clearErrorMessages()"
93
- />
94
- <v-text-field
95
- ref="passwordField"
96
- v-model="data.password"
97
- color="primary"
98
- label="รหัสผ่าน (Password)"
99
- type="password"
100
- clearable
101
- :rules="[rules.require('กรุณาระบุ')]"
102
- autofocus
103
- @update:model-value="clearErrorMessages()"
104
- />
105
- </template>
106
- </form-pad>
107
- <div class="text-body-2 text-error">
108
- {{ errorText }}
109
- </div>
110
- <div class="my-3">
111
- <slot name="hint">
112
- {{ props.hint }}
113
- </slot>
114
- </div>
115
- <v-btn
116
- :disabled="!formValid"
117
- :loading="props.loading"
118
- block
119
- color="primary"
120
- size="large"
121
- type="submit"
122
- variant="elevated"
123
- >
124
- {{ props.btnSubmit }}
125
- </v-btn>
126
- </v-form>
127
- </v-card>
128
- </v-sheet>
129
- </v-col>
130
- </v-row>
131
- </template>
1
+ <script lang="ts" setup>
2
+ import { ref, watch, withDefaults } from 'vue'
3
+
4
+ interface Props {
5
+ title?: string
6
+ btnSubmit?: string
7
+ imgLogo?: string
8
+ errorMessages?: string
9
+ loading?: boolean
10
+ hint?: string
11
+ }
12
+
13
+ const props = withDefaults(defineProps<Props>(), {
14
+ title: 'Login Ramathibodi',
15
+ btnSubmit: 'เข้าสู่ระบบ',
16
+ imgLogo: '',
17
+ errorMessages: '',
18
+ loading: false,
19
+ hint: '',
20
+ })
21
+
22
+ interface LoginData {
23
+ username: string
24
+ password: string
25
+ }
26
+
27
+ const formValid = ref<boolean>(false)
28
+ const loginData = ref<LoginData>({ username: '', password: '' })
29
+ const emit = defineEmits(['update:modelValue'])
30
+
31
+ const errorText = ref<string>('')
32
+
33
+ const clearErrorMessages = () => {
34
+ errorText.value = ''
35
+ }
36
+
37
+ watch(() => props.errorMessages, (newVal) => {
38
+ if (errorText.value !== newVal) {
39
+ errorText.value = newVal
40
+ }
41
+ })
42
+
43
+ const onSubmit = () => {
44
+ if (!formValid.value) return
45
+ emit('update:modelValue', { ...loginData.value })
46
+ }
47
+ </script>
48
+
49
+ <template>
50
+ <v-row
51
+ justify="center"
52
+ align="center"
53
+ >
54
+ <v-col
55
+ cols="12"
56
+ xs="12"
57
+ sm="8"
58
+ md="6"
59
+ lg="6"
60
+ xl="4"
61
+ align-self="center"
62
+ >
63
+ <v-sheet
64
+ class="pa-3"
65
+ rounded
66
+ >
67
+ <v-card class="mx-auto px-6 py-6">
68
+ <v-img
69
+ :src="props.imgLogo"
70
+ cover
71
+ />
72
+ <v-card-title class="text-primary text-center">
73
+ {{ props.title }}
74
+ </v-card-title>
75
+ <v-form
76
+ v-model="formValid"
77
+ @submit.prevent="onSubmit"
78
+ >
79
+ <form-pad
80
+ ref="formPadTemplate"
81
+ v-model="loginData"
82
+ >
83
+ <template #default="{ data, rules }">
84
+ <v-text-field
85
+ ref="usernameField"
86
+ v-model="data.username"
87
+ color="primary"
88
+ label="ชื่อผู้ใช้งาน (Username)"
89
+ clearable
90
+ :rules="[rules.require('กรุณาระบุ')]"
91
+ autofocus
92
+ @update:model-value="clearErrorMessages()"
93
+ />
94
+ <v-text-field
95
+ ref="passwordField"
96
+ v-model="data.password"
97
+ color="primary"
98
+ label="รหัสผ่าน (Password)"
99
+ type="password"
100
+ clearable
101
+ :rules="[rules.require('กรุณาระบุ')]"
102
+ autofocus
103
+ @update:model-value="clearErrorMessages()"
104
+ />
105
+ </template>
106
+ </form-pad>
107
+ <div class="text-body-2 text-error">
108
+ {{ errorText }}
109
+ </div>
110
+ <div class="my-3">
111
+ <slot name="hint">
112
+ {{ props.hint }}
113
+ </slot>
114
+ </div>
115
+ <v-btn
116
+ :disabled="!formValid"
117
+ :loading="props.loading"
118
+ block
119
+ color="primary"
120
+ size="large"
121
+ type="submit"
122
+ variant="elevated"
123
+ >
124
+ {{ props.btnSubmit }}
125
+ </v-btn>
126
+ </v-form>
127
+ </v-card>
128
+ </v-sheet>
129
+ </v-col>
130
+ </v-row>
131
+ </template>