import snippets from './snippets'; export default { snippets, componentName: 'Modal', title: 'dialog', category: 'Feedback', props: [ { name: 'title', title: { label: 'title', tip: 'title' }, propType: { type: 'oneOfType', value: ['string', 'node'] }, }, { name: 'cancelText', title: { label: 'cancel text', tip: 'Cancel button text' }, propType: { type: 'oneOfType', value: ['string', 'node'] }, }, { name: 'okText', title: { label: 'Confirm text', tip: 'Confirm button text' }, propType: { type: 'oneOfType', value: ['string', 'node'] }, }, { name: 'open', title: { label: 'visible or not', tip: 'Is the dialog box visible?' }, propType: 'bool', setter: 'BoolSetter', supportVariable: true }, { name: 'centered', title: { label: 'center vertically', tip: 'Display Modal vertically centered' }, propType: 'bool', defaultValue: false, setter: 'BoolSetter', supportVariable: true }, { name: 'closable', title: { label: 'Show close button', tip: 'Whether to display the close button in the upper right corner' }, propType: 'bool', defaultValue: true, setter: 'BoolSetter', supportVariable: true }, { name: 'closeIcon', title: { label: 'close icon', tip: 'Custom close icon' }, propType: 'node', }, { name: 'confirmLoading', title: { label: 'OK button loading', tip: 'OK button loading' }, propType: 'bool', defaultValue: false, setter: 'BoolSetter', supportVariable: true }, { name: 'destroyOnClose', title: { label: 'Destroy child elements', tip: 'Destroy child elements in Modal when closed' }, propType: 'bool', defaultValue: false, setter: 'BoolSetter', supportVariable: true }, { name: 'forceRender', title: { label: 'Force rendering Modal', tip: 'Force rendering Modal' }, propType: 'bool', defaultValue: false, setter: 'BoolSetter', supportVariable: true }, { name: 'keyboard', title: { label: 'esc close', tip: 'Whether to support keyboard esc close' }, propType: 'bool', defaultValue: true, setter: 'BoolSetter', supportVariable: true }, { name: 'mask', title: { label: 'display the mask', tip: 'display the mask' }, propType: 'bool', defaultValue: true, setter: 'BoolSetter', supportVariable: true }, { name: 'maskClosable', title: { label: 'click to close', tip: 'Click whether the mask layer is allowed to be closed' }, propType: 'bool', defaultValue: true, setter: 'BoolSetter', supportVariable: true }, { name: 'zIndex', title: { label: 'z-index', tip: '设置 Modal 的 `z-index`' }, propType: 'number', setter: 'NumberSetter', supportVariable: true }, { name: 'width', title: { label: 'width', tip: 'width' }, propType: { type: 'oneOfType', value: ['string', 'number'] }, }, { name: 'footer', title: { label: 'bottom content', tip: 'Bottom content, when the default bottom button is not required, it can be set to `footer={null}`', }, propType: { type: 'oneOfType', value: ['string', 'node'] }, }, { name: 'okType', title: { label: 'Confirm button type', tip: 'Confirm button type' }, propType: { type: 'oneOf', value: ['default', 'small'] }, setter: { componentName: 'RadioGroupSetter', props: { options: [ { title: 'primary', value: 'primary', }, { title: 'ghost', value: 'ghost', }, { title: 'dashed', value: 'dashed', }, { title: 'link', value: 'link', }, { title: 'text', value: 'text', }, { title: 'default', value: 'default', }, ], }, }, }, { name: 'okButtonProps', title: { label: 'Confirm button props', tip: 'Confirm button props' }, propType: 'object', setter: { componentName: 'ObjectSetter', props: { config: { items: [ { name: 'disabled', title: { label: 'disabled', tip: 'Is it clickable?' }, propType: 'bool', setter: [ { componentName: 'BoolSetter', initialValue: false, }, 'VariableSetter', ], isRequired: true, }, ], }, }, }, }, { name: 'bodyStyle', title: { label: 'body style', tip: 'Modal body style' }, propType: 'object', }, { name: 'maskStyle', title: { label: 'mask style', tip: 'mask style' }, propType: 'object', }, { name: 'style', title: { label: 'overlay style', tip: 'Can be used to set the style of the floating layer, adjust the position of the floating layer, etc.', }, propType: 'object', }, { name: 'wrapClassName', title: { label: 'wrap class name', tip: 'The class name of the outer container of the dialog box' }, propType: 'string', setter: 'StringSetter', supportVariable: true }, { name: 'getContainer', title: { label: 'get container', tip: 'Specify the HTML node mounted by Modal, false means it is mounted in the current dom', }, propType: { type: 'oneOfType', value: ['node', 'func'] }, }, { name: 'onCancel', title: { label: 'cancel button on', tip: 'Callback for clicking the mask layer or the upper right cross or cancel button', }, propType: 'func', }, { name: 'onOk', title: { label: 'click OK on', tip: 'click OK on' }, propType: 'func', }, ], configure: { component: { isContainer: true, isModal: true, rootSelector: '.ant-modal-content', nestingRule: { parentWhitelist: ['Page', 'Component'], }, }, supports: { style: true, events: [ { name: 'afterClose', templete: "onCancel(${extParams}){\n// 完全关闭后的回调\nconsole.log('afterClose');}", }, { name: 'onCancel', template: "onCancel(${extParams}){\n// 点击遮罩层或右上角叉或取消按钮的回调\nconsole.log('onCancel');}", }, { name: 'onOk', template: "onOk(${extParams}){\n// 点击确定回调\nconsole.log('onOk');}", }, ], }, }, };