mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-03-11 02:47:37 +03:00
add ui option to remove inner cards
This commit is contained in:
parent
ef55d90379
commit
13cdab5071
@ -532,10 +532,19 @@ export function DetectorHardwareField(props: FieldProps) {
|
|||||||
const globalHidden = buildHiddenUiSchema(globalHiddenFields);
|
const globalHidden = buildHiddenUiSchema(globalHiddenFields);
|
||||||
const hiddenOverrides = buildHiddenUiSchema(hiddenByType[type] ?? []);
|
const hiddenOverrides = buildHiddenUiSchema(hiddenByType[type] ?? []);
|
||||||
const typeHidden = { type: { "ui:widget": "hidden" } } as UiSchema;
|
const typeHidden = { type: { "ui:widget": "hidden" } } as UiSchema;
|
||||||
|
const nestedOverrides = {
|
||||||
|
"ui:options": {
|
||||||
|
disableNestedCard: true,
|
||||||
|
},
|
||||||
|
} as UiSchema;
|
||||||
|
|
||||||
const withGlobalHidden = mergeUiSchema(baseUiSchema, globalHidden);
|
const withGlobalHidden = mergeUiSchema(baseUiSchema, globalHidden);
|
||||||
const withTypeHidden = mergeUiSchema(withGlobalHidden, hiddenOverrides);
|
const withTypeHidden = mergeUiSchema(withGlobalHidden, hiddenOverrides);
|
||||||
return mergeUiSchema(withTypeHidden, typeHidden);
|
const withTypeHiddenAndOptions = mergeUiSchema(
|
||||||
|
withTypeHidden,
|
||||||
|
typeHidden,
|
||||||
|
);
|
||||||
|
return mergeUiSchema(withTypeHiddenAndOptions, nestedOverrides);
|
||||||
},
|
},
|
||||||
[globalHiddenFields, hiddenByType, uiSchema?.additionalProperties],
|
[globalHiddenFields, hiddenByType, uiSchema?.additionalProperties],
|
||||||
);
|
);
|
||||||
@ -785,12 +794,7 @@ export function DetectorHardwareField(props: FieldProps) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div className={cn(readonly && "opacity-90")}>
|
||||||
className={cn(
|
|
||||||
"rounded-md border border-border/70 bg-background p-0",
|
|
||||||
readonly && "opacity-90",
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
{renderInstanceForm(key, value)}
|
{renderInstanceForm(key, value)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -56,6 +56,8 @@ export function ObjectFieldTemplate(props: ObjectFieldTemplateProps) {
|
|||||||
|
|
||||||
const groupDefinitions =
|
const groupDefinitions =
|
||||||
(uiSchema?.["ui:groups"] as Record<string, string[]> | undefined) || {};
|
(uiSchema?.["ui:groups"] as Record<string, string[]> | undefined) || {};
|
||||||
|
const disableNestedCard =
|
||||||
|
uiSchema?.["ui:options"]?.disableNestedCard === true;
|
||||||
|
|
||||||
const isHiddenProp = (prop: (typeof properties)[number]) =>
|
const isHiddenProp = (prop: (typeof properties)[number]) =>
|
||||||
prop.content.props.uiSchema?.["ui:widget"] === "hidden";
|
prop.content.props.uiSchema?.["ui:widget"] === "hidden";
|
||||||
@ -250,6 +252,36 @@ export function ObjectFieldTemplate(props: ObjectFieldTemplateProps) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (disableNestedCard) {
|
||||||
|
return (
|
||||||
|
<div className="space-y-4">
|
||||||
|
{hasCustomChildren ? (
|
||||||
|
children
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
{renderGroupedFields(regularProps)}
|
||||||
|
<AddPropertyButton
|
||||||
|
onAddProperty={onAddProperty}
|
||||||
|
schema={schema}
|
||||||
|
uiSchema={uiSchema}
|
||||||
|
formData={formData}
|
||||||
|
disabled={disabled}
|
||||||
|
readonly={readonly}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<AdvancedCollapsible
|
||||||
|
count={advancedProps.length}
|
||||||
|
open={showAdvanced}
|
||||||
|
onOpenChange={setShowAdvanced}
|
||||||
|
>
|
||||||
|
{renderGroupedFields(advancedProps)}
|
||||||
|
</AdvancedCollapsible>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Nested objects render as collapsible cards
|
// Nested objects render as collapsible cards
|
||||||
return (
|
return (
|
||||||
<Card className="w-full">
|
<Card className="w-full">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user