@codeperate/app-asset
Version:
Codeperate App Asset
57 lines (56 loc) • 2.15 kB
JavaScript
import { Component, Element, h, Host, Prop, State } from '@stencil/core';
import { mapStateToProps } from '../../../utils/map-state-to-props';
export class CdpMenuRematch {
constructor() {
this.proxyHandler = {
set: (_target, prop, value, _receiver) => {
this.config.store.dispatch.CdpMenuModel.set({ [prop]: value });
return true;
},
};
}
componentWillLoad() {
mapStateToProps(this.config.store, this, (state) => ({
props: state.CdpMenuModel,
}));
}
render() {
return (h(Host, { class: "h-full block w-full" },
h("cdp-menu", { config: Object.assign(Object.assign({}, this.config.menuConfig), { proxyHandler: this.proxyHandler }), props: this.props },
h("slot", null))));
}
static get is() { return "cdp-menu-rematch"; }
static get properties() { return {
"config": {
"type": "unknown",
"mutable": false,
"complexType": {
"original": "{\r\n menuConfig?: Omit<CdpMenuConfig, 'proxyHandler'>;\r\n store: RematchStore<{ CdpMenuModel: typeof CdpMenuModel }>;\r\n }",
"resolved": "{ menuConfig?: Omit<CdpMenuConfig, \"proxyHandler\">; store: RematchStore<{ CdpMenuModel: { state: { display: boolean; }; reducers: { set(state: CdpMenuState, payload: CdpMenuState): CdpMenuState; open(state: CdpMenuState): CdpMenuState; close(state: CdpMenuState): CdpMenuState; toggle(state: CdpMenuState): CdpMenuState; }; }; }, Record<string, any>>; }",
"references": {
"Omit": {
"location": "global"
},
"CdpMenuConfig": {
"location": "import",
"path": "@codeperate/cdp-ui-library/dist/types/components/cdp/cdp-menu/cdp-menu.interface"
},
"RematchStore": {
"location": "import",
"path": "@rematch/core"
}
}
},
"required": true,
"optional": false,
"docs": {
"tags": [],
"text": ""
}
}
}; }
static get states() { return {
"props": {}
}; }
static get elementRef() { return "rootEl"; }
}