@conduction/nextcloud-vue 2.154.0 → 2.156.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 (98) hide show
  1. package/dist/esm/components/CnAiCompanion/CnAiInput.vue2.js +3 -1
  2. package/dist/esm/components/CnAiCompanion/CnAiInput.vue2.js.map +1 -1
  3. package/dist/esm/components/CnAiCompanion/CnAiInput.vue3.js.map +1 -1
  4. package/dist/esm/components/CnAppRoot/CnAppRoot.vue2.js.map +1 -1
  5. package/dist/esm/components/CnAppRoot/CnAppRoot.vue3.js +2 -2
  6. package/dist/esm/components/CnAppRoot/CnAppRoot.vue3.js.map +1 -1
  7. package/dist/esm/components/CnAssignDialog/CnAssignDialog.vue.js +1 -1
  8. package/dist/esm/components/CnAssignDialog/CnAssignDialog.vue2.js +10 -5
  9. package/dist/esm/components/CnAssignDialog/CnAssignDialog.vue2.js.map +1 -1
  10. package/dist/esm/components/CnAssignDialog/CnAssignDialog.vue3.js.map +1 -1
  11. package/dist/esm/components/CnAttentionFlagWidget/CnAttentionFlagWidget.vue.js +1 -1
  12. package/dist/esm/components/CnAttentionFlagWidget/CnAttentionFlagWidget.vue2.js.map +1 -1
  13. package/dist/esm/components/CnAttentionFlagWidget/CnAttentionFlagWidget.vue3.js +2 -0
  14. package/dist/esm/components/CnAttentionFlagWidget/CnAttentionFlagWidget.vue3.js.map +1 -1
  15. package/dist/esm/components/CnChoiceCards/CnChoiceCards.vue.js +1 -1
  16. package/dist/esm/components/CnChoiceCards/CnChoiceCards.vue2.js.map +1 -1
  17. package/dist/esm/components/CnChoiceCards/CnChoiceCards.vue3.js.map +1 -1
  18. package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue.js +1 -1
  19. package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue2.js.map +1 -1
  20. package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue3.js.map +1 -1
  21. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue.js +1 -1
  22. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue2.js.map +1 -1
  23. package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue3.js.map +1 -1
  24. package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue.js +1 -1
  25. package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue2.js +9 -8
  26. package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue2.js.map +1 -1
  27. package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue3.js.map +1 -1
  28. package/dist/esm/components/CnIndexSidebar/CnIndexSidebar.vue2.js +13 -4
  29. package/dist/esm/components/CnIndexSidebar/CnIndexSidebar.vue2.js.map +1 -1
  30. package/dist/esm/components/CnIndexSidebar/CnIndexSidebar.vue3.js.map +1 -1
  31. package/dist/esm/components/CnLinkedWidget/CnLinkedWidget.vue.js +1 -1
  32. package/dist/esm/components/CnLinkedWidget/CnLinkedWidget.vue2.js +91 -7
  33. package/dist/esm/components/CnLinkedWidget/CnLinkedWidget.vue2.js.map +1 -1
  34. package/dist/esm/components/CnLinkedWidget/CnLinkedWidget.vue3.js.map +1 -1
  35. package/dist/esm/components/CnMapWidget/CnMapWidget.vue.js +1 -1
  36. package/dist/esm/components/CnMapWidget/CnMapWidget.vue2.js +37 -0
  37. package/dist/esm/components/CnMapWidget/CnMapWidget.vue2.js.map +1 -1
  38. package/dist/esm/components/CnMapWidget/CnMapWidget.vue3.js +16 -7
  39. package/dist/esm/components/CnMapWidget/CnMapWidget.vue3.js.map +1 -1
  40. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue.js +1 -1
  41. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js +2 -1
  42. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js.map +1 -1
  43. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js +1 -1
  44. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js.map +1 -1
  45. package/dist/esm/components/CnSavedViewMenuSettings/CnSavedViewMenuSettings.vue.js +1 -1
  46. package/dist/esm/components/CnSavedViewMenuSettings/CnSavedViewMenuSettings.vue2.js.map +1 -1
  47. package/dist/esm/components/CnSavedViewMenuSettings/CnSavedViewMenuSettings.vue3.js.map +1 -1
  48. package/dist/esm/components/CnSchemaFormDialog/CnSchemaConfigurationTab.vue2.js +25 -0
  49. package/dist/esm/components/CnSchemaFormDialog/CnSchemaConfigurationTab.vue2.js.map +1 -1
  50. package/dist/esm/components/CnSchemaFormDialog/CnSchemaConfigurationTab.vue3.js +40 -8
  51. package/dist/esm/components/CnSchemaFormDialog/CnSchemaConfigurationTab.vue3.js.map +1 -1
  52. package/dist/esm/components/CnSchemaFormDialog/CnSchemaFormDialog.vue2.js +10 -0
  53. package/dist/esm/components/CnSchemaFormDialog/CnSchemaFormDialog.vue2.js.map +1 -1
  54. package/dist/esm/components/CnSchemaFormDialog/CnSchemaFormDialog.vue3.js.map +1 -1
  55. package/dist/esm/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue.js +1 -1
  56. package/dist/esm/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue2.js +24 -1
  57. package/dist/esm/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue2.js.map +1 -1
  58. package/dist/esm/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue3.js +9 -0
  59. package/dist/esm/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue3.js.map +1 -1
  60. package/dist/esm/components/CnUserSettingsDialog/CnUserSettingsDialog.vue.js +1 -1
  61. package/dist/esm/components/CnUserSettingsDialog/CnUserSettingsDialog.vue2.js.map +1 -1
  62. package/dist/esm/components/CnUserSettingsDialog/CnUserSettingsDialog.vue3.js.map +1 -1
  63. package/dist/esm/l10n/en.json.js +12 -7
  64. package/dist/esm/l10n/en.json.js.map +1 -1
  65. package/dist/esm/l10n/nl.json.js +14 -9
  66. package/dist/esm/l10n/nl.json.js.map +1 -1
  67. package/dist/esm/library-style.js +1 -1
  68. package/dist/esm/nextcloud-vue.css +604 -375
  69. package/dist/esm/utils/groupSublines.js +30 -12
  70. package/dist/esm/utils/groupSublines.js.map +1 -1
  71. package/dist/nextcloud-vue.cjs.js +1783 -1509
  72. package/dist/nextcloud-vue.cjs.js.map +2 -2
  73. package/dist/nextcloud-vue.css +604 -375
  74. package/l10n/en.json +12 -7
  75. package/l10n/nl.json +14 -9
  76. package/package.json +1 -1
  77. package/src/components/CnAiCompanion/CnAiInput.vue +3 -1
  78. package/src/components/CnAppRoot/CnAppRoot.vue +2 -2
  79. package/src/components/CnAssignDialog/CnAssignDialog.vue +10 -5
  80. package/src/components/CnAttentionFlagWidget/CnAttentionFlagWidget.vue +2 -6
  81. package/src/components/CnChoiceCards/CnChoiceCards.vue +9 -0
  82. package/src/components/CnCountdownWidget/CnCountdownWidget.vue +3 -0
  83. package/src/components/CnDashboardPage/CnDashboardPage.vue +7 -2
  84. package/src/components/CnFactsWidget/CnFactsWidget.vue +9 -8
  85. package/src/components/CnIndexSidebar/CnIndexSidebar.vue +13 -4
  86. package/src/components/CnLinkedWidget/CnLinkedWidget.vue +91 -7
  87. package/src/components/CnMapWidget/CnMapWidget.vue +55 -1
  88. package/src/components/CnRecordListWidget/CnRecordListWidget.vue +3 -2
  89. package/src/components/CnSavedViewMenuSettings/CnSavedViewMenuSettings.vue +3 -1
  90. package/src/components/CnSchemaFormDialog/CnSchemaConfigurationTab.vue +42 -0
  91. package/src/components/CnSchemaFormDialog/CnSchemaFormDialog.vue +10 -0
  92. package/src/components/CnSettingsFieldsSection/CnSettingsFieldsSection.vue +37 -1
  93. package/src/components/CnUserSettingsDialog/CnUserSettingsDialog.vue +4 -1
  94. package/src/css/dialog.css +43 -0
  95. package/src/css/look-board-detail.css +42 -0
  96. package/src/css/look-board-index.css +8 -0
  97. package/src/css/look-board.css +107 -3
  98. package/src/utils/groupSublines.js +29 -11
@@ -3,7 +3,7 @@ export { withTypedAssignee } from './CnAssignDialog.vue2.js';
3
3
  import { render } from './CnAssignDialog.vue3.js';
4
4
 
5
5
  script.render = render;
6
- script.__scopeId = "data-v-7a19bf99";
6
+ script.__scopeId = "data-v-6ea0c632";
7
7
  const __sfc_main = script;
8
8
 
9
9
  export { __sfc_main as default };
@@ -5,7 +5,7 @@ import { generateUrl } from '@nextcloud/router';
5
5
  import { NcButton, NcCheckboxRadioSwitch, NcTextArea } from '@nextcloud/vue';
6
6
  import { fetchEndpointSource } from '../../composables/useEndpointSource.js';
7
7
  import { fillTemplate } from '../../utils/fillTemplate.js';
8
- import { groupSublines } from '../../utils/groupSublines.js';
8
+ import { describedGroupIds, groupSublines } from '../../utils/groupSublines.js';
9
9
  import { readPath } from '../../utils/readPath.js';
10
10
  import { searchNextcloudGroups, searchNextcloudUsers } from '../../utils/userAutocomplete.js';
11
11
  import __sfc_main from '../CnDialog/CnDialog.vue.js';
@@ -53,9 +53,11 @@ function withTypedAssignee(found, typed, label) {
53
53
  * - `source`: an endpointSource to read the record from, else `object`.
54
54
  * - `assignee`: `{ kinds?, label?, placeholder?, hint?, currentPath?,
55
55
  * currentHint?, currentAs?, allowTyped?, field?, kindField?, describe? }`.
56
- * `describe` (`{ register, schema, groupField?, textField? }`) names the
56
+ * `describe` (`{ register, schema, groupField?, textField?, only? }`) names the
57
57
  * records that hold a team's description; each team option then reads
58
- * "{count} members · {description}", the count where the viewer may read it. `kinds` is `["group"]`
58
+ * "{count} members · {description}", the count where the viewer may read it.
59
+ * With `only` the search lists just the groups such a record names (the
60
+ * app's teams, not every Nextcloud group); with no record at all it lists every group. `kinds` is `["group"]`
59
61
  * (default), `["user"]` or both; `currentPath` reads who has it now from the
60
62
  * record and `currentHint` ("Now with {current}.", the placeholder named
61
63
  * by `currentAs`) says so, in place of `hint`; `allowTyped`
@@ -319,12 +321,15 @@ var script = {
319
321
  if (seq !== this.searchSeq) {
320
322
  return
321
323
  }
322
- const lines = await groupSublines(groups.map((g) => g.id), typed, this.assigneeConfig.describe || null);
324
+ const describe = this.assigneeConfig.describe || null;
325
+ const teams = describe && describe.only ? await describedGroupIds(describe) : null;
326
+ const listed = teams && teams.size > 0 ? groups.filter((g) => teams.has(String(g.id))) : groups;
327
+ const lines = await groupSublines(listed.map((g) => g.id), typed, describe);
323
328
  if (seq !== this.searchSeq) {
324
329
  return
325
330
  }
326
331
  const found = [
327
- ...groups.map((g) => ({ id: g.id, label: g.label, secondary: lines[g.id] || g.subline || '', icon: 'AccountGroupOutline', kind: 'group' })),
332
+ ...listed.map((g) => ({ id: g.id, label: g.label, secondary: lines[g.id] || g.subline || '', icon: 'AccountGroupOutline', kind: 'group' })),
328
333
  ...users.map((u) => ({ id: u.id, label: u.label, secondary: u.subline || '', avatar: true, kind: 'user' })),
329
334
  ];
330
335
  this.options = this.assigneeConfig.allowTyped ? withTypedAssignee(found, typed, translate('nextcloud-vue', 'Use "{name}"', { name: typed })) : found;
@@ -1 +1 @@
1
- {"version":3,"file":"CnAssignDialog.vue2.js","sources":["../../../../src/components/CnAssignDialog/CnAssignDialog.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n<template>\n\t<CnDialog\n\t\t:name=\"text(config.title) || t('nextcloud-vue', 'Assign')\"\n\t\t:eyebrow=\"fill(config.eyebrow)\"\n\t\t:subtitle=\"text(config.subtitle)\"\n\t\twidth=\"form\"\n\t\t:noClose=\"busy\"\n\t\tdata-testid=\"cn-assign-dialog\"\n\t\t@closing=\"close\">\n\t\t<div v-if=\"!done\" class=\"cn-assign-dialog\">\n\t\t\t<div class=\"cn-assign-dialog__field\">\n\t\t\t\t<CnSearchSelect\n\t\t\t\t\t:modelValue=\"picked ? picked.id : null\"\n\t\t\t\t\t:inputId=\"assigneeId\"\n\t\t\t\t\t:inputLabel=\"assigneeLabel\"\n\t\t\t\t\t:labelOutside=\"false\"\n\t\t\t\t\t:options=\"shownOptions\"\n\t\t\t\t\t:loading=\"searching\"\n\t\t\t\t\t:filterable=\"false\"\n\t\t\t\t\t:placeholder=\"text(assigneeConfig.placeholder)\"\n\t\t\t\t\tdata-testid=\"cn-assign-dialog-assignee\"\n\t\t\t\t\t@search=\"onSearch\"\n\t\t\t\t\t@update:modelValue=\"onPick\" />\n\t\t\t\t<span v-if=\"assigneeHint\" class=\"cn-assign-dialog__hint\">{{ assigneeHint }}</span>\n\t\t\t</div>\n\n\t\t\t<div v-if=\"config.note !== false\" class=\"cn-assign-dialog__field\">\n\t\t\t\t<NcTextArea\n\t\t\t\t\t:id=\"noteId\"\n\t\t\t\t\tv-model=\"note\"\n\t\t\t\t\t:label=\"noteLabel\"\n\t\t\t\t\t:labelOutside=\"false\"\n\t\t\t\t\t:rows=\"noteConfig.rows || 3\"\n\t\t\t\t\tresize=\"vertical\"\n\t\t\t\t\tdata-testid=\"cn-assign-dialog-note\" />\n\t\t\t\t<span v-if=\"noteConfig.hint\" class=\"cn-assign-dialog__hint\">{{ text(noteConfig.hint) }}</span>\n\t\t\t</div>\n\n\t\t\t<div v-for=\"toggle in toggles\"\n\t\t\t\t:key=\"toggle.field\"\n\t\t\t\tclass=\"cn-assign-dialog__toggle\"\n\t\t\t\t:class=\"{ 'cn-assign-dialog__toggle--on': flags[toggle.field] }\"\n\t\t\t\t:data-testid=\"`cn-assign-dialog-toggle-${toggle.field}`\">\n\t\t\t\t<NcCheckboxRadioSwitch :modelValue=\"flags[toggle.field] === true\" @update:modelValue=\"flags[toggle.field] = $event\">\n\t\t\t\t\t<span class=\"cn-assign-dialog__toggle-title\">{{ fill(toggle.label) }}</span>\n\t\t\t\t</NcCheckboxRadioSwitch>\n\t\t\t\t<span v-if=\"toggle.note\" class=\"cn-assign-dialog__hint cn-assign-dialog__toggle-note\">{{ fill(toggle.note) || text(toggle.noteFallback) }}</span>\n\t\t\t</div>\n\n\t\t\t<p v-if=\"refusal\"\n\t\t\t\tclass=\"cn-assign-dialog__error\"\n\t\t\t\trole=\"alert\"\n\t\t\t\tdata-testid=\"cn-assign-dialog-refusal\">\n\t\t\t\t{{ refusal }}\n\t\t\t</p>\n\t\t</div>\n\n\t\t<p v-else role=\"status\" data-testid=\"cn-assign-dialog-done\">\n\t\t\t{{ text(config.doneText) || t('nextcloud-vue', 'Done') }}\n\t\t</p>\n\n\t\t<template #actions>\n\t\t\t<NcButton :disabled=\"busy\" data-testid=\"cn-assign-dialog-cancel\" @click=\"close\">\n\t\t\t\t{{ done ? t('nextcloud-vue', 'Close') : t('nextcloud-vue', 'Cancel') }}\n\t\t\t</NcButton>\n\t\t\t<NcButton v-if=\"!done\"\n\t\t\t\tvariant=\"primary\"\n\t\t\t\t:disabled=\"!canConfirm\"\n\t\t\t\tdata-testid=\"cn-assign-dialog-confirm\"\n\t\t\t\t@click=\"confirm\">\n\t\t\t\t<template #icon>\n\t\t\t\t\t<CnIcon :name=\"confirmConfig.icon || 'SwapHorizontal'\" :size=\"20\" />\n\t\t\t\t</template>\n\t\t\t\t{{ text(confirmConfig.label) || t('nextcloud-vue', 'Assign') }}\n\t\t\t</NcButton>\n\t\t</template>\n\t</CnDialog>\n</template>\n\n<script>\nimport axios from '@nextcloud/axios'\nimport { emit } from '@nextcloud/event-bus'\nimport { translate as t } from '@nextcloud/l10n'\nimport { generateUrl } from '@nextcloud/router'\nimport { NcButton, NcCheckboxRadioSwitch, NcTextArea } from '@nextcloud/vue'\nimport { fetchEndpointSource, interpolateUrlTokens } from '../../composables/useEndpointSource.js'\nimport { fillTemplate } from '../../utils/fillTemplate.js'\nimport { groupSublines } from '../../utils/groupSublines.js'\nimport { readPath } from '../../utils/readPath.js'\nimport { searchNextcloudGroups, searchNextcloudUsers } from '../../utils/userAutocomplete.js'\nimport { CnDialog } from '../CnDialog/index.js'\nimport { CnIcon } from '../CnIcon/index.js'\nimport { CnSearchSelect } from '../CnSearchSelect/index.js'\n\n/** The page refresh channel the built-in widgets listen on. */\nconst PAGE_REFRESH = 'cn:page:refresh'\n\n/** How long typing rests before a search runs, in ms. */\nconst SEARCH_DELAY = 250\n\n/** Gives each dialog's fields their own ids. */\nlet fieldSeq = 0\n\n/**\n * The found rows, with what was typed offered as an assignee of its own when\n * no row carries that id or name: where sharing is restricted the search\n * answers nothing, and an endpoint may still take the name.\n *\n * @param {Array<object>} found The rows found.\n * @param {string} typed What was typed.\n * @param {string} label The typed row's label.\n * @return {Array<object>} The rows.\n */\nexport function withTypedAssignee(found, typed, label) {\n\tconst lower = typed.toLowerCase()\n\tif (typed === '' || found.some((row) => String(row.id) === typed || String(row.label).toLowerCase() === lower)) {\n\t\treturn found\n\t}\n\treturn [...found, { id: typed, label, icon: 'AccountGroupOutline', kind: 'typed' }]\n}\n\n/**\n * CnAssignDialog — hand a record to another user or team, with a note and\n * optional switches, configured from the manifest (an `open-modal` action's\n * props). dossiq's case handover (board DqOverdragen: new team, why it moves,\n * \"this is a doorzending (Awb 2:3)\") is the first; pipelinq tickets and bulk\n * reassignment use the same dialog.\n *\n * `config`:\n * - `title`, `subtitle`, `doneText`: texts, through the host translate;\n * `eyebrow` a template filled from the record.\n * - `source`: an endpointSource to read the record from, else `object`.\n * - `assignee`: `{ kinds?, label?, placeholder?, hint?, currentPath?,\n * currentHint?, currentAs?, allowTyped?, field?, kindField?, describe? }`.\n * `describe` (`{ register, schema, groupField?, textField? }`) names the\n * records that hold a team's description; each team option then reads\n * \"{count} members · {description}\", the count where the viewer may read it. `kinds` is `[\"group\"]`\n * (default), `[\"user\"]` or both; `currentPath` reads who has it now from the\n * record and `currentHint` (\"Now with {current}.\", the placeholder named\n * by `currentAs`) says so, in place of `hint`; `allowTyped`\n * offers what was typed as a choice; the id is sent as `field` (default\n * `assignee`) and its kind as `kindField` when set.\n * - `note`: `{ label?, hint?, required?, field?, rows? }`, required by default and\n * sent as `field` (default `note`); `false` drops it. `rows` is the text\n * area's height in lines (default 3, as board DqOverdragen draws it).\n * - `toggles`: `[{ field, label, note?, noteFallback? }]`: switches that start\n * off and are sent as booleans; `label` and `note` are templates filled from\n * the record (\"{initiatorDisplayName} then gets a message\"); `noteFallback`\n * is shown when the record lacks a value the note names.\n * - `confirm`: `{ label?, icon?, request?: { method?, url, body? }, action? }`.\n * `request` sends the choice itself (`body` templates filled from the\n * record); `action` dispatches a manifest action with the choice as its\n * last argument.\n *\n * Tokens (`@objectId`, `@object.<field>`) resolve in every url. A refusal is\n * shown in the server's own words and the dialog stays open.\n */\nexport default {\n\tname: 'CnAssignDialog',\n\n\tcomponents: { CnDialog, CnIcon, CnSearchSelect, NcButton, NcCheckboxRadioSwitch, NcTextArea },\n\n\tinject: {\n\t\t/** The host app's translate (CnAppRoot `cnTranslate`). */\n\t\tcnTranslate: { default: () => (key) => key },\n\t\t/** The page's pre-bound action dispatcher (CnPageRenderer), for `confirm.action`. */\n\t\tcnDispatchAction: { default: null },\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * The dialog's configuration (see the component docs).\n\t\t *\n\t\t * @type {object}\n\t\t */\n\t\tconfig: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/** The record's id, for the `@objectId` token. */\n\t\tobjectId: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/**\n\t\t * The record, when the host has it.\n\t\t *\n\t\t * @type {object|null}\n\t\t */\n\t\tobject: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\t},\n\n\temits: ['close', 'done'],\n\n\tdata() {\n\t\tconst seq = ++fieldSeq\n\t\tconst flags = {}\n\t\tfor (const toggle of Array.isArray(this.config.toggles) ? this.config.toggles : []) {\n\t\t\tif (toggle && toggle.field) {\n\t\t\t\tflags[toggle.field] = false\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\trecord: this.object,\n\t\t\toptions: [],\n\t\t\tpicked: null,\n\t\t\tsearching: false,\n\t\t\ttimer: null,\n\t\t\tsearchSeq: 0,\n\t\t\tnote: '',\n\t\t\tflags,\n\t\t\tbusy: false,\n\t\t\trefusal: '',\n\t\t\tdone: false,\n\t\t\tassigneeId: `cn-assign-dialog-assignee-${seq}`,\n\t\t\tnoteId: `cn-assign-dialog-note-${seq}`,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** @return {object} The token context. */\n\t\ttokenCtx() {\n\t\t\treturn { objectId: this.recordId, object: this.record || {} }\n\t\t},\n\n\t\t/**\n\t\t * The record's id: `objectId`, or the route's `id` when the prop is\n\t\t * empty or a token the opener could not resolve.\n\t\t *\n\t\t * @return {string|number}\n\t\t */\n\t\trecordId() {\n\t\t\tconst given = this.objectId\n\t\t\tif (given !== '' && given !== null && given !== undefined && !String(given).startsWith('@')) {\n\t\t\t\treturn given\n\t\t\t}\n\t\t\treturn (this.$route && this.$route.params && this.$route.params.id) || ''\n\t\t},\n\n\t\t/** @return {object} The assignee config. */\n\t\tassigneeConfig() {\n\t\t\treturn this.config.assignee && typeof this.config.assignee === 'object' ? this.config.assignee : {}\n\t\t},\n\n\t\t/** @return {object} The note config. */\n\t\tnoteConfig() {\n\t\t\treturn this.config.note && typeof this.config.note === 'object' ? this.config.note : {}\n\t\t},\n\n\t\t/** @return {object} The confirm config. */\n\t\tconfirmConfig() {\n\t\t\treturn this.config.confirm && typeof this.config.confirm === 'object' ? this.config.confirm : {}\n\t\t},\n\n\t\t/** @return {Array<object>} The switches with a field. */\n\t\ttoggles() {\n\t\t\treturn (Array.isArray(this.config.toggles) ? this.config.toggles : []).filter((toggle) => toggle && toggle.field)\n\t\t},\n\n\t\t/** @return {string[]} The kinds searched: `group`, `user`. */\n\t\tkinds() {\n\t\t\tconst kinds = Array.isArray(this.assigneeConfig.kinds) ? this.assigneeConfig.kinds.filter((k) => k === 'group' || k === 'user') : []\n\t\t\treturn kinds.length ? kinds : ['group']\n\t\t},\n\n\t\t/** @return {string} The assignee field's label. */\n\t\tassigneeLabel() {\n\t\t\tif (this.assigneeConfig.label) {\n\t\t\t\treturn this.text(this.assigneeConfig.label)\n\t\t\t}\n\t\t\treturn this.kinds.length === 1 && this.kinds[0] === 'user' ? t('nextcloud-vue', 'New handler') : t('nextcloud-vue', 'New team')\n\t\t},\n\n\t\t/** @return {string} Who has the record now, read from it. */\n\t\tcurrent() {\n\t\t\tconst path = this.assigneeConfig.currentPath\n\t\t\tconst value = path && this.record ? readPath(this.record, path) : ''\n\t\t\treturn value === undefined || value === null ? '' : String(value)\n\t\t},\n\n\t\t/**\n\t\t * The hint under the assignee field: who has it now, else the configured hint.\n\t\t *\n\t\t * @spec openspec/changes/assign-dialog/specs/assign-dialog/spec.md#requirement-a-manifest-configures-an-assign-dialog\n\t\t * @return {string}\n\t\t */\n\t\tassigneeHint() {\n\t\t\tconst name = this.assigneeConfig.currentAs || 'current'\n\t\t\tconst now = this.current && this.assigneeConfig.currentHint ? fillTemplate(this.cnTranslate(this.assigneeConfig.currentHint), { [name]: this.current }) : ''\n\t\t\treturn now || this.text(this.assigneeConfig.hint)\n\t\t},\n\n\t\t/** @return {Array<object>} The rows, keeping the picked one listed. */\n\t\tshownOptions() {\n\t\t\tif (this.picked && !this.options.some((o) => String(o.id) === String(this.picked.id))) {\n\t\t\t\treturn [this.picked, ...this.options]\n\t\t\t}\n\t\t\treturn this.options\n\t\t},\n\n\t\t/** @return {boolean} Whether a note is asked and needed. */\n\t\tnoteNeeded() {\n\t\t\treturn this.config.note !== false && this.noteConfig.required !== false\n\t\t},\n\n\t\t/** @return {string} The note field's label. */\n\t\tnoteLabel() {\n\t\t\treturn this.text(this.noteConfig.label) || t('nextcloud-vue', 'Why it is moving')\n\t\t},\n\n\t\t/**\n\t\t * Whether the assignment may run: an assignee, a note when needed, nothing in flight.\n\t\t *\n\t\t * @spec openspec/changes/assign-dialog/specs/assign-dialog/spec.md#requirement-a-manifest-configures-an-assign-dialog\n\t\t * @return {boolean}\n\t\t */\n\t\tcanConfirm() {\n\t\t\treturn !this.busy && this.picked !== null && (!this.noteNeeded || this.note.trim() !== '')\n\t\t},\n\t},\n\n\tasync mounted() {\n\t\tconst source = this.config.source\n\t\tif (source && source.url) {\n\t\t\ttry {\n\t\t\t\tconst data = await fetchEndpointSource(source, this.tokenCtx, { fresh: true })\n\t\t\t\tthis.record = data && typeof data === 'object' ? data : this.record\n\t\t\t} catch {\n\t\t\t\t// The hint stays without the current assignee; the dialog still works.\n\t\t\t}\n\t\t}\n\t},\n\n\tbeforeUnmount() {\n\t\tclearTimeout(this.timer)\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * A config text through the host translate, '' for anything else.\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 * A template filled from the record, translated first.\n\t\t *\n\t\t * @param {unknown} template The template.\n\t\t * @return {string}\n\t\t */\n\t\tfill(template) {\n\t\t\tif (typeof template !== 'string' || template === '') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\treturn fillTemplate(this.cnTranslate(template), this.record || {}).trim()\n\t\t},\n\n\t\t/**\n\t\t * Search after typing rests.\n\t\t *\n\t\t * @param {string} query What was typed.\n\t\t */\n\t\tonSearch(query) {\n\t\t\tclearTimeout(this.timer)\n\t\t\tconst typed = String(query ?? '').trim()\n\t\t\tif (typed === '') {\n\t\t\t\tthis.options = []\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.timer = setTimeout(() => this.search(typed), SEARCH_DELAY)\n\t\t},\n\n\t\t/**\n\t\t * Search the configured kinds; offer what was typed when allowed.\n\t\t *\n\t\t * @spec openspec/changes/assign-dialog/specs/assign-dialog/spec.md#requirement-a-manifest-configures-an-assign-dialog\n\t\t * @param {string} typed What was typed.\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync search(typed) {\n\t\t\tconst seq = ++this.searchSeq\n\t\t\tthis.searching = true\n\t\t\tconst [groups, users] = await Promise.all([\n\t\t\t\tthis.kinds.includes('group') ? searchNextcloudGroups(typed, { limit: 20 }) : [],\n\t\t\t\tthis.kinds.includes('user') ? searchNextcloudUsers(typed, { limit: 20 }) : [],\n\t\t\t])\n\t\t\tif (seq !== this.searchSeq) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst lines = await groupSublines(groups.map((g) => g.id), typed, this.assigneeConfig.describe || null)\n\t\t\tif (seq !== this.searchSeq) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst found = [\n\t\t\t\t...groups.map((g) => ({ id: g.id, label: g.label, secondary: lines[g.id] || g.subline || '', icon: 'AccountGroupOutline', kind: 'group' })),\n\t\t\t\t...users.map((u) => ({ id: u.id, label: u.label, secondary: u.subline || '', avatar: true, kind: 'user' })),\n\t\t\t]\n\t\t\tthis.options = this.assigneeConfig.allowTyped ? withTypedAssignee(found, typed, t('nextcloud-vue', 'Use \"{name}\"', { name: typed })) : found\n\t\t\tthis.searching = false\n\t\t},\n\n\t\t/**\n\t\t * Take the picked row.\n\t\t *\n\t\t * @param {string|null} id The picked id.\n\t\t */\n\t\tonPick(id) {\n\t\t\tthis.picked = id === null ? null : (this.shownOptions.find((o) => String(o.id) === String(id)) || null)\n\t\t},\n\n\t\t/**\n\t\t * The choice as sent: assignee, its kind, the note and the switches.\n\t\t *\n\t\t * @return {object}\n\t\t */\n\t\tchoice() {\n\t\t\tconst out = { [this.assigneeConfig.field || 'assignee']: String(this.picked.id) }\n\t\t\tif (this.assigneeConfig.kindField) {\n\t\t\t\tout[this.assigneeConfig.kindField] = this.picked.kind === 'typed' ? this.kinds[0] : this.picked.kind\n\t\t\t}\n\t\t\tif (this.config.note !== false) {\n\t\t\t\tout[this.noteConfig.field || 'note'] = this.note.trim()\n\t\t\t}\n\t\t\treturn { ...out, ...this.flags }\n\t\t},\n\n\t\t/**\n\t\t * Assign once: send `confirm.request`, or dispatch `confirm.action`,\n\t\t * then show the done text and refresh the page.\n\t\t *\n\t\t * @spec openspec/changes/assign-dialog/specs/assign-dialog/spec.md#requirement-a-manifest-configures-an-assign-dialog\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync confirm() {\n\t\t\tif (!this.canConfirm) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.busy = true\n\t\t\tthis.refusal = ''\n\t\t\tconst choice = this.choice()\n\t\t\ttry {\n\t\t\t\tconst request = this.confirmConfig.request\n\t\t\t\tif (request && request.url) {\n\t\t\t\t\tconst url = interpolateUrlTokens(request.url, this.tokenCtx)\n\t\t\t\t\tconst body = {}\n\t\t\t\t\tfor (const [key, value] of Object.entries(request.body || {})) {\n\t\t\t\t\t\tbody[key] = typeof value === 'string' ? fillTemplate(value, this.record || {}) : value\n\t\t\t\t\t}\n\t\t\t\t\tconst method = String(request.method || 'POST').toLowerCase()\n\t\t\t\t\tawait axios[['post', 'put', 'patch'].includes(method) ? method : 'post'](/^https?:\\/\\//i.test(url) ? url : generateUrl(url), { ...body, ...choice })\n\t\t\t\t} else if (this.confirmConfig.action && typeof this.cnDispatchAction === 'function') {\n\t\t\t\t\tawait this.cnDispatchAction({ ...this.confirmConfig.action, args: [...(this.confirmConfig.action.args || []), choice] })\n\t\t\t\t}\n\t\t\t\tthis.done = true\n\t\t\t\temit(PAGE_REFRESH, {})\n\t\t\t\t/** @event done The assignment ran. Payload: the choice as sent. */\n\t\t\t\tthis.$emit('done', choice)\n\t\t\t} catch (failure) {\n\t\t\t\tconst data = failure && failure.response && failure.response.data\n\t\t\t\tthis.refusal = String((data && (data.message || data.error)) || t('nextcloud-vue', 'It was not handed over.'))\n\t\t\t} finally {\n\t\t\t\tthis.busy = false\n\t\t\t}\n\t\t},\n\n\t\t/** Close the dialog, unless the assignment is running. */\n\t\tclose() {\n\t\t\tif (this.busy) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\t/** @event close The dialog was closed. */\n\t\t\tthis.$emit('close')\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-assign-dialog {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 18px;\n}\n\n.cn-assign-dialog__field {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 6px;\n}\n\n/* The assignee label sits above its field, as the note's does. */\n.cn-assign-dialog__field :deep(.select__label) {\n\tdisplay: block;\n\tmargin-bottom: 6px;\n\tfont-size: 14px;\n\tfont-weight: 600;\n\tcolor: var(--color-main-text);\n}\n\n.cn-assign-dialog__hint {\n\tfont-size: 13px;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-assign-dialog__toggle {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 2px;\n\tpadding: 12px 14px;\n\tborder: 1px solid var(--color-border-dark);\n\tborder-radius: var(--border-radius-large, 8px);\n}\n\n.cn-assign-dialog__toggle--on {\n\tborder: 2px solid var(--color-primary-element);\n\tbackground: var(--color-primary-element-light);\n}\n\n.cn-assign-dialog__toggle-title {\n\tfont-weight: 600;\n}\n\n.cn-assign-dialog__toggle-note {\n\tpadding-inline-start: var(--cn-dialog-check-label-inset, 44px);\n}\n\n.cn-assign-dialog__error {\n\tmargin: 0;\n\tcolor: var(--color-error-text, var(--color-error));\n}\n</style>\n"],"names":["CnDialog","CnIcon","CnSearchSelect","t","axios"],"mappings":";;;;;;;;;;;;;;;AAkGA;AACA,MAAM,YAAW,GAAI,kBAAgB;;AAErC;AACA,MAAM,YAAa,GAAE,IAAE;;AAEvB;AACA,IAAI,QAAO,GAAI,EAAA;;AAEf;;;;AAIC;AACA;AACA;AACA;AACA;;AAEM,SAAS,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;CACtD,MAAM,KAAI,GAAI,KAAK,CAAC,WAAW,GAAC;CAChC,IAAI,KAAI,KAAM,EAAG,IAAG,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,MAAM,CAAC,GAAG,CAAC,EAAE,CAAA,KAAM,KAAI,IAAK,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,WAAW,EAAG,KAAI,KAAK,CAAC,EAAE;EAC/G,OAAO,KAAI;AACZ,EAAA;AACA,CAAA,OAAO,CAAC,GAAG,KAAK,EAAE,EAA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,CAAC,UAAU,MAAM,CAAC,CAAC,IAAK,KAAI,IAAI,CAAC,OAAQ,IAAG,IAAI,CAAC,KAAK,CAAC,KAAKD,SAAC,CAAC,eAAe,EAAE,yBAAyB,CAAC,EAAA;AAC9G,IAAA,SAAU;AACT,IAAA,IAAI,CAAC,IAAG,GAAI,MAAI;AACjB,IAAA;GACA;;;AAGD,EAAA,KAAK,GAAG;GACP,IAAI,IAAI,CAAC,IAAI,EAAE;IACd,MAAK;AACN,IAAA;AACA;AACA,GAAA,IAAI,CAAC,KAAK,CAAC,OAAO,EAAA;GAClB;EACD;AACF;;;;"}
1
+ {"version":3,"file":"CnAssignDialog.vue2.js","sources":["../../../../src/components/CnAssignDialog/CnAssignDialog.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n<template>\n\t<CnDialog\n\t\t:name=\"text(config.title) || t('nextcloud-vue', 'Assign')\"\n\t\t:eyebrow=\"fill(config.eyebrow)\"\n\t\t:subtitle=\"text(config.subtitle)\"\n\t\twidth=\"form\"\n\t\t:noClose=\"busy\"\n\t\tdata-testid=\"cn-assign-dialog\"\n\t\t@closing=\"close\">\n\t\t<div v-if=\"!done\" class=\"cn-assign-dialog\">\n\t\t\t<div class=\"cn-assign-dialog__field\">\n\t\t\t\t<CnSearchSelect\n\t\t\t\t\t:modelValue=\"picked ? picked.id : null\"\n\t\t\t\t\t:inputId=\"assigneeId\"\n\t\t\t\t\t:inputLabel=\"assigneeLabel\"\n\t\t\t\t\t:labelOutside=\"false\"\n\t\t\t\t\t:options=\"shownOptions\"\n\t\t\t\t\t:loading=\"searching\"\n\t\t\t\t\t:filterable=\"false\"\n\t\t\t\t\t:placeholder=\"text(assigneeConfig.placeholder)\"\n\t\t\t\t\tdata-testid=\"cn-assign-dialog-assignee\"\n\t\t\t\t\t@search=\"onSearch\"\n\t\t\t\t\t@update:modelValue=\"onPick\" />\n\t\t\t\t<span v-if=\"assigneeHint\" class=\"cn-assign-dialog__hint\">{{ assigneeHint }}</span>\n\t\t\t</div>\n\n\t\t\t<div v-if=\"config.note !== false\" class=\"cn-assign-dialog__field\">\n\t\t\t\t<NcTextArea\n\t\t\t\t\t:id=\"noteId\"\n\t\t\t\t\tv-model=\"note\"\n\t\t\t\t\t:label=\"noteLabel\"\n\t\t\t\t\t:labelOutside=\"false\"\n\t\t\t\t\t:rows=\"noteConfig.rows || 3\"\n\t\t\t\t\tresize=\"vertical\"\n\t\t\t\t\tdata-testid=\"cn-assign-dialog-note\" />\n\t\t\t\t<span v-if=\"noteConfig.hint\" class=\"cn-assign-dialog__hint\">{{ text(noteConfig.hint) }}</span>\n\t\t\t</div>\n\n\t\t\t<div v-for=\"toggle in toggles\"\n\t\t\t\t:key=\"toggle.field\"\n\t\t\t\tclass=\"cn-assign-dialog__toggle\"\n\t\t\t\t:class=\"{ 'cn-assign-dialog__toggle--on': flags[toggle.field] }\"\n\t\t\t\t:data-testid=\"`cn-assign-dialog-toggle-${toggle.field}`\">\n\t\t\t\t<NcCheckboxRadioSwitch :modelValue=\"flags[toggle.field] === true\" @update:modelValue=\"flags[toggle.field] = $event\">\n\t\t\t\t\t<span class=\"cn-assign-dialog__toggle-title\">{{ fill(toggle.label) }}</span>\n\t\t\t\t</NcCheckboxRadioSwitch>\n\t\t\t\t<span v-if=\"toggle.note\" class=\"cn-assign-dialog__hint cn-assign-dialog__toggle-note\">{{ fill(toggle.note) || text(toggle.noteFallback) }}</span>\n\t\t\t</div>\n\n\t\t\t<p v-if=\"refusal\"\n\t\t\t\tclass=\"cn-assign-dialog__error\"\n\t\t\t\trole=\"alert\"\n\t\t\t\tdata-testid=\"cn-assign-dialog-refusal\">\n\t\t\t\t{{ refusal }}\n\t\t\t</p>\n\t\t</div>\n\n\t\t<p v-else role=\"status\" data-testid=\"cn-assign-dialog-done\">\n\t\t\t{{ text(config.doneText) || t('nextcloud-vue', 'Done') }}\n\t\t</p>\n\n\t\t<template #actions>\n\t\t\t<NcButton :disabled=\"busy\" data-testid=\"cn-assign-dialog-cancel\" @click=\"close\">\n\t\t\t\t{{ done ? t('nextcloud-vue', 'Close') : t('nextcloud-vue', 'Cancel') }}\n\t\t\t</NcButton>\n\t\t\t<NcButton v-if=\"!done\"\n\t\t\t\tvariant=\"primary\"\n\t\t\t\t:disabled=\"!canConfirm\"\n\t\t\t\tdata-testid=\"cn-assign-dialog-confirm\"\n\t\t\t\t@click=\"confirm\">\n\t\t\t\t<template #icon>\n\t\t\t\t\t<CnIcon :name=\"confirmConfig.icon || 'SwapHorizontal'\" :size=\"20\" />\n\t\t\t\t</template>\n\t\t\t\t{{ text(confirmConfig.label) || t('nextcloud-vue', 'Assign') }}\n\t\t\t</NcButton>\n\t\t</template>\n\t</CnDialog>\n</template>\n\n<script>\nimport axios from '@nextcloud/axios'\nimport { emit } from '@nextcloud/event-bus'\nimport { translate as t } from '@nextcloud/l10n'\nimport { generateUrl } from '@nextcloud/router'\nimport { NcButton, NcCheckboxRadioSwitch, NcTextArea } from '@nextcloud/vue'\nimport { fetchEndpointSource, interpolateUrlTokens } from '../../composables/useEndpointSource.js'\nimport { fillTemplate } from '../../utils/fillTemplate.js'\nimport { describedGroupIds, groupSublines } from '../../utils/groupSublines.js'\nimport { readPath } from '../../utils/readPath.js'\nimport { searchNextcloudGroups, searchNextcloudUsers } from '../../utils/userAutocomplete.js'\nimport { CnDialog } from '../CnDialog/index.js'\nimport { CnIcon } from '../CnIcon/index.js'\nimport { CnSearchSelect } from '../CnSearchSelect/index.js'\n\n/** The page refresh channel the built-in widgets listen on. */\nconst PAGE_REFRESH = 'cn:page:refresh'\n\n/** How long typing rests before a search runs, in ms. */\nconst SEARCH_DELAY = 250\n\n/** Gives each dialog's fields their own ids. */\nlet fieldSeq = 0\n\n/**\n * The found rows, with what was typed offered as an assignee of its own when\n * no row carries that id or name: where sharing is restricted the search\n * answers nothing, and an endpoint may still take the name.\n *\n * @param {Array<object>} found The rows found.\n * @param {string} typed What was typed.\n * @param {string} label The typed row's label.\n * @return {Array<object>} The rows.\n */\nexport function withTypedAssignee(found, typed, label) {\n\tconst lower = typed.toLowerCase()\n\tif (typed === '' || found.some((row) => String(row.id) === typed || String(row.label).toLowerCase() === lower)) {\n\t\treturn found\n\t}\n\treturn [...found, { id: typed, label, icon: 'AccountGroupOutline', kind: 'typed' }]\n}\n\n/**\n * CnAssignDialog — hand a record to another user or team, with a note and\n * optional switches, configured from the manifest (an `open-modal` action's\n * props). dossiq's case handover (board DqOverdragen: new team, why it moves,\n * \"this is a doorzending (Awb 2:3)\") is the first; pipelinq tickets and bulk\n * reassignment use the same dialog.\n *\n * `config`:\n * - `title`, `subtitle`, `doneText`: texts, through the host translate;\n * `eyebrow` a template filled from the record.\n * - `source`: an endpointSource to read the record from, else `object`.\n * - `assignee`: `{ kinds?, label?, placeholder?, hint?, currentPath?,\n * currentHint?, currentAs?, allowTyped?, field?, kindField?, describe? }`.\n * `describe` (`{ register, schema, groupField?, textField?, only? }`) names the\n * records that hold a team's description; each team option then reads\n * \"{count} members · {description}\", the count where the viewer may read it.\n * With `only` the search lists just the groups such a record names (the\n * app's teams, not every Nextcloud group); with no record at all it lists every group. `kinds` is `[\"group\"]`\n * (default), `[\"user\"]` or both; `currentPath` reads who has it now from the\n * record and `currentHint` (\"Now with {current}.\", the placeholder named\n * by `currentAs`) says so, in place of `hint`; `allowTyped`\n * offers what was typed as a choice; the id is sent as `field` (default\n * `assignee`) and its kind as `kindField` when set.\n * - `note`: `{ label?, hint?, required?, field?, rows? }`, required by default and\n * sent as `field` (default `note`); `false` drops it. `rows` is the text\n * area's height in lines (default 3, as board DqOverdragen draws it).\n * - `toggles`: `[{ field, label, note?, noteFallback? }]`: switches that start\n * off and are sent as booleans; `label` and `note` are templates filled from\n * the record (\"{initiatorDisplayName} then gets a message\"); `noteFallback`\n * is shown when the record lacks a value the note names.\n * - `confirm`: `{ label?, icon?, request?: { method?, url, body? }, action? }`.\n * `request` sends the choice itself (`body` templates filled from the\n * record); `action` dispatches a manifest action with the choice as its\n * last argument.\n *\n * Tokens (`@objectId`, `@object.<field>`) resolve in every url. A refusal is\n * shown in the server's own words and the dialog stays open.\n */\nexport default {\n\tname: 'CnAssignDialog',\n\n\tcomponents: { CnDialog, CnIcon, CnSearchSelect, NcButton, NcCheckboxRadioSwitch, NcTextArea },\n\n\tinject: {\n\t\t/** The host app's translate (CnAppRoot `cnTranslate`). */\n\t\tcnTranslate: { default: () => (key) => key },\n\t\t/** The page's pre-bound action dispatcher (CnPageRenderer), for `confirm.action`. */\n\t\tcnDispatchAction: { default: null },\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * The dialog's configuration (see the component docs).\n\t\t *\n\t\t * @type {object}\n\t\t */\n\t\tconfig: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/** The record's id, for the `@objectId` token. */\n\t\tobjectId: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/**\n\t\t * The record, when the host has it.\n\t\t *\n\t\t * @type {object|null}\n\t\t */\n\t\tobject: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\t},\n\n\temits: ['close', 'done'],\n\n\tdata() {\n\t\tconst seq = ++fieldSeq\n\t\tconst flags = {}\n\t\tfor (const toggle of Array.isArray(this.config.toggles) ? this.config.toggles : []) {\n\t\t\tif (toggle && toggle.field) {\n\t\t\t\tflags[toggle.field] = false\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\trecord: this.object,\n\t\t\toptions: [],\n\t\t\tpicked: null,\n\t\t\tsearching: false,\n\t\t\ttimer: null,\n\t\t\tsearchSeq: 0,\n\t\t\tnote: '',\n\t\t\tflags,\n\t\t\tbusy: false,\n\t\t\trefusal: '',\n\t\t\tdone: false,\n\t\t\tassigneeId: `cn-assign-dialog-assignee-${seq}`,\n\t\t\tnoteId: `cn-assign-dialog-note-${seq}`,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** @return {object} The token context. */\n\t\ttokenCtx() {\n\t\t\treturn { objectId: this.recordId, object: this.record || {} }\n\t\t},\n\n\t\t/**\n\t\t * The record's id: `objectId`, or the route's `id` when the prop is\n\t\t * empty or a token the opener could not resolve.\n\t\t *\n\t\t * @return {string|number}\n\t\t */\n\t\trecordId() {\n\t\t\tconst given = this.objectId\n\t\t\tif (given !== '' && given !== null && given !== undefined && !String(given).startsWith('@')) {\n\t\t\t\treturn given\n\t\t\t}\n\t\t\treturn (this.$route && this.$route.params && this.$route.params.id) || ''\n\t\t},\n\n\t\t/** @return {object} The assignee config. */\n\t\tassigneeConfig() {\n\t\t\treturn this.config.assignee && typeof this.config.assignee === 'object' ? this.config.assignee : {}\n\t\t},\n\n\t\t/** @return {object} The note config. */\n\t\tnoteConfig() {\n\t\t\treturn this.config.note && typeof this.config.note === 'object' ? this.config.note : {}\n\t\t},\n\n\t\t/** @return {object} The confirm config. */\n\t\tconfirmConfig() {\n\t\t\treturn this.config.confirm && typeof this.config.confirm === 'object' ? this.config.confirm : {}\n\t\t},\n\n\t\t/** @return {Array<object>} The switches with a field. */\n\t\ttoggles() {\n\t\t\treturn (Array.isArray(this.config.toggles) ? this.config.toggles : []).filter((toggle) => toggle && toggle.field)\n\t\t},\n\n\t\t/** @return {string[]} The kinds searched: `group`, `user`. */\n\t\tkinds() {\n\t\t\tconst kinds = Array.isArray(this.assigneeConfig.kinds) ? this.assigneeConfig.kinds.filter((k) => k === 'group' || k === 'user') : []\n\t\t\treturn kinds.length ? kinds : ['group']\n\t\t},\n\n\t\t/** @return {string} The assignee field's label. */\n\t\tassigneeLabel() {\n\t\t\tif (this.assigneeConfig.label) {\n\t\t\t\treturn this.text(this.assigneeConfig.label)\n\t\t\t}\n\t\t\treturn this.kinds.length === 1 && this.kinds[0] === 'user' ? t('nextcloud-vue', 'New handler') : t('nextcloud-vue', 'New team')\n\t\t},\n\n\t\t/** @return {string} Who has the record now, read from it. */\n\t\tcurrent() {\n\t\t\tconst path = this.assigneeConfig.currentPath\n\t\t\tconst value = path && this.record ? readPath(this.record, path) : ''\n\t\t\treturn value === undefined || value === null ? '' : String(value)\n\t\t},\n\n\t\t/**\n\t\t * The hint under the assignee field: who has it now, else the configured hint.\n\t\t *\n\t\t * @spec openspec/changes/assign-dialog/specs/assign-dialog/spec.md#requirement-a-manifest-configures-an-assign-dialog\n\t\t * @return {string}\n\t\t */\n\t\tassigneeHint() {\n\t\t\tconst name = this.assigneeConfig.currentAs || 'current'\n\t\t\tconst now = this.current && this.assigneeConfig.currentHint ? fillTemplate(this.cnTranslate(this.assigneeConfig.currentHint), { [name]: this.current }) : ''\n\t\t\treturn now || this.text(this.assigneeConfig.hint)\n\t\t},\n\n\t\t/** @return {Array<object>} The rows, keeping the picked one listed. */\n\t\tshownOptions() {\n\t\t\tif (this.picked && !this.options.some((o) => String(o.id) === String(this.picked.id))) {\n\t\t\t\treturn [this.picked, ...this.options]\n\t\t\t}\n\t\t\treturn this.options\n\t\t},\n\n\t\t/** @return {boolean} Whether a note is asked and needed. */\n\t\tnoteNeeded() {\n\t\t\treturn this.config.note !== false && this.noteConfig.required !== false\n\t\t},\n\n\t\t/** @return {string} The note field's label. */\n\t\tnoteLabel() {\n\t\t\treturn this.text(this.noteConfig.label) || t('nextcloud-vue', 'Why it is moving')\n\t\t},\n\n\t\t/**\n\t\t * Whether the assignment may run: an assignee, a note when needed, nothing in flight.\n\t\t *\n\t\t * @spec openspec/changes/assign-dialog/specs/assign-dialog/spec.md#requirement-a-manifest-configures-an-assign-dialog\n\t\t * @return {boolean}\n\t\t */\n\t\tcanConfirm() {\n\t\t\treturn !this.busy && this.picked !== null && (!this.noteNeeded || this.note.trim() !== '')\n\t\t},\n\t},\n\n\tasync mounted() {\n\t\tconst source = this.config.source\n\t\tif (source && source.url) {\n\t\t\ttry {\n\t\t\t\tconst data = await fetchEndpointSource(source, this.tokenCtx, { fresh: true })\n\t\t\t\tthis.record = data && typeof data === 'object' ? data : this.record\n\t\t\t} catch {\n\t\t\t\t// The hint stays without the current assignee; the dialog still works.\n\t\t\t}\n\t\t}\n\t},\n\n\tbeforeUnmount() {\n\t\tclearTimeout(this.timer)\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * A config text through the host translate, '' for anything else.\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 * A template filled from the record, translated first.\n\t\t *\n\t\t * @param {unknown} template The template.\n\t\t * @return {string}\n\t\t */\n\t\tfill(template) {\n\t\t\tif (typeof template !== 'string' || template === '') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\treturn fillTemplate(this.cnTranslate(template), this.record || {}).trim()\n\t\t},\n\n\t\t/**\n\t\t * Search after typing rests.\n\t\t *\n\t\t * @param {string} query What was typed.\n\t\t */\n\t\tonSearch(query) {\n\t\t\tclearTimeout(this.timer)\n\t\t\tconst typed = String(query ?? '').trim()\n\t\t\tif (typed === '') {\n\t\t\t\tthis.options = []\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.timer = setTimeout(() => this.search(typed), SEARCH_DELAY)\n\t\t},\n\n\t\t/**\n\t\t * Search the configured kinds; offer what was typed when allowed.\n\t\t *\n\t\t * @spec openspec/changes/assign-dialog/specs/assign-dialog/spec.md#requirement-a-manifest-configures-an-assign-dialog\n\t\t * @param {string} typed What was typed.\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync search(typed) {\n\t\t\tconst seq = ++this.searchSeq\n\t\t\tthis.searching = true\n\t\t\tconst [groups, users] = await Promise.all([\n\t\t\t\tthis.kinds.includes('group') ? searchNextcloudGroups(typed, { limit: 20 }) : [],\n\t\t\t\tthis.kinds.includes('user') ? searchNextcloudUsers(typed, { limit: 20 }) : [],\n\t\t\t])\n\t\t\tif (seq !== this.searchSeq) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst describe = this.assigneeConfig.describe || null\n\t\t\tconst teams = describe && describe.only ? await describedGroupIds(describe) : null\n\t\t\tconst listed = teams && teams.size > 0 ? groups.filter((g) => teams.has(String(g.id))) : groups\n\t\t\tconst lines = await groupSublines(listed.map((g) => g.id), typed, describe)\n\t\t\tif (seq !== this.searchSeq) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst found = [\n\t\t\t\t...listed.map((g) => ({ id: g.id, label: g.label, secondary: lines[g.id] || g.subline || '', icon: 'AccountGroupOutline', kind: 'group' })),\n\t\t\t\t...users.map((u) => ({ id: u.id, label: u.label, secondary: u.subline || '', avatar: true, kind: 'user' })),\n\t\t\t]\n\t\t\tthis.options = this.assigneeConfig.allowTyped ? withTypedAssignee(found, typed, t('nextcloud-vue', 'Use \"{name}\"', { name: typed })) : found\n\t\t\tthis.searching = false\n\t\t},\n\n\t\t/**\n\t\t * Take the picked row.\n\t\t *\n\t\t * @param {string|null} id The picked id.\n\t\t */\n\t\tonPick(id) {\n\t\t\tthis.picked = id === null ? null : (this.shownOptions.find((o) => String(o.id) === String(id)) || null)\n\t\t},\n\n\t\t/**\n\t\t * The choice as sent: assignee, its kind, the note and the switches.\n\t\t *\n\t\t * @return {object}\n\t\t */\n\t\tchoice() {\n\t\t\tconst out = { [this.assigneeConfig.field || 'assignee']: String(this.picked.id) }\n\t\t\tif (this.assigneeConfig.kindField) {\n\t\t\t\tout[this.assigneeConfig.kindField] = this.picked.kind === 'typed' ? this.kinds[0] : this.picked.kind\n\t\t\t}\n\t\t\tif (this.config.note !== false) {\n\t\t\t\tout[this.noteConfig.field || 'note'] = this.note.trim()\n\t\t\t}\n\t\t\treturn { ...out, ...this.flags }\n\t\t},\n\n\t\t/**\n\t\t * Assign once: send `confirm.request`, or dispatch `confirm.action`,\n\t\t * then show the done text and refresh the page.\n\t\t *\n\t\t * @spec openspec/changes/assign-dialog/specs/assign-dialog/spec.md#requirement-a-manifest-configures-an-assign-dialog\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync confirm() {\n\t\t\tif (!this.canConfirm) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.busy = true\n\t\t\tthis.refusal = ''\n\t\t\tconst choice = this.choice()\n\t\t\ttry {\n\t\t\t\tconst request = this.confirmConfig.request\n\t\t\t\tif (request && request.url) {\n\t\t\t\t\tconst url = interpolateUrlTokens(request.url, this.tokenCtx)\n\t\t\t\t\tconst body = {}\n\t\t\t\t\tfor (const [key, value] of Object.entries(request.body || {})) {\n\t\t\t\t\t\tbody[key] = typeof value === 'string' ? fillTemplate(value, this.record || {}) : value\n\t\t\t\t\t}\n\t\t\t\t\tconst method = String(request.method || 'POST').toLowerCase()\n\t\t\t\t\tawait axios[['post', 'put', 'patch'].includes(method) ? method : 'post'](/^https?:\\/\\//i.test(url) ? url : generateUrl(url), { ...body, ...choice })\n\t\t\t\t} else if (this.confirmConfig.action && typeof this.cnDispatchAction === 'function') {\n\t\t\t\t\tawait this.cnDispatchAction({ ...this.confirmConfig.action, args: [...(this.confirmConfig.action.args || []), choice] })\n\t\t\t\t}\n\t\t\t\tthis.done = true\n\t\t\t\temit(PAGE_REFRESH, {})\n\t\t\t\t/** @event done The assignment ran. Payload: the choice as sent. */\n\t\t\t\tthis.$emit('done', choice)\n\t\t\t} catch (failure) {\n\t\t\t\tconst data = failure && failure.response && failure.response.data\n\t\t\t\tthis.refusal = String((data && (data.message || data.error)) || t('nextcloud-vue', 'It was not handed over.'))\n\t\t\t} finally {\n\t\t\t\tthis.busy = false\n\t\t\t}\n\t\t},\n\n\t\t/** Close the dialog, unless the assignment is running. */\n\t\tclose() {\n\t\t\tif (this.busy) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\t/** @event close The dialog was closed. */\n\t\t\tthis.$emit('close')\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-assign-dialog {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 18px;\n}\n\n.cn-assign-dialog__field {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 6px;\n}\n\n/* The assignee label sits above its field, as the note's does. */\n.cn-assign-dialog__field :deep(.select__label) {\n\tdisplay: block;\n\tmargin-bottom: 6px;\n\tfont-size: 14px;\n\tfont-weight: 600;\n\tcolor: var(--color-main-text);\n}\n\n.cn-assign-dialog__hint {\n\tfont-size: 13px;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-assign-dialog__toggle {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 2px;\n\tpadding: 12px 14px;\n\tborder: 1px solid var(--color-border-dark);\n\tborder-radius: var(--border-radius-large, 8px);\n}\n\n.cn-assign-dialog__toggle--on {\n\tborder: 2px solid var(--color-primary-element);\n\tbackground: var(--color-primary-element-light);\n}\n\n.cn-assign-dialog__toggle-title {\n\tfont-weight: 600;\n}\n\n.cn-assign-dialog__toggle-note {\n\tpadding-inline-start: var(--cn-dialog-check-label-inset, 44px);\n}\n\n.cn-assign-dialog__error {\n\tmargin: 0;\n\tcolor: var(--color-error-text, var(--color-error));\n}\n</style>\n"],"names":["CnDialog","CnIcon","CnSearchSelect","t","axios"],"mappings":";;;;;;;;;;;;;;;AAkGA;AACA,MAAM,YAAW,GAAI,kBAAgB;;AAErC;AACA,MAAM,YAAa,GAAE,IAAE;;AAEvB;AACA,IAAI,QAAO,GAAI,EAAA;;AAEf;;;;AAIC;AACA;AACA;AACA;AACA;;AAEM,SAAS,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;CACtD,MAAM,KAAI,GAAI,KAAK,CAAC,WAAW,GAAC;CAChC,IAAI,KAAI,KAAM,EAAG,IAAG,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,MAAM,CAAC,GAAG,CAAC,EAAE,CAAA,KAAM,KAAI,IAAK,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,WAAW,EAAG,KAAI,KAAK,CAAC,EAAE;EAC/G,OAAO,KAAI;AACZ,EAAA;AACA,CAAA,OAAO,CAAC,GAA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a,CAAC,MAAM,CAAC,IAAG,IAAK,EAAE,CAAC,EAAE,MAAM,CAAA,EAAG,EAAA;AACxH,KAAA;IACA,IAAI,CAAC,IAAK,GAAE,KAAG;AACf,IAAA,IAAI,CAAC,YAAY,EAAE,EAAE,EAAA;;IAErB,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,EAAA;AAC1B,IAAA,CAAE,OAAO,OAAO,EAAE;IACjB,MAAM,IAAG,GAAI,OAAQ,IAAG,OAAO,CAAC,QAAO,IAAK,OAAO,CAAC,QAAQ,CAAC,KAAG;IAChE,IAAI,CAAC,UAAU,MAAM,CAAC,CAAC,IAAK,KAAI,IAAI,CAAC,OAAQ,IAAG,IAAI,CAAC,KAAK,CAAC,KAAKD,SAAC,CAAC,eAAe,EAAE,yBAAyB,CAAC,EAAA;AAC9G,IAAA,SAAU;AACT,IAAA,IAAI,CAAC,IAAG,GAAI,MAAI;AACjB,IAAA;GACA;;;AAGD,EAAA,KAAK,GAAG;GACP,IAAI,IAAI,CAAC,IAAI,EAAE;IACd,MAAK;AACN,IAAA;AACA;AACA,GAAA,IAAI,CAAC,KAAK,CAAC,OAAO,EAAA;GAClB;EACD;AACF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"CnAssignDialog.vue3.js","sources":["../../../../src/components/CnAssignDialog/CnAssignDialog.vue?vue&type=template&id=7a19bf99&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n<template>\n\t<CnDialog\n\t\t:name=\"text(config.title) || t('nextcloud-vue', 'Assign')\"\n\t\t:eyebrow=\"fill(config.eyebrow)\"\n\t\t:subtitle=\"text(config.subtitle)\"\n\t\twidth=\"form\"\n\t\t:noClose=\"busy\"\n\t\tdata-testid=\"cn-assign-dialog\"\n\t\t@closing=\"close\">\n\t\t<div v-if=\"!done\" class=\"cn-assign-dialog\">\n\t\t\t<div class=\"cn-assign-dialog__field\">\n\t\t\t\t<CnSearchSelect\n\t\t\t\t\t:modelValue=\"picked ? picked.id : null\"\n\t\t\t\t\t:inputId=\"assigneeId\"\n\t\t\t\t\t:inputLabel=\"assigneeLabel\"\n\t\t\t\t\t:labelOutside=\"false\"\n\t\t\t\t\t:options=\"shownOptions\"\n\t\t\t\t\t:loading=\"searching\"\n\t\t\t\t\t:filterable=\"false\"\n\t\t\t\t\t:placeholder=\"text(assigneeConfig.placeholder)\"\n\t\t\t\t\tdata-testid=\"cn-assign-dialog-assignee\"\n\t\t\t\t\t@search=\"onSearch\"\n\t\t\t\t\t@update:modelValue=\"onPick\" />\n\t\t\t\t<span v-if=\"assigneeHint\" class=\"cn-assign-dialog__hint\">{{ assigneeHint }}</span>\n\t\t\t</div>\n\n\t\t\t<div v-if=\"config.note !== false\" class=\"cn-assign-dialog__field\">\n\t\t\t\t<NcTextArea\n\t\t\t\t\t:id=\"noteId\"\n\t\t\t\t\tv-model=\"note\"\n\t\t\t\t\t:label=\"noteLabel\"\n\t\t\t\t\t:labelOutside=\"false\"\n\t\t\t\t\t:rows=\"noteConfig.rows || 3\"\n\t\t\t\t\tresize=\"vertical\"\n\t\t\t\t\tdata-testid=\"cn-assign-dialog-note\" />\n\t\t\t\t<span v-if=\"noteConfig.hint\" class=\"cn-assign-dialog__hint\">{{ text(noteConfig.hint) }}</span>\n\t\t\t</div>\n\n\t\t\t<div v-for=\"toggle in toggles\"\n\t\t\t\t:key=\"toggle.field\"\n\t\t\t\tclass=\"cn-assign-dialog__toggle\"\n\t\t\t\t:class=\"{ 'cn-assign-dialog__toggle--on': flags[toggle.field] }\"\n\t\t\t\t:data-testid=\"`cn-assign-dialog-toggle-${toggle.field}`\">\n\t\t\t\t<NcCheckboxRadioSwitch :modelValue=\"flags[toggle.field] === true\" @update:modelValue=\"flags[toggle.field] = $event\">\n\t\t\t\t\t<span class=\"cn-assign-dialog__toggle-title\">{{ fill(toggle.label) }}</span>\n\t\t\t\t</NcCheckboxRadioSwitch>\n\t\t\t\t<span v-if=\"toggle.note\" class=\"cn-assign-dialog__hint cn-assign-dialog__toggle-note\">{{ fill(toggle.note) || text(toggle.noteFallback) }}</span>\n\t\t\t</div>\n\n\t\t\t<p v-if=\"refusal\"\n\t\t\t\tclass=\"cn-assign-dialog__error\"\n\t\t\t\trole=\"alert\"\n\t\t\t\tdata-testid=\"cn-assign-dialog-refusal\">\n\t\t\t\t{{ refusal }}\n\t\t\t</p>\n\t\t</div>\n\n\t\t<p v-else role=\"status\" data-testid=\"cn-assign-dialog-done\">\n\t\t\t{{ text(config.doneText) || t('nextcloud-vue', 'Done') }}\n\t\t</p>\n\n\t\t<template #actions>\n\t\t\t<NcButton :disabled=\"busy\" data-testid=\"cn-assign-dialog-cancel\" @click=\"close\">\n\t\t\t\t{{ done ? t('nextcloud-vue', 'Close') : t('nextcloud-vue', 'Cancel') }}\n\t\t\t</NcButton>\n\t\t\t<NcButton v-if=\"!done\"\n\t\t\t\tvariant=\"primary\"\n\t\t\t\t:disabled=\"!canConfirm\"\n\t\t\t\tdata-testid=\"cn-assign-dialog-confirm\"\n\t\t\t\t@click=\"confirm\">\n\t\t\t\t<template #icon>\n\t\t\t\t\t<CnIcon :name=\"confirmConfig.icon || 'SwapHorizontal'\" :size=\"20\" />\n\t\t\t\t</template>\n\t\t\t\t{{ text(confirmConfig.label) || t('nextcloud-vue', 'Assign') }}\n\t\t\t</NcButton>\n\t\t</template>\n\t</CnDialog>\n</template>\n\n<script>\nimport axios from '@nextcloud/axios'\nimport { emit } from '@nextcloud/event-bus'\nimport { translate as t } from '@nextcloud/l10n'\nimport { generateUrl } from '@nextcloud/router'\nimport { NcButton, NcCheckboxRadioSwitch, NcTextArea } from '@nextcloud/vue'\nimport { fetchEndpointSource, interpolateUrlTokens } from '../../composables/useEndpointSource.js'\nimport { fillTemplate } from '../../utils/fillTemplate.js'\nimport { groupSublines } from '../../utils/groupSublines.js'\nimport { readPath } from '../../utils/readPath.js'\nimport { searchNextcloudGroups, searchNextcloudUsers } from '../../utils/userAutocomplete.js'\nimport { CnDialog } from '../CnDialog/index.js'\nimport { CnIcon } from '../CnIcon/index.js'\nimport { CnSearchSelect } from '../CnSearchSelect/index.js'\n\n/** The page refresh channel the built-in widgets listen on. */\nconst PAGE_REFRESH = 'cn:page:refresh'\n\n/** How long typing rests before a search runs, in ms. */\nconst SEARCH_DELAY = 250\n\n/** Gives each dialog's fields their own ids. */\nlet fieldSeq = 0\n\n/**\n * The found rows, with what was typed offered as an assignee of its own when\n * no row carries that id or name: where sharing is restricted the search\n * answers nothing, and an endpoint may still take the name.\n *\n * @param {Array<object>} found The rows found.\n * @param {string} typed What was typed.\n * @param {string} label The typed row's label.\n * @return {Array<object>} The rows.\n */\nexport function withTypedAssignee(found, typed, label) {\n\tconst lower = typed.toLowerCase()\n\tif (typed === '' || found.some((row) => String(row.id) === typed || String(row.label).toLowerCase() === lower)) {\n\t\treturn found\n\t}\n\treturn [...found, { id: typed, label, icon: 'AccountGroupOutline', kind: 'typed' }]\n}\n\n/**\n * CnAssignDialog — hand a record to another user or team, with a note and\n * optional switches, configured from the manifest (an `open-modal` action's\n * props). dossiq's case handover (board DqOverdragen: new team, why it moves,\n * \"this is a doorzending (Awb 2:3)\") is the first; pipelinq tickets and bulk\n * reassignment use the same dialog.\n *\n * `config`:\n * - `title`, `subtitle`, `doneText`: texts, through the host translate;\n * `eyebrow` a template filled from the record.\n * - `source`: an endpointSource to read the record from, else `object`.\n * - `assignee`: `{ kinds?, label?, placeholder?, hint?, currentPath?,\n * currentHint?, currentAs?, allowTyped?, field?, kindField?, describe? }`.\n * `describe` (`{ register, schema, groupField?, textField? }`) names the\n * records that hold a team's description; each team option then reads\n * \"{count} members · {description}\", the count where the viewer may read it. `kinds` is `[\"group\"]`\n * (default), `[\"user\"]` or both; `currentPath` reads who has it now from the\n * record and `currentHint` (\"Now with {current}.\", the placeholder named\n * by `currentAs`) says so, in place of `hint`; `allowTyped`\n * offers what was typed as a choice; the id is sent as `field` (default\n * `assignee`) and its kind as `kindField` when set.\n * - `note`: `{ label?, hint?, required?, field?, rows? }`, required by default and\n * sent as `field` (default `note`); `false` drops it. `rows` is the text\n * area's height in lines (default 3, as board DqOverdragen draws it).\n * - `toggles`: `[{ field, label, note?, noteFallback? }]`: switches that start\n * off and are sent as booleans; `label` and `note` are templates filled from\n * the record (\"{initiatorDisplayName} then gets a message\"); `noteFallback`\n * is shown when the record lacks a value the note names.\n * - `confirm`: `{ label?, icon?, request?: { method?, url, body? }, action? }`.\n * `request` sends the choice itself (`body` templates filled from the\n * record); `action` dispatches a manifest action with the choice as its\n * last argument.\n *\n * Tokens (`@objectId`, `@object.<field>`) resolve in every url. A refusal is\n * shown in the server's own words and the dialog stays open.\n */\nexport default {\n\tname: 'CnAssignDialog',\n\n\tcomponents: { CnDialog, CnIcon, CnSearchSelect, NcButton, NcCheckboxRadioSwitch, NcTextArea },\n\n\tinject: {\n\t\t/** The host app's translate (CnAppRoot `cnTranslate`). */\n\t\tcnTranslate: { default: () => (key) => key },\n\t\t/** The page's pre-bound action dispatcher (CnPageRenderer), for `confirm.action`. */\n\t\tcnDispatchAction: { default: null },\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * The dialog's configuration (see the component docs).\n\t\t *\n\t\t * @type {object}\n\t\t */\n\t\tconfig: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/** The record's id, for the `@objectId` token. */\n\t\tobjectId: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/**\n\t\t * The record, when the host has it.\n\t\t *\n\t\t * @type {object|null}\n\t\t */\n\t\tobject: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\t},\n\n\temits: ['close', 'done'],\n\n\tdata() {\n\t\tconst seq = ++fieldSeq\n\t\tconst flags = {}\n\t\tfor (const toggle of Array.isArray(this.config.toggles) ? this.config.toggles : []) {\n\t\t\tif (toggle && toggle.field) {\n\t\t\t\tflags[toggle.field] = false\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\trecord: this.object,\n\t\t\toptions: [],\n\t\t\tpicked: null,\n\t\t\tsearching: false,\n\t\t\ttimer: null,\n\t\t\tsearchSeq: 0,\n\t\t\tnote: '',\n\t\t\tflags,\n\t\t\tbusy: false,\n\t\t\trefusal: '',\n\t\t\tdone: false,\n\t\t\tassigneeId: `cn-assign-dialog-assignee-${seq}`,\n\t\t\tnoteId: `cn-assign-dialog-note-${seq}`,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** @return {object} The token context. */\n\t\ttokenCtx() {\n\t\t\treturn { objectId: this.recordId, object: this.record || {} }\n\t\t},\n\n\t\t/**\n\t\t * The record's id: `objectId`, or the route's `id` when the prop is\n\t\t * empty or a token the opener could not resolve.\n\t\t *\n\t\t * @return {string|number}\n\t\t */\n\t\trecordId() {\n\t\t\tconst given = this.objectId\n\t\t\tif (given !== '' && given !== null && given !== undefined && !String(given).startsWith('@')) {\n\t\t\t\treturn given\n\t\t\t}\n\t\t\treturn (this.$route && this.$route.params && this.$route.params.id) || ''\n\t\t},\n\n\t\t/** @return {object} The assignee config. */\n\t\tassigneeConfig() {\n\t\t\treturn this.config.assignee && typeof this.config.assignee === 'object' ? this.config.assignee : {}\n\t\t},\n\n\t\t/** @return {object} The note config. */\n\t\tnoteConfig() {\n\t\t\treturn this.config.note && typeof this.config.note === 'object' ? this.config.note : {}\n\t\t},\n\n\t\t/** @return {object} The confirm config. */\n\t\tconfirmConfig() {\n\t\t\treturn this.config.confirm && typeof this.config.confirm === 'object' ? this.config.confirm : {}\n\t\t},\n\n\t\t/** @return {Array<object>} The switches with a field. */\n\t\ttoggles() {\n\t\t\treturn (Array.isArray(this.config.toggles) ? this.config.toggles : []).filter((toggle) => toggle && toggle.field)\n\t\t},\n\n\t\t/** @return {string[]} The kinds searched: `group`, `user`. */\n\t\tkinds() {\n\t\t\tconst kinds = Array.isArray(this.assigneeConfig.kinds) ? this.assigneeConfig.kinds.filter((k) => k === 'group' || k === 'user') : []\n\t\t\treturn kinds.length ? kinds : ['group']\n\t\t},\n\n\t\t/** @return {string} The assignee field's label. */\n\t\tassigneeLabel() {\n\t\t\tif (this.assigneeConfig.label) {\n\t\t\t\treturn this.text(this.assigneeConfig.label)\n\t\t\t}\n\t\t\treturn this.kinds.length === 1 && this.kinds[0] === 'user' ? t('nextcloud-vue', 'New handler') : t('nextcloud-vue', 'New team')\n\t\t},\n\n\t\t/** @return {string} Who has the record now, read from it. */\n\t\tcurrent() {\n\t\t\tconst path = this.assigneeConfig.currentPath\n\t\t\tconst value = path && this.record ? readPath(this.record, path) : ''\n\t\t\treturn value === undefined || value === null ? '' : String(value)\n\t\t},\n\n\t\t/**\n\t\t * The hint under the assignee field: who has it now, else the configured hint.\n\t\t *\n\t\t * @spec openspec/changes/assign-dialog/specs/assign-dialog/spec.md#requirement-a-manifest-configures-an-assign-dialog\n\t\t * @return {string}\n\t\t */\n\t\tassigneeHint() {\n\t\t\tconst name = this.assigneeConfig.currentAs || 'current'\n\t\t\tconst now = this.current && this.assigneeConfig.currentHint ? fillTemplate(this.cnTranslate(this.assigneeConfig.currentHint), { [name]: this.current }) : ''\n\t\t\treturn now || this.text(this.assigneeConfig.hint)\n\t\t},\n\n\t\t/** @return {Array<object>} The rows, keeping the picked one listed. */\n\t\tshownOptions() {\n\t\t\tif (this.picked && !this.options.some((o) => String(o.id) === String(this.picked.id))) {\n\t\t\t\treturn [this.picked, ...this.options]\n\t\t\t}\n\t\t\treturn this.options\n\t\t},\n\n\t\t/** @return {boolean} Whether a note is asked and needed. */\n\t\tnoteNeeded() {\n\t\t\treturn this.config.note !== false && this.noteConfig.required !== false\n\t\t},\n\n\t\t/** @return {string} The note field's label. */\n\t\tnoteLabel() {\n\t\t\treturn this.text(this.noteConfig.label) || t('nextcloud-vue', 'Why it is moving')\n\t\t},\n\n\t\t/**\n\t\t * Whether the assignment may run: an assignee, a note when needed, nothing in flight.\n\t\t *\n\t\t * @spec openspec/changes/assign-dialog/specs/assign-dialog/spec.md#requirement-a-manifest-configures-an-assign-dialog\n\t\t * @return {boolean}\n\t\t */\n\t\tcanConfirm() {\n\t\t\treturn !this.busy && this.picked !== null && (!this.noteNeeded || this.note.trim() !== '')\n\t\t},\n\t},\n\n\tasync mounted() {\n\t\tconst source = this.config.source\n\t\tif (source && source.url) {\n\t\t\ttry {\n\t\t\t\tconst data = await fetchEndpointSource(source, this.tokenCtx, { fresh: true })\n\t\t\t\tthis.record = data && typeof data === 'object' ? data : this.record\n\t\t\t} catch {\n\t\t\t\t// The hint stays without the current assignee; the dialog still works.\n\t\t\t}\n\t\t}\n\t},\n\n\tbeforeUnmount() {\n\t\tclearTimeout(this.timer)\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * A config text through the host translate, '' for anything else.\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 * A template filled from the record, translated first.\n\t\t *\n\t\t * @param {unknown} template The template.\n\t\t * @return {string}\n\t\t */\n\t\tfill(template) {\n\t\t\tif (typeof template !== 'string' || template === '') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\treturn fillTemplate(this.cnTranslate(template), this.record || {}).trim()\n\t\t},\n\n\t\t/**\n\t\t * Search after typing rests.\n\t\t *\n\t\t * @param {string} query What was typed.\n\t\t */\n\t\tonSearch(query) {\n\t\t\tclearTimeout(this.timer)\n\t\t\tconst typed = String(query ?? '').trim()\n\t\t\tif (typed === '') {\n\t\t\t\tthis.options = []\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.timer = setTimeout(() => this.search(typed), SEARCH_DELAY)\n\t\t},\n\n\t\t/**\n\t\t * Search the configured kinds; offer what was typed when allowed.\n\t\t *\n\t\t * @spec openspec/changes/assign-dialog/specs/assign-dialog/spec.md#requirement-a-manifest-configures-an-assign-dialog\n\t\t * @param {string} typed What was typed.\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync search(typed) {\n\t\t\tconst seq = ++this.searchSeq\n\t\t\tthis.searching = true\n\t\t\tconst [groups, users] = await Promise.all([\n\t\t\t\tthis.kinds.includes('group') ? searchNextcloudGroups(typed, { limit: 20 }) : [],\n\t\t\t\tthis.kinds.includes('user') ? searchNextcloudUsers(typed, { limit: 20 }) : [],\n\t\t\t])\n\t\t\tif (seq !== this.searchSeq) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst lines = await groupSublines(groups.map((g) => g.id), typed, this.assigneeConfig.describe || null)\n\t\t\tif (seq !== this.searchSeq) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst found = [\n\t\t\t\t...groups.map((g) => ({ id: g.id, label: g.label, secondary: lines[g.id] || g.subline || '', icon: 'AccountGroupOutline', kind: 'group' })),\n\t\t\t\t...users.map((u) => ({ id: u.id, label: u.label, secondary: u.subline || '', avatar: true, kind: 'user' })),\n\t\t\t]\n\t\t\tthis.options = this.assigneeConfig.allowTyped ? withTypedAssignee(found, typed, t('nextcloud-vue', 'Use \"{name}\"', { name: typed })) : found\n\t\t\tthis.searching = false\n\t\t},\n\n\t\t/**\n\t\t * Take the picked row.\n\t\t *\n\t\t * @param {string|null} id The picked id.\n\t\t */\n\t\tonPick(id) {\n\t\t\tthis.picked = id === null ? null : (this.shownOptions.find((o) => String(o.id) === String(id)) || null)\n\t\t},\n\n\t\t/**\n\t\t * The choice as sent: assignee, its kind, the note and the switches.\n\t\t *\n\t\t * @return {object}\n\t\t */\n\t\tchoice() {\n\t\t\tconst out = { [this.assigneeConfig.field || 'assignee']: String(this.picked.id) }\n\t\t\tif (this.assigneeConfig.kindField) {\n\t\t\t\tout[this.assigneeConfig.kindField] = this.picked.kind === 'typed' ? this.kinds[0] : this.picked.kind\n\t\t\t}\n\t\t\tif (this.config.note !== false) {\n\t\t\t\tout[this.noteConfig.field || 'note'] = this.note.trim()\n\t\t\t}\n\t\t\treturn { ...out, ...this.flags }\n\t\t},\n\n\t\t/**\n\t\t * Assign once: send `confirm.request`, or dispatch `confirm.action`,\n\t\t * then show the done text and refresh the page.\n\t\t *\n\t\t * @spec openspec/changes/assign-dialog/specs/assign-dialog/spec.md#requirement-a-manifest-configures-an-assign-dialog\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync confirm() {\n\t\t\tif (!this.canConfirm) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.busy = true\n\t\t\tthis.refusal = ''\n\t\t\tconst choice = this.choice()\n\t\t\ttry {\n\t\t\t\tconst request = this.confirmConfig.request\n\t\t\t\tif (request && request.url) {\n\t\t\t\t\tconst url = interpolateUrlTokens(request.url, this.tokenCtx)\n\t\t\t\t\tconst body = {}\n\t\t\t\t\tfor (const [key, value] of Object.entries(request.body || {})) {\n\t\t\t\t\t\tbody[key] = typeof value === 'string' ? fillTemplate(value, this.record || {}) : value\n\t\t\t\t\t}\n\t\t\t\t\tconst method = String(request.method || 'POST').toLowerCase()\n\t\t\t\t\tawait axios[['post', 'put', 'patch'].includes(method) ? method : 'post'](/^https?:\\/\\//i.test(url) ? url : generateUrl(url), { ...body, ...choice })\n\t\t\t\t} else if (this.confirmConfig.action && typeof this.cnDispatchAction === 'function') {\n\t\t\t\t\tawait this.cnDispatchAction({ ...this.confirmConfig.action, args: [...(this.confirmConfig.action.args || []), choice] })\n\t\t\t\t}\n\t\t\t\tthis.done = true\n\t\t\t\temit(PAGE_REFRESH, {})\n\t\t\t\t/** @event done The assignment ran. Payload: the choice as sent. */\n\t\t\t\tthis.$emit('done', choice)\n\t\t\t} catch (failure) {\n\t\t\t\tconst data = failure && failure.response && failure.response.data\n\t\t\t\tthis.refusal = String((data && (data.message || data.error)) || t('nextcloud-vue', 'It was not handed over.'))\n\t\t\t} finally {\n\t\t\t\tthis.busy = false\n\t\t\t}\n\t\t},\n\n\t\t/** Close the dialog, unless the assignment is running. */\n\t\tclose() {\n\t\t\tif (this.busy) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\t/** @event close The dialog was closed. */\n\t\t\tthis.$emit('close')\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-assign-dialog {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 18px;\n}\n\n.cn-assign-dialog__field {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 6px;\n}\n\n/* The assignee label sits above its field, as the note's does. */\n.cn-assign-dialog__field :deep(.select__label) {\n\tdisplay: block;\n\tmargin-bottom: 6px;\n\tfont-size: 14px;\n\tfont-weight: 600;\n\tcolor: var(--color-main-text);\n}\n\n.cn-assign-dialog__hint {\n\tfont-size: 13px;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-assign-dialog__toggle {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 2px;\n\tpadding: 12px 14px;\n\tborder: 1px solid var(--color-border-dark);\n\tborder-radius: var(--border-radius-large, 8px);\n}\n\n.cn-assign-dialog__toggle--on {\n\tborder: 2px solid var(--color-primary-element);\n\tbackground: var(--color-primary-element-light);\n}\n\n.cn-assign-dialog__toggle-title {\n\tfont-weight: 600;\n}\n\n.cn-assign-dialog__toggle-note {\n\tpadding-inline-start: var(--cn-dialog-check-label-inset, 44px);\n}\n\n.cn-assign-dialog__error {\n\tmargin: 0;\n\tcolor: var(--color-error-text, var(--color-error));\n}\n</style>\n"],"names":["_createVNode","_createBlock","_createTextVNode","_openBlock","_createElementBlock","_toDisplayString","_Fragment","_renderList"],"mappings":";;;;AAiBoB,EAAA,KAAK,EAAA,kBAAA;;AACjB,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,yBAAiB,GAAA;;;AAajB,EAAA,KAAA,EAAA,wBAAA;;;;AAGQ,EAAA,KAAA,EAAA,yBAAA;;;;AASA,EAAA,KAAA,EAAA,wBAAA;;;;;;AAWO,EAAA,KAAK,EAAA,sDAAA;;;;AAI9B,EAAA,KAAE,EAAA,yBAAA;AACF,EAAA,IAAG,EAAA,OAAA;;;;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AC,MAAM,CAAA,MAAA,CAAC,QAAQ,CAAA,IAAK,QAAC,CAAA,CAAA,CAAA,eAAA,EAAA,MAAA,CAAA,CAAA,EAAA,CAAA,YAAA,CAAA;;;;;;;;"}
1
+ {"version":3,"file":"CnAssignDialog.vue3.js","sources":["../../../../src/components/CnAssignDialog/CnAssignDialog.vue?vue&type=template&id=6ea0c632&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n<template>\n\t<CnDialog\n\t\t:name=\"text(config.title) || t('nextcloud-vue', 'Assign')\"\n\t\t:eyebrow=\"fill(config.eyebrow)\"\n\t\t:subtitle=\"text(config.subtitle)\"\n\t\twidth=\"form\"\n\t\t:noClose=\"busy\"\n\t\tdata-testid=\"cn-assign-dialog\"\n\t\t@closing=\"close\">\n\t\t<div v-if=\"!done\" class=\"cn-assign-dialog\">\n\t\t\t<div class=\"cn-assign-dialog__field\">\n\t\t\t\t<CnSearchSelect\n\t\t\t\t\t:modelValue=\"picked ? picked.id : null\"\n\t\t\t\t\t:inputId=\"assigneeId\"\n\t\t\t\t\t:inputLabel=\"assigneeLabel\"\n\t\t\t\t\t:labelOutside=\"false\"\n\t\t\t\t\t:options=\"shownOptions\"\n\t\t\t\t\t:loading=\"searching\"\n\t\t\t\t\t:filterable=\"false\"\n\t\t\t\t\t:placeholder=\"text(assigneeConfig.placeholder)\"\n\t\t\t\t\tdata-testid=\"cn-assign-dialog-assignee\"\n\t\t\t\t\t@search=\"onSearch\"\n\t\t\t\t\t@update:modelValue=\"onPick\" />\n\t\t\t\t<span v-if=\"assigneeHint\" class=\"cn-assign-dialog__hint\">{{ assigneeHint }}</span>\n\t\t\t</div>\n\n\t\t\t<div v-if=\"config.note !== false\" class=\"cn-assign-dialog__field\">\n\t\t\t\t<NcTextArea\n\t\t\t\t\t:id=\"noteId\"\n\t\t\t\t\tv-model=\"note\"\n\t\t\t\t\t:label=\"noteLabel\"\n\t\t\t\t\t:labelOutside=\"false\"\n\t\t\t\t\t:rows=\"noteConfig.rows || 3\"\n\t\t\t\t\tresize=\"vertical\"\n\t\t\t\t\tdata-testid=\"cn-assign-dialog-note\" />\n\t\t\t\t<span v-if=\"noteConfig.hint\" class=\"cn-assign-dialog__hint\">{{ text(noteConfig.hint) }}</span>\n\t\t\t</div>\n\n\t\t\t<div v-for=\"toggle in toggles\"\n\t\t\t\t:key=\"toggle.field\"\n\t\t\t\tclass=\"cn-assign-dialog__toggle\"\n\t\t\t\t:class=\"{ 'cn-assign-dialog__toggle--on': flags[toggle.field] }\"\n\t\t\t\t:data-testid=\"`cn-assign-dialog-toggle-${toggle.field}`\">\n\t\t\t\t<NcCheckboxRadioSwitch :modelValue=\"flags[toggle.field] === true\" @update:modelValue=\"flags[toggle.field] = $event\">\n\t\t\t\t\t<span class=\"cn-assign-dialog__toggle-title\">{{ fill(toggle.label) }}</span>\n\t\t\t\t</NcCheckboxRadioSwitch>\n\t\t\t\t<span v-if=\"toggle.note\" class=\"cn-assign-dialog__hint cn-assign-dialog__toggle-note\">{{ fill(toggle.note) || text(toggle.noteFallback) }}</span>\n\t\t\t</div>\n\n\t\t\t<p v-if=\"refusal\"\n\t\t\t\tclass=\"cn-assign-dialog__error\"\n\t\t\t\trole=\"alert\"\n\t\t\t\tdata-testid=\"cn-assign-dialog-refusal\">\n\t\t\t\t{{ refusal }}\n\t\t\t</p>\n\t\t</div>\n\n\t\t<p v-else role=\"status\" data-testid=\"cn-assign-dialog-done\">\n\t\t\t{{ text(config.doneText) || t('nextcloud-vue', 'Done') }}\n\t\t</p>\n\n\t\t<template #actions>\n\t\t\t<NcButton :disabled=\"busy\" data-testid=\"cn-assign-dialog-cancel\" @click=\"close\">\n\t\t\t\t{{ done ? t('nextcloud-vue', 'Close') : t('nextcloud-vue', 'Cancel') }}\n\t\t\t</NcButton>\n\t\t\t<NcButton v-if=\"!done\"\n\t\t\t\tvariant=\"primary\"\n\t\t\t\t:disabled=\"!canConfirm\"\n\t\t\t\tdata-testid=\"cn-assign-dialog-confirm\"\n\t\t\t\t@click=\"confirm\">\n\t\t\t\t<template #icon>\n\t\t\t\t\t<CnIcon :name=\"confirmConfig.icon || 'SwapHorizontal'\" :size=\"20\" />\n\t\t\t\t</template>\n\t\t\t\t{{ text(confirmConfig.label) || t('nextcloud-vue', 'Assign') }}\n\t\t\t</NcButton>\n\t\t</template>\n\t</CnDialog>\n</template>\n\n<script>\nimport axios from '@nextcloud/axios'\nimport { emit } from '@nextcloud/event-bus'\nimport { translate as t } from '@nextcloud/l10n'\nimport { generateUrl } from '@nextcloud/router'\nimport { NcButton, NcCheckboxRadioSwitch, NcTextArea } from '@nextcloud/vue'\nimport { fetchEndpointSource, interpolateUrlTokens } from '../../composables/useEndpointSource.js'\nimport { fillTemplate } from '../../utils/fillTemplate.js'\nimport { describedGroupIds, groupSublines } from '../../utils/groupSublines.js'\nimport { readPath } from '../../utils/readPath.js'\nimport { searchNextcloudGroups, searchNextcloudUsers } from '../../utils/userAutocomplete.js'\nimport { CnDialog } from '../CnDialog/index.js'\nimport { CnIcon } from '../CnIcon/index.js'\nimport { CnSearchSelect } from '../CnSearchSelect/index.js'\n\n/** The page refresh channel the built-in widgets listen on. */\nconst PAGE_REFRESH = 'cn:page:refresh'\n\n/** How long typing rests before a search runs, in ms. */\nconst SEARCH_DELAY = 250\n\n/** Gives each dialog's fields their own ids. */\nlet fieldSeq = 0\n\n/**\n * The found rows, with what was typed offered as an assignee of its own when\n * no row carries that id or name: where sharing is restricted the search\n * answers nothing, and an endpoint may still take the name.\n *\n * @param {Array<object>} found The rows found.\n * @param {string} typed What was typed.\n * @param {string} label The typed row's label.\n * @return {Array<object>} The rows.\n */\nexport function withTypedAssignee(found, typed, label) {\n\tconst lower = typed.toLowerCase()\n\tif (typed === '' || found.some((row) => String(row.id) === typed || String(row.label).toLowerCase() === lower)) {\n\t\treturn found\n\t}\n\treturn [...found, { id: typed, label, icon: 'AccountGroupOutline', kind: 'typed' }]\n}\n\n/**\n * CnAssignDialog — hand a record to another user or team, with a note and\n * optional switches, configured from the manifest (an `open-modal` action's\n * props). dossiq's case handover (board DqOverdragen: new team, why it moves,\n * \"this is a doorzending (Awb 2:3)\") is the first; pipelinq tickets and bulk\n * reassignment use the same dialog.\n *\n * `config`:\n * - `title`, `subtitle`, `doneText`: texts, through the host translate;\n * `eyebrow` a template filled from the record.\n * - `source`: an endpointSource to read the record from, else `object`.\n * - `assignee`: `{ kinds?, label?, placeholder?, hint?, currentPath?,\n * currentHint?, currentAs?, allowTyped?, field?, kindField?, describe? }`.\n * `describe` (`{ register, schema, groupField?, textField?, only? }`) names the\n * records that hold a team's description; each team option then reads\n * \"{count} members · {description}\", the count where the viewer may read it.\n * With `only` the search lists just the groups such a record names (the\n * app's teams, not every Nextcloud group); with no record at all it lists every group. `kinds` is `[\"group\"]`\n * (default), `[\"user\"]` or both; `currentPath` reads who has it now from the\n * record and `currentHint` (\"Now with {current}.\", the placeholder named\n * by `currentAs`) says so, in place of `hint`; `allowTyped`\n * offers what was typed as a choice; the id is sent as `field` (default\n * `assignee`) and its kind as `kindField` when set.\n * - `note`: `{ label?, hint?, required?, field?, rows? }`, required by default and\n * sent as `field` (default `note`); `false` drops it. `rows` is the text\n * area's height in lines (default 3, as board DqOverdragen draws it).\n * - `toggles`: `[{ field, label, note?, noteFallback? }]`: switches that start\n * off and are sent as booleans; `label` and `note` are templates filled from\n * the record (\"{initiatorDisplayName} then gets a message\"); `noteFallback`\n * is shown when the record lacks a value the note names.\n * - `confirm`: `{ label?, icon?, request?: { method?, url, body? }, action? }`.\n * `request` sends the choice itself (`body` templates filled from the\n * record); `action` dispatches a manifest action with the choice as its\n * last argument.\n *\n * Tokens (`@objectId`, `@object.<field>`) resolve in every url. A refusal is\n * shown in the server's own words and the dialog stays open.\n */\nexport default {\n\tname: 'CnAssignDialog',\n\n\tcomponents: { CnDialog, CnIcon, CnSearchSelect, NcButton, NcCheckboxRadioSwitch, NcTextArea },\n\n\tinject: {\n\t\t/** The host app's translate (CnAppRoot `cnTranslate`). */\n\t\tcnTranslate: { default: () => (key) => key },\n\t\t/** The page's pre-bound action dispatcher (CnPageRenderer), for `confirm.action`. */\n\t\tcnDispatchAction: { default: null },\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * The dialog's configuration (see the component docs).\n\t\t *\n\t\t * @type {object}\n\t\t */\n\t\tconfig: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/** The record's id, for the `@objectId` token. */\n\t\tobjectId: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/**\n\t\t * The record, when the host has it.\n\t\t *\n\t\t * @type {object|null}\n\t\t */\n\t\tobject: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\t},\n\n\temits: ['close', 'done'],\n\n\tdata() {\n\t\tconst seq = ++fieldSeq\n\t\tconst flags = {}\n\t\tfor (const toggle of Array.isArray(this.config.toggles) ? this.config.toggles : []) {\n\t\t\tif (toggle && toggle.field) {\n\t\t\t\tflags[toggle.field] = false\n\t\t\t}\n\t\t}\n\t\treturn {\n\t\t\trecord: this.object,\n\t\t\toptions: [],\n\t\t\tpicked: null,\n\t\t\tsearching: false,\n\t\t\ttimer: null,\n\t\t\tsearchSeq: 0,\n\t\t\tnote: '',\n\t\t\tflags,\n\t\t\tbusy: false,\n\t\t\trefusal: '',\n\t\t\tdone: false,\n\t\t\tassigneeId: `cn-assign-dialog-assignee-${seq}`,\n\t\t\tnoteId: `cn-assign-dialog-note-${seq}`,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** @return {object} The token context. */\n\t\ttokenCtx() {\n\t\t\treturn { objectId: this.recordId, object: this.record || {} }\n\t\t},\n\n\t\t/**\n\t\t * The record's id: `objectId`, or the route's `id` when the prop is\n\t\t * empty or a token the opener could not resolve.\n\t\t *\n\t\t * @return {string|number}\n\t\t */\n\t\trecordId() {\n\t\t\tconst given = this.objectId\n\t\t\tif (given !== '' && given !== null && given !== undefined && !String(given).startsWith('@')) {\n\t\t\t\treturn given\n\t\t\t}\n\t\t\treturn (this.$route && this.$route.params && this.$route.params.id) || ''\n\t\t},\n\n\t\t/** @return {object} The assignee config. */\n\t\tassigneeConfig() {\n\t\t\treturn this.config.assignee && typeof this.config.assignee === 'object' ? this.config.assignee : {}\n\t\t},\n\n\t\t/** @return {object} The note config. */\n\t\tnoteConfig() {\n\t\t\treturn this.config.note && typeof this.config.note === 'object' ? this.config.note : {}\n\t\t},\n\n\t\t/** @return {object} The confirm config. */\n\t\tconfirmConfig() {\n\t\t\treturn this.config.confirm && typeof this.config.confirm === 'object' ? this.config.confirm : {}\n\t\t},\n\n\t\t/** @return {Array<object>} The switches with a field. */\n\t\ttoggles() {\n\t\t\treturn (Array.isArray(this.config.toggles) ? this.config.toggles : []).filter((toggle) => toggle && toggle.field)\n\t\t},\n\n\t\t/** @return {string[]} The kinds searched: `group`, `user`. */\n\t\tkinds() {\n\t\t\tconst kinds = Array.isArray(this.assigneeConfig.kinds) ? this.assigneeConfig.kinds.filter((k) => k === 'group' || k === 'user') : []\n\t\t\treturn kinds.length ? kinds : ['group']\n\t\t},\n\n\t\t/** @return {string} The assignee field's label. */\n\t\tassigneeLabel() {\n\t\t\tif (this.assigneeConfig.label) {\n\t\t\t\treturn this.text(this.assigneeConfig.label)\n\t\t\t}\n\t\t\treturn this.kinds.length === 1 && this.kinds[0] === 'user' ? t('nextcloud-vue', 'New handler') : t('nextcloud-vue', 'New team')\n\t\t},\n\n\t\t/** @return {string} Who has the record now, read from it. */\n\t\tcurrent() {\n\t\t\tconst path = this.assigneeConfig.currentPath\n\t\t\tconst value = path && this.record ? readPath(this.record, path) : ''\n\t\t\treturn value === undefined || value === null ? '' : String(value)\n\t\t},\n\n\t\t/**\n\t\t * The hint under the assignee field: who has it now, else the configured hint.\n\t\t *\n\t\t * @spec openspec/changes/assign-dialog/specs/assign-dialog/spec.md#requirement-a-manifest-configures-an-assign-dialog\n\t\t * @return {string}\n\t\t */\n\t\tassigneeHint() {\n\t\t\tconst name = this.assigneeConfig.currentAs || 'current'\n\t\t\tconst now = this.current && this.assigneeConfig.currentHint ? fillTemplate(this.cnTranslate(this.assigneeConfig.currentHint), { [name]: this.current }) : ''\n\t\t\treturn now || this.text(this.assigneeConfig.hint)\n\t\t},\n\n\t\t/** @return {Array<object>} The rows, keeping the picked one listed. */\n\t\tshownOptions() {\n\t\t\tif (this.picked && !this.options.some((o) => String(o.id) === String(this.picked.id))) {\n\t\t\t\treturn [this.picked, ...this.options]\n\t\t\t}\n\t\t\treturn this.options\n\t\t},\n\n\t\t/** @return {boolean} Whether a note is asked and needed. */\n\t\tnoteNeeded() {\n\t\t\treturn this.config.note !== false && this.noteConfig.required !== false\n\t\t},\n\n\t\t/** @return {string} The note field's label. */\n\t\tnoteLabel() {\n\t\t\treturn this.text(this.noteConfig.label) || t('nextcloud-vue', 'Why it is moving')\n\t\t},\n\n\t\t/**\n\t\t * Whether the assignment may run: an assignee, a note when needed, nothing in flight.\n\t\t *\n\t\t * @spec openspec/changes/assign-dialog/specs/assign-dialog/spec.md#requirement-a-manifest-configures-an-assign-dialog\n\t\t * @return {boolean}\n\t\t */\n\t\tcanConfirm() {\n\t\t\treturn !this.busy && this.picked !== null && (!this.noteNeeded || this.note.trim() !== '')\n\t\t},\n\t},\n\n\tasync mounted() {\n\t\tconst source = this.config.source\n\t\tif (source && source.url) {\n\t\t\ttry {\n\t\t\t\tconst data = await fetchEndpointSource(source, this.tokenCtx, { fresh: true })\n\t\t\t\tthis.record = data && typeof data === 'object' ? data : this.record\n\t\t\t} catch {\n\t\t\t\t// The hint stays without the current assignee; the dialog still works.\n\t\t\t}\n\t\t}\n\t},\n\n\tbeforeUnmount() {\n\t\tclearTimeout(this.timer)\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * A config text through the host translate, '' for anything else.\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 * A template filled from the record, translated first.\n\t\t *\n\t\t * @param {unknown} template The template.\n\t\t * @return {string}\n\t\t */\n\t\tfill(template) {\n\t\t\tif (typeof template !== 'string' || template === '') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\treturn fillTemplate(this.cnTranslate(template), this.record || {}).trim()\n\t\t},\n\n\t\t/**\n\t\t * Search after typing rests.\n\t\t *\n\t\t * @param {string} query What was typed.\n\t\t */\n\t\tonSearch(query) {\n\t\t\tclearTimeout(this.timer)\n\t\t\tconst typed = String(query ?? '').trim()\n\t\t\tif (typed === '') {\n\t\t\t\tthis.options = []\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.timer = setTimeout(() => this.search(typed), SEARCH_DELAY)\n\t\t},\n\n\t\t/**\n\t\t * Search the configured kinds; offer what was typed when allowed.\n\t\t *\n\t\t * @spec openspec/changes/assign-dialog/specs/assign-dialog/spec.md#requirement-a-manifest-configures-an-assign-dialog\n\t\t * @param {string} typed What was typed.\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync search(typed) {\n\t\t\tconst seq = ++this.searchSeq\n\t\t\tthis.searching = true\n\t\t\tconst [groups, users] = await Promise.all([\n\t\t\t\tthis.kinds.includes('group') ? searchNextcloudGroups(typed, { limit: 20 }) : [],\n\t\t\t\tthis.kinds.includes('user') ? searchNextcloudUsers(typed, { limit: 20 }) : [],\n\t\t\t])\n\t\t\tif (seq !== this.searchSeq) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst describe = this.assigneeConfig.describe || null\n\t\t\tconst teams = describe && describe.only ? await describedGroupIds(describe) : null\n\t\t\tconst listed = teams && teams.size > 0 ? groups.filter((g) => teams.has(String(g.id))) : groups\n\t\t\tconst lines = await groupSublines(listed.map((g) => g.id), typed, describe)\n\t\t\tif (seq !== this.searchSeq) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst found = [\n\t\t\t\t...listed.map((g) => ({ id: g.id, label: g.label, secondary: lines[g.id] || g.subline || '', icon: 'AccountGroupOutline', kind: 'group' })),\n\t\t\t\t...users.map((u) => ({ id: u.id, label: u.label, secondary: u.subline || '', avatar: true, kind: 'user' })),\n\t\t\t]\n\t\t\tthis.options = this.assigneeConfig.allowTyped ? withTypedAssignee(found, typed, t('nextcloud-vue', 'Use \"{name}\"', { name: typed })) : found\n\t\t\tthis.searching = false\n\t\t},\n\n\t\t/**\n\t\t * Take the picked row.\n\t\t *\n\t\t * @param {string|null} id The picked id.\n\t\t */\n\t\tonPick(id) {\n\t\t\tthis.picked = id === null ? null : (this.shownOptions.find((o) => String(o.id) === String(id)) || null)\n\t\t},\n\n\t\t/**\n\t\t * The choice as sent: assignee, its kind, the note and the switches.\n\t\t *\n\t\t * @return {object}\n\t\t */\n\t\tchoice() {\n\t\t\tconst out = { [this.assigneeConfig.field || 'assignee']: String(this.picked.id) }\n\t\t\tif (this.assigneeConfig.kindField) {\n\t\t\t\tout[this.assigneeConfig.kindField] = this.picked.kind === 'typed' ? this.kinds[0] : this.picked.kind\n\t\t\t}\n\t\t\tif (this.config.note !== false) {\n\t\t\t\tout[this.noteConfig.field || 'note'] = this.note.trim()\n\t\t\t}\n\t\t\treturn { ...out, ...this.flags }\n\t\t},\n\n\t\t/**\n\t\t * Assign once: send `confirm.request`, or dispatch `confirm.action`,\n\t\t * then show the done text and refresh the page.\n\t\t *\n\t\t * @spec openspec/changes/assign-dialog/specs/assign-dialog/spec.md#requirement-a-manifest-configures-an-assign-dialog\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync confirm() {\n\t\t\tif (!this.canConfirm) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.busy = true\n\t\t\tthis.refusal = ''\n\t\t\tconst choice = this.choice()\n\t\t\ttry {\n\t\t\t\tconst request = this.confirmConfig.request\n\t\t\t\tif (request && request.url) {\n\t\t\t\t\tconst url = interpolateUrlTokens(request.url, this.tokenCtx)\n\t\t\t\t\tconst body = {}\n\t\t\t\t\tfor (const [key, value] of Object.entries(request.body || {})) {\n\t\t\t\t\t\tbody[key] = typeof value === 'string' ? fillTemplate(value, this.record || {}) : value\n\t\t\t\t\t}\n\t\t\t\t\tconst method = String(request.method || 'POST').toLowerCase()\n\t\t\t\t\tawait axios[['post', 'put', 'patch'].includes(method) ? method : 'post'](/^https?:\\/\\//i.test(url) ? url : generateUrl(url), { ...body, ...choice })\n\t\t\t\t} else if (this.confirmConfig.action && typeof this.cnDispatchAction === 'function') {\n\t\t\t\t\tawait this.cnDispatchAction({ ...this.confirmConfig.action, args: [...(this.confirmConfig.action.args || []), choice] })\n\t\t\t\t}\n\t\t\t\tthis.done = true\n\t\t\t\temit(PAGE_REFRESH, {})\n\t\t\t\t/** @event done The assignment ran. Payload: the choice as sent. */\n\t\t\t\tthis.$emit('done', choice)\n\t\t\t} catch (failure) {\n\t\t\t\tconst data = failure && failure.response && failure.response.data\n\t\t\t\tthis.refusal = String((data && (data.message || data.error)) || t('nextcloud-vue', 'It was not handed over.'))\n\t\t\t} finally {\n\t\t\t\tthis.busy = false\n\t\t\t}\n\t\t},\n\n\t\t/** Close the dialog, unless the assignment is running. */\n\t\tclose() {\n\t\t\tif (this.busy) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\t/** @event close The dialog was closed. */\n\t\t\tthis.$emit('close')\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-assign-dialog {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 18px;\n}\n\n.cn-assign-dialog__field {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 6px;\n}\n\n/* The assignee label sits above its field, as the note's does. */\n.cn-assign-dialog__field :deep(.select__label) {\n\tdisplay: block;\n\tmargin-bottom: 6px;\n\tfont-size: 14px;\n\tfont-weight: 600;\n\tcolor: var(--color-main-text);\n}\n\n.cn-assign-dialog__hint {\n\tfont-size: 13px;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-assign-dialog__toggle {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 2px;\n\tpadding: 12px 14px;\n\tborder: 1px solid var(--color-border-dark);\n\tborder-radius: var(--border-radius-large, 8px);\n}\n\n.cn-assign-dialog__toggle--on {\n\tborder: 2px solid var(--color-primary-element);\n\tbackground: var(--color-primary-element-light);\n}\n\n.cn-assign-dialog__toggle-title {\n\tfont-weight: 600;\n}\n\n.cn-assign-dialog__toggle-note {\n\tpadding-inline-start: var(--cn-dialog-check-label-inset, 44px);\n}\n\n.cn-assign-dialog__error {\n\tmargin: 0;\n\tcolor: var(--color-error-text, var(--color-error));\n}\n</style>\n"],"names":["_createVNode","_createBlock","_createTextVNode","_openBlock","_createElementBlock","_toDisplayString","_Fragment","_renderList"],"mappings":";;;;AAiBoB,EAAA,KAAK,EAAA,kBAAA;;AACjB,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,yBAAiB,GAAA;;;AAajB,EAAA,KAAA,EAAA,wBAAA;;;;AAGQ,EAAA,KAAA,EAAA,yBAAA;;;;AASA,EAAA,KAAA,EAAA,wBAAA;;;;;;AAWO,EAAA,KAAK,EAAA,sDAAA;;;;AAI9B,EAAA,KAAE,EAAA,yBAAA;AACF,EAAA,IAAG,EAAA,OAAA;;;;;AAMK,EAAA,IAAI,EAAC,QAAG;AAAA,EAAA,aAAA,EAAA,uBAAA;;;;;;;;;;;;AAvDjB,IAAA,IAAI,EAAE,QAAI,CAAA,IAAA,CAAC,aAAE,CAAA,KAAA,KAAA,QAAA,CAAA,CAAA,CAAA,eAAA,EAAA,QAAA,CAAA;AACb,IAAA,OAAO,EAAE,QAAA,CAAA,IAAI,CAAC,MAAA,CAAA,MAAM,CAAC,OAAO,CAAA;AAC5B,IAAA,QAAQ,EAAE,QAAA,CAAA,IAAI,CAAC,MAAA,CAAA,MAAA,CAAA,QAAA,CAAA;AAChB,IAAA,KAAK,EAAC,MAAM;AACX,IAAA,OAAO,EAAE,KAA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A,EAAA,8BAAA,EACT,WAAA,CAAA,MAAA,CAAA,KAAA,CAAA,EAAA,CAAA,CAAA;gBACtB,aAAW,EAAA,CAAA,wBAAA,EAA6B,MAAM,CAAC,KAAK,CAAA,CAAA;;gBACrDP,WAEe,CAAA,gCAAA,EAAA;AAFX,kBAAA,UAAA,EAAA,KAAA,CAAA,KAAA,CAAA,MAAA,CAAA,KAAA,CAAA,KAAA,IAAA;AAAA,kBAAA,qBAAA,aAAA,KAAA,CAAA,KAAA,CAAA,MAAA,CAAA,KAAA,IAAA,MAAA,CAAA;;;;;;;AAGQ,gBAAA,CAAA,MAAM,CAAC,IAAI;AAAvB,qBAAAG,SAAA,EAAA,EAAAC,kBAAA,CAA8B,MAA9B,EAAA,UAA8B,EAAAC,eAAA,CAAA,QAAA,CAAA,IAAA,CAAA,MAAA,CAAA,IAAA,CAAA,IAAA,QAAA,CAAA,IAAA,CAAA,MAAA,CAAA,YAAA,CAAA,CAAA,EAAA,CAAA,YAAA;;;;aAGtB,KAAI,CAAA,OAAA;gDAKT,CAAA,GAAA,YAAA,EAAAA,eAAA,CADA,KAAO,CAAA,OAAA,CAAA,EAAA,CAAA,YAAA;;;wBAIZD,kBAEK,CAAA,GAAA,EAFL,WAEK,EADDC,eAAA,CAAA,QAAA,CAAA,IAAI,CAAC,MAAM,CAAA,MAAA,CAAC,QAAQ,CAAA,IAAK,QAAC,CAAA,CAAA,CAAA,eAAA,EAAA,MAAA,CAAA,CAAA,EAAA,CAAA,YAAA,CAAA;;;;;;;;"}
@@ -2,7 +2,7 @@ import script from './CnAttentionFlagWidget.vue2.js';
2
2
  import { render } from './CnAttentionFlagWidget.vue3.js';
3
3
 
4
4
  script.render = render;
5
- script.__scopeId = "data-v-a3f4189e";
5
+ script.__scopeId = "data-v-25e8ede7";
6
6
  const __sfc_main = script;
7
7
 
8
8
  export { __sfc_main as default };
@@ -1 +1 @@
1
- {"version":3,"file":"CnAttentionFlagWidget.vue2.js","sources":["../../../../src/components/CnAttentionFlagWidget/CnAttentionFlagWidget.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<div v-if=\"loaded\" class=\"cn-attention-flag\" data-testid=\"cn-attention-flag\">\n\t\t<p\n\t\t\tv-if=\"raised\"\n\t\t\tclass=\"cn-attention-flag__line\"\n\t\t\tdata-testid=\"cn-attention-flag-raised\">\n\t\t\t<span class=\"cn-attention-flag__lead\">{{ label('raisedLead') }}</span>\n\t\t\t<span class=\"cn-attention-flag__muted\">{{ flagReason }}</span>\n\t\t</p>\n\n\t\t<ul\n\t\t\tv-if=\"markers.length > 0\"\n\t\t\tclass=\"cn-attention-flag__list\"\n\t\t\tdata-testid=\"cn-attention-flag-markers\">\n\t\t\t<li\n\t\t\t\tv-for=\"marker in markers\"\n\t\t\t\t:key=\"marker.marker\"\n\t\t\t\t:data-testid=\"`cn-attention-flag-marker-${marker.marker}`\"\n\t\t\t\t:data-tab=\"marker.tab\">\n\t\t\t\t<span class=\"cn-attention-flag__lead\">{{ marker.panelLabel }}</span>\n\t\t\t\t<span class=\"cn-attention-flag__muted\">{{ marker.reason }}</span>\n\t\t\t</li>\n\t\t</ul>\n\n\t\t<p\n\t\t\tv-if=\"assessment\"\n\t\t\tclass=\"cn-attention-flag__line\"\n\t\t\tdata-testid=\"cn-attention-flag-assessment\">\n\t\t\t<span class=\"cn-attention-flag__lead\">{{ label('assessmentLead') }}</span>\n\t\t\t<span class=\"cn-attention-flag__lead\" :data-level=\"assessment.level\">{{ assessment.levelLabel }}</span>\n\t\t\t<span class=\"cn-attention-flag__muted\">{{ assessment.ground }}</span>\n\t\t\t<span\n\t\t\t\tv-if=\"assessment.dueForReview\"\n\t\t\t\tclass=\"cn-attention-flag__due\"\n\t\t\t\tdata-testid=\"cn-attention-flag-review-due\">{{ label('reviewDue') }}</span>\n\t\t</p>\n\n\t\t<template v-if=\"behindButton && !composing\">\n\t\t\t<component :is=\"innerHeadingTag\" class=\"cn-attention-flag__heading cn-inner-heading\" data-testid=\"cn-attention-flag-heading\">\n\t\t\t\t{{ reasonLabel }}\n\t\t\t</component>\n\t\t\t<p class=\"cn-attention-flag__hint\" data-testid=\"cn-attention-flag-hint\">\n\t\t\t\t{{ raised ? label('hintClear') : label('hintRaise') }}\n\t\t\t</p>\n\t\t\t<NcButton\n\t\t\t\tclass=\"cn-attention-flag__compose\"\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\tdata-testid=\"cn-attention-flag-compose\"\n\t\t\t\t@click=\"composing = true\">\n\t\t\t\t<template #icon>\n\t\t\t\t\t<FlagOutline :size=\"16\" />\n\t\t\t\t</template>\n\t\t\t\t{{ raised ? label('clear') : label('raise') }}\n\t\t\t</NcButton>\n\t\t</template>\n\n\t\t<div v-else class=\"cn-attention-flag__act\">\n\t\t\t<NcTextField\n\t\t\t\t:modelValue=\"reason\"\n\t\t\t\t:label=\"reasonLabel\"\n\t\t\t\tdata-testid=\"cn-attention-flag-reason\"\n\t\t\t\t@update:modelValue=\"onReason\" />\n\t\t\t<NcButton\n\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t:disabled=\"busy || reason.trim() === ''\"\n\t\t\t\t:data-testid=\"raised ? 'cn-attention-flag-clear' : 'cn-attention-flag-raise'\"\n\t\t\t\t@click=\"submit\">\n\t\t\t\t{{ raised ? label('clear') : label('raise') }}\n\t\t\t</NcButton>\n\t\t</div>\n\n\t\t<p\n\t\t\tv-if=\"refusal\"\n\t\t\tclass=\"cn-attention-flag__refusal\"\n\t\t\trole=\"alert\"\n\t\t\tdata-testid=\"cn-attention-flag-refusal\">\n\t\t\t{{ refusal }}\n\t\t</p>\n\n\t\t<ol\n\t\t\tv-if=\"history.length > 0\"\n\t\t\tclass=\"cn-attention-flag__list\"\n\t\t\tdata-testid=\"cn-attention-flag-history\">\n\t\t\t<li\n\t\t\t\tv-for=\"(row, index) in history\"\n\t\t\t\t:key=\"`${row.moment}-${index}`\"\n\t\t\t\t:data-act=\"row.act\">\n\t\t\t\t<span class=\"cn-attention-flag__lead\">{{ row.act === 'cleared' ? label('cleared') : label('raised') }}</span>\n\t\t\t\t<span class=\"cn-attention-flag__muted\">{{ row.reason }}</span>\n\t\t\t</li>\n\t\t</ol>\n\t</div>\n</template>\n\n<script>\nimport axios from '@nextcloud/axios'\nimport { emit } from '@nextcloud/event-bus'\nimport { translate as t } from '@nextcloud/l10n'\nimport { generateUrl } from '@nextcloud/router'\nimport { NcButton, NcTextField } from '@nextcloud/vue'\nimport FlagOutline from 'vue-material-design-icons/FlagOutline.vue'\nimport { interpolateUrlTokens } from '../../composables/useEndpointSource.js'\nimport innerHeading from '../../mixins/innerHeading.js'\nimport { dispatchObjectsChanged } from '../../utils/objectSignals.js'\nimport { readPath } from '../../utils/readPath.js'\n\n/**\n * The default words, keyed as `content.labels` overrides them.\n *\n * @return {object} The labels.\n */\nfunction defaultLabels() {\n\treturn {\n\t\traisedLead: t('nextcloud-vue', 'Flagged as needing attention:'),\n\t\tassessmentLead: t('nextcloud-vue', 'Assessed risk:'),\n\t\treviewDue: t('nextcloud-vue', 'Due for review'),\n\t\treasonRaise: t('nextcloud-vue', 'Why this needs attention'),\n\t\treasonClear: t('nextcloud-vue', 'Why it no longer needs attention'),\n\t\thintRaise: t('nextcloud-vue', 'Flag it with a reason, so it stands out to everyone who works on it.'),\n\t\thintClear: t('nextcloud-vue', 'Clear the flag with a reason once it no longer needs attention.'),\n\t\traise: t('nextcloud-vue', 'Flag for attention'),\n\t\tclear: t('nextcloud-vue', 'Clear the flag'),\n\t\traised: t('nextcloud-vue', 'Raised'),\n\t\tcleared: t('nextcloud-vue', 'Cleared'),\n\t\tfailed: t('nextcloud-vue', 'This did not work. Try again.'),\n\t}\n}\n\n/** The assessed levels a record may carry, with their default words. */\nconst LEVELS = {\n\tlow: 'Low',\n\tmedium: 'Medium',\n\thigh: 'High',\n\tcritical: 'Critical',\n}\n\n/**\n * CnAttentionFlagWidget — the `attention-flag` widget: a flag a PERSON raises\n * on a record with a reason, the markers the SYSTEM raised against a part of\n * it, and an assessment the ORGANISATION made, kept apart on one strip.\n *\n * ```json\n * {\n * \"type\": \"attention-flag\",\n * \"content\": {\n * \"endpoint\": \"/apps/myapp/api/item/@objectId/attention\",\n * \"raisePath\": \"/raise\",\n * \"clearPath\": \"/clear\",\n * \"markersPath\": \"attentionMarkers\",\n * \"panelLabels\": { \"item-files\": \"Files\" },\n * \"assessment\": { \"path\": \"riskAssessment\", \"levelMap\": { \"high\": \"High\" }, \"reviewDateField\": \"reviewDate\" },\n * \"behindButton\": true\n * }\n * }\n * ```\n *\n * The endpoint answers `{ raised, flag: { reason }, history: [{ act, reason, moment }] }`\n * on GET, and the same after a POST of `{ reason }` to `raisePath` or\n * `clearPath`. A reason is required in both directions: the button stays\n * disabled without one, and the server's refusal sentence (`error`) is shown\n * as written. Markers and the assessment are read off the record the page\n * already holds. An assessment the reader may not see is absent from the\n * record, so it is absent here rather than blank. A failed read draws\n * nothing. With `behindButton` the strip shows the act as a heading, a hint\n * (`labels.hintRaise` / `labels.hintClear`) and one button, and the reason\n * field opens when that button is pressed. After a raise or a clear the widget emits `object-changed`, says\n * so to every list (`dispatchObjectsChanged`) and asks the page to refresh.\n *\n * @spec openspec/changes/dq-abstract-record-widgets/specs/record-widgets/spec.md#requirement-a-record-can-carry-an-attention-flag\n */\nexport default {\n\tname: 'CnAttentionFlagWidget',\n\n\tcomponents: { FlagOutline, NcButton, NcTextField },\n\n\tmixins: [innerHeading],\n\n\tinject: {\n\t\tcnTranslate: { default: () => (key) => key },\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * The configuration: `endpoint` (tokens `@objectId`, `@object.<field>`),\n\t\t * `raisePath` (default `/raise`), `clearPath` (default `/clear`),\n\t\t * `labels` (overrides of the default words), `markersPath`,\n\t\t * `panelLabels` (marker tab id to label) and `assessment`\n\t\t * (`{ path, levelMap?, levelField?, groundField?, reviewDateField? }`)\n\t\t * and `behindButton` (the reason field opens from a button).\n\t\t */\n\t\tcontent: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/** The record's id, bound by the detail-page host. */\n\t\tobjectId: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** The loaded record, or null while it is fetched. */\n\t\tobjectData: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/** The record's register, for the changed-objects signal. */\n\t\tregister: {\n\t\t\ttype: [String, Object],\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** The record's schema, for the changed-objects signal. */\n\t\tschema: {\n\t\t\ttype: [String, Object],\n\t\t\tdefault: '',\n\t\t},\n\t},\n\n\temits: ['object-changed'],\n\n\tdata() {\n\t\treturn {\n\t\t\tloaded: false,\n\t\t\tbusy: false,\n\t\t\traised: false,\n\t\t\tflag: {},\n\t\t\thistory: [],\n\t\t\treason: '',\n\t\t\trefusal: '',\n\t\t\tcomposing: false,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * The flag endpoint with its tokens filled, or '' while a token is not known.\n\t\t *\n\t\t * @return {string}\n\t\t */\n\t\tendpoint() {\n\t\t\tconst raw = typeof this.content?.endpoint === 'string' ? this.content.endpoint : ''\n\t\t\tif (raw === '' || !this.objectId) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\treturn interpolateUrlTokens(raw, { objectId: this.objectId, object: this.objectData || {} })\n\t\t},\n\n\t\t/** @return {boolean} Whether the reason field waits behind a button. */\n\t\tbehindButton() {\n\t\t\treturn this.content?.behindButton === true\n\t\t},\n\n\t\t/** @return {string} What the raise or clear was for, in the flag's own words. */\n\t\tflagReason() {\n\t\t\treturn String(this.flag?.reason ?? '')\n\t\t},\n\n\t\t/** @return {string} The label over the reason field, naming the act it is for. */\n\t\treasonLabel() {\n\t\t\treturn this.raised ? this.label('reasonClear') : this.label('reasonRaise')\n\t\t},\n\n\t\t/**\n\t\t * The markers on the record, each naming the part it points at.\n\t\t *\n\t\t * @return {Array<{marker: string, tab: string, reason: string, panelLabel: string}>}\n\t\t */\n\t\tmarkers() {\n\t\t\tconst path = this.content?.markersPath\n\t\t\tif (typeof path !== 'string' || path === '' || !this.objectData) {\n\t\t\t\treturn []\n\t\t\t}\n\t\t\tconst raw = readPath(this.objectData, path)\n\t\t\tif (!Array.isArray(raw)) {\n\t\t\t\treturn []\n\t\t\t}\n\t\t\tconst panelLabels = this.content?.panelLabels && typeof this.content.panelLabels === 'object' ? this.content.panelLabels : {}\n\t\t\treturn raw\n\t\t\t\t.filter((marker) => marker && String(marker.marker ?? '') !== '')\n\t\t\t\t.map((marker) => {\n\t\t\t\t\tconst tab = String(marker.tab ?? '')\n\t\t\t\t\treturn {\n\t\t\t\t\t\tmarker: String(marker.marker),\n\t\t\t\t\t\ttab,\n\t\t\t\t\t\treason: String(marker.reason ?? ''),\n\t\t\t\t\t\tpanelLabel: this.cnTranslate(panelLabels[tab] || tab),\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * The assessment, or null when the record carries none or the reader\n\t\t * may not see it (OpenRegister leaves the property out).\n\t\t *\n\t\t * @return {{level: string, levelLabel: string, ground: string, dueForReview: boolean}|null}\n\t\t */\n\t\tassessment() {\n\t\t\tconst config = this.content?.assessment\n\t\t\tif (!config || typeof config !== 'object' || typeof config.path !== 'string' || !this.objectData) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst stored = readPath(this.objectData, config.path)\n\t\t\tif (!stored || typeof stored !== 'object') {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst level = String(stored[config.levelField || 'level'] ?? '')\n\t\t\tif (level === '') {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst levelMap = config.levelMap && typeof config.levelMap === 'object' ? config.levelMap : {}\n\t\t\tconst word = levelMap[level] || LEVELS[level]\n\t\t\treturn {\n\t\t\t\tlevel,\n\t\t\t\tlevelLabel: word ? this.cnTranslate(word) : level,\n\t\t\t\tground: String(stored[config.groundField || 'ground'] ?? ''),\n\t\t\t\tdueForReview: hasPassed(String(stored[config.reviewDateField || 'reviewDate'] ?? '')),\n\t\t\t}\n\t\t},\n\t},\n\n\twatch: {\n\t\tendpoint: {\n\t\t\timmediate: true,\n\t\t\thandler() {\n\t\t\t\tthis.load()\n\t\t\t},\n\t\t},\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * A label: the content's own (through the host translate), else the default.\n\t\t *\n\t\t * @param {string} key The label key.\n\t\t * @return {string} The text.\n\t\t */\n\t\tlabel(key) {\n\t\t\tconst own = this.content?.labels && typeof this.content.labels[key] === 'string' ? this.content.labels[key] : ''\n\t\t\treturn own !== '' ? this.cnTranslate(own) : defaultLabels()[key]\n\t\t},\n\n\t\t/**\n\t\t * Read where the flag stands. A failure draws nothing: an instance that\n\t\t * does not carry the endpoint answers 404, and nothing else depends on it.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync load() {\n\t\t\tif (this.endpoint === '') {\n\t\t\t\tthis.loaded = false\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tconst response = await axios.get(generateUrl(this.endpoint))\n\t\t\t\tthis.apply(response?.data)\n\t\t\t\tthis.loaded = true\n\t\t\t} catch {\n\t\t\t\tthis.loaded = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Take the answer of a read or an act.\n\t\t *\n\t\t * @param {object} state What the endpoint answered.\n\t\t * @return {void}\n\t\t */\n\t\tapply(state) {\n\t\t\tthis.raised = state?.raised === true\n\t\t\tthis.flag = state?.flag ?? {}\n\t\t\tthis.history = Array.isArray(state?.history) ? state.history : []\n\t\t},\n\n\t\t/**\n\t\t * Keep the typed reason, so the button knows whether there is one.\n\t\t *\n\t\t * @param {string} value The field's value.\n\t\t * @return {void}\n\t\t */\n\t\tonReason(value) {\n\t\t\tthis.reason = String(value ?? '')\n\t\t},\n\n\t\t/**\n\t\t * Raise the flag, or clear it, with the reason that was written.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync submit() {\n\t\t\tconst reason = this.reason.trim()\n\t\t\tif (reason === '' || this.endpoint === '') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst tail = this.raised ? (this.content?.clearPath || '/clear') : (this.content?.raisePath || '/raise')\n\t\t\tthis.busy = true\n\t\t\tthis.refusal = ''\n\t\t\ttry {\n\t\t\t\tconst response = await axios.post(generateUrl(this.endpoint + tail), { reason })\n\t\t\t\tthis.apply(response?.data)\n\t\t\t\tthis.reason = ''\n\t\t\t\tthis.composing = false\n\t\t\t\tthis.announce()\n\t\t\t} catch (error) {\n\t\t\t\tconst said = String(error?.response?.data?.error ?? error?.response?.data?.message ?? '')\n\t\t\t\tthis.refusal = said !== '' ? said : this.label('failed')\n\t\t\t} finally {\n\t\t\t\tthis.busy = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Say the record changed: to the host, to every list showing it, and\n\t\t * to the page so it reads the record again.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tannounce() {\n\t\t\tconst id = String(this.objectId || '')\n\t\t\t/** @event object-changed The flag was raised or cleared: `{ register, schema, id }` of the record. */\n\t\t\tthis.$emit('object-changed', { register: this.register, schema: this.schema, id })\n\t\t\tdispatchObjectsChanged({ register: typeof this.register === 'string' ? this.register : '', schema: typeof this.schema === 'string' ? this.schema : '', id })\n\t\t\temit('cn:page:refresh')\n\t\t},\n\t},\n}\n\n/**\n * Whether a date lies before today. The date named is the last day the\n * assessment is still good for, so a review date of today is not yet due.\n *\n * @param {string} date The date.\n * @return {boolean} True when it has passed.\n */\nfunction hasPassed(date) {\n\tif (date === '') {\n\t\treturn false\n\t}\n\tconst moment = new Date(date)\n\tif (Number.isNaN(moment.getTime())) {\n\t\treturn false\n\t}\n\treturn moment.toISOString().slice(0, 10) < new Date().toISOString().slice(0, 10)\n}\n</script>\n\n<style scoped>\n.cn-attention-flag {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 4px;\n\tpadding: 4px 0;\n}\n\n/* The button is as wide as its label, as the boards draw it (DqZaakAssistent\n \"Markeer voor aandacht\"), not stretched across the card. */\n.cn-attention-flag__compose {\n\talign-self: flex-start;\n}\n\n.cn-attention-flag__line,\n.cn-attention-flag__act {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\talign-items: center;\n\tgap: 8px;\n\tmargin: 0;\n}\n\n.cn-attention-flag__list {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 2px;\n\tmargin: 0;\n\tpadding: 0;\n\tlist-style: none;\n}\n\n.cn-attention-flag__list li {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 8px;\n}\n\n.cn-attention-flag__lead {\n\tfont-weight: bold;\n}\n\n.cn-attention-flag__heading {\n\tmargin: 0;\n\tfont-size: 14px;\n\tfont-weight: bold;\n}\n\n.cn-attention-flag__hint {\n\tmargin: 0 0 8px;\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 13px;\n}\n\n.cn-attention-flag__muted {\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-attention-flag__due {\n\tcolor: var(--color-warning-text, var(--color-main-text));\n}\n\n.cn-attention-flag__refusal {\n\tmargin: 0;\n\tcolor: var(--color-error-text, var(--color-error));\n}\n</style>\n"],"names":["t","axios"],"mappings":";;;;;;;;;;;;AA+GA;;AAEC;;;AAGD,SAAS,aAAa,GAAG;AACxB,CAAA,OAAO;EACN,UAAU,EAAEA,SAAC,CAAC,eAAe,EAAE,+BAA+B,CAAC;EAC/D,cAAc,EAAEA,SAAC,CAAC,eAAe,EAAE,gBAAgB,CAAC;AACpD,EAAA,SAAS,EAAEA,SAAC,CAAC,eAAe,EAAE,gBAAgB,CAAC;EAC/C,WAAW,EAAEA,SAAC,CAAC,eAAe,EAAE,0BAA0B,CAAC;EAC3D,WAAW,EAAEA,SAAC,CAAC,eAAe,EAAE,kCAAkC,CAAC;AACnE,EAAA,SAAS,EAAEA,SAAC,CAAC,eAAe,EAAE,sEA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,CAAC,QAAO,IAAK,EAAE,EAAA;AACrC;AACA,GAAA,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,EAAA;AACjF,GAAA,sBAAsB,CAAC,EAAE,QAAQ,EAAE,OAAO,IAAI,CAAC,QAAO,KAAM,QAAS,GAAE,IAAI,CAAC,QAAO,GAAI,EAAE,EAAE,MAAM,EAAE,OAAO,IAAI,CAAC,MAAK,KAAM,WAAW,IAAI,CAAC,MAAO,GAAE,EAAE,EAAE,IAAI,EAAA;GAC3J,IAAI,CAAC,iBAAiB,EAAA;GACtB;EACD;AACF,EAAA;;AAEA;;;AAGC;;AAEA;;AAED,SAAS,SAAS,CAAC,IAAI,EAAE;CACxB,IAAI,IAAK,KAAI,EAAE,EAAE;EAChB,OAAO,KAAI;AACZ,EAAA;CACA,MAAM,MAAO,GAAE,IAAI,IAAI,CAAC,IAAI,EAAA;AAC5B,CAAA,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,EAAE;EACnC,OAAO,KAAI;AACZ,EAAA;AACA,CAAA,OAAO,MAAM,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAA,GAAI,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAA;AAChF;;;;"}
1
+ {"version":3,"file":"CnAttentionFlagWidget.vue2.js","sources":["../../../../src/components/CnAttentionFlagWidget/CnAttentionFlagWidget.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<div v-if=\"loaded\" class=\"cn-attention-flag\" data-testid=\"cn-attention-flag\">\n\t\t<p\n\t\t\tv-if=\"raised\"\n\t\t\tclass=\"cn-attention-flag__line\"\n\t\t\tdata-testid=\"cn-attention-flag-raised\">\n\t\t\t<span class=\"cn-attention-flag__lead\">{{ label('raisedLead') }}</span>\n\t\t\t<span class=\"cn-attention-flag__muted\">{{ flagReason }}</span>\n\t\t</p>\n\n\t\t<ul\n\t\t\tv-if=\"markers.length > 0\"\n\t\t\tclass=\"cn-attention-flag__list\"\n\t\t\tdata-testid=\"cn-attention-flag-markers\">\n\t\t\t<li\n\t\t\t\tv-for=\"marker in markers\"\n\t\t\t\t:key=\"marker.marker\"\n\t\t\t\t:data-testid=\"`cn-attention-flag-marker-${marker.marker}`\"\n\t\t\t\t:data-tab=\"marker.tab\">\n\t\t\t\t<span class=\"cn-attention-flag__lead\">{{ marker.panelLabel }}</span>\n\t\t\t\t<span class=\"cn-attention-flag__muted\">{{ marker.reason }}</span>\n\t\t\t</li>\n\t\t</ul>\n\n\t\t<p\n\t\t\tv-if=\"assessment\"\n\t\t\tclass=\"cn-attention-flag__line\"\n\t\t\tdata-testid=\"cn-attention-flag-assessment\">\n\t\t\t<span class=\"cn-attention-flag__lead\">{{ label('assessmentLead') }}</span>\n\t\t\t<span class=\"cn-attention-flag__lead\" :data-level=\"assessment.level\">{{ assessment.levelLabel }}</span>\n\t\t\t<span class=\"cn-attention-flag__muted\">{{ assessment.ground }}</span>\n\t\t\t<span\n\t\t\t\tv-if=\"assessment.dueForReview\"\n\t\t\t\tclass=\"cn-attention-flag__due\"\n\t\t\t\tdata-testid=\"cn-attention-flag-review-due\">{{ label('reviewDue') }}</span>\n\t\t</p>\n\n\t\t<template v-if=\"behindButton && !composing\">\n\t\t\t<component :is=\"innerHeadingTag\" class=\"cn-attention-flag__heading cn-inner-heading\" data-testid=\"cn-attention-flag-heading\">\n\t\t\t\t{{ reasonLabel }}\n\t\t\t</component>\n\t\t\t<p class=\"cn-attention-flag__hint\" data-testid=\"cn-attention-flag-hint\">\n\t\t\t\t{{ raised ? label('hintClear') : label('hintRaise') }}\n\t\t\t</p>\n\t\t\t<NcButton\n\t\t\t\tclass=\"cn-attention-flag__compose\"\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\twide\n\t\t\t\talignment=\"start\"\n\t\t\t\tdata-testid=\"cn-attention-flag-compose\"\n\t\t\t\t@click=\"composing = true\">\n\t\t\t\t<template #icon>\n\t\t\t\t\t<FlagOutline :size=\"16\" />\n\t\t\t\t</template>\n\t\t\t\t{{ raised ? label('clear') : label('raise') }}\n\t\t\t</NcButton>\n\t\t</template>\n\n\t\t<div v-else class=\"cn-attention-flag__act\">\n\t\t\t<NcTextField\n\t\t\t\t:modelValue=\"reason\"\n\t\t\t\t:label=\"reasonLabel\"\n\t\t\t\tdata-testid=\"cn-attention-flag-reason\"\n\t\t\t\t@update:modelValue=\"onReason\" />\n\t\t\t<NcButton\n\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t:disabled=\"busy || reason.trim() === ''\"\n\t\t\t\t:data-testid=\"raised ? 'cn-attention-flag-clear' : 'cn-attention-flag-raise'\"\n\t\t\t\t@click=\"submit\">\n\t\t\t\t{{ raised ? label('clear') : label('raise') }}\n\t\t\t</NcButton>\n\t\t</div>\n\n\t\t<p\n\t\t\tv-if=\"refusal\"\n\t\t\tclass=\"cn-attention-flag__refusal\"\n\t\t\trole=\"alert\"\n\t\t\tdata-testid=\"cn-attention-flag-refusal\">\n\t\t\t{{ refusal }}\n\t\t</p>\n\n\t\t<ol\n\t\t\tv-if=\"history.length > 0\"\n\t\t\tclass=\"cn-attention-flag__list\"\n\t\t\tdata-testid=\"cn-attention-flag-history\">\n\t\t\t<li\n\t\t\t\tv-for=\"(row, index) in history\"\n\t\t\t\t:key=\"`${row.moment}-${index}`\"\n\t\t\t\t:data-act=\"row.act\">\n\t\t\t\t<span class=\"cn-attention-flag__lead\">{{ row.act === 'cleared' ? label('cleared') : label('raised') }}</span>\n\t\t\t\t<span class=\"cn-attention-flag__muted\">{{ row.reason }}</span>\n\t\t\t</li>\n\t\t</ol>\n\t</div>\n</template>\n\n<script>\nimport axios from '@nextcloud/axios'\nimport { emit } from '@nextcloud/event-bus'\nimport { translate as t } from '@nextcloud/l10n'\nimport { generateUrl } from '@nextcloud/router'\nimport { NcButton, NcTextField } from '@nextcloud/vue'\nimport FlagOutline from 'vue-material-design-icons/FlagOutline.vue'\nimport { interpolateUrlTokens } from '../../composables/useEndpointSource.js'\nimport innerHeading from '../../mixins/innerHeading.js'\nimport { dispatchObjectsChanged } from '../../utils/objectSignals.js'\nimport { readPath } from '../../utils/readPath.js'\n\n/**\n * The default words, keyed as `content.labels` overrides them.\n *\n * @return {object} The labels.\n */\nfunction defaultLabels() {\n\treturn {\n\t\traisedLead: t('nextcloud-vue', 'Flagged as needing attention:'),\n\t\tassessmentLead: t('nextcloud-vue', 'Assessed risk:'),\n\t\treviewDue: t('nextcloud-vue', 'Due for review'),\n\t\treasonRaise: t('nextcloud-vue', 'Why this needs attention'),\n\t\treasonClear: t('nextcloud-vue', 'Why it no longer needs attention'),\n\t\thintRaise: t('nextcloud-vue', 'Flag it with a reason, so it stands out to everyone who works on it.'),\n\t\thintClear: t('nextcloud-vue', 'Clear the flag with a reason once it no longer needs attention.'),\n\t\traise: t('nextcloud-vue', 'Flag for attention'),\n\t\tclear: t('nextcloud-vue', 'Clear the flag'),\n\t\traised: t('nextcloud-vue', 'Raised'),\n\t\tcleared: t('nextcloud-vue', 'Cleared'),\n\t\tfailed: t('nextcloud-vue', 'This did not work. Try again.'),\n\t}\n}\n\n/** The assessed levels a record may carry, with their default words. */\nconst LEVELS = {\n\tlow: 'Low',\n\tmedium: 'Medium',\n\thigh: 'High',\n\tcritical: 'Critical',\n}\n\n/**\n * CnAttentionFlagWidget — the `attention-flag` widget: a flag a PERSON raises\n * on a record with a reason, the markers the SYSTEM raised against a part of\n * it, and an assessment the ORGANISATION made, kept apart on one strip.\n *\n * ```json\n * {\n * \"type\": \"attention-flag\",\n * \"content\": {\n * \"endpoint\": \"/apps/myapp/api/item/@objectId/attention\",\n * \"raisePath\": \"/raise\",\n * \"clearPath\": \"/clear\",\n * \"markersPath\": \"attentionMarkers\",\n * \"panelLabels\": { \"item-files\": \"Files\" },\n * \"assessment\": { \"path\": \"riskAssessment\", \"levelMap\": { \"high\": \"High\" }, \"reviewDateField\": \"reviewDate\" },\n * \"behindButton\": true\n * }\n * }\n * ```\n *\n * The endpoint answers `{ raised, flag: { reason }, history: [{ act, reason, moment }] }`\n * on GET, and the same after a POST of `{ reason }` to `raisePath` or\n * `clearPath`. A reason is required in both directions: the button stays\n * disabled without one, and the server's refusal sentence (`error`) is shown\n * as written. Markers and the assessment are read off the record the page\n * already holds. An assessment the reader may not see is absent from the\n * record, so it is absent here rather than blank. A failed read draws\n * nothing. With `behindButton` the strip shows the act as a heading, a hint\n * (`labels.hintRaise` / `labels.hintClear`) and one button, and the reason\n * field opens when that button is pressed. After a raise or a clear the widget emits `object-changed`, says\n * so to every list (`dispatchObjectsChanged`) and asks the page to refresh.\n *\n * @spec openspec/changes/dq-abstract-record-widgets/specs/record-widgets/spec.md#requirement-a-record-can-carry-an-attention-flag\n */\nexport default {\n\tname: 'CnAttentionFlagWidget',\n\n\tcomponents: { FlagOutline, NcButton, NcTextField },\n\n\tmixins: [innerHeading],\n\n\tinject: {\n\t\tcnTranslate: { default: () => (key) => key },\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * The configuration: `endpoint` (tokens `@objectId`, `@object.<field>`),\n\t\t * `raisePath` (default `/raise`), `clearPath` (default `/clear`),\n\t\t * `labels` (overrides of the default words), `markersPath`,\n\t\t * `panelLabels` (marker tab id to label) and `assessment`\n\t\t * (`{ path, levelMap?, levelField?, groundField?, reviewDateField? }`)\n\t\t * and `behindButton` (the reason field opens from a button).\n\t\t */\n\t\tcontent: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/** The record's id, bound by the detail-page host. */\n\t\tobjectId: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** The loaded record, or null while it is fetched. */\n\t\tobjectData: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/** The record's register, for the changed-objects signal. */\n\t\tregister: {\n\t\t\ttype: [String, Object],\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** The record's schema, for the changed-objects signal. */\n\t\tschema: {\n\t\t\ttype: [String, Object],\n\t\t\tdefault: '',\n\t\t},\n\t},\n\n\temits: ['object-changed'],\n\n\tdata() {\n\t\treturn {\n\t\t\tloaded: false,\n\t\t\tbusy: false,\n\t\t\traised: false,\n\t\t\tflag: {},\n\t\t\thistory: [],\n\t\t\treason: '',\n\t\t\trefusal: '',\n\t\t\tcomposing: false,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * The flag endpoint with its tokens filled, or '' while a token is not known.\n\t\t *\n\t\t * @return {string}\n\t\t */\n\t\tendpoint() {\n\t\t\tconst raw = typeof this.content?.endpoint === 'string' ? this.content.endpoint : ''\n\t\t\tif (raw === '' || !this.objectId) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\treturn interpolateUrlTokens(raw, { objectId: this.objectId, object: this.objectData || {} })\n\t\t},\n\n\t\t/** @return {boolean} Whether the reason field waits behind a button. */\n\t\tbehindButton() {\n\t\t\treturn this.content?.behindButton === true\n\t\t},\n\n\t\t/** @return {string} What the raise or clear was for, in the flag's own words. */\n\t\tflagReason() {\n\t\t\treturn String(this.flag?.reason ?? '')\n\t\t},\n\n\t\t/** @return {string} The label over the reason field, naming the act it is for. */\n\t\treasonLabel() {\n\t\t\treturn this.raised ? this.label('reasonClear') : this.label('reasonRaise')\n\t\t},\n\n\t\t/**\n\t\t * The markers on the record, each naming the part it points at.\n\t\t *\n\t\t * @return {Array<{marker: string, tab: string, reason: string, panelLabel: string}>}\n\t\t */\n\t\tmarkers() {\n\t\t\tconst path = this.content?.markersPath\n\t\t\tif (typeof path !== 'string' || path === '' || !this.objectData) {\n\t\t\t\treturn []\n\t\t\t}\n\t\t\tconst raw = readPath(this.objectData, path)\n\t\t\tif (!Array.isArray(raw)) {\n\t\t\t\treturn []\n\t\t\t}\n\t\t\tconst panelLabels = this.content?.panelLabels && typeof this.content.panelLabels === 'object' ? this.content.panelLabels : {}\n\t\t\treturn raw\n\t\t\t\t.filter((marker) => marker && String(marker.marker ?? '') !== '')\n\t\t\t\t.map((marker) => {\n\t\t\t\t\tconst tab = String(marker.tab ?? '')\n\t\t\t\t\treturn {\n\t\t\t\t\t\tmarker: String(marker.marker),\n\t\t\t\t\t\ttab,\n\t\t\t\t\t\treason: String(marker.reason ?? ''),\n\t\t\t\t\t\tpanelLabel: this.cnTranslate(panelLabels[tab] || tab),\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * The assessment, or null when the record carries none or the reader\n\t\t * may not see it (OpenRegister leaves the property out).\n\t\t *\n\t\t * @return {{level: string, levelLabel: string, ground: string, dueForReview: boolean}|null}\n\t\t */\n\t\tassessment() {\n\t\t\tconst config = this.content?.assessment\n\t\t\tif (!config || typeof config !== 'object' || typeof config.path !== 'string' || !this.objectData) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst stored = readPath(this.objectData, config.path)\n\t\t\tif (!stored || typeof stored !== 'object') {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst level = String(stored[config.levelField || 'level'] ?? '')\n\t\t\tif (level === '') {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst levelMap = config.levelMap && typeof config.levelMap === 'object' ? config.levelMap : {}\n\t\t\tconst word = levelMap[level] || LEVELS[level]\n\t\t\treturn {\n\t\t\t\tlevel,\n\t\t\t\tlevelLabel: word ? this.cnTranslate(word) : level,\n\t\t\t\tground: String(stored[config.groundField || 'ground'] ?? ''),\n\t\t\t\tdueForReview: hasPassed(String(stored[config.reviewDateField || 'reviewDate'] ?? '')),\n\t\t\t}\n\t\t},\n\t},\n\n\twatch: {\n\t\tendpoint: {\n\t\t\timmediate: true,\n\t\t\thandler() {\n\t\t\t\tthis.load()\n\t\t\t},\n\t\t},\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * A label: the content's own (through the host translate), else the default.\n\t\t *\n\t\t * @param {string} key The label key.\n\t\t * @return {string} The text.\n\t\t */\n\t\tlabel(key) {\n\t\t\tconst own = this.content?.labels && typeof this.content.labels[key] === 'string' ? this.content.labels[key] : ''\n\t\t\treturn own !== '' ? this.cnTranslate(own) : defaultLabels()[key]\n\t\t},\n\n\t\t/**\n\t\t * Read where the flag stands. A failure draws nothing: an instance that\n\t\t * does not carry the endpoint answers 404, and nothing else depends on it.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync load() {\n\t\t\tif (this.endpoint === '') {\n\t\t\t\tthis.loaded = false\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tconst response = await axios.get(generateUrl(this.endpoint))\n\t\t\t\tthis.apply(response?.data)\n\t\t\t\tthis.loaded = true\n\t\t\t} catch {\n\t\t\t\tthis.loaded = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Take the answer of a read or an act.\n\t\t *\n\t\t * @param {object} state What the endpoint answered.\n\t\t * @return {void}\n\t\t */\n\t\tapply(state) {\n\t\t\tthis.raised = state?.raised === true\n\t\t\tthis.flag = state?.flag ?? {}\n\t\t\tthis.history = Array.isArray(state?.history) ? state.history : []\n\t\t},\n\n\t\t/**\n\t\t * Keep the typed reason, so the button knows whether there is one.\n\t\t *\n\t\t * @param {string} value The field's value.\n\t\t * @return {void}\n\t\t */\n\t\tonReason(value) {\n\t\t\tthis.reason = String(value ?? '')\n\t\t},\n\n\t\t/**\n\t\t * Raise the flag, or clear it, with the reason that was written.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync submit() {\n\t\t\tconst reason = this.reason.trim()\n\t\t\tif (reason === '' || this.endpoint === '') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst tail = this.raised ? (this.content?.clearPath || '/clear') : (this.content?.raisePath || '/raise')\n\t\t\tthis.busy = true\n\t\t\tthis.refusal = ''\n\t\t\ttry {\n\t\t\t\tconst response = await axios.post(generateUrl(this.endpoint + tail), { reason })\n\t\t\t\tthis.apply(response?.data)\n\t\t\t\tthis.reason = ''\n\t\t\t\tthis.composing = false\n\t\t\t\tthis.announce()\n\t\t\t} catch (error) {\n\t\t\t\tconst said = String(error?.response?.data?.error ?? error?.response?.data?.message ?? '')\n\t\t\t\tthis.refusal = said !== '' ? said : this.label('failed')\n\t\t\t} finally {\n\t\t\t\tthis.busy = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Say the record changed: to the host, to every list showing it, and\n\t\t * to the page so it reads the record again.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tannounce() {\n\t\t\tconst id = String(this.objectId || '')\n\t\t\t/** @event object-changed The flag was raised or cleared: `{ register, schema, id }` of the record. */\n\t\t\tthis.$emit('object-changed', { register: this.register, schema: this.schema, id })\n\t\t\tdispatchObjectsChanged({ register: typeof this.register === 'string' ? this.register : '', schema: typeof this.schema === 'string' ? this.schema : '', id })\n\t\t\temit('cn:page:refresh')\n\t\t},\n\t},\n}\n\n/**\n * Whether a date lies before today. The date named is the last day the\n * assessment is still good for, so a review date of today is not yet due.\n *\n * @param {string} date The date.\n * @return {boolean} True when it has passed.\n */\nfunction hasPassed(date) {\n\tif (date === '') {\n\t\treturn false\n\t}\n\tconst moment = new Date(date)\n\tif (Number.isNaN(moment.getTime())) {\n\t\treturn false\n\t}\n\treturn moment.toISOString().slice(0, 10) < new Date().toISOString().slice(0, 10)\n}\n</script>\n\n<style scoped>\n.cn-attention-flag {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 4px;\n\tpadding: 4px 0;\n}\n\n.cn-attention-flag__line,\n.cn-attention-flag__act {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\talign-items: center;\n\tgap: 8px;\n\tmargin: 0;\n}\n\n.cn-attention-flag__list {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 2px;\n\tmargin: 0;\n\tpadding: 0;\n\tlist-style: none;\n}\n\n.cn-attention-flag__list li {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 8px;\n}\n\n.cn-attention-flag__lead {\n\tfont-weight: bold;\n}\n\n.cn-attention-flag__heading {\n\tmargin: 0;\n\tfont-size: 14px;\n\tfont-weight: bold;\n}\n\n.cn-attention-flag__hint {\n\tmargin: 0 0 8px;\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 13px;\n}\n\n.cn-attention-flag__muted {\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-attention-flag__due {\n\tcolor: var(--color-warning-text, var(--color-main-text));\n}\n\n.cn-attention-flag__refusal {\n\tmargin: 0;\n\tcolor: var(--color-error-text, var(--color-error));\n}\n</style>\n"],"names":["t","axios"],"mappings":";;;;;;;;;;;;AAiHA;;AAEC;;;AAGD,SAAS,aAAa,GAAG;AACxB,CAAA,OAAO;EACN,UAAU,EAAEA,SAAC,CAAC,eAAe,EAAE,+BAA+B,CAAC;EAC/D,cAAc,EAAEA,SAAC,CAAC,eAAe,EAAE,gBAAgB,CAAC;AACpD,EAAA,SAAS,EAAEA,SAAC,CAAC,eAAe,EAAE,gBAAgB,CAAC;EAC/C,WAAW,EAAEA,SAAC,CAAC,eAAe,EAAE,0BAA0B,CAAC;EAC3D,WAAW,EAAEA,SAAC,CAAC,eAAe,EAAE,kCAAkC,CAAC;AACnE,EAAA,SAAS,EAAEA,SAAC,CAAC,eAAe,EAAE,sEAAsE,CAAC;AACrG,EAAA,SAAS,EAAEA,SAAC,CAAC,eAAe,EAAE,iEAAiE,CAAC;AAChG,EAAA,KAAK,EAAEA,SAAC,CAAC,eAAe,EAAE,oBAAoB,CAAC;AAC/C,EAAA,KAAK,EAAEA,SAAC,CAAC,eAAe,EAAE,gBAAgB,CAAC;AAC3C,EAAA,MAAM,EAAEA,SAAC,CAAC,eAAe,EAAE,QAAQ,CAAC;AACpC,EAAA,OAAO,EAAEA,SAAC,CAAC,eAAe,EAAE,SAAS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IAAI,CAAC,MAAK,KAAM,WAAW,IAAI,CAAC,MAAO,GAAE,EAAE,EAAE,IAAI,EAAA;GAC3J,IAAI,CAAC,iBAAiB,EAAA;GACtB;EACD;AACF,EAAA;;AAEA;;;AAGC;;AAEA;;AAED,SAAS,SAAS,CAAC,IAAI,EAAE;CACxB,IAAI,IAAK,KAAI,EAAE,EAAE;EAChB,OAAO,KAAI;AACZ,EAAA;CACA,MAAM,MAAO,GAAE,IAAI,IAAI,CAAC,IAAI,EAAA;AAC5B,CAAA,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,EAAE;EACnC,OAAO,KAAI;AACZ,EAAA;AACA,CAAA,OAAO,MAAM,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAA,GAAI,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAA;AAChF;;;;"}
@@ -111,6 +111,8 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
111
111
  createVNode(_component_NcButton, {
112
112
  class: "cn-attention-flag__compose",
113
113
  variant: "secondary",
114
+ wide: "",
115
+ alignment: "start",
114
116
  "data-testid": "cn-attention-flag-compose",
115
117
  onClick: _cache[0] || (_cache[0] = $event => ($data.composing = true))
116
118
  }, {
@@ -1 +1 @@
1
- {"version":3,"file":"CnAttentionFlagWidget.vue3.js","sources":["../../../../src/components/CnAttentionFlagWidget/CnAttentionFlagWidget.vue?vue&type=template&id=a3f4189e&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<div v-if=\"loaded\" class=\"cn-attention-flag\" data-testid=\"cn-attention-flag\">\n\t\t<p\n\t\t\tv-if=\"raised\"\n\t\t\tclass=\"cn-attention-flag__line\"\n\t\t\tdata-testid=\"cn-attention-flag-raised\">\n\t\t\t<span class=\"cn-attention-flag__lead\">{{ label('raisedLead') }}</span>\n\t\t\t<span class=\"cn-attention-flag__muted\">{{ flagReason }}</span>\n\t\t</p>\n\n\t\t<ul\n\t\t\tv-if=\"markers.length > 0\"\n\t\t\tclass=\"cn-attention-flag__list\"\n\t\t\tdata-testid=\"cn-attention-flag-markers\">\n\t\t\t<li\n\t\t\t\tv-for=\"marker in markers\"\n\t\t\t\t:key=\"marker.marker\"\n\t\t\t\t:data-testid=\"`cn-attention-flag-marker-${marker.marker}`\"\n\t\t\t\t:data-tab=\"marker.tab\">\n\t\t\t\t<span class=\"cn-attention-flag__lead\">{{ marker.panelLabel }}</span>\n\t\t\t\t<span class=\"cn-attention-flag__muted\">{{ marker.reason }}</span>\n\t\t\t</li>\n\t\t</ul>\n\n\t\t<p\n\t\t\tv-if=\"assessment\"\n\t\t\tclass=\"cn-attention-flag__line\"\n\t\t\tdata-testid=\"cn-attention-flag-assessment\">\n\t\t\t<span class=\"cn-attention-flag__lead\">{{ label('assessmentLead') }}</span>\n\t\t\t<span class=\"cn-attention-flag__lead\" :data-level=\"assessment.level\">{{ assessment.levelLabel }}</span>\n\t\t\t<span class=\"cn-attention-flag__muted\">{{ assessment.ground }}</span>\n\t\t\t<span\n\t\t\t\tv-if=\"assessment.dueForReview\"\n\t\t\t\tclass=\"cn-attention-flag__due\"\n\t\t\t\tdata-testid=\"cn-attention-flag-review-due\">{{ label('reviewDue') }}</span>\n\t\t</p>\n\n\t\t<template v-if=\"behindButton && !composing\">\n\t\t\t<component :is=\"innerHeadingTag\" class=\"cn-attention-flag__heading cn-inner-heading\" data-testid=\"cn-attention-flag-heading\">\n\t\t\t\t{{ reasonLabel }}\n\t\t\t</component>\n\t\t\t<p class=\"cn-attention-flag__hint\" data-testid=\"cn-attention-flag-hint\">\n\t\t\t\t{{ raised ? label('hintClear') : label('hintRaise') }}\n\t\t\t</p>\n\t\t\t<NcButton\n\t\t\t\tclass=\"cn-attention-flag__compose\"\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\tdata-testid=\"cn-attention-flag-compose\"\n\t\t\t\t@click=\"composing = true\">\n\t\t\t\t<template #icon>\n\t\t\t\t\t<FlagOutline :size=\"16\" />\n\t\t\t\t</template>\n\t\t\t\t{{ raised ? label('clear') : label('raise') }}\n\t\t\t</NcButton>\n\t\t</template>\n\n\t\t<div v-else class=\"cn-attention-flag__act\">\n\t\t\t<NcTextField\n\t\t\t\t:modelValue=\"reason\"\n\t\t\t\t:label=\"reasonLabel\"\n\t\t\t\tdata-testid=\"cn-attention-flag-reason\"\n\t\t\t\t@update:modelValue=\"onReason\" />\n\t\t\t<NcButton\n\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t:disabled=\"busy || reason.trim() === ''\"\n\t\t\t\t:data-testid=\"raised ? 'cn-attention-flag-clear' : 'cn-attention-flag-raise'\"\n\t\t\t\t@click=\"submit\">\n\t\t\t\t{{ raised ? label('clear') : label('raise') }}\n\t\t\t</NcButton>\n\t\t</div>\n\n\t\t<p\n\t\t\tv-if=\"refusal\"\n\t\t\tclass=\"cn-attention-flag__refusal\"\n\t\t\trole=\"alert\"\n\t\t\tdata-testid=\"cn-attention-flag-refusal\">\n\t\t\t{{ refusal }}\n\t\t</p>\n\n\t\t<ol\n\t\t\tv-if=\"history.length > 0\"\n\t\t\tclass=\"cn-attention-flag__list\"\n\t\t\tdata-testid=\"cn-attention-flag-history\">\n\t\t\t<li\n\t\t\t\tv-for=\"(row, index) in history\"\n\t\t\t\t:key=\"`${row.moment}-${index}`\"\n\t\t\t\t:data-act=\"row.act\">\n\t\t\t\t<span class=\"cn-attention-flag__lead\">{{ row.act === 'cleared' ? label('cleared') : label('raised') }}</span>\n\t\t\t\t<span class=\"cn-attention-flag__muted\">{{ row.reason }}</span>\n\t\t\t</li>\n\t\t</ol>\n\t</div>\n</template>\n\n<script>\nimport axios from '@nextcloud/axios'\nimport { emit } from '@nextcloud/event-bus'\nimport { translate as t } from '@nextcloud/l10n'\nimport { generateUrl } from '@nextcloud/router'\nimport { NcButton, NcTextField } from '@nextcloud/vue'\nimport FlagOutline from 'vue-material-design-icons/FlagOutline.vue'\nimport { interpolateUrlTokens } from '../../composables/useEndpointSource.js'\nimport innerHeading from '../../mixins/innerHeading.js'\nimport { dispatchObjectsChanged } from '../../utils/objectSignals.js'\nimport { readPath } from '../../utils/readPath.js'\n\n/**\n * The default words, keyed as `content.labels` overrides them.\n *\n * @return {object} The labels.\n */\nfunction defaultLabels() {\n\treturn {\n\t\traisedLead: t('nextcloud-vue', 'Flagged as needing attention:'),\n\t\tassessmentLead: t('nextcloud-vue', 'Assessed risk:'),\n\t\treviewDue: t('nextcloud-vue', 'Due for review'),\n\t\treasonRaise: t('nextcloud-vue', 'Why this needs attention'),\n\t\treasonClear: t('nextcloud-vue', 'Why it no longer needs attention'),\n\t\thintRaise: t('nextcloud-vue', 'Flag it with a reason, so it stands out to everyone who works on it.'),\n\t\thintClear: t('nextcloud-vue', 'Clear the flag with a reason once it no longer needs attention.'),\n\t\traise: t('nextcloud-vue', 'Flag for attention'),\n\t\tclear: t('nextcloud-vue', 'Clear the flag'),\n\t\traised: t('nextcloud-vue', 'Raised'),\n\t\tcleared: t('nextcloud-vue', 'Cleared'),\n\t\tfailed: t('nextcloud-vue', 'This did not work. Try again.'),\n\t}\n}\n\n/** The assessed levels a record may carry, with their default words. */\nconst LEVELS = {\n\tlow: 'Low',\n\tmedium: 'Medium',\n\thigh: 'High',\n\tcritical: 'Critical',\n}\n\n/**\n * CnAttentionFlagWidget — the `attention-flag` widget: a flag a PERSON raises\n * on a record with a reason, the markers the SYSTEM raised against a part of\n * it, and an assessment the ORGANISATION made, kept apart on one strip.\n *\n * ```json\n * {\n * \"type\": \"attention-flag\",\n * \"content\": {\n * \"endpoint\": \"/apps/myapp/api/item/@objectId/attention\",\n * \"raisePath\": \"/raise\",\n * \"clearPath\": \"/clear\",\n * \"markersPath\": \"attentionMarkers\",\n * \"panelLabels\": { \"item-files\": \"Files\" },\n * \"assessment\": { \"path\": \"riskAssessment\", \"levelMap\": { \"high\": \"High\" }, \"reviewDateField\": \"reviewDate\" },\n * \"behindButton\": true\n * }\n * }\n * ```\n *\n * The endpoint answers `{ raised, flag: { reason }, history: [{ act, reason, moment }] }`\n * on GET, and the same after a POST of `{ reason }` to `raisePath` or\n * `clearPath`. A reason is required in both directions: the button stays\n * disabled without one, and the server's refusal sentence (`error`) is shown\n * as written. Markers and the assessment are read off the record the page\n * already holds. An assessment the reader may not see is absent from the\n * record, so it is absent here rather than blank. A failed read draws\n * nothing. With `behindButton` the strip shows the act as a heading, a hint\n * (`labels.hintRaise` / `labels.hintClear`) and one button, and the reason\n * field opens when that button is pressed. After a raise or a clear the widget emits `object-changed`, says\n * so to every list (`dispatchObjectsChanged`) and asks the page to refresh.\n *\n * @spec openspec/changes/dq-abstract-record-widgets/specs/record-widgets/spec.md#requirement-a-record-can-carry-an-attention-flag\n */\nexport default {\n\tname: 'CnAttentionFlagWidget',\n\n\tcomponents: { FlagOutline, NcButton, NcTextField },\n\n\tmixins: [innerHeading],\n\n\tinject: {\n\t\tcnTranslate: { default: () => (key) => key },\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * The configuration: `endpoint` (tokens `@objectId`, `@object.<field>`),\n\t\t * `raisePath` (default `/raise`), `clearPath` (default `/clear`),\n\t\t * `labels` (overrides of the default words), `markersPath`,\n\t\t * `panelLabels` (marker tab id to label) and `assessment`\n\t\t * (`{ path, levelMap?, levelField?, groundField?, reviewDateField? }`)\n\t\t * and `behindButton` (the reason field opens from a button).\n\t\t */\n\t\tcontent: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/** The record's id, bound by the detail-page host. */\n\t\tobjectId: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** The loaded record, or null while it is fetched. */\n\t\tobjectData: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/** The record's register, for the changed-objects signal. */\n\t\tregister: {\n\t\t\ttype: [String, Object],\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** The record's schema, for the changed-objects signal. */\n\t\tschema: {\n\t\t\ttype: [String, Object],\n\t\t\tdefault: '',\n\t\t},\n\t},\n\n\temits: ['object-changed'],\n\n\tdata() {\n\t\treturn {\n\t\t\tloaded: false,\n\t\t\tbusy: false,\n\t\t\traised: false,\n\t\t\tflag: {},\n\t\t\thistory: [],\n\t\t\treason: '',\n\t\t\trefusal: '',\n\t\t\tcomposing: false,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * The flag endpoint with its tokens filled, or '' while a token is not known.\n\t\t *\n\t\t * @return {string}\n\t\t */\n\t\tendpoint() {\n\t\t\tconst raw = typeof this.content?.endpoint === 'string' ? this.content.endpoint : ''\n\t\t\tif (raw === '' || !this.objectId) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\treturn interpolateUrlTokens(raw, { objectId: this.objectId, object: this.objectData || {} })\n\t\t},\n\n\t\t/** @return {boolean} Whether the reason field waits behind a button. */\n\t\tbehindButton() {\n\t\t\treturn this.content?.behindButton === true\n\t\t},\n\n\t\t/** @return {string} What the raise or clear was for, in the flag's own words. */\n\t\tflagReason() {\n\t\t\treturn String(this.flag?.reason ?? '')\n\t\t},\n\n\t\t/** @return {string} The label over the reason field, naming the act it is for. */\n\t\treasonLabel() {\n\t\t\treturn this.raised ? this.label('reasonClear') : this.label('reasonRaise')\n\t\t},\n\n\t\t/**\n\t\t * The markers on the record, each naming the part it points at.\n\t\t *\n\t\t * @return {Array<{marker: string, tab: string, reason: string, panelLabel: string}>}\n\t\t */\n\t\tmarkers() {\n\t\t\tconst path = this.content?.markersPath\n\t\t\tif (typeof path !== 'string' || path === '' || !this.objectData) {\n\t\t\t\treturn []\n\t\t\t}\n\t\t\tconst raw = readPath(this.objectData, path)\n\t\t\tif (!Array.isArray(raw)) {\n\t\t\t\treturn []\n\t\t\t}\n\t\t\tconst panelLabels = this.content?.panelLabels && typeof this.content.panelLabels === 'object' ? this.content.panelLabels : {}\n\t\t\treturn raw\n\t\t\t\t.filter((marker) => marker && String(marker.marker ?? '') !== '')\n\t\t\t\t.map((marker) => {\n\t\t\t\t\tconst tab = String(marker.tab ?? '')\n\t\t\t\t\treturn {\n\t\t\t\t\t\tmarker: String(marker.marker),\n\t\t\t\t\t\ttab,\n\t\t\t\t\t\treason: String(marker.reason ?? ''),\n\t\t\t\t\t\tpanelLabel: this.cnTranslate(panelLabels[tab] || tab),\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * The assessment, or null when the record carries none or the reader\n\t\t * may not see it (OpenRegister leaves the property out).\n\t\t *\n\t\t * @return {{level: string, levelLabel: string, ground: string, dueForReview: boolean}|null}\n\t\t */\n\t\tassessment() {\n\t\t\tconst config = this.content?.assessment\n\t\t\tif (!config || typeof config !== 'object' || typeof config.path !== 'string' || !this.objectData) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst stored = readPath(this.objectData, config.path)\n\t\t\tif (!stored || typeof stored !== 'object') {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst level = String(stored[config.levelField || 'level'] ?? '')\n\t\t\tif (level === '') {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst levelMap = config.levelMap && typeof config.levelMap === 'object' ? config.levelMap : {}\n\t\t\tconst word = levelMap[level] || LEVELS[level]\n\t\t\treturn {\n\t\t\t\tlevel,\n\t\t\t\tlevelLabel: word ? this.cnTranslate(word) : level,\n\t\t\t\tground: String(stored[config.groundField || 'ground'] ?? ''),\n\t\t\t\tdueForReview: hasPassed(String(stored[config.reviewDateField || 'reviewDate'] ?? '')),\n\t\t\t}\n\t\t},\n\t},\n\n\twatch: {\n\t\tendpoint: {\n\t\t\timmediate: true,\n\t\t\thandler() {\n\t\t\t\tthis.load()\n\t\t\t},\n\t\t},\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * A label: the content's own (through the host translate), else the default.\n\t\t *\n\t\t * @param {string} key The label key.\n\t\t * @return {string} The text.\n\t\t */\n\t\tlabel(key) {\n\t\t\tconst own = this.content?.labels && typeof this.content.labels[key] === 'string' ? this.content.labels[key] : ''\n\t\t\treturn own !== '' ? this.cnTranslate(own) : defaultLabels()[key]\n\t\t},\n\n\t\t/**\n\t\t * Read where the flag stands. A failure draws nothing: an instance that\n\t\t * does not carry the endpoint answers 404, and nothing else depends on it.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync load() {\n\t\t\tif (this.endpoint === '') {\n\t\t\t\tthis.loaded = false\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tconst response = await axios.get(generateUrl(this.endpoint))\n\t\t\t\tthis.apply(response?.data)\n\t\t\t\tthis.loaded = true\n\t\t\t} catch {\n\t\t\t\tthis.loaded = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Take the answer of a read or an act.\n\t\t *\n\t\t * @param {object} state What the endpoint answered.\n\t\t * @return {void}\n\t\t */\n\t\tapply(state) {\n\t\t\tthis.raised = state?.raised === true\n\t\t\tthis.flag = state?.flag ?? {}\n\t\t\tthis.history = Array.isArray(state?.history) ? state.history : []\n\t\t},\n\n\t\t/**\n\t\t * Keep the typed reason, so the button knows whether there is one.\n\t\t *\n\t\t * @param {string} value The field's value.\n\t\t * @return {void}\n\t\t */\n\t\tonReason(value) {\n\t\t\tthis.reason = String(value ?? '')\n\t\t},\n\n\t\t/**\n\t\t * Raise the flag, or clear it, with the reason that was written.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync submit() {\n\t\t\tconst reason = this.reason.trim()\n\t\t\tif (reason === '' || this.endpoint === '') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst tail = this.raised ? (this.content?.clearPath || '/clear') : (this.content?.raisePath || '/raise')\n\t\t\tthis.busy = true\n\t\t\tthis.refusal = ''\n\t\t\ttry {\n\t\t\t\tconst response = await axios.post(generateUrl(this.endpoint + tail), { reason })\n\t\t\t\tthis.apply(response?.data)\n\t\t\t\tthis.reason = ''\n\t\t\t\tthis.composing = false\n\t\t\t\tthis.announce()\n\t\t\t} catch (error) {\n\t\t\t\tconst said = String(error?.response?.data?.error ?? error?.response?.data?.message ?? '')\n\t\t\t\tthis.refusal = said !== '' ? said : this.label('failed')\n\t\t\t} finally {\n\t\t\t\tthis.busy = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Say the record changed: to the host, to every list showing it, and\n\t\t * to the page so it reads the record again.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tannounce() {\n\t\t\tconst id = String(this.objectId || '')\n\t\t\t/** @event object-changed The flag was raised or cleared: `{ register, schema, id }` of the record. */\n\t\t\tthis.$emit('object-changed', { register: this.register, schema: this.schema, id })\n\t\t\tdispatchObjectsChanged({ register: typeof this.register === 'string' ? this.register : '', schema: typeof this.schema === 'string' ? this.schema : '', id })\n\t\t\temit('cn:page:refresh')\n\t\t},\n\t},\n}\n\n/**\n * Whether a date lies before today. The date named is the last day the\n * assessment is still good for, so a review date of today is not yet due.\n *\n * @param {string} date The date.\n * @return {boolean} True when it has passed.\n */\nfunction hasPassed(date) {\n\tif (date === '') {\n\t\treturn false\n\t}\n\tconst moment = new Date(date)\n\tif (Number.isNaN(moment.getTime())) {\n\t\treturn false\n\t}\n\treturn moment.toISOString().slice(0, 10) < new Date().toISOString().slice(0, 10)\n}\n</script>\n\n<style scoped>\n.cn-attention-flag {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 4px;\n\tpadding: 4px 0;\n}\n\n/* The button is as wide as its label, as the boards draw it (DqZaakAssistent\n \"Markeer voor aandacht\"), not stretched across the card. */\n.cn-attention-flag__compose {\n\talign-self: flex-start;\n}\n\n.cn-attention-flag__line,\n.cn-attention-flag__act {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\talign-items: center;\n\tgap: 8px;\n\tmargin: 0;\n}\n\n.cn-attention-flag__list {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 2px;\n\tmargin: 0;\n\tpadding: 0;\n\tlist-style: none;\n}\n\n.cn-attention-flag__list li {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 8px;\n}\n\n.cn-attention-flag__lead {\n\tfont-weight: bold;\n}\n\n.cn-attention-flag__heading {\n\tmargin: 0;\n\tfont-size: 14px;\n\tfont-weight: bold;\n}\n\n.cn-attention-flag__hint {\n\tmargin: 0 0 8px;\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 13px;\n}\n\n.cn-attention-flag__muted {\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-attention-flag__due {\n\tcolor: var(--color-warning-text, var(--color-main-text));\n}\n\n.cn-attention-flag__refusal {\n\tmargin: 0;\n\tcolor: var(--color-error-text, var(--color-error));\n}\n</style>\n"],"names":["_openBlock","_createElementBlock","_createElementVNode","_toDisplayString","_Fragment","_renderList","_createBlock","_resolveDynamicComponent","_createVNode","_createTextVNode"],"mappings":";;;;AAWoB,EAAA,KAAK,EAAC,mBAAmB;AAAC,EAAA,aAAW,EAAC,mBAAc;;;;;AAIrE,EAAA,aAAC,EAAA,0BAAA;;AACK,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,yBAAY,GAAA;AAClB,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,0BAAkB,GAAA;;;OAKzB,EAAC,yBAAyB;eACpB,EAAC,2BAAW;;;AAMvB,MAAA,UAAA,GAAA,EAAA,KAAA,EAAA,yBAAA,GAAA;AACO,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,0BAAG,GAAA;;;AAMhB,EAAA,KAAI,EAAA,yBAAA;eACO,EAAC,8BAAkB;;AACxB,MAAA,WAAA,GAAA,EAAA,KAAK,EAAC,yBAAkB,GAAA;;AAE5B,MAAA,WAAA,GAAA,EAAA,KAAA,EAAA,0BAAA,GAAA;;;AAGD,EAAA,KAAK,EAAC,wBAAwB;AAC9B,EAAA,aAAW,EAAC,8BAAI;;;AAOd,EAAA,KAAK,EAAC,yBA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lagWidget/CnAttentionFlagWidget.vue?vue&type=template&id=25e8ede7&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<div v-if=\"loaded\" class=\"cn-attention-flag\" data-testid=\"cn-attention-flag\">\n\t\t<p\n\t\t\tv-if=\"raised\"\n\t\t\tclass=\"cn-attention-flag__line\"\n\t\t\tdata-testid=\"cn-attention-flag-raised\">\n\t\t\t<span class=\"cn-attention-flag__lead\">{{ label('raisedLead') }}</span>\n\t\t\t<span class=\"cn-attention-flag__muted\">{{ flagReason }}</span>\n\t\t</p>\n\n\t\t<ul\n\t\t\tv-if=\"markers.length > 0\"\n\t\t\tclass=\"cn-attention-flag__list\"\n\t\t\tdata-testid=\"cn-attention-flag-markers\">\n\t\t\t<li\n\t\t\t\tv-for=\"marker in markers\"\n\t\t\t\t:key=\"marker.marker\"\n\t\t\t\t:data-testid=\"`cn-attention-flag-marker-${marker.marker}`\"\n\t\t\t\t:data-tab=\"marker.tab\">\n\t\t\t\t<span class=\"cn-attention-flag__lead\">{{ marker.panelLabel }}</span>\n\t\t\t\t<span class=\"cn-attention-flag__muted\">{{ marker.reason }}</span>\n\t\t\t</li>\n\t\t</ul>\n\n\t\t<p\n\t\t\tv-if=\"assessment\"\n\t\t\tclass=\"cn-attention-flag__line\"\n\t\t\tdata-testid=\"cn-attention-flag-assessment\">\n\t\t\t<span class=\"cn-attention-flag__lead\">{{ label('assessmentLead') }}</span>\n\t\t\t<span class=\"cn-attention-flag__lead\" :data-level=\"assessment.level\">{{ assessment.levelLabel }}</span>\n\t\t\t<span class=\"cn-attention-flag__muted\">{{ assessment.ground }}</span>\n\t\t\t<span\n\t\t\t\tv-if=\"assessment.dueForReview\"\n\t\t\t\tclass=\"cn-attention-flag__due\"\n\t\t\t\tdata-testid=\"cn-attention-flag-review-due\">{{ label('reviewDue') }}</span>\n\t\t</p>\n\n\t\t<template v-if=\"behindButton && !composing\">\n\t\t\t<component :is=\"innerHeadingTag\" class=\"cn-attention-flag__heading cn-inner-heading\" data-testid=\"cn-attention-flag-heading\">\n\t\t\t\t{{ reasonLabel }}\n\t\t\t</component>\n\t\t\t<p class=\"cn-attention-flag__hint\" data-testid=\"cn-attention-flag-hint\">\n\t\t\t\t{{ raised ? label('hintClear') : label('hintRaise') }}\n\t\t\t</p>\n\t\t\t<NcButton\n\t\t\t\tclass=\"cn-attention-flag__compose\"\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\twide\n\t\t\t\talignment=\"start\"\n\t\t\t\tdata-testid=\"cn-attention-flag-compose\"\n\t\t\t\t@click=\"composing = true\">\n\t\t\t\t<template #icon>\n\t\t\t\t\t<FlagOutline :size=\"16\" />\n\t\t\t\t</template>\n\t\t\t\t{{ raised ? label('clear') : label('raise') }}\n\t\t\t</NcButton>\n\t\t</template>\n\n\t\t<div v-else class=\"cn-attention-flag__act\">\n\t\t\t<NcTextField\n\t\t\t\t:modelValue=\"reason\"\n\t\t\t\t:label=\"reasonLabel\"\n\t\t\t\tdata-testid=\"cn-attention-flag-reason\"\n\t\t\t\t@update:modelValue=\"onReason\" />\n\t\t\t<NcButton\n\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t:disabled=\"busy || reason.trim() === ''\"\n\t\t\t\t:data-testid=\"raised ? 'cn-attention-flag-clear' : 'cn-attention-flag-raise'\"\n\t\t\t\t@click=\"submit\">\n\t\t\t\t{{ raised ? label('clear') : label('raise') }}\n\t\t\t</NcButton>\n\t\t</div>\n\n\t\t<p\n\t\t\tv-if=\"refusal\"\n\t\t\tclass=\"cn-attention-flag__refusal\"\n\t\t\trole=\"alert\"\n\t\t\tdata-testid=\"cn-attention-flag-refusal\">\n\t\t\t{{ refusal }}\n\t\t</p>\n\n\t\t<ol\n\t\t\tv-if=\"history.length > 0\"\n\t\t\tclass=\"cn-attention-flag__list\"\n\t\t\tdata-testid=\"cn-attention-flag-history\">\n\t\t\t<li\n\t\t\t\tv-for=\"(row, index) in history\"\n\t\t\t\t:key=\"`${row.moment}-${index}`\"\n\t\t\t\t:data-act=\"row.act\">\n\t\t\t\t<span class=\"cn-attention-flag__lead\">{{ row.act === 'cleared' ? label('cleared') : label('raised') }}</span>\n\t\t\t\t<span class=\"cn-attention-flag__muted\">{{ row.reason }}</span>\n\t\t\t</li>\n\t\t</ol>\n\t</div>\n</template>\n\n<script>\nimport axios from '@nextcloud/axios'\nimport { emit } from '@nextcloud/event-bus'\nimport { translate as t } from '@nextcloud/l10n'\nimport { generateUrl } from '@nextcloud/router'\nimport { NcButton, NcTextField } from '@nextcloud/vue'\nimport FlagOutline from 'vue-material-design-icons/FlagOutline.vue'\nimport { interpolateUrlTokens } from '../../composables/useEndpointSource.js'\nimport innerHeading from '../../mixins/innerHeading.js'\nimport { dispatchObjectsChanged } from '../../utils/objectSignals.js'\nimport { readPath } from '../../utils/readPath.js'\n\n/**\n * The default words, keyed as `content.labels` overrides them.\n *\n * @return {object} The labels.\n */\nfunction defaultLabels() {\n\treturn {\n\t\traisedLead: t('nextcloud-vue', 'Flagged as needing attention:'),\n\t\tassessmentLead: t('nextcloud-vue', 'Assessed risk:'),\n\t\treviewDue: t('nextcloud-vue', 'Due for review'),\n\t\treasonRaise: t('nextcloud-vue', 'Why this needs attention'),\n\t\treasonClear: t('nextcloud-vue', 'Why it no longer needs attention'),\n\t\thintRaise: t('nextcloud-vue', 'Flag it with a reason, so it stands out to everyone who works on it.'),\n\t\thintClear: t('nextcloud-vue', 'Clear the flag with a reason once it no longer needs attention.'),\n\t\traise: t('nextcloud-vue', 'Flag for attention'),\n\t\tclear: t('nextcloud-vue', 'Clear the flag'),\n\t\traised: t('nextcloud-vue', 'Raised'),\n\t\tcleared: t('nextcloud-vue', 'Cleared'),\n\t\tfailed: t('nextcloud-vue', 'This did not work. Try again.'),\n\t}\n}\n\n/** The assessed levels a record may carry, with their default words. */\nconst LEVELS = {\n\tlow: 'Low',\n\tmedium: 'Medium',\n\thigh: 'High',\n\tcritical: 'Critical',\n}\n\n/**\n * CnAttentionFlagWidget — the `attention-flag` widget: a flag a PERSON raises\n * on a record with a reason, the markers the SYSTEM raised against a part of\n * it, and an assessment the ORGANISATION made, kept apart on one strip.\n *\n * ```json\n * {\n * \"type\": \"attention-flag\",\n * \"content\": {\n * \"endpoint\": \"/apps/myapp/api/item/@objectId/attention\",\n * \"raisePath\": \"/raise\",\n * \"clearPath\": \"/clear\",\n * \"markersPath\": \"attentionMarkers\",\n * \"panelLabels\": { \"item-files\": \"Files\" },\n * \"assessment\": { \"path\": \"riskAssessment\", \"levelMap\": { \"high\": \"High\" }, \"reviewDateField\": \"reviewDate\" },\n * \"behindButton\": true\n * }\n * }\n * ```\n *\n * The endpoint answers `{ raised, flag: { reason }, history: [{ act, reason, moment }] }`\n * on GET, and the same after a POST of `{ reason }` to `raisePath` or\n * `clearPath`. A reason is required in both directions: the button stays\n * disabled without one, and the server's refusal sentence (`error`) is shown\n * as written. Markers and the assessment are read off the record the page\n * already holds. An assessment the reader may not see is absent from the\n * record, so it is absent here rather than blank. A failed read draws\n * nothing. With `behindButton` the strip shows the act as a heading, a hint\n * (`labels.hintRaise` / `labels.hintClear`) and one button, and the reason\n * field opens when that button is pressed. After a raise or a clear the widget emits `object-changed`, says\n * so to every list (`dispatchObjectsChanged`) and asks the page to refresh.\n *\n * @spec openspec/changes/dq-abstract-record-widgets/specs/record-widgets/spec.md#requirement-a-record-can-carry-an-attention-flag\n */\nexport default {\n\tname: 'CnAttentionFlagWidget',\n\n\tcomponents: { FlagOutline, NcButton, NcTextField },\n\n\tmixins: [innerHeading],\n\n\tinject: {\n\t\tcnTranslate: { default: () => (key) => key },\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * The configuration: `endpoint` (tokens `@objectId`, `@object.<field>`),\n\t\t * `raisePath` (default `/raise`), `clearPath` (default `/clear`),\n\t\t * `labels` (overrides of the default words), `markersPath`,\n\t\t * `panelLabels` (marker tab id to label) and `assessment`\n\t\t * (`{ path, levelMap?, levelField?, groundField?, reviewDateField? }`)\n\t\t * and `behindButton` (the reason field opens from a button).\n\t\t */\n\t\tcontent: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/** The record's id, bound by the detail-page host. */\n\t\tobjectId: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** The loaded record, or null while it is fetched. */\n\t\tobjectData: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/** The record's register, for the changed-objects signal. */\n\t\tregister: {\n\t\t\ttype: [String, Object],\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/** The record's schema, for the changed-objects signal. */\n\t\tschema: {\n\t\t\ttype: [String, Object],\n\t\t\tdefault: '',\n\t\t},\n\t},\n\n\temits: ['object-changed'],\n\n\tdata() {\n\t\treturn {\n\t\t\tloaded: false,\n\t\t\tbusy: false,\n\t\t\traised: false,\n\t\t\tflag: {},\n\t\t\thistory: [],\n\t\t\treason: '',\n\t\t\trefusal: '',\n\t\t\tcomposing: false,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * The flag endpoint with its tokens filled, or '' while a token is not known.\n\t\t *\n\t\t * @return {string}\n\t\t */\n\t\tendpoint() {\n\t\t\tconst raw = typeof this.content?.endpoint === 'string' ? this.content.endpoint : ''\n\t\t\tif (raw === '' || !this.objectId) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\treturn interpolateUrlTokens(raw, { objectId: this.objectId, object: this.objectData || {} })\n\t\t},\n\n\t\t/** @return {boolean} Whether the reason field waits behind a button. */\n\t\tbehindButton() {\n\t\t\treturn this.content?.behindButton === true\n\t\t},\n\n\t\t/** @return {string} What the raise or clear was for, in the flag's own words. */\n\t\tflagReason() {\n\t\t\treturn String(this.flag?.reason ?? '')\n\t\t},\n\n\t\t/** @return {string} The label over the reason field, naming the act it is for. */\n\t\treasonLabel() {\n\t\t\treturn this.raised ? this.label('reasonClear') : this.label('reasonRaise')\n\t\t},\n\n\t\t/**\n\t\t * The markers on the record, each naming the part it points at.\n\t\t *\n\t\t * @return {Array<{marker: string, tab: string, reason: string, panelLabel: string}>}\n\t\t */\n\t\tmarkers() {\n\t\t\tconst path = this.content?.markersPath\n\t\t\tif (typeof path !== 'string' || path === '' || !this.objectData) {\n\t\t\t\treturn []\n\t\t\t}\n\t\t\tconst raw = readPath(this.objectData, path)\n\t\t\tif (!Array.isArray(raw)) {\n\t\t\t\treturn []\n\t\t\t}\n\t\t\tconst panelLabels = this.content?.panelLabels && typeof this.content.panelLabels === 'object' ? this.content.panelLabels : {}\n\t\t\treturn raw\n\t\t\t\t.filter((marker) => marker && String(marker.marker ?? '') !== '')\n\t\t\t\t.map((marker) => {\n\t\t\t\t\tconst tab = String(marker.tab ?? '')\n\t\t\t\t\treturn {\n\t\t\t\t\t\tmarker: String(marker.marker),\n\t\t\t\t\t\ttab,\n\t\t\t\t\t\treason: String(marker.reason ?? ''),\n\t\t\t\t\t\tpanelLabel: this.cnTranslate(panelLabels[tab] || tab),\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * The assessment, or null when the record carries none or the reader\n\t\t * may not see it (OpenRegister leaves the property out).\n\t\t *\n\t\t * @return {{level: string, levelLabel: string, ground: string, dueForReview: boolean}|null}\n\t\t */\n\t\tassessment() {\n\t\t\tconst config = this.content?.assessment\n\t\t\tif (!config || typeof config !== 'object' || typeof config.path !== 'string' || !this.objectData) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst stored = readPath(this.objectData, config.path)\n\t\t\tif (!stored || typeof stored !== 'object') {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst level = String(stored[config.levelField || 'level'] ?? '')\n\t\t\tif (level === '') {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst levelMap = config.levelMap && typeof config.levelMap === 'object' ? config.levelMap : {}\n\t\t\tconst word = levelMap[level] || LEVELS[level]\n\t\t\treturn {\n\t\t\t\tlevel,\n\t\t\t\tlevelLabel: word ? this.cnTranslate(word) : level,\n\t\t\t\tground: String(stored[config.groundField || 'ground'] ?? ''),\n\t\t\t\tdueForReview: hasPassed(String(stored[config.reviewDateField || 'reviewDate'] ?? '')),\n\t\t\t}\n\t\t},\n\t},\n\n\twatch: {\n\t\tendpoint: {\n\t\t\timmediate: true,\n\t\t\thandler() {\n\t\t\t\tthis.load()\n\t\t\t},\n\t\t},\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * A label: the content's own (through the host translate), else the default.\n\t\t *\n\t\t * @param {string} key The label key.\n\t\t * @return {string} The text.\n\t\t */\n\t\tlabel(key) {\n\t\t\tconst own = this.content?.labels && typeof this.content.labels[key] === 'string' ? this.content.labels[key] : ''\n\t\t\treturn own !== '' ? this.cnTranslate(own) : defaultLabels()[key]\n\t\t},\n\n\t\t/**\n\t\t * Read where the flag stands. A failure draws nothing: an instance that\n\t\t * does not carry the endpoint answers 404, and nothing else depends on it.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync load() {\n\t\t\tif (this.endpoint === '') {\n\t\t\t\tthis.loaded = false\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tconst response = await axios.get(generateUrl(this.endpoint))\n\t\t\t\tthis.apply(response?.data)\n\t\t\t\tthis.loaded = true\n\t\t\t} catch {\n\t\t\t\tthis.loaded = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Take the answer of a read or an act.\n\t\t *\n\t\t * @param {object} state What the endpoint answered.\n\t\t * @return {void}\n\t\t */\n\t\tapply(state) {\n\t\t\tthis.raised = state?.raised === true\n\t\t\tthis.flag = state?.flag ?? {}\n\t\t\tthis.history = Array.isArray(state?.history) ? state.history : []\n\t\t},\n\n\t\t/**\n\t\t * Keep the typed reason, so the button knows whether there is one.\n\t\t *\n\t\t * @param {string} value The field's value.\n\t\t * @return {void}\n\t\t */\n\t\tonReason(value) {\n\t\t\tthis.reason = String(value ?? '')\n\t\t},\n\n\t\t/**\n\t\t * Raise the flag, or clear it, with the reason that was written.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync submit() {\n\t\t\tconst reason = this.reason.trim()\n\t\t\tif (reason === '' || this.endpoint === '') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst tail = this.raised ? (this.content?.clearPath || '/clear') : (this.content?.raisePath || '/raise')\n\t\t\tthis.busy = true\n\t\t\tthis.refusal = ''\n\t\t\ttry {\n\t\t\t\tconst response = await axios.post(generateUrl(this.endpoint + tail), { reason })\n\t\t\t\tthis.apply(response?.data)\n\t\t\t\tthis.reason = ''\n\t\t\t\tthis.composing = false\n\t\t\t\tthis.announce()\n\t\t\t} catch (error) {\n\t\t\t\tconst said = String(error?.response?.data?.error ?? error?.response?.data?.message ?? '')\n\t\t\t\tthis.refusal = said !== '' ? said : this.label('failed')\n\t\t\t} finally {\n\t\t\t\tthis.busy = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Say the record changed: to the host, to every list showing it, and\n\t\t * to the page so it reads the record again.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tannounce() {\n\t\t\tconst id = String(this.objectId || '')\n\t\t\t/** @event object-changed The flag was raised or cleared: `{ register, schema, id }` of the record. */\n\t\t\tthis.$emit('object-changed', { register: this.register, schema: this.schema, id })\n\t\t\tdispatchObjectsChanged({ register: typeof this.register === 'string' ? this.register : '', schema: typeof this.schema === 'string' ? this.schema : '', id })\n\t\t\temit('cn:page:refresh')\n\t\t},\n\t},\n}\n\n/**\n * Whether a date lies before today. The date named is the last day the\n * assessment is still good for, so a review date of today is not yet due.\n *\n * @param {string} date The date.\n * @return {boolean} True when it has passed.\n */\nfunction hasPassed(date) {\n\tif (date === '') {\n\t\treturn false\n\t}\n\tconst moment = new Date(date)\n\tif (Number.isNaN(moment.getTime())) {\n\t\treturn false\n\t}\n\treturn moment.toISOString().slice(0, 10) < new Date().toISOString().slice(0, 10)\n}\n</script>\n\n<style scoped>\n.cn-attention-flag {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 4px;\n\tpadding: 4px 0;\n}\n\n.cn-attention-flag__line,\n.cn-attention-flag__act {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\talign-items: center;\n\tgap: 8px;\n\tmargin: 0;\n}\n\n.cn-attention-flag__list {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 2px;\n\tmargin: 0;\n\tpadding: 0;\n\tlist-style: none;\n}\n\n.cn-attention-flag__list li {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 8px;\n}\n\n.cn-attention-flag__lead {\n\tfont-weight: bold;\n}\n\n.cn-attention-flag__heading {\n\tmargin: 0;\n\tfont-size: 14px;\n\tfont-weight: bold;\n}\n\n.cn-attention-flag__hint {\n\tmargin: 0 0 8px;\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 13px;\n}\n\n.cn-attention-flag__muted {\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-attention-flag__due {\n\tcolor: var(--color-warning-text, var(--color-main-text));\n}\n\n.cn-attention-flag__refusal {\n\tmargin: 0;\n\tcolor: var(--color-error-text, var(--color-error));\n}\n</style>\n"],"names":["_openBlock","_createElementBlock","_createElementVNode","_toDisplayString","_Fragment","_renderList","_createBlock","_resolveDynamicComponent","_createVNode","_createTextVNode"],"mappings":";;;;AAWoB,EAAA,KAAK,EAAC,mBAAmB;AAAC,EAAA,aAAW,EAAC,mBAAc;;;;;AAIrE,EAAA,aAAC,EAAA,0BAAA;;AACK,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,yBAAY,GAAA;AAClB,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,0BAAkB,GAAA;;;OAKzB,EAAC,yBAAyB;eACpB,EAAC,2BAAW;;;AAMvB,MAAA,UAAA,GAAA,EAAA,KAAA,EAAA,yBAAA,GAAA;AACO,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,0BAAG,GAAA;;;AAMhB,EAAA,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