piral-dashboard 1.6.0-beta.7240 → 1.6.0-beta.7244
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/lib/Dashboard.js +8 -12
- package/lib/Dashboard.js.map +1 -1
- package/lib/actions.js +5 -10
- package/lib/actions.js.map +1 -1
- package/lib/components.js +3 -6
- package/lib/components.js.map +1 -1
- package/lib/create.js +10 -14
- package/lib/create.js.map +1 -1
- package/lib/default.js +4 -9
- package/lib/default.js.map +1 -1
- package/lib/helpers.js +9 -16
- package/lib/helpers.js.map +1 -1
- package/lib/index.js +4 -7
- package/lib/index.js.map +1 -1
- package/lib/types.js +1 -2
- package/package.json +9 -20
- package/esm/Dashboard.d.ts +0 -11
- package/esm/Dashboard.js +0 -22
- package/esm/Dashboard.js.map +0 -1
- package/esm/actions.d.ts +0 -4
- package/esm/actions.js +0 -20
- package/esm/actions.js.map +0 -1
- package/esm/components.d.ts +0 -3
- package/esm/components.js +0 -4
- package/esm/components.js.map +0 -1
- package/esm/create.d.ts +0 -26
- package/esm/create.js +0 -39
- package/esm/create.js.map +0 -1
- package/esm/default.d.ts +0 -4
- package/esm/default.js +0 -5
- package/esm/default.js.map +0 -1
- package/esm/helpers.d.ts +0 -11
- package/esm/helpers.js +0 -47
- package/esm/helpers.js.map +0 -1
- package/esm/index.d.ts +0 -4
- package/esm/index.js +0 -5
- package/esm/index.js.map +0 -1
- package/esm/types.d.ts +0 -161
- package/esm/types.js +0 -2
- package/esm/types.js.map +0 -1
package/lib/Dashboard.js
CHANGED
|
@@ -1,26 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const React = require("react");
|
|
5
|
-
const piral_core_1 = require("piral-core");
|
|
6
|
-
const components_1 = require("./components");
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useGlobalState } from 'piral-core';
|
|
3
|
+
import { PiralDashboardContainer, PiralDashboardTile } from './components';
|
|
7
4
|
/**
|
|
8
5
|
* The dashboard component. Integrate this as a page or in a component
|
|
9
6
|
* where dashboard information (tiles) should be shown.
|
|
10
7
|
*/
|
|
11
|
-
const Dashboard = (props) => {
|
|
12
|
-
const tiles =
|
|
8
|
+
export const Dashboard = (props) => {
|
|
9
|
+
const tiles = useGlobalState((s) => s.registry.tiles);
|
|
13
10
|
const { filter = () => true } = props;
|
|
14
11
|
const children = Object.keys(tiles)
|
|
15
12
|
.filter((tile) => filter(tiles[tile]))
|
|
16
13
|
.map((tile) => {
|
|
17
14
|
const { component: Component, preferences } = tiles[tile];
|
|
18
15
|
const { initialColumns = 1, initialRows = 1, resizable = false } = preferences;
|
|
19
|
-
return (React.createElement(
|
|
16
|
+
return (React.createElement(PiralDashboardTile, { key: tile, columns: initialColumns, rows: initialRows, resizable: resizable, meta: preferences },
|
|
20
17
|
React.createElement(Component, { columns: initialColumns, rows: initialRows })));
|
|
21
18
|
});
|
|
22
|
-
return React.createElement(
|
|
19
|
+
return React.createElement(PiralDashboardContainer, { ...props, children: children });
|
|
23
20
|
};
|
|
24
|
-
|
|
25
|
-
exports.Dashboard.displayName = 'Dashboard';
|
|
21
|
+
Dashboard.displayName = 'Dashboard';
|
|
26
22
|
//# sourceMappingURL=Dashboard.js.map
|
package/lib/Dashboard.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dashboard.js","sourceRoot":"","sources":["../src/Dashboard.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Dashboard.js","sourceRoot":"","sources":["../src/Dashboard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAO3E;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAA6B,CAAC,KAAK,EAAE,EAAE;IAC3D,MAAM,KAAK,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtD,MAAM,EAAE,MAAM,GAAG,GAAG,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,CAAC;IACtC,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;SAChC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;SACrC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACZ,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;QAC1D,MAAM,EAAE,cAAc,GAAG,CAAC,EAAE,WAAW,GAAG,CAAC,EAAE,SAAS,GAAG,KAAK,EAAE,GAAG,WAAW,CAAC;QAC/E,OAAO,CACL,oBAAC,kBAAkB,IACjB,GAAG,EAAE,IAAI,EACT,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,WAAW,EACjB,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,WAAW;YACjB,oBAAC,SAAS,IAAC,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,WAAW,GAAI,CACtC,CACtB,CAAC;IACJ,CAAC,CAAC,CAAC;IAEL,OAAO,oBAAC,uBAAuB,OAAK,KAAK,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAAC;AACpE,CAAC,CAAC;AACF,SAAS,CAAC,WAAW,GAAG,WAAW,CAAC"}
|
package/lib/actions.js
CHANGED
|
@@ -1,25 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.unregisterTile = exports.registerTile = void 0;
|
|
4
|
-
const piral_core_1 = require("piral-core");
|
|
5
|
-
function registerTile(ctx, name, value) {
|
|
1
|
+
import { withKey, withoutKey } from 'piral-core';
|
|
2
|
+
export function registerTile(ctx, name, value) {
|
|
6
3
|
ctx.dispatch((state) => ({
|
|
7
4
|
...state,
|
|
8
5
|
registry: {
|
|
9
6
|
...state.registry,
|
|
10
|
-
tiles:
|
|
7
|
+
tiles: withKey(state.registry.tiles, name, value),
|
|
11
8
|
},
|
|
12
9
|
}));
|
|
13
10
|
}
|
|
14
|
-
|
|
15
|
-
function unregisterTile(ctx, name) {
|
|
11
|
+
export function unregisterTile(ctx, name) {
|
|
16
12
|
ctx.dispatch((state) => ({
|
|
17
13
|
...state,
|
|
18
14
|
registry: {
|
|
19
15
|
...state.registry,
|
|
20
|
-
tiles:
|
|
16
|
+
tiles: withoutKey(state.registry.tiles, name),
|
|
21
17
|
},
|
|
22
18
|
}));
|
|
23
19
|
}
|
|
24
|
-
exports.unregisterTile = unregisterTile;
|
|
25
20
|
//# sourceMappingURL=actions.js.map
|
package/lib/actions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAsB,MAAM,YAAY,CAAC;AAGrE,MAAM,UAAU,YAAY,CAAC,GAAuB,EAAE,IAAY,EAAE,KAAuB;IACzF,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACvB,GAAG,KAAK;QACR,QAAQ,EAAE;YACR,GAAG,KAAK,CAAC,QAAQ;YACjB,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC;SAClD;KACF,CAAC,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,GAAuB,EAAE,IAAY;IAClE,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACvB,GAAG,KAAK;QACR,QAAQ,EAAE;YACR,GAAG,KAAK,CAAC,QAAQ;YACjB,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC;SAC9C;KACF,CAAC,CAAC,CAAC;AACN,CAAC"}
|
package/lib/components.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const piral_core_1 = require("piral-core");
|
|
5
|
-
exports.PiralDashboardContainer = (0, piral_core_1.getPiralComponent)('DashboardContainer');
|
|
6
|
-
exports.PiralDashboardTile = (0, piral_core_1.getPiralComponent)('DashboardTile');
|
|
1
|
+
import { getPiralComponent } from 'piral-core';
|
|
2
|
+
export const PiralDashboardContainer = getPiralComponent('DashboardContainer');
|
|
3
|
+
export const PiralDashboardTile = getPiralComponent('DashboardTile');
|
|
7
4
|
//# sourceMappingURL=components.js.map
|
package/lib/components.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.js","sourceRoot":"","sources":["../src/components.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"components.js","sourceRoot":"","sources":["../src/components.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,MAAM,CAAC,MAAM,uBAAuB,GAAG,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;AAC/E,MAAM,CAAC,MAAM,kBAAkB,GAAG,iBAAiB,CAAC,eAAe,CAAC,CAAC"}
|
package/lib/create.js
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const piral_core_1 = require("piral-core");
|
|
6
|
-
const Dashboard_1 = require("./Dashboard");
|
|
7
|
-
const helpers_1 = require("./helpers");
|
|
1
|
+
import * as actions from './actions';
|
|
2
|
+
import { buildName, withApi, withRootExtension, withAll } from 'piral-core';
|
|
3
|
+
import { Dashboard } from './Dashboard';
|
|
4
|
+
import { getPreferences, getTiles, withRoutes, withTiles } from './helpers';
|
|
8
5
|
/**
|
|
9
6
|
* Creates the Pilet API extension for activating dashboard support.
|
|
10
7
|
*/
|
|
11
|
-
function createDashboardApi(config = {}) {
|
|
8
|
+
export function createDashboardApi(config = {}) {
|
|
12
9
|
const { tiles = [], defaultPreferences = {}, routes = ['/'] } = config;
|
|
13
10
|
return (context) => {
|
|
14
11
|
context.defineActions(actions);
|
|
15
|
-
context.dispatch(
|
|
12
|
+
context.dispatch(withAll(withTiles(getTiles(tiles, defaultPreferences)), withRootExtension('piral-dashboard', Dashboard), withRoutes(routes)));
|
|
16
13
|
return (api, target) => {
|
|
17
14
|
const pilet = target.name;
|
|
18
15
|
let next = 0;
|
|
@@ -23,21 +20,20 @@ function createDashboardApi(config = {}) {
|
|
|
23
20
|
arg = name;
|
|
24
21
|
name = next++;
|
|
25
22
|
}
|
|
26
|
-
const id =
|
|
23
|
+
const id = buildName(pilet, name);
|
|
27
24
|
context.registerTile(id, {
|
|
28
25
|
pilet,
|
|
29
|
-
component:
|
|
30
|
-
preferences:
|
|
26
|
+
component: withApi(context, arg, api, 'tile'),
|
|
27
|
+
preferences: getPreferences(defaultPreferences, preferences),
|
|
31
28
|
});
|
|
32
29
|
return () => api.unregisterTile(name);
|
|
33
30
|
},
|
|
34
31
|
unregisterTile(name) {
|
|
35
|
-
const id =
|
|
32
|
+
const id = buildName(pilet, name);
|
|
36
33
|
context.unregisterTile(id);
|
|
37
34
|
},
|
|
38
35
|
};
|
|
39
36
|
};
|
|
40
37
|
};
|
|
41
38
|
}
|
|
42
|
-
exports.createDashboardApi = createDashboardApi;
|
|
43
39
|
//# sourceMappingURL=create.js.map
|
package/lib/create.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAe,iBAAiB,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACzF,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAuB5E;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,SAA0B,EAAE;IAC7D,MAAM,EAAE,KAAK,GAAG,EAAE,EAAE,kBAAkB,GAAG,EAAE,EAAE,MAAM,GAAG,CAAC,GAAG,CAAC,EAAE,GAAG,MAAM,CAAC;IAEvE,OAAO,CAAC,OAAO,EAAE,EAAE;QACjB,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAE/B,OAAO,CAAC,QAAQ,CACd,OAAO,CACL,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC,EAC9C,iBAAiB,CAAC,iBAAiB,EAAE,SAAS,CAAC,EAC/C,UAAU,CAAC,MAAM,CAAC,CACnB,CACF,CAAC;QAEF,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;YACrB,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC;YAC1B,IAAI,IAAI,GAAG,CAAC,CAAC;YAEb,OAAO;gBACL,YAAY,CAAC,IAAI,EAAE,GAAG,EAAE,WAAY;oBAClC,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;wBAC5B,WAAW,GAAG,GAAG,CAAC;wBAClB,GAAG,GAAG,IAAI,CAAC;wBACX,IAAI,GAAG,IAAI,EAAE,CAAC;qBACf;oBAED,MAAM,EAAE,GAAG,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;oBAClC,OAAO,CAAC,YAAY,CAAC,EAAE,EAAE;wBACvB,KAAK;wBACL,SAAS,EAAE,OAAO,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC;wBAC7C,WAAW,EAAE,cAAc,CAAC,kBAAkB,EAAE,WAAW,CAAC;qBAC7D,CAAC,CAAC;oBACH,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;gBACxC,CAAC;gBACD,cAAc,CAAC,IAAI;oBACjB,MAAM,EAAE,GAAG,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;oBAClC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;gBAC7B,CAAC;aACF,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
|
package/lib/default.js
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const piral_core_1 = require("piral-core");
|
|
6
|
-
const DefaultContainer = (props) => (React.createElement(piral_core_1.ExtensionSlot, { name: "dashboard", params: props, empty: () => (0, piral_core_1.defaultRender)(props.children, 'default_dashboard') }));
|
|
7
|
-
exports.DefaultContainer = DefaultContainer;
|
|
8
|
-
const DefaultTile = (props) => (0, piral_core_1.defaultRender)(props.children);
|
|
9
|
-
exports.DefaultTile = DefaultTile;
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ExtensionSlot, defaultRender } from 'piral-core';
|
|
3
|
+
export const DefaultContainer = (props) => (React.createElement(ExtensionSlot, { name: "dashboard", params: props, empty: () => defaultRender(props.children, 'default_dashboard') }));
|
|
4
|
+
export const DefaultTile = (props) => defaultRender(props.children);
|
|
10
5
|
//# sourceMappingURL=default.js.map
|
package/lib/default.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default.js","sourceRoot":"","sources":["../src/default.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"default.js","sourceRoot":"","sources":["../src/default.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAG1D,MAAM,CAAC,MAAM,gBAAgB,GAAsC,CAAC,KAAK,EAAE,EAAE,CAAC,CAC5E,oBAAC,aAAa,IAAC,IAAI,EAAC,WAAW,EAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,EAAE,mBAAmB,CAAC,GAAI,CACnH,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAiC,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC"}
|
package/lib/helpers.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const default_1 = require("./default");
|
|
5
|
-
const Dashboard_1 = require("./Dashboard");
|
|
6
|
-
function getPreferences(defaultPreferences, customPreferences = {}) {
|
|
1
|
+
import { DefaultTile, DefaultContainer } from './default';
|
|
2
|
+
import { Dashboard } from './Dashboard';
|
|
3
|
+
export function getPreferences(defaultPreferences, customPreferences = {}) {
|
|
7
4
|
return {
|
|
8
5
|
...defaultPreferences,
|
|
9
6
|
...customPreferences,
|
|
10
7
|
};
|
|
11
8
|
}
|
|
12
|
-
|
|
13
|
-
function getTiles(items, defaultPreferences) {
|
|
9
|
+
export function getTiles(items, defaultPreferences) {
|
|
14
10
|
const tiles = {};
|
|
15
11
|
let i = 0;
|
|
16
12
|
for (const { component, preferences } of items) {
|
|
@@ -22,13 +18,12 @@ function getTiles(items, defaultPreferences) {
|
|
|
22
18
|
}
|
|
23
19
|
return tiles;
|
|
24
20
|
}
|
|
25
|
-
|
|
26
|
-
function withTiles(tiles) {
|
|
21
|
+
export function withTiles(tiles) {
|
|
27
22
|
return (state) => ({
|
|
28
23
|
...state,
|
|
29
24
|
components: {
|
|
30
|
-
DashboardTile:
|
|
31
|
-
DashboardContainer:
|
|
25
|
+
DashboardTile: DefaultTile,
|
|
26
|
+
DashboardContainer: DefaultContainer,
|
|
32
27
|
...state.components,
|
|
33
28
|
},
|
|
34
29
|
registry: {
|
|
@@ -37,18 +32,16 @@ function withTiles(tiles) {
|
|
|
37
32
|
},
|
|
38
33
|
});
|
|
39
34
|
}
|
|
40
|
-
|
|
41
|
-
function withRoutes(routes) {
|
|
35
|
+
export function withRoutes(routes) {
|
|
42
36
|
return (state) => ({
|
|
43
37
|
...state,
|
|
44
38
|
routes: {
|
|
45
39
|
...state.routes,
|
|
46
40
|
...routes.reduce((newRoutes, route) => {
|
|
47
|
-
newRoutes[route] =
|
|
41
|
+
newRoutes[route] = Dashboard;
|
|
48
42
|
return newRoutes;
|
|
49
43
|
}, {}),
|
|
50
44
|
},
|
|
51
45
|
});
|
|
52
46
|
}
|
|
53
|
-
exports.withRoutes = withRoutes;
|
|
54
47
|
//# sourceMappingURL=helpers.js.map
|
package/lib/helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,MAAM,UAAU,cAAc,CAAC,kBAAmC,EAAE,oBAAqC,EAAE;IACzG,OAAO;QACL,GAAG,kBAAkB;QACrB,GAAG,iBAAiB;KACrB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,KAAyB,EAAE,kBAAmC;IACrF,MAAM,KAAK,GAA2B,EAAE,CAAC;IACzC,IAAI,CAAC,GAAG,CAAC,CAAC;IAEV,KAAK,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,KAAK,EAAE;QAC9C,KAAK,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC,GAAG;YACvB,KAAK,EAAE,SAAS;YAChB,SAAS;YACT,WAAW,EAAE,cAAc,CAAC,kBAAkB,EAAE,WAAW,CAAC;SAC7D,CAAC;KACH;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,KAA6B;IACrD,OAAO,CAAC,KAAkB,EAAe,EAAE,CAAC,CAAC;QAC3C,GAAG,KAAK;QACR,UAAU,EAAE;YACV,aAAa,EAAE,WAAW;YAC1B,kBAAkB,EAAE,gBAAgB;YACpC,GAAG,KAAK,CAAC,UAAU;SACpB;QACD,QAAQ,EAAE;YACR,GAAG,KAAK,CAAC,QAAQ;YACjB,KAAK;SACN;KACF,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,MAAqB;IAC9C,OAAO,CAAC,KAAkB,EAAe,EAAE,CAAC,CAAC;QAC3C,GAAG,KAAK;QACR,MAAM,EAAE;YACN,GAAG,KAAK,CAAC,MAAM;YACf,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE;gBACpC,SAAS,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC;gBAC7B,OAAO,SAAS,CAAC;YACnB,CAAC,EAAE,EAAE,CAAC;SACP;KACF,CAAC,CAAC;AACL,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
tslib_1.__exportStar(require("./components"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./Dashboard"), exports);
|
|
7
|
-
tslib_1.__exportStar(require("./types"), exports);
|
|
1
|
+
export * from './create';
|
|
2
|
+
export * from './components';
|
|
3
|
+
export * from './Dashboard';
|
|
4
|
+
export * from './types';
|
|
8
5
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
|
package/lib/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piral-dashboard",
|
|
3
|
-
"version": "1.6.0-beta.
|
|
3
|
+
"version": "1.6.0-beta.7244",
|
|
4
4
|
"description": "Plugin for creating a centralized dashboard in Piral.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"piral",
|
|
@@ -17,29 +17,19 @@
|
|
|
17
17
|
"author": "smapiot",
|
|
18
18
|
"homepage": "https://piral.io",
|
|
19
19
|
"license": "MIT",
|
|
20
|
-
"module": "
|
|
20
|
+
"module": "lib/index.js",
|
|
21
21
|
"main": "lib/index.js",
|
|
22
22
|
"typings": "lib/index.d.ts",
|
|
23
23
|
"exports": {
|
|
24
|
-
".":
|
|
25
|
-
"import": "./esm/index.js",
|
|
26
|
-
"require": "./lib/index.js"
|
|
27
|
-
},
|
|
28
|
-
"./esm/*": {
|
|
29
|
-
"import": "./esm/*"
|
|
30
|
-
},
|
|
24
|
+
".": "./lib/index.js",
|
|
31
25
|
"./lib/*": {
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
"./_/*": {
|
|
35
|
-
"import": "./esm/*.js",
|
|
36
|
-
"require": "./lib/*.js"
|
|
26
|
+
"import": "./lib/*",
|
|
27
|
+
"types": "./lib/*.d.ts"
|
|
37
28
|
},
|
|
38
29
|
"./package.json": "./package.json"
|
|
39
30
|
},
|
|
40
31
|
"sideEffects": false,
|
|
41
32
|
"files": [
|
|
42
|
-
"esm",
|
|
43
33
|
"lib",
|
|
44
34
|
"src",
|
|
45
35
|
"piral-dashboard.min.js"
|
|
@@ -53,18 +43,17 @@
|
|
|
53
43
|
},
|
|
54
44
|
"scripts": {
|
|
55
45
|
"cleanup": "rimraf esm lib piral-dashboard.min.js",
|
|
56
|
-
"build": "yarn build:bundle && yarn build:
|
|
46
|
+
"build": "yarn build:bundle && yarn build:esnext",
|
|
57
47
|
"build:bundle": "esbuild src/index.ts --outfile=piral-dashboard.min.js --bundle --external:piral-core --external:react --minify --global-name=piralDashboard",
|
|
58
|
-
"build:
|
|
59
|
-
"build:esnext": "tsc --project tsconfig.json --outDir esm --module esnext",
|
|
48
|
+
"build:esnext": "tsc --project tsconfig.json --outDir lib --module esnext",
|
|
60
49
|
"typedoc": "typedoc --json ../../../docs/types/piral-dashboard.json src --exclude \"src/**/*.test.*\"",
|
|
61
50
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
62
51
|
},
|
|
63
52
|
"devDependencies": {
|
|
64
53
|
"@types/react": "^18.0.0",
|
|
65
54
|
"@types/react-router-dom": "^5.1.6",
|
|
66
|
-
"piral-core": "1.6.0-beta.
|
|
55
|
+
"piral-core": "1.6.0-beta.7244",
|
|
67
56
|
"react": "^18.0.0"
|
|
68
57
|
},
|
|
69
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "65ac1291c3429dbf16079b4deb6138b24c5719f7"
|
|
70
59
|
}
|
package/esm/Dashboard.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import type { RouteComponentProps } from 'react-router-dom';
|
|
3
|
-
import { TileRegistration } from './types';
|
|
4
|
-
export interface DashboardProps extends RouteComponentProps {
|
|
5
|
-
filter?(tile: TileRegistration): boolean;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* The dashboard component. Integrate this as a page or in a component
|
|
9
|
-
* where dashboard information (tiles) should be shown.
|
|
10
|
-
*/
|
|
11
|
-
export declare const Dashboard: React.FC<DashboardProps>;
|
package/esm/Dashboard.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { useGlobalState } from 'piral-core';
|
|
3
|
-
import { PiralDashboardContainer, PiralDashboardTile } from './components';
|
|
4
|
-
/**
|
|
5
|
-
* The dashboard component. Integrate this as a page or in a component
|
|
6
|
-
* where dashboard information (tiles) should be shown.
|
|
7
|
-
*/
|
|
8
|
-
export const Dashboard = (props) => {
|
|
9
|
-
const tiles = useGlobalState((s) => s.registry.tiles);
|
|
10
|
-
const { filter = () => true } = props;
|
|
11
|
-
const children = Object.keys(tiles)
|
|
12
|
-
.filter((tile) => filter(tiles[tile]))
|
|
13
|
-
.map((tile) => {
|
|
14
|
-
const { component: Component, preferences } = tiles[tile];
|
|
15
|
-
const { initialColumns = 1, initialRows = 1, resizable = false } = preferences;
|
|
16
|
-
return (React.createElement(PiralDashboardTile, { key: tile, columns: initialColumns, rows: initialRows, resizable: resizable, meta: preferences },
|
|
17
|
-
React.createElement(Component, { columns: initialColumns, rows: initialRows })));
|
|
18
|
-
});
|
|
19
|
-
return React.createElement(PiralDashboardContainer, { ...props, children: children });
|
|
20
|
-
};
|
|
21
|
-
Dashboard.displayName = 'Dashboard';
|
|
22
|
-
//# sourceMappingURL=Dashboard.js.map
|
package/esm/Dashboard.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Dashboard.js","sourceRoot":"","sources":["../src/Dashboard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAO3E;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAA6B,CAAC,KAAK,EAAE,EAAE;IAC3D,MAAM,KAAK,GAAG,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtD,MAAM,EAAE,MAAM,GAAG,GAAG,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,CAAC;IACtC,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;SAChC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;SACrC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACZ,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;QAC1D,MAAM,EAAE,cAAc,GAAG,CAAC,EAAE,WAAW,GAAG,CAAC,EAAE,SAAS,GAAG,KAAK,EAAE,GAAG,WAAW,CAAC;QAC/E,OAAO,CACL,oBAAC,kBAAkB,IACjB,GAAG,EAAE,IAAI,EACT,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,WAAW,EACjB,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,WAAW;YACjB,oBAAC,SAAS,IAAC,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,WAAW,GAAI,CACtC,CACtB,CAAC;IACJ,CAAC,CAAC,CAAC;IAEL,OAAO,oBAAC,uBAAuB,OAAK,KAAK,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAAC;AACpE,CAAC,CAAC;AACF,SAAS,CAAC,WAAW,GAAG,WAAW,CAAC"}
|
package/esm/actions.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { GlobalStateContext } from 'piral-core';
|
|
2
|
-
import { TileRegistration } from './types';
|
|
3
|
-
export declare function registerTile(ctx: GlobalStateContext, name: string, value: TileRegistration): void;
|
|
4
|
-
export declare function unregisterTile(ctx: GlobalStateContext, name: string): void;
|
package/esm/actions.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { withKey, withoutKey } from 'piral-core';
|
|
2
|
-
export function registerTile(ctx, name, value) {
|
|
3
|
-
ctx.dispatch((state) => ({
|
|
4
|
-
...state,
|
|
5
|
-
registry: {
|
|
6
|
-
...state.registry,
|
|
7
|
-
tiles: withKey(state.registry.tiles, name, value),
|
|
8
|
-
},
|
|
9
|
-
}));
|
|
10
|
-
}
|
|
11
|
-
export function unregisterTile(ctx, name) {
|
|
12
|
-
ctx.dispatch((state) => ({
|
|
13
|
-
...state,
|
|
14
|
-
registry: {
|
|
15
|
-
...state.registry,
|
|
16
|
-
tiles: withoutKey(state.registry.tiles, name),
|
|
17
|
-
},
|
|
18
|
-
}));
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=actions.js.map
|
package/esm/actions.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAsB,MAAM,YAAY,CAAC;AAGrE,MAAM,UAAU,YAAY,CAAC,GAAuB,EAAE,IAAY,EAAE,KAAuB;IACzF,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACvB,GAAG,KAAK;QACR,QAAQ,EAAE;YACR,GAAG,KAAK,CAAC,QAAQ;YACjB,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC;SAClD;KACF,CAAC,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,GAAuB,EAAE,IAAY;IAClE,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACvB,GAAG,KAAK;QACR,QAAQ,EAAE;YACR,GAAG,KAAK,CAAC,QAAQ;YACjB,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC;SAC9C;KACF,CAAC,CAAC,CAAC;AACN,CAAC"}
|
package/esm/components.d.ts
DELETED
package/esm/components.js
DELETED
package/esm/components.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"components.js","sourceRoot":"","sources":["../src/components.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,MAAM,CAAC,MAAM,uBAAuB,GAAG,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;AAC/E,MAAM,CAAC,MAAM,kBAAkB,GAAG,iBAAiB,CAAC,eAAe,CAAC,CAAC"}
|
package/esm/create.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { PiralPlugin } from 'piral-core';
|
|
2
|
-
import { InitialTile, PiletDashboardApi, TilePreferences } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* Available configuration options for the dashboard plugin.
|
|
5
|
-
*/
|
|
6
|
-
export interface DashboardConfig {
|
|
7
|
-
/**
|
|
8
|
-
* Sets the routes where a dashboard should be displayed.
|
|
9
|
-
* @default ['/']
|
|
10
|
-
*/
|
|
11
|
-
routes?: Array<string>;
|
|
12
|
-
/**
|
|
13
|
-
* Sets the tiles to be given by the app shell.
|
|
14
|
-
* @default []
|
|
15
|
-
*/
|
|
16
|
-
tiles?: Array<InitialTile>;
|
|
17
|
-
/**
|
|
18
|
-
* Sets the default preferences to be used.
|
|
19
|
-
* @default {}
|
|
20
|
-
*/
|
|
21
|
-
defaultPreferences?: TilePreferences;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Creates the Pilet API extension for activating dashboard support.
|
|
25
|
-
*/
|
|
26
|
-
export declare function createDashboardApi(config?: DashboardConfig): PiralPlugin<PiletDashboardApi>;
|
package/esm/create.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import * as actions from './actions';
|
|
2
|
-
import { buildName, withApi, withRootExtension, withAll } from 'piral-core';
|
|
3
|
-
import { Dashboard } from './Dashboard';
|
|
4
|
-
import { getPreferences, getTiles, withRoutes, withTiles } from './helpers';
|
|
5
|
-
/**
|
|
6
|
-
* Creates the Pilet API extension for activating dashboard support.
|
|
7
|
-
*/
|
|
8
|
-
export function createDashboardApi(config = {}) {
|
|
9
|
-
const { tiles = [], defaultPreferences = {}, routes = ['/'] } = config;
|
|
10
|
-
return (context) => {
|
|
11
|
-
context.defineActions(actions);
|
|
12
|
-
context.dispatch(withAll(withTiles(getTiles(tiles, defaultPreferences)), withRootExtension('piral-dashboard', Dashboard), withRoutes(routes)));
|
|
13
|
-
return (api, target) => {
|
|
14
|
-
const pilet = target.name;
|
|
15
|
-
let next = 0;
|
|
16
|
-
return {
|
|
17
|
-
registerTile(name, arg, preferences) {
|
|
18
|
-
if (typeof name !== 'string') {
|
|
19
|
-
preferences = arg;
|
|
20
|
-
arg = name;
|
|
21
|
-
name = next++;
|
|
22
|
-
}
|
|
23
|
-
const id = buildName(pilet, name);
|
|
24
|
-
context.registerTile(id, {
|
|
25
|
-
pilet,
|
|
26
|
-
component: withApi(context, arg, api, 'tile'),
|
|
27
|
-
preferences: getPreferences(defaultPreferences, preferences),
|
|
28
|
-
});
|
|
29
|
-
return () => api.unregisterTile(name);
|
|
30
|
-
},
|
|
31
|
-
unregisterTile(name) {
|
|
32
|
-
const id = buildName(pilet, name);
|
|
33
|
-
context.unregisterTile(id);
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=create.js.map
|
package/esm/create.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAe,iBAAiB,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACzF,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAuB5E;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,SAA0B,EAAE;IAC7D,MAAM,EAAE,KAAK,GAAG,EAAE,EAAE,kBAAkB,GAAG,EAAE,EAAE,MAAM,GAAG,CAAC,GAAG,CAAC,EAAE,GAAG,MAAM,CAAC;IAEvE,OAAO,CAAC,OAAO,EAAE,EAAE;QACjB,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QAE/B,OAAO,CAAC,QAAQ,CACd,OAAO,CACL,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC,EAC9C,iBAAiB,CAAC,iBAAiB,EAAE,SAAS,CAAC,EAC/C,UAAU,CAAC,MAAM,CAAC,CACnB,CACF,CAAC;QAEF,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;YACrB,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC;YAC1B,IAAI,IAAI,GAAG,CAAC,CAAC;YAEb,OAAO;gBACL,YAAY,CAAC,IAAI,EAAE,GAAG,EAAE,WAAY;oBAClC,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;wBAC5B,WAAW,GAAG,GAAG,CAAC;wBAClB,GAAG,GAAG,IAAI,CAAC;wBACX,IAAI,GAAG,IAAI,EAAE,CAAC;qBACf;oBAED,MAAM,EAAE,GAAG,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;oBAClC,OAAO,CAAC,YAAY,CAAC,EAAE,EAAE;wBACvB,KAAK;wBACL,SAAS,EAAE,OAAO,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC;wBAC7C,WAAW,EAAE,cAAc,CAAC,kBAAkB,EAAE,WAAW,CAAC;qBAC7D,CAAC,CAAC;oBACH,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;gBACxC,CAAC;gBACD,cAAc,CAAC,IAAI;oBACjB,MAAM,EAAE,GAAG,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;oBAClC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;gBAC7B,CAAC;aACF,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
|
package/esm/default.d.ts
DELETED
package/esm/default.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { ExtensionSlot, defaultRender } from 'piral-core';
|
|
3
|
-
export const DefaultContainer = (props) => (React.createElement(ExtensionSlot, { name: "dashboard", params: props, empty: () => defaultRender(props.children, 'default_dashboard') }));
|
|
4
|
-
export const DefaultTile = (props) => defaultRender(props.children);
|
|
5
|
-
//# sourceMappingURL=default.js.map
|
package/esm/default.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"default.js","sourceRoot":"","sources":["../src/default.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAG1D,MAAM,CAAC,MAAM,gBAAgB,GAAsC,CAAC,KAAK,EAAE,EAAE,CAAC,CAC5E,oBAAC,aAAa,IAAC,IAAI,EAAC,WAAW,EAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,EAAE,mBAAmB,CAAC,GAAI,CACnH,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAiC,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC"}
|
package/esm/helpers.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Dict, GlobalState } from 'piral-core';
|
|
2
|
-
import { InitialTile, TilePreferences, TileRegistration } from './types';
|
|
3
|
-
export declare function getPreferences(defaultPreferences: TilePreferences, customPreferences?: TilePreferences): {
|
|
4
|
-
initialColumns?: number;
|
|
5
|
-
initialRows?: number;
|
|
6
|
-
resizable?: boolean;
|
|
7
|
-
customProperties?: string[];
|
|
8
|
-
};
|
|
9
|
-
export declare function getTiles(items: Array<InitialTile>, defaultPreferences: TilePreferences): Dict<TileRegistration>;
|
|
10
|
-
export declare function withTiles(tiles: Dict<TileRegistration>): (state: GlobalState) => GlobalState;
|
|
11
|
-
export declare function withRoutes(routes: Array<string>): (state: GlobalState) => GlobalState;
|
package/esm/helpers.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { DefaultTile, DefaultContainer } from './default';
|
|
2
|
-
import { Dashboard } from './Dashboard';
|
|
3
|
-
export function getPreferences(defaultPreferences, customPreferences = {}) {
|
|
4
|
-
return {
|
|
5
|
-
...defaultPreferences,
|
|
6
|
-
...customPreferences,
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
export function getTiles(items, defaultPreferences) {
|
|
10
|
-
const tiles = {};
|
|
11
|
-
let i = 0;
|
|
12
|
-
for (const { component, preferences } of items) {
|
|
13
|
-
tiles[`global-${i++}`] = {
|
|
14
|
-
pilet: undefined,
|
|
15
|
-
component,
|
|
16
|
-
preferences: getPreferences(defaultPreferences, preferences),
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
return tiles;
|
|
20
|
-
}
|
|
21
|
-
export function withTiles(tiles) {
|
|
22
|
-
return (state) => ({
|
|
23
|
-
...state,
|
|
24
|
-
components: {
|
|
25
|
-
DashboardTile: DefaultTile,
|
|
26
|
-
DashboardContainer: DefaultContainer,
|
|
27
|
-
...state.components,
|
|
28
|
-
},
|
|
29
|
-
registry: {
|
|
30
|
-
...state.registry,
|
|
31
|
-
tiles,
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
export function withRoutes(routes) {
|
|
36
|
-
return (state) => ({
|
|
37
|
-
...state,
|
|
38
|
-
routes: {
|
|
39
|
-
...state.routes,
|
|
40
|
-
...routes.reduce((newRoutes, route) => {
|
|
41
|
-
newRoutes[route] = Dashboard;
|
|
42
|
-
return newRoutes;
|
|
43
|
-
}, {}),
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=helpers.js.map
|
package/esm/helpers.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,MAAM,UAAU,cAAc,CAAC,kBAAmC,EAAE,oBAAqC,EAAE;IACzG,OAAO;QACL,GAAG,kBAAkB;QACrB,GAAG,iBAAiB;KACrB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,KAAyB,EAAE,kBAAmC;IACrF,MAAM,KAAK,GAA2B,EAAE,CAAC;IACzC,IAAI,CAAC,GAAG,CAAC,CAAC;IAEV,KAAK,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,KAAK,EAAE;QAC9C,KAAK,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC,GAAG;YACvB,KAAK,EAAE,SAAS;YAChB,SAAS;YACT,WAAW,EAAE,cAAc,CAAC,kBAAkB,EAAE,WAAW,CAAC;SAC7D,CAAC;KACH;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,KAA6B;IACrD,OAAO,CAAC,KAAkB,EAAe,EAAE,CAAC,CAAC;QAC3C,GAAG,KAAK;QACR,UAAU,EAAE;YACV,aAAa,EAAE,WAAW;YAC1B,kBAAkB,EAAE,gBAAgB;YACpC,GAAG,KAAK,CAAC,UAAU;SACpB;QACD,QAAQ,EAAE;YACR,GAAG,KAAK,CAAC,QAAQ;YACjB,KAAK;SACN;KACF,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,MAAqB;IAC9C,OAAO,CAAC,KAAkB,EAAe,EAAE,CAAC,CAAC;QAC3C,GAAG,KAAK;QACR,MAAM,EAAE;YACN,GAAG,KAAK,CAAC,MAAM;YACf,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE;gBACpC,SAAS,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC;gBAC7B,OAAO,SAAS,CAAC;YACnB,CAAC,EAAE,EAAE,CAAC;SACP;KACF,CAAC,CAAC;AACL,CAAC"}
|
package/esm/index.d.ts
DELETED
package/esm/index.js
DELETED
package/esm/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
|
package/esm/types.d.ts
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import type { ComponentType, ReactNode } from 'react';
|
|
2
|
-
import type { RouteComponentProps } from 'react-router-dom';
|
|
3
|
-
import type { Dict, WrappedComponent, BaseComponentProps, AnyComponent, BaseRegistration, RegistrationDisposer } from 'piral-core';
|
|
4
|
-
declare module 'piral-core/lib/types/custom' {
|
|
5
|
-
interface PiletCustomApi extends PiletDashboardApi {
|
|
6
|
-
}
|
|
7
|
-
interface PiralCustomState {
|
|
8
|
-
}
|
|
9
|
-
interface PiralCustomActions {
|
|
10
|
-
/**
|
|
11
|
-
* Registers a new tile.
|
|
12
|
-
* @param name The name of the tile.
|
|
13
|
-
* @param value The tile registration.
|
|
14
|
-
*/
|
|
15
|
-
registerTile(name: string, value: TileRegistration): void;
|
|
16
|
-
/**
|
|
17
|
-
* Unregisters an existing tile.
|
|
18
|
-
* @param name The name of the tile to be removed.
|
|
19
|
-
*/
|
|
20
|
-
unregisterTile(name: string): void;
|
|
21
|
-
}
|
|
22
|
-
interface PiralCustomRegistryState {
|
|
23
|
-
/**
|
|
24
|
-
* The registered tile components for a dashboard.
|
|
25
|
-
*/
|
|
26
|
-
tiles: Dict<TileRegistration>;
|
|
27
|
-
}
|
|
28
|
-
interface PiralCustomErrors {
|
|
29
|
-
tile: TileErrorInfoProps;
|
|
30
|
-
}
|
|
31
|
-
interface PiralCustomComponentsState {
|
|
32
|
-
/**
|
|
33
|
-
* The dashboard container component.
|
|
34
|
-
*/
|
|
35
|
-
DashboardContainer: ComponentType<DashboardContainerProps>;
|
|
36
|
-
/**
|
|
37
|
-
* The dashboard tile component.
|
|
38
|
-
*/
|
|
39
|
-
DashboardTile: ComponentType<DashboardTileProps>;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
export interface InitialTile {
|
|
43
|
-
/**
|
|
44
|
-
* Defines the component to be used for the tile.
|
|
45
|
-
*/
|
|
46
|
-
component: ComponentType<BareTileComponentProps>;
|
|
47
|
-
/**
|
|
48
|
-
* Optionally sets the preferences for the tile.
|
|
49
|
-
*/
|
|
50
|
-
preferences?: TilePreferences;
|
|
51
|
-
}
|
|
52
|
-
export interface DashboardContainerProps extends RouteComponentProps {
|
|
53
|
-
/**
|
|
54
|
-
* The tiles to display.
|
|
55
|
-
*/
|
|
56
|
-
children?: ReactNode;
|
|
57
|
-
}
|
|
58
|
-
export interface DashboardTileProps {
|
|
59
|
-
/**
|
|
60
|
-
* The currently used number of columns.
|
|
61
|
-
*/
|
|
62
|
-
columns: number;
|
|
63
|
-
/**
|
|
64
|
-
* The currently used number of rows.
|
|
65
|
-
*/
|
|
66
|
-
rows: number;
|
|
67
|
-
/**
|
|
68
|
-
* The resizable status.
|
|
69
|
-
*/
|
|
70
|
-
resizable: boolean;
|
|
71
|
-
/**
|
|
72
|
-
* The provided tile preferences.
|
|
73
|
-
*/
|
|
74
|
-
meta: TilePreferences;
|
|
75
|
-
/**
|
|
76
|
-
* The content of the tile to display.
|
|
77
|
-
*/
|
|
78
|
-
children?: ReactNode;
|
|
79
|
-
}
|
|
80
|
-
export interface TileErrorInfoProps {
|
|
81
|
-
/**
|
|
82
|
-
* The type of the error.
|
|
83
|
-
*/
|
|
84
|
-
type: 'tile';
|
|
85
|
-
/**
|
|
86
|
-
* The provided error details.
|
|
87
|
-
*/
|
|
88
|
-
error: any;
|
|
89
|
-
/**
|
|
90
|
-
* The currently used number of columns.
|
|
91
|
-
*/
|
|
92
|
-
columns: number;
|
|
93
|
-
/**
|
|
94
|
-
* The currently used number of rows.
|
|
95
|
-
*/
|
|
96
|
-
rows: number;
|
|
97
|
-
/**
|
|
98
|
-
* The name of the pilet emitting the error.
|
|
99
|
-
*/
|
|
100
|
-
pilet?: string;
|
|
101
|
-
}
|
|
102
|
-
export interface BareTileComponentProps {
|
|
103
|
-
/**
|
|
104
|
-
* The currently used number of columns.
|
|
105
|
-
*/
|
|
106
|
-
columns: number;
|
|
107
|
-
/**
|
|
108
|
-
* The currently used number of rows.
|
|
109
|
-
*/
|
|
110
|
-
rows: number;
|
|
111
|
-
}
|
|
112
|
-
export type TileComponentProps = BaseComponentProps & BareTileComponentProps;
|
|
113
|
-
export interface PiralCustomTilePreferences {
|
|
114
|
-
}
|
|
115
|
-
export interface TilePreferences extends PiralCustomTilePreferences {
|
|
116
|
-
/**
|
|
117
|
-
* Sets the desired initial number of columns.
|
|
118
|
-
* This may be overridden either by the user (if resizable true), or by the dashboard.
|
|
119
|
-
*/
|
|
120
|
-
initialColumns?: number;
|
|
121
|
-
/**
|
|
122
|
-
* Sets the desired initial number of rows.
|
|
123
|
-
* This may be overridden either by the user (if resizable true), or by the dashboard.
|
|
124
|
-
*/
|
|
125
|
-
initialRows?: number;
|
|
126
|
-
/**
|
|
127
|
-
* Determines if the tile can be resized by the user.
|
|
128
|
-
* By default the size of the tile is fixed.
|
|
129
|
-
*/
|
|
130
|
-
resizable?: boolean;
|
|
131
|
-
/**
|
|
132
|
-
* Declares a set of custom properties to be used with user-specified values.
|
|
133
|
-
*/
|
|
134
|
-
customProperties?: Array<string>;
|
|
135
|
-
}
|
|
136
|
-
export interface TileRegistration extends BaseRegistration {
|
|
137
|
-
component: WrappedComponent<TileComponentProps>;
|
|
138
|
-
preferences: TilePreferences;
|
|
139
|
-
}
|
|
140
|
-
export interface PiletDashboardApi {
|
|
141
|
-
/**
|
|
142
|
-
* Registers a tile with a predefined tile components.
|
|
143
|
-
* The name has to be unique within the current pilet.
|
|
144
|
-
* @param name The name of the tile.
|
|
145
|
-
* @param Component The component to be rendered within the Dashboard.
|
|
146
|
-
* @param preferences The optional preferences to be supplied to the Dashboard for the tile.
|
|
147
|
-
*/
|
|
148
|
-
registerTile(name: string, Component: AnyComponent<TileComponentProps>, preferences?: TilePreferences): RegistrationDisposer;
|
|
149
|
-
/**
|
|
150
|
-
* Registers a tile for predefined tile components.
|
|
151
|
-
* @param Component The component to be rendered within the Dashboard.
|
|
152
|
-
* @param preferences The optional preferences to be supplied to the Dashboard for the tile.
|
|
153
|
-
*/
|
|
154
|
-
registerTile(Component: AnyComponent<TileComponentProps>, preferences?: TilePreferences): RegistrationDisposer;
|
|
155
|
-
/**
|
|
156
|
-
* Unregisters a tile known by the given name.
|
|
157
|
-
* Only previously registered tiles can be unregistered.
|
|
158
|
-
* @param name The name of the tile to unregister.
|
|
159
|
-
*/
|
|
160
|
-
unregisterTile(name: string): void;
|
|
161
|
-
}
|
package/esm/types.js
DELETED
package/esm/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|