import { RequiredSetter } from '../_setters'; import { uuid } from '../_utils/utils'; const { version } = require('../../package.json'); export default { componentName: 'RsTab.TabPane', title: '标签项', group: '基础组件', category: '容器元素', npm: { package: 'components-page', version, exportName: 'RsTab', main: 'src\\index.tsx', destructuring: true, subName: 'TabPane', }, props: [ { name: 'rs_id', title: { label: '组件ID' }, propType: 'string', condition: () => false, setter: { componentName: RequiredSetter, initialValue: () => 'tabPane_' + uuid(), }, }, // { // name: 'key', // title: { // label: 'key', // tip: 'key', // }, // propType: 'string', // setter: 'StringSetter', // supportVariable: true, // extraProps: { // setValue: (target: IPublicModelSettingField, value: any) => { // if (!value) return; // const { node } = target; // let parent = node?.parent, // slotParent = null; // while (parent) { // if (parent.componentName === 'RsTab') { // break; // } // if (parent.componentName === 'Slot') { // slotParent = parent; // } // parent = parent.parent; // } // console.log(target.parent); // let items = parent?.getPropValue('items'); // items = items.map((item: any) => { // if (item.children.id === slotParent?.id) { // return { ...item, value: value }; // } // return item; // }); // parent?.setPropValue('items', items); // }, // }, // }, // { // name: 'label', // title: { // label: '标题', // tip: '标题', // }, // propType: { type: 'oneOfType', value: ['string', 'node'] }, // setter: 'StringSetter', // extraProps: { // setValue: (target: IPublicModelSettingField, value: any) => { // if (!value) return; // const { node } = target; // let parent = node?.parent, // slotParent = null; // while (parent) { // if (parent.componentName === 'RsTab') { // break; // } // if (parent.componentName === 'Slot') { // slotParent = parent; // } // parent = parent.parent; // } // console.log(target.parent); // let items = parent?.getPropValue('items'); // items = items.map((item: any) => { // if (item.children.id === slotParent?.id) { // return { ...item, label: value }; // } // return item; // }); // parent?.setPropValue('items', items); // }, // }, // }, { name: 'padding', title: { label: { type: 'i18n', zh_CN: '内边距', en_US: 'contentPadding', }, tip: { type: 'i18n', zh_CN: '属性: contentPadding | 说明: 内边距', en_US: 'prop: contentPadding | description: Padding', }, }, setter: { componentName: 'RadioGroupSetter', props: { options: [ { title: '无', value: '0px', }, { title: '12px', value: '12px', }, { title: '16px', value: '16px', }, ], }, }, propType: { type: 'oneOf', value: ['0px', '12px', '16px'] }, }, { name: 'margin', title: { label: { type: 'i18n', zh_CN: '外边距', en_US: 'contentPadding', }, tip: { type: 'i18n', zh_CN: '属性: margin | 说明: 外边距', en_US: 'prop: margin | description: margin', }, }, setter: { componentName: 'RadioGroupSetter', props: { options: [ { title: '无', value: '0px', }, { title: '12px', value: '12px', }, { title: '20px', value: '20px', }, { title: '24px', value: '24px', }, ], }, }, propType: { type: 'oneOf', value: ['0px', '12px', '20px', '24px'] }, }, ], configure: { component: { isContainer: true, nestingRule: { parentWhitelist: ['RsTab'], }, disableBehaviors: ['copy', 'remove'], }, supports: { style: true, }, }, };