@dxos/plugin-kanban 0.8.4-main.c4373fc → 0.8.4-main.c85a9c8dae
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/lib/browser/KanbanContainer-BCXSJ6KS.mjs +304 -0
- package/dist/lib/browser/KanbanContainer-BCXSJ6KS.mjs.map +7 -0
- package/dist/lib/browser/KanbanViewEditor-IH5CJ6BW.mjs +66 -0
- package/dist/lib/browser/KanbanViewEditor-IH5CJ6BW.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-HFEKGFJK.mjs +17 -0
- package/dist/lib/browser/blueprint-definition-HFEKGFJK.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +8 -0
- package/dist/lib/browser/blueprints/index.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/browser/chunk-QSWCFMEB.mjs +385 -0
- package/dist/lib/browser/chunk-QSWCFMEB.mjs.map +7 -0
- package/dist/lib/browser/chunk-RNFIFE2P.mjs +213 -0
- package/dist/lib/browser/chunk-RNFIFE2P.mjs.map +7 -0
- package/dist/lib/browser/chunk-TLYZSC7O.mjs +29 -0
- package/dist/lib/browser/chunk-TLYZSC7O.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +65 -68
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-BRA2OHUE.mjs +162 -0
- package/dist/lib/browser/operation-resolver-BRA2OHUE.mjs.map +7 -0
- package/dist/lib/browser/react-surface-FOMOGFVW.mjs +99 -0
- package/dist/lib/browser/react-surface-FOMOGFVW.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +14 -5
- package/dist/lib/node-esm/KanbanContainer-EHRTLE7M.mjs +305 -0
- package/dist/lib/node-esm/KanbanContainer-EHRTLE7M.mjs.map +7 -0
- package/dist/lib/node-esm/KanbanViewEditor-WDACFC35.mjs +67 -0
- package/dist/lib/node-esm/KanbanViewEditor-WDACFC35.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-NARBX32U.mjs +18 -0
- package/dist/lib/node-esm/blueprint-definition-NARBX32U.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +9 -0
- package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-4AWDHQVY.mjs +214 -0
- package/dist/lib/node-esm/chunk-4AWDHQVY.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-CSL3HF2X.mjs +386 -0
- package/dist/lib/node-esm/chunk-CSL3HF2X.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-X3UJUQIV.mjs +31 -0
- package/dist/lib/node-esm/chunk-X3UJUQIV.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +65 -68
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/operation-resolver-UEQ64LCN.mjs +163 -0
- package/dist/lib/node-esm/operation-resolver-UEQ64LCN.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-AITKFRBE.mjs +100 -0
- package/dist/lib/node-esm/react-surface-AITKFRBE.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +14 -5
- package/dist/types/src/KanbanPlugin.d.ts +2 -1
- package/dist/types/src/KanbanPlugin.d.ts.map +1 -1
- package/dist/types/src/blueprints/index.d.ts +2 -0
- package/dist/types/src/blueprints/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/kanban-blueprint.d.ts +4 -0
- package/dist/types/src/blueprints/kanban-blueprint.d.ts.map +1 -0
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts +12 -0
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/artifact-definition/index.d.ts +3 -0
- package/dist/types/src/capabilities/artifact-definition/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +6 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +3 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +3 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/components/KanbanBoard/KanbanBoard.d.ts +58 -0
- package/dist/types/src/components/KanbanBoard/KanbanBoard.d.ts.map +1 -0
- package/dist/types/src/components/KanbanBoard/KanbanBoard.stories.d.ts +70 -0
- package/dist/types/src/components/KanbanBoard/KanbanBoard.stories.d.ts.map +1 -0
- package/dist/types/src/components/KanbanBoard/KanbanCard.d.ts +10 -0
- package/dist/types/src/components/KanbanBoard/KanbanCard.d.ts.map +1 -0
- package/dist/types/src/components/KanbanBoard/KanbanColumn.d.ts +9 -0
- package/dist/types/src/components/KanbanBoard/KanbanColumn.d.ts.map +1 -0
- package/dist/types/src/components/KanbanBoard/index.d.ts +2 -0
- package/dist/types/src/components/KanbanBoard/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +1 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/KanbanContainer/KanbanContainer.d.ts +6 -0
- package/dist/types/src/containers/KanbanContainer/KanbanContainer.d.ts.map +1 -0
- package/dist/types/src/containers/KanbanContainer/KanbanContainer.stories.d.ts +77 -0
- package/dist/types/src/containers/KanbanContainer/KanbanContainer.stories.d.ts.map +1 -0
- package/dist/types/src/containers/KanbanContainer/index.d.ts +3 -0
- package/dist/types/src/containers/KanbanContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/KanbanViewEditor/KanbanViewEditor.d.ts +6 -0
- package/dist/types/src/containers/KanbanViewEditor/KanbanViewEditor.d.ts.map +1 -0
- package/dist/types/src/containers/KanbanViewEditor/index.d.ts +3 -0
- package/dist/types/src/containers/KanbanViewEditor/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +4 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +6 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -0
- package/dist/types/src/hooks/useEchoChangeCallback.d.ts +13 -0
- package/dist/types/src/hooks/useEchoChangeCallback.d.ts.map +1 -0
- package/dist/types/src/hooks/useKanbanBoardModel.d.ts +16 -0
- package/dist/types/src/hooks/useKanbanBoardModel.d.ts.map +1 -0
- package/dist/types/src/hooks/useKanbanBoardModel.test.d.ts +2 -0
- package/dist/types/src/hooks/useKanbanBoardModel.test.d.ts.map +1 -0
- package/dist/types/src/hooks/useKanbanColumnEventHandler.d.ts +22 -0
- package/dist/types/src/hooks/useKanbanColumnEventHandler.d.ts.map +1 -0
- package/dist/types/src/hooks/useKanbanItemEventHandler.d.ts +19 -0
- package/dist/types/src/hooks/useKanbanItemEventHandler.d.ts.map +1 -0
- package/dist/types/src/hooks/useProjectionModel.d.ts +15 -0
- package/dist/types/src/hooks/useProjectionModel.d.ts.map +1 -0
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/playwright/board-manager.d.ts +5 -0
- package/dist/types/src/playwright/board-manager.d.ts.map +1 -0
- package/dist/types/src/playwright/playwright.config.d.ts +3 -0
- package/dist/types/src/playwright/playwright.config.d.ts.map +1 -0
- package/dist/types/src/playwright/smoke.spec.d.ts +2 -0
- package/dist/types/src/playwright/smoke.spec.d.ts.map +1 -0
- package/dist/types/src/testing/KanbanCardTileSimple.d.ts +5 -0
- package/dist/types/src/testing/KanbanCardTileSimple.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +2 -0
- package/dist/types/src/testing/index.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +35 -9
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Kanban.d.ts +37 -0
- package/dist/types/src/types/Kanban.d.ts.map +1 -0
- package/dist/types/src/types/constants.d.ts +6 -0
- package/dist/types/src/types/constants.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +2 -0
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +98 -43
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +28 -0
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/util/arrangement.d.ts +68 -0
- package/dist/types/src/util/arrangement.d.ts.map +1 -0
- package/dist/types/src/util/arrangement.test.d.ts +2 -0
- package/dist/types/src/util/arrangement.test.d.ts.map +1 -0
- package/dist/types/src/util/index.d.ts +2 -0
- package/dist/types/src/util/index.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +67 -46
- package/src/KanbanPlugin.tsx +35 -54
- package/src/blueprints/index.ts +5 -0
- package/src/blueprints/kanban-blueprint.ts +31 -0
- package/src/capabilities/artifact-definition/artifact-definition.ts +151 -0
- package/src/capabilities/artifact-definition/index.ts +7 -0
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +17 -0
- package/src/capabilities/blueprint-definition/index.ts +7 -0
- package/src/capabilities/index.ts +3 -5
- package/src/capabilities/operation-resolver/index.ts +7 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +133 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +86 -0
- package/src/components/KanbanBoard/KanbanBoard.stories.tsx +142 -0
- package/src/components/KanbanBoard/KanbanBoard.tsx +184 -0
- package/src/components/KanbanBoard/KanbanCard.tsx +87 -0
- package/src/components/KanbanBoard/KanbanColumn.tsx +69 -0
- package/src/components/KanbanBoard/index.ts +5 -0
- package/src/components/index.ts +1 -2
- package/src/containers/KanbanContainer/KanbanContainer.stories.tsx +263 -0
- package/src/containers/KanbanContainer/KanbanContainer.tsx +87 -0
- package/src/containers/KanbanContainer/index.ts +7 -0
- package/src/containers/KanbanViewEditor/KanbanViewEditor.tsx +63 -0
- package/src/containers/KanbanViewEditor/index.ts +7 -0
- package/src/containers/index.ts +8 -0
- package/src/hooks/index.ts +9 -0
- package/src/hooks/useEchoChangeCallback.ts +30 -0
- package/src/hooks/useKanbanBoardModel.test.ts +235 -0
- package/src/hooks/useKanbanBoardModel.ts +143 -0
- package/src/hooks/useKanbanColumnEventHandler.ts +106 -0
- package/src/hooks/useKanbanItemEventHandler.ts +133 -0
- package/src/hooks/useProjectionModel.ts +58 -0
- package/src/meta.ts +8 -4
- package/src/playwright/board-manager.ts +13 -0
- package/src/playwright/playwright.config.ts +19 -0
- package/src/playwright/smoke.spec.ts +107 -0
- package/src/testing/KanbanCardTileSimple.tsx +76 -0
- package/src/testing/index.ts +5 -0
- package/src/translations.ts +13 -6
- package/src/types/Kanban.ts +67 -0
- package/src/types/constants.ts +9 -0
- package/src/types/index.ts +2 -0
- package/src/types/schema.ts +84 -38
- package/src/types/types.ts +35 -0
- package/src/util/arrangement.test.ts +208 -0
- package/src/util/arrangement.ts +167 -0
- package/src/util/index.ts +5 -0
- package/dist/lib/browser/blueprint-definition-UYVX622Q.mjs +0 -28
- package/dist/lib/browser/blueprint-definition-UYVX622Q.mjs.map +0 -7
- package/dist/lib/browser/chunk-K7KYFJ3P.mjs +0 -80
- package/dist/lib/browser/chunk-K7KYFJ3P.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-LR3SDMKQ.mjs +0 -111
- package/dist/lib/browser/intent-resolver-LR3SDMKQ.mjs.map +0 -7
- package/dist/lib/browser/react-surface-R2ORFB43.mjs +0 -255
- package/dist/lib/browser/react-surface-R2ORFB43.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-42P47FUY.mjs +0 -30
- package/dist/lib/node-esm/blueprint-definition-42P47FUY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VDWYSHP4.mjs +0 -82
- package/dist/lib/node-esm/chunk-VDWYSHP4.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-CKDNVLND.mjs +0 -112
- package/dist/lib/node-esm/intent-resolver-CKDNVLND.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-RMRLHCOY.mjs +0 -256
- package/dist/lib/node-esm/react-surface-RMRLHCOY.mjs.map +0 -7
- package/dist/types/src/capabilities/artifact-definition.d.ts +0 -11
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +0 -5
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/components/KanbanContainer.d.ts +0 -7
- package/dist/types/src/components/KanbanContainer.d.ts.map +0 -1
- package/dist/types/src/components/KanbanContainer.stories.d.ts +0 -41
- package/dist/types/src/components/KanbanContainer.stories.d.ts.map +0 -1
- package/dist/types/src/components/KanbanViewEditor.d.ts +0 -8
- package/dist/types/src/components/KanbanViewEditor.d.ts.map +0 -1
- package/src/capabilities/artifact-definition.ts +0 -148
- package/src/capabilities/blueprint-definition.ts +0 -30
- package/src/capabilities/intent-resolver.ts +0 -71
- package/src/capabilities/react-surface.tsx +0 -84
- package/src/components/KanbanContainer.stories.tsx +0 -193
- package/src/components/KanbanContainer.tsx +0 -95
- package/src/components/KanbanViewEditor.tsx +0 -64
package/src/meta.ts
CHANGED
|
@@ -2,14 +2,18 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { trim } from '@dxos/util';
|
|
6
7
|
|
|
7
|
-
export const meta:
|
|
8
|
+
export const meta: Plugin.Meta = {
|
|
8
9
|
id: 'dxos.org/plugin/kanban',
|
|
9
10
|
name: 'Kanban',
|
|
10
|
-
description:
|
|
11
|
-
|
|
11
|
+
description: trim`
|
|
12
|
+
Visual project management using customizable kanban boards to track workflow progress.
|
|
13
|
+
Organize table data into columns, drag and drop items between stages, and trigger automations based on status changes.
|
|
14
|
+
`,
|
|
12
15
|
icon: 'ph--kanban--regular',
|
|
16
|
+
iconHue: 'green',
|
|
13
17
|
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-kanban',
|
|
14
18
|
screenshots: ['https://dxos.network/plugin-details-kanban-dark.png'],
|
|
15
19
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { BoardManager as MosaicBoardManager } from '@dxos/react-ui-mosaic/playwright';
|
|
6
|
+
|
|
7
|
+
export class BoardManager extends MosaicBoardManager {
|
|
8
|
+
async waitUntilReady(): Promise<void> {
|
|
9
|
+
await this.columns().first().waitFor({ state: 'visible' });
|
|
10
|
+
await this.columns().nth(2).waitFor({ state: 'visible' });
|
|
11
|
+
await this.column(1).items().first().waitFor({ state: 'visible' });
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { defineConfig } from '@playwright/test';
|
|
6
|
+
|
|
7
|
+
import { e2ePreset } from '@dxos/test-utils/playwright';
|
|
8
|
+
|
|
9
|
+
export default defineConfig({
|
|
10
|
+
...e2ePreset(import.meta.dirname),
|
|
11
|
+
// TODO(wittjosiah): Stories are slow to start up.
|
|
12
|
+
timeout: 60_000,
|
|
13
|
+
// TODO(wittjosiah): Avoid hard-coding ports.
|
|
14
|
+
webServer: {
|
|
15
|
+
command: 'pnpm storybook dev --ci --quiet --port=9011 --config-dir=.storybook',
|
|
16
|
+
port: 9011,
|
|
17
|
+
reuseExistingServer: false,
|
|
18
|
+
},
|
|
19
|
+
});
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Page, expect, test } from '@playwright/test';
|
|
6
|
+
|
|
7
|
+
import { setupPage, storybookUrl } from '@dxos/test-utils/playwright';
|
|
8
|
+
|
|
9
|
+
import { BoardManager } from './board-manager';
|
|
10
|
+
|
|
11
|
+
const PORT = 9011;
|
|
12
|
+
const STORY_URL = storybookUrl('plugins-plugin-kanban-containers-kanban--mutable-schema', PORT);
|
|
13
|
+
|
|
14
|
+
test.describe('Kanban MutableSchema', () => {
|
|
15
|
+
let page: Page;
|
|
16
|
+
let board: BoardManager;
|
|
17
|
+
|
|
18
|
+
test.beforeEach(async ({ browser }) => {
|
|
19
|
+
// Larger viewport to avoid triggering scroll-assist behaviour on simple drag operations.
|
|
20
|
+
({ page } = await setupPage(browser, { url: STORY_URL, viewportSize: { width: 1920, height: 1080 } }));
|
|
21
|
+
board = new BoardManager(page.locator('body'));
|
|
22
|
+
await board.waitUntilReady();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test.afterEach(async () => {
|
|
26
|
+
await page.close();
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test('rearrange columns', async () => {
|
|
30
|
+
const col1Label = await board.column(1).title().textContent();
|
|
31
|
+
const col2Label = await board.column(2).title().textContent();
|
|
32
|
+
expect(col1Label).not.toBeNull();
|
|
33
|
+
expect(col2Label).not.toBeNull();
|
|
34
|
+
|
|
35
|
+
await board.column(1).dragTo(board.column(2).header());
|
|
36
|
+
|
|
37
|
+
await expect(board.column(1).title()).toHaveText(col2Label!);
|
|
38
|
+
await expect(board.column(2).title()).toHaveText(col1Label!);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test('rearrange within column', async () => {
|
|
42
|
+
// Column 0 is uncategorized (empty). Use column 1 (first status column).
|
|
43
|
+
const column = board.column(1);
|
|
44
|
+
const countBefore = await column.items().count();
|
|
45
|
+
|
|
46
|
+
const firstLabel = await column.item(0).title().textContent();
|
|
47
|
+
const secondLabel = await column.item(1).title().textContent();
|
|
48
|
+
expect(firstLabel).not.toBeNull();
|
|
49
|
+
expect(secondLabel).not.toBeNull();
|
|
50
|
+
|
|
51
|
+
// Drag first item below the second item.
|
|
52
|
+
await column.item(0).dragTo(column.item(1).locator, { x: 0, y: 200 });
|
|
53
|
+
|
|
54
|
+
// Item count should stay the same.
|
|
55
|
+
await expect(column.items()).toHaveCount(countBefore);
|
|
56
|
+
|
|
57
|
+
// The first item should now be what was previously the second item.
|
|
58
|
+
await expect(column.item(0).title()).toHaveText(secondLabel!);
|
|
59
|
+
|
|
60
|
+
// The original first item should now be at index 1.
|
|
61
|
+
await expect(column.item(1).title()).toHaveText(firstLabel!);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test('drag to beginning of another column', async () => {
|
|
65
|
+
// Column 0 is uncategorized (empty). Use columns 1 and 2 (both have items).
|
|
66
|
+
const col1 = board.column(1);
|
|
67
|
+
const col2 = board.column(2);
|
|
68
|
+
|
|
69
|
+
const col1CountBefore = await col1.items().count();
|
|
70
|
+
const col2CountBefore = await col2.items().count();
|
|
71
|
+
const draggedLabel = await col1.item(0).title().textContent();
|
|
72
|
+
expect(draggedLabel).not.toBeNull();
|
|
73
|
+
|
|
74
|
+
// Drop above first item. Kanban cards are taller; use larger negative y so we land in top half.
|
|
75
|
+
await col1.item(0).dragTo(col2.item(0).locator, { x: 0, y: -30 });
|
|
76
|
+
|
|
77
|
+
await expect(col1.items()).toHaveCount(col1CountBefore - 1);
|
|
78
|
+
await expect(col2.items()).toHaveCount(col2CountBefore + 1);
|
|
79
|
+
await expect(col2.item(0).title()).toHaveText(draggedLabel!);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
test('drag into empty column', async () => {
|
|
83
|
+
// Uncategorized is column 0 (empty); first populated column is at index 1.
|
|
84
|
+
const emptyColumn = board.column(0);
|
|
85
|
+
const sourceColumn = board.column(1);
|
|
86
|
+
|
|
87
|
+
const sourceCountBefore = await sourceColumn.items().count();
|
|
88
|
+
const draggedLabel = await sourceColumn.item(0).title().textContent();
|
|
89
|
+
expect(draggedLabel).not.toBeNull();
|
|
90
|
+
|
|
91
|
+
await sourceColumn.item(0).dragTo(emptyColumn.header(), { x: 0, y: 40 });
|
|
92
|
+
|
|
93
|
+
await expect(sourceColumn.items()).toHaveCount(sourceCountBefore - 1);
|
|
94
|
+
await expect(emptyColumn.items()).toHaveCount(1);
|
|
95
|
+
await expect(emptyColumn.item(0).title()).toHaveText(draggedLabel!);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
test('create new item', async () => {
|
|
99
|
+
// Use first populated column.
|
|
100
|
+
const column = board.column(1);
|
|
101
|
+
const countBefore = await column.items().count();
|
|
102
|
+
|
|
103
|
+
await column.addItem();
|
|
104
|
+
|
|
105
|
+
await expect(column.items()).toHaveCount(countBefore + 1);
|
|
106
|
+
});
|
|
107
|
+
});
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { forwardRef, useCallback, useMemo, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { Obj } from '@dxos/echo';
|
|
8
|
+
import { Card, Toolbar, useTranslation } from '@dxos/react-ui';
|
|
9
|
+
import { Menu, createMenuAction } from '@dxos/react-ui-menu';
|
|
10
|
+
import { Focus, Mosaic, useBoard } from '@dxos/react-ui-mosaic';
|
|
11
|
+
|
|
12
|
+
import { type KanbanCardProps, useKanbanBoard } from '../components';
|
|
13
|
+
import { meta } from '../meta';
|
|
14
|
+
|
|
15
|
+
const KANBAN_CARD_TILE_SIMPLE_NAME = 'KanbanCardTileSimple';
|
|
16
|
+
|
|
17
|
+
/** Card tile without Surface; for stories and tests when plugin manager is not available. */
|
|
18
|
+
export const KanbanCardTileSimple = forwardRef<HTMLDivElement, KanbanCardProps>(
|
|
19
|
+
({ data, location, debug }, forwardedRef) => {
|
|
20
|
+
const { t } = useTranslation(meta.id);
|
|
21
|
+
const { model } = useBoard(KANBAN_CARD_TILE_SIMPLE_NAME);
|
|
22
|
+
const { onCardRemove } = useKanbanBoard(KANBAN_CARD_TILE_SIMPLE_NAME);
|
|
23
|
+
const [dragHandle, setDragHandle] = useState<HTMLButtonElement | null>(null);
|
|
24
|
+
const dragHandleRef = useCallback((el: HTMLButtonElement | null) => setDragHandle(el), []);
|
|
25
|
+
|
|
26
|
+
const menuItems = useMemo(
|
|
27
|
+
() =>
|
|
28
|
+
onCardRemove
|
|
29
|
+
? [
|
|
30
|
+
createMenuAction('remove', () => onCardRemove(data), {
|
|
31
|
+
label: t('remove card label'),
|
|
32
|
+
icon: 'ph--trash--regular',
|
|
33
|
+
}),
|
|
34
|
+
]
|
|
35
|
+
: [],
|
|
36
|
+
[onCardRemove, data, t],
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<Mosaic.Tile
|
|
41
|
+
asChild
|
|
42
|
+
id={model.getItemId(data)}
|
|
43
|
+
data={data}
|
|
44
|
+
location={location}
|
|
45
|
+
debug={debug}
|
|
46
|
+
dragHandle={dragHandle}
|
|
47
|
+
>
|
|
48
|
+
<Focus.Group asChild>
|
|
49
|
+
<Menu.Root>
|
|
50
|
+
<Card.Root ref={forwardedRef} data-testid='board-item'>
|
|
51
|
+
<Card.Toolbar>
|
|
52
|
+
<Card.DragHandle ref={dragHandleRef} />
|
|
53
|
+
<Card.Title>{Obj.getLabel(data)}</Card.Title>
|
|
54
|
+
{/* TODO(wittjosiah): Reconcile with Card.Menu. */}
|
|
55
|
+
<Menu.Trigger asChild disabled={!menuItems?.length}>
|
|
56
|
+
<Toolbar.IconButton
|
|
57
|
+
iconOnly
|
|
58
|
+
variant='ghost'
|
|
59
|
+
icon='ph--dots-three-vertical--regular'
|
|
60
|
+
label={t('action menu label')}
|
|
61
|
+
/>
|
|
62
|
+
</Menu.Trigger>
|
|
63
|
+
<Menu.Content items={menuItems} />
|
|
64
|
+
</Card.Toolbar>
|
|
65
|
+
<Card.Content>
|
|
66
|
+
<div className='p-2 text-sm text-fg'>{Obj.getLabel(data)}</div>
|
|
67
|
+
</Card.Content>
|
|
68
|
+
</Card.Root>
|
|
69
|
+
</Menu.Root>
|
|
70
|
+
</Focus.Group>
|
|
71
|
+
</Mosaic.Tile>
|
|
72
|
+
);
|
|
73
|
+
},
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
KanbanCardTileSimple.displayName = KANBAN_CARD_TILE_SIMPLE_NAME;
|
package/src/translations.ts
CHANGED
|
@@ -2,34 +2,41 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { Type } from '@dxos/echo';
|
|
5
6
|
import { type Resource } from '@dxos/react-ui';
|
|
6
|
-
import { Kanban } from '@dxos/react-ui-kanban/types';
|
|
7
7
|
|
|
8
8
|
import { meta } from './meta';
|
|
9
|
+
import { Kanban } from './types';
|
|
9
10
|
|
|
10
11
|
export const translations = [
|
|
11
12
|
{
|
|
12
13
|
'en-US': {
|
|
13
|
-
[Kanban.Kanban
|
|
14
|
+
[Type.getTypename(Kanban.Kanban)]: {
|
|
14
15
|
'typename label': 'Kanban',
|
|
15
16
|
'typename label_zero': 'Kanbans',
|
|
16
17
|
'typename label_one': 'Kanban',
|
|
17
18
|
'typename label_other': 'Kanbans',
|
|
18
19
|
'object name placeholder': 'New kanban',
|
|
20
|
+
'rename object label': 'Rename kanban',
|
|
21
|
+
'delete object label': 'Delete kanban',
|
|
22
|
+
'object deleted label': 'Kanban deleted',
|
|
19
23
|
},
|
|
20
24
|
[meta.id]: {
|
|
25
|
+
'action menu label': 'Actions',
|
|
21
26
|
'plugin name': 'Kanban',
|
|
22
27
|
'kanban title label': 'Title',
|
|
23
28
|
'column title label': 'Column title',
|
|
24
29
|
'column title placeholder': 'New column',
|
|
25
|
-
'item title label': 'Item title',
|
|
26
|
-
'item title placeholder': 'New item',
|
|
27
30
|
'add column label': 'Add column',
|
|
28
|
-
'add
|
|
31
|
+
'add card label': 'Add card',
|
|
32
|
+
'new column name label': 'New column name',
|
|
33
|
+
'remove card label': 'Remove card',
|
|
34
|
+
'remove empty column label': 'Remove empty column',
|
|
35
|
+
'column drag handle label': 'Drag to rearrange',
|
|
29
36
|
'delete column label': 'Delete column',
|
|
30
|
-
'delete item label': 'Delete card',
|
|
31
37
|
'card field deleted label': 'Card field deleted',
|
|
32
38
|
'card deleted label': 'Card deleted',
|
|
39
|
+
'select pivot placeholder': 'Select a pivot column in board settings to display columns.',
|
|
33
40
|
},
|
|
34
41
|
},
|
|
35
42
|
},
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
|
|
7
|
+
import { Obj, Ref, Type } from '@dxos/echo';
|
|
8
|
+
import { View } from '@dxos/echo';
|
|
9
|
+
import { FormInputAnnotation, LabelAnnotation } from '@dxos/echo/internal';
|
|
10
|
+
import { ViewAnnotation } from '@dxos/schema';
|
|
11
|
+
|
|
12
|
+
/** Per-column entry (ids order, optional hidden). */
|
|
13
|
+
const ArrangementColumnEntry = Schema.Struct({
|
|
14
|
+
ids: Schema.Array(Obj.ID),
|
|
15
|
+
hidden: Schema.optional(Schema.Boolean),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
/** Keyed by columnValue. */
|
|
19
|
+
const ArrangementColumns = Schema.Record({
|
|
20
|
+
key: Schema.String,
|
|
21
|
+
value: ArrangementColumnEntry,
|
|
22
|
+
}).pipe(FormInputAnnotation.set(false));
|
|
23
|
+
|
|
24
|
+
/** Column order and per-column card ids. */
|
|
25
|
+
export const Arrangement = Schema.Struct({
|
|
26
|
+
order: Schema.Array(Schema.String).pipe(FormInputAnnotation.set(false)),
|
|
27
|
+
columns: ArrangementColumns,
|
|
28
|
+
}).pipe(FormInputAnnotation.set(false));
|
|
29
|
+
|
|
30
|
+
export type Arrangement = Schema.Schema.Type<typeof Arrangement>;
|
|
31
|
+
|
|
32
|
+
export const Kanban = Schema.Struct({
|
|
33
|
+
name: Schema.optional(Schema.String),
|
|
34
|
+
|
|
35
|
+
view: Ref.Ref(View.View).pipe(FormInputAnnotation.set(false)),
|
|
36
|
+
|
|
37
|
+
/** Column display order and per-column card ids. */
|
|
38
|
+
arrangement: Arrangement,
|
|
39
|
+
}).pipe(
|
|
40
|
+
Type.object({
|
|
41
|
+
typename: 'dxos.org/type/Kanban',
|
|
42
|
+
version: '0.3.0',
|
|
43
|
+
}),
|
|
44
|
+
LabelAnnotation.set(['name']),
|
|
45
|
+
ViewAnnotation.set(true),
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
/** Instance type; use Kanban.Kanban in type position so namespace has .Kanban as type and .KanbanSchema as schema. */
|
|
49
|
+
export interface Kanban extends Schema.Schema.Type<typeof Kanban> {}
|
|
50
|
+
|
|
51
|
+
type MakeProps = Omit<Partial<Obj.MakeProps<typeof Kanban>>, 'view'> & {
|
|
52
|
+
view: View.View;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Make a kanban as a view of a data set.
|
|
57
|
+
*/
|
|
58
|
+
export const make = (props: MakeProps): Kanban => {
|
|
59
|
+
const { name, view, arrangement } = props;
|
|
60
|
+
const order = arrangement?.order ?? [];
|
|
61
|
+
const columns = arrangement?.columns ?? {};
|
|
62
|
+
return Obj.make(Kanban, {
|
|
63
|
+
name,
|
|
64
|
+
view: Ref.make(view),
|
|
65
|
+
arrangement: { order, columns },
|
|
66
|
+
});
|
|
67
|
+
};
|
package/src/types/index.ts
CHANGED
package/src/types/schema.ts
CHANGED
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { View } from '@dxos/echo';
|
|
9
|
+
import { Operation } from '@dxos/operation';
|
|
10
|
+
import { TypeInputOptionsAnnotation } from '@dxos/plugin-space/types';
|
|
9
11
|
|
|
10
12
|
import { meta } from '../meta';
|
|
11
13
|
|
|
@@ -21,13 +23,23 @@ import { meta } from '../meta';
|
|
|
21
23
|
// TODO(wittjosiah): Factor out?
|
|
22
24
|
export const PivotColumnAnnotationId = Symbol.for('@dxos/plugin-kanban/annotation/PivotColumn');
|
|
23
25
|
|
|
26
|
+
export const SettingsSchema = Schema.Struct({
|
|
27
|
+
columnFieldId: Schema.String.annotations({
|
|
28
|
+
title: 'Column field',
|
|
29
|
+
}),
|
|
30
|
+
});
|
|
31
|
+
|
|
24
32
|
export const CreateKanbanSchema = Schema.Struct({
|
|
25
33
|
name: Schema.optional(Schema.String),
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
34
|
+
// TODO(wittjosiah): This should be a query input instead.
|
|
35
|
+
typename: Schema.String.pipe(
|
|
36
|
+
Schema.annotations({ title: 'Select card type' }),
|
|
37
|
+
TypeInputOptionsAnnotation.set({
|
|
38
|
+
location: ['database', 'runtime'],
|
|
39
|
+
kind: ['user'],
|
|
40
|
+
registered: ['registered'],
|
|
30
41
|
}),
|
|
42
|
+
Schema.optional,
|
|
31
43
|
),
|
|
32
44
|
initialPivotColumn: Schema.optional(
|
|
33
45
|
Schema.String.annotations({
|
|
@@ -37,38 +49,72 @@ export const CreateKanbanSchema = Schema.Struct({
|
|
|
37
49
|
),
|
|
38
50
|
});
|
|
39
51
|
|
|
40
|
-
|
|
41
|
-
const KANBAN_ACTION = `${meta.id}/action`;
|
|
52
|
+
const KANBAN_OPERATION = `${meta.id}/operation`;
|
|
42
53
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}),
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
export class DeleteCardField extends Schema.TaggedClass<DeleteCardField>()(`${KANBAN_ACTION}/delete-card-field`, {
|
|
51
|
-
input: Schema.Struct({
|
|
52
|
-
view: DataType.View,
|
|
53
|
-
fieldId: Schema.String,
|
|
54
|
-
// TODO(wittjosiah): Separate fields for undo data?
|
|
55
|
-
deletionData: Schema.optional(
|
|
56
|
-
Schema.Struct({
|
|
57
|
-
field: FieldSchema,
|
|
58
|
-
// TODO(wittjosiah): This creates a type error.
|
|
59
|
-
// props: PropertySchema,
|
|
60
|
-
props: Schema.Any,
|
|
61
|
-
index: Schema.Number,
|
|
62
|
-
}),
|
|
63
|
-
),
|
|
64
|
-
}),
|
|
65
|
-
output: Schema.Void,
|
|
66
|
-
}) {}
|
|
54
|
+
export namespace KanbanOperation {
|
|
55
|
+
export const DeleteCardFieldOutput = Schema.Struct({
|
|
56
|
+
field: View.FieldSchema.annotations({ description: 'The deleted field schema.' }),
|
|
57
|
+
props: Schema.Any.annotations({ description: 'The deleted field properties.' }),
|
|
58
|
+
index: Schema.Number.annotations({ description: 'The index the field was at.' }),
|
|
59
|
+
});
|
|
67
60
|
|
|
68
|
-
export
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
61
|
+
export type DeleteCardFieldOutput = Schema.Schema.Type<typeof DeleteCardFieldOutput>;
|
|
62
|
+
|
|
63
|
+
export const DeleteCardField = Operation.make({
|
|
64
|
+
meta: { key: `${KANBAN_OPERATION}/delete-card-field`, name: 'Delete Card Field' },
|
|
65
|
+
services: [Capability.Service],
|
|
66
|
+
schema: {
|
|
67
|
+
input: Schema.Struct({
|
|
68
|
+
view: View.View,
|
|
69
|
+
fieldId: Schema.String,
|
|
70
|
+
}),
|
|
71
|
+
output: DeleteCardFieldOutput,
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
export const DeleteCardOutput = Schema.Struct({
|
|
76
|
+
card: Schema.Any.annotations({ description: 'The deleted card.' }),
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
export type DeleteCardOutput = Schema.Schema.Type<typeof DeleteCardOutput>;
|
|
80
|
+
|
|
81
|
+
export const DeleteCard = Operation.make({
|
|
82
|
+
meta: { key: `${KANBAN_OPERATION}/delete-card`, name: 'Delete Card' },
|
|
83
|
+
schema: {
|
|
84
|
+
input: Schema.Struct({
|
|
85
|
+
card: Schema.Any,
|
|
86
|
+
}),
|
|
87
|
+
output: DeleteCardOutput,
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Restore a deleted card field (inverse of DeleteCardField).
|
|
93
|
+
*/
|
|
94
|
+
export const RestoreCardField = Operation.make({
|
|
95
|
+
meta: { key: `${KANBAN_OPERATION}/restore-card-field`, name: 'Restore Card Field' },
|
|
96
|
+
services: [Capability.Service],
|
|
97
|
+
schema: {
|
|
98
|
+
input: Schema.Struct({
|
|
99
|
+
view: View.View.annotations({ description: 'The view to restore the field to.' }),
|
|
100
|
+
field: View.FieldSchema.annotations({ description: 'The field schema to restore.' }),
|
|
101
|
+
props: Schema.Any.annotations({ description: 'The field properties to restore.' }),
|
|
102
|
+
index: Schema.Number.annotations({ description: 'The index to restore the field at.' }),
|
|
103
|
+
}),
|
|
104
|
+
output: Schema.Void,
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Restore a deleted card (inverse of DeleteCard).
|
|
110
|
+
*/
|
|
111
|
+
export const RestoreCard = Operation.make({
|
|
112
|
+
meta: { key: `${KANBAN_OPERATION}/restore-card`, name: 'Restore Card' },
|
|
113
|
+
schema: {
|
|
114
|
+
input: Schema.Struct({
|
|
115
|
+
card: Schema.Any.annotations({ description: 'The card to restore.' }),
|
|
116
|
+
}),
|
|
117
|
+
output: Schema.Void,
|
|
118
|
+
},
|
|
119
|
+
});
|
|
74
120
|
}
|
package/src/types/types.ts
CHANGED
|
@@ -2,6 +2,41 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { type Obj } from '@dxos/echo';
|
|
6
|
+
|
|
7
|
+
import { type Kanban } from './Kanban';
|
|
8
|
+
|
|
5
9
|
export type Location = {
|
|
6
10
|
idx?: number;
|
|
7
11
|
};
|
|
12
|
+
|
|
13
|
+
/** Snapshot shape used when reading kanban arrangement from atoms. */
|
|
14
|
+
export type KanbanArrangementSnapshot = Kanban | Obj.Snapshot<Kanban>;
|
|
15
|
+
|
|
16
|
+
/** Minimal item shape for arrangement; Obj.Unknown satisfies this. */
|
|
17
|
+
export type BaseKanbanItem = { id: string };
|
|
18
|
+
|
|
19
|
+
/** Column structure without cards; used for board model column type and derived atoms. */
|
|
20
|
+
export type ColumnStructure = {
|
|
21
|
+
columnValue: string;
|
|
22
|
+
ids: string[];
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type KanbanColumn<T extends BaseKanbanItem = BaseKanbanItem> = {
|
|
26
|
+
columnValue: string;
|
|
27
|
+
cards: T[];
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type ArrangedCards<T extends BaseKanbanItem = BaseKanbanItem> = KanbanColumn<T>[];
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Callback type for wrapping mutations in Obj.change().
|
|
34
|
+
* Contains separate callbacks for kanban object and item mutations.
|
|
35
|
+
*/
|
|
36
|
+
export type KanbanChangeCallback<T extends BaseKanbanItem> = {
|
|
37
|
+
/** Callback to wrap kanban object mutations. */
|
|
38
|
+
kanban: (mutate: (mutableKanban: Obj.Mutable<Kanban>) => void) => void;
|
|
39
|
+
|
|
40
|
+
/** Sets a field on an item, wrapping in Obj.change() if needed. */
|
|
41
|
+
setItemField: (item: T, field: string, value: unknown) => void;
|
|
42
|
+
};
|