@conduction/nextcloud-vue 2.154.0 → 2.156.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/components/CnAiCompanion/CnAiInput.vue2.js +3 -1
- package/dist/esm/components/CnAiCompanion/CnAiInput.vue2.js.map +1 -1
- package/dist/esm/components/CnAiCompanion/CnAiInput.vue3.js.map +1 -1
- package/dist/esm/components/CnAppRoot/CnAppRoot.vue2.js.map +1 -1
- package/dist/esm/components/CnAppRoot/CnAppRoot.vue3.js +2 -2
- package/dist/esm/components/CnAppRoot/CnAppRoot.vue3.js.map +1 -1
- package/dist/esm/components/CnAssignDialog/CnAssignDialog.vue.js +1 -1
- package/dist/esm/components/CnAssignDialog/CnAssignDialog.vue2.js +10 -5
- package/dist/esm/components/CnAssignDialog/CnAssignDialog.vue2.js.map +1 -1
- package/dist/esm/components/CnAssignDialog/CnAssignDialog.vue3.js.map +1 -1
- package/dist/esm/components/CnAttentionFlagWidget/CnAttentionFlagWidget.vue.js +1 -1
- package/dist/esm/components/CnAttentionFlagWidget/CnAttentionFlagWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnAttentionFlagWidget/CnAttentionFlagWidget.vue3.js +2 -0
- package/dist/esm/components/CnAttentionFlagWidget/CnAttentionFlagWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnChoiceCards/CnChoiceCards.vue.js +1 -1
- package/dist/esm/components/CnChoiceCards/CnChoiceCards.vue2.js.map +1 -1
- package/dist/esm/components/CnChoiceCards/CnChoiceCards.vue3.js.map +1 -1
- package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue.js +1 -1
- package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue.js +1 -1
- package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue2.js.map +1 -1
- package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue3.js.map +1 -1
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue.js +1 -1
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue2.js +9 -8
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnIndexSidebar/CnIndexSidebar.vue2.js +13 -4
- package/dist/esm/components/CnIndexSidebar/CnIndexSidebar.vue2.js.map +1 -1
- package/dist/esm/components/CnIndexSidebar/CnIndexSidebar.vue3.js.map +1 -1
- package/dist/esm/components/CnLinkedWidget/CnLinkedWidget.vue.js +1 -1
- package/dist/esm/components/CnLinkedWidget/CnLinkedWidget.vue2.js +91 -7
- package/dist/esm/components/CnLinkedWidget/CnLinkedWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnLinkedWidget/CnLinkedWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnMapWidget/CnMapWidget.vue.js +1 -1
- package/dist/esm/components/CnMapWidget/CnMapWidget.vue2.js +37 -0
- package/dist/esm/components/CnMapWidget/CnMapWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnMapWidget/CnMapWidget.vue3.js +16 -7
- package/dist/esm/components/CnMapWidget/CnMapWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue.js +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js +2 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnSavedViewMenuSettings/CnSavedViewMenuSettings.vue.js +1 -1
- package/dist/esm/components/CnSavedViewMenuSettings/CnSavedViewMenuSettings.vue2.js.map +1 -1
- package/dist/esm/components/CnSavedViewMenuSettings/CnSavedViewMenuSettings.vue3.js.map +1 -1
- package/dist/esm/components/CnSchemaFormDialog/CnSchemaConfigurationTab.vue2.js +25 -0
- package/dist/esm/components/CnSchemaFormDialog/CnSchemaConfigurationTab.vue2.js.map +1 -1
- package/dist/esm/components/CnSchemaFormDialog/CnSchemaConfigurationTab.vue3.js +40 -8
- package/dist/esm/components/CnSchemaFormDialog/CnSchemaConfigurationTab.vue3.js.map +1 -1
- package/dist/esm/components/CnSchemaFormDialog/CnSchemaFormDialog.vue2.js +10 -0
- package/dist/esm/components/CnSchemaFormDialog/CnSchemaFormDialog.vue2.js.map +1 -1
- package/dist/esm/components/CnSchemaFormDialog/CnSchemaFormDialog.vue3.js.map +1 -1
- package/dist/esm/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue.js +1 -1
- package/dist/esm/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue2.js +24 -1
- package/dist/esm/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue2.js.map +1 -1
- package/dist/esm/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue3.js +9 -0
- package/dist/esm/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue3.js.map +1 -1
- package/dist/esm/components/CnUserSettingsDialog/CnUserSettingsDialog.vue.js +1 -1
- package/dist/esm/components/CnUserSettingsDialog/CnUserSettingsDialog.vue2.js.map +1 -1
- package/dist/esm/components/CnUserSettingsDialog/CnUserSettingsDialog.vue3.js.map +1 -1
- package/dist/esm/l10n/en.json.js +12 -7
- package/dist/esm/l10n/en.json.js.map +1 -1
- package/dist/esm/l10n/nl.json.js +14 -9
- package/dist/esm/l10n/nl.json.js.map +1 -1
- package/dist/esm/library-style.js +1 -1
- package/dist/esm/nextcloud-vue.css +604 -375
- package/dist/esm/utils/groupSublines.js +30 -12
- package/dist/esm/utils/groupSublines.js.map +1 -1
- package/dist/nextcloud-vue.cjs.js +1783 -1509
- package/dist/nextcloud-vue.cjs.js.map +2 -2
- package/dist/nextcloud-vue.css +604 -375
- package/l10n/en.json +12 -7
- package/l10n/nl.json +14 -9
- package/package.json +1 -1
- package/src/components/CnAiCompanion/CnAiInput.vue +3 -1
- package/src/components/CnAppRoot/CnAppRoot.vue +2 -2
- package/src/components/CnAssignDialog/CnAssignDialog.vue +10 -5
- package/src/components/CnAttentionFlagWidget/CnAttentionFlagWidget.vue +2 -6
- package/src/components/CnChoiceCards/CnChoiceCards.vue +9 -0
- package/src/components/CnCountdownWidget/CnCountdownWidget.vue +3 -0
- package/src/components/CnDashboardPage/CnDashboardPage.vue +7 -2
- package/src/components/CnFactsWidget/CnFactsWidget.vue +9 -8
- package/src/components/CnIndexSidebar/CnIndexSidebar.vue +13 -4
- package/src/components/CnLinkedWidget/CnLinkedWidget.vue +91 -7
- package/src/components/CnMapWidget/CnMapWidget.vue +55 -1
- package/src/components/CnRecordListWidget/CnRecordListWidget.vue +3 -2
- package/src/components/CnSavedViewMenuSettings/CnSavedViewMenuSettings.vue +3 -1
- package/src/components/CnSchemaFormDialog/CnSchemaConfigurationTab.vue +42 -0
- package/src/components/CnSchemaFormDialog/CnSchemaFormDialog.vue +10 -0
- package/src/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue +37 -1
- package/src/components/CnUserSettingsDialog/CnUserSettingsDialog.vue +4 -1
- package/src/css/dialog.css +43 -0
- package/src/css/look-board-detail.css +42 -0
- package/src/css/look-board-index.css +8 -0
- package/src/css/look-board.css +107 -3
- package/src/utils/groupSublines.js +29 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CnLinkedWidget.vue2.js","sources":["../../../../src/components/CnLinkedWidget/CnLinkedWidget.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<div class=\"cn-linked-widget\" data-testid=\"cn-linked-widget\">\n\t\t<ul v-if=\"linkedRows.length > 0\" class=\"cn-linked-widget__rows\">\n\t\t\t<li\n\t\t\t\tv-for=\"row in linkedRows\"\n\t\t\t\t:key=\"row.key\"\n\t\t\t\tclass=\"cn-linked-widget__row\"\n\t\t\t\tdata-testid=\"cn-linked-row\">\n\t\t\t\t<a v-if=\"row.href\" :href=\"row.href\" class=\"cn-linked-widget__link\">\n\t\t\t\t\t<CnIcon\n\t\t\t\t\t\tv-if=\"row.icon\"\n\t\t\t\t\t\t:name=\"row.icon\"\n\t\t\t\t\t\t:size=\"18\"\n\t\t\t\t\t\taria-hidden=\"true\" />\n\t\t\t\t\t{{ row.label }}\n\t\t\t\t</a>\n\t\t\t\t<button\n\t\t\t\t\tv-else-if=\"row.run\"\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tclass=\"cn-linked-widget__link\"\n\t\t\t\t\t@click=\"row.run()\">\n\t\t\t\t\t<CnIcon\n\t\t\t\t\t\tv-if=\"row.icon\"\n\t\t\t\t\t\t:name=\"row.icon\"\n\t\t\t\t\t\t:size=\"18\"\n\t\t\t\t\t\taria-hidden=\"true\" />\n\t\t\t\t\t{{ row.label }}\n\t\t\t\t</button>\n\t\t\t\t<span v-else class=\"cn-linked-widget__link\">\n\t\t\t\t\t<CnIcon\n\t\t\t\t\t\tv-if=\"row.icon\"\n\t\t\t\t\t\t:name=\"row.icon\"\n\t\t\t\t\t\t:size=\"18\"\n\t\t\t\t\t\taria-hidden=\"true\" />\n\t\t\t\t\t{{ row.label }}\n\t\t\t\t</span>\n\t\t\t</li>\n\t\t</ul>\n\t\t<!-- A div, not a p: a theme's paragraph rule would draw the muted\n\t\t 13px line at body size. -->\n\t\t<div v-if=\"emptyLine\" class=\"cn-linked-widget__empty\" data-testid=\"cn-linked-empty\">\n\t\t\t{{ emptyLine }}\n\t\t</div>\n\t\t<span v-if=\"emptyActions.length > 0\" class=\"cn-linked-widget__actions\">\n\t\t\t<button\n\t\t\t\tv-for=\"action in emptyActions\"\n\t\t\t\t:key=\"action.key\"\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"cn-linked-widget__action\"\n\t\t\t\tdata-testid=\"cn-linked-action\"\n\t\t\t\t@click=\"action.run()\">\n\t\t\t\t{{ action.label }}\n\t\t\t</button>\n\t\t</span>\n\t\t<!-- The leaves run here, unseen: each reads its own data and reports\n\t\t a summary through `onSummary`; this card draws the rows. -->\n\t\t<div hidden class=\"cn-linked-widget__leaves\">\n\t\t\t<CnLeafMountHost\n\t\t\t\tv-for=\"provider in providers\"\n\t\t\t\t:key=\"provider.id\"\n\t\t\t\t:provider=\"provider\"\n\t\t\t\t:mountProps=\"mountPropsById[provider.id]\" />\n\t\t</div>\n\t</div>\n</template>\n\n<script>\nimport { getLanguage, translate as t } from '@nextcloud/l10n'\nimport CnIcon from '../CnIcon/CnIcon.vue'\nimport CnLeafMountHost from '../CnLeafMountHost/CnLeafMountHost.vue'\nimport { useIntegrationRegistry } from '../../composables/useIntegrationRegistry.js'\n\n/**\n * Join nouns as a sentence list in the user's language (\"a, b en c\").\n *\n * @param {string[]} items The nouns.\n * @return {string} The list.\n */\nfunction joinList(items) {\n\ttry {\n\t\treturn new Intl.ListFormat((getLanguage() || 'en').replace('_', '-'), { style: 'long', type: 'conjunction' }).format(items)\n\t} catch {\n\t\treturn items.join(', ')\n\t}\n}\n\n/**\n * CnLinkedWidget — the `linked` widget: one card that lists what other apps\n * hold for this record (DqZaak \"Gekoppeld\").\n *\n * `content.leaves` names the mount-mode integration leaves, in order. Each is\n * mounted out of sight with an `onSummary(summary)` prop and reports\n * `{ count, noun, rows?, actions? }`: a leaf with something linked draws its\n * rows (`{ label, href?, run?, icon? }`); the leaves with nothing linked share\n * one line (\"Leges, contract en projecten: niets gekoppeld\") followed by their\n * actions. A leaf whose app is absent is not registered and is left out.\n *\n * @spec openspec/changes/linked-integrations-card/specs/linked-integrations-card/spec.md#requirement-one-card-lists-the-linked-integrations-of-a-record\n */\nexport default {\n\tname: 'CnLinkedWidget',\n\n\tcomponents: { CnIcon, CnLeafMountHost },\n\n\tprops: {\n\t\t/** `{ leaves: string[] }`: the integration ids, in the order to list them. */\n\t\tcontent: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/** The record's id. */\n\t\tobjectId: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** The record's register. */\n\t\tregister: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** The record's schema. */\n\t\tschema: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\t},\n\n\tsetup() {\n\t\tconst { integrations, getById } = useIntegrationRegistry()\n\t\treturn { integrations, getById }\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\t/** The latest summary each leaf reported, by integration id. */\n\t\t\tsummaries: {},\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** @return {string[]} The configured leaf ids. */\n\t\tleafIds() {\n\t\t\tconst leaves = this.content && this.content.leaves\n\t\t\treturn Array.isArray(leaves) ? leaves.filter((id) => typeof id === 'string' && id !== '') : []\n\t\t},\n\n\t\t/** @return {object[]} The registered mount-mode providers, in the configured order. */\n\t\tproviders() {\n\t\t\t// Read so a leaf that registers after this card renders still joins it.\n\t\t\tvoid this.integrations\n\t\t\treturn this.leafIds\n\t\t\t\t.map((id) => this.getById(id))\n\t\t\t\t.filter((p) => p && p.renderMode === 'mount' && typeof p.mount === 'function' && typeof p.unmount === 'function')\n\t\t},\n\n\t\t/** @return {object} The mount props per leaf. */\n\t\tmountPropsById() {\n\t\t\tconst context = { register: this.register, schema: this.schema, objectId: String(this.objectId || '') }\n\t\t\tconst out = {}\n\t\t\tfor (const provider of this.providers) {\n\t\t\t\tout[provider.id] = {\n\t\t\t\t\tsurface: 'detail-page',\n\t\t\t\t\t...context,\n\t\t\t\t\tintegrationContext: { ...context },\n\t\t\t\t\tonSummary: (summary) => this.onSummary(provider.id, summary),\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn out\n\t\t},\n\n\t\t/** @return {Array<{id: string, summary: object}>} The reported summaries, in order. */\n\t\treported() {\n\t\t\treturn this.providers\n\t\t\t\t.filter((p) => this.summaries[p.id])\n\t\t\t\t.map((p) => ({ id: p.id, summary: this.summaries[p.id] }))\n\t\t},\n\n\t\t/** @return {object[]} The rows of the leaves that have something linked. */\n\t\tlinkedRows() {\n\t\t\tconst rows = []\n\t\t\tfor (const { id, summary } of this.reported) {\n\t\t\t\tif (summary.count <= 0) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tconst own = summary.rows.length > 0\n\t\t\t\t\t? summary.rows\n\t\t\t\t\t: [{ label: `${summary.noun} (${summary.count})` }]\n\t\t\t\town.forEach((row, index) => rows.push({ ...row, key: `${id}-${index}` }))\n\t\t\t}\n\t\t\treturn rows\n\t\t},\n\n\t\t/** @return {object[]} The leaves with nothing linked. */\n\t\temptyLeaves() {\n\t\t\treturn this.reported.filter(({ summary }) => summary.count <= 0)\n\t\t},\n\n\t\t/** @return {string} \"Leges, contract en projecten: niets gekoppeld\", or ''. */\n\t\temptyLine() {\n\t\t\tconst nouns = this.emptyLeaves.map(({ summary }) => summary.noun).filter((noun) => noun !== '')\n\t\t\tif (nouns.length === 0) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst list = joinList(nouns)\n\t\t\treturn t('nextcloud-vue', '{things}: nothing linked', { things: list.charAt(0).toUpperCase() + list.slice(1) })\n\t\t},\n\n\t\t/** @return {object[]} The actions of the leaves with nothing linked. */\n\t\temptyActions() {\n\t\t\tconst actions = []\n\t\t\tfor (const { id, summary } of this.emptyLeaves) {\n\t\t\t\tsummary.actions.forEach((action, index) => actions.push({ ...action, key: `${id}-${index}` }))\n\t\t\t}\n\t\t\treturn actions\n\t\t},\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * Keep a leaf's summary, normalised.\n\t\t *\n\t\t * @param {string} id The integration id.\n\t\t * @param {{count?: number, noun?: string, rows?: Array, actions?: Array}} summary What the leaf reported.\n\t\t */\n\t\tonSummary(id, summary) {\n\t\t\tconst s = summary && typeof summary === 'object' ? summary : {}\n\t\t\tconst usableRow = (row) => row && typeof row.label === 'string' && row.label !== ''\n\t\t\tconst usableAction = (action) => action && typeof action.run === 'function' && typeof action.label === 'string' && action.label !== ''\n\t\t\tthis.summaries = {\n\t\t\t\t...this.summaries,\n\t\t\t\t[id]: {\n\t\t\t\t\tcount: Number.isFinite(s.count) ? s.count : 0,\n\t\t\t\t\tnoun: typeof s.noun === 'string' ? s.noun : '',\n\t\t\t\t\trows: Array.isArray(s.rows) ? s.rows.filter(usableRow) : [],\n\t\t\t\t\tactions: Array.isArray(s.actions) ? s.actions.filter(usableAction) : [],\n\t\t\t\t},\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-linked-widget {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 10px;\n}\n\n.cn-linked-widget__rows {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 10px;\n\tlist-style: none;\n\tmargin: 0;\n\tpadding: 0;\n}\n\n.cn-linked-widget__link {\n\talign-items: center;\n\tbackground: none;\n\tborder: 0;\n\tcolor: var(--color-main-text);\n\tdisplay: flex;\n\tfont: inherit;\n\tfont-size: 14px;\n\tfont-weight: 600;\n\tgap: 10px;\n\tmargin: 0;\n\tmin-height: 0;\n\tpadding: 0;\n\ttext-align: start;\n}\n\na.cn-linked-widget__link,\nbutton.cn-linked-widget__link {\n\tcolor: var(--color-primary-element);\n\tcursor: pointer;\n\ttext-decoration: underline;\n}\n\n.cn-linked-widget__empty {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 13px;\n\tmargin: 0;\n}\n\n.cn-linked-widget__actions {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 12px;\n}\n\n.cn-linked-widget__action {\n\tbackground: none;\n\tborder: 0;\n\tcolor: var(--color-primary-element);\n\tcursor: pointer;\n\tfont: inherit;\n\tfont-size: 14px;\n\tfont-weight: 600;\n\tmargin: 0;\n\tmin-height: 0;\n\tpadding: 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AAK,MAAM,CAAC,KAAM,KAAI,GAAC;AACrI,GAAA,IAAI,CAAC,YAAY;AAChB,IAAA,GAAG,IAAI,CAAC,SAAS;IACjB,CAAC,EAAE,GAAG;AACL,KAAA,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAA,GAAI,CAAC,CAAC,KAAI,GAAI,CAAC;AAC7C,KAAA,IAAI,EAAE,OAAO,CAAC,CAAC,SAAS,QAAS,GAAE,CAAC,CAAC,IAAK,GAAE,EAAE;KAC9C,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAE,GAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAA,GAAI,EAAE;AAC3D,KAAA,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAE,GAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAE,GAAE,EAAE;KACvE;AACF,KAAA;GACA;EACD;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"CnLinkedWidget.vue2.js","sources":["../../../../src/components/CnLinkedWidget/CnLinkedWidget.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<div class=\"cn-linked-widget\" data-testid=\"cn-linked-widget\">\n\t\t<ul v-if=\"linkedRows.length > 0\" class=\"cn-linked-widget__rows\">\n\t\t\t<li\n\t\t\t\tv-for=\"row in linkedRows\"\n\t\t\t\t:key=\"row.key\"\n\t\t\t\tclass=\"cn-linked-widget__row\"\n\t\t\t\tdata-testid=\"cn-linked-row\">\n\t\t\t\t<a v-if=\"row.href\" :href=\"row.href\" class=\"cn-linked-widget__link\">\n\t\t\t\t\t<CnIcon\n\t\t\t\t\t\tv-if=\"row.icon\"\n\t\t\t\t\t\t:name=\"row.icon\"\n\t\t\t\t\t\t:size=\"18\"\n\t\t\t\t\t\taria-hidden=\"true\" />\n\t\t\t\t\t{{ row.label }}\n\t\t\t\t</a>\n\t\t\t\t<button\n\t\t\t\t\tv-else-if=\"row.run\"\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tclass=\"cn-linked-widget__link\"\n\t\t\t\t\t@click=\"row.run()\">\n\t\t\t\t\t<CnIcon\n\t\t\t\t\t\tv-if=\"row.icon\"\n\t\t\t\t\t\t:name=\"row.icon\"\n\t\t\t\t\t\t:size=\"18\"\n\t\t\t\t\t\taria-hidden=\"true\" />\n\t\t\t\t\t{{ row.label }}\n\t\t\t\t</button>\n\t\t\t\t<span v-else class=\"cn-linked-widget__link\">\n\t\t\t\t\t<CnIcon\n\t\t\t\t\t\tv-if=\"row.icon\"\n\t\t\t\t\t\t:name=\"row.icon\"\n\t\t\t\t\t\t:size=\"18\"\n\t\t\t\t\t\taria-hidden=\"true\" />\n\t\t\t\t\t{{ row.label }}\n\t\t\t\t</span>\n\t\t\t</li>\n\t\t</ul>\n\t\t<!-- A div, not a p: a theme's paragraph rule would draw the muted\n\t\t 13px line at body size. -->\n\t\t<div v-if=\"emptyLine\" class=\"cn-linked-widget__empty\" data-testid=\"cn-linked-empty\">\n\t\t\t{{ emptyLine }}\n\t\t</div>\n\t\t<span v-if=\"emptyActions.length > 0\" class=\"cn-linked-widget__actions\">\n\t\t\t<button\n\t\t\t\tv-for=\"action in emptyActions\"\n\t\t\t\t:key=\"action.key\"\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"cn-linked-widget__action\"\n\t\t\t\tdata-testid=\"cn-linked-action\"\n\t\t\t\t@click=\"action.run()\">\n\t\t\t\t{{ action.label }}\n\t\t\t</button>\n\t\t</span>\n\t\t<!-- The leaves run here, unseen: each reads its own data and reports\n\t\t a summary through `onSummary`; this card draws the rows. -->\n\t\t<div hidden class=\"cn-linked-widget__leaves\">\n\t\t\t<CnLeafMountHost\n\t\t\t\tv-for=\"provider in providers\"\n\t\t\t\t:key=\"provider.id\"\n\t\t\t\t:provider=\"provider\"\n\t\t\t\t:mountProps=\"mountPropsById[provider.id]\" />\n\t\t</div>\n\t</div>\n</template>\n\n<script>\nimport { getLanguage, translate as t } from '@nextcloud/l10n'\nimport CnIcon from '../CnIcon/CnIcon.vue'\nimport CnLeafMountHost from '../CnLeafMountHost/CnLeafMountHost.vue'\nimport { useIntegrationRegistry } from '../../composables/useIntegrationRegistry.js'\nimport { isAppInstalled } from '../../utils/appInstalled.js'\nimport { fetchReferenceObjects } from '../../utils/boardReferenceColumns.js'\nimport { fillTemplate } from '../../utils/fillTemplate.js'\nimport { prefixUrl } from '../../utils/headers.js'\n\n/**\n * Join nouns as a sentence list in the user's language (\"a, b en c\").\n *\n * @param {string[]} items The nouns.\n * @return {string} The list.\n */\nfunction joinList(items) {\n\ttry {\n\t\treturn new Intl.ListFormat((getLanguage() || 'en').replace('_', '-'), { style: 'long', type: 'conjunction' }).format(items)\n\t} catch {\n\t\treturn items.join(', ')\n\t}\n}\n\n/**\n * CnLinkedWidget — the `linked` widget: one card that lists what other apps\n * hold for this record (DqZaak \"Gekoppeld\").\n *\n * `content.leaves` names the mount-mode integration leaves, in order. Each is\n * mounted out of sight with an `onSummary(summary)` prop and reports\n * `{ count, noun, rows?, actions? }`: a leaf with something linked draws its\n * rows (`{ label, href?, run?, icon? }`); the leaves with nothing linked share\n * one line (\"Leges, contract en projecten: niets gekoppeld\") followed by their\n * actions. A leaf whose app is absent is not registered and is left out.\n *\n * A leaf may also be a record leaf, written in the manifest instead of\n * registered by an app: `{ id, register, schema, filter?, requiredApp?, noun,\n * label, href?, icon? }`. The card reads that register's records matching\n * `filter` (`@objectId` is this record's id) and lists one row per record,\n * `label` and `href` filled from it (DqZaak \"Vraag in pipelinq\": the\n * requests whose case reference is this case). It is left out when\n * `requiredApp` is not installed. Texts go through the host translate.\n *\n * @spec openspec/changes/linked-integrations-card/specs/linked-integrations-card/spec.md#requirement-one-card-lists-the-linked-integrations-of-a-record\n */\nexport default {\n\tname: 'CnLinkedWidget',\n\n\tcomponents: { CnIcon, CnLeafMountHost },\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/** `{ leaves: Array<string|object> }`: integration ids or record leaves, in the order to list them. */\n\t\tcontent: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/** The record's id. */\n\t\tobjectId: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** The record's register. */\n\t\tregister: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** The record's schema. */\n\t\tschema: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\t},\n\n\tsetup() {\n\t\tconst { integrations, getById } = useIntegrationRegistry()\n\t\treturn { integrations, getById }\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\t/** The latest summary each leaf reported, by integration id. */\n\t\t\tsummaries: {},\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** @return {Array<string|object>} The configured leaves. */\n\t\tleaves() {\n\t\t\tconst leaves = this.content && this.content.leaves\n\t\t\treturn Array.isArray(leaves) ? leaves : []\n\t\t},\n\n\t\t/** @return {string[]} The configured integration ids. */\n\t\tleafIds() {\n\t\t\treturn this.leaves.filter((id) => typeof id === 'string' && id !== '')\n\t\t},\n\n\t\t/** @return {object[]} The record leaves whose app is here. */\n\t\trecordLeaves() {\n\t\t\treturn this.leaves.filter((leaf) => leaf && typeof leaf === 'object' && typeof leaf.id === 'string' && leaf.id !== ''\n\t\t\t\t&& leaf.register && leaf.schema && (!leaf.requiredApp || isAppInstalled(leaf.requiredApp)))\n\t\t},\n\n\t\t/** @return {string[]} Every listed leaf's id, in the configured order. */\n\t\torderedIds() {\n\t\t\tconst providers = new Set(this.providers.map((p) => p.id))\n\t\t\tconst records = new Set(this.recordLeaves.map((leaf) => leaf.id))\n\t\t\treturn this.leaves\n\t\t\t\t.map((leaf) => (typeof leaf === 'string' ? leaf : (leaf && leaf.id)))\n\t\t\t\t.filter((id) => providers.has(id) || records.has(id))\n\t\t},\n\n\t\t/** @return {object[]} The registered mount-mode providers, in the configured order. */\n\t\tproviders() {\n\t\t\t// Read so a leaf that registers after this card renders still joins it.\n\t\t\tvoid this.integrations\n\t\t\treturn this.leafIds\n\t\t\t\t.map((id) => this.getById(id))\n\t\t\t\t.filter((p) => p && p.renderMode === 'mount' && typeof p.mount === 'function' && typeof p.unmount === 'function')\n\t\t},\n\n\t\t/** @return {object} The mount props per leaf. */\n\t\tmountPropsById() {\n\t\t\tconst context = { register: this.register, schema: this.schema, objectId: String(this.objectId || '') }\n\t\t\tconst out = {}\n\t\t\tfor (const provider of this.providers) {\n\t\t\t\tout[provider.id] = {\n\t\t\t\t\tsurface: 'detail-page',\n\t\t\t\t\t...context,\n\t\t\t\t\tintegrationContext: { ...context },\n\t\t\t\t\tonSummary: (summary) => this.onSummary(provider.id, summary),\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn out\n\t\t},\n\n\t\t/** @return {Array<{id: string, summary: object}>} The reported summaries, in order. */\n\t\treported() {\n\t\t\treturn this.orderedIds\n\t\t\t\t.filter((id) => this.summaries[id])\n\t\t\t\t.map((id) => ({ id, summary: this.summaries[id] }))\n\t\t},\n\n\t\t/** @return {object[]} The rows of the leaves that have something linked. */\n\t\tlinkedRows() {\n\t\t\tconst rows = []\n\t\t\tfor (const { id, summary } of this.reported) {\n\t\t\t\tif (summary.count <= 0) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tconst own = summary.rows.length > 0\n\t\t\t\t\t? summary.rows\n\t\t\t\t\t: [{ label: `${summary.noun} (${summary.count})` }]\n\t\t\t\town.forEach((row, index) => rows.push({ ...row, key: `${id}-${index}` }))\n\t\t\t}\n\t\t\treturn rows\n\t\t},\n\n\t\t/** @return {object[]} The leaves with nothing linked. */\n\t\temptyLeaves() {\n\t\t\treturn this.reported.filter(({ summary }) => summary.count <= 0)\n\t\t},\n\n\t\t/** @return {string} \"Leges, contract en projecten: niets gekoppeld\", or ''. */\n\t\temptyLine() {\n\t\t\tconst nouns = this.emptyLeaves.map(({ summary }) => summary.noun).filter((noun) => noun !== '')\n\t\t\tif (nouns.length === 0) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst list = joinList(nouns)\n\t\t\treturn t('nextcloud-vue', '{things}: nothing linked', { things: list.charAt(0).toUpperCase() + list.slice(1) })\n\t\t},\n\n\t\t/** @return {object[]} The actions of the leaves with nothing linked. */\n\t\temptyActions() {\n\t\t\tconst actions = []\n\t\t\tfor (const { id, summary } of this.emptyLeaves) {\n\t\t\t\tsummary.actions.forEach((action, index) => actions.push({ ...action, key: `${id}-${index}` }))\n\t\t\t}\n\t\t\treturn actions\n\t\t},\n\t},\n\n\twatch: {\n\t\trecordLeaves: {\n\t\t\thandler() {\n\t\t\t\tthis.recordLeaves.forEach((leaf) => this.readRecordLeaf(leaf))\n\t\t\t},\n\n\t\t\timmediate: true,\n\t\t},\n\n\t\tobjectId() {\n\t\t\tthis.recordLeaves.forEach((leaf) => this.readRecordLeaf(leaf))\n\t\t},\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * Read a record leaf's records and report them as its summary. A\n\t\t * failed read reports nothing, so the leaf is not listed as empty.\n\t\t *\n\t\t * @param {object} leaf The record leaf.\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync readRecordLeaf(leaf) {\n\t\t\tconst objectId = String(this.objectId || '')\n\t\t\tif (objectId === '') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst filter = {}\n\t\t\tfor (const [key, value] of Object.entries(leaf.filter || {})) {\n\t\t\t\tfilter[key] = value === '@objectId' ? objectId : value\n\t\t\t}\n\t\t\tlet rows\n\t\t\ttry {\n\t\t\t\trows = await fetchReferenceObjects({ register: leaf.register, schema: leaf.schema, filter, limit: leaf.limit || 20 })\n\t\t\t} catch {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst label = leaf.label ? this.cnTranslate(leaf.label) : ''\n\t\t\tthis.onSummary(leaf.id, {\n\t\t\t\tcount: rows.length,\n\t\t\t\tnoun: leaf.noun ? this.cnTranslate(leaf.noun) : '',\n\t\t\t\trows: rows.map((row) => {\n\t\t\t\t\tconst href = leaf.href ? fillTemplate(leaf.href, row) : ''\n\t\t\t\t\treturn { label: fillTemplate(label, row), href: href ? prefixUrl(href) : undefined, icon: leaf.icon || undefined }\n\t\t\t\t}),\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Keep a leaf's summary, normalised.\n\t\t *\n\t\t * @param {string} id The integration id.\n\t\t * @param {{count?: number, noun?: string, rows?: Array, actions?: Array}} summary What the leaf reported.\n\t\t */\n\t\tonSummary(id, summary) {\n\t\t\tconst s = summary && typeof summary === 'object' ? summary : {}\n\t\t\tconst usableRow = (row) => row && typeof row.label === 'string' && row.label !== ''\n\t\t\tconst usableAction = (action) => action && typeof action.run === 'function' && typeof action.label === 'string' && action.label !== ''\n\t\t\tthis.summaries = {\n\t\t\t\t...this.summaries,\n\t\t\t\t[id]: {\n\t\t\t\t\tcount: Number.isFinite(s.count) ? s.count : 0,\n\t\t\t\t\tnoun: typeof s.noun === 'string' ? s.noun : '',\n\t\t\t\t\trows: Array.isArray(s.rows) ? s.rows.filter(usableRow) : [],\n\t\t\t\t\tactions: Array.isArray(s.actions) ? s.actions.filter(usableAction) : [],\n\t\t\t\t},\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-linked-widget {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 10px;\n}\n\n.cn-linked-widget__rows {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 10px;\n\tlist-style: none;\n\tmargin: 0;\n\tpadding: 0;\n}\n\n.cn-linked-widget__link {\n\talign-items: center;\n\tbackground: none;\n\tborder: 0;\n\tcolor: var(--color-main-text);\n\tdisplay: flex;\n\tfont: inherit;\n\tfont-size: 14px;\n\tfont-weight: 600;\n\tgap: 10px;\n\tmargin: 0;\n\tmin-height: 0;\n\tpadding: 0;\n\ttext-align: start;\n}\n\na.cn-linked-widget__link,\nbutton.cn-linked-widget__link {\n\tcolor: var(--color-primary-element);\n\tcursor: pointer;\n\ttext-decoration: underline;\n}\n\n.cn-linked-widget__empty {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 13px;\n\tmargin: 0;\n}\n\n.cn-linked-widget__actions {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 12px;\n}\n\n.cn-linked-widget__action {\n\tbackground: none;\n\tborder: 0;\n\tcolor: var(--color-primary-element);\n\tcursor: pointer;\n\tfont: inherit;\n\tfont-size: 14px;\n\tfont-weight: 600;\n\tmargin: 0;\n\tmin-height: 0;\n\tpadding: 0;\n\ttext-decoration: underline;\n}\n</style>\n"],"names":["CnIcon","CnLeafMountHost","t"],"mappings":";;;;;;;;;AAiFA;;AAEC;AACA;;;AAGD,SAAS,QAAQ,CAAC,KAAK,EAAE;AACxB,CAAA,IAAI;EACH,OAAO,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,WAAW,EAAC,IAAK,IAAI,EAAE,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,aAAc,EAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAA;AAC3H,EAAA,CAAE,MAAM;AACP,EAAA,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAA;AACvB,EAAA;AACD,CAAA;;AAEA;AACC;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;;;;;AAMA;AACA;;AAED,aAAe;AACd,CAAA,IAAI,EAAE,gBAAgB;;AAEtB,CAAA,UAAU,EAAE,UAAEA,UAAM,mBAAEC,cAAiB;;AAEvC,CAAA,MAAM,EAAE;;AAEP,EAAA,WAAW,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,KAAK,KAAK;EAC5C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,EAAE;AAC3D,KAAA,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAE,GAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAE,GAAE,EAAE;KACvE;AACF,KAAA;GACA;EACD;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CnLinkedWidget.vue3.js","sources":["../../../../src/components/CnLinkedWidget/CnLinkedWidget.vue?vue&type=template&id=0fc31606&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<div class=\"cn-linked-widget\" data-testid=\"cn-linked-widget\">\n\t\t<ul v-if=\"linkedRows.length > 0\" class=\"cn-linked-widget__rows\">\n\t\t\t<li\n\t\t\t\tv-for=\"row in linkedRows\"\n\t\t\t\t:key=\"row.key\"\n\t\t\t\tclass=\"cn-linked-widget__row\"\n\t\t\t\tdata-testid=\"cn-linked-row\">\n\t\t\t\t<a v-if=\"row.href\" :href=\"row.href\" class=\"cn-linked-widget__link\">\n\t\t\t\t\t<CnIcon\n\t\t\t\t\t\tv-if=\"row.icon\"\n\t\t\t\t\t\t:name=\"row.icon\"\n\t\t\t\t\t\t:size=\"18\"\n\t\t\t\t\t\taria-hidden=\"true\" />\n\t\t\t\t\t{{ row.label }}\n\t\t\t\t</a>\n\t\t\t\t<button\n\t\t\t\t\tv-else-if=\"row.run\"\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tclass=\"cn-linked-widget__link\"\n\t\t\t\t\t@click=\"row.run()\">\n\t\t\t\t\t<CnIcon\n\t\t\t\t\t\tv-if=\"row.icon\"\n\t\t\t\t\t\t:name=\"row.icon\"\n\t\t\t\t\t\t:size=\"18\"\n\t\t\t\t\t\taria-hidden=\"true\" />\n\t\t\t\t\t{{ row.label }}\n\t\t\t\t</button>\n\t\t\t\t<span v-else class=\"cn-linked-widget__link\">\n\t\t\t\t\t<CnIcon\n\t\t\t\t\t\tv-if=\"row.icon\"\n\t\t\t\t\t\t:name=\"row.icon\"\n\t\t\t\t\t\t:size=\"18\"\n\t\t\t\t\t\taria-hidden=\"true\" />\n\t\t\t\t\t{{ row.label }}\n\t\t\t\t</span>\n\t\t\t</li>\n\t\t</ul>\n\t\t<!-- A div, not a p: a theme's paragraph rule would draw the muted\n\t\t 13px line at body size. -->\n\t\t<div v-if=\"emptyLine\" class=\"cn-linked-widget__empty\" data-testid=\"cn-linked-empty\">\n\t\t\t{{ emptyLine }}\n\t\t</div>\n\t\t<span v-if=\"emptyActions.length > 0\" class=\"cn-linked-widget__actions\">\n\t\t\t<button\n\t\t\t\tv-for=\"action in emptyActions\"\n\t\t\t\t:key=\"action.key\"\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"cn-linked-widget__action\"\n\t\t\t\tdata-testid=\"cn-linked-action\"\n\t\t\t\t@click=\"action.run()\">\n\t\t\t\t{{ action.label }}\n\t\t\t</button>\n\t\t</span>\n\t\t<!-- The leaves run here, unseen: each reads its own data and reports\n\t\t a summary through `onSummary`; this card draws the rows. -->\n\t\t<div hidden class=\"cn-linked-widget__leaves\">\n\t\t\t<CnLeafMountHost\n\t\t\t\tv-for=\"provider in providers\"\n\t\t\t\t:key=\"provider.id\"\n\t\t\t\t:provider=\"provider\"\n\t\t\t\t:mountProps=\"mountPropsById[provider.id]\" />\n\t\t</div>\n\t</div>\n</template>\n\n<script>\nimport { getLanguage, translate as t } from '@nextcloud/l10n'\nimport CnIcon from '../CnIcon/CnIcon.vue'\nimport CnLeafMountHost from '../CnLeafMountHost/CnLeafMountHost.vue'\nimport { useIntegrationRegistry } from '../../composables/useIntegrationRegistry.js'\n\n/**\n * Join nouns as a sentence list in the user's language (\"a, b en c\").\n *\n * @param {string[]} items The nouns.\n * @return {string} The list.\n */\nfunction joinList(items) {\n\ttry {\n\t\treturn new Intl.ListFormat((getLanguage() || 'en').replace('_', '-'), { style: 'long', type: 'conjunction' }).format(items)\n\t} catch {\n\t\treturn items.join(', ')\n\t}\n}\n\n/**\n * CnLinkedWidget — the `linked` widget: one card that lists what other apps\n * hold for this record (DqZaak \"Gekoppeld\").\n *\n * `content.leaves` names the mount-mode integration leaves, in order. Each is\n * mounted out of sight with an `onSummary(summary)` prop and reports\n * `{ count, noun, rows?, actions? }`: a leaf with something linked draws its\n * rows (`{ label, href?, run?, icon? }`); the leaves with nothing linked share\n * one line (\"Leges, contract en projecten: niets gekoppeld\") followed by their\n * actions. A leaf whose app is absent is not registered and is left out.\n *\n * @spec openspec/changes/linked-integrations-card/specs/linked-integrations-card/spec.md#requirement-one-card-lists-the-linked-integrations-of-a-record\n */\nexport default {\n\tname: 'CnLinkedWidget',\n\n\tcomponents: { CnIcon, CnLeafMountHost },\n\n\tprops: {\n\t\t/** `{ leaves: string[] }`: the integration ids, in the order to list them. */\n\t\tcontent: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/** The record's id. */\n\t\tobjectId: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** The record's register. */\n\t\tregister: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** The record's schema. */\n\t\tschema: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\t},\n\n\tsetup() {\n\t\tconst { integrations, getById } = useIntegrationRegistry()\n\t\treturn { integrations, getById }\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\t/** The latest summary each leaf reported, by integration id. */\n\t\t\tsummaries: {},\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** @return {string[]} The configured leaf ids. */\n\t\tleafIds() {\n\t\t\tconst leaves = this.content && this.content.leaves\n\t\t\treturn Array.isArray(leaves) ? leaves.filter((id) => typeof id === 'string' && id !== '') : []\n\t\t},\n\n\t\t/** @return {object[]} The registered mount-mode providers, in the configured order. */\n\t\tproviders() {\n\t\t\t// Read so a leaf that registers after this card renders still joins it.\n\t\t\tvoid this.integrations\n\t\t\treturn this.leafIds\n\t\t\t\t.map((id) => this.getById(id))\n\t\t\t\t.filter((p) => p && p.renderMode === 'mount' && typeof p.mount === 'function' && typeof p.unmount === 'function')\n\t\t},\n\n\t\t/** @return {object} The mount props per leaf. */\n\t\tmountPropsById() {\n\t\t\tconst context = { register: this.register, schema: this.schema, objectId: String(this.objectId || '') }\n\t\t\tconst out = {}\n\t\t\tfor (const provider of this.providers) {\n\t\t\t\tout[provider.id] = {\n\t\t\t\t\tsurface: 'detail-page',\n\t\t\t\t\t...context,\n\t\t\t\t\tintegrationContext: { ...context },\n\t\t\t\t\tonSummary: (summary) => this.onSummary(provider.id, summary),\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn out\n\t\t},\n\n\t\t/** @return {Array<{id: string, summary: object}>} The reported summaries, in order. */\n\t\treported() {\n\t\t\treturn this.providers\n\t\t\t\t.filter((p) => this.summaries[p.id])\n\t\t\t\t.map((p) => ({ id: p.id, summary: this.summaries[p.id] }))\n\t\t},\n\n\t\t/** @return {object[]} The rows of the leaves that have something linked. */\n\t\tlinkedRows() {\n\t\t\tconst rows = []\n\t\t\tfor (const { id, summary } of this.reported) {\n\t\t\t\tif (summary.count <= 0) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tconst own = summary.rows.length > 0\n\t\t\t\t\t? summary.rows\n\t\t\t\t\t: [{ label: `${summary.noun} (${summary.count})` }]\n\t\t\t\town.forEach((row, index) => rows.push({ ...row, key: `${id}-${index}` }))\n\t\t\t}\n\t\t\treturn rows\n\t\t},\n\n\t\t/** @return {object[]} The leaves with nothing linked. */\n\t\temptyLeaves() {\n\t\t\treturn this.reported.filter(({ summary }) => summary.count <= 0)\n\t\t},\n\n\t\t/** @return {string} \"Leges, contract en projecten: niets gekoppeld\", or ''. */\n\t\temptyLine() {\n\t\t\tconst nouns = this.emptyLeaves.map(({ summary }) => summary.noun).filter((noun) => noun !== '')\n\t\t\tif (nouns.length === 0) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst list = joinList(nouns)\n\t\t\treturn t('nextcloud-vue', '{things}: nothing linked', { things: list.charAt(0).toUpperCase() + list.slice(1) })\n\t\t},\n\n\t\t/** @return {object[]} The actions of the leaves with nothing linked. */\n\t\temptyActions() {\n\t\t\tconst actions = []\n\t\t\tfor (const { id, summary } of this.emptyLeaves) {\n\t\t\t\tsummary.actions.forEach((action, index) => actions.push({ ...action, key: `${id}-${index}` }))\n\t\t\t}\n\t\t\treturn actions\n\t\t},\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * Keep a leaf's summary, normalised.\n\t\t *\n\t\t * @param {string} id The integration id.\n\t\t * @param {{count?: number, noun?: string, rows?: Array, actions?: Array}} summary What the leaf reported.\n\t\t */\n\t\tonSummary(id, summary) {\n\t\t\tconst s = summary && typeof summary === 'object' ? summary : {}\n\t\t\tconst usableRow = (row) => row && typeof row.label === 'string' && row.label !== ''\n\t\t\tconst usableAction = (action) => action && typeof action.run === 'function' && typeof action.label === 'string' && action.label !== ''\n\t\t\tthis.summaries = {\n\t\t\t\t...this.summaries,\n\t\t\t\t[id]: {\n\t\t\t\t\tcount: Number.isFinite(s.count) ? s.count : 0,\n\t\t\t\t\tnoun: typeof s.noun === 'string' ? s.noun : '',\n\t\t\t\t\trows: Array.isArray(s.rows) ? s.rows.filter(usableRow) : [],\n\t\t\t\t\tactions: Array.isArray(s.actions) ? s.actions.filter(usableAction) : [],\n\t\t\t\t},\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-linked-widget {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 10px;\n}\n\n.cn-linked-widget__rows {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 10px;\n\tlist-style: none;\n\tmargin: 0;\n\tpadding: 0;\n}\n\n.cn-linked-widget__link {\n\talign-items: center;\n\tbackground: none;\n\tborder: 0;\n\tcolor: var(--color-main-text);\n\tdisplay: flex;\n\tfont: inherit;\n\tfont-size: 14px;\n\tfont-weight: 600;\n\tgap: 10px;\n\tmargin: 0;\n\tmin-height: 0;\n\tpadding: 0;\n\ttext-align: start;\n}\n\na.cn-linked-widget__link,\nbutton.cn-linked-widget__link {\n\tcolor: var(--color-primary-element);\n\tcursor: pointer;\n\ttext-decoration: underline;\n}\n\n.cn-linked-widget__empty {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 13px;\n\tmargin: 0;\n}\n\n.cn-linked-widget__actions {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 12px;\n}\n\n.cn-linked-widget__action {\n\tbackground: none;\n\tborder: 0;\n\tcolor: var(--color-primary-element);\n\tcursor: pointer;\n\tfont: inherit;\n\tfont-size: 14px;\n\tfont-weight: 600;\n\tmargin: 0;\n\tmin-height: 0;\n\tpadding: 0;\n\ttext-decoration: underline;\n}\n</style>\n"],"names":["_createElementBlock","_Fragment","_renderList","_createBlock","_toDisplayString","_openBlock","_createElementVNode"],"mappings":";;;AAWM,EAAA,KAAK,EAAC,kBAAkB;AAAC,EAAA,aAAC,EAAA,kBAAA;;;;AACD,EAAA,KAAA,EAAA,wBAAA;;;;;;AA0Bd,EAAA,KAAK,EAAC,wBAAG;;;;AAYF,EAAA,KAAK,EAAC,yBAAG;AAAA,EAAA,aAAA,EAAA,iBAAA;;;;AAGE,EAAA,KAAA,EAAA,2BAAA;;;;AAa5B,EAAA,MAAM,EAAN,EAAM;AAAC,EAAA,KAAK,EAAC,0BAA0B;;;;;;;;AAtDlC,IAAA,CAAA,QAAA,CAAA,UAAU,CAAC,MAAM,GAAA,CAAA;yCAmCtB,gBAAA,EAAA;4BAlCHA,kBAiCI,CAAAC,QAAA,EAAA,IAAA,EAAAC,UAAA,CAhCG,QAAA,CAAA,UAAA,EAAA,CAAA,GAAA,KAAA;iCADPF,kBAiCI,CAAA,IAAA,EAAA;cA/BF,GAAE,EAAE,GAAG,CAAC,GAAG;AACX,cAAA,KAAG,EAAC,uBAAW;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eAAA,CADF,QAAS,CAAA,SAAA,CAAA,EAAA,CAAA,YAAA;;AAED,IAAA,CAAA,QAAA,CAAA,YAAY,CAAC,MAAM,GAAA,CAAA;AAA7B,SAAAC,SAAA,EAAA,EAAAL,kBAAA,CAUK,QAVL,UAUK,EAAA;8CADG,CAAAC,QAAA,EAAA,IAAA,EAAAC,UAAA,CAPS,QAAI,CAAA,YAAA,EAAA,CAAd,MAAM,KAAA;mDAOL,CAAA,QAAA,EAAA;cANP,GAAG,EAAE,MAAM,CAAC,GAAG;AAChB,cAAA,IAAI,EAAC,QAAE;AACP,cAAA,KAAI,EAAA,0BAAA;AACJ,cAAA,aAAW,EAAC,kBAAkB;qBACxB,EAAA,MAAA,KAAE,MAAM,CAAC,GAAG,EAAA,CAAA;AACf,aAAA,EAAAE,eAAA,CAAA,MAAK,CAAE,KAAK,CAAA,EAAA,CAAA,oBAAA,UAAA,CAAA,CAAA;;;;AAKf,IAAAE,kBAAA,QAAA;wBACDN,8CACG,QAAA,CAAA,SAAA,EAAA,CAAA,QAAA,KAAA;6BADHG;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"CnLinkedWidget.vue3.js","sources":["../../../../src/components/CnLinkedWidget/CnLinkedWidget.vue?vue&type=template&id=744b4be8&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<div class=\"cn-linked-widget\" data-testid=\"cn-linked-widget\">\n\t\t<ul v-if=\"linkedRows.length > 0\" class=\"cn-linked-widget__rows\">\n\t\t\t<li\n\t\t\t\tv-for=\"row in linkedRows\"\n\t\t\t\t:key=\"row.key\"\n\t\t\t\tclass=\"cn-linked-widget__row\"\n\t\t\t\tdata-testid=\"cn-linked-row\">\n\t\t\t\t<a v-if=\"row.href\" :href=\"row.href\" class=\"cn-linked-widget__link\">\n\t\t\t\t\t<CnIcon\n\t\t\t\t\t\tv-if=\"row.icon\"\n\t\t\t\t\t\t:name=\"row.icon\"\n\t\t\t\t\t\t:size=\"18\"\n\t\t\t\t\t\taria-hidden=\"true\" />\n\t\t\t\t\t{{ row.label }}\n\t\t\t\t</a>\n\t\t\t\t<button\n\t\t\t\t\tv-else-if=\"row.run\"\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tclass=\"cn-linked-widget__link\"\n\t\t\t\t\t@click=\"row.run()\">\n\t\t\t\t\t<CnIcon\n\t\t\t\t\t\tv-if=\"row.icon\"\n\t\t\t\t\t\t:name=\"row.icon\"\n\t\t\t\t\t\t:size=\"18\"\n\t\t\t\t\t\taria-hidden=\"true\" />\n\t\t\t\t\t{{ row.label }}\n\t\t\t\t</button>\n\t\t\t\t<span v-else class=\"cn-linked-widget__link\">\n\t\t\t\t\t<CnIcon\n\t\t\t\t\t\tv-if=\"row.icon\"\n\t\t\t\t\t\t:name=\"row.icon\"\n\t\t\t\t\t\t:size=\"18\"\n\t\t\t\t\t\taria-hidden=\"true\" />\n\t\t\t\t\t{{ row.label }}\n\t\t\t\t</span>\n\t\t\t</li>\n\t\t</ul>\n\t\t<!-- A div, not a p: a theme's paragraph rule would draw the muted\n\t\t 13px line at body size. -->\n\t\t<div v-if=\"emptyLine\" class=\"cn-linked-widget__empty\" data-testid=\"cn-linked-empty\">\n\t\t\t{{ emptyLine }}\n\t\t</div>\n\t\t<span v-if=\"emptyActions.length > 0\" class=\"cn-linked-widget__actions\">\n\t\t\t<button\n\t\t\t\tv-for=\"action in emptyActions\"\n\t\t\t\t:key=\"action.key\"\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"cn-linked-widget__action\"\n\t\t\t\tdata-testid=\"cn-linked-action\"\n\t\t\t\t@click=\"action.run()\">\n\t\t\t\t{{ action.label }}\n\t\t\t</button>\n\t\t</span>\n\t\t<!-- The leaves run here, unseen: each reads its own data and reports\n\t\t a summary through `onSummary`; this card draws the rows. -->\n\t\t<div hidden class=\"cn-linked-widget__leaves\">\n\t\t\t<CnLeafMountHost\n\t\t\t\tv-for=\"provider in providers\"\n\t\t\t\t:key=\"provider.id\"\n\t\t\t\t:provider=\"provider\"\n\t\t\t\t:mountProps=\"mountPropsById[provider.id]\" />\n\t\t</div>\n\t</div>\n</template>\n\n<script>\nimport { getLanguage, translate as t } from '@nextcloud/l10n'\nimport CnIcon from '../CnIcon/CnIcon.vue'\nimport CnLeafMountHost from '../CnLeafMountHost/CnLeafMountHost.vue'\nimport { useIntegrationRegistry } from '../../composables/useIntegrationRegistry.js'\nimport { isAppInstalled } from '../../utils/appInstalled.js'\nimport { fetchReferenceObjects } from '../../utils/boardReferenceColumns.js'\nimport { fillTemplate } from '../../utils/fillTemplate.js'\nimport { prefixUrl } from '../../utils/headers.js'\n\n/**\n * Join nouns as a sentence list in the user's language (\"a, b en c\").\n *\n * @param {string[]} items The nouns.\n * @return {string} The list.\n */\nfunction joinList(items) {\n\ttry {\n\t\treturn new Intl.ListFormat((getLanguage() || 'en').replace('_', '-'), { style: 'long', type: 'conjunction' }).format(items)\n\t} catch {\n\t\treturn items.join(', ')\n\t}\n}\n\n/**\n * CnLinkedWidget — the `linked` widget: one card that lists what other apps\n * hold for this record (DqZaak \"Gekoppeld\").\n *\n * `content.leaves` names the mount-mode integration leaves, in order. Each is\n * mounted out of sight with an `onSummary(summary)` prop and reports\n * `{ count, noun, rows?, actions? }`: a leaf with something linked draws its\n * rows (`{ label, href?, run?, icon? }`); the leaves with nothing linked share\n * one line (\"Leges, contract en projecten: niets gekoppeld\") followed by their\n * actions. A leaf whose app is absent is not registered and is left out.\n *\n * A leaf may also be a record leaf, written in the manifest instead of\n * registered by an app: `{ id, register, schema, filter?, requiredApp?, noun,\n * label, href?, icon? }`. The card reads that register's records matching\n * `filter` (`@objectId` is this record's id) and lists one row per record,\n * `label` and `href` filled from it (DqZaak \"Vraag in pipelinq\": the\n * requests whose case reference is this case). It is left out when\n * `requiredApp` is not installed. Texts go through the host translate.\n *\n * @spec openspec/changes/linked-integrations-card/specs/linked-integrations-card/spec.md#requirement-one-card-lists-the-linked-integrations-of-a-record\n */\nexport default {\n\tname: 'CnLinkedWidget',\n\n\tcomponents: { CnIcon, CnLeafMountHost },\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/** `{ leaves: Array<string|object> }`: integration ids or record leaves, in the order to list them. */\n\t\tcontent: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/** The record's id. */\n\t\tobjectId: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** The record's register. */\n\t\tregister: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** The record's schema. */\n\t\tschema: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\t},\n\n\tsetup() {\n\t\tconst { integrations, getById } = useIntegrationRegistry()\n\t\treturn { integrations, getById }\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\t/** The latest summary each leaf reported, by integration id. */\n\t\t\tsummaries: {},\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** @return {Array<string|object>} The configured leaves. */\n\t\tleaves() {\n\t\t\tconst leaves = this.content && this.content.leaves\n\t\t\treturn Array.isArray(leaves) ? leaves : []\n\t\t},\n\n\t\t/** @return {string[]} The configured integration ids. */\n\t\tleafIds() {\n\t\t\treturn this.leaves.filter((id) => typeof id === 'string' && id !== '')\n\t\t},\n\n\t\t/** @return {object[]} The record leaves whose app is here. */\n\t\trecordLeaves() {\n\t\t\treturn this.leaves.filter((leaf) => leaf && typeof leaf === 'object' && typeof leaf.id === 'string' && leaf.id !== ''\n\t\t\t\t&& leaf.register && leaf.schema && (!leaf.requiredApp || isAppInstalled(leaf.requiredApp)))\n\t\t},\n\n\t\t/** @return {string[]} Every listed leaf's id, in the configured order. */\n\t\torderedIds() {\n\t\t\tconst providers = new Set(this.providers.map((p) => p.id))\n\t\t\tconst records = new Set(this.recordLeaves.map((leaf) => leaf.id))\n\t\t\treturn this.leaves\n\t\t\t\t.map((leaf) => (typeof leaf === 'string' ? leaf : (leaf && leaf.id)))\n\t\t\t\t.filter((id) => providers.has(id) || records.has(id))\n\t\t},\n\n\t\t/** @return {object[]} The registered mount-mode providers, in the configured order. */\n\t\tproviders() {\n\t\t\t// Read so a leaf that registers after this card renders still joins it.\n\t\t\tvoid this.integrations\n\t\t\treturn this.leafIds\n\t\t\t\t.map((id) => this.getById(id))\n\t\t\t\t.filter((p) => p && p.renderMode === 'mount' && typeof p.mount === 'function' && typeof p.unmount === 'function')\n\t\t},\n\n\t\t/** @return {object} The mount props per leaf. */\n\t\tmountPropsById() {\n\t\t\tconst context = { register: this.register, schema: this.schema, objectId: String(this.objectId || '') }\n\t\t\tconst out = {}\n\t\t\tfor (const provider of this.providers) {\n\t\t\t\tout[provider.id] = {\n\t\t\t\t\tsurface: 'detail-page',\n\t\t\t\t\t...context,\n\t\t\t\t\tintegrationContext: { ...context },\n\t\t\t\t\tonSummary: (summary) => this.onSummary(provider.id, summary),\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn out\n\t\t},\n\n\t\t/** @return {Array<{id: string, summary: object}>} The reported summaries, in order. */\n\t\treported() {\n\t\t\treturn this.orderedIds\n\t\t\t\t.filter((id) => this.summaries[id])\n\t\t\t\t.map((id) => ({ id, summary: this.summaries[id] }))\n\t\t},\n\n\t\t/** @return {object[]} The rows of the leaves that have something linked. */\n\t\tlinkedRows() {\n\t\t\tconst rows = []\n\t\t\tfor (const { id, summary } of this.reported) {\n\t\t\t\tif (summary.count <= 0) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tconst own = summary.rows.length > 0\n\t\t\t\t\t? summary.rows\n\t\t\t\t\t: [{ label: `${summary.noun} (${summary.count})` }]\n\t\t\t\town.forEach((row, index) => rows.push({ ...row, key: `${id}-${index}` }))\n\t\t\t}\n\t\t\treturn rows\n\t\t},\n\n\t\t/** @return {object[]} The leaves with nothing linked. */\n\t\temptyLeaves() {\n\t\t\treturn this.reported.filter(({ summary }) => summary.count <= 0)\n\t\t},\n\n\t\t/** @return {string} \"Leges, contract en projecten: niets gekoppeld\", or ''. */\n\t\temptyLine() {\n\t\t\tconst nouns = this.emptyLeaves.map(({ summary }) => summary.noun).filter((noun) => noun !== '')\n\t\t\tif (nouns.length === 0) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst list = joinList(nouns)\n\t\t\treturn t('nextcloud-vue', '{things}: nothing linked', { things: list.charAt(0).toUpperCase() + list.slice(1) })\n\t\t},\n\n\t\t/** @return {object[]} The actions of the leaves with nothing linked. */\n\t\temptyActions() {\n\t\t\tconst actions = []\n\t\t\tfor (const { id, summary } of this.emptyLeaves) {\n\t\t\t\tsummary.actions.forEach((action, index) => actions.push({ ...action, key: `${id}-${index}` }))\n\t\t\t}\n\t\t\treturn actions\n\t\t},\n\t},\n\n\twatch: {\n\t\trecordLeaves: {\n\t\t\thandler() {\n\t\t\t\tthis.recordLeaves.forEach((leaf) => this.readRecordLeaf(leaf))\n\t\t\t},\n\n\t\t\timmediate: true,\n\t\t},\n\n\t\tobjectId() {\n\t\t\tthis.recordLeaves.forEach((leaf) => this.readRecordLeaf(leaf))\n\t\t},\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * Read a record leaf's records and report them as its summary. A\n\t\t * failed read reports nothing, so the leaf is not listed as empty.\n\t\t *\n\t\t * @param {object} leaf The record leaf.\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync readRecordLeaf(leaf) {\n\t\t\tconst objectId = String(this.objectId || '')\n\t\t\tif (objectId === '') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst filter = {}\n\t\t\tfor (const [key, value] of Object.entries(leaf.filter || {})) {\n\t\t\t\tfilter[key] = value === '@objectId' ? objectId : value\n\t\t\t}\n\t\t\tlet rows\n\t\t\ttry {\n\t\t\t\trows = await fetchReferenceObjects({ register: leaf.register, schema: leaf.schema, filter, limit: leaf.limit || 20 })\n\t\t\t} catch {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst label = leaf.label ? this.cnTranslate(leaf.label) : ''\n\t\t\tthis.onSummary(leaf.id, {\n\t\t\t\tcount: rows.length,\n\t\t\t\tnoun: leaf.noun ? this.cnTranslate(leaf.noun) : '',\n\t\t\t\trows: rows.map((row) => {\n\t\t\t\t\tconst href = leaf.href ? fillTemplate(leaf.href, row) : ''\n\t\t\t\t\treturn { label: fillTemplate(label, row), href: href ? prefixUrl(href) : undefined, icon: leaf.icon || undefined }\n\t\t\t\t}),\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Keep a leaf's summary, normalised.\n\t\t *\n\t\t * @param {string} id The integration id.\n\t\t * @param {{count?: number, noun?: string, rows?: Array, actions?: Array}} summary What the leaf reported.\n\t\t */\n\t\tonSummary(id, summary) {\n\t\t\tconst s = summary && typeof summary === 'object' ? summary : {}\n\t\t\tconst usableRow = (row) => row && typeof row.label === 'string' && row.label !== ''\n\t\t\tconst usableAction = (action) => action && typeof action.run === 'function' && typeof action.label === 'string' && action.label !== ''\n\t\t\tthis.summaries = {\n\t\t\t\t...this.summaries,\n\t\t\t\t[id]: {\n\t\t\t\t\tcount: Number.isFinite(s.count) ? s.count : 0,\n\t\t\t\t\tnoun: typeof s.noun === 'string' ? s.noun : '',\n\t\t\t\t\trows: Array.isArray(s.rows) ? s.rows.filter(usableRow) : [],\n\t\t\t\t\tactions: Array.isArray(s.actions) ? s.actions.filter(usableAction) : [],\n\t\t\t\t},\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-linked-widget {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 10px;\n}\n\n.cn-linked-widget__rows {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 10px;\n\tlist-style: none;\n\tmargin: 0;\n\tpadding: 0;\n}\n\n.cn-linked-widget__link {\n\talign-items: center;\n\tbackground: none;\n\tborder: 0;\n\tcolor: var(--color-main-text);\n\tdisplay: flex;\n\tfont: inherit;\n\tfont-size: 14px;\n\tfont-weight: 600;\n\tgap: 10px;\n\tmargin: 0;\n\tmin-height: 0;\n\tpadding: 0;\n\ttext-align: start;\n}\n\na.cn-linked-widget__link,\nbutton.cn-linked-widget__link {\n\tcolor: var(--color-primary-element);\n\tcursor: pointer;\n\ttext-decoration: underline;\n}\n\n.cn-linked-widget__empty {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 13px;\n\tmargin: 0;\n}\n\n.cn-linked-widget__actions {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 12px;\n}\n\n.cn-linked-widget__action {\n\tbackground: none;\n\tborder: 0;\n\tcolor: var(--color-primary-element);\n\tcursor: pointer;\n\tfont: inherit;\n\tfont-size: 14px;\n\tfont-weight: 600;\n\tmargin: 0;\n\tmin-height: 0;\n\tpadding: 0;\n\ttext-decoration: underline;\n}\n</style>\n"],"names":["_createElementBlock","_Fragment","_renderList","_createBlock","_toDisplayString","_openBlock","_createElementVNode"],"mappings":";;;AAWM,EAAA,KAAK,EAAC,kBAAkB;AAAC,EAAA,aAAC,EAAA,kBAAA;;;;AACD,EAAA,KAAA,EAAA,wBAAA;;;;;;AA0Bd,EAAA,KAAK,EAAC,wBAAG;;;;AAYF,EAAA,KAAK,EAAC,yBAAG;AAAA,EAAA,aAAA,EAAA,iBAAA;;;;AAGE,EAAA,KAAA,EAAA,2BAAA;;;;AAa5B,EAAA,MAAM,EAAN,EAAM;AAAC,EAAA,KAAK,EAAC,0BAA0B;;;;;;;;AAtDlC,IAAA,CAAA,QAAA,CAAA,UAAU,CAAC,MAAM,GAAA,CAAA;yCAmCtB,gBAAA,EAAA;4BAlCHA,kBAiCI,CAAAC,QAAA,EAAA,IAAA,EAAAC,UAAA,CAhCG,QAAA,CAAA,UAAA,EAAA,CAAA,GAAA,KAAA;iCADPF,kBAiCI,CAAA,IAAA,EAAA;cA/BF,GAAE,EAAE,GAAG,CAAC,G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A;wCAEd,CAAA,KAAA,YAAA,EAAAA,eAAA,CADF,QAAS,CAAA,SAAA,CAAA,EAAA,CAAA,YAAA;;AAED,IAAA,CAAA,QAAA,CAAA,YAAY,CAAC,MAAM,GAAA,CAAA;AAA7B,SAAAC,SAAA,EAAA,EAAAL,kBAAA,CAUK,QAVL,UAUK,EAAA;8CADG,CAAAC,QAAA,EAAA,IAAA,EAAAC,UAAA,CAPS,QAAI,CAAA,YAAA,EAAA,CAAd,MAAM,KAAA;mDAOL,CAAA,QAAA,EAAA;cANP,GAAG,EAAE,MAAM,CAAC,GAAG;AAChB,cAAA,IAAI,EAAC,QAAE;AACP,cAAA,KAAI,EAAA,0BAAA;AACJ,cAAA,aAAW,EAAC,kBAAkB;qBACxB,EAAA,MAAA,KAAE,MAAM,CAAC,GAAG,EAAA,CAAA;AACf,aAAA,EAAAE,eAAA,CAAA,MAAK,CAAE,KAAK,CAAA,EAAA,CAAA,oBAAA,UAAA,CAAA,CAAA;;;;AAKf,IAAAE,kBAAA,QAAA;wBACDN,8CACG,QAAA,CAAA,SAAA,EAAA,CAAA,QAAA,KAAA;6BADHG;;;;;;;;;;;;"}
|
|
@@ -2,7 +2,7 @@ import script from './CnMapWidget.vue2.js';
|
|
|
2
2
|
import { render } from './CnMapWidget.vue3.js';
|
|
3
3
|
|
|
4
4
|
script.render = render;
|
|
5
|
-
script.__scopeId = "data-v-
|
|
5
|
+
script.__scopeId = "data-v-e2f8f29c";
|
|
6
6
|
const __sfc_main = script;
|
|
7
7
|
|
|
8
8
|
export { __sfc_main as default };
|
|
@@ -330,6 +330,8 @@ var script = {
|
|
|
330
330
|
* `clustering`, `height`, `autoFit`, `layers`, `basemaps`) overrides the
|
|
331
331
|
* matching flat prop. Direct (non-dashboard) consumers omit this and pass
|
|
332
332
|
* the flat props instead. See the `cfg` computed for the merge rules.
|
|
333
|
+
* `labelsBelow: true` writes the markers' `popupField` values on a line
|
|
334
|
+
* under the map ("Fietspad Lindelaan, tussen nummer 2 en 40").
|
|
333
335
|
*
|
|
334
336
|
* @type {object|null}
|
|
335
337
|
*/
|
|
@@ -403,6 +405,8 @@ var script = {
|
|
|
403
405
|
// Whether the marker source has answered, and with how many markers.
|
|
404
406
|
markersLoaded: false,
|
|
405
407
|
markerCount: 0,
|
|
408
|
+
// The markers' `popupField` values, for `content.labelsBelow`.
|
|
409
|
+
markerLabels: [],
|
|
406
410
|
// Whether the marker source could not be read (not: read and empty).
|
|
407
411
|
markersFailed: false,
|
|
408
412
|
// Set once the user has framed the view themselves; stops autoFit.
|
|
@@ -515,6 +519,21 @@ var script = {
|
|
|
515
519
|
return countLine(this.content?.headerNote, this)
|
|
516
520
|
},
|
|
517
521
|
|
|
522
|
+
/**
|
|
523
|
+
* The line under the map naming its places (`content.labelsBelow: true`):
|
|
524
|
+
* each marker's `markers.popupField` value, joined by ", ", as the case
|
|
525
|
+
* boards draw "Fietspad Lindelaan, tussen nummer 2 en 40" under the
|
|
526
|
+
* Locaties map. Empty until the source answered with labelled markers.
|
|
527
|
+
*
|
|
528
|
+
* @return {string}
|
|
529
|
+
*/
|
|
530
|
+
markerCaption() {
|
|
531
|
+
if (this.content?.labelsBelow !== true || !this.markersLoaded || this.markersFailed) {
|
|
532
|
+
return ''
|
|
533
|
+
}
|
|
534
|
+
return (this.markerLabels || []).join(', ')
|
|
535
|
+
},
|
|
536
|
+
|
|
518
537
|
markerStatusText() {
|
|
519
538
|
const markers = this.cfg.markers;
|
|
520
539
|
if (!markers || !markers.dataSource || !this.markersLoaded) {
|
|
@@ -940,6 +959,23 @@ var script = {
|
|
|
940
959
|
});
|
|
941
960
|
},
|
|
942
961
|
|
|
962
|
+
/**
|
|
963
|
+
* The non-empty `markers.popupField` values of the features, in order.
|
|
964
|
+
*
|
|
965
|
+
* @param {Array|null} features The features.
|
|
966
|
+
* @return {string[]}
|
|
967
|
+
*/
|
|
968
|
+
labelsOf(features) {
|
|
969
|
+
const field = this.cfg.markers && this.cfg.markers.popupField;
|
|
970
|
+
if (!field || !Array.isArray(features)) {
|
|
971
|
+
return []
|
|
972
|
+
}
|
|
973
|
+
return features
|
|
974
|
+
.map((feature) => (feature && feature.properties ? feature.properties[field] : null))
|
|
975
|
+
.filter((label) => typeof label === 'string' && label.trim() !== '')
|
|
976
|
+
.map((label) => label.trim())
|
|
977
|
+
},
|
|
978
|
+
|
|
943
979
|
/**
|
|
944
980
|
* Mount the configured `markers` onto the Leaflet map. Reads from
|
|
945
981
|
* `features[]` (inline) OR `dataSource.url` (HTTP fetch). When
|
|
@@ -968,6 +1004,7 @@ var script = {
|
|
|
968
1004
|
this.markersFailed = false;
|
|
969
1005
|
const features = await this.collectFeatures();
|
|
970
1006
|
this.markerCount = Array.isArray(features) ? features.length : 0;
|
|
1007
|
+
this.markerLabels = this.labelsOf(features);
|
|
971
1008
|
this.markersLoaded = true;
|
|
972
1009
|
if (!features || features.length === 0) {
|
|
973
1010
|
return
|