@conduction/nextcloud-vue 2.64.0 → 2.65.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 (51) hide show
  1. package/dist/esm/components/CnAppNav/CnAppNav.vue2.js +99 -3
  2. package/dist/esm/components/CnAppNav/CnAppNav.vue2.js.map +1 -1
  3. package/dist/esm/components/CnAppNav/CnAppNav.vue3.js +23 -7
  4. package/dist/esm/components/CnAppNav/CnAppNav.vue3.js.map +1 -1
  5. package/dist/esm/components/CnBreadcrumbs/CnBreadcrumbs.vue2.js +13 -0
  6. package/dist/esm/components/CnBreadcrumbs/CnBreadcrumbs.vue2.js.map +1 -1
  7. package/dist/esm/components/CnBreadcrumbs/CnBreadcrumbs.vue3.js +2 -1
  8. package/dist/esm/components/CnBreadcrumbs/CnBreadcrumbs.vue3.js.map +1 -1
  9. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue2.js +26 -2
  10. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue2.js.map +1 -1
  11. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue3.js +6 -3
  12. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue3.js.map +1 -1
  13. package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js +64 -5
  14. package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js.map +1 -1
  15. package/dist/esm/components/CnDetailPage/CnDetailPage.vue3.js +66 -28
  16. package/dist/esm/components/CnDetailPage/CnDetailPage.vue3.js.map +1 -1
  17. package/dist/esm/components/CnHeaderWidget/CnHeaderWidget.vue2.js +22 -5
  18. package/dist/esm/components/CnHeaderWidget/CnHeaderWidget.vue2.js.map +1 -1
  19. package/dist/esm/components/CnHeaderWidget/CnHeaderWidget.vue3.js +1 -1
  20. package/dist/esm/components/CnHeaderWidget/CnHeaderWidget.vue3.js.map +1 -1
  21. package/dist/esm/components/CnStagesWidget/CnStagesWidget.vue2.js.map +1 -1
  22. package/dist/esm/components/CnStagesWidget/CnStagesWidget.vue3.js.map +1 -1
  23. package/dist/esm/components/CnStatWidget/CnStatWidget.vue2.js +22 -3
  24. package/dist/esm/components/CnStatWidget/CnStatWidget.vue2.js.map +1 -1
  25. package/dist/esm/components/CnStatWidget/CnStatWidget.vue3.js +10 -3
  26. package/dist/esm/components/CnStatWidget/CnStatWidget.vue3.js.map +1 -1
  27. package/dist/esm/nextcloud-vue.css +164 -0
  28. package/dist/esm/store/useObjectStore.js +118 -33
  29. package/dist/esm/store/useObjectStore.js.map +1 -1
  30. package/dist/esm/utils/actionsDispatcher.js +14 -0
  31. package/dist/esm/utils/actionsDispatcher.js.map +1 -1
  32. package/dist/esm/utils/validateManifestV2.compiled.js +2 -2
  33. package/dist/esm/utils/validateManifestV2.compiled.js.map +1 -1
  34. package/dist/nextcloud-vue.cjs.js +488 -96
  35. package/dist/nextcloud-vue.cjs.js.map +2 -2
  36. package/dist/nextcloud-vue.css +164 -0
  37. package/package.json +1 -1
  38. package/src/components/CnAppNav/CnAppNav.vue +148 -7
  39. package/src/components/CnBreadcrumbs/CnBreadcrumbs.vue +14 -0
  40. package/src/components/CnDashboardPage/CnDashboardPage.vue +29 -2
  41. package/src/components/CnDetailPage/CnDetailPage.md +5 -1
  42. package/src/components/CnDetailPage/CnDetailPage.vue +114 -6
  43. package/src/components/CnHeaderWidget/CnHeaderWidget.vue +34 -6
  44. package/src/components/CnStagesWidget/CnStagesWidget.vue +9 -0
  45. package/src/components/CnStatWidget/CnStatWidget.vue +33 -5
  46. package/src/css/detail-page.css +22 -0
  47. package/src/css/kpi-card.css +47 -0
  48. package/src/schemas/app-manifest-v2.schema.json +23 -2
  49. package/src/store/useObjectStore.js +118 -33
  50. package/src/utils/actionsDispatcher.js +14 -0
  51. package/src/utils/validateManifestV2.compiled.js +2 -2
@@ -264,6 +264,27 @@ const baseActions = {
264
264
  this.facets = { ...this.facets, [slug]: {} }
265
265
  },
266
266
 
267
+ /**
268
+ * Give a registered type a second schema path segment to try once when
269
+ * its own answers 404 (see `_fetchWithSchemaFallback`). Set by
270
+ * `resolveObjectOpType` for a schema title it kebab-cased, with the
271
+ * title as written. A type that is not registered is left alone.
272
+ *
273
+ * @spec openspec/changes/zuiddrecht-pixel-gaps-2/specs/zuiddrecht-pixel-gaps-2/spec.md#requirement-a-schema-title-falls-back-to-its-written-form
274
+ * @param {string} slug The type slug
275
+ * @param {string} schema The fallback schema path segment
276
+ */
277
+ setSchemaFallback(slug, schema) {
278
+ const config = this.objectTypeRegistry[slug]
279
+ if (!config || typeof schema !== 'string' || schema === '') {
280
+ return
281
+ }
282
+ this.objectTypeRegistry = {
283
+ ...this.objectTypeRegistry,
284
+ [slug]: { ...config, schemaFallback: schema },
285
+ }
286
+ },
287
+
267
288
  /**
268
289
  * Unregister an object type and clean up all its state.
269
290
  *
@@ -433,11 +454,12 @@ const baseActions = {
433
454
  *
434
455
  * @param {string} type The type slug
435
456
  * @param {string|null} [id] Optional object ID
457
+ * @param {string|null} [schema] Schema path segment to use instead of the type's own
436
458
  * @return {string} Full API URL path
437
459
  */
438
- _buildUrl(type, id = null) {
460
+ _buildUrl(type, id = null, schema = null) {
439
461
  const config = this._getTypeConfig(type)
440
- let url = `${this._options.baseUrl}/${config.register}/${config.schema}`
462
+ let url = `${this._options.baseUrl}/${config.register}/${schema ?? config.schema}`
441
463
  if (id) {
442
464
  url += `/${id}`
443
465
  }
@@ -458,11 +480,12 @@ const baseActions = {
458
480
  * @param {string} type The type slug
459
481
  * @param {object} [params] Extra query parameters
460
482
  * @param {string|null} [id] Optional object ID
483
+ * @param {string|null} [schema] Schema path segment to use instead of the type's own
461
484
  * @return {string} Full API URL path including query string
462
485
  */
463
- _buildUrlWithParams(type, params = {}, id = null) {
486
+ _buildUrlWithParams(type, params = {}, id = null, schema = null) {
464
487
  const config = this._getTypeConfig(type)
465
- let url = `${this._options.baseUrl}/${config.register}/${config.schema}`
488
+ let url = `${this._options.baseUrl}/${config.register}/${schema ?? config.schema}`
466
489
  if (id) {
467
490
  url += `/${id}`
468
491
  }
@@ -472,6 +495,54 @@ const baseActions = {
472
495
  return url
473
496
  },
474
497
 
498
+ /**
499
+ * Fetch for a type, retrying ONCE with its `schemaFallback` when the
500
+ * schema path segment answers 404. A type without a fallback (every type
501
+ * not registered by `resolveObjectOpType` for a kebab-cased title) makes
502
+ * exactly the one request it always made. When the retry succeeds the
503
+ * fallback becomes the type's schema, so later calls go straight to it;
504
+ * when it does not, the first answer is returned and nothing changes.
505
+ *
506
+ * @spec openspec/changes/zuiddrecht-pixel-gaps-2/specs/zuiddrecht-pixel-gaps-2/spec.md#requirement-a-schema-title-falls-back-to-its-written-form
507
+ * @param {string} type The type slug
508
+ * @param {function((string|null)): string} makeUrl Builds the URL; called with
509
+ * null for the type's own schema, or with the fallback segment.
510
+ * @param {object} init The fetch options.
511
+ * @return {Promise<Response>} The response to use.
512
+ */
513
+ async _fetchWithSchemaFallback(type, makeUrl, init) {
514
+ // `makeUrl` wraps `_buildUrl` / `_buildUrlWithParams`, so `url` is built
515
+ // from the prefixed `_options.baseUrl` like every other request here.
516
+ let url = makeUrl(null)
517
+ const response = await fetch(url, init)
518
+ if (!response || response.status !== 404) {
519
+ return response
520
+ }
521
+ const config = this.objectTypeRegistry[type]
522
+ const fallback = config && config.schemaFallback
523
+ if (!fallback || String(fallback) === String(config.schema)) {
524
+ return response
525
+ }
526
+ let retry
527
+ try {
528
+ url = makeUrl(fallback)
529
+ retry = await fetch(url, init)
530
+ } catch {
531
+ return response
532
+ }
533
+ if (!retry || !retry.ok) {
534
+ discardResponseBody(retry)
535
+ return response
536
+ }
537
+ discardResponseBody(response)
538
+ const { schemaFallback: _, ...rest } = config
539
+ this.objectTypeRegistry = {
540
+ ...this.objectTypeRegistry,
541
+ [type]: { ...rest, schema: fallback },
542
+ }
543
+ return retry
544
+ },
545
+
475
546
  /**
476
547
  * Clear the error state for a type.
477
548
  *
@@ -604,12 +675,14 @@ const baseActions = {
604
675
  }
605
676
  }
606
677
 
607
- const url = this._buildUrlWithParams(type, fetchParams)
608
-
609
- const response = await fetch(url, {
610
- method: 'GET',
611
- headers: this._buildHeaders(),
612
- })
678
+ const response = await this._fetchWithSchemaFallback(
679
+ type,
680
+ (schema) => this._buildUrlWithParams(type, fetchParams, null, schema),
681
+ {
682
+ method: 'GET',
683
+ headers: this._buildHeaders(),
684
+ },
685
+ )
613
686
 
614
687
  if (!response.ok) {
615
688
  this.errors = { ...this.errors, [type]: await parseResponseError(response, type) }
@@ -675,11 +748,14 @@ const baseActions = {
675
748
  */
676
749
  async fetchCollectionForOptions(type, params = {}) {
677
750
  try {
678
- const url = this._buildUrlWithParams(type, params)
679
- const response = await fetch(url, {
680
- method: 'GET',
681
- headers: this._buildHeaders(),
682
- })
751
+ const response = await this._fetchWithSchemaFallback(
752
+ type,
753
+ (schema) => this._buildUrlWithParams(type, params, null, schema),
754
+ {
755
+ method: 'GET',
756
+ headers: this._buildHeaders(),
757
+ },
758
+ )
683
759
 
684
760
  if (!response.ok) {
685
761
  discardResponseBody(response)
@@ -734,10 +810,14 @@ const baseActions = {
734
810
  this.errors = { ...this.errors, [type]: null }
735
811
 
736
812
  try {
737
- const response = await fetch(url, {
738
- method: 'GET',
739
- headers: this._buildHeaders(),
740
- })
813
+ const response = await this._fetchWithSchemaFallback(
814
+ type,
815
+ (schema) => (schema === null ? url : this._buildUrl(type, id, schema)),
816
+ {
817
+ method: 'GET',
818
+ headers: this._buildHeaders(),
819
+ },
820
+ )
741
821
 
742
822
  if (!response.ok) {
743
823
  this.errors = { ...this.errors, [type]: await parseResponseError(response, type) }
@@ -805,16 +885,19 @@ const baseActions = {
805
885
 
806
886
  try {
807
887
  const isUpdate = !!objectData.id
808
- const url = isUpdate
809
- ? this._buildUrl(type, objectData.id)
810
- : this._buildUrl(type)
811
888
  const method = isUpdate ? 'PUT' : 'POST'
812
889
 
813
- const response = await fetch(url, {
814
- method,
815
- headers: this._buildHeaders(),
816
- body: JSON.stringify(objectData),
817
- })
890
+ const response = await this._fetchWithSchemaFallback(
891
+ type,
892
+ (schema) => (isUpdate
893
+ ? this._buildUrl(type, objectData.id, schema)
894
+ : this._buildUrl(type, null, schema)),
895
+ {
896
+ method,
897
+ headers: this._buildHeaders(),
898
+ body: JSON.stringify(objectData),
899
+ },
900
+ )
818
901
 
819
902
  if (!response.ok) {
820
903
  this.errors = { ...this.errors, [type]: await parseResponseError(response, type) }
@@ -866,12 +949,14 @@ const baseActions = {
866
949
  this.errors = { ...this.errors, [type]: null }
867
950
 
868
951
  try {
869
- const url = this._buildUrl(type, id)
870
-
871
- const response = await fetch(url, {
872
- method: 'DELETE',
873
- headers: this._buildHeaders(),
874
- })
952
+ const response = await this._fetchWithSchemaFallback(
953
+ type,
954
+ (schema) => this._buildUrl(type, id, schema),
955
+ {
956
+ method: 'DELETE',
957
+ headers: this._buildHeaders(),
958
+ },
959
+ )
875
960
 
876
961
  if (!response.ok) {
877
962
  this.errors = { ...this.errors, [type]: await parseResponseError(response, type) }
@@ -100,6 +100,14 @@ export function isExternalActionTarget(target) {
100
100
  * would otherwise register — and fetch — a 404 (defect 7, learniq round
101
101
  * 1). Idempotent for a caller that already passes a correct slug.
102
102
  *
103
+ * A title is not always registered under its kebab form: learniq holds
104
+ * `LearniqSettings` and `SubjectTeacherAssignment` as written. So a type
105
+ * registered here for a value the kebab rule CHANGED also carries the value
106
+ * as written as its `schemaFallback`, and the store retries with it once
107
+ * when the kebab form answers 404 (keeping it from then on). The kebab form
108
+ * is still tried first, so a schema registered under it costs nothing.
109
+ *
110
+ * @spec openspec/changes/zuiddrecht-pixel-gaps-2/specs/zuiddrecht-pixel-gaps-2/spec.md#requirement-a-schema-title-falls-back-to-its-written-form
103
111
  * @param {object} store The object store instance (useObjectStore shape).
104
112
  * @param {{register: (string|number), schema: (string|number)}} source The widget source.
105
113
  * @return {string} The type slug to use for store CRUD calls.
@@ -107,6 +115,9 @@ export function isExternalActionTarget(target) {
107
115
  export function resolveObjectOpType(store, source) {
108
116
  const register = String(source.register)
109
117
  const schema = String(schemaRefSlug(source.schema))
118
+ const written = typeof source.schema === 'string'
119
+ ? source.schema.substring(source.schema.lastIndexOf('/') + 1)
120
+ : ''
110
121
  const registry = store.objectTypeRegistry || {}
111
122
  for (const [slug, config] of Object.entries(registry)) {
112
123
  if (!config) {
@@ -120,6 +131,9 @@ export function resolveObjectOpType(store, source) {
120
131
  const slug = `${register}/${schema}`
121
132
  if (!registry[slug]) {
122
133
  store.registerObjectType(slug, schema, register)
134
+ if (written !== '' && written !== schema && typeof store.setSchemaFallback === 'function') {
135
+ store.setSchemaFallback(slug, written)
136
+ }
123
137
  }
124
138
  return slug
125
139
  }