@conduction/nextcloud-vue 2.56.0-beta.30 → 2.56.0-beta.31
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/CnActionsBar/CnActionsBar.vue2.js.map +1 -1
- package/dist/esm/components/CnActionsBar/CnActionsBar.vue3.js +3 -3
- package/dist/esm/components/CnActionsBar/CnActionsBar.vue3.js.map +1 -1
- package/dist/esm/components/CnAppRoot/CnAppRoot.vue2.js +80 -4
- package/dist/esm/components/CnAppRoot/CnAppRoot.vue2.js.map +1 -1
- package/dist/esm/components/CnAppRoot/CnAppRoot.vue3.js +95 -91
- package/dist/esm/components/CnAppRoot/CnAppRoot.vue3.js.map +1 -1
- package/dist/esm/components/CnBannerWidget/CnBannerWidget.vue2.js +85 -6
- package/dist/esm/components/CnBannerWidget/CnBannerWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnBannerWidget/CnBannerWidget.vue3.js +1 -1
- package/dist/esm/components/CnBannerWidget/CnBannerWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnCellRenderer/CnCellRenderer.vue2.js +4 -1
- package/dist/esm/components/CnCellRenderer/CnCellRenderer.vue2.js.map +1 -1
- package/dist/esm/components/CnCellRenderer/CnCellRenderer.vue3.js.map +1 -1
- package/dist/esm/components/CnConversationThread/CnConversationWidget.vue2.js +1 -1
- package/dist/esm/components/CnConversationThread/CnConversationWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnConversationThread/CnConversationWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnDashboardGrid/CnDashboardGrid.vue2.js +2 -2
- package/dist/esm/components/CnDashboardGrid/CnDashboardGrid.vue2.js.map +1 -1
- package/dist/esm/components/CnDashboardGrid/CnDashboardGrid.vue3.js.map +1 -1
- package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue2.js +40 -3
- package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue2.js.map +1 -1
- package/dist/esm/components/CnDashboardPage/CnDashboardPage.vue3.js.map +1 -1
- package/dist/esm/components/CnDataTable/CnDataTable.vue2.js +19 -11
- package/dist/esm/components/CnDataTable/CnDataTable.vue2.js.map +1 -1
- package/dist/esm/components/CnDataTable/CnDataTable.vue3.js.map +1 -1
- package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js +43 -0
- package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js.map +1 -1
- package/dist/esm/components/CnDetailPage/CnDetailPage.vue3.js +1 -1
- package/dist/esm/components/CnDetailPage/CnDetailPage.vue3.js.map +1 -1
- package/dist/esm/components/CnDocumentReviewList/CnDocumentReviewWidget.vue2.js +1 -1
- package/dist/esm/components/CnDocumentReviewList/CnDocumentReviewWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnDocumentReviewList/CnDocumentReviewWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnFacetSidebar/CnFacetSidebar.vue2.js +7 -7
- package/dist/esm/components/CnFacetSidebar/CnFacetSidebar.vue2.js.map +1 -1
- package/dist/esm/components/CnFacetSidebar/CnFacetSidebar.vue3.js.map +1 -1
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue2.js +125 -0
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnFactsWidget/CnFactsWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnFieldListWidget/CnFieldListWidget.vue2.js +3 -2
- package/dist/esm/components/CnFieldListWidget/CnFieldListWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnFieldListWidget/CnFieldListWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue2.js +302 -4
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue2.js.map +1 -1
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue3.js +417 -244
- package/dist/esm/components/CnFilesBrowser/CnFilesBrowser.vue3.js.map +1 -1
- package/dist/esm/components/CnFilesBrowser/filesBrowser.js +101 -1
- package/dist/esm/components/CnFilesBrowser/filesBrowser.js.map +1 -1
- package/dist/esm/components/CnFilesBrowser/filesBrowserColumns.js +141 -1
- package/dist/esm/components/CnFilesBrowser/filesBrowserColumns.js.map +1 -1
- package/dist/esm/components/CnFormPage/CnFormPage.vue2.js +60 -0
- package/dist/esm/components/CnFormPage/CnFormPage.vue2.js.map +1 -1
- package/dist/esm/components/CnFormPage/CnFormPage.vue3.js +74 -49
- package/dist/esm/components/CnFormPage/CnFormPage.vue3.js.map +1 -1
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js +29 -1
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js.map +1 -1
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js +48 -4
- package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js.map +1 -1
- package/dist/esm/components/CnIndexSidebar/CnIndexSidebar.vue2.js +7 -7
- package/dist/esm/components/CnIndexSidebar/CnIndexSidebar.vue2.js.map +1 -1
- package/dist/esm/components/CnIndexSidebar/CnIndexSidebar.vue3.js.map +1 -1
- package/dist/esm/components/CnNextStepCard/CnNextStepWidget.vue2.js +1 -1
- package/dist/esm/components/CnNextStepCard/CnNextStepWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnObjectListWidget/CnObjectListWidget.vue2.js +1 -1
- package/dist/esm/components/CnObjectListWidget/CnObjectListWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnObjectListWidget/CnObjectListWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnObjectSidebar/CnFilesTab.vue2.js +63 -1
- package/dist/esm/components/CnObjectSidebar/CnFilesTab.vue2.js.map +1 -1
- package/dist/esm/components/CnObjectSidebar/CnFilesTab.vue3.js +8 -1
- package/dist/esm/components/CnObjectSidebar/CnFilesTab.vue3.js.map +1 -1
- package/dist/esm/components/CnObjectSidebar/CnNotesTab.vue2.js +14 -0
- package/dist/esm/components/CnObjectSidebar/CnNotesTab.vue2.js.map +1 -1
- package/dist/esm/components/CnObjectSidebar/CnNotesTab.vue3.js +5 -1
- package/dist/esm/components/CnObjectSidebar/CnNotesTab.vue3.js.map +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js +13 -6
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnStatsBlockWidget/CnStatsBlockWidget.vue2.js +84 -1
- package/dist/esm/components/CnStatsBlockWidget/CnStatsBlockWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnStatsBlockWidget/CnStatsBlockWidget.vue3.js +85 -41
- package/dist/esm/components/CnStatsBlockWidget/CnStatsBlockWidget.vue3.js.map +1 -1
- package/dist/esm/components/CnWidgetObjectTable/CnWidgetObjectTable.vue2.js +7 -2
- package/dist/esm/components/CnWidgetObjectTable/CnWidgetObjectTable.vue2.js.map +1 -1
- package/dist/esm/components/CnWidgetObjectTable/CnWidgetObjectTable.vue3.js.map +1 -1
- package/dist/esm/components/CnWidgetObjectTable/dashboardRegistration.js +5 -0
- package/dist/esm/components/CnWidgetObjectTable/dashboardRegistration.js.map +1 -1
- package/dist/esm/components/CnWorkspaceFilterWidget/CnWorkspaceFilterWidget.vue2.js +197 -6
- package/dist/esm/components/CnWorkspaceFilterWidget/CnWorkspaceFilterWidget.vue2.js.map +1 -1
- package/dist/esm/components/CnWorkspaceFilterWidget/CnWorkspaceFilterWidget.vue3.js +94 -50
- package/dist/esm/components/CnWorkspaceFilterWidget/CnWorkspaceFilterWidget.vue3.js.map +1 -1
- package/dist/esm/composables/useListView.js +4 -4
- package/dist/esm/composables/useListView.js.map +1 -1
- package/dist/esm/index.js +10 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/l10n/en.json.js +8 -1
- package/dist/esm/l10n/en.json.js.map +1 -1
- package/dist/esm/l10n/nl.json.js +54 -1
- package/dist/esm/l10n/nl.json.js.map +1 -1
- package/dist/esm/nextcloud-vue.css +198 -8
- package/dist/esm/utils/facets.js +75 -3
- package/dist/esm/utils/facets.js.map +1 -1
- package/dist/esm/utils/fillTemplate.js +7 -1
- package/dist/esm/utils/fillTemplate.js.map +1 -1
- package/dist/esm/utils/pageControls.js +81 -0
- package/dist/esm/utils/pageControls.js.map +1 -0
- package/dist/esm/utils/personalLenses.js +40 -3
- package/dist/esm/utils/personalLenses.js.map +1 -1
- package/dist/esm/utils/resolveFilterTokens.js +1 -1
- package/dist/esm/utils/resolveFilterTokens.js.map +1 -1
- package/dist/esm/utils/resolveManifestTokens.js +2 -0
- package/dist/esm/utils/resolveManifestTokens.js.map +1 -1
- package/dist/esm/utils/sentinelTokens.js +19 -1
- package/dist/esm/utils/sentinelTokens.js.map +1 -1
- package/dist/esm/utils/userGroupsPeek.js +91 -0
- package/dist/esm/utils/userGroupsPeek.js.map +1 -0
- package/dist/esm/utils/validateManifestV2.compiled.js +3 -3
- package/dist/esm/utils/validateManifestV2.compiled.js.map +1 -1
- package/dist/esm/utils/visibleWhen.js +57 -5
- package/dist/esm/utils/visibleWhen.js.map +1 -1
- package/dist/esm/utils/widgetVisibility.js +4 -57
- package/dist/esm/utils/widgetVisibility.js.map +1 -1
- package/dist/nextcloud-vue.cjs.js +4309 -2233
- package/dist/nextcloud-vue.cjs.js.map +2 -2
- package/dist/nextcloud-vue.css +198 -8
- package/l10n/en.json +8 -1
- package/l10n/nl.json +54 -1
- package/package.json +2 -1
- package/scripts/check-docs-mdx.mjs +108 -0
- package/src/components/CnActionsBar/CnActionsBar.vue +6 -1
- package/src/components/CnAppRoot/CnAppRoot.md +4 -2
- package/src/components/CnAppRoot/CnAppRoot.vue +151 -59
- package/src/components/CnBannerWidget/CnBannerWidget.vue +112 -7
- package/src/components/CnCellRenderer/CnCellRenderer.vue +4 -1
- package/src/components/CnConversationThread/CnConversationWidget.vue +1 -1
- package/src/components/CnDashboardGrid/CnDashboardGrid.vue +2 -2
- package/src/components/CnDashboardPage/CnDashboardPage.vue +40 -3
- package/src/components/CnDataTable/CnDataTable.vue +19 -11
- package/src/components/CnDetailPage/CnDetailPage.vue +44 -1
- package/src/components/CnDocumentReviewList/CnDocumentReviewWidget.vue +1 -1
- package/src/components/CnFacetSidebar/CnFacetSidebar.vue +7 -7
- package/src/components/CnFactsWidget/CnFactsWidget.vue +125 -0
- package/src/components/CnFieldListWidget/CnFieldListWidget.vue +3 -2
- package/src/components/CnFilesBrowser/CnFilesBrowser.vue +588 -117
- package/src/components/CnFilesBrowser/filesBrowser.js +100 -0
- package/src/components/CnFilesBrowser/filesBrowserColumns.js +140 -0
- package/src/components/CnFormPage/CnFormPage.vue +81 -0
- package/src/components/CnIndexPage/CnIndexPage.vue +56 -3
- package/src/components/CnIndexSidebar/CnIndexSidebar.vue +7 -7
- package/src/components/CnNextStepCard/CnNextStepWidget.vue +1 -1
- package/src/components/CnObjectListWidget/CnObjectListWidget.vue +1 -1
- package/src/components/CnObjectSidebar/CnFilesTab.vue +70 -1
- package/src/components/CnObjectSidebar/CnNotesTab.vue +16 -0
- package/src/components/CnRecordListWidget/CnRecordListWidget.vue +13 -6
- package/src/components/CnStatsBlockWidget/CnStatsBlockWidget.vue +180 -3
- package/src/components/CnWidgetObjectTable/CnWidgetObjectTable.vue +7 -2
- package/src/components/CnWidgetObjectTable/dashboardRegistration.js +5 -0
- package/src/components/CnWorkspaceFilterWidget/CnWorkspaceFilterWidget.vue +281 -10
- package/src/components/index.js +8 -0
- package/src/composables/useListView.js +4 -4
- package/src/css/look-board-index.css +16 -8
- package/src/index.js +8 -0
- package/src/schemas/app-manifest-v2.schema.json +93 -9
- package/src/utils/facets.js +74 -2
- package/src/utils/fillTemplate.js +7 -1
- package/src/utils/pageControls.js +78 -0
- package/src/utils/personalLenses.js +39 -2
- package/src/utils/resolveFilterTokens.js +3 -1
- package/src/utils/resolveManifestTokens.js +2 -0
- package/src/utils/sentinelTokens.js +19 -1
- package/src/utils/userGroupsPeek.js +87 -0
- package/src/utils/validateManifestV2.compiled.js +3 -3
- package/src/utils/visibleWhen.js +56 -4
- package/src/utils/widgetVisibility.js +7 -56
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CnWidgetObjectTable.vue3.js","sources":["../../../../src/components/CnWidgetObjectTable/CnWidgetObjectTable.vue?vue&type=template&id=f6accf5e&lang.js"],"sourcesContent":["<!--\n CnWidgetObjectTable — built-in v2 widget wrapping CnDataTable.\n\n Referenced in v2 manifests via `widgetKey: \"object-table\"`. Renders the\n table on the shared CnWidgetWrapper chrome (title + standard overflow\n Actions menu: Refresh / Documentation / Request a feature) and forwards\n all data props to CnDataTable so the table itself is a transparent\n pass-through.\n\n ADR-049 enrichment: a declarative token-resolved `source` drives\n CnDataTable's existing self-fetch (externally supplied `rows` always win),\n the compact-list surface (hideHeader / borderless / rowRoute /\n viewAllRoute / emptyText / rowIcon / #footer) passes straight through,\n and a declarative `actions[]` renders row-scoped actions via CnRowActions\n plus widget-scoped `object-op` create affordances in the footer.\n\n Spec: REQ-MVR-006 (manifest-v2-renderer) — built-in widget: object-table\n Spec: openspec/changes/list-widget-enrichment/specs/manifest-v2-renderer/spec.md\n-->\n<template>\n\t<!-- `refreshing` mirrors the endpoint fetch so the chrome's Refresh\n\t action spins (and stays disabled) for the real duration of an\n\t in-flight refetch. -->\n\t<component\n\t\t:is=\"hideWrapper ? 'CnWidgetHostShell' : 'CnWidgetWrapper'\"\n\t\tv-bind=\"hideWrapper ? {} : { title, widgetId, documentationUrl, flush: true, refreshing: epLoading }\">\n\t\t<div class=\"cn-widget-object-table\">\n\t\t\t<CnDataTable ref=\"dataTable\" v-bind=\"{ ...innerProps, ...$attrs }\">\n\t\t\t\t<!-- Forward every host-supplied CnDataTable scoped slot verbatim\n\t\t\t\t (#footer { total, shown }, #empty, #column-<key>, …). The\n\t\t\t\t #row-actions slot is NOT forwarded while the widget renders\n\t\t\t\t its own declarative actions[] menu. -->\n\t\t\t\t<template v-for=\"(_, name) in forwardedScopedSlots\" #[name]=\"slotData\">\n\t\t\t\t\t<!-- @slot Any CnDataTable scoped slot, forwarded verbatim — e.g. #footer ({ total, shown }), #empty, #column-<key>. #row-actions is withheld while the declarative actions[] menu renders. -->\n\t\t\t\t\t<slot :name=\"name\" v-bind=\"slotData\" />\n\t\t\t\t</template>\n\t\t\t\t<template v-if=\"rowScopedActions.length > 0\" #row-actions=\"{ row }\">\n\t\t\t\t\t<CnRowActions :actions=\"mappedRowActions\" :row=\"row\" />\n\t\t\t\t</template>\n\t\t\t</CnDataTable>\n\n\t\t\t<!-- Widget-scoped object-op create affordance: `create` has no row\n\t\t\t to mutate, so it renders in the list footer, never inside the\n\t\t\t per-row actions menu (ADR-049 / list-widget-enrichment). -->\n\t\t\t<div v-if=\"createActions.length > 0\" class=\"cn-widget-object-table__footer\">\n\t\t\t\t<NcButton\n\t\t\t\t\tv-for=\"action in createActions\"\n\t\t\t\t\t:key=\"action.id || action.label\"\n\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t:data-testid=\"`cn-widget-create-${action.id || 'action'}`\"\n\t\t\t\t\t@click=\"onActionTriggered(action, null)\">\n\t\t\t\t\t<template v-if=\"action.icon\" #icon>\n\t\t\t\t\t\t<CnIcon :name=\"action.icon\" :size=\"20\" />\n\t\t\t\t\t</template>\n\t\t\t\t\t{{ action.label }}\n\t\t\t\t</NcButton>\n\t\t\t</div>\n\n\t\t\t<!-- A rejected write (OpenRegister RBAC) surfaces here — local row\n\t\t\t state is never mutated on failure (the store only writes its\n\t\t\t caches on success). -->\n\t\t\t<p v-if=\"opError\" class=\"cn-widget-object-table__error\" data-testid=\"cn-widget-object-table-error\">\n\t\t\t\t{{ opError }}\n\t\t\t</p>\n\n\t\t\t<CnConfirmDialog\n\t\t\t\tv-if=\"confirmAction\"\n\t\t\t\tref=\"confirmDialog\"\n\t\t\t\t:dialogTitle=\"confirmAction.label\"\n\t\t\t\t:message=\"confirmMessage\"\n\t\t\t\t:variant=\"confirmAction.op === 'delete' ? 'error' : 'primary'\"\n\t\t\t\t:confirmLabel=\"confirmAction.label\"\n\t\t\t\t@confirm=\"onConfirmConfirmed\"\n\t\t\t\t@close=\"closeConfirm\" />\n\t\t</div>\n\t</component>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcButton } from '@nextcloud/vue'\nimport { inject, ref } from 'vue'\nimport CnConfirmDialog from '../../dialogs/CnConfirmDialog.vue'\nimport CnDataTable from '../CnDataTable/CnDataTable.vue'\nimport { useEndpointSource } from '../../composables/useEndpointSource.js'\nimport { useObjectStore } from '../../store/useObjectStore.js'\nimport { dispatchAction, resolveObjectOpType } from '../../utils/actionsDispatcher.js'\nimport { resolveObjectTokenContext } from '../../utils/detailObjectContext.js'\nimport { dropOptionalUnresolved, hasUnresolvedTokens, resolveFilterTokens } from '../../utils/resolveFilterTokens.js'\nimport { compareVisibleWhen, readVisibleWhenPath } from '../../utils/visibleWhen.js'\nimport { CnIcon } from '../CnIcon/index.js'\nimport { CnRowActions } from '../CnRowActions/index.js'\nimport { CnWidgetWrapper } from '../CnWidgetWrapper/index.js'\n// Chrome-less pass-through used when `hideWrapper` is set (see hostShell.js\n// for why it lives in its own module).\nimport { CnWidgetHostShell } from './hostShell.js'\n\n/**\n * CnWidgetObjectTable — built-in v2 widget wrapping CnDataTable.\n *\n * Renders a data table on the shared CnWidgetWrapper chrome, which supplies\n * the widget title and the standard overflow Actions menu (Refresh /\n * Documentation / Request a feature). All data props are forwarded to the\n * inner CnDataTable; the chrome props (`title`, `documentationUrl`,\n * `widgetId`) are consumed by the wrapper and not passed down.\n *\n * A declarative `source` makes the widget self-fetch from OpenRegister:\n * `source.filter` is token-resolved with the shared `resolveFilterTokens`\n * grammar (`@me`, `@today`, `@workspace.*`, `?`-optional clauses dropped\n * when unresolved via `dropOptionalUnresolved`), `source.order` /\n * `source.limit` drive the fetch, and an `@resolve:` register sentinel is\n * passed through unexpanded (resolution is the host loader's job).\n * Externally supplied `rows` always win — the pre-existing pass-through\n * interface is unchanged.\n *\n * Wave 2 (#91): a declarative `endpointSource` (`{ url, method?, params?,\n * responsePath? }`) is the alternative to the OpenRegister `source` — rows\n * come from an app REST endpoint's payload at `responsePath`, fetched by the\n * shared `useEndpointSource` engine (token-resolved params, request dedup +\n * short-TTL cache, `cn:page:refresh` / `cn:widget:refresh` subscription).\n * Exactly one of `source` | `endpointSource`; columns / formatters /\n * `rowRoute` / `actions` apply unchanged on top of endpoint rows.\n *\n * A declarative `actions[]` array renders `patch` / `delete` `object-op`\n * actions (and reused `handler` / `open-modal` / `open-page` / `navigate`\n * actions) per row through `CnRowActions`; an `object-op` `create` action\n * renders as a widget-scoped footer affordance. `delete` is ALWAYS\n * confirm-gated through `CnConfirmDialog`; `patch` / `create` confirm only\n * on `confirm: true`. Mutations dispatch via the shared object store —\n * the manifest declares intent only, OpenRegister RBAC is the authority,\n * and a rejected write surfaces as an error without local mutation.\n *\n * A declarative `rowClass` (#91) — `[{ when: { field, op?, value }, class }]` reusing\n * the shared `visibleWhen` predicate grammar — is compiled into CnDataTable's\n * `rowClass` function so overdue / at-risk rows can be highlighted from the manifest\n * (a host-supplied `rowClass` FUNCTION still passes straight through).\n */\nexport default {\n\tname: 'CnWidgetObjectTable',\n\n\tcomponents: { CnDataTable, CnWidgetWrapper, CnWidgetHostShell, CnRowActions, CnIcon, NcButton, CnConfirmDialog },\n\n\tinject: {\n\t\t/**\n\t\t * Detail-page object context (`{ objectId, object, register, schema }`)\n\t\t * provided by CnDetailPage — enables `@objectId` / `@object.<field>`\n\t\t * tokens in `source.filter`. Null on dashboards.\n\t\t */\n\t\tcnObjectContext: { default: null },\n\t\t/**\n\t\t * v2 slot-grid detail context holder (`{ value: { objectData, schema,\n\t\t * objectType, objectId, register, store } | null }`) provided by\n\t\t * CnPageRenderer — backfills the object token context so\n\t\t * `@objectId` / `@object.<field>` resolve on detail surfaces where\n\t\t * CnDetailPage is not an ancestor (#91 Wave 3).\n\t\t */\n\t\tcnDetailObjectContext: { default: null },\n\t\t/**\n\t\t * Page-level workspace context (reactive `ref({})`) provided by\n\t\t * CnDashboardPage — enables `@workspace.<key>` tokens in\n\t\t * `source.filter`. Null on pages that don't provide it.\n\t\t */\n\t\tcnWorkspaceContext: { default: null },\n\t\t/**\n\t\t * Pre-bound `dispatchAction` provided by CnPageRenderer (router,\n\t\t * registry, handlers, openModal already wired). Used for the reused\n\t\t * non-mutating action types; falls back to a direct `dispatchAction`\n\t\t * call when mounted outside a CnPageRenderer tree.\n\t\t */\n\t\tcnDispatchAction: { default: null },\n\t},\n\n\tinheritAttrs: false,\n\n\tprops: {\n\t\t/**\n\t\t * Widget title shown in the CnWidgetWrapper header.\n\t\t */\n\t\ttitle: {\n\t\t\ttype: String,\n\t\t\tdefault: () => t('nextcloud-vue', 'Table'),\n\t\t},\n\n\t\t/**\n\t\t * Documentation link surfaced in the widget's overflow Actions menu.\n\t\t * Empty (the default) hides the Documentation item; the Refresh and\n\t\t * Request-a-feature items always render.\n\t\t */\n\t\tdocumentationUrl: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/**\n\t\t * Stable id forwarded to the widget chrome for the Refresh /\n\t\t * Request-a-feature payloads.\n\t\t */\n\t\twidgetId: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/**\n\t\t * Render content-only, WITHOUT the widget's own CnWidgetWrapper\n\t\t * chrome. Set by hosts that already provide the card chrome — e.g.\n\t\t * CnDashboardPage's dashboard widget grid, whose registry branch\n\t\t * wraps every catalog widget in its own CnWidgetWrapper (a naive\n\t\t * mount would double-card). Default `false` keeps the pre-existing\n\t\t * self-chromed v2 rendering byte-for-byte.\n\t\t */\n\t\thideWrapper: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\n\t\t/** Register slug. Forwarded to CnDataTable. */\n\t\tregister: {\n\t\t\ttype: String,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/** Schema slug. Forwarded to CnDataTable. */\n\t\tschema: {\n\t\t\ttype: String,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/**\n\t\t * Column definitions. Forwarded to CnDataTable — bare string keys OR\n\t\t * the object form (`{ key, label, sortable, width, cellClass,\n\t\t * formatter, widget, format, aggregate }`) both pass straight through.\n\t\t *\n\t\t * @type {Array<object|string>}\n\t\t */\n\t\tcolumns: {\n\t\t\ttype: Array,\n\t\t\tdefault: () => [],\n\t\t},\n\n\t\t/** Rows array. Forwarded to CnDataTable. External rows always win over `source`. */\n\t\trows: {\n\t\t\ttype: Array,\n\t\t\tdefault: () => [],\n\t\t},\n\n\t\t/** Loading state. Forwarded to CnDataTable. */\n\t\tloading: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\n\t\t/**\n\t\t * Declarative self-fetch source (ADR-049). When set and no external\n\t\t * `rows` are supplied, the widget resolves `filter` @-tokens and\n\t\t * drives CnDataTable's existing self-fetch with the resolved filter,\n\t\t * `order`, and `limit`. `register` MAY carry an `@resolve:` sentinel —\n\t\t * it is passed through unexpanded. `extend` (#91 Wave 3) forwards\n\t\t * OpenRegister `_extend[]` values (e.g. `[\"calculations\"]`) on the\n\t\t * fetch so virtual/declarative calc fields ride along and render as\n\t\t * ordinary columns. Default `null` keeps the pre-existing\n\t\t * pass-through behaviour byte-for-byte.\n\t\t *\n\t\t * @type {{register?: string, schema?: string, filter?: object, order?: object, limit?: number, extend?: string[]}|null}\n\t\t */\n\t\tsource: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/**\n\t\t * Endpoint data binding (Wave 2, #91) — the alternative to the\n\t\t * OpenRegister `source` for rows an app REST endpoint computes (e.g. a\n\t\t * per-source performance report). Rows come from the payload at\n\t\t * `responsePath` (a dot-path; the plucked value must be an array —\n\t\t * anything else renders as empty). `params` values use the shared\n\t\t * filter-token grammar (`@workspace.dateFrom?`, `@me`, `@today±Nd`, …)\n\t\t * and re-resolve + refetch when the page context changes. Requests are\n\t\t * deduped + short-TTL cached per (url+params) by the shared\n\t\t * `useEndpointSource` engine, which also subscribes to\n\t\t * `cn:page:refresh` / `cn:widget:refresh`. Exactly one of `source` |\n\t\t * `endpointSource` (validator-enforced); external `rows` still win\n\t\t * over both. `columns` / formatters / `rowRoute` / `actions` apply\n\t\t * unchanged on top of endpoint rows.\n\t\t *\n\t\t * @type {{url: string, method?: string, params?: object, responsePath?: string}|null}\n\t\t */\n\t\tendpointSource: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/**\n\t\t * Declarative actions (unified manifest action shape — `handler` |\n\t\t * `open-modal` | `open-page` | `navigate` | `object-op`). `object-op`\n\t\t * `patch` / `delete` (and every non-mutating type) render per row via\n\t\t * CnRowActions; `object-op` `create` renders as a widget-scoped footer\n\t\t * affordance. `delete` always confirms; `patch` / `create` confirm on\n\t\t * `confirm: true`. Authorization-shaped fields on an action have no\n\t\t * effect — OpenRegister RBAC is the only authority.\n\t\t *\n\t\t * @type {Array<object>}\n\t\t */\n\t\tactions: {\n\t\t\ttype: Array,\n\t\t\tdefault: () => [],\n\t\t},\n\n\t\t/**\n\t\t * Hide the column-header row. Forwarded to CnDataTable — the compact\n\t\t * dashboard-list surface.\n\t\t */\n\t\thideHeader: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\n\t\t/**\n\t\t * Drop CnDataTable's card chrome (border, radius, shadow) so the table\n\t\t * sits flush inside the widget card. Forwarded to CnDataTable.\n\t\t */\n\t\tborderless: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\n\t\t/**\n\t\t * Fit the table to the tile: the title column (a column's `grow: true`,\n\t\t * else `title` or `name`, else the first) shrinks and ends in an\n\t\t * ellipsis so the trailing columns stay visible. On by default; pass\n\t\t * `false` for the table's own auto layout. Forwarded to CnDataTable.\n\t\t *\n\t\t * @spec openspec/changes/narrow-object-table-widgets/specs/narrow-object-table-widgets/spec.md#requirement-a-narrow-object-table-keeps-its-trailing-columns-in-view\n\t\t */\n\t\tfitWidth: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: true,\n\t\t},\n\n\t\t/**\n\t\t * Route NAME for row-click navigation. Mapped onto CnDataTable's\n\t\t * `rowClickRoute` as `{ name: rowRoute, params: { id } }` with the\n\t\t * row's `id` (or `@self.id`). Empty (the default) = no navigation.\n\t\t */\n\t\trowRoute: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/**\n\t\t * Client-side row cap, forwarded to CnDataTable (`0` = all rows).\n\t\t * This is what makes `viewAllRoute` reachable for `endpointSource`\n\t\t * tables: the endpoint's full payload stays the `totalRowCount`\n\t\t * while CnDataTable renders only the first `limit` rows, so the\n\t\t * \"View all\" footer condition (total > shown) can finally hold.\n\t\t * The OpenRegister `source` mode keeps using `source.limit` (an\n\t\t * explicit assignment that wins over this passthrough).\n\t\t */\n\t\tlimit: {\n\t\t\ttype: Number,\n\t\t\tdefault: 0,\n\t\t},\n\n\t\t/**\n\t\t * vue-router route object for the \"View all\" footer link. Forwarded\n\t\t * to CnDataTable (footer shows when the rows are a `limit`-ed subset).\n\t\t *\n\t\t * @type {object|null}\n\t\t */\n\t\tviewAllRoute: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/** Pre-translated \"View all\" footer label. Forwarded to CnDataTable. */\n\t\tviewAllLabel: {\n\t\t\ttype: String,\n\t\t\tdefault: undefined,\n\t\t},\n\n\t\t/** Text shown when there are no rows. Forwarded to CnDataTable. */\n\t\temptyText: {\n\t\t\ttype: String,\n\t\t\tdefault: undefined,\n\t\t},\n\n\t\t/**\n\t\t * App wording for an unavailable personal lens (a `source.filter._recent`\n\t\t * tile on an instance that does not log reads), keyed `<lens>.<reason>`\n\t\t * or `<reason>`. Forwarded to CnDataTable, which shows the library's\n\t\t * object-neutral text without it.\n\t\t *\n\t\t * @spec openspec/changes/lens-says-why-it-is-empty/specs/personal-lens-availability/spec.md#requirement-an-unavailable-lens-explains-its-empty-page\n\t\t */\n\t\tlensReasonTexts: {\n\t\t\ttype: Object,\n\t\t\tdefault: undefined,\n\t\t},\n\n\t\t/**\n\t\t * Leading per-row icon: a static MDI icon name string, or a function\n\t\t * `(row) => iconName`. Forwarded to CnDataTable.\n\t\t *\n\t\t * @type {string|((row: object) => string)|null}\n\t\t */\n\t\trowIcon: {\n\t\t\ttype: [String, Function],\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/**\n\t\t * Per-row CSS class binding (#91). Two forms:\n\t\t * - a FUNCTION `(row) => string` — passed straight through to\n\t\t * CnDataTable's `rowClass` (the pre-existing host-supplied contract).\n\t\t * - an ARRAY of declarative rules `[{ when: { field, op?, value }, class }]`\n\t\t * compiled here into that function. Each rule adds its `class` to a\n\t\t * row when the shared `visibleWhen` predicate holds against the row:\n\t\t * `field` is a dot-path into the row, `op` is `eq|neq|gt|gte|lt|lte`\n\t\t * (default `eq`), `value` is the literal right-hand side. Rules are\n\t\t * evaluated in order and every matching `class` is space-joined, so an\n\t\t * overdue / at-risk row can be highlighted declaratively from a\n\t\t * manifest with no bespoke function. Default `null` = no row class.\n\t\t *\n\t\t * @type {((row: object) => string)|Array<{when: {field: string, op?: string, value: unknown}, class: string}>|null}\n\t\t */\n\t\trowClass: {\n\t\t\ttype: [Function, Array],\n\t\t\tdefault: null,\n\t\t},\n\t},\n\n\temits: ['object-op'],\n\n\tsetup(props) {\n\t\t// Endpoint binding (Wave 2, #91): the shared useEndpointSource engine\n\t\t// owns token resolution, request dedup + TTL caching, and the\n\t\t// cn:page:refresh / cn:widget:refresh subscriptions (the widget's own\n\t\t// `widgetId` is matched against widget-scoped refresh payloads).\n\t\t// No-op while `endpointSource` is null, so the OpenRegister `source`\n\t\t// self-fetch path is untouched. Injects re-read in setup (same\n\t\t// resolution as the Options `inject` block).\n\t\tconst objectCtxRaw = inject('cnObjectContext', null)\n\t\tconst detailCtxRaw = inject('cnDetailObjectContext', null)\n\t\tconst workspaceRaw = inject('cnWorkspaceContext', ref(null))\n\t\tconst appConfigRaw = inject('cnAppConfig', ref({}))\n\t\tconst unwrap = (v) => ((v && typeof v === 'object' && 'value' in v) ? v.value : v)\n\t\t// External rows always win — and suppress the request entirely (the\n\t\t// pre-existing \"when rows are provided, no API calls are made\"\n\t\t// contract), so the getter resolves to null while `rows` are supplied.\n\t\tconst { data, loading, error, refetch } = useEndpointSource(\n\t\t\t() => ((props.rows && props.rows.length > 0) ? null : props.endpointSource),\n\t\t\t{\n\t\t\t\tctx: () => ({\n\t\t\t\t\t...(resolveObjectTokenContext(objectCtxRaw, detailCtxRaw) || {}),\n\t\t\t\t\tworkspace: unwrap(workspaceRaw) || {},\n\t\t\t\t\tconfig: unwrap(appConfigRaw) || {},\n\t\t\t\t}),\n\t\t\t\twidgetId: () => props.widgetId,\n\t\t\t},\n\t\t)\n\t\treturn { epData: data, epLoading: loading, epError: error, epRefetch: refetch }\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\t/** Error message from the last rejected object-op write ('' = none). */\n\t\t\topError: '',\n\t\t\t/** @type {object|null} The object-op action awaiting confirmation (null = no dialog). */\n\t\t\tconfirmAction: null,\n\t\t\t/** @type {object|null} The row the pending confirm-gated action targets. */\n\t\t\tconfirmRow: null,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * The merged detail-page object context for token resolution — both\n\t\t * detail-surface injects, holder fields backfilling (#91 Wave 3) —\n\t\t * or null on surfaces (dashboards) that don't provide one.\n\t\t *\n\t\t * @return {object|null}\n\t\t */\n\t\tobjectCtx() {\n\t\t\treturn resolveObjectTokenContext(this.cnObjectContext, this.cnDetailObjectContext)\n\t\t},\n\n\t\t/**\n\t\t * The unwrapped workspace context bag (or null). Vue 2.7 inject may\n\t\t * hand back a raw ref; unwrap `.value` for token resolution.\n\t\t *\n\t\t * @return {object|null}\n\t\t */\n\t\tworkspaceCtx() {\n\t\t\tconst c = this.cnWorkspaceContext\n\t\t\tif (!c) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\treturn (typeof c === 'object' && 'value' in c) ? c.value : c\n\t\t},\n\n\t\t/**\n\t\t * Token-resolution context merged from the detail-page object context\n\t\t * and the page-level workspace bag (`@workspace.<key>`).\n\t\t *\n\t\t * @return {object}\n\t\t */\n\t\ttokenCtx() {\n\t\t\tconst base = this.objectCtx ? { ...this.objectCtx } : {}\n\t\t\tbase.workspace = this.workspaceCtx || {}\n\t\t\treturn base\n\t\t},\n\n\t\t/**\n\t\t * `source.filter` with every @-token resolved against `tokenCtx`, then\n\t\t * with any UNRESOLVED OPTIONAL clause (`@workspace.<key>?`) dropped —\n\t\t * an optional clause simply shows all rows until its context is set.\n\t\t *\n\t\t * @return {object}\n\t\t */\n\t\tresolvedFilter() {\n\t\t\treturn dropOptionalUnresolved(resolveFilterTokens((this.source && this.source.filter) || {}, this.tokenCtx))\n\t\t},\n\n\t\t/**\n\t\t * Whether a REQUIRED context token in `source.filter` is still\n\t\t * unresolved — the widget then skips the fetch instead of querying the\n\t\t * whole register.\n\t\t *\n\t\t * @return {boolean}\n\t\t */\n\t\twaitingForContext() {\n\t\t\treturn !!this.source && hasUnresolvedTokens(this.resolvedFilter)\n\t\t},\n\n\t\t/**\n\t\t * Whether the Wave-2 `endpointSource` drives the rows: a usable\n\t\t * endpoint config and no external rows (external rows always win).\n\t\t *\n\t\t * @return {boolean}\n\t\t */\n\t\tendpointActive() {\n\t\t\treturn !!(this.endpointSource && this.endpointSource.url)\n\t\t\t\t&& (!this.rows || this.rows.length === 0)\n\t\t},\n\n\t\t/**\n\t\t * Rows resolved from the endpoint payload. The payload (after the\n\t\t * `responsePath` pluck the shared engine applies) must be an ARRAY;\n\t\t * anything else renders as an empty table rather than crashing the\n\t\t * column renderer.\n\t\t *\n\t\t * @return {Array<object>}\n\t\t */\n\t\tendpointRows() {\n\t\t\treturn Array.isArray(this.epData) ? this.epData : []\n\t\t},\n\n\t\t/**\n\t\t * Whether the declarative `source` drives a self-fetch: a usable\n\t\t * source, no external rows (external rows always win), no active\n\t\t * endpoint binding (exactly-one-of — endpointSource wins when both\n\t\t * slip past the validator), and no unresolved required token.\n\t\t *\n\t\t * @return {boolean}\n\t\t */\n\t\tselfFetchActive() {\n\t\t\treturn !!(this.source && this.source.register && this.source.schema)\n\t\t\t\t&& (!this.rows || this.rows.length === 0)\n\t\t\t\t&& !this.endpointActive\n\t\t\t\t&& !this.waitingForContext\n\t\t},\n\n\t\t/**\n\t\t * Query params handed to CnDataTable's self-fetch: the resolved filter\n\t\t * as direct field params (OpenRegister object-search shape),\n\t\t * `_order[field]` entries from `source.order`, and — when\n\t\t * `source.limit` is set — `_limit` of limit + 1 so CnDataTable's\n\t\t * View-all footer can detect that more rows exist while the display\n\t\t * caps at `limit`.\n\t\t *\n\t\t * IN-lists: an ARRAY filter value (either directly on the field or via\n\t\t * the `{ in: [...] }` operator form) is emitted as the bare field with\n\t\t * the array value, which axios serializes as repeated bracket params\n\t\t * (`field[]=a&field[]=b`) — the same shape `buildQueryString` /\n\t\t * `useObjectStore` send and the only IN form OpenRegister parses (a\n\t\t * `field[in]`-style key is NOT understood server-side). Empty arrays\n\t\t * are skipped (no constraint).\n\t\t *\n\t\t * @return {object}\n\t\t */\n\t\tresolvedFetchParams() {\n\t\t\tconst src = this.source || {}\n\t\t\tconst params = {}\n\t\t\tfor (const [field, dir] of Object.entries(src.order || {})) {\n\t\t\t\tparams[`_order[${field}]`] = dir === 'desc' ? 'desc' : 'asc'\n\t\t\t}\n\t\t\tif (typeof src.limit === 'number' && src.limit > 0) {\n\t\t\t\tparams._limit = src.limit + 1\n\t\t\t}\n\t\t\t// `source.extend` (#91 Wave 3): forwarded as OR's repeated\n\t\t\t// `_extend[]` param so virtual/declarative fields (e.g.\n\t\t\t// `calculations` — procest daysOverdue) ride the fetch and are\n\t\t\t// displayable as ordinary columns. Serialized by the shared\n\t\t\t// query builder (array value → repeated `key[]`).\n\t\t\tif (Array.isArray(src.extend) && src.extend.length > 0) {\n\t\t\t\tparams._extend = src.extend.filter((e) => typeof e === 'string' && e !== '')\n\t\t\t}\n\t\t\tconst filter = this.resolvedFilter\n\t\t\tif (filter && typeof filter === 'object') {\n\t\t\t\tfor (const [k, v] of Object.entries(filter)) {\n\t\t\t\t\tif (Array.isArray(v)) {\n\t\t\t\t\t\tif (v.length > 0) {\n\t\t\t\t\t\t\tparams[k] = v\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (v && typeof v === 'object') {\n\t\t\t\t\t\tfor (const [op, ov] of Object.entries(v)) {\n\t\t\t\t\t\t\tif (op === 'in' && Array.isArray(ov)) {\n\t\t\t\t\t\t\t\t// OR's IN form is the bare repeated field param.\n\t\t\t\t\t\t\t\tif (ov.length > 0) {\n\t\t\t\t\t\t\t\t\tparams[k] = ov\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tparams[`${k}[${op}]`] = ov\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (v !== '' && v !== null && v !== undefined) {\n\t\t\t\t\t\tparams[k] = v\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn params\n\t\t},\n\n\t\t/**\n\t\t * `$props` minus the chrome props (`title`, `documentationUrl`,\n\t\t * `widgetId`, `hideWrapper`) and the widget-only props (`source`,\n\t\t * `endpointSource`, `actions`, `rowRoute`), so they are consumed here\n\t\t * and never forwarded to the inner CnDataTable. `undefined` values are\n\t\t * dropped so CnDataTable's own prop defaults apply. When the\n\t\t * declarative `source` is active it supplies `register` / `schemaId` /\n\t\t * `fetchParams` / `limit`; an `@resolve:` register sentinel passes\n\t\t * through unexpanded. When the Wave-2 `endpointSource` is active it\n\t\t * supplies the resolved `rows` + `loading` instead — columns,\n\t\t * formatters, and row navigation apply unchanged on top.\n\t\t *\n\t\t * @return {object}\n\t\t */\n\t\tinnerProps() {\n\t\t\tconst { title, documentationUrl, widgetId, hideWrapper, source, endpointSource, actions, rowRoute, rowClass, schema, ...rest } = this.$props\n\t\t\tconst inner = {}\n\t\t\tfor (const [k, v] of Object.entries(rest)) {\n\t\t\t\tif (v !== undefined) {\n\t\t\t\t\tinner[k] = v\n\t\t\t\t}\n\t\t\t}\n\t\t\t// This widget's `schema` is a slug, while CnDataTable's `schema` is a\n\t\t\t// schema object, so it is not forwarded. Nor is it mapped to `schemaId`:\n\t\t\t// that would turn on CnDataTable's unscoped self-fetch whenever the\n\t\t\t// widget's own rows are empty. Self-fetch comes from `source` alone.\n\t\t\t// `rowClass` is consumed here (function or declarative rules[]) and\n\t\t\t// forwarded to CnDataTable as a compiled `(row) => class` function.\n\t\t\tif (this.compiledRowClass) {\n\t\t\t\tinner.rowClass = this.compiledRowClass\n\t\t\t}\n\t\t\tif (this.selfFetchActive) {\n\t\t\t\tinner.register = this.source.register\n\t\t\t\tinner.schemaId = this.source.schema\n\t\t\t\tinner.fetchParams = this.resolvedFetchParams\n\t\t\t\tif (typeof this.source.limit === 'number' && this.source.limit > 0) {\n\t\t\t\t\tinner.limit = this.source.limit\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (this.endpointActive) {\n\t\t\t\tinner.rows = this.endpointRows\n\t\t\t\tinner.loading = this.epLoading || this.loading\n\t\t\t}\n\t\t\tif (this.rowRoute) {\n\t\t\t\tinner.rowClickRoute = this.rowRouteFn\n\t\t\t}\n\t\t\treturn inner\n\t\t},\n\n\t\t/**\n\t\t * The effective `rowClass` function forwarded to CnDataTable. A\n\t\t * host-supplied FUNCTION passes straight through; a declarative\n\t\t * rules[] array is compiled into a `(row) => string` that space-joins\n\t\t * every rule whose shared `visibleWhen` predicate holds against the\n\t\t * row (`field` dot-path + `op` + `value`). Null when `rowClass` is\n\t\t * unset or an empty array — the widget then forwards nothing so\n\t\t * CnDataTable's own default applies.\n\t\t *\n\t\t * @return {?(row: object) => string} The row-class function, or null.\n\t\t */\n\t\tcompiledRowClass() {\n\t\t\tconst rc = this.rowClass\n\t\t\tif (typeof rc === 'function') {\n\t\t\t\treturn rc\n\t\t\t}\n\t\t\tif (!Array.isArray(rc) || rc.length === 0) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst rules = rc\n\t\t\treturn (row) => {\n\t\t\t\tconst classes = []\n\t\t\t\tfor (const rule of rules) {\n\t\t\t\t\tif (!rule || !rule.class) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tconst when = rule.when || {}\n\t\t\t\t\tconst actual = readVisibleWhenPath(row, when.field)\n\t\t\t\t\tif (compareVisibleWhen(actual, when.op || 'eq', when.value)) {\n\t\t\t\t\t\tclasses.push(rule.class)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn classes.join(' ')\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Row-click navigation function derived from the `rowRoute` route\n\t\t * name (CnDataTable's `rowClickRoute` shape).\n\t\t *\n\t\t * @return {(row: object) => (object|null)} A vue-router location, or null for a row with no id.\n\t\t */\n\t\trowRouteFn() {\n\t\t\treturn (row) => {\n\t\t\t\tconst id = row && (row.id || (row['@self'] && row['@self'].id))\n\t\t\t\treturn id ? { name: this.rowRoute, params: { id: String(id) } } : null\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Actions rendered per row: every non-`object-op` type plus\n\t\t * `object-op` `patch` / `delete` (they mutate THAT row's object).\n\t\t *\n\t\t * @return {Array<object>}\n\t\t */\n\t\trowScopedActions() {\n\t\t\treturn (this.actions || []).filter((a) => a && (a.type !== 'object-op' || a.op === 'patch' || a.op === 'delete'))\n\t\t},\n\n\t\t/**\n\t\t * `object-op` `create` actions — widget-scoped (no row to mutate), so\n\t\t * they render in the list footer, never in the row menu.\n\t\t *\n\t\t * @return {Array<object>}\n\t\t */\n\t\tcreateActions() {\n\t\t\treturn (this.actions || []).filter((a) => a && a.type === 'object-op' && a.op === 'create')\n\t\t},\n\n\t\t/**\n\t\t * Row-scoped actions mapped onto the CnRowActions shape: label + icon\n\t\t * pass through, `object-op` `delete` renders destructive, and the\n\t\t * handler routes back through the widget's confirm-gated dispatcher.\n\t\t *\n\t\t * @return {Array<object>}\n\t\t */\n\t\tmappedRowActions() {\n\t\t\treturn this.rowScopedActions.map((action) => ({\n\t\t\t\tlabel: action.label,\n\t\t\t\ticon: action.icon,\n\t\t\t\tdestructive: action.type === 'object-op' && action.op === 'delete',\n\t\t\t\thandler: (row) => this.onActionTriggered(action, row),\n\t\t\t}))\n\t\t},\n\n\t\t/**\n\t\t * Host-supplied CnDataTable scoped slots to forward (keys only). The\n\t\t * `row-actions` slot is withheld while the widget renders its own\n\t\t * declarative actions menu.\n\t\t *\n\t\t * @return {object}\n\t\t */\n\t\tforwardedScopedSlots() {\n\t\t\tconst out = {}\n\t\t\tfor (const name of Object.keys(this.$slots || {})) {\n\t\t\t\tif (name === 'row-actions' && this.rowScopedActions.length > 0) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tout[name] = true\n\t\t\t}\n\t\t\treturn out\n\t\t},\n\n\t\t/**\n\t\t * Confirmation question for the pending confirm-gated action —\n\t\t * destructive copy for `delete`, a generic confirm otherwise.\n\t\t *\n\t\t * @return {string}\n\t\t */\n\t\tconfirmMessage() {\n\t\t\tif (this.confirmAction && this.confirmAction.op === 'delete') {\n\t\t\t\treturn t('nextcloud-vue', 'Are you sure you want to delete this item? This action cannot be undone.')\n\t\t\t}\n\t\t\treturn t('nextcloud-vue', 'Are you sure you want to continue?')\n\t\t},\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * Entry point for every declarative action trigger (row menu or\n\t\t * footer create button). `object-op` `delete` ALWAYS confirms;\n\t\t * `patch` / `create` confirm only when the action sets\n\t\t * `confirm: true`; everything else dispatches immediately.\n\t\t *\n\t\t * @param {object} action The manifest action.\n\t\t * @param {object|null} row The row for row-scoped actions (null for create).\n\t\t * @return {Promise<void>|void}\n\t\t */\n\t\tonActionTriggered(action, row) {\n\t\t\tif (action && action.type === 'object-op' && (action.op === 'delete' || action.confirm === true)) {\n\t\t\t\tthis.confirmAction = action\n\t\t\t\tthis.confirmRow = row\n\t\t\t\treturn\n\t\t\t}\n\t\t\treturn this.runAction(action, row)\n\t\t},\n\n\t\t/**\n\t\t * Confirm-dialog primary button: run the pending action and report\n\t\t * the outcome back into the dialog's result phase.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync onConfirmConfirmed() {\n\t\t\tconst outcome = await this.runAction(this.confirmAction, this.confirmRow)\n\t\t\tconst dialog = this.$refs.confirmDialog\n\t\t\tif (dialog) {\n\t\t\t\tdialog.setResult(outcome.ok ? { success: true } : { error: outcome.error })\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Close/cancel the confirm dialog and clear the pending action.\n\t\t */\n\t\tcloseConfirm() {\n\t\t\tthis.confirmAction = null\n\t\t\tthis.confirmRow = null\n\t\t},\n\n\t\t/**\n\t\t * Dispatch an action. Non-mutating types go through the page's\n\t\t * pre-bound `cnDispatchAction` (falling back to a bare\n\t\t * `dispatchAction`); for `handler` actions the row is appended as the\n\t\t * final handler argument so row context reaches the registry function.\n\t\t * `object-op` actions dispatch via the shared object store — a\n\t\t * rejected (RBAC) write surfaces `opError` and mutates NO local state;\n\t\t * a success clears the error and refreshes the self-fetched rows.\n\t\t *\n\t\t * @param {object} action The manifest action.\n\t\t * @param {object|null} row The target row (null for create).\n\t\t * @return {Promise<{ok: boolean, error?: string}>}\n\t\t */\n\t\tasync runAction(action, row) {\n\t\t\tif (!action) {\n\t\t\t\treturn { ok: false, error: '' }\n\t\t\t}\n\t\t\tif (action.type !== 'object-op') {\n\t\t\t\tconst wrapped = (!action.type || action.type === 'handler')\n\t\t\t\t\t? { ...action, args: [...(action.args || []), row] }\n\t\t\t\t\t: action\n\t\t\t\tif (typeof this.cnDispatchAction === 'function') {\n\t\t\t\t\tthis.cnDispatchAction(wrapped)\n\t\t\t\t} else {\n\t\t\t\t\tdispatchAction(wrapped, { router: this.$router || null })\n\t\t\t\t}\n\t\t\t\treturn { ok: true }\n\t\t\t}\n\n\t\t\tconst store = this.getObjectStore()\n\t\t\tconst result = await dispatchAction(action, {\n\t\t\t\tobjectStore: store,\n\t\t\t\tsource: this.source,\n\t\t\t\trow,\n\t\t\t})\n\t\t\tconst ok = !(result === null || result === false || result === undefined)\n\t\t\tif (!ok) {\n\t\t\t\tconst error = this.readStoreError(store)\n\t\t\t\tthis.opError = error\n\t\t\t\treturn { ok: false, error }\n\t\t\t}\n\t\t\tthis.opError = ''\n\t\t\tthis.refresh()\n\t\t\t/**\n\t\t\t * @event object-op Emitted after a successful declarative mutation\n\t\t\t * so a host that supplies external `rows` can refetch them.\n\t\t\t * @type {{action: object, row: (object|null), result: unknown}}\n\t\t\t */\n\t\t\tthis.$emit('object-op', { action, row, result })\n\t\t\treturn { ok: true }\n\t\t},\n\n\t\t/**\n\t\t * Re-run the active fetch: the endpoint binding (force-refetch past\n\t\t * the shared cache) or the inner CnDataTable's self-fetch. No-op when\n\t\t * the widget is fed external rows.\n\t\t */\n\t\trefresh() {\n\t\t\tif (this.endpointActive) {\n\t\t\t\tthis.epRefetch()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst table = this.$refs.dataTable\n\t\t\tif (this.selfFetchActive && table && typeof table.fetchData === 'function') {\n\t\t\t\ttable.fetchData()\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * The shared object store instance, or null when no Pinia is active\n\t\t * (`dispatchAction` then warns and no-ops).\n\t\t *\n\t\t * @return {object|null}\n\t\t */\n\t\tgetObjectStore() {\n\t\t\ttry {\n\t\t\t\treturn useObjectStore()\n\t\t\t} catch {\n\t\t\t\treturn null\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Human-readable message for the last store error on this widget's\n\t\t * source type (RBAC rejection, network failure, …).\n\t\t *\n\t\t * @param {object|null} store The object store used for the dispatch.\n\t\t * @return {string}\n\t\t */\n\t\treadStoreError(store) {\n\t\t\ttry {\n\t\t\t\tif (store && this.source) {\n\t\t\t\t\tconst type = resolveObjectOpType(store, this.source)\n\t\t\t\t\tconst err = store.errors && store.errors[type]\n\t\t\t\t\tif (err && err.message) {\n\t\t\t\t\t\treturn err.message\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// fall through to the generic message\n\t\t\t}\n\t\t\treturn t('nextcloud-vue', 'The operation was rejected')\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-widget-object-table {\n\twidth: 100%;\n}\n\n.cn-widget-object-table__footer {\n\tdisplay: flex;\n\tgap: 4px;\n\tpadding: 4px 8px;\n\tborder-top: 1px solid var(--color-border);\n}\n\n.cn-widget-object-table__error {\n\tcolor: var(--color-text-error, var(--color-error-text));\n\tfont-size: 0.85em;\n\tmargin: 4px 8px 0;\n}\n</style>\n"],"names":["_normalizeProps","_guardReactiveProps","_createElementVNode","_createSlots","_withCtx","_renderSlot","_createVNode","_openBlock","_createElementBlock","_Fragment","_renderList","_toDisplayString"],"mappings":";;AA6CO,MAAA,UAAA,GAAA,EAAA,KAAK,EAAA,wBAAA,GAAA;;;AAkBN,EAAA,KAAA,EAAA,gCAAA;;;;;;;;;;;;;;;iEApBY,CAAA,WAAA,GAAA,mBAAA,GAAA,iBAAA,CAAA,EAAAA,cAAA,CAAAC,kBAAA,CACR,MAAW,CAAA,WAAA,GAAA,EAAA,GAAA,EAAA,KAAA,EAAU,MAAM,CAAA,KAAA,EAAA,QAAA,EAAC,MAAQ,CAAA,QAAA,EAAA,gBAAA,EAAE,MAAgB,CAAA,gBAAA,EAAA,KAAA,EAAA,IAAA,EAAA,UAAA,EAAc,MAAA,CAAA,SAAA,EAAA,CAAA,CAAA,EAAA;qBAC1E;AAAA,MAAAC,kBAAA,QAAA;mBAaa,CAAA,sBAAA,aAAA,EAZD,GAAG,EAAC,WAAW,EAAA,EAAA,EAAA,GAAI,QAAA,CAAA,UAAA,EAAA,GAAA,IAAA,CAAA,MAAA,EAAA,CAAA,EAAAC,WAAA,CAAA,EAAA,CAAA,EAAA,CAAA,gBAAA,EAAA;qBAKD,QAAK,CAAA,oBAAA,EAAA,CAAjB,CAAC,EAAE,IAAI,KAAA;;oBAAU,IAAA;AAElC,cAAA,EAAA,EAAAC,OAAA,CAAA,CAFkC,QAAA,KAAA;gBAElCC,UAAU,CAAA,IAAA,CAAA,MAAA,EAAA,IAAA,EAAAL,cAAA,CAAAC,kBAAA,CAAA,QAAA,CAAA,CAAA,CAAA;;;;AAED,UAAA,CAAA,QAAA,CAAA,gBAAA,CAAA,MAAA,GAAA,CAAA;;sBAAA,aAAA;AACT,gBAAA,EAAA,EAAAG,OAAA,CAAA,CAAG,EADM,GAAA,EAAA,KAAA;kBACTE,WAAG,CAAA,uBAAA,EAAA;AAAA,oBAAA,OAAA,EAAA,QAAA,CAAA,gBAAA;AAAA,oBAAA,GAAA,EAAA,GAAA;;;;;;;AAOF,QAAA,CAAA,QAAA,CAAA,aAAA,CAAA,MAAA,GAAA,CAAA;AAAH,aAAAC,SAAA,EAAA,EAAAC,kBAAA,CAYM,OAZN,UAYM,EAAA;kDADF,CAAAC,QAAA,EAAA,IAAA,EAAAC,UAAA,CATW,QAAA,CAAA,aAAA,EAAA,CAAN,MAAM,KAAA;gDASX,CAAA,mBAAA,EAAA;AARD,kBAAA,GAAG,EAAE,MAAM,CAAC,EAAE,IAAG,MAAA,CAAA,KAAA;AAClB,kBAAA,OAAO,EAAC,UAAS;kBAChB,aAAW,EAAA,CAAA,iBAAA,EAAoB,MAAA,CAAA,EAAA,IAAA,QAAA,CAAA,CAAA;kBAC/B,OAAK,EAAA,MAAA,KAAE,QAAe,CAAA,iBAAA,CAAA,MAAA,EAAA,IAAA,CAAA,CAAA;;mCAGZ,MACX;oCADW,GACX,GAAAC,eAAA,CAAG,MAAM,CAAC,KAAK,CAAA,EAAA,CAAA,YAAA;;;;AAHC,kBAAA,CAAA,MAAM,CAAC,IAAI;;8BAAG,MAAI;oCACjC,MAAgC;0BAAhCL,WAAgC,CAAA,iBAAA,EAAA;4BAAvB,IAAI,EAAE,MAAM,CAAC,IAAI;AAAG,4BAAA,IAAG,EAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"CnWidgetObjectTable.vue3.js","sources":["../../../../src/components/CnWidgetObjectTable/CnWidgetObjectTable.vue?vue&type=template&id=f6accf5e&lang.js"],"sourcesContent":["<!--\n CnWidgetObjectTable — built-in v2 widget wrapping CnDataTable.\n\n Referenced in v2 manifests via `widgetKey: \"object-table\"`. Renders the\n table on the shared CnWidgetWrapper chrome (title + standard overflow\n Actions menu: Refresh / Documentation / Request a feature) and forwards\n all data props to CnDataTable so the table itself is a transparent\n pass-through.\n\n ADR-049 enrichment: a declarative token-resolved `source` drives\n CnDataTable's existing self-fetch (externally supplied `rows` always win),\n the compact-list surface (hideHeader / borderless / rowRoute /\n viewAllRoute / emptyText / rowIcon / #footer) passes straight through,\n and a declarative `actions[]` renders row-scoped actions via CnRowActions\n plus widget-scoped `object-op` create affordances in the footer.\n\n Spec: REQ-MVR-006 (manifest-v2-renderer) — built-in widget: object-table\n Spec: openspec/changes/list-widget-enrichment/specs/manifest-v2-renderer/spec.md\n-->\n<template>\n\t<!-- `refreshing` mirrors the endpoint fetch so the chrome's Refresh\n\t action spins (and stays disabled) for the real duration of an\n\t in-flight refetch. -->\n\t<component\n\t\t:is=\"hideWrapper ? 'CnWidgetHostShell' : 'CnWidgetWrapper'\"\n\t\tv-bind=\"hideWrapper ? {} : { title, widgetId, documentationUrl, flush: true, refreshing: epLoading }\">\n\t\t<div class=\"cn-widget-object-table\">\n\t\t\t<CnDataTable ref=\"dataTable\" v-bind=\"{ ...innerProps, ...$attrs }\">\n\t\t\t\t<!-- Forward every host-supplied CnDataTable scoped slot verbatim\n\t\t\t\t (#footer { total, shown }, #empty, #column-<key>, …). The\n\t\t\t\t #row-actions slot is NOT forwarded while the widget renders\n\t\t\t\t its own declarative actions[] menu. -->\n\t\t\t\t<template v-for=\"(_, name) in forwardedScopedSlots\" #[name]=\"slotData\">\n\t\t\t\t\t<!-- @slot Any CnDataTable scoped slot, forwarded verbatim — e.g. #footer ({ total, shown }), #empty, #column-<key>. #row-actions is withheld while the declarative actions[] menu renders. -->\n\t\t\t\t\t<slot :name=\"name\" v-bind=\"slotData\" />\n\t\t\t\t</template>\n\t\t\t\t<template v-if=\"rowScopedActions.length > 0\" #row-actions=\"{ row }\">\n\t\t\t\t\t<CnRowActions :actions=\"mappedRowActions\" :row=\"row\" />\n\t\t\t\t</template>\n\t\t\t</CnDataTable>\n\n\t\t\t<!-- Widget-scoped object-op create affordance: `create` has no row\n\t\t\t to mutate, so it renders in the list footer, never inside the\n\t\t\t per-row actions menu (ADR-049 / list-widget-enrichment). -->\n\t\t\t<div v-if=\"createActions.length > 0\" class=\"cn-widget-object-table__footer\">\n\t\t\t\t<NcButton\n\t\t\t\t\tv-for=\"action in createActions\"\n\t\t\t\t\t:key=\"action.id || action.label\"\n\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t:data-testid=\"`cn-widget-create-${action.id || 'action'}`\"\n\t\t\t\t\t@click=\"onActionTriggered(action, null)\">\n\t\t\t\t\t<template v-if=\"action.icon\" #icon>\n\t\t\t\t\t\t<CnIcon :name=\"action.icon\" :size=\"20\" />\n\t\t\t\t\t</template>\n\t\t\t\t\t{{ action.label }}\n\t\t\t\t</NcButton>\n\t\t\t</div>\n\n\t\t\t<!-- A rejected write (OpenRegister RBAC) surfaces here — local row\n\t\t\t state is never mutated on failure (the store only writes its\n\t\t\t caches on success). -->\n\t\t\t<p v-if=\"opError\" class=\"cn-widget-object-table__error\" data-testid=\"cn-widget-object-table-error\">\n\t\t\t\t{{ opError }}\n\t\t\t</p>\n\n\t\t\t<CnConfirmDialog\n\t\t\t\tv-if=\"confirmAction\"\n\t\t\t\tref=\"confirmDialog\"\n\t\t\t\t:dialogTitle=\"confirmAction.label\"\n\t\t\t\t:message=\"confirmMessage\"\n\t\t\t\t:variant=\"confirmAction.op === 'delete' ? 'error' : 'primary'\"\n\t\t\t\t:confirmLabel=\"confirmAction.label\"\n\t\t\t\t@confirm=\"onConfirmConfirmed\"\n\t\t\t\t@close=\"closeConfirm\" />\n\t\t</div>\n\t</component>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcButton } from '@nextcloud/vue'\nimport { inject, ref } from 'vue'\nimport CnConfirmDialog from '../../dialogs/CnConfirmDialog.vue'\nimport CnDataTable from '../CnDataTable/CnDataTable.vue'\nimport { useEndpointSource } from '../../composables/useEndpointSource.js'\nimport { useObjectStore } from '../../store/useObjectStore.js'\nimport { dispatchAction, resolveObjectOpType } from '../../utils/actionsDispatcher.js'\nimport { resolveObjectTokenContext } from '../../utils/detailObjectContext.js'\nimport { pageFilter, pageSort } from '../../utils/pageControls.js'\nimport { dropOptionalUnresolved, hasUnresolvedTokens, resolveFilterTokens } from '../../utils/resolveFilterTokens.js'\nimport { compareVisibleWhen, readVisibleWhenPath } from '../../utils/visibleWhen.js'\nimport { CnIcon } from '../CnIcon/index.js'\nimport { CnRowActions } from '../CnRowActions/index.js'\nimport { CnWidgetWrapper } from '../CnWidgetWrapper/index.js'\n// Chrome-less pass-through used when `hideWrapper` is set (see hostShell.js\n// for why it lives in its own module).\nimport { CnWidgetHostShell } from './hostShell.js'\n\n/**\n * CnWidgetObjectTable — built-in v2 widget wrapping CnDataTable.\n *\n * Renders a data table on the shared CnWidgetWrapper chrome, which supplies\n * the widget title and the standard overflow Actions menu (Refresh /\n * Documentation / Request a feature). All data props are forwarded to the\n * inner CnDataTable; the chrome props (`title`, `documentationUrl`,\n * `widgetId`) are consumed by the wrapper and not passed down.\n *\n * A declarative `source` makes the widget self-fetch from OpenRegister:\n * `source.filter` is token-resolved with the shared `resolveFilterTokens`\n * grammar (`@me`, `@today`, `@workspace.*`, `?`-optional clauses dropped\n * when unresolved via `dropOptionalUnresolved`), `source.order` /\n * `source.limit` drive the fetch, and an `@resolve:` register sentinel is\n * passed through unexpanded (resolution is the host loader's job).\n * Externally supplied `rows` always win — the pre-existing pass-through\n * interface is unchanged.\n *\n * Wave 2 (#91): a declarative `endpointSource` (`{ url, method?, params?,\n * responsePath? }`) is the alternative to the OpenRegister `source` — rows\n * come from an app REST endpoint's payload at `responsePath`, fetched by the\n * shared `useEndpointSource` engine (token-resolved params, request dedup +\n * short-TTL cache, `cn:page:refresh` / `cn:widget:refresh` subscription).\n * Exactly one of `source` | `endpointSource`; columns / formatters /\n * `rowRoute` / `actions` apply unchanged on top of endpoint rows.\n *\n * A declarative `actions[]` array renders `patch` / `delete` `object-op`\n * actions (and reused `handler` / `open-modal` / `open-page` / `navigate`\n * actions) per row through `CnRowActions`; an `object-op` `create` action\n * renders as a widget-scoped footer affordance. `delete` is ALWAYS\n * confirm-gated through `CnConfirmDialog`; `patch` / `create` confirm only\n * on `confirm: true`. Mutations dispatch via the shared object store —\n * the manifest declares intent only, OpenRegister RBAC is the authority,\n * and a rejected write surfaces as an error without local mutation.\n *\n * A declarative `rowClass` (#91) — `[{ when: { field, op?, value }, class }]` reusing\n * the shared `visibleWhen` predicate grammar — is compiled into CnDataTable's\n * `rowClass` function so overdue / at-risk rows can be highlighted from the manifest\n * (a host-supplied `rowClass` FUNCTION still passes straight through).\n */\nexport default {\n\tname: 'CnWidgetObjectTable',\n\n\tcomponents: { CnDataTable, CnWidgetWrapper, CnWidgetHostShell, CnRowActions, CnIcon, NcButton, CnConfirmDialog },\n\n\tinject: {\n\t\t/**\n\t\t * Detail-page object context (`{ objectId, object, register, schema }`)\n\t\t * provided by CnDetailPage — enables `@objectId` / `@object.<field>`\n\t\t * tokens in `source.filter`. Null on dashboards.\n\t\t */\n\t\tcnObjectContext: { default: null },\n\t\t/**\n\t\t * v2 slot-grid detail context holder (`{ value: { objectData, schema,\n\t\t * objectType, objectId, register, store } | null }`) provided by\n\t\t * CnPageRenderer — backfills the object token context so\n\t\t * `@objectId` / `@object.<field>` resolve on detail surfaces where\n\t\t * CnDetailPage is not an ancestor (#91 Wave 3).\n\t\t */\n\t\tcnDetailObjectContext: { default: null },\n\t\t/**\n\t\t * Page-level workspace context (reactive `ref({})`) provided by\n\t\t * CnDashboardPage — enables `@workspace.<key>` tokens in\n\t\t * `source.filter`. Null on pages that don't provide it.\n\t\t */\n\t\tcnWorkspaceContext: { default: null },\n\t\t/**\n\t\t * Pre-bound `dispatchAction` provided by CnPageRenderer (router,\n\t\t * registry, handlers, openModal already wired). Used for the reused\n\t\t * non-mutating action types; falls back to a direct `dispatchAction`\n\t\t * call when mounted outside a CnPageRenderer tree.\n\t\t */\n\t\tcnDispatchAction: { default: null },\n\t},\n\n\tinheritAttrs: false,\n\n\tprops: {\n\t\t/**\n\t\t * Widget title shown in the CnWidgetWrapper header.\n\t\t */\n\t\ttitle: {\n\t\t\ttype: String,\n\t\t\tdefault: () => t('nextcloud-vue', 'Table'),\n\t\t},\n\n\t\t/**\n\t\t * Documentation link surfaced in the widget's overflow Actions menu.\n\t\t * Empty (the default) hides the Documentation item; the Refresh and\n\t\t * Request-a-feature items always render.\n\t\t */\n\t\tdocumentationUrl: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/**\n\t\t * Stable id forwarded to the widget chrome for the Refresh /\n\t\t * Request-a-feature payloads.\n\t\t */\n\t\twidgetId: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/**\n\t\t * Render content-only, WITHOUT the widget's own CnWidgetWrapper\n\t\t * chrome. Set by hosts that already provide the card chrome — e.g.\n\t\t * CnDashboardPage's dashboard widget grid, whose registry branch\n\t\t * wraps every catalog widget in its own CnWidgetWrapper (a naive\n\t\t * mount would double-card). Default `false` keeps the pre-existing\n\t\t * self-chromed v2 rendering byte-for-byte.\n\t\t */\n\t\thideWrapper: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\n\t\t/** Register slug. Forwarded to CnDataTable. */\n\t\tregister: {\n\t\t\ttype: String,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/** Schema slug. Forwarded to CnDataTable. */\n\t\tschema: {\n\t\t\ttype: String,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/**\n\t\t * Column definitions. Forwarded to CnDataTable — bare string keys OR\n\t\t * the object form (`{ key, label, sortable, width, cellClass,\n\t\t * formatter, widget, format, aggregate }`) both pass straight through.\n\t\t *\n\t\t * @type {Array<object|string>}\n\t\t */\n\t\tcolumns: {\n\t\t\ttype: Array,\n\t\t\tdefault: () => [],\n\t\t},\n\n\t\t/** Rows array. Forwarded to CnDataTable. External rows always win over `source`. */\n\t\trows: {\n\t\t\ttype: Array,\n\t\t\tdefault: () => [],\n\t\t},\n\n\t\t/** Loading state. Forwarded to CnDataTable. */\n\t\tloading: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\n\t\t/**\n\t\t * Declarative self-fetch source (ADR-049). When set and no external\n\t\t * `rows` are supplied, the widget resolves `filter` @-tokens and\n\t\t * drives CnDataTable's existing self-fetch with the resolved filter,\n\t\t * `order`, and `limit`. `register` MAY carry an `@resolve:` sentinel —\n\t\t * it is passed through unexpanded. `extend` (#91 Wave 3) forwards\n\t\t * OpenRegister `_extend[]` values (e.g. `[\"calculations\"]`) on the\n\t\t * fetch so virtual/declarative calc fields ride along and render as\n\t\t * ordinary columns. Default `null` keeps the pre-existing\n\t\t * pass-through behaviour byte-for-byte.\n\t\t *\n\t\t * @type {{register?: string, schema?: string, filter?: object, order?: object, limit?: number, extend?: string[]}|null}\n\t\t */\n\t\tsource: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/**\n\t\t * Endpoint data binding (Wave 2, #91) — the alternative to the\n\t\t * OpenRegister `source` for rows an app REST endpoint computes (e.g. a\n\t\t * per-source performance report). Rows come from the payload at\n\t\t * `responsePath` (a dot-path; the plucked value must be an array —\n\t\t * anything else renders as empty). `params` values use the shared\n\t\t * filter-token grammar (`@workspace.dateFrom?`, `@me`, `@today±Nd`, …)\n\t\t * and re-resolve + refetch when the page context changes. Requests are\n\t\t * deduped + short-TTL cached per (url+params) by the shared\n\t\t * `useEndpointSource` engine, which also subscribes to\n\t\t * `cn:page:refresh` / `cn:widget:refresh`. Exactly one of `source` |\n\t\t * `endpointSource` (validator-enforced); external `rows` still win\n\t\t * over both. `columns` / formatters / `rowRoute` / `actions` apply\n\t\t * unchanged on top of endpoint rows.\n\t\t *\n\t\t * @type {{url: string, method?: string, params?: object, responsePath?: string}|null}\n\t\t */\n\t\tendpointSource: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/**\n\t\t * Declarative actions (unified manifest action shape — `handler` |\n\t\t * `open-modal` | `open-page` | `navigate` | `object-op`). `object-op`\n\t\t * `patch` / `delete` (and every non-mutating type) render per row via\n\t\t * CnRowActions; `object-op` `create` renders as a widget-scoped footer\n\t\t * affordance. `delete` always confirms; `patch` / `create` confirm on\n\t\t * `confirm: true`. Authorization-shaped fields on an action have no\n\t\t * effect — OpenRegister RBAC is the only authority.\n\t\t *\n\t\t * @type {Array<object>}\n\t\t */\n\t\tactions: {\n\t\t\ttype: Array,\n\t\t\tdefault: () => [],\n\t\t},\n\n\t\t/**\n\t\t * Hide the column-header row. Forwarded to CnDataTable — the compact\n\t\t * dashboard-list surface.\n\t\t */\n\t\thideHeader: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\n\t\t/**\n\t\t * Drop CnDataTable's card chrome (border, radius, shadow) so the table\n\t\t * sits flush inside the widget card. Forwarded to CnDataTable.\n\t\t */\n\t\tborderless: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\n\t\t/**\n\t\t * Fit the table to the tile: the title column (a column's `grow: true`,\n\t\t * else `title` or `name`, else the first) shrinks and ends in an\n\t\t * ellipsis so the trailing columns stay visible. On by default; pass\n\t\t * `false` for the table's own auto layout. Forwarded to CnDataTable.\n\t\t *\n\t\t * @spec openspec/changes/narrow-object-table-widgets/specs/narrow-object-table-widgets/spec.md#requirement-a-narrow-object-table-keeps-its-trailing-columns-in-view\n\t\t */\n\t\tfitWidth: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: true,\n\t\t},\n\n\t\t/**\n\t\t * Route NAME for row-click navigation. Mapped onto CnDataTable's\n\t\t * `rowClickRoute` as `{ name: rowRoute, params: { id } }` with the\n\t\t * row's `id` (or `@self.id`). Empty (the default) = no navigation.\n\t\t */\n\t\trowRoute: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/**\n\t\t * Client-side row cap, forwarded to CnDataTable (`0` = all rows).\n\t\t * This is what makes `viewAllRoute` reachable for `endpointSource`\n\t\t * tables: the endpoint's full payload stays the `totalRowCount`\n\t\t * while CnDataTable renders only the first `limit` rows, so the\n\t\t * \"View all\" footer condition (total > shown) can finally hold.\n\t\t * The OpenRegister `source` mode keeps using `source.limit` (an\n\t\t * explicit assignment that wins over this passthrough).\n\t\t */\n\t\tlimit: {\n\t\t\ttype: Number,\n\t\t\tdefault: 0,\n\t\t},\n\n\t\t/**\n\t\t * vue-router route object for the \"View all\" footer link. Forwarded\n\t\t * to CnDataTable (footer shows when the rows are a `limit`-ed subset).\n\t\t *\n\t\t * @type {object|null}\n\t\t */\n\t\tviewAllRoute: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/** Pre-translated \"View all\" footer label. Forwarded to CnDataTable. */\n\t\tviewAllLabel: {\n\t\t\ttype: String,\n\t\t\tdefault: undefined,\n\t\t},\n\n\t\t/** Text shown when there are no rows. Forwarded to CnDataTable. */\n\t\temptyText: {\n\t\t\ttype: String,\n\t\t\tdefault: undefined,\n\t\t},\n\n\t\t/**\n\t\t * App wording for an unavailable personal lens (a `source.filter._recent`\n\t\t * tile on an instance that does not log reads), keyed `<lens>.<reason>`\n\t\t * or `<reason>`. Forwarded to CnDataTable, which shows the library's\n\t\t * object-neutral text without it.\n\t\t *\n\t\t * @spec openspec/changes/lens-says-why-it-is-empty/specs/personal-lens-availability/spec.md#requirement-an-unavailable-lens-explains-its-empty-page\n\t\t */\n\t\tlensReasonTexts: {\n\t\t\ttype: Object,\n\t\t\tdefault: undefined,\n\t\t},\n\n\t\t/**\n\t\t * Leading per-row icon: a static MDI icon name string, or a function\n\t\t * `(row) => iconName`. Forwarded to CnDataTable.\n\t\t *\n\t\t * @type {string|((row: object) => string)|null}\n\t\t */\n\t\trowIcon: {\n\t\t\ttype: [String, Function],\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/**\n\t\t * Per-row CSS class binding (#91). Two forms:\n\t\t * - a FUNCTION `(row) => string` — passed straight through to\n\t\t * CnDataTable's `rowClass` (the pre-existing host-supplied contract).\n\t\t * - an ARRAY of declarative rules `[{ when: { field, op?, value }, class }]`\n\t\t * compiled here into that function. Each rule adds its `class` to a\n\t\t * row when the shared `visibleWhen` predicate holds against the row:\n\t\t * `field` is a dot-path into the row, `op` is `eq|neq|gt|gte|lt|lte`\n\t\t * (default `eq`), `value` is the literal right-hand side. Rules are\n\t\t * evaluated in order and every matching `class` is space-joined, so an\n\t\t * overdue / at-risk row can be highlighted declaratively from a\n\t\t * manifest with no bespoke function. Default `null` = no row class.\n\t\t *\n\t\t * @type {((row: object) => string)|Array<{when: {field: string, op?: string, value: unknown}, class: string}>|null}\n\t\t */\n\t\trowClass: {\n\t\t\ttype: [Function, Array],\n\t\t\tdefault: null,\n\t\t},\n\t},\n\n\temits: ['object-op'],\n\n\tsetup(props) {\n\t\t// Endpoint binding (Wave 2, #91): the shared useEndpointSource engine\n\t\t// owns token resolution, request dedup + TTL caching, and the\n\t\t// cn:page:refresh / cn:widget:refresh subscriptions (the widget's own\n\t\t// `widgetId` is matched against widget-scoped refresh payloads).\n\t\t// No-op while `endpointSource` is null, so the OpenRegister `source`\n\t\t// self-fetch path is untouched. Injects re-read in setup (same\n\t\t// resolution as the Options `inject` block).\n\t\tconst objectCtxRaw = inject('cnObjectContext', null)\n\t\tconst detailCtxRaw = inject('cnDetailObjectContext', null)\n\t\tconst workspaceRaw = inject('cnWorkspaceContext', ref(null))\n\t\tconst appConfigRaw = inject('cnAppConfig', ref({}))\n\t\tconst unwrap = (v) => ((v && typeof v === 'object' && 'value' in v) ? v.value : v)\n\t\t// External rows always win — and suppress the request entirely (the\n\t\t// pre-existing \"when rows are provided, no API calls are made\"\n\t\t// contract), so the getter resolves to null while `rows` are supplied.\n\t\tconst { data, loading, error, refetch } = useEndpointSource(\n\t\t\t() => ((props.rows && props.rows.length > 0) ? null : props.endpointSource),\n\t\t\t{\n\t\t\t\tctx: () => ({\n\t\t\t\t\t...(resolveObjectTokenContext(objectCtxRaw, detailCtxRaw) || {}),\n\t\t\t\t\tworkspace: unwrap(workspaceRaw) || {},\n\t\t\t\t\tconfig: unwrap(appConfigRaw) || {},\n\t\t\t\t}),\n\t\t\t\twidgetId: () => props.widgetId,\n\t\t\t},\n\t\t)\n\t\treturn { epData: data, epLoading: loading, epError: error, epRefetch: refetch }\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\t/** Error message from the last rejected object-op write ('' = none). */\n\t\t\topError: '',\n\t\t\t/** @type {object|null} The object-op action awaiting confirmation (null = no dialog). */\n\t\t\tconfirmAction: null,\n\t\t\t/** @type {object|null} The row the pending confirm-gated action targets. */\n\t\t\tconfirmRow: null,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * The merged detail-page object context for token resolution — both\n\t\t * detail-surface injects, holder fields backfilling (#91 Wave 3) —\n\t\t * or null on surfaces (dashboards) that don't provide one.\n\t\t *\n\t\t * @return {object|null}\n\t\t */\n\t\tobjectCtx() {\n\t\t\treturn resolveObjectTokenContext(this.cnObjectContext, this.cnDetailObjectContext)\n\t\t},\n\n\t\t/**\n\t\t * The unwrapped workspace context bag (or null). Vue 2.7 inject may\n\t\t * hand back a raw ref; unwrap `.value` for token resolution.\n\t\t *\n\t\t * @return {object|null}\n\t\t */\n\t\tworkspaceCtx() {\n\t\t\tconst c = this.cnWorkspaceContext\n\t\t\tif (!c) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\treturn (typeof c === 'object' && 'value' in c) ? c.value : c\n\t\t},\n\n\t\t/**\n\t\t * Token-resolution context merged from the detail-page object context\n\t\t * and the page-level workspace bag (`@workspace.<key>`).\n\t\t *\n\t\t * @return {object}\n\t\t */\n\t\ttokenCtx() {\n\t\t\tconst base = this.objectCtx ? { ...this.objectCtx } : {}\n\t\t\tbase.workspace = this.workspaceCtx || {}\n\t\t\treturn base\n\t\t},\n\n\t\t/**\n\t\t * `source.filter` with every @-token resolved against `tokenCtx`, then\n\t\t * with any UNRESOLVED OPTIONAL clause (`@workspace.<key>?`) dropped —\n\t\t * an optional clause simply shows all rows until its context is set.\n\t\t *\n\t\t * @return {object}\n\t\t */\n\t\tresolvedFilter() {\n\t\t\tconst filter = pageFilter(this.source && this.source.pageControls, this.workspaceCtx, this.source && this.source.filter)\n\t\t\treturn dropOptionalUnresolved(resolveFilterTokens(filter, this.tokenCtx))\n\t\t},\n\n\t\t/**\n\t\t * Whether a REQUIRED context token in `source.filter` is still\n\t\t * unresolved — the widget then skips the fetch instead of querying the\n\t\t * whole register.\n\t\t *\n\t\t * @return {boolean}\n\t\t */\n\t\twaitingForContext() {\n\t\t\treturn !!this.source && hasUnresolvedTokens(this.resolvedFilter)\n\t\t},\n\n\t\t/**\n\t\t * Whether the Wave-2 `endpointSource` drives the rows: a usable\n\t\t * endpoint config and no external rows (external rows always win).\n\t\t *\n\t\t * @return {boolean}\n\t\t */\n\t\tendpointActive() {\n\t\t\treturn !!(this.endpointSource && this.endpointSource.url)\n\t\t\t\t&& (!this.rows || this.rows.length === 0)\n\t\t},\n\n\t\t/**\n\t\t * Rows resolved from the endpoint payload. The payload (after the\n\t\t * `responsePath` pluck the shared engine applies) must be an ARRAY;\n\t\t * anything else renders as an empty table rather than crashing the\n\t\t * column renderer.\n\t\t *\n\t\t * @return {Array<object>}\n\t\t */\n\t\tendpointRows() {\n\t\t\treturn Array.isArray(this.epData) ? this.epData : []\n\t\t},\n\n\t\t/**\n\t\t * Whether the declarative `source` drives a self-fetch: a usable\n\t\t * source, no external rows (external rows always win), no active\n\t\t * endpoint binding (exactly-one-of — endpointSource wins when both\n\t\t * slip past the validator), and no unresolved required token.\n\t\t *\n\t\t * @return {boolean}\n\t\t */\n\t\tselfFetchActive() {\n\t\t\treturn !!(this.source && this.source.register && this.source.schema)\n\t\t\t\t&& (!this.rows || this.rows.length === 0)\n\t\t\t\t&& !this.endpointActive\n\t\t\t\t&& !this.waitingForContext\n\t\t},\n\n\t\t/**\n\t\t * Query params handed to CnDataTable's self-fetch: the resolved filter\n\t\t * as direct field params (OpenRegister object-search shape),\n\t\t * `_order[field]` entries from `source.order`, and — when\n\t\t * `source.limit` is set — `_limit` of limit + 1 so CnDataTable's\n\t\t * View-all footer can detect that more rows exist while the display\n\t\t * caps at `limit`.\n\t\t *\n\t\t * IN-lists: an ARRAY filter value (either directly on the field or via\n\t\t * the `{ in: [...] }` operator form) is emitted as the bare field with\n\t\t * the array value, which axios serializes as repeated bracket params\n\t\t * (`field[]=a&field[]=b`) — the same shape `buildQueryString` /\n\t\t * `useObjectStore` send and the only IN form OpenRegister parses (a\n\t\t * `field[in]`-style key is NOT understood server-side). Empty arrays\n\t\t * are skipped (no constraint).\n\t\t *\n\t\t * @return {object}\n\t\t */\n\t\tresolvedFetchParams() {\n\t\t\tconst src = this.source || {}\n\t\t\tconst params = {}\n\t\t\t// A page sort control (`source.pageControls.sort`) replaces the order.\n\t\t\tconst chosen = pageSort(src.pageControls, this.workspaceCtx, null)\n\t\t\tconst order = chosen ? { [chosen.field]: chosen.dir } : (src.order || {})\n\t\t\tfor (const [field, dir] of Object.entries(order)) {\n\t\t\t\tparams[`_order[${field}]`] = dir === 'desc' ? 'desc' : 'asc'\n\t\t\t}\n\t\t\tif (typeof src.limit === 'number' && src.limit > 0) {\n\t\t\t\tparams._limit = src.limit + 1\n\t\t\t}\n\t\t\t// `source.extend` (#91 Wave 3): forwarded as OR's repeated\n\t\t\t// `_extend[]` param so virtual/declarative fields (e.g.\n\t\t\t// `calculations` — procest daysOverdue) ride the fetch and are\n\t\t\t// displayable as ordinary columns. Serialized by the shared\n\t\t\t// query builder (array value → repeated `key[]`).\n\t\t\tif (Array.isArray(src.extend) && src.extend.length > 0) {\n\t\t\t\tparams._extend = src.extend.filter((e) => typeof e === 'string' && e !== '')\n\t\t\t}\n\t\t\tconst filter = this.resolvedFilter\n\t\t\tif (filter && typeof filter === 'object') {\n\t\t\t\tfor (const [k, v] of Object.entries(filter)) {\n\t\t\t\t\tif (Array.isArray(v)) {\n\t\t\t\t\t\tif (v.length > 0) {\n\t\t\t\t\t\t\tparams[k] = v\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (v && typeof v === 'object') {\n\t\t\t\t\t\tfor (const [op, ov] of Object.entries(v)) {\n\t\t\t\t\t\t\tif (op === 'in' && Array.isArray(ov)) {\n\t\t\t\t\t\t\t\t// OR's IN form is the bare repeated field param.\n\t\t\t\t\t\t\t\tif (ov.length > 0) {\n\t\t\t\t\t\t\t\t\tparams[k] = ov\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tparams[`${k}[${op}]`] = ov\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (v !== '' && v !== null && v !== undefined) {\n\t\t\t\t\t\tparams[k] = v\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn params\n\t\t},\n\n\t\t/**\n\t\t * `$props` minus the chrome props (`title`, `documentationUrl`,\n\t\t * `widgetId`, `hideWrapper`) and the widget-only props (`source`,\n\t\t * `endpointSource`, `actions`, `rowRoute`), so they are consumed here\n\t\t * and never forwarded to the inner CnDataTable. `undefined` values are\n\t\t * dropped so CnDataTable's own prop defaults apply. When the\n\t\t * declarative `source` is active it supplies `register` / `schemaId` /\n\t\t * `fetchParams` / `limit`; an `@resolve:` register sentinel passes\n\t\t * through unexpanded. When the Wave-2 `endpointSource` is active it\n\t\t * supplies the resolved `rows` + `loading` instead — columns,\n\t\t * formatters, and row navigation apply unchanged on top.\n\t\t *\n\t\t * @return {object}\n\t\t */\n\t\tinnerProps() {\n\t\t\tconst { title, documentationUrl, widgetId, hideWrapper, source, endpointSource, actions, rowRoute, rowClass, schema, ...rest } = this.$props\n\t\t\tconst inner = {}\n\t\t\tfor (const [k, v] of Object.entries(rest)) {\n\t\t\t\tif (v !== undefined) {\n\t\t\t\t\tinner[k] = v\n\t\t\t\t}\n\t\t\t}\n\t\t\t// This widget's `schema` is a slug, while CnDataTable's `schema` is a\n\t\t\t// schema object, so it is not forwarded. Nor is it mapped to `schemaId`:\n\t\t\t// that would turn on CnDataTable's unscoped self-fetch whenever the\n\t\t\t// widget's own rows are empty. Self-fetch comes from `source` alone.\n\t\t\t// `rowClass` is consumed here (function or declarative rules[]) and\n\t\t\t// forwarded to CnDataTable as a compiled `(row) => class` function.\n\t\t\tif (this.compiledRowClass) {\n\t\t\t\tinner.rowClass = this.compiledRowClass\n\t\t\t}\n\t\t\tif (this.selfFetchActive) {\n\t\t\t\tinner.register = this.source.register\n\t\t\t\tinner.schemaId = this.source.schema\n\t\t\t\tinner.fetchParams = this.resolvedFetchParams\n\t\t\t\tif (typeof this.source.limit === 'number' && this.source.limit > 0) {\n\t\t\t\t\tinner.limit = this.source.limit\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (this.endpointActive) {\n\t\t\t\tinner.rows = this.endpointRows\n\t\t\t\tinner.loading = this.epLoading || this.loading\n\t\t\t}\n\t\t\tif (this.rowRoute) {\n\t\t\t\tinner.rowClickRoute = this.rowRouteFn\n\t\t\t}\n\t\t\treturn inner\n\t\t},\n\n\t\t/**\n\t\t * The effective `rowClass` function forwarded to CnDataTable. A\n\t\t * host-supplied FUNCTION passes straight through; a declarative\n\t\t * rules[] array is compiled into a `(row) => string` that space-joins\n\t\t * every rule whose shared `visibleWhen` predicate holds against the\n\t\t * row (`field` dot-path + `op` + `value`). Null when `rowClass` is\n\t\t * unset or an empty array — the widget then forwards nothing so\n\t\t * CnDataTable's own default applies.\n\t\t *\n\t\t * @return {?(row: object) => string} The row-class function, or null.\n\t\t */\n\t\tcompiledRowClass() {\n\t\t\tconst rc = this.rowClass\n\t\t\tif (typeof rc === 'function') {\n\t\t\t\treturn rc\n\t\t\t}\n\t\t\tif (!Array.isArray(rc) || rc.length === 0) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst rules = rc\n\t\t\treturn (row) => {\n\t\t\t\tconst classes = []\n\t\t\t\tfor (const rule of rules) {\n\t\t\t\t\tif (!rule || !rule.class) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tconst when = rule.when || {}\n\t\t\t\t\tconst actual = readVisibleWhenPath(row, when.field)\n\t\t\t\t\tif (compareVisibleWhen(actual, when.op || 'eq', when.value)) {\n\t\t\t\t\t\tclasses.push(rule.class)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn classes.join(' ')\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Row-click navigation function derived from the `rowRoute` route\n\t\t * name (CnDataTable's `rowClickRoute` shape).\n\t\t *\n\t\t * @return {(row: object) => (object|null)} A vue-router location, or null for a row with no id.\n\t\t */\n\t\trowRouteFn() {\n\t\t\treturn (row) => {\n\t\t\t\tconst id = row && (row.id || (row['@self'] && row['@self'].id))\n\t\t\t\treturn id ? { name: this.rowRoute, params: { id: String(id) } } : null\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Actions rendered per row: every non-`object-op` type plus\n\t\t * `object-op` `patch` / `delete` (they mutate THAT row's object).\n\t\t *\n\t\t * @return {Array<object>}\n\t\t */\n\t\trowScopedActions() {\n\t\t\treturn (this.actions || []).filter((a) => a && (a.type !== 'object-op' || a.op === 'patch' || a.op === 'delete'))\n\t\t},\n\n\t\t/**\n\t\t * `object-op` `create` actions — widget-scoped (no row to mutate), so\n\t\t * they render in the list footer, never in the row menu.\n\t\t *\n\t\t * @return {Array<object>}\n\t\t */\n\t\tcreateActions() {\n\t\t\treturn (this.actions || []).filter((a) => a && a.type === 'object-op' && a.op === 'create')\n\t\t},\n\n\t\t/**\n\t\t * Row-scoped actions mapped onto the CnRowActions shape: label + icon\n\t\t * pass through, `object-op` `delete` renders destructive, and the\n\t\t * handler routes back through the widget's confirm-gated dispatcher.\n\t\t *\n\t\t * @return {Array<object>}\n\t\t */\n\t\tmappedRowActions() {\n\t\t\treturn this.rowScopedActions.map((action) => ({\n\t\t\t\tlabel: action.label,\n\t\t\t\ticon: action.icon,\n\t\t\t\tdestructive: action.type === 'object-op' && action.op === 'delete',\n\t\t\t\thandler: (row) => this.onActionTriggered(action, row),\n\t\t\t}))\n\t\t},\n\n\t\t/**\n\t\t * Host-supplied CnDataTable scoped slots to forward (keys only). The\n\t\t * `row-actions` slot is withheld while the widget renders its own\n\t\t * declarative actions menu.\n\t\t *\n\t\t * @return {object}\n\t\t */\n\t\tforwardedScopedSlots() {\n\t\t\tconst out = {}\n\t\t\tfor (const name of Object.keys(this.$slots || {})) {\n\t\t\t\tif (name === 'row-actions' && this.rowScopedActions.length > 0) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tout[name] = true\n\t\t\t}\n\t\t\treturn out\n\t\t},\n\n\t\t/**\n\t\t * Confirmation question for the pending confirm-gated action —\n\t\t * destructive copy for `delete`, a generic confirm otherwise.\n\t\t *\n\t\t * @return {string}\n\t\t */\n\t\tconfirmMessage() {\n\t\t\tif (this.confirmAction && this.confirmAction.op === 'delete') {\n\t\t\t\treturn t('nextcloud-vue', 'Are you sure you want to delete this item? This action cannot be undone.')\n\t\t\t}\n\t\t\treturn t('nextcloud-vue', 'Are you sure you want to continue?')\n\t\t},\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * Entry point for every declarative action trigger (row menu or\n\t\t * footer create button). `object-op` `delete` ALWAYS confirms;\n\t\t * `patch` / `create` confirm only when the action sets\n\t\t * `confirm: true`; everything else dispatches immediately.\n\t\t *\n\t\t * @param {object} action The manifest action.\n\t\t * @param {object|null} row The row for row-scoped actions (null for create).\n\t\t * @return {Promise<void>|void}\n\t\t */\n\t\tonActionTriggered(action, row) {\n\t\t\tif (action && action.type === 'object-op' && (action.op === 'delete' || action.confirm === true)) {\n\t\t\t\tthis.confirmAction = action\n\t\t\t\tthis.confirmRow = row\n\t\t\t\treturn\n\t\t\t}\n\t\t\treturn this.runAction(action, row)\n\t\t},\n\n\t\t/**\n\t\t * Confirm-dialog primary button: run the pending action and report\n\t\t * the outcome back into the dialog's result phase.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync onConfirmConfirmed() {\n\t\t\tconst outcome = await this.runAction(this.confirmAction, this.confirmRow)\n\t\t\tconst dialog = this.$refs.confirmDialog\n\t\t\tif (dialog) {\n\t\t\t\tdialog.setResult(outcome.ok ? { success: true } : { error: outcome.error })\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Close/cancel the confirm dialog and clear the pending action.\n\t\t */\n\t\tcloseConfirm() {\n\t\t\tthis.confirmAction = null\n\t\t\tthis.confirmRow = null\n\t\t},\n\n\t\t/**\n\t\t * Dispatch an action. Non-mutating types go through the page's\n\t\t * pre-bound `cnDispatchAction` (falling back to a bare\n\t\t * `dispatchAction`); for `handler` actions the row is appended as the\n\t\t * final handler argument so row context reaches the registry function.\n\t\t * `object-op` actions dispatch via the shared object store — a\n\t\t * rejected (RBAC) write surfaces `opError` and mutates NO local state;\n\t\t * a success clears the error and refreshes the self-fetched rows.\n\t\t *\n\t\t * @param {object} action The manifest action.\n\t\t * @param {object|null} row The target row (null for create).\n\t\t * @return {Promise<{ok: boolean, error?: string}>}\n\t\t */\n\t\tasync runAction(action, row) {\n\t\t\tif (!action) {\n\t\t\t\treturn { ok: false, error: '' }\n\t\t\t}\n\t\t\tif (action.type !== 'object-op') {\n\t\t\t\tconst wrapped = (!action.type || action.type === 'handler')\n\t\t\t\t\t? { ...action, args: [...(action.args || []), row] }\n\t\t\t\t\t: action\n\t\t\t\tif (typeof this.cnDispatchAction === 'function') {\n\t\t\t\t\tthis.cnDispatchAction(wrapped)\n\t\t\t\t} else {\n\t\t\t\t\tdispatchAction(wrapped, { router: this.$router || null })\n\t\t\t\t}\n\t\t\t\treturn { ok: true }\n\t\t\t}\n\n\t\t\tconst store = this.getObjectStore()\n\t\t\tconst result = await dispatchAction(action, {\n\t\t\t\tobjectStore: store,\n\t\t\t\tsource: this.source,\n\t\t\t\trow,\n\t\t\t})\n\t\t\tconst ok = !(result === null || result === false || result === undefined)\n\t\t\tif (!ok) {\n\t\t\t\tconst error = this.readStoreError(store)\n\t\t\t\tthis.opError = error\n\t\t\t\treturn { ok: false, error }\n\t\t\t}\n\t\t\tthis.opError = ''\n\t\t\tthis.refresh()\n\t\t\t/**\n\t\t\t * @event object-op Emitted after a successful declarative mutation\n\t\t\t * so a host that supplies external `rows` can refetch them.\n\t\t\t * @type {{action: object, row: (object|null), result: unknown}}\n\t\t\t */\n\t\t\tthis.$emit('object-op', { action, row, result })\n\t\t\treturn { ok: true }\n\t\t},\n\n\t\t/**\n\t\t * Re-run the active fetch: the endpoint binding (force-refetch past\n\t\t * the shared cache) or the inner CnDataTable's self-fetch. No-op when\n\t\t * the widget is fed external rows.\n\t\t */\n\t\trefresh() {\n\t\t\tif (this.endpointActive) {\n\t\t\t\tthis.epRefetch()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst table = this.$refs.dataTable\n\t\t\tif (this.selfFetchActive && table && typeof table.fetchData === 'function') {\n\t\t\t\ttable.fetchData()\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * The shared object store instance, or null when no Pinia is active\n\t\t * (`dispatchAction` then warns and no-ops).\n\t\t *\n\t\t * @return {object|null}\n\t\t */\n\t\tgetObjectStore() {\n\t\t\ttry {\n\t\t\t\treturn useObjectStore()\n\t\t\t} catch {\n\t\t\t\treturn null\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Human-readable message for the last store error on this widget's\n\t\t * source type (RBAC rejection, network failure, …).\n\t\t *\n\t\t * @param {object|null} store The object store used for the dispatch.\n\t\t * @return {string}\n\t\t */\n\t\treadStoreError(store) {\n\t\t\ttry {\n\t\t\t\tif (store && this.source) {\n\t\t\t\t\tconst type = resolveObjectOpType(store, this.source)\n\t\t\t\t\tconst err = store.errors && store.errors[type]\n\t\t\t\t\tif (err && err.message) {\n\t\t\t\t\t\treturn err.message\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// fall through to the generic message\n\t\t\t}\n\t\t\treturn t('nextcloud-vue', 'The operation was rejected')\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-widget-object-table {\n\twidth: 100%;\n}\n\n.cn-widget-object-table__footer {\n\tdisplay: flex;\n\tgap: 4px;\n\tpadding: 4px 8px;\n\tborder-top: 1px solid var(--color-border);\n}\n\n.cn-widget-object-table__error {\n\tcolor: var(--color-text-error, var(--color-error-text));\n\tfont-size: 0.85em;\n\tmargin: 4px 8px 0;\n}\n</style>\n"],"names":["_normalizeProps","_guardReactiveProps","_createElementVNode","_createSlots","_withCtx","_renderSlot","_createVNode","_openBlock","_createElementBlock","_Fragment","_renderList","_toDisplayString"],"mappings":";;AA6CO,MAAA,UAAA,GAAA,EAAA,KAAK,EAAA,wBAAA,GAAA;;;AAkBN,EAAA,KAAA,EAAA,gCAAA;;;;;;;;;;;;;;;iEApBY,CAAA,WAAA,GAAA,mBAAA,GAAA,iBAAA,CAAA,EAAAA,cAAA,CAAAC,kBAAA,CACR,MAAW,CAAA,WAAA,GAAA,EAAA,GAAA,EAAA,KAAA,EAAU,MAAM,CAAA,KAAA,EAAA,QAAA,EAAC,MAAQ,CAAA,QAAA,EAAA,gBAAA,EAAE,MAAgB,CAAA,gBAAA,EAAA,KAAA,EAAA,IAAA,EAAA,UAAA,EAAc,MAAA,CAAA,SAAA,EAAA,CAAA,CAAA,EAAA;qBAC1E;AAAA,MAAAC,kBAAA,QAAA;mBAaa,CAAA,sBAAA,aAAA,EAZD,GAAG,EAAC,WAAW,EAAA,EAAA,EAAA,GAAI,QAAA,CAAA,UAAA,EAAA,GAAA,IAAA,CAAA,MAAA,EAAA,CAAA,EAAAC,WAAA,CAAA,EAAA,CAAA,EAAA,CAAA,gBAAA,EAAA;qBAKD,QAAK,CAAA,oBAAA,EAAA,CAAjB,CAAC,EAAE,IAAI,KAAA;;oBAAU,IAAA;AAElC,cAAA,EAAA,EAAAC,OAAA,CAAA,CAFkC,QAAA,KAAA;gBAElCC,UAAU,CAAA,IAAA,CAAA,MAAA,EAAA,IAAA,EAAAL,cAAA,CAAAC,kBAAA,CAAA,QAAA,CAAA,CAAA,CAAA;;;;AAED,UAAA,CAAA,QAAA,CAAA,gBAAA,CAAA,MAAA,GAAA,CAAA;;sBAAA,aAAA;AACT,gBAAA,EAAA,EAAAG,OAAA,CAAA,CAAG,EADM,GAAA,EAAA,KAAA;kBACTE,WAAG,CAAA,uBAAA,EAAA;AAAA,oBAAA,OAAA,EAAA,QAAA,CAAA,gBAAA;AAAA,oBAAA,GAAA,EAAA,GAAA;;;;;;;AAOF,QAAA,CAAA,QAAA,CAAA,aAAA,CAAA,MAAA,GAAA,CAAA;AAAH,aAAAC,SAAA,EAAA,EAAAC,kBAAA,CAYM,OAZN,UAYM,EAAA;kDADF,CAAAC,QAAA,EAAA,IAAA,EAAAC,UAAA,CATW,QAAA,CAAA,aAAA,EAAA,CAAN,MAAM,KAAA;gDASX,CAAA,mBAAA,EAAA;AARD,kBAAA,GAAG,EAAE,MAAM,CAAC,EAAE,IAAG,MAAA,CAAA,KAAA;AAClB,kBAAA,OAAO,EAAC,UAAS;kBAChB,aAAW,EAAA,CAAA,iBAAA,EAAoB,MAAA,CAAA,EAAA,IAAA,QAAA,CAAA,CAAA;kBAC/B,OAAK,EAAA,MAAA,KAAE,QAAe,CAAA,iBAAA,CAAA,MAAA,EAAA,IAAA,CAAA,CAAA;;mCAGZ,MACX;oCADW,GACX,GAAAC,eAAA,CAAG,MAAM,CAAC,KAAK,CAAA,EAAA,CAAA,YAAA;;;;AAHC,kBAAA,CAAA,MAAM,CAAC,IAAI;;8BAAG,MAAI;oCACjC,MAAgC;0BAAhCL,WAAgC,CAAA,iBAAA,EAAA;4BAAvB,IAAI,EAAE,MAAM,CAAC,IAAI;AAAG,4BAAA,IAAG,EAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -74,6 +74,11 @@ function objectTableContentToProps(content) {
|
|
|
74
74
|
if (hasLimit) {
|
|
75
75
|
source.limit = limit;
|
|
76
76
|
}
|
|
77
|
+
// The page controls the table listens to belong to its source.
|
|
78
|
+
if (rest.pageControls && typeof rest.pageControls === 'object') {
|
|
79
|
+
source.pageControls = rest.pageControls;
|
|
80
|
+
delete rest.pageControls;
|
|
81
|
+
}
|
|
77
82
|
return { ...rest, source }
|
|
78
83
|
}
|
|
79
84
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboardRegistration.js","sources":["../../../../src/components/CnWidgetObjectTable/dashboardRegistration.js"],"sourcesContent":["/**\n * SPDX-FileCopyrightText: 2026 Conduction B.V.\n * SPDX-License-Identifier: EUPL-1.2\n *\n * Registers the `object-table` widget type (CnWidgetObjectTable) into the\n * shared dashboardWidgetRegistry so CnDashboardPage's `config.widgets[].type`\n * dispatch reaches the built-in v2 object-table (ConductionNL/nextcloud-vue#89).\n *\n * The registry branch in CnDashboardPage wraps every catalog widget in its\n * own CnWidgetWrapper — a naive registration of CnWidgetObjectTable would\n * therefore double-card (the widget renders its own CnWidgetWrapper for the\n * v2 grid). The registered renderer is a chrome-aware host adapter that\n * mounts the widget with `hideWrapper: true` (content-only) and normalises\n * the stored content blob onto the widget's declarative prop surface.\n *\n * Side-effect module kept separate from the component so importing\n * CnWidgetObjectTable (a public export) doesn't force the registration.\n */\n\nimport { h } from 'vue'\nimport CnObjectListWidgetForm from '../CnObjectListWidgetForm/CnObjectListWidgetForm.vue'\nimport CnWidgetObjectTable from './CnWidgetObjectTable.vue'\nimport { registerDashboardWidget } from '../CnWidgetGrid/dashboardWidgetRegistry.js'\n\n/**\n * Normalise a stored widget content blob onto CnWidgetObjectTable's props.\n *\n * Three content shapes are accepted:\n *\n * 1. v2-prop shape — content already carries a `source` object (plus\n * `columns`, `actions`, `hideHeader`, …). Passed through as-is.\n * 2. Flat form shape — the shape CnObjectListWidgetForm assembles\n * (`{ register, schema, filter, sort: {field, dir}, limit, columns }`).\n * Folded into the widget's `source` (`sort` becomes an\n * `order: { field: dir }` map), `limit` among it.\n * 3. Neither — no `source` and no register/schema, the shape an\n * `endpointSource` table stores. There is nothing to fold into, so\n * `limit` stays a top-level prop and the rest passes through.\n *\n * In all three, `limit` survives only as a positive finite number: the\n * widget's prop is `type: Number`, so a stored `'3'` is dropped.\n *\n * @param {object} content The stored widget `content` blob.\n * @return {object} A CnWidgetObjectTable props map (without `hideWrapper`).\n */\nexport function objectTableContentToProps(content) {\n\tconst c = (content && typeof content === 'object') ? content : {}\n\tconst { register, schema, filter, sort, limit, ...rest } = c\n\t// A stored blob can hold `limit: '3'`; the prop is `type: Number`, so an\n\t// unusable value has to be dropped rather than forwarded and warned about.\n\tconst hasLimit = Number.isFinite(limit) && limit > 0\n\tif (c.source && typeof c.source === 'object') {\n\t\tconst { limit: _limit, ...v2 } = c\n\t\treturn hasLimit ? { ...v2, limit } : { ...v2 }\n\t}\n\tif (!register && !schema) {\n\t\t// No register/schema means no `source` to fold `limit` into, but it is\n\t\t// a real prop of its own. Dropping it disabled `viewAllRoute` on every\n\t\t// endpointSource table: uncapped, the footer's \"total > shown\"\n\t\t// condition never held, so the View-all link never appeared.\n\t\treturn hasLimit ? { ...rest, limit } : { ...rest }\n\t}\n\tconst order = {}\n\tif (sort && sort.field) {\n\t\torder[sort.field] = sort.dir === 'desc' ? 'desc' : 'asc'\n\t}\n\tconst source = {\n\t\tregister: register || '',\n\t\tschema: schema || '',\n\t\tfilter: filter || {},\n\t\torder,\n\t}\n\tif (hasLimit) {\n\t\tsource.limit = limit\n\t}\n\treturn { ...rest, source }\n}\n\n/**\n * Chrome-aware host adapter: mounts CnWidgetObjectTable content-only\n * (`hideWrapper: true`) inside CnDashboardPage's own widget chrome, mapping\n * the stored `content` blob (bound by the dashboard's registry branch as the\n * `content` attr) onto the widget's props via {@link objectTableContentToProps}.\n */\nconst CnHostedObjectTable = {\n\tname: 'CnHostedObjectTable',\n\t// Vue 3: no `functional: true`; a render function on a normal component.\n\t// inheritAttrs:false so we forward $attrs explicitly (listeners are onXxx in\n\t// $attrs now, not a separate ctx.listeners) and don't double-apply to the root.\n\tinheritAttrs: false,\n\trender() {\n\t\tconst attrs = this.$attrs || {}\n\t\tconst content = (attrs.content && typeof attrs.content === 'object') ? attrs.content : attrs\n\t\t// Everything except `content` (mapped to props) passes through — this\n\t\t// carries parent listeners (onXxx) too. Vue 3: props/attrs/listeners are\n\t\t// one flat object; slots are the 3rd arg.\n\t\tconst { content: _content, ...rest } = attrs\n\t\treturn h(CnWidgetObjectTable, { ...rest, ...objectTableContentToProps(content), hideWrapper: true }, this.$slots)\n\t},\n}\n\nregisterDashboardWidget('object-table', {\n\trenderer: CnHostedObjectTable,\n\tform: CnObjectListWidgetForm,\n\tdefaultContent: {\n\t\tregister: '',\n\t\tschema: '',\n\t\tfilter: {},\n\t\tsort: { field: '', dir: 'asc' },\n\t\tlimit: 10,\n\t\tcolumns: [],\n\t},\n\tdisplayName: 'Object table',\n\ticon: 'TableLarge',\n})\n"],"names":["CnWidgetObjectTable","CnObjectListWidgetForm"],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,yBAAyB,CAAC,OAAO,EAAE;AACnD,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,GAAG,GAAE;AAClE,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,EAAC;AAC7D;AACA;AACA,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,EAAC;AACrD,CAAC,IAAI,CAAC,CAAC,MAAM,IAAI,OAAO,CAAC,CAAC,MAAM,KAAK,QAAQ,EAAE;AAC/C,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,GAAG,EAAC;AACpC,EAAE,OAAO,QAAQ,GAAG,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;AAChD,EAAE;AACF,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,MAAM,EAAE;AAC3B;AACA;AACA;AACA;AACA,EAAE,OAAO,QAAQ,GAAG,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE;AACpD,EAAE;AACF,CAAC,MAAM,KAAK,GAAG,GAAE;AACjB,CAAC,IAAI,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE;AACzB,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,KAAK,MAAM,GAAG,MAAM,GAAG,MAAK;AAC1D,EAAE;AACF,CAAC,MAAM,MAAM,GAAG;AAChB,EAAE,QAAQ,EAAE,QAAQ,IAAI,EAAE;AAC1B,EAAE,MAAM,EAAE,MAAM,IAAI,EAAE;AACtB,EAAE,MAAM,EAAE,MAAM,IAAI,EAAE;AACtB,EAAE,KAAK;AACP,GAAE;AACF,CAAC,IAAI,QAAQ,EAAE;AACf,EAAE,MAAM,CAAC,KAAK,GAAG,MAAK;AACtB,EAAE;AACF,CAAC,OAAO,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE;AAC3B,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,mBAAmB,GAAG;AAC5B,CAAC,IAAI,EAAE,qBAAqB;AAC5B;AACA;AACA;AACA,CAAC,YAAY,EAAE,KAAK;AACpB,CAAC,MAAM,GAAG;AACV,EAAE,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,IAAI,GAAE;AACjC,EAAE,MAAM,OAAO,GAAG,CAAC,KAAK,CAAC,OAAO,IAAI,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,GAAG,MAAK;AAC9F;AACA;AACA;AACA,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,GAAG,MAAK;AAC9C,EAAE,OAAO,CAAC,CAACA,YAAmB,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,yBAAyB,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC;AACnH,EAAE;AACF,EAAC;AACD;AACA,uBAAuB,CAAC,cAAc,EAAE;AACxC,CAAC,QAAQ,EAAE,mBAAmB;AAC9B,CAAC,IAAI,EAAEC,UAAsB;AAC7B,CAAC,cAAc,EAAE;AACjB,EAAE,QAAQ,EAAE,EAAE;AACd,EAAE,MAAM,EAAE,EAAE;AACZ,EAAE,MAAM,EAAE,EAAE;AACZ,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE;AACjC,EAAE,KAAK,EAAE,EAAE;AACX,EAAE,OAAO,EAAE,EAAE;AACb,EAAE;AACF,CAAC,WAAW,EAAE,cAAc;AAC5B,CAAC,IAAI,EAAE,YAAY;AACnB,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"dashboardRegistration.js","sources":["../../../../src/components/CnWidgetObjectTable/dashboardRegistration.js"],"sourcesContent":["/**\n * SPDX-FileCopyrightText: 2026 Conduction B.V.\n * SPDX-License-Identifier: EUPL-1.2\n *\n * Registers the `object-table` widget type (CnWidgetObjectTable) into the\n * shared dashboardWidgetRegistry so CnDashboardPage's `config.widgets[].type`\n * dispatch reaches the built-in v2 object-table (ConductionNL/nextcloud-vue#89).\n *\n * The registry branch in CnDashboardPage wraps every catalog widget in its\n * own CnWidgetWrapper — a naive registration of CnWidgetObjectTable would\n * therefore double-card (the widget renders its own CnWidgetWrapper for the\n * v2 grid). The registered renderer is a chrome-aware host adapter that\n * mounts the widget with `hideWrapper: true` (content-only) and normalises\n * the stored content blob onto the widget's declarative prop surface.\n *\n * Side-effect module kept separate from the component so importing\n * CnWidgetObjectTable (a public export) doesn't force the registration.\n */\n\nimport { h } from 'vue'\nimport CnObjectListWidgetForm from '../CnObjectListWidgetForm/CnObjectListWidgetForm.vue'\nimport CnWidgetObjectTable from './CnWidgetObjectTable.vue'\nimport { registerDashboardWidget } from '../CnWidgetGrid/dashboardWidgetRegistry.js'\n\n/**\n * Normalise a stored widget content blob onto CnWidgetObjectTable's props.\n *\n * Three content shapes are accepted:\n *\n * 1. v2-prop shape — content already carries a `source` object (plus\n * `columns`, `actions`, `hideHeader`, …). Passed through as-is.\n * 2. Flat form shape — the shape CnObjectListWidgetForm assembles\n * (`{ register, schema, filter, sort: {field, dir}, limit, columns }`).\n * Folded into the widget's `source` (`sort` becomes an\n * `order: { field: dir }` map), `limit` among it.\n * 3. Neither — no `source` and no register/schema, the shape an\n * `endpointSource` table stores. There is nothing to fold into, so\n * `limit` stays a top-level prop and the rest passes through.\n *\n * In all three, `limit` survives only as a positive finite number: the\n * widget's prop is `type: Number`, so a stored `'3'` is dropped.\n *\n * @param {object} content The stored widget `content` blob.\n * @return {object} A CnWidgetObjectTable props map (without `hideWrapper`).\n */\nexport function objectTableContentToProps(content) {\n\tconst c = (content && typeof content === 'object') ? content : {}\n\tconst { register, schema, filter, sort, limit, ...rest } = c\n\t// A stored blob can hold `limit: '3'`; the prop is `type: Number`, so an\n\t// unusable value has to be dropped rather than forwarded and warned about.\n\tconst hasLimit = Number.isFinite(limit) && limit > 0\n\tif (c.source && typeof c.source === 'object') {\n\t\tconst { limit: _limit, ...v2 } = c\n\t\treturn hasLimit ? { ...v2, limit } : { ...v2 }\n\t}\n\tif (!register && !schema) {\n\t\t// No register/schema means no `source` to fold `limit` into, but it is\n\t\t// a real prop of its own. Dropping it disabled `viewAllRoute` on every\n\t\t// endpointSource table: uncapped, the footer's \"total > shown\"\n\t\t// condition never held, so the View-all link never appeared.\n\t\treturn hasLimit ? { ...rest, limit } : { ...rest }\n\t}\n\tconst order = {}\n\tif (sort && sort.field) {\n\t\torder[sort.field] = sort.dir === 'desc' ? 'desc' : 'asc'\n\t}\n\tconst source = {\n\t\tregister: register || '',\n\t\tschema: schema || '',\n\t\tfilter: filter || {},\n\t\torder,\n\t}\n\tif (hasLimit) {\n\t\tsource.limit = limit\n\t}\n\t// The page controls the table listens to belong to its source.\n\tif (rest.pageControls && typeof rest.pageControls === 'object') {\n\t\tsource.pageControls = rest.pageControls\n\t\tdelete rest.pageControls\n\t}\n\treturn { ...rest, source }\n}\n\n/**\n * Chrome-aware host adapter: mounts CnWidgetObjectTable content-only\n * (`hideWrapper: true`) inside CnDashboardPage's own widget chrome, mapping\n * the stored `content` blob (bound by the dashboard's registry branch as the\n * `content` attr) onto the widget's props via {@link objectTableContentToProps}.\n */\nconst CnHostedObjectTable = {\n\tname: 'CnHostedObjectTable',\n\t// Vue 3: no `functional: true`; a render function on a normal component.\n\t// inheritAttrs:false so we forward $attrs explicitly (listeners are onXxx in\n\t// $attrs now, not a separate ctx.listeners) and don't double-apply to the root.\n\tinheritAttrs: false,\n\trender() {\n\t\tconst attrs = this.$attrs || {}\n\t\tconst content = (attrs.content && typeof attrs.content === 'object') ? attrs.content : attrs\n\t\t// Everything except `content` (mapped to props) passes through — this\n\t\t// carries parent listeners (onXxx) too. Vue 3: props/attrs/listeners are\n\t\t// one flat object; slots are the 3rd arg.\n\t\tconst { content: _content, ...rest } = attrs\n\t\treturn h(CnWidgetObjectTable, { ...rest, ...objectTableContentToProps(content), hideWrapper: true }, this.$slots)\n\t},\n}\n\nregisterDashboardWidget('object-table', {\n\trenderer: CnHostedObjectTable,\n\tform: CnObjectListWidgetForm,\n\tdefaultContent: {\n\t\tregister: '',\n\t\tschema: '',\n\t\tfilter: {},\n\t\tsort: { field: '', dir: 'asc' },\n\t\tlimit: 10,\n\t\tcolumns: [],\n\t},\n\tdisplayName: 'Object table',\n\ticon: 'TableLarge',\n})\n"],"names":["CnWidgetObjectTable","CnObjectListWidgetForm"],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,yBAAyB,CAAC,OAAO,EAAE;AACnD,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,GAAG,GAAE;AAClE,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,EAAC;AAC7D;AACA;AACA,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,EAAC;AACrD,CAAC,IAAI,CAAC,CAAC,MAAM,IAAI,OAAO,CAAC,CAAC,MAAM,KAAK,QAAQ,EAAE;AAC/C,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,GAAG,EAAC;AACpC,EAAE,OAAO,QAAQ,GAAG,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;AAChD,EAAE;AACF,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,MAAM,EAAE;AAC3B;AACA;AACA;AACA;AACA,EAAE,OAAO,QAAQ,GAAG,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE;AACpD,EAAE;AACF,CAAC,MAAM,KAAK,GAAG,GAAE;AACjB,CAAC,IAAI,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE;AACzB,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,KAAK,MAAM,GAAG,MAAM,GAAG,MAAK;AAC1D,EAAE;AACF,CAAC,MAAM,MAAM,GAAG;AAChB,EAAE,QAAQ,EAAE,QAAQ,IAAI,EAAE;AAC1B,EAAE,MAAM,EAAE,MAAM,IAAI,EAAE;AACtB,EAAE,MAAM,EAAE,MAAM,IAAI,EAAE;AACtB,EAAE,KAAK;AACP,GAAE;AACF,CAAC,IAAI,QAAQ,EAAE;AACf,EAAE,MAAM,CAAC,KAAK,GAAG,MAAK;AACtB,EAAE;AACF;AACA,CAAC,IAAI,IAAI,CAAC,YAAY,IAAI,OAAO,IAAI,CAAC,YAAY,KAAK,QAAQ,EAAE;AACjE,EAAE,MAAM,CAAC,YAAY,GAAG,IAAI,CAAC,aAAY;AACzC,EAAE,OAAO,IAAI,CAAC,aAAY;AAC1B,EAAE;AACF,CAAC,OAAO,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE;AAC3B,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,mBAAmB,GAAG;AAC5B,CAAC,IAAI,EAAE,qBAAqB;AAC5B;AACA;AACA;AACA,CAAC,YAAY,EAAE,KAAK;AACpB,CAAC,MAAM,GAAG;AACV,EAAE,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,IAAI,GAAE;AACjC,EAAE,MAAM,OAAO,GAAG,CAAC,KAAK,CAAC,OAAO,IAAI,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,GAAG,MAAK;AAC9F;AACA;AACA;AACA,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,GAAG,MAAK;AAC9C,EAAE,OAAO,CAAC,CAACA,YAAmB,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,yBAAyB,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC;AACnH,EAAE;AACF,EAAC;AACD;AACA,uBAAuB,CAAC,cAAc,EAAE;AACxC,CAAC,QAAQ,EAAE,mBAAmB;AAC9B,CAAC,IAAI,EAAEC,UAAsB;AAC7B,CAAC,cAAc,EAAE;AACjB,EAAE,QAAQ,EAAE,EAAE;AACd,EAAE,MAAM,EAAE,EAAE;AACZ,EAAE,MAAM,EAAE,EAAE;AACZ,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE;AACjC,EAAE,KAAK,EAAE,EAAE;AACX,EAAE,OAAO,EAAE,EAAE;AACb,EAAE;AACF,CAAC,WAAW,EAAE,cAAc;AAC5B,CAAC,IAAI,EAAE,YAAY;AACnB,CAAC;;;;"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { subscribe, unsubscribe } from '@nextcloud/event-bus';
|
|
1
2
|
import { translate } from '@nextcloud/l10n';
|
|
2
3
|
import { NcSelect, NcCheckboxRadioSwitch } from '@nextcloud/vue';
|
|
3
4
|
import __sfc_main from '../CnResourceSelect/CnResourceSelect.vue.js';
|
|
5
|
+
import __sfc_main$1 from '../CnSegmentedControl/CnSegmentedControl.vue.js';
|
|
4
6
|
import { fetchEndpointSource } from '../../composables/useEndpointSource.js';
|
|
7
|
+
import { fetchListTotal } from '../../utils/fetchFilterCounts.js';
|
|
5
8
|
import { resolveFilterTokens } from '../../utils/resolveFilterTokens.js';
|
|
6
9
|
|
|
7
10
|
/**
|
|
@@ -32,7 +35,7 @@ import { resolveFilterTokens } from '../../utils/resolveFilterTokens.js';
|
|
|
32
35
|
* content: {
|
|
33
36
|
* label: 'Queue',
|
|
34
37
|
* writes: '@workspace.queue',
|
|
35
|
-
* style: 'radio', // 'radio' (default) | 'select'
|
|
38
|
+
* style: 'radio', // 'radio' (default) | 'select' | 'chips'
|
|
36
39
|
* allLabel: 'All',
|
|
37
40
|
* showCounts: true,
|
|
38
41
|
* source: { register: 'pipelinq', schema: 'werkitem', groupBy: 'queue' },
|
|
@@ -42,7 +45,7 @@ import { resolveFilterTokens } from '../../utils/resolveFilterTokens.js';
|
|
|
42
45
|
var script = {
|
|
43
46
|
name: 'CnWorkspaceFilterWidget',
|
|
44
47
|
|
|
45
|
-
components: { CnResourceSelect: __sfc_main, NcSelect, NcCheckboxRadioSwitch },
|
|
48
|
+
components: { CnResourceSelect: __sfc_main, CnSegmentedControl: __sfc_main$1, NcSelect, NcCheckboxRadioSwitch },
|
|
46
49
|
|
|
47
50
|
inject: {
|
|
48
51
|
/**
|
|
@@ -68,7 +71,19 @@ var script = {
|
|
|
68
71
|
* server and writes the picked object's id; without a selection and
|
|
69
72
|
* without `allLabel` it selects the first object.
|
|
70
73
|
*
|
|
71
|
-
*
|
|
74
|
+
* Chips (screens-page-lenses): `style: "chips"` draws the options as one
|
|
75
|
+
* compact segmented group with a count after each label. An option's
|
|
76
|
+
* `countFrom` (`{ register, schema, filter? }`, or a list of them that
|
|
77
|
+
* are added up) counts that list; a static `count` is used otherwise.
|
|
78
|
+
* `urlKey` keeps the choice in the address (`?<urlKey>=<value>`), and
|
|
79
|
+
* the address wins over `default` on load.
|
|
80
|
+
*
|
|
81
|
+
* Page controls (screens-page-controls): `style: "toggle"` is a switch
|
|
82
|
+
* that writes `onValue` / `offValue` (true / false); `layout: "bar"`
|
|
83
|
+
* with `controls` draws several controls side by side in one row, and
|
|
84
|
+
* `align: "end"` pushes a control to the right edge.
|
|
85
|
+
*
|
|
86
|
+
* @type {{label?: string, controls?: Array<object>, onValue?: unknown, offValue?: unknown, align?: string, urlKey?: string, writes?: string, style?: string, allLabel?: string, showCounts?: boolean, options?: Array, source?: object, endpointSource?: object, objectSource?: object, default?: (string|number), layout?: string, title?: string, description?: string, link?: object}}
|
|
72
87
|
*/
|
|
73
88
|
content: {
|
|
74
89
|
type: Object,
|
|
@@ -86,6 +101,8 @@ var script = {
|
|
|
86
101
|
loading: false,
|
|
87
102
|
/** The currently-selected value (mirrors the workspace key). */
|
|
88
103
|
selected: undefined,
|
|
104
|
+
/** Counted totals of the options that ask (`countFrom`), by option position. */
|
|
105
|
+
optionCounts: {},
|
|
89
106
|
}
|
|
90
107
|
},
|
|
91
108
|
|
|
@@ -139,9 +156,73 @@ var script = {
|
|
|
139
156
|
return src && typeof src === 'object' && src.register && src.schema ? src : null
|
|
140
157
|
},
|
|
141
158
|
|
|
142
|
-
/** Choice style: 'select' or 'radio' (default). */
|
|
159
|
+
/** Choice style: 'chips', 'select' or 'radio' (default). */
|
|
143
160
|
style() {
|
|
144
|
-
return this.content.style
|
|
161
|
+
return ['select', 'chips', 'toggle'].includes(this.content.style) ? this.content.style : 'radio'
|
|
162
|
+
},
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* The chips: each option with its label translated and its count,
|
|
166
|
+
* the static one or the counted one.
|
|
167
|
+
*
|
|
168
|
+
* @return {Array<{value: string, label: string, count?: number}>}
|
|
169
|
+
* @spec openspec/changes/screens-page-lenses/specs/page-lenses/spec.md#requirement-a-workspace-filter-can-draw-chips-with-counts
|
|
170
|
+
*/
|
|
171
|
+
chipOptions() {
|
|
172
|
+
return this.displayOptions.map((option, index) => {
|
|
173
|
+
const counted = this.optionCounts[index];
|
|
174
|
+
const count = counted !== undefined && counted !== null ? counted : option.count;
|
|
175
|
+
const chip = { value: String(option.value), label: this.tr(option.label) };
|
|
176
|
+
if (this.showCounts && Number.isFinite(count)) {
|
|
177
|
+
chip.count = count;
|
|
178
|
+
}
|
|
179
|
+
return chip
|
|
180
|
+
})
|
|
181
|
+
},
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Whether the widget is a bar of controls (`layout: "bar"`).
|
|
185
|
+
*
|
|
186
|
+
* @return {boolean}
|
|
187
|
+
* @spec openspec/changes/screens-page-controls/specs/page-controls/spec.md#requirement-a-bar-holds-the-pages-controls-in-one-row
|
|
188
|
+
*/
|
|
189
|
+
isBar() {
|
|
190
|
+
return this.content.layout === 'bar' && Array.isArray(this.content.controls)
|
|
191
|
+
},
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* The bar's controls, each an inline workspace filter of its own.
|
|
195
|
+
*
|
|
196
|
+
* @return {Array<object>}
|
|
197
|
+
*/
|
|
198
|
+
barControls() {
|
|
199
|
+
return this.content.controls
|
|
200
|
+
.filter((control) => control && typeof control === 'object')
|
|
201
|
+
.map((control) => ({ ...control, inline: true }))
|
|
202
|
+
},
|
|
203
|
+
|
|
204
|
+
/** @return {unknown} The value a switch writes when on. */
|
|
205
|
+
onValue() {
|
|
206
|
+
return this.content.onValue !== undefined ? this.content.onValue : true
|
|
207
|
+
},
|
|
208
|
+
|
|
209
|
+
/** @return {unknown} The value a switch writes when off. */
|
|
210
|
+
offValue() {
|
|
211
|
+
return this.content.offValue !== undefined ? this.content.offValue : false
|
|
212
|
+
},
|
|
213
|
+
|
|
214
|
+
/** @return {boolean} Whether the switch is on. */
|
|
215
|
+
toggleOn() {
|
|
216
|
+
return this.selected !== undefined && String(this.selected) === String(this.onValue)
|
|
217
|
+
},
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* The address key that carries the choice (`urlKey`), or ''.
|
|
221
|
+
*
|
|
222
|
+
* @return {string}
|
|
223
|
+
*/
|
|
224
|
+
urlKey() {
|
|
225
|
+
return typeof this.content.urlKey === 'string' ? this.content.urlKey : ''
|
|
145
226
|
},
|
|
146
227
|
|
|
147
228
|
/** Whether to render per-option counts. */
|
|
@@ -222,17 +303,115 @@ var script = {
|
|
|
222
303
|
// Seed the selection: existing workspace value → content.default → the
|
|
223
304
|
// "All" clear option (empty) when present, else the first option once
|
|
224
305
|
// loaded (handled in loadOptions).
|
|
306
|
+
const fromAddress = this.readAddress();
|
|
225
307
|
const existing = this.readWorkspace();
|
|
226
|
-
if (
|
|
308
|
+
if (fromAddress !== undefined) {
|
|
309
|
+
this.selected = fromAddress;
|
|
310
|
+
this.writeWorkspace(fromAddress);
|
|
311
|
+
} else if (existing !== undefined) {
|
|
227
312
|
this.selected = existing;
|
|
228
313
|
} else if (this.content.default !== undefined) {
|
|
229
314
|
this.selected = this.content.default;
|
|
230
315
|
this.writeWorkspace(this.content.default);
|
|
316
|
+
} else if (this.style === 'toggle') {
|
|
317
|
+
// A switch starts off, and says so, so a condition on its key holds.
|
|
318
|
+
this.selected = this.offValue;
|
|
319
|
+
this.writeWorkspace(this.offValue);
|
|
231
320
|
}
|
|
232
321
|
this.loadOptions();
|
|
233
322
|
},
|
|
234
323
|
|
|
324
|
+
mounted() {
|
|
325
|
+
this.onPageRefresh = () => this.loadCounts();
|
|
326
|
+
subscribe('cn:page:refresh', this.onPageRefresh);
|
|
327
|
+
this.loadCounts();
|
|
328
|
+
},
|
|
329
|
+
|
|
330
|
+
beforeUnmount() {
|
|
331
|
+
unsubscribe('cn:page:refresh', this.onPageRefresh);
|
|
332
|
+
},
|
|
333
|
+
|
|
235
334
|
methods: {
|
|
335
|
+
/**
|
|
336
|
+
* The choice named in the address (`?<urlKey>=…`), when it is one of
|
|
337
|
+
* the options; undefined otherwise.
|
|
338
|
+
*
|
|
339
|
+
* @return {string|undefined}
|
|
340
|
+
* @spec openspec/changes/screens-page-lenses/specs/page-lenses/spec.md#requirement-the-choice-is-in-the-address
|
|
341
|
+
*/
|
|
342
|
+
readAddress() {
|
|
343
|
+
if (!this.urlKey || !this.$route || !this.$route.query) {
|
|
344
|
+
return undefined
|
|
345
|
+
}
|
|
346
|
+
const raw = this.$route.query[this.urlKey];
|
|
347
|
+
if (this.style === 'toggle') {
|
|
348
|
+
if (raw === undefined) {
|
|
349
|
+
return undefined
|
|
350
|
+
}
|
|
351
|
+
return [this.onValue, this.offValue].find((value) => String(value) === String(raw))
|
|
352
|
+
}
|
|
353
|
+
const known = this.displayOptions.some((option) => String(option.value) === String(raw));
|
|
354
|
+
return known ? String(raw) : undefined
|
|
355
|
+
},
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Write the choice to the address, replacing the history entry and
|
|
359
|
+
* keeping the other query keys.
|
|
360
|
+
*
|
|
361
|
+
* @param {unknown} value The chosen value.
|
|
362
|
+
* @return {void}
|
|
363
|
+
* @spec openspec/changes/screens-page-lenses/specs/page-lenses/spec.md#requirement-the-choice-is-in-the-address
|
|
364
|
+
*/
|
|
365
|
+
writeAddress(value) {
|
|
366
|
+
if (!this.urlKey || !this.$router || !this.$route) {
|
|
367
|
+
return
|
|
368
|
+
}
|
|
369
|
+
const query = this.$route.query || {};
|
|
370
|
+
if (String(query[this.urlKey]) === String(value)) {
|
|
371
|
+
return
|
|
372
|
+
}
|
|
373
|
+
const result = this.$router.replace({ query: { ...query, [this.urlKey]: String(value) } });
|
|
374
|
+
if (result && typeof result.catch === 'function') {
|
|
375
|
+
result.catch(() => {});
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Count the lists behind the options that ask (`countFrom`: a list
|
|
381
|
+
* `{ register, schema, filter? }`, or several that are added up). One
|
|
382
|
+
* list request each; an option whose count failed shows none.
|
|
383
|
+
*
|
|
384
|
+
* @return {Promise<void>}
|
|
385
|
+
* @spec openspec/changes/screens-page-lenses/specs/page-lenses/spec.md#requirement-a-workspace-filter-can-draw-chips-with-counts
|
|
386
|
+
*/
|
|
387
|
+
async loadCounts() {
|
|
388
|
+
const options = this.displayOptions;
|
|
389
|
+
const seq = (this.countSeq = (this.countSeq || 0) + 1);
|
|
390
|
+
const ctx = { workspace: this.readWorkspaceBag() };
|
|
391
|
+
await Promise.all(options.map(async (option, index) => {
|
|
392
|
+
const raw = (Array.isArray(this.content.options) ? this.content.options : [])
|
|
393
|
+
.find((candidate) => candidate && typeof candidate === 'object' && String(candidate.value ?? candidate.id) === String(option.value));
|
|
394
|
+
const from = raw ? raw.countFrom : null;
|
|
395
|
+
const lists = (Array.isArray(from) ? from : [from]).filter((list) => list && typeof list === 'object' && list.register && list.schema);
|
|
396
|
+
if (lists.length === 0) {
|
|
397
|
+
return
|
|
398
|
+
}
|
|
399
|
+
let total;
|
|
400
|
+
try {
|
|
401
|
+
const parts = await Promise.all(lists.map((list) => fetchListTotal(list.register, list.schema, list.filter || {}, ctx)));
|
|
402
|
+
if (parts.some((part) => part === null)) {
|
|
403
|
+
throw new Error('no total')
|
|
404
|
+
}
|
|
405
|
+
total = parts.reduce((sum, part) => sum + part, 0);
|
|
406
|
+
} catch {
|
|
407
|
+
total = null;
|
|
408
|
+
}
|
|
409
|
+
if (seq === this.countSeq) {
|
|
410
|
+
this.optionCounts = { ...this.optionCounts, [index]: total };
|
|
411
|
+
}
|
|
412
|
+
}));
|
|
413
|
+
},
|
|
414
|
+
|
|
236
415
|
/**
|
|
237
416
|
* Normalise a raw option into `{ value, label, count? }`. Accepts
|
|
238
417
|
* `{ value, label, count }`, `{ id, name }`, `{ key, count }` (OR
|
|
@@ -409,6 +588,17 @@ var script = {
|
|
|
409
588
|
this.applySelection(option.value);
|
|
410
589
|
},
|
|
411
590
|
|
|
591
|
+
/**
|
|
592
|
+
* Switch handler: write `onValue` or `offValue`.
|
|
593
|
+
*
|
|
594
|
+
* @param {boolean} on Whether the switch is on.
|
|
595
|
+
* @return {void}
|
|
596
|
+
* @spec openspec/changes/screens-page-controls/specs/page-controls/spec.md#requirement-a-toggle-and-a-select-are-page-controls
|
|
597
|
+
*/
|
|
598
|
+
onToggle(on) {
|
|
599
|
+
this.applySelection(on ? this.onValue : this.offValue);
|
|
600
|
+
},
|
|
601
|
+
|
|
412
602
|
/**
|
|
413
603
|
* NcSelect input handler.
|
|
414
604
|
*
|
|
@@ -429,6 +619,7 @@ var script = {
|
|
|
429
619
|
applySelection(value) {
|
|
430
620
|
this.selected = value;
|
|
431
621
|
this.writeWorkspace(value);
|
|
622
|
+
this.writeAddress(value);
|
|
432
623
|
/**
|
|
433
624
|
* @event change Emitted when the selection changes. Payload: `{ key, value }`.
|
|
434
625
|
*/
|