@conduction/nextcloud-vue 0.1.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/dist/nextcloud-vue.cjs.js +10710 -0
  2. package/dist/nextcloud-vue.cjs.js.map +1 -0
  3. package/dist/nextcloud-vue.css +803 -0
  4. package/dist/nextcloud-vue.esm.js +10665 -0
  5. package/dist/nextcloud-vue.esm.js.map +1 -0
  6. package/package.json +63 -0
  7. package/src/components/CnCardGrid/CnCardGrid.vue +152 -0
  8. package/src/components/CnCardGrid/index.js +1 -0
  9. package/src/components/CnCellRenderer/CnCellRenderer.vue +132 -0
  10. package/src/components/CnCellRenderer/index.js +1 -0
  11. package/src/components/CnConfigurationCard/CnConfigurationCard.vue +77 -0
  12. package/src/components/CnConfigurationCard/index.js +1 -0
  13. package/src/components/CnDataTable/CnDataTable.vue +354 -0
  14. package/src/components/CnDataTable/index.js +1 -0
  15. package/src/components/CnDetailViewLayout/CnDetailViewLayout.vue +88 -0
  16. package/src/components/CnDetailViewLayout/index.js +1 -0
  17. package/src/components/CnEmptyState/CnEmptyState.vue +78 -0
  18. package/src/components/CnEmptyState/index.js +1 -0
  19. package/src/components/CnFacetSidebar/CnFacetSidebar.vue +223 -0
  20. package/src/components/CnFacetSidebar/index.js +1 -0
  21. package/src/components/CnFilterBar/CnFilterBar.vue +152 -0
  22. package/src/components/CnFilterBar/index.js +1 -0
  23. package/src/components/CnIndexPage/CnIndexPage.vue +682 -0
  24. package/src/components/CnIndexPage/index.js +1 -0
  25. package/src/components/CnKpiGrid/CnKpiGrid.vue +89 -0
  26. package/src/components/CnKpiGrid/index.js +1 -0
  27. package/src/components/CnListViewLayout/CnListViewLayout.vue +80 -0
  28. package/src/components/CnListViewLayout/index.js +1 -0
  29. package/src/components/CnMassActionBar/CnMassActionBar.vue +160 -0
  30. package/src/components/CnMassActionBar/index.js +1 -0
  31. package/src/components/CnMassCopyDialog/CnMassCopyDialog.vue +320 -0
  32. package/src/components/CnMassCopyDialog/index.js +1 -0
  33. package/src/components/CnMassDeleteDialog/CnMassDeleteDialog.vue +238 -0
  34. package/src/components/CnMassDeleteDialog/index.js +1 -0
  35. package/src/components/CnMassExportDialog/CnMassExportDialog.vue +190 -0
  36. package/src/components/CnMassExportDialog/index.js +1 -0
  37. package/src/components/CnMassImportDialog/CnMassImportDialog.vue +491 -0
  38. package/src/components/CnMassImportDialog/index.js +1 -0
  39. package/src/components/CnObjectCard/CnObjectCard.vue +292 -0
  40. package/src/components/CnObjectCard/index.js +1 -0
  41. package/src/components/CnPagination/CnPagination.vue +252 -0
  42. package/src/components/CnPagination/index.js +1 -0
  43. package/src/components/CnRowActions/CnRowActions.vue +73 -0
  44. package/src/components/CnRowActions/index.js +1 -0
  45. package/src/components/CnSettingsCard/CnSettingsCard.vue +92 -0
  46. package/src/components/CnSettingsCard/index.js +1 -0
  47. package/src/components/CnSettingsSection/CnSettingsSection.vue +266 -0
  48. package/src/components/CnSettingsSection/index.js +1 -0
  49. package/src/components/CnStatsBlock/CnStatsBlock.vue +366 -0
  50. package/src/components/CnStatsBlock/index.js +1 -0
  51. package/src/components/CnStatusBadge/CnStatusBadge.vue +77 -0
  52. package/src/components/CnStatusBadge/index.js +1 -0
  53. package/src/components/CnVersionInfoCard/CnVersionInfoCard.vue +312 -0
  54. package/src/components/CnVersionInfoCard/index.js +1 -0
  55. package/src/components/CnViewModeToggle/CnViewModeToggle.vue +77 -0
  56. package/src/components/CnViewModeToggle/index.js +1 -0
  57. package/src/components/index.js +25 -0
  58. package/src/composables/index.js +3 -0
  59. package/src/composables/useDetailView.js +132 -0
  60. package/src/composables/useListView.js +153 -0
  61. package/src/composables/useSubResource.js +142 -0
  62. package/src/css/badge.css +51 -0
  63. package/src/css/card.css +128 -0
  64. package/src/css/detail.css +68 -0
  65. package/src/css/index.css +8 -0
  66. package/src/css/layout.css +90 -0
  67. package/src/css/pagination.css +72 -0
  68. package/src/css/table.css +143 -0
  69. package/src/css/utilities.css +46 -0
  70. package/src/index.js +50 -0
  71. package/src/store/createSubResourcePlugin.js +135 -0
  72. package/src/store/index.js +3 -0
  73. package/src/store/plugins/auditTrails.js +17 -0
  74. package/src/store/plugins/files.js +186 -0
  75. package/src/store/plugins/index.js +4 -0
  76. package/src/store/plugins/lifecycle.js +180 -0
  77. package/src/store/plugins/relations.js +68 -0
  78. package/src/store/useObjectStore.js +625 -0
  79. package/src/types/auditTrail.d.ts +32 -0
  80. package/src/types/file.d.ts +23 -0
  81. package/src/types/index.d.ts +35 -0
  82. package/src/types/notification.d.ts +36 -0
  83. package/src/types/object.d.ts +40 -0
  84. package/src/types/organisation.d.ts +41 -0
  85. package/src/types/register.d.ts +25 -0
  86. package/src/types/schema.d.ts +39 -0
  87. package/src/types/shared.d.ts +79 -0
  88. package/src/types/source.d.ts +14 -0
  89. package/src/types/task.d.ts +31 -0
  90. package/src/utils/errors.js +96 -0
  91. package/src/utils/headers.js +44 -0
  92. package/src/utils/index.js +3 -0
  93. package/src/utils/schema.js +287 -0
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@conduction/nextcloud-vue",
3
+ "version": "0.1.0-beta.1",
4
+ "description": "Shared Vue component library for Conduction Nextcloud apps — complements @nextcloud/vue with higher-level components, OpenRegister integration, and NL Design System support",
5
+ "license": "EUPL-1.2",
6
+ "author": "Conduction B.V. <info@conduction.nl>",
7
+ "main": "dist/nextcloud-vue.cjs.js",
8
+ "module": "dist/nextcloud-vue.esm.js",
9
+ "style": "dist/nextcloud-vue.css",
10
+ "types": "src/types/index.d.ts",
11
+ "files": [
12
+ "dist/",
13
+ "src/"
14
+ ],
15
+ "sideEffects": [
16
+ "*.css"
17
+ ],
18
+ "scripts": {
19
+ "build": "rollup -c",
20
+ "dev": "rollup -c -w",
21
+ "test": "jest",
22
+ "lint": "eslint src/",
23
+ "stylelint": "stylelint 'src/**/*.vue' 'src/**/*.css'",
24
+ "prepare": "npm run build",
25
+ "prepublishOnly": "npm run build"
26
+ },
27
+ "peerDependencies": {
28
+ "@nextcloud/l10n": "^2.0.0 || ^3.0.0",
29
+ "@nextcloud/vue": "^8.0.0",
30
+ "pinia": "^2.0.0",
31
+ "vue": "^2.7.0",
32
+ "vue-material-design-icons": "^5.0.0"
33
+ },
34
+ "devDependencies": {
35
+ "@babel/core": "^7.29.0",
36
+ "@babel/preset-env": "^7.29.0",
37
+ "@eslint/config-helpers": "^0.4.2",
38
+ "@eslint/eslintrc": "^3.3.4",
39
+ "@eslint/js": "^9.39.3",
40
+ "@nextcloud/browserslist-config": "^3.1.2",
41
+ "@nextcloud/eslint-config": "^8.4.2",
42
+ "@nextcloud/vue": "^8.12.0",
43
+ "@rollup/plugin-commonjs": "^25.0.0",
44
+ "@rollup/plugin-node-resolve": "^15.0.0",
45
+ "@vue/test-utils": "^1.3.6",
46
+ "@vue/vue2-jest": "^29.2.6",
47
+ "babel-jest": "^29.7.0",
48
+ "eslint": "^8.56.0",
49
+ "eslint-import-resolver-alias": "^1.1.2",
50
+ "jest": "^29.7.0",
51
+ "jest-environment-jsdom": "^29.7.0",
52
+ "jest-transform-stub": "^2.0.0",
53
+ "pinia": "^2.1.7",
54
+ "rollup": "^3.29.0",
55
+ "rollup-plugin-postcss": "^4.0.0",
56
+ "rollup-plugin-vue": "^5.1.9",
57
+ "stylelint": "^14.16.1",
58
+ "stylelint-config-recommended": "^9.0.0",
59
+ "stylelint-config-recommended-vue": "^1.5.0",
60
+ "vue": "^2.7.16",
61
+ "vue-material-design-icons": "^5.2.0"
62
+ }
63
+ }
@@ -0,0 +1,152 @@
1
+ <template>
2
+ <div class="cn-card-grid">
3
+ <!-- Loading state -->
4
+ <div v-if="loading" class="cn-card-grid__loading">
5
+ <NcLoadingIcon :size="32" />
6
+ </div>
7
+
8
+ <!-- Empty state -->
9
+ <div v-else-if="objects.length === 0" class="cn-card-grid__empty">
10
+ <slot name="empty">
11
+ <NcEmptyContent :name="emptyText">
12
+ <template #icon>
13
+ <ViewGrid :size="64" />
14
+ </template>
15
+ </NcEmptyContent>
16
+ </slot>
17
+ </div>
18
+
19
+ <!-- Card grid -->
20
+ <div v-else class="cn-card-grid__grid">
21
+ <slot
22
+ v-for="object in objects"
23
+ name="card"
24
+ :object="object"
25
+ :selected="isSelected(object)"
26
+ :schema="schema">
27
+ <CnObjectCard
28
+ :key="object[rowKey]"
29
+ :object="object"
30
+ :schema="schema"
31
+ :selectable="selectable"
32
+ :selected="isSelected(object)"
33
+ @click="$emit('click', object)"
34
+ @select="toggleSelect(object)">
35
+ <template v-if="$scopedSlots['card-actions']" #actions="{ object: obj }">
36
+ <slot name="card-actions" :object="obj" />
37
+ </template>
38
+ <template v-if="$scopedSlots['card-badges']" #badges="{ object: obj }">
39
+ <slot name="card-badges" :object="obj" />
40
+ </template>
41
+ </CnObjectCard>
42
+ </slot>
43
+ </div>
44
+ </div>
45
+ </template>
46
+
47
+ <script>
48
+ import { NcLoadingIcon, NcEmptyContent } from '@nextcloud/vue'
49
+ import ViewGrid from 'vue-material-design-icons/ViewGrid.vue'
50
+ import { CnObjectCard } from '../CnObjectCard/index.js'
51
+
52
+ /**
53
+ * CnCardGrid — Responsive grid container for CnObjectCard instances.
54
+ *
55
+ * Displays objects in a responsive CSS grid layout using schema-driven cards.
56
+ * Supports selection, loading/empty states, and custom card rendering via slots.
57
+ *
58
+ * @example
59
+ * <CnCardGrid
60
+ * :objects="publications"
61
+ * :schema="pubSchema"
62
+ * :selectable="true"
63
+ * :selected-ids="selectedIds"
64
+ * @click="openPublication"
65
+ * @select="onSelect">
66
+ * <template #card-actions="{ object }">
67
+ * <NcActions><NcActionButton>Edit</NcActionButton></NcActions>
68
+ * </template>
69
+ * </CnCardGrid>
70
+ */
71
+ export default {
72
+ name: 'CnCardGrid',
73
+
74
+ components: {
75
+ NcLoadingIcon,
76
+ NcEmptyContent,
77
+ ViewGrid,
78
+ CnObjectCard,
79
+ },
80
+
81
+ props: {
82
+ /** Array of objects to display as cards */
83
+ objects: {
84
+ type: Array,
85
+ default: () => [],
86
+ },
87
+ /** Schema definition (passed through to CnObjectCard) */
88
+ schema: {
89
+ type: Object,
90
+ required: true,
91
+ },
92
+ /** Whether data is loading */
93
+ loading: {
94
+ type: Boolean,
95
+ default: false,
96
+ },
97
+ /** Whether cards can be selected */
98
+ selectable: {
99
+ type: Boolean,
100
+ default: false,
101
+ },
102
+ /** Array of currently selected object IDs */
103
+ selectedIds: {
104
+ type: Array,
105
+ default: () => [],
106
+ },
107
+ /** Property name used as unique identifier */
108
+ rowKey: {
109
+ type: String,
110
+ default: 'id',
111
+ },
112
+ /** Text shown when there are no objects */
113
+ emptyText: {
114
+ type: String,
115
+ default: 'No items found',
116
+ },
117
+ },
118
+
119
+ methods: {
120
+ isSelected(object) {
121
+ return this.selectedIds.includes(object[this.rowKey])
122
+ },
123
+
124
+ toggleSelect(object) {
125
+ const id = object[this.rowKey]
126
+ const newIds = this.isSelected(object)
127
+ ? this.selectedIds.filter((i) => i !== id)
128
+ : [...this.selectedIds, id]
129
+ this.$emit('select', newIds)
130
+ },
131
+ },
132
+ }
133
+ </script>
134
+
135
+ <style scoped>
136
+ .cn-card-grid__grid {
137
+ display: grid;
138
+ grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
139
+ gap: 16px;
140
+ }
141
+
142
+ .cn-card-grid__loading {
143
+ display: flex;
144
+ justify-content: center;
145
+ padding: 40px;
146
+ }
147
+
148
+ .cn-card-grid__empty {
149
+ padding: 40px 20px;
150
+ text-align: center;
151
+ }
152
+ </style>
@@ -0,0 +1 @@
1
+ export { default as CnCardGrid } from './CnCardGrid.vue'
@@ -0,0 +1,132 @@
1
+ <template>
2
+ <span class="cn-cell-renderer" :class="cellClass">
3
+ <!-- Boolean: icon -->
4
+ <template v-if="propertyType === 'boolean'">
5
+ <CheckBold v-if="value" :size="16" class="cn-cell-renderer__icon cn-cell-renderer__icon--success" />
6
+ <span v-else class="cn-cell-renderer__dash">—</span>
7
+ </template>
8
+
9
+ <!-- Enum: status badge -->
10
+ <template v-else-if="isEnum">
11
+ <CnStatusBadge v-if="value" :label="String(value)" />
12
+ <span v-else class="cn-cell-renderer__dash">—</span>
13
+ </template>
14
+
15
+ <!-- Array: comma-joined or count -->
16
+ <template v-else-if="propertyType === 'array'">
17
+ <span v-if="!value || !value.length" class="cn-cell-renderer__dash">—</span>
18
+ <span v-else :title="Array.isArray(value) ? value.join(', ') : ''">
19
+ {{ formattedValue }}
20
+ </span>
21
+ </template>
22
+
23
+ <!-- Default: formatted text -->
24
+ <template v-else>
25
+ <span :title="rawTitle">{{ formattedValue }}</span>
26
+ </template>
27
+ </span>
28
+ </template>
29
+
30
+ <script>
31
+ import { formatValue } from '../../utils/schema.js'
32
+ import { CnStatusBadge } from '../CnStatusBadge/index.js'
33
+ import CheckBold from 'vue-material-design-icons/CheckBold.vue'
34
+
35
+ /**
36
+ * CnCellRenderer — Type-aware cell renderer for schema-driven tables.
37
+ *
38
+ * Renders a single cell value based on its schema property definition.
39
+ * Booleans render as icons, enums as status badges, dates as formatted strings,
40
+ * and everything else as truncated text via `formatValue()`.
41
+ *
42
+ * @example
43
+ * <CnCellRenderer :value="row.status" :property="schema.properties.status" />
44
+ */
45
+ export default {
46
+ name: 'CnCellRenderer',
47
+
48
+ components: {
49
+ CnStatusBadge,
50
+ CheckBold,
51
+ },
52
+
53
+ props: {
54
+ /** The raw cell value */
55
+ value: {
56
+ type: [String, Number, Boolean, Array, Object],
57
+ default: null,
58
+ },
59
+ /** Schema property definition: { type, format, enum, items, title } */
60
+ property: {
61
+ type: Object,
62
+ default: () => ({}),
63
+ },
64
+ /** Maximum string length before truncation */
65
+ truncate: {
66
+ type: Number,
67
+ default: 100,
68
+ },
69
+ },
70
+
71
+ computed: {
72
+ propertyType() {
73
+ return this.property?.type || (typeof this.value)
74
+ },
75
+
76
+ isEnum() {
77
+ return !!(this.property?.enum && this.property.enum.length > 0)
78
+ },
79
+
80
+ formattedValue() {
81
+ return formatValue(this.value, this.property, { truncate: this.truncate })
82
+ },
83
+
84
+ rawTitle() {
85
+ // Show full value on hover if it was truncated
86
+ const raw = this.value
87
+ if (typeof raw === 'string' && raw.length > this.truncate) {
88
+ return raw
89
+ }
90
+ return undefined
91
+ },
92
+
93
+ cellClass() {
94
+ const classes = []
95
+ if (this.propertyType === 'boolean') classes.push('cn-cell-renderer--boolean')
96
+ if (this.isEnum) classes.push('cn-cell-renderer--enum')
97
+ if (this.property?.format === 'date-time' || this.property?.format === 'date') {
98
+ classes.push('cn-cell-renderer--date')
99
+ }
100
+ if (this.property?.format === 'uuid') classes.push('cn-cell-renderer--uuid')
101
+ if (this.propertyType === 'integer' || this.propertyType === 'number') {
102
+ classes.push('cn-cell-renderer--number')
103
+ }
104
+ return classes
105
+ },
106
+ },
107
+ }
108
+ </script>
109
+
110
+ <style scoped>
111
+ .cn-cell-renderer--uuid {
112
+ font-family: monospace;
113
+ font-size: 13px;
114
+ color: var(--color-text-maxcontrast);
115
+ }
116
+
117
+ .cn-cell-renderer--number {
118
+ font-variant-numeric: tabular-nums;
119
+ }
120
+
121
+ .cn-cell-renderer--date {
122
+ white-space: nowrap;
123
+ }
124
+
125
+ .cn-cell-renderer__dash {
126
+ color: var(--color-text-maxcontrast);
127
+ }
128
+
129
+ .cn-cell-renderer__icon--success {
130
+ color: var(--color-success);
131
+ }
132
+ </style>
@@ -0,0 +1 @@
1
+ export { default as CnCellRenderer } from './CnCellRenderer.vue'
@@ -0,0 +1,77 @@
1
+ <template>
2
+ <div class="cn-card">
3
+ <div class="cn-card-header">
4
+ <h3>
5
+ <slot name="icon" />
6
+ {{ title }}
7
+ </h3>
8
+ <div class="cn-card-header__actions">
9
+ <slot name="actions" />
10
+ </div>
11
+ </div>
12
+
13
+ <!-- Status badges -->
14
+ <div v-if="$slots.status" class="cn-config-card__status">
15
+ <slot name="status" />
16
+ </div>
17
+
18
+ <!-- Main content -->
19
+ <div class="cn-config-card__content">
20
+ <slot />
21
+ </div>
22
+
23
+ <!-- Footer -->
24
+ <div v-if="$slots.footer" class="cn-config-card__footer">
25
+ <slot name="footer" />
26
+ </div>
27
+ </div>
28
+ </template>
29
+
30
+ <script>
31
+ /**
32
+ * CnConfigurationCard — Configuration card with title, actions, status, and content.
33
+ *
34
+ * Decoupled from OpenRegister's ConfigurationCard. All data is provided via
35
+ * props and slots — no store dependencies. Consumer wraps this and handles
36
+ * navigation/store logic.
37
+ *
38
+ * @example
39
+ * <CnConfigurationCard title="Database Configuration">
40
+ * <template #actions>
41
+ * <NcActions><NcActionButton @click="edit">Edit</NcActionButton></NcActions>
42
+ * </template>
43
+ * <template #status>
44
+ * <CnStatusBadge label="Connected" variant="success" />
45
+ * </template>
46
+ * <p>PostgreSQL 15.2 on localhost:5432</p>
47
+ * </CnConfigurationCard>
48
+ */
49
+ export default {
50
+ name: 'CnConfigurationCard',
51
+
52
+ props: {
53
+ /** Card title */
54
+ title: {
55
+ type: String,
56
+ default: '',
57
+ },
58
+ },
59
+ }
60
+ </script>
61
+
62
+ <style scoped>
63
+ .cn-config-card__status {
64
+ display: flex;
65
+ gap: 8px;
66
+ margin-bottom: 12px;
67
+ }
68
+
69
+ .cn-config-card__content {
70
+ margin-bottom: 8px;
71
+ }
72
+
73
+ .cn-config-card__footer {
74
+ padding-top: 12px;
75
+ border-top: 1px solid var(--color-border);
76
+ }
77
+ </style>
@@ -0,0 +1 @@
1
+ export { default as CnConfigurationCard } from './CnConfigurationCard.vue'