UNPKG

@try-at-software/input-elements

Version:

A package providing different input elements that are extensible and easily configurable for your custom needs.

48 lines (47 loc) 1.92 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DynamicListInputElementWrapper = void 0; const React = require("react"); const Presentations_1 = require("../../Presentations"); const DynamicInputsList_1 = require("../DynamicInputsList"); class DynamicListInputElementWrapper extends React.Component { constructor(props) { var _a; super(props); this.startLoading = () => { if (this.state.isLoading) return; this.setState({ isLoading: true }); }; this.stopLoading = () => { if (!this.state.isLoading) return; this.setState({ isLoading: false }); }; this.hide = () => { if (!this.state.isVisible) return; this.setState({ isVisible: false }); }; this.show = () => { if (this.state.isVisible) return; this.setState({ isVisible: true }); }; this.update = (newValue) => { this.setState({ inputElements: newValue }); }; this.render = () => { return (React.createElement(Presentations_1.PresentationRenderer, { isVisible: this.state.isVisible, isLoading: this.state.isLoading, renderInternalContent: this.renderInternalContent, loadingIndicator: this.props.loadingComponent })); }; this.renderInternalContent = () => { return React.createElement(DynamicInputsList_1.DynamicInputsList, Object.assign({}, this.props, { inputs: this.state.inputElements })); }; this.state = { isLoading: false, isVisible: true, inputElements: (_a = props.inputs) !== null && _a !== void 0 ? _a : [] }; } } exports.DynamicListInputElementWrapper = DynamicListInputElementWrapper;