@ramathibodi/nuxt-commons 4.0.12 → 4.0.13

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 (27) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/components/dialog/ImportProgress.d.vue.ts +35 -0
  3. package/dist/runtime/components/dialog/ImportProgress.vue +53 -0
  4. package/dist/runtime/components/dialog/ImportProgress.vue.d.ts +35 -0
  5. package/dist/runtime/components/document/TemplateBuilder.vue +112 -7
  6. package/dist/runtime/components/model/Pad.vue +2 -1
  7. package/dist/runtime/components/model/Table.d.vue.ts +79 -12
  8. package/dist/runtime/components/model/Table.vue +106 -3
  9. package/dist/runtime/components/model/Table.vue.d.ts +79 -12
  10. package/dist/runtime/components/model/iterator.d.vue.ts +117 -29
  11. package/dist/runtime/components/model/iterator.vue +117 -5
  12. package/dist/runtime/components/model/iterator.vue.d.ts +117 -29
  13. package/dist/runtime/composables/apiModel.d.ts +20 -1
  14. package/dist/runtime/composables/apiModel.js +24 -16
  15. package/dist/runtime/composables/document/template.d.ts +61 -0
  16. package/dist/runtime/composables/document/template.js +59 -0
  17. package/dist/runtime/composables/document/validateTemplate.d.ts +62 -0
  18. package/dist/runtime/composables/document/validateTemplate.js +378 -0
  19. package/dist/runtime/composables/graphqlModel.d.ts +20 -1
  20. package/dist/runtime/composables/graphqlModel.js +24 -16
  21. package/dist/runtime/composables/graphqlModelOperation.d.ts +1 -0
  22. package/dist/runtime/composables/importProgress.d.ts +34 -0
  23. package/dist/runtime/composables/importProgress.js +50 -0
  24. package/dist/runtime/utils/virtualize.d.ts +15 -0
  25. package/dist/runtime/utils/virtualize.js +10 -0
  26. package/package.json +2 -1
  27. package/scripts/validate-document-template.mjs +158 -0
@@ -32,6 +32,12 @@ interface Props extends /* @vue-ignore */ InstanceType<typeof VDataIterator['$pr
32
32
  autoRefresh?: number | boolean;
33
33
  autoRefreshDefault?: number;
34
34
  autoRefreshControl?: boolean;
35
+ importConcurrency?: number;
36
+ virtual?: boolean;
37
+ virtualThreshold?: number;
38
+ virtualHeight?: number | string;
39
+ virtualItemHeight?: number;
40
+ virtualItemsPerRow?: number;
35
41
  }
36
42
  /**
37
43
  * Public props accepted by ModelIterator.
@@ -43,7 +49,7 @@ declare var __VLS_15: {
43
49
  operation: {
44
50
  openDialog: typeof openDialog;
45
51
  createItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean) => Promise<any>);
46
- importItems: ((importItems: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void) | ((importItemsList: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void);
52
+ importItems: ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void) | ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void);
47
53
  updateItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<any>);
48
54
  deleteItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<any>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<any>);
49
55
  reload: (() => Promise<void> | undefined) | (() => Promise<void>);
@@ -80,7 +86,7 @@ declare var __VLS_15: {
80
86
  operation: {
81
87
  openDialog: typeof openDialog;
82
88
  createItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean) => Promise<any>);
83
- importItems: ((importItems: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void) | ((importItemsList: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void);
89
+ importItems: ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void) | ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void);
84
90
  updateItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<any>);
85
91
  deleteItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<any>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<any>);
86
92
  reload: (() => Promise<void> | undefined) | (() => Promise<void>);
@@ -92,15 +98,32 @@ declare var __VLS_15: {
92
98
  canDelete: boolean;
93
99
  autoRefresh: import("vue").Raw<import("../../composables/autoRefresh.js").UseAutoRefreshHandle>;
94
100
  };
95
- }, __VLS_38: {
101
+ }, __VLS_62: {
102
+ item: any;
103
+ operation: {
104
+ openDialog: typeof openDialog;
105
+ createItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean) => Promise<any>);
106
+ importItems: ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void) | ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void);
107
+ updateItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<any>);
108
+ deleteItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<any>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<any>);
109
+ reload: (() => Promise<void> | undefined) | (() => Promise<void>);
110
+ setSearch: ((keyword: string) => void) | ((keyword: string) => void);
111
+ canServerPageable: boolean;
112
+ canServerSearch: boolean;
113
+ canCreate: boolean;
114
+ canUpdate: boolean;
115
+ canDelete: boolean;
116
+ autoRefresh: import("vue").Raw<import("../../composables/autoRefresh.js").UseAutoRefreshHandle>;
117
+ };
118
+ }, __VLS_65: {
96
119
  color: string | undefined;
97
120
  isActive: boolean;
98
- }, __VLS_58: {}, __VLS_66: {
121
+ }, __VLS_85: {}, __VLS_93: {
99
122
  items: Record<string, any>[];
100
123
  operation: {
101
124
  openDialog: typeof openDialog;
102
125
  createItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean) => Promise<any>);
103
- importItems: ((importItems: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void) | ((importItemsList: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void);
126
+ importItems: ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void) | ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void);
104
127
  updateItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<any>);
105
128
  deleteItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<any>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<any>);
106
129
  reload: (() => Promise<void> | undefined) | (() => Promise<void>);
@@ -131,9 +154,9 @@ declare var __VLS_15: {
131
154
  toggleGroup: ReturnType<typeof import("vuetify/lib/components/VDataTable/composables/group.mjs").provideGroupBy>["toggleGroup"];
132
155
  itemsCount: number;
133
156
  groupedItems: readonly (import("vuetify/lib/components/VDataIterator/composables/items.mjs").DataIteratorItem<Record<string, any>> | import("vuetify/lib/components/VDataTable/composables/group.mjs").Group<import("vuetify/lib/components/VDataIterator/composables/items.mjs").DataIteratorItem<Record<string, any>>> | import("vuetify/lib/components/VDataTable/composables/group.mjs").GroupSummary<import("vuetify/lib/components/VDataIterator/composables/items.mjs").DataIteratorItem<Record<string, any>>>)[];
134
- }, __VLS_92: {
157
+ }, __VLS_119: {
135
158
  reload: () => void;
136
- }, __VLS_102: {
159
+ }, __VLS_129: {
137
160
  enabled: import("vue").ComputedRef<boolean>;
138
161
  isActive: import("vue").ComputedRef<boolean>;
139
162
  isLoading: import("vue").ComputedRef<boolean>;
@@ -143,12 +166,12 @@ declare var __VLS_15: {
143
166
  togglePause: () => void;
144
167
  reset: () => void;
145
168
  reload: () => void | Promise<void>;
146
- }, __VLS_115: {
169
+ }, __VLS_142: {
147
170
  items: Record<string, any>[];
148
171
  operation: {
149
172
  openDialog: typeof openDialog;
150
173
  createItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean) => Promise<any>);
151
- importItems: ((importItems: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void) | ((importItemsList: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void);
174
+ importItems: ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void) | ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void);
152
175
  updateItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<any>);
153
176
  deleteItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<any>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<any>);
154
177
  reload: (() => Promise<void> | undefined) | (() => Promise<void>);
@@ -160,12 +183,12 @@ declare var __VLS_15: {
160
183
  canDelete: boolean;
161
184
  autoRefresh: import("vue").Raw<import("../../composables/autoRefresh.js").UseAutoRefreshHandle>;
162
185
  };
163
- }, __VLS_128: {
186
+ }, __VLS_155: {
164
187
  items: Record<string, any>[];
165
188
  operation: {
166
189
  openDialog: typeof openDialog;
167
190
  createItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean) => Promise<any>);
168
- importItems: ((importItems: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void) | ((importItemsList: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void);
191
+ importItems: ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void) | ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void);
169
192
  updateItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<any>);
170
193
  deleteItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<any>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<any>);
171
194
  reload: (() => Promise<void> | undefined) | (() => Promise<void>);
@@ -177,11 +200,11 @@ declare var __VLS_15: {
177
200
  canDelete: boolean;
178
201
  autoRefresh: import("vue").Raw<import("../../composables/autoRefresh.js").UseAutoRefreshHandle>;
179
202
  };
180
- }, __VLS_182: never, __VLS_183: {
203
+ }, __VLS_209: never, __VLS_210: {
181
204
  operation: {
182
205
  openDialog: typeof openDialog;
183
206
  createItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean) => Promise<any>);
184
- importItems: ((importItems: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void) | ((importItemsList: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void);
207
+ importItems: ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void) | ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void);
185
208
  updateItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<any>);
186
209
  deleteItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<any>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<any>);
187
210
  reload: (() => Promise<void> | undefined) | (() => Promise<void>);
@@ -193,11 +216,11 @@ declare var __VLS_15: {
193
216
  canDelete: boolean;
194
217
  autoRefresh: import("vue").Raw<import("../../composables/autoRefresh.js").UseAutoRefreshHandle>;
195
218
  };
196
- }, __VLS_208: never, __VLS_209: {
219
+ }, __VLS_235: never, __VLS_236: {
197
220
  operation: {
198
221
  openDialog: typeof openDialog;
199
222
  createItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean) => Promise<any>);
200
- importItems: ((importItems: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void) | ((importItemsList: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void);
223
+ importItems: ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void) | ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void);
201
224
  updateItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<any>);
202
225
  deleteItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<any>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<any>);
203
226
  reload: (() => Promise<void> | undefined) | (() => Promise<void>);
@@ -209,31 +232,60 @@ declare var __VLS_15: {
209
232
  canDelete: boolean;
210
233
  autoRefresh: import("vue").Raw<import("../../composables/autoRefresh.js").UseAutoRefreshHandle>;
211
234
  };
212
- }, __VLS_277: any;
235
+ }, __VLS_261: never, __VLS_262: {
236
+ operation: {
237
+ openDialog: typeof openDialog;
238
+ createItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean) => Promise<any>);
239
+ importItems: ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void) | ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void);
240
+ updateItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<any>);
241
+ deleteItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<any>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<any>);
242
+ reload: (() => Promise<void> | undefined) | (() => Promise<void>);
243
+ setSearch: ((keyword: string) => void) | ((keyword: string) => void);
244
+ canServerPageable: boolean;
245
+ canServerSearch: boolean;
246
+ canCreate: boolean;
247
+ canUpdate: boolean;
248
+ canDelete: boolean;
249
+ autoRefresh: import("vue").Raw<import("../../composables/autoRefresh.js").UseAutoRefreshHandle>;
250
+ };
251
+ }, __VLS_330: any, __VLS_332: {
252
+ isImporting: boolean;
253
+ total: number;
254
+ processed: number;
255
+ succeeded: number;
256
+ failed: number;
257
+ percent: number;
258
+ };
213
259
  type __VLS_Slots = {} & {
214
- [K in NonNullable<typeof __VLS_182>]?: (props: typeof __VLS_183) => any;
260
+ [K in NonNullable<typeof __VLS_209>]?: (props: typeof __VLS_210) => any;
215
261
  } & {
216
- [K in NonNullable<typeof __VLS_208>]?: (props: typeof __VLS_209) => any;
262
+ [K in NonNullable<typeof __VLS_235>]?: (props: typeof __VLS_236) => any;
263
+ } & {
264
+ [K in NonNullable<typeof __VLS_261>]?: (props: typeof __VLS_262) => any;
217
265
  } & {
218
266
  default?: (props: typeof __VLS_15) => any;
219
267
  } & {
220
268
  item?: (props: typeof __VLS_35) => any;
221
269
  } & {
222
- loader?: (props: typeof __VLS_38) => any;
270
+ item?: (props: typeof __VLS_62) => any;
271
+ } & {
272
+ loader?: (props: typeof __VLS_65) => any;
223
273
  } & {
224
- loaderItem?: (props: typeof __VLS_58) => any;
274
+ loaderItem?: (props: typeof __VLS_85) => any;
225
275
  } & {
226
- header?: (props: typeof __VLS_66) => any;
276
+ header?: (props: typeof __VLS_93) => any;
227
277
  } & {
228
- title?: (props: typeof __VLS_92) => any;
278
+ title?: (props: typeof __VLS_119) => any;
229
279
  } & {
230
- autoRefreshControl?: (props: typeof __VLS_102) => any;
280
+ autoRefreshControl?: (props: typeof __VLS_129) => any;
231
281
  } & {
232
- search?: (props: typeof __VLS_115) => any;
282
+ search?: (props: typeof __VLS_142) => any;
233
283
  } & {
234
- toolbarItems?: (props: typeof __VLS_128) => any;
284
+ toolbarItems?: (props: typeof __VLS_155) => any;
235
285
  } & {
236
- form?: (props: typeof __VLS_277) => any;
286
+ form?: (props: typeof __VLS_330) => any;
287
+ } & {
288
+ importProgress?: (props: typeof __VLS_332) => any;
237
289
  };
238
290
  declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<__VLS_Props>, {
239
291
  noDataText: string;
@@ -260,12 +312,18 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
260
312
  autoRefresh: boolean;
261
313
  autoRefreshDefault: number;
262
314
  autoRefreshControl: boolean;
315
+ importConcurrency: number;
316
+ virtual: undefined;
317
+ virtualThreshold: number;
318
+ virtualHeight: string;
319
+ virtualItemHeight: number;
320
+ virtualItemsPerRow: undefined;
263
321
  }>>, {
264
322
  reload: (() => Promise<void> | undefined) | (() => Promise<void>);
265
323
  operation: import("vue").Ref<{
266
324
  openDialog: typeof openDialog;
267
325
  createItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean) => Promise<any>);
268
- importItems: ((importItems: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void) | ((importItemsList: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void);
326
+ importItems: ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void) | ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void);
269
327
  updateItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<any>);
270
328
  deleteItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<any>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<any>);
271
329
  reload: (() => Promise<void> | undefined) | (() => Promise<void>);
@@ -279,7 +337,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
279
337
  }, {
280
338
  openDialog: typeof openDialog;
281
339
  createItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean) => Promise<any>);
282
- importItems: ((importItems: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void) | ((importItemsList: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void);
340
+ importItems: ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void) | ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void);
283
341
  updateItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<any>);
284
342
  deleteItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<any>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<any>);
285
343
  reload: (() => Promise<void> | undefined) | (() => Promise<void>);
@@ -293,7 +351,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
293
351
  } | {
294
352
  openDialog: typeof openDialog;
295
353
  createItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean) => Promise<any>);
296
- importItems: ((importItems: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void) | ((importItemsList: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void);
354
+ importItems: ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void) | ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void);
297
355
  updateItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<any>);
298
356
  deleteItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<any>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback) => Promise<any>);
299
357
  reload: (() => Promise<void> | undefined) | (() => Promise<void>);
@@ -306,6 +364,30 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
306
364
  autoRefresh: import("vue").Raw<import("../../composables/autoRefresh.js").UseAutoRefreshHandle>;
307
365
  }>;
308
366
  autoRefresh: import("../../composables/autoRefresh.js").UseAutoRefreshHandle;
367
+ importProgress: {
368
+ isImporting: import("vue").Ref<boolean, boolean>;
369
+ total: import("vue").Ref<number, number>;
370
+ processed: import("vue").Ref<number, number>;
371
+ succeeded: import("vue").Ref<number, number>;
372
+ failed: import("vue").Ref<number, number>;
373
+ errors: import("vue").Ref<{
374
+ index: number;
375
+ message: string;
376
+ }[], import("../../composables/importProgress.js").ImportError[] | {
377
+ index: number;
378
+ message: string;
379
+ }[]>;
380
+ percent: import("vue").ComputedRef<number>;
381
+ reset: () => void;
382
+ run: <T = any>(items: T[], worker: import("../../composables/importProgress.js").ImportWorker<T>, options?: {
383
+ concurrency
384
+ /**
385
+ * ModelIterator connects model metadata to reusable selection, labeling, iterator, or table UI patterns.
386
+ * This doc block is consumed by vue-docgen for generated API documentation.
387
+ */
388
+ ?: number;
389
+ }) => Promise<import("../../composables/importProgress.js").ImportSummary>;
390
+ };
309
391
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<__VLS_Props>, {
310
392
  noDataText: string;
311
393
  dialogFullscreen: boolean;
@@ -331,6 +413,12 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
331
413
  autoRefresh: boolean;
332
414
  autoRefreshDefault: number;
333
415
  autoRefreshControl: boolean;
416
+ importConcurrency: number;
417
+ virtual: undefined;
418
+ virtualThreshold: number;
419
+ virtualHeight: string;
420
+ virtualItemHeight: number;
421
+ virtualItemsPerRow: undefined;
334
422
  }>>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
335
423
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
336
424
  declare const _default: typeof __VLS_export;
@@ -31,10 +31,29 @@ export declare function useApiModel<T extends ApiModelComposableProps>(props: T)
31
31
  canUpdate: import("vue").ComputedRef<boolean>;
32
32
  canDelete: import("vue").ComputedRef<boolean>;
33
33
  createItem: (item: Record<string, any>, callback?: FormDialogCallback, importing?: boolean) => Promise<any>;
34
- importItems: (importItemsList: Record<string, any>[], callback?: FormDialogCallback) => void;
34
+ importItems: (importData: Record<string, any>[], callback?: FormDialogCallback) => void;
35
35
  updateItem: (item: Record<string, any>, callback?: FormDialogCallback) => Promise<any>;
36
36
  deleteItem: (item: Record<string, any>, callback?: FormDialogCallback) => Promise<any>;
37
37
  loadItems: (options: any) => Promise<void>;
38
38
  reload: () => Promise<void>;
39
39
  isLoading: import("vue").Ref<boolean, boolean>;
40
+ importProgress: {
41
+ isImporting: import("vue").Ref<boolean, boolean>;
42
+ total: import("vue").Ref<number, number>;
43
+ processed: import("vue").Ref<number, number>;
44
+ succeeded: import("vue").Ref<number, number>;
45
+ failed: import("vue").Ref<number, number>;
46
+ errors: import("vue").Ref<{
47
+ index: number;
48
+ message: string;
49
+ }[], import("./importProgress.js").ImportError[] | {
50
+ index: number;
51
+ message: string;
52
+ }[]>;
53
+ percent: import("vue").ComputedRef<number>;
54
+ reset: () => void;
55
+ run: <T_1 = any>(items: T_1[], worker: import("./importProgress.js").ImportWorker<T_1>, options?: {
56
+ concurrency?: number;
57
+ }) => Promise<import("./importProgress.js").ImportSummary>;
58
+ };
40
59
  };
@@ -3,7 +3,7 @@ import { watchDebounced } from "@vueuse/core";
3
3
  import { useAlert } from "./alert.js";
4
4
  import { useApiModelOperation } from "./apiModelOperation.js";
5
5
  import { arrayWrap } from "../utils/array.js";
6
- import pLimit from "p-limit";
6
+ import { useImportProgress } from "./importProgress.js";
7
7
  export function stripModelByQualifier(modelName) {
8
8
  return modelName.split("By")[0].trim();
9
9
  }
@@ -20,6 +20,7 @@ export function useApiModel(props) {
20
20
  const search = ref();
21
21
  const currentOptions = ref();
22
22
  const isLoading = ref(false);
23
+ const importProgress = useImportProgress();
23
24
  function setSearch(keyword) {
24
25
  search.value = keyword;
25
26
  }
@@ -60,27 +61,33 @@ export function useApiModel(props) {
60
61
  if (callback && callback.setData) callback.setData(result);
61
62
  return result;
62
63
  }).catch((error) => {
64
+ if (importing) throw error;
63
65
  alert?.addAlert({ alertType: "error", message: error?.message || String(error) });
64
66
  }).finally(() => {
65
67
  if (!importing) isLoading.value = false;
66
68
  if (callback) callback.done();
67
69
  });
68
70
  }
69
- function importItems(importItemsList, callback) {
71
+ function importItems(importData, callback) {
72
+ if (importProgress.isImporting.value) return;
73
+ if (importData.length === 0) {
74
+ if (callback) callback.done();
75
+ return;
76
+ }
70
77
  isLoading.value = true;
71
- const limit = pLimit(50);
72
- const importPromises = importItemsList.map(
73
- (item) => limit(
74
- () => (item[props.modelKey || "id"] ? updateItem(item, void 0).then((result) => {
75
- if (!result) {
76
- return createItem(Object.assign({}, props.initialData, item), void 0, true);
77
- }
78
- }) : createItem(Object.assign({}, props.initialData, item), void 0, true)).catch((error) => {
79
- alert?.addAlert({ alertType: "error", message: error?.message || String(error) });
80
- })
81
- )
82
- );
83
- Promise.all(importPromises).finally(() => {
78
+ const worker = (item) => {
79
+ const createAsNew = () => createItem(Object.assign({}, props.initialData, item), void 0, true);
80
+ return item[props.modelKey || "id"] ? updateItem(item, void 0).then((result) => {
81
+ if (!result) return createAsNew();
82
+ }) : createAsNew();
83
+ };
84
+ importProgress.run(importData, worker, { concurrency: props.importConcurrency }).then(({ succeeded, failed }) => {
85
+ if (failed > 0) {
86
+ alert?.addAlert({ alertType: "warning", message: `\u0E19\u0E33\u0E40\u0E02\u0E49\u0E32\u0E2A\u0E33\u0E40\u0E23\u0E47\u0E08 ${succeeded} \u0E23\u0E32\u0E22\u0E01\u0E32\u0E23, \u0E25\u0E49\u0E21\u0E40\u0E2B\u0E25\u0E27 ${failed} \u0E23\u0E32\u0E22\u0E01\u0E32\u0E23` });
87
+ } else {
88
+ alert?.addAlert({ alertType: "success", message: `\u0E19\u0E33\u0E40\u0E02\u0E49\u0E32\u0E2A\u0E33\u0E40\u0E23\u0E47\u0E08 ${succeeded} \u0E23\u0E32\u0E22\u0E01\u0E32\u0E23` });
89
+ }
90
+ }).finally(() => {
84
91
  isLoading.value = false;
85
92
  reload();
86
93
  if (callback) callback.done();
@@ -180,6 +187,7 @@ export function useApiModel(props) {
180
187
  deleteItem,
181
188
  loadItems,
182
189
  reload,
183
- isLoading
190
+ isLoading,
191
+ importProgress
184
192
  };
185
193
  }
@@ -13,6 +13,26 @@ export interface DocumentTemplateItem {
13
13
  retrievedValue?: string;
14
14
  customClass?: string;
15
15
  customStyle?: string;
16
+ /**
17
+ * Print/docx-only hook attributes appended to the generated `{{placeholder}}`
18
+ * by the backend docx renderer (rama-spring-starter `DocumentTemplateJsonRenderer`).
19
+ * Ignored by the Vue form renderer ({@link useDocumentTemplate}).
20
+ *
21
+ * Two accepted shapes:
22
+ * - object map — each entry becomes a placeholder attribute
23
+ * (`{ width: 2 }` → `;width=2`); a `true`/blank value becomes a bare flag
24
+ * (`{ qrcode: true }` → `;qrcode`). Entry order is preserved.
25
+ * - raw string — appended verbatim as attributes
26
+ * (`"format=dd/MM/yyyy"` → `;format=dd/MM/yyyy`).
27
+ *
28
+ * See {@link printConfigToAttributes} for the exact append semantics.
29
+ */
30
+ printConfig?: Record<string, string | number | boolean> | string;
31
+ }
32
+ /** A single key/value row of a {@link DocumentTemplateItem.printConfig} object map, used by the builder editor. */
33
+ export interface PrintConfigRow {
34
+ key: string;
35
+ value: string | number | boolean;
16
36
  }
17
37
  export interface ChoiceItem {
18
38
  label: string;
@@ -23,5 +43,46 @@ export declare function useDocumentTemplate(items: string | object, parentTempla
23
43
  export declare function templateItemToString(inputItem: DocumentTemplateItem, parentTemplates: string | string[], dataVariable?: string): string;
24
44
  export declare function optionStringToChoiceObject(option: string | object): ChoiceItem[];
25
45
  export declare function escapeObjectForInlineBinding(obj: object): string;
46
+ /**
47
+ * Explode a {@link DocumentTemplateItem.printConfig} object map into ordered
48
+ * key/value rows for the builder editor. Returns an empty array for the
49
+ * raw-string form or any non-object value (those are edited as a plain string).
50
+ */
51
+ export declare function printConfigToRows(printConfig: DocumentTemplateItem['printConfig'] | undefined): PrintConfigRow[];
52
+ /**
53
+ * Collapse builder rows back into a `printConfig` object map. Blank keys are
54
+ * dropped; string values are coerced so the stored JSON matches the backend's
55
+ * expected primitives: `'true'`/`'false'` → boolean, numeric strings → number,
56
+ * and a blank value → `true` (a bare flag). Entry order is preserved.
57
+ */
58
+ export declare function rowsToPrintConfig(rows: PrintConfigRow[] | undefined): Record<string, string | number | boolean>;
59
+ /**
60
+ * Parse a human raw-attribute string (`"width=2; qrcode; locale=th_TH"`, an
61
+ * optional leading `;` is tolerated) into builder rows. Each `;`-separated
62
+ * token splits on the first `=`; a token without `=` becomes a bare-flag row
63
+ * (blank value). Blank tokens and blank keys are dropped. Inverse of
64
+ * {@link rowsToConfigString}; used when toggling the builder from raw-string to
65
+ * key/value mode.
66
+ */
67
+ export declare function configStringToRows(configString: string | undefined): PrintConfigRow[];
68
+ /**
69
+ * Render builder rows into a human raw-attribute string
70
+ * (`"width=2; qrcode"`). A `true`/blank value becomes a bare flag. Inverse of
71
+ * {@link configStringToRows}; used when toggling the builder from key/value to
72
+ * raw-string mode.
73
+ */
74
+ export declare function rowsToConfigString(rows: PrintConfigRow[] | undefined): string;
75
+ /**
76
+ * Resolve a {@link DocumentTemplateItem.printConfig} to the attribute string the
77
+ * backend docx renderer appends to a `{{placeholder}}`. This is the single
78
+ * source of truth for the append semantics (object map and raw string).
79
+ *
80
+ * - object map — `{ width: 2 }` → `;width=2`; a `true`/blank value becomes a
81
+ * bare flag (`{ qrcode: true }` → `;qrcode`); a `false` value is omitted.
82
+ * - raw string — appended verbatim with exactly one leading `;`.
83
+ *
84
+ * The Vue form renderer never calls this — `printConfig` is print-target-only.
85
+ */
86
+ export declare function printConfigToAttributes(printConfig: DocumentTemplateItem['printConfig'] | undefined): string;
26
87
  export declare function buildValidationRules(validationString: string): string;
27
88
  export declare function processDefaultTemplate(item: DocumentTemplateItem, insideTemplate?: string, optionString?: string, validationRules?: string, dataVariable?: string): string;
@@ -130,6 +130,65 @@ export function optionStringToChoiceObject(option) {
130
130
  export function escapeObjectForInlineBinding(obj) {
131
131
  return JSON.stringify(obj).replace(/'/g, "&#39;");
132
132
  }
133
+ export function printConfigToRows(printConfig) {
134
+ if (!printConfig || typeof printConfig !== "object" || Array.isArray(printConfig)) return [];
135
+ return Object.entries(printConfig).map(([key, value]) => ({ key, value }));
136
+ }
137
+ export function rowsToPrintConfig(rows) {
138
+ const out = {};
139
+ for (const row of rows || []) {
140
+ const key = typeof row?.key === "string" ? row.key.trim() : "";
141
+ if (!key) continue;
142
+ out[key] = coercePrintConfigValue(row.value);
143
+ }
144
+ return out;
145
+ }
146
+ function coercePrintConfigValue(value) {
147
+ if (typeof value === "boolean" || typeof value === "number") return value;
148
+ const str = typeof value === "string" ? value.trim() : "";
149
+ if (str === "") return true;
150
+ if (str === "true") return true;
151
+ if (str === "false") return false;
152
+ if (/^-?\d+(\.\d+)?$/.test(str)) return Number(str);
153
+ return str;
154
+ }
155
+ export function configStringToRows(configString) {
156
+ if (typeof configString !== "string") return [];
157
+ const rows = [];
158
+ for (const token of configString.split(";")) {
159
+ const trimmed = token.trim();
160
+ if (!trimmed) continue;
161
+ const eq = trimmed.indexOf("=");
162
+ const key = (eq === -1 ? trimmed : trimmed.slice(0, eq)).trim();
163
+ if (!key) continue;
164
+ rows.push({ key, value: eq === -1 ? "" : trimmed.slice(eq + 1).trim() });
165
+ }
166
+ return rows;
167
+ }
168
+ export function rowsToConfigString(rows) {
169
+ return (rows || []).map((row) => {
170
+ const key = typeof row?.key === "string" ? row.key.trim() : "";
171
+ if (!key) return "";
172
+ return row.value === true || row.value === "" ? key : `${key}=${row.value}`;
173
+ }).filter(Boolean).join("; ");
174
+ }
175
+ export function printConfigToAttributes(printConfig) {
176
+ if (!printConfig) return "";
177
+ if (typeof printConfig === "string") {
178
+ const trimmed = printConfig.trim();
179
+ return trimmed ? `;${trimmed.replace(/^;+/, "")}` : "";
180
+ }
181
+ if (typeof printConfig !== "object" || Array.isArray(printConfig)) return "";
182
+ let attributes = "";
183
+ for (const [key, value] of Object.entries(printConfig)) {
184
+ const name = String(key).trim();
185
+ if (!name) continue;
186
+ if (value === false) continue;
187
+ if (value === true || value === "") attributes += `;${name}`;
188
+ else attributes += `;${name}=${value}`;
189
+ }
190
+ return attributes;
191
+ }
133
192
  export function buildValidationRules(validationString) {
134
193
  validationString = validationString.replace(/^\[|]$/g, "").trim();
135
194
  if (!validationRulesRegex.test(validationString)) return "";
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Validation for Document Template JSON — the array of `DocumentTemplateItem`
3
+ * objects consumed by {@link useDocumentTemplate} and produced by
4
+ * `<DocumentTemplateBuilder>`.
5
+ *
6
+ * The validator reuses the renderer's own single-sources-of-truth so it can
7
+ * never drift from runtime behaviour:
8
+ *
9
+ * - `validationRulesRegex` — the exact gate the runtime (`buildValidationRules`)
10
+ * and the builder UI both apply to `validationRules`.
11
+ * - the choice-format regex `^[^'",]+(,[^'",]+)*$` — the same one
12
+ * `optionStringToChoiceObject` and the builder's `ruleOptions` use.
13
+ * - the built-in input-type registry — for per-type flags (`requiresOptions`,
14
+ * `needsVariableName`, `needsLabel`, `needsWidth`, `optionsAsChoice`,
15
+ * `hasSpecificOptionEditor`).
16
+ *
17
+ * Two strictness levels share one core via the `strict` option:
18
+ *
19
+ * - `error` — render-breaking. Invalid in both modes.
20
+ * - `warning` — builder-unsafe, but the runtime still renders without crashing.
21
+ * Promoted to `error` when `strict: true`.
22
+ * - `info` — advisory only; never affects `valid`.
23
+ *
24
+ * This doc block is consumed by vue-docgen for generated API documentation.
25
+ */
26
+ import { type ComputedRef, type MaybeRefOrGetter } from 'vue';
27
+ export type ValidationSeverity = 'error' | 'warning' | 'info';
28
+ export interface ValidationIssue {
29
+ /** JSON-ish path to the offending node, e.g. `[2].inputOptions.formTemplate[0].variableName`. */
30
+ path: string;
31
+ /** Stable machine code, e.g. `INPUT_TYPE_MISSING`. */
32
+ code: string;
33
+ /** Human-readable explanation. */
34
+ message: string;
35
+ /** Effective severity (already reflects `strict` promotion). */
36
+ severity: ValidationSeverity;
37
+ }
38
+ export interface ValidationResult {
39
+ valid: boolean;
40
+ errors: ValidationIssue[];
41
+ warnings: ValidationIssue[];
42
+ infos: ValidationIssue[];
43
+ /** All issues in document order. */
44
+ issues: ValidationIssue[];
45
+ }
46
+ export interface ValidateOptions {
47
+ /** Promote builder-unsafe `warning`s to `error`s. Default `false`. */
48
+ strict?: boolean;
49
+ /** Forwarded ancestor-template context (advisory; mirrors `useDocumentTemplate`). */
50
+ parentTemplates?: string | string[];
51
+ }
52
+ /**
53
+ * Validate a Document Template. Accepts the same inputs as `useDocumentTemplate`:
54
+ * a JSON string or an already-parsed array of items.
55
+ */
56
+ export declare function validateDocumentTemplate(items: string | object, options?: ValidateOptions): ValidationResult;
57
+ /**
58
+ * Reactive wrapper. Re-validates whenever `source` (a ref, getter, JSON string,
59
+ * or item array) changes. Use in `<DocumentTemplateBuilder>`-adjacent UIs to
60
+ * surface per-field issues live.
61
+ */
62
+ export declare function useDocumentTemplateValidate(source: MaybeRefOrGetter<string | object>, options?: ValidateOptions): ComputedRef<ValidationResult>;