Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
田翔
xform
Commits
88e26158
Commit
88e26158
authored
Nov 15, 2024
by
彭俊龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
描述控件新增跟随字段隐藏
parent
46d16d2f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
65 additions
and
2 deletions
+65
-2
settings.js
src/core/FormDesigner/config/settings.js
+5
-0
index.js
src/core/FormRender/index.js
+20
-0
index.js
src/core/widgets/settings/groupBase/FollowFieldHide/index.js
+35
-0
index.less
...ore/widgets/settings/groupBase/FollowFieldHide/index.less
+0
-0
index.js
src/core/widgets/settings/groupBase/index.js
+3
-0
index.js
src/core/widgets/text/TextHTML/index.js
+2
-2
No files found.
src/core/FormDesigner/config/settings.js
View file @
88e26158
...
...
@@ -77,6 +77,11 @@ const layoutWidgets = [
hidden
:
"{{formData.isText}}"
,
dependencies
:
[
'IsText'
],
},
hideKey
:{
title
:
'跟随字段同步隐藏'
,
type
:
'string'
,
widget
:
'FollowFieldHide'
,
},
styleHTML
:
{
title
:
'控件样式'
,
type
:
'object'
,
...
...
src/core/FormRender/index.js
View file @
88e26158
...
...
@@ -43,13 +43,24 @@ const XRender = (props, ref) => {
const
schemaForm
=
useMemo
(()
=>
{
let
schemaForm
=
formJson
?
(
isObject
(
formJson
)
?
formJson
:
JSON
.
parse
(
formJson
))
:
{}
console
.
log
(
schemaForm
,
'schemaForm'
);
let
parent
=
schemaForm
?.
properties
let
keys
=
Object
.
keys
(
parent
);
let
parentDatas
=
keys
.
map
(
k
=>
parent
[
k
].
properties
)
let
fieldDatas
=
{};
parentDatas
.
forEach
(
k
=>
{
let
ks
=
Object
.
keys
(
k
)
ks
.
map
(
x
=>
fieldDatas
[
x
]
=
k
[
x
])
})
console
.
log
(
fieldDatas
,
'datasdatas'
);
let
parentObj
=
{}
let
array
=
[]
if
(
isObject
(
parent
))
{
for
(
let
v
in
parent
)
{
let
hidden
=
true
let
child
=
parent
[
v
]?.
properties
let
childObj
=
{}
if
(
isObject
(
child
))
{
for
(
let
s
in
child
)
{
...
...
@@ -80,6 +91,15 @@ const XRender = (props, ref) => {
if
(
child
[
s
].
isDoing
)
{
array
.
push
(
s
)
}
if
(
child
[
s
].
widget
===
'TextHTML'
&&
child
[
s
]?.
hideKey
){
const
hideKey
=
child
[
s
]?.
hideKey
if
(
fieldDatas
.
hasOwnProperty
(
hideKey
)){
const
followData
=
fieldDatas
[
hideKey
];
if
(
followData
){
child
[
s
].
hidden
=
followData
.
hidden
;
}
}
}
childObj
[
s
]
=
{
...
child
[
s
],
title
:
[
'RelationForm'
,
'AreaTask'
].
includes
(
child
[
s
].
widget
)
?
''
:
child
[
s
].
title
,
...
...
src/core/widgets/settings/groupBase/FollowFieldHide/index.js
0 → 100644
View file @
88e26158
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
{
LoadTableFields
,
ReloadTableFields
}
from
'../../../../../apis/process'
;
import
React
,
{
useContext
,
useEffect
,
useMemo
,
useState
}
from
'react'
;
import
{
Select
}
from
'antd'
const
FollowFieldHide
=
props
=>
{
const
{
value
,
onChange
,
addons
,
disabled
}
=
props
;
const
{
tableNameParent
,
widget
,
$id
}
=
addons
.
formData
;
const
[
fields
,
setFields
]
=
useState
([]);
useEffect
(()
=>
{
getFieldData
();
},
[]);
const
getFieldData
=
async
()
=>
{
if
(
!
tableNameParent
)
{
return
message
.
info
(
'缺少表名!'
)
}
const
{
data
}
=
await
ReloadTableFields
({
tableName
:
tableNameParent
});
if
(
Array
.
isArray
(
data
.
root
))
{
const
fields
=
data
.
root
.
map
(
x
=>
x
.
name
);
setFields
(
fields
);
}
console
.
log
(
data
,
'data'
);
};
return
(
<
div
>
<
Select
style
=
{{
width
:
'100%'
}}
onChange
=
{
onChange
}
value
=
{
value
}
options
=
{
fields
.
map
(
x
=>
{
return
{
value
:
x
,
label
:
x
}})}
/
>
<
/div
>
)
};
export
default
FollowFieldHide
;
src/core/widgets/settings/groupBase/FollowFieldHide/index.less
0 → 100644
View file @
88e26158
src/core/widgets/settings/groupBase/index.js
View file @
88e26158
import
FieldNames
from
'./FieldNames'
import
FollowFieldHide
from
'./FollowFieldHide'
import
Placeholder
from
'./Placeholder'
import
PresetValueFileUpload
from
'./PresetValueFileUpload'
import
InputDefault
from
'./InputDefault'
...
...
@@ -28,6 +29,7 @@ const groupBase = {
RichTextDefault
,
IsHidden
,
IsText
,
FollowFieldHide
}
export
default
groupBase
\ No newline at end of file
src/core/widgets/text/TextHTML/index.js
View file @
88e26158
...
...
@@ -4,10 +4,10 @@ const TextHTML = (props) => {
const
{
value
,
onChange
,
schema
}
=
props
const
{
isText
,
contentHTML
,
contentText
,
styleHTML
}
=
schema
if
(
isText
)
{
return
(
<
div
style
=
{{
color
:
styleHTML
?.
color
,
padding
:
styleHTML
?.
padding
?
`0
${
styleHTML
.
padding
}
%`
:
''
}}
>
{
contentText
}
<
/div
>
<
div
style
=
{{
background
:
styleHTML
?.
background
,
color
:
styleHTML
?.
color
,
padding
:
styleHTML
?.
padding
?
`0
${
styleHTML
.
padding
}
%`
:
''
}}
>
{
contentText
}
<
/div
>
)
}
...
...
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