Skip to main content

CnWidgetVisibilityRulesModal

Isolated host (ADR-004) for editing a dashboard-widget's conditional-visibility rule set. It is a pure editor — it does NO API. The rule model is OR-across-rules / AND-within-a-rule: the widget shows when ANY rule matches, and a rule matches only when ALL of its conditions match. Each condition is one of four kinds — group, time (time-of-day), date (date-range), attribute (user-attribute). The modal edits a working copy of the passed rules; nothing leaves the modal until Save, which emits the rebuilt array.

Usage

<template>
<CnWidgetVisibilityRulesModal
:show="showRules"
:rules="widget.visibilityRules"
:available-groups="groups"
@close="showRules = false"
@save="onRulesSave" />
</template>

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

export default {
components: { CnWidgetVisibilityRulesModal },
data() {
return { showRules: false, widget: { visibilityRules: [] }, groups: [] }
},
methods: {
onRulesSave(rules) { this.widget.visibilityRules = rules },
},
}
</script>

Props

PropTypeDefaultDescription
showBooleanfalseToggles visibility. Going false → true re-seeds the working copy from rules.
rulesArray[]The rule set to edit. Each rule ANDs its conditions; the array ORs its rules. A condition is { kind, ...config }. The prop is not mutated — Save emits a fresh array.
available-groupsArray[]Group options for the group condition picker.

Events

EventPayloadDescription
closeFired on Cancel, backdrop click, or Esc — discards the working copy.
saverules (Array)Fired on Save with the rebuilt rule array.