@conduction/nextcloud-vue 2.161.0 → 2.162.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/CnActionsMenu/CnActionsMenu.vue2.js +3 -2
- package/dist/esm/components/CnActionsMenu/CnActionsMenu.vue2.js.map +1 -1
- package/dist/esm/components/CnActionsMenu/CnActionsMenu.vue3.js.map +1 -1
- package/dist/esm/components/CnAddressSearch/CnAddressSearch.vue.js +1 -1
- package/dist/esm/components/CnAddressSearch/CnAddressSearch.vue2.js +2 -1
- package/dist/esm/components/CnAddressSearch/CnAddressSearch.vue2.js.map +1 -1
- package/dist/esm/components/CnAddressSearch/CnAddressSearch.vue3.js.map +1 -1
- package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue.js +1 -1
- package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue2.js +2 -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/CnDataTable/CnDataTable.vue2.js +8 -8
- package/dist/esm/components/CnDataTable/CnDataTable.vue2.js.map +1 -1
- package/dist/esm/components/CnDataTable/CnDataTable.vue3.js.map +1 -1
- package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue.js +1 -1
- package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue2.js +23 -0
- package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue2.js.map +1 -1
- package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue3.js.map +1 -1
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue.js +1 -1
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue2.js +48 -5
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue3.js +2 -1
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue.js +1 -1
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue2.js +4 -3
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue2.js.map +1 -1
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue3.js.map +1 -1
- package/dist/esm/components/CnFilesBrowser/filesBrowser.js +6 -5
- package/dist/esm/components/CnFilesBrowser/filesBrowser.js.map +1 -1
- package/dist/esm/components/CnFilesWidget/CnFilesWidget.vue.js +1 -1
- package/dist/esm/components/CnFilesWidget/CnFilesWidget.vue2.js +2 -1
- package/dist/esm/components/CnFilesWidget/CnFilesWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnFilesWidget/CnFilesWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnFlowRunsWidget/CnFlowRunsWidget.vue.js +1 -1
- package/dist/esm/components/CnFlowRunsWidget/CnFlowRunsWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnFlowRunsWidget/CnFlowRunsWidget.vue3.js +41 -39
- package/dist/esm/components/CnFlowRunsWidget/CnFlowRunsWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnFolderSidebar/webdavFolders.js +2 -1
- package/dist/esm/components/CnFolderSidebar/webdavFolders.js.map +1 -1
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js +11 -3
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js.map +1 -1
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js.map +1 -1
- package/dist/esm/components/CnMenuWidget/menuActive.js +2 -1
- package/dist/esm/components/CnMenuWidget/menuActive.js.map +1 -1
- package/dist/esm/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue.js +1 -1
- package/dist/esm/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue2.js +39 -2
- package/dist/esm/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue3.js +1 -1
- package/dist/esm/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnPageTreeNode/CnPageTreeNode.vue.js +1 -1
- package/dist/esm/components/CnPageTreeNode/CnPageTreeNode.vue2.js +2 -1
- package/dist/esm/components/CnPageTreeNode/CnPageTreeNode.vue2.js.map +1 -1
- package/dist/esm/components/CnPageTreeNode/CnPageTreeNode.vue3.js.map +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue.js +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js +5 -5
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js.map +1 -1
- package/dist/esm/integrations/builtin/email/CnEmailTab.vue.js +1 -1
- package/dist/esm/integrations/builtin/email/CnEmailTab.vue2.js +130 -1
- package/dist/esm/integrations/builtin/email/CnEmailTab.vue2.js.map +1 -1
- package/dist/esm/integrations/builtin/email/CnEmailTab.vue3.js +27 -16
- package/dist/esm/integrations/builtin/email/CnEmailTab.vue3.js.map +1 -1
- package/dist/esm/l10n/en.json.js +9 -1
- package/dist/esm/l10n/en.json.js.map +1 -1
- package/dist/esm/l10n/nl.json.js +9 -1
- package/dist/esm/l10n/nl.json.js.map +1 -1
- package/dist/esm/library-style.js +1 -1
- package/dist/esm/nextcloud-vue.css +560 -488
- package/dist/esm/utils/buildManifestRoutes.js +2 -1
- package/dist/esm/utils/buildManifestRoutes.js.map +1 -1
- package/dist/esm/utils/cnFetch.js +1 -15
- package/dist/esm/utils/cnFetch.js.map +1 -1
- package/dist/esm/utils/fillTemplate.js +29 -2
- package/dist/esm/utils/fillTemplate.js.map +1 -1
- package/dist/esm/utils/forge.js +4 -1
- package/dist/esm/utils/forge.js.map +1 -1
- package/dist/esm/utils/myTeam.js +17 -3
- package/dist/esm/utils/myTeam.js.map +1 -1
- package/dist/esm/utils/rowAggregate.js +20 -1
- package/dist/esm/utils/rowAggregate.js.map +1 -1
- package/dist/esm/utils/trailingSlashes.js +24 -0
- package/dist/esm/utils/trailingSlashes.js.map +1 -0
- package/dist/nextcloud-vue.cjs.js +1009 -675
- package/dist/nextcloud-vue.cjs.js.map +2 -2
- package/dist/nextcloud-vue.css +560 -488
- package/l10n/en.json +9 -1
- package/l10n/nl.json +9 -1
- package/package.json +1 -1
- package/src/components/CnActionsMenu/CnActionsMenu.vue +3 -2
- package/src/components/CnAddressSearch/CnAddressSearch.vue +2 -1
- package/src/components/CnDashboardPage/CnDashboardPage.vue +2 -1
- package/src/components/CnDataTable/CnDataTable.vue +8 -8
- package/src/components/CnDetailWidgetHost/CnDetailWidgetHost.vue +23 -0
- package/src/components/CnFactsWidget/CnFactsWidget.vue +49 -5
- package/src/components/CnFilesBrowser/CnFilesBrowser.vue +4 -3
- package/src/components/CnFilesBrowser/filesBrowser.js +6 -5
- package/src/components/CnFilesWidget/CnFilesWidget.vue +2 -1
- package/src/components/CnFlowRunsWidget/CnFlowRunsWidget.vue +1 -1
- package/src/components/CnFolderSidebar/webdavFolders.js +2 -1
- package/src/components/CnIndexPage/CnIndexPage.vue +11 -3
- package/src/components/CnMenuWidget/menuActive.js +2 -1
- package/src/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue +40 -3
- package/src/components/CnPageTreeNode/CnPageTreeNode.vue +2 -1
- package/src/components/CnRecordListWidget/CnRecordListWidget.vue +5 -5
- package/src/css/dialog.css +7 -0
- package/src/css/look-board-detail.css +35 -0
- package/src/css/look-board.css +18 -1
- package/src/integrations/builtin/email/CnEmailTab.vue +155 -4
- package/src/utils/buildManifestRoutes.js +2 -1
- package/src/utils/cnFetch.js +3 -15
- package/src/utils/fillTemplate.js +29 -2
- package/src/utils/forge.js +3 -1
- package/src/utils/myTeam.js +17 -3
- package/src/utils/rowAggregate.js +19 -0
- package/src/utils/trailingSlashes.js +21 -0
package/l10n/en.json
CHANGED
|
@@ -2509,7 +2509,15 @@
|
|
|
2509
2509
|
"Filter on {name}": "Filter on {name}",
|
|
2510
2510
|
"(empty)": "(empty)",
|
|
2511
2511
|
"Drag, or use the arrow keys, to move": "Drag, or use the arrow keys, to move",
|
|
2512
|
-
"The new order could not be saved": "The new order could not be saved"
|
|
2512
|
+
"The new order could not be saved": "The new order could not be saved",
|
|
2513
|
+
"From {name}": "From {name}",
|
|
2514
|
+
"To {name}": "To {name}",
|
|
2515
|
+
"linked automatically": "linked automatically",
|
|
2516
|
+
"linked automatically via {mailbox}": "linked automatically via {mailbox}",
|
|
2517
|
+
"from a saved mail file": "from a saved mail file",
|
|
2518
|
+
"linked by {name}": "linked by {name}",
|
|
2519
|
+
"Archived as PDF": "Archived as PDF",
|
|
2520
|
+
"Archived as {format}": "Archived as {format}"
|
|
2513
2521
|
},
|
|
2514
2522
|
"plurals": {
|
|
2515
2523
|
"{count} member": [
|
package/l10n/nl.json
CHANGED
|
@@ -2774,7 +2774,15 @@
|
|
|
2774
2774
|
"Filter on {name}": "Filteren op {name}",
|
|
2775
2775
|
"(empty)": "(leeg)",
|
|
2776
2776
|
"Drag, or use the arrow keys, to move": "Sleep, of gebruik de pijltjestoetsen, om te verplaatsen",
|
|
2777
|
-
"The new order could not be saved": "De nieuwe volgorde kon niet worden opgeslagen"
|
|
2777
|
+
"The new order could not be saved": "De nieuwe volgorde kon niet worden opgeslagen",
|
|
2778
|
+
"From {name}": "Van {name}",
|
|
2779
|
+
"To {name}": "Aan {name}",
|
|
2780
|
+
"linked automatically": "automatisch gekoppeld",
|
|
2781
|
+
"linked automatically via {mailbox}": "automatisch gekoppeld via {mailbox}",
|
|
2782
|
+
"from a saved mail file": "uit een opgeslagen mailbestand",
|
|
2783
|
+
"linked by {name}": "door {name} gekoppeld",
|
|
2784
|
+
"Archived as PDF": "Als pdf gearchiveerd",
|
|
2785
|
+
"Archived as {format}": "Als {format} gearchiveerd"
|
|
2778
2786
|
},
|
|
2779
2787
|
"plurals": {
|
|
2780
2788
|
"{count} member": [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@conduction/nextcloud-vue",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.162.0",
|
|
4
4
|
"description": "Shared Vue component library for Conduction Nextcloud apps — complements @nextcloud/vue with higher-level components, OpenRegister integration, and NL Design System support",
|
|
5
5
|
"homepage": "https://github.com/ConductionNL/nextcloud-vue#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -134,6 +134,7 @@ import DotsHorizontal from 'vue-material-design-icons/DotsHorizontal.vue'
|
|
|
134
134
|
import LightbulbOutline from 'vue-material-design-icons/LightbulbOutline.vue'
|
|
135
135
|
import Refresh from 'vue-material-design-icons/Refresh.vue'
|
|
136
136
|
import { buildBugReportUrl, buildFeatureRequestUrl, DEFAULT_FORGE } from '../../utils/forge.js'
|
|
137
|
+
import { stripTrailingSlashes } from '../../utils/trailingSlashes.js'
|
|
137
138
|
|
|
138
139
|
/**
|
|
139
140
|
* The fleet's per-app documentation site, derived from the app id. Used only
|
|
@@ -182,10 +183,10 @@ export function resolveDocsUrl(base, anchor) {
|
|
|
182
183
|
try {
|
|
183
184
|
return new URL(a, b).toString()
|
|
184
185
|
} catch {
|
|
185
|
-
return `${b
|
|
186
|
+
return `${stripTrailingSlashes(b)}${a}`
|
|
186
187
|
}
|
|
187
188
|
}
|
|
188
|
-
return `${b.replace(/#.*$/, '')
|
|
189
|
+
return `${stripTrailingSlashes(b.replace(/#.*$/, ''))}#${a}`
|
|
189
190
|
}
|
|
190
191
|
|
|
191
192
|
/**
|
|
@@ -30,6 +30,7 @@ import axios from '@nextcloud/axios'
|
|
|
30
30
|
import { t } from '@nextcloud/l10n'
|
|
31
31
|
import { generateUrl } from '@nextcloud/router'
|
|
32
32
|
import { prefixUrl } from '../../utils/headers.js'
|
|
33
|
+
import { stripTrailingSlashes } from '../../utils/trailingSlashes.js'
|
|
33
34
|
import { CnSearchSelect } from '../CnSearchSelect/index.js'
|
|
34
35
|
|
|
35
36
|
/** How long typing rests before a search runs, in ms. */
|
|
@@ -194,7 +195,7 @@ export default {
|
|
|
194
195
|
*/
|
|
195
196
|
baseUrl() {
|
|
196
197
|
if (this.endpoint) {
|
|
197
|
-
return this.endpoint
|
|
198
|
+
return stripTrailingSlashes(this.endpoint)
|
|
198
199
|
}
|
|
199
200
|
const roots = (typeof window !== 'undefined' && window.OC && window.OC.appswebroots) || {}
|
|
200
201
|
const app = this.appCandidates.find((id) => Object.hasOwn(roots, id)) || this.appCandidates[0] || 'integriq'
|
|
@@ -4899,7 +4899,8 @@ export default {
|
|
|
4899
4899
|
if (reported && Number.isFinite(reported.count)) {
|
|
4900
4900
|
return title.replace(/\{count\}/g, String(reported.count))
|
|
4901
4901
|
}
|
|
4902
|
-
|
|
4902
|
+
const parts = title.split('{count}')
|
|
4903
|
+
return parts.map((part, i) => (i < parts.length - 1 ? part.trimEnd() : part)).join('').trim()
|
|
4903
4904
|
},
|
|
4904
4905
|
|
|
4905
4906
|
/**
|
|
@@ -498,7 +498,7 @@ import { fillTemplate, firstFilled, joinTemplateParts } from '../../utils/fillTe
|
|
|
498
498
|
import { lensUnavailableText, readLensReports } from '../../utils/lensAvailability.js'
|
|
499
499
|
import { followLinkClick, openRowTarget, resolveHref } from '../../utils/linkNavigation.js'
|
|
500
500
|
import { nextSortState } from '../../utils/multiColumnSort.js'
|
|
501
|
-
import { fetchRowAggregate } from '../../utils/rowAggregate.js'
|
|
501
|
+
import { cellsOf, fetchRowAggregate } from '../../utils/rowAggregate.js'
|
|
502
502
|
import { isNewTabClick, isNewTabHandled, isRowMiddleClick, markNewTabHandled, preventMiddleClickAutoscroll } from '../../utils/rowAuxClick.js'
|
|
503
503
|
import { DEFAULT_ROW_INDICATOR_CAP, indicatorApplies, resolveRowIndicators } from '../../utils/rowIndicators.js'
|
|
504
504
|
import { columnsFromSchema } from '../../utils/schema.js'
|
|
@@ -2438,11 +2438,11 @@ export default {
|
|
|
2438
2438
|
}
|
|
2439
2439
|
const id = ++this.aggregateRequestId
|
|
2440
2440
|
this.aggregateLoading = true
|
|
2441
|
-
const next =
|
|
2441
|
+
const next = new Map()
|
|
2442
2442
|
const jobs = []
|
|
2443
2443
|
for (const row of this.rows) {
|
|
2444
2444
|
const rowKey = String(row[this.rowKey])
|
|
2445
|
-
|
|
2445
|
+
const cells = cellsOf(next, rowKey)
|
|
2446
2446
|
for (const col of aggCols) {
|
|
2447
2447
|
const agg = col.aggregate
|
|
2448
2448
|
if (isEndpointAggregate(col)) {
|
|
@@ -2455,12 +2455,12 @@ export default {
|
|
|
2455
2455
|
// first of them sorted on it descending ("Laatste contact").
|
|
2456
2456
|
jobs.push(fetchRowAggregate(agg, row, (r, path) => this.getCellValue(r, path))
|
|
2457
2457
|
.then((value) => {
|
|
2458
|
-
|
|
2458
|
+
cells[col.key] = value
|
|
2459
2459
|
})
|
|
2460
2460
|
.catch((e) => {
|
|
2461
2461
|
// eslint-disable-next-line no-console
|
|
2462
2462
|
console.warn(`[CnDataTable] aggregate "${col.key}" count failed for row ${rowKey}`, e)
|
|
2463
|
-
|
|
2463
|
+
cells[col.key] = undefined
|
|
2464
2464
|
}))
|
|
2465
2465
|
}
|
|
2466
2466
|
}
|
|
@@ -2471,7 +2471,7 @@ export default {
|
|
|
2471
2471
|
if (id !== this.aggregateRequestId) {
|
|
2472
2472
|
return
|
|
2473
2473
|
}
|
|
2474
|
-
this.aggregateValues = next
|
|
2474
|
+
this.aggregateValues = Object.fromEntries(next)
|
|
2475
2475
|
this.aggregateLoading = false
|
|
2476
2476
|
},
|
|
2477
2477
|
|
|
@@ -2502,7 +2502,7 @@ export default {
|
|
|
2502
2502
|
* hides the column.
|
|
2503
2503
|
*
|
|
2504
2504
|
* @param {object} col The column.
|
|
2505
|
-
* @param {object} next The values being built, by row then column.
|
|
2505
|
+
* @param {Map<string, object>} next The values being built, by row then column.
|
|
2506
2506
|
* @param {number} id The batch id, to drop a stale answer.
|
|
2507
2507
|
* @return {Promise<void>}
|
|
2508
2508
|
* @spec openspec/changes/aggregate-from-endpoint/specs/cn-data-table/spec.md
|
|
@@ -2534,7 +2534,7 @@ export default {
|
|
|
2534
2534
|
}
|
|
2535
2535
|
for (const row of this.rows) {
|
|
2536
2536
|
const k = keyOf(row)
|
|
2537
|
-
next
|
|
2537
|
+
cellsOf(next, String(row[this.rowKey]))[col.key] = k !== '' && values[k] !== undefined ? values[k] : 0
|
|
2538
2538
|
}
|
|
2539
2539
|
},
|
|
2540
2540
|
|
|
@@ -1585,6 +1585,27 @@ export default {
|
|
|
1585
1585
|
return title ? { titleLabel: title } : {}
|
|
1586
1586
|
},
|
|
1587
1587
|
|
|
1588
|
+
/**
|
|
1589
|
+
* An integration widget's `labels` (prop name to text), translated in
|
|
1590
|
+
* the host's language: a leaf cannot translate the host app's words.
|
|
1591
|
+
*
|
|
1592
|
+
* @return {object} Prop name to translated text.
|
|
1593
|
+
* @spec openspec/changes/leaf-labels-in-the-host-language/specs/leaf-labels-in-the-host-language/spec.md#requirement-an-integration-widget-gives-its-leaf-labels-in-the-hosts-language
|
|
1594
|
+
*/
|
|
1595
|
+
leafLabels() {
|
|
1596
|
+
const labels = this.widget?.labels
|
|
1597
|
+
if (!labels || typeof labels !== 'object' || Array.isArray(labels)) {
|
|
1598
|
+
return {}
|
|
1599
|
+
}
|
|
1600
|
+
const out = {}
|
|
1601
|
+
for (const [prop, text] of Object.entries(labels)) {
|
|
1602
|
+
if (typeof text === 'string') {
|
|
1603
|
+
out[prop] = this.translateLabel(text)
|
|
1604
|
+
}
|
|
1605
|
+
}
|
|
1606
|
+
return out
|
|
1607
|
+
},
|
|
1608
|
+
|
|
1588
1609
|
integrationProps() {
|
|
1589
1610
|
return {
|
|
1590
1611
|
surface: this.surface,
|
|
@@ -1599,6 +1620,7 @@ export default {
|
|
|
1599
1620
|
// the tabs card, repeating the label the open tab already shows.
|
|
1600
1621
|
...(this.usesBareWidget ? { chromeless: true } : {}),
|
|
1601
1622
|
...this.derivedIntegrationContext,
|
|
1623
|
+
...this.leafLabels,
|
|
1602
1624
|
...this.resolvedWidgetProps,
|
|
1603
1625
|
}
|
|
1604
1626
|
},
|
|
@@ -1618,6 +1640,7 @@ export default {
|
|
|
1618
1640
|
// reads `integrationContext.objectId` gets the same object as
|
|
1619
1641
|
// one that reads `objectId`.
|
|
1620
1642
|
integrationContext: this.widgetIntegrationContext,
|
|
1643
|
+
...this.leafLabels,
|
|
1621
1644
|
...this.resolvedWidgetProps,
|
|
1622
1645
|
// A carded leaf reports its title row and empty state here.
|
|
1623
1646
|
...(this.wrapsMountLeaf ? { onHeader: this.onRendererHeader } : {}),
|
|
@@ -113,6 +113,7 @@
|
|
|
113
113
|
v-else-if="block.kind === 'title'"
|
|
114
114
|
:to="block.to || undefined"
|
|
115
115
|
class="cn-facts-widget__title"
|
|
116
|
+
:style="block.size ? { fontSize: `${block.size}px` } : undefined"
|
|
116
117
|
:data-testid="`cn-fact-${block.key}`">
|
|
117
118
|
{{ block.value }}
|
|
118
119
|
</component>
|
|
@@ -300,8 +301,10 @@ import { fetchListTotal } from '../../utils/fetchFilterCounts.js'
|
|
|
300
301
|
import { fillTemplate, formatLongDate } from '../../utils/fillTemplate.js'
|
|
301
302
|
import { formatMoney, metricLocale, unwrapAppConfig } from '../../utils/formatMetric.js'
|
|
302
303
|
import { groupDisplayName, loadGroupDisplayName } from '../../utils/groupAutocomplete.js'
|
|
304
|
+
import { fetchCallerScope } from '../../utils/objectPermissions.js'
|
|
303
305
|
import { readPath } from '../../utils/readPath.js'
|
|
304
306
|
import { hasUnresolvedDeepTokens, resolveDeepTokens } from '../../utils/resolveFilterTokens.js'
|
|
307
|
+
import { stripTrailingSlashes } from '../../utils/trailingSlashes.js'
|
|
305
308
|
import { userDisplayName } from '../../utils/userDisplayName.js'
|
|
306
309
|
import { evaluateVisibleWhen, evaluateVisibleWhenLocal, isLocallyDecidableVisibleWhen } from '../../utils/visibleWhen.js'
|
|
307
310
|
|
|
@@ -498,7 +501,7 @@ export default {
|
|
|
498
501
|
* The widget configuration.
|
|
499
502
|
*
|
|
500
503
|
* - `fields` — the entries, in order. Each is `{ path, label?, as?, from?, format?, map?, itemPath?, parts?, separator?, route?, variant?, variantMap?, colorMap?, icon?, copy?, reveal?, inline?, joinPrevious?, joinSeparator?, text?, title?, subtitle?, initialsPath?, tone? }`.
|
|
501
|
-
* `as` is `row` (default when `label` or `icon` is set), `title`, `line`, `text` (a line in the normal ink), `lead` (an icon tile or initials beside `title` and `subtitle`), `pill` or `meter`.
|
|
504
|
+
* `as` is `row` (default when `label` or `icon` is set), `title`, `line`, `text` (a line in the normal ink), `lead` (an icon tile or initials beside `title` and `subtitle`), `pill` or `meter`. A `title` takes `size` in px (a Termijn card's 26px figure).
|
|
502
505
|
* `countFrom` (`{ register, schema, filter? }`, `@objectId` / `@object.<field>` in the filter) shows how many records that list holds ("Lopende zaken 43"); the row is left out while the count cannot be read.
|
|
503
506
|
* A `meter` shows the amount at `path` against the limit at `limitPath` (or a constant `limit`) as "12 of 50" with a bar; past the limit the bar turns red and the text says "over the limit"; without a positive limit it shows the amount and no bar.
|
|
504
507
|
* A `line` or `text` with `joinPrevious: true` is written on after the line or text just before it, as one paragraph (`joinSeparator`, default a space); with none before it, it stands alone. A text joined with a line break (`joinSeparator: "\n"`) keeps it: two address lines as one block.
|
|
@@ -515,7 +518,7 @@ export default {
|
|
|
515
518
|
* `labelPath` ("@context.caseType.handlerLabel") names a value on the record or the page's `@context` records that labels the row when it holds text; `label` is the fallback.
|
|
516
519
|
* `emptyValue` ("No") is shown, translated, when the entry has no value, so the entry stays drawn whatever `hideEmpty` says (an override that was never set reads "No").
|
|
517
520
|
* - `action` — an action drawn as a button under the facts; `headerAction` — one drawn in the card header (reported through the `header` event).
|
|
518
|
-
* - `actions` — action buttons under the facts in the `headerActions` shape (`api-call`, `open-form`, `navigate`, `open-modal`, ...; `confirm`, `variant`). `@source.<field>` names a field of the record shown, and an action whose token names an empty field is not drawn. `visibleWhen` reads the record shown; `adminOnly: true` draws the action for an instance admin only (visibility, never authorisation). An api-call or a saved form refreshes the page, and the facts read their source again.
|
|
521
|
+
* - `actions` — action buttons under the facts in the `headerActions` shape (`api-call`, `open-form`, `navigate`, `open-modal`, ...; `confirm`, `variant`). `@source.<field>` names a field of the record shown, and an action whose token names an empty field is not drawn. `visibleWhen` reads the record shown; `adminOnly: true` draws the action for an instance admin only (visibility, never authorisation). `requires: "update"` draws it only when OpenRegister lets the reader update the page's record (also on `emptyActions`; while the right is unknown it draws, and the server decides). An api-call or a saved form refreshes the page, and the facts read their source again.
|
|
519
522
|
* - `fieldsFrom` — `@context.<name>.<path>`, a list of entries on a record the page reads beside this one (a case type's `requestFields`); when it holds entries they are drawn instead of `fields`.
|
|
520
523
|
* - `rowsPath` — a path to a list of `{ label, value }` the record holds, drawn as rows after `fields` (a preview the server builds).
|
|
521
524
|
* - `headerPill` — a status pill in the card header (reported through the `header` event): `{ path?, text?, map?, variant?, variantMap?, colorMap? }`, read from the record like a `pill` entry (DqBezwaar "Advies ontvangen"); nothing shows while the value is empty.
|
|
@@ -582,6 +585,8 @@ export default {
|
|
|
582
585
|
counts: {},
|
|
583
586
|
/** The outcome of each `actions[]` condition that needs a request, by action id. */
|
|
584
587
|
remoteVisibility: {},
|
|
588
|
+
/** Whether OpenRegister lets the reader update the page's record; null while unknown (the server decides). */
|
|
589
|
+
mayUpdate: null,
|
|
585
590
|
/** Sequence of the source reads, so an older answer never replaces a newer one. */
|
|
586
591
|
loadSeq: 0,
|
|
587
592
|
}
|
|
@@ -796,6 +801,7 @@ export default {
|
|
|
796
801
|
emptyActions() {
|
|
797
802
|
const list = Array.isArray(this.content?.emptyActions) ? this.content.emptyActions : []
|
|
798
803
|
return list
|
|
804
|
+
.filter((action) => this.rightAllows(action))
|
|
799
805
|
.map((action) => ({ view: this.actionView(action), action }))
|
|
800
806
|
.filter((entry) => entry.view)
|
|
801
807
|
.map((entry) => ({ ...entry.view, action: entry.action }))
|
|
@@ -828,7 +834,7 @@ export default {
|
|
|
828
834
|
const admin = this.viewerIsAdmin()
|
|
829
835
|
const out = []
|
|
830
836
|
actions.forEach((action, index) => {
|
|
831
|
-
if (!action || typeof action !== 'object' || (action.adminOnly === true && !admin)) {
|
|
837
|
+
if (!action || typeof action !== 'object' || (action.adminOnly === true && !admin) || !this.rightAllows(action)) {
|
|
832
838
|
return
|
|
833
839
|
}
|
|
834
840
|
const id = this.actionId(action, index)
|
|
@@ -843,7 +849,7 @@ export default {
|
|
|
843
849
|
if (unresolved) {
|
|
844
850
|
return
|
|
845
851
|
}
|
|
846
|
-
const { visibleWhen, adminOnly, ...drawn } = value
|
|
852
|
+
const { visibleWhen, adminOnly, requires, ...drawn } = value
|
|
847
853
|
out.push({ ...drawn, id })
|
|
848
854
|
})
|
|
849
855
|
return out
|
|
@@ -927,6 +933,9 @@ export default {
|
|
|
927
933
|
if (kind === 'title' && field.route) {
|
|
928
934
|
block.to = this.resolveRoute(field.route, record)
|
|
929
935
|
}
|
|
936
|
+
if (kind === 'title' && Number.isFinite(field.size) && field.size > 0) {
|
|
937
|
+
block.size = field.size
|
|
938
|
+
}
|
|
930
939
|
if (kind === 'pill') {
|
|
931
940
|
const raw = readPath(record, field.path)
|
|
932
941
|
const colours = field.variantMap || field.colorMap
|
|
@@ -1152,6 +1161,7 @@ export default {
|
|
|
1152
1161
|
|
|
1153
1162
|
mounted() {
|
|
1154
1163
|
subscribe(PAGE_REFRESH_CHANNEL, this.onPageRefresh)
|
|
1164
|
+
this.loadMayUpdate()
|
|
1155
1165
|
},
|
|
1156
1166
|
|
|
1157
1167
|
beforeUnmount() {
|
|
@@ -1159,6 +1169,40 @@ export default {
|
|
|
1159
1169
|
},
|
|
1160
1170
|
|
|
1161
1171
|
methods: {
|
|
1172
|
+
/**
|
|
1173
|
+
* Whether an action's `requires: "update"` holds: the reader may update
|
|
1174
|
+
* the page's record. Unknown counts as yes; the server decides.
|
|
1175
|
+
*
|
|
1176
|
+
* @param {object} action The declaration.
|
|
1177
|
+
* @return {boolean}
|
|
1178
|
+
* @spec openspec/changes/facts-title-size-and-update-right/specs/facts-widget/spec.md#requirement-a-facts-action-can-ask-for-the-update-right
|
|
1179
|
+
*/
|
|
1180
|
+
rightAllows(action) {
|
|
1181
|
+
return !(action && action.requires === 'update' && this.mayUpdate === false)
|
|
1182
|
+
},
|
|
1183
|
+
|
|
1184
|
+
/**
|
|
1185
|
+
* Read the reader's rights on the page's register and schema, when an
|
|
1186
|
+
* action asks for the update right.
|
|
1187
|
+
*
|
|
1188
|
+
* @return {Promise<void>}
|
|
1189
|
+
* @spec openspec/changes/facts-title-size-and-update-right/specs/facts-widget/spec.md#requirement-a-facts-action-can-ask-for-the-update-right
|
|
1190
|
+
*/
|
|
1191
|
+
async loadMayUpdate() {
|
|
1192
|
+
const all = [...(Array.isArray(this.content?.actions) ? this.content.actions : []), ...(Array.isArray(this.content?.emptyActions) ? this.content.emptyActions : [])]
|
|
1193
|
+
const { register, schema } = this.tokenCtx
|
|
1194
|
+
if (!all.some((action) => action && action.requires === 'update') || !register || !schema) {
|
|
1195
|
+
return
|
|
1196
|
+
}
|
|
1197
|
+
const slug = (value) => (value && typeof value === 'object' ? String(value.slug || value.id || '') : String(value))
|
|
1198
|
+
try {
|
|
1199
|
+
const scope = await fetchCallerScope({ register: slug(register), schema: slug(schema) })
|
|
1200
|
+
this.mayUpdate = !scope || !Array.isArray(scope.actions) || scope.actions.includes('update')
|
|
1201
|
+
} catch {
|
|
1202
|
+
this.mayUpdate = null
|
|
1203
|
+
}
|
|
1204
|
+
},
|
|
1205
|
+
|
|
1162
1206
|
/**
|
|
1163
1207
|
* A link's label and the muted note under it, their `{path}` and
|
|
1164
1208
|
* `{path:format}` placeholders filled from the record ("{page:last-segment}").
|
|
@@ -1285,7 +1329,7 @@ export default {
|
|
|
1285
1329
|
return LINK_SCHEMES.includes(parsed.protocol) ? parsed.href : ''
|
|
1286
1330
|
}
|
|
1287
1331
|
if (typeof link.hrefBase === 'string' && link.hrefBase !== '') {
|
|
1288
|
-
const path = link.hrefBase
|
|
1332
|
+
const path = stripTrailingSlashes(link.hrefBase) + '/' + value.replace(/^\/+/, '')
|
|
1289
1333
|
return generateUrl(path)
|
|
1290
1334
|
}
|
|
1291
1335
|
return value.startsWith('/') && !value.startsWith('//') ? value : ''
|
|
@@ -777,6 +777,7 @@ import { dispatchAction } from '../../utils/actionsDispatcher.js'
|
|
|
777
777
|
import { fillTemplate } from '../../utils/fillTemplate.js'
|
|
778
778
|
import { readPath } from '../../utils/readPath.js'
|
|
779
779
|
import { isNewTabClick, isRowMiddleClick, preventMiddleClickAutoscroll } from '../../utils/rowAuxClick.js'
|
|
780
|
+
import { stripTrailingSlashes } from '../../utils/trailingSlashes.js'
|
|
780
781
|
import { ACTIONS_NEEDING_THE_FILES_PAGE, crumbsFor, hostActionApplies, joinPath } from './filesBrowser.js'
|
|
781
782
|
import {
|
|
782
783
|
attributePropertiesFor,
|
|
@@ -1493,7 +1494,7 @@ export default {
|
|
|
1493
1494
|
* @spec openspec/changes/board-files-root-crumb/specs/board-files-root-crumb/spec.md#requirement-the-board-files-bar-draws-no-trail-at-the-root
|
|
1494
1495
|
*/
|
|
1495
1496
|
atRoot() {
|
|
1496
|
-
const root = String(this.rootPath || '/')
|
|
1497
|
+
const root = stripTrailingSlashes(String(this.rootPath || '/')) || '/'
|
|
1497
1498
|
const last = this.crumbs[this.crumbs.length - 1]
|
|
1498
1499
|
return Boolean(last) && last.path === root
|
|
1499
1500
|
},
|
|
@@ -1986,7 +1987,7 @@ export default {
|
|
|
1986
1987
|
this.nodes = nodes
|
|
1987
1988
|
await this.resolveRowData(this.nodes)
|
|
1988
1989
|
} catch (err) {
|
|
1989
|
-
const atRoot = (this.currentPath
|
|
1990
|
+
const atRoot = (stripTrailingSlashes(this.currentPath) || '/') === (stripTrailingSlashes(this.rootPath) || '/')
|
|
1990
1991
|
this.error = err?.status === 404
|
|
1991
1992
|
? (atRoot ? t('nextcloud-vue', 'You cannot see these files') : t('nextcloud-vue', 'This folder no longer exists'))
|
|
1992
1993
|
: (err?.status === 403 ? t('nextcloud-vue', 'You cannot see this folder') : t('nextcloud-vue', 'The folder could not be read'))
|
|
@@ -2045,7 +2046,7 @@ export default {
|
|
|
2045
2046
|
* @return {void}
|
|
2046
2047
|
*/
|
|
2047
2048
|
navigate(path) {
|
|
2048
|
-
const root = this.rootPath
|
|
2049
|
+
const root = stripTrailingSlashes(this.rootPath) || '/'
|
|
2049
2050
|
if (path !== root && !path.startsWith(root === '/' ? '/' : `${root}/`)) {
|
|
2050
2051
|
return
|
|
2051
2052
|
}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import axios from '@nextcloud/axios'
|
|
11
11
|
import { generateUrl } from '@nextcloud/router'
|
|
12
|
+
import { stripTrailingSlashes } from '../../utils/trailingSlashes.js'
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Actions the Files app registers that cannot run on a page without the Files
|
|
@@ -42,7 +43,7 @@ export function userRelativePathFromHref(href, uid) {
|
|
|
42
43
|
const marker = `/dav/files/${uid}`
|
|
43
44
|
const at = decoded.indexOf(marker)
|
|
44
45
|
const rest = at === -1 ? decoded : decoded.slice(at + marker.length)
|
|
45
|
-
const trimmed = rest
|
|
46
|
+
const trimmed = stripTrailingSlashes(rest)
|
|
46
47
|
return trimmed === '' ? '/' : trimmed
|
|
47
48
|
}
|
|
48
49
|
|
|
@@ -54,7 +55,7 @@ export function userRelativePathFromHref(href, uid) {
|
|
|
54
55
|
* @return {string} The child's path.
|
|
55
56
|
*/
|
|
56
57
|
export function joinPath(dir, name) {
|
|
57
|
-
return `${String(dir || '')
|
|
58
|
+
return `${stripTrailingSlashes(String(dir || ''))}/${String(name || '').replace(/^\/+/, '')}`
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
/**
|
|
@@ -74,8 +75,8 @@ export function joinPath(dir, name) {
|
|
|
74
75
|
* @return {Array<{name: string, path: string, aboveRoot: boolean}>} The crumbs, outermost first.
|
|
75
76
|
*/
|
|
76
77
|
export function crumbsFor(rootPath, currentPath, rootLabel = null) {
|
|
77
|
-
const root = String(rootPath || '/')
|
|
78
|
-
const current = String(currentPath || root)
|
|
78
|
+
const root = stripTrailingSlashes(String(rootPath || '/')) || '/'
|
|
79
|
+
const current = stripTrailingSlashes(String(currentPath || root)) || '/'
|
|
79
80
|
const crumbs = []
|
|
80
81
|
let path = ''
|
|
81
82
|
for (const segment of root.split('/').filter(Boolean)) {
|
|
@@ -209,7 +210,7 @@ export async function resolveObjectFolderInfo({ apiBase, register, schema, objec
|
|
|
209
210
|
try {
|
|
210
211
|
const response = await axios.request({
|
|
211
212
|
method: 'SEARCH',
|
|
212
|
-
url: `${remoteUrl
|
|
213
|
+
url: `${stripTrailingSlashes(remoteUrl)}/`,
|
|
213
214
|
headers: { 'Content-Type': 'application/xml' },
|
|
214
215
|
data: fileIdSearchBody(folderId, uid),
|
|
215
216
|
responseType: 'text',
|
|
@@ -197,6 +197,7 @@ import { generateUrl } from '@nextcloud/router'
|
|
|
197
197
|
import CnFilesWidgetDeleteDialog from '../../dialogs/CnFilesWidgetDeleteDialog.vue'
|
|
198
198
|
import CnFilePreview from '../CnFilePreview/CnFilePreview.vue'
|
|
199
199
|
import { useFileOpener } from '../../composables/useFileOpener.js'
|
|
200
|
+
import { stripTrailingSlashes } from '../../utils/trailingSlashes.js'
|
|
200
201
|
|
|
201
202
|
/**
|
|
202
203
|
* CnFilesWidget — an inline Nextcloud Files browser rendered as a dashboard
|
|
@@ -815,7 +816,7 @@ export default {
|
|
|
815
816
|
* @return {string} the joined path.
|
|
816
817
|
*/
|
|
817
818
|
joinPath(base, name) {
|
|
818
|
-
const trimmedBase = String(base || '/')
|
|
819
|
+
const trimmedBase = stripTrailingSlashes(String(base || '/'))
|
|
819
820
|
const trimmedName = String(name || '').replace(/^\/+/, '')
|
|
820
821
|
if (trimmedBase === '' || trimmedBase === '/') {
|
|
821
822
|
return '/' + trimmedName
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
<p v-if="rows.length === 0 && content.quietLineWithHistory !== false" class="cn-flow-runs-widget__empty">
|
|
30
30
|
{{ emptyLabel }}
|
|
31
31
|
</p>
|
|
32
|
-
<ul v-else class="cn-flow-runs-widget__list">
|
|
32
|
+
<ul v-else-if="rows.length > 0" class="cn-flow-runs-widget__list">
|
|
33
33
|
<li
|
|
34
34
|
v-for="(run, index) in rows"
|
|
35
35
|
:key="run.uuid || `row-${index}`"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getCurrentUser } from '@nextcloud/auth'
|
|
2
2
|
import axios from '@nextcloud/axios'
|
|
3
3
|
import { generateRemoteUrl } from '@nextcloud/router'
|
|
4
|
+
import { stripTrailingSlashes } from '../../utils/trailingSlashes.js'
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Default WebDAV folder loader for CnFolderSidebar's `files` source.
|
|
@@ -104,7 +105,7 @@ function text(parent, local) {
|
|
|
104
105
|
* @return {string} The normalised path.
|
|
105
106
|
*/
|
|
106
107
|
function normalizePath(path) {
|
|
107
|
-
const trimmed = (path || '/')
|
|
108
|
+
const trimmed = stripTrailingSlashes(path || '/')
|
|
108
109
|
return trimmed.startsWith('/') ? trimmed : '/' + trimmed
|
|
109
110
|
}
|
|
110
111
|
|
|
@@ -1525,6 +1525,7 @@ import { resolveScopeLayout, resolveScopePresentation } from '../../utils/scopeL
|
|
|
1525
1525
|
import { readSearchRefusal } from '../../utils/searchRefusal.js'
|
|
1526
1526
|
import { orderToSortKeys } from '../../utils/sortOrder.js'
|
|
1527
1527
|
import { annotateRows, filterSourceRows, pageSourceRows, rowsFromSourceBody } from '../../utils/sortSourceRows.js'
|
|
1528
|
+
import { stripTrailingSlashes } from '../../utils/trailingSlashes.js'
|
|
1528
1529
|
import { userDisplayName } from '../../utils/userDisplayName.js'
|
|
1529
1530
|
import { dispatchObjectCreated } from '../../utils/walkthroughSignals.js'
|
|
1530
1531
|
import { CnActionButtons } from '../CnActionButtons/index.js'
|
|
@@ -2330,7 +2331,10 @@ export default {
|
|
|
2330
2331
|
* filter? }`), or a field read from an app endpoint (`{ endpoint,
|
|
2331
2332
|
* path, followFilters? }`; `followFilters: true` sends the active
|
|
2332
2333
|
* filters along as `filter[<field>]=<value>`). A value not read (yet) leaves its token empty (board PqLeads
|
|
2333
|
-
* "€ 509.928 in de pijplijn").
|
|
2334
|
+
* "€ 509.928 in de pijplijn"). `unfiltered: true` reads an aggregation
|
|
2335
|
+
* under the page's own `filter` only, so the footer note can name the
|
|
2336
|
+
* whole list ("73 aanmeldingen in totaal"); the footer note fills the
|
|
2337
|
+
* same tokens.
|
|
2334
2338
|
*
|
|
2335
2339
|
* @spec openspec/changes/index-count-values/specs/index-page/spec.md#requirement-the-count-line-can-name-sums-and-values
|
|
2336
2340
|
* @type {Record<string, object>|null}
|
|
@@ -8434,6 +8438,7 @@ export default {
|
|
|
8434
8438
|
const footerNote = scoped !== undefined ? scoped : footerNoteForView(this.footerNoteByView, this.currentViewMode, this.footerNote)
|
|
8435
8439
|
if (footerNote) {
|
|
8436
8440
|
return this.fillConfigTokens(this.cnTranslate(footerNote))
|
|
8441
|
+
.replace(/\{(\w+)\|[^}]*\}|\{(\w+)\}/g, (token, a, b) => this.countValueToken(token, a || b))
|
|
8437
8442
|
}
|
|
8438
8443
|
const source = this.isNamedSource ? this.namedSource : null
|
|
8439
8444
|
return (source && source.footerNote) || footerNote
|
|
@@ -10272,9 +10277,12 @@ export default {
|
|
|
10272
10277
|
}
|
|
10273
10278
|
const params = (this.$route && this.$route.params) || {}
|
|
10274
10279
|
const ctx = typeof this.selfFetchTokenCtx === 'function' ? this.selfFetchTokenCtx() : {}
|
|
10275
|
-
const
|
|
10280
|
+
const pageFilter = resolveFilterMap(this.filter, params, ctx)
|
|
10281
|
+
const filtered = { ...pageFilter, ...(this.effectiveActiveFilters || {}) }
|
|
10276
10282
|
const results = {}
|
|
10277
10283
|
await Promise.all(entries.map(async ([name, cfg]) => {
|
|
10284
|
+
// `unfiltered`: the whole list under the page's own filter, not the user's.
|
|
10285
|
+
const base = cfg && cfg.unfiltered === true ? pageFilter : filtered
|
|
10278
10286
|
try {
|
|
10279
10287
|
let value
|
|
10280
10288
|
if (cfg && typeof cfg.endpoint === 'string' && cfg.endpoint !== '') {
|
|
@@ -13450,7 +13458,7 @@ export default {
|
|
|
13450
13458
|
return !!this.$route && tab.to.name !== undefined && this.$route.name === tab.to.name
|
|
13451
13459
|
}
|
|
13452
13460
|
const path = this.$route && this.$route.path
|
|
13453
|
-
return !!path && String(path)
|
|
13461
|
+
return !!path && stripTrailingSlashes(String(path)) === stripTrailingSlashes(String(tab.to))
|
|
13454
13462
|
},
|
|
13455
13463
|
|
|
13456
13464
|
/**
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
import { routeHref } from '../../utils/actionLink.js'
|
|
22
22
|
import { safeHref } from '../../utils/safeHref.js'
|
|
23
|
+
import { stripTrailingSlashes } from '../../utils/trailingSlashes.js'
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
26
|
* Whether a URL string should be considered external (http/https).
|
|
@@ -53,7 +54,7 @@ export function isRouterPath(url) {
|
|
|
53
54
|
*/
|
|
54
55
|
export function routerBase(router) {
|
|
55
56
|
const base = router?.options?.history?.base
|
|
56
|
-
return typeof base === 'string' ? base
|
|
57
|
+
return typeof base === 'string' ? stripTrailingSlashes(base) : ''
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
/**
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
<template>
|
|
7
7
|
<div class="cn-object-parties" :class="{ 'cn-object-parties--board': isBoard }" data-testid="cn-object-parties">
|
|
8
|
-
<div v-if="canAdd" class="cn-object-parties__manage">
|
|
8
|
+
<div v-if="canAdd && !addInTitle" class="cn-object-parties__manage">
|
|
9
9
|
<NcButton data-testid="cn-object-parties-add" @click="adding = true">
|
|
10
10
|
<template #icon>
|
|
11
11
|
<Plus :size="20" />
|
|
@@ -300,13 +300,15 @@ function defaultLabels() {
|
|
|
300
300
|
*
|
|
301
301
|
* `manage` lets a reader change the parties through OpenRegister's party
|
|
302
302
|
* API, which asks the record's update right on every write: `add` (`{ label?,
|
|
303
|
-
* dialogTitle?, kind?, sources, create?, primary?, confirmLabel? }`) opens a
|
|
303
|
+
* dialogTitle?, kind?, sources, create?, primary?, confirmLabel?, placement? }`) opens a
|
|
304
304
|
* dialog to pick somebody known or describe somebody new (`create: {
|
|
305
305
|
* register, schema, label?, fields, compose? }`, see `newPartyRecord`), choose
|
|
306
306
|
* a role and optionally make them the primary party; `remove` (`{ title?,
|
|
307
307
|
* message?, confirmLabel? }`, `{name}` and `{role}` in the message) takes a
|
|
308
308
|
* party off in one role. Both are hidden when OpenRegister says the reader
|
|
309
|
-
* may not update the schema; a refusal is shown, never swallowed.
|
|
309
|
+
* may not update the schema; a refusal is shown, never swallowed. With
|
|
310
|
+
* `add.placement: "title"` the add button is reported to the card's title
|
|
311
|
+
* row (the `header` event) instead of drawn above the parties.
|
|
310
312
|
*
|
|
311
313
|
* `presentation: "primary"` draws only the primary party, as a side card
|
|
312
314
|
* does: initials, name and role label, its correspondence e-mail, and
|
|
@@ -368,6 +370,8 @@ export default {
|
|
|
368
370
|
},
|
|
369
371
|
},
|
|
370
372
|
|
|
373
|
+
emits: ['header'],
|
|
374
|
+
|
|
371
375
|
data() {
|
|
372
376
|
uid += 1
|
|
373
377
|
return {
|
|
@@ -409,6 +413,27 @@ export default {
|
|
|
409
413
|
return Boolean(this.manage.add) && this.mayUpdate && !this.isPrimaryPresentation && !this.loading && !this.failed
|
|
410
414
|
},
|
|
411
415
|
|
|
416
|
+
/** @return {boolean} Whether the add button goes to the card's title row. */
|
|
417
|
+
addInTitle() {
|
|
418
|
+
return this.manage.add?.placement === 'title'
|
|
419
|
+
},
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* The title-row actions: the add button when it is placed there.
|
|
423
|
+
*
|
|
424
|
+
* @spec openspec/changes/parties-add-in-title-row/specs/record-widgets/spec.md#requirement-a-parties-card-can-put-its-add-button-in-the-title-row
|
|
425
|
+
* @return {Array<object>} The actions.
|
|
426
|
+
*/
|
|
427
|
+
titleActions() {
|
|
428
|
+
if (!(this.addInTitle && this.canAdd)) {
|
|
429
|
+
return []
|
|
430
|
+
}
|
|
431
|
+
const run = () => {
|
|
432
|
+
this.adding = true
|
|
433
|
+
}
|
|
434
|
+
return [{ key: 'add', label: this.manageWord('add', 'label', t('nextcloud-vue', 'Add a party')), icon: 'Plus', variant: 'secondary', run }]
|
|
435
|
+
},
|
|
436
|
+
|
|
412
437
|
/** @return {boolean} Whether each party offers its remove button. */
|
|
413
438
|
canRemove() {
|
|
414
439
|
return Boolean(this.manage.remove) && this.mayUpdate && !this.isPrimaryPresentation
|
|
@@ -547,6 +572,18 @@ export default {
|
|
|
547
572
|
},
|
|
548
573
|
|
|
549
574
|
watch: {
|
|
575
|
+
titleActions: {
|
|
576
|
+
immediate: true,
|
|
577
|
+
handler(actions) {
|
|
578
|
+
if (this.addInTitle) {
|
|
579
|
+
/**
|
|
580
|
+
* @event header The card's title-row actions, `{ actions }`, for the host to draw.
|
|
581
|
+
*/
|
|
582
|
+
this.$emit('header', { actions })
|
|
583
|
+
}
|
|
584
|
+
},
|
|
585
|
+
},
|
|
586
|
+
|
|
550
587
|
recordKey: {
|
|
551
588
|
immediate: true,
|
|
552
589
|
handler() {
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
import { translate as t } from '@nextcloud/l10n'
|
|
56
56
|
import draggable from 'vuedraggable'
|
|
57
57
|
import CnPageTreeRow from './CnPageTreeRow.vue'
|
|
58
|
+
import { stripTrailingSlashes } from '../../utils/trailingSlashes.js'
|
|
58
59
|
|
|
59
60
|
// Stable per-page-object render keys, independent of the mutable `id`. Keyed by
|
|
60
61
|
// the page ref itself (a WeakMap, so removed pages are GC'd) so a slug rename —
|
|
@@ -317,7 +318,7 @@ export default {
|
|
|
317
318
|
* @return {void}
|
|
318
319
|
*/
|
|
319
320
|
addChild(node) {
|
|
320
|
-
const base = String(node.ref.route || '')
|
|
321
|
+
const base = stripTrailingSlashes(String(node.ref.route || ''))
|
|
321
322
|
const ref = { id: this.nextId(), parent: node.ref.id, type: 'detail', route: `${base}/:id`, title: '', config: {} }
|
|
322
323
|
node.children.push({ ref, children: [] })
|
|
323
324
|
this.flatten()
|