@conduction/nextcloud-vue 2.151.0 → 2.153.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/CnAiFloatingButton.vue2.js +13 -1
- package/dist/esm/components/CnAiCompanion/CnAiFloatingButton.vue2.js.map +1 -1
- package/dist/esm/components/CnAiCompanion/CnAiFloatingButton.vue3.js +1 -1
- package/dist/esm/components/CnAiCompanion/CnAiFloatingButton.vue3.js.map +1 -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/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 +1 -1
- package/dist/esm/components/CnAttentionFlagWidget/CnAttentionFlagWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnAuditTrailCard/CnAuditTrailCard.vue.js +1 -1
- package/dist/esm/components/CnAuditTrailCard/CnAuditTrailCard.vue2.js +30 -5
- package/dist/esm/components/CnAuditTrailCard/CnAuditTrailCard.vue2.js.map +1 -1
- package/dist/esm/components/CnAuditTrailCard/CnAuditTrailCard.vue3.js.map +1 -1
- package/dist/esm/components/CnBannerWidget/CnBannerWidget.vue.js +1 -1
- package/dist/esm/components/CnBannerWidget/CnBannerWidget.vue2.js +38 -0
- package/dist/esm/components/CnBannerWidget/CnBannerWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnBannerWidget/CnBannerWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnConversationThread/CnConversationThread.vue.js +1 -1
- package/dist/esm/components/CnConversationThread/CnConversationThread.vue2.js +2 -1
- package/dist/esm/components/CnConversationThread/CnConversationThread.vue2.js.map +1 -1
- package/dist/esm/components/CnConversationThread/CnConversationThread.vue3.js +33 -25
- package/dist/esm/components/CnConversationThread/CnConversationThread.vue3.js.map +1 -1
- package/dist/esm/components/CnConversationThread/CnConversationWidget.vue.js +1 -1
- package/dist/esm/components/CnConversationThread/CnConversationWidget.vue2.js +22 -2
- package/dist/esm/components/CnConversationThread/CnConversationWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnConversationThread/CnConversationWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue.js +1 -1
- package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue2.js.map +1 -1
- package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue3.js.map +1 -1
- package/dist/esm/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue.js +1 -1
- package/dist/esm/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue2.js +7 -1
- package/dist/esm/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnExportsWidget/CnExportsWidget.vue.js +1 -1
- package/dist/esm/components/CnExportsWidget/CnExportsWidget.vue2.js +2 -1
- package/dist/esm/components/CnExportsWidget/CnExportsWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnExportsWidget/CnExportsWidget.vue3.js +6 -2
- package/dist/esm/components/CnExportsWidget/CnExportsWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnFeaturesBoard/CnFeaturesBoard.vue.js +1 -1
- package/dist/esm/components/CnFeaturesBoard/CnFeaturesBoard.vue2.js.map +1 -1
- package/dist/esm/components/CnFeaturesBoard/CnFeaturesBoard.vue3.js.map +1 -1
- package/dist/esm/components/CnFieldListWidget/CnFieldListWidget.vue.js +1 -1
- package/dist/esm/components/CnFieldListWidget/CnFieldListWidget.vue2.js +3 -1
- package/dist/esm/components/CnFieldListWidget/CnFieldListWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnFieldListWidget/CnFieldListWidget.vue3.js +31 -9
- package/dist/esm/components/CnFieldListWidget/CnFieldListWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js +21 -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/CnMapWidget/CnMapWidget.vue.js +1 -1
- package/dist/esm/components/CnMapWidget/CnMapWidget.vue2.js +20 -0
- package/dist/esm/components/CnMapWidget/CnMapWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnMapWidget/CnMapWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnNotificationMatrix/CnNotificationMatrix.vue.js +1 -1
- package/dist/esm/components/CnNotificationMatrix/CnNotificationMatrix.vue2.js.map +1 -1
- package/dist/esm/components/CnNotificationMatrix/CnNotificationMatrix.vue3.js.map +1 -1
- package/dist/esm/components/CnPlanWidget/CnPlanWidget.vue.js +1 -1
- package/dist/esm/components/CnPlanWidget/CnPlanWidget.vue2.js +18 -1
- package/dist/esm/components/CnPlanWidget/CnPlanWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnPlanWidget/CnPlanWidget.vue3.js +4 -2
- package/dist/esm/components/CnPlanWidget/CnPlanWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnPlanWidget/CnPlanWidgetRow.vue.js +1 -1
- package/dist/esm/components/CnPlanWidget/CnPlanWidgetRow.vue2.js +25 -3
- package/dist/esm/components/CnPlanWidget/CnPlanWidgetRow.vue2.js.map +1 -1
- package/dist/esm/components/CnPlanWidget/CnPlanWidgetRow.vue3.js +1 -1
- package/dist/esm/components/CnPlanWidget/CnPlanWidgetRow.vue3.js.map +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue.js +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js +31 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js +102 -97
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnSavedViewLookFields/CnSavedViewLookFields.vue.js +1 -1
- package/dist/esm/components/CnSavedViewLookFields/CnSavedViewLookFields.vue2.js +33 -0
- package/dist/esm/components/CnSavedViewLookFields/CnSavedViewLookFields.vue2.js.map +1 -1
- package/dist/esm/components/CnSavedViewLookFields/CnSavedViewLookFields.vue3.js +2 -2
- package/dist/esm/components/CnSavedViewLookFields/CnSavedViewLookFields.vue3.js.map +1 -1
- package/dist/esm/components/CnSettingsField/CnSettingsField.vue.js +1 -1
- package/dist/esm/components/CnSettingsField/CnSettingsField.vue2.js +2 -1
- package/dist/esm/components/CnSettingsField/CnSettingsField.vue2.js.map +1 -1
- package/dist/esm/components/CnSettingsField/CnSettingsField.vue3.js +15 -13
- package/dist/esm/components/CnSettingsField/CnSettingsField.vue3.js.map +1 -1
- package/dist/esm/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue.js +1 -1
- package/dist/esm/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue2.js +27 -0
- package/dist/esm/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue2.js.map +1 -1
- package/dist/esm/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue3.js +6 -6
- package/dist/esm/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue3.js.map +1 -1
- package/dist/esm/components/CnStepper/CnStepper.vue.js +1 -1
- package/dist/esm/components/CnStepper/CnStepper.vue2.js.map +1 -1
- package/dist/esm/components/CnStepper/CnStepper.vue3.js.map +1 -1
- package/dist/esm/components/CnTimelineWidget/CnTimelineManage.vue.js +1 -1
- package/dist/esm/components/CnTimelineWidget/CnTimelineManage.vue2.js.map +1 -1
- package/dist/esm/components/CnTimelineWidget/CnTimelineManage.vue3.js +14 -14
- package/dist/esm/components/CnTimelineWidget/CnTimelineManage.vue3.js.map +1 -1
- package/dist/esm/composables/indexSources.js +4 -1
- package/dist/esm/composables/indexSources.js.map +1 -1
- package/dist/esm/l10n/en.json.js +30 -1
- package/dist/esm/l10n/en.json.js.map +1 -1
- package/dist/esm/l10n/nl.json.js +31 -2
- package/dist/esm/l10n/nl.json.js.map +1 -1
- package/dist/esm/library-style.js +1 -1
- package/dist/esm/nextcloud-vue.css +1129 -567
- package/dist/esm/utils/fillTemplate.js +12 -2
- package/dist/esm/utils/fillTemplate.js.map +1 -1
- package/dist/esm/utils/libraryTranslate.js +19 -1
- package/dist/esm/utils/libraryTranslate.js.map +1 -1
- package/dist/esm/utils/savedViewSummary.js +109 -4
- package/dist/esm/utils/savedViewSummary.js.map +1 -1
- package/dist/nextcloud-vue.cjs.js +1096 -592
- package/dist/nextcloud-vue.cjs.js.map +2 -2
- package/dist/nextcloud-vue.css +1129 -567
- package/l10n/en.json +30 -1
- package/l10n/nl.json +31 -2
- package/package.json +1 -1
- package/src/components/CnAiCompanion/CnAiFloatingButton.vue +14 -2
- package/src/components/CnAiCompanion/CnAiInput.vue +19 -0
- package/src/components/CnAttentionFlagWidget/CnAttentionFlagWidget.vue +7 -1
- package/src/components/CnAuditTrailCard/CnAuditTrailCard.vue +30 -5
- package/src/components/CnBannerWidget/CnBannerWidget.vue +38 -0
- package/src/components/CnConversationThread/CnConversationThread.vue +7 -1
- package/src/components/CnConversationThread/CnConversationWidget.vue +22 -2
- package/src/components/CnDashboardPage/CnDashboardPage.vue +17 -0
- package/src/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue +16 -1
- package/src/components/CnExportsWidget/CnExportsWidget.vue +5 -1
- package/src/components/CnFeaturesBoard/CnFeaturesBoard.vue +2 -0
- package/src/components/CnFieldListWidget/CnFieldListWidget.vue +18 -4
- package/src/components/CnIndexPage/CnIndexPage.vue +21 -3
- package/src/components/CnMapWidget/CnMapWidget.vue +20 -0
- package/src/components/CnNotificationMatrix/CnNotificationMatrix.vue +23 -0
- package/src/components/CnPlanWidget/CnPlanWidget.vue +20 -1
- package/src/components/CnPlanWidget/CnPlanWidgetRow.vue +26 -4
- package/src/components/CnRecordListWidget/CnRecordListWidget.vue +73 -5
- package/src/components/CnSavedViewLookFields/CnSavedViewLookFields.vue +35 -2
- package/src/components/CnSettingsField/CnSettingsField.vue +5 -3
- package/src/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue +31 -4
- package/src/components/CnStepper/CnStepper.vue +7 -5
- package/src/components/CnTimelineWidget/CnTimelineManage.vue +9 -4
- package/src/composables/indexSources.js +4 -1
- package/src/css/dialog.css +18 -3
- package/src/css/form-field.css +11 -0
- package/src/css/look-board-detail.css +124 -1
- package/src/css/look-board-index.css +75 -9
- package/src/css/look-board.css +242 -6
- package/src/css/patches.css +5 -5
- package/src/utils/fillTemplate.js +12 -2
- package/src/utils/libraryTranslate.js +18 -0
- package/src/utils/savedViewSummary.js +109 -4
package/src/css/patches.css
CHANGED
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
border-radius: var(--border-radius-element, var(--border-radius-large, 8px));
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
/* In the board look the square is the
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
2.78:1.
|
|
37
|
+
/* In the board look the square is the brand orange darkened to WCAG AA
|
|
38
|
+
(Ruben, 26 Oct): #c64e0b, the Conduction accent, keeps the brand hue and
|
|
39
|
+
puts the white icon at 4.67:1 and the square's edge at 4.32:1 on the
|
|
40
|
+
page ground; the brand orange #f36c21 gives 3.01:1 and 2.78:1.
|
|
41
41
|
@spec openspec/changes/board-buildiq-orange/specs/board-buildiq-orange/spec.md#requirement-the-board-buildiq-square-is-the-boards-orange */
|
|
42
42
|
.cn-look-board .cn-buildiq-edit .cn-buildiq-edit__actions .button-vue {
|
|
43
|
-
--cn-buildiq-color: #
|
|
43
|
+
--cn-buildiq-color: #c64e0b;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
.cn-buildiq-edit__actions .button-vue__wrapper {
|
|
@@ -5,6 +5,7 @@ import { translate as t } from '@nextcloud/l10n'
|
|
|
5
5
|
import { boardDateLocale, formatAgo, formatBoardDate, formatBoardWeekday, formatRelativeDate, formatTimeOfDay, isoWeek } from './boardDate.js'
|
|
6
6
|
import { parseDateValue } from './dateVariant.js'
|
|
7
7
|
import { formatMoney } from './formatMetric.js'
|
|
8
|
+
import { groupDisplayName, loadGroupDisplayName } from './groupAutocomplete.js'
|
|
8
9
|
import { readPath } from './readPath.js'
|
|
9
10
|
import { userDisplayName } from './userDisplayName.js'
|
|
10
11
|
|
|
@@ -80,7 +81,7 @@ function countEntries(list, key) {
|
|
|
80
81
|
* Format one token value.
|
|
81
82
|
*
|
|
82
83
|
* @param {unknown} value The raw value.
|
|
83
|
-
* @param {string} format `date`, `datetime`, `weekday`, `longdate`, `time`, `user`, `currency`, `relative`, `relativetime`, `ago`, `week`, `days`, `lower`, `mailbox` or '' (as is).
|
|
84
|
+
* @param {string} format `date`, `datetime`, `weekday`, `longdate`, `time`, `user`, `group`, `currency`, `relative`, `relativetime`, `ago`, `week`, `days`, `lower`, `mailbox` or '' (as is).
|
|
84
85
|
* @param {Date} now The reference moment.
|
|
85
86
|
* @param {string} [arg] The format's argument (`currency:EUR`, or a row path holding the code).
|
|
86
87
|
* @param {object|null} [object] The row, for a currency read from a field.
|
|
@@ -121,6 +122,14 @@ function formatValue(value, format, now, arg = '', object = null, config = null,
|
|
|
121
122
|
if (format === 'user') {
|
|
122
123
|
return userDisplayName(value)
|
|
123
124
|
}
|
|
125
|
+
if (format === 'group') {
|
|
126
|
+
const name = groupDisplayName(value)
|
|
127
|
+
if (name === null) {
|
|
128
|
+
loadGroupDisplayName(value)
|
|
129
|
+
return ''
|
|
130
|
+
}
|
|
131
|
+
return name
|
|
132
|
+
}
|
|
124
133
|
if (format === 'time') {
|
|
125
134
|
const date = parseDateValue(value)
|
|
126
135
|
return date === null ? '' : formatTimeOfDay(date)
|
|
@@ -168,7 +177,8 @@ function formatValue(value, format, now, arg = '', object = null, config = null,
|
|
|
168
177
|
* for today), `{path|longdate}` writes the month out ("7 oktober";
|
|
169
178
|
* `{path|longdate:year}` always adds the year), `{path|time}` is the time
|
|
170
179
|
* of day ("08:45"), `{path|user}` is a user id's display name (looked up
|
|
171
|
-
* once, '' until it arrives), `{path|
|
|
180
|
+
* once, '' until it arrives), `{path|group}` is a group id's display name
|
|
181
|
+
* (the same, through the group name cache), `{path|currency}`,
|
|
172
182
|
* `{path|currency:EUR}` and `{path|currency:field}` write an amount in a
|
|
173
183
|
* currency (a code, or the row field that holds it; without either, or when
|
|
174
184
|
* the row field is empty, the app's reporting currency), `{path|relative}` and
|
|
@@ -23,3 +23,21 @@ export function libraryTranslate(text, vars) {
|
|
|
23
23
|
ensureTranslations()
|
|
24
24
|
return t('nextcloud-vue', text, vars)
|
|
25
25
|
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Translate a library string through the host app's catalogue, falling back
|
|
29
|
+
* to the library's own when the host has no translation for it. An app's
|
|
30
|
+
* `cnTranslate` answers the English string back for a string its catalogue
|
|
31
|
+
* lacks, so library chrome (the AI button's "Open AI chat") read English in
|
|
32
|
+
* an app that never copied the string.
|
|
33
|
+
*
|
|
34
|
+
* @param {Function} hostTranslate The injected `cnTranslate`.
|
|
35
|
+
* @param {string} text The English string.
|
|
36
|
+
* @param {object} [vars] Placeholder values.
|
|
37
|
+
* @return {string} The string in the user's language.
|
|
38
|
+
* @spec openspec/changes/library-string-host-fallback/specs/i18n/spec.md
|
|
39
|
+
*/
|
|
40
|
+
export function translateLibraryString(hostTranslate, text, vars) {
|
|
41
|
+
const viaHost = typeof hostTranslate === 'function' ? hostTranslate(text, vars) : text
|
|
42
|
+
return viaHost !== text ? viaHost : libraryTranslate(text, vars)
|
|
43
|
+
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2026 Conduction B.V.
|
|
2
2
|
// SPDX-License-Identifier: EUPL-1.2
|
|
3
3
|
|
|
4
|
-
import { translate as t } from '@nextcloud/l10n'
|
|
4
|
+
import { translatePlural as n, translate as t } from '@nextcloud/l10n'
|
|
5
5
|
import { MISSING_VALUE } from './facets.js'
|
|
6
|
+
import { relativeRangeText } from './filterRangeLabel.js'
|
|
7
|
+
|
|
8
|
+
/** Marks a filter entry built from `field[gte]` / `field[lt]` keys. */
|
|
9
|
+
const RANGE = Symbol('range')
|
|
6
10
|
|
|
7
11
|
/**
|
|
8
12
|
* A saved view's filters as one readable line: "Case type Woo request,
|
|
@@ -26,7 +30,7 @@ import { MISSING_VALUE } from './facets.js'
|
|
|
26
30
|
* @param {object} [options] Options.
|
|
27
31
|
* @param {object} [options.properties] The page schema's `properties`.
|
|
28
32
|
* @param {{[key: string]: {[value: string]: string}}} [options.valueLabels] Display names per filter key and value.
|
|
29
|
-
* @param {{[key: string]: {label?: string, values?: object, hidden?: boolean}}} [options.filterLabels] The page's `config.filterLabels
|
|
33
|
+
* @param {{[key: string]: {label?: string, values?: object, hidden?: boolean, valuesAlone?: boolean}}} [options.filterLabels] The page's `config.filterLabels`; with `valuesAlone` a named value reads as the whole part.
|
|
30
34
|
* @param {(text: string) => string} [options.translate] The app's translate, for titles and labels the schema declares.
|
|
31
35
|
* @return {string} The line, or '' for a view without filters or search.
|
|
32
36
|
* @spec openspec/changes/saved-view-summary-reads-like-the-chips/specs/saved-view-menu-settings/spec.md
|
|
@@ -37,9 +41,19 @@ export function summarizeViewFilters(state, options = {}) {
|
|
|
37
41
|
const valueLabels = (options.valueLabels && typeof options.valueLabels === 'object') ? options.valueLabels : {}
|
|
38
42
|
const filterLabels = (options.filterLabels && typeof options.filterLabels === 'object') ? options.filterLabels : {}
|
|
39
43
|
const tr = typeof options.translate === 'function' ? options.translate : (text) => text
|
|
40
|
-
const filters = (state && state.filters && typeof state.filters === 'object') ? state.filters : {}
|
|
44
|
+
const filters = groupRanges((state && state.filters && typeof state.filters === 'object') ? state.filters : {})
|
|
41
45
|
const parts = []
|
|
42
46
|
for (const [key, raw] of Object.entries(filters)) {
|
|
47
|
+
if (raw && typeof raw === 'object' && raw[RANGE] === true) {
|
|
48
|
+
const named = (filterLabels[key] && typeof filterLabels[key] === 'object') ? filterLabels[key] : {}
|
|
49
|
+
if (named.hidden === true) {
|
|
50
|
+
continue
|
|
51
|
+
}
|
|
52
|
+
const prop = properties[key] || {}
|
|
53
|
+
const title = typeof named.label === 'string' && named.label !== '' ? named.label : (typeof prop.title === 'string' && prop.title !== '' ? prop.title : key)
|
|
54
|
+
parts.push(`${tr(title)} ${rangeWords(raw.from, raw.to)}`)
|
|
55
|
+
continue
|
|
56
|
+
}
|
|
43
57
|
const named = (filterLabels[key] && typeof filterLabels[key] === 'object') ? filterLabels[key] : {}
|
|
44
58
|
if (named.hidden === true) {
|
|
45
59
|
continue
|
|
@@ -59,7 +73,11 @@ export function summarizeViewFilters(state, options = {}) {
|
|
|
59
73
|
? named.label
|
|
60
74
|
: (typeof prop.title === 'string' && prop.title !== '' ? prop.title : key)
|
|
61
75
|
const field = tr(title)
|
|
62
|
-
|
|
76
|
+
// `valuesAlone: true`: a value the page names reads as the whole part
|
|
77
|
+
// ("My cases" for assignee @me), not after the field's title.
|
|
78
|
+
const raws = (Array.isArray(raw) ? raw : [raw]).filter((value) => value !== undefined && value !== '')
|
|
79
|
+
const alone = named.valuesAlone === true && raws.length === 1 && typeof namedValues[String(raws[0])] === 'string' && namedValues[String(raws[0])] !== ''
|
|
80
|
+
parts.push(alone ? values[0] : `${field} ${values.join(` ${t('nextcloud-vue', 'or')} `)}`)
|
|
63
81
|
}
|
|
64
82
|
if (state && typeof state.search === 'string' && state.search.trim() !== '') {
|
|
65
83
|
parts.push(`"${state.search.trim()}"`)
|
|
@@ -130,6 +148,10 @@ function valueText(value, prop, labels, tr) {
|
|
|
130
148
|
.join(' ')
|
|
131
149
|
}
|
|
132
150
|
const id = String(value)
|
|
151
|
+
const token = tokenWords(id)
|
|
152
|
+
if (token !== null) {
|
|
153
|
+
return token
|
|
154
|
+
}
|
|
133
155
|
if (typeof labels[id] === 'string' && labels[id] !== '') {
|
|
134
156
|
return labels[id]
|
|
135
157
|
}
|
|
@@ -144,6 +166,89 @@ function valueText(value, prop, labels, tr) {
|
|
|
144
166
|
return id
|
|
145
167
|
}
|
|
146
168
|
|
|
169
|
+
/**
|
|
170
|
+
* The filters with each `field[op]` pair folded into one range entry under
|
|
171
|
+
* `field`, in the place of its first part, so "deadline[gte] @today,
|
|
172
|
+
* deadline[lt] @today+7d" reads as one deadline range.
|
|
173
|
+
*
|
|
174
|
+
* @param {object} filters The view's filters.
|
|
175
|
+
* @return {object} The filters, ranges folded.
|
|
176
|
+
*/
|
|
177
|
+
function groupRanges(filters) {
|
|
178
|
+
const out = {}
|
|
179
|
+
for (const [key, value] of Object.entries(filters)) {
|
|
180
|
+
const match = /^(.+)\[(gte|gt|lte|lt)\]$/.exec(key)
|
|
181
|
+
if (!match) {
|
|
182
|
+
out[key] = value
|
|
183
|
+
continue
|
|
184
|
+
}
|
|
185
|
+
const field = match[1]
|
|
186
|
+
const range = out[field] && out[field][RANGE] === true ? out[field] : { [RANGE]: true }
|
|
187
|
+
if (match[2] === 'gte' || match[2] === 'gt') {
|
|
188
|
+
range.from = value
|
|
189
|
+
} else {
|
|
190
|
+
range.to = value
|
|
191
|
+
}
|
|
192
|
+
out[field] = range
|
|
193
|
+
}
|
|
194
|
+
return out
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* A range in words: "within 7 days", "today" or "this week" when it starts
|
|
199
|
+
* today, else "from {from} up to {to}" with each end in words.
|
|
200
|
+
*
|
|
201
|
+
* @param {unknown} from The lower end, or undefined.
|
|
202
|
+
* @param {unknown} to The upper end, or undefined.
|
|
203
|
+
* @return {string} The words.
|
|
204
|
+
*/
|
|
205
|
+
function rangeWords(from, to) {
|
|
206
|
+
if (from !== undefined && to !== undefined) {
|
|
207
|
+
const relative = relativeRangeText(from, to, {
|
|
208
|
+
translate: (text, vars) => t('nextcloud-vue', text, vars),
|
|
209
|
+
translatePlural: (one, many, count) => n('nextcloud-vue', one, many, count),
|
|
210
|
+
})
|
|
211
|
+
if (relative) {
|
|
212
|
+
return relative
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
const words = (value) => tokenWords(String(value)) ?? String(value)
|
|
216
|
+
if (from !== undefined && to !== undefined) {
|
|
217
|
+
return `${t('nextcloud-vue', 'from {value}', { value: words(from) })} ${t('nextcloud-vue', 'up to {value}', { value: words(to) })}`
|
|
218
|
+
}
|
|
219
|
+
return from !== undefined
|
|
220
|
+
? t('nextcloud-vue', 'from {value}', { value: words(from) })
|
|
221
|
+
: t('nextcloud-vue', 'up to {value}', { value: words(to) })
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* A filter token in words: `@me` "you", `@myTeam` "my team", `@today`
|
|
226
|
+
* "today", `@today+7d` "in 7 days", `@today-7d` "7 days ago". Null for a
|
|
227
|
+
* value that is not a token.
|
|
228
|
+
*
|
|
229
|
+
* @param {string} value The stored value.
|
|
230
|
+
* @return {string|null} The words, or null.
|
|
231
|
+
*/
|
|
232
|
+
function tokenWords(value) {
|
|
233
|
+
if (value === '@me') {
|
|
234
|
+
return t('nextcloud-vue', 'you')
|
|
235
|
+
}
|
|
236
|
+
if (value === '@myTeam') {
|
|
237
|
+
return t('nextcloud-vue', 'my team')
|
|
238
|
+
}
|
|
239
|
+
const day = /^@today(?:([+-])(\d+)d)?$/.exec(value)
|
|
240
|
+
if (!day) {
|
|
241
|
+
return null
|
|
242
|
+
}
|
|
243
|
+
if (!day[1] || Number(day[2]) === 0) {
|
|
244
|
+
return t('nextcloud-vue', 'today')
|
|
245
|
+
}
|
|
246
|
+
const count = Number(day[2])
|
|
247
|
+
return day[1] === '+'
|
|
248
|
+
? n('nextcloud-vue', 'in %n day', 'in %n days', count)
|
|
249
|
+
: n('nextcloud-vue', '%n day ago', '%n days ago', count)
|
|
250
|
+
}
|
|
251
|
+
|
|
147
252
|
/**
|
|
148
253
|
* The text with its first letter in lower case, unless the first word is in
|
|
149
254
|
* capitals (an abbreviation such as "BSN").
|