@visactor/vtable 1.3.0 → 1.3.1-alpha.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/cjs/PivotTable.js +17 -11
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/components/empty-tip/empty-tip.js +2 -2
- package/cjs/components/empty-tip/empty-tip.js.map +1 -1
- package/cjs/core/BaseTable.js +1 -1
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/dataset/dataset.d.ts +2 -0
- package/cjs/dataset/dataset.js +8 -7
- package/cjs/dataset/dataset.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +2 -2
- package/cjs/index.js.map +1 -1
- package/cjs/layout/pivot-header-layout.js +17 -13
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.js +2 -2
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/cjs/scenegraph/layout/frozen.js +12 -4
- package/cjs/scenegraph/layout/frozen.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +111 -23
- package/dist/vtable.min.js +2 -2
- package/es/PivotTable.js +17 -11
- package/es/PivotTable.js.map +1 -1
- package/es/components/empty-tip/empty-tip.js +2 -2
- package/es/components/empty-tip/empty-tip.js.map +1 -1
- package/es/core/BaseTable.js +1 -1
- package/es/core/BaseTable.js.map +1 -1
- package/es/dataset/dataset.d.ts +2 -0
- package/es/dataset/dataset.js +8 -7
- package/es/dataset/dataset.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/layout/pivot-header-layout.js +17 -13
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/scenegraph/group-creater/cell-helper.js +2 -2
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/es/scenegraph/layout/frozen.js +12 -4
- package/es/scenegraph/layout/frozen.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +5 -5
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,uCAA4D;AA8F1D,4FA9FO,qBAAW,OA8FP;AA7Fb,IAAA,4BAAkB,GAAE,CAAC;AAErB,kDAAoC;AAqDlC,sBAAK;AApDP,6CAA+B;AAqD7B,oBAAI;AApDN,6CAA+B;AA4E7B,oBAAI;AA3EN,+CAAiC;AACjC,qDAAuC;AA+ErC,4BAAQ;AA9EV,iDAAmC;AAwEjC,wBAAM;AAvER,yEAA2D;AAiFzD,wCAAc;AA3DhB,2CAAwC;AA2BtC,0FA3BO,qBAAS,OA2BP;AA1BX,6CAA0C;AA4BxC,2FA5BO,uBAAU,OA4BP;AA3BZ,6CAA0C;AA8BxC,2FA9BO,uBAAU,OA8BP;AA5BZ,8DAAgD;AAwD9C,oCAAY;AAtDd,wEAAoE;AAuDlE,2FAvDO,wBAAU,OAuDP;AAtDZ,gGAAqF;AAuDnF,4FAvDO,iCAAW,OAuDP;AAtDb,kEAA+F;AAyD7F,mGAzDO,iCAAkB,OAyDP;AADlB,yGAxD2B,uCAAwB,OAwD3B;AAnD1B,uDAAwD;AAA/C,gHAAA,eAAe,OAAA;AACxB,+CAA6B;AAEhB,QAAA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,uCAA4D;AA8F1D,4FA9FO,qBAAW,OA8FP;AA7Fb,IAAA,4BAAkB,GAAE,CAAC;AAErB,kDAAoC;AAqDlC,sBAAK;AApDP,6CAA+B;AAqD7B,oBAAI;AApDN,6CAA+B;AA4E7B,oBAAI;AA3EN,+CAAiC;AACjC,qDAAuC;AA+ErC,4BAAQ;AA9EV,iDAAmC;AAwEjC,wBAAM;AAvER,yEAA2D;AAiFzD,wCAAc;AA3DhB,2CAAwC;AA2BtC,0FA3BO,qBAAS,OA2BP;AA1BX,6CAA0C;AA4BxC,2FA5BO,uBAAU,OA4BP;AA3BZ,6CAA0C;AA8BxC,2FA9BO,uBAAU,OA8BP;AA5BZ,8DAAgD;AAwD9C,oCAAY;AAtDd,wEAAoE;AAuDlE,2FAvDO,wBAAU,OAuDP;AAtDZ,gGAAqF;AAuDnF,4FAvDO,iCAAW,OAuDP;AAtDb,kEAA+F;AAyD7F,mGAzDO,iCAAkB,OAyDP;AADlB,yGAxD2B,uCAAwB,OAwD3B;AAnD1B,uDAAwD;AAA/C,gHAAA,eAAe,OAAA;AACxB,+CAA6B;AAEhB,QAAA,OAAO,GAAG,eAAe,CAAC;AAqDvC,SAAS,QAAQ;IAGf,OAAO,KAAK,CAAC,GAAG,EAAE,CAAC;AACrB,CAAC;AArBC,4BAAQ;AAuBV,SAAS,WAAW;IAClB,QAAQ,CAAC,QAAQ,EAAE,CAAC;AAGtB,CAAC;AA1BC,kCAAW;AA2Bb,KAAK,CAAC,eAAe,CAAC","file":"index.js","sourcesContent":["/* eslint-disable sort-imports */\nimport { graphicUtil, registerForVrender } from './vrender';\nregisterForVrender();\n\nimport * as TYPES from './ts-types';\nimport * as core from './core';\nimport * as data from './data';\nimport * as icons from './icons';\nimport * as register from './register';\nimport * as themes from './themes';\nimport * as DataStatistics from './dataset/DataStatistics';\nimport type {\n ColumnDefine,\n ColumnsDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n ListTableConstructorOptions,\n PivotTableConstructorOptions,\n PivotChartConstructorOptions,\n IHeaderTreeDefine,\n IDimension,\n IIndicator,\n ITitleDefine,\n ICornerDefine,\n TextAlignType,\n TextBaselineType\n} from './ts-types';\nimport { ListTable } from './ListTable';\nimport { PivotTable } from './PivotTable';\nimport { PivotChart } from './PivotChart';\nimport type { MousePointerCellEvent } from './ts-types/events';\nimport * as CustomLayout from './render/layout';\n\nimport { updateCell } from './scenegraph/group-creater/cell-helper';\nimport { renderChart } from './scenegraph/graphic/contributions/chart-render-helper';\nimport { restoreMeasureText, setCustomAlphabetCharSet } from './scenegraph/utils/text-measure';\n\n// import { container, loadCanvasPicker } from '@src/vrender';\n// loadCanvasPicker(container);\n\nexport { getDataCellPath } from './tools/get-data-path';\nexport * from './render/jsx';\n\nexport const version = \"1.3.1-alpha.0\";\n/**\n * @namespace VTable\n */\nexport {\n /**\n * Types\n * @namespace VTable.TYPES\n */\n TYPES,\n core,\n ListTable,\n ListTableConstructorOptions,\n PivotTable,\n PivotTableConstructorOptions,\n PivotChartConstructorOptions,\n PivotChart,\n IHeaderTreeDefine,\n IDimension,\n IIndicator,\n ITitleDefine,\n ICornerDefine,\n ColumnsDefine,\n ColumnDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n TextAlignType,\n TextBaselineType,\n themes,\n data,\n MousePointerCellEvent,\n getIcons,\n clearGlobal,\n //plugin registers\n register,\n /**\n * 暂不推荐使用\n */\n DataStatistics,\n CustomLayout,\n updateCell,\n renderChart,\n graphicUtil,\n setCustomAlphabetCharSet,\n restoreMeasureText\n};\n\n/** @private */\nfunction getIcons(): {\n [key: string]: TYPES.ColumnIconOption;\n} {\n return icons.get();\n}\n/** 清理内部的全局变量 如注册的icon theme等 以及共享的header column类实例 */\nfunction clearGlobal() {\n register.clearAll();\n // headers.type.clearGlobal();\n // columns.type.clearGlobal();\n}\nTYPES.AggregationType;\n"]}
|
|
@@ -11,7 +11,7 @@ const util_1 = require("../tools/util"), ts_types_1 = require("../ts-types"), gl
|
|
|
11
11
|
|
|
12
12
|
class PivotHeaderLayoutMap {
|
|
13
13
|
constructor(table, dataset, columnDimensionTree, rowDimensionTree) {
|
|
14
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
14
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
15
15
|
if (this.colIndex = 0, this._showHeader = !0, this.columnHeaderObjs = [], this.rowHeaderObjs = [],
|
|
16
16
|
this._cornerHeaderCellFullPathIds = [], this._columnHeaderCellFullPathIds = [],
|
|
17
17
|
this._rowHeaderCellFullPathIds = [], this._rowHeaderCellFullPathIds_FULL = [], this._cornerHeaderCellIds = [],
|
|
@@ -63,9 +63,10 @@ class PivotHeaderLayoutMap {
|
|
|
63
63
|
})), this._extensionRowDimensionKeys.push(rowKeys), this.fullRowDimensionKeys = this.fullRowDimensionKeys.concat(rowKeys);
|
|
64
64
|
}))), this.sharedVar.seqId = Math.max(this.sharedVar.seqId, this._headerObjects.length),
|
|
65
65
|
"column" === this.cornerSetting.titleOnDimension) {
|
|
66
|
-
|
|
66
|
+
let colDimensionKeys = this.columnDimensionTree.dimensionKeysIncludeVirtual.valueArr();
|
|
67
|
+
0 !== (null !== (_q = null === (_p = this.dataset.records) || void 0 === _p ? void 0 : _p.length) && void 0 !== _q ? _q : 0) || this.dataset.customColTree || this.dataset.customRowTree || (colDimensionKeys = this.columnsDefine.map((define => "string" == typeof define ? define : define.dimensionKey))),
|
|
67
68
|
this.cornerHeaderObjs = this._addCornerHeaders(this.columnHeaderTitle ? [ "" ].concat(colDimensionKeys) : colDimensionKeys, this.columnsDefine);
|
|
68
|
-
} else if ("row" === this.cornerSetting.titleOnDimension) if ("tree" === this.rowHierarchyType && (null === (
|
|
69
|
+
} else if ("row" === this.cornerSetting.titleOnDimension) if ("tree" === this.rowHierarchyType && (null === (_r = this.extensionRows) || void 0 === _r ? void 0 : _r.length) >= 1) {
|
|
69
70
|
const rowTreeFirstKey = [];
|
|
70
71
|
rowTreeFirstKey.push(this.rowDimensionKeys[0]), this._extensionRowDimensionKeys.forEach((extensionRowKeys => {
|
|
71
72
|
rowTreeFirstKey.push(extensionRowKeys[0]);
|
|
@@ -73,7 +74,8 @@ class PivotHeaderLayoutMap {
|
|
|
73
74
|
const extensionRowDimensions = this.extensionRows.reduce(((dimensions, cur) => dimensions.concat(cur.rows)), []);
|
|
74
75
|
this.cornerHeaderObjs = this._addCornerHeaders(this.rowHeaderTitle ? [ "" ].concat(rowTreeFirstKey) : rowTreeFirstKey, this.rowsDefine.concat(extensionRowDimensions));
|
|
75
76
|
} else {
|
|
76
|
-
|
|
77
|
+
let rowDimensionKeys = this.rowDimensionTree.dimensionKeysIncludeVirtual.valueArr();
|
|
78
|
+
0 !== (null !== (_t = null === (_s = this.dataset.records) || void 0 === _s ? void 0 : _s.length) && void 0 !== _t ? _t : 0) || this.dataset.customColTree || this.dataset.customRowTree || (rowDimensionKeys = this.rowsDefine.map((define => "string" == typeof define ? define : define.dimensionKey))),
|
|
77
79
|
this.cornerHeaderObjs = this._addCornerHeaders(this.rowHeaderTitle ? [ "" ].concat(rowDimensionKeys) : rowDimensionKeys, this.rowsDefine);
|
|
78
80
|
} else this.cornerHeaderObjs = this._addCornerHeaders(null, void 0);
|
|
79
81
|
this.colIndex = 0, this._headerObjectMap = this._headerObjects.reduce(((o, e) => (o[e.id] = e,
|
|
@@ -475,18 +477,19 @@ class PivotHeaderLayoutMap {
|
|
|
475
477
|
return this.columnHeaderLevelCount;
|
|
476
478
|
}
|
|
477
479
|
resetColumnHeaderLevelCount() {
|
|
478
|
-
var _a, _b, _c, _d;
|
|
480
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
479
481
|
if (this.showHeader && this.showColumnHeader) {
|
|
480
482
|
if (this._table.isPivotChart() && this.indicatorsAsCol && !(null === (_b = null === (_a = this.dataset) || void 0 === _a ? void 0 : _a.colKeys) || void 0 === _b ? void 0 : _b.length) && 0 === (null === (_d = null === (_c = this.columnDimensionTree) || void 0 === _c ? void 0 : _c.tree) || void 0 === _d ? void 0 : _d.level) && !this.hasTwoIndicatorAxes) return void (this.columnHeaderLevelCount = 0);
|
|
481
483
|
let count = this.indicatorsAsCol && this.hideIndicatorName && this.colDimensionKeys[this.colDimensionKeys.length - 1] === this.indicatorDimensionKey ? this.columnDimensionTree.totalLevel - 1 : this.columnDimensionTree.totalLevel;
|
|
482
|
-
return this.
|
|
484
|
+
return 0 !== count || this.dataset.customColTree || this.dataset.customRowTree ? 0 !== (null !== (_j = null === (_h = this.dataset.records) || void 0 === _h ? void 0 : _h.length) && void 0 !== _j ? _j : 0) || this.dataset.customColTree || this.dataset.customRowTree || (count = this.columnsDefine.length) : "row" === this.cornerSetting.titleOnDimension ? count = 1 : 0 === (null !== (_f = null === (_e = this.dataset.records) || void 0 === _e ? void 0 : _e.length) && void 0 !== _f ? _f : 0) && "column" === this.cornerSetting.titleOnDimension && (count = null !== (_g = this.columnsDefine.length) && void 0 !== _g ? _g : 0),
|
|
485
|
+
this.columnHeaderTitle && (count += 1), this._table.isPivotChart() && this.indicatorsAsCol && !this.hasTwoIndicatorAxes && (0,
|
|
483
486
|
get_chart_spec_1.checkHasCartesianChart)(this.indicatorsDefine) && (count -= 1),
|
|
484
487
|
void (this.columnHeaderLevelCount = count);
|
|
485
488
|
}
|
|
486
489
|
this.columnHeaderLevelCount = this.indicatorsAsCol ? this.hideIndicatorName ? 0 : 1 : 0;
|
|
487
490
|
}
|
|
488
491
|
resetRowHeaderLevelCount() {
|
|
489
|
-
var _a, _b;
|
|
492
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
490
493
|
if (this.showHeader && this.showRowHeader) {
|
|
491
494
|
if ("tree" === this.rowHierarchyType) {
|
|
492
495
|
const extensionRowCount = null !== (_b = null === (_a = this.extensionRows) || void 0 === _a ? void 0 : _a.length) && void 0 !== _b ? _b : 0;
|
|
@@ -495,6 +498,7 @@ class PivotHeaderLayoutMap {
|
|
|
495
498
|
const rowLevelCount = this.rowDimensionTree.totalLevel;
|
|
496
499
|
let count = rowLevelCount;
|
|
497
500
|
return this.indicatorsAsCol || this.hideIndicatorName && this.rowDimensionKeys[this.rowDimensionKeys.length - 1] === this.indicatorDimensionKey && (count = rowLevelCount - 1),
|
|
501
|
+
0 !== count || this.dataset.customColTree || this.dataset.customRowTree ? 0 !== (null !== (_g = null === (_f = this.dataset.records) || void 0 === _f ? void 0 : _f.length) && void 0 !== _g ? _g : 0) || this.dataset.customColTree || this.dataset.customRowTree || (count = this.rowsDefine.length) : "column" === this.cornerSetting.titleOnDimension ? count = 1 : 0 === (null !== (_d = null === (_c = this.dataset.records) || void 0 === _c ? void 0 : _c.length) && void 0 !== _d ? _d : 0) && "row" === this.cornerSetting.titleOnDimension && (count = null !== (_e = this.rowsDefine.length) && void 0 !== _e ? _e : 0),
|
|
498
502
|
this.rowHeaderTitle && (count += 1), void (this.rowHeaderLevelCount = count);
|
|
499
503
|
}
|
|
500
504
|
this.rowHeaderLevelCount = this.indicatorsAsCol || this.hideIndicatorName ? 0 : 1;
|
|
@@ -549,14 +553,14 @@ class PivotHeaderLayoutMap {
|
|
|
549
553
|
return this._indicators;
|
|
550
554
|
}
|
|
551
555
|
getCellId(col, row) {
|
|
552
|
-
var _a, _b;
|
|
556
|
+
var _a, _b, _c, _d, _e;
|
|
553
557
|
if (row >= 0 && col >= 0) {
|
|
554
558
|
if (this.isSeriesNumber(col, row)) return "";
|
|
555
|
-
if (this.isCornerHeader(col, row)) return this._cornerHeaderCellIds[row][col - this.leftRowSeriesNumberColumnCount];
|
|
556
|
-
if (this.isColumnHeader(col, row)) return this._columnHeaderCellIds[row][col - this.rowHeaderLevelCount - this.leftRowSeriesNumberColumnCount];
|
|
557
|
-
if (this.isRowHeader(col, row)) return null === (
|
|
558
|
-
if (this.isRightFrozenColumn(col, row)) return this._rowHeaderCellIds[row - this.columnHeaderLevelCount][this.rowHeaderLevelCount - 1];
|
|
559
|
-
if (this.isBottomFrozenRow(col, row)) return null === (
|
|
559
|
+
if (this.isCornerHeader(col, row)) return null === (_a = this._cornerHeaderCellIds[row]) || void 0 === _a ? void 0 : _a[col - this.leftRowSeriesNumberColumnCount];
|
|
560
|
+
if (this.isColumnHeader(col, row)) return null === (_b = this._columnHeaderCellIds[row]) || void 0 === _b ? void 0 : _b[col - this.rowHeaderLevelCount - this.leftRowSeriesNumberColumnCount];
|
|
561
|
+
if (this.isRowHeader(col, row)) return null === (_c = this._rowHeaderCellIds[row - this.columnHeaderLevelCount]) || void 0 === _c ? void 0 : _c[col - this.leftRowSeriesNumberColumnCount];
|
|
562
|
+
if (this.isRightFrozenColumn(col, row)) return null === (_d = this._rowHeaderCellIds[row - this.columnHeaderLevelCount]) || void 0 === _d ? void 0 : _d[this.rowHeaderLevelCount - 1];
|
|
563
|
+
if (this.isBottomFrozenRow(col, row)) return null === (_e = this._columnHeaderCellIds[this.columnHeaderLevelCount - 1]) || void 0 === _e ? void 0 : _e[col - this.rowHeaderLevelCount - this.leftRowSeriesNumberColumnCount];
|
|
560
564
|
}
|
|
561
565
|
}
|
|
562
566
|
getHeader(col, row) {
|