UNPKG

dockview

Version:

Zero dependency layout manager supporting tabs, grids and splitviews with ReactJS support

31 lines 1.53 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createComponent = void 0; function createComponent(id, componentName, components, frameworkComponents, createFrameworkComponent, fallback) { if (components === void 0) { components = {}; } if (frameworkComponents === void 0) { frameworkComponents = {}; } var Component = typeof componentName === 'string' ? components[componentName] : undefined; var FrameworkComponent = typeof componentName === 'string' ? frameworkComponents[componentName] : undefined; if (Component && FrameworkComponent) { throw new Error("Cannot create '".concat(id, "'. component '").concat(componentName, "' registered as both a component and frameworkComponent")); } if (FrameworkComponent) { if (!createFrameworkComponent) { throw new Error("Cannot create '".concat(id, "' for framework component '").concat(componentName, "'. you must register a frameworkPanelWrapper to use framework components")); } return createFrameworkComponent.createComponent(id, componentName, FrameworkComponent); } if (!Component) { if (fallback) { return fallback(); } throw new Error("Cannot create '".concat(id, "', no component '").concat(componentName, "' provided")); } return new Component(id, componentName); } exports.createComponent = createComponent; //# sourceMappingURL=componentFactory.js.map