@kanaries/graphic-walker 0.3.16 → 0.4.0
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 +9 -2
- package/dist/assets/filter.worker-f09fcd6f.js.map +1 -1
- package/dist/assets/sort.worker-f77540ac.js.map +1 -0
- package/dist/assets/transform.worker-bae8e910.js.map +1 -0
- package/dist/assets/{viewQuery.worker-03404216.js.map → viewQuery.worker-bdb6477c.js.map} +1 -1
- package/dist/components/askViz/index.d.ts +6 -0
- package/dist/components/askViz/schemaTransform.d.ts +2 -0
- package/dist/components/dataTable/index.d.ts +8 -5
- package/dist/components/pivotTable/store.d.ts +0 -2
- package/dist/components/spinner.d.ts +2 -0
- package/dist/computation/clientComputation.d.ts +3 -0
- package/dist/computation/serverComputation.d.ts +8 -0
- package/dist/config.d.ts +3 -1
- package/dist/fields/filterField/tabs.d.ts +2 -1
- package/dist/graphic-walker.es.js +22226 -21650
- package/dist/graphic-walker.es.js.map +1 -1
- package/dist/graphic-walker.umd.js +137 -137
- package/dist/graphic-walker.umd.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/interfaces.d.ts +93 -4
- package/dist/lib/execExp.d.ts +4 -4
- package/dist/lib/interfaces.d.ts +1 -0
- package/dist/lib/viewQuery.d.ts +2 -2
- package/dist/renderer/hooks.d.ts +8 -4
- package/dist/renderer/index.d.ts +2 -1
- package/dist/renderer/pureRenderer.d.ts +17 -1
- package/dist/renderer/specRenderer.d.ts +1 -0
- package/dist/services.d.ts +8 -5
- package/dist/store/commonStore.d.ts +2 -2
- package/dist/store/visualSpecStore.d.ts +58 -42
- package/dist/utils/save.d.ts +10 -2
- package/dist/utils/workflow.d.ts +3 -0
- package/dist/vis/react-vega.d.ts +3 -1
- package/dist/workers/sort.d.ts +2 -2
- package/dist/workers/transform.d.ts +5 -2
- package/package.json +2 -2
- package/src/App.tsx +46 -7
- package/src/components/askViz/index.tsx +92 -0
- package/src/components/askViz/schemaTransform.ts +38 -0
- package/src/components/dataTable/index.tsx +51 -11
- package/src/components/pivotTable/index.tsx +0 -1
- package/src/components/pivotTable/store.tsx +0 -16
- package/src/components/spinner.tsx +14 -0
- package/src/components/toggle.tsx +2 -2
- package/src/components/visualConfig/index.tsx +78 -8
- package/src/computation/clientComputation.ts +55 -0
- package/src/computation/serverComputation.ts +153 -0
- package/src/config.ts +15 -2
- package/src/dataSource/datasetConfig/index.tsx +38 -6
- package/src/dataSource/table.tsx +11 -2
- package/src/fields/filterField/filterEditDialog.tsx +11 -10
- package/src/fields/filterField/tabs.tsx +178 -77
- package/src/index.tsx +2 -0
- package/src/interfaces.ts +108 -5
- package/src/lib/execExp.ts +20 -11
- package/src/lib/interfaces.ts +1 -0
- package/src/lib/op/aggregate.ts +1 -1
- package/src/lib/viewQuery.ts +2 -2
- package/src/locales/en-US.json +11 -2
- package/src/locales/ja-JP.json +11 -2
- package/src/locales/zh-CN.json +11 -2
- package/src/main.tsx +1 -1
- package/src/renderer/hooks.ts +100 -66
- package/src/renderer/index.tsx +10 -6
- package/src/renderer/pureRenderer.tsx +40 -14
- package/src/renderer/specRenderer.tsx +24 -7
- package/src/services.ts +7 -8
- package/src/store/commonStore.ts +7 -7
- package/src/store/visualSpecStore.ts +287 -192
- package/src/utils/save.ts +81 -3
- package/src/utils/workflow.ts +148 -0
- package/src/vis/react-vega.tsx +21 -6
- package/src/vis/spec/aggregate.ts +3 -2
- package/src/vis/spec/stack.ts +7 -6
- package/src/visualSettings/index.tsx +2 -3
- package/src/workers/filter.worker.js +1 -1
- package/src/workers/sort.ts +3 -4
- package/src/workers/sort.worker.ts +2 -2
- package/src/workers/transform.ts +7 -8
- package/src/workers/transform.worker.js +2 -2
- package/src/workers/viewQuery.worker.js +2 -2
- package/dist/assets/sort.worker-4299a6a0.js.map +0 -1
- package/dist/assets/transform.worker-a12fb3d8.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -6,3 +6,5 @@ export declare const GraphicWalker: React.MemoExoticComponent<React.ForwardRefEx
|
|
|
6
6
|
export { default as PureRenderer } from './renderer/pureRenderer';
|
|
7
7
|
export { embedGraphicWalker } from './vanilla';
|
|
8
8
|
export type { IGWProps };
|
|
9
|
+
export { ISegmentKey } from './interfaces';
|
|
10
|
+
export { resolveSpecFromStoInfo } from './utils/save';
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Config as VgConfig, View } from 'vega';
|
|
2
2
|
import { Config as VlConfig } from 'vega-lite';
|
|
3
|
+
import type { IViewQuery } from "./lib/viewQuery";
|
|
3
4
|
export type DeepReadonly<T extends Record<keyof any, any>> = {
|
|
4
5
|
readonly [K in keyof T]: T[K] extends Record<keyof any, any> ? DeepReadonly<T[K]> : T[K];
|
|
5
6
|
};
|
|
@@ -46,6 +47,16 @@ export interface IUncertainMutField {
|
|
|
46
47
|
analyticType: IAnalyticType | '?';
|
|
47
48
|
path: string[];
|
|
48
49
|
}
|
|
50
|
+
export interface IDatasetStats {
|
|
51
|
+
rowCount: number;
|
|
52
|
+
}
|
|
53
|
+
export interface IFieldStats {
|
|
54
|
+
values: {
|
|
55
|
+
value: number | string;
|
|
56
|
+
count: number;
|
|
57
|
+
}[];
|
|
58
|
+
range: [number, number];
|
|
59
|
+
}
|
|
49
60
|
export type IExpParamter = {
|
|
50
61
|
type: 'field';
|
|
51
62
|
value: string;
|
|
@@ -83,11 +94,12 @@ export interface IField {
|
|
|
83
94
|
computed?: boolean;
|
|
84
95
|
expression?: IExpression;
|
|
85
96
|
basename?: string;
|
|
86
|
-
path?: [];
|
|
97
|
+
path?: string[];
|
|
87
98
|
}
|
|
99
|
+
export type ISortMode = 'none' | 'ascending' | 'descending';
|
|
88
100
|
export interface IViewField extends IField {
|
|
89
101
|
dragId: string;
|
|
90
|
-
sort?:
|
|
102
|
+
sort?: ISortMode;
|
|
91
103
|
}
|
|
92
104
|
export interface DataSet {
|
|
93
105
|
id: string;
|
|
@@ -135,6 +147,10 @@ export interface IDataSource {
|
|
|
135
147
|
export interface IFilterField extends IViewField {
|
|
136
148
|
rule: IFilterRule | null;
|
|
137
149
|
}
|
|
150
|
+
export interface IFilterFiledSimple {
|
|
151
|
+
fid: string;
|
|
152
|
+
rule: IFilterRule | null;
|
|
153
|
+
}
|
|
138
154
|
export interface DraggableFieldState {
|
|
139
155
|
dimensions: IViewField[];
|
|
140
156
|
measures: IViewField[];
|
|
@@ -164,25 +180,35 @@ export type IFilterRule = {
|
|
|
164
180
|
type: 'one of';
|
|
165
181
|
value: Set<string | number>;
|
|
166
182
|
};
|
|
167
|
-
export type IStackMode = 'none' | 'stack' | 'normalize';
|
|
183
|
+
export type IStackMode = 'none' | 'stack' | 'normalize' | 'zero' | 'center';
|
|
168
184
|
export interface IVisualConfig {
|
|
169
185
|
defaultAggregated: boolean;
|
|
170
186
|
geoms: string[];
|
|
171
187
|
stack: IStackMode;
|
|
172
188
|
showActions: boolean;
|
|
173
189
|
interactiveScale: boolean;
|
|
174
|
-
sorted:
|
|
190
|
+
sorted: ISortMode;
|
|
175
191
|
zeroScale: boolean;
|
|
192
|
+
background?: string;
|
|
176
193
|
format: {
|
|
177
194
|
numberFormat?: string;
|
|
178
195
|
timeFormat?: string;
|
|
179
196
|
normalizedNumberFormat?: string;
|
|
180
197
|
};
|
|
198
|
+
resolve: {
|
|
199
|
+
x?: boolean;
|
|
200
|
+
y?: boolean;
|
|
201
|
+
color?: boolean;
|
|
202
|
+
opacity?: boolean;
|
|
203
|
+
shape?: boolean;
|
|
204
|
+
size?: boolean;
|
|
205
|
+
};
|
|
181
206
|
size: {
|
|
182
207
|
mode: 'auto' | 'fixed';
|
|
183
208
|
width: number;
|
|
184
209
|
height: number;
|
|
185
210
|
};
|
|
211
|
+
limit: number;
|
|
186
212
|
}
|
|
187
213
|
export interface IVisSpec {
|
|
188
214
|
readonly visId: string;
|
|
@@ -201,6 +227,7 @@ export declare enum ISegmentKey {
|
|
|
201
227
|
}
|
|
202
228
|
export type IThemeKey = 'vega' | 'g2';
|
|
203
229
|
export type IDarkMode = 'media' | 'light' | 'dark';
|
|
230
|
+
export type IComputationFunction = (payload: IDataQueryPayload) => Promise<IRow[]>;
|
|
204
231
|
export type VegaGlobalConfig = VgConfig | VlConfig;
|
|
205
232
|
export interface IVegaChartRef {
|
|
206
233
|
x: number;
|
|
@@ -299,4 +326,66 @@ export interface IGWHandler {
|
|
|
299
326
|
export interface IGWHandlerInsider extends IGWHandler {
|
|
300
327
|
updateRenderStatus: (renderStatus: IRenderStatus) => void;
|
|
301
328
|
}
|
|
329
|
+
export interface IVisField {
|
|
330
|
+
key: string;
|
|
331
|
+
type: ISemanticType;
|
|
332
|
+
name?: string;
|
|
333
|
+
description?: string;
|
|
334
|
+
format?: string;
|
|
335
|
+
expression?: IExpression;
|
|
336
|
+
}
|
|
337
|
+
export type IVisFieldComputation = {
|
|
338
|
+
field: IVisField['key'];
|
|
339
|
+
expression: NonNullable<IVisField['expression']>;
|
|
340
|
+
name: NonNullable<IVisField['name']>;
|
|
341
|
+
type: IVisField['type'];
|
|
342
|
+
};
|
|
343
|
+
export interface IVisFilter {
|
|
344
|
+
fid: string;
|
|
345
|
+
rule: SetToArray<IFilterRule>;
|
|
346
|
+
}
|
|
347
|
+
export interface IFilterWorkflowStep {
|
|
348
|
+
type: 'filter';
|
|
349
|
+
filters: IVisFilter[];
|
|
350
|
+
}
|
|
351
|
+
export interface ITransformWorkflowStep {
|
|
352
|
+
type: 'transform';
|
|
353
|
+
transform: {
|
|
354
|
+
key: IVisFieldComputation['field'];
|
|
355
|
+
expression: IVisFieldComputation['expression'];
|
|
356
|
+
}[];
|
|
357
|
+
}
|
|
358
|
+
export interface IViewWorkflowStep {
|
|
359
|
+
type: 'view';
|
|
360
|
+
query: IViewQuery[];
|
|
361
|
+
}
|
|
362
|
+
export interface ISortWorkflowStep {
|
|
363
|
+
type: 'sort';
|
|
364
|
+
sort: 'ascending' | 'descending';
|
|
365
|
+
by: string[];
|
|
366
|
+
}
|
|
367
|
+
export type IDataQueryWorkflowStep = IFilterWorkflowStep | ITransformWorkflowStep | IViewWorkflowStep | ISortWorkflowStep;
|
|
368
|
+
export interface IDataQueryPayload {
|
|
369
|
+
workflow: IDataQueryWorkflowStep[];
|
|
370
|
+
limit?: number;
|
|
371
|
+
offset?: number;
|
|
372
|
+
}
|
|
373
|
+
export interface ILoadDataPayload {
|
|
374
|
+
pageSize: number;
|
|
375
|
+
pageIndex: number;
|
|
376
|
+
}
|
|
377
|
+
export interface IGWDatasetStat {
|
|
378
|
+
count: number;
|
|
379
|
+
}
|
|
380
|
+
export type IResponse<T> = ({
|
|
381
|
+
success: true;
|
|
382
|
+
data: T;
|
|
383
|
+
} | {
|
|
384
|
+
success: false;
|
|
385
|
+
message: string;
|
|
386
|
+
error?: {
|
|
387
|
+
code: `ERR_${Uppercase<string>}`;
|
|
388
|
+
options?: Record<string, string>;
|
|
389
|
+
};
|
|
390
|
+
});
|
|
302
391
|
export {};
|
package/dist/lib/execExp.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { IExpression,
|
|
1
|
+
import { IExpression, IRow } from "../interfaces";
|
|
2
2
|
interface IDataFrame {
|
|
3
3
|
[key: string]: any[];
|
|
4
4
|
}
|
|
5
|
-
export declare function execExpression(exp: IExpression, dataFrame: IDataFrame
|
|
6
|
-
export declare function dataset2DataFrame(dataset: IRow[]
|
|
7
|
-
export declare function dataframe2Dataset(dataFrame: IDataFrame
|
|
5
|
+
export declare function execExpression(exp: IExpression, dataFrame: IDataFrame): IDataFrame;
|
|
6
|
+
export declare function dataset2DataFrame(dataset: IRow[]): IDataFrame;
|
|
7
|
+
export declare function dataframe2Dataset(dataFrame: IDataFrame): IRow[];
|
|
8
8
|
export {};
|
package/dist/lib/interfaces.d.ts
CHANGED
package/dist/lib/viewQuery.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IRow } from "../interfaces";
|
|
2
2
|
import { IAggQuery, IBinQuery, IFoldQuery, IRawQuery } from "./interfaces";
|
|
3
3
|
export type IViewQuery = IAggQuery | IFoldQuery | IBinQuery | IRawQuery;
|
|
4
|
-
export declare function queryView(rawData: IRow[],
|
|
4
|
+
export declare function queryView(rawData: IRow[], query: IViewQuery): IRow[];
|
package/dist/renderer/hooks.d.ts
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import type { DeepReadonly, IFilterField, IRow, IViewField } from '../interfaces';
|
|
1
|
+
import type { DeepReadonly, IFilterField, IRow, IViewField, IDataQueryWorkflowStep, IComputationFunction } from '../interfaces';
|
|
2
|
+
export declare const useComputationFunc: () => IComputationFunction;
|
|
2
3
|
interface UseRendererProps {
|
|
3
|
-
data: IRow[];
|
|
4
4
|
allFields: Omit<IViewField, 'dragId'>[];
|
|
5
|
-
viewDimensions: IViewField[];
|
|
6
|
-
viewMeasures: IViewField[];
|
|
5
|
+
viewDimensions: Omit<IViewField, 'dragId'>[];
|
|
6
|
+
viewMeasures: Omit<IViewField, 'dragId'>[];
|
|
7
7
|
filters: readonly DeepReadonly<IFilterField>[];
|
|
8
8
|
defaultAggregated: boolean;
|
|
9
9
|
sort: 'none' | 'ascending' | 'descending';
|
|
10
10
|
limit: number;
|
|
11
|
+
computationFunction: IComputationFunction;
|
|
11
12
|
}
|
|
12
13
|
interface UseRendererResult {
|
|
13
14
|
viewData: IRow[];
|
|
14
15
|
loading: boolean;
|
|
16
|
+
parsed: {
|
|
17
|
+
workflow: IDataQueryWorkflowStep[];
|
|
18
|
+
};
|
|
15
19
|
}
|
|
16
20
|
export declare const useRenderer: (props: UseRendererProps) => UseRendererResult;
|
|
17
21
|
export {};
|
package/dist/renderer/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { IDarkMode, IThemeKey } from '../interfaces';
|
|
2
|
+
import { IDarkMode, IThemeKey, IComputationFunction } from '../interfaces';
|
|
3
3
|
import { IReactVegaHandler } from '../vis/react-vega';
|
|
4
4
|
interface RendererProps {
|
|
5
5
|
themeKey?: IThemeKey;
|
|
6
6
|
dark?: IDarkMode;
|
|
7
|
+
computationFunction: IComputationFunction;
|
|
7
8
|
}
|
|
8
9
|
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<Pick<RendererProps & React.RefAttributes<IReactVegaHandler>, "key" | keyof RendererProps> & React.RefAttributes<IReactVegaHandler>>>;
|
|
9
10
|
export default _default;
|
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
2
|
+
import type { IDarkMode, IRow, IThemeKey, DraggableFieldState, IVisualConfig, IComputationFunction } from '../interfaces';
|
|
3
|
+
declare const _default: ((props: {
|
|
4
|
+
name?: string | undefined;
|
|
5
|
+
themeKey?: IThemeKey | undefined;
|
|
6
|
+
dark?: IDarkMode | undefined;
|
|
7
|
+
visualState: DraggableFieldState;
|
|
8
|
+
visualConfig: IVisualConfig;
|
|
9
|
+
sort?: "none" | "ascending" | "descending" | undefined;
|
|
10
|
+
limit?: number | undefined;
|
|
11
|
+
locale?: string | undefined;
|
|
12
|
+
} & ({
|
|
13
|
+
type: "remote";
|
|
14
|
+
computation: IComputationFunction;
|
|
15
|
+
} | {
|
|
16
|
+
type?: "local" | undefined;
|
|
17
|
+
rawData: IRow[];
|
|
18
|
+
})) => JSX.Element) & {
|
|
3
19
|
displayName: string;
|
|
4
20
|
};
|
|
5
21
|
export default _default;
|
|
@@ -11,6 +11,7 @@ interface SpecRendererProps {
|
|
|
11
11
|
visualConfig: DeepReadonly<IVisualConfig>;
|
|
12
12
|
onGeomClick?: ((values: any, e: any) => void) | undefined;
|
|
13
13
|
onChartResize?: ((width: number, height: number) => void) | undefined;
|
|
14
|
+
locale?: string;
|
|
14
15
|
}
|
|
15
16
|
/**
|
|
16
17
|
* Sans-store renderer of GraphicWalker.
|
package/dist/services.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { IRow,
|
|
1
|
+
import { IRow, Specification, IFilterFiledSimple, IExpression } from './interfaces';
|
|
2
2
|
import { IViewQuery } from './lib/viewQuery';
|
|
3
3
|
export interface IVisSpace {
|
|
4
4
|
dataView: IRow[];
|
|
5
5
|
schema: Specification;
|
|
6
6
|
}
|
|
7
|
-
export declare const applyFilter: (data: IRow[], filters: readonly
|
|
8
|
-
export declare const transformDataService: (data: IRow[],
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
export declare const applyFilter: (data: IRow[], filters: readonly IFilterFiledSimple[]) => Promise<IRow[]>;
|
|
8
|
+
export declare const transformDataService: (data: IRow[], trans: {
|
|
9
|
+
key: string;
|
|
10
|
+
expression: IExpression;
|
|
11
|
+
}[]) => Promise<IRow[]>;
|
|
12
|
+
export declare const applyViewQuery: (data: IRow[], query: IViewQuery) => Promise<IRow[]>;
|
|
13
|
+
export declare const applySort: (data: IRow[], viewMeasures: string[], sort: 'ascending' | 'descending') => Promise<IRow[]>;
|
|
@@ -42,8 +42,8 @@ export declare class CommonStore {
|
|
|
42
42
|
updateTempSTDDS(dataset: IDataSetInfo): void;
|
|
43
43
|
commitTempDS(): void;
|
|
44
44
|
startDSBuildingTask(): void;
|
|
45
|
-
addAndUseDS(dataset: IDataSetInfo): string;
|
|
46
|
-
addDS(dataset: IDataSetInfo): string;
|
|
45
|
+
addAndUseDS(dataset: IDataSetInfo, datasetId?: string | undefined): string;
|
|
46
|
+
addDS(dataset: IDataSetInfo, datasetId?: string | undefined): string;
|
|
47
47
|
removeDS(datasetId: string): void;
|
|
48
48
|
useDS(datasetId: string): void;
|
|
49
49
|
createPlaceholderDS(): void;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { DataSet, DraggableFieldState, IFilterRule, IViewField, IVisualConfig, Specification } from
|
|
2
|
-
import { VisSpecWithHistory } from
|
|
3
|
-
import { IStoInfo } from
|
|
4
|
-
import { CommonStore } from
|
|
1
|
+
import { DataSet, DraggableFieldState, IFilterRule, ISortMode, IStackMode, IViewField, IVisualConfig, Specification, IComputationFunction } from '../interfaces';
|
|
2
|
+
import { VisSpecWithHistory } from '../models/visSpecHistory';
|
|
3
|
+
import { IStoInfo } from '../utils/save';
|
|
4
|
+
import { CommonStore } from './commonStore';
|
|
5
5
|
export declare function initEncoding(): DraggableFieldState;
|
|
6
|
-
export declare function initVisualConfig(): IVisualConfig;
|
|
7
6
|
type DeepReadonly<T extends Record<keyof any, any>> = {
|
|
8
7
|
readonly [K in keyof T]: T[K] extends Record<keyof any, any> ? DeepReadonly<T[K]> : T[K];
|
|
9
8
|
};
|
|
@@ -47,6 +46,7 @@ export declare class VizSpecStore {
|
|
|
47
46
|
canUndo: boolean;
|
|
48
47
|
canRedo: boolean;
|
|
49
48
|
editingFilterIdx: number | null;
|
|
49
|
+
computationFuction: IComputationFunction;
|
|
50
50
|
constructor(commonStore: CommonStore);
|
|
51
51
|
private __dangerous_is_inside_useMutable__;
|
|
52
52
|
/**
|
|
@@ -85,11 +85,14 @@ export declare class VizSpecStore {
|
|
|
85
85
|
setVisName(visIndex: number, name: string): void;
|
|
86
86
|
initState(): void;
|
|
87
87
|
initMetaState(dataset: DataSet): void;
|
|
88
|
+
/**
|
|
89
|
+
* clear all config in draggable state
|
|
90
|
+
*/
|
|
88
91
|
clearState(): void;
|
|
89
92
|
setVisualConfig<K extends keyof IVisualConfig>(configKey: K, value: IVisualConfig[K]): void;
|
|
90
|
-
transformCoord(coord:
|
|
93
|
+
transformCoord(coord: 'cartesian' | 'polar'): void;
|
|
91
94
|
setChartLayout(props: {
|
|
92
|
-
mode: IVisualConfig[
|
|
95
|
+
mode: IVisualConfig['size']['mode'];
|
|
93
96
|
width?: number;
|
|
94
97
|
height?: number;
|
|
95
98
|
}): void;
|
|
@@ -102,14 +105,15 @@ export declare class VizSpecStore {
|
|
|
102
105
|
setFilterEditing(index: number): void;
|
|
103
106
|
closeFilterEditing(): void;
|
|
104
107
|
transpose(): void;
|
|
105
|
-
createBinField(stateKey: keyof DraggableFieldState, index: number, binType: 'bin' | 'binCount'):
|
|
108
|
+
createBinField(stateKey: keyof DraggableFieldState, index: number, binType: 'bin' | 'binCount'): string;
|
|
106
109
|
createLogField(stateKey: keyof DraggableFieldState, index: number, scaleType: 'log10' | 'log2'): void;
|
|
107
110
|
setFieldAggregator(stateKey: keyof DraggableFieldState, index: number, aggName: string): void;
|
|
108
111
|
get sortCondition(): boolean;
|
|
109
|
-
setFieldSort(stateKey: keyof DraggableFieldState, index: number, sortType:
|
|
110
|
-
applyDefaultSort(sortType?:
|
|
111
|
-
appendField(destinationKey: keyof DraggableFieldState, field: IViewField | undefined): void;
|
|
112
|
+
setFieldSort(stateKey: keyof DraggableFieldState, index: number, sortType: ISortMode): void;
|
|
113
|
+
applyDefaultSort(sortType?: ISortMode): void;
|
|
114
|
+
appendField(destinationKey: keyof DraggableFieldState, field: IViewField | undefined, overrideAttr?: Record<string, any>): void;
|
|
112
115
|
setVizFormatConfig(formatKey: keyof IVisualConfig['format'], value?: string): void;
|
|
116
|
+
renderVLSubset(vlStruct: any): void;
|
|
113
117
|
renderSpec(spec: Specification): void;
|
|
114
118
|
destroy(): void;
|
|
115
119
|
exportAsRaw(): string;
|
|
@@ -119,7 +123,7 @@ export declare class VizSpecStore {
|
|
|
119
123
|
readonly encodings: {
|
|
120
124
|
readonly dimensions: readonly {
|
|
121
125
|
readonly dragId: string;
|
|
122
|
-
readonly sort?:
|
|
126
|
+
readonly sort?: ISortMode | undefined;
|
|
123
127
|
readonly fid: string;
|
|
124
128
|
readonly name: string;
|
|
125
129
|
readonly aggName?: string | undefined;
|
|
@@ -145,11 +149,11 @@ export declare class VizSpecStore {
|
|
|
145
149
|
as: string;
|
|
146
150
|
} | undefined;
|
|
147
151
|
readonly basename?: string | undefined;
|
|
148
|
-
readonly path?: [] | undefined;
|
|
152
|
+
readonly path?: string[] | undefined;
|
|
149
153
|
}[];
|
|
150
154
|
readonly measures: readonly {
|
|
151
155
|
readonly dragId: string;
|
|
152
|
-
readonly sort?:
|
|
156
|
+
readonly sort?: ISortMode | undefined;
|
|
153
157
|
readonly fid: string;
|
|
154
158
|
readonly name: string;
|
|
155
159
|
readonly aggName?: string | undefined;
|
|
@@ -175,11 +179,11 @@ export declare class VizSpecStore {
|
|
|
175
179
|
as: string;
|
|
176
180
|
} | undefined;
|
|
177
181
|
readonly basename?: string | undefined;
|
|
178
|
-
readonly path?: [] | undefined;
|
|
182
|
+
readonly path?: string[] | undefined;
|
|
179
183
|
}[];
|
|
180
184
|
readonly rows: readonly {
|
|
181
185
|
readonly dragId: string;
|
|
182
|
-
readonly sort?:
|
|
186
|
+
readonly sort?: ISortMode | undefined;
|
|
183
187
|
readonly fid: string;
|
|
184
188
|
readonly name: string;
|
|
185
189
|
readonly aggName?: string | undefined;
|
|
@@ -205,11 +209,11 @@ export declare class VizSpecStore {
|
|
|
205
209
|
as: string;
|
|
206
210
|
} | undefined;
|
|
207
211
|
readonly basename?: string | undefined;
|
|
208
|
-
readonly path?: [] | undefined;
|
|
212
|
+
readonly path?: string[] | undefined;
|
|
209
213
|
}[];
|
|
210
214
|
readonly columns: readonly {
|
|
211
215
|
readonly dragId: string;
|
|
212
|
-
readonly sort?:
|
|
216
|
+
readonly sort?: ISortMode | undefined;
|
|
213
217
|
readonly fid: string;
|
|
214
218
|
readonly name: string;
|
|
215
219
|
readonly aggName?: string | undefined;
|
|
@@ -235,11 +239,11 @@ export declare class VizSpecStore {
|
|
|
235
239
|
as: string;
|
|
236
240
|
} | undefined;
|
|
237
241
|
readonly basename?: string | undefined;
|
|
238
|
-
readonly path?: [] | undefined;
|
|
242
|
+
readonly path?: string[] | undefined;
|
|
239
243
|
}[];
|
|
240
244
|
readonly color: readonly {
|
|
241
245
|
readonly dragId: string;
|
|
242
|
-
readonly sort?:
|
|
246
|
+
readonly sort?: ISortMode | undefined;
|
|
243
247
|
readonly fid: string;
|
|
244
248
|
readonly name: string;
|
|
245
249
|
readonly aggName?: string | undefined;
|
|
@@ -265,11 +269,11 @@ export declare class VizSpecStore {
|
|
|
265
269
|
as: string;
|
|
266
270
|
} | undefined;
|
|
267
271
|
readonly basename?: string | undefined;
|
|
268
|
-
readonly path?: [] | undefined;
|
|
272
|
+
readonly path?: string[] | undefined;
|
|
269
273
|
}[];
|
|
270
274
|
readonly opacity: readonly {
|
|
271
275
|
readonly dragId: string;
|
|
272
|
-
readonly sort?:
|
|
276
|
+
readonly sort?: ISortMode | undefined;
|
|
273
277
|
readonly fid: string;
|
|
274
278
|
readonly name: string;
|
|
275
279
|
readonly aggName?: string | undefined;
|
|
@@ -295,11 +299,11 @@ export declare class VizSpecStore {
|
|
|
295
299
|
as: string;
|
|
296
300
|
} | undefined;
|
|
297
301
|
readonly basename?: string | undefined;
|
|
298
|
-
readonly path?: [] | undefined;
|
|
302
|
+
readonly path?: string[] | undefined;
|
|
299
303
|
}[];
|
|
300
304
|
readonly size: readonly {
|
|
301
305
|
readonly dragId: string;
|
|
302
|
-
readonly sort?:
|
|
306
|
+
readonly sort?: ISortMode | undefined;
|
|
303
307
|
readonly fid: string;
|
|
304
308
|
readonly name: string;
|
|
305
309
|
readonly aggName?: string | undefined;
|
|
@@ -325,11 +329,11 @@ export declare class VizSpecStore {
|
|
|
325
329
|
as: string;
|
|
326
330
|
} | undefined;
|
|
327
331
|
readonly basename?: string | undefined;
|
|
328
|
-
readonly path?: [] | undefined;
|
|
332
|
+
readonly path?: string[] | undefined;
|
|
329
333
|
}[];
|
|
330
334
|
readonly shape: readonly {
|
|
331
335
|
readonly dragId: string;
|
|
332
|
-
readonly sort?:
|
|
336
|
+
readonly sort?: ISortMode | undefined;
|
|
333
337
|
readonly fid: string;
|
|
334
338
|
readonly name: string;
|
|
335
339
|
readonly aggName?: string | undefined;
|
|
@@ -355,11 +359,11 @@ export declare class VizSpecStore {
|
|
|
355
359
|
as: string;
|
|
356
360
|
} | undefined;
|
|
357
361
|
readonly basename?: string | undefined;
|
|
358
|
-
readonly path?: [] | undefined;
|
|
362
|
+
readonly path?: string[] | undefined;
|
|
359
363
|
}[];
|
|
360
364
|
readonly theta: readonly {
|
|
361
365
|
readonly dragId: string;
|
|
362
|
-
readonly sort?:
|
|
366
|
+
readonly sort?: ISortMode | undefined;
|
|
363
367
|
readonly fid: string;
|
|
364
368
|
readonly name: string;
|
|
365
369
|
readonly aggName?: string | undefined;
|
|
@@ -385,11 +389,11 @@ export declare class VizSpecStore {
|
|
|
385
389
|
as: string;
|
|
386
390
|
} | undefined;
|
|
387
391
|
readonly basename?: string | undefined;
|
|
388
|
-
readonly path?: [] | undefined;
|
|
392
|
+
readonly path?: string[] | undefined;
|
|
389
393
|
}[];
|
|
390
394
|
readonly radius: readonly {
|
|
391
395
|
readonly dragId: string;
|
|
392
|
-
readonly sort?:
|
|
396
|
+
readonly sort?: ISortMode | undefined;
|
|
393
397
|
readonly fid: string;
|
|
394
398
|
readonly name: string;
|
|
395
399
|
readonly aggName?: string | undefined;
|
|
@@ -415,11 +419,11 @@ export declare class VizSpecStore {
|
|
|
415
419
|
as: string;
|
|
416
420
|
} | undefined;
|
|
417
421
|
readonly basename?: string | undefined;
|
|
418
|
-
readonly path?: [] | undefined;
|
|
422
|
+
readonly path?: string[] | undefined;
|
|
419
423
|
}[];
|
|
420
424
|
readonly details: readonly {
|
|
421
425
|
readonly dragId: string;
|
|
422
|
-
readonly sort?:
|
|
426
|
+
readonly sort?: ISortMode | undefined;
|
|
423
427
|
readonly fid: string;
|
|
424
428
|
readonly name: string;
|
|
425
429
|
readonly aggName?: string | undefined;
|
|
@@ -445,7 +449,7 @@ export declare class VizSpecStore {
|
|
|
445
449
|
as: string;
|
|
446
450
|
} | undefined;
|
|
447
451
|
readonly basename?: string | undefined;
|
|
448
|
-
readonly path?: [] | undefined;
|
|
452
|
+
readonly path?: string[] | undefined;
|
|
449
453
|
}[];
|
|
450
454
|
readonly filters: readonly {
|
|
451
455
|
readonly rule: {
|
|
@@ -459,7 +463,7 @@ export declare class VizSpecStore {
|
|
|
459
463
|
value: (string | number)[];
|
|
460
464
|
} | null;
|
|
461
465
|
readonly dragId: string;
|
|
462
|
-
readonly sort?:
|
|
466
|
+
readonly sort?: ISortMode | undefined;
|
|
463
467
|
readonly fid: string;
|
|
464
468
|
readonly name: string;
|
|
465
469
|
readonly aggName?: string | undefined;
|
|
@@ -485,11 +489,11 @@ export declare class VizSpecStore {
|
|
|
485
489
|
as: string;
|
|
486
490
|
} | undefined;
|
|
487
491
|
readonly basename?: string | undefined;
|
|
488
|
-
readonly path?: [] | undefined;
|
|
492
|
+
readonly path?: string[] | undefined;
|
|
489
493
|
}[];
|
|
490
494
|
readonly text: readonly {
|
|
491
495
|
readonly dragId: string;
|
|
492
|
-
readonly sort?:
|
|
496
|
+
readonly sort?: ISortMode | undefined;
|
|
493
497
|
readonly fid: string;
|
|
494
498
|
readonly name: string;
|
|
495
499
|
readonly aggName?: string | undefined;
|
|
@@ -515,34 +519,46 @@ export declare class VizSpecStore {
|
|
|
515
519
|
as: string;
|
|
516
520
|
} | undefined;
|
|
517
521
|
readonly basename?: string | undefined;
|
|
518
|
-
readonly path?: [] | undefined;
|
|
522
|
+
readonly path?: string[] | undefined;
|
|
519
523
|
}[];
|
|
520
524
|
};
|
|
521
525
|
readonly config: {
|
|
522
526
|
readonly defaultAggregated: boolean;
|
|
523
527
|
readonly geoms: readonly string[];
|
|
524
|
-
readonly stack:
|
|
528
|
+
readonly stack: IStackMode;
|
|
525
529
|
readonly showActions: boolean;
|
|
526
530
|
readonly interactiveScale: boolean;
|
|
527
|
-
readonly sorted:
|
|
531
|
+
readonly sorted: ISortMode;
|
|
528
532
|
readonly zeroScale: boolean;
|
|
533
|
+
readonly background?: string | undefined;
|
|
529
534
|
readonly format: {
|
|
530
535
|
readonly numberFormat?: string | undefined;
|
|
531
536
|
readonly timeFormat?: string | undefined;
|
|
532
537
|
readonly normalizedNumberFormat?: string | undefined;
|
|
533
538
|
};
|
|
539
|
+
readonly resolve: {
|
|
540
|
+
readonly x?: boolean | undefined;
|
|
541
|
+
readonly y?: boolean | undefined;
|
|
542
|
+
readonly color?: boolean | undefined;
|
|
543
|
+
readonly opacity?: boolean | undefined;
|
|
544
|
+
readonly shape?: boolean | undefined;
|
|
545
|
+
readonly size?: boolean | undefined;
|
|
546
|
+
};
|
|
534
547
|
readonly size: {
|
|
535
548
|
readonly mode: "auto" | "fixed";
|
|
536
549
|
readonly width: number;
|
|
537
550
|
readonly height: number;
|
|
538
551
|
};
|
|
552
|
+
readonly limit: number;
|
|
539
553
|
};
|
|
540
554
|
}[];
|
|
541
555
|
importStoInfo(stoInfo: IStoInfo): void;
|
|
542
556
|
importRaw(raw: string): void;
|
|
543
557
|
private visSpecEncoder;
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
get sort():
|
|
558
|
+
get limit(): number;
|
|
559
|
+
setLimit(value: number): void;
|
|
560
|
+
get sort(): ISortMode;
|
|
561
|
+
getWorkflow(): import("../interfaces").IDataQueryWorkflowStep[];
|
|
562
|
+
setComputationFunction(f: IComputationFunction): void;
|
|
547
563
|
}
|
|
548
564
|
export {};
|
package/dist/utils/save.d.ts
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
import { IDataSet, IDataSource, IVisSpec, IVisSpecForExport } from "../interfaces";
|
|
1
|
+
import { DraggableFieldState, IDataSet, IDataSource, IVisSpec, IVisSpecForExport, IVisualConfig } 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
|
+
export declare function initVisualConfig(): IVisualConfig;
|
|
6
|
+
export declare function visSpecDecoder(visList: IVisSpecForExport[]): IVisSpec[];
|
|
7
|
+
export declare const forwardVisualConfigs: (backwards: ReturnType<typeof parseGWContent>['specList']) => IVisSpecForExport[];
|
|
8
|
+
export declare function resolveSpecFromStoInfo(info: IStoInfo): {
|
|
9
|
+
config: IVisualConfig;
|
|
10
|
+
encodings: DraggableFieldState;
|
|
11
|
+
name: string | undefined;
|
|
12
|
+
};
|
|
5
13
|
export interface IStoInfo {
|
|
6
14
|
datasets: IDataSet[];
|
|
7
15
|
specList: {
|
|
8
|
-
[K in keyof IVisSpecForExport]: K extends
|
|
16
|
+
[K in keyof IVisSpecForExport]: K extends 'config' ? Partial<IVisSpecForExport[K]> : IVisSpecForExport[K];
|
|
9
17
|
}[];
|
|
10
18
|
dataSources: IDataSource[];
|
|
11
19
|
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { IDataQueryWorkflowStep, IViewField } from "../interfaces";
|
|
2
|
+
import type { VizSpecStore } from "../store/visualSpecStore";
|
|
3
|
+
export declare const toWorkflow: (viewFilters: VizSpecStore['viewFilters'], allFields: Omit<IViewField, 'dragId'>[], viewDimensions: Omit<IViewField, 'dragId'>[], viewMeasures: Omit<IViewField, 'dragId'>[], defaultAggregated: VizSpecStore['visualConfig']['defaultAggregated'], sort: 'none' | 'ascending' | 'descending', limit?: number) => IDataQueryWorkflowStep[];
|
package/dist/vis/react-vega.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ interface ReactVegaProps {
|
|
|
10
10
|
name?: string;
|
|
11
11
|
rows: Readonly<IViewField[]>;
|
|
12
12
|
columns: Readonly<IViewField[]>;
|
|
13
|
-
dataSource: IRow[];
|
|
13
|
+
dataSource: readonly IRow[];
|
|
14
14
|
defaultAggregate?: boolean;
|
|
15
15
|
stack: IStackMode;
|
|
16
16
|
interactiveScale: boolean;
|
|
@@ -29,6 +29,8 @@ interface ReactVegaProps {
|
|
|
29
29
|
height: number;
|
|
30
30
|
onGeomClick?: (values: any, e: any) => void;
|
|
31
31
|
vegaConfig: VegaGlobalConfig;
|
|
32
|
+
/** @default "en-US" */
|
|
33
|
+
locale?: string;
|
|
32
34
|
}
|
|
33
35
|
declare const ReactVega: React.ForwardRefExoticComponent<ReactVegaProps & React.RefAttributes<IReactVegaHandler>>;
|
|
34
36
|
export default ReactVega;
|
package/dist/workers/sort.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function sortBy(data: IRow[], viewMeasures:
|
|
1
|
+
import { IRow } from '../interfaces';
|
|
2
|
+
export declare function sortBy(data: IRow[], viewMeasures: string[], sort: 'ascending' | 'descending'): IRow[];
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function transformData(data: IRow[],
|
|
1
|
+
import { IRow, IExpression } from "../interfaces";
|
|
2
|
+
export declare function transformData(data: IRow[], trans: {
|
|
3
|
+
key: string;
|
|
4
|
+
expression: IExpression;
|
|
5
|
+
}[]): IRow[];
|