@dt-frames/ui 1.0.6 → 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/components/curd/src/components/dialog.d.ts +1 -0
- package/es/components/forms/src/components/formIcon.d.ts +3 -1
- package/es/components/icons/src/pick-icon.d.ts +1 -0
- package/es/components/modal/src/components/modal-wrap.d.ts +1 -0
- package/es/components/modal/src/index.d.ts +1 -0
- 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/table/src/components/TableActions.d.ts +2 -2
- package/es/components/table/src/components/setting/Column.d.ts +1 -1
- 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/useHeaderCode.d.ts +3 -2
- package/es/components/table/src/index.d.ts +23 -20
- package/es/components/table/src/props.d.ts +5 -4
- package/es/components/table/src/types/table.type.d.ts +2 -2
- package/es/index.js +880 -837
- package/es/style/components/icons/index.less +5 -1
- 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 +3 -3
- 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 +5 -1
- package/src/components/icons/src/pick-icon.vue +3 -1
- package/src/components/modal/src/components/modal-wrap.vue +49 -39
- package/src/components/modal/src/components/modal.tsx +1 -1
- package/src/components/modal/src/hooks/useFullScreen.ts +3 -1
- package/src/components/modal/src/hooks/useModal.ts +23 -7
- 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/useSource.ts +18 -4
- package/src/components/source/src/types/source.type.ts +11 -1
- 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/Fullscreen.vue +1 -1
- package/src/components/table/src/components/setting/index.vue +2 -2
- package/src/components/table/src/hooks/useDataSource.ts +24 -13
- package/src/components/table/src/hooks/useHeaderCode.ts +9 -2
- package/src/components/table/src/hooks/useTable.ts +5 -4
- package/src/components/table/src/hooks/useTableHeader.ts +2 -2
- package/src/components/table/src/index.vue +0 -2
- package/src/components/table/src/props.ts +3 -3
- package/src/components/table/src/types/table.type.ts +2 -2
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
padding: 4px;
|
|
76
76
|
transform: all 0.2s;
|
|
77
77
|
border: 1px solid #fff;
|
|
78
|
-
&:hover{
|
|
78
|
+
&:hover, &.active-icon{
|
|
79
79
|
border: 1px solid @primary-color;
|
|
80
80
|
border-radius: 4px;
|
|
81
81
|
color: @primary-color;
|
|
@@ -94,4 +94,8 @@
|
|
|
94
94
|
background: #fff !important;
|
|
95
95
|
color: @icon-pick-hover-color ;
|
|
96
96
|
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.dt-icon-dialog > div{
|
|
100
|
+
top: 0 !important;
|
|
97
101
|
}
|
|
@@ -125,7 +125,7 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
125
125
|
'onUpdate:openKeys': import("vue").PropType<(keys: import("ant-design-vue/lib/_util/type").Key[]) => void>;
|
|
126
126
|
'onUpdate:selectedKeys': import("vue").PropType<(keys: import("ant-design-vue/lib/_util/type").Key[]) => void>;
|
|
127
127
|
'onUpdate:activeKey': import("vue").PropType<(key: import("ant-design-vue/lib/_util/type").Key) => void>;
|
|
128
|
-
}>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "disabled" | "mode" | "
|
|
128
|
+
}>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "disabled" | "mode" | "theme" | "multiple" | "inlineCollapsed" | "disabledOverflow" | "forceSubMenuRender" | "selectable" | "inlineIndent" | "subMenuOpenDelay" | "subMenuCloseDelay" | "triggerSubMenuAction">;
|
|
129
129
|
$attrs: {
|
|
130
130
|
[x: string]: unknown;
|
|
131
131
|
};
|
|
@@ -742,10 +742,10 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
742
742
|
}, {
|
|
743
743
|
type: string;
|
|
744
744
|
mode: MenuMode;
|
|
745
|
-
inlineCollapsed: boolean;
|
|
746
745
|
theme: import("@dt-frames/core").Theme;
|
|
747
|
-
inlineIndent: number;
|
|
748
746
|
isHorizontal: boolean;
|
|
747
|
+
inlineCollapsed: boolean;
|
|
748
|
+
inlineIndent: number;
|
|
749
749
|
collapsedShowTitle: boolean;
|
|
750
750
|
mixSider: boolean;
|
|
751
751
|
}>;
|
|
@@ -64,7 +64,7 @@ declare const _sfc_main: import("vue").DefineComponent<{}, {
|
|
|
64
64
|
'onUpdate:visible': {
|
|
65
65
|
type: import("vue").PropType<(val: boolean) => void>;
|
|
66
66
|
};
|
|
67
|
-
}>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "visible" | "overlayStyle" | "disabled" | "
|
|
67
|
+
}>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "visible" | "overlayStyle" | "disabled" | "forceRender" | "arrow" | "minOverlayWidthMatchTrigger" | "destroyPopupOnHide">;
|
|
68
68
|
$attrs: {
|
|
69
69
|
[x: string]: unknown;
|
|
70
70
|
};
|
|
@@ -501,7 +501,7 @@ declare const _sfc_main: import("vue").DefineComponent<{}, {
|
|
|
501
501
|
'onUpdate:openKeys': import("vue").PropType<(keys: import("ant-design-vue/lib/_util/type").Key[]) => void>;
|
|
502
502
|
'onUpdate:selectedKeys': import("vue").PropType<(keys: import("ant-design-vue/lib/_util/type").Key[]) => void>;
|
|
503
503
|
'onUpdate:activeKey': import("vue").PropType<(key: import("ant-design-vue/lib/_util/type").Key) => void>;
|
|
504
|
-
}>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "disabled" | "mode" | "
|
|
504
|
+
}>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "disabled" | "mode" | "theme" | "multiple" | "inlineCollapsed" | "disabledOverflow" | "forceSubMenuRender" | "selectable" | "inlineIndent" | "subMenuOpenDelay" | "subMenuCloseDelay" | "triggerSubMenuAction">;
|
|
505
505
|
$attrs: {
|
|
506
506
|
[x: string]: unknown;
|
|
507
507
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dt-frames/ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"ui",
|
|
6
6
|
"dt-ui"
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@iconify/json": "^1.1.460",
|
|
45
|
-
"@vitejs/plugin-vue": "^2.
|
|
46
|
-
"vite": "^2.
|
|
45
|
+
"@vitejs/plugin-vue": "^2.2.0",
|
|
46
|
+
"vite": "^2.8.0",
|
|
47
47
|
"vite-plugin-purge-icons": "^0.7.0",
|
|
48
48
|
"vite-plugin-theme": "^0.8.6"
|
|
49
49
|
}
|
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
title: '选择字体图标',
|
|
32
32
|
width: '70%',
|
|
33
33
|
showSave: false,
|
|
34
|
-
centered: true
|
|
34
|
+
centered: true,
|
|
35
|
+
wrapClassName: 'dt-icon-dialog',
|
|
35
36
|
})
|
|
36
37
|
|
|
37
38
|
const props = defineProps({
|
|
@@ -44,7 +45,7 @@
|
|
|
44
45
|
function chooseIcon(icon) {
|
|
45
46
|
setState(icon)
|
|
46
47
|
|
|
47
|
-
closeModal()
|
|
48
|
+
closeModal(icon)
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
</script>
|
|
@@ -223,21 +223,25 @@
|
|
|
223
223
|
(schemas) => resetSchema(schemas ?? [])
|
|
224
224
|
)
|
|
225
225
|
|
|
226
|
+
watch(
|
|
227
|
+
() => unref(getProps).onSearch,
|
|
228
|
+
() => {
|
|
229
|
+
useTimeoutFn(() => {
|
|
230
|
+
// 如果有onSearch默认查询
|
|
231
|
+
const { onSearch, autoFetch } = unref(getProps)
|
|
232
|
+
|
|
233
|
+
if( autoFetch && onSearch && isFunction(onSearch) ) {
|
|
234
|
+
onSearch(toRaw(defaultValue.value))
|
|
235
|
+
}
|
|
236
|
+
}, 1)
|
|
237
|
+
}
|
|
238
|
+
)
|
|
239
|
+
|
|
226
240
|
onMounted(() => {
|
|
227
241
|
// 每次加载 进行重置
|
|
228
242
|
setFormValues( null )
|
|
229
243
|
emit('register', formActionMethods)
|
|
230
244
|
initDefault()
|
|
231
|
-
|
|
232
|
-
// 为了保证table的数据能够成功传入useSource中,这里需要延迟执行search
|
|
233
|
-
useTimeoutFn(() => {
|
|
234
|
-
// 如果有onSearch默认查询
|
|
235
|
-
const { onSearch, autoFetch } = unref(getProps)
|
|
236
|
-
|
|
237
|
-
if( autoFetch && onSearch && isFunction(onSearch) ) {
|
|
238
|
-
onSearch(toRaw(defaultValue.value))
|
|
239
|
-
}
|
|
240
|
-
}, 20)
|
|
241
245
|
})
|
|
242
246
|
|
|
243
247
|
const getActionsProps = computed((): Recordable => {
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
padding: 4px;
|
|
76
76
|
transform: all 0.2s;
|
|
77
77
|
border: 1px solid #fff;
|
|
78
|
-
&:hover{
|
|
78
|
+
&:hover, &.active-icon{
|
|
79
79
|
border: 1px solid @primary-color;
|
|
80
80
|
border-radius: 4px;
|
|
81
81
|
color: @primary-color;
|
|
@@ -94,4 +94,8 @@
|
|
|
94
94
|
background: #fff !important;
|
|
95
95
|
color: @icon-pick-hover-color ;
|
|
96
96
|
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.dt-icon-dialog > div{
|
|
100
|
+
top: 0 !important;
|
|
97
101
|
}
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
></InputSearch>
|
|
24
24
|
|
|
25
25
|
<template v-for="icon in currentIcons" :key="icon">
|
|
26
|
-
<a @click="selectIcon(icon)">
|
|
26
|
+
<a @click="selectIcon(icon)" :class="activeIcon === icon && 'active-icon'">
|
|
27
27
|
<Tooltip
|
|
28
28
|
placement="bottom"
|
|
29
29
|
overlayClassName="dt-pick-icon-item">
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
const activeIndex = ref(1)
|
|
57
57
|
const filter = ref(null)
|
|
58
58
|
const currentIcons = ref([])
|
|
59
|
+
const activeIcon = ref(null)
|
|
59
60
|
|
|
60
61
|
|
|
61
62
|
const iconMenus = computed(() => {
|
|
@@ -110,6 +111,7 @@
|
|
|
110
111
|
}
|
|
111
112
|
|
|
112
113
|
function selectIcon(icon) {
|
|
114
|
+
activeIcon.value = icon
|
|
113
115
|
emits('chooseIcon', icon)
|
|
114
116
|
}
|
|
115
117
|
|
|
@@ -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
|
}
|
|
@@ -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
|
}
|
|
@@ -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,11 +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
5
|
import { ModalMethods, ReturnInnerMethods, ReturnMethods, UseModalInnerReturnType, UseModalReturnType } from '../types/modal.type';
|
|
6
|
-
import { computed,
|
|
6
|
+
import { computed, getCurrentInstance, nextTick, onUnmounted, reactive, ref, toRaw, unref, watch, watchEffect } from "vue";
|
|
7
7
|
|
|
8
8
|
const dataTransfer = reactive<any>({})
|
|
9
|
+
const cbTransfer = reactive<any>({})
|
|
9
10
|
const visibleData = reactive<{ [key: number]: boolean }>({})
|
|
10
11
|
|
|
11
12
|
export function useModalOut(): UseModalReturnType{
|
|
@@ -24,6 +25,7 @@ export function useModalOut(): UseModalReturnType{
|
|
|
24
25
|
modal.value = null
|
|
25
26
|
loaded.value = false
|
|
26
27
|
dataTransfer[unref(uid)] = null
|
|
28
|
+
cbTransfer[unref(uid)] = (rsp?: Recordable) => { }
|
|
27
29
|
})
|
|
28
30
|
|
|
29
31
|
if( unref(loaded) && modalMethod === unref(modal) ) return
|
|
@@ -59,18 +61,28 @@ export function useModalOut(): UseModalReturnType{
|
|
|
59
61
|
getInstance()?.redoModalHeight?.()
|
|
60
62
|
},
|
|
61
63
|
|
|
62
|
-
openModal:
|
|
64
|
+
openModal: (params?: Recordable, openOnSet = true) => {
|
|
63
65
|
getInstance()?.setModalProps({
|
|
64
|
-
visible:
|
|
66
|
+
visible: true
|
|
65
67
|
})
|
|
66
68
|
|
|
67
|
-
|
|
69
|
+
const { data, afterClose } = params || {}
|
|
68
70
|
|
|
69
71
|
const id = unref(uid)
|
|
70
72
|
|
|
73
|
+
// 设置回调
|
|
74
|
+
cbTransfer[unref(uid)] = (rsp?: Recordable) => {
|
|
75
|
+
if( afterClose && isFunction(afterClose)) {
|
|
76
|
+
afterClose(rsp)
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if( !data ) return
|
|
81
|
+
|
|
71
82
|
if( openOnSet ) {
|
|
72
83
|
dataTransfer[id] = toRaw(data);
|
|
73
|
-
|
|
84
|
+
|
|
85
|
+
return
|
|
74
86
|
}
|
|
75
87
|
|
|
76
88
|
const equal = isEqual(toRaw(dataTransfer[id]), toRaw(data))
|
|
@@ -139,8 +151,12 @@ export function useModal(props?: Partial<ModalProps>,callbackFn?: Function): Use
|
|
|
139
151
|
changeLoading: (loading = true) => {
|
|
140
152
|
getInstance()?.setModalProps({ loading })
|
|
141
153
|
},
|
|
154
|
+
|
|
142
155
|
getVisible: computed(() => visibleData[~~unref(uidRef)]),
|
|
143
|
-
|
|
156
|
+
|
|
157
|
+
// 关闭弹框进行回调
|
|
158
|
+
closeModal: (rsp: Recordable) => {
|
|
159
|
+
cbTransfer[unref(uidRef)](rsp)
|
|
144
160
|
getInstance()?.setModalProps({ visible: false });
|
|
145
161
|
},
|
|
146
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
|
|
@@ -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
|
|
|
@@ -112,6 +116,7 @@ export function useSource(opt: SourceType) {
|
|
|
112
116
|
const { fetch } = useFetch(add, baseUrl)
|
|
113
117
|
|
|
114
118
|
fetch(model).then( (rsp: any) => {
|
|
119
|
+
message.success('新增成功')
|
|
115
120
|
search()
|
|
116
121
|
} )
|
|
117
122
|
}
|
|
@@ -128,6 +133,7 @@ export function useSource(opt: SourceType) {
|
|
|
128
133
|
function onUpdate(model: Recordable) {
|
|
129
134
|
const { fetch } = useFetch(update, baseUrl)
|
|
130
135
|
fetch(model).then( (rsp: any) => {
|
|
136
|
+
message.success('更新数据成功')
|
|
131
137
|
search()
|
|
132
138
|
} )
|
|
133
139
|
}
|
|
@@ -171,9 +177,17 @@ export function useSource(opt: SourceType) {
|
|
|
171
177
|
|
|
172
178
|
return {
|
|
173
179
|
api,
|
|
180
|
+
apiFul,
|
|
174
181
|
form,
|
|
175
182
|
table,
|
|
176
183
|
curd,
|
|
184
|
+
loading,
|
|
185
|
+
onAdd,
|
|
186
|
+
onQueryById,
|
|
187
|
+
onDeletes,
|
|
188
|
+
onUpdate,
|
|
189
|
+
onTableChange,
|
|
190
|
+
onDownload,
|
|
177
191
|
onSearch
|
|
178
192
|
}
|
|
179
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
|
|
@@ -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()
|
|
@@ -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,
|
|
@@ -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 {
|