@ramathibodi/nuxt-commons 0.1.74 → 0.1.75

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 (96) hide show
  1. package/README.md +115 -115
  2. package/dist/module.json +1 -1
  3. package/dist/runtime/components/Alert.vue +58 -58
  4. package/dist/runtime/components/BarcodeReader.vue +130 -130
  5. package/dist/runtime/components/ExportCSV.vue +110 -110
  6. package/dist/runtime/components/FileBtn.vue +79 -79
  7. package/dist/runtime/components/ImportCSV.vue +151 -151
  8. package/dist/runtime/components/MrzReader.vue +168 -168
  9. package/dist/runtime/components/SplitterPanel.vue +67 -67
  10. package/dist/runtime/components/TabsGroup.vue +39 -39
  11. package/dist/runtime/components/TextBarcode.vue +66 -66
  12. package/dist/runtime/components/device/IdCardButton.vue +95 -95
  13. package/dist/runtime/components/device/IdCardWebSocket.vue +207 -207
  14. package/dist/runtime/components/device/Scanner.vue +350 -350
  15. package/dist/runtime/components/dialog/Confirm.vue +112 -112
  16. package/dist/runtime/components/dialog/Host.vue +88 -88
  17. package/dist/runtime/components/dialog/Index.vue +84 -84
  18. package/dist/runtime/components/dialog/Loading.vue +51 -51
  19. package/dist/runtime/components/dialog/default/Confirm.vue +112 -112
  20. package/dist/runtime/components/dialog/default/Loading.vue +60 -60
  21. package/dist/runtime/components/dialog/default/Notify.vue +82 -82
  22. package/dist/runtime/components/dialog/default/Printing.vue +46 -46
  23. package/dist/runtime/components/dialog/default/VerifyUser.vue +144 -144
  24. package/dist/runtime/components/document/Form.vue +50 -50
  25. package/dist/runtime/components/document/TemplateBuilder.vue +536 -536
  26. package/dist/runtime/components/form/ActionPad.vue +156 -156
  27. package/dist/runtime/components/form/Birthdate.vue +116 -116
  28. package/dist/runtime/components/form/CheckboxGroup.vue +99 -99
  29. package/dist/runtime/components/form/CodeEditor.vue +45 -45
  30. package/dist/runtime/components/form/Date.vue +270 -270
  31. package/dist/runtime/components/form/DateTime.vue +220 -220
  32. package/dist/runtime/components/form/Dialog.vue +178 -178
  33. package/dist/runtime/components/form/EditPad.vue +157 -157
  34. package/dist/runtime/components/form/File.vue +295 -295
  35. package/dist/runtime/components/form/Hidden.vue +44 -44
  36. package/dist/runtime/components/form/Iterator.vue +538 -538
  37. package/dist/runtime/components/form/Login.vue +143 -143
  38. package/dist/runtime/components/form/Pad.vue +399 -399
  39. package/dist/runtime/components/form/SignPad.vue +226 -226
  40. package/dist/runtime/components/form/System.vue +34 -34
  41. package/dist/runtime/components/form/Table.vue +391 -391
  42. package/dist/runtime/components/form/TableData.vue +236 -236
  43. package/dist/runtime/components/form/Time.vue +177 -177
  44. package/dist/runtime/components/form/images/Capture.vue +245 -245
  45. package/dist/runtime/components/form/images/Edit.vue +133 -133
  46. package/dist/runtime/components/form/images/Field.vue +331 -331
  47. package/dist/runtime/components/form/images/Pad.vue +54 -54
  48. package/dist/runtime/components/label/Date.vue +37 -37
  49. package/dist/runtime/components/label/DateAgo.vue +102 -102
  50. package/dist/runtime/components/label/DateCount.vue +152 -152
  51. package/dist/runtime/components/label/Field.vue +111 -111
  52. package/dist/runtime/components/label/FormatMoney.vue +37 -37
  53. package/dist/runtime/components/label/Mask.vue +46 -46
  54. package/dist/runtime/components/label/Object.vue +21 -21
  55. package/dist/runtime/components/master/Autocomplete.vue +89 -89
  56. package/dist/runtime/components/master/Combobox.vue +88 -88
  57. package/dist/runtime/components/master/RadioGroup.vue +90 -90
  58. package/dist/runtime/components/master/Select.vue +70 -70
  59. package/dist/runtime/components/master/label.vue +55 -55
  60. package/dist/runtime/components/model/Autocomplete.vue +91 -91
  61. package/dist/runtime/components/model/Combobox.vue +90 -90
  62. package/dist/runtime/components/model/Pad.vue +114 -114
  63. package/dist/runtime/components/model/Select.vue +78 -84
  64. package/dist/runtime/components/model/Table.vue +370 -370
  65. package/dist/runtime/components/model/iterator.vue +497 -497
  66. package/dist/runtime/components/model/label.vue +58 -58
  67. package/dist/runtime/components/pdf/Print.vue +75 -75
  68. package/dist/runtime/components/pdf/View.vue +146 -146
  69. package/dist/runtime/composables/dialog.d.ts +1 -1
  70. package/dist/runtime/composables/graphql.d.ts +1 -1
  71. package/dist/runtime/composables/graphqlModel.d.ts +9 -9
  72. package/dist/runtime/composables/graphqlModelItem.d.ts +7 -7
  73. package/dist/runtime/composables/graphqlModelOperation.d.ts +6 -6
  74. package/dist/runtime/composables/userPermission.d.ts +1 -1
  75. package/dist/runtime/labs/Calendar.vue +99 -99
  76. package/dist/runtime/labs/form/EditMobile.vue +152 -152
  77. package/dist/runtime/labs/form/TextFieldMask.vue +43 -43
  78. package/dist/runtime/plugins/clientConfig.d.ts +1 -1
  79. package/dist/runtime/plugins/default.d.ts +1 -1
  80. package/dist/runtime/plugins/dialogManager.d.ts +1 -1
  81. package/dist/runtime/plugins/permission.d.ts +1 -1
  82. package/dist/runtime/types/alert.d.ts +11 -11
  83. package/dist/runtime/types/clientConfig.d.ts +13 -13
  84. package/dist/runtime/types/dialogManager.d.ts +35 -35
  85. package/dist/runtime/types/formDialog.d.ts +5 -5
  86. package/dist/runtime/types/graphqlOperation.d.ts +23 -23
  87. package/dist/runtime/types/menu.d.ts +31 -31
  88. package/dist/runtime/types/modules.d.ts +7 -7
  89. package/dist/runtime/types/permission.d.ts +13 -13
  90. package/package.json +131 -131
  91. package/scripts/enrich-vue-docs-from-ai.mjs +197 -197
  92. package/scripts/generate-ai-summary.mjs +321 -321
  93. package/scripts/generate-composables-md.mjs +129 -129
  94. package/scripts/postInstall.cjs +70 -70
  95. package/templates/.codegen/codegen.ts +32 -32
  96. package/templates/.codegen/plugin-schema-object.js +161 -161
@@ -1,58 +1,58 @@
1
- <script lang="ts" setup>
2
- /**
3
- * ModelLabel connects model metadata to reusable selection, labeling, iterator, or table UI patterns.
4
- * This doc block is consumed by vue-docgen for generated API documentation.
5
- */
6
- import { computedAsync } from '@vueuse/core'
7
- import { useGraphQlOperation } from '../../composables/graphqlOperation'
8
- import { concat } from "lodash-es";
9
- import { ref } from 'vue'
10
-
11
- interface Props {
12
- modelName: string // GraphQL model name used to resolve lookup/query metadata.
13
- modelBy?: object // Key/value filter used to fetch a specific model item.
14
- itemTitle: string | ((result:Record<string,any>)=>void) // Field name or mapper function used to build display labels.
15
- fields?: Array<string | object> // Field list/query selection used when fetching model or lookup data.
16
- cache?: boolean | number // Enables cached requests; number values represent cache TTL in milliseconds.
17
-
18
- notFoundText?: string // Text shown when the resolved value or label is unavailable.
19
- placeholder?: string // placeholder text shown when value is empty
20
- }
21
-
22
- /**
23
- * Public props accepted by ModelLabel.
24
- * Document each prop field with intent, defaults, and side effects for clear generated docs.
25
- */
26
- const props = withDefaults(defineProps<Props>(), {
27
- cache: false,
28
- })
29
-
30
- const modelItem = ref<Record<string, any>>({})
31
-
32
- const modelItemValue = computedAsync<string>(async () => {
33
- if (props.modelName && props.itemTitle) {
34
- let fields: any[] = (typeof props.itemTitle === "string") ? [props.itemTitle] : []
35
- if (props.fields) fields = concat(fields, props.fields)
36
-
37
- const variables: Record<string, any> = Object.assign({},props.modelBy)
38
- const result : Record<string, any> = await useGraphQlOperation('Query',props.modelName,fields,variables,props.cache)
39
-
40
- try {
41
- if (result) {
42
- modelItem.value = result
43
- if (typeof props.itemTitle === "string") return result[props.itemTitle]
44
- else return props.itemTitle(result)
45
- }
46
- } catch (e) {
47
- console.error(e)
48
- }
49
- }
50
- return props.notFoundText
51
- }, props.placeholder ?? '' )
52
- </script>
53
-
54
- <template>
55
- <slot name="default" :data="modelItem">
56
- <span>{{ modelItemValue }}</span>
57
- </slot>
58
- </template>
1
+ <script lang="ts" setup>
2
+ /**
3
+ * ModelLabel connects model metadata to reusable selection, labeling, iterator, or table UI patterns.
4
+ * This doc block is consumed by vue-docgen for generated API documentation.
5
+ */
6
+ import { computedAsync } from '@vueuse/core'
7
+ import { useGraphQlOperation } from '../../composables/graphqlOperation'
8
+ import { concat } from "lodash-es";
9
+ import { ref } from 'vue'
10
+
11
+ interface Props {
12
+ modelName: string // GraphQL model name used to resolve lookup/query metadata.
13
+ modelBy?: object // Key/value filter used to fetch a specific model item.
14
+ itemTitle: string | ((result:Record<string,any>)=>void) // Field name or mapper function used to build display labels.
15
+ fields?: Array<string | object> // Field list/query selection used when fetching model or lookup data.
16
+ cache?: boolean | number // Enables cached requests; number values represent cache TTL in milliseconds.
17
+
18
+ notFoundText?: string // Text shown when the resolved value or label is unavailable.
19
+ placeholder?: string // placeholder text shown when value is empty
20
+ }
21
+
22
+ /**
23
+ * Public props accepted by ModelLabel.
24
+ * Document each prop field with intent, defaults, and side effects for clear generated docs.
25
+ */
26
+ const props = withDefaults(defineProps<Props>(), {
27
+ cache: false,
28
+ })
29
+
30
+ const modelItem = ref<Record<string, any>>({})
31
+
32
+ const modelItemValue = computedAsync<string>(async () => {
33
+ if (props.modelName && props.itemTitle) {
34
+ let fields: any[] = (typeof props.itemTitle === "string") ? [props.itemTitle] : []
35
+ if (props.fields) fields = concat(fields, props.fields)
36
+
37
+ const variables: Record<string, any> = Object.assign({},props.modelBy)
38
+ const result : Record<string, any> = await useGraphQlOperation('Query',props.modelName,fields,variables,props.cache)
39
+
40
+ try {
41
+ if (result) {
42
+ modelItem.value = result
43
+ if (typeof props.itemTitle === "string") return result[props.itemTitle]
44
+ else return props.itemTitle(result)
45
+ }
46
+ } catch (e) {
47
+ console.error(e)
48
+ }
49
+ }
50
+ return props.notFoundText
51
+ }, props.placeholder ?? '' )
52
+ </script>
53
+
54
+ <template>
55
+ <slot name="default" :data="modelItem">
56
+ <span>{{ modelItemValue }}</span>
57
+ </slot>
58
+ </template>
@@ -1,75 +1,75 @@
1
- <script setup lang="ts">
2
- /**
3
- * PdfPrint renders a print-oriented PDF view and handles browser print lifecycle events.
4
- * This doc block is consumed by vue-docgen for generated API documentation.
5
- */
6
- import printJS from 'print-js'
7
- import { ref, watch } from 'vue'
8
- import { useAlert } from '../../composables/alert'
9
-
10
- interface Props {
11
- base64String?: string // Base64 document payload used as the PDF source.
12
- fileName?: string // File name used when downloading or printing generated files.
13
- print?: boolean // When true, starts printing automatically after the PDF is ready.
14
- title?: string // Title text displayed in the component header or dialog.
15
- disabled?: boolean // disables user interaction for this field
16
- }
17
-
18
- /**
19
- * Public props accepted by PdfPrint.
20
- * Document each prop field with intent, defaults, and side effects for clear generated docs.
21
- */
22
- const props = withDefaults(defineProps<Props>(), {
23
- print: false,
24
- disabled: false,
25
- })
26
- /**
27
- * Custom events emitted by PdfPrint.
28
- * Parents can listen to these events to react to user actions and internal state changes.
29
- */
30
- const emit = defineEmits(['update:print'])
31
-
32
- const isMobile = ref(false)
33
- const alert = useAlert()
34
-
35
- const openPdf = () => {
36
- if (/Android|Mobi|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Macintosh/i.test(navigator.userAgent)) {
37
- isMobile.value = true
38
- }
39
- else {
40
- printJS({
41
- printable: props.base64String,
42
- type: 'pdf',
43
- base64: true,
44
- onPrintDialogClose: endLoadPdf,
45
- onError: (error: any) => {
46
- alert?.addAlert({ message: error, alertType: 'error' })
47
- },
48
- })
49
- }
50
- }
51
-
52
- const endLoadPdf = () => {
53
- emit('update:print', false)
54
- isMobile.value = false
55
- }
56
-
57
- watch(() => props.print, () => {
58
- if (props.print) openPdf()
59
- })
60
- </script>
61
-
62
- <template>
63
- <v-dialog
64
- v-model="isMobile"
65
- fullscreen
66
- >
67
- <PdfView
68
- :base64-string="props.base64String"
69
- :disabled="props.disabled"
70
- :title="props.title"
71
- :file-name="props.fileName"
72
- @close-dialog="endLoadPdf"
73
- />
74
- </v-dialog>
75
- </template>
1
+ <script setup lang="ts">
2
+ /**
3
+ * PdfPrint renders a print-oriented PDF view and handles browser print lifecycle events.
4
+ * This doc block is consumed by vue-docgen for generated API documentation.
5
+ */
6
+ import printJS from 'print-js'
7
+ import { ref, watch } from 'vue'
8
+ import { useAlert } from '../../composables/alert'
9
+
10
+ interface Props {
11
+ base64String?: string // Base64 document payload used as the PDF source.
12
+ fileName?: string // File name used when downloading or printing generated files.
13
+ print?: boolean // When true, starts printing automatically after the PDF is ready.
14
+ title?: string // Title text displayed in the component header or dialog.
15
+ disabled?: boolean // disables user interaction for this field
16
+ }
17
+
18
+ /**
19
+ * Public props accepted by PdfPrint.
20
+ * Document each prop field with intent, defaults, and side effects for clear generated docs.
21
+ */
22
+ const props = withDefaults(defineProps<Props>(), {
23
+ print: false,
24
+ disabled: false,
25
+ })
26
+ /**
27
+ * Custom events emitted by PdfPrint.
28
+ * Parents can listen to these events to react to user actions and internal state changes.
29
+ */
30
+ const emit = defineEmits(['update:print'])
31
+
32
+ const isMobile = ref(false)
33
+ const alert = useAlert()
34
+
35
+ const openPdf = () => {
36
+ if (/Android|Mobi|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Macintosh/i.test(navigator.userAgent)) {
37
+ isMobile.value = true
38
+ }
39
+ else {
40
+ printJS({
41
+ printable: props.base64String,
42
+ type: 'pdf',
43
+ base64: true,
44
+ onPrintDialogClose: endLoadPdf,
45
+ onError: (error: any) => {
46
+ alert?.addAlert({ message: error, alertType: 'error' })
47
+ },
48
+ })
49
+ }
50
+ }
51
+
52
+ const endLoadPdf = () => {
53
+ emit('update:print', false)
54
+ isMobile.value = false
55
+ }
56
+
57
+ watch(() => props.print, () => {
58
+ if (props.print) openPdf()
59
+ })
60
+ </script>
61
+
62
+ <template>
63
+ <v-dialog
64
+ v-model="isMobile"
65
+ fullscreen
66
+ >
67
+ <PdfView
68
+ :base64-string="props.base64String"
69
+ :disabled="props.disabled"
70
+ :title="props.title"
71
+ :file-name="props.fileName"
72
+ @close-dialog="endLoadPdf"
73
+ />
74
+ </v-dialog>
75
+ </template>
@@ -1,146 +1,146 @@
1
- <script setup lang="ts">
2
- /**
3
- * PdfView displays PDF documents in-app with loading and viewport state management for preview workflows.
4
- * This doc block is consumed by vue-docgen for generated API documentation.
5
- */
6
- import PDF from 'pdf-vue3'
7
- import { uid } from 'uid'
8
- import printJS from 'print-js'
9
- import { ref, computed } from 'vue'
10
- import { useAlert } from '../../composables/alert'
11
-
12
- interface Props extends /* @vue-ignore */ InstanceType<typeof PDF['$props']> {
13
- base64String?: string // Base64 document payload used as the PDF source.
14
- title?: string // Title text displayed in the component header or dialog.
15
- fileName?: string // File name used when downloading or printing generated files.
16
- disabled?: boolean // disables user interaction for this field
17
- isPrint?: boolean // boolean flag controlling runtime behavior
18
- showBackToTopBtn?: boolean // Shows a back-to-top button while scrolling long PDF content.
19
- }
20
-
21
- /**
22
- * Public props accepted by PdfView.
23
- * Document each prop field with intent, defaults, and side effects for clear generated docs.
24
- */
25
- const props = withDefaults(defineProps<Props>(), {
26
- base64String: '',
27
- title: '',
28
- fileName: '',
29
- disabled: false,
30
- isPrint: false,
31
- showBackToTopBtn: false,
32
- })
33
-
34
- /**
35
- * Custom events emitted by PdfView.
36
- * Parents can listen to these events to react to user actions and internal state changes.
37
- */
38
- const emit = defineEmits(['closeDialog'])
39
- const base64 = ref(props.base64String)
40
- const alert = useAlert()
41
-
42
- const generateUniqueId = (): string => {
43
- const uniqueId: string = uid()
44
- return props.fileName ? `${props.fileName}` : uniqueId
45
- }
46
-
47
- const downloadPdf = (): void => {
48
- try {
49
- if (!props.base64String) alert?.addAlert({ message: 'No Base64 provided', alertType: 'error' })
50
-
51
- const byteString = atob(props.base64String || '')
52
- const byteArray = new Uint8Array(byteString.length)
53
-
54
- for (let i = 0; i < byteString.length; i++) {
55
- byteArray[i] = byteString.charCodeAt(i)
56
- }
57
-
58
- const blob = new Blob([byteArray], { type: 'application/pdf' })
59
- const link = URL.createObjectURL(blob)
60
- const anchorElement = document.createElement('a')
61
- anchorElement.style.display = 'none'
62
- anchorElement.href = link
63
- anchorElement.download = `${generateUniqueId()}.pdf`
64
-
65
- document.body.appendChild(anchorElement)
66
- anchorElement.click()
67
- URL.revokeObjectURL(link)
68
- document.body.removeChild(anchorElement)
69
- base64.value = ''
70
-
71
- alert?.addAlert({ message: 'Download success', alertType: 'success' })
72
- }
73
- catch (error) {
74
- alert?.addAlert({ message: `Download unsuccess : ${error}`, alertType: 'error' })
75
- }
76
- }
77
-
78
- const printPdf = () => {
79
- printJS({
80
- printable: props.base64String,
81
- type: 'pdf',
82
- base64: true,
83
- onPrintDialogClose: endLoadPdf,
84
- onError: (error) => {
85
- alert?.addAlert({ message: error, alertType: 'error' })
86
- },
87
- })
88
- base64.value = ''
89
- }
90
-
91
- const endLoadPdf = () => {
92
- emit('closeDialog', false)
93
- base64.value = ''
94
- }
95
-
96
- const isMobile = () => {
97
- return /Android|Mobi|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Macintosh/i.test(navigator.userAgent)
98
- }
99
-
100
- const checkMobileAndPrint = computed(() => {
101
- return !isMobile() && props.isPrint
102
- })
103
-
104
- const setWidthPdf = computed(() => {
105
- if (isMobile()) {
106
- return '100%'
107
- }
108
- else {
109
- return '100dvh'
110
- }
111
- })
112
- </script>
113
-
114
- <template>
115
- <v-card>
116
- <v-toolbar density="compact">
117
- <v-toolbar-title>{{ props.title }}</v-toolbar-title>
118
- <v-spacer />
119
- <v-btn
120
- v-if="checkMobileAndPrint"
121
- icon="mdi mdi-printer"
122
- variant="plain"
123
- @click="printPdf"
124
- />
125
- <v-btn
126
- v-if="!props.disabled"
127
- icon="mdi mdi-download"
128
- variant="plain"
129
- @click="downloadPdf"
130
- />
131
- <v-btn
132
- icon="mdi mdi-close"
133
- variant="plain"
134
- @click="endLoadPdf"
135
- />
136
- </v-toolbar>
137
- <v-card-text class="justify-center h-screen">
138
- <PDF
139
- v-bind="$attrs"
140
- :pdf-width="setWidthPdf"
141
- :src="base64"
142
- :show-back-to-top-btn="props.showBackToTopBtn"
143
- />
144
- </v-card-text>
145
- </v-card>
146
- </template>
1
+ <script setup lang="ts">
2
+ /**
3
+ * PdfView displays PDF documents in-app with loading and viewport state management for preview workflows.
4
+ * This doc block is consumed by vue-docgen for generated API documentation.
5
+ */
6
+ import PDF from 'pdf-vue3'
7
+ import { uid } from 'uid'
8
+ import printJS from 'print-js'
9
+ import { ref, computed } from 'vue'
10
+ import { useAlert } from '../../composables/alert'
11
+
12
+ interface Props extends /* @vue-ignore */ InstanceType<typeof PDF['$props']> {
13
+ base64String?: string // Base64 document payload used as the PDF source.
14
+ title?: string // Title text displayed in the component header or dialog.
15
+ fileName?: string // File name used when downloading or printing generated files.
16
+ disabled?: boolean // disables user interaction for this field
17
+ isPrint?: boolean // boolean flag controlling runtime behavior
18
+ showBackToTopBtn?: boolean // Shows a back-to-top button while scrolling long PDF content.
19
+ }
20
+
21
+ /**
22
+ * Public props accepted by PdfView.
23
+ * Document each prop field with intent, defaults, and side effects for clear generated docs.
24
+ */
25
+ const props = withDefaults(defineProps<Props>(), {
26
+ base64String: '',
27
+ title: '',
28
+ fileName: '',
29
+ disabled: false,
30
+ isPrint: false,
31
+ showBackToTopBtn: false,
32
+ })
33
+
34
+ /**
35
+ * Custom events emitted by PdfView.
36
+ * Parents can listen to these events to react to user actions and internal state changes.
37
+ */
38
+ const emit = defineEmits(['closeDialog'])
39
+ const base64 = ref(props.base64String)
40
+ const alert = useAlert()
41
+
42
+ const generateUniqueId = (): string => {
43
+ const uniqueId: string = uid()
44
+ return props.fileName ? `${props.fileName}` : uniqueId
45
+ }
46
+
47
+ const downloadPdf = (): void => {
48
+ try {
49
+ if (!props.base64String) alert?.addAlert({ message: 'No Base64 provided', alertType: 'error' })
50
+
51
+ const byteString = atob(props.base64String || '')
52
+ const byteArray = new Uint8Array(byteString.length)
53
+
54
+ for (let i = 0; i < byteString.length; i++) {
55
+ byteArray[i] = byteString.charCodeAt(i)
56
+ }
57
+
58
+ const blob = new Blob([byteArray], { type: 'application/pdf' })
59
+ const link = URL.createObjectURL(blob)
60
+ const anchorElement = document.createElement('a')
61
+ anchorElement.style.display = 'none'
62
+ anchorElement.href = link
63
+ anchorElement.download = `${generateUniqueId()}.pdf`
64
+
65
+ document.body.appendChild(anchorElement)
66
+ anchorElement.click()
67
+ URL.revokeObjectURL(link)
68
+ document.body.removeChild(anchorElement)
69
+ base64.value = ''
70
+
71
+ alert?.addAlert({ message: 'Download success', alertType: 'success' })
72
+ }
73
+ catch (error) {
74
+ alert?.addAlert({ message: `Download unsuccess : ${error}`, alertType: 'error' })
75
+ }
76
+ }
77
+
78
+ const printPdf = () => {
79
+ printJS({
80
+ printable: props.base64String,
81
+ type: 'pdf',
82
+ base64: true,
83
+ onPrintDialogClose: endLoadPdf,
84
+ onError: (error) => {
85
+ alert?.addAlert({ message: error, alertType: 'error' })
86
+ },
87
+ })
88
+ base64.value = ''
89
+ }
90
+
91
+ const endLoadPdf = () => {
92
+ emit('closeDialog', false)
93
+ base64.value = ''
94
+ }
95
+
96
+ const isMobile = () => {
97
+ return /Android|Mobi|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Macintosh/i.test(navigator.userAgent)
98
+ }
99
+
100
+ const checkMobileAndPrint = computed(() => {
101
+ return !isMobile() && props.isPrint
102
+ })
103
+
104
+ const setWidthPdf = computed(() => {
105
+ if (isMobile()) {
106
+ return '100%'
107
+ }
108
+ else {
109
+ return '100dvh'
110
+ }
111
+ })
112
+ </script>
113
+
114
+ <template>
115
+ <v-card>
116
+ <v-toolbar density="compact">
117
+ <v-toolbar-title>{{ props.title }}</v-toolbar-title>
118
+ <v-spacer />
119
+ <v-btn
120
+ v-if="checkMobileAndPrint"
121
+ icon="mdi mdi-printer"
122
+ variant="plain"
123
+ @click="printPdf"
124
+ />
125
+ <v-btn
126
+ v-if="!props.disabled"
127
+ icon="mdi mdi-download"
128
+ variant="plain"
129
+ @click="downloadPdf"
130
+ />
131
+ <v-btn
132
+ icon="mdi mdi-close"
133
+ variant="plain"
134
+ @click="endLoadPdf"
135
+ />
136
+ </v-toolbar>
137
+ <v-card-text class="justify-center h-screen">
138
+ <PDF
139
+ v-bind="$attrs"
140
+ :pdf-width="setWidthPdf"
141
+ :src="base64"
142
+ :show-back-to-top-btn="props.showBackToTopBtn"
143
+ />
144
+ </v-card-text>
145
+ </v-card>
146
+ </template>
@@ -1 +1 @@
1
- export declare const useDialog: () => import("../types/dialogManager").DialogPlugin;
1
+ export declare const useDialog: () => any;
@@ -10,7 +10,7 @@ declare type VariableOptions = {
10
10
  [k: string]: any;
11
11
  };
12
12
  export declare function useGraphQl(): {
13
- query: <T>(operation: string, fields: Array<string | Object> | ClassConstructor<any>, variables?: VariableOptions, cache?: boolean) => import("#app").AsyncData<(T extends any[] ? T : T extends Record<string, any> ? keyof T extends (T extends T ? keyof T extends string ? string & keyof T : never : never) ? T : (T extends T ? keyof T extends string ? string & keyof T : never : never) extends never ? T : Pick<T, T extends T ? keyof T extends string ? string & keyof T : never : never> : T) | null, import("#app").NuxtError<unknown> | null>;
13
+ query: <T>(operation: string, fields: Array<string | Object> | ClassConstructor<any>, variables?: VariableOptions, cache?: boolean) => any;
14
14
  queryPromise: <T>(operation: string, fields: Array<string | Object> | ClassConstructor<any>, variables?: VariableOptions, cache?: boolean | number) => Promise<T>;
15
15
  mutation: <T>(operation: string, fields: Array<string | Object> | ClassConstructor<any>, variables?: VariableOptions) => UseMutationReturn<any, any>;
16
16
  mutationPromise: <T>(operation: string, fields: Array<string | Object> | ClassConstructor<any>, variables?: VariableOptions) => Promise<T>;
@@ -13,22 +13,22 @@ export declare function useGraphqlModel<T extends GraphqlModelProps>(props: T):
13
13
  search: import("vue").Ref<string | undefined, string | undefined>;
14
14
  setSearch: (keyword: string) => void;
15
15
  currentOptions: import("vue").Ref<any, any>;
16
- operationCreate: import("vue").ComputedRef<import("~/.nuxt/types/graphqlOperation").graphqlOperationObject<any, any>>;
17
- operationUpdate: import("vue").ComputedRef<import("~/.nuxt/types/graphqlOperation").graphqlOperationObject<any, any>>;
18
- operationDelete: import("vue").ComputedRef<import("~/.nuxt/types/graphqlOperation").graphqlOperationObject<any, any>>;
19
- operationRead: import("vue").ComputedRef<import("~/.nuxt/types/graphqlOperation").graphqlOperationObject<any, any>>;
20
- operationReadPageable: import("vue").ComputedRef<import("~/.nuxt/types/graphqlOperation").graphqlOperationObject<any, any>>;
21
- operationSearch: import("vue").ComputedRef<import("~/.nuxt/types/graphqlOperation").graphqlOperationObject<any, any>>;
16
+ operationCreate: import("vue").ComputedRef<import("~/.nuxt/types/graphqlOperation").graphqlOperationObject<any, any> | undefined>;
17
+ operationUpdate: import("vue").ComputedRef<import("~/.nuxt/types/graphqlOperation").graphqlOperationObject<any, any> | undefined>;
18
+ operationDelete: import("vue").ComputedRef<import("~/.nuxt/types/graphqlOperation").graphqlOperationObject<any, any> | undefined>;
19
+ operationRead: import("vue").ComputedRef<import("~/.nuxt/types/graphqlOperation").graphqlOperationObject<any, any> | undefined>;
20
+ operationReadPageable: import("vue").ComputedRef<import("~/.nuxt/types/graphqlOperation").graphqlOperationObject<any, any> | undefined>;
21
+ operationSearch: import("vue").ComputedRef<import("~/.nuxt/types/graphqlOperation").graphqlOperationObject<any, any> | undefined>;
22
22
  fields: import("vue").ComputedRef<(string | object)[]>;
23
23
  canServerPageable: import("vue").ComputedRef<boolean>;
24
24
  canServerSearch: import("vue").ComputedRef<boolean>;
25
25
  canCreate: import("vue").ComputedRef<boolean>;
26
26
  canUpdate: import("vue").ComputedRef<boolean>;
27
27
  canDelete: import("vue").ComputedRef<boolean>;
28
- createItem: (item: Record<string, any>, callback?: FormDialogCallback, importing?: boolean) => Promise<void>;
28
+ createItem: (item: Record<string, any>, callback?: FormDialogCallback, importing?: boolean) => Promise<void> | undefined;
29
29
  importItems: (importItems: Record<string, any>[], callback?: FormDialogCallback) => void;
30
- updateItem: (item: Record<string, any>, callback?: FormDialogCallback) => Promise<void>;
31
- deleteItem: (item: Record<string, any>, callback?: FormDialogCallback) => Promise<any>;
30
+ updateItem: (item: Record<string, any>, callback?: FormDialogCallback) => Promise<void> | undefined;
31
+ deleteItem: (item: Record<string, any>, callback?: FormDialogCallback) => Promise<any> | undefined;
32
32
  loadItems: (options: any) => void;
33
33
  reload: () => void;
34
34
  isLoading: import("vue").Ref<boolean, boolean>;
@@ -4,17 +4,17 @@ export type GraphqlModelItemProps = Omit<GraphqlModelConfigProps, 'operationSear
4
4
  export declare function useGraphqlModelItem<T extends GraphqlModelItemProps>(props: T): {
5
5
  modelBy: import("vue").Ref<object | undefined, object | undefined>;
6
6
  item: import("vue").Ref<Record<string, any> | undefined, Record<string, any> | undefined>;
7
- operationCreate: import("vue").ComputedRef<import("~/.nuxt/types/graphqlOperation").graphqlOperationObject<any, any>>;
8
- operationUpdate: import("vue").ComputedRef<import("~/.nuxt/types/graphqlOperation").graphqlOperationObject<any, any>>;
9
- operationDelete: import("vue").ComputedRef<import("~/.nuxt/types/graphqlOperation").graphqlOperationObject<any, any>>;
10
- operationRead: import("vue").ComputedRef<import("~/.nuxt/types/graphqlOperation").graphqlOperationObject<any, any>>;
7
+ operationCreate: import("vue").ComputedRef<import("~/.nuxt/types/graphqlOperation").graphqlOperationObject<any, any> | undefined>;
8
+ operationUpdate: import("vue").ComputedRef<import("~/.nuxt/types/graphqlOperation").graphqlOperationObject<any, any> | undefined>;
9
+ operationDelete: import("vue").ComputedRef<import("~/.nuxt/types/graphqlOperation").graphqlOperationObject<any, any> | undefined>;
10
+ operationRead: import("vue").ComputedRef<import("~/.nuxt/types/graphqlOperation").graphqlOperationObject<any, any> | undefined>;
11
11
  fields: import("vue").ComputedRef<(string | object)[]>;
12
12
  canCreate: import("vue").ComputedRef<boolean>;
13
13
  canUpdate: import("vue").ComputedRef<boolean>;
14
14
  canDelete: import("vue").ComputedRef<boolean>;
15
- createItem: (createItem: Record<string, any>, callback?: FormDialogCallback) => Promise<void>;
16
- updateItem: (updateItem: Record<string, any>, callback?: FormDialogCallback) => Promise<void>;
17
- deleteItem: (item: Record<string, any>, callback?: FormDialogCallback) => Promise<any>;
15
+ createItem: (createItem: Record<string, any>, callback?: FormDialogCallback) => Promise<void> | undefined;
16
+ updateItem: (updateItem: Record<string, any>, callback?: FormDialogCallback) => Promise<void> | undefined;
17
+ deleteItem: (item: Record<string, any>, callback?: FormDialogCallback) => Promise<any> | undefined;
18
18
  reload: () => void;
19
19
  isLoading: import("vue").Ref<boolean, boolean>;
20
20
  };