@d-mok/quasar-app-extension-quasar-axe 2.1.66 → 2.1.68
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,16 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
import Papa from 'papaparse'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
3
|
+
export function unparseCSV(
|
|
4
|
+
arr: Record<string, any>[],
|
|
5
|
+
delimiter: string
|
|
6
|
+
): string {
|
|
7
|
+
return Papa.unparse(arr, {
|
|
8
|
+
quotes: false, //or array of booleans
|
|
9
|
+
quoteChar: '"',
|
|
10
|
+
escapeChar: '"',
|
|
11
|
+
delimiter,
|
|
12
|
+
header: true,
|
|
13
|
+
newline: '\r\n',
|
|
14
|
+
skipEmptyLines: false, //other option is 'greedy', meaning skip delimiters, quotes, and whitespace.
|
|
15
|
+
})
|
|
16
|
+
}
|
|
@@ -5,7 +5,6 @@ import dialogForm from './custom/dialogForm.vue'
|
|
|
5
5
|
import dialogBtn from './custom/dialogBtn.vue'
|
|
6
6
|
import dialogFile from './custom/dialogFile.vue'
|
|
7
7
|
import { throwError } from './basic'
|
|
8
|
-
import { getLabelFunc } from './tool'
|
|
9
8
|
|
|
10
9
|
type Predicate<T> = (_: T) => boolean
|
|
11
10
|
type Mapper<T, S> = (_: T) => S
|
|
@@ -56,13 +55,13 @@ export async function askBtn<T>(
|
|
|
56
55
|
title: string,
|
|
57
56
|
message: string = '',
|
|
58
57
|
items: T[],
|
|
59
|
-
label
|
|
58
|
+
label: (string & keyof T) | Mapper<T, string> = $ => String($)
|
|
60
59
|
): Promise<T> {
|
|
61
60
|
return await base(dialogBtn, {
|
|
62
61
|
title,
|
|
63
62
|
message,
|
|
64
63
|
items,
|
|
65
|
-
labelFunc:
|
|
64
|
+
labelFunc: ($: any) => $.pipe(label),
|
|
66
65
|
cancel: true,
|
|
67
66
|
})
|
|
68
67
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Dialog, QDialogOptions } from 'quasar'
|
|
2
|
-
import { getLabelFunc } from './tool'
|
|
3
2
|
|
|
4
3
|
type Predicate<T> = (_: T) => boolean
|
|
5
4
|
type Mapper<T, S> = (_: T) => S
|
|
@@ -141,9 +140,9 @@ export async function askRadio<T>(
|
|
|
141
140
|
title: string,
|
|
142
141
|
message: string = '',
|
|
143
142
|
items: T[],
|
|
144
|
-
label
|
|
143
|
+
label: (string & keyof T) | Mapper<T, string> = $ => String($)
|
|
145
144
|
): Promise<T> {
|
|
146
|
-
let labelFunc =
|
|
145
|
+
let labelFunc = ($: any) => $.pipe(label)
|
|
147
146
|
let values = items.map(labelFunc)
|
|
148
147
|
|
|
149
148
|
let value = await base({
|
|
@@ -152,10 +151,7 @@ export async function askRadio<T>(
|
|
|
152
151
|
options: {
|
|
153
152
|
model: '',
|
|
154
153
|
type: 'radio',
|
|
155
|
-
items:
|
|
156
|
-
label: labelFunc($),
|
|
157
|
-
value: labelFunc($),
|
|
158
|
-
})),
|
|
154
|
+
items: values.map($ => ({ label: $, value: $ })),
|
|
159
155
|
isValid: $ => typeof $ === 'string' && values.includes($),
|
|
160
156
|
},
|
|
161
157
|
})
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
type Labeler<T> = (string & keyof T) | ((_: T) => string)
|
|
1
|
+
// type Labeler<T> = (string & keyof T) | ((_: T) => string)
|
|
2
2
|
|
|
3
|
-
export function getLabelFunc<T>(labeler?: Labeler<T>) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
3
|
+
// export function getLabelFunc<T>(labeler?: Labeler<T>) {
|
|
4
|
+
// if (typeof labeler === 'string') {
|
|
5
|
+
// return ($: T) => String($[labeler])
|
|
6
|
+
// }
|
|
7
|
+
// if (typeof labeler === 'function') {
|
|
8
|
+
// return labeler
|
|
9
|
+
// }
|
|
10
|
+
// return ($: T) => String($)
|
|
11
|
+
// }
|