@dxos/plugin-kanban 0.8.4-main.fcfe5033a5 → 0.8.4-staging.60fe92afc8
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/LICENSE +102 -5
- package/PLUGIN.mdl +398 -0
- package/README.md +1 -1
- package/dist/lib/neutral/KanbanArticle-T4CPKAZH.mjs +132 -0
- package/dist/lib/neutral/KanbanArticle-T4CPKAZH.mjs.map +7 -0
- package/dist/lib/neutral/KanbanPlugin.mjs +44 -0
- package/dist/lib/neutral/KanbanPlugin.mjs.map +7 -0
- package/dist/lib/neutral/KanbanPlugin.node.mjs +27 -0
- package/dist/lib/neutral/KanbanPlugin.node.mjs.map +7 -0
- package/dist/lib/neutral/KanbanPlugin.workerd.mjs +21 -0
- package/dist/lib/neutral/KanbanPlugin.workerd.mjs.map +7 -0
- package/dist/lib/neutral/KanbanSettings-5WOS4CUE.mjs +83 -0
- package/dist/lib/neutral/KanbanSettings-5WOS4CUE.mjs.map +7 -0
- package/dist/lib/neutral/blueprint-definition-6DV3Q5MC.mjs +15 -0
- package/dist/lib/neutral/blueprint-definition-6DV3Q5MC.mjs.map +7 -0
- package/dist/lib/neutral/blueprints/index.mjs +8 -0
- package/dist/lib/neutral/capabilities/index.mjs +17 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/chunk-6ZHHQWO5.mjs +39 -0
- package/dist/lib/neutral/chunk-6ZHHQWO5.mjs.map +7 -0
- package/dist/lib/neutral/chunk-DAKIZO46.mjs +246 -0
- package/dist/lib/neutral/chunk-DAKIZO46.mjs.map +7 -0
- package/dist/lib/neutral/chunk-M5ISZWZU.mjs +8 -0
- package/dist/lib/neutral/chunk-M5ISZWZU.mjs.map +7 -0
- package/dist/lib/{browser/blueprints/index.mjs → neutral/chunk-ZTQW5KQS.mjs} +4 -5
- package/dist/lib/neutral/chunk-ZTQW5KQS.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +243 -0
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/containers/index.mjs +11 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/create-object-DKBSI46K.mjs +40 -0
- package/dist/lib/neutral/create-object-DKBSI46K.mjs.map +7 -0
- package/dist/lib/{browser/delete-card-VPNVIWOA.mjs → neutral/delete-card-VNAV3CZV.mjs} +6 -14
- package/dist/lib/neutral/delete-card-VNAV3CZV.mjs.map +7 -0
- package/dist/lib/neutral/delete-card-field-XHOLGS6L.mjs +39 -0
- package/dist/lib/neutral/delete-card-field-XHOLGS6L.mjs.map +7 -0
- package/dist/lib/neutral/hooks/index.mjs +431 -0
- package/dist/lib/neutral/hooks/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +34 -0
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +8 -0
- package/dist/lib/neutral/meta.mjs.map +7 -0
- package/dist/lib/neutral/operation-handler-B7IW6MXU.mjs +13 -0
- package/dist/lib/neutral/operation-handler-B7IW6MXU.mjs.map +7 -0
- package/dist/lib/neutral/operations/index.mjs +8 -0
- package/dist/lib/neutral/operations/index.mjs.map +7 -0
- package/dist/lib/neutral/plugin.mjs +16 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-VZEVEJL5.mjs +91 -0
- package/dist/lib/neutral/react-surface-VZEVEJL5.mjs.map +7 -0
- package/dist/lib/{browser/restore-card-4GG2RYKR.mjs → neutral/restore-card-EKVEPATL.mjs} +6 -14
- package/dist/lib/neutral/restore-card-EKVEPATL.mjs.map +7 -0
- package/dist/lib/neutral/restore-card-field-TQCTGGNO.mjs +37 -0
- package/dist/lib/neutral/restore-card-field-TQCTGGNO.mjs.map +7 -0
- package/dist/lib/neutral/testing/index.mjs +62 -0
- package/dist/lib/neutral/testing/index.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +44 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +22 -0
- package/dist/lib/neutral/types/index.mjs.map +7 -0
- package/dist/lib/neutral/undo-mappings-6CHW6BOF.mjs +42 -0
- package/dist/lib/neutral/undo-mappings-6CHW6BOF.mjs.map +7 -0
- package/dist/types/src/KanbanPlugin.d.ts +1 -0
- package/dist/types/src/KanbanPlugin.d.ts.map +1 -1
- package/dist/types/src/KanbanPlugin.node.d.ts +4 -0
- package/dist/types/src/KanbanPlugin.node.d.ts.map +1 -0
- package/dist/types/src/KanbanPlugin.test.d.ts +2 -0
- package/dist/types/src/KanbanPlugin.test.d.ts.map +1 -0
- package/dist/types/src/KanbanPlugin.workerd.d.ts +4 -0
- package/dist/types/src/KanbanPlugin.workerd.d.ts.map +1 -0
- package/dist/types/src/blueprints/kanban-blueprint.d.ts +2 -2
- package/dist/types/src/blueprints/kanban-blueprint.d.ts.map +1 -1
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/create-object.d.ts +11 -0
- package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +9 -2
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/undo-mappings.d.ts.map +1 -1
- package/dist/types/src/components/KanbanBoard/KanbanBoard.d.ts +9 -29
- package/dist/types/src/components/KanbanBoard/KanbanBoard.d.ts.map +1 -1
- package/dist/types/src/components/KanbanBoard/KanbanBoard.stories.d.ts +24 -24
- package/dist/types/src/components/KanbanBoard/KanbanBoard.stories.d.ts.map +1 -1
- package/dist/types/src/components/KanbanBoard/KanbanCard.d.ts +2 -3
- package/dist/types/src/components/KanbanBoard/KanbanCard.d.ts.map +1 -1
- package/dist/types/src/components/KanbanBoard/KanbanColumn.d.ts +2 -3
- package/dist/types/src/components/KanbanBoard/KanbanColumn.d.ts.map +1 -1
- package/dist/types/src/components/KanbanBoard/context.d.ts +38 -0
- package/dist/types/src/components/KanbanBoard/context.d.ts.map +1 -0
- package/dist/types/src/containers/KanbanArticle/KanbanArticle.d.ts +6 -0
- package/dist/types/src/containers/KanbanArticle/KanbanArticle.d.ts.map +1 -0
- package/dist/types/src/containers/{KanbanContainer/KanbanContainer.stories.d.ts → KanbanArticle/KanbanArticle.stories.d.ts} +26 -26
- package/dist/types/src/containers/KanbanArticle/KanbanArticle.stories.d.ts.map +1 -0
- package/dist/types/src/containers/KanbanArticle/index.d.ts +2 -0
- package/dist/types/src/containers/KanbanArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/KanbanSettings/KanbanSettings.d.ts +13 -0
- package/dist/types/src/containers/KanbanSettings/KanbanSettings.d.ts.map +1 -0
- package/dist/types/src/containers/KanbanSettings/index.d.ts +2 -0
- package/dist/types/src/containers/KanbanSettings/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +2 -2
- package/dist/types/src/containers/index.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +1 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useEchoChangeCallback.d.ts.map +1 -1
- package/dist/types/src/hooks/useItemsProjection.d.ts +10 -0
- package/dist/types/src/hooks/useItemsProjection.d.ts.map +1 -0
- package/dist/types/src/hooks/useKanbanBoardModel.browser.test.d.ts +2 -0
- package/dist/types/src/hooks/useKanbanBoardModel.browser.test.d.ts.map +1 -0
- package/dist/types/src/hooks/useKanbanBoardModel.d.ts.map +1 -1
- package/dist/types/src/hooks/useKanbanColumnEventHandler.d.ts +1 -1
- package/dist/types/src/hooks/useKanbanColumnEventHandler.d.ts.map +1 -1
- package/dist/types/src/hooks/useKanbanItemEventHandler.d.ts +1 -1
- package/dist/types/src/hooks/useKanbanItemEventHandler.d.ts.map +1 -1
- package/dist/types/src/hooks/useProjectionModel.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +3 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/delete-card-field.d.ts +3 -3
- package/dist/types/src/operations/delete-card-field.d.ts.map +1 -1
- package/dist/types/src/operations/delete-card.d.ts +3 -3
- package/dist/types/src/operations/delete-card.d.ts.map +1 -1
- package/dist/types/src/operations/index.d.ts +1 -2
- package/dist/types/src/operations/index.d.ts.map +1 -1
- package/dist/types/src/operations/restore-card-field.d.ts +3 -3
- package/dist/types/src/operations/restore-card-field.d.ts.map +1 -1
- package/dist/types/src/operations/restore-card.d.ts +3 -3
- package/dist/types/src/operations/restore-card.d.ts.map +1 -1
- package/dist/types/src/playwright/board-manager.d.ts.map +1 -1
- package/dist/types/src/playwright/playwright.config.d.ts.map +1 -1
- package/dist/types/src/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +24 -24
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Kanban.d.ts +66 -9
- package/dist/types/src/types/Kanban.d.ts.map +1 -1
- package/dist/types/src/{operations/definitions.d.ts → types/KanbanOperation.d.ts} +4 -4
- package/dist/types/src/types/KanbanOperation.d.ts.map +1 -0
- package/dist/types/src/types/constants.d.ts +3 -3
- package/dist/types/src/types/constants.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +2 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +15 -1
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +2 -2
- package/dist/types/src/util/arrangement.d.ts +8 -4
- package/dist/types/src/util/arrangement.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +110 -76
- package/src/KanbanPlugin.node.ts +21 -0
- package/src/KanbanPlugin.test.ts +31 -0
- package/src/KanbanPlugin.tsx +12 -39
- package/src/KanbanPlugin.workerd.ts +18 -0
- package/src/blueprints/kanban-blueprint.ts +2 -3
- package/src/capabilities/artifact-definition.ts +10 -9
- package/src/capabilities/blueprint-definition.ts +6 -4
- package/src/capabilities/create-object.ts +40 -0
- package/src/capabilities/index.ts +9 -2
- package/src/capabilities/operation-handler.ts +1 -1
- package/src/capabilities/react-surface.tsx +31 -14
- package/src/capabilities/undo-mappings.ts +1 -1
- package/src/components/KanbanBoard/KanbanBoard.stories.tsx +9 -6
- package/src/components/KanbanBoard/KanbanBoard.tsx +22 -51
- package/src/components/KanbanBoard/KanbanCard.tsx +75 -60
- package/src/components/KanbanBoard/KanbanColumn.tsx +16 -13
- package/src/components/KanbanBoard/context.ts +54 -0
- package/src/containers/{KanbanContainer/KanbanContainer.stories.tsx → KanbanArticle/KanbanArticle.stories.tsx} +48 -42
- package/src/containers/KanbanArticle/KanbanArticle.tsx +179 -0
- package/src/containers/KanbanArticle/index.ts +5 -0
- package/src/containers/KanbanSettings/KanbanSettings.tsx +94 -0
- package/src/containers/KanbanSettings/index.ts +5 -0
- package/src/containers/index.ts +2 -2
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useEchoChangeCallback.ts +2 -2
- package/src/hooks/useItemsProjection.ts +44 -0
- package/src/hooks/{useKanbanBoardModel.test.ts → useKanbanBoardModel.browser.test.ts} +14 -19
- package/src/hooks/useKanbanBoardModel.ts +19 -7
- package/src/hooks/useProjectionModel.ts +4 -4
- package/src/index.ts +3 -2
- package/src/meta.ts +22 -5
- package/src/operations/delete-card-field.ts +11 -16
- package/src/operations/delete-card.ts +3 -3
- package/src/operations/index.ts +1 -3
- package/src/operations/restore-card-field.ts +11 -16
- package/src/operations/restore-card.ts +3 -3
- package/src/playwright/smoke.spec.ts +3 -3
- package/src/plugin.ts +11 -0
- package/src/testing/KanbanCardTileSimple.tsx +6 -6
- package/src/types/Kanban.ts +86 -23
- package/src/{operations/definitions.ts → types/KanbanOperation.ts} +25 -9
- package/src/types/index.ts +3 -1
- package/src/types/schema.ts +20 -2
- package/src/types/types.ts +2 -2
- package/src/util/arrangement.test.ts +22 -13
- package/src/util/arrangement.ts +25 -15
- package/src/vite-env.d.ts +10 -0
- package/dist/lib/browser/blueprints/index.mjs.map +0 -7
- package/dist/lib/browser/chunk-A3PBV3S5.mjs +0 -105
- package/dist/lib/browser/chunk-A3PBV3S5.mjs.map +0 -7
- package/dist/lib/browser/delete-card-VPNVIWOA.mjs.map +0 -7
- package/dist/lib/browser/delete-card-field-4HHF2GYX.mjs +0 -50
- package/dist/lib/browser/delete-card-field-4HHF2GYX.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -121
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/operations/index.mjs +0 -13
- package/dist/lib/browser/operations/index.mjs.map +0 -7
- package/dist/lib/browser/restore-card-4GG2RYKR.mjs.map +0 -7
- package/dist/lib/browser/restore-card-field-3T26ACYX.mjs +0 -48
- package/dist/lib/browser/restore-card-field-3T26ACYX.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -100
- package/dist/lib/browser/types/index.mjs.map +0 -7
- package/dist/lib/node-esm/blueprints/index.mjs +0 -28
- package/dist/lib/node-esm/blueprints/index.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6LELYA2G.mjs +0 -106
- package/dist/lib/node-esm/chunk-6LELYA2G.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
- package/dist/lib/node-esm/delete-card-5PW5OMFN.mjs +0 -33
- package/dist/lib/node-esm/delete-card-5PW5OMFN.mjs.map +0 -7
- package/dist/lib/node-esm/delete-card-field-KPJU2AQ3.mjs +0 -51
- package/dist/lib/node-esm/delete-card-field-KPJU2AQ3.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -122
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/operations/index.mjs +0 -14
- package/dist/lib/node-esm/operations/index.mjs.map +0 -7
- package/dist/lib/node-esm/restore-card-X2TKMU5A.mjs +0 -30
- package/dist/lib/node-esm/restore-card-X2TKMU5A.mjs.map +0 -7
- package/dist/lib/node-esm/restore-card-field-IUTL4RTR.mjs +0 -49
- package/dist/lib/node-esm/restore-card-field-IUTL4RTR.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -101
- package/dist/lib/node-esm/types/index.mjs.map +0 -7
- package/dist/types/src/containers/KanbanContainer/KanbanContainer.d.ts +0 -6
- package/dist/types/src/containers/KanbanContainer/KanbanContainer.d.ts.map +0 -1
- package/dist/types/src/containers/KanbanContainer/KanbanContainer.stories.d.ts.map +0 -1
- package/dist/types/src/containers/KanbanContainer/index.d.ts +0 -2
- package/dist/types/src/containers/KanbanContainer/index.d.ts.map +0 -1
- package/dist/types/src/containers/KanbanViewEditor/KanbanViewEditor.d.ts +0 -6
- package/dist/types/src/containers/KanbanViewEditor/KanbanViewEditor.d.ts.map +0 -1
- package/dist/types/src/containers/KanbanViewEditor/index.d.ts +0 -2
- package/dist/types/src/containers/KanbanViewEditor/index.d.ts.map +0 -1
- package/dist/types/src/hooks/useKanbanBoardModel.test.d.ts +0 -2
- package/dist/types/src/hooks/useKanbanBoardModel.test.d.ts.map +0 -1
- package/dist/types/src/operations/definitions.d.ts.map +0 -1
- package/src/containers/KanbanContainer/KanbanContainer.tsx +0 -96
- package/src/containers/KanbanContainer/index.ts +0 -5
- package/src/containers/KanbanViewEditor/KanbanViewEditor.tsx +0 -63
- package/src/containers/KanbanViewEditor/index.ts +0 -5
- /package/dist/lib/{browser/chunk-J5LGTIGS.mjs.map → neutral/blueprints/index.mjs.map} +0 -0
- /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs +0 -0
- /package/dist/lib/{node-esm/chunk-HSLMI22Q.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
|
@@ -3,34 +3,29 @@
|
|
|
3
3
|
import * as Effect from 'effect/Effect';
|
|
4
4
|
|
|
5
5
|
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { Operation } from '@dxos/compute';
|
|
7
|
+
import { Obj, Type } from '@dxos/echo';
|
|
8
8
|
import { invariant } from '@dxos/invariant';
|
|
9
|
-
import {
|
|
10
|
-
import { ProjectionModel, createEchoChangeCallback, getTypenameFromQuery } from '@dxos/schema';
|
|
9
|
+
import { ProjectionModel, createEchoChangeCallback, getTypeURIFromQuery } from '@dxos/schema';
|
|
11
10
|
|
|
12
|
-
import {
|
|
11
|
+
import { KanbanOperation } from '../types';
|
|
13
12
|
|
|
14
|
-
const handler: Operation.WithHandler<typeof RestoreCardField> = RestoreCardField.pipe(
|
|
13
|
+
const handler: Operation.WithHandler<typeof KanbanOperation.RestoreCardField> = KanbanOperation.RestoreCardField.pipe(
|
|
15
14
|
Operation.withHandler(
|
|
16
15
|
Effect.fnUntraced(function* ({ view, field, props, index }) {
|
|
17
16
|
const registry = yield* Capability.get(Capabilities.AtomRegistry);
|
|
18
17
|
const db = Obj.getDatabase(view);
|
|
19
18
|
invariant(db, 'Database not found');
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
typename: getTypenameFromQuery(view.query.ast)!,
|
|
24
|
-
location: ['database', 'runtime'],
|
|
25
|
-
})
|
|
26
|
-
.first(),
|
|
27
|
-
);
|
|
19
|
+
const types = db.graph.registry.list().filter(Type.isType);
|
|
20
|
+
const type = types.find((t) => Type.getURI(t) === getTypeURIFromQuery(view.query.ast));
|
|
21
|
+
invariant(type, 'Schema not found');
|
|
28
22
|
|
|
23
|
+
invariant(Type.isType(type), 'expected stored Type.Type for card schema');
|
|
29
24
|
const projection = new ProjectionModel({
|
|
30
25
|
registry,
|
|
31
26
|
view,
|
|
32
|
-
baseSchema:
|
|
33
|
-
change: createEchoChangeCallback(view,
|
|
27
|
+
baseSchema: type.jsonSchema,
|
|
28
|
+
change: createEchoChangeCallback(view, type),
|
|
34
29
|
});
|
|
35
30
|
|
|
36
31
|
projection.setFieldProjection({ field, props }, index);
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
import * as Effect from 'effect/Effect';
|
|
4
4
|
|
|
5
|
+
import { Operation } from '@dxos/compute';
|
|
5
6
|
import { Obj } from '@dxos/echo';
|
|
6
7
|
import { invariant } from '@dxos/invariant';
|
|
7
|
-
import { Operation } from '@dxos/operation';
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { KanbanOperation } from '../types';
|
|
10
10
|
|
|
11
|
-
const handler: Operation.WithHandler<typeof RestoreCard> = RestoreCard.pipe(
|
|
11
|
+
const handler: Operation.WithHandler<typeof KanbanOperation.RestoreCard> = KanbanOperation.RestoreCard.pipe(
|
|
12
12
|
Operation.withHandler(({ card }) =>
|
|
13
13
|
Effect.sync(() => {
|
|
14
14
|
const db = Obj.getDatabase(card);
|
|
@@ -49,7 +49,7 @@ test.describe('Kanban MutableSchema', () => {
|
|
|
49
49
|
expect(secondLabel).not.toBeNull();
|
|
50
50
|
|
|
51
51
|
// Drag first item below the second item.
|
|
52
|
-
await column.item(0).dragTo(column.item(1).locator, { x: 0, y: 200 });
|
|
52
|
+
await column.item(0).dragTo(column.item(1).locator, { x: 0, y: 200 }, 'bottom');
|
|
53
53
|
|
|
54
54
|
// Item count should stay the same.
|
|
55
55
|
await expect(column.items()).toHaveCount(countBefore);
|
|
@@ -71,8 +71,8 @@ test.describe('Kanban MutableSchema', () => {
|
|
|
71
71
|
const draggedLabel = await col1.item(0).title().textContent();
|
|
72
72
|
expect(draggedLabel).not.toBeNull();
|
|
73
73
|
|
|
74
|
-
// Drop above first item.
|
|
75
|
-
await col1.item(0).dragTo(col2.item(0).locator, { x: 0, y: -30 });
|
|
74
|
+
// Drop above first item.
|
|
75
|
+
await col1.item(0).dragTo(col2.item(0).locator, { x: 0, y: -30 }, 'top');
|
|
76
76
|
|
|
77
77
|
await expect(col1.items()).toHaveCount(col1CountBefore - 1);
|
|
78
78
|
await expect(col2.items()).toHaveCount(col2CountBefore + 1);
|
package/src/plugin.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
import { meta } from './meta';
|
|
8
|
+
|
|
9
|
+
export const KanbanPlugin = Plugin.lazy(meta, () => import('#plugin'));
|
|
10
|
+
|
|
11
|
+
export { KanbanOperationHandlerSet } from './operations';
|
|
@@ -50,7 +50,7 @@ export const KanbanCardTileSimple = forwardRef<HTMLDivElement, KanbanCardProps>(
|
|
|
50
50
|
>
|
|
51
51
|
<Focus.Item asChild>
|
|
52
52
|
<Card.Root ref={forwardedRef} data-testid='board-item'>
|
|
53
|
-
<Card.
|
|
53
|
+
<Card.Header>
|
|
54
54
|
<Card.DragHandle ref={dragHandleRef} />
|
|
55
55
|
<Card.Title>{Obj.getLabel(data)}</Card.Title>
|
|
56
56
|
{/* TODO(wittjosiah): Reconcile with Card.Menu. */}
|
|
@@ -63,14 +63,14 @@ export const KanbanCardTileSimple = forwardRef<HTMLDivElement, KanbanCardProps>(
|
|
|
63
63
|
/>
|
|
64
64
|
</Menu.Trigger>
|
|
65
65
|
<Menu.Content items={menuItems} />
|
|
66
|
-
</Card.
|
|
67
|
-
<Card.
|
|
68
|
-
<Card.
|
|
66
|
+
</Card.Header>
|
|
67
|
+
<Card.Body>
|
|
68
|
+
<Card.Row fullWidth>
|
|
69
69
|
<pre className='p-2 text-xs text-description whitespace-pre-wrap'>
|
|
70
70
|
{JSON.stringify(data, null, 2)}
|
|
71
71
|
</pre>
|
|
72
|
-
</Card.
|
|
73
|
-
</Card.
|
|
72
|
+
</Card.Row>
|
|
73
|
+
</Card.Body>
|
|
74
74
|
</Card.Root>
|
|
75
75
|
</Focus.Item>
|
|
76
76
|
</Mosaic.Tile>
|
package/src/types/Kanban.ts
CHANGED
|
@@ -4,15 +4,23 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import
|
|
7
|
+
// QueryAST is referenced indirectly through `Type.InstanceType<typeof ...Schema>`
|
|
8
|
+
// (Ref.Ref(View.View) → View.View → QueryAST.Query) in the emitted .d.ts; the
|
|
9
|
+
// namespace import keeps the inferred types portable.
|
|
10
|
+
// eslint-disable-next-line unused-imports/no-unused-imports
|
|
11
|
+
import { DXN, Annotation, Obj, QueryAST, Ref, Type, View } from '@dxos/echo';
|
|
12
|
+
import { FormInputAnnotation, LabelAnnotation } from '@dxos/echo/Annotation';
|
|
10
13
|
import { ViewAnnotation } from '@dxos/schema';
|
|
11
14
|
|
|
12
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Per-column entry: ordered card ids plus an optional `hidden` flag that
|
|
17
|
+
* removes the column from the rendered board (and from the model's column
|
|
18
|
+
* list). Today only the uncategorized column is exposed in settings, but
|
|
19
|
+
* the data structure supports per-column hiding generally.
|
|
20
|
+
*/
|
|
13
21
|
const ArrangementColumnEntry = Schema.Struct({
|
|
14
22
|
ids: Schema.Array(Obj.ID),
|
|
15
|
-
hidden: Schema.
|
|
23
|
+
hidden: Schema.Boolean.pipe(Schema.optional),
|
|
16
24
|
});
|
|
17
25
|
|
|
18
26
|
/** Keyed by columnValue. */
|
|
@@ -29,43 +37,98 @@ export const Arrangement = Schema.Struct({
|
|
|
29
37
|
|
|
30
38
|
export type Arrangement = Schema.Schema.Type<typeof Arrangement>;
|
|
31
39
|
|
|
32
|
-
|
|
33
|
-
|
|
40
|
+
//
|
|
41
|
+
// Mirrors the canonical DXOS pattern (see `Trigger.Spec` in
|
|
42
|
+
// `@dxos/functions/src/types/Trigger.ts` and `Sequence.Source` in
|
|
43
|
+
// `@dxos/plugin-zen`): the `Type.makeObject` schema is a flat `Schema.Struct`,
|
|
44
|
+
// and the discriminated union lives one level down as a single field whose
|
|
45
|
+
// variants are tagged with a `kind` literal.
|
|
46
|
+
//
|
|
34
47
|
|
|
48
|
+
/** View-variant: items come from running the View's query (the original behaviour). */
|
|
49
|
+
export const KanbanViewSpec = Schema.Struct({
|
|
50
|
+
kind: Schema.Literal('view').pipe(FormInputAnnotation.set(false)),
|
|
35
51
|
view: Ref.Ref(View.View).pipe(FormInputAnnotation.set(false)),
|
|
52
|
+
});
|
|
53
|
+
export type KanbanViewSpec = Schema.Schema.Type<typeof KanbanViewSpec>;
|
|
54
|
+
|
|
55
|
+
/** Items-variant: kanban owns its items as an explicit ref array (used by externally-synced kanbans). */
|
|
56
|
+
export const KanbanItemsSpec = Schema.Struct({
|
|
57
|
+
kind: Schema.Literal('items').pipe(FormInputAnnotation.set(false)),
|
|
58
|
+
/** Property path on each item that drives column membership (e.g. `'listName'`). */
|
|
59
|
+
pivotField: Schema.String,
|
|
60
|
+
/** Items owned directly by the kanban. */
|
|
61
|
+
items: Schema.Array(Ref.Ref(Obj.Unknown)).pipe(FormInputAnnotation.set(false)),
|
|
62
|
+
});
|
|
63
|
+
export type KanbanItemsSpec = Schema.Schema.Type<typeof KanbanItemsSpec>;
|
|
64
|
+
|
|
65
|
+
/** Discriminated union of source specs. Distinguished by `kind`. */
|
|
66
|
+
export const KanbanSpec = Schema.Union(KanbanViewSpec, KanbanItemsSpec);
|
|
67
|
+
export type KanbanSpec = Schema.Schema.Type<typeof KanbanSpec>;
|
|
36
68
|
|
|
37
|
-
|
|
69
|
+
export const Kanban = Schema.Struct({
|
|
70
|
+
name: Schema.String.pipe(Schema.optional),
|
|
38
71
|
arrangement: Arrangement,
|
|
72
|
+
/** How this kanban sources its items. Discriminated by `spec.kind`. */
|
|
73
|
+
spec: KanbanSpec,
|
|
39
74
|
}).pipe(
|
|
40
|
-
Type.object({
|
|
41
|
-
typename: 'org.dxos.type.kanban',
|
|
42
|
-
version: '0.1.0',
|
|
43
|
-
}),
|
|
44
75
|
LabelAnnotation.set(['name']),
|
|
45
|
-
ViewAnnotation.set(
|
|
46
|
-
Annotation.IconAnnotation.set({
|
|
47
|
-
|
|
48
|
-
hue: 'green',
|
|
49
|
-
}),
|
|
76
|
+
ViewAnnotation.set(['spec', 'view']),
|
|
77
|
+
Annotation.IconAnnotation.set({ icon: 'ph--kanban--regular', hue: 'green' }),
|
|
78
|
+
Type.makeObject(DXN.make('org.dxos.type.kanban', '0.2.0')),
|
|
50
79
|
);
|
|
51
80
|
|
|
52
|
-
/**
|
|
53
|
-
|
|
81
|
+
/**
|
|
82
|
+
* Instance type; narrow on `kanban.spec.kind` (or use the guards below).
|
|
83
|
+
*/
|
|
84
|
+
export interface Kanban extends Type.InstanceType<typeof Kanban> {}
|
|
85
|
+
|
|
86
|
+
/** Narrowed view-variant kanban. */
|
|
87
|
+
export type KanbanView = Kanban & { spec: KanbanViewSpec };
|
|
88
|
+
|
|
89
|
+
/** Narrowed items-variant kanban. */
|
|
90
|
+
export type KanbanItems = Kanban & { spec: KanbanItemsSpec };
|
|
54
91
|
|
|
55
|
-
|
|
92
|
+
export const isKanbanView = (kanban: Kanban): kanban is KanbanView => kanban.spec.kind === 'view';
|
|
93
|
+
export const isKanbanItems = (kanban: Kanban): kanban is KanbanItems => kanban.spec.kind === 'items';
|
|
94
|
+
|
|
95
|
+
type MakeViewProps = {
|
|
96
|
+
name?: string;
|
|
56
97
|
view: View.View;
|
|
98
|
+
arrangement?: Arrangement;
|
|
57
99
|
};
|
|
58
100
|
|
|
59
101
|
/**
|
|
60
|
-
* Make a kanban
|
|
102
|
+
* Make a view-variant kanban (items sourced via the View's query).
|
|
61
103
|
*/
|
|
62
|
-
export const make = (props:
|
|
104
|
+
export const make = (props: MakeViewProps): Kanban => {
|
|
63
105
|
const { name, view, arrangement } = props;
|
|
64
106
|
const order = arrangement?.order ?? [];
|
|
65
107
|
const columns = arrangement?.columns ?? {};
|
|
66
108
|
return Obj.make(Kanban, {
|
|
67
109
|
name,
|
|
68
|
-
view: Ref.make(view),
|
|
69
110
|
arrangement: { order, columns },
|
|
111
|
+
spec: { kind: 'view' as const, view: Ref.make(view) },
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
type MakeItemsProps = {
|
|
116
|
+
name?: string;
|
|
117
|
+
arrangement?: Arrangement;
|
|
118
|
+
pivotField: string;
|
|
119
|
+
items?: ReadonlyArray<Ref.Ref<Obj.Unknown>>;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Make an items-variant kanban (items list owned by the kanban itself, e.g. populated by a sync integration).
|
|
124
|
+
*/
|
|
125
|
+
export const makeItems = (props: MakeItemsProps): Kanban => {
|
|
126
|
+
const { name, arrangement, pivotField, items = [] } = props;
|
|
127
|
+
const order = arrangement?.order ?? [];
|
|
128
|
+
const columns = arrangement?.columns ?? {};
|
|
129
|
+
return Obj.make(Kanban, {
|
|
130
|
+
name,
|
|
131
|
+
arrangement: { order, columns },
|
|
132
|
+
spec: { kind: 'items' as const, pivotField, items },
|
|
70
133
|
});
|
|
71
134
|
};
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
+
//
|
|
1
2
|
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// @import-as-namespace
|
|
2
6
|
|
|
3
7
|
import * as Schema from 'effect/Schema';
|
|
4
8
|
|
|
5
9
|
import { Capability } from '@dxos/app-framework';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
10
|
+
import { Operation } from '@dxos/compute';
|
|
11
|
+
import { Type, View, DXN } from '@dxos/echo';
|
|
8
12
|
|
|
9
13
|
import { meta } from '#meta';
|
|
10
14
|
|
|
11
|
-
const
|
|
15
|
+
const makeKey = (name: string) => DXN.make(`${meta.id}.operation.${name}`);
|
|
12
16
|
|
|
13
17
|
export const DeleteCardFieldOutput = Schema.Struct({
|
|
14
18
|
field: View.FieldSchema.annotations({ description: 'The deleted field schema.' }),
|
|
@@ -19,10 +23,14 @@ export const DeleteCardFieldOutput = Schema.Struct({
|
|
|
19
23
|
export type DeleteCardFieldOutput = Schema.Schema.Type<typeof DeleteCardFieldOutput>;
|
|
20
24
|
|
|
21
25
|
export const DeleteCardField = Operation.make({
|
|
22
|
-
meta: {
|
|
26
|
+
meta: {
|
|
27
|
+
key: makeKey('deleteCardField'),
|
|
28
|
+
name: 'Delete Card Field',
|
|
29
|
+
icon: 'ph--minus-circle--regular',
|
|
30
|
+
},
|
|
23
31
|
services: [Capability.Service],
|
|
24
32
|
input: Schema.Struct({
|
|
25
|
-
view: View.View,
|
|
33
|
+
view: Type.getSchema(View.View),
|
|
26
34
|
fieldId: Schema.String,
|
|
27
35
|
}),
|
|
28
36
|
output: DeleteCardFieldOutput,
|
|
@@ -35,7 +43,7 @@ export const DeleteCardOutput = Schema.Struct({
|
|
|
35
43
|
export type DeleteCardOutput = Schema.Schema.Type<typeof DeleteCardOutput>;
|
|
36
44
|
|
|
37
45
|
export const DeleteCard = Operation.make({
|
|
38
|
-
meta: { key:
|
|
46
|
+
meta: { key: makeKey('deleteCard'), name: 'Delete Card', icon: 'ph--trash--regular' },
|
|
39
47
|
input: Schema.Struct({
|
|
40
48
|
card: Schema.Any,
|
|
41
49
|
}),
|
|
@@ -43,10 +51,14 @@ export const DeleteCard = Operation.make({
|
|
|
43
51
|
});
|
|
44
52
|
|
|
45
53
|
export const RestoreCardField = Operation.make({
|
|
46
|
-
meta: {
|
|
54
|
+
meta: {
|
|
55
|
+
key: makeKey('restoreCardField'),
|
|
56
|
+
name: 'Restore Card Field',
|
|
57
|
+
icon: 'ph--clock-counter-clockwise--regular',
|
|
58
|
+
},
|
|
47
59
|
services: [Capability.Service],
|
|
48
60
|
input: Schema.Struct({
|
|
49
|
-
view: View.View.annotations({ description: 'The view to restore the field to.' }),
|
|
61
|
+
view: Type.getSchema(View.View).annotations({ description: 'The view to restore the field to.' }),
|
|
50
62
|
field: View.FieldSchema.annotations({ description: 'The field schema to restore.' }),
|
|
51
63
|
props: Schema.Any.annotations({ description: 'The field properties to restore.' }),
|
|
52
64
|
index: Schema.Number.annotations({ description: 'The index to restore the field at.' }),
|
|
@@ -55,7 +67,11 @@ export const RestoreCardField = Operation.make({
|
|
|
55
67
|
});
|
|
56
68
|
|
|
57
69
|
export const RestoreCard = Operation.make({
|
|
58
|
-
meta: {
|
|
70
|
+
meta: {
|
|
71
|
+
key: makeKey('restoreCard'),
|
|
72
|
+
name: 'Restore Card',
|
|
73
|
+
icon: 'ph--clock-counter-clockwise--regular',
|
|
74
|
+
},
|
|
59
75
|
input: Schema.Struct({
|
|
60
76
|
card: Schema.Any.annotations({ description: 'The card to restore.' }),
|
|
61
77
|
}),
|
package/src/types/index.ts
CHANGED
package/src/types/schema.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import { TypeInputOptionsAnnotation } from '@dxos/plugin-space
|
|
7
|
+
import { TypeInputOptionsAnnotation } from '@dxos/plugin-space';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Kanban data model.
|
|
@@ -18,10 +18,28 @@ import { TypeInputOptionsAnnotation } from '@dxos/plugin-space/types';
|
|
|
18
18
|
// TODO(wittjosiah): Factor out?
|
|
19
19
|
export const PivotColumnAnnotationId = Symbol.for('@dxos/plugin-kanban/annotation/PivotColumn');
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Settings common to every Kanban (view or items). Rendered as form fields
|
|
23
|
+
* by `KanbanSettings`.
|
|
24
|
+
*/
|
|
25
|
+
export const KanbanSettingsSchema = Schema.Struct({
|
|
26
|
+
hideUncategorized: Schema.Boolean.annotations({
|
|
27
|
+
title: 'Hide uncategorized column',
|
|
28
|
+
description: 'When enabled, items without a pivot value won’t be shown as a column.',
|
|
29
|
+
}).pipe(Schema.optional),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Settings for view-variant Kanbans only. Spreads {@link KanbanSettingsSchema}'s
|
|
34
|
+
* fields and adds a column-field picker that binds the View’s pivot field.
|
|
35
|
+
* Items-variant kanbans use a hardcoded `spec.pivotField` and don’t expose
|
|
36
|
+
* this control.
|
|
37
|
+
*/
|
|
38
|
+
export const KanbanViewSettingsSchema = Schema.Struct({
|
|
22
39
|
columnFieldId: Schema.String.annotations({
|
|
23
40
|
title: 'Column field',
|
|
24
41
|
}),
|
|
42
|
+
...KanbanSettingsSchema.fields,
|
|
25
43
|
});
|
|
26
44
|
|
|
27
45
|
export const CreateKanbanSchema = Schema.Struct({
|
package/src/types/types.ts
CHANGED
|
@@ -30,13 +30,13 @@ export type KanbanColumn<T extends BaseKanbanItem = BaseKanbanItem> = {
|
|
|
30
30
|
export type ArrangedCards<T extends BaseKanbanItem = BaseKanbanItem> = KanbanColumn<T>[];
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* Callback type for wrapping mutations in Obj.
|
|
33
|
+
* Callback type for wrapping mutations in Obj.update().
|
|
34
34
|
* Contains separate callbacks for kanban object and item mutations.
|
|
35
35
|
*/
|
|
36
36
|
export type KanbanChangeCallback<T extends BaseKanbanItem> = {
|
|
37
37
|
/** Callback to wrap kanban object mutations. */
|
|
38
38
|
kanban: (mutate: (mutableKanban: Obj.Mutable<Kanban>) => void) => void;
|
|
39
39
|
|
|
40
|
-
/** Sets a field on an item, wrapping in Obj.
|
|
40
|
+
/** Sets a field on an item, wrapping in Obj.update() if needed. */
|
|
41
41
|
setItemField: (item: T, field: string, value: unknown) => void;
|
|
42
42
|
};
|
|
@@ -5,9 +5,8 @@
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
import { beforeEach, describe, test } from 'vitest';
|
|
7
7
|
|
|
8
|
-
import { Filter, JsonSchema, Query, Type } from '@dxos/echo';
|
|
9
|
-
import {
|
|
10
|
-
import { ObjectId } from '@dxos/keys';
|
|
8
|
+
import { DXN, Filter, JsonSchema, Query, Type, type View } from '@dxos/echo';
|
|
9
|
+
import { EntityId } from '@dxos/keys';
|
|
11
10
|
import { ViewModel } from '@dxos/schema';
|
|
12
11
|
|
|
13
12
|
import { Kanban, UNCATEGORIZED_VALUE } from '#types';
|
|
@@ -26,7 +25,7 @@ const selectOptions = [
|
|
|
26
25
|
];
|
|
27
26
|
|
|
28
27
|
const MinimalSchema = Schema.Struct({ id: Schema.String }).pipe(
|
|
29
|
-
Type.
|
|
28
|
+
Type.makeObject(DXN.make('com.example.type.minimal', '0.1.0')),
|
|
30
29
|
);
|
|
31
30
|
|
|
32
31
|
describe('arrangement utils', () => {
|
|
@@ -80,9 +79,9 @@ describe('arrangement utils', () => {
|
|
|
80
79
|
});
|
|
81
80
|
|
|
82
81
|
test('returns per-column ids and preserves hidden from kanban arrangement', ({ expect }) => {
|
|
83
|
-
const id1 =
|
|
84
|
-
const id2 =
|
|
85
|
-
const id3 =
|
|
82
|
+
const id1 = EntityId.random();
|
|
83
|
+
const id2 = EntityId.random();
|
|
84
|
+
const id3 = EntityId.random();
|
|
86
85
|
const kanban = Kanban.make({
|
|
87
86
|
view,
|
|
88
87
|
arrangement: {
|
|
@@ -99,14 +98,24 @@ describe('arrangement utils', () => {
|
|
|
99
98
|
expect(byColumn.b.hidden).toBeUndefined();
|
|
100
99
|
});
|
|
101
100
|
|
|
101
|
+
test('treats non-array ids as empty (Automerge / corrupt layout)', ({ expect }) => {
|
|
102
|
+
const arrangement = {
|
|
103
|
+
order: [],
|
|
104
|
+
columns: { a: { ids: {} as unknown as string[] }, b: { ids: ['ok'] } },
|
|
105
|
+
};
|
|
106
|
+
const byColumn = getOrderByColumnFromArrangement(arrangement);
|
|
107
|
+
expect(byColumn.a.ids).toEqual([]);
|
|
108
|
+
expect(byColumn.b.ids).toEqual(['ok']);
|
|
109
|
+
});
|
|
110
|
+
|
|
102
111
|
test('returns mutable copies', ({ expect }) => {
|
|
103
|
-
const idX =
|
|
112
|
+
const idX = EntityId.random();
|
|
104
113
|
const kanban = Kanban.make({
|
|
105
114
|
view,
|
|
106
115
|
arrangement: { order: [], columns: { a: { ids: [idX] } } },
|
|
107
116
|
});
|
|
108
117
|
const byColumn = getOrderByColumnFromArrangement(kanban.arrangement);
|
|
109
|
-
byColumn.a.ids.push(
|
|
118
|
+
byColumn.a.ids.push(EntityId.random());
|
|
110
119
|
expect(getOrderByColumnFromArrangement(kanban.arrangement).a.ids).toEqual([idX]);
|
|
111
120
|
});
|
|
112
121
|
|
|
@@ -142,10 +151,10 @@ describe('arrangement utils', () => {
|
|
|
142
151
|
|
|
143
152
|
describe('computeItemArrangement', () => {
|
|
144
153
|
test('distributes items by pivotPath and preserves saved order within column', ({ expect }) => {
|
|
145
|
-
const idUc1 =
|
|
146
|
-
const idA1 =
|
|
147
|
-
const idA2 =
|
|
148
|
-
const idA3 =
|
|
154
|
+
const idUc1 = EntityId.random();
|
|
155
|
+
const idA1 = EntityId.random();
|
|
156
|
+
const idA2 = EntityId.random();
|
|
157
|
+
const idA3 = EntityId.random();
|
|
149
158
|
const kanban = Kanban.make({
|
|
150
159
|
view,
|
|
151
160
|
arrangement: {
|
package/src/util/arrangement.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type SelectOption } from '@dxos/echo/
|
|
5
|
+
import { type SelectOption } from '@dxos/echo/Format';
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
type ArrangedCards,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
*/
|
|
21
21
|
export const getOrderFromArrangement = (arrangement?: Kanban.Arrangement): string[] => {
|
|
22
22
|
const order = arrangement?.order;
|
|
23
|
-
if (order != null && order.length > 0) {
|
|
23
|
+
if (order != null && Array.isArray(order) && order.length > 0) {
|
|
24
24
|
return [...order];
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -41,10 +41,11 @@ export const getOrderByColumnFromArrangement = (
|
|
|
41
41
|
const columns = arrangement?.columns;
|
|
42
42
|
if (columns != null && Object.keys(columns).length > 0) {
|
|
43
43
|
return Object.fromEntries(
|
|
44
|
-
Object.entries(columns).map(([key, entry]) =>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
Object.entries(columns).map(([key, entry]) => {
|
|
45
|
+
const rawIds = entry.ids;
|
|
46
|
+
const ids = Array.isArray(rawIds) ? [...rawIds] : [];
|
|
47
|
+
return [key, { ids, ...(entry.hidden !== undefined && { hidden: entry.hidden }) }];
|
|
48
|
+
}),
|
|
48
49
|
);
|
|
49
50
|
}
|
|
50
51
|
|
|
@@ -54,11 +55,15 @@ export const getOrderByColumnFromArrangement = (
|
|
|
54
55
|
/**
|
|
55
56
|
* Builds the ordered list of columns (value + ids) for the board model.
|
|
56
57
|
*
|
|
57
|
-
* Column order: uncategorized first, then effectiveOrder, then any
|
|
58
|
-
* Each entry gets the ids from
|
|
58
|
+
* Column order: uncategorized first, then effectiveOrder, then any
|
|
59
|
+
* selectOption ids not yet in order. Each entry gets the ids from
|
|
60
|
+
* effectiveByColumn for that column (or empty). Columns whose entry has
|
|
61
|
+
* `hidden: true` are dropped from the result — currently only the
|
|
62
|
+
* "Uncategorized" column is toggleable from settings, but the filter is
|
|
63
|
+
* generic so any column can be hidden via the same flag.
|
|
59
64
|
*
|
|
60
65
|
* @param effectiveOrder - Column order from arrangement (or previous merge).
|
|
61
|
-
* @param effectiveByColumn - Per-column card id order from arrangement.
|
|
66
|
+
* @param effectiveByColumn - Per-column card id order + hidden flag from arrangement.
|
|
62
67
|
* @param selectOptions - Defines valid column ids; any missing from order are appended.
|
|
63
68
|
* @returns ColumnStructure array in display order.
|
|
64
69
|
*/
|
|
@@ -78,10 +83,12 @@ export const computeColumnStructure = (
|
|
|
78
83
|
}
|
|
79
84
|
}
|
|
80
85
|
|
|
81
|
-
return order
|
|
82
|
-
columnValue
|
|
83
|
-
|
|
84
|
-
|
|
86
|
+
return order
|
|
87
|
+
.filter((columnValue) => effectiveByColumn[columnValue]?.hidden !== true)
|
|
88
|
+
.map((columnValue) => ({
|
|
89
|
+
columnValue,
|
|
90
|
+
ids: effectiveByColumn[columnValue]?.ids ?? [],
|
|
91
|
+
}));
|
|
85
92
|
};
|
|
86
93
|
|
|
87
94
|
/**
|
|
@@ -152,13 +159,16 @@ export const computeItemArrangement = <T extends BaseKanbanItem = BaseKanbanItem
|
|
|
152
159
|
const validColumnValues = new Set(selectOptions.map((opt) => opt.id));
|
|
153
160
|
const byColumn = getOrderByColumnFromArrangement(object?.arrangement);
|
|
154
161
|
|
|
155
|
-
// Column order: uncategorized first, then each select option (skip
|
|
162
|
+
// Column order: uncategorized first, then each select option (skip
|
|
163
|
+
// uncategorized if duplicated). Columns whose arrangement entry has
|
|
164
|
+
// `hidden: true` are dropped — same generic hide-by-column flag used
|
|
165
|
+
// by `computeColumnStructure`.
|
|
156
166
|
const columnEntries = [
|
|
157
167
|
{ columnValue: UNCATEGORIZED_VALUE, ids: byColumn[UNCATEGORIZED_VALUE]?.ids ?? [] },
|
|
158
168
|
...selectOptions
|
|
159
169
|
.filter((opt) => opt.id !== UNCATEGORIZED_VALUE)
|
|
160
170
|
.map((opt) => ({ columnValue: opt.id, ids: byColumn[opt.id]?.ids ?? [] })),
|
|
161
|
-
];
|
|
171
|
+
].filter((entry) => byColumn[entry.columnValue]?.hidden !== true);
|
|
162
172
|
|
|
163
173
|
return columnEntries.map(({ columnValue, ids }) => ({
|
|
164
174
|
columnValue,
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/blueprints/kanban-blueprint.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type AppCapabilities } from '@dxos/app-toolkit';\nimport { Blueprint, Template } from '@dxos/blueprints';\nimport { trim } from '@dxos/util';\n\nconst BLUEPRINT_KEY = 'org.dxos.blueprint.kanban';\n\nconst make = () =>\n Blueprint.make({\n key: BLUEPRINT_KEY,\n name: 'Kanban',\n tools: Blueprint.toolDefinitions({ tools: [] }),\n instructions: Template.make({\n source: trim`\n You can create and update kanban boards to show data in sorted columns defined by schema.\n `,\n }),\n });\n\nconst blueprint: AppCapabilities.BlueprintDefinition = {\n key: BLUEPRINT_KEY,\n make,\n};\n\nexport default blueprint;\n"],
|
|
5
|
-
"mappings": ";;;AAKA,SAASA,WAAWC,gBAAgB;AACpC,SAASC,YAAY;AAErB,IAAMC,gBAAgB;AAEtB,IAAMC,OAAO,MACXC,UAAUD,KAAK;EACbE,KAAKH;EACLI,MAAM;EACNC,OAAOH,UAAUI,gBAAgB;IAAED,OAAO,CAAA;EAAG,CAAA;EAC7CE,cAAcC,SAASP,KAAK;IAC1BQ,QAAQC;;;EAGV,CAAA;AACF,CAAA;AAEF,IAAMC,YAAiD;EACrDR,KAAKH;EACLC;AACF;AAEA,IAAA,2BAAeU;",
|
|
6
|
-
"names": ["Blueprint", "Template", "trim", "BLUEPRINT_KEY", "make", "Blueprint", "key", "name", "tools", "toolDefinitions", "instructions", "Template", "source", "trim", "blueprint"]
|
|
7
|
-
}
|