UNPKG

devextreme-react

Version:

DevExtreme React UI and Visualization Components

157 lines (155 loc) 4.8 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 client"; import * as React from "react"; import { memo, forwardRef, useImperativeHandle, useRef, useMemo } from "react"; import dxDeferRendering from "devextreme/ui/defer_rendering"; import { Component as BaseComponent } from "./core/component"; import NestedOption from "./core/nested-option"; const DeferRendering = memo(forwardRef((props, ref) => { const baseRef = useRef(null); useImperativeHandle(ref, () => ({ instance() { return baseRef.current?.getInstance(); } }), [baseRef.current]); const independentEvents = useMemo(() => (["onContentReady", "onDisposing", "onInitialized", "onRendered", "onShown"]), []); const expectedChildren = useMemo(() => ({ animation: { optionName: "animation", isCollectionItem: false } }), []); return (React.createElement((BaseComponent), { WidgetClass: dxDeferRendering, ref: baseRef, independentEvents, expectedChildren, ...props, })); })); const _componentAnimation = (props) => { return React.createElement((NestedOption), { ...props, elementDescriptor: { OptionName: "animation", ExpectedChildren: { from: { optionName: "from", isCollectionItem: false }, to: { optionName: "to", isCollectionItem: false } }, }, }); }; const Animation = Object.assign(_componentAnimation, { componentType: "option", }); const _componentAt = (props) => { return React.createElement((NestedOption), { ...props, elementDescriptor: { OptionName: "at", }, }); }; const At = Object.assign(_componentAt, { componentType: "option", }); const _componentBoundaryOffset = (props) => { return React.createElement((NestedOption), { ...props, elementDescriptor: { OptionName: "boundaryOffset", }, }); }; const BoundaryOffset = Object.assign(_componentBoundaryOffset, { componentType: "option", }); const _componentCollision = (props) => { return React.createElement((NestedOption), { ...props, elementDescriptor: { OptionName: "collision", }, }); }; const Collision = Object.assign(_componentCollision, { componentType: "option", }); const _componentFrom = (props) => { return React.createElement((NestedOption), { ...props, elementDescriptor: { OptionName: "from", ExpectedChildren: { position: { optionName: "position", isCollectionItem: false } }, }, }); }; const From = Object.assign(_componentFrom, { componentType: "option", }); const _componentMy = (props) => { return React.createElement((NestedOption), { ...props, elementDescriptor: { OptionName: "my", }, }); }; const My = Object.assign(_componentMy, { componentType: "option", }); const _componentOffset = (props) => { return React.createElement((NestedOption), { ...props, elementDescriptor: { OptionName: "offset", }, }); }; const Offset = Object.assign(_componentOffset, { componentType: "option", }); const _componentPosition = (props) => { return React.createElement((NestedOption), { ...props, elementDescriptor: { OptionName: "position", ExpectedChildren: { at: { optionName: "at", isCollectionItem: false }, boundaryOffset: { optionName: "boundaryOffset", isCollectionItem: false }, collision: { optionName: "collision", isCollectionItem: false }, my: { optionName: "my", isCollectionItem: false }, offset: { optionName: "offset", isCollectionItem: false } }, }, }); }; const Position = Object.assign(_componentPosition, { componentType: "option", }); const _componentTo = (props) => { return React.createElement((NestedOption), { ...props, elementDescriptor: { OptionName: "to", ExpectedChildren: { position: { optionName: "position", isCollectionItem: false } }, }, }); }; const To = Object.assign(_componentTo, { componentType: "option", }); export default DeferRendering; export { DeferRendering, Animation, At, BoundaryOffset, Collision, From, My, Offset, Position, To };