@dxos/plugin-kanban 0.8.4-main.28f8d3d → 0.8.4-main.406dc2a
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/blueprint-definition-UYVX622Q.mjs +28 -0
- package/dist/lib/browser/blueprint-definition-UYVX622Q.mjs.map +7 -0
- package/dist/lib/browser/{chunk-5BR6HNHI.mjs → chunk-K7KYFJ3P.mjs} +4 -32
- package/dist/lib/browser/chunk-K7KYFJ3P.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +16 -11
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-65UVYRI2.mjs → intent-resolver-LR3SDMKQ.mjs} +14 -14
- package/dist/lib/browser/intent-resolver-LR3SDMKQ.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-KX5U6PJ2.mjs → react-surface-R2ORFB43.mjs} +23 -24
- package/dist/lib/browser/react-surface-R2ORFB43.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +3 -5
- package/dist/lib/node-esm/blueprint-definition-42P47FUY.mjs +30 -0
- package/dist/lib/node-esm/blueprint-definition-42P47FUY.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-WLFZKRIJ.mjs → chunk-VDWYSHP4.mjs} +4 -32
- package/dist/lib/node-esm/chunk-VDWYSHP4.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +16 -11
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-R3MYQATZ.mjs → intent-resolver-CKDNVLND.mjs} +14 -14
- package/dist/lib/node-esm/intent-resolver-CKDNVLND.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-BAMERRU5.mjs → react-surface-RMRLHCOY.mjs} +23 -24
- package/dist/lib/node-esm/react-surface-RMRLHCOY.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +3 -5
- package/dist/types/src/KanbanPlugin.d.ts +1 -1
- package/dist/types/src/KanbanPlugin.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 +5 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +3 -2
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/components/KanbanContainer.d.ts.map +1 -1
- package/dist/types/src/components/KanbanContainer.stories.d.ts +37 -6
- package/dist/types/src/components/KanbanContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/KanbanViewEditor.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +0 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +2 -2
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +0 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +11 -54
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +40 -40
- package/src/KanbanPlugin.tsx +49 -44
- package/src/capabilities/artifact-definition.ts +3 -2
- package/src/capabilities/blueprint-definition.ts +30 -0
- package/src/capabilities/index.ts +1 -0
- package/src/capabilities/intent-resolver.ts +9 -8
- package/src/capabilities/react-surface.tsx +4 -4
- package/src/components/KanbanContainer.stories.tsx +31 -27
- package/src/components/KanbanContainer.tsx +4 -4
- package/src/components/KanbanViewEditor.tsx +14 -10
- package/src/meta.ts +1 -3
- package/src/translations.ts +2 -2
- package/src/types/index.ts +0 -1
- package/src/types/schema.ts +3 -3
- package/dist/lib/browser/chunk-5BR6HNHI.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-65UVYRI2.mjs.map +0 -7
- package/dist/lib/browser/react-surface-KX5U6PJ2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WLFZKRIJ.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-R3MYQATZ.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-BAMERRU5.mjs.map +0 -7
- package/dist/types/src/types/kanban.d.ts +0 -11
- package/dist/types/src/types/kanban.d.ts.map +0 -1
- package/src/types/kanban.ts +0 -29
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-kanban",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.406dc2a",
|
|
4
4
|
"description": "Kanban DXOS Surface plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -36,50 +36,50 @@
|
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@preact-signals/safe-react": "^0.9.0",
|
|
39
|
-
"@preact/signals-core": "^1.
|
|
40
|
-
"effect": "3.
|
|
41
|
-
"@dxos/ai": "0.8.4-main.
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/async": "0.8.4-main.
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/echo": "0.8.4-main.
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/plugin-
|
|
52
|
-
"@dxos/plugin-
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/random": "0.8.4-main.
|
|
55
|
-
"@dxos/react-client": "0.8.4-main.
|
|
56
|
-
"@dxos/
|
|
57
|
-
"@dxos/
|
|
58
|
-
"@dxos/react-ui-kanban": "0.8.4-main.
|
|
59
|
-
"@dxos/react-ui-
|
|
60
|
-
"@dxos/react-ui-
|
|
61
|
-
"@dxos/
|
|
62
|
-
"@dxos/
|
|
39
|
+
"@preact/signals-core": "^1.12.1",
|
|
40
|
+
"effect": "3.18.3",
|
|
41
|
+
"@dxos/ai": "0.8.4-main.406dc2a",
|
|
42
|
+
"@dxos/app-framework": "0.8.4-main.406dc2a",
|
|
43
|
+
"@dxos/assistant": "0.8.4-main.406dc2a",
|
|
44
|
+
"@dxos/async": "0.8.4-main.406dc2a",
|
|
45
|
+
"@dxos/effect": "0.8.4-main.406dc2a",
|
|
46
|
+
"@dxos/echo": "0.8.4-main.406dc2a",
|
|
47
|
+
"@dxos/functions": "0.8.4-main.406dc2a",
|
|
48
|
+
"@dxos/blueprints": "0.8.4-main.406dc2a",
|
|
49
|
+
"@dxos/invariant": "0.8.4-main.406dc2a",
|
|
50
|
+
"@dxos/log": "0.8.4-main.406dc2a",
|
|
51
|
+
"@dxos/plugin-client": "0.8.4-main.406dc2a",
|
|
52
|
+
"@dxos/plugin-graph": "0.8.4-main.406dc2a",
|
|
53
|
+
"@dxos/plugin-search": "0.8.4-main.406dc2a",
|
|
54
|
+
"@dxos/random": "0.8.4-main.406dc2a",
|
|
55
|
+
"@dxos/react-client": "0.8.4-main.406dc2a",
|
|
56
|
+
"@dxos/plugin-space": "0.8.4-main.406dc2a",
|
|
57
|
+
"@dxos/react-ui": "0.8.4-main.406dc2a",
|
|
58
|
+
"@dxos/react-ui-kanban": "0.8.4-main.406dc2a",
|
|
59
|
+
"@dxos/react-ui-stack": "0.8.4-main.406dc2a",
|
|
60
|
+
"@dxos/react-ui-form": "0.8.4-main.406dc2a",
|
|
61
|
+
"@dxos/schema": "0.8.4-main.406dc2a",
|
|
62
|
+
"@dxos/util": "0.8.4-main.406dc2a"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@types/react": "~
|
|
66
|
-
"@types/react-dom": "~
|
|
67
|
-
"react": "~
|
|
68
|
-
"react-dom": "~
|
|
69
|
-
"vite": "
|
|
70
|
-
"@dxos/plugin-theme": "0.8.4-main.
|
|
71
|
-
"@dxos/plugin-preview": "0.8.4-main.
|
|
72
|
-
"@dxos/react-ui-
|
|
73
|
-
"@dxos/
|
|
74
|
-
"@dxos/
|
|
75
|
-
"@dxos/test-utils": "0.8.4-main.
|
|
65
|
+
"@types/react": "~19.2.2",
|
|
66
|
+
"@types/react-dom": "~19.2.1",
|
|
67
|
+
"react": "~19.2.0",
|
|
68
|
+
"react-dom": "~19.2.0",
|
|
69
|
+
"vite": "7.1.9",
|
|
70
|
+
"@dxos/plugin-theme": "0.8.4-main.406dc2a",
|
|
71
|
+
"@dxos/plugin-preview": "0.8.4-main.406dc2a",
|
|
72
|
+
"@dxos/react-ui-theme": "0.8.4-main.406dc2a",
|
|
73
|
+
"@dxos/storybook-utils": "0.8.4-main.406dc2a",
|
|
74
|
+
"@dxos/react-ui-syntax-highlighter": "0.8.4-main.406dc2a",
|
|
75
|
+
"@dxos/test-utils": "0.8.4-main.406dc2a"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
78
|
"effect": "^3.13.3",
|
|
79
|
-
"react": "
|
|
80
|
-
"react-dom": "
|
|
81
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
82
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
79
|
+
"react": "^19.0.0",
|
|
80
|
+
"react-dom": "^19.0.0",
|
|
81
|
+
"@dxos/react-ui": "0.8.4-main.406dc2a",
|
|
82
|
+
"@dxos/react-ui-theme": "0.8.4-main.406dc2a"
|
|
83
83
|
},
|
|
84
84
|
"publishConfig": {
|
|
85
85
|
"access": "public"
|
package/src/KanbanPlugin.tsx
CHANGED
|
@@ -6,53 +6,58 @@ import { Capabilities, Events, contributes, createIntent, defineModule, definePl
|
|
|
6
6
|
import { ClientEvents } from '@dxos/plugin-client';
|
|
7
7
|
import { SpaceCapabilities } from '@dxos/plugin-space';
|
|
8
8
|
import { defineObjectForm } from '@dxos/plugin-space/types';
|
|
9
|
-
import {
|
|
9
|
+
import { translations as kanbanTranslations } from '@dxos/react-ui-kanban';
|
|
10
|
+
import { Kanban } from '@dxos/react-ui-kanban/types';
|
|
10
11
|
|
|
11
|
-
import { IntentResolver, ReactSurface } from './capabilities';
|
|
12
|
+
import { BlueprintDefinition, IntentResolver, ReactSurface } from './capabilities';
|
|
12
13
|
import { meta } from './meta';
|
|
13
14
|
import { translations } from './translations';
|
|
14
15
|
import { CreateKanbanSchema, KanbanAction } from './types';
|
|
15
16
|
|
|
16
|
-
export const KanbanPlugin = () =>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
17
|
+
export const KanbanPlugin = definePlugin(meta, () => [
|
|
18
|
+
defineModule({
|
|
19
|
+
id: `${meta.id}/module/translations`,
|
|
20
|
+
activatesOn: Events.SetupTranslations,
|
|
21
|
+
activate: () => contributes(Capabilities.Translations, [...translations, ...kanbanTranslations]),
|
|
22
|
+
}),
|
|
23
|
+
defineModule({
|
|
24
|
+
id: `${meta.id}/module/metadata`,
|
|
25
|
+
activatesOn: Events.SetupMetadata,
|
|
26
|
+
activate: () =>
|
|
27
|
+
contributes(Capabilities.Metadata, {
|
|
28
|
+
id: Kanban.Kanban.typename,
|
|
29
|
+
metadata: {
|
|
30
|
+
icon: 'ph--kanban--regular',
|
|
31
|
+
},
|
|
32
|
+
}),
|
|
33
|
+
}),
|
|
34
|
+
defineModule({
|
|
35
|
+
id: `${meta.id}/module/object-form`,
|
|
36
|
+
activatesOn: ClientEvents.SetupSchema,
|
|
37
|
+
activate: () =>
|
|
38
|
+
contributes(
|
|
39
|
+
SpaceCapabilities.ObjectForm,
|
|
40
|
+
defineObjectForm({
|
|
41
|
+
objectSchema: Kanban.Kanban,
|
|
42
|
+
formSchema: CreateKanbanSchema,
|
|
43
|
+
hidden: true,
|
|
44
|
+
getIntent: (props, options) => createIntent(KanbanAction.Create, { ...props, space: options.space }),
|
|
32
45
|
}),
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
activate: ReactSurface,
|
|
52
|
-
}),
|
|
53
|
-
defineModule({
|
|
54
|
-
id: `${meta.id}/module/intent-resolver`,
|
|
55
|
-
activatesOn: Events.SetupIntentResolver,
|
|
56
|
-
activate: IntentResolver,
|
|
57
|
-
}),
|
|
58
|
-
]);
|
|
46
|
+
),
|
|
47
|
+
}),
|
|
48
|
+
defineModule({
|
|
49
|
+
id: `${meta.id}/module/react-surface`,
|
|
50
|
+
activatesOn: Events.SetupReactSurface,
|
|
51
|
+
activate: ReactSurface,
|
|
52
|
+
}),
|
|
53
|
+
defineModule({
|
|
54
|
+
id: `${meta.id}/module/intent-resolver`,
|
|
55
|
+
activatesOn: Events.SetupIntentResolver,
|
|
56
|
+
activate: IntentResolver,
|
|
57
|
+
}),
|
|
58
|
+
defineModule({
|
|
59
|
+
id: `${meta.id}/module/blueprint`,
|
|
60
|
+
activatesOn: Events.SetupArtifactDefinition,
|
|
61
|
+
activate: BlueprintDefinition,
|
|
62
|
+
}),
|
|
63
|
+
]);
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
// ISSUE(burdon): defineArtifact
|
|
6
6
|
// @ts-nocheck
|
|
7
7
|
|
|
8
|
-
import
|
|
8
|
+
import * as Function from 'effect/Function';
|
|
9
|
+
import * as Schema from 'effect/Schema';
|
|
9
10
|
|
|
10
11
|
import { ToolResult, createTool } from '@dxos/ai';
|
|
11
12
|
import { Capabilities, type PromiseIntentDispatcher, chain, contributes, createIntent } from '@dxos/app-framework';
|
|
@@ -68,7 +69,7 @@ export default () => {
|
|
|
68
69
|
return ToolResult.Error(`Schema not found: ${typename}`);
|
|
69
70
|
}
|
|
70
71
|
|
|
71
|
-
const intent = pipe(
|
|
72
|
+
const intent = Function.pipe(
|
|
72
73
|
createIntent(KanbanAction.Create, {
|
|
73
74
|
space: extensions.space,
|
|
74
75
|
typename,
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Capabilities, contributes } from '@dxos/app-framework';
|
|
6
|
+
import { Blueprint, Template } from '@dxos/blueprints';
|
|
7
|
+
import { type FunctionDefinition } from '@dxos/functions';
|
|
8
|
+
import { trim } from '@dxos/util';
|
|
9
|
+
|
|
10
|
+
const functions: FunctionDefinition[] = [];
|
|
11
|
+
const tools: string[] = [];
|
|
12
|
+
|
|
13
|
+
export default () => {
|
|
14
|
+
return [
|
|
15
|
+
contributes(Capabilities.Functions, functions),
|
|
16
|
+
contributes(
|
|
17
|
+
Capabilities.BlueprintDefinition,
|
|
18
|
+
Blueprint.make({
|
|
19
|
+
key: 'dxos.org/blueprint/kanban',
|
|
20
|
+
name: 'Kanban',
|
|
21
|
+
tools: Blueprint.toolDefinitions({ functions, tools }),
|
|
22
|
+
instructions: Template.make({
|
|
23
|
+
source: trim`
|
|
24
|
+
You can create and update kanban boards to show data in sorted columns defined by schema.
|
|
25
|
+
`,
|
|
26
|
+
}),
|
|
27
|
+
}),
|
|
28
|
+
),
|
|
29
|
+
];
|
|
30
|
+
};
|
|
@@ -4,5 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
import { lazy } from '@dxos/app-framework';
|
|
6
6
|
|
|
7
|
+
export const BlueprintDefinition = lazy(() => import('./blueprint-definition'));
|
|
7
8
|
export const IntentResolver = lazy(() => import('./intent-resolver'));
|
|
8
9
|
export const ReactSurface = lazy(() => import('./react-surface'));
|
|
@@ -6,10 +6,11 @@ import { Capabilities, type PluginContext, contributes, createResolver } from '@
|
|
|
6
6
|
import { invariant } from '@dxos/invariant';
|
|
7
7
|
import { ClientCapabilities } from '@dxos/plugin-client';
|
|
8
8
|
import { getSpace } from '@dxos/react-client/echo';
|
|
9
|
-
import {
|
|
9
|
+
import { Kanban } from '@dxos/react-ui-kanban/types';
|
|
10
|
+
import { ProjectionModel, getTypenameFromQuery } from '@dxos/schema';
|
|
10
11
|
|
|
11
|
-
import {
|
|
12
|
-
import { KanbanAction
|
|
12
|
+
import { meta } from '../meta';
|
|
13
|
+
import { KanbanAction } from '../types';
|
|
13
14
|
|
|
14
15
|
export default (context: PluginContext) =>
|
|
15
16
|
contributes(Capabilities.IntentResolver, [
|
|
@@ -17,12 +18,12 @@ export default (context: PluginContext) =>
|
|
|
17
18
|
intent: KanbanAction.Create,
|
|
18
19
|
resolve: async ({ space, name, typename, initialPivotColumn }) => {
|
|
19
20
|
const client = context.getCapability(ClientCapabilities.Client);
|
|
20
|
-
const { view } = await
|
|
21
|
+
const { view } = await Kanban.makeView({
|
|
21
22
|
client,
|
|
22
23
|
space,
|
|
23
24
|
name,
|
|
24
25
|
typename,
|
|
25
|
-
initialPivotColumn,
|
|
26
|
+
pivotFieldName: initialPivotColumn,
|
|
26
27
|
});
|
|
27
28
|
return { data: { object: view } };
|
|
28
29
|
},
|
|
@@ -30,7 +31,7 @@ export default (context: PluginContext) =>
|
|
|
30
31
|
createResolver({
|
|
31
32
|
intent: KanbanAction.DeleteCardField,
|
|
32
33
|
resolve: async ({ view, fieldId, deletionData }, undo) => {
|
|
33
|
-
const schema = getSpace(view)?.db.schemaRegistry.getSchema(view.query.
|
|
34
|
+
const schema = getSpace(view)?.db.schemaRegistry.getSchema(getTypenameFromQuery(view.query.ast)!);
|
|
34
35
|
invariant(schema);
|
|
35
36
|
const projection = new ProjectionModel(schema.jsonSchema, view.projection);
|
|
36
37
|
|
|
@@ -38,7 +39,7 @@ export default (context: PluginContext) =>
|
|
|
38
39
|
const { deleted, index } = projection.deleteFieldProjection(fieldId);
|
|
39
40
|
return {
|
|
40
41
|
undoable: {
|
|
41
|
-
message: ['card field deleted label', { ns:
|
|
42
|
+
message: ['card field deleted label', { ns: meta.id }],
|
|
42
43
|
data: { deletionData: { ...deleted, index } },
|
|
43
44
|
},
|
|
44
45
|
};
|
|
@@ -58,7 +59,7 @@ export default (context: PluginContext) =>
|
|
|
58
59
|
space.db.remove(card);
|
|
59
60
|
return {
|
|
60
61
|
undoable: {
|
|
61
|
-
message: ['card deleted label', { ns:
|
|
62
|
+
message: ['card deleted label', { ns: meta.id }],
|
|
62
63
|
data: { card },
|
|
63
64
|
},
|
|
64
65
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import type * as Schema from 'effect/Schema';
|
|
6
6
|
import React, { useMemo } from 'react';
|
|
7
7
|
|
|
8
8
|
import { Capabilities, contributes, createSurface, useCapabilities } from '@dxos/app-framework';
|
|
@@ -11,7 +11,7 @@ import { findAnnotation } from '@dxos/effect';
|
|
|
11
11
|
import { ClientCapabilities } from '@dxos/plugin-client';
|
|
12
12
|
import { type Space, getSpace, isSpace } from '@dxos/react-client/echo';
|
|
13
13
|
import { type InputProps, SelectInput, useFormValues } from '@dxos/react-ui-form';
|
|
14
|
-
import {
|
|
14
|
+
import { Kanban } from '@dxos/react-ui-kanban/types';
|
|
15
15
|
import { DataType } from '@dxos/schema';
|
|
16
16
|
|
|
17
17
|
import { KanbanContainer, KanbanViewEditor } from '../components';
|
|
@@ -24,7 +24,7 @@ export default () =>
|
|
|
24
24
|
id: meta.id,
|
|
25
25
|
role: ['article', 'section'],
|
|
26
26
|
filter: (data): data is { subject: DataType.View } =>
|
|
27
|
-
Obj.instanceOf(DataType.View, data.subject) && Obj.instanceOf(
|
|
27
|
+
Obj.instanceOf(DataType.View, data.subject) && Obj.instanceOf(Kanban.Kanban, data.subject.presentation.target),
|
|
28
28
|
component: ({ data, role }) => <KanbanContainer view={data.subject} role={role} />,
|
|
29
29
|
}),
|
|
30
30
|
createSurface({
|
|
@@ -32,7 +32,7 @@ export default () =>
|
|
|
32
32
|
role: 'object-settings',
|
|
33
33
|
position: 'hoist',
|
|
34
34
|
filter: (data): data is { subject: DataType.View } =>
|
|
35
|
-
Obj.instanceOf(DataType.View, data.subject) && Obj.instanceOf(
|
|
35
|
+
Obj.instanceOf(DataType.View, data.subject) && Obj.instanceOf(Kanban.Kanban, data.subject.presentation.target),
|
|
36
36
|
component: ({ data }) => <KanbanViewEditor view={data.subject} />,
|
|
37
37
|
}),
|
|
38
38
|
createSurface({
|
|
@@ -2,14 +2,12 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
6
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
9
7
|
|
|
10
8
|
import { IntentPlugin, SettingsPlugin } from '@dxos/app-framework';
|
|
11
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
12
|
-
import { Obj, Type } from '@dxos/echo';
|
|
10
|
+
import { Obj, type QueryAST, Type } from '@dxos/echo';
|
|
13
11
|
import { invariant } from '@dxos/invariant';
|
|
14
12
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
15
13
|
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
@@ -20,15 +18,15 @@ import { ThemePlugin } from '@dxos/plugin-theme';
|
|
|
20
18
|
import { faker } from '@dxos/random';
|
|
21
19
|
import { useClient } from '@dxos/react-client';
|
|
22
20
|
import { Filter, useQuery, useSchema, useSpaces } from '@dxos/react-client/echo';
|
|
21
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
23
22
|
import { ViewEditor } from '@dxos/react-ui-form';
|
|
24
|
-
import { Kanban
|
|
23
|
+
import { Kanban as KanbanComponent, useKanbanModel } from '@dxos/react-ui-kanban';
|
|
24
|
+
import { Kanban } from '@dxos/react-ui-kanban/types';
|
|
25
25
|
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
26
26
|
import { defaultTx } from '@dxos/react-ui-theme';
|
|
27
|
-
import { DataType, ProjectionModel } from '@dxos/schema';
|
|
28
|
-
import { withLayout } from '@dxos/storybook-utils';
|
|
27
|
+
import { DataType, ProjectionModel, getTypenameFromQuery } from '@dxos/schema';
|
|
29
28
|
|
|
30
29
|
import { translations } from '../translations';
|
|
31
|
-
import { createKanban } from '../types';
|
|
32
30
|
|
|
33
31
|
faker.seed(0);
|
|
34
32
|
|
|
@@ -51,7 +49,8 @@ const StorybookKanban = () => {
|
|
|
51
49
|
const views = useQuery(space, Filter.type(DataType.View));
|
|
52
50
|
const [view, setView] = useState<DataType.View>();
|
|
53
51
|
const [projection, setProjection] = useState<ProjectionModel>();
|
|
54
|
-
const
|
|
52
|
+
const typename = view?.query ? getTypenameFromQuery(view.query.ast) : undefined;
|
|
53
|
+
const schema = useSchema(client, space, typename);
|
|
55
54
|
|
|
56
55
|
useEffect(() => {
|
|
57
56
|
if (views.length && !view) {
|
|
@@ -97,14 +96,14 @@ const StorybookKanban = () => {
|
|
|
97
96
|
|
|
98
97
|
const handleRemoveCard = useCallback((card: { id: string }) => space.db.remove(card), [space]);
|
|
99
98
|
|
|
100
|
-
const
|
|
101
|
-
(
|
|
99
|
+
const handleUpdateQuery = useCallback(
|
|
100
|
+
(newQuery: QueryAST.Query) => {
|
|
102
101
|
invariant(schema);
|
|
103
102
|
invariant(Type.isMutable(schema));
|
|
104
103
|
invariant(view);
|
|
105
104
|
|
|
106
|
-
schema.updateTypename(
|
|
107
|
-
view.query.
|
|
105
|
+
schema.updateTypename(getTypenameFromQuery(newQuery));
|
|
106
|
+
view.query.ast = newQuery;
|
|
108
107
|
},
|
|
109
108
|
[view, schema],
|
|
110
109
|
);
|
|
@@ -115,18 +114,18 @@ const StorybookKanban = () => {
|
|
|
115
114
|
|
|
116
115
|
return (
|
|
117
116
|
<div className='grow grid grid-cols-[1fr_350px]'>
|
|
118
|
-
{model ? <
|
|
117
|
+
{model ? <KanbanComponent model={model} onAddCard={handleAddCard} onRemoveCard={handleRemoveCard} /> : <div />}
|
|
119
118
|
<div className='flex flex-col bs-full border-is border-separator overflow-y-auto'>
|
|
120
119
|
<ViewEditor
|
|
121
120
|
registry={space?.db.schemaRegistry}
|
|
122
121
|
schema={schema}
|
|
123
122
|
view={view}
|
|
124
|
-
|
|
123
|
+
onQueryChanged={handleUpdateQuery}
|
|
125
124
|
onDelete={(fieldId: string) => {
|
|
126
125
|
console.log('[ViewEditor]', 'onDelete', fieldId);
|
|
127
126
|
}}
|
|
128
127
|
/>
|
|
129
|
-
<SyntaxHighlighter language='json' className='
|
|
128
|
+
<SyntaxHighlighter language='json' className='text-xs'>
|
|
130
129
|
{JSON.stringify({ view, schema }, null, 2)}
|
|
131
130
|
</SyntaxHighlighter>
|
|
132
131
|
</div>
|
|
@@ -142,27 +141,25 @@ type StoryProps = {
|
|
|
142
141
|
// Story definitions.
|
|
143
142
|
//
|
|
144
143
|
|
|
145
|
-
const meta
|
|
144
|
+
const meta = {
|
|
146
145
|
title: 'plugins/plugin-kanban/Kanban',
|
|
147
146
|
component: StorybookKanban,
|
|
148
147
|
render: () => <StorybookKanban />,
|
|
149
|
-
parameters: { translations },
|
|
150
148
|
decorators: [
|
|
151
|
-
|
|
149
|
+
withTheme,
|
|
152
150
|
withPluginManager({
|
|
153
151
|
plugins: [
|
|
154
|
-
ThemePlugin({ tx: defaultTx }),
|
|
155
152
|
ClientPlugin({
|
|
156
|
-
types: [DataType.Organization, DataType.Person, DataType.View,
|
|
153
|
+
types: [DataType.Organization, DataType.Person, DataType.View, Kanban.Kanban],
|
|
157
154
|
onClientInitialized: async ({ client }) => {
|
|
158
155
|
await client.halo.createIdentity();
|
|
159
156
|
const space = await client.spaces.create();
|
|
160
157
|
await space.waitUntilReady();
|
|
161
|
-
const { view } = await
|
|
158
|
+
const { view } = await Kanban.makeView({
|
|
162
159
|
client,
|
|
163
160
|
space,
|
|
164
161
|
typename: DataType.Organization.typename,
|
|
165
|
-
|
|
162
|
+
pivotFieldName: 'status',
|
|
166
163
|
});
|
|
167
164
|
space.db.add(view);
|
|
168
165
|
|
|
@@ -172,18 +169,25 @@ const meta: Meta<StoryProps> = {
|
|
|
172
169
|
});
|
|
173
170
|
},
|
|
174
171
|
}),
|
|
175
|
-
|
|
176
|
-
PreviewPlugin(),
|
|
177
|
-
SpacePlugin(),
|
|
172
|
+
SpacePlugin({}),
|
|
178
173
|
IntentPlugin(),
|
|
179
174
|
SettingsPlugin(),
|
|
175
|
+
|
|
176
|
+
// UI
|
|
177
|
+
ThemePlugin({ tx: defaultTx }),
|
|
178
|
+
PreviewPlugin(),
|
|
179
|
+
StorybookLayoutPlugin({}),
|
|
180
180
|
],
|
|
181
181
|
}),
|
|
182
182
|
],
|
|
183
|
-
|
|
183
|
+
parameters: {
|
|
184
|
+
layout: 'fullscreen',
|
|
185
|
+
translations,
|
|
186
|
+
},
|
|
187
|
+
} satisfies Meta<typeof StorybookKanban>;
|
|
184
188
|
|
|
185
189
|
export default meta;
|
|
186
190
|
|
|
187
|
-
type Story = StoryObj<
|
|
191
|
+
type Story = StoryObj<typeof meta>;
|
|
188
192
|
|
|
189
193
|
export const Default: Story = {};
|
|
@@ -6,13 +6,13 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { createIntent, useIntentDispatcher } from '@dxos/app-framework';
|
|
8
8
|
import { Filter, Obj, Type } from '@dxos/echo';
|
|
9
|
-
import { EchoSchema, type TypedObject } from '@dxos/echo
|
|
9
|
+
import { EchoSchema, type TypedObject } from '@dxos/echo/internal';
|
|
10
10
|
import { useGlobalFilteredObjects } from '@dxos/plugin-search';
|
|
11
11
|
import { useClient } from '@dxos/react-client';
|
|
12
12
|
import { getSpace, useQuery } from '@dxos/react-client/echo';
|
|
13
13
|
import { Kanban, useKanbanModel } from '@dxos/react-ui-kanban';
|
|
14
14
|
import { StackItem } from '@dxos/react-ui-stack';
|
|
15
|
-
import { type DataType, ProjectionModel } from '@dxos/schema';
|
|
15
|
+
import { type DataType, ProjectionModel, getTypenameFromQuery } from '@dxos/schema';
|
|
16
16
|
|
|
17
17
|
import { KanbanAction } from '../types';
|
|
18
18
|
|
|
@@ -22,6 +22,7 @@ export const KanbanContainer = ({ view }: { view: DataType.View; role: string })
|
|
|
22
22
|
const [projection, setProjection] = useState<ProjectionModel>();
|
|
23
23
|
const space = getSpace(view);
|
|
24
24
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
25
|
+
const typename = view.query ? getTypenameFromQuery(view.query.ast) : undefined;
|
|
25
26
|
|
|
26
27
|
const jsonSchema = useMemo(() => {
|
|
27
28
|
if (!cardSchema) {
|
|
@@ -31,7 +32,6 @@ export const KanbanContainer = ({ view }: { view: DataType.View; role: string })
|
|
|
31
32
|
}, [cardSchema]);
|
|
32
33
|
|
|
33
34
|
useEffect(() => {
|
|
34
|
-
const typename = view.query.typename;
|
|
35
35
|
const staticSchema = client.graph.schemaRegistry.schemas.find((schema) => Type.getTypename(schema) === typename);
|
|
36
36
|
if (staticSchema) {
|
|
37
37
|
setCardSchema(() => staticSchema as TypedObject<any, any>);
|
|
@@ -49,7 +49,7 @@ export const KanbanContainer = ({ view }: { view: DataType.View; role: string })
|
|
|
49
49
|
);
|
|
50
50
|
return unsubscribe;
|
|
51
51
|
}
|
|
52
|
-
}, [
|
|
52
|
+
}, [typename, space]);
|
|
53
53
|
|
|
54
54
|
useEffect(() => {
|
|
55
55
|
if (jsonSchema) {
|
|
@@ -5,26 +5,27 @@
|
|
|
5
5
|
import React, { useCallback, useMemo } from 'react';
|
|
6
6
|
|
|
7
7
|
import { Type } from '@dxos/echo';
|
|
8
|
-
import { EchoSchema, FormatEnum } from '@dxos/echo
|
|
8
|
+
import { EchoSchema, FormatEnum } from '@dxos/echo/internal';
|
|
9
9
|
import { useClient } from '@dxos/react-client';
|
|
10
10
|
import { getSpace, useSchema } from '@dxos/react-client/echo';
|
|
11
11
|
import { type CustomInputMap, Form, SelectInput } from '@dxos/react-ui-form';
|
|
12
|
-
import {
|
|
13
|
-
import { type DataType, ProjectionModel } from '@dxos/schema';
|
|
12
|
+
import { Kanban } from '@dxos/react-ui-kanban/types';
|
|
13
|
+
import { type DataType, ProjectionModel, getTypenameFromQuery } from '@dxos/schema';
|
|
14
14
|
|
|
15
15
|
type KanbanViewEditorProps = { view: DataType.View };
|
|
16
16
|
|
|
17
17
|
export const KanbanViewEditor = ({ view }: KanbanViewEditorProps) => {
|
|
18
18
|
const client = useClient();
|
|
19
19
|
const space = getSpace(view);
|
|
20
|
-
const
|
|
21
|
-
const currentTypename = useMemo(() => view.query.typename, [view.query.typename]);
|
|
20
|
+
const currentTypename = view.query ? getTypenameFromQuery(view.query.ast) : undefined;
|
|
22
21
|
const schema = useSchema(client, space, currentTypename);
|
|
23
22
|
|
|
24
23
|
const projection = useMemo(() => {
|
|
25
24
|
if (schema) {
|
|
26
25
|
const jsonSchema = schema instanceof EchoSchema ? schema.jsonSchema : Type.toJsonSchema(schema);
|
|
27
|
-
|
|
26
|
+
const projection = new ProjectionModel(jsonSchema, view.projection);
|
|
27
|
+
projection.normalizeView();
|
|
28
|
+
return projection;
|
|
28
29
|
}
|
|
29
30
|
}, [view.projection, JSON.stringify(schema)]);
|
|
30
31
|
|
|
@@ -35,12 +36,15 @@ export const KanbanViewEditor = ({ view }: KanbanViewEditorProps) => {
|
|
|
35
36
|
|
|
36
37
|
const handleSave = useCallback(
|
|
37
38
|
(values: Partial<{ columnFieldId: string }>) => {
|
|
38
|
-
|
|
39
|
+
view.projection.pivotFieldId = values.columnFieldId;
|
|
39
40
|
},
|
|
40
|
-
[
|
|
41
|
+
[view],
|
|
41
42
|
);
|
|
42
43
|
|
|
43
|
-
const initialValues = useMemo(
|
|
44
|
+
const initialValues = useMemo(
|
|
45
|
+
() => ({ columnFieldId: view.projection.pivotFieldId }),
|
|
46
|
+
[view.projection.pivotFieldId],
|
|
47
|
+
);
|
|
44
48
|
const custom: CustomInputMap = useMemo(
|
|
45
49
|
() => ({ columnFieldId: (props) => <SelectInput {...props} options={selectFields} /> }),
|
|
46
50
|
[selectFields],
|
|
@@ -49,7 +53,7 @@ export const KanbanViewEditor = ({ view }: KanbanViewEditorProps) => {
|
|
|
49
53
|
return (
|
|
50
54
|
<Form
|
|
51
55
|
Custom={custom}
|
|
52
|
-
schema={
|
|
56
|
+
schema={Kanban.SettingsSchema}
|
|
53
57
|
values={initialValues}
|
|
54
58
|
onSave={handleSave}
|
|
55
59
|
autoSave
|
package/src/meta.ts
CHANGED
|
@@ -4,10 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import { type PluginMeta } from '@dxos/app-framework';
|
|
6
6
|
|
|
7
|
-
export const KANBAN_PLUGIN = 'dxos.org/plugin/kanban';
|
|
8
|
-
|
|
9
7
|
export const meta: PluginMeta = {
|
|
10
|
-
id:
|
|
8
|
+
id: 'dxos.org/plugin/kanban',
|
|
11
9
|
name: 'Kanban',
|
|
12
10
|
description:
|
|
13
11
|
'Kanban allows you to explore Table data in sorted columns defined by your custom schema. You can use Kanbans to track progress or trigger custom automations when cards are moved from one state to another.',
|
package/src/translations.ts
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Resource } from '@dxos/react-ui';
|
|
6
|
-
import {
|
|
6
|
+
import { Kanban } from '@dxos/react-ui-kanban/types';
|
|
7
7
|
|
|
8
8
|
import { meta } from './meta';
|
|
9
9
|
|
|
10
10
|
export const translations = [
|
|
11
11
|
{
|
|
12
12
|
'en-US': {
|
|
13
|
-
[
|
|
13
|
+
[Kanban.Kanban.typename]: {
|
|
14
14
|
'typename label': 'Kanban',
|
|
15
15
|
'typename label_zero': 'Kanbans',
|
|
16
16
|
'typename label_one': 'Kanban',
|