@visactor/vtable 0.9.3-alpha.5 → 0.9.3-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/ListTable.d.ts +2 -1
- package/cjs/ListTable.js +3 -2
- package/cjs/ListTable.js.map +1 -1
- package/cjs/PivotChart.d.ts +1 -0
- package/cjs/PivotChart.js +8 -7
- package/cjs/PivotChart.js.map +1 -1
- package/cjs/PivotTable.d.ts +1 -0
- package/cjs/PivotTable.js +5 -3
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/components/axis/get-axis-attributes.js +1 -1
- package/cjs/components/axis/get-axis-attributes.js.map +1 -1
- package/cjs/components/axis/get-axis-component-size.d.ts +2 -1
- package/cjs/components/axis/get-axis-component-size.js +55 -15
- package/cjs/components/axis/get-axis-component-size.js.map +1 -1
- package/cjs/components/legend/get-legend-attributes.js +1 -1
- package/cjs/components/legend/get-legend-attributes.js.map +1 -1
- package/cjs/components/legend/legend.d.ts +2 -0
- package/cjs/components/legend/legend.js +13 -3
- package/cjs/components/legend/legend.js.map +1 -1
- package/cjs/components/title/title.d.ts +3 -0
- package/cjs/components/title/title.js +22 -3
- package/cjs/components/title/title.js.map +1 -1
- package/cjs/core/BaseTable.d.ts +4 -3
- package/cjs/core/BaseTable.js +13 -16
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/dataset/dataset.js +11 -4
- package/cjs/dataset/dataset.js.map +1 -1
- package/cjs/event/listener/container-dom.js +1 -1
- package/cjs/event/listener/container-dom.js.map +1 -1
- package/cjs/event/listener/scroll-bar.js +2 -0
- package/cjs/event/listener/scroll-bar.js.map +1 -1
- package/cjs/event/scroll.js +8 -4
- package/cjs/event/scroll.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/layout/chart-helper/get-axis-config.js +27 -9
- package/cjs/layout/chart-helper/get-axis-config.js.map +1 -1
- package/cjs/layout/chart-helper/get-chart-spec.js +21 -8
- package/cjs/layout/chart-helper/get-chart-spec.js.map +1 -1
- package/cjs/render/layout/text.js +1 -0
- package/cjs/render/layout/text.js.map +1 -1
- package/cjs/scenegraph/graphic/chart.js +3 -1
- package/cjs/scenegraph/graphic/chart.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/chart-render.js +1 -1
- package/cjs/scenegraph/graphic/contributions/chart-render.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/group-contribution-render.js +6 -3
- package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
- package/cjs/scenegraph/graphic/text.js +6 -4
- package/cjs/scenegraph/graphic/text.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/proxy.d.ts +1 -1
- package/cjs/scenegraph/group-creater/progress/proxy.js +7 -19
- package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.js +1 -0
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +22 -17
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/update-position/update-auto-row.js +7 -6
- package/cjs/scenegraph/group-creater/progress/update-position/update-auto-row.js.map +1 -1
- package/cjs/scenegraph/layout/compute-col-width.js +6 -4
- package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
- package/cjs/scenegraph/layout/compute-row-height.d.ts +1 -1
- package/cjs/scenegraph/layout/compute-row-height.js +40 -16
- package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
- package/cjs/scenegraph/layout/update-height.js +1 -1
- package/cjs/scenegraph/layout/update-height.js.map +1 -1
- package/cjs/scenegraph/layout/update-width.js +6 -2
- package/cjs/scenegraph/layout/update-width.js.map +1 -1
- package/cjs/scenegraph/refresh-node/update-chart.js +2 -2
- package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -1
- package/cjs/scenegraph/scenegraph.js +7 -6
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/scenegraph/utils/measure-text.js +9 -8
- package/cjs/scenegraph/utils/measure-text.js.map +1 -1
- package/cjs/scenegraph/utils/text-icon-layout.js +1 -1
- package/cjs/scenegraph/utils/text-icon-layout.js.map +1 -1
- package/cjs/state/state.d.ts +1 -0
- package/cjs/state/state.js +4 -2
- package/cjs/state/state.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +3 -2
- package/cjs/ts-types/base-table.js.map +1 -1
- package/dist/vtable.js +506 -231
- package/dist/vtable.min.js +3 -3
- package/es/ListTable.d.ts +2 -1
- package/es/ListTable.js +3 -2
- package/es/ListTable.js.map +1 -1
- package/es/PivotChart.d.ts +1 -0
- package/es/PivotChart.js +8 -7
- package/es/PivotChart.js.map +1 -1
- package/es/PivotTable.d.ts +1 -0
- package/es/PivotTable.js +5 -3
- package/es/PivotTable.js.map +1 -1
- package/es/components/axis/get-axis-attributes.js +1 -1
- package/es/components/axis/get-axis-attributes.js.map +1 -1
- package/es/components/axis/get-axis-component-size.d.ts +2 -1
- package/es/components/axis/get-axis-component-size.js +53 -13
- package/es/components/axis/get-axis-component-size.js.map +1 -1
- package/es/components/legend/get-legend-attributes.js +1 -1
- package/es/components/legend/get-legend-attributes.js.map +1 -1
- package/es/components/legend/legend.d.ts +2 -0
- package/es/components/legend/legend.js +13 -3
- package/es/components/legend/legend.js.map +1 -1
- package/es/components/title/title.d.ts +3 -0
- package/es/components/title/title.js +22 -3
- package/es/components/title/title.js.map +1 -1
- package/es/core/BaseTable.d.ts +4 -3
- package/es/core/BaseTable.js +13 -16
- package/es/core/BaseTable.js.map +1 -1
- package/es/dataset/dataset.js +11 -3
- package/es/dataset/dataset.js.map +1 -1
- package/es/event/listener/container-dom.js +1 -1
- package/es/event/listener/container-dom.js.map +1 -1
- package/es/event/listener/scroll-bar.js +2 -0
- package/es/event/listener/scroll-bar.js.map +1 -1
- package/es/event/scroll.js +4 -1
- package/es/event/scroll.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/layout/chart-helper/get-axis-config.js +27 -9
- package/es/layout/chart-helper/get-axis-config.js.map +1 -1
- package/es/layout/chart-helper/get-chart-spec.js +22 -5
- package/es/layout/chart-helper/get-chart-spec.js.map +1 -1
- package/es/render/layout/text.js +1 -0
- package/es/render/layout/text.js.map +1 -1
- package/es/scenegraph/graphic/chart.js +3 -1
- package/es/scenegraph/graphic/chart.js.map +1 -1
- package/es/scenegraph/graphic/contributions/chart-render.js +1 -1
- package/es/scenegraph/graphic/contributions/chart-render.js.map +1 -1
- package/es/scenegraph/graphic/contributions/group-contribution-render.js +7 -2
- package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
- package/es/scenegraph/graphic/text.js +6 -4
- package/es/scenegraph/graphic/text.js.map +1 -1
- package/es/scenegraph/group-creater/progress/proxy.d.ts +1 -1
- package/es/scenegraph/group-creater/progress/proxy.js +7 -18
- package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.js +1 -0
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.js.map +1 -1
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +21 -17
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js.map +1 -1
- package/es/scenegraph/group-creater/progress/update-position/update-auto-row.js +7 -6
- package/es/scenegraph/group-creater/progress/update-position/update-auto-row.js.map +1 -1
- package/es/scenegraph/layout/compute-col-width.js +6 -4
- package/es/scenegraph/layout/compute-col-width.js.map +1 -1
- package/es/scenegraph/layout/compute-row-height.d.ts +1 -1
- package/es/scenegraph/layout/compute-row-height.js +43 -15
- package/es/scenegraph/layout/compute-row-height.js.map +1 -1
- package/es/scenegraph/layout/update-height.js +1 -1
- package/es/scenegraph/layout/update-height.js.map +1 -1
- package/es/scenegraph/layout/update-width.js +6 -2
- package/es/scenegraph/layout/update-width.js.map +1 -1
- package/es/scenegraph/refresh-node/update-chart.js +2 -2
- package/es/scenegraph/refresh-node/update-chart.js.map +1 -1
- package/es/scenegraph/scenegraph.js +7 -5
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/scenegraph/utils/measure-text.js +10 -9
- package/es/scenegraph/utils/measure-text.js.map +1 -1
- package/es/scenegraph/utils/text-icon-layout.js +1 -1
- package/es/scenegraph/utils/text-icon-layout.js.map +1 -1
- package/es/state/state.d.ts +1 -0
- package/es/state/state.js +5 -1
- package/es/state/state.js.map +1 -1
- package/es/ts-types/base-table.d.ts +3 -2
- package/es/ts-types/base-table.js.map +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/legend/legend.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAGzD,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAG9D,MAAM,OAAO,WAAW;IAStB,YAAY,MAA0B,EAAE,KAAmB;;QACzD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;QAChC,IAAI,CAAC,MAAM,GAAG,MAAA,MAAM,CAAC,MAAM,mCAAI,MAAM,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,MAAA,MAAM,CAAC,OAAO,mCAAI,IAAI,CAAC;QACtC,IAAI,CAAC,QAAQ,GAAG,MAAA,MAAM,CAAC,QAAQ,mCAAI,QAAQ,CAAC;QAC5C,IAAI,CAAC,YAAY,GAA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AAM,GAAG,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAEjH,OAAO;YACL,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,MAAM;SACf,CAAC;IACJ,CAAC;IACD,OAAO;QACL,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAC3E,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;IAC9B,CAAC;CACF","file":"legend.js","sourcesContent":["import { cloneDeep, get, merge } from '@visactor/vutils';\nimport type { ITableLegendOption } from '../../ts-types/component/legend';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport { DiscreteLegend, LegendEvent } from '@visactor/vrender-components';\nimport { getLegendAttributes } from './get-legend-attributes';\nimport { TABLE_EVENT_TYPE } from '../../core/TABLE_EVENT_TYPE';\nimport { getQuadProps } from '../../scenegraph/utils/padding';\nimport type { IOrientType } from '../../ts-types/component/util';\n\nexport class TableLegend {\n table: BaseTableAPI;\n option: ITableLegendOption;\n orient: IOrientType;\n visible: boolean;\n position: 'start' | 'middle' | 'end';\n selectedData: (string | number)[];\n legendComponent: DiscreteLegend;\n\n constructor(option: ITableLegendOption, table: BaseTableAPI) {\n this.table = table;\n this.option = cloneDeep(option);\n this.orient = option.orient ?? 'left';\n this.visible = option.visible ?? true;\n this.position = option.position ?? 'middle';\n this.selectedData = option.defaultSelected ?? [];\n\n this.createComponent();\n this.initEvent();\n }\n\n createComponent() {\n const attrs = this.getLegendAttributes({\n width: this.table.tableNoFrameWidth,\n height: this.table.tableNoFrameHeight\n });\n const legend = new DiscreteLegend(\n merge({}, attrs, {\n defaultSelected: this.selectedData\n })\n );\n legend.name = 'legend';\n this.legendComponent = legend;\n this.table.scenegraph.stage.defaultLayer.appendChild(legend);\n\n // 调整位置\n let width = isFinite(this.legendComponent.AABBBounds.width()) ? this.legendComponent.AABBBounds.width() : 0;\n let height = isFinite(this.legendComponent.AABBBounds.height()) ? this.legendComponent.AABBBounds.height() : 0;\n const rectWidth = this.table.tableNoFrameWidth;\n const rectHeight = this.table.tableNoFrameHeight;\n const padding = getQuadProps(attrs.padding ?? this.option.padding ?? 10);\n\n let x = 0;\n let y = 0;\n if (this.orient === 'left') {\n x = padding[3];\n y = 0;\n width += padding[1] + padding[3];\n } else if (this.orient === 'top') {\n x = 0;\n y = padding[0];\n height += padding[0] + padding[2];\n } else if (this.orient === 'right') {\n x = rectWidth - width - padding[1];\n y = 0;\n width += padding[1] + padding[3];\n } else if (this.orient === 'bottom') {\n x = 0;\n y = rectHeight - height - padding[2];\n height += padding[0] + padding[2];\n }\n\n const layout = this.orient === 'bottom' || this.orient === 'top' ? 'horizontal' : 'vertical';\n const position = this.position;\n // const { width: rectWidth, height: rectHeight } = fullSpace;\n let offsetX = 0;\n let offsetY = 0;\n if (layout === 'horizontal') {\n if (position === 'middle') {\n offsetX = (rectWidth - width) / 2;\n } else if (position === 'end') {\n offsetX = rectWidth - width - padding[1];\n } else {\n offsetX = padding[3];\n }\n } else {\n if (position === 'middle') {\n offsetY = (rectHeight - height) / 2;\n } else if (position === 'end') {\n offsetY = rectHeight - height - padding[2];\n } else {\n offsetY = padding[0];\n }\n }\n\n this.legendComponent.setAttributes({\n dx: offsetX,\n dy: offsetY,\n x,\n y\n });\n\n // update table size\n if (this.orient === 'left') {\n this.table.tableNoFrameWidth = this.table.tableNoFrameWidth - Math.ceil(width);\n this.table.tableX += Math.ceil(width);\n } else if (this.orient === 'top') {\n this.table.tableNoFrameHeight = this.table.tableNoFrameHeight - Math.ceil(height);\n this.table.tableY += Math.ceil(height);\n } else if (this.orient === 'right') {\n this.table.tableNoFrameWidth = this.table.tableNoFrameWidth - Math.ceil(width);\n } else if (this.orient === 'bottom') {\n this.table.tableNoFrameHeight = this.table.tableNoFrameHeight - Math.ceil(height);\n }\n }\n\n getLegendAttributes(rect: any) {\n const layout = this.orient === 'bottom' || this.orient === 'top' ? 'horizontal' : 'vertical';\n const attrs = {\n layout,\n items: this.getLegendItems(),\n // zIndex: this.layoutZIndex,\n maxWidth: rect.width,\n maxHeight: rect.height,\n ...getLegendAttributes(this.option, rect)\n };\n return attrs;\n }\n\n getLegendItems() {\n return this.option.data;\n }\n\n initEvent() {\n if (this.legendComponent) {\n this.legendComponent.addEventListener(LegendEvent.legendItemClick, (e: any) => {\n const selectedData = get(e, 'detail.currentSelected');\n this.table.scenegraph.updateNextFrame();\n this.table.fireListeners(TABLE_EVENT_TYPE.LEGEND_ITEM_CLICK, { model: this, value: selectedData, event: e });\n });\n\n this.legendComponent.addEventListener(LegendEvent.legendItemHover, (e: any) => {\n const detail = get(e, 'detail');\n this.table.scenegraph.updateNextFrame();\n this.table.fireListeners(TABLE_EVENT_TYPE.LEGEND_ITEM_HOVER, { model: this, value: detail, event: e });\n });\n\n this.legendComponent.addEventListener(LegendEvent.legendItemUnHover, (e: any) => {\n const detail = get(e, 'detail');\n this.table.scenegraph.updateNextFrame();\n this.table.fireListeners(TABLE_EVENT_TYPE.LEGEND_ITEM_UNHOVER, { model: this, value: detail, event: e });\n });\n }\n }\n\n getLegendBounds() {\n const width = isFinite(this.legendComponent.AABBBounds.width()) ? this.legendComponent.AABBBounds.width() : 0;\n const height = isFinite(this.legendComponent.AABBBounds.height()) ? this.legendComponent.AABBBounds.height() : 0;\n\n return {\n width: width,\n height: height\n };\n }\n release() {\n this.table.scenegraph.stage.defaultLayer.removeChild(this.legendComponent);\n this.legendComponent = null;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["components/legend/legend.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAGzD,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,8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ACJ,CAAC;IACD,OAAO;QACL,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACnG,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;IAC9B,CAAC;CACF","file":"legend.js","sourcesContent":["import { cloneDeep, get, merge } from '@visactor/vutils';\nimport type { ITableLegendOption } from '../../ts-types/component/legend';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport { DiscreteLegend, LegendEvent } from '@visactor/vrender-components';\nimport { getLegendAttributes } from './get-legend-attributes';\nimport { TABLE_EVENT_TYPE } from '../../core/TABLE_EVENT_TYPE';\nimport { getQuadProps } from '../../scenegraph/utils/padding';\nimport type { IOrientType } from '../../ts-types/component/util';\n\nexport class TableLegend {\n table: BaseTableAPI;\n option: ITableLegendOption;\n orient: IOrientType;\n visible: boolean;\n position: 'start' | 'middle' | 'end';\n selectedData: (string | number)[];\n legendComponent: DiscreteLegend;\n\n constructor(option: ITableLegendOption, table: BaseTableAPI) {\n this.table = table;\n this.option = cloneDeep(option);\n this.orient = option.orient ?? 'left';\n this.visible = option.visible ?? true;\n this.position = option.position ?? 'middle';\n this.selectedData = option.defaultSelected ?? [];\n\n this.createComponent();\n this.initEvent();\n }\n\n createComponent() {\n const attrs = this.getLegendAttributes({\n width: this.table.tableNoFrameWidth,\n height: this.table.tableNoFrameHeight\n });\n const legend = new DiscreteLegend(\n merge({}, attrs, {\n defaultSelected: this.selectedData\n })\n );\n legend.name = 'legend';\n this.legendComponent = legend;\n this.table.scenegraph.stage.defaultLayer.appendChild(legend);\n\n this.adjustTableSize(attrs);\n }\n\n resize() {\n if (!this.legendComponent) {\n return;\n }\n\n this.legendComponent.setAttributes({\n width: this.table.tableNoFrameWidth,\n height: this.table.tableNoFrameHeight\n });\n\n this.adjustTableSize(this.legendComponent.attribute);\n }\n\n adjustTableSize(attrs: any) {\n // 调整位置\n let width = isFinite(this.legendComponent.AABBBounds.width()) ? this.legendComponent.AABBBounds.width() : 0;\n let height = isFinite(this.legendComponent.AABBBounds.height()) ? this.legendComponent.AABBBounds.height() : 0;\n const rectWidth = this.table.tableNoFrameWidth;\n const rectHeight = this.table.tableNoFrameHeight;\n const padding = getQuadProps(attrs.padding ?? this.option.padding ?? 10);\n\n let x = 0;\n let y = 0;\n if (this.orient === 'left') {\n x = padding[3];\n y = 0;\n width += padding[1] + padding[3];\n } else if (this.orient === 'top') {\n x = 0;\n y = padding[0];\n height += padding[0] + padding[2];\n } else if (this.orient === 'right') {\n x = rectWidth - width - padding[1];\n y = 0;\n width += padding[1] + padding[3];\n } else if (this.orient === 'bottom') {\n x = 0;\n y = rectHeight - height - padding[2];\n height += padding[0] + padding[2];\n }\n\n const layout = this.orient === 'bottom' || this.orient === 'top' ? 'horizontal' : 'vertical';\n const position = this.position;\n // const { width: rectWidth, height: rectHeight } = fullSpace;\n let offsetX = 0;\n let offsetY = 0;\n if (layout === 'horizontal') {\n if (position === 'middle') {\n offsetX = (rectWidth - width) / 2;\n } else if (position === 'end') {\n offsetX = rectWidth - width - padding[1];\n } else {\n offsetX = padding[3];\n }\n } else {\n if (position === 'middle') {\n offsetY = (rectHeight - height) / 2;\n } else if (position === 'end') {\n offsetY = rectHeight - height - padding[2];\n } else {\n offsetY = padding[0];\n }\n }\n\n this.legendComponent.setAttributes({\n dx: offsetX,\n dy: offsetY,\n x,\n y\n });\n\n // update table size\n if (this.orient === 'left') {\n this.table.tableNoFrameWidth = this.table.tableNoFrameWidth - Math.ceil(width);\n this.table.tableX += Math.ceil(width);\n } else if (this.orient === 'top') {\n this.table.tableNoFrameHeight = this.table.tableNoFrameHeight - Math.ceil(height);\n this.table.tableY += Math.ceil(height);\n } else if (this.orient === 'right') {\n this.table.tableNoFrameWidth = this.table.tableNoFrameWidth - Math.ceil(width);\n } else if (this.orient === 'bottom') {\n this.table.tableNoFrameHeight = this.table.tableNoFrameHeight - Math.ceil(height);\n }\n }\n\n getLegendAttributes(rect: any) {\n const layout = this.orient === 'bottom' || this.orient === 'top' ? 'horizontal' : 'vertical';\n const attrs = {\n layout,\n items: this.getLegendItems(),\n // zIndex: this.layoutZIndex,\n maxWidth: rect.width,\n maxHeight: rect.height,\n ...getLegendAttributes(this.option, rect)\n };\n return attrs;\n }\n\n getLegendItems() {\n return this.option.data;\n }\n\n initEvent() {\n if (this.legendComponent) {\n this.legendComponent.addEventListener(LegendEvent.legendItemClick, (e: any) => {\n const selectedData = get(e, 'detail.currentSelected');\n this.table.scenegraph.updateNextFrame();\n this.table.fireListeners(TABLE_EVENT_TYPE.LEGEND_ITEM_CLICK, { model: this, value: selectedData, event: e });\n });\n\n this.legendComponent.addEventListener(LegendEvent.legendItemHover, (e: any) => {\n const detail = get(e, 'detail');\n this.table.scenegraph.updateNextFrame();\n this.table.fireListeners(TABLE_EVENT_TYPE.LEGEND_ITEM_HOVER, { model: this, value: detail, event: e });\n });\n\n this.legendComponent.addEventListener(LegendEvent.legendItemUnHover, (e: any) => {\n const detail = get(e, 'detail');\n this.table.scenegraph.updateNextFrame();\n this.table.fireListeners(TABLE_EVENT_TYPE.LEGEND_ITEM_UNHOVER, { model: this, value: detail, event: e });\n });\n }\n }\n\n getLegendBounds() {\n const width = isFinite(this.legendComponent.AABBBounds.width()) ? this.legendComponent.AABBBounds.width() : 0;\n const height = isFinite(this.legendComponent.AABBBounds.height()) ? this.legendComponent.AABBBounds.height() : 0;\n\n return {\n width: width,\n height: height\n };\n }\n release() {\n this.legendComponent && this.table.scenegraph.stage.defaultLayer.removeChild(this.legendComponent);\n this.legendComponent = null;\n }\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TitleAttrs } from '@visactor/vrender-components';
|
|
1
2
|
import type { ITitle } from '../../ts-types/component/title';
|
|
2
3
|
import type { BaseTableAPI } from '../../ts-types/base-table';
|
|
3
4
|
export declare class Title {
|
|
@@ -7,6 +8,8 @@ export declare class Title {
|
|
|
7
8
|
private _cacheAttrs;
|
|
8
9
|
constructor(titleOption: ITitle, table: BaseTableAPI);
|
|
9
10
|
private _createOrUpdateTitleComponent;
|
|
11
|
+
resize(): void;
|
|
12
|
+
_adjustTableSize(attrs: TitleAttrs): void;
|
|
10
13
|
release(): void;
|
|
11
14
|
private _getTitleAttrs;
|
|
12
15
|
}
|
|
@@ -9,16 +9,35 @@ export class Title {
|
|
|
9
9
|
this.table = table, this._titleOption = titleOption, this._titleComponent = this._createOrUpdateTitleComponent(this._getTitleAttrs());
|
|
10
10
|
}
|
|
11
11
|
_createOrUpdateTitleComponent(attrs) {
|
|
12
|
-
var _a, _b, _c, _d;
|
|
13
12
|
if (this._titleComponent) isEqual(attrs, this._cacheAttrs) || this._titleComponent.setAttributes(attrs); else {
|
|
14
13
|
const title = new TitleComponents(attrs);
|
|
15
14
|
title.name = "title", this.table.scenegraph.stage.defaultLayer.appendChild(title),
|
|
16
15
|
this._titleComponent = title;
|
|
17
16
|
}
|
|
17
|
+
return this._adjustTableSize(this._titleComponent.attribute), this._titleComponent;
|
|
18
|
+
}
|
|
19
|
+
resize() {
|
|
20
|
+
var _a, _b, _c, _d;
|
|
21
|
+
if (!this._titleComponent) return;
|
|
22
|
+
const padding = getQuadProps(null !== (_a = this._titleOption.padding) && void 0 !== _a ? _a : 10), realWidth = null !== (_b = this._titleOption.width) && void 0 !== _b ? _b : this.table.tableNoFrameWidth - padding[1] - padding[3];
|
|
23
|
+
this._titleComponent.setAttributes({
|
|
24
|
+
x: (null !== (_c = this._titleOption.x) && void 0 !== _c ? _c : "right" === this._titleOption.orient) ? this.table.tableX + this.table.tableNoFrameWidth : this.table.tableX,
|
|
25
|
+
y: (null !== (_d = this._titleOption.y) && void 0 !== _d ? _d : "bottom" === this._titleOption.orient) ? this.table.tableY + this.table.tableNoFrameHeight : this.table.tableY,
|
|
26
|
+
width: realWidth,
|
|
27
|
+
textStyle: Object.assign({
|
|
28
|
+
width: realWidth
|
|
29
|
+
}, this._titleOption.textStyle),
|
|
30
|
+
subtextStyle: Object.assign({
|
|
31
|
+
width: realWidth
|
|
32
|
+
}, this._titleOption.subtextStyle)
|
|
33
|
+
}), this._adjustTableSize(this._titleComponent.attribute);
|
|
34
|
+
}
|
|
35
|
+
_adjustTableSize(attrs) {
|
|
36
|
+
var _a, _b, _c, _d;
|
|
18
37
|
let width = isFinite(this._titleComponent.AABBBounds.width()) ? this._titleComponent.AABBBounds.width() : 0;
|
|
19
38
|
const height = isFinite(this._titleComponent.AABBBounds.height()) ? this._titleComponent.AABBBounds.height() : 0, rectWidth = this.table.tableNoFrameWidth, rectHeight = this.table.tableNoFrameHeight, padding = getQuadProps(null !== (_b = null !== (_a = attrs.padding) && void 0 !== _a ? _a : this._titleOption.padding) && void 0 !== _b ? _b : 10);
|
|
20
39
|
let x = 0, y = 0;
|
|
21
|
-
|
|
40
|
+
"left" === this._titleOption.orient ? (x = padding[3], y = 0) : "top" === this._titleOption.orient ? (x = 0,
|
|
22
41
|
y = padding[0]) : "right" === this._titleOption.orient ? (x = rectWidth - width - padding[1],
|
|
23
42
|
y = 0, width += padding[1] + padding[3]) : "bottom" === this._titleOption.orient && (x = 0,
|
|
24
43
|
y = rectHeight - height - padding[2]), "left" === this._titleOption.orient ? (this.table.tableNoFrameWidth = this.table.tableNoFrameWidth - Math.ceil(width),
|
|
@@ -27,7 +46,7 @@ export class Title {
|
|
|
27
46
|
this._cacheAttrs = attrs, "right" !== this._titleOption.orient && "bottom" !== this._titleOption.orient || this._titleComponent.setAttributes({
|
|
28
47
|
x: (null !== (_c = this._titleOption.x) && void 0 !== _c ? _c : "right" === this._titleOption.orient) ? this.table.tableX + this.table.tableNoFrameWidth : this.table.tableX,
|
|
29
48
|
y: (null !== (_d = this._titleOption.y) && void 0 !== _d ? _d : "bottom" === this._titleOption.orient) ? this.table.tableY + this.table.tableNoFrameHeight : this.table.tableY
|
|
30
|
-
})
|
|
49
|
+
});
|
|
31
50
|
}
|
|
32
51
|
release() {
|
|
33
52
|
this.table.scenegraph.stage.defaultLayer.removeChild(this._titleComponent), this._titleComponent = null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/title/title.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAIxE,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAE9D,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,MAAM,OAAO,KAAK;IAKhB,YAAY,WAAmB,EAAE,KAAmB;QAClD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,6BAA6B,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;IACnF,CAAC;IAEO,6BAA6B,CAAC,KAAiB;;QACrD,IAAI,IAAI,CAAC,eAAe,EAAE;YACxB,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,EAAE;gBACrC,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;aAC3C;SACF;aAAM;YACL,MAAM,KAAK,GAAG,IAAI,eAAe,CAAC,KAAK,CAAC,CAAC;YACzC,KAAK,CAAC,IAAI,GAAG,OAAO,CAAC;YACrB,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;YAC5D,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;SAG9B;QAID,IAAI,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5G,MAAM,MAAM,GAAG,QAAQ,CA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IAAI,CAAC,KAAK,CAAC,MAAM;YACvB,CAAC,EACC,CAAA,MAAA,IAAI,CAAC,YAAY,CAAC,CAAC,mCAAI,IAAI,CAAC,YAAY,CAAC,MAAM,KAAK,QAAQ;gBAC1D,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,kBAAkB;gBACnD,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM;YACvB,KAAK,EAAE,SAAS;YAChB,MAAM,EAAE,IAAI,CAAC,YAAY,CAAC,MAAM;YAChC,QAAQ,EAAE,IAAI,CAAC,YAAY,CAAC,QAAQ;YACpC,QAAQ,EAAE,IAAI,CAAC,YAAY,CAAC,QAAQ;YACpC,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,SAAS;YACtC,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,SAAS;YACtC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,OAAO;YAClC,KAAK,EAAE,MAAA,IAAI,CAAC,YAAY,CAAC,KAAK,mCAAI,MAAM;YACxC,aAAa,EAAE,MAAA,IAAI,CAAC,YAAY,CAAC,aAAa,mCAAI,KAAK;YACvD,SAAS,kBACP,KAAK,EAAE,SAAS,IACb,IAAI,CAAC,YAAY,CAAC,SAAS,CAC/B;YACD,YAAY,kBACV,KAAK,EAAE,SAAS,IACb,IAAI,CAAC,YAAY,CAAC,YAAY,CAClC;SACY,CAAC;IAClB,CAAC;CACF","file":"title.js","sourcesContent":["import { Title as TitleComponents } from '@visactor/vrender-components';\n// eslint-disable-next-line no-duplicate-imports\nimport type { TitleAttrs } from '@visactor/vrender-components';\nimport type { ITitle } from '../../ts-types/component/title';\nimport { getQuadProps } from '../../scenegraph/utils/padding';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport { isEqual } from '@visactor/vutils';\nexport class Title {\n table: BaseTableAPI;\n _titleOption: ITitle;\n private _titleComponent: TitleComponents;\n private _cacheAttrs: TitleAttrs;\n constructor(titleOption: ITitle, table: BaseTableAPI) {\n this.table = table;\n this._titleOption = titleOption;\n this._titleComponent = this._createOrUpdateTitleComponent(this._getTitleAttrs());\n }\n\n private _createOrUpdateTitleComponent(attrs: TitleAttrs): TitleComponents {\n if (this._titleComponent) {\n if (!isEqual(attrs, this._cacheAttrs)) {\n this._titleComponent.setAttributes(attrs);\n }\n } else {\n const title = new TitleComponents(attrs);\n title.name = 'title';\n this.table.scenegraph.stage.defaultLayer.appendChild(title);\n this._titleComponent = title;\n // 代理 title 组件上的事件\n // title.on('*', (event: any, type: string) => this._delegateEvent(title as unknown as INode, event, type));\n }\n // update table size\n\n // 调整位置\n let width = isFinite(this._titleComponent.AABBBounds.width()) ? this._titleComponent.AABBBounds.width() : 0;\n const height = isFinite(this._titleComponent.AABBBounds.height()) ? this._titleComponent.AABBBounds.height() : 0;\n const rectWidth = this.table.tableNoFrameWidth;\n const rectHeight = this.table.tableNoFrameHeight;\n const padding = getQuadProps((attrs.padding as number | number[]) ?? this._titleOption.padding ?? 10);\n\n let x = 0;\n let y = 0;\n if (this._titleOption.orient === 'left') {\n x = padding[3];\n y = 0;\n // width += padding[1] + padding[3];\n } else if (this._titleOption.orient === 'top') {\n x = 0;\n y = padding[0];\n // height += padding[0] + padding[2];\n } else if (this._titleOption.orient === 'right') {\n x = rectWidth - width - padding[1];\n y = 0;\n width += padding[1] + padding[3];\n } else if (this._titleOption.orient === 'bottom') {\n x = 0;\n y = rectHeight - height - padding[2];\n // height += padding[0] + padding[2];\n }\n if (this._titleOption.orient === 'left') {\n this.table.tableNoFrameWidth = this.table.tableNoFrameWidth - Math.ceil(width);\n this.table.tableX += Math.ceil(width);\n } else if (this._titleOption.orient === 'top') {\n this.table.tableNoFrameHeight = this.table.tableNoFrameHeight - Math.ceil(height);\n this.table.tableY += Math.ceil(height);\n } else if (this._titleOption.orient === 'right') {\n this.table.tableNoFrameWidth = this.table.tableNoFrameWidth - Math.ceil(width);\n } else if (this._titleOption.orient === 'bottom') {\n this.table.tableNoFrameHeight = this.table.tableNoFrameHeight - Math.ceil(height);\n }\n this._cacheAttrs = attrs;\n if (this._titleOption.orient === 'right' || this._titleOption.orient === 'bottom') {\n this._titleComponent.setAttributes({\n x:\n this._titleOption.x ?? this._titleOption.orient === 'right'\n ? this.table.tableX + this.table.tableNoFrameWidth\n : this.table.tableX,\n y:\n this._titleOption.y ?? this._titleOption.orient === 'bottom'\n ? this.table.tableY + this.table.tableNoFrameHeight\n : this.table.tableY\n });\n }\n return this._titleComponent;\n }\n\n release(): void {\n this.table.scenegraph.stage.defaultLayer.removeChild(this._titleComponent);\n this._titleComponent = null;\n }\n private _getTitleAttrs() {\n const padding = getQuadProps(this._titleOption.padding ?? 10);\n const realWidth = this._titleOption.width ?? this.table.tableNoFrameWidth - padding[1] - padding[3];\n return {\n text: this._titleOption.text ?? '',\n subtext: this._titleOption.subtext ?? '',\n x:\n this._titleOption.x ?? this._titleOption.orient === 'right'\n ? this.table.tableX + this.table.tableNoFrameWidth\n : this.table.tableX,\n y:\n this._titleOption.y ?? this._titleOption.orient === 'bottom'\n ? this.table.tableY + this.table.tableNoFrameHeight\n : this.table.tableY,\n width: realWidth,\n height: this._titleOption.height,\n minWidth: this._titleOption.minWidth,\n maxWidth: this._titleOption.maxWidth,\n minHeight: this._titleOption.minHeight,\n maxHeight: this._titleOption.maxHeight,\n padding: this._titleOption.padding,\n align: this._titleOption.align ?? 'left',\n verticalAlign: this._titleOption.verticalAlign ?? 'top',\n textStyle: {\n width: realWidth,\n ...this._titleOption.textStyle\n },\n subtextStyle: {\n width: realWidth,\n ...this._titleOption.subtextStyle\n }\n } as TitleAttrs;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["components/title/title.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAIxE,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAE9D,OAAO,EAAE,OAAO,EAAE,MAAM,k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,CAAC,KAAK,CAAC,MAAM;YACvB,KAAK,EAAE,SAAS;YAChB,MAAM,EAAE,IAAI,CAAC,YAAY,CAAC,MAAM;YAChC,QAAQ,EAAE,IAAI,CAAC,YAAY,CAAC,QAAQ;YACpC,QAAQ,EAAE,IAAI,CAAC,YAAY,CAAC,QAAQ;YACpC,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,SAAS;YACtC,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,SAAS;YACtC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,OAAO;YAClC,KAAK,EAAE,MAAA,IAAI,CAAC,YAAY,CAAC,KAAK,mCAAI,MAAM;YACxC,aAAa,EAAE,MAAA,IAAI,CAAC,YAAY,CAAC,aAAa,mCAAI,KAAK;YACvD,SAAS,kBACP,KAAK,EAAE,SAAS,IACb,IAAI,CAAC,YAAY,CAAC,SAAS,CAC/B;YACD,YAAY,kBACV,KAAK,EAAE,SAAS,IACb,IAAI,CAAC,YAAY,CAAC,YAAY,CAClC;SACY,CAAC;IAClB,CAAC;CACF","file":"title.js","sourcesContent":["import { Title as TitleComponents } from '@visactor/vrender-components';\n// eslint-disable-next-line no-duplicate-imports\nimport type { TitleAttrs } from '@visactor/vrender-components';\nimport type { ITitle } from '../../ts-types/component/title';\nimport { getQuadProps } from '../../scenegraph/utils/padding';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport { isEqual } from '@visactor/vutils';\nexport class Title {\n table: BaseTableAPI;\n _titleOption: ITitle;\n private _titleComponent: TitleComponents;\n private _cacheAttrs: TitleAttrs;\n constructor(titleOption: ITitle, table: BaseTableAPI) {\n this.table = table;\n this._titleOption = titleOption;\n this._titleComponent = this._createOrUpdateTitleComponent(this._getTitleAttrs());\n }\n\n private _createOrUpdateTitleComponent(attrs: TitleAttrs): TitleComponents {\n if (this._titleComponent) {\n if (!isEqual(attrs, this._cacheAttrs)) {\n this._titleComponent.setAttributes(attrs);\n }\n } else {\n const title = new TitleComponents(attrs);\n title.name = 'title';\n this.table.scenegraph.stage.defaultLayer.appendChild(title);\n this._titleComponent = title;\n // 代理 title 组件上的事件\n // title.on('*', (event: any, type: string) => this._delegateEvent(title as unknown as INode, event, type));\n }\n // update table size\n this._adjustTableSize(this._titleComponent.attribute);\n return this._titleComponent;\n }\n\n resize() {\n if (!this._titleComponent) {\n return;\n }\n const padding = getQuadProps(this._titleOption.padding ?? 10);\n const realWidth = this._titleOption.width ?? this.table.tableNoFrameWidth - padding[1] - padding[3];\n this._titleComponent.setAttributes({\n x:\n this._titleOption.x ?? this._titleOption.orient === 'right'\n ? this.table.tableX + this.table.tableNoFrameWidth\n : this.table.tableX,\n y:\n this._titleOption.y ?? this._titleOption.orient === 'bottom'\n ? this.table.tableY + this.table.tableNoFrameHeight\n : this.table.tableY,\n width: realWidth,\n textStyle: {\n width: realWidth,\n ...this._titleOption.textStyle\n },\n subtextStyle: {\n width: realWidth,\n ...this._titleOption.subtextStyle\n }\n });\n this._adjustTableSize(this._titleComponent.attribute);\n }\n\n _adjustTableSize(attrs: TitleAttrs) {\n // 调整位置\n let width = isFinite(this._titleComponent.AABBBounds.width()) ? this._titleComponent.AABBBounds.width() : 0;\n const height = isFinite(this._titleComponent.AABBBounds.height()) ? this._titleComponent.AABBBounds.height() : 0;\n const rectWidth = this.table.tableNoFrameWidth;\n const rectHeight = this.table.tableNoFrameHeight;\n const padding = getQuadProps((attrs.padding as number | number[]) ?? this._titleOption.padding ?? 10);\n\n let x = 0;\n let y = 0;\n if (this._titleOption.orient === 'left') {\n x = padding[3];\n y = 0;\n // width += padding[1] + padding[3];\n } else if (this._titleOption.orient === 'top') {\n x = 0;\n y = padding[0];\n // height += padding[0] + padding[2];\n } else if (this._titleOption.orient === 'right') {\n x = rectWidth - width - padding[1];\n y = 0;\n width += padding[1] + padding[3];\n } else if (this._titleOption.orient === 'bottom') {\n x = 0;\n y = rectHeight - height - padding[2];\n // height += padding[0] + padding[2];\n }\n if (this._titleOption.orient === 'left') {\n this.table.tableNoFrameWidth = this.table.tableNoFrameWidth - Math.ceil(width);\n this.table.tableX += Math.ceil(width);\n } else if (this._titleOption.orient === 'top') {\n this.table.tableNoFrameHeight = this.table.tableNoFrameHeight - Math.ceil(height);\n this.table.tableY += Math.ceil(height);\n } else if (this._titleOption.orient === 'right') {\n this.table.tableNoFrameWidth = this.table.tableNoFrameWidth - Math.ceil(width);\n } else if (this._titleOption.orient === 'bottom') {\n this.table.tableNoFrameHeight = this.table.tableNoFrameHeight - Math.ceil(height);\n }\n this._cacheAttrs = attrs;\n if (this._titleOption.orient === 'right' || this._titleOption.orient === 'bottom') {\n this._titleComponent.setAttributes({\n x:\n this._titleOption.x ?? this._titleOption.orient === 'right'\n ? this.table.tableX + this.table.tableNoFrameWidth\n : this.table.tableX,\n y:\n this._titleOption.y ?? this._titleOption.orient === 'bottom'\n ? this.table.tableY + this.table.tableNoFrameHeight\n : this.table.tableY\n });\n }\n }\n\n release(): void {\n this.table.scenegraph.stage.defaultLayer.removeChild(this._titleComponent);\n this._titleComponent = null;\n }\n private _getTitleAttrs() {\n const padding = getQuadProps(this._titleOption.padding ?? 10);\n const realWidth = this._titleOption.width ?? this.table.tableNoFrameWidth - padding[1] - padding[3];\n return {\n text: this._titleOption.text ?? '',\n subtext: this._titleOption.subtext ?? '',\n x:\n this._titleOption.x ?? this._titleOption.orient === 'right'\n ? this.table.tableX + this.table.tableNoFrameWidth\n : this.table.tableX,\n y:\n this._titleOption.y ?? this._titleOption.orient === 'bottom'\n ? this.table.tableY + this.table.tableNoFrameHeight\n : this.table.tableY,\n width: realWidth,\n height: this._titleOption.height,\n minWidth: this._titleOption.minWidth,\n maxWidth: this._titleOption.maxWidth,\n minHeight: this._titleOption.minHeight,\n maxHeight: this._titleOption.maxHeight,\n padding: this._titleOption.padding,\n align: this._titleOption.align ?? 'left',\n verticalAlign: this._titleOption.verticalAlign ?? 'top',\n textStyle: {\n width: realWidth,\n ...this._titleOption.textStyle\n },\n subtextStyle: {\n width: realWidth,\n ...this._titleOption.subtextStyle\n }\n } as TitleAttrs;\n }\n}\n"]}
|
package/es/core/BaseTable.d.ts
CHANGED
|
@@ -50,9 +50,10 @@ export declare abstract class BaseTable extends EventTarget implements BaseTable
|
|
|
50
50
|
id: string;
|
|
51
51
|
headerStyleCache: any;
|
|
52
52
|
bodyStyleCache: any;
|
|
53
|
-
|
|
53
|
+
container: HTMLElement;
|
|
54
|
+
constructor(container: HTMLElement, options?: BaseTableConstructorOptions);
|
|
54
55
|
throttleInvalidate: (this: any, ...args: any[]) => void;
|
|
55
|
-
|
|
56
|
+
getContainer(): HTMLElement;
|
|
56
57
|
getElement(): HTMLElement;
|
|
57
58
|
get canvas(): HTMLCanvasElement;
|
|
58
59
|
resize(): void;
|
|
@@ -115,7 +116,6 @@ export declare abstract class BaseTable extends EventTarget implements BaseTable
|
|
|
115
116
|
getColsWidth(startCol: number, endCol: number): number;
|
|
116
117
|
getRowHeight(row: number): number;
|
|
117
118
|
setRowHeight(row: number, height: number, clearCache?: boolean): void;
|
|
118
|
-
fillRowsHeight(rowStart: number, rowEnd: number, rowHeight: number): void;
|
|
119
119
|
getRowsHeight(startRow: number, endRow: number): number;
|
|
120
120
|
getColWidthDefine(col: number): string | number;
|
|
121
121
|
getColWidth(col: number): number;
|
|
@@ -285,6 +285,7 @@ export declare abstract class BaseTable extends EventTarget implements BaseTable
|
|
|
285
285
|
getSelectedCellInfos(): CellInfo[][];
|
|
286
286
|
measureText(text: string, font: {
|
|
287
287
|
fontSize: number;
|
|
288
|
+
fontWeight: string | number;
|
|
288
289
|
fontFamily: string;
|
|
289
290
|
}): ITextSize;
|
|
290
291
|
measureTextBounds(attributes: IWrapTextGraphicAttribute): ITextSize;
|
package/es/core/BaseTable.js
CHANGED
|
@@ -70,14 +70,15 @@ export class BaseTable extends EventTarget {
|
|
|
70
70
|
static get EVENT_TYPE() {
|
|
71
71
|
return TABLE_EVENT_TYPE;
|
|
72
72
|
}
|
|
73
|
-
constructor(options = {}) {
|
|
73
|
+
constructor(container, options = {}) {
|
|
74
74
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
75
|
-
super(), this.showFrozenIcon = !0, this.showSort = !0, this.bottomFrozenRowCount = 0,
|
|
76
|
-
this.rightFrozenColCount = 0, this.version = "0.9.3-alpha.
|
|
77
|
-
this.throttleInvalidate = throttle2(this.render.bind(this), 200);
|
|
78
|
-
const {frozenColCount: frozenColCount = 0, defaultRowHeight: defaultRowHeight = 40, defaultHeaderRowHeight: defaultHeaderRowHeight, defaultColWidth: defaultColWidth = 80, defaultHeaderColWidth: defaultHeaderColWidth, widthMode: widthMode = "standard", heightMode: heightMode = "standard", autoFillWidth: autoFillWidth = !1, keyboardOptions: keyboardOptions,
|
|
79
|
-
this.
|
|
80
|
-
this.
|
|
75
|
+
if (super(), this.showFrozenIcon = !0, this.showSort = !0, this.bottomFrozenRowCount = 0,
|
|
76
|
+
this.rightFrozenColCount = 0, this.version = "0.9.3-alpha.7", this.id = `VTable${Date.now()}`,
|
|
77
|
+
this.throttleInvalidate = throttle2(this.render.bind(this), 200), !container) throw new Error("vtable's container is undefined");
|
|
78
|
+
const {frozenColCount: frozenColCount = 0, defaultRowHeight: defaultRowHeight = 40, defaultHeaderRowHeight: defaultHeaderRowHeight, defaultColWidth: defaultColWidth = 80, defaultHeaderColWidth: defaultHeaderColWidth, widthMode: widthMode = "standard", heightMode: heightMode = "standard", autoFillWidth: autoFillWidth = !1, keyboardOptions: keyboardOptions, columnResizeMode: columnResizeMode, dragHeaderMode: dragHeaderMode, showFrozenIcon: showFrozenIcon, allowFrozenColCount: allowFrozenColCount, padding: padding, hover: hover, menu: menu, select: click, customRender: customRender, pixelRatio: pixelRatio = defaultPixelRatio} = options;
|
|
79
|
+
this.container = container, this.options = options, this.options.container = container,
|
|
80
|
+
this._widthMode = widthMode, this._heightMode = heightMode, this._autoFillWidth = autoFillWidth,
|
|
81
|
+
this.customRender = customRender, this.padding = {
|
|
81
82
|
top: 0,
|
|
82
83
|
right: 0,
|
|
83
84
|
left: 0,
|
|
@@ -106,7 +107,7 @@ export class BaseTable extends EventTarget {
|
|
|
106
107
|
return this._.canvas.width / (null !== (_a = this._.context.pixelRatio) && void 0 !== _a ? _a : window.devicePixelRatio);
|
|
107
108
|
}
|
|
108
109
|
}, internalProps.cellTextOverflows = {}, internalProps.focusedTable = !1, internalProps.theme = themes.of(null !== (_a = options.theme) && void 0 !== _a ? _a : themes.DEFAULT),
|
|
109
|
-
|
|
110
|
+
container ? (container.innerHTML = "", container.appendChild(internalProps.element),
|
|
110
111
|
this._updateSize()) : this._updateSize(), this.options = options, internalProps.theme = themes.of(null !== (_b = options.theme) && void 0 !== _b ? _b : themes.DEFAULT),
|
|
111
112
|
internalProps.bodyHelper = new BodyHelper(this), internalProps.headerHelper = new HeaderHelper(this),
|
|
112
113
|
internalProps.autoWrapText = options.autoWrapText, internalProps.allowFrozenColCount = null !== (_c = options.allowFrozenColCount) && void 0 !== _c ? _c : internalProps.colCount,
|
|
@@ -131,8 +132,8 @@ export class BaseTable extends EventTarget {
|
|
|
131
132
|
"html" === internalProps.menu.renderMode && (internalProps.menuHandler = new MenuHandler(this)),
|
|
132
133
|
this.headerStyleCache = new Map, this.bodyStyleCache = new Map;
|
|
133
134
|
}
|
|
134
|
-
|
|
135
|
-
return this.
|
|
135
|
+
getContainer() {
|
|
136
|
+
return this.container;
|
|
136
137
|
}
|
|
137
138
|
getElement() {
|
|
138
139
|
return this.internalProps.element;
|
|
@@ -141,7 +142,8 @@ export class BaseTable extends EventTarget {
|
|
|
141
142
|
return this.internalProps.canvas;
|
|
142
143
|
}
|
|
143
144
|
resize() {
|
|
144
|
-
this._updateSize(), this.
|
|
145
|
+
this._updateSize(), this.internalProps.legends && this.internalProps.legends.resize(),
|
|
146
|
+
this.internalProps.title && this.internalProps.title.resize(), this.scenegraph.resize();
|
|
145
147
|
}
|
|
146
148
|
get rowCount() {
|
|
147
149
|
return this.internalProps.rowCount;
|
|
@@ -349,11 +351,6 @@ export class BaseTable extends EventTarget {
|
|
|
349
351
|
setRowHeight(row, height, clearCache) {
|
|
350
352
|
this.rowHeightsMap.put(row, Math.round(height)), clearCache && this._clearRowRangeHeightsMap(row);
|
|
351
353
|
}
|
|
352
|
-
fillRowsHeight(rowStart, rowEnd, rowHeight) {
|
|
353
|
-
var _a;
|
|
354
|
-
for (let row = rowStart; row <= rowEnd; row++) this.rowHeightsMap.put(row, Math.round(rowHeight)),
|
|
355
|
-
this._rowRangeHeightsMap.set(`$0$${row}`, Math.round((null !== (_a = this._rowRangeHeightsMap.get("$0$" + (row - 1))) && void 0 !== _a ? _a : 0) + rowHeight));
|
|
356
|
-
}
|
|
357
354
|
getRowsHeight(startRow, endRow) {
|
|
358
355
|
var _a, _b;
|
|
359
356
|
const cachedRowHeight = this._rowRangeHeightsMap.get(`$${startRow}$${endRow}`);
|