@svar-ui/svelte-kanban 2.6.0 → 2.7.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/components/Card.svelte +15 -72
- package/dist/components/CardList.svelte +8 -341
- package/dist/components/CardList.svelte.d.ts +14 -12
- package/dist/components/CardMenuButton.svelte +47 -0
- package/dist/components/CardMenuButton.svelte.d.ts +10 -0
- package/dist/components/CardWrapper.svelte +2 -5
- package/dist/components/Column.svelte +85 -53
- package/dist/components/Column.svelte.d.ts +4 -0
- package/dist/components/DragGhost.svelte +4 -0
- package/dist/components/Kanban.svelte +19 -20
- package/dist/components/Kanban.svelte.d.ts +117 -12
- package/dist/components/Layout.svelte +103 -51
- package/dist/components/Layout.svelte.d.ts +5 -1
- package/dist/components/Stack.svelte +383 -0
- package/dist/components/Stack.svelte.d.ts +26 -0
- package/dist/components/StackCardList.svelte +434 -0
- package/dist/components/StackCardList.svelte.d.ts +28 -0
- package/dist/components/useDrag.svelte.d.ts +7 -5
- package/dist/components/useDrag.svelte.js +6 -0
- package/dist/context.d.ts +6 -0
- package/dist/context.js +1 -0
- package/dist/directives/dblclick.d.ts +2 -1
- package/dist/directives/dblclick.js +5 -4
- package/dist/directives/drag.d.ts +2 -0
- package/dist/directives/drag.js +99 -43
- package/dist/index.d.ts +10 -4
- package/dist/index.js +9 -3
- package/dist/layout/stack.d.ts +19 -0
- package/dist/layout/stack.js +37 -0
- package/dist/layout/target.d.ts +18 -0
- package/dist/layout/target.js +74 -0
- package/dist/menus/CardActionMenu.svelte +20 -0
- package/dist/menus/CardActionMenu.svelte.d.ts +7 -0
- package/dist/menus/CardContextMenu.svelte +20 -0
- package/dist/menus/CardContextMenu.svelte.d.ts +7 -0
- package/dist/menus/ColumnActionMenu.svelte +20 -0
- package/dist/menus/ColumnActionMenu.svelte.d.ts +7 -0
- package/dist/menus/ColumnContextMenu.svelte +20 -0
- package/dist/menus/ColumnContextMenu.svelte.d.ts +7 -0
- package/dist/menus/KanbanMenu.svelte +65 -0
- package/dist/menus/KanbanMenu.svelte.d.ts +37 -0
- package/dist/menus/helpers.d.ts +23 -0
- package/dist/menus/helpers.js +80 -0
- package/dist/themes/Print.svelte +1 -8
- package/dist/themes/PrintBW.svelte +1 -8
- package/dist/themes/Willow.svelte +1 -1
- package/dist/themes/WillowDark.svelte +1 -1
- package/dist/types.d.ts +71 -9
- package/package.json +25 -11
- package/readme.md +16 -8
- package/dist/components/ContextMenu.svelte +0 -111
- package/dist/components/ContextMenu.svelte.d.ts +0 -18
- package/dist/components/ExportLayout.svelte +0 -52
- package/dist/components/ExportLayout.svelte.d.ts +0 -15
- package/dist/export/Card.svelte +0 -5
- package/dist/export/Card.svelte.d.ts +0 -11
- package/dist/export/Kanban.svelte +0 -30
- package/dist/export/Kanban.svelte.d.ts +0 -16
- package/dist/export.d.ts +0 -3
- package/dist/export.js +0 -15
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { KanbanCard, SwimlaneID } from "@svar-ui/kanban-store";
|
|
2
|
+
import type { ColumnMenuContext, KanbanInstanceApi } from "../types.js";
|
|
3
|
+
/** Card for a located id; `null` when the card or the api is missing. */
|
|
4
|
+
export declare function resolveCard(api: KanbanInstanceApi | null | undefined, id: any): KanbanCard | null;
|
|
5
|
+
/** Lane id of a stack header under `node`, if any. */
|
|
6
|
+
export declare function locateLane(node: Element | null): SwimlaneID | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Projected column with the cards under its header: all column cards, or one
|
|
9
|
+
* lane's when `lane` is set (stack layout). `null` when anything is missing.
|
|
10
|
+
*/
|
|
11
|
+
export declare function resolveColumn(api: KanbanInstanceApi | null | undefined, id: any, lane?: SwimlaneID): ColumnMenuContext | null;
|
|
12
|
+
/** Built-in column menu items: no `add-card` when the column disables it. */
|
|
13
|
+
export declare function defaultColumnOptions(options: any[], { column }: ColumnMenuContext): any[];
|
|
14
|
+
/** Runs built-in card items: `edit-card`, `duplicate-card`, `delete-card`. */
|
|
15
|
+
export declare function execCardMenuAction(api: KanbanInstanceApi | null | undefined, action: {
|
|
16
|
+
id?: any;
|
|
17
|
+
} | null | undefined, card: KanbanCard): void;
|
|
18
|
+
/** Runs built-in column items: `add-card`, `collapse-column`. */
|
|
19
|
+
export declare function execColumnMenuAction(api: KanbanInstanceApi | null | undefined, action: {
|
|
20
|
+
id?: any;
|
|
21
|
+
} | null | undefined, { column, swimlane }: ColumnMenuContext): void;
|
|
22
|
+
/** Translates `text` / `subtext` of menu items, including nested `data`. */
|
|
23
|
+
export declare function localizeOptions(options: any[], _: (text: string) => string): any[];
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { getID, locate } from "@svar-ui/lib-dom";
|
|
2
|
+
import { createColumnCard } from "../directives/dblclick.js";
|
|
3
|
+
/** Card for a located id; `null` when the card or the api is missing. */
|
|
4
|
+
export function resolveCard(api, id) {
|
|
5
|
+
if (!api || id == null)
|
|
6
|
+
return null;
|
|
7
|
+
return api.getState().cards.getById(id) ?? null;
|
|
8
|
+
}
|
|
9
|
+
/** Lane id of a stack header under `node`, if any. */
|
|
10
|
+
export function locateLane(node) {
|
|
11
|
+
const lane = node && locate(node, "data-lane-id");
|
|
12
|
+
return lane ? getID(lane, "data-lane-id") : undefined;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Projected column with the cards under its header: all column cards, or one
|
|
16
|
+
* lane's when `lane` is set (stack layout). `null` when anything is missing.
|
|
17
|
+
*/
|
|
18
|
+
export function resolveColumn(api, id, lane) {
|
|
19
|
+
if (!api || id == null)
|
|
20
|
+
return null;
|
|
21
|
+
const { viewData } = api.getState();
|
|
22
|
+
const column = viewData.columns.find(c => c.id === id);
|
|
23
|
+
if (!column)
|
|
24
|
+
return null;
|
|
25
|
+
if (lane === undefined)
|
|
26
|
+
return { column, cards: column.cards };
|
|
27
|
+
const swimlane = viewData.swimlanes.find(l => l.id === lane);
|
|
28
|
+
if (!swimlane)
|
|
29
|
+
return null;
|
|
30
|
+
const cell = swimlane.cells.find(c => c.column === id);
|
|
31
|
+
return { column, cards: cell?.cards ?? [], swimlane };
|
|
32
|
+
}
|
|
33
|
+
/** Built-in column menu items: no `add-card` when the column disables it. */
|
|
34
|
+
export function defaultColumnOptions(options, { column }) {
|
|
35
|
+
return options.filter(op => op.id !== "add-card" || column.addCard);
|
|
36
|
+
}
|
|
37
|
+
/** Runs built-in card items: `edit-card`, `duplicate-card`, `delete-card`. */
|
|
38
|
+
export function execCardMenuAction(api, action, card) {
|
|
39
|
+
if (!api || !action)
|
|
40
|
+
return;
|
|
41
|
+
const id = card.id;
|
|
42
|
+
if (action.id === "edit-card")
|
|
43
|
+
void api.exec("select-card", { id });
|
|
44
|
+
else if (action.id === "duplicate-card")
|
|
45
|
+
void api.exec("duplicate-card", { id });
|
|
46
|
+
else if (action.id === "delete-card")
|
|
47
|
+
void api.exec("delete-card", { id });
|
|
48
|
+
}
|
|
49
|
+
/** Runs built-in column items: `add-card`, `collapse-column`. */
|
|
50
|
+
export function execColumnMenuAction(api, action, { column, swimlane }) {
|
|
51
|
+
if (!api || !action)
|
|
52
|
+
return;
|
|
53
|
+
if (action.id === "add-card") {
|
|
54
|
+
const state = api.getState();
|
|
55
|
+
let card = createColumnCard({}, state.columnAccessor, column.id);
|
|
56
|
+
if (swimlane)
|
|
57
|
+
card = createColumnCard(card, state.swimlaneAccessor, swimlane.id);
|
|
58
|
+
void api.exec("add-card", { card: card, edit: true });
|
|
59
|
+
}
|
|
60
|
+
else if (action.id === "collapse-column") {
|
|
61
|
+
void api.exec("update-column", {
|
|
62
|
+
id: column.id,
|
|
63
|
+
column: { collapsed: !column.collapsed },
|
|
64
|
+
skipProvider: true,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/** Translates `text` / `subtext` of menu items, including nested `data`. */
|
|
69
|
+
export function localizeOptions(options, _) {
|
|
70
|
+
return options.map(op => {
|
|
71
|
+
op = { ...op };
|
|
72
|
+
if (op.text)
|
|
73
|
+
op.text = _(op.text);
|
|
74
|
+
if (op.subtext)
|
|
75
|
+
op.subtext = _(op.subtext);
|
|
76
|
+
if (op.data)
|
|
77
|
+
op.data = localizeOptions(op.data, _);
|
|
78
|
+
return op;
|
|
79
|
+
});
|
|
80
|
+
}
|
package/dist/themes/Print.svelte
CHANGED
|
@@ -31,7 +31,6 @@
|
|
|
31
31
|
/* kanban surfaces */
|
|
32
32
|
--wx-kanban-bg: #ffffff;
|
|
33
33
|
--wx-kanban-column-bg: #ffffff;
|
|
34
|
-
--wx-kanban-column-over-limit-bg: #ffffff;
|
|
35
34
|
--wx-kanban-card-bg: #ffffff;
|
|
36
35
|
--wx-kanban-tag-bg: #ffffff;
|
|
37
36
|
--wx-kanban-avatar-bg: #ffffff;
|
|
@@ -70,16 +69,10 @@
|
|
|
70
69
|
}
|
|
71
70
|
|
|
72
71
|
.wx-print-theme :global(.wx-column-header),
|
|
73
|
-
.wx-print-theme :global(.wx-scroll-board .wx-column-header)
|
|
74
|
-
.wx-print-theme :global(.wx-over-limit .wx-column-header),
|
|
75
|
-
.wx-print-theme :global(.wx-over-limit .wx-body) {
|
|
72
|
+
.wx-print-theme :global(.wx-scroll-board .wx-column-header) {
|
|
76
73
|
background: #ffffff;
|
|
77
74
|
}
|
|
78
75
|
|
|
79
|
-
.wx-print-theme :global(.wx-over-limit.wx-column) {
|
|
80
|
-
border-color: var(--wx-color-danger);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
76
|
.wx-print-theme :global(.wx-card) {
|
|
84
77
|
background: #ffffff;
|
|
85
78
|
border: 1px solid var(--wx-kanban-border-color);
|
|
@@ -35,7 +35,6 @@
|
|
|
35
35
|
/* kanban surfaces */
|
|
36
36
|
--wx-kanban-bg: #ffffff;
|
|
37
37
|
--wx-kanban-column-bg: #ffffff;
|
|
38
|
-
--wx-kanban-column-over-limit-bg: #ffffff;
|
|
39
38
|
--wx-kanban-card-bg: #ffffff;
|
|
40
39
|
--wx-kanban-tag-bg: #ffffff;
|
|
41
40
|
--wx-kanban-avatar-bg: #ffffff;
|
|
@@ -74,16 +73,10 @@
|
|
|
74
73
|
}
|
|
75
74
|
|
|
76
75
|
.wx-bw-theme :global(.wx-column-header),
|
|
77
|
-
.wx-bw-theme :global(.wx-scroll-board .wx-column-header)
|
|
78
|
-
.wx-bw-theme :global(.wx-over-limit .wx-column-header),
|
|
79
|
-
.wx-bw-theme :global(.wx-over-limit .wx-body) {
|
|
76
|
+
.wx-bw-theme :global(.wx-scroll-board .wx-column-header) {
|
|
80
77
|
background: #ffffff;
|
|
81
78
|
}
|
|
82
79
|
|
|
83
|
-
.wx-bw-theme :global(.wx-over-limit.wx-column) {
|
|
84
|
-
border-color: #000000;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
80
|
.wx-bw-theme :global(.wx-card) {
|
|
88
81
|
background: #ffffff;
|
|
89
82
|
border: 1px solid var(--wx-kanban-border-color);
|
|
@@ -16,7 +16,7 @@ let { fonts = true, children } = $props();
|
|
|
16
16
|
/* kanban surfaces */
|
|
17
17
|
--wx-kanban-bg: var(--wx-background-alt);
|
|
18
18
|
--wx-kanban-column-bg: #ebecef;
|
|
19
|
-
--wx-kanban-
|
|
19
|
+
--wx-kanban-lane-bg: #ecf2ff;
|
|
20
20
|
--wx-kanban-card-bg: var(--wx-background);
|
|
21
21
|
--wx-kanban-tag-bg: var(--wx-background-alt);
|
|
22
22
|
--wx-kanban-avatar-bg: #d0d4dc;
|
|
@@ -16,7 +16,7 @@ let { fonts = true, children } = $props();
|
|
|
16
16
|
/* kanban surfaces */
|
|
17
17
|
--wx-kanban-bg: var(--wx-background);
|
|
18
18
|
--wx-kanban-column-bg: var(--wx-background-alt);
|
|
19
|
-
--wx-kanban-
|
|
19
|
+
--wx-kanban-lane-bg: #000;
|
|
20
20
|
--wx-kanban-card-bg: var(--wx-background);
|
|
21
21
|
--wx-kanban-tag-bg: #434863;
|
|
22
22
|
--wx-kanban-avatar-bg: #4a5070;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
|
+
import type { Snippet } from "svelte";
|
|
1
2
|
import type { EventBus } from "@svar-ui/lib-state";
|
|
2
|
-
import type { Brandmark, KanbanStore, StoreActions, KanbanCard, CardID, ColumnID, ColumnView } from "@svar-ui/kanban-store";
|
|
3
|
+
import type { Brandmark, KanbanStore, StoreActions, KanbanCard, CardID, ColumnID, ColumnView, SwimlaneID, SwimlaneView } from "@svar-ui/kanban-store";
|
|
4
|
+
export type CardListSlotProps = {
|
|
5
|
+
column: ColumnView;
|
|
6
|
+
swimlane?: SwimlaneView;
|
|
7
|
+
/** All filtered and sorted cards in this area. */
|
|
8
|
+
cards: KanbanCard[];
|
|
9
|
+
readonly: boolean;
|
|
10
|
+
};
|
|
3
11
|
export type CardCssFn = (card: KanbanCard, column: ColumnView) => string;
|
|
4
12
|
export type ColumnCssFn = (cards: KanbanCard[], column: ColumnView) => string;
|
|
5
13
|
type ShapeConfig<T> = boolean | T;
|
|
@@ -8,7 +16,9 @@ export type CardShapeItem = {
|
|
|
8
16
|
label: string;
|
|
9
17
|
css?: string;
|
|
10
18
|
};
|
|
11
|
-
export type CardShapeUserItem =
|
|
19
|
+
export type CardShapeUserItem = {
|
|
20
|
+
id: CardID;
|
|
21
|
+
label: string;
|
|
12
22
|
img?: string;
|
|
13
23
|
};
|
|
14
24
|
export type CardPriorityShape = {
|
|
@@ -20,16 +30,35 @@ export type CardTagsShape = {
|
|
|
20
30
|
};
|
|
21
31
|
export type CardUsersShape = {
|
|
22
32
|
max?: number;
|
|
23
|
-
size?: "sm" | "md";
|
|
24
33
|
data?: CardShapeUserItem[];
|
|
25
34
|
};
|
|
26
35
|
export type CardDeadlineShape = {
|
|
27
|
-
format?: string;
|
|
36
|
+
format?: string | ((date: Date) => string);
|
|
28
37
|
};
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
38
|
+
/** What a column menu was opened for. */
|
|
39
|
+
export type ColumnMenuContext = {
|
|
40
|
+
column: ColumnView;
|
|
41
|
+
/** Cards under the clicked header: the column's cards, or one lane's in the stack layout. */
|
|
42
|
+
cards: KanbanCard[];
|
|
43
|
+
/** The lane of the clicked header; only set in the stack layout. */
|
|
44
|
+
swimlane?: SwimlaneView;
|
|
45
|
+
};
|
|
46
|
+
/** Props shared by `CardActionMenu`, `CardContextMenu`, `ColumnActionMenu` and `ColumnContextMenu`. */
|
|
47
|
+
export type KanbanMenuProps<T> = {
|
|
48
|
+
/** Kanban instance (`bind:this` / `init`); the menu stays inert until it is set. */
|
|
49
|
+
api?: KanbanInstanceApi | null;
|
|
50
|
+
/** Items, or a function called on every open. Empty/nullish result - no menu. Omitted - defaults. */
|
|
51
|
+
options?: any[] | ((ctx: T) => any[] | null | undefined | false);
|
|
52
|
+
/** Gate after the target is resolved; falsy - no menu. */
|
|
53
|
+
resolver?: ((ctx: T, ev: MouseEvent) => any) | null;
|
|
54
|
+
/** Per-item filter for the resolved target. */
|
|
55
|
+
filter?: ((item: any, ctx: T) => boolean) | null;
|
|
56
|
+
/** Called after built-in items ran; `ev.context` is the target. */
|
|
57
|
+
onclick?: (ev: any) => void;
|
|
58
|
+
/** Placement, forwarded to the menu (default `"point"`). */
|
|
59
|
+
at?: string;
|
|
60
|
+
css?: string;
|
|
61
|
+
children?: Snippet;
|
|
33
62
|
};
|
|
34
63
|
export type CardShape = {
|
|
35
64
|
cover?: boolean;
|
|
@@ -43,7 +72,8 @@ export type CardShape = {
|
|
|
43
72
|
attachments?: boolean;
|
|
44
73
|
comments?: boolean;
|
|
45
74
|
description?: boolean;
|
|
46
|
-
|
|
75
|
+
/** Renders the card ⋯ button for an outer `CardActionMenu`. */
|
|
76
|
+
menu?: boolean;
|
|
47
77
|
};
|
|
48
78
|
export type EditorShape = {
|
|
49
79
|
description?: boolean;
|
|
@@ -56,6 +86,8 @@ export type EditorShape = {
|
|
|
56
86
|
users?: ShapeConfig<CardUsersShape>;
|
|
57
87
|
};
|
|
58
88
|
export type RenderConfig = {
|
|
89
|
+
/** `"stack"` renders one vertical column of groups; default `"board"`. */
|
|
90
|
+
layout?: "board" | "stack";
|
|
59
91
|
columnScroll?: boolean;
|
|
60
92
|
fixedColumnWidth?: boolean;
|
|
61
93
|
virtualizeCards?: boolean;
|
|
@@ -65,6 +97,24 @@ export type RenderConfig = {
|
|
|
65
97
|
columnOverscan?: number;
|
|
66
98
|
};
|
|
67
99
|
export type { KanbanCard, CardID, ColumnID };
|
|
100
|
+
/** Destination resolved by the widget; `before: null` appends to the cell. */
|
|
101
|
+
export type CardProjectionTarget = {
|
|
102
|
+
column: ColumnID;
|
|
103
|
+
swimlane?: SwimlaneID;
|
|
104
|
+
before: CardID | null;
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Application-owned external drag descriptor. The host sets `card` and
|
|
108
|
+
* `htmlEvent`; the widget writes `target` and destination membership into `card`.
|
|
109
|
+
*/
|
|
110
|
+
export type CardProjection = {
|
|
111
|
+
htmlEvent: {
|
|
112
|
+
clientX: number;
|
|
113
|
+
clientY: number;
|
|
114
|
+
} | null;
|
|
115
|
+
card: Partial<KanbanCard>;
|
|
116
|
+
target?: CardProjectionTarget | null;
|
|
117
|
+
};
|
|
68
118
|
type KanbanEventBus = EventBus<StoreActions, keyof StoreActions>;
|
|
69
119
|
type KanbanApi = {
|
|
70
120
|
getState: KanbanStore["getState"];
|
|
@@ -84,3 +134,15 @@ export type KanbanInstanceApi = KanbanApi & {
|
|
|
84
134
|
detach: KanbanEventBus["detach"];
|
|
85
135
|
getCards: KanbanStore["getCards"];
|
|
86
136
|
};
|
|
137
|
+
type WithoutDashes<T extends string> = T extends `${infer A}-${infer B}` ? `${A}${WithoutDashes<B>}` : T;
|
|
138
|
+
export type KanbanEventHandlers = {
|
|
139
|
+
[A in keyof StoreActions as `on${WithoutDashes<A>}`]?: (event: StoreActions[A]) => void;
|
|
140
|
+
};
|
|
141
|
+
export type GroupManagerProps = {
|
|
142
|
+
api?: KanbanInstanceApi | null;
|
|
143
|
+
placement?: "sidebar" | "modal" | "popup" | "inline";
|
|
144
|
+
parent?: HTMLElement;
|
|
145
|
+
swimlanes?: boolean;
|
|
146
|
+
readonly?: boolean;
|
|
147
|
+
onclose?: () => void;
|
|
148
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@svar-ui/svelte-kanban",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.7.0",
|
|
4
|
+
"description": "Customizable Svelte Kanban board component with drag-and-drop, filtering, custom cards, and live updates",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"drag-and-drop",
|
|
7
|
+
"kanban",
|
|
8
|
+
"kanban-board",
|
|
9
|
+
"kanban-component",
|
|
10
|
+
"project-management",
|
|
11
|
+
"svelte",
|
|
12
|
+
"svelte-kanban",
|
|
13
|
+
"svelte-kanban-board",
|
|
14
|
+
"svelte5",
|
|
15
|
+
"task-board",
|
|
16
|
+
"task-management",
|
|
17
|
+
"typescript"
|
|
18
|
+
],
|
|
5
19
|
"homepage": "https://svar.dev/svelte/kanban/",
|
|
6
20
|
"bugs": {
|
|
7
21
|
"url": "https://forum.svar.dev"
|
|
@@ -27,17 +41,17 @@
|
|
|
27
41
|
"./package.json": "./package.json"
|
|
28
42
|
},
|
|
29
43
|
"dependencies": {
|
|
30
|
-
"@svar-ui/core-locales": "2.6.
|
|
31
|
-
"@svar-ui/lib-dom": "0.
|
|
44
|
+
"@svar-ui/core-locales": "2.6.1",
|
|
45
|
+
"@svar-ui/lib-dom": "0.14.0",
|
|
32
46
|
"@svar-ui/lib-state": "1.9.7",
|
|
33
|
-
"@svar-ui/svelte-core": "2.6.
|
|
34
|
-
"@svar-ui/svelte-editor": "2.
|
|
35
|
-
"@svar-ui/svelte-menu": "2.6.
|
|
36
|
-
"@svar-ui/svelte-toolbar": "2.6.
|
|
47
|
+
"@svar-ui/svelte-core": "2.6.1",
|
|
48
|
+
"@svar-ui/svelte-editor": "2.7.0",
|
|
49
|
+
"@svar-ui/svelte-menu": "2.6.1",
|
|
50
|
+
"@svar-ui/svelte-toolbar": "2.6.1",
|
|
37
51
|
"svelte-check": "^4.4.6",
|
|
38
|
-
"@svar-ui/kanban-
|
|
39
|
-
"@svar-ui/kanban-
|
|
40
|
-
"@svar-ui/kanban-provider": "2.
|
|
52
|
+
"@svar-ui/kanban-locales": "2.7.0",
|
|
53
|
+
"@svar-ui/kanban-store": "2.7.0",
|
|
54
|
+
"@svar-ui/kanban-provider": "2.7.0"
|
|
41
55
|
},
|
|
42
56
|
"devDependencies": {
|
|
43
57
|
"@sveltejs/package": "^2.5.7",
|
package/readme.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
# SVAR Svelte Kanban
|
|
4
4
|
|
|
5
5
|
</div>
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
</div>
|
|
20
20
|
|
|
21
|
-
[SVAR Svelte Kanban](https://svar.dev/svelte/kanban/) is a customizable, interactive Kanban board component for Svelte and SvelteKit apps. It supports drag-and-drop, card editing, filtering, sorting, flexible layouts, and rich customization options. Use it to add clear visualization of tasks and project workflows.
|
|
21
|
+
[SVAR Svelte Kanban](https://svar.dev/svelte/kanban/) is a customizable, interactive Kanban board component for Svelte and SvelteKit apps. It supports drag-and-drop, card editing, filtering, sorting, flexible layouts, and rich customization options. Use it to add clear visualization of tasks and project workflows.
|
|
22
22
|
|
|
23
23
|
The kanban component comes with full TypeScript support, rich API, and easy CSS styling. The PRO Edition offers extra features for enterprise projects (see below).
|
|
24
24
|
|
|
@@ -28,23 +28,31 @@ The kanban component comes with full TypeScript support, rich API, and easy CSS
|
|
|
28
28
|
|
|
29
29
|
### ✨ Key Features
|
|
30
30
|
|
|
31
|
-
- Drag-and-drop cards between
|
|
31
|
+
- Drag-and-drop cards between and within columns
|
|
32
32
|
- Built-in card editor
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
33
|
+
- Card and column menus
|
|
34
|
+
- Toolbar
|
|
35
|
+
- Column summaries
|
|
36
|
+
- Card filtering, sorting, and grouping
|
|
36
37
|
- Custom card templates
|
|
37
38
|
- Localization
|
|
38
39
|
- Light and dark themes
|
|
40
|
+
- Stack layout for small screens
|
|
41
|
+
- REST data provider for backend integration
|
|
42
|
+
- Live multi-user updates
|
|
39
43
|
- Full TypeScript support
|
|
40
44
|
|
|
41
45
|
### 🚀 PRO Edition
|
|
42
46
|
|
|
43
47
|
SVAR Svelte Kanban is available in open-source and [PRO Editions](https://svar.dev/svelte/kanban/#pro). The PRO Edition offers extra features for enterprise projects:
|
|
44
48
|
|
|
45
|
-
-
|
|
49
|
+
- Swimlanes
|
|
50
|
+
- Group manager for columns and swimlanes
|
|
51
|
+
- Card grid – fixed-size tiles inside a column
|
|
52
|
+
- Drag-in from external lists
|
|
46
53
|
- Dynamic data loading
|
|
47
54
|
- Undo/redo
|
|
55
|
+
- Export to PDF, PNG, Excel
|
|
48
56
|
|
|
49
57
|
Visit the [pricing page](https://svar.dev/svelte/kanban/pricing/) for full feature comparison, licensing details, and **free trial**.
|
|
50
58
|
|
|
@@ -93,7 +101,7 @@ vp test
|
|
|
93
101
|
|
|
94
102
|
### ⭐ Show Your Support
|
|
95
103
|
|
|
96
|
-
If SVAR Svelte Kanban helps your project, [give us a star](https://github.com/svar-widgets/kanban/) to support us!
|
|
104
|
+
If SVAR Svelte Kanban helps your project, [give us a star](https://github.com/svar-widgets/kanban/) to support us!
|
|
97
105
|
|
|
98
106
|
### :speech_balloon: Need Help?
|
|
99
107
|
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
<script lang="ts">import { getContext, setContext } from "svelte";
|
|
2
|
-
import { ContextMenu } from "@svar-ui/svelte-menu";
|
|
3
|
-
import { getID, locale } from "@svar-ui/lib-dom";
|
|
4
|
-
import { en } from "@svar-ui/kanban-locales";
|
|
5
|
-
import { en as coreEn } from "@svar-ui/core-locales";
|
|
6
|
-
import { getMenuOptions } from "@svar-ui/kanban-store";
|
|
7
|
-
import { KANBAN_API_CONTEXT } from "../context.js";
|
|
8
|
-
let { options = [], api = null, resolver = null, filter = null, at = "point", children, onclick, css } = $props();
|
|
9
|
-
// when mounted inside <Kanban> the api context is available;
|
|
10
|
-
// when wrapping <Kanban> from the outside, caller must pass `api`
|
|
11
|
-
const ctxApi = getContext(KANBAN_API_CONTEXT);
|
|
12
|
-
function parseId(id) {
|
|
13
|
-
if (typeof id === "string" && id.startsWith(":")) {
|
|
14
|
-
const element = document.createElement("div");
|
|
15
|
-
element.setAttribute("data-id", id);
|
|
16
|
-
return getID(element);
|
|
17
|
-
}
|
|
18
|
-
return typeof id === "string" || typeof id === "number" ? id : null;
|
|
19
|
-
}
|
|
20
|
-
function getCardById(id) {
|
|
21
|
-
const cardId = parseId(id);
|
|
22
|
-
if (cardId == null) return undefined;
|
|
23
|
-
if (api) return api.getCards().find((c) => c.id === cardId);
|
|
24
|
-
return ctxApi?.getState().cards.getById(cardId);
|
|
25
|
-
}
|
|
26
|
-
function exec(action, payload) {
|
|
27
|
-
(api ?? ctxApi)?.exec(action, payload);
|
|
28
|
-
}
|
|
29
|
-
let activeId = null;
|
|
30
|
-
let l = getContext("wx-i18n");
|
|
31
|
-
if (!l) {
|
|
32
|
-
l = locale({
|
|
33
|
-
...en,
|
|
34
|
-
...coreEn
|
|
35
|
-
});
|
|
36
|
-
setContext("wx-i18n", l);
|
|
37
|
-
}
|
|
38
|
-
const _ = l.getGroup("kanban");
|
|
39
|
-
function applyLocale(opts) {
|
|
40
|
-
return opts.map((op) => {
|
|
41
|
-
op = { ...op };
|
|
42
|
-
if (op.text) op.text = _(op.text);
|
|
43
|
-
if (op.subtext) op.subtext = _(op.subtext);
|
|
44
|
-
if (op.data) op.data = applyLocale(op.data);
|
|
45
|
-
return op;
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
function getOptions() {
|
|
49
|
-
const base = options.length ? options : getMenuOptions();
|
|
50
|
-
return applyLocale(base);
|
|
51
|
-
}
|
|
52
|
-
function itemResolver(rawId, ev) {
|
|
53
|
-
if (rawId == null) return null;
|
|
54
|
-
const card = getCardById(rawId);
|
|
55
|
-
if (!card) return null;
|
|
56
|
-
if (resolver) {
|
|
57
|
-
const result = resolver(card, ev);
|
|
58
|
-
if (!result) return null;
|
|
59
|
-
}
|
|
60
|
-
activeId = card.id;
|
|
61
|
-
return card;
|
|
62
|
-
}
|
|
63
|
-
function menuAction(ev) {
|
|
64
|
-
const action = ev?.action;
|
|
65
|
-
if (!action) return;
|
|
66
|
-
const id = typeof activeId === "object" ? activeId.id : activeId;
|
|
67
|
-
if (action.id === "edit-card") {
|
|
68
|
-
exec("select-card", { id });
|
|
69
|
-
} else if (action.id === "duplicate-card") {
|
|
70
|
-
exec("duplicate-card", { id });
|
|
71
|
-
} else if (action.id === "delete-card") {
|
|
72
|
-
exec("delete-card", { id });
|
|
73
|
-
}
|
|
74
|
-
onclick?.(ev);
|
|
75
|
-
}
|
|
76
|
-
function filterMenu(item, card) {
|
|
77
|
-
return filter ? filter(item, card) : true;
|
|
78
|
-
}
|
|
79
|
-
const cOptions = $derived(getOptions());
|
|
80
|
-
let menu = $state();
|
|
81
|
-
export function show(ev, obj) {
|
|
82
|
-
menu.show(ev, obj);
|
|
83
|
-
}
|
|
84
|
-
</script>
|
|
85
|
-
|
|
86
|
-
<ContextMenu
|
|
87
|
-
filter={filterMenu}
|
|
88
|
-
options={cOptions}
|
|
89
|
-
dataKey="id"
|
|
90
|
-
resolver={itemResolver}
|
|
91
|
-
onclick={menuAction}
|
|
92
|
-
{css}
|
|
93
|
-
{at}
|
|
94
|
-
bind:this={menu}
|
|
95
|
-
/>
|
|
96
|
-
{#if children}
|
|
97
|
-
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
98
|
-
<span oncontextmenu={menu?.show} data-menu-ignore="true">
|
|
99
|
-
{@render children?.()}
|
|
100
|
-
</span>
|
|
101
|
-
{/if}
|
|
102
|
-
|
|
103
|
-
<style>
|
|
104
|
-
:global(.wx-menu .wx-option.wx-disabled) {
|
|
105
|
-
pointer-events: none;
|
|
106
|
-
}
|
|
107
|
-
:global(.wx-menu .wx-option.wx-disabled .wx-value),
|
|
108
|
-
:global(.wx-menu .wx-option.wx-disabled .wx-icon) {
|
|
109
|
-
color: var(--wx-color-font-disabled);
|
|
110
|
-
}
|
|
111
|
-
</style>
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { Snippet } from "svelte";
|
|
2
|
-
import { ContextMenu } from "@svar-ui/svelte-menu";
|
|
3
|
-
import type { KanbanCard, KanbanInstanceApi } from "../types.js";
|
|
4
|
-
type Props = {
|
|
5
|
-
options?: any[];
|
|
6
|
-
api?: KanbanInstanceApi | null;
|
|
7
|
-
resolver?: ((card: KanbanCard, ev: MouseEvent) => any) | null;
|
|
8
|
-
filter?: ((item: any, card: KanbanCard) => boolean) | null;
|
|
9
|
-
at?: string;
|
|
10
|
-
children?: Snippet;
|
|
11
|
-
onclick?: (e: any) => void;
|
|
12
|
-
css?: string;
|
|
13
|
-
};
|
|
14
|
-
declare const ContextMenu: import("svelte").Component<Props, {
|
|
15
|
-
show: (ev: any, obj?: any) => void;
|
|
16
|
-
}, "">;
|
|
17
|
-
type ContextMenu = ReturnType<typeof ContextMenu>;
|
|
18
|
-
export default ContextMenu;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
<script lang="ts">import { getContext } from "svelte";
|
|
2
|
-
import { KANBAN_API_CONTEXT } from "../context.js";
|
|
3
|
-
let { cardCss, columnCss, cardContent: CardContent, cardShape } = $props();
|
|
4
|
-
const store = getContext(KANBAN_API_CONTEXT);
|
|
5
|
-
const viewData = store.getReactiveState().viewData;
|
|
6
|
-
let root = $state();
|
|
7
|
-
$effect(() => {
|
|
8
|
-
const out = {};
|
|
9
|
-
if (CardContent) {
|
|
10
|
-
const c = {};
|
|
11
|
-
root.querySelectorAll(".wx-ex-cell").forEach((element) => {
|
|
12
|
-
c[element.dataset.id] = element.innerHTML;
|
|
13
|
-
});
|
|
14
|
-
out.cardContent = c;
|
|
15
|
-
}
|
|
16
|
-
const cs = {};
|
|
17
|
-
if (cardCss) {
|
|
18
|
-
$viewData.columns.forEach((column) => {
|
|
19
|
-
column.cards.forEach((card) => {
|
|
20
|
-
cs[card.id.toString()] = cardCss(card, column);
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
out.cardCss = cs;
|
|
24
|
-
}
|
|
25
|
-
const cls = {};
|
|
26
|
-
if (columnCss) {
|
|
27
|
-
$viewData.columns.forEach((column) => {
|
|
28
|
-
cls[column.id.toString()] = columnCss(column.cards, column);
|
|
29
|
-
});
|
|
30
|
-
out.columnCss = cls;
|
|
31
|
-
}
|
|
32
|
-
store.exec("export-data", {
|
|
33
|
-
format: "inner",
|
|
34
|
-
data: out
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
</script>
|
|
38
|
-
|
|
39
|
-
<div style="visibility: hidden;position:absolute;" bind:this={root}>
|
|
40
|
-
{#if CardContent}
|
|
41
|
-
{#each $viewData.columns as column}
|
|
42
|
-
{#each column.cards as card}
|
|
43
|
-
<div class="wx-ex-cell" data-id={card.id} >
|
|
44
|
-
<CardContent
|
|
45
|
-
{card}
|
|
46
|
-
{cardShape}
|
|
47
|
-
></CardContent>
|
|
48
|
-
</div>
|
|
49
|
-
{/each}
|
|
50
|
-
{/each}
|
|
51
|
-
{/if}
|
|
52
|
-
</div>
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { CardCssFn, ColumnCssFn, CardShape } from "../types.js";
|
|
2
|
-
import type { Component } from "svelte";
|
|
3
|
-
import type { KanbanCard } from "@svar-ui/kanban-store";
|
|
4
|
-
type Props = {
|
|
5
|
-
cardShape: CardShape;
|
|
6
|
-
cardCss?: CardCssFn;
|
|
7
|
-
columnCss?: ColumnCssFn;
|
|
8
|
-
cardContent?: Component<{
|
|
9
|
-
card: KanbanCard;
|
|
10
|
-
cardShape: CardShape;
|
|
11
|
-
}>;
|
|
12
|
-
};
|
|
13
|
-
declare const ExportLayout: Component<Props, {}, "">;
|
|
14
|
-
type ExportLayout = ReturnType<typeof ExportLayout>;
|
|
15
|
-
export default ExportLayout;
|
package/dist/export/Card.svelte
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export default Card;
|
|
2
|
-
type Card = {
|
|
3
|
-
$on?(type: string, callback: (e: any) => void): () => void;
|
|
4
|
-
$set?(props: Partial<$$ComponentProps>): void;
|
|
5
|
-
};
|
|
6
|
-
declare const Card: import("svelte").Component<{
|
|
7
|
-
card: any;
|
|
8
|
-
}, {}, "">;
|
|
9
|
-
type $$ComponentProps = {
|
|
10
|
-
card: any;
|
|
11
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import Willow from "../themes/Willow.svelte";
|
|
3
|
-
import WillowDark from "../themes/WillowDark.svelte";
|
|
4
|
-
import Print from "../themes/Print.svelte";
|
|
5
|
-
import PrintBW from "../themes/PrintBW.svelte";
|
|
6
|
-
import Kanban from "../components/Kanban.svelte";
|
|
7
|
-
import Card from "./Card.svelte";
|
|
8
|
-
|
|
9
|
-
const { skin, config = {}, htmlMode } = $props();
|
|
10
|
-
const cardContent = $derived(htmlMode ? Card : undefined);
|
|
11
|
-
|
|
12
|
-
</script>
|
|
13
|
-
|
|
14
|
-
{#if skin === "willow-dark" || skin === "dark"}
|
|
15
|
-
<WillowDark>
|
|
16
|
-
<Kanban {...config} {cardContent} />
|
|
17
|
-
</WillowDark>
|
|
18
|
-
{:else if skin === "print"}
|
|
19
|
-
<Print>
|
|
20
|
-
<Kanban {...config} {cardContent} />
|
|
21
|
-
</Print>
|
|
22
|
-
{:else if skin === "bw"}
|
|
23
|
-
<PrintBW>
|
|
24
|
-
<Kanban {...config} {cardContent} />
|
|
25
|
-
</PrintBW>
|
|
26
|
-
{:else}
|
|
27
|
-
<Willow>
|
|
28
|
-
<Kanban {...config} {cardContent} />
|
|
29
|
-
</Willow>
|
|
30
|
-
{/if}
|