@d-mok/quasar-app-extension-quasar-axe 3.1.49 → 3.1.51
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": "3.1.
|
|
3
|
+
"version": "3.1.51",
|
|
4
4
|
"description": "A Quasar App Extension",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"handsontable": "^15.2.0",
|
|
18
18
|
"jszip": "^3.10.1",
|
|
19
19
|
"lodash": "^4.17.21",
|
|
20
|
-
"sapphire-js": "^2.1.
|
|
20
|
+
"sapphire-js": "^2.1.49",
|
|
21
21
|
"sortablejs": "^1.15.0",
|
|
22
22
|
"valibot": "^1.0.0"
|
|
23
23
|
},
|
|
@@ -4,9 +4,10 @@ import dialogBtn from './custom/dialogBtn.vue'
|
|
|
4
4
|
import dialogFile from './custom/dialogFile.vue'
|
|
5
5
|
import dialogRadioText from './custom/dialogRadioText.vue'
|
|
6
6
|
import dialogCheckboxText from './custom/dialogCheckboxText.vue'
|
|
7
|
+
import dialogForm from './custom/dialogForm.vue'
|
|
7
8
|
import { throwError } from './basic'
|
|
8
9
|
import type { Component } from 'vue'
|
|
9
|
-
import {
|
|
10
|
+
import { Dialog, QDialogOptions } from 'quasar'
|
|
10
11
|
|
|
11
12
|
type Predicate<T> = (_: T) => boolean
|
|
12
13
|
type Mapper<T, S> = (_: T) => S
|
|
@@ -18,6 +19,20 @@ type PropType<C extends VueComponent> = Omit<
|
|
|
18
19
|
>
|
|
19
20
|
type OkType<C extends VueComponent> = Parameters<InstanceType<C>['$emit']>[1]
|
|
20
21
|
|
|
22
|
+
export async function base(component: Component, props: any) {
|
|
23
|
+
return new Promise<any>((resolve, reject) =>
|
|
24
|
+
Dialog.create({
|
|
25
|
+
component,
|
|
26
|
+
componentProps: {
|
|
27
|
+
persistent: true,
|
|
28
|
+
...props,
|
|
29
|
+
},
|
|
30
|
+
})
|
|
31
|
+
.onOk((data: any) => resolve(data))
|
|
32
|
+
.onCancel(() => reject('dialog cancelled by user.'))
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
21
36
|
export async function custom<C extends VueComponent>(
|
|
22
37
|
component: C,
|
|
23
38
|
props?: PropType<C>
|
|
@@ -275,3 +290,80 @@ export async function askCheckboxText(
|
|
|
275
290
|
cancel: true,
|
|
276
291
|
})
|
|
277
292
|
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* FORM
|
|
296
|
+
*/
|
|
297
|
+
|
|
298
|
+
type FormPrefill = Record<
|
|
299
|
+
string,
|
|
300
|
+
| string
|
|
301
|
+
| number
|
|
302
|
+
| boolean
|
|
303
|
+
| { type: 'string'; value: string; label?: string; hint?: string }
|
|
304
|
+
| { type: 'number'; value: number; label?: string; hint?: string }
|
|
305
|
+
| { type: 'boolean'; value: boolean; label?: string }
|
|
306
|
+
| { type: 'date'; value: string; label?: string; hint?: string }
|
|
307
|
+
| { type: 'time'; value: string; label?: string; hint?: string }
|
|
308
|
+
| {
|
|
309
|
+
type: 'select'
|
|
310
|
+
value: string
|
|
311
|
+
options: string[]
|
|
312
|
+
label?: string
|
|
313
|
+
hint?: string
|
|
314
|
+
}
|
|
315
|
+
| {
|
|
316
|
+
type: 'autocomplete'
|
|
317
|
+
value: string
|
|
318
|
+
options: string[]
|
|
319
|
+
label?: string
|
|
320
|
+
hint?: string
|
|
321
|
+
noFilter?: boolean
|
|
322
|
+
immediate?: boolean
|
|
323
|
+
}
|
|
324
|
+
>
|
|
325
|
+
|
|
326
|
+
type FormPrefillStandard<T extends FormPrefill> = {
|
|
327
|
+
[P in keyof T]: T[P] extends object
|
|
328
|
+
? T[P]
|
|
329
|
+
: T[P] extends string
|
|
330
|
+
? { type: 'string'; value: string; label?: string; hint?: string }
|
|
331
|
+
: T[P] extends number
|
|
332
|
+
? { type: 'number'; value: number; label?: string; hint?: string }
|
|
333
|
+
: T[P] extends boolean
|
|
334
|
+
? { type: 'boolean'; value: boolean; label?: string }
|
|
335
|
+
: never
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
type FormFlat<T extends FormPrefill> = {
|
|
339
|
+
[P in keyof T]: T[P] extends object ? T[P]['value'] : T[P]
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Ask for an objects.
|
|
344
|
+
*/
|
|
345
|
+
export async function askForm<T extends FormPrefill>(
|
|
346
|
+
title: string,
|
|
347
|
+
message: string,
|
|
348
|
+
prefill: T,
|
|
349
|
+
validators: [(_: FormFlat<T>) => boolean, string][] = [[$ => true, '']],
|
|
350
|
+
onChange: (
|
|
351
|
+
current: FormPrefillStandard<T>,
|
|
352
|
+
old: FormPrefillStandard<T>
|
|
353
|
+
) => void = (c, o) => {}
|
|
354
|
+
): Promise<FormFlat<T>> {
|
|
355
|
+
const standardPrefill = Object.mapValues(prefill, $ => {
|
|
356
|
+
if (typeof $ === 'string') return { type: 'string', value: $ }
|
|
357
|
+
if (typeof $ === 'number') return { type: 'number', value: $ }
|
|
358
|
+
if (typeof $ === 'boolean') return { type: 'boolean', value: $ }
|
|
359
|
+
return $
|
|
360
|
+
})
|
|
361
|
+
|
|
362
|
+
return await base(dialogForm, {
|
|
363
|
+
title,
|
|
364
|
+
message,
|
|
365
|
+
prefill: standardPrefill,
|
|
366
|
+
validators,
|
|
367
|
+
onChange,
|
|
368
|
+
})
|
|
369
|
+
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Dialog, QDialogOptions } from 'quasar'
|
|
2
|
-
import type { Component } from 'vue'
|
|
3
|
-
|
|
4
|
-
export async function base(component: Component, props: any) {
|
|
5
|
-
return new Promise<any>((resolve, reject) =>
|
|
6
|
-
Dialog.create({
|
|
7
|
-
component,
|
|
8
|
-
componentProps: {
|
|
9
|
-
persistent: true,
|
|
10
|
-
...props,
|
|
11
|
-
},
|
|
12
|
-
})
|
|
13
|
-
.onOk((data: any) => resolve(data))
|
|
14
|
-
.onCancel(() => reject('dialog cancelled by user.'))
|
|
15
|
-
)
|
|
16
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import dialogForm from './custom/dialogForm.vue'
|
|
2
|
-
import { base } from './custom_base'
|
|
3
|
-
|
|
4
|
-
type FormPrefill = Record<
|
|
5
|
-
string,
|
|
6
|
-
| string
|
|
7
|
-
| number
|
|
8
|
-
| boolean
|
|
9
|
-
| { type: 'string'; value: string; label?: string; hint?: string }
|
|
10
|
-
| { type: 'number'; value: number; label?: string; hint?: string }
|
|
11
|
-
| { type: 'boolean'; value: boolean; label?: string }
|
|
12
|
-
| { type: 'date'; value: string; label?: string; hint?: string }
|
|
13
|
-
| { type: 'time'; value: string; label?: string; hint?: string }
|
|
14
|
-
| {
|
|
15
|
-
type: 'select'
|
|
16
|
-
value: string
|
|
17
|
-
options: string[]
|
|
18
|
-
label?: string
|
|
19
|
-
hint?: string
|
|
20
|
-
}
|
|
21
|
-
| {
|
|
22
|
-
type: 'autocomplete'
|
|
23
|
-
value: string
|
|
24
|
-
options: string[]
|
|
25
|
-
label?: string
|
|
26
|
-
hint?: string
|
|
27
|
-
noFilter?: boolean
|
|
28
|
-
immediate?: boolean
|
|
29
|
-
}
|
|
30
|
-
>
|
|
31
|
-
|
|
32
|
-
type FormPrefillStandard<T extends FormPrefill> = {
|
|
33
|
-
[P in keyof T]: T[P] extends object
|
|
34
|
-
? T[P]
|
|
35
|
-
: T[P] extends string
|
|
36
|
-
? { type: 'string'; value: string; label?: string; hint?: string }
|
|
37
|
-
: T[P] extends number
|
|
38
|
-
? { type: 'number'; value: number; label?: string; hint?: string }
|
|
39
|
-
: T[P] extends boolean
|
|
40
|
-
? { type: 'boolean'; value: boolean; label?: string }
|
|
41
|
-
: never
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
type FormFlat<T extends FormPrefill> = {
|
|
45
|
-
[P in keyof T]: T[P] extends object ? T[P]['value'] : T[P]
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Ask for an objects.
|
|
50
|
-
*/
|
|
51
|
-
export async function askForm<T extends FormPrefill>(
|
|
52
|
-
title: string,
|
|
53
|
-
message: string,
|
|
54
|
-
prefill: T,
|
|
55
|
-
validators: [(_: FormFlat<T>) => boolean, string][] = [[$ => true, '']],
|
|
56
|
-
onChange: (
|
|
57
|
-
current: FormPrefillStandard<T>,
|
|
58
|
-
old: FormPrefillStandard<T>
|
|
59
|
-
) => void = (c, o) => {}
|
|
60
|
-
): Promise<FormFlat<T>> {
|
|
61
|
-
const standardPrefill = Object.mapValues(prefill, $ => {
|
|
62
|
-
if (typeof $ === 'string') return { type: 'string', value: $ }
|
|
63
|
-
if (typeof $ === 'number') return { type: 'number', value: $ }
|
|
64
|
-
if (typeof $ === 'boolean') return { type: 'boolean', value: $ }
|
|
65
|
-
return $
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
return await base(dialogForm, {
|
|
69
|
-
title,
|
|
70
|
-
message,
|
|
71
|
-
prefill: standardPrefill,
|
|
72
|
-
validators,
|
|
73
|
-
onChange,
|
|
74
|
-
})
|
|
75
|
-
}
|