@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.
- package/README.md +226 -0
- package/css/index.css +5 -0
- package/dist/nextcloud-vue.cjs.js +7039 -2409
- package/dist/nextcloud-vue.cjs.js.map +1 -1
- package/dist/nextcloud-vue.css +237 -52
- package/dist/nextcloud-vue.esm.js +7012 -2386
- package/dist/nextcloud-vue.esm.js.map +1 -1
- package/package.json +4 -5
- package/src/components/CnActionsBar/CnActionsBar.vue +225 -0
- package/src/components/CnActionsBar/index.js +1 -0
- package/src/components/CnCopyDialog/CnCopyDialog.vue +250 -0
- package/src/components/CnCopyDialog/index.js +1 -0
- package/src/components/CnDataTable/CnDataTable.vue +0 -5
- package/src/components/CnDeleteDialog/CnDeleteDialog.vue +170 -0
- package/src/components/CnDeleteDialog/index.js +1 -0
- package/src/components/CnFormDialog/CnFormDialog.vue +629 -0
- package/src/components/CnFormDialog/index.js +1 -0
- package/src/components/CnIcon/CnIcon.vue +89 -0
- package/src/components/CnIcon/index.js +1 -0
- package/src/components/CnIndexPage/CnIndexPage.vue +434 -300
- package/src/components/CnIndexSidebar/CnIndexSidebar.vue +484 -0
- package/src/components/CnIndexSidebar/index.js +1 -0
- package/src/components/CnPageHeader/CnPageHeader.vue +57 -0
- package/src/components/CnPageHeader/index.js +1 -0
- package/src/components/CnRegisterMapping/CnRegisterMapping.vue +792 -0
- package/src/components/CnRegisterMapping/index.js +1 -0
- package/src/components/index.js +8 -4
- package/src/composables/useListView.js +254 -45
- package/src/constants/metadata.js +30 -0
- package/src/css/actions-bar.css +48 -0
- package/src/css/badge.css +4 -4
- package/src/css/card.css +23 -23
- package/src/css/detail.css +13 -13
- package/src/css/index-page.css +32 -0
- package/src/css/index-sidebar.css +187 -0
- package/src/css/index.css +4 -0
- package/src/css/layout.css +14 -14
- package/src/css/page-header.css +33 -0
- package/src/css/pagination.css +12 -12
- package/src/css/table.css +21 -22
- package/src/css/utilities.css +2 -2
- package/src/index.js +11 -8
- package/src/store/plugins/index.js +1 -0
- package/src/store/plugins/registerMapping.js +185 -0
- package/src/store/useObjectStore.js +122 -61
- package/src/utils/headers.js +7 -1
- package/src/utils/index.js +1 -1
- package/src/utils/schema.js +133 -1
- package/src/components/CnDetailViewLayout/CnDetailViewLayout.vue +0 -88
- package/src/components/CnDetailViewLayout/index.js +0 -1
- package/src/components/CnEmptyState/CnEmptyState.vue +0 -78
- package/src/components/CnEmptyState/index.js +0 -1
- package/src/components/CnListViewLayout/CnListViewLayout.vue +0 -80
- package/src/components/CnListViewLayout/index.js +0 -1
- package/src/components/CnViewModeToggle/CnViewModeToggle.vue +0 -77
- package/src/components/CnViewModeToggle/index.js +0 -1
package/README.md
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/ConductionNL/nextcloud-vue/main/src/img/logo.svg" alt="@conduction/nextcloud-vue logo" width="80" height="80">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">@conduction/nextcloud-vue</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<strong>Shared Vue 2 component library for Conduction Nextcloud apps — higher-level UI, OpenRegister integration, and NL Design System support</strong>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://www.npmjs.com/package/@conduction/nextcloud-vue"><img src="https://img.shields.io/npm/v/@conduction/nextcloud-vue" alt="npm version"></a>
|
|
13
|
+
<a href="https://github.com/ConductionNL/nextcloud-vue/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-EUPL--1.2-blue" alt="License"></a>
|
|
14
|
+
<a href="https://github.com/ConductionNL/nextcloud-vue/actions"><img src="https://img.shields.io/github/actions/workflow/status/ConductionNL/nextcloud-vue/code-quality.yml?label=quality" alt="Code quality"></a>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
`@conduction/nextcloud-vue` is an npm component library that sits on top of `@nextcloud/vue` and provides higher-level, opinionated components for building Nextcloud apps. It handles the repetitive patterns — schema-driven tables, CRUD dialogs, paginated lists, faceted search — so each app only writes the domain-specific parts.
|
|
20
|
+
|
|
21
|
+
Used internally by [Pipelinq](https://github.com/ConductionNL/pipelinq), [Procest](https://github.com/ConductionNL/procest), [Larping](https://github.com/ConductionNL/larpingapp), and other Conduction Nextcloud apps.
|
|
22
|
+
|
|
23
|
+
> **Requires:** Vue 2.7, Pinia 2, @nextcloud/vue 8
|
|
24
|
+
|
|
25
|
+
## Features
|
|
26
|
+
|
|
27
|
+
### Layout & Page Components
|
|
28
|
+
|
|
29
|
+
| Component | Description |
|
|
30
|
+
|-----------|-------------|
|
|
31
|
+
| `CnIndexPage` | Zero-config index page with table/card views, built-in CRUD dialogs, pagination, mass actions, and faceted search |
|
|
32
|
+
| `CnPageHeader` | Page header with icon, title, and description |
|
|
33
|
+
| `CnActionsBar` | Action bar with add button, mass action triggers, view toggle (table/grid), and search |
|
|
34
|
+
| `CnIndexSidebar` | Sidebar for index pages |
|
|
35
|
+
|
|
36
|
+
### Data Display
|
|
37
|
+
|
|
38
|
+
| Component | Description |
|
|
39
|
+
|-----------|-------------|
|
|
40
|
+
| `CnDataTable` | Sortable table with multi-select, schema-driven columns, loading states, and empty states |
|
|
41
|
+
| `CnCardGrid` | Responsive card grid for object summaries |
|
|
42
|
+
| `CnObjectCard` | Single object card with title, metadata, and actions |
|
|
43
|
+
| `CnCellRenderer` | Type-aware cell formatter for strings, numbers, dates, objects, arrays, and booleans |
|
|
44
|
+
| `CnFacetSidebar` | Faceted filter sidebar with aggregated count buckets |
|
|
45
|
+
| `CnPagination` | Full pagination with page numbers, size selector, and "go to page" |
|
|
46
|
+
| `CnFilterBar` | Search input with filter controls |
|
|
47
|
+
| `CnKpiGrid` | KPI metric cards for statistics dashboards |
|
|
48
|
+
|
|
49
|
+
### Single-Object Dialogs
|
|
50
|
+
|
|
51
|
+
| Component | Description |
|
|
52
|
+
|-----------|-------------|
|
|
53
|
+
| `CnFormDialog` | Schema-driven form dialog for create and edit; auto-generates fields from JSON Schema |
|
|
54
|
+
| `CnDeleteDialog` | Delete confirmation with two-phase confirm/result pattern |
|
|
55
|
+
| `CnCopyDialog` | Copy dialog with naming pattern selector |
|
|
56
|
+
|
|
57
|
+
### Mass-Action Dialogs
|
|
58
|
+
|
|
59
|
+
| Component | Description |
|
|
60
|
+
|-----------|-------------|
|
|
61
|
+
| `CnMassDeleteDialog` | Bulk delete confirmation |
|
|
62
|
+
| `CnMassCopyDialog` | Bulk copy with per-item naming |
|
|
63
|
+
| `CnMassExportDialog` | Export selected items (JSON, CSV, …) |
|
|
64
|
+
| `CnMassImportDialog` | Bulk import with file upload and format detection |
|
|
65
|
+
|
|
66
|
+
### Settings & Config
|
|
67
|
+
|
|
68
|
+
| Component | Description |
|
|
69
|
+
|-----------|-------------|
|
|
70
|
+
| `CnSettingsCard` | Collapsible settings card with save state |
|
|
71
|
+
| `CnSettingsSection` | Container for grouping settings |
|
|
72
|
+
| `CnConfigurationCard` | Configuration card with status indicator |
|
|
73
|
+
| `CnVersionInfoCard` | Version information display |
|
|
74
|
+
| `CnStatsBlock` | Statistics block with count and breakdown |
|
|
75
|
+
| `CnRegisterMapping` | Register-to-field mapping configuration |
|
|
76
|
+
|
|
77
|
+
### State Management
|
|
78
|
+
|
|
79
|
+
| Export | Description |
|
|
80
|
+
|--------|-------------|
|
|
81
|
+
| `useObjectStore(id)` | Generic Pinia store for OpenRegister CRUD — pagination, search, caching |
|
|
82
|
+
| `createObjectStore(id)` | Factory for custom-scoped object stores |
|
|
83
|
+
| `createSubResourcePlugin(name)` | Plugin factory for sub-resource management |
|
|
84
|
+
| `auditTrailsPlugin` | Adds audit trail state and getters |
|
|
85
|
+
| `relationsPlugin` | Manages object relations/associations |
|
|
86
|
+
| `filesPlugin` | Handles file attachments and uploads |
|
|
87
|
+
| `lifecyclePlugin` | Tracks lifecycle states (draft, published, archived) |
|
|
88
|
+
| `registerMappingPlugin` | Manages register-to-field mappings |
|
|
89
|
+
|
|
90
|
+
### Composables
|
|
91
|
+
|
|
92
|
+
| Composable | Description |
|
|
93
|
+
|------------|-------------|
|
|
94
|
+
| `useListView(options)` | Manages list view state: search debounce, filter state, sort, pagination |
|
|
95
|
+
| `useDetailView(options)` | Manages detail view: load, edit, delete, validation |
|
|
96
|
+
| `useSubResource(options)` | Manages sub-resource operations |
|
|
97
|
+
|
|
98
|
+
### Schema Utilities
|
|
99
|
+
|
|
100
|
+
| Function | Description |
|
|
101
|
+
|----------|-------------|
|
|
102
|
+
| `columnsFromSchema(schema)` | Auto-generate data table column definitions from JSON Schema |
|
|
103
|
+
| `fieldsFromSchema(schema)` | Auto-generate form field definitions from JSON Schema |
|
|
104
|
+
| `filtersFromSchema(schema)` | Auto-generate filter definitions from JSON Schema |
|
|
105
|
+
| `formatValue(value, format)` | Type-aware cell value formatter |
|
|
106
|
+
|
|
107
|
+
## Architecture
|
|
108
|
+
|
|
109
|
+
```mermaid
|
|
110
|
+
graph TD
|
|
111
|
+
A[Nextcloud App] -->|imports| B[@conduction/nextcloud-vue]
|
|
112
|
+
B --> C[Components]
|
|
113
|
+
B --> D[useObjectStore]
|
|
114
|
+
B --> E[Composables]
|
|
115
|
+
B --> F[Schema Utils]
|
|
116
|
+
D -->|CRUD| G[OpenRegister REST API]
|
|
117
|
+
C -->|styles via| H[Nextcloud CSS Variables]
|
|
118
|
+
C -->|NL Design tokens| I[--nldesign-* CSS vars]
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Two-Phase Dialog Pattern
|
|
122
|
+
|
|
123
|
+
All dialogs follow a predictable confirm/result flow that keeps parent components in control of API calls:
|
|
124
|
+
|
|
125
|
+
```js
|
|
126
|
+
// 1. Dialog emits @confirm with user input
|
|
127
|
+
// 2. Parent handles API call
|
|
128
|
+
// 3. Parent calls dialog.setResult(response) via $ref
|
|
129
|
+
// 4. Dialog shows toast and auto-closes
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Schema-Driven Components
|
|
133
|
+
|
|
134
|
+
Pass a JSON Schema and get a fully working table or form with zero configuration:
|
|
135
|
+
|
|
136
|
+
```vue
|
|
137
|
+
<CnIndexPage
|
|
138
|
+
:schema="caseTypeSchema"
|
|
139
|
+
:objects="caseTypes"
|
|
140
|
+
@save="onSave"
|
|
141
|
+
@delete="onDelete"
|
|
142
|
+
/>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Installation
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
npm install @conduction/nextcloud-vue
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Import the CSS alongside your component imports:
|
|
152
|
+
|
|
153
|
+
```js
|
|
154
|
+
import '@conduction/nextcloud-vue/dist/nextcloud-vue.css'
|
|
155
|
+
import { CnIndexPage, useObjectStore } from '@conduction/nextcloud-vue'
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Webpack Alias (for local development)
|
|
159
|
+
|
|
160
|
+
When developing against the source directly, add deduplication aliases in `webpack.config.js` to prevent dual-instance bugs:
|
|
161
|
+
|
|
162
|
+
```js
|
|
163
|
+
config.resolve.alias = {
|
|
164
|
+
'@conduction/nextcloud-vue': path.resolve(__dirname, '../nextcloud-vue/src'),
|
|
165
|
+
'vue': path.resolve(__dirname, 'node_modules/vue'),
|
|
166
|
+
'pinia': path.resolve(__dirname, 'node_modules/pinia'),
|
|
167
|
+
'@nextcloud/vue': path.resolve(__dirname, 'node_modules/@nextcloud/vue'),
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
> **Important:** Without these aliases, webpack may resolve Vue and Pinia from the library's `node_modules`, creating dual instances that break reactivity and state management.
|
|
172
|
+
|
|
173
|
+
## Directory Structure
|
|
174
|
+
|
|
175
|
+
```
|
|
176
|
+
nextcloud-vue/
|
|
177
|
+
├── src/
|
|
178
|
+
│ ├── index.js # Main barrel export
|
|
179
|
+
│ ├── components/ # 30+ Vue 2 SFCs (one directory each)
|
|
180
|
+
│ │ ├── CnIndexPage/
|
|
181
|
+
│ │ ├── CnDataTable/
|
|
182
|
+
│ │ ├── CnFormDialog/
|
|
183
|
+
│ │ └── ...
|
|
184
|
+
│ ├── store/
|
|
185
|
+
│ │ ├── index.js # useObjectStore, createObjectStore
|
|
186
|
+
│ │ └── plugins/ # auditTrails, relations, files, lifecycle, registerMapping
|
|
187
|
+
│ ├── composables/ # useListView, useDetailView, useSubResource
|
|
188
|
+
│ ├── utils/ # schema, headers, errors, formatting
|
|
189
|
+
│ ├── css/ # Modular CSS (one file per component group)
|
|
190
|
+
│ └── types/index.d.ts # TypeScript definitions
|
|
191
|
+
├── tests/ # Jest test suite
|
|
192
|
+
├── dist/ # Built output (ESM, CJS, CSS)
|
|
193
|
+
├── rollup.config.js # Build configuration
|
|
194
|
+
└── package.json
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## Development
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
npm install
|
|
201
|
+
npm run dev # Watch mode (Rollup)
|
|
202
|
+
npm run build # Production build
|
|
203
|
+
npm test # Jest tests
|
|
204
|
+
npm run lint # ESLint
|
|
205
|
+
npm run stylelint # Stylelint
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## Tech Stack
|
|
209
|
+
|
|
210
|
+
| Layer | Technology |
|
|
211
|
+
|-------|-----------|
|
|
212
|
+
| Framework | Vue 2.7 (Options API) |
|
|
213
|
+
| State | Pinia 2 |
|
|
214
|
+
| Build | Rollup 3 |
|
|
215
|
+
| CSS | PostCSS (extracted to dist/nextcloud-vue.css) |
|
|
216
|
+
| Testing | Jest 29, @vue/test-utils 1 |
|
|
217
|
+
| Quality | ESLint (@nextcloud/eslint-config), Stylelint |
|
|
218
|
+
| Release | semantic-release (automated npm publish) |
|
|
219
|
+
|
|
220
|
+
## License
|
|
221
|
+
|
|
222
|
+
EUPL-1.2
|
|
223
|
+
|
|
224
|
+
## Authors
|
|
225
|
+
|
|
226
|
+
Built by [Conduction](https://conduction.nl) — open-source software for Dutch government and public sector organizations.
|
package/css/index.css
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/* Entry point for @conduction/nextcloud-vue/css/index.css
|
|
2
|
+
* When installed via npm, this re-exports the library CSS.
|
|
3
|
+
* When resolved via webpack alias (../nextcloud-vue/src), the alias
|
|
4
|
+
* resolves directly to src/css/index.css instead. */
|
|
5
|
+
@import '../src/css/index.css';
|