@uzum-tech/ui 2.0.8 → 2.1.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/dist/index.js +1787 -467
- package/dist/index.mjs +1782 -468
- package/dist/index.prod.js +2 -2
- package/dist/index.prod.mjs +2 -2
- package/es/carousel/src/Carousel.d.ts +1 -1
- package/es/components.d.ts +655 -5
- package/es/components.mjs +5 -0
- package/es/config-provider/src/internal-interface.d.ts +3 -1
- package/es/data-table/src/DataTable.d.ts +1 -1
- package/es/descriptions/src/Descriptions.d.ts +1 -1
- package/es/kanban/index.d.ts +7 -0
- package/es/kanban/index.mjs +5 -0
- package/es/kanban/src/Kanban.d.ts +570 -0
- package/es/kanban/src/Kanban.mjs +349 -0
- package/es/kanban/src/KanbanCard.d.ts +39 -0
- package/es/kanban/src/KanbanCard.mjs +86 -0
- package/es/kanban/src/KanbanColumn.d.ts +45 -0
- package/es/kanban/src/KanbanColumn.mjs +176 -0
- package/es/kanban/src/injection.d.ts +28 -0
- package/es/kanban/src/injection.mjs +2 -0
- package/es/kanban/src/interface.d.ts +215 -0
- package/es/kanban/src/interface.mjs +84 -0
- package/es/kanban/src/styles/index.cssr.d.ts +2 -0
- package/es/kanban/src/styles/index.cssr.mjs +165 -0
- package/es/kanban/src/use-kanban-data.d.ts +4 -0
- package/es/kanban/src/use-kanban-data.mjs +69 -0
- package/es/kanban/src/use-kanban-drag.d.ts +2 -0
- package/es/kanban/src/use-kanban-drag.mjs +238 -0
- package/es/kanban/styles/dark.d.ts +73 -0
- package/es/kanban/styles/dark.mjs +15 -0
- package/es/kanban/styles/index.d.ts +3 -0
- package/es/kanban/styles/index.mjs +2 -0
- package/es/kanban/styles/light.d.ts +109 -0
- package/es/kanban/styles/light.mjs +64 -0
- package/es/modal/src/BodyWrapper.d.ts +1 -1
- package/es/themes/dark.mjs +2 -0
- package/es/themes/light.mjs +2 -0
- package/es/tree/src/Tree.d.ts +1 -1
- package/es/tree/src/TreeNode.d.ts +1 -1
- package/es/tree/src/TreeNode.mjs +2 -1
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/lib/carousel/src/Carousel.d.ts +1 -1
- package/lib/components.d.ts +655 -5
- package/lib/components.js +13 -5
- package/lib/config-provider/src/internal-interface.d.ts +3 -1
- package/lib/data-table/src/DataTable.d.ts +1 -1
- package/lib/descriptions/src/Descriptions.d.ts +1 -1
- package/lib/kanban/index.d.ts +7 -0
- package/lib/kanban/index.js +17 -0
- package/lib/kanban/src/Kanban.d.ts +570 -0
- package/lib/kanban/src/Kanban.js +291 -0
- package/lib/kanban/src/KanbanCard.d.ts +39 -0
- package/lib/kanban/src/KanbanCard.js +63 -0
- package/lib/kanban/src/KanbanColumn.d.ts +45 -0
- package/lib/kanban/src/KanbanColumn.js +141 -0
- package/lib/kanban/src/injection.d.ts +28 -0
- package/lib/kanban/src/injection.js +5 -0
- package/lib/kanban/src/interface.d.ts +215 -0
- package/lib/kanban/src/interface.js +87 -0
- package/lib/kanban/src/styles/index.cssr.d.ts +2 -0
- package/lib/kanban/src/styles/index.cssr.js +170 -0
- package/lib/kanban/src/use-kanban-data.d.ts +4 -0
- package/lib/kanban/src/use-kanban-data.js +70 -0
- package/lib/kanban/src/use-kanban-drag.d.ts +2 -0
- package/lib/kanban/src/use-kanban-drag.js +220 -0
- package/lib/kanban/styles/dark.d.ts +73 -0
- package/lib/kanban/styles/dark.js +17 -0
- package/lib/kanban/styles/index.d.ts +3 -0
- package/lib/kanban/styles/index.js +10 -0
- package/lib/kanban/styles/light.d.ts +109 -0
- package/lib/kanban/styles/light.js +54 -0
- package/lib/modal/src/BodyWrapper.d.ts +1 -1
- package/lib/themes/dark.js +98 -96
- package/lib/themes/light.js +96 -94
- package/lib/tree/src/Tree.d.ts +1 -1
- package/lib/tree/src/TreeNode.d.ts +1 -1
- package/lib/tree/src/TreeNode.js +2 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/volar.d.ts +3 -0
- package/web-types.json +171 -1
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const vue_1 = require("vue");
|
|
7
|
+
const _mixins_1 = require("../../_mixins");
|
|
8
|
+
const empty_1 = require("../../empty");
|
|
9
|
+
const styles_1 = require("../styles");
|
|
10
|
+
const injection_1 = require("./injection");
|
|
11
|
+
const interface_1 = require("./interface");
|
|
12
|
+
const KanbanColumn_1 = __importDefault(require("./KanbanColumn"));
|
|
13
|
+
const index_cssr_1 = __importDefault(require("./styles/index.cssr"));
|
|
14
|
+
const use_kanban_data_1 = require("./use-kanban-data");
|
|
15
|
+
const use_kanban_drag_1 = require("./use-kanban-drag");
|
|
16
|
+
exports.default = (0, vue_1.defineComponent)({
|
|
17
|
+
name: 'Kanban',
|
|
18
|
+
props: Object.assign(Object.assign({}, _mixins_1.useTheme.props), interface_1.kanbanProps),
|
|
19
|
+
emits: [
|
|
20
|
+
'update:data',
|
|
21
|
+
'move',
|
|
22
|
+
'columns-reorder',
|
|
23
|
+
'drag-start',
|
|
24
|
+
'drag-end',
|
|
25
|
+
'item-click',
|
|
26
|
+
'column-scroll-top',
|
|
27
|
+
'column-scroll-bottom',
|
|
28
|
+
'scroll-top',
|
|
29
|
+
'scroll-bottom'
|
|
30
|
+
],
|
|
31
|
+
setup(props, { emit, expose }) {
|
|
32
|
+
const { mergedClsPrefixRef, inlineThemeDisabled } = (0, _mixins_1.useConfig)(props);
|
|
33
|
+
const themeRef = (0, _mixins_1.useTheme)('Kanban', '-kanban', index_cssr_1.default, styles_1.kanbanLight, props, mergedClsPrefixRef);
|
|
34
|
+
const selfElRef = (0, vue_1.ref)(null);
|
|
35
|
+
const uncontrolledDataRef = (0, vue_1.ref)(props.data);
|
|
36
|
+
const uncontrolledColumnsRef = (0, vue_1.ref)(props.columns);
|
|
37
|
+
const mergedDataRef = (0, vue_1.computed)(() => uncontrolledDataRef.value);
|
|
38
|
+
const mergedColumnsRef = (0, vue_1.computed)(() => uncontrolledColumnsRef.value);
|
|
39
|
+
const columnFieldRef = (0, vue_1.computed)(() => props.columnField);
|
|
40
|
+
const orientationRef = (0, vue_1.computed)(() => props.orientation);
|
|
41
|
+
const allowDropRef = (0, vue_1.computed)(() => props.allowDrop);
|
|
42
|
+
const cssVarsRef = (0, vue_1.computed)(() => {
|
|
43
|
+
const { common: { cubicBezierEaseInOut }, self: { columnWidth, columnGap, cardGap, boardPadding, columnHeaderPadding, columnBodyPadding, columnBackgroundColor, columnBorderRadius, columnHeaderColor, countBackgroundColor, countTextColor, statusSuccessHeaderColor, statusSuccessCountColor, statusProgressHeaderColor, statusProgressCountColor, statusPendingHeaderColor, statusPendingCountColor, statusErrorHeaderColor, statusErrorCountColor, columnDraggingOpacity, cardBackgroundColor, cardBackgroundColorDragging, cardBorderColorDragging, cardBorderRadius, cardPadding, cardColor, cardSubColor, cardBoxShadow, cardBoxShadowHover, cardBoxShadowDragging, dropIndicatorColor, maxReachedColor } } = themeRef.value;
|
|
44
|
+
return {
|
|
45
|
+
'--u-bezier': cubicBezierEaseInOut,
|
|
46
|
+
'--u-column-width': columnWidth,
|
|
47
|
+
'--u-column-gap': columnGap,
|
|
48
|
+
'--u-card-gap': cardGap,
|
|
49
|
+
'--u-board-padding': boardPadding,
|
|
50
|
+
'--u-column-header-padding': columnHeaderPadding,
|
|
51
|
+
'--u-column-body-padding': columnBodyPadding,
|
|
52
|
+
'--u-column-background-color': columnBackgroundColor,
|
|
53
|
+
'--u-column-border-radius': columnBorderRadius,
|
|
54
|
+
'--u-column-header-color': columnHeaderColor,
|
|
55
|
+
'--u-count-background-color': countBackgroundColor,
|
|
56
|
+
'--u-count-text-color': countTextColor,
|
|
57
|
+
'--u-status-success-header-color': statusSuccessHeaderColor,
|
|
58
|
+
'--u-status-success-count-color': statusSuccessCountColor,
|
|
59
|
+
'--u-status-progress-header-color': statusProgressHeaderColor,
|
|
60
|
+
'--u-status-progress-count-color': statusProgressCountColor,
|
|
61
|
+
'--u-status-pending-header-color': statusPendingHeaderColor,
|
|
62
|
+
'--u-status-pending-count-color': statusPendingCountColor,
|
|
63
|
+
'--u-status-error-header-color': statusErrorHeaderColor,
|
|
64
|
+
'--u-status-error-count-color': statusErrorCountColor,
|
|
65
|
+
'--u-column-dragging-opacity': columnDraggingOpacity,
|
|
66
|
+
'--u-card-background-color': cardBackgroundColor,
|
|
67
|
+
'--u-card-background-color-dragging': cardBackgroundColorDragging,
|
|
68
|
+
'--u-card-border-color-dragging': cardBorderColorDragging,
|
|
69
|
+
'--u-card-border-radius': cardBorderRadius,
|
|
70
|
+
'--u-card-padding': cardPadding,
|
|
71
|
+
'--u-card-color': cardColor,
|
|
72
|
+
'--u-card-sub-color': cardSubColor,
|
|
73
|
+
'--u-card-box-shadow': cardBoxShadow,
|
|
74
|
+
'--u-card-box-shadow-hover': cardBoxShadowHover,
|
|
75
|
+
'--u-card-box-shadow-dragging': cardBoxShadowDragging,
|
|
76
|
+
'--u-drop-indicator-color': dropIndicatorColor,
|
|
77
|
+
'--u-max-reached-color': maxReachedColor
|
|
78
|
+
};
|
|
79
|
+
});
|
|
80
|
+
const drag = (0, use_kanban_drag_1.useKanbanDrag)({
|
|
81
|
+
dataRef: mergedDataRef,
|
|
82
|
+
columnsRef: mergedColumnsRef,
|
|
83
|
+
columnFieldRef,
|
|
84
|
+
orientationRef,
|
|
85
|
+
getItemKey,
|
|
86
|
+
isItemDraggable,
|
|
87
|
+
isColumnDraggable,
|
|
88
|
+
allowDropRef,
|
|
89
|
+
emitUpdateData: doUpdateData,
|
|
90
|
+
emitMove,
|
|
91
|
+
emitColumnsReorder,
|
|
92
|
+
emitDragStart,
|
|
93
|
+
emitDragEnd
|
|
94
|
+
});
|
|
95
|
+
const themeClassHandle = inlineThemeDisabled
|
|
96
|
+
? (0, _mixins_1.useThemeClass)('kanban', undefined, cssVarsRef, props)
|
|
97
|
+
: undefined;
|
|
98
|
+
const handleItemClick = (item, column) => {
|
|
99
|
+
var _a;
|
|
100
|
+
(_a = props.onItemClick) === null || _a === void 0 ? void 0 : _a.call(props, item, column);
|
|
101
|
+
emit('item-click', item, column);
|
|
102
|
+
};
|
|
103
|
+
const buildScrollContext = (target, column) => ({
|
|
104
|
+
column,
|
|
105
|
+
scrollTop: target.scrollTop,
|
|
106
|
+
scrollHeight: target.scrollHeight,
|
|
107
|
+
clientHeight: target.clientHeight
|
|
108
|
+
});
|
|
109
|
+
const handleColumnScroll = (column, target) => {
|
|
110
|
+
var _a, _b;
|
|
111
|
+
const { scrollTop, scrollHeight, clientHeight } = target;
|
|
112
|
+
const threshold = props.scrollThreshold;
|
|
113
|
+
const ctx = buildScrollContext(target, column.key);
|
|
114
|
+
if (scrollTop <= threshold) {
|
|
115
|
+
(_a = props.onColumnScrollTop) === null || _a === void 0 ? void 0 : _a.call(props, ctx);
|
|
116
|
+
emit('column-scroll-top', ctx);
|
|
117
|
+
}
|
|
118
|
+
if (scrollHeight - scrollTop - clientHeight <= threshold) {
|
|
119
|
+
(_b = props.onColumnScrollBottom) === null || _b === void 0 ? void 0 : _b.call(props, ctx);
|
|
120
|
+
emit('column-scroll-bottom', ctx);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
const handleBoardScroll = (event) => {
|
|
124
|
+
var _a, _b;
|
|
125
|
+
const target = event.target;
|
|
126
|
+
const { scrollTop, scrollHeight, clientHeight } = target;
|
|
127
|
+
const threshold = props.scrollThreshold;
|
|
128
|
+
const ctx = buildScrollContext(target);
|
|
129
|
+
if (scrollTop <= threshold) {
|
|
130
|
+
(_a = props.onScrollTop) === null || _a === void 0 ? void 0 : _a.call(props, ctx);
|
|
131
|
+
emit('scroll-top', ctx);
|
|
132
|
+
}
|
|
133
|
+
if (scrollHeight - scrollTop - clientHeight <= threshold) {
|
|
134
|
+
(_b = props.onScrollBottom) === null || _b === void 0 ? void 0 : _b.call(props, ctx);
|
|
135
|
+
emit('scroll-bottom', ctx);
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
const findColumnEl = (columnKey) => {
|
|
139
|
+
if (!selfElRef.value) {
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
return selfElRef.value.querySelector(`[data-kanban-column-key="${String(columnKey)}"]`);
|
|
143
|
+
};
|
|
144
|
+
const exposed = {
|
|
145
|
+
moveItem(key, to) {
|
|
146
|
+
var _a;
|
|
147
|
+
const result = (0, use_kanban_data_1.moveItem)(mergedDataRef.value, getItemKey, columnFieldRef.value, key, to.column, (_a = to.index) !== null && _a !== void 0 ? _a : Number.MAX_SAFE_INTEGER);
|
|
148
|
+
if (result) {
|
|
149
|
+
doUpdateData(result.data);
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
addItem(item, index) {
|
|
153
|
+
const next = mergedDataRef.value.slice();
|
|
154
|
+
next.splice(index !== null && index !== void 0 ? index : next.length, 0, item);
|
|
155
|
+
doUpdateData(next);
|
|
156
|
+
},
|
|
157
|
+
removeItem(key) {
|
|
158
|
+
doUpdateData(mergedDataRef.value.filter(item => getItemKey(item) !== key));
|
|
159
|
+
},
|
|
160
|
+
scrollToColumn(columnKey) {
|
|
161
|
+
var _a;
|
|
162
|
+
(_a = findColumnEl(columnKey)) === null || _a === void 0 ? void 0 : _a.scrollIntoView({
|
|
163
|
+
behavior: 'smooth',
|
|
164
|
+
inline: 'nearest',
|
|
165
|
+
block: 'nearest'
|
|
166
|
+
});
|
|
167
|
+
},
|
|
168
|
+
scrollColumnToBottom(columnKey) {
|
|
169
|
+
var _a;
|
|
170
|
+
const body = (_a = findColumnEl(columnKey)) === null || _a === void 0 ? void 0 : _a.querySelector(`.${mergedClsPrefixRef.value}-kanban-column__body`);
|
|
171
|
+
if (body) {
|
|
172
|
+
body.scrollTop = body.scrollHeight;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
expose(exposed);
|
|
177
|
+
function getItemKey(item) {
|
|
178
|
+
const { itemKey } = props;
|
|
179
|
+
if (typeof itemKey === 'function') {
|
|
180
|
+
return itemKey(item);
|
|
181
|
+
}
|
|
182
|
+
return item[itemKey];
|
|
183
|
+
}
|
|
184
|
+
function isItemDraggable(item, column) {
|
|
185
|
+
return (props.draggable && !props.disabled && !item.disabled && !column.frozen);
|
|
186
|
+
}
|
|
187
|
+
function isColumnDraggable(column) {
|
|
188
|
+
return props.columnsDraggable && !props.disabled && !column.disabled;
|
|
189
|
+
}
|
|
190
|
+
function doUpdateData(next) {
|
|
191
|
+
uncontrolledDataRef.value = next;
|
|
192
|
+
emit('update:data', next);
|
|
193
|
+
}
|
|
194
|
+
function doUpdateColumns(next) {
|
|
195
|
+
uncontrolledColumnsRef.value = next;
|
|
196
|
+
}
|
|
197
|
+
function emitMove(ctx) {
|
|
198
|
+
var _a;
|
|
199
|
+
(_a = props.onMove) === null || _a === void 0 ? void 0 : _a.call(props, ctx);
|
|
200
|
+
emit('move', ctx);
|
|
201
|
+
}
|
|
202
|
+
function emitColumnsReorder(columns) {
|
|
203
|
+
var _a;
|
|
204
|
+
doUpdateColumns(columns);
|
|
205
|
+
(_a = props.onColumnsReorder) === null || _a === void 0 ? void 0 : _a.call(props, columns);
|
|
206
|
+
emit('columns-reorder', columns);
|
|
207
|
+
}
|
|
208
|
+
function emitDragStart(ctx) {
|
|
209
|
+
var _a;
|
|
210
|
+
(_a = props.onDragStart) === null || _a === void 0 ? void 0 : _a.call(props, ctx);
|
|
211
|
+
emit('drag-start', ctx);
|
|
212
|
+
}
|
|
213
|
+
function emitDragEnd(ctx) {
|
|
214
|
+
var _a;
|
|
215
|
+
(_a = props.onDragEnd) === null || _a === void 0 ? void 0 : _a.call(props, ctx);
|
|
216
|
+
emit('drag-end', ctx);
|
|
217
|
+
}
|
|
218
|
+
(0, vue_1.provide)(injection_1.kanbanInjectionKey, {
|
|
219
|
+
mergedClsPrefixRef,
|
|
220
|
+
mergedThemeRef: themeRef,
|
|
221
|
+
propsRef: props,
|
|
222
|
+
getItemKey,
|
|
223
|
+
draggingItemKeySetRef: drag.draggingItemKeySetRef,
|
|
224
|
+
draggingItemRef: drag.draggingItemRef,
|
|
225
|
+
draggingColumnKeyRef: drag.draggingColumnKeyRef,
|
|
226
|
+
droppingColumnKeyRef: drag.droppingColumnKeyRef,
|
|
227
|
+
droppingItemKeyRef: drag.droppingItemKeyRef,
|
|
228
|
+
droppingPositionRef: drag.droppingPositionRef,
|
|
229
|
+
handleItemDragStart: drag.handleItemDragStart,
|
|
230
|
+
handleItemDragOver: drag.handleItemDragOver,
|
|
231
|
+
handleItemDrop: drag.handleItemDrop,
|
|
232
|
+
handleColumnDragStart: drag.handleColumnDragStart,
|
|
233
|
+
handleColumnDragOver: drag.handleColumnDragOver,
|
|
234
|
+
handleColumnDrop: drag.handleColumnDrop,
|
|
235
|
+
handleDragEnd: drag.handleDragEnd,
|
|
236
|
+
handleItemClick,
|
|
237
|
+
handleColumnScroll,
|
|
238
|
+
isItemDraggable,
|
|
239
|
+
isColumnDraggable
|
|
240
|
+
});
|
|
241
|
+
(0, vue_1.watch)(() => props.data, (value) => {
|
|
242
|
+
uncontrolledDataRef.value = value;
|
|
243
|
+
});
|
|
244
|
+
(0, vue_1.watch)(() => props.columns, (value) => {
|
|
245
|
+
uncontrolledColumnsRef.value = value;
|
|
246
|
+
});
|
|
247
|
+
return {
|
|
248
|
+
selfElRef,
|
|
249
|
+
mergedClsPrefix: mergedClsPrefixRef,
|
|
250
|
+
mergedColumns: mergedColumnsRef,
|
|
251
|
+
mergedData: mergedDataRef,
|
|
252
|
+
columnFieldValue: columnFieldRef,
|
|
253
|
+
handleBoardScroll,
|
|
254
|
+
cssVars: inlineThemeDisabled ? undefined : cssVarsRef,
|
|
255
|
+
themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass,
|
|
256
|
+
onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender
|
|
257
|
+
};
|
|
258
|
+
},
|
|
259
|
+
render() {
|
|
260
|
+
var _a;
|
|
261
|
+
const { mergedClsPrefix, mergedColumns, mergedData, columnFieldValue, orientation, scrollMode, loading, emptyProps, $slots } = this;
|
|
262
|
+
(_a = this.onRender) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
263
|
+
const grouped = (0, use_kanban_data_1.groupItemsByColumn)(mergedColumns, mergedData, columnFieldValue);
|
|
264
|
+
const isEmpty = !mergedColumns.length;
|
|
265
|
+
return ((0, vue_1.h)("div", { ref: "selfElRef", class: [`${mergedClsPrefix}-kanban`, this.themeClass], style: this.cssVars }, isEmpty ? ((0, vue_1.h)("div", { class: `${mergedClsPrefix}-kanban__empty` }, $slots.empty ? ($slots.empty()) : ((0, vue_1.h)(empty_1.UEmpty, Object.assign({ size: "large" }, emptyProps))))) : ((0, vue_1.h)("div", { class: [
|
|
266
|
+
`${mergedClsPrefix}-kanban__board`,
|
|
267
|
+
{
|
|
268
|
+
[`${mergedClsPrefix}-kanban__board--vertical`]: orientation === 'vertical',
|
|
269
|
+
[`${mergedClsPrefix}-kanban__board--scroll-board`]: scrollMode === 'board'
|
|
270
|
+
}
|
|
271
|
+
], "aria-busy": loading || undefined, onScroll: scrollMode === 'board' ? this.handleBoardScroll : undefined },
|
|
272
|
+
(0, vue_1.h)("div", { class: [
|
|
273
|
+
`${mergedClsPrefix}-kanban__board-track`,
|
|
274
|
+
{
|
|
275
|
+
[`${mergedClsPrefix}-kanban__board-track--vertical`]: orientation === 'vertical'
|
|
276
|
+
}
|
|
277
|
+
] }, mergedColumns.map((column, index) => {
|
|
278
|
+
var _a, _b;
|
|
279
|
+
return $slots.column ? ($slots.column({
|
|
280
|
+
column,
|
|
281
|
+
items: (_a = grouped.get(column.key)) !== null && _a !== void 0 ? _a : [],
|
|
282
|
+
index
|
|
283
|
+
})) : ((0, vue_1.h)(KanbanColumn_1.default, { key: column.key, column: column, items: (_b = grouped.get(column.key)) !== null && _b !== void 0 ? _b : [], index: index }, {
|
|
284
|
+
columnHeader: $slots.columnHeader,
|
|
285
|
+
columnFooter: $slots.columnFooter,
|
|
286
|
+
columnEmpty: $slots.columnEmpty,
|
|
287
|
+
card: $slots.card
|
|
288
|
+
}));
|
|
289
|
+
}))))));
|
|
290
|
+
}
|
|
291
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
|
+
readonly item: {
|
|
3
|
+
readonly type: import("vue").PropType<import("./interface").KanbanItem>;
|
|
4
|
+
readonly required: true;
|
|
5
|
+
};
|
|
6
|
+
readonly column: {
|
|
7
|
+
readonly type: import("vue").PropType<import("./interface").KanbanColumn>;
|
|
8
|
+
readonly required: true;
|
|
9
|
+
};
|
|
10
|
+
readonly index: {
|
|
11
|
+
readonly type: NumberConstructor;
|
|
12
|
+
readonly default: 0;
|
|
13
|
+
};
|
|
14
|
+
readonly ghost: BooleanConstructor;
|
|
15
|
+
}>, {
|
|
16
|
+
injection: import("./injection").KanbanInjection;
|
|
17
|
+
mergedClsPrefix: import("vue").Ref<string, string>;
|
|
18
|
+
draggable: import("vue").ComputedRef<boolean>;
|
|
19
|
+
dragging: import("vue").ComputedRef<boolean>;
|
|
20
|
+
clickable: import("vue").ComputedRef<boolean>;
|
|
21
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
22
|
+
readonly item: {
|
|
23
|
+
readonly type: import("vue").PropType<import("./interface").KanbanItem>;
|
|
24
|
+
readonly required: true;
|
|
25
|
+
};
|
|
26
|
+
readonly column: {
|
|
27
|
+
readonly type: import("vue").PropType<import("./interface").KanbanColumn>;
|
|
28
|
+
readonly required: true;
|
|
29
|
+
};
|
|
30
|
+
readonly index: {
|
|
31
|
+
readonly type: NumberConstructor;
|
|
32
|
+
readonly default: 0;
|
|
33
|
+
};
|
|
34
|
+
readonly ghost: BooleanConstructor;
|
|
35
|
+
}>> & Readonly<{}>, {
|
|
36
|
+
readonly ghost: boolean;
|
|
37
|
+
readonly index: number;
|
|
38
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
39
|
+
export default _default;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vue_1 = require("vue");
|
|
4
|
+
const _utils_1 = require("../../_utils");
|
|
5
|
+
const injection_1 = require("./injection");
|
|
6
|
+
const interface_1 = require("./interface");
|
|
7
|
+
exports.default = (0, vue_1.defineComponent)({
|
|
8
|
+
name: 'KanbanCard',
|
|
9
|
+
props: interface_1.kanbanCardProps,
|
|
10
|
+
setup(props) {
|
|
11
|
+
const injection = (0, vue_1.inject)(injection_1.kanbanInjectionKey, null);
|
|
12
|
+
if (!injection) {
|
|
13
|
+
(0, _utils_1.warn)('kanban', '`UKanbanCard` must be used inside `UKanban`.');
|
|
14
|
+
}
|
|
15
|
+
const { mergedClsPrefixRef, getItemKey, draggingItemKeySetRef, isItemDraggable, propsRef } = injection;
|
|
16
|
+
const itemKeyRef = (0, vue_1.computed)(() => getItemKey(props.item));
|
|
17
|
+
const draggableRef = (0, vue_1.computed)(() => isItemDraggable(props.item, props.column));
|
|
18
|
+
const draggingRef = (0, vue_1.computed)(() => draggingItemKeySetRef.value.has(itemKeyRef.value));
|
|
19
|
+
const clickableRef = (0, vue_1.computed)(() => !!propsRef.onItemClick && !props.item.disabled);
|
|
20
|
+
return {
|
|
21
|
+
injection,
|
|
22
|
+
mergedClsPrefix: mergedClsPrefixRef,
|
|
23
|
+
draggable: draggableRef,
|
|
24
|
+
dragging: draggingRef,
|
|
25
|
+
clickable: clickableRef
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
render() {
|
|
29
|
+
var _a;
|
|
30
|
+
const { mergedClsPrefix, item, column, ghost, dragging, draggable, clickable, injection, $slots } = this;
|
|
31
|
+
let body;
|
|
32
|
+
if ($slots.card) {
|
|
33
|
+
body = $slots.card({ item, column, dragging: dragging || ghost });
|
|
34
|
+
}
|
|
35
|
+
else if (item.render) {
|
|
36
|
+
body = item.render(item, column);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
body = [
|
|
40
|
+
(0, vue_1.h)("div", { class: `${mergedClsPrefix}-kanban-card__title` }, (_a = (0, _utils_1.render)(item.title)) !== null && _a !== void 0 ? _a : item.name),
|
|
41
|
+
item.description ? ((0, vue_1.h)("div", { class: `${mergedClsPrefix}-kanban-card__description` }, (0, _utils_1.render)(item.description))) : null
|
|
42
|
+
];
|
|
43
|
+
}
|
|
44
|
+
if (ghost) {
|
|
45
|
+
return ((0, vue_1.h)("div", { class: [
|
|
46
|
+
`${mergedClsPrefix}-kanban-card`,
|
|
47
|
+
`${mergedClsPrefix}-kanban-card--ghost`
|
|
48
|
+
], "aria-hidden": "true" }, body));
|
|
49
|
+
}
|
|
50
|
+
return ((0, vue_1.h)("div", Object.assign({ class: [
|
|
51
|
+
`${mergedClsPrefix}-kanban-card`,
|
|
52
|
+
{
|
|
53
|
+
[`${mergedClsPrefix}-kanban-card--dragging`]: dragging,
|
|
54
|
+
[`${mergedClsPrefix}-kanban-card--disabled`]: item.disabled,
|
|
55
|
+
[`${mergedClsPrefix}-kanban-card--clickable`]: clickable
|
|
56
|
+
}
|
|
57
|
+
], "data-kanban-card-key": String(injection.getItemKey(item)), draggable: draggable || undefined, onDragstart: (event) => injection.handleItemDragStart(event, item), onDragover: (event) => injection.handleItemDragOver(event, item), onDrop: (event) => injection.handleItemDrop(event, item), onDragend: () => injection.handleDragEnd(), onClick: () => {
|
|
58
|
+
if (clickable) {
|
|
59
|
+
injection.handleItemClick(item, column);
|
|
60
|
+
}
|
|
61
|
+
} }, injection.propsRef.cardProps), body));
|
|
62
|
+
}
|
|
63
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { CSSProperties } from 'vue';
|
|
2
|
+
import type { KanbanDropPosition, KanbanItem } from './interface';
|
|
3
|
+
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
|
+
readonly column: {
|
|
5
|
+
readonly type: import("vue").PropType<import("./interface").KanbanColumn>;
|
|
6
|
+
readonly required: true;
|
|
7
|
+
};
|
|
8
|
+
readonly items: {
|
|
9
|
+
readonly type: import("vue").PropType<KanbanItem[]>;
|
|
10
|
+
readonly default: () => never[];
|
|
11
|
+
};
|
|
12
|
+
readonly index: {
|
|
13
|
+
readonly type: NumberConstructor;
|
|
14
|
+
readonly default: 0;
|
|
15
|
+
};
|
|
16
|
+
}>, {
|
|
17
|
+
injection: import("./injection").KanbanInjection;
|
|
18
|
+
mergedClsPrefix: import("vue").Ref<string, string>;
|
|
19
|
+
columnDraggable: import("vue").ComputedRef<boolean>;
|
|
20
|
+
dragging: import("vue").ComputedRef<boolean>;
|
|
21
|
+
columnDropPosition: import("vue").ComputedRef<KanbanDropPosition | null>;
|
|
22
|
+
vertical: import("vue").ComputedRef<boolean>;
|
|
23
|
+
boardScroll: import("vue").ComputedRef<boolean>;
|
|
24
|
+
maxReached: import("vue").ComputedRef<boolean>;
|
|
25
|
+
columnStyle: import("vue").ComputedRef<CSSProperties | undefined>;
|
|
26
|
+
countStyle: import("vue").ComputedRef<CSSProperties | undefined>;
|
|
27
|
+
handleBodyScroll: (event: Event) => void;
|
|
28
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
29
|
+
readonly column: {
|
|
30
|
+
readonly type: import("vue").PropType<import("./interface").KanbanColumn>;
|
|
31
|
+
readonly required: true;
|
|
32
|
+
};
|
|
33
|
+
readonly items: {
|
|
34
|
+
readonly type: import("vue").PropType<KanbanItem[]>;
|
|
35
|
+
readonly default: () => never[];
|
|
36
|
+
};
|
|
37
|
+
readonly index: {
|
|
38
|
+
readonly type: NumberConstructor;
|
|
39
|
+
readonly default: 0;
|
|
40
|
+
};
|
|
41
|
+
}>> & Readonly<{}>, {
|
|
42
|
+
readonly items: KanbanItem[];
|
|
43
|
+
readonly index: number;
|
|
44
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
45
|
+
export default _default;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const vue_1 = require("vue");
|
|
7
|
+
const _utils_1 = require("../../_utils");
|
|
8
|
+
const empty_1 = require("../../empty");
|
|
9
|
+
const injection_1 = require("./injection");
|
|
10
|
+
const interface_1 = require("./interface");
|
|
11
|
+
const KanbanCard_1 = __importDefault(require("./KanbanCard"));
|
|
12
|
+
exports.default = (0, vue_1.defineComponent)({
|
|
13
|
+
name: 'KanbanColumn',
|
|
14
|
+
props: interface_1.kanbanColumnProps,
|
|
15
|
+
setup(props) {
|
|
16
|
+
const injection = (0, vue_1.inject)(injection_1.kanbanInjectionKey, null);
|
|
17
|
+
if (!injection) {
|
|
18
|
+
(0, _utils_1.warn)('kanban', '`UKanbanColumn` must be used inside `UKanban`.');
|
|
19
|
+
}
|
|
20
|
+
const { mergedClsPrefixRef, draggingColumnKeyRef, droppingColumnKeyRef, droppingPositionRef, isColumnDraggable, propsRef } = injection;
|
|
21
|
+
const columnDraggableRef = (0, vue_1.computed)(() => isColumnDraggable(props.column));
|
|
22
|
+
const draggingRef = (0, vue_1.computed)(() => draggingColumnKeyRef.value === props.column.key);
|
|
23
|
+
const columnDropPositionRef = (0, vue_1.computed)(() => draggingColumnKeyRef.value != null
|
|
24
|
+
&& droppingColumnKeyRef.value === props.column.key
|
|
25
|
+
? droppingPositionRef.value
|
|
26
|
+
: null);
|
|
27
|
+
const verticalRef = (0, vue_1.computed)(() => propsRef.orientation === 'vertical');
|
|
28
|
+
const boardScrollRef = (0, vue_1.computed)(() => propsRef.scrollMode === 'board');
|
|
29
|
+
const maxReachedRef = (0, vue_1.computed)(() => typeof props.column.max === 'number'
|
|
30
|
+
&& props.items.length >= props.column.max);
|
|
31
|
+
const statusRef = (0, vue_1.computed)(() => {
|
|
32
|
+
const status = props.column.status;
|
|
33
|
+
return status && status !== 'neutral' ? status : null;
|
|
34
|
+
});
|
|
35
|
+
const columnStyleRef = (0, vue_1.computed)(() => statusRef.value
|
|
36
|
+
? { backgroundColor: `var(--u-status-${statusRef.value}-header-color)` }
|
|
37
|
+
: undefined);
|
|
38
|
+
const countStyleRef = (0, vue_1.computed)(() => statusRef.value && !maxReachedRef.value
|
|
39
|
+
? { backgroundColor: `var(--u-status-${statusRef.value}-count-color)` }
|
|
40
|
+
: undefined);
|
|
41
|
+
function handleBodyScroll(event) {
|
|
42
|
+
injection.handleColumnScroll(props.column, event.target);
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
injection,
|
|
46
|
+
mergedClsPrefix: mergedClsPrefixRef,
|
|
47
|
+
columnDraggable: columnDraggableRef,
|
|
48
|
+
dragging: draggingRef,
|
|
49
|
+
columnDropPosition: columnDropPositionRef,
|
|
50
|
+
vertical: verticalRef,
|
|
51
|
+
boardScroll: boardScrollRef,
|
|
52
|
+
maxReached: maxReachedRef,
|
|
53
|
+
columnStyle: columnStyleRef,
|
|
54
|
+
countStyle: countStyleRef,
|
|
55
|
+
handleBodyScroll
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
render() {
|
|
59
|
+
var _a;
|
|
60
|
+
const { mergedClsPrefix, column, items, injection, columnDraggable, dragging, columnDropPosition, vertical, boardScroll, maxReached, columnStyle, countStyle, $slots } = this;
|
|
61
|
+
const count = items.length;
|
|
62
|
+
const emptyText = injection.propsRef.columnEmptyText;
|
|
63
|
+
const getItemKey = injection.getItemKey;
|
|
64
|
+
const draggingItem = injection.draggingItemRef.value;
|
|
65
|
+
const draggingKey = draggingItem ? getItemKey(draggingItem) : null;
|
|
66
|
+
const columnField = (_a = injection.propsRef.columnField) !== null && _a !== void 0 ? _a : 'column';
|
|
67
|
+
const sourceColumnKey = draggingItem ? draggingItem[columnField] : null;
|
|
68
|
+
const dropColumnKey = injection.droppingColumnKeyRef.value;
|
|
69
|
+
const dropKey = injection.droppingItemKeyRef.value;
|
|
70
|
+
const dropPosition = injection.droppingPositionRef.value;
|
|
71
|
+
const isTarget = !!draggingItem && dropColumnKey === column.key && !column.frozen;
|
|
72
|
+
const isSameColumnReorder = !!draggingItem && sourceColumnKey === dropColumnKey;
|
|
73
|
+
const renderCard = (item) => ((0, vue_1.h)(KanbanCard_1.default, { key: getItemKey(item), item: item, column: column }, { card: $slots.card }));
|
|
74
|
+
const renderGhost = () => ((0, vue_1.h)(KanbanCard_1.default, { key: "__kanban-ghost__", ghost: true, item: draggingItem, column: column }, { card: $slots.card }));
|
|
75
|
+
let cardNodes = [];
|
|
76
|
+
if (draggingItem && isSameColumnReorder && sourceColumnKey === column.key) {
|
|
77
|
+
const rest = items.filter(item => getItemKey(item) !== draggingKey);
|
|
78
|
+
let insertAt = rest.length;
|
|
79
|
+
if (dropKey != null) {
|
|
80
|
+
const anchor = rest.findIndex(item => getItemKey(item) === dropKey);
|
|
81
|
+
if (anchor >= 0) {
|
|
82
|
+
insertAt = dropPosition === 'after' ? anchor + 1 : anchor;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
const preview = rest.slice();
|
|
86
|
+
preview.splice(insertAt, 0, draggingItem);
|
|
87
|
+
cardNodes = preview.map(renderCard);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
items.forEach((item) => {
|
|
91
|
+
const key = getItemKey(item);
|
|
92
|
+
if (isTarget && dropKey === key && dropPosition === 'before') {
|
|
93
|
+
cardNodes.push(renderGhost());
|
|
94
|
+
}
|
|
95
|
+
cardNodes.push(renderCard(item));
|
|
96
|
+
if (isTarget && dropKey === key && dropPosition === 'after') {
|
|
97
|
+
cardNodes.push(renderGhost());
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
if (isTarget && dropKey == null) {
|
|
101
|
+
cardNodes.push(renderGhost());
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
const hasBodyContent = cardNodes.length > 0;
|
|
105
|
+
return ((0, vue_1.h)("div", { class: [
|
|
106
|
+
`${mergedClsPrefix}-kanban-column`,
|
|
107
|
+
{
|
|
108
|
+
[`${mergedClsPrefix}-kanban-column--vertical`]: vertical,
|
|
109
|
+
[`${mergedClsPrefix}-kanban-column--board-scroll`]: boardScroll,
|
|
110
|
+
[`${mergedClsPrefix}-kanban-column--dragging`]: dragging,
|
|
111
|
+
[`${mergedClsPrefix}-kanban-column--drop-before`]: columnDropPosition === 'before',
|
|
112
|
+
[`${mergedClsPrefix}-kanban-column--drop-after`]: columnDropPosition === 'after'
|
|
113
|
+
}
|
|
114
|
+
], style: columnStyle, "data-kanban-column-key": String(column.key), onDragover: (event) => injection.handleColumnDragOver(event, column), onDrop: (event) => injection.handleColumnDrop(event, column) },
|
|
115
|
+
(0, vue_1.h)("div", { class: [
|
|
116
|
+
`${mergedClsPrefix}-kanban-column__header`,
|
|
117
|
+
{
|
|
118
|
+
[`${mergedClsPrefix}-kanban-column__header--draggable`]: columnDraggable
|
|
119
|
+
}
|
|
120
|
+
], draggable: columnDraggable || undefined, onDragstart: (event) => injection.handleColumnDragStart(event, column), onDragend: () => injection.handleDragEnd() }, $slots.columnHeader
|
|
121
|
+
? $slots.columnHeader({ column, count })
|
|
122
|
+
: [
|
|
123
|
+
(0, vue_1.h)("span", { class: `${mergedClsPrefix}-kanban-column__title` }, (0, _utils_1.render)(column.title)),
|
|
124
|
+
(0, vue_1.h)("span", { class: [
|
|
125
|
+
`${mergedClsPrefix}-kanban-column__count`,
|
|
126
|
+
{
|
|
127
|
+
[`${mergedClsPrefix}-kanban-column__count--max-reached`]: maxReached
|
|
128
|
+
}
|
|
129
|
+
], style: countStyle }, typeof column.max === 'number'
|
|
130
|
+
? `${count}/${column.max}`
|
|
131
|
+
: count)
|
|
132
|
+
]),
|
|
133
|
+
(0, vue_1.h)("div", { class: [
|
|
134
|
+
`${mergedClsPrefix}-kanban-column__body`,
|
|
135
|
+
{
|
|
136
|
+
[`${mergedClsPrefix}-kanban-column__body--board-scroll`]: boardScroll
|
|
137
|
+
}
|
|
138
|
+
], onScroll: boardScroll ? undefined : this.handleBodyScroll }, hasBodyContent ? (cardNodes) : ((0, vue_1.h)("div", { class: `${mergedClsPrefix}-kanban-column__empty` }, $slots.columnEmpty ? ($slots.columnEmpty({ column })) : typeof emptyText === 'function' ? (emptyText()) : ((0, vue_1.h)(empty_1.UEmpty, { size: "small", description: emptyText }))))),
|
|
139
|
+
$slots.columnFooter ? ((0, vue_1.h)("div", { class: `${mergedClsPrefix}-kanban-column__footer` }, $slots.columnFooter({ column }))) : null));
|
|
140
|
+
}
|
|
141
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
import type { MergedTheme } from '../../_mixins';
|
|
3
|
+
import type { KanbanTheme } from '../styles';
|
|
4
|
+
import type { KanbanColumn, KanbanDropPosition, KanbanItem, KanbanKey, KanbanProps } from './interface';
|
|
5
|
+
export interface KanbanInjection {
|
|
6
|
+
mergedClsPrefixRef: Ref<string>;
|
|
7
|
+
mergedThemeRef: Ref<MergedTheme<KanbanTheme>>;
|
|
8
|
+
propsRef: KanbanProps;
|
|
9
|
+
getItemKey: (item: KanbanItem) => KanbanKey;
|
|
10
|
+
draggingItemKeySetRef: Ref<Set<KanbanKey>>;
|
|
11
|
+
draggingItemRef: Ref<KanbanItem | null>;
|
|
12
|
+
draggingColumnKeyRef: Ref<KanbanKey | null>;
|
|
13
|
+
droppingColumnKeyRef: Ref<KanbanKey | null>;
|
|
14
|
+
droppingItemKeyRef: Ref<KanbanKey | null>;
|
|
15
|
+
droppingPositionRef: Ref<KanbanDropPosition | null>;
|
|
16
|
+
handleItemDragStart: (event: DragEvent, item: KanbanItem) => void;
|
|
17
|
+
handleItemDragOver: (event: DragEvent, item: KanbanItem) => void;
|
|
18
|
+
handleItemDrop: (event: DragEvent, item: KanbanItem) => void;
|
|
19
|
+
handleColumnDragStart: (event: DragEvent, column: KanbanColumn) => void;
|
|
20
|
+
handleColumnDragOver: (event: DragEvent, column: KanbanColumn) => void;
|
|
21
|
+
handleColumnDrop: (event: DragEvent, column: KanbanColumn) => void;
|
|
22
|
+
handleDragEnd: () => void;
|
|
23
|
+
handleItemClick: (item: KanbanItem, column: KanbanColumn) => void;
|
|
24
|
+
handleColumnScroll: (column: KanbanColumn, target: HTMLElement) => void;
|
|
25
|
+
isItemDraggable: (item: KanbanItem, column: KanbanColumn) => boolean;
|
|
26
|
+
isColumnDraggable: (column: KanbanColumn) => boolean;
|
|
27
|
+
}
|
|
28
|
+
export declare const kanbanInjectionKey: import("vue").InjectionKey<KanbanInjection>;
|