move util

This commit is contained in:
Josh Hawkins
2026-02-27 09:40:21 -06:00
parent 72ccd397f9
commit c3d68f3867
2 changed files with 3 additions and 3 deletions
@@ -1,32 +0,0 @@
import mergeWith from "lodash/mergeWith";
import type { SectionConfig } from "./sections/BaseSection";
import { sectionConfigs } from "./sectionConfigs";
const mergeSectionConfig = (
base: SectionConfig | undefined,
overrides: Partial<SectionConfig> | undefined,
): SectionConfig =>
mergeWith({}, base ?? {}, overrides ?? {}, (objValue, srcValue, key) => {
if (Array.isArray(objValue) || Array.isArray(srcValue)) {
return srcValue ?? objValue;
}
if (key === "uiSchema" && srcValue !== undefined) {
return srcValue;
}
return undefined;
});
export function getSectionConfig(
sectionKey: string,
level: "global" | "camera",
): SectionConfig {
const entry = sectionConfigs[sectionKey];
if (!entry) {
return {};
}
const overrides = level === "global" ? entry.global : entry.camera;
return mergeSectionConfig(entry.base, overrides);
}
@@ -1,7 +1,7 @@
import { useMemo } from "react";
import { createConfigSection } from "./BaseSection";
import type { BaseSectionProps, SectionConfig } from "./BaseSection";
import { getSectionConfig } from "@/components/config-form/sectionConfigsUtils";
import { getSectionConfig } from "@/utils/sectionConfigsUtils";
export type ConfigSectionTemplateProps = BaseSectionProps & {
sectionKey: string;