Ga naar hoofdinhoud

CnWidgetStyleEditorModal

Isolated host (ADR-004) for editing a single dashboard-widget's chrome: its title override, background colour, and icon. It is a pure editor — it does NO API and NO grid work. On Save it mutates the passed widget object in place (writing widget.styleConfig, widget.showTitle, widget.customTitle, widget.customIcon) and emits save with the same object, so the parent can persist. The draft is a working copy; nothing on the widget changes until Save — Cancel / Esc / backdrop discard the draft.

Usage

<template>
<CnWidgetStyleEditorModal
:show="showStyleEditor"
:widget="activeWidget"
:deletable="!activeWidget.compulsory"
@close="showStyleEditor = false"
@save="onStyleSave"
@delete="onWidgetDelete" />
</template>

<script>
import { CnWidgetStyleEditorModal } from '@conduction/nextcloud-vue'

export default {
components: { CnWidgetStyleEditorModal },
data() {
return { showStyleEditor: false, activeWidget: {} }
},
methods: {
onStyleSave(widget) { /* persist widget.styleConfig + chrome fields */ },
onWidgetDelete(widget) { /* remove the placement */ },
},
}
</script>

Props

PropTypeDefaultDescription
showBooleanfalseToggles visibility. Going false → true re-seeds the draft from widget.
widget{ styleConfig?, showTitle?, customTitle?, customIcon?, title? }The widget chrome being edited. Its styleConfig and chrome fields (showTitle, customTitle, customIcon) are mutated in place on Save.
deletableBooleantrueWhether to show the Delete button (false for compulsory widgets).
extraIconOptionsArray<{id, label, icon}>[]Extra icon options appended to the built-in set (e.g. an app's own icon pack). icon may be an MDI path string OR a URL/absolute path (rendered as an <img>).

Events

EventPayloadDescription
closeFired on Cancel, backdrop click, or Esc — never mutates the widget.
savewidget (object)Fired on Save with the in-place-mutated widget.
deletewidgetFired when the Delete button is clicked. Payload is the widget.