@visactor/vtable 1.17.3-alpha.9 → 1.17.3
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/ListTable.js.map +1 -1
- package/cjs/PivotTable.d.ts +5 -0
- package/cjs/PivotTable.js +15 -2
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/components/react/react-custom-layout.js +3 -2
- package/cjs/components/react/react-custom-layout.js.map +1 -1
- package/cjs/core/BaseTable.js +36 -21
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/TABLE_EVENT_TYPE.d.ts +1 -0
- package/cjs/core/TABLE_EVENT_TYPE.js +1 -0
- package/cjs/core/TABLE_EVENT_TYPE.js.map +1 -1
- package/cjs/core/record-helper.js +2 -2
- package/cjs/core/record-helper.js.map +1 -1
- package/cjs/core/tableHelper.js +1 -1
- package/cjs/core/tableHelper.js.map +1 -1
- package/cjs/dataset/dataset.js +6 -4
- package/cjs/dataset/dataset.js.map +1 -1
- package/cjs/event/event.js +7 -35
- package/cjs/event/event.js.map +1 -1
- package/cjs/event/listener/container-dom.js +1 -1
- package/cjs/event/listener/container-dom.js.map +1 -1
- package/cjs/event/listener/table-group.js +2 -2
- package/cjs/event/listener/table-group.js.map +1 -1
- package/cjs/event/scroll.js +1 -2
- package/cjs/event/self-event-listener/base-table/dbclick-auto-column-width.d.ts +2 -0
- package/cjs/event/self-event-listener/base-table/dbclick-auto-column-width.js +31 -0
- package/cjs/event/self-event-listener/base-table/dbclick-auto-column-width.js.map +1 -0
- package/cjs/event/self-event-listener/base-table/dropdown-menu.d.ts +2 -0
- package/cjs/event/self-event-listener/base-table/dropdown-menu.js +16 -0
- package/cjs/event/self-event-listener/base-table/dropdown-menu.js.map +1 -0
- package/cjs/event/self-event-listener/base-table/icon.d.ts +2 -0
- package/cjs/event/self-event-listener/base-table/icon.js +23 -0
- package/cjs/event/self-event-listener/base-table/icon.js.map +1 -0
- package/cjs/event/self-event-listener/base-table/right-button-click.d.ts +2 -0
- package/cjs/event/self-event-listener/base-table/right-button-click.js +25 -0
- package/cjs/event/self-event-listener/base-table/right-button-click.js.map +1 -0
- package/cjs/event/{list-table → self-event-listener/list-table}/checkbox.d.ts +1 -1
- package/cjs/event/{list-table → self-event-listener/list-table}/checkbox.js +1 -1
- package/cjs/event/self-event-listener/list-table/checkbox.js.map +1 -0
- package/{es/event → cjs/event/self-event-listener}/pivot-chart/axis-click.d.ts +1 -1
- package/cjs/event/{pivot-chart → self-event-listener/pivot-chart}/axis-click.js +1 -1
- package/cjs/event/self-event-listener/pivot-chart/axis-click.js.map +1 -0
- package/cjs/event/{pivot-chart → self-event-listener/pivot-chart}/axis-hover.d.ts +1 -1
- package/cjs/event/{pivot-chart → self-event-listener/pivot-chart}/axis-hover.js +1 -1
- package/cjs/event/self-event-listener/pivot-chart/axis-hover.js.map +1 -0
- package/cjs/event/self-event-listener/pivot-table/drill.d.ts +1 -0
- package/cjs/event/self-event-listener/pivot-table/drill.js +3 -0
- package/cjs/event/self-event-listener/pivot-table/drill.js.map +1 -0
- 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 +5 -7
- package/cjs/layout/chart-helper/get-axis-config.js.map +1 -1
- package/cjs/layout/index.js +2 -1
- package/cjs/layout/pivot-header-layout.js +13 -8
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/layout/simple-header-layout.js +5 -5
- package/cjs/layout/simple-header-layout.js.map +1 -1
- package/cjs/plugins/chartModules.js +1 -1
- package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/rect-contribution-render.js +4 -4
- package/cjs/scenegraph/graphic/contributions/rect-contribution-render.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.js +3 -1
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/radio-cell.js +1 -1
- package/cjs/scenegraph/group-creater/cell-type/radio-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/video-cell.js +4 -2
- package/cjs/scenegraph/group-creater/cell-type/video-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js +1 -1
- package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/proxy.js +6 -6
- package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +6 -6
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/update-position/sort-vertical.js +5 -4
- package/cjs/scenegraph/group-creater/progress/update-position/sort-vertical.js.map +1 -1
- package/cjs/scenegraph/layout/compute-col-width.js +2 -1
- package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
- package/cjs/scenegraph/layout/compute-row-height.js +9 -8
- package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
- package/cjs/scenegraph/layout/frozen.js +5 -5
- package/cjs/scenegraph/layout/frozen.js.map +1 -1
- package/cjs/scenegraph/layout/update-row.js +5 -5
- package/cjs/scenegraph/layout/update-row.js.map +1 -1
- package/cjs/scenegraph/scenegraph.js +1 -1
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/scenegraph/select/create-select-border.js +13 -2
- package/cjs/scenegraph/select/create-select-border.js.map +1 -1
- package/cjs/scenegraph/select/update-select-border.js +5 -1
- package/cjs/scenegraph/select/update-select-border.js.map +1 -1
- package/cjs/state/select/update-position.js +2 -2
- package/cjs/state/select/update-position.js.map +1 -1
- package/cjs/state/state.js +117 -37
- package/cjs/state/state.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +1 -0
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/common.d.ts +3 -1
- package/cjs/ts-types/common.js.map +1 -1
- package/cjs/ts-types/customElement.d.ts +1 -0
- package/cjs/ts-types/customElement.js.map +1 -1
- package/cjs/ts-types/events.d.ts +17 -0
- package/cjs/ts-types/events.js.map +1 -1
- package/cjs/ts-types/list-table/layout-map/api.d.ts +1 -1
- package/cjs/ts-types/list-table/layout-map/api.js.map +1 -1
- package/cjs/ts-types/table-engine.d.ts +2 -1
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/cjs/ts-types/theme.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +514 -213
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.js.map +1 -1
- package/es/PivotTable.d.ts +5 -0
- package/es/PivotTable.js +15 -2
- package/es/PivotTable.js.map +1 -1
- package/es/components/react/react-custom-layout.js +3 -2
- package/es/components/react/react-custom-layout.js.map +1 -1
- package/es/core/BaseTable.js +35 -20
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/TABLE_EVENT_TYPE.d.ts +1 -0
- package/es/core/TABLE_EVENT_TYPE.js +1 -0
- package/es/core/TABLE_EVENT_TYPE.js.map +1 -1
- package/es/core/record-helper.js +2 -2
- package/es/core/record-helper.js.map +1 -1
- package/es/core/tableHelper.js +1 -1
- package/es/core/tableHelper.js.map +1 -1
- package/es/dataset/dataset.js +6 -4
- package/es/dataset/dataset.js.map +1 -1
- package/es/event/event.js +16 -39
- package/es/event/event.js.map +1 -1
- package/es/event/listener/container-dom.js +1 -1
- package/es/event/listener/container-dom.js.map +1 -1
- package/es/event/listener/table-group.js +2 -2
- package/es/event/listener/table-group.js.map +1 -1
- package/es/event/scroll.js +1 -2
- package/es/event/self-event-listener/base-table/dbclick-auto-column-width.d.ts +2 -0
- package/es/event/self-event-listener/base-table/dbclick-auto-column-width.js +25 -0
- package/es/event/self-event-listener/base-table/dbclick-auto-column-width.js.map +1 -0
- package/es/event/self-event-listener/base-table/dropdown-menu.d.ts +2 -0
- package/es/event/self-event-listener/base-table/dropdown-menu.js +8 -0
- package/es/event/self-event-listener/base-table/dropdown-menu.js.map +1 -0
- package/es/event/self-event-listener/base-table/icon.d.ts +2 -0
- package/es/event/self-event-listener/base-table/icon.js +18 -0
- package/es/event/self-event-listener/base-table/icon.js.map +1 -0
- package/es/event/self-event-listener/base-table/right-button-click.d.ts +2 -0
- package/es/event/self-event-listener/base-table/right-button-click.js +17 -0
- package/es/event/self-event-listener/base-table/right-button-click.js.map +1 -0
- package/es/event/{list-table → self-event-listener/list-table}/checkbox.d.ts +1 -1
- package/es/event/{list-table → self-event-listener/list-table}/checkbox.js +2 -2
- package/es/event/self-event-listener/list-table/checkbox.js.map +1 -0
- package/{cjs/event → es/event/self-event-listener}/pivot-chart/axis-click.d.ts +1 -1
- package/es/event/{pivot-chart → self-event-listener/pivot-chart}/axis-click.js +2 -2
- package/es/event/self-event-listener/pivot-chart/axis-click.js.map +1 -0
- package/es/event/{pivot-chart → self-event-listener/pivot-chart}/axis-hover.d.ts +1 -1
- package/es/event/{pivot-chart → self-event-listener/pivot-chart}/axis-hover.js +1 -1
- package/es/event/self-event-listener/pivot-chart/axis-hover.js.map +1 -0
- package/es/event/self-event-listener/pivot-table/drill.d.ts +1 -0
- package/es/event/self-event-listener/pivot-table/drill.js +3 -0
- package/es/event/self-event-listener/pivot-table/drill.js.map +1 -0
- 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 +5 -7
- package/es/layout/chart-helper/get-axis-config.js.map +1 -1
- package/es/layout/index.js +2 -1
- package/es/layout/pivot-header-layout.js +12 -8
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/layout/simple-header-layout.js +5 -5
- package/es/layout/simple-header-layout.js.map +1 -1
- package/es/plugins/chartModules.js +1 -1
- package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
- package/es/scenegraph/graphic/contributions/rect-contribution-render.js +4 -4
- package/es/scenegraph/graphic/contributions/rect-contribution-render.js.map +1 -1
- package/es/scenegraph/group-creater/cell-helper.js +3 -1
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/radio-cell.js +1 -1
- package/es/scenegraph/group-creater/cell-type/radio-cell.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/video-cell.js +4 -2
- package/es/scenegraph/group-creater/cell-type/video-cell.js.map +1 -1
- package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js +1 -1
- package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
- package/es/scenegraph/group-creater/progress/proxy.js +6 -6
- package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +6 -6
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js.map +1 -1
- package/es/scenegraph/group-creater/progress/update-position/sort-vertical.js +5 -4
- package/es/scenegraph/group-creater/progress/update-position/sort-vertical.js.map +1 -1
- package/es/scenegraph/layout/compute-col-width.js +2 -1
- package/es/scenegraph/layout/compute-col-width.js.map +1 -1
- package/es/scenegraph/layout/compute-row-height.js +9 -8
- package/es/scenegraph/layout/compute-row-height.js.map +1 -1
- package/es/scenegraph/layout/frozen.js +5 -5
- package/es/scenegraph/layout/frozen.js.map +1 -1
- package/es/scenegraph/layout/update-row.js +5 -5
- package/es/scenegraph/layout/update-row.js.map +1 -1
- package/es/scenegraph/scenegraph.js +1 -1
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/scenegraph/select/create-select-border.js +13 -2
- package/es/scenegraph/select/create-select-border.js.map +1 -1
- package/es/scenegraph/select/update-select-border.js +5 -1
- package/es/scenegraph/select/update-select-border.js.map +1 -1
- package/es/state/select/update-position.js +2 -2
- package/es/state/select/update-position.js.map +1 -1
- package/es/state/state.js +117 -37
- package/es/state/state.js.map +1 -1
- package/es/ts-types/base-table.d.ts +1 -0
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/common.d.ts +3 -1
- package/es/ts-types/common.js.map +1 -1
- package/es/ts-types/customElement.d.ts +1 -0
- package/es/ts-types/customElement.js.map +1 -1
- package/es/ts-types/events.d.ts +17 -0
- package/es/ts-types/events.js.map +1 -1
- package/es/ts-types/list-table/layout-map/api.d.ts +1 -1
- package/es/ts-types/list-table/layout-map/api.js.map +1 -1
- package/es/ts-types/table-engine.d.ts +2 -1
- package/es/ts-types/table-engine.js.map +1 -1
- package/es/ts-types/theme.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +3 -3
- package/cjs/event/list-table/checkbox.js.map +0 -1
- package/cjs/event/pivot-chart/axis-click.js.map +0 -1
- package/cjs/event/pivot-chart/axis-hover.js.map +0 -1
- package/es/event/list-table/checkbox.js.map +0 -1
- package/es/event/pivot-chart/axis-click.js.map +0 -1
- package/es/event/pivot-chart/axis-hover.js.map +0 -1
|
@@ -27,7 +27,9 @@ export class ReactCustomLayout {
|
|
|
27
27
|
}
|
|
28
28
|
updateCustomCell(componentId, isHeaderCustomLayout) {
|
|
29
29
|
const table = this.table;
|
|
30
|
-
if (table.
|
|
30
|
+
if ("autoWidth" === table.widthMode && table.scenegraph.recalculateColWidths(),
|
|
31
|
+
(table.isAutoRowHeight() || "auto" === table.internalProps.defaultRowHeight && !isHeaderCustomLayout || "auto" === table.internalProps.defaultHeaderRowHeight && isHeaderCustomLayout) && table.scenegraph.recalculateRowHeights(),
|
|
32
|
+
table.isPivotTable()) {
|
|
31
33
|
const ranges = getUpdateCustomCellRangeInPivotTable(componentId, table, isHeaderCustomLayout);
|
|
32
34
|
for (let i = 0; i < ranges.length; i++) {
|
|
33
35
|
const range = ranges[i];
|
|
@@ -37,7 +39,6 @@ export class ReactCustomLayout {
|
|
|
37
39
|
const range = getUpdateCustomCellRangeInListTable(componentId, table, isHeaderCustomLayout);
|
|
38
40
|
for (let col = range.start.col; col <= range.end.col; col++) for (let row = range.start.row; row <= range.end.row; row++) table.scenegraph.updateCellContent(col, row);
|
|
39
41
|
}
|
|
40
|
-
"autoWidth" === table.widthMode && table.scenegraph.recalculateColWidths(), table.isAutoRowHeight() && table.scenegraph.recalculateRowHeights(),
|
|
41
42
|
table.scenegraph.renderSceneGraph();
|
|
42
43
|
}
|
|
43
44
|
getCustomLayoutFunc(col, row) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/react/react-custom-layout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAMxC,MAAM,UAAU,iBAAiB,CAAC,IAA6B;IAC7D,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,EAAE,CAAC,CAAC;IAC5B,OAAO;QACL,aAAa,EAAE,KAAK;QACpB,aAAa,EAAE,IAAI;KACpB,CAAC;AACJ,CAAC;AAED,MAAM,OAAO,iBAAiB;IAU5B,YAAY,KAAmB;QAE7B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,qBAAqB,GAAG,IAAI,GAAG,EAAE,CAAC;QAEvC,IAAI,CAAC,uBAAuB,GAAG,IAAI,GAAG,EAAE,CAAC;QACzC,IAAI,CAAC,0BAA0B,GAAG,IAAI,GAAG,EAAE,CAAC;QAC5C,IAAI,CAAC,2BAA2B,GAAG,IAAI,GAAG,EAAE,CAAC;QAE7C,IAAI,CAAC,6BAA6B,GAAG,IAAI,GAAG,EAAE,CAAC;QAC/C,IAAI,CAAC,gCAAgC,GAAG,IAAI,GAAG,EAAE,CAAC;IACpD,CAAC;IAED,qBAAqB,CAAC,WAAmB,EAAE,oBAA8B;QACvE,IAAI,oBAAoB,EAAE;YACxB,OAAO,IAAI,CAAC,2BAA2B,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;SAC1D;QACD,OAAO,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACrD,CAAC;IAED,qBAAqB,CACnB,WAAmB,EACnB,aAA+B,EAE/B,oBAA8B;QAE9B,IAAI,oBAAoB,EAAE;YACxB,IAAI,CAAC,2BAA2B,CAAC,GAAG,CAAC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,QAAQ,GAAG,CAAC;qBAC5B;iBACF,CAAC;gBACF,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aACpB;SACF;aAAM;YACL,KACE,IAAI,GAAG,GAAG,SAAS,CAAC,sBAAsB,GAAG,WAAW,EACxD,GAAG,GAAG,SAAS,CAAC,QAAQ,EACxB,GAAG,IAAI,aAAa,CAAC,MAAM,EAC3B;gBACA,MAAM,KAAK,GAAG;oBACZ,KAAK,EAAE;wBACL,GAAG,EAAE,SAAS,CAAC,mBAAmB,GAAG,eAAe;wBACpD,GAAG,EAAE,GAAG;qBACT;oBACD,GAAG,EAAE;wBACH,GAAG,EAAE,SAAS,CAAC,QAAQ,GAAG,CAAC;wBAC3B,GAAG,EAAE,GAAG;qBACT;iBACF,CAAC;gBACF,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aACpB;SACF;KACF;IAED,OAAO,MAAM,CAAC;AAQhB,CAAC","file":"react-custom-layout.js","sourcesContent":["import { Group } from './../../vrender';\nimport type { CustomRenderFunctionArg, ICustomLayoutFuc } from '../../ts-types';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport type { PivotHeaderLayoutMap } from '../../layout/pivot-header-layout';\nimport type { SimpleHeaderLayoutMap } from '../../layout';\n\nexport function emptyCustomLayout(args: CustomRenderFunctionArg) {\n const group = new Group({});\n return {\n rootContainer: group,\n renderDefault: true\n };\n}\n\nexport class ReactCustomLayout {\n removeAllContainer: () => void;\n table: BaseTableAPI;\n customLayoutFuncCache: Map<string, ICustomLayoutFuc>;\n reactRemoveGraphicCache: Map<string, (col: number, row: number) => void>;\n reactRemoveAllGraphicCache: Map<string, () => void>;\n headerCustomLayoutFuncCache: Map<string, ICustomLayoutFuc>;\n headerReactRemoveGraphicCache: Map<string, (col: number, row: number) => void>;\n headerReactRemoveAllGraphicCache: Map<string, () => void>;\n // reactContainerCache: Map<number, Map<string, any>>;\n constructor(table: BaseTableAPI) {\n // this.removeAllContainer = removeAllContainer;\n this.table = table;\n this.customLayoutFuncCache = new Map();\n // this.reactContainerCache = new Map();\n this.reactRemoveGraphicCache = new Map();\n this.reactRemoveAllGraphicCache = new Map();\n this.headerCustomLayoutFuncCache = new Map();\n // this.headerCeactContainerCache = new Map();\n this.headerReactRemoveGraphicCache = new Map();\n this.headerReactRemoveAllGraphicCache = new Map();\n }\n\n hasReactCreateGraphic(componentId: string, isHeaderCustomLayout?: boolean) {\n if (isHeaderCustomLayout) {\n return this.headerCustomLayoutFuncCache.has(componentId);\n }\n return this.customLayoutFuncCache.has(componentId);\n }\n\n setReactCreateGraphic(\n componentId: string,\n createGraphic: ICustomLayoutFuc,\n // containerCache: Map<string, any>,\n isHeaderCustomLayout?: boolean\n ) {\n if (isHeaderCustomLayout) {\n this.headerCustomLayoutFuncCache.set(componentId, createGraphic);\n } else {\n this.customLayoutFuncCache.set(componentId, createGraphic);\n }\n // this.reactContainerCache.set(componentId, containerCache);\n }\n\n setReactRemoveGraphic(\n componentId: string,\n removeGraphic: (col: number, row: number) => void,\n isHeaderCustomLayout?: boolean\n ) {\n if (isHeaderCustomLayout) {\n this.headerReactRemoveGraphicCache.set(componentId, removeGraphic);\n } else {\n this.reactRemoveGraphicCache.set(componentId, removeGraphic);\n }\n }\n\n setReactRemoveAllGraphic(componentId: string, removeGraphic: () => void, isHeaderCustomLayout?: boolean) {\n if (isHeaderCustomLayout) {\n this.headerReactRemoveAllGraphicCache.set(componentId, removeGraphic);\n } else {\n this.reactRemoveAllGraphicCache.set(componentId, removeGraphic);\n }\n }\n\n updateCustomCell(componentId: string, isHeaderCustomLayout?: boolean) {\n const table = this.table;\n // const col = componentId;\n // // to do: deal with transpose table\n // if (isHeaderCustomLayout) {\n // for (let row = 0; row < table.columnHeaderLevelCount; row++) {\n // table.scenegraph.updateCellContent(col, row);\n // }\n // } else {\n // for (let row = table.columnHeaderLevelCount; row < table.rowCount; row++) {\n // table.scenegraph.updateCellContent(col, row);\n // }\n // }\n\n if (table.isPivotTable()) {\n const ranges = getUpdateCustomCellRangeInPivotTable(componentId, table, isHeaderCustomLayout);\n for (let i = 0; i < ranges.length; i++) {\n const range = ranges[i];\n for (let col = range.start.col; col <= range.end.col; col++) {\n for (let row = range.start.row; row <= range.end.row; row++) {\n table.scenegraph.updateCellContent(col, row);\n }\n }\n }\n } else {\n const range = getUpdateCustomCellRangeInListTable(componentId, table, isHeaderCustomLayout);\n for (let col = range.start.col; col <= range.end.col; col++) {\n for (let row = range.start.row; row <= range.end.row; row++) {\n table.scenegraph.updateCellContent(col, row);\n }\n }\n }\n if (table.widthMode === 'autoWidth') {\n table.scenegraph.recalculateColWidths();\n }\n if (table.isAutoRowHeight()) {\n table.scenegraph.recalculateRowHeights();\n }\n // table.scenegraph.updateNextFrame();\n table.scenegraph.renderSceneGraph(); // use sync render for faster update\n }\n\n getCustomLayoutFunc(col: number, row: number) {\n const isHeader = this.table.isHeader(col, row);\n if (isHeader) {\n const { componentId } = this.table.getHeaderDefine(col, row) as any;\n return this.headerCustomLayoutFuncCache.get(componentId) ?? emptyCustomLayout;\n }\n const { componentId } = this.table.getBodyColumnDefine(col, row) as any;\n return this.customLayoutFuncCache.get(componentId) || emptyCustomLayout;\n }\n\n removeCustomCell(col: number, row: number) {\n // const { startInTotal } = this.table.getBodyColumnDefine(col, row) as any;\n const isHeader = this.table.isHeader(col, row);\n let removeFun;\n if (isHeader) {\n const define = this.table.getHeaderDefine(col, row);\n const { componentId } = define as any;\n removeFun = this.headerReactRemoveGraphicCache.get(componentId);\n } else {\n const define = this.table.getBodyColumnDefine(col, row);\n const { componentId } = define as any;\n removeFun = this.reactRemoveGraphicCache.get(componentId);\n }\n if (removeFun) {\n removeFun(col, row);\n }\n }\n\n clearCache() {\n this.reactRemoveAllGraphicCache.forEach(removeFun => {\n removeFun();\n });\n this.headerReactRemoveAllGraphicCache.forEach(removeFun => {\n removeFun();\n });\n }\n\n updateAllCustomCell() {\n this.customLayoutFuncCache.forEach((createFun, componentId) => {\n this.updateCustomCell(componentId);\n });\n this.headerCustomLayoutFuncCache.forEach((createFun, componentId) => {\n this.updateCustomCell(componentId, true);\n });\n }\n}\n\nfunction getUpdateCustomCellRangeInListTable(componentId: string, table: BaseTableAPI, isHeaderCustomLayout?: boolean) {\n const rowSeriesNumber = table.internalProps.rowSeriesNumber ? 1 : 0;\n if (isHeaderCustomLayout) {\n const layoutMap = table.internalProps.layoutMap as SimpleHeaderLayoutMap;\n const { headerObjects } = table.internalProps.layoutMap;\n let headerId: number;\n for (let i = 0; i < headerObjects.length; i++) {\n const headerObject = headerObjects[i];\n if ((headerObject.define as any).componentId === componentId) {\n headerId = headerObject.id as number;\n break;\n }\n }\n\n const startCell = layoutMap.getHeaderCellAdressById(headerId);\n const range = layoutMap.getCellRange(startCell.col, startCell.row);\n return range;\n\n // let startCol = -1;\n // let endCol = -1;\n // let startRow = -1;\n // let endRow = -1;\n // for (let i = 0; i < _headerCellIds.length; i++) {\n // const row = _headerCellIds[i];\n // let rowHasObject = false;\n // for (let j = 0; j < row.length; j++) {\n // if (row[j] === headerId) {\n // rowHasObject = true;\n // if (transpose) {\n // // return { col: i, row: j };\n // startCol === -1 && (startCol = i);\n // startRow === -1 && (startRow = j);\n // } else {\n // // return { col: j + this.leftRowSeriesNumberColumnCount, row: i };\n // startCol === -1 && (startCol = j);\n // startRow === -1 && (startRow = i);\n // }\n // } else {\n // if (transpose) {\n // // endCol === -1 && startCol !== -1 && (endCol = i);\n // endRow === -1 && startRow !== -1 && (endRow = j - 1);\n // } else {\n // endCol === -1 && startCol !== -1 && (endCol = j - 1);\n // // endRow === -1 && startRow !== -1 && (endRow = i);\n // }\n // }\n\n // if (startCol !== -1 && endCol !== -1 && startRow !== -1 && endRow !== -1) {\n // break;\n // }\n // }\n\n // if (!rowHasObject) {\n // if (transpose) {\n // endCol === -1 && startCol !== -1 && (endCol = i - 1);\n // } else {\n // endRow === -1 && startRow !== -1 && (endRow = i - 1);\n // }\n // }\n\n // if (startCol !== -1 && endCol !== -1 && startRow !== -1 && endRow !== -1) {\n // break;\n // }\n // }\n\n // return {\n // startCol: startCol + rowSeriesNumber,\n // endCol: endCol + rowSeriesNumber,\n // startRow,\n // endRow\n // };\n }\n const { columnObjects } = table.internalProps.layoutMap;\n for (let i = 0; i < columnObjects.length; i++) {\n const columnObject = columnObjects[i];\n if ((columnObject.define as any).componentId === componentId) {\n return {\n start: {\n col: rowSeriesNumber + i,\n row: table.columnHeaderLevelCount\n },\n end: {\n col: rowSeriesNumber + i,\n row: table.rowCount - 1\n }\n };\n }\n }\n\n return {\n start: {\n col: 0,\n row: 0\n },\n end: {\n col: table.colCount - 1,\n row: table.rowCount - 1\n }\n };\n}\n\nfunction getUpdateCustomCellRangeInPivotTable(\n componentId: string,\n table: BaseTableAPI,\n isHeaderCustomLayout?: boolean\n) {\n const rowSeriesNumber = table.internalProps.rowSeriesNumber ? 1 : 0;\n const ranges = [];\n const layoutMap = table.internalProps.layoutMap as PivotHeaderLayoutMap;\n if (isHeaderCustomLayout) {\n const { headerObjects } = layoutMap;\n const headerIds: number[] = [];\n for (let i = 0; i < headerObjects.length; i++) {\n const headerObject = headerObjects[i];\n if (!headerObject) {\n continue;\n }\n if ((headerObject.define as any).componentId === componentId) {\n headerIds.push(headerObject.id as number);\n }\n }\n\n for (let i = 0; i < headerIds.length; i++) {\n const headerId = headerIds[i];\n const startCell = layoutMap.getHeaderCellAdressById(headerId);\n const range = layoutMap.getCellRange(startCell.col, startCell.row);\n ranges.push(range);\n }\n } else {\n let columnIndex: number;\n const { columnObjects, indicatorsAsCol } = layoutMap;\n for (let i = 0; i < columnObjects.length; i++) {\n const columnObject = columnObjects[i];\n if ((columnObject.define as any).componentId === componentId) {\n columnIndex = i;\n break;\n }\n }\n\n if (indicatorsAsCol) {\n for (\n let column = layoutMap.rowHeaderLevelCount + columnIndex;\n column < layoutMap.colCount;\n column += columnObjects.length\n ) {\n const range = {\n start: {\n col: column + rowSeriesNumber,\n row: layoutMap.columnHeaderLevelCount\n },\n end: {\n col: column + rowSeriesNumber,\n row: layoutMap.rowCount - 1\n }\n };\n ranges.push(range);\n }\n } else {\n for (\n let row = layoutMap.columnHeaderLevelCount + columnIndex;\n row < layoutMap.rowCount;\n row += columnObjects.length\n ) {\n const range = {\n start: {\n col: layoutMap.rowHeaderLevelCount + rowSeriesNumber,\n row: row\n },\n end: {\n col: layoutMap.colCount - 1,\n row: row\n }\n };\n ranges.push(range);\n }\n }\n }\n\n return ranges;\n\n // return {\n // startCol: 0,\n // endCol: table.colCount - 1,\n // startRow: 0,\n // endRow: table.rowCount - 1\n // };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/react/react-custom-layout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAMxC,MAAM,UAAU,iBAAiB,CAAC,IAA6B;IAC7D,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,EAAE,CAAC,CAAC;IAC5B,OAAO;QACL,aAAa,EAAE,KAAK;QACpB,aAAa,EAAE,IAAI;KACpB,CAAC;AACJ,CAAC;AAED,MAAM,OAAO,iBAAiB;IAU5B,YAAY,KAAmB;QAE7B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,qBAAqB,GAAG,IAAI,GAAG,EAAE,CAAC;QAEvC,IAAI,CAAC,uBAAuB,GAAG,IAAI,GAAG,EAAE,CAAC;QACzC,IAAI,CAAC,0BAA0B,GAAG,IAAI,GAAG,EAAE,CAAC;QAC5C,IAAI,CAAC,2BAA2B,GAAG,IAAI,GAAG,EAAE,CAAC;QAE7C,IAAI,CAAC,6BAA6B,GAAG,IAAI,GAAG,EAAE,CAAC;QAC/C,IAAI,CAAC,gCAAgC,GAAG,IAAI,GAAG,EAAE,CAAC;IACpD,CAAC;IAED,qBAAqB,CAAC,WAAmB,EAAE,oBAA8B;QACvE,IAAI,oBAAoB,EAAE;YACxB,OAAO,IAAI,CAAC,2BAA2B,CAAC,GAAG,CAAC,WAAW,CAAC,C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AED,IAAI,eAAe,EAAE;YACnB,KACE,IAAI,MAAM,GAAG,SAAS,CAAC,mBAAmB,GAAG,WAAW,EACxD,MAAM,GAAG,SAAS,CAAC,QAAQ,EAC3B,MAAM,IAAI,aAAa,CAAC,MAAM,EAC9B;gBACA,MAAM,KAAK,GAAG;oBACZ,KAAK,EAAE;wBACL,GAAG,EAAE,MAAM,GAAG,eAAe;wBAC7B,GAAG,EAAE,SAAS,CAAC,sBAAsB;qBACtC;oBACD,GAAG,EAAE;wBACH,GAAG,EAAE,MAAM,GAAG,eAAe;wBAC7B,GAAG,EAAE,SAAS,CAAC,QAAQ,GAAG,CAAC;qBAC5B;iBACF,CAAC;gBACF,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aACpB;SACF;aAAM;YACL,KACE,IAAI,GAAG,GAAG,SAAS,CAAC,sBAAsB,GAAG,WAAW,EACxD,GAAG,GAAG,SAAS,CAAC,QAAQ,EACxB,GAAG,IAAI,aAAa,CAAC,MAAM,EAC3B;gBACA,MAAM,KAAK,GAAG;oBACZ,KAAK,EAAE;wBACL,GAAG,EAAE,SAAS,CAAC,mBAAmB,GAAG,eAAe;wBACpD,GAAG,EAAE,GAAG;qBACT;oBACD,GAAG,EAAE;wBACH,GAAG,EAAE,SAAS,CAAC,QAAQ,GAAG,CAAC;wBAC3B,GAAG,EAAE,GAAG;qBACT;iBACF,CAAC;gBACF,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aACpB;SACF;KACF;IAED,OAAO,MAAM,CAAC;AAQhB,CAAC","file":"react-custom-layout.js","sourcesContent":["import { Group } from './../../vrender';\nimport type { CustomRenderFunctionArg, ICustomLayoutFuc } from '../../ts-types';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport type { PivotHeaderLayoutMap } from '../../layout/pivot-header-layout';\nimport type { SimpleHeaderLayoutMap } from '../../layout';\n\nexport function emptyCustomLayout(args: CustomRenderFunctionArg) {\n const group = new Group({});\n return {\n rootContainer: group,\n renderDefault: true\n };\n}\n\nexport class ReactCustomLayout {\n removeAllContainer: () => void;\n table: BaseTableAPI;\n customLayoutFuncCache: Map<string, ICustomLayoutFuc>;\n reactRemoveGraphicCache: Map<string, (col: number, row: number) => void>;\n reactRemoveAllGraphicCache: Map<string, () => void>;\n headerCustomLayoutFuncCache: Map<string, ICustomLayoutFuc>;\n headerReactRemoveGraphicCache: Map<string, (col: number, row: number) => void>;\n headerReactRemoveAllGraphicCache: Map<string, () => void>;\n // reactContainerCache: Map<number, Map<string, any>>;\n constructor(table: BaseTableAPI) {\n // this.removeAllContainer = removeAllContainer;\n this.table = table;\n this.customLayoutFuncCache = new Map();\n // this.reactContainerCache = new Map();\n this.reactRemoveGraphicCache = new Map();\n this.reactRemoveAllGraphicCache = new Map();\n this.headerCustomLayoutFuncCache = new Map();\n // this.headerCeactContainerCache = new Map();\n this.headerReactRemoveGraphicCache = new Map();\n this.headerReactRemoveAllGraphicCache = new Map();\n }\n\n hasReactCreateGraphic(componentId: string, isHeaderCustomLayout?: boolean) {\n if (isHeaderCustomLayout) {\n return this.headerCustomLayoutFuncCache.has(componentId);\n }\n return this.customLayoutFuncCache.has(componentId);\n }\n\n setReactCreateGraphic(\n componentId: string,\n createGraphic: ICustomLayoutFuc,\n // containerCache: Map<string, any>,\n isHeaderCustomLayout?: boolean\n ) {\n if (isHeaderCustomLayout) {\n this.headerCustomLayoutFuncCache.set(componentId, createGraphic);\n } else {\n this.customLayoutFuncCache.set(componentId, createGraphic);\n }\n // this.reactContainerCache.set(componentId, containerCache);\n }\n\n setReactRemoveGraphic(\n componentId: string,\n removeGraphic: (col: number, row: number) => void,\n isHeaderCustomLayout?: boolean\n ) {\n if (isHeaderCustomLayout) {\n this.headerReactRemoveGraphicCache.set(componentId, removeGraphic);\n } else {\n this.reactRemoveGraphicCache.set(componentId, removeGraphic);\n }\n }\n\n setReactRemoveAllGraphic(componentId: string, removeGraphic: () => void, isHeaderCustomLayout?: boolean) {\n if (isHeaderCustomLayout) {\n this.headerReactRemoveAllGraphicCache.set(componentId, removeGraphic);\n } else {\n this.reactRemoveAllGraphicCache.set(componentId, removeGraphic);\n }\n }\n\n updateCustomCell(componentId: string, isHeaderCustomLayout?: boolean) {\n const table = this.table;\n // const col = componentId;\n // // to do: deal with transpose table\n // if (isHeaderCustomLayout) {\n // for (let row = 0; row < table.columnHeaderLevelCount; row++) {\n // table.scenegraph.updateCellContent(col, row);\n // }\n // } else {\n // for (let row = table.columnHeaderLevelCount; row < table.rowCount; row++) {\n // table.scenegraph.updateCellContent(col, row);\n // }\n // }\n\n if (table.widthMode === 'autoWidth') {\n table.scenegraph.recalculateColWidths();\n }\n if (\n table.isAutoRowHeight() ||\n (table.internalProps.defaultRowHeight === 'auto' && !isHeaderCustomLayout) ||\n (table.internalProps.defaultHeaderRowHeight === 'auto' && isHeaderCustomLayout)\n ) {\n table.scenegraph.recalculateRowHeights();\n }\n\n if (table.isPivotTable()) {\n const ranges = getUpdateCustomCellRangeInPivotTable(componentId, table, isHeaderCustomLayout);\n for (let i = 0; i < ranges.length; i++) {\n const range = ranges[i];\n for (let col = range.start.col; col <= range.end.col; col++) {\n for (let row = range.start.row; row <= range.end.row; row++) {\n table.scenegraph.updateCellContent(col, row);\n }\n }\n }\n } else {\n const range = getUpdateCustomCellRangeInListTable(componentId, table, isHeaderCustomLayout);\n for (let col = range.start.col; col <= range.end.col; col++) {\n for (let row = range.start.row; row <= range.end.row; row++) {\n table.scenegraph.updateCellContent(col, row);\n }\n }\n }\n\n // table.scenegraph.updateNextFrame();\n table.scenegraph.renderSceneGraph(); // use sync render for faster update\n }\n\n getCustomLayoutFunc(col: number, row: number) {\n const isHeader = this.table.isHeader(col, row);\n if (isHeader) {\n const { componentId } = this.table.getHeaderDefine(col, row) as any;\n return this.headerCustomLayoutFuncCache.get(componentId) ?? emptyCustomLayout;\n }\n const { componentId } = this.table.getBodyColumnDefine(col, row) as any;\n return this.customLayoutFuncCache.get(componentId) || emptyCustomLayout;\n }\n\n removeCustomCell(col: number, row: number) {\n // const { startInTotal } = this.table.getBodyColumnDefine(col, row) as any;\n const isHeader = this.table.isHeader(col, row);\n let removeFun;\n if (isHeader) {\n const define = this.table.getHeaderDefine(col, row);\n const { componentId } = define as any;\n removeFun = this.headerReactRemoveGraphicCache.get(componentId);\n } else {\n const define = this.table.getBodyColumnDefine(col, row);\n const { componentId } = define as any;\n removeFun = this.reactRemoveGraphicCache.get(componentId);\n }\n if (removeFun) {\n removeFun(col, row);\n }\n }\n\n clearCache() {\n this.reactRemoveAllGraphicCache.forEach(removeFun => {\n removeFun();\n });\n this.headerReactRemoveAllGraphicCache.forEach(removeFun => {\n removeFun();\n });\n }\n\n updateAllCustomCell() {\n this.customLayoutFuncCache.forEach((createFun, componentId) => {\n this.updateCustomCell(componentId);\n });\n this.headerCustomLayoutFuncCache.forEach((createFun, componentId) => {\n this.updateCustomCell(componentId, true);\n });\n }\n}\n\nfunction getUpdateCustomCellRangeInListTable(componentId: string, table: BaseTableAPI, isHeaderCustomLayout?: boolean) {\n const rowSeriesNumber = table.internalProps.rowSeriesNumber ? 1 : 0;\n if (isHeaderCustomLayout) {\n const layoutMap = table.internalProps.layoutMap as SimpleHeaderLayoutMap;\n const { headerObjects } = table.internalProps.layoutMap;\n let headerId: number;\n for (let i = 0; i < headerObjects.length; i++) {\n const headerObject = headerObjects[i];\n if ((headerObject.define as any).componentId === componentId) {\n headerId = headerObject.id as number;\n break;\n }\n }\n\n const startCell = layoutMap.getHeaderCellAdressById(headerId);\n const range = layoutMap.getCellRange(startCell.col, startCell.row);\n return range;\n\n // let startCol = -1;\n // let endCol = -1;\n // let startRow = -1;\n // let endRow = -1;\n // for (let i = 0; i < _headerCellIds.length; i++) {\n // const row = _headerCellIds[i];\n // let rowHasObject = false;\n // for (let j = 0; j < row.length; j++) {\n // if (row[j] === headerId) {\n // rowHasObject = true;\n // if (transpose) {\n // // return { col: i, row: j };\n // startCol === -1 && (startCol = i);\n // startRow === -1 && (startRow = j);\n // } else {\n // // return { col: j + this.leftRowSeriesNumberColumnCount, row: i };\n // startCol === -1 && (startCol = j);\n // startRow === -1 && (startRow = i);\n // }\n // } else {\n // if (transpose) {\n // // endCol === -1 && startCol !== -1 && (endCol = i);\n // endRow === -1 && startRow !== -1 && (endRow = j - 1);\n // } else {\n // endCol === -1 && startCol !== -1 && (endCol = j - 1);\n // // endRow === -1 && startRow !== -1 && (endRow = i);\n // }\n // }\n\n // if (startCol !== -1 && endCol !== -1 && startRow !== -1 && endRow !== -1) {\n // break;\n // }\n // }\n\n // if (!rowHasObject) {\n // if (transpose) {\n // endCol === -1 && startCol !== -1 && (endCol = i - 1);\n // } else {\n // endRow === -1 && startRow !== -1 && (endRow = i - 1);\n // }\n // }\n\n // if (startCol !== -1 && endCol !== -1 && startRow !== -1 && endRow !== -1) {\n // break;\n // }\n // }\n\n // return {\n // startCol: startCol + rowSeriesNumber,\n // endCol: endCol + rowSeriesNumber,\n // startRow,\n // endRow\n // };\n }\n const { columnObjects } = table.internalProps.layoutMap;\n for (let i = 0; i < columnObjects.length; i++) {\n const columnObject = columnObjects[i];\n if ((columnObject.define as any).componentId === componentId) {\n return {\n start: {\n col: rowSeriesNumber + i,\n row: table.columnHeaderLevelCount\n },\n end: {\n col: rowSeriesNumber + i,\n row: table.rowCount - 1\n }\n };\n }\n }\n\n return {\n start: {\n col: 0,\n row: 0\n },\n end: {\n col: table.colCount - 1,\n row: table.rowCount - 1\n }\n };\n}\n\nfunction getUpdateCustomCellRangeInPivotTable(\n componentId: string,\n table: BaseTableAPI,\n isHeaderCustomLayout?: boolean\n) {\n const rowSeriesNumber = table.internalProps.rowSeriesNumber ? 1 : 0;\n const ranges = [];\n const layoutMap = table.internalProps.layoutMap as PivotHeaderLayoutMap;\n if (isHeaderCustomLayout) {\n const { headerObjects } = layoutMap;\n const headerIds: number[] = [];\n for (let i = 0; i < headerObjects.length; i++) {\n const headerObject = headerObjects[i];\n if (!headerObject) {\n continue;\n }\n if ((headerObject.define as any).componentId === componentId) {\n headerIds.push(headerObject.id as number);\n }\n }\n\n for (let i = 0; i < headerIds.length; i++) {\n const headerId = headerIds[i];\n const startCell = layoutMap.getHeaderCellAdressById(headerId);\n const range = layoutMap.getCellRange(startCell.col, startCell.row);\n ranges.push(range);\n }\n } else {\n let columnIndex: number;\n const { columnObjects, indicatorsAsCol } = layoutMap;\n for (let i = 0; i < columnObjects.length; i++) {\n const columnObject = columnObjects[i];\n if ((columnObject.define as any).componentId === componentId) {\n columnIndex = i;\n break;\n }\n }\n\n if (indicatorsAsCol) {\n for (\n let column = layoutMap.rowHeaderLevelCount + columnIndex;\n column < layoutMap.colCount;\n column += columnObjects.length\n ) {\n const range = {\n start: {\n col: column + rowSeriesNumber,\n row: layoutMap.columnHeaderLevelCount\n },\n end: {\n col: column + rowSeriesNumber,\n row: layoutMap.rowCount - 1\n }\n };\n ranges.push(range);\n }\n } else {\n for (\n let row = layoutMap.columnHeaderLevelCount + columnIndex;\n row < layoutMap.rowCount;\n row += columnObjects.length\n ) {\n const range = {\n start: {\n col: layoutMap.rowHeaderLevelCount + rowSeriesNumber,\n row: row\n },\n end: {\n col: layoutMap.colCount - 1,\n row: row\n }\n };\n ranges.push(range);\n }\n }\n }\n\n return ranges;\n\n // return {\n // startCol: 0,\n // endCol: table.colCount - 1,\n // startRow: 0,\n // endRow: table.rowCount - 1\n // };\n}\n"]}
|
package/es/core/BaseTable.js
CHANGED
|
@@ -90,7 +90,7 @@ export class BaseTable extends EventTarget {
|
|
|
90
90
|
}
|
|
91
91
|
constructor(container, options = {}) {
|
|
92
92
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
93
|
-
if (super(), this.showFrozenIcon = !0, this.version = "1.17.3
|
|
93
|
+
if (super(), this.showFrozenIcon = !0, this.version = "1.17.3", this.id = `VTable${Date.now()}`,
|
|
94
94
|
this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200),
|
|
95
95
|
!container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
|
|
96
96
|
!1 === (null === (_a = options.customConfig) || void 0 === _a ? void 0 : _a.imageAnonymous) && (vglobal.isImageAnonymous = !1);
|
|
@@ -106,7 +106,7 @@ export class BaseTable extends EventTarget {
|
|
|
106
106
|
}, padding && ("number" == typeof padding ? (this.padding.top = padding, this.padding.left = padding,
|
|
107
107
|
this.padding.bottom = padding, this.padding.right = padding) : (padding.top && (this.padding.top = padding.top),
|
|
108
108
|
padding.bottom && (this.padding.bottom = padding.bottom), padding.left && (this.padding.left = padding.left),
|
|
109
|
-
padding.right && (this.padding.right = padding.right))), isValid(canvasHeight)
|
|
109
|
+
padding.right && (this.padding.right = padding.right))), (isValid(canvasHeight) || isValid(canvasWidth)) && (this.canvasSizeSeted = !0),
|
|
110
110
|
this.tableNoFrameWidth = 0, this.tableNoFrameHeight = 0, this.canvasWidth = isNumber(canvasWidth) ? canvasWidth : void 0,
|
|
111
111
|
this.canvasHeight = isNumber(canvasHeight) ? canvasHeight : void 0, this.columnWidthComputeMode = null !== (_b = options.columnWidthComputeMode) && void 0 !== _b ? _b : "normal";
|
|
112
112
|
const internalProps = this.internalProps = {};
|
|
@@ -457,17 +457,20 @@ export class BaseTable extends EventTarget {
|
|
|
457
457
|
}
|
|
458
458
|
}
|
|
459
459
|
_updateSize() {
|
|
460
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
|
|
460
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5;
|
|
461
461
|
const {padding: padding} = this;
|
|
462
462
|
let widthP = 0, heightP = 0;
|
|
463
463
|
if (this.tableX = 0, this.tableY = 0, this.options.canvas && this.options.viewBox) widthP = this.options.viewBox.x2 - this.options.viewBox.x1,
|
|
464
464
|
heightP = this.options.viewBox.y2 - this.options.viewBox.y1, (null === (_a = null == this ? void 0 : this.scenegraph) || void 0 === _a ? void 0 : _a.stage) && (this.options.viewBox ? this.scenegraph.stage.setViewBox(this.options.viewBox, !1) : this.scenegraph.stage.resize(widthP, heightP)); else if ("browser" === Env.mode) {
|
|
465
465
|
const element = this.getElement();
|
|
466
466
|
let widthWithoutPadding = 0, heightWithoutPadding = 0;
|
|
467
|
-
|
|
467
|
+
const isDefWidth = isValid(this.canvasWidth), isDefHeight = isValid(this.canvasHeight);
|
|
468
|
+
this.canvasSizeSeted && (isDefWidth && (widthWithoutPadding = this.canvasWidth),
|
|
469
|
+
isDefHeight && (heightWithoutPadding = this.canvasHeight));
|
|
470
|
+
if ((!isDefWidth || !isDefHeight) && element.parentElement) {
|
|
468
471
|
const computedStyle = element.parentElement.style || window.getComputedStyle(element.parentElement);
|
|
469
|
-
widthWithoutPadding = element.parentElement.offsetWidth - parseInt(computedStyle.paddingLeft
|
|
470
|
-
heightWithoutPadding = element.parentElement.offsetHeight - parseInt(computedStyle.paddingTop || "0px", 10) - parseInt(computedStyle.paddingBottom || "0px", 20),
|
|
472
|
+
isDefWidth || (widthWithoutPadding = element.parentElement.offsetWidth - (parseInt(computedStyle.paddingLeft, 10) || 0) - (parseInt(computedStyle.paddingRight, 10) || 0)),
|
|
473
|
+
isDefHeight || (heightWithoutPadding = element.parentElement.offsetHeight - parseInt(computedStyle.paddingTop || "0px", 10) - parseInt(computedStyle.paddingBottom || "0px", 20)),
|
|
471
474
|
widthWithoutPadding = (null != widthWithoutPadding ? widthWithoutPadding : 1) - (this.options.tableSizeAntiJitter ? 1 : 0),
|
|
472
475
|
heightWithoutPadding = (null != heightWithoutPadding ? heightWithoutPadding : 1) - (this.options.tableSizeAntiJitter ? 1 : 0);
|
|
473
476
|
}
|
|
@@ -476,24 +479,25 @@ export class BaseTable extends EventTarget {
|
|
|
476
479
|
const {canvas: canvas} = this.internalProps;
|
|
477
480
|
widthP = (null !== (_c = null === (_b = canvas.parentElement) || void 0 === _b ? void 0 : _b.offsetWidth) && void 0 !== _c ? _c : 1) - (this.options.tableSizeAntiJitter ? 1 : 0),
|
|
478
481
|
heightP = (null !== (_e = null === (_d = canvas.parentElement) || void 0 === _d ? void 0 : _d.offsetHeight) && void 0 !== _e ? _e : 1) - (this.options.tableSizeAntiJitter ? 1 : 0),
|
|
479
|
-
(null === (_f = null == this ? void 0 : this.scenegraph) || void 0 === _f ? void 0 : _f.stage) ? this.scenegraph.stage.resize(widthP, heightP) : (canvas.style.width = "",
|
|
482
|
+
(null === (_f = null == this ? void 0 : this.scenegraph) || void 0 === _f ? void 0 : _f.stage) ? (null === (_g = this.options) || void 0 === _g ? void 0 : _g.viewBox) && !(null === (_h = this.options) || void 0 === _h ? void 0 : _h.canvas) && this.scenegraph.stage.resize(widthP, heightP) : (canvas.style.width = "",
|
|
480
483
|
canvas.style.height = "", canvas.width = widthP, canvas.height = heightP, canvas.style.width = `${widthP}px`,
|
|
481
|
-
canvas.style.height = `${heightP}px`)
|
|
484
|
+
canvas.style.height = `${heightP}px`), (null === (_j = this.options) || void 0 === _j ? void 0 : _j.viewBox) && (widthP = this.options.viewBox.x2 - this.options.viewBox.x1,
|
|
485
|
+
heightP = this.options.viewBox.y2 - this.options.viewBox.y1), (null === (_k = null == this ? void 0 : this.scenegraph) || void 0 === _k ? void 0 : _k.stage) && (this.options.viewBox ? this.scenegraph.stage.setViewBox(this.options.viewBox, !1) : this.scenegraph.stage.resize(widthP, heightP));
|
|
482
486
|
} else "node" === Env.mode && (widthP = this.canvasWidth - 1, heightP = this.canvasHeight - 1);
|
|
483
487
|
const width = Math.floor(widthP - style.getVerticalScrollBarSize(this.getTheme().scrollStyle)), height = Math.floor(heightP - style.getHorizontalScrollBarSize(this.getTheme().scrollStyle));
|
|
484
|
-
if (null === (
|
|
485
|
-
const lineWidths = toBoxArray(null !== (
|
|
486
|
-
(null === (
|
|
487
|
-
this.tableY = 0, this.tableNoFrameWidth = width - (null !== (
|
|
488
|
-
this.tableNoFrameHeight = height - (null !== (
|
|
489
|
-
this.tableY = (null !== (
|
|
490
|
-
this.tableNoFrameWidth = width - ((null !== (
|
|
491
|
-
this.tableNoFrameHeight = height - ((null !== (
|
|
488
|
+
if (null === (_l = this.internalProps.theme) || void 0 === _l ? void 0 : _l.frameStyle) {
|
|
489
|
+
const lineWidths = toBoxArray(null !== (_o = null === (_m = this.internalProps.theme.frameStyle) || void 0 === _m ? void 0 : _m.borderLineWidth) && void 0 !== _o ? _o : [ null ]), shadowWidths = toBoxArray(null !== (_q = null === (_p = this.internalProps.theme.frameStyle) || void 0 === _p ? void 0 : _p.shadowBlur) && void 0 !== _q ? _q : [ 0 ]);
|
|
490
|
+
(null === (_r = this.theme.frameStyle) || void 0 === _r ? void 0 : _r.innerBorder) ? (this.tableX = 0,
|
|
491
|
+
this.tableY = 0, this.tableNoFrameWidth = width - (null !== (_s = shadowWidths[1]) && void 0 !== _s ? _s : 0),
|
|
492
|
+
this.tableNoFrameHeight = height - (null !== (_t = shadowWidths[2]) && void 0 !== _t ? _t : 0)) : (this.tableX = (null !== (_u = lineWidths[3]) && void 0 !== _u ? _u : 0) + (null !== (_v = shadowWidths[3]) && void 0 !== _v ? _v : 0),
|
|
493
|
+
this.tableY = (null !== (_w = lineWidths[0]) && void 0 !== _w ? _w : 0) + (null !== (_x = shadowWidths[0]) && void 0 !== _x ? _x : 0),
|
|
494
|
+
this.tableNoFrameWidth = width - ((null !== (_y = lineWidths[1]) && void 0 !== _y ? _y : 0) + (null !== (_z = shadowWidths[1]) && void 0 !== _z ? _z : 0)) - ((null !== (_0 = lineWidths[3]) && void 0 !== _0 ? _0 : 0) + (null !== (_1 = shadowWidths[3]) && void 0 !== _1 ? _1 : 0)),
|
|
495
|
+
this.tableNoFrameHeight = height - ((null !== (_2 = lineWidths[0]) && void 0 !== _2 ? _2 : 0) + (null !== (_3 = shadowWidths[0]) && void 0 !== _3 ? _3 : 0)) - ((null !== (_4 = lineWidths[2]) && void 0 !== _4 ? _4 : 0) + (null !== (_5 = shadowWidths[2]) && void 0 !== _5 ? _5 : 0)));
|
|
492
496
|
}
|
|
493
497
|
}
|
|
494
498
|
updateViewBox(newViewBox) {
|
|
495
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
496
|
-
const oldWidth = null !== (
|
|
499
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
500
|
+
const oldWidth = (null !== (_c = null === (_b = null === (_a = this.options) || void 0 === _a ? void 0 : _a.viewBox) || void 0 === _b ? void 0 : _b.x2) && void 0 !== _c ? _c : 0) - (null !== (_f = null === (_e = null === (_d = this.options) || void 0 === _d ? void 0 : _d.viewBox) || void 0 === _e ? void 0 : _e.x1) && void 0 !== _f ? _f : 0), oldHeight = (null !== (_j = null === (_h = null === (_g = this.options) || void 0 === _g ? void 0 : _g.viewBox) || void 0 === _h ? void 0 : _h.y2) && void 0 !== _j ? _j : 0) - (null !== (_m = null === (_l = null === (_k = this.options) || void 0 === _k ? void 0 : _k.viewBox) || void 0 === _l ? void 0 : _l.y1) && void 0 !== _m ? _m : 0), newWidth = newViewBox.x2 - newViewBox.x1, newHeight = newViewBox.y2 - newViewBox.y1;
|
|
497
501
|
this.options.viewBox = newViewBox, oldWidth !== newWidth || oldHeight !== newHeight ? this.resize() : this.scenegraph.stage.setViewBox(this.options.viewBox, !0);
|
|
498
502
|
}
|
|
499
503
|
setViewBoxTransform(a, b, c, d, e, f) {
|
|
@@ -583,7 +587,7 @@ export class BaseTable extends EventTarget {
|
|
|
583
587
|
return this._adjustColWidth(col, this._colWidthDefineToPxWidth(width));
|
|
584
588
|
}
|
|
585
589
|
isAutoRowHeight(row) {
|
|
586
|
-
return "autoHeight" === this.heightMode || (!!this.options.customComputeRowHeight || row >= 0 && row < this.columnHeaderLevelCount
|
|
590
|
+
return "autoHeight" === this.heightMode || (!!this.options.customComputeRowHeight || (row >= 0 && row < this.columnHeaderLevelCount ? "auto" === this.getDefaultRowHeight(row) : "auto" === this.internalProps.defaultRowHeight));
|
|
587
591
|
}
|
|
588
592
|
getColWidth(col) {
|
|
589
593
|
var _a;
|
|
@@ -1191,7 +1195,18 @@ export class BaseTable extends EventTarget {
|
|
|
1191
1195
|
var _a;
|
|
1192
1196
|
if (this.internalProps.customMergeCell) {
|
|
1193
1197
|
const customMerge = this.internalProps.customMergeCell(col, row, this);
|
|
1194
|
-
if (customMerge && customMerge.range && (isValid(customMerge.text) || customMerge.customLayout || customMerge.customRender))
|
|
1198
|
+
if (customMerge && customMerge.range && (isValid(customMerge.text) || customMerge.customLayout || customMerge.customRender)) {
|
|
1199
|
+
return {
|
|
1200
|
+
start: {
|
|
1201
|
+
col: Math.max(customMerge.range.start.col, 0),
|
|
1202
|
+
row: Math.max(customMerge.range.start.row, 0)
|
|
1203
|
+
},
|
|
1204
|
+
end: {
|
|
1205
|
+
col: Math.min(customMerge.range.end.col, this.colCount - 1),
|
|
1206
|
+
row: Math.min(customMerge.range.end.row, this.rowCount - 1)
|
|
1207
|
+
}
|
|
1208
|
+
};
|
|
1209
|
+
}
|
|
1195
1210
|
}
|
|
1196
1211
|
return null === (_a = this.internalProps.layoutMap) || void 0 === _a ? void 0 : _a.getCellRange(col, row);
|
|
1197
1212
|
}
|