@conduction/nextcloud-vue 2.152.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 (63) hide show
  1. package/dist/esm/components/CnConversationThread/CnConversationThread.vue.js +1 -1
  2. package/dist/esm/components/CnConversationThread/CnConversationThread.vue2.js +2 -1
  3. package/dist/esm/components/CnConversationThread/CnConversationThread.vue2.js.map +1 -1
  4. package/dist/esm/components/CnConversationThread/CnConversationThread.vue3.js +33 -25
  5. package/dist/esm/components/CnConversationThread/CnConversationThread.vue3.js.map +1 -1
  6. package/dist/esm/components/CnConversationThread/CnConversationWidget.vue.js +1 -1
  7. package/dist/esm/components/CnConversationThread/CnConversationWidget.vue2.js +22 -2
  8. package/dist/esm/components/CnConversationThread/CnConversationWidget.vue2.js.map +1 -1
  9. package/dist/esm/components/CnConversationThread/CnConversationWidget.vue3.js.map +1 -1
  10. package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js +21 -3
  11. package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js.map +1 -1
  12. package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js.map +1 -1
  13. package/dist/esm/components/CnMapWidget/CnMapWidget.vue.js +1 -1
  14. package/dist/esm/components/CnMapWidget/CnMapWidget.vue2.js +20 -0
  15. package/dist/esm/components/CnMapWidget/CnMapWidget.vue2.js.map +1 -1
  16. package/dist/esm/components/CnMapWidget/CnMapWidget.vue3.js.map +1 -1
  17. package/dist/esm/components/CnNotificationMatrix/CnNotificationMatrix.vue.js +1 -1
  18. package/dist/esm/components/CnNotificationMatrix/CnNotificationMatrix.vue2.js.map +1 -1
  19. package/dist/esm/components/CnNotificationMatrix/CnNotificationMatrix.vue3.js.map +1 -1
  20. package/dist/esm/components/CnPlanWidget/CnPlanWidget.vue.js +1 -1
  21. package/dist/esm/components/CnPlanWidget/CnPlanWidget.vue2.js +18 -1
  22. package/dist/esm/components/CnPlanWidget/CnPlanWidget.vue2.js.map +1 -1
  23. package/dist/esm/components/CnPlanWidget/CnPlanWidget.vue3.js +4 -2
  24. package/dist/esm/components/CnPlanWidget/CnPlanWidget.vue3.js.map +1 -1
  25. package/dist/esm/components/CnPlanWidget/CnPlanWidgetRow.vue.js +1 -1
  26. package/dist/esm/components/CnPlanWidget/CnPlanWidgetRow.vue2.js +25 -3
  27. package/dist/esm/components/CnPlanWidget/CnPlanWidgetRow.vue2.js.map +1 -1
  28. package/dist/esm/components/CnPlanWidget/CnPlanWidgetRow.vue3.js +1 -1
  29. package/dist/esm/components/CnPlanWidget/CnPlanWidgetRow.vue3.js.map +1 -1
  30. package/dist/esm/components/CnStepper/CnStepper.vue.js +1 -1
  31. package/dist/esm/components/CnStepper/CnStepper.vue2.js.map +1 -1
  32. package/dist/esm/components/CnStepper/CnStepper.vue3.js.map +1 -1
  33. package/dist/esm/l10n/en.json.js +19 -1
  34. package/dist/esm/l10n/en.json.js.map +1 -1
  35. package/dist/esm/l10n/nl.json.js +20 -2
  36. package/dist/esm/l10n/nl.json.js.map +1 -1
  37. package/dist/esm/library-style.js +1 -1
  38. package/dist/esm/nextcloud-vue.css +237 -125
  39. package/dist/esm/utils/fillTemplate.js +12 -2
  40. package/dist/esm/utils/fillTemplate.js.map +1 -1
  41. package/dist/esm/utils/savedViewSummary.js +109 -4
  42. package/dist/esm/utils/savedViewSummary.js.map +1 -1
  43. package/dist/nextcloud-vue.cjs.js +681 -424
  44. package/dist/nextcloud-vue.cjs.js.map +2 -2
  45. package/dist/nextcloud-vue.css +237 -125
  46. package/l10n/en.json +19 -1
  47. package/l10n/nl.json +20 -2
  48. package/package.json +1 -1
  49. package/src/components/CnConversationThread/CnConversationThread.vue +7 -1
  50. package/src/components/CnConversationThread/CnConversationWidget.vue +22 -2
  51. package/src/components/CnIndexPage/CnIndexPage.vue +21 -3
  52. package/src/components/CnMapWidget/CnMapWidget.vue +20 -0
  53. package/src/components/CnNotificationMatrix/CnNotificationMatrix.vue +23 -0
  54. package/src/components/CnPlanWidget/CnPlanWidget.vue +20 -1
  55. package/src/components/CnPlanWidget/CnPlanWidgetRow.vue +26 -4
  56. package/src/components/CnStepper/CnStepper.vue +7 -5
  57. package/src/css/dialog.css +12 -0
  58. package/src/css/form-field.css +11 -0
  59. package/src/css/look-board-detail.css +28 -1
  60. package/src/css/look-board-index.css +21 -4
  61. package/src/css/look-board.css +20 -0
  62. package/src/utils/fillTemplate.js +12 -2
  63. package/src/utils/savedViewSummary.js +109 -4
@@ -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").