@composy/kanban-core 0.0.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.
- package/README.md +37 -0
- package/dist/index.css +307 -0
- package/dist/index.js +1279 -0
- package/dist/index.js.map +1 -0
- package/dist/index.min.css +1 -0
- package/dist/index.min.js +1 -0
- package/es/core/ColumnManager.d.ts +99 -0
- package/es/core/ColumnManager.d.ts.map +1 -0
- package/es/core/ColumnManager.js +285 -0
- package/es/core/ColumnManager.js.map +1 -0
- package/es/core/DragController.d.ts +55 -0
- package/es/core/DragController.d.ts.map +1 -0
- package/es/core/DragController.js +225 -0
- package/es/core/DragController.js.map +1 -0
- package/es/core/EventEmitter.d.ts +35 -0
- package/es/core/EventEmitter.d.ts.map +1 -0
- package/es/core/EventEmitter.js +68 -0
- package/es/core/EventEmitter.js.map +1 -0
- package/es/core/FilterEngine.d.ts +45 -0
- package/es/core/FilterEngine.d.ts.map +1 -0
- package/es/core/FilterEngine.js +127 -0
- package/es/core/FilterEngine.js.map +1 -0
- package/es/core/KanbanBoard.d.ts +152 -0
- package/es/core/KanbanBoard.d.ts.map +1 -0
- package/es/core/KanbanBoard.js +332 -0
- package/es/core/KanbanBoard.js.map +1 -0
- package/es/core/Renderer.d.ts +59 -0
- package/es/core/Renderer.d.ts.map +1 -0
- package/es/core/Renderer.js +247 -0
- package/es/core/Renderer.js.map +1 -0
- package/es/core/index.d.ts +11 -0
- package/es/core/index.d.ts.map +1 -0
- package/es/core/index.js +17 -0
- package/es/index.d.ts +15 -0
- package/es/index.d.ts.map +1 -0
- package/es/index.js +21 -0
- package/es/styles/kanban.css +306 -0
- package/es/types/index.d.ts +209 -0
- package/es/types/index.d.ts.map +1 -0
- package/es/types/index.js +10 -0
- package/es/utils/dom.d.ts +24 -0
- package/es/utils/dom.d.ts.map +1 -0
- package/es/utils/dom.js +37 -0
- package/es/utils/dom.js.map +1 -0
- package/es/utils/id.d.ts +9 -0
- package/es/utils/id.d.ts.map +1 -0
- package/es/utils/id.js +22 -0
- package/es/utils/id.js.map +1 -0
- package/es/utils/index.d.ts +25 -0
- package/es/utils/index.d.ts.map +1 -0
- package/es/utils/index.js +20 -0
- package/es/utils/index.js.map +1 -0
- package/es/version.d.ts +6 -0
- package/es/version.d.ts.map +1 -0
- package/es/version.js +15 -0
- package/es/version.js.map +1 -0
- package/esm/core/ColumnManager.d.ts +99 -0
- package/esm/core/ColumnManager.d.ts.map +1 -0
- package/esm/core/ColumnManager.js +285 -0
- package/esm/core/ColumnManager.js.map +1 -0
- package/esm/core/DragController.d.ts +55 -0
- package/esm/core/DragController.d.ts.map +1 -0
- package/esm/core/DragController.js +225 -0
- package/esm/core/DragController.js.map +1 -0
- package/esm/core/EventEmitter.d.ts +35 -0
- package/esm/core/EventEmitter.d.ts.map +1 -0
- package/esm/core/EventEmitter.js +68 -0
- package/esm/core/EventEmitter.js.map +1 -0
- package/esm/core/FilterEngine.d.ts +45 -0
- package/esm/core/FilterEngine.d.ts.map +1 -0
- package/esm/core/FilterEngine.js +127 -0
- package/esm/core/FilterEngine.js.map +1 -0
- package/esm/core/KanbanBoard.d.ts +152 -0
- package/esm/core/KanbanBoard.d.ts.map +1 -0
- package/esm/core/KanbanBoard.js +332 -0
- package/esm/core/KanbanBoard.js.map +1 -0
- package/esm/core/Renderer.d.ts +59 -0
- package/esm/core/Renderer.d.ts.map +1 -0
- package/esm/core/Renderer.js +247 -0
- package/esm/core/Renderer.js.map +1 -0
- package/esm/core/index.d.ts +11 -0
- package/esm/core/index.d.ts.map +1 -0
- package/esm/core/index.js +17 -0
- package/esm/index.d.ts +15 -0
- package/esm/index.d.ts.map +1 -0
- package/esm/index.js +21 -0
- package/esm/styles/kanban.less +339 -0
- package/esm/types/index.d.ts +209 -0
- package/esm/types/index.d.ts.map +1 -0
- package/esm/types/index.js +10 -0
- package/esm/utils/dom.d.ts +24 -0
- package/esm/utils/dom.d.ts.map +1 -0
- package/esm/utils/dom.js +37 -0
- package/esm/utils/dom.js.map +1 -0
- package/esm/utils/id.d.ts +9 -0
- package/esm/utils/id.d.ts.map +1 -0
- package/esm/utils/id.js +22 -0
- package/esm/utils/id.js.map +1 -0
- package/esm/utils/index.d.ts +25 -0
- package/esm/utils/index.d.ts.map +1 -0
- package/esm/utils/index.js +20 -0
- package/esm/utils/index.js.map +1 -0
- package/esm/version.d.ts +6 -0
- package/esm/version.d.ts.map +1 -0
- package/esm/version.js +15 -0
- package/esm/version.js.map +1 -0
- package/lib/core/ColumnManager.cjs +286 -0
- package/lib/core/ColumnManager.cjs.map +1 -0
- package/lib/core/ColumnManager.d.ts +99 -0
- package/lib/core/DragController.cjs +226 -0
- package/lib/core/DragController.cjs.map +1 -0
- package/lib/core/DragController.d.ts +55 -0
- package/lib/core/EventEmitter.cjs +69 -0
- package/lib/core/EventEmitter.cjs.map +1 -0
- package/lib/core/EventEmitter.d.ts +35 -0
- package/lib/core/FilterEngine.cjs +128 -0
- package/lib/core/FilterEngine.cjs.map +1 -0
- package/lib/core/FilterEngine.d.ts +45 -0
- package/lib/core/KanbanBoard.cjs +334 -0
- package/lib/core/KanbanBoard.cjs.map +1 -0
- package/lib/core/KanbanBoard.d.ts +152 -0
- package/lib/core/Renderer.cjs +248 -0
- package/lib/core/Renderer.cjs.map +1 -0
- package/lib/core/Renderer.d.ts +59 -0
- package/lib/core/index.cjs +24 -0
- package/lib/core/index.d.ts +11 -0
- package/lib/index.cjs +37 -0
- package/lib/index.d.ts +15 -0
- package/lib/package.json +3 -0
- package/lib/styles/kanban.css +306 -0
- package/lib/types/index.cjs +11 -0
- package/lib/types/index.d.ts +209 -0
- package/lib/utils/dom.cjs +42 -0
- package/lib/utils/dom.cjs.map +1 -0
- package/lib/utils/dom.d.ts +24 -0
- package/lib/utils/id.cjs +24 -0
- package/lib/utils/id.cjs.map +1 -0
- package/lib/utils/id.d.ts +9 -0
- package/lib/utils/index.cjs +28 -0
- package/lib/utils/index.cjs.map +1 -0
- package/lib/utils/index.d.ts +25 -0
- package/lib/version.cjs +16 -0
- package/lib/version.cjs.map +1 -0
- package/lib/version.d.ts +6 -0
- package/package.json +105 -0
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
/* @composy/kanban-core - Default Styles */
|
|
2
|
+
.kanban-board {
|
|
3
|
+
width: 100%;
|
|
4
|
+
min-height: 400px;
|
|
5
|
+
overflow-x: auto;
|
|
6
|
+
overflow-y: hidden;
|
|
7
|
+
max-width: 100%;
|
|
8
|
+
}
|
|
9
|
+
.kanban-columns {
|
|
10
|
+
display: flex;
|
|
11
|
+
gap: 16px;
|
|
12
|
+
padding: 8px;
|
|
13
|
+
min-height: 100%;
|
|
14
|
+
align-items: flex-start;
|
|
15
|
+
}
|
|
16
|
+
/* Column */
|
|
17
|
+
.kanban-column {
|
|
18
|
+
flex: 0 0 280px;
|
|
19
|
+
max-width: 280px;
|
|
20
|
+
background: #f4f5f7;
|
|
21
|
+
border-radius: 8px;
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
max-height: calc(100vh - 200px);
|
|
25
|
+
transition: opacity 0.2s, box-shadow 0.2s;
|
|
26
|
+
}
|
|
27
|
+
.kanban-column--collapsed {
|
|
28
|
+
flex: 0 0 48px;
|
|
29
|
+
max-width: 48px;
|
|
30
|
+
min-height: 200px;
|
|
31
|
+
}
|
|
32
|
+
.kanban-column--dragging {
|
|
33
|
+
opacity: 0.5;
|
|
34
|
+
}
|
|
35
|
+
.kanban-column--drag-over {
|
|
36
|
+
box-shadow: 0 0 0 2px #4c9aff;
|
|
37
|
+
}
|
|
38
|
+
/* Column Header */
|
|
39
|
+
.kanban-column-header {
|
|
40
|
+
display: flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
gap: 6px;
|
|
43
|
+
padding: 10px 12px;
|
|
44
|
+
border-bottom: 1px solid #e1e4e8;
|
|
45
|
+
-webkit-user-select: none;
|
|
46
|
+
-moz-user-select: none;
|
|
47
|
+
user-select: none;
|
|
48
|
+
}
|
|
49
|
+
.kanban-column-drag-handle {
|
|
50
|
+
cursor: grab;
|
|
51
|
+
color: #a0a0a0;
|
|
52
|
+
font-size: 12px;
|
|
53
|
+
letter-spacing: -3px;
|
|
54
|
+
line-height: 1;
|
|
55
|
+
padding: 2px 0;
|
|
56
|
+
}
|
|
57
|
+
.kanban-column-drag-handle:active {
|
|
58
|
+
cursor: grabbing;
|
|
59
|
+
}
|
|
60
|
+
.kanban-column-color {
|
|
61
|
+
width: 12px;
|
|
62
|
+
height: 12px;
|
|
63
|
+
border-radius: 3px;
|
|
64
|
+
flex-shrink: 0;
|
|
65
|
+
}
|
|
66
|
+
.kanban-column-title {
|
|
67
|
+
font-size: 14px;
|
|
68
|
+
font-weight: 600;
|
|
69
|
+
color: #172b4d;
|
|
70
|
+
flex: 1;
|
|
71
|
+
overflow: hidden;
|
|
72
|
+
text-overflow: ellipsis;
|
|
73
|
+
white-space: nowrap;
|
|
74
|
+
}
|
|
75
|
+
.kanban-column-count {
|
|
76
|
+
font-size: 12px;
|
|
77
|
+
color: #6b778c;
|
|
78
|
+
background: #dfe1e6;
|
|
79
|
+
border-radius: 10px;
|
|
80
|
+
padding: 1px 8px;
|
|
81
|
+
flex-shrink: 0;
|
|
82
|
+
}
|
|
83
|
+
.kanban-column-count--limit {
|
|
84
|
+
background: #ffebe6;
|
|
85
|
+
color: #bf2600;
|
|
86
|
+
}
|
|
87
|
+
.kanban-column-collapse-btn,
|
|
88
|
+
.kanban-column-actions-btn {
|
|
89
|
+
background: none;
|
|
90
|
+
border: none;
|
|
91
|
+
cursor: pointer;
|
|
92
|
+
color: #6b778c;
|
|
93
|
+
font-size: 12px;
|
|
94
|
+
padding: 2px 4px;
|
|
95
|
+
border-radius: 3px;
|
|
96
|
+
line-height: 1;
|
|
97
|
+
}
|
|
98
|
+
.kanban-column-collapse-btn:hover,
|
|
99
|
+
.kanban-column-actions-btn:hover {
|
|
100
|
+
background: #dfe1e6;
|
|
101
|
+
color: #172b4d;
|
|
102
|
+
}
|
|
103
|
+
/* Column Body */
|
|
104
|
+
.kanban-column-body {
|
|
105
|
+
flex: 1;
|
|
106
|
+
overflow-y: auto;
|
|
107
|
+
padding: 8px;
|
|
108
|
+
min-height: 40px;
|
|
109
|
+
}
|
|
110
|
+
.kanban-column-body--drag-over {
|
|
111
|
+
background: #e3f2fd;
|
|
112
|
+
border-radius: 0 0 8px 8px;
|
|
113
|
+
}
|
|
114
|
+
/* Placeholder */
|
|
115
|
+
.kanban-placeholder {
|
|
116
|
+
background: #e3f2fd;
|
|
117
|
+
border: 2px dashed #90caf9;
|
|
118
|
+
border-radius: 6px;
|
|
119
|
+
margin-bottom: 8px;
|
|
120
|
+
min-height: 40px;
|
|
121
|
+
transition: height 0.15s ease;
|
|
122
|
+
}
|
|
123
|
+
/* Card */
|
|
124
|
+
.kanban-card {
|
|
125
|
+
background: #fff;
|
|
126
|
+
border-radius: 6px;
|
|
127
|
+
padding: 10px 12px;
|
|
128
|
+
margin-bottom: 8px;
|
|
129
|
+
cursor: pointer;
|
|
130
|
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
|
|
131
|
+
transition: box-shadow 0.2s, transform 0.15s, opacity 0.2s;
|
|
132
|
+
border: 1px solid transparent;
|
|
133
|
+
position: relative;
|
|
134
|
+
}
|
|
135
|
+
.kanban-card:hover {
|
|
136
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
|
|
137
|
+
border-color: #e1e4e8;
|
|
138
|
+
}
|
|
139
|
+
.kanban-card--dragging {
|
|
140
|
+
opacity: 0.4;
|
|
141
|
+
transform: rotate(2deg);
|
|
142
|
+
}
|
|
143
|
+
/* Card Priority */
|
|
144
|
+
.kanban-card-priority {
|
|
145
|
+
position: absolute;
|
|
146
|
+
left: 0;
|
|
147
|
+
top: 0;
|
|
148
|
+
bottom: 0;
|
|
149
|
+
width: 3px;
|
|
150
|
+
border-radius: 6px 0 0 6px;
|
|
151
|
+
}
|
|
152
|
+
.kanban-card-priority--low {
|
|
153
|
+
background: #36b37e;
|
|
154
|
+
}
|
|
155
|
+
.kanban-card-priority--medium {
|
|
156
|
+
background: #ffab00;
|
|
157
|
+
}
|
|
158
|
+
.kanban-card-priority--high {
|
|
159
|
+
background: #ff5630;
|
|
160
|
+
}
|
|
161
|
+
.kanban-card-priority--urgent {
|
|
162
|
+
background: #bf2600;
|
|
163
|
+
}
|
|
164
|
+
/* Card Labels */
|
|
165
|
+
.kanban-card-labels {
|
|
166
|
+
display: flex;
|
|
167
|
+
flex-wrap: wrap;
|
|
168
|
+
gap: 4px;
|
|
169
|
+
margin-bottom: 6px;
|
|
170
|
+
}
|
|
171
|
+
.kanban-card-label {
|
|
172
|
+
display: inline-block;
|
|
173
|
+
padding: 1px 8px;
|
|
174
|
+
border-radius: 3px;
|
|
175
|
+
font-size: 11px;
|
|
176
|
+
color: #fff;
|
|
177
|
+
font-weight: 500;
|
|
178
|
+
line-height: 1.6;
|
|
179
|
+
}
|
|
180
|
+
/* Card Title */
|
|
181
|
+
.kanban-card-title {
|
|
182
|
+
font-size: 14px;
|
|
183
|
+
font-weight: 500;
|
|
184
|
+
color: #172b4d;
|
|
185
|
+
line-height: 1.4;
|
|
186
|
+
word-break: break-word;
|
|
187
|
+
}
|
|
188
|
+
/* Card Description */
|
|
189
|
+
.kanban-card-desc {
|
|
190
|
+
font-size: 12px;
|
|
191
|
+
color: #6b778c;
|
|
192
|
+
margin-top: 4px;
|
|
193
|
+
line-height: 1.4;
|
|
194
|
+
display: -webkit-box;
|
|
195
|
+
-webkit-line-clamp: 2;
|
|
196
|
+
-webkit-box-orient: vertical;
|
|
197
|
+
overflow: hidden;
|
|
198
|
+
}
|
|
199
|
+
/* Card Footer */
|
|
200
|
+
.kanban-card-footer {
|
|
201
|
+
display: flex;
|
|
202
|
+
align-items: center;
|
|
203
|
+
justify-content: space-between;
|
|
204
|
+
margin-top: 8px;
|
|
205
|
+
gap: 8px;
|
|
206
|
+
}
|
|
207
|
+
.kanban-card-assignees {
|
|
208
|
+
display: flex;
|
|
209
|
+
gap: -4px;
|
|
210
|
+
}
|
|
211
|
+
.kanban-card-avatar {
|
|
212
|
+
display: inline-flex;
|
|
213
|
+
align-items: center;
|
|
214
|
+
justify-content: center;
|
|
215
|
+
width: 24px;
|
|
216
|
+
height: 24px;
|
|
217
|
+
border-radius: 50%;
|
|
218
|
+
background: #dfe1e6;
|
|
219
|
+
color: #42526e;
|
|
220
|
+
font-size: 11px;
|
|
221
|
+
font-weight: 600;
|
|
222
|
+
border: 2px solid #fff;
|
|
223
|
+
margin-left: -4px;
|
|
224
|
+
}
|
|
225
|
+
.kanban-card-avatar:first-child {
|
|
226
|
+
margin-left: 0;
|
|
227
|
+
}
|
|
228
|
+
.kanban-card-avatar-more {
|
|
229
|
+
display: inline-flex;
|
|
230
|
+
align-items: center;
|
|
231
|
+
justify-content: center;
|
|
232
|
+
width: 24px;
|
|
233
|
+
height: 24px;
|
|
234
|
+
border-radius: 50%;
|
|
235
|
+
background: #c1c7d0;
|
|
236
|
+
color: #42526e;
|
|
237
|
+
font-size: 10px;
|
|
238
|
+
font-weight: 600;
|
|
239
|
+
border: 2px solid #fff;
|
|
240
|
+
margin-left: -4px;
|
|
241
|
+
}
|
|
242
|
+
.kanban-card-due {
|
|
243
|
+
font-size: 12px;
|
|
244
|
+
color: #6b778c;
|
|
245
|
+
display: flex;
|
|
246
|
+
align-items: center;
|
|
247
|
+
gap: 4px;
|
|
248
|
+
}
|
|
249
|
+
.kanban-card-due--overdue {
|
|
250
|
+
color: #ff5630;
|
|
251
|
+
font-weight: 600;
|
|
252
|
+
}
|
|
253
|
+
/* Add Buttons */
|
|
254
|
+
.kanban-add-card {
|
|
255
|
+
padding: 0 4px;
|
|
256
|
+
}
|
|
257
|
+
.kanban-add-card-btn {
|
|
258
|
+
width: 100%;
|
|
259
|
+
padding: 6px 8px;
|
|
260
|
+
background: none;
|
|
261
|
+
border: none;
|
|
262
|
+
border-radius: 6px;
|
|
263
|
+
color: #6b778c;
|
|
264
|
+
font-size: 13px;
|
|
265
|
+
cursor: pointer;
|
|
266
|
+
text-align: left;
|
|
267
|
+
transition: background 0.15s, color 0.15s;
|
|
268
|
+
}
|
|
269
|
+
.kanban-add-card-btn:hover {
|
|
270
|
+
background: #dfe1e6;
|
|
271
|
+
color: #172b4d;
|
|
272
|
+
}
|
|
273
|
+
.kanban-add-column {
|
|
274
|
+
flex: 0 0 280px;
|
|
275
|
+
}
|
|
276
|
+
.kanban-add-column-btn {
|
|
277
|
+
width: 100%;
|
|
278
|
+
padding: 10px;
|
|
279
|
+
background: rgba(0, 0, 0, 0.04);
|
|
280
|
+
border: 2px dashed #d0d4d9;
|
|
281
|
+
border-radius: 8px;
|
|
282
|
+
color: #6b778c;
|
|
283
|
+
font-size: 14px;
|
|
284
|
+
cursor: pointer;
|
|
285
|
+
transition: background 0.15s, border-color 0.15s, color 0.15s;
|
|
286
|
+
}
|
|
287
|
+
.kanban-add-column-btn:hover {
|
|
288
|
+
background: rgba(0, 0, 0, 0.08);
|
|
289
|
+
border-color: #a5adba;
|
|
290
|
+
color: #172b4d;
|
|
291
|
+
}
|
|
292
|
+
/* Scrollbar */
|
|
293
|
+
.kanban-column-body::-webkit-scrollbar {
|
|
294
|
+
width: 6px;
|
|
295
|
+
}
|
|
296
|
+
.kanban-column-body::-webkit-scrollbar-track {
|
|
297
|
+
background: transparent;
|
|
298
|
+
}
|
|
299
|
+
.kanban-column-body::-webkit-scrollbar-thumb {
|
|
300
|
+
background: #c1c7d0;
|
|
301
|
+
border-radius: 3px;
|
|
302
|
+
}
|
|
303
|
+
.kanban-column-body::-webkit-scrollbar-thumb:hover {
|
|
304
|
+
background: #a5adba;
|
|
305
|
+
}
|
|
306
|
+
/*# sourceMappingURL=src/styles/kanban.less.map */
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ***********************************
|
|
3
|
+
* @composy/kanban-core v0.0.1 *
|
|
4
|
+
* Built with rollup *
|
|
5
|
+
* Build time: 2024-08-17 11:33:25 *
|
|
6
|
+
* Build mode: production *
|
|
7
|
+
* Minified: No *
|
|
8
|
+
* ***********************************
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
11
|
+
/*! End of @composy/kanban-core | Powered by @composy/builder */
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @composy/kanban-core - Type Definitions
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* 标签
|
|
6
|
+
*/
|
|
7
|
+
export interface Label {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
color: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* 卡片
|
|
14
|
+
*/
|
|
15
|
+
export interface Card {
|
|
16
|
+
id: string;
|
|
17
|
+
title: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
labels?: Label[];
|
|
20
|
+
assignees?: string[];
|
|
21
|
+
dueDate?: string | Date;
|
|
22
|
+
priority?: 'low' | 'medium' | 'high' | 'urgent';
|
|
23
|
+
order: number;
|
|
24
|
+
columnId: string;
|
|
25
|
+
/** 自定义数据 */
|
|
26
|
+
data?: Record<string, unknown>;
|
|
27
|
+
/** 创建时间 */
|
|
28
|
+
createdAt?: string;
|
|
29
|
+
/** 更新时间 */
|
|
30
|
+
updatedAt?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* 列
|
|
34
|
+
*/
|
|
35
|
+
export interface Column {
|
|
36
|
+
id: string;
|
|
37
|
+
title: string;
|
|
38
|
+
cards: Card[];
|
|
39
|
+
/** WIP 限制(Work In Progress) */
|
|
40
|
+
wipLimit?: number;
|
|
41
|
+
/** 是否折叠 */
|
|
42
|
+
collapsed?: boolean;
|
|
43
|
+
/** 列颜色 */
|
|
44
|
+
color?: string;
|
|
45
|
+
/** 排序序号 */
|
|
46
|
+
order: number;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* 看板数据
|
|
50
|
+
*/
|
|
51
|
+
export interface Board {
|
|
52
|
+
id: string;
|
|
53
|
+
title: string;
|
|
54
|
+
columns: Column[];
|
|
55
|
+
labels?: Label[];
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* 看板配置项
|
|
59
|
+
*/
|
|
60
|
+
export interface KanbanOptions {
|
|
61
|
+
/** 容器元素或 CSS 选择器 */
|
|
62
|
+
container: HTMLElement | string;
|
|
63
|
+
/** 初始列数据 */
|
|
64
|
+
columns?: Partial<Column>[];
|
|
65
|
+
/** 初始标签 */
|
|
66
|
+
labels?: Label[];
|
|
67
|
+
/** 看板标题 */
|
|
68
|
+
title?: string;
|
|
69
|
+
/** 是否启用拖拽 */
|
|
70
|
+
draggable?: boolean;
|
|
71
|
+
/** 是否启用列拖拽 */
|
|
72
|
+
columnDraggable?: boolean;
|
|
73
|
+
/** 是否允许跨列拖拽 */
|
|
74
|
+
crossColumnDrag?: boolean;
|
|
75
|
+
/** 是否启用搜索 */
|
|
76
|
+
searchable?: boolean;
|
|
77
|
+
/** 是否显示添加卡片按钮 */
|
|
78
|
+
showAddCard?: boolean;
|
|
79
|
+
/** 是否显示添加列按钮 */
|
|
80
|
+
showAddColumn?: boolean;
|
|
81
|
+
/** 是否显示列头部操作菜单 */
|
|
82
|
+
showColumnActions?: boolean;
|
|
83
|
+
/** 是否显示卡片数量徽章 */
|
|
84
|
+
showCardCount?: boolean;
|
|
85
|
+
/** 调试模式 */
|
|
86
|
+
debug?: boolean;
|
|
87
|
+
/** 自定义 CSS 类名前缀 */
|
|
88
|
+
classPrefix?: string;
|
|
89
|
+
/** 卡片渲染器 */
|
|
90
|
+
cardRenderer?: (card: Card, element: HTMLElement) => void;
|
|
91
|
+
/** 列头部渲染器 */
|
|
92
|
+
columnHeaderRenderer?: (column: Column, element: HTMLElement) => void;
|
|
93
|
+
onCardAdd?: (card: Card, columnId: string) => void;
|
|
94
|
+
onCardRemove?: (card: Card, columnId: string) => void;
|
|
95
|
+
onCardMove?: (card: Card, fromColumnId: string, toColumnId: string, toIndex: number) => void;
|
|
96
|
+
onCardClick?: (card: Card) => void;
|
|
97
|
+
onCardUpdate?: (card: Card) => void;
|
|
98
|
+
onColumnAdd?: (column: Column) => void;
|
|
99
|
+
onColumnRemove?: (column: Column) => void;
|
|
100
|
+
onColumnMove?: (column: Column, fromIndex: number, toIndex: number) => void;
|
|
101
|
+
onColumnCollapse?: (column: Column, collapsed: boolean) => void;
|
|
102
|
+
onReady?: (instance: unknown) => void;
|
|
103
|
+
onDestroy?: () => void;
|
|
104
|
+
onError?: (error: Error) => void;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* 看板事件映射
|
|
108
|
+
*/
|
|
109
|
+
export interface KanbanEventMap {
|
|
110
|
+
'ready': {
|
|
111
|
+
instance: unknown;
|
|
112
|
+
};
|
|
113
|
+
'destroy': void;
|
|
114
|
+
'error': {
|
|
115
|
+
error: Error;
|
|
116
|
+
};
|
|
117
|
+
'card:add': {
|
|
118
|
+
card: Card;
|
|
119
|
+
columnId: string;
|
|
120
|
+
};
|
|
121
|
+
'card:remove': {
|
|
122
|
+
card: Card;
|
|
123
|
+
columnId: string;
|
|
124
|
+
};
|
|
125
|
+
'card:move': {
|
|
126
|
+
card: Card;
|
|
127
|
+
fromColumnId: string;
|
|
128
|
+
toColumnId: string;
|
|
129
|
+
toIndex: number;
|
|
130
|
+
};
|
|
131
|
+
'card:click': {
|
|
132
|
+
card: Card;
|
|
133
|
+
};
|
|
134
|
+
'card:update': {
|
|
135
|
+
card: Card;
|
|
136
|
+
changes: Partial<Card>;
|
|
137
|
+
};
|
|
138
|
+
'card:drag-start': {
|
|
139
|
+
card: Card;
|
|
140
|
+
};
|
|
141
|
+
'card:drag-end': {
|
|
142
|
+
card: Card;
|
|
143
|
+
};
|
|
144
|
+
'column:add': {
|
|
145
|
+
column: Column;
|
|
146
|
+
};
|
|
147
|
+
'column:remove': {
|
|
148
|
+
column: Column;
|
|
149
|
+
};
|
|
150
|
+
'column:move': {
|
|
151
|
+
column: Column;
|
|
152
|
+
fromIndex: number;
|
|
153
|
+
toIndex: number;
|
|
154
|
+
};
|
|
155
|
+
'column:collapse': {
|
|
156
|
+
column: Column;
|
|
157
|
+
collapsed: boolean;
|
|
158
|
+
};
|
|
159
|
+
'column:update': {
|
|
160
|
+
column: Column;
|
|
161
|
+
changes: Partial<Column>;
|
|
162
|
+
};
|
|
163
|
+
'filter:change': {
|
|
164
|
+
criteria: FilterCriteria;
|
|
165
|
+
};
|
|
166
|
+
'filter:clear': void;
|
|
167
|
+
'search:change': {
|
|
168
|
+
keyword: string;
|
|
169
|
+
};
|
|
170
|
+
'data:import': {
|
|
171
|
+
board: BoardData;
|
|
172
|
+
};
|
|
173
|
+
'data:export': {
|
|
174
|
+
board: BoardData;
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* 筛选条件
|
|
179
|
+
*/
|
|
180
|
+
export interface FilterCriteria {
|
|
181
|
+
/** 关键词搜索(匹配标题和描述) */
|
|
182
|
+
keyword?: string;
|
|
183
|
+
/** 按标签筛选 */
|
|
184
|
+
labelIds?: string[];
|
|
185
|
+
/** 按成员筛选 */
|
|
186
|
+
assignees?: string[];
|
|
187
|
+
/** 按优先级筛选 */
|
|
188
|
+
priorities?: Card['priority'][];
|
|
189
|
+
/** 按列筛选 */
|
|
190
|
+
columnIds?: string[];
|
|
191
|
+
/** 按截止日期范围筛选 */
|
|
192
|
+
dueDateRange?: {
|
|
193
|
+
start?: string;
|
|
194
|
+
end?: string;
|
|
195
|
+
};
|
|
196
|
+
/** 自定义筛选函数 */
|
|
197
|
+
custom?: (card: Card) => boolean;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* 看板导出数据格式
|
|
201
|
+
*/
|
|
202
|
+
export interface BoardData {
|
|
203
|
+
version: string;
|
|
204
|
+
title: string;
|
|
205
|
+
columns: Column[];
|
|
206
|
+
labels: Label[];
|
|
207
|
+
exportedAt: string;
|
|
208
|
+
}
|
|
209
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ***********************************
|
|
3
|
+
* @composy/kanban-core v0.0.1 *
|
|
4
|
+
* Built with rollup *
|
|
5
|
+
* Build time: 2024-08-17 11:33:25 *
|
|
6
|
+
* Build mode: production *
|
|
7
|
+
* Minified: No *
|
|
8
|
+
* ***********************************
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
11
|
+
//#region src/utils/dom.ts
|
|
12
|
+
function createElement(tag, className, attributes) {
|
|
13
|
+
const el = document.createElement(tag);
|
|
14
|
+
if (className) el.className = className;
|
|
15
|
+
if (attributes) Object.entries(attributes).forEach(([key, value]) => {
|
|
16
|
+
el.setAttribute(key, value);
|
|
17
|
+
});
|
|
18
|
+
return el;
|
|
19
|
+
}
|
|
20
|
+
function resolveElement(target) {
|
|
21
|
+
if (typeof target === "string") return document.querySelector(target);
|
|
22
|
+
return target;
|
|
23
|
+
}
|
|
24
|
+
function clearElement(el) {
|
|
25
|
+
el.innerHTML = "";
|
|
26
|
+
}
|
|
27
|
+
function removeElement(el) {
|
|
28
|
+
el?.parentNode?.removeChild(el);
|
|
29
|
+
}
|
|
30
|
+
function insertAt(parent, child, index) {
|
|
31
|
+
const ref = parent.children[index];
|
|
32
|
+
if (ref) parent.insertBefore(child, ref);
|
|
33
|
+
else parent.appendChild(child);
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
exports.clearElement = clearElement;
|
|
37
|
+
exports.createElement = createElement;
|
|
38
|
+
exports.insertAt = insertAt;
|
|
39
|
+
exports.removeElement = removeElement;
|
|
40
|
+
exports.resolveElement = resolveElement;
|
|
41
|
+
/*! End of @composy/kanban-core | Powered by @composy/builder */
|
|
42
|
+
//# sourceMappingURL=dom.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom.cjs","names":[],"sources":["../../src/utils/dom.ts"],"sourcesContent":["/**\n * DOM 工具函数\n */\n\n/**\n * 创建 DOM 元素\n */\nexport function createElement<K extends keyof HTMLElementTagNameMap>(\n tag: K,\n className?: string,\n attributes?: Record<string, string>,\n): HTMLElementTagNameMap[K] {\n const el = document.createElement(tag);\n if (className) el.className = className;\n if (attributes) {\n Object.entries(attributes).forEach(([key, value]) => {\n el.setAttribute(key, value);\n });\n }\n return el;\n}\n\n/**\n * 从选择器或元素获取 HTMLElement\n */\nexport function resolveElement(target: HTMLElement | string): HTMLElement | null {\n if (typeof target === 'string') {\n return document.querySelector(target);\n }\n return target;\n}\n\n/**\n * 清空元素内容\n */\nexport function clearElement(el: HTMLElement): void {\n el.innerHTML = '';\n}\n\n/**\n * 安全移除元素\n */\nexport function removeElement(el: HTMLElement | null): void {\n el?.parentNode?.removeChild(el);\n}\n\n/**\n * 插入元素到指定位置\n */\nexport function insertAt(parent: HTMLElement, child: HTMLElement, index: number): void {\n const ref = parent.children[index] as HTMLElement | undefined;\n if (ref) {\n parent.insertBefore(child, ref);\n } else {\n parent.appendChild(child);\n }\n}\n"],"mappings":";;;;;;;;;;;AAOO,SAAS,cACd,KACA,WACA,YAC0B;CAC1B,MAAM,KAAK,SAAS,cAAc,GAAG;CACrC,IAAI,WAAW,GAAG,YAAY;CAC9B,IAAI,YACF,OAAO,QAAQ,UAAU,CAAA,CAAE,SAAS,CAAC,KAAK,WAAW;EACnD,GAAG,aAAa,KAAK,KAAK;CAC5B,CAAC;CAEH,OAAO;AACT;AAKO,SAAS,eAAe,QAAkD;CAC/E,IAAI,OAAO,WAAW,UACpB,OAAO,SAAS,cAAc,MAAM;CAEtC,OAAO;AACT;AAKO,SAAS,aAAa,IAAuB;CAClD,GAAG,YAAY;AACjB;AAKO,SAAS,cAAc,IAA8B;CAC1D,IAAI,YAAY,YAAY,EAAE;AAChC;AAKO,SAAS,SAAS,QAAqB,OAAoB,OAAqB;CACrF,MAAM,MAAM,OAAO,SAAS;CAC5B,IAAI,KACF,OAAO,aAAa,OAAO,GAAG;MAE9B,OAAO,YAAY,KAAK;AAE5B"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOM 工具函数
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* 创建 DOM 元素
|
|
6
|
+
*/
|
|
7
|
+
export declare function createElement<K extends keyof HTMLElementTagNameMap>(tag: K, className?: string, attributes?: Record<string, string>): HTMLElementTagNameMap[K];
|
|
8
|
+
/**
|
|
9
|
+
* 从选择器或元素获取 HTMLElement
|
|
10
|
+
*/
|
|
11
|
+
export declare function resolveElement(target: HTMLElement | string): HTMLElement | null;
|
|
12
|
+
/**
|
|
13
|
+
* 清空元素内容
|
|
14
|
+
*/
|
|
15
|
+
export declare function clearElement(el: HTMLElement): void;
|
|
16
|
+
/**
|
|
17
|
+
* 安全移除元素
|
|
18
|
+
*/
|
|
19
|
+
export declare function removeElement(el: HTMLElement | null): void;
|
|
20
|
+
/**
|
|
21
|
+
* 插入元素到指定位置
|
|
22
|
+
*/
|
|
23
|
+
export declare function insertAt(parent: HTMLElement, child: HTMLElement, index: number): void;
|
|
24
|
+
//# sourceMappingURL=dom.d.ts.map
|
package/lib/utils/id.cjs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ***********************************
|
|
3
|
+
* @composy/kanban-core v0.0.1 *
|
|
4
|
+
* Built with rollup *
|
|
5
|
+
* Build time: 2024-08-17 11:33:25 *
|
|
6
|
+
* Build mode: production *
|
|
7
|
+
* Minified: No *
|
|
8
|
+
* ***********************************
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
11
|
+
//#region src/utils/id.ts
|
|
12
|
+
let counter = 0;
|
|
13
|
+
function generateId(prefix = "kb") {
|
|
14
|
+
counter++;
|
|
15
|
+
return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).substring(2, 6)}_${counter}`;
|
|
16
|
+
}
|
|
17
|
+
function resetIdCounter() {
|
|
18
|
+
counter = 0;
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
exports.generateId = generateId;
|
|
22
|
+
exports.resetIdCounter = resetIdCounter;
|
|
23
|
+
/*! End of @composy/kanban-core | Powered by @composy/builder */
|
|
24
|
+
//# sourceMappingURL=id.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"id.cjs","names":[],"sources":["../../src/utils/id.ts"],"sourcesContent":["let counter = 0;\n\n/**\n * 生成唯一 ID\n */\nexport function generateId(prefix = 'kb'): string {\n counter++;\n const timestamp = Date.now().toString(36);\n const random = Math.random().toString(36).substring(2, 6);\n return `${prefix}_${timestamp}_${random}_${counter}`;\n}\n\n/**\n * 重置计数器(仅测试用)\n */\nexport function resetIdCounter(): void {\n counter = 0;\n}\n"],"mappings":";;;;;;;;;;;AAAA,IAAI,UAAU;AAKP,SAAS,WAAW,SAAS,MAAc;CAChD;CAGA,OAAO,GAAG,OAAM,GAFE,KAAK,IAAI,CAAA,CAAE,SAAS,EAElB,EAAS,GADd,KAAK,OAAO,CAAA,CAAE,SAAS,EAAE,CAAA,CAAE,UAAU,GAAG,CACtB,EAAM,GAAI;AAC7C;AAKO,SAAS,iBAAuB;CACrC,UAAU;AACZ"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ***********************************
|
|
3
|
+
* @composy/kanban-core v0.0.1 *
|
|
4
|
+
* Built with rollup *
|
|
5
|
+
* Build time: 2024-08-17 11:33:25 *
|
|
6
|
+
* Build mode: production *
|
|
7
|
+
* Minified: No *
|
|
8
|
+
* ***********************************
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
11
|
+
const require_id = require("./id.cjs");
|
|
12
|
+
const require_dom = require("./dom.cjs");
|
|
13
|
+
//#region src/utils/index.ts
|
|
14
|
+
function getElement(target) {
|
|
15
|
+
if (typeof target === "string") return document.querySelector(target);
|
|
16
|
+
return target;
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
exports.clearElement = require_dom.clearElement;
|
|
20
|
+
exports.createElement = require_dom.createElement;
|
|
21
|
+
exports.generateId = require_id.generateId;
|
|
22
|
+
exports.getElement = getElement;
|
|
23
|
+
exports.insertAt = require_dom.insertAt;
|
|
24
|
+
exports.removeElement = require_dom.removeElement;
|
|
25
|
+
exports.resetIdCounter = require_id.resetIdCounter;
|
|
26
|
+
exports.resolveElement = require_dom.resolveElement;
|
|
27
|
+
/*! End of @composy/kanban-core | Powered by @composy/builder */
|
|
28
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../src/utils/index.ts"],"sourcesContent":["/**\n * @file index.ts\n * @description index 模块\n */\n\n/**\n * Utility functions for @composy/kanban-core\n */\n\nexport { generateId, resetIdCounter } from './id';\nexport { createElement, resolveElement, clearElement, removeElement, insertAt } from './dom';\n\n/**\n * Get element from selector or element\n * @deprecated Use resolveElement instead\n */\n/**\n * getElement 函数\n * @param target - 参数\n * @returns 返回值\n */\n/**\n * getElement - get Element function\n * @param target - 参数说明\n * @returns 返回值说明\n */\nexport function getElement(target: HTMLElement | string): HTMLElement | null {\n if (typeof target === 'string') {\n return document.querySelector(target);\n }\n return target;\n}\n"],"mappings":";;;;;;;;;;;;;AA0BO,SAAS,WAAW,QAAkD;CAC3E,IAAI,OAAO,WAAW,UACpB,OAAO,SAAS,cAAc,MAAM;CAEtC,OAAO;AACT"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file index.ts
|
|
3
|
+
* @description index 模块
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Utility functions for @composy/kanban-core
|
|
7
|
+
*/
|
|
8
|
+
export { generateId, resetIdCounter } from './id';
|
|
9
|
+
export { createElement, resolveElement, clearElement, removeElement, insertAt } from './dom';
|
|
10
|
+
/**
|
|
11
|
+
* Get element from selector or element
|
|
12
|
+
* @deprecated Use resolveElement instead
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* getElement 函数
|
|
16
|
+
* @param target - 参数
|
|
17
|
+
* @returns 返回值
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* getElement - get Element function
|
|
21
|
+
* @param target - 参数说明
|
|
22
|
+
* @returns 返回值说明
|
|
23
|
+
*/
|
|
24
|
+
export declare function getElement(target: HTMLElement | string): HTMLElement | null;
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|