@ramathibodi/nuxt-commons 0.1.19 → 0.1.21
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/dist/module.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import {VAutocomplete} from 'vuetify/components/VAutocomplete'
|
|
3
|
-
import {concat, isEmpty,sortBy} from 'lodash-es'
|
|
3
|
+
import {concat, isEmpty, sortBy} from 'lodash-es'
|
|
4
4
|
import {computed, ref, watch} from 'vue'
|
|
5
5
|
import {watchDebounced} from '@vueuse/core'
|
|
6
6
|
import {useFuzzy} from '../../composables/utils/fuzzy'
|
|
@@ -17,6 +17,7 @@ interface Props extends /* @vue-ignore */ InstanceType<typeof VAutocomplete['$pr
|
|
|
17
17
|
waitForFilterText?: string
|
|
18
18
|
modelValue?: string
|
|
19
19
|
sortBy?: 'itemCode' | 'itemValue'
|
|
20
|
+
showCode?: boolean
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
const props = withDefaults(defineProps<Props>(), {
|
|
@@ -24,7 +25,8 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
24
25
|
noDataText: 'ไม่พบข้อมูล',
|
|
25
26
|
lang: 'TH',
|
|
26
27
|
waitForFilter: false,
|
|
27
|
-
sortBy: 'itemValue'
|
|
28
|
+
sortBy: 'itemValue',
|
|
29
|
+
showCode: false
|
|
28
30
|
})
|
|
29
31
|
|
|
30
32
|
const emit = defineEmits(['update:modelValue'])
|
|
@@ -125,7 +127,7 @@ const computedSortBy = computed(()=>{
|
|
|
125
127
|
})
|
|
126
128
|
|
|
127
129
|
const computedItems = computed(()=>{
|
|
128
|
-
if (
|
|
130
|
+
if (props.fuzzy && !isEmpty(searchData.value)) {
|
|
129
131
|
return items.value
|
|
130
132
|
} else {
|
|
131
133
|
return sortBy(items.value, computedSortBy.value)
|
|
@@ -163,7 +165,7 @@ const computedItems = computed(()=>{
|
|
|
163
165
|
>
|
|
164
166
|
<v-list-item
|
|
165
167
|
v-bind="props"
|
|
166
|
-
:title="item.title || item.raw.itemValue || item.raw.itemCode"
|
|
168
|
+
:title="(showCode ? item.raw.itemCode+'-' : '')+(item.title || item.raw.itemValue || item.raw.itemCode)"
|
|
167
169
|
/>
|
|
168
170
|
</template>
|
|
169
171
|
<template
|
package/package.json
CHANGED
|
@@ -110,7 +110,7 @@ module.exports = {
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
function createGraphQLOperation${'<' + 'T,U>'}(operationType: "Query" | "Mutation",name: string,variables?: graphqlVariable[],fields?: graphqlTypeObject): graphqlOperationObject${'<' + 'T,U>'} {
|
|
113
|
-
let returnGraphqlOperation = {
|
|
113
|
+
let returnGraphqlOperation : ${'Record' + '<string,any>'} = {
|
|
114
114
|
operationType,
|
|
115
115
|
name,
|
|
116
116
|
variables,
|
|
@@ -125,7 +125,7 @@ module.exports = {
|
|
|
125
125
|
return operationCall(operationType,name, fields, variables,cache);
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
-
return returnGraphqlOperation
|
|
128
|
+
return returnGraphqlOperation as graphqlOperationObject${'<' + 'T,U>'}
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
interface graphqlTypeObjects extends ${'Record<string,' + 'graphqlTypeObject>'} {
|