@kanaries/graphic-walker 0.4.0 → 0.4.2

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.
Files changed (73) hide show
  1. package/dist/App.d.ts +5 -1
  2. package/dist/assets/buildMetricTable.worker-5555966a.js.map +1 -0
  3. package/dist/components/dataTable/index.d.ts +2 -1
  4. package/dist/components/leafletRenderer/ChoroplethRenderer.d.ts +21 -0
  5. package/dist/components/leafletRenderer/POIRenderer.d.ts +19 -0
  6. package/dist/components/leafletRenderer/encodings.d.ts +7 -0
  7. package/dist/components/leafletRenderer/geoConfigPanel.d.ts +3 -0
  8. package/dist/components/leafletRenderer/index.d.ts +14 -0
  9. package/dist/components/leafletRenderer/tooltip.d.ts +9 -0
  10. package/dist/components/leafletRenderer/utils.d.ts +2 -0
  11. package/dist/components/pivotTable/index.d.ts +2 -1
  12. package/dist/components/pivotTable/inteface.d.ts +6 -2
  13. package/dist/components/pivotTable/leftTree.d.ts +1 -0
  14. package/dist/components/pivotTable/topTree.d.ts +2 -0
  15. package/dist/components/pivotTable/utils.d.ts +1 -2
  16. package/dist/config.d.ts +3 -2
  17. package/dist/graphic-walker.es.js +37802 -30402
  18. package/dist/graphic-walker.es.js.map +1 -1
  19. package/dist/graphic-walker.umd.js +145 -137
  20. package/dist/graphic-walker.umd.js.map +1 -1
  21. package/dist/hooks/index.d.ts +1 -0
  22. package/dist/interfaces.d.ts +27 -0
  23. package/dist/renderer/specRenderer.d.ts +2 -1
  24. package/dist/services.d.ts +7 -1
  25. package/dist/store/commonStore.d.ts +6 -0
  26. package/dist/store/visualSpecStore.d.ts +180 -4
  27. package/dist/utils/save.d.ts +1 -0
  28. package/dist/workers/buildPivotTable.d.ts +7 -0
  29. package/package.json +14 -2
  30. package/src/App.tsx +18 -4
  31. package/src/components/askViz/index.tsx +2 -1
  32. package/src/components/dataTable/index.tsx +7 -5
  33. package/src/components/leafletRenderer/ChoroplethRenderer.tsx +293 -0
  34. package/src/components/leafletRenderer/POIRenderer.tsx +170 -0
  35. package/src/components/leafletRenderer/encodings.ts +194 -0
  36. package/src/components/leafletRenderer/geoConfigPanel.tsx +197 -0
  37. package/src/components/leafletRenderer/index.tsx +67 -0
  38. package/src/components/leafletRenderer/tooltip.tsx +24 -0
  39. package/src/components/leafletRenderer/utils.ts +52 -0
  40. package/src/components/limitSetting.tsx +8 -6
  41. package/src/components/pivotTable/index.tsx +171 -67
  42. package/src/components/pivotTable/inteface.ts +6 -2
  43. package/src/components/pivotTable/leftTree.tsx +24 -11
  44. package/src/components/pivotTable/metricTable.tsx +15 -10
  45. package/src/components/pivotTable/topTree.tsx +50 -17
  46. package/src/components/pivotTable/utils.ts +70 -11
  47. package/src/components/sizeSetting.tsx +9 -7
  48. package/src/components/visualConfig/index.tsx +17 -1
  49. package/src/computation/serverComputation.ts +8 -3
  50. package/src/config.ts +27 -16
  51. package/src/dataSource/table.tsx +9 -9
  52. package/src/fields/aestheticFields.tsx +4 -0
  53. package/src/fields/fieldsContext.tsx +3 -0
  54. package/src/fields/posFields/index.tsx +8 -2
  55. package/src/global.d.ts +4 -4
  56. package/src/hooks/index.ts +8 -0
  57. package/src/index.tsx +11 -9
  58. package/src/interfaces.ts +34 -0
  59. package/src/locales/en-US.json +27 -2
  60. package/src/locales/ja-JP.json +27 -2
  61. package/src/locales/zh-CN.json +27 -2
  62. package/src/renderer/hooks.ts +2 -48
  63. package/src/renderer/index.tsx +24 -1
  64. package/src/renderer/pureRenderer.tsx +26 -13
  65. package/src/renderer/specRenderer.tsx +45 -30
  66. package/src/services.ts +32 -23
  67. package/src/shadow-dom.tsx +7 -0
  68. package/src/store/commonStore.ts +29 -1
  69. package/src/store/visualSpecStore.ts +40 -24
  70. package/src/utils/save.ts +28 -1
  71. package/src/visualSettings/index.tsx +58 -7
  72. package/src/workers/buildMetricTable.worker.js +27 -0
  73. package/src/workers/buildPivotTable.ts +27 -0
package/dist/App.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { IComputationFunction, IDarkMode, IMutField, IRow, IThemeKey, Specification } from './interfaces';
2
+ import { IGeographicData, IComputationFunction, IDarkMode, IMutField, IRow, IThemeKey, Specification } from './interfaces';
3
3
  import { IGlobalStore } from './store';
4
4
  import type { ToolbarItemProps } from './components/toolbar';
5
5
  export interface IGWProps {
@@ -25,12 +25,16 @@ export interface IGWProps {
25
25
  extra?: ToolbarItemProps[];
26
26
  exclude?: string[];
27
27
  };
28
+ geographicData?: IGeographicData & {
29
+ key: string;
30
+ };
28
31
  enhanceAPI?: {
29
32
  header?: Record<string, string>;
30
33
  features?: {
31
34
  askviz?: string | boolean;
32
35
  };
33
36
  };
37
+ computationTimeout?: number;
34
38
  }
35
39
  declare const App: React.FunctionComponent<IGWProps>;
36
40
  export default App;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildMetricTable.worker-5555966a.js","sources":["../src/components/pivotTable/utils.ts","../src/workers/buildPivotTable.ts","../src/workers/buildMetricTable.worker.js"],"sourcesContent":["import { IRow } from \"../../interfaces\";\nimport { INestNode } from \"./inteface\";\n\nconst key_prefix = 'nk_';\n\nfunction insertNode (tree: INestNode, layerKeys: string[], nodeData: IRow, depth: number, collapsedKeyList: string[]) {\n if (depth >= layerKeys.length) {\n // tree.key = nodeData[layerKeys[depth]];\n return; \n }\n const key = nodeData[layerKeys[depth]];\n const uniqueKey = `${tree.uniqueKey}__${key}`;\n // console.log({\n // key,\n // nodeData,\n // layerKeys,\n // depth\n // })\n let child = tree.children.find((c) => c.key === key);\n if (!child) {\n // console.log(key, tree.children.map(c => c.key))\n // insertNode(child, layerKeys, nodeData, depth + 1);\n // return;\n child = {\n key,\n value: key,\n uniqueKey: uniqueKey, \n fieldKey: layerKeys[depth],\n children: [],\n path: [...tree.path, {key: layerKeys[depth], value: key}],\n height: layerKeys.length - depth - 1,\n isCollapsed: false,\n }\n if (collapsedKeyList.includes(tree.uniqueKey)) {\n tree.isCollapsed = true;\n }\n tree.children.splice(binarySearchIndex(tree.children, child.key), 0, child);\n }\n insertNode(child, layerKeys, nodeData, depth + 1, collapsedKeyList);\n\n}\n\n// Custom binary search function to find appropriate index for insertion.\nfunction binarySearchIndex(arr: INestNode[], keyVal: string | number): number {\n let start = 0, end = arr.length - 1;\n\n while (start <= end) {\n let middle = Math.floor((start + end) / 2);\n let middleVal = arr[middle].key;\n if (typeof middleVal === 'number' && typeof keyVal === 'number') {\n if (middleVal < keyVal) start = middle + 1;\n else end = middle - 1;\n } else {\n let cmp = String(middleVal).localeCompare(String(keyVal));\n if (cmp < 0) start = middle + 1;\n else end = middle - 1;\n }\n }\n return start;\n}\n\nconst ROOT_KEY = '__root';\nconst TOTAL_KEY = '__total'\n\nfunction insertSummaryNode (node: INestNode): void {\n if (node.children.length > 0) {\n node.children.push({\n key: TOTAL_KEY,\n value: 'total',\n fieldKey: node.children[0].fieldKey,\n uniqueKey: `${node.uniqueKey}${TOTAL_KEY}`,\n children: [],\n path: [],\n height: node.children[0].height,\n isCollapsed: true,\n });\n for (let i = 0; i < node.children.length - 1; i ++) {\n insertSummaryNode(node.children[i]);\n }\n }\n};\n\nexport function buildNestTree (layerKeys: string[], data: IRow[], collapsedKeyList: string[], showSummary: boolean): INestNode {\n const tree: INestNode = {\n key: ROOT_KEY,\n value: 'root',\n fieldKey: 'root',\n uniqueKey: ROOT_KEY,\n children: [],\n path: [],\n height: layerKeys.length,\n isCollapsed: false,\n };\n for (let row of data) {\n insertNode(tree, layerKeys, row, 0, collapsedKeyList);\n }\n if (showSummary) {\n insertSummaryNode(tree);\n }\n return tree;\n}\n\nclass NodeIterator {\n public tree: INestNode;\n public nodeStack: INestNode[] = [];\n public current: INestNode | null = null;\n constructor (tree: INestNode) {\n this.tree = tree;\n }\n public first () {\n let node = this.tree\n this.nodeStack = [node];\n while (node.children.length > 0 && !node.isCollapsed) {\n this.nodeStack.push(node.children[0])\n node = node.children[0]\n }\n this.current = node;\n return this.current;\n }\n public next (): INestNode | null {\n let cursorMoved = false;\n let counter = 0\n while (this.nodeStack.length > 1) {\n counter++\n if (counter > 100) break;\n let node = this.nodeStack[this.nodeStack.length - 1];\n let parent = this.nodeStack[this.nodeStack.length - 2];\n let nodeIndex = parent.children.findIndex(n => n.key === node!.key);\n if (nodeIndex === -1) break;\n // console.log(this.nodeStack.map(n => `${n.fieldKey}-${n.value}`))\n if (cursorMoved) {\n if (node.children.length > 0 && !node.isCollapsed) {\n this.nodeStack.push(node.children[0]);\n continue;\n } else {\n break;\n }\n } else {\n if (nodeIndex < parent.children.length - 1) {\n this.nodeStack.pop();\n this.nodeStack.push(parent.children[nodeIndex + 1])\n cursorMoved = true\n continue;\n }\n if (nodeIndex >= parent.children.length - 1) {\n this.nodeStack.pop();\n continue;\n }\n }\n }\n if (cursorMoved) {\n this.current = this.nodeStack[this.nodeStack.length - 1] || null;\n } else {\n this.current = null;\n }\n // console.log(this.current)\n return this.current;\n }\n public predicates (): { key: string; value: string | number }[] {\n return this.nodeStack.filter(node => node.key !== ROOT_KEY).map(node => ({\n key: node.fieldKey,\n value: node.value\n }))\n }\n}\n\nexport function buildMetricTableFromNestTree (leftTree: INestNode, topTree: INestNode, data: IRow[]): (IRow | null)[][] {\n const mat: any[][] = [];\n const iteLeft = new NodeIterator(leftTree);\n const iteTop = new NodeIterator(topTree);\n // console.log(iteLeft, iteTop)\n iteLeft.first();\n // return mat;\n while (iteLeft.current !== null) {\n const vec: any[] = [];\n iteTop.first();\n while (iteTop.current !== null) {\n const predicates = iteLeft.predicates().concat(iteTop.predicates()).filter((ele) => ele.value !== \"total\");\n const matchedRows = data.filter(r => predicates.every(pre => r[pre.key] === pre.value));\n if (matchedRows.length > 0) {\n // If multiple rows are matched, then find the most matched one (the row with smallest number of keys)\n vec.push(matchedRows.reduce((a, b) => Object.keys(a).length < Object.keys(b).length ? a : b));\n } else {\n vec.push(undefined);\n }\n iteTop.next();\n }\n mat.push(vec)\n iteLeft.next();\n }\n return mat;\n}\n\nexport function getAllChildrenSize (node: INestNode, depth: number): number {\n if (depth === 0) {\n return node.children.length;\n }\n return node.children.reduce((acc, child) => acc + getAllChildrenSize(child, depth + 1), 0)\n\n}","import { INestNode } from \"../components/pivotTable/inteface\";\nimport { buildMetricTableFromNestTree, buildNestTree } from \"../components/pivotTable/utils\"\nimport { IViewField, IRow } from \"../interfaces\"\n\nexport function buildPivotTable (\n dimsInRow: IViewField[], \n dimsInColumn: IViewField[], \n allData: IRow[], \n aggData: IRow[], \n collapsedKeyList: string[], \n showTableSummary: boolean\n): {lt: INestNode, tt: INestNode, metric: (IRow | null)[][]} {\n const lt = buildNestTree(\n dimsInRow.map((d) => d.fid),\n allData,\n collapsedKeyList,\n showTableSummary\n );\n const tt = buildNestTree(\n dimsInColumn.map((d) => d.fid),\n allData,\n collapsedKeyList,\n showTableSummary\n );\n const metric = buildMetricTableFromNestTree(lt, tt, [...allData, ...aggData])\n return {lt, tt, metric}\n}","/* eslint no-restricted-globals: 0 */\n/* eslint-disable */ \nimport { buildPivotTable } from \"./buildPivotTable\"\n/**\n * @param {import('../interfaces').IViewField[]} dimsInRow\n * @param {import('../interfaces').IViewField[]} dimsInColumn\n * @param {import('../interfaces').IRow[]} allData\n * @param {import('../interfaces').IRow} aggData\n * @param {string[]} collapsedKeyList\n * @param {boolean} showTableSummary\n * @return {{lt: import('../components/pivotTable/inteface').INestNode, tt: import('../components/pivotTable/inteface').INestNode, metric: import('../interfaces').(IRow | null)[][]}}\n */\n\n/**\n * @param {MessageEvent<{ dimsInRow: import('../interfaces').IViewField[]; dimsInColumn: import('../interfaces').IViewField[]; allData: import('../interfaces').IRow[]; aggData: import('../interfaces').IRow[]; collapsedKeyList: string[]; showTableSummary: boolean }>} e\n */\nconst main = e => {\n const { dimsInRow, dimsInColumn, allData, aggData, collapsedKeyList, showTableSummary } = e.data;\n try {\n const ans = buildPivotTable(dimsInRow, dimsInColumn, allData, aggData, collapsedKeyList, showTableSummary);\n self.postMessage(ans);\n } catch (error) {\n self.postMessage({ error: error.message });\n }\n};\n\nself.addEventListener('message', main, false);\n"],"names":["insertNode","tree","layerKeys","nodeData","depth","collapsedKeyList","key","uniqueKey","child","c","binarySearchIndex","arr","keyVal","start","end","middle","middleVal","ROOT_KEY","TOTAL_KEY","insertSummaryNode","node","i","buildNestTree","data","showSummary","row","NodeIterator","__publicField","cursorMoved","counter","parent","nodeIndex","n","buildMetricTableFromNestTree","leftTree","topTree","mat","iteLeft","iteTop","vec","predicates","ele","matchedRows","r","pre","a","b","buildPivotTable","dimsInRow","dimsInColumn","allData","aggData","showTableSummary","lt","d","tt","metric","main","e","ans","error"],"mappings":"iMAKA,SAASA,EAAYC,EAAiBC,EAAqBC,EAAgBC,EAAeC,EAA4B,CAC9G,GAAAD,GAASF,EAAU,OAEnB,OAEJ,MAAMI,EAAMH,EAASD,EAAUE,CAAK,CAAC,EAC/BG,EAAY,GAAGN,EAAK,cAAcK,IAOpC,IAAAE,EAAQP,EAAK,SAAS,KAAMQ,GAAMA,EAAE,MAAQH,CAAG,EAC9CE,IAIOA,EAAA,CACJ,IAAAF,EACA,MAAOA,EACP,UAAAC,EACA,SAAUL,EAAUE,CAAK,EACzB,SAAU,CAAC,EACX,KAAM,CAAC,GAAGH,EAAK,KAAM,CAAC,IAAKC,EAAUE,CAAK,EAAG,MAAOE,EAAI,EACxD,OAAQJ,EAAU,OAASE,EAAQ,EACnC,YAAa,EAAA,EAEbC,EAAiB,SAASJ,EAAK,SAAS,IACxCA,EAAK,YAAc,IAElBA,EAAA,SAAS,OAAOS,EAAkBT,EAAK,SAAUO,EAAM,GAAG,EAAG,EAAGA,CAAK,GAE9ER,EAAWQ,EAAON,EAAWC,EAAUC,EAAQ,EAAGC,CAAgB,CAEtE,CAGA,SAASK,EAAkBC,EAAkBC,EAAiC,CAC1E,IAAIC,EAAQ,EAAGC,EAAMH,EAAI,OAAS,EAElC,KAAOE,GAASC,GAAK,CACjB,IAAIC,EAAS,KAAK,OAAOF,EAAQC,GAAO,CAAC,EACrCE,EAAYL,EAAII,CAAM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,CAC5C,CACL,EAEA,KAAK,iBAAiB,UAAWH,EAAM,EAAK"}
@@ -1,11 +1,12 @@
1
1
  import React from 'react';
2
- import type { IMutField, DataSet } from '../../interfaces';
2
+ import type { IMutField, DataSet, IComputationFunction } from '../../interfaces';
3
3
  interface DataTableProps {
4
4
  /** page limit */
5
5
  size?: number;
6
6
  /** total count of rows */
7
7
  total: number;
8
8
  dataset: DataSet;
9
+ computation?: IComputationFunction;
9
10
  onMetaChange: (fid: string, fIndex: number, meta: Partial<IMutField>) => void;
10
11
  loading?: boolean;
11
12
  }
@@ -0,0 +1,21 @@
1
+ import React from "react";
2
+ import type { DeepReadonly, IRow, IViewField, VegaGlobalConfig } from "../../interfaces";
3
+ import type { FeatureCollection } from "geojson";
4
+ export interface IChoroplethRendererProps {
5
+ data: IRow[];
6
+ allFields: DeepReadonly<IViewField[]>;
7
+ features: FeatureCollection | undefined;
8
+ geoKey: string;
9
+ defaultAggregated: boolean;
10
+ geoId: DeepReadonly<IViewField>;
11
+ color: DeepReadonly<IViewField> | undefined;
12
+ opacity: DeepReadonly<IViewField> | undefined;
13
+ text: DeepReadonly<IViewField> | undefined;
14
+ details: readonly DeepReadonly<IViewField>[];
15
+ vegaConfig: VegaGlobalConfig;
16
+ scaleIncludeUnmatchedChoropleth: boolean;
17
+ }
18
+ export interface IChoroplethRendererRef {
19
+ }
20
+ declare const ChoroplethRenderer: React.ForwardRefExoticComponent<IChoroplethRendererProps & React.RefAttributes<IChoroplethRendererRef>>;
21
+ export default ChoroplethRenderer;
@@ -0,0 +1,19 @@
1
+ import React from "react";
2
+ import type { DeepReadonly, IRow, IViewField, VegaGlobalConfig } from "../../interfaces";
3
+ export interface IPOIRendererProps {
4
+ data: IRow[];
5
+ allFields: DeepReadonly<IViewField[]>;
6
+ defaultAggregated: boolean;
7
+ latitude: DeepReadonly<IViewField> | undefined;
8
+ longitude: DeepReadonly<IViewField> | undefined;
9
+ color: DeepReadonly<IViewField> | undefined;
10
+ opacity: DeepReadonly<IViewField> | undefined;
11
+ size: DeepReadonly<IViewField> | undefined;
12
+ details: readonly DeepReadonly<IViewField>[];
13
+ vegaConfig: VegaGlobalConfig;
14
+ }
15
+ export interface IPOIRendererRef {
16
+ }
17
+ export declare const isValidLatLng: (latRaw: unknown, lngRaw: unknown) => boolean;
18
+ declare const POIRenderer: React.ForwardRefExoticComponent<IPOIRendererProps & React.RefAttributes<IPOIRendererRef>>;
19
+ export default POIRenderer;
@@ -0,0 +1,7 @@
1
+ import type { IRow, IViewField, VegaGlobalConfig } from "../../interfaces";
2
+ export interface Scale<T> {
3
+ (record: IRow): T;
4
+ }
5
+ export declare const useColorScale: (data: IRow[], field: IViewField | null | undefined, defaultAggregate: boolean, vegaConfig: VegaGlobalConfig) => Scale<string>;
6
+ export declare const useSizeScale: (data: IRow[], field: IViewField | null | undefined, defaultAggregate: boolean) => Scale<number>;
7
+ export declare const useOpacityScale: (data: IRow[], field: IViewField | null | undefined, defaultAggregate: boolean) => Scale<number>;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const _default: React.FunctionComponent<{}>;
3
+ export default _default;
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ import type { DeepReadonly, DraggableFieldState, IRow, IVisualConfig, VegaGlobalConfig } from "../../interfaces";
3
+ export interface ILeafletRendererProps {
4
+ vegaConfig?: VegaGlobalConfig;
5
+ draggableFieldState: DeepReadonly<DraggableFieldState>;
6
+ visualConfig: DeepReadonly<IVisualConfig>;
7
+ data: IRow[];
8
+ }
9
+ export interface ILeafletRendererRef {
10
+ }
11
+ export declare const LEAFLET_DEFAULT_WIDTH = 800;
12
+ export declare const LEAFLET_DEFAULT_HEIGHT = 600;
13
+ declare const LeafletRenderer: React.ForwardRefExoticComponent<ILeafletRendererProps & React.RefAttributes<ILeafletRendererRef>>;
14
+ export default LeafletRenderer;
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import type { DeepReadonly, IViewField, VegaGlobalConfig } from "../../interfaces";
3
+ export interface ITooltipContentProps {
4
+ allFields: readonly DeepReadonly<IViewField>[];
5
+ vegaConfig: VegaGlobalConfig;
6
+ field: DeepReadonly<IViewField>;
7
+ value: unknown;
8
+ }
9
+ export declare const TooltipContent: React.NamedExoticComponent<ITooltipContentProps>;
@@ -0,0 +1,2 @@
1
+ import type { ISemanticType, VegaGlobalConfig } from "../../interfaces";
2
+ export declare const useDisplayValueFormatter: (semanticType: ISemanticType, vegaConfig: VegaGlobalConfig) => (value: unknown) => string;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { DeepReadonly, DraggableFieldState, IDarkMode, IRow, IThemeKey, IVisualConfig } from '../../interfaces';
2
+ import { DeepReadonly, DraggableFieldState, IComputationFunction, IDarkMode, IRow, IThemeKey, IVisualConfig } from '../../interfaces';
3
3
  interface PivotTableProps {
4
4
  themeKey?: IThemeKey;
5
5
  dark?: IDarkMode;
@@ -7,6 +7,7 @@ interface PivotTableProps {
7
7
  loading: boolean;
8
8
  draggableFieldState: DeepReadonly<DraggableFieldState>;
9
9
  visualConfig: DeepReadonly<IVisualConfig>;
10
+ computationFunction: IComputationFunction;
10
11
  }
11
12
  declare const PivotTable: React.FC<PivotTableProps>;
12
13
  export default PivotTable;
@@ -1,6 +1,10 @@
1
1
  export interface INestNode {
2
- key: string;
3
- value: string;
2
+ key: string | number;
3
+ value: string | number;
4
+ uniqueKey: string;
4
5
  fieldKey: string;
5
6
  children: INestNode[];
7
+ height: number;
8
+ isCollapsed: boolean;
9
+ path: Record<INestNode["fieldKey"], INestNode["value"]>[];
6
10
  }
@@ -5,6 +5,7 @@ export interface TreeProps {
5
5
  data: INestNode;
6
6
  dimsInRow: IField[];
7
7
  measInRow: IField[];
8
+ onHeaderCollapse: (node: INestNode) => void;
8
9
  }
9
10
  declare const LeftTree: React.FC<TreeProps>;
10
11
  export default LeftTree;
@@ -5,6 +5,8 @@ export interface TreeProps {
5
5
  data: INestNode;
6
6
  dimsInCol: IField[];
7
7
  measInCol: IField[];
8
+ onHeaderCollapse: (node: INestNode) => void;
9
+ onTopTreeHeaderRowNumChange: (num: number) => void;
8
10
  }
9
11
  declare const TopTree: React.FC<TreeProps>;
10
12
  export default TopTree;
@@ -1,6 +1,5 @@
1
1
  import { IRow } from "../../interfaces";
2
2
  import { INestNode } from "./inteface";
3
- export declare function insertNode(tree: INestNode, layerKeys: string[], nodeData: IRow, depth: number): void;
4
- export declare function buildNestTree(layerKeys: string[], data: IRow[]): INestNode;
3
+ export declare function buildNestTree(layerKeys: string[], data: IRow[], collapsedKeyList: string[], showSummary: boolean): INestNode;
5
4
  export declare function buildMetricTableFromNestTree(leftTree: INestNode, topTree: INestNode, data: IRow[]): (IRow | null)[][];
6
5
  export declare function getAllChildrenSize(node: INestNode, depth: number): number;
package/dist/config.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { DraggableFieldState, IStackMode, IVisualConfig } from "./interfaces";
2
- export declare const GEMO_TYPES: Readonly<string[]>;
1
+ import { DraggableFieldState, ICoordMode, IStackMode, IVisualConfig } from "./interfaces";
2
+ export declare const GEMO_TYPES: Record<ICoordMode, Readonly<string[]>>;
3
+ export declare const COORD_TYPES: Readonly<ICoordMode[]>;
3
4
  export declare const STACK_MODE: Readonly<IStackMode[]>;
4
5
  export declare const CHART_LAYOUT_TYPE: Readonly<string[]>;
5
6
  export declare const COLORS: {