@object-ui/plugin-kanban 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,26 @@
1
+ import { describe, it, expect, vi } from 'vitest';
2
+ import { render, screen } from '@testing-library/react';
3
+ import React from 'react';
4
+ import { ObjectKanbanRenderer } from './index';
5
+
6
+ // Mock dependencies
7
+ vi.mock('@object-ui/react', () => ({
8
+ useSchemaContext: vi.fn(() => ({ dataSource: { type: 'mock-datasource' } })),
9
+ }));
10
+
11
+ // Mock the implementation
12
+ vi.mock('./ObjectKanban', () => ({
13
+ ObjectKanban: ({ dataSource }: any) => (
14
+ <div data-testid="kanban-mock">
15
+ {dataSource ? `DataSource: ${dataSource.type}` : 'No DataSource'}
16
+ </div>
17
+ )
18
+ }));
19
+
20
+ describe('Plugin Kanban Registration', () => {
21
+ it('renderer passes dataSource from context', () => {
22
+
23
+ render(<ObjectKanbanRenderer schema={{ type: 'object-kanban' }} />);
24
+ expect(screen.getByTestId('kanban-mock')).toHaveTextContent('DataSource: mock-datasource');
25
+ });
26
+ });
package/src/types.ts CHANGED
@@ -1,3 +1,11 @@
1
+ /**
2
+ * ObjectUI
3
+ * Copyright (c) 2024-present ObjectStack Inc.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+
1
9
  import type { BaseSchema } from '@object-ui/types';
2
10
 
3
11
  /**
@@ -29,6 +37,31 @@ export interface KanbanColumn {
29
37
  export interface KanbanSchema extends BaseSchema {
30
38
  type: 'kanban';
31
39
 
40
+ /**
41
+ * Object name to fetch data from.
42
+ */
43
+ objectName?: string;
44
+
45
+ /**
46
+ * Field to group records by (maps to column IDs).
47
+ */
48
+ groupBy?: string;
49
+
50
+ /**
51
+ * Field to use as the card title.
52
+ */
53
+ cardTitle?: string;
54
+
55
+ /**
56
+ * Fields to display on the card.
57
+ */
58
+ cardFields?: string[];
59
+
60
+ /**
61
+ * Static data or bound data.
62
+ */
63
+ data?: any[];
64
+
32
65
  /**
33
66
  * Array of columns to display in the kanban board.
34
67
  * Each column contains an array of cards.
package/tsconfig.json CHANGED
@@ -1,11 +1,19 @@
1
1
  {
2
2
  "extends": "../../tsconfig.json",
3
3
  "compilerOptions": {
4
- "outDir": "./dist",
5
- "rootDir": "./src",
4
+ "outDir": "dist",
5
+ "jsx": "react-jsx",
6
+ "baseUrl": ".",
7
+ "paths": {
8
+ "@/*": ["src/*"]
9
+ },
10
+ // Removed rootDir to prevent file not under rootDir errors when importing from workspace dependencies
11
+ "noEmit": false,
12
+ "declaration": true,
6
13
  "composite": true,
7
- "declarationMap": true
14
+ "declarationMap": true,
15
+ "skipLibCheck": true
8
16
  },
9
- "include": ["src/**/*"],
17
+ "include": ["src"],
10
18
  "exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.test.tsx"]
11
19
  }
package/vite.config.ts CHANGED
@@ -1,3 +1,11 @@
1
+ /**
2
+ * ObjectUI
3
+ * Copyright (c) 2024-present ObjectStack Inc.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+
1
9
  import { defineConfig } from 'vite';
2
10
  import react from '@vitejs/plugin-react';
3
11
  import dts from 'vite-plugin-dts';
@@ -9,11 +17,20 @@ export default defineConfig({
9
17
  dts({
10
18
  insertTypesEntry: true,
11
19
  include: ['src'],
20
+ exclude: ['**/*.test.ts', '**/*.test.tsx', 'node_modules'],
21
+ skipDiagnostics: true,
12
22
  }),
13
23
  ],
14
24
  resolve: {
15
25
  alias: {
16
26
  '@': resolve(__dirname, './src'),
27
+ '@object-ui/core': resolve(__dirname, '../core/src'),
28
+ '@object-ui/types': resolve(__dirname, '../types/src'),
29
+ '@object-ui/react': resolve(__dirname, '../react/src'),
30
+ '@object-ui/components': resolve(__dirname, '../components/src'),
31
+ '@object-ui/fields': resolve(__dirname, '../fields/src'),
32
+ '@object-ui/plugin-dashboard': resolve(__dirname, '../plugin-dashboard/src'),
33
+ '@object-ui/plugin-grid': resolve(__dirname, '../plugin-grid/src'),
17
34
  },
18
35
  },
19
36
  build: {
@@ -35,4 +52,10 @@ export default defineConfig({
35
52
  },
36
53
  },
37
54
  },
55
+ test: {
56
+ globals: true,
57
+ environment: 'happy-dom',
58
+ setupFiles: ['../../vitest.setup.tsx'],
59
+ passWithNoTests: true,
60
+ },
38
61
  });
@@ -0,0 +1,12 @@
1
+ /// <reference types="vitest" />
2
+ import { defineConfig } from 'vite';
3
+ import react from '@vitejs/plugin-react';
4
+
5
+ export default defineConfig({
6
+ plugins: [react()],
7
+ test: {
8
+ environment: 'happy-dom',
9
+ globals: true,
10
+ setupFiles: ['./vitest.setup.ts'],
11
+ },
12
+ });
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -1 +0,0 @@
1
- {"version":3,"file":"KanbanImpl.d.ts","sourceRoot":"","sources":["../src/KanbanImpl.tsx"],"names":[],"mappings":"AAuBA,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,aAAa,GAAG,SAAS,CAAA;KAAE,CAAC,CAAA;IAChG,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,UAAU,EAAE,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;IACjG,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAsGD,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE,gBAAgB,2CA0IvF"}