UNPKG

devextreme-react

Version:

DevExtreme React UI and Visualization Components

44 lines (42 loc) 1.47 kB
/*! * devextreme-react * Version: 24.2.6 * Build date: Mon Mar 17 2025 * * Copyright (c) 2012 - 2025 Developer Express Inc. ALL RIGHTS RESERVED * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file in the root of the project for details. * * https://github.com/DevExpress/devextreme-react */ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.findProps = exports.Template = void 0; const react_1 = require("react"); const contexts_1 = require("./contexts"); const templates_1 = require("./configuration/react/templates"); const Template = (0, react_1.memo)((props) => { const { onNamedTemplateReady, treeUpdateToken, } = (0, react_1.useContext)(contexts_1.NestedOptionContext); const { isTemplateRendering } = (0, react_1.useContext)(contexts_1.TemplateRenderingContext); const template = (0, templates_1.getNamedTemplate)(props); (0, react_1.useLayoutEffect)(() => { if (!isTemplateRendering) { onNamedTemplateReady(template, treeUpdateToken); } }, [treeUpdateToken]); return null; }); exports.Template = Template; function findProps(child) { if (child.type !== Template) { return undefined; } return { name: child.props.name, render: child.props.render, component: child.props.component, children: child.props.children, }; } exports.findProps = findProps;