@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
@@ -524,6 +524,57 @@ export function formatIsoDuration(value) {
524
524
  return words[period.unit] ? words[period.unit]() : String(value)
525
525
  }
526
526
 
527
+ /** The ISO designator of each date unit a term is written in. */
528
+ const UNIT_DESIGNATOR = { years: 'Y', months: 'M', weeks: 'W', days: 'D' }
529
+
530
+ /**
531
+ * A one-unit ISO-8601 period, a day count that is whole weeks read as weeks
532
+ * (a term of `P28D` is "4 weeks"); null when it is not a one-unit period.
533
+ *
534
+ * @param {unknown} value The stored period.
535
+ * @return {{amount: number, unit: string}|null}
536
+ */
537
+ function termPeriod(value) {
538
+ if (value === null || value === undefined || value === '') {
539
+ return null
540
+ }
541
+ const period = parseDuration(String(value))
542
+ if (period === null || !UNIT_DESIGNATOR[period.unit]) {
543
+ return null
544
+ }
545
+ if (period.unit === 'days' && period.amount > 0 && period.amount % 7 === 0) {
546
+ return { amount: period.amount / 7, unit: 'weeks' }
547
+ }
548
+ return period
549
+ }
550
+
551
+ /**
552
+ * A term in words, with the extension it may get (`format: 'duration'`):
553
+ * `P28D` reads "4 weeks", and with an extension of `P14D` "4 weeks,
554
+ * extendable by 2" (the unit is said once when both share it). A value that
555
+ * is not a one-unit period is returned as written, '' for null or empty.
556
+ *
557
+ * @spec openspec/changes/data-widget-duration-format/specs/data-widget/spec.md#requirement-a-term-reads-in-words-with-its-extension
558
+ * @param {unknown} value The stored term.
559
+ * @param {unknown} [extension] The stored extension period, if any.
560
+ * @return {string}
561
+ */
562
+ export function formatTermDuration(value, extension = null) {
563
+ const term = termPeriod(value)
564
+ if (term === null) {
565
+ return value === null || value === undefined ? '' : String(value)
566
+ }
567
+ const words = formatIsoDuration(`P${term.amount}${UNIT_DESIGNATOR[term.unit]}`)
568
+ const extra = termPeriod(extension)
569
+ if (extra === null || extra.amount === 0) {
570
+ return words
571
+ }
572
+ const extraWords = extra.unit === term.unit
573
+ ? String(extra.amount)
574
+ : formatIsoDuration(`P${extra.amount}${UNIT_DESIGNATOR[extra.unit]}`)
575
+ return t('nextcloud-vue', '{term}, extendable by {extension}', { term: words, extension: extraWords })
576
+ }
577
+
527
578
  /**
528
579
  * A Nextcloud user id as its display name (`userName` registry key): the id
529
580
  * while the name is looked up, and for a user nobody answers for.
@@ -553,6 +604,7 @@ export const BUILT_IN_FORMATTERS = {
553
604
  connectionSettingsLabel: formatConnectionSettingsLabel,
554
605
  masked: formatMasked,
555
606
  isoDuration: formatIsoDuration,
607
+ termDuration: formatTermDuration,
556
608
  valueMap: formatValueMap,
557
609
  userName: formatUserName,
558
610
  }
@@ -176,6 +176,35 @@ export function kindCode(kind) {
176
176
  return String(kind?.code || kind?.key || '')
177
177
  }
178
178
 
179
+ /**
180
+ * Whether a party's kind is among the kinds a record accepts. Two
181
+ * vocabularies meet here: the party's kind is its schema's (`person`,
182
+ * `organisation`, `colleague`), while the accepted kinds may be role kinds
183
+ * that name the identity shapes they take (pipelinq's `aanvrager` with
184
+ * `identityShapes: ["naturalPerson", "organization"]`). When the accepted
185
+ * kinds name shapes, the party's own kind is matched by the shapes the
186
+ * listing gives it; a kind that names none cannot be judged and passes.
187
+ * Otherwise the codes are compared.
188
+ *
189
+ * @param {string} partyKind The party's kind key.
190
+ * @param {Array<object>} accepted The accepted kinds.
191
+ * @param {Array<object>} own The listing's own kinds (`{ key, identityShapes? }`).
192
+ * @return {boolean} False only when the party is known not to fit.
193
+ * @spec openspec/changes/parties-accepted-kinds-by-shape/specs/object-parties/spec.md#requirement-a-party-is-checked-against-the-accepted-kinds-in-one-vocabulary
194
+ */
195
+ export function partyKindAccepted(partyKind, accepted, own) {
196
+ const kinds = Array.isArray(accepted) ? accepted : []
197
+ const shapes = new Set(kinds.flatMap((kind) => (Array.isArray(kind?.identityShapes) ? kind.identityShapes : [])))
198
+ if (shapes.size === 0) {
199
+ return kinds.some((kind) => kindCode(kind) === partyKind)
200
+ }
201
+ const mine = (Array.isArray(own) ? own : []).find((kind) => kindCode(kind) === partyKind)?.identityShapes
202
+ if (!Array.isArray(mine) || mine.length === 0) {
203
+ return true
204
+ }
205
+ return mine.some((shape) => shapes.has(shape))
206
+ }
207
+
179
208
  /**
180
209
  * Write a value at a dotted path, creating the objects on the way.
181
210
  *