piral-dashboard 1.6.0-beta.7240 → 1.6.0-beta.7243

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 CHANGED
@@ -1,26 +1,22 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Dashboard = void 0;
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 = (0, piral_core_1.useGlobalState)((s) => s.registry.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(components_1.PiralDashboardTile, { key: tile, columns: initialColumns, rows: initialRows, resizable: resizable, meta: preferences },
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(components_1.PiralDashboardContainer, { ...props, children: children });
19
+ return React.createElement(PiralDashboardContainer, { ...props, children: children });
23
20
  };
24
- exports.Dashboard = Dashboard;
25
- exports.Dashboard.displayName = 'Dashboard';
21
+ Dashboard.displayName = 'Dashboard';
26
22
  //# sourceMappingURL=Dashboard.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Dashboard.js","sourceRoot":"","sources":["../src/Dashboard.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B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@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
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: (0, piral_core_1.withKey)(state.registry.tiles, name, value),
7
+ tiles: withKey(state.registry.tiles, name, value),
11
8
  },
12
9
  }));
13
10
  }
14
- exports.registerTile = registerTile;
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: (0, piral_core_1.withoutKey)(state.registry.tiles, name),
16
+ tiles: withoutKey(state.registry.tiles, name),
21
17
  },
22
18
  }));
23
19
  }
24
- exports.unregisterTile = unregisterTile;
25
20
  //# sourceMappingURL=actions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"actions.js","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":";;;AAAA,2CAAqE;AAGrE,SAAgB,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,IAAA,oBAAO,EAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC;SAClD;KACF,CAAC,CAAC,CAAC;AACN,CAAC;AARD,oCAQC;AAED,SAAgB,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,IAAA,uBAAU,EAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC;SAC9C;KACF,CAAC,CAAC,CAAC;AACN,CAAC;AARD,wCAQC"}
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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PiralDashboardTile = exports.PiralDashboardContainer = void 0;
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
@@ -1 +1 @@
1
- {"version":3,"file":"components.js","sourceRoot":"","sources":["../src/components.tsx"],"names":[],"mappings":";;;AAAA,2CAA+C;AAElC,QAAA,uBAAuB,GAAG,IAAA,8BAAiB,EAAC,oBAAoB,CAAC,CAAC;AAClE,QAAA,kBAAkB,GAAG,IAAA,8BAAiB,EAAC,eAAe,CAAC,CAAC"}
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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createDashboardApi = void 0;
4
- const actions = require("./actions");
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((0, piral_core_1.withAll)((0, helpers_1.withTiles)((0, helpers_1.getTiles)(tiles, defaultPreferences)), (0, piral_core_1.withRootExtension)('piral-dashboard', Dashboard_1.Dashboard), (0, helpers_1.withRoutes)(routes)));
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 = (0, piral_core_1.buildName)(pilet, name);
23
+ const id = buildName(pilet, name);
27
24
  context.registerTile(id, {
28
25
  pilet,
29
- component: (0, piral_core_1.withApi)(context, arg, api, 'tile'),
30
- preferences: (0, helpers_1.getPreferences)(defaultPreferences, 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 = (0, piral_core_1.buildName)(pilet, name);
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":";;;AAAA,qCAAqC;AACrC,2CAAyF;AACzF,2CAAwC;AAExC,uCAA4E;AAuB5E;;GAEG;AACH,SAAgB,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,IAAA,oBAAO,EACL,IAAA,mBAAS,EAAC,IAAA,kBAAQ,EAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC,EAC9C,IAAA,8BAAiB,EAAC,iBAAiB,EAAE,qBAAS,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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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DefaultTile = exports.DefaultContainer = void 0;
4
- const React = require("react");
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
@@ -1 +1 @@
1
- {"version":3,"file":"default.js","sourceRoot":"","sources":["../src/default.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,2CAA0D;AAGnD,MAAM,gBAAgB,GAAsC,CAAC,KAAK,EAAE,EAAE,CAAC,CAC5E,oBAAC,0BAAa,IAAC,IAAI,EAAC,WAAW,EAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,IAAA,0BAAa,EAAC,KAAK,CAAC,QAAQ,EAAE,mBAAmB,CAAC,GAAI,CACnH,CAAC;AAFW,QAAA,gBAAgB,oBAE3B;AAEK,MAAM,WAAW,GAAiC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,0BAAa,EAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAArF,QAAA,WAAW,eAA0E"}
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
- "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 = {}) {
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
- exports.getPreferences = getPreferences;
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
- exports.getTiles = getTiles;
26
- function withTiles(tiles) {
21
+ export function withTiles(tiles) {
27
22
  return (state) => ({
28
23
  ...state,
29
24
  components: {
30
- DashboardTile: default_1.DefaultTile,
31
- DashboardContainer: default_1.DefaultContainer,
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
- exports.withTiles = withTiles;
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] = Dashboard_1.Dashboard;
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
@@ -1 +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,OAAO;QACL,GAAG,kBAAkB;QACrB,GAAG,iBAAiB;KACrB,CAAC;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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AE,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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./create"), exports);
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":";;;AAAA,mDAAyB;AACzB,uDAA6B;AAC7B,sDAA4B;AAC5B,kDAAwB"}
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
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=types.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "piral-dashboard",
3
- "version": "1.6.0-beta.7240",
3
+ "version": "1.6.0-beta.7243",
4
4
  "description": "Plugin for creating a centralized dashboard in Piral.",
5
5
  "keywords": [
6
6
  "piral",
@@ -17,29 +17,16 @@
17
17
  "author": "smapiot",
18
18
  "homepage": "https://piral.io",
19
19
  "license": "MIT",
20
- "module": "esm/index.js",
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
- },
31
- "./lib/*": {
32
- "require": "./lib/*"
33
- },
34
- "./_/*": {
35
- "import": "./esm/*.js",
36
- "require": "./lib/*.js"
37
- },
24
+ ".": "./lib/index.js",
25
+ "./lib/*": "./lib/*",
38
26
  "./package.json": "./package.json"
39
27
  },
40
28
  "sideEffects": false,
41
29
  "files": [
42
- "esm",
43
30
  "lib",
44
31
  "src",
45
32
  "piral-dashboard.min.js"
@@ -53,18 +40,17 @@
53
40
  },
54
41
  "scripts": {
55
42
  "cleanup": "rimraf esm lib piral-dashboard.min.js",
56
- "build": "yarn build:bundle && yarn build:commonjs && yarn build:esnext",
43
+ "build": "yarn build:bundle && yarn build:esnext",
57
44
  "build:bundle": "esbuild src/index.ts --outfile=piral-dashboard.min.js --bundle --external:piral-core --external:react --minify --global-name=piralDashboard",
58
- "build:commonjs": "tsc --project tsconfig.json --outDir lib --module commonjs",
59
- "build:esnext": "tsc --project tsconfig.json --outDir esm --module esnext",
45
+ "build:esnext": "tsc --project tsconfig.json --outDir lib --module esnext",
60
46
  "typedoc": "typedoc --json ../../../docs/types/piral-dashboard.json src --exclude \"src/**/*.test.*\"",
61
47
  "test": "echo \"Error: run tests from root\" && exit 1"
62
48
  },
63
49
  "devDependencies": {
64
50
  "@types/react": "^18.0.0",
65
51
  "@types/react-router-dom": "^5.1.6",
66
- "piral-core": "1.6.0-beta.7240",
52
+ "piral-core": "1.6.0-beta.7243",
67
53
  "react": "^18.0.0"
68
54
  },
69
- "gitHead": "2fd8ff47d9a7e0666e4e6bc1dc5a7ef45e8e9f39"
55
+ "gitHead": "bbb6e4f78c61b6ef753099a5b378ad2708565ce3"
70
56
  }
@@ -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
@@ -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
@@ -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"}
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const PiralDashboardContainer: import("react").ComponentType<import("./types").DashboardContainerProps>;
3
- export declare const PiralDashboardTile: import("react").ComponentType<import("./types").DashboardTileProps>;
package/esm/components.js DELETED
@@ -1,4 +0,0 @@
1
- import { getPiralComponent } from 'piral-core';
2
- export const PiralDashboardContainer = getPiralComponent('DashboardContainer');
3
- export const PiralDashboardTile = getPiralComponent('DashboardTile');
4
- //# sourceMappingURL=components.js.map
@@ -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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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
@@ -1,4 +0,0 @@
1
- import * as React from 'react';
2
- import { DashboardContainerProps, DashboardTileProps } from './types';
3
- export declare const DefaultContainer: React.FC<DashboardContainerProps>;
4
- export declare const DefaultTile: React.FC<DashboardTileProps>;
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
@@ -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
@@ -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
@@ -1,4 +0,0 @@
1
- export * from './create';
2
- export * from './components';
3
- export * from './Dashboard';
4
- export * from './types';
package/esm/index.js DELETED
@@ -1,5 +0,0 @@
1
- export * from './create';
2
- export * from './components';
3
- export * from './Dashboard';
4
- export * from './types';
5
- //# sourceMappingURL=index.js.map
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
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
package/esm/types.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}