ERP-node/frontend/components/v2/config-panels/V2TableSearchWidgetConfigPa...

69 lines
1.7 KiB
TypeScript
Raw Normal View History

"use client";
/**
* V2TableSearchWidget
* TableSearchWidgetConfigPanel의 ( , , )
* componentConfigChanged
*/
import React from "react";
import { TableSearchWidgetConfigPanel } from "@/lib/registry/components/v2-table-search-widget/TableSearchWidgetConfigPanel";
interface V2TableSearchWidgetConfigPanelProps {
component?: any;
config?: any;
onUpdateProperty?: (property: string, value: any) => void;
onChange?: (newConfig: any) => void;
tables?: any[];
}
export function V2TableSearchWidgetConfigPanel({
component,
config,
onUpdateProperty,
onChange,
tables,
}: V2TableSearchWidgetConfigPanelProps) {
const handleChange = (newConfig: any) => {
if (onChange) {
onChange(newConfig);
}
if (typeof window !== "undefined") {
window.dispatchEvent(
new CustomEvent("componentConfigChanged", {
detail: { config: newConfig },
})
);
}
};
const handleUpdateProperty = (property: string, value: any) => {
if (onUpdateProperty) {
onUpdateProperty(property, value);
}
if (typeof window !== "undefined") {
window.dispatchEvent(
new CustomEvent("componentConfigChanged", {
detail: { property, value },
})
);
}
};
return (
<TableSearchWidgetConfigPanel
component={component}
config={config}
onUpdateProperty={onChange ? undefined : handleUpdateProperty}
onChange={onChange ? handleChange : undefined}
tables={tables}
/>
);
}
V2TableSearchWidgetConfigPanel.displayName = "V2TableSearchWidgetConfigPanel";
export default V2TableSearchWidgetConfigPanel;