@progress/kendo-react-map
Version:
KendoReact Map package
51 lines (50 loc) • 1.53 kB
JavaScript
/**
* @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 {
get optionsStore() {
var t;
return (t = this.context) == null ? void 0 : t.optionsStore;
}
constructor(t) {
super(t), 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, ...i } = this.props;
(r || this.optionsStore).dispatch({
mapKey: t,
mapCollectionIdxKey: e,
payload: Object.assign({}, i, 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 n = s;
export {
n as default
};