@d-mok/quasar-app-extension-quasar-axe 2.0.21 → 2.0.23

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": "2.0.21",
3
+ "version": "2.0.23",
4
4
  "description": "A Quasar App Extension",
5
5
  "author": "d-mok <49301824+d-mok@users.noreply.github.com>",
6
6
  "license": "MIT",
@@ -7,7 +7,7 @@
7
7
  </template>
8
8
 
9
9
  <script lang="ts" setup>
10
- import { computed } from '@vue/reactivity'
10
+ import { computed } from 'vue'
11
11
  import { useVModel } from '@vueuse/core'
12
12
 
13
13
  const props = withDefaults(
@@ -4,6 +4,7 @@
4
4
  use-input
5
5
  hide-selected
6
6
  fill-input
7
+ hide-dropdown-icon
7
8
  input-debounce="0"
8
9
  :options="options"
9
10
  @filter="filterFn"
@@ -1,9 +1,21 @@
1
+ import Papa from 'papaparse'
2
+
1
3
  export function unparseCSV(arr: Record<string, any>[]): string {
2
- let fields = Object.keys(arr[0])
3
- let csv = fields.join(',') + '\n'
4
- for (let obj of arr) {
5
- let line = fields.map(f => String(obj[f])).join(',')
6
- csv += line + '\n'
7
- }
8
- return csv
4
+ return Papa.unparse(arr, {
5
+ quotes: false, //or array of booleans
6
+ quoteChar: '"',
7
+ escapeChar: '"',
8
+ delimiter: '\t',
9
+ header: true,
10
+ newline: '\r\n',
11
+ skipEmptyLines: false, //other option is 'greedy', meaning skip delimiters, quotes, and whitespace.
12
+ })
13
+
14
+ // let fields = Object.keys(arr[0])
15
+ // let csv = fields.join(delimiter) + '\n'
16
+ // for (let obj of arr) {
17
+ // let line = fields.map(f => String(obj[f])).join(delimiter)
18
+ // csv += line + '\n'
19
+ // }
20
+ // return csv
9
21
  }
@@ -30,6 +30,11 @@
30
30
  </q-card-section>
31
31
 
32
32
  <q-card-actions align="right">
33
+ <q-btn
34
+ label="Copy"
35
+ flat
36
+ @click="copy"
37
+ />
33
38
  <q-btn
34
39
  v-if="cancel"
35
40
  label="Cancel"
@@ -52,6 +57,8 @@ import handson from './handson.vue'
52
57
  import { useDialogPluginComponent } from 'quasar'
53
58
  import { ref } from 'vue'
54
59
  import { toSchema, isMatchSchema, isPrimitive, clone } from './schema'
60
+ import { unparseCSV } from '../../csv'
61
+ import { copyToClipboard } from 'quasar'
55
62
 
56
63
  defineEmits([...useDialogPluginComponent.emits])
57
64
 
@@ -106,4 +113,11 @@ function isBlank(row: row): boolean {
106
113
  function filterBlank(rows: row[]): row[] {
107
114
  return rows.filter($ => !isBlank($))
108
115
  }
116
+
117
+ // copy to clipboard
118
+
119
+ function copy() {
120
+ let csv = unparseCSV(dummy.value)
121
+ copyToClipboard(csv)
122
+ }
109
123
  </script>