import './LayoutSettings.scss' import { NButton, NFlex, NForm, NFormItem, NInputNumber, NSelect, NSwitch, } from 'naive-ui' import { defineComponent } from 'vue' import type { PropType } from 'vue' import { LAYOUT_MODES } from './AdminShell' import type { LayoutConfig } from './AdminShell' export const LayoutSettings = defineComponent({ name: 'LayoutSettings', props: { showDescription: Boolean, layout: { type: Object as PropType, required: true }, defaults: { type: Object as PropType, required: true }, translate: { type: Function as PropType<(key: string) => string>, required: true, }, update: { type: Function as PropType<(value: Partial) => void>, required: true, }, }, setup(props) { const text = props.translate const update = props.update return () => ( {props.showDescription ? (

{text('description')}

) : null}
{LAYOUT_MODES.map((mode) => ( ))}
{props.showDescription ? (

{text(`modeHint.${props.layout.mode}`)}

) : null} ({ value, label: text(value), }))} onUpdateValue={(value: LayoutConfig['contentWidth']) => update({ contentWidth: value }) } /> { if (value !== null) update({ contentMaxWidth: value }) }} /> { if (value !== null) update({ contentPadding: value }) }} /> update({ fixedHeader })} /> update({ fixedFooter })} /> update({ ...props.defaults })}> {text('reset')}
) }, })