@visactor/vtable 0.10.2 → 0.10.3-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/PivotChart.js +26 -25
- package/cjs/PivotChart.js.map +1 -1
- package/cjs/PivotTable.js +8 -8
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/core/BaseTable.js +1 -1
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/dataset/dataset-pivot-table.js.map +1 -1
- package/cjs/dataset/dataset.js +4 -5
- package/cjs/dataset/dataset.js.map +1 -1
- package/cjs/dataset/flatDataToObject.js +2 -1
- package/cjs/dataset/flatDataToObject.js.map +1 -1
- package/cjs/header-helper/header-helper.js +1 -0
- package/cjs/header-helper/header-helper.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/layout/chart-helper/get-axis-config.js +7 -7
- package/cjs/layout/chart-helper/get-axis-config.js.map +1 -1
- package/cjs/layout/chart-helper/get-chart-spec.js +4 -4
- package/cjs/layout/chart-helper/get-chart-spec.js.map +1 -1
- package/cjs/layout/pivot-header-layout.js +21 -19
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/layout/pivot-layout.js +4 -3
- package/cjs/layout/pivot-layout.js.map +1 -1
- package/cjs/scenegraph/layout/frozen.js +18 -4
- package/cjs/scenegraph/layout/frozen.js.map +1 -1
- package/cjs/state/spark-line/index.js +3 -2
- package/cjs/state/spark-line/index.js.map +1 -1
- package/dist/vtable.js +103 -71
- package/dist/vtable.min.js +1 -1
- package/es/PivotChart.js +26 -25
- package/es/PivotChart.js.map +1 -1
- package/es/PivotTable.js +8 -8
- package/es/PivotTable.js.map +1 -1
- package/es/core/BaseTable.js +1 -1
- package/es/core/BaseTable.js.map +1 -1
- package/es/dataset/dataset-pivot-table.js.map +1 -1
- package/es/dataset/dataset.js +4 -4
- package/es/dataset/dataset.js.map +1 -1
- package/es/dataset/flatDataToObject.js +2 -1
- package/es/dataset/flatDataToObject.js.map +1 -1
- package/es/header-helper/header-helper.js +1 -0
- package/es/header-helper/header-helper.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/chart-helper/get-axis-config.js +7 -7
- package/es/layout/chart-helper/get-axis-config.js.map +1 -1
- package/es/layout/chart-helper/get-chart-spec.js +4 -4
- package/es/layout/chart-helper/get-chart-spec.js.map +1 -1
- package/es/layout/pivot-header-layout.js +21 -19
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/layout/pivot-layout.js +4 -3
- package/es/layout/pivot-layout.js.map +1 -1
- package/es/scenegraph/layout/frozen.js +18 -4
- package/es/scenegraph/layout/frozen.js.map +1 -1
- package/es/state/spark-line/index.js +3 -2
- package/es/state/spark-line/index.js.map +1 -1
- package/package.json +1 -1
package/cjs/index.js
CHANGED
|
@@ -91,6 +91,6 @@ function clearGlobal() {
|
|
|
91
91
|
register.clearAll();
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
exports.CustomLayout = CustomLayout, exports.version = "0.10.
|
|
94
|
+
exports.CustomLayout = CustomLayout, exports.version = "0.10.3-alpha.0", exports.getIcons = getIcons,
|
|
95
95
|
exports.clearGlobal = clearGlobal, TYPES.AggregationType;
|
|
96
96
|
//# sourceMappingURL=index.js.map
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,8CAA4C;AAC5C,kDAAoC;AAqClC,sBAAK;AApCP,6CAA+B;AAqC7B,oBAAI;AApCN,6CAA+B;AAuD7B,oBAAI;AAtDN,+CAAiC;AACjC,qDAAuC;AA0DrC,4BAAQ;AAzDV,iDAAmC;AAmDjC,wBAAM;AAlDR,yEAA2D;AA4DzD,wCAAc;AA3ChB,2CAAwC;AAgBtC,0FAhBO,qBAAS,OAgBP;AAfX,6CAA0C;AAiBxC,2FAjBO,uBAAU,OAiBP;AAhBZ,6CAA0C;AAmBxC,2FAnBO,uBAAU,OAmBP;AAjBZ,8DAAgD;AAwC9C,oCAAY;AAvCD,QAAA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,8CAA4C;AAC5C,kDAAoC;AAqClC,sBAAK;AApCP,6CAA+B;AAqC7B,oBAAI;AApCN,6CAA+B;AAuD7B,oBAAI;AAtDN,+CAAiC;AACjC,qDAAuC;AA0DrC,4BAAQ;AAzDV,iDAAmC;AAmDjC,wBAAM;AAlDR,yEAA2D;AA4DzD,wCAAc;AA3ChB,2CAAwC;AAgBtC,0FAhBO,qBAAS,OAgBP;AAfX,6CAA0C;AAiBxC,2FAjBO,uBAAU,OAiBP;AAhBZ,6CAA0C;AAmBxC,2FAnBO,uBAAU,OAmBP;AAjBZ,8DAAgD;AAwC9C,oCAAY;AAvCD,QAAA,OAAO,GAAG,gBAAgB,CAAC;AA2CxC,SAAS,QAAQ;IAGf,OAAO,KAAK,CAAC,GAAG,EAAE,CAAC;AACrB,CAAC;AAhBC,4BAAQ;AAkBV,SAAS,WAAW;IAClB,QAAQ,CAAC,QAAQ,EAAE,CAAC;AAGtB,CAAC;AArBC,kCAAW;AAsBb,KAAK,CAAC,eAAe,CAAC","file":"index.js","sourcesContent":["/* eslint-disable sort-imports */\nimport 'core-js/proposals/reflect-metadata'; // wait for vrender fix\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} 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';\nexport const version = \"0.10.3-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 ColumnsDefine,\n ColumnDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n themes,\n data,\n MousePointerCellEvent,\n getIcons,\n clearGlobal,\n //plugin registers\n register,\n /**\n * 暂不推荐使用\n */\n DataStatistics,\n CustomLayout\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"]}
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
const vutils_1 = require("@visactor/vutils");
|
|
8
8
|
|
|
9
9
|
function getAxisConfigInPivotChart(col, row, layout) {
|
|
10
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
10
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
11
11
|
if (layout._table.isPivotChart()) if (layout.indicatorsAsCol) {
|
|
12
12
|
if (layout.hasTwoIndicatorAxes && row === layout.columnHeaderLevelCount - 1 && col >= layout.rowHeaderLevelCount && col < layout.colCount - layout.rightFrozenColCount) {
|
|
13
13
|
let defaultKey = layout.getIndicatorKeyInChartSpec(col, layout.columnHeaderLevelCount - 1)[1];
|
|
@@ -61,9 +61,9 @@ function getAxisConfigInPivotChart(col, row, layout) {
|
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
if (col === layout.rowHeaderLevelCount - 1 && row >= layout.columnHeaderLevelCount && row < layout.rowCount - layout.bottomFrozenRowCount) {
|
|
64
|
-
let rowDimensionKey = layout.getDimensionKeyInChartSpec(layout.rowHeaderLevelCount, row)[0];
|
|
64
|
+
let rowDimensionKey = null === (_b = layout.getDimensionKeyInChartSpec(layout.rowHeaderLevelCount, row)) || void 0 === _b ? void 0 : _b[0];
|
|
65
65
|
(0, vutils_1.isArray)(rowDimensionKey) && (rowDimensionKey = rowDimensionKey[0]);
|
|
66
|
-
const data = null !== (
|
|
66
|
+
const data = null !== (_c = layout.dataset.collectedValues[rowDimensionKey]) && void 0 !== _c ? _c : [], recordRow = layout.getRecordIndexByRow(row), rowPath = layout.getRowKeysPath()[recordRow], domain = null !== (_d = data[rowPath[rowPath.length - 1]]) && void 0 !== _d ? _d : [], axisOption = getAxisOption(col, row, "left", layout);
|
|
67
67
|
if (!1 === (null == axisOption ? void 0 : axisOption.visible)) return;
|
|
68
68
|
return (0, vutils_1.merge)({
|
|
69
69
|
domain: Array.from(domain).reverse(),
|
|
@@ -80,7 +80,7 @@ function getAxisConfigInPivotChart(col, row, layout) {
|
|
|
80
80
|
const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, row);
|
|
81
81
|
let defaultKey = indicatorKeys[0];
|
|
82
82
|
(0, vutils_1.isArray)(defaultKey) && (defaultKey = defaultKey[0]);
|
|
83
|
-
const isZeroAlign = checkZeroAlign(col, row, "left", layout), data = layout.dataset.collectedValues[defaultKey + (isZeroAlign ? "_align" : "")] ? layout.dataset.collectedValues[defaultKey + (isZeroAlign ? "_align" : "")] : layout.dataset.collectedValues[defaultKey], index = layout.getRecordIndexByRow(row), range = null !== (
|
|
83
|
+
const isZeroAlign = checkZeroAlign(col, row, "left", layout), data = layout.dataset.collectedValues[defaultKey + (isZeroAlign ? "_align" : "")] ? layout.dataset.collectedValues[defaultKey + (isZeroAlign ? "_align" : "")] : layout.dataset.collectedValues[defaultKey], index = layout.getRecordIndexByRow(row), range = null !== (_g = null == data ? void 0 : data[null !== (_f = null === (_e = layout.getRowKeysPath()[index]) || void 0 === _e ? void 0 : _e[Math.max(0, layout.rowHeaderLevelCount - 1 - layout.leftAxesCount)]) && void 0 !== _f ? _f : ""]) && void 0 !== _g ? _g : {
|
|
84
84
|
min: 0,
|
|
85
85
|
max: 1
|
|
86
86
|
};
|
|
@@ -111,7 +111,7 @@ function getAxisConfigInPivotChart(col, row, layout) {
|
|
|
111
111
|
if (col === layout.colCount - layout.rightFrozenColCount && row >= layout.columnHeaderLevelCount && row < layout.rowCount - layout.bottomFrozenRowCount) {
|
|
112
112
|
let defaultKey = layout.getIndicatorKeyInChartSpec(layout.rowHeaderLevelCount - 1, row)[1];
|
|
113
113
|
if ((0, vutils_1.isArray)(defaultKey) && (defaultKey = defaultKey[0]), !defaultKey) return;
|
|
114
|
-
const isZeroAlign = checkZeroAlign(col, row, "right", layout), data = layout.dataset.collectedValues[defaultKey + (isZeroAlign ? "_align" : "")] ? layout.dataset.collectedValues[defaultKey + (isZeroAlign ? "_align" : "")] : layout.dataset.collectedValues[defaultKey], index = layout.getRecordIndexByRow(row), range = null !== (
|
|
114
|
+
const isZeroAlign = checkZeroAlign(col, row, "right", layout), data = layout.dataset.collectedValues[defaultKey + (isZeroAlign ? "_align" : "")] ? layout.dataset.collectedValues[defaultKey + (isZeroAlign ? "_align" : "")] : layout.dataset.collectedValues[defaultKey], index = layout.getRecordIndexByRow(row), range = null !== (_k = null == data ? void 0 : data[null !== (_j = null === (_h = layout.getRowKeysPath()[index]) || void 0 === _h ? void 0 : _h[Math.max(0, layout.rowHeaderLevelCount - 1 - layout.leftAxesCount)]) && void 0 !== _j ? _j : ""]) && void 0 !== _k ? _k : {
|
|
115
115
|
min: 0,
|
|
116
116
|
max: 1
|
|
117
117
|
}, axisOption = getAxisOption(col, row, "right", layout);
|
|
@@ -132,9 +132,9 @@ function getAxisConfigInPivotChart(col, row, layout) {
|
|
|
132
132
|
});
|
|
133
133
|
}
|
|
134
134
|
if (row === layout.rowCount - layout.bottomFrozenRowCount && col >= layout.rowHeaderLevelCount && col < layout.colCount - layout.rightFrozenColCount) {
|
|
135
|
-
let columnDimensionKey = layout.getDimensionKeyInChartSpec(col, layout.columnHeaderLevelCount)[0];
|
|
135
|
+
let columnDimensionKey = null === (_l = layout.getDimensionKeyInChartSpec(col, layout.columnHeaderLevelCount)) || void 0 === _l ? void 0 : _l[0];
|
|
136
136
|
(0, vutils_1.isArray)(columnDimensionKey) && (columnDimensionKey = columnDimensionKey[0]);
|
|
137
|
-
const data = null !== (
|
|
137
|
+
const data = null !== (_m = layout.dataset.collectedValues[columnDimensionKey]) && void 0 !== _m ? _m : [], recordCol = layout.getRecordIndexByCol(col), colPath = layout.getColKeysPath()[recordCol], domain = null !== (_o = null == data ? void 0 : data[null == colPath ? void 0 : colPath[(null == colPath ? void 0 : colPath.length) - 1]]) && void 0 !== _o ? _o : [], axisOption = getAxisOption(col, row, "bottom", layout);
|
|
138
138
|
if (!1 === (null == axisOption ? void 0 : axisOption.visible)) return;
|
|
139
139
|
return (0, vutils_1.merge)({
|
|
140
140
|
domain: Array.from(domain)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["layout/chart-helper/get-axis-config.ts"],"names":[],"mappings":";;;AAAA,6CAA4D;AAK5D,SAAgB,yBAAyB,CAAC,GAAW,EAAE,GAAW,EAAE,MAAsB;;IACxF,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,EAAE;QACjC,OAAO,SAAS,CAAC;KAClB;IAGD,IAAI,MAAM,CAAC,eAAe,EAAE;QAC1B,IACE,MAAM,CAAC,mBAAmB;YAC1B,GAAG,KAAK,MAAM,CAAC,sBAAsB,GA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AE,CAAC;QACvB,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAS,EAAE,EAAE;YAC7B,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;gBACjC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aACjB;QACH,CAAC,CAAC,CAAC;QACH,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACpC,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YACrB,IACE,IAAI,CAAC,IAAI;gBACT,IAAI,CAAC,IAAI,CAAC,SAAS;gBACnB,IAAI,CAAC,IAAI,CAAC,MAAM;gBAChB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;oBACnB,OAAO,QAAQ,CAAC,EAAE,KAAK,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;gBAC1C,CAAC,CAAC,EACF;gBACA,OAAO,IAAI,CAAC;aACb;SACF;KACF;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAxCD,wCAwCC","file":"get-axis-config.js","sourcesContent":["import { isArray, isNumber, merge } from '@visactor/vutils';\nimport type { PivotLayoutMap } from '../pivot-layout';\nimport type { ITableAxisOption } from '../../ts-types/component/axis';\nimport type { PivotChart } from '../../PivotChart';\n\nexport function getAxisConfigInPivotChart(col: number, row: number, layout: PivotLayoutMap): any {\n if (!layout._table.isPivotChart()) {\n return undefined;\n }\n\n // 是否是指标\n if (layout.indicatorsAsCol) {\n if (\n layout.hasTwoIndicatorAxes &&\n row === layout.columnHeaderLevelCount - 1 &&\n col >= layout.rowHeaderLevelCount &&\n col < layout.colCount - layout.rightFrozenColCount\n ) {\n const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, layout.columnHeaderLevelCount - 1);\n let defaultKey = indicatorKeys[1];\n if (isArray(defaultKey)) {\n defaultKey = defaultKey[0];\n }\n if (!defaultKey) {\n return undefined;\n }\n\n const isZeroAlign = checkZeroAlign(col, row, 'top', layout);\n // const data = layout.dataset.collectedValues[defaultKey];\n const data = layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]\n ? layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]\n : layout.dataset.collectedValues[defaultKey];\n const index = layout.getRecordIndexByCol(col);\n const range = data\n ? data[layout.getColKeysPath()[index][Math.max(0, layout.columnHeaderLevelCount - 1 - layout.topAxesCount)]]\n : { max: 1, min: 0 };\n const axisOption = getAxisOption(col, row, 'top', layout);\n if (axisOption?.visible === false) {\n return;\n }\n if (isNumber(axisOption?.min)) {\n (range as any).min = axisOption.min;\n }\n if (isNumber(axisOption?.max)) {\n (range as any).max = axisOption.max;\n }\n // 顶部副指标轴\n return merge(\n {\n range: range\n },\n axisOption,\n {\n orient: 'top',\n type: 'linear',\n label: {\n flush: true\n }\n }\n );\n } else if (\n row === layout.rowCount - layout.bottomFrozenRowCount &&\n col >= layout.rowHeaderLevelCount &&\n col < layout.colCount - layout.rightFrozenColCount\n ) {\n const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, row);\n let defaultKey = indicatorKeys[0];\n if (isArray(defaultKey)) {\n defaultKey = defaultKey[0];\n }\n\n const isZeroAlign = checkZeroAlign(col, row, 'bottom', layout);\n\n const data = layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]\n ? layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]\n : layout.dataset.collectedValues[defaultKey];\n const index = layout.getRecordIndexByCol(col);\n const range = data?.[\n layout.getColKeysPath()[index][Math.max(0, layout.columnHeaderLevelCount - 1 - layout.topAxesCount)]\n ] ?? { min: 0, max: 1 };\n let indicatorInfo = null;\n indicatorKeys.forEach(key => {\n const info = layout.getIndicatorInfo(key);\n if (info) {\n indicatorInfo = info;\n }\n });\n\n const axisOption = getAxisOption(col, row, 'bottom', layout);\n if (axisOption?.visible === false) {\n return;\n }\n if (isNumber(axisOption?.min)) {\n (range as any).min = axisOption.min;\n }\n if (isNumber(axisOption?.max)) {\n (range as any).max = axisOption.max;\n }\n // 底侧指标轴\n return merge(\n {\n title: {\n visible: true,\n text: (indicatorInfo as any)?.title\n // autoRotate: true\n },\n range: range\n },\n axisOption,\n {\n orient: 'bottom',\n type: 'linear',\n label: {\n flush: true\n }\n }\n );\n } else if (\n col === layout.rowHeaderLevelCount - 1 &&\n row >= layout.columnHeaderLevelCount &&\n row < layout.rowCount - layout.bottomFrozenRowCount\n ) {\n let rowDimensionKey = layout.getDimensionKeyInChartSpec(layout.rowHeaderLevelCount, row)[0];\n if (isArray(rowDimensionKey)) {\n rowDimensionKey = rowDimensionKey[0];\n }\n const data = layout.dataset.collectedValues[rowDimensionKey] ?? ([] as string[]);\n\n const recordRow = layout.getRecordIndexByRow(row);\n const rowPath = layout.getRowKeysPath()[recordRow];\n const domain = (data[rowPath[rowPath.length - 1]] as Array<string>) ?? [];\n\n const axisOption = getAxisOption(col, row, 'left', layout);\n if (axisOption?.visible === false) {\n return;\n }\n // 左侧维度轴\n return merge(\n {\n domain: Array.from(domain).reverse(),\n title: {\n autoRotate: true\n }\n },\n axisOption,\n {\n orient: 'left',\n type: 'band'\n }\n );\n }\n } else {\n if (\n col === layout.rowHeaderLevelCount - 1 &&\n row >= layout.columnHeaderLevelCount &&\n row < layout.rowCount - layout.bottomFrozenRowCount\n ) {\n const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, row);\n let defaultKey = indicatorKeys[0];\n if (isArray(defaultKey)) {\n defaultKey = defaultKey[0];\n }\n\n const isZeroAlign = checkZeroAlign(col, row, 'left', layout);\n\n const data = layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]\n ? layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]\n : layout.dataset.collectedValues[defaultKey];\n const index = layout.getRecordIndexByRow(row);\n const range = data?.[\n layout.getRowKeysPath()[index][Math.max(0, layout.rowHeaderLevelCount - 1 - layout.leftAxesCount)]\n ] ?? { min: 0, max: 1 };\n let indicatorInfo = null;\n indicatorKeys.forEach(key => {\n const info = layout.getIndicatorInfo(key);\n if (info) {\n indicatorInfo = info;\n }\n });\n\n const axisOption = getAxisOption(col, row, 'left', layout);\n if (axisOption?.visible === false) {\n return;\n }\n if (isNumber(axisOption?.min)) {\n (range as any).min = axisOption.min;\n }\n if (isNumber(axisOption?.max)) {\n (range as any).max = axisOption.max;\n }\n // 左侧指标轴\n return merge(\n {\n title: {\n visible: true,\n text: (indicatorInfo as any)?.title,\n autoRotate: true\n },\n range: range\n },\n axisOption,\n {\n orient: 'left',\n type: 'linear',\n label: {\n flush: true\n }\n }\n );\n } else if (\n col === layout.colCount - layout.rightFrozenColCount &&\n row >= layout.columnHeaderLevelCount &&\n row < layout.rowCount - layout.bottomFrozenRowCount\n ) {\n const indicatorKeys = layout.getIndicatorKeyInChartSpec(layout.rowHeaderLevelCount - 1, row);\n let defaultKey = indicatorKeys[1];\n if (isArray(defaultKey)) {\n defaultKey = defaultKey[0];\n }\n\n if (!defaultKey) {\n return undefined;\n }\n\n const isZeroAlign = checkZeroAlign(col, row, 'right', layout);\n\n const data = layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]\n ? layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]\n : layout.dataset.collectedValues[defaultKey];\n const index = layout.getRecordIndexByRow(row);\n const range = data?.[\n layout.getRowKeysPath()[index][Math.max(0, layout.rowHeaderLevelCount - 1 - layout.leftAxesCount)]\n ] ?? { min: 0, max: 1 };\n\n const axisOption = getAxisOption(col, row, 'right', layout);\n if (axisOption?.visible === false) {\n return;\n }\n if (isNumber(axisOption?.min)) {\n (range as any).min = axisOption.min;\n }\n if (isNumber(axisOption?.max)) {\n (range as any).max = axisOption.max;\n }\n // 右侧副指标轴\n return merge(\n {\n range: range,\n title: {\n autoRotate: true\n }\n },\n axisOption,\n {\n orient: 'right',\n type: 'linear',\n label: {\n flush: true\n }\n }\n );\n } else if (\n row === layout.rowCount - layout.bottomFrozenRowCount &&\n col >= layout.rowHeaderLevelCount &&\n col < layout.colCount - layout.rightFrozenColCount\n ) {\n // const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, row);\n\n let columnDimensionKey = layout.getDimensionKeyInChartSpec(col, layout.columnHeaderLevelCount)[0];\n if (isArray(columnDimensionKey)) {\n columnDimensionKey = columnDimensionKey[0];\n }\n const data = layout.dataset.collectedValues[columnDimensionKey] ?? ([] as string[]);\n\n const recordCol = layout.getRecordIndexByCol(col);\n const colPath = layout.getColKeysPath()[recordCol];\n const domain = (data?.[colPath[colPath.length - 1]] as Array<string>) ?? [];\n\n const axisOption = getAxisOption(col, row, 'bottom', layout);\n if (axisOption?.visible === false) {\n return;\n }\n // 底部维度轴\n return merge(\n {\n domain: Array.from(domain)\n },\n axisOption,\n {\n orient: 'bottom',\n type: 'band'\n }\n );\n }\n }\n\n return undefined;\n}\n\nexport function getAxisOption(col: number, row: number, orient: string, layout: PivotLayoutMap) {\n const spec = layout.getRawChartSpec(col, row);\n if (spec && isArray(spec.axes)) {\n const axisOption = spec.axes.find((axis: any) => {\n return axis.orient === orient;\n });\n if (axisOption) {\n return axisOption;\n }\n }\n const axisOption = ((layout._table as PivotChart).pivotChartAxes as ITableAxisOption[]).find(axisOption => {\n return axisOption.orient === orient;\n });\n return axisOption;\n}\n\nexport function checkZeroAlign(col: number, row: number, orient: string, layout: PivotLayoutMap) {\n // check condition:\n // 1. two axes and one set sync\n // 2. axisId in sync is another\n const orients: string[] = [];\n if (orient === 'left' || orient === 'right') {\n orients.push('left', 'right');\n } else if (orient === 'top' || orient === 'bottom') {\n orients.push('top', 'bottom');\n }\n const spec = layout.getRawChartSpec(col, row);\n let axesSpec;\n if (spec && isArray(spec.axes)) {\n axesSpec = spec.axes;\n } else {\n axesSpec = (layout._table as PivotChart).pivotChartAxes as ITableAxisOption[];\n }\n if (isArray(axesSpec)) {\n const axes: any[] = [];\n axesSpec.forEach((axis: any) => {\n if (orients.includes(axis.orient)) {\n axes.push(axis);\n }\n });\n for (let i = 0; i < axes.length; i++) {\n const axis = axes[i];\n if (\n axis.sync &&\n axis.sync.zeroAlign &&\n axis.sync.axisId &&\n axes.find(axisSync => {\n return axisSync.id === axis.sync.axisId;\n })\n ) {\n return true;\n }\n }\n }\n\n return false;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["layout/chart-helper/get-axis-config.ts"],"names":[],"mappings":";;;AAAA,6CAA4D;AAK5D,SAAgB,yBAAyB,CAAC,GAAW,EAAE,GAAW,EAAE,MAAsB;;IACxF,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,EAAE;QACjC,OAAO,SAAS,CAAC;KAClB;IAGD,IAAI,MAAM,CAAC,eAAe,EAAE;QAC1B,IACE,MAAM,CAAC,mBAAmB;YAC1B,GAAG,KAAK,MAAM,CAAC,sBAAsB,GAAG,CAAC;YACzC,GAAG,IAAI,MAAM,CAAC,mBAAmB;YACjC,GAAG,GAAG,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,mBAAmB,EAClD;YACA,MAAM,aAAa,GAAG,MAAM,CAAC,0BAA0B,CAAC,GAAG,EAAE,MAAM,CAAC,sBAAsB,GAAG,CAAC,CAAC,CAAC;YAChG,IAAI,UAAU,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;YAClC,IAAI,IAAA,gBAAO,EAAC,UAAU,CAAC,EAAE;gBACvB,UAAU,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;aAC5B;YACD,IAAI,CAAC,UAAU,EAAE;gBACf,OAAO,SAAS,CAAC;aAClB;YAED,MAAM,WAAW,GAAG,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;YAE5D,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,UAAU,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,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KAAK,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;gBAC1C,CAAC,CAAC,EACF;gBACA,OAAO,IAAI,CAAC;aACb;SACF;KACF;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAxCD,wCAwCC","file":"get-axis-config.js","sourcesContent":["import { isArray, isNumber, merge } from '@visactor/vutils';\nimport type { PivotLayoutMap } from '../pivot-layout';\nimport type { ITableAxisOption } from '../../ts-types/component/axis';\nimport type { PivotChart } from '../../PivotChart';\n\nexport function getAxisConfigInPivotChart(col: number, row: number, layout: PivotLayoutMap): any {\n if (!layout._table.isPivotChart()) {\n return undefined;\n }\n\n // 是否是指标\n if (layout.indicatorsAsCol) {\n if (\n layout.hasTwoIndicatorAxes &&\n row === layout.columnHeaderLevelCount - 1 &&\n col >= layout.rowHeaderLevelCount &&\n col < layout.colCount - layout.rightFrozenColCount\n ) {\n const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, layout.columnHeaderLevelCount - 1);\n let defaultKey = indicatorKeys[1];\n if (isArray(defaultKey)) {\n defaultKey = defaultKey[0];\n }\n if (!defaultKey) {\n return undefined;\n }\n\n const isZeroAlign = checkZeroAlign(col, row, 'top', layout);\n // const data = layout.dataset.collectedValues[defaultKey];\n const data = layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]\n ? layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]\n : layout.dataset.collectedValues[defaultKey];\n const index = layout.getRecordIndexByCol(col);\n const range = data\n ? data[layout.getColKeysPath()[index][Math.max(0, layout.columnHeaderLevelCount - 1 - layout.topAxesCount)]]\n : { max: 1, min: 0 };\n const axisOption = getAxisOption(col, row, 'top', layout);\n if (axisOption?.visible === false) {\n return;\n }\n if (isNumber(axisOption?.min)) {\n (range as any).min = axisOption.min;\n }\n if (isNumber(axisOption?.max)) {\n (range as any).max = axisOption.max;\n }\n // 顶部副指标轴\n return merge(\n {\n range: range\n },\n axisOption,\n {\n orient: 'top',\n type: 'linear',\n label: {\n flush: true\n }\n }\n );\n } else if (\n row === layout.rowCount - layout.bottomFrozenRowCount &&\n col >= layout.rowHeaderLevelCount &&\n col < layout.colCount - layout.rightFrozenColCount\n ) {\n const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, row);\n let defaultKey = indicatorKeys[0];\n if (isArray(defaultKey)) {\n defaultKey = defaultKey[0];\n }\n\n const isZeroAlign = checkZeroAlign(col, row, 'bottom', layout);\n\n const data = layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]\n ? layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]\n : layout.dataset.collectedValues[defaultKey];\n const index = layout.getRecordIndexByCol(col);\n const range = data?.[\n layout.getColKeysPath()[index][Math.max(0, layout.columnHeaderLevelCount - 1 - layout.topAxesCount)]\n ] ?? { min: 0, max: 1 };\n let indicatorInfo = null;\n indicatorKeys.forEach(key => {\n const info = layout.getIndicatorInfo(key);\n if (info) {\n indicatorInfo = info;\n }\n });\n\n const axisOption = getAxisOption(col, row, 'bottom', layout);\n if (axisOption?.visible === false) {\n return;\n }\n if (isNumber(axisOption?.min)) {\n (range as any).min = axisOption.min;\n }\n if (isNumber(axisOption?.max)) {\n (range as any).max = axisOption.max;\n }\n // 底侧指标轴\n return merge(\n {\n title: {\n visible: true,\n text: (indicatorInfo as any)?.title\n // autoRotate: true\n },\n range: range\n },\n axisOption,\n {\n orient: 'bottom',\n type: 'linear',\n label: {\n flush: true\n }\n }\n );\n } else if (\n col === layout.rowHeaderLevelCount - 1 &&\n row >= layout.columnHeaderLevelCount &&\n row < layout.rowCount - layout.bottomFrozenRowCount\n ) {\n let rowDimensionKey = layout.getDimensionKeyInChartSpec(layout.rowHeaderLevelCount, row)?.[0];\n if (isArray(rowDimensionKey)) {\n rowDimensionKey = rowDimensionKey[0];\n }\n const data = layout.dataset.collectedValues[rowDimensionKey] ?? ([] as string[]);\n\n const recordRow = layout.getRecordIndexByRow(row);\n const rowPath = layout.getRowKeysPath()[recordRow];\n const domain = (data[rowPath[rowPath.length - 1]] as Array<string>) ?? [];\n\n const axisOption = getAxisOption(col, row, 'left', layout);\n if (axisOption?.visible === false) {\n return;\n }\n // 左侧维度轴\n return merge(\n {\n domain: Array.from(domain).reverse(),\n title: {\n autoRotate: true\n }\n },\n axisOption,\n {\n orient: 'left',\n type: 'band'\n }\n );\n }\n } else {\n if (\n col === layout.rowHeaderLevelCount - 1 &&\n row >= layout.columnHeaderLevelCount &&\n row < layout.rowCount - layout.bottomFrozenRowCount\n ) {\n const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, row);\n let defaultKey = indicatorKeys[0];\n if (isArray(defaultKey)) {\n defaultKey = defaultKey[0];\n }\n\n const isZeroAlign = checkZeroAlign(col, row, 'left', layout);\n\n const data = layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]\n ? layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]\n : layout.dataset.collectedValues[defaultKey];\n const index = layout.getRecordIndexByRow(row);\n const range = data?.[\n layout.getRowKeysPath()[index]?.[Math.max(0, layout.rowHeaderLevelCount - 1 - layout.leftAxesCount)] ?? ''\n ] ?? { min: 0, max: 1 };\n let indicatorInfo = null;\n indicatorKeys.forEach(key => {\n const info = layout.getIndicatorInfo(key);\n if (info) {\n indicatorInfo = info;\n }\n });\n\n const axisOption = getAxisOption(col, row, 'left', layout);\n if (axisOption?.visible === false) {\n return;\n }\n if (isNumber(axisOption?.min)) {\n (range as any).min = axisOption.min;\n }\n if (isNumber(axisOption?.max)) {\n (range as any).max = axisOption.max;\n }\n // 左侧指标轴\n return merge(\n {\n title: {\n visible: true,\n text: (indicatorInfo as any)?.title,\n autoRotate: true\n },\n range: range\n },\n axisOption,\n {\n orient: 'left',\n type: 'linear',\n label: {\n flush: true\n }\n }\n );\n } else if (\n col === layout.colCount - layout.rightFrozenColCount &&\n row >= layout.columnHeaderLevelCount &&\n row < layout.rowCount - layout.bottomFrozenRowCount\n ) {\n const indicatorKeys = layout.getIndicatorKeyInChartSpec(layout.rowHeaderLevelCount - 1, row);\n let defaultKey = indicatorKeys[1];\n if (isArray(defaultKey)) {\n defaultKey = defaultKey[0];\n }\n\n if (!defaultKey) {\n return undefined;\n }\n\n const isZeroAlign = checkZeroAlign(col, row, 'right', layout);\n\n const data = layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]\n ? layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]\n : layout.dataset.collectedValues[defaultKey];\n const index = layout.getRecordIndexByRow(row);\n const range = data?.[\n layout.getRowKeysPath()[index]?.[Math.max(0, layout.rowHeaderLevelCount - 1 - layout.leftAxesCount)] ?? ''\n ] ?? { min: 0, max: 1 };\n\n const axisOption = getAxisOption(col, row, 'right', layout);\n if (axisOption?.visible === false) {\n return;\n }\n if (isNumber(axisOption?.min)) {\n (range as any).min = axisOption.min;\n }\n if (isNumber(axisOption?.max)) {\n (range as any).max = axisOption.max;\n }\n // 右侧副指标轴\n return merge(\n {\n range: range,\n title: {\n autoRotate: true\n }\n },\n axisOption,\n {\n orient: 'right',\n type: 'linear',\n label: {\n flush: true\n }\n }\n );\n } else if (\n row === layout.rowCount - layout.bottomFrozenRowCount &&\n col >= layout.rowHeaderLevelCount &&\n col < layout.colCount - layout.rightFrozenColCount\n ) {\n // const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, row);\n\n let columnDimensionKey = layout.getDimensionKeyInChartSpec(col, layout.columnHeaderLevelCount)?.[0];\n if (isArray(columnDimensionKey)) {\n columnDimensionKey = columnDimensionKey[0];\n }\n const data = layout.dataset.collectedValues[columnDimensionKey] ?? ([] as string[]);\n\n const recordCol = layout.getRecordIndexByCol(col);\n const colPath = layout.getColKeysPath()[recordCol];\n const domain = (data?.[colPath?.[colPath?.length - 1]] as Array<string>) ?? [];\n\n const axisOption = getAxisOption(col, row, 'bottom', layout);\n if (axisOption?.visible === false) {\n return;\n }\n // 底部维度轴\n return merge(\n {\n domain: Array.from(domain)\n },\n axisOption,\n {\n orient: 'bottom',\n type: 'band'\n }\n );\n }\n }\n\n return undefined;\n}\n\nexport function getAxisOption(col: number, row: number, orient: string, layout: PivotLayoutMap) {\n const spec = layout.getRawChartSpec(col, row);\n if (spec && isArray(spec.axes)) {\n const axisOption = spec.axes.find((axis: any) => {\n return axis.orient === orient;\n });\n if (axisOption) {\n return axisOption;\n }\n }\n const axisOption = ((layout._table as PivotChart).pivotChartAxes as ITableAxisOption[]).find(axisOption => {\n return axisOption.orient === orient;\n });\n return axisOption;\n}\n\nexport function checkZeroAlign(col: number, row: number, orient: string, layout: PivotLayoutMap) {\n // check condition:\n // 1. two axes and one set sync\n // 2. axisId in sync is another\n const orients: string[] = [];\n if (orient === 'left' || orient === 'right') {\n orients.push('left', 'right');\n } else if (orient === 'top' || orient === 'bottom') {\n orients.push('top', 'bottom');\n }\n const spec = layout.getRawChartSpec(col, row);\n let axesSpec;\n if (spec && isArray(spec.axes)) {\n axesSpec = spec.axes;\n } else {\n axesSpec = (layout._table as PivotChart).pivotChartAxes as ITableAxisOption[];\n }\n if (isArray(axesSpec)) {\n const axes: any[] = [];\n axesSpec.forEach((axis: any) => {\n if (orients.includes(axis.orient)) {\n axes.push(axis);\n }\n });\n for (let i = 0; i < axes.length; i++) {\n const axis = axes[i];\n if (\n axis.sync &&\n axis.sync.zeroAlign &&\n axis.sync.axisId &&\n axes.find(axisSync => {\n return axisSync.id === axis.sync.axisId;\n })\n ) {\n return true;\n }\n }\n }\n\n return false;\n}\n"]}
|
|
@@ -27,7 +27,7 @@ function getChartSpec(col, row, layout) {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
function getChartAxes(col, row, layout) {
|
|
30
|
-
var _a;
|
|
30
|
+
var _a, _b;
|
|
31
31
|
const axes = [];
|
|
32
32
|
if (layout.indicatorsAsCol) {
|
|
33
33
|
const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, row), colIndex = layout.getRecordIndexByCol(col);
|
|
@@ -90,9 +90,9 @@ function getChartAxes(col, row, layout) {
|
|
|
90
90
|
} else {
|
|
91
91
|
const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, row), rowIndex = layout.getRecordIndexByRow(row);
|
|
92
92
|
indicatorKeys.forEach(((key, index) => {
|
|
93
|
-
var _a;
|
|
93
|
+
var _a, _b, _c;
|
|
94
94
|
(0, vutils_1.isArray)(key) && (key = key[0]);
|
|
95
|
-
const isZeroAlign = (0, get_axis_config_1.checkZeroAlign)(col, row, 0 === index ? "left" : "right", layout), data = layout.dataset.collectedValues[key + (isZeroAlign ? "_align" : "")] ? layout.dataset.collectedValues[key + (isZeroAlign ? "_align" : "")] : layout.dataset.collectedValues[key], range = null !== (
|
|
95
|
+
const isZeroAlign = (0, get_axis_config_1.checkZeroAlign)(col, row, 0 === index ? "left" : "right", layout), data = layout.dataset.collectedValues[key + (isZeroAlign ? "_align" : "")] ? layout.dataset.collectedValues[key + (isZeroAlign ? "_align" : "")] : layout.dataset.collectedValues[key], range = null !== (_c = null == data ? void 0 : data[null !== (_b = null === (_a = layout.getRowKeysPath()[rowIndex]) || void 0 === _a ? void 0 : _a[Math.max(0, layout.rowHeaderLevelCount - 1 - layout.leftAxesCount)]) && void 0 !== _b ? _b : ""]) && void 0 !== _c ? _c : {
|
|
96
96
|
min: 0,
|
|
97
97
|
max: 1
|
|
98
98
|
}, axisOption = (0, get_axis_config_1.getAxisOption)(col, row, 0 === index ? "left" : "right", layout);
|
|
@@ -120,7 +120,7 @@ function getChartAxes(col, row, layout) {
|
|
|
120
120
|
}));
|
|
121
121
|
let columnDimensionKey = layout.getDimensionKeyInChartSpec(col, layout.columnHeaderLevelCount)[0];
|
|
122
122
|
(0, vutils_1.isArray)(columnDimensionKey) && (columnDimensionKey = columnDimensionKey[0]);
|
|
123
|
-
const data = layout.dataset.cacheCollectedValues[columnDimensionKey] || layout.dataset.collectedValues[columnDimensionKey] || [], recordCol = layout.getRecordIndexByCol(col), colPath = layout.getColKeysPath()[recordCol], domain = null !== (
|
|
123
|
+
const data = layout.dataset.cacheCollectedValues[columnDimensionKey] || layout.dataset.collectedValues[columnDimensionKey] || [], recordCol = layout.getRecordIndexByCol(col), colPath = layout.getColKeysPath()[recordCol], domain = null !== (_b = null == data ? void 0 : data[null !== (_a = null == colPath ? void 0 : colPath[(null == colPath ? void 0 : colPath.length) - 1]) && void 0 !== _a ? _a : ""]) && void 0 !== _b ? _b : [], axisOption = (0,
|
|
124
124
|
get_axis_config_1.getAxisOption)(col, row, "bottom", layout);
|
|
125
125
|
axes.push((0, vutils_1.merge)({
|
|
126
126
|
domain: Array.from(domain)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["layout/chart-helper/get-chart-spec.ts"],"names":[],"mappings":";;;AAAA,6CAA6D;AAM7D,uDAAkE;AAElE,MAAM,oBAAoB,GAAG,sBAAsB,CAAC;AAEpD,SAAgB,eAAe,CAAC,GAAW,EAAE,GAAW,EAAE,MAA6C;;IACrG,MAAM,KAAK,GAAG,MAAM,CAAC,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAClD,IAAI,YAAY,CAAC;IACjB,IAAI,MAAM,CAAC,eAAe,EAAE;QAC1B,MAAM,YAAY,GAAG,MAAA,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,0CAAE,YAAY,CAAC;QAC9F,YAAY,GAAG,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,YAAY,KAAK,YAAY,CAAC,CAAC;KAChG;SAAM;QACL,MAAM,YAAY,GAAG,MAAA,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,0CAAE,YAAY,CAAC;QAC9F,YAAY,GAAG,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,YAAY,KAAK,YA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AC3B,CAAC;AA5BD,wCA4BC","file":"get-chart-spec.js","sourcesContent":["import { cloneDeep, isArray, merge } from '@visactor/vutils';\nimport type { PivotLayoutMap } from '../pivot-layout';\nimport type { PivotChart } from '../../PivotChart';\nimport type { ITableAxisOption } from '../../ts-types/component/axis';\nimport type { PivotHeaderLayoutMap } from '../pivot-header-layout';\nimport type { SimpleHeaderLayoutMap } from '../simple-header-layout';\nimport { checkZeroAlign, getAxisOption } from './get-axis-config';\n\nconst NO_AXISID_FRO_VTABLE = 'NO_AXISID_FRO_VTABLE';\n\nexport function getRawChartSpec(col: number, row: number, layout: PivotLayoutMap | PivotHeaderLayoutMap): any {\n const paths = layout.getCellHeaderPaths(col, row);\n let indicatorObj;\n if (layout.indicatorsAsCol) {\n const indicatorKey = paths.colHeaderPaths.find(colPath => colPath.indicatorKey)?.indicatorKey;\n indicatorObj = layout.columnObjects.find(indicator => indicator.indicatorKey === indicatorKey);\n } else {\n const indicatorKey = paths.rowHeaderPaths.find(rowPath => rowPath.indicatorKey)?.indicatorKey;\n indicatorObj = layout.columnObjects.find(indicator => indicator.indicatorKey === indicatorKey);\n }\n // const indicatorKeys: string[] = [];\n const chartSpec = indicatorObj?.chartSpec;\n\n return chartSpec;\n}\n\nexport function getChartSpec(col: number, row: number, layout: PivotLayoutMap): any {\n let chartSpec = layout.getRawChartSpec(col, row);\n if (chartSpec) {\n chartSpec = cloneDeep(chartSpec);\n chartSpec.axes = layout.getChartAxes(col, row);\n chartSpec.padding = 0;\n chartSpec.dataZoom = []; // Do not support datazoom temply\n return chartSpec;\n }\n return null;\n}\n\nexport function getChartAxes(col: number, row: number, layout: PivotLayoutMap): any {\n const axes = [];\n if (layout.indicatorsAsCol) {\n const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, row);\n const colIndex = layout.getRecordIndexByCol(col);\n indicatorKeys.forEach((key, index) => {\n if (isArray(key)) {\n key = key[0];\n }\n\n const isZeroAlign = checkZeroAlign(col, row, index === 0 ? 'bottom' : 'top', layout);\n\n const data = layout.dataset.collectedValues[key + (isZeroAlign ? '_align' : '')]\n ? layout.dataset.collectedValues[key + (isZeroAlign ? '_align' : '')]\n : layout.dataset.collectedValues[key];\n const range = (data?.[\n layout.getColKeysPath()[colIndex][Math.max(0, layout.columnHeaderLevelCount - 1 - layout.topAxesCount)]\n ] as { max?: number; min?: number }) ?? { min: 0, max: 1 };\n\n const axisOption = getAxisOption(col, row, index === 0 ? 'bottom' : 'top', layout);\n if (axisOption?.zero) {\n range.min = Math.min(range.min, 0);\n range.max = Math.max(range.max, 0);\n }\n axes.push(\n merge(\n {\n range\n },\n axisOption,\n {\n type: 'linear',\n orient: index === 0 ? 'bottom' : 'top',\n // visible: true,\n label: { visible: false },\n title: { visible: false },\n domainLine: { visible: false },\n seriesIndex: index,\n height: -1,\n\n sync: { axisId: NO_AXISID_FRO_VTABLE } // hack for fs\n }\n )\n );\n });\n\n let rowDimensionKey = layout.getDimensionKeyInChartSpec(layout.rowHeaderLevelCount, col)[0];\n if (isArray(rowDimensionKey)) {\n rowDimensionKey = rowDimensionKey[0];\n }\n const data =\n layout.dataset.cacheCollectedValues[rowDimensionKey] ||\n layout.dataset.collectedValues[rowDimensionKey] ||\n ([] as string[]);\n const recordRow = layout.getRecordIndexByRow(row);\n const rowPath = layout.getRowKeysPath()[recordRow];\n const domain = data[rowPath[rowPath.length - 1]] as Set<string>;\n\n const axisOption = getAxisOption(col, row, 'left', layout);\n axes.push(\n merge(\n {\n domain: Array.from(domain)\n },\n axisOption,\n {\n type: 'band',\n orient: 'left',\n // visible: true,\n label: { visible: false, space: 0 },\n domainLine: { visible: false },\n tick: { visible: false },\n subTick: { visible: false },\n title: { visible: false },\n // height: -1,\n width: -1\n // autoIndent: false,\n }\n )\n );\n } else {\n const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, row);\n const rowIndex = layout.getRecordIndexByRow(row);\n indicatorKeys.forEach((key, index) => {\n if (isArray(key)) {\n key = key[0];\n }\n\n const isZeroAlign = checkZeroAlign(col, row, index === 0 ? 'left' : 'right', layout);\n\n const data = layout.dataset.collectedValues[key + (isZeroAlign ? '_align' : '')]\n ? layout.dataset.collectedValues[key + (isZeroAlign ? '_align' : '')]\n : layout.dataset.collectedValues[key];\n const range = (data?.[\n layout.getRowKeysPath()[rowIndex][Math.max(0, layout.rowHeaderLevelCount - 1 - layout.leftAxesCount)]\n ] as { max?: number; min?: number }) ?? { min: 0, max: 1 };\n\n const axisOption = getAxisOption(col, row, index === 0 ? 'left' : 'right', layout);\n if (axisOption?.zero) {\n range.min = Math.min(range.min, 0);\n range.max = Math.max(range.max, 0);\n }\n axes.push(\n merge(\n {\n range\n },\n axisOption,\n {\n type: 'linear',\n orient: index === 0 ? 'left' : 'right',\n // visible: true,\n label: { visible: false },\n title: { visible: false },\n domainLine: { visible: false },\n seriesIndex: index,\n width: -1,\n // grid: index === 0 ? undefined : { visible: false }\n\n sync: { axisId: NO_AXISID_FRO_VTABLE } // hack for fs\n }\n )\n );\n });\n\n let columnDimensionKey = layout.getDimensionKeyInChartSpec(col, layout.columnHeaderLevelCount)[0];\n if (isArray(columnDimensionKey)) {\n columnDimensionKey = columnDimensionKey[0];\n }\n const data =\n layout.dataset.cacheCollectedValues[columnDimensionKey] ||\n layout.dataset.collectedValues[columnDimensionKey] ||\n ([] as string[]);\n const recordCol = layout.getRecordIndexByCol(col);\n const colPath = layout.getColKeysPath()[recordCol];\n const domain: string[] | Set<string> = (data?.[colPath[colPath.length - 1]] as Set<string>) ?? [];\n\n const axisOption = getAxisOption(col, row, 'bottom', layout);\n axes.push(\n merge(\n {\n domain: Array.from(domain)\n },\n axisOption,\n {\n type: 'band',\n orient: 'bottom',\n visible: true,\n label: { visible: false, space: 0 },\n domainLine: { visible: false },\n tick: { visible: false },\n subTick: { visible: false },\n title: { visible: false },\n height: -1\n // autoIndent: false,\n }\n )\n );\n }\n return axes;\n}\n/**\n * 获取单元格对应spec的dataId。\n * 如果是spec外层的dataId,则是string,否则通过series获取到的是Record<string, string> => <dataId, series-chart的指标key用于过滤数据>\n * @param col\n * @param row\n * @param layout\n * @returns\n */\nexport function getChartDataId(\n col: number,\n row: number,\n layout: PivotLayoutMap | PivotHeaderLayoutMap | SimpleHeaderLayoutMap\n): string | Record<string, string> {\n const chartSpec = layout.getRawChartSpec(col, row);\n // 如果chartSpec配置了组合图 series 则需要考虑 series中存在的多个指标\n if (chartSpec?.series) {\n const dataIdfield: Record<string, string> = {};\n\n if (chartSpec.data?.id) {\n dataIdfield[chartSpec.data.id] = undefined;\n }\n chartSpec?.series.forEach((seriesSpec: any) => {\n if (!seriesSpec.data?.fromDataId) {\n if (!seriesSpec.data?.transforms) {\n const seriesField = seriesSpec.direction === 'horizontal' ? seriesSpec.xField : seriesSpec.yField;\n dataIdfield[seriesSpec.data?.id ?? chartSpec.data?.id ?? 'data'] = seriesSpec.data?.id\n ? seriesField\n : undefined;\n } else {\n dataIdfield[seriesSpec.data?.id ?? chartSpec.data?.id ?? 'data'] = undefined;\n }\n }\n });\n return dataIdfield;\n }\n return chartSpec.data.id;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["layout/chart-helper/get-chart-spec.ts"],"names":[],"mappings":";;;AAAA,6CAA6D;AAM7D,uDAAkE;AAElE,MAAM,oBAAoB,GAAG,sBAAsB,CAAC;AAEpD,SAAgB,eAAe,CAAC,GAAW,EAAE,GAAW,EAAE,MAA6C;;IACrG,MAAM,KAAK,GAAG,MAAM,CAAC,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAClD,IAAI,YAAY,CAAC;IACjB,IAAI,MAAM,CAAC,eAAe,EAAE;QAC1B,MAAM,YAAY,GAAG,MAAA,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,YAAY,CAAC,0CAAE,YAAY,CAAC;QAC9F,YAAY,GAAG,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,YAAY,K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AG,CAAA,MAAA,UAAU,CAAC,IAAI,0CAAE,EAAE;wBACpF,CAAC,CAAC,WAAW;wBACb,CAAC,CAAC,SAAS,CAAC;iBACf;qBAAM;oBACL,WAAW,CAAC,MAAA,MAAA,MAAA,UAAU,CAAC,IAAI,0CAAE,EAAE,mCAAI,MAAA,SAAS,CAAC,IAAI,0CAAE,EAAE,mCAAI,MAAM,CAAC,GAAG,SAAS,CAAC;iBAC9E;aACF;QACH,CAAC,CAAC,CAAC;QACH,OAAO,WAAW,CAAC;KACpB;IACD,OAAO,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;AAC3B,CAAC;AA5BD,wCA4BC","file":"get-chart-spec.js","sourcesContent":["import { cloneDeep, isArray, merge } from '@visactor/vutils';\nimport type { PivotLayoutMap } from '../pivot-layout';\nimport type { PivotChart } from '../../PivotChart';\nimport type { ITableAxisOption } from '../../ts-types/component/axis';\nimport type { PivotHeaderLayoutMap } from '../pivot-header-layout';\nimport type { SimpleHeaderLayoutMap } from '../simple-header-layout';\nimport { checkZeroAlign, getAxisOption } from './get-axis-config';\n\nconst NO_AXISID_FRO_VTABLE = 'NO_AXISID_FRO_VTABLE';\n\nexport function getRawChartSpec(col: number, row: number, layout: PivotLayoutMap | PivotHeaderLayoutMap): any {\n const paths = layout.getCellHeaderPaths(col, row);\n let indicatorObj;\n if (layout.indicatorsAsCol) {\n const indicatorKey = paths.colHeaderPaths.find(colPath => colPath.indicatorKey)?.indicatorKey;\n indicatorObj = layout.columnObjects.find(indicator => indicator.indicatorKey === indicatorKey);\n } else {\n const indicatorKey = paths.rowHeaderPaths.find(rowPath => rowPath.indicatorKey)?.indicatorKey;\n indicatorObj = layout.columnObjects.find(indicator => indicator.indicatorKey === indicatorKey);\n }\n // const indicatorKeys: string[] = [];\n const chartSpec = indicatorObj?.chartSpec;\n\n return chartSpec;\n}\n\nexport function getChartSpec(col: number, row: number, layout: PivotLayoutMap): any {\n let chartSpec = layout.getRawChartSpec(col, row);\n if (chartSpec) {\n chartSpec = cloneDeep(chartSpec);\n chartSpec.axes = layout.getChartAxes(col, row);\n chartSpec.padding = 0;\n chartSpec.dataZoom = []; // Do not support datazoom temply\n return chartSpec;\n }\n return null;\n}\n\nexport function getChartAxes(col: number, row: number, layout: PivotLayoutMap): any {\n const axes = [];\n if (layout.indicatorsAsCol) {\n const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, row);\n const colIndex = layout.getRecordIndexByCol(col);\n indicatorKeys.forEach((key, index) => {\n if (isArray(key)) {\n key = key[0];\n }\n\n const isZeroAlign = checkZeroAlign(col, row, index === 0 ? 'bottom' : 'top', layout);\n\n const data = layout.dataset.collectedValues[key + (isZeroAlign ? '_align' : '')]\n ? layout.dataset.collectedValues[key + (isZeroAlign ? '_align' : '')]\n : layout.dataset.collectedValues[key];\n const range = (data?.[\n layout.getColKeysPath()[colIndex][Math.max(0, layout.columnHeaderLevelCount - 1 - layout.topAxesCount)]\n ] as { max?: number; min?: number }) ?? { min: 0, max: 1 };\n\n const axisOption = getAxisOption(col, row, index === 0 ? 'bottom' : 'top', layout);\n if (axisOption?.zero) {\n range.min = Math.min(range.min, 0);\n range.max = Math.max(range.max, 0);\n }\n axes.push(\n merge(\n {\n range\n },\n axisOption,\n {\n type: 'linear',\n orient: index === 0 ? 'bottom' : 'top',\n // visible: true,\n label: { visible: false },\n title: { visible: false },\n domainLine: { visible: false },\n seriesIndex: index,\n height: -1,\n\n sync: { axisId: NO_AXISID_FRO_VTABLE } // hack for fs\n }\n )\n );\n });\n\n let rowDimensionKey = layout.getDimensionKeyInChartSpec(layout.rowHeaderLevelCount, col)[0];\n if (isArray(rowDimensionKey)) {\n rowDimensionKey = rowDimensionKey[0];\n }\n const data =\n layout.dataset.cacheCollectedValues[rowDimensionKey] ||\n layout.dataset.collectedValues[rowDimensionKey] ||\n ([] as string[]);\n const recordRow = layout.getRecordIndexByRow(row);\n const rowPath = layout.getRowKeysPath()[recordRow];\n const domain = data[rowPath[rowPath.length - 1]] as Set<string>;\n\n const axisOption = getAxisOption(col, row, 'left', layout);\n axes.push(\n merge(\n {\n domain: Array.from(domain)\n },\n axisOption,\n {\n type: 'band',\n orient: 'left',\n // visible: true,\n label: { visible: false, space: 0 },\n domainLine: { visible: false },\n tick: { visible: false },\n subTick: { visible: false },\n title: { visible: false },\n // height: -1,\n width: -1\n // autoIndent: false,\n }\n )\n );\n } else {\n const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, row);\n const rowIndex = layout.getRecordIndexByRow(row);\n indicatorKeys.forEach((key, index) => {\n if (isArray(key)) {\n key = key[0];\n }\n\n const isZeroAlign = checkZeroAlign(col, row, index === 0 ? 'left' : 'right', layout);\n\n const data = layout.dataset.collectedValues[key + (isZeroAlign ? '_align' : '')]\n ? layout.dataset.collectedValues[key + (isZeroAlign ? '_align' : '')]\n : layout.dataset.collectedValues[key];\n const range = (data?.[\n layout.getRowKeysPath()[rowIndex]?.[Math.max(0, layout.rowHeaderLevelCount - 1 - layout.leftAxesCount)] ?? ''\n ] as { max?: number; min?: number }) ?? { min: 0, max: 1 };\n\n const axisOption = getAxisOption(col, row, index === 0 ? 'left' : 'right', layout);\n if (axisOption?.zero) {\n range.min = Math.min(range.min, 0);\n range.max = Math.max(range.max, 0);\n }\n axes.push(\n merge(\n {\n range\n },\n axisOption,\n {\n type: 'linear',\n orient: index === 0 ? 'left' : 'right',\n // visible: true,\n label: { visible: false },\n title: { visible: false },\n domainLine: { visible: false },\n seriesIndex: index,\n width: -1,\n // grid: index === 0 ? undefined : { visible: false }\n\n sync: { axisId: NO_AXISID_FRO_VTABLE } // hack for fs\n }\n )\n );\n });\n\n let columnDimensionKey = layout.getDimensionKeyInChartSpec(col, layout.columnHeaderLevelCount)[0];\n if (isArray(columnDimensionKey)) {\n columnDimensionKey = columnDimensionKey[0];\n }\n const data =\n layout.dataset.cacheCollectedValues[columnDimensionKey] ||\n layout.dataset.collectedValues[columnDimensionKey] ||\n ([] as string[]);\n const recordCol = layout.getRecordIndexByCol(col);\n const colPath = layout.getColKeysPath()[recordCol];\n const domain: string[] | Set<string> = (data?.[colPath?.[colPath?.length - 1] ?? ''] as Set<string>) ?? [];\n\n const axisOption = getAxisOption(col, row, 'bottom', layout);\n axes.push(\n merge(\n {\n domain: Array.from(domain)\n },\n axisOption,\n {\n type: 'band',\n orient: 'bottom',\n visible: true,\n label: { visible: false, space: 0 },\n domainLine: { visible: false },\n tick: { visible: false },\n subTick: { visible: false },\n title: { visible: false },\n height: -1\n // autoIndent: false,\n }\n )\n );\n }\n return axes;\n}\n/**\n * 获取单元格对应spec的dataId。\n * 如果是spec外层的dataId,则是string,否则通过series获取到的是Record<string, string> => <dataId, series-chart的指标key用于过滤数据>\n * @param col\n * @param row\n * @param layout\n * @returns\n */\nexport function getChartDataId(\n col: number,\n row: number,\n layout: PivotLayoutMap | PivotHeaderLayoutMap | SimpleHeaderLayoutMap\n): string | Record<string, string> {\n const chartSpec = layout.getRawChartSpec(col, row);\n // 如果chartSpec配置了组合图 series 则需要考虑 series中存在的多个指标\n if (chartSpec?.series) {\n const dataIdfield: Record<string, string> = {};\n\n if (chartSpec.data?.id) {\n dataIdfield[chartSpec.data.id] = undefined;\n }\n chartSpec?.series.forEach((seriesSpec: any) => {\n if (!seriesSpec.data?.fromDataId) {\n if (!seriesSpec.data?.transforms) {\n const seriesField = seriesSpec.direction === 'horizontal' ? seriesSpec.xField : seriesSpec.yField;\n dataIdfield[seriesSpec.data?.id ?? chartSpec.data?.id ?? 'data'] = seriesSpec.data?.id\n ? seriesField\n : undefined;\n } else {\n dataIdfield[seriesSpec.data?.id ?? chartSpec.data?.id ?? 'data'] = undefined;\n }\n }\n });\n return dataIdfield;\n }\n return chartSpec.data.id;\n}\n"]}
|
|
@@ -155,7 +155,7 @@ class PivotHeaderLayoutMap {
|
|
|
155
155
|
const prev = _headerCellIds[row - 1];
|
|
156
156
|
for (let col = 0; col < (null == prev ? void 0 : prev.length); col++) newRow[col] = prev[col];
|
|
157
157
|
}(row), header.forEach((hd => {
|
|
158
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
158
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
159
159
|
const id = hd.id, dimensionInfo = null !== (_b = null === (_a = this.rowsDefine) || void 0 === _a ? void 0 : _a.find((dimension => "string" != typeof dimension && dimension.dimensionKey === hd.dimensionKey))) && void 0 !== _b ? _b : null === (_c = this.columnsDefine) || void 0 === _c ? void 0 : _c.find((dimension => "string" != typeof dimension && dimension.dimensionKey === hd.dimensionKey)), indicatorInfo = null === (_d = this.indicatorsDefine) || void 0 === _d ? void 0 : _d.find((indicator => "string" != typeof indicator && (hd.indicatorKey ? indicator.indicatorKey === hd.indicatorKey : indicator.title === hd.value))), cell = {
|
|
160
160
|
id: id,
|
|
161
161
|
title: null !== (_e = hd.value) && void 0 !== _e ? _e : indicatorInfo.title,
|
|
@@ -178,12 +178,12 @@ class PivotHeaderLayoutMap {
|
|
|
178
178
|
description: null == dimensionInfo ? void 0 : dimensionInfo.description
|
|
179
179
|
};
|
|
180
180
|
indicatorInfo ? (indicatorInfo.customRender && (hd.customRender = indicatorInfo.customRender),
|
|
181
|
-
(0, util_1.isValid)(this._indicators.find((indicator => indicator.indicatorKey === indicatorInfo.indicatorKey))) || this._indicators.push({
|
|
181
|
+
(0, util_1.isValid)(null === (_q = this._indicators) || void 0 === _q ? void 0 : _q.find((indicator => indicator.indicatorKey === indicatorInfo.indicatorKey))) || null === (_r = this._indicators) || void 0 === _r || _r.push({
|
|
182
182
|
id: ++seqId,
|
|
183
183
|
indicatorKey: indicatorInfo.indicatorKey,
|
|
184
184
|
field: indicatorInfo.indicatorKey,
|
|
185
185
|
fieldFormat: null == indicatorInfo ? void 0 : indicatorInfo.format,
|
|
186
|
-
cellType: null !== (
|
|
186
|
+
cellType: null !== (_t = null !== (_s = null == indicatorInfo ? void 0 : indicatorInfo.cellType) && void 0 !== _s ? _s : null == indicatorInfo ? void 0 : indicatorInfo.columnType) && void 0 !== _t ? _t : "text",
|
|
187
187
|
chartModule: "chartModule" in indicatorInfo ? indicatorInfo.chartModule : null,
|
|
188
188
|
chartSpec: "chartSpec" in indicatorInfo ? indicatorInfo.chartSpec : null,
|
|
189
189
|
sparklineSpec: "sparklineSpec" in indicatorInfo ? indicatorInfo.sparklineSpec : null,
|
|
@@ -196,7 +196,7 @@ class PivotHeaderLayoutMap {
|
|
|
196
196
|
minWidth: null == indicatorInfo ? void 0 : indicatorInfo.minWidth,
|
|
197
197
|
maxWidth: null == indicatorInfo ? void 0 : indicatorInfo.maxWidth,
|
|
198
198
|
disableColumnResize: null == indicatorInfo ? void 0 : indicatorInfo.disableColumnResize
|
|
199
|
-
})) : hd.indicatorKey && ((0, util_1.isValid)(this._indicators.find((indicator => indicator.indicatorKey === hd.indicatorKey))) || this._indicators.push({
|
|
199
|
+
})) : hd.indicatorKey && ((0, util_1.isValid)(null === (_u = this._indicators) || void 0 === _u ? void 0 : _u.find((indicator => indicator.indicatorKey === hd.indicatorKey))) || null === (_v = this._indicators) || void 0 === _v || _v.push({
|
|
200
200
|
id: ++seqId,
|
|
201
201
|
indicatorKey: hd.indicatorKey,
|
|
202
202
|
field: hd.indicatorKey,
|
|
@@ -204,7 +204,7 @@ class PivotHeaderLayoutMap {
|
|
|
204
204
|
define: Object.assign({}, hd)
|
|
205
205
|
})), results[id] = cell, this._headerObjects[id] = cell, _headerCellIds[row][colIndex] = id;
|
|
206
206
|
for (let r = row - 1; r >= 0; r--) _headerCellIds[r][colIndex] = roots[r];
|
|
207
|
-
if (hd.children) this._addHeaders(_headerCellIds, row + 1, null !== (
|
|
207
|
+
if (hd.children) this._addHeaders(_headerCellIds, row + 1, null !== (_w = hd.children) && void 0 !== _w ? _w : [], [ ...roots, id ]).forEach((c => results.push(c))); else {
|
|
208
208
|
for (let r = row + 1; r < _headerCellIds.length; r++) _headerCellIds[r][colIndex] = id;
|
|
209
209
|
colIndex++;
|
|
210
210
|
}
|
|
@@ -310,6 +310,7 @@ class PivotHeaderLayoutMap {
|
|
|
310
310
|
return results;
|
|
311
311
|
}
|
|
312
312
|
setColumnWidths() {
|
|
313
|
+
var _a;
|
|
313
314
|
const returnWidths = new Array(this.colCount).fill(void 0);
|
|
314
315
|
if (this.showHeader && this.showRowHeader && (this.rowHeaderTitle && (returnWidths[0] = {}),
|
|
315
316
|
this.rowDimensionKeys.forEach(((objKey, index) => {
|
|
@@ -329,7 +330,7 @@ class PivotHeaderLayoutMap {
|
|
|
329
330
|
};
|
|
330
331
|
} else {
|
|
331
332
|
let maxWidth, minWidth, isAuto, width = 0;
|
|
332
|
-
this._indicators.forEach(((obj, index) => {
|
|
333
|
+
null === (_a = this._indicators) || void 0 === _a || _a.forEach(((obj, index) => {
|
|
333
334
|
"number" == typeof obj.width ? width = Math.max(obj.width, width) : "auto" === obj.width && (isAuto = !0),
|
|
334
335
|
"number" == typeof obj.minWidth && (minWidth = Math.max(obj.minWidth, minWidth)),
|
|
335
336
|
"number" == typeof obj.maxWidth && (maxWidth = Math.max(obj.maxWidth, maxWidth));
|
|
@@ -543,11 +544,11 @@ class PivotHeaderLayoutMap {
|
|
|
543
544
|
return this.getHeaderCellAdress(hd.id);
|
|
544
545
|
}
|
|
545
546
|
getBody(_col, _row) {
|
|
546
|
-
var _a, _b, _c, _d, _e, _f;
|
|
547
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
547
548
|
const paths = this.getCellHeaderPaths(_col, _row);
|
|
548
549
|
if (this.indicatorsAsCol) {
|
|
549
550
|
const indicatorKey = null === (_a = paths.colHeaderPaths.find((colPath => colPath.indicatorKey))) || void 0 === _a ? void 0 : _a.indicatorKey;
|
|
550
|
-
return null !== (
|
|
551
|
+
return null !== (_d = null !== (_c = null === (_b = this._indicators) || void 0 === _b ? void 0 : _b.find((indicator => indicator.indicatorKey === indicatorKey))) && void 0 !== _c ? _c : this._indicators[0]) && void 0 !== _d ? _d : {
|
|
551
552
|
id: "",
|
|
552
553
|
field: void 0,
|
|
553
554
|
indicatorKey: void 0,
|
|
@@ -555,8 +556,8 @@ class PivotHeaderLayoutMap {
|
|
|
555
556
|
define: void 0
|
|
556
557
|
};
|
|
557
558
|
}
|
|
558
|
-
const indicatorKey = null === (
|
|
559
|
-
return null !== (
|
|
559
|
+
const indicatorKey = null === (_e = paths.rowHeaderPaths.find((rowPath => rowPath.indicatorKey))) || void 0 === _e ? void 0 : _e.indicatorKey;
|
|
560
|
+
return null !== (_h = null !== (_g = null === (_f = this._indicators) || void 0 === _f ? void 0 : _f.find((indicator => indicator.indicatorKey === indicatorKey))) && void 0 !== _g ? _g : this._indicators[0]) && void 0 !== _h ? _h : {
|
|
560
561
|
id: "",
|
|
561
562
|
field: void 0,
|
|
562
563
|
indicatorKey: void 0,
|
|
@@ -918,28 +919,28 @@ class PivotHeaderLayoutMap {
|
|
|
918
919
|
}
|
|
919
920
|
}
|
|
920
921
|
setChartInstance(_col, _row, chartInstance) {
|
|
921
|
-
var _a, _b;
|
|
922
|
+
var _a, _b, _c, _d;
|
|
922
923
|
const paths = this.getCellHeaderPaths(_col, _row);
|
|
923
924
|
let indicatorObj;
|
|
924
925
|
if (this.indicatorsAsCol) {
|
|
925
926
|
const indicatorKey = null === (_a = paths.colHeaderPaths.find((colPath => colPath.indicatorKey))) || void 0 === _a ? void 0 : _a.indicatorKey;
|
|
926
|
-
indicatorObj = this._indicators.find((indicator => indicator.indicatorKey === indicatorKey));
|
|
927
|
+
indicatorObj = null === (_b = this._indicators) || void 0 === _b ? void 0 : _b.find((indicator => indicator.indicatorKey === indicatorKey));
|
|
927
928
|
} else {
|
|
928
|
-
const indicatorKey = null === (
|
|
929
|
-
indicatorObj = this._indicators.find((indicator => indicator.indicatorKey === indicatorKey));
|
|
929
|
+
const indicatorKey = null === (_c = paths.rowHeaderPaths.find((rowPath => rowPath.indicatorKey))) || void 0 === _c ? void 0 : _c.indicatorKey;
|
|
930
|
+
indicatorObj = null === (_d = this._indicators) || void 0 === _d ? void 0 : _d.find((indicator => indicator.indicatorKey === indicatorKey));
|
|
930
931
|
}
|
|
931
932
|
indicatorObj && (indicatorObj.chartInstance = chartInstance);
|
|
932
933
|
}
|
|
933
934
|
getChartInstance(_col, _row) {
|
|
934
|
-
var _a, _b;
|
|
935
|
+
var _a, _b, _c, _d;
|
|
935
936
|
const paths = this.getCellHeaderPaths(_col, _row);
|
|
936
937
|
let indicatorObj;
|
|
937
938
|
if (this.indicatorsAsCol) {
|
|
938
939
|
const indicatorKey = null === (_a = paths.colHeaderPaths.find((colPath => colPath.indicatorKey))) || void 0 === _a ? void 0 : _a.indicatorKey;
|
|
939
|
-
indicatorObj = this._indicators.find((indicator => indicator.indicatorKey === indicatorKey));
|
|
940
|
+
indicatorObj = null === (_b = this._indicators) || void 0 === _b ? void 0 : _b.find((indicator => indicator.indicatorKey === indicatorKey));
|
|
940
941
|
} else {
|
|
941
|
-
const indicatorKey = null === (
|
|
942
|
-
indicatorObj = this._indicators.find((indicator => indicator.indicatorKey === indicatorKey));
|
|
942
|
+
const indicatorKey = null === (_c = paths.rowHeaderPaths.find((rowPath => rowPath.indicatorKey))) || void 0 === _c ? void 0 : _c.indicatorKey;
|
|
943
|
+
indicatorObj = null === (_d = this._indicators) || void 0 === _d ? void 0 : _d.find((indicator => indicator.indicatorKey === indicatorKey));
|
|
943
944
|
}
|
|
944
945
|
return null == indicatorObj ? void 0 : indicatorObj.chartInstance;
|
|
945
946
|
}
|
|
@@ -961,8 +962,9 @@ class PivotHeaderLayoutMap {
|
|
|
961
962
|
return (0, get_chart_spec_1.getChartDataId)(col, row, this);
|
|
962
963
|
}
|
|
963
964
|
release() {
|
|
965
|
+
var _a;
|
|
964
966
|
const activeChartInstance = this._table._getActiveChartInstance();
|
|
965
|
-
null == activeChartInstance || activeChartInstance.release(), this._indicators.forEach((indicatorObject => {
|
|
967
|
+
null == activeChartInstance || activeChartInstance.release(), null === (_a = this._indicators) || void 0 === _a || _a.forEach((indicatorObject => {
|
|
966
968
|
var _a;
|
|
967
969
|
null === (_a = indicatorObject.chartInstance) || void 0 === _a || _a.release();
|
|
968
970
|
}));
|