@conduction/nextcloud-vue 0.1.0-beta.1 → 0.1.0-beta.10

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 (197) hide show
  1. package/README.md +226 -0
  2. package/css/index.css +5 -0
  3. package/dist/nextcloud-vue.cjs +67614 -0
  4. package/dist/nextcloud-vue.cjs.js +76311 -5905
  5. package/dist/nextcloud-vue.cjs.js.map +1 -1
  6. package/dist/nextcloud-vue.cjs.map +1 -0
  7. package/dist/nextcloud-vue.css +3279 -203
  8. package/dist/nextcloud-vue.esm.js +76240 -5882
  9. package/dist/nextcloud-vue.esm.js.map +1 -1
  10. package/package.json +89 -63
  11. package/src/components/CnActionsBar/CnActionsBar.vue +254 -0
  12. package/src/components/CnActionsBar/index.js +1 -0
  13. package/src/components/CnAdvancedFormDialog/CnAdvancedFormDialog.vue +569 -0
  14. package/src/components/CnAdvancedFormDialog/CnDataTab.vue +217 -0
  15. package/src/components/CnAdvancedFormDialog/CnMetadataTab.vue +121 -0
  16. package/src/components/CnAdvancedFormDialog/CnPropertiesTab.vue +422 -0
  17. package/src/components/CnAdvancedFormDialog/CnPropertyValueCell.vue +247 -0
  18. package/src/components/CnAdvancedFormDialog/index.js +1 -0
  19. package/src/components/CnCard/CnCard.vue +415 -0
  20. package/src/components/CnCard/index.js +1 -0
  21. package/src/components/CnCardGrid/CnCardGrid.vue +23 -20
  22. package/src/components/CnCardGrid/index.js +1 -1
  23. package/src/components/CnCellRenderer/index.js +1 -1
  24. package/src/components/CnChartWidget/CnChartWidget.vue +318 -0
  25. package/src/components/CnChartWidget/index.js +1 -0
  26. package/src/components/CnConfigurationCard/index.js +1 -1
  27. package/src/components/CnContextMenu/CnContextMenu.vue +142 -0
  28. package/src/components/CnContextMenu/index.js +1 -0
  29. package/src/components/CnCopyDialog/CnCopyDialog.vue +257 -0
  30. package/src/components/CnCopyDialog/index.js +1 -0
  31. package/src/components/CnDashboardGrid/CnDashboardGrid.vue +229 -0
  32. package/src/components/CnDashboardGrid/index.js +1 -0
  33. package/src/components/CnDashboardPage/CnDashboardPage.vue +396 -0
  34. package/src/components/CnDashboardPage/index.js +1 -0
  35. package/src/components/CnDataTable/CnDataTable.vue +24 -16
  36. package/src/components/CnDataTable/index.js +1 -1
  37. package/src/components/CnDeleteDialog/CnDeleteDialog.vue +177 -0
  38. package/src/components/CnDeleteDialog/index.js +1 -0
  39. package/src/components/CnDetailCard/CnDetailCard.vue +225 -0
  40. package/src/components/CnDetailCard/index.js +1 -0
  41. package/src/components/CnDetailGrid/CnDetailGrid.vue +254 -0
  42. package/src/components/CnDetailGrid/index.js +1 -0
  43. package/src/components/CnDetailPage/CnDetailPage.vue +431 -0
  44. package/src/components/CnDetailPage/index.js +1 -0
  45. package/src/components/CnFacetSidebar/CnFacetSidebar.vue +12 -2
  46. package/src/components/CnFacetSidebar/index.js +1 -1
  47. package/src/components/CnFilterBar/index.js +1 -1
  48. package/src/components/CnFormDialog/CnFormDialog.vue +934 -0
  49. package/src/components/CnFormDialog/index.js +1 -0
  50. package/src/components/CnIcon/CnIcon.vue +89 -0
  51. package/src/components/CnIcon/index.js +1 -0
  52. package/src/components/CnIndexPage/CnIndexPage.vue +589 -291
  53. package/src/components/CnIndexPage/index.js +1 -1
  54. package/src/components/CnIndexSidebar/CnIndexSidebar.vue +535 -0
  55. package/src/components/CnIndexSidebar/index.js +1 -0
  56. package/src/components/CnInfoWidget/CnInfoWidget.vue +219 -0
  57. package/src/components/CnInfoWidget/index.js +1 -0
  58. package/src/components/CnItemCard/CnItemCard.vue +134 -0
  59. package/src/components/CnItemCard/index.js +1 -0
  60. package/src/components/CnJsonViewer/CnJsonViewer.vue +283 -0
  61. package/src/components/CnJsonViewer/index.js +1 -0
  62. package/src/components/CnKpiGrid/CnKpiGrid.vue +5 -1
  63. package/src/components/CnKpiGrid/index.js +1 -1
  64. package/src/components/CnMassActionBar/CnMassActionBar.vue +6 -5
  65. package/src/components/CnMassActionBar/index.js +1 -1
  66. package/src/components/CnMassCopyDialog/CnMassCopyDialog.vue +16 -9
  67. package/src/components/CnMassCopyDialog/index.js +1 -1
  68. package/src/components/CnMassDeleteDialog/CnMassDeleteDialog.vue +16 -9
  69. package/src/components/CnMassDeleteDialog/index.js +1 -1
  70. package/src/components/CnMassExportDialog/CnMassExportDialog.vue +8 -7
  71. package/src/components/CnMassExportDialog/index.js +1 -1
  72. package/src/components/CnMassImportDialog/CnMassImportDialog.vue +20 -17
  73. package/src/components/CnMassImportDialog/index.js +1 -1
  74. package/src/components/CnNoteCard/CnNoteCard.vue +149 -0
  75. package/src/components/CnNoteCard/index.js +1 -0
  76. package/src/components/CnNotesCard/CnNotesCard.vue +415 -0
  77. package/src/components/CnNotesCard/index.js +1 -0
  78. package/src/components/CnObjectCard/CnObjectCard.vue +3 -1
  79. package/src/components/CnObjectCard/index.js +1 -1
  80. package/src/components/CnObjectDataWidget/CnObjectDataWidget.vue +853 -0
  81. package/src/components/CnObjectDataWidget/index.js +1 -0
  82. package/src/components/CnObjectMetadataWidget/CnObjectMetadataWidget.vue +288 -0
  83. package/src/components/CnObjectMetadataWidget/index.js +1 -0
  84. package/src/components/CnObjectSidebar/CnAuditTrailTab.vue +368 -0
  85. package/src/components/CnObjectSidebar/CnFilesTab.vue +286 -0
  86. package/src/components/CnObjectSidebar/CnNotesTab.vue +249 -0
  87. package/src/components/CnObjectSidebar/CnObjectSidebar.vue +254 -0
  88. package/src/components/CnObjectSidebar/CnTagsTab.vue +258 -0
  89. package/src/components/CnObjectSidebar/CnTasksTab.vue +482 -0
  90. package/src/components/CnObjectSidebar/index.js +6 -0
  91. package/src/components/CnPageHeader/CnPageHeader.vue +61 -0
  92. package/src/components/CnPageHeader/index.js +1 -0
  93. package/src/components/CnPagination/CnPagination.vue +7 -6
  94. package/src/components/CnPagination/index.js +1 -1
  95. package/src/components/CnProgressBar/CnProgressBar.vue +262 -0
  96. package/src/components/CnProgressBar/index.js +1 -0
  97. package/src/components/CnRegisterMapping/CnRegisterMapping.vue +792 -0
  98. package/src/components/CnRegisterMapping/index.js +1 -0
  99. package/src/components/CnRowActions/CnRowActions.vue +25 -3
  100. package/src/components/CnRowActions/index.js +1 -1
  101. package/src/components/CnSchemaFormDialog/CnSchemaConfigurationTab.vue +226 -0
  102. package/src/components/CnSchemaFormDialog/CnSchemaFormDialog.vue +787 -0
  103. package/src/components/CnSchemaFormDialog/CnSchemaPropertiesTab.vue +305 -0
  104. package/src/components/CnSchemaFormDialog/CnSchemaPropertyActions.vue +1398 -0
  105. package/src/components/CnSchemaFormDialog/CnSchemaSecurityTab.vue +236 -0
  106. package/src/components/CnSchemaFormDialog/index.js +1 -0
  107. package/src/components/CnSettingsCard/index.js +1 -1
  108. package/src/components/CnSettingsSection/index.js +1 -1
  109. package/src/components/CnStatsBlock/CnStatsBlock.vue +89 -19
  110. package/src/components/CnStatsBlock/index.js +1 -1
  111. package/src/components/CnStatsPanel/CnStatsPanel.vue +320 -0
  112. package/src/components/CnStatsPanel/index.js +1 -0
  113. package/src/components/CnStatusBadge/CnStatusBadge.vue +15 -2
  114. package/src/components/CnStatusBadge/index.js +1 -1
  115. package/src/components/CnTabbedFormDialog/CnTabbedFormDialog.vue +544 -0
  116. package/src/components/CnTabbedFormDialog/index.js +1 -0
  117. package/src/components/CnTableWidget/CnTableWidget.vue +332 -0
  118. package/src/components/CnTableWidget/index.js +1 -0
  119. package/src/components/CnTasksCard/CnTasksCard.vue +373 -0
  120. package/src/components/CnTasksCard/index.js +1 -0
  121. package/src/components/CnTileWidget/CnTileWidget.vue +159 -0
  122. package/src/components/CnTileWidget/index.js +1 -0
  123. package/src/components/CnTimelineStages/CnTimelineStages.vue +292 -0
  124. package/src/components/CnTimelineStages/index.js +1 -0
  125. package/src/components/CnUserActionMenu/CnUserActionMenu.vue +435 -0
  126. package/src/components/CnUserActionMenu/index.js +1 -0
  127. package/src/components/CnVersionInfoCard/index.js +1 -1
  128. package/src/components/CnWidgetRenderer/CnWidgetRenderer.vue +180 -0
  129. package/src/components/CnWidgetRenderer/index.js +1 -0
  130. package/src/components/CnWidgetWrapper/CnWidgetWrapper.vue +246 -0
  131. package/src/components/CnWidgetWrapper/index.js +1 -0
  132. package/src/components/index.js +57 -25
  133. package/src/composables/index.js +5 -3
  134. package/src/composables/useContextMenu.js +126 -0
  135. package/src/composables/useDashboardView.js +286 -0
  136. package/src/composables/useDetailView.js +290 -132
  137. package/src/composables/useListView.js +364 -153
  138. package/src/composables/useSubResource.js +142 -142
  139. package/src/constants/metadata.js +30 -0
  140. package/src/css/CnSchemaFormDialog.css +546 -0
  141. package/src/css/__sample_nextcloud_tokens.css +110 -0
  142. package/src/css/actions-bar.css +54 -0
  143. package/src/css/badge.css +83 -51
  144. package/src/css/card.css +129 -128
  145. package/src/css/context-menu.css +20 -0
  146. package/src/css/dashboard.css +70 -0
  147. package/src/css/detail-page.css +235 -0
  148. package/src/css/detail.css +68 -68
  149. package/src/css/index-page.css +44 -0
  150. package/src/css/index-sidebar.css +193 -0
  151. package/src/css/index.css +17 -8
  152. package/src/css/layout.css +90 -90
  153. package/src/css/page-header.css +35 -0
  154. package/src/css/pagination.css +72 -72
  155. package/src/css/table.css +142 -143
  156. package/src/css/timeline-stages.css +220 -0
  157. package/src/css/utilities.css +46 -46
  158. package/src/index.js +91 -50
  159. package/src/mixins/gridLayout.js +118 -0
  160. package/src/store/createCrudStore.js +360 -0
  161. package/src/store/createSubResourcePlugin.js +125 -135
  162. package/src/store/index.js +4 -3
  163. package/src/store/plugins/auditTrails.js +357 -17
  164. package/src/store/plugins/files.js +250 -186
  165. package/src/store/plugins/index.js +7 -4
  166. package/src/store/plugins/lifecycle.js +180 -180
  167. package/src/store/plugins/registerMapping.js +195 -0
  168. package/src/store/plugins/relations.js +68 -68
  169. package/src/store/plugins/search.js +385 -0
  170. package/src/store/plugins/selection.js +104 -0
  171. package/src/store/useObjectStore.js +823 -625
  172. package/src/types/auditTrail.d.ts +32 -32
  173. package/src/types/file.d.ts +23 -23
  174. package/src/types/index.d.ts +35 -35
  175. package/src/types/notification.d.ts +36 -36
  176. package/src/types/object.d.ts +40 -40
  177. package/src/types/organisation.d.ts +41 -41
  178. package/src/types/register.d.ts +25 -25
  179. package/src/types/schema.d.ts +39 -39
  180. package/src/types/shared.d.ts +79 -79
  181. package/src/types/source.d.ts +14 -14
  182. package/src/types/task.d.ts +31 -31
  183. package/src/utils/errors.js +96 -96
  184. package/src/utils/getTheme.js +9 -0
  185. package/src/utils/headers.js +80 -44
  186. package/src/utils/id.js +13 -0
  187. package/src/utils/index.js +4 -3
  188. package/src/utils/schema.js +422 -287
  189. package/src/utils/widgetVisibility.js +162 -0
  190. package/src/components/CnDetailViewLayout/CnDetailViewLayout.vue +0 -88
  191. package/src/components/CnDetailViewLayout/index.js +0 -1
  192. package/src/components/CnEmptyState/CnEmptyState.vue +0 -78
  193. package/src/components/CnEmptyState/index.js +0 -1
  194. package/src/components/CnListViewLayout/CnListViewLayout.vue +0 -80
  195. package/src/components/CnListViewLayout/index.js +0 -1
  196. package/src/components/CnViewModeToggle/CnViewModeToggle.vue +0 -77
  197. package/src/components/CnViewModeToggle/index.js +0 -1
@@ -1 +1 @@
1
- export { default as CnIndexPage } from './CnIndexPage.vue'
1
+ export { default as CnIndexPage } from './CnIndexPage.vue'
@@ -0,0 +1,535 @@
1
+ <template>
2
+ <NcAppSidebar
3
+ :name="resolvedName"
4
+ :title="resolvedName"
5
+ :subname="resolvedSubname"
6
+ :open.sync="internalOpen"
7
+ :active="internalActiveTab"
8
+ :compact="!!resolvedIcon"
9
+ @close="$emit('update:open', false)"
10
+ @update:active="onTabChange">
11
+ <!-- Schema icon in sidebar header -->
12
+ <template v-if="resolvedIcon" #header>
13
+ <div class="cn-index-sidebar__header-icon">
14
+ <CnIcon :name="resolvedIcon" :size="32" />
15
+ </div>
16
+ </template>
17
+
18
+ <!-- Search Tab -->
19
+ <NcAppSidebarTab
20
+ id="search-tab"
21
+ :name="searchTabLabel"
22
+ :order="1">
23
+ <template #icon>
24
+ <Magnify :size="20" />
25
+ </template>
26
+
27
+ <div class="cn-index-sidebar__tab-content">
28
+ <div v-if="$slots['search-above']" class="cn-index-sidebar__section">
29
+ <slot name="search-above" />
30
+ </div>
31
+
32
+ <div class="cn-index-sidebar__section">
33
+ <h3>{{ searchLabel }}</h3>
34
+ <NcTextField
35
+ :value="searchValue"
36
+ :placeholder="searchPlaceholder"
37
+ :label="searchLabel"
38
+ @update:value="$emit('search', $event)" />
39
+ </div>
40
+
41
+ <div v-if="schemaFilters.length > 0" class="cn-index-sidebar__section">
42
+ <h3>{{ filtersLabel }}</h3>
43
+ <div
44
+ v-for="filter in schemaFilters"
45
+ :key="filter.key"
46
+ class="cn-index-sidebar__filter-group">
47
+ <div class="cn-index-sidebar__filter-header">
48
+ <span class="cn-index-sidebar__filter-label">{{ filter.label }}</span>
49
+ <NcPopover v-if="filter.description" popup-role="dialog">
50
+ <template #trigger>
51
+ <NcButton
52
+ type="tertiary-no-background"
53
+ :aria-label="filter.label + ' info'"
54
+ class="cn-index-sidebar__info-btn">
55
+ <template #icon>
56
+ <InformationOutline :size="16" />
57
+ </template>
58
+ </NcButton>
59
+ </template>
60
+ <p class="cn-index-sidebar__filter-description">
61
+ {{ filter.description }}
62
+ </p>
63
+ </NcPopover>
64
+ </div>
65
+ <NcSelect
66
+ class="cn-index-sidebar__select"
67
+ :value="getSelectedFilterOptions(filter)"
68
+ :options="getFilterOptions(filter)"
69
+ placeholder="Select..."
70
+ :input-label="filter.label"
71
+ :multiple="true"
72
+ :clearable="true"
73
+ @input="onFilterChange(filter.key, $event)" />
74
+ </div>
75
+ </div>
76
+
77
+ <slot name="search-extra" />
78
+ </div>
79
+ </NcAppSidebarTab>
80
+
81
+ <!-- Columns Tab -->
82
+ <NcAppSidebarTab
83
+ id="columns-tab"
84
+ :name="columnsTabLabel"
85
+ :order="2">
86
+ <template #icon>
87
+ <FormatColumns :size="20" />
88
+ </template>
89
+
90
+ <div class="cn-index-sidebar__tab-content">
91
+ <div class="cn-sidebar-columns">
92
+ <h3>{{ columnsHeading }}</h3>
93
+ <p class="cn-sidebar-columns__description">
94
+ {{ columnsDescription }}
95
+ </p>
96
+
97
+ <template v-if="allColumns.length > 0 || allGroups.length > 0">
98
+ <!-- Schema properties group (collapsible) -->
99
+ <div v-if="allColumns.length > 0" class="cn-sidebar-columns__group cn-sidebar-columns__group--collapsible">
100
+ <div class="cn-sidebar-columns__group-header" @click="propertiesExpanded = !propertiesExpanded">
101
+ <ChevronDown v-if="propertiesExpanded" :size="20" />
102
+ <ChevronRight v-else :size="20" />
103
+ <h4>{{ resolvedPropertiesLabel }}</h4>
104
+ <NcCheckboxRadioSwitch
105
+ :checked="isGroupAllVisible(allColumns)"
106
+ class="cn-sidebar-columns__select-all"
107
+ @click.native.stop
108
+ @update:checked="toggleGroupAll(allColumns)">
109
+ All
110
+ </NcCheckboxRadioSwitch>
111
+ </div>
112
+ <div v-if="propertiesExpanded" class="cn-sidebar-columns__group-content">
113
+ <NcCheckboxRadioSwitch
114
+ v-for="col in allColumns"
115
+ :key="col.key"
116
+ :checked="isColumnVisible(col.key)"
117
+ @update:checked="toggleColumn(col.key)">
118
+ {{ col.label }}
119
+ </NcCheckboxRadioSwitch>
120
+ </div>
121
+ </div>
122
+
123
+ <!-- Extra column groups (built-in Metadata + external) -->
124
+ <div
125
+ v-for="group in allGroups"
126
+ :key="group.id"
127
+ class="cn-sidebar-columns__group cn-sidebar-columns__group--collapsible">
128
+ <div class="cn-sidebar-columns__group-header" @click="toggleGroup(group.id)">
129
+ <ChevronDown v-if="expandedGroups[group.id]" :size="20" />
130
+ <ChevronRight v-else :size="20" />
131
+ <h4>{{ group.label }}</h4>
132
+ <NcCheckboxRadioSwitch
133
+ :checked="isGroupAllVisible(group.columns)"
134
+ class="cn-sidebar-columns__select-all"
135
+ @click.native.stop
136
+ @update:checked="toggleGroupAll(group.columns)">
137
+ All
138
+ </NcCheckboxRadioSwitch>
139
+ </div>
140
+ <div v-if="expandedGroups[group.id]" class="cn-sidebar-columns__group-content">
141
+ <NcCheckboxRadioSwitch
142
+ v-for="col in group.columns"
143
+ :key="col.key"
144
+ :checked="isColumnVisible(col.key)"
145
+ @update:checked="toggleColumn(col.key)">
146
+ {{ col.label }}
147
+ </NcCheckboxRadioSwitch>
148
+ </div>
149
+ </div>
150
+ </template>
151
+
152
+ <p v-else class="cn-sidebar-columns__empty">
153
+ No columns available. Provide a schema to auto-generate columns.
154
+ </p>
155
+ </div>
156
+
157
+ <slot name="columns-extra" />
158
+ </div>
159
+ </NcAppSidebarTab>
160
+
161
+ <!-- Extra tabs injected by the consumer -->
162
+ <slot name="tabs" />
163
+ </NcAppSidebar>
164
+ </template>
165
+
166
+ <script>
167
+ import { NcAppSidebar, NcAppSidebarTab, NcTextField, NcSelect, NcCheckboxRadioSwitch, NcPopover, NcButton } from '@nextcloud/vue'
168
+ import Magnify from 'vue-material-design-icons/Magnify.vue'
169
+ import FormatColumns from 'vue-material-design-icons/FormatColumns.vue'
170
+ import ChevronDown from 'vue-material-design-icons/ChevronDown.vue'
171
+ import ChevronRight from 'vue-material-design-icons/ChevronRight.vue'
172
+ import InformationOutline from 'vue-material-design-icons/InformationOutline.vue'
173
+ import { CnIcon } from '../CnIcon/index.js'
174
+ import { columnsFromSchema, filtersFromSchema } from '../../utils/schema.js'
175
+ import { METADATA_COLUMNS } from '../../constants/metadata.js'
176
+
177
+ /**
178
+ * CnIndexSidebar — Reusable NcAppSidebar wrapper with Search + Columns tabs.
179
+ *
180
+ * Designed to be schema-driven: pass a schema and the sidebar auto-generates
181
+ * search filters, column visibility controls, and the standard Metadata group.
182
+ * Title and properties group label are derived from schema.title by default.
183
+ *
184
+ * Must be rendered at the App.vue level as a sibling of NcAppContent.
185
+ * Use provide/inject to connect it to page components.
186
+ *
187
+ * @example
188
+ * <!-- Minimal usage — schema drives everything -->
189
+ * <CnIndexSidebar
190
+ * :schema="schema"
191
+ * :visible-columns="visibleCols"
192
+ * :search-value="search"
193
+ * @search="onSearch"
194
+ * @columns-change="onColumnsChange" />
195
+ *
196
+ * @slot search-above - Content rendered above the search field in the Search tab (e.g. hints, quick actions).
197
+ * @slot search-extra - Content rendered below the search field and filters in the Search tab (e.g. saved searches).
198
+ */
199
+ export default {
200
+ name: 'CnIndexSidebar',
201
+
202
+ components: {
203
+ NcAppSidebar,
204
+ NcAppSidebarTab,
205
+ NcTextField,
206
+ NcSelect,
207
+ NcCheckboxRadioSwitch,
208
+ NcPopover,
209
+ NcButton,
210
+ CnIcon,
211
+ Magnify,
212
+ FormatColumns,
213
+ ChevronDown,
214
+ ChevronRight,
215
+ InformationOutline,
216
+ },
217
+
218
+ props: {
219
+ /** Sidebar title. Defaults to schema.title when not set. */
220
+ title: {
221
+ type: String,
222
+ default: '',
223
+ },
224
+ /** MDI icon name or emoji. Defaults to schema.icon when not set. */
225
+ icon: {
226
+ type: String,
227
+ default: '',
228
+ },
229
+ /** Schema object for auto-generating filters, columns, and labels */
230
+ schema: {
231
+ type: Object,
232
+ default: null,
233
+ },
234
+ /** Array of currently visible column keys */
235
+ visibleColumns: {
236
+ type: Array,
237
+ default: null,
238
+ },
239
+ /** Current search term */
240
+ searchValue: {
241
+ type: String,
242
+ default: '',
243
+ },
244
+ /** Whether sidebar is open */
245
+ open: {
246
+ type: Boolean,
247
+ default: true,
248
+ },
249
+ /** Current active facet filters: { fieldName: [values] } */
250
+ activeFilters: {
251
+ type: Object,
252
+ default: () => ({}),
253
+ },
254
+ /** Live facet data from API: { fieldName: { values: [{value, count}] } } */
255
+ facetData: {
256
+ type: Object,
257
+ default: () => ({}),
258
+ },
259
+ /**
260
+ * Additional column groups beyond schema properties and the built-in Metadata.
261
+ * Each group: { id: string, label: string, columns: Array<{key, label}>, expanded?: boolean }
262
+ */
263
+ columnGroups: {
264
+ type: Array,
265
+ default: () => [],
266
+ },
267
+ /** Whether to include the built-in Metadata column group */
268
+ showMetadata: {
269
+ type: Boolean,
270
+ default: true,
271
+ },
272
+ /** Search input placeholder */
273
+ searchPlaceholder: {
274
+ type: String,
275
+ default: 'Type to search...',
276
+ },
277
+ /** Search tab label */
278
+ searchTabLabel: {
279
+ type: String,
280
+ default: 'Search',
281
+ },
282
+ /** Columns tab label */
283
+ columnsTabLabel: {
284
+ type: String,
285
+ default: 'Columns',
286
+ },
287
+ /** Search section heading */
288
+ searchLabel: {
289
+ type: String,
290
+ default: 'Search',
291
+ },
292
+ /** Filters section heading */
293
+ filtersLabel: {
294
+ type: String,
295
+ default: 'Filters',
296
+ },
297
+ /** Columns section heading */
298
+ columnsHeading: {
299
+ type: String,
300
+ default: 'Column Visibility',
301
+ },
302
+ /** Columns section description */
303
+ columnsDescription: {
304
+ type: String,
305
+ default: 'Select which columns to display in the table',
306
+ },
307
+ /** Override label for the schema properties group. Defaults to schema.title. */
308
+ propertiesGroupLabel: {
309
+ type: String,
310
+ default: '',
311
+ },
312
+ /**
313
+ * ID of the tab that should be active when the sidebar opens.
314
+ * Built-in IDs are 'search-tab' and 'columns-tab'.
315
+ * Use the id you set on your custom NcAppSidebarTab for custom tabs.
316
+ */
317
+ defaultTab: {
318
+ type: String,
319
+ default: 'search-tab',
320
+ },
321
+ /**
322
+ * Whether the current user is an admin.
323
+ * When false, schema properties with `adminOnly: true` are hidden from filters.
324
+ */
325
+ userIsAdmin: {
326
+ type: Boolean,
327
+ default: true,
328
+ },
329
+ },
330
+
331
+ data() {
332
+ return {
333
+ internalOpen: this.open,
334
+ internalActiveTab: this.defaultTab,
335
+ propertiesExpanded: true,
336
+ expandedGroups: {},
337
+ }
338
+ },
339
+
340
+ computed: {
341
+ /** Resolved icon — explicit prop overrides schema.icon */
342
+ resolvedIcon() {
343
+ return this.icon || this.schema?.icon || ''
344
+ },
345
+
346
+ /** Sidebar name — schema title, shown as the h2 header */
347
+ resolvedName() {
348
+ if (this.title) return this.title
349
+ return this.schema?.title || 'Search'
350
+ },
351
+
352
+ /** Sidebar subname — schema description, shown below the name */
353
+ resolvedSubname() {
354
+ return this.schema?.description || ''
355
+ },
356
+
357
+ /** Properties group label — derived from schema.title if not explicitly set */
358
+ resolvedPropertiesLabel() {
359
+ if (this.propertiesGroupLabel) return this.propertiesGroupLabel
360
+ return this.schema?.title || 'Properties'
361
+ },
362
+
363
+ /** All available columns from schema */
364
+ allColumns() {
365
+ if (!this.schema) return []
366
+ return columnsFromSchema(this.schema, {})
367
+ },
368
+
369
+ /** Filter definitions from schema (facetable properties, respecting RBAC) */
370
+ schemaFilters() {
371
+ if (!this.schema) return []
372
+ return filtersFromSchema(this.schema, { isAdmin: this.userIsAdmin })
373
+ },
374
+
375
+ /** Combined column groups: built-in Metadata + external groups */
376
+ allGroups() {
377
+ const groups = []
378
+ if (this.showMetadata && this.schema) {
379
+ groups.push({
380
+ id: 'metadata',
381
+ label: 'Metadata',
382
+ columns: METADATA_COLUMNS,
383
+ expanded: true,
384
+ })
385
+ }
386
+ return [...groups, ...this.columnGroups]
387
+ },
388
+
389
+ /** All column keys across schema properties and all groups */
390
+ allColumnKeys() {
391
+ return [
392
+ ...this.allColumns.map((c) => c.key),
393
+ ...this.allGroups.flatMap((g) => g.columns.map((c) => c.key)),
394
+ ]
395
+ },
396
+ },
397
+
398
+ watch: {
399
+ open(val) {
400
+ this.internalOpen = val
401
+ },
402
+ internalOpen(val) {
403
+ this.$emit('update:open', val)
404
+ },
405
+ defaultTab(val) {
406
+ this.internalActiveTab = val
407
+ },
408
+ allGroups: {
409
+ immediate: true,
410
+ handler(groups) {
411
+ for (const group of groups) {
412
+ if (!(group.id in this.expandedGroups)) {
413
+ this.$set(this.expandedGroups, group.id, group.expanded !== false)
414
+ }
415
+ }
416
+ },
417
+ },
418
+ },
419
+
420
+ methods: {
421
+ /**
422
+ * Handle tab change from NcAppSidebar
423
+ * @param {string} tabId Tab identifier
424
+ */
425
+ onTabChange(tabId) {
426
+ this.internalActiveTab = tabId
427
+ this.$emit('tab-change', tabId)
428
+ },
429
+
430
+ /**
431
+ * Check if a column is currently visible
432
+ * @param {string} key Column key
433
+ */
434
+ isColumnVisible(key) {
435
+ if (this.visibleColumns === null) return true
436
+ return this.visibleColumns.includes(key)
437
+ },
438
+
439
+ /**
440
+ * Check if all columns in a group are visible
441
+ * @param {string[]} columns Array of column keys
442
+ */
443
+ isGroupAllVisible(columns) {
444
+ return columns.every((col) => this.isColumnVisible(col.key))
445
+ },
446
+
447
+ /**
448
+ * Toggle a single column's visibility
449
+ * @param {string} key Column key
450
+ */
451
+ toggleColumn(key) {
452
+ let newVisible
453
+ if (this.visibleColumns === null) {
454
+ newVisible = this.allColumnKeys.filter((k) => k !== key)
455
+ } else if (this.isColumnVisible(key)) {
456
+ newVisible = this.visibleColumns.filter((k) => k !== key)
457
+ } else {
458
+ newVisible = [...this.visibleColumns, key]
459
+ }
460
+ this.$emit('columns-change', newVisible)
461
+ },
462
+
463
+ /**
464
+ * Select or deselect all columns in a group
465
+ * @param {string[]} columns Array of column keys
466
+ */
467
+ toggleGroupAll(columns) {
468
+ const groupKeys = columns.map((c) => c.key)
469
+ const allVisible = this.isGroupAllVisible(columns)
470
+
471
+ let newVisible
472
+ if (this.visibleColumns === null) {
473
+ // Currently all visible — deselect this group
474
+ newVisible = this.allColumnKeys.filter((k) => !groupKeys.includes(k))
475
+ } else if (allVisible) {
476
+ // All in group visible — deselect them
477
+ newVisible = this.visibleColumns.filter((k) => !groupKeys.includes(k))
478
+ } else {
479
+ // Not all visible — select them all
480
+ const current = new Set(this.visibleColumns)
481
+ groupKeys.forEach((k) => current.add(k))
482
+ newVisible = [...current]
483
+ }
484
+ this.$emit('columns-change', newVisible)
485
+ },
486
+
487
+ /**
488
+ * Toggle a group's expanded state
489
+ * @param {string} groupId Filter group identifier
490
+ */
491
+ toggleGroup(groupId) {
492
+ this.$set(this.expandedGroups, groupId, !this.expandedGroups[groupId])
493
+ },
494
+
495
+ /**
496
+ * Get filter options for a filter definition
497
+ * @param {object} filter Filter object
498
+ */
499
+ getFilterOptions(filter) {
500
+ const facet = this.facetData[filter.key]
501
+ if (facet?.values?.length > 0) {
502
+ return facet.values.map((v) => ({
503
+ id: v.value,
504
+ label: v.count !== undefined ? `${v.value} (${v.count})` : String(v.value),
505
+ }))
506
+ }
507
+ return filter.options || []
508
+ },
509
+
510
+ /**
511
+ * Get currently selected options for a filter
512
+ * @param {object} filter Filter object
513
+ */
514
+ getSelectedFilterOptions(filter) {
515
+ const value = this.activeFilters[filter.key]
516
+ if (!value) return []
517
+ const values = Array.isArray(value) ? value : [value]
518
+ const options = this.getFilterOptions(filter)
519
+ return values.map((v) => options.find((o) => o.id === v) || { id: v, label: String(v) })
520
+ },
521
+
522
+ /**
523
+ * Handle filter select change
524
+ * @param {string} key Filter key
525
+ * @param {Array} selected Selected values
526
+ */
527
+ onFilterChange(key, selected) {
528
+ const values = selected ? selected.map((o) => o.id) : []
529
+ this.$emit('filter-change', { key, values })
530
+ },
531
+ },
532
+ }
533
+ </script>
534
+
535
+ <!-- Styles in css/index-sidebar.css -->
@@ -0,0 +1 @@
1
+ export { default as CnIndexSidebar } from './CnIndexSidebar.vue'