@mythpe/quasar-ui-qui 0.1.58 → 0.1.59
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
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
import type { MDatatableProps } from '../../types'
|
|
14
14
|
import type { InvalidSubmissionHandler, SubmissionHandler } from 'vee-validate'
|
|
15
15
|
import { useForm } from 'vee-validate'
|
|
16
|
-
import {
|
|
16
|
+
import { onMounted, ref, toValue, watch } from 'vue'
|
|
17
17
|
import { is as quasarHelpers, QCardSection, QTable, useQuasar } from 'quasar'
|
|
18
18
|
import lodash from 'lodash'
|
|
19
19
|
import { useDtHelpers, useMyth } from '../../composable'
|
|
@@ -237,6 +237,7 @@ const {
|
|
|
237
237
|
deleteSelectionItem,
|
|
238
238
|
logoutDatatable,
|
|
239
239
|
contextmenuItems,
|
|
240
|
+
activeContextItems,
|
|
240
241
|
datatableItemsScope,
|
|
241
242
|
onCloneItem,
|
|
242
243
|
imageDialog,
|
|
@@ -380,9 +381,6 @@ watch(formDialogModel, (v) => {
|
|
|
380
381
|
dialogErrors.value = {}
|
|
381
382
|
}
|
|
382
383
|
})
|
|
383
|
-
const activeContextItems = computed(() => {
|
|
384
|
-
return contextmenuItems.value.filter((e, i) => typeof e.showIf === 'function' ? e.showIf(e, i) : e.showIf !== !1) as Required<MDatatableProps['contextItems']> || []
|
|
385
|
-
})
|
|
386
384
|
const table = ref<InstanceType<typeof QTable>>()
|
|
387
385
|
defineOptions({
|
|
388
386
|
name: 'MDatatable',
|
|
@@ -670,8 +668,8 @@ defineExpose({
|
|
|
670
668
|
</div>
|
|
671
669
|
<div class="col">
|
|
672
670
|
<div
|
|
673
|
-
class="text-h5 bordered-bottom ellipsis"
|
|
674
671
|
v-if="!!getTableTitle"
|
|
672
|
+
class="text-h5 bordered-bottom ellipsis"
|
|
675
673
|
>
|
|
676
674
|
{{ getTableTitle }}
|
|
677
675
|
</div>
|
|
@@ -7,7 +7,8 @@ import type {
|
|
|
7
7
|
MDatatableMetaServer,
|
|
8
8
|
MDatatableOptions,
|
|
9
9
|
MDatatablePagination,
|
|
10
|
-
MDatatableProps,
|
|
10
|
+
MDatatableProps,
|
|
11
|
+
MDatatableScope,
|
|
11
12
|
MDtExportOptions,
|
|
12
13
|
MDtHeadersParameter,
|
|
13
14
|
MDtItem,
|
|
@@ -102,8 +103,13 @@ export const useDtHelpers = (options: MaybeRefOrGetter<MDatatableProps>) => {
|
|
|
102
103
|
dialogErrors.value = {}
|
|
103
104
|
}
|
|
104
105
|
|
|
105
|
-
const getHeaders = computed<any[]>(() =>
|
|
106
|
-
{ noSort: props.imageColumns }) || []
|
|
106
|
+
const getHeaders = computed<any[]>(() => {
|
|
107
|
+
const h = parseHeaders(props.headers as MDtHeadersParameter, { noSort: props.imageColumns }) || []
|
|
108
|
+
if (!activeContextItems.value.length) {
|
|
109
|
+
return h.filter(e => e.name !== props.controlKey)
|
|
110
|
+
}
|
|
111
|
+
return h
|
|
112
|
+
})
|
|
107
113
|
const visibleHeaders = ref<string[]>([])
|
|
108
114
|
|
|
109
115
|
const contextmenu = ref(!1)
|
|
@@ -253,10 +259,7 @@ export const useDtHelpers = (options: MaybeRefOrGetter<MDatatableProps>) => {
|
|
|
253
259
|
}
|
|
254
260
|
return v.join(',') ?? null
|
|
255
261
|
}
|
|
256
|
-
const getDatatableParams = ({
|
|
257
|
-
pagination,
|
|
258
|
-
filter
|
|
259
|
-
}: FetchRowsArgs = {}, merge: Partial<ApiServiceParams> = {}): ApiServiceParams => {
|
|
262
|
+
const getDatatableParams = ({ pagination, filter }: FetchRowsArgs = {}, merge: Partial<ApiServiceParams> = {}): ApiServiceParams => {
|
|
260
263
|
const headerItems = getHeaders.value.map((e: any) => e.name).join(',')
|
|
261
264
|
// console.log(headerItems)
|
|
262
265
|
let params: ApiServiceParams = {
|
|
@@ -745,6 +748,7 @@ export const useDtHelpers = (options: MaybeRefOrGetter<MDatatableProps>) => {
|
|
|
745
748
|
},
|
|
746
749
|
...(props.contextItems || [])
|
|
747
750
|
].sort((a, b) => (a.order ?? 0) - (b.order ?? 0))))
|
|
751
|
+
const activeContextItems = computed(() => contextmenuItems.value.filter((e, i) => typeof e.showIf === 'function' ? e.showIf(e, i) : e.showIf !== !1) as Required<MDatatableProps['contextItems']> || [])
|
|
748
752
|
const onCloneItem = (item: MDtItem) => {
|
|
749
753
|
item = toValue(item)
|
|
750
754
|
confirmMessage()
|
|
@@ -824,6 +828,9 @@ export const useDtHelpers = (options: MaybeRefOrGetter<MDatatableProps>) => {
|
|
|
824
828
|
if (props.hideSelection) {
|
|
825
829
|
return !1
|
|
826
830
|
}
|
|
831
|
+
if (!activeContextItems.value.length && !props.pdf && !props.excel) {
|
|
832
|
+
return !1
|
|
833
|
+
}
|
|
827
834
|
return props.showSelection
|
|
828
835
|
})
|
|
829
836
|
const defaultTopBtnProps: any = {
|
|
@@ -937,6 +944,7 @@ export const useDtHelpers = (options: MaybeRefOrGetter<MDatatableProps>) => {
|
|
|
937
944
|
deleteSelectionItem,
|
|
938
945
|
logoutDatatable,
|
|
939
946
|
contextmenuItems,
|
|
947
|
+
activeContextItems,
|
|
940
948
|
datatableItemsScope,
|
|
941
949
|
onCloneItem,
|
|
942
950
|
openImageDialog,
|