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

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