Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
najiu-admin-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
najiu-frontend
najiu-admin-template
Commits
5091a875
Commit
5091a875
authored
Jan 02, 2021
by
vben
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(modal): add minHeight and height prop #156
parent
5c273534
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
13 deletions
+21
-13
BasicForm.vue
src/components/Form/src/BasicForm.vue
+1
-11
useFormValues.ts
src/components/Form/src/hooks/useFormValues.ts
+7
-1
BasicModal.vue
src/components/Modal/src/BasicModal.vue
+2
-0
ModalWrapper.vue
src/components/Modal/src/components/ModalWrapper.vue
+6
-1
props.ts
src/components/Modal/src/props.ts
+2
-0
types.ts
src/components/Modal/src/types.ts
+3
-0
No files found.
src/components/Form/src/BasicForm.vue
View file @
5091a875
...
...
@@ -31,17 +31,7 @@
import
type
{
AdvanceState
}
from
'
./types/hooks
'
;
import
type
{
CSSProperties
,
Ref
,
WatchStopHandle
}
from
'
vue
'
;
import
{
defineComponent
,
reactive
,
ref
,
computed
,
unref
,
onMounted
,
watch
,
toRefs
,
toRaw
,
}
from
'
vue
'
;
import
{
defineComponent
,
reactive
,
ref
,
computed
,
unref
,
onMounted
,
watch
,
toRefs
}
from
'
vue
'
;
import
{
Form
,
Row
}
from
'
ant-design-vue
'
;
import
FormItem
from
'
./components/FormItem
'
;
import
FormAction
from
'
./components/FormAction.vue
'
;
...
...
src/components/Form/src/hooks/useFormValues.ts
View file @
5091a875
import
{
isArray
,
isFunction
,
isObject
,
isString
}
from
'
/@/utils/is
'
;
import
moment
from
'
moment
'
;
import
{
unref
}
from
'
vue
'
;
import
{
unref
,
nextTick
}
from
'
vue
'
;
import
type
{
Ref
,
ComputedRef
}
from
'
vue
'
;
import
type
{
FieldMapToTime
,
FormSchema
}
from
'
../types/form
'
;
import
{
useModalContext
}
from
'
/@/components/Modal
'
;
interface
UseFormValuesContext
{
transformDateFuncRef
:
Ref
<
Fn
>
;
...
...
@@ -18,6 +19,7 @@ export function useFormValues({
getSchema
,
formModel
,
}:
UseFormValuesContext
)
{
const
modalFn
=
useModalContext
();
// Processing form values
function
handleFormValues
(
values
:
Recordable
)
{
if
(
!
isObject
(
values
))
{
...
...
@@ -81,6 +83,10 @@ export function useFormValues({
}
});
defaultValueRef
.
value
=
obj
;
nextTick
(()
=>
{
// Solve the problem of modal adaptive height calculation when the form is placed in the modal
modalFn
?.
redoModalHeight
?.();
});
}
return
{
handleFormValues
,
initDefault
};
...
...
src/components/Modal/src/BasicModal.vue
View file @
5091a875
...
...
@@ -23,6 +23,8 @@
:fullScreen=
"fullScreenRef"
ref=
"modalWrapperRef"
:loading=
"getProps.loading"
:minHeight=
"getProps.minHeight"
:height=
"getProps.height"
:visible=
"visibleRef"
:modalFooterHeight=
"footer !== undefined && !footer ? 0 : undefined"
v-bind=
"omit(getProps.wrapperProps, 'visible')"
...
...
src/components/Modal/src/components/ModalWrapper.vue
View file @
5091a875
...
...
@@ -38,6 +38,7 @@
modalHeaderHeight
:
propTypes
.
number
.
def
(
50
),
modalFooterHeight
:
propTypes
.
number
.
def
(
54
),
minHeight
:
propTypes
.
number
.
def
(
200
),
height
:
propTypes
.
number
,
footerOffset
:
propTypes
.
number
.
def
(
0
),
visible
:
propTypes
.
bool
,
fullScreen
:
propTypes
.
bool
,
...
...
@@ -142,7 +143,11 @@
realHeightRef
.
value
=
window
.
innerHeight
-
props
.
modalFooterHeight
-
props
.
modalHeaderHeight
;
}
else
{
realHeightRef
.
value
=
realHeight
>
maxHeight
?
maxHeight
:
realHeight
+
16
+
30
;
realHeightRef
.
value
=
props
.
height
?
props
.
height
:
realHeight
>
maxHeight
?
maxHeight
:
realHeight
+
16
+
30
;
}
emit
(
'
height-change
'
,
unref
(
realHeightRef
));
}
catch
(
error
)
{
...
...
src/components/Modal/src/props.ts
View file @
5091a875
...
...
@@ -8,6 +8,8 @@ const { t } = useI18n();
export
const
modalProps
=
{
visible
:
propTypes
.
bool
,
height
:
propTypes
.
number
,
minHeight
:
propTypes
.
number
,
// open drag
draggable
:
propTypes
.
bool
.
def
(
true
),
centered
:
propTypes
.
bool
,
...
...
src/components/Modal/src/types.ts
View file @
5091a875
...
...
@@ -27,6 +27,8 @@ export interface ReturnInnerMethods extends ModalMethods {
export
type
UseModalInnerReturnType
=
[
RegisterFn
,
ReturnInnerMethods
];
export
interface
ModalProps
{
minHeight
?:
number
;
height
?:
number
;
// 启用wrapper后 底部可以适当增加高度
wrapperFooterOffset
?:
number
;
draggable
?:
boolean
;
...
...
@@ -195,6 +197,7 @@ export interface ModalWrapperProps {
modalHeaderHeight
:
number
;
modalFooterHeight
:
number
;
minHeight
:
number
;
height
:
number
;
visible
:
boolean
;
fullScreen
:
boolean
;
useWrapper
:
boolean
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment