Commit e3be7fcf authored by 田翔's avatar 田翔

fix: 增加描述控件

parent a762f726
{ {
"name": "panda-xform", "name": "panda-xform",
"version": "5.5.9", "version": "5.6.0",
"description": "5.5.9 样式细节优化", "description": "5.6.0 增加描述控件",
"keywords": [ "keywords": [
"panda-xform" "panda-xform"
], ],
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
"qrcode.react": "^3.1.0", "qrcode.react": "^3.1.0",
"rc-tween-one": "^3.0.6", "rc-tween-one": "^3.0.6",
"react": "17.0.2", "react": "17.0.2",
"react-color": "2.19.3",
"react-dnd": "^16.0.1", "react-dnd": "^16.0.1",
"react-dnd-html5-backend": "^16.0.1", "react-dnd-html5-backend": "^16.0.1",
"react-file-viewer": "^1.2.1", "react-file-viewer": "^1.2.1",
...@@ -133,4 +134,4 @@ ...@@ -133,4 +134,4 @@
"publishConfig": { "publishConfig": {
"registry": "https://g.civnet.cn:4873" "registry": "https://g.civnet.cn:4873"
} }
} }
\ No newline at end of file
...@@ -52,6 +52,38 @@ const layoutWidgets = [ ...@@ -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 = [ const textWidgets = [
...@@ -798,38 +830,6 @@ 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 = [ const selectWidgets = [
......
...@@ -83,12 +83,13 @@ const XRender = (props, ref) => { ...@@ -83,12 +83,13 @@ const XRender = (props, ref) => {
} }
} }
} }
if (JSON.stringify(childObj) !== '{}') { if (parent[v]?.widget === 'TextHTML') {
parentObj[v] = { hidden = false
...parent[v], }
properties: childObj, parentObj[v] = {
hidden, ...parent[v],
} properties: childObj,
hidden,
} }
} }
} }
...@@ -98,6 +99,7 @@ const XRender = (props, ref) => { ...@@ -98,6 +99,7 @@ const XRender = (props, ref) => {
properties: parentObj properties: parentObj
} }
setInitField(array) setInitField(array)
console.log('json', schemaForm, json)
return json return json
}, [formJson, values, disabledFields, disabled]) }, [formJson, values, disabledFields, disabled])
......
...@@ -75,7 +75,6 @@ const FileUpload = (props) => { ...@@ -75,7 +75,6 @@ const FileUpload = (props) => {
const images = useMemo(() => { const images = useMemo(() => {
let array = [] let array = []
console.log('showList', showList)
showList.forEach(v => { showList.forEach(v => {
if (['jpg', 'png', 'svg', 'jpeg'].includes(getFileType(v.name))) { if (['jpg', 'png', 'svg', 'jpeg'].includes(getFileType(v.name))) {
array.push({ src: v.url, alt: '' }) array.push({ src: v.url, alt: '' })
...@@ -301,8 +300,6 @@ const FileUpload = (props) => { ...@@ -301,8 +300,6 @@ const FileUpload = (props) => {
} }
}, [presetValue]) }, [presetValue])
console.log('images', images)
return ( return (
<div className={fileType === '图片' ? styles.uploadBoxImg : styles.uploadBox}> <div className={fileType === '图片' ? styles.uploadBoxImg : styles.uploadBox}>
<Upload <Upload
......
import React from 'react' 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 StyleHTML = (props) => {
const { value, onChange } = props const { value, onChange } = props
const colorChange = (e) => {
onChange({ ...value, background: e.hex })
}
return ( return (
<div> <div style={{ paddingLeft: '10px' }}>
<Form> <Form
name="dynamic_rule"
layout={'vertical'}
>
<Form.Item label="背景色"> <Form.Item label="背景色">
<Popconfirm
</Form.Item> overlayClassName={styles.Popconfirmtitle}
<Form.Item label="边距"> 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>
<Form.Item label="背景色"> <Form.Item label="内边距(px)">
<Slider
defaultValue={0}
value={value?.padding}
onChange={padding => onChange({ ...value, padding: padding })}
/>
</Form.Item> </Form.Item>
</Form> </Form>
</div> </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) => { ...@@ -182,9 +182,6 @@ export const getVerify = (json) => {
let properties = json?.properties let properties = json?.properties
if (isObject(properties)) { if (isObject(properties)) {
for (let v in properties) { for (let v in properties) {
// if (properties[v].title === '(未分组)') {
// return message.error(`包含未分组字段,请将分组命名`)
// }
let child = properties[v]?.properties let child = properties[v]?.properties
if (isObject(child)) { if (isObject(child)) {
for (let s in 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