瀏覽代碼

fixed setting CollapsableControls default state

Alexander Rose 5 年之前
父節點
當前提交
c20c9c9917
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      src/mol-plugin/ui/base.tsx

+ 5 - 1
src/mol-plugin/ui/base.tsx

@@ -95,6 +95,10 @@ export abstract class CollapsableControls<P extends CollapsableProps = Collapsab
 
     constructor(props: P, context?: any) {
         super(props, context)
-        this.state = this.defaultState()
+
+        const state = this.defaultState()
+        if (props.initiallyCollapsed !== undefined) state.isCollapsed = props.initiallyCollapsed
+        if (props.header !== undefined) state.header = props.header
+        this.state = state
     }
 }