@conduction/nextcloud-vue 2.146.0 → 2.148.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 (58) hide show
  1. package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js +71 -8
  2. package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js.map +1 -1
  3. package/dist/esm/components/CnDetailPage/CnDetailPage.vue3.js +2 -2
  4. package/dist/esm/components/CnDetailPage/CnDetailPage.vue3.js.map +1 -1
  5. package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue.js +1 -1
  6. package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue2.js +73 -9
  7. package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue2.js.map +1 -1
  8. package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue3.js +37 -13
  9. package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue3.js.map +1 -1
  10. package/dist/esm/components/CnObjectDataWidget/CnObjectDataWidget.vue.js +1 -1
  11. package/dist/esm/components/CnObjectDataWidget/CnObjectDataWidget.vue2.js +8 -0
  12. package/dist/esm/components/CnObjectDataWidget/CnObjectDataWidget.vue2.js.map +1 -1
  13. package/dist/esm/components/CnObjectDataWidget/CnObjectDataWidget.vue3.js.map +1 -1
  14. package/dist/esm/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue.js +1 -1
  15. package/dist/esm/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue2.js +2 -2
  16. package/dist/esm/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue2.js.map +1 -1
  17. package/dist/esm/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue3.js.map +1 -1
  18. package/dist/esm/components/CnStepper/CnStepper.vue.js +1 -1
  19. package/dist/esm/components/CnStepper/CnStepper.vue2.js.map +1 -1
  20. package/dist/esm/components/CnStepper/CnStepper.vue3.js.map +1 -1
  21. package/dist/esm/dialogs/CnAccessPurposeDialog.vue.js +1 -1
  22. package/dist/esm/dialogs/CnAccessPurposeDialog.vue2.js +3 -1
  23. package/dist/esm/dialogs/CnAccessPurposeDialog.vue2.js.map +1 -1
  24. package/dist/esm/dialogs/CnAccessPurposeDialog.vue3.js +26 -15
  25. package/dist/esm/dialogs/CnAccessPurposeDialog.vue3.js.map +1 -1
  26. package/dist/esm/l10n/en.json.js +2 -1
  27. package/dist/esm/l10n/en.json.js.map +1 -1
  28. package/dist/esm/l10n/nl.json.js +2 -1
  29. package/dist/esm/l10n/nl.json.js.map +1 -1
  30. package/dist/esm/library-style.js +1 -1
  31. package/dist/esm/nextcloud-vue.css +191 -145
  32. package/dist/esm/utils/builtInFormatters.js +53 -1
  33. package/dist/esm/utils/builtInFormatters.js.map +1 -1
  34. package/dist/esm/utils/objectParties.js +30 -1
  35. package/dist/esm/utils/objectParties.js.map +1 -1
  36. package/dist/esm/utils/validateManifestV2.compiled.js +3 -3
  37. package/dist/esm/utils/validateManifestV2.compiled.js.map +1 -1
  38. package/dist/nextcloud-vue.cjs.js +1548 -1296
  39. package/dist/nextcloud-vue.cjs.js.map +2 -2
  40. package/dist/nextcloud-vue.css +191 -145
  41. package/l10n/en.json +2 -1
  42. package/l10n/nl.json +2 -1
  43. package/package.json +1 -1
  44. package/src/components/CnDetailPage/CnDetailPage.md +1 -1
  45. package/src/components/CnDetailPage/CnDetailPage.vue +73 -10
  46. package/src/components/CnFactsWidget/CnFactsWidget.vue +101 -9
  47. package/src/components/CnObjectDataWidget/CnObjectDataWidget.md +1 -1
  48. package/src/components/CnObjectDataWidget/CnObjectDataWidget.vue +8 -0
  49. package/src/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue +2 -1
  50. package/src/components/CnStepper/CnStepper.vue +10 -2
  51. package/src/css/dialog.css +5 -2
  52. package/src/css/look-board-index.css +14 -0
  53. package/src/css/look-board.css +3 -0
  54. package/src/dialogs/CnAccessPurposeDialog.vue +27 -12
  55. package/src/schemas/app-manifest-v2.schema.json +4 -2
  56. package/src/utils/builtInFormatters.js +52 -0
  57. package/src/utils/objectParties.js +29 -0
  58. package/src/utils/validateManifestV2.compiled.js +3 -3
@@ -3,7 +3,7 @@ export { FACTS_REVEAL_CHANNEL } from './CnFactsWidget.vue2.js';
3
3
  import { render } from './CnFactsWidget.vue3.js';
4
4
 
5
5
  script.render = render;
6
- script.__scopeId = "data-v-2903e476";
6
+ script.__scopeId = "data-v-48761b13";
7
7
  const __sfc_main = script;
8
8
 
9
9
  export { __sfc_main as default };
@@ -15,6 +15,7 @@ import { useRefLabels } from '../../composables/useRefLabels.js';
15
15
  import { dispatchAction } from '../../utils/actionsDispatcher.js';
16
16
  import { isBadgeVariant } from '../../utils/badgeVariants.js';
17
17
  import { formatBoardDate } from '../../utils/boardDate.js';
18
+ import { formatTermDuration } from '../../utils/builtInFormatters.js';
18
19
  import { conditionalLine } from '../../utils/conditionalLine.js';
19
20
  import { parseDateValue } from '../../utils/dateVariant.js';
20
21
  import { fetchListTotal } from '../../utils/fetchFilterCounts.js';
@@ -64,6 +65,30 @@ function resolveSourceTokens(value, record) {
64
65
  }
65
66
 
66
67
  /** Kinds of entry a `fields[]` item can be. A labelled item without `as` is a row. */
68
+ /**
69
+ * Two or more pills in a row become one `pills` block, drawn on one line.
70
+ *
71
+ * @param {Array<object>} blocks The blocks in order.
72
+ * @return {Array<object>}
73
+ * @spec openspec/changes/facts-fields-from-context/specs/facts-widget/spec.md#requirement-a-facts-card-can-take-its-entries-from-the-page-context
74
+ */
75
+ function groupPills(blocks) {
76
+ const out = [];
77
+ blocks.forEach((block) => {
78
+ const last = out[out.length - 1];
79
+ if (block.kind !== 'pill') {
80
+ out.push(block);
81
+ } else if (last && last.kind === 'pills') {
82
+ last.pills.push(block);
83
+ } else if (last && last.kind === 'pill') {
84
+ out[out.length - 1] = { kind: 'pills', key: `pills-${last.key}`, pills: [last, block] };
85
+ } else {
86
+ out.push(block);
87
+ }
88
+ });
89
+ return out
90
+ }
91
+
67
92
  const KINDS = Object.freeze(['row', 'title', 'line', 'pill', 'lead', 'text', 'meter', 'progress']);
68
93
 
69
94
  /** The schemes a facts link opens, besides a path on this server. */
@@ -204,15 +229,17 @@ var script = {
204
229
  * `resolve: { register, schema, labelField? }` on an entry or a part turns a value that is a reference (an id, or a list of ids) into the label of the referenced object (`labelField`, else `title`, then `name`): the case type or status of a task shows its name, not its uuid. The ids are fetched once per register and schema through the object store and shared by every facts widget on the page; the entry stays empty until its label is known, and when no label can be read. A resolved value works as a pill too: `map` is applied to the resolved label, and `variantMap` / `colorMap` look the tone up by the value of `resolve.toneField` on the referenced object when that is set (a status named by its `name`, coloured by its `state`), then by the resolved label, then by the stored value.
205
230
  * `route` (`{ name, params?, query? }`, `@source.<path>` in a param) on a `title` or a `row` links its value to that route; a param that does not fill leaves it plain.
206
231
  * `format: 'user'` shows a Nextcloud user id as the user's display name, read once per id; the entry stays empty until the name is known.
207
- * `template` ("{available} {unit}") fills its `{path}` placeholders from the record instead of reading `path`; it is empty when every placeholder is. `suffix` (" kg") is added to a value that is not empty, its words translated.
232
+ * `template` ("{available} {unit}") fills its `{path}` placeholders from the record instead of reading `path` (`{path:format}` formats one, "{from:year}"); it is empty when every placeholder is. `suffix` (" kg") is added to a value that is not empty, its words translated.
208
233
  * `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.
209
234
  * `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").
210
235
  * - `action` — an action drawn as a button under the facts; `headerAction` — one drawn in the card header (reported through the `header` event).
211
236
  * - `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.
237
+ * - `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`.
212
238
  * - `rowsPath` — a path to a list of `{ label, value }` the record holds, drawn as rows after `fields` (a preview the server builds).
213
239
  * - `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.
214
240
  * - `notice` — `{ text, variant? }`, a note band inside the card under the facts (`info` by default; `success`, `warning` or `error`); the text is translated.
215
- * `format` is `text` (default), `date` (board short date), `date-long` (always with the year), `longdate` (the month written out, the year only outside this year: "3 oktober"), `list` (an array joined by ", ", each item read at `itemPath` and written in `itemFormat`), `group` (a Nextcloud group by its display name), `bytes` (a size, "1.5 MB"), `number` (in the reader's language, `decimals` fraction digits when set), `months` (a number of months in words, whole years as years: 240 is "20 jaar") or `currency` (a money amount in the reader's language, "€ 1.234,50": the code in `currency`, else the record's `currencyField`, else the app's reporting currency, else EUR; `decimals` defaults to 2).
241
+ * - `footnote` — a plain muted line under the facts, without a band (DqZaakBesluiten "Na het ondertekenen ..."); the text is translated.
242
+ * `format` is `text` (default), `date` (board short date), `date-long` (always with the year), `longdate` (the month written out, the year only outside this year: "3 oktober"), `duration` (an ISO period in words, "4 weken"; `extendBy` names the extension period on the record: "4 weken, te verdagen met 2"), `year` ("2026"), `list` (an array joined by ", ", each item read at `itemPath` and written in `itemFormat`), `group` (a Nextcloud group by its display name), `bytes` (a size, "1.5 MB"), `number` (in the reader's language, `decimals` fraction digits when set), `months` (a number of months in words, whole years as years: 240 is "20 jaar") or `currency` (a money amount in the reader's language, "€ 1.234,50": the code in `currency`, else the record's `currencyField`, else the app's reporting currency, else EUR; `decimals` defaults to 2).
216
243
  * `map` turns a raw value into a label (translated). `parts` (on a `line`) lists paths, or `{ path, label?, format? }`, joined by `separator` (default " · "); empty parts are dropped.
217
244
  * - `source` — `{ register, schema, id }` or `{ url }`; omitted = the current object. `{ register, schema, filter, sort? }` without `id` reads the first object that matches `filter` in `sort` order (`{ field, dir }`): the latest count of a shift. An entry with `from: "object"` reads the current object even then (a client card that also shows the ticket's channel).
218
245
  * - `endpointSource` — `{ url, method?, params?, responsePath? }`, the block a stat or chart takes: the facts read an app endpoint, shared and cached like those.
@@ -271,6 +298,29 @@ var script = {
271
298
  },
272
299
 
273
300
  computed: {
301
+ /**
302
+ * The entries to draw: the list `fieldsFrom` names on the page's
303
+ * `@context` records when it holds entries (a case type's
304
+ * `requestFields`), else `fields`.
305
+ *
306
+ * @return {Array<object>}
307
+ * @spec openspec/changes/facts-fields-from-context/specs/facts-widget/spec.md#requirement-a-facts-card-can-take-its-entries-from-the-page-context
308
+ */
309
+ entries() {
310
+ const from = this.content?.fieldsFrom;
311
+ if (typeof from === 'string' && from.startsWith('@context.')) {
312
+ const rows = this.cnDetailVisibilityRows && typeof this.cnDetailVisibilityRows === 'object' && 'value' in this.cnDetailVisibilityRows
313
+ ? this.cnDetailVisibilityRows.value
314
+ : this.cnDetailVisibilityRows;
315
+ const named = readPath({ '@context': rows || {} }, from);
316
+ const list = Array.isArray(named) ? named.filter((entry) => entry && typeof entry === 'object' && !Array.isArray(entry)) : [];
317
+ if (list.length > 0) {
318
+ return list
319
+ }
320
+ }
321
+ return Array.isArray(this.content?.fields) ? this.content.fields : []
322
+ },
323
+
274
324
  /**
275
325
  * Whether the rows sit in two columns, label above value.
276
326
  *
@@ -315,7 +365,7 @@ var script = {
315
365
  * @spec openspec/changes/facts-entry-count/specs/facts-widget/spec.md#requirement-a-facts-entry-can-count-a-related-list
316
366
  */
317
367
  countJobsKey() {
318
- const fields = Array.isArray(this.content?.fields) ? this.content.fields : [];
368
+ const fields = this.entries;
319
369
  const keys = fields
320
370
  .filter((field) => field && field.countFrom && typeof field.countFrom === 'object' && field.countFrom.register && field.countFrom.schema)
321
371
  .map((field) => this.countKey(field.countFrom));
@@ -476,7 +526,7 @@ var script = {
476
526
  */
477
527
  blocks() {
478
528
  const sourceRecord = this.record;
479
- const fields = Array.isArray(this.content?.fields) ? this.content.fields : [];
529
+ const fields = this.entries;
480
530
  // A source that finds nothing still leaves the entries that read the
481
531
  // page's own object (`from: "object"`).
482
532
  const ownEntries = Boolean(this.objectData) && fields.some((field) => field && field.from === 'object');
@@ -555,7 +605,7 @@ var script = {
555
605
  out.push({ kind: 'rows', key: 'rows-answered', rows: [row] });
556
606
  }
557
607
  });
558
- return out
608
+ return groupPills(out)
559
609
  },
560
610
 
561
611
  /**
@@ -647,6 +697,12 @@ var script = {
647
697
  return { text, type: ['success', 'warning', 'error'].includes(notice.variant) ? notice.variant : 'info' }
648
698
  },
649
699
 
700
+ /** @return {string} The translated footnote, or '' when none is set. */
701
+ footnote() {
702
+ const footnote = this.content?.footnote;
703
+ return typeof footnote === 'string' && footnote.trim() !== '' ? this.tr(footnote) : ''
704
+ },
705
+
650
706
  /** @return {string} The reveal button's text. */
651
707
  showLabel() {
652
708
  return translate('nextcloud-vue', 'Show')
@@ -884,7 +940,7 @@ var script = {
884
940
  * @spec openspec/changes/facts-entry-count/specs/facts-widget/spec.md#requirement-a-facts-entry-can-count-a-related-list
885
941
  */
886
942
  async loadCounts() {
887
- const fields = Array.isArray(this.content?.fields) ? this.content.fields : [];
943
+ const fields = this.entries;
888
944
  const seen = new Set();
889
945
  for (const field of fields) {
890
946
  const countFrom = field && field.countFrom;
@@ -961,8 +1017,8 @@ var script = {
961
1017
  */
962
1018
  templateValue(record, template) {
963
1019
  let filled = false;
964
- const text = this.tr(template).replace(/\{([\w.@]+)\}/g, (match, path) => {
965
- const value = this.format(readPath(record, path), {}, record);
1020
+ const text = this.tr(template).replace(/\{([\w.@]+)(?::([\w-]+))?\}/g, (match, path, format) => {
1021
+ const value = this.format(readPath(record, path), format ? { format } : {}, record);
966
1022
  filled = filled || value !== '';
967
1023
  return value
968
1024
  });
@@ -1354,7 +1410,7 @@ var script = {
1354
1410
  * @return {Array<{spec: object, raw: unknown}>}
1355
1411
  */
1356
1412
  refSpecs(record) {
1357
- const fields = Array.isArray(this.content?.fields) ? this.content.fields : [];
1413
+ const fields = this.entries;
1358
1414
  const specs = [];
1359
1415
  const visit = (spec) => {
1360
1416
  if (!spec || typeof spec !== 'object') {
@@ -1587,6 +1643,14 @@ var script = {
1587
1643
  .filter((item) => item !== '');
1588
1644
  return items.join(', ')
1589
1645
  }
1646
+ if (format === 'year') {
1647
+ const date = parseDateValue(raw);
1648
+ return date === null ? '' : String(date.getFullYear())
1649
+ }
1650
+ // A term in words, with the extension at `extendBy` on the record: "4 weken, te verdagen met 2".
1651
+ if (format === 'duration') {
1652
+ return formatTermDuration(raw, typeof spec.extendBy === 'string' && record ? readPath(record, spec.extendBy) : null)
1653
+ }
1590
1654
  // The month written out, the year only outside this year: "3 oktober".
1591
1655
  if (format === 'longdate') {
1592
1656
  return formatLongDate(raw)