@d-mok/quasar-app-extension-quasar-axe 2.1.78 → 2.1.80

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.1.78",
3
+ "version": "2.1.80",
4
4
  "description": "A Quasar App Extension",
5
5
  "author": "d-mok <49301824+d-mok@users.noreply.github.com>",
6
6
  "license": "MIT",
@@ -27,7 +27,7 @@
27
27
  "lodash": "^4.17.21",
28
28
  "mime-types": "^2.1.35",
29
29
  "papaparse": "^5.4.1",
30
- "sapphire-js": "^2.0.32",
30
+ "sapphire-js": "^2.1.3",
31
31
  "sortablejs": "^1.15.0",
32
32
  "vuedraggable": "^4.1.0"
33
33
  },
@@ -2,6 +2,7 @@
2
2
  <q-btn v-bind="$attrs">
3
3
  <q-tooltip
4
4
  class="text-body1"
5
+ style="white-space: break-spaces"
5
6
  v-if="tooltip"
6
7
  :delay="150"
7
8
  >{{ tooltip }}</q-tooltip
@@ -8,6 +8,7 @@
8
8
 
9
9
  <script lang="ts" setup generic="T extends Object">
10
10
  import { computed } from 'vue'
11
+ import { getLabelFunc } from '../../../utils/tool'
11
12
 
12
13
  const modelValue = defineModel<T>()
13
14
 
@@ -18,7 +19,7 @@ const { options, optionLabel } = defineProps<{
18
19
 
19
20
  let opts = computed(() =>
20
21
  options.map($ => ({
21
- label: String($.pipe(optionLabel ?? ($ => String($)))),
22
+ label: getLabelFunc(optionLabel)($),
22
23
  value: $,
23
24
  }))
24
25
  )
@@ -8,6 +8,7 @@
8
8
 
9
9
  <script lang="ts" setup generic="T extends Object">
10
10
  import { computed } from 'vue'
11
+ import { getLabelFunc } from '../../../utils/tool'
11
12
 
12
13
  let modelValue = defineModel<T>()
13
14
 
@@ -18,7 +19,7 @@ const { options, optionLabel } = defineProps<{
18
19
 
19
20
  let opts = computed(() =>
20
21
  options.map($ => ({
21
- label: String($.pipe(optionLabel ?? ($ => String($)))),
22
+ label: getLabelFunc(optionLabel)($),
22
23
  value: $,
23
24
  }))
24
25
  )
@@ -22,9 +22,7 @@
22
22
  <tr style="cursor: move">
23
23
  <td>{{ index + 1 }}</td>
24
24
  <td>
25
- <b>{{
26
- element.pipe(label ?? (($: any) => String($)))
27
- }}</b>
25
+ <b>{{ labeler(element) }}</b>
28
26
  </td>
29
27
  </tr>
30
28
  </template>
@@ -34,6 +32,7 @@
34
32
 
35
33
  <script lang="ts" setup generic="T extends Object">
36
34
  import draggable from 'vuedraggable'
35
+ import { getLabelFunc } from '../../../utils/tool'
37
36
 
38
37
  let modelValue = defineModel<T[]>()
39
38
 
@@ -50,6 +49,10 @@ const {
50
49
  function identity($: any) {
51
50
  return $
52
51
  }
52
+
53
+ function labeler(v: any) {
54
+ return getLabelFunc(label)(v)
55
+ }
53
56
  </script>
54
57
 
55
58
  <style scoped>
@@ -5,6 +5,7 @@ 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 '../../utils/tool'
8
9
 
9
10
  type Predicate<T> = (_: T) => boolean
10
11
  type Mapper<T, S> = (_: T) => S
@@ -61,7 +62,7 @@ export async function askBtn<T>(
61
62
  title,
62
63
  message,
63
64
  items,
64
- labelFunc: ($: any) => $.pipe(label),
65
+ labelFunc: ($: any) => getLabelFunc(label)($),
65
66
  cancel: true,
66
67
  })
67
68
  }
@@ -1,4 +1,5 @@
1
1
  import { Dialog, QDialogOptions } from 'quasar'
2
+ import { getLabelFunc } from '../tool'
2
3
 
3
4
  type Predicate<T> = (_: T) => boolean
4
5
  type Mapper<T, S> = (_: T) => S
@@ -142,7 +143,7 @@ export async function askRadio<T>(
142
143
  items: T[],
143
144
  label: (string & keyof T) | Mapper<T, string> = $ => String($)
144
145
  ): Promise<T> {
145
- let labelFunc = ($: any) => $.pipe(label)
146
+ let labelFunc = ($: any) => getLabelFunc(label)($)
146
147
  let values = items.map(labelFunc)
147
148
 
148
149
  let value = await base({
@@ -0,0 +1,11 @@
1
+ type Labeler<T> = (string & keyof T) | ((_: T) => string)
2
+
3
+ export function getLabelFunc<T>(labeler: Labeler<T> | undefined) {
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
+ }
@@ -1,11 +0,0 @@
1
- // type Labeler<T> = (string & keyof T) | ((_: T) => string)
2
-
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
- // }