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B;QACd,MAAM,EAAE,MAAM,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC;QACvC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC;QACjC,IAAI,CAAC,MAAM;YAAE,OAAO,gBAAgB,MAAM,oBAAoB,MAAM,KAAK,CAAC;QAC1E,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;YAAE,MAAM,GAAG,EAAS,CAAC;QAC1C,MAAM,EAAE,KAAK,GAAG,CAAC,EAAE,GAAG,MAAa,CAAC;QACpC,OAAO,gBAAgB,KAAK,oBAAoB,KAAK,KAAK,CAAC;IAC7D,CAAC;IAED,SAAS;QACP,IAAI,IAAI,CAAC,WAAW,EAAE;YACpB,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAC/B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;SACzB;IACH,CAAC;CACF,CAAA;AA3DoB,IAAI;IADxB,WAAW,EAAE;GACO,IAAI,CA2DxB;eA3DoB,IAAI","file":"grid.js","sourcesContent":["import { isObject, SuperComponent, wxComponent } from '../common/src/index';\nimport config from '../common/config';\nimport props from './props';\n\nconst { prefix } = config;\nconst name = `${prefix}-grid`;\n\n@wxComponent()\nexport default class Grid extends SuperComponent {\n externalClasses = ['t-class'];\n\n relations = {\n './grid-item': {\n type: 'descendant' as 'descendant',\n },\n };\n\n properties = props;\n\n data = {\n classPrefix: name,\n contentStyle: '',\n };\n\n observers = {\n 'border,gutter,column,hover,align'() {\n this.updateContentStyle();\n },\n };\n\n lifetimes = {\n attached() {\n this.updateContentStyle();\n },\n detached() {\n this.destroyed();\n },\n created() {\n this.children = [];\n },\n };\n\n updateContentStyle() {\n const contentStyles = [];\n const marginStyle = this.getContentMargin();\n marginStyle && contentStyles.push(marginStyle);\n this.setData({\n contentStyle: contentStyles.join(';'),\n });\n }\n\n // 判断需不需要在content上加负margin以实现gutter间距\n getContentMargin() {\n const { gutter = 0 } = this.properties;\n let { border } = this.properties;\n if (!border) return `margin-left:-${gutter}rpx; margin-top:-${gutter}rpx`;\n if (!isObject(border)) border = {} as any;\n const { width = 2 } = border as any;\n return `margin-left:-${width}rpx; margin-top:-${width}rpx`;\n }\n\n destroyed() {\n if (this.updateTimer) {\n clearTimeout(this.updateTimer);\n this.updateTimer = null;\n }\n }\n}\n"]}
|