import type { RenderCtxBase } from "../../../render";
import type { PlDataTableModel } from "../typesV8";
import { createPlDataTableOptionsV2, createPlDataTableV2 } from "./createPlDataTableV2";
import { createPlDataTableV3 } from "./createPlDataTableV3";
import type { createPlDataTableOptionsV3 } from "./createPlDataTableV3";
export function createPlDataTable(
ctx: RenderCtxBase,
options: { version: "v2" } & createPlDataTableOptionsV2,
): ReturnType;
export function createPlDataTable(
ctx: RenderCtxBase,
options: { version?: "v3" } & createPlDataTableOptionsV3,
): ReturnType;
export function createPlDataTable(
ctx: RenderCtxBase,
options:
| ({ version: "v2" } & createPlDataTableOptionsV2)
| ({ version?: "v3" } & createPlDataTableOptionsV3),
): PlDataTableModel | undefined {
if (options.version === "v2") {
return createPlDataTableV2(ctx, options.columns, options.tableState, options.options);
} else {
// default version is last (v3 at the moment)
return createPlDataTableV3(ctx, options);
}
}
export { discoverTableColumns as discoverTableColumnSnaphots } from "./discoverColumns";