piral-dashboard 0.14.12 → 0.14.13

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,11 @@
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 ADDED
@@ -0,0 +1,27 @@
1
+ import { DefaultTile, DefaultContainer } from './default';
2
+ import { Dashboard } from './Dashboard';
3
+ export function getPreferences(defaultPreferences, customPreferences = {}) {
4
+ return Object.assign(Object.assign({}, defaultPreferences), customPreferences);
5
+ }
6
+ export function getTiles(items, defaultPreferences) {
7
+ const tiles = {};
8
+ let i = 0;
9
+ for (const { component, preferences } of items) {
10
+ tiles[`global-${i++}`] = {
11
+ pilet: undefined,
12
+ component,
13
+ preferences: getPreferences(defaultPreferences, preferences),
14
+ };
15
+ }
16
+ return tiles;
17
+ }
18
+ export function withTiles(tiles) {
19
+ return (state) => (Object.assign(Object.assign({}, state), { components: Object.assign({ DashboardTile: DefaultTile, DashboardContainer: DefaultContainer }, state.components), registry: Object.assign(Object.assign({}, state.registry), { tiles }) }));
20
+ }
21
+ export function withRoutes(routes) {
22
+ return (state) => (Object.assign(Object.assign({}, state), { routes: Object.assign(Object.assign({}, state.routes), routes.reduce((newRoutes, route) => {
23
+ newRoutes[route] = Dashboard;
24
+ return newRoutes;
25
+ }, {})) }));
26
+ }
27
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"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ACL,CAAC"}
@@ -0,0 +1,11 @@
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/lib/helpers.js ADDED
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.withRoutes = exports.withTiles = exports.getTiles = exports.getPreferences = void 0;
4
+ const default_1 = require("./default");
5
+ const Dashboard_1 = require("./Dashboard");
6
+ function getPreferences(defaultPreferences, customPreferences = {}) {
7
+ return Object.assign(Object.assign({}, defaultPreferences), customPreferences);
8
+ }
9
+ exports.getPreferences = getPreferences;
10
+ function getTiles(items, defaultPreferences) {
11
+ const tiles = {};
12
+ let i = 0;
13
+ for (const { component, preferences } of items) {
14
+ tiles[`global-${i++}`] = {
15
+ pilet: undefined,
16
+ component,
17
+ preferences: getPreferences(defaultPreferences, preferences),
18
+ };
19
+ }
20
+ return tiles;
21
+ }
22
+ exports.getTiles = getTiles;
23
+ function withTiles(tiles) {
24
+ return (state) => (Object.assign(Object.assign({}, state), { components: Object.assign({ DashboardTile: default_1.DefaultTile, DashboardContainer: default_1.DefaultContainer }, state.components), registry: Object.assign(Object.assign({}, state.registry), { tiles }) }));
25
+ }
26
+ exports.withTiles = withTiles;
27
+ function withRoutes(routes) {
28
+ return (state) => (Object.assign(Object.assign({}, state), { routes: Object.assign(Object.assign({}, state.routes), routes.reduce((newRoutes, route) => {
29
+ newRoutes[route] = Dashboard_1.Dashboard;
30
+ return newRoutes;
31
+ }, {})) }));
32
+ }
33
+ exports.withRoutes = withRoutes;
34
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":";;;AACA,uCAA0D;AAC1D,2CAAwC;AAGxC,SAAgB,cAAc,CAAC,kBAAmC,EAAE,oBAAqC,EAAE;IACzG,uCACK,kBAAkB,GAClB,iBAAiB,EACpB;AACJ,CAAC;AALD,wCAKC;AAED,SAAgB,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;AAbD,4BAaC;AAED,SAAgB,SAAS,CAAC,KAA6B;IACrD,OAAO,CAAC,KAAkB,EAAe,EAAE,CAAC,iCACvC,KAAK,KACR,UAAU,kBACR,aAAa,EAAE,qBAAW,EAC1B,kBAAkB,EAAE,0BAAgB,IACjC,KAAK,CAAC,UAAU,GAErB,QAAQ,kCACH,KAAK,CAAC,QAAQ,KACjB,KAAK,OAEP,CAAC;AACL,CAAC;AAbD,8BAaC;AAED,SAAgB,UAAU,CAAC,MAAqB;IAC9C,OAAO,CAAC,KAAkB,EAAe,EAAE,CAAC,iCACvC,KAAK,KACR,MAAM,kCACD,KAAK,CAAC,MAAM,GACZ,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE;YACpC,SAAS,CAAC,KAAK,CAAC,GAAG,qBAAS,CAAC;YAC7B,OAAO,SAAS,CAAC;QACnB,CAAC,EAAE,EAAE,CAAC,KAER,CAAC;AACL,CAAC;AAXD,gCAWC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "piral-dashboard",
3
- "version": "0.14.12",
3
+ "version": "0.14.13",
4
4
  "description": "Plugin for creating a centralized dashboard in Piral.",
5
5
  "keywords": [
6
6
  "piral",
@@ -41,10 +41,9 @@
41
41
  "test": "echo \"Error: run tests from root\" && exit 1"
42
42
  },
43
43
  "devDependencies": {
44
- "piral-core": "^0.14.12"
44
+ "piral-core": "^0.14.13"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "piral-core": "0.14.x"
48
- },
49
- "gitHead": "a75b9e31d077eeb9e998b26b32bf331faecfaf19"
48
+ }
50
49
  }