diff --git a/src/components/Dashboard/common/ObjectProperty.jsx b/src/components/Dashboard/common/ObjectProperty.jsx index bfa623f..0f52cad 100644 --- a/src/components/Dashboard/common/ObjectProperty.jsx +++ b/src/components/Dashboard/common/ObjectProperty.jsx @@ -85,6 +85,7 @@ const ObjectProperty = ({ minimal = false, previewOpen = false, showPreview = true, + useFormItem = true, options = [], roundNumber = false, fixedNumber = false, @@ -613,254 +614,218 @@ const ObjectProperty = ({ mergedFormItemProps.onChange = onChange } - switch (type) { - case 'netGross': - return ( - + const inputProps = useFormItem + ? {} + : { + value, + onChange, + disabled + } + + const renderInput = () => { + switch (type) { + case 'netGross': + return ( - - ) - case 'secret': - return ( - + ) + case 'secret': + return ( visible ? : } + {...mergedFormItemProps} + {...inputProps} /> - - ) - case 'wsprotocol': - return ( - + ) + case 'wsprotocol': + return ( - - ) - case 'bool': - return ( - - - - ) - case 'dateTime': - return ( - ({ value: v ? dayjs(v) : null })} - > + ) + case 'bool': + return ( + + ) + case 'dateTime': + return ( - - ) - case 'country': - return ( - - - - ) - case 'color': - return ( - v} - > - - - ) - case 'weight': - return ( - + ) + case 'country': + return + case 'color': + return ( + + ) + case 'weight': + return ( - - ) - case 'number': - return ( - + ) + case 'number': + return ( - - ) - case 'text': - return ( - - - - ) - case 'codeBlock': - return ( - + ) + case 'text': + return + case 'codeBlock': + return ( - - ) - case 'markdown': - return ( - - - - ) - case 'material': - return ( - + ) + case 'markdown': + return + case 'material': + return ( } - default: - return ( - - - - ) } + + if (!useFormItem) { + return renderInput() + } + + return ( + v } + : {})} + {...(type === 'dateTime' + ? { getValueProps: (v) => ({ value: v ? dayjs(v) : null }) } + : {})} + > + {renderInput()} + + ) } const property = renderProperty() @@ -892,6 +857,7 @@ ObjectProperty.propTypes = { height: PropTypes.string, previewOpen: PropTypes.bool, showPreview: PropTypes.bool, + useFormItem: PropTypes.bool, showHyperlink: PropTypes.bool, options: PropTypes.array, showSince: PropTypes.bool,