@d-mok/quasar-app-extension-quasar-axe 1.0.77 → 1.0.78
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 +1 -1
- package/src/utils/dialog.ts +10 -9
package/package.json
CHANGED
package/src/utils/dialog.ts
CHANGED
|
@@ -63,6 +63,10 @@ function extractObj<T extends object>(
|
|
|
63
63
|
return obj
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
function maxStringLength(strings: string[]): number {
|
|
67
|
+
return Math.max(0, ...strings.map($ => $.length))
|
|
68
|
+
}
|
|
69
|
+
|
|
66
70
|
class QDialog {
|
|
67
71
|
/**
|
|
68
72
|
* The basic dialog. If cancel, throw error.
|
|
@@ -112,15 +116,12 @@ class QDialog {
|
|
|
112
116
|
options: QDialogOptions,
|
|
113
117
|
sample: object[]
|
|
114
118
|
): Promise<string> {
|
|
115
|
-
let
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
let
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
.split('\n')
|
|
122
|
-
.map($ => $.replace('\t', ' '.repeat(maxWordLength + 2)))
|
|
123
|
-
let maxLineLength = Math.max(0, ...lines.map($ => $.length))
|
|
119
|
+
let lines = unparseCSV(sample).split('\n')
|
|
120
|
+
let words = lines.flatMap(l => l.split('\t'))
|
|
121
|
+
let maxWordLength = maxStringLength(words)
|
|
122
|
+
let maxLineLength = maxStringLength(
|
|
123
|
+
lines.map($ => $.replace('\t', ' '.repeat(maxWordLength + 2)))
|
|
124
|
+
)
|
|
124
125
|
|
|
125
126
|
let { prompt, ...rest } = options
|
|
126
127
|
let csv = await this.baseDialog({
|