@visactor/vtable 0.10.0 → 0.10.1-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/cjs/ListTable.d.ts +1 -2
  2. package/cjs/ListTable.js +2 -5
  3. package/cjs/ListTable.js.map +1 -1
  4. package/cjs/PivotChart.js +10 -8
  5. package/cjs/PivotChart.js.map +1 -1
  6. package/cjs/PivotTable.js +8 -5
  7. package/cjs/PivotTable.js.map +1 -1
  8. package/cjs/components/axis/get-axis-attributes.d.ts +2 -0
  9. package/cjs/components/axis/get-axis-attributes.js +3 -1
  10. package/cjs/components/axis/get-axis-attributes.js.map +1 -1
  11. package/cjs/components/axis/get-axis-component-size.js +65 -33
  12. package/cjs/components/axis/get-axis-component-size.js.map +1 -1
  13. package/cjs/components/tooltip/TooltipHandler.js +2 -0
  14. package/cjs/components/tooltip/TooltipHandler.js.map +1 -1
  15. package/cjs/core/BaseTable.d.ts +4 -2
  16. package/cjs/core/BaseTable.js +29 -30
  17. package/cjs/core/BaseTable.js.map +1 -1
  18. package/cjs/event/drill.js +2 -0
  19. package/cjs/event/drill.js.map +1 -1
  20. package/cjs/event/event.js +1 -1
  21. package/cjs/event/event.js.map +1 -1
  22. package/cjs/event/listener/table-group.js +19 -9
  23. package/cjs/event/listener/table-group.js.map +1 -1
  24. package/cjs/index.d.ts +1 -1
  25. package/cjs/index.js +1 -1
  26. package/cjs/index.js.map +1 -1
  27. package/cjs/layout/pivot-header-layout.d.ts +1 -0
  28. package/cjs/layout/pivot-header-layout.js +28 -4
  29. package/cjs/layout/pivot-header-layout.js.map +1 -1
  30. package/cjs/layout/simple-header-layout.js +22 -10
  31. package/cjs/layout/simple-header-layout.js.map +1 -1
  32. package/cjs/scenegraph/component/table-component.d.ts +3 -3
  33. package/cjs/scenegraph/component/table-component.js +6 -6
  34. package/cjs/scenegraph/component/table-component.js.map +1 -1
  35. package/cjs/scenegraph/component/util.d.ts +1 -1
  36. package/cjs/scenegraph/component/util.js +2 -1
  37. package/cjs/scenegraph/component/util.js.map +1 -1
  38. package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js +1 -3
  39. package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
  40. package/cjs/scenegraph/layout/compute-col-width.js +7 -21
  41. package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
  42. package/cjs/scenegraph/layout/update-width.js +9 -4
  43. package/cjs/scenegraph/layout/update-width.js.map +1 -1
  44. package/cjs/scenegraph/scenegraph.d.ts +1 -0
  45. package/cjs/scenegraph/scenegraph.js +20 -21
  46. package/cjs/scenegraph/scenegraph.js.map +1 -1
  47. package/cjs/scenegraph/utils/update-container.d.ts +2 -0
  48. package/cjs/scenegraph/utils/update-container.js +13 -0
  49. package/cjs/scenegraph/utils/update-container.js.map +1 -0
  50. package/cjs/state/resize/update-resize-column.d.ts +2 -0
  51. package/cjs/state/resize/update-resize-column.js +74 -0
  52. package/cjs/state/resize/update-resize-column.js.map +1 -0
  53. package/cjs/state/sort/index.js +4 -2
  54. package/cjs/state/sort/index.js.map +1 -1
  55. package/cjs/state/state.d.ts +2 -1
  56. package/cjs/state/state.js +5 -24
  57. package/cjs/state/state.js.map +1 -1
  58. package/cjs/ts-types/base-table.d.ts +3 -1
  59. package/cjs/ts-types/base-table.js.map +1 -1
  60. package/cjs/ts-types/events.d.ts +1 -1
  61. package/cjs/ts-types/events.js.map +1 -1
  62. package/dist/vtable.js +1936 -726
  63. package/dist/vtable.min.js +3 -3
  64. package/es/ListTable.d.ts +1 -2
  65. package/es/ListTable.js +2 -5
  66. package/es/ListTable.js.map +1 -1
  67. package/es/PivotChart.js +10 -8
  68. package/es/PivotChart.js.map +1 -1
  69. package/es/PivotTable.js +8 -5
  70. package/es/PivotTable.js.map +1 -1
  71. package/es/components/axis/get-axis-attributes.d.ts +2 -0
  72. package/es/components/axis/get-axis-attributes.js +3 -1
  73. package/es/components/axis/get-axis-attributes.js.map +1 -1
  74. package/es/components/axis/get-axis-component-size.js +65 -33
  75. package/es/components/axis/get-axis-component-size.js.map +1 -1
  76. package/es/components/tooltip/TooltipHandler.js +2 -0
  77. package/es/components/tooltip/TooltipHandler.js.map +1 -1
  78. package/es/core/BaseTable.d.ts +4 -2
  79. package/es/core/BaseTable.js +28 -28
  80. package/es/core/BaseTable.js.map +1 -1
  81. package/es/event/drill.js +2 -0
  82. package/es/event/drill.js.map +1 -1
  83. package/es/event/event.js +1 -1
  84. package/es/event/event.js.map +1 -1
  85. package/es/event/listener/table-group.js +19 -9
  86. package/es/event/listener/table-group.js.map +1 -1
  87. package/es/index.d.ts +1 -1
  88. package/es/index.js +1 -1
  89. package/es/index.js.map +1 -1
  90. package/es/layout/pivot-header-layout.d.ts +1 -0
  91. package/es/layout/pivot-header-layout.js +26 -4
  92. package/es/layout/pivot-header-layout.js.map +1 -1
  93. package/es/layout/simple-header-layout.js +22 -10
  94. package/es/layout/simple-header-layout.js.map +1 -1
  95. package/es/scenegraph/component/table-component.d.ts +3 -3
  96. package/es/scenegraph/component/table-component.js +6 -6
  97. package/es/scenegraph/component/table-component.js.map +1 -1
  98. package/es/scenegraph/component/util.d.ts +1 -1
  99. package/es/scenegraph/component/util.js +2 -1
  100. package/es/scenegraph/component/util.js.map +1 -1
  101. package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js +1 -3
  102. package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
  103. package/es/scenegraph/layout/compute-col-width.js +7 -21
  104. package/es/scenegraph/layout/compute-col-width.js.map +1 -1
  105. package/es/scenegraph/layout/update-width.js +9 -4
  106. package/es/scenegraph/layout/update-width.js.map +1 -1
  107. package/es/scenegraph/scenegraph.d.ts +1 -0
  108. package/es/scenegraph/scenegraph.js +18 -20
  109. package/es/scenegraph/scenegraph.js.map +1 -1
  110. package/es/scenegraph/utils/update-container.d.ts +2 -0
  111. package/es/scenegraph/utils/update-container.js +7 -0
  112. package/es/scenegraph/utils/update-container.js.map +1 -0
  113. package/es/state/resize/update-resize-column.d.ts +2 -0
  114. package/es/state/resize/update-resize-column.js +68 -0
  115. package/es/state/resize/update-resize-column.js.map +1 -0
  116. package/es/state/sort/index.js +4 -2
  117. package/es/state/sort/index.js.map +1 -1
  118. package/es/state/state.d.ts +2 -1
  119. package/es/state/state.js +6 -23
  120. package/es/state/state.js.map +1 -1
  121. package/es/ts-types/base-table.d.ts +3 -1
  122. package/es/ts-types/base-table.js.map +1 -1
  123. package/es/ts-types/events.d.ts +1 -1
  124. package/es/ts-types/events.js.map +1 -1
  125. package/package.json +7 -7
@@ -1 +1 @@
1
- {"version":3,"sources":["PivotTable.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AACvF,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAG7C,MAAM,OAAO,UAAW,SAAQ,SAAS;IAWvC,YAAY,SAAsD,EAAE,OAAsC;;QACxG,IAAI,CAAC,CAAC,SAAS,YAAY,WAAW,CAAC,EAAE;YACvC,OAAO,GAAG,SAAyC,CAAC;YACpD,IAAK,SAA0C,CAAC,SAAS,EAAE;gBACzD,SAAS,GAAI,SAA0C,CAAC,SAAS,CAAC;aACnE;iBAAM;gBACL,SAAS,GAAG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,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;QACpG,OAAO,eAAe,CAAC;IACzB,CAAC;IACD,iBAAiB,CAAC,GAAW,EAAE,GAAW;;QACxC,OAAO,MAAA,IAAI,CAAC,mBAAmB,CAAC,GAAG,EAAE,GAAG,CAAC,0CAAE,cAAc,CAAC;IAC5D,CAAC;IAED,sBAAsB;QACpB,OAAQ,IAAI,CAAC,aAAa,CAAC,SAAkC,CAAC,gBAAgB,KAAK,MAAM,CAAC;IAC5F,CAAC;IAED,WAAW,CAAC,GAAW,EAAE,GAAW,EAAE,IAAY;QAChD,MAAM,cAAc,GAAI,IAAI,CAAC,aAAa,CAAC,SAAkC,CAAC,qBAAqB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAC9G,MAAM,MAAM,GAA0B;YACpC,YAAY,EAAE,cAAc,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,YAAY;YACpE,KAAK,EAAE,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC;YAClC,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC;YACpC,aAAa,EAAE,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC;SAC7C,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","file":"PivotTable.js","sourcesContent":["import type {\n FieldData,\n FieldDef,\n FieldFormat,\n PivotTableAPI,\n SortRules,\n PivotSortState,\n CellAddress,\n ICellHeaderPaths,\n DropDownMenuEventInfo,\n FieldKeyDef,\n PivotTableConstructorOptions,\n IHeaderTreeDefine,\n IDimensionInfo,\n SortOrder\n} from './ts-types';\nimport { HierarchyState } from './ts-types';\nimport { PivotHeaderLayoutMap } from './layout/pivot-header-layout';\nimport { getField } from './data/DataSource';\nimport { PivotLayoutMap } from './layout/pivot-layout';\nimport { FlatDataToObjects } from './dataset/flatDataToObject';\nimport { PIVOT_TABLE_EVENT_TYPE } from './ts-types/pivot-table/PIVOT_TABLE_EVENT_TYPE';\nimport { cellInRange, emptyFn } from './tools/helper';\nimport { Dataset } from './dataset/dataset';\nimport { _setDataSource } from './core/tableHelper';\nimport { BaseTable } from './core/BaseTable';\nimport type { PivotTableProtected } from './ts-types/base-table';\n\nexport class PivotTable extends BaseTable implements PivotTableAPI {\n declare internalProps: PivotTableProtected;\n declare options: PivotTableConstructorOptions;\n pivotSortState: PivotSortState[];\n\n dataset?: Dataset; //数据处理对象 开启数据透视分析的表\n flatDataToObjects?: FlatDataToObjects; //数据处理对象 聚合后的flat数据 转成便于查询的行列二维数组\n // drillMenu: Menu; //上卷下钻的按钮\n // eslint-disable-next-line default-param-last\n constructor(options: PivotTableConstructorOptions);\n constructor(container: HTMLElement, options: PivotTableConstructorOptions);\n constructor(container?: HTMLElement | PivotTableConstructorOptions, options?: PivotTableConstructorOptions) {\n if (!(container instanceof HTMLElement)) {\n options = container as PivotTableConstructorOptions;\n if ((container as PivotTableConstructorOptions).container) {\n container = (container as PivotTableConstructorOptions).container;\n } else {\n container = null;\n }\n }\n super(container as HTMLElement, options);\n if ((options as any).layout) {\n //TODO hack处理之前的demo都是定义到layout上的 所以这里直接并到options中\n Object.assign(options, (options as any).layout);\n }\n this.internalProps.dataConfig = options.dataConfig;\n this.internalProps.enableDataAnalysis = options.enableDataAnalysis;\n if (this.internalProps.enableDataAnalysis && (options.rows || options.columns)) {\n const rowKeys = options.rows.reduce((keys, rowObj) => {\n if (typeof rowObj === 'string') {\n keys.push(rowObj);\n } else {\n keys.push(rowObj.dimensionKey);\n }\n return keys;\n }, []);\n const columnKeys = options.columns.reduce((keys, columnObj) => {\n if (typeof columnObj === 'string') {\n keys.push(columnObj);\n } else {\n keys.push(columnObj.dimensionKey);\n }\n return keys;\n }, []);\n const indicatorKeys =\n options.indicators?.reduce((keys, indicatorObj) => {\n if (typeof indicatorObj === 'string') {\n keys.push(indicatorObj);\n } else {\n keys.push(indicatorObj.indicatorKey);\n }\n return keys;\n }, []) ?? [];\n this.dataset = new Dataset(this.internalProps.dataConfig, rowKeys, columnKeys, indicatorKeys, options.records);\n }\n\n this.refreshHeader();\n\n this.pivotSortState = [];\n if (options.pivotSortState) {\n this.updatePivotSortState(options.pivotSortState);\n }\n\n if (options.dataSource) {\n _setDataSource(this, options.dataSource);\n } else if (options.records) {\n this.setRecords(options.records as any, this.internalProps.sortState);\n } else {\n this.setRecords([]);\n }\n }\n static get EVENT_TYPE(): typeof PIVOT_TABLE_EVENT_TYPE {\n return PIVOT_TABLE_EVENT_TYPE;\n }\n isListTable(): false {\n return false;\n }\n isPivotTable(): true {\n return true;\n }\n isPivotChart(): false {\n return false;\n }\n _canResizeColumn(col: number, row: number): boolean {\n const ifCan = super._canResizeColumn(col, row);\n if (ifCan) {\n if (!this.internalProps.layoutMap.indicatorsAsCol) {\n // 列上是否配置了禁止拖拽列宽的配置项disableColumnResize\n const cellDefine = this.internalProps.layoutMap.getBody(col, this.columnHeaderLevelCount);\n if (cellDefine?.disableColumnResize) {\n return false;\n }\n }\n }\n return ifCan;\n }\n updateOption(options: PivotTableConstructorOptions, accelerateFirstScreen = false) {\n const internalProps = this.internalProps;\n //维护选中状态\n // const range = internalProps.selection.range; //保留原有单元格选中状态\n super.updateOption(options);\n\n // 更新protectedSpace\n internalProps.dataConfig = options.dataConfig;\n internalProps.enableDataAnalysis = options.enableDataAnalysis;\n\n //维护tree树形结构的展开状态\n if (\n options?.rowHierarchyType === 'tree' &&\n (this.internalProps.layoutMap as PivotHeaderLayoutMap).rowHierarchyType === 'tree' &&\n (this.internalProps.layoutMap as PivotHeaderLayoutMap).rowExpandLevel === options?.rowExpandLevel\n ) {\n const beforeRowDimensions = (this.internalProps.layoutMap as PivotHeaderLayoutMap).rowDimensionTree.tree.children;\n (this.internalProps.layoutMap as PivotHeaderLayoutMap).rowTree.forEach(\n (node: IHeaderTreeDefine, index: number) => {\n this.syncHierarchyState(beforeRowDimensions[index], node);\n }\n );\n }\n\n //TODO 这里需要加上判断 dataConfig是否有配置变化\n if (this.internalProps.enableDataAnalysis && (options.rows || options.columns)) {\n const rowKeys = options.rows.reduce((keys, rowObj) => {\n if (typeof rowObj === 'string') {\n keys.push(rowObj);\n } else {\n keys.push(rowObj.dimensionKey);\n }\n return keys;\n }, []);\n const columnKeys = options.columns.reduce((keys, columnObj) => {\n if (typeof columnObj === 'string') {\n keys.push(columnObj);\n } else {\n keys.push(columnObj.dimensionKey);\n }\n return keys;\n }, []);\n const indicatorKeys = options.indicators.reduce((keys, indicatorObj) => {\n if (typeof indicatorObj === 'string') {\n keys.push(indicatorObj);\n } else {\n keys.push(indicatorObj.indicatorKey);\n }\n return keys;\n }, []);\n this.dataset = new Dataset(internalProps.dataConfig, rowKeys, columnKeys, indicatorKeys, options.records);\n }\n // 更新表头\n this.refreshHeader();\n\n // this.hasMedia = null; // 避免重复绑定\n // 清空目前数据\n if (internalProps.releaseList) {\n internalProps.releaseList.forEach(releaseObj => releaseObj?.release?.());\n internalProps.releaseList = null;\n }\n // // 恢复selection状态\n // internalProps.selection.range = range;\n // this._updateSize();\n // 传入新数据\n if (options.dataSource) {\n _setDataSource(this, options.dataSource);\n } else if (options.records) {\n this.setRecords(options.records as any, undefined);\n } else {\n this._resetFrozenColCount();\n // 生成单元格场景树\n this.scenegraph.createSceneGraph();\n this.render();\n }\n\n this.pivotSortState = [];\n if (options.pivotSortState) {\n this.updatePivotSortState(options.pivotSortState);\n }\n return new Promise(resolve => {\n setTimeout(resolve, 0);\n });\n }\n\n refreshHeader(): void {\n const internalProps = this.internalProps;\n\n //原表头绑定的事件 解除掉\n if (internalProps.headerEvents) {\n internalProps.headerEvents.forEach((id: number) => this.off(id));\n }\n const records = this.options.records ?? this.internalProps.records;\n if (this.options.enableDataAnalysis) {\n internalProps.layoutMap = new PivotLayoutMap(this, this.dataset);\n } else if (Array.isArray(this.options.columnTree) || Array.isArray(this.options.rowTree)) {\n internalProps.layoutMap = new PivotHeaderLayoutMap(this);\n //判断如果数据是二维数组 则标识已经分析过 直接从二维数组挨个读取渲染即可\n //不是二维数组 对应是个object json对象 则表示flat数据,需要对应行列维度进行转成方便数据查询的行列树结构\n if (records?.[0]?.constructor !== Array) {\n this.flatDataToObjects = new FlatDataToObjects(\n {\n rows: internalProps.layoutMap.rowDimensionKeys,\n columns: internalProps.layoutMap.colDimensionKeys,\n indicators: internalProps.layoutMap.indicatorKeys,\n indicatorsAsCol: internalProps.layoutMap.indicatorsAsCol,\n indicatorDimensionKey: internalProps.layoutMap.indicatorDimensionKey\n },\n records\n );\n }\n }\n\n //设置列宽\n for (let col = 0; col < internalProps.layoutMap.columnWidths.length; col++) {\n const { width, minWidth, maxWidth } = internalProps.layoutMap.columnWidths?.[col] ?? {};\n // width 为 \"auto\" 时先不存储ColWidth\n if (width && ((typeof width === 'string' && width !== 'auto') || (typeof width === 'number' && width > 0))) {\n this.setColWidth(col, width);\n }\n if (minWidth && ((typeof minWidth === 'number' && minWidth > 0) || typeof minWidth === 'string')) {\n this.setMinColWidth(col, minWidth);\n }\n if (maxWidth && ((typeof maxWidth === 'number' && maxWidth > 0) || typeof maxWidth === 'string')) {\n this.setMaxColWidth(col, maxWidth);\n }\n }\n //刷新表头,原来这里是_refreshRowCount 后改名为_refreshRowColCount 因为表头定义会影响行数,而转置模式下会影响列数\n this.refreshRowColCount();\n }\n\n refreshRowColCount(): void {\n const table = this;\n const { layoutMap } = table.internalProps;\n if (!layoutMap) {\n return;\n }\n table.colCount = layoutMap.colCount ?? 0;\n table.rowCount = layoutMap.rowCount ?? 0;\n table.frozenColCount = layoutMap.rowHeaderLevelCount; //TODO\n table.frozenRowCount = layoutMap.headerLevelCount;\n\n table.bottomFrozenRowCount = this.options.bottomFrozenRowCount ?? 0;\n table.rightFrozenColCount = this.options.rightFrozenColCount ?? 0;\n }\n protected _getSortFuncFromHeaderOption(\n columns: undefined,\n field: FieldDef,\n fieldKey?: FieldKeyDef\n ): ((v1: any, v2: any, order: SortOrder) => 0 | 1 | -1) | undefined {\n return undefined;\n }\n /**\n * Get rowHierarchyType of pivotTable\n */\n get rowHierarchyType(): 'grid' | 'tree' {\n return (this.internalProps.layoutMap as PivotHeaderLayoutMap).rowHierarchyType;\n }\n /**\n * 将现有tree中的的hierarchyState同步到rows透视树中\n * @param sourceNode\n * @param targetNode\n */\n private syncHierarchyState(sourceNode: any, targetNode: IHeaderTreeDefine) {\n if (sourceNode.value === targetNode.value && sourceNode.dimensionKey === targetNode.dimensionKey) {\n targetNode.hierarchyState =\n targetNode.hierarchyState ?? (targetNode?.children ? sourceNode.hierarchyState : undefined);\n targetNode?.children?.forEach((targetChildNode: IHeaderTreeDefine, index: number) => {\n if (sourceNode?.children?.[index] && targetChildNode) {\n this.syncHierarchyState(sourceNode.children[index], targetChildNode);\n }\n });\n }\n }\n\n getRecordIndexByRow(row: number): number {\n const { layoutMap } = this.internalProps;\n return layoutMap.getRecordIndexByRow(row);\n }\n getRecordIndexByCol(col: number): number {\n const { layoutMap } = this.internalProps;\n return layoutMap.getRecordIndexByCol(col);\n }\n getFieldData(field: FieldDef | FieldFormat | undefined, col: number, row: number): FieldData {\n if (field === null || field === undefined) {\n return null;\n }\n const table = this;\n if (table.internalProps.layoutMap.isHeader(col, row)) {\n return null;\n }\n const rowIndex = this.getRecordIndexByRow(row);\n const colIndex = this.getRecordIndexByCol(col);\n const dataValue = table.dataSource?.getField(rowIndex, colIndex);\n if (typeof field !== 'string') {\n //field为函数format\n const cellHeaderPaths = table.internalProps.layoutMap.getCellHeaderPaths(col, row);\n return getField({ dataValue, ...cellHeaderPaths }, field, emptyFn as any);\n }\n return dataValue;\n }\n\n getCellValue(col: number, row: number): FieldData {\n if (this.internalProps.layoutMap.isHeader(col, row)) {\n const { caption, fieldFormat } = this.internalProps.layoutMap.getHeader(col, row);\n return typeof fieldFormat === 'function' ? fieldFormat(caption) : caption;\n }\n if (this.dataset) {\n const colKey = this.dataset.colKeysPath[this.internalProps.layoutMap.getRecordIndexByCol(col)] ?? [];\n const rowKey = this.dataset.rowKeysPath[this.internalProps.layoutMap.getRecordIndexByRow(row)] ?? [];\n const aggregator = this.dataset.getAggregator(\n rowKey[rowKey.length - 1],\n colKey[colKey.length - 1],\n (this.internalProps.layoutMap as PivotLayoutMap).getIndicatorKey(col, row)\n );\n return aggregator.formatValue ? aggregator.formatValue() : '';\n } else if (this.flatDataToObjects) {\n //数据为行列树结构 根据row col获取对应的维度名称 查找到对应值\n const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row);\n const colKeys = cellDimensionPath.colHeaderPaths.map((colPath: any) => {\n return colPath.indicatorKey ?? colPath.value;\n });\n const rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath: any) => {\n return rowPath.indicatorKey ?? rowPath.value;\n });\n const valueNode = this.flatDataToObjects.getTreeNode(\n rowKeys,\n colKeys,\n this.internalProps.layoutMap.getBody(col, row).indicatorKey\n );\n const { fieldFormat } = this.internalProps.layoutMap.getBody(col, row);\n return typeof fieldFormat === 'function' ? fieldFormat(valueNode?.record) : valueNode?.value ?? '';\n }\n const { field, fieldFormat } = this.internalProps.layoutMap.getBody(col, row);\n return this.getFieldData(fieldFormat || field, col, row);\n }\n\n getCellOriginValue(col: number, row: number): FieldData {\n const table = this;\n if (table.internalProps.layoutMap.isHeader(col, row)) {\n const { caption } = table.internalProps.layoutMap.getHeader(col, row);\n return typeof caption === 'function' ? caption() : caption;\n }\n if (this.dataset) {\n const colKey = this.dataset.colKeysPath[this.internalProps.layoutMap.getRecordIndexByCol(col)] ?? [];\n const rowKey = this.dataset.rowKeysPath[this.internalProps.layoutMap.getRecordIndexByRow(row)] ?? [];\n const aggregator = this.dataset.getAggregator(\n rowKey[rowKey.length - 1],\n colKey[colKey.length - 1],\n (this.internalProps.layoutMap as PivotLayoutMap).getIndicatorKey(col, row)\n );\n return aggregator.value ? aggregator.value() : undefined;\n // return ''\n } else if (this.flatDataToObjects) {\n //数据为行列树结构 根据row col获取对应的维度名称 查找到对应值\n const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row);\n const colKeys = cellDimensionPath.colHeaderPaths.map((colPath: any) => {\n return colPath.indicatorKey ?? colPath.value;\n });\n const rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath: any) => {\n return rowPath.indicatorKey ?? rowPath.value;\n });\n const treeNode = this.flatDataToObjects.getTreeNode(\n rowKeys,\n colKeys,\n this.internalProps.layoutMap.getBody(col, row).indicatorKey\n );\n return treeNode?.value;\n }\n const { field } = table.internalProps.layoutMap.getBody(col, row);\n return table.getFieldData(field, col, row);\n }\n\n // 获取原始数据\n getCellOriginRecord(col: number, row: number) {\n const table = this;\n if (table.internalProps.layoutMap.isHeader(col, row)) {\n return undefined;\n }\n if (this.dataset) {\n const colKey = this.dataset.colKeysPath[this.internalProps.layoutMap.getRecordIndexByCol(col)] ?? [];\n const rowKey = this.dataset.rowKeysPath[this.internalProps.layoutMap.getRecordIndexByRow(row)] ?? [];\n const aggregator = this.dataset.getAggregator(\n rowKey[rowKey.length - 1],\n colKey[colKey.length - 1],\n (this.internalProps.layoutMap as PivotLayoutMap).getIndicatorKey(col, row)\n );\n return aggregator.records;\n // return ''\n } else if (this.flatDataToObjects) {\n //数据为行列树结构 根据row col获取对应的维度名称 查找到对应值\n const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row);\n const colKeys = cellDimensionPath.colHeaderPaths.map((colPath: any) => {\n return colPath.indicatorKey ?? colPath.value;\n });\n const rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath: any) => {\n return rowPath.indicatorKey ?? rowPath.value;\n });\n const treeNode = this.flatDataToObjects.getTreeNode(\n rowKeys,\n colKeys,\n this.internalProps.layoutMap.getBody(col, row).indicatorKey\n );\n return treeNode?.record;\n }\n return undefined;\n }\n /**\n * 全量更新排序规则\n * @param sortRules\n */\n updateSortRules(sortRules: SortRules) {\n this.internalProps.dataConfig.sortRules = sortRules;\n this.dataset.updateSortRules(sortRules);\n (this.internalProps.layoutMap as PivotLayoutMap).updateDataset(this.dataset);\n this.render();\n }\n updatePivotSortState(\n pivotSortStateConfig: {\n dimensions: IDimensionInfo[];\n order: SortOrder;\n }[]\n ) {\n // // dimensions: IDimensionInfo[], order: SortOrder\n // // 清空当前 pivot sort 状态\n // const cells = this.pivotSortState.map((cell) => ({ col: cell.col, row: cell.row }));\n // this.pivotSortState.length = 0;\n // cells.map((cell) => {\n // this.invalidateCellRange(this.getCellRange(cell.col, cell.row));\n // });\n\n // 更新 pivot sort 状态\n for (let i = 0; i < pivotSortStateConfig.length; i++) {\n const { dimensions, order } = pivotSortStateConfig[i];\n const cellAddress = (this.internalProps.layoutMap as PivotHeaderLayoutMap).getPivotCellAdress(dimensions);\n\n cellAddress &&\n this.pivotSortState.push({\n col: cellAddress.col,\n row: cellAddress.row,\n order\n });\n }\n\n // // 更新相关单元格样式\n // this.pivotSortState.map((cell) => {\n // this.invalidateCellRange(this.getCellRange(cell.col, cell.row));\n // });\n }\n\n getPivotSortState(col: number, row: number): SortOrder {\n if (!this.pivotSortState) {\n return undefined;\n }\n const cellRange = this.getCellRange(col, row);\n for (let i = 0; i < this.pivotSortState.length; i++) {\n const { col: sortCol, row: sortRow, order } = this.pivotSortState[i];\n\n if (cellInRange(cellRange, sortCol, sortRow)) {\n return order;\n }\n }\n return undefined;\n }\n /**\n * 拖拽移动表头位置\n * @param source 移动源位置\n * @param target 移动目标位置\n */\n moveHeaderPosition(source: CellAddress, target: CellAddress) {\n // 调用布局类 布局数据结构调整为移动位置后的\n const moveContext = (this.internalProps.layoutMap as PivotHeaderLayoutMap).moveHeaderPosition(source, target);\n if (moveContext) {\n if (moveContext.moveType === 'column') {\n // 是扁平数据结构 需要将二维数组this.records进行调整\n if (this.options.records?.[0]?.constructor === Array) {\n for (let row = 0; row < this.internalProps.records.length; row++) {\n const sourceColumns = (this.internalProps.records[row] as unknown as number[]).splice(\n moveContext.sourceIndex - this.rowHeaderLevelCount,\n moveContext.moveSize\n );\n sourceColumns.unshift((moveContext.targetIndex as any) - this.rowHeaderLevelCount, 0 as any);\n Array.prototype.splice.apply(this.internalProps.records[row] as unknown as number[], sourceColumns);\n }\n }\n //colWidthsMap 中存储着每列的宽度 根据移动 sourceCol targetCol 调整其中的位置\n this.colWidthsMap.adjustOrder(moveContext.sourceIndex, moveContext.targetIndex, moveContext.moveSize);\n //下面代码取自refreshHeader列宽设置逻辑\n //设置列宽极限值 TODO 目前是有问题的 最大最小宽度限制 移动列位置后不正确\n for (let col = 0; col < this.internalProps.layoutMap.columnWidths.length; col++) {\n const { minWidth, maxWidth } = this.internalProps.layoutMap.columnWidths?.[col] ?? {};\n if (minWidth && ((typeof minWidth === 'number' && minWidth > 0) || typeof minWidth === 'string')) {\n this.setMinColWidth(col, minWidth);\n }\n if (maxWidth && ((typeof maxWidth === 'number' && maxWidth > 0) || typeof maxWidth === 'string')) {\n this.setMaxColWidth(col, maxWidth);\n }\n }\n } else if (moveContext.moveType === 'row') {\n // 是扁平数据结构 需要将二维数组this.records进行调整\n if (this.options.records?.[0]?.constructor === Array) {\n const sourceRows = (this.internalProps.records as unknown as number[]).splice(\n moveContext.sourceIndex - this.columnHeaderLevelCount,\n moveContext.moveSize\n );\n sourceRows.unshift((moveContext.targetIndex as any) - this.columnHeaderLevelCount, 0 as any);\n Array.prototype.splice.apply(this.internalProps.records, sourceRows);\n }\n //colWidthsMap 中存储着每列的宽度 根据移动 sourceCol targetCol 调整其中的位置\n this.rowHeightsMap.adjustOrder(moveContext.sourceIndex, moveContext.targetIndex, moveContext.moveSize);\n }\n return true;\n }\n return false;\n }\n /**\n * 表头切换层级状态\n * @param col\n * @param row\n */\n toggleHierarchyState(col: number, row: number) {\n const hierarchyState = this.getHierarchyState(col, row);\n if (hierarchyState === HierarchyState.expand) {\n this.fireListeners(PIVOT_TABLE_EVENT_TYPE.TREE_HIERARCHY_STATE_CHANGE, {\n col: col,\n row: row,\n hierarchyState: HierarchyState.collapse\n });\n } else if (hierarchyState === HierarchyState.collapse) {\n this.fireListeners(PIVOT_TABLE_EVENT_TYPE.TREE_HIERARCHY_STATE_CHANGE, {\n col: col,\n row: row,\n hierarchyState: HierarchyState.expand,\n originData: this.getCellOriginRecord(col, row)\n });\n }\n\n const result = (this.internalProps.layoutMap as PivotHeaderLayoutMap).toggleHierarchyState(col, row);\n //影响行数\n this.refreshRowColCount();\n // this.scenegraph.clearCells();\n // this.scenegraph.createSceneGraph();\n // this.invalidate();\n this.clearCellStyleCache();\n this.scenegraph.updateHierarchyIcon(col, row);\n this.scenegraph.updateRow(result.removeCellPositions, result.addCellPositions);\n }\n /**\n * 通过表头的维度值路径来计算单元格位置 getCellAddressByHeaderPaths接口更强大一些 不限表头 不限参数格式\n * @param dimensionPaths\n * @returns\n */\n getHeaderCellAddressByPath(dimensionPaths: IDimensionInfo[]): CellAddress {\n const cellAddress = (this.internalProps.layoutMap as PivotHeaderLayoutMap).getPivotCellAdress(dimensionPaths);\n return cellAddress;\n }\n /**\n * 通过表头的维度值路径来计算单元格位置\n * @param dimensionPaths\n * @returns\n */\n getCellAddressByHeaderPaths(\n dimensionPaths:\n | {\n colHeaderPaths: IDimensionInfo[];\n rowHeaderPaths: IDimensionInfo[];\n }\n | IDimensionInfo[]\n ): CellAddress {\n const cellAddress = (this.internalProps.layoutMap as PivotHeaderLayoutMap).getCellAdressByHeaderPath(\n dimensionPaths\n );\n return cellAddress;\n }\n\n /**\n * 通过传入的坐标 获取该位置当前单元格的维度路径;\n * @param coordinate 从body左上角为原点 coordinate为偏移距离 去计算单元格的headerPath;\n * 如不传coordinate坐标则按取body中左上角第一个单元格的维度路径\n * @returns\n */\n getHeaderPathByXY(coordinate?: { x: number; y: number }): ICellHeaderPaths {\n let cellAddr;\n if (coordinate) {\n cellAddr = this.getCellAt(\n coordinate.x + this.getFrozenColsWidth() + this.scrollLeft + 1,\n coordinate.y + this.getFrozenRowsHeight() + this.scrollTop + 1\n );\n } else {\n cellAddr = this.getCellAt(\n this.getFrozenColsWidth() + this.scrollLeft + 1,\n this.getFrozenRowsHeight() + this.scrollTop + 1\n );\n }\n const cellHeaderPaths = this.internalProps.layoutMap.getCellHeaderPaths(cellAddr.col, cellAddr.row);\n return cellHeaderPaths;\n }\n getHierarchyState(col: number, row: number): HierarchyState {\n return this._getHeaderLayoutMap(col, row)?.hierarchyState;\n }\n\n hasHierarchyTreeHeader() {\n return (this.internalProps.layoutMap as PivotHeaderLayoutMap).rowHierarchyType === 'tree';\n }\n\n getMenuInfo(col: number, row: number, type: string): DropDownMenuEventInfo {\n const dimensionInfos = (this.internalProps.layoutMap as PivotHeaderLayoutMap).getPivotDimensionInfo(col, row);\n const result: DropDownMenuEventInfo = {\n dimensionKey: dimensionInfos[dimensionInfos.length - 1].dimensionKey,\n value: this.getCellValue(col, row),\n cellType: this.getCellType(col, row),\n isPivotCorner: this.isCornerHeader(col, row)\n };\n return result;\n }\n}\n"]}
1
+ {"version":3,"sources":["PivotTable.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AACvF,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAG7C,MAAM,OAAO,UAAW,SAAQ,SAAS;IAWvC,YAAY,SAAsD,EAAE,OAAsC;;QACxG,IAAI,CAAC,CAAC,SAAS,YAAY,WAAW,CAAC,EAAE;YAC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,\n PivotSortState,\n CellAddress,\n ICellHeaderPaths,\n DropDownMenuEventInfo,\n FieldKeyDef,\n PivotTableConstructorOptions,\n IHeaderTreeDefine,\n IDimensionInfo,\n SortOrder\n} from './ts-types';\nimport { HierarchyState } from './ts-types';\nimport { PivotHeaderLayoutMap } from './layout/pivot-header-layout';\nimport { getField } from './data/DataSource';\nimport { PivotLayoutMap } from './layout/pivot-layout';\nimport { FlatDataToObjects } from './dataset/flatDataToObject';\nimport { PIVOT_TABLE_EVENT_TYPE } from './ts-types/pivot-table/PIVOT_TABLE_EVENT_TYPE';\nimport { cellInRange, emptyFn } from './tools/helper';\nimport { Dataset } from './dataset/dataset';\nimport { _setDataSource } from './core/tableHelper';\nimport { BaseTable } from './core/BaseTable';\nimport type { PivotTableProtected } from './ts-types/base-table';\n\nexport class PivotTable extends BaseTable implements PivotTableAPI {\n declare internalProps: PivotTableProtected;\n declare options: PivotTableConstructorOptions;\n pivotSortState: PivotSortState[];\n\n dataset?: Dataset; //数据处理对象 开启数据透视分析的表\n flatDataToObjects?: FlatDataToObjects; //数据处理对象 聚合后的flat数据 转成便于查询的行列二维数组\n // drillMenu: Menu; //上卷下钻的按钮\n // eslint-disable-next-line default-param-last\n constructor(options: PivotTableConstructorOptions);\n constructor(container: HTMLElement, options: PivotTableConstructorOptions);\n constructor(container?: HTMLElement | PivotTableConstructorOptions, options?: PivotTableConstructorOptions) {\n if (!(container instanceof HTMLElement)) {\n options = container as PivotTableConstructorOptions;\n if ((container as PivotTableConstructorOptions).container) {\n container = (container as PivotTableConstructorOptions).container;\n } else {\n container = null;\n }\n }\n super(container as HTMLElement, options);\n if ((options as any).layout) {\n //TODO hack处理之前的demo都是定义到layout上的 所以这里直接并到options中\n Object.assign(options, (options as any).layout);\n }\n this.internalProps.columnResizeType = options.columnResizeType ?? 'column';\n this.internalProps.dataConfig = options.dataConfig;\n this.internalProps.enableDataAnalysis = options.enableDataAnalysis;\n if (this.internalProps.enableDataAnalysis && (options.rows || options.columns)) {\n const rowKeys = options.rows.reduce((keys, rowObj) => {\n if (typeof rowObj === 'string') {\n keys.push(rowObj);\n } else {\n keys.push(rowObj.dimensionKey);\n }\n return keys;\n }, []);\n const columnKeys = options.columns.reduce((keys, columnObj) => {\n if (typeof columnObj === 'string') {\n keys.push(columnObj);\n } else {\n keys.push(columnObj.dimensionKey);\n }\n return keys;\n }, []);\n const indicatorKeys =\n options.indicators?.reduce((keys, indicatorObj) => {\n if (typeof indicatorObj === 'string') {\n keys.push(indicatorObj);\n } else {\n keys.push(indicatorObj.indicatorKey);\n }\n return keys;\n }, []) ?? [];\n this.dataset = new Dataset(this.internalProps.dataConfig, rowKeys, columnKeys, indicatorKeys, options.records);\n }\n\n this.refreshHeader();\n\n this.pivotSortState = [];\n if (options.pivotSortState) {\n this.updatePivotSortState(options.pivotSortState);\n }\n\n if (options.dataSource) {\n _setDataSource(this, options.dataSource);\n } else if (options.records) {\n this.setRecords(options.records as any, this.internalProps.sortState);\n } else {\n this.setRecords([]);\n }\n }\n static get EVENT_TYPE(): typeof PIVOT_TABLE_EVENT_TYPE {\n return PIVOT_TABLE_EVENT_TYPE;\n }\n isListTable(): false {\n return false;\n }\n isPivotTable(): true {\n return true;\n }\n isPivotChart(): false {\n return false;\n }\n _canResizeColumn(col: number, row: number): boolean {\n const ifCan = super._canResizeColumn(col, row);\n if (ifCan) {\n if (!this.internalProps.layoutMap.indicatorsAsCol) {\n // 列上是否配置了禁止拖拽列宽的配置项disableColumnResize\n const cellDefine = this.internalProps.layoutMap.getBody(col, this.columnHeaderLevelCount);\n if (cellDefine?.disableColumnResize) {\n return false;\n }\n }\n }\n return ifCan;\n }\n updateOption(options: PivotTableConstructorOptions, accelerateFirstScreen = false) {\n const internalProps = this.internalProps;\n //维护选中状态\n // const range = internalProps.selection.range; //保留原有单元格选中状态\n super.updateOption(options);\n\n // 更新protectedSpace\n internalProps.columnResizeType = options.columnResizeType ?? 'column';\n internalProps.dataConfig = options.dataConfig;\n internalProps.enableDataAnalysis = options.enableDataAnalysis;\n\n //维护tree树形结构的展开状态\n if (\n options?.rowHierarchyType === 'tree' &&\n (this.internalProps.layoutMap as PivotHeaderLayoutMap).rowHierarchyType === 'tree' &&\n (this.internalProps.layoutMap as PivotHeaderLayoutMap).rowExpandLevel === options?.rowExpandLevel\n ) {\n const beforeRowDimensions = (this.internalProps.layoutMap as PivotHeaderLayoutMap).rowDimensionTree.tree.children;\n (this.internalProps.layoutMap as PivotHeaderLayoutMap).rowTree.forEach(\n (node: IHeaderTreeDefine, index: number) => {\n this.syncHierarchyState(beforeRowDimensions[index], node);\n }\n );\n }\n\n //TODO 这里需要加上判断 dataConfig是否有配置变化\n if (this.internalProps.enableDataAnalysis && (options.rows || options.columns)) {\n const rowKeys = options.rows.reduce((keys, rowObj) => {\n if (typeof rowObj === 'string') {\n keys.push(rowObj);\n } else {\n keys.push(rowObj.dimensionKey);\n }\n return keys;\n }, []);\n const columnKeys = options.columns.reduce((keys, columnObj) => {\n if (typeof columnObj === 'string') {\n keys.push(columnObj);\n } else {\n keys.push(columnObj.dimensionKey);\n }\n return keys;\n }, []);\n const indicatorKeys = options.indicators.reduce((keys, indicatorObj) => {\n if (typeof indicatorObj === 'string') {\n keys.push(indicatorObj);\n } else {\n keys.push(indicatorObj.indicatorKey);\n }\n return keys;\n }, []);\n this.dataset = new Dataset(internalProps.dataConfig, rowKeys, columnKeys, indicatorKeys, options.records);\n }\n // 更新表头\n this.refreshHeader();\n\n // this.hasMedia = null; // 避免重复绑定\n // 清空目前数据\n if (internalProps.releaseList) {\n internalProps.releaseList.forEach(releaseObj => releaseObj?.release?.());\n internalProps.releaseList = null;\n }\n // // 恢复selection状态\n // internalProps.selection.range = range;\n // this._updateSize();\n // 传入新数据\n if (options.dataSource) {\n _setDataSource(this, options.dataSource);\n } else if (options.records) {\n this.setRecords(options.records as any, undefined);\n } else {\n this._resetFrozenColCount();\n // 生成单元格场景树\n this.scenegraph.createSceneGraph();\n this.render();\n }\n\n this.pivotSortState = [];\n if (options.pivotSortState) {\n this.updatePivotSortState(options.pivotSortState);\n }\n return new Promise(resolve => {\n setTimeout(resolve, 0);\n });\n }\n\n refreshHeader(): void {\n const internalProps = this.internalProps;\n\n //原表头绑定的事件 解除掉\n if (internalProps.headerEvents) {\n internalProps.headerEvents.forEach((id: number) => this.off(id));\n }\n const records = this.options.records ?? this.internalProps.records;\n if (this.options.enableDataAnalysis) {\n internalProps.layoutMap = new PivotLayoutMap(this, this.dataset);\n } else if (Array.isArray(this.options.columnTree) || Array.isArray(this.options.rowTree)) {\n internalProps.layoutMap = new PivotHeaderLayoutMap(this);\n //判断如果数据是二维数组 则标识已经分析过 直接从二维数组挨个读取渲染即可\n //不是二维数组 对应是个object json对象 则表示flat数据,需要对应行列维度进行转成方便数据查询的行列树结构\n if (records?.[0]?.constructor !== Array) {\n this.flatDataToObjects = new FlatDataToObjects(\n {\n rows: internalProps.layoutMap.rowDimensionKeys,\n columns: internalProps.layoutMap.colDimensionKeys,\n indicators: internalProps.layoutMap.indicatorKeys,\n indicatorsAsCol: internalProps.layoutMap.indicatorsAsCol,\n indicatorDimensionKey: internalProps.layoutMap.indicatorDimensionKey\n },\n records\n );\n }\n }\n\n //设置列宽\n for (let col = 0; col < internalProps.layoutMap.columnWidths.length; col++) {\n const { width, minWidth, maxWidth } = internalProps.layoutMap.columnWidths?.[col] ?? {};\n // width 为 \"auto\" 时先不存储ColWidth\n if (width && ((typeof width === 'string' && width !== 'auto') || (typeof width === 'number' && width > 0))) {\n this.setColWidth(col, width);\n }\n if (minWidth && ((typeof minWidth === 'number' && minWidth > 0) || typeof minWidth === 'string')) {\n this.setMinColWidth(col, minWidth);\n }\n if (maxWidth && ((typeof maxWidth === 'number' && maxWidth > 0) || typeof maxWidth === 'string')) {\n this.setMaxColWidth(col, maxWidth);\n }\n }\n //刷新表头,原来这里是_refreshRowCount 后改名为_refreshRowColCount 因为表头定义会影响行数,而转置模式下会影响列数\n this.refreshRowColCount();\n }\n\n refreshRowColCount(): void {\n const table = this;\n const { layoutMap } = table.internalProps;\n if (!layoutMap) {\n return;\n }\n table.colCount = layoutMap.colCount ?? 0;\n table.rowCount = layoutMap.rowCount ?? 0;\n table.frozenColCount = layoutMap.rowHeaderLevelCount; //TODO\n table.frozenRowCount = layoutMap.headerLevelCount;\n\n table.bottomFrozenRowCount = this.options.bottomFrozenRowCount ?? 0;\n table.rightFrozenColCount = this.options.rightFrozenColCount ?? 0;\n }\n protected _getSortFuncFromHeaderOption(\n columns: undefined,\n field: FieldDef,\n fieldKey?: FieldKeyDef\n ): ((v1: any, v2: any, order: SortOrder) => 0 | 1 | -1) | undefined {\n return undefined;\n }\n /**\n * Get rowHierarchyType of pivotTable\n */\n get rowHierarchyType(): 'grid' | 'tree' {\n return (this.internalProps.layoutMap as PivotHeaderLayoutMap).rowHierarchyType;\n }\n /**\n * 将现有tree中的的hierarchyState同步到rows透视树中\n * @param sourceNode\n * @param targetNode\n */\n private syncHierarchyState(sourceNode: any, targetNode: IHeaderTreeDefine) {\n if (sourceNode.value === targetNode.value && sourceNode.dimensionKey === targetNode.dimensionKey) {\n targetNode.hierarchyState =\n targetNode.hierarchyState ?? (targetNode?.children ? sourceNode.hierarchyState : undefined);\n targetNode?.children?.forEach((targetChildNode: IHeaderTreeDefine, index: number) => {\n if (sourceNode?.children?.[index] && targetChildNode) {\n this.syncHierarchyState(sourceNode.children[index], targetChildNode);\n }\n });\n }\n }\n\n getRecordIndexByRow(row: number): number {\n const { layoutMap } = this.internalProps;\n return layoutMap.getRecordIndexByRow(row);\n }\n getRecordIndexByCol(col: number): number {\n const { layoutMap } = this.internalProps;\n return layoutMap.getRecordIndexByCol(col);\n }\n getFieldData(field: FieldDef | FieldFormat | undefined, col: number, row: number): FieldData {\n if (field === null || field === undefined) {\n return null;\n }\n const table = this;\n if (table.internalProps.layoutMap.isHeader(col, row)) {\n return null;\n }\n const rowIndex = this.getRecordIndexByRow(row);\n const colIndex = this.getRecordIndexByCol(col);\n const dataValue = table.dataSource?.getField(rowIndex, colIndex);\n if (typeof field !== 'string') {\n //field为函数format\n const cellHeaderPaths = table.internalProps.layoutMap.getCellHeaderPaths(col, row);\n return getField({ dataValue, ...cellHeaderPaths }, field, emptyFn as any);\n }\n return dataValue;\n }\n\n getCellValue(col: number, row: number): FieldData {\n if (this.internalProps.layoutMap.isHeader(col, row)) {\n const { caption, fieldFormat } = this.internalProps.layoutMap.getHeader(col, row);\n return typeof fieldFormat === 'function' ? fieldFormat(caption) : caption;\n }\n if (this.dataset) {\n const colKey = this.dataset.colKeysPath[this.internalProps.layoutMap.getRecordIndexByCol(col)] ?? [];\n const rowKey = this.dataset.rowKeysPath[this.internalProps.layoutMap.getRecordIndexByRow(row)] ?? [];\n const aggregator = this.dataset.getAggregator(\n rowKey[rowKey.length - 1],\n colKey[colKey.length - 1],\n (this.internalProps.layoutMap as PivotLayoutMap).getIndicatorKey(col, row)\n );\n return aggregator.formatValue ? aggregator.formatValue() : '';\n } else if (this.flatDataToObjects) {\n //数据为行列树结构 根据row col获取对应的维度名称 查找到对应值\n const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row);\n const colKeys = cellDimensionPath.colHeaderPaths.map((colPath: any) => {\n return colPath.indicatorKey ?? colPath.value;\n });\n const rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath: any) => {\n return rowPath.indicatorKey ?? rowPath.value;\n });\n const valueNode = this.flatDataToObjects.getTreeNode(\n rowKeys,\n colKeys,\n this.internalProps.layoutMap.getBody(col, row).indicatorKey\n );\n const { fieldFormat } = this.internalProps.layoutMap.getBody(col, row);\n return typeof fieldFormat === 'function' ? fieldFormat(valueNode?.record) : valueNode?.value ?? '';\n }\n const { field, fieldFormat } = this.internalProps.layoutMap.getBody(col, row);\n return this.getFieldData(fieldFormat || field, col, row);\n }\n\n getCellOriginValue(col: number, row: number): FieldData {\n const table = this;\n if (table.internalProps.layoutMap.isHeader(col, row)) {\n const { caption } = table.internalProps.layoutMap.getHeader(col, row);\n return typeof caption === 'function' ? caption() : caption;\n }\n if (this.dataset) {\n const colKey = this.dataset.colKeysPath[this.internalProps.layoutMap.getRecordIndexByCol(col)] ?? [];\n const rowKey = this.dataset.rowKeysPath[this.internalProps.layoutMap.getRecordIndexByRow(row)] ?? [];\n const aggregator = this.dataset.getAggregator(\n rowKey[rowKey.length - 1],\n colKey[colKey.length - 1],\n (this.internalProps.layoutMap as PivotLayoutMap).getIndicatorKey(col, row)\n );\n return aggregator.value ? aggregator.value() : undefined;\n // return ''\n } else if (this.flatDataToObjects) {\n //数据为行列树结构 根据row col获取对应的维度名称 查找到对应值\n const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row);\n const colKeys = cellDimensionPath.colHeaderPaths.map((colPath: any) => {\n return colPath.indicatorKey ?? colPath.value;\n });\n const rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath: any) => {\n return rowPath.indicatorKey ?? rowPath.value;\n });\n const treeNode = this.flatDataToObjects.getTreeNode(\n rowKeys,\n colKeys,\n this.internalProps.layoutMap.getBody(col, row).indicatorKey\n );\n return treeNode?.value;\n }\n const { field } = table.internalProps.layoutMap.getBody(col, row);\n return table.getFieldData(field, col, row);\n }\n\n // 获取原始数据\n getCellOriginRecord(col: number, row: number) {\n const table = this;\n if (table.internalProps.layoutMap.isHeader(col, row)) {\n return undefined;\n }\n if (this.dataset) {\n const colKey = this.dataset.colKeysPath[this.internalProps.layoutMap.getRecordIndexByCol(col)] ?? [];\n const rowKey = this.dataset.rowKeysPath[this.internalProps.layoutMap.getRecordIndexByRow(row)] ?? [];\n const aggregator = this.dataset.getAggregator(\n rowKey[rowKey.length - 1],\n colKey[colKey.length - 1],\n (this.internalProps.layoutMap as PivotLayoutMap).getIndicatorKey(col, row)\n );\n return aggregator.records;\n // return ''\n } else if (this.flatDataToObjects) {\n //数据为行列树结构 根据row col获取对应的维度名称 查找到对应值\n const cellDimensionPath = this.internalProps.layoutMap.getCellHeaderPaths(col, row);\n const colKeys = cellDimensionPath.colHeaderPaths.map((colPath: any) => {\n return colPath.indicatorKey ?? colPath.value;\n });\n const rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath: any) => {\n return rowPath.indicatorKey ?? rowPath.value;\n });\n const treeNode = this.flatDataToObjects.getTreeNode(\n rowKeys,\n colKeys,\n this.internalProps.layoutMap.getBody(col, row).indicatorKey\n );\n return treeNode?.record;\n }\n return undefined;\n }\n /**\n * 全量更新排序规则\n * @param sortRules\n */\n updateSortRules(sortRules: SortRules) {\n this.internalProps.dataConfig.sortRules = sortRules;\n this.dataset.updateSortRules(sortRules);\n (this.internalProps.layoutMap as PivotLayoutMap).updateDataset(this.dataset);\n this.render();\n }\n /**\n * 更新排序状态\n * @param pivotSortStateConfig.dimensions 排序状态维度对应关系;pivotSortStateConfig.order 排序状态\n */\n updatePivotSortState(\n pivotSortStateConfig: {\n dimensions: IDimensionInfo[];\n order: SortOrder;\n }[]\n ) {\n // // dimensions: IDimensionInfo[], order: SortOrder\n // // 清空当前 pivot sort 状态\n // const cells = this.pivotSortState.map((cell) => ({ col: cell.col, row: cell.row }));\n // this.pivotSortState.length = 0;\n // cells.map((cell) => {\n // this.invalidateCellRange(this.getCellRange(cell.col, cell.row));\n // });\n\n // 更新 pivot sort 状态\n for (let i = 0; i < pivotSortStateConfig.length; i++) {\n const { dimensions, order } = pivotSortStateConfig[i];\n const cellAddress = (this.internalProps.layoutMap as PivotHeaderLayoutMap).getPivotCellAdress(dimensions);\n\n cellAddress &&\n this.pivotSortState.push({\n col: cellAddress.col,\n row: cellAddress.row,\n order\n });\n }\n\n // // 更新相关单元格样式\n // this.pivotSortState.map((cell) => {\n // this.invalidateCellRange(this.getCellRange(cell.col, cell.row));\n // });\n }\n\n getPivotSortState(col: number, row: number): SortOrder {\n if (!this.pivotSortState) {\n return undefined;\n }\n const cellRange = this.getCellRange(col, row);\n for (let i = 0; i < this.pivotSortState.length; i++) {\n const { col: sortCol, row: sortRow, order } = this.pivotSortState[i];\n\n if (cellInRange(cellRange, sortCol, sortRow)) {\n return order;\n }\n }\n return undefined;\n }\n /**\n * 拖拽移动表头位置\n * @param source 移动源位置\n * @param target 移动目标位置\n */\n moveHeaderPosition(source: CellAddress, target: CellAddress) {\n // 调用布局类 布局数据结构调整为移动位置后的\n const moveContext = (this.internalProps.layoutMap as PivotHeaderLayoutMap).moveHeaderPosition(source, target);\n if (moveContext) {\n if (moveContext.moveType === 'column') {\n // 是扁平数据结构 需要将二维数组this.records进行调整\n if (this.options.records?.[0]?.constructor === Array) {\n for (let row = 0; row < this.internalProps.records.length; row++) {\n const sourceColumns = (this.internalProps.records[row] as unknown as number[]).splice(\n moveContext.sourceIndex - this.rowHeaderLevelCount,\n moveContext.moveSize\n );\n sourceColumns.unshift((moveContext.targetIndex as any) - this.rowHeaderLevelCount, 0 as any);\n Array.prototype.splice.apply(this.internalProps.records[row] as unknown as number[], sourceColumns);\n }\n }\n //colWidthsMap 中存储着每列的宽度 根据移动 sourceCol targetCol 调整其中的位置\n this.colWidthsMap.adjustOrder(moveContext.sourceIndex, moveContext.targetIndex, moveContext.moveSize);\n //下面代码取自refreshHeader列宽设置逻辑\n //设置列宽极限值 TODO 目前是有问题的 最大最小宽度限制 移动列位置后不正确\n for (let col = 0; col < this.internalProps.layoutMap.columnWidths.length; col++) {\n const { minWidth, maxWidth } = this.internalProps.layoutMap.columnWidths?.[col] ?? {};\n if (minWidth && ((typeof minWidth === 'number' && minWidth > 0) || typeof minWidth === 'string')) {\n this.setMinColWidth(col, minWidth);\n }\n if (maxWidth && ((typeof maxWidth === 'number' && maxWidth > 0) || typeof maxWidth === 'string')) {\n this.setMaxColWidth(col, maxWidth);\n }\n }\n } else if (moveContext.moveType === 'row') {\n // 是扁平数据结构 需要将二维数组this.records进行调整\n if (this.options.records?.[0]?.constructor === Array) {\n const sourceRows = (this.internalProps.records as unknown as number[]).splice(\n moveContext.sourceIndex - this.columnHeaderLevelCount,\n moveContext.moveSize\n );\n sourceRows.unshift((moveContext.targetIndex as any) - this.columnHeaderLevelCount, 0 as any);\n Array.prototype.splice.apply(this.internalProps.records, sourceRows);\n }\n //colWidthsMap 中存储着每列的宽度 根据移动 sourceCol targetCol 调整其中的位置\n this.rowHeightsMap.adjustOrder(moveContext.sourceIndex, moveContext.targetIndex, moveContext.moveSize);\n }\n return true;\n }\n return false;\n }\n /**\n * 表头切换层级状态\n * @param col\n * @param row\n */\n toggleHierarchyState(col: number, row: number) {\n const hierarchyState = this.getHierarchyState(col, row);\n if (hierarchyState === HierarchyState.expand) {\n this.fireListeners(PIVOT_TABLE_EVENT_TYPE.TREE_HIERARCHY_STATE_CHANGE, {\n col: col,\n row: row,\n hierarchyState: HierarchyState.collapse\n });\n } else if (hierarchyState === HierarchyState.collapse) {\n this.fireListeners(PIVOT_TABLE_EVENT_TYPE.TREE_HIERARCHY_STATE_CHANGE, {\n col: col,\n row: row,\n hierarchyState: HierarchyState.expand,\n originData: this.getCellOriginRecord(col, row)\n });\n }\n\n const result = (this.internalProps.layoutMap as PivotHeaderLayoutMap).toggleHierarchyState(col, row);\n //影响行数\n this.refreshRowColCount();\n // this.scenegraph.clearCells();\n // this.scenegraph.createSceneGraph();\n // this.invalidate();\n this.clearCellStyleCache();\n this.scenegraph.updateHierarchyIcon(col, row);\n this.scenegraph.updateRow(result.removeCellPositions, result.addCellPositions);\n }\n /**\n * 通过表头的维度值路径来计算单元格位置 getCellAddressByHeaderPaths接口更强大一些 不限表头 不限参数格式\n * @param dimensionPaths\n * @returns\n */\n getHeaderCellAddressByPath(dimensionPaths: IDimensionInfo[]): CellAddress {\n const cellAddress = (this.internalProps.layoutMap as PivotHeaderLayoutMap).getPivotCellAdress(dimensionPaths);\n return cellAddress;\n }\n /**\n * 通过表头的维度值路径来计算单元格位置\n * @param dimensionPaths\n * @returns\n */\n getCellAddressByHeaderPaths(\n dimensionPaths:\n | {\n colHeaderPaths: IDimensionInfo[];\n rowHeaderPaths: IDimensionInfo[];\n }\n | IDimensionInfo[]\n ): CellAddress {\n const cellAddress = (this.internalProps.layoutMap as PivotHeaderLayoutMap).getCellAdressByHeaderPath(\n dimensionPaths\n );\n return cellAddress;\n }\n\n /**\n * 通过传入的坐标 获取该位置当前单元格的维度路径;\n * @param coordinate 从body左上角为原点 coordinate为偏移距离 去计算单元格的headerPath;\n * 如不传coordinate坐标则按取body中左上角第一个单元格的维度路径\n * @returns\n */\n getHeaderPathByXY(coordinate?: { x: number; y: number }): ICellHeaderPaths {\n let cellAddr;\n if (coordinate) {\n cellAddr = this.getCellAt(\n coordinate.x + this.getFrozenColsWidth() + this.scrollLeft + 1,\n coordinate.y + this.getFrozenRowsHeight() + this.scrollTop + 1\n );\n } else {\n cellAddr = this.getCellAt(\n this.getFrozenColsWidth() + this.scrollLeft + 1,\n this.getFrozenRowsHeight() + this.scrollTop + 1\n );\n }\n const cellHeaderPaths = this.internalProps.layoutMap.getCellHeaderPaths(cellAddr.col, cellAddr.row);\n return cellHeaderPaths;\n }\n getHierarchyState(col: number, row: number): HierarchyState {\n return this._getHeaderLayoutMap(col, row)?.hierarchyState;\n }\n\n hasHierarchyTreeHeader() {\n return (this.internalProps.layoutMap as PivotHeaderLayoutMap).rowHierarchyType === 'tree';\n }\n\n getMenuInfo(col: number, row: number, type: string): DropDownMenuEventInfo {\n const dimensionInfos = (this.internalProps.layoutMap as PivotHeaderLayoutMap).getPivotDimensionInfo(col, row);\n const result: DropDownMenuEventInfo = {\n dimensionKey: dimensionInfos[dimensionInfos.length - 1].dimensionKey,\n value: this.getCellValue(col, row),\n cellType: this.getCellType(col, row),\n isPivotCorner: this.isCornerHeader(col, row)\n };\n return result;\n }\n}\n"]}
@@ -65,6 +65,7 @@ export declare const commonAxis: {
65
65
  };
66
66
  };
67
67
  export declare function getAxisAttributes(option: ICellAxisOption): {
68
+ orient: import("@visactor/vchart/esm/typings").IOrientType;
68
69
  select: boolean;
69
70
  hover: boolean;
70
71
  line: any;
@@ -75,6 +76,7 @@ export declare function getAxisAttributes(option: ICellAxisOption): {
75
76
  style: any;
76
77
  formatMethod: (value: any, datum: any, index: number) => string | string[];
77
78
  state: any;
79
+ containerAlign: "left" | "top" | "right" | "center" | "middle" | "bottom";
78
80
  };
79
81
  tick: {
80
82
  visible: boolean;
@@ -93,6 +93,7 @@ export function getAxisAttributes(option) {
93
93
  let titleTextStyle, titleAngle = null !== (_b = null === (_a = spec.title) || void 0 === _a ? void 0 : _a.angle) && void 0 !== _b ? _b : 0;
94
94
  return "left" !== spec.orient && "right" !== spec.orient || (null === (_c = spec.title) || void 0 === _c ? void 0 : _c.autoRotate) && isNil(spec.title.angle) && (titleAngle = "left" === spec.orient ? -90 : 90,
95
95
  titleTextStyle = DEFAULT_TITLE_STYLE[spec.orient]), {
96
+ orient: spec.orient,
96
97
  select: spec.select,
97
98
  hover: spec.hover,
98
99
  line: transformAxisLineStyle(spec.domainLine),
@@ -102,7 +103,8 @@ export function getAxisAttributes(option) {
102
103
  inside: spec.label.inside,
103
104
  style: transformToGraphic(spec.label.style),
104
105
  formatMethod: spec.label.formatMethod ? (value, datum, index) => spec.label.formatMethod(datum.rawValue, datum) : null,
105
- state: transformStateStyle(spec.label.state)
106
+ state: transformStateStyle(spec.label.state),
107
+ containerAlign: spec.label.containerAlign
106
108
  },
107
109
  tick: {
108
110
  visible: spec.tick.visible,
@@ -1 +1 @@
1
- {"version":3,"sources":["components/axis/get-axis-attributes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAGpG,MAAM,mBAAmB,GAAG;IAC1B,IAAI,EAAE;QACJ,SAAS,EAAE,QAAQ;QACnB,YAAY,EAAE,QAAQ;KACvB;IACD,KAAK,EAAE;QACL,SAAS,EAAE,QAAQ;QACnB,YAAY,EAAE,QAAQ;KACvB;IACD,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,EAAE;CACV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KAAK,CAAC;gBAC3C,KAAK,EAAE,mBAAmB,CAAC,MAAA,IAAI,CAAC,KAAK,CAAC,KAAK,0CAAE,KAAK,CAAC;gBACnD,UAAU,EAAE,mBAAmB,CAAC,MAAA,IAAI,CAAC,KAAK,CAAC,UAAU,0CAAE,KAAK,CAAC;aAC9D;SACF;QACD,KAAK,EAAE;YACL,OAAO,EAAE,MAAA,IAAI,CAAC,UAAU,0CAAE,OAAO;YACjC,KAAK,EAAE,kBAAkB,CAAC,MAAA,IAAI,CAAC,UAAU,0CAAE,KAAK,CAAC;YACjD,KAAK,EAAE,mBAAmB,CAAC,MAAA,IAAI,CAAC,UAAU,0CAAE,KAAK,CAAC;SACnD;KACF,CAAC;AACJ,CAAC","file":"get-axis-attributes.js","sourcesContent":["import { degreeToRadian, isNil, merge } from '@visactor/vutils';\nimport { transformAxisLineStyle, transformStateStyle, transformToGraphic } from '../util/transform';\nimport type { ICellAxisOption } from '../../ts-types/component/axis';\n\nconst DEFAULT_TITLE_STYLE = {\n left: {\n textAlign: 'center',\n textBaseline: 'bottom'\n },\n right: {\n textAlign: 'center',\n textBaseline: 'bottom'\n },\n radius: {},\n angle: {}\n};\n\nconst DEFAULT_TEXT_FONT_FAMILY =\n // eslint-disable-next-line max-len\n 'PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol';\n\nconst DEFAULT_TEXT_FONT_SIZE = 14;\n\nconst THEME_CONSTANTS = {\n FONT_FAMILY: DEFAULT_TEXT_FONT_FAMILY,\n LABEL_FONT_SIZE: DEFAULT_TEXT_FONT_SIZE,\n MAP_LABEL_FONT_SIZE: 10,\n TITLE_FONT_SIZE: 18,\n AXIS_TICK_SIZE: 4\n};\n\nexport const commonAxis = {\n domainLine: {\n visible: true,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n grid: {\n visible: true,\n style: {\n lineWidth: 1,\n stroke: '#EBEDF2',\n strokeOpacity: 1,\n lineDash: [] as any[]\n }\n },\n subGrid: {\n visible: false,\n style: {\n lineWidth: 1,\n stroke: '#EBEDF2',\n strokeOpacity: 1,\n lineDash: [4, 4]\n }\n },\n tick: {\n visible: true,\n tickSize: THEME_CONSTANTS.AXIS_TICK_SIZE,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n subTick: {\n visible: false,\n tickSize: THEME_CONSTANTS.AXIS_TICK_SIZE / 2,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n label: {\n visible: true,\n space: 1, // hack: VChart中为0,为了方便fs调试暂时改为1\n style: {\n fontSize: THEME_CONSTANTS.LABEL_FONT_SIZE,\n fill: '#89909D',\n fontWeight: 'normal',\n fillOpacity: 1\n }\n },\n title: {\n space: 10,\n style: {\n fontSize: THEME_CONSTANTS.LABEL_FONT_SIZE,\n fill: '#333333',\n fontWeight: 'normal',\n fillOpacity: 1\n }\n }\n};\n\nexport function getAxisAttributes(option: ICellAxisOption) {\n // const spec = merge({}, option, commonAxis);\n const spec = option;\n let titleAngle = spec.title?.angle ?? 0;\n let titleTextStyle;\n if (spec.orient === 'left' || spec.orient === 'right') {\n // 处理纵轴的标题样式\n if (spec.title?.autoRotate && isNil(spec.title.angle)) {\n titleAngle = spec.orient === 'left' ? -90 : 90;\n titleTextStyle = DEFAULT_TITLE_STYLE[spec.orient];\n }\n }\n\n return {\n select: spec.select,\n hover: spec.hover,\n line: transformAxisLineStyle(spec.domainLine),\n label: {\n visible: spec.label.visible,\n space: spec.label.space,\n inside: spec.label.inside,\n style:\n // isFunction(spec.label.style)\n // ? (datum: Datum, index: number) => {\n // const style = this._preprocessSpec(spec.label.style(datum.rawValue, index, datum));\n\n // return transformToGraphic(this._preprocessSpec(merge({}, this._theme.label?.style, style)));\n // }\n // :\n transformToGraphic(spec.label.style),\n formatMethod: spec.label.formatMethod\n ? (value: any, datum: any, index: number) => {\n return spec.label.formatMethod(datum.rawValue, datum);\n }\n : null,\n state: transformStateStyle(spec.label.state)\n },\n tick: {\n visible: spec.tick.visible,\n length: spec.tick.tickSize,\n inside: spec.tick.inside,\n alignWithLabel: spec.tick.alignWithLabel,\n style:\n // isFunction(spec.tick.style)\n // ? (datum: Datum, index: number) => {\n // const style = this._preprocessSpec(spec.tick.style(datum.rawValue, index, datum));\n\n // return transformToGraphic(this._preprocessSpec(merge({}, this._theme.tick?.style, style)));\n // }\n // :\n transformToGraphic(spec.tick.style),\n state: transformStateStyle(spec.tick.state)\n },\n subTick: {\n visible: spec.subTick.visible,\n length: spec.subTick.tickSize,\n inside: spec.subTick.inside,\n count: spec.subTick.tickCount,\n style: transformToGraphic(spec.subTick.style),\n state: transformStateStyle(spec.subTick.state)\n },\n grid: {\n type: 'line',\n visible: spec.grid.visible,\n alternateColor: spec.grid.alternateColor,\n alignWithLabel: spec.grid.alignWithLabel,\n style:\n // isFunction(spec.grid.style)\n // ? (datum: Datum, index: number) => {\n // const style = spec.grid.style(datum.datum?.rawValue, index, datum.datum);\n\n // return transformToGraphic(this._preprocessSpec(merge({}, this._theme.grid?.style, style)));\n // }\n // :\n transformToGraphic(spec.grid.style)\n },\n subGrid: {\n type: 'line',\n visible: spec.subGrid.visible,\n alternateColor: spec.subGrid.alternateColor,\n style: transformToGraphic(spec.subGrid.style)\n },\n title: {\n visible: spec.title.visible,\n position: spec.title.position,\n space: spec.title.space,\n autoRotate: false, // 默认不对外提供该配置\n angle: titleAngle ? degreeToRadian(titleAngle) : null,\n textStyle: merge({}, titleTextStyle, transformToGraphic(spec.title.style)),\n padding: spec.title.padding,\n shape: {\n visible: spec.title.shape?.visible,\n space: spec.title.shape?.space,\n style: transformToGraphic(spec.title.shape?.style)\n },\n background: {\n visible: spec.title.background?.visible,\n style: transformToGraphic(spec.title.background?.style)\n },\n state: {\n text: transformStateStyle(spec.title.state),\n shape: transformStateStyle(spec.title.shape?.state),\n background: transformStateStyle(spec.title.background?.state)\n }\n },\n panel: {\n visible: spec.background?.visible,\n style: transformToGraphic(spec.background?.style),\n state: transformStateStyle(spec.background?.state)\n }\n };\n}\n"]}
1
+ {"version":3,"sources":["components/axis/get-axis-attributes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAGpG,MAAM,mBAAmB,GAAG;IAC1B,IAAI,EAAE;QACJ,SAAS,EAAE,QAAQ;QACnB,YAAY,EAAE,QAAQ;KACvB;IACD,KAAK,EAAE;QACL,SAAS,EAAE,QAAQ;QACnB,YAAY,EAAE,QAAQ;KACvB;IACD,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,EAAE;CACV,CAAC;AAEF,MAAM,wBAAwB,GAE5B,kJAAkJ,CAAC;AAErJ,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAElC,MAAM,eAAe,GAAG;IACtB,WAAW,EAAE,wBAAwB;IACrC,eAAe,EAAE,sBAAsB;IACvC,mBAAmB,EAAE,EAAE;IACvB,eAAe,EAAE,EAAE;IACnB,cAAc,EAAE,CAAC;CAClB,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,UAAU,EAAE;QACV,OAAO,EAAE,IAAI;QACb,KAAK,EAAE;YACL,SAAS,EAAE,CAAC;YACZ,MAAM,EAAE,SAAS;YACjB,aAAa,EAAE,CAAC;SACjB;KACF;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,IAAI;QACb,KAAK,EAAE;YACL,SAAS,EAAE,CAAC;YACZ,MAAM,EAAE,SAAS;YACjB,aAAa,EAAE,CAAC;YAChB,QAAQ,EAAE,EAAW;SACtB;KACF;IACD,OAAO,EAAE;QACP,OAAO,EAAE,KAAK;QACd,KAAK,EAAE;YACL,SAAS,EAAE,CAAC;YACZ,MAAM,EAAE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AAE,cAAc,EAAE,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAC1E,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO;YAC3B,KAAK,EAAE;gBACL,OAAO,EAAE,MAAA,IAAI,CAAC,KAAK,CAAC,KAAK,0CAAE,OAAO;gBAClC,KAAK,EAAE,MAAA,IAAI,CAAC,KAAK,CAAC,KAAK,0CAAE,KAAK;gBAC9B,KAAK,EAAE,kBAAkB,CAAC,MAAA,IAAI,CAAC,KAAK,CAAC,KAAK,0CAAE,KAAK,CAAC;aACnD;YACD,UAAU,EAAE;gBACV,OAAO,EAAE,MAAA,IAAI,CAAC,KAAK,CAAC,UAAU,0CAAE,OAAO;gBACvC,KAAK,EAAE,kBAAkB,CAAC,MAAA,IAAI,CAAC,KAAK,CAAC,UAAU,0CAAE,KAAK,CAAC;aACxD;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;gBAC3C,KAAK,EAAE,mBAAmB,CAAC,MAAA,IAAI,CAAC,KAAK,CAAC,KAAK,0CAAE,KAAK,CAAC;gBACnD,UAAU,EAAE,mBAAmB,CAAC,MAAA,IAAI,CAAC,KAAK,CAAC,UAAU,0CAAE,KAAK,CAAC;aAC9D;SACF;QACD,KAAK,EAAE;YACL,OAAO,EAAE,MAAA,IAAI,CAAC,UAAU,0CAAE,OAAO;YACjC,KAAK,EAAE,kBAAkB,CAAC,MAAA,IAAI,CAAC,UAAU,0CAAE,KAAK,CAAC;YACjD,KAAK,EAAE,mBAAmB,CAAC,MAAA,IAAI,CAAC,UAAU,0CAAE,KAAK,CAAC;SACnD;KACF,CAAC;AACJ,CAAC","file":"get-axis-attributes.js","sourcesContent":["import { degreeToRadian, isNil, merge } from '@visactor/vutils';\nimport { transformAxisLineStyle, transformStateStyle, transformToGraphic } from '../util/transform';\nimport type { ICellAxisOption } from '../../ts-types/component/axis';\n\nconst DEFAULT_TITLE_STYLE = {\n left: {\n textAlign: 'center',\n textBaseline: 'bottom'\n },\n right: {\n textAlign: 'center',\n textBaseline: 'bottom'\n },\n radius: {},\n angle: {}\n};\n\nconst DEFAULT_TEXT_FONT_FAMILY =\n // eslint-disable-next-line max-len\n 'PingFang SC,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol';\n\nconst DEFAULT_TEXT_FONT_SIZE = 14;\n\nconst THEME_CONSTANTS = {\n FONT_FAMILY: DEFAULT_TEXT_FONT_FAMILY,\n LABEL_FONT_SIZE: DEFAULT_TEXT_FONT_SIZE,\n MAP_LABEL_FONT_SIZE: 10,\n TITLE_FONT_SIZE: 18,\n AXIS_TICK_SIZE: 4\n};\n\nexport const commonAxis = {\n domainLine: {\n visible: true,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n grid: {\n visible: true,\n style: {\n lineWidth: 1,\n stroke: '#EBEDF2',\n strokeOpacity: 1,\n lineDash: [] as any[]\n }\n },\n subGrid: {\n visible: false,\n style: {\n lineWidth: 1,\n stroke: '#EBEDF2',\n strokeOpacity: 1,\n lineDash: [4, 4]\n }\n },\n tick: {\n visible: true,\n tickSize: THEME_CONSTANTS.AXIS_TICK_SIZE,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n subTick: {\n visible: false,\n tickSize: THEME_CONSTANTS.AXIS_TICK_SIZE / 2,\n style: {\n lineWidth: 1,\n stroke: '#D9DDE4',\n strokeOpacity: 1\n }\n },\n label: {\n visible: true,\n space: 1, // hack: VChart中为0,为了方便fs调试暂时改为1\n style: {\n fontSize: THEME_CONSTANTS.LABEL_FONT_SIZE,\n fill: '#89909D',\n fontWeight: 'normal',\n fillOpacity: 1\n }\n },\n title: {\n space: 10,\n style: {\n fontSize: THEME_CONSTANTS.LABEL_FONT_SIZE,\n fill: '#333333',\n fontWeight: 'normal',\n fillOpacity: 1\n }\n }\n};\n\nexport function getAxisAttributes(option: ICellAxisOption) {\n // const spec = merge({}, option, commonAxis);\n const spec = option;\n let titleAngle = spec.title?.angle ?? 0;\n let titleTextStyle;\n if (spec.orient === 'left' || spec.orient === 'right') {\n // 处理纵轴的标题样式\n if (spec.title?.autoRotate && isNil(spec.title.angle)) {\n titleAngle = spec.orient === 'left' ? -90 : 90;\n titleTextStyle = DEFAULT_TITLE_STYLE[spec.orient];\n }\n }\n\n return {\n orient: spec.orient,\n select: spec.select,\n hover: spec.hover,\n line: transformAxisLineStyle(spec.domainLine),\n label: {\n visible: spec.label.visible,\n space: spec.label.space,\n inside: spec.label.inside,\n style:\n // isFunction(spec.label.style)\n // ? (datum: Datum, index: number) => {\n // const style = this._preprocessSpec(spec.label.style(datum.rawValue, index, datum));\n\n // return transformToGraphic(this._preprocessSpec(merge({}, this._theme.label?.style, style)));\n // }\n // :\n transformToGraphic(spec.label.style),\n formatMethod: spec.label.formatMethod\n ? (value: any, datum: any, index: number) => {\n return spec.label.formatMethod(datum.rawValue, datum);\n }\n : null,\n state: transformStateStyle(spec.label.state),\n containerAlign: spec.label.containerAlign\n },\n tick: {\n visible: spec.tick.visible,\n length: spec.tick.tickSize,\n inside: spec.tick.inside,\n alignWithLabel: spec.tick.alignWithLabel,\n style:\n // isFunction(spec.tick.style)\n // ? (datum: Datum, index: number) => {\n // const style = this._preprocessSpec(spec.tick.style(datum.rawValue, index, datum));\n\n // return transformToGraphic(this._preprocessSpec(merge({}, this._theme.tick?.style, style)));\n // }\n // :\n transformToGraphic(spec.tick.style),\n state: transformStateStyle(spec.tick.state)\n },\n subTick: {\n visible: spec.subTick.visible,\n length: spec.subTick.tickSize,\n inside: spec.subTick.inside,\n count: spec.subTick.tickCount,\n style: transformToGraphic(spec.subTick.style),\n state: transformStateStyle(spec.subTick.state)\n },\n grid: {\n type: 'line',\n visible: spec.grid.visible,\n alternateColor: spec.grid.alternateColor,\n alignWithLabel: spec.grid.alignWithLabel,\n style:\n // isFunction(spec.grid.style)\n // ? (datum: Datum, index: number) => {\n // const style = spec.grid.style(datum.datum?.rawValue, index, datum.datum);\n\n // return transformToGraphic(this._preprocessSpec(merge({}, this._theme.grid?.style, style)));\n // }\n // :\n transformToGraphic(spec.grid.style)\n },\n subGrid: {\n type: 'line',\n visible: spec.subGrid.visible,\n alternateColor: spec.subGrid.alternateColor,\n style: transformToGraphic(spec.subGrid.style)\n },\n title: {\n visible: spec.title.visible,\n position: spec.title.position,\n space: spec.title.space,\n autoRotate: false, // 默认不对外提供该配置\n angle: titleAngle ? degreeToRadian(titleAngle) : null,\n textStyle: merge({}, titleTextStyle, transformToGraphic(spec.title.style)),\n padding: spec.title.padding,\n shape: {\n visible: spec.title.shape?.visible,\n space: spec.title.shape?.space,\n style: transformToGraphic(spec.title.shape?.style)\n },\n background: {\n visible: spec.title.background?.visible,\n style: transformToGraphic(spec.title.background?.style)\n },\n state: {\n text: transformStateStyle(spec.title.state),\n shape: transformStateStyle(spec.title.shape?.state),\n background: transformStateStyle(spec.title.background?.state)\n }\n },\n panel: {\n visible: spec.background?.visible,\n style: transformToGraphic(spec.background?.style),\n state: transformStateStyle(spec.background?.state)\n }\n };\n}\n"]}
@@ -3,43 +3,47 @@ import { merge } from "@visactor/vutils";
3
3
  import { commonAxis } from "./get-axis-attributes";
4
4
 
5
5
  export function computeAxisComponentWidth(config, table) {
6
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
6
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
7
7
  const attribute = merge({}, commonAxis, config), tickWidth = null !== (_a = attribute.tick.width) && void 0 !== _a ? _a : 4;
8
8
  let labelWidth = 0;
9
9
  if (attribute.label.visible) {
10
10
  if ("band" === attribute.type) {
11
11
  attribute.domain.forEach((text => {
12
- var _a, _b, _c, _d, _e, _f;
13
- attribute.label.formatMethod && (text = attribute.label.formatMethod(text)), labelWidth = Math.max(labelWidth, table.measureText(text, {
12
+ var _a, _b, _c, _d, _e, _f, _g, _h;
13
+ attribute.label.formatMethod && (text = attribute.label.formatMethod(text));
14
+ const {width: width, height: height} = table.measureText(text, {
14
15
  fontSize: null === (_b = null === (_a = attribute.label) || void 0 === _a ? void 0 : _a.style) || void 0 === _b ? void 0 : _b.fontSize,
15
16
  fontWeight: null === (_d = null === (_c = attribute.label) || void 0 === _c ? void 0 : _c.style) || void 0 === _d ? void 0 : _d.fontWeight,
16
17
  fontFamily: null === (_f = null === (_e = attribute.label) || void 0 === _e ? void 0 : _e.style) || void 0 === _f ? void 0 : _f.fontFamily
17
- }).width);
18
+ });
19
+ labelWidth = Math.max(labelWidth, getSizeAfterResize(width, height, null === (_h = null === (_g = attribute.label) || void 0 === _g ? void 0 : _g.style) || void 0 === _h ? void 0 : _h.angle).width);
18
20
  }));
19
21
  } else {
20
22
  const range = attribute.range, minNumber = Math.abs(range.min) > 1 ? Math.round(range.min) : range.min, maxNumber = Math.abs(range.max) > 1 ? Math.round(range.max) : range.max;
21
23
  [ formatDecimal(minNumber), formatDecimal(maxNumber) ].forEach((text => {
22
- var _a, _b, _c, _d, _e, _f;
23
- attribute.label.formatMethod && (text = attribute.label.formatMethod(text)), labelWidth = Math.max(labelWidth, table.measureText(text, {
24
+ var _a, _b, _c, _d, _e, _f, _g, _h;
25
+ attribute.label.formatMethod && (text = attribute.label.formatMethod(text));
26
+ const {width: width, height: height} = table.measureText(text, {
24
27
  fontSize: null === (_b = null === (_a = attribute.label) || void 0 === _a ? void 0 : _a.style) || void 0 === _b ? void 0 : _b.fontSize,
25
28
  fontWeight: null === (_d = null === (_c = attribute.label) || void 0 === _c ? void 0 : _c.style) || void 0 === _d ? void 0 : _d.fontWeight,
26
29
  fontFamily: null === (_f = null === (_e = attribute.label) || void 0 === _e ? void 0 : _e.style) || void 0 === _f ? void 0 : _f.fontFamily
27
- }).width + 2);
30
+ });
31
+ labelWidth = Math.max(labelWidth, getSizeAfterResize(width, height, null === (_h = null === (_g = attribute.label) || void 0 === _g ? void 0 : _g.style) || void 0 === _h ? void 0 : _h.angle).width + 2);
28
32
  }));
29
33
  }
30
34
  labelWidth += null !== (_b = attribute.label.space) && void 0 !== _b ? _b : 4;
31
35
  }
32
36
  let titleWidth = 0;
33
- return attribute.title.visible && attribute.title.text && (titleWidth = "left" !== config.orient && "right" !== config.orient || !attribute.title.autoRotate ? table.measureText(attribute.title.text, {
34
- fontSize: null === (_k = null === (_j = attribute.title) || void 0 === _j ? void 0 : _j.style) || void 0 === _k ? void 0 : _k.fontSize,
35
- fontWeight: null === (_m = null === (_l = attribute.title) || void 0 === _l ? void 0 : _l.style) || void 0 === _m ? void 0 : _m.fontWeight,
36
- fontFamily: null === (_p = null === (_o = attribute.title) || void 0 === _o ? void 0 : _o.style) || void 0 === _p ? void 0 : _p.fontFamily
37
- }).width + 2 : table.measureText(attribute.title.text, {
38
- fontSize: null === (_d = null === (_c = attribute.title) || void 0 === _c ? void 0 : _c.style) || void 0 === _d ? void 0 : _d.fontSize,
39
- fontWeight: null === (_f = null === (_e = attribute.title) || void 0 === _e ? void 0 : _e.style) || void 0 === _f ? void 0 : _f.fontWeight,
40
- fontFamily: null === (_h = null === (_g = attribute.title) || void 0 === _g ? void 0 : _g.style) || void 0 === _h ? void 0 : _h.fontFamily
41
- }).height + 2, titleWidth += null !== (_q = attribute.title.space) && void 0 !== _q ? _q : 4),
42
- tickWidth + labelWidth + titleWidth;
37
+ if (attribute.title.visible && attribute.title.text) {
38
+ const {width: width, height: height} = table.measureText(attribute.title.text, {
39
+ fontSize: null === (_d = null === (_c = attribute.label) || void 0 === _c ? void 0 : _c.style) || void 0 === _d ? void 0 : _d.fontSize,
40
+ fontWeight: null === (_f = null === (_e = attribute.label) || void 0 === _e ? void 0 : _e.style) || void 0 === _f ? void 0 : _f.fontWeight,
41
+ fontFamily: null === (_h = null === (_g = attribute.label) || void 0 === _g ? void 0 : _g.style) || void 0 === _h ? void 0 : _h.fontFamily
42
+ }), size = getSizeAfterResize(width, height, null === (_k = null === (_j = attribute.label) || void 0 === _j ? void 0 : _j.style) || void 0 === _k ? void 0 : _k.angle);
43
+ titleWidth = "left" !== config.orient && "right" !== config.orient || !attribute.title.autoRotate ? size.width + 2 : size.height + 2,
44
+ titleWidth += null !== (_l = attribute.title.space) && void 0 !== _l ? _l : 4;
45
+ }
46
+ return tickWidth + labelWidth + titleWidth;
43
47
  }
44
48
 
45
49
  export function computeAxisComponentHeight(config, table) {
@@ -49,36 +53,64 @@ export function computeAxisComponentHeight(config, table) {
49
53
  if (attribute.label.visible) {
50
54
  if ("band" === attribute.type) {
51
55
  attribute.domain.forEach((text => {
52
- var _a, _b, _c, _d;
53
- attribute.label.formatMethod && (text = attribute.label.formatMethod(text)), labelHeight = Math.max(labelHeight, table.measureText(text, {
56
+ var _a, _b, _c, _d, _e, _f, _g, _h;
57
+ attribute.label.formatMethod && (text = attribute.label.formatMethod(text));
58
+ const {width: width, height: height} = table.measureText(text, {
54
59
  fontSize: null === (_b = null === (_a = attribute.label) || void 0 === _a ? void 0 : _a.style) || void 0 === _b ? void 0 : _b.fontSize,
55
- fontFamily: null === (_d = null === (_c = attribute.label) || void 0 === _c ? void 0 : _c.style) || void 0 === _d ? void 0 : _d.fontFamily
56
- }).height);
60
+ fontWeight: null === (_d = null === (_c = attribute.label) || void 0 === _c ? void 0 : _c.style) || void 0 === _d ? void 0 : _d.fontWeight,
61
+ fontFamily: null === (_f = null === (_e = attribute.label) || void 0 === _e ? void 0 : _e.style) || void 0 === _f ? void 0 : _f.fontFamily
62
+ });
63
+ labelHeight = Math.max(labelHeight, getSizeAfterResize(width, height, null === (_h = null === (_g = attribute.label) || void 0 === _g ? void 0 : _g.style) || void 0 === _h ? void 0 : _h.angle).height);
57
64
  }));
58
65
  } else {
59
66
  const range = attribute.range, minNumber = Math.abs(range.min) > 1 ? Math.round(range.min) : range.min, maxNumber = Math.abs(range.max) > 1 ? Math.round(range.max) : range.max;
60
67
  [ formatDecimal(minNumber), formatDecimal(maxNumber) ].forEach((text => {
61
- var _a, _b, _c, _d;
62
- attribute.label.formatMethod && (text = attribute.label.formatMethod(text)), labelHeight = Math.max(labelHeight, table.measureText(text, {
68
+ var _a, _b, _c, _d, _e, _f, _g, _h;
69
+ attribute.label.formatMethod && (text = attribute.label.formatMethod(text));
70
+ const {width: width, height: height} = table.measureText(text, {
63
71
  fontSize: null === (_b = null === (_a = attribute.label) || void 0 === _a ? void 0 : _a.style) || void 0 === _b ? void 0 : _b.fontSize,
64
- fontFamily: null === (_d = null === (_c = attribute.label) || void 0 === _c ? void 0 : _c.style) || void 0 === _d ? void 0 : _d.fontFamily
65
- }).height + 2);
72
+ fontWeight: null === (_d = null === (_c = attribute.label) || void 0 === _c ? void 0 : _c.style) || void 0 === _d ? void 0 : _d.fontWeight,
73
+ fontFamily: null === (_f = null === (_e = attribute.label) || void 0 === _e ? void 0 : _e.style) || void 0 === _f ? void 0 : _f.fontFamily
74
+ });
75
+ labelHeight = Math.max(labelHeight, getSizeAfterResize(width, height, null === (_h = null === (_g = attribute.label) || void 0 === _g ? void 0 : _g.style) || void 0 === _h ? void 0 : _h.angle).height + 2);
66
76
  }));
67
77
  }
68
78
  labelHeight += null !== (_b = attribute.label.space) && void 0 !== _b ? _b : 4;
69
79
  }
70
80
  let titleHeight = 0;
71
- return attribute.title.visible && attribute.title.text && (titleHeight = "bottom" !== config.orient && "top" !== config.orient || !attribute.title.autoRotate ? table.measureText(attribute.title.text, {
72
- fontSize: null === (_h = null === (_g = attribute.title) || void 0 === _g ? void 0 : _g.style) || void 0 === _h ? void 0 : _h.fontSize,
73
- fontFamily: null === (_k = null === (_j = attribute.title) || void 0 === _j ? void 0 : _j.style) || void 0 === _k ? void 0 : _k.fontFamily
74
- }).height + 2 : table.measureText(attribute.title.text, {
75
- fontSize: null === (_d = null === (_c = attribute.title) || void 0 === _c ? void 0 : _c.style) || void 0 === _d ? void 0 : _d.fontSize,
76
- fontFamily: null === (_f = null === (_e = attribute.title) || void 0 === _e ? void 0 : _e.style) || void 0 === _f ? void 0 : _f.fontFamily
77
- }).width + 2, titleHeight += null !== (_l = attribute.title.space) && void 0 !== _l ? _l : 4),
78
- tickHeight + labelHeight + titleHeight;
81
+ if (attribute.title.visible && attribute.title.text) {
82
+ const {width: width, height: height} = table.measureText(attribute.title.text, {
83
+ fontSize: null === (_d = null === (_c = attribute.label) || void 0 === _c ? void 0 : _c.style) || void 0 === _d ? void 0 : _d.fontSize,
84
+ fontWeight: null === (_f = null === (_e = attribute.label) || void 0 === _e ? void 0 : _e.style) || void 0 === _f ? void 0 : _f.fontWeight,
85
+ fontFamily: null === (_h = null === (_g = attribute.label) || void 0 === _g ? void 0 : _g.style) || void 0 === _h ? void 0 : _h.fontFamily
86
+ }), size = getSizeAfterResize(width, height, null === (_k = null === (_j = attribute.label) || void 0 === _j ? void 0 : _j.style) || void 0 === _k ? void 0 : _k.angle);
87
+ titleHeight = "bottom" !== config.orient && "top" !== config.orient || !attribute.title.autoRotate ? size.height + 2 : size.width + 2,
88
+ titleHeight += null !== (_l = attribute.title.space) && void 0 !== _l ? _l : 4;
89
+ }
90
+ return tickHeight + labelHeight + titleHeight;
79
91
  }
80
92
 
81
93
  function formatDecimal(number) {
82
94
  return "number" != typeof number && (number = Number(number)), Number(number.toPrecision(1)).toString();
83
95
  }
96
+
97
+ function getSizeAfterResize(width, height, angle = 0) {
98
+ const theta = angle * Math.PI / 180, p1_x = -width / 2, p1_y = -height / 2, p2_x = width / 2, p2_y = -height / 2, p3_x = width / 2, p3_y = height / 2, p4_x = -width / 2, p4_y = height / 2, p1Rotated = {
99
+ x: p1_x * Math.cos(theta) - p1_y * Math.sin(theta),
100
+ y: p1_x * Math.sin(theta) + p1_y * Math.cos(theta)
101
+ }, p2Rotated = {
102
+ x: p2_x * Math.cos(theta) - p2_y * Math.sin(theta),
103
+ y: p2_x * Math.sin(theta) + p2_y * Math.cos(theta)
104
+ }, p3Rotated = {
105
+ x: p3_x * Math.cos(theta) - p3_y * Math.sin(theta),
106
+ y: p3_x * Math.sin(theta) + p3_y * Math.cos(theta)
107
+ }, p4Rotated = {
108
+ x: p4_x * Math.cos(theta) - p4_y * Math.sin(theta),
109
+ y: p4_x * Math.sin(theta) + p4_y * Math.cos(theta)
110
+ }, bounds_minX = Math.min(p1Rotated.x, p2Rotated.x, p3Rotated.x, p4Rotated.x), bounds_maxX = Math.max(p1Rotated.x, p2Rotated.x, p3Rotated.x, p4Rotated.x), bounds_minY = Math.min(p1Rotated.y, p2Rotated.y, p3Rotated.y, p4Rotated.y);
111
+ return {
112
+ width: bounds_maxX - bounds_minX,
113
+ height: Math.max(p1Rotated.y, p2Rotated.y, p3Rotated.y, p4Rotated.y) - bounds_minY
114
+ };
115
+ }
84
116
  //# sourceMappingURL=get-axis-component-size.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["components/axis/get-axis-component-size.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAGzC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAOnD,MAAM,UAAU,yBAAyB,CAAC,MAAuB,EAAE,KAAmB;;IACpF,MAAM,SAAS,GAAG,KAAK,CAAC,EAAE,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IAEhD,MAAM,SAAS,GAAG,MAAA,SAAS,CAAC,IAAI,CAAC,KAAK,mCAAI,CAAC,CAAC;IAG5C,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,IAAI,SAAS,CAAC,KAAK,CAAC,OAAO,EAAE;QAC3B,IAAI,SAAS,CAAC,IAAI,KAAK,MAAM,EAAE;YAC7B,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;YAChC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAY,EAAE,EAAE;;gBAC9B,IAAI,SAAS,CAAC,KAAK,CAAC,YAAY,EAAE;oBAChC,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CA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AAI,EAAE;QACnD,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,MAAM,KAAK,KAAK,CAAC,IAAI,SAAS,CAAC,KAAK,CAAC,UAAU,EAAE;YACzF,WAAW;gBACT,KAAK,CAAC,WAAW,CAAC,SAAS,CAAC,KAAK,CAAC,IAAc,EAAE;oBAChD,QAAQ,EAAE,MAAA,MAAA,SAAS,CAAC,KAAK,0CAAE,KAAK,0CAAE,QAAQ;oBAC1C,UAAU,EAAE,MAAA,MAAA,SAAS,CAAC,KAAK,0CAAE,KAAK,0CAAE,UAAU;iBAC/C,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC;SAChB;aAAM;YACL,WAAW;gBACT,KAAK,CAAC,WAAW,CAAC,SAAS,CAAC,KAAK,CAAC,IAAc,EAAE;oBAChD,QAAQ,EAAE,MAAA,MAAA,SAAS,CAAC,KAAK,0CAAE,KAAK,0CAAE,QAAQ;oBAC1C,UAAU,EAAE,MAAA,MAAA,SAAS,CAAC,KAAK,0CAAE,KAAK,0CAAE,UAAU;iBAC/C,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;SACjB;QACD,WAAW,IAAI,MAAA,SAAS,CAAC,KAAK,CAAC,KAAK,mCAAI,CAAC,CAAC;KAC3C;IAED,OAAO,UAAU,GAAG,WAAW,GAAG,WAAW,CAAC;AAChD,CAAC;AAGD,SAAS,aAAa,CAAC,MAAc;IACnC,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;QAC9B,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;KACzB;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;AAClD,CAAC","file":"get-axis-component-size.js","sourcesContent":["import { merge } from '@visactor/vutils';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport type { ICellAxisOption } from '../../ts-types/component/axis';\nimport { commonAxis } from './get-axis-attributes';\n\n/**\n * @description: compuational vertical axis width\n * @param {ICellAxisOption} config\n * @return {*}\n */\nexport function computeAxisComponentWidth(config: ICellAxisOption, table: BaseTableAPI) {\n const attribute = merge({}, commonAxis, config);\n // tick\n const tickWidth = attribute.tick.width ?? 4;\n\n // text\n let labelWidth = 0;\n if (attribute.label.visible) {\n if (attribute.type === 'band') {\n const domain = attribute.domain;\n domain.forEach((text: string) => {\n if (attribute.label.formatMethod) {\n text = attribute.label.formatMethod(text);\n }\n labelWidth = Math.max(\n labelWidth,\n table.measureText(text, {\n fontSize: attribute.label?.style?.fontSize,\n fontWeight: attribute.label?.style?.fontWeight,\n fontFamily: attribute.label?.style?.fontFamily\n }).width\n );\n });\n } else {\n const range = attribute.range;\n const minNumber = Math.abs(range.min) > 1 ? Math.round(range.min) : range.min;\n const maxNumber = Math.abs(range.max) > 1 ? Math.round(range.max) : range.max;\n // abs>1取整保留两位有效数字,abs<1保留一位有效数字\n const minString = formatDecimal(minNumber);\n const maxString = formatDecimal(maxNumber);\n // 这里测量的是预估的最大最小range,与实际现实的label可能不同\n [minString, maxString].forEach(text => {\n if (attribute.label.formatMethod) {\n text = attribute.label.formatMethod(text);\n }\n labelWidth = Math.max(\n labelWidth,\n table.measureText(text, {\n fontSize: attribute.label?.style?.fontSize,\n fontWeight: attribute.label?.style?.fontWeight,\n fontFamily: attribute.label?.style?.fontFamily\n }).width + 2\n );\n });\n }\n labelWidth += attribute.label.space ?? 4;\n }\n\n // title\n let titleWidth = 0;\n if (attribute.title.visible && attribute.title.text) {\n if ((config.orient === 'left' || config.orient === 'right') && attribute.title.autoRotate) {\n titleWidth =\n table.measureText(attribute.title.text as string, {\n fontSize: attribute.title?.style?.fontSize,\n fontWeight: attribute.title?.style?.fontWeight,\n fontFamily: attribute.title?.style?.fontFamily\n }).height + 2;\n } else {\n titleWidth =\n table.measureText(attribute.title.text as string, {\n fontSize: attribute.title?.style?.fontSize,\n fontWeight: attribute.title?.style?.fontWeight,\n fontFamily: attribute.title?.style?.fontFamily\n }).width + 2;\n }\n titleWidth += attribute.title.space ?? 4;\n }\n\n return tickWidth + labelWidth + titleWidth;\n}\n\n/**\n * @description: compuational horizontal axis height\n * @param {ICellAxisOption} config\n * @return {*}\n */\nexport function computeAxisComponentHeight(config: ICellAxisOption, table: BaseTableAPI) {\n const attribute = merge({}, commonAxis, config);\n // tick\n const tickHeight = attribute.tick.width ?? 4;\n\n // text\n let labelHeight = 0;\n if (attribute.label.visible) {\n if (attribute.type === 'band') {\n const domain = attribute.domain;\n domain.forEach((text: string) => {\n if (attribute.label.formatMethod) {\n text = attribute.label.formatMethod(text);\n }\n labelHeight = Math.max(\n labelHeight,\n table.measureText(text, {\n fontSize: attribute.label?.style?.fontSize,\n fontFamily: attribute.label?.style?.fontFamily\n }).height\n );\n });\n } else {\n const range = attribute.range;\n const minNumber = Math.abs(range.min) > 1 ? Math.round(range.min) : range.min;\n const maxNumber = Math.abs(range.max) > 1 ? Math.round(range.max) : range.max;\n // abs>1取整保留两位有效数字,abs<1保留一位有效数字\n const minString = formatDecimal(minNumber);\n const maxString = formatDecimal(maxNumber);\n // 这里测量的是预估的最大最小range,与实际现实的label可能不同\n [minString, maxString].forEach(text => {\n if (attribute.label.formatMethod) {\n text = attribute.label.formatMethod(text);\n }\n labelHeight = Math.max(\n labelHeight,\n table.measureText(text, {\n fontSize: attribute.label?.style?.fontSize,\n fontFamily: attribute.label?.style?.fontFamily\n }).height + 2\n );\n });\n }\n labelHeight += attribute.label.space ?? 4;\n }\n\n // title\n let titleHeight = 0;\n if (attribute.title.visible && attribute.title.text) {\n if ((config.orient === 'bottom' || config.orient === 'top') && attribute.title.autoRotate) {\n titleHeight =\n table.measureText(attribute.title.text as string, {\n fontSize: attribute.title?.style?.fontSize,\n fontFamily: attribute.title?.style?.fontFamily\n }).width + 2;\n } else {\n titleHeight =\n table.measureText(attribute.title.text as string, {\n fontSize: attribute.title?.style?.fontSize,\n fontFamily: attribute.title?.style?.fontFamily\n }).height + 2;\n }\n titleHeight += attribute.title.space ?? 4;\n }\n\n return tickHeight + labelHeight + titleHeight;\n}\n\n// 保留一位有效数字\nfunction formatDecimal(number: number) {\n if (typeof number !== 'number') {\n number = Number(number);\n }\n\n return Number(number.toPrecision(1)).toString(); // 避免科学计数法\n}\n"]}
1
+ {"version":3,"sources":["components/axis/get-axis-component-size.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAGzC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAOnD,MAAM,UAAU,yBAAyB,CAAC,MAAuB,EAAE,KAAmB;;IACpF,MAAM,SAAS,GAAG,KAAK,CAAC,EAAE,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IAEhD,MAAM,SAAS,GAAG,MAAA,SAAS,CAAC,IAAI,CAAC,KAAK,mCAAI,CAAC,CAAC;IAG5C,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,IAAI,SAAS,CAAC,KAAK,CAAC,OAAO,EAAE;QAC3B,IAAI,SAAS,CAAC,IAAI,KAAK,MAAM,EAAE;YAC7B,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;YAChC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAY,EAAE,EAAE;;gBAC9B,IAAI,SAAS,CAAC,KAAK,CAAC,YAAY,EAAE;oBAChC,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;iBAC3C;gBACD,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE;oBAChD,QAAQ,EAAE,MAAA,MAAA,SAAS,CAAC,KAAK,0CAAE,KAAK,0CAAE,QAAQ;oBAC1C,UAAU,EAAE,MAAA,MAAA,SAAS,CAAC,KAAK,0CAAE,KAAK,0CAAE,UAAU;oBAC9C,UAAU,EAAE,MAAA,MAAA,SAAS,CAAC,KAAK,0CAAE,KAAK,0CAAE,UAAU;i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IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;QAClE,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC;KACnE,CAAC;IAEF,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI;QAChC,MAAM,EAAE,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI;KAClC,CAAC;AACJ,CAAC","file":"get-axis-component-size.js","sourcesContent":["import { merge } from '@visactor/vutils';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport type { ICellAxisOption } from '../../ts-types/component/axis';\nimport { commonAxis } from './get-axis-attributes';\n\n/**\n * @description: compuational vertical axis width\n * @param {ICellAxisOption} config\n * @return {*}\n */\nexport function computeAxisComponentWidth(config: ICellAxisOption, table: BaseTableAPI) {\n const attribute = merge({}, commonAxis, config);\n // tick\n const tickWidth = attribute.tick.width ?? 4;\n\n // text\n let labelWidth = 0;\n if (attribute.label.visible) {\n if (attribute.type === 'band') {\n const domain = attribute.domain;\n domain.forEach((text: string) => {\n if (attribute.label.formatMethod) {\n text = attribute.label.formatMethod(text);\n }\n const { width, height } = table.measureText(text, {\n fontSize: attribute.label?.style?.fontSize,\n fontWeight: attribute.label?.style?.fontWeight,\n fontFamily: attribute.label?.style?.fontFamily\n });\n labelWidth = Math.max(labelWidth, getSizeAfterResize(width, height, attribute.label?.style?.angle).width);\n });\n } else {\n const range = attribute.range;\n const minNumber = Math.abs(range.min) > 1 ? Math.round(range.min) : range.min;\n const maxNumber = Math.abs(range.max) > 1 ? Math.round(range.max) : range.max;\n // abs>1取整保留两位有效数字,abs<1保留一位有效数字\n const minString = formatDecimal(minNumber);\n const maxString = formatDecimal(maxNumber);\n // 这里测量的是预估的最大最小range,与实际现实的label可能不同\n [minString, maxString].forEach(text => {\n if (attribute.label.formatMethod) {\n text = attribute.label.formatMethod(text);\n }\n const { width, height } = table.measureText(text, {\n fontSize: attribute.label?.style?.fontSize,\n fontWeight: attribute.label?.style?.fontWeight,\n fontFamily: attribute.label?.style?.fontFamily\n });\n labelWidth = Math.max(labelWidth, getSizeAfterResize(width, height, attribute.label?.style?.angle).width + 2);\n });\n }\n labelWidth += attribute.label.space ?? 4;\n }\n\n // title\n let titleWidth = 0;\n if (attribute.title.visible && attribute.title.text) {\n const { width, height } = table.measureText(attribute.title.text, {\n fontSize: attribute.label?.style?.fontSize,\n fontWeight: attribute.label?.style?.fontWeight,\n fontFamily: attribute.label?.style?.fontFamily\n });\n const size = getSizeAfterResize(width, height, attribute.label?.style?.angle);\n if ((config.orient === 'left' || config.orient === 'right') && attribute.title.autoRotate) {\n titleWidth = size.height + 2;\n } else {\n titleWidth = size.width + 2;\n }\n titleWidth += attribute.title.space ?? 4;\n }\n\n return tickWidth + labelWidth + titleWidth;\n}\n\n/**\n * @description: compuational horizontal axis height\n * @param {ICellAxisOption} config\n * @return {*}\n */\nexport function computeAxisComponentHeight(config: ICellAxisOption, table: BaseTableAPI) {\n const attribute = merge({}, commonAxis, config);\n // tick\n const tickHeight = attribute.tick.width ?? 4;\n\n // text\n let labelHeight = 0;\n if (attribute.label.visible) {\n if (attribute.type === 'band') {\n const domain = attribute.domain;\n domain.forEach((text: string) => {\n if (attribute.label.formatMethod) {\n text = attribute.label.formatMethod(text);\n }\n const { width, height } = table.measureText(text, {\n fontSize: attribute.label?.style?.fontSize,\n fontWeight: attribute.label?.style?.fontWeight,\n fontFamily: attribute.label?.style?.fontFamily\n });\n labelHeight = Math.max(labelHeight, getSizeAfterResize(width, height, attribute.label?.style?.angle).height);\n });\n } else {\n const range = attribute.range;\n const minNumber = Math.abs(range.min) > 1 ? Math.round(range.min) : range.min;\n const maxNumber = Math.abs(range.max) > 1 ? Math.round(range.max) : range.max;\n // abs>1取整保留两位有效数字,abs<1保留一位有效数字\n const minString = formatDecimal(minNumber);\n const maxString = formatDecimal(maxNumber);\n // 这里测量的是预估的最大最小range,与实际现实的label可能不同\n [minString, maxString].forEach(text => {\n if (attribute.label.formatMethod) {\n text = attribute.label.formatMethod(text);\n }\n const { width, height } = table.measureText(text, {\n fontSize: attribute.label?.style?.fontSize,\n fontWeight: attribute.label?.style?.fontWeight,\n fontFamily: attribute.label?.style?.fontFamily\n });\n labelHeight = Math.max(\n labelHeight,\n getSizeAfterResize(width, height, attribute.label?.style?.angle).height + 2\n );\n });\n }\n labelHeight += attribute.label.space ?? 4;\n }\n\n // title\n let titleHeight = 0;\n if (attribute.title.visible && attribute.title.text) {\n const { width, height } = table.measureText(attribute.title.text, {\n fontSize: attribute.label?.style?.fontSize,\n fontWeight: attribute.label?.style?.fontWeight,\n fontFamily: attribute.label?.style?.fontFamily\n });\n const size = getSizeAfterResize(width, height, attribute.label?.style?.angle);\n if ((config.orient === 'bottom' || config.orient === 'top') && attribute.title.autoRotate) {\n titleHeight = size.width + 2;\n } else {\n titleHeight = size.height + 2;\n }\n titleHeight += attribute.title.space ?? 4;\n }\n\n return tickHeight + labelHeight + titleHeight;\n}\n\n// 保留一位有效数字\nfunction formatDecimal(number: number) {\n if (typeof number !== 'number') {\n number = Number(number);\n }\n\n return Number(number.toPrecision(1)).toString(); // 避免科学计数法\n}\n\n// 计算旋转后的size\nfunction getSizeAfterResize(width: number, height: number, angle = 0) {\n const theta = (angle * Math.PI) / 180; // 角度转为弧度\n const p1 = { x: -width / 2, y: -height / 2 };\n const p2 = { x: width / 2, y: -height / 2 };\n const p3 = { x: width / 2, y: height / 2 };\n const p4 = { x: -width / 2, y: height / 2 };\n\n const p1Rotated = {\n x: p1.x * Math.cos(theta) - p1.y * Math.sin(theta),\n y: p1.x * Math.sin(theta) + p1.y * Math.cos(theta)\n };\n const p2Rotated = {\n x: p2.x * Math.cos(theta) - p2.y * Math.sin(theta),\n y: p2.x * Math.sin(theta) + p2.y * Math.cos(theta)\n };\n const p3Rotated = {\n x: p3.x * Math.cos(theta) - p3.y * Math.sin(theta),\n y: p3.x * Math.sin(theta) + p3.y * Math.cos(theta)\n };\n const p4Rotated = {\n x: p4.x * Math.cos(theta) - p4.y * Math.sin(theta),\n y: p4.x * Math.sin(theta) + p4.y * Math.cos(theta)\n };\n\n const bounds = {\n minX: Math.min(p1Rotated.x, p2Rotated.x, p3Rotated.x, p4Rotated.x),\n maxX: Math.max(p1Rotated.x, p2Rotated.x, p3Rotated.x, p4Rotated.x),\n minY: Math.min(p1Rotated.y, p2Rotated.y, p3Rotated.y, p4Rotated.y),\n maxY: Math.max(p1Rotated.y, p2Rotated.y, p3Rotated.y, p4Rotated.y)\n };\n\n return {\n width: bounds.maxX - bounds.minX,\n height: bounds.maxY - bounds.minY\n };\n}\n"]}
@@ -107,6 +107,8 @@ export class TooltipHandler {
107
107
  e.related && this._isBindCell(e.related.col, e.related.row) || this._unbindFromCell();
108
108
  })), table.on(TABLE_EVENT_TYPE.SELECTED_CELL, (e => {
109
109
  this._isBindCell(e.col, e.row) && this._unbindFromCell();
110
+ })), table.on(TABLE_EVENT_TYPE.MOUSELEAVE_TABLE, (e => {
111
+ this._unbindFromCell();
110
112
  })), table.on(TABLE_EVENT_TYPE.SCROLL, (e => {
111
113
  var _a;
112
114
  const info = this._attachInfo;