UNPKG

@progress/kendo-react-map

Version:
47 lines (46 loc) 1.47 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ import * as o from "react"; import p from "../../store/store.mjs"; import { optionsReducer as c } from "../../store/reducer.mjs"; import { MapContext as a } from "../../MapContext.mjs"; const s = class s extends o.Component { constructor(t, e) { super(t, e), this.optionsStore = e.optionsStore, this.childStore = p(c); } render() { const { children: t } = this.props; return t !== void 0 ? o.Children.map(t, (e) => o.isValidElement(e) ? this.renderChildren(e) : e) : null; } componentDidMount() { this.dispatch(); } componentDidUpdate() { this.dispatch(); } dispatch() { const { _mapKey: t, _mapCollectionIdxKey: e, _parentStore: r, children: d, ...n } = this.props; (r || this.optionsStore).dispatch({ mapKey: t, mapCollectionIdxKey: e, payload: Object.assign({}, n, this.childStore.getState()) }); } renderChildren(t) { const { children: e } = t.props, r = { ...t.props, _parentStore: this.childStore }; return o.cloneElement(t, r, e); } }; s.contextType = a; let i = s; export { i as default };