@ramathibodi/nuxt-commons 4.0.12 → 4.0.14
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.
- package/dist/module.json +1 -1
- package/dist/runtime/components/dialog/ImportProgress.d.vue.ts +35 -0
- package/dist/runtime/components/dialog/ImportProgress.vue +53 -0
- package/dist/runtime/components/dialog/ImportProgress.vue.d.ts +35 -0
- package/dist/runtime/components/dialog/ImportResult.d.vue.ts +28 -0
- package/dist/runtime/components/dialog/ImportResult.vue +122 -0
- package/dist/runtime/components/dialog/ImportResult.vue.d.ts +28 -0
- package/dist/runtime/components/document/TemplateBuilder.vue +112 -7
- package/dist/runtime/components/model/Pad.vue +2 -1
- package/dist/runtime/components/model/Table.d.vue.ts +104 -28
- package/dist/runtime/components/model/Table.vue +118 -3
- package/dist/runtime/components/model/Table.vue.d.ts +104 -28
- package/dist/runtime/components/model/iterator.d.vue.ts +146 -49
- package/dist/runtime/components/model/iterator.vue +129 -5
- package/dist/runtime/components/model/iterator.vue.d.ts +146 -49
- package/dist/runtime/composables/api.d.ts +7 -0
- package/dist/runtime/composables/api.js +3 -2
- package/dist/runtime/composables/apiModel.d.ts +31 -3
- package/dist/runtime/composables/apiModel.js +30 -21
- package/dist/runtime/composables/apiModelOperation.d.ts +17 -3
- package/dist/runtime/composables/apiModelOperation.js +6 -6
- package/dist/runtime/composables/document/template.d.ts +61 -0
- package/dist/runtime/composables/document/template.js +59 -0
- package/dist/runtime/composables/document/validateTemplate.d.ts +62 -0
- package/dist/runtime/composables/document/validateTemplate.js +378 -0
- package/dist/runtime/composables/graphql.d.ts +3 -3
- package/dist/runtime/composables/graphql.js +6 -6
- package/dist/runtime/composables/graphqlModel.d.ts +31 -3
- package/dist/runtime/composables/graphqlModel.js +28 -20
- package/dist/runtime/composables/graphqlModelOperation.d.ts +1 -0
- package/dist/runtime/composables/graphqlOperation.d.ts +2 -1
- package/dist/runtime/composables/graphqlOperation.js +3 -3
- package/dist/runtime/composables/importProgress.d.ts +58 -0
- package/dist/runtime/composables/importProgress.js +130 -0
- package/dist/runtime/types/graphqlOperation.d.ts +12 -1
- package/dist/runtime/utils/virtualize.d.ts +15 -0
- package/dist/runtime/utils/virtualize.js +10 -0
- package/package.json +2 -1
- package/scripts/validate-document-template.mjs +158 -0
- package/templates/.codegen/plugin-schema-object.cjs +10 -13
|
@@ -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.
|
|
@@ -42,9 +48,9 @@ declare function openDialog(item?: object): void;
|
|
|
42
48
|
declare var __VLS_15: {
|
|
43
49
|
operation: {
|
|
44
50
|
openDialog: typeof openDialog;
|
|
45
|
-
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: ((
|
|
47
|
-
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>);
|
|
51
|
+
createItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean, idempotencySalt?: string | number) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean, idempotencySalt?: string | number) => Promise<any>);
|
|
52
|
+
importItems: ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void) | ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void);
|
|
53
|
+
updateItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, idempotencySalt?: string | number) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean, idempotencySalt?: string | number) => 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>);
|
|
50
56
|
setSearch: ((keyword: string) => void) | ((keyword: string) => void);
|
|
@@ -79,9 +85,9 @@ declare var __VLS_15: {
|
|
|
79
85
|
item: import("vuetify/lib/components/VDataIterator/composables/items.mjs").DataIteratorItem<Record<string, any>>;
|
|
80
86
|
operation: {
|
|
81
87
|
openDialog: typeof openDialog;
|
|
82
|
-
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: ((
|
|
84
|
-
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>);
|
|
88
|
+
createItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean, idempotencySalt?: string | number) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean, idempotencySalt?: string | number) => Promise<any>);
|
|
89
|
+
importItems: ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void) | ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void);
|
|
90
|
+
updateItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, idempotencySalt?: string | number) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean, idempotencySalt?: string | number) => 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>);
|
|
87
93
|
setSearch: ((keyword: string) => void) | ((keyword: string) => void);
|
|
@@ -92,16 +98,33 @@ declare var __VLS_15: {
|
|
|
92
98
|
canDelete: boolean;
|
|
93
99
|
autoRefresh: import("vue").Raw<import("../../composables/autoRefresh.js").UseAutoRefreshHandle>;
|
|
94
100
|
};
|
|
95
|
-
},
|
|
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, idempotencySalt?: string | number) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean, idempotencySalt?: string | number) => 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, idempotencySalt?: string | number) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean, idempotencySalt?: string | number) => 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
|
-
},
|
|
121
|
+
}, __VLS_85: {}, __VLS_93: {
|
|
99
122
|
items: Record<string, any>[];
|
|
100
123
|
operation: {
|
|
101
124
|
openDialog: typeof openDialog;
|
|
102
|
-
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: ((
|
|
104
|
-
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>);
|
|
125
|
+
createItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean, idempotencySalt?: string | number) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean, idempotencySalt?: string | number) => Promise<any>);
|
|
126
|
+
importItems: ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void) | ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void);
|
|
127
|
+
updateItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, idempotencySalt?: string | number) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean, idempotencySalt?: string | number) => 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>);
|
|
107
130
|
setSearch: ((keyword: string) => void) | ((keyword: string) => 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
|
-
},
|
|
157
|
+
}, __VLS_119: {
|
|
135
158
|
reload: () => void;
|
|
136
|
-
},
|
|
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,13 +166,13 @@ declare var __VLS_15: {
|
|
|
143
166
|
togglePause: () => void;
|
|
144
167
|
reset: () => void;
|
|
145
168
|
reload: () => void | Promise<void>;
|
|
146
|
-
},
|
|
169
|
+
}, __VLS_142: {
|
|
147
170
|
items: Record<string, any>[];
|
|
148
171
|
operation: {
|
|
149
172
|
openDialog: typeof openDialog;
|
|
150
|
-
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: ((
|
|
152
|
-
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>);
|
|
173
|
+
createItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean, idempotencySalt?: string | number) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean, idempotencySalt?: string | number) => Promise<any>);
|
|
174
|
+
importItems: ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void) | ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void);
|
|
175
|
+
updateItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, idempotencySalt?: string | number) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean, idempotencySalt?: string | number) => 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>);
|
|
155
178
|
setSearch: ((keyword: string) => void) | ((keyword: string) => void);
|
|
@@ -160,13 +183,13 @@ declare var __VLS_15: {
|
|
|
160
183
|
canDelete: boolean;
|
|
161
184
|
autoRefresh: import("vue").Raw<import("../../composables/autoRefresh.js").UseAutoRefreshHandle>;
|
|
162
185
|
};
|
|
163
|
-
},
|
|
186
|
+
}, __VLS_155: {
|
|
164
187
|
items: Record<string, any>[];
|
|
165
188
|
operation: {
|
|
166
189
|
openDialog: typeof openDialog;
|
|
167
|
-
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: ((
|
|
169
|
-
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>);
|
|
190
|
+
createItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean, idempotencySalt?: string | number) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean, idempotencySalt?: string | number) => Promise<any>);
|
|
191
|
+
importItems: ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void) | ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void);
|
|
192
|
+
updateItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, idempotencySalt?: string | number) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean, idempotencySalt?: string | number) => 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>);
|
|
172
195
|
setSearch: ((keyword: string) => void) | ((keyword: string) => void);
|
|
@@ -177,12 +200,12 @@ declare var __VLS_15: {
|
|
|
177
200
|
canDelete: boolean;
|
|
178
201
|
autoRefresh: import("vue").Raw<import("../../composables/autoRefresh.js").UseAutoRefreshHandle>;
|
|
179
202
|
};
|
|
180
|
-
},
|
|
203
|
+
}, __VLS_209: never, __VLS_210: {
|
|
181
204
|
operation: {
|
|
182
205
|
openDialog: typeof openDialog;
|
|
183
|
-
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: ((
|
|
185
|
-
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>);
|
|
206
|
+
createItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean, idempotencySalt?: string | number) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean, idempotencySalt?: string | number) => Promise<any>);
|
|
207
|
+
importItems: ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void) | ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void);
|
|
208
|
+
updateItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, idempotencySalt?: string | number) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean, idempotencySalt?: string | number) => 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>);
|
|
188
211
|
setSearch: ((keyword: string) => void) | ((keyword: string) => void);
|
|
@@ -193,12 +216,12 @@ declare var __VLS_15: {
|
|
|
193
216
|
canDelete: boolean;
|
|
194
217
|
autoRefresh: import("vue").Raw<import("../../composables/autoRefresh.js").UseAutoRefreshHandle>;
|
|
195
218
|
};
|
|
196
|
-
},
|
|
219
|
+
}, __VLS_235: never, __VLS_236: {
|
|
197
220
|
operation: {
|
|
198
221
|
openDialog: typeof openDialog;
|
|
199
|
-
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: ((
|
|
201
|
-
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>);
|
|
222
|
+
createItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean, idempotencySalt?: string | number) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean, idempotencySalt?: string | number) => Promise<any>);
|
|
223
|
+
importItems: ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void) | ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void);
|
|
224
|
+
updateItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, idempotencySalt?: string | number) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean, idempotencySalt?: string | number) => 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>);
|
|
204
227
|
setSearch: ((keyword: string) => void) | ((keyword: string) => 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
|
-
},
|
|
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, idempotencySalt?: string | number) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean, idempotencySalt?: string | number) => 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, idempotencySalt?: string | number) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean, idempotencySalt?: string | number) => 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
|
|
260
|
+
[K in NonNullable<typeof __VLS_209>]?: (props: typeof __VLS_210) => any;
|
|
261
|
+
} & {
|
|
262
|
+
[K in NonNullable<typeof __VLS_235>]?: (props: typeof __VLS_236) => any;
|
|
215
263
|
} & {
|
|
216
|
-
[K in NonNullable<typeof
|
|
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
|
-
|
|
270
|
+
item?: (props: typeof __VLS_62) => any;
|
|
223
271
|
} & {
|
|
224
|
-
|
|
272
|
+
loader?: (props: typeof __VLS_65) => any;
|
|
225
273
|
} & {
|
|
226
|
-
|
|
274
|
+
loaderItem?: (props: typeof __VLS_85) => any;
|
|
227
275
|
} & {
|
|
228
|
-
|
|
276
|
+
header?: (props: typeof __VLS_93) => any;
|
|
229
277
|
} & {
|
|
230
|
-
|
|
278
|
+
title?: (props: typeof __VLS_119) => any;
|
|
231
279
|
} & {
|
|
232
|
-
|
|
280
|
+
autoRefreshControl?: (props: typeof __VLS_129) => any;
|
|
233
281
|
} & {
|
|
234
|
-
|
|
282
|
+
search?: (props: typeof __VLS_142) => any;
|
|
235
283
|
} & {
|
|
236
|
-
|
|
284
|
+
toolbarItems?: (props: typeof __VLS_155) => any;
|
|
285
|
+
} & {
|
|
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,13 +312,19 @@ 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
|
-
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: ((
|
|
269
|
-
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>);
|
|
325
|
+
createItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean, idempotencySalt?: string | number) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean, idempotencySalt?: string | number) => Promise<any>);
|
|
326
|
+
importItems: ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void) | ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void);
|
|
327
|
+
updateItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, idempotencySalt?: string | number) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean, idempotencySalt?: string | number) => 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>);
|
|
272
330
|
setSearch: ((keyword: string) => void) | ((keyword: string) => void);
|
|
@@ -278,9 +336,9 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
278
336
|
autoRefresh: import("vue").Raw<import("../../composables/autoRefresh.js").UseAutoRefreshHandle>;
|
|
279
337
|
}, {
|
|
280
338
|
openDialog: typeof openDialog;
|
|
281
|
-
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: ((
|
|
283
|
-
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>);
|
|
339
|
+
createItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean, idempotencySalt?: string | number) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean, idempotencySalt?: string | number) => Promise<any>);
|
|
340
|
+
importItems: ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void) | ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void);
|
|
341
|
+
updateItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, idempotencySalt?: string | number) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean, idempotencySalt?: string | number) => 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>);
|
|
286
344
|
setSearch: ((keyword: string) => void) | ((keyword: string) => void);
|
|
@@ -292,9 +350,9 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
292
350
|
autoRefresh: import("vue").Raw<import("../../composables/autoRefresh.js").UseAutoRefreshHandle>;
|
|
293
351
|
} | {
|
|
294
352
|
openDialog: typeof openDialog;
|
|
295
|
-
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: ((
|
|
297
|
-
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>);
|
|
353
|
+
createItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean, idempotencySalt?: string | number) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean, idempotencySalt?: string | number) => Promise<any>);
|
|
354
|
+
importItems: ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void) | ((importData: Record<string, any>[], callback?: import("../../types/formDialog.js").FormDialogCallback) => void);
|
|
355
|
+
updateItem: ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, idempotencySalt?: string | number) => Promise<void>) | ((item: Record<string, any>, callback?: import("../../types/formDialog.js").FormDialogCallback, importing?: boolean, idempotencySalt?: string | number) => 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>);
|
|
300
358
|
setSearch: ((keyword: string) => void) | ((keyword: string) => void);
|
|
@@ -306,6 +364,39 @@ 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
|
+
item: any;
|
|
376
|
+
errorType: import("../../composables/importProgress.js").ImportErrorType;
|
|
377
|
+
message: string;
|
|
378
|
+
detail?: any;
|
|
379
|
+
}[], import("../../composables/importProgress.js").ImportError[] | {
|
|
380
|
+
index: number;
|
|
381
|
+
item: any;
|
|
382
|
+
errorType: import("../../composables/importProgress.js").ImportErrorType;
|
|
383
|
+
message: string;
|
|
384
|
+
detail?: any;
|
|
385
|
+
}[]>;
|
|
386
|
+
percent: import("vue").ComputedRef<number>;
|
|
387
|
+
resultVisible: import("vue").Ref<boolean, boolean>;
|
|
388
|
+
reset: () => void;
|
|
389
|
+
run: <T = any>(items: T[], worker: import("../../composables/importProgress.js").ImportWorker<T>, options?: {
|
|
390
|
+
concurrency
|
|
391
|
+
/**
|
|
392
|
+
* ModelIterator connects model metadata to reusable selection, labeling, iterator, or table UI patterns.
|
|
393
|
+
* This doc block is consumed by vue-docgen for generated API documentation.
|
|
394
|
+
*/
|
|
395
|
+
?: number;
|
|
396
|
+
}) => Promise<import("../../composables/importProgress.js").ImportSummary>;
|
|
397
|
+
retry: (indices?: number[]) => Promise<import("../../composables/importProgress.js").ImportSummary>;
|
|
398
|
+
dismissResult: () => void;
|
|
399
|
+
};
|
|
309
400
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<__VLS_Props>, {
|
|
310
401
|
noDataText: string;
|
|
311
402
|
dialogFullscreen: boolean;
|
|
@@ -331,6 +422,12 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
331
422
|
autoRefresh: boolean;
|
|
332
423
|
autoRefreshDefault: number;
|
|
333
424
|
autoRefreshControl: boolean;
|
|
425
|
+
importConcurrency: number;
|
|
426
|
+
virtual: undefined;
|
|
427
|
+
virtualThreshold: number;
|
|
428
|
+
virtualHeight: string;
|
|
429
|
+
virtualItemHeight: number;
|
|
430
|
+
virtualItemsPerRow: undefined;
|
|
334
431
|
}>>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
335
432
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
336
433
|
declare const _default: typeof __VLS_export;
|
|
@@ -64,6 +64,13 @@ export type CacheOption = boolean | number | {
|
|
|
64
64
|
*/
|
|
65
65
|
export interface ApiIdempotencyOption {
|
|
66
66
|
idempotent?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Optional discriminator folded as a trailing component into the
|
|
69
|
+
* Idempotency-Key hash: SHA-256(`<second>|<username>|<body>|<salt>`).
|
|
70
|
+
* Lets legitimately-identical payloads (e.g. duplicate bulk-import rows)
|
|
71
|
+
* resolve to distinct keys without weakening dedup elsewhere.
|
|
72
|
+
*/
|
|
73
|
+
idempotencySalt?: string | number;
|
|
67
74
|
}
|
|
68
75
|
export type ApiFetchOptions = UseFetchOptions<unknown> & ApiIdempotencyOption;
|
|
69
76
|
export declare function _resetLegacyHeuristicWarning(): void;
|
|
@@ -101,9 +101,10 @@ export function useApi() {
|
|
|
101
101
|
const username = (typeof auth.getUsername === "function" ? auth.getUsername() : auth.userProfile?.username) ?? "";
|
|
102
102
|
const second = Math.floor(Date.now() / 1e3).toString();
|
|
103
103
|
const bodyJson = stableStringify(body ?? {});
|
|
104
|
-
|
|
104
|
+
const salt = options.idempotencySalt != null ? `|${String(options.idempotencySalt)}` : "";
|
|
105
|
+
headers[headerName] = await sha256(`${second}|${username}|${bodyJson}${salt}`);
|
|
105
106
|
}
|
|
106
|
-
const { idempotent: _omitIdempotent, ...passThroughOptions } = options;
|
|
107
|
+
const { idempotent: _omitIdempotent, idempotencySalt: _omitSalt, ...passThroughOptions } = options;
|
|
107
108
|
const baseOptions = {
|
|
108
109
|
method,
|
|
109
110
|
body,
|
|
@@ -30,11 +30,39 @@ export declare function useApiModel<T extends ApiModelComposableProps>(props: T)
|
|
|
30
30
|
canCreate: import("vue").ComputedRef<boolean>;
|
|
31
31
|
canUpdate: import("vue").ComputedRef<boolean>;
|
|
32
32
|
canDelete: import("vue").ComputedRef<boolean>;
|
|
33
|
-
createItem: (item: Record<string, any>, callback?: FormDialogCallback, importing?: boolean) => Promise<any>;
|
|
34
|
-
importItems: (
|
|
35
|
-
updateItem: (item: Record<string, any>, callback?: FormDialogCallback) => Promise<any>;
|
|
33
|
+
createItem: (item: Record<string, any>, callback?: FormDialogCallback, importing?: boolean, idempotencySalt?: string | number) => Promise<any>;
|
|
34
|
+
importItems: (importData: Record<string, any>[], callback?: FormDialogCallback) => void;
|
|
35
|
+
updateItem: (item: Record<string, any>, callback?: FormDialogCallback, importing?: boolean, idempotencySalt?: string | number) => 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
|
+
item: any;
|
|
49
|
+
errorType: import("./importProgress.js").ImportErrorType;
|
|
50
|
+
message: string;
|
|
51
|
+
detail?: any;
|
|
52
|
+
}[], import("./importProgress.js").ImportError[] | {
|
|
53
|
+
index: number;
|
|
54
|
+
item: any;
|
|
55
|
+
errorType: import("./importProgress.js").ImportErrorType;
|
|
56
|
+
message: string;
|
|
57
|
+
detail?: any;
|
|
58
|
+
}[]>;
|
|
59
|
+
percent: import("vue").ComputedRef<number>;
|
|
60
|
+
resultVisible: import("vue").Ref<boolean, boolean>;
|
|
61
|
+
reset: () => void;
|
|
62
|
+
run: <T_1 = any>(items: T_1[], worker: import("./importProgress.js").ImportWorker<T_1>, options?: {
|
|
63
|
+
concurrency?: number;
|
|
64
|
+
}) => Promise<import("./importProgress.js").ImportSummary>;
|
|
65
|
+
retry: (indices?: number[]) => Promise<import("./importProgress.js").ImportSummary>;
|
|
66
|
+
dismissResult: () => void;
|
|
67
|
+
};
|
|
40
68
|
};
|
|
@@ -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
|
|
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
|
}
|
|
@@ -49,9 +50,9 @@ export function useApiModel(props) {
|
|
|
49
50
|
}
|
|
50
51
|
return [.../* @__PURE__ */ new Set([...fieldsProps, ...tmpFields])];
|
|
51
52
|
});
|
|
52
|
-
function createItem(item, callback, importing = false) {
|
|
53
|
+
function createItem(item, callback, importing = false, idempotencySalt) {
|
|
53
54
|
isLoading.value = true;
|
|
54
|
-
return ops.value.create(item, fields.value).then((result) => {
|
|
55
|
+
return ops.value.create(item, fields.value, idempotencySalt != null ? { idempotencySalt } : void 0).then((result) => {
|
|
55
56
|
if (canServerPageable.value) {
|
|
56
57
|
if (!importing) loadItems(currentOptions.value);
|
|
57
58
|
} else {
|
|
@@ -60,35 +61,41 @@ 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(
|
|
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
|
|
72
|
-
|
|
73
|
-
(item) =>
|
|
74
|
-
()
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
78
|
+
const worker = (item, _index, salt) => {
|
|
79
|
+
const createAsNew = () => createItem(Object.assign({}, props.initialData, item), void 0, true, salt);
|
|
80
|
+
return item[props.modelKey || "id"] ? updateItem(item, void 0, true, salt).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
|
+
importProgress.resultVisible.value = true;
|
|
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();
|
|
87
94
|
});
|
|
88
95
|
}
|
|
89
|
-
function updateItem(item, callback) {
|
|
96
|
+
function updateItem(item, callback, importing = false, idempotencySalt) {
|
|
90
97
|
isLoading.value = true;
|
|
91
|
-
return ops.value.update(item, fields.value).then((result) => {
|
|
98
|
+
return ops.value.update(item, fields.value, idempotencySalt != null ? { idempotencySalt } : void 0).then((result) => {
|
|
92
99
|
if (canServerPageable.value) {
|
|
93
100
|
loadItems(currentOptions.value);
|
|
94
101
|
} else {
|
|
@@ -100,9 +107,10 @@ export function useApiModel(props) {
|
|
|
100
107
|
if (callback && callback.setData) callback.setData(result);
|
|
101
108
|
return result;
|
|
102
109
|
}).catch((error) => {
|
|
110
|
+
if (importing) throw error;
|
|
103
111
|
alert?.addAlert({ alertType: "error", message: error?.message || String(error) });
|
|
104
112
|
}).finally(() => {
|
|
105
|
-
isLoading.value = false;
|
|
113
|
+
if (!importing) isLoading.value = false;
|
|
106
114
|
if (callback) callback.done();
|
|
107
115
|
});
|
|
108
116
|
}
|
|
@@ -180,6 +188,7 @@ export function useApiModel(props) {
|
|
|
180
188
|
deleteItem,
|
|
181
189
|
loadItems,
|
|
182
190
|
reload,
|
|
183
|
-
isLoading
|
|
191
|
+
isLoading,
|
|
192
|
+
importProgress
|
|
184
193
|
};
|
|
185
194
|
}
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useApiModelOperation provides a single runtime layer that owns every
|
|
3
|
+
* URL- and body-building rule for API mode (the REST counterpart to
|
|
4
|
+
* useGraphQlOperation). Reads preserve the full modelName; mutations
|
|
5
|
+
* strip the `By<Qualifier>` suffix.
|
|
6
|
+
*
|
|
7
|
+
* When the GraphQL bridge has a `graphqlType[modelName]` entry, fields
|
|
8
|
+
* are expanded via the existing buildFields() helper exactly the way
|
|
9
|
+
* useGraphQlOperation does for GraphQL queries. Otherwise, fields and
|
|
10
|
+
* variables pass through verbatim.
|
|
11
|
+
*
|
|
12
|
+
* This doc block is consumed by vue-docgen for generated API documentation.
|
|
13
|
+
*/
|
|
14
|
+
import { type ApiIdempotencyOption } from './api.js';
|
|
1
15
|
export interface ApiModelPageable {
|
|
2
16
|
page?: number;
|
|
3
17
|
perPage?: number;
|
|
@@ -12,8 +26,8 @@ export interface ApiModelOperationCallables<TItem = any, TInput = any> {
|
|
|
12
26
|
};
|
|
13
27
|
}>;
|
|
14
28
|
search: <T = TItem>(fields?: Array<string | object>, variables?: Record<string, any>, search?: any) => Promise<T[]>;
|
|
15
|
-
create: <T = TItem>(input: TInput | Record<string, any>, fields?: Array<string | object
|
|
16
|
-
update: <T = TItem>(input: TInput | Record<string, any>, fields?: Array<string | object
|
|
17
|
-
delete: <T = any>(input: TInput | Record<string, any>, fields?: Array<string | object
|
|
29
|
+
create: <T = TItem>(input: TInput | Record<string, any>, fields?: Array<string | object>, options?: ApiIdempotencyOption) => Promise<T>;
|
|
30
|
+
update: <T = TItem>(input: TInput | Record<string, any>, fields?: Array<string | object>, options?: ApiIdempotencyOption) => Promise<T>;
|
|
31
|
+
delete: <T = any>(input: TInput | Record<string, any>, fields?: Array<string | object>, options?: ApiIdempotencyOption) => Promise<T>;
|
|
18
32
|
}
|
|
19
33
|
export declare function useApiModelOperation<TItem = any, TInput = any>(modelName: string): ApiModelOperationCallables<TItem, TInput>;
|
|
@@ -40,17 +40,17 @@ export function useApiModelOperation(modelName) {
|
|
|
40
40
|
search
|
|
41
41
|
});
|
|
42
42
|
},
|
|
43
|
-
create: (input, fields) => {
|
|
43
|
+
create: (input, fields, options) => {
|
|
44
44
|
const endpoint = buildApiEndpoint(stripModelByQualifier(modelName), "create");
|
|
45
|
-
return api.postPromise(endpoint, { input, fields: prepFields(fields) });
|
|
45
|
+
return api.postPromise(endpoint, { input, fields: prepFields(fields) }, void 0, options);
|
|
46
46
|
},
|
|
47
|
-
update: (input, fields) => {
|
|
47
|
+
update: (input, fields, options) => {
|
|
48
48
|
const endpoint = buildApiEndpoint(stripModelByQualifier(modelName), "update");
|
|
49
|
-
return api.postPromise(endpoint, { input, fields: prepFields(fields) });
|
|
49
|
+
return api.postPromise(endpoint, { input, fields: prepFields(fields) }, void 0, options);
|
|
50
50
|
},
|
|
51
|
-
delete: (input, fields) => {
|
|
51
|
+
delete: (input, fields, options) => {
|
|
52
52
|
const endpoint = buildApiEndpoint(stripModelByQualifier(modelName), "delete");
|
|
53
|
-
return api.postPromise(endpoint, { input, fields: prepFields(fields) });
|
|
53
|
+
return api.postPromise(endpoint, { input, fields: prepFields(fields) }, void 0, options);
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
56
|
}
|