@dt-frames/ui 1.0.4 → 1.0.7
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/es/assets/imgs/header/avatar.png +0 -0
- package/es/components/curd/src/components/dialog.d.ts +22 -58
- package/es/components/curd/src/types/curd.type.d.ts +2 -1
- package/es/components/dialog/index.d.ts +2 -0
- package/es/components/dialog/src/hooks/useDialog.d.ts +3 -0
- package/es/components/forms/index.d.ts +2 -2
- package/es/components/forms/src/components/formIcon.d.ts +7 -48
- package/es/components/forms/src/index.d.ts +2 -6
- package/es/components/icons/src/pick-icon.d.ts +1 -0
- package/es/components/index.d.ts +2 -1
- package/es/components/modal/src/components/close-icon.d.ts +0 -43
- package/es/components/modal/src/components/modal-wrap.d.ts +1 -0
- package/es/components/modal/src/index.d.ts +1 -43
- package/es/components/modal/src/types/modal.type.d.ts +3 -3
- package/es/components/source/src/hooks/useSource.d.ts +10 -0
- package/es/components/source/src/types/source.type.d.ts +10 -1
- package/es/components/source/src/types/table.type.d.ts +1 -1
- package/es/components/table/index.d.ts +1 -1
- package/es/components/table/src/components/TableActions.d.ts +2 -2
- package/es/components/table/src/components/setting/Column.d.ts +7 -6
- package/es/components/table/src/components/setting/Download.d.ts +2 -2
- package/es/components/table/src/components/setting/Size.d.ts +2 -2
- package/es/components/table/src/hooks/useColumns.d.ts +1 -1
- package/es/components/table/src/hooks/useDataSource.d.ts +1 -3
- package/es/components/table/src/hooks/useHeaderCode.d.ts +3 -0
- package/es/components/table/src/hooks/useRowSelection.d.ts +2 -3
- package/es/components/table/src/index.d.ts +35 -20
- package/es/components/table/src/props.d.ts +10 -3
- package/es/components/table/src/types/table.type.d.ts +2 -2
- package/es/index.js +1315 -901
- package/es/style/components/icons/index.less +6 -1
- package/es/style/components/modal/index.less +0 -3
- package/es/style/components/table/index.less +12 -1
- package/es/style/theme/header/index.less +8 -4
- package/es/theme/header/components/logo.d.ts +43 -0
- package/es/theme/sider/components/basic-menu/basic-menu.d.ts +3 -3
- package/es/theme/tabs/components/TabContent.d.ts +2 -2
- package/package.json +6 -3
- package/src/assets/imgs/header/avatar.png +0 -0
- package/src/components/curd/src/components/dialog.vue +11 -5
- package/src/components/curd/src/hooks/useCurd.tsx +24 -9
- package/src/components/curd/src/types/curd.type.ts +3 -1
- package/src/components/dialog/index.ts +5 -0
- package/src/components/dialog/src/hooks/useDialog.ts +85 -0
- package/src/components/forms/index.ts +3 -4
- package/src/components/forms/src/components/formIcon.vue +3 -2
- package/src/components/forms/src/index.vue +14 -10
- package/src/components/icons/index.less +6 -1
- package/src/components/icons/src/pick-icon.vue +3 -1
- package/src/components/iframe/src/index.less +3 -0
- package/src/components/index.ts +3 -1
- package/src/components/modal/index.less +0 -3
- package/src/components/modal/src/components/close-icon.vue +3 -4
- package/src/components/modal/src/components/modal-wrap.vue +49 -39
- package/src/components/modal/src/components/modal.tsx +2 -2
- package/src/components/modal/src/components/modalFooter.vue +1 -1
- package/src/components/modal/src/hooks/useFullScreen.ts +3 -1
- package/src/components/modal/src/hooks/useModal.ts +23 -8
- package/src/components/modal/src/index.vue +1 -1
- package/src/components/modal/src/types/modal.type.ts +3 -3
- package/src/components/source/src/hooks/useFetch.ts +3 -4
- package/src/components/source/src/hooks/useSource.ts +21 -6
- package/src/components/source/src/types/source.type.ts +11 -1
- package/src/components/source/src/types/table.type.ts +1 -1
- package/src/components/table/index.less +12 -1
- package/src/components/table/index.ts +1 -1
- package/src/components/table/src/components/TableActions.vue +2 -2
- package/src/components/table/src/components/TableHeader.vue +1 -0
- package/src/components/table/src/components/TableRender.vue +8 -6
- package/src/components/table/src/components/setting/Column.vue +1 -2
- package/src/components/table/src/components/setting/Fullscreen.vue +1 -1
- package/src/components/table/src/components/setting/index.vue +2 -2
- package/src/components/table/src/hooks/useColumns.ts +2 -2
- package/src/components/table/src/hooks/useDataSource.ts +24 -13
- package/src/components/table/src/hooks/useHeaderCode.ts +89 -0
- package/src/components/table/src/hooks/useRowSelection.ts +2 -3
- package/src/components/table/src/hooks/useTable.ts +15 -2
- package/src/components/table/src/hooks/useTableHeader.ts +2 -2
- package/src/components/table/src/hooks/useTableScroll.ts +5 -3
- package/src/components/table/src/index.vue +18 -21
- package/src/components/table/src/props.ts +9 -4
- package/src/components/table/src/types/table.type.ts +2 -2
- package/src/theme/header/components/logo.vue +4 -2
- package/src/theme/header/components/user-info.vue +21 -4
- package/src/theme/header/index.less +8 -4
- package/es/index.css +0 -1
- package/es/style/components/forms/src/index.less +0 -82
- package/es/style/components/icons/src/index.less +0 -96
- package/es/style/components/modal/src/index.less +0 -60
- package/es/style/components/table/src/index.less +0 -162
- package/es/theme/header/components/user-info.d.ts +0 -452
|
@@ -44,8 +44,7 @@
|
|
|
44
44
|
emits('ext-height', modalHeaderHeight + modalFooterHeight);
|
|
45
45
|
});
|
|
46
46
|
|
|
47
|
-
async function
|
|
48
|
-
if (!props.visible) return;
|
|
47
|
+
async function getModalDom() {
|
|
49
48
|
const wrapperRefDom = unref(wrapperRef);
|
|
50
49
|
if (!wrapperRefDom) return;
|
|
51
50
|
|
|
@@ -54,45 +53,56 @@
|
|
|
54
53
|
bodyDom.style.padding = '0';
|
|
55
54
|
await nextTick();
|
|
56
55
|
|
|
56
|
+
const modalDom = bodyDom.parentElement && bodyDom.parentElement.parentElement;
|
|
57
|
+
|
|
58
|
+
return modalDom
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async function setModalHeight() {
|
|
62
|
+
if (!props.visible) return;
|
|
63
|
+
|
|
57
64
|
try {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
65
|
+
const modalDom = await getModalDom()
|
|
66
|
+
if (!modalDom) return;
|
|
67
|
+
|
|
68
|
+
const modalRect = getComputedStyle(modalDom as Element).top;
|
|
69
|
+
const modalTop = Number.parseInt(modalRect);
|
|
70
|
+
|
|
71
|
+
let maxHeight =
|
|
72
|
+
window.innerHeight -
|
|
73
|
+
(props.footerOffset! || 0) -
|
|
74
|
+
props.modalFooterHeight -
|
|
75
|
+
props.modalHeaderHeight
|
|
76
|
+
- 100;
|
|
77
|
+
|
|
78
|
+
// 距离顶部过进会出现滚动条
|
|
79
|
+
if (modalTop < 40) {
|
|
80
|
+
maxHeight -= 26;
|
|
81
|
+
}
|
|
82
|
+
await nextTick();
|
|
83
|
+
const spinEl = unref(spinRef);
|
|
84
|
+
|
|
85
|
+
if (!spinEl) return;
|
|
86
|
+
await nextTick();
|
|
87
|
+
realHeight = spinEl.scrollHeight;
|
|
88
|
+
|
|
89
|
+
if (props.fullScreen) {
|
|
90
|
+
realHeightRef.value =
|
|
91
|
+
window.innerHeight - props.modalFooterHeight - props.modalHeaderHeight;
|
|
92
|
+
} else {
|
|
93
|
+
realHeightRef.value = props.height
|
|
94
|
+
? props.height
|
|
95
|
+
: realHeight > maxHeight
|
|
96
|
+
? maxHeight
|
|
97
|
+
: realHeight;
|
|
98
|
+
}
|
|
99
|
+
emits('height-change', unref(realHeightRef));
|
|
100
|
+
|
|
101
|
+
const _modalDom = await getModalDom()
|
|
102
|
+
_modalDom.style.top = (window.innerHeight - _modalDom.offsetHeight) / 2 + 'px'
|
|
103
|
+
|
|
94
104
|
} catch (error) {
|
|
95
|
-
|
|
105
|
+
console.log(error);
|
|
96
106
|
}
|
|
97
107
|
|
|
98
108
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent,
|
|
1
|
+
import { defineComponent, toRefs, unref } from "vue";
|
|
2
2
|
import { Modal } from 'ant-design-vue';
|
|
3
3
|
import { useAttrs, useSlots } from '@dt-frames/core';
|
|
4
4
|
import { basicProps } from '../props';
|
|
@@ -23,7 +23,7 @@ export default defineComponent({
|
|
|
23
23
|
const { extendSlots } = useSlots();
|
|
24
24
|
|
|
25
25
|
return () => {
|
|
26
|
-
const propsData = { ...unref(attrs), ...props } as any;
|
|
26
|
+
const propsData = { ...unref(attrs), ...props, destroyOnClose: true } as any;
|
|
27
27
|
return <Modal {...propsData}>{extendSlots(slots as any)}</Modal>;
|
|
28
28
|
};
|
|
29
29
|
}
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
})
|
|
24
24
|
|
|
25
25
|
const buttonActions: ButtonProps[] = [
|
|
26
|
-
{ name: '保存', preIcon: 'mdi:content-save', type: 'primary', flag: 'OK'
|
|
26
|
+
{ name: '保存', preIcon: 'mdi:content-save', type: 'primary', flag: 'OK' },
|
|
27
27
|
{ name: '关闭', preIcon: 'mdi:close', flag: 'CANCEL' },
|
|
28
28
|
]
|
|
29
29
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { ref, Ref, unref, computed } from "vue"
|
|
1
|
+
import { ref, Ref, unref, computed } from "vue"
|
|
2
|
+
import { dispatchResize } from '@dt-frames/core'
|
|
2
3
|
|
|
3
4
|
interface FullScreenOptions{
|
|
4
5
|
wrapClassName: Ref<string | undefined>;
|
|
@@ -17,6 +18,7 @@ export function useFullScreen(options: FullScreenOptions) {
|
|
|
17
18
|
function toggleFullScreen(e: Event) {
|
|
18
19
|
e && e.stopPropagation();
|
|
19
20
|
fullScreenRef.value = !unref(fullScreenRef);
|
|
21
|
+
dispatchResize()
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
return {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { error, isFunction, Nullable } from "@dt-frames/core";
|
|
1
|
+
import { error, isFunction, Nullable, Recordable } from "@dt-frames/core";
|
|
2
2
|
import { ModalProps } from "@dt-frames/core"
|
|
3
3
|
import { isEqual } from 'lodash-es'
|
|
4
4
|
import { tryOnUnmounted } from '@vueuse/core'
|
|
5
|
-
import { basicProps } from '../props'
|
|
6
5
|
import { ModalMethods, ReturnInnerMethods, ReturnMethods, UseModalInnerReturnType, UseModalReturnType } from '../types/modal.type';
|
|
7
|
-
import { computed,
|
|
6
|
+
import { computed, getCurrentInstance, nextTick, onUnmounted, reactive, ref, toRaw, unref, watch, watchEffect } from "vue";
|
|
8
7
|
|
|
9
8
|
const dataTransfer = reactive<any>({})
|
|
9
|
+
const cbTransfer = reactive<any>({})
|
|
10
10
|
const visibleData = reactive<{ [key: number]: boolean }>({})
|
|
11
11
|
|
|
12
12
|
export function useModalOut(): UseModalReturnType{
|
|
@@ -25,6 +25,7 @@ export function useModalOut(): UseModalReturnType{
|
|
|
25
25
|
modal.value = null
|
|
26
26
|
loaded.value = false
|
|
27
27
|
dataTransfer[unref(uid)] = null
|
|
28
|
+
cbTransfer[unref(uid)] = (rsp?: Recordable) => { }
|
|
28
29
|
})
|
|
29
30
|
|
|
30
31
|
if( unref(loaded) && modalMethod === unref(modal) ) return
|
|
@@ -60,18 +61,28 @@ export function useModalOut(): UseModalReturnType{
|
|
|
60
61
|
getInstance()?.redoModalHeight?.()
|
|
61
62
|
},
|
|
62
63
|
|
|
63
|
-
openModal:
|
|
64
|
+
openModal: (params?: Recordable, openOnSet = true) => {
|
|
64
65
|
getInstance()?.setModalProps({
|
|
65
|
-
visible:
|
|
66
|
+
visible: true
|
|
66
67
|
})
|
|
67
68
|
|
|
68
|
-
|
|
69
|
+
const { data, afterClose } = params || {}
|
|
69
70
|
|
|
70
71
|
const id = unref(uid)
|
|
71
72
|
|
|
73
|
+
// 设置回调
|
|
74
|
+
cbTransfer[unref(uid)] = (rsp?: Recordable) => {
|
|
75
|
+
if( afterClose && isFunction(afterClose)) {
|
|
76
|
+
afterClose(rsp)
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if( !data ) return
|
|
81
|
+
|
|
72
82
|
if( openOnSet ) {
|
|
73
83
|
dataTransfer[id] = toRaw(data);
|
|
74
|
-
|
|
84
|
+
|
|
85
|
+
return
|
|
75
86
|
}
|
|
76
87
|
|
|
77
88
|
const equal = isEqual(toRaw(dataTransfer[id]), toRaw(data))
|
|
@@ -140,8 +151,12 @@ export function useModal(props?: Partial<ModalProps>,callbackFn?: Function): Use
|
|
|
140
151
|
changeLoading: (loading = true) => {
|
|
141
152
|
getInstance()?.setModalProps({ loading })
|
|
142
153
|
},
|
|
154
|
+
|
|
143
155
|
getVisible: computed(() => visibleData[~~unref(uidRef)]),
|
|
144
|
-
|
|
156
|
+
|
|
157
|
+
// 关闭弹框进行回调
|
|
158
|
+
closeModal: (rsp: Recordable) => {
|
|
159
|
+
cbTransfer[unref(uidRef)](rsp)
|
|
145
160
|
getInstance()?.setModalProps({ visible: false });
|
|
146
161
|
},
|
|
147
162
|
openModal: <T = any>(visable = true, data?: T, openOnSet = true) => {
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
const { getWrapClassName, toggleFullScreen, fullScreenRef } = useFullScreen({
|
|
83
|
-
wrapClassName: computed(() =>
|
|
83
|
+
wrapClassName: computed(() => (unref(propsRef) as any).wrapClassName),
|
|
84
84
|
extHeightRef,
|
|
85
85
|
modalWrapperRef
|
|
86
86
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ModalProps } from "@dt-frames/core"
|
|
1
|
+
import { ModalProps, Recordable } from "@dt-frames/core"
|
|
2
2
|
import { ComputedRef } from "vue"
|
|
3
3
|
|
|
4
4
|
export type ModalMethods = {
|
|
@@ -8,14 +8,14 @@ export type ModalMethods = {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export interface ReturnMethods extends ModalMethods{
|
|
11
|
-
openModal: <T = any>(
|
|
11
|
+
openModal: <T = any>(data?: T, openOnSet?: boolean) => void
|
|
12
12
|
closeModal: () => void
|
|
13
13
|
getVisible?: ComputedRef<boolean>
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export interface ReturnInnerMethods extends ModalMethods {
|
|
17
17
|
openModal: <T = any>(props?: boolean, data?: T, openOnSet?: boolean) => void
|
|
18
|
-
closeModal: () => void
|
|
18
|
+
closeModal: (rsp: Recordable) => void
|
|
19
19
|
changeLoading: (loading: boolean) => void
|
|
20
20
|
getVisible?: ComputedRef<boolean>
|
|
21
21
|
redoModalHeight: () => void
|
|
@@ -48,13 +48,12 @@ export function useFetch(api: string | ApiType, baseUrl: string = '') {
|
|
|
48
48
|
...header,
|
|
49
49
|
...{ onlyData: false }
|
|
50
50
|
}).then(
|
|
51
|
-
(data: JsonResult) => {
|
|
51
|
+
(data: JsonResult) => {
|
|
52
52
|
if( afterFetch && isFunction(afterFetch) ) {
|
|
53
53
|
data = afterFetch( data )
|
|
54
54
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
55
|
+
|
|
56
|
+
resolve( data?.data )
|
|
58
57
|
},
|
|
59
58
|
(error) => {
|
|
60
59
|
reject( error )
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { BaseDataType, SourceType } from "../types/source.type"
|
|
1
|
+
import { ref, reactive, toRaw, Ref } from 'vue'
|
|
2
|
+
import { isString, Recordable, useMessage } from "@dt-frames/core"
|
|
3
|
+
import { ApiType, BaseDataType, SourceType } from "../types/source.type"
|
|
4
4
|
import { useFetch } from './useFetch'
|
|
5
5
|
import { TableParamsType } from '../types/table.type'
|
|
6
6
|
import { DownloadType } from '../../../table/src/types/tableHeader.type'
|
|
@@ -17,9 +17,13 @@ export function useSource(opt: SourceType) {
|
|
|
17
17
|
const { baseUrl = '', api = {}, exportName = '' } = opt
|
|
18
18
|
const { add, deletes, update, queryById, queryPage } = api
|
|
19
19
|
|
|
20
|
+
const { message } = useMessage()
|
|
21
|
+
const apiFul: Recordable = {}
|
|
22
|
+
|
|
20
23
|
// 定义加载状态
|
|
21
24
|
for( let it in api ) {
|
|
22
25
|
loading['on' + it.slice(0,1).toUpperCase() + it.slice(1).toLowerCase()] = ref(false)
|
|
26
|
+
apiFul[it] = baseUrl + (isString(api[it]) ? api[it] : (api[it] as ApiType).api)
|
|
23
27
|
}
|
|
24
28
|
|
|
25
29
|
// 定义分页数据
|
|
@@ -37,7 +41,7 @@ export function useSource(opt: SourceType) {
|
|
|
37
41
|
pageNo: 0,
|
|
38
42
|
pageSize: 10
|
|
39
43
|
},
|
|
40
|
-
orderDTOs:
|
|
44
|
+
orderDTOs: []
|
|
41
45
|
})
|
|
42
46
|
|
|
43
47
|
|
|
@@ -74,7 +78,8 @@ export function useSource(opt: SourceType) {
|
|
|
74
78
|
pageSize: pagination.pageSize
|
|
75
79
|
}
|
|
76
80
|
|
|
77
|
-
baseData.orderDTOs = sort
|
|
81
|
+
// baseData.orderDTOs = sort.length ?? null
|
|
82
|
+
baseData.orderDTOs = []
|
|
78
83
|
|
|
79
84
|
if( needSearch ) search()
|
|
80
85
|
}
|
|
@@ -90,7 +95,7 @@ export function useSource(opt: SourceType) {
|
|
|
90
95
|
).then( (rsp: any) => {
|
|
91
96
|
const { records, pageDTO } = rsp
|
|
92
97
|
|
|
93
|
-
dataSource.value
|
|
98
|
+
dataSource.value.splice(0, dataSource.value.length, ...records)
|
|
94
99
|
|
|
95
100
|
pagination.value = {
|
|
96
101
|
current: (pageDTO?.pageNo??0) + 1,
|
|
@@ -111,6 +116,7 @@ export function useSource(opt: SourceType) {
|
|
|
111
116
|
const { fetch } = useFetch(add, baseUrl)
|
|
112
117
|
|
|
113
118
|
fetch(model).then( (rsp: any) => {
|
|
119
|
+
message.success('新增成功')
|
|
114
120
|
search()
|
|
115
121
|
} )
|
|
116
122
|
}
|
|
@@ -127,6 +133,7 @@ export function useSource(opt: SourceType) {
|
|
|
127
133
|
function onUpdate(model: Recordable) {
|
|
128
134
|
const { fetch } = useFetch(update, baseUrl)
|
|
129
135
|
fetch(model).then( (rsp: any) => {
|
|
136
|
+
message.success('更新数据成功')
|
|
130
137
|
search()
|
|
131
138
|
} )
|
|
132
139
|
}
|
|
@@ -170,9 +177,17 @@ export function useSource(opt: SourceType) {
|
|
|
170
177
|
|
|
171
178
|
return {
|
|
172
179
|
api,
|
|
180
|
+
apiFul,
|
|
173
181
|
form,
|
|
174
182
|
table,
|
|
175
183
|
curd,
|
|
184
|
+
loading,
|
|
185
|
+
onAdd,
|
|
186
|
+
onQueryById,
|
|
187
|
+
onDeletes,
|
|
188
|
+
onUpdate,
|
|
189
|
+
onTableChange,
|
|
190
|
+
onDownload,
|
|
176
191
|
onSearch
|
|
177
192
|
}
|
|
178
193
|
}
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { Recordable } from "@dt-frames/core"
|
|
2
2
|
|
|
3
|
+
export type PageQueryType = {
|
|
4
|
+
entityDTO: Recordable,
|
|
5
|
+
orderDTOs: Recordable[],
|
|
6
|
+
pageDTO: {
|
|
7
|
+
pageNo: number
|
|
8
|
+
pageSize: number
|
|
9
|
+
[key: string]: any
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
3
13
|
export type ApiType = {
|
|
4
14
|
// api接口
|
|
5
15
|
api: string
|
|
@@ -14,7 +24,7 @@ export type ApiType = {
|
|
|
14
24
|
model?: Recordable
|
|
15
25
|
|
|
16
26
|
// 请求之前
|
|
17
|
-
beforeFetch?: ( params:
|
|
27
|
+
beforeFetch?: <T = any>( params: T ) => T
|
|
18
28
|
|
|
19
29
|
// 请求之后
|
|
20
30
|
afterFetch?: <T = any>( data: any) => T
|
|
@@ -82,6 +82,11 @@
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
.dt-table-action-dropdown{
|
|
86
|
+
vertical-align: middle;
|
|
87
|
+
cursor: pointer;
|
|
88
|
+
}
|
|
89
|
+
|
|
85
90
|
.ant-table-fixed-left table, .ant-table-fixed-right table{
|
|
86
91
|
width: min-content;
|
|
87
92
|
}
|
|
@@ -115,12 +120,13 @@
|
|
|
115
120
|
.ant-dropdown-menu-title-content{
|
|
116
121
|
display: flex;
|
|
117
122
|
align-items: center;
|
|
123
|
+
font-size: 13px;
|
|
118
124
|
svg{
|
|
119
125
|
display: block;
|
|
120
126
|
}
|
|
121
127
|
|
|
122
128
|
.dt-icon{
|
|
123
|
-
padding:
|
|
129
|
+
padding-right: 8px;
|
|
124
130
|
}
|
|
125
131
|
}
|
|
126
132
|
}
|
|
@@ -159,4 +165,9 @@
|
|
|
159
165
|
margin-left: 0;
|
|
160
166
|
}
|
|
161
167
|
}
|
|
168
|
+
|
|
169
|
+
.ant-table-thead > tr > th{
|
|
170
|
+
font-weight: bolder;
|
|
171
|
+
color: #333;
|
|
172
|
+
}
|
|
162
173
|
}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
:getPopupContainer="getPopupContainer"
|
|
14
14
|
:trigger="['click']"
|
|
15
15
|
>
|
|
16
|
-
<DtIcon :icon-class="'
|
|
16
|
+
<DtIcon :icon-class="'ic:baseline-settings'" class-name="dt-table-action-dropdown"></DtIcon>
|
|
17
17
|
|
|
18
18
|
<template #overlay>
|
|
19
19
|
<Menu class="dt-action-select">
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
v-if="item.ifShow"
|
|
23
23
|
@click="handleAction(item)"
|
|
24
24
|
>
|
|
25
|
-
<DtIcon :icon-class="item.icon" :color="item.color"></DtIcon>
|
|
25
|
+
<DtIcon :icon-class="item.icon" :color="item.color" :size="16"></DtIcon>
|
|
26
26
|
<span>{{ item.title }}</span>
|
|
27
27
|
</MenuItem>
|
|
28
28
|
</template>
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
import { defineComponent, PropType, unref, ref, h, toRaw, render as render1, resolveComponent, resolveDynamicComponent, createVNode } from 'vue'
|
|
5
5
|
import { BasicColumn } from '../types/table.type'
|
|
6
6
|
|
|
7
|
+
import { Switch } from 'ant-design-vue'
|
|
8
|
+
|
|
7
9
|
export default defineComponent({
|
|
8
10
|
name: 'TableFormat',
|
|
9
11
|
props: {
|
|
@@ -28,10 +30,6 @@
|
|
|
28
30
|
const { column, record, index } = props
|
|
29
31
|
const { render, dataIndex } = column
|
|
30
32
|
const text = record[dataIndex.toString()]
|
|
31
|
-
|
|
32
|
-
if( isFunction(render) ) {
|
|
33
|
-
renderText.value = render(text, record, index)
|
|
34
|
-
}
|
|
35
33
|
|
|
36
34
|
if( isObject(render) ) {
|
|
37
35
|
const { dict, date, number, percent } = render as Recordable
|
|
@@ -53,7 +51,7 @@
|
|
|
53
51
|
}
|
|
54
52
|
|
|
55
53
|
if( isVnode(render) ) {
|
|
56
|
-
renderText.value = render
|
|
54
|
+
renderText.value = ( <> { render } </> )
|
|
57
55
|
}
|
|
58
56
|
|
|
59
57
|
if( render['setup'] ) {
|
|
@@ -62,9 +60,13 @@
|
|
|
62
60
|
|
|
63
61
|
|
|
64
62
|
} else {
|
|
65
|
-
console.log(text)
|
|
66
63
|
renderText.value = text
|
|
67
64
|
}
|
|
65
|
+
|
|
66
|
+
if( isFunction(render) ) {
|
|
67
|
+
let afterRenderData = render(record, index, text)
|
|
68
|
+
renderText.value = isVnode(afterRenderData) ? ( <>{ afterRenderData }</> ) : afterRenderData
|
|
69
|
+
}
|
|
68
70
|
}
|
|
69
71
|
|
|
70
72
|
renderCell()
|
|
@@ -99,11 +99,10 @@
|
|
|
99
99
|
import { Tooltip, Popover, Checkbox, Button, CheckboxGroup, Divider } from 'ant-design-vue'
|
|
100
100
|
import { getPopupContainer as getParentContainer, isNullAndUnDef } from '@dt-frames/core'
|
|
101
101
|
import { DtIcon } from '../../../../icons/index'
|
|
102
|
-
import { computed, reactive, ref, unref, watchEffect, useAttrs } from 'vue'
|
|
102
|
+
import { computed, reactive, ref, unref, watchEffect, useAttrs, nextTick } from 'vue'
|
|
103
103
|
import type { ColumnStateType, ColumnOptionsType } from '../../types/tableHeader.type'
|
|
104
104
|
import { getTableInstance } from '../../hooks/useTableInstance'
|
|
105
105
|
import { BasicColumn } from '../../types/table.type'
|
|
106
|
-
import { nextTick } from 'process'
|
|
107
106
|
import { isFunction } from '@vueuse/core'
|
|
108
107
|
import { cloneDeep, omit } from 'lodash-es'
|
|
109
108
|
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
if( !el || !el.parentNode ) return null
|
|
31
31
|
|
|
32
32
|
// 找到路由的下一层 进行全屏
|
|
33
|
-
if(el.parentNode.className
|
|
33
|
+
if(el.parentNode.className?.indexOf('dt-layout-content') !== -1) {
|
|
34
34
|
wrapEl.value = el.parentNode
|
|
35
35
|
} else {
|
|
36
36
|
getParent( el.parentNode )
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<Download></Download>
|
|
2
|
+
<Download v-if="getSetting.download"></Download>
|
|
3
3
|
<SizeSetting v-if="getSetting.size" />
|
|
4
4
|
<ColumnSetting
|
|
5
5
|
v-if="getSetting.setting"
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
setup(props, { emit }) {
|
|
44
44
|
const getSetting = computed((): TableSetting => {
|
|
45
45
|
return {
|
|
46
|
-
|
|
46
|
+
download: true,
|
|
47
47
|
size: true,
|
|
48
48
|
setting: true,
|
|
49
49
|
fullscreen: true,
|
|
@@ -147,7 +147,7 @@ function handleActionColumn(propsRef: ComputedRef<BasicTableProps>, columns: Bas
|
|
|
147
147
|
title: '操作',
|
|
148
148
|
align: 'center',
|
|
149
149
|
expand,
|
|
150
|
-
width: (expand ? (column.btns.length * 30 + 40) : 70)
|
|
150
|
+
width: `${ (expand ? (column.btns.length * 30 + 40) : 70) }px`,
|
|
151
151
|
...column,
|
|
152
152
|
flag: ACTION_COLUMN,
|
|
153
153
|
}
|
|
@@ -256,7 +256,7 @@ export function useColumns(
|
|
|
256
256
|
|
|
257
257
|
|
|
258
258
|
// 设置列信息
|
|
259
|
-
function setColumns(columnList: Partial<BasicColumn>[] | string[]) {
|
|
259
|
+
function setColumns(columnList: Partial<BasicColumn>[] | string[] = []) {
|
|
260
260
|
const columns = cloneDeep(columnList)
|
|
261
261
|
|
|
262
262
|
if( !isArray( columns ) ) return
|
|
@@ -24,6 +24,19 @@ export function useDataSource(
|
|
|
24
24
|
// 拷贝一份表格数据 然后再做数据处理
|
|
25
25
|
const dataSourceRef = ref<Recordable[]>([])
|
|
26
26
|
|
|
27
|
+
// const { defSort, onTableChange } = unref( propsRef )
|
|
28
|
+
// const { appConf } = useAppStore()
|
|
29
|
+
|
|
30
|
+
// onTableChange({
|
|
31
|
+
// pagination: {
|
|
32
|
+
// current: 1,
|
|
33
|
+
// pageSize: appConf.ui.table.defaultPageSize
|
|
34
|
+
// },
|
|
35
|
+
// sort:defSort,
|
|
36
|
+
// filter: null,
|
|
37
|
+
// showBtnLoading: false
|
|
38
|
+
// }, false)
|
|
39
|
+
|
|
27
40
|
watch(
|
|
28
41
|
() => unref(propsRef).dataSource,
|
|
29
42
|
(dataSource) => {
|
|
@@ -75,20 +88,18 @@ export function useDataSource(
|
|
|
75
88
|
}
|
|
76
89
|
|
|
77
90
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
const { appConf } = useAppStore()
|
|
91
|
+
const { defSort, onTableChange } = unref( propsRef )
|
|
92
|
+
const { appConf } = useAppStore()
|
|
81
93
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
})
|
|
94
|
+
onTableChange({
|
|
95
|
+
pagination: {
|
|
96
|
+
current: 1,
|
|
97
|
+
pageSize: appConf.ui.table.defaultPageSize
|
|
98
|
+
},
|
|
99
|
+
sort:defSort,
|
|
100
|
+
filter: null,
|
|
101
|
+
showBtnLoading: false
|
|
102
|
+
}, false)
|
|
92
103
|
|
|
93
104
|
|
|
94
105
|
return {
|