@conduction/nextcloud-vue 2.154.0 → 2.156.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/components/CnAiCompanion/CnAiInput.vue2.js +3 -1
- package/dist/esm/components/CnAiCompanion/CnAiInput.vue2.js.map +1 -1
- package/dist/esm/components/CnAiCompanion/CnAiInput.vue3.js.map +1 -1
- package/dist/esm/components/CnAppRoot/CnAppRoot.vue2.js.map +1 -1
- package/dist/esm/components/CnAppRoot/CnAppRoot.vue3.js +2 -2
- package/dist/esm/components/CnAppRoot/CnAppRoot.vue3.js.map +1 -1
- package/dist/esm/components/CnAssignDialog/CnAssignDialog.vue.js +1 -1
- package/dist/esm/components/CnAssignDialog/CnAssignDialog.vue2.js +10 -5
- package/dist/esm/components/CnAssignDialog/CnAssignDialog.vue2.js.map +1 -1
- package/dist/esm/components/CnAssignDialog/CnAssignDialog.vue3.js.map +1 -1
- package/dist/esm/components/CnAttentionFlagWidget/CnAttentionFlagWidget.vue.js +1 -1
- package/dist/esm/components/CnAttentionFlagWidget/CnAttentionFlagWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnAttentionFlagWidget/CnAttentionFlagWidget.vue3.js +2 -0
- package/dist/esm/components/CnAttentionFlagWidget/CnAttentionFlagWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnChoiceCards/CnChoiceCards.vue.js +1 -1
- package/dist/esm/components/CnChoiceCards/CnChoiceCards.vue2.js.map +1 -1
- package/dist/esm/components/CnChoiceCards/CnChoiceCards.vue3.js.map +1 -1
- package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue.js +1 -1
- package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue.js +1 -1
- package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue2.js.map +1 -1
- package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue3.js.map +1 -1
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue.js +1 -1
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue2.js +9 -8
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnIndexSidebar/CnIndexSidebar.vue2.js +13 -4
- package/dist/esm/components/CnIndexSidebar/CnIndexSidebar.vue2.js.map +1 -1
- package/dist/esm/components/CnIndexSidebar/CnIndexSidebar.vue3.js.map +1 -1
- package/dist/esm/components/CnLinkedWidget/CnLinkedWidget.vue.js +1 -1
- package/dist/esm/components/CnLinkedWidget/CnLinkedWidget.vue2.js +91 -7
- package/dist/esm/components/CnLinkedWidget/CnLinkedWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnLinkedWidget/CnLinkedWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnMapWidget/CnMapWidget.vue.js +1 -1
- package/dist/esm/components/CnMapWidget/CnMapWidget.vue2.js +37 -0
- package/dist/esm/components/CnMapWidget/CnMapWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnMapWidget/CnMapWidget.vue3.js +16 -7
- package/dist/esm/components/CnMapWidget/CnMapWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue.js +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js +2 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnSavedViewMenuSettings/CnSavedViewMenuSettings.vue.js +1 -1
- package/dist/esm/components/CnSavedViewMenuSettings/CnSavedViewMenuSettings.vue2.js.map +1 -1
- package/dist/esm/components/CnSavedViewMenuSettings/CnSavedViewMenuSettings.vue3.js.map +1 -1
- package/dist/esm/components/CnSchemaFormDialog/CnSchemaConfigurationTab.vue2.js +25 -0
- package/dist/esm/components/CnSchemaFormDialog/CnSchemaConfigurationTab.vue2.js.map +1 -1
- package/dist/esm/components/CnSchemaFormDialog/CnSchemaConfigurationTab.vue3.js +40 -8
- package/dist/esm/components/CnSchemaFormDialog/CnSchemaConfigurationTab.vue3.js.map +1 -1
- package/dist/esm/components/CnSchemaFormDialog/CnSchemaFormDialog.vue2.js +10 -0
- package/dist/esm/components/CnSchemaFormDialog/CnSchemaFormDialog.vue2.js.map +1 -1
- package/dist/esm/components/CnSchemaFormDialog/CnSchemaFormDialog.vue3.js.map +1 -1
- package/dist/esm/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue.js +1 -1
- package/dist/esm/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue2.js +24 -1
- package/dist/esm/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue2.js.map +1 -1
- package/dist/esm/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue3.js +9 -0
- package/dist/esm/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue3.js.map +1 -1
- package/dist/esm/components/CnUserSettingsDialog/CnUserSettingsDialog.vue.js +1 -1
- package/dist/esm/components/CnUserSettingsDialog/CnUserSettingsDialog.vue2.js.map +1 -1
- package/dist/esm/components/CnUserSettingsDialog/CnUserSettingsDialog.vue3.js.map +1 -1
- package/dist/esm/l10n/en.json.js +12 -7
- package/dist/esm/l10n/en.json.js.map +1 -1
- package/dist/esm/l10n/nl.json.js +14 -9
- package/dist/esm/l10n/nl.json.js.map +1 -1
- package/dist/esm/library-style.js +1 -1
- package/dist/esm/nextcloud-vue.css +604 -375
- package/dist/esm/utils/groupSublines.js +30 -12
- package/dist/esm/utils/groupSublines.js.map +1 -1
- package/dist/nextcloud-vue.cjs.js +1783 -1509
- package/dist/nextcloud-vue.cjs.js.map +2 -2
- package/dist/nextcloud-vue.css +604 -375
- package/l10n/en.json +12 -7
- package/l10n/nl.json +14 -9
- package/package.json +1 -1
- package/src/components/CnAiCompanion/CnAiInput.vue +3 -1
- package/src/components/CnAppRoot/CnAppRoot.vue +2 -2
- package/src/components/CnAssignDialog/CnAssignDialog.vue +10 -5
- package/src/components/CnAttentionFlagWidget/CnAttentionFlagWidget.vue +2 -6
- package/src/components/CnChoiceCards/CnChoiceCards.vue +9 -0
- package/src/components/CnCountdownWidget/CnCountdownWidget.vue +3 -0
- package/src/components/CnDashboardPage/CnDashboardPage.vue +7 -2
- package/src/components/CnFactsWidget/CnFactsWidget.vue +9 -8
- package/src/components/CnIndexSidebar/CnIndexSidebar.vue +13 -4
- package/src/components/CnLinkedWidget/CnLinkedWidget.vue +91 -7
- package/src/components/CnMapWidget/CnMapWidget.vue +55 -1
- package/src/components/CnRecordListWidget/CnRecordListWidget.vue +3 -2
- package/src/components/CnSavedViewMenuSettings/CnSavedViewMenuSettings.vue +3 -1
- package/src/components/CnSchemaFormDialog/CnSchemaConfigurationTab.vue +42 -0
- package/src/components/CnSchemaFormDialog/CnSchemaFormDialog.vue +10 -0
- package/src/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue +37 -1
- package/src/components/CnUserSettingsDialog/CnUserSettingsDialog.vue +4 -1
- package/src/css/dialog.css +43 -0
- package/src/css/look-board-detail.css +42 -0
- package/src/css/look-board-index.css +8 -0
- package/src/css/look-board.css +107 -3
- package/src/utils/groupSublines.js +29 -11
|
@@ -2,7 +2,7 @@ import script from './CnSavedViewMenuSettings.vue2.js';
|
|
|
2
2
|
import { render } from './CnSavedViewMenuSettings.vue3.js';
|
|
3
3
|
|
|
4
4
|
script.render = render;
|
|
5
|
-
script.__scopeId = "data-v-
|
|
5
|
+
script.__scopeId = "data-v-527dbad5";
|
|
6
6
|
const __sfc_main = script;
|
|
7
7
|
|
|
8
8
|
export { __sfc_main as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CnSavedViewMenuSettings.vue2.js","sources":["../../../../src/components/CnSavedViewMenuSettings/CnSavedViewMenuSettings.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<div class=\"cn-saved-view-menu-settings\" data-testid=\"cn-saved-view-menu-settings\">\n\t\t<p class=\"cn-saved-view-menu-settings__intro\">\n\t\t\t{{ t('nextcloud-vue', 'These saved views are at the bottom of your menu under My views, in this order. Drag a row or use the arrow keys. You put a view in the menu with Add to menu in the side panel of a list.') }}\n\t\t</p>\n\t\t<CnOrderedListField\n\t\t\t:modelValue=\"values\"\n\t\t\t:options=\"options\"\n\t\t\t:label=\"t('nextcloud-vue', 'Views in my menu')\"\n\t\t\t:hideLabel=\"true\"\n\t\t\t:addLabel=\"t('nextcloud-vue', 'Add view')\"\n\t\t\t:addPlaceholder=\"t('nextcloud-vue', 'Pick a saved view')\"\n\t\t\t:addHint=\"t('nextcloud-vue', 'You see your own views, the views shared with you and the default views. A new view goes to the bottom.')\"\n\t\t\t:removeLabel=\"t('nextcloud-vue', 'Remove from menu')\"\n\t\t\t:emptyText=\"t('nextcloud-vue', 'Your menu has no views yet.')\"\n\t\t\t:loading=\"loading\"\n\t\t\t:disabled=\"!menu\"\n\t\t\t@update:modelValue=\"onChange\" />\n\t</div>\n</template>\n\n<script>\nimport { translatePlural as n, translate as t } from '@nextcloud/l10n'\nimport CnOrderedListField from '../CnOrderedListField/CnOrderedListField.vue'\nimport { useSavedViewsApi } from '../../composables/useSavedViewsApi.js'\nimport { countLine } from '../../utils/countLine.js'\nimport { facetFilterParams } from '../../utils/facets.js'\nimport { fetchFilterCounts } from '../../utils/fetchFilterCounts.js'\nimport { pickRefLabel } from '../../utils/headerFieldChips.js'\nimport { buildHeaders, buildQueryString, prefixUrl } from '../../utils/headers.js'\nimport { resolveFilterMap } from '../../utils/routeFilters.js'\nimport { defaultFilterViews, extractViewState, pageOffersSavedViews, viewMatchesScope } from '../../utils/savedViewHelpers.js'\nimport { normalizeSavedViewMenu } from '../../utils/savedViewMenu.js'\nimport { summarizeViewFilters, viewFilterReferences } from '../../utils/savedViewSummary.js'\nimport { fieldsFromSchema } from '../../utils/schema.js'\n\n// Per session: a schema, a referenced record's name and a view's count are\n// asked once, however often the dialog opens.\nconst schemaCache = new Map()\nconst labelCache = new Map()\nconst countCache = new Map()\n\n/**\n * The key a menu entry or a candidate view is listed under.\n *\n * @param {string} page The page's route name.\n * @param {string} id The view id.\n * @return {string}\n */\nfunction keyOf(page, id) {\n\treturn `${page}|${id}`\n}\n\n/**\n * GET a JSON document from OpenRegister.\n *\n * @param {string} path The app-absolute path.\n * @param {object} [params] Query parameters.\n * @return {Promise<object>}\n */\nasync function getJson(path, params = {}) {\n\tconst response = await fetch(prefixUrl(path + buildQueryString(params)), { headers: buildHeaders() })\n\tif (!response.ok) {\n\t\tthrow new Error(`${path} returned ${response.status}`)\n\t}\n\treturn response.json()\n}\n\n/**\n * A page's schema, asked once.\n *\n * @param {string} register The register slug.\n * @param {string} schema The schema slug.\n * @return {Promise<object|null>}\n */\nfunction loadSchema(register, schema) {\n\tconst key = `${register}|${schema}`\n\tif (!schemaCache.has(key)) {\n\t\t// A failed read is forgotten, so the next opening asks again instead\n\t\t// of naming every filter by its raw key for the rest of the session.\n\t\tschemaCache.set(key, getJson(`/apps/openregister/api/schemas/${encodeURIComponent(schema)}`, { register }).catch(() => {\n\t\t\tschemaCache.delete(key)\n\t\t\treturn null\n\t\t}))\n\t}\n\treturn schemaCache.get(key)\n}\n\n/**\n * The names of referenced records, each asked once.\n *\n * @param {{register: string, schema: string, labelField: string, matchField?: string, ids: Array<string>}} ref The reference filter; with `matchField` the ids are that field's values.\n * @return {Promise<{[id: string]: string}>}\n */\nasync function loadLabels(ref) {\n\tconst prefix = `${ref.register}|${ref.schema}|${ref.labelField}|${ref.matchField || ''}|`\n\tconst missing = ref.ids.filter((id) => !labelCache.has(prefix + id))\n\t// A value that identifies a record by another field: one read per value.\n\tif (missing.length > 0 && ref.matchField) {\n\t\tfor (const value of missing) {\n\t\t\tlabelCache.set(prefix + value, getJson(`/apps/openregister/api/objects/${encodeURIComponent(ref.register)}/${encodeURIComponent(ref.schema)}`, { [ref.matchField]: value, _limit: 1 })\n\t\t\t\t.then((data) => {\n\t\t\t\t\tconst row = Array.isArray(data && data.results) ? data.results[0] : null\n\t\t\t\t\treturn row ? pickRefLabel(row, ref.labelField) : null\n\t\t\t\t})\n\t\t\t\t.catch(() => null))\n\t\t}\n\t} else if (missing.length > 0) {\n\t\tconst request = getJson(`/apps/openregister/api/objects/${encodeURIComponent(ref.register)}/${encodeURIComponent(ref.schema)}`, { _ids: missing.join(','), _limit: missing.length })\n\t\t\t.then((data) => {\n\t\t\t\tconst byId = {}\n\t\t\t\tfor (const row of (Array.isArray(data && data.results) ? data.results : [])) {\n\t\t\t\t\tconst id = row && (row.id ?? row.uuid ?? (row['@self'] && row['@self'].id))\n\t\t\t\t\tif (id !== undefined && id !== null) {\n\t\t\t\t\t\tbyId[String(id)] = pickRefLabel(row, ref.labelField)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn byId\n\t\t\t})\n\t\t\t.catch(() => ({}))\n\t\tfor (const id of missing) {\n\t\t\tlabelCache.set(prefix + id, request.then((byId) => byId[id] || null))\n\t\t}\n\t}\n\tconst out = {}\n\tawait Promise.all(ref.ids.map(async (id) => {\n\t\tconst label = await labelCache.get(prefix + id)\n\t\tif (label) {\n\t\t\tout[id] = label\n\t\t}\n\t}))\n\treturn out\n}\n\n/**\n * How many records a view's filters match on its page, asked once per view.\n *\n * @param {{register: string, schema: string, baseFilter: object}} page The page.\n * @param {object} filter The view's filters as query parameters.\n * @return {Promise<number|null>}\n */\nfunction loadCount(page, filter) {\n\tconst key = JSON.stringify([page.register, page.schema, page.baseFilter, filter])\n\tif (!countCache.has(key)) {\n\t\tcountCache.set(key, fetchFilterCounts({ register: page.register, schema: page.schema, entries: [{ key: 'view', filter }], baseFilter: page.baseFilter })\n\t\t\t.then((counts) => (typeof counts.view === 'number' ? counts.view : null))\n\t\t\t.catch(() => null))\n\t}\n\treturn countCache.get(key)\n}\n\n/**\n * A view's filters as the list request sends them.\n *\n * @param {{filters: object, search: string}} state The view's state.\n * @return {object}\n */\nfunction filterParams(state) {\n\tconst out = {}\n\tfor (const [key, raw] of Object.entries(state.filters || {})) {\n\t\tObject.assign(out, facetFilterParams(key, Array.isArray(raw) ? raw : [raw]))\n\t}\n\tif (state.search) {\n\t\tout._search = state.search\n\t}\n\treturn out\n}\n\n/**\n * CnSavedViewMenuSettings - the user's \"My views\" menu entries as a settings\n * section body (board DqPersoonlijkeInstellingen, \"Views in my menu\"): the\n * entries in their menu order, reordered by dragging or the arrow keys,\n * taken out of the menu with \"Remove from menu\", and a picker that adds any\n * view the user can see on a page of the app (their own, shared ones and the\n * pages' default views). Removing an entry never deletes the view.\n *\n * Each row says what its view shows and how many records that is: \"Case\n * type Woo request, status open · 19 cases\". The line is built from the\n * view's filters with the page schema's titles and the names of the records\n * and options they point at; the count is one request per view, cached for\n * the session, and fills in when it arrives without holding up the list.\n *\n * Reads and writes the list CnAppRoot holds (`cnSavedViewMenu`, stored in\n * the `cn_saved_view_menu` preference). CnAppRoot draws it as the `views`\n * section of its user settings dialog; an app with a dialog of its own can\n * mount it inside an NcAppSettingsSection.\n *\n * @spec openspec/changes/saved-view-menu-settings/specs/saved-view-menu-settings/spec.md#requirement-a-user-orders-and-picks-the-views-in-their-menu\n */\nexport default {\n\tname: 'CnSavedViewMenuSettings',\n\tcomponents: { CnOrderedListField },\n\tinject: {\n\t\tcnSavedViewMenu: { default: null },\n\t\tcnManifest: { default: null },\n\t\tcnTranslate: { default: () => (key) => key },\n\t\tcnAppId: { default: '' },\n\t\tcnAppConfig: { default: null },\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\tviews: [],\n\t\t\tloading: false,\n\t\t\t/** The schema per page id. */\n\t\t\tschemas: {},\n\t\t\t/** Looked-up display names per page id, filter key and value. */\n\t\t\tvalueLabels: {},\n\t\t\t/** The count per list value; undefined while it is asked. */\n\t\t\tcounts: {},\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** @return {object|null} The menu holder, when it can be changed. */\n\t\tmenu() {\n\t\t\tconst menu = this.cnSavedViewMenu\n\t\t\treturn menu && typeof menu.set === 'function' ? menu : null\n\t\t},\n\n\t\t/** @return {Array<object>} The stored entries. */\n\t\tentries() {\n\t\t\treturn normalizeSavedViewMenu(this.cnSavedViewMenu ? this.cnSavedViewMenu.entries : [])\n\t\t},\n\n\t\t/** @return {Array<object>} The pages that offer saved views. */\n\t\tpages() {\n\t\t\tconst pages = this.cnManifest && Array.isArray(this.cnManifest.pages) ? this.cnManifest.pages : []\n\t\t\treturn pages\n\t\t\t\t.filter((page) => page && page.type === 'index' && typeof page.id === 'string' && pageOffersSavedViews(page.config))\n\t\t\t\t.map((page) => {\n\t\t\t\t\tconst config = page.config || {}\n\t\t\t\t\treturn {\n\t\t\t\t\t\tid: page.id,\n\t\t\t\t\t\ttitle: typeof page.title === 'string' ? this.cnTranslate(page.title) : page.id,\n\t\t\t\t\t\tscope: { scope: config.savedViewsScope, register: config.register, schema: config.schema, source: config.entitySource },\n\t\t\t\t\t\tdefaults: Array.isArray(config.defaultSavedViews) ? config.defaultSavedViews : [],\n\t\t\t\t\t\tregister: typeof config.register === 'string' ? config.register : '',\n\t\t\t\t\t\tschema: typeof config.schema === 'string' ? config.schema : '',\n\t\t\t\t\t\tbaseFilter: resolveFilterMap(config.filter, {}, { config: this.cnAppConfig || {} }),\n\t\t\t\t\t\tcountSubtitle: config.countSubtitle || null,\n\t\t\t\t\t\tfilterLabels: (config.filterLabels && typeof config.filterLabels === 'object') ? config.filterLabels : {},\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t},\n\n\t\t/** @return {Array<object>} Every view the user can put in the menu, with its page and state. */\n\t\tcandidates() {\n\t\t\tconst out = []\n\t\t\tfor (const page of this.pages) {\n\t\t\t\tconst defaults = page.defaults.map((entry) => (entry && typeof entry.name === 'string' ? { ...entry, name: this.cnTranslate(entry.name) } : entry))\n\t\t\t\tconst views = [...defaultFilterViews(defaults, page.scope), ...this.views.filter((view) => viewMatchesScope(view, page.scope))]\n\t\t\t\tfor (const view of views) {\n\t\t\t\t\tconst id = String(view.id ?? view.slug ?? '')\n\t\t\t\t\tif (id === '' || typeof view.name !== 'string' || view.name === '') {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tout.push({ value: keyOf(page.id, id), id, page: page.id, label: view.name, state: extractViewState(view) })\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn out\n\t\t},\n\n\t\t/** @return {Array<string>} The entries as list values, in menu order. */\n\t\tvalues() {\n\t\t\treturn this.entries.map((entry) => keyOf(entry.page, entry.id))\n\t\t},\n\n\t\t/**\n\t\t * The choices: the candidates, and the entries no candidate covers. A\n\t\t * choice's second line says what the view shows; a row in the menu\n\t\t * adds how many records that is, once the count is in.\n\t\t *\n\t\t * @return {Array<{value: string, label: string, description: string}>}\n\t\t */\n\t\toptions() {\n\t\t\tconst byId = new Map(this.pages.map((page) => [page.id, page]))\n\t\t\tconst inMenu = new Set(this.values)\n\t\t\tconst known = new Set(this.candidates.map((c) => c.value))\n\t\t\tconst candidates = this.candidates.map((c) => {\n\t\t\t\tconst summary = this.summaryOf(byId.get(c.page), c.state)\n\t\t\t\tconst count = inMenu.has(c.value) ? this.countText(byId.get(c.page), this.counts[c.value]) : ''\n\t\t\t\treturn { value: c.value, label: c.label, description: count ? `${summary} · ${count}` : summary }\n\t\t\t})\n\t\t\tconst stored = this.entries\n\t\t\t\t.filter((entry) => !known.has(keyOf(entry.page, entry.id)))\n\t\t\t\t.map((entry) => ({ value: keyOf(entry.page, entry.id), label: entry.name, description: byId.has(entry.page) ? byId.get(entry.page).title : '' }))\n\t\t\treturn [...candidates, ...stored]\n\t\t},\n\t},\n\n\twatch: {\n\t\t/** Look up the names a summary needs once the views are in. */\n\t\tcandidates() {\n\t\t\tthis.loadValueLabels()\n\t\t\tthis.loadCounts()\n\t\t},\n\n\t\t/** Count a view as soon as it is in the menu. */\n\t\tvalues() {\n\t\t\tthis.loadCounts()\n\t\t},\n\t},\n\n\tmounted() {\n\t\tthis.fetchViews()\n\t\tthis.loadSchemas()\n\t\tthis.loadCounts()\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/** Read the saved views the user can see; without them the defaults stay. */\n\t\tasync fetchViews() {\n\t\t\tthis.loading = true\n\t\t\ttry {\n\t\t\t\tconst views = await useSavedViewsApi().fetchViews()\n\t\t\t\tthis.views = Array.isArray(views) ? views : []\n\t\t\t} catch {\n\t\t\t\tthis.views = []\n\t\t\t} finally {\n\t\t\t\tthis.loading = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * A view's filters as one line, else the page's title.\n\t\t *\n\t\t * @param {object} page The page.\n\t\t * @param {{filters: object, search: string}} state The view's state.\n\t\t * @return {string}\n\t\t */\n\t\tsummaryOf(page, state) {\n\t\t\tconst schema = this.schemas[page.id]\n\t\t\tconst summary = summarizeViewFilters(state, {\n\t\t\t\tproperties: (schema && schema.properties) || {},\n\t\t\t\tvalueLabels: this.valueLabels[page.id] || {},\n\t\t\t\tfilterLabels: page.filterLabels,\n\t\t\t\ttranslate: this.cnTranslate,\n\t\t\t})\n\t\t\treturn summary || page.title\n\t\t},\n\n\t\t/**\n\t\t * \"19 cases\": the page's `countSubtitle` for the total, else \"19 results\".\n\t\t *\n\t\t * @param {object} page The page.\n\t\t * @param {number|undefined} total The count, when it is in.\n\t\t * @return {string} The text, or '' while the count is unknown.\n\t\t */\n\t\tcountText(page, total) {\n\t\t\tif (typeof total !== 'number') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst line = page.countSubtitle ? countLine(page.countSubtitle, total, { translate: this.cnTranslate, appId: this.cnAppId }) : ''\n\t\t\treturn line || n('nextcloud-vue', '%n result', '%n results', total)\n\t\t},\n\n\t\t/** Read the schema of every page that offers saved views, for field titles and value names. */\n\t\tasync loadSchemas() {\n\t\t\tawait Promise.all(this.pages.filter((page) => page.register && page.schema).map(async (page) => {\n\t\t\t\tconst schema = await loadSchema(page.register, page.schema)\n\t\t\t\tif (schema) {\n\t\t\t\t\tthis.schemas = { ...this.schemas, [page.id]: schema }\n\t\t\t\t}\n\t\t\t}))\n\t\t\tthis.loadValueLabels()\n\t\t},\n\n\t\t/** Look up the names of the referenced records the views filter on. */\n\t\tasync loadValueLabels() {\n\t\t\tfor (const page of this.pages) {\n\t\t\t\tconst schema = this.schemas[page.id]\n\t\t\t\tif (!schema) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tconst fields = fieldsFromSchema(schema, { includeReadOnly: true })\n\t\t\t\tconst refs = this.candidates\n\t\t\t\t\t.filter((c) => c.page === page.id)\n\t\t\t\t\t.flatMap((c) => viewFilterReferences(c.state, fields, page.filterLabels))\n\t\t\t\tfor (const ref of refs) {\n\t\t\t\t\tconst labels = await loadLabels({ ...ref, register: ref.register || page.register })\n\t\t\t\t\tif (Object.keys(labels).length === 0) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tconst forPage = this.valueLabels[page.id] || {}\n\t\t\t\t\tthis.valueLabels = { ...this.valueLabels, [page.id]: { ...forPage, [ref.key]: { ...(forPage[ref.key] || {}), ...labels } } }\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\t/** Count every view in the menu; each count fills in on its own. */\n\t\tloadCounts() {\n\t\t\tfor (const value of this.values) {\n\t\t\t\tif (Object.hasOwn(this.counts, value)) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tconst candidate = this.candidates.find((c) => c.value === value)\n\t\t\t\tconst page = candidate && this.pages.find((p) => p.id === candidate.page)\n\t\t\t\tif (!page || !page.register || !page.schema) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tthis.counts = { ...this.counts, [value]: undefined }\n\t\t\t\tloadCount(page, filterParams(candidate.state)).then((total) => {\n\t\t\t\t\tif (typeof total === 'number') {\n\t\t\t\t\t\tthis.counts = { ...this.counts, [value]: total }\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Store the list in its new order, with entries removed or added.\n\t\t *\n\t\t * @param {Array<string>} values The list values in order.\n\t\t */\n\t\tonChange(values) {\n\t\t\tif (!this.menu) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst byKey = new Map(this.entries.map((entry) => [keyOf(entry.page, entry.id), entry]))\n\t\t\tconst candidates = new Map(this.candidates.map((c) => [c.value, c]))\n\t\t\tconst next = values\n\t\t\t\t.map((value) => {\n\t\t\t\t\tif (byKey.has(value)) {\n\t\t\t\t\t\treturn byKey.get(value)\n\t\t\t\t\t}\n\t\t\t\t\tconst candidate = candidates.get(value)\n\t\t\t\t\treturn candidate ? { id: candidate.id, page: candidate.page, name: candidate.label } : null\n\t\t\t\t})\n\t\t\t\t.filter(Boolean)\n\t\t\tthis.menu.set(next)\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-saved-view-menu-settings__intro {\n\tmargin: 0 0 12px;\n\tcolor: var(--color-text-maxcontrast);\n}\n</style>\n"],"names":["CnOrderedListField","t","n"],"mappings":";;;;;;;;;;;;;;AAyCA;AACA;AACA,MAAM,cAAc,IAAI,GAAG,GAAC;AAC5B,MAAM,aAAa,IAAI,GAAG,GAAC;AAC3B,MAAM,aAAa,IAAI,GAAG,GAAC;;AAE3B;;AAEC;AACA;;AAEA;;AAED,SAAS,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE;AACxB,CAAA,OAAO,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;AACtB,CAAA;;AAEA;AACC;AACA;AACA;AACA;;;AAGD,eAAe,OAAO,CAAC,IAAI,EAAE,MAAK,GAAI,EAAE,EAAE;AACzC,CAAA,MAAM,QAAO,GAAI,MAAM,KAAK,C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AAE,CAAC,EAAE,KAAK,CAAC,CAAC,EAAA;GACvF,MAAM,UAAW,GAAE,IAAI,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAA;AACnE,GAAA,MAAM,IAAG,GAAI,MAAK;AACjB,KAAC,GAAG,CAAC,CAAC,KAAK,KAAK;AACf,KAAA,IAAI,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;AACrB,MAAA,OAAO,KAAK,CAAC,GAAG,CAAC,KAAK,CAAA;AACvB,MAAA;AACA,KAAA,MAAM,SAAQ,GAAI,UAAU,CAAC,GAAG,CAAC,KAAK,EAAA;AACtC,KAAA,OAAO,SAAU,GAAE,EAAE,EAAE,EAAE,SAAS,CAAC,EAAE,EAAE,IAAI,EAAE,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,CAAC,KAAM,EAAA,GAAI,IAAG;KAC1F,CAAA;AACD,KAAC,MAAM,CAAC,OAAO,EAAA;AAChB,GAAA,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAA;GAClB;EACD;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"CnSavedViewMenuSettings.vue2.js","sources":["../../../../src/components/CnSavedViewMenuSettings/CnSavedViewMenuSettings.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<div class=\"cn-saved-view-menu-settings\" data-testid=\"cn-saved-view-menu-settings\">\n\t\t<p class=\"cn-saved-view-menu-settings__intro\">\n\t\t\t{{ t('nextcloud-vue', 'These saved views are at the bottom of your menu under My views, in this order. Drag a row or use the arrow keys. You put a view in the menu with Add to menu in the side panel of a list.') }}\n\t\t</p>\n\t\t<CnOrderedListField\n\t\t\t:modelValue=\"values\"\n\t\t\t:options=\"options\"\n\t\t\t:label=\"t('nextcloud-vue', 'Views in my menu')\"\n\t\t\t:hideLabel=\"true\"\n\t\t\t:addLabel=\"t('nextcloud-vue', 'Add view')\"\n\t\t\t:addPlaceholder=\"t('nextcloud-vue', 'Pick a saved view')\"\n\t\t\t:addHint=\"t('nextcloud-vue', 'You see your own views, the views shared with you and the default views. A new view goes to the bottom.')\"\n\t\t\t:removeLabel=\"t('nextcloud-vue', 'Remove from menu')\"\n\t\t\t:emptyText=\"t('nextcloud-vue', 'Your menu has no views yet.')\"\n\t\t\t:loading=\"loading\"\n\t\t\t:disabled=\"!menu\"\n\t\t\t@update:modelValue=\"onChange\" />\n\t</div>\n</template>\n\n<script>\nimport { translatePlural as n, translate as t } from '@nextcloud/l10n'\nimport CnOrderedListField from '../CnOrderedListField/CnOrderedListField.vue'\nimport { useSavedViewsApi } from '../../composables/useSavedViewsApi.js'\nimport { countLine } from '../../utils/countLine.js'\nimport { facetFilterParams } from '../../utils/facets.js'\nimport { fetchFilterCounts } from '../../utils/fetchFilterCounts.js'\nimport { pickRefLabel } from '../../utils/headerFieldChips.js'\nimport { buildHeaders, buildQueryString, prefixUrl } from '../../utils/headers.js'\nimport { resolveFilterMap } from '../../utils/routeFilters.js'\nimport { defaultFilterViews, extractViewState, pageOffersSavedViews, viewMatchesScope } from '../../utils/savedViewHelpers.js'\nimport { normalizeSavedViewMenu } from '../../utils/savedViewMenu.js'\nimport { summarizeViewFilters, viewFilterReferences } from '../../utils/savedViewSummary.js'\nimport { fieldsFromSchema } from '../../utils/schema.js'\n\n// Per session: a schema, a referenced record's name and a view's count are\n// asked once, however often the dialog opens.\nconst schemaCache = new Map()\nconst labelCache = new Map()\nconst countCache = new Map()\n\n/**\n * The key a menu entry or a candidate view is listed under.\n *\n * @param {string} page The page's route name.\n * @param {string} id The view id.\n * @return {string}\n */\nfunction keyOf(page, id) {\n\treturn `${page}|${id}`\n}\n\n/**\n * GET a JSON document from OpenRegister.\n *\n * @param {string} path The app-absolute path.\n * @param {object} [params] Query parameters.\n * @return {Promise<object>}\n */\nasync function getJson(path, params = {}) {\n\tconst response = await fetch(prefixUrl(path + buildQueryString(params)), { headers: buildHeaders() })\n\tif (!response.ok) {\n\t\tthrow new Error(`${path} returned ${response.status}`)\n\t}\n\treturn response.json()\n}\n\n/**\n * A page's schema, asked once.\n *\n * @param {string} register The register slug.\n * @param {string} schema The schema slug.\n * @return {Promise<object|null>}\n */\nfunction loadSchema(register, schema) {\n\tconst key = `${register}|${schema}`\n\tif (!schemaCache.has(key)) {\n\t\t// A failed read is forgotten, so the next opening asks again instead\n\t\t// of naming every filter by its raw key for the rest of the session.\n\t\tschemaCache.set(key, getJson(`/apps/openregister/api/schemas/${encodeURIComponent(schema)}`, { register }).catch(() => {\n\t\t\tschemaCache.delete(key)\n\t\t\treturn null\n\t\t}))\n\t}\n\treturn schemaCache.get(key)\n}\n\n/**\n * The names of referenced records, each asked once.\n *\n * @param {{register: string, schema: string, labelField: string, matchField?: string, ids: Array<string>}} ref The reference filter; with `matchField` the ids are that field's values.\n * @return {Promise<{[id: string]: string}>}\n */\nasync function loadLabels(ref) {\n\tconst prefix = `${ref.register}|${ref.schema}|${ref.labelField}|${ref.matchField || ''}|`\n\tconst missing = ref.ids.filter((id) => !labelCache.has(prefix + id))\n\t// A value that identifies a record by another field: one read per value.\n\tif (missing.length > 0 && ref.matchField) {\n\t\tfor (const value of missing) {\n\t\t\tlabelCache.set(prefix + value, getJson(`/apps/openregister/api/objects/${encodeURIComponent(ref.register)}/${encodeURIComponent(ref.schema)}`, { [ref.matchField]: value, _limit: 1 })\n\t\t\t\t.then((data) => {\n\t\t\t\t\tconst row = Array.isArray(data && data.results) ? data.results[0] : null\n\t\t\t\t\treturn row ? pickRefLabel(row, ref.labelField) : null\n\t\t\t\t})\n\t\t\t\t.catch(() => null))\n\t\t}\n\t} else if (missing.length > 0) {\n\t\tconst request = getJson(`/apps/openregister/api/objects/${encodeURIComponent(ref.register)}/${encodeURIComponent(ref.schema)}`, { _ids: missing.join(','), _limit: missing.length })\n\t\t\t.then((data) => {\n\t\t\t\tconst byId = {}\n\t\t\t\tfor (const row of (Array.isArray(data && data.results) ? data.results : [])) {\n\t\t\t\t\tconst id = row && (row.id ?? row.uuid ?? (row['@self'] && row['@self'].id))\n\t\t\t\t\tif (id !== undefined && id !== null) {\n\t\t\t\t\t\tbyId[String(id)] = pickRefLabel(row, ref.labelField)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn byId\n\t\t\t})\n\t\t\t.catch(() => ({}))\n\t\tfor (const id of missing) {\n\t\t\tlabelCache.set(prefix + id, request.then((byId) => byId[id] || null))\n\t\t}\n\t}\n\tconst out = {}\n\tawait Promise.all(ref.ids.map(async (id) => {\n\t\tconst label = await labelCache.get(prefix + id)\n\t\tif (label) {\n\t\t\tout[id] = label\n\t\t}\n\t}))\n\treturn out\n}\n\n/**\n * How many records a view's filters match on its page, asked once per view.\n *\n * @param {{register: string, schema: string, baseFilter: object}} page The page.\n * @param {object} filter The view's filters as query parameters.\n * @return {Promise<number|null>}\n */\nfunction loadCount(page, filter) {\n\tconst key = JSON.stringify([page.register, page.schema, page.baseFilter, filter])\n\tif (!countCache.has(key)) {\n\t\tcountCache.set(key, fetchFilterCounts({ register: page.register, schema: page.schema, entries: [{ key: 'view', filter }], baseFilter: page.baseFilter })\n\t\t\t.then((counts) => (typeof counts.view === 'number' ? counts.view : null))\n\t\t\t.catch(() => null))\n\t}\n\treturn countCache.get(key)\n}\n\n/**\n * A view's filters as the list request sends them.\n *\n * @param {{filters: object, search: string}} state The view's state.\n * @return {object}\n */\nfunction filterParams(state) {\n\tconst out = {}\n\tfor (const [key, raw] of Object.entries(state.filters || {})) {\n\t\tObject.assign(out, facetFilterParams(key, Array.isArray(raw) ? raw : [raw]))\n\t}\n\tif (state.search) {\n\t\tout._search = state.search\n\t}\n\treturn out\n}\n\n/**\n * CnSavedViewMenuSettings - the user's \"My views\" menu entries as a settings\n * section body (board DqPersoonlijkeInstellingen, \"Views in my menu\"): the\n * entries in their menu order, reordered by dragging or the arrow keys,\n * taken out of the menu with \"Remove from menu\", and a picker that adds any\n * view the user can see on a page of the app (their own, shared ones and the\n * pages' default views). Removing an entry never deletes the view.\n *\n * Each row says what its view shows and how many records that is: \"Case\n * type Woo request, status open · 19 cases\". The line is built from the\n * view's filters with the page schema's titles and the names of the records\n * and options they point at; the count is one request per view, cached for\n * the session, and fills in when it arrives without holding up the list.\n *\n * Reads and writes the list CnAppRoot holds (`cnSavedViewMenu`, stored in\n * the `cn_saved_view_menu` preference). CnAppRoot draws it as the `views`\n * section of its user settings dialog; an app with a dialog of its own can\n * mount it inside an NcAppSettingsSection.\n *\n * @spec openspec/changes/saved-view-menu-settings/specs/saved-view-menu-settings/spec.md#requirement-a-user-orders-and-picks-the-views-in-their-menu\n */\nexport default {\n\tname: 'CnSavedViewMenuSettings',\n\tcomponents: { CnOrderedListField },\n\tinject: {\n\t\tcnSavedViewMenu: { default: null },\n\t\tcnManifest: { default: null },\n\t\tcnTranslate: { default: () => (key) => key },\n\t\tcnAppId: { default: '' },\n\t\tcnAppConfig: { default: null },\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\tviews: [],\n\t\t\tloading: false,\n\t\t\t/** The schema per page id. */\n\t\t\tschemas: {},\n\t\t\t/** Looked-up display names per page id, filter key and value. */\n\t\t\tvalueLabels: {},\n\t\t\t/** The count per list value; undefined while it is asked. */\n\t\t\tcounts: {},\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** @return {object|null} The menu holder, when it can be changed. */\n\t\tmenu() {\n\t\t\tconst menu = this.cnSavedViewMenu\n\t\t\treturn menu && typeof menu.set === 'function' ? menu : null\n\t\t},\n\n\t\t/** @return {Array<object>} The stored entries. */\n\t\tentries() {\n\t\t\treturn normalizeSavedViewMenu(this.cnSavedViewMenu ? this.cnSavedViewMenu.entries : [])\n\t\t},\n\n\t\t/** @return {Array<object>} The pages that offer saved views. */\n\t\tpages() {\n\t\t\tconst pages = this.cnManifest && Array.isArray(this.cnManifest.pages) ? this.cnManifest.pages : []\n\t\t\treturn pages\n\t\t\t\t.filter((page) => page && page.type === 'index' && typeof page.id === 'string' && pageOffersSavedViews(page.config))\n\t\t\t\t.map((page) => {\n\t\t\t\t\tconst config = page.config || {}\n\t\t\t\t\treturn {\n\t\t\t\t\t\tid: page.id,\n\t\t\t\t\t\ttitle: typeof page.title === 'string' ? this.cnTranslate(page.title) : page.id,\n\t\t\t\t\t\tscope: { scope: config.savedViewsScope, register: config.register, schema: config.schema, source: config.entitySource },\n\t\t\t\t\t\tdefaults: Array.isArray(config.defaultSavedViews) ? config.defaultSavedViews : [],\n\t\t\t\t\t\tregister: typeof config.register === 'string' ? config.register : '',\n\t\t\t\t\t\tschema: typeof config.schema === 'string' ? config.schema : '',\n\t\t\t\t\t\tbaseFilter: resolveFilterMap(config.filter, {}, { config: this.cnAppConfig || {} }),\n\t\t\t\t\t\tcountSubtitle: config.countSubtitle || null,\n\t\t\t\t\t\tfilterLabels: (config.filterLabels && typeof config.filterLabels === 'object') ? config.filterLabels : {},\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t},\n\n\t\t/** @return {Array<object>} Every view the user can put in the menu, with its page and state. */\n\t\tcandidates() {\n\t\t\tconst out = []\n\t\t\tfor (const page of this.pages) {\n\t\t\t\tconst defaults = page.defaults.map((entry) => (entry && typeof entry.name === 'string' ? { ...entry, name: this.cnTranslate(entry.name) } : entry))\n\t\t\t\tconst views = [...defaultFilterViews(defaults, page.scope), ...this.views.filter((view) => viewMatchesScope(view, page.scope))]\n\t\t\t\tfor (const view of views) {\n\t\t\t\t\tconst id = String(view.id ?? view.slug ?? '')\n\t\t\t\t\tif (id === '' || typeof view.name !== 'string' || view.name === '') {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tout.push({ value: keyOf(page.id, id), id, page: page.id, label: view.name, state: extractViewState(view) })\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn out\n\t\t},\n\n\t\t/** @return {Array<string>} The entries as list values, in menu order. */\n\t\tvalues() {\n\t\t\treturn this.entries.map((entry) => keyOf(entry.page, entry.id))\n\t\t},\n\n\t\t/**\n\t\t * The choices: the candidates, and the entries no candidate covers. A\n\t\t * choice's second line says what the view shows; a row in the menu\n\t\t * adds how many records that is, once the count is in.\n\t\t *\n\t\t * @return {Array<{value: string, label: string, description: string}>}\n\t\t */\n\t\toptions() {\n\t\t\tconst byId = new Map(this.pages.map((page) => [page.id, page]))\n\t\t\tconst inMenu = new Set(this.values)\n\t\t\tconst known = new Set(this.candidates.map((c) => c.value))\n\t\t\tconst candidates = this.candidates.map((c) => {\n\t\t\t\tconst summary = this.summaryOf(byId.get(c.page), c.state)\n\t\t\t\tconst count = inMenu.has(c.value) ? this.countText(byId.get(c.page), this.counts[c.value]) : ''\n\t\t\t\treturn { value: c.value, label: c.label, description: count ? `${summary} · ${count}` : summary }\n\t\t\t})\n\t\t\tconst stored = this.entries\n\t\t\t\t.filter((entry) => !known.has(keyOf(entry.page, entry.id)))\n\t\t\t\t.map((entry) => ({ value: keyOf(entry.page, entry.id), label: entry.name, description: byId.has(entry.page) ? byId.get(entry.page).title : '' }))\n\t\t\treturn [...candidates, ...stored]\n\t\t},\n\t},\n\n\twatch: {\n\t\t/** Look up the names a summary needs once the views are in. */\n\t\tcandidates() {\n\t\t\tthis.loadValueLabels()\n\t\t\tthis.loadCounts()\n\t\t},\n\n\t\t/** Count a view as soon as it is in the menu. */\n\t\tvalues() {\n\t\t\tthis.loadCounts()\n\t\t},\n\t},\n\n\tmounted() {\n\t\tthis.fetchViews()\n\t\tthis.loadSchemas()\n\t\tthis.loadCounts()\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/** Read the saved views the user can see; without them the defaults stay. */\n\t\tasync fetchViews() {\n\t\t\tthis.loading = true\n\t\t\ttry {\n\t\t\t\tconst views = await useSavedViewsApi().fetchViews()\n\t\t\t\tthis.views = Array.isArray(views) ? views : []\n\t\t\t} catch {\n\t\t\t\tthis.views = []\n\t\t\t} finally {\n\t\t\t\tthis.loading = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * A view's filters as one line, else the page's title.\n\t\t *\n\t\t * @param {object} page The page.\n\t\t * @param {{filters: object, search: string}} state The view's state.\n\t\t * @return {string}\n\t\t */\n\t\tsummaryOf(page, state) {\n\t\t\tconst schema = this.schemas[page.id]\n\t\t\tconst summary = summarizeViewFilters(state, {\n\t\t\t\tproperties: (schema && schema.properties) || {},\n\t\t\t\tvalueLabels: this.valueLabels[page.id] || {},\n\t\t\t\tfilterLabels: page.filterLabels,\n\t\t\t\ttranslate: this.cnTranslate,\n\t\t\t})\n\t\t\treturn summary || page.title\n\t\t},\n\n\t\t/**\n\t\t * \"19 cases\": the page's `countSubtitle` for the total, else \"19 results\".\n\t\t *\n\t\t * @param {object} page The page.\n\t\t * @param {number|undefined} total The count, when it is in.\n\t\t * @return {string} The text, or '' while the count is unknown.\n\t\t */\n\t\tcountText(page, total) {\n\t\t\tif (typeof total !== 'number') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst line = page.countSubtitle ? countLine(page.countSubtitle, total, { translate: this.cnTranslate, appId: this.cnAppId }) : ''\n\t\t\treturn line || n('nextcloud-vue', '%n result', '%n results', total)\n\t\t},\n\n\t\t/** Read the schema of every page that offers saved views, for field titles and value names. */\n\t\tasync loadSchemas() {\n\t\t\tawait Promise.all(this.pages.filter((page) => page.register && page.schema).map(async (page) => {\n\t\t\t\tconst schema = await loadSchema(page.register, page.schema)\n\t\t\t\tif (schema) {\n\t\t\t\t\tthis.schemas = { ...this.schemas, [page.id]: schema }\n\t\t\t\t}\n\t\t\t}))\n\t\t\tthis.loadValueLabels()\n\t\t},\n\n\t\t/** Look up the names of the referenced records the views filter on. */\n\t\tasync loadValueLabels() {\n\t\t\tfor (const page of this.pages) {\n\t\t\t\tconst schema = this.schemas[page.id]\n\t\t\t\tif (!schema) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tconst fields = fieldsFromSchema(schema, { includeReadOnly: true })\n\t\t\t\tconst refs = this.candidates\n\t\t\t\t\t.filter((c) => c.page === page.id)\n\t\t\t\t\t.flatMap((c) => viewFilterReferences(c.state, fields, page.filterLabels))\n\t\t\t\tfor (const ref of refs) {\n\t\t\t\t\tconst labels = await loadLabels({ ...ref, register: ref.register || page.register })\n\t\t\t\t\tif (Object.keys(labels).length === 0) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tconst forPage = this.valueLabels[page.id] || {}\n\t\t\t\t\tthis.valueLabels = { ...this.valueLabels, [page.id]: { ...forPage, [ref.key]: { ...(forPage[ref.key] || {}), ...labels } } }\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\t/** Count every view in the menu; each count fills in on its own. */\n\t\tloadCounts() {\n\t\t\tfor (const value of this.values) {\n\t\t\t\tif (Object.hasOwn(this.counts, value)) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tconst candidate = this.candidates.find((c) => c.value === value)\n\t\t\t\tconst page = candidate && this.pages.find((p) => p.id === candidate.page)\n\t\t\t\tif (!page || !page.register || !page.schema) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tthis.counts = { ...this.counts, [value]: undefined }\n\t\t\t\tloadCount(page, filterParams(candidate.state)).then((total) => {\n\t\t\t\t\tif (typeof total === 'number') {\n\t\t\t\t\t\tthis.counts = { ...this.counts, [value]: total }\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Store the list in its new order, with entries removed or added.\n\t\t *\n\t\t * @param {Array<string>} values The list values in order.\n\t\t */\n\t\tonChange(values) {\n\t\t\tif (!this.menu) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst byKey = new Map(this.entries.map((entry) => [keyOf(entry.page, entry.id), entry]))\n\t\t\tconst candidates = new Map(this.candidates.map((c) => [c.value, c]))\n\t\t\tconst next = values\n\t\t\t\t.map((value) => {\n\t\t\t\t\tif (byKey.has(value)) {\n\t\t\t\t\t\treturn byKey.get(value)\n\t\t\t\t\t}\n\t\t\t\t\tconst candidate = candidates.get(value)\n\t\t\t\t\treturn candidate ? { id: candidate.id, page: candidate.page, name: candidate.label } : null\n\t\t\t\t})\n\t\t\t\t.filter(Boolean)\n\t\t\tthis.menu.set(next)\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n/* The description sits 16px above the list, as a board section's does\n (DqPersoonlijkeInstellingen \"Weergaven in mijn menu\"). */\n.cn-saved-view-menu-settings__intro {\n\tmargin: 0 0 16px;\n\tcolor: var(--color-text-maxcontrast);\n}\n</style>\n"],"names":["CnOrderedListField","t","n"],"mappings":";;;;;;;;;;;;;;AAyCA;AACA;AACA,MAAM,cAAc,IAAI,GAAG,GAAC;AAC5B,MAAM,aAAa,IAAI,GAAG,GAAC;AAC3B,MAAM,aAAa,IAAI,GAAG,GAAC;;AAE3B;;AAEC;AACA;;AAEA;;AAED,SAAS,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE;AACxB,CAAA,OAAO,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;AACtB,CAAA;;AAEA;AACC;AACA;AACA;AACA;;;AAGD,eAAe,OAAO,CAAC,IAAI,EAAE,MAAK,GAAI,EAAE,EAAE;AACzC,CAAA,MAAM,QAAO,GAAI,MAAM,KAAK,CAAC,SAAS,CAAC,IAAG,GAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,YAAY,IAAI,EAAA;AACpG,CAAA,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE;EACjB,MAAM,IAAI,KAAK,CAAC,CAAC,EAAE,IAAI,CAAA,UAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAA;AACtD,EAAA;AACA,CAAA,OAAO,QAAQ,CAAC,IAAI,EAAC;AACtB,CAAA;;AAEA;;AAEC;AACA;AACA;;;AAGD,SAAS,UAAU,CAAC,QAAQ,EAAE,MAA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AAA;AACA,KAAA,MAAM,SAAQ,GAAI,UAAU,CAAC,GAAG,CAAC,KAAK,EAAA;AACtC,KAAA,OAAO,SAAU,GAAE,EAAE,EAAE,EAAE,SAAS,CAAC,EAAE,EAAE,IAAI,EAAE,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,CAAC,KAAM,EAAA,GAAI,IAAG;KAC1F,CAAA;AACD,KAAC,MAAM,CAAC,OAAO,EAAA;AAChB,GAAA,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAA;GAClB;EACD;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CnSavedViewMenuSettings.vue3.js","sources":["../../../../src/components/CnSavedViewMenuSettings/CnSavedViewMenuSettings.vue?vue&type=template&id=962f985c&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<div class=\"cn-saved-view-menu-settings\" data-testid=\"cn-saved-view-menu-settings\">\n\t\t<p class=\"cn-saved-view-menu-settings__intro\">\n\t\t\t{{ t('nextcloud-vue', 'These saved views are at the bottom of your menu under My views, in this order. Drag a row or use the arrow keys. You put a view in the menu with Add to menu in the side panel of a list.') }}\n\t\t</p>\n\t\t<CnOrderedListField\n\t\t\t:modelValue=\"values\"\n\t\t\t:options=\"options\"\n\t\t\t:label=\"t('nextcloud-vue', 'Views in my menu')\"\n\t\t\t:hideLabel=\"true\"\n\t\t\t:addLabel=\"t('nextcloud-vue', 'Add view')\"\n\t\t\t:addPlaceholder=\"t('nextcloud-vue', 'Pick a saved view')\"\n\t\t\t:addHint=\"t('nextcloud-vue', 'You see your own views, the views shared with you and the default views. A new view goes to the bottom.')\"\n\t\t\t:removeLabel=\"t('nextcloud-vue', 'Remove from menu')\"\n\t\t\t:emptyText=\"t('nextcloud-vue', 'Your menu has no views yet.')\"\n\t\t\t:loading=\"loading\"\n\t\t\t:disabled=\"!menu\"\n\t\t\t@update:modelValue=\"onChange\" />\n\t</div>\n</template>\n\n<script>\nimport { translatePlural as n, translate as t } from '@nextcloud/l10n'\nimport CnOrderedListField from '../CnOrderedListField/CnOrderedListField.vue'\nimport { useSavedViewsApi } from '../../composables/useSavedViewsApi.js'\nimport { countLine } from '../../utils/countLine.js'\nimport { facetFilterParams } from '../../utils/facets.js'\nimport { fetchFilterCounts } from '../../utils/fetchFilterCounts.js'\nimport { pickRefLabel } from '../../utils/headerFieldChips.js'\nimport { buildHeaders, buildQueryString, prefixUrl } from '../../utils/headers.js'\nimport { resolveFilterMap } from '../../utils/routeFilters.js'\nimport { defaultFilterViews, extractViewState, pageOffersSavedViews, viewMatchesScope } from '../../utils/savedViewHelpers.js'\nimport { normalizeSavedViewMenu } from '../../utils/savedViewMenu.js'\nimport { summarizeViewFilters, viewFilterReferences } from '../../utils/savedViewSummary.js'\nimport { fieldsFromSchema } from '../../utils/schema.js'\n\n// Per session: a schema, a referenced record's name and a view's count are\n// asked once, however often the dialog opens.\nconst schemaCache = new Map()\nconst labelCache = new Map()\nconst countCache = new Map()\n\n/**\n * The key a menu entry or a candidate view is listed under.\n *\n * @param {string} page The page's route name.\n * @param {string} id The view id.\n * @return {string}\n */\nfunction keyOf(page, id) {\n\treturn `${page}|${id}`\n}\n\n/**\n * GET a JSON document from OpenRegister.\n *\n * @param {string} path The app-absolute path.\n * @param {object} [params] Query parameters.\n * @return {Promise<object>}\n */\nasync function getJson(path, params = {}) {\n\tconst response = await fetch(prefixUrl(path + buildQueryString(params)), { headers: buildHeaders() })\n\tif (!response.ok) {\n\t\tthrow new Error(`${path} returned ${response.status}`)\n\t}\n\treturn response.json()\n}\n\n/**\n * A page's schema, asked once.\n *\n * @param {string} register The register slug.\n * @param {string} schema The schema slug.\n * @return {Promise<object|null>}\n */\nfunction loadSchema(register, schema) {\n\tconst key = `${register}|${schema}`\n\tif (!schemaCache.has(key)) {\n\t\t// A failed read is forgotten, so the next opening asks again instead\n\t\t// of naming every filter by its raw key for the rest of the session.\n\t\tschemaCache.set(key, getJson(`/apps/openregister/api/schemas/${encodeURIComponent(schema)}`, { register }).catch(() => {\n\t\t\tschemaCache.delete(key)\n\t\t\treturn null\n\t\t}))\n\t}\n\treturn schemaCache.get(key)\n}\n\n/**\n * The names of referenced records, each asked once.\n *\n * @param {{register: string, schema: string, labelField: string, matchField?: string, ids: Array<string>}} ref The reference filter; with `matchField` the ids are that field's values.\n * @return {Promise<{[id: string]: string}>}\n */\nasync function loadLabels(ref) {\n\tconst prefix = `${ref.register}|${ref.schema}|${ref.labelField}|${ref.matchField || ''}|`\n\tconst missing = ref.ids.filter((id) => !labelCache.has(prefix + id))\n\t// A value that identifies a record by another field: one read per value.\n\tif (missing.length > 0 && ref.matchField) {\n\t\tfor (const value of missing) {\n\t\t\tlabelCache.set(prefix + value, getJson(`/apps/openregister/api/objects/${encodeURIComponent(ref.register)}/${encodeURIComponent(ref.schema)}`, { [ref.matchField]: value, _limit: 1 })\n\t\t\t\t.then((data) => {\n\t\t\t\t\tconst row = Array.isArray(data && data.results) ? data.results[0] : null\n\t\t\t\t\treturn row ? pickRefLabel(row, ref.labelField) : null\n\t\t\t\t})\n\t\t\t\t.catch(() => null))\n\t\t}\n\t} else if (missing.length > 0) {\n\t\tconst request = getJson(`/apps/openregister/api/objects/${encodeURIComponent(ref.register)}/${encodeURIComponent(ref.schema)}`, { _ids: missing.join(','), _limit: missing.length })\n\t\t\t.then((data) => {\n\t\t\t\tconst byId = {}\n\t\t\t\tfor (const row of (Array.isArray(data && data.results) ? data.results : [])) {\n\t\t\t\t\tconst id = row && (row.id ?? row.uuid ?? (row['@self'] && row['@self'].id))\n\t\t\t\t\tif (id !== undefined && id !== null) {\n\t\t\t\t\t\tbyId[String(id)] = pickRefLabel(row, ref.labelField)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn byId\n\t\t\t})\n\t\t\t.catch(() => ({}))\n\t\tfor (const id of missing) {\n\t\t\tlabelCache.set(prefix + id, request.then((byId) => byId[id] || null))\n\t\t}\n\t}\n\tconst out = {}\n\tawait Promise.all(ref.ids.map(async (id) => {\n\t\tconst label = await labelCache.get(prefix + id)\n\t\tif (label) {\n\t\t\tout[id] = label\n\t\t}\n\t}))\n\treturn out\n}\n\n/**\n * How many records a view's filters match on its page, asked once per view.\n *\n * @param {{register: string, schema: string, baseFilter: object}} page The page.\n * @param {object} filter The view's filters as query parameters.\n * @return {Promise<number|null>}\n */\nfunction loadCount(page, filter) {\n\tconst key = JSON.stringify([page.register, page.schema, page.baseFilter, filter])\n\tif (!countCache.has(key)) {\n\t\tcountCache.set(key, fetchFilterCounts({ register: page.register, schema: page.schema, entries: [{ key: 'view', filter }], baseFilter: page.baseFilter })\n\t\t\t.then((counts) => (typeof counts.view === 'number' ? counts.view : null))\n\t\t\t.catch(() => null))\n\t}\n\treturn countCache.get(key)\n}\n\n/**\n * A view's filters as the list request sends them.\n *\n * @param {{filters: object, search: string}} state The view's state.\n * @return {object}\n */\nfunction filterParams(state) {\n\tconst out = {}\n\tfor (const [key, raw] of Object.entries(state.filters || {})) {\n\t\tObject.assign(out, facetFilterParams(key, Array.isArray(raw) ? raw : [raw]))\n\t}\n\tif (state.search) {\n\t\tout._search = state.search\n\t}\n\treturn out\n}\n\n/**\n * CnSavedViewMenuSettings - the user's \"My views\" menu entries as a settings\n * section body (board DqPersoonlijkeInstellingen, \"Views in my menu\"): the\n * entries in their menu order, reordered by dragging or the arrow keys,\n * taken out of the menu with \"Remove from menu\", and a picker that adds any\n * view the user can see on a page of the app (their own, shared ones and the\n * pages' default views). Removing an entry never deletes the view.\n *\n * Each row says what its view shows and how many records that is: \"Case\n * type Woo request, status open · 19 cases\". The line is built from the\n * view's filters with the page schema's titles and the names of the records\n * and options they point at; the count is one request per view, cached for\n * the session, and fills in when it arrives without holding up the list.\n *\n * Reads and writes the list CnAppRoot holds (`cnSavedViewMenu`, stored in\n * the `cn_saved_view_menu` preference). CnAppRoot draws it as the `views`\n * section of its user settings dialog; an app with a dialog of its own can\n * mount it inside an NcAppSettingsSection.\n *\n * @spec openspec/changes/saved-view-menu-settings/specs/saved-view-menu-settings/spec.md#requirement-a-user-orders-and-picks-the-views-in-their-menu\n */\nexport default {\n\tname: 'CnSavedViewMenuSettings',\n\tcomponents: { CnOrderedListField },\n\tinject: {\n\t\tcnSavedViewMenu: { default: null },\n\t\tcnManifest: { default: null },\n\t\tcnTranslate: { default: () => (key) => key },\n\t\tcnAppId: { default: '' },\n\t\tcnAppConfig: { default: null },\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\tviews: [],\n\t\t\tloading: false,\n\t\t\t/** The schema per page id. */\n\t\t\tschemas: {},\n\t\t\t/** Looked-up display names per page id, filter key and value. */\n\t\t\tvalueLabels: {},\n\t\t\t/** The count per list value; undefined while it is asked. */\n\t\t\tcounts: {},\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** @return {object|null} The menu holder, when it can be changed. */\n\t\tmenu() {\n\t\t\tconst menu = this.cnSavedViewMenu\n\t\t\treturn menu && typeof menu.set === 'function' ? menu : null\n\t\t},\n\n\t\t/** @return {Array<object>} The stored entries. */\n\t\tentries() {\n\t\t\treturn normalizeSavedViewMenu(this.cnSavedViewMenu ? this.cnSavedViewMenu.entries : [])\n\t\t},\n\n\t\t/** @return {Array<object>} The pages that offer saved views. */\n\t\tpages() {\n\t\t\tconst pages = this.cnManifest && Array.isArray(this.cnManifest.pages) ? this.cnManifest.pages : []\n\t\t\treturn pages\n\t\t\t\t.filter((page) => page && page.type === 'index' && typeof page.id === 'string' && pageOffersSavedViews(page.config))\n\t\t\t\t.map((page) => {\n\t\t\t\t\tconst config = page.config || {}\n\t\t\t\t\treturn {\n\t\t\t\t\t\tid: page.id,\n\t\t\t\t\t\ttitle: typeof page.title === 'string' ? this.cnTranslate(page.title) : page.id,\n\t\t\t\t\t\tscope: { scope: config.savedViewsScope, register: config.register, schema: config.schema, source: config.entitySource },\n\t\t\t\t\t\tdefaults: Array.isArray(config.defaultSavedViews) ? config.defaultSavedViews : [],\n\t\t\t\t\t\tregister: typeof config.register === 'string' ? config.register : '',\n\t\t\t\t\t\tschema: typeof config.schema === 'string' ? config.schema : '',\n\t\t\t\t\t\tbaseFilter: resolveFilterMap(config.filter, {}, { config: this.cnAppConfig || {} }),\n\t\t\t\t\t\tcountSubtitle: config.countSubtitle || null,\n\t\t\t\t\t\tfilterLabels: (config.filterLabels && typeof config.filterLabels === 'object') ? config.filterLabels : {},\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t},\n\n\t\t/** @return {Array<object>} Every view the user can put in the menu, with its page and state. */\n\t\tcandidates() {\n\t\t\tconst out = []\n\t\t\tfor (const page of this.pages) {\n\t\t\t\tconst defaults = page.defaults.map((entry) => (entry && typeof entry.name === 'string' ? { ...entry, name: this.cnTranslate(entry.name) } : entry))\n\t\t\t\tconst views = [...defaultFilterViews(defaults, page.scope), ...this.views.filter((view) => viewMatchesScope(view, page.scope))]\n\t\t\t\tfor (const view of views) {\n\t\t\t\t\tconst id = String(view.id ?? view.slug ?? '')\n\t\t\t\t\tif (id === '' || typeof view.name !== 'string' || view.name === '') {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tout.push({ value: keyOf(page.id, id), id, page: page.id, label: view.name, state: extractViewState(view) })\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn out\n\t\t},\n\n\t\t/** @return {Array<string>} The entries as list values, in menu order. */\n\t\tvalues() {\n\t\t\treturn this.entries.map((entry) => keyOf(entry.page, entry.id))\n\t\t},\n\n\t\t/**\n\t\t * The choices: the candidates, and the entries no candidate covers. A\n\t\t * choice's second line says what the view shows; a row in the menu\n\t\t * adds how many records that is, once the count is in.\n\t\t *\n\t\t * @return {Array<{value: string, label: string, description: string}>}\n\t\t */\n\t\toptions() {\n\t\t\tconst byId = new Map(this.pages.map((page) => [page.id, page]))\n\t\t\tconst inMenu = new Set(this.values)\n\t\t\tconst known = new Set(this.candidates.map((c) => c.value))\n\t\t\tconst candidates = this.candidates.map((c) => {\n\t\t\t\tconst summary = this.summaryOf(byId.get(c.page), c.state)\n\t\t\t\tconst count = inMenu.has(c.value) ? this.countText(byId.get(c.page), this.counts[c.value]) : ''\n\t\t\t\treturn { value: c.value, label: c.label, description: count ? `${summary} · ${count}` : summary }\n\t\t\t})\n\t\t\tconst stored = this.entries\n\t\t\t\t.filter((entry) => !known.has(keyOf(entry.page, entry.id)))\n\t\t\t\t.map((entry) => ({ value: keyOf(entry.page, entry.id), label: entry.name, description: byId.has(entry.page) ? byId.get(entry.page).title : '' }))\n\t\t\treturn [...candidates, ...stored]\n\t\t},\n\t},\n\n\twatch: {\n\t\t/** Look up the names a summary needs once the views are in. */\n\t\tcandidates() {\n\t\t\tthis.loadValueLabels()\n\t\t\tthis.loadCounts()\n\t\t},\n\n\t\t/** Count a view as soon as it is in the menu. */\n\t\tvalues() {\n\t\t\tthis.loadCounts()\n\t\t},\n\t},\n\n\tmounted() {\n\t\tthis.fetchViews()\n\t\tthis.loadSchemas()\n\t\tthis.loadCounts()\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/** Read the saved views the user can see; without them the defaults stay. */\n\t\tasync fetchViews() {\n\t\t\tthis.loading = true\n\t\t\ttry {\n\t\t\t\tconst views = await useSavedViewsApi().fetchViews()\n\t\t\t\tthis.views = Array.isArray(views) ? views : []\n\t\t\t} catch {\n\t\t\t\tthis.views = []\n\t\t\t} finally {\n\t\t\t\tthis.loading = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * A view's filters as one line, else the page's title.\n\t\t *\n\t\t * @param {object} page The page.\n\t\t * @param {{filters: object, search: string}} state The view's state.\n\t\t * @return {string}\n\t\t */\n\t\tsummaryOf(page, state) {\n\t\t\tconst schema = this.schemas[page.id]\n\t\t\tconst summary = summarizeViewFilters(state, {\n\t\t\t\tproperties: (schema && schema.properties) || {},\n\t\t\t\tvalueLabels: this.valueLabels[page.id] || {},\n\t\t\t\tfilterLabels: page.filterLabels,\n\t\t\t\ttranslate: this.cnTranslate,\n\t\t\t})\n\t\t\treturn summary || page.title\n\t\t},\n\n\t\t/**\n\t\t * \"19 cases\": the page's `countSubtitle` for the total, else \"19 results\".\n\t\t *\n\t\t * @param {object} page The page.\n\t\t * @param {number|undefined} total The count, when it is in.\n\t\t * @return {string} The text, or '' while the count is unknown.\n\t\t */\n\t\tcountText(page, total) {\n\t\t\tif (typeof total !== 'number') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst line = page.countSubtitle ? countLine(page.countSubtitle, total, { translate: this.cnTranslate, appId: this.cnAppId }) : ''\n\t\t\treturn line || n('nextcloud-vue', '%n result', '%n results', total)\n\t\t},\n\n\t\t/** Read the schema of every page that offers saved views, for field titles and value names. */\n\t\tasync loadSchemas() {\n\t\t\tawait Promise.all(this.pages.filter((page) => page.register && page.schema).map(async (page) => {\n\t\t\t\tconst schema = await loadSchema(page.register, page.schema)\n\t\t\t\tif (schema) {\n\t\t\t\t\tthis.schemas = { ...this.schemas, [page.id]: schema }\n\t\t\t\t}\n\t\t\t}))\n\t\t\tthis.loadValueLabels()\n\t\t},\n\n\t\t/** Look up the names of the referenced records the views filter on. */\n\t\tasync loadValueLabels() {\n\t\t\tfor (const page of this.pages) {\n\t\t\t\tconst schema = this.schemas[page.id]\n\t\t\t\tif (!schema) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tconst fields = fieldsFromSchema(schema, { includeReadOnly: true })\n\t\t\t\tconst refs = this.candidates\n\t\t\t\t\t.filter((c) => c.page === page.id)\n\t\t\t\t\t.flatMap((c) => viewFilterReferences(c.state, fields, page.filterLabels))\n\t\t\t\tfor (const ref of refs) {\n\t\t\t\t\tconst labels = await loadLabels({ ...ref, register: ref.register || page.register })\n\t\t\t\t\tif (Object.keys(labels).length === 0) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tconst forPage = this.valueLabels[page.id] || {}\n\t\t\t\t\tthis.valueLabels = { ...this.valueLabels, [page.id]: { ...forPage, [ref.key]: { ...(forPage[ref.key] || {}), ...labels } } }\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\t/** Count every view in the menu; each count fills in on its own. */\n\t\tloadCounts() {\n\t\t\tfor (const value of this.values) {\n\t\t\t\tif (Object.hasOwn(this.counts, value)) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tconst candidate = this.candidates.find((c) => c.value === value)\n\t\t\t\tconst page = candidate && this.pages.find((p) => p.id === candidate.page)\n\t\t\t\tif (!page || !page.register || !page.schema) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tthis.counts = { ...this.counts, [value]: undefined }\n\t\t\t\tloadCount(page, filterParams(candidate.state)).then((total) => {\n\t\t\t\t\tif (typeof total === 'number') {\n\t\t\t\t\t\tthis.counts = { ...this.counts, [value]: total }\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Store the list in its new order, with entries removed or added.\n\t\t *\n\t\t * @param {Array<string>} values The list values in order.\n\t\t */\n\t\tonChange(values) {\n\t\t\tif (!this.menu) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst byKey = new Map(this.entries.map((entry) => [keyOf(entry.page, entry.id), entry]))\n\t\t\tconst candidates = new Map(this.candidates.map((c) => [c.value, c]))\n\t\t\tconst next = values\n\t\t\t\t.map((value) => {\n\t\t\t\t\tif (byKey.has(value)) {\n\t\t\t\t\t\treturn byKey.get(value)\n\t\t\t\t\t}\n\t\t\t\t\tconst candidate = candidates.get(value)\n\t\t\t\t\treturn candidate ? { id: candidate.id, page: candidate.page, name: candidate.label } : null\n\t\t\t\t})\n\t\t\t\t.filter(Boolean)\n\t\t\tthis.menu.set(next)\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-saved-view-menu-settings__intro {\n\tmargin: 0 0 12px;\n\tcolor: var(--color-text-maxcontrast);\n}\n</style>\n"],"names":["_openBlock","_createElementBlock","_createElementVNode","_toDisplayString","_createVNode"],"mappings":";;;AAWM,EAAA,KAAK,EAAC,6BAAU;AAAA,EAAA,aAAA,EAAA,6BAAA;;AACjB,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,oCAAS,GAAA;;;;;AADjB,EAAA,QAAAA,SAAA,EAAA,EAAAC,kBAAA,QAAA;IACAC,kBAEG,CAAA,GAAA,EAFH,UAEG,EAAAC,eAAA,CADA,QAAC,CAAA,CAAA,CAAA,eAAA,EAAA,4LAAA,CAAA,CAAA,EAAA,CAAA,YAAA;IAEJC;AACC,MAAA,UAAU,EAAE,QAAM,CAAA,MAAA;AAClB,MAAA,OAAO,EAAE,QAAO,CAAA,OAAA;AAChB,MAAA,KAAK,EAAE,QAAC,CAAA,CAAA,CAAA,eAAA,EAAA,kBAAA,CAAA;AACR,MAAA,SAAS,EAAE,IAAI;AACf,MAAA,QAAQ,EAAE,QAAC,CAAA,CAAA,CAAA,eAAA,EAAA,UAAA,CAAA;AACX,MAAA,cAAc,EAAC,QAAA,CAAA,CAAA,CAAA,eAAA,EAAA,mBAAA,CAAA;AACf,MAAA,OAAO,EAAE,QAAC,CAAA,CAAA,CAAA,eAAA,EAAA,yGAAA,CAAA;AACV,MAAA,WAAE,EAAA,QAAA,CAAA,CAAA,CAAA,eAAA,EAAA,kBAAA,CAAA;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"CnSavedViewMenuSettings.vue3.js","sources":["../../../../src/components/CnSavedViewMenuSettings/CnSavedViewMenuSettings.vue?vue&type=template&id=527dbad5&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<div class=\"cn-saved-view-menu-settings\" data-testid=\"cn-saved-view-menu-settings\">\n\t\t<p class=\"cn-saved-view-menu-settings__intro\">\n\t\t\t{{ t('nextcloud-vue', 'These saved views are at the bottom of your menu under My views, in this order. Drag a row or use the arrow keys. You put a view in the menu with Add to menu in the side panel of a list.') }}\n\t\t</p>\n\t\t<CnOrderedListField\n\t\t\t:modelValue=\"values\"\n\t\t\t:options=\"options\"\n\t\t\t:label=\"t('nextcloud-vue', 'Views in my menu')\"\n\t\t\t:hideLabel=\"true\"\n\t\t\t:addLabel=\"t('nextcloud-vue', 'Add view')\"\n\t\t\t:addPlaceholder=\"t('nextcloud-vue', 'Pick a saved view')\"\n\t\t\t:addHint=\"t('nextcloud-vue', 'You see your own views, the views shared with you and the default views. A new view goes to the bottom.')\"\n\t\t\t:removeLabel=\"t('nextcloud-vue', 'Remove from menu')\"\n\t\t\t:emptyText=\"t('nextcloud-vue', 'Your menu has no views yet.')\"\n\t\t\t:loading=\"loading\"\n\t\t\t:disabled=\"!menu\"\n\t\t\t@update:modelValue=\"onChange\" />\n\t</div>\n</template>\n\n<script>\nimport { translatePlural as n, translate as t } from '@nextcloud/l10n'\nimport CnOrderedListField from '../CnOrderedListField/CnOrderedListField.vue'\nimport { useSavedViewsApi } from '../../composables/useSavedViewsApi.js'\nimport { countLine } from '../../utils/countLine.js'\nimport { facetFilterParams } from '../../utils/facets.js'\nimport { fetchFilterCounts } from '../../utils/fetchFilterCounts.js'\nimport { pickRefLabel } from '../../utils/headerFieldChips.js'\nimport { buildHeaders, buildQueryString, prefixUrl } from '../../utils/headers.js'\nimport { resolveFilterMap } from '../../utils/routeFilters.js'\nimport { defaultFilterViews, extractViewState, pageOffersSavedViews, viewMatchesScope } from '../../utils/savedViewHelpers.js'\nimport { normalizeSavedViewMenu } from '../../utils/savedViewMenu.js'\nimport { summarizeViewFilters, viewFilterReferences } from '../../utils/savedViewSummary.js'\nimport { fieldsFromSchema } from '../../utils/schema.js'\n\n// Per session: a schema, a referenced record's name and a view's count are\n// asked once, however often the dialog opens.\nconst schemaCache = new Map()\nconst labelCache = new Map()\nconst countCache = new Map()\n\n/**\n * The key a menu entry or a candidate view is listed under.\n *\n * @param {string} page The page's route name.\n * @param {string} id The view id.\n * @return {string}\n */\nfunction keyOf(page, id) {\n\treturn `${page}|${id}`\n}\n\n/**\n * GET a JSON document from OpenRegister.\n *\n * @param {string} path The app-absolute path.\n * @param {object} [params] Query parameters.\n * @return {Promise<object>}\n */\nasync function getJson(path, params = {}) {\n\tconst response = await fetch(prefixUrl(path + buildQueryString(params)), { headers: buildHeaders() })\n\tif (!response.ok) {\n\t\tthrow new Error(`${path} returned ${response.status}`)\n\t}\n\treturn response.json()\n}\n\n/**\n * A page's schema, asked once.\n *\n * @param {string} register The register slug.\n * @param {string} schema The schema slug.\n * @return {Promise<object|null>}\n */\nfunction loadSchema(register, schema) {\n\tconst key = `${register}|${schema}`\n\tif (!schemaCache.has(key)) {\n\t\t// A failed read is forgotten, so the next opening asks again instead\n\t\t// of naming every filter by its raw key for the rest of the session.\n\t\tschemaCache.set(key, getJson(`/apps/openregister/api/schemas/${encodeURIComponent(schema)}`, { register }).catch(() => {\n\t\t\tschemaCache.delete(key)\n\t\t\treturn null\n\t\t}))\n\t}\n\treturn schemaCache.get(key)\n}\n\n/**\n * The names of referenced records, each asked once.\n *\n * @param {{register: string, schema: string, labelField: string, matchField?: string, ids: Array<string>}} ref The reference filter; with `matchField` the ids are that field's values.\n * @return {Promise<{[id: string]: string}>}\n */\nasync function loadLabels(ref) {\n\tconst prefix = `${ref.register}|${ref.schema}|${ref.labelField}|${ref.matchField || ''}|`\n\tconst missing = ref.ids.filter((id) => !labelCache.has(prefix + id))\n\t// A value that identifies a record by another field: one read per value.\n\tif (missing.length > 0 && ref.matchField) {\n\t\tfor (const value of missing) {\n\t\t\tlabelCache.set(prefix + value, getJson(`/apps/openregister/api/objects/${encodeURIComponent(ref.register)}/${encodeURIComponent(ref.schema)}`, { [ref.matchField]: value, _limit: 1 })\n\t\t\t\t.then((data) => {\n\t\t\t\t\tconst row = Array.isArray(data && data.results) ? data.results[0] : null\n\t\t\t\t\treturn row ? pickRefLabel(row, ref.labelField) : null\n\t\t\t\t})\n\t\t\t\t.catch(() => null))\n\t\t}\n\t} else if (missing.length > 0) {\n\t\tconst request = getJson(`/apps/openregister/api/objects/${encodeURIComponent(ref.register)}/${encodeURIComponent(ref.schema)}`, { _ids: missing.join(','), _limit: missing.length })\n\t\t\t.then((data) => {\n\t\t\t\tconst byId = {}\n\t\t\t\tfor (const row of (Array.isArray(data && data.results) ? data.results : [])) {\n\t\t\t\t\tconst id = row && (row.id ?? row.uuid ?? (row['@self'] && row['@self'].id))\n\t\t\t\t\tif (id !== undefined && id !== null) {\n\t\t\t\t\t\tbyId[String(id)] = pickRefLabel(row, ref.labelField)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn byId\n\t\t\t})\n\t\t\t.catch(() => ({}))\n\t\tfor (const id of missing) {\n\t\t\tlabelCache.set(prefix + id, request.then((byId) => byId[id] || null))\n\t\t}\n\t}\n\tconst out = {}\n\tawait Promise.all(ref.ids.map(async (id) => {\n\t\tconst label = await labelCache.get(prefix + id)\n\t\tif (label) {\n\t\t\tout[id] = label\n\t\t}\n\t}))\n\treturn out\n}\n\n/**\n * How many records a view's filters match on its page, asked once per view.\n *\n * @param {{register: string, schema: string, baseFilter: object}} page The page.\n * @param {object} filter The view's filters as query parameters.\n * @return {Promise<number|null>}\n */\nfunction loadCount(page, filter) {\n\tconst key = JSON.stringify([page.register, page.schema, page.baseFilter, filter])\n\tif (!countCache.has(key)) {\n\t\tcountCache.set(key, fetchFilterCounts({ register: page.register, schema: page.schema, entries: [{ key: 'view', filter }], baseFilter: page.baseFilter })\n\t\t\t.then((counts) => (typeof counts.view === 'number' ? counts.view : null))\n\t\t\t.catch(() => null))\n\t}\n\treturn countCache.get(key)\n}\n\n/**\n * A view's filters as the list request sends them.\n *\n * @param {{filters: object, search: string}} state The view's state.\n * @return {object}\n */\nfunction filterParams(state) {\n\tconst out = {}\n\tfor (const [key, raw] of Object.entries(state.filters || {})) {\n\t\tObject.assign(out, facetFilterParams(key, Array.isArray(raw) ? raw : [raw]))\n\t}\n\tif (state.search) {\n\t\tout._search = state.search\n\t}\n\treturn out\n}\n\n/**\n * CnSavedViewMenuSettings - the user's \"My views\" menu entries as a settings\n * section body (board DqPersoonlijkeInstellingen, \"Views in my menu\"): the\n * entries in their menu order, reordered by dragging or the arrow keys,\n * taken out of the menu with \"Remove from menu\", and a picker that adds any\n * view the user can see on a page of the app (their own, shared ones and the\n * pages' default views). Removing an entry never deletes the view.\n *\n * Each row says what its view shows and how many records that is: \"Case\n * type Woo request, status open · 19 cases\". The line is built from the\n * view's filters with the page schema's titles and the names of the records\n * and options they point at; the count is one request per view, cached for\n * the session, and fills in when it arrives without holding up the list.\n *\n * Reads and writes the list CnAppRoot holds (`cnSavedViewMenu`, stored in\n * the `cn_saved_view_menu` preference). CnAppRoot draws it as the `views`\n * section of its user settings dialog; an app with a dialog of its own can\n * mount it inside an NcAppSettingsSection.\n *\n * @spec openspec/changes/saved-view-menu-settings/specs/saved-view-menu-settings/spec.md#requirement-a-user-orders-and-picks-the-views-in-their-menu\n */\nexport default {\n\tname: 'CnSavedViewMenuSettings',\n\tcomponents: { CnOrderedListField },\n\tinject: {\n\t\tcnSavedViewMenu: { default: null },\n\t\tcnManifest: { default: null },\n\t\tcnTranslate: { default: () => (key) => key },\n\t\tcnAppId: { default: '' },\n\t\tcnAppConfig: { default: null },\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\tviews: [],\n\t\t\tloading: false,\n\t\t\t/** The schema per page id. */\n\t\t\tschemas: {},\n\t\t\t/** Looked-up display names per page id, filter key and value. */\n\t\t\tvalueLabels: {},\n\t\t\t/** The count per list value; undefined while it is asked. */\n\t\t\tcounts: {},\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** @return {object|null} The menu holder, when it can be changed. */\n\t\tmenu() {\n\t\t\tconst menu = this.cnSavedViewMenu\n\t\t\treturn menu && typeof menu.set === 'function' ? menu : null\n\t\t},\n\n\t\t/** @return {Array<object>} The stored entries. */\n\t\tentries() {\n\t\t\treturn normalizeSavedViewMenu(this.cnSavedViewMenu ? this.cnSavedViewMenu.entries : [])\n\t\t},\n\n\t\t/** @return {Array<object>} The pages that offer saved views. */\n\t\tpages() {\n\t\t\tconst pages = this.cnManifest && Array.isArray(this.cnManifest.pages) ? this.cnManifest.pages : []\n\t\t\treturn pages\n\t\t\t\t.filter((page) => page && page.type === 'index' && typeof page.id === 'string' && pageOffersSavedViews(page.config))\n\t\t\t\t.map((page) => {\n\t\t\t\t\tconst config = page.config || {}\n\t\t\t\t\treturn {\n\t\t\t\t\t\tid: page.id,\n\t\t\t\t\t\ttitle: typeof page.title === 'string' ? this.cnTranslate(page.title) : page.id,\n\t\t\t\t\t\tscope: { scope: config.savedViewsScope, register: config.register, schema: config.schema, source: config.entitySource },\n\t\t\t\t\t\tdefaults: Array.isArray(config.defaultSavedViews) ? config.defaultSavedViews : [],\n\t\t\t\t\t\tregister: typeof config.register === 'string' ? config.register : '',\n\t\t\t\t\t\tschema: typeof config.schema === 'string' ? config.schema : '',\n\t\t\t\t\t\tbaseFilter: resolveFilterMap(config.filter, {}, { config: this.cnAppConfig || {} }),\n\t\t\t\t\t\tcountSubtitle: config.countSubtitle || null,\n\t\t\t\t\t\tfilterLabels: (config.filterLabels && typeof config.filterLabels === 'object') ? config.filterLabels : {},\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t},\n\n\t\t/** @return {Array<object>} Every view the user can put in the menu, with its page and state. */\n\t\tcandidates() {\n\t\t\tconst out = []\n\t\t\tfor (const page of this.pages) {\n\t\t\t\tconst defaults = page.defaults.map((entry) => (entry && typeof entry.name === 'string' ? { ...entry, name: this.cnTranslate(entry.name) } : entry))\n\t\t\t\tconst views = [...defaultFilterViews(defaults, page.scope), ...this.views.filter((view) => viewMatchesScope(view, page.scope))]\n\t\t\t\tfor (const view of views) {\n\t\t\t\t\tconst id = String(view.id ?? view.slug ?? '')\n\t\t\t\t\tif (id === '' || typeof view.name !== 'string' || view.name === '') {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tout.push({ value: keyOf(page.id, id), id, page: page.id, label: view.name, state: extractViewState(view) })\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn out\n\t\t},\n\n\t\t/** @return {Array<string>} The entries as list values, in menu order. */\n\t\tvalues() {\n\t\t\treturn this.entries.map((entry) => keyOf(entry.page, entry.id))\n\t\t},\n\n\t\t/**\n\t\t * The choices: the candidates, and the entries no candidate covers. A\n\t\t * choice's second line says what the view shows; a row in the menu\n\t\t * adds how many records that is, once the count is in.\n\t\t *\n\t\t * @return {Array<{value: string, label: string, description: string}>}\n\t\t */\n\t\toptions() {\n\t\t\tconst byId = new Map(this.pages.map((page) => [page.id, page]))\n\t\t\tconst inMenu = new Set(this.values)\n\t\t\tconst known = new Set(this.candidates.map((c) => c.value))\n\t\t\tconst candidates = this.candidates.map((c) => {\n\t\t\t\tconst summary = this.summaryOf(byId.get(c.page), c.state)\n\t\t\t\tconst count = inMenu.has(c.value) ? this.countText(byId.get(c.page), this.counts[c.value]) : ''\n\t\t\t\treturn { value: c.value, label: c.label, description: count ? `${summary} · ${count}` : summary }\n\t\t\t})\n\t\t\tconst stored = this.entries\n\t\t\t\t.filter((entry) => !known.has(keyOf(entry.page, entry.id)))\n\t\t\t\t.map((entry) => ({ value: keyOf(entry.page, entry.id), label: entry.name, description: byId.has(entry.page) ? byId.get(entry.page).title : '' }))\n\t\t\treturn [...candidates, ...stored]\n\t\t},\n\t},\n\n\twatch: {\n\t\t/** Look up the names a summary needs once the views are in. */\n\t\tcandidates() {\n\t\t\tthis.loadValueLabels()\n\t\t\tthis.loadCounts()\n\t\t},\n\n\t\t/** Count a view as soon as it is in the menu. */\n\t\tvalues() {\n\t\t\tthis.loadCounts()\n\t\t},\n\t},\n\n\tmounted() {\n\t\tthis.fetchViews()\n\t\tthis.loadSchemas()\n\t\tthis.loadCounts()\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/** Read the saved views the user can see; without them the defaults stay. */\n\t\tasync fetchViews() {\n\t\t\tthis.loading = true\n\t\t\ttry {\n\t\t\t\tconst views = await useSavedViewsApi().fetchViews()\n\t\t\t\tthis.views = Array.isArray(views) ? views : []\n\t\t\t} catch {\n\t\t\t\tthis.views = []\n\t\t\t} finally {\n\t\t\t\tthis.loading = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * A view's filters as one line, else the page's title.\n\t\t *\n\t\t * @param {object} page The page.\n\t\t * @param {{filters: object, search: string}} state The view's state.\n\t\t * @return {string}\n\t\t */\n\t\tsummaryOf(page, state) {\n\t\t\tconst schema = this.schemas[page.id]\n\t\t\tconst summary = summarizeViewFilters(state, {\n\t\t\t\tproperties: (schema && schema.properties) || {},\n\t\t\t\tvalueLabels: this.valueLabels[page.id] || {},\n\t\t\t\tfilterLabels: page.filterLabels,\n\t\t\t\ttranslate: this.cnTranslate,\n\t\t\t})\n\t\t\treturn summary || page.title\n\t\t},\n\n\t\t/**\n\t\t * \"19 cases\": the page's `countSubtitle` for the total, else \"19 results\".\n\t\t *\n\t\t * @param {object} page The page.\n\t\t * @param {number|undefined} total The count, when it is in.\n\t\t * @return {string} The text, or '' while the count is unknown.\n\t\t */\n\t\tcountText(page, total) {\n\t\t\tif (typeof total !== 'number') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst line = page.countSubtitle ? countLine(page.countSubtitle, total, { translate: this.cnTranslate, appId: this.cnAppId }) : ''\n\t\t\treturn line || n('nextcloud-vue', '%n result', '%n results', total)\n\t\t},\n\n\t\t/** Read the schema of every page that offers saved views, for field titles and value names. */\n\t\tasync loadSchemas() {\n\t\t\tawait Promise.all(this.pages.filter((page) => page.register && page.schema).map(async (page) => {\n\t\t\t\tconst schema = await loadSchema(page.register, page.schema)\n\t\t\t\tif (schema) {\n\t\t\t\t\tthis.schemas = { ...this.schemas, [page.id]: schema }\n\t\t\t\t}\n\t\t\t}))\n\t\t\tthis.loadValueLabels()\n\t\t},\n\n\t\t/** Look up the names of the referenced records the views filter on. */\n\t\tasync loadValueLabels() {\n\t\t\tfor (const page of this.pages) {\n\t\t\t\tconst schema = this.schemas[page.id]\n\t\t\t\tif (!schema) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tconst fields = fieldsFromSchema(schema, { includeReadOnly: true })\n\t\t\t\tconst refs = this.candidates\n\t\t\t\t\t.filter((c) => c.page === page.id)\n\t\t\t\t\t.flatMap((c) => viewFilterReferences(c.state, fields, page.filterLabels))\n\t\t\t\tfor (const ref of refs) {\n\t\t\t\t\tconst labels = await loadLabels({ ...ref, register: ref.register || page.register })\n\t\t\t\t\tif (Object.keys(labels).length === 0) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tconst forPage = this.valueLabels[page.id] || {}\n\t\t\t\t\tthis.valueLabels = { ...this.valueLabels, [page.id]: { ...forPage, [ref.key]: { ...(forPage[ref.key] || {}), ...labels } } }\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\t/** Count every view in the menu; each count fills in on its own. */\n\t\tloadCounts() {\n\t\t\tfor (const value of this.values) {\n\t\t\t\tif (Object.hasOwn(this.counts, value)) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tconst candidate = this.candidates.find((c) => c.value === value)\n\t\t\t\tconst page = candidate && this.pages.find((p) => p.id === candidate.page)\n\t\t\t\tif (!page || !page.register || !page.schema) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tthis.counts = { ...this.counts, [value]: undefined }\n\t\t\t\tloadCount(page, filterParams(candidate.state)).then((total) => {\n\t\t\t\t\tif (typeof total === 'number') {\n\t\t\t\t\t\tthis.counts = { ...this.counts, [value]: total }\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Store the list in its new order, with entries removed or added.\n\t\t *\n\t\t * @param {Array<string>} values The list values in order.\n\t\t */\n\t\tonChange(values) {\n\t\t\tif (!this.menu) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst byKey = new Map(this.entries.map((entry) => [keyOf(entry.page, entry.id), entry]))\n\t\t\tconst candidates = new Map(this.candidates.map((c) => [c.value, c]))\n\t\t\tconst next = values\n\t\t\t\t.map((value) => {\n\t\t\t\t\tif (byKey.has(value)) {\n\t\t\t\t\t\treturn byKey.get(value)\n\t\t\t\t\t}\n\t\t\t\t\tconst candidate = candidates.get(value)\n\t\t\t\t\treturn candidate ? { id: candidate.id, page: candidate.page, name: candidate.label } : null\n\t\t\t\t})\n\t\t\t\t.filter(Boolean)\n\t\t\tthis.menu.set(next)\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n/* The description sits 16px above the list, as a board section's does\n (DqPersoonlijkeInstellingen \"Weergaven in mijn menu\"). */\n.cn-saved-view-menu-settings__intro {\n\tmargin: 0 0 16px;\n\tcolor: var(--color-text-maxcontrast);\n}\n</style>\n"],"names":["_openBlock","_createElementBlock","_createElementVNode","_toDisplayString","_createVNode"],"mappings":";;;AAWM,EAAA,KAAK,EAAC,6BAAU;AAAA,EAAA,aAAA,EAAA,6BAAA;;AACjB,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,oCAAS,GAAA;;;;;AADjB,EAAA,QAAAA,SAAA,EAAA,EAAAC,kBAAA,QAAA;IACAC,kBAEG,CAAA,GAAA,EAFH,UAEG,EAAAC,eAAA,CADA,QAAC,CAAA,CAAA,CAAA,eAAA,EAAA,4LAAA,CAAA,CAAA,EAAA,CAAA,YAAA;IAEJC;AACC,MAAA,UAAU,EAAE,QAAM,CAAA,MAAA;AAClB,MAAA,OAAO,EAAE,QAAO,CAAA,OAAA;AAChB,MAAA,KAAK,EAAE,QAAC,CAAA,CAAA,CAAA,eAAA,EAAA,kBAAA,CAAA;AACR,MAAA,SAAS,EAAE,IAAI;AACf,MAAA,QAAQ,EAAE,QAAC,CAAA,CAAA,CAAA,eAAA,EAAA,UAAA,CAAA;AACX,MAAA,cAAc,EAAC,QAAA,CAAA,CAAA,CAAA,eAAA,EAAA,mBAAA,CAAA;AACf,MAAA,OAAO,EAAE,QAAC,CAAA,CAAA,CAAA,eAAA,EAAA,yGAAA,CAAA;AACV,MAAA,WAAE,EAAA,QAAA,CAAA,CAAA,CAAA,eAAA,EAAA,kBAAA,CAAA;;;;;;;;;;;"}
|
|
@@ -37,6 +37,21 @@ var script = {
|
|
|
37
37
|
},
|
|
38
38
|
|
|
39
39
|
computed: {
|
|
40
|
+
/**
|
|
41
|
+
* The choices for the object slug field: every schema property, and first the
|
|
42
|
+
* reserved source `@schema.name` that OpenRegister turns into
|
|
43
|
+
* `<schema slug>-<object name>` (the second choice Robert Zondervan asked for
|
|
44
|
+
* next to a property, 2026-10-26). Stored as the id, shown by its label.
|
|
45
|
+
*
|
|
46
|
+
* @return {Array<{id: string, label: string}>}
|
|
47
|
+
*/
|
|
48
|
+
slugFieldOptions() {
|
|
49
|
+
return [
|
|
50
|
+
{ id: '@schema.name', label: translate('nextcloud-vue', 'Schema name + object name') },
|
|
51
|
+
...this.propertyOptions.map((property) => ({ id: property, label: property })),
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
|
|
40
55
|
/** Local alias to avoid vue/no-mutating-props on template bindings */
|
|
41
56
|
schema() {
|
|
42
57
|
return this.schemaItem
|
|
@@ -44,6 +59,16 @@ var script = {
|
|
|
44
59
|
},
|
|
45
60
|
|
|
46
61
|
watch: {
|
|
62
|
+
// The suffix only applies together with a slug field; drop it when the
|
|
63
|
+
// field is cleared so it cannot silently re-activate on a later pick.
|
|
64
|
+
'schema.configuration.objectSlugField': {
|
|
65
|
+
handler(value) {
|
|
66
|
+
if (!value && this.schema.configuration.objectSlugSuffix) {
|
|
67
|
+
this.schema.configuration.objectSlugSuffix = false;
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
|
|
47
72
|
'schema.configuration.allowedTags': {
|
|
48
73
|
immediate: true,
|
|
49
74
|
handler(tags) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CnSchemaConfigurationTab.vue2.js","sources":["../../../../src/components/CnSchemaFormDialog/CnSchemaConfigurationTab.vue"],"sourcesContent":["<template>\n\t<div class=\"cn-schema-form__form-editor\">\n\t\t<NcTextArea v-model=\"schema.description\"\n\t\t\t:disabled=\"loading\"\n\t\t\t:label=\"t('nextcloud-vue', 'Description')\" />\n\t\t<NcTextArea v-model=\"schema.summary\"\n\t\t\t:disabled=\"loading\"\n\t\t\t:label=\"t('nextcloud-vue', 'Summary')\" />\n\t\t<NcTextField v-model=\"schema.slug\"\n\t\t\t:disabled=\"loading\"\n\t\t\t:label=\"t('nextcloud-vue', 'Slug')\" />\n\n\t\t<!-- Schema Composition Section -->\n\t\t<div>\n\t\t\t<h3>{{ t('nextcloud-vue', 'Schema composition (JSON Schema)') }}</h3>\n\n\t\t\t<!-- allOf - Multiple Inheritance (Recommended) -->\n\t\t\t<NcSelect\n\t\t\t\tv-model=\"schema.allOf\"\n\t\t\t\t:disabled=\"loading\"\n\t\t\t\t:options=\"availableSchemas\"\n\t\t\t\t:multiple=\"true\"\n\t\t\t\t:clearable=\"true\"\n\t\t\t\t:keepOpen=\"true\"\n\t\t\t\tlabel=\"title\"\n\t\t\t\ttrackBy=\"id\"\n\t\t\t\t:inputLabel=\"t('nextcloud-vue', 'allOf - Inherits from ALL schemas (Recommended)')\"\n\t\t\t\t:placeholder=\"t('nextcloud-vue', 'Select schemas to inherit from (supports multiple parents)')\">\n\t\t\t\t<template #option=\"{ title, description }\">\n\t\t\t\t\t<div class=\"cn-schema-form__schema-option\">\n\t\t\t\t\t\t<span class=\"cn-schema-form__option-title\">{{ title }}</span>\n\t\t\t\t\t\t<span v-if=\"description\" class=\"cn-schema-form__option-description\">{{ description }}</span>\n\t\t\t\t\t</div>\n\t\t\t\t</template>\n\t\t\t</NcSelect>\n\t\t\t<NcNoteCard v-if=\"schema.allOf && schema.allOf.length > 0\" type=\"info\">\n\t\t\t\t<p><strong>{{ t('nextcloud-vue', 'allOf - Multiple inheritance') }}</strong></p>\n\t\t\t\t<p>{{ t('nextcloud-vue', 'Instance must validate against all selected schemas. Properties from all parent schemas are merged. This is the recommended pattern for schema extension and multiple inheritance.') }}</p>\n\t\t\t\t<p><strong>{{ t('nextcloud-vue', 'Important:') }}</strong> {{ t('nextcloud-vue', 'Child schemas can only add constraints, never relax them (Liskov substitution principle). Metadata (title, description, order) can be overridden.') }}</p>\n\t\t\t\t<div v-if=\"allOfSchemaNames.length > 0\">\n\t\t\t\t\t<strong>{{ t('nextcloud-vue', 'Parent schemas:') }}</strong>\n\t\t\t\t\t<ul>\n\t\t\t\t\t\t<li v-for=\"name in allOfSchemaNames\" :key=\"name\">\n\t\t\t\t\t\t\t{{ name }}\n\t\t\t\t\t\t</li>\n\t\t\t\t\t</ul>\n\t\t\t\t</div>\n\t\t\t</NcNoteCard>\n\n\t\t\t<!-- oneOf - Mutually Exclusive Options -->\n\t\t\t<NcSelect\n\t\t\t\tv-model=\"schema.oneOf\"\n\t\t\t\t:disabled=\"loading\"\n\t\t\t\t:options=\"availableSchemas\"\n\t\t\t\t:multiple=\"true\"\n\t\t\t\t:clearable=\"true\"\n\t\t\t\t:keepOpen=\"true\"\n\t\t\t\tlabel=\"title\"\n\t\t\t\ttrackBy=\"id\"\n\t\t\t\t:inputLabel=\"t('nextcloud-vue', 'oneOf - Exactly one schema must match')\"\n\t\t\t\t:placeholder=\"t('nextcloud-vue', 'Select schemas (instance must match exactly one)')\">\n\t\t\t\t<template #option=\"{ title, description }\">\n\t\t\t\t\t<div class=\"cn-schema-form__schema-option\">\n\t\t\t\t\t\t<span class=\"cn-schema-form__option-title\">{{ title }}</span>\n\t\t\t\t\t\t<span v-if=\"description\" class=\"cn-schema-form__option-description\">{{ description }}</span>\n\t\t\t\t\t</div>\n\t\t\t\t</template>\n\t\t\t</NcSelect>\n\t\t\t<NcNoteCard v-if=\"schema.oneOf && schema.oneOf.length > 0\" type=\"info\">\n\t\t\t\t<p><strong>{{ t('nextcloud-vue', 'oneOf - Mutually exclusive') }}</strong></p>\n\t\t\t\t<p>{{ t('nextcloud-vue', 'Instance must validate against exactly one of the selected schemas. Properties are not merged. Use for discriminated unions or type variants.') }}</p>\n\t\t\t</NcNoteCard>\n\n\t\t\t<!-- anyOf - Flexible Composition -->\n\t\t\t<NcSelect\n\t\t\t\tv-model=\"schema.anyOf\"\n\t\t\t\t:disabled=\"loading\"\n\t\t\t\t:options=\"availableSchemas\"\n\t\t\t\t:multiple=\"true\"\n\t\t\t\t:clearable=\"true\"\n\t\t\t\t:keepOpen=\"true\"\n\t\t\t\tlabel=\"title\"\n\t\t\t\ttrackBy=\"id\"\n\t\t\t\t:inputLabel=\"t('nextcloud-vue', 'anyOf - At least one schema must match')\"\n\t\t\t\t:placeholder=\"t('nextcloud-vue', 'Select schemas (instance must match at least one)')\">\n\t\t\t\t<template #option=\"{ title, description }\">\n\t\t\t\t\t<div class=\"cn-schema-form__schema-option\">\n\t\t\t\t\t\t<span class=\"cn-schema-form__option-title\">{{ title }}</span>\n\t\t\t\t\t\t<span v-if=\"description\" class=\"cn-schema-form__option-description\">{{ description }}</span>\n\t\t\t\t\t</div>\n\t\t\t\t</template>\n\t\t\t</NcSelect>\n\t\t\t<NcNoteCard v-if=\"schema.anyOf && schema.anyOf.length > 0\" type=\"info\">\n\t\t\t\t<p><strong>{{ t('nextcloud-vue', 'anyOf - Flexible composition') }}</strong></p>\n\t\t\t\t<p>{{ t('nextcloud-vue', 'Instance must validate against at least one of the selected schemas. Properties are not merged. More permissive than oneOf.') }}</p>\n\t\t\t</NcNoteCard>\n\t\t</div>\n\t\t<NcSelect\n\t\t\tv-model=\"schema.configuration.objectNameField\"\n\t\t\t:disabled=\"loading\"\n\t\t\t:options=\"propertyOptions\"\n\t\t\t:clearable=\"true\"\n\t\t\t:inputLabel=\"t('nextcloud-vue', 'Object name field')\"\n\t\t\t:placeholder=\"t('nextcloud-vue', 'Select a property to use as object name')\" />\n\t\t<NcSelect\n\t\t\tv-model=\"schema.configuration.objectDescriptionField\"\n\t\t\t:disabled=\"loading\"\n\t\t\t:options=\"propertyOptions\"\n\t\t\t:clearable=\"true\"\n\t\t\t:inputLabel=\"t('nextcloud-vue', 'Object description field')\"\n\t\t\t:placeholder=\"t('nextcloud-vue', 'Select a property to use as object description')\" />\n\t\t<NcSelect\n\t\t\tv-model=\"schema.configuration.objectImageField\"\n\t\t\t:disabled=\"loading\"\n\t\t\t:options=\"propertyOptions\"\n\t\t\t:clearable=\"true\"\n\t\t\t:inputLabel=\"t('nextcloud-vue', 'Object image field')\"\n\t\t\t:placeholder=\"t('nextcloud-vue', 'Select a property to use as object image representing the object. e.g. logo (should contain base64 encoded image)')\" />\n\t\t<NcSelect\n\t\t\tv-model=\"schema.configuration.objectSummaryField\"\n\t\t\t:disabled=\"loading\"\n\t\t\t:options=\"propertyOptions\"\n\t\t\t:clearable=\"true\"\n\t\t\t:inputLabel=\"t('nextcloud-vue', 'Object summary field')\"\n\t\t\t:placeholder=\"t('nextcloud-vue', 'Select a property to use as object summary. e.g. summary, abstract, or excerpt')\" />\n\t\t<NcCheckboxRadioSwitch\n\t\t\tv-model=\"schema.configuration.allowFiles\"\n\t\t\t:disabled=\"loading\">\n\t\t\t{{ t('nextcloud-vue', 'Allow files') }}\n\t\t</NcCheckboxRadioSwitch>\n\t\t<NcCheckboxRadioSwitch\n\t\t\tv-model=\"schema.configuration.autoPublish\"\n\t\t\t:disabled=\"loading\">\n\t\t\t{{ t('nextcloud-vue', 'Auto-publish objects') }}\n\t\t</NcCheckboxRadioSwitch>\n\t\t<NcCheckboxRadioSwitch\n\t\t\tv-model=\"schema.configuration.defaultAutoShare\"\n\t\t\t:disabled=\"loading\">\n\t\t\t{{ t('nextcloud-vue', 'Default \"Automatically publish\" toggle to on for new attachments') }}\n\t\t</NcCheckboxRadioSwitch>\n\t\t<NcTextField\n\t\t\tv-model=\"allowedTagsInput\"\n\t\t\t:disabled=\"loading\"\n\t\t\t:label=\"t('nextcloud-vue', 'Allowed tags (comma-separated)')\"\n\t\t\t:placeholder=\"t('nextcloud-vue', 'image, document, audio, video')\"\n\t\t\t@update:modelValue=\"updateAllowedTags\" />\n\t\t<NcCheckboxRadioSwitch\n\t\t\tv-model=\"schema.hardValidation\"\n\t\t\t:disabled=\"loading\">\n\t\t\t{{ t('nextcloud-vue', 'Hard validation') }}\n\t\t</NcCheckboxRadioSwitch>\n\t\t<NcTextField v-model=\"schema.maxDepth\"\n\t\t\t:disabled=\"loading\"\n\t\t\t:label=\"t('nextcloud-vue', 'Max depth')\"\n\t\t\ttype=\"number\" />\n\t\t<NcTextField :disabled=\"loading\"\n\t\t\t:label=\"t('nextcloud-vue', 'Icon (Material Design Icon name, e.g. Dog)')\"\n\t\t\t:modelValue=\"schema.icon || ''\"\n\t\t\t:placeholder=\"t('nextcloud-vue', 'e.g. Dog, Account, Tag — see pictogrammers.com/library/mdi')\"\n\t\t\t@update:modelValue=\"setIcon\" />\n\t\t<NcCheckboxRadioSwitch\n\t\t\tv-model=\"schema.immutable\"\n\t\t\t:disabled=\"loading\">\n\t\t\t{{ t('nextcloud-vue', 'Immutable') }}\n\t\t</NcCheckboxRadioSwitch>\n\t\t<NcCheckboxRadioSwitch\n\t\t\tv-model=\"schema.searchable\"\n\t\t\t:disabled=\"loading\">\n\t\t\t{{ t('nextcloud-vue', 'Searchable (appears in Nextcloud unified search)') }}\n\t\t</NcCheckboxRadioSwitch>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport {\n\tNcCheckboxRadioSwitch,\n\tNcNoteCard,\n\tNcSelect,\n\tNcTextArea,\n\tNcTextField,\n} from '@nextcloud/vue'\n\n/**\n * CnSchemaConfigurationTab — Configuration form tab for CnSchemaFormDialog.\n *\n * Renders schema metadata fields, composition (allOf/oneOf/anyOf), field mappings,\n * and configuration toggles. Mutates schemaItem directly.\n */\nexport default {\n\tname: 'CnSchemaConfigurationTab',\n\tcomponents: {\n\t\tNcTextField,\n\t\tNcTextArea,\n\t\tNcNoteCard,\n\t\tNcCheckboxRadioSwitch,\n\t\tNcSelect,\n\t},\n\n\tprops: {\n\t\t/** The full schema item — mutated directly */\n\t\tschemaItem: { type: Object, required: true },\n\t\t/** Disable state */\n\t\tloading: { type: Boolean, default: false },\n\t\t/** Available schemas for composition selects */\n\t\tavailableSchemas: { type: Array, default: () => [] },\n\t\t/** Property names for field mapping selects */\n\t\tpropertyOptions: { type: Array, default: () => [] },\n\t\t/** Pre-computed names for allOf note card display */\n\t\tallOfSchemaNames: { type: Array, default: () => [] },\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\tallowedTagsInput: '',\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** Local alias to avoid vue/no-mutating-props on template bindings */\n\t\tschema() {\n\t\t\treturn this.schemaItem\n\t\t},\n\t},\n\n\twatch: {\n\t\t'schema.configuration.allowedTags': {\n\t\t\timmediate: true,\n\t\t\thandler(tags) {\n\t\t\t\tthis.allowedTagsInput = (tags || []).join(', ')\n\t\t\t},\n\t\t},\n\t},\n\n\tmethods: {\n\t\tt,\n\t\t/**\n\t\t * Set the schema icon (an MDI name), using $set so a previously absent\n\t\t * `icon` key becomes reactive. An empty value clears it to null.\n\t\t *\n\t\t * @param {string} value The entered MDI icon name.\n\t\t */\n\t\tsetIcon(value) {\n\t\t\tconst trimmed = (value || '').trim()\n\t\t\tthis.schema.icon = trimmed === '' ? null : trimmed\n\t\t},\n\n\t\tupdateAllowedTags(value) {\n\t\t\tif (!value || value.trim() === '') {\n\t\t\t\tthis.schema.configuration.allowedTags = []\n\t\t\t} else {\n\t\t\t\tconst tags = value.split(',').map((tag) => tag.trim()).filter((tag) => tag !== '')\n\t\t\t\tthis.schema.configuration.allowedTags = tags\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n"],"names":["t"],"mappings":";;;AAuLA;AACC;AACA;AACA;;;AAGD,aAAe;AACd,CAAA,IAAI,EAAE,0BAA0B;CAChC,UAAU,EAAE;EACX,WAAW;EACX,UAAU;EACV,UAAU;AACV,EAAA,qBAAqB;AACrB,EAAA,QAAQ;EACR;;AAED,CAAA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AAU,GAAI,GAAC;IACxC,MAAK;AACN,IAAA,MAAM,IAAK,GAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,GAAI,KAAI,EAAE,EAAA;AACjF,IAAA,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,cAAc,KAAG;AAC5C,IAAA;GACA;EACD;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"CnSchemaConfigurationTab.vue2.js","sources":["../../../../src/components/CnSchemaFormDialog/CnSchemaConfigurationTab.vue"],"sourcesContent":["<template>\n\t<div class=\"cn-schema-form__form-editor\">\n\t\t<NcTextArea v-model=\"schema.description\"\n\t\t\t:disabled=\"loading\"\n\t\t\t:label=\"t('nextcloud-vue', 'Description')\" />\n\t\t<NcTextArea v-model=\"schema.summary\"\n\t\t\t:disabled=\"loading\"\n\t\t\t:label=\"t('nextcloud-vue', 'Summary')\" />\n\t\t<NcTextField v-model=\"schema.slug\"\n\t\t\t:disabled=\"loading\"\n\t\t\t:label=\"t('nextcloud-vue', 'Slug')\" />\n\n\t\t<!-- Schema Composition Section -->\n\t\t<div>\n\t\t\t<h3>{{ t('nextcloud-vue', 'Schema composition (JSON Schema)') }}</h3>\n\n\t\t\t<!-- allOf - Multiple Inheritance (Recommended) -->\n\t\t\t<NcSelect\n\t\t\t\tv-model=\"schema.allOf\"\n\t\t\t\t:disabled=\"loading\"\n\t\t\t\t:options=\"availableSchemas\"\n\t\t\t\t:multiple=\"true\"\n\t\t\t\t:clearable=\"true\"\n\t\t\t\t:keepOpen=\"true\"\n\t\t\t\tlabel=\"title\"\n\t\t\t\ttrackBy=\"id\"\n\t\t\t\t:inputLabel=\"t('nextcloud-vue', 'allOf - Inherits from ALL schemas (Recommended)')\"\n\t\t\t\t:placeholder=\"t('nextcloud-vue', 'Select schemas to inherit from (supports multiple parents)')\">\n\t\t\t\t<template #option=\"{ title, description }\">\n\t\t\t\t\t<div class=\"cn-schema-form__schema-option\">\n\t\t\t\t\t\t<span class=\"cn-schema-form__option-title\">{{ title }}</span>\n\t\t\t\t\t\t<span v-if=\"description\" class=\"cn-schema-form__option-description\">{{ description }}</span>\n\t\t\t\t\t</div>\n\t\t\t\t</template>\n\t\t\t</NcSelect>\n\t\t\t<NcNoteCard v-if=\"schema.allOf && schema.allOf.length > 0\" type=\"info\">\n\t\t\t\t<p><strong>{{ t('nextcloud-vue', 'allOf - Multiple inheritance') }}</strong></p>\n\t\t\t\t<p>{{ t('nextcloud-vue', 'Instance must validate against all selected schemas. Properties from all parent schemas are merged. This is the recommended pattern for schema extension and multiple inheritance.') }}</p>\n\t\t\t\t<p><strong>{{ t('nextcloud-vue', 'Important:') }}</strong> {{ t('nextcloud-vue', 'Child schemas can only add constraints, never relax them (Liskov substitution principle). Metadata (title, description, order) can be overridden.') }}</p>\n\t\t\t\t<div v-if=\"allOfSchemaNames.length > 0\">\n\t\t\t\t\t<strong>{{ t('nextcloud-vue', 'Parent schemas:') }}</strong>\n\t\t\t\t\t<ul>\n\t\t\t\t\t\t<li v-for=\"name in allOfSchemaNames\" :key=\"name\">\n\t\t\t\t\t\t\t{{ name }}\n\t\t\t\t\t\t</li>\n\t\t\t\t\t</ul>\n\t\t\t\t</div>\n\t\t\t</NcNoteCard>\n\n\t\t\t<!-- oneOf - Mutually Exclusive Options -->\n\t\t\t<NcSelect\n\t\t\t\tv-model=\"schema.oneOf\"\n\t\t\t\t:disabled=\"loading\"\n\t\t\t\t:options=\"availableSchemas\"\n\t\t\t\t:multiple=\"true\"\n\t\t\t\t:clearable=\"true\"\n\t\t\t\t:keepOpen=\"true\"\n\t\t\t\tlabel=\"title\"\n\t\t\t\ttrackBy=\"id\"\n\t\t\t\t:inputLabel=\"t('nextcloud-vue', 'oneOf - Exactly one schema must match')\"\n\t\t\t\t:placeholder=\"t('nextcloud-vue', 'Select schemas (instance must match exactly one)')\">\n\t\t\t\t<template #option=\"{ title, description }\">\n\t\t\t\t\t<div class=\"cn-schema-form__schema-option\">\n\t\t\t\t\t\t<span class=\"cn-schema-form__option-title\">{{ title }}</span>\n\t\t\t\t\t\t<span v-if=\"description\" class=\"cn-schema-form__option-description\">{{ description }}</span>\n\t\t\t\t\t</div>\n\t\t\t\t</template>\n\t\t\t</NcSelect>\n\t\t\t<NcNoteCard v-if=\"schema.oneOf && schema.oneOf.length > 0\" type=\"info\">\n\t\t\t\t<p><strong>{{ t('nextcloud-vue', 'oneOf - Mutually exclusive') }}</strong></p>\n\t\t\t\t<p>{{ t('nextcloud-vue', 'Instance must validate against exactly one of the selected schemas. Properties are not merged. Use for discriminated unions or type variants.') }}</p>\n\t\t\t</NcNoteCard>\n\n\t\t\t<!-- anyOf - Flexible Composition -->\n\t\t\t<NcSelect\n\t\t\t\tv-model=\"schema.anyOf\"\n\t\t\t\t:disabled=\"loading\"\n\t\t\t\t:options=\"availableSchemas\"\n\t\t\t\t:multiple=\"true\"\n\t\t\t\t:clearable=\"true\"\n\t\t\t\t:keepOpen=\"true\"\n\t\t\t\tlabel=\"title\"\n\t\t\t\ttrackBy=\"id\"\n\t\t\t\t:inputLabel=\"t('nextcloud-vue', 'anyOf - At least one schema must match')\"\n\t\t\t\t:placeholder=\"t('nextcloud-vue', 'Select schemas (instance must match at least one)')\">\n\t\t\t\t<template #option=\"{ title, description }\">\n\t\t\t\t\t<div class=\"cn-schema-form__schema-option\">\n\t\t\t\t\t\t<span class=\"cn-schema-form__option-title\">{{ title }}</span>\n\t\t\t\t\t\t<span v-if=\"description\" class=\"cn-schema-form__option-description\">{{ description }}</span>\n\t\t\t\t\t</div>\n\t\t\t\t</template>\n\t\t\t</NcSelect>\n\t\t\t<NcNoteCard v-if=\"schema.anyOf && schema.anyOf.length > 0\" type=\"info\">\n\t\t\t\t<p><strong>{{ t('nextcloud-vue', 'anyOf - Flexible composition') }}</strong></p>\n\t\t\t\t<p>{{ t('nextcloud-vue', 'Instance must validate against at least one of the selected schemas. Properties are not merged. More permissive than oneOf.') }}</p>\n\t\t\t</NcNoteCard>\n\t\t</div>\n\t\t<NcSelect\n\t\t\tv-model=\"schema.configuration.objectNameField\"\n\t\t\t:disabled=\"loading\"\n\t\t\t:options=\"propertyOptions\"\n\t\t\t:clearable=\"true\"\n\t\t\t:inputLabel=\"t('nextcloud-vue', 'Object name field')\"\n\t\t\t:placeholder=\"t('nextcloud-vue', 'Select a property to use as object name')\" />\n\t\t<NcSelect\n\t\t\tv-model=\"schema.configuration.objectDescriptionField\"\n\t\t\t:disabled=\"loading\"\n\t\t\t:options=\"propertyOptions\"\n\t\t\t:clearable=\"true\"\n\t\t\t:inputLabel=\"t('nextcloud-vue', 'Object description field')\"\n\t\t\t:placeholder=\"t('nextcloud-vue', 'Select a property to use as object description')\" />\n\t\t<NcSelect\n\t\t\tv-model=\"schema.configuration.objectImageField\"\n\t\t\t:disabled=\"loading\"\n\t\t\t:options=\"propertyOptions\"\n\t\t\t:clearable=\"true\"\n\t\t\t:inputLabel=\"t('nextcloud-vue', 'Object image field')\"\n\t\t\t:placeholder=\"t('nextcloud-vue', 'Select a property to use as object image representing the object. e.g. logo (should contain base64 encoded image)')\" />\n\t\t<NcSelect\n\t\t\tv-model=\"schema.configuration.objectSummaryField\"\n\t\t\t:disabled=\"loading\"\n\t\t\t:options=\"propertyOptions\"\n\t\t\t:clearable=\"true\"\n\t\t\t:inputLabel=\"t('nextcloud-vue', 'Object summary field')\"\n\t\t\t:placeholder=\"t('nextcloud-vue', 'Select a property to use as object summary. e.g. summary, abstract, or excerpt')\" />\n\t\t<NcSelect\n\t\t\tv-model=\"schema.configuration.objectSlugField\"\n\t\t\t:disabled=\"loading\"\n\t\t\t:options=\"slugFieldOptions\"\n\t\t\t:reduce=\"option => option.id\"\n\t\t\tlabel=\"label\"\n\t\t\t:clearable=\"true\"\n\t\t\t:inputLabel=\"t('nextcloud-vue', 'Object slug field')\"\n\t\t\t:placeholder=\"t('nextcloud-vue', 'Select a property to build object slugs from')\" />\n\t\t<NcCheckboxRadioSwitch\n\t\t\tv-model=\"schema.configuration.objectSlugSuffix\"\n\t\t\t:disabled=\"loading || !schema.configuration.objectSlugField\">\n\t\t\t{{ t('nextcloud-vue', 'Append a date-time suffix when a slug is already taken') }}\n\t\t</NcCheckboxRadioSwitch>\n\t\t<NcNoteCard v-if=\"schema.configuration.objectSlugField\" type=\"info\">\n\t\t\t<p>{{ t('nextcloud-vue', 'A slug is unique within the register and schema and does not change once it is set, also not after the slug field is switched. Objects without a slug get one from the new field on their next save or with occ openregister:backfill-slugs <register> <schema>.') }}</p>\n\t\t</NcNoteCard>\n\t\t<NcCheckboxRadioSwitch\n\t\t\tv-model=\"schema.configuration.allowFiles\"\n\t\t\t:disabled=\"loading\">\n\t\t\t{{ t('nextcloud-vue', 'Allow files') }}\n\t\t</NcCheckboxRadioSwitch>\n\t\t<NcCheckboxRadioSwitch\n\t\t\tv-model=\"schema.configuration.autoPublish\"\n\t\t\t:disabled=\"loading\">\n\t\t\t{{ t('nextcloud-vue', 'Auto-publish objects') }}\n\t\t</NcCheckboxRadioSwitch>\n\t\t<NcCheckboxRadioSwitch\n\t\t\tv-model=\"schema.configuration.defaultAutoShare\"\n\t\t\t:disabled=\"loading\">\n\t\t\t{{ t('nextcloud-vue', 'Default \"Automatically publish\" toggle to on for new attachments') }}\n\t\t</NcCheckboxRadioSwitch>\n\t\t<NcTextField\n\t\t\tv-model=\"allowedTagsInput\"\n\t\t\t:disabled=\"loading\"\n\t\t\t:label=\"t('nextcloud-vue', 'Allowed tags (comma-separated)')\"\n\t\t\t:placeholder=\"t('nextcloud-vue', 'image, document, audio, video')\"\n\t\t\t@update:modelValue=\"updateAllowedTags\" />\n\t\t<NcCheckboxRadioSwitch\n\t\t\tv-model=\"schema.hardValidation\"\n\t\t\t:disabled=\"loading\">\n\t\t\t{{ t('nextcloud-vue', 'Hard validation') }}\n\t\t</NcCheckboxRadioSwitch>\n\t\t<NcTextField v-model=\"schema.maxDepth\"\n\t\t\t:disabled=\"loading\"\n\t\t\t:label=\"t('nextcloud-vue', 'Max depth')\"\n\t\t\ttype=\"number\" />\n\t\t<NcTextField :disabled=\"loading\"\n\t\t\t:label=\"t('nextcloud-vue', 'Icon (Material Design Icon name, e.g. Dog)')\"\n\t\t\t:modelValue=\"schema.icon || ''\"\n\t\t\t:placeholder=\"t('nextcloud-vue', 'e.g. Dog, Account, Tag — see pictogrammers.com/library/mdi')\"\n\t\t\t@update:modelValue=\"setIcon\" />\n\t\t<NcCheckboxRadioSwitch\n\t\t\tv-model=\"schema.immutable\"\n\t\t\t:disabled=\"loading\">\n\t\t\t{{ t('nextcloud-vue', 'Immutable') }}\n\t\t</NcCheckboxRadioSwitch>\n\t\t<NcCheckboxRadioSwitch\n\t\t\tv-model=\"schema.searchable\"\n\t\t\t:disabled=\"loading\">\n\t\t\t{{ t('nextcloud-vue', 'Searchable (appears in Nextcloud unified search)') }}\n\t\t</NcCheckboxRadioSwitch>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport {\n\tNcCheckboxRadioSwitch,\n\tNcNoteCard,\n\tNcSelect,\n\tNcTextArea,\n\tNcTextField,\n} from '@nextcloud/vue'\n\n/**\n * CnSchemaConfigurationTab — Configuration form tab for CnSchemaFormDialog.\n *\n * Renders schema metadata fields, composition (allOf/oneOf/anyOf), field mappings,\n * and configuration toggles. Mutates schemaItem directly.\n */\nexport default {\n\tname: 'CnSchemaConfigurationTab',\n\tcomponents: {\n\t\tNcTextField,\n\t\tNcTextArea,\n\t\tNcNoteCard,\n\t\tNcCheckboxRadioSwitch,\n\t\tNcSelect,\n\t},\n\n\tprops: {\n\t\t/** The full schema item — mutated directly */\n\t\tschemaItem: { type: Object, required: true },\n\t\t/** Disable state */\n\t\tloading: { type: Boolean, default: false },\n\t\t/** Available schemas for composition selects */\n\t\tavailableSchemas: { type: Array, default: () => [] },\n\t\t/** Property names for field mapping selects */\n\t\tpropertyOptions: { type: Array, default: () => [] },\n\t\t/** Pre-computed names for allOf note card display */\n\t\tallOfSchemaNames: { type: Array, default: () => [] },\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\tallowedTagsInput: '',\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * The choices for the object slug field: every schema property, and first the\n\t\t * reserved source `@schema.name` that OpenRegister turns into\n\t\t * `<schema slug>-<object name>` (the second choice Robert Zondervan asked for\n\t\t * next to a property, 2026-10-26). Stored as the id, shown by its label.\n\t\t *\n\t\t * @return {Array<{id: string, label: string}>}\n\t\t */\n\t\tslugFieldOptions() {\n\t\t\treturn [\n\t\t\t\t{ id: '@schema.name', label: t('nextcloud-vue', 'Schema name + object name') },\n\t\t\t\t...this.propertyOptions.map((property) => ({ id: property, label: property })),\n\t\t\t]\n\t\t},\n\n\t\t/** Local alias to avoid vue/no-mutating-props on template bindings */\n\t\tschema() {\n\t\t\treturn this.schemaItem\n\t\t},\n\t},\n\n\twatch: {\n\t\t// The suffix only applies together with a slug field; drop it when the\n\t\t// field is cleared so it cannot silently re-activate on a later pick.\n\t\t'schema.configuration.objectSlugField': {\n\t\t\thandler(value) {\n\t\t\t\tif (!value && this.schema.configuration.objectSlugSuffix) {\n\t\t\t\t\tthis.schema.configuration.objectSlugSuffix = false\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\n\t\t'schema.configuration.allowedTags': {\n\t\t\timmediate: true,\n\t\t\thandler(tags) {\n\t\t\t\tthis.allowedTagsInput = (tags || []).join(', ')\n\t\t\t},\n\t\t},\n\t},\n\n\tmethods: {\n\t\tt,\n\t\t/**\n\t\t * Set the schema icon (an MDI name), using $set so a previously absent\n\t\t * `icon` key becomes reactive. An empty value clears it to null.\n\t\t *\n\t\t * @param {string} value The entered MDI icon name.\n\t\t */\n\t\tsetIcon(value) {\n\t\t\tconst trimmed = (value || '').trim()\n\t\t\tthis.schema.icon = trimmed === '' ? null : trimmed\n\t\t},\n\n\t\tupdateAllowedTags(value) {\n\t\t\tif (!value || value.trim() === '') {\n\t\t\t\tthis.schema.configuration.allowedTags = []\n\t\t\t} else {\n\t\t\t\tconst tags = value.split(',').map((tag) => tag.trim()).filter((tag) => tag !== '')\n\t\t\t\tthis.schema.configuration.allowedTags = tags\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n"],"names":["t"],"mappings":";;;AAwMA;AACC;AACA;AACA;;;AAGD,aAAe;AACd,CAAA,IAAI,EAAE,0BAA0B;CAChC,UAAU,EAAE;EACX,WAAW;EACX,UAAU;EACV,UAAU;AACV,EAAA,qBAAqB;AACrB,EAAA,QAAQ;EACR;;AAED,CAAA,KAAK,EAAE;AACN;AACA,EAAA,UAAU,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;AAC5C;AACA,EAAA,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO;AAC1C;AACA,EAAA,gBAAgB,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI;AACpD;AACA,EAAA,eAAe,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI;AACnD;AACA,EAAA,gBAAgB,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI;EACpD;;AAED,CAAA,IAAI,GAAG;AACN,EAAA,OAAO;AACN,GAAA,gBAAgB,EAAE,EAAE;AACrB,GAAA;EACA;;AAED,CAAA,QAAQ,EAAE;AACT;AACC;;AAEA;;AAEA;AACA;;AAED,EAAA,gBAAgB,GAAG;AAClB,GAAA,OAAO;AACN,IAAA,EAAE,EAAE,EAAE,cAAc,EAAE,KAAK,EAAEA,SAAC,CAAC,eAAe,EAAE,2BAA2B,GAAG;AAC9E,IAAA,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,QAAQ,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAS,EAAC,CAAC,C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ACA;EACD;AACF;;;;"}
|
|
@@ -211,9 +211,41 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
211
211
|
inputLabel: $options.t('nextcloud-vue', 'Object summary field'),
|
|
212
212
|
placeholder: $options.t('nextcloud-vue', 'Select a property to use as object summary. e.g. summary, abstract, or excerpt')
|
|
213
213
|
}, null, 8 /* PROPS */, ["modelValue", "disabled", "options", "inputLabel", "placeholder"]),
|
|
214
|
+
createVNode(_component_NcSelect, {
|
|
215
|
+
modelValue: $options.schema.configuration.objectSlugField,
|
|
216
|
+
"onUpdate:modelValue": _cache[10] || (_cache[10] = $event => (($options.schema.configuration.objectSlugField) = $event)),
|
|
217
|
+
disabled: $props.loading,
|
|
218
|
+
options: $options.slugFieldOptions,
|
|
219
|
+
reduce: option => option.id,
|
|
220
|
+
label: "label",
|
|
221
|
+
clearable: true,
|
|
222
|
+
inputLabel: $options.t('nextcloud-vue', 'Object slug field'),
|
|
223
|
+
placeholder: $options.t('nextcloud-vue', 'Select a property to build object slugs from')
|
|
224
|
+
}, null, 8 /* PROPS */, ["modelValue", "disabled", "options", "reduce", "inputLabel", "placeholder"]),
|
|
225
|
+
createVNode(_component_NcCheckboxRadioSwitch, {
|
|
226
|
+
modelValue: $options.schema.configuration.objectSlugSuffix,
|
|
227
|
+
"onUpdate:modelValue": _cache[11] || (_cache[11] = $event => (($options.schema.configuration.objectSlugSuffix) = $event)),
|
|
228
|
+
disabled: $props.loading || !$options.schema.configuration.objectSlugField
|
|
229
|
+
}, {
|
|
230
|
+
default: withCtx(() => [
|
|
231
|
+
createTextVNode(toDisplayString($options.t('nextcloud-vue', 'Append a date-time suffix when a slug is already taken')), 1 /* TEXT */)
|
|
232
|
+
]),
|
|
233
|
+
_: 1 /* STABLE */
|
|
234
|
+
}, 8 /* PROPS */, ["modelValue", "disabled"]),
|
|
235
|
+
($options.schema.configuration.objectSlugField)
|
|
236
|
+
? (openBlock(), createBlock(_component_NcNoteCard, {
|
|
237
|
+
key: 0,
|
|
238
|
+
type: "info"
|
|
239
|
+
}, {
|
|
240
|
+
default: withCtx(() => [
|
|
241
|
+
createElementVNode("p", null, toDisplayString($options.t('nextcloud-vue', 'A slug is unique within the register and schema and does not change once it is set, also not after the slug field is switched. Objects without a slug get one from the new field on their next save or with occ openregister:backfill-slugs <register> <schema>.')), 1 /* TEXT */)
|
|
242
|
+
]),
|
|
243
|
+
_: 1 /* STABLE */
|
|
244
|
+
}))
|
|
245
|
+
: createCommentVNode("v-if", true),
|
|
214
246
|
createVNode(_component_NcCheckboxRadioSwitch, {
|
|
215
247
|
modelValue: $options.schema.configuration.allowFiles,
|
|
216
|
-
"onUpdate:modelValue": _cache[
|
|
248
|
+
"onUpdate:modelValue": _cache[12] || (_cache[12] = $event => (($options.schema.configuration.allowFiles) = $event)),
|
|
217
249
|
disabled: $props.loading
|
|
218
250
|
}, {
|
|
219
251
|
default: withCtx(() => [
|
|
@@ -223,7 +255,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
223
255
|
}, 8 /* PROPS */, ["modelValue", "disabled"]),
|
|
224
256
|
createVNode(_component_NcCheckboxRadioSwitch, {
|
|
225
257
|
modelValue: $options.schema.configuration.autoPublish,
|
|
226
|
-
"onUpdate:modelValue": _cache[
|
|
258
|
+
"onUpdate:modelValue": _cache[13] || (_cache[13] = $event => (($options.schema.configuration.autoPublish) = $event)),
|
|
227
259
|
disabled: $props.loading
|
|
228
260
|
}, {
|
|
229
261
|
default: withCtx(() => [
|
|
@@ -233,7 +265,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
233
265
|
}, 8 /* PROPS */, ["modelValue", "disabled"]),
|
|
234
266
|
createVNode(_component_NcCheckboxRadioSwitch, {
|
|
235
267
|
modelValue: $options.schema.configuration.defaultAutoShare,
|
|
236
|
-
"onUpdate:modelValue": _cache[
|
|
268
|
+
"onUpdate:modelValue": _cache[14] || (_cache[14] = $event => (($options.schema.configuration.defaultAutoShare) = $event)),
|
|
237
269
|
disabled: $props.loading
|
|
238
270
|
}, {
|
|
239
271
|
default: withCtx(() => [
|
|
@@ -244,7 +276,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
244
276
|
createVNode(_component_NcTextField, {
|
|
245
277
|
modelValue: $data.allowedTagsInput,
|
|
246
278
|
"onUpdate:modelValue": [
|
|
247
|
-
_cache[
|
|
279
|
+
_cache[15] || (_cache[15] = $event => (($data.allowedTagsInput) = $event)),
|
|
248
280
|
$options.updateAllowedTags
|
|
249
281
|
],
|
|
250
282
|
disabled: $props.loading,
|
|
@@ -253,7 +285,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
253
285
|
}, null, 8 /* PROPS */, ["modelValue", "disabled", "label", "placeholder", "onUpdate:modelValue"]),
|
|
254
286
|
createVNode(_component_NcCheckboxRadioSwitch, {
|
|
255
287
|
modelValue: $options.schema.hardValidation,
|
|
256
|
-
"onUpdate:modelValue": _cache[
|
|
288
|
+
"onUpdate:modelValue": _cache[16] || (_cache[16] = $event => (($options.schema.hardValidation) = $event)),
|
|
257
289
|
disabled: $props.loading
|
|
258
290
|
}, {
|
|
259
291
|
default: withCtx(() => [
|
|
@@ -263,7 +295,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
263
295
|
}, 8 /* PROPS */, ["modelValue", "disabled"]),
|
|
264
296
|
createVNode(_component_NcTextField, {
|
|
265
297
|
modelValue: $options.schema.maxDepth,
|
|
266
|
-
"onUpdate:modelValue": _cache[
|
|
298
|
+
"onUpdate:modelValue": _cache[17] || (_cache[17] = $event => (($options.schema.maxDepth) = $event)),
|
|
267
299
|
disabled: $props.loading,
|
|
268
300
|
label: $options.t('nextcloud-vue', 'Max depth'),
|
|
269
301
|
type: "number"
|
|
@@ -277,7 +309,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
277
309
|
}, null, 8 /* PROPS */, ["disabled", "label", "modelValue", "placeholder", "onUpdate:modelValue"]),
|
|
278
310
|
createVNode(_component_NcCheckboxRadioSwitch, {
|
|
279
311
|
modelValue: $options.schema.immutable,
|
|
280
|
-
"onUpdate:modelValue": _cache[
|
|
312
|
+
"onUpdate:modelValue": _cache[18] || (_cache[18] = $event => (($options.schema.immutable) = $event)),
|
|
281
313
|
disabled: $props.loading
|
|
282
314
|
}, {
|
|
283
315
|
default: withCtx(() => [
|
|
@@ -287,7 +319,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
287
319
|
}, 8 /* PROPS */, ["modelValue", "disabled"]),
|
|
288
320
|
createVNode(_component_NcCheckboxRadioSwitch, {
|
|
289
321
|
modelValue: $options.schema.searchable,
|
|
290
|
-
"onUpdate:modelValue": _cache[
|
|
322
|
+
"onUpdate:modelValue": _cache[19] || (_cache[19] = $event => (($options.schema.searchable) = $event)),
|
|
291
323
|
disabled: $props.loading
|
|
292
324
|
}, {
|
|
293
325
|
default: withCtx(() => [
|