@conduction/nextcloud-vue 2.155.0 → 2.157.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/CnBannerWidget/CnBannerWidget.vue.js +1 -1
- package/dist/esm/components/CnBannerWidget/CnBannerWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnBannerWidget/CnBannerWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue.js +1 -1
- package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.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/CnDeviceFramesWidget/CnDeviceFramesWidget.vue.js +1 -1
- package/dist/esm/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnDuplicateWarning/CnDuplicateWarning.vue.js +1 -1
- package/dist/esm/components/CnDuplicateWarning/CnDuplicateWarning.vue2.js +2 -1
- package/dist/esm/components/CnDuplicateWarning/CnDuplicateWarning.vue2.js.map +1 -1
- package/dist/esm/components/CnDuplicateWarning/CnDuplicateWarning.vue3.js +10 -3
- package/dist/esm/components/CnDuplicateWarning/CnDuplicateWarning.vue3.js.map +1 -1
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue.js +1 -1
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue2.js +14 -4
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue3.js +3 -3
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnFeaturesBoard/CnFeaturesBoard.vue.js +1 -1
- package/dist/esm/components/CnFeaturesBoard/CnFeaturesBoard.vue2.js.map +1 -1
- package/dist/esm/components/CnFeaturesBoard/CnFeaturesBoard.vue3.js.map +1 -1
- package/dist/esm/components/CnFormDialog/CnFormDialog.vue.js +1 -1
- package/dist/esm/components/CnFormDialog/CnFormDialog.vue2.js.map +1 -1
- package/dist/esm/components/CnFormDialog/CnFormDialog.vue3.js +2 -1
- package/dist/esm/components/CnFormDialog/CnFormDialog.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/CnMailTab/CnMailTab.vue.js +1 -1
- package/dist/esm/components/CnMailTab/CnMailTab.vue2.js +4 -4
- package/dist/esm/components/CnMailTab/CnMailTab.vue2.js.map +1 -1
- package/dist/esm/components/CnMailTab/CnMailTab.vue3.js.map +1 -1
- package/dist/esm/components/CnNotificationMatrix/CnNotificationMatrix.vue.js +1 -1
- package/dist/esm/components/CnNotificationMatrix/CnNotificationMatrix.vue2.js +3 -0
- package/dist/esm/components/CnNotificationMatrix/CnNotificationMatrix.vue2.js.map +1 -1
- package/dist/esm/components/CnNotificationMatrix/CnNotificationMatrix.vue3.js +10 -2
- package/dist/esm/components/CnNotificationMatrix/CnNotificationMatrix.vue3.js.map +1 -1
- package/dist/esm/components/CnPartyPicker/CnPartyPicker.vue.js +1 -1
- package/dist/esm/components/CnPartyPicker/CnPartyPicker.vue2.js +6 -0
- package/dist/esm/components/CnPartyPicker/CnPartyPicker.vue2.js.map +1 -1
- package/dist/esm/components/CnPartyPicker/CnPartyPicker.vue3.js +2 -1
- package/dist/esm/components/CnPartyPicker/CnPartyPicker.vue3.js.map +1 -1
- package/dist/esm/components/CnSavedViewLookFields/CnSavedViewLookFields.vue.js +1 -1
- package/dist/esm/components/CnSavedViewLookFields/CnSavedViewLookFields.vue2.js.map +1 -1
- package/dist/esm/components/CnSavedViewLookFields/CnSavedViewLookFields.vue3.js +27 -24
- package/dist/esm/components/CnSavedViewLookFields/CnSavedViewLookFields.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/CnSearchSelect/CnSearchSelect.vue.js +1 -1
- package/dist/esm/components/CnSearchSelect/CnSearchSelect.vue2.js.map +1 -1
- package/dist/esm/components/CnSearchSelect/CnSearchSelect.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/CnStagesWidget/CnStagesWidget.vue.js +1 -1
- package/dist/esm/components/CnStagesWidget/CnStagesWidget.vue2.js +4 -1
- package/dist/esm/components/CnStagesWidget/CnStagesWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnStagesWidget/CnStagesWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnStagesWidget/stagesModel.js +10 -2
- package/dist/esm/components/CnStagesWidget/stagesModel.js.map +1 -1
- package/dist/esm/components/CnTimelineWidget/CnTimelineManage.vue.js +1 -1
- package/dist/esm/components/CnTimelineWidget/CnTimelineManage.vue2.js +61 -2
- package/dist/esm/components/CnTimelineWidget/CnTimelineManage.vue2.js.map +1 -1
- package/dist/esm/components/CnTimelineWidget/CnTimelineManage.vue3.js +68 -44
- package/dist/esm/components/CnTimelineWidget/CnTimelineManage.vue3.js.map +1 -1
- package/dist/esm/integrations/builtin/email/CnEmailTab.vue.js +1 -1
- package/dist/esm/integrations/builtin/email/CnEmailTab.vue2.js +13 -3
- package/dist/esm/integrations/builtin/email/CnEmailTab.vue2.js.map +1 -1
- package/dist/esm/integrations/builtin/email/CnEmailTab.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 +777 -469
- package/dist/esm/utils/dynamicProperties.js +14 -2
- package/dist/esm/utils/dynamicProperties.js.map +1 -1
- package/dist/nextcloud-vue.cjs.js +2472 -2120
- package/dist/nextcloud-vue.cjs.js.map +2 -2
- package/dist/nextcloud-vue.css +777 -469
- 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/CnBannerWidget/CnBannerWidget.vue +5 -1
- package/src/components/CnChecklistRunWidget/CnChecklistRunWidget.vue +12 -5
- package/src/components/CnCountdownWidget/CnCountdownWidget.vue +12 -0
- package/src/components/CnDashboardPage/CnDashboardPage.vue +3 -1
- package/src/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue +1 -0
- package/src/components/CnDuplicateWarning/CnDuplicateWarning.vue +8 -4
- package/src/components/CnFactsWidget/CnFactsWidget.vue +31 -6
- package/src/components/CnFeaturesBoard/CnFeaturesBoard.vue +4 -2
- package/src/components/CnFormDialog/CnFormDialog.vue +1 -0
- package/src/components/CnIndexSidebar/CnIndexSidebar.vue +13 -4
- package/src/components/CnLinkedWidget/CnLinkedWidget.vue +91 -7
- package/src/components/CnMailTab/CnMailTab.vue +4 -4
- package/src/components/CnNotificationMatrix/CnNotificationMatrix.vue +20 -0
- package/src/components/CnPartyPicker/CnPartyPicker.vue +7 -0
- package/src/components/CnSavedViewLookFields/CnSavedViewLookFields.vue +27 -20
- package/src/components/CnSchemaFormDialog/CnSchemaConfigurationTab.vue +42 -0
- package/src/components/CnSchemaFormDialog/CnSchemaFormDialog.vue +10 -0
- package/src/components/CnSearchSelect/CnSearchSelect.vue +3 -1
- package/src/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue +37 -1
- package/src/components/CnStagesWidget/CnStagesWidget.vue +4 -1
- package/src/components/CnStagesWidget/stagesModel.js +10 -2
- package/src/components/CnTimelineWidget/CnTimelineManage.vue +69 -4
- package/src/css/dialog.css +33 -0
- package/src/css/look-board-detail.css +4 -3
- package/src/css/look-board-index.css +34 -3
- package/src/css/look-board.css +181 -4
- package/src/integrations/builtin/email/CnEmailTab.vue +13 -3
- package/src/utils/dynamicProperties.js +13 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CnPartyPicker.vue2.js","sources":["../../../../src/components/CnPartyPicker/CnPartyPicker.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n<template>\n\t<div class=\"cn-party-picker\">\n\t\t<CnSearchSelect\n\t\t\t:modelValue=\"selectedOption\"\n\t\t\t:options=\"options\"\n\t\t\t:inputLabel=\"inputLabel\"\n\t\t\t:labelOutside=\"labelOutside\"\n\t\t\t:placeholder=\"placeholder ? cnTranslate(placeholder) : ''\"\n\t\t\t:loading=\"searching\"\n\t\t\t:filterable=\"false\"\n\t\t\t:clearable=\"clearable\"\n\t\t\t:disabled=\"disabled\"\n\t\t\tdata-testid=\"cn-party-picker\"\n\t\t\t@search=\"onSearch\"\n\t\t\t@update:modelValue=\"onPick\" />\n\t\t<p v-if=\"refusal\"\n\t\t\tclass=\"cn-party-picker__refusal\"\n\t\t\trole=\"alert\"\n\t\t\tdata-testid=\"cn-party-picker-refusal\">\n\t\t\t{{ t('nextcloud-vue', 'This search could not be read.') }} {{ refusal }}\n\t\t</p>\n\t\t<p v-for=\"name in unavailable\"\n\t\t\t:key=\"name\"\n\t\t\tclass=\"cn-party-picker__unavailable\"\n\t\t\trole=\"status\"\n\t\t\tdata-testid=\"cn-party-picker-unavailable\">\n\t\t\t{{ t('nextcloud-vue', '{source} could not be searched, so this list may be incomplete.', { source: name }) }}\n\t\t</p>\n\t</div>\n</template>\n\n<script>\nimport axios from '@nextcloud/axios'\nimport { translate as t } from '@nextcloud/l10n'\nimport { generateUrl } from '@nextcloud/router'\nimport { fillTemplate } from '../../utils/fillTemplate.js'\nimport { CnSearchSelect } from '../CnSearchSelect/index.js'\n\n/** How long typing rests before a search runs, in ms. */\nconst SEARCH_DELAY = 250\n\n/**\n * CnPartyPicker — one search field over several kinds of party: people and\n * organisations from OpenRegister register sets (BRP persons, KvK companies,\n * an app's own clients) and the reader's Nextcloud contacts, as rows with\n * initials, the name and a second line, in one list (board DqNieuweZaak\n * \"Aanvrager\": \"Henk Visser · Inwoner · Beukenlaan 3\", \"Visser Bouw B.V. ·\n * Organisatie · KvK …\"). Built on CnSearchSelect.\n *\n * `sources`: each `{ id, register, schema, label?, title?, secondary?,\n * limit?, icon?, lookup? }` searches OpenRegister with `_search`; `lookup`\n * (`{ url, when }`) sends a term matching `when` to the app's exact lookup\n * instead (a POST of `{ term }` answering `{ results }`); `title` and\n * `secondary` are templates filled from the row (default `{name}` / none),\n * `label` names the kind (\"Resident\") and starts the second line; `label`\n * and `secondary` go through the host translate, so a manifest can write\n * `\"CoC {kvkNumber}\"` and a Dutch reader sees \"KvK 24157431\". A source\n * `{ id, type: \"contacts\", label? }` searches the reader's Nextcloud contacts.\n *\n * `update:modelValue` emits the chosen row's id (a contact has none and\n * emits its contact id); `select` emits the whole choice: `{ source, id,\n * label, secondary, row }`, so a host can store more than the id (a case's\n * initiator type, source id and display name). A `modelValue` the list does\n * not hold is shown by its `selectedLabel`, else looked up by id in the\n * OpenRegister sources.\n *\n * ```vue\n * <CnPartyPicker\n * v-model=\"case.requester\"\n * input-label=\"Requester\"\n * :sources=\"[\n * { id: 'person', register: 'dossiq', schema: 'brpPerson', label: 'Resident', title: '{firstName} {lastName}', secondary: '{residence.street} {residence.houseNumber}' },\n * { id: 'company', register: 'dossiq', schema: 'kvkCompany', label: 'Organisation', title: '{tradeName}', secondary: 'KvK {sourceId}' },\n * { id: 'contact', type: 'contacts', label: 'Contact' },\n * ]\"\n * @select=\"onRequester\" />\n * ```\n */\nexport default {\n\tname: 'CnPartyPicker',\n\n\tcomponents: { CnSearchSelect },\n\n\tinject: {\n\t\t/** The host app's translate (CnAppRoot `cnTranslate`). */\n\t\tcnTranslate: { default: () => (key) => key },\n\t},\n\n\tprops: {\n\t\t/** The chosen party's id. */\n\t\tmodelValue: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/**\n\t\t * Where to search: OpenRegister sets `{ id, register, schema, label?,\n\t\t * title?, secondary?, limit?, icon? }`, or `{ id, type: \"contacts\",\n\t\t * label? }` for the reader's Nextcloud contacts.\n\t\t *\n\t\t * @type {Array<object>}\n\t\t */\n\t\tsources: {\n\t\t\ttype: Array,\n\t\t\tdefault: () => [],\n\t\t},\n\n\t\t/** The field's label. */\n\t\tinputLabel: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** Draw the label above the field. */\n\t\tlabelOutside: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\n\t\t/** Placeholder (\"Name, BSN, trade name or KvK number\"), through the host translate. */\n\t\tplaceholder: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** The chosen party's name, shown before the list holds it. */\n\t\tselectedLabel: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** Offer a clear button. */\n\t\tclearable: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: true,\n\t\t},\n\n\t\t/** Disable the field. */\n\t\tdisabled: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\n\t\t/** The fewest characters a search needs. */\n\t\tminLength: {\n\t\t\ttype: Number,\n\t\t\tdefault: 2,\n\t\t},\n\t},\n\n\temits: ['update:modelValue', 'select'],\n\n\tdata() {\n\t\treturn {\n\t\t\toptions: [],\n\t\t\tsearching: false,\n\t\t\tknown: null,\n\t\t\ttimer: null,\n\t\t\tsearchSeq: 0,\n\t\t\trefusal: '',\n\t\t\tunavailable: [],\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * The option for `modelValue`: in the list, else the known choice,\n\t\t * else one named by `selectedLabel`.\n\t\t *\n\t\t * @spec openspec/changes/party-picker/specs/party-picker/spec.md#requirement-one-search-field-over-several-kinds-of-party\n\t\t * @return {object|null}\n\t\t */\n\t\tselectedOption() {\n\t\t\tconst value = this.modelValue\n\t\t\tif (value === null || value === undefined || value === '') {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst found = this.options.find((o) => String(o.id) === String(value))\n\t\t\tif (found) {\n\t\t\t\treturn found\n\t\t\t}\n\t\t\tif (this.known && String(this.known.id) === String(value)) {\n\t\t\t\treturn this.known\n\t\t\t}\n\t\t\treturn { id: value, label: this.selectedLabel || String(value), avatar: true }\n\t\t},\n\t},\n\n\twatch: {\n\t\tmodelValue: {\n\t\t\timmediate: true,\n\t\t\thandler(value) {\n\t\t\t\tif (value && !this.selectedLabel && !this.options.some((o) => String(o.id) === String(value))) {\n\t\t\t\t\tthis.lookUp(value)\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t},\n\n\tbeforeUnmount() {\n\t\tclearTimeout(this.timer)\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * A source's row as a picker option.\n\t\t *\n\t\t * @param {object} source The source.\n\t\t * @param {object} row The row.\n\t\t * @return {object|null} The option, or null without an id.\n\t\t */\n\t\toptionOf(source, row) {\n\t\t\tconst id = row && (row.id ?? row['@self']?.id ?? row.uuid)\n\t\t\tif (id === undefined || id === null || id === '') {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst title = (source.title ? fillTemplate(source.title, row) : (row.name || row.title || row.displayName || '')).trim() || String(id)\n\t\t\tconst detail = source.secondary ? fillTemplate(this.cnTranslate(source.secondary), row).trim() : ''\n\t\t\tconst kind = source.label ? this.cnTranslate(source.label) : ''\n\t\t\treturn {\n\t\t\t\tid,\n\t\t\t\tlabel: title,\n\t\t\t\tsecondary: [kind, detail].filter(Boolean).join(' · '),\n\t\t\t\tavatar: !source.icon,\n\t\t\t\ticon: source.icon || '',\n\t\t\t\tsource: source.id,\n\t\t\t\trow,\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * A Nextcloud contact as a picker option.\n\t\t *\n\t\t * @param {object} source The contacts source.\n\t\t * @param {object} contact The contactsmenu entry.\n\t\t * @return {object|null}\n\t\t */\n\t\tcontactOptionOf(source, contact) {\n\t\t\tconst id = contact && (contact.id || contact.uid)\n\t\t\tif (!id) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst mail = Array.isArray(contact.emailAddresses) ? contact.emailAddresses[0] : ''\n\t\t\tconst kind = source.label ? this.cnTranslate(source.label) : ''\n\t\t\treturn { id, label: contact.fullName || String(id), secondary: [kind, mail].filter(Boolean).join(' · '), avatar: true, source: source.id, row: contact }\n\t\t},\n\n\t\t/**\n\t\t * Search after typing rests.\n\t\t *\n\t\t * @param {string} query The typed text.\n\t\t */\n\t\tonSearch(query) {\n\t\t\tclearTimeout(this.timer)\n\t\t\tconst term = String(query || '').trim()\n\t\t\tif (term.length < this.minLength) {\n\t\t\t\tthis.options = this.selectedOption ? [this.selectedOption] : []\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.timer = setTimeout(() => this.search(term), SEARCH_DELAY)\n\t\t},\n\n\t\t/**\n\t\t * Search every source at once. A term a source refused (400) is said\n\t\t * under the field in its words; a source that could not be searched at\n\t\t * all is named, so an empty list never hides a missing source.\n\t\t *\n\t\t * @spec openspec/changes/party-picker/specs/party-picker/spec.md#requirement-one-search-field-over-several-kinds-of-party\n\t\t * @param {string} term The search term.\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync search(term) {\n\t\t\tconst seq = ++this.searchSeq\n\t\t\tthis.searching = true\n\t\t\tlet refusal = ''\n\t\t\tconst unavailable = []\n\t\t\tconst sets = await Promise.all((this.sources || []).map(async (source) => {\n\t\t\t\ttry {\n\t\t\t\t\tif (source.type === 'contacts') {\n\t\t\t\t\t\tconst { data } = await axios.post(generateUrl('/contactsmenu/contacts'), { filter: term })\n\t\t\t\t\t\treturn (data && Array.isArray(data.contacts) ? data.contacts : []).map((c) => this.contactOptionOf(source, c))\n\t\t\t\t\t}\n\t\t\t\t\tif (this.isExactLookup(source, term) === true) {\n\t\t\t\t\t\tconst { data } = await axios.post(generateUrl(source.lookup.url), { term })\n\t\t\t\t\t\treturn (data && Array.isArray(data.results) ? data.results : []).map((row) => this.optionOf(source, row))\n\t\t\t\t\t}\n\t\t\t\t\tif (!source.register || !source.schema) {\n\t\t\t\t\t\treturn []\n\t\t\t\t\t}\n\t\t\t\t\tconst { data } = await axios.get(generateUrl(`/apps/openregister/api/objects/${source.register}/${source.schema}`), { params: { _search: term, _limit: source.limit || 8 } })\n\t\t\t\t\treturn (data && Array.isArray(data.results) ? data.results : []).map((row) => this.optionOf(source, row))\n\t\t\t\t} catch (failure) {\n\t\t\t\t\t// OpenRegister refuses a term it cannot parse with a 400 rather\n\t\t\t\t\t// than answering nothing, so that refusal is said, not hidden.\n\t\t\t\t\tconst response = failure && failure.response\n\t\t\t\t\tif (response && response.status === 400) {\n\t\t\t\t\t\tconst body = response.data\n\t\t\t\t\t\trefusal = String((body && (body.message || body.error)) || (typeof body === 'string' ? body : '') || refusal)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tunavailable.push(source.label ? this.cnTranslate(source.label) : String(source.id || ''))\n\t\t\t\t\t}\n\t\t\t\t\treturn []\n\t\t\t\t}\n\t\t\t}))\n\t\t\tif (seq !== this.searchSeq) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.options = sets.flat().filter(Boolean)\n\t\t\tthis.refusal = refusal\n\t\t\tthis.unavailable = unavailable.filter(Boolean)\n\t\t\tthis.searching = false\n\t\t},\n\n\t\t/**\n\t\t * Whether a typed term goes to the source's exact lookup instead of the\n\t\t * free-text search: `source.lookup` is `{ url, when }`, `when` a regular\n\t\t * expression the whole term must match (\"^[0-9]{9}$\" for a BSN). The\n\t\t * lookup is a POST, so the term never sits in a URL or a server log line,\n\t\t * and the app behind it may check and record who looked whom up.\n\t\t *\n\t\t * @param {object} source The source.\n\t\t * @param {string} term The typed term.\n\t\t * @return {boolean}\n\t\t * @spec openspec/changes/party-picker-exact-lookup/specs/party-picker/spec.md#requirement-a-party-source-can-look-a-term-up-exactly\n\t\t */\n\t\tisExactLookup(source, term) {\n\t\t\tconst lookup = source && source.lookup\n\t\t\tif (!lookup || typeof lookup.url !== 'string' || lookup.url === '' || typeof lookup.when !== 'string') {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\ttry {\n\t\t\t\treturn new RegExp(lookup.when).test(term)\n\t\t\t} catch {\n\t\t\t\treturn false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Name a value the list does not hold: the first OpenRegister source\n\t\t * that has an object with that id.\n\t\t *\n\t\t * @param {string|number} id The id.\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync lookUp(id) {\n\t\t\tfor (const source of (this.sources || []).filter((s) => s.register && s.schema && s.type !== 'contacts')) {\n\t\t\t\ttry {\n\t\t\t\t\tconst { data } = await axios.get(generateUrl(`/apps/openregister/api/objects/${source.register}/${source.schema}/${encodeURIComponent(id)}`))\n\t\t\t\t\tconst option = data ? this.optionOf(source, data) : null\n\t\t\t\t\tif (option && String(this.modelValue) === String(id)) {\n\t\t\t\t\t\tthis.known = option\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t} catch {\n\t\t\t\t\t// Not in this source; try the next.\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Take the picked option: emit its id and the whole choice.\n\t\t *\n\t\t * @param {string|number|null} id The picked id.\n\t\t */\n\t\tonPick(id) {\n\t\t\tconst option = id === null ? null : this.options.find((o) => String(o.id) === String(id)) || null\n\t\t\tif (option) {\n\t\t\t\tthis.known = option\n\t\t\t}\n\t\t\t/** @event update:modelValue The chosen party's id, or null when cleared. */\n\t\t\tthis.$emit('update:modelValue', id)\n\t\t\t/** @event select The whole choice: `{ source, id, label, secondary, row }`, or null when cleared. */\n\t\t\tthis.$emit('select', option ? { source: option.source, id: option.id, label: option.label, secondary: option.secondary, row: option.row } : null)\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-party-picker__refusal {\n\tmargin: 4px 0 0;\n\tcolor: var(--color-error-text, var(--color-error));\n}\n\n.cn-party-picker__unavailable {\n\tmargin: 4px 0 0;\n\tcolor: var(--color-text-maxcontrast);\n}\n</style>\n"],"names":["CnSearchSelect","t","axios"],"mappings":";;;;;;AA0CA;AACA,MAAM,YAAa,GAAE,IAAE;;AAEvB;;AAEC;;;;AAIA;AACA;;AAEA;;;AAGA;;;;AAIA;AACA;;;;AAIA;;AAEA;AACA;AACA;AACA;;;;AAIA;;;AAGA;;AAEA;;AAED,aAAe;AACd,CAAA,IAAI,EAAE,eAAe;;CAErB,UAAU,EAAE,kBAAEA,UAAa,EAAG;;AAE9B,CAAA,MAAM,EAAE;;AAEP,EAAA,WAAW,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,KAAK,KAAK;EAC5C;;AAED,CAAA,KAAK,EAAE;;EAEN,UAAU,EAAE;AACX,GAAA,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;GACtB,OAAO,EAAE,IAAI;GACb;;AAED;;;AAGC;AACA;AACA;;AAED,EAAA,OAAO,EAAE;GACR,IAAI,EAAE,KAAK;AACX,GAAA,OAAO,EAAE,MAAM,EAAE;GACjB;;AAED;EACA,UAAU,EAAE;GACX,IAAI,EAAE,MAAM;GACZ,OAAO,EAAE,EAAE;GACX;;AAED;EACA,YAAY,EAAE;GACb,IAAI,EAAE,OAAO;GACb,OAAO,EAAE,KAAK;GACd;;AAED;EACA,WAAW,EAAE;GACZ,IAAI,EAAE,MAAM;GACZ,OAAO,EAAE,EAAE;GACX;;;AAGD,EAAA,aAAa,EAAE;GACd,IAAI,EAAE,MAAM;GACZ,OAAO,EAAE,EAAE;GACX;;;EAGD,SAAS,EAAE;GACV,IAAI,EAAE,OAAO;GACb,OAAO,EAAE,IAAI;GACb;;AAED;AACA,EAAA,QAAQ,EAAE;GACT,IAAI,EAAE,OAAO;GACb,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MAAM,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,GAAG,EAAE,MAAM,CAAC,GAAE,EAAI,GAAE,IAAI,EAAA;GAChJ;EACD;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"CnPartyPicker.vue2.js","sources":["../../../../src/components/CnPartyPicker/CnPartyPicker.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n<template>\n\t<div class=\"cn-party-picker\">\n\t\t<CnSearchSelect\n\t\t\t:inputId=\"inputId\"\n\t\t\t:modelValue=\"selectedOption\"\n\t\t\t:options=\"options\"\n\t\t\t:inputLabel=\"inputLabel\"\n\t\t\t:labelOutside=\"labelOutside\"\n\t\t\t:placeholder=\"placeholder ? cnTranslate(placeholder) : ''\"\n\t\t\t:loading=\"searching\"\n\t\t\t:filterable=\"false\"\n\t\t\t:clearable=\"clearable\"\n\t\t\t:disabled=\"disabled\"\n\t\t\tdata-testid=\"cn-party-picker\"\n\t\t\t@search=\"onSearch\"\n\t\t\t@update:modelValue=\"onPick\" />\n\t\t<p v-if=\"refusal\"\n\t\t\tclass=\"cn-party-picker__refusal\"\n\t\t\trole=\"alert\"\n\t\t\tdata-testid=\"cn-party-picker-refusal\">\n\t\t\t{{ t('nextcloud-vue', 'This search could not be read.') }} {{ refusal }}\n\t\t</p>\n\t\t<p v-for=\"name in unavailable\"\n\t\t\t:key=\"name\"\n\t\t\tclass=\"cn-party-picker__unavailable\"\n\t\t\trole=\"status\"\n\t\t\tdata-testid=\"cn-party-picker-unavailable\">\n\t\t\t{{ t('nextcloud-vue', '{source} could not be searched, so this list may be incomplete.', { source: name }) }}\n\t\t</p>\n\t</div>\n</template>\n\n<script>\nimport axios from '@nextcloud/axios'\nimport { translate as t } from '@nextcloud/l10n'\nimport { generateUrl } from '@nextcloud/router'\nimport { fillTemplate } from '../../utils/fillTemplate.js'\nimport { CnSearchSelect } from '../CnSearchSelect/index.js'\n\n/** How long typing rests before a search runs, in ms. */\nconst SEARCH_DELAY = 250\n\n/**\n * CnPartyPicker — one search field over several kinds of party: people and\n * organisations from OpenRegister register sets (BRP persons, KvK companies,\n * an app's own clients) and the reader's Nextcloud contacts, as rows with\n * initials, the name and a second line, in one list (board DqNieuweZaak\n * \"Aanvrager\": \"Henk Visser · Inwoner · Beukenlaan 3\", \"Visser Bouw B.V. ·\n * Organisatie · KvK …\"). Built on CnSearchSelect.\n *\n * `sources`: each `{ id, register, schema, label?, title?, secondary?,\n * limit?, icon?, lookup? }` searches OpenRegister with `_search`; `lookup`\n * (`{ url, when }`) sends a term matching `when` to the app's exact lookup\n * instead (a POST of `{ term }` answering `{ results }`); `title` and\n * `secondary` are templates filled from the row (default `{name}` / none),\n * `label` names the kind (\"Resident\") and starts the second line; `label`\n * and `secondary` go through the host translate, so a manifest can write\n * `\"CoC {kvkNumber}\"` and a Dutch reader sees \"KvK 24157431\". A source\n * `{ id, type: \"contacts\", label? }` searches the reader's Nextcloud contacts.\n *\n * `update:modelValue` emits the chosen row's id (a contact has none and\n * emits its contact id); `select` emits the whole choice: `{ source, id,\n * label, secondary, row }`, so a host can store more than the id (a case's\n * initiator type, source id and display name). A `modelValue` the list does\n * not hold is shown by its `selectedLabel`, else looked up by id in the\n * OpenRegister sources.\n *\n * ```vue\n * <CnPartyPicker\n * v-model=\"case.requester\"\n * input-label=\"Requester\"\n * :sources=\"[\n * { id: 'person', register: 'dossiq', schema: 'brpPerson', label: 'Resident', title: '{firstName} {lastName}', secondary: '{residence.street} {residence.houseNumber}' },\n * { id: 'company', register: 'dossiq', schema: 'kvkCompany', label: 'Organisation', title: '{tradeName}', secondary: 'KvK {sourceId}' },\n * { id: 'contact', type: 'contacts', label: 'Contact' },\n * ]\"\n * @select=\"onRequester\" />\n * ```\n */\nexport default {\n\tname: 'CnPartyPicker',\n\n\tcomponents: { CnSearchSelect },\n\n\tinject: {\n\t\t/** The host app's translate (CnAppRoot `cnTranslate`). */\n\t\tcnTranslate: { default: () => (key) => key },\n\t},\n\n\tprops: {\n\t\t/** The search input's id, so the form's own label names it. */\n\t\tinputId: {\n\t\t\ttype: String,\n\t\t\tdefault: undefined,\n\t\t},\n\n\t\t/** The chosen party's id. */\n\t\tmodelValue: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/**\n\t\t * Where to search: OpenRegister sets `{ id, register, schema, label?,\n\t\t * title?, secondary?, limit?, icon? }`, or `{ id, type: \"contacts\",\n\t\t * label? }` for the reader's Nextcloud contacts.\n\t\t *\n\t\t * @type {Array<object>}\n\t\t */\n\t\tsources: {\n\t\t\ttype: Array,\n\t\t\tdefault: () => [],\n\t\t},\n\n\t\t/** The field's label. */\n\t\tinputLabel: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** Draw the label above the field. */\n\t\tlabelOutside: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\n\t\t/** Placeholder (\"Name, BSN, trade name or KvK number\"), through the host translate. */\n\t\tplaceholder: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** The chosen party's name, shown before the list holds it. */\n\t\tselectedLabel: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** Offer a clear button. */\n\t\tclearable: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: true,\n\t\t},\n\n\t\t/** Disable the field. */\n\t\tdisabled: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\n\t\t/** The fewest characters a search needs. */\n\t\tminLength: {\n\t\t\ttype: Number,\n\t\t\tdefault: 2,\n\t\t},\n\t},\n\n\temits: ['update:modelValue', 'select'],\n\n\tdata() {\n\t\treturn {\n\t\t\toptions: [],\n\t\t\tsearching: false,\n\t\t\tknown: null,\n\t\t\ttimer: null,\n\t\t\tsearchSeq: 0,\n\t\t\trefusal: '',\n\t\t\tunavailable: [],\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * The option for `modelValue`: in the list, else the known choice,\n\t\t * else one named by `selectedLabel`.\n\t\t *\n\t\t * @spec openspec/changes/party-picker/specs/party-picker/spec.md#requirement-one-search-field-over-several-kinds-of-party\n\t\t * @return {object|null}\n\t\t */\n\t\tselectedOption() {\n\t\t\tconst value = this.modelValue\n\t\t\tif (value === null || value === undefined || value === '') {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst found = this.options.find((o) => String(o.id) === String(value))\n\t\t\tif (found) {\n\t\t\t\treturn found\n\t\t\t}\n\t\t\tif (this.known && String(this.known.id) === String(value)) {\n\t\t\t\treturn this.known\n\t\t\t}\n\t\t\treturn { id: value, label: this.selectedLabel || String(value), avatar: true }\n\t\t},\n\t},\n\n\twatch: {\n\t\tmodelValue: {\n\t\t\timmediate: true,\n\t\t\thandler(value) {\n\t\t\t\tif (value && !this.selectedLabel && !this.options.some((o) => String(o.id) === String(value))) {\n\t\t\t\t\tthis.lookUp(value)\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t},\n\n\tbeforeUnmount() {\n\t\tclearTimeout(this.timer)\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * A source's row as a picker option.\n\t\t *\n\t\t * @param {object} source The source.\n\t\t * @param {object} row The row.\n\t\t * @return {object|null} The option, or null without an id.\n\t\t */\n\t\toptionOf(source, row) {\n\t\t\tconst id = row && (row.id ?? row['@self']?.id ?? row.uuid)\n\t\t\tif (id === undefined || id === null || id === '') {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst title = (source.title ? fillTemplate(source.title, row) : (row.name || row.title || row.displayName || '')).trim() || String(id)\n\t\t\tconst detail = source.secondary ? fillTemplate(this.cnTranslate(source.secondary), row).trim() : ''\n\t\t\tconst kind = source.label ? this.cnTranslate(source.label) : ''\n\t\t\treturn {\n\t\t\t\tid,\n\t\t\t\tlabel: title,\n\t\t\t\tsecondary: [kind, detail].filter(Boolean).join(' · '),\n\t\t\t\tavatar: !source.icon,\n\t\t\t\ticon: source.icon || '',\n\t\t\t\tsource: source.id,\n\t\t\t\trow,\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * A Nextcloud contact as a picker option.\n\t\t *\n\t\t * @param {object} source The contacts source.\n\t\t * @param {object} contact The contactsmenu entry.\n\t\t * @return {object|null}\n\t\t */\n\t\tcontactOptionOf(source, contact) {\n\t\t\tconst id = contact && (contact.id || contact.uid)\n\t\t\tif (!id) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst mail = Array.isArray(contact.emailAddresses) ? contact.emailAddresses[0] : ''\n\t\t\tconst kind = source.label ? this.cnTranslate(source.label) : ''\n\t\t\treturn { id, label: contact.fullName || String(id), secondary: [kind, mail].filter(Boolean).join(' · '), avatar: true, source: source.id, row: contact }\n\t\t},\n\n\t\t/**\n\t\t * Search after typing rests.\n\t\t *\n\t\t * @param {string} query The typed text.\n\t\t */\n\t\tonSearch(query) {\n\t\t\tclearTimeout(this.timer)\n\t\t\tconst term = String(query || '').trim()\n\t\t\tif (term.length < this.minLength) {\n\t\t\t\tthis.options = this.selectedOption ? [this.selectedOption] : []\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.timer = setTimeout(() => this.search(term), SEARCH_DELAY)\n\t\t},\n\n\t\t/**\n\t\t * Search every source at once. A term a source refused (400) is said\n\t\t * under the field in its words; a source that could not be searched at\n\t\t * all is named, so an empty list never hides a missing source.\n\t\t *\n\t\t * @spec openspec/changes/party-picker/specs/party-picker/spec.md#requirement-one-search-field-over-several-kinds-of-party\n\t\t * @param {string} term The search term.\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync search(term) {\n\t\t\tconst seq = ++this.searchSeq\n\t\t\tthis.searching = true\n\t\t\tlet refusal = ''\n\t\t\tconst unavailable = []\n\t\t\tconst sets = await Promise.all((this.sources || []).map(async (source) => {\n\t\t\t\ttry {\n\t\t\t\t\tif (source.type === 'contacts') {\n\t\t\t\t\t\tconst { data } = await axios.post(generateUrl('/contactsmenu/contacts'), { filter: term })\n\t\t\t\t\t\treturn (data && Array.isArray(data.contacts) ? data.contacts : []).map((c) => this.contactOptionOf(source, c))\n\t\t\t\t\t}\n\t\t\t\t\tif (this.isExactLookup(source, term) === true) {\n\t\t\t\t\t\tconst { data } = await axios.post(generateUrl(source.lookup.url), { term })\n\t\t\t\t\t\treturn (data && Array.isArray(data.results) ? data.results : []).map((row) => this.optionOf(source, row))\n\t\t\t\t\t}\n\t\t\t\t\tif (!source.register || !source.schema) {\n\t\t\t\t\t\treturn []\n\t\t\t\t\t}\n\t\t\t\t\tconst { data } = await axios.get(generateUrl(`/apps/openregister/api/objects/${source.register}/${source.schema}`), { params: { _search: term, _limit: source.limit || 8 } })\n\t\t\t\t\treturn (data && Array.isArray(data.results) ? data.results : []).map((row) => this.optionOf(source, row))\n\t\t\t\t} catch (failure) {\n\t\t\t\t\t// OpenRegister refuses a term it cannot parse with a 400 rather\n\t\t\t\t\t// than answering nothing, so that refusal is said, not hidden.\n\t\t\t\t\tconst response = failure && failure.response\n\t\t\t\t\tif (response && response.status === 400) {\n\t\t\t\t\t\tconst body = response.data\n\t\t\t\t\t\trefusal = String((body && (body.message || body.error)) || (typeof body === 'string' ? body : '') || refusal)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tunavailable.push(source.label ? this.cnTranslate(source.label) : String(source.id || ''))\n\t\t\t\t\t}\n\t\t\t\t\treturn []\n\t\t\t\t}\n\t\t\t}))\n\t\t\tif (seq !== this.searchSeq) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.options = sets.flat().filter(Boolean)\n\t\t\tthis.refusal = refusal\n\t\t\tthis.unavailable = unavailable.filter(Boolean)\n\t\t\tthis.searching = false\n\t\t},\n\n\t\t/**\n\t\t * Whether a typed term goes to the source's exact lookup instead of the\n\t\t * free-text search: `source.lookup` is `{ url, when }`, `when` a regular\n\t\t * expression the whole term must match (\"^[0-9]{9}$\" for a BSN). The\n\t\t * lookup is a POST, so the term never sits in a URL or a server log line,\n\t\t * and the app behind it may check and record who looked whom up.\n\t\t *\n\t\t * @param {object} source The source.\n\t\t * @param {string} term The typed term.\n\t\t * @return {boolean}\n\t\t * @spec openspec/changes/party-picker-exact-lookup/specs/party-picker/spec.md#requirement-a-party-source-can-look-a-term-up-exactly\n\t\t */\n\t\tisExactLookup(source, term) {\n\t\t\tconst lookup = source && source.lookup\n\t\t\tif (!lookup || typeof lookup.url !== 'string' || lookup.url === '' || typeof lookup.when !== 'string') {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\ttry {\n\t\t\t\treturn new RegExp(lookup.when).test(term)\n\t\t\t} catch {\n\t\t\t\treturn false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Name a value the list does not hold: the first OpenRegister source\n\t\t * that has an object with that id.\n\t\t *\n\t\t * @param {string|number} id The id.\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync lookUp(id) {\n\t\t\tfor (const source of (this.sources || []).filter((s) => s.register && s.schema && s.type !== 'contacts')) {\n\t\t\t\ttry {\n\t\t\t\t\tconst { data } = await axios.get(generateUrl(`/apps/openregister/api/objects/${source.register}/${source.schema}/${encodeURIComponent(id)}`))\n\t\t\t\t\tconst option = data ? this.optionOf(source, data) : null\n\t\t\t\t\tif (option && String(this.modelValue) === String(id)) {\n\t\t\t\t\t\tthis.known = option\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t} catch {\n\t\t\t\t\t// Not in this source; try the next.\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Take the picked option: emit its id and the whole choice.\n\t\t *\n\t\t * @param {string|number|null} id The picked id.\n\t\t */\n\t\tonPick(id) {\n\t\t\tconst option = id === null ? null : this.options.find((o) => String(o.id) === String(id)) || null\n\t\t\tif (option) {\n\t\t\t\tthis.known = option\n\t\t\t}\n\t\t\t/** @event update:modelValue The chosen party's id, or null when cleared. */\n\t\t\tthis.$emit('update:modelValue', id)\n\t\t\t/** @event select The whole choice: `{ source, id, label, secondary, row }`, or null when cleared. */\n\t\t\tthis.$emit('select', option ? { source: option.source, id: option.id, label: option.label, secondary: option.secondary, row: option.row } : null)\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-party-picker__refusal {\n\tmargin: 4px 0 0;\n\tcolor: var(--color-error-text, var(--color-error));\n}\n\n.cn-party-picker__unavailable {\n\tmargin: 4px 0 0;\n\tcolor: var(--color-text-maxcontrast);\n}\n</style>\n"],"names":["CnSearchSelect","t","axios"],"mappings":";;;;;;AA2CA;AACA,MAAM,YAAa,GAAE,IAAE;;AAEvB;;AAEC;;;;AAIA;AACA;;AAEA;;;AAGA;;;;AAIA;AACA;;;;AAIA;;AAEA;AACA;AACA;AACA;;;;AAIA;;;AAGA;;AAEA;;AAED,aAAe;AACd,CAAA,IAAI,EAAE,eAAe;;CAErB,UAAU,EAAE,kBAAEA,UAAa,EAAG;;AAE9B,CAAA,MAAM,EAAE;;AAEP,EAAA,WAAW,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,KAAK,KAAK;EAC5C;;AAED,CAAA,KAAK,EAAE;;AAEN,EAAA,OAAO,EAAE;GACR,IAAI,EAAE,MAAM;AACZ,GAAA,OAAO,EAAE,SAAS;GAClB;;;EAGD,UAAU,EAAE;AACX,GAAA,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;GACtB,OAAO,EAAE,IAAI;GACb;;AAED;;;AAGC;AACA;AACA;;AAED,EAAA,OAAO,EAAE;GACR,IAAI,EAAE,KAAK;AACX,GAAA,OAAO,EAAE,MAAM,EAAE;GACjB;;AAED;EACA,UAAU,EAAE;GACX,IAAI,EAAE,MAAM;GACZ,OAAO,EAAE,EAAE;GACX;;AAED;EACA,YAAY,EAAE;GACb,IAAI,EAAE,OAAO;GACb,OAAO,EAAE,KAAK;GACd;;AAED;EACA,WAAW,EAAE;GACZ,IAAI,EAAE,MAAM;GACZ,OAAO,EAAE,EAAE;GACX;;;AAGD,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AC,KAAK,CAAC,mBAAmB,EAAE,EAAE,EAAA;AAClC;AACA,GAAA,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,MAAO,GAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,GAAG,EAAE,MAAM,CAAC,GAAE,EAAI,GAAE,IAAI,EAAA;GAChJ;EACD;AACF;;;;"}
|
|
@@ -13,6 +13,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
13
13
|
|
|
14
14
|
return (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
15
15
|
createVNode(_component_CnSearchSelect, {
|
|
16
|
+
inputId: $props.inputId,
|
|
16
17
|
modelValue: $options.selectedOption,
|
|
17
18
|
options: $data.options,
|
|
18
19
|
inputLabel: $props.inputLabel,
|
|
@@ -25,7 +26,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
25
26
|
"data-testid": "cn-party-picker",
|
|
26
27
|
onSearch: $options.onSearch,
|
|
27
28
|
"onUpdate:modelValue": $options.onPick
|
|
28
|
-
}, null, 8 /* PROPS */, ["modelValue", "options", "inputLabel", "labelOutside", "placeholder", "loading", "clearable", "disabled", "onSearch", "onUpdate:modelValue"]),
|
|
29
|
+
}, null, 8 /* PROPS */, ["inputId", "modelValue", "options", "inputLabel", "labelOutside", "placeholder", "loading", "clearable", "disabled", "onSearch", "onUpdate:modelValue"]),
|
|
29
30
|
($data.refusal)
|
|
30
31
|
? (openBlock(), createElementBlock("p", _hoisted_2, toDisplayString($options.t('nextcloud-vue', 'This search could not be read.')) + " " + toDisplayString($data.refusal), 1 /* TEXT */))
|
|
31
32
|
: createCommentVNode("v-if", true),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CnPartyPicker.vue3.js","sources":["../../../../src/components/CnPartyPicker/CnPartyPicker.vue?vue&type=template&id=1b4d732c&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n<template>\n\t<div class=\"cn-party-picker\">\n\t\t<CnSearchSelect\n\t\t\t:modelValue=\"selectedOption\"\n\t\t\t:options=\"options\"\n\t\t\t:inputLabel=\"inputLabel\"\n\t\t\t:labelOutside=\"labelOutside\"\n\t\t\t:placeholder=\"placeholder ? cnTranslate(placeholder) : ''\"\n\t\t\t:loading=\"searching\"\n\t\t\t:filterable=\"false\"\n\t\t\t:clearable=\"clearable\"\n\t\t\t:disabled=\"disabled\"\n\t\t\tdata-testid=\"cn-party-picker\"\n\t\t\t@search=\"onSearch\"\n\t\t\t@update:modelValue=\"onPick\" />\n\t\t<p v-if=\"refusal\"\n\t\t\tclass=\"cn-party-picker__refusal\"\n\t\t\trole=\"alert\"\n\t\t\tdata-testid=\"cn-party-picker-refusal\">\n\t\t\t{{ t('nextcloud-vue', 'This search could not be read.') }} {{ refusal }}\n\t\t</p>\n\t\t<p v-for=\"name in unavailable\"\n\t\t\t:key=\"name\"\n\t\t\tclass=\"cn-party-picker__unavailable\"\n\t\t\trole=\"status\"\n\t\t\tdata-testid=\"cn-party-picker-unavailable\">\n\t\t\t{{ t('nextcloud-vue', '{source} could not be searched, so this list may be incomplete.', { source: name }) }}\n\t\t</p>\n\t</div>\n</template>\n\n<script>\nimport axios from '@nextcloud/axios'\nimport { translate as t } from '@nextcloud/l10n'\nimport { generateUrl } from '@nextcloud/router'\nimport { fillTemplate } from '../../utils/fillTemplate.js'\nimport { CnSearchSelect } from '../CnSearchSelect/index.js'\n\n/** How long typing rests before a search runs, in ms. */\nconst SEARCH_DELAY = 250\n\n/**\n * CnPartyPicker — one search field over several kinds of party: people and\n * organisations from OpenRegister register sets (BRP persons, KvK companies,\n * an app's own clients) and the reader's Nextcloud contacts, as rows with\n * initials, the name and a second line, in one list (board DqNieuweZaak\n * \"Aanvrager\": \"Henk Visser · Inwoner · Beukenlaan 3\", \"Visser Bouw B.V. ·\n * Organisatie · KvK …\"). Built on CnSearchSelect.\n *\n * `sources`: each `{ id, register, schema, label?, title?, secondary?,\n * limit?, icon?, lookup? }` searches OpenRegister with `_search`; `lookup`\n * (`{ url, when }`) sends a term matching `when` to the app's exact lookup\n * instead (a POST of `{ term }` answering `{ results }`); `title` and\n * `secondary` are templates filled from the row (default `{name}` / none),\n * `label` names the kind (\"Resident\") and starts the second line; `label`\n * and `secondary` go through the host translate, so a manifest can write\n * `\"CoC {kvkNumber}\"` and a Dutch reader sees \"KvK 24157431\". A source\n * `{ id, type: \"contacts\", label? }` searches the reader's Nextcloud contacts.\n *\n * `update:modelValue` emits the chosen row's id (a contact has none and\n * emits its contact id); `select` emits the whole choice: `{ source, id,\n * label, secondary, row }`, so a host can store more than the id (a case's\n * initiator type, source id and display name). A `modelValue` the list does\n * not hold is shown by its `selectedLabel`, else looked up by id in the\n * OpenRegister sources.\n *\n * ```vue\n * <CnPartyPicker\n * v-model=\"case.requester\"\n * input-label=\"Requester\"\n * :sources=\"[\n * { id: 'person', register: 'dossiq', schema: 'brpPerson', label: 'Resident', title: '{firstName} {lastName}', secondary: '{residence.street} {residence.houseNumber}' },\n * { id: 'company', register: 'dossiq', schema: 'kvkCompany', label: 'Organisation', title: '{tradeName}', secondary: 'KvK {sourceId}' },\n * { id: 'contact', type: 'contacts', label: 'Contact' },\n * ]\"\n * @select=\"onRequester\" />\n * ```\n */\nexport default {\n\tname: 'CnPartyPicker',\n\n\tcomponents: { CnSearchSelect },\n\n\tinject: {\n\t\t/** The host app's translate (CnAppRoot `cnTranslate`). */\n\t\tcnTranslate: { default: () => (key) => key },\n\t},\n\n\tprops: {\n\t\t/** The chosen party's id. */\n\t\tmodelValue: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/**\n\t\t * Where to search: OpenRegister sets `{ id, register, schema, label?,\n\t\t * title?, secondary?, limit?, icon? }`, or `{ id, type: \"contacts\",\n\t\t * label? }` for the reader's Nextcloud contacts.\n\t\t *\n\t\t * @type {Array<object>}\n\t\t */\n\t\tsources: {\n\t\t\ttype: Array,\n\t\t\tdefault: () => [],\n\t\t},\n\n\t\t/** The field's label. */\n\t\tinputLabel: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** Draw the label above the field. */\n\t\tlabelOutside: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\n\t\t/** Placeholder (\"Name, BSN, trade name or KvK number\"), through the host translate. */\n\t\tplaceholder: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** The chosen party's name, shown before the list holds it. */\n\t\tselectedLabel: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** Offer a clear button. */\n\t\tclearable: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: true,\n\t\t},\n\n\t\t/** Disable the field. */\n\t\tdisabled: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\n\t\t/** The fewest characters a search needs. */\n\t\tminLength: {\n\t\t\ttype: Number,\n\t\t\tdefault: 2,\n\t\t},\n\t},\n\n\temits: ['update:modelValue', 'select'],\n\n\tdata() {\n\t\treturn {\n\t\t\toptions: [],\n\t\t\tsearching: false,\n\t\t\tknown: null,\n\t\t\ttimer: null,\n\t\t\tsearchSeq: 0,\n\t\t\trefusal: '',\n\t\t\tunavailable: [],\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * The option for `modelValue`: in the list, else the known choice,\n\t\t * else one named by `selectedLabel`.\n\t\t *\n\t\t * @spec openspec/changes/party-picker/specs/party-picker/spec.md#requirement-one-search-field-over-several-kinds-of-party\n\t\t * @return {object|null}\n\t\t */\n\t\tselectedOption() {\n\t\t\tconst value = this.modelValue\n\t\t\tif (value === null || value === undefined || value === '') {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst found = this.options.find((o) => String(o.id) === String(value))\n\t\t\tif (found) {\n\t\t\t\treturn found\n\t\t\t}\n\t\t\tif (this.known && String(this.known.id) === String(value)) {\n\t\t\t\treturn this.known\n\t\t\t}\n\t\t\treturn { id: value, label: this.selectedLabel || String(value), avatar: true }\n\t\t},\n\t},\n\n\twatch: {\n\t\tmodelValue: {\n\t\t\timmediate: true,\n\t\t\thandler(value) {\n\t\t\t\tif (value && !this.selectedLabel && !this.options.some((o) => String(o.id) === String(value))) {\n\t\t\t\t\tthis.lookUp(value)\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t},\n\n\tbeforeUnmount() {\n\t\tclearTimeout(this.timer)\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * A source's row as a picker option.\n\t\t *\n\t\t * @param {object} source The source.\n\t\t * @param {object} row The row.\n\t\t * @return {object|null} The option, or null without an id.\n\t\t */\n\t\toptionOf(source, row) {\n\t\t\tconst id = row && (row.id ?? row['@self']?.id ?? row.uuid)\n\t\t\tif (id === undefined || id === null || id === '') {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst title = (source.title ? fillTemplate(source.title, row) : (row.name || row.title || row.displayName || '')).trim() || String(id)\n\t\t\tconst detail = source.secondary ? fillTemplate(this.cnTranslate(source.secondary), row).trim() : ''\n\t\t\tconst kind = source.label ? this.cnTranslate(source.label) : ''\n\t\t\treturn {\n\t\t\t\tid,\n\t\t\t\tlabel: title,\n\t\t\t\tsecondary: [kind, detail].filter(Boolean).join(' · '),\n\t\t\t\tavatar: !source.icon,\n\t\t\t\ticon: source.icon || '',\n\t\t\t\tsource: source.id,\n\t\t\t\trow,\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * A Nextcloud contact as a picker option.\n\t\t *\n\t\t * @param {object} source The contacts source.\n\t\t * @param {object} contact The contactsmenu entry.\n\t\t * @return {object|null}\n\t\t */\n\t\tcontactOptionOf(source, contact) {\n\t\t\tconst id = contact && (contact.id || contact.uid)\n\t\t\tif (!id) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst mail = Array.isArray(contact.emailAddresses) ? contact.emailAddresses[0] : ''\n\t\t\tconst kind = source.label ? this.cnTranslate(source.label) : ''\n\t\t\treturn { id, label: contact.fullName || String(id), secondary: [kind, mail].filter(Boolean).join(' · '), avatar: true, source: source.id, row: contact }\n\t\t},\n\n\t\t/**\n\t\t * Search after typing rests.\n\t\t *\n\t\t * @param {string} query The typed text.\n\t\t */\n\t\tonSearch(query) {\n\t\t\tclearTimeout(this.timer)\n\t\t\tconst term = String(query || '').trim()\n\t\t\tif (term.length < this.minLength) {\n\t\t\t\tthis.options = this.selectedOption ? [this.selectedOption] : []\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.timer = setTimeout(() => this.search(term), SEARCH_DELAY)\n\t\t},\n\n\t\t/**\n\t\t * Search every source at once. A term a source refused (400) is said\n\t\t * under the field in its words; a source that could not be searched at\n\t\t * all is named, so an empty list never hides a missing source.\n\t\t *\n\t\t * @spec openspec/changes/party-picker/specs/party-picker/spec.md#requirement-one-search-field-over-several-kinds-of-party\n\t\t * @param {string} term The search term.\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync search(term) {\n\t\t\tconst seq = ++this.searchSeq\n\t\t\tthis.searching = true\n\t\t\tlet refusal = ''\n\t\t\tconst unavailable = []\n\t\t\tconst sets = await Promise.all((this.sources || []).map(async (source) => {\n\t\t\t\ttry {\n\t\t\t\t\tif (source.type === 'contacts') {\n\t\t\t\t\t\tconst { data } = await axios.post(generateUrl('/contactsmenu/contacts'), { filter: term })\n\t\t\t\t\t\treturn (data && Array.isArray(data.contacts) ? data.contacts : []).map((c) => this.contactOptionOf(source, c))\n\t\t\t\t\t}\n\t\t\t\t\tif (this.isExactLookup(source, term) === true) {\n\t\t\t\t\t\tconst { data } = await axios.post(generateUrl(source.lookup.url), { term })\n\t\t\t\t\t\treturn (data && Array.isArray(data.results) ? data.results : []).map((row) => this.optionOf(source, row))\n\t\t\t\t\t}\n\t\t\t\t\tif (!source.register || !source.schema) {\n\t\t\t\t\t\treturn []\n\t\t\t\t\t}\n\t\t\t\t\tconst { data } = await axios.get(generateUrl(`/apps/openregister/api/objects/${source.register}/${source.schema}`), { params: { _search: term, _limit: source.limit || 8 } })\n\t\t\t\t\treturn (data && Array.isArray(data.results) ? data.results : []).map((row) => this.optionOf(source, row))\n\t\t\t\t} catch (failure) {\n\t\t\t\t\t// OpenRegister refuses a term it cannot parse with a 400 rather\n\t\t\t\t\t// than answering nothing, so that refusal is said, not hidden.\n\t\t\t\t\tconst response = failure && failure.response\n\t\t\t\t\tif (response && response.status === 400) {\n\t\t\t\t\t\tconst body = response.data\n\t\t\t\t\t\trefusal = String((body && (body.message || body.error)) || (typeof body === 'string' ? body : '') || refusal)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tunavailable.push(source.label ? this.cnTranslate(source.label) : String(source.id || ''))\n\t\t\t\t\t}\n\t\t\t\t\treturn []\n\t\t\t\t}\n\t\t\t}))\n\t\t\tif (seq !== this.searchSeq) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.options = sets.flat().filter(Boolean)\n\t\t\tthis.refusal = refusal\n\t\t\tthis.unavailable = unavailable.filter(Boolean)\n\t\t\tthis.searching = false\n\t\t},\n\n\t\t/**\n\t\t * Whether a typed term goes to the source's exact lookup instead of the\n\t\t * free-text search: `source.lookup` is `{ url, when }`, `when` a regular\n\t\t * expression the whole term must match (\"^[0-9]{9}$\" for a BSN). The\n\t\t * lookup is a POST, so the term never sits in a URL or a server log line,\n\t\t * and the app behind it may check and record who looked whom up.\n\t\t *\n\t\t * @param {object} source The source.\n\t\t * @param {string} term The typed term.\n\t\t * @return {boolean}\n\t\t * @spec openspec/changes/party-picker-exact-lookup/specs/party-picker/spec.md#requirement-a-party-source-can-look-a-term-up-exactly\n\t\t */\n\t\tisExactLookup(source, term) {\n\t\t\tconst lookup = source && source.lookup\n\t\t\tif (!lookup || typeof lookup.url !== 'string' || lookup.url === '' || typeof lookup.when !== 'string') {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\ttry {\n\t\t\t\treturn new RegExp(lookup.when).test(term)\n\t\t\t} catch {\n\t\t\t\treturn false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Name a value the list does not hold: the first OpenRegister source\n\t\t * that has an object with that id.\n\t\t *\n\t\t * @param {string|number} id The id.\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync lookUp(id) {\n\t\t\tfor (const source of (this.sources || []).filter((s) => s.register && s.schema && s.type !== 'contacts')) {\n\t\t\t\ttry {\n\t\t\t\t\tconst { data } = await axios.get(generateUrl(`/apps/openregister/api/objects/${source.register}/${source.schema}/${encodeURIComponent(id)}`))\n\t\t\t\t\tconst option = data ? this.optionOf(source, data) : null\n\t\t\t\t\tif (option && String(this.modelValue) === String(id)) {\n\t\t\t\t\t\tthis.known = option\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t} catch {\n\t\t\t\t\t// Not in this source; try the next.\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Take the picked option: emit its id and the whole choice.\n\t\t *\n\t\t * @param {string|number|null} id The picked id.\n\t\t */\n\t\tonPick(id) {\n\t\t\tconst option = id === null ? null : this.options.find((o) => String(o.id) === String(id)) || null\n\t\t\tif (option) {\n\t\t\t\tthis.known = option\n\t\t\t}\n\t\t\t/** @event update:modelValue The chosen party's id, or null when cleared. */\n\t\t\tthis.$emit('update:modelValue', id)\n\t\t\t/** @event select The whole choice: `{ source, id, label, secondary, row }`, or null when cleared. */\n\t\t\tthis.$emit('select', option ? { source: option.source, id: option.id, label: option.label, secondary: option.secondary, row: option.row } : null)\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-party-picker__refusal {\n\tmargin: 4px 0 0;\n\tcolor: var(--color-error-text, var(--color-error));\n}\n\n.cn-party-picker__unavailable {\n\tmargin: 4px 0 0;\n\tcolor: var(--color-text-maxcontrast);\n}\n</style>\n"],"names":["_toDisplayString","_createElementBlock"],"mappings":";;AASM,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,iBAAc,GAAA;;;AAevB,EAAA,KAAE,EAAA,0BAAA;AACF,EAAA,IAAI,EAAC,OAAO;AACZ,EAAA,aAAU,EAAA,yBAAA;;;;;;;eAJoB,CAAA,yBAAA,EAAA;AAX7B,MAAA,UAAU,EAAE,QAAa,CAAA,cAAA;AACzB,MAAA,OAAO,EAAE,KAAO,CAAA,OAAA;AAChB,MAAA,UAAU,EAAE,MAAK,CAAA,UAAA;AACjB,MAAA,YAAY,EAAE,MAAM,CAAA,YAAA;AACpB,MAAA,WAAW,EAAE,MAAA,CAAA,WAAK,GAAA,QAAA,CAAA,WAAA,CAAA,MAAA,CAAA,WAAA,CAAA,GAAA,EAAA;AAClB,MAAA,OAAO,EAAE,KAAS,CAAA,SAAA;AAClB,MAAA,UAAU,EAAE,KAAI;AAChB,MAAA,SAAS,EAAE,MAAS,CAAA,SAAA;AACnB,MAAA,QAAO,EAAE,MAAI,CAAA,QAAA;AACf,MAAA,aAAW,EAAC,iBAAiB;AAC5B,MAAA,QAAM,EAAE,QAAE,CAAA,QAAA;AACV,MAAA,qBAAiB,EAAE,QAAM,CAAA,MAAA;;KAClB,KAAO,CAAA,OAAA;yCAKZ,eAAA,EAAAA,eAAA,CADA,UAAC,CAA+B,eAAA,EAAA,gCAAA,CAAA,CAAA,GAAA,GAAA,mBAAA,KAAA,CAAA,OAAA,CAAA,EAAA,CAAA,YAAA;;sBAEnCC,8CAAiB,KAAW,CAAA,WAAA,EAAA,CAAnB,IAAI,KAAA;2BAAbA;AACC,QAAA,GAAG,EAAE,IAAI;AACV,QAAA,KAAE,EAAA,8BAAA;AACF,QAAA,IAAG,EAAA,QAAA;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"CnPartyPicker.vue3.js","sources":["../../../../src/components/CnPartyPicker/CnPartyPicker.vue?vue&type=template&id=4a9b14a6&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n<template>\n\t<div class=\"cn-party-picker\">\n\t\t<CnSearchSelect\n\t\t\t:inputId=\"inputId\"\n\t\t\t:modelValue=\"selectedOption\"\n\t\t\t:options=\"options\"\n\t\t\t:inputLabel=\"inputLabel\"\n\t\t\t:labelOutside=\"labelOutside\"\n\t\t\t:placeholder=\"placeholder ? cnTranslate(placeholder) : ''\"\n\t\t\t:loading=\"searching\"\n\t\t\t:filterable=\"false\"\n\t\t\t:clearable=\"clearable\"\n\t\t\t:disabled=\"disabled\"\n\t\t\tdata-testid=\"cn-party-picker\"\n\t\t\t@search=\"onSearch\"\n\t\t\t@update:modelValue=\"onPick\" />\n\t\t<p v-if=\"refusal\"\n\t\t\tclass=\"cn-party-picker__refusal\"\n\t\t\trole=\"alert\"\n\t\t\tdata-testid=\"cn-party-picker-refusal\">\n\t\t\t{{ t('nextcloud-vue', 'This search could not be read.') }} {{ refusal }}\n\t\t</p>\n\t\t<p v-for=\"name in unavailable\"\n\t\t\t:key=\"name\"\n\t\t\tclass=\"cn-party-picker__unavailable\"\n\t\t\trole=\"status\"\n\t\t\tdata-testid=\"cn-party-picker-unavailable\">\n\t\t\t{{ t('nextcloud-vue', '{source} could not be searched, so this list may be incomplete.', { source: name }) }}\n\t\t</p>\n\t</div>\n</template>\n\n<script>\nimport axios from '@nextcloud/axios'\nimport { translate as t } from '@nextcloud/l10n'\nimport { generateUrl } from '@nextcloud/router'\nimport { fillTemplate } from '../../utils/fillTemplate.js'\nimport { CnSearchSelect } from '../CnSearchSelect/index.js'\n\n/** How long typing rests before a search runs, in ms. */\nconst SEARCH_DELAY = 250\n\n/**\n * CnPartyPicker — one search field over several kinds of party: people and\n * organisations from OpenRegister register sets (BRP persons, KvK companies,\n * an app's own clients) and the reader's Nextcloud contacts, as rows with\n * initials, the name and a second line, in one list (board DqNieuweZaak\n * \"Aanvrager\": \"Henk Visser · Inwoner · Beukenlaan 3\", \"Visser Bouw B.V. ·\n * Organisatie · KvK …\"). Built on CnSearchSelect.\n *\n * `sources`: each `{ id, register, schema, label?, title?, secondary?,\n * limit?, icon?, lookup? }` searches OpenRegister with `_search`; `lookup`\n * (`{ url, when }`) sends a term matching `when` to the app's exact lookup\n * instead (a POST of `{ term }` answering `{ results }`); `title` and\n * `secondary` are templates filled from the row (default `{name}` / none),\n * `label` names the kind (\"Resident\") and starts the second line; `label`\n * and `secondary` go through the host translate, so a manifest can write\n * `\"CoC {kvkNumber}\"` and a Dutch reader sees \"KvK 24157431\". A source\n * `{ id, type: \"contacts\", label? }` searches the reader's Nextcloud contacts.\n *\n * `update:modelValue` emits the chosen row's id (a contact has none and\n * emits its contact id); `select` emits the whole choice: `{ source, id,\n * label, secondary, row }`, so a host can store more than the id (a case's\n * initiator type, source id and display name). A `modelValue` the list does\n * not hold is shown by its `selectedLabel`, else looked up by id in the\n * OpenRegister sources.\n *\n * ```vue\n * <CnPartyPicker\n * v-model=\"case.requester\"\n * input-label=\"Requester\"\n * :sources=\"[\n * { id: 'person', register: 'dossiq', schema: 'brpPerson', label: 'Resident', title: '{firstName} {lastName}', secondary: '{residence.street} {residence.houseNumber}' },\n * { id: 'company', register: 'dossiq', schema: 'kvkCompany', label: 'Organisation', title: '{tradeName}', secondary: 'KvK {sourceId}' },\n * { id: 'contact', type: 'contacts', label: 'Contact' },\n * ]\"\n * @select=\"onRequester\" />\n * ```\n */\nexport default {\n\tname: 'CnPartyPicker',\n\n\tcomponents: { CnSearchSelect },\n\n\tinject: {\n\t\t/** The host app's translate (CnAppRoot `cnTranslate`). */\n\t\tcnTranslate: { default: () => (key) => key },\n\t},\n\n\tprops: {\n\t\t/** The search input's id, so the form's own label names it. */\n\t\tinputId: {\n\t\t\ttype: String,\n\t\t\tdefault: undefined,\n\t\t},\n\n\t\t/** The chosen party's id. */\n\t\tmodelValue: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/**\n\t\t * Where to search: OpenRegister sets `{ id, register, schema, label?,\n\t\t * title?, secondary?, limit?, icon? }`, or `{ id, type: \"contacts\",\n\t\t * label? }` for the reader's Nextcloud contacts.\n\t\t *\n\t\t * @type {Array<object>}\n\t\t */\n\t\tsources: {\n\t\t\ttype: Array,\n\t\t\tdefault: () => [],\n\t\t},\n\n\t\t/** The field's label. */\n\t\tinputLabel: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** Draw the label above the field. */\n\t\tlabelOutside: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\n\t\t/** Placeholder (\"Name, BSN, trade name or KvK number\"), through the host translate. */\n\t\tplaceholder: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** The chosen party's name, shown before the list holds it. */\n\t\tselectedLabel: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** Offer a clear button. */\n\t\tclearable: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: true,\n\t\t},\n\n\t\t/** Disable the field. */\n\t\tdisabled: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\n\t\t/** The fewest characters a search needs. */\n\t\tminLength: {\n\t\t\ttype: Number,\n\t\t\tdefault: 2,\n\t\t},\n\t},\n\n\temits: ['update:modelValue', 'select'],\n\n\tdata() {\n\t\treturn {\n\t\t\toptions: [],\n\t\t\tsearching: false,\n\t\t\tknown: null,\n\t\t\ttimer: null,\n\t\t\tsearchSeq: 0,\n\t\t\trefusal: '',\n\t\t\tunavailable: [],\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * The option for `modelValue`: in the list, else the known choice,\n\t\t * else one named by `selectedLabel`.\n\t\t *\n\t\t * @spec openspec/changes/party-picker/specs/party-picker/spec.md#requirement-one-search-field-over-several-kinds-of-party\n\t\t * @return {object|null}\n\t\t */\n\t\tselectedOption() {\n\t\t\tconst value = this.modelValue\n\t\t\tif (value === null || value === undefined || value === '') {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst found = this.options.find((o) => String(o.id) === String(value))\n\t\t\tif (found) {\n\t\t\t\treturn found\n\t\t\t}\n\t\t\tif (this.known && String(this.known.id) === String(value)) {\n\t\t\t\treturn this.known\n\t\t\t}\n\t\t\treturn { id: value, label: this.selectedLabel || String(value), avatar: true }\n\t\t},\n\t},\n\n\twatch: {\n\t\tmodelValue: {\n\t\t\timmediate: true,\n\t\t\thandler(value) {\n\t\t\t\tif (value && !this.selectedLabel && !this.options.some((o) => String(o.id) === String(value))) {\n\t\t\t\t\tthis.lookUp(value)\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t},\n\n\tbeforeUnmount() {\n\t\tclearTimeout(this.timer)\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * A source's row as a picker option.\n\t\t *\n\t\t * @param {object} source The source.\n\t\t * @param {object} row The row.\n\t\t * @return {object|null} The option, or null without an id.\n\t\t */\n\t\toptionOf(source, row) {\n\t\t\tconst id = row && (row.id ?? row['@self']?.id ?? row.uuid)\n\t\t\tif (id === undefined || id === null || id === '') {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst title = (source.title ? fillTemplate(source.title, row) : (row.name || row.title || row.displayName || '')).trim() || String(id)\n\t\t\tconst detail = source.secondary ? fillTemplate(this.cnTranslate(source.secondary), row).trim() : ''\n\t\t\tconst kind = source.label ? this.cnTranslate(source.label) : ''\n\t\t\treturn {\n\t\t\t\tid,\n\t\t\t\tlabel: title,\n\t\t\t\tsecondary: [kind, detail].filter(Boolean).join(' · '),\n\t\t\t\tavatar: !source.icon,\n\t\t\t\ticon: source.icon || '',\n\t\t\t\tsource: source.id,\n\t\t\t\trow,\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * A Nextcloud contact as a picker option.\n\t\t *\n\t\t * @param {object} source The contacts source.\n\t\t * @param {object} contact The contactsmenu entry.\n\t\t * @return {object|null}\n\t\t */\n\t\tcontactOptionOf(source, contact) {\n\t\t\tconst id = contact && (contact.id || contact.uid)\n\t\t\tif (!id) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst mail = Array.isArray(contact.emailAddresses) ? contact.emailAddresses[0] : ''\n\t\t\tconst kind = source.label ? this.cnTranslate(source.label) : ''\n\t\t\treturn { id, label: contact.fullName || String(id), secondary: [kind, mail].filter(Boolean).join(' · '), avatar: true, source: source.id, row: contact }\n\t\t},\n\n\t\t/**\n\t\t * Search after typing rests.\n\t\t *\n\t\t * @param {string} query The typed text.\n\t\t */\n\t\tonSearch(query) {\n\t\t\tclearTimeout(this.timer)\n\t\t\tconst term = String(query || '').trim()\n\t\t\tif (term.length < this.minLength) {\n\t\t\t\tthis.options = this.selectedOption ? [this.selectedOption] : []\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.timer = setTimeout(() => this.search(term), SEARCH_DELAY)\n\t\t},\n\n\t\t/**\n\t\t * Search every source at once. A term a source refused (400) is said\n\t\t * under the field in its words; a source that could not be searched at\n\t\t * all is named, so an empty list never hides a missing source.\n\t\t *\n\t\t * @spec openspec/changes/party-picker/specs/party-picker/spec.md#requirement-one-search-field-over-several-kinds-of-party\n\t\t * @param {string} term The search term.\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync search(term) {\n\t\t\tconst seq = ++this.searchSeq\n\t\t\tthis.searching = true\n\t\t\tlet refusal = ''\n\t\t\tconst unavailable = []\n\t\t\tconst sets = await Promise.all((this.sources || []).map(async (source) => {\n\t\t\t\ttry {\n\t\t\t\t\tif (source.type === 'contacts') {\n\t\t\t\t\t\tconst { data } = await axios.post(generateUrl('/contactsmenu/contacts'), { filter: term })\n\t\t\t\t\t\treturn (data && Array.isArray(data.contacts) ? data.contacts : []).map((c) => this.contactOptionOf(source, c))\n\t\t\t\t\t}\n\t\t\t\t\tif (this.isExactLookup(source, term) === true) {\n\t\t\t\t\t\tconst { data } = await axios.post(generateUrl(source.lookup.url), { term })\n\t\t\t\t\t\treturn (data && Array.isArray(data.results) ? data.results : []).map((row) => this.optionOf(source, row))\n\t\t\t\t\t}\n\t\t\t\t\tif (!source.register || !source.schema) {\n\t\t\t\t\t\treturn []\n\t\t\t\t\t}\n\t\t\t\t\tconst { data } = await axios.get(generateUrl(`/apps/openregister/api/objects/${source.register}/${source.schema}`), { params: { _search: term, _limit: source.limit || 8 } })\n\t\t\t\t\treturn (data && Array.isArray(data.results) ? data.results : []).map((row) => this.optionOf(source, row))\n\t\t\t\t} catch (failure) {\n\t\t\t\t\t// OpenRegister refuses a term it cannot parse with a 400 rather\n\t\t\t\t\t// than answering nothing, so that refusal is said, not hidden.\n\t\t\t\t\tconst response = failure && failure.response\n\t\t\t\t\tif (response && response.status === 400) {\n\t\t\t\t\t\tconst body = response.data\n\t\t\t\t\t\trefusal = String((body && (body.message || body.error)) || (typeof body === 'string' ? body : '') || refusal)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tunavailable.push(source.label ? this.cnTranslate(source.label) : String(source.id || ''))\n\t\t\t\t\t}\n\t\t\t\t\treturn []\n\t\t\t\t}\n\t\t\t}))\n\t\t\tif (seq !== this.searchSeq) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.options = sets.flat().filter(Boolean)\n\t\t\tthis.refusal = refusal\n\t\t\tthis.unavailable = unavailable.filter(Boolean)\n\t\t\tthis.searching = false\n\t\t},\n\n\t\t/**\n\t\t * Whether a typed term goes to the source's exact lookup instead of the\n\t\t * free-text search: `source.lookup` is `{ url, when }`, `when` a regular\n\t\t * expression the whole term must match (\"^[0-9]{9}$\" for a BSN). The\n\t\t * lookup is a POST, so the term never sits in a URL or a server log line,\n\t\t * and the app behind it may check and record who looked whom up.\n\t\t *\n\t\t * @param {object} source The source.\n\t\t * @param {string} term The typed term.\n\t\t * @return {boolean}\n\t\t * @spec openspec/changes/party-picker-exact-lookup/specs/party-picker/spec.md#requirement-a-party-source-can-look-a-term-up-exactly\n\t\t */\n\t\tisExactLookup(source, term) {\n\t\t\tconst lookup = source && source.lookup\n\t\t\tif (!lookup || typeof lookup.url !== 'string' || lookup.url === '' || typeof lookup.when !== 'string') {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\ttry {\n\t\t\t\treturn new RegExp(lookup.when).test(term)\n\t\t\t} catch {\n\t\t\t\treturn false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Name a value the list does not hold: the first OpenRegister source\n\t\t * that has an object with that id.\n\t\t *\n\t\t * @param {string|number} id The id.\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync lookUp(id) {\n\t\t\tfor (const source of (this.sources || []).filter((s) => s.register && s.schema && s.type !== 'contacts')) {\n\t\t\t\ttry {\n\t\t\t\t\tconst { data } = await axios.get(generateUrl(`/apps/openregister/api/objects/${source.register}/${source.schema}/${encodeURIComponent(id)}`))\n\t\t\t\t\tconst option = data ? this.optionOf(source, data) : null\n\t\t\t\t\tif (option && String(this.modelValue) === String(id)) {\n\t\t\t\t\t\tthis.known = option\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t} catch {\n\t\t\t\t\t// Not in this source; try the next.\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Take the picked option: emit its id and the whole choice.\n\t\t *\n\t\t * @param {string|number|null} id The picked id.\n\t\t */\n\t\tonPick(id) {\n\t\t\tconst option = id === null ? null : this.options.find((o) => String(o.id) === String(id)) || null\n\t\t\tif (option) {\n\t\t\t\tthis.known = option\n\t\t\t}\n\t\t\t/** @event update:modelValue The chosen party's id, or null when cleared. */\n\t\t\tthis.$emit('update:modelValue', id)\n\t\t\t/** @event select The whole choice: `{ source, id, label, secondary, row }`, or null when cleared. */\n\t\t\tthis.$emit('select', option ? { source: option.source, id: option.id, label: option.label, secondary: option.secondary, row: option.row } : null)\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-party-picker__refusal {\n\tmargin: 4px 0 0;\n\tcolor: var(--color-error-text, var(--color-error));\n}\n\n.cn-party-picker__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;AACF,QAAA,IAAG,EAAA,QAAA;;;;;;;;;"}
|
|
@@ -2,7 +2,7 @@ import script from './CnSavedViewLookFields.vue2.js';
|
|
|
2
2
|
import { render } from './CnSavedViewLookFields.vue3.js';
|
|
3
3
|
|
|
4
4
|
script.render = render;
|
|
5
|
-
script.__scopeId = "data-v-
|
|
5
|
+
script.__scopeId = "data-v-f0552066";
|
|
6
6
|
const __sfc_main = script;
|
|
7
7
|
|
|
8
8
|
export { __sfc_main as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CnSavedViewLookFields.vue2.js","sources":["../../../../src/components/CnSavedViewLookFields/CnSavedViewLookFields.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n<template>\n\t<div class=\"cn-saved-view-look\" data-testid=\"cn-saved-view-look-fields\">\n\t\t<NcTextField\n\t\t\t:modelValue=\"description\"\n\t\t\t:label=\"t('nextcloud-vue', 'Description')\"\n\t\t\t:labelVisible=\"true\"\n\t\t\t:helperText=\"t('nextcloud-vue', 'Shown when you point at the view in the menu.')\"\n\t\t\tdata-testid=\"cn-saved-view-description\"\n\t\t\t@update:modelValue=\"onDescription\" />\n\t\t<div\n\t\t\tclass=\"cn-saved-view-look__icons\"\n\t\t\trole=\"radiogroup\"\n\t\t\t:aria-label=\"t('nextcloud-vue', 'Icon')\"\n\t\t\tdata-testid=\"cn-saved-view-icon\">\n\t\t\t
|
|
1
|
+
{"version":3,"file":"CnSavedViewLookFields.vue2.js","sources":["../../../../src/components/CnSavedViewLookFields/CnSavedViewLookFields.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n<template>\n\t<div class=\"cn-saved-view-look\" data-testid=\"cn-saved-view-look-fields\">\n\t\t<NcTextField\n\t\t\t:modelValue=\"description\"\n\t\t\t:label=\"t('nextcloud-vue', 'Description')\"\n\t\t\t:labelVisible=\"true\"\n\t\t\t:helperText=\"t('nextcloud-vue', 'Shown when you point at the view in the menu.')\"\n\t\t\tdata-testid=\"cn-saved-view-description\"\n\t\t\t@update:modelValue=\"onDescription\" />\n\t\t<div class=\"cn-saved-view-look__icon-field\">\n\t\t\t<span class=\"cn-saved-view-look__label\" aria-hidden=\"true\">{{ t('nextcloud-vue', 'Icon') }}</span>\n\t\t\t<div\n\t\t\t\tclass=\"cn-saved-view-look__icons\"\n\t\t\t\trole=\"radiogroup\"\n\t\t\t\t:aria-label=\"t('nextcloud-vue', 'Icon')\"\n\t\t\t\tdata-testid=\"cn-saved-view-icon\">\n\t\t\t\t<button\n\t\t\t\t\tv-for=\"name in iconNames\"\n\t\t\t\t\t:key=\"name\"\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\trole=\"radio\"\n\t\t\t\t\tclass=\"cn-saved-view-look__icon\"\n\t\t\t\t\t:class=\"{ 'cn-saved-view-look__icon--chosen': name === chosenIcon }\"\n\t\t\t\t\t:aria-checked=\"name === chosenIcon ? 'true' : 'false'\"\n\t\t\t\t\t:aria-label=\"iconLabel(name)\"\n\t\t\t\t\t:title=\"iconLabel(name)\"\n\t\t\t\t\t:data-icon=\"name\"\n\t\t\t\t\t@click=\"onIcon(name)\">\n\t\t\t\t\t<component :is=\"componentOf(name)\" :size=\"20\" />\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcTextField } from '@nextcloud/vue'\nimport { SAVED_VIEW_ICONS, SAVED_VIEW_MENU_DEFAULT_ICON } from '../../utils/savedViewMenu.js'\nimport { getSemanticIconComponent } from '../CnIcon/semanticIcons.js'\n\n/**\n * CnSavedViewLookFields — a saved view's description and icon, in the save\n * and edit dialogs. The description is the tooltip on the view's menu entry;\n * the icon stands before it in the menu. The icons are a short list from the\n * shared semantic vocabulary, so every one resolves in the menu without the\n * app registering it. Choosing the menu's own default icon stores none.\n *\n * @event {string} update:description The typed description.\n * @event {string} update:icon The chosen icon name, '' for the default.\n * @spec openspec/changes/saved-view-icon-description-count/specs/saved-view-icon-description-count/spec.md#requirement-a-saved-view-has-an-icon-and-a-description\n */\nexport default {\n\tname: 'CnSavedViewLookFields',\n\n\tcomponents: { NcTextField },\n\n\tprops: {\n\t\t/** The view's description. */\n\t\tdescription: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** The view's icon name, '' for the menu's default. */\n\t\ticon: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\t},\n\n\temits: ['update:description', 'update:icon'],\n\n\tcomputed: {\n\t\t/** @return {string} The icon the menu falls back to. */\n\t\tdefaultIcon() {\n\t\t\treturn SAVED_VIEW_MENU_DEFAULT_ICON\n\t\t},\n\n\t\t/** @return {Array<string>} The icons offered, the default first. */\n\t\ticonNames() {\n\t\t\treturn SAVED_VIEW_ICONS\n\t\t},\n\n\t\t/** @return {string} The icon shown as chosen. */\n\t\tchosenIcon() {\n\t\t\treturn this.icon && SAVED_VIEW_ICONS.includes(this.icon) ? this.icon : SAVED_VIEW_MENU_DEFAULT_ICON\n\t\t},\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * Pass the typed description on.\n\t\t *\n\t\t * @param {string} value The description.\n\t\t * @return {void}\n\t\t */\n\t\tonDescription(value) {\n\t\t\t/** @event update:description The typed description. */\n\t\t\tthis.$emit('update:description', value)\n\t\t},\n\n\t\t/**\n\t\t * Pass the chosen icon on; the menu's own default icon is stored as none.\n\t\t *\n\t\t * @param {string} name The icon name.\n\t\t * @return {void}\n\t\t */\n\t\tonIcon(name) {\n\t\t\t/** @event update:icon The chosen icon name, '' for the menu's default. */\n\t\t\tthis.$emit('update:icon', name === this.defaultIcon ? '' : name)\n\t\t},\n\n\t\tt,\n\n\t\t/**\n\t\t * The accessible name of an icon option: what it shows, in words.\n\t\t *\n\t\t * @param {string} name An icon name.\n\t\t * @return {string} Its label, or the name when it has none.\n\t\t * @spec openspec/changes/saved-view-icon-labels/specs/saved-view-icon-labels/spec.md#requirement-an-icon-option-is-named-in-words\n\t\t */\n\t\ticonLabel(name) {\n\t\t\tconst labels = {\n\t\t\t\tFilterVariant: t('nextcloud-vue', 'Filter'),\n\t\t\t\tClockOutline: t('nextcloud-vue', 'Clock'),\n\t\t\t\tClockAlertOutline: t('nextcloud-vue', 'Clock with warning'),\n\t\t\t\tCalendarClockOutline: t('nextcloud-vue', 'Calendar with clock'),\n\t\t\t\tCalendarOutline: t('nextcloud-vue', 'Calendar'),\n\t\t\t\tAccountOutline: t('nextcloud-vue', 'Person'),\n\t\t\t\tAccountGroupOutline: t('nextcloud-vue', 'Group'),\n\t\t\t\tFolderOutline: t('nextcloud-vue', 'Folder'),\n\t\t\t\tFileDocumentOutline: t('nextcloud-vue', 'Document'),\n\t\t\t\tAlertCircleOutline: t('nextcloud-vue', 'Attention'),\n\t\t\t\tCheckCircleOutline: t('nextcloud-vue', 'Ready'),\n\t\t\t\tEmailOutline: t('nextcloud-vue', 'Email'),\n\t\t\t\tMapMarkerOutline: t('nextcloud-vue', 'Location'),\n\t\t\t\tTagOutline: t('nextcloud-vue', 'Label'),\n\t\t\t\tBellOutline: t('nextcloud-vue', 'Bell'),\n\t\t\t\tScaleBalance: t('nextcloud-vue', 'Scales'),\n\t\t\t\tBriefcaseOutline: t('nextcloud-vue', 'Briefcase'),\n\t\t\t\tEyeOutline: t('nextcloud-vue', 'Eye'),\n\t\t\t\tLockOutline: t('nextcloud-vue', 'Lock'),\n\t\t\t\tCurrencyEur: t('nextcloud-vue', 'Euro'),\n\t\t\t}\n\t\t\treturn labels[name] || name\n\t\t},\n\n\t\t/**\n\t\t * @param {string} name An icon name.\n\t\t * @return {object|null} Its component.\n\t\t */\n\t\tcomponentOf(name) {\n\t\t\treturn getSemanticIconComponent(name)\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-saved-view-look {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 12px;\n}\n\n.cn-saved-view-look__icons {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 4px;\n}\n\n.cn-saved-view-look__icon-field {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 4px;\n}\n\n.cn-saved-view-look__label {\n\tfont-weight: 600;\n}\n\n.cn-saved-view-look__icon {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: var(--default-clickable-area);\n\theight: var(--default-clickable-area);\n\tpadding: 0;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius-element, 8px);\n\tbackground: var(--color-main-background);\n\tcolor: var(--color-main-text);\n\tcursor: pointer;\n}\n\n.cn-saved-view-look__icon--chosen {\n\tborder-color: var(--color-primary-element);\n\tbackground: var(--color-primary-element-light);\n\tcolor: var(--color-primary-element-light-text);\n}\n\n.cn-saved-view-look__icon:focus-visible {\n\toutline: 2px solid var(--color-primary-element);\n\toutline-offset: 2px;\n}\n</style>\n"],"names":["t"],"mappings":";;;;;AA6CA;AACC;AACA;;AAEA;;AAEA;;;AAGA;;AAED,aAAe;CACd,IAAI,EAAE,uBAAuB;;CAE7B,UAAU,EAAE,EAAE,WAAU,EAAG;;AAE3B,CAAA,KAAK,EAAE;;EAEN,WAAW,EAAE;GACZ,IAAI,EAAE,MAAM;GACZ,OAAO,EAAE,EAAE;GACX;;AAED;EACA,IAAI,EAAE;GACL,IAAI,EAAE,MAAM;GACZ,OAAO,EAAE,EAAE;GACX;EACD;;AAED,CAAA,KAAK,EAAE,CAAC,oBAAoB,EAAE,aAAa,CAAC;;AAE5C,CAAA,QAAQ,EAAE;AACT;EACA,WAAW,GAAG;AACb,GAAA,OAAO,4BAA2B;GAClC;;;EAGD,SAAS,GAAG;AACX,GAAA,OAAO,gBAAe;GACtB;;AAED;EACA,UAAU,GAAG;AACZ,GAAA,OAAO,IAAI,CAAC,IAAK,IAAG,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CA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AAU,CAAC;AAChD,IAAA,UAAU,EAAEA,SAAC,CAAC,eAAe,EAAE,OAAO,CAAC;AACvC,IAAA,WAAW,EAAEA,SAAC,CAAC,eAAe,EAAE,MAAM,CAAC;AACvC,IAAA,YAAY,EAAEA,SAAC,CAAC,eAAe,EAAE,QAAQ,CAAC;IAC1C,gBAAgB,EAAEA,SAAC,CAAC,eAAe,EAAE,WAAW,CAAC;AACjD,IAAA,UAAU,EAAEA,SAAC,CAAC,eAAe,EAAE,KAAK,CAAC;AACrC,IAAA,WAAW,EAAEA,SAAC,CAAC,eAAe,EAAE,MAAM,CAAC;AACvC,IAAA,WAAW,EAAEA,SAAC,CAAC,eAAe,EAAE,MAAM,CAAC;AACxC,KAAA;GACA,OAAO,MAAM,CAAC,IAAI,KAAK,IAAG;GAC1B;;AAED;;AAEC;;AAED,EAAA,WAAW,CAAC,IAAI,EAAE;AACjB,GAAA,OAAO,wBAAwB,CAAC,IAAI,CAAA;GACpC;EACD;AACF;;;;"}
|
|
@@ -4,12 +4,13 @@ const _hoisted_1 = {
|
|
|
4
4
|
class: "cn-saved-view-look",
|
|
5
5
|
"data-testid": "cn-saved-view-look-fields"
|
|
6
6
|
};
|
|
7
|
-
const _hoisted_2 =
|
|
7
|
+
const _hoisted_2 = { class: "cn-saved-view-look__icon-field" };
|
|
8
8
|
const _hoisted_3 = {
|
|
9
9
|
class: "cn-saved-view-look__label",
|
|
10
10
|
"aria-hidden": "true"
|
|
11
11
|
};
|
|
12
|
-
const _hoisted_4 = ["aria-
|
|
12
|
+
const _hoisted_4 = ["aria-label"];
|
|
13
|
+
const _hoisted_5 = ["aria-checked", "aria-label", "title", "data-icon", "onClick"];
|
|
13
14
|
|
|
14
15
|
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
15
16
|
const _component_NcTextField = resolveComponent("NcTextField");
|
|
@@ -23,29 +24,31 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
23
24
|
"data-testid": "cn-saved-view-description",
|
|
24
25
|
"onUpdate:modelValue": $options.onDescription
|
|
25
26
|
}, null, 8 /* PROPS */, ["modelValue", "label", "helperText", "onUpdate:modelValue"]),
|
|
26
|
-
createElementVNode("div",
|
|
27
|
-
class: "cn-saved-view-look__icons",
|
|
28
|
-
role: "radiogroup",
|
|
29
|
-
"aria-label": $options.t('nextcloud-vue', 'Icon'),
|
|
30
|
-
"data-testid": "cn-saved-view-icon"
|
|
31
|
-
}, [
|
|
27
|
+
createElementVNode("div", _hoisted_2, [
|
|
32
28
|
createElementVNode("span", _hoisted_3, toDisplayString($options.t('nextcloud-vue', 'Icon')), 1 /* TEXT */),
|
|
33
|
-
(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
29
|
+
createElementVNode("div", {
|
|
30
|
+
class: "cn-saved-view-look__icons",
|
|
31
|
+
role: "radiogroup",
|
|
32
|
+
"aria-label": $options.t('nextcloud-vue', 'Icon'),
|
|
33
|
+
"data-testid": "cn-saved-view-icon"
|
|
34
|
+
}, [
|
|
35
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList($options.iconNames, (name) => {
|
|
36
|
+
return (openBlock(), createElementBlock("button", {
|
|
37
|
+
key: name,
|
|
38
|
+
type: "button",
|
|
39
|
+
role: "radio",
|
|
40
|
+
class: normalizeClass(["cn-saved-view-look__icon", { 'cn-saved-view-look__icon--chosen': name === $options.chosenIcon }]),
|
|
41
|
+
"aria-checked": name === $options.chosenIcon ? 'true' : 'false',
|
|
42
|
+
"aria-label": $options.iconLabel(name),
|
|
43
|
+
title: $options.iconLabel(name),
|
|
44
|
+
"data-icon": name,
|
|
45
|
+
onClick: $event => ($options.onIcon(name))
|
|
46
|
+
}, [
|
|
47
|
+
(openBlock(), createBlock(resolveDynamicComponent($options.componentOf(name)), { size: 20 }))
|
|
48
|
+
], 10 /* CLASS, PROPS */, _hoisted_5))
|
|
49
|
+
}), 128 /* KEYED_FRAGMENT */))
|
|
50
|
+
], 8 /* PROPS */, _hoisted_4)
|
|
51
|
+
])
|
|
49
52
|
]))
|
|
50
53
|
}
|
|
51
54
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CnSavedViewLookFields.vue3.js","sources":["../../../../src/components/CnSavedViewLookFields/CnSavedViewLookFields.vue?vue&type=template&id=
|
|
1
|
+
{"version":3,"file":"CnSavedViewLookFields.vue3.js","sources":["../../../../src/components/CnSavedViewLookFields/CnSavedViewLookFields.vue?vue&type=template&id=f0552066&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n<template>\n\t<div class=\"cn-saved-view-look\" data-testid=\"cn-saved-view-look-fields\">\n\t\t<NcTextField\n\t\t\t:modelValue=\"description\"\n\t\t\t:label=\"t('nextcloud-vue', 'Description')\"\n\t\t\t:labelVisible=\"true\"\n\t\t\t:helperText=\"t('nextcloud-vue', 'Shown when you point at the view in the menu.')\"\n\t\t\tdata-testid=\"cn-saved-view-description\"\n\t\t\t@update:modelValue=\"onDescription\" />\n\t\t<div class=\"cn-saved-view-look__icon-field\">\n\t\t\t<span class=\"cn-saved-view-look__label\" aria-hidden=\"true\">{{ t('nextcloud-vue', 'Icon') }}</span>\n\t\t\t<div\n\t\t\t\tclass=\"cn-saved-view-look__icons\"\n\t\t\t\trole=\"radiogroup\"\n\t\t\t\t:aria-label=\"t('nextcloud-vue', 'Icon')\"\n\t\t\t\tdata-testid=\"cn-saved-view-icon\">\n\t\t\t\t<button\n\t\t\t\t\tv-for=\"name in iconNames\"\n\t\t\t\t\t:key=\"name\"\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\trole=\"radio\"\n\t\t\t\t\tclass=\"cn-saved-view-look__icon\"\n\t\t\t\t\t:class=\"{ 'cn-saved-view-look__icon--chosen': name === chosenIcon }\"\n\t\t\t\t\t:aria-checked=\"name === chosenIcon ? 'true' : 'false'\"\n\t\t\t\t\t:aria-label=\"iconLabel(name)\"\n\t\t\t\t\t:title=\"iconLabel(name)\"\n\t\t\t\t\t:data-icon=\"name\"\n\t\t\t\t\t@click=\"onIcon(name)\">\n\t\t\t\t\t<component :is=\"componentOf(name)\" :size=\"20\" />\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcTextField } from '@nextcloud/vue'\nimport { SAVED_VIEW_ICONS, SAVED_VIEW_MENU_DEFAULT_ICON } from '../../utils/savedViewMenu.js'\nimport { getSemanticIconComponent } from '../CnIcon/semanticIcons.js'\n\n/**\n * CnSavedViewLookFields — a saved view's description and icon, in the save\n * and edit dialogs. The description is the tooltip on the view's menu entry;\n * the icon stands before it in the menu. The icons are a short list from the\n * shared semantic vocabulary, so every one resolves in the menu without the\n * app registering it. Choosing the menu's own default icon stores none.\n *\n * @event {string} update:description The typed description.\n * @event {string} update:icon The chosen icon name, '' for the default.\n * @spec openspec/changes/saved-view-icon-description-count/specs/saved-view-icon-description-count/spec.md#requirement-a-saved-view-has-an-icon-and-a-description\n */\nexport default {\n\tname: 'CnSavedViewLookFields',\n\n\tcomponents: { NcTextField },\n\n\tprops: {\n\t\t/** The view's description. */\n\t\tdescription: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** The view's icon name, '' for the menu's default. */\n\t\ticon: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\t},\n\n\temits: ['update:description', 'update:icon'],\n\n\tcomputed: {\n\t\t/** @return {string} The icon the menu falls back to. */\n\t\tdefaultIcon() {\n\t\t\treturn SAVED_VIEW_MENU_DEFAULT_ICON\n\t\t},\n\n\t\t/** @return {Array<string>} The icons offered, the default first. */\n\t\ticonNames() {\n\t\t\treturn SAVED_VIEW_ICONS\n\t\t},\n\n\t\t/** @return {string} The icon shown as chosen. */\n\t\tchosenIcon() {\n\t\t\treturn this.icon && SAVED_VIEW_ICONS.includes(this.icon) ? this.icon : SAVED_VIEW_MENU_DEFAULT_ICON\n\t\t},\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * Pass the typed description on.\n\t\t *\n\t\t * @param {string} value The description.\n\t\t * @return {void}\n\t\t */\n\t\tonDescription(value) {\n\t\t\t/** @event update:description The typed description. */\n\t\t\tthis.$emit('update:description', value)\n\t\t},\n\n\t\t/**\n\t\t * Pass the chosen icon on; the menu's own default icon is stored as none.\n\t\t *\n\t\t * @param {string} name The icon name.\n\t\t * @return {void}\n\t\t */\n\t\tonIcon(name) {\n\t\t\t/** @event update:icon The chosen icon name, '' for the menu's default. */\n\t\t\tthis.$emit('update:icon', name === this.defaultIcon ? '' : name)\n\t\t},\n\n\t\tt,\n\n\t\t/**\n\t\t * The accessible name of an icon option: what it shows, in words.\n\t\t *\n\t\t * @param {string} name An icon name.\n\t\t * @return {string} Its label, or the name when it has none.\n\t\t * @spec openspec/changes/saved-view-icon-labels/specs/saved-view-icon-labels/spec.md#requirement-an-icon-option-is-named-in-words\n\t\t */\n\t\ticonLabel(name) {\n\t\t\tconst labels = {\n\t\t\t\tFilterVariant: t('nextcloud-vue', 'Filter'),\n\t\t\t\tClockOutline: t('nextcloud-vue', 'Clock'),\n\t\t\t\tClockAlertOutline: t('nextcloud-vue', 'Clock with warning'),\n\t\t\t\tCalendarClockOutline: t('nextcloud-vue', 'Calendar with clock'),\n\t\t\t\tCalendarOutline: t('nextcloud-vue', 'Calendar'),\n\t\t\t\tAccountOutline: t('nextcloud-vue', 'Person'),\n\t\t\t\tAccountGroupOutline: t('nextcloud-vue', 'Group'),\n\t\t\t\tFolderOutline: t('nextcloud-vue', 'Folder'),\n\t\t\t\tFileDocumentOutline: t('nextcloud-vue', 'Document'),\n\t\t\t\tAlertCircleOutline: t('nextcloud-vue', 'Attention'),\n\t\t\t\tCheckCircleOutline: t('nextcloud-vue', 'Ready'),\n\t\t\t\tEmailOutline: t('nextcloud-vue', 'Email'),\n\t\t\t\tMapMarkerOutline: t('nextcloud-vue', 'Location'),\n\t\t\t\tTagOutline: t('nextcloud-vue', 'Label'),\n\t\t\t\tBellOutline: t('nextcloud-vue', 'Bell'),\n\t\t\t\tScaleBalance: t('nextcloud-vue', 'Scales'),\n\t\t\t\tBriefcaseOutline: t('nextcloud-vue', 'Briefcase'),\n\t\t\t\tEyeOutline: t('nextcloud-vue', 'Eye'),\n\t\t\t\tLockOutline: t('nextcloud-vue', 'Lock'),\n\t\t\t\tCurrencyEur: t('nextcloud-vue', 'Euro'),\n\t\t\t}\n\t\t\treturn labels[name] || name\n\t\t},\n\n\t\t/**\n\t\t * @param {string} name An icon name.\n\t\t * @return {object|null} Its component.\n\t\t */\n\t\tcomponentOf(name) {\n\t\t\treturn getSemanticIconComponent(name)\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-saved-view-look {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 12px;\n}\n\n.cn-saved-view-look__icons {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 4px;\n}\n\n.cn-saved-view-look__icon-field {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 4px;\n}\n\n.cn-saved-view-look__label {\n\tfont-weight: 600;\n}\n\n.cn-saved-view-look__icon {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: var(--default-clickable-area);\n\theight: var(--default-clickable-area);\n\tpadding: 0;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius-element, 8px);\n\tbackground: var(--color-main-background);\n\tcolor: var(--color-main-text);\n\tcursor: pointer;\n}\n\n.cn-saved-view-look__icon--chosen {\n\tborder-color: var(--color-primary-element);\n\tbackground: var(--color-primary-element-light);\n\tcolor: var(--color-primary-element-light-text);\n}\n\n.cn-saved-view-look__icon:focus-visible {\n\toutline: 2px solid var(--color-primary-element);\n\toutline-offset: 2px;\n}\n</style>\n"],"names":["_openBlock","_createElementBlock","_createVNode","_createElementVNode","_toDisplayString","_normalizeClass","_createBlock","_resolveDynamicComponent"],"mappings":";;;AASM,EAAA,KAAK,EAAC,oBAAU;AAAA,EAAA,aAAA,EAAA,2BAAA;;AAQf,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,gCAAO,GAAA;;AACX,EAAA,KAAK,EAAC,2BAA2B;AAAC,EAAA,aAAA,EAAA,MAAA;;;;;;;;AATxC,EAAA,QAAAA,SAAA,EAAA,EAAAC,kBAAA,QAAA;IACAC,WAMiC,CAAA,sBAAA,EAAA;AALhC,MAAA,UAAU,EAAE,MAAW,CAAA,WAAA;AACvB,MAAA,KAAK,EAAE,QAAC,CAAA,CAAA,CAAA,eAAA,EAAA,aAAA,CAAA;AACR,MAAA,YAAY,EAAE,IAAI;AAClB,MAAA,UAAU,EAAE,QAAC,CAAA,CAAA,CAAA,eAAA,EAAA,+CAAA,CAAA;AACd,MAAA,aAAG,EAAA,2BAAA;AACF,MAAA,qBAAiB,EAAE,QAAa,CAAA,aAAA;;AAChC,IAAAC,kBAAA,QAAA;MACAA,kBAAuC,CAAA,MAAA,EAAvC,UAAuC,EAAAC,eAAA,CAAA,QAAA,CAAA,CAAA,CAAA,eAAA,EAAA,MAAA,CAAA,CAAA,EAAA,CAAA,YAAA;MACvCD;AACA,QAAA,KAAK,EAAC,2BAAA;YACF,EAAC,YAAY;AAChB,QAAA,YAAU,EAAA,QAAA,CAAA,CAAA,CAAA,eAAA,EAAA,MAAA,CAAA;qBACA,EAAC,oBAAC;;wEAEG,QAAS,CAAA,SAAA,EAAA,CAAjB,IAAI,KAAA;;AACV,YAAA,GAAG,EAAE,IAAI;AACV,YAAA,IAAI,EAAC,QAAQ;AACb,YAAA,IAAI,EAAC,OAAO;AACZ,YAAA,KAAK,EAACE,cAAA,CAAA,CAAA,0BAAiB,EACP,EAAA,kCAAA,EAAA,IAAA,KAAA,QAAA,CAAA,UAAA,EAAA,CAAA,CAAA;YACf,cAAY,EAAE,IAAI,KAAE,QAAA,CAAA,UAAA,GAAA,MAAA,GAAA,OAAA;YACpB,YAAU,EAAE,QAAS,CAAA,SAAA,CAAC,IAAI,CAAA;YAC1B,KAAK,EAAC,QAAA,CAAA,SAAA,CAAA,IAAA,CAAA;AACN,YAAA,WAAE,EAAA,IAAA;YACF,OAAC,EAAA,MAAA,KAAA,QAAA,CAAA,MAAA,CAAA,IAAA,CAAA,CAAA;;AACF,aAAAL,SAAA,EAAA,EAAAM,WAAA,CAACC,wBAAA,QAAA,CAAA,WAAA,CAAA,IAAA,CAAA,CAAA,EAAA,EAAA,IAAA,EAAA,EAAA,EAAA,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,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;;AAET,EAAA,MAAM,GAAG;AACR,GAAA,OAAO,IAAI,CAAC,UAAS;GACrB;EACD;;AAED,CAAA,KAAK,EAAE;AACN,EAAA,kCAAkC,EAAE;AACnC,GAAA,SAAS,EAAE,IAAI;GACf,OAAO,CAAC,IAAI,EAAE;AACb,IAAA,IAAI,CAAC,gBAAiB,GAAE,CAAC,IAAK,IAAG,EAAE,EAAE,IAAI,CAAC,IAAI,EAAA;IAC9C;GACD;EACD;;AAED,CAAA,OAAO,EAAE;KACRA,SAAC;AACD;;;AAGC;AACA;;AAED,EAAA,OAAO,CAAC,KAAK,EAAE;AACd,GAAA,MAAM,OAAQ,GAAE,CAAC,KAAI,IAAK,EAAE,EAAE,IAAI,GAAC;AACnC,GAAA,IAAI,CAAC,MAAM,CAAC,IAAK,GAAE,OAAQ,KAAI,KAAK,OAAO,QAAM;GACjD;;EAED,iBAAiB,CAAC,KAAK,EAAE;GACxB,IAAI,CAAC,KAAM,IAAG,KAAK,CAAC,IAAI,EAAG,KAAI,EAAE,EAAE;AAClC,IAAA,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,WAAU,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,GA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