piral-dashboard 0.15.0-alpha.4332 → 0.15.0-alpha.4396
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/package.json +7 -3
- package/src/Dashboard.test.tsx +7 -7
- package/src/actions.test.ts +5 -5
- package/src/create.test.ts +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piral-dashboard",
|
|
3
|
-
"version": "0.15.0-alpha.
|
|
3
|
+
"version": "0.15.0-alpha.4396",
|
|
4
4
|
"description": "Plugin for creating a centralized dashboard in Piral.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"piral",
|
|
@@ -31,6 +31,10 @@
|
|
|
31
31
|
"./lib/*": {
|
|
32
32
|
"require": "./lib/*"
|
|
33
33
|
},
|
|
34
|
+
"./_/*": {
|
|
35
|
+
"import": "./esm/*.js",
|
|
36
|
+
"require": "./lib/*.js"
|
|
37
|
+
},
|
|
34
38
|
"./package.json": "./package.json"
|
|
35
39
|
},
|
|
36
40
|
"sideEffects": false,
|
|
@@ -59,12 +63,12 @@
|
|
|
59
63
|
"devDependencies": {
|
|
60
64
|
"@types/react": "^18.0.0",
|
|
61
65
|
"@types/react-router-dom": "^5.1.6",
|
|
62
|
-
"piral-core": "0.15.0-alpha.
|
|
66
|
+
"piral-core": "0.15.0-alpha.4396",
|
|
63
67
|
"react": "^18.0.0"
|
|
64
68
|
},
|
|
65
69
|
"peerDependencies": {
|
|
66
70
|
"piral-core": "0.14.x || 0.15.x",
|
|
67
71
|
"react": ">=16.8.0"
|
|
68
72
|
},
|
|
69
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "62abff4d61634b3ecffda2407f1c29f1de929b4c"
|
|
70
74
|
}
|
package/src/Dashboard.test.tsx
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import create from 'zustand';
|
|
2
3
|
import { mount } from 'enzyme';
|
|
3
4
|
import { StateContext } from 'piral-core';
|
|
4
|
-
import { Atom, swap, deref } from '@dbeining/react-atom';
|
|
5
5
|
import { Dashboard } from './Dashboard';
|
|
6
6
|
|
|
7
|
-
const MockDbContainer: React.FC = ({ children }) => <div>{children}</div>;
|
|
7
|
+
const MockDbContainer: React.FC<any> = ({ children }) => <div>{children}</div>;
|
|
8
8
|
MockDbContainer.displayName = 'MockDbContainer';
|
|
9
|
-
const MockDbTile: React.FC = ({ children }) => <div>{children}</div>;
|
|
9
|
+
const MockDbTile: React.FC<any> = ({ children }) => <div>{children}</div>;
|
|
10
10
|
MockDbTile.displayName = 'MockDbTile';
|
|
11
11
|
|
|
12
12
|
function createMockContainer(tiles = {}) {
|
|
13
|
-
const state =
|
|
13
|
+
const state = create(() => ({
|
|
14
14
|
components: {
|
|
15
15
|
DashboardContainer: MockDbContainer,
|
|
16
16
|
DashboardTile: MockDbTile,
|
|
@@ -18,7 +18,7 @@ function createMockContainer(tiles = {}) {
|
|
|
18
18
|
registry: {
|
|
19
19
|
tiles,
|
|
20
20
|
},
|
|
21
|
-
});
|
|
21
|
+
}));
|
|
22
22
|
return {
|
|
23
23
|
context: {
|
|
24
24
|
on: jest.fn(),
|
|
@@ -27,10 +27,10 @@ function createMockContainer(tiles = {}) {
|
|
|
27
27
|
defineActions() {},
|
|
28
28
|
state,
|
|
29
29
|
readState(read) {
|
|
30
|
-
return read(
|
|
30
|
+
return read(state.getState());
|
|
31
31
|
},
|
|
32
32
|
dispatch(update) {
|
|
33
|
-
|
|
33
|
+
state.setState(update(state.getState()));
|
|
34
34
|
},
|
|
35
35
|
} as any,
|
|
36
36
|
api: {} as any,
|
package/src/actions.test.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import
|
|
1
|
+
import create from 'zustand';
|
|
2
2
|
import { createListener } from 'piral-base';
|
|
3
3
|
import { createActions } from 'piral-core';
|
|
4
4
|
import { registerTile, unregisterTile } from './actions';
|
|
5
5
|
|
|
6
6
|
describe('Dashboard Actions Module', () => {
|
|
7
7
|
it('registerTile and unregisterTile', () => {
|
|
8
|
-
const state =
|
|
8
|
+
const state: any = create(() => ({
|
|
9
9
|
foo: 5,
|
|
10
10
|
registry: {
|
|
11
11
|
foo: 5,
|
|
12
12
|
tiles: {},
|
|
13
13
|
},
|
|
14
|
-
});
|
|
14
|
+
}));
|
|
15
15
|
const ctx = createActions(state, createListener({}));
|
|
16
16
|
registerTile(ctx, 'foo', 10);
|
|
17
|
-
expect(
|
|
17
|
+
expect((state.getState())).toEqual({
|
|
18
18
|
foo: 5,
|
|
19
19
|
registry: {
|
|
20
20
|
foo: 5,
|
|
@@ -24,7 +24,7 @@ describe('Dashboard Actions Module', () => {
|
|
|
24
24
|
},
|
|
25
25
|
});
|
|
26
26
|
unregisterTile(ctx, 'foo');
|
|
27
|
-
expect(
|
|
27
|
+
expect((state.getState())).toEqual({
|
|
28
28
|
foo: 5,
|
|
29
29
|
registry: {
|
|
30
30
|
foo: 5,
|
package/src/create.test.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import create from 'zustand';
|
|
2
2
|
import { createElement, FC } from 'react';
|
|
3
3
|
import { createDashboardApi } from './create';
|
|
4
4
|
|
|
@@ -6,11 +6,11 @@ const StubComponent: FC = (props) => createElement('div', props);
|
|
|
6
6
|
StubComponent.displayName = 'StubComponent';
|
|
7
7
|
|
|
8
8
|
function createMockContainer() {
|
|
9
|
-
const state =
|
|
9
|
+
const state = create(() => ({
|
|
10
10
|
registry: {
|
|
11
11
|
extensions: {},
|
|
12
12
|
},
|
|
13
|
-
});
|
|
13
|
+
}));
|
|
14
14
|
return {
|
|
15
15
|
context: {
|
|
16
16
|
on: jest.fn(),
|
|
@@ -23,7 +23,7 @@ function createMockContainer() {
|
|
|
23
23
|
},
|
|
24
24
|
state,
|
|
25
25
|
dispatch(update) {
|
|
26
|
-
|
|
26
|
+
state.setState(update(state.getState()));
|
|
27
27
|
},
|
|
28
28
|
} as any,
|
|
29
29
|
api: {} as any,
|