@conduction/nextcloud-vue 2.174.0 → 2.176.1
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 +114 -11
- package/dist/esm/components/CnActionDialog/CnActionDialog.vue2.js.map +1 -1
- package/dist/esm/components/CnActionDialog/CnActionDialog.vue3.js +67 -17
- package/dist/esm/components/CnActionDialog/CnActionDialog.vue3.js.map +1 -1
- package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue.js +9 -0
- package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue.js.map +1 -0
- package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue2.js +352 -0
- package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue2.js.map +1 -0
- package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue3.js +266 -0
- package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue3.js.map +1 -0
- package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue.js +1 -1
- package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue2.js +323 -7
- package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue3.js +113 -59
- package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnChildRecordsField/CnChildRecordsField.vue.js +1 -1
- package/dist/esm/components/CnChildRecordsField/CnChildRecordsField.vue2.js +210 -5
- package/dist/esm/components/CnChildRecordsField/CnChildRecordsField.vue2.js.map +1 -1
- package/dist/esm/components/CnChildRecordsField/CnChildRecordsField.vue3.js +134 -46
- package/dist/esm/components/CnChildRecordsField/CnChildRecordsField.vue3.js.map +1 -1
- package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue.js +9 -0
- package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue.js.map +1 -0
- package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue2.js +385 -0
- package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue2.js.map +1 -0
- package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue3.js +277 -0
- package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue3.js.map +1 -0
- package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue.js +1 -1
- package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue2.js +175 -20
- package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue3.js +30 -8
- package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnCreateFormWidget/CnCreateFormWidget.vue.js +1 -1
- package/dist/esm/components/CnCreateFormWidget/CnCreateFormWidget.vue2.js +72 -6
- package/dist/esm/components/CnCreateFormWidget/CnCreateFormWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnCreateFormWidget/CnCreateFormWidget.vue3.js +48 -14
- package/dist/esm/components/CnCreateFormWidget/CnCreateFormWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue.js +1 -1
- package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue2.js +255 -10
- package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue2.js.map +1 -1
- package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue3.js +70 -28
- package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue3.js.map +1 -1
- package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js +55 -6
- package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js.map +1 -1
- package/dist/esm/components/CnDetailPage/CnDetailPage.vue3.js.map +1 -1
- package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue.js +9 -0
- package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue.js.map +1 -0
- package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue2.js +175 -0
- package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue2.js.map +1 -0
- package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue3.js +114 -0
- package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue3.js.map +1 -0
- package/dist/esm/components/CnDurationField/CnDurationField.vue.js +1 -1
- package/dist/esm/components/CnDurationField/CnDurationField.vue2.js +218 -4
- package/dist/esm/components/CnDurationField/CnDurationField.vue2.js.map +1 -1
- package/dist/esm/components/CnDurationField/CnDurationField.vue3.js +133 -44
- package/dist/esm/components/CnDurationField/CnDurationField.vue3.js.map +1 -1
- package/dist/esm/components/CnFormDialog/CnFormDialog.vue.js +1 -1
- package/dist/esm/components/CnFormDialog/CnFormDialog.vue2.js.map +1 -1
- package/dist/esm/components/CnFormDialog/CnFormDialog.vue3.js +5 -1
- package/dist/esm/components/CnFormDialog/CnFormDialog.vue3.js.map +1 -1
- package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue.js +9 -0
- package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue.js.map +1 -0
- package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue2.js +113 -0
- package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue2.js.map +1 -0
- package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue3.js +43 -0
- package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue3.js.map +1 -0
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js +40 -1
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js.map +1 -1
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js.map +1 -1
- package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue.js +1 -1
- package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue2.js +110 -1
- package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue2.js.map +1 -1
- package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue3.js +60 -18
- package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue3.js.map +1 -1
- package/dist/esm/components/CnMenuTreeNode/CnMenuTreeNode.vue2.js +2 -2
- package/dist/esm/components/CnMenuTreeNode/CnMenuTreeNode.vue2.js.map +1 -1
- package/dist/esm/components/CnObjectKanban/CnObjectKanban.vue2.js +2 -2
- package/dist/esm/components/CnObjectKanban/CnObjectKanban.vue2.js.map +1 -1
- package/dist/esm/components/CnPageTreeNode/CnPageTreeNode.vue2.js +2 -2
- package/dist/esm/components/CnPageTreeNode/CnPageTreeNode.vue2.js.map +1 -1
- package/dist/esm/components/CnQrCode/CnQrCode.vue.js +9 -0
- package/dist/esm/components/CnQrCode/CnQrCode.vue.js.map +1 -0
- package/dist/esm/components/CnQrCode/CnQrCode.vue2.js +241 -0
- package/dist/esm/components/CnQrCode/CnQrCode.vue2.js.map +1 -0
- package/dist/esm/components/CnQrCode/CnQrCode.vue3.js +75 -0
- package/dist/esm/components/CnQrCode/CnQrCode.vue3.js.map +1 -0
- package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue.js +1 -1
- package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue2.js +34 -3
- package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue2.js.map +1 -1
- package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue3.js +81 -19
- package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue3.js.map +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue.js +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js +11 -0
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js +112 -88
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnRevealField/CnRevealField.vue.js +9 -0
- package/dist/esm/components/CnRevealField/CnRevealField.vue.js.map +1 -0
- package/dist/esm/components/CnRevealField/CnRevealField.vue2.js +157 -0
- package/dist/esm/components/CnRevealField/CnRevealField.vue2.js.map +1 -0
- package/dist/esm/components/CnRevealField/CnRevealField.vue3.js +116 -0
- package/dist/esm/components/CnRevealField/CnRevealField.vue3.js.map +1 -0
- package/dist/esm/components/CnStorePage/CnStorePage.vue.js +1 -1
- package/dist/esm/components/CnStorePage/CnStorePage.vue2.js +3 -3
- package/dist/esm/components/CnStorePage/CnStorePage.vue2.js.map +1 -1
- package/dist/esm/components/CnStorePage/CnStorePage.vue3.js +5 -5
- package/dist/esm/components/CnStorePage/CnStorePage.vue3.js.map +1 -1
- package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue.js +1 -1
- package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue2.js +6 -6
- package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue2.js.map +1 -1
- package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue3.js +1 -1
- package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue3.js.map +1 -1
- package/dist/esm/components/CnTextWidget/CnTextWidget.vue.js +1 -1
- package/dist/esm/components/CnTextWidget/CnTextWidget.vue2.js +43 -3
- package/dist/esm/components/CnTextWidget/CnTextWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnTextWidget/CnTextWidget.vue3.js +19 -12
- package/dist/esm/components/CnTextWidget/CnTextWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnTransferCard/CnTransferCard.vue.js +9 -0
- package/dist/esm/components/CnTransferCard/CnTransferCard.vue.js.map +1 -0
- package/dist/esm/components/CnTransferCard/CnTransferCard.vue2.js +87 -0
- package/dist/esm/components/CnTransferCard/CnTransferCard.vue2.js.map +1 -0
- package/dist/esm/components/CnTransferCard/CnTransferCard.vue3.js +126 -0
- package/dist/esm/components/CnTransferCard/CnTransferCard.vue3.js.map +1 -0
- package/dist/esm/components/CnTreeView/CnTreeNode.vue.js +1 -1
- package/dist/esm/components/CnTreeView/CnTreeNode.vue2.js +66 -1
- package/dist/esm/components/CnTreeView/CnTreeNode.vue2.js.map +1 -1
- package/dist/esm/components/CnTreeView/CnTreeNode.vue3.js +129 -29
- package/dist/esm/components/CnTreeView/CnTreeNode.vue3.js.map +1 -1
- package/dist/esm/components/CnTreeView/CnTreeView.vue.js +1 -1
- package/dist/esm/components/CnTreeView/CnTreeView.vue2.js +158 -6
- package/dist/esm/components/CnTreeView/CnTreeView.vue2.js.map +1 -1
- package/dist/esm/components/CnTreeView/CnTreeView.vue3.js +100 -39
- package/dist/esm/components/CnTreeView/CnTreeView.vue3.js.map +1 -1
- package/dist/esm/index.js +8 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/l10n/en.json.js +79 -14
- package/dist/esm/l10n/en.json.js.map +1 -1
- package/dist/esm/l10n/nl.json.js +79 -14
- package/dist/esm/l10n/nl.json.js.map +1 -1
- package/dist/esm/library-style.js +1 -1
- package/dist/esm/nextcloud-vue.css +1162 -523
- package/dist/esm/node_modules/vuedraggable/dist/vuedraggable.umd.js +2 -2
- package/dist/esm/utils/captureLocation.js +32 -0
- package/dist/esm/utils/captureLocation.js.map +1 -0
- package/dist/esm/utils/childRecordTotals.js +157 -0
- package/dist/esm/utils/childRecordTotals.js.map +1 -0
- package/dist/esm/utils/isoDuration.js +51 -1
- package/dist/esm/utils/isoDuration.js.map +1 -1
- package/dist/esm/utils/parentCrumb.js +86 -0
- package/dist/esm/utils/parentCrumb.js.map +1 -0
- package/dist/esm/utils/qr.js +649 -0
- package/dist/esm/utils/qr.js.map +1 -0
- package/dist/esm/utils/schema.js +3 -0
- package/dist/esm/utils/schema.js.map +1 -1
- package/dist/esm/utils/templateVariables.js +54 -0
- package/dist/esm/utils/templateVariables.js.map +1 -0
- package/dist/nextcloud-vue.cjs.js +21125 -15025
- package/dist/nextcloud-vue.cjs.js.map +2 -2
- package/dist/nextcloud-vue.css +1162 -523
- package/l10n/en.json +79 -14
- package/l10n/nl.json +79 -14
- package/package.json +1 -1
- package/src/components/CnActionDialog/CnActionDialog.vue +156 -9
- package/src/components/CnBlockListEditor/CnBlockListEditor.vue +615 -0
- package/src/components/CnBlockListEditor/index.js +9 -0
- package/src/components/CnChecklistRunWidget/CnChecklistRunWidget.vue +377 -10
- package/src/components/CnChildRecordsField/CnChildRecordsField.vue +306 -15
- package/src/components/CnChoiceMatrix/CnChoiceMatrix.vue +710 -0
- package/src/components/CnChoiceMatrix/index.js +9 -0
- package/src/components/CnCountdownWidget/CnCountdownWidget.vue +223 -28
- package/src/components/CnCreateFormWidget/CnCreateFormWidget.vue +97 -6
- package/src/components/CnDataMatrix/CnDataMatrix.vue +304 -17
- package/src/components/CnDetailPage/CnDetailPage.vue +55 -6
- package/src/components/CnDisplayScreen/CnDisplayScreen.vue +308 -0
- package/src/components/CnDisplayScreen/index.js +9 -0
- package/src/components/CnDurationField/CnDurationField.vue +330 -5
- package/src/components/CnFormDialog/CnFormDialog.vue +4 -0
- package/src/components/CnGeoCaptureField/CnGeoCaptureField.vue +148 -0
- package/src/components/CnGeoCaptureField/index.js +9 -0
- package/src/components/CnIndexPage/CnIndexPage.vue +40 -1
- package/src/components/CnMarkdownEditor/CnMarkdownEditor.vue +139 -1
- package/src/components/CnQrCode/CnQrCode.vue +321 -0
- package/src/components/CnQrCode/index.js +9 -0
- package/src/components/CnReadinessChecklist/CnReadinessChecklist.vue +80 -3
- package/src/components/CnRecordListWidget/CnRecordListWidget.vue +34 -1
- package/src/components/CnRevealField/CnRevealField.vue +273 -0
- package/src/components/CnRevealField/index.js +9 -0
- package/src/components/CnStorePage/CnStorePage.vue +8 -8
- package/src/components/CnStorePage/CnStorePublishDialog.vue +7 -7
- package/src/components/CnTextWidget/CnTextWidget.vue +62 -3
- package/src/components/CnTransferCard/CnTransferCard.vue +205 -0
- package/src/components/CnTransferCard/index.js +9 -0
- package/src/components/CnTreeView/CnTreeNode.vue +145 -2
- package/src/components/CnTreeView/CnTreeView.vue +210 -6
- package/src/components/index.js +7 -0
- package/src/index.js +8 -0
- package/src/utils/captureLocation.js +29 -0
- package/src/utils/childRecordTotals.js +153 -0
- package/src/utils/isoDuration.js +50 -0
- package/src/utils/parentCrumb.js +83 -0
- package/src/utils/qr.js +681 -0
- package/src/utils/schema.js +3 -0
- package/src/utils/templateVariables.js +51 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CnCountdownWidget.vue2.js","sources":["../../../../src/components/CnCountdownWidget/CnCountdownWidget.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<div\n\t\tclass=\"cn-kpi-card cn-countdown-widget\"\n\t\t:class=\"[`cn-countdown-widget--${variant}`, { 'cn-kpi-card--board cn-countdown-widget--board': isBoardLook }]\">\n\t\t<div v-if=\"!isBoardLook\" class=\"cn-kpi-card__icon cn-countdown-widget__icon\" :style=\"iconCircleStyle\">\n\t\t\t<CnWidgetIcon :name=\"resolvedIcon\" :size=\"24\" />\n\t\t</div>\n\n\t\t<div class=\"cn-kpi-card__body\">\n\t\t\t<div v-if=\"resolvedLabel\" class=\"cn-kpi-card__title\">\n\t\t\t\t{{ resolvedLabel }}\n\t\t\t</div>\n\t\t\t<div class=\"cn-kpi-card__value cn-countdown-widget__value\" :style=\"{ color: valueColor }\">\n\t\t\t\t{{ headline }}\n\t\t\t</div>\n\t\t\t<div v-if=\"subLabel\" class=\"cn-countdown-widget__sub\" data-testid=\"cn-countdown-sub\">\n\t\t\t\t{{ subLabel }}\n\t\t\t</div>\n\t\t\t<dl v-if=\"facts.length\" class=\"cn-countdown-widget__facts\" data-testid=\"cn-countdown-facts\">\n\t\t\t\t<template v-for=\"fact in facts\" :key=\"fact.label\">\n\t\t\t\t\t<dt>{{ fact.label }}</dt>\n\t\t\t\t\t<dd>{{ fact.value }}</dd>\n\t\t\t\t</template>\n\t\t\t</dl>\n\t\t\t<span\n\t\t\t\tv-if=\"progress !== null\"\n\t\t\t\tclass=\"cn-countdown-widget__progress\"\n\t\t\t\trole=\"meter\"\n\t\t\t\t:aria-label=\"progressLabel\"\n\t\t\t\t:aria-valuenow=\"Math.round(progress)\"\n\t\t\t\taria-valuemin=\"0\"\n\t\t\t\taria-valuemax=\"100\"\n\t\t\t\tdata-testid=\"cn-countdown-progress\">\n\t\t\t\t<span class=\"cn-countdown-widget__progress-fill\" :style=\"{ width: `${progress}%` }\" />\n\t\t\t</span>\n\t\t\t<button\n\t\t\t\tv-if=\"actionLabel\"\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"cn-countdown-widget__action\"\n\t\t\t\t:class=\"{ 'cn-countdown-widget__action--primary': content.action && content.action.variant === 'primary' }\"\n\t\t\t\tdata-testid=\"cn-countdown-action\"\n\t\t\t\t@click=\"runAction\">\n\t\t\t\t{{ actionLabel }}\n\t\t\t</button>\n\t\t</div>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { inject } from 'vue'\nimport CnWidgetIcon from '../CnWidgetGrid/CnWidgetIcon.vue'\nimport { getByPath } from '../../composables/useEndpointSource.js'\nimport { normalizeLook } from '../../composables/useLook.js'\nimport { dispatchAction } from '../../utils/actionsDispatcher.js'\nimport { resolveObjectTokenContext } from '../../utils/detailObjectContext.js'\nimport { resolveDeepTokens } from '../../utils/resolveFilterTokens.js'\nimport { userLocale } from '../../utils/userLocale.js'\n\nconst MS_PER_DAY = 24 * 60 * 60 * 1000\n\nconst VARIANT_COLORS = Object.freeze({\n\tdefault: 'var(--color-primary-element)',\n\tsuccess: 'var(--color-success)',\n\twarning: 'var(--color-warning)',\n\terror: 'var(--color-error)',\n})\n\n/**\n * CnCountdownWidget — a KPI tile for how long is left until a date on the\n * bound record.\n *\n * Every other tile in the catalog answers \"how many\" by aggregating or calling\n * an endpoint. This one answers \"how long\", and it needs neither: the record is\n * already loaded by the detail page, so the tile reads the date straight off it\n * and does the arithmetic. No request, and nothing to go stale.\n *\n * It headlines the remaining time and carries the date itself underneath,\n * because \"12 days left\" and \"5 October\" answer different questions and a\n * handler asks both.\n *\n * ## Thresholds\n *\n * `thresholds` recolours the tile as the date approaches, in days:\n *\n * ```js\n * content: {\n * label: 'Time left',\n * field: 'deadline',\n * icon: 'ClockAlertOutline',\n * thresholds: { warn: 14, danger: 5 },\n * }\n * ```\n *\n * A date in the past reads \"overdue by N days\" in the error colour, never a\n * negative number: \"-3 days left\" is a puzzle, and an overdue case is the one\n * state a handler must not have to decode.\n *\n * ## A settled record\n *\n * `settledField` names a property on the record that is truthy once the work\n * the date belongs to is done, such as a case in its final status. A settled\n * record reads `settledLabel` (default \"Closed\") in no threshold colour, never\n * \"overdue\": a closed case missed nothing that can still be acted on, and a red\n * count of days on it sends a handler after a case that needs nobody.\n *\n * ```js\n * content: { field: 'deadline', settledField: 'isFinalStatus', settledLabel: 'Handled' }\n * ```\n *\n * ## An unset date\n *\n * Renders a dash and no threshold colour. A case with no deadline is not urgent\n * and is not on time; it simply has no deadline, and colouring it green would\n * claim otherwise.\n */\nexport default {\n\tname: 'CnCountdownWidget',\n\n\tcomponents: {\n\t\tCnWidgetIcon,\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * The tile's config.\n\t\t *\n\t\t * - `field` — property on the bound record holding the target date.\n\t\t * - `label` — the tile's title.\n\t\t * - `icon` — MDI icon name.\n\t\t * - `thresholds` — `{ warn, danger }` in days remaining.\n\t\t * - `showDate` — render the absolute date underneath (default true).\n\t\t * - `settledField` — property on the record that is truthy once the work is done; the tile then reads `settledLabel` and never counts overdue.\n\t\t * - `settledLabel` — the headline of a settled record, run through the host's translate function (default \"Closed\").\n\t\t * - `daysLabel` — `{ one, other }` with `{count}`, the headline while days remain (\"27 dagen\").\n\t\t * - `caption` — the line under the headline instead of the date, with `{date}` (the long date) and `{count}` (days left).\n\t\t * - `startField` — property holding the start of the term; a bar then shows how much of it has passed.\n\t\t * - `action` — one manifest action under the card (`{ label, type, variant?, ... }`, the headerActions shape; `variant: \"primary\"` draws it in the primary tint).\n\t\t * - `emptyLabel` — the headline while the date is unset (default a dash).\n\t\t * - `emptyCaption` — the line under it while the date is unset, with `{date}` read from `emptyDateField`.\n\t\t * - `facts` — `[{ label, field }]` rows under the caption.\n\t\t *\n\t\t * @type {{ field?: string, label?: string, icon?: string, thresholds?: {warn?: number, danger?: number}, showDate?: boolean, settledField?: string, settledLabel?: string, daysLabel?: {one?: string, other?: string}, caption?: string, startField?: string, action?: object, emptyLabel?: string, emptyCaption?: string, emptyDateField?: string, facts?: Array<{label: string, field: string}> }}\n\t\t */\n\t\tcontent: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/**\n\t\t * The bound record, when the surface passes it explicitly. Falls back to\n\t\t * the injected `cnObjectContext` a detail page provides.\n\t\t *\n\t\t * @type {object|null}\n\t\t */\n\t\tobjectData: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\t},\n\n\tsetup() {\n\t\treturn {\n\t\t\tcnObjectContextInjected: inject('cnObjectContext', null),\n\t\t\tcnDetailObjectContextInjected: inject('cnDetailObjectContext', null),\n\t\t\tcnTranslate: inject('cnTranslate', null),\n\t\t\tcnLook: inject('cnLook', 'nextcloud'),\n\t\t\tcnDispatchAction: inject('cnDispatchAction', null),\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * The record to read the date from.\n\t\t *\n\t\t * @return {object|null} The bound record, or null.\n\t\t */\n\t\trecord() {\n\t\t\tif (this.objectData) {\n\t\t\t\treturn this.objectData\n\t\t\t}\n\t\t\tconst ctx = resolveObjectTokenContext(this.cnObjectContextInjected, this.cnDetailObjectContextInjected)\n\t\t\treturn ctx?.object || null\n\t\t},\n\n\t\t/**\n\t\t * The target date, or null when unset or unparseable.\n\t\t *\n\t\t * @return {Date|null} The parsed date.\n\t\t */\n\t\ttargetDate() {\n\t\t\tconst field = this.content?.field\n\t\t\tif (!this.record || !field) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst raw = getByPath(this.record, field)\n\t\t\tif (raw === null || raw === undefined || raw === '') {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst parsed = new Date(raw)\n\t\t\treturn Number.isNaN(parsed.getTime()) ? null : parsed\n\t\t},\n\n\t\t/**\n\t\t * Whole days from today until the target. Negative once it has passed.\n\t\t *\n\t\t * Both ends are floored to midnight first, so \"tomorrow\" is 1 day away\n\t\t * all day today rather than flipping to 0 at lunchtime.\n\t\t *\n\t\t * @return {number|null} Days remaining, or null.\n\t\t */\n\t\tdaysRemaining() {\n\t\t\tif (!this.targetDate) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst startOfDay = (d) => Date.UTC(d.getFullYear(), d.getMonth(), d.getDate())\n\t\t\treturn Math.round((startOfDay(this.targetDate) - startOfDay(new Date())) / MS_PER_DAY)\n\t\t},\n\n\t\t/**\n\t\t * Whether the record says its work is done (`settledField` is truthy).\n\t\t *\n\t\t * @return {boolean} True for a settled record.\n\t\t * @spec openspec/changes/countdown-settled-record/specs/countdown-settled-record/spec.md#requirement-a-settled-record-never-reads-as-overdue\n\t\t */\n\t\tisSettled() {\n\t\t\tconst field = this.content?.settledField\n\t\t\tif (!this.record || !field) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn Boolean(getByPath(this.record, field))\n\t\t},\n\n\t\t/**\n\t\t * Whether the date has passed on a record still open.\n\t\t *\n\t\t * @return {boolean} True when overdue.\n\t\t * @spec openspec/changes/countdown-settled-record/specs/countdown-settled-record/spec.md#requirement-a-settled-record-never-reads-as-overdue\n\t\t */\n\t\tisOverdue() {\n\t\t\treturn !this.isSettled && this.daysRemaining !== null && this.daysRemaining < 0\n\t\t},\n\n\t\t/**\n\t\t * The headline: the remaining time in words.\n\t\t *\n\t\t * @return {string} The headline text.\n\t\t * @spec openspec/changes/countdown-settled-record/specs/countdown-settled-record/spec.md#requirement-a-settled-record-never-reads-as-overdue\n\t\t */\n\t\theadline() {\n\t\t\tif (this.isSettled) {\n\t\t\t\tconst label = this.content?.settledLabel\n\t\t\t\tif (label) {\n\t\t\t\t\treturn typeof this.cnTranslate === 'function' ? this.cnTranslate(label) : label\n\t\t\t\t}\n\t\t\t\treturn t('nextcloud-vue', 'Closed')\n\t\t\t}\n\t\t\tconst days = this.daysRemaining\n\t\t\tif (days === null) {\n\t\t\t\treturn this.content?.emptyLabel ? this.translate(this.content.emptyLabel) : '—'\n\t\t\t}\n\t\t\tif (days < 0) {\n\t\t\t\tconst overdue = Math.abs(days)\n\t\t\t\treturn overdue === 1\n\t\t\t\t\t? t('nextcloud-vue', '1 day overdue')\n\t\t\t\t\t: t('nextcloud-vue', '{count} days overdue', { count: overdue })\n\t\t\t}\n\t\t\tif (days === 0) {\n\t\t\t\treturn t('nextcloud-vue', 'Due today')\n\t\t\t}\n\t\t\tconst labels = this.content?.daysLabel\n\t\t\tif (labels && typeof labels === 'object' && (labels.one || labels.other)) {\n\t\t\t\tconst template = this.translate((days === 1 ? labels.one : labels.other) || labels.other || labels.one)\n\t\t\t\treturn template.replace(/\\{count\\}/g, String(days))\n\t\t\t}\n\t\t\tif (days === 1) {\n\t\t\t\treturn t('nextcloud-vue', '1 day left')\n\t\t\t}\n\t\t\treturn t('nextcloud-vue', '{count} days left', { count: days })\n\t\t},\n\n\t\t/**\n\t\t * Whether the app takes the board look: no icon circle.\n\t\t *\n\t\t * @return {boolean} True in the board look.\n\t\t * @spec openspec/changes/countdown-board-look/specs/countdown-board-look/spec.md#requirement-the-countdown-draws-the-boards-term-card\n\t\t */\n\t\tisBoardLook() {\n\t\t\treturn normalizeLook(this.cnLook) === 'board'\n\t\t},\n\n\t\t/**\n\t\t * How much of the term has passed, from `startField` to the date, in\n\t\t * whole days and as a percentage (0 to 100), or null without a usable\n\t\t * start.\n\t\t *\n\t\t * @return {number|null} The share passed.\n\t\t * @spec openspec/changes/countdown-board-look/specs/countdown-board-look/spec.md#requirement-the-countdown-draws-the-boards-term-card\n\t\t */\n\t\tprogress() {\n\t\t\tconst field = this.content?.startField\n\t\t\tif (!field || !this.record || !this.targetDate || this.isSettled) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst raw = getByPath(this.record, field)\n\t\t\tconst start = raw === null || raw === undefined || raw === '' ? null : new Date(raw)\n\t\t\tif (!start || Number.isNaN(start.getTime())) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst startOfDay = (d) => Date.UTC(d.getFullYear(), d.getMonth(), d.getDate())\n\t\t\tconst span = startOfDay(this.targetDate) - startOfDay(start)\n\t\t\tif (span <= 0) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\treturn Math.min(100, Math.max(0, ((startOfDay(new Date()) - startOfDay(start)) / span) * 100))\n\t\t},\n\n\t\t/**\n\t\t * The `facts` rows under the caption (`[{ label, field }]`), with\n\t\t * their values read off the record; a row without a value is left out.\n\t\t *\n\t\t * @return {Array<{label: string, value: string}>} The rows.\n\t\t * @spec openspec/changes/countdown-board-look/specs/countdown-board-look/spec.md#requirement-the-countdown-draws-the-boards-term-card\n\t\t */\n\t\tfacts() {\n\t\t\tconst rows = Array.isArray(this.content?.facts) ? this.content.facts : []\n\t\t\treturn rows\n\t\t\t\t.filter((row) => row && typeof row.label === 'string' && typeof row.field === 'string')\n\t\t\t\t.map((row) => {\n\t\t\t\t\tconst value = this.record ? getByPath(this.record, row.field) : null\n\t\t\t\t\treturn { label: this.translate(row.label), value: value === null || value === undefined ? '' : this.translate(String(value)) }\n\t\t\t\t})\n\t\t\t\t.filter((row) => row.value !== '')\n\t\t},\n\n\t\t/** @return {string} The accessible name of the progress bar. */\n\t\tprogressLabel() {\n\t\t\treturn t('nextcloud-vue', 'Time passed')\n\t\t},\n\n\t\t/**\n\t\t * The label of `content.action`, translated, or ''.\n\t\t *\n\t\t * @return {string} The label.\n\t\t * @spec openspec/changes/countdown-board-look/specs/countdown-board-look/spec.md#requirement-the-countdown-draws-the-boards-term-card\n\t\t */\n\t\tactionLabel() {\n\t\t\tconst action = this.content?.action\n\t\t\treturn action && typeof action === 'object' && typeof action.label === 'string' && action.label !== ''\n\t\t\t\t? this.translate(action.label)\n\t\t\t\t: ''\n\t\t},\n\n\t\t/**\n\t\t * The absolute date under the headline, so the tile answers \"how long\"\n\t\t * and \"when\" at once.\n\t\t *\n\t\t * @return {string} The formatted date, or ''.\n\t\t */\n\t\tsubLabel() {\n\t\t\tif (!this.targetDate && typeof this.content?.emptyCaption === 'string' && this.content.emptyCaption !== '') {\n\t\t\t\tconst raw = this.content.emptyDateField && this.record ? getByPath(this.record, this.content.emptyDateField) : null\n\t\t\t\tconst when = raw ? new Date(raw) : null\n\t\t\t\tconst date = when && !Number.isNaN(when.getTime()) ? when.toLocaleDateString(userLocale(), { day: 'numeric', month: 'long', year: 'numeric' }) : ''\n\t\t\t\treturn this.translate(this.content.emptyCaption).replace(/\\{date\\}/g, date)\n\t\t\t}\n\t\t\tif (!this.targetDate || this.content?.showDate === false) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst date = this.targetDate.toLocaleDateString(userLocale(), { day: 'numeric', month: 'long', year: 'numeric' })\n\t\t\tconst caption = this.content?.caption\n\t\t\tif (typeof caption === 'string' && caption !== '') {\n\t\t\t\treturn this.translate(caption).replace(/\\{date\\}/g, date).replace(/\\{count\\}/g, String(this.daysRemaining ?? ''))\n\t\t\t}\n\t\t\treturn date\n\t\t},\n\n\t\t/**\n\t\t * The threshold band this date falls in.\n\t\t *\n\t\t * @return {string} One of default / success / warning / error.\n\t\t * @spec openspec/changes/countdown-settled-record/specs/countdown-settled-record/spec.md#requirement-a-settled-record-never-reads-as-overdue\n\t\t */\n\t\tvariant() {\n\t\t\tconst days = this.daysRemaining\n\t\t\tif (days === null || this.isSettled) {\n\t\t\t\treturn 'default'\n\t\t\t}\n\t\t\tif (days < 0) {\n\t\t\t\treturn 'error'\n\t\t\t}\n\t\t\tconst thresholds = this.content?.thresholds || {}\n\t\t\tif (Number.isFinite(thresholds.danger) && days <= thresholds.danger) {\n\t\t\t\treturn 'error'\n\t\t\t}\n\t\t\tif (Number.isFinite(thresholds.warn) && days <= thresholds.warn) {\n\t\t\t\treturn 'warning'\n\t\t\t}\n\t\t\treturn 'default'\n\t\t},\n\n\t\t/** @return {string} The value colour for the current band. */\n\t\tvalueColor() {\n\t\t\tif (this.isBoardLook && this.variant === 'default') {\n\t\t\t\treturn 'var(--color-main-text)'\n\t\t\t}\n\t\t\treturn VARIANT_COLORS[this.variant] || VARIANT_COLORS.default\n\t\t},\n\n\t\t/** @return {string} The tile label. */\n\t\tresolvedLabel() {\n\t\t\treturn this.content?.label || ''\n\t\t},\n\n\t\t/** @return {string} The MDI icon name. */\n\t\tresolvedIcon() {\n\t\t\treturn this.content?.icon || 'ClockOutline'\n\t\t},\n\n\t\t/** @return {object} Inline style for the icon circle. */\n\t\ticonCircleStyle() {\n\t\t\treturn { color: this.valueColor }\n\t\t},\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * The host's translate, or the text unchanged.\n\t\t *\n\t\t * @param {string} text The text.\n\t\t * @return {string} The translation.\n\t\t */\n\t\ttranslate(text) {\n\t\t\treturn typeof this.cnTranslate === 'function' ? this.cnTranslate(text) : text\n\t\t},\n\n\t\t/**\n\t\t * Dispatch `content.action` with the record's tokens resolved, through\n\t\t * the page's dispatcher when there is one.\n\t\t *\n\t\t * @return {unknown}\n\t\t * @spec openspec/changes/countdown-board-look/specs/countdown-board-look/spec.md#requirement-the-countdown-draws-the-boards-term-card\n\t\t */\n\t\trunAction() {\n\t\t\tconst action = this.content?.action\n\t\t\tif (!action || typeof action !== 'object') {\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\tconst ctx = resolveObjectTokenContext(this.cnObjectContextInjected, this.cnDetailObjectContextInjected) || {}\n\t\t\tconst tokenCtx = { ...ctx, object: this.record || ctx.object || null, objectId: this.record?.id ?? ctx.objectId ?? null }\n\t\t\tconst resolved = resolveDeepTokens(action, tokenCtx)\n\t\t\tif (typeof this.cnDispatchAction === 'function') {\n\t\t\t\treturn this.cnDispatchAction(resolved)\n\t\t\t}\n\t\t\treturn dispatchAction(resolved, { router: this.$router || null, tokenCtx })\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-countdown-widget__value {\n\twhite-space: nowrap;\n}\n\n/* The bar spans the card: the KPI body aligns its items to the start, which\n left the empty track 0px wide. */\n.cn-countdown-widget__progress {\n\talign-self: stretch;\n\tbackground: var(--color-border);\n\tborder-radius: 3px;\n\tdisplay: block;\n\theight: 6px;\n\tmargin-block-start: 10px;\n\toverflow: hidden;\n}\n\n.cn-countdown-widget__progress-fill {\n\tbackground: var(--color-primary-element);\n\tdisplay: block;\n\theight: 100%;\n}\n\n.cn-countdown-widget__action {\n\talign-self: flex-start;\n\tbackground: var(--color-background-dark);\n\tborder: 0;\n\tborder-radius: var(--border-radius-pill, 17px);\n\tcolor: var(--color-main-text);\n\tfont-weight: 600;\n\tmargin-block-start: 10px;\n\tmin-height: 34px;\n\tpadding: 0 12px;\n}\n\n/* The board draws the term card's action as a 34px chip with 13px text and\n a 17px radius (DqZaak \"Termijn opschorten\"); Nextcloud's pill radius is\n 100px and its text 15px. */\n.cn-countdown-widget--board .cn-countdown-widget__action {\n\tborder-radius: 17px;\n\tfont-size: 13px;\n}\n\n/* The board stacks the term card 10px apart: the days, the date line, the\n bar and the action (DqZaak \"Termijn\": r33 live 2 / 11.9 / 5 against 10,\n card 182.7 against 188). */\n.cn-countdown-widget--board .cn-kpi-card__body {\n\tgap: 10px;\n}\n\n.cn-countdown-widget--board .cn-countdown-widget__progress.cn-countdown-widget__progress,\n.cn-countdown-widget--board .cn-countdown-widget__action.cn-countdown-widget__action {\n\tmargin: 0;\n}\n\n.cn-countdown-widget__action--primary {\n\tbackground: var(--color-primary-element-light);\n\tcolor: var(--color-primary-element-light-text);\n}\n\n.cn-countdown-widget__facts {\n\tdisplay: grid;\n\tgap: 8px 16px;\n\tgrid-template-columns: max-content 1fr;\n\tmargin: 10px 0 0;\n}\n\n.cn-countdown-widget__facts dt {\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-countdown-widget__facts dd {\n\tmargin: 0;\n}\n\n.cn-countdown-widget__action:hover,\n.cn-countdown-widget__action:focus-visible {\n\tbackground: var(--color-background-hover);\n}\n\n.cn-countdown-widget__sub {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 0.85em;\n}\n</style>\n"],"names":["CnWidgetIcon","t"],"mappings":";;;;;;;;;;AAgEA,MAAM,aAAa,EAAG,GAAE,EAAC,GAAI,EAAG,GAAE,KAAG;;AAErC,MAAM,cAAa,GAAI,MAAM,CAAC,MAAM,CAAC;AACpC,CAAA,OAAO,EAAE,8BAA8B;AACvC,CAAA,OAAO,EAAE,sBAAsB;AAC/B,CAAA,OAAO,EAAE,sBAAsB;CAC/B,KAAK,EAAE,oBAAoB;AAC5B,CAAC,EAAA;;AAED;;;AAGC;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAED,aAAe;CACd,IAAI,EAAE,mBAAmB;;CAEzB,UAAU,EAAE;gBACXA,UAAY;EACZ;;AAED,CAAA,KAAK,EAAE;AACN;AACC;AACA;;;AAGA;AACA;;;;AAIA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAED,EAAA,OAAO,EAAE;GACR,IAAI,EAAE,MAAM;AACZ,GAAA,OAAO,EAAE,OAAO,EAAE,CAAC;GACnB;;AAED;;;AAGC;AACA;;EAED,UAAU,EAAE;GACX,IAAI,EAAE,MAAM;GACZ,OAAO,EAAE,IAAI;GACb;EACD;;AAED,CAAA,KAAK,GAAG;AACP,EAAA,OAAO;GACN,uBAAuB,EAAE,MA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AAC,IAAI,EAAE;AACf,GAAA,OAAO,OAAO,IAAI,CAAC,WAAY,KAAI,UAAW,GAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAA,GAAI,IAAG;GAC5E;;AAED;;AAEC;AACA;AACA;AACA;;EAED,SAAS,GAAG;AACX,GAAA,MAAM,MAAK,GAAI,IAAI,CAAC,OAAO,EAAE,OAAK;AAClC,GAAA,IAAI,CAAC,MAAK,IAAK,OAAO,MAAK,KAAM,QAAQ,EAAE;AAC1C,IAAA,OAAO,SAAQ;AAChB,IAAA;GACA,MAAM,GAAE,GAAI,yBAAyB,CAAC,IAAI,CAAC,uBAAuB,EAAE,IAAI,CAAC,6BAA6B,CAAA,IAAK,GAAC;GAC5G,MAAM,WAAW,EAAE,GAAG,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,MAAO,IAAG,GAAG,CAAC,UAAU,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE,EAAC,IAAK,GAAG,CAAC,QAAO,IAAK,IAAK,GAAA;GACxH,MAAM,QAAS,GAAE,iBAAiB,CAAC,MAAM,EAAE,QAAQ,EAAA;AACnD,GAAA,IAAI,OAAO,IAAI,CAAC,gBAAe,KAAM,UAAU,EAAE;AAChD,IAAA,OAAO,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAA;AACtC,IAAA;AACA,GAAA,OAAO,cAAc,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,OAAM,IAAK,IAAI,EAAE,UAAU,CAAA;GAC1E;EACD;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"CnCountdownWidget.vue2.js","sources":["../../../../src/components/CnCountdownWidget/CnCountdownWidget.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<div\n\t\tclass=\"cn-kpi-card cn-countdown-widget\"\n\t\t:class=\"[`cn-countdown-widget--${variant}`, { 'cn-kpi-card--board cn-countdown-widget--board': isBoardLook }]\">\n\t\t<div v-if=\"!isBoardLook\" class=\"cn-kpi-card__icon cn-countdown-widget__icon\" :style=\"iconCircleStyle\">\n\t\t\t<CnWidgetIcon :name=\"resolvedIcon\" :size=\"24\" />\n\t\t</div>\n\n\t\t<div class=\"cn-kpi-card__body\">\n\t\t\t<div v-if=\"resolvedLabel\" class=\"cn-kpi-card__title\">\n\t\t\t\t{{ resolvedLabel }}\n\t\t\t</div>\n\t\t\t<div class=\"cn-kpi-card__value cn-countdown-widget__value\" :style=\"{ color: valueColor }\">\n\t\t\t\t{{ headline }}\n\t\t\t</div>\n\t\t\t<div v-if=\"subLabel\" class=\"cn-countdown-widget__sub\" data-testid=\"cn-countdown-sub\">\n\t\t\t\t{{ subLabel }}\n\t\t\t</div>\n\t\t\t<dl v-if=\"facts.length\" class=\"cn-countdown-widget__facts\" data-testid=\"cn-countdown-facts\">\n\t\t\t\t<template v-for=\"fact in facts\" :key=\"fact.label\">\n\t\t\t\t\t<dt>{{ fact.label }}</dt>\n\t\t\t\t\t<dd>{{ fact.value }}</dd>\n\t\t\t\t</template>\n\t\t\t</dl>\n\t\t\t<span\n\t\t\t\tv-if=\"progress !== null\"\n\t\t\t\tclass=\"cn-countdown-widget__progress\"\n\t\t\t\trole=\"meter\"\n\t\t\t\t:aria-label=\"progressLabel\"\n\t\t\t\t:aria-valuenow=\"Math.round(progress)\"\n\t\t\t\taria-valuemin=\"0\"\n\t\t\t\taria-valuemax=\"100\"\n\t\t\t\tdata-testid=\"cn-countdown-progress\">\n\t\t\t\t<span class=\"cn-countdown-widget__progress-fill\" :style=\"{ width: `${progress}%` }\" />\n\t\t\t</span>\n\t\t\t<CnNoteCard\n\t\t\t\tv-if=\"stateNotice\"\n\t\t\t\tclass=\"cn-countdown-widget__notice\"\n\t\t\t\t:type=\"stateNotice.type\"\n\t\t\t\t:heading=\"stateNotice.lead || undefined\"\n\t\t\t\t:text=\"stateNotice.text\"\n\t\t\t\tdata-testid=\"cn-countdown-notice\" />\n\t\t\t<div v-if=\"actionButtons.length\" class=\"cn-countdown-widget__actions\">\n\t\t\t\t<button\n\t\t\t\t\tv-for=\"button in actionButtons\"\n\t\t\t\t\t:key=\"button.index\"\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tclass=\"cn-countdown-widget__action\"\n\t\t\t\t\t:class=\"{ 'cn-countdown-widget__action--primary': button.primary }\"\n\t\t\t\t\t:disabled=\"button.disabled\"\n\t\t\t\t\t:aria-disabled=\"button.disabled ? 'true' : null\"\n\t\t\t\t\tdata-testid=\"cn-countdown-action\"\n\t\t\t\t\t@click=\"runAction(button.action)\">\n\t\t\t\t\t{{ button.label }}\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { inject } from 'vue'\nimport CnNoteCard from '../CnNoteCard/CnNoteCard.vue'\nimport CnWidgetIcon from '../CnWidgetGrid/CnWidgetIcon.vue'\nimport { getByPath } from '../../composables/useEndpointSource.js'\nimport { normalizeLook } from '../../composables/useLook.js'\nimport { dispatchAction } from '../../utils/actionsDispatcher.js'\nimport { resolveObjectTokenContext } from '../../utils/detailObjectContext.js'\nimport { resolveDeepTokens } from '../../utils/resolveFilterTokens.js'\nimport { userLocale } from '../../utils/userLocale.js'\n\nconst MS_PER_DAY = 24 * 60 * 60 * 1000\n\n/** The note-card types a state notice may take. */\nconst NOTICE_TYPES = ['success', 'info', 'warning', 'error']\n\n/** The note-card type of each state's notice when the notice names none. */\nconst DEFAULT_NOTICE_TYPES = Object.freeze({\n\tonTrack: 'info',\n\twarning: 'warning',\n\tdanger: 'error',\n\toverdue: 'error',\n\textended: 'info',\n})\n\nconst VARIANT_COLORS = Object.freeze({\n\tdefault: 'var(--color-primary-element)',\n\tsuccess: 'var(--color-success)',\n\twarning: 'var(--color-warning)',\n\terror: 'var(--color-error)',\n})\n\n/**\n * CnCountdownWidget — a KPI tile for how long is left until a date on the\n * bound record.\n *\n * Every other tile in the catalog answers \"how many\" by aggregating or calling\n * an endpoint. This one answers \"how long\", and it needs neither: the record is\n * already loaded by the detail page, so the tile reads the date straight off it\n * and does the arithmetic. No request, and nothing to go stale.\n *\n * It headlines the remaining time and carries the date itself underneath,\n * because \"12 days left\" and \"5 October\" answer different questions and a\n * handler asks both.\n *\n * ## Thresholds\n *\n * `thresholds` recolours the tile as the date approaches, in days:\n *\n * ```js\n * content: {\n * label: 'Time left',\n * field: 'deadline',\n * icon: 'ClockAlertOutline',\n * thresholds: { warn: 14, danger: 5 },\n * }\n * ```\n *\n * A date in the past reads \"overdue by N days\" in the error colour, never a\n * negative number: \"-3 days left\" is a puzzle, and an overdue case is the one\n * state a handler must not have to decode.\n *\n * ## A settled record\n *\n * `settledField` names a property on the record that is truthy once the work\n * the date belongs to is done, such as a case in its final status. A settled\n * record reads `settledLabel` (default \"Closed\") in no threshold colour, never\n * \"overdue\": a closed case missed nothing that can still be acted on, and a red\n * count of days on it sends a handler after a case that needs nobody.\n *\n * ```js\n * content: { field: 'deadline', settledField: 'isFinalStatus', settledLabel: 'Handled' }\n * ```\n *\n * ## The states of a term\n *\n * A term card reads differently as its date nears. `states` gives each state\n * its own headline, caption and notice, and `actions` puts several buttons\n * under the card, each greyed out in the states its `disabledIn` names:\n *\n * ```js\n * content: {\n * field: 'deadline',\n * thresholds: { warn: 14, danger: 7 },\n * extendedField: 'extendedOn',\n * states: {\n * warning: { notice: { lead: 'Watch the term', text: 'Two weeks left.' } },\n * overdue: { headline: 'Term passed', caption: 'Was due {date}, {count} days ago' },\n * },\n * actions: [\n * { label: 'Extend', type: 'handler', handler: 'extendTerm', disabledIn: ['overdue', 'extended'] },\n * { label: 'Suspend', type: 'handler', handler: 'suspendTerm' },\n * ],\n * }\n * ```\n *\n * The state is `overdue` past the date, else `danger` or `warning` by the\n * thresholds, else `extended` when `extendedField` is truthy, else `onTrack`.\n * `extended` also counts for `disabledIn` while a threshold applies, so a\n * term extended once cannot be extended again a week before its end.\n *\n * ## An unset date\n *\n * Renders a dash and no threshold colour. A case with no deadline is not urgent\n * and is not on time; it simply has no deadline, and colouring it green would\n * claim otherwise.\n */\nexport default {\n\tname: 'CnCountdownWidget',\n\n\tcomponents: {\n\t\tCnNoteCard,\n\t\tCnWidgetIcon,\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * The tile's config.\n\t\t *\n\t\t * - `field` — property on the bound record holding the target date.\n\t\t * - `label` — the tile's title.\n\t\t * - `icon` — MDI icon name.\n\t\t * - `thresholds` — `{ warn, danger }` in days remaining.\n\t\t * - `showDate` — render the absolute date underneath (default true).\n\t\t * - `settledField` — property on the record that is truthy once the work is done; the tile then reads `settledLabel` and never counts overdue.\n\t\t * - `settledLabel` — the headline of a settled record, run through the host's translate function (default \"Closed\").\n\t\t * - `daysLabel` — `{ one, other }` with `{count}`, the headline while days remain (\"27 dagen\").\n\t\t * - `caption` — the line under the headline instead of the date, with `{date}` (the long date) and `{count}` (days left).\n\t\t * - `startField` — property holding the start of the term; a bar then shows how much of it has passed.\n\t\t * - `action` — one manifest action under the card (`{ label, type, variant?, ... }`, the headerActions shape; `variant: \"primary\"` draws it in the primary tint).\n\t\t * - `emptyLabel` — the headline while the date is unset (default a dash).\n\t\t * - `emptyCaption` — the line under it while the date is unset, with `{date}` read from `emptyDateField`.\n\t\t * - `facts` — `[{ label, field }]` rows under the caption.\n\t\t * - `extendedField` — property on the record that is truthy once the term has been extended.\n\t\t * - `states` — per state (`onTrack`, `warning`, `danger`, `overdue`, `extended`) a `{ headline?, caption?, notice?: { lead?, text?, type? } }`; texts take `{date}` and `{count}` and run through the host's translate.\n\t\t * - `actions` — several manifest actions under the card, each with an optional `disabledIn` list of states.\n\t\t *\n\t\t * @type {{ field?: string, label?: string, icon?: string, thresholds?: {warn?: number, danger?: number}, showDate?: boolean, settledField?: string, settledLabel?: string, daysLabel?: {one?: string, other?: string}, caption?: string, startField?: string, action?: object, emptyLabel?: string, emptyCaption?: string, emptyDateField?: string, facts?: Array<{label: string, field: string}>, extendedField?: string, states?: object, actions?: Array<object> }}\n\t\t */\n\t\tcontent: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/**\n\t\t * The bound record, when the surface passes it explicitly. Falls back to\n\t\t * the injected `cnObjectContext` a detail page provides.\n\t\t *\n\t\t * @type {object|null}\n\t\t */\n\t\tobjectData: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\t},\n\n\tsetup() {\n\t\treturn {\n\t\t\tcnObjectContextInjected: inject('cnObjectContext', null),\n\t\t\tcnDetailObjectContextInjected: inject('cnDetailObjectContext', null),\n\t\t\tcnTranslate: inject('cnTranslate', null),\n\t\t\tcnLook: inject('cnLook', 'nextcloud'),\n\t\t\tcnDispatchAction: inject('cnDispatchAction', null),\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * The record to read the date from.\n\t\t *\n\t\t * @return {object|null} The bound record, or null.\n\t\t */\n\t\trecord() {\n\t\t\tif (this.objectData) {\n\t\t\t\treturn this.objectData\n\t\t\t}\n\t\t\tconst ctx = resolveObjectTokenContext(this.cnObjectContextInjected, this.cnDetailObjectContextInjected)\n\t\t\treturn ctx?.object || null\n\t\t},\n\n\t\t/**\n\t\t * The target date, or null when unset or unparseable.\n\t\t *\n\t\t * @return {Date|null} The parsed date.\n\t\t */\n\t\ttargetDate() {\n\t\t\tconst field = this.content?.field\n\t\t\tif (!this.record || !field) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst raw = getByPath(this.record, field)\n\t\t\tif (raw === null || raw === undefined || raw === '') {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst parsed = new Date(raw)\n\t\t\treturn Number.isNaN(parsed.getTime()) ? null : parsed\n\t\t},\n\n\t\t/**\n\t\t * Whole days from today until the target. Negative once it has passed.\n\t\t *\n\t\t * Both ends are floored to midnight first, so \"tomorrow\" is 1 day away\n\t\t * all day today rather than flipping to 0 at lunchtime.\n\t\t *\n\t\t * @return {number|null} Days remaining, or null.\n\t\t */\n\t\tdaysRemaining() {\n\t\t\tif (!this.targetDate) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst startOfDay = (d) => Date.UTC(d.getFullYear(), d.getMonth(), d.getDate())\n\t\t\treturn Math.round((startOfDay(this.targetDate) - startOfDay(new Date())) / MS_PER_DAY)\n\t\t},\n\n\t\t/**\n\t\t * Whether the record says its work is done (`settledField` is truthy).\n\t\t *\n\t\t * @return {boolean} True for a settled record.\n\t\t * @spec openspec/changes/countdown-settled-record/specs/countdown-settled-record/spec.md#requirement-a-settled-record-never-reads-as-overdue\n\t\t */\n\t\tisSettled() {\n\t\t\tconst field = this.content?.settledField\n\t\t\tif (!this.record || !field) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn Boolean(getByPath(this.record, field))\n\t\t},\n\n\t\t/**\n\t\t * Whether the date has passed on a record still open.\n\t\t *\n\t\t * @return {boolean} True when overdue.\n\t\t * @spec openspec/changes/countdown-settled-record/specs/countdown-settled-record/spec.md#requirement-a-settled-record-never-reads-as-overdue\n\t\t */\n\t\tisOverdue() {\n\t\t\treturn !this.isSettled && this.daysRemaining !== null && this.daysRemaining < 0\n\t\t},\n\n\t\t/**\n\t\t * The headline: the remaining time in words.\n\t\t *\n\t\t * @return {string} The headline text.\n\t\t * @spec openspec/changes/countdown-settled-record/specs/countdown-settled-record/spec.md#requirement-a-settled-record-never-reads-as-overdue\n\t\t */\n\t\theadline() {\n\t\t\tif (this.isSettled) {\n\t\t\t\tconst label = this.content?.settledLabel\n\t\t\t\tif (label) {\n\t\t\t\t\treturn typeof this.cnTranslate === 'function' ? this.cnTranslate(label) : label\n\t\t\t\t}\n\t\t\t\treturn t('nextcloud-vue', 'Closed')\n\t\t\t}\n\t\t\tconst days = this.daysRemaining\n\t\t\tif (this.stateConfig.headline) {\n\t\t\t\treturn this.fillStateText(this.stateConfig.headline)\n\t\t\t}\n\t\t\tif (days === null) {\n\t\t\t\treturn this.content?.emptyLabel ? this.translate(this.content.emptyLabel) : '—'\n\t\t\t}\n\t\t\tif (days < 0) {\n\t\t\t\tconst overdue = Math.abs(days)\n\t\t\t\treturn overdue === 1\n\t\t\t\t\t? t('nextcloud-vue', '1 day overdue')\n\t\t\t\t\t: t('nextcloud-vue', '{count} days overdue', { count: overdue })\n\t\t\t}\n\t\t\tif (days === 0) {\n\t\t\t\treturn t('nextcloud-vue', 'Due today')\n\t\t\t}\n\t\t\tconst labels = this.content?.daysLabel\n\t\t\tif (labels && typeof labels === 'object' && (labels.one || labels.other)) {\n\t\t\t\tconst template = this.translate((days === 1 ? labels.one : labels.other) || labels.other || labels.one)\n\t\t\t\treturn template.replace(/\\{count\\}/g, String(days))\n\t\t\t}\n\t\t\tif (days === 1) {\n\t\t\t\treturn t('nextcloud-vue', '1 day left')\n\t\t\t}\n\t\t\treturn t('nextcloud-vue', '{count} days left', { count: days })\n\t\t},\n\n\t\t/**\n\t\t * Whether the app takes the board look: no icon circle.\n\t\t *\n\t\t * @return {boolean} True in the board look.\n\t\t * @spec openspec/changes/countdown-board-look/specs/countdown-board-look/spec.md#requirement-the-countdown-draws-the-boards-term-card\n\t\t */\n\t\tisBoardLook() {\n\t\t\treturn normalizeLook(this.cnLook) === 'board'\n\t\t},\n\n\t\t/**\n\t\t * How much of the term has passed, from `startField` to the date, in\n\t\t * whole days and as a percentage (0 to 100), or null without a usable\n\t\t * start.\n\t\t *\n\t\t * @return {number|null} The share passed.\n\t\t * @spec openspec/changes/countdown-board-look/specs/countdown-board-look/spec.md#requirement-the-countdown-draws-the-boards-term-card\n\t\t */\n\t\tprogress() {\n\t\t\tconst field = this.content?.startField\n\t\t\tif (!field || !this.record || !this.targetDate || this.isSettled) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst raw = getByPath(this.record, field)\n\t\t\tconst start = raw === null || raw === undefined || raw === '' ? null : new Date(raw)\n\t\t\tif (!start || Number.isNaN(start.getTime())) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst startOfDay = (d) => Date.UTC(d.getFullYear(), d.getMonth(), d.getDate())\n\t\t\tconst span = startOfDay(this.targetDate) - startOfDay(start)\n\t\t\tif (span <= 0) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\treturn Math.min(100, Math.max(0, ((startOfDay(new Date()) - startOfDay(start)) / span) * 100))\n\t\t},\n\n\t\t/**\n\t\t * The `facts` rows under the caption (`[{ label, field }]`), with\n\t\t * their values read off the record; a row without a value is left out.\n\t\t *\n\t\t * @return {Array<{label: string, value: string}>} The rows.\n\t\t * @spec openspec/changes/countdown-board-look/specs/countdown-board-look/spec.md#requirement-the-countdown-draws-the-boards-term-card\n\t\t */\n\t\tfacts() {\n\t\t\tconst rows = Array.isArray(this.content?.facts) ? this.content.facts : []\n\t\t\treturn rows\n\t\t\t\t.filter((row) => row && typeof row.label === 'string' && typeof row.field === 'string')\n\t\t\t\t.map((row) => {\n\t\t\t\t\tconst value = this.record ? getByPath(this.record, row.field) : null\n\t\t\t\t\treturn { label: this.translate(row.label), value: value === null || value === undefined ? '' : this.translate(String(value)) }\n\t\t\t\t})\n\t\t\t\t.filter((row) => row.value !== '')\n\t\t},\n\n\t\t/**\n\t\t * Whether the record says its term has been extended (`extendedField`).\n\t\t *\n\t\t * @return {boolean} True for an extended term.\n\t\t * @spec openspec/changes/countdown-term-states/specs/countdown-term-states/spec.md#requirement-a-term-card-reads-per-state\n\t\t */\n\t\tisExtended() {\n\t\t\tconst field = this.content?.extendedField\n\t\t\treturn Boolean(field && this.record && getByPath(this.record, field))\n\t\t},\n\n\t\t/**\n\t\t * The state of the term: `overdue`, `danger`, `warning`, `extended` or\n\t\t * `onTrack`; null while the date is unset or the record is settled.\n\t\t *\n\t\t * @return {string|null} The state.\n\t\t * @spec openspec/changes/countdown-term-states/specs/countdown-term-states/spec.md#requirement-a-term-card-reads-per-state\n\t\t */\n\t\ttermState() {\n\t\t\tif (this.daysRemaining === null || this.isSettled) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tif (this.daysRemaining < 0) {\n\t\t\t\treturn 'overdue'\n\t\t\t}\n\t\t\tif (this.variant === 'error') {\n\t\t\t\treturn 'danger'\n\t\t\t}\n\t\t\tif (this.variant === 'warning') {\n\t\t\t\treturn 'warning'\n\t\t\t}\n\t\t\treturn this.isExtended ? 'extended' : 'onTrack'\n\t\t},\n\n\t\t/**\n\t\t * Every state that holds now: the term state, plus `extended` while a\n\t\t * threshold or the date outranks it.\n\t\t *\n\t\t * @return {string[]} The states.\n\t\t * @spec openspec/changes/countdown-term-states/specs/countdown-term-states/spec.md#requirement-an-action-can-be-greyed-out-per-state\n\t\t */\n\t\tactiveStates() {\n\t\t\tif (this.termState === null) {\n\t\t\t\treturn []\n\t\t\t}\n\t\t\treturn this.isExtended && this.termState !== 'extended' ? [this.termState, 'extended'] : [this.termState]\n\t\t},\n\n\t\t/**\n\t\t * The `states` entry of the current state, or an empty object.\n\t\t *\n\t\t * @return {{headline?: string, caption?: string, notice?: object}} The entry.\n\t\t * @spec openspec/changes/countdown-term-states/specs/countdown-term-states/spec.md#requirement-a-term-card-reads-per-state\n\t\t */\n\t\tstateConfig() {\n\t\t\tconst states = this.content?.states\n\t\t\tconst entry = this.termState && states && typeof states === 'object' ? states[this.termState] : null\n\t\t\treturn entry && typeof entry === 'object' ? entry : {}\n\t\t},\n\n\t\t/**\n\t\t * The notice of the current state, its texts filled in, or null.\n\t\t *\n\t\t * @return {{lead: string, text: string, type: string}|null} The notice.\n\t\t * @spec openspec/changes/countdown-term-states/specs/countdown-term-states/spec.md#requirement-a-term-card-reads-per-state\n\t\t */\n\t\tstateNotice() {\n\t\t\tconst notice = this.stateConfig.notice\n\t\t\tif (!notice || typeof notice !== 'object' || (!notice.lead && !notice.text)) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst type = NOTICE_TYPES.includes(notice.type) ? notice.type : DEFAULT_NOTICE_TYPES[this.termState]\n\t\t\treturn {\n\t\t\t\tlead: notice.lead ? this.fillStateText(notice.lead) : '',\n\t\t\t\ttext: notice.text ? this.fillStateText(notice.text) : '',\n\t\t\t\ttype,\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * The buttons under the card: `content.actions`, or `content.action`\n\t\t * alone, each greyed out while a state its `disabledIn` names holds.\n\t\t *\n\t\t * @return {Array<{index: number, label: string, primary: boolean, disabled: boolean, action: object}>} The buttons.\n\t\t * @spec openspec/changes/countdown-term-states/specs/countdown-term-states/spec.md#requirement-an-action-can-be-greyed-out-per-state\n\t\t */\n\t\tactionButtons() {\n\t\t\tconst list = Array.isArray(this.content?.actions) ? this.content.actions : [this.content?.action]\n\t\t\treturn list\n\t\t\t\t.map((action, index) => ({ action, index }))\n\t\t\t\t.filter(({ action }) => action && typeof action === 'object' && typeof action.label === 'string' && action.label !== '')\n\t\t\t\t.map(({ action, index }) => ({\n\t\t\t\t\tindex,\n\t\t\t\t\tlabel: this.translate(action.label),\n\t\t\t\t\tprimary: action.variant === 'primary',\n\t\t\t\t\tdisabled: Array.isArray(action.disabledIn) && action.disabledIn.some((state) => this.activeStates.includes(state)),\n\t\t\t\t\taction,\n\t\t\t\t}))\n\t\t},\n\n\t\t/** @return {string} The accessible name of the progress bar. */\n\t\tprogressLabel() {\n\t\t\treturn t('nextcloud-vue', 'Time passed')\n\t\t},\n\n\t\t/**\n\t\t * The absolute date under the headline, so the tile answers \"how long\"\n\t\t * and \"when\" at once.\n\t\t *\n\t\t * @return {string} The formatted date, or ''.\n\t\t */\n\t\tsubLabel() {\n\t\t\tif (!this.targetDate && typeof this.content?.emptyCaption === 'string' && this.content.emptyCaption !== '') {\n\t\t\t\tconst raw = this.content.emptyDateField && this.record ? getByPath(this.record, this.content.emptyDateField) : null\n\t\t\t\tconst when = raw ? new Date(raw) : null\n\t\t\t\tconst date = when && !Number.isNaN(when.getTime()) ? when.toLocaleDateString(userLocale(), { day: 'numeric', month: 'long', year: 'numeric' }) : ''\n\t\t\t\treturn this.translate(this.content.emptyCaption).replace(/\\{date\\}/g, date)\n\t\t\t}\n\t\t\tif (!this.targetDate || this.content?.showDate === false) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tif (this.stateConfig.caption) {\n\t\t\t\treturn this.fillStateText(this.stateConfig.caption)\n\t\t\t}\n\t\t\tconst date = this.targetDate.toLocaleDateString(userLocale(), { day: 'numeric', month: 'long', year: 'numeric' })\n\t\t\tconst caption = this.content?.caption\n\t\t\tif (typeof caption === 'string' && caption !== '') {\n\t\t\t\treturn this.translate(caption).replace(/\\{date\\}/g, date).replace(/\\{count\\}/g, String(this.daysRemaining ?? ''))\n\t\t\t}\n\t\t\treturn date\n\t\t},\n\n\t\t/**\n\t\t * The threshold band this date falls in.\n\t\t *\n\t\t * @return {string} One of default / success / warning / error.\n\t\t * @spec openspec/changes/countdown-settled-record/specs/countdown-settled-record/spec.md#requirement-a-settled-record-never-reads-as-overdue\n\t\t */\n\t\tvariant() {\n\t\t\tconst days = this.daysRemaining\n\t\t\tif (days === null || this.isSettled) {\n\t\t\t\treturn 'default'\n\t\t\t}\n\t\t\tif (days < 0) {\n\t\t\t\treturn 'error'\n\t\t\t}\n\t\t\tconst thresholds = this.content?.thresholds || {}\n\t\t\tif (Number.isFinite(thresholds.danger) && days <= thresholds.danger) {\n\t\t\t\treturn 'error'\n\t\t\t}\n\t\t\tif (Number.isFinite(thresholds.warn) && days <= thresholds.warn) {\n\t\t\t\treturn 'warning'\n\t\t\t}\n\t\t\treturn 'default'\n\t\t},\n\n\t\t/** @return {string} The value colour for the current band. */\n\t\tvalueColor() {\n\t\t\tif (this.isBoardLook && this.variant === 'default') {\n\t\t\t\treturn 'var(--color-main-text)'\n\t\t\t}\n\t\t\treturn VARIANT_COLORS[this.variant] || VARIANT_COLORS.default\n\t\t},\n\n\t\t/** @return {string} The tile label. */\n\t\tresolvedLabel() {\n\t\t\treturn this.content?.label || ''\n\t\t},\n\n\t\t/** @return {string} The MDI icon name. */\n\t\tresolvedIcon() {\n\t\t\treturn this.content?.icon || 'ClockOutline'\n\t\t},\n\n\t\t/** @return {object} Inline style for the icon circle. */\n\t\ticonCircleStyle() {\n\t\t\treturn { color: this.valueColor }\n\t\t},\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * The host's translate, or the text unchanged.\n\t\t *\n\t\t * @param {string} text The text.\n\t\t * @return {string} The translation.\n\t\t */\n\t\ttranslate(text) {\n\t\t\treturn typeof this.cnTranslate === 'function' ? this.cnTranslate(text) : text\n\t\t},\n\n\t\t/**\n\t\t * A state text through the host's translate, with `{date}` the long\n\t\t * date and `{count}` the days left, or the days past once overdue.\n\t\t *\n\t\t * @param {string} text The text.\n\t\t * @return {string} The filled text.\n\t\t * @spec openspec/changes/countdown-term-states/specs/countdown-term-states/spec.md#requirement-a-term-card-reads-per-state\n\t\t */\n\t\tfillStateText(text) {\n\t\t\tconst date = this.targetDate ? this.targetDate.toLocaleDateString(userLocale(), { day: 'numeric', month: 'long', year: 'numeric' }) : ''\n\t\t\tconst count = this.daysRemaining === null ? '' : String(Math.abs(this.daysRemaining))\n\t\t\treturn this.translate(text).replace(/\\{date\\}/g, date).replace(/\\{count\\}/g, count)\n\t\t},\n\n\t\t/**\n\t\t * Dispatch a manifest action with the record's tokens resolved, through\n\t\t * the page's dispatcher when there is one. A greyed-out action does nothing.\n\t\t *\n\t\t * @param {object} [action] The action; `content.action` when left out.\n\t\t * @return {unknown}\n\t\t * @spec openspec/changes/countdown-term-states/specs/countdown-term-states/spec.md#requirement-an-action-can-be-greyed-out-per-state\n\t\t */\n\t\trunAction(action = this.content?.action) {\n\t\t\tif (!action || typeof action !== 'object') {\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\tconst ctx = resolveObjectTokenContext(this.cnObjectContextInjected, this.cnDetailObjectContextInjected) || {}\n\t\t\tconst tokenCtx = { ...ctx, object: this.record || ctx.object || null, objectId: this.record?.id ?? ctx.objectId ?? null }\n\t\t\tconst { disabledIn, ...declared } = action\n\t\t\tif (Array.isArray(disabledIn) && disabledIn.some((state) => this.activeStates.includes(state))) {\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\tconst resolved = resolveDeepTokens(declared, tokenCtx)\n\t\t\tif (typeof this.cnDispatchAction === 'function') {\n\t\t\t\treturn this.cnDispatchAction(resolved)\n\t\t\t}\n\t\t\treturn dispatchAction(resolved, { router: this.$router || null, tokenCtx })\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-countdown-widget__value {\n\twhite-space: nowrap;\n}\n\n/* The bar spans the card: the KPI body aligns its items to the start, which\n left the empty track 0px wide. */\n.cn-countdown-widget__progress {\n\talign-self: stretch;\n\tbackground: var(--color-border);\n\tborder-radius: 3px;\n\tdisplay: block;\n\theight: 6px;\n\tmargin-block-start: 10px;\n\toverflow: hidden;\n}\n\n.cn-countdown-widget__progress-fill {\n\tbackground: var(--color-primary-element);\n\tdisplay: block;\n\theight: 100%;\n}\n\n.cn-countdown-widget__action {\n\talign-self: flex-start;\n\tbackground: var(--color-background-dark);\n\tborder: 0;\n\tborder-radius: var(--border-radius-pill, 17px);\n\tcolor: var(--color-main-text);\n\tfont-weight: 600;\n\tmargin-block-start: 10px;\n\tmin-height: 34px;\n\tpadding: 0 12px;\n}\n\n/* The board draws the term card's action as a 34px chip with 13px text and\n a 17px radius (DqZaak \"Termijn opschorten\"); Nextcloud's pill radius is\n 100px and its text 15px. */\n.cn-countdown-widget--board .cn-countdown-widget__action {\n\tborder-radius: 17px;\n\tfont-size: 13px;\n}\n\n/* The board stacks the term card 10px apart: the days, the date line, the\n bar and the action (DqZaak \"Termijn\": r33 live 2 / 11.9 / 5 against 10,\n card 182.7 against 188). */\n.cn-countdown-widget--board .cn-kpi-card__body {\n\tgap: 10px;\n}\n\n.cn-countdown-widget--board .cn-countdown-widget__progress.cn-countdown-widget__progress,\n.cn-countdown-widget--board .cn-countdown-widget__action.cn-countdown-widget__action {\n\tmargin: 0;\n}\n\n.cn-countdown-widget__actions {\n\talign-self: stretch;\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 8px;\n\tmargin-block-start: 10px;\n}\n\n.cn-countdown-widget__actions .cn-countdown-widget__action {\n\tmargin: 0;\n}\n\n.cn-countdown-widget__action:disabled {\n\tbackground: var(--color-background-hover);\n\tcolor: var(--color-text-maxcontrast);\n\tcursor: not-allowed;\n}\n\n.cn-countdown-widget__notice {\n\talign-self: stretch;\n\tmargin: 10px 0 0;\n}\n\n.cn-countdown-widget--board .cn-countdown-widget__actions,\n.cn-countdown-widget--board .cn-countdown-widget__notice {\n\tmargin: 0;\n}\n\n.cn-countdown-widget__action--primary {\n\tbackground: var(--color-primary-element-light);\n\tcolor: var(--color-primary-element-light-text);\n}\n\n.cn-countdown-widget__facts {\n\tdisplay: grid;\n\tgap: 8px 16px;\n\tgrid-template-columns: max-content 1fr;\n\tmargin: 10px 0 0;\n}\n\n.cn-countdown-widget__facts dt {\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-countdown-widget__facts dd {\n\tmargin: 0;\n}\n\n.cn-countdown-widget__action:not(:disabled):hover,\n.cn-countdown-widget__action:focus-visible {\n\tbackground: var(--color-background-hover);\n}\n\n.cn-countdown-widget__sub {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 0.85em;\n}\n</style>\n"],"names":["CnNoteCard","CnWidgetIcon","t"],"mappings":";;;;;;;;;;;AA6EA,MAAM,aAAa,EAAG,GAAE,EAAC,GAAI,EAAG,GAAE,KAAG;;AAErC;AACA,MAAM,YAAW,GAAI,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAA;;AAE3D;AACA,MAAM,oBAAmB,GAAI,MAAM,CAAC,MAAM,CAAC;AAC1C,CAAA,OAAO,EAAE,MAAM;AACf,CAAA,OAAO,EAAE,SAAS;AAClB,CAAA,MAAM,EAAE,OAAO;AACf,CAAA,OAAO,EAAE,OAAO;AAChB,CAAA,QAAQ,EAAE,MAAM;AACjB,CAAC,EAAA;;AAED,MAAM,cAAa,GAAI,MAAM,CAAC,MAAM,CAA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AA,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,KAAK,UAAU,CAAC,IAAI,CAAC,CAAC,KAAK,KAAK,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE;AAC/F,IAAA,OAAO,SAAQ;AAChB,IAAA;GACA,MAAM,QAAS,GAAE,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,EAAA;AACrD,GAAA,IAAI,OAAO,IAAI,CAAC,gBAAe,KAAM,UAAU,EAAE;AAChD,IAAA,OAAO,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAA;AACtC,IAAA;AACA,GAAA,OAAO,cAAc,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,OAAM,IAAK,IAAI,EAAE,UAAU,CAAA;GAC1E;EACD;AACF;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { resolveComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, createVNode, createCommentVNode, createElementVNode, toDisplayString, Fragment, renderList } from 'vue';
|
|
1
|
+
import { resolveComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, createVNode, createCommentVNode, createElementVNode, toDisplayString, Fragment, renderList, createBlock } from 'vue';
|
|
2
2
|
|
|
3
3
|
const _hoisted_1 = { class: "cn-kpi-card__body" };
|
|
4
4
|
const _hoisted_2 = {
|
|
@@ -16,9 +16,15 @@ const _hoisted_4 = {
|
|
|
16
16
|
"data-testid": "cn-countdown-facts"
|
|
17
17
|
};
|
|
18
18
|
const _hoisted_5 = ["aria-label", "aria-valuenow"];
|
|
19
|
+
const _hoisted_6 = {
|
|
20
|
+
key: 5,
|
|
21
|
+
class: "cn-countdown-widget__actions"
|
|
22
|
+
};
|
|
23
|
+
const _hoisted_7 = ["disabled", "aria-disabled", "onClick"];
|
|
19
24
|
|
|
20
25
|
function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
21
26
|
const _component_CnWidgetIcon = resolveComponent("CnWidgetIcon");
|
|
27
|
+
const _component_CnNoteCard = resolveComponent("CnNoteCard");
|
|
22
28
|
|
|
23
29
|
return (openBlock(), createElementBlock("div", {
|
|
24
30
|
class: normalizeClass(["cn-kpi-card cn-countdown-widget", [`cn-countdown-widget--${$options.variant}`, { 'cn-kpi-card--board cn-countdown-widget--board': $options.isBoardLook }]])
|
|
@@ -75,14 +81,30 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
75
81
|
}, null, 4 /* STYLE */)
|
|
76
82
|
], 8 /* PROPS */, _hoisted_5))
|
|
77
83
|
: createCommentVNode("v-if", true),
|
|
78
|
-
($options.
|
|
79
|
-
? (openBlock(),
|
|
84
|
+
($options.stateNotice)
|
|
85
|
+
? (openBlock(), createBlock(_component_CnNoteCard, {
|
|
80
86
|
key: 4,
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
87
|
+
class: "cn-countdown-widget__notice",
|
|
88
|
+
type: $options.stateNotice.type,
|
|
89
|
+
heading: $options.stateNotice.lead || undefined,
|
|
90
|
+
text: $options.stateNotice.text,
|
|
91
|
+
"data-testid": "cn-countdown-notice"
|
|
92
|
+
}, null, 8 /* PROPS */, ["type", "heading", "text"]))
|
|
93
|
+
: createCommentVNode("v-if", true),
|
|
94
|
+
($options.actionButtons.length)
|
|
95
|
+
? (openBlock(), createElementBlock("div", _hoisted_6, [
|
|
96
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList($options.actionButtons, (button) => {
|
|
97
|
+
return (openBlock(), createElementBlock("button", {
|
|
98
|
+
key: button.index,
|
|
99
|
+
type: "button",
|
|
100
|
+
class: normalizeClass(["cn-countdown-widget__action", { 'cn-countdown-widget__action--primary': button.primary }]),
|
|
101
|
+
disabled: button.disabled,
|
|
102
|
+
"aria-disabled": button.disabled ? 'true' : null,
|
|
103
|
+
"data-testid": "cn-countdown-action",
|
|
104
|
+
onClick: $event => ($options.runAction(button.action))
|
|
105
|
+
}, toDisplayString(button.label), 11 /* TEXT, CLASS, PROPS */, _hoisted_7))
|
|
106
|
+
}), 128 /* KEYED_FRAGMENT */))
|
|
107
|
+
]))
|
|
86
108
|
: createCommentVNode("v-if", true)
|
|
87
109
|
])
|
|
88
110
|
], 2 /* CLASS */))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CnCountdownWidget.vue3.js","sources":["../../../../src/components/CnCountdownWidget/CnCountdownWidget.vue?vue&type=template&id=f992f4f8&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<div\n\t\tclass=\"cn-kpi-card cn-countdown-widget\"\n\t\t:class=\"[`cn-countdown-widget--${variant}`, { 'cn-kpi-card--board cn-countdown-widget--board': isBoardLook }]\">\n\t\t<div v-if=\"!isBoardLook\" class=\"cn-kpi-card__icon cn-countdown-widget__icon\" :style=\"iconCircleStyle\">\n\t\t\t<CnWidgetIcon :name=\"resolvedIcon\" :size=\"24\" />\n\t\t</div>\n\n\t\t<div class=\"cn-kpi-card__body\">\n\t\t\t<div v-if=\"resolvedLabel\" class=\"cn-kpi-card__title\">\n\t\t\t\t{{ resolvedLabel }}\n\t\t\t</div>\n\t\t\t<div class=\"cn-kpi-card__value cn-countdown-widget__value\" :style=\"{ color: valueColor }\">\n\t\t\t\t{{ headline }}\n\t\t\t</div>\n\t\t\t<div v-if=\"subLabel\" class=\"cn-countdown-widget__sub\" data-testid=\"cn-countdown-sub\">\n\t\t\t\t{{ subLabel }}\n\t\t\t</div>\n\t\t\t<dl v-if=\"facts.length\" class=\"cn-countdown-widget__facts\" data-testid=\"cn-countdown-facts\">\n\t\t\t\t<template v-for=\"fact in facts\" :key=\"fact.label\">\n\t\t\t\t\t<dt>{{ fact.label }}</dt>\n\t\t\t\t\t<dd>{{ fact.value }}</dd>\n\t\t\t\t</template>\n\t\t\t</dl>\n\t\t\t<span\n\t\t\t\tv-if=\"progress !== null\"\n\t\t\t\tclass=\"cn-countdown-widget__progress\"\n\t\t\t\trole=\"meter\"\n\t\t\t\t:aria-label=\"progressLabel\"\n\t\t\t\t:aria-valuenow=\"Math.round(progress)\"\n\t\t\t\taria-valuemin=\"0\"\n\t\t\t\taria-valuemax=\"100\"\n\t\t\t\tdata-testid=\"cn-countdown-progress\">\n\t\t\t\t<span class=\"cn-countdown-widget__progress-fill\" :style=\"{ width: `${progress}%` }\" />\n\t\t\t</span>\n\t\t\t<button\n\t\t\t\tv-if=\"actionLabel\"\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"cn-countdown-widget__action\"\n\t\t\t\t:class=\"{ 'cn-countdown-widget__action--primary': content.action && content.action.variant === 'primary' }\"\n\t\t\t\tdata-testid=\"cn-countdown-action\"\n\t\t\t\t@click=\"runAction\">\n\t\t\t\t{{ actionLabel }}\n\t\t\t</button>\n\t\t</div>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { inject } from 'vue'\nimport CnWidgetIcon from '../CnWidgetGrid/CnWidgetIcon.vue'\nimport { getByPath } from '../../composables/useEndpointSource.js'\nimport { normalizeLook } from '../../composables/useLook.js'\nimport { dispatchAction } from '../../utils/actionsDispatcher.js'\nimport { resolveObjectTokenContext } from '../../utils/detailObjectContext.js'\nimport { resolveDeepTokens } from '../../utils/resolveFilterTokens.js'\nimport { userLocale } from '../../utils/userLocale.js'\n\nconst MS_PER_DAY = 24 * 60 * 60 * 1000\n\nconst VARIANT_COLORS = Object.freeze({\n\tdefault: 'var(--color-primary-element)',\n\tsuccess: 'var(--color-success)',\n\twarning: 'var(--color-warning)',\n\terror: 'var(--color-error)',\n})\n\n/**\n * CnCountdownWidget — a KPI tile for how long is left until a date on the\n * bound record.\n *\n * Every other tile in the catalog answers \"how many\" by aggregating or calling\n * an endpoint. This one answers \"how long\", and it needs neither: the record is\n * already loaded by the detail page, so the tile reads the date straight off it\n * and does the arithmetic. No request, and nothing to go stale.\n *\n * It headlines the remaining time and carries the date itself underneath,\n * because \"12 days left\" and \"5 October\" answer different questions and a\n * handler asks both.\n *\n * ## Thresholds\n *\n * `thresholds` recolours the tile as the date approaches, in days:\n *\n * ```js\n * content: {\n * label: 'Time left',\n * field: 'deadline',\n * icon: 'ClockAlertOutline',\n * thresholds: { warn: 14, danger: 5 },\n * }\n * ```\n *\n * A date in the past reads \"overdue by N days\" in the error colour, never a\n * negative number: \"-3 days left\" is a puzzle, and an overdue case is the one\n * state a handler must not have to decode.\n *\n * ## A settled record\n *\n * `settledField` names a property on the record that is truthy once the work\n * the date belongs to is done, such as a case in its final status. A settled\n * record reads `settledLabel` (default \"Closed\") in no threshold colour, never\n * \"overdue\": a closed case missed nothing that can still be acted on, and a red\n * count of days on it sends a handler after a case that needs nobody.\n *\n * ```js\n * content: { field: 'deadline', settledField: 'isFinalStatus', settledLabel: 'Handled' }\n * ```\n *\n * ## An unset date\n *\n * Renders a dash and no threshold colour. A case with no deadline is not urgent\n * and is not on time; it simply has no deadline, and colouring it green would\n * claim otherwise.\n */\nexport default {\n\tname: 'CnCountdownWidget',\n\n\tcomponents: {\n\t\tCnWidgetIcon,\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * The tile's config.\n\t\t *\n\t\t * - `field` — property on the bound record holding the target date.\n\t\t * - `label` — the tile's title.\n\t\t * - `icon` — MDI icon name.\n\t\t * - `thresholds` — `{ warn, danger }` in days remaining.\n\t\t * - `showDate` — render the absolute date underneath (default true).\n\t\t * - `settledField` — property on the record that is truthy once the work is done; the tile then reads `settledLabel` and never counts overdue.\n\t\t * - `settledLabel` — the headline of a settled record, run through the host's translate function (default \"Closed\").\n\t\t * - `daysLabel` — `{ one, other }` with `{count}`, the headline while days remain (\"27 dagen\").\n\t\t * - `caption` — the line under the headline instead of the date, with `{date}` (the long date) and `{count}` (days left).\n\t\t * - `startField` — property holding the start of the term; a bar then shows how much of it has passed.\n\t\t * - `action` — one manifest action under the card (`{ label, type, variant?, ... }`, the headerActions shape; `variant: \"primary\"` draws it in the primary tint).\n\t\t * - `emptyLabel` — the headline while the date is unset (default a dash).\n\t\t * - `emptyCaption` — the line under it while the date is unset, with `{date}` read from `emptyDateField`.\n\t\t * - `facts` — `[{ label, field }]` rows under the caption.\n\t\t *\n\t\t * @type {{ field?: string, label?: string, icon?: string, thresholds?: {warn?: number, danger?: number}, showDate?: boolean, settledField?: string, settledLabel?: string, daysLabel?: {one?: string, other?: string}, caption?: string, startField?: string, action?: object, emptyLabel?: string, emptyCaption?: string, emptyDateField?: string, facts?: Array<{label: string, field: string}> }}\n\t\t */\n\t\tcontent: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/**\n\t\t * The bound record, when the surface passes it explicitly. Falls back to\n\t\t * the injected `cnObjectContext` a detail page provides.\n\t\t *\n\t\t * @type {object|null}\n\t\t */\n\t\tobjectData: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\t},\n\n\tsetup() {\n\t\treturn {\n\t\t\tcnObjectContextInjected: inject('cnObjectContext', null),\n\t\t\tcnDetailObjectContextInjected: inject('cnDetailObjectContext', null),\n\t\t\tcnTranslate: inject('cnTranslate', null),\n\t\t\tcnLook: inject('cnLook', 'nextcloud'),\n\t\t\tcnDispatchAction: inject('cnDispatchAction', null),\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * The record to read the date from.\n\t\t *\n\t\t * @return {object|null} The bound record, or null.\n\t\t */\n\t\trecord() {\n\t\t\tif (this.objectData) {\n\t\t\t\treturn this.objectData\n\t\t\t}\n\t\t\tconst ctx = resolveObjectTokenContext(this.cnObjectContextInjected, this.cnDetailObjectContextInjected)\n\t\t\treturn ctx?.object || null\n\t\t},\n\n\t\t/**\n\t\t * The target date, or null when unset or unparseable.\n\t\t *\n\t\t * @return {Date|null} The parsed date.\n\t\t */\n\t\ttargetDate() {\n\t\t\tconst field = this.content?.field\n\t\t\tif (!this.record || !field) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst raw = getByPath(this.record, field)\n\t\t\tif (raw === null || raw === undefined || raw === '') {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst parsed = new Date(raw)\n\t\t\treturn Number.isNaN(parsed.getTime()) ? null : parsed\n\t\t},\n\n\t\t/**\n\t\t * Whole days from today until the target. Negative once it has passed.\n\t\t *\n\t\t * Both ends are floored to midnight first, so \"tomorrow\" is 1 day away\n\t\t * all day today rather than flipping to 0 at lunchtime.\n\t\t *\n\t\t * @return {number|null} Days remaining, or null.\n\t\t */\n\t\tdaysRemaining() {\n\t\t\tif (!this.targetDate) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst startOfDay = (d) => Date.UTC(d.getFullYear(), d.getMonth(), d.getDate())\n\t\t\treturn Math.round((startOfDay(this.targetDate) - startOfDay(new Date())) / MS_PER_DAY)\n\t\t},\n\n\t\t/**\n\t\t * Whether the record says its work is done (`settledField` is truthy).\n\t\t *\n\t\t * @return {boolean} True for a settled record.\n\t\t * @spec openspec/changes/countdown-settled-record/specs/countdown-settled-record/spec.md#requirement-a-settled-record-never-reads-as-overdue\n\t\t */\n\t\tisSettled() {\n\t\t\tconst field = this.content?.settledField\n\t\t\tif (!this.record || !field) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn Boolean(getByPath(this.record, field))\n\t\t},\n\n\t\t/**\n\t\t * Whether the date has passed on a record still open.\n\t\t *\n\t\t * @return {boolean} True when overdue.\n\t\t * @spec openspec/changes/countdown-settled-record/specs/countdown-settled-record/spec.md#requirement-a-settled-record-never-reads-as-overdue\n\t\t */\n\t\tisOverdue() {\n\t\t\treturn !this.isSettled && this.daysRemaining !== null && this.daysRemaining < 0\n\t\t},\n\n\t\t/**\n\t\t * The headline: the remaining time in words.\n\t\t *\n\t\t * @return {string} The headline text.\n\t\t * @spec openspec/changes/countdown-settled-record/specs/countdown-settled-record/spec.md#requirement-a-settled-record-never-reads-as-overdue\n\t\t */\n\t\theadline() {\n\t\t\tif (this.isSettled) {\n\t\t\t\tconst label = this.content?.settledLabel\n\t\t\t\tif (label) {\n\t\t\t\t\treturn typeof this.cnTranslate === 'function' ? this.cnTranslate(label) : label\n\t\t\t\t}\n\t\t\t\treturn t('nextcloud-vue', 'Closed')\n\t\t\t}\n\t\t\tconst days = this.daysRemaining\n\t\t\tif (days === null) {\n\t\t\t\treturn this.content?.emptyLabel ? this.translate(this.content.emptyLabel) : '—'\n\t\t\t}\n\t\t\tif (days < 0) {\n\t\t\t\tconst overdue = Math.abs(days)\n\t\t\t\treturn overdue === 1\n\t\t\t\t\t? t('nextcloud-vue', '1 day overdue')\n\t\t\t\t\t: t('nextcloud-vue', '{count} days overdue', { count: overdue })\n\t\t\t}\n\t\t\tif (days === 0) {\n\t\t\t\treturn t('nextcloud-vue', 'Due today')\n\t\t\t}\n\t\t\tconst labels = this.content?.daysLabel\n\t\t\tif (labels && typeof labels === 'object' && (labels.one || labels.other)) {\n\t\t\t\tconst template = this.translate((days === 1 ? labels.one : labels.other) || labels.other || labels.one)\n\t\t\t\treturn template.replace(/\\{count\\}/g, String(days))\n\t\t\t}\n\t\t\tif (days === 1) {\n\t\t\t\treturn t('nextcloud-vue', '1 day left')\n\t\t\t}\n\t\t\treturn t('nextcloud-vue', '{count} days left', { count: days })\n\t\t},\n\n\t\t/**\n\t\t * Whether the app takes the board look: no icon circle.\n\t\t *\n\t\t * @return {boolean} True in the board look.\n\t\t * @spec openspec/changes/countdown-board-look/specs/countdown-board-look/spec.md#requirement-the-countdown-draws-the-boards-term-card\n\t\t */\n\t\tisBoardLook() {\n\t\t\treturn normalizeLook(this.cnLook) === 'board'\n\t\t},\n\n\t\t/**\n\t\t * How much of the term has passed, from `startField` to the date, in\n\t\t * whole days and as a percentage (0 to 100), or null without a usable\n\t\t * start.\n\t\t *\n\t\t * @return {number|null} The share passed.\n\t\t * @spec openspec/changes/countdown-board-look/specs/countdown-board-look/spec.md#requirement-the-countdown-draws-the-boards-term-card\n\t\t */\n\t\tprogress() {\n\t\t\tconst field = this.content?.startField\n\t\t\tif (!field || !this.record || !this.targetDate || this.isSettled) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst raw = getByPath(this.record, field)\n\t\t\tconst start = raw === null || raw === undefined || raw === '' ? null : new Date(raw)\n\t\t\tif (!start || Number.isNaN(start.getTime())) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst startOfDay = (d) => Date.UTC(d.getFullYear(), d.getMonth(), d.getDate())\n\t\t\tconst span = startOfDay(this.targetDate) - startOfDay(start)\n\t\t\tif (span <= 0) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\treturn Math.min(100, Math.max(0, ((startOfDay(new Date()) - startOfDay(start)) / span) * 100))\n\t\t},\n\n\t\t/**\n\t\t * The `facts` rows under the caption (`[{ label, field }]`), with\n\t\t * their values read off the record; a row without a value is left out.\n\t\t *\n\t\t * @return {Array<{label: string, value: string}>} The rows.\n\t\t * @spec openspec/changes/countdown-board-look/specs/countdown-board-look/spec.md#requirement-the-countdown-draws-the-boards-term-card\n\t\t */\n\t\tfacts() {\n\t\t\tconst rows = Array.isArray(this.content?.facts) ? this.content.facts : []\n\t\t\treturn rows\n\t\t\t\t.filter((row) => row && typeof row.label === 'string' && typeof row.field === 'string')\n\t\t\t\t.map((row) => {\n\t\t\t\t\tconst value = this.record ? getByPath(this.record, row.field) : null\n\t\t\t\t\treturn { label: this.translate(row.label), value: value === null || value === undefined ? '' : this.translate(String(value)) }\n\t\t\t\t})\n\t\t\t\t.filter((row) => row.value !== '')\n\t\t},\n\n\t\t/** @return {string} The accessible name of the progress bar. */\n\t\tprogressLabel() {\n\t\t\treturn t('nextcloud-vue', 'Time passed')\n\t\t},\n\n\t\t/**\n\t\t * The label of `content.action`, translated, or ''.\n\t\t *\n\t\t * @return {string} The label.\n\t\t * @spec openspec/changes/countdown-board-look/specs/countdown-board-look/spec.md#requirement-the-countdown-draws-the-boards-term-card\n\t\t */\n\t\tactionLabel() {\n\t\t\tconst action = this.content?.action\n\t\t\treturn action && typeof action === 'object' && typeof action.label === 'string' && action.label !== ''\n\t\t\t\t? this.translate(action.label)\n\t\t\t\t: ''\n\t\t},\n\n\t\t/**\n\t\t * The absolute date under the headline, so the tile answers \"how long\"\n\t\t * and \"when\" at once.\n\t\t *\n\t\t * @return {string} The formatted date, or ''.\n\t\t */\n\t\tsubLabel() {\n\t\t\tif (!this.targetDate && typeof this.content?.emptyCaption === 'string' && this.content.emptyCaption !== '') {\n\t\t\t\tconst raw = this.content.emptyDateField && this.record ? getByPath(this.record, this.content.emptyDateField) : null\n\t\t\t\tconst when = raw ? new Date(raw) : null\n\t\t\t\tconst date = when && !Number.isNaN(when.getTime()) ? when.toLocaleDateString(userLocale(), { day: 'numeric', month: 'long', year: 'numeric' }) : ''\n\t\t\t\treturn this.translate(this.content.emptyCaption).replace(/\\{date\\}/g, date)\n\t\t\t}\n\t\t\tif (!this.targetDate || this.content?.showDate === false) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst date = this.targetDate.toLocaleDateString(userLocale(), { day: 'numeric', month: 'long', year: 'numeric' })\n\t\t\tconst caption = this.content?.caption\n\t\t\tif (typeof caption === 'string' && caption !== '') {\n\t\t\t\treturn this.translate(caption).replace(/\\{date\\}/g, date).replace(/\\{count\\}/g, String(this.daysRemaining ?? ''))\n\t\t\t}\n\t\t\treturn date\n\t\t},\n\n\t\t/**\n\t\t * The threshold band this date falls in.\n\t\t *\n\t\t * @return {string} One of default / success / warning / error.\n\t\t * @spec openspec/changes/countdown-settled-record/specs/countdown-settled-record/spec.md#requirement-a-settled-record-never-reads-as-overdue\n\t\t */\n\t\tvariant() {\n\t\t\tconst days = this.daysRemaining\n\t\t\tif (days === null || this.isSettled) {\n\t\t\t\treturn 'default'\n\t\t\t}\n\t\t\tif (days < 0) {\n\t\t\t\treturn 'error'\n\t\t\t}\n\t\t\tconst thresholds = this.content?.thresholds || {}\n\t\t\tif (Number.isFinite(thresholds.danger) && days <= thresholds.danger) {\n\t\t\t\treturn 'error'\n\t\t\t}\n\t\t\tif (Number.isFinite(thresholds.warn) && days <= thresholds.warn) {\n\t\t\t\treturn 'warning'\n\t\t\t}\n\t\t\treturn 'default'\n\t\t},\n\n\t\t/** @return {string} The value colour for the current band. */\n\t\tvalueColor() {\n\t\t\tif (this.isBoardLook && this.variant === 'default') {\n\t\t\t\treturn 'var(--color-main-text)'\n\t\t\t}\n\t\t\treturn VARIANT_COLORS[this.variant] || VARIANT_COLORS.default\n\t\t},\n\n\t\t/** @return {string} The tile label. */\n\t\tresolvedLabel() {\n\t\t\treturn this.content?.label || ''\n\t\t},\n\n\t\t/** @return {string} The MDI icon name. */\n\t\tresolvedIcon() {\n\t\t\treturn this.content?.icon || 'ClockOutline'\n\t\t},\n\n\t\t/** @return {object} Inline style for the icon circle. */\n\t\ticonCircleStyle() {\n\t\t\treturn { color: this.valueColor }\n\t\t},\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * The host's translate, or the text unchanged.\n\t\t *\n\t\t * @param {string} text The text.\n\t\t * @return {string} The translation.\n\t\t */\n\t\ttranslate(text) {\n\t\t\treturn typeof this.cnTranslate === 'function' ? this.cnTranslate(text) : text\n\t\t},\n\n\t\t/**\n\t\t * Dispatch `content.action` with the record's tokens resolved, through\n\t\t * the page's dispatcher when there is one.\n\t\t *\n\t\t * @return {unknown}\n\t\t * @spec openspec/changes/countdown-board-look/specs/countdown-board-look/spec.md#requirement-the-countdown-draws-the-boards-term-card\n\t\t */\n\t\trunAction() {\n\t\t\tconst action = this.content?.action\n\t\t\tif (!action || typeof action !== 'object') {\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\tconst ctx = resolveObjectTokenContext(this.cnObjectContextInjected, this.cnDetailObjectContextInjected) || {}\n\t\t\tconst tokenCtx = { ...ctx, object: this.record || ctx.object || null, objectId: this.record?.id ?? ctx.objectId ?? null }\n\t\t\tconst resolved = resolveDeepTokens(action, tokenCtx)\n\t\t\tif (typeof this.cnDispatchAction === 'function') {\n\t\t\t\treturn this.cnDispatchAction(resolved)\n\t\t\t}\n\t\t\treturn dispatchAction(resolved, { router: this.$router || null, tokenCtx })\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-countdown-widget__value {\n\twhite-space: nowrap;\n}\n\n/* The bar spans the card: the KPI body aligns its items to the start, which\n left the empty track 0px wide. */\n.cn-countdown-widget__progress {\n\talign-self: stretch;\n\tbackground: var(--color-border);\n\tborder-radius: 3px;\n\tdisplay: block;\n\theight: 6px;\n\tmargin-block-start: 10px;\n\toverflow: hidden;\n}\n\n.cn-countdown-widget__progress-fill {\n\tbackground: var(--color-primary-element);\n\tdisplay: block;\n\theight: 100%;\n}\n\n.cn-countdown-widget__action {\n\talign-self: flex-start;\n\tbackground: var(--color-background-dark);\n\tborder: 0;\n\tborder-radius: var(--border-radius-pill, 17px);\n\tcolor: var(--color-main-text);\n\tfont-weight: 600;\n\tmargin-block-start: 10px;\n\tmin-height: 34px;\n\tpadding: 0 12px;\n}\n\n/* The board draws the term card's action as a 34px chip with 13px text and\n a 17px radius (DqZaak \"Termijn opschorten\"); Nextcloud's pill radius is\n 100px and its text 15px. */\n.cn-countdown-widget--board .cn-countdown-widget__action {\n\tborder-radius: 17px;\n\tfont-size: 13px;\n}\n\n/* The board stacks the term card 10px apart: the days, the date line, the\n bar and the action (DqZaak \"Termijn\": r33 live 2 / 11.9 / 5 against 10,\n card 182.7 against 188). */\n.cn-countdown-widget--board .cn-kpi-card__body {\n\tgap: 10px;\n}\n\n.cn-countdown-widget--board .cn-countdown-widget__progress.cn-countdown-widget__progress,\n.cn-countdown-widget--board .cn-countdown-widget__action.cn-countdown-widget__action {\n\tmargin: 0;\n}\n\n.cn-countdown-widget__action--primary {\n\tbackground: var(--color-primary-element-light);\n\tcolor: var(--color-primary-element-light-text);\n}\n\n.cn-countdown-widget__facts {\n\tdisplay: grid;\n\tgap: 8px 16px;\n\tgrid-template-columns: max-content 1fr;\n\tmargin: 10px 0 0;\n}\n\n.cn-countdown-widget__facts dt {\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-countdown-widget__facts dd {\n\tmargin: 0;\n}\n\n.cn-countdown-widget__action:hover,\n.cn-countdown-widget__action:focus-visible {\n\tbackground: var(--color-background-hover);\n}\n\n.cn-countdown-widget__sub {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 0.85em;\n}\n</style>\n"],"names":["_createVNode","_createElementBlock","_toDisplayString","_createElementVNode","_openBlock","_Fragment","_renderList","_normalizeClass"],"mappings":";;AAkBO,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,mBAAI,GAAA;;;AACT,EAAA,KAAA,EAAA,oBAAA;;;;AAMgB,EAAA,KAAK,EAAA,0BAAA;AAAA,EAAA,aAAA,EAAA,kBAAA;;;;AAGtB,EAAA,KAAA,EAAA,4BAAA;AAAA,EAAA,aAAA,EAAA,oBAAA;;;;;;;;8DAfyB,CAAA,CAAA,qBAAA,EAAA,QAAA,CAAA,OAAA,uDAAA,QAAA,CAAA,WAAA,EAAA,CAAA,CAAA,CAAA;;MAClB,QAAW,CAAA,WAAA;wCAEjB,CAAA,KAAA,EAAA;;AAFmB,UAAA,KAAK,EAAC,6CAAsB;AAAA,UAAA,KAAA,iBAAA,QAAA,CAAA,eAAA,CAAA;;UACnDA,WAAkB,CAAA,uBAAA,EAAA;AAAJ,YAAA,IAAI,EAAA,QAAA,CAAA,YAAA;AAAA,YAAA,IAAA,EAAA,EAAA;;;;;OAId,QAAA,CAAA,aAAA;wBAALC,kBAEM,CAAA,KAAA,EAFN,UAEM,EAAAC,eAAA,CADH,QAAc,CAAA,aAAA,CAAA,EAAA,CAAA,YAAA;;MAEjBC,kBAEM,CAAA,KAAA,EAAA;AAFD,QAAA,KAAA,EAAA,+CAAA;AAAA,QAAA,KAAA,0BAAA,QAAA,CAAA,UAAA,EAAA,CAAA;yBACD,QAAQ,CAAA,QAAA,CAAA,EAAA,CAAA,mBAAA;OAED,QAAS,CAAA,QAAA;0CAEd,CAAA,KAAA,YAAA,EAAAD,eAAA,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BAAA;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"CnCountdownWidget.vue3.js","sources":["../../../../src/components/CnCountdownWidget/CnCountdownWidget.vue?vue&type=template&id=69debc7c&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<div\n\t\tclass=\"cn-kpi-card cn-countdown-widget\"\n\t\t:class=\"[`cn-countdown-widget--${variant}`, { 'cn-kpi-card--board cn-countdown-widget--board': isBoardLook }]\">\n\t\t<div v-if=\"!isBoardLook\" class=\"cn-kpi-card__icon cn-countdown-widget__icon\" :style=\"iconCircleStyle\">\n\t\t\t<CnWidgetIcon :name=\"resolvedIcon\" :size=\"24\" />\n\t\t</div>\n\n\t\t<div class=\"cn-kpi-card__body\">\n\t\t\t<div v-if=\"resolvedLabel\" class=\"cn-kpi-card__title\">\n\t\t\t\t{{ resolvedLabel }}\n\t\t\t</div>\n\t\t\t<div class=\"cn-kpi-card__value cn-countdown-widget__value\" :style=\"{ color: valueColor }\">\n\t\t\t\t{{ headline }}\n\t\t\t</div>\n\t\t\t<div v-if=\"subLabel\" class=\"cn-countdown-widget__sub\" data-testid=\"cn-countdown-sub\">\n\t\t\t\t{{ subLabel }}\n\t\t\t</div>\n\t\t\t<dl v-if=\"facts.length\" class=\"cn-countdown-widget__facts\" data-testid=\"cn-countdown-facts\">\n\t\t\t\t<template v-for=\"fact in facts\" :key=\"fact.label\">\n\t\t\t\t\t<dt>{{ fact.label }}</dt>\n\t\t\t\t\t<dd>{{ fact.value }}</dd>\n\t\t\t\t</template>\n\t\t\t</dl>\n\t\t\t<span\n\t\t\t\tv-if=\"progress !== null\"\n\t\t\t\tclass=\"cn-countdown-widget__progress\"\n\t\t\t\trole=\"meter\"\n\t\t\t\t:aria-label=\"progressLabel\"\n\t\t\t\t:aria-valuenow=\"Math.round(progress)\"\n\t\t\t\taria-valuemin=\"0\"\n\t\t\t\taria-valuemax=\"100\"\n\t\t\t\tdata-testid=\"cn-countdown-progress\">\n\t\t\t\t<span class=\"cn-countdown-widget__progress-fill\" :style=\"{ width: `${progress}%` }\" />\n\t\t\t</span>\n\t\t\t<CnNoteCard\n\t\t\t\tv-if=\"stateNotice\"\n\t\t\t\tclass=\"cn-countdown-widget__notice\"\n\t\t\t\t:type=\"stateNotice.type\"\n\t\t\t\t:heading=\"stateNotice.lead || undefined\"\n\t\t\t\t:text=\"stateNotice.text\"\n\t\t\t\tdata-testid=\"cn-countdown-notice\" />\n\t\t\t<div v-if=\"actionButtons.length\" class=\"cn-countdown-widget__actions\">\n\t\t\t\t<button\n\t\t\t\t\tv-for=\"button in actionButtons\"\n\t\t\t\t\t:key=\"button.index\"\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tclass=\"cn-countdown-widget__action\"\n\t\t\t\t\t:class=\"{ 'cn-countdown-widget__action--primary': button.primary }\"\n\t\t\t\t\t:disabled=\"button.disabled\"\n\t\t\t\t\t:aria-disabled=\"button.disabled ? 'true' : null\"\n\t\t\t\t\tdata-testid=\"cn-countdown-action\"\n\t\t\t\t\t@click=\"runAction(button.action)\">\n\t\t\t\t\t{{ button.label }}\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { inject } from 'vue'\nimport CnNoteCard from '../CnNoteCard/CnNoteCard.vue'\nimport CnWidgetIcon from '../CnWidgetGrid/CnWidgetIcon.vue'\nimport { getByPath } from '../../composables/useEndpointSource.js'\nimport { normalizeLook } from '../../composables/useLook.js'\nimport { dispatchAction } from '../../utils/actionsDispatcher.js'\nimport { resolveObjectTokenContext } from '../../utils/detailObjectContext.js'\nimport { resolveDeepTokens } from '../../utils/resolveFilterTokens.js'\nimport { userLocale } from '../../utils/userLocale.js'\n\nconst MS_PER_DAY = 24 * 60 * 60 * 1000\n\n/** The note-card types a state notice may take. */\nconst NOTICE_TYPES = ['success', 'info', 'warning', 'error']\n\n/** The note-card type of each state's notice when the notice names none. */\nconst DEFAULT_NOTICE_TYPES = Object.freeze({\n\tonTrack: 'info',\n\twarning: 'warning',\n\tdanger: 'error',\n\toverdue: 'error',\n\textended: 'info',\n})\n\nconst VARIANT_COLORS = Object.freeze({\n\tdefault: 'var(--color-primary-element)',\n\tsuccess: 'var(--color-success)',\n\twarning: 'var(--color-warning)',\n\terror: 'var(--color-error)',\n})\n\n/**\n * CnCountdownWidget — a KPI tile for how long is left until a date on the\n * bound record.\n *\n * Every other tile in the catalog answers \"how many\" by aggregating or calling\n * an endpoint. This one answers \"how long\", and it needs neither: the record is\n * already loaded by the detail page, so the tile reads the date straight off it\n * and does the arithmetic. No request, and nothing to go stale.\n *\n * It headlines the remaining time and carries the date itself underneath,\n * because \"12 days left\" and \"5 October\" answer different questions and a\n * handler asks both.\n *\n * ## Thresholds\n *\n * `thresholds` recolours the tile as the date approaches, in days:\n *\n * ```js\n * content: {\n * label: 'Time left',\n * field: 'deadline',\n * icon: 'ClockAlertOutline',\n * thresholds: { warn: 14, danger: 5 },\n * }\n * ```\n *\n * A date in the past reads \"overdue by N days\" in the error colour, never a\n * negative number: \"-3 days left\" is a puzzle, and an overdue case is the one\n * state a handler must not have to decode.\n *\n * ## A settled record\n *\n * `settledField` names a property on the record that is truthy once the work\n * the date belongs to is done, such as a case in its final status. A settled\n * record reads `settledLabel` (default \"Closed\") in no threshold colour, never\n * \"overdue\": a closed case missed nothing that can still be acted on, and a red\n * count of days on it sends a handler after a case that needs nobody.\n *\n * ```js\n * content: { field: 'deadline', settledField: 'isFinalStatus', settledLabel: 'Handled' }\n * ```\n *\n * ## The states of a term\n *\n * A term card reads differently as its date nears. `states` gives each state\n * its own headline, caption and notice, and `actions` puts several buttons\n * under the card, each greyed out in the states its `disabledIn` names:\n *\n * ```js\n * content: {\n * field: 'deadline',\n * thresholds: { warn: 14, danger: 7 },\n * extendedField: 'extendedOn',\n * states: {\n * warning: { notice: { lead: 'Watch the term', text: 'Two weeks left.' } },\n * overdue: { headline: 'Term passed', caption: 'Was due {date}, {count} days ago' },\n * },\n * actions: [\n * { label: 'Extend', type: 'handler', handler: 'extendTerm', disabledIn: ['overdue', 'extended'] },\n * { label: 'Suspend', type: 'handler', handler: 'suspendTerm' },\n * ],\n * }\n * ```\n *\n * The state is `overdue` past the date, else `danger` or `warning` by the\n * thresholds, else `extended` when `extendedField` is truthy, else `onTrack`.\n * `extended` also counts for `disabledIn` while a threshold applies, so a\n * term extended once cannot be extended again a week before its end.\n *\n * ## An unset date\n *\n * Renders a dash and no threshold colour. A case with no deadline is not urgent\n * and is not on time; it simply has no deadline, and colouring it green would\n * claim otherwise.\n */\nexport default {\n\tname: 'CnCountdownWidget',\n\n\tcomponents: {\n\t\tCnNoteCard,\n\t\tCnWidgetIcon,\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * The tile's config.\n\t\t *\n\t\t * - `field` — property on the bound record holding the target date.\n\t\t * - `label` — the tile's title.\n\t\t * - `icon` — MDI icon name.\n\t\t * - `thresholds` — `{ warn, danger }` in days remaining.\n\t\t * - `showDate` — render the absolute date underneath (default true).\n\t\t * - `settledField` — property on the record that is truthy once the work is done; the tile then reads `settledLabel` and never counts overdue.\n\t\t * - `settledLabel` — the headline of a settled record, run through the host's translate function (default \"Closed\").\n\t\t * - `daysLabel` — `{ one, other }` with `{count}`, the headline while days remain (\"27 dagen\").\n\t\t * - `caption` — the line under the headline instead of the date, with `{date}` (the long date) and `{count}` (days left).\n\t\t * - `startField` — property holding the start of the term; a bar then shows how much of it has passed.\n\t\t * - `action` — one manifest action under the card (`{ label, type, variant?, ... }`, the headerActions shape; `variant: \"primary\"` draws it in the primary tint).\n\t\t * - `emptyLabel` — the headline while the date is unset (default a dash).\n\t\t * - `emptyCaption` — the line under it while the date is unset, with `{date}` read from `emptyDateField`.\n\t\t * - `facts` — `[{ label, field }]` rows under the caption.\n\t\t * - `extendedField` — property on the record that is truthy once the term has been extended.\n\t\t * - `states` — per state (`onTrack`, `warning`, `danger`, `overdue`, `extended`) a `{ headline?, caption?, notice?: { lead?, text?, type? } }`; texts take `{date}` and `{count}` and run through the host's translate.\n\t\t * - `actions` — several manifest actions under the card, each with an optional `disabledIn` list of states.\n\t\t *\n\t\t * @type {{ field?: string, label?: string, icon?: string, thresholds?: {warn?: number, danger?: number}, showDate?: boolean, settledField?: string, settledLabel?: string, daysLabel?: {one?: string, other?: string}, caption?: string, startField?: string, action?: object, emptyLabel?: string, emptyCaption?: string, emptyDateField?: string, facts?: Array<{label: string, field: string}>, extendedField?: string, states?: object, actions?: Array<object> }}\n\t\t */\n\t\tcontent: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/**\n\t\t * The bound record, when the surface passes it explicitly. Falls back to\n\t\t * the injected `cnObjectContext` a detail page provides.\n\t\t *\n\t\t * @type {object|null}\n\t\t */\n\t\tobjectData: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\t},\n\n\tsetup() {\n\t\treturn {\n\t\t\tcnObjectContextInjected: inject('cnObjectContext', null),\n\t\t\tcnDetailObjectContextInjected: inject('cnDetailObjectContext', null),\n\t\t\tcnTranslate: inject('cnTranslate', null),\n\t\t\tcnLook: inject('cnLook', 'nextcloud'),\n\t\t\tcnDispatchAction: inject('cnDispatchAction', null),\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * The record to read the date from.\n\t\t *\n\t\t * @return {object|null} The bound record, or null.\n\t\t */\n\t\trecord() {\n\t\t\tif (this.objectData) {\n\t\t\t\treturn this.objectData\n\t\t\t}\n\t\t\tconst ctx = resolveObjectTokenContext(this.cnObjectContextInjected, this.cnDetailObjectContextInjected)\n\t\t\treturn ctx?.object || null\n\t\t},\n\n\t\t/**\n\t\t * The target date, or null when unset or unparseable.\n\t\t *\n\t\t * @return {Date|null} The parsed date.\n\t\t */\n\t\ttargetDate() {\n\t\t\tconst field = this.content?.field\n\t\t\tif (!this.record || !field) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst raw = getByPath(this.record, field)\n\t\t\tif (raw === null || raw === undefined || raw === '') {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst parsed = new Date(raw)\n\t\t\treturn Number.isNaN(parsed.getTime()) ? null : parsed\n\t\t},\n\n\t\t/**\n\t\t * Whole days from today until the target. Negative once it has passed.\n\t\t *\n\t\t * Both ends are floored to midnight first, so \"tomorrow\" is 1 day away\n\t\t * all day today rather than flipping to 0 at lunchtime.\n\t\t *\n\t\t * @return {number|null} Days remaining, or null.\n\t\t */\n\t\tdaysRemaining() {\n\t\t\tif (!this.targetDate) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst startOfDay = (d) => Date.UTC(d.getFullYear(), d.getMonth(), d.getDate())\n\t\t\treturn Math.round((startOfDay(this.targetDate) - startOfDay(new Date())) / MS_PER_DAY)\n\t\t},\n\n\t\t/**\n\t\t * Whether the record says its work is done (`settledField` is truthy).\n\t\t *\n\t\t * @return {boolean} True for a settled record.\n\t\t * @spec openspec/changes/countdown-settled-record/specs/countdown-settled-record/spec.md#requirement-a-settled-record-never-reads-as-overdue\n\t\t */\n\t\tisSettled() {\n\t\t\tconst field = this.content?.settledField\n\t\t\tif (!this.record || !field) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn Boolean(getByPath(this.record, field))\n\t\t},\n\n\t\t/**\n\t\t * Whether the date has passed on a record still open.\n\t\t *\n\t\t * @return {boolean} True when overdue.\n\t\t * @spec openspec/changes/countdown-settled-record/specs/countdown-settled-record/spec.md#requirement-a-settled-record-never-reads-as-overdue\n\t\t */\n\t\tisOverdue() {\n\t\t\treturn !this.isSettled && this.daysRemaining !== null && this.daysRemaining < 0\n\t\t},\n\n\t\t/**\n\t\t * The headline: the remaining time in words.\n\t\t *\n\t\t * @return {string} The headline text.\n\t\t * @spec openspec/changes/countdown-settled-record/specs/countdown-settled-record/spec.md#requirement-a-settled-record-never-reads-as-overdue\n\t\t */\n\t\theadline() {\n\t\t\tif (this.isSettled) {\n\t\t\t\tconst label = this.content?.settledLabel\n\t\t\t\tif (label) {\n\t\t\t\t\treturn typeof this.cnTranslate === 'function' ? this.cnTranslate(label) : label\n\t\t\t\t}\n\t\t\t\treturn t('nextcloud-vue', 'Closed')\n\t\t\t}\n\t\t\tconst days = this.daysRemaining\n\t\t\tif (this.stateConfig.headline) {\n\t\t\t\treturn this.fillStateText(this.stateConfig.headline)\n\t\t\t}\n\t\t\tif (days === null) {\n\t\t\t\treturn this.content?.emptyLabel ? this.translate(this.content.emptyLabel) : '—'\n\t\t\t}\n\t\t\tif (days < 0) {\n\t\t\t\tconst overdue = Math.abs(days)\n\t\t\t\treturn overdue === 1\n\t\t\t\t\t? t('nextcloud-vue', '1 day overdue')\n\t\t\t\t\t: t('nextcloud-vue', '{count} days overdue', { count: overdue })\n\t\t\t}\n\t\t\tif (days === 0) {\n\t\t\t\treturn t('nextcloud-vue', 'Due today')\n\t\t\t}\n\t\t\tconst labels = this.content?.daysLabel\n\t\t\tif (labels && typeof labels === 'object' && (labels.one || labels.other)) {\n\t\t\t\tconst template = this.translate((days === 1 ? labels.one : labels.other) || labels.other || labels.one)\n\t\t\t\treturn template.replace(/\\{count\\}/g, String(days))\n\t\t\t}\n\t\t\tif (days === 1) {\n\t\t\t\treturn t('nextcloud-vue', '1 day left')\n\t\t\t}\n\t\t\treturn t('nextcloud-vue', '{count} days left', { count: days })\n\t\t},\n\n\t\t/**\n\t\t * Whether the app takes the board look: no icon circle.\n\t\t *\n\t\t * @return {boolean} True in the board look.\n\t\t * @spec openspec/changes/countdown-board-look/specs/countdown-board-look/spec.md#requirement-the-countdown-draws-the-boards-term-card\n\t\t */\n\t\tisBoardLook() {\n\t\t\treturn normalizeLook(this.cnLook) === 'board'\n\t\t},\n\n\t\t/**\n\t\t * How much of the term has passed, from `startField` to the date, in\n\t\t * whole days and as a percentage (0 to 100), or null without a usable\n\t\t * start.\n\t\t *\n\t\t * @return {number|null} The share passed.\n\t\t * @spec openspec/changes/countdown-board-look/specs/countdown-board-look/spec.md#requirement-the-countdown-draws-the-boards-term-card\n\t\t */\n\t\tprogress() {\n\t\t\tconst field = this.content?.startField\n\t\t\tif (!field || !this.record || !this.targetDate || this.isSettled) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst raw = getByPath(this.record, field)\n\t\t\tconst start = raw === null || raw === undefined || raw === '' ? null : new Date(raw)\n\t\t\tif (!start || Number.isNaN(start.getTime())) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst startOfDay = (d) => Date.UTC(d.getFullYear(), d.getMonth(), d.getDate())\n\t\t\tconst span = startOfDay(this.targetDate) - startOfDay(start)\n\t\t\tif (span <= 0) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\treturn Math.min(100, Math.max(0, ((startOfDay(new Date()) - startOfDay(start)) / span) * 100))\n\t\t},\n\n\t\t/**\n\t\t * The `facts` rows under the caption (`[{ label, field }]`), with\n\t\t * their values read off the record; a row without a value is left out.\n\t\t *\n\t\t * @return {Array<{label: string, value: string}>} The rows.\n\t\t * @spec openspec/changes/countdown-board-look/specs/countdown-board-look/spec.md#requirement-the-countdown-draws-the-boards-term-card\n\t\t */\n\t\tfacts() {\n\t\t\tconst rows = Array.isArray(this.content?.facts) ? this.content.facts : []\n\t\t\treturn rows\n\t\t\t\t.filter((row) => row && typeof row.label === 'string' && typeof row.field === 'string')\n\t\t\t\t.map((row) => {\n\t\t\t\t\tconst value = this.record ? getByPath(this.record, row.field) : null\n\t\t\t\t\treturn { label: this.translate(row.label), value: value === null || value === undefined ? '' : this.translate(String(value)) }\n\t\t\t\t})\n\t\t\t\t.filter((row) => row.value !== '')\n\t\t},\n\n\t\t/**\n\t\t * Whether the record says its term has been extended (`extendedField`).\n\t\t *\n\t\t * @return {boolean} True for an extended term.\n\t\t * @spec openspec/changes/countdown-term-states/specs/countdown-term-states/spec.md#requirement-a-term-card-reads-per-state\n\t\t */\n\t\tisExtended() {\n\t\t\tconst field = this.content?.extendedField\n\t\t\treturn Boolean(field && this.record && getByPath(this.record, field))\n\t\t},\n\n\t\t/**\n\t\t * The state of the term: `overdue`, `danger`, `warning`, `extended` or\n\t\t * `onTrack`; null while the date is unset or the record is settled.\n\t\t *\n\t\t * @return {string|null} The state.\n\t\t * @spec openspec/changes/countdown-term-states/specs/countdown-term-states/spec.md#requirement-a-term-card-reads-per-state\n\t\t */\n\t\ttermState() {\n\t\t\tif (this.daysRemaining === null || this.isSettled) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tif (this.daysRemaining < 0) {\n\t\t\t\treturn 'overdue'\n\t\t\t}\n\t\t\tif (this.variant === 'error') {\n\t\t\t\treturn 'danger'\n\t\t\t}\n\t\t\tif (this.variant === 'warning') {\n\t\t\t\treturn 'warning'\n\t\t\t}\n\t\t\treturn this.isExtended ? 'extended' : 'onTrack'\n\t\t},\n\n\t\t/**\n\t\t * Every state that holds now: the term state, plus `extended` while a\n\t\t * threshold or the date outranks it.\n\t\t *\n\t\t * @return {string[]} The states.\n\t\t * @spec openspec/changes/countdown-term-states/specs/countdown-term-states/spec.md#requirement-an-action-can-be-greyed-out-per-state\n\t\t */\n\t\tactiveStates() {\n\t\t\tif (this.termState === null) {\n\t\t\t\treturn []\n\t\t\t}\n\t\t\treturn this.isExtended && this.termState !== 'extended' ? [this.termState, 'extended'] : [this.termState]\n\t\t},\n\n\t\t/**\n\t\t * The `states` entry of the current state, or an empty object.\n\t\t *\n\t\t * @return {{headline?: string, caption?: string, notice?: object}} The entry.\n\t\t * @spec openspec/changes/countdown-term-states/specs/countdown-term-states/spec.md#requirement-a-term-card-reads-per-state\n\t\t */\n\t\tstateConfig() {\n\t\t\tconst states = this.content?.states\n\t\t\tconst entry = this.termState && states && typeof states === 'object' ? states[this.termState] : null\n\t\t\treturn entry && typeof entry === 'object' ? entry : {}\n\t\t},\n\n\t\t/**\n\t\t * The notice of the current state, its texts filled in, or null.\n\t\t *\n\t\t * @return {{lead: string, text: string, type: string}|null} The notice.\n\t\t * @spec openspec/changes/countdown-term-states/specs/countdown-term-states/spec.md#requirement-a-term-card-reads-per-state\n\t\t */\n\t\tstateNotice() {\n\t\t\tconst notice = this.stateConfig.notice\n\t\t\tif (!notice || typeof notice !== 'object' || (!notice.lead && !notice.text)) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst type = NOTICE_TYPES.includes(notice.type) ? notice.type : DEFAULT_NOTICE_TYPES[this.termState]\n\t\t\treturn {\n\t\t\t\tlead: notice.lead ? this.fillStateText(notice.lead) : '',\n\t\t\t\ttext: notice.text ? this.fillStateText(notice.text) : '',\n\t\t\t\ttype,\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * The buttons under the card: `content.actions`, or `content.action`\n\t\t * alone, each greyed out while a state its `disabledIn` names holds.\n\t\t *\n\t\t * @return {Array<{index: number, label: string, primary: boolean, disabled: boolean, action: object}>} The buttons.\n\t\t * @spec openspec/changes/countdown-term-states/specs/countdown-term-states/spec.md#requirement-an-action-can-be-greyed-out-per-state\n\t\t */\n\t\tactionButtons() {\n\t\t\tconst list = Array.isArray(this.content?.actions) ? this.content.actions : [this.content?.action]\n\t\t\treturn list\n\t\t\t\t.map((action, index) => ({ action, index }))\n\t\t\t\t.filter(({ action }) => action && typeof action === 'object' && typeof action.label === 'string' && action.label !== '')\n\t\t\t\t.map(({ action, index }) => ({\n\t\t\t\t\tindex,\n\t\t\t\t\tlabel: this.translate(action.label),\n\t\t\t\t\tprimary: action.variant === 'primary',\n\t\t\t\t\tdisabled: Array.isArray(action.disabledIn) && action.disabledIn.some((state) => this.activeStates.includes(state)),\n\t\t\t\t\taction,\n\t\t\t\t}))\n\t\t},\n\n\t\t/** @return {string} The accessible name of the progress bar. */\n\t\tprogressLabel() {\n\t\t\treturn t('nextcloud-vue', 'Time passed')\n\t\t},\n\n\t\t/**\n\t\t * The absolute date under the headline, so the tile answers \"how long\"\n\t\t * and \"when\" at once.\n\t\t *\n\t\t * @return {string} The formatted date, or ''.\n\t\t */\n\t\tsubLabel() {\n\t\t\tif (!this.targetDate && typeof this.content?.emptyCaption === 'string' && this.content.emptyCaption !== '') {\n\t\t\t\tconst raw = this.content.emptyDateField && this.record ? getByPath(this.record, this.content.emptyDateField) : null\n\t\t\t\tconst when = raw ? new Date(raw) : null\n\t\t\t\tconst date = when && !Number.isNaN(when.getTime()) ? when.toLocaleDateString(userLocale(), { day: 'numeric', month: 'long', year: 'numeric' }) : ''\n\t\t\t\treturn this.translate(this.content.emptyCaption).replace(/\\{date\\}/g, date)\n\t\t\t}\n\t\t\tif (!this.targetDate || this.content?.showDate === false) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tif (this.stateConfig.caption) {\n\t\t\t\treturn this.fillStateText(this.stateConfig.caption)\n\t\t\t}\n\t\t\tconst date = this.targetDate.toLocaleDateString(userLocale(), { day: 'numeric', month: 'long', year: 'numeric' })\n\t\t\tconst caption = this.content?.caption\n\t\t\tif (typeof caption === 'string' && caption !== '') {\n\t\t\t\treturn this.translate(caption).replace(/\\{date\\}/g, date).replace(/\\{count\\}/g, String(this.daysRemaining ?? ''))\n\t\t\t}\n\t\t\treturn date\n\t\t},\n\n\t\t/**\n\t\t * The threshold band this date falls in.\n\t\t *\n\t\t * @return {string} One of default / success / warning / error.\n\t\t * @spec openspec/changes/countdown-settled-record/specs/countdown-settled-record/spec.md#requirement-a-settled-record-never-reads-as-overdue\n\t\t */\n\t\tvariant() {\n\t\t\tconst days = this.daysRemaining\n\t\t\tif (days === null || this.isSettled) {\n\t\t\t\treturn 'default'\n\t\t\t}\n\t\t\tif (days < 0) {\n\t\t\t\treturn 'error'\n\t\t\t}\n\t\t\tconst thresholds = this.content?.thresholds || {}\n\t\t\tif (Number.isFinite(thresholds.danger) && days <= thresholds.danger) {\n\t\t\t\treturn 'error'\n\t\t\t}\n\t\t\tif (Number.isFinite(thresholds.warn) && days <= thresholds.warn) {\n\t\t\t\treturn 'warning'\n\t\t\t}\n\t\t\treturn 'default'\n\t\t},\n\n\t\t/** @return {string} The value colour for the current band. */\n\t\tvalueColor() {\n\t\t\tif (this.isBoardLook && this.variant === 'default') {\n\t\t\t\treturn 'var(--color-main-text)'\n\t\t\t}\n\t\t\treturn VARIANT_COLORS[this.variant] || VARIANT_COLORS.default\n\t\t},\n\n\t\t/** @return {string} The tile label. */\n\t\tresolvedLabel() {\n\t\t\treturn this.content?.label || ''\n\t\t},\n\n\t\t/** @return {string} The MDI icon name. */\n\t\tresolvedIcon() {\n\t\t\treturn this.content?.icon || 'ClockOutline'\n\t\t},\n\n\t\t/** @return {object} Inline style for the icon circle. */\n\t\ticonCircleStyle() {\n\t\t\treturn { color: this.valueColor }\n\t\t},\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * The host's translate, or the text unchanged.\n\t\t *\n\t\t * @param {string} text The text.\n\t\t * @return {string} The translation.\n\t\t */\n\t\ttranslate(text) {\n\t\t\treturn typeof this.cnTranslate === 'function' ? this.cnTranslate(text) : text\n\t\t},\n\n\t\t/**\n\t\t * A state text through the host's translate, with `{date}` the long\n\t\t * date and `{count}` the days left, or the days past once overdue.\n\t\t *\n\t\t * @param {string} text The text.\n\t\t * @return {string} The filled text.\n\t\t * @spec openspec/changes/countdown-term-states/specs/countdown-term-states/spec.md#requirement-a-term-card-reads-per-state\n\t\t */\n\t\tfillStateText(text) {\n\t\t\tconst date = this.targetDate ? this.targetDate.toLocaleDateString(userLocale(), { day: 'numeric', month: 'long', year: 'numeric' }) : ''\n\t\t\tconst count = this.daysRemaining === null ? '' : String(Math.abs(this.daysRemaining))\n\t\t\treturn this.translate(text).replace(/\\{date\\}/g, date).replace(/\\{count\\}/g, count)\n\t\t},\n\n\t\t/**\n\t\t * Dispatch a manifest action with the record's tokens resolved, through\n\t\t * the page's dispatcher when there is one. A greyed-out action does nothing.\n\t\t *\n\t\t * @param {object} [action] The action; `content.action` when left out.\n\t\t * @return {unknown}\n\t\t * @spec openspec/changes/countdown-term-states/specs/countdown-term-states/spec.md#requirement-an-action-can-be-greyed-out-per-state\n\t\t */\n\t\trunAction(action = this.content?.action) {\n\t\t\tif (!action || typeof action !== 'object') {\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\tconst ctx = resolveObjectTokenContext(this.cnObjectContextInjected, this.cnDetailObjectContextInjected) || {}\n\t\t\tconst tokenCtx = { ...ctx, object: this.record || ctx.object || null, objectId: this.record?.id ?? ctx.objectId ?? null }\n\t\t\tconst { disabledIn, ...declared } = action\n\t\t\tif (Array.isArray(disabledIn) && disabledIn.some((state) => this.activeStates.includes(state))) {\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\tconst resolved = resolveDeepTokens(declared, tokenCtx)\n\t\t\tif (typeof this.cnDispatchAction === 'function') {\n\t\t\t\treturn this.cnDispatchAction(resolved)\n\t\t\t}\n\t\t\treturn dispatchAction(resolved, { router: this.$router || null, tokenCtx })\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-countdown-widget__value {\n\twhite-space: nowrap;\n}\n\n/* The bar spans the card: the KPI body aligns its items to the start, which\n left the empty track 0px wide. */\n.cn-countdown-widget__progress {\n\talign-self: stretch;\n\tbackground: var(--color-border);\n\tborder-radius: 3px;\n\tdisplay: block;\n\theight: 6px;\n\tmargin-block-start: 10px;\n\toverflow: hidden;\n}\n\n.cn-countdown-widget__progress-fill {\n\tbackground: var(--color-primary-element);\n\tdisplay: block;\n\theight: 100%;\n}\n\n.cn-countdown-widget__action {\n\talign-self: flex-start;\n\tbackground: var(--color-background-dark);\n\tborder: 0;\n\tborder-radius: var(--border-radius-pill, 17px);\n\tcolor: var(--color-main-text);\n\tfont-weight: 600;\n\tmargin-block-start: 10px;\n\tmin-height: 34px;\n\tpadding: 0 12px;\n}\n\n/* The board draws the term card's action as a 34px chip with 13px text and\n a 17px radius (DqZaak \"Termijn opschorten\"); Nextcloud's pill radius is\n 100px and its text 15px. */\n.cn-countdown-widget--board .cn-countdown-widget__action {\n\tborder-radius: 17px;\n\tfont-size: 13px;\n}\n\n/* The board stacks the term card 10px apart: the days, the date line, the\n bar and the action (DqZaak \"Termijn\": r33 live 2 / 11.9 / 5 against 10,\n card 182.7 against 188). */\n.cn-countdown-widget--board .cn-kpi-card__body {\n\tgap: 10px;\n}\n\n.cn-countdown-widget--board .cn-countdown-widget__progress.cn-countdown-widget__progress,\n.cn-countdown-widget--board .cn-countdown-widget__action.cn-countdown-widget__action {\n\tmargin: 0;\n}\n\n.cn-countdown-widget__actions {\n\talign-self: stretch;\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 8px;\n\tmargin-block-start: 10px;\n}\n\n.cn-countdown-widget__actions .cn-countdown-widget__action {\n\tmargin: 0;\n}\n\n.cn-countdown-widget__action:disabled {\n\tbackground: var(--color-background-hover);\n\tcolor: var(--color-text-maxcontrast);\n\tcursor: not-allowed;\n}\n\n.cn-countdown-widget__notice {\n\talign-self: stretch;\n\tmargin: 10px 0 0;\n}\n\n.cn-countdown-widget--board .cn-countdown-widget__actions,\n.cn-countdown-widget--board .cn-countdown-widget__notice {\n\tmargin: 0;\n}\n\n.cn-countdown-widget__action--primary {\n\tbackground: var(--color-primary-element-light);\n\tcolor: var(--color-primary-element-light-text);\n}\n\n.cn-countdown-widget__facts {\n\tdisplay: grid;\n\tgap: 8px 16px;\n\tgrid-template-columns: max-content 1fr;\n\tmargin: 10px 0 0;\n}\n\n.cn-countdown-widget__facts dt {\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-countdown-widget__facts dd {\n\tmargin: 0;\n}\n\n.cn-countdown-widget__action:not(:disabled):hover,\n.cn-countdown-widget__action:focus-visible {\n\tbackground: var(--color-background-hover);\n}\n\n.cn-countdown-widget__sub {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 0.85em;\n}\n</style>\n"],"names":["_createVNode","_createElementBlock","_toDisplayString","_createElementVNode","_openBlock","_Fragment","_renderList","_normalizeClass"],"mappings":";;AAkBO,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,mBAAI,GAAA;;;AACT,EAAA,KAAA,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A,CAAA,CAAA;gBAChB,QAAM,EAAA,MAAA,CAAA,QAAA;gBACN,eAAE,EAAA,MAAA,CAAA,QAAA,GAAA,MAAA,GAAA,IAAA;AACH,gBAAA,aAAE,EAAA,qBAAA;AACD,gBAAA,OAAA,EAAA,MAAA,KAAA,QAAA,CAAA,SAAA,CAAA,MAAA,CAAA,MAAA,CAAA,CAAA;;;;;;;;;;;"}
|
|
@@ -2,7 +2,7 @@ import script from './CnCreateFormWidget.vue2.js';
|
|
|
2
2
|
import { render } from './CnCreateFormWidget.vue3.js';
|
|
3
3
|
|
|
4
4
|
script.render = render;
|
|
5
|
-
script.__scopeId = "data-v-
|
|
5
|
+
script.__scopeId = "data-v-a55360d8";
|
|
6
6
|
const __sfc_main = script;
|
|
7
7
|
|
|
8
8
|
export { __sfc_main as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { translate } from '@nextcloud/l10n';
|
|
2
|
-
import { NcButton, NcCheckboxRadioSwitch } from '@nextcloud/vue';
|
|
2
|
+
import { NcButton, NcCheckboxRadioSwitch, NcTextField } from '@nextcloud/vue';
|
|
3
3
|
import { camelize } from 'vue';
|
|
4
4
|
import __sfc_main from '../CnFormWidgetBase/CnFormWidgetBase.vue.js';
|
|
5
5
|
import __sfc_main$1 from '../CnIcon/CnIcon.vue.js';
|
|
@@ -36,7 +36,7 @@ import { useObjectStore } from '../../store/useObjectStore.js';
|
|
|
36
36
|
var script = {
|
|
37
37
|
name: 'CnCreateFormWidget',
|
|
38
38
|
|
|
39
|
-
components: { CnFormWidgetBase: __sfc_main, CnIcon: __sfc_main$1, CnResourceSelect: __sfc_main$2, NcButton, NcCheckboxRadioSwitch },
|
|
39
|
+
components: { CnFormWidgetBase: __sfc_main, CnIcon: __sfc_main$1, CnResourceSelect: __sfc_main$2, NcButton, NcCheckboxRadioSwitch, NcTextField },
|
|
40
40
|
|
|
41
41
|
inject: {
|
|
42
42
|
/** Page-level workspace context from CnDashboardPage, for `@workspace.<key>` defaults. */
|
|
@@ -57,6 +57,18 @@ var script = {
|
|
|
57
57
|
type: Object,
|
|
58
58
|
default: () => ({}),
|
|
59
59
|
},
|
|
60
|
+
|
|
61
|
+
/** The record of a detail page, for `@objectId` in `values`. */
|
|
62
|
+
objectId: {
|
|
63
|
+
type: [String, Number],
|
|
64
|
+
default: null,
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
/** The record of a detail page, for `@object.<field>` in `values`. */
|
|
68
|
+
objectData: {
|
|
69
|
+
type: Object,
|
|
70
|
+
default: null,
|
|
71
|
+
},
|
|
60
72
|
},
|
|
61
73
|
|
|
62
74
|
emits: ['saved'],
|
|
@@ -67,6 +79,8 @@ var script = {
|
|
|
67
79
|
optionsByField: {},
|
|
68
80
|
saving: false,
|
|
69
81
|
errorMessage: '',
|
|
82
|
+
timerStartedAt: null,
|
|
83
|
+
timerNow: 0,
|
|
70
84
|
}
|
|
71
85
|
},
|
|
72
86
|
|
|
@@ -102,9 +116,9 @@ var script = {
|
|
|
102
116
|
: { key: field.key, type: field.type === 'text' ? 'text' : 'custom', label: field.type === 'checkbox' ? '' : field.label }))
|
|
103
117
|
},
|
|
104
118
|
|
|
105
|
-
/** The fields drawn through a `field-<key>` slot
|
|
119
|
+
/** The fields drawn through a `field-<key>` slot. */
|
|
106
120
|
slotFields() {
|
|
107
|
-
return this.fields.filter((field) =>
|
|
121
|
+
return this.fields.filter((field) => ['reference', 'checkbox', 'date', 'number'].includes(field.type))
|
|
108
122
|
},
|
|
109
123
|
|
|
110
124
|
workspace() {
|
|
@@ -142,6 +156,27 @@ var script = {
|
|
|
142
156
|
return translate('nextcloud-vue', 'Creating…')
|
|
143
157
|
},
|
|
144
158
|
|
|
159
|
+
/** `content.timer` when it names a field of this form, else null. */
|
|
160
|
+
timerConfig() {
|
|
161
|
+
const timer = this.content.timer;
|
|
162
|
+
return timer && this.fields.some((field) => field.key === timer.field) ? timer : null
|
|
163
|
+
},
|
|
164
|
+
|
|
165
|
+
timerStartLabel() {
|
|
166
|
+
return this.copy(this.timerConfig?.startLabel) || translate('nextcloud-vue', 'Start timer')
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
timerStopLabel() {
|
|
170
|
+
return this.copy(this.timerConfig?.stopLabel) || translate('nextcloud-vue', 'Stop timer')
|
|
171
|
+
},
|
|
172
|
+
|
|
173
|
+
/** The running timer as h:mm:ss. */
|
|
174
|
+
elapsedText() {
|
|
175
|
+
const seconds = Math.max(0, Math.floor((this.timerNow - this.timerStartedAt) / 1000));
|
|
176
|
+
const minutes = String(Math.floor(seconds / 60) % 60).padStart(2, '0');
|
|
177
|
+
return `${Math.floor(seconds / 3600)}:${minutes}:${String(seconds % 60).padStart(2, '0')}`
|
|
178
|
+
},
|
|
179
|
+
|
|
145
180
|
typeSlug() {
|
|
146
181
|
return `${this.register}-${this.schema}`
|
|
147
182
|
},
|
|
@@ -166,7 +201,37 @@ var script = {
|
|
|
166
201
|
this.loadOptions();
|
|
167
202
|
},
|
|
168
203
|
|
|
204
|
+
beforeUnmount() {
|
|
205
|
+
clearInterval(this.timerInterval);
|
|
206
|
+
},
|
|
207
|
+
|
|
169
208
|
methods: {
|
|
209
|
+
/**
|
|
210
|
+
* Start the timer, or stop it and write the time into its field: hours
|
|
211
|
+
* with two decimals, minutes with `unit: "minutes"`, never less than the
|
|
212
|
+
* smallest step so a short run does not read as nothing.
|
|
213
|
+
*
|
|
214
|
+
* @spec openspec/changes/create-form-date-number-timer/specs/create-form-date-number-timer/spec.md#requirement-a-timer-fills-a-field
|
|
215
|
+
* @return {void}
|
|
216
|
+
*/
|
|
217
|
+
toggleTimer() {
|
|
218
|
+
if (this.timerStartedAt === null) {
|
|
219
|
+
this.timerStartedAt = Date.now();
|
|
220
|
+
this.timerNow = this.timerStartedAt;
|
|
221
|
+
this.timerInterval = setInterval(() => {
|
|
222
|
+
this.timerNow = Date.now();
|
|
223
|
+
}, 1000);
|
|
224
|
+
return
|
|
225
|
+
}
|
|
226
|
+
clearInterval(this.timerInterval);
|
|
227
|
+
const milliseconds = Date.now() - this.timerStartedAt;
|
|
228
|
+
this.timerStartedAt = null;
|
|
229
|
+
const value = this.timerConfig.unit === 'minutes'
|
|
230
|
+
? Math.max(1, Math.round(milliseconds / 60000))
|
|
231
|
+
: Math.max(0.01, Math.round(milliseconds / 36000) / 100);
|
|
232
|
+
this.onFieldUpdate({ key: this.timerConfig.field, value: String(value) });
|
|
233
|
+
},
|
|
234
|
+
|
|
170
235
|
/**
|
|
171
236
|
* A manifest string through the host's translate, else the library's.
|
|
172
237
|
*
|
|
@@ -252,10 +317,11 @@ var script = {
|
|
|
252
317
|
this.saving = true;
|
|
253
318
|
this.errorMessage = '';
|
|
254
319
|
try {
|
|
255
|
-
const values = resolveDeepTokens(this.content.values || {}, { workspace: this.workspace });
|
|
320
|
+
const values = resolveDeepTokens(this.content.values || {}, { workspace: this.workspace, objectId: this.objectId, object: this.objectData });
|
|
256
321
|
const payload = { ...values };
|
|
257
322
|
for (const field of this.fields) {
|
|
258
|
-
|
|
323
|
+
const value = this.form[field.key];
|
|
324
|
+
payload[field.key] = field.type === 'number' && value !== '' && value !== null && value !== undefined ? Number(value) : value;
|
|
259
325
|
}
|
|
260
326
|
if (typeof store.registerObjectType === 'function' && !store.objectTypeRegistry?.[this.typeSlug]) {
|
|
261
327
|
store.registerObjectType(this.typeSlug, this.schema, this.register);
|