@kanaries/graphic-walker 0.2.16 → 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 +3 -4
- package/dist/assets/viewQuery.worker-ffefc111.js.map +1 -1
- package/dist/dataSource/index.d.ts +0 -1
- package/dist/fields/encodeFields/singleEncodeEditor.d.ts +4 -4
- package/dist/graphic-walker.es.js +29716 -34642
- 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/interfaces.d.ts +31 -16
- 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 +2 -1
- package/dist/lib/op/aggregate.d.ts +1 -1
- package/dist/lib/op/bin.d.ts +1 -1
- package/dist/lib/op/fold.d.ts +1 -1
- package/dist/lib/viewQuery.d.ts +1 -2
- package/dist/services.d.ts +1 -30
- package/dist/store/visualSpecStore.d.ts +1 -2
- package/dist/utils/autoMark.d.ts +1 -1
- package/dist/utils/dataPrep.d.ts +1 -2
- package/dist/vis/react-vega.d.ts +1 -0
- package/dist/vis/spec/encode.d.ts +1 -0
- package/dist/vis/spec/mark.d.ts +1 -1
- package/dist/vis/spec/tooltip.d.ts +4 -0
- package/dist/vis/spec/view.d.ts +9 -3
- package/package.json +2 -4
- package/src/App.tsx +55 -68
- package/src/dataSource/index.tsx +0 -17
- package/src/fields/aestheticFields.tsx +1 -2
- package/src/fields/encodeFields/singleEncodeEditor.tsx +11 -12
- package/src/fields/fieldsContext.tsx +1 -0
- package/src/interfaces.ts +75 -63
- 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 +3 -9
- package/src/lib/op/aggregate.ts +1 -1
- package/src/lib/op/bin.ts +1 -1
- package/src/lib/op/fold.ts +1 -1
- package/src/lib/viewQuery.ts +1 -2
- package/src/locales/en-US.json +2 -1
- package/src/locales/zh-CN.json +2 -1
- package/src/renderer/specRenderer.tsx +2 -0
- package/src/services.ts +65 -67
- package/src/store/visualSpecStore.ts +2 -4
- package/src/utils/autoMark.ts +1 -1
- package/src/utils/dataPrep.ts +1 -2
- package/src/vis/react-vega.tsx +5 -0
- package/src/vis/spec/encode.ts +1 -0
- package/src/vis/spec/mark.ts +1 -1
- package/src/vis/spec/tooltip.ts +16 -0
- package/src/vis/spec/view.ts +12 -14
- package/dist/assets/explainer.worker-8428eb12.js.map +0 -1
- 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/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/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
|
}
|
|
@@ -71,12 +81,6 @@ export interface IViewField extends IField {
|
|
|
71
81
|
dragId: string;
|
|
72
82
|
sort?: 'none' | 'ascending' | 'descending';
|
|
73
83
|
}
|
|
74
|
-
export interface Measure extends IField {
|
|
75
|
-
aggregator?: AggFC;
|
|
76
|
-
minWidth?: number;
|
|
77
|
-
formatter?: (value: number | undefined) => number | string;
|
|
78
|
-
[key: string]: any;
|
|
79
|
-
}
|
|
80
84
|
export interface DataSet {
|
|
81
85
|
id: string;
|
|
82
86
|
name: string;
|
|
@@ -89,7 +93,18 @@ export interface IFieldNeighbor {
|
|
|
89
93
|
}
|
|
90
94
|
export interface IMeasure {
|
|
91
95
|
key: string;
|
|
92
|
-
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[];
|
|
93
108
|
}
|
|
94
109
|
export interface IDataSet {
|
|
95
110
|
id: string;
|
|
@@ -144,8 +159,8 @@ export type IFilterRule = {
|
|
|
144
159
|
export declare const EXPLORATION_TYPES: readonly ["none", "brush", "point"];
|
|
145
160
|
export declare const BRUSH_DIRECTIONS: readonly ["default", "x", "y"];
|
|
146
161
|
export type IStackMode = 'none' | 'stack' | 'normalize';
|
|
147
|
-
export type IExplorationType =
|
|
148
|
-
export type IBrushDirection =
|
|
162
|
+
export type IExplorationType = typeof EXPLORATION_TYPES[number];
|
|
163
|
+
export type IBrushDirection = typeof BRUSH_DIRECTIONS[number];
|
|
149
164
|
export interface IVisualConfig {
|
|
150
165
|
defaultAggregated: boolean;
|
|
151
166
|
geoms: string[];
|
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[];
|
package/dist/lib/interfaces.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { IAggregator } from "../interfaces";
|
|
1
2
|
export interface IAggQuery {
|
|
2
3
|
op: 'aggregate';
|
|
3
4
|
groupBy: string[];
|
|
4
5
|
agg: {
|
|
5
|
-
[field: string]:
|
|
6
|
+
[field: string]: IAggregator;
|
|
6
7
|
};
|
|
7
8
|
}
|
|
8
9
|
export interface IFoldQuery {
|
package/dist/lib/op/bin.d.ts
CHANGED
package/dist/lib/op/fold.d.ts
CHANGED
package/dist/lib/viewQuery.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { IRow } from "
|
|
2
|
-
import { IMutField } from "../interfaces";
|
|
1
|
+
import { IMutField, IRow } from "../interfaces";
|
|
3
2
|
import { IAggQuery, IBinQuery, IFoldQuery, IRawQuery } from "./interfaces";
|
|
4
3
|
export type IViewQuery = IAggQuery | IFoldQuery | IBinQuery | IRawQuery;
|
|
5
4
|
export declare function queryView(rawData: IRow[], metas: IMutField[], query: IViewQuery): IRow[];
|
package/dist/services.d.ts
CHANGED
|
@@ -1,38 +1,9 @@
|
|
|
1
|
-
import { Specification } from '
|
|
2
|
-
import { IRow, Filters, SemanticType, IMeasure, IMutField, IFilterField } from './interfaces';
|
|
3
|
-
import { IExplaination, IMeasureWithStat } from './insights';
|
|
1
|
+
import { IRow, IMutField, IFilterField, Specification } from './interfaces';
|
|
4
2
|
import { IViewQuery } from './lib/viewQuery';
|
|
5
|
-
interface ExplainParams {
|
|
6
|
-
dimensions: string[];
|
|
7
|
-
measures: string[];
|
|
8
|
-
dataSource: IRow[];
|
|
9
|
-
filters?: Filters;
|
|
10
|
-
currentSpace: {
|
|
11
|
-
dimensions: string[];
|
|
12
|
-
measures: IMeasure[];
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
3
|
export interface IVisSpace {
|
|
16
4
|
dataView: IRow[];
|
|
17
5
|
schema: Specification;
|
|
18
6
|
}
|
|
19
|
-
interface ExplainReturns {
|
|
20
|
-
explainations: IExplaination[];
|
|
21
|
-
valueExp: IMeasureWithStat[];
|
|
22
|
-
visSpaces: IVisSpace[];
|
|
23
|
-
fieldsWithSemanticType: Array<{
|
|
24
|
-
key: string;
|
|
25
|
-
type: SemanticType;
|
|
26
|
-
}>;
|
|
27
|
-
}
|
|
28
|
-
export declare function getExplaination(props: ExplainParams): Promise<ExplainReturns>;
|
|
29
|
-
interface PreAnalysisParams {
|
|
30
|
-
fields: IMutField[];
|
|
31
|
-
dataSource: IRow[];
|
|
32
|
-
}
|
|
33
|
-
export declare function preAnalysis(props: PreAnalysisParams): Promise<void>;
|
|
34
|
-
export declare function destroyWorker(): void;
|
|
35
7
|
export declare const applyFilter: (data: IRow[], filters: readonly IFilterField[]) => Promise<IRow[]>;
|
|
36
8
|
export declare const transformDataService: (data: IRow[], columns: IMutField[]) => Promise<IRow[]>;
|
|
37
9
|
export declare const applyViewQuery: (data: IRow[], metas: IMutField[], query: IViewQuery) => Promise<IRow[]>;
|
|
38
|
-
export {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Specification } from "
|
|
2
|
-
import { DataSet, DraggableFieldState, IFilterRule, IViewField, IVisSpec, IVisualConfig } from "../interfaces";
|
|
1
|
+
import { DataSet, DraggableFieldState, IFilterRule, IViewField, IVisSpec, IVisualConfig, Specification } from "../interfaces";
|
|
3
2
|
import { VisSpecWithHistory } from "../models/visSpecHistory";
|
|
4
3
|
import { IStoInfo } from "../utils/save";
|
|
5
4
|
import { CommonStore } from "./commonStore";
|
package/dist/utils/autoMark.d.ts
CHANGED
package/dist/utils/dataPrep.d.ts
CHANGED
package/dist/vis/react-vega.d.ts
CHANGED
package/dist/vis/spec/mark.d.ts
CHANGED
package/dist/vis/spec/view.d.ts
CHANGED
|
@@ -14,7 +14,9 @@ export declare function getSingleView(props: SingleViewProps): {
|
|
|
14
14
|
mark: {
|
|
15
15
|
type: string;
|
|
16
16
|
opacity: number;
|
|
17
|
-
tooltip:
|
|
17
|
+
tooltip: {
|
|
18
|
+
content: string;
|
|
19
|
+
};
|
|
18
20
|
};
|
|
19
21
|
encoding: {
|
|
20
22
|
[key: string]: any;
|
|
@@ -38,7 +40,9 @@ export declare function getSingleView(props: SingleViewProps): {
|
|
|
38
40
|
mark: {
|
|
39
41
|
type: string;
|
|
40
42
|
opacity: number;
|
|
41
|
-
tooltip:
|
|
43
|
+
tooltip: {
|
|
44
|
+
content: string;
|
|
45
|
+
};
|
|
42
46
|
};
|
|
43
47
|
encoding: {
|
|
44
48
|
[key: string]: any;
|
|
@@ -59,7 +63,9 @@ export declare function getSingleView(props: SingleViewProps): {
|
|
|
59
63
|
mark: {
|
|
60
64
|
type: string;
|
|
61
65
|
opacity: number;
|
|
62
|
-
tooltip:
|
|
66
|
+
tooltip: {
|
|
67
|
+
content: string;
|
|
68
|
+
};
|
|
63
69
|
};
|
|
64
70
|
encoding: {
|
|
65
71
|
[key: string]: any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kanaries/graphic-walker",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.17",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev:front_end": "vite --host",
|
|
6
6
|
"dev": "npm run dev:front_end",
|
|
@@ -47,15 +47,13 @@
|
|
|
47
47
|
"postinstall-postinstall": "^2.1.0",
|
|
48
48
|
"re-resizable": "^6.9.8",
|
|
49
49
|
"react-i18next": "^11.18.6",
|
|
50
|
-
"react-json-view": "^1.21.3",
|
|
51
50
|
"react-shadow": "^20.0.0",
|
|
52
51
|
"rxjs": "^7.3.0",
|
|
53
52
|
"tailwindcss": "^3.2.4",
|
|
54
53
|
"uuid": "^8.3.2",
|
|
55
54
|
"vega": "^5.22.1",
|
|
56
55
|
"vega-embed": "^6.21.0",
|
|
57
|
-
"vega-lite": "^5.6.0"
|
|
58
|
-
"visual-insights": "0.7.15"
|
|
56
|
+
"vega-lite": "^5.6.0"
|
|
59
57
|
},
|
|
60
58
|
"devDependencies": {
|
|
61
59
|
"@rollup/plugin-typescript": "^8.2.5",
|
package/src/App.tsx
CHANGED
|
@@ -1,29 +1,23 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import FilterField from "./fields/filterField";
|
|
22
|
-
import { guardDataKeys } from "./utils/dataPrep";
|
|
23
|
-
import SegmentNav from "./segments/segmentNav";
|
|
24
|
-
import DatasetConfig from "./dataSource/datasetConfig";
|
|
25
|
-
import { useCurrentMediaTheme } from "./utils/media";
|
|
26
|
-
import CodeExport from "./components/codeExport";
|
|
1
|
+
import React, { useEffect, useRef, useMemo } from 'react';
|
|
2
|
+
import { observer } from 'mobx-react-lite';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { IDarkMode, IMutField, IRow, ISegmentKey, IThemeKey, Specification } from './interfaces';
|
|
5
|
+
import type { IReactVegaHandler } from './vis/react-vega';
|
|
6
|
+
import VisualSettings from './visualSettings';
|
|
7
|
+
import PosFields from './fields/posFields';
|
|
8
|
+
import AestheticFields from './fields/aestheticFields';
|
|
9
|
+
import DatasetFields from './fields/datasetFields/index';
|
|
10
|
+
import ReactiveRenderer from './renderer/index';
|
|
11
|
+
import DataSourceSegment from './dataSource/index';
|
|
12
|
+
import { IGlobalStore, useGlobalStore } from './store';
|
|
13
|
+
import VisNav from './segments/visNav';
|
|
14
|
+
import { mergeLocaleRes, setLocaleLanguage } from './locales/i18n';
|
|
15
|
+
import FilterField from './fields/filterField';
|
|
16
|
+
import { guardDataKeys } from './utils/dataPrep';
|
|
17
|
+
import SegmentNav from './segments/segmentNav';
|
|
18
|
+
import DatasetConfig from './dataSource/datasetConfig';
|
|
19
|
+
import { useCurrentMediaTheme } from './utils/media';
|
|
20
|
+
import CodeExport from './components/codeExport';
|
|
27
21
|
|
|
28
22
|
export interface IGWProps {
|
|
29
23
|
dataSource?: IRow[];
|
|
@@ -43,22 +37,21 @@ export interface IGWProps {
|
|
|
43
37
|
storeRef?: React.MutableRefObject<IGlobalStore | null>;
|
|
44
38
|
}
|
|
45
39
|
|
|
46
|
-
const App = observer<IGWProps>(function App
|
|
40
|
+
const App = observer<IGWProps>(function App(props) {
|
|
47
41
|
const {
|
|
48
42
|
dataSource = [],
|
|
49
43
|
rawFields = [],
|
|
50
44
|
spec,
|
|
51
|
-
i18nLang =
|
|
45
|
+
i18nLang = 'en-US',
|
|
52
46
|
i18nResources,
|
|
53
47
|
hideDataSourceConfig,
|
|
54
48
|
fieldKeyGuard = true,
|
|
55
49
|
themeKey = 'vega',
|
|
56
|
-
dark = 'media'
|
|
50
|
+
dark = 'media',
|
|
57
51
|
} = props;
|
|
58
52
|
const { commonStore, vizStore } = useGlobalStore();
|
|
59
|
-
const [insightReady, setInsightReady] = useState<boolean>(true);
|
|
60
53
|
|
|
61
|
-
const {
|
|
54
|
+
const { datasets, segmentKey } = commonStore;
|
|
62
55
|
|
|
63
56
|
const { t, i18n } = useTranslation();
|
|
64
57
|
const curLang = i18n.language;
|
|
@@ -93,53 +86,43 @@ const App = observer<IGWProps>(function App (props) {
|
|
|
93
86
|
useEffect(() => {
|
|
94
87
|
if (safeDataset.safeData.length > 0 && safeDataset.safeMetas.length > 0) {
|
|
95
88
|
commonStore.addAndUseDS({
|
|
96
|
-
name:
|
|
89
|
+
name: 'context dataset',
|
|
97
90
|
dataSource: safeDataset.safeData,
|
|
98
91
|
rawFields: safeDataset.safeMetas,
|
|
99
92
|
});
|
|
100
93
|
}
|
|
101
94
|
}, [safeDataset]);
|
|
102
95
|
|
|
103
|
-
// do preparation analysis work when using a new dataset
|
|
104
96
|
useEffect(() => {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
setInsightReady(false);
|
|
108
|
-
preAnalysis({
|
|
109
|
-
dataSource: ds.dataSource,
|
|
110
|
-
fields: toJS(ds.rawFields),
|
|
111
|
-
}).then(() => {
|
|
112
|
-
setInsightReady(true);
|
|
113
|
-
|
|
114
|
-
if (spec) {
|
|
115
|
-
vizStore.renderSpec(spec);
|
|
116
|
-
}
|
|
117
|
-
});
|
|
97
|
+
if (safeDataset.safeData.length > 0 && safeDataset.safeMetas.length > 0 && spec) {
|
|
98
|
+
vizStore.renderSpec(spec);
|
|
118
99
|
}
|
|
119
|
-
|
|
120
|
-
destroyWorker();
|
|
121
|
-
};
|
|
122
|
-
}, [currentDataset, spec]);
|
|
100
|
+
}, [spec, safeDataset]);
|
|
123
101
|
|
|
124
102
|
const darkMode = useCurrentMediaTheme(dark);
|
|
125
103
|
|
|
126
104
|
const rendererRef = useRef<IReactVegaHandler>(null);
|
|
127
105
|
|
|
128
106
|
return (
|
|
129
|
-
<div
|
|
107
|
+
<div
|
|
108
|
+
className={`${
|
|
109
|
+
darkMode === 'dark' ? 'dark' : ''
|
|
110
|
+
} App font-sans bg-white dark:bg-zinc-900 dark:text-white m-0 p-0`}
|
|
111
|
+
>
|
|
130
112
|
{/* <div className="grow-0">
|
|
131
113
|
<PageNav />
|
|
132
114
|
</div> */}
|
|
133
115
|
<div className="bg-white dark:bg-zinc-900 dark:text-white">
|
|
134
|
-
{!hideDataSourceConfig && <DataSourceSegment
|
|
116
|
+
{!hideDataSourceConfig && <DataSourceSegment />}
|
|
135
117
|
<div className="px-2 mx-2">
|
|
136
118
|
<SegmentNav />
|
|
137
|
-
{
|
|
138
|
-
segmentKey === ISegmentKey.vis && <VisNav />
|
|
139
|
-
}
|
|
119
|
+
{segmentKey === ISegmentKey.vis && <VisNav />}
|
|
140
120
|
</div>
|
|
141
121
|
{segmentKey === ISegmentKey.vis && (
|
|
142
|
-
<div
|
|
122
|
+
<div
|
|
123
|
+
style={{ marginTop: '0em', borderTop: 'none' }}
|
|
124
|
+
className="m-4 p-4 border border-gray-200 dark:border-gray-700"
|
|
125
|
+
>
|
|
143
126
|
<VisualSettings rendererHandler={rendererRef} darkModePreference={dark} />
|
|
144
127
|
<CodeExport />
|
|
145
128
|
<div className="md:grid md:grid-cols-12 xl:grid-cols-6">
|
|
@@ -156,17 +139,18 @@ const App = observer<IGWProps>(function App (props) {
|
|
|
156
139
|
</div>
|
|
157
140
|
<div
|
|
158
141
|
className="m-0.5 p-1 border border-gray-200 dark:border-gray-700"
|
|
159
|
-
style={{ minHeight:
|
|
160
|
-
onMouseLeave={() => {
|
|
161
|
-
|
|
162
|
-
}}
|
|
163
|
-
onClick={() => {
|
|
164
|
-
|
|
165
|
-
}}
|
|
142
|
+
style={{ minHeight: '600px', overflow: 'auto' }}
|
|
143
|
+
// onMouseLeave={() => {
|
|
144
|
+
// vizEmbededMenu.show && commonStore.closeEmbededMenu();
|
|
145
|
+
// }}
|
|
146
|
+
// onClick={() => {
|
|
147
|
+
// vizEmbededMenu.show && commonStore.closeEmbededMenu();
|
|
148
|
+
// }}
|
|
166
149
|
>
|
|
167
|
-
{datasets.length > 0 &&
|
|
168
|
-
|
|
169
|
-
|
|
150
|
+
{datasets.length > 0 && (
|
|
151
|
+
<ReactiveRenderer ref={rendererRef} themeKey={themeKey} dark={dark} />
|
|
152
|
+
)}
|
|
153
|
+
{/* {vizEmbededMenu.show && (
|
|
170
154
|
<ClickMenu x={vizEmbededMenu.position[0]} y={vizEmbededMenu.position[1]}>
|
|
171
155
|
<div
|
|
172
156
|
className="flex items-center whitespace-nowrap py-1 px-4 hover:bg-gray-100 dark:hover:bg-gray-800 cursor-pointer"
|
|
@@ -181,14 +165,17 @@ const App = observer<IGWProps>(function App (props) {
|
|
|
181
165
|
<LightBulbIcon className="ml-1 w-3 flex-grow-0 flex-shrink-0" />
|
|
182
166
|
</div>
|
|
183
167
|
</ClickMenu>
|
|
184
|
-
)}
|
|
168
|
+
)} */}
|
|
185
169
|
</div>
|
|
186
170
|
</div>
|
|
187
171
|
</div>
|
|
188
172
|
</div>
|
|
189
173
|
)}
|
|
190
174
|
{segmentKey === ISegmentKey.data && (
|
|
191
|
-
<div
|
|
175
|
+
<div
|
|
176
|
+
className="m-4 p-4 border border-gray-200 dark:border-gray-700"
|
|
177
|
+
style={{ marginTop: '0em', borderTop: 'none' }}
|
|
178
|
+
>
|
|
192
179
|
<DatasetConfig />
|
|
193
180
|
</div>
|
|
194
181
|
)}
|
package/src/dataSource/index.tsx
CHANGED
|
@@ -12,11 +12,9 @@ import DropdownSelect from "../components/dropdownSelect";
|
|
|
12
12
|
import PrimaryButton from "../components/button/primary";
|
|
13
13
|
|
|
14
14
|
interface DSSegmentProps {
|
|
15
|
-
preWorkDone: boolean;
|
|
16
15
|
}
|
|
17
16
|
|
|
18
17
|
const DataSourceSegment: React.FC<DSSegmentProps> = (props) => {
|
|
19
|
-
const { preWorkDone } = props;
|
|
20
18
|
const { commonStore, vizStore } = useGlobalStore();
|
|
21
19
|
const gwFileRef = useRef<HTMLInputElement>(null);
|
|
22
20
|
const { t } = useTranslation();
|
|
@@ -26,9 +24,6 @@ const DataSourceSegment: React.FC<DSSegmentProps> = (props) => {
|
|
|
26
24
|
return (
|
|
27
25
|
<div className="flex items-center m-4 p-4 border border-gray-200 dark:border-gray-700">
|
|
28
26
|
<GwFile fileRef={gwFileRef} />
|
|
29
|
-
{!preWorkDone && (
|
|
30
|
-
<div className="animate-spin inline-block mr-2 ml-2 w-4 h-4 rounded-full border-t-2 border-l-2 border-blue-500"></div>
|
|
31
|
-
)}
|
|
32
27
|
{/* <label className="text-xs mr-1 whitespace-nowrap self-center h-4">
|
|
33
28
|
{t("DataSource.labels.cur_dataset")}
|
|
34
29
|
</label> */}
|
|
@@ -76,18 +71,6 @@ const DataSourceSegment: React.FC<DSSegmentProps> = (props) => {
|
|
|
76
71
|
>
|
|
77
72
|
<DataSelection />
|
|
78
73
|
</Modal>
|
|
79
|
-
{/* {showDSPanel && (
|
|
80
|
-
<Modal
|
|
81
|
-
title={t("DataSource.dialog.create_data_source")}
|
|
82
|
-
onClose={() => {
|
|
83
|
-
commonStore.setShowDSPanel(false);
|
|
84
|
-
}}
|
|
85
|
-
>
|
|
86
|
-
<DataSelection />
|
|
87
|
-
</Modal>
|
|
88
|
-
)} */}
|
|
89
|
-
{preWorkDone && <CheckCircleIcon className="text-green-500 w-5 inline-block ml-2" />}
|
|
90
|
-
{!preWorkDone && <ArrowPathIcon className="text-yellow-500 w-5 inline-block ml-2" />}
|
|
91
74
|
</div>
|
|
92
75
|
);
|
|
93
76
|
};
|
|
@@ -2,10 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import { Droppable } from "@kanaries/react-beautiful-dnd";
|
|
3
3
|
import { DRAGGABLE_STATE_KEYS } from './fieldsContext';
|
|
4
4
|
import { AestheticFieldContainer } from './components'
|
|
5
|
-
import OBFieldContainer from './obComponents/obFContainer';
|
|
6
5
|
import SingleEncodeEditor from './encodeFields/singleEncodeEditor';
|
|
7
6
|
|
|
8
|
-
const aestheticFields = DRAGGABLE_STATE_KEYS.filter(f => ['color', 'opacity', 'size', 'shape'].includes(f.id));
|
|
7
|
+
const aestheticFields = DRAGGABLE_STATE_KEYS.filter(f => ['color', 'opacity', 'size', 'shape', 'details'].includes(f.id));
|
|
9
8
|
|
|
10
9
|
const AestheticFields: React.FC = props => {
|
|
11
10
|
return <div>
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import React, { useMemo } from
|
|
2
|
-
import { IDraggableStateKey } from
|
|
3
|
-
import { observer } from
|
|
4
|
-
import { useGlobalStore } from
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import { Draggable, DroppableStateSnapshot } from "@kanaries/react-beautiful-dnd";
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { IDraggableStateKey } from '../../interfaces';
|
|
3
|
+
import { observer } from 'mobx-react-lite';
|
|
4
|
+
import { useGlobalStore } from '../../store';
|
|
5
|
+
import { DroppableProvided } from 'react-beautiful-dnd';
|
|
6
|
+
import { ChevronUpDownIcon, TrashIcon } from '@heroicons/react/24/outline';
|
|
7
|
+
import { useTranslation } from 'react-i18next';
|
|
8
|
+
import { COUNT_FIELD_ID } from '../../constants';
|
|
9
|
+
import DropdownContext from '../../components/dropdownContext';
|
|
10
|
+
import { AGGREGATOR_LIST } from '../fieldsContext';
|
|
11
|
+
import { Draggable, DroppableStateSnapshot } from '@kanaries/react-beautiful-dnd';
|
|
13
12
|
|
|
14
13
|
interface SingleEncodeEditorProps {
|
|
15
14
|
dkey: IDraggableStateKey;
|
|
@@ -50,6 +50,7 @@ export const DRAGGABLE_STATE_KEYS: Readonly<IDraggableStateKey[]> = [
|
|
|
50
50
|
{ id: 'theta', mode: 1 },
|
|
51
51
|
{ id: 'radius', mode: 1 },
|
|
52
52
|
{ id: 'filters', mode: 1 },
|
|
53
|
+
{ id: 'details', mode: 1 }
|
|
53
54
|
] as const;
|
|
54
55
|
|
|
55
56
|
export const AGGREGATOR_LIST: Readonly<string[]> = [
|