@nextcloud/vue
Version:
Nextcloud vue components
66 lines (65 loc) • 1.92 kB
JavaScript
require('../assets/NcAppSettingsSection-IzrCzLDw.css');
;
const _pluginVue2_normalizer = require("../chunks/_plugin-vue2_normalizer-V0q-tHlQ.cjs");
const _sfc_main = {
name: "NcAppSettingsSection",
inject: ["registerSection", "unregisterSection"],
props: {
/**
* Name of the section
*/
name: {
type: String,
required: true
},
/**
* The id of the section
*/
id: {
type: String,
required: true,
validator(id) {
return /^[a-z0-9\-_]+$/.test(id);
}
}
},
computed: {
// generate an id for each settingssection based on the name without whitespaces
htmlId() {
return "settings-section_" + this.id;
}
},
// Reactive changes for section navigation
watch: {
id(newId, oldId) {
this.unregisterSection(oldId);
this.registerSection(newId, this.name, this.$slots?.icon);
},
name(newName) {
this.unregisterSection(this.id);
this.registerSection(this.id, newName, this.$slots?.icon);
}
},
mounted() {
this.registerSection(this.id, this.name, this.$slots?.icon);
},
beforeDestroy() {
this.unregisterSection(this.id);
}
};
var _sfc_render = function render() {
var _vm = this, _c = _vm._self._c;
return _c("section", { staticClass: "app-settings-section", attrs: { "id": _vm.htmlId, "aria-labelledby": `${_vm.htmlId}--label` } }, [_c("h3", { staticClass: "app-settings-section__name", attrs: { "id": `${_vm.htmlId}--label` } }, [_vm._v(" " + _vm._s(_vm.name) + " ")]), _vm._t("default"), _vm._e()], 2);
};
var _sfc_staticRenderFns = [];
var __component__ = /* @__PURE__ */ _pluginVue2_normalizer.normalizeComponent(
_sfc_main,
_sfc_render,
_sfc_staticRenderFns,
false,
null,
"b1b2060d"
);
const NcAppSettingsSection = __component__.exports;
module.exports = NcAppSettingsSection;
//# sourceMappingURL=NcAppSettingsSection.cjs.map