@kanaries/graphic-walker 0.2.15 → 0.2.17
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/dist/App.d.ts +4 -3
- package/dist/assets/transform.worker-5d54ff09.js.map +1 -0
- package/dist/assets/viewQuery.worker-ffefc111.js.map +1 -0
- package/dist/components/codeExport/index.d.ts +3 -0
- package/dist/components/loadingLayer.d.ts +2 -0
- package/dist/components/tabs/defaultTab.d.ts +1 -0
- package/dist/components/tabs/editableTab.d.ts +1 -2
- package/dist/dataSource/dataSelection/config.d.ts +1 -0
- package/dist/dataSource/dataSelection/utils.d.ts +2 -0
- package/dist/dataSource/index.d.ts +0 -1
- package/dist/datasets/tmp/test.json +1 -0
- package/dist/fields/encodeFields/singleEncodeEditor.d.ts +4 -4
- package/dist/graphic-walker.es.js +29228 -33650
- package/dist/graphic-walker.es.js.map +1 -1
- package/dist/graphic-walker.umd.js +218 -256
- package/dist/graphic-walker.umd.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/interfaces.d.ts +52 -17
- package/dist/lib/execExp.d.ts +8 -0
- package/dist/lib/inferMeta.d.ts +2 -9
- package/dist/lib/insights/explainByChildren.d.ts +16 -0
- package/dist/lib/insights/explainBySelection.d.ts +5 -0
- package/dist/lib/insights/explainValue.d.ts +2 -0
- package/dist/lib/insights/utils.d.ts +11 -0
- package/dist/lib/interfaces.d.ts +23 -0
- package/dist/lib/op/aggregate.d.ts +3 -0
- package/dist/lib/op/bin.d.ts +3 -0
- package/dist/lib/op/fold.d.ts +3 -0
- package/dist/lib/op/stat.d.ts +8 -0
- package/dist/lib/viewQuery.d.ts +4 -0
- package/dist/models/visSpecHistory.d.ts +2 -0
- package/dist/renderer/index.d.ts +8 -7
- package/dist/renderer/specRenderer.d.ts +13 -0
- package/dist/services.d.ts +5 -31
- package/dist/store/commonStore.d.ts +6 -0
- package/dist/store/index.d.ts +3 -2
- package/dist/store/visualSpecStore.d.ts +11 -5
- package/dist/utils/autoMark.d.ts +1 -1
- package/dist/utils/dataPrep.d.ts +3 -2
- package/dist/utils/index.d.ts +3 -5
- package/dist/utils/save.d.ts +1 -2
- package/dist/vis/react-vega.d.ts +2 -22
- package/dist/vis/spec/aggregate.d.ts +4 -0
- package/dist/vis/spec/encode.d.ts +20 -0
- package/dist/vis/spec/field.d.ts +2 -0
- package/dist/vis/spec/mark.d.ts +7 -0
- package/dist/vis/spec/stack.d.ts +4 -0
- package/dist/vis/spec/tooltip.d.ts +4 -0
- package/dist/vis/spec/view.d.ts +73 -0
- package/dist/workers/transform.d.ts +2 -0
- package/package.json +5 -6
- package/src/App.tsx +56 -66
- package/src/components/codeExport/index.tsx +114 -0
- package/src/components/dataTable/index.tsx +10 -10
- package/src/components/loadingLayer.tsx +7 -0
- package/src/components/tabs/defaultTab.tsx +4 -2
- package/src/components/tabs/editableTab.tsx +74 -39
- package/src/dataSource/dataSelection/config.ts +11 -0
- package/src/dataSource/dataSelection/csvData.tsx +71 -39
- package/src/dataSource/dataSelection/gwFile.tsx +2 -2
- package/src/dataSource/dataSelection/utils.ts +28 -0
- package/src/dataSource/index.tsx +0 -17
- package/src/dataSource/utils.ts +8 -3
- package/src/fields/aestheticFields.tsx +1 -2
- package/src/fields/datasetFields/meaFields.tsx +12 -4
- package/src/fields/encodeFields/singleEncodeEditor.tsx +11 -12
- package/src/fields/fieldsContext.tsx +1 -0
- package/src/index.css +4 -4
- package/src/index.tsx +22 -22
- package/src/interfaces.ts +85 -49
- package/src/lib/execExp.ts +147 -0
- package/src/lib/inferMeta.ts +26 -29
- package/src/lib/insights/explainByChildren.ts +50 -0
- package/src/lib/insights/explainBySelection.ts +47 -0
- package/src/lib/insights/explainValue.ts +30 -0
- package/src/lib/insights/utils.ts +21 -0
- package/src/lib/interfaces.ts +33 -0
- package/src/lib/op/aggregate.ts +49 -0
- package/src/lib/op/bin.ts +25 -0
- package/src/lib/op/fold.ts +17 -0
- package/src/lib/op/stat.ts +46 -0
- package/src/lib/viewQuery.ts +22 -0
- package/src/locales/en-US.json +6 -3
- package/src/locales/i18n.ts +0 -1
- package/src/locales/ja-JP.json +4 -2
- package/src/locales/zh-CN.json +6 -3
- package/src/main.tsx +1 -1
- package/src/models/visSpecHistory.ts +14 -0
- package/src/renderer/index.tsx +58 -126
- package/src/renderer/specRenderer.tsx +121 -0
- package/src/segments/segmentNav.tsx +3 -16
- package/src/segments/visNav.tsx +17 -6
- package/src/services.ts +101 -67
- package/src/store/commonStore.ts +14 -9
- package/src/store/index.tsx +11 -4
- package/src/store/visualSpecStore.ts +89 -52
- package/src/utils/autoMark.ts +1 -1
- package/src/utils/dataPrep.ts +25 -2
- package/src/utils/index.ts +16 -17
- package/src/utils/normalization.ts +3 -1
- package/src/utils/save.ts +1 -2
- package/src/vis/react-vega.tsx +9 -340
- package/src/vis/spec/aggregate.ts +13 -0
- package/src/vis/spec/encode.ts +70 -0
- package/src/vis/spec/field.ts +10 -0
- package/src/vis/spec/mark.ts +30 -0
- package/src/vis/spec/stack.ts +11 -0
- package/src/vis/spec/tooltip.ts +16 -0
- package/src/vis/spec/view.ts +136 -0
- package/src/vis/theme.ts +12 -0
- package/src/visualSettings/index.tsx +10 -1
- package/src/workers/transform.ts +12 -0
- package/src/workers/transform.worker.js +13 -0
- package/src/workers/viewQuery.worker.js +16 -0
- package/dist/assets/explainer.worker-8428eb12.js.map +0 -1
- package/dist/dataSource/pannel.d.ts +0 -5
- package/dist/insightBoard/index.d.ts +0 -3
- package/dist/insightBoard/mainBoard.d.ts +0 -11
- package/dist/insightBoard/radioGroupButtons.d.ts +0 -12
- package/dist/insightBoard/selectionSpec.d.ts +0 -13
- package/dist/insightBoard/std2vegaSpec.d.ts +0 -12
- package/dist/insightBoard/utils.d.ts +0 -8
- package/dist/insights.d.ts +0 -61
- package/src/dataSource/pannel.tsx +0 -71
- package/src/insightBoard/index.tsx +0 -31
- package/src/insightBoard/mainBoard.tsx +0 -224
- package/src/insightBoard/radioGroupButtons.tsx +0 -57
- package/src/insightBoard/selectionSpec.ts +0 -113
- package/src/insightBoard/std2vegaSpec.ts +0 -184
- package/src/insightBoard/utils.ts +0 -32
- package/src/insights.ts +0 -408
- package/src/workers/explainer.worker.js +0 -76
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { IGWProps } from
|
|
3
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { IGWProps } from "./App";
|
|
3
|
+
import "./empty_sheet.css";
|
|
4
4
|
export declare const ShadowDomContext: React.Context<{
|
|
5
5
|
root: ShadowRoot | null;
|
|
6
6
|
}>;
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -1,16 +1,26 @@
|
|
|
1
|
-
import { StatFuncName } from "visual-insights/build/esm/statistics";
|
|
2
|
-
import { AggFC } from 'cube-core/built/types';
|
|
3
|
-
import { IAnalyticType, ISemanticType } from 'visual-insights';
|
|
4
1
|
export type DeepReadonly<T extends Record<keyof any, any>> = {
|
|
5
2
|
readonly [K in keyof T]: T[K] extends Record<keyof any, any> ? DeepReadonly<T[K]> : T[K];
|
|
6
3
|
};
|
|
4
|
+
export type ISemanticType = 'quantitative' | 'nominal' | 'ordinal' | 'temporal';
|
|
5
|
+
export type IDataType = 'number' | 'integer' | 'boolean' | 'date' | 'string';
|
|
6
|
+
export type IAnalyticType = 'dimension' | 'measure';
|
|
7
7
|
export interface IRow {
|
|
8
8
|
[key: string]: any;
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
export type IAggregator = 'sum' | 'count' | 'max' | 'min' | 'mean' | 'median' | 'variance' | 'stdev';
|
|
11
|
+
export interface Specification {
|
|
12
|
+
position?: string[];
|
|
13
|
+
color?: string[];
|
|
14
|
+
size?: string[];
|
|
15
|
+
shape?: string[];
|
|
16
|
+
opacity?: string[];
|
|
17
|
+
facets?: string[];
|
|
18
|
+
page?: string[];
|
|
19
|
+
filter?: string[];
|
|
20
|
+
highFacets?: string[];
|
|
21
|
+
geomType?: string[];
|
|
22
|
+
aggregate?: boolean;
|
|
23
|
+
}
|
|
14
24
|
export interface Filters {
|
|
15
25
|
[key: string]: any[];
|
|
16
26
|
}
|
|
@@ -30,6 +40,24 @@ export interface IUncertainMutField {
|
|
|
30
40
|
semanticType: ISemanticType | '?';
|
|
31
41
|
analyticType: IAnalyticType | '?';
|
|
32
42
|
}
|
|
43
|
+
export type IExpParamter = {
|
|
44
|
+
type: 'field';
|
|
45
|
+
value: string;
|
|
46
|
+
} | {
|
|
47
|
+
type: 'value';
|
|
48
|
+
value: any;
|
|
49
|
+
} | {
|
|
50
|
+
type: 'expression';
|
|
51
|
+
value: IExpression;
|
|
52
|
+
} | {
|
|
53
|
+
type: 'constant';
|
|
54
|
+
value: any;
|
|
55
|
+
};
|
|
56
|
+
export interface IExpression {
|
|
57
|
+
op: 'bin' | 'log2' | 'log10' | 'one' | 'binCount';
|
|
58
|
+
params: IExpParamter[];
|
|
59
|
+
as: string;
|
|
60
|
+
}
|
|
33
61
|
export interface IField {
|
|
34
62
|
/**
|
|
35
63
|
* fid: key in data record
|
|
@@ -46,17 +74,13 @@ export interface IField {
|
|
|
46
74
|
semanticType: ISemanticType;
|
|
47
75
|
analyticType: IAnalyticType;
|
|
48
76
|
cmp?: (a: any, b: any) => number;
|
|
77
|
+
computed?: boolean;
|
|
78
|
+
expressoion?: IExpression;
|
|
49
79
|
}
|
|
50
80
|
export interface IViewField extends IField {
|
|
51
81
|
dragId: string;
|
|
52
82
|
sort?: 'none' | 'ascending' | 'descending';
|
|
53
83
|
}
|
|
54
|
-
export interface Measure extends IField {
|
|
55
|
-
aggregator?: AggFC;
|
|
56
|
-
minWidth?: number;
|
|
57
|
-
formatter?: (value: number | undefined) => number | string;
|
|
58
|
-
[key: string]: any;
|
|
59
|
-
}
|
|
60
84
|
export interface DataSet {
|
|
61
85
|
id: string;
|
|
62
86
|
name: string;
|
|
@@ -69,7 +93,18 @@ export interface IFieldNeighbor {
|
|
|
69
93
|
}
|
|
70
94
|
export interface IMeasure {
|
|
71
95
|
key: string;
|
|
72
|
-
op:
|
|
96
|
+
op: IAggregator;
|
|
97
|
+
}
|
|
98
|
+
export interface IPredicate {
|
|
99
|
+
key: string;
|
|
100
|
+
type: "discrete" | "continuous";
|
|
101
|
+
range: Set<any> | [number, number];
|
|
102
|
+
}
|
|
103
|
+
export interface IExplainProps {
|
|
104
|
+
dataSource: IRow[];
|
|
105
|
+
predicates: IPredicate[];
|
|
106
|
+
viewFields: IField[];
|
|
107
|
+
metas: IField[];
|
|
73
108
|
}
|
|
74
109
|
export interface IDataSet {
|
|
75
110
|
id: string;
|
|
@@ -124,8 +159,8 @@ export type IFilterRule = {
|
|
|
124
159
|
export declare const EXPLORATION_TYPES: readonly ["none", "brush", "point"];
|
|
125
160
|
export declare const BRUSH_DIRECTIONS: readonly ["default", "x", "y"];
|
|
126
161
|
export type IStackMode = 'none' | 'stack' | 'normalize';
|
|
127
|
-
export type IExplorationType =
|
|
128
|
-
export type IBrushDirection =
|
|
162
|
+
export type IExplorationType = typeof EXPLORATION_TYPES[number];
|
|
163
|
+
export type IBrushDirection = typeof BRUSH_DIRECTIONS[number];
|
|
129
164
|
export interface IVisualConfig {
|
|
130
165
|
defaultAggregated: boolean;
|
|
131
166
|
geoms: string[];
|
|
@@ -146,7 +181,7 @@ export interface IVisualConfig {
|
|
|
146
181
|
}
|
|
147
182
|
export interface IVisSpec {
|
|
148
183
|
readonly visId: string;
|
|
149
|
-
readonly name?:
|
|
184
|
+
readonly name?: string;
|
|
150
185
|
readonly encodings: DeepReadonly<DraggableFieldState>;
|
|
151
186
|
readonly config: DeepReadonly<IVisualConfig>;
|
|
152
187
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IExpression, IField, IRow } from "../interfaces";
|
|
2
|
+
interface IDataFrame {
|
|
3
|
+
[key: string]: any[];
|
|
4
|
+
}
|
|
5
|
+
export declare function execExpression(exp: IExpression, dataFrame: IDataFrame, columns: IField[]): IDataFrame;
|
|
6
|
+
export declare function dataset2DataFrame(dataset: IRow[], columns: IField[]): IDataFrame;
|
|
7
|
+
export declare function dataframe2Dataset(dataFrame: IDataFrame, columns: IField[]): IRow[];
|
|
8
|
+
export {};
|
package/dist/lib/inferMeta.d.ts
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
import { ISemanticType } from
|
|
2
|
-
import { IMutField, IRow, IUncertainMutField } from "../interfaces";
|
|
1
|
+
import { IMutField, IRow, ISemanticType, IUncertainMutField } from '../interfaces';
|
|
3
2
|
/**
|
|
4
3
|
* check if this array is a date time array based on some common date format
|
|
5
4
|
* @param data string array
|
|
6
5
|
* @returns
|
|
7
6
|
*/
|
|
8
7
|
export declare function isDateTimeArray(data: string[]): boolean;
|
|
9
|
-
|
|
10
|
-
* 这里目前暂时包一层,是为了解耦具体的推断实现。后续这里要调整推断的逻辑。
|
|
11
|
-
* 需要讨论这一层是否和交互层有关,如果没有关系,这一层包裹可以不存在这里,而是在visual-insights中。
|
|
12
|
-
* @param data 原始数据
|
|
13
|
-
* @param fid 字段id
|
|
14
|
-
* @returns semantic type 列表
|
|
15
|
-
*/
|
|
8
|
+
export declare function isNumericArray(data: any[]): boolean;
|
|
16
9
|
export declare function inferSemanticType(data: IRow[], fid: string): ISemanticType;
|
|
17
10
|
export declare function inferMeta(props: {
|
|
18
11
|
dataSource: IRow[];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IMeasure, IRow } from '../../interfaces';
|
|
2
|
+
import { IPredicate } from '../../utils';
|
|
3
|
+
export declare function explainByChildren(dataSource: IRow[], predicates: IPredicate[], dimensions: string[], measures: IMeasure[]): {
|
|
4
|
+
majorList: {
|
|
5
|
+
key: string;
|
|
6
|
+
score: number;
|
|
7
|
+
dimensions: string[];
|
|
8
|
+
measures: IMeasure[];
|
|
9
|
+
}[];
|
|
10
|
+
outlierList: {
|
|
11
|
+
key: string;
|
|
12
|
+
score: number;
|
|
13
|
+
dimensions: string[];
|
|
14
|
+
measures: IMeasure[];
|
|
15
|
+
}[];
|
|
16
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IField } from '../../interfaces';
|
|
2
|
+
import { IAggQuery } from '../interfaces';
|
|
3
|
+
export declare function groupByAnalyticTypes(fields: IField[]): {
|
|
4
|
+
dimensions: IField[];
|
|
5
|
+
measures: IField[];
|
|
6
|
+
};
|
|
7
|
+
export declare function meaList2AggProps(measures: IField[]): IAggQuery['agg'];
|
|
8
|
+
export declare function complementaryFields(props: {
|
|
9
|
+
selection: IField[];
|
|
10
|
+
all: IField[];
|
|
11
|
+
}): IField[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { IAggregator } from "../interfaces";
|
|
2
|
+
export interface IAggQuery {
|
|
3
|
+
op: 'aggregate';
|
|
4
|
+
groupBy: string[];
|
|
5
|
+
agg: {
|
|
6
|
+
[field: string]: IAggregator;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export interface IFoldQuery {
|
|
10
|
+
op: 'fold';
|
|
11
|
+
foldBy: string[];
|
|
12
|
+
newFoldKeyCol: string;
|
|
13
|
+
newFoldValueCol: string;
|
|
14
|
+
}
|
|
15
|
+
export interface IBinQuery {
|
|
16
|
+
op: 'bin';
|
|
17
|
+
binBy: string;
|
|
18
|
+
newBinCol: string;
|
|
19
|
+
binSize: number;
|
|
20
|
+
}
|
|
21
|
+
export interface IRawQuery {
|
|
22
|
+
op: 'raw';
|
|
23
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function mean(nums: number[]): number;
|
|
2
|
+
export declare function sum(nums: number[]): number;
|
|
3
|
+
export declare function median(nums: number[]): number;
|
|
4
|
+
export declare function variance(nums: number[]): number;
|
|
5
|
+
export declare function stdev(nums: number[]): number;
|
|
6
|
+
export declare function max(nums: number[]): number;
|
|
7
|
+
export declare function min(nums: number[]): number;
|
|
8
|
+
export declare function count(nums: number[]): number;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IMutField, IRow } from "../interfaces";
|
|
2
|
+
import { IAggQuery, IBinQuery, IFoldQuery, IRawQuery } from "./interfaces";
|
|
3
|
+
export type IViewQuery = IAggQuery | IFoldQuery | IBinQuery | IRawQuery;
|
|
4
|
+
export declare function queryView(rawData: IRow[], metas: IMutField[], query: IViewQuery): IRow[];
|
|
@@ -6,6 +6,7 @@ export declare class VisSpecWithHistory {
|
|
|
6
6
|
constructor(data: IVisSpec);
|
|
7
7
|
private get frame();
|
|
8
8
|
private batchFlag;
|
|
9
|
+
updateLatest(snapshot: Partial<Readonly<VisSpecWithHistory['snapshots'][0]>>): void;
|
|
9
10
|
private commit;
|
|
10
11
|
get canUndo(): boolean;
|
|
11
12
|
undo(): boolean;
|
|
@@ -18,5 +19,6 @@ export declare class VisSpecWithHistory {
|
|
|
18
19
|
set encodings(encodings: IVisSpec['encodings']);
|
|
19
20
|
get config(): DeepReadonly<IVisualConfig>;
|
|
20
21
|
set config(config: IVisSpec['config']);
|
|
22
|
+
clone(): VisSpecWithHistory;
|
|
21
23
|
exportGW(): IVisSpec;
|
|
22
24
|
}
|
package/dist/renderer/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
themeKey?: IThemeKey
|
|
6
|
-
dark?: IDarkMode
|
|
7
|
-
}
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IDarkMode, IThemeKey } from '../interfaces';
|
|
3
|
+
import { IReactVegaHandler } from '../vis/react-vega';
|
|
4
|
+
interface RendererProps {
|
|
5
|
+
themeKey?: IThemeKey;
|
|
6
|
+
dark?: IDarkMode;
|
|
7
|
+
}
|
|
8
|
+
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<Pick<RendererProps & React.RefAttributes<IReactVegaHandler>, "key" | keyof RendererProps> & React.RefAttributes<IReactVegaHandler>>>;
|
|
8
9
|
export default _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IReactVegaHandler } from '../vis/react-vega';
|
|
3
|
+
import { DeepReadonly, DraggableFieldState, IDarkMode, IRow, IThemeKey, IVisualConfig } from '../interfaces';
|
|
4
|
+
interface SpecRendererProps {
|
|
5
|
+
themeKey?: IThemeKey;
|
|
6
|
+
dark?: IDarkMode;
|
|
7
|
+
data: IRow[];
|
|
8
|
+
loading: boolean;
|
|
9
|
+
draggableFieldState: DeepReadonly<DraggableFieldState>;
|
|
10
|
+
visualConfig: IVisualConfig;
|
|
11
|
+
}
|
|
12
|
+
declare const SpecRenderer: React.ForwardRefExoticComponent<SpecRendererProps & React.RefAttributes<IReactVegaHandler>>;
|
|
13
|
+
export default SpecRenderer;
|
package/dist/services.d.ts
CHANGED
|
@@ -1,35 +1,9 @@
|
|
|
1
|
-
import { Specification } from '
|
|
2
|
-
import {
|
|
3
|
-
import { IExplaination, IMeasureWithStat } from './insights';
|
|
4
|
-
interface ExplainParams {
|
|
5
|
-
dimensions: string[];
|
|
6
|
-
measures: string[];
|
|
7
|
-
dataSource: IRow[];
|
|
8
|
-
filters?: Filters;
|
|
9
|
-
currentSpace: {
|
|
10
|
-
dimensions: string[];
|
|
11
|
-
measures: IMeasure[];
|
|
12
|
-
};
|
|
13
|
-
}
|
|
1
|
+
import { IRow, IMutField, IFilterField, Specification } from './interfaces';
|
|
2
|
+
import { IViewQuery } from './lib/viewQuery';
|
|
14
3
|
export interface IVisSpace {
|
|
15
4
|
dataView: IRow[];
|
|
16
5
|
schema: Specification;
|
|
17
6
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
visSpaces: IVisSpace[];
|
|
22
|
-
fieldsWithSemanticType: Array<{
|
|
23
|
-
key: string;
|
|
24
|
-
type: SemanticType;
|
|
25
|
-
}>;
|
|
26
|
-
}
|
|
27
|
-
export declare function getExplaination(props: ExplainParams): Promise<ExplainReturns>;
|
|
28
|
-
interface PreAnalysisParams {
|
|
29
|
-
fields: IMutField[];
|
|
30
|
-
dataSource: IRow[];
|
|
31
|
-
}
|
|
32
|
-
export declare function preAnalysis(props: PreAnalysisParams): Promise<void>;
|
|
33
|
-
export declare function destroyWorker(): void;
|
|
34
|
-
export declare const applyFilter: (data: readonly IRow[], filters: readonly IFilterField[]) => Promise<IRow[]>;
|
|
35
|
-
export {};
|
|
7
|
+
export declare const applyFilter: (data: IRow[], filters: readonly IFilterField[]) => Promise<IRow[]>;
|
|
8
|
+
export declare const transformDataService: (data: IRow[], columns: IMutField[]) => Promise<IRow[]>;
|
|
9
|
+
export declare const applyViewQuery: (data: IRow[], metas: IMutField[], query: IViewQuery) => Promise<IRow[]>;
|
|
@@ -13,6 +13,7 @@ export declare class CommonStore {
|
|
|
13
13
|
position: [number, number];
|
|
14
14
|
};
|
|
15
15
|
showDataConfig: boolean;
|
|
16
|
+
showCodeExportPanel: boolean;
|
|
16
17
|
filters: Filters;
|
|
17
18
|
segmentKey: ISegmentKey;
|
|
18
19
|
constructor();
|
|
@@ -22,6 +23,7 @@ export declare class CommonStore {
|
|
|
22
23
|
setShowDataConfig(show: boolean): void;
|
|
23
24
|
setShowInsightBoard(show: boolean): void;
|
|
24
25
|
showEmbededMenu(position: [number, number]): void;
|
|
26
|
+
setShowCodeExportPanel(show: boolean): void;
|
|
25
27
|
closeEmbededMenu(): void;
|
|
26
28
|
initTempDS(): void;
|
|
27
29
|
updateTempFields(fields: IMutField[]): void;
|
|
@@ -31,6 +33,10 @@ export declare class CommonStore {
|
|
|
31
33
|
updateTempFieldSemanticType(fieldKey: string, semanticType: IMutField['semanticType']): void;
|
|
32
34
|
updateTempName(name: string): void;
|
|
33
35
|
updateTempDS(rawData: IRow[]): void;
|
|
36
|
+
/**
|
|
37
|
+
* update temp dataset (standard) with dataset info
|
|
38
|
+
* @param dataset
|
|
39
|
+
*/
|
|
34
40
|
updateTempSTDDS(dataset: IDataSetInfo): void;
|
|
35
41
|
commitTempDS(): void;
|
|
36
42
|
startDSBuildingTask(): void;
|
package/dist/store/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CommonStore } from './commonStore';
|
|
3
3
|
import { VizSpecStore } from './visualSpecStore';
|
|
4
|
-
interface
|
|
4
|
+
export interface IGlobalStore {
|
|
5
5
|
commonStore: CommonStore;
|
|
6
6
|
vizStore: VizSpecStore;
|
|
7
7
|
}
|
|
@@ -9,11 +9,12 @@ export declare function destroyGWStore(): void;
|
|
|
9
9
|
export declare function rebootGWStore(): void;
|
|
10
10
|
interface StoreWrapperProps {
|
|
11
11
|
keepAlive?: boolean;
|
|
12
|
+
storeRef?: React.MutableRefObject<IGlobalStore | null>;
|
|
12
13
|
}
|
|
13
14
|
export declare class StoreWrapper extends React.Component<StoreWrapperProps> {
|
|
14
15
|
constructor(props: StoreWrapperProps);
|
|
15
16
|
componentWillUnmount(): void;
|
|
16
17
|
render(): JSX.Element;
|
|
17
18
|
}
|
|
18
|
-
export declare function useGlobalStore():
|
|
19
|
+
export declare function useGlobalStore(): IGlobalStore;
|
|
19
20
|
export {};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { Specification } from "
|
|
2
|
-
import { DataSet, DraggableFieldState, IFilterRule, IViewField, IVisualConfig } from "../interfaces";
|
|
1
|
+
import { DataSet, DraggableFieldState, IFilterRule, IViewField, IVisSpec, IVisualConfig, Specification } from "../interfaces";
|
|
3
2
|
import { VisSpecWithHistory } from "../models/visSpecHistory";
|
|
3
|
+
import { IStoInfo } from "../utils/save";
|
|
4
4
|
import { CommonStore } from "./commonStore";
|
|
5
|
+
export declare function initEncoding(): DraggableFieldState;
|
|
6
|
+
export declare function initVisualConfig(): IVisualConfig;
|
|
5
7
|
type DeepReadonly<T extends Record<keyof any, any>> = {
|
|
6
8
|
readonly [K in keyof T]: T[K] extends Record<keyof any, any> ? DeepReadonly<T[K]> : T[K];
|
|
7
9
|
};
|
|
@@ -76,7 +78,9 @@ export declare class VizSpecStore {
|
|
|
76
78
|
* dimension fields in visualization
|
|
77
79
|
*/
|
|
78
80
|
get viewMeasures(): IViewField[];
|
|
79
|
-
|
|
81
|
+
get allFields(): IViewField[];
|
|
82
|
+
get viewFilters(): readonly DeepReadonly<import("../interfaces").IFilterField>[];
|
|
83
|
+
addVisualization(defaultName?: string): void;
|
|
80
84
|
selectVisualization(visIndex: number): void;
|
|
81
85
|
setVisName(visIndex: number, name: string): void;
|
|
82
86
|
initState(): void;
|
|
@@ -99,8 +103,8 @@ export declare class VizSpecStore {
|
|
|
99
103
|
setFilterEditing(index: number): void;
|
|
100
104
|
closeFilterEditing(): void;
|
|
101
105
|
transpose(): void;
|
|
102
|
-
createBinField(stateKey: keyof DraggableFieldState, index: number): void;
|
|
103
|
-
createLogField(stateKey: keyof DraggableFieldState, index: number): void;
|
|
106
|
+
createBinField(stateKey: keyof DraggableFieldState, index: number, binType: 'bin' | 'binCount'): void;
|
|
107
|
+
createLogField(stateKey: keyof DraggableFieldState, index: number, scaleType: 'log10' | 'log2'): void;
|
|
104
108
|
setFieldAggregator(stateKey: keyof DraggableFieldState, index: number, aggName: string): void;
|
|
105
109
|
get sortCondition(): boolean;
|
|
106
110
|
setFieldSort(stateKey: keyof DraggableFieldState, index: number, sortType: "none" | "ascending" | "descending"): void;
|
|
@@ -109,6 +113,8 @@ export declare class VizSpecStore {
|
|
|
109
113
|
renderSpec(spec: Specification): void;
|
|
110
114
|
destroy(): void;
|
|
111
115
|
exportAsRaw(): string;
|
|
116
|
+
exportViewSpec(): IVisSpec[];
|
|
117
|
+
importStoInfo(stoInfo: IStoInfo): void;
|
|
112
118
|
importRaw(raw: string): void;
|
|
113
119
|
}
|
|
114
120
|
export {};
|
package/dist/utils/autoMark.d.ts
CHANGED
package/dist/utils/dataPrep.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { IRow } from "
|
|
2
|
-
import { IMutField } from "../interfaces";
|
|
1
|
+
import { IMutField, IRow } from "../interfaces";
|
|
3
2
|
export declare function guardDataKeys(data: IRow[], metas: IMutField[]): {
|
|
4
3
|
safeData: IRow[];
|
|
5
4
|
safeMetas: IMutField[];
|
|
6
5
|
};
|
|
6
|
+
export declare function flatNestKeys(object: any): string[];
|
|
7
|
+
export declare function getValueByKeyPath(object: any, keyPath: string): any;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IRow, Filters,
|
|
1
|
+
import { IRow, Filters, IViewField } from "../interfaces";
|
|
2
2
|
export declare function checkMajorFactor(data: IRow[], childrenData: Map<any, IRow[]>, dimensions: string[], measures: string[]): {
|
|
3
3
|
majorKey: string;
|
|
4
4
|
majorSum: number;
|
|
@@ -16,9 +16,7 @@ export declare function getPredicates(selection: IRow[], dimensions: string[], m
|
|
|
16
16
|
export declare function getPredicatesFromVegaSignals(signals: Filters, dimensions: string[], measures: string[]): IPredicate[];
|
|
17
17
|
export declare function filterByPredicates(data: IRow[], predicates: IPredicate[]): IRow[];
|
|
18
18
|
export declare function applyFilters(dataSource: IRow[], filters: Filters): IRow[];
|
|
19
|
-
export declare function
|
|
20
|
-
dataSource: IRow[];
|
|
21
|
-
fields: IMutField[];
|
|
22
|
-
};
|
|
19
|
+
export declare function createCountField(): IViewField;
|
|
23
20
|
export declare function getRange(nums: number[]): [number, number];
|
|
24
21
|
export declare function makeNumbersBeautiful(nums: number[]): number[];
|
|
22
|
+
export declare function classNames(...classes: string[]): string;
|
package/dist/utils/save.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { IDataSet, IDataSource, IVisSpec } from "../interfaces";
|
|
|
2
2
|
import { VisSpecWithHistory } from "../models/visSpecHistory";
|
|
3
3
|
export declare function dumpsGWPureSpec(list: VisSpecWithHistory[]): IVisSpec[];
|
|
4
4
|
export declare function parseGWPureSpec(list: IVisSpec[]): VisSpecWithHistory[];
|
|
5
|
-
interface IStoInfo {
|
|
5
|
+
export interface IStoInfo {
|
|
6
6
|
datasets: IDataSet[];
|
|
7
7
|
specList: {
|
|
8
8
|
[K in keyof IVisSpec]: K extends "config" ? Partial<IVisSpec[K]> : IVisSpec[K];
|
|
@@ -12,4 +12,3 @@ interface IStoInfo {
|
|
|
12
12
|
export declare function stringifyGWContent(info: IStoInfo): string;
|
|
13
13
|
export declare function parseGWContent(raw: string): IStoInfo;
|
|
14
14
|
export declare function download(data: string, filename: string, type: string): void;
|
|
15
|
-
export {};
|
package/dist/vis/react-vega.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IViewField, IRow, IStackMode, IDarkMode, IThemeKey } from '../interfaces';
|
|
3
|
+
import { SingleViewProps } from './spec/view';
|
|
3
4
|
export interface IReactVegaHandler {
|
|
4
5
|
getSVGData: () => Promise<string[]>;
|
|
5
6
|
getCanvasData: () => Promise<string[]>;
|
|
@@ -20,6 +21,7 @@ interface ReactVegaProps {
|
|
|
20
21
|
shape?: IViewField;
|
|
21
22
|
theta?: IViewField;
|
|
22
23
|
radius?: IViewField;
|
|
24
|
+
details?: Readonly<IViewField[]>;
|
|
23
25
|
showActions: boolean;
|
|
24
26
|
layoutMode: string;
|
|
25
27
|
width: number;
|
|
@@ -31,27 +33,5 @@ interface ReactVegaProps {
|
|
|
31
33
|
themeKey?: IThemeKey;
|
|
32
34
|
dark?: IDarkMode;
|
|
33
35
|
}
|
|
34
|
-
interface SingleViewProps {
|
|
35
|
-
x: IViewField;
|
|
36
|
-
y: IViewField;
|
|
37
|
-
color: IViewField;
|
|
38
|
-
opacity: IViewField;
|
|
39
|
-
size: IViewField;
|
|
40
|
-
shape: IViewField;
|
|
41
|
-
xOffset: IViewField;
|
|
42
|
-
yOffset: IViewField;
|
|
43
|
-
row: IViewField;
|
|
44
|
-
column: IViewField;
|
|
45
|
-
theta: IViewField;
|
|
46
|
-
radius: IViewField;
|
|
47
|
-
defaultAggregated: boolean;
|
|
48
|
-
stack: IStackMode;
|
|
49
|
-
geomType: string;
|
|
50
|
-
enableCrossFilter: boolean;
|
|
51
|
-
asCrossFilterTrigger: boolean;
|
|
52
|
-
selectEncoding: 'default' | 'none';
|
|
53
|
-
brushEncoding: 'x' | 'y' | 'default' | 'none';
|
|
54
|
-
hideLegend?: boolean;
|
|
55
|
-
}
|
|
56
36
|
declare const ReactVega: React.ForwardRefExoticComponent<ReactVegaProps & React.RefAttributes<IReactVegaHandler>>;
|
|
57
37
|
export default ReactVega;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IViewField } from '../../interfaces';
|
|
2
|
+
export interface IEncodeProps {
|
|
3
|
+
geomType: string;
|
|
4
|
+
x: IViewField;
|
|
5
|
+
y: IViewField;
|
|
6
|
+
color: IViewField;
|
|
7
|
+
opacity: IViewField;
|
|
8
|
+
size: IViewField;
|
|
9
|
+
shape: IViewField;
|
|
10
|
+
xOffset: IViewField;
|
|
11
|
+
yOffset: IViewField;
|
|
12
|
+
row: IViewField;
|
|
13
|
+
column: IViewField;
|
|
14
|
+
theta: IViewField;
|
|
15
|
+
radius: IViewField;
|
|
16
|
+
details: Readonly<IViewField[]>;
|
|
17
|
+
}
|
|
18
|
+
export declare function channelEncode(props: IEncodeProps): {
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { IStackMode } from '../../interfaces';
|
|
2
|
+
import { IEncodeProps } from './encode';
|
|
3
|
+
export interface SingleViewProps extends IEncodeProps {
|
|
4
|
+
defaultAggregated: boolean;
|
|
5
|
+
stack: IStackMode;
|
|
6
|
+
enableCrossFilter: boolean;
|
|
7
|
+
asCrossFilterTrigger: boolean;
|
|
8
|
+
selectEncoding: 'default' | 'none';
|
|
9
|
+
brushEncoding: 'x' | 'y' | 'default' | 'none';
|
|
10
|
+
hideLegend?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function getSingleView(props: SingleViewProps): {
|
|
13
|
+
config: any;
|
|
14
|
+
mark: {
|
|
15
|
+
type: string;
|
|
16
|
+
opacity: number;
|
|
17
|
+
tooltip: {
|
|
18
|
+
content: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
encoding: {
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
};
|
|
24
|
+
transform?: undefined;
|
|
25
|
+
params?: undefined;
|
|
26
|
+
} | {
|
|
27
|
+
config: any;
|
|
28
|
+
transform: {
|
|
29
|
+
filter: {
|
|
30
|
+
param: string;
|
|
31
|
+
};
|
|
32
|
+
}[];
|
|
33
|
+
params: {
|
|
34
|
+
name: string;
|
|
35
|
+
select: {
|
|
36
|
+
type: string;
|
|
37
|
+
encodings: ("x" | "y")[] | undefined;
|
|
38
|
+
};
|
|
39
|
+
}[];
|
|
40
|
+
mark: {
|
|
41
|
+
type: string;
|
|
42
|
+
opacity: number;
|
|
43
|
+
tooltip: {
|
|
44
|
+
content: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
encoding: {
|
|
48
|
+
[key: string]: any;
|
|
49
|
+
};
|
|
50
|
+
} | {
|
|
51
|
+
config: any;
|
|
52
|
+
transform: {
|
|
53
|
+
filter: {
|
|
54
|
+
param: string;
|
|
55
|
+
};
|
|
56
|
+
}[];
|
|
57
|
+
params: {
|
|
58
|
+
name: string;
|
|
59
|
+
select: {
|
|
60
|
+
type: string;
|
|
61
|
+
};
|
|
62
|
+
}[];
|
|
63
|
+
mark: {
|
|
64
|
+
type: string;
|
|
65
|
+
opacity: number;
|
|
66
|
+
tooltip: {
|
|
67
|
+
content: string;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
encoding: {
|
|
71
|
+
[key: string]: any;
|
|
72
|
+
};
|
|
73
|
+
};
|