@conduction/nextcloud-vue 2.146.0 → 2.147.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/CnFactsWidget/CnFactsWidget.vue.js +1 -1
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue2.js +68 -9
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue3.js +37 -13
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue.js +1 -1
- package/dist/esm/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue2.js +2 -2
- package/dist/esm/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue3.js.map +1 -1
- package/dist/esm/library-style.js +1 -1
- package/dist/esm/nextcloud-vue.css +83 -71
- package/dist/esm/utils/objectParties.js +30 -1
- package/dist/esm/utils/objectParties.js.map +1 -1
- package/dist/nextcloud-vue.cjs.js +193 -81
- package/dist/nextcloud-vue.cjs.js.map +2 -2
- package/dist/nextcloud-vue.css +83 -71
- package/package.json +1 -1
- package/src/components/CnFactsWidget/CnFactsWidget.vue +96 -9
- package/src/components/CnObjectPartiesWidget/CnObjectPartiesWidget.vue +2 -1
- package/src/utils/objectParties.js +29 -0
|
@@ -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-
|
|
6
|
+
script.__scopeId = "data-v-6351bc64";
|
|
7
7
|
const __sfc_main = script;
|
|
8
8
|
|
|
9
9
|
export { __sfc_main as default };
|
|
@@ -64,6 +64,30 @@ function resolveSourceTokens(value, record) {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
/** Kinds of entry a `fields[]` item can be. A labelled item without `as` is a row. */
|
|
67
|
+
/**
|
|
68
|
+
* Two or more pills in a row become one `pills` block, drawn on one line.
|
|
69
|
+
*
|
|
70
|
+
* @param {Array<object>} blocks The blocks in order.
|
|
71
|
+
* @return {Array<object>}
|
|
72
|
+
* @spec openspec/changes/facts-fields-from-context/specs/facts-widget/spec.md#requirement-a-facts-card-can-take-its-entries-from-the-page-context
|
|
73
|
+
*/
|
|
74
|
+
function groupPills(blocks) {
|
|
75
|
+
const out = [];
|
|
76
|
+
blocks.forEach((block) => {
|
|
77
|
+
const last = out[out.length - 1];
|
|
78
|
+
if (block.kind !== 'pill') {
|
|
79
|
+
out.push(block);
|
|
80
|
+
} else if (last && last.kind === 'pills') {
|
|
81
|
+
last.pills.push(block);
|
|
82
|
+
} else if (last && last.kind === 'pill') {
|
|
83
|
+
out[out.length - 1] = { kind: 'pills', key: `pills-${last.key}`, pills: [last, block] };
|
|
84
|
+
} else {
|
|
85
|
+
out.push(block);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
return out
|
|
89
|
+
}
|
|
90
|
+
|
|
67
91
|
const KINDS = Object.freeze(['row', 'title', 'line', 'pill', 'lead', 'text', 'meter', 'progress']);
|
|
68
92
|
|
|
69
93
|
/** The schemes a facts link opens, besides a path on this server. */
|
|
@@ -204,15 +228,17 @@ var script = {
|
|
|
204
228
|
* `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
229
|
* `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
230
|
* `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
|
|
231
|
+
* `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
232
|
* `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
233
|
* `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
234
|
* - `action` — an action drawn as a button under the facts; `headerAction` — one drawn in the card header (reported through the `header` event).
|
|
211
235
|
* - `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.
|
|
236
|
+
* - `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
237
|
* - `rowsPath` — a path to a list of `{ label, value }` the record holds, drawn as rows after `fields` (a preview the server builds).
|
|
213
238
|
* - `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
239
|
* - `notice` — `{ text, variant? }`, a note band inside the card under the facts (`info` by default; `success`, `warning` or `error`); the text is translated.
|
|
215
|
-
*
|
|
240
|
+
* - `footnote` — a plain muted line under the facts, without a band (DqZaakBesluiten "Na het ondertekenen ..."); the text is translated.
|
|
241
|
+
* `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"), `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
242
|
* `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
243
|
* - `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
244
|
* - `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 +297,29 @@ var script = {
|
|
|
271
297
|
},
|
|
272
298
|
|
|
273
299
|
computed: {
|
|
300
|
+
/**
|
|
301
|
+
* The entries to draw: the list `fieldsFrom` names on the page's
|
|
302
|
+
* `@context` records when it holds entries (a case type's
|
|
303
|
+
* `requestFields`), else `fields`.
|
|
304
|
+
*
|
|
305
|
+
* @return {Array<object>}
|
|
306
|
+
* @spec openspec/changes/facts-fields-from-context/specs/facts-widget/spec.md#requirement-a-facts-card-can-take-its-entries-from-the-page-context
|
|
307
|
+
*/
|
|
308
|
+
entries() {
|
|
309
|
+
const from = this.content?.fieldsFrom;
|
|
310
|
+
if (typeof from === 'string' && from.startsWith('@context.')) {
|
|
311
|
+
const rows = this.cnDetailVisibilityRows && typeof this.cnDetailVisibilityRows === 'object' && 'value' in this.cnDetailVisibilityRows
|
|
312
|
+
? this.cnDetailVisibilityRows.value
|
|
313
|
+
: this.cnDetailVisibilityRows;
|
|
314
|
+
const named = readPath({ '@context': rows || {} }, from);
|
|
315
|
+
const list = Array.isArray(named) ? named.filter((entry) => entry && typeof entry === 'object' && !Array.isArray(entry)) : [];
|
|
316
|
+
if (list.length > 0) {
|
|
317
|
+
return list
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
return Array.isArray(this.content?.fields) ? this.content.fields : []
|
|
321
|
+
},
|
|
322
|
+
|
|
274
323
|
/**
|
|
275
324
|
* Whether the rows sit in two columns, label above value.
|
|
276
325
|
*
|
|
@@ -315,7 +364,7 @@ var script = {
|
|
|
315
364
|
* @spec openspec/changes/facts-entry-count/specs/facts-widget/spec.md#requirement-a-facts-entry-can-count-a-related-list
|
|
316
365
|
*/
|
|
317
366
|
countJobsKey() {
|
|
318
|
-
const fields =
|
|
367
|
+
const fields = this.entries;
|
|
319
368
|
const keys = fields
|
|
320
369
|
.filter((field) => field && field.countFrom && typeof field.countFrom === 'object' && field.countFrom.register && field.countFrom.schema)
|
|
321
370
|
.map((field) => this.countKey(field.countFrom));
|
|
@@ -476,7 +525,7 @@ var script = {
|
|
|
476
525
|
*/
|
|
477
526
|
blocks() {
|
|
478
527
|
const sourceRecord = this.record;
|
|
479
|
-
const fields =
|
|
528
|
+
const fields = this.entries;
|
|
480
529
|
// A source that finds nothing still leaves the entries that read the
|
|
481
530
|
// page's own object (`from: "object"`).
|
|
482
531
|
const ownEntries = Boolean(this.objectData) && fields.some((field) => field && field.from === 'object');
|
|
@@ -555,7 +604,7 @@ var script = {
|
|
|
555
604
|
out.push({ kind: 'rows', key: 'rows-answered', rows: [row] });
|
|
556
605
|
}
|
|
557
606
|
});
|
|
558
|
-
return out
|
|
607
|
+
return groupPills(out)
|
|
559
608
|
},
|
|
560
609
|
|
|
561
610
|
/**
|
|
@@ -647,6 +696,12 @@ var script = {
|
|
|
647
696
|
return { text, type: ['success', 'warning', 'error'].includes(notice.variant) ? notice.variant : 'info' }
|
|
648
697
|
},
|
|
649
698
|
|
|
699
|
+
/** @return {string} The translated footnote, or '' when none is set. */
|
|
700
|
+
footnote() {
|
|
701
|
+
const footnote = this.content?.footnote;
|
|
702
|
+
return typeof footnote === 'string' && footnote.trim() !== '' ? this.tr(footnote) : ''
|
|
703
|
+
},
|
|
704
|
+
|
|
650
705
|
/** @return {string} The reveal button's text. */
|
|
651
706
|
showLabel() {
|
|
652
707
|
return translate('nextcloud-vue', 'Show')
|
|
@@ -884,7 +939,7 @@ var script = {
|
|
|
884
939
|
* @spec openspec/changes/facts-entry-count/specs/facts-widget/spec.md#requirement-a-facts-entry-can-count-a-related-list
|
|
885
940
|
*/
|
|
886
941
|
async loadCounts() {
|
|
887
|
-
const fields =
|
|
942
|
+
const fields = this.entries;
|
|
888
943
|
const seen = new Set();
|
|
889
944
|
for (const field of fields) {
|
|
890
945
|
const countFrom = field && field.countFrom;
|
|
@@ -961,8 +1016,8 @@ var script = {
|
|
|
961
1016
|
*/
|
|
962
1017
|
templateValue(record, template) {
|
|
963
1018
|
let filled = false;
|
|
964
|
-
const text = this.tr(template).replace(/\{([\w.@]+)\}/g, (match, path) => {
|
|
965
|
-
const value = this.format(readPath(record, path), {}, record);
|
|
1019
|
+
const text = this.tr(template).replace(/\{([\w.@]+)(?::([\w-]+))?\}/g, (match, path, format) => {
|
|
1020
|
+
const value = this.format(readPath(record, path), format ? { format } : {}, record);
|
|
966
1021
|
filled = filled || value !== '';
|
|
967
1022
|
return value
|
|
968
1023
|
});
|
|
@@ -1354,7 +1409,7 @@ var script = {
|
|
|
1354
1409
|
* @return {Array<{spec: object, raw: unknown}>}
|
|
1355
1410
|
*/
|
|
1356
1411
|
refSpecs(record) {
|
|
1357
|
-
const fields =
|
|
1412
|
+
const fields = this.entries;
|
|
1358
1413
|
const specs = [];
|
|
1359
1414
|
const visit = (spec) => {
|
|
1360
1415
|
if (!spec || typeof spec !== 'object') {
|
|
@@ -1587,6 +1642,10 @@ var script = {
|
|
|
1587
1642
|
.filter((item) => item !== '');
|
|
1588
1643
|
return items.join(', ')
|
|
1589
1644
|
}
|
|
1645
|
+
if (format === 'year') {
|
|
1646
|
+
const date = parseDateValue(raw);
|
|
1647
|
+
return date === null ? '' : String(date.getFullYear())
|
|
1648
|
+
}
|
|
1590
1649
|
// The month written out, the year only outside this year: "3 oktober".
|
|
1591
1650
|
if (format === 'longdate') {
|
|
1592
1651
|
return formatLongDate(raw)
|