import React from 'react'; import Window from 'ui/components/Window'; import Stack from 'ui/components/Stack'; import Field from 'ui/components/controls/Field'; import Label from 'ui/components/controls/Label'; import camelCaseSplit from 'gems/camelCaseSplit'; import NumberControl from 'ui/components/controls/NumberControl'; import TextControl from 'ui/components/controls/TextControl'; import Button from 'ui/components/controls/Button'; import ButtonGroup from 'ui/components/controls/ButtonGroup'; export default class Wizard extends React.Component { constructor({initialState, metadata, previewer}) { super(); this.params = {}; metadata.forEach(([name,, v]) => this.params[name] = v); Object.assign(this.params, initialState); this.preview = previewer(this.params); } shouldComponentUpdate() { // all controls are unmanaged and they should keep their state // if the wizard manager gets updated when a new wizard appears return false; } render() { let {left, title, metadata, onOK, onCancel} = this.props; let onClose = () => { this.onClose(); onCancel(); }; return {metadata.map(([name, type, , params], index) => { return {this.controlForType(name, type, params)} } )}