chore: image custom params
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import { Slider } from 'antd';
|
||||
import SealInput from '../seal-input';
|
||||
import SealSelect from '../seal-select';
|
||||
|
||||
const components: {
|
||||
InputNumber: typeof SealInput.Number;
|
||||
Select: typeof SealSelect;
|
||||
Slider: React.ComponentType<typeof Slider>;
|
||||
TextArea: typeof SealInput.TextArea;
|
||||
Input: typeof SealInput.Input;
|
||||
} = {
|
||||
InputNumber: SealInput.Number,
|
||||
Select: SealSelect,
|
||||
Slider: Slider as React.ComponentType<typeof Slider>,
|
||||
TextArea: SealInput.TextArea,
|
||||
Input: SealInput.Input
|
||||
};
|
||||
|
||||
export default components;
|
||||
@@ -0,0 +1,19 @@
|
||||
import { ParamsSchema } from '@/pages/playground/config/types';
|
||||
import { useIntl } from '@umijs/max';
|
||||
import React from 'react';
|
||||
import componentsMap from './config/components';
|
||||
|
||||
const FieldComponent: React.FC<ParamsSchema> = (props) => {
|
||||
const intl = useIntl();
|
||||
const { type, label, attrs, style, ...rest } = props;
|
||||
return React.createElement(componentsMap[type], {
|
||||
...rest,
|
||||
...attrs,
|
||||
style: { ...style, width: '100%' },
|
||||
label: label.isLocalized
|
||||
? intl.formatMessage({ id: label.text })
|
||||
: label.text
|
||||
});
|
||||
};
|
||||
|
||||
export default React.memo(FieldComponent);
|
||||
Reference in New Issue
Block a user