

<script>
/* eslint-disable */
// sd-skip-auto-import
import SdTabbedEditor from"./tabbed-layout/sd-tabbed-editor.vue";import components from"./_import-components/sd-tabbed-layout-import";export const metaInfo={caption:"选项卡",icon:"credit-card",order:200,category:"layout",component:SdTabbedEditor,hiddenProps:["readonly","required","name","caption","description","mobileVisible"]};function getNewTab(t){const e=Math.max(0,...t.map((t=>t.id)));return{label:"标签"+(e+1),id:e+1,contents:[]}}const tab1=getNewTab([]);const tab2=getNewTab([tab1]);export const fieldProps={dataType:"string",data:[tab1,tab2],attrFD:{transient:true,hideLabel:true,tabsProps:{tabPosition:"top",type:"card"}}};var _render=function t(){var e=this,a=e._self._c;return a("div",[a("a-form-model-item",[a("div",{attrs:{slot:"label"},slot:"label"},[e._v(" 选项卡 "),a("a-icon",{attrs:{type:"plus-circle",theme:"twoTone"},on:{click:e.addItem}})],1),a("sd-draggable",{attrs:{handle:".handle",disabled:e.component.data.length<2},model:{value:e.component.data,callback:function(t){e.$set(e.component,"data",t)},expression:"component.data"}},e._l(e.component.data,(function(t,o){return a("a-row",{key:t.id,class:e.$style.row,attrs:{gutter:[4,8]}},[a("a-col",{staticClass:"handle"}),a("a-col",{attrs:{span:20}},[a("a-input",{attrs:{placeholder:"选项名"},model:{value:t.label,callback:function(a){e.$set(t,"label",a)},expression:"item.label"}})],1),a("a-col",{attrs:{span:2}},[a("a-icon",{attrs:{type:"delete"},on:{click:function(t){return e.deleteItem(o)}}})],1)],1)})),1)],1),a("a-form-model-item",{attrs:{label:"位置"}},[a("a-radio-group",{model:{value:e.component.attrFD.tabsProps.tabPosition,callback:function(t){e.$set(e.component.attrFD.tabsProps,"tabPosition",t)},expression:"component.attrFD.tabsProps.tabPosition"}},[a("a-radio-button",{attrs:{value:"top"}},[e._v(" 顶部 ")]),a("a-radio-button",{attrs:{value:"left"}},[e._v(" 左侧 ")])],1)],1),a("a-form-model-item",{attrs:{label:"样式"}},[a("a-radio-group",{model:{value:e.component.attrFD.tabsProps.type,callback:function(t){e.$set(e.component.attrFD.tabsProps,"type",t)},expression:"component.attrFD.tabsProps.type"}},[a("a-radio-button",{attrs:{value:"card"}},[e._v(" 卡片 ")]),a("a-radio-button",{attrs:{value:"line"}},[e._v(" 线条 ")])],1)],1)],1)};var staticRenderFns=[];_render._withStripped=true;export default{name:"SdTabbedLayout",components:components,data(){return{}},methods:{addItem(){this.component.data.push(getNewTab(this.component.data))},deleteItem(t){this.component.data[t].contents.forEach((t=>this.designer.visibleComponents.push(t)));this.component.data.splice(t,1)}},render:_render,staticRenderFns:staticRenderFns};</script>

<style module lang="scss">
@use '@/common/design' as *;
.row {
  display: flex;
  align-items: center;
  :global(.handle) {
    display: flex;
    align-items: center;
    align-self: stretch;
    width: 15px;
  }
  /* stylelint-disable-next-line */
  :global(.handle_sd-draggable_common::before) {
    position: absolute;
    /* stylelint-disable-next-line */
    color: #999;
    content: '\22EE\22EE';
  }
}
</style>
