steps.d.ts.map 2.1 KB

1
  1. {"version":3,"sources":["../src/steps/steps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,cAAc,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAQpF,MAAM,CAAC,OAAO,OAAO,KAAM,SAAQ,cAAc;IAC/C,SAAS,EAAE,gBAAgB,CAmBzB;IAEF,eAAe,WAAuB;IAEtC,UAAU,gCAAS;IAEnB,eAAe;;;QAKb;IAGF,IAAI;;;MAGF;IAEF,SAAS;;MAIP;IAEF,OAAO;;;MAwBL;CACH","file":"steps.d.ts","sourcesContent":["import { wxComponent, SuperComponent, RelationsOptions } from '../common/src/index';\nimport config from '../common/config';\nimport props from './props';\n\nconst { prefix } = config;\nconst name = `${prefix}-steps`;\n\n@wxComponent()\nexport default class Steps extends SuperComponent {\n relations: RelationsOptions = {\n './step-item': {\n type: 'descendant',\n linked(child) {\n this.updateChildren();\n\n const { readonly, layout } = this.data;\n let isLarge = false;\n\n if (!readonly && layout === 'horizontal') {\n isLarge = !!child.data.icon;\n }\n\n child.setData({\n readonly,\n isLarge,\n });\n },\n },\n };\n\n externalClasses = [`${prefix}-class`];\n\n properties = props;\n\n controlledProps = [\n {\n key: 'current',\n event: 'change',\n },\n ];\n\n // 组件的内部数据\n data = {\n prefix,\n classPrefix: name,\n };\n\n observers = {\n current() {\n this.updateChildren();\n },\n };\n\n methods = {\n updateChildren() {\n const items = this.getRelationNodes('./step-item');\n const len = items.length;\n const { current, currentStatus, readonly } = this.data;\n\n if (len) {\n items.forEach((item, index) => {\n item.updateStatus(current, currentStatus, index, this.data.theme, this.data.layout, items, readonly);\n });\n }\n },\n handleClick(index) {\n if (this.data.layout === 'vertical') {\n return;\n }\n if (!this.data.readonly) {\n const preIndex = this.data.current;\n this._trigger('change', {\n previous: preIndex,\n current: index,\n });\n }\n },\n };\n}\n"]}