@d-mok/quasar-app-extension-quasar-axe 4.0.4 → 4.0.6

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d-mok/quasar-app-extension-quasar-axe",
3
- "version": "4.0.4",
3
+ "version": "4.0.6",
4
4
  "description": "A Quasar App Extension",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -44,7 +44,7 @@
44
44
  <q-separator />
45
45
  <q-list separator>
46
46
  <qx-menu-item
47
- v-for="item in items"
47
+ v-for="item in items.filter($ => $.title !== undefined)"
48
48
  :key="item.title"
49
49
  v-bind="item"
50
50
  />
@@ -106,7 +106,7 @@ import { computed, ref } from 'vue'
106
106
  import { useRoute } from 'vue-router'
107
107
 
108
108
  type item = {
109
- title: string
109
+ title?: string
110
110
  caption?: string
111
111
  icon?: string
112
112
  link: string
@@ -90,15 +90,20 @@ export function ORM<
90
90
  return Rs.map(r => this.convert(r))
91
91
  }
92
92
 
93
- private async wrapper<X>(
93
+ private async wrapper(
94
94
  logType: 'select' | 'insert' | 'update' | 'delete',
95
95
  options: uiOptions | undefined,
96
- fn: () => Promise<X>
97
- ): Promise<X> {
96
+ fn: () => Promise<T[]>
97
+ ): Promise<T[]> {
98
98
  const { confirm, notify, loading } = options ?? {}
99
99
 
100
100
  if (confirm) {
101
- await qDialog.confirm(...confirm)
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,28 +233,34 @@ export function ORM<
224
233
  row: Partial<R>,
225
234
  options?: uiOptions
226
235
  ): Promise<T> {
227
- return await this.wrapper('update', options, async () => {
228
- const data: R = await supabase
229
- .from(tableName)
230
- .update(this.onSanitize(row))
231
- .eq(idKey, idVal as any)
232
- .select(fields)
233
- .single()
234
- .then(handleError)
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
- const entity = this.convert(data)
248
+ const entity = this.convert(data)
237
249
 
238
- this.merge([entity], idKey)
239
- this.onChange()
240
- this.onEdit()
250
+ this.merge([entity], idKey)
251
+ this.onChange()
252
+ this.onEdit()
241
253
 
242
- return entity
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)
@@ -253,9 +268,13 @@ export function ORM<
253
268
  .single()
254
269
  .then(handleError)
255
270
 
271
+ const entity = this.convert(data)
272
+
256
273
  this.remove($ => $[idKey] === idVal)
257
274
  this.onChange()
258
275
  this.onEdit()
276
+
277
+ return [entity]
259
278
  })
260
279
  }
261
280
 
@@ -303,7 +322,7 @@ if (process.env.DEBUGGING) {
303
322
  }
304
323
 
305
324
  type uiOptions = {
306
- confirm?: [string, string]
325
+ confirm?: [string, string] | string
307
326
  notify?: string | false
308
327
  loading?: false
309
328
  }