@conduction/nextcloud-vue 0.1.0-beta.3 → 0.1.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/README.md +226 -226
  2. package/dist/nextcloud-vue.cjs +67614 -0
  3. package/dist/nextcloud-vue.cjs.js +58386 -6112
  4. package/dist/nextcloud-vue.cjs.js.map +1 -1
  5. package/dist/nextcloud-vue.cjs.map +1 -0
  6. package/dist/nextcloud-vue.css +1819 -285
  7. package/dist/nextcloud-vue.esm.js +58342 -6088
  8. package/dist/nextcloud-vue.esm.js.map +1 -1
  9. package/package.json +82 -62
  10. package/src/components/CnActionsBar/CnActionsBar.vue +17 -7
  11. package/src/components/CnActionsBar/index.js +1 -1
  12. package/src/components/CnAdvancedFormDialog/CnAdvancedFormDialog.vue +579 -0
  13. package/src/components/CnAdvancedFormDialog/CnDataTab.vue +217 -0
  14. package/src/components/CnAdvancedFormDialog/CnMetadataTab.vue +121 -0
  15. package/src/components/CnAdvancedFormDialog/CnPropertiesTab.vue +418 -0
  16. package/src/components/CnAdvancedFormDialog/CnPropertyValueCell.vue +247 -0
  17. package/src/components/CnAdvancedFormDialog/index.js +1 -0
  18. package/src/components/CnCardGrid/CnCardGrid.vue +1 -1
  19. package/src/components/CnCardGrid/index.js +1 -1
  20. package/src/components/CnCellRenderer/index.js +1 -1
  21. package/src/components/CnChartWidget/CnChartWidget.vue +320 -0
  22. package/src/components/CnChartWidget/index.js +1 -0
  23. package/src/components/CnConfigurationCard/index.js +1 -1
  24. package/src/components/CnCopyDialog/CnCopyDialog.vue +250 -250
  25. package/src/components/CnDashboardGrid/CnDashboardGrid.vue +225 -0
  26. package/src/components/CnDashboardGrid/index.js +1 -0
  27. package/src/components/CnDashboardPage/CnDashboardPage.vue +390 -0
  28. package/src/components/CnDashboardPage/index.js +1 -0
  29. package/src/components/CnDataTable/CnDataTable.vue +1 -1
  30. package/src/components/CnDataTable/index.js +1 -1
  31. package/src/components/CnDeleteDialog/CnDeleteDialog.vue +170 -170
  32. package/src/components/CnDetailCard/CnDetailCard.vue +214 -0
  33. package/src/components/CnDetailCard/index.js +1 -0
  34. package/src/components/CnDetailPage/CnDetailPage.vue +285 -0
  35. package/src/components/CnDetailPage/index.js +1 -0
  36. package/src/components/CnFacetSidebar/CnFacetSidebar.vue +9 -1
  37. package/src/components/CnFacetSidebar/index.js +1 -1
  38. package/src/components/CnFilterBar/index.js +1 -1
  39. package/src/components/CnFormDialog/CnFormDialog.vue +302 -11
  40. package/src/components/CnIcon/index.js +1 -1
  41. package/src/components/CnIndexPage/CnIndexPage.vue +71 -3
  42. package/src/components/CnIndexPage/index.js +1 -1
  43. package/src/components/CnIndexSidebar/CnIndexSidebar.vue +121 -102
  44. package/src/components/CnIndexSidebar/index.js +1 -1
  45. package/src/components/CnItemCard/CnItemCard.vue +132 -0
  46. package/src/components/CnItemCard/index.js +1 -0
  47. package/src/components/CnKpiGrid/index.js +1 -1
  48. package/src/components/CnMassActionBar/index.js +1 -1
  49. package/src/components/CnMassCopyDialog/index.js +1 -1
  50. package/src/components/CnMassDeleteDialog/index.js +1 -1
  51. package/src/components/CnMassExportDialog/index.js +1 -1
  52. package/src/components/CnMassImportDialog/index.js +1 -1
  53. package/src/components/CnNoteCard/CnNoteCard.vue +149 -0
  54. package/src/components/CnNoteCard/index.js +1 -0
  55. package/src/components/CnNotesCard/CnNotesCard.vue +413 -0
  56. package/src/components/CnNotesCard/index.js +1 -0
  57. package/src/components/CnObjectCard/CnObjectCard.vue +1 -1
  58. package/src/components/CnObjectCard/index.js +1 -1
  59. package/src/components/CnObjectSidebar/CnObjectSidebar.vue +876 -0
  60. package/src/components/CnObjectSidebar/index.js +1 -0
  61. package/src/components/CnPageHeader/index.js +1 -1
  62. package/src/components/CnPagination/index.js +1 -1
  63. package/src/components/CnRegisterMapping/CnRegisterMapping.vue +792 -792
  64. package/src/components/CnRowActions/CnRowActions.vue +25 -3
  65. package/src/components/CnRowActions/index.js +1 -1
  66. package/src/components/CnSchemaFormDialog/CnSchemaConfigurationTab.vue +226 -0
  67. package/src/components/CnSchemaFormDialog/CnSchemaFormDialog.vue +787 -0
  68. package/src/components/CnSchemaFormDialog/CnSchemaPropertiesTab.vue +305 -0
  69. package/src/components/CnSchemaFormDialog/CnSchemaPropertyActions.vue +1398 -0
  70. package/src/components/CnSchemaFormDialog/CnSchemaSecurityTab.vue +236 -0
  71. package/src/components/CnSchemaFormDialog/index.js +1 -0
  72. package/src/components/CnSettingsCard/index.js +1 -1
  73. package/src/components/CnSettingsSection/index.js +1 -1
  74. package/src/components/CnStatsBlock/CnStatsBlock.vue +62 -8
  75. package/src/components/CnStatsBlock/index.js +1 -1
  76. package/src/components/CnStatusBadge/index.js +1 -1
  77. package/src/components/CnTabbedFormDialog/CnTabbedFormDialog.vue +540 -0
  78. package/src/components/CnTabbedFormDialog/index.js +1 -0
  79. package/src/components/CnTasksCard/CnTasksCard.vue +373 -0
  80. package/src/components/CnTasksCard/index.js +1 -0
  81. package/src/components/CnTileWidget/CnTileWidget.vue +159 -0
  82. package/src/components/CnTileWidget/index.js +1 -0
  83. package/src/components/CnTimelineStages/CnTimelineStages.vue +292 -0
  84. package/src/components/CnTimelineStages/index.js +1 -0
  85. package/src/components/CnUserActionMenu/CnUserActionMenu.vue +435 -0
  86. package/src/components/CnUserActionMenu/index.js +1 -0
  87. package/src/components/CnVersionInfoCard/index.js +1 -1
  88. package/src/components/CnWidgetRenderer/CnWidgetRenderer.vue +180 -0
  89. package/src/components/CnWidgetRenderer/index.js +1 -0
  90. package/src/components/CnWidgetWrapper/CnWidgetWrapper.vue +211 -0
  91. package/src/components/CnWidgetWrapper/index.js +1 -0
  92. package/src/components/index.js +43 -29
  93. package/src/composables/index.js +4 -3
  94. package/src/composables/useDashboardView.js +240 -0
  95. package/src/composables/useDetailView.js +289 -132
  96. package/src/composables/useListView.js +363 -362
  97. package/src/composables/useSubResource.js +142 -142
  98. package/src/constants/metadata.js +30 -30
  99. package/src/css/CnSchemaFormDialog.css +546 -0
  100. package/src/css/__sample_nextcloud_tokens.css +110 -0
  101. package/src/css/actions-bar.css +48 -48
  102. package/src/css/badge.css +51 -51
  103. package/src/css/card.css +128 -128
  104. package/src/css/dashboard.css +70 -0
  105. package/src/css/detail-page.css +168 -0
  106. package/src/css/detail.css +68 -68
  107. package/src/css/index-page.css +44 -32
  108. package/src/css/index-sidebar.css +193 -187
  109. package/src/css/index.css +16 -12
  110. package/src/css/layout.css +90 -90
  111. package/src/css/page-header.css +33 -33
  112. package/src/css/pagination.css +72 -72
  113. package/src/css/table.css +142 -142
  114. package/src/css/timeline-stages.css +218 -0
  115. package/src/css/utilities.css +46 -46
  116. package/src/index.js +72 -53
  117. package/src/store/createSubResourcePlugin.js +135 -135
  118. package/src/store/index.js +3 -3
  119. package/src/store/plugins/auditTrails.js +17 -17
  120. package/src/store/plugins/files.js +250 -186
  121. package/src/store/plugins/index.js +7 -5
  122. package/src/store/plugins/lifecycle.js +180 -180
  123. package/src/store/plugins/relations.js +68 -68
  124. package/src/store/plugins/search.js +372 -0
  125. package/src/store/plugins/selection.js +104 -0
  126. package/src/store/useObjectStore.js +829 -686
  127. package/src/types/auditTrail.d.ts +32 -32
  128. package/src/types/file.d.ts +23 -23
  129. package/src/types/index.d.ts +35 -35
  130. package/src/types/notification.d.ts +36 -36
  131. package/src/types/object.d.ts +40 -40
  132. package/src/types/organisation.d.ts +41 -41
  133. package/src/types/register.d.ts +25 -25
  134. package/src/types/schema.d.ts +39 -39
  135. package/src/types/shared.d.ts +79 -79
  136. package/src/types/source.d.ts +14 -14
  137. package/src/types/task.d.ts +31 -31
  138. package/src/utils/errors.js +96 -96
  139. package/src/utils/headers.js +68 -50
  140. package/src/utils/id.js +13 -0
  141. package/src/utils/index.js +3 -3
  142. package/src/utils/schema.js +422 -419
@@ -0,0 +1,225 @@
1
+ <!--
2
+ CnDashboardGrid — GridStack-powered drag-and-drop dashboard grid.
3
+
4
+ Renders widgets in a configurable grid layout. Supports drag, resize,
5
+ and dynamic item addition/removal. Emits layout changes for persistence.
6
+ -->
7
+ <template>
8
+ <div ref="gridContainer" class="cn-dashboard-grid">
9
+ <div class="grid-stack">
10
+ <div
11
+ v-for="item in layout"
12
+ :key="item.id"
13
+ class="grid-stack-item"
14
+ :gs-id="item.id"
15
+ :gs-x="item.gridX"
16
+ :gs-y="item.gridY"
17
+ :gs-w="item.gridWidth"
18
+ :gs-h="item.gridHeight"
19
+ :gs-min-w="minWidth"
20
+ :gs-min-h="minHeight">
21
+ <div class="grid-stack-item-content">
22
+ <slot name="widget" :item="item">
23
+ <!-- Default: render nothing; CnDashboardPage provides content -->
24
+ </slot>
25
+ </div>
26
+ </div>
27
+ </div>
28
+ </div>
29
+ </template>
30
+
31
+ <script>
32
+ import { GridStack } from 'gridstack'
33
+ import 'gridstack/dist/gridstack.min.css'
34
+
35
+ /**
36
+ * CnDashboardGrid — Low-level grid layout engine powered by GridStack.
37
+ *
38
+ * Manages the drag-and-drop grid, syncs positions, and emits layout
39
+ * changes. Does NOT handle widget rendering — that's done by the parent
40
+ * via the `#widget` scoped slot.
41
+ *
42
+ * @example
43
+ * <CnDashboardGrid
44
+ * :layout="placements"
45
+ * :editable="isEditing"
46
+ * @layout-change="onLayoutChange">
47
+ * <template #widget="{ item }">
48
+ * <MyWidget :config="item" />
49
+ * </template>
50
+ * </CnDashboardGrid>
51
+ */
52
+ export default {
53
+ name: 'CnDashboardGrid',
54
+
55
+ props: {
56
+ /** Array of layout items: { id, gridX, gridY, gridWidth, gridHeight, ...extra } */
57
+ layout: {
58
+ type: Array,
59
+ required: true,
60
+ },
61
+ /** Whether drag and resize are enabled */
62
+ editable: {
63
+ type: Boolean,
64
+ default: false,
65
+ },
66
+ /** Number of grid columns */
67
+ columns: {
68
+ type: Number,
69
+ default: 12,
70
+ },
71
+ /** Cell height in pixels */
72
+ cellHeight: {
73
+ type: Number,
74
+ default: 80,
75
+ },
76
+ /** Grid margin in pixels */
77
+ margin: {
78
+ type: Number,
79
+ default: 12,
80
+ },
81
+ /** Minimum widget width in grid units */
82
+ minWidth: {
83
+ type: Number,
84
+ default: 2,
85
+ },
86
+ /** Minimum widget height in grid units */
87
+ minHeight: {
88
+ type: Number,
89
+ default: 2,
90
+ },
91
+ },
92
+
93
+ emits: ['layout-change'],
94
+
95
+ data() {
96
+ return {
97
+ grid: null,
98
+ }
99
+ },
100
+
101
+ watch: {
102
+ editable(val) {
103
+ if (!this.grid) return
104
+ if (val) {
105
+ this.grid.enable()
106
+ } else {
107
+ this.grid.disable()
108
+ }
109
+ },
110
+
111
+ layout: {
112
+ deep: true,
113
+ handler(newLayout) {
114
+ if (this.grid) {
115
+ this.syncGridItems(newLayout)
116
+ }
117
+ },
118
+ },
119
+ },
120
+
121
+ mounted() {
122
+ this.initGrid()
123
+ },
124
+
125
+ beforeDestroy() {
126
+ if (this.grid) {
127
+ this.grid.destroy(false)
128
+ }
129
+ },
130
+
131
+ methods: {
132
+ initGrid() {
133
+ const el = this.$refs.gridContainer.querySelector('.grid-stack')
134
+ this.grid = GridStack.init({
135
+ column: this.columns,
136
+ cellHeight: this.cellHeight,
137
+ margin: this.margin,
138
+ float: true,
139
+ animate: true,
140
+ disableDrag: !this.editable,
141
+ disableResize: !this.editable,
142
+ removable: false,
143
+ }, el)
144
+
145
+ this.grid.on('change', (_event, items) => {
146
+ this.handleGridChange(items)
147
+ })
148
+ },
149
+
150
+ handleGridChange(items) {
151
+ if (!items || items.length === 0) return
152
+
153
+ const updated = this.layout.map(item => {
154
+ const gridItem = items.find(gi => String(gi.id) === String(item.id))
155
+ if (gridItem) {
156
+ return {
157
+ ...item,
158
+ gridX: gridItem.x,
159
+ gridY: gridItem.y,
160
+ gridWidth: gridItem.w,
161
+ gridHeight: gridItem.h,
162
+ }
163
+ }
164
+ return item
165
+ })
166
+
167
+ this.$emit('layout-change', updated)
168
+ },
169
+
170
+ syncGridItems(newLayout) {
171
+ // Add items that don't exist in grid yet
172
+ for (const item of newLayout) {
173
+ const exists = this.grid.engine.nodes.find(
174
+ n => String(n.id) === String(item.id),
175
+ )
176
+ if (!exists) {
177
+ this.$nextTick(() => {
178
+ const el = this.$refs.gridContainer.querySelector(`[gs-id="${item.id}"]`)
179
+ if (el) {
180
+ this.grid.makeWidget(el)
181
+ }
182
+ })
183
+ }
184
+ }
185
+
186
+ // Remove items no longer in layout
187
+ const ids = newLayout.map(i => String(i.id))
188
+ const toRemove = this.grid.engine.nodes.filter(
189
+ n => !ids.includes(String(n.id)),
190
+ )
191
+ for (const node of toRemove) {
192
+ const el = this.$refs.gridContainer.querySelector(`[gs-id="${node.id}"]`)
193
+ if (el) {
194
+ this.grid.removeWidget(el, false)
195
+ }
196
+ }
197
+ },
198
+ },
199
+ }
200
+ </script>
201
+
202
+ <style scoped>
203
+ .cn-dashboard-grid {
204
+ width: 100%;
205
+ min-height: 200px;
206
+ }
207
+
208
+ .grid-stack {
209
+ background: transparent;
210
+ }
211
+
212
+ :deep(.grid-stack-item-content) {
213
+ background: var(--color-main-background);
214
+ border-radius: 0;
215
+ border: none;
216
+ box-shadow: none;
217
+ overflow: hidden;
218
+ }
219
+
220
+ :deep(.grid-stack-placeholder > .placeholder-content) {
221
+ background: var(--color-primary-element-light);
222
+ border: 2px dashed var(--color-primary-element);
223
+ border-radius: var(--border-radius-large);
224
+ }
225
+ </style>
@@ -0,0 +1 @@
1
+ export { default as CnDashboardGrid } from './CnDashboardGrid.vue'
@@ -0,0 +1,390 @@
1
+ <!--
2
+ CnDashboardPage — Top-level dashboard page with GridStack widget grid.
3
+
4
+ The dashboard equivalent of CnIndexPage. Assembles a complete dashboard
5
+ from a widget definition array and a layout array. Supports:
6
+ - Custom widgets via scoped slots (#widget-{widgetId})
7
+ - Nextcloud Dashboard API widgets (auto-rendered)
8
+ - Tile widgets (quick-access links)
9
+ - Drag-and-drop editing mode
10
+ - Header with title, actions, and edit toggle
11
+ -->
12
+ <template>
13
+ <div class="cn-dashboard-page">
14
+ <!-- Header -->
15
+ <div class="cn-dashboard-page__header">
16
+ <div class="cn-dashboard-page__header-left">
17
+ <h2 v-if="title" class="cn-dashboard-page__title">
18
+ {{ title }}
19
+ </h2>
20
+ <p v-if="description" class="cn-dashboard-page__description">
21
+ {{ description }}
22
+ </p>
23
+ </div>
24
+ <div class="cn-dashboard-page__header-actions">
25
+ <slot name="header-actions" />
26
+ <NcButton
27
+ v-if="allowEdit"
28
+ :type="isEditing ? 'primary' : 'secondary'"
29
+ @click="toggleEdit">
30
+ <template #icon>
31
+ <Pencil v-if="!isEditing" :size="20" />
32
+ <Check v-else :size="20" />
33
+ </template>
34
+ {{ isEditing ? doneLabel : editLabel }}
35
+ </NcButton>
36
+ </div>
37
+ </div>
38
+
39
+ <!-- Loading state -->
40
+ <NcLoadingIcon v-if="loading" />
41
+
42
+ <!-- Empty state -->
43
+ <div v-else-if="!hasWidgets" class="cn-dashboard-page__empty">
44
+ <slot name="empty">
45
+ <NcEmptyContent :description="emptyLabel">
46
+ <template #icon>
47
+ <ViewDashboardOutline :size="48" />
48
+ </template>
49
+ </NcEmptyContent>
50
+ </slot>
51
+ </div>
52
+
53
+ <!-- Dashboard grid -->
54
+ <CnDashboardGrid
55
+ v-else
56
+ :layout="layout"
57
+ :editable="isEditing"
58
+ :columns="columns"
59
+ :cell-height="cellHeight"
60
+ :margin="gridMargin"
61
+ @layout-change="onLayoutChange">
62
+ <template #widget="{ item }">
63
+ <!-- Tile widget -->
64
+ <CnTileWidget
65
+ v-if="isTile(item)"
66
+ :tile="getTileConfig(item)" />
67
+
68
+ <!-- Custom slot widget — apps provide their own rendering -->
69
+ <template v-else-if="hasWidgetSlot(item.widgetId)">
70
+ <CnWidgetWrapper
71
+ :title="getWidgetTitle(item)"
72
+ :icon-url="getWidgetIconUrl(item)"
73
+ :icon-class="getWidgetIconClass(item)"
74
+ :show-title="item.showTitle !== false"
75
+ :buttons="getWidgetButtons(item)"
76
+ :style-config="item.styleConfig || {}">
77
+ <slot :name="'widget-' + item.widgetId" :item="item" :widget="getWidgetDef(item.widgetId)" />
78
+ </CnWidgetWrapper>
79
+ </template>
80
+
81
+ <!-- NC Dashboard API widget -->
82
+ <template v-else-if="isNcWidget(item)">
83
+ <CnWidgetWrapper
84
+ :title="getWidgetTitle(item)"
85
+ :icon-url="getWidgetIconUrl(item)"
86
+ :icon-class="getWidgetIconClass(item)"
87
+ :show-title="item.showTitle !== false"
88
+ :buttons="getWidgetButtons(item)"
89
+ :style-config="item.styleConfig || {}">
90
+ <CnWidgetRenderer
91
+ :widget="getWidgetDef(item.widgetId)"
92
+ :unavailable-text="unavailableLabel" />
93
+ </CnWidgetWrapper>
94
+ </template>
95
+
96
+ <!-- Unknown widget fallback -->
97
+ <CnWidgetWrapper
98
+ v-else
99
+ :title="getWidgetTitle(item)"
100
+ :show-title="item.showTitle !== false">
101
+ <div class="cn-dashboard-page__unknown">
102
+ {{ unavailableLabel }}
103
+ </div>
104
+ </CnWidgetWrapper>
105
+ </template>
106
+ </CnDashboardGrid>
107
+ </div>
108
+ </template>
109
+
110
+ <script>
111
+ import { NcButton, NcEmptyContent, NcLoadingIcon } from '@nextcloud/vue'
112
+ import Pencil from 'vue-material-design-icons/Pencil.vue'
113
+ import Check from 'vue-material-design-icons/Check.vue'
114
+ import ViewDashboardOutline from 'vue-material-design-icons/ViewDashboardOutline.vue'
115
+ import CnDashboardGrid from '../CnDashboardGrid/CnDashboardGrid.vue'
116
+ import CnWidgetWrapper from '../CnWidgetWrapper/CnWidgetWrapper.vue'
117
+ import CnWidgetRenderer from '../CnWidgetRenderer/CnWidgetRenderer.vue'
118
+ import CnTileWidget from '../CnTileWidget/CnTileWidget.vue'
119
+
120
+ /**
121
+ * CnDashboardPage — Top-level dashboard page component.
122
+ *
123
+ * The dashboard equivalent of CnIndexPage. Renders a configurable grid
124
+ * of widgets from a `widgets` definition array and a `layout` array.
125
+ *
126
+ * Widget types:
127
+ * 1. **Custom** — App provides rendering via `#widget-{widgetId}` slot
128
+ * 2. **NC Dashboard API** — Widgets with `itemApiVersions` are auto-rendered
129
+ * 3. **Tile** — Items with `type: 'tile'` render as quick-access tiles
130
+ *
131
+ * @example Basic usage with custom widgets
132
+ * <CnDashboardPage
133
+ * title="Dashboard"
134
+ * :widgets="widgetDefs"
135
+ * :layout="savedLayout"
136
+ * @layout-change="saveLayout">
137
+ * <template #widget-cases-by-status="{ item }">
138
+ * <StatusChart :data="statusData" />
139
+ * </template>
140
+ * <template #widget-my-work="{ item }">
141
+ * <MyWorkList :items="workItems" />
142
+ * </template>
143
+ * </CnDashboardPage>
144
+ *
145
+ * @example With NC Dashboard API widgets
146
+ * <CnDashboardPage
147
+ * title="Dashboard"
148
+ * :widgets="[...appWidgets, ...ncWidgets]"
149
+ * :layout="layout"
150
+ * @layout-change="saveLayout" />
151
+ */
152
+ export default {
153
+ name: 'CnDashboardPage',
154
+
155
+ components: {
156
+ NcButton,
157
+ NcEmptyContent,
158
+ NcLoadingIcon,
159
+ Pencil,
160
+ Check,
161
+ ViewDashboardOutline,
162
+ CnDashboardGrid,
163
+ CnWidgetWrapper,
164
+ CnWidgetRenderer,
165
+ CnTileWidget,
166
+ },
167
+
168
+ props: {
169
+ /** Page title */
170
+ title: {
171
+ type: String,
172
+ default: '',
173
+ },
174
+ /** Page description (shown below title) */
175
+ description: {
176
+ type: String,
177
+ default: '',
178
+ },
179
+ /**
180
+ * Widget definitions array. Each widget defines metadata for rendering.
181
+ *
182
+ * Custom widgets: `{ id: 'my-widget', title: 'My Widget', type: 'custom' }`
183
+ * NC API widgets: `{ id: 'calendar', title: 'Calendar', itemApiVersions: [1,2], ... }`
184
+ * Tile widgets: `{ id: 'tile-files', type: 'tile', title: 'Files', icon: 'M12...', iconType: 'svg', backgroundColor: '#0082c9', textColor: '#fff', linkType: 'app', linkValue: 'files' }`
185
+ *
186
+ * @type {Array<{ id: string, title: string, type?: string, iconUrl?: string, iconClass?: string, buttons?: Array, itemApiVersions?: number[], reloadInterval?: number, [key: string]: any }>}
187
+ */
188
+ widgets: {
189
+ type: Array,
190
+ default: () => [],
191
+ },
192
+ /**
193
+ * Layout array defining widget positions in the grid.
194
+ *
195
+ * Each item: `{ id: 'unique-id', widgetId: 'my-widget', gridX: 0, gridY: 0, gridWidth: 4, gridHeight: 3 }`
196
+ *
197
+ * Additional properties (showTitle, styleConfig, tile config) are passed through.
198
+ *
199
+ * @type {Array<{ id: string|number, widgetId: string, gridX: number, gridY: number, gridWidth: number, gridHeight: number, showTitle?: boolean, styleConfig?: object, [key: string]: any }>}
200
+ */
201
+ layout: {
202
+ type: Array,
203
+ default: () => [],
204
+ },
205
+ /** Whether the dashboard is loading */
206
+ loading: {
207
+ type: Boolean,
208
+ default: false,
209
+ },
210
+ /** Whether to show the edit toggle button */
211
+ allowEdit: {
212
+ type: Boolean,
213
+ default: false,
214
+ },
215
+ /** Number of grid columns */
216
+ columns: {
217
+ type: Number,
218
+ default: 12,
219
+ },
220
+ /** Grid cell height in pixels */
221
+ cellHeight: {
222
+ type: Number,
223
+ default: 80,
224
+ },
225
+ /** Grid margin in pixels */
226
+ gridMargin: {
227
+ type: Number,
228
+ default: 12,
229
+ },
230
+ /** Label for the edit button */
231
+ editLabel: {
232
+ type: String,
233
+ default: 'Edit',
234
+ },
235
+ /** Label for the done button (when editing) */
236
+ doneLabel: {
237
+ type: String,
238
+ default: 'Done',
239
+ },
240
+ /** Label for the empty state */
241
+ emptyLabel: {
242
+ type: String,
243
+ default: 'No widgets configured',
244
+ },
245
+ /** Label for unavailable widgets */
246
+ unavailableLabel: {
247
+ type: String,
248
+ default: 'Widget not available',
249
+ },
250
+ },
251
+
252
+ emits: ['layout-change', 'edit-toggle'],
253
+
254
+ data() {
255
+ return {
256
+ isEditing: false,
257
+ }
258
+ },
259
+
260
+ computed: {
261
+ hasWidgets() {
262
+ return this.layout.length > 0
263
+ },
264
+
265
+ widgetMap() {
266
+ const map = {}
267
+ for (const w of this.widgets) {
268
+ map[w.id] = w
269
+ }
270
+ return map
271
+ },
272
+ },
273
+
274
+ methods: {
275
+ toggleEdit() {
276
+ this.isEditing = !this.isEditing
277
+ this.$emit('edit-toggle', this.isEditing)
278
+ },
279
+
280
+ onLayoutChange(updated) {
281
+ this.$emit('layout-change', updated)
282
+ },
283
+
284
+ getWidgetDef(widgetId) {
285
+ return this.widgetMap[widgetId] || null
286
+ },
287
+
288
+ getWidgetTitle(item) {
289
+ const def = this.getWidgetDef(item.widgetId)
290
+ return item.customTitle || def?.title || item.widgetId
291
+ },
292
+
293
+ getWidgetIconUrl(item) {
294
+ const def = this.getWidgetDef(item.widgetId)
295
+ return def?.iconUrl || null
296
+ },
297
+
298
+ getWidgetIconClass(item) {
299
+ const def = this.getWidgetDef(item.widgetId)
300
+ return def?.iconClass || null
301
+ },
302
+
303
+ getWidgetButtons(item) {
304
+ const def = this.getWidgetDef(item.widgetId)
305
+ return def?.buttons || []
306
+ },
307
+
308
+ isTile(item) {
309
+ const def = this.getWidgetDef(item.widgetId)
310
+ return def?.type === 'tile'
311
+ },
312
+
313
+ getTileConfig(item) {
314
+ const def = this.getWidgetDef(item.widgetId)
315
+ if (!def) return null
316
+ return {
317
+ title: def.title,
318
+ icon: def.icon,
319
+ iconType: def.iconType,
320
+ backgroundColor: def.backgroundColor,
321
+ textColor: def.textColor,
322
+ linkType: def.linkType,
323
+ linkValue: def.linkValue,
324
+ }
325
+ },
326
+
327
+ isNcWidget(item) {
328
+ const def = this.getWidgetDef(item.widgetId)
329
+ return def?.itemApiVersions && def.itemApiVersions.length > 0
330
+ },
331
+
332
+ hasWidgetSlot(widgetId) {
333
+ return !!this.$scopedSlots['widget-' + widgetId]
334
+ },
335
+ },
336
+ }
337
+ </script>
338
+
339
+ <style scoped>
340
+ .cn-dashboard-page {
341
+ padding: 20px;
342
+ max-width: 1400px;
343
+ }
344
+
345
+ .cn-dashboard-page__header {
346
+ display: flex;
347
+ justify-content: space-between;
348
+ align-items: flex-start;
349
+ margin-bottom: 20px;
350
+ flex-wrap: wrap;
351
+ gap: 12px;
352
+ }
353
+
354
+ .cn-dashboard-page__header-left {
355
+ min-width: 0;
356
+ }
357
+
358
+ .cn-dashboard-page__title {
359
+ margin: 0;
360
+ font-size: 20px;
361
+ font-weight: 700;
362
+ }
363
+
364
+ .cn-dashboard-page__description {
365
+ margin: 4px 0 0;
366
+ font-size: 14px;
367
+ color: var(--color-text-maxcontrast);
368
+ }
369
+
370
+ .cn-dashboard-page__header-actions {
371
+ display: flex;
372
+ gap: 8px;
373
+ flex-wrap: wrap;
374
+ flex-shrink: 0;
375
+ }
376
+
377
+ .cn-dashboard-page__empty {
378
+ padding: 60px 20px;
379
+ }
380
+
381
+ .cn-dashboard-page__unknown {
382
+ display: flex;
383
+ align-items: center;
384
+ justify-content: center;
385
+ height: 100%;
386
+ color: var(--color-text-maxcontrast);
387
+ font-size: 14px;
388
+ padding: 16px;
389
+ }
390
+ </style>
@@ -0,0 +1 @@
1
+ export { default as CnDashboardPage } from './CnDashboardPage.vue'
@@ -38,7 +38,7 @@
38
38
 
39
39
  <!-- Actions column -->
40
40
  <th v-if="$scopedSlots['row-actions']" class="cn-table-col--actions">
41
- <!-- Actions header intentionally empty -->
41
+ <slot name="actions-header" />
42
42
  </th>
43
43
  </tr>
44
44
  </thead>
@@ -1 +1 @@
1
- export { default as CnDataTable } from './CnDataTable.vue'
1
+ export { default as CnDataTable } from './CnDataTable.vue'