Commit e3be7fcf authored by 田翔's avatar 田翔

fix: 增加描述控件

parent a762f726
{
"name": "panda-xform",
"version": "5.5.9",
"description": "5.5.9 样式细节优化",
"version": "5.6.0",
"description": "5.6.0 增加描述控件",
"keywords": [
"panda-xform"
],
......@@ -37,6 +37,7 @@
"qrcode.react": "^3.1.0",
"rc-tween-one": "^3.0.6",
"react": "17.0.2",
"react-color": "2.19.3",
"react-dnd": "^16.0.1",
"react-dnd-html5-backend": "^16.0.1",
"react-file-viewer": "^1.2.1",
......@@ -133,4 +134,4 @@
"publishConfig": {
"registry": "https://g.civnet.cn:4873"
}
}
\ No newline at end of file
}
......@@ -52,6 +52,38 @@ const layoutWidgets = [
// },
},
},
{
text: '描述控件',
name: '描述控件',
icon: <IconPack.SearchLocation />,
schema: {
title: '描述控件',
type: 'html',
widget: 'TextHTML',
placeholder: '',
width: '100%',
labelWidth: 1,
},
setting: {
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 75,
},
contentHTML: {
title: '控件内容',
type: 'string',
widget: 'ContentHTML',
},
styleHTML: {
title: '控件样式',
type: 'object',
widget: 'StyleHTML',
},
},
},
]
const textWidgets = [
......@@ -798,38 +830,6 @@ const textWidgets = [
},
},
},
{
text: '描述控件',
name: '描述控件',
icon: <IconPack.SearchLocation />,
schema: {
title: '',
type: 'string',
widget: 'TextHTML',
placeholder: '',
width: '100%',
labelWidth: 1,
},
setting: {
widget: {
title: '控件类型',
type: 'string',
widget: 'WidgetType',
displayType: 'row',
labelWidth: 75,
},
contentHTML: {
title: '控件内容',
type: 'string',
widget: 'ContentHTML',
},
// styleHTML: {
// title: '控件样式',
// type: 'string',
// widget: 'StyleHTML',
// },
},
},
]
const selectWidgets = [
......
......@@ -83,12 +83,13 @@ const XRender = (props, ref) => {
}
}
}
if (JSON.stringify(childObj) !== '{}') {
parentObj[v] = {
...parent[v],
properties: childObj,
hidden,
}
if (parent[v]?.widget === 'TextHTML') {
hidden = false
}
parentObj[v] = {
...parent[v],
properties: childObj,
hidden,
}
}
}
......@@ -98,6 +99,7 @@ const XRender = (props, ref) => {
properties: parentObj
}
setInitField(array)
console.log('json', schemaForm, json)
return json
}, [formJson, values, disabledFields, disabled])
......
......@@ -75,7 +75,6 @@ const FileUpload = (props) => {
const images = useMemo(() => {
let array = []
console.log('showList', showList)
showList.forEach(v => {
if (['jpg', 'png', 'svg', 'jpeg'].includes(getFileType(v.name))) {
array.push({ src: v.url, alt: '' })
......@@ -301,8 +300,6 @@ const FileUpload = (props) => {
}
}, [presetValue])
console.log('images', images)
return (
<div className={fileType === '图片' ? styles.uploadBoxImg : styles.uploadBox}>
<Upload
......
import React from 'react'
import { Form } from 'antd'
import { Form, Slider, Input, Popconfirm } from 'antd'
import { SketchPicker } from 'react-color'
import styles from './index.less'
const StyleHTML = (props) => {
const { value, onChange } = props
const colorChange = (e) => {
onChange({ ...value, background: e.hex })
}
return (
<div>
<Form>
<div style={{ paddingLeft: '10px' }}>
<Form
name="dynamic_rule"
layout={'vertical'}
>
<Form.Item label="背景色">
</Form.Item>
<Form.Item label="边距">
<Popconfirm
overlayClassName={styles.Popconfirmtitle}
placement="topLeft"
icon={false}
title={
<SketchPicker width="217px" color={value?.background} onChange={e => colorChange(e)} />
}
>
<div className={styles.borderColor}>
<div
style={{
background: value?.background,
width: '18px',
height: '10px',
marginLeft: '1px',
marginTop: '4px',
}}
/>
</div>
</Popconfirm>
</Form.Item>
<Form.Item label="背景色">
<Form.Item label="内边距(px)">
<Slider
defaultValue={0}
value={value?.padding}
onChange={padding => onChange({ ...value, padding: padding })}
/>
</Form.Item>
</Form>
</div>
......
.Popconfirmtitle {
.ant-popover-message-title {
padding-left: 0;
}
}
.borderColor {
width: 22px;
height: 20px;
border: 1px solid #ccc;
border-radius: 2px;
&:hover {
width: 22px;
height: 20px;
border: 1px solid rgb(241, 228, 32);
border-radius: 2px;
}
}
\ No newline at end of file
......@@ -182,9 +182,6 @@ export const getVerify = (json) => {
let properties = json?.properties
if (isObject(properties)) {
for (let v in properties) {
// if (properties[v].title === '(未分组)') {
// return message.error(`包含未分组字段,请将分组命名`)
// }
let child = properties[v]?.properties
if (isObject(child)) {
for (let s in child) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment