@conduction/nextcloud-vue 2.164.0 → 2.165.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/CnLinkCardsPage/CnLinkCardsPage.vue.js +1 -1
- package/dist/esm/components/CnLinkCardsPage/CnLinkCardsPage.vue2.js.map +1 -1
- package/dist/esm/components/CnLinkCardsPage/CnLinkCardsPage.vue3.js.map +1 -1
- package/dist/esm/components/CnMailTab/CnMailTab.vue.js +1 -1
- package/dist/esm/components/CnMailTab/CnMailTab.vue2.js +43 -2
- 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/CnModuleCard/CnModuleCard.vue.js +1 -1
- package/dist/esm/components/CnModuleCard/CnModuleCard.vue2.js.map +1 -1
- package/dist/esm/components/CnModuleCard/CnModuleCard.vue3.js.map +1 -1
- package/dist/esm/components/CnObjectDataWidget/CnObjectDataWidget.vue.js +1 -1
- package/dist/esm/components/CnObjectDataWidget/CnObjectDataWidget.vue2.js +7 -1
- package/dist/esm/components/CnObjectDataWidget/CnObjectDataWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnObjectDataWidget/CnObjectDataWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnStatWidget/CnStatWidget.vue.js +1 -1
- package/dist/esm/components/CnStatWidget/CnStatWidget.vue2.js +49 -1
- package/dist/esm/components/CnStatWidget/CnStatWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnStatWidget/CnStatWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnWeekStripWidget/CnWeekStripWidget.vue.js +1 -1
- package/dist/esm/components/CnWeekStripWidget/CnWeekStripWidget.vue2.js +48 -8
- package/dist/esm/components/CnWeekStripWidget/CnWeekStripWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnWeekStripWidget/CnWeekStripWidget.vue3.js +33 -31
- package/dist/esm/components/CnWeekStripWidget/CnWeekStripWidget.vue3.js.map +1 -1
- package/dist/esm/library-style.js +1 -1
- package/dist/esm/nextcloud-vue.css +203 -178
- package/dist/esm/utils/filterRangeLabel.js +5 -3
- package/dist/esm/utils/filterRangeLabel.js.map +1 -1
- package/dist/esm/utils/validateManifestV2.compiled.js +3 -3
- package/dist/esm/utils/validateManifestV2.compiled.js.map +1 -1
- package/dist/nextcloud-vue.cjs.js +303 -165
- package/dist/nextcloud-vue.cjs.js.map +2 -2
- package/dist/nextcloud-vue.css +203 -178
- package/package.json +1 -1
- package/src/components/CnLinkCardsPage/CnLinkCardsPage.vue +4 -0
- package/src/components/CnMailTab/CnMailTab.vue +43 -2
- package/src/components/CnModuleCard/CnModuleCard.vue +4 -0
- package/src/components/CnObjectDataWidget/CnObjectDataWidget.vue +7 -1
- package/src/components/CnStatWidget/CnStatWidget.vue +49 -1
- package/src/components/CnWeekStripWidget/CnWeekStripWidget.vue +60 -9
- package/src/css/look-board-detail.css +12 -5
- package/src/schemas/app-manifest-v2.schema.json +5 -3
- package/src/utils/filterRangeLabel.js +5 -3
- package/src/utils/validateManifestV2.compiled.js +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CnMailTab.vue3.js","sources":["../../../../src/components/CnMailTab/CnMailTab.vue?vue&type=template&id=474b24a4&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-mail-tab\" data-testid=\"cn-mail-tab\">\n\t\t<CnEmptyContent\n\t\t\tv-if=\"unavailable\"\n\t\t\t:name=\"t('nextcloud-vue', 'Mail is not available')\"\n\t\t\t:description=\"t('nextcloud-vue', 'Install Nextcloud Mail to draft and link mail here.')\">\n\t\t\t<template #icon>\n\t\t\t\t<EmailOffOutline :size=\"48\" />\n\t\t\t</template>\n\t\t</CnEmptyContent>\n\n\t\t<template v-else>\n\t\t\t<div v-if=\"heading || description || hasHeaderActions\" class=\"cn-mail-tab__header\" data-testid=\"cn-mail-tab-header\">\n\t\t\t\t<div class=\"cn-mail-tab__heading\">\n\t\t\t\t\t<h3 v-if=\"heading\" class=\"cn-mail-tab__title\">\n\t\t\t\t\t\t{{ heading }}\n\t\t\t\t\t</h3>\n\t\t\t\t\t<!-- Divs, not <p>: a theme that sizes every paragraph with !important\n\t\t\t\t\t would override the card's 14px description. -->\n\t\t\t\t\t<div v-if=\"description\" class=\"cn-mail-tab__subtitle\">\n\t\t\t\t\t\t{{ description }}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div v-if=\"hasHeaderActions\" class=\"cn-mail-tab__header-actions\">\n\t\t\t\t\t<NcButton\n\t\t\t\t\t\tv-if=\"showLinkAction\"\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tdata-testid=\"cn-mail-tab-header-link\"\n\t\t\t\t\t\t@click=\"openLinkPicker\">\n\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t<LinkVariant :size=\"18\" />\n\t\t\t\t\t\t</template>\n\t\t\t\t\t\t{{ t('nextcloud-vue', 'Link mail') }}\n\t\t\t\t\t</NcButton>\n\t\t\t\t\t<NcButton\n\t\t\t\t\t\tv-if=\"showComposeAction\"\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t:disabled=\"draftEnabled && (closed || drafting)\"\n\t\t\t\t\t\t:href=\"draftEnabled ? undefined : composeUrl\"\n\t\t\t\t\t\t:target=\"draftEnabled ? undefined : '_blank'\"\n\t\t\t\t\t\tdata-testid=\"cn-mail-tab-header-compose\"\n\t\t\t\t\t\t@click=\"onCompose\">\n\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t<EmailEditOutline :size=\"18\" />\n\t\t\t\t\t\t</template>\n\t\t\t\t\t\t{{ t('nextcloud-vue', 'Compose mail') }}\n\t\t\t\t\t</NcButton>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<div v-if=\"draftEnabled\" class=\"cn-mail-tab__template-row\" data-testid=\"cn-mail-tab-template-row\">\n\t\t\t\t<NcSelect\n\t\t\t\t\tv-if=\"templatesEnabled\"\n\t\t\t\t\tv-model=\"selectedTemplate\"\n\t\t\t\t\tclass=\"cn-mail-tab__template-select\"\n\t\t\t\t\t:options=\"templates\"\n\t\t\t\t\t:disabled=\"templates.length === 0\"\n\t\t\t\t\t:inputLabel=\"t('nextcloud-vue', 'Email template')\"\n\t\t\t\t\t:label=\"templateLabelField\"\n\t\t\t\t\t:trackBy=\"templateIdField\"\n\t\t\t\t\t:placeholder=\"templatePlaceholder\"\n\t\t\t\t\t:clearable=\"true\" />\n\t\t\t\t<!-- The draft buttons stand together, 8px apart, beside the field. -->\n\t\t\t\t<div class=\"cn-mail-tab__template-actions\">\n\t\t\t\t\t<NcButton\n\t\t\t\t\t\tv-if=\"templatesEnabled\"\n\t\t\t\t\t\t:disabled=\"closed || drafting || !selectedTemplate\"\n\t\t\t\t\t\tdata-testid=\"cn-mail-tab-draft-template\"\n\t\t\t\t\t\t@click=\"draftFromTemplate\">\n\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t<OpenInNew :size=\"16\" />\n\t\t\t\t\t\t</template>\n\t\t\t\t\t\t{{ t('nextcloud-vue', 'Open draft from template') }}\n\t\t\t\t\t</NcButton>\n\t\t\t\t\t<NcButton\n\t\t\t\t\t\tv-if=\"!showComposeAction || draftSource.blankButton === true\"\n\t\t\t\t\t\t:disabled=\"closed || drafting\"\n\t\t\t\t\t\tdata-testid=\"cn-mail-tab-draft-blank\"\n\t\t\t\t\t\t@click=\"draftBlank\">\n\t\t\t\t\t\t{{ t('nextcloud-vue', 'Empty draft') }}\n\t\t\t\t\t</NcButton>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div v-if=\"hint\" class=\"cn-mail-tab__hint\">\n\t\t\t\t{{ hint }}\n\t\t\t</div>\n\n\t\t\t<NcNoteCard\n\t\t\t\tv-if=\"error\"\n\t\t\t\ttype=\"error\"\n\t\t\t\t:heading=\"t('nextcloud-vue', 'Could not open draft')\"\n\t\t\t\trole=\"alert\">\n\t\t\t\t{{ error }}\n\t\t\t</NcNoteCard>\n\t\t\t<NcNoteCard\n\t\t\t\tv-if=\"unresolved.length > 0\"\n\t\t\t\ttype=\"warning\"\n\t\t\t\trole=\"status\"\n\t\t\t\tdata-testid=\"cn-mail-tab-unresolved\">\n\t\t\t\t<p>{{ t('nextcloud-vue', 'Some template fields could not be filled. Fill these in the draft yourself:') }}</p>\n\t\t\t\t<ul class=\"cn-mail-tab__unresolved\">\n\t\t\t\t\t<li v-for=\"name in unresolved\" :key=\"name\">\n\t\t\t\t\t\t<code>{{ placeholderOf(name) }}</code>\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\n\t\t\t</NcNoteCard>\n\n\t\t\t<CnEmailTab\n\t\t\t\tv-if=\"linkedMail && objectKey\"\n\t\t\t\tref=\"linkedMail\"\n\t\t\t\tclass=\"cn-mail-tab__linked\"\n\t\t\t\t:showActions=\"!hasHeaderActions\"\n\t\t\t\t:objectId=\"objectKey\"\n\t\t\t\t:register=\"registerKey\"\n\t\t\t\t:schema=\"schemaKey\" />\n\t\t</template>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcButton, NcNoteCard, NcSelect } from '@nextcloud/vue'\nimport EmailEditOutline from 'vue-material-design-icons/EmailEditOutline.vue'\nimport EmailOffOutline from 'vue-material-design-icons/EmailOffOutline.vue'\nimport LinkVariant from 'vue-material-design-icons/LinkVariant.vue'\nimport OpenInNew from 'vue-material-design-icons/OpenInNew.vue'\nimport CnEmailTab from '../../integrations/builtin/email/CnEmailTab.vue'\nimport CnEmptyContent from '../CnEmptyContent/CnEmptyContent.vue'\nimport { fetchEndpointSource, interpolateUrlTokens } from '../../composables/useEndpointSource.js'\nimport { evaluateVisibleWhenLocal } from '../../utils/visibleWhen.js'\n\n/** The actions `content.headerActions` can put in the tab's header. */\nconst HEADER_ACTIONS = ['compose', 'link']\n\n/**\n * Read a reference that may be a slug, an id or an object carrying either.\n *\n * @param {string|number|object} value The reference.\n * @return {string} The slug or id, or ''.\n */\nfunction keyOf(value) {\n\tif (value === null || value === undefined) {\n\t\treturn ''\n\t}\n\tif (typeof value === 'object') {\n\t\treturn String(value.slug || value.id || value.uuid || '')\n\t}\n\treturn String(value)\n}\n\n/**\n * CnMailTab — the mail of one record: drafts in Nextcloud Mail, from a\n * template or empty, above the mail linked to the record.\n *\n * Registered as the `mail` widget type. The app owns the endpoints and the\n * texts; the tab never sends mail. A draft is a POST to `draft.url`, whose\n * response may carry `draftUrl` (opened in a new tab) and `unresolved` (the\n * template fields the server could not fill). A 404 there means the app has\n * no Mail to draft into, and the tab says so instead of the controls.\n *\n * ```json\n * {\n * \"type\": \"mail\",\n * \"content\": {\n * \"heading\": \"Email\",\n * \"description\": \"Mail linked to this case\",\n * \"hint\": \"The draft opens in Nextcloud Mail.\",\n * \"templates\": { \"url\": \"/apps/app/api/types/@object.type/templates\", \"responsePath\": \"results\", \"labelField\": \"name\", \"idField\": \"id\" },\n * \"noTemplatesText\": \"No templates for this type yet\",\n * \"draft\": { \"url\": \"/apps/app/api/records/@objectId/templates/{templateId}/draft\", \"blankTemplateId\": \"blank\" },\n * \"closedWhen\": { \"field\": \"endDate\", \"op\": \"notEmpty\" },\n * \"linkedMail\": true,\n * \"headerActions\": [\"link\", \"compose\"]\n * }\n * }\n * ```\n *\n * URLs take the `@objectId` / `@object.<field>` tokens of `endpointSource`;\n * `{templateId}` in the draft URL is the chosen template's id, or\n * `blankTemplateId` for an empty draft. Without `templates` the row offers\n * the empty draft only; without `draft` there is no row. `closedWhen` is a\n * local visibleWhen condition on the record that disables drafting.\n * `linkedMail: false` leaves the linked mail to a separate `email`\n * integration card. `headerActions` puts buttons beside the heading:\n * `compose` opens the empty draft (or Nextcloud Mail's composer when there\n * is no `draft`) and replaces the row's empty-draft button, unless\n * `draft.blankButton` is true (DqZaakEmail draws both); `link` opens the\n * linked mail's picker and needs the linked mail. The linked mail then drops\n * its own buttons. Texts go through the host's translate.\n */\nexport default {\n\tname: 'CnMailTab',\n\n\tcomponents: {\n\t\tCnEmailTab,\n\t\tCnEmptyContent,\n\t\tEmailEditOutline,\n\t\tEmailOffOutline,\n\t\tLinkVariant,\n\t\tNcButton,\n\t\tNcNoteCard,\n\t\tNcSelect,\n\t\tOpenInNew,\n\t},\n\n\tinject: {\n\t\t/** The detail page's object context (`{ objectId, object }`), for tokens. */\n\t\tcnObjectContext: { default: null },\n\t\t/** The host's translate, for the manifest texts. */\n\t\tcnTranslate: { default: () => (key) => key },\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * The widget config: `{ heading?, description?, hint?, templates?,\n\t\t * noTemplatesText?, draft?, closedWhen?, linkedMail?, headerActions? }`, as in the\n\t\t * component description and docs/components/cn-mail-tab.md.\n\t\t *\n\t\t * @type {object}\n\t\t */\n\t\tcontent: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/** The bound record's id, for `@objectId` and the linked mail. */\n\t\tobjectId: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** The bound record, for `@object.<field>` and `closedWhen`. */\n\t\tobjectData: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/** The bound record's register, for the linked mail. */\n\t\tregister: {\n\t\t\ttype: [String, Object],\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** The bound record's schema, for the linked mail. */\n\t\tschema: {\n\t\t\ttype: [String, Object],\n\t\t\tdefault: '',\n\t\t},\n\t},\n\n\temits: ['drafted'],\n\n\tdata() {\n\t\treturn {\n\t\t\ttemplates: [],\n\t\t\tselectedTemplate: null,\n\t\t\tdrafting: false,\n\t\t\terror: '',\n\t\t\tunresolved: [],\n\t\t\tunavailable: false,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** @return {object} The record, from the prop or the page context. */\n\t\trecord() {\n\t\t\tif (this.objectData) {\n\t\t\t\treturn this.objectData\n\t\t\t}\n\t\t\tconst ctx = this.cnObjectContext\n\t\t\tconst value = ctx && typeof ctx === 'object' && 'value' in ctx ? ctx.value : ctx\n\t\t\treturn (value && value.object) || {}\n\t\t},\n\n\t\t/** @return {string} The record id. */\n\t\tobjectKey() {\n\t\t\treturn keyOf(this.objectId) || keyOf(this.record.id) || keyOf(this.record['@self'] && this.record['@self'].id)\n\t\t},\n\n\t\t/** @return {string} The register slug or id, from the prop or else the record's own `@self`. */\n\t\tregisterKey() {\n\t\t\treturn keyOf(this.register) || keyOf(this.record['@self'] && this.record['@self'].register)\n\t\t},\n\n\t\t/** @return {string} The schema slug or id, from the prop or else the record's own `@self`. */\n\t\tschemaKey() {\n\t\t\treturn keyOf(this.schema) || keyOf(this.record['@self'] && this.record['@self'].schema)\n\t\t},\n\n\t\t/** @return {object} The token context for the URLs. */\n\t\ttokenContext() {\n\t\t\treturn { objectId: this.objectKey, object: this.record }\n\t\t},\n\n\t\t/** @return {string} The heading, translated, or ''. */\n\t\theading() {\n\t\t\treturn this.tr(this.content.heading)\n\t\t},\n\n\t\t/** @return {string} The line under the heading, translated, or ''. */\n\t\tdescription() {\n\t\t\treturn this.tr(this.content.description)\n\t\t},\n\n\t\t/** @return {string} The line under the template row, translated, or ''. */\n\t\thint() {\n\t\t\treturn this.tr(this.content.hint)\n\t\t},\n\n\t\t/** @return {object|null} The templates endpoint, or null. */\n\t\ttemplatesSource() {\n\t\t\tconst source = this.content.templates\n\t\t\treturn source && typeof source === 'object' && source.url ? source : null\n\t\t},\n\n\t\t/** @return {object|null} The draft endpoint, or null. */\n\t\tdraftSource() {\n\t\t\tconst source = this.content.draft\n\t\t\treturn source && typeof source === 'object' && source.url ? source : null\n\t\t},\n\n\t\t/** @return {boolean} Whether the template select and its button show. */\n\t\ttemplatesEnabled() {\n\t\t\treturn this.templatesSource !== null\n\t\t},\n\n\t\t/** @return {boolean} Whether the template row shows. */\n\t\tdraftEnabled() {\n\t\t\treturn this.draftSource !== null\n\t\t},\n\n\t\t/** @return {string} The template field shown in the select. */\n\t\ttemplateLabelField() {\n\t\t\treturn (this.templatesSource && this.templatesSource.labelField) || 'name'\n\t\t},\n\n\t\t/** @return {string} The template field that identifies it. */\n\t\ttemplateIdField() {\n\t\t\treturn (this.templatesSource && this.templatesSource.idField) || 'id'\n\t\t},\n\n\t\t/** @return {string} The select's placeholder. */\n\t\ttemplatePlaceholder() {\n\t\t\tif (this.templates.length === 0) {\n\t\t\t\treturn this.tr(this.content.noTemplatesText) || t('nextcloud-vue', 'No templates yet')\n\t\t\t}\n\t\t\treturn t('nextcloud-vue', 'Select a template (optional)…')\n\t\t},\n\n\t\t/** @return {boolean} Whether `closedWhen` holds for the record. */\n\t\tclosed() {\n\t\t\tconst cond = this.content.closedWhen\n\t\t\tif (!cond) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn evaluateVisibleWhenLocal(cond, this.record)\n\t\t},\n\n\t\t/** @return {string} The templates URL after tokens, to refetch on change. */\n\t\ttemplatesUrl() {\n\t\t\treturn this.templatesSource ? interpolateUrlTokens(this.templatesSource.url, this.tokenContext) : ''\n\t\t},\n\n\t\t/** @return {boolean} Whether the linked mail list shows. */\n\t\tlinkedMail() {\n\t\t\treturn this.content.linkedMail !== false\n\t\t},\n\n\t\t/**\n\t\t * The known header actions the config asks for.\n\t\t *\n\t\t * @return {string[]} `compose` and or `link`.\n\t\t * @spec openspec/changes/mail-tab-compose-and-link/specs/mail-tab-compose-and-link/spec.md#requirement-the-mail-tab-can-carry-compose-mail-and-link-mail-in-its-header\n\t\t */\n\t\theaderActions() {\n\t\t\tconst list = Array.isArray(this.content.headerActions) ? this.content.headerActions : []\n\t\t\treturn list.filter((key) => HEADER_ACTIONS.includes(key))\n\t\t},\n\n\t\t/** @return {boolean} Whether the header shows \"Compose mail\". */\n\t\tshowComposeAction() {\n\t\t\treturn this.headerActions.includes('compose')\n\t\t},\n\n\t\t/** @return {boolean} Whether the header shows \"Link mail\": it opens the linked mail's picker. */\n\t\tshowLinkAction() {\n\t\t\treturn this.headerActions.includes('link') && this.linkedMail && this.objectKey !== ''\n\t\t},\n\n\t\t/** @return {boolean} Whether the header holds any button. */\n\t\thasHeaderActions() {\n\t\t\treturn this.showComposeAction || this.showLinkAction\n\t\t},\n\n\t\t/** @return {string} Nextcloud Mail's composer, for an app without a draft endpoint. */\n\t\tcomposeUrl() {\n\t\t\treturn (typeof OC !== 'undefined' && typeof OC.generateUrl === 'function')\n\t\t\t\t? OC.generateUrl('/apps/mail/box/draft')\n\t\t\t\t: '/index.php/apps/mail/box/draft'\n\t\t},\n\t},\n\n\twatch: {\n\t\ttemplatesUrl: {\n\t\t\timmediate: true,\n\t\t\thandler() {\n\t\t\t\tthis.loadTemplates()\n\t\t\t},\n\t\t},\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * Translate a manifest text through the host.\n\t\t *\n\t\t * @param {string} text The text.\n\t\t * @return {string} The translation, or '' for no text.\n\t\t */\n\t\ttr(text) {\n\t\t\tif (typeof text !== 'string' || text === '') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\treturn this.cnTranslate(text)\n\t\t},\n\n\t\t/**\n\t\t * Read the templates. A failed read leaves the empty draft usable.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync loadTemplates() {\n\t\t\tif (!this.templatesSource) {\n\t\t\t\tthis.templates = []\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tconst payload = await fetchEndpointSource(this.templatesSource, this.tokenContext)\n\t\t\t\tconst list = Array.isArray(payload) ? payload : (payload && Array.isArray(payload.results) ? payload.results : [])\n\t\t\t\tthis.templates = list\n\t\t\t} catch (err) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.warn('[CnMailTab] could not read the templates', err)\n\t\t\t\tthis.templates = []\n\t\t\t}\n\t\t},\n\n\t\t/** @return {Promise<void>} */\n\t\tdraftFromTemplate() {\n\t\t\treturn this.openDraft(this.selectedTemplate)\n\t\t},\n\n\t\t/**\n\t\t * \"Compose mail\": the empty draft through the app's endpoint. Without\n\t\t * one the button is a link to Mail's composer and needs no handler.\n\t\t *\n\t\t * @return {Promise<void>|undefined}\n\t\t */\n\t\tonCompose() {\n\t\t\treturn this.draftEnabled ? this.draftBlank() : undefined\n\t\t},\n\n\t\t/**\n\t\t * \"Link mail\": the linked mail's picker, which links the chosen\n\t\t * message to the record through its own endpoint.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\topenLinkPicker() {\n\t\t\tconst linked = this.$refs.linkedMail\n\t\t\tif (linked && typeof linked.openPicker === 'function') {\n\t\t\t\tlinked.openPicker()\n\t\t\t}\n\t\t},\n\n\t\t/** @return {Promise<void>} */\n\t\tdraftBlank() {\n\t\t\tthis.selectedTemplate = null\n\t\t\treturn this.openDraft(null)\n\t\t},\n\n\t\t/**\n\t\t * Ask the app to create a Nextcloud Mail draft and open it.\n\t\t *\n\t\t * @param {object|null} template The chosen template, or null for an empty draft.\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync openDraft(template) {\n\t\t\tif (this.closed || !this.draftSource) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.drafting = true\n\t\t\tthis.error = ''\n\t\t\tthis.unresolved = []\n\t\t\ttry {\n\t\t\t\tconst id = template ? template[this.templateIdField] : (this.draftSource.blankTemplateId || 'blank')\n\t\t\t\tconst path = interpolateUrlTokens(this.draftSource.url, this.tokenContext)\n\t\t\t\t\t.replace('{templateId}', encodeURIComponent(String(id)))\n\t\t\t\tconst [{ default: axios }, { generateUrl }] = await Promise.all([\n\t\t\t\t\timport('@nextcloud/axios'),\n\t\t\t\t\timport('@nextcloud/router'),\n\t\t\t\t])\n\t\t\t\tconst { data } = await axios.post(generateUrl(path), {})\n\t\t\t\tthis.unresolved = Array.isArray(data && data.unresolved) ? data.unresolved : []\n\t\t\t\tif (data && data.draftUrl) {\n\t\t\t\t\twindow.open(data.draftUrl, '_blank', 'noopener')\n\t\t\t\t}\n\t\t\t\t/**\n\t\t\t\t * @event drafted A draft was made from a template. Carries the\n\t\t\t\t * draft endpoint's response, including `draftUrl` and\n\t\t\t\t * `unresolved` when the endpoint returns them.\n\t\t\t\t * @type {object}\n\t\t\t\t */\n\t\t\t\tthis.$emit('drafted', data)\n\t\t\t} catch (err) {\n\t\t\t\tconst response = err && err.response\n\t\t\t\tif (response && response.status === 404) {\n\t\t\t\t\tthis.unavailable = true\n\t\t\t\t}\n\t\t\t\tthis.error = (response && response.data && response.data.message)\n\t\t\t\t\t|| (err && err.message)\n\t\t\t\t\t|| t('nextcloud-vue', 'The draft could not be opened.')\n\t\t\t} finally {\n\t\t\t\tthis.drafting = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Write a template field the way the template spells it.\n\t\t *\n\t\t * @param {string} name The field name.\n\t\t * @return {string} `{{name}}`.\n\t\t */\n\t\tplaceholderOf(name) {\n\t\t\treturn `{{${name}}}`\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-mail-tab {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 16px;\n\tpadding: 12px;\n}\n\n.cn-mail-tab__header {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\talign-items: flex-start;\n\tjustify-content: space-between;\n\tgap: 10px 16px;\n}\n\n.cn-mail-tab__heading {\n\tdisplay: flex;\n\tflex: 1 1 260px;\n\tflex-direction: column;\n\tgap: 3px;\n\tmin-width: 0;\n}\n\n.cn-mail-tab__header-actions {\n\tdisplay: flex;\n\tflex: none;\n\tflex-wrap: wrap;\n\tgap: 8px;\n}\n\n.cn-mail-tab__title {\n\tmargin: 0;\n\tfont-size: 16px;\n\tfont-weight: bold;\n}\n\n.cn-mail-tab__subtitle,\n.cn-mail-tab__hint {\n\tmargin: 0;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-mail-tab__template-row {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\talign-items: flex-end;\n\tgap: 8px;\n}\n\n.cn-mail-tab__template-actions {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 8px;\n}\n\n.cn-mail-tab__template-select {\n\tflex: 1 1 260px;\n}\n\n.cn-mail-tab__unresolved {\n\tmargin: 4px 0 0;\n\tpadding-inline-start: 20px;\n}\n\n.cn-mail-tab__unresolved code {\n\tbackground: var(--color-background-dark);\n\tpadding: 2px 6px;\n\tborder-radius: var(--border-radius);\n\tfont-family: var(--font-face-mono, monospace);\n}\n</style>\n"],"names":["_openBlock","_createElementBlock","_createBlock","_createVNode","_toDisplayString","_createTextVNode","_createElementVNode","_Fragment","_renderList"],"mappings":";;;AASM,EAAA,KAAK,EAAC,aAAa;AAAC,EAAA,aAAW,EAAC,aAAa;;;;AAW1C,EAAA,KAAA,EAAA,qBAAA;AAAA,EAAA,aAAA,EAAA,oBAAA;;AACD,MAAA,UAAA,GAAA,EAAA,KAAM,EAAE,sBAAsB,GAAA;;;AACb,EAAA,KAAI,EAAC,oBAAoB;;;;AAKrB,EAAA,KAAK,EAAC,uBAAuB;;;;AAIzB,EAAA,KAAK,EAAC,6BAAG;;;;AA2Bd,EAAA,KAAK,EAAC,2BAAM;AAAA,EAAA,aAAA,EAAA,0BAAA;;AAa/B,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,+BAA8B,GAAA;;;AAoBhC,EAAA,KAAA,EAAA,mBAAA;;AAiBL,MAAA,WAAA,GAAA,EAAA,KAAA,EAAA,yBAAA,GAAA;;;;;;;;;;;;;AAnGL,EAAA,QAAAA,SAAA,EAAA,EAAAC,kBAAA,QAAA;KAEM,KAAU,CAAA,WAAA;sBADhBC,WAOgB,CAAA,yBAAA,EAAA;;AALf,UAAA,IAAI,EAAE,QAAC,CAAA,CAAA,CAAA,eAAA,EAAA,uBAAA,CAAA;AACP,UAAA,WAAW,EAAE,QAAC,CAAA,CAAA,CAAA,eAAA,EAAA,qDAAA,CAAA;;wBAEd,MAAc;YAAdC,WAAc,CA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AAA,IAAA,KAAA;2CAAVP,kBAEK,CAAA,IAAA,EAAA,EAFK,GAAA,EAAA,IAAA,EAAA,EAAA;;;;;;;;;AAOL,UAAA,CAAA,QAAA,CAAA,UAAU,IAAI,QAAA,CAAA,SAAA;4BADpBC;;AAEA,gBAAA,GAAG,EAAC,YAAY;AAChB,gBAAA,KAAK,EAAC,qBAAe;AACpB,gBAAA,WAAO,GAAA,QAAA,CAAA,gBAAA;AACP,gBAAA,QAAC,EAAA,QAAA,CAAA,SAAA;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"CnMailTab.vue3.js","sources":["../../../../src/components/CnMailTab/CnMailTab.vue?vue&type=template&id=495e6034&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-mail-tab\" data-testid=\"cn-mail-tab\">\n\t\t<CnEmptyContent\n\t\t\tv-if=\"unavailable\"\n\t\t\t:name=\"t('nextcloud-vue', 'Mail is not available')\"\n\t\t\t:description=\"t('nextcloud-vue', 'Install Nextcloud Mail to draft and link mail here.')\">\n\t\t\t<template #icon>\n\t\t\t\t<EmailOffOutline :size=\"48\" />\n\t\t\t</template>\n\t\t</CnEmptyContent>\n\n\t\t<template v-else>\n\t\t\t<div v-if=\"heading || description || hasHeaderActions\" class=\"cn-mail-tab__header\" data-testid=\"cn-mail-tab-header\">\n\t\t\t\t<div class=\"cn-mail-tab__heading\">\n\t\t\t\t\t<h3 v-if=\"heading\" class=\"cn-mail-tab__title\">\n\t\t\t\t\t\t{{ heading }}\n\t\t\t\t\t</h3>\n\t\t\t\t\t<!-- Divs, not <p>: a theme that sizes every paragraph with !important\n\t\t\t\t\t would override the card's 14px description. -->\n\t\t\t\t\t<div v-if=\"description\" class=\"cn-mail-tab__subtitle\">\n\t\t\t\t\t\t{{ description }}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div v-if=\"hasHeaderActions\" class=\"cn-mail-tab__header-actions\">\n\t\t\t\t\t<NcButton\n\t\t\t\t\t\tv-if=\"showLinkAction\"\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tdata-testid=\"cn-mail-tab-header-link\"\n\t\t\t\t\t\t@click=\"openLinkPicker\">\n\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t<LinkVariant :size=\"18\" />\n\t\t\t\t\t\t</template>\n\t\t\t\t\t\t{{ t('nextcloud-vue', 'Link mail') }}\n\t\t\t\t\t</NcButton>\n\t\t\t\t\t<NcButton\n\t\t\t\t\t\tv-if=\"showComposeAction\"\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t:disabled=\"draftEnabled && (closed || drafting)\"\n\t\t\t\t\t\t:href=\"draftEnabled ? undefined : composeUrl\"\n\t\t\t\t\t\t:target=\"draftEnabled ? undefined : '_blank'\"\n\t\t\t\t\t\tdata-testid=\"cn-mail-tab-header-compose\"\n\t\t\t\t\t\t@click=\"onCompose\">\n\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t<EmailEditOutline :size=\"18\" />\n\t\t\t\t\t\t</template>\n\t\t\t\t\t\t{{ t('nextcloud-vue', 'Compose mail') }}\n\t\t\t\t\t</NcButton>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<div v-if=\"draftEnabled\" class=\"cn-mail-tab__template-row\" data-testid=\"cn-mail-tab-template-row\">\n\t\t\t\t<NcSelect\n\t\t\t\t\tv-if=\"templatesEnabled\"\n\t\t\t\t\tv-model=\"selectedTemplate\"\n\t\t\t\t\tclass=\"cn-mail-tab__template-select\"\n\t\t\t\t\t:options=\"templates\"\n\t\t\t\t\t:disabled=\"templates.length === 0\"\n\t\t\t\t\t:inputLabel=\"t('nextcloud-vue', 'Email template')\"\n\t\t\t\t\t:label=\"templateLabelField\"\n\t\t\t\t\t:trackBy=\"templateIdField\"\n\t\t\t\t\t:placeholder=\"templatePlaceholder\"\n\t\t\t\t\t:clearable=\"true\" />\n\t\t\t\t<!-- The draft buttons stand together, 8px apart, beside the field. -->\n\t\t\t\t<div class=\"cn-mail-tab__template-actions\">\n\t\t\t\t\t<NcButton\n\t\t\t\t\t\tv-if=\"templatesEnabled\"\n\t\t\t\t\t\t:disabled=\"closed || drafting || !selectedTemplate\"\n\t\t\t\t\t\tdata-testid=\"cn-mail-tab-draft-template\"\n\t\t\t\t\t\t@click=\"draftFromTemplate\">\n\t\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t\t<OpenInNew :size=\"16\" />\n\t\t\t\t\t\t</template>\n\t\t\t\t\t\t{{ t('nextcloud-vue', 'Open draft from template') }}\n\t\t\t\t\t</NcButton>\n\t\t\t\t\t<NcButton\n\t\t\t\t\t\tv-if=\"!showComposeAction || draftSource.blankButton === true\"\n\t\t\t\t\t\t:disabled=\"closed || drafting\"\n\t\t\t\t\t\tdata-testid=\"cn-mail-tab-draft-blank\"\n\t\t\t\t\t\t@click=\"draftBlank\">\n\t\t\t\t\t\t{{ t('nextcloud-vue', 'Empty draft') }}\n\t\t\t\t\t</NcButton>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div v-if=\"hint\" class=\"cn-mail-tab__hint\">\n\t\t\t\t{{ hint }}\n\t\t\t</div>\n\n\t\t\t<NcNoteCard\n\t\t\t\tv-if=\"error\"\n\t\t\t\ttype=\"error\"\n\t\t\t\t:heading=\"t('nextcloud-vue', 'Could not open draft')\"\n\t\t\t\trole=\"alert\">\n\t\t\t\t{{ error }}\n\t\t\t</NcNoteCard>\n\t\t\t<NcNoteCard\n\t\t\t\tv-if=\"unresolved.length > 0\"\n\t\t\t\ttype=\"warning\"\n\t\t\t\trole=\"status\"\n\t\t\t\tdata-testid=\"cn-mail-tab-unresolved\">\n\t\t\t\t<p>{{ t('nextcloud-vue', 'Some template fields could not be filled. Fill these in the draft yourself:') }}</p>\n\t\t\t\t<ul class=\"cn-mail-tab__unresolved\">\n\t\t\t\t\t<li v-for=\"name in unresolved\" :key=\"name\">\n\t\t\t\t\t\t<code>{{ placeholderOf(name) }}</code>\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\n\t\t\t</NcNoteCard>\n\n\t\t\t<CnEmailTab\n\t\t\t\tv-if=\"linkedMail && objectKey\"\n\t\t\t\tref=\"linkedMail\"\n\t\t\t\tclass=\"cn-mail-tab__linked\"\n\t\t\t\t:showActions=\"!hasHeaderActions\"\n\t\t\t\t:objectId=\"objectKey\"\n\t\t\t\t:register=\"registerKey\"\n\t\t\t\t:schema=\"schemaKey\" />\n\t\t</template>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcButton, NcNoteCard, NcSelect } from '@nextcloud/vue'\nimport EmailEditOutline from 'vue-material-design-icons/EmailEditOutline.vue'\nimport EmailOffOutline from 'vue-material-design-icons/EmailOffOutline.vue'\nimport LinkVariant from 'vue-material-design-icons/LinkVariant.vue'\nimport OpenInNew from 'vue-material-design-icons/OpenInNew.vue'\nimport CnEmailTab from '../../integrations/builtin/email/CnEmailTab.vue'\nimport CnEmptyContent from '../CnEmptyContent/CnEmptyContent.vue'\nimport { fetchEndpointSource, interpolateUrlTokens } from '../../composables/useEndpointSource.js'\nimport { evaluateVisibleWhenLocal } from '../../utils/visibleWhen.js'\n\n/** The actions `content.headerActions` can put in the tab's header. */\nconst HEADER_ACTIONS = ['compose', 'link']\n\n/**\n * Read a reference that may be a slug, an id or an object carrying either.\n *\n * @param {string|number|object} value The reference.\n * @return {string} The slug or id, or ''.\n */\nfunction keyOf(value) {\n\tif (value === null || value === undefined) {\n\t\treturn ''\n\t}\n\tif (typeof value === 'object') {\n\t\treturn String(value.slug || value.id || value.uuid || '')\n\t}\n\treturn String(value)\n}\n\n/**\n * The template a `templates.preselect` rule picks: `\"first\"` the first one,\n * `\"only\"` the one when the list holds exactly one, `{ field, value }` the\n * first whose field holds the value.\n *\n * @param {object[]} list The templates.\n * @param {string|object} rule The rule.\n * @return {object|null} The template, or null.\n */\nfunction preselectedTemplate(list, rule) {\n\tif (rule === 'first') {\n\t\treturn list[0] || null\n\t}\n\tif (rule === 'only') {\n\t\treturn list.length === 1 ? list[0] : null\n\t}\n\tif (rule && typeof rule === 'object' && typeof rule.field === 'string') {\n\t\treturn list.find((item) => item && item[rule.field] === rule.value) || null\n\t}\n\treturn null\n}\n\n/**\n * CnMailTab — the mail of one record: drafts in Nextcloud Mail, from a\n * template or empty, above the mail linked to the record.\n *\n * Registered as the `mail` widget type. The app owns the endpoints and the\n * texts; the tab never sends mail. A draft is a POST to `draft.url`, whose\n * response may carry `draftUrl` (opened in a new tab) and `unresolved` (the\n * template fields the server could not fill). A 404 there means the app has\n * no Mail to draft into, and the tab says so instead of the controls.\n *\n * ```json\n * {\n * \"type\": \"mail\",\n * \"content\": {\n * \"heading\": \"Email\",\n * \"description\": \"Mail linked to this case\",\n * \"hint\": \"The draft opens in Nextcloud Mail.\",\n * \"templates\": { \"url\": \"/apps/app/api/types/@object.type/templates\", \"responsePath\": \"results\", \"labelField\": \"name\", \"idField\": \"id\", \"preselect\": \"first\" },\n * \"noTemplatesText\": \"No templates for this type yet\",\n * \"draft\": { \"url\": \"/apps/app/api/records/@objectId/templates/{templateId}/draft\", \"blankTemplateId\": \"blank\" },\n * \"closedWhen\": { \"field\": \"endDate\", \"op\": \"notEmpty\" },\n * \"linkedMail\": true,\n * \"headerActions\": [\"link\", \"compose\"]\n * }\n * }\n * ```\n *\n * URLs take the `@objectId` / `@object.<field>` tokens of `endpointSource`;\n * `{templateId}` in the draft URL is the chosen template's id, or\n * `blankTemplateId` for an empty draft. Without `templates` the row offers\n * the empty draft only; without `draft` there is no row. `templates.preselect`\n * picks a template when the list is read (`\"first\"`, `\"only\"` or\n * `{ field, value }`), so the template draft button is ready without a pick;\n * a pick still in the list is kept. `closedWhen` is a\n * local visibleWhen condition on the record that disables drafting.\n * `linkedMail: false` leaves the linked mail to a separate `email`\n * integration card. `headerActions` puts buttons beside the heading:\n * `compose` opens the empty draft (or Nextcloud Mail's composer when there\n * is no `draft`) and replaces the row's empty-draft button, unless\n * `draft.blankButton` is true (DqZaakEmail draws both); `link` opens the\n * linked mail's picker and needs the linked mail. The linked mail then drops\n * its own buttons. Texts go through the host's translate.\n */\nexport default {\n\tname: 'CnMailTab',\n\n\tcomponents: {\n\t\tCnEmailTab,\n\t\tCnEmptyContent,\n\t\tEmailEditOutline,\n\t\tEmailOffOutline,\n\t\tLinkVariant,\n\t\tNcButton,\n\t\tNcNoteCard,\n\t\tNcSelect,\n\t\tOpenInNew,\n\t},\n\n\tinject: {\n\t\t/** The detail page's object context (`{ objectId, object }`), for tokens. */\n\t\tcnObjectContext: { default: null },\n\t\t/** The host's translate, for the manifest texts. */\n\t\tcnTranslate: { default: () => (key) => key },\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * The widget config: `{ heading?, description?, hint?, templates?,\n\t\t * noTemplatesText?, draft?, closedWhen?, linkedMail?, headerActions? }`, as in the\n\t\t * component description and docs/components/cn-mail-tab.md.\n\t\t *\n\t\t * @type {object}\n\t\t */\n\t\tcontent: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/** The bound record's id, for `@objectId` and the linked mail. */\n\t\tobjectId: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** The bound record, for `@object.<field>` and `closedWhen`. */\n\t\tobjectData: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/** The bound record's register, for the linked mail. */\n\t\tregister: {\n\t\t\ttype: [String, Object],\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** The bound record's schema, for the linked mail. */\n\t\tschema: {\n\t\t\ttype: [String, Object],\n\t\t\tdefault: '',\n\t\t},\n\t},\n\n\temits: ['drafted'],\n\n\tdata() {\n\t\treturn {\n\t\t\ttemplates: [],\n\t\t\tselectedTemplate: null,\n\t\t\tdrafting: false,\n\t\t\terror: '',\n\t\t\tunresolved: [],\n\t\t\tunavailable: false,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** @return {object} The record, from the prop or the page context. */\n\t\trecord() {\n\t\t\tif (this.objectData) {\n\t\t\t\treturn this.objectData\n\t\t\t}\n\t\t\tconst ctx = this.cnObjectContext\n\t\t\tconst value = ctx && typeof ctx === 'object' && 'value' in ctx ? ctx.value : ctx\n\t\t\treturn (value && value.object) || {}\n\t\t},\n\n\t\t/** @return {string} The record id. */\n\t\tobjectKey() {\n\t\t\treturn keyOf(this.objectId) || keyOf(this.record.id) || keyOf(this.record['@self'] && this.record['@self'].id)\n\t\t},\n\n\t\t/** @return {string} The register slug or id, from the prop or else the record's own `@self`. */\n\t\tregisterKey() {\n\t\t\treturn keyOf(this.register) || keyOf(this.record['@self'] && this.record['@self'].register)\n\t\t},\n\n\t\t/** @return {string} The schema slug or id, from the prop or else the record's own `@self`. */\n\t\tschemaKey() {\n\t\t\treturn keyOf(this.schema) || keyOf(this.record['@self'] && this.record['@self'].schema)\n\t\t},\n\n\t\t/** @return {object} The token context for the URLs. */\n\t\ttokenContext() {\n\t\t\treturn { objectId: this.objectKey, object: this.record }\n\t\t},\n\n\t\t/** @return {string} The heading, translated, or ''. */\n\t\theading() {\n\t\t\treturn this.tr(this.content.heading)\n\t\t},\n\n\t\t/** @return {string} The line under the heading, translated, or ''. */\n\t\tdescription() {\n\t\t\treturn this.tr(this.content.description)\n\t\t},\n\n\t\t/** @return {string} The line under the template row, translated, or ''. */\n\t\thint() {\n\t\t\treturn this.tr(this.content.hint)\n\t\t},\n\n\t\t/** @return {object|null} The templates endpoint, or null. */\n\t\ttemplatesSource() {\n\t\t\tconst source = this.content.templates\n\t\t\treturn source && typeof source === 'object' && source.url ? source : null\n\t\t},\n\n\t\t/** @return {object|null} The draft endpoint, or null. */\n\t\tdraftSource() {\n\t\t\tconst source = this.content.draft\n\t\t\treturn source && typeof source === 'object' && source.url ? source : null\n\t\t},\n\n\t\t/** @return {boolean} Whether the template select and its button show. */\n\t\ttemplatesEnabled() {\n\t\t\treturn this.templatesSource !== null\n\t\t},\n\n\t\t/** @return {boolean} Whether the template row shows. */\n\t\tdraftEnabled() {\n\t\t\treturn this.draftSource !== null\n\t\t},\n\n\t\t/** @return {string} The template field shown in the select. */\n\t\ttemplateLabelField() {\n\t\t\treturn (this.templatesSource && this.templatesSource.labelField) || 'name'\n\t\t},\n\n\t\t/** @return {string} The template field that identifies it. */\n\t\ttemplateIdField() {\n\t\t\treturn (this.templatesSource && this.templatesSource.idField) || 'id'\n\t\t},\n\n\t\t/** @return {string} The select's placeholder. */\n\t\ttemplatePlaceholder() {\n\t\t\tif (this.templates.length === 0) {\n\t\t\t\treturn this.tr(this.content.noTemplatesText) || t('nextcloud-vue', 'No templates yet')\n\t\t\t}\n\t\t\treturn t('nextcloud-vue', 'Select a template (optional)…')\n\t\t},\n\n\t\t/** @return {boolean} Whether `closedWhen` holds for the record. */\n\t\tclosed() {\n\t\t\tconst cond = this.content.closedWhen\n\t\t\tif (!cond) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn evaluateVisibleWhenLocal(cond, this.record)\n\t\t},\n\n\t\t/** @return {string} The templates URL after tokens, to refetch on change. */\n\t\ttemplatesUrl() {\n\t\t\treturn this.templatesSource ? interpolateUrlTokens(this.templatesSource.url, this.tokenContext) : ''\n\t\t},\n\n\t\t/** @return {boolean} Whether the linked mail list shows. */\n\t\tlinkedMail() {\n\t\t\treturn this.content.linkedMail !== false\n\t\t},\n\n\t\t/**\n\t\t * The known header actions the config asks for.\n\t\t *\n\t\t * @return {string[]} `compose` and or `link`.\n\t\t * @spec openspec/changes/mail-tab-compose-and-link/specs/mail-tab-compose-and-link/spec.md#requirement-the-mail-tab-can-carry-compose-mail-and-link-mail-in-its-header\n\t\t */\n\t\theaderActions() {\n\t\t\tconst list = Array.isArray(this.content.headerActions) ? this.content.headerActions : []\n\t\t\treturn list.filter((key) => HEADER_ACTIONS.includes(key))\n\t\t},\n\n\t\t/** @return {boolean} Whether the header shows \"Compose mail\". */\n\t\tshowComposeAction() {\n\t\t\treturn this.headerActions.includes('compose')\n\t\t},\n\n\t\t/** @return {boolean} Whether the header shows \"Link mail\": it opens the linked mail's picker. */\n\t\tshowLinkAction() {\n\t\t\treturn this.headerActions.includes('link') && this.linkedMail && this.objectKey !== ''\n\t\t},\n\n\t\t/** @return {boolean} Whether the header holds any button. */\n\t\thasHeaderActions() {\n\t\t\treturn this.showComposeAction || this.showLinkAction\n\t\t},\n\n\t\t/** @return {string} Nextcloud Mail's composer, for an app without a draft endpoint. */\n\t\tcomposeUrl() {\n\t\t\treturn (typeof OC !== 'undefined' && typeof OC.generateUrl === 'function')\n\t\t\t\t? OC.generateUrl('/apps/mail/box/draft')\n\t\t\t\t: '/index.php/apps/mail/box/draft'\n\t\t},\n\t},\n\n\twatch: {\n\t\ttemplatesUrl: {\n\t\t\timmediate: true,\n\t\t\thandler() {\n\t\t\t\tthis.loadTemplates()\n\t\t\t},\n\t\t},\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * Translate a manifest text through the host.\n\t\t *\n\t\t * @param {string} text The text.\n\t\t * @return {string} The translation, or '' for no text.\n\t\t */\n\t\ttr(text) {\n\t\t\tif (typeof text !== 'string' || text === '') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\treturn this.cnTranslate(text)\n\t\t},\n\n\t\t/**\n\t\t * Read the templates. A failed read leaves the empty draft usable.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync loadTemplates() {\n\t\t\tif (!this.templatesSource) {\n\t\t\t\tthis.templates = []\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tconst payload = await fetchEndpointSource(this.templatesSource, this.tokenContext)\n\t\t\t\tconst list = Array.isArray(payload) ? payload : (payload && Array.isArray(payload.results) ? payload.results : [])\n\t\t\t\tthis.templates = list\n\t\t\t\tthis.applyPreselect()\n\t\t\t} catch (err) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.warn('[CnMailTab] could not read the templates', err)\n\t\t\t\tthis.templates = []\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Keep a pick that is still in the list; otherwise select what `templates.preselect` picks.\n\t\t *\n\t\t * @return {void}\n\t\t * @spec openspec/changes/mail-tab-template-preselect/specs/mail-tab-template-preselect/spec.md#requirement-the-mail-tab-can-preselect-a-template\n\t\t */\n\t\tapplyPreselect() {\n\t\t\tconst idField = this.templateIdField\n\t\t\tconst picked = this.selectedTemplate\n\t\t\tif (picked && this.templates.some((item) => item && item[idField] === picked[idField])) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.selectedTemplate = preselectedTemplate(this.templates, this.templatesSource && this.templatesSource.preselect)\n\t\t},\n\n\t\t/** @return {Promise<void>} */\n\t\tdraftFromTemplate() {\n\t\t\treturn this.openDraft(this.selectedTemplate)\n\t\t},\n\n\t\t/**\n\t\t * \"Compose mail\": the empty draft through the app's endpoint. Without\n\t\t * one the button is a link to Mail's composer and needs no handler.\n\t\t *\n\t\t * @return {Promise<void>|undefined}\n\t\t */\n\t\tonCompose() {\n\t\t\treturn this.draftEnabled ? this.draftBlank() : undefined\n\t\t},\n\n\t\t/**\n\t\t * \"Link mail\": the linked mail's picker, which links the chosen\n\t\t * message to the record through its own endpoint.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\topenLinkPicker() {\n\t\t\tconst linked = this.$refs.linkedMail\n\t\t\tif (linked && typeof linked.openPicker === 'function') {\n\t\t\t\tlinked.openPicker()\n\t\t\t}\n\t\t},\n\n\t\t/** @return {Promise<void>} */\n\t\tdraftBlank() {\n\t\t\tthis.selectedTemplate = null\n\t\t\treturn this.openDraft(null)\n\t\t},\n\n\t\t/**\n\t\t * Ask the app to create a Nextcloud Mail draft and open it.\n\t\t *\n\t\t * @param {object|null} template The chosen template, or null for an empty draft.\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync openDraft(template) {\n\t\t\tif (this.closed || !this.draftSource) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.drafting = true\n\t\t\tthis.error = ''\n\t\t\tthis.unresolved = []\n\t\t\ttry {\n\t\t\t\tconst id = template ? template[this.templateIdField] : (this.draftSource.blankTemplateId || 'blank')\n\t\t\t\tconst path = interpolateUrlTokens(this.draftSource.url, this.tokenContext)\n\t\t\t\t\t.replace('{templateId}', encodeURIComponent(String(id)))\n\t\t\t\tconst [{ default: axios }, { generateUrl }] = await Promise.all([\n\t\t\t\t\timport('@nextcloud/axios'),\n\t\t\t\t\timport('@nextcloud/router'),\n\t\t\t\t])\n\t\t\t\tconst { data } = await axios.post(generateUrl(path), {})\n\t\t\t\tthis.unresolved = Array.isArray(data && data.unresolved) ? data.unresolved : []\n\t\t\t\tif (data && data.draftUrl) {\n\t\t\t\t\twindow.open(data.draftUrl, '_blank', 'noopener')\n\t\t\t\t}\n\t\t\t\t/**\n\t\t\t\t * @event drafted A draft was made from a template. Carries the\n\t\t\t\t * draft endpoint's response, including `draftUrl` and\n\t\t\t\t * `unresolved` when the endpoint returns them.\n\t\t\t\t * @type {object}\n\t\t\t\t */\n\t\t\t\tthis.$emit('drafted', data)\n\t\t\t} catch (err) {\n\t\t\t\tconst response = err && err.response\n\t\t\t\tif (response && response.status === 404) {\n\t\t\t\t\tthis.unavailable = true\n\t\t\t\t}\n\t\t\t\tthis.error = (response && response.data && response.data.message)\n\t\t\t\t\t|| (err && err.message)\n\t\t\t\t\t|| t('nextcloud-vue', 'The draft could not be opened.')\n\t\t\t} finally {\n\t\t\t\tthis.drafting = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Write a template field the way the template spells it.\n\t\t *\n\t\t * @param {string} name The field name.\n\t\t * @return {string} `{{name}}`.\n\t\t */\n\t\tplaceholderOf(name) {\n\t\t\treturn `{{${name}}}`\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-mail-tab {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 16px;\n\tpadding: 12px;\n}\n\n.cn-mail-tab__header {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\talign-items: flex-start;\n\tjustify-content: space-between;\n\tgap: 10px 16px;\n}\n\n.cn-mail-tab__heading {\n\tdisplay: flex;\n\tflex: 1 1 260px;\n\tflex-direction: column;\n\tgap: 3px;\n\tmin-width: 0;\n}\n\n.cn-mail-tab__header-actions {\n\tdisplay: flex;\n\tflex: none;\n\tflex-wrap: wrap;\n\tgap: 8px;\n}\n\n.cn-mail-tab__title {\n\tmargin: 0;\n\tfont-size: 16px;\n\tfont-weight: bold;\n}\n\n.cn-mail-tab__subtitle,\n.cn-mail-tab__hint {\n\tmargin: 0;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-mail-tab__template-row {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\talign-items: flex-end;\n\tgap: 8px;\n}\n\n.cn-mail-tab__template-actions {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 8px;\n}\n\n.cn-mail-tab__template-select {\n\tflex: 1 1 260px;\n}\n\n.cn-mail-tab__unresolved {\n\tmargin: 4px 0 0;\n\tpadding-inline-start: 20px;\n}\n\n.cn-mail-tab__unresolved code {\n\tbackground: var(--color-background-dark);\n\tpadding: 2px 6px;\n\tborder-radius: var(--border-radius);\n\tfont-family: var(--font-face-mono, monospace);\n}\n</style>\n"],"names":["_openBlock","_createElementBlock","_createBlock","_createVNode","_toDisplayString","_createTextVNode","_createElementVNode","_Fragment","_renderList"],"mappings":";;;AASM,EAAA,KAAK,EAAC,aAAa;AAAC,EAAA,aAAW,EAAC,aAAa;;;;AAW1C,EAAA,KAAA,EAAA,qBAAA;AAAA,EAAA,aAAA,EAAA,oBAAA;;AACD,MAAA,UAAA,GAAA,EAAA,KAAM,EAAE,sBAAsB,GAAA;;;AACb,EAAA,KAAI,EAAC,oBAAoB;;;;AAKrB,EAAA,KAAK,EAAC,uBAAuB;;;;AAIzB,EAAA,KAAK,EAAC,6BAAG;;;;AA2Bd,EAAA,KAAK,EAAC,2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OAAO;;iCACZ,MAAW;kDAAR,KAAK,CAAA,KAAA,CAAA,EAAA,CAAA,YAAA;;;;;AAGF,UAAA,CAAA,KAAA,CAAA,UAAU,CAAC,MAAM,GAAA,CAAA;4BADvBF,WAWY,CAAA,qBAAA,EAAA;;AATZ,gBAAA,IAAI,EAAC,SAAS;AACb,gBAAA,IAAI,EAAA,QAAQ;AACX,gBAAA,aAAS,EAAC,wBAAwB;;uCAC/B;qCAAA,2BAAA,QAAA,CAAA,CAAA,CAAA,eAAA,EAAA,6EAAA,CAAA,CAAA,EAAA,CAAA,YAAA;AACL,kBAAAI,kBAAA,CAIK,MAJL,WAIK,EAAA;sCAHJL,kBAEK,CAAAM,QAAA,EAAA,IAAA,EAAAC,UAAA,CAFK,KAAA,CAAA,UAAA,EAAA,CAAA,IAAA,KAAA;2CAAVP,kBAEK,CAAA,IAAA,EAAA,EAFK,GAAA,EAAA,IAAA,EAAA,EAAA;;;;;;;;;AAOL,UAAA,CAAA,QAAA,CAAA,UAAU,IAAI,QAAA,CAAA,SAAA;4BADpBC;;AAEA,gBAAA,GAAG,EAAC,YAAY;AAChB,gBAAA,KAAK,EAAC,qBAAe;AACpB,gBAAA,WAAO,GAAA,QAAA,CAAA,gBAAA;AACP,gBAAA,QAAC,EAAA,QAAA,CAAA,SAAA;;;;;;;;;;;"}
|
|
@@ -2,7 +2,7 @@ import script from './CnModuleCard.vue2.js';
|
|
|
2
2
|
import { render } from './CnModuleCard.vue3.js';
|
|
3
3
|
|
|
4
4
|
script.render = render;
|
|
5
|
-
script.__scopeId = "data-v-
|
|
5
|
+
script.__scopeId = "data-v-430bcec8";
|
|
6
6
|
const __sfc_main = script;
|
|
7
7
|
|
|
8
8
|
export { __sfc_main as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CnModuleCard.vue2.js","sources":["../../../../src/components/CnModuleCard/CnModuleCard.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n<template>\n\t<article\n\t\tclass=\"cn-module-card\"\n\t\t:aria-labelledby=\"headingId\"\n\t\tdata-testid=\"cn-module-card\"\n\t\t:data-module-id=\"module.id\">\n\t\t<div class=\"cn-module-card__head\">\n\t\t\t<span\n\t\t\t\tv-if=\"module.icon\"\n\t\t\t\tclass=\"cn-module-card__icon\"\n\t\t\t\t:class=\"{ 'cn-module-card__icon--off': !module.enabled }\"\n\t\t\t\taria-hidden=\"true\">\n\t\t\t\t<CnIcon :name=\"module.icon\" :size=\"22\" />\n\t\t\t</span>\n\t\t\t<h3 :id=\"headingId\" class=\"cn-module-card__title\">\n\t\t\t\t{{ module.label }}\n\t\t\t</h3>\n\t\t\t<CnStatusBadge\n\t\t\t\tclass=\"cn-module-card__state\"\n\t\t\t\t:label=\"module.enabled ? t('nextcloud-vue', 'In the menu') : t('nextcloud-vue', 'Off')\"\n\t\t\t\t:variant=\"module.enabled ? 'success' : 'default'\"\n\t\t\t\tdata-testid=\"cn-module-card-state\" />\n\t\t</div>\n\t\t<p v-if=\"module.description\" class=\"cn-module-card__description\">\n\t\t\t{{ module.description }}\n\t\t</p>\n\t\t<template v-if=\"module.pages.length > 0\">\n\t\t\t<span class=\"cn-module-card__pages-line\" data-testid=\"cn-module-card-pages-line\">{{ pagesLine }}</span>\n\t\t\t<ul class=\"cn-module-card__pages\" :aria-label=\"t('nextcloud-vue', 'Pages')\">\n\t\t\t\t<li v-for=\"page in module.pages\" :key=\"page.key\">\n\t\t\t\t\t<a\n\t\t\t\t\t\tclass=\"cn-module-card__page\"\n\t\t\t\t\t\t:href=\"page.url\"\n\t\t\t\t\t\t@click=\"follow(page, $event)\">{{ page.label }}</a>\n\t\t\t\t</li>\n\t\t\t</ul>\n\t\t</template>\n\t\t<div v-if=\"module.open || (!module.enabled && module.settings)\" class=\"cn-module-card__footer\">\n\t\t\t<a\n\t\t\t\tv-if=\"module.open\"\n\t\t\t\tclass=\"cn-module-card__open\"\n\t\t\t\t:href=\"module.open.url\"\n\t\t\t\t:aria-label=\"t('nextcloud-vue', 'Open {module}', { module: module.label })\"\n\t\t\t\tdata-testid=\"cn-module-card-open\"\n\t\t\t\t@click=\"follow(module.open, $event)\">\n\t\t\t\t{{ t('nextcloud-vue', 'Open') }}\n\t\t\t\t<ChevronRight :size=\"18\" />\n\t\t\t</a>\n\t\t\t<span v-if=\"!module.enabled && module.settings\" class=\"cn-module-card__settings\" data-testid=\"cn-module-card-settings\">\n\t\t\t\t{{ module.settings.prefix || t('nextcloud-vue', 'Put it in the menu:') }}\n\t\t\t\t<a\n\t\t\t\t\t:href=\"module.settings.url\"\n\t\t\t\t\t:target=\"module.settings.external ? '_blank' : null\"\n\t\t\t\t\t:rel=\"module.settings.external ? 'noopener noreferrer' : null\"\n\t\t\t\t\t@click=\"follow(module.settings, $event)\">{{ module.settings.label || t('nextcloud-vue', 'Admin settings') }}</a>\n\t\t\t</span>\n\t\t</div>\n\t</article>\n</template>\n\n<script>\nimport { translatePlural as n, translate as t } from '@nextcloud/l10n'\nimport ChevronRight from 'vue-material-design-icons/ChevronRight.vue'\nimport CnStatusBadge from '../CnStatusBadge/CnStatusBadge.vue'\nimport { followLinkClick } from '../../utils/linkNavigation.js'\nimport { CnIcon } from '../CnIcon/index.js'\n\n/** A module with more pages than this names its highlights instead of every page. */\nconst LISTED_PAGES = 4\n\n/**\n * CnModuleCard - one module on a `type: \"links\"` page (board PqModules): an\n * icon, the title and a state badge (in the menu, or off), a description,\n * the module's pages as a line and as links, an Open button, and for a\n * module that is off a link to where an admin puts it in the menu.\n *\n * Rendered by CnLinkCardsPage for each entry of `config.modules`; the page\n * resolves the links and the text before handing the module over.\n *\n * @spec openspec/changes/screens-links-module-cards/specs/link-cards-page/spec.md#requirement-a-links-page-can-show-modules\n */\nexport default {\n\tname: 'CnModuleCard',\n\n\tcomponents: { ChevronRight, CnIcon, CnStatusBadge },\n\n\tprops: {\n\t\t/**\n\t\t * The resolved module: `{ id, label, description, icon, enabled,\n\t\t * pages: [{ key, label, url, location, highlight }], open: { url,\n\t\t * location }|null, settings: { url, location, external, label, prefix }|null }`.\n\t\t */\n\t\tmodule: {\n\t\t\ttype: Object,\n\t\t\trequired: true,\n\t\t},\n\n\t\t/** Id of the card's heading, unique on the page. */\n\t\theadingId: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * \"4 pages: Overview, Leads, Prospects, Pipeline\", or for a larger\n\t\t * module \"15 pages, including Campaigns, Blasts and Mailing lists\"\n\t\t * from the pages marked `highlight` (else the first three).\n\t\t *\n\t\t * @return {string} The line.\n\t\t */\n\t\tpagesLine() {\n\t\t\tconst pages = this.module.pages\n\t\t\tif (pages.length <= LISTED_PAGES) {\n\t\t\t\treturn n('nextcloud-vue', '%n page: {pages}', '%n pages: {pages}', pages.length, { pages: pages.map((page) => page.label).join(', ') })\n\t\t\t}\n\t\t\tconst marked = pages.filter((page) => page.highlight)\n\t\t\tconst named = (marked.length > 0 ? marked : pages).slice(0, 3).map((page) => page.label)\n\t\t\tconst last = named.pop()\n\t\t\tconst list = named.length > 0 ? t('nextcloud-vue', '{list} and {last}', { list: named.join(', '), last }) : last\n\t\t\treturn n('nextcloud-vue', '%n page, including {pages}', '%n pages, including {pages}', pages.length, { pages: list })\n\t\t},\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * Route a plain click on an in-app link, so the page does not reload.\n\t\t *\n\t\t * @param {{location: (object|null)}} target The resolved link.\n\t\t * @param {MouseEvent} event The click.\n\t\t */\n\t\tfollow(target, event) {\n\t\t\tif (target && target.location) {\n\t\t\t\tfollowLinkClick(event, target.location, this.$router)\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-module-card {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 12px;\n\tpadding: 20px;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius-container-large, 12px);\n\tbackground: var(--color-main-background);\n}\n\n.cn-module-card__head {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 12px;\n}\n\n.cn-module-card__icon {\n\tdisplay: flex;\n\tflex: none;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 42px;\n\theight: 42px;\n\tborder-radius: var(--border-radius-large, 10px);\n\tbackground: var(--color-primary-element-light);\n\tcolor: var(--color-primary-element-light-text, var(--color-primary-element));\n}\n\n.cn-module-card__title {\n\tflex: 1 1 auto;\n\tmargin: 0;\n\tfont-size: 17px;\n\tfont-weight: 700;\n\tline-height: normal;\n}\n\n.cn-module-card__state {\n\tflex: none;\n}\n\n.cn-module-card__description {\n\tmargin: 0;\n\tfont-size: 15px;\n\tline-height: 1.5;\n}\n\n.cn-module-card__pages-line {\n\tfont-size: 13px;\n\tline-height: normal;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-module-card__pages {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 6px 12px;\n\tmargin: 0;\n\tpadding: 0;\n\tlist-style: none;\n\tfont-size: 14px;\n\tline-height: normal;\n}\n\n.cn-module-card__page {\n\tfont-weight: 600;\n\tcolor: var(--color-primary-element);\n}\n\n.cn-module-card__footer {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\talign-items: center;\n\tgap: 8px 14px;\n\tmargin-top: auto;\n\tpadding-top: 4px;\n}\n\n.cn-module-card__open {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tgap: 6px;\n\tbox-sizing: border-box;\n\theight: 36px;\n\tpadding: 0 14px;\n\tfont-size: 14px;\n\tfont-weight: 600;\n\ttext-decoration: none;\n}\n\n.cn-module-card__open {\n\tborder: 1px solid var(--color-border-dark);\n\tborder-radius: var(--border-radius-element, 8px);\n\tbackground: var(--color-main-background);\n\tcolor: var(--color-main-text);\n}\n\n/* A theme that underlines every link (nldesign) must not reach the button. */\n.cn-module-card__open,\n.cn-module-card__open:hover,\n.cn-module-card__open:focus,\n.cn-module-card__open:active {\n\ttext-decoration: none !important;\n}\n\n.cn-module-card__icon--off {\n\tbackground: var(--color-background-dark);\n\tcolor: var(--color-main-text);\n}\n\n.cn-module-card__settings {\n\tfont-size: 13px;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-module-card__open:focus-visible,\n.cn-module-card__settings a:focus-visible,\n.cn-module-card__page:focus-visible {\n\toutline: 2px solid var(--color-primary-element);\n\toutline-offset: 2px;\n}\n</style>\n"],"names":["CnIcon","CnStatusBadge","n","t"],"mappings":";;;;;;AAuEA;AACA,MAAM,eAAe,EAAA;;AAErB;AACC;;;;AAIA;AACA;;AAEA;;;AAGD,aAAe;AACd,CAAA,IAAI,EAAE,cAAc;;CAEpB,UAAU,EAAE,EAAE,YAAY,UAAEA,UAAM,iBAAEC,cAAe;;AAEnD,CAAA,KAAK,EAAE;AACN;;;AAGC;;AAED,EAAA,MAAM,EAAE;GACP,IAAI,EAAE,MAAM;GACZ,QAAQ,EAAE,IAAI;GACd;;AAED;EACA,SAAS,EAAE;GACV,IAAI,EAAE,MAAM;GACZ,QAAQ,EAAE,IAAI;GACd;EACD;;AAED,CAAA,QAAQ,EAAE;AACT;;;;AAIC;;;EAGD,SAAS,GAAG;GACX,MAAM,KAAM,GAAE,IAAI,CAAC,MAAM,CAAC,MAAI;AAC9B,GAAA,IAAI,KAAK,CAAC,MAAK,IAAK,YAAY,EAAE;IACjC,OAAOC,eAAC,CAAC,eAAe,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAA,EAAG,CAAA;AACvI,IAAA;GACA,MAAM,MAAK,GAAI,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,SAAS,EAAA;AACpD,GAAA,MAAM,KAAI,GAAI,CAAC,MAAM,CAAC,SAAS,CAAA,GAAI,MAAK,GAAI,KAAK,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,KAAK,EAAA;AACvF,GAAA,MAAM,IAAK,GAAE,KAAK,CAAC,GAAG,GAAC;AACvB,GAAA,MAAM,IAAK,GAAE,KAAK,CAAC,MAAK,GAAI,CAAE,GAAEC,SAAC,CAAC,eAAe,EAAE,mBAAmB,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAK,EAAC,IAAI,KAAG;GAC/G,OAAOD,eAAC,CAAC,eAAe,EAAE,4BAA4B,EAAE,6BAA6B,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,IAAG,EAAG,CAAA;GACpH;EACD;;AAED,CAAA,OAAO,EAAE;KACRC,SAAC;;AAED;;AAEC;;AAEA;;AAED,EAAA,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE;GACrB,IAAI,MAAK,IAAK,MAAM,CAAC,QAAQ,EAAE;IAC9B,eAAe,CAAC,KAAK,EAAE,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAA;AACrD,IAAA;GACA;EACD;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"CnModuleCard.vue2.js","sources":["../../../../src/components/CnModuleCard/CnModuleCard.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n<template>\n\t<article\n\t\tclass=\"cn-module-card\"\n\t\t:aria-labelledby=\"headingId\"\n\t\tdata-testid=\"cn-module-card\"\n\t\t:data-module-id=\"module.id\">\n\t\t<div class=\"cn-module-card__head\">\n\t\t\t<span\n\t\t\t\tv-if=\"module.icon\"\n\t\t\t\tclass=\"cn-module-card__icon\"\n\t\t\t\t:class=\"{ 'cn-module-card__icon--off': !module.enabled }\"\n\t\t\t\taria-hidden=\"true\">\n\t\t\t\t<CnIcon :name=\"module.icon\" :size=\"22\" />\n\t\t\t</span>\n\t\t\t<h3 :id=\"headingId\" class=\"cn-module-card__title\">\n\t\t\t\t{{ module.label }}\n\t\t\t</h3>\n\t\t\t<CnStatusBadge\n\t\t\t\tclass=\"cn-module-card__state\"\n\t\t\t\t:label=\"module.enabled ? t('nextcloud-vue', 'In the menu') : t('nextcloud-vue', 'Off')\"\n\t\t\t\t:variant=\"module.enabled ? 'success' : 'default'\"\n\t\t\t\tdata-testid=\"cn-module-card-state\" />\n\t\t</div>\n\t\t<p v-if=\"module.description\" class=\"cn-module-card__description\">\n\t\t\t{{ module.description }}\n\t\t</p>\n\t\t<template v-if=\"module.pages.length > 0\">\n\t\t\t<span class=\"cn-module-card__pages-line\" data-testid=\"cn-module-card-pages-line\">{{ pagesLine }}</span>\n\t\t\t<ul class=\"cn-module-card__pages\" :aria-label=\"t('nextcloud-vue', 'Pages')\">\n\t\t\t\t<li v-for=\"page in module.pages\" :key=\"page.key\">\n\t\t\t\t\t<a\n\t\t\t\t\t\tclass=\"cn-module-card__page\"\n\t\t\t\t\t\t:href=\"page.url\"\n\t\t\t\t\t\t@click=\"follow(page, $event)\">{{ page.label }}</a>\n\t\t\t\t</li>\n\t\t\t</ul>\n\t\t</template>\n\t\t<div v-if=\"module.open || (!module.enabled && module.settings)\" class=\"cn-module-card__footer\">\n\t\t\t<a\n\t\t\t\tv-if=\"module.open\"\n\t\t\t\tclass=\"cn-module-card__open\"\n\t\t\t\t:href=\"module.open.url\"\n\t\t\t\t:aria-label=\"t('nextcloud-vue', 'Open {module}', { module: module.label })\"\n\t\t\t\tdata-testid=\"cn-module-card-open\"\n\t\t\t\t@click=\"follow(module.open, $event)\">\n\t\t\t\t{{ t('nextcloud-vue', 'Open') }}\n\t\t\t\t<ChevronRight :size=\"18\" />\n\t\t\t</a>\n\t\t\t<span v-if=\"!module.enabled && module.settings\" class=\"cn-module-card__settings\" data-testid=\"cn-module-card-settings\">\n\t\t\t\t{{ module.settings.prefix || t('nextcloud-vue', 'Put it in the menu:') }}\n\t\t\t\t<a\n\t\t\t\t\t:href=\"module.settings.url\"\n\t\t\t\t\t:target=\"module.settings.external ? '_blank' : null\"\n\t\t\t\t\t:rel=\"module.settings.external ? 'noopener noreferrer' : null\"\n\t\t\t\t\t@click=\"follow(module.settings, $event)\">{{ module.settings.label || t('nextcloud-vue', 'Admin settings') }}</a>\n\t\t\t</span>\n\t\t</div>\n\t</article>\n</template>\n\n<script>\nimport { translatePlural as n, translate as t } from '@nextcloud/l10n'\nimport ChevronRight from 'vue-material-design-icons/ChevronRight.vue'\nimport CnStatusBadge from '../CnStatusBadge/CnStatusBadge.vue'\nimport { followLinkClick } from '../../utils/linkNavigation.js'\nimport { CnIcon } from '../CnIcon/index.js'\n\n/** A module with more pages than this names its highlights instead of every page. */\nconst LISTED_PAGES = 4\n\n/**\n * CnModuleCard - one module on a `type: \"links\"` page (board PqModules): an\n * icon, the title and a state badge (in the menu, or off), a description,\n * the module's pages as a line and as links, an Open button, and for a\n * module that is off a link to where an admin puts it in the menu.\n *\n * Rendered by CnLinkCardsPage for each entry of `config.modules`; the page\n * resolves the links and the text before handing the module over.\n *\n * @spec openspec/changes/screens-links-module-cards/specs/link-cards-page/spec.md#requirement-a-links-page-can-show-modules\n */\nexport default {\n\tname: 'CnModuleCard',\n\n\tcomponents: { ChevronRight, CnIcon, CnStatusBadge },\n\n\tprops: {\n\t\t/**\n\t\t * The resolved module: `{ id, label, description, icon, enabled,\n\t\t * pages: [{ key, label, url, location, highlight }], open: { url,\n\t\t * location }|null, settings: { url, location, external, label, prefix }|null }`.\n\t\t */\n\t\tmodule: {\n\t\t\ttype: Object,\n\t\t\trequired: true,\n\t\t},\n\n\t\t/** Id of the card's heading, unique on the page. */\n\t\theadingId: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * \"4 pages: Overview, Leads, Prospects, Pipeline\", or for a larger\n\t\t * module \"15 pages, including Campaigns, Blasts and Mailing lists\"\n\t\t * from the pages marked `highlight` (else the first three).\n\t\t *\n\t\t * @return {string} The line.\n\t\t */\n\t\tpagesLine() {\n\t\t\tconst pages = this.module.pages\n\t\t\tif (pages.length <= LISTED_PAGES) {\n\t\t\t\treturn n('nextcloud-vue', '%n page: {pages}', '%n pages: {pages}', pages.length, { pages: pages.map((page) => page.label).join(', ') })\n\t\t\t}\n\t\t\tconst marked = pages.filter((page) => page.highlight)\n\t\t\tconst named = (marked.length > 0 ? marked : pages).slice(0, 3).map((page) => page.label)\n\t\t\tconst last = named.pop()\n\t\t\tconst list = named.length > 0 ? t('nextcloud-vue', '{list} and {last}', { list: named.join(', '), last }) : last\n\t\t\treturn n('nextcloud-vue', '%n page, including {pages}', '%n pages, including {pages}', pages.length, { pages: list })\n\t\t},\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * Route a plain click on an in-app link, so the page does not reload.\n\t\t *\n\t\t * @param {{location: (object|null)}} target The resolved link.\n\t\t * @param {MouseEvent} event The click.\n\t\t */\n\t\tfollow(target, event) {\n\t\t\tif (target && target.location) {\n\t\t\t\tfollowLinkClick(event, target.location, this.$router)\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-module-card {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 12px;\n\tpadding: 20px;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius-container-large, 12px);\n\tbackground: var(--color-main-background);\n}\n\n.cn-module-card__head {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 12px;\n}\n\n.cn-module-card__icon {\n\tdisplay: flex;\n\tflex: none;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 42px;\n\theight: 42px;\n\tborder-radius: var(--border-radius-large, 10px);\n\tbackground: var(--color-primary-element-light);\n\tcolor: var(--color-primary-element-light-text, var(--color-primary-element));\n}\n\n.cn-module-card__title {\n\tflex: 1 1 auto;\n\tmargin: 0;\n\tfont-size: 17px;\n\tfont-weight: 700;\n\tline-height: normal;\n}\n\n.cn-module-card__state {\n\tflex: none;\n}\n\n.cn-module-card__description {\n\tmargin: 0;\n\tfont-size: 15px;\n\tline-height: 1.5;\n}\n\n.cn-module-card__pages-line {\n\tfont-size: 13px;\n\tline-height: normal;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-module-card__pages {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 6px 12px;\n\tmargin: 0;\n\tpadding: 0;\n\tlist-style: none;\n\tfont-size: 14px;\n\tline-height: normal;\n}\n\n.cn-module-card__page {\n\tfont-weight: 600;\n\tcolor: var(--color-primary-element);\n}\n\n.cn-module-card__footer {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\talign-items: center;\n\tgap: 8px 14px;\n\tmargin-top: auto;\n\tpadding-top: 4px;\n}\n\n.cn-module-card__open {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tgap: 6px;\n\tbox-sizing: border-box;\n\theight: 36px;\n\tpadding: 0 14px;\n\tfont-size: 14px;\n\tfont-weight: 600;\n\ttext-decoration: none;\n}\n\n/* The theme paints every link in its link colour (`!important`, through its\n link tokens); the button hands it the main ink. */\n.cn-module-card__open {\n\t--nldesign-color-on-surface: var(--color-main-text);\n\t--nldesign-component-link-color: var(--color-main-text);\n\tborder: 1px solid var(--color-border-dark);\n\tborder-radius: var(--border-radius-element, 8px);\n\tbackground: var(--color-main-background);\n\tcolor: var(--color-main-text);\n}\n\n/* A theme that underlines every link (nldesign) must not reach the button. */\n.cn-module-card__open,\n.cn-module-card__open:hover,\n.cn-module-card__open:focus,\n.cn-module-card__open:active {\n\ttext-decoration: none !important;\n}\n\n.cn-module-card__icon--off {\n\tbackground: var(--color-background-dark);\n\tcolor: var(--color-main-text);\n}\n\n.cn-module-card__settings {\n\tfont-size: 13px;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-module-card__open:focus-visible,\n.cn-module-card__settings a:focus-visible,\n.cn-module-card__page:focus-vis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AC,MAAK,GAAI,CAAE,GAAEC,SAAC,CAAC,eAAe,EAAE,mBAAmB,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAK,EAAC,IAAI,KAAG;GAC/G,OAAOD,eAAC,CAAC,eAAe,EAAE,4BAA4B,EAAE,6BAA6B,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,IAAG,EAAG,CAAA;GACpH;EACD;;AAED,CAAA,OAAO,EAAE;KACRC,SAAC;;AAED;;AAEC;;AAEA;;AAED,EAAA,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE;GACrB,IAAI,MAAK,IAAK,MAAM,CAAC,QAAQ,EAAE;IAC9B,eAAe,CAAC,KAAK,EAAE,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,EAAA;AACrD,IAAA;GACA;EACD;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CnModuleCard.vue3.js","sources":["../../../../src/components/CnModuleCard/CnModuleCard.vue?vue&type=template&id=2814368c&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n<template>\n\t<article\n\t\tclass=\"cn-module-card\"\n\t\t:aria-labelledby=\"headingId\"\n\t\tdata-testid=\"cn-module-card\"\n\t\t:data-module-id=\"module.id\">\n\t\t<div class=\"cn-module-card__head\">\n\t\t\t<span\n\t\t\t\tv-if=\"module.icon\"\n\t\t\t\tclass=\"cn-module-card__icon\"\n\t\t\t\t:class=\"{ 'cn-module-card__icon--off': !module.enabled }\"\n\t\t\t\taria-hidden=\"true\">\n\t\t\t\t<CnIcon :name=\"module.icon\" :size=\"22\" />\n\t\t\t</span>\n\t\t\t<h3 :id=\"headingId\" class=\"cn-module-card__title\">\n\t\t\t\t{{ module.label }}\n\t\t\t</h3>\n\t\t\t<CnStatusBadge\n\t\t\t\tclass=\"cn-module-card__state\"\n\t\t\t\t:label=\"module.enabled ? t('nextcloud-vue', 'In the menu') : t('nextcloud-vue', 'Off')\"\n\t\t\t\t:variant=\"module.enabled ? 'success' : 'default'\"\n\t\t\t\tdata-testid=\"cn-module-card-state\" />\n\t\t</div>\n\t\t<p v-if=\"module.description\" class=\"cn-module-card__description\">\n\t\t\t{{ module.description }}\n\t\t</p>\n\t\t<template v-if=\"module.pages.length > 0\">\n\t\t\t<span class=\"cn-module-card__pages-line\" data-testid=\"cn-module-card-pages-line\">{{ pagesLine }}</span>\n\t\t\t<ul class=\"cn-module-card__pages\" :aria-label=\"t('nextcloud-vue', 'Pages')\">\n\t\t\t\t<li v-for=\"page in module.pages\" :key=\"page.key\">\n\t\t\t\t\t<a\n\t\t\t\t\t\tclass=\"cn-module-card__page\"\n\t\t\t\t\t\t:href=\"page.url\"\n\t\t\t\t\t\t@click=\"follow(page, $event)\">{{ page.label }}</a>\n\t\t\t\t</li>\n\t\t\t</ul>\n\t\t</template>\n\t\t<div v-if=\"module.open || (!module.enabled && module.settings)\" class=\"cn-module-card__footer\">\n\t\t\t<a\n\t\t\t\tv-if=\"module.open\"\n\t\t\t\tclass=\"cn-module-card__open\"\n\t\t\t\t:href=\"module.open.url\"\n\t\t\t\t:aria-label=\"t('nextcloud-vue', 'Open {module}', { module: module.label })\"\n\t\t\t\tdata-testid=\"cn-module-card-open\"\n\t\t\t\t@click=\"follow(module.open, $event)\">\n\t\t\t\t{{ t('nextcloud-vue', 'Open') }}\n\t\t\t\t<ChevronRight :size=\"18\" />\n\t\t\t</a>\n\t\t\t<span v-if=\"!module.enabled && module.settings\" class=\"cn-module-card__settings\" data-testid=\"cn-module-card-settings\">\n\t\t\t\t{{ module.settings.prefix || t('nextcloud-vue', 'Put it in the menu:') }}\n\t\t\t\t<a\n\t\t\t\t\t:href=\"module.settings.url\"\n\t\t\t\t\t:target=\"module.settings.external ? '_blank' : null\"\n\t\t\t\t\t:rel=\"module.settings.external ? 'noopener noreferrer' : null\"\n\t\t\t\t\t@click=\"follow(module.settings, $event)\">{{ module.settings.label || t('nextcloud-vue', 'Admin settings') }}</a>\n\t\t\t</span>\n\t\t</div>\n\t</article>\n</template>\n\n<script>\nimport { translatePlural as n, translate as t } from '@nextcloud/l10n'\nimport ChevronRight from 'vue-material-design-icons/ChevronRight.vue'\nimport CnStatusBadge from '../CnStatusBadge/CnStatusBadge.vue'\nimport { followLinkClick } from '../../utils/linkNavigation.js'\nimport { CnIcon } from '../CnIcon/index.js'\n\n/** A module with more pages than this names its highlights instead of every page. */\nconst LISTED_PAGES = 4\n\n/**\n * CnModuleCard - one module on a `type: \"links\"` page (board PqModules): an\n * icon, the title and a state badge (in the menu, or off), a description,\n * the module's pages as a line and as links, an Open button, and for a\n * module that is off a link to where an admin puts it in the menu.\n *\n * Rendered by CnLinkCardsPage for each entry of `config.modules`; the page\n * resolves the links and the text before handing the module over.\n *\n * @spec openspec/changes/screens-links-module-cards/specs/link-cards-page/spec.md#requirement-a-links-page-can-show-modules\n */\nexport default {\n\tname: 'CnModuleCard',\n\n\tcomponents: { ChevronRight, CnIcon, CnStatusBadge },\n\n\tprops: {\n\t\t/**\n\t\t * The resolved module: `{ id, label, description, icon, enabled,\n\t\t * pages: [{ key, label, url, location, highlight }], open: { url,\n\t\t * location }|null, settings: { url, location, external, label, prefix }|null }`.\n\t\t */\n\t\tmodule: {\n\t\t\ttype: Object,\n\t\t\trequired: true,\n\t\t},\n\n\t\t/** Id of the card's heading, unique on the page. */\n\t\theadingId: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * \"4 pages: Overview, Leads, Prospects, Pipeline\", or for a larger\n\t\t * module \"15 pages, including Campaigns, Blasts and Mailing lists\"\n\t\t * from the pages marked `highlight` (else the first three).\n\t\t *\n\t\t * @return {string} The line.\n\t\t */\n\t\tpagesLine() {\n\t\t\tconst pages = this.module.pages\n\t\t\tif (pages.length <= LISTED_PAGES) {\n\t\t\t\treturn n('nextcloud-vue', '%n page: {pages}', '%n pages: {pages}', pages.length, { pages: pages.map((page) => page.label).join(', ') })\n\t\t\t}\n\t\t\tconst marked = pages.filter((page) => page.highlight)\n\t\t\tconst named = (marked.length > 0 ? marked : pages).slice(0, 3).map((page) => page.label)\n\t\t\tconst last = named.pop()\n\t\t\tconst list = named.length > 0 ? t('nextcloud-vue', '{list} and {last}', { list: named.join(', '), last }) : last\n\t\t\treturn n('nextcloud-vue', '%n page, including {pages}', '%n pages, including {pages}', pages.length, { pages: list })\n\t\t},\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * Route a plain click on an in-app link, so the page does not reload.\n\t\t *\n\t\t * @param {{location: (object|null)}} target The resolved link.\n\t\t * @param {MouseEvent} event The click.\n\t\t */\n\t\tfollow(target, event) {\n\t\t\tif (target && target.location) {\n\t\t\t\tfollowLinkClick(event, target.location, this.$router)\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-module-card {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 12px;\n\tpadding: 20px;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius-container-large, 12px);\n\tbackground: var(--color-main-background);\n}\n\n.cn-module-card__head {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 12px;\n}\n\n.cn-module-card__icon {\n\tdisplay: flex;\n\tflex: none;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 42px;\n\theight: 42px;\n\tborder-radius: var(--border-radius-large, 10px);\n\tbackground: var(--color-primary-element-light);\n\tcolor: var(--color-primary-element-light-text, var(--color-primary-element));\n}\n\n.cn-module-card__title {\n\tflex: 1 1 auto;\n\tmargin: 0;\n\tfont-size: 17px;\n\tfont-weight: 700;\n\tline-height: normal;\n}\n\n.cn-module-card__state {\n\tflex: none;\n}\n\n.cn-module-card__description {\n\tmargin: 0;\n\tfont-size: 15px;\n\tline-height: 1.5;\n}\n\n.cn-module-card__pages-line {\n\tfont-size: 13px;\n\tline-height: normal;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-module-card__pages {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 6px 12px;\n\tmargin: 0;\n\tpadding: 0;\n\tlist-style: none;\n\tfont-size: 14px;\n\tline-height: normal;\n}\n\n.cn-module-card__page {\n\tfont-weight: 600;\n\tcolor: var(--color-primary-element);\n}\n\n.cn-module-card__footer {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\talign-items: center;\n\tgap: 8px 14px;\n\tmargin-top: auto;\n\tpadding-top: 4px;\n}\n\n.cn-module-card__open {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tgap: 6px;\n\tbox-sizing: border-box;\n\theight: 36px;\n\tpadding: 0 14px;\n\tfont-size: 14px;\n\tfont-weight: 600;\n\ttext-decoration: none;\n}\n\n.cn-module-card__open {\n\tborder: 1px solid var(--color-border-dark);\n\tborder-radius: var(--border-radius-element, 8px);\n\tbackground: var(--color-main-background);\n\tcolor: var(--color-main-text);\n}\n\n/* A theme that underlines every link (nldesign) must not reach the button. */\n.cn-module-card__open,\n.cn-module-card__open:hover,\n.cn-module-card__open:focus,\n.cn-module-card__open:active {\n\ttext-decoration: none !important;\n}\n\n.cn-module-card__icon--off {\n\tbackground: var(--color-background-dark);\n\tcolor: var(--color-main-text);\n}\n\n.cn-module-card__settings {\n\tfont-size: 13px;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-module-card__open:focus-visible,\n.cn-module-card__settings a:focus-visible,\n.cn-module-card__page:focus-visible {\n\toutline: 2px solid var(--color-primary-element);\n\toutline-offset: 2px;\n}\n</style>\n"],"names":["_createElementBlock","_normalizeClass","_createVNode","_toDisplayString","_Fragment","_createElementVNode","_renderList","_createTextVNode"],"mappings":";;;AAcO,MAAA,UAAA,GAAA,EAAA,KAAK,EAAE,sBAAqB,GAAA;;;;AAiBJ,EAAA,KAAK,EAAC,6BAA6B;;;AAIzD,EAAA,KAAK,EAAC,4BAAkB;AAA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EAAA,MAAA,EAAA,MAAA,CAAA,MAAA,CAAA,KAAA,EAAA,CAAA;AAC1B,gBAAA,aAAE,EAAA,qBAAA;AACD,gBAAA,OAAK,uCAAE,QAAM,CAAA,MAAA,CAAC,aAAM,CAAC,IAAK,EAAC,MAAM,CAAA,CAAA,CAAA;;AAC/B,gBAAAO,eAAA,CAAAJ,eAAA,CAAA,QAAA,CAAA,CAAC,6BAA4B,GAChC,EAAA,CAAA,YAAA;gBAAAD,WAAC,CAAA,uBAAA,EAAA,EAAA,IAAA,EAAA,EAAA,EAAA,CAAA;;;AAEW,UAAA,CAAA,CAAA,MAAA,CAAA,MAAM,CAAC,OAAO,IAAI,MAAA,CAAA,MAAO,CAAA;;AAClC,gBAAAK,eAAA,CAAAJ,eAAA,CAAA,MAAA,CAAA,MAAM,CAAC,QAAQ,CAAC,MAAM,IAAI,QAAA,CAAA,CAAC,4CAAgC;;AAE5D,kBAAA,IAAG,EAAA,MAAA,CAAA,MAAA,CAAA,QAAA,CAAA,GAAA;AACH,kBAAA,MAAC,EAAA,MAAA,CAAA,MAAA,CAAA,QAAA,CAAA,QAAA,GAAA,QAAA,GAAA,IAAA;AACD,kBAAA,GAAG,EAAC,MAAA,CAAA,MAAA,CAAA,QAAA,CAAA,QAAA,GAAA,qBAAA,GAAA,IAAA;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"CnModuleCard.vue3.js","sources":["../../../../src/components/CnModuleCard/CnModuleCard.vue?vue&type=template&id=430bcec8&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n<template>\n\t<article\n\t\tclass=\"cn-module-card\"\n\t\t:aria-labelledby=\"headingId\"\n\t\tdata-testid=\"cn-module-card\"\n\t\t:data-module-id=\"module.id\">\n\t\t<div class=\"cn-module-card__head\">\n\t\t\t<span\n\t\t\t\tv-if=\"module.icon\"\n\t\t\t\tclass=\"cn-module-card__icon\"\n\t\t\t\t:class=\"{ 'cn-module-card__icon--off': !module.enabled }\"\n\t\t\t\taria-hidden=\"true\">\n\t\t\t\t<CnIcon :name=\"module.icon\" :size=\"22\" />\n\t\t\t</span>\n\t\t\t<h3 :id=\"headingId\" class=\"cn-module-card__title\">\n\t\t\t\t{{ module.label }}\n\t\t\t</h3>\n\t\t\t<CnStatusBadge\n\t\t\t\tclass=\"cn-module-card__state\"\n\t\t\t\t:label=\"module.enabled ? t('nextcloud-vue', 'In the menu') : t('nextcloud-vue', 'Off')\"\n\t\t\t\t:variant=\"module.enabled ? 'success' : 'default'\"\n\t\t\t\tdata-testid=\"cn-module-card-state\" />\n\t\t</div>\n\t\t<p v-if=\"module.description\" class=\"cn-module-card__description\">\n\t\t\t{{ module.description }}\n\t\t</p>\n\t\t<template v-if=\"module.pages.length > 0\">\n\t\t\t<span class=\"cn-module-card__pages-line\" data-testid=\"cn-module-card-pages-line\">{{ pagesLine }}</span>\n\t\t\t<ul class=\"cn-module-card__pages\" :aria-label=\"t('nextcloud-vue', 'Pages')\">\n\t\t\t\t<li v-for=\"page in module.pages\" :key=\"page.key\">\n\t\t\t\t\t<a\n\t\t\t\t\t\tclass=\"cn-module-card__page\"\n\t\t\t\t\t\t:href=\"page.url\"\n\t\t\t\t\t\t@click=\"follow(page, $event)\">{{ page.label }}</a>\n\t\t\t\t</li>\n\t\t\t</ul>\n\t\t</template>\n\t\t<div v-if=\"module.open || (!module.enabled && module.settings)\" class=\"cn-module-card__footer\">\n\t\t\t<a\n\t\t\t\tv-if=\"module.open\"\n\t\t\t\tclass=\"cn-module-card__open\"\n\t\t\t\t:href=\"module.open.url\"\n\t\t\t\t:aria-label=\"t('nextcloud-vue', 'Open {module}', { module: module.label })\"\n\t\t\t\tdata-testid=\"cn-module-card-open\"\n\t\t\t\t@click=\"follow(module.open, $event)\">\n\t\t\t\t{{ t('nextcloud-vue', 'Open') }}\n\t\t\t\t<ChevronRight :size=\"18\" />\n\t\t\t</a>\n\t\t\t<span v-if=\"!module.enabled && module.settings\" class=\"cn-module-card__settings\" data-testid=\"cn-module-card-settings\">\n\t\t\t\t{{ module.settings.prefix || t('nextcloud-vue', 'Put it in the menu:') }}\n\t\t\t\t<a\n\t\t\t\t\t:href=\"module.settings.url\"\n\t\t\t\t\t:target=\"module.settings.external ? '_blank' : null\"\n\t\t\t\t\t:rel=\"module.settings.external ? 'noopener noreferrer' : null\"\n\t\t\t\t\t@click=\"follow(module.settings, $event)\">{{ module.settings.label || t('nextcloud-vue', 'Admin settings') }}</a>\n\t\t\t</span>\n\t\t</div>\n\t</article>\n</template>\n\n<script>\nimport { translatePlural as n, translate as t } from '@nextcloud/l10n'\nimport ChevronRight from 'vue-material-design-icons/ChevronRight.vue'\nimport CnStatusBadge from '../CnStatusBadge/CnStatusBadge.vue'\nimport { followLinkClick } from '../../utils/linkNavigation.js'\nimport { CnIcon } from '../CnIcon/index.js'\n\n/** A module with more pages than this names its highlights instead of every page. */\nconst LISTED_PAGES = 4\n\n/**\n * CnModuleCard - one module on a `type: \"links\"` page (board PqModules): an\n * icon, the title and a state badge (in the menu, or off), a description,\n * the module's pages as a line and as links, an Open button, and for a\n * module that is off a link to where an admin puts it in the menu.\n *\n * Rendered by CnLinkCardsPage for each entry of `config.modules`; the page\n * resolves the links and the text before handing the module over.\n *\n * @spec openspec/changes/screens-links-module-cards/specs/link-cards-page/spec.md#requirement-a-links-page-can-show-modules\n */\nexport default {\n\tname: 'CnModuleCard',\n\n\tcomponents: { ChevronRight, CnIcon, CnStatusBadge },\n\n\tprops: {\n\t\t/**\n\t\t * The resolved module: `{ id, label, description, icon, enabled,\n\t\t * pages: [{ key, label, url, location, highlight }], open: { url,\n\t\t * location }|null, settings: { url, location, external, label, prefix }|null }`.\n\t\t */\n\t\tmodule: {\n\t\t\ttype: Object,\n\t\t\trequired: true,\n\t\t},\n\n\t\t/** Id of the card's heading, unique on the page. */\n\t\theadingId: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * \"4 pages: Overview, Leads, Prospects, Pipeline\", or for a larger\n\t\t * module \"15 pages, including Campaigns, Blasts and Mailing lists\"\n\t\t * from the pages marked `highlight` (else the first three).\n\t\t *\n\t\t * @return {string} The line.\n\t\t */\n\t\tpagesLine() {\n\t\t\tconst pages = this.module.pages\n\t\t\tif (pages.length <= LISTED_PAGES) {\n\t\t\t\treturn n('nextcloud-vue', '%n page: {pages}', '%n pages: {pages}', pages.length, { pages: pages.map((page) => page.label).join(', ') })\n\t\t\t}\n\t\t\tconst marked = pages.filter((page) => page.highlight)\n\t\t\tconst named = (marked.length > 0 ? marked : pages).slice(0, 3).map((page) => page.label)\n\t\t\tconst last = named.pop()\n\t\t\tconst list = named.length > 0 ? t('nextcloud-vue', '{list} and {last}', { list: named.join(', '), last }) : last\n\t\t\treturn n('nextcloud-vue', '%n page, including {pages}', '%n pages, including {pages}', pages.length, { pages: list })\n\t\t},\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * Route a plain click on an in-app link, so the page does not reload.\n\t\t *\n\t\t * @param {{location: (object|null)}} target The resolved link.\n\t\t * @param {MouseEvent} event The click.\n\t\t */\n\t\tfollow(target, event) {\n\t\t\tif (target && target.location) {\n\t\t\t\tfollowLinkClick(event, target.location, this.$router)\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-module-card {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 12px;\n\tpadding: 20px;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius-container-large, 12px);\n\tbackground: var(--color-main-background);\n}\n\n.cn-module-card__head {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 12px;\n}\n\n.cn-module-card__icon {\n\tdisplay: flex;\n\tflex: none;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 42px;\n\theight: 42px;\n\tborder-radius: var(--border-radius-large, 10px);\n\tbackground: var(--color-primary-element-light);\n\tcolor: var(--color-primary-element-light-text, var(--color-primary-element));\n}\n\n.cn-module-card__title {\n\tflex: 1 1 auto;\n\tmargin: 0;\n\tfont-size: 17px;\n\tfont-weight: 700;\n\tline-height: normal;\n}\n\n.cn-module-card__state {\n\tflex: none;\n}\n\n.cn-module-card__description {\n\tmargin: 0;\n\tfont-size: 15px;\n\tline-height: 1.5;\n}\n\n.cn-module-card__pages-line {\n\tfont-size: 13px;\n\tline-height: normal;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-module-card__pages {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 6px 12px;\n\tmargin: 0;\n\tpadding: 0;\n\tlist-style: none;\n\tfont-size: 14px;\n\tline-height: normal;\n}\n\n.cn-module-card__page {\n\tfont-weight: 600;\n\tcolor: var(--color-primary-element);\n}\n\n.cn-module-card__footer {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\talign-items: center;\n\tgap: 8px 14px;\n\tmargin-top: auto;\n\tpadding-top: 4px;\n}\n\n.cn-module-card__open {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tgap: 6px;\n\tbox-sizing: border-box;\n\theight: 36px;\n\tpadding: 0 14px;\n\tfont-size: 14px;\n\tfont-weight: 600;\n\ttext-decoration: none;\n}\n\n/* The theme paints every link in its link colour (`!important`, through its\n link tokens); the button hands it the main ink. */\n.cn-module-card__open {\n\t--nldesign-color-on-surface: var(--color-main-text);\n\t--nldesign-component-link-color: var(--color-main-text);\n\tborder: 1px solid var(--color-border-dark);\n\tborder-radius: var(--border-radius-element, 8px);\n\tbackground: var(--color-main-background);\n\tcolor: var(--color-main-text);\n}\n\n/* A theme that underlines every link (nldesign) must not reach the button. */\n.cn-module-card__open,\n.cn-module-card__open:hover,\n.cn-module-card__open:focus,\n.cn-module-card__open:active {\n\ttext-decoration: none !important;\n}\n\n.cn-module-card__icon--off {\n\tbackground: var(--color-background-dark);\n\tcolor: var(--color-main-text);\n}\n\n.cn-module-card__settings {\n\tfont-size: 13px;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-module-card__open:focus-visible,\n.cn-module-card__settings a:focus-visible,\n.cn-module-card__page:focus-visible {\n\toutline: 2px solid var(--color-primary-element);\n\toutline-offset: 2px;\n}\n</style>\n"],"names":["_createElementBlock","_normalizeClass","_createVNode","_toDisplayString","_Fragment","_createElementVNode","_renderList","_createTextVNode"],"mappings":";;;AAcO,MAAA,UAAA,GAAA,EAAA,KAAK,EAAE,sBAAqB,GAAA;;;;AAiBJ,EAAA,KAAK,EAAC,6BAA6B;;;AAIzD,EAAA,KAAK,EAAC,4BAAkB;AAAA,EAAA,aAAA,EAAA,2BAAA;;;;;;AAUP,EAAA,KAAA,EAAA,wBAAA;;;;;AAW0B,EAAA,KAAI,EAAA,0BAAA;AAAA,EAAA,aAAA,EAAA,yBAAA;;;;;;;;;;AA9CtD,IAAA,KAAK,EAAC,gBAAgB;AACrB,IAAA,iBAAI,EAAA,MAAA,CAAA,SAAA;AACH,IAAA,aAAS,EAAC,gBAAO;oBACJ,EAAE,MAAM,CAAA,MAAA,CAAC,EAAE;;uBAiBpB,iBAAA,EAAA;AAdE,MAAA,CAAA,MAAA,CAAA,MAAM,CAAC,IAAI;wBADjBA,kBAMM,CAAA,MAAA,EAAA;;AAJN,YAAA,KAAK,EAAAC,cAAA,CAAA,CAAA,sBAAA,EACmC,EAAA,2BAAA,EAAA,CAAA,MAAA,CAAA,MAAM,CAAC,OAAC,EAAA,CAAA,CAAA;AAChD,YAAA,aAAW,EAAC,MAAK;;YACjBC,WAAG,CAAA,iBAAA,EAAA;cAAA,IAAA,EAAA,MAAA,CAAA,MAAA,CAAA,IAAA;AAAA,cAAA,IAAA,EAAA,EAAA;;;;wBAIC,CAAA,IAAA,EAAA;AAFA,QAAA,EAAE,EAAE,MAAS,CAAA,SAAA;AAAE,QAAA,KAAK,EAAC,uBAAG;AACzB,OAAA,EAAAC,eAAA,CAAA,MAAA,CAAA,MAAM,CAAC,KAAK,CAAA,EAAA,CAAA,oBAAA,UAAA,C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ue2.js';
|
|
|
2
2
|
import { render } from './CnObjectDataWidget.vue3.js';
|
|
3
3
|
|
|
4
4
|
script.render = render;
|
|
5
|
-
script.__scopeId = "data-v-
|
|
5
|
+
script.__scopeId = "data-v-4671221e";
|
|
6
6
|
const __sfc_main = script;
|
|
7
7
|
|
|
8
8
|
export { __sfc_main as default };
|
|
@@ -724,7 +724,13 @@ var script = {
|
|
|
724
724
|
values[field.key] = formatTermDuration(raw, extension);
|
|
725
725
|
continue
|
|
726
726
|
}
|
|
727
|
-
|
|
727
|
+
if (empty === null && enumLabel === null && typeof raw === 'boolean') {
|
|
728
|
+
// A fact reads yes/no as a word, as the boards draw it.
|
|
729
|
+
values[field.key] = raw ? translate('nextcloud-vue', 'Yes') : translate('nextcloud-vue', 'No');
|
|
730
|
+
continue
|
|
731
|
+
}
|
|
732
|
+
// A fact shows its text whole; the cell wraps.
|
|
733
|
+
values[field.key] = empty !== null ? empty : (enumLabel !== null ? enumLabel : formatValue(raw, prop || {}, { truncate: Infinity }));
|
|
728
734
|
}
|
|
729
735
|
return values
|
|
730
736
|
},
|