@conduction/nextcloud-vue 2.150.0 → 2.151.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/components/CnActionDialog/CnActionDialog.vue.js +1 -1
- package/dist/esm/components/CnActionDialog/CnActionDialog.vue2.js +7 -2
- package/dist/esm/components/CnActionDialog/CnActionDialog.vue2.js.map +1 -1
- package/dist/esm/components/CnActionDialog/CnActionDialog.vue3.js +40 -41
- package/dist/esm/components/CnActionDialog/CnActionDialog.vue3.js.map +1 -1
- package/dist/esm/components/CnConversationThread/CnConversationThread.vue.js +1 -1
- package/dist/esm/components/CnConversationThread/CnConversationThread.vue2.js +6 -3
- package/dist/esm/components/CnConversationThread/CnConversationThread.vue2.js.map +1 -1
- package/dist/esm/components/CnConversationThread/CnConversationThread.vue3.js +13 -1
- package/dist/esm/components/CnConversationThread/CnConversationThread.vue3.js.map +1 -1
- package/dist/esm/components/CnConversationThread/CnConversationWidget.vue.js +1 -1
- package/dist/esm/components/CnConversationThread/CnConversationWidget.vue2.js +5 -1
- package/dist/esm/components/CnConversationThread/CnConversationWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnConversationThread/CnConversationWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue.js +1 -1
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue2.js +46 -0
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue2.js.map +1 -1
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue3.js +64 -64
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue3.js.map +1 -1
- package/dist/esm/components/CnObjectDataWidget/CnObjectDataWidget.vue.js +1 -1
- package/dist/esm/components/CnObjectDataWidget/CnObjectDataWidget.vue2.js +15 -1
- package/dist/esm/components/CnObjectDataWidget/CnObjectDataWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnObjectDataWidget/CnObjectDataWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnPlanWidget/CnPlanWidgetRow.vue.js +1 -1
- package/dist/esm/components/CnPlanWidget/CnPlanWidgetRow.vue2.js.map +1 -1
- package/dist/esm/components/CnPlanWidget/CnPlanWidgetRow.vue3.js +16 -5
- package/dist/esm/components/CnPlanWidget/CnPlanWidgetRow.vue3.js.map +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue.js +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js +25 -2
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js +82 -68
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnRetentionWidget/CnRetentionWidget.vue.js +1 -1
- package/dist/esm/components/CnRetentionWidget/CnRetentionWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnRetentionWidget/CnRetentionWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnTimelineWidget/CnTimelineManage.vue.js +1 -1
- package/dist/esm/components/CnTimelineWidget/CnTimelineManage.vue2.js.map +1 -1
- package/dist/esm/components/CnTimelineWidget/CnTimelineManage.vue3.js +1 -1
- package/dist/esm/components/CnTimelineWidget/CnTimelineManage.vue3.js.map +1 -1
- package/dist/esm/integrations/builtin/calendar/eventStatus.js +43 -2
- package/dist/esm/integrations/builtin/calendar/eventStatus.js.map +1 -1
- package/dist/esm/l10n/en.json.js +4 -1
- package/dist/esm/l10n/en.json.js.map +1 -1
- package/dist/esm/l10n/nl.json.js +5 -2
- package/dist/esm/l10n/nl.json.js.map +1 -1
- package/dist/esm/library-style.js +1 -1
- package/dist/esm/nextcloud-vue.css +623 -362
- package/dist/nextcloud-vue.cjs.js +894 -720
- package/dist/nextcloud-vue.cjs.js.map +2 -2
- package/dist/nextcloud-vue.css +623 -362
- package/l10n/en.json +4 -1
- package/l10n/nl.json +5 -2
- package/package.json +1 -1
- package/src/components/CnActionDialog/CnActionDialog.vue +17 -4
- package/src/components/CnConversationThread/CnConversationThread.vue +16 -2
- package/src/components/CnConversationThread/CnConversationWidget.vue +5 -1
- package/src/components/CnFilesBrowser/CnFilesBrowser.vue +47 -2
- package/src/components/CnObjectDataWidget/CnObjectDataWidget.md +1 -1
- package/src/components/CnObjectDataWidget/CnObjectDataWidget.vue +15 -1
- package/src/components/CnPlanWidget/CnPlanWidgetRow.vue +17 -2
- package/src/components/CnRecordListWidget/CnRecordListWidget.vue +45 -2
- package/src/components/CnRetentionWidget/CnRetentionWidget.vue +8 -1
- package/src/components/CnTimelineWidget/CnTimelineManage.vue +1 -1
- package/src/css/dialog.css +6 -0
- package/src/css/look-board-detail.css +137 -0
- package/src/css/look-board.css +78 -2
- package/src/integrations/builtin/calendar/eventStatus.js +42 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CnConversationWidget.vue3.js","sources":["../../../../src/components/CnConversationThread/CnConversationWidget.vue?vue&type=template&id=63984d97&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<div class=\"cn-case-widget-card\">\n\t\t<CnConversationThread\n\t\t\tref=\"thread\"\n\t\t\t:messages=\"messages\"\n\t\t\t:title=\"tr(content.title || '')\"\n\t\t\t:subtitle=\"tr(content.subtitle || '')\"\n\t\t\t:showDirection=\"content.showDirection === true\"\n\t\t\t:allowReply=\"content.allowReply !== false\"\n\t\t\t:replyLabel=\"content.replyLabel ? tr(content.replyLabel) : undefined\"\n\t\t\t:placeholder=\"tr(content.placeholder || '')\"\n\t\t\t:sendLabel=\"content.sendLabel ? tr(content.sendLabel) : undefined\"\n\t\t\t:replyHint=\"tr(content.replyHint || '')\"\n\t\t\t:replyOption=\"replyOption\"\n\t\t\t:usLabel=\"content.usLabel ? tr(content.usLabel) : undefined\"\n\t\t\t:endpoint=\"replyAction ? '' : endpoint\"\n\t\t\t:loading=\"loading\"\n\t\t\t:emptyText=\"content.emptyText ? tr(content.emptyText) : undefined\"\n\t\t\t:channelFilter=\"content.channelChips === true\"\n\t\t\t:channels=\"channelLabels\"\n\t\t\t:payload=\"replyValues\"\n\t\t\t@send=\"onSend\"\n\t\t\t@sent=\"onSent\"\n\t\t\t@messageAction=\"onMessageAction\">\n\t\t\t<template v-if=\"templates\" #reply-tools=\"{ setDraft }\">\n\t\t\t\t<CnTemplateSelect\n\t\t\t\t\t:url=\"templates.url\"\n\t\t\t\t\t:params=\"templateParams\"\n\t\t\t\t\t:inputLabel=\"tr(templates.inputLabel || 'Template')\"\n\t\t\t\t\tdata-testid=\"cn-conversation-templates\"\n\t\t\t\t\t@apply=\"applyTemplate($event, setDraft)\" />\n\t\t\t</template>\n\t\t\t<template v-if=\"replyOptions.length > 0 || draftUrl\" #reply-actions=\"{ draft }\">\n\t\t\t\t<NcCheckboxRadioSwitch\n\t\t\t\t\tv-for=\"option in replyOptions\"\n\t\t\t\t\t:key=\"option.key\"\n\t\t\t\t\tv-model=\"replyValues[option.key]\"\n\t\t\t\t\t:data-testid=\"`cn-conversation-option-${option.key}`\">\n\t\t\t\t\t{{ tr(option.label) }}\n\t\t\t\t</NcCheckboxRadioSwitch>\n\t\t\t\t<span v-if=\"draftUrl && draftStatus\"\n\t\t\t\t\tclass=\"cn-conversation-widget__draft-status\"\n\t\t\t\t\trole=\"status\"\n\t\t\t\t\tdata-testid=\"cn-conversation-draft-status\">\n\t\t\t\t\t{{ draftStatus }}\n\t\t\t\t</span>\n\t\t\t\t<NcButton\n\t\t\t\t\tv-if=\"draftUrl\"\n\t\t\t\t\tdata-testid=\"cn-conversation-save-draft\"\n\t\t\t\t\t:disabled=\"savingDraft\"\n\t\t\t\t\t@click=\"saveDraft(draft)\">\n\t\t\t\t\t{{ t('nextcloud-vue', 'Save as draft') }}\n\t\t\t\t</NcButton>\n\t\t\t</template>\n\t\t\t<template v-if=\"headerAction || statusBadgeText\" #header-actions>\n\t\t\t\t<span v-if=\"statusBadgeText\"\n\t\t\t\t\tclass=\"cn-conversation-widget__badge\"\n\t\t\t\t\tdata-testid=\"cn-conversation-status-badge\">\n\t\t\t\t\t{{ statusBadgeText }}\n\t\t\t\t</span>\n\t\t\t\t<NcButton\n\t\t\t\t\tv-if=\"headerAction\"\n\t\t\t\t\tdata-testid=\"cn-conversation-header-action\"\n\t\t\t\t\t@click=\"onHeaderAction\">\n\t\t\t\t\t<template v-if=\"headerAction.icon\" #icon>\n\t\t\t\t\t\t<CnIcon :name=\"headerAction.icon\" :size=\"20\" />\n\t\t\t\t\t</template>\n\t\t\t\t\t{{ tr(headerAction.label) }}\n\t\t\t\t</NcButton>\n\t\t\t</template>\n\t\t</CnConversationThread>\n\t\t<p v-if=\"actionError\"\n\t\t\tclass=\"cn-conversation-widget__error\"\n\t\t\trole=\"alert\"\n\t\t\tdata-testid=\"cn-conversation-action-error\">\n\t\t\t{{ actionError }}\n\t\t</p>\n\t</div>\n</template>\n\n<script>\nimport { subscribe, unsubscribe } from '@nextcloud/event-bus'\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcButton, NcCheckboxRadioSwitch } from '@nextcloud/vue'\nimport CnIcon from '../CnIcon/CnIcon.vue'\nimport CnTemplateSelect from '../CnTemplateSelect/CnTemplateSelect.vue'\nimport CnConversationThread from './CnConversationThread.vue'\nimport { dispatchAction } from '../../utils/actionsDispatcher.js'\nimport { formatTimeOfDay } from '../../utils/boardDate.js'\nimport { fetchReferenceObjects } from '../../utils/boardReferenceColumns.js'\nimport { readPath } from '../../utils/readPath.js'\nimport { hasUnresolvedDeepTokens, resolveDeepTokens } from '../../utils/resolveFilterTokens.js'\nimport { userDisplayName } from '../../utils/userDisplayName.js'\n\n/**\n * CnConversationWidget: the `conversation` detail widget type.\n *\n * Renders CnConversationThread from the messages of a record, oldest first.\n * The messages are a list on the bound record (`field`), or the objects of a\n * register list (`source: { register, schema, filter?, limit? }`, the filter\n * token-resolved like a record-list's: `{ \"case\": \"@objectId\" }`).\n *\n * Mapping keys name where each message keeps its parts: `textField` (alias\n * `bodyField`), `timeField` (alias `timestampField`), `authorField` (alias\n * `senderField`), `sideField` (alias `directionField`) with `usValue` (alias\n * `outValue`) for the messages the organisation sent, and `channelField` with\n * an optional `channelMap` from stored value to label (\"email\" to \"E-mail\").\n *\n * The reply box posts to `endpoint` (`@objectId` filled in), or runs\n * `replyAction`, an action descriptor the app decides the meaning of: it is\n * dispatched with `args: [{ text, objectId }]` and `props.text`. After a send\n * the source is read again.\n *\n * `fields: [{ field, side }]` merges several lists of the record by time,\n * each on its side (a ticket's `portalReplies` and `portalAnswers`).\n * `templates` (`{ url, params?, inputLabel, textField? }`) puts a\n * CnTemplateSelect above the reply box; picking one fills the box with the\n * option's `values[textField]` (default `text`). `replyOptions`\n * (`[{ key, label, default? }]`) are checkboxes sent with the reply: in the\n * endpoint's body and as `options` in a `replyAction`'s argument.\n * `statusField` with `statusMap` shows each message's status, and\n * `messageActions` (`[{ id, label, endpoint, method?, when?, errorText? }]`)\n * are buttons on the messages that match `when` (`{ field, in }`,\n * `{ field, equals }`, `{ field, empty: true }`, or a list of them that must\n * all hold); `{field}` in the endpoint is read from the message. `errors`\n * (`{ path, map, default, ok? }`) names an answer's refusal by its status.\n *\n * `channelChips: true` draws a chip per channel above the thread (every\n * `channelMap` label, in map order, then any other channel a message uses).\n * `headerAction` is a button beside the title (`{ label, icon?, ...action }`,\n * DqZaakContact's \"Contact vastleggen\"), dispatched like `replyAction` with\n * `args: [{ objectId }]`; after it the source is read again.\n */\nexport default {\n\tname: 'CnConversationWidget',\n\n\tcomponents: {\n\t\tCnConversationThread,\n\t\tCnIcon,\n\t\tCnTemplateSelect,\n\t\tNcButton,\n\t\tNcCheckboxRadioSwitch,\n\t},\n\n\tinject: {\n\t\tcnTranslate: { default: () => (key) => key },\n\t\t/** Pre-bound action dispatcher of the page, for `replyAction`. */\n\t\tcnDispatchAction: { default: null },\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * The widget's content: `field` (the dot-path to the messages on the\n\t\t * record) or `source`, the mapping keys, `endpoint` or `replyAction`,\n\t\t * and the texts (`title`, `replyLabel`, `placeholder`, `sendLabel`,\n\t\t * `usLabel`, `emptyText`, translated).\n\t\t */\n\t\tcontent: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/** The bound record. */\n\t\tobjectData: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/** The bound record's id. */\n\t\tobjectId: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: '',\n\t\t},\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\t/** Replies sent from this widget that the record does not hold yet. */\n\t\t\tsentHere: [],\n\t\t\t/** The messages read from `source`. */\n\t\t\tlisted: [],\n\t\t\t/** Whether `source` is being read. */\n\t\t\tloading: false,\n\t\t\t/** The reply options' values, by key. */\n\t\t\treplyValues: this.initialReplyValues(),\n\t\t\t/** Why the last message action failed. */\n\t\t\tactionError: '',\n\t\t\t/** The action running, as `<action>|<message>`. */\n\t\t\tacting: '',\n\t\t\t/** The threads `statusBadge` reads. */\n\t\t\tbadgeRows: [],\n\t\t\t/** What the last draft save said: when it was saved, or that it failed. */\n\t\t\tdraftStatus: '',\n\t\t\t/** Whether a draft is being saved. */\n\t\t\tsavingDraft: false,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** @return {object|null} The register list the messages come from, or null. */\n\t\tsource() {\n\t\t\tconst source = this.content?.source\n\t\t\treturn source && typeof source === 'object' && source.register && source.schema ? source : null\n\t\t},\n\n\t\t/** @return {object|null} The header action, or null without a label. */\n\t\t/** @return {string} The latest thread's status (`statusBadge`), mapped and translated; '' for none. */\n\t\tstatusBadgeText() {\n\t\t\tconst badge = this.content?.statusBadge\n\t\t\tif (!badge || this.badgeRows.length === 0) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst sortField = badge.sortField || ''\n\t\t\tconst time = (row) => {\n\t\t\t\tconst value = sortField ? Date.parse(readPath(row, sortField)) : NaN\n\t\t\t\treturn Number.isNaN(value) ? 0 : value\n\t\t\t}\n\t\t\tconst latest = [...this.badgeRows].sort((a, b) => time(b) - time(a))[0]\n\t\t\tconst raw = readPath(latest, badge.path || 'status')\n\t\t\tif (raw === undefined || raw === null || raw === '') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst map = badge.map && typeof badge.map === 'object' ? badge.map : {}\n\t\t\treturn this.tr(Object.hasOwn(map, String(raw)) ? map[String(raw)] : String(raw))\n\t\t},\n\n\t\theaderAction() {\n\t\t\tconst action = this.content?.headerAction\n\t\t\treturn action && typeof action === 'object' && typeof action.label === 'string' && action.label !== '' ? action : null\n\t\t},\n\n\t\t/** @return {Array<string>} The `channelMap` labels, translated, each once. */\n\t\tchannelLabels() {\n\t\t\tconst map = this.content?.channelMap && typeof this.content.channelMap === 'object' ? this.content.channelMap : {}\n\t\t\treturn [...new Set(Object.values(map).filter((label) => typeof label === 'string' && label !== '').map((label) => this.tr(label)))]\n\t\t},\n\n\t\t/**\n\t\t * `content.replyOption` with its label translated, or null.\n\t\t *\n\t\t * @return {{label: string, key: string, value?: boolean}|null}\n\t\t * @spec openspec/changes/conversation-reply-option/specs/conversation-source/spec.md#requirement-a-reply-can-carry-a-hint-and-an-option\n\t\t */\n\t\treplyOption() {\n\t\t\tconst option = this.content?.replyOption\n\t\t\treturn option && typeof option === 'object' && option.label && option.key\n\t\t\t\t? { ...option, label: this.tr(option.label) }\n\t\t\t\t: null\n\t\t},\n\n\t\t/** @return {object|null} The template picker config, or null. */\n\t\ttemplates() {\n\t\t\tconst templates = this.content?.templates\n\t\t\treturn templates && typeof templates === 'object' && typeof templates.url === 'string' && templates.url !== '' ? templates : null\n\t\t},\n\n\t\t/** @return {object} The template list's params with tokens resolved. */\n\t\ttemplateParams() {\n\t\t\treturn resolveDeepTokens(this.templates?.params || {}, this.tokenCtx)\n\t\t},\n\n\t\t/** @return {Array<object>} The reply options with a key and a label. */\n\t\treplyOptions() {\n\t\t\tconst list = Array.isArray(this.content?.replyOptions) ? this.content.replyOptions : []\n\t\t\treturn list.filter((option) => option && typeof option.key === 'string' && option.key !== '' && typeof option.label === 'string')\n\t\t},\n\n\t\t/** @return {Array<object>} The message actions with an id, a label and an endpoint. */\n\t\tmessageActions() {\n\t\t\tconst list = Array.isArray(this.content?.messageActions) ? this.content.messageActions : []\n\t\t\treturn list.filter((action) => action && action.id && action.label && typeof action.endpoint === 'string')\n\t\t},\n\n\t\t/** @return {object|null} The reply action, or null. */\n\t\treplyAction() {\n\t\t\tconst action = this.content?.replyAction\n\t\t\treturn action && typeof action === 'object' ? action : null\n\t\t},\n\n\t\t/**\n\t\t * The messages in the thread's shape, oldest first, plus the replies\n\t\t * sent here.\n\t\t *\n\t\t * @return {Array<object>} The messages.\n\t\t * @spec openspec/changes/detail-action-model-and-case-surfaces/specs/detail-action-model/spec.md#requirement-conversation-thread\n\t\t * @spec openspec/changes/conversation-source/specs/conversation-source/spec.md#requirement-a-conversation-reads-its-messages-from-a-list-and-maps-their-parts\n\t\t */\n\t\tmessages() {\n\t\t\tconst c = this.content || {}\n\t\t\tconst usValue = String(c.outValue ?? c.usValue ?? 'us')\n\t\t\tconst channelMap = c.channelMap && typeof c.channelMap === 'object' ? c.channelMap : {}\n\t\t\tconst statusMap = c.statusMap && typeof c.statusMap === 'object' ? c.statusMap : {}\n\t\t\tconst stored = this.rawMessages()\n\t\t\t\t.map(({ message, side, key }, index) => {\n\t\t\t\t\tconst channel = c.channelField ? readPath(message, c.channelField) : undefined\n\t\t\t\t\tconst channelKey = channel === undefined || channel === null ? '' : String(channel)\n\t\t\t\t\tconst status = c.statusField ? readPath(message, c.statusField) : undefined\n\t\t\t\t\tconst statusKey = status === undefined || status === null ? '' : String(status)\n\t\t\t\t\tconst sideOf = side || (String(readPath(message, c.directionField || c.sideField || 'side')) === usValue ? 'us' : 'them')\n\t\t\t\t\treturn {\n\t\t\t\t\t\tid: key,\n\t\t\t\t\t\tauthor: this.authorOf(message, sideOf),\n\t\t\t\t\t\tnote: c.noteField ? this.textOf(readPath(message, c.noteField)) : '',\n\t\t\t\t\t\ttime: readPath(message, c.timestampField || c.timeField || 'time'),\n\t\t\t\t\t\ttext: readPath(message, c.bodyField || c.textField || 'text'),\n\t\t\t\t\t\tside: sideOf,\n\t\t\t\t\t\tchannel: channelKey === '' ? '' : this.tr(Object.hasOwn(channelMap, channelKey) ? channelMap[channelKey] : channelKey),\n\t\t\t\t\t\tstatus: statusKey === '' ? '' : this.tr(Object.hasOwn(statusMap, statusKey) ? statusMap[statusKey] : statusKey),\n\t\t\t\t\t\tactions: this.messageActions\n\t\t\t\t\t\t\t.filter((action) => this.actionApplies(action, message))\n\t\t\t\t\t\t\t.map((action) => ({ id: action.id, label: this.tr(action.label), disabled: this.acting === `${action.id}|${key}` })),\n\t\t\t\t\t\torder: index,\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\tconst at = (message) => {\n\t\t\t\tconst ms = Date.parse(message.time)\n\t\t\t\treturn Number.isNaN(ms) ? null : ms\n\t\t\t}\n\t\t\tstored.sort((a, b) => {\n\t\t\t\tconst ta = at(a)\n\t\t\t\tconst tb = at(b)\n\t\t\t\treturn (ta === null || tb === null || ta === tb) ? a.order - b.order : ta - tb\n\t\t\t})\n\t\t\treturn [...stored, ...this.sentHere]\n\t\t},\n\n\t\t/**\n\t\t * The endpoint with the record's id filled in.\n\t\t *\n\t\t * @return {string} The URL, or '' when the content names none.\n\t\t * @spec openspec/changes/detail-action-model-and-case-surfaces/specs/detail-action-model/spec.md#requirement-conversation-thread\n\t\t */\n\t\t/**\n\t\t * The reply draft's url (`content.draft.url`, `@objectId` filled in),\n\t\t * or '' without one.\n\t\t *\n\t\t * @return {string}\n\t\t * @spec openspec/changes/conversation-reply-draft/specs/conversation-reply-draft/spec.md#requirement-a-reply-can-be-saved-as-a-draft-and-comes-back\n\t\t */\n\t\tdraftUrl() {\n\t\t\tconst url = this.content.draft && this.content.draft.url\n\t\t\tif (typeof url !== 'string' || url === '') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\treturn url.replace(/@objectId/g, encodeURIComponent(String(this.objectId ?? '')))\n\t\t},\n\n\t\tendpoint() {\n\t\t\tconst url = this.content.endpoint\n\t\t\tif (typeof url !== 'string' || url === '') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\treturn url.replace(/@objectId/g, encodeURIComponent(String(this.objectId ?? '')))\n\t\t},\n\n\t\t/** @return {object} The token context for `source.filter` and `replyAction`. */\n\t\ttokenCtx() {\n\t\t\treturn { objectId: this.objectId, object: this.objectData || {} }\n\t\t},\n\t},\n\n\twatch: {\n\t\t// The record was read again, so it now holds what was sent from here.\n\t\tobjectData() {\n\t\t\tthis.sentHere = []\n\t\t},\n\n\t\tobjectId: {\n\t\t\timmediate: true,\n\t\t\thandler() {\n\t\t\t\tthis.loadSource()\n\t\t\t\tthis.loadBadge()\n\t\t\t\tthis.loadDraft()\n\t\t\t},\n\t\t},\n\t},\n\n\tmounted() {\n\t\tsubscribe('cn:page:refresh', this.onPageRefresh)\n\t\tsubscribe('cn:conversation:reply-sent', this.onReplySentElsewhere)\n\t},\n\n\tbeforeUnmount() {\n\t\tunsubscribe('cn:page:refresh', this.onPageRefresh)\n\t\tunsubscribe('cn:conversation:reply-sent', this.onReplySentElsewhere)\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * Read the saved reply draft into the reply box.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t * @spec openspec/changes/conversation-reply-draft/specs/conversation-reply-draft/spec.md#requirement-a-reply-can-be-saved-as-a-draft-and-comes-back\n\t\t */\n\t\tasync loadDraft() {\n\t\t\tif (!this.draftUrl) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tconst { default: axios } = await import('@nextcloud/axios')\n\t\t\t\tconst { generateUrl } = await import('@nextcloud/router')\n\t\t\t\tconst { data } = await axios.get(generateUrl(this.draftUrl))\n\t\t\t\tconst text = data && typeof data.text === 'string' ? data.text : ''\n\t\t\t\tif (text !== '' && this.$refs.thread) {\n\t\t\t\t\tthis.$refs.thread.setDraft(text)\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// No saved draft to read leaves the box empty.\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Store the reply box as the draft and say when it was saved.\n\t\t *\n\t\t * @param {string} text The reply box's text.\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync saveDraft(text) {\n\t\t\tthis.savingDraft = true\n\t\t\ttry {\n\t\t\t\tawait this.storeDraft(String(text ?? ''))\n\t\t\t\tthis.draftStatus = t('nextcloud-vue', 'Draft saved at {time}', { time: formatTimeOfDay(new Date()) })\n\t\t\t} catch {\n\t\t\t\tthis.draftStatus = t('nextcloud-vue', 'The draft could not be saved')\n\t\t\t} finally {\n\t\t\t\tthis.savingDraft = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * A reply on this record went out through a dialog or another surface\n\t\t * (`cn:conversation:reply-sent` with `{ objectId }`): the saved draft\n\t\t * and the reply box are cleared.\n\t\t *\n\t\t * @param {{objectId?: string}} payload The record the reply was on.\n\t\t * @return {Promise<void>}\n\t\t * @spec openspec/changes/conversation-reply-draft/specs/conversation-reply-draft/spec.md#requirement-a-reply-can-be-saved-as-a-draft-and-comes-back\n\t\t */\n\t\tasync onReplySentElsewhere(payload) {\n\t\t\tif (!this.draftUrl || String(payload?.objectId ?? '') !== String(this.objectId ?? '')) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (this.$refs.thread) {\n\t\t\t\tthis.$refs.thread.setDraft('')\n\t\t\t}\n\t\t\tthis.draftStatus = ''\n\t\t\ttry {\n\t\t\t\tawait this.storeDraft('')\n\t\t\t} catch {\n\t\t\t\t// The next save overwrites a draft that could not be cleared.\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * PUT the draft text.\n\t\t *\n\t\t * @param {string} text The text; '' clears the draft.\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync storeDraft(text) {\n\t\t\tconst { default: axios } = await import('@nextcloud/axios')\n\t\t\tconst { generateUrl } = await import('@nextcloud/router')\n\t\t\tawait axios.put(generateUrl(this.draftUrl), { text })\n\t\t},\n\n\t\t/**\n\t\t * Read the messages again when the page refreshes (a dialog sent one).\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync onPageRefresh() {\n\t\t\tawait Promise.all([this.loadSource(), this.loadBadge()])\n\t\t},\n\n\t\t/**\n\t\t * Read the threads whose latest status `statusBadge` shows\n\t\t * (`{ source: { register, schema, filter?, limit? }, sortField?, path?, map? }`).\n\t\t * A filter whose token does not resolve, or a failed read, shows no badge.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t * @spec openspec/changes/conversation-reply-tools/specs/conversation/spec.md#requirement-a-conversation-shows-the-latest-thread-status-and-a-status-can-open-a-follow-up\n\t\t */\n\t\tasync loadBadge() {\n\t\t\tconst source = this.content?.statusBadge?.source\n\t\t\tif (!source || !source.register || !source.schema) {\n\t\t\t\tthis.badgeRows = []\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst filter = resolveDeepTokens(source.filter || {}, this.tokenCtx)\n\t\t\tif (hasUnresolvedDeepTokens(filter) || Object.values(filter).some((value) => value === '' || value === null || value === undefined)) {\n\t\t\t\tthis.badgeRows = []\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tconst rows = await fetchReferenceObjects({ register: source.register, schema: source.schema, filter, limit: source.limit || 50 })\n\t\t\t\tthis.badgeRows = Array.isArray(rows) ? rows : []\n\t\t\t} catch {\n\t\t\t\tthis.badgeRows = []\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * The stored messages with the side their list gives them: one list\n\t\t * (`field` or `source`), or several merged (`fields`).\n\t\t *\n\t\t * @return {Array<{message: object, side: string, key: string}>} The messages.\n\t\t * @spec openspec/changes/conversation-reply-tools/specs/conversation/spec.md#requirement-a-conversation-merges-several-lists-of-the-record\n\t\t */\n\t\trawMessages() {\n\t\t\tconst c = this.content || {}\n\t\t\tconst lists = !this.source && Array.isArray(c.fields) && c.fields.length > 0\n\t\t\t\t? c.fields.filter((entry) => entry && typeof entry.field === 'string').map((entry) => ({ list: readPath(this.objectData || {}, entry.field), side: entry.side === 'us' ? 'us' : 'them', prefix: entry.field }))\n\t\t\t\t: [{ list: this.source ? this.listed : readPath(this.objectData || {}, c.field || 'messages'), side: '', prefix: 'message' }]\n\t\t\treturn lists.flatMap(({ list, side, prefix }) => (Array.isArray(list) ? list : [])\n\t\t\t\t.filter((message) => message && typeof message === 'object')\n\t\t\t\t.map((message, index) => ({ message, side, key: String(message.id ?? `${prefix}-${index}`) })))\n\t\t},\n\n\t\t/**\n\t\t * Whether a message action applies to a message (`when`).\n\t\t *\n\t\t * @param {object} action The action.\n\t\t * @param {object} message The stored message.\n\t\t * @return {boolean}\n\t\t */\n\t\tactionApplies(action, message) {\n\t\t\tconst conditions = [].concat(action.when || [])\n\t\t\treturn conditions.every((when) => {\n\t\t\t\tif (!when || typeof when !== 'object' || typeof when.field !== 'string') {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t\tconst value = readPath(message, when.field)\n\t\t\t\tif (when.empty === true) {\n\t\t\t\t\treturn value === undefined || value === null || value === ''\n\t\t\t\t}\n\t\t\t\tif (Array.isArray(when.in)) {\n\t\t\t\t\treturn when.in.map(String).includes(String(value))\n\t\t\t\t}\n\t\t\t\treturn String(value) === String(when.equals)\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * The reply options at their defaults.\n\t\t *\n\t\t * @return {object} Values by key.\n\t\t */\n\t\tinitialReplyValues() {\n\t\t\tconst list = Array.isArray(this.content?.replyOptions) ? this.content.replyOptions : []\n\t\t\treturn Object.fromEntries(list.filter((option) => option && option.key).map((option) => [option.key, option.default === true]))\n\t\t},\n\n\t\t/**\n\t\t * Put a picked template's text in the reply box.\n\t\t *\n\t\t * @param {object|null} option The template option.\n\t\t * @param {(text: string) => void} setDraft The thread's draft setter.\n\t\t * @return {void}\n\t\t */\n\t\tapplyTemplate(option, setDraft) {\n\t\t\tif (!option || !option.values) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst text = option.values[this.templates.textField || 'text']\n\t\t\tif (typeof text === 'string') {\n\t\t\t\tsetDraft(text)\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Run a message action: call its endpoint with the message's fields,\n\t\t * then read the messages again.\n\t\t *\n\t\t * @param {{action: string, message: string}} event Which action on which message.\n\t\t * @return {Promise<void>}\n\t\t * @spec openspec/changes/conversation-reply-tools/specs/conversation/spec.md#requirement-a-message-carries-its-status-and-actions\n\t\t */\n\t\tasync onMessageAction({ action: actionId, message: key }) {\n\t\t\tconst action = this.messageActions.find((entry) => entry.id === actionId)\n\t\t\tconst stored = this.rawMessages().find((entry) => entry.key === key)\n\t\t\tif (!action || !stored || this.acting) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.actionError = ''\n\t\t\tthis.acting = `${actionId}|${key}`\n\t\t\ttry {\n\t\t\t\tconst [{ default: axios }, { generateUrl }] = await Promise.all([import('@nextcloud/axios'), import('@nextcloud/router')])\n\t\t\t\tconst path = action.endpoint\n\t\t\t\t\t.replace(/@objectId/g, encodeURIComponent(String(this.objectId ?? '')))\n\t\t\t\t\t.replace(/\\{([\\w.]+)\\}/g, (_m, field) => encodeURIComponent(String(readPath(stored.message, field) ?? '')))\n\t\t\t\tconst response = await axios.request({ method: String(action.method || 'POST').toLowerCase(), url: generateUrl(path) })\n\t\t\t\tif (await this.followUp(action, response?.data)) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst refusal = this.actionRefusal(action, response?.data)\n\t\t\t\tif (refusal) {\n\t\t\t\t\tthis.actionError = refusal\n\t\t\t\t}\n\t\t\t\tawait this.loadSource()\n\t\t\t} catch (error) {\n\t\t\t\tif (await this.followUp(action, error?.response?.data)) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tthis.actionError = this.actionRefusal(action, error?.response?.data) || this.tr(action.errorText || 'The action failed.')\n\t\t\t} finally {\n\t\t\t\tthis.acting = ''\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Run the follow-up action a message action's answer asks for: the\n\t\t * status at `errors.path` (default `status`) looked up in `onStatus`,\n\t\t * dispatched like `headerAction`, tokens resolved against the record.\n\t\t *\n\t\t * @param {object} action The message action.\n\t\t * @param {object|undefined} answer The response body.\n\t\t * @return {Promise<boolean>} True when a follow-up ran.\n\t\t * @spec openspec/changes/conversation-reply-tools/specs/conversation/spec.md#requirement-a-conversation-shows-the-latest-thread-status-and-a-status-can-open-a-follow-up\n\t\t */\n\t\tasync followUp(action, answer) {\n\t\t\tconst map = action.onStatus\n\t\t\tif (!map || typeof map !== 'object' || !answer || typeof answer !== 'object') {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tconst status = readPath(answer, action.errors?.path || 'status')\n\t\t\tconst next = status === undefined || status === null ? null : map[String(status)]\n\t\t\tif (!next || typeof next !== 'object') {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tconst resolved = resolveDeepTokens(next, this.tokenCtx)\n\t\t\ttry {\n\t\t\t\tawait (typeof this.cnDispatchAction === 'function'\n\t\t\t\t\t? this.cnDispatchAction(resolved)\n\t\t\t\t\t: dispatchAction(resolved, { router: this.$router || null }))\n\t\t\t} catch {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn true\n\t\t},\n\n\t\t/**\n\t\t * The text a message action's answer names, by `errors` (`{ path, map,\n\t\t * ok? }`): the status at `path` mapped to a text. A status listed in `ok`\n\t\t * (default `[\"sent\", \"ok\"]`) is no refusal.\n\t\t *\n\t\t * @param {object} action The action.\n\t\t * @param {object|undefined} answer The response body.\n\t\t * @return {string} The text, '' for none.\n\t\t */\n\t\tactionRefusal(action, answer) {\n\t\t\tconst errors = action.errors\n\t\t\tif (!errors || typeof errors !== 'object' || !answer || typeof answer !== 'object') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst status = readPath(answer, errors.path || 'status')\n\t\t\tif (status === undefined || status === null || (errors.ok || ['sent', 'ok']).map(String).includes(String(status))) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst text = (errors.map || {})[String(status)] || errors.default\n\t\t\treturn text ? this.tr(text) : ''\n\t\t},\n\n\t\t/**\n\t\t * Who wrote a message: `usAuthorField` / `themAuthorField` for its\n\t\t * side, else `senderField` (`authorField`). A field written\n\t\t * `@object.<path>` reads the bound record (the case's requester on an\n\t\t * incoming message). With `usAuthorFormat` / `themAuthorFormat` set to\n\t\t * `user` the value is a user id, shown by its display name.\n\t\t *\n\t\t * @param {object} message The message.\n\t\t * @param {string} side `us` or `them`.\n\t\t * @return {string} The author, or '' when the message names none.\n\t\t * @spec openspec/changes/conversation-board-bubble/specs/conversation-source/spec.md#requirement-a-message-names-its-author-per-side-its-direction-and-a-note\n\t\t */\n\t\tauthorOf(message, side) {\n\t\t\tconst c = this.content || {}\n\t\t\tconst field = (side === 'us' ? c.usAuthorField : c.themAuthorField) || c.senderField || c.authorField || 'author'\n\t\t\tconst value = typeof field === 'string' && field.startsWith('@object.')\n\t\t\t\t? readPath(this.objectData || {}, field.slice('@object.'.length))\n\t\t\t\t: readPath(message, field)\n\t\t\tconst text = this.textOf(value)\n\t\t\tconst format = side === 'us' ? c.usAuthorFormat : c.themAuthorFormat\n\t\t\treturn format === 'user' && text !== '' ? (userDisplayName(text) || text) : text\n\t\t},\n\n\t\t/**\n\t\t * @param {unknown} value A stored value.\n\t\t * @return {string} It as text, or '' for none.\n\t\t */\n\t\ttextOf(value) {\n\t\t\treturn value === undefined || value === null || typeof value === 'object' ? '' : String(value)\n\t\t},\n\n\t\t/**\n\t\t * Translate through the app's translate.\n\t\t *\n\t\t * @param {string} key The source string.\n\t\t * @return {string}\n\t\t */\n\t\ttr(key) {\n\t\t\treturn key && typeof this.cnTranslate === 'function' ? this.cnTranslate(key) : (key || '')\n\t\t},\n\n\t\t/**\n\t\t * Read the messages from `source`. A filter whose token does not\n\t\t * resolve sends no request; a failed read leaves the thread empty.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t * @spec openspec/changes/conversation-source/specs/conversation-source/spec.md#requirement-a-conversation-reads-its-messages-from-a-list-and-maps-their-parts\n\t\t */\n\t\tasync loadSource() {\n\t\t\tif (!this.source) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst raw = this.source.filter || {}\n\t\t\tconst filter = resolveDeepTokens(raw, this.tokenCtx)\n\t\t\tconst emptied = Object.keys(raw).some((key) => typeof raw[key] === 'string' && raw[key].startsWith('@') && (filter[key] === '' || filter[key] === null || filter[key] === undefined))\n\t\t\tif (emptied || hasUnresolvedDeepTokens(filter)) {\n\t\t\t\tthis.listed = []\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.loading = true\n\t\t\ttry {\n\t\t\t\tthis.listed = await fetchReferenceObjects({ register: this.source.register, schema: this.source.schema, filter, limit: this.source.limit || 200 })\n\t\t\t\tthis.sentHere = []\n\t\t\t} catch {\n\t\t\t\tthis.listed = []\n\t\t\t} finally {\n\t\t\t\tthis.loading = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Run `replyAction` with the reply, when there is one; the endpoint\n\t\t * path is the thread's own.\n\t\t *\n\t\t * @param {string} text The reply.\n\t\t * @param {object} [extras] The reply option's state, `{ [key]: boolean }`.\n\t\t * @return {Promise<void>}\n\t\t * @spec openspec/changes/conversation-source/specs/conversation-source/spec.md#requirement-a-reply-can-run-an-app-action\n\t\t * @spec openspec/changes/conversation-reply-option/specs/conversation-source/spec.md#requirement-a-reply-can-carry-a-hint-and-an-option\n\t\t */\n\t\tasync onSend(text, extras = {}) {\n\t\t\tif (!this.replyAction) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst resolved = resolveDeepTokens(this.replyAction, this.tokenCtx)\n\t\t\tconst options = this.replyOptions.length > 0 ? { options: { ...this.replyValues } } : {}\n\t\t\tconst action = { ...resolved, args: [{ text, objectId: this.objectId, ...extras, ...options }], props: { ...(resolved.props || {}), text, ...extras, ...options } }\n\t\t\tconst result = typeof this.cnDispatchAction === 'function'\n\t\t\t\t? this.cnDispatchAction(action)\n\t\t\t\t: dispatchAction(action, { router: this.$router || null })\n\t\t\ttry {\n\t\t\t\tconst outcome = await result\n\t\t\t\tif (outcome === false) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (this.source) {\n\t\t\t\tawait this.loadSource()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.onSent({ text })\n\t\t},\n\n\t\t/**\n\t\t * Run `headerAction` with the record id, then read the source again.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync onHeaderAction() {\n\t\t\tif (!this.headerAction) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst { label, icon, ...rest } = resolveDeepTokens(this.headerAction, this.tokenCtx)\n\t\t\tconst action = { ...rest, args: [{ objectId: this.objectId }] }\n\t\t\ttry {\n\t\t\t\tconst outcome = await (typeof this.cnDispatchAction === 'function'\n\t\t\t\t\t? this.cnDispatchAction(action)\n\t\t\t\t\t: dispatchAction(action, { router: this.$router || null }))\n\t\t\t\tif (outcome === false) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tawait this.loadSource()\n\t\t},\n\n\t\t/**\n\t\t * Show an accepted reply at once, without waiting for the record.\n\t\t *\n\t\t * @param {object} data The endpoint's response.\n\t\t * @return {void}\n\t\t * @spec openspec/changes/detail-action-model-and-case-surfaces/specs/detail-action-model/spec.md#requirement-conversation-thread\n\t\t */\n\t\tonSent(data) {\n\t\t\tconst text = data?.message ?? data?.text\n\t\t\tif (typeof text !== 'string' || text === '') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (this.draftUrl) {\n\t\t\t\tthis.storeDraft('')\n\t\t\t}\n\t\t\tthis.sentHere.push({\n\t\t\t\tid: `sent-${this.sentHere.length}`,\n\t\t\t\ttime: new Date().toISOString(),\n\t\t\t\ttext,\n\t\t\t\tside: 'us',\n\t\t\t})\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-conversation-widget__badge {\n\tpadding: 2px 10px;\n\tborder-radius: var(--border-radius-pill);\n\tbackground: var(--color-background-dark);\n\tcolor: var(--color-main-text);\n\tfont-size: var(--font-size-small, 13px);\n}\n\n.cn-conversation-widget__error {\n\tcolor: var(--color-error-text, var(--color-error));\n\tmargin: calc(2 * var(--default-grid-baseline)) 0 0;\n}\n\n.cn-case-widget-card {\n\tbackground: var(--color-main-background);\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius-large);\n\tpadding: calc(5 * var(--default-grid-baseline));\n}\n\n.cn-conversation-widget__draft-status {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 13px;\n}\n</style>\n"],"names":["_openBlock","_createElementBlock","_createVNode","_withCtx","_Fragment","_renderList","_createBlock","_toDisplayString","_createTextVNode"],"mappings":";;AAWM,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,qBAAsB,GAAA;;;AAwC7B,EAAA,KAAK,EAAC,sCAAC;AACP,EAAA,IAAI,EAAC,QAAQ;AACb,EAAA,aAAW,EAAC,8BAA2B;;;;AAavC,EAAA,KAAK,EAAC,+BAAY;AAClB,EAAA,aAAW,EAAC,8BAA8B;;;;AAe5C,EAAA,KAAG,EAAA,+BAAA;;;;;;;;;;;;AAvEH,EAAA,QAAAA,SAAA,EAAA,EAAAC,kBAAA,QAAA;IACAC,WAoEgB,CAAA,+BAAA,EAAA;AAnEhB,MAAA,GAAG,EAAC,QAAQ;AACX,MAAA,QAAQ,EAAE,QAAQ,CAAA,QAAA;AAClB,MAAA,KAAK,EAAE,QAAA,CAAA,EAAE,CAAC,MAAA,CAAA,OAAO,CAAC,KAAK,IAAA,EAAA,CAAA;AACvB,MAAA,QAAQ,EAAE,QAAA,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.vue?vue&type=template&id=f7f83cfa&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<div class=\"cn-case-widget-card\">\n\t\t<CnConversationThread\n\t\t\tref=\"thread\"\n\t\t\t:messages=\"messages\"\n\t\t\t:title=\"tr(content.title || '')\"\n\t\t\t:subtitle=\"tr(content.subtitle || '')\"\n\t\t\t:showDirection=\"content.showDirection === true\"\n\t\t\t:allowReply=\"content.allowReply !== false\"\n\t\t\t:replyLabel=\"content.replyLabel ? tr(content.replyLabel) : undefined\"\n\t\t\t:placeholder=\"tr(content.placeholder || '')\"\n\t\t\t:sendLabel=\"content.sendLabel ? tr(content.sendLabel) : undefined\"\n\t\t\t:replyHint=\"tr(content.replyHint || '')\"\n\t\t\t:replyOption=\"replyOption\"\n\t\t\t:usLabel=\"content.usLabel ? tr(content.usLabel) : undefined\"\n\t\t\t:endpoint=\"replyAction ? '' : endpoint\"\n\t\t\t:loading=\"loading\"\n\t\t\t:emptyText=\"content.emptyText ? tr(content.emptyText) : undefined\"\n\t\t\t:channelFilter=\"content.channelChips === true\"\n\t\t\t:channels=\"channelLabels\"\n\t\t\t:payload=\"replyValues\"\n\t\t\t@send=\"onSend\"\n\t\t\t@sent=\"onSent\"\n\t\t\t@messageAction=\"onMessageAction\">\n\t\t\t<template v-if=\"templates\" #reply-tools=\"{ setDraft }\">\n\t\t\t\t<CnTemplateSelect\n\t\t\t\t\t:url=\"templates.url\"\n\t\t\t\t\t:params=\"templateParams\"\n\t\t\t\t\t:inputLabel=\"tr(templates.inputLabel || 'Template')\"\n\t\t\t\t\tdata-testid=\"cn-conversation-templates\"\n\t\t\t\t\t@apply=\"applyTemplate($event, setDraft)\" />\n\t\t\t</template>\n\t\t\t<template v-if=\"replyOptions.length > 0 || draftUrl\" #reply-actions=\"{ draft }\">\n\t\t\t\t<NcCheckboxRadioSwitch\n\t\t\t\t\tv-for=\"option in replyOptions\"\n\t\t\t\t\t:key=\"option.key\"\n\t\t\t\t\tv-model=\"replyValues[option.key]\"\n\t\t\t\t\t:data-testid=\"`cn-conversation-option-${option.key}`\">\n\t\t\t\t\t{{ tr(option.label) }}\n\t\t\t\t</NcCheckboxRadioSwitch>\n\t\t\t\t<span v-if=\"draftUrl && draftStatus\"\n\t\t\t\t\tclass=\"cn-conversation-widget__draft-status\"\n\t\t\t\t\trole=\"status\"\n\t\t\t\t\tdata-testid=\"cn-conversation-draft-status\">\n\t\t\t\t\t{{ draftStatus }}\n\t\t\t\t</span>\n\t\t\t\t<NcButton\n\t\t\t\t\tv-if=\"draftUrl\"\n\t\t\t\t\tdata-testid=\"cn-conversation-save-draft\"\n\t\t\t\t\t:disabled=\"savingDraft\"\n\t\t\t\t\t@click=\"saveDraft(draft)\">\n\t\t\t\t\t{{ t('nextcloud-vue', 'Save as draft') }}\n\t\t\t\t</NcButton>\n\t\t\t</template>\n\t\t\t<template v-if=\"headerAction || statusBadgeText\" #header-actions>\n\t\t\t\t<span v-if=\"statusBadgeText\"\n\t\t\t\t\tclass=\"cn-conversation-widget__badge\"\n\t\t\t\t\tdata-testid=\"cn-conversation-status-badge\">\n\t\t\t\t\t{{ statusBadgeText }}\n\t\t\t\t</span>\n\t\t\t\t<NcButton\n\t\t\t\t\tv-if=\"headerAction\"\n\t\t\t\t\tdata-testid=\"cn-conversation-header-action\"\n\t\t\t\t\t@click=\"onHeaderAction\">\n\t\t\t\t\t<template v-if=\"headerAction.icon\" #icon>\n\t\t\t\t\t\t<CnIcon :name=\"headerAction.icon\" :size=\"20\" />\n\t\t\t\t\t</template>\n\t\t\t\t\t{{ tr(headerAction.label) }}\n\t\t\t\t</NcButton>\n\t\t\t</template>\n\t\t</CnConversationThread>\n\t\t<p v-if=\"actionError\"\n\t\t\tclass=\"cn-conversation-widget__error\"\n\t\t\trole=\"alert\"\n\t\t\tdata-testid=\"cn-conversation-action-error\">\n\t\t\t{{ actionError }}\n\t\t</p>\n\t</div>\n</template>\n\n<script>\nimport { subscribe, unsubscribe } from '@nextcloud/event-bus'\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcButton, NcCheckboxRadioSwitch } from '@nextcloud/vue'\nimport CnIcon from '../CnIcon/CnIcon.vue'\nimport CnTemplateSelect from '../CnTemplateSelect/CnTemplateSelect.vue'\nimport CnConversationThread from './CnConversationThread.vue'\nimport { dispatchAction } from '../../utils/actionsDispatcher.js'\nimport { formatTimeOfDay } from '../../utils/boardDate.js'\nimport { fetchReferenceObjects } from '../../utils/boardReferenceColumns.js'\nimport { readPath } from '../../utils/readPath.js'\nimport { hasUnresolvedDeepTokens, resolveDeepTokens } from '../../utils/resolveFilterTokens.js'\nimport { userDisplayName } from '../../utils/userDisplayName.js'\n\n/**\n * CnConversationWidget: the `conversation` detail widget type.\n *\n * Renders CnConversationThread from the messages of a record, oldest first.\n * The messages are a list on the bound record (`field`), or the objects of a\n * register list (`source: { register, schema, filter?, limit? }`, the filter\n * token-resolved like a record-list's: `{ \"case\": \"@objectId\" }`).\n *\n * Mapping keys name where each message keeps its parts: `textField` (alias\n * `bodyField`), `timeField` (alias `timestampField`), `authorField` (alias\n * `senderField`), `sideField` (alias `directionField`) with `usValue` (alias\n * `outValue`) for the messages the organisation sent, and `channelField` with\n * an optional `channelMap` from stored value to label (\"email\" to \"E-mail\")\n * and `channelIcons` from stored value to an icon name, drawn before the label.\n *\n * The reply box posts to `endpoint` (`@objectId` filled in), or runs\n * `replyAction`, an action descriptor the app decides the meaning of: it is\n * dispatched with `args: [{ text, objectId }]` and `props.text`. After a send\n * the source is read again.\n *\n * `fields: [{ field, side }]` merges several lists of the record by time,\n * each on its side (a ticket's `portalReplies` and `portalAnswers`).\n * `templates` (`{ url, params?, inputLabel, textField? }`) puts a\n * CnTemplateSelect above the reply box; picking one fills the box with the\n * option's `values[textField]` (default `text`). `replyOptions`\n * (`[{ key, label, default? }]`) are checkboxes sent with the reply: in the\n * endpoint's body and as `options` in a `replyAction`'s argument.\n * `statusField` with `statusMap` shows each message's status, and\n * `messageActions` (`[{ id, label, endpoint, method?, when?, errorText? }]`)\n * are buttons on the messages that match `when` (`{ field, in }`,\n * `{ field, equals }`, `{ field, empty: true }`, or a list of them that must\n * all hold); `{field}` in the endpoint is read from the message. `errors`\n * (`{ path, map, default, ok? }`) names an answer's refusal by its status.\n *\n * `channelChips: true` draws a chip per channel above the thread (every\n * `channelMap` label, in map order, then any other channel a message uses).\n * `headerAction` is a button beside the title (`{ label, icon?, ...action }`,\n * DqZaakContact's \"Contact vastleggen\"), dispatched like `replyAction` with\n * `args: [{ objectId }]`; after it the source is read again.\n */\nexport default {\n\tname: 'CnConversationWidget',\n\n\tcomponents: {\n\t\tCnConversationThread,\n\t\tCnIcon,\n\t\tCnTemplateSelect,\n\t\tNcButton,\n\t\tNcCheckboxRadioSwitch,\n\t},\n\n\tinject: {\n\t\tcnTranslate: { default: () => (key) => key },\n\t\t/** Pre-bound action dispatcher of the page, for `replyAction`. */\n\t\tcnDispatchAction: { default: null },\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * The widget's content: `field` (the dot-path to the messages on the\n\t\t * record) or `source`, the mapping keys, `endpoint` or `replyAction`,\n\t\t * and the texts (`title`, `replyLabel`, `placeholder`, `sendLabel`,\n\t\t * `usLabel`, `emptyText`, translated).\n\t\t */\n\t\tcontent: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/** The bound record. */\n\t\tobjectData: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/** The bound record's id. */\n\t\tobjectId: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: '',\n\t\t},\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\t/** Replies sent from this widget that the record does not hold yet. */\n\t\t\tsentHere: [],\n\t\t\t/** The messages read from `source`. */\n\t\t\tlisted: [],\n\t\t\t/** Whether `source` is being read. */\n\t\t\tloading: false,\n\t\t\t/** The reply options' values, by key. */\n\t\t\treplyValues: this.initialReplyValues(),\n\t\t\t/** Why the last message action failed. */\n\t\t\tactionError: '',\n\t\t\t/** The action running, as `<action>|<message>`. */\n\t\t\tacting: '',\n\t\t\t/** The threads `statusBadge` reads. */\n\t\t\tbadgeRows: [],\n\t\t\t/** What the last draft save said: when it was saved, or that it failed. */\n\t\t\tdraftStatus: '',\n\t\t\t/** Whether a draft is being saved. */\n\t\t\tsavingDraft: false,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** @return {object|null} The register list the messages come from, or null. */\n\t\tsource() {\n\t\t\tconst source = this.content?.source\n\t\t\treturn source && typeof source === 'object' && source.register && source.schema ? source : null\n\t\t},\n\n\t\t/** @return {object|null} The header action, or null without a label. */\n\t\t/** @return {string} The latest thread's status (`statusBadge`), mapped and translated; '' for none. */\n\t\tstatusBadgeText() {\n\t\t\tconst badge = this.content?.statusBadge\n\t\t\tif (!badge || this.badgeRows.length === 0) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst sortField = badge.sortField || ''\n\t\t\tconst time = (row) => {\n\t\t\t\tconst value = sortField ? Date.parse(readPath(row, sortField)) : NaN\n\t\t\t\treturn Number.isNaN(value) ? 0 : value\n\t\t\t}\n\t\t\tconst latest = [...this.badgeRows].sort((a, b) => time(b) - time(a))[0]\n\t\t\tconst raw = readPath(latest, badge.path || 'status')\n\t\t\tif (raw === undefined || raw === null || raw === '') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst map = badge.map && typeof badge.map === 'object' ? badge.map : {}\n\t\t\treturn this.tr(Object.hasOwn(map, String(raw)) ? map[String(raw)] : String(raw))\n\t\t},\n\n\t\theaderAction() {\n\t\t\tconst action = this.content?.headerAction\n\t\t\treturn action && typeof action === 'object' && typeof action.label === 'string' && action.label !== '' ? action : null\n\t\t},\n\n\t\t/** @return {Array<string>} The `channelMap` labels, translated, each once. */\n\t\tchannelLabels() {\n\t\t\tconst map = this.content?.channelMap && typeof this.content.channelMap === 'object' ? this.content.channelMap : {}\n\t\t\treturn [...new Set(Object.values(map).filter((label) => typeof label === 'string' && label !== '').map((label) => this.tr(label)))]\n\t\t},\n\n\t\t/**\n\t\t * `content.replyOption` with its label translated, or null.\n\t\t *\n\t\t * @return {{label: string, key: string, value?: boolean}|null}\n\t\t * @spec openspec/changes/conversation-reply-option/specs/conversation-source/spec.md#requirement-a-reply-can-carry-a-hint-and-an-option\n\t\t */\n\t\treplyOption() {\n\t\t\tconst option = this.content?.replyOption\n\t\t\treturn option && typeof option === 'object' && option.label && option.key\n\t\t\t\t? { ...option, label: this.tr(option.label) }\n\t\t\t\t: null\n\t\t},\n\n\t\t/** @return {object|null} The template picker config, or null. */\n\t\ttemplates() {\n\t\t\tconst templates = this.content?.templates\n\t\t\treturn templates && typeof templates === 'object' && typeof templates.url === 'string' && templates.url !== '' ? templates : null\n\t\t},\n\n\t\t/** @return {object} The template list's params with tokens resolved. */\n\t\ttemplateParams() {\n\t\t\treturn resolveDeepTokens(this.templates?.params || {}, this.tokenCtx)\n\t\t},\n\n\t\t/** @return {Array<object>} The reply options with a key and a label. */\n\t\treplyOptions() {\n\t\t\tconst list = Array.isArray(this.content?.replyOptions) ? this.content.replyOptions : []\n\t\t\treturn list.filter((option) => option && typeof option.key === 'string' && option.key !== '' && typeof option.label === 'string')\n\t\t},\n\n\t\t/** @return {Array<object>} The message actions with an id, a label and an endpoint. */\n\t\tmessageActions() {\n\t\t\tconst list = Array.isArray(this.content?.messageActions) ? this.content.messageActions : []\n\t\t\treturn list.filter((action) => action && action.id && action.label && typeof action.endpoint === 'string')\n\t\t},\n\n\t\t/** @return {object|null} The reply action, or null. */\n\t\treplyAction() {\n\t\t\tconst action = this.content?.replyAction\n\t\t\treturn action && typeof action === 'object' ? action : null\n\t\t},\n\n\t\t/**\n\t\t * The messages in the thread's shape, oldest first, plus the replies\n\t\t * sent here.\n\t\t *\n\t\t * @return {Array<object>} The messages.\n\t\t * @spec openspec/changes/detail-action-model-and-case-surfaces/specs/detail-action-model/spec.md#requirement-conversation-thread\n\t\t * @spec openspec/changes/conversation-source/specs/conversation-source/spec.md#requirement-a-conversation-reads-its-messages-from-a-list-and-maps-their-parts\n\t\t */\n\t\tmessages() {\n\t\t\tconst c = this.content || {}\n\t\t\tconst usValue = String(c.outValue ?? c.usValue ?? 'us')\n\t\t\tconst channelMap = c.channelMap && typeof c.channelMap === 'object' ? c.channelMap : {}\n\t\t\tconst channelIcons = c.channelIcons && typeof c.channelIcons === 'object' ? c.channelIcons : {}\n\t\t\tconst statusMap = c.statusMap && typeof c.statusMap === 'object' ? c.statusMap : {}\n\t\t\tconst stored = this.rawMessages()\n\t\t\t\t.map(({ message, side, key }, index) => {\n\t\t\t\t\tconst channel = c.channelField ? readPath(message, c.channelField) : undefined\n\t\t\t\t\tconst channelKey = channel === undefined || channel === null ? '' : String(channel)\n\t\t\t\t\tconst status = c.statusField ? readPath(message, c.statusField) : undefined\n\t\t\t\t\tconst statusKey = status === undefined || status === null ? '' : String(status)\n\t\t\t\t\tconst sideOf = side || (String(readPath(message, c.directionField || c.sideField || 'side')) === usValue ? 'us' : 'them')\n\t\t\t\t\treturn {\n\t\t\t\t\t\tid: key,\n\t\t\t\t\t\tauthor: this.authorOf(message, sideOf),\n\t\t\t\t\t\tnote: c.noteField ? this.textOf(readPath(message, c.noteField)) : '',\n\t\t\t\t\t\ttime: readPath(message, c.timestampField || c.timeField || 'time'),\n\t\t\t\t\t\ttext: readPath(message, c.bodyField || c.textField || 'text'),\n\t\t\t\t\t\tside: sideOf,\n\t\t\t\t\t\tchannel: channelKey === '' ? '' : this.tr(Object.hasOwn(channelMap, channelKey) ? channelMap[channelKey] : channelKey),\n\t\t\t\t\t\t// @spec openspec/changes/conversation-channel-icons/specs/conversation-channel-icons/spec.md#requirement-a-messages-channel-can-carry-its-icon\n\t\t\t\t\t\tchannelIcon: Object.hasOwn(channelIcons, channelKey) && typeof channelIcons[channelKey] === 'string' ? channelIcons[channelKey] : '',\n\t\t\t\t\t\tstatus: statusKey === '' ? '' : this.tr(Object.hasOwn(statusMap, statusKey) ? statusMap[statusKey] : statusKey),\n\t\t\t\t\t\tactions: this.messageActions\n\t\t\t\t\t\t\t.filter((action) => this.actionApplies(action, message))\n\t\t\t\t\t\t\t.map((action) => ({ id: action.id, label: this.tr(action.label), disabled: this.acting === `${action.id}|${key}` })),\n\t\t\t\t\t\torder: index,\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\tconst at = (message) => {\n\t\t\t\tconst ms = Date.parse(message.time)\n\t\t\t\treturn Number.isNaN(ms) ? null : ms\n\t\t\t}\n\t\t\tstored.sort((a, b) => {\n\t\t\t\tconst ta = at(a)\n\t\t\t\tconst tb = at(b)\n\t\t\t\treturn (ta === null || tb === null || ta === tb) ? a.order - b.order : ta - tb\n\t\t\t})\n\t\t\treturn [...stored, ...this.sentHere]\n\t\t},\n\n\t\t/**\n\t\t * The endpoint with the record's id filled in.\n\t\t *\n\t\t * @return {string} The URL, or '' when the content names none.\n\t\t * @spec openspec/changes/detail-action-model-and-case-surfaces/specs/detail-action-model/spec.md#requirement-conversation-thread\n\t\t */\n\t\t/**\n\t\t * The reply draft's url (`content.draft.url`, `@objectId` filled in),\n\t\t * or '' without one.\n\t\t *\n\t\t * @return {string}\n\t\t * @spec openspec/changes/conversation-reply-draft/specs/conversation-reply-draft/spec.md#requirement-a-reply-can-be-saved-as-a-draft-and-comes-back\n\t\t */\n\t\tdraftUrl() {\n\t\t\tconst url = this.content.draft && this.content.draft.url\n\t\t\tif (typeof url !== 'string' || url === '') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\treturn url.replace(/@objectId/g, encodeURIComponent(String(this.objectId ?? '')))\n\t\t},\n\n\t\tendpoint() {\n\t\t\tconst url = this.content.endpoint\n\t\t\tif (typeof url !== 'string' || url === '') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\treturn url.replace(/@objectId/g, encodeURIComponent(String(this.objectId ?? '')))\n\t\t},\n\n\t\t/** @return {object} The token context for `source.filter` and `replyAction`. */\n\t\ttokenCtx() {\n\t\t\treturn { objectId: this.objectId, object: this.objectData || {} }\n\t\t},\n\t},\n\n\twatch: {\n\t\t// The record was read again, so it now holds what was sent from here.\n\t\tobjectData() {\n\t\t\tthis.sentHere = []\n\t\t},\n\n\t\tobjectId: {\n\t\t\timmediate: true,\n\t\t\thandler() {\n\t\t\t\tthis.loadSource()\n\t\t\t\tthis.loadBadge()\n\t\t\t\tthis.loadDraft()\n\t\t\t},\n\t\t},\n\t},\n\n\tmounted() {\n\t\tsubscribe('cn:page:refresh', this.onPageRefresh)\n\t\tsubscribe('cn:conversation:reply-sent', this.onReplySentElsewhere)\n\t},\n\n\tbeforeUnmount() {\n\t\tunsubscribe('cn:page:refresh', this.onPageRefresh)\n\t\tunsubscribe('cn:conversation:reply-sent', this.onReplySentElsewhere)\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * Read the saved reply draft into the reply box.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t * @spec openspec/changes/conversation-reply-draft/specs/conversation-reply-draft/spec.md#requirement-a-reply-can-be-saved-as-a-draft-and-comes-back\n\t\t */\n\t\tasync loadDraft() {\n\t\t\tif (!this.draftUrl) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tconst { default: axios } = await import('@nextcloud/axios')\n\t\t\t\tconst { generateUrl } = await import('@nextcloud/router')\n\t\t\t\tconst { data } = await axios.get(generateUrl(this.draftUrl))\n\t\t\t\tconst text = data && typeof data.text === 'string' ? data.text : ''\n\t\t\t\tif (text !== '' && this.$refs.thread) {\n\t\t\t\t\tthis.$refs.thread.setDraft(text)\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// No saved draft to read leaves the box empty.\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Store the reply box as the draft and say when it was saved.\n\t\t *\n\t\t * @param {string} text The reply box's text.\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync saveDraft(text) {\n\t\t\tthis.savingDraft = true\n\t\t\ttry {\n\t\t\t\tawait this.storeDraft(String(text ?? ''))\n\t\t\t\tthis.draftStatus = t('nextcloud-vue', 'Draft saved at {time}', { time: formatTimeOfDay(new Date()) })\n\t\t\t} catch {\n\t\t\t\tthis.draftStatus = t('nextcloud-vue', 'The draft could not be saved')\n\t\t\t} finally {\n\t\t\t\tthis.savingDraft = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * A reply on this record went out through a dialog or another surface\n\t\t * (`cn:conversation:reply-sent` with `{ objectId }`): the saved draft\n\t\t * and the reply box are cleared.\n\t\t *\n\t\t * @param {{objectId?: string}} payload The record the reply was on.\n\t\t * @return {Promise<void>}\n\t\t * @spec openspec/changes/conversation-reply-draft/specs/conversation-reply-draft/spec.md#requirement-a-reply-can-be-saved-as-a-draft-and-comes-back\n\t\t */\n\t\tasync onReplySentElsewhere(payload) {\n\t\t\tif (!this.draftUrl || String(payload?.objectId ?? '') !== String(this.objectId ?? '')) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (this.$refs.thread) {\n\t\t\t\tthis.$refs.thread.setDraft('')\n\t\t\t}\n\t\t\tthis.draftStatus = ''\n\t\t\ttry {\n\t\t\t\tawait this.storeDraft('')\n\t\t\t} catch {\n\t\t\t\t// The next save overwrites a draft that could not be cleared.\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * PUT the draft text.\n\t\t *\n\t\t * @param {string} text The text; '' clears the draft.\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync storeDraft(text) {\n\t\t\tconst { default: axios } = await import('@nextcloud/axios')\n\t\t\tconst { generateUrl } = await import('@nextcloud/router')\n\t\t\tawait axios.put(generateUrl(this.draftUrl), { text })\n\t\t},\n\n\t\t/**\n\t\t * Read the messages again when the page refreshes (a dialog sent one).\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync onPageRefresh() {\n\t\t\tawait Promise.all([this.loadSource(), this.loadBadge()])\n\t\t},\n\n\t\t/**\n\t\t * Read the threads whose latest status `statusBadge` shows\n\t\t * (`{ source: { register, schema, filter?, limit? }, sortField?, path?, map? }`).\n\t\t * A filter whose token does not resolve, or a failed read, shows no badge.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t * @spec openspec/changes/conversation-reply-tools/specs/conversation/spec.md#requirement-a-conversation-shows-the-latest-thread-status-and-a-status-can-open-a-follow-up\n\t\t */\n\t\tasync loadBadge() {\n\t\t\tconst source = this.content?.statusBadge?.source\n\t\t\tif (!source || !source.register || !source.schema) {\n\t\t\t\tthis.badgeRows = []\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst filter = resolveDeepTokens(source.filter || {}, this.tokenCtx)\n\t\t\tif (hasUnresolvedDeepTokens(filter) || Object.values(filter).some((value) => value === '' || value === null || value === undefined)) {\n\t\t\t\tthis.badgeRows = []\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tconst rows = await fetchReferenceObjects({ register: source.register, schema: source.schema, filter, limit: source.limit || 50 })\n\t\t\t\tthis.badgeRows = Array.isArray(rows) ? rows : []\n\t\t\t} catch {\n\t\t\t\tthis.badgeRows = []\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * The stored messages with the side their list gives them: one list\n\t\t * (`field` or `source`), or several merged (`fields`).\n\t\t *\n\t\t * @return {Array<{message: object, side: string, key: string}>} The messages.\n\t\t * @spec openspec/changes/conversation-reply-tools/specs/conversation/spec.md#requirement-a-conversation-merges-several-lists-of-the-record\n\t\t */\n\t\trawMessages() {\n\t\t\tconst c = this.content || {}\n\t\t\tconst lists = !this.source && Array.isArray(c.fields) && c.fields.length > 0\n\t\t\t\t? c.fields.filter((entry) => entry && typeof entry.field === 'string').map((entry) => ({ list: readPath(this.objectData || {}, entry.field), side: entry.side === 'us' ? 'us' : 'them', prefix: entry.field }))\n\t\t\t\t: [{ list: this.source ? this.listed : readPath(this.objectData || {}, c.field || 'messages'), side: '', prefix: 'message' }]\n\t\t\treturn lists.flatMap(({ list, side, prefix }) => (Array.isArray(list) ? list : [])\n\t\t\t\t.filter((message) => message && typeof message === 'object')\n\t\t\t\t.map((message, index) => ({ message, side, key: String(message.id ?? `${prefix}-${index}`) })))\n\t\t},\n\n\t\t/**\n\t\t * Whether a message action applies to a message (`when`).\n\t\t *\n\t\t * @param {object} action The action.\n\t\t * @param {object} message The stored message.\n\t\t * @return {boolean}\n\t\t */\n\t\tactionApplies(action, message) {\n\t\t\tconst conditions = [].concat(action.when || [])\n\t\t\treturn conditions.every((when) => {\n\t\t\t\tif (!when || typeof when !== 'object' || typeof when.field !== 'string') {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t\tconst value = readPath(message, when.field)\n\t\t\t\tif (when.empty === true) {\n\t\t\t\t\treturn value === undefined || value === null || value === ''\n\t\t\t\t}\n\t\t\t\tif (Array.isArray(when.in)) {\n\t\t\t\t\treturn when.in.map(String).includes(String(value))\n\t\t\t\t}\n\t\t\t\treturn String(value) === String(when.equals)\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * The reply options at their defaults.\n\t\t *\n\t\t * @return {object} Values by key.\n\t\t */\n\t\tinitialReplyValues() {\n\t\t\tconst list = Array.isArray(this.content?.replyOptions) ? this.content.replyOptions : []\n\t\t\treturn Object.fromEntries(list.filter((option) => option && option.key).map((option) => [option.key, option.default === true]))\n\t\t},\n\n\t\t/**\n\t\t * Put a picked template's text in the reply box.\n\t\t *\n\t\t * @param {object|null} option The template option.\n\t\t * @param {(text: string) => void} setDraft The thread's draft setter.\n\t\t * @return {void}\n\t\t */\n\t\tapplyTemplate(option, setDraft) {\n\t\t\tif (!option || !option.values) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst text = option.values[this.templates.textField || 'text']\n\t\t\tif (typeof text === 'string') {\n\t\t\t\tsetDraft(text)\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Run a message action: call its endpoint with the message's fields,\n\t\t * then read the messages again.\n\t\t *\n\t\t * @param {{action: string, message: string}} event Which action on which message.\n\t\t * @return {Promise<void>}\n\t\t * @spec openspec/changes/conversation-reply-tools/specs/conversation/spec.md#requirement-a-message-carries-its-status-and-actions\n\t\t */\n\t\tasync onMessageAction({ action: actionId, message: key }) {\n\t\t\tconst action = this.messageActions.find((entry) => entry.id === actionId)\n\t\t\tconst stored = this.rawMessages().find((entry) => entry.key === key)\n\t\t\tif (!action || !stored || this.acting) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.actionError = ''\n\t\t\tthis.acting = `${actionId}|${key}`\n\t\t\ttry {\n\t\t\t\tconst [{ default: axios }, { generateUrl }] = await Promise.all([import('@nextcloud/axios'), import('@nextcloud/router')])\n\t\t\t\tconst path = action.endpoint\n\t\t\t\t\t.replace(/@objectId/g, encodeURIComponent(String(this.objectId ?? '')))\n\t\t\t\t\t.replace(/\\{([\\w.]+)\\}/g, (_m, field) => encodeURIComponent(String(readPath(stored.message, field) ?? '')))\n\t\t\t\tconst response = await axios.request({ method: String(action.method || 'POST').toLowerCase(), url: generateUrl(path) })\n\t\t\t\tif (await this.followUp(action, response?.data)) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst refusal = this.actionRefusal(action, response?.data)\n\t\t\t\tif (refusal) {\n\t\t\t\t\tthis.actionError = refusal\n\t\t\t\t}\n\t\t\t\tawait this.loadSource()\n\t\t\t} catch (error) {\n\t\t\t\tif (await this.followUp(action, error?.response?.data)) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tthis.actionError = this.actionRefusal(action, error?.response?.data) || this.tr(action.errorText || 'The action failed.')\n\t\t\t} finally {\n\t\t\t\tthis.acting = ''\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Run the follow-up action a message action's answer asks for: the\n\t\t * status at `errors.path` (default `status`) looked up in `onStatus`,\n\t\t * dispatched like `headerAction`, tokens resolved against the record.\n\t\t *\n\t\t * @param {object} action The message action.\n\t\t * @param {object|undefined} answer The response body.\n\t\t * @return {Promise<boolean>} True when a follow-up ran.\n\t\t * @spec openspec/changes/conversation-reply-tools/specs/conversation/spec.md#requirement-a-conversation-shows-the-latest-thread-status-and-a-status-can-open-a-follow-up\n\t\t */\n\t\tasync followUp(action, answer) {\n\t\t\tconst map = action.onStatus\n\t\t\tif (!map || typeof map !== 'object' || !answer || typeof answer !== 'object') {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tconst status = readPath(answer, action.errors?.path || 'status')\n\t\t\tconst next = status === undefined || status === null ? null : map[String(status)]\n\t\t\tif (!next || typeof next !== 'object') {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tconst resolved = resolveDeepTokens(next, this.tokenCtx)\n\t\t\ttry {\n\t\t\t\tawait (typeof this.cnDispatchAction === 'function'\n\t\t\t\t\t? this.cnDispatchAction(resolved)\n\t\t\t\t\t: dispatchAction(resolved, { router: this.$router || null }))\n\t\t\t} catch {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn true\n\t\t},\n\n\t\t/**\n\t\t * The text a message action's answer names, by `errors` (`{ path, map,\n\t\t * ok? }`): the status at `path` mapped to a text. A status listed in `ok`\n\t\t * (default `[\"sent\", \"ok\"]`) is no refusal.\n\t\t *\n\t\t * @param {object} action The action.\n\t\t * @param {object|undefined} answer The response body.\n\t\t * @return {string} The text, '' for none.\n\t\t */\n\t\tactionRefusal(action, answer) {\n\t\t\tconst errors = action.errors\n\t\t\tif (!errors || typeof errors !== 'object' || !answer || typeof answer !== 'object') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst status = readPath(answer, errors.path || 'status')\n\t\t\tif (status === undefined || status === null || (errors.ok || ['sent', 'ok']).map(String).includes(String(status))) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst text = (errors.map || {})[String(status)] || errors.default\n\t\t\treturn text ? this.tr(text) : ''\n\t\t},\n\n\t\t/**\n\t\t * Who wrote a message: `usAuthorField` / `themAuthorField` for its\n\t\t * side, else `senderField` (`authorField`). A field written\n\t\t * `@object.<path>` reads the bound record (the case's requester on an\n\t\t * incoming message). With `usAuthorFormat` / `themAuthorFormat` set to\n\t\t * `user` the value is a user id, shown by its display name.\n\t\t *\n\t\t * @param {object} message The message.\n\t\t * @param {string} side `us` or `them`.\n\t\t * @return {string} The author, or '' when the message names none.\n\t\t * @spec openspec/changes/conversation-board-bubble/specs/conversation-source/spec.md#requirement-a-message-names-its-author-per-side-its-direction-and-a-note\n\t\t */\n\t\tauthorOf(message, side) {\n\t\t\tconst c = this.content || {}\n\t\t\tconst field = (side === 'us' ? c.usAuthorField : c.themAuthorField) || c.senderField || c.authorField || 'author'\n\t\t\tconst value = typeof field === 'string' && field.startsWith('@object.')\n\t\t\t\t? readPath(this.objectData || {}, field.slice('@object.'.length))\n\t\t\t\t: readPath(message, field)\n\t\t\tconst text = this.textOf(value)\n\t\t\tconst format = side === 'us' ? c.usAuthorFormat : c.themAuthorFormat\n\t\t\treturn format === 'user' && text !== '' ? (userDisplayName(text) || text) : text\n\t\t},\n\n\t\t/**\n\t\t * @param {unknown} value A stored value.\n\t\t * @return {string} It as text, or '' for none.\n\t\t */\n\t\ttextOf(value) {\n\t\t\treturn value === undefined || value === null || typeof value === 'object' ? '' : String(value)\n\t\t},\n\n\t\t/**\n\t\t * Translate through the app's translate.\n\t\t *\n\t\t * @param {string} key The source string.\n\t\t * @return {string}\n\t\t */\n\t\ttr(key) {\n\t\t\treturn key && typeof this.cnTranslate === 'function' ? this.cnTranslate(key) : (key || '')\n\t\t},\n\n\t\t/**\n\t\t * Read the messages from `source`. A filter whose token does not\n\t\t * resolve sends no request; a failed read leaves the thread empty.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t * @spec openspec/changes/conversation-source/specs/conversation-source/spec.md#requirement-a-conversation-reads-its-messages-from-a-list-and-maps-their-parts\n\t\t */\n\t\tasync loadSource() {\n\t\t\tif (!this.source) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst raw = this.source.filter || {}\n\t\t\tconst filter = resolveDeepTokens(raw, this.tokenCtx)\n\t\t\tconst emptied = Object.keys(raw).some((key) => typeof raw[key] === 'string' && raw[key].startsWith('@') && (filter[key] === '' || filter[key] === null || filter[key] === undefined))\n\t\t\tif (emptied || hasUnresolvedDeepTokens(filter)) {\n\t\t\t\tthis.listed = []\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.loading = true\n\t\t\ttry {\n\t\t\t\tthis.listed = await fetchReferenceObjects({ register: this.source.register, schema: this.source.schema, filter, limit: this.source.limit || 200 })\n\t\t\t\tthis.sentHere = []\n\t\t\t} catch {\n\t\t\t\tthis.listed = []\n\t\t\t} finally {\n\t\t\t\tthis.loading = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Run `replyAction` with the reply, when there is one; the endpoint\n\t\t * path is the thread's own.\n\t\t *\n\t\t * @param {string} text The reply.\n\t\t * @param {object} [extras] The reply option's state, `{ [key]: boolean }`.\n\t\t * @return {Promise<void>}\n\t\t * @spec openspec/changes/conversation-source/specs/conversation-source/spec.md#requirement-a-reply-can-run-an-app-action\n\t\t * @spec openspec/changes/conversation-reply-option/specs/conversation-source/spec.md#requirement-a-reply-can-carry-a-hint-and-an-option\n\t\t */\n\t\tasync onSend(text, extras = {}) {\n\t\t\tif (!this.replyAction) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst resolved = resolveDeepTokens(this.replyAction, this.tokenCtx)\n\t\t\tconst options = this.replyOptions.length > 0 ? { options: { ...this.replyValues } } : {}\n\t\t\tconst action = { ...resolved, args: [{ text, objectId: this.objectId, ...extras, ...options }], props: { ...(resolved.props || {}), text, ...extras, ...options } }\n\t\t\tconst result = typeof this.cnDispatchAction === 'function'\n\t\t\t\t? this.cnDispatchAction(action)\n\t\t\t\t: dispatchAction(action, { router: this.$router || null })\n\t\t\ttry {\n\t\t\t\tconst outcome = await result\n\t\t\t\tif (outcome === false) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (this.source) {\n\t\t\t\tawait this.loadSource()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.onSent({ text })\n\t\t},\n\n\t\t/**\n\t\t * Run `headerAction` with the record id, then read the source again.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync onHeaderAction() {\n\t\t\tif (!this.headerAction) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst { label, icon, ...rest } = resolveDeepTokens(this.headerAction, this.tokenCtx)\n\t\t\tconst action = { ...rest, args: [{ objectId: this.objectId }] }\n\t\t\ttry {\n\t\t\t\tconst outcome = await (typeof this.cnDispatchAction === 'function'\n\t\t\t\t\t? this.cnDispatchAction(action)\n\t\t\t\t\t: dispatchAction(action, { router: this.$router || null }))\n\t\t\t\tif (outcome === false) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tawait this.loadSource()\n\t\t},\n\n\t\t/**\n\t\t * Show an accepted reply at once, without waiting for the record.\n\t\t *\n\t\t * @param {object} data The endpoint's response.\n\t\t * @return {void}\n\t\t * @spec openspec/changes/detail-action-model-and-case-surfaces/specs/detail-action-model/spec.md#requirement-conversation-thread\n\t\t */\n\t\tonSent(data) {\n\t\t\tconst text = data?.message ?? data?.text\n\t\t\tif (typeof text !== 'string' || text === '') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (this.draftUrl) {\n\t\t\t\tthis.storeDraft('')\n\t\t\t}\n\t\t\tthis.sentHere.push({\n\t\t\t\tid: `sent-${this.sentHere.length}`,\n\t\t\t\ttime: new Date().toISOString(),\n\t\t\t\ttext,\n\t\t\t\tside: 'us',\n\t\t\t})\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-conversation-widget__badge {\n\tpadding: 2px 10px;\n\tborder-radius: var(--border-radius-pill);\n\tbackground: var(--color-background-dark);\n\tcolor: var(--color-main-text);\n\tfont-size: var(--font-size-small, 13px);\n}\n\n.cn-conversation-widget__error {\n\tcolor: var(--color-error-text, var(--color-error));\n\tmargin: calc(2 * var(--default-grid-baseline)) 0 0;\n}\n\n.cn-case-widget-card {\n\tbackground: var(--color-main-background);\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius-large);\n\tpadding: calc(5 * var(--default-grid-baseline));\n}\n\n.cn-conversation-widget__draft-status {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 13px;\n}\n</style>\n"],"names":["_openBlock","_createElementBlock","_createVNode","_withCtx","_Fragment","_renderList","_createBlock","_toDisplayString","_createTextVNode"],"mappings":";;AAWM,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,qBAAsB,GAAA;;;AAwC7B,EAAA,KAAK,EAAC,sCAAC;AACP,EAAA,IAAI,EAAC,QAAQ;AACb,EAAA,aAAW,EAAC,8BAA2B;;;;AAavC,EAAA,KAAK,EAAC,+BAAY;AAClB,EAAA,aAAW,EAAC,8BAA8B;;;;AAe5C,EAAA,KAAG,EAAA,+BAAA;;;;;;;;;;;;AAvEH,EAAA,QAAAA,SAAA,EAAA,EAAAC,kBAAA,QAAA;IACAC,WAoEgB,CAAA,+BAAA,EAAA;AAnEhB,MAAA,GAAG,EAAC,QAAQ;AACX,MAAA,QAAQ,EAAE,QAAQ,CAAA,QAAA;AAClB,MAAA,KAAK,EAAE,QAAA,CAAA,EAAE,CAAC,MAAA,CAAA,OAAO,CAAC,KAAK,IAAA,EAAA,CAAA;AACvB,MAAA,QAAQ,EAAE,QAAA,CAAA,EAAE,CAAC,MAAA,CAAA,OAAO,CAAC,QAAQ,IAAA,EAAA,CAAA;MAC7B,aAAa,EAAE,MAAO,CAAA,OAAA,CAAC,aAAa,KAAA,IAAA;MACpC,UAAU,EAAE,MAAO,CAAA,OAAA,CAAC,UAAI,KAAA,KAAA;MACxB,UAAU,EAAE,MAAO,CAAA,OAAA,CAAC,UAAU,GAAG,QAAE,CAAA,EAAA,CAAC,MAAO,CAAA,OAAA,CAAC,UAAU,CAAA,GAAI,SAAA;AAC1D,MAAA,WAAW,EAAE,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AAA,EAAA,eAAA,CAAA,CAAA,EAAA,CAAA,YAAA;;;;;;;;;AAGC,MAAA,CAAA,QAAA,CAAA,YAAA,IAAA,QAAA,CAAA,eAAA;;kBAAA,gBAAA;wBACN,MAIO;eAJC,QAAA,CAAA,eAAA;gCAARL,kBAIO,CAAA,MAAA,EAJP,UAIO,EAAAM,eAAA,CADH,QAAe,CAAA,eAAA,CAAA,EAAA,CAAA,YAAA;;eAGZ,QAAI,CAAA,YAAA;gCADTD,WAQQ,CAAA,mBAAA,EAAA;;AANT,oBAAA,aAAW,EAAC,+BAAe;AAC1B,oBAAA,OAAK,EAAE,QAAC,CAAA,cAAA;;qCAGE,MACX;AADW,sBAAAE,eAAA,CAAA,GACX,GAAGD,eAAA,CAAA,QAAA,CAAA,EAAE,CAAC,QAAA,CAAA,YAAY,CAAC,KAAK,CAAA,CAAA,EAAA,CAAA,YAAA;;;;AAHhB,oBAAA,CAAA,QAAA,CAAA,YAAA,CAAA,IAAA;;gCAAA,MAAA;sCACP,MAAkB;4BAAlBL,WAAkB,CAAA,iBAAA,EAAA;8BAAT,IAAI,EAAE,QAAG,CAAA,YAAA,CAAA,IAAA;AAAA,8BAAA,IAAA,EAAA,EAAA;;;;;;;;;;;;;KAMnB,KAAA,CAAA,WAAA;sBAAHD,wBAAA;;;;;;;"}
|
|
@@ -2,7 +2,7 @@ import script from './CnFilesBrowser.vue2.js';
|
|
|
2
2
|
import { render } from './CnFilesBrowser.vue3.js';
|
|
3
3
|
|
|
4
4
|
script.render = render;
|
|
5
|
-
script.__scopeId = "data-v-
|
|
5
|
+
script.__scopeId = "data-v-4990d6a1";
|
|
6
6
|
const __sfc_main = script;
|
|
7
7
|
|
|
8
8
|
export { __sfc_main as default };
|
|
@@ -583,6 +583,8 @@ var script = {
|
|
|
583
583
|
|
|
584
584
|
data() {
|
|
585
585
|
return {
|
|
586
|
+
/** The actions column's measured width while a row button stands in it, else null. */
|
|
587
|
+
actionsColumnWidth: null,
|
|
586
588
|
currentPath: this.rootPath,
|
|
587
589
|
/** The open folder as a node, or null before the first listing. */
|
|
588
590
|
folder: null,
|
|
@@ -642,6 +644,18 @@ var script = {
|
|
|
642
644
|
},
|
|
643
645
|
|
|
644
646
|
computed: {
|
|
647
|
+
/**
|
|
648
|
+
* The actions column's width. The table lays out fixed, so its columns
|
|
649
|
+
* take their widths from the head; a row button (Beoordelen) beside the
|
|
650
|
+
* row menu needs more than the menu's 48px, measured from the first row.
|
|
651
|
+
*
|
|
652
|
+
* @return {object} The head cell's style.
|
|
653
|
+
* @spec openspec/changes/files-actions-column-fits-row-button/specs/files-actions-column-fits-row-button/spec.md#requirement-the-actions-column-fits-a-row-button
|
|
654
|
+
*/
|
|
655
|
+
actionsColumnStyle() {
|
|
656
|
+
return this.actionsColumnWidth ? { width: this.actionsColumnWidth + 'px' } : {}
|
|
657
|
+
},
|
|
658
|
+
|
|
645
659
|
/**
|
|
646
660
|
* The `dropDetail` text: the string, or the text of the first variant
|
|
647
661
|
* `{ when, text }` whose `when` is `true` or that has none.
|
|
@@ -1096,6 +1110,10 @@ var script = {
|
|
|
1096
1110
|
}
|
|
1097
1111
|
},
|
|
1098
1112
|
|
|
1113
|
+
updated() {
|
|
1114
|
+
this.measureActionsColumn();
|
|
1115
|
+
},
|
|
1116
|
+
|
|
1099
1117
|
beforeUnmount() {
|
|
1100
1118
|
this.cnDetailSideColumn?.claim?.(this.$.uid, false);
|
|
1101
1119
|
for (const channel of FOLDER_CHANGED_CHANNELS) {
|
|
@@ -1105,6 +1123,34 @@ var script = {
|
|
|
1105
1123
|
},
|
|
1106
1124
|
|
|
1107
1125
|
methods: {
|
|
1126
|
+
/**
|
|
1127
|
+
* Measure the first row's actions cell (padding, the row button, the
|
|
1128
|
+
* gap and the menu) and keep it as the column's width, so a fixed
|
|
1129
|
+
* table does not push the button past its card. Without a row button
|
|
1130
|
+
* the column keeps its own width.
|
|
1131
|
+
*
|
|
1132
|
+
* @spec openspec/changes/files-actions-column-fits-row-button/specs/files-actions-column-fits-row-button/spec.md#requirement-the-actions-column-fits-a-row-button
|
|
1133
|
+
*/
|
|
1134
|
+
measureActionsColumn() {
|
|
1135
|
+
const cell = this.$el && this.$el.querySelector ? this.$el.querySelector('tbody .cn-files-browser__col-actions') : null;
|
|
1136
|
+
const button = cell ? cell.querySelector('.cn-files-browser__row-button') : null;
|
|
1137
|
+
if (!cell || !button) {
|
|
1138
|
+
if (this.actionsColumnWidth !== null) {
|
|
1139
|
+
this.actionsColumnWidth = null;
|
|
1140
|
+
}
|
|
1141
|
+
return
|
|
1142
|
+
}
|
|
1143
|
+
const style = window.getComputedStyle(cell);
|
|
1144
|
+
const content = [...cell.children].reduce((sum, child) => {
|
|
1145
|
+
const childStyle = window.getComputedStyle(child);
|
|
1146
|
+
return sum + child.offsetWidth + (parseFloat(childStyle.marginInlineStart) || 0) + (parseFloat(childStyle.marginInlineEnd) || 0)
|
|
1147
|
+
}, 0);
|
|
1148
|
+
const width = Math.ceil(content + (parseFloat(style.paddingInlineStart) || 0) + (parseFloat(style.paddingInlineEnd) || 0));
|
|
1149
|
+
if (width > 0 && width !== this.actionsColumnWidth) {
|
|
1150
|
+
this.actionsColumnWidth = width;
|
|
1151
|
+
}
|
|
1152
|
+
},
|
|
1153
|
+
|
|
1108
1154
|
t: translate,
|
|
1109
1155
|
|
|
1110
1156
|
preventMiddleClickAutoscroll,
|