@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
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
.dt-icon{
|
|
10
10
|
display: inline-block;
|
|
11
11
|
text-align: center;
|
|
12
|
+
vertical-align: middle;
|
|
12
13
|
& > svg{
|
|
13
14
|
vertical-align: middle;
|
|
14
15
|
}
|
|
@@ -74,7 +75,7 @@
|
|
|
74
75
|
padding: 4px;
|
|
75
76
|
transform: all 0.2s;
|
|
76
77
|
border: 1px solid #fff;
|
|
77
|
-
&:hover{
|
|
78
|
+
&:hover, &.active-icon{
|
|
78
79
|
border: 1px solid @primary-color;
|
|
79
80
|
border-radius: 4px;
|
|
80
81
|
color: @primary-color;
|
|
@@ -93,4 +94,8 @@
|
|
|
93
94
|
background: #fff !important;
|
|
94
95
|
color: @icon-pick-hover-color ;
|
|
95
96
|
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.dt-icon-dialog > div{
|
|
100
|
+
top: 0 !important;
|
|
96
101
|
}
|
|
@@ -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
|
}
|
|
@@ -121,10 +121,6 @@
|
|
|
121
121
|
color: #333;
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
|
|
125
|
-
.icon{
|
|
126
|
-
padding: 0 14px;
|
|
127
|
-
}
|
|
128
124
|
}
|
|
129
125
|
|
|
130
126
|
&--light{
|
|
@@ -209,6 +205,14 @@
|
|
|
209
205
|
right: 4px;
|
|
210
206
|
top: 10px;
|
|
211
207
|
}
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.brand-logo{
|
|
213
|
+
width: 40px;
|
|
214
|
+
height: 60px;
|
|
215
|
+
margin-left: -7px;
|
|
212
216
|
}
|
|
213
217
|
|
|
214
218
|
.dt-multiple-header{
|
|
@@ -25,6 +25,49 @@ declare const _sfc_main: import("vue").DefineComponent<{
|
|
|
25
25
|
getLogoClass: import("vue").ComputedRef<(string | {
|
|
26
26
|
'collapsed-show-title': boolean;
|
|
27
27
|
})[]>;
|
|
28
|
+
DtIcon: import("vue").DefineComponent<{
|
|
29
|
+
iconClass: {
|
|
30
|
+
type: StringConstructor;
|
|
31
|
+
required: true;
|
|
32
|
+
};
|
|
33
|
+
className: {
|
|
34
|
+
type: (StringConstructor | ArrayConstructor)[];
|
|
35
|
+
default: string;
|
|
36
|
+
};
|
|
37
|
+
color: {
|
|
38
|
+
type: StringConstructor;
|
|
39
|
+
default: string;
|
|
40
|
+
};
|
|
41
|
+
size: {
|
|
42
|
+
type: NumberConstructor;
|
|
43
|
+
default: number;
|
|
44
|
+
};
|
|
45
|
+
}, {
|
|
46
|
+
isSvgIcon: import("vue").ComputedRef<boolean>;
|
|
47
|
+
iconName: import("vue").ComputedRef<string>;
|
|
48
|
+
clsName: import("vue").ComputedRef<string>;
|
|
49
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
50
|
+
iconClass: {
|
|
51
|
+
type: StringConstructor;
|
|
52
|
+
required: true;
|
|
53
|
+
};
|
|
54
|
+
className: {
|
|
55
|
+
type: (StringConstructor | ArrayConstructor)[];
|
|
56
|
+
default: string;
|
|
57
|
+
};
|
|
58
|
+
color: {
|
|
59
|
+
type: StringConstructor;
|
|
60
|
+
default: string;
|
|
61
|
+
};
|
|
62
|
+
size: {
|
|
63
|
+
type: NumberConstructor;
|
|
64
|
+
default: number;
|
|
65
|
+
};
|
|
66
|
+
}>>, {
|
|
67
|
+
className: string | unknown[];
|
|
68
|
+
color: string;
|
|
69
|
+
size: number;
|
|
70
|
+
}>;
|
|
28
71
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
29
72
|
theme: {
|
|
30
73
|
type: StringConstructor;
|
|
@@ -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"
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"types": "./es/index.d.ts",
|
|
29
29
|
"sideEffects": false,
|
|
30
30
|
"dependencies": {
|
|
31
|
+
"@iconify/iconify": "^2.1.2",
|
|
31
32
|
"@vueuse/core": "^7.5.2",
|
|
32
33
|
"lodash-es": "^4.17.21",
|
|
33
34
|
"sortablejs": "^1.15.0",
|
|
@@ -41,7 +42,9 @@
|
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
44
|
"@iconify/json": "^1.1.460",
|
|
44
|
-
"@vitejs/plugin-vue": "^2.
|
|
45
|
-
"vite": "^2.
|
|
45
|
+
"@vitejs/plugin-vue": "^2.2.0",
|
|
46
|
+
"vite": "^2.8.0",
|
|
47
|
+
"vite-plugin-purge-icons": "^0.7.0",
|
|
48
|
+
"vite-plugin-theme": "^0.8.6"
|
|
46
49
|
}
|
|
47
50
|
}
|
|
Binary file
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { isFunction, Recordable } from "@dt-frames/core";
|
|
10
10
|
import { omit } from 'lodash-es'
|
|
11
11
|
import { Ref, PropType, watch, toRaw, unref, watchEffect } from "vue";
|
|
12
|
-
import { useForm, DtForm } from "../../../forms";
|
|
12
|
+
import { useForm, DtForm, FormProps } from "../../../forms";
|
|
13
13
|
import { DtModal, useModal } from "../../../modal"
|
|
14
14
|
import { basicProps } from "./props";
|
|
15
15
|
|
|
@@ -18,28 +18,34 @@
|
|
|
18
18
|
...{
|
|
19
19
|
onRegister: { type: Function },
|
|
20
20
|
formProps: {
|
|
21
|
+
type: Object as PropType<Ref<Partial<FormProps>>>
|
|
22
|
+
},
|
|
23
|
+
formsVal: {
|
|
21
24
|
type: Object as PropType<Ref<Recordable>>
|
|
22
25
|
}
|
|
23
26
|
}
|
|
24
27
|
} )
|
|
25
28
|
|
|
26
|
-
const [registerDialog
|
|
29
|
+
const [registerDialog] = useModal({
|
|
27
30
|
...omit(toRaw(props), [
|
|
28
31
|
'actions',
|
|
29
32
|
'curd',
|
|
30
33
|
'formProps',
|
|
34
|
+
'formsVal',
|
|
31
35
|
'onRegister',
|
|
32
36
|
'schemas'
|
|
33
|
-
])
|
|
37
|
+
]),
|
|
38
|
+
destroyOnClose: true
|
|
34
39
|
})
|
|
35
40
|
|
|
36
41
|
const [ registerForm, { getFormValues, setFormValues } ] = useForm({
|
|
42
|
+
...( props.formProps.value || {} ),
|
|
37
43
|
schemas: props.schemas,
|
|
38
44
|
mode: 'dialog'
|
|
39
45
|
})
|
|
40
46
|
|
|
41
47
|
watch(
|
|
42
|
-
() => props.
|
|
48
|
+
() => props.formsVal.value,
|
|
43
49
|
v => {
|
|
44
50
|
if( v ) {
|
|
45
51
|
setFormValues( toRaw(v) )
|
|
@@ -53,7 +59,7 @@
|
|
|
53
59
|
|
|
54
60
|
let obj = Object.assign(
|
|
55
61
|
{},
|
|
56
|
-
props.
|
|
62
|
+
props.formsVal.value || {},
|
|
57
63
|
getFormValues()
|
|
58
64
|
)
|
|
59
65
|
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { useModal, useModalOut } from "../../../modal"
|
|
1
|
+
import { error, isFunction, Recordable, useMessage } from "@dt-frames/core";
|
|
2
|
+
import { h, ref } from "vue"
|
|
3
|
+
import { useModalOut } from "../../../modal"
|
|
5
4
|
import DtModal from "../components/dialog.vue";
|
|
6
5
|
import { CrudOptType } from "../types/curd.type";
|
|
7
6
|
|
|
8
7
|
|
|
9
8
|
export function useCurd(curdOpt: CrudOptType) {
|
|
10
|
-
const
|
|
9
|
+
const formsVal = ref<Recordable>()
|
|
11
10
|
const [register, { closeModal, setModalProps, openModal }] = useModalOut()
|
|
11
|
+
const { confirm } = useMessage()
|
|
12
12
|
|
|
13
13
|
const DtCurdModal = () => {
|
|
14
14
|
return h(
|
|
15
15
|
<div class="curdModal">
|
|
16
16
|
<DtModal
|
|
17
17
|
{ ...curdOpt }
|
|
18
|
-
|
|
18
|
+
formsVal = { formsVal }
|
|
19
|
+
formProps = { curdOpt.formProps }
|
|
19
20
|
onRegister = { register }
|
|
20
21
|
></DtModal>
|
|
21
22
|
</div>
|
|
@@ -32,7 +33,14 @@ export function useCurd(curdOpt: CrudOptType) {
|
|
|
32
33
|
const { primaryKey = 'id', curd } = curdOpt
|
|
33
34
|
|
|
34
35
|
if( curd && curd.onDeletes && isFunction( curd.onDeletes ) ) {
|
|
35
|
-
|
|
36
|
+
confirm({
|
|
37
|
+
title: '删除确认',
|
|
38
|
+
content: '确认要删除选中的数据?',
|
|
39
|
+
iconType: 'warning',
|
|
40
|
+
onOk() {
|
|
41
|
+
curd.onDeletes( [row[ primaryKey ]] )
|
|
42
|
+
}
|
|
43
|
+
})
|
|
36
44
|
} else {
|
|
37
45
|
error(`缺少curd函数配置, 请将useSource中返回的curd参数传入useCurd配置项中!`)
|
|
38
46
|
}
|
|
@@ -43,7 +51,7 @@ export function useCurd(curdOpt: CrudOptType) {
|
|
|
43
51
|
const { primaryKey = 'id', curd } = curdOpt
|
|
44
52
|
|
|
45
53
|
curd.onQueryById(row[primaryKey]).then( rsp => {
|
|
46
|
-
|
|
54
|
+
formsVal.value = rsp
|
|
47
55
|
} )
|
|
48
56
|
|
|
49
57
|
openModal()
|
|
@@ -55,7 +63,14 @@ export function useCurd(curdOpt: CrudOptType) {
|
|
|
55
63
|
const { curd } = curdOpt
|
|
56
64
|
|
|
57
65
|
if( curd && curd.onDeletes && isFunction( curd.onDeletes ) ) {
|
|
58
|
-
|
|
66
|
+
confirm({
|
|
67
|
+
title: '批量删除确认',
|
|
68
|
+
content: '确认要批量删除选中的数据?',
|
|
69
|
+
iconType: 'warning',
|
|
70
|
+
onOk() {
|
|
71
|
+
curd.onDeletes( ids )
|
|
72
|
+
}
|
|
73
|
+
})
|
|
59
74
|
} else {
|
|
60
75
|
error(`缺少curd函数配置, 请将useSource中返回的curd参数传入useCurd配置项中!`)
|
|
61
76
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Recordable } from "@dt-frames/core"
|
|
2
|
-
import { FormSchema, ButtonProps } from "../../../forms/src/types/form.type"
|
|
2
|
+
import { FormSchema, ButtonProps, FormProps } from "../../../forms/src/types/form.type"
|
|
3
3
|
|
|
4
4
|
export type CrudOptType = {
|
|
5
5
|
// 标题
|
|
@@ -16,6 +16,8 @@ export type CrudOptType = {
|
|
|
16
16
|
showClose?: boolean
|
|
17
17
|
// 物理主键
|
|
18
18
|
primaryKey?: string
|
|
19
|
+
// 弹框中表格的属性
|
|
20
|
+
formProps?: Partial<FormProps>,
|
|
19
21
|
// 增删改查接口
|
|
20
22
|
curd?: {
|
|
21
23
|
onAdd?: ( model: Recordable ) => void
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { ModalProps, Recordable } from "@dt-frames/core"
|
|
2
|
+
import { VNode, h, createVNode, render as vueRender, Component } from "vue"
|
|
3
|
+
|
|
4
|
+
export function useDialog() {
|
|
5
|
+
function createDialog( component: any, options: any ) {
|
|
6
|
+
return new Promise( resolve => {
|
|
7
|
+
const div = document.createElement('div');
|
|
8
|
+
document.body.appendChild(div);
|
|
9
|
+
|
|
10
|
+
const wrapper = () => {
|
|
11
|
+
return h(component, {
|
|
12
|
+
params: {
|
|
13
|
+
...options,
|
|
14
|
+
afterClose: ( data: any ) => destroy( data )
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
})
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
let dialogInstance = render();
|
|
21
|
+
|
|
22
|
+
function render() {
|
|
23
|
+
const vm = createVNode(component.children[0]);
|
|
24
|
+
vueRender(vm, div);
|
|
25
|
+
return vm;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function destroy( data: any ) {
|
|
29
|
+
if (dialogInstance && div.parentNode) {
|
|
30
|
+
vueRender(null, div);
|
|
31
|
+
dialogInstance.component.update();
|
|
32
|
+
dialogInstance = null;
|
|
33
|
+
div.parentNode.removeChild(div);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
resolve( data );
|
|
37
|
+
}
|
|
38
|
+
} )
|
|
39
|
+
}
|
|
40
|
+
// function createDialog(component: any, props?: ModalProps) {
|
|
41
|
+
// const afterClose = (rsp: Recordable) => { }
|
|
42
|
+
|
|
43
|
+
// const div = document.createElement('div')
|
|
44
|
+
// document.body.appendChild(div)
|
|
45
|
+
|
|
46
|
+
// const wrapper = () => {
|
|
47
|
+
// return (
|
|
48
|
+
// h(component, {
|
|
49
|
+
// params: {
|
|
50
|
+
// ...props,
|
|
51
|
+
// afterClose: ( data: Recordable ) => destroy( data )
|
|
52
|
+
// }
|
|
53
|
+
// })
|
|
54
|
+
// )
|
|
55
|
+
// }
|
|
56
|
+
|
|
57
|
+
// let dialogInstance = render()
|
|
58
|
+
|
|
59
|
+
// function render(){
|
|
60
|
+
// const vm = createVNode(wrapper)
|
|
61
|
+
// vueRender(vm, div)
|
|
62
|
+
// return vm
|
|
63
|
+
// }
|
|
64
|
+
|
|
65
|
+
// const destroy = ( data: Recordable ) => {
|
|
66
|
+
// if (dialogInstance && div.parentNode) {
|
|
67
|
+
// vueRender(null, div)
|
|
68
|
+
// dialogInstance.component.update()
|
|
69
|
+
// dialogInstance = null
|
|
70
|
+
// div.parentNode.removeChild(div)
|
|
71
|
+
// }
|
|
72
|
+
|
|
73
|
+
// afterClose( data )
|
|
74
|
+
// }
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
// return {
|
|
78
|
+
// afterClose
|
|
79
|
+
// }
|
|
80
|
+
// }
|
|
81
|
+
|
|
82
|
+
return {
|
|
83
|
+
createDialog
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import DtForm from './src/index.vue'
|
|
2
2
|
import { useForm } from './src/hooks/useForm'
|
|
3
|
-
import { ButtonProps, FormSchema } from './src/types/form.type'
|
|
4
3
|
import FormButtons from './src/components/formButton.vue'
|
|
5
4
|
|
|
5
|
+
export * from './src/types/form.type'
|
|
6
|
+
|
|
6
7
|
export {
|
|
7
8
|
FormButtons,
|
|
8
9
|
DtForm,
|
|
9
|
-
useForm
|
|
10
|
-
FormSchema,
|
|
11
|
-
ButtonProps
|
|
10
|
+
useForm
|
|
12
11
|
}
|
|
@@ -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 => {
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
.dt-icon{
|
|
10
10
|
display: inline-block;
|
|
11
11
|
text-align: center;
|
|
12
|
+
vertical-align: middle;
|
|
12
13
|
& > svg{
|
|
13
14
|
vertical-align: middle;
|
|
14
15
|
}
|
|
@@ -74,7 +75,7 @@
|
|
|
74
75
|
padding: 4px;
|
|
75
76
|
transform: all 0.2s;
|
|
76
77
|
border: 1px solid #fff;
|
|
77
|
-
&:hover{
|
|
78
|
+
&:hover, &.active-icon{
|
|
78
79
|
border: 1px solid @primary-color;
|
|
79
80
|
border-radius: 4px;
|
|
80
81
|
color: @primary-color;
|
|
@@ -93,4 +94,8 @@
|
|
|
93
94
|
background: #fff !important;
|
|
94
95
|
color: @icon-pick-hover-color ;
|
|
95
96
|
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.dt-icon-dialog > div{
|
|
100
|
+
top: 0 !important;
|
|
96
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
|
|
package/src/components/index.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { useSource } from './source'
|
|
|
8
8
|
import { useCurd } from './curd'
|
|
9
9
|
import { export2Excel } from './excel'
|
|
10
10
|
import { DtIframe } from './iframe'
|
|
11
|
+
import { useDialog } from './dialog';
|
|
11
12
|
|
|
12
13
|
const dtComponents = [
|
|
13
14
|
{ name: 'dt-base-router', component: DtBaseRouter },
|
|
@@ -42,5 +43,6 @@ export {
|
|
|
42
43
|
useCurd,
|
|
43
44
|
useModal,
|
|
44
45
|
useModalOut,
|
|
45
|
-
export2Excel
|
|
46
|
+
export2Excel,
|
|
47
|
+
useDialog
|
|
46
48
|
}
|
|
@@ -2,21 +2,20 @@
|
|
|
2
2
|
<div :class="getClass">
|
|
3
3
|
<template v-if="canFullscreen">
|
|
4
4
|
<Tooltip title="退出全屏" placement="bottom" v-if="fullScreen">
|
|
5
|
-
<i
|
|
5
|
+
<i class="i ic:baseline-fullscreen-exit" @click="handleFullScreen" />
|
|
6
6
|
</Tooltip>
|
|
7
7
|
<Tooltip title="全屏" placement="bottom" v-else>
|
|
8
|
-
<i
|
|
8
|
+
<i class="i ic:baseline-fullscreen" @click="handleFullScreen" />
|
|
9
9
|
</Tooltip>
|
|
10
10
|
</template>
|
|
11
11
|
|
|
12
|
-
<
|
|
12
|
+
<i class="i mdi:close" @click="handleCancel" />
|
|
13
13
|
</div>
|
|
14
14
|
</template>
|
|
15
15
|
|
|
16
16
|
<script lang="ts" setup>
|
|
17
17
|
import { computed } from 'vue';
|
|
18
18
|
import { Tooltip } from 'ant-design-vue';
|
|
19
|
-
import { DtIcon } from '../../../icons';
|
|
20
19
|
|
|
21
20
|
const props = defineProps({
|
|
22
21
|
canFullscreen: { type: Boolean, default: true },
|