@conduction/nextcloud-vue 2.151.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 (147) hide show
  1. package/dist/esm/components/CnAiCompanion/CnAiFloatingButton.vue2.js +13 -1
  2. package/dist/esm/components/CnAiCompanion/CnAiFloatingButton.vue2.js.map +1 -1
  3. package/dist/esm/components/CnAiCompanion/CnAiFloatingButton.vue3.js +1 -1
  4. package/dist/esm/components/CnAiCompanion/CnAiFloatingButton.vue3.js.map +1 -1
  5. package/dist/esm/components/CnAiCompanion/CnAiInput.vue2.js.map +1 -1
  6. package/dist/esm/components/CnAiCompanion/CnAiInput.vue3.js.map +1 -1
  7. package/dist/esm/components/CnAttentionFlagWidget/CnAttentionFlagWidget.vue.js +1 -1
  8. package/dist/esm/components/CnAttentionFlagWidget/CnAttentionFlagWidget.vue2.js.map +1 -1
  9. package/dist/esm/components/CnAttentionFlagWidget/CnAttentionFlagWidget.vue3.js +1 -1
  10. package/dist/esm/components/CnAttentionFlagWidget/CnAttentionFlagWidget.vue3.js.map +1 -1
  11. package/dist/esm/components/CnAuditTrailCard/CnAuditTrailCard.vue.js +1 -1
  12. package/dist/esm/components/CnAuditTrailCard/CnAuditTrailCard.vue2.js +30 -5
  13. package/dist/esm/components/CnAuditTrailCard/CnAuditTrailCard.vue2.js.map +1 -1
  14. package/dist/esm/components/CnAuditTrailCard/CnAuditTrailCard.vue3.js.map +1 -1
  15. package/dist/esm/components/CnBannerWidget/CnBannerWidget.vue.js +1 -1
  16. package/dist/esm/components/CnBannerWidget/CnBannerWidget.vue2.js +38 -0
  17. package/dist/esm/components/CnBannerWidget/CnBannerWidget.vue2.js.map +1 -1
  18. package/dist/esm/components/CnBannerWidget/CnBannerWidget.vue3.js.map +1 -1
  19. package/dist/esm/components/CnConversationThread/CnConversationThread.vue.js +1 -1
  20. package/dist/esm/components/CnConversationThread/CnConversationThread.vue2.js +2 -1
  21. package/dist/esm/components/CnConversationThread/CnConversationThread.vue2.js.map +1 -1
  22. package/dist/esm/components/CnConversationThread/CnConversationThread.vue3.js +33 -25
  23. package/dist/esm/components/CnConversationThread/CnConversationThread.vue3.js.map +1 -1
  24. package/dist/esm/components/CnConversationThread/CnConversationWidget.vue.js +1 -1
  25. package/dist/esm/components/CnConversationThread/CnConversationWidget.vue2.js +22 -2
  26. package/dist/esm/components/CnConversationThread/CnConversationWidget.vue2.js.map +1 -1
  27. package/dist/esm/components/CnConversationThread/CnConversationWidget.vue3.js.map +1 -1
  28. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue.js +1 -1
  29. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue2.js.map +1 -1
  30. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue3.js.map +1 -1
  31. package/dist/esm/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue.js +1 -1
  32. package/dist/esm/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue2.js +7 -1
  33. package/dist/esm/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue2.js.map +1 -1
  34. package/dist/esm/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue3.js.map +1 -1
  35. package/dist/esm/components/CnExportsWidget/CnExportsWidget.vue.js +1 -1
  36. package/dist/esm/components/CnExportsWidget/CnExportsWidget.vue2.js +2 -1
  37. package/dist/esm/components/CnExportsWidget/CnExportsWidget.vue2.js.map +1 -1
  38. package/dist/esm/components/CnExportsWidget/CnExportsWidget.vue3.js +6 -2
  39. package/dist/esm/components/CnExportsWidget/CnExportsWidget.vue3.js.map +1 -1
  40. package/dist/esm/components/CnFeaturesBoard/CnFeaturesBoard.vue.js +1 -1
  41. package/dist/esm/components/CnFeaturesBoard/CnFeaturesBoard.vue2.js.map +1 -1
  42. package/dist/esm/components/CnFeaturesBoard/CnFeaturesBoard.vue3.js.map +1 -1
  43. package/dist/esm/components/CnFieldListWidget/CnFieldListWidget.vue.js +1 -1
  44. package/dist/esm/components/CnFieldListWidget/CnFieldListWidget.vue2.js +3 -1
  45. package/dist/esm/components/CnFieldListWidget/CnFieldListWidget.vue2.js.map +1 -1
  46. package/dist/esm/components/CnFieldListWidget/CnFieldListWidget.vue3.js +31 -9
  47. package/dist/esm/components/CnFieldListWidget/CnFieldListWidget.vue3.js.map +1 -1
  48. package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js +21 -3
  49. package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js.map +1 -1
  50. package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js.map +1 -1
  51. package/dist/esm/components/CnMapWidget/CnMapWidget.vue.js +1 -1
  52. package/dist/esm/components/CnMapWidget/CnMapWidget.vue2.js +20 -0
  53. package/dist/esm/components/CnMapWidget/CnMapWidget.vue2.js.map +1 -1
  54. package/dist/esm/components/CnMapWidget/CnMapWidget.vue3.js.map +1 -1
  55. package/dist/esm/components/CnNotificationMatrix/CnNotificationMatrix.vue.js +1 -1
  56. package/dist/esm/components/CnNotificationMatrix/CnNotificationMatrix.vue2.js.map +1 -1
  57. package/dist/esm/components/CnNotificationMatrix/CnNotificationMatrix.vue3.js.map +1 -1
  58. package/dist/esm/components/CnPlanWidget/CnPlanWidget.vue.js +1 -1
  59. package/dist/esm/components/CnPlanWidget/CnPlanWidget.vue2.js +18 -1
  60. package/dist/esm/components/CnPlanWidget/CnPlanWidget.vue2.js.map +1 -1
  61. package/dist/esm/components/CnPlanWidget/CnPlanWidget.vue3.js +4 -2
  62. package/dist/esm/components/CnPlanWidget/CnPlanWidget.vue3.js.map +1 -1
  63. package/dist/esm/components/CnPlanWidget/CnPlanWidgetRow.vue.js +1 -1
  64. package/dist/esm/components/CnPlanWidget/CnPlanWidgetRow.vue2.js +25 -3
  65. package/dist/esm/components/CnPlanWidget/CnPlanWidgetRow.vue2.js.map +1 -1
  66. package/dist/esm/components/CnPlanWidget/CnPlanWidgetRow.vue3.js +1 -1
  67. package/dist/esm/components/CnPlanWidget/CnPlanWidgetRow.vue3.js.map +1 -1
  68. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue.js +1 -1
  69. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js +31 -1
  70. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js.map +1 -1
  71. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js +102 -97
  72. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js.map +1 -1
  73. package/dist/esm/components/CnSavedViewLookFields/CnSavedViewLookFields.vue.js +1 -1
  74. package/dist/esm/components/CnSavedViewLookFields/CnSavedViewLookFields.vue2.js +33 -0
  75. package/dist/esm/components/CnSavedViewLookFields/CnSavedViewLookFields.vue2.js.map +1 -1
  76. package/dist/esm/components/CnSavedViewLookFields/CnSavedViewLookFields.vue3.js +2 -2
  77. package/dist/esm/components/CnSavedViewLookFields/CnSavedViewLookFields.vue3.js.map +1 -1
  78. package/dist/esm/components/CnSettingsField/CnSettingsField.vue.js +1 -1
  79. package/dist/esm/components/CnSettingsField/CnSettingsField.vue2.js +2 -1
  80. package/dist/esm/components/CnSettingsField/CnSettingsField.vue2.js.map +1 -1
  81. package/dist/esm/components/CnSettingsField/CnSettingsField.vue3.js +15 -13
  82. package/dist/esm/components/CnSettingsField/CnSettingsField.vue3.js.map +1 -1
  83. package/dist/esm/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue.js +1 -1
  84. package/dist/esm/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue2.js +27 -0
  85. package/dist/esm/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue2.js.map +1 -1
  86. package/dist/esm/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue3.js +6 -6
  87. package/dist/esm/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue3.js.map +1 -1
  88. package/dist/esm/components/CnStepper/CnStepper.vue.js +1 -1
  89. package/dist/esm/components/CnStepper/CnStepper.vue2.js.map +1 -1
  90. package/dist/esm/components/CnStepper/CnStepper.vue3.js.map +1 -1
  91. package/dist/esm/components/CnTimelineWidget/CnTimelineManage.vue.js +1 -1
  92. package/dist/esm/components/CnTimelineWidget/CnTimelineManage.vue2.js.map +1 -1
  93. package/dist/esm/components/CnTimelineWidget/CnTimelineManage.vue3.js +14 -14
  94. package/dist/esm/components/CnTimelineWidget/CnTimelineManage.vue3.js.map +1 -1
  95. package/dist/esm/composables/indexSources.js +4 -1
  96. package/dist/esm/composables/indexSources.js.map +1 -1
  97. package/dist/esm/l10n/en.json.js +30 -1
  98. package/dist/esm/l10n/en.json.js.map +1 -1
  99. package/dist/esm/l10n/nl.json.js +31 -2
  100. package/dist/esm/l10n/nl.json.js.map +1 -1
  101. package/dist/esm/library-style.js +1 -1
  102. package/dist/esm/nextcloud-vue.css +1129 -567
  103. package/dist/esm/utils/fillTemplate.js +12 -2
  104. package/dist/esm/utils/fillTemplate.js.map +1 -1
  105. package/dist/esm/utils/libraryTranslate.js +19 -1
  106. package/dist/esm/utils/libraryTranslate.js.map +1 -1
  107. package/dist/esm/utils/savedViewSummary.js +109 -4
  108. package/dist/esm/utils/savedViewSummary.js.map +1 -1
  109. package/dist/nextcloud-vue.cjs.js +1096 -592
  110. package/dist/nextcloud-vue.cjs.js.map +2 -2
  111. package/dist/nextcloud-vue.css +1129 -567
  112. package/l10n/en.json +30 -1
  113. package/l10n/nl.json +31 -2
  114. package/package.json +1 -1
  115. package/src/components/CnAiCompanion/CnAiFloatingButton.vue +14 -2
  116. package/src/components/CnAiCompanion/CnAiInput.vue +19 -0
  117. package/src/components/CnAttentionFlagWidget/CnAttentionFlagWidget.vue +7 -1
  118. package/src/components/CnAuditTrailCard/CnAuditTrailCard.vue +30 -5
  119. package/src/components/CnBannerWidget/CnBannerWidget.vue +38 -0
  120. package/src/components/CnConversationThread/CnConversationThread.vue +7 -1
  121. package/src/components/CnConversationThread/CnConversationWidget.vue +22 -2
  122. package/src/components/CnDashboardPage/CnDashboardPage.vue +17 -0
  123. package/src/components/CnDeviceFramesWidget/CnDeviceFramesWidget.vue +16 -1
  124. package/src/components/CnExportsWidget/CnExportsWidget.vue +5 -1
  125. package/src/components/CnFeaturesBoard/CnFeaturesBoard.vue +2 -0
  126. package/src/components/CnFieldListWidget/CnFieldListWidget.vue +18 -4
  127. package/src/components/CnIndexPage/CnIndexPage.vue +21 -3
  128. package/src/components/CnMapWidget/CnMapWidget.vue +20 -0
  129. package/src/components/CnNotificationMatrix/CnNotificationMatrix.vue +23 -0
  130. package/src/components/CnPlanWidget/CnPlanWidget.vue +20 -1
  131. package/src/components/CnPlanWidget/CnPlanWidgetRow.vue +26 -4
  132. package/src/components/CnRecordListWidget/CnRecordListWidget.vue +73 -5
  133. package/src/components/CnSavedViewLookFields/CnSavedViewLookFields.vue +35 -2
  134. package/src/components/CnSettingsField/CnSettingsField.vue +5 -3
  135. package/src/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue +31 -4
  136. package/src/components/CnStepper/CnStepper.vue +7 -5
  137. package/src/components/CnTimelineWidget/CnTimelineManage.vue +9 -4
  138. package/src/composables/indexSources.js +4 -1
  139. package/src/css/dialog.css +18 -3
  140. package/src/css/form-field.css +11 -0
  141. package/src/css/look-board-detail.css +124 -1
  142. package/src/css/look-board-index.css +75 -9
  143. package/src/css/look-board.css +242 -6
  144. package/src/css/patches.css +5 -5
  145. package/src/utils/fillTemplate.js +12 -2
  146. package/src/utils/libraryTranslate.js +18 -0
  147. package/src/utils/savedViewSummary.js +109 -4
@@ -1 +1 @@
1
- {"version":3,"file":"CnPlanWidget.vue2.js","sources":["../../../../src/components/CnPlanWidget/CnPlanWidget.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n<template>\n\t<div class=\"cn-plan\" data-testid=\"cn-plan\">\n\t\t<NcLoadingIcon v-if=\"loading\" :size=\"24\" />\n\t\t<NcEmptyContent v-else-if=\"error\"\n\t\t\t:name=\"t('nextcloud-vue', 'The plan is unavailable')\"\n\t\t\t:description=\"error\"\n\t\t\tdata-testid=\"cn-plan-error\">\n\t\t\t<template #action>\n\t\t\t\t<NcButton data-testid=\"cn-plan-retry\" @click=\"load\">\n\t\t\t\t\t{{ t('nextcloud-vue', 'Try again') }}\n\t\t\t\t</NcButton>\n\t\t\t</template>\n\t\t</NcEmptyContent>\n\t\t<ul v-else-if=\"roots.length > 0\" class=\"cn-plan__tree\">\n\t\t\t<li v-for=\"node in roots\" :key=\"node.uuid\" class=\"cn-plan__node\">\n\t\t\t\t<CnPlanWidgetRow :item=\"node\"\n\t\t\t\t\t:busy=\"busy\"\n\t\t\t\t\t@enable=\"enable\"\n\t\t\t\t\t@transition=\"transition\" />\n\t\t\t\t<ul v-if=\"node.children.length > 0\" class=\"cn-plan__children\">\n\t\t\t\t\t<li v-for=\"child in node.children\" :key=\"child.uuid\" class=\"cn-plan__node\">\n\t\t\t\t\t\t<CnPlanWidgetRow :item=\"child\"\n\t\t\t\t\t\t\t:busy=\"busy\"\n\t\t\t\t\t\t\t@enable=\"enable\"\n\t\t\t\t\t\t\t@transition=\"transition\" />\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\n\t\t\t</li>\n\t\t</ul>\n\t\t<p v-else class=\"cn-plan__empty\" data-testid=\"cn-plan-empty\">\n\t\t\t{{ text(content.emptyText) || t('nextcloud-vue', 'This record has no plan') }}\n\t\t</p>\n\t</div>\n</template>\n\n<script>\nimport axios from '@nextcloud/axios'\nimport { emit, subscribe, unsubscribe } from '@nextcloud/event-bus'\nimport { translate as t } from '@nextcloud/l10n'\nimport { generateUrl } from '@nextcloud/router'\nimport { NcButton, NcEmptyContent, NcLoadingIcon } from '@nextcloud/vue'\nimport CnPlanWidgetRow from './CnPlanWidgetRow.vue'\nimport { planTree } from '../../utils/planTree.js'\n\n/** The page refresh channel the built-in widgets listen on. */\nconst PAGE_REFRESH = 'cn:page:refresh'\n\n/**\n * CnPlanWidget — the `plan` detail widget: a record's planned steps (stages,\n * tasks and milestones) as OpenRegister's case layer holds them, read from\n * `/api/cases/{id}`, with the moves OpenRegister allows: start a\n * discretionary item, complete or terminate one. It judges nothing:\n * OpenRegister decides every move and its refusal is shown as it says it.\n * A 404 means the record has no plan; any other failure is an error with a\n * retry, never an empty plan. Any app whose records run on OpenRegister's\n * case layer uses it; dossiq's case plan is the first.\n *\n * `content`: `emptyText`, through the host translate.\n *\n * The record's id comes from `objectId`, else the bound record.\n */\nexport default {\n\tname: 'CnPlanWidget',\n\n\tcomponents: { CnPlanWidgetRow, NcButton, NcEmptyContent, NcLoadingIcon },\n\n\tinject: {\n\t\t/** The host app's translate (CnAppRoot `cnTranslate`). */\n\t\tcnTranslate: { default: () => (key) => key },\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * The widget's configuration: `{ emptyText? }`.\n\t\t *\n\t\t * @type {object}\n\t\t */\n\t\tcontent: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/**\n\t\t * The bound record, on a detail page.\n\t\t *\n\t\t * @type {object|null}\n\t\t */\n\t\tobjectData: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/** The record's id (else the bound record's). */\n\t\tobjectId: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: '',\n\t\t},\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\tloading: true,\n\t\t\tbusy: false,\n\t\t\terror: '',\n\t\t\troots: [],\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** @return {string} The record id. */\n\t\tid() {\n\t\t\tconst bound = this.objectData || {}\n\t\t\treturn String(this.objectId || bound.id || (bound['@self'] && bound['@self'].id) || '')\n\t\t},\n\t},\n\n\tmounted() {\n\t\tsubscribe(PAGE_REFRESH, this.load)\n\t\tthis.load()\n\t},\n\n\tbeforeUnmount() {\n\t\tunsubscribe(PAGE_REFRESH, this.load)\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * A config text through the host translate.\n\t\t *\n\t\t * @param {unknown} value The text.\n\t\t * @return {string}\n\t\t */\n\t\ttext(value) {\n\t\t\treturn typeof value === 'string' && value !== '' ? this.cnTranslate(value) : ''\n\t\t},\n\n\t\t/**\n\t\t * The server's sentence for a failure.\n\t\t *\n\t\t * @param {unknown} failure The rejection.\n\t\t * @return {string}\n\t\t */\n\t\tmessageOf(failure) {\n\t\t\tconst response = failure && failure.response\n\t\t\tif (response && response.status === 403) {\n\t\t\t\treturn t('nextcloud-vue', 'You are not allowed to see this plan.')\n\t\t\t}\n\t\t\tconst body = response && response.data\n\t\t\tconst detail = body && (body.error || body.message)\n\t\t\treturn typeof detail === 'string' && detail !== '' ? detail : t('nextcloud-vue', 'The plan could not be loaded. Try again.')\n\t\t},\n\n\t\t/**\n\t\t * Read the plan; 404 is \"no plan\", anything else an error.\n\t\t *\n\t\t * @spec openspec/changes/plan-widget/specs/plan-widget/spec.md#requirement-a-record-shows-its-planned-steps\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync load() {\n\t\t\tif (!this.id) {\n\t\t\t\tthis.loading = false\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.loading = true\n\t\t\tthis.error = ''\n\t\t\ttry {\n\t\t\t\tconst { data } = await axios.get(generateUrl(`/apps/openregister/api/cases/${encodeURIComponent(this.id)}`))\n\t\t\t\tthis.roots = data && Array.isArray(data.items) ? planTree(data.items) : []\n\t\t\t} catch (failure) {\n\t\t\t\tthis.roots = []\n\t\t\t\tif (!(failure && failure.response && failure.response.status === 404)) {\n\t\t\t\t\tthis.error = this.messageOf(failure)\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tthis.loading = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Start a discretionary item.\n\t\t *\n\t\t * @param {object} item The plan item.\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tenable(item) {\n\t\t\treturn this.act(() => axios.post(generateUrl(`/apps/openregister/api/cases/items/${encodeURIComponent(item.uuid)}/enable`), {}))\n\t\t},\n\n\t\t/**\n\t\t * Move an item to a target state.\n\t\t *\n\t\t * @param {object} item The plan item.\n\t\t * @param {string} to The target state.\n\t\t * @return {Promise<void>}\n\t\t */\n\t\ttransition(item, to) {\n\t\t\treturn this.act(() => axios.post(generateUrl(`/apps/openregister/api/cases/items/${encodeURIComponent(item.uuid)}/transition`), { to, reason: '' }))\n\t\t},\n\n\t\t/**\n\t\t * Run one move, then read the plan again: a move can cascade, so the\n\t\t * next read is the plan, not the write's answer.\n\t\t *\n\t\t * @spec openspec/changes/plan-widget/specs/plan-widget/spec.md#requirement-a-record-shows-its-planned-steps\n\t\t * @param {() => Promise<unknown>} write The move.\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync act(write) {\n\t\t\tthis.busy = true\n\t\t\ttry {\n\t\t\t\tawait write()\n\t\t\t\tawait this.load()\n\t\t\t\temit(PAGE_REFRESH, {})\n\t\t\t} catch (failure) {\n\t\t\t\tthis.error = this.messageOf(failure)\n\t\t\t} finally {\n\t\t\t\tthis.busy = false\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-plan__tree,\n.cn-plan__children {\n\tmargin: 0;\n\tpadding: 0;\n\tlist-style: none;\n}\n\n.cn-plan__children {\n\tpadding-inline-start: 24px;\n}\n\n.cn-plan__empty {\n\tmargin: 0;\n\tcolor: var(--color-text-maxcontrast);\n}\n</style>\n"],"names":["CnPlanWidgetRow","t","axios"],"mappings":";;;;;;;;AAgDA;AACA,MAAM,YAAW,GAAI,kBAAgB;;AAErC;AACC;AACA;;;;;;AAMA;AACA;;AAEA;;;AAGD,aAAe;AACd,CAAA,IAAI,EAAE,cAAc;;AAEpB,CAAA,UAAU,EAAE,mBAAEA,UAAe,EAAE,QAAQ,EAAE,cAAc,EAAE,eAAe;;AAExE,CAAA,MAAM,EAAE;;AAEP,EAAA,WAAW,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,KAAK,KAAK;EAC5C;;AAED,CAAA,KAAK,EAAE;AACN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C,SAAS,CAAC,OAAO,EAAA;AACpC,KAAA;AACD,IAAA,SAAU;AACT,IAAA,IAAI,CAAC,OAAQ,GAAE,MAAI;AACpB,IAAA;GACA;;AAED;;AAEC;AACA;;;EAGD,MAAM,CAAC,IAAI,EAAE;GACZ,OAAO,IAAI,CAAC,GAAG,CAAC,MAAMA,cAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,mCAAmC,EAAE,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;GAC/H;;AAED;;AAEC;AACA;AACA;;;AAGD,EAAA,UAAU,CAAC,IAAI,EAAE,EAAE,EAAE;AACpB,GAAA,OAAO,IAAI,CAAC,GAAG,CAAC,MAAMA,cAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,mCAAmC,EAAE,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,EAAC,EAAG,CAAC,CAAA;GACnJ;;AAED;;AAEC;AACA;;AAEA;;;AAGD,EAAA,MAAM,GAAG,CAAC,KAAK,EAAE;GAChB,IAAI,CAAC,IAAK,GAAE,KAAG;AACf,GAAA,IAAI;IACH,MAAM,KAAK,GAAC;AACZ,IAAA,MAAM,IAAI,CAAC,IAAI,GAAC;AAChB,IAAA,IAAI,CAAC,YAAY,EAAE,EAAE,EAAA;AACtB,IAAA,CAAE,OAAO,OAAO,EAAE;AACjB,IAAA,IAAI,CAAC,KAAM,GAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAA;AACpC,IAAA,SAAU;AACT,IAAA,IAAI,CAAC,IAAG,GAAI,MAAI;AACjB,IAAA;GACA;EACD;AACF;;;;"}
1
+ {"version":3,"file":"CnPlanWidget.vue2.js","sources":["../../../../src/components/CnPlanWidget/CnPlanWidget.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n<template>\n\t<div class=\"cn-plan\" data-testid=\"cn-plan\">\n\t\t<NcLoadingIcon v-if=\"loading\" :size=\"24\" />\n\t\t<NcEmptyContent v-else-if=\"error\"\n\t\t\t:name=\"t('nextcloud-vue', 'The plan is unavailable')\"\n\t\t\t:description=\"error\"\n\t\t\tdata-testid=\"cn-plan-error\">\n\t\t\t<template #action>\n\t\t\t\t<NcButton data-testid=\"cn-plan-retry\" @click=\"load\">\n\t\t\t\t\t{{ t('nextcloud-vue', 'Try again') }}\n\t\t\t\t</NcButton>\n\t\t\t</template>\n\t\t</NcEmptyContent>\n\t\t<ul v-else-if=\"roots.length > 0\" class=\"cn-plan__tree\">\n\t\t\t<li v-for=\"node in roots\" :key=\"node.uuid\" class=\"cn-plan__node\">\n\t\t\t\t<CnPlanWidgetRow :item=\"node\"\n\t\t\t\t\t:labels=\"stateLabels\"\n\t\t\t\t\t:busy=\"busy\"\n\t\t\t\t\t@enable=\"enable\"\n\t\t\t\t\t@transition=\"transition\" />\n\t\t\t\t<ul v-if=\"node.children.length > 0\" class=\"cn-plan__children\">\n\t\t\t\t\t<li v-for=\"child in node.children\" :key=\"child.uuid\" class=\"cn-plan__node\">\n\t\t\t\t\t\t<CnPlanWidgetRow :item=\"child\"\n\t\t\t\t\t\t\t:labels=\"stateLabels\"\n\t\t\t\t\t\t\t:busy=\"busy\"\n\t\t\t\t\t\t\t@enable=\"enable\"\n\t\t\t\t\t\t\t@transition=\"transition\" />\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\n\t\t\t</li>\n\t\t</ul>\n\t\t<p v-else class=\"cn-plan__empty\" data-testid=\"cn-plan-empty\">\n\t\t\t{{ text(content.emptyText) || t('nextcloud-vue', 'This record has no plan') }}\n\t\t</p>\n\t</div>\n</template>\n\n<script>\nimport axios from '@nextcloud/axios'\nimport { emit, subscribe, unsubscribe } from '@nextcloud/event-bus'\nimport { translate as t } from '@nextcloud/l10n'\nimport { generateUrl } from '@nextcloud/router'\nimport { NcButton, NcEmptyContent, NcLoadingIcon } from '@nextcloud/vue'\nimport CnPlanWidgetRow from './CnPlanWidgetRow.vue'\nimport { planTree } from '../../utils/planTree.js'\n\n/** The page refresh channel the built-in widgets listen on. */\nconst PAGE_REFRESH = 'cn:page:refresh'\n\n/**\n * CnPlanWidget — the `plan` detail widget: a record's planned steps (stages,\n * tasks and milestones) as OpenRegister's case layer holds them, read from\n * `/api/cases/{id}`, with the moves OpenRegister allows: start a\n * discretionary item, complete or terminate one. It judges nothing:\n * OpenRegister decides every move and its refusal is shown as it says it.\n * A 404 means the record has no plan; any other failure is an error with a\n * retry, never an empty plan. Any app whose records run on OpenRegister's\n * case layer uses it; dossiq's case plan is the first.\n *\n * `content`: `emptyText`, and `stateLabels` (`{ active: 'Active' }`, the word\n * for a state), both through the host translate.\n *\n * The record's id comes from `objectId`, else the bound record.\n */\nexport default {\n\tname: 'CnPlanWidget',\n\n\tcomponents: { CnPlanWidgetRow, NcButton, NcEmptyContent, NcLoadingIcon },\n\n\tinject: {\n\t\t/** The host app's translate (CnAppRoot `cnTranslate`). */\n\t\tcnTranslate: { default: () => (key) => key },\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * The widget's configuration: `{ emptyText? }`.\n\t\t *\n\t\t * @type {object}\n\t\t */\n\t\tcontent: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/**\n\t\t * The bound record, on a detail page.\n\t\t *\n\t\t * @type {object|null}\n\t\t */\n\t\tobjectData: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/** The record's id (else the bound record's). */\n\t\tobjectId: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: '',\n\t\t},\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\tloading: true,\n\t\t\tbusy: false,\n\t\t\terror: '',\n\t\t\troots: [],\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** @return {object} The configured word per state, translated. */\n\t\tstateLabels() {\n\t\t\tconst map = this.content?.stateLabels\n\t\t\tif (!map || typeof map !== 'object') {\n\t\t\t\treturn {}\n\t\t\t}\n\t\t\tconst out = {}\n\t\t\tfor (const [state, label] of Object.entries(map)) {\n\t\t\t\tconst text = this.text(label)\n\t\t\t\tif (text !== '') {\n\t\t\t\t\tout[state] = text\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn out\n\t\t},\n\n\t\t/** @return {string} The record id. */\n\t\tid() {\n\t\t\tconst bound = this.objectData || {}\n\t\t\treturn String(this.objectId || bound.id || (bound['@self'] && bound['@self'].id) || '')\n\t\t},\n\t},\n\n\tmounted() {\n\t\tsubscribe(PAGE_REFRESH, this.load)\n\t\tthis.load()\n\t},\n\n\tbeforeUnmount() {\n\t\tunsubscribe(PAGE_REFRESH, this.load)\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * A config text through the host translate.\n\t\t *\n\t\t * @param {unknown} value The text.\n\t\t * @return {string}\n\t\t */\n\t\ttext(value) {\n\t\t\treturn typeof value === 'string' && value !== '' ? this.cnTranslate(value) : ''\n\t\t},\n\n\t\t/**\n\t\t * The server's sentence for a failure.\n\t\t *\n\t\t * @param {unknown} failure The rejection.\n\t\t * @return {string}\n\t\t */\n\t\tmessageOf(failure) {\n\t\t\tconst response = failure && failure.response\n\t\t\tif (response && response.status === 403) {\n\t\t\t\treturn t('nextcloud-vue', 'You are not allowed to see this plan.')\n\t\t\t}\n\t\t\tconst body = response && response.data\n\t\t\tconst detail = body && (body.error || body.message)\n\t\t\treturn typeof detail === 'string' && detail !== '' ? detail : t('nextcloud-vue', 'The plan could not be loaded. Try again.')\n\t\t},\n\n\t\t/**\n\t\t * Read the plan; 404 is \"no plan\", anything else an error.\n\t\t *\n\t\t * @spec openspec/changes/plan-widget/specs/plan-widget/spec.md#requirement-a-record-shows-its-planned-steps\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync load() {\n\t\t\tif (!this.id) {\n\t\t\t\tthis.loading = false\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.loading = true\n\t\t\tthis.error = ''\n\t\t\ttry {\n\t\t\t\tconst { data } = await axios.get(generateUrl(`/apps/openregister/api/cases/${encodeURIComponent(this.id)}`))\n\t\t\t\tthis.roots = data && Array.isArray(data.items) ? planTree(data.items) : []\n\t\t\t} catch (failure) {\n\t\t\t\tthis.roots = []\n\t\t\t\tif (!(failure && failure.response && failure.response.status === 404)) {\n\t\t\t\t\tthis.error = this.messageOf(failure)\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tthis.loading = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Start a discretionary item.\n\t\t *\n\t\t * @param {object} item The plan item.\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tenable(item) {\n\t\t\treturn this.act(() => axios.post(generateUrl(`/apps/openregister/api/cases/items/${encodeURIComponent(item.uuid)}/enable`), {}))\n\t\t},\n\n\t\t/**\n\t\t * Move an item to a target state.\n\t\t *\n\t\t * @param {object} item The plan item.\n\t\t * @param {string} to The target state.\n\t\t * @return {Promise<void>}\n\t\t */\n\t\ttransition(item, to) {\n\t\t\treturn this.act(() => axios.post(generateUrl(`/apps/openregister/api/cases/items/${encodeURIComponent(item.uuid)}/transition`), { to, reason: '' }))\n\t\t},\n\n\t\t/**\n\t\t * Run one move, then read the plan again: a move can cascade, so the\n\t\t * next read is the plan, not the write's answer.\n\t\t *\n\t\t * @spec openspec/changes/plan-widget/specs/plan-widget/spec.md#requirement-a-record-shows-its-planned-steps\n\t\t * @param {() => Promise<unknown>} write The move.\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync act(write) {\n\t\t\tthis.busy = true\n\t\t\ttry {\n\t\t\t\tawait write()\n\t\t\t\tawait this.load()\n\t\t\t\temit(PAGE_REFRESH, {})\n\t\t\t} catch (failure) {\n\t\t\t\tthis.error = this.messageOf(failure)\n\t\t\t} finally {\n\t\t\t\tthis.busy = false\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-plan__tree,\n.cn-plan__children {\n\tmargin: 0;\n\tpadding: 0;\n\tlist-style: none;\n}\n\n.cn-plan__children {\n\tpadding-inline-start: 24px;\n}\n\n.cn-plan__empty {\n\tmargin: 0;\n\tcolor: var(--color-text-maxcontrast);\n}\n</style>\n"],"names":["CnPlanWidgetRow","t","axios"],"mappings":";;;;;;;;AAkDA;AACA,MAAM,YAAW,GAAI,kBAAgB;;AAErC;AACC;AACA;;;;;;AAMA;AACA;AACA;AACA;AACA;;;AAGD,aAAe;AACd,CAAA,IAAI,EAAE,cAAc;;AAEpB,CAAA,UAAU,EAAE,mBAAEA,UAAe,EAAE,QAAQ,EAAE,cAAc,EAAE,eAAe;;AAExE,CAAA,MAAM,EAAE;;AAEP,EAAA,WAAW,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,GAAG,KAAK,KAAK;EAC5C;;AAED,CAAA,KAAK,EAAE;AACN;AACC;AACA;;;AAGD,EAAA,OAAO,EAAE;GACR,IAAI,EAAE,MAAM;AACZ,GAAA,OAAO,EAAE,OAAO,EAAE,CAAC;GACnB;;AAED;;AAEC;AACA;;EAED,UAAU,EAAE;GACX,IAAI,EAAE,MAAM;GACZ,OAAO,EAAE,IAAI;GACb;;AAED;AACA,EAAA,QAAQ,EAAE;AACT,GAAA,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;GACtB,OAAO,EAAE,EAAE;GACX;EACD;;AAED,CAAA,IAAI,GAAG;AACN,EAAA,OAAO;GACN,OAAO,EAAE,IAAI;GACb,IAAI,EAAE,KAAK;AACX,GAAA,KAAK,EAAE,EAAE;AACT,GAAA,KAAK,EAAE,EAAE;AACV,GAAA;EACA;;AAED,CAAA,QAAQ,EAAE;;EAET,WAAW,GAAG;AACb,GAAA,MAAM,GAAI,GAAE,IAAI,CAAC,OAAO,EAAE,YAAU;AACpC,GAAA,IAAI,CAAC,GAAE,IAAK,OAAO,GAAI,KAAI,QAAQ,EAAE;AACp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,MAAM,CAAC,IAAI,EAAE;GACZ,OAAO,IAAI,CAAC,GAAG,CAAC,MAAMA,cAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,mCAAmC,EAAE,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;GAC/H;;AAED;;AAEC;AACA;AACA;;;AAGD,EAAA,UAAU,CAAC,IAAI,EAAE,EAAE,EAAE;AACpB,GAAA,OAAO,IAAI,CAAC,GAAG,CAAC,MAAMA,cAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,mCAAmC,EAAE,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,EAAC,EAAG,CAAC,CAAA;GACnJ;;AAED;;AAEC;AACA;;AAEA;;;AAGD,EAAA,MAAM,GAAG,CAAC,KAAK,EAAE;GAChB,IAAI,CAAC,IAAK,GAAE,KAAG;AACf,GAAA,IAAI;IACH,MAAM,KAAK,GAAC;AACZ,IAAA,MAAM,IAAI,CAAC,IAAI,GAAC;AAChB,IAAA,IAAI,CAAC,YAAY,EAAE,EAAE,EAAA;AACtB,IAAA,CAAE,OAAO,OAAO,EAAE;AACjB,IAAA,IAAI,CAAC,KAAM,GAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAA;AACpC,IAAA,SAAU;AACT,IAAA,IAAI,CAAC,IAAG,GAAI,MAAI;AACjB,IAAA;GACA;EACD;AACF;;;;"}
@@ -59,10 +59,11 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
59
59
  }, [
60
60
  createVNode(_component_CnPlanWidgetRow, {
61
61
  item: node,
62
+ labels: $options.stateLabels,
62
63
  busy: $data.busy,
63
64
  onEnable: $options.enable,
64
65
  onTransition: $options.transition
65
- }, null, 8 /* PROPS */, ["item", "busy", "onEnable", "onTransition"]),
66
+ }, null, 8 /* PROPS */, ["item", "labels", "busy", "onEnable", "onTransition"]),
66
67
  (node.children.length > 0)
67
68
  ? (openBlock(), createElementBlock("ul", _hoisted_3, [
68
69
  (openBlock(true), createElementBlock(Fragment, null, renderList(node.children, (child) => {
@@ -72,10 +73,11 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
72
73
  }, [
73
74
  createVNode(_component_CnPlanWidgetRow, {
74
75
  item: child,
76
+ labels: $options.stateLabels,
75
77
  busy: $data.busy,
76
78
  onEnable: $options.enable,
77
79
  onTransition: $options.transition
78
- }, null, 8 /* PROPS */, ["item", "busy", "onEnable", "onTransition"])
80
+ }, null, 8 /* PROPS */, ["item", "labels", "busy", "onEnable", "onTransition"])
79
81
  ]))
80
82
  }), 128 /* KEYED_FRAGMENT */))
81
83
  ]))
@@ -1 +1 @@
1
- {"version":3,"file":"CnPlanWidget.vue3.js","sources":["../../../../src/components/CnPlanWidget/CnPlanWidget.vue?vue&type=template&id=425e0d90&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n<template>\n\t<div class=\"cn-plan\" data-testid=\"cn-plan\">\n\t\t<NcLoadingIcon v-if=\"loading\" :size=\"24\" />\n\t\t<NcEmptyContent v-else-if=\"error\"\n\t\t\t:name=\"t('nextcloud-vue', 'The plan is unavailable')\"\n\t\t\t:description=\"error\"\n\t\t\tdata-testid=\"cn-plan-error\">\n\t\t\t<template #action>\n\t\t\t\t<NcButton data-testid=\"cn-plan-retry\" @click=\"load\">\n\t\t\t\t\t{{ t('nextcloud-vue', 'Try again') }}\n\t\t\t\t</NcButton>\n\t\t\t</template>\n\t\t</NcEmptyContent>\n\t\t<ul v-else-if=\"roots.length > 0\" class=\"cn-plan__tree\">\n\t\t\t<li v-for=\"node in roots\" :key=\"node.uuid\" class=\"cn-plan__node\">\n\t\t\t\t<CnPlanWidgetRow :item=\"node\"\n\t\t\t\t\t:busy=\"busy\"\n\t\t\t\t\t@enable=\"enable\"\n\t\t\t\t\t@transition=\"transition\" />\n\t\t\t\t<ul v-if=\"node.children.length > 0\" class=\"cn-plan__children\">\n\t\t\t\t\t<li v-for=\"child in node.children\" :key=\"child.uuid\" class=\"cn-plan__node\">\n\t\t\t\t\t\t<CnPlanWidgetRow :item=\"child\"\n\t\t\t\t\t\t\t:busy=\"busy\"\n\t\t\t\t\t\t\t@enable=\"enable\"\n\t\t\t\t\t\t\t@transition=\"transition\" />\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\n\t\t\t</li>\n\t\t</ul>\n\t\t<p v-else class=\"cn-plan__empty\" data-testid=\"cn-plan-empty\">\n\t\t\t{{ text(content.emptyText) || t('nextcloud-vue', 'This record has no plan') }}\n\t\t</p>\n\t</div>\n</template>\n\n<script>\nimport axios from '@nextcloud/axios'\nimport { emit, subscribe, unsubscribe } from '@nextcloud/event-bus'\nimport { translate as t } from '@nextcloud/l10n'\nimport { generateUrl } from '@nextcloud/router'\nimport { NcButton, NcEmptyContent, NcLoadingIcon } from '@nextcloud/vue'\nimport CnPlanWidgetRow from './CnPlanWidgetRow.vue'\nimport { planTree } from '../../utils/planTree.js'\n\n/** The page refresh channel the built-in widgets listen on. */\nconst PAGE_REFRESH = 'cn:page:refresh'\n\n/**\n * CnPlanWidget — the `plan` detail widget: a record's planned steps (stages,\n * tasks and milestones) as OpenRegister's case layer holds them, read from\n * `/api/cases/{id}`, with the moves OpenRegister allows: start a\n * discretionary item, complete or terminate one. It judges nothing:\n * OpenRegister decides every move and its refusal is shown as it says it.\n * A 404 means the record has no plan; any other failure is an error with a\n * retry, never an empty plan. Any app whose records run on OpenRegister's\n * case layer uses it; dossiq's case plan is the first.\n *\n * `content`: `emptyText`, through the host translate.\n *\n * The record's id comes from `objectId`, else the bound record.\n */\nexport default {\n\tname: 'CnPlanWidget',\n\n\tcomponents: { CnPlanWidgetRow, NcButton, NcEmptyContent, NcLoadingIcon },\n\n\tinject: {\n\t\t/** The host app's translate (CnAppRoot `cnTranslate`). */\n\t\tcnTranslate: { default: () => (key) => key },\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * The widget's configuration: `{ emptyText? }`.\n\t\t *\n\t\t * @type {object}\n\t\t */\n\t\tcontent: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/**\n\t\t * The bound record, on a detail page.\n\t\t *\n\t\t * @type {object|null}\n\t\t */\n\t\tobjectData: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/** The record's id (else the bound record's). */\n\t\tobjectId: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: '',\n\t\t},\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\tloading: true,\n\t\t\tbusy: false,\n\t\t\terror: '',\n\t\t\troots: [],\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** @return {string} The record id. */\n\t\tid() {\n\t\t\tconst bound = this.objectData || {}\n\t\t\treturn String(this.objectId || bound.id || (bound['@self'] && bound['@self'].id) || '')\n\t\t},\n\t},\n\n\tmounted() {\n\t\tsubscribe(PAGE_REFRESH, this.load)\n\t\tthis.load()\n\t},\n\n\tbeforeUnmount() {\n\t\tunsubscribe(PAGE_REFRESH, this.load)\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * A config text through the host translate.\n\t\t *\n\t\t * @param {unknown} value The text.\n\t\t * @return {string}\n\t\t */\n\t\ttext(value) {\n\t\t\treturn typeof value === 'string' && value !== '' ? this.cnTranslate(value) : ''\n\t\t},\n\n\t\t/**\n\t\t * The server's sentence for a failure.\n\t\t *\n\t\t * @param {unknown} failure The rejection.\n\t\t * @return {string}\n\t\t */\n\t\tmessageOf(failure) {\n\t\t\tconst response = failure && failure.response\n\t\t\tif (response && response.status === 403) {\n\t\t\t\treturn t('nextcloud-vue', 'You are not allowed to see this plan.')\n\t\t\t}\n\t\t\tconst body = response && response.data\n\t\t\tconst detail = body && (body.error || body.message)\n\t\t\treturn typeof detail === 'string' && detail !== '' ? detail : t('nextcloud-vue', 'The plan could not be loaded. Try again.')\n\t\t},\n\n\t\t/**\n\t\t * Read the plan; 404 is \"no plan\", anything else an error.\n\t\t *\n\t\t * @spec openspec/changes/plan-widget/specs/plan-widget/spec.md#requirement-a-record-shows-its-planned-steps\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync load() {\n\t\t\tif (!this.id) {\n\t\t\t\tthis.loading = false\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.loading = true\n\t\t\tthis.error = ''\n\t\t\ttry {\n\t\t\t\tconst { data } = await axios.get(generateUrl(`/apps/openregister/api/cases/${encodeURIComponent(this.id)}`))\n\t\t\t\tthis.roots = data && Array.isArray(data.items) ? planTree(data.items) : []\n\t\t\t} catch (failure) {\n\t\t\t\tthis.roots = []\n\t\t\t\tif (!(failure && failure.response && failure.response.status === 404)) {\n\t\t\t\t\tthis.error = this.messageOf(failure)\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tthis.loading = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Start a discretionary item.\n\t\t *\n\t\t * @param {object} item The plan item.\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tenable(item) {\n\t\t\treturn this.act(() => axios.post(generateUrl(`/apps/openregister/api/cases/items/${encodeURIComponent(item.uuid)}/enable`), {}))\n\t\t},\n\n\t\t/**\n\t\t * Move an item to a target state.\n\t\t *\n\t\t * @param {object} item The plan item.\n\t\t * @param {string} to The target state.\n\t\t * @return {Promise<void>}\n\t\t */\n\t\ttransition(item, to) {\n\t\t\treturn this.act(() => axios.post(generateUrl(`/apps/openregister/api/cases/items/${encodeURIComponent(item.uuid)}/transition`), { to, reason: '' }))\n\t\t},\n\n\t\t/**\n\t\t * Run one move, then read the plan again: a move can cascade, so the\n\t\t * next read is the plan, not the write's answer.\n\t\t *\n\t\t * @spec openspec/changes/plan-widget/specs/plan-widget/spec.md#requirement-a-record-shows-its-planned-steps\n\t\t * @param {() => Promise<unknown>} write The move.\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync act(write) {\n\t\t\tthis.busy = true\n\t\t\ttry {\n\t\t\t\tawait write()\n\t\t\t\tawait this.load()\n\t\t\t\temit(PAGE_REFRESH, {})\n\t\t\t} catch (failure) {\n\t\t\t\tthis.error = this.messageOf(failure)\n\t\t\t} finally {\n\t\t\t\tthis.busy = false\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-plan__tree,\n.cn-plan__children {\n\tmargin: 0;\n\tpadding: 0;\n\tlist-style: none;\n}\n\n.cn-plan__children {\n\tpadding-inline-start: 24px;\n}\n\n.cn-plan__empty {\n\tmargin: 0;\n\tcolor: var(--color-text-maxcontrast);\n}\n</style>\n"],"names":["_openBlock","_createElementBlock","_createBlock","_createVNode","_Fragment","_renderList"],"mappings":";;;AASM,EAAA,KAAK,EAAC,SAAS;AAAC,EAAA,aAAA,EAAA,SAAA;;;;AAYF,EAAA,KAAA,EAAA,eAAA;;;;AAME,EAAA,KAAA,EAAA,mBAAA;;;;;;;;;;;;;;AAlBnB,EAAA,QAAAA,SAAA,EAAA,EAAAC,kBAAA,QAAA;KACoB,KAAO,CAAA,OAAA;iCAAA,CAAA,wBAAA,EAAA;;AAAA,UAAA,IAAA,EAAA,EAAA;;SACV,KAAA,CAAA,KAAA;wBAAjBC,WASa,CAAA,yBAAA,EAAA;;AARZ,YAAA,IAAI,EAAE,QAAC,CAAA,CAAA,CAAA,eAAA,EAAA,yBAAA,CAAA;AACN,YAAA,WAAU,EAAE,KAAK,CAAA,KAAA;yBACR,EAAA,eAAA;;AACD,YAAA,MAAA,UACT,MAEW;cAFXC,WAEW,CAAA,mBAAA,EAAA;AAFD,gBAAA,aAAI,EAAA,eAAA;AAAA,gBAAA,OAAA,EAAA,QAAA,CAAA,IAAA;;uCACwB;kDAAlC,QAAC,CAAA,CAAA,CAAA,eAAA,EAAA,WAAA,CAAA,CAAA,EAAA,CAAA,YAAA;;;;;;;AAIQ,UAAA,CAAA,KAAA,CAAA,KAAG,CAAA,MAAA,GAAA,CAAA;AAAf,aAAAH,SAAA,EAAA,EAAAC,kBAAA,CAeC,MAfD,UAeC,EAAA;kDADD,CAAAG,QAAA,EAAA,IAAA,EAAAC,UAAA,CAbiB,KAAK,CAAA,KAAA,EAAA,CAAb,IAAI,KAAA;uDAab,CAAA,IAAA,EAAA;kBAbyB,GAAC,EAAA,IAAA,CAAA,IAAA;AAAA,kBAAA,KAAA,EAAA,eAAA;;kBAC3BF,WAGc,CAAA,0BAAA,EAAA;AAHI,oBAAA,IAAI,EAAE,IAAI;AAC1B,oBAAA,IAAI,EAAE,KAAI,CAAA,IAAA;AACV,oBAAA,QAAM,EAAE,QAAM,CAAA,MAAA;gCACJ,EAAE,QAAA,CAAA,UAAA;;mBACJ,IAAI,CAAC,QAAG,CAAA,MAAA,GAAA,CAAA;AAAf,uBAAAH,SAAA,EAAA,EAAAC,kBAAA,CAOE,MAPF,UAOE,EAAA;6DADCG,QALe,EAAA,IAAA,EAAAC,UAAA,CAAA,IAAI,CAAC,QAAG,GAAjB,KAAK,KAAA;iEAKX,CAAA,IAAA,EAAA;4BALuB,GAAA,EAAA,KAAA,CAAA,IAAA;AAAA,4BAAA,KAAA,EAAA,eAAA;;4BAC3BF,WAGA,CAAA,0BAAA,EAAA;AAHG,8BAAA,IAAA,EAAA,KAAA;AACD,8BAAA,IAAA,EAAA,KAAA,CAAA,IAAA;AACD,8BAAA,QAAA,EAAA,QAAA,CAAA,MAAA;AACD,8BAAA,YAAA,EAAA,QAAA,CAAA,UAAA;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"CnPlanWidget.vue3.js","sources":["../../../../src/components/CnPlanWidget/CnPlanWidget.vue?vue&type=template&id=06146e95&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n<template>\n\t<div class=\"cn-plan\" data-testid=\"cn-plan\">\n\t\t<NcLoadingIcon v-if=\"loading\" :size=\"24\" />\n\t\t<NcEmptyContent v-else-if=\"error\"\n\t\t\t:name=\"t('nextcloud-vue', 'The plan is unavailable')\"\n\t\t\t:description=\"error\"\n\t\t\tdata-testid=\"cn-plan-error\">\n\t\t\t<template #action>\n\t\t\t\t<NcButton data-testid=\"cn-plan-retry\" @click=\"load\">\n\t\t\t\t\t{{ t('nextcloud-vue', 'Try again') }}\n\t\t\t\t</NcButton>\n\t\t\t</template>\n\t\t</NcEmptyContent>\n\t\t<ul v-else-if=\"roots.length > 0\" class=\"cn-plan__tree\">\n\t\t\t<li v-for=\"node in roots\" :key=\"node.uuid\" class=\"cn-plan__node\">\n\t\t\t\t<CnPlanWidgetRow :item=\"node\"\n\t\t\t\t\t:labels=\"stateLabels\"\n\t\t\t\t\t:busy=\"busy\"\n\t\t\t\t\t@enable=\"enable\"\n\t\t\t\t\t@transition=\"transition\" />\n\t\t\t\t<ul v-if=\"node.children.length > 0\" class=\"cn-plan__children\">\n\t\t\t\t\t<li v-for=\"child in node.children\" :key=\"child.uuid\" class=\"cn-plan__node\">\n\t\t\t\t\t\t<CnPlanWidgetRow :item=\"child\"\n\t\t\t\t\t\t\t:labels=\"stateLabels\"\n\t\t\t\t\t\t\t:busy=\"busy\"\n\t\t\t\t\t\t\t@enable=\"enable\"\n\t\t\t\t\t\t\t@transition=\"transition\" />\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\n\t\t\t</li>\n\t\t</ul>\n\t\t<p v-else class=\"cn-plan__empty\" data-testid=\"cn-plan-empty\">\n\t\t\t{{ text(content.emptyText) || t('nextcloud-vue', 'This record has no plan') }}\n\t\t</p>\n\t</div>\n</template>\n\n<script>\nimport axios from '@nextcloud/axios'\nimport { emit, subscribe, unsubscribe } from '@nextcloud/event-bus'\nimport { translate as t } from '@nextcloud/l10n'\nimport { generateUrl } from '@nextcloud/router'\nimport { NcButton, NcEmptyContent, NcLoadingIcon } from '@nextcloud/vue'\nimport CnPlanWidgetRow from './CnPlanWidgetRow.vue'\nimport { planTree } from '../../utils/planTree.js'\n\n/** The page refresh channel the built-in widgets listen on. */\nconst PAGE_REFRESH = 'cn:page:refresh'\n\n/**\n * CnPlanWidget — the `plan` detail widget: a record's planned steps (stages,\n * tasks and milestones) as OpenRegister's case layer holds them, read from\n * `/api/cases/{id}`, with the moves OpenRegister allows: start a\n * discretionary item, complete or terminate one. It judges nothing:\n * OpenRegister decides every move and its refusal is shown as it says it.\n * A 404 means the record has no plan; any other failure is an error with a\n * retry, never an empty plan. Any app whose records run on OpenRegister's\n * case layer uses it; dossiq's case plan is the first.\n *\n * `content`: `emptyText`, and `stateLabels` (`{ active: 'Active' }`, the word\n * for a state), both through the host translate.\n *\n * The record's id comes from `objectId`, else the bound record.\n */\nexport default {\n\tname: 'CnPlanWidget',\n\n\tcomponents: { CnPlanWidgetRow, NcButton, NcEmptyContent, NcLoadingIcon },\n\n\tinject: {\n\t\t/** The host app's translate (CnAppRoot `cnTranslate`). */\n\t\tcnTranslate: { default: () => (key) => key },\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * The widget's configuration: `{ emptyText? }`.\n\t\t *\n\t\t * @type {object}\n\t\t */\n\t\tcontent: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/**\n\t\t * The bound record, on a detail page.\n\t\t *\n\t\t * @type {object|null}\n\t\t */\n\t\tobjectData: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/** The record's id (else the bound record's). */\n\t\tobjectId: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: '',\n\t\t},\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\tloading: true,\n\t\t\tbusy: false,\n\t\t\terror: '',\n\t\t\troots: [],\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** @return {object} The configured word per state, translated. */\n\t\tstateLabels() {\n\t\t\tconst map = this.content?.stateLabels\n\t\t\tif (!map || typeof map !== 'object') {\n\t\t\t\treturn {}\n\t\t\t}\n\t\t\tconst out = {}\n\t\t\tfor (const [state, label] of Object.entries(map)) {\n\t\t\t\tconst text = this.text(label)\n\t\t\t\tif (text !== '') {\n\t\t\t\t\tout[state] = text\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn out\n\t\t},\n\n\t\t/** @return {string} The record id. */\n\t\tid() {\n\t\t\tconst bound = this.objectData || {}\n\t\t\treturn String(this.objectId || bound.id || (bound['@self'] && bound['@self'].id) || '')\n\t\t},\n\t},\n\n\tmounted() {\n\t\tsubscribe(PAGE_REFRESH, this.load)\n\t\tthis.load()\n\t},\n\n\tbeforeUnmount() {\n\t\tunsubscribe(PAGE_REFRESH, this.load)\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * A config text through the host translate.\n\t\t *\n\t\t * @param {unknown} value The text.\n\t\t * @return {string}\n\t\t */\n\t\ttext(value) {\n\t\t\treturn typeof value === 'string' && value !== '' ? this.cnTranslate(value) : ''\n\t\t},\n\n\t\t/**\n\t\t * The server's sentence for a failure.\n\t\t *\n\t\t * @param {unknown} failure The rejection.\n\t\t * @return {string}\n\t\t */\n\t\tmessageOf(failure) {\n\t\t\tconst response = failure && failure.response\n\t\t\tif (response && response.status === 403) {\n\t\t\t\treturn t('nextcloud-vue', 'You are not allowed to see this plan.')\n\t\t\t}\n\t\t\tconst body = response && response.data\n\t\t\tconst detail = body && (body.error || body.message)\n\t\t\treturn typeof detail === 'string' && detail !== '' ? detail : t('nextcloud-vue', 'The plan could not be loaded. Try again.')\n\t\t},\n\n\t\t/**\n\t\t * Read the plan; 404 is \"no plan\", anything else an error.\n\t\t *\n\t\t * @spec openspec/changes/plan-widget/specs/plan-widget/spec.md#requirement-a-record-shows-its-planned-steps\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync load() {\n\t\t\tif (!this.id) {\n\t\t\t\tthis.loading = false\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.loading = true\n\t\t\tthis.error = ''\n\t\t\ttry {\n\t\t\t\tconst { data } = await axios.get(generateUrl(`/apps/openregister/api/cases/${encodeURIComponent(this.id)}`))\n\t\t\t\tthis.roots = data && Array.isArray(data.items) ? planTree(data.items) : []\n\t\t\t} catch (failure) {\n\t\t\t\tthis.roots = []\n\t\t\t\tif (!(failure && failure.response && failure.response.status === 404)) {\n\t\t\t\t\tthis.error = this.messageOf(failure)\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tthis.loading = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Start a discretionary item.\n\t\t *\n\t\t * @param {object} item The plan item.\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tenable(item) {\n\t\t\treturn this.act(() => axios.post(generateUrl(`/apps/openregister/api/cases/items/${encodeURIComponent(item.uuid)}/enable`), {}))\n\t\t},\n\n\t\t/**\n\t\t * Move an item to a target state.\n\t\t *\n\t\t * @param {object} item The plan item.\n\t\t * @param {string} to The target state.\n\t\t * @return {Promise<void>}\n\t\t */\n\t\ttransition(item, to) {\n\t\t\treturn this.act(() => axios.post(generateUrl(`/apps/openregister/api/cases/items/${encodeURIComponent(item.uuid)}/transition`), { to, reason: '' }))\n\t\t},\n\n\t\t/**\n\t\t * Run one move, then read the plan again: a move can cascade, so the\n\t\t * next read is the plan, not the write's answer.\n\t\t *\n\t\t * @spec openspec/changes/plan-widget/specs/plan-widget/spec.md#requirement-a-record-shows-its-planned-steps\n\t\t * @param {() => Promise<unknown>} write The move.\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync act(write) {\n\t\t\tthis.busy = true\n\t\t\ttry {\n\t\t\t\tawait write()\n\t\t\t\tawait this.load()\n\t\t\t\temit(PAGE_REFRESH, {})\n\t\t\t} catch (failure) {\n\t\t\t\tthis.error = this.messageOf(failure)\n\t\t\t} finally {\n\t\t\t\tthis.busy = false\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-plan__tree,\n.cn-plan__children {\n\tmargin: 0;\n\tpadding: 0;\n\tlist-style: none;\n}\n\n.cn-plan__children {\n\tpadding-inline-start: 24px;\n}\n\n.cn-plan__empty {\n\tmargin: 0;\n\tcolor: var(--color-text-maxcontrast);\n}\n</style>\n"],"names":["_openBlock","_createElementBlock","_createBlock","_createVNode","_Fragment","_renderList"],"mappings":";;;AASM,EAAA,KAAK,EAAC,SAAS;AAAC,EAAA,aAAA,EAAA,SAAA;;;;AAYN,EAAA,KAAA,EAAA,eAAA;;;;AAOE,EAAA,KAAA,EAAA,mBAAA;;;;;;;;;;;;;;AAnBf,EAAA,QAAAA,SAAA,EAAA,EAAAC,kBAAA,QAAA;KACoB,KAAO,CAAA,OAAA;iCAAA,CAAA,wBAAA,EAAA;;AAAA,UAAA,IAAA,EAAA,EAAA;;SACV,KAAA,CAAA,KAAA;wBAAjBC,WASgB,CAAA,yBAAA,EAAA;;AARf,YAAA,IAAI,EAAE,QAAC,CAAA,CAAA,CAAA,eAAA,EAAA,yBAAA,CAAA;AACN,YAAA,WAAU,EAAE,KAAK,CAAA,KAAA;yBACR,EAAA,eAAA;;AACD,YAAA,MAAA,UACT,MAEW;cAFXC,WAEW,CAAA,mBAAA,EAAA;AAFD,gBAAA,aAAI,EAAA,eAAA;AAAA,gBAAA,OAAA,EAAA,QAAA,CAAA,IAAA;;uCACwB;kDAAlC,QAAC,CAAA,CAAA,CAAA,eAAA,EAAA,WAAA,CAAA,CAAA,EAAA,CAAA,YAAA;;;;;;;AAIO,UAAA,CAAA,KAAA,CAAA,KAAA,CAAA,MAAA,GAAA,CAAA;6CAiBV,gBAAA,EAAA;gCAhBDF,kBAeA,CAAAG,QAAA,EAAA,IAAA,EAAAC,UAAA,CAfe,KAAA,CAAA,KAAA,EAAA,CAAN,IAAI,KAAA;qCAAbJ,kBAeA,CAAA,IAAA,EAAA;kBAfe,GAAA,EAAA,IAAA,CAAA,IAAA;AAAA,kBAAA,KAAA,EAAA,eAAA;;6BAKO,CAAA,0BAAA,EAAA;AAJL,oBAAA,IAAI,EAAE,IAAG;AACzB,oBAAA,MAAM,EAAE,QAAW,CAAA,WAAA;AACnB,oBAAA,IAAI,EAAE,KAAI,CAAA,IAAA;AACV,oBAAA,QAAM,EAAE,QAAM,CAAA,MAAA;AACb,oBAAA,YAAS,EAAE,QAAS,CAAA,UAAA;;mBACb,IAAI,CAAA,QAAA,CAAA,MAAA,GAAA,CAAA;uDAQT,gBAAA,EAAA;AAPF,yBAAAD,SAAA,CAAA,IAAA,CAAA,EAAAC,kBAAA,CAMGG,QANY,EAAA,IAAA,EAAAC,UAAA,CAAA,IAAA,CAAA,QAAA,GAAN,KAAK,KAAA;+CAAdJ,kBAMG,CAAA,IAAA,EAAA;4BANY,GAAA,EAAA,KAAA,CAAA,IAAA;AAAA,4BAAA,KAAA,EAAA,eAAA;;uCAKhB,CAAA,0BAAA,EAAA;AAJkB,8BAAA,IAAI,EAAE,KAAG;AACzB,8BAAA,MAAC,EAAA,QAAA,CAAA,WAAA;AACD,8BAAA,IAAA,EAAA,KAAA,CAAA,IAAA;AACD,8BAAA,QAAA,EAAA,QAAA,CAAA,MAAA;AACD,8BAAA,YAAA,EAAA,QAAA,CAAA,UAAA;;;;;;;;;;;;;;;"}
@@ -2,7 +2,7 @@ import script from './CnPlanWidgetRow.vue2.js';
2
2
  import { render } from './CnPlanWidgetRow.vue3.js';
3
3
 
4
4
  script.render = render;
5
- script.__scopeId = "data-v-45566f45";
5
+ script.__scopeId = "data-v-3c7f161a";
6
6
  const __sfc_main = script;
7
7
 
8
8
  export { __sfc_main as default };
@@ -21,6 +21,16 @@ var script = {
21
21
  required: true,
22
22
  },
23
23
 
24
+ /**
25
+ * The word per state that replaces the default, already translated.
26
+ *
27
+ * @type {object}
28
+ */
29
+ labels: {
30
+ type: Object,
31
+ default: () => ({}),
32
+ },
33
+
24
34
  /** A move is running. */
25
35
  busy: {
26
36
  type: Boolean,
@@ -41,12 +51,24 @@ var script = {
41
51
  t: translate,
42
52
 
43
53
  /**
44
- * The word for a state.
54
+ * The word for an item's state. A completed milestone is reached, and
55
+ * an optional item nobody has started reads as optional rather than
56
+ * waiting. `labels` replaces the word for a state.
45
57
  *
46
- * @param {string} state The state.
58
+ * @param {object} item The plan item.
47
59
  * @return {string}
48
60
  */
49
- stateLabel(state) {
61
+ stateLabel(item) {
62
+ const state = item.state;
63
+ if (typeof this.labels[state] === 'string' && this.labels[state] !== '') {
64
+ return this.labels[state]
65
+ }
66
+ if (state === 'completed' && item.type === 'milestone') {
67
+ return translate('nextcloud-vue', 'Reached')
68
+ }
69
+ if (item.discretionary && (state === 'available' || state === 'enabled')) {
70
+ return translate('nextcloud-vue', 'Optional')
71
+ }
50
72
  const labels = {
51
73
  available: translate('nextcloud-vue', 'Waiting'),
52
74
  enabled: translate('nextcloud-vue', 'Can start'),
@@ -1 +1 @@
1
- {"version":3,"file":"CnPlanWidgetRow.vue2.js","sources":["../../../../src/components/CnPlanWidget/CnPlanWidgetRow.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n<template>\n\t<div class=\"cn-plan-row\" :data-testid=\"`cn-plan-row-${item.key || item.uuid}`\">\n\t\t<span class=\"cn-plan-row__text\">\n\t\t\t<span class=\"cn-plan-row__name\">{{ item.name }}</span>\n\t\t\t<span v-if=\"item.description\" class=\"cn-plan-row__meta\" data-testid=\"cn-plan-row-meta\">{{ item.description }}</span>\n\t\t</span>\n\t\t<span class=\"cn-plan-row__state\" :data-state=\"item.state\">{{ stateLabel(item.state) }}</span>\n\t\t<NcButton v-if=\"item.state === 'enabled' && item.discretionary\"\n\t\t\t:disabled=\"busy\"\n\t\t\t:data-testid=\"`cn-plan-enable-${item.key || item.uuid}`\"\n\t\t\t@click=\"$emit('enable', item)\">\n\t\t\t{{ t('nextcloud-vue', 'Start') }}\n\t\t</NcButton>\n\t\t<NcButton v-for=\"target in targets\"\n\t\t\t:key=\"target\"\n\t\t\t:disabled=\"busy\"\n\t\t\t:data-testid=\"`cn-plan-${target}-${item.key || item.uuid}`\"\n\t\t\t@click=\"$emit('transition', item, target)\">\n\t\t\t{{ target === 'completed' ? t('nextcloud-vue', 'Complete') : t('nextcloud-vue', 'Stop') }}\n\t\t</NcButton>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcButton } from '@nextcloud/vue'\nimport { offeredTransitions } from '../../utils/planTree.js'\n\n/**\n * One plan item in CnPlanWidget: its name, its state and the moves offered.\n */\nexport default {\n\tname: 'CnPlanWidgetRow',\n\n\tcomponents: { NcButton },\n\n\tprops: {\n\t\t/**\n\t\t * The plan item (`uuid`, `key`, `name`, `state`, `type`, `discretionary`).\n\t\t *\n\t\t * @type {object}\n\t\t */\n\t\titem: {\n\t\t\ttype: Object,\n\t\t\trequired: true,\n\t\t},\n\n\t\t/** A move is running. */\n\t\tbusy: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\t},\n\n\temits: ['enable', 'transition'],\n\n\tcomputed: {\n\t\t/** @return {string[]} The moves offered. */\n\t\ttargets() {\n\t\t\treturn offeredTransitions(this.item)\n\t\t},\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * The word for a state.\n\t\t *\n\t\t * @param {string} state The state.\n\t\t * @return {string}\n\t\t */\n\t\tstateLabel(state) {\n\t\t\tconst labels = {\n\t\t\t\tavailable: t('nextcloud-vue', 'Waiting'),\n\t\t\t\tenabled: t('nextcloud-vue', 'Can start'),\n\t\t\t\tactive: t('nextcloud-vue', 'In progress'),\n\t\t\t\tcompleted: t('nextcloud-vue', 'Done'),\n\t\t\t\tterminated: t('nextcloud-vue', 'Stopped'),\n\t\t\t\tdisabled: t('nextcloud-vue', 'Not needed'),\n\t\t\t}\n\t\t\treturn labels[state] || String(state || '')\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-plan-row {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\talign-items: center;\n\tgap: 8px;\n\tpadding-block: 6px;\n}\n\n.cn-plan-row__text {\n\tdisplay: flex;\n\tflex: 1 1 auto;\n\tflex-direction: column;\n\tgap: 2px;\n\tmin-width: 0;\n}\n\n.cn-plan-row__name {\n\tfont-weight: 600;\n}\n\n.cn-plan-row__meta {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 13px;\n}\n\n.cn-plan-row__state {\n\tpadding: 2px 10px;\n\tborder-radius: 12px;\n\tbackground: var(--color-background-dark);\n\tfont-size: 13px;\n}\n\n.cn-plan-row__state[data-state='active'] {\n\tbackground: var(--color-primary-element-light);\n}\n\n.cn-plan-row__state[data-state='completed'] {\n\tcolor: var(--color-success-text, var(--color-success));\n}\n</style>\n"],"names":["t"],"mappings":";;;;AAgCA;;;AAGA,aAAe;CACd,IAAI,EAAE,iBAAiB;;AAEvB,CAAA,UAAU,EAAE,EAAE,UAAU;;AAExB,CAAA,KAAK,EAAE;AACN;AACC;AACA;;;EAGD,IAAI,EAAE;GACL,IAAI,EAAE,MAAM;GACZ,QAAQ,EAAE,IAAI;GACd;;AAED;EACA,IAAI,EAAE;GACL,IAAI,EAAE,OAAO;GACb,OAAO,EAAE,KAAK;GACd;EACD;;CAED,KAAK,EAAE,CAAC,QAAQ,EAAE,YAAY,CAAC;;AAE/B,CAAA,QAAQ,EAAE;AACT;AACA,EAAA,OAAO,GAAG;AACT,GAAA,OAAO,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAA;GACnC;EACD;;AAED,CAAA,OAAO,EAAE;KACRA,SAAC;;AAED;AACC;AACA;;AAEA;;AAED,EAAA,UAAU,CAAC,KAAK,EAAE;GACjB,MAAM,MAAK,GAAI;AACd,IAAA,SAAS,EAAEA,SAAC,CAAC,eAAe,EAAE,SAAS,CAAC;AACxC,IAAA,OAAO,EAAEA,SAAC,CAAC,eAAe,EAAE,WAAW,CAAC;AACxC,IAAA,MAAM,EAAEA,SAAC,CAAC,eAAe,EAAE,aAAa,CAAC;AACzC,IAAA,SAAS,EAAEA,SAAC,CAAC,eAAe,EAAE,MAAM,CAAC;AACrC,IAAA,UAAU,EAAEA,SAAC,CAAC,eAAe,EAAE,SAAS,CAAC;AACzC,IAAA,QAAQ,EAAEA,SAAC,CAAC,eAAe,EAAE,YAAY,CAAC;AAC3C,KAAA;AACA,GAAA,OAAO,MAAM,CAAC,KAAK,CAAE,IAAG,MAAM,CAAC,KAAI,IAAK,EAAE,CAAA;GAC1C;EACD;AACF;;;;"}
1
+ {"version":3,"file":"CnPlanWidgetRow.vue2.js","sources":["../../../../src/components/CnPlanWidget/CnPlanWidgetRow.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n<template>\n\t<div class=\"cn-plan-row\" :data-testid=\"`cn-plan-row-${item.key || item.uuid}`\">\n\t\t<span class=\"cn-plan-row__text\">\n\t\t\t<span class=\"cn-plan-row__name\">{{ item.name }}</span>\n\t\t\t<span v-if=\"item.description\" class=\"cn-plan-row__meta\" data-testid=\"cn-plan-row-meta\">{{ item.description }}</span>\n\t\t</span>\n\t\t<span class=\"cn-plan-row__state\" :data-state=\"item.state\">{{ stateLabel(item) }}</span>\n\t\t<NcButton v-if=\"item.state === 'enabled' && item.discretionary\"\n\t\t\t:disabled=\"busy\"\n\t\t\t:data-testid=\"`cn-plan-enable-${item.key || item.uuid}`\"\n\t\t\t@click=\"$emit('enable', item)\">\n\t\t\t{{ t('nextcloud-vue', 'Start') }}\n\t\t</NcButton>\n\t\t<NcButton v-for=\"target in targets\"\n\t\t\t:key=\"target\"\n\t\t\t:disabled=\"busy\"\n\t\t\t:data-testid=\"`cn-plan-${target}-${item.key || item.uuid}`\"\n\t\t\t@click=\"$emit('transition', item, target)\">\n\t\t\t{{ target === 'completed' ? t('nextcloud-vue', 'Complete') : t('nextcloud-vue', 'Stop') }}\n\t\t</NcButton>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcButton } from '@nextcloud/vue'\nimport { offeredTransitions } from '../../utils/planTree.js'\n\n/**\n * One plan item in CnPlanWidget: its name, its state and the moves offered.\n */\nexport default {\n\tname: 'CnPlanWidgetRow',\n\n\tcomponents: { NcButton },\n\n\tprops: {\n\t\t/**\n\t\t * The plan item (`uuid`, `key`, `name`, `state`, `type`, `discretionary`).\n\t\t *\n\t\t * @type {object}\n\t\t */\n\t\titem: {\n\t\t\ttype: Object,\n\t\t\trequired: true,\n\t\t},\n\n\t\t/**\n\t\t * The word per state that replaces the default, already translated.\n\t\t *\n\t\t * @type {object}\n\t\t */\n\t\tlabels: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/** A move is running. */\n\t\tbusy: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\t},\n\n\temits: ['enable', 'transition'],\n\n\tcomputed: {\n\t\t/** @return {string[]} The moves offered. */\n\t\ttargets() {\n\t\t\treturn offeredTransitions(this.item)\n\t\t},\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * The word for an item's state. A completed milestone is reached, and\n\t\t * an optional item nobody has started reads as optional rather than\n\t\t * waiting. `labels` replaces the word for a state.\n\t\t *\n\t\t * @param {object} item The plan item.\n\t\t * @return {string}\n\t\t */\n\t\tstateLabel(item) {\n\t\t\tconst state = item.state\n\t\t\tif (typeof this.labels[state] === 'string' && this.labels[state] !== '') {\n\t\t\t\treturn this.labels[state]\n\t\t\t}\n\t\t\tif (state === 'completed' && item.type === 'milestone') {\n\t\t\t\treturn t('nextcloud-vue', 'Reached')\n\t\t\t}\n\t\t\tif (item.discretionary && (state === 'available' || state === 'enabled')) {\n\t\t\t\treturn t('nextcloud-vue', 'Optional')\n\t\t\t}\n\t\t\tconst labels = {\n\t\t\t\tavailable: t('nextcloud-vue', 'Waiting'),\n\t\t\t\tenabled: t('nextcloud-vue', 'Can start'),\n\t\t\t\tactive: t('nextcloud-vue', 'In progress'),\n\t\t\t\tcompleted: t('nextcloud-vue', 'Done'),\n\t\t\t\tterminated: t('nextcloud-vue', 'Stopped'),\n\t\t\t\tdisabled: t('nextcloud-vue', 'Not needed'),\n\t\t\t}\n\t\t\treturn labels[state] || String(state || '')\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-plan-row {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\talign-items: center;\n\tgap: 8px;\n\tpadding-block: 6px;\n}\n\n.cn-plan-row__text {\n\tdisplay: flex;\n\tflex: 1 1 auto;\n\tflex-direction: column;\n\tgap: 2px;\n\tmin-width: 0;\n}\n\n.cn-plan-row__name {\n\tfont-weight: 600;\n}\n\n.cn-plan-row__meta {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 13px;\n}\n\n.cn-plan-row__state {\n\tpadding: 2px 10px;\n\tborder-radius: 12px;\n\tbackground: var(--color-background-dark);\n\tfont-size: 13px;\n}\n\n.cn-plan-row__state[data-state='active'] {\n\tbackground: var(--color-primary-element-light);\n}\n\n.cn-plan-row__state[data-state='completed'] {\n\tcolor: var(--color-success-text, var(--color-success));\n}\n</style>\n"],"names":["t"],"mappings":";;;;AAgCA;;;AAGA,aAAe;CACd,IAAI,EAAE,iBAAiB;;AAEvB,CAAA,UAAU,EAAE,EAAE,UAAU;;AAExB,CAAA,KAAK,EAAE;AACN;AACC;AACA;;;EAGD,IAAI,EAAE;GACL,IAAI,EAAE,MAAM;GACZ,QAAQ,EAAE,IAAI;GACd;;AAED;;AAEC;;;AAGD,EAAA,MAAM,EAAE;GACP,IAAI,EAAE,MAAM;AACZ,GAAA,OAAO,EAAE,OAAO,EAAE,CAAC;GACnB;;AAED;EACA,IAAI,EAAE;GACL,IAAI,EAAE,OAAO;GACb,OAAO,EAAE,KAAK;GACd;EACD;;CAED,KAAK,EAAE,CAAC,QAAQ,EAAE,YAAY,CAAC;;AAE/B,CAAA,QAAQ,EAAE;AACT;AACA,EAAA,OAAO,GAAG;AACT,GAAA,OAAO,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAA;GACnC;EACD;;AAED,CAAA,OAAO,EAAE;KACRA,SAAC;;AAED;;;AAGC;AACA;AACA;AACA;;AAED,EAAA,UAAU,CAAC,IAAI,EAAE;AAChB,GAAA,MAAM,KAAI,GAAI,IAAI,CAAC,MAAI;AACvB,GAAA,IAAI,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAA,KAAM,QAAO,IAAK,IAAI,CAAC,MAAM,CAAC,KAAK,CAAA,KAAM,EAAE,EAAE;IACxE,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAA;AACzB,IAAA;GACA,IAAI,KAAI,KAAM,WAAU,IAAK,IAAI,CAAC,IAAG,KAAM,WAAW,EAAE;AACvD,IAAA,OAAOA,SAAC,CAAC,eAAe,EAAE,SAAS,CAAA;AACpC,IAAA;AACA,GAAA,IAAI,IAAI,CAAC,aAAY,KAAM,KAAI,KAAM,WAAY,IAAG,KAAI,KAAM,SAAS,CAAC,EAAE;AACzE,IAAA,OAAOA,SAAC,CAAC,eAAe,EAAE,UAAU,CAAA;AACrC,IAAA;GACA,MAAM,MAAK,GAAI;AACd,IAAA,SAAS,EAAEA,SAAC,CAAC,eAAe,EAAE,SAAS,CAAC;AACxC,IAAA,OAAO,EAAEA,SAAC,CAAC,eAAe,EAAE,WAAW,CAAC;AACxC,IAAA,MAAM,EAAEA,SAAC,CAAC,eAAe,EAAE,aAAa,CAAC;AACzC,IAAA,SAAS,EAAEA,SAAC,CAAC,eAAe,EAAE,MAAM,CAAC;AACrC,IAAA,UAAU,EAAEA,SAAC,CAAC,eAAe,EAAE,SAAS,CAAC;AACzC,IAAA,QAAQ,EAAEA,SAAC,CAAC,eAAe,EAAE,YAAY,CAAC;AAC3C,KAAA;AACA,GAAA,OAAO,MAAM,CAAC,KAAK,CAAE,IAAG,MAAM,CAAC,KAAI,IAAK,EAAE,CAAA;GAC1C;EACD;AACF;;;;"}
@@ -26,7 +26,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
26
26
  createElementVNode("span", {
27
27
  class: "cn-plan-row__state",
28
28
  "data-state": $props.item.state
29
- }, toDisplayString($options.stateLabel($props.item.state)), 9 /* TEXT, PROPS */, _hoisted_5),
29
+ }, toDisplayString($options.stateLabel($props.item)), 9 /* TEXT, PROPS */, _hoisted_5),
30
30
  ($props.item.state === 'enabled' && $props.item.discretionary)
31
31
  ? (openBlock(), createBlock(_component_NcButton, {
32
32
  key: 0,
@@ -1 +1 @@
1
- {"version":3,"file":"CnPlanWidgetRow.vue3.js","sources":["../../../../src/components/CnPlanWidget/CnPlanWidgetRow.vue?vue&type=template&id=45566f45&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n<template>\n\t<div class=\"cn-plan-row\" :data-testid=\"`cn-plan-row-${item.key || item.uuid}`\">\n\t\t<span class=\"cn-plan-row__text\">\n\t\t\t<span class=\"cn-plan-row__name\">{{ item.name }}</span>\n\t\t\t<span v-if=\"item.description\" class=\"cn-plan-row__meta\" data-testid=\"cn-plan-row-meta\">{{ item.description }}</span>\n\t\t</span>\n\t\t<span class=\"cn-plan-row__state\" :data-state=\"item.state\">{{ stateLabel(item.state) }}</span>\n\t\t<NcButton v-if=\"item.state === 'enabled' && item.discretionary\"\n\t\t\t:disabled=\"busy\"\n\t\t\t:data-testid=\"`cn-plan-enable-${item.key || item.uuid}`\"\n\t\t\t@click=\"$emit('enable', item)\">\n\t\t\t{{ t('nextcloud-vue', 'Start') }}\n\t\t</NcButton>\n\t\t<NcButton v-for=\"target in targets\"\n\t\t\t:key=\"target\"\n\t\t\t:disabled=\"busy\"\n\t\t\t:data-testid=\"`cn-plan-${target}-${item.key || item.uuid}`\"\n\t\t\t@click=\"$emit('transition', item, target)\">\n\t\t\t{{ target === 'completed' ? t('nextcloud-vue', 'Complete') : t('nextcloud-vue', 'Stop') }}\n\t\t</NcButton>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcButton } from '@nextcloud/vue'\nimport { offeredTransitions } from '../../utils/planTree.js'\n\n/**\n * One plan item in CnPlanWidget: its name, its state and the moves offered.\n */\nexport default {\n\tname: 'CnPlanWidgetRow',\n\n\tcomponents: { NcButton },\n\n\tprops: {\n\t\t/**\n\t\t * The plan item (`uuid`, `key`, `name`, `state`, `type`, `discretionary`).\n\t\t *\n\t\t * @type {object}\n\t\t */\n\t\titem: {\n\t\t\ttype: Object,\n\t\t\trequired: true,\n\t\t},\n\n\t\t/** A move is running. */\n\t\tbusy: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\t},\n\n\temits: ['enable', 'transition'],\n\n\tcomputed: {\n\t\t/** @return {string[]} The moves offered. */\n\t\ttargets() {\n\t\t\treturn offeredTransitions(this.item)\n\t\t},\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * The word for a state.\n\t\t *\n\t\t * @param {string} state The state.\n\t\t * @return {string}\n\t\t */\n\t\tstateLabel(state) {\n\t\t\tconst labels = {\n\t\t\t\tavailable: t('nextcloud-vue', 'Waiting'),\n\t\t\t\tenabled: t('nextcloud-vue', 'Can start'),\n\t\t\t\tactive: t('nextcloud-vue', 'In progress'),\n\t\t\t\tcompleted: t('nextcloud-vue', 'Done'),\n\t\t\t\tterminated: t('nextcloud-vue', 'Stopped'),\n\t\t\t\tdisabled: t('nextcloud-vue', 'Not needed'),\n\t\t\t}\n\t\t\treturn labels[state] || String(state || '')\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-plan-row {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\talign-items: center;\n\tgap: 8px;\n\tpadding-block: 6px;\n}\n\n.cn-plan-row__text {\n\tdisplay: flex;\n\tflex: 1 1 auto;\n\tflex-direction: column;\n\tgap: 2px;\n\tmin-width: 0;\n}\n\n.cn-plan-row__name {\n\tfont-weight: 600;\n}\n\n.cn-plan-row__meta {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 13px;\n}\n\n.cn-plan-row__state {\n\tpadding: 2px 10px;\n\tborder-radius: 12px;\n\tbackground: var(--color-background-dark);\n\tfont-size: 13px;\n}\n\n.cn-plan-row__state[data-state='active'] {\n\tbackground: var(--color-primary-element-light);\n}\n\n.cn-plan-row__state[data-state='completed'] {\n\tcolor: var(--color-success-text, var(--color-success));\n}\n</style>\n"],"names":["_createElementBlock","_createElementVNode","_toDisplayString","_openBlock","_createBlock"],"mappings":";;;AAUQ,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,mBAAmB,GAAA;AACxB,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,mBAAmB,GAAA;;;AAChB,EAAA,KAAA,EAAA,mBAAA;AAAA,EAAA,aAAA,EAAA,kBAAA;;;;;;;uBAHhBA;AAAI,IAAA,KAAE,EAAA,aAAA;AAAA,IAAA,aAAA,iBAAA,MAAA,CAAA,IAAA,CAAA,GAAA,IAAA,MAAA,CAAA,IAAA,CAAA,IAAA,CAAA,CAAA;;AACN,IAAAC,kBAAA,CAGO,QAHP,UAGO,EAAA;AAFN,MAAAA,kBAAA,CAAsD,MAAtD,EAAA,UAAsD,EAAnBC,eAAA,CAAA,MAAA,CAAA,IAAG,CAAE,IAAI,CAAA,EAAA,CAAA,YAAA;AAChC,MAAA,CAAA,MAAA,CAAA,IAAG,CAAA,WAAA;AAAf,WAAAC,SAAA,EAAA,EAAAH,kBAAA,CAAe,MAAf,EAAA,UAAe,EAAAE,eAAA,CAAA,MAAA,CAAA,IAAA,CAAA,WAAA,CAAA,EAAA,CAAA,YAAA;;;sBAEe,CAAA,MAAA,EAAA;AAAzB,MAAA,KAAK,EAAC,oBAAmB;MAAA,YAAA,EAAA,MAAA,CAAA,IAAA,CAAA,KAAA;uBAAA,QAAA,CAAA,UAAA,CAAA,MAAA,CAAA,IAAA,CAAA,KAAA,CAAA,CAAA,EAAA,CAAA,oBAAA,UAAA,CAAA;AACf,IAAA,CAAA,MAAA,CAAA,IAAI,CAAC,KAAK,KAAO,SAAA,IAAA,MAAA,CAAA,IAAA,CAAA,aAAA;iCAKtB,CAAA,mBAAA,EAAA;;AAJT,UAAA,QAAQ,EAAA,MAAA,CAAA,IAAA;AACR,UAAA,aAAW,oBAAoB,MAAC,CAAA,IAAA,CAAA,GAAA,IAAA,MAAA,CAAA,IAAA,CAAA,IAAA,CAAA,CAAA;UAChC,OAAK,EAAA,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,MAAA,KAAE,IAAI,CAAA,KAAA,CAAA,QAAA,EAAA,MAAA,CAAA,IAAA,CAAA,CAAA,CAAA;;2BACZ,MAAe;4CAAZ,QAAC,CAAA,CAAA,CAAA,eAAA,EAAA,OAAA,CAAA,CAAA,EAAA,CAAA,YAAA;;;;;sBAEJF,8CAA0B,QAAM,CAAA,OAAA,EAAA,CAAhB,MAAM,KAAA;2BAAtBI;AACC,QAAA,GAAG,EAAE,MAAM;AACX,QAAA,QAAQ,EAAA,MAAA,CAAA,IAAA;QACR,aAAE,EAAA,CAAA,QAAA,EAAA,MAAA,CAAA,CAAA,EAAA,MAAA,CAAA,IAAA,CAAA,GAAA,IAAA,MAAA,CAAA,IAAA,CAAA,IAAA,CAAA,CAAA;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"CnPlanWidgetRow.vue3.js","sources":["../../../../src/components/CnPlanWidget/CnPlanWidgetRow.vue?vue&type=template&id=3c7f161a&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n<template>\n\t<div class=\"cn-plan-row\" :data-testid=\"`cn-plan-row-${item.key || item.uuid}`\">\n\t\t<span class=\"cn-plan-row__text\">\n\t\t\t<span class=\"cn-plan-row__name\">{{ item.name }}</span>\n\t\t\t<span v-if=\"item.description\" class=\"cn-plan-row__meta\" data-testid=\"cn-plan-row-meta\">{{ item.description }}</span>\n\t\t</span>\n\t\t<span class=\"cn-plan-row__state\" :data-state=\"item.state\">{{ stateLabel(item) }}</span>\n\t\t<NcButton v-if=\"item.state === 'enabled' && item.discretionary\"\n\t\t\t:disabled=\"busy\"\n\t\t\t:data-testid=\"`cn-plan-enable-${item.key || item.uuid}`\"\n\t\t\t@click=\"$emit('enable', item)\">\n\t\t\t{{ t('nextcloud-vue', 'Start') }}\n\t\t</NcButton>\n\t\t<NcButton v-for=\"target in targets\"\n\t\t\t:key=\"target\"\n\t\t\t:disabled=\"busy\"\n\t\t\t:data-testid=\"`cn-plan-${target}-${item.key || item.uuid}`\"\n\t\t\t@click=\"$emit('transition', item, target)\">\n\t\t\t{{ target === 'completed' ? t('nextcloud-vue', 'Complete') : t('nextcloud-vue', 'Stop') }}\n\t\t</NcButton>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcButton } from '@nextcloud/vue'\nimport { offeredTransitions } from '../../utils/planTree.js'\n\n/**\n * One plan item in CnPlanWidget: its name, its state and the moves offered.\n */\nexport default {\n\tname: 'CnPlanWidgetRow',\n\n\tcomponents: { NcButton },\n\n\tprops: {\n\t\t/**\n\t\t * The plan item (`uuid`, `key`, `name`, `state`, `type`, `discretionary`).\n\t\t *\n\t\t * @type {object}\n\t\t */\n\t\titem: {\n\t\t\ttype: Object,\n\t\t\trequired: true,\n\t\t},\n\n\t\t/**\n\t\t * The word per state that replaces the default, already translated.\n\t\t *\n\t\t * @type {object}\n\t\t */\n\t\tlabels: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/** A move is running. */\n\t\tbusy: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\t},\n\n\temits: ['enable', 'transition'],\n\n\tcomputed: {\n\t\t/** @return {string[]} The moves offered. */\n\t\ttargets() {\n\t\t\treturn offeredTransitions(this.item)\n\t\t},\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * The word for an item's state. A completed milestone is reached, and\n\t\t * an optional item nobody has started reads as optional rather than\n\t\t * waiting. `labels` replaces the word for a state.\n\t\t *\n\t\t * @param {object} item The plan item.\n\t\t * @return {string}\n\t\t */\n\t\tstateLabel(item) {\n\t\t\tconst state = item.state\n\t\t\tif (typeof this.labels[state] === 'string' && this.labels[state] !== '') {\n\t\t\t\treturn this.labels[state]\n\t\t\t}\n\t\t\tif (state === 'completed' && item.type === 'milestone') {\n\t\t\t\treturn t('nextcloud-vue', 'Reached')\n\t\t\t}\n\t\t\tif (item.discretionary && (state === 'available' || state === 'enabled')) {\n\t\t\t\treturn t('nextcloud-vue', 'Optional')\n\t\t\t}\n\t\t\tconst labels = {\n\t\t\t\tavailable: t('nextcloud-vue', 'Waiting'),\n\t\t\t\tenabled: t('nextcloud-vue', 'Can start'),\n\t\t\t\tactive: t('nextcloud-vue', 'In progress'),\n\t\t\t\tcompleted: t('nextcloud-vue', 'Done'),\n\t\t\t\tterminated: t('nextcloud-vue', 'Stopped'),\n\t\t\t\tdisabled: t('nextcloud-vue', 'Not needed'),\n\t\t\t}\n\t\t\treturn labels[state] || String(state || '')\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-plan-row {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\talign-items: center;\n\tgap: 8px;\n\tpadding-block: 6px;\n}\n\n.cn-plan-row__text {\n\tdisplay: flex;\n\tflex: 1 1 auto;\n\tflex-direction: column;\n\tgap: 2px;\n\tmin-width: 0;\n}\n\n.cn-plan-row__name {\n\tfont-weight: 600;\n}\n\n.cn-plan-row__meta {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 13px;\n}\n\n.cn-plan-row__state {\n\tpadding: 2px 10px;\n\tborder-radius: 12px;\n\tbackground: var(--color-background-dark);\n\tfont-size: 13px;\n}\n\n.cn-plan-row__state[data-state='active'] {\n\tbackground: var(--color-primary-element-light);\n}\n\n.cn-plan-row__state[data-state='completed'] {\n\tcolor: var(--color-success-text, var(--color-success));\n}\n</style>\n"],"names":["_createElementBlock","_createElementVNode","_toDisplayString","_openBlock","_createBlock"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KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,MAAA,KAAE,IAAI,CAAA,KAAA,CAAA,QAAA,EAAA,MAAA,CAAA,IAAA,CAAA,CAAA,CAAA;;2BACZ,MAAe;4CAAZ,QAAC,CAAA,CAAA,CAAA,eAAA,EAAA,OAAA,CAAA,CAAA,EAAA,CAAA,YAAA;;;;;sBAEJF,8CAA0B,QAAM,CAAA,OAAA,EAAA,CAAhB,MAAM,KAAA;2BAAtBI;AACC,QAAA,GAAG,EAAE,MAAM;AACX,QAAA,QAAQ,EAAA,MAAA,CAAA,IAAA;QACR,aAAE,EAAA,CAAA,QAAA,EAAA,MAAA,CAAA,CAAA,EAAA,MAAA,CAAA,IAAA,CAAA,GAAA,IAAA,MAAA,CAAA,IAAA,CAAA,IAAA,CAAA,CAAA;;;;;;;;;;;;;;"}
@@ -2,7 +2,7 @@ import script from './CnRecordListWidget.vue2.js';
2
2
  import { render } from './CnRecordListWidget.vue3.js';
3
3
 
4
4
  script.render = render;
5
- script.__scopeId = "data-v-60a08dcb";
5
+ script.__scopeId = "data-v-2d6d1351";
6
6
  const __sfc_main = script;
7
7
 
8
8
  export { __sfc_main as default };
@@ -303,6 +303,18 @@ var script = {
303
303
  return Boolean(avatar && typeof avatar === 'object' && Number(avatar.size) === 32)
304
304
  },
305
305
 
306
+ /**
307
+ * Whether the avatar is tinted with the primary colour (`avatar.tone:
308
+ * "primary"`), as DqZaakGerelateerd draws a related case's type initials.
309
+ *
310
+ * @return {boolean}
311
+ * @spec openspec/changes/record-list-avatar-tone/specs/record-list-avatar/spec.md#requirement-a-record-list-avatar-can-carry-the-primary-tint
312
+ */
313
+ avatarPrimary() {
314
+ const avatar = this.content?.avatar;
315
+ return Boolean(avatar && typeof avatar === 'object' && avatar.tone === 'primary')
316
+ },
317
+
306
318
  /** @return {boolean} Whether a row's pill comes before its title (`pillAt: "start"`). */
307
319
  pillFirst() {
308
320
  return this.content?.pillAt === 'start'
@@ -563,6 +575,7 @@ var script = {
563
575
  tag: link ? 'router-link' : 'div',
564
576
  attrs: link ? { to: link } : {},
565
577
  initials: this.initialsFor(row),
578
+ avatarTone: this.avatarToneFor(row),
566
579
  title: this.fill(c.title || (row !== raw ? '{value}' : ''), row),
567
580
  meta: this.metaOf(row),
568
581
  text: this.fill(c.text, row),
@@ -1281,6 +1294,23 @@ var script = {
1281
1294
  return { value, max, share, over }
1282
1295
  },
1283
1296
 
1297
+ /**
1298
+ * The tone of a row's initials, from `avatar.tone: { field, map }`
1299
+ * (`{ field: "status", map: { requested: "warning" } }`: an open advice
1300
+ * request's initials on the warning tint, DqZaakBesluiten); '' without.
1301
+ *
1302
+ * @param {object} row The row.
1303
+ * @return {string} A status variant, or ''.
1304
+ */
1305
+ avatarToneFor(row) {
1306
+ const tone = this.content?.avatar?.tone;
1307
+ if (!tone || typeof tone !== 'object' || typeof tone.field !== 'string' || !tone.map || typeof tone.map !== 'object') {
1308
+ return ''
1309
+ }
1310
+ const variant = tone.map[String(readPath(row, tone.field) ?? '')];
1311
+ return ['default', 'success', 'warning', 'error', 'info', 'purple', 'teal'].includes(variant) ? variant : ''
1312
+ },
1313
+
1284
1314
  /**
1285
1315
  * The initials of the row's avatar (`avatar`: a name template such as
1286
1316
  * `"{client.name}"`, or `{ text }`), or '' without one.
@@ -1430,7 +1460,7 @@ var script = {
1430
1460
  ? { label, tag: 'a', attrs: { href: link.href, target: '_blank', rel: 'noopener' } }
1431
1461
  : { label, tag: 'router-link', attrs: { to: link.to } }
1432
1462
  }
1433
- return { label, tag: 'button', attrs: { type: 'button' } }
1463
+ return { label, tag: 'button', attrs: { type: 'button' }, icon: typeof action.icon === 'string' ? action.icon : '' }
1434
1464
  },
1435
1465
 
1436
1466
  /**