@object-ui/plugin-kanban 0.3.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/CHANGELOG.md +48 -0
- package/LICENSE +21 -0
- package/README.md +170 -0
- package/dist/KanbanImpl-mGLdSHcd.js +3335 -0
- package/dist/KanbanImpl.d.ts +24 -0
- package/dist/KanbanImpl.d.ts.map +1 -0
- package/dist/index-i_5clVsp.js +746 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.umd.cjs +18 -0
- package/dist/types.d.ts +45 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +44 -0
- package/src/KanbanImpl.tsx +284 -0
- package/src/index.test.ts +104 -0
- package/src/index.tsx +168 -0
- package/src/types.ts +47 -0
- package/tsconfig.json +11 -0
- package/vite.config.ts +38 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# @object-ui/plugin-kanban
|
|
2
|
+
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Unified version across all packages to 0.3.0 for consistent versioning
|
|
8
|
+
|
|
9
|
+
## 0.2.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- New plugin-object and ObjectQL SDK updates
|
|
14
|
+
|
|
15
|
+
**Added:**
|
|
16
|
+
- New Plugin: @object-ui/plugin-object - ObjectQL plugin for automatic table and form generation
|
|
17
|
+
- ObjectTable: Auto-generates tables from ObjectQL object schemas
|
|
18
|
+
- ObjectForm: Auto-generates forms from ObjectQL object schemas with create/edit/view modes
|
|
19
|
+
- Full TypeScript support with comprehensive type definitions
|
|
20
|
+
- Type Definitions: Added ObjectTableSchema and ObjectFormSchema to @object-ui/types
|
|
21
|
+
- ObjectQL Integration: Enhanced ObjectQLDataSource with getObjectSchema() method using MetadataApiClient
|
|
22
|
+
|
|
23
|
+
**Changed:**
|
|
24
|
+
- Updated @objectql/sdk from ^1.8.3 to ^1.9.1
|
|
25
|
+
- Updated @objectql/types from ^1.8.3 to ^1.9.1
|
|
26
|
+
|
|
27
|
+
- Updated dependencies
|
|
28
|
+
- @object-ui/types@0.3.0
|
|
29
|
+
- @object-ui/core@0.2.2
|
|
30
|
+
- @object-ui/react@0.2.2
|
|
31
|
+
- @object-ui/components@0.2.2
|
|
32
|
+
|
|
33
|
+
## 0.2.1
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- Patch release: Add automated changeset workflow and CI/CD improvements
|
|
38
|
+
|
|
39
|
+
This release includes infrastructure improvements:
|
|
40
|
+
- Added changeset-based version management
|
|
41
|
+
- Enhanced CI/CD workflows with GitHub Actions
|
|
42
|
+
- Improved documentation for contributing and releasing
|
|
43
|
+
|
|
44
|
+
- Updated dependencies
|
|
45
|
+
- @object-ui/types@0.2.1
|
|
46
|
+
- @object-ui/core@0.2.1
|
|
47
|
+
- @object-ui/react@0.2.1
|
|
48
|
+
- @object-ui/components@0.2.1
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 ObjectQL
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# Plugin Kanban - Lazy-Loaded Kanban Board
|
|
2
|
+
|
|
3
|
+
A lazy-loaded kanban board component for Object UI based on @dnd-kit for drag-and-drop functionality.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Internal Lazy Loading**: @dnd-kit libraries are loaded on-demand using `React.lazy()` and `Suspense`
|
|
8
|
+
- **Zero Configuration**: Just import the package and use `type: 'kanban'` in your schema
|
|
9
|
+
- **Automatic Registration**: Components auto-register with the ComponentRegistry
|
|
10
|
+
- **Skeleton Loading**: Shows a skeleton while @dnd-kit loads
|
|
11
|
+
- **Drag and Drop**: Full drag-and-drop support for cards between columns
|
|
12
|
+
- **Column Limits**: Set maximum card limits per column
|
|
13
|
+
- **Customizable**: Badge support, custom styling, and callbacks
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pnpm add @object-ui/plugin-kanban
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
### Automatic Registration (Side-Effect Import)
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
// In your app entry point (e.g., App.tsx or main.tsx)
|
|
27
|
+
import '@object-ui/plugin-kanban';
|
|
28
|
+
|
|
29
|
+
// Now you can use kanban type in your schemas
|
|
30
|
+
const schema = {
|
|
31
|
+
type: 'kanban',
|
|
32
|
+
columns: [
|
|
33
|
+
{
|
|
34
|
+
id: 'todo',
|
|
35
|
+
title: 'To Do',
|
|
36
|
+
cards: [
|
|
37
|
+
{ id: '1', title: 'Task 1', description: 'Description' }
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: 'done',
|
|
42
|
+
title: 'Done',
|
|
43
|
+
cards: []
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
};
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Manual Integration
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
import { kanbanComponents } from '@object-ui/plugin-kanban';
|
|
53
|
+
import { ComponentRegistry } from '@object-ui/core';
|
|
54
|
+
|
|
55
|
+
// Manually register if needed
|
|
56
|
+
Object.entries(kanbanComponents).forEach(([type, component]) => {
|
|
57
|
+
ComponentRegistry.register(type, component);
|
|
58
|
+
});
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### TypeScript Support
|
|
62
|
+
|
|
63
|
+
The plugin exports TypeScript types for full type safety:
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
import type { KanbanSchema, KanbanCard, KanbanColumn } from '@object-ui/plugin-kanban';
|
|
67
|
+
|
|
68
|
+
const card: KanbanCard = {
|
|
69
|
+
id: 'task-1',
|
|
70
|
+
title: 'My Task',
|
|
71
|
+
description: 'Task description',
|
|
72
|
+
badges: [
|
|
73
|
+
{ label: 'High Priority', variant: 'destructive' }
|
|
74
|
+
]
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const column: KanbanColumn = {
|
|
78
|
+
id: 'todo',
|
|
79
|
+
title: 'To Do',
|
|
80
|
+
cards: [card],
|
|
81
|
+
limit: 5
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const schema: KanbanSchema = {
|
|
85
|
+
type: 'kanban',
|
|
86
|
+
columns: [column]
|
|
87
|
+
};
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Schema API
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
{
|
|
94
|
+
type: 'kanban',
|
|
95
|
+
columns?: KanbanColumn[], // Array of columns
|
|
96
|
+
onCardMove?: (cardId, fromColumnId, toColumnId, newIndex) => void,
|
|
97
|
+
className?: string // Tailwind classes
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Column structure
|
|
101
|
+
interface KanbanColumn {
|
|
102
|
+
id: string;
|
|
103
|
+
title: string;
|
|
104
|
+
cards: KanbanCard[];
|
|
105
|
+
limit?: number; // Maximum cards allowed
|
|
106
|
+
className?: string;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Card structure
|
|
110
|
+
interface KanbanCard {
|
|
111
|
+
id: string;
|
|
112
|
+
title: string;
|
|
113
|
+
description?: string;
|
|
114
|
+
badges?: Array<{
|
|
115
|
+
label: string;
|
|
116
|
+
variant?: 'default' | 'secondary' | 'destructive' | 'outline';
|
|
117
|
+
}>;
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Features
|
|
122
|
+
|
|
123
|
+
- **Drag and Drop**: Drag cards between columns or reorder within a column
|
|
124
|
+
- **Column Limits**: Set maximum card limits and get visual feedback when full
|
|
125
|
+
- **Card Badges**: Add colored badges to cards for status/priority
|
|
126
|
+
- **Responsive**: Horizontal scrolling for many columns
|
|
127
|
+
- **Accessible**: Built on @dnd-kit with keyboard navigation support
|
|
128
|
+
|
|
129
|
+
## Lazy Loading Architecture
|
|
130
|
+
|
|
131
|
+
The plugin uses a two-file pattern for optimal code splitting:
|
|
132
|
+
|
|
133
|
+
1. **`KanbanImpl.tsx`**: Contains the actual @dnd-kit imports (heavy ~100-150 KB)
|
|
134
|
+
2. **`index.tsx`**: Entry point with `React.lazy()` wrapper (light)
|
|
135
|
+
|
|
136
|
+
When bundled, Vite automatically creates separate chunks:
|
|
137
|
+
- `index.js` (~200 bytes) - The entry point
|
|
138
|
+
- `KanbanImpl-xxx.js` (~100-150 KB) - The lazy-loaded implementation
|
|
139
|
+
|
|
140
|
+
The @dnd-kit libraries are only downloaded when a `kanban` component is actually rendered, not on initial page load.
|
|
141
|
+
|
|
142
|
+
## Bundle Size Impact
|
|
143
|
+
|
|
144
|
+
By using lazy loading, the main application bundle stays lean:
|
|
145
|
+
- Without lazy loading: +100-150 KB on initial load
|
|
146
|
+
- With lazy loading: +0.19 KB on initial load, +100-150 KB only when kanban is rendered
|
|
147
|
+
|
|
148
|
+
This results in significantly faster initial page loads for applications that don't use kanban on every page.
|
|
149
|
+
|
|
150
|
+
## Development
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# Build the plugin
|
|
154
|
+
pnpm build
|
|
155
|
+
|
|
156
|
+
# The package will generate proper ESM and UMD builds with lazy loading preserved
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Example with Callbacks
|
|
160
|
+
|
|
161
|
+
```typescript
|
|
162
|
+
const schema = {
|
|
163
|
+
type: 'kanban',
|
|
164
|
+
columns: [...],
|
|
165
|
+
onCardMove: (cardId, fromColumnId, toColumnId, newIndex) => {
|
|
166
|
+
console.log(`Card ${cardId} moved from ${fromColumnId} to ${toColumnId} at index ${newIndex}`);
|
|
167
|
+
// Update your backend or state here
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
```
|