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,KAAK;aAC5B,CAAC,CAAC;QACL,CAAC;KAAA;IAED,QAAQ;QACN,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IAChD,CAAC;IAED,IAAI;QACF,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IACjC,CAAC;IAED,KAAK;QACH,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IAClC,CAAC;IAED,UAAU;QACR,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IACxE,CAAC;IAED,KAAK;QACH,IAAI,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;IAED,WAAW,CAAC,KAAK;QACf,MAAM,EACJ,aAAa,EAAE,EACb,OAAO,EAAE,EAAE,MAAM,EAAE,GACpB,GACF,GAAG,KAAK,CAAC;QACV,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACrC,CAAC;CACF,CAAA;AA9DoB,UAAU;IAD9B,WAAW,EAAE;GACO,UAAU,CA8D9B;eA9DoB,UAAU","file":"swipe-cell.js","sourcesContent":["import dom from '../behaviors/dom';\nimport { SuperComponent, wxComponent } from '../common/src/index';\nimport config from '../common/config';\nimport props from './props';\n\nlet ARRAY: WechatMiniprogram.Component.TrivialInstance[] = [];\nconst { prefix } = config;\n\n@wxComponent()\nexport default class SwiperCell extends SuperComponent {\n behaviors = [dom];\n\n externalClasses = ['t-class'];\n\n options = {\n multipleSlots: true,\n };\n\n properties = props;\n\n data = {\n wrapperStyle: '',\n closed: true,\n opened: false,\n classPrefix: `.${prefix}-swipe-cell`,\n };\n\n attached() {\n ARRAY.push(this as WechatMiniprogram.Component.TrivialInstance);\n wx.nextTick(() => {\n this.setSwipeWidth();\n });\n }\n\n async setSwipeWidth() {\n const rightRect = await this.gettingBoundingClientRect(`${this.data.classPrefix}__right`);\n const leftRect = await this.gettingBoundingClientRect(`${this.data.classPrefix}__left`);\n this.setData({\n leftWidth: leftRect.width,\n rightWidth: rightRect.width,\n });\n }\n\n detached() {\n ARRAY = ARRAY.filter((item) => item !== this);\n }\n\n open() {\n this.setData({ opened: true });\n }\n\n close() {\n this.setData({ opened: false });\n }\n\n closeOther() {\n ARRAY.filter((item) => item !== this).forEach((item) => item.close());\n }\n\n onTap() {\n this.close();\n }\n\n onActionTap(event) {\n const {\n currentTarget: {\n dataset: { action },\n },\n } = event;\n this.triggerEvent('click', action);\n }\n}\n"]}
|