Commit f7074a49 authored by 田翔's avatar 田翔

fix: 样式修改

parent ab185135
{ {
"name": "panda-xform", "name": "panda-xform",
"version": "2.6.4", "version": "2.6.5",
"description": "2.6.4: laoding优化", "description": "2.6.5: 样式修改",
"keywords": [ "keywords": [
"panda-xform" "panda-xform"
], ],
......
...@@ -400,23 +400,14 @@ const textWidgets = [ ...@@ -400,23 +400,14 @@ const textWidgets = [
type: 'string', type: 'string',
widget: 'CalculateRule', widget: 'CalculateRule',
}, },
groupStyle: {
title: '控件样式',
type: 'object',
properties: {}
},
prefix: { prefix: {
title: '前缀', title: '前缀',
type: 'string', type: 'string',
widget: 'htmlInput', widget: 'htmlInput',
displayType: 'row',
labelWidth: 60,
}, },
formatter: { formatter: {
title: '格式化', title: '格式化',
type: 'string', type: 'string',
displayType: 'row',
labelWidth: 60,
widget: 'select', widget: 'select',
enum: ['%', '‰'], enum: ['%', '‰'],
default: '', default: '',
...@@ -425,6 +416,21 @@ const textWidgets = [ ...@@ -425,6 +416,21 @@ const textWidgets = [
allowClear: true allowClear: true
} }
}, },
groupStyle: {
title: '控件样式',
type: 'object',
properties: {}
},
addonBefore: {
title: '前置标签',
type: 'string',
widget: 'InputAddon',
},
addonAfter: {
title: '后置标签',
type: 'string',
widget: 'InputAddon',
},
width: { width: {
title: '元素宽度', title: '元素宽度',
type: 'string', type: 'string',
......
...@@ -23,6 +23,7 @@ const FormDesigner = (props, ref) => { ...@@ -23,6 +23,7 @@ const FormDesigner = (props, ref) => {
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext) const { getPrefixCls } = useContext(ConfigProvider.ConfigContext)
const prefixCls = getPrefixCls('pandaXform') const prefixCls = getPrefixCls('pandaXform')
const prefixClsPandaXform = getPrefixCls()
const [visible, setVisible] = useState(false) const [visible, setVisible] = useState(false)
const [schema, setSchema] = useState({}) const [schema, setSchema] = useState({})
const designerRef = useRef(null) const designerRef = useRef(null)
...@@ -220,7 +221,7 @@ const FormDesigner = (props, ref) => { ...@@ -220,7 +221,7 @@ const FormDesigner = (props, ref) => {
<div className={prefixCls} style={{ width: '100%', height: '100%', background: 'white' }}> <div className={prefixCls} style={{ width: '100%', height: '100%', background: 'white' }}>
<div style={{ height: '100%' }}> <div style={{ height: '100%' }}>
<Generator <Generator
configProvider={{ prefixCls: prefixCls }} configProvider={{ prefixCls: prefixClsPandaXform }}
mapping={{ mapping={{
object: 'Header', object: 'Header',
}} }}
......
...@@ -2,7 +2,7 @@ import React, { useMemo, useState, useContext } from 'react' ...@@ -2,7 +2,7 @@ import React, { useMemo, useState, useContext } from 'react'
import { Input, Modal, ConfigProvider } from 'antd' import { Input, Modal, ConfigProvider } from 'antd'
import Icon, { PlusOutlined } from '@ant-design/icons' import Icon, { PlusOutlined } from '@ant-design/icons'
import * as icons from '@ant-design/icons' import * as icons from '@ant-design/icons'
import './index.less' import styles from './index.less'
import Drag from '../../../components/Drag' import Drag from '../../../components/Drag'
const iconList = Object.keys(icons).filter((item) => typeof icons[item] === 'object') const iconList = Object.keys(icons).filter((item) => typeof icons[item] === 'object')
...@@ -32,8 +32,9 @@ const InputAddon = (props) => { ...@@ -32,8 +32,9 @@ const InputAddon = (props) => {
} }
return ( return (
<div className={`inputAddon`}> <div className={styles.inputAddon}>
<Input value={value} onChange={inputChange} addonAfter={<PlusOutlined onClick={iconClick} />} /> <Input value={value} onChange={inputChange} />
<div className={styles.addon}><PlusOutlined onClick={iconClick} /></div>
<Drag <Drag
width={'50%'} width={'50%'}
getContainer={false} getContainer={false}
......
...@@ -2,6 +2,18 @@ ...@@ -2,6 +2,18 @@
@pandaXform: ~'@{ant-prefix}-pandaXform'; @pandaXform: ~'@{ant-prefix}-pandaXform';
.@{pandaXform} { .@{pandaXform} {
.inputAddon { .inputAddon {
position: relative;
.@{ant-prefix}-input {
padding-right: 30px;
}
.addon {
position: absolute;
right: 10px;
top: 5px;
&:hover {
color: #4096ff;
}
}
.iconBox { .iconBox {
width: 100%; width: 100%;
height: 100%; height: 100%;
......
...@@ -4,7 +4,7 @@ import { InputNumber } from 'antd' ...@@ -4,7 +4,7 @@ import { InputNumber } from 'antd'
const NumberInput = (props) => { const NumberInput = (props) => {
const { value, onChange, schema, addons } = props const { value, onChange, schema, addons } = props
const { disabled, presetValue, placeholder, prefix, formatter } = schema const { disabled, presetValue, placeholder, prefix, formatter, addonBefore, addonAfter } = schema
useEffect(() => { useEffect(() => {
if (addons) { if (addons) {
...@@ -22,6 +22,8 @@ const NumberInput = (props) => { ...@@ -22,6 +22,8 @@ const NumberInput = (props) => {
return ( return (
<InputNumber <InputNumber
addonBefore={addonBefore}
addonAfter={addonAfter}
prefix={prefix} prefix={prefix}
placeholder={placeholder} placeholder={placeholder}
disabled={disabled} disabled={disabled}
......
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