directus-extension-super-table 0.4.1 → 0.5.0
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 +110 -86
- package/index.js +2 -2
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -11,9 +11,7 @@ A powerful and feature-rich table layout extension for Directus 11+ that enhance
|
|
|
11
11
|
|
|
12
12
|

|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
v0.3.1 - Stable release
|
|
14
|
+
See [CHANGELOG.md](./CHANGELOG.md) for version history.
|
|
17
15
|
|
|
18
16
|
## 🌟 Top Features
|
|
19
17
|
|
|
@@ -33,26 +31,28 @@ Powerful search functionality across all table fields, including nested relation
|
|
|
33
31
|
Switch seamlessly between read-only view mode and interactive edit mode. Control when and how users can modify data.
|
|
34
32
|
|
|
35
33
|
### 🖼️ Advanced Image Display & Selection
|
|
36
|
-
Smart image handling with hover preview, proper aspect ratios, and built-in file browser for selecting media files directly from table cells.
|
|
34
|
+
Smart image handling with an enlarged hover preview, proper aspect ratios, and a built-in file browser for selecting media files directly from table cells.
|
|
37
35
|
|
|
38
36
|
### 🔄 Deep Duplication
|
|
39
37
|
Duplicate items with all their relationships and translations. Perfect for creating variations of complex data structures.
|
|
40
38
|
|
|
39
|
+
### 🧩 Many-to-Any (M2A) Display
|
|
40
|
+
Render polymorphic Many-to-Any relationships directly in the table. Use the `related-values` display or a per-column template with the `{{item:collection.field}}` syntax — including nested chains like `{{item:partners_catalog.catalog_id.title}}`. Each junction row resolves against its own target collection.
|
|
41
|
+
|
|
41
42
|
|
|
42
43
|
|
|
43
44
|
### Display Features
|
|
44
45
|
- **Custom Cell Rendering** - Specialized display for different field types
|
|
45
46
|
- **Relationship Support** - Handle M2O, O2M, M2M, M2A relationships with deep data access
|
|
46
|
-
- **Image Preview** - Inline image display with
|
|
47
|
+
- **Image Preview** - Inline image display with an enlarged hover preview and file browser
|
|
47
48
|
- **Tag Support** - Automatic detection and display of tag fields as visual chips with inline popover editor for adding/removing tags
|
|
48
49
|
- **Status Indicators** - Visual representation of boolean and select fields
|
|
49
50
|
- **Translation Support** - Display multiple language translations as separate columns
|
|
50
51
|
- **Column Alignment** - Configurable text alignment per column (left, center, right)
|
|
51
52
|
|
|
52
53
|
### Performance
|
|
53
|
-
- **
|
|
54
|
-
- **
|
|
55
|
-
- **Lazy Loading** - Load data as needed for large datasets
|
|
54
|
+
- **Native Pagination** - Server-side pagination with selectable page sizes (25, 50, 100, 250, 500, 1000; default 25)
|
|
55
|
+
- **Separate Count Query** - Item count is fetched independently so the table still renders when the count query is restricted by permissions
|
|
56
56
|
|
|
57
57
|
|
|
58
58
|
## Installation
|
|
@@ -89,12 +89,12 @@ npx directus start
|
|
|
89
89
|
1. Clone or download the extension to your Directus extensions folder:
|
|
90
90
|
```bash
|
|
91
91
|
cd /path/to/directus/extensions
|
|
92
|
-
git clone https://github.com/
|
|
92
|
+
git clone https://github.com/smartlabsAT/directus-super-table.git
|
|
93
93
|
```
|
|
94
94
|
|
|
95
95
|
2. Install dependencies:
|
|
96
96
|
```bash
|
|
97
|
-
cd super-
|
|
97
|
+
cd directus-super-table
|
|
98
98
|
pnpm install # or npm install
|
|
99
99
|
```
|
|
100
100
|
|
|
@@ -107,11 +107,10 @@ npx directus start
|
|
|
107
107
|
|
|
108
108
|
### Configuration
|
|
109
109
|
|
|
110
|
-
1.
|
|
111
|
-
2.
|
|
112
|
-
3. Select "Super
|
|
113
|
-
4. Configure the layout options
|
|
114
|
-
5. Save your changes
|
|
110
|
+
1. Open a collection in the Directus Content module
|
|
111
|
+
2. Open the layout dropdown in the sidebar
|
|
112
|
+
3. Select **"Super Table"** as the layout
|
|
113
|
+
4. Configure the layout options in the **Layout Options** sidebar panel
|
|
115
114
|
|
|
116
115
|
## Usage Guide
|
|
117
116
|
|
|
@@ -129,21 +128,24 @@ Quick Filters provide fast access to frequently used filter combinations:
|
|
|
129
128
|
### Inline Editing
|
|
130
129
|
Edit data directly in the table without opening a separate form:
|
|
131
130
|
|
|
132
|
-
1. **Entering Edit Mode**:
|
|
131
|
+
1. **Entering Edit Mode**: Enable "Edit Mode" in the **Layout Options** sidebar (or the edit toggle in the table header), then click an editable cell
|
|
133
132
|
2. **Editor Types**:
|
|
134
133
|
- Text fields: Simple input or WYSIWYG editor
|
|
135
134
|
- Boolean: Checkbox toggle
|
|
136
135
|
- Select: Dropdown menu
|
|
137
136
|
- Date/Time: Full date picker with calendar
|
|
138
137
|
- Color: Color picker with alignment support
|
|
139
|
-
- Image/File:
|
|
140
|
-
3. **Unified Header Actions
|
|
141
|
-
- Save/Cancel buttons
|
|
138
|
+
- Image/File: File browser with larger previews
|
|
139
|
+
3. **Unified Header Actions**:
|
|
140
|
+
- Save/Cancel buttons in the popover header for all field types
|
|
142
141
|
- Consistent UI across all editors
|
|
143
142
|
- Icon-only buttons matching native Directus style
|
|
144
143
|
4. **Saving**: Click save button (✓) or press Enter
|
|
145
144
|
5. **Canceling**: Click cancel button (✗) or press Escape
|
|
146
145
|
|
|
146
|
+
> **Note:** Relational fields (M2O, O2M, M2M, M2A) are display-only and are not
|
|
147
|
+
> editable inline — open the item detail view to edit them.
|
|
148
|
+
|
|
147
149
|
### Column Management
|
|
148
150
|
Customize which columns are displayed and how:
|
|
149
151
|
|
|
@@ -153,6 +155,34 @@ Customize which columns are displayed and how:
|
|
|
153
155
|
4. **Reorder Columns**: Drag column headers to reorder
|
|
154
156
|
5. **Resize Columns**: Drag column borders to resize
|
|
155
157
|
|
|
158
|
+
### Column Displays
|
|
159
|
+
Override how a column renders by attaching a display template, configured in the
|
|
160
|
+
sidebar under **Layout Options → Column Displays**:
|
|
161
|
+
|
|
162
|
+
1. **Add a display**: Click "Add Column Display", pick a column, and enter a template
|
|
163
|
+
2. **Edit / Remove**: Click an existing entry to edit it, or the ✗ icon to remove it
|
|
164
|
+
3. **Templates** use the `{{ field }}` mustache syntax and may reference related fields
|
|
165
|
+
|
|
166
|
+
#### Many-to-Any (M2A) templates
|
|
167
|
+
M2A fields are polymorphic — each row points at one of several target collections —
|
|
168
|
+
so their templates use a dedicated `item:` syntax. Tokens are written **relative to
|
|
169
|
+
the field** (do not prefix the field name):
|
|
170
|
+
|
|
171
|
+
- `{{collection}}` — the name of the row's target collection
|
|
172
|
+
- `{{item:<collection>.<field>}}` — a field on a specific target collection
|
|
173
|
+
- Nested paths are supported, e.g. `{{item:partners_catalog.catalog_id.title}}`
|
|
174
|
+
(M2A → M2O → value)
|
|
175
|
+
|
|
176
|
+
Each junction row only resolves the token whose `<collection>` matches its own
|
|
177
|
+
target, so a template can cover every allowed collection at once:
|
|
178
|
+
|
|
179
|
+
```
|
|
180
|
+
{{collection}}: {{item:partners_catalog.name}} {{item:service.name}}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
The editor shows the allowed collections and an example for the selected field. A
|
|
184
|
+
bare token (e.g. `{{name}}`) is intentionally dropped for M2A — use the `item:` form.
|
|
185
|
+
|
|
156
186
|
### Bookmarks
|
|
157
187
|
Save table configurations for quick access:
|
|
158
188
|
|
|
@@ -165,35 +195,38 @@ Save table configurations for quick access:
|
|
|
165
195
|
|
|
166
196
|
```
|
|
167
197
|
super-layout-table/
|
|
198
|
+
├── index.ts # Extension entry point (defineLayout)
|
|
168
199
|
├── src/
|
|
169
|
-
│ ├──
|
|
170
|
-
│ ├──
|
|
171
|
-
│ ├── actions.vue
|
|
172
|
-
│ ├──
|
|
173
|
-
│ ├──
|
|
174
|
-
│
|
|
175
|
-
│
|
|
176
|
-
│
|
|
177
|
-
│
|
|
178
|
-
│
|
|
179
|
-
│
|
|
180
|
-
│
|
|
181
|
-
├──
|
|
182
|
-
│ ├──
|
|
183
|
-
│
|
|
184
|
-
│ └──
|
|
185
|
-
├──
|
|
186
|
-
│
|
|
187
|
-
│
|
|
188
|
-
|
|
189
|
-
├──
|
|
190
|
-
|
|
200
|
+
│ ├── super-table.vue # Main layout component
|
|
201
|
+
│ ├── options.vue # Sidebar layout options
|
|
202
|
+
│ ├── actions.vue # Row/bulk actions component
|
|
203
|
+
│ ├── components/
|
|
204
|
+
│ │ ├── InlineEditPopover.vue # Inline editor popover
|
|
205
|
+
│ │ ├── QuickFilters.vue # Quick filter management
|
|
206
|
+
│ │ ├── ColumnDisplaysSection.vue # Column-display list + editor
|
|
207
|
+
│ │ ├── ColumnDisplayEditor.vue # Single column-display form
|
|
208
|
+
│ │ ├── EditableCellRelational.vue# Relational/M2A cell rendering
|
|
209
|
+
│ │ └── CellRenderers/ # Custom cell renderers (image, select, …)
|
|
210
|
+
│ ├── composables/
|
|
211
|
+
│ │ ├── api.ts # API operations (useTableApi)
|
|
212
|
+
│ │ ├── useAliasFields.ts # Field aliasing logic
|
|
213
|
+
│ │ ├── useColumnDisplays.ts # Column-display override CRUD
|
|
214
|
+
│ │ └── … # pagination, sort, permissions, translations
|
|
215
|
+
│ └── utils/
|
|
216
|
+
│ ├── adjustFieldsForDisplays.ts# Display field expansion (incl. M2A)
|
|
217
|
+
│ ├── displayHeuristics.ts # Template tokenising + relation helpers
|
|
218
|
+
│ ├── resolveM2ARelation.ts # M2A junction-shape resolver
|
|
219
|
+
│ └── getDefaultDisplayForType.ts# Default display mapping
|
|
220
|
+
├── tests/ # Vitest unit tests
|
|
221
|
+
├── package.json # Package configuration
|
|
222
|
+
├── tsconfig.json # TypeScript configuration
|
|
223
|
+
└── README.md # This file
|
|
191
224
|
```
|
|
192
225
|
|
|
193
226
|
## Development
|
|
194
227
|
|
|
195
228
|
### Prerequisites
|
|
196
|
-
- Node.js
|
|
229
|
+
- Node.js 20+ (CI runs on 20.x and 22.x)
|
|
197
230
|
- pnpm package manager
|
|
198
231
|
- Directus 11.0.0+
|
|
199
232
|
|
|
@@ -240,10 +273,12 @@ Every push and pull request triggers automated quality validation:
|
|
|
240
273
|
|
|
241
274
|
```
|
|
242
275
|
.github/workflows/
|
|
243
|
-
├──
|
|
244
|
-
├──
|
|
245
|
-
├──
|
|
246
|
-
|
|
276
|
+
├── ci.yml # CI/CD pipeline (build, test, quality on Node 20.x & 22.x)
|
|
277
|
+
├── quality-checks.yml # Type-check, lint, format, build (push/PR)
|
|
278
|
+
├── test.yml # Vitest unit tests
|
|
279
|
+
├── pr-checks.yml # PR-specific checks with auto-comments
|
|
280
|
+
├── release.yml # Automated release creation on version tags
|
|
281
|
+
└── badges.yml # Status badge updates
|
|
247
282
|
```
|
|
248
283
|
|
|
249
284
|
### Running Locally
|
|
@@ -268,56 +303,45 @@ pnpm run build # Build test
|
|
|
268
303
|
5. GitHub Actions will automatically validate your code
|
|
269
304
|
6. PR will receive an automated quality report comment
|
|
270
305
|
|
|
271
|
-
###
|
|
272
|
-
The
|
|
306
|
+
### Layout Options
|
|
307
|
+
The layout persists these options (those marked *(sidebar)* have a control in the
|
|
308
|
+
**Layout Options** panel; the rest are set through table interactions):
|
|
273
309
|
|
|
274
310
|
```typescript
|
|
275
311
|
{
|
|
276
|
-
//
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
//
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
//
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
//
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
// Allow column resizing
|
|
289
|
-
showResize: true,
|
|
290
|
-
|
|
291
|
-
// Enable inline editing
|
|
292
|
-
allowInlineEdit: true,
|
|
293
|
-
|
|
294
|
-
// Enable bookmark system
|
|
295
|
-
allowBookmarks: true,
|
|
296
|
-
|
|
297
|
-
// Enable quick filters
|
|
298
|
-
allowQuickFilters: true
|
|
312
|
+
showToolbar?: boolean; // (sidebar) show the toolbar with actions
|
|
313
|
+
editMode?: boolean; // (sidebar) enable inline editing
|
|
314
|
+
directBooleanToggle?: boolean; // (sidebar, requires editMode) single-click boolean toggle
|
|
315
|
+
languageCodeField?: string; // (sidebar) language-code field for translations (default 'languages_code')
|
|
316
|
+
customFieldNames?: Record<string, string>; // per-column header label overrides
|
|
317
|
+
columnDisplays?: Record<string, { template: string; display?: string }>; // per-column display templates
|
|
318
|
+
showSelect?: boolean; // show row-selection checkboxes
|
|
319
|
+
spacing?: 'compact' | 'cozy' | 'comfortable'; // row height
|
|
320
|
+
align?: Record<string, 'left' | 'center' | 'right'>; // per-column text alignment
|
|
321
|
+
widths?: Record<string, number>; // per-column widths
|
|
322
|
+
quickFilters?: QuickFilter[]; // saved quick filters
|
|
299
323
|
}
|
|
300
324
|
```
|
|
301
325
|
|
|
302
326
|
## API Reference
|
|
303
327
|
|
|
304
328
|
### Events
|
|
305
|
-
|
|
329
|
+
As a Directus layout, the component emits the standard layout sync events:
|
|
306
330
|
|
|
307
331
|
- `update:selection` - When item selection changes
|
|
308
|
-
- `update:
|
|
309
|
-
- `update:
|
|
310
|
-
- `update:
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
332
|
+
- `update:layoutOptions` - When a layout option changes (column displays, edit mode, alignment, widths, …)
|
|
333
|
+
- `update:layoutQuery` - When the query changes (fields, sort, page, limit)
|
|
334
|
+
- `update:search` - When the search query changes
|
|
335
|
+
|
|
336
|
+
The `filter` prop is consumed read-only (filtering is driven by Directus), so no
|
|
337
|
+
`update:filter` event is emitted.
|
|
314
338
|
|
|
315
339
|
### Composables
|
|
316
340
|
Available composables for extension development:
|
|
317
341
|
|
|
318
|
-
- `
|
|
342
|
+
- `useTableApi()` - API operations wrapper (fetch, count, update, delete, export)
|
|
319
343
|
- `useAliasFields()` - Field aliasing for complex queries
|
|
320
|
-
- `
|
|
344
|
+
- `useColumnDisplays()` - Per-column display-template overrides
|
|
321
345
|
|
|
322
346
|
## Browser Support
|
|
323
347
|
|
|
@@ -351,14 +375,14 @@ Contributions are welcome! Please follow these guidelines:
|
|
|
351
375
|
- Try clearing browser cache
|
|
352
376
|
|
|
353
377
|
### Inline editing not working
|
|
354
|
-
-
|
|
355
|
-
-
|
|
356
|
-
-
|
|
378
|
+
- Make sure "Edit Mode" is enabled in the Layout Options sidebar
|
|
379
|
+
- Check field permissions in Directus (no update permission = read-only)
|
|
380
|
+
- Ensure fields are not configured as read-only
|
|
381
|
+
- Note: relational fields (M2O, O2M, M2M, M2A) are display-only by design
|
|
357
382
|
|
|
358
383
|
### Performance issues
|
|
359
|
-
-
|
|
360
|
-
-
|
|
361
|
-
- Check browser console for errors
|
|
384
|
+
- Choose a smaller page size (the per-page selector defaults to 25)
|
|
385
|
+
- Check the browser console for errors
|
|
362
386
|
|
|
363
387
|
## Changelog
|
|
364
388
|
|