@conduction/nextcloud-vue 2.111.0 → 2.112.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/CnActionDialog/CnActionDialog.vue.js +1 -1
- package/dist/esm/components/CnActionDialog/CnActionDialog.vue2.js +3 -2
- package/dist/esm/components/CnActionDialog/CnActionDialog.vue2.js.map +1 -1
- package/dist/esm/components/CnActionDialog/CnActionDialog.vue3.js +4 -2
- package/dist/esm/components/CnActionDialog/CnActionDialog.vue3.js.map +1 -1
- package/dist/esm/components/CnAssignDialog/CnAssignDialog.vue.js +1 -1
- package/dist/esm/components/CnAssignDialog/CnAssignDialog.vue2.js +3 -2
- package/dist/esm/components/CnAssignDialog/CnAssignDialog.vue2.js.map +1 -1
- package/dist/esm/components/CnAssignDialog/CnAssignDialog.vue3.js +2 -1
- package/dist/esm/components/CnAssignDialog/CnAssignDialog.vue3.js.map +1 -1
- package/dist/esm/components/CnBoardView/CnBoardView.vue.js +1 -1
- package/dist/esm/components/CnBoardView/CnBoardView.vue2.js +54 -5
- package/dist/esm/components/CnBoardView/CnBoardView.vue2.js.map +1 -1
- package/dist/esm/components/CnBoardView/CnBoardView.vue3.js +16 -2
- package/dist/esm/components/CnBoardView/CnBoardView.vue3.js.map +1 -1
- package/dist/esm/components/CnCardGrid/CnCardGrid.vue.js +1 -1
- package/dist/esm/components/CnCardGrid/CnCardGrid.vue2.js +10 -0
- package/dist/esm/components/CnCardGrid/CnCardGrid.vue2.js.map +1 -1
- package/dist/esm/components/CnCardGrid/CnCardGrid.vue3.js +2 -1
- package/dist/esm/components/CnCardGrid/CnCardGrid.vue3.js.map +1 -1
- package/dist/esm/components/CnCellRenderer/CnCellRenderer.vue.js +1 -1
- package/dist/esm/components/CnCellRenderer/CnCellRenderer.vue2.js +22 -2
- package/dist/esm/components/CnCellRenderer/CnCellRenderer.vue2.js.map +1 -1
- package/dist/esm/components/CnCellRenderer/CnCellRenderer.vue3.js +17 -3
- package/dist/esm/components/CnCellRenderer/CnCellRenderer.vue3.js.map +1 -1
- package/dist/esm/components/CnChartWidget/CnChartWidget.vue.js +1 -1
- package/dist/esm/components/CnChartWidget/CnChartWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnChartWidget/CnChartWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js +32 -8
- package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js.map +1 -1
- package/dist/esm/components/CnDetailPage/CnDetailPage.vue3.js +31 -3
- package/dist/esm/components/CnDetailPage/CnDetailPage.vue3.js.map +1 -1
- package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue.js +1 -1
- package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue2.js +48 -11
- package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue2.js.map +1 -1
- package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue3.js +160 -97
- package/dist/esm/components/CnDetailWidgetHost/CnDetailWidgetHost.vue3.js.map +1 -1
- package/dist/esm/components/CnFormDialog/CnFormDialog.vue.js +1 -1
- package/dist/esm/components/CnFormDialog/CnFormDialog.vue2.js.map +1 -1
- package/dist/esm/components/CnFormDialog/CnFormDialog.vue3.js +2 -2
- package/dist/esm/components/CnFormDialog/CnFormDialog.vue3.js.map +1 -1
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js +166 -2
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js.map +1 -1
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js +19 -4
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js.map +1 -1
- package/dist/esm/components/CnNcDashboardList/CnNcDashboardList.vue.js +1 -1
- package/dist/esm/components/CnNcDashboardList/CnNcDashboardList.vue2.js +21 -1
- package/dist/esm/components/CnNcDashboardList/CnNcDashboardList.vue2.js.map +1 -1
- package/dist/esm/components/CnNcDashboardList/CnNcDashboardList.vue3.js.map +1 -1
- package/dist/esm/components/CnObjectCard/CnObjectCard.vue.js +1 -1
- package/dist/esm/components/CnObjectCard/CnObjectCard.vue2.js +36 -2
- package/dist/esm/components/CnObjectCard/CnObjectCard.vue2.js.map +1 -1
- package/dist/esm/components/CnObjectCard/CnObjectCard.vue3.js +44 -5
- package/dist/esm/components/CnObjectCard/CnObjectCard.vue3.js.map +1 -1
- package/dist/esm/components/CnPartyPicker/CnPartyPicker.vue.js +1 -0
- package/dist/esm/components/CnPartyPicker/CnPartyPicker.vue.js.map +1 -1
- package/dist/esm/components/CnPartyPicker/CnPartyPicker.vue2.js +22 -2
- package/dist/esm/components/CnPartyPicker/CnPartyPicker.vue2.js.map +1 -1
- package/dist/esm/components/CnPartyPicker/CnPartyPicker.vue3.js +36 -16
- package/dist/esm/components/CnPartyPicker/CnPartyPicker.vue3.js.map +1 -1
- package/dist/esm/components/CnSearchSelect/CnSearchSelect.vue.js +1 -1
- package/dist/esm/components/CnSearchSelect/CnSearchSelect.vue2.js.map +1 -1
- package/dist/esm/components/CnSearchSelect/CnSearchSelect.vue3.js.map +1 -1
- package/dist/esm/composables/useRefLabels.js +26 -6
- package/dist/esm/composables/useRefLabels.js.map +1 -1
- package/dist/esm/integrations/registry.js +4 -0
- package/dist/esm/integrations/registry.js.map +1 -1
- package/dist/esm/l10n/en.json.js +3 -1
- package/dist/esm/l10n/en.json.js.map +1 -1
- package/dist/esm/l10n/nl.json.js +3 -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 +533 -273
- package/dist/esm/store/plugins/liveUpdates.js +3 -1
- package/dist/esm/store/plugins/liveUpdates.js.map +1 -1
- package/dist/esm/store/plugins/logs.js +2 -1
- package/dist/esm/store/plugins/logs.js.map +1 -1
- package/dist/esm/utils/detailActionModel.js +28 -1
- package/dist/esm/utils/detailActionModel.js.map +1 -1
- package/dist/esm/utils/fillTemplate.js +13 -5
- package/dist/esm/utils/fillTemplate.js.map +1 -1
- package/dist/esm/utils/headerFieldChips.js +21 -2
- package/dist/esm/utils/headerFieldChips.js.map +1 -1
- package/dist/esm/utils/mapList.js +26 -11
- package/dist/esm/utils/mapList.js.map +1 -1
- package/dist/esm/utils/savedViewMenu.js +12 -5
- package/dist/esm/utils/savedViewMenu.js.map +1 -1
- package/dist/esm/utils/validateManifestV2.compiled.js +3 -3
- package/dist/esm/utils/validateManifestV2.compiled.js.map +1 -1
- package/dist/nextcloud-vue.cjs.js +2562 -1886
- package/dist/nextcloud-vue.cjs.js.map +2 -2
- package/dist/nextcloud-vue.css +533 -273
- package/l10n/en.json +3 -1
- package/l10n/nl.json +3 -1
- package/package.json +1 -1
- package/src/components/CnActionDialog/CnActionDialog.vue +32 -9
- package/src/components/CnAssignDialog/CnAssignDialog.vue +4 -2
- package/src/components/CnBoardView/CnBoardView.vue +58 -5
- package/src/components/CnCardGrid/CnCardGrid.md +1 -0
- package/src/components/CnCardGrid/CnCardGrid.vue +11 -0
- package/src/components/CnCellRenderer/CnCellRenderer.vue +27 -3
- package/src/components/CnChartWidget/CnChartWidget.vue +6 -0
- package/src/components/CnDetailPage/CnDetailPage.vue +42 -9
- package/src/components/CnDetailWidgetHost/CnDetailWidgetHost.vue +100 -5
- package/src/components/CnFormDialog/CnFormDialog.vue +1 -1
- package/src/components/CnIndexPage/CnIndexPage.vue +174 -4
- package/src/components/CnNcDashboardList/CnNcDashboardList.vue +21 -1
- package/src/components/CnObjectCard/CnObjectCard.md +1 -0
- package/src/components/CnObjectCard/CnObjectCard.vue +51 -5
- package/src/components/CnPartyPicker/CnPartyPicker.vue +62 -16
- package/src/components/CnSearchSelect/CnSearchSelect.vue +8 -0
- package/src/composables/useRefLabels.js +25 -5
- package/src/css/dialog.css +53 -3
- package/src/css/index-page.css +26 -1
- package/src/css/look-board-detail.css +36 -15
- package/src/css/look-board-index.css +69 -3
- package/src/css/look-board.css +30 -2
- package/src/integrations/registry.js +4 -0
- package/src/schemas/app-manifest-v2.schema.json +11 -5
- package/src/store/plugins/liveUpdates.js +3 -1
- package/src/store/plugins/logs.js +2 -1
- package/src/utils/detailActionModel.js +27 -0
- package/src/utils/fillTemplate.js +13 -5
- package/src/utils/headerFieldChips.js +21 -2
- package/src/utils/mapList.js +26 -11
- package/src/utils/savedViewMenu.js +12 -5
- package/src/utils/validateManifestV2.compiled.js +3 -3
|
@@ -156,6 +156,7 @@ export function logsPlugin(options = {}) {
|
|
|
156
156
|
|
|
157
157
|
if (autoRefreshOnItemChange) {
|
|
158
158
|
plugin.setup = function setup(store) {
|
|
159
|
+
// Detached: the store outlives the component whose setup first used it.
|
|
159
160
|
store.$onAction(({ name, after }) => {
|
|
160
161
|
if (name !== 'setItem') {
|
|
161
162
|
return
|
|
@@ -170,7 +171,7 @@ export function logsPlugin(options = {}) {
|
|
|
170
171
|
store.clearLogs()
|
|
171
172
|
}
|
|
172
173
|
})
|
|
173
|
-
})
|
|
174
|
+
}, true)
|
|
174
175
|
}
|
|
175
176
|
}
|
|
176
177
|
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* @module utils/detailActionModel
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
+
import { variantForColor } from './headerFieldChips.js'
|
|
19
20
|
import { readPath } from './readPath.js'
|
|
20
21
|
import { evaluateVisibleWhenLocal } from './visibleWhen.js'
|
|
21
22
|
|
|
@@ -239,6 +240,32 @@ export function resolvePill(config, object) {
|
|
|
239
240
|
}
|
|
240
241
|
}
|
|
241
242
|
|
|
243
|
+
/**
|
|
244
|
+
* What a pill takes from the record its `resolve` points at
|
|
245
|
+
* (`resolve.colorField`, `resolve.iconField`): the tone its colour name maps
|
|
246
|
+
* onto (an NL Design System hue or a badge role, see `variantForColor`), which
|
|
247
|
+
* replaces the pill's own `variant` and `colorMap`, and an icon name. An empty
|
|
248
|
+
* colour or icon leaves the pill as declared.
|
|
249
|
+
*
|
|
250
|
+
* @param {{color?: string|null, icon?: string|null}|null|undefined} look The names read off the record.
|
|
251
|
+
* @return {{variant?: string, colorMap?: null, icon?: string}} The keys to lay over the pill.
|
|
252
|
+
* @spec openspec/changes/pill-color-field/specs/pill-color-field/spec.md#requirement-a-pill-takes-its-tone-and-icon-from-the-referenced-record
|
|
253
|
+
*/
|
|
254
|
+
export function pillLook(look) {
|
|
255
|
+
const out = {}
|
|
256
|
+
if (!look || typeof look !== 'object') {
|
|
257
|
+
return out
|
|
258
|
+
}
|
|
259
|
+
if (typeof look.color === 'string' && look.color !== '') {
|
|
260
|
+
out.variant = variantForColor(look.color)
|
|
261
|
+
out.colorMap = null
|
|
262
|
+
}
|
|
263
|
+
if (typeof look.icon === 'string' && look.icon !== '') {
|
|
264
|
+
out.icon = look.icon
|
|
265
|
+
}
|
|
266
|
+
return out
|
|
267
|
+
}
|
|
268
|
+
|
|
242
269
|
/**
|
|
243
270
|
* Resolve a tab's count.
|
|
244
271
|
*
|
|
@@ -7,7 +7,7 @@ import { formatMoney } from './formatMetric.js'
|
|
|
7
7
|
import { readPath } from './readPath.js'
|
|
8
8
|
import { userDisplayName } from './userDisplayName.js'
|
|
9
9
|
|
|
10
|
-
const TOKEN = /\{([^{}\s|]+)(?:\|([
|
|
10
|
+
const TOKEN = /\{([^{}\s|]+)(?:\|([A-Za-z]+)(?::([^{}\s]+))?)?\}/g
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* A moment in the board's short form with the time: "4 okt, 10:52", or
|
|
@@ -68,12 +68,18 @@ export function formatLongDate(value, now = new Date(), withYear = false) {
|
|
|
68
68
|
* @param {string} [arg] The format's argument (`currency:EUR`, or a row path holding the code).
|
|
69
69
|
* @param {object|null} [object] The row, for a currency read from a field.
|
|
70
70
|
* @param {object|null} [config] The app config map, for the reporting currency.
|
|
71
|
+
* @param {object|null} [formatters] The app's named formatters (`cnFormatters`), for any other format name.
|
|
71
72
|
* @return {string} The text, '' when nothing can be shown.
|
|
73
|
+
* @spec openspec/changes/map-list-formatters/specs/map-list-formatters/spec.md#requirement-a-map-list-reads-display-names-through-the-apps-formatters
|
|
72
74
|
*/
|
|
73
|
-
function formatValue(value, format, now, arg = '', object = null, config = null) {
|
|
75
|
+
function formatValue(value, format, now, arg = '', object = null, config = null, formatters = null) {
|
|
74
76
|
if (value === null || value === undefined || value === '' || typeof value === 'object') {
|
|
75
77
|
return ''
|
|
76
78
|
}
|
|
79
|
+
if (format !== '' && formatters && typeof formatters[format] === 'function') {
|
|
80
|
+
const shown = formatters[format](value, object)
|
|
81
|
+
return shown === null || shown === undefined ? '' : String(shown)
|
|
82
|
+
}
|
|
77
83
|
if (format === 'date') {
|
|
78
84
|
return formatBoardDate(value, now)
|
|
79
85
|
}
|
|
@@ -130,14 +136,16 @@ function formatValue(value, format, now, arg = '', object = null, config = null)
|
|
|
130
136
|
* the row field is empty, the app's reporting currency), `{path|relative}` and
|
|
131
137
|
* `{path|relativetime}` say "today", "yesterday" and then the short date
|
|
132
138
|
* ("vandaag, 09.42"), and `{path|days}` is the
|
|
133
|
-
* whole days since that date ("has waited {createdAt|days} days").
|
|
139
|
+
* whole days since that date ("has waited {createdAt|days} days"). Any other
|
|
140
|
+
* name is one of the app's formatters, passed as `context.formatters`
|
|
141
|
+
* (`{id|caseAddress}`). A token without a
|
|
134
142
|
* value empties the WHOLE template, because "Termijn " is worse than nothing.
|
|
135
143
|
* A template without tokens is returned as written (a constant label).
|
|
136
144
|
*
|
|
137
145
|
* @param {string} template The template, already translated.
|
|
138
146
|
* @param {object|null} object The object to read.
|
|
139
147
|
* @param {Date} [now] The reference moment for dates.
|
|
140
|
-
* @param {{config?: object}|null} [context] The app config map, for the reporting currency of a money token.
|
|
148
|
+
* @param {{config?: object, formatters?: object}|null} [context] The app config map, for the reporting currency of a money token, and the app's named formatters.
|
|
141
149
|
* @return {string} The filled text, or ''.
|
|
142
150
|
* @spec openspec/changes/screens-relation-pages/specs/relation-pages/spec.md#requirement-a-record-list-shows-the-objects-that-point-at-this-record
|
|
143
151
|
*/
|
|
@@ -148,7 +156,7 @@ export function fillTemplate(template, object, now = new Date(), context = null)
|
|
|
148
156
|
let missing = false
|
|
149
157
|
const text = template.replace(TOKEN, (_match, path, format, arg) => {
|
|
150
158
|
const value = object && typeof object === 'object' ? readPath(object, path) : undefined
|
|
151
|
-
const shown = formatValue(value, format || '', now, arg || '', object, context && context.config ? context.config : null)
|
|
159
|
+
const shown = formatValue(value, format || '', now, arg || '', object, context && context.config ? context.config : null, context && context.formatters ? context.formatters : null)
|
|
152
160
|
if (shown === '') {
|
|
153
161
|
missing = true
|
|
154
162
|
}
|
|
@@ -11,7 +11,12 @@
|
|
|
11
11
|
/** The renderers a header chip can use. */
|
|
12
12
|
export const HEADER_CHIP_FORMATS = Object.freeze(['text', 'mono', 'badge', 'user', 'date'])
|
|
13
13
|
|
|
14
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* The variants a colour name maps onto; anything else is neutral. A name is a
|
|
16
|
+
* badge role (`success`, `warning`, ...) or an NL Design System hue as a
|
|
17
|
+
* register stores it (`red`, `blue-light`, ...): a hue and its light tint
|
|
18
|
+
* take the same tone.
|
|
19
|
+
*/
|
|
15
20
|
const COLOR_VARIANTS = Object.freeze({
|
|
16
21
|
success: 'success',
|
|
17
22
|
warning: 'warning',
|
|
@@ -19,6 +24,20 @@ const COLOR_VARIANTS = Object.freeze({
|
|
|
19
24
|
info: 'info',
|
|
20
25
|
primary: 'primary',
|
|
21
26
|
neutral: 'default',
|
|
27
|
+
blue: 'info',
|
|
28
|
+
'blue-light': 'info',
|
|
29
|
+
green: 'success',
|
|
30
|
+
'green-light': 'success',
|
|
31
|
+
orange: 'warning',
|
|
32
|
+
'orange-light': 'warning',
|
|
33
|
+
red: 'error',
|
|
34
|
+
'red-light': 'error',
|
|
35
|
+
purple: 'purple',
|
|
36
|
+
'purple-light': 'purple',
|
|
37
|
+
teal: 'teal',
|
|
38
|
+
'teal-light': 'teal',
|
|
39
|
+
grey: 'default',
|
|
40
|
+
'grey-light': 'default',
|
|
22
41
|
})
|
|
23
42
|
|
|
24
43
|
/**
|
|
@@ -69,7 +88,7 @@ export function isEmptyChipValue(value) {
|
|
|
69
88
|
/**
|
|
70
89
|
* Map a colour name read off a referenced object onto a badge variant.
|
|
71
90
|
*
|
|
72
|
-
* @param {*} name The colour name (`success`, `warning`, `error`, `info`, `neutral`).
|
|
91
|
+
* @param {*} name The colour name: a badge role (`success`, `warning`, `error`, `info`, `neutral`) or an NL Design System hue (`red`, `blue-light`, ...).
|
|
73
92
|
* @return {string} A `CnStatusBadge` variant; `default` (neutral) when unknown.
|
|
74
93
|
*/
|
|
75
94
|
export function variantForColor(name) {
|
package/src/utils/mapList.js
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* SPDX-License-Identifier: EUPL-1.2
|
|
4
4
|
*/
|
|
5
5
|
import { isBadgeVariant } from './badgeVariants.js'
|
|
6
|
-
import {
|
|
6
|
+
import { pillLook } from './detailActionModel.js'
|
|
7
|
+
import { fillTemplate, firstFilled } from './fillTemplate.js'
|
|
7
8
|
import { readPath } from './readPath.js'
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -12,10 +13,14 @@ import { readPath } from './readPath.js'
|
|
|
12
13
|
* pin and the number in the list are the same, and the rows without one.
|
|
13
14
|
*
|
|
14
15
|
* `spec` is `mapConfig.list`: `{ title, sub?, pills?: [{ path?, text?, map?,
|
|
15
|
-
* colorMap? }], due? }`. `title`, `sub` and `due` are
|
|
16
|
-
* (`"{title}"`, `"{address} · {identifier}"`,
|
|
17
|
-
* translated by the caller;
|
|
18
|
-
*
|
|
16
|
+
* formatter?, colorMap?, variant?, resolve? }], due? }`. `title`, `sub` and `due` are
|
|
17
|
+
* field templates (`"{title}"`, `"{address} · {identifier}"`,
|
|
18
|
+
* `"{deadline|date}"`), already translated by the caller; `sub` may list
|
|
19
|
+
* several, the first that fills wins. A pill reads `path` (or shows `text`),
|
|
20
|
+
* maps it through `map` or the app formatter `formatter` (a reference's
|
|
21
|
+
* display name), and takes its tone from `colorMap` by the raw value, or,
|
|
22
|
+
* with `resolve`, the tone and icon of the record the value points at
|
|
23
|
+
* (`options.looks`, read by CnIndexPage as for its other pills).
|
|
19
24
|
*
|
|
20
25
|
* @param {Array<object>} rows The rows, in display order.
|
|
21
26
|
* @param {object} spec The list declaration.
|
|
@@ -23,9 +28,14 @@ import { readPath } from './readPath.js'
|
|
|
23
28
|
* @param {string} options.rowKey The row's key field.
|
|
24
29
|
* @param {Function} options.located Whether a row has a place on the map.
|
|
25
30
|
* @param {Function} [options.translate] The host's translate, for pill labels.
|
|
31
|
+
* @param {object} [options.formatters] The app's named formatters, for pills and template tokens.
|
|
32
|
+
* @param {object} [options.looks] The referenced records' looks by field and id (`{ [path]: { [id]: { color, icon } } }`).
|
|
26
33
|
* @return {{items: Array<{key: string, n: number, row: object, title: string, sub: string, due: string, pills: Array<{label: string, variant: string}>}>, missing: Array<object>}}
|
|
34
|
+
* @spec openspec/changes/map-list-formatters/specs/map-list-formatters/spec.md#requirement-a-map-list-reads-display-names-through-the-apps-formatters
|
|
35
|
+
* @spec openspec/changes/map-list-formatters/specs/map-list-formatters/spec.md#requirement-a-map-list-pill-takes-its-tone-and-icon-from-the-referenced-record
|
|
27
36
|
*/
|
|
28
|
-
export function mapListItems(rows, spec, { rowKey, located, translate = (text) => text }) {
|
|
37
|
+
export function mapListItems(rows, spec, { rowKey, located, translate = (text) => text, formatters = null, looks = null }) {
|
|
38
|
+
const context = formatters ? { formatters } : null
|
|
29
39
|
const items = []
|
|
30
40
|
const missing = []
|
|
31
41
|
const list = spec && typeof spec === 'object' ? spec : {}
|
|
@@ -40,7 +50,9 @@ export function mapListItems(rows, spec, { rowKey, located, translate = (text) =
|
|
|
40
50
|
return null
|
|
41
51
|
}
|
|
42
52
|
const raw = typeof pill.path === 'string' && pill.path !== '' ? readPath(row, pill.path) : undefined
|
|
43
|
-
const
|
|
53
|
+
const formatter = typeof pill.formatter === 'string' && formatters ? formatters[pill.formatter] : null
|
|
54
|
+
const formatted = typeof formatter === 'function' && (typeof raw === 'string' || typeof raw === 'number') && raw !== '' ? formatter(raw, row) : undefined
|
|
55
|
+
const mapped = pill.map && (typeof raw === 'string' || typeof raw === 'number') && Object.hasOwn(pill.map, raw) ? pill.map[raw] : formatted
|
|
44
56
|
const text = mapped ?? pill.text ?? raw
|
|
45
57
|
if (typeof text !== 'string' && typeof text !== 'number') {
|
|
46
58
|
return null
|
|
@@ -50,16 +62,19 @@ export function mapListItems(rows, spec, { rowKey, located, translate = (text) =
|
|
|
50
62
|
return null
|
|
51
63
|
}
|
|
52
64
|
const tone = pill.colorMap && (typeof raw === 'string' || typeof raw === 'number') ? pill.colorMap[raw] : pill.variant
|
|
53
|
-
|
|
65
|
+
const fieldLooks = pill.resolve && looks && typeof pill.path === 'string' ? looks[pill.path] : null
|
|
66
|
+
const look = pillLook(fieldLooks && (typeof raw === 'string' || typeof raw === 'number') ? fieldLooks[String(raw)] : null)
|
|
67
|
+
const variant = look.variant || tone
|
|
68
|
+
return { label, variant: isBadgeVariant(variant) ? variant : 'default', ...(look.icon ? { icon: look.icon } : {}) }
|
|
54
69
|
})
|
|
55
70
|
.filter(Boolean)
|
|
56
71
|
items.push({
|
|
57
72
|
key: String(row[rowKey]),
|
|
58
73
|
n: items.length + 1,
|
|
59
74
|
row,
|
|
60
|
-
title: fillTemplate(list.title || '', row),
|
|
61
|
-
sub:
|
|
62
|
-
due: fillTemplate(list.due || '', row),
|
|
75
|
+
title: fillTemplate(list.title || '', row, undefined, context),
|
|
76
|
+
sub: list.sub ? firstFilled(list.sub, row, undefined, undefined, context) : '',
|
|
77
|
+
due: fillTemplate(list.due || '', row, undefined, context),
|
|
63
78
|
pills,
|
|
64
79
|
})
|
|
65
80
|
}
|
|
@@ -64,6 +64,9 @@ export function normalizeSavedViewMenu(entries) {
|
|
|
64
64
|
}
|
|
65
65
|
seen.add(`${page}|${id}`)
|
|
66
66
|
const entry = { id, page, name: e && typeof e.name === 'string' && e.name !== '' ? e.name : id }
|
|
67
|
+
if (typeof e.icon === 'string' && e.icon !== '') {
|
|
68
|
+
entry.icon = e.icon
|
|
69
|
+
}
|
|
67
70
|
const badge = normalizeBadge(e.badge)
|
|
68
71
|
if (badge) {
|
|
69
72
|
entry.badge = badge
|
|
@@ -87,12 +90,12 @@ export function toggleSavedViewMenuEntry(entries, entry) {
|
|
|
87
90
|
if (present) {
|
|
88
91
|
return list.filter((e) => !(e.id === id && e.page === entry.page))
|
|
89
92
|
}
|
|
90
|
-
return normalizeSavedViewMenu([...list, { id, page: entry.page, name: entry.name, badge: entry.badge }])
|
|
93
|
+
return normalizeSavedViewMenu([...list, { id, page: entry.page, name: entry.name, icon: entry.icon, badge: entry.badge }])
|
|
91
94
|
}
|
|
92
95
|
|
|
93
96
|
/**
|
|
94
97
|
* Bring one page's entries in line with the views that page can show:
|
|
95
|
-
* current names and badges, and no entry for a view that was deleted or is
|
|
98
|
+
* current names, icons and badges, and no entry for a view that was deleted or is
|
|
96
99
|
* no longer shared with the user. Other pages' entries are left alone. A
|
|
97
100
|
* view's badge is read from its `menuBadge` (see `withSavedViewMenu`).
|
|
98
101
|
*
|
|
@@ -110,9 +113,10 @@ export function syncSavedViewMenu(entries, page, views) {
|
|
|
110
113
|
return e
|
|
111
114
|
}
|
|
112
115
|
const view = byId.get(e.id)
|
|
113
|
-
const { badge, ...rest } = e
|
|
116
|
+
const { badge, icon, ...rest } = e
|
|
114
117
|
const next = normalizeBadge(view.menuBadge)
|
|
115
|
-
|
|
118
|
+
const nextIcon = typeof view.icon === 'string' && view.icon !== '' ? view.icon : icon
|
|
119
|
+
return normalizeSavedViewMenu([{ ...rest, name: view.name || e.name, ...(nextIcon ? { icon: nextIcon } : {}), ...(next ? { badge: next } : {}) }])[0]
|
|
116
120
|
})
|
|
117
121
|
}
|
|
118
122
|
|
|
@@ -127,6 +131,9 @@ export const SAVED_VIEW_MENU_EMPTY = 'saved-views-empty'
|
|
|
127
131
|
* same place (Ruben's design rule, 19 Oct); it replaces app-specific groups
|
|
128
132
|
* such as dossiq's "My case types".
|
|
129
133
|
*
|
|
134
|
+
* An entry shows its view's `icon` (a registered icon name; a case type's
|
|
135
|
+
* own icon, say), else the filter icon.
|
|
136
|
+
*
|
|
130
137
|
* An entry with a badge carries it as the menu entry's `count` (and
|
|
131
138
|
* `counterVariant`), which CnAppRoot fetches like any filtered menu count.
|
|
132
139
|
*
|
|
@@ -154,7 +161,7 @@ export function withSavedViewMenu(menu, entries, options = {}) {
|
|
|
154
161
|
label: e.name,
|
|
155
162
|
route: e.page,
|
|
156
163
|
query: { savedView: e.id },
|
|
157
|
-
icon: 'FilterOutline',
|
|
164
|
+
icon: e.icon || 'FilterOutline',
|
|
158
165
|
...(e.badge || {}),
|
|
159
166
|
}))
|
|
160
167
|
: [{ id: SAVED_VIEW_MENU_EMPTY, type: 'hint', label: t('nextcloud-vue', 'Add a view to the menu from Filters') }]),
|