@d-mok/quasar-app-extension-quasar-axe 4.0.3 → 4.0.5
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/package.json
CHANGED
|
@@ -90,15 +90,20 @@ export function ORM<
|
|
|
90
90
|
return Rs.map(r => this.convert(r))
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
private async wrapper
|
|
93
|
+
private async wrapper(
|
|
94
94
|
logType: 'select' | 'insert' | 'update' | 'delete',
|
|
95
95
|
options: uiOptions | undefined,
|
|
96
|
-
fn: () => Promise<
|
|
97
|
-
): Promise<
|
|
96
|
+
fn: () => Promise<T[]>
|
|
97
|
+
): Promise<T[]> {
|
|
98
98
|
const { confirm, notify, loading } = options ?? {}
|
|
99
99
|
|
|
100
100
|
if (confirm) {
|
|
101
|
-
|
|
101
|
+
if (Array.isArray(confirm)) {
|
|
102
|
+
const [title, msg] = confirm
|
|
103
|
+
await qDialog.confirm(title, msg)
|
|
104
|
+
} else {
|
|
105
|
+
await qDialog.confirm(confirm)
|
|
106
|
+
}
|
|
102
107
|
}
|
|
103
108
|
|
|
104
109
|
if (loading === false) {
|
|
@@ -156,6 +161,8 @@ export function ORM<
|
|
|
156
161
|
: this.set(entities)
|
|
157
162
|
|
|
158
163
|
this.onChange()
|
|
164
|
+
|
|
165
|
+
return entities
|
|
159
166
|
})
|
|
160
167
|
}
|
|
161
168
|
|
|
@@ -182,6 +189,8 @@ export function ORM<
|
|
|
182
189
|
|
|
183
190
|
this.sortBy($ => vals.indexOf($[key]))
|
|
184
191
|
this.onChange()
|
|
192
|
+
|
|
193
|
+
return entities
|
|
185
194
|
})
|
|
186
195
|
}
|
|
187
196
|
|
|
@@ -216,7 +225,7 @@ export function ORM<
|
|
|
216
225
|
|
|
217
226
|
async insert(row: Partial<R>, options?: uiOptions): Promise<T> {
|
|
218
227
|
let entities = await this.insertMany([row], options)
|
|
219
|
-
return entities[0]
|
|
228
|
+
return entities[0]
|
|
220
229
|
}
|
|
221
230
|
|
|
222
231
|
async update(
|
|
@@ -224,37 +233,48 @@ export function ORM<
|
|
|
224
233
|
row: Partial<R>,
|
|
225
234
|
options?: uiOptions
|
|
226
235
|
): Promise<T> {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
236
|
+
const entities = await this.wrapper(
|
|
237
|
+
'update',
|
|
238
|
+
options,
|
|
239
|
+
async () => {
|
|
240
|
+
const data: R = await supabase
|
|
241
|
+
.from(tableName)
|
|
242
|
+
.update(this.onSanitize(row))
|
|
243
|
+
.eq(idKey, idVal as any)
|
|
244
|
+
.select(fields)
|
|
245
|
+
.single()
|
|
246
|
+
.then(handleError)
|
|
235
247
|
|
|
236
|
-
|
|
248
|
+
const entity = this.convert(data)
|
|
237
249
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
250
|
+
this.merge([entity], idKey)
|
|
251
|
+
this.onChange()
|
|
252
|
+
this.onEdit()
|
|
241
253
|
|
|
242
|
-
|
|
243
|
-
|
|
254
|
+
return [entity]
|
|
255
|
+
}
|
|
256
|
+
)
|
|
257
|
+
|
|
258
|
+
return entities[0]
|
|
244
259
|
}
|
|
245
260
|
|
|
246
261
|
async delete(idVal: R[IdK], options?: uiOptions): Promise<void> {
|
|
247
262
|
await this.wrapper('delete', options, async () => {
|
|
248
|
-
await supabase
|
|
263
|
+
const data: R = await supabase
|
|
249
264
|
.from(tableName)
|
|
250
265
|
.delete()
|
|
251
266
|
.eq(idKey, idVal as any)
|
|
267
|
+
.select(fields)
|
|
252
268
|
.single()
|
|
253
269
|
.then(handleError)
|
|
254
270
|
|
|
271
|
+
const entity = this.convert(data)
|
|
272
|
+
|
|
255
273
|
this.remove($ => $[idKey] === idVal)
|
|
256
274
|
this.onChange()
|
|
257
275
|
this.onEdit()
|
|
276
|
+
|
|
277
|
+
return [entity]
|
|
258
278
|
})
|
|
259
279
|
}
|
|
260
280
|
|
|
@@ -302,7 +322,7 @@ if (process.env.DEBUGGING) {
|
|
|
302
322
|
}
|
|
303
323
|
|
|
304
324
|
type uiOptions = {
|
|
305
|
-
confirm?: [string, string]
|
|
325
|
+
confirm?: [string, string] | string
|
|
306
326
|
notify?: string | false
|
|
307
327
|
loading?: false
|
|
308
328
|
}
|