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C9B,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC;gBAC7D,IAAI,KAAK,GAAG,EAAE,CAAC;gBACf,MAAM,GAAG,GAAG,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;gBAE7C,IAAI,GAAG,GAAG,CAAC,CAAC,EAAE;oBACZ,KAAK,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC;iBAC5D;qBAAM;oBACL,KAAK,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;iBACtE;gBAED,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;YACrC,CAAC;SACF,CAAC;IACJ,CAAC;CAAA,CAAA;AA3DoB,QAAQ;IAD5B,WAAW,EAAE;GACO,QAAQ,CA2D5B;eA3DoB,QAAQ","file":"collapse.js","sourcesContent":["import { SuperComponent, wxComponent, RelationsOptions } from '../common/src/index';\nimport config from '../common/config';\nimport props from './props';\nimport type { CollapseValue, TdCollapseProps } from './type';\n\nconst { prefix } = config;\nconst name = `${prefix}-collapse`;\n\nexport interface CollapseProps extends TdCollapseProps {}\n\n@wxComponent()\nexport default class Collapse extends SuperComponent {\n options = {\n addGlobalClass: true,\n };\n\n externalClasses = [`${prefix}-class`];\n\n relations: RelationsOptions = {\n './collapse-panel': {\n type: 'descendant',\n linked() {\n // this.updateExpanded();\n },\n },\n };\n\n controlledProps = [\n {\n key: 'value',\n event: 'change',\n },\n ];\n\n properties = props;\n\n data = {\n classPrefix: name,\n };\n\n observers = {\n 'value, expandMutex '() {\n this.updateExpanded();\n },\n };\n\n methods = {\n updateExpanded() {\n const panels = this.getRelationNodes('./collapse-panel');\n\n if (panels.length === 0) return;\n\n panels.forEach((child: WechatMiniprogram.Component.TrivialInstance) => {\n child.updateExpanded(this.properties.value);\n });\n },\n switch(panelValue: CollapseValue) {\n const { expandMutex, value: activeValues } = this.properties;\n let value = [];\n const hit = activeValues.indexOf(panelValue);\n\n if (hit > -1) {\n value = activeValues.filter((item) => item !== panelValue);\n } else {\n value = expandMutex ? [panelValue] : activeValues.concat(panelValue);\n }\n\n this._trigger('change', { value });\n },\n };\n}\n"]}