@uzum-tech/ui 2.0.9 → 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.
Files changed (79) hide show
  1. package/dist/index.js +1785 -466
  2. package/dist/index.mjs +1780 -467
  3. package/dist/index.prod.js +2 -2
  4. package/dist/index.prod.mjs +2 -2
  5. package/es/carousel/src/Carousel.d.ts +1 -1
  6. package/es/components.d.ts +655 -5
  7. package/es/components.mjs +5 -0
  8. package/es/config-provider/src/internal-interface.d.ts +3 -1
  9. package/es/data-table/src/DataTable.d.ts +1 -1
  10. package/es/descriptions/src/Descriptions.d.ts +1 -1
  11. package/es/kanban/index.d.ts +7 -0
  12. package/es/kanban/index.mjs +5 -0
  13. package/es/kanban/src/Kanban.d.ts +570 -0
  14. package/es/kanban/src/Kanban.mjs +349 -0
  15. package/es/kanban/src/KanbanCard.d.ts +39 -0
  16. package/es/kanban/src/KanbanCard.mjs +86 -0
  17. package/es/kanban/src/KanbanColumn.d.ts +45 -0
  18. package/es/kanban/src/KanbanColumn.mjs +176 -0
  19. package/es/kanban/src/injection.d.ts +28 -0
  20. package/es/kanban/src/injection.mjs +2 -0
  21. package/es/kanban/src/interface.d.ts +215 -0
  22. package/es/kanban/src/interface.mjs +84 -0
  23. package/es/kanban/src/styles/index.cssr.d.ts +2 -0
  24. package/es/kanban/src/styles/index.cssr.mjs +165 -0
  25. package/es/kanban/src/use-kanban-data.d.ts +4 -0
  26. package/es/kanban/src/use-kanban-data.mjs +69 -0
  27. package/es/kanban/src/use-kanban-drag.d.ts +2 -0
  28. package/es/kanban/src/use-kanban-drag.mjs +238 -0
  29. package/es/kanban/styles/dark.d.ts +73 -0
  30. package/es/kanban/styles/dark.mjs +15 -0
  31. package/es/kanban/styles/index.d.ts +3 -0
  32. package/es/kanban/styles/index.mjs +2 -0
  33. package/es/kanban/styles/light.d.ts +109 -0
  34. package/es/kanban/styles/light.mjs +64 -0
  35. package/es/modal/src/BodyWrapper.d.ts +1 -1
  36. package/es/themes/dark.mjs +2 -0
  37. package/es/themes/light.mjs +2 -0
  38. package/es/tree/src/Tree.d.ts +1 -1
  39. package/es/version.d.ts +1 -1
  40. package/es/version.mjs +1 -1
  41. package/lib/carousel/src/Carousel.d.ts +1 -1
  42. package/lib/components.d.ts +655 -5
  43. package/lib/components.js +13 -5
  44. package/lib/config-provider/src/internal-interface.d.ts +3 -1
  45. package/lib/data-table/src/DataTable.d.ts +1 -1
  46. package/lib/descriptions/src/Descriptions.d.ts +1 -1
  47. package/lib/kanban/index.d.ts +7 -0
  48. package/lib/kanban/index.js +17 -0
  49. package/lib/kanban/src/Kanban.d.ts +570 -0
  50. package/lib/kanban/src/Kanban.js +291 -0
  51. package/lib/kanban/src/KanbanCard.d.ts +39 -0
  52. package/lib/kanban/src/KanbanCard.js +63 -0
  53. package/lib/kanban/src/KanbanColumn.d.ts +45 -0
  54. package/lib/kanban/src/KanbanColumn.js +141 -0
  55. package/lib/kanban/src/injection.d.ts +28 -0
  56. package/lib/kanban/src/injection.js +5 -0
  57. package/lib/kanban/src/interface.d.ts +215 -0
  58. package/lib/kanban/src/interface.js +87 -0
  59. package/lib/kanban/src/styles/index.cssr.d.ts +2 -0
  60. package/lib/kanban/src/styles/index.cssr.js +170 -0
  61. package/lib/kanban/src/use-kanban-data.d.ts +4 -0
  62. package/lib/kanban/src/use-kanban-data.js +70 -0
  63. package/lib/kanban/src/use-kanban-drag.d.ts +2 -0
  64. package/lib/kanban/src/use-kanban-drag.js +220 -0
  65. package/lib/kanban/styles/dark.d.ts +73 -0
  66. package/lib/kanban/styles/dark.js +17 -0
  67. package/lib/kanban/styles/index.d.ts +3 -0
  68. package/lib/kanban/styles/index.js +10 -0
  69. package/lib/kanban/styles/light.d.ts +109 -0
  70. package/lib/kanban/styles/light.js +54 -0
  71. package/lib/modal/src/BodyWrapper.d.ts +1 -1
  72. package/lib/themes/dark.js +98 -96
  73. package/lib/themes/light.js +96 -94
  74. package/lib/tree/src/Tree.d.ts +1 -1
  75. package/lib/version.d.ts +1 -1
  76. package/lib/version.js +1 -1
  77. package/package.json +1 -1
  78. package/volar.d.ts +3 -0
  79. package/web-types.json +171 -1
@@ -0,0 +1,215 @@
1
+ import type { PropType, Ref, VNodeChild } from 'vue';
2
+ import type { ExtractPublicPropTypes } from '../../_utils';
3
+ import type { EmptyProps } from '../../empty';
4
+ export interface KanbanItem {
5
+ key: KanbanKey;
6
+ column: KanbanKey;
7
+ disabled?: boolean;
8
+ title?: string | (() => VNodeChild);
9
+ description?: string | (() => VNodeChild);
10
+ name?: string;
11
+ render?: (item: KanbanItem, column: KanbanColumn) => VNodeChild;
12
+ [key: string]: unknown;
13
+ }
14
+ export interface KanbanColumn {
15
+ key: KanbanKey;
16
+ title?: string | (() => VNodeChild);
17
+ disabled?: boolean;
18
+ frozen?: boolean;
19
+ max?: number;
20
+ status?: KanbanColumnStatus;
21
+ [key: string]: unknown;
22
+ }
23
+ export interface KanbanMoveLocation {
24
+ column: KanbanKey;
25
+ index: number;
26
+ }
27
+ export interface KanbanMoveTarget {
28
+ column: KanbanKey;
29
+ index?: number;
30
+ }
31
+ export interface KanbanMoveContext {
32
+ item: KanbanItem;
33
+ from: KanbanMoveLocation;
34
+ to: KanbanMoveLocation;
35
+ }
36
+ export interface KanbanDragContext {
37
+ type: 'item' | 'column';
38
+ item?: KanbanItem;
39
+ column: KanbanColumn;
40
+ }
41
+ export interface KanbanScrollContext {
42
+ column?: KanbanKey;
43
+ scrollTop: number;
44
+ scrollHeight: number;
45
+ clientHeight: number;
46
+ }
47
+ export interface KanbanInstance {
48
+ moveItem: (key: KanbanKey, to: KanbanMoveTarget) => void;
49
+ addItem: (item: KanbanItem, index?: number) => void;
50
+ removeItem: (key: KanbanKey) => void;
51
+ scrollToColumn: (columnKey: KanbanKey) => void;
52
+ scrollColumnToBottom: (columnKey: KanbanKey) => void;
53
+ }
54
+ export interface KanbanColumnSlotProps {
55
+ column: KanbanColumn;
56
+ items: KanbanItem[];
57
+ index: number;
58
+ }
59
+ export interface KanbanColumnHeaderSlotProps {
60
+ column: KanbanColumn;
61
+ count: number;
62
+ }
63
+ export interface KanbanColumnFooterSlotProps {
64
+ column: KanbanColumn;
65
+ }
66
+ export interface KanbanColumnEmptySlotProps {
67
+ column: KanbanColumn;
68
+ }
69
+ export interface KanbanCardSlotProps {
70
+ item: KanbanItem;
71
+ column: KanbanColumn;
72
+ dragging: boolean;
73
+ }
74
+ export interface KanbanSlots {
75
+ column?: (props: KanbanColumnSlotProps) => VNodeChild;
76
+ columnHeader?: (props: KanbanColumnHeaderSlotProps) => VNodeChild;
77
+ columnFooter?: (props: KanbanColumnFooterSlotProps) => VNodeChild;
78
+ card?: (props: KanbanCardSlotProps) => VNodeChild;
79
+ empty?: () => VNodeChild;
80
+ columnEmpty?: (props: KanbanColumnEmptySlotProps) => VNodeChild;
81
+ }
82
+ export interface MoveItemResult {
83
+ data: KanbanItem[];
84
+ item: KanbanItem;
85
+ from: KanbanMoveLocation;
86
+ to: KanbanMoveLocation;
87
+ }
88
+ export interface ReadRef<T> {
89
+ readonly value: T;
90
+ }
91
+ export interface UseKanbanDragDeps {
92
+ dataRef: ReadRef<KanbanItem[]>;
93
+ columnsRef: ReadRef<KanbanColumn[]>;
94
+ columnFieldRef: ReadRef<string>;
95
+ orientationRef: ReadRef<KanbanOrientation>;
96
+ getItemKey: (item: KanbanItem) => KanbanKey;
97
+ isItemDraggable: (item: KanbanItem, column: KanbanColumn) => boolean;
98
+ isColumnDraggable: (column: KanbanColumn) => boolean;
99
+ allowDropRef: ReadRef<((ctx: KanbanMoveContext) => boolean) | undefined>;
100
+ emitUpdateData: (data: KanbanItem[]) => void;
101
+ emitMove: (ctx: KanbanMoveContext) => void;
102
+ emitColumnsReorder: (columns: KanbanColumn[]) => void;
103
+ emitDragStart: (ctx: KanbanDragContext) => void;
104
+ emitDragEnd: (ctx: KanbanDragContext) => void;
105
+ }
106
+ export interface UseKanbanDragReturn {
107
+ draggingItemKeySetRef: Ref<Set<KanbanKey>>;
108
+ draggingItemRef: Ref<KanbanItem | null>;
109
+ draggingColumnKeyRef: Ref<KanbanKey | null>;
110
+ droppingColumnKeyRef: Ref<KanbanKey | null>;
111
+ droppingItemKeyRef: Ref<KanbanKey | null>;
112
+ droppingPositionRef: Ref<KanbanDropPosition | null>;
113
+ handleItemDragStart: (event: DragEvent, item: KanbanItem) => void;
114
+ handleItemDragOver: (event: DragEvent, item: KanbanItem) => void;
115
+ handleItemDrop: (event: DragEvent, item: KanbanItem) => void;
116
+ handleColumnDragStart: (event: DragEvent, column: KanbanColumn) => void;
117
+ handleColumnDragOver: (event: DragEvent, column: KanbanColumn) => void;
118
+ handleColumnDrop: (event: DragEvent, column: KanbanColumn) => void;
119
+ handleDragEnd: VoidFunction;
120
+ }
121
+ export type KanbanKey = string | number;
122
+ export type KanbanDropPosition = 'before' | 'after';
123
+ export type KanbanOrientation = 'horizontal' | 'vertical';
124
+ export type KanbanScrollMode = 'column' | 'board';
125
+ export type KanbanColumnStatus = 'neutral' | 'success' | 'progress' | 'pending' | 'error';
126
+ export type KanbanProps = ExtractPublicPropTypes<typeof kanbanProps>;
127
+ export type KanbanColumnProps = ExtractPublicPropTypes<typeof kanbanColumnProps>;
128
+ export type KanbanCardProps = ExtractPublicPropTypes<typeof kanbanCardProps>;
129
+ export type KanbanItemKeyField = KanbanKey | ((item: KanbanItem) => KanbanKey);
130
+ export type KanbanColumnByKey = Map<KanbanKey, KanbanColumn>;
131
+ export type KanbanDropPredicate = (ctx: KanbanMoveContext) => boolean;
132
+ export declare const kanbanProps: {
133
+ readonly columns: {
134
+ readonly type: PropType<KanbanColumn[]>;
135
+ readonly default: () => never[];
136
+ };
137
+ readonly data: {
138
+ readonly type: PropType<KanbanItem[]>;
139
+ readonly default: () => never[];
140
+ };
141
+ readonly itemKey: {
142
+ readonly type: PropType<KanbanItemKeyField>;
143
+ readonly default: "key";
144
+ };
145
+ readonly columnField: {
146
+ readonly type: StringConstructor;
147
+ readonly default: "column";
148
+ };
149
+ readonly orientation: {
150
+ readonly type: PropType<KanbanOrientation>;
151
+ readonly default: "horizontal";
152
+ };
153
+ readonly draggable: {
154
+ readonly type: BooleanConstructor;
155
+ readonly default: true;
156
+ };
157
+ readonly columnsDraggable: {
158
+ readonly type: BooleanConstructor;
159
+ readonly default: false;
160
+ };
161
+ readonly disabled: BooleanConstructor;
162
+ readonly allowDrop: PropType<(ctx: KanbanMoveContext) => boolean>;
163
+ readonly scrollMode: {
164
+ readonly type: PropType<KanbanScrollMode>;
165
+ readonly default: "board";
166
+ };
167
+ readonly scrollThreshold: {
168
+ readonly type: NumberConstructor;
169
+ readonly default: 48;
170
+ };
171
+ readonly loading: BooleanConstructor;
172
+ readonly emptyProps: PropType<Partial<EmptyProps>>;
173
+ readonly columnEmptyText: PropType<string | (() => VNodeChild)>;
174
+ readonly columnProps: PropType<Record<string, unknown>>;
175
+ readonly cardProps: PropType<Record<string, unknown>>;
176
+ readonly 'onUpdate:data': PropType<((data: KanbanItem[]) => void) | Array<(data: KanbanItem[]) => void>>;
177
+ readonly onMove: PropType<(ctx: KanbanMoveContext) => void>;
178
+ readonly onColumnsReorder: PropType<(columns: KanbanColumn[]) => void>;
179
+ readonly onDragStart: PropType<(ctx: KanbanDragContext) => void>;
180
+ readonly onDragEnd: PropType<(ctx: KanbanDragContext) => void>;
181
+ readonly onItemClick: PropType<(item: KanbanItem, column: KanbanColumn) => void>;
182
+ readonly onColumnScrollTop: PropType<(ctx: KanbanScrollContext) => void>;
183
+ readonly onColumnScrollBottom: PropType<(ctx: KanbanScrollContext) => void>;
184
+ readonly onScrollTop: PropType<(ctx: KanbanScrollContext) => void>;
185
+ readonly onScrollBottom: PropType<(ctx: KanbanScrollContext) => void>;
186
+ };
187
+ export declare const kanbanColumnProps: {
188
+ readonly column: {
189
+ readonly type: PropType<KanbanColumn>;
190
+ readonly required: true;
191
+ };
192
+ readonly items: {
193
+ readonly type: PropType<KanbanItem[]>;
194
+ readonly default: () => never[];
195
+ };
196
+ readonly index: {
197
+ readonly type: NumberConstructor;
198
+ readonly default: 0;
199
+ };
200
+ };
201
+ export declare const kanbanCardProps: {
202
+ readonly item: {
203
+ readonly type: PropType<KanbanItem>;
204
+ readonly required: true;
205
+ };
206
+ readonly column: {
207
+ readonly type: PropType<KanbanColumn>;
208
+ readonly required: true;
209
+ };
210
+ readonly index: {
211
+ readonly type: NumberConstructor;
212
+ readonly default: 0;
213
+ };
214
+ readonly ghost: BooleanConstructor;
215
+ };
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.kanbanCardProps = exports.kanbanColumnProps = exports.kanbanProps = void 0;
4
+ exports.kanbanProps = {
5
+ columns: {
6
+ type: Array,
7
+ default: () => []
8
+ },
9
+ data: {
10
+ type: Array,
11
+ default: () => []
12
+ },
13
+ itemKey: {
14
+ type: [String, Number, Function],
15
+ default: 'key'
16
+ },
17
+ columnField: {
18
+ type: String,
19
+ default: 'column'
20
+ },
21
+ orientation: {
22
+ type: String,
23
+ default: 'horizontal'
24
+ },
25
+ draggable: {
26
+ type: Boolean,
27
+ default: true
28
+ },
29
+ columnsDraggable: {
30
+ type: Boolean,
31
+ default: false
32
+ },
33
+ disabled: Boolean,
34
+ allowDrop: Function,
35
+ scrollMode: {
36
+ type: String,
37
+ default: 'board'
38
+ },
39
+ scrollThreshold: {
40
+ type: Number,
41
+ default: 48
42
+ },
43
+ loading: Boolean,
44
+ emptyProps: Object,
45
+ columnEmptyText: [String, Function],
46
+ columnProps: Object,
47
+ cardProps: Object,
48
+ 'onUpdate:data': [Function, Array],
49
+ onMove: Function,
50
+ onColumnsReorder: Function,
51
+ onDragStart: Function,
52
+ onDragEnd: Function,
53
+ onItemClick: Function,
54
+ onColumnScrollTop: Function,
55
+ onColumnScrollBottom: Function,
56
+ onScrollTop: Function,
57
+ onScrollBottom: Function
58
+ };
59
+ exports.kanbanColumnProps = {
60
+ column: {
61
+ type: Object,
62
+ required: true
63
+ },
64
+ items: {
65
+ type: Array,
66
+ default: () => []
67
+ },
68
+ index: {
69
+ type: Number,
70
+ default: 0
71
+ }
72
+ };
73
+ exports.kanbanCardProps = {
74
+ item: {
75
+ type: Object,
76
+ required: true
77
+ },
78
+ column: {
79
+ type: Object,
80
+ required: true
81
+ },
82
+ index: {
83
+ type: Number,
84
+ default: 0
85
+ },
86
+ ghost: Boolean
87
+ };
@@ -0,0 +1,2 @@
1
+ declare const _default: import("css-render").CNode;
2
+ export default _default;
@@ -0,0 +1,170 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ const cssr_1 = require("../../../_utils/cssr");
7
+ exports.default = (0, cssr_1.c)([(0, cssr_1.cB)('kanban', `
8
+ display: flex;
9
+ flex-direction: column;
10
+ width: 100%;
11
+ height: 100%;
12
+ box-sizing: border-box;
13
+ `, [(0, cssr_1.cE)('board', `
14
+ padding: var(--u-board-padding);
15
+ overflow-x: auto;
16
+ overflow-y: hidden;
17
+ flex: 1;
18
+ min-height: 0;
19
+ `, [(0, cssr_1.cM)('vertical', `
20
+ overflow-x: hidden;
21
+ overflow-y: auto;
22
+ `), (0, cssr_1.cM)('scroll-board', `
23
+ overflow-y: auto;
24
+ `)]), (0, cssr_1.cE)('board-track', `
25
+ display: flex;
26
+ flex-direction: row;
27
+ align-items: stretch;
28
+ gap: var(--u-column-gap);
29
+ width: max-content;
30
+ min-width: 100%;
31
+ min-height: 100%;
32
+ box-sizing: border-box;
33
+ `, [(0, cssr_1.cM)('vertical', `
34
+ flex-direction: column;
35
+ width: 100%;
36
+ min-height: 0;
37
+ `)]), (0, cssr_1.cE)('empty', `
38
+ margin: auto;
39
+ `)]), (0, cssr_1.cB)('kanban-column', `
40
+ display: flex;
41
+ flex-direction: column;
42
+ width: var(--u-column-width);
43
+ flex-shrink: 0;
44
+ max-height: 100%;
45
+ background-color: var(--u-column-background-color);
46
+ border-radius: var(--u-column-border-radius);
47
+ box-sizing: border-box;
48
+ transition: opacity .2s var(--u-bezier);
49
+ position: relative;
50
+ `, [(0, cssr_1.cM)('vertical', `
51
+ width: 100%;
52
+ `), (0, cssr_1.cM)('board-scroll', `
53
+ max-height: none;
54
+ `), (0, cssr_1.cM)('dragging', `
55
+ opacity: var(--u-column-dragging-opacity);
56
+ `), (0, cssr_1.cM)('drop-before', [(0, cssr_1.c)('&::before', `
57
+ content: '';
58
+ position: absolute;
59
+ top: 0;
60
+ bottom: 0;
61
+ left: -8px;
62
+ width: 3px;
63
+ border-radius: 3px;
64
+ background-color: var(--u-drop-indicator-color);
65
+ `)]), (0, cssr_1.cM)('drop-after', [(0, cssr_1.c)('&::after', `
66
+ content: '';
67
+ position: absolute;
68
+ top: 0;
69
+ bottom: 0;
70
+ right: -8px;
71
+ width: 3px;
72
+ border-radius: 3px;
73
+ background-color: var(--u-drop-indicator-color);
74
+ `)]), (0, cssr_1.cE)('header', `
75
+ display: flex;
76
+ align-items: center;
77
+ justify-content: space-between;
78
+ gap: 20px;
79
+ padding: var(--u-column-header-padding);
80
+ color: var(--u-column-header-color);
81
+ font-size: 14px;
82
+ font-weight: 700;
83
+ line-height: 20px;
84
+ border-top-left-radius: var(--u-column-border-radius);
85
+ border-top-right-radius: var(--u-column-border-radius);
86
+ cursor: default;
87
+ `, [(0, cssr_1.cM)('draggable', `
88
+ cursor: grab;
89
+ `)]), (0, cssr_1.cE)('title', `
90
+ min-width: 0;
91
+ overflow: hidden;
92
+ text-overflow: ellipsis;
93
+ white-space: nowrap;
94
+ `), (0, cssr_1.cE)('count', `
95
+ display: inline-flex;
96
+ align-items: center;
97
+ justify-content: center;
98
+ flex-shrink: 0;
99
+ box-sizing: border-box;
100
+ min-width: 24px;
101
+ height: 24px;
102
+ padding: 2px 8px;
103
+ border-radius: 100px;
104
+ background-color: var(--u-count-background-color);
105
+ color: var(--u-count-text-color);
106
+ font-size: 14px;
107
+ font-weight: 600;
108
+ line-height: 20px;
109
+ `, [(0, cssr_1.cM)('max-reached', `
110
+ background-color: var(--u-max-reached-color);
111
+ `)]), (0, cssr_1.cE)('body', `
112
+ display: flex;
113
+ flex-direction: column;
114
+ gap: var(--u-card-gap);
115
+ padding: var(--u-column-body-padding);
116
+ overflow-y: auto;
117
+ flex: 1;
118
+ min-height: 48px;
119
+ `, [(0, cssr_1.cM)('board-scroll', `
120
+ overflow-y: visible;
121
+ `)]), (0, cssr_1.cE)('footer', `
122
+ padding: var(--u-column-body-padding);
123
+ padding-top: 0;
124
+ `), (0, cssr_1.cE)('empty', `
125
+ padding: 32px 0 64px;
126
+ `)]), (0, cssr_1.cB)('kanban-card', `
127
+ position: relative;
128
+ background-color: var(--u-card-background-color);
129
+ border: 2px solid transparent;
130
+ border-radius: var(--u-card-border-radius);
131
+ padding: var(--u-card-padding);
132
+ color: var(--u-card-color);
133
+ box-shadow: var(--u-card-box-shadow);
134
+ box-sizing: border-box;
135
+ cursor: grab;
136
+ transition:
137
+ box-shadow .2s var(--u-bezier),
138
+ border-color .2s var(--u-bezier),
139
+ background-color .2s var(--u-bezier);
140
+ `, [(0, cssr_1.c)('&:hover', `
141
+ box-shadow: var(--u-card-box-shadow-hover);
142
+ `), (0, cssr_1.cM)('dragging', `
143
+ border: 2px dashed var(--u-drop-indicator-color);
144
+ background-color: var(--u-card-background-color);
145
+ box-shadow: none;
146
+ opacity: .6;
147
+ cursor: grabbing;
148
+ `), (0, cssr_1.cM)('ghost', `
149
+ border: 2px dashed var(--u-drop-indicator-color);
150
+ background-color: var(--u-card-background-color);
151
+ box-shadow: none;
152
+ opacity: .6;
153
+ cursor: default;
154
+ pointer-events: none;
155
+ `), (0, cssr_1.cM)('disabled', `
156
+ cursor: default;
157
+ `), (0, cssr_1.cM)('clickable', `
158
+ cursor: pointer;
159
+ `), (0, cssr_1.cE)('title', `
160
+ color: var(--u-card-color);
161
+ font-size: 16px;
162
+ font-weight: 700;
163
+ line-height: 24px;
164
+ `), (0, cssr_1.cE)('description', `
165
+ color: var(--u-card-sub-color);
166
+ font-size: 14px;
167
+ font-weight: 500;
168
+ line-height: 20px;
169
+ margin-top: 2px;
170
+ `)])]);
@@ -0,0 +1,4 @@
1
+ import type { KanbanColumn, KanbanItem, KanbanKey, MoveItemResult } from './interface';
2
+ export declare function groupItemsByColumn(columns: KanbanColumn[], data: KanbanItem[], columnField: string): Map<KanbanKey, KanbanItem[]>;
3
+ export declare function moveItem(data: KanbanItem[], getKey: (item: KanbanItem) => KanbanKey, columnField: string, movingKey: KanbanKey, toColumn: KanbanKey, toIndex: number): MoveItemResult | null;
4
+ export declare function reorderColumns(columns: KanbanColumn[], movingKey: KanbanKey, targetKey: KanbanKey, position: 'before' | 'after'): KanbanColumn[] | null;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.groupItemsByColumn = groupItemsByColumn;
4
+ exports.moveItem = moveItem;
5
+ exports.reorderColumns = reorderColumns;
6
+ function groupItemsByColumn(columns, data, columnField) {
7
+ const map = new Map();
8
+ for (const column of columns) {
9
+ map.set(column.key, []);
10
+ }
11
+ for (const item of data) {
12
+ const columnKey = item[columnField];
13
+ if (!map.has(columnKey)) {
14
+ map.set(columnKey, []);
15
+ }
16
+ map.get(columnKey).push(item);
17
+ }
18
+ return map;
19
+ }
20
+ function moveItem(data, getKey, columnField, movingKey, toColumn, toIndex) {
21
+ const sourceIndex = data.findIndex(item => getKey(item) === movingKey);
22
+ if (sourceIndex < 0) {
23
+ return null;
24
+ }
25
+ const moving = data[sourceIndex];
26
+ const fromColumn = moving[columnField];
27
+ const fromIndex = data
28
+ .filter(item => item[columnField] === fromColumn)
29
+ .findIndex(item => getKey(item) === movingKey);
30
+ const updatedMoving = Object.assign(Object.assign({}, moving), { [columnField]: toColumn });
31
+ const rest = data.slice();
32
+ rest.splice(sourceIndex, 1);
33
+ const targetColumnItems = rest.filter(item => item[columnField] === toColumn);
34
+ const clampedIndex = Math.max(0, Math.min(toIndex, targetColumnItems.length));
35
+ let insertAt;
36
+ if (targetColumnItems.length === 0) {
37
+ insertAt = rest.length;
38
+ }
39
+ else if (clampedIndex >= targetColumnItems.length) {
40
+ const anchor = targetColumnItems[targetColumnItems.length - 1];
41
+ insertAt = rest.findIndex(item => getKey(item) === getKey(anchor)) + 1;
42
+ }
43
+ else {
44
+ const anchor = targetColumnItems[clampedIndex];
45
+ insertAt = rest.findIndex(item => getKey(item) === getKey(anchor));
46
+ }
47
+ rest.splice(insertAt, 0, updatedMoving);
48
+ return {
49
+ data: rest,
50
+ item: updatedMoving,
51
+ from: { column: fromColumn, index: fromIndex },
52
+ to: { column: toColumn, index: clampedIndex }
53
+ };
54
+ }
55
+ function reorderColumns(columns, movingKey, targetKey, position) {
56
+ if (movingKey === targetKey) {
57
+ return null;
58
+ }
59
+ const sourceIndex = columns.findIndex(column => column.key === movingKey);
60
+ const targetIndex = columns.findIndex(column => column.key === targetKey);
61
+ if (sourceIndex < 0 || targetIndex < 0) {
62
+ return null;
63
+ }
64
+ const next = columns.slice();
65
+ const [moving] = next.splice(sourceIndex, 1);
66
+ const anchorIndex = next.findIndex(column => column.key === targetKey);
67
+ const insertAt = position === 'after' ? anchorIndex + 1 : anchorIndex;
68
+ next.splice(insertAt, 0, moving);
69
+ return next;
70
+ }
@@ -0,0 +1,2 @@
1
+ import type { UseKanbanDragDeps, UseKanbanDragReturn } from './interface';
2
+ export declare function useKanbanDrag(deps: UseKanbanDragDeps): UseKanbanDragReturn;