{"version":3,"sources":["../src/grid/grid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,cAAc,EAAe,MAAM,qBAAqB,CAAC;AAQ5E,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,cAAc;IAC9C,eAAe,WAAe;IAE9B,SAAS;;;;MAIP;IAEF,UAAU,+BAAS;IAEnB,IAAI;;;MAGF;IAEF,SAAS;;MAIP;IAEF,SAAS;;;;MAUP;IAEF,kBAAkB;IAUlB,gBAAgB;IAShB,SAAS;CAMV","file":"grid.d.ts","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"]}