polymatica-widget 2.0.10 → 2.0.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.
@@ -1,3 +1,4 @@
1
+ import { Column } from '../dataset';
1
2
  import { Locale } from '../locale';
2
3
  import { Theme } from '../theme';
3
4
  import { Dataset, Options } from '../widget';
@@ -5,15 +6,21 @@ export declare enum Input {
5
6
  Change = "poly.input.change",
6
7
  ChangeLang = "poly.input.changeLang",
7
8
  ChangeTheme = "poly.input.changeTheme",
8
- Highlight = "poly.input.highlight"
9
+ Highlight = "poly.input.highlight",
10
+ UnHighlight = "poly.input.unhighlight"
9
11
  }
10
12
  export declare enum Output {
11
13
  Init = "poly.output.init",
12
14
  Ready = "poly.output.ready",
13
15
  Interact = "poly.output.interact"
14
16
  }
15
- export declare type InputDataset = Omit<Dataset, 'interact' | 'events'> & {
17
+ export declare type InputColumn = Omit<Column, 'interact'> & {
18
+ columnId: number;
19
+ };
20
+ export declare type InputDataset = Omit<Dataset, 'columns' | 'columnsByBlock' | 'events'> & {
16
21
  datasetId: number;
22
+ columns: InputColumn[];
23
+ columnsByBlock: Record<string, number[]>;
17
24
  };
18
25
  export interface InputSingleData {
19
26
  readonly dataset: InputDataset;
@@ -39,12 +46,16 @@ export interface InputParameter extends Record<Input, any> {
39
46
  datasetId: number;
40
47
  rowIndexArray: number[];
41
48
  };
49
+ [Input.UnHighlight]: {
50
+ datasetId: number;
51
+ };
42
52
  }
43
53
  export interface OutputParameter extends Record<Output, any> {
44
54
  [Output.Init]: void;
45
55
  [Output.Ready]: void;
46
56
  [Output.Interact]: {
47
57
  datasetId: number;
58
+ columnId: number;
48
59
  dataIndex: number;
49
60
  };
50
61
  }
@@ -7,6 +7,7 @@ var Input;
7
7
  Input["ChangeLang"] = "poly.input.changeLang";
8
8
  Input["ChangeTheme"] = "poly.input.changeTheme";
9
9
  Input["Highlight"] = "poly.input.highlight";
10
+ Input["UnHighlight"] = "poly.input.unhighlight";
10
11
  })(Input = exports.Input || (exports.Input = {}));
11
12
  var Output;
12
13
  (function (Output) {
package/dataset.d.ts CHANGED
@@ -13,4 +13,5 @@ export interface Column {
13
13
  type: ColumnType;
14
14
  name: string;
15
15
  path: string;
16
+ interact(rowIndex: number): void;
16
17
  }
package/declare.js CHANGED
@@ -84,13 +84,31 @@ function provideTo(widget, source, token) {
84
84
  }
85
85
  }
86
86
  function transform(source, token) {
87
- const { datasetId } = source, slice = __rest(source, ["datasetId"]);
88
- const dataset = Object.assign(Object.assign({}, slice), { interact(dataIndex) {
89
- output(token, io_1.Output.Interact, {
90
- datasetId,
91
- dataIndex,
92
- });
93
- }, events: {
87
+ const { datasetId, columns: sourceColumns, columnsByBlock: sourceColumnsByBlock } = source, slice = __rest(source, ["datasetId", "columns", "columnsByBlock"]);
88
+ const columnsById = new Map();
89
+ const columns = sourceColumns.map((_a) => {
90
+ var { columnId } = _a, source = __rest(_a, ["columnId"]);
91
+ const column = Object.assign(Object.assign({}, source), { interact(rowIndex) {
92
+ output(token, io_1.Output.Interact, {
93
+ datasetId,
94
+ columnId,
95
+ dataIndex: rowIndex,
96
+ });
97
+ } });
98
+ columnsById.set(columnId, column);
99
+ return column;
100
+ });
101
+ const columnsByBlock = {};
102
+ Object.entries(sourceColumnsByBlock).forEach(([blockKey, columnIds]) => {
103
+ columnsByBlock[blockKey] = [];
104
+ columnIds.forEach(id => {
105
+ const column = columnsById.get(id);
106
+ if (column)
107
+ columnsByBlock[blockKey].push(column);
108
+ });
109
+ });
110
+ const dataset = Object.assign(Object.assign({}, slice), { columns,
111
+ columnsByBlock, events: {
94
112
  onHighlight() { },
95
113
  } });
96
114
  datasetMap.set(datasetId, dataset);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polymatica-widget",
3
- "version": "2.0.10",
3
+ "version": "2.0.13",
4
4
  "description": "SDK для создания виджетов для платформы Polymatica",
5
5
  "keywords": [],
6
6
  "license": "ISC",
@@ -28,9 +28,9 @@ export interface DataConfig {
28
28
  max?: number;
29
29
  };
30
30
  drilldown?: {
31
- source: string;
31
+ sources: string[];
32
32
  };
33
- heatmap?: boolean | {
33
+ heatmap?: {
34
34
  targets: string[];
35
35
  };
36
36
  }
package/widget.d.ts CHANGED
@@ -33,7 +33,6 @@ export interface Dataset {
33
33
  };
34
34
  rows: DatasetRow[];
35
35
  heatmap: HeatmapItem[];
36
- interact(rowIndex: number): void;
37
36
  events: {
38
37
  onHighlight: (rowIndexArray: number[]) => void;
39
38
  };