@dt-frames/ui 1.0.9 → 1.0.12
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 +8 -3
- package/es/components/forms/src/components/formIcon.d.ts +1 -1
- package/es/components/forms/src/components/formInputUseDialog.d.ts +903 -0
- package/es/components/forms/src/types/form.type.d.ts +6 -4
- package/es/components/index.d.ts +3 -2
- package/es/components/modal/src/types/modal.type.d.ts +5 -2
- package/es/components/source/src/hooks/useFetch.d.ts +2 -2
- package/es/components/source/src/hooks/useSource.d.ts +8 -8
- package/es/components/source/src/types/table.type.d.ts +1 -1
- package/es/components/table/src/components/TableActions.d.ts +2 -2
- package/es/components/table/src/components/TableHeader.d.ts +2 -2
- package/es/components/table/src/components/editable/CellComponent.d.ts +14 -0
- package/es/components/table/src/components/editable/EditTableCell.d.ts +88 -0
- package/es/components/table/src/components/editable/componentMap.d.ts +4 -0
- package/es/components/table/src/components/editable/index.d.ts +9 -0
- 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/useCustomRow.d.ts +19 -0
- package/es/components/table/src/index.d.ts +29 -6
- package/es/components/table/src/props.d.ts +5 -1
- package/es/components/table/src/types/table.type.d.ts +16 -0
- package/es/components/tree/index.d.ts +2 -0
- package/es/components/tree/src/hooks/useTree.d.ts +14 -0
- package/es/components/tree/src/props.d.ts +101 -0
- package/es/components/tree/src/type/tree.d.ts +85 -0
- package/es/components/tree/src/utils/tree.d.ts +5 -0
- package/es/components/upload/index.d.ts +3 -0
- package/es/components/upload/src/helper.d.ts +4 -0
- package/es/components/upload/src/index.d.ts +2807 -0
- package/es/components/upload/src/props.d.ts +40 -0
- package/es/components/upload/src/upload.d.ts +1653 -0
- package/es/index.js +2113 -270
- package/es/style/components/forms/index.less +23 -0
- package/es/style/components/table/index.less +8 -2
- package/es/style/components/tree/index.less +41 -0
- package/es/style/components/upload/index.less +43 -0
- package/es/style/theme/header/index.less +1 -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 +2 -1
- package/src/components/curd/src/components/dialog.vue +7 -4
- package/src/components/curd/src/hooks/useCurd.tsx +1 -1
- package/src/components/forms/index.less +23 -0
- package/src/components/forms/src/componentMap.ts +2 -0
- package/src/components/forms/src/components/formInputUseDialog.vue +43 -0
- package/src/components/forms/src/components/formItem.vue +25 -12
- package/src/components/forms/src/hooks/useFormEvents.ts +4 -3
- package/src/components/forms/src/hooks/useFormValues.ts +1 -1
- package/src/components/forms/src/types/form.type.ts +9 -3
- package/src/components/index.ts +9 -3
- package/src/components/modal/src/hooks/useModal.ts +12 -4
- package/src/components/modal/src/index.vue +2 -2
- package/src/components/modal/src/types/modal.type.ts +5 -2
- package/src/components/source/src/hooks/useFetch.ts +10 -6
- package/src/components/source/src/hooks/useSource.ts +33 -12
- package/src/components/source/src/types/table.type.ts +1 -1
- package/src/components/table/index.less +8 -2
- package/src/components/table/src/components/TableHeader.vue +2 -2
- package/src/components/table/src/components/editable/CellComponent.ts +57 -0
- package/src/components/table/src/components/editable/EditTableCell.vue +181 -0
- package/src/components/table/src/components/editable/componentMap.ts +18 -0
- package/src/components/table/src/components/editable/index.ts +58 -0
- package/src/components/table/src/hooks/useColumns.ts +15 -8
- package/src/components/table/src/hooks/useCustomRow.ts +86 -0
- package/src/components/table/src/hooks/useDataSource.ts +0 -13
- package/src/components/table/src/hooks/useTableHeader.ts +2 -2
- package/src/components/table/src/index.vue +20 -3
- package/src/components/table/src/props.ts +4 -1
- package/src/components/table/src/types/table.type.ts +28 -1
- package/src/components/tree/index.less +41 -0
- package/src/components/tree/index.ts +5 -0
- package/src/components/tree/src/components/TreeHeader.vue +97 -0
- package/src/components/tree/src/hooks/useTree.ts +239 -0
- package/src/components/tree/src/index.vue +392 -0
- package/src/components/tree/src/props.ts +133 -0
- package/src/components/tree/src/type/tree.ts +105 -0
- package/src/components/tree/src/utils/tree.ts +73 -0
- package/src/components/upload/index.less +43 -0
- package/src/components/upload/index.ts +7 -0
- package/src/components/upload/src/helper.ts +32 -0
- package/src/components/upload/src/index.vue +38 -0
- package/src/components/upload/src/props.ts +48 -0
- package/src/components/upload/src/upload.vue +166 -0
- package/src/theme/header/helper/menu-tree.ts +2 -2
- package/src/theme/header/index.less +1 -1
- package/src/theme/sider/helper/split-menu.ts +2 -2
- package/es/components/dialog/index.d.ts +0 -2
- package/es/components/dialog/src/hooks/useDialog.d.ts +0 -3
- package/src/components/dialog/index.ts +0 -5
- package/src/components/dialog/src/hooks/useDialog.ts +0 -85
|
@@ -80,5 +80,28 @@
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
.input-with-dialog{
|
|
84
|
+
position: relative;
|
|
85
|
+
span{
|
|
86
|
+
background: none;
|
|
87
|
+
cursor: pointer;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
i{
|
|
91
|
+
position: absolute;
|
|
92
|
+
right: 15px;
|
|
93
|
+
top: 0;
|
|
94
|
+
bottom: 0;
|
|
95
|
+
margin: auto;
|
|
96
|
+
line-height: 32px;
|
|
97
|
+
opacity: 0.3;
|
|
98
|
+
cursor: pointer;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.ant-input{
|
|
102
|
+
color: #333;
|
|
103
|
+
cursor: pointer;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
83
106
|
|
|
84
107
|
|
|
@@ -77,8 +77,8 @@
|
|
|
77
77
|
display: inline-block;
|
|
78
78
|
vertical-align: middle;
|
|
79
79
|
cursor: pointer;
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
i{
|
|
81
|
+
color: @primary-color;
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
|
|
@@ -171,3 +171,9 @@
|
|
|
171
171
|
color: #333;
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
|
+
|
|
175
|
+
.edit-cell-rule-popover .ant-popover-inner-content{
|
|
176
|
+
padding: 4px 8px;
|
|
177
|
+
color: #ed6f6f;
|
|
178
|
+
border-radius: 2px;
|
|
179
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
.dt-tree{
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
height: 100%;
|
|
5
|
+
|
|
6
|
+
.dt-tree-header{
|
|
7
|
+
.headerTitle{
|
|
8
|
+
text-align: center;
|
|
9
|
+
line-height: 32px;
|
|
10
|
+
font-weight: bolder;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.dt-tree-search{
|
|
14
|
+
display: flex;
|
|
15
|
+
padding: 0 0 10px 10px;
|
|
16
|
+
border-bottom: 1px solid #e7e7e7;
|
|
17
|
+
&>i{
|
|
18
|
+
width: 24px;
|
|
19
|
+
display: block;
|
|
20
|
+
text-align: center;
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
}
|
|
23
|
+
.dt-tree-search-input{
|
|
24
|
+
flex: 1;
|
|
25
|
+
input{
|
|
26
|
+
font-size: 12px;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.ant-spin-nested-loading{
|
|
33
|
+
flex: 1;
|
|
34
|
+
overflow-y: auto;
|
|
35
|
+
padding: 10px 0;
|
|
36
|
+
|
|
37
|
+
.tree-title{
|
|
38
|
+
font-size: 12px;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
.dt-upload-wrap{
|
|
2
|
+
height: 350px;
|
|
3
|
+
padding: 10px 20px;
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
|
|
7
|
+
.ant-table-wrapper{
|
|
8
|
+
flex: 1;
|
|
9
|
+
.ant-table-body{
|
|
10
|
+
border-bottom: 1px solid #e7e7e7;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.file-header{
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: row;
|
|
18
|
+
justify-content: space-between;
|
|
19
|
+
&>div{
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: row;
|
|
22
|
+
button{
|
|
23
|
+
margin-right: 10px;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.file-type-tips{
|
|
29
|
+
line-height: 24px;
|
|
30
|
+
padding: 5px 10px;
|
|
31
|
+
font-size: 12px;
|
|
32
|
+
display: flex;
|
|
33
|
+
margin: 10px 0;
|
|
34
|
+
border: 1px dashed @primary-color;
|
|
35
|
+
cursor: inherit;
|
|
36
|
+
span i{
|
|
37
|
+
color: @primary-color;
|
|
38
|
+
margin-right: 7px;
|
|
39
|
+
}
|
|
40
|
+
i{
|
|
41
|
+
color: #666;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -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" | "multiple" | "selectable" | "inlineCollapsed" | "disabledOverflow" | "forceSubMenuRender" | "theme" | "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
|
-
theme: import("@dt-frames/core").Theme;
|
|
746
|
-
isHorizontal: boolean;
|
|
747
745
|
inlineCollapsed: boolean;
|
|
746
|
+
theme: import("@dt-frames/core").Theme;
|
|
748
747
|
inlineIndent: number;
|
|
748
|
+
isHorizontal: boolean;
|
|
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" | "arrow" | "forceRender" | "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" | "multiple" | "selectable" | "inlineCollapsed" | "disabledOverflow" | "forceSubMenuRender" | "theme" | "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.12",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"ui",
|
|
6
6
|
"dt-ui"
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"@vueuse/core": "^7.5.2",
|
|
33
33
|
"lodash-es": "^4.17.21",
|
|
34
34
|
"sortablejs": "^1.15.0",
|
|
35
|
+
"spark-md5": "^3.0.2",
|
|
35
36
|
"vue": "^3.2.25",
|
|
36
37
|
"vue-router": "^4.0.12",
|
|
37
38
|
"xlsx": "^0.18.5"
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
...{
|
|
19
19
|
onRegister: { type: Function },
|
|
20
20
|
formProps: {
|
|
21
|
-
type: Object as PropType<
|
|
21
|
+
type: Object as PropType<Partial<FormProps>>,
|
|
22
|
+
default: () => ({})
|
|
22
23
|
},
|
|
23
24
|
formsVal: {
|
|
24
25
|
type: Object as PropType<Ref<Recordable>>
|
|
@@ -26,7 +27,7 @@
|
|
|
26
27
|
}
|
|
27
28
|
} )
|
|
28
29
|
|
|
29
|
-
const [registerDialog] = useModal({
|
|
30
|
+
const [registerDialog, { closeModal }] = useModal({
|
|
30
31
|
...omit(toRaw(props), [
|
|
31
32
|
'actions',
|
|
32
33
|
'curd',
|
|
@@ -39,7 +40,7 @@
|
|
|
39
40
|
})
|
|
40
41
|
|
|
41
42
|
const [ registerForm, { getFormValues, setFormValues } ] = useForm({
|
|
42
|
-
...( props.formProps
|
|
43
|
+
...( props.formProps || {} ),
|
|
43
44
|
schemas: props.schemas,
|
|
44
45
|
mode: 'dialog'
|
|
45
46
|
})
|
|
@@ -63,9 +64,11 @@
|
|
|
63
64
|
getFormValues()
|
|
64
65
|
)
|
|
65
66
|
|
|
66
|
-
obj.id
|
|
67
|
+
let pro = obj.id
|
|
67
68
|
? props.curd.onUpdate( obj )
|
|
68
69
|
: props.curd.onAdd( obj )
|
|
70
|
+
|
|
71
|
+
pro.then( rsp => closeModal() )
|
|
69
72
|
}
|
|
70
73
|
}
|
|
71
74
|
</script>
|
|
@@ -80,5 +80,28 @@
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
.input-with-dialog{
|
|
84
|
+
position: relative;
|
|
85
|
+
span{
|
|
86
|
+
background: none;
|
|
87
|
+
cursor: pointer;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
i{
|
|
91
|
+
position: absolute;
|
|
92
|
+
right: 15px;
|
|
93
|
+
top: 0;
|
|
94
|
+
bottom: 0;
|
|
95
|
+
margin: auto;
|
|
96
|
+
line-height: 32px;
|
|
97
|
+
opacity: 0.3;
|
|
98
|
+
cursor: pointer;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.ant-input{
|
|
102
|
+
color: #333;
|
|
103
|
+
cursor: pointer;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
83
106
|
|
|
84
107
|
|
|
@@ -3,10 +3,12 @@ import { Component } from "vue"
|
|
|
3
3
|
import { Input, Select, Radio, Checkbox, AutoComplete, Cascader, DatePicker, InputNumber, Switch, TimePicker, TreeSelect, Slider, Rate, Divider } from 'ant-design-vue'
|
|
4
4
|
import RadioButtonGroup from './components/radioButton.vue'
|
|
5
5
|
import FormIcon from './components/formIcon.vue'
|
|
6
|
+
import formInputUseDialog from './components/formInputUseDialog.vue'
|
|
6
7
|
import { ComponentType } from "./types/form.type"
|
|
7
8
|
|
|
8
9
|
const components = {
|
|
9
10
|
Input,
|
|
11
|
+
InputWithDialog: formInputUseDialog,
|
|
10
12
|
InputTextArea: Input.TextArea,
|
|
11
13
|
InputSearch: Input.Search,
|
|
12
14
|
InputGroup: Input.Group,
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="input-with-dialog">
|
|
3
|
+
<div @click="onClickInput">
|
|
4
|
+
<Input v-bind="bindProps"></Input>
|
|
5
|
+
</div>
|
|
6
|
+
<i class="i mdi:close-circle" @click="clearProps"></i>
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script lang="ts" setup>
|
|
11
|
+
import { computed, useAttrs } from 'vue'
|
|
12
|
+
import { Input } from 'ant-design-vue'
|
|
13
|
+
import { omit } from 'lodash-es'
|
|
14
|
+
import { error, isFunction } from '@dt-frames/core'
|
|
15
|
+
|
|
16
|
+
const attrs = useAttrs()
|
|
17
|
+
|
|
18
|
+
const bindProps = computed(() => {
|
|
19
|
+
return {
|
|
20
|
+
...omit(attrs, [
|
|
21
|
+
'formValues'
|
|
22
|
+
]),
|
|
23
|
+
disabled: true
|
|
24
|
+
}
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
function onClickInput() {
|
|
28
|
+
const { model, schema = { } } = attrs.formValues as any
|
|
29
|
+
|
|
30
|
+
if( !schema.openDialog || !isFunction(schema.openDialog) ) {
|
|
31
|
+
error('openDialog必须是函数')
|
|
32
|
+
return
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
schema.openDialog( model )
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function clearProps() {
|
|
39
|
+
const { model, schema = { } } = attrs.formValues as any
|
|
40
|
+
[...schema.linkProps, schema.name].forEach( it => model[it] = null )
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
</script>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { defineComponent, PropType, Ref, toRefs, unref, computed } from "vue"
|
|
3
3
|
import { Col, Tooltip, Divider, Form, FormItem } from 'ant-design-vue'
|
|
4
4
|
import { upperFirst, cloneDeep } from 'lodash-es'
|
|
5
|
-
import { isFunction, isBoolean, isNull, Recordable, useSlots, useAppStore, isString, isArray } from "@dt-frames/core"
|
|
5
|
+
import { isFunction, isBoolean, isNull, Recordable, useSlots, useAppStore, isString, isArray, error } from "@dt-frames/core"
|
|
6
6
|
import type { ValidationRule } from 'ant-design-vue/lib/form/Form'
|
|
7
7
|
|
|
8
8
|
import { useLabelWidth } from "../hooks/useLabelWidth"
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
const { defaultValues, formModel, schema } = props;
|
|
33
33
|
|
|
34
34
|
return {
|
|
35
|
-
name: schema.name,
|
|
35
|
+
name: (schema as FormSchema).name,
|
|
36
36
|
model: formModel,
|
|
37
37
|
values: {
|
|
38
38
|
...defaultValues,
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
|
|
45
45
|
// 是否显示当前条目
|
|
46
46
|
const getShow = computed(() => {
|
|
47
|
-
const { show = true, isAdvanced = true } = props.schema
|
|
47
|
+
const { show = true, isAdvanced = true } = props.schema as FormSchema
|
|
48
48
|
|
|
49
49
|
// 是否处于收缩状态
|
|
50
50
|
if( !isAdvanced ) {
|
|
@@ -61,13 +61,13 @@
|
|
|
61
61
|
// 设置表单绑定的特殊属性,如前后缀、禁用启用、日期格式等
|
|
62
62
|
const getComponentProps = computed(() => {
|
|
63
63
|
const { schema, formModel, formActionType } = props
|
|
64
|
-
let { props: cProps = {} } = schema
|
|
64
|
+
let { props: cProps = {} } = schema as FormSchema
|
|
65
65
|
|
|
66
66
|
if (isFunction(cProps)) {
|
|
67
67
|
cProps = cProps( { schema, formModel, formActionType } ) ?? {}
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
if (schema.component === 'Divider') {
|
|
70
|
+
if ((schema as FormSchema).component === 'Divider') {
|
|
71
71
|
cProps = Object.assign({ type: 'horizontal' }, cProps, {
|
|
72
72
|
orientation: 'left',
|
|
73
73
|
plain: true,
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
* 支持的类型参照 ../types/form.type.ts 中 ComponentType
|
|
84
84
|
*/
|
|
85
85
|
function renderItem() {
|
|
86
|
-
const { component, props: cProps, slot, render, name, colon = appConf.ui.form.colon, suffix } = props.schema
|
|
86
|
+
const { component, props: cProps, slot, render, name, colon = appConf.ui.form.colon, suffix } = props.schema as FormSchema
|
|
87
87
|
|
|
88
88
|
// 计算label的属性
|
|
89
89
|
const { labelCol, wrapperCol } = unref( useLabelWidth( schema, formProps ) )
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
* 渲染Label标签元素
|
|
140
140
|
*/
|
|
141
141
|
function renderLabel() {
|
|
142
|
-
const { label, toolTip, subLabel, toolTipProps } = props.schema
|
|
142
|
+
const { label, toolTip, subLabel, toolTipProps } = props.schema as FormSchema
|
|
143
143
|
|
|
144
144
|
const renderLabel
|
|
145
145
|
= subLabel
|
|
@@ -164,7 +164,7 @@
|
|
|
164
164
|
*/
|
|
165
165
|
function renderFormItem() {
|
|
166
166
|
const { schema, formModel, formActionType } = props
|
|
167
|
-
const { component, name, changeEvent = 'change', valueField, renderComponent, props: sProps } = props.schema
|
|
167
|
+
const { component, name, changeEvent = 'change', valueField, renderComponent, props: sProps } = props.schema as FormSchema
|
|
168
168
|
|
|
169
169
|
const isCheck = component && ['Switch', 'Checkbox'].includes(component)
|
|
170
170
|
|
|
@@ -216,7 +216,7 @@
|
|
|
216
216
|
// 设置表单禁用启用
|
|
217
217
|
const getDisable = computed(() => {
|
|
218
218
|
const { disabled: gDisabled } = props.formProps as FormProps
|
|
219
|
-
const { dynamicDisabled } = props.schema
|
|
219
|
+
const { dynamicDisabled } = props.schema as FormSchema
|
|
220
220
|
const { disabled: itemDisabled = false } = unref( getComponentProps )
|
|
221
221
|
|
|
222
222
|
let disabled = !!gDisabled || itemDisabled
|
|
@@ -261,7 +261,7 @@
|
|
|
261
261
|
/**
|
|
262
262
|
* 所有属性汇总,包括方法、属性及值的绑定
|
|
263
263
|
*/
|
|
264
|
-
|
|
264
|
+
let compAttr: Recordable = {
|
|
265
265
|
...itemProps,
|
|
266
266
|
...bindValue,
|
|
267
267
|
...on
|
|
@@ -288,7 +288,7 @@
|
|
|
288
288
|
* 处理验证规则
|
|
289
289
|
*/
|
|
290
290
|
function handleRules(): ValidationRule[] {
|
|
291
|
-
const { rules: defaultRules = [], component, label, dynamicRules, required } = props.schema
|
|
291
|
+
const { rules: defaultRules = [], component, label, dynamicRules, required } = props.schema as FormSchema
|
|
292
292
|
|
|
293
293
|
// 1、如果为动态规则,则直接返回rules
|
|
294
294
|
if( isFunction( dynamicRules ) ) {
|
|
@@ -377,7 +377,7 @@
|
|
|
377
377
|
* 3、否则通过属性去动态设置渲染条目
|
|
378
378
|
*/
|
|
379
379
|
return () => {
|
|
380
|
-
const { colSlot, renderCol, colProps } = props.schema
|
|
380
|
+
const { colSlot, renderCol, colProps, component, render } = props.schema as FormSchema
|
|
381
381
|
const { colProps: gColProps, mode } = props.formProps as FormProps
|
|
382
382
|
|
|
383
383
|
let _colProps = colProps
|
|
@@ -388,6 +388,19 @@
|
|
|
388
388
|
|
|
389
389
|
const values = unref(getValues)
|
|
390
390
|
|
|
391
|
+
if( !component ) {
|
|
392
|
+
if( !render ) {
|
|
393
|
+
error('请配置render函数')
|
|
394
|
+
return
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
return (
|
|
398
|
+
<Col span={24}>
|
|
399
|
+
{ render() }
|
|
400
|
+
</Col>
|
|
401
|
+
)
|
|
402
|
+
}
|
|
403
|
+
|
|
391
404
|
const getContent = () => {
|
|
392
405
|
return colSlot
|
|
393
406
|
? getSlot(slots, colSlot, values)
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { deepMerge, isObject, isString, Recordable } from "@dt-frames/core"
|
|
2
2
|
import { ComputedRef, nextTick, Ref, toRaw, unref } from "vue"
|
|
3
3
|
import { uniqBy, cloneDeep } from 'lodash-es'
|
|
4
4
|
import { FormActionType, FormProps, FormSchema } from "../types/form.type"
|
|
5
5
|
import { handleInputNumberValue } from "./helper"
|
|
6
|
+
import dayjs from 'dayjs'
|
|
6
7
|
|
|
7
8
|
/** =================================
|
|
8
9
|
* 定义表单的事件
|
|
@@ -166,7 +167,7 @@ export function useFormEvents({
|
|
|
166
167
|
if (Array.isArray(value)) {
|
|
167
168
|
const arr: any[] = [];
|
|
168
169
|
for (const ele of value) {
|
|
169
|
-
arr.push(ele ?
|
|
170
|
+
arr.push(ele ? dayjs(ele) : null);
|
|
170
171
|
}
|
|
171
172
|
formModel[key] = arr;
|
|
172
173
|
} else {
|
|
@@ -177,7 +178,7 @@ export function useFormEvents({
|
|
|
177
178
|
if (typeof props === 'function') {
|
|
178
179
|
_props = props({ formModel });
|
|
179
180
|
}
|
|
180
|
-
|
|
181
|
+
formModel[key] = value ? (_props?.valueFormat ? value : dayjs(value)) : null
|
|
181
182
|
}
|
|
182
183
|
} else {
|
|
183
184
|
formModel[key] = value
|
|
@@ -19,6 +19,7 @@ export type FormCallBackParams = {
|
|
|
19
19
|
// 组件的类型
|
|
20
20
|
export type ComponentType =
|
|
21
21
|
| 'Input'
|
|
22
|
+
| 'InputWithDialog'
|
|
22
23
|
| 'InputGroup'
|
|
23
24
|
| 'InputPassword'
|
|
24
25
|
| 'InputSearch'
|
|
@@ -155,7 +156,7 @@ export type FormProps = {
|
|
|
155
156
|
// 表单当个元素配置项
|
|
156
157
|
export type FormSchema = {
|
|
157
158
|
// 表单绑定的属性,亦作为name属性,用于后期自动化测试
|
|
158
|
-
name
|
|
159
|
+
name?: string | string[]
|
|
159
160
|
// 值发生变化触发的函数名
|
|
160
161
|
changeEvent?: string
|
|
161
162
|
// 绑定v-model的值
|
|
@@ -176,7 +177,7 @@ export type FormSchema = {
|
|
|
176
177
|
// tooltip 配置信息
|
|
177
178
|
toolTipProps?: ToolTipProps
|
|
178
179
|
// 表单控件类型
|
|
179
|
-
component
|
|
180
|
+
component?: ComponentType
|
|
180
181
|
// 表单控件参数
|
|
181
182
|
props?:
|
|
182
183
|
| ((opt: {
|
|
@@ -205,7 +206,7 @@ export type FormSchema = {
|
|
|
205
206
|
show?: boolean | ( ( parms: FormCallBackParams ) => boolean )
|
|
206
207
|
|
|
207
208
|
// 渲染item
|
|
208
|
-
render?: (parms
|
|
209
|
+
render?: (parms?: FormCallBackParams) => VNode | VNode[] | string
|
|
209
210
|
|
|
210
211
|
// 渲染col
|
|
211
212
|
renderCol?: (parms: FormCallBackParams) => VNode | VNode[] | string
|
|
@@ -236,6 +237,11 @@ export type FormSchema = {
|
|
|
236
237
|
|
|
237
238
|
// 是否处于收缩状态 仅在 search 模式下使用
|
|
238
239
|
isAdvanced?: boolean
|
|
240
|
+
|
|
241
|
+
// 只有当类型为inputWithDialog 是否才有此属性
|
|
242
|
+
openDialog?: (parms: Recordable) => void
|
|
243
|
+
// 点击删除按钮需要清空的属性
|
|
244
|
+
linkProps?: string[]
|
|
239
245
|
}
|
|
240
246
|
|
|
241
247
|
|
package/src/components/index.ts
CHANGED
|
@@ -8,7 +8,8 @@ import { useSource } from './source'
|
|
|
8
8
|
import { useCurd } from './curd'
|
|
9
9
|
import { export2Excel } from './excel'
|
|
10
10
|
import { DtIframe } from './iframe'
|
|
11
|
-
import {
|
|
11
|
+
import { DtUpload, DtUploadModal } from './upload'
|
|
12
|
+
import { DtTree } from './tree'
|
|
12
13
|
|
|
13
14
|
const dtComponents = [
|
|
14
15
|
{ name: 'dt-base-router', component: DtBaseRouter },
|
|
@@ -16,6 +17,9 @@ const dtComponents = [
|
|
|
16
17
|
{ name: 'dt-pick-icon', component: DtPickIcon },
|
|
17
18
|
{ name: 'dt-modal', component: DtModal },
|
|
18
19
|
{ name: 'dt-form', component: DtForm },
|
|
20
|
+
{ name: 'dt-upload', component: DtUpload },
|
|
21
|
+
{ name: 'dt-upload-modal', component: DtUploadModal },
|
|
22
|
+
{ name: 'dt-tree', component: DtTree },
|
|
19
23
|
];
|
|
20
24
|
|
|
21
25
|
|
|
@@ -37,12 +41,14 @@ export {
|
|
|
37
41
|
DtTable,
|
|
38
42
|
FormButtons,
|
|
39
43
|
DtIframe,
|
|
44
|
+
DtUpload,
|
|
45
|
+
DtUploadModal,
|
|
46
|
+
DtTree,
|
|
40
47
|
useForm,
|
|
41
48
|
useTable,
|
|
42
49
|
useSource,
|
|
43
50
|
useCurd,
|
|
44
51
|
useModal,
|
|
45
52
|
useModalOut,
|
|
46
|
-
export2Excel
|
|
47
|
-
useDialog
|
|
53
|
+
export2Excel
|
|
48
54
|
}
|
|
@@ -61,7 +61,13 @@ export function useModalOut(): UseModalReturnType{
|
|
|
61
61
|
getInstance()?.redoModalHeight?.()
|
|
62
62
|
},
|
|
63
63
|
|
|
64
|
-
openModal: (
|
|
64
|
+
openModal: (
|
|
65
|
+
params?: {
|
|
66
|
+
data?: Recordable,
|
|
67
|
+
afterClose?: ( data: Recordable ) => void
|
|
68
|
+
},
|
|
69
|
+
openOnSet = true
|
|
70
|
+
) => {
|
|
65
71
|
getInstance()?.setModalProps({
|
|
66
72
|
visible: true
|
|
67
73
|
})
|
|
@@ -155,10 +161,11 @@ export function useModal(props?: Partial<ModalProps>,callbackFn?: Function): Use
|
|
|
155
161
|
getVisible: computed(() => visibleData[~~unref(uidRef)]),
|
|
156
162
|
|
|
157
163
|
// 关闭弹框进行回调
|
|
158
|
-
closeModal: (rsp
|
|
159
|
-
cbTransfer[unref(uidRef)](rsp)
|
|
160
|
-
getInstance()?.setModalProps({ visible: false })
|
|
164
|
+
closeModal: (rsp?: Recordable) => {
|
|
165
|
+
if(cbTransfer[unref(uidRef)]) cbTransfer[unref(uidRef)](rsp)
|
|
166
|
+
getInstance()?.setModalProps({ visible: false })
|
|
161
167
|
},
|
|
168
|
+
|
|
162
169
|
openModal: <T = any>(visable = true, data?: T, openOnSet = true) => {
|
|
163
170
|
getInstance()?.setModalProps({
|
|
164
171
|
visible: visable
|
|
@@ -178,6 +185,7 @@ export function useModal(props?: Partial<ModalProps>,callbackFn?: Function): Use
|
|
|
178
185
|
dataTransfer[id] = toRaw(data);
|
|
179
186
|
}
|
|
180
187
|
},
|
|
188
|
+
|
|
181
189
|
setModalProps: (props: Partial<ModalProps>) => {
|
|
182
190
|
getInstance()?.setModalProps(props);
|
|
183
191
|
},
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
const { getWrapClassName, toggleFullScreen, fullScreenRef } = useFullScreen({
|
|
83
|
-
wrapClassName: computed(() => (unref(propsRef) as any)
|
|
83
|
+
wrapClassName: computed(() => (unref(propsRef) as any)?.wrapClassName),
|
|
84
84
|
extHeightRef,
|
|
85
85
|
modalWrapperRef
|
|
86
86
|
});
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
// 弹框保存
|
|
149
149
|
function handleSave() {
|
|
150
150
|
emits('save')
|
|
151
|
-
handleCancel()
|
|
151
|
+
// handleCancel()
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
// 弹框关闭
|
|
@@ -8,14 +8,17 @@ export type ModalMethods = {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export interface ReturnMethods extends ModalMethods{
|
|
11
|
-
openModal:
|
|
11
|
+
openModal: (data?: {
|
|
12
|
+
data?: Recordable,
|
|
13
|
+
afterClose?: ( data: Recordable ) => void
|
|
14
|
+
}, openOnSet?: boolean) => void
|
|
12
15
|
closeModal: () => void
|
|
13
16
|
getVisible?: ComputedRef<boolean>
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
export interface ReturnInnerMethods extends ModalMethods {
|
|
17
20
|
openModal: <T = any>(props?: boolean, data?: T, openOnSet?: boolean) => void
|
|
18
|
-
closeModal: (rsp
|
|
21
|
+
closeModal: (rsp?: Recordable) => void
|
|
19
22
|
changeLoading: (loading: boolean) => void
|
|
20
23
|
getVisible?: ComputedRef<boolean>
|
|
21
24
|
redoModalHeight: () => void
|