@ramathibodi/nuxt-commons 0.1.73 → 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 (111) hide show
  1. package/README.md +115 -96
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +1 -0
  4. package/dist/runtime/components/Alert.vue +58 -54
  5. package/dist/runtime/components/BarcodeReader.vue +130 -122
  6. package/dist/runtime/components/ExportCSV.vue +110 -102
  7. package/dist/runtime/components/FileBtn.vue +79 -67
  8. package/dist/runtime/components/ImportCSV.vue +151 -139
  9. package/dist/runtime/components/MrzReader.vue +168 -0
  10. package/dist/runtime/components/SplitterPanel.vue +67 -59
  11. package/dist/runtime/components/TabsGroup.vue +39 -31
  12. package/dist/runtime/components/TextBarcode.vue +66 -54
  13. package/dist/runtime/components/device/IdCardButton.vue +95 -83
  14. package/dist/runtime/components/device/IdCardWebSocket.vue +207 -195
  15. package/dist/runtime/components/device/Scanner.vue +350 -338
  16. package/dist/runtime/components/dialog/Confirm.vue +112 -100
  17. package/dist/runtime/components/dialog/Host.vue +88 -84
  18. package/dist/runtime/components/dialog/Index.vue +84 -72
  19. package/dist/runtime/components/dialog/Loading.vue +51 -39
  20. package/dist/runtime/components/dialog/default/Confirm.vue +112 -100
  21. package/dist/runtime/components/dialog/default/Loading.vue +60 -48
  22. package/dist/runtime/components/dialog/default/Notify.vue +82 -70
  23. package/dist/runtime/components/dialog/default/Printing.vue +46 -34
  24. package/dist/runtime/components/dialog/default/VerifyUser.vue +144 -132
  25. package/dist/runtime/components/document/Form.vue +50 -42
  26. package/dist/runtime/components/document/TemplateBuilder.vue +536 -524
  27. package/dist/runtime/components/form/ActionPad.vue +156 -144
  28. package/dist/runtime/components/form/Birthdate.vue +116 -104
  29. package/dist/runtime/components/form/CheckboxGroup.vue +99 -87
  30. package/dist/runtime/components/form/CodeEditor.vue +45 -37
  31. package/dist/runtime/components/form/Date.vue +270 -258
  32. package/dist/runtime/components/form/DateTime.vue +220 -208
  33. package/dist/runtime/components/form/Dialog.vue +178 -166
  34. package/dist/runtime/components/form/EditPad.vue +157 -145
  35. package/dist/runtime/components/form/File.vue +295 -283
  36. package/dist/runtime/components/form/Hidden.vue +44 -32
  37. package/dist/runtime/components/form/Iterator.vue +538 -526
  38. package/dist/runtime/components/form/Login.vue +143 -131
  39. package/dist/runtime/components/form/Pad.vue +399 -387
  40. package/dist/runtime/components/form/SignPad.vue +226 -218
  41. package/dist/runtime/components/form/System.vue +34 -26
  42. package/dist/runtime/components/form/Table.vue +391 -379
  43. package/dist/runtime/components/form/TableData.vue +236 -224
  44. package/dist/runtime/components/form/Time.vue +177 -165
  45. package/dist/runtime/components/form/images/Capture.vue +245 -237
  46. package/dist/runtime/components/form/images/Edit.vue +133 -121
  47. package/dist/runtime/components/form/images/Field.vue +331 -320
  48. package/dist/runtime/components/form/images/Pad.vue +54 -42
  49. package/dist/runtime/components/label/Date.vue +37 -29
  50. package/dist/runtime/components/label/DateAgo.vue +102 -94
  51. package/dist/runtime/components/label/DateCount.vue +152 -144
  52. package/dist/runtime/components/label/Field.vue +111 -103
  53. package/dist/runtime/components/label/FormatMoney.vue +37 -29
  54. package/dist/runtime/components/label/Mask.vue +46 -38
  55. package/dist/runtime/components/label/Object.vue +21 -13
  56. package/dist/runtime/components/master/Autocomplete.vue +89 -81
  57. package/dist/runtime/components/master/Combobox.vue +88 -80
  58. package/dist/runtime/components/master/RadioGroup.vue +90 -78
  59. package/dist/runtime/components/master/Select.vue +70 -62
  60. package/dist/runtime/components/master/label.vue +55 -47
  61. package/dist/runtime/components/model/Autocomplete.vue +91 -79
  62. package/dist/runtime/components/model/Combobox.vue +90 -78
  63. package/dist/runtime/components/model/Pad.vue +114 -102
  64. package/dist/runtime/components/model/Select.vue +78 -72
  65. package/dist/runtime/components/model/Table.vue +370 -358
  66. package/dist/runtime/components/model/iterator.vue +497 -489
  67. package/dist/runtime/components/model/label.vue +58 -50
  68. package/dist/runtime/components/pdf/Print.vue +75 -63
  69. package/dist/runtime/components/pdf/View.vue +146 -134
  70. package/dist/runtime/composables/alert.d.ts +4 -0
  71. package/dist/runtime/composables/api.d.ts +4 -0
  72. package/dist/runtime/composables/dialog.d.ts +1 -1
  73. package/dist/runtime/composables/document/templateFormHidden.d.ts +4 -0
  74. package/dist/runtime/composables/graphql.d.ts +1 -1
  75. package/dist/runtime/composables/graphqlModel.d.ts +9 -9
  76. package/dist/runtime/composables/graphqlModelItem.d.ts +7 -7
  77. package/dist/runtime/composables/graphqlModelOperation.d.ts +6 -6
  78. package/dist/runtime/composables/localStorageModel.d.ts +4 -0
  79. package/dist/runtime/composables/lookupList.d.ts +4 -0
  80. package/dist/runtime/composables/menu.d.ts +4 -0
  81. package/dist/runtime/composables/useMrzReader.d.ts +48 -0
  82. package/dist/runtime/composables/useMrzReader.js +423 -0
  83. package/dist/runtime/composables/useTesseract.d.ts +16 -0
  84. package/dist/runtime/composables/useTesseract.js +45 -0
  85. package/dist/runtime/composables/userPermission.d.ts +1 -1
  86. package/dist/runtime/labs/Calendar.vue +99 -99
  87. package/dist/runtime/labs/form/EditMobile.vue +152 -152
  88. package/dist/runtime/labs/form/TextFieldMask.vue +43 -43
  89. package/dist/runtime/plugins/clientConfig.d.ts +1 -1
  90. package/dist/runtime/plugins/default.d.ts +1 -1
  91. package/dist/runtime/plugins/dialogManager.d.ts +1 -1
  92. package/dist/runtime/plugins/permission.d.ts +1 -1
  93. package/dist/runtime/types/alert.d.ts +11 -11
  94. package/dist/runtime/types/clientConfig.d.ts +13 -13
  95. package/dist/runtime/types/dialogManager.d.ts +35 -35
  96. package/dist/runtime/types/formDialog.d.ts +5 -5
  97. package/dist/runtime/types/graphqlOperation.d.ts +23 -23
  98. package/dist/runtime/types/menu.d.ts +31 -31
  99. package/dist/runtime/types/modules.d.ts +7 -7
  100. package/dist/runtime/types/permission.d.ts +13 -13
  101. package/dist/runtime/utils/asset.d.ts +2 -0
  102. package/dist/runtime/utils/asset.js +49 -0
  103. package/package.json +131 -122
  104. package/scripts/enrich-vue-docs-from-ai.mjs +197 -0
  105. package/scripts/generate-ai-summary.mjs +321 -0
  106. package/scripts/generate-composables-md.mjs +129 -0
  107. package/scripts/postInstall.cjs +70 -70
  108. package/templates/.codegen/codegen.ts +32 -32
  109. package/templates/.codegen/plugin-schema-object.js +161 -161
  110. package/templates/public/tesseract/mrz.traineddata.gz +0 -0
  111. package/templates/public/tesseract/ocrb.traineddata.gz +0 -0
@@ -1,218 +1,226 @@
1
- <script lang="ts" setup>
2
- import { VueSignaturePad } from 'vue-signature-pad'
3
- import { VInput } from 'vuetify/components/VInput'
4
- import { ref, computed, withDefaults, defineProps, defineExpose, watch } from 'vue'
5
- import { useAssetFile, type Base64Asset, type Base64File } from '../../composables/assetFile'
6
-
7
- interface SignatureProps extends /* @vue-ignore */ InstanceType<typeof VInput['$props']> {
8
- title?: string
9
- btnName?: string
10
- titleConfirm?: string
11
- penColor?: string
12
- /** hydrate when id is present but base64String is missing */
13
- autoHydrate?: boolean
14
- }
15
-
16
- const props = withDefaults(defineProps<SignatureProps>(), {
17
- title: 'Signature',
18
- btnName: 'Draw Your Signature',
19
- titleConfirm: 'I Accept My Signature',
20
- penColor: '#303F9F',
21
- autoHydrate: true,
22
- })
23
-
24
- const { hydrateAssetFile } = useAssetFile()
25
-
26
- const model = defineModel<Base64Asset | string | null>({ default: null })
27
-
28
- // refs
29
- const inputRef = ref<InstanceType<typeof VInput> | null>(null)
30
- const signaturePadRef = ref<InstanceType<typeof VueSignaturePad> | null>(null)
31
-
32
- const isDialogOpen = ref(false)
33
-
34
- // signature pad options from props
35
- const signatureOptions = computed(() => ({
36
- penColor: props.penColor,
37
- minWidth: 0.5,
38
- maxWidth: 4,
39
- }))
40
-
41
- // internal normalized value
42
- const normalized = ref<Base64Asset | null>(null)
43
- const imageDataUrl = computed(() => {
44
- const val = normalized.value
45
- if (!val?.base64String) return null
46
-
47
- return useAssetFile().ensureDataUrl(val.base64String.trim(),(val as Base64File).fileType || "image/png")
48
- })
49
-
50
-
51
- // guards
52
- let syncing = false // block re-entrancy while normalizing/hydrating
53
-
54
- function wrapToAsset(input: Base64Asset | string | null): Base64Asset | null {
55
- if (input == null) return null
56
- return typeof input === 'string' ? { base64String: input } : input
57
- }
58
-
59
- /** Normalize & (optionally) hydrate whenever external model changes */
60
- watch(
61
- model,
62
- async (val) => {
63
- if (syncing) return
64
- syncing = true
65
- try {
66
- const asAsset = wrapToAsset(val)
67
- normalized.value = asAsset
68
-
69
- // If parent provided a string, convert and write back once
70
- if (typeof val === 'string') {
71
- model.value = asAsset
72
- }
73
-
74
- // Hydrate if requested and needed (id present, no base64String)
75
- if (props.autoHydrate && asAsset?.id != null && !asAsset.base64String) {
76
- await hydrateAssetFile(asAsset) // mutates asAsset in-place
77
- // reflect hydrated base64String back to parent (guarded)
78
- model.value = asAsset
79
- }
80
- } finally {
81
- syncing = false
82
- }
83
- },
84
- { immediate: true }
85
- )
86
-
87
- // signature actions
88
- const undoSignature = () => signaturePadRef.value?.undoSignature()
89
- const clearSignature = () => signaturePadRef.value?.clearSignature()
90
-
91
- const closeDialog = () => {
92
- isDialogOpen.value = false
93
- signaturePadRef.value?.clearSignature()
94
- signaturePadRef.value?.clearCacheImages?.()
95
- }
96
-
97
- const saveSignature = () => {
98
- isDialogOpen.value = false
99
- const result = signaturePadRef.value?.saveSignature()
100
- if (!result) return
101
- const { isEmpty, data } = result
102
- if (isEmpty) {
103
- normalized.value = null
104
- model.value = null
105
- } else {
106
- const asset: Base64Asset = { base64String: data }
107
- normalized.value = asset
108
- model.value = asset
109
- }
110
- }
111
-
112
- const openSignatureDialog = async () => {
113
- // ensure hydration before opening to preview correctly
114
- if (props.autoHydrate && normalized.value?.id != null && !normalized.value.base64String) {
115
- await hydrateAssetFile(normalized.value)
116
- model.value = normalized.value
117
- }
118
-
119
- isDialogOpen.value = true
120
-
121
- const existing = normalized.value?.base64String
122
- if (existing) {
123
- // seed after dialog mount
124
- requestAnimationFrame(() => signaturePadRef.value?.fromDataURL(existing))
125
- }
126
- }
127
-
128
- // validation passthrough
129
- const isValid = computed(() => inputRef.value?.isValid)
130
- const errorMessages = computed(() => inputRef.value?.errorMessages)
131
-
132
- defineExpose({
133
- errorMessages,
134
- isValid,
135
- reset: () => inputRef.value?.reset(),
136
- resetValidation: () => inputRef.value?.resetValidation(),
137
- validate: () => inputRef.value?.validate(),
138
- })
139
- </script>
140
-
141
- <template>
142
- <v-input v-model="model" v-bind="$attrs" ref="inputRef">
143
- <template #default="{ isReadonly, isDisabled }">
144
- <v-card class="w-100" flat :variant="$attrs.variant" :title="props.title">
145
- <v-card-text v-if="normalized?.base64String">
146
- <v-img :src="imageDataUrl" cover />
147
- <v-icon
148
- class="position-absolute"
149
- style="top: 8px; right: 8px; z-index: 10;"
150
- @click="model = null; normalized = null"
151
- v-if="!isReadonly?.value"
152
- >
153
- mdi mdi-close-circle
154
- </v-icon>
155
- </v-card-text>
156
-
157
- <v-card-actions v-if="!isReadonly?.value">
158
- <v-btn
159
- append-icon="mdi mdi-draw-pen"
160
- block
161
- class="text-none"
162
- color="primary"
163
- variant="flat"
164
- @click="openSignatureDialog"
165
- :readonly="isReadonly?.value"
166
- :disabled="isDisabled?.value"
167
- >
168
- {{ props.btnName }}
169
- </v-btn>
170
- </v-card-actions>
171
-
172
- <v-dialog v-model="isDialogOpen" height="auto" persistent width="100%">
173
- <v-card>
174
- <v-toolbar>
175
- <v-toolbar-title class="text-no-wrap">
176
- {{ props.title }}
177
- </v-toolbar-title>
178
-
179
- <v-btn icon @click="undoSignature">
180
- <v-icon>fa-solid fa-arrow-rotate-left</v-icon>
181
- </v-btn>
182
-
183
- <v-btn icon @click="clearSignature">
184
- <v-icon>fa-solid fa-trash</v-icon>
185
- </v-btn>
186
-
187
- <v-btn icon @click="closeDialog">
188
- <v-icon>fa-solid fa-xmark</v-icon>
189
- </v-btn>
190
- </v-toolbar>
191
-
192
- <v-card-text>
193
- <VueSignaturePad
194
- ref="signaturePadRef"
195
- :options="signatureOptions"
196
- height="40vh"
197
- />
198
- </v-card-text>
199
-
200
- <v-divider />
201
-
202
- <v-card-actions class="justify-center">
203
- <v-btn
204
- class="text-none"
205
- color="success"
206
- prepend-icon="fa-solid fa-check"
207
- variant="flat"
208
- @click="saveSignature"
209
- >
210
- {{ props.titleConfirm }}
211
- </v-btn>
212
- </v-card-actions>
213
- </v-card>
214
- </v-dialog>
215
- </v-card>
216
- </template>
217
- </v-input>
218
- </template>
1
+ <script lang="ts" setup>
2
+ /**
3
+ * FormSignPad is a schema-driven form field component that binds model data, renders field UI, and emits normalized updates.
4
+ * This doc block is consumed by vue-docgen for generated API documentation.
5
+ */
6
+ import { VueSignaturePad } from 'vue-signature-pad'
7
+ import { VInput } from 'vuetify/components/VInput'
8
+ import { ref, computed, withDefaults, defineProps, defineExpose, watch } from 'vue'
9
+ import { useAssetFile, type Base64Asset, type Base64File } from '../../composables/assetFile'
10
+
11
+ interface SignatureProps extends /* @vue-ignore */ InstanceType<typeof VInput['$props']> {
12
+ title?: string // Title text displayed in the component header or dialog.
13
+ btnName?: string // Button label used to open the signature pad dialog.
14
+ titleConfirm?: string // Confirmation text shown before accepting the signature.
15
+ penColor?: string // Pen stroke color used while drawing the signature.
16
+ /** hydrate when id is present but base64String is missing */
17
+ autoHydrate?: boolean // Converts incoming serialized values into component runtime format on mount/watch.
18
+ }
19
+
20
+ /**
21
+ * Public props accepted by FormSignPad.
22
+ * Document each prop field with intent, defaults, and side effects for clear generated docs.
23
+ */
24
+ const props = withDefaults(defineProps<SignatureProps>(), {
25
+ title: 'Signature',
26
+ btnName: 'Draw Your Signature',
27
+ titleConfirm: 'I Accept My Signature',
28
+ penColor: '#303F9F',
29
+ autoHydrate: true,
30
+ })
31
+
32
+ const { hydrateAssetFile } = useAssetFile()
33
+
34
+ const model = defineModel<Base64Asset | string | null>({ default: null })
35
+
36
+ // refs
37
+ const inputRef = ref<InstanceType<typeof VInput> | null>(null)
38
+ const signaturePadRef = ref<InstanceType<typeof VueSignaturePad> | null>(null)
39
+
40
+ const isDialogOpen = ref(false)
41
+
42
+ // signature pad options from props
43
+ const signatureOptions = computed(() => ({
44
+ penColor: props.penColor,
45
+ minWidth: 0.5,
46
+ maxWidth: 4,
47
+ }))
48
+
49
+ // internal normalized value
50
+ const normalized = ref<Base64Asset | null>(null)
51
+ const imageDataUrl = computed(() => {
52
+ const val = normalized.value
53
+ if (!val?.base64String) return null
54
+
55
+ return useAssetFile().ensureDataUrl(val.base64String.trim(),(val as Base64File).fileType || "image/png")
56
+ })
57
+
58
+
59
+ // guards
60
+ let syncing = false // block re-entrancy while normalizing/hydrating
61
+
62
+ function wrapToAsset(input: Base64Asset | string | null): Base64Asset | null {
63
+ if (input == null) return null
64
+ return typeof input === 'string' ? { base64String: input } : input
65
+ }
66
+
67
+ /** Normalize & (optionally) hydrate whenever external model changes */
68
+ watch(
69
+ model,
70
+ async (val) => {
71
+ if (syncing) return
72
+ syncing = true
73
+ try {
74
+ const asAsset = wrapToAsset(val)
75
+ normalized.value = asAsset
76
+
77
+ // If parent provided a string, convert and write back once
78
+ if (typeof val === 'string') {
79
+ model.value = asAsset
80
+ }
81
+
82
+ // Hydrate if requested and needed (id present, no base64String)
83
+ if (props.autoHydrate && asAsset?.id != null && !asAsset.base64String) {
84
+ await hydrateAssetFile(asAsset) // mutates asAsset in-place
85
+ // reflect hydrated base64String back to parent (guarded)
86
+ model.value = asAsset
87
+ }
88
+ } finally {
89
+ syncing = false
90
+ }
91
+ },
92
+ { immediate: true }
93
+ )
94
+
95
+ // signature actions
96
+ const undoSignature = () => signaturePadRef.value?.undoSignature()
97
+ const clearSignature = () => signaturePadRef.value?.clearSignature()
98
+
99
+ const closeDialog = () => {
100
+ isDialogOpen.value = false
101
+ signaturePadRef.value?.clearSignature()
102
+ signaturePadRef.value?.clearCacheImages?.()
103
+ }
104
+
105
+ const saveSignature = () => {
106
+ isDialogOpen.value = false
107
+ const result = signaturePadRef.value?.saveSignature()
108
+ if (!result) return
109
+ const { isEmpty, data } = result
110
+ if (isEmpty) {
111
+ normalized.value = null
112
+ model.value = null
113
+ } else {
114
+ const asset: Base64Asset = { base64String: data }
115
+ normalized.value = asset
116
+ model.value = asset
117
+ }
118
+ }
119
+
120
+ const openSignatureDialog = async () => {
121
+ // ensure hydration before opening to preview correctly
122
+ if (props.autoHydrate && normalized.value?.id != null && !normalized.value.base64String) {
123
+ await hydrateAssetFile(normalized.value)
124
+ model.value = normalized.value
125
+ }
126
+
127
+ isDialogOpen.value = true
128
+
129
+ const existing = normalized.value?.base64String
130
+ if (existing) {
131
+ // seed after dialog mount
132
+ requestAnimationFrame(() => signaturePadRef.value?.fromDataURL(existing))
133
+ }
134
+ }
135
+
136
+ // validation passthrough
137
+ const isValid = computed(() => inputRef.value?.isValid)
138
+ const errorMessages = computed(() => inputRef.value?.errorMessages)
139
+
140
+ defineExpose({
141
+ errorMessages,
142
+ isValid,
143
+ reset: () => inputRef.value?.reset(),
144
+ resetValidation: () => inputRef.value?.resetValidation(),
145
+ validate: () => inputRef.value?.validate(),
146
+ })
147
+ </script>
148
+
149
+ <template>
150
+ <v-input v-model="model" v-bind="$attrs" ref="inputRef">
151
+ <template #default="{ isReadonly, isDisabled }">
152
+ <v-card class="w-100" flat :variant="$attrs.variant" :title="props.title">
153
+ <v-card-text v-if="normalized?.base64String">
154
+ <v-img :src="imageDataUrl" cover />
155
+ <v-icon
156
+ class="position-absolute"
157
+ style="top: 8px; right: 8px; z-index: 10;"
158
+ @click="model = null; normalized = null"
159
+ v-if="!isReadonly?.value"
160
+ >
161
+ mdi mdi-close-circle
162
+ </v-icon>
163
+ </v-card-text>
164
+
165
+ <v-card-actions v-if="!isReadonly?.value">
166
+ <v-btn
167
+ append-icon="mdi mdi-draw-pen"
168
+ block
169
+ class="text-none"
170
+ color="primary"
171
+ variant="flat"
172
+ @click="openSignatureDialog"
173
+ :readonly="isReadonly?.value"
174
+ :disabled="isDisabled?.value"
175
+ >
176
+ {{ props.btnName }}
177
+ </v-btn>
178
+ </v-card-actions>
179
+
180
+ <v-dialog v-model="isDialogOpen" height="auto" persistent width="100%">
181
+ <v-card>
182
+ <v-toolbar>
183
+ <v-toolbar-title class="text-no-wrap">
184
+ {{ props.title }}
185
+ </v-toolbar-title>
186
+
187
+ <v-btn icon @click="undoSignature">
188
+ <v-icon>fa-solid fa-arrow-rotate-left</v-icon>
189
+ </v-btn>
190
+
191
+ <v-btn icon @click="clearSignature">
192
+ <v-icon>fa-solid fa-trash</v-icon>
193
+ </v-btn>
194
+
195
+ <v-btn icon @click="closeDialog">
196
+ <v-icon>fa-solid fa-xmark</v-icon>
197
+ </v-btn>
198
+ </v-toolbar>
199
+
200
+ <v-card-text>
201
+ <VueSignaturePad
202
+ ref="signaturePadRef"
203
+ :options="signatureOptions"
204
+ height="40vh"
205
+ />
206
+ </v-card-text>
207
+
208
+ <v-divider />
209
+
210
+ <v-card-actions class="justify-center">
211
+ <v-btn
212
+ class="text-none"
213
+ color="success"
214
+ prepend-icon="fa-solid fa-check"
215
+ variant="flat"
216
+ @click="saveSignature"
217
+ >
218
+ {{ props.titleConfirm }}
219
+ </v-btn>
220
+ </v-card-actions>
221
+ </v-card>
222
+ </v-dialog>
223
+ </v-card>
224
+ </template>
225
+ </v-input>
226
+ </template>
@@ -1,27 +1,35 @@
1
- <script lang="ts" setup>
2
- import Pad from './Pad.vue'
3
- import { watch } from 'vue'
4
- import { useGraphQlOperation } from '../../composables/graphqlOperation'
5
-
6
- interface Props extends /* @vue-ignore */ InstanceType<typeof Pad['$props']> {
7
- templateId: string;
8
- cache?: boolean | number
9
- }
10
-
11
- const props = withDefaults(defineProps<Props>(),{
12
- cache: false
13
- })
14
-
15
- const currentTemplate = ref<any>({})
16
-
17
- watch(()=>props.templateId, (newValue) => {
18
- useGraphQlOperation("Query","systemTemplateById",["template","templateScript"],{id: newValue},props.cache).then(result => {
19
- currentTemplate.value = result
20
- }).catch(_error => {
21
- currentTemplate.value = {}
22
- })
23
- })
24
- </script>
25
- <template>
26
- <FormPad v-bind="$attrs" :template="currentTemplate.template" :template-script="currentTemplate.templateScript" />
1
+ <script lang="ts" setup>
2
+ /**
3
+ * FormSystem is a schema-driven form field component that binds model data, renders field UI, and emits normalized updates.
4
+ * This doc block is consumed by vue-docgen for generated API documentation.
5
+ */
6
+ import Pad from './Pad.vue'
7
+ import { watch } from 'vue'
8
+ import { useGraphQlOperation } from '../../composables/graphqlOperation'
9
+
10
+ interface Props extends /* @vue-ignore */ InstanceType<typeof Pad['$props']> {
11
+ templateId: string; // identifier value used to resolve business data
12
+ cache?: boolean | number // Enables cached requests; number values represent cache TTL in milliseconds.
13
+ }
14
+
15
+ /**
16
+ * Public props accepted by FormSystem.
17
+ * Document each prop field with intent, defaults, and side effects for clear generated docs.
18
+ */
19
+ const props = withDefaults(defineProps<Props>(),{
20
+ cache: false
21
+ })
22
+
23
+ const currentTemplate = ref<any>({})
24
+
25
+ watch(()=>props.templateId, (newValue) => {
26
+ useGraphQlOperation("Query","systemTemplateById",["template","templateScript"],{id: newValue},props.cache).then(result => {
27
+ currentTemplate.value = result
28
+ }).catch(_error => {
29
+ currentTemplate.value = {}
30
+ })
31
+ })
32
+ </script>
33
+ <template>
34
+ <FormPad v-bind="$attrs" :template="currentTemplate.template" :template-script="currentTemplate.templateScript" />
27
35
  </template>