polymatica-widget 2.0.11 → 2.0.12
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/__internal__/io.d.ts +8 -1
- package/dataset.d.ts +1 -0
- package/declare.js +25 -7
- package/package.json +1 -1
- package/widget.d.ts +0 -1
package/__internal__/io.d.ts
CHANGED
|
@@ -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';
|
|
@@ -12,8 +13,13 @@ export declare enum Output {
|
|
|
12
13
|
Ready = "poly.output.ready",
|
|
13
14
|
Interact = "poly.output.interact"
|
|
14
15
|
}
|
|
15
|
-
export declare type
|
|
16
|
+
export declare type InputColumn = Omit<Column, 'interact'> & {
|
|
17
|
+
columnId: number;
|
|
18
|
+
};
|
|
19
|
+
export declare type InputDataset = Omit<Dataset, 'columns' | 'columnsByBlock' | 'events'> & {
|
|
16
20
|
datasetId: number;
|
|
21
|
+
columns: InputColumn[];
|
|
22
|
+
columnsByBlock: Record<string, number[]>;
|
|
17
23
|
};
|
|
18
24
|
export interface InputSingleData {
|
|
19
25
|
readonly dataset: InputDataset;
|
|
@@ -45,6 +51,7 @@ export interface OutputParameter extends Record<Output, any> {
|
|
|
45
51
|
[Output.Ready]: void;
|
|
46
52
|
[Output.Interact]: {
|
|
47
53
|
datasetId: number;
|
|
54
|
+
columnId: number;
|
|
48
55
|
dataIndex: number;
|
|
49
56
|
};
|
|
50
57
|
}
|
package/dataset.d.ts
CHANGED
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
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
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