@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.
Files changed (147) hide show
  1. package/dist/esm/components/CnAiCompanion/CnAiFloatingButton.vue2.js +13 -1
  2. package/dist/esm/components/CnAiCompanion/CnAiFloatingButton.vue2.js.map +1 -1
  3. package/dist/esm/components/CnAiCompanion/CnAiFloatingButton.vue3.js +1 -1
  4. package/dist/esm/components/CnAiCompanion/CnAiFloatingButton.vue3.js.map +1 -1
  5. package/dist/esm/components/CnAiCompanion/CnAiInput.vue2.js.map +1 -1
  6. package/dist/esm/components/CnAiCompanion/CnAiInput.vue3.js.map +1 -1
  7. package/dist/esm/components/CnAttentionFlagWidget/CnAttentionFlagWidget.vue.js +1 -1
  8. package/dist/esm/components/CnAttentionFlagWidget/CnAttentionFlagWidget.vue2.js.map +1 -1
  9. package/dist/esm/components/CnAttentionFlagWidget/CnAttentionFlagWidget.vue3.js +1 -1
  10. package/dist/esm/components/CnAttentionFlagWidget/CnAttentionFlagWidget.vue3.js.map +1 -1
  11. package/dist/esm/components/CnAuditTrailCard/CnAuditTrailCard.vue.js +1 -1
  12. package/dist/esm/components/CnAuditTrailCard/CnAuditTrailCard.vue2.js +30 -5
  13. package/dist/esm/components/CnAuditTrailCard/CnAuditTrailCard.vue2.js.map +1 -1
  14. package/dist/esm/components/CnAuditTrailCard/CnAuditTrailCard.vue3.js.map +1 -1
  15. package/dist/esm/components/CnBannerWidget/CnBannerWidget.vue.js +1 -1
  16. package/dist/esm/components/CnBannerWidget/CnBannerWidget.vue2.js +38 -0
  17. package/dist/esm/components/CnBannerWidget/CnBannerWidget.vue2.js.map +1 -1
  18. package/dist/esm/components/CnBannerWidget/CnBannerWidget.vue3.js.map +1 -1
  19. package/dist/esm/components/CnConversationThread/CnConversationThread.vue.js +1 -1
  20. package/dist/esm/components/CnConversationThread/CnConversationThread.vue2.js +2 -1
  21. package/dist/esm/components/CnConversationThread/CnConversationThread.vue2.js.map +1 -1
  22. package/dist/esm/components/CnConversationThread/CnConversationThread.vue3.js +33 -25
  23. package/dist/esm/components/CnConversationThread/CnConversationThread.vue3.js.map +1 -1
  24. package/dist/esm/components/CnConversationThread/CnConversationWidget.vue.js +1 -1
  25. package/dist/esm/components/CnConversationThread/CnConversationWidget.vue2.js +22 -2
  26. package/dist/esm/components/CnConversationThread/CnConversationWidget.vue2.js.map +1 -1
  27. package/dist/esm/components/CnConversationThread/CnConversationWidget.vue3.js.map +1 -1
  28. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue.js +1 -1
  29. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue2.js.map +1 -1
  30. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue3.js.map +1 -1
  31. package/dist/esm/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue.js +1 -1
  32. package/dist/esm/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue2.js +7 -1
  33. package/dist/esm/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue2.js.map +1 -1
  34. package/dist/esm/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue3.js.map +1 -1
  35. package/dist/esm/components/CnExportsWidget/CnExportsWidget.vue.js +1 -1
  36. package/dist/esm/components/CnExportsWidget/CnExportsWidget.vue2.js +2 -1
  37. package/dist/esm/components/CnExportsWidget/CnExportsWidget.vue2.js.map +1 -1
  38. package/dist/esm/components/CnExportsWidget/CnExportsWidget.vue3.js +6 -2
  39. package/dist/esm/components/CnExportsWidget/CnExportsWidget.vue3.js.map +1 -1
  40. package/dist/esm/components/CnFeaturesBoard/CnFeaturesBoard.vue.js +1 -1
  41. package/dist/esm/components/CnFeaturesBoard/CnFeaturesBoard.vue2.js.map +1 -1
  42. package/dist/esm/components/CnFeaturesBoard/CnFeaturesBoard.vue3.js.map +1 -1
  43. package/dist/esm/components/CnFieldListWidget/CnFieldListWidget.vue.js +1 -1
  44. package/dist/esm/components/CnFieldListWidget/CnFieldListWidget.vue2.js +3 -1
  45. package/dist/esm/components/CnFieldListWidget/CnFieldListWidget.vue2.js.map +1 -1
  46. package/dist/esm/components/CnFieldListWidget/CnFieldListWidget.vue3.js +31 -9
  47. package/dist/esm/components/CnFieldListWidget/CnFieldListWidget.vue3.js.map +1 -1
  48. package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js +21 -3
  49. package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js.map +1 -1
  50. package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js.map +1 -1
  51. package/dist/esm/components/CnMapWidget/CnMapWidget.vue.js +1 -1
  52. package/dist/esm/components/CnMapWidget/CnMapWidget.vue2.js +20 -0
  53. package/dist/esm/components/CnMapWidget/CnMapWidget.vue2.js.map +1 -1
  54. package/dist/esm/components/CnMapWidget/CnMapWidget.vue3.js.map +1 -1
  55. package/dist/esm/components/CnNotificationMatrix/CnNotificationMatrix.vue.js +1 -1
  56. package/dist/esm/components/CnNotificationMatrix/CnNotificationMatrix.vue2.js.map +1 -1
  57. package/dist/esm/components/CnNotificationMatrix/CnNotificationMatrix.vue3.js.map +1 -1
  58. package/dist/esm/components/CnPlanWidget/CnPlanWidget.vue.js +1 -1
  59. package/dist/esm/components/CnPlanWidget/CnPlanWidget.vue2.js +18 -1
  60. package/dist/esm/components/CnPlanWidget/CnPlanWidget.vue2.js.map +1 -1
  61. package/dist/esm/components/CnPlanWidget/CnPlanWidget.vue3.js +4 -2
  62. package/dist/esm/components/CnPlanWidget/CnPlanWidget.vue3.js.map +1 -1
  63. package/dist/esm/components/CnPlanWidget/CnPlanWidgetRow.vue.js +1 -1
  64. package/dist/esm/components/CnPlanWidget/CnPlanWidgetRow.vue2.js +25 -3
  65. package/dist/esm/components/CnPlanWidget/CnPlanWidgetRow.vue2.js.map +1 -1
  66. package/dist/esm/components/CnPlanWidget/CnPlanWidgetRow.vue3.js +1 -1
  67. package/dist/esm/components/CnPlanWidget/CnPlanWidgetRow.vue3.js.map +1 -1
  68. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue.js +1 -1
  69. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js +31 -1
  70. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js.map +1 -1
  71. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js +102 -97
  72. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js.map +1 -1
  73. package/dist/esm/components/CnSavedViewLookFields/CnSavedViewLookFields.vue.js +1 -1
  74. package/dist/esm/components/CnSavedViewLookFields/CnSavedViewLookFields.vue2.js +33 -0
  75. package/dist/esm/components/CnSavedViewLookFields/CnSavedViewLookFields.vue2.js.map +1 -1
  76. package/dist/esm/components/CnSavedViewLookFields/CnSavedViewLookFields.vue3.js +2 -2
  77. package/dist/esm/components/CnSavedViewLookFields/CnSavedViewLookFields.vue3.js.map +1 -1
  78. package/dist/esm/components/CnSettingsField/CnSettingsField.vue.js +1 -1
  79. package/dist/esm/components/CnSettingsField/CnSettingsField.vue2.js +2 -1
  80. package/dist/esm/components/CnSettingsField/CnSettingsField.vue2.js.map +1 -1
  81. package/dist/esm/components/CnSettingsField/CnSettingsField.vue3.js +15 -13
  82. package/dist/esm/components/CnSettingsField/CnSettingsField.vue3.js.map +1 -1
  83. package/dist/esm/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue.js +1 -1
  84. package/dist/esm/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue2.js +27 -0
  85. package/dist/esm/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue2.js.map +1 -1
  86. package/dist/esm/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue3.js +6 -6
  87. package/dist/esm/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue3.js.map +1 -1
  88. package/dist/esm/components/CnStepper/CnStepper.vue.js +1 -1
  89. package/dist/esm/components/CnStepper/CnStepper.vue2.js.map +1 -1
  90. package/dist/esm/components/CnStepper/CnStepper.vue3.js.map +1 -1
  91. package/dist/esm/components/CnTimelineWidget/CnTimelineManage.vue.js +1 -1
  92. package/dist/esm/components/CnTimelineWidget/CnTimelineManage.vue2.js.map +1 -1
  93. package/dist/esm/components/CnTimelineWidget/CnTimelineManage.vue3.js +14 -14
  94. package/dist/esm/components/CnTimelineWidget/CnTimelineManage.vue3.js.map +1 -1
  95. package/dist/esm/composables/indexSources.js +4 -1
  96. package/dist/esm/composables/indexSources.js.map +1 -1
  97. package/dist/esm/l10n/en.json.js +30 -1
  98. package/dist/esm/l10n/en.json.js.map +1 -1
  99. package/dist/esm/l10n/nl.json.js +31 -2
  100. package/dist/esm/l10n/nl.json.js.map +1 -1
  101. package/dist/esm/library-style.js +1 -1
  102. package/dist/esm/nextcloud-vue.css +1129 -567
  103. package/dist/esm/utils/fillTemplate.js +12 -2
  104. package/dist/esm/utils/fillTemplate.js.map +1 -1
  105. package/dist/esm/utils/libraryTranslate.js +19 -1
  106. package/dist/esm/utils/libraryTranslate.js.map +1 -1
  107. package/dist/esm/utils/savedViewSummary.js +109 -4
  108. package/dist/esm/utils/savedViewSummary.js.map +1 -1
  109. package/dist/nextcloud-vue.cjs.js +1096 -592
  110. package/dist/nextcloud-vue.cjs.js.map +2 -2
  111. package/dist/nextcloud-vue.css +1129 -567
  112. package/l10n/en.json +30 -1
  113. package/l10n/nl.json +31 -2
  114. package/package.json +1 -1
  115. package/src/components/CnAiCompanion/CnAiFloatingButton.vue +14 -2
  116. package/src/components/CnAiCompanion/CnAiInput.vue +19 -0
  117. package/src/components/CnAttentionFlagWidget/CnAttentionFlagWidget.vue +7 -1
  118. package/src/components/CnAuditTrailCard/CnAuditTrailCard.vue +30 -5
  119. package/src/components/CnBannerWidget/CnBannerWidget.vue +38 -0
  120. package/src/components/CnConversationThread/CnConversationThread.vue +7 -1
  121. package/src/components/CnConversationThread/CnConversationWidget.vue +22 -2
  122. package/src/components/CnDashboardPage/CnDashboardPage.vue +17 -0
  123. package/src/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue +16 -1
  124. package/src/components/CnExportsWidget/CnExportsWidget.vue +5 -1
  125. package/src/components/CnFeaturesBoard/CnFeaturesBoard.vue +2 -0
  126. package/src/components/CnFieldListWidget/CnFieldListWidget.vue +18 -4
  127. package/src/components/CnIndexPage/CnIndexPage.vue +21 -3
  128. package/src/components/CnMapWidget/CnMapWidget.vue +20 -0
  129. package/src/components/CnNotificationMatrix/CnNotificationMatrix.vue +23 -0
  130. package/src/components/CnPlanWidget/CnPlanWidget.vue +20 -1
  131. package/src/components/CnPlanWidget/CnPlanWidgetRow.vue +26 -4
  132. package/src/components/CnRecordListWidget/CnRecordListWidget.vue +73 -5
  133. package/src/components/CnSavedViewLookFields/CnSavedViewLookFields.vue +35 -2
  134. package/src/components/CnSettingsField/CnSettingsField.vue +5 -3
  135. package/src/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue +31 -4
  136. package/src/components/CnStepper/CnStepper.vue +7 -5
  137. package/src/components/CnTimelineWidget/CnTimelineManage.vue +9 -4
  138. package/src/composables/indexSources.js +4 -1
  139. package/src/css/dialog.css +18 -3
  140. package/src/css/form-field.css +11 -0
  141. package/src/css/look-board-detail.css +124 -1
  142. package/src/css/look-board-index.css +75 -9
  143. package/src/css/look-board.css +242 -6
  144. package/src/css/patches.css +5 -5
  145. package/src/utils/fillTemplate.js +12 -2
  146. package/src/utils/libraryTranslate.js +18 -0
  147. package/src/utils/savedViewSummary.js +109 -4
@@ -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 boards' deeper orange: the white icon
38
- on it is 3.52:1, where the brand orange #f36c21 is 3.01:1, and the
39
- square's edge is 3.26:1 on the page ground, where the brand orange is
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: #e2611a;
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|currency}`,
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
- parts.push(`${field} ${values.join(` ${t('nextcloud-vue', 'or')} `)}`)
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").