Skip to content

Commit

Permalink
feat: add PivotTableSample
Browse files Browse the repository at this point in the history
  • Loading branch information
Rui-Sun committed Jul 1, 2024
1 parent e68228f commit 9b2cb35
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 40 deletions.
2 changes: 1 addition & 1 deletion packages/vtable/__tests__/edit/pivotTable.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// @ts-nocheck
// 有问题可对照demo unitTestPivotTable
import records from '../data/marketsales.json';
import { PivotTable } from '../../src/PivotTable';
import { PivotTable } from '../../src';
import { register } from '../../src';
import { InputEditor } from '@visactor/vtable-editors';
import { createDiv } from '../dom';
Expand Down
2 changes: 1 addition & 1 deletion packages/vtable/__tests__/pivotTable-analysis.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-nocheck
// 有问题可对照demo unitTestPivotTable
import records from './data/marketsales.json';
import { PivotTable } from '../src/PivotTable';
import { PivotTable } from '../src';
import * as VTable from '../src/index';
import { createDiv } from './dom';
global.__VERSION__ = 'none';
Expand Down
2 changes: 1 addition & 1 deletion packages/vtable/__tests__/pivotTable-tree.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// @ts-nocheck
// 有问题可对照demo unitTestPivotTable
import records from './data/North_American_Superstore_pivot_extension_rows.json';
import { PivotTable } from '../src/PivotTable';
import { PivotTable } from '../src';
import { createDiv } from './dom';
global.__VERSION__ = 'none';
describe('pivotTableTree init test', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/vtable/__tests__/pivotTable.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// @ts-nocheck
// 有问题可对照demo unitTestPivotTable
import records from './data/marketsales.json';
import { PivotTable } from '../src/PivotTable';
import { PivotTable } from '../src';
import { createDiv } from './dom';
global.__VERSION__ = 'none';
describe('pivotTable init test', () => {
Expand Down
3 changes: 2 additions & 1 deletion packages/vtable/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"sideEffects": [
"./src/ListTable-all.js",
"./src/ListTable-simple.js",
"./src/PivotTable.js",
"./src/PivotTable-all.js",
"./src/PivotTable-simple.js",
"./src/PivotChart.js",
"./src/index.js",
"./src/scenegraph/scenegraph.js"
Expand Down
37 changes: 37 additions & 0 deletions packages/vtable/src/PivotTable-all.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { PivotTable } from './PivotTable';
import {
registerAxis,
registerEmptyTip,
registerLegend,
registerMenu,
registerTitle,
registerTooltip
} from './components';
import {
registerChartCell,
registerCheckboxCell,
registerImageCell,
registerProgressBarCell,
registerRadioCell,
registerSparkLineCell,
registerTextCell,
registerVideoCell
} from './scenegraph/group-creater/cell-type';

registerAxis();
registerEmptyTip();
registerLegend();
registerMenu();
registerTitle();
registerTooltip();

registerChartCell();
registerCheckboxCell();
registerImageCell();
registerProgressBarCell();
registerRadioCell();
registerSparkLineCell();
registerTextCell();
registerVideoCell();

export class PivotTableAll extends PivotTable {}
6 changes: 6 additions & 0 deletions packages/vtable/src/PivotTable-simple.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { PivotTable } from './PivotTable';
import { registerTextCell } from './scenegraph/group-creater/cell-type';

registerTextCell();

export class PivotTableSimple extends PivotTable {}
34 changes: 0 additions & 34 deletions packages/vtable/src/PivotTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,40 +45,6 @@ import { cloneDeepSpec } from '@visactor/vutils-extension';
import { parseColKeyRowKeyForPivotTable, supplementIndicatorNodesForCustomTree } from './layout/layout-helper';
import type { IEmptyTipComponent } from './components/empty-tip/empty-tip';
import { Factory } from './core/factory';
import {
registerAxis,
registerEmptyTip,
registerLegend,
registerMenu,
registerTitle,
registerTooltip
} from './components';
import {
registerChartCell,
registerCheckboxCell,
registerImageCell,
registerProgressBarCell,
registerRadioCell,
registerSparkLineCell,
registerTextCell,
registerVideoCell
} from './scenegraph/group-creater/cell-type';

registerAxis();
registerEmptyTip();
registerLegend();
registerMenu();
registerTitle();
registerTooltip();

registerChartCell();
registerCheckboxCell();
registerImageCell();
registerProgressBarCell();
registerRadioCell();
registerSparkLineCell();
registerTextCell();
registerVideoCell();

export class PivotTable extends BaseTable implements PivotTableAPI {
layoutNodeId: { seqId: number } = { seqId: 0 };
Expand Down
5 changes: 4 additions & 1 deletion packages/vtable/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ import type {
} from './ts-types';
import { ListTableAll as ListTable } from './ListTable-all';
import { ListTableSimple } from './ListTable-simple';
import { PivotTable } from './PivotTable';
// import { PivotTable } from './PivotTable';
import { PivotTableAll as PivotTable } from './PivotTable-all';
import { PivotTableSimple } from './PivotTable-simple';
import { PivotChart } from './PivotChart';
import type { MousePointerCellEvent } from './ts-types/events';
import * as CustomLayout from './render/layout';
Expand Down Expand Up @@ -65,6 +67,7 @@ export {
ListTableSimple,
ListTableConstructorOptions,
PivotTable,
PivotTableSimple,
PivotTableConstructorOptions,
PivotChartConstructorOptions,
PivotChart,
Expand Down

0 comments on commit 9b2cb35

Please sign in to comment.