<import src="../common/template/icon.wxml" />
<wxs src="./swipe-cell.wxs" module="swipe"></wxs>

<view
  class="{{prefix}}-class {{classPrefix}}"
  data-key="cell"
  capture-bind:tap="onTap"
  bindtouchstart="{{disabled || swipe.startDrag}}"
  capture-bind:touchmove="{{disabled || swipe.onDrag}}"
  bindtouchend="{{disabled || swipe.endDrag}}"
  bindtouchcancel="{{disabled || swipe.endDrag}}"
  opened="{{opened}}"
  change:opened="{{swipe.onOpenedChange}}"
  leftWidth="{{leftWidth}}"
  rightWidth="{{rightWidth}}"
  change:leftWidth="{{swipe.initLeftWidth}}"
  change:rightWidth="{{swipe.initRightWidth}}"
>
  <view id="wrapper">
    <view class="{{classPrefix}}__left" data-key="left">
      <slot name="left" />
      <view
        wx:for="{{left}}"
        class="{{classPrefix}}__content {{item.className}}"
        style="{{item.style}}"
        wx:key="index"
        data-action="{{item}}"
        bind:tap="onActionTap"
      >
        <template
          wx:if="{{item.icon}}"
          is="icon"
          data="{{class: classPrefix + '__icon', name: item.icon, ...item.icon}}"
        ></template>
        <text wx:if="{{item.text}}" class="{{classPrefix}}__text">{{item.text}}</text>
      </view>
    </view>
    <slot />
    <view class="{{classPrefix}}__right" data-key="right">
      <slot name="right" />
      <view
        wx:for="{{right}}"
        class="{{classPrefix}}__content {{item.className}}"
        style="{{item.style}}"
        wx:key="index"
        data-action="{{item}}"
        bind:tap="onActionTap"
      >
        <template
          wx:if="{{item.icon}}"
          is="icon"
          data="{{class: classPrefix + '__icon', name: item.icon, ...item.icon}}"
        ></template>
        <text wx:if="{{item.text}}" class="{{classPrefix}}__text">{{item.text}}</text>
      </view>
    </view>
  </view>
</view>
