@visactor/vtable 0.9.1-alpha.4 → 0.9.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.
- package/cjs/ListTable.js +15 -4
- package/cjs/ListTable.js.map +1 -1
- package/cjs/PivotTable.d.ts +2 -1
- package/cjs/PivotTable.js +15 -3
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/body-helper/body-helper.d.ts +1 -0
- package/cjs/body-helper/body-helper.js +6 -3
- package/cjs/body-helper/body-helper.js.map +1 -1
- package/cjs/body-helper/style/ProgressBarStyle.js +14 -8
- package/cjs/body-helper/style/ProgressBarStyle.js.map +1 -1
- package/cjs/body-helper/style/Style.d.ts +3 -0
- package/cjs/body-helper/style/Style.js +21 -14
- package/cjs/body-helper/style/Style.js.map +1 -1
- package/cjs/core/BaseTable.d.ts +4 -1
- package/cjs/core/BaseTable.js +31 -20
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/tableHelper.js +11 -6
- package/cjs/core/tableHelper.js.map +1 -1
- package/cjs/data/DataSource.d.ts +4 -1
- package/cjs/data/DataSource.js +3 -3
- package/cjs/data/DataSource.js.map +1 -1
- package/cjs/event/event.d.ts +14 -19
- package/cjs/event/event.js +12 -329
- package/cjs/event/event.js.map +1 -1
- package/cjs/event/listener/container-dom.d.ts +2 -0
- package/cjs/event/listener/container-dom.js +42 -0
- package/cjs/event/listener/container-dom.js.map +1 -0
- package/cjs/event/listener/scroll-bar.d.ts +2 -0
- package/cjs/event/listener/scroll-bar.js +44 -0
- package/cjs/event/listener/scroll-bar.js.map +1 -0
- package/cjs/event/listener/table-group.d.ts +2 -0
- package/cjs/event/listener/table-group.js +262 -0
- package/cjs/event/listener/table-group.js.map +1 -0
- package/cjs/event/listener/touch.d.ts +2 -0
- package/cjs/event/listener/touch.js +76 -0
- package/cjs/event/listener/touch.js.map +1 -0
- package/cjs/event/scroll.d.ts +2 -0
- package/cjs/event/scroll.js +32 -4
- package/cjs/event/scroll.js.map +1 -1
- package/cjs/event/util.d.ts +16 -0
- package/cjs/event/util.js +30 -0
- package/cjs/event/util.js.map +1 -0
- package/cjs/header-helper/header-helper.d.ts +5 -6
- package/cjs/header-helper/header-helper.js +19 -22
- package/cjs/header-helper/header-helper.js.map +1 -1
- package/cjs/icons.js +11 -11
- package/cjs/icons.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/index.js +1 -2
- package/cjs/layout/pivot-header-layout.d.ts +4 -1
- package/cjs/layout/pivot-header-layout.js +15 -14
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/layout/simple-header-layout.d.ts +13 -1
- package/cjs/layout/simple-header-layout.js +12 -1
- package/cjs/layout/simple-header-layout.js.map +1 -1
- package/cjs/render/layout/container.js +1 -1
- package/cjs/render/layout/container.js.map +1 -1
- package/cjs/render/layout/element.d.ts +1 -1
- package/cjs/render/layout/element.js.map +1 -1
- package/cjs/render/layout/rect.d.ts +2 -2
- package/cjs/render/layout/rect.js +2 -2
- package/cjs/render/layout/rect.js.map +1 -1
- package/cjs/scenegraph/component/custom.js +18 -7
- package/cjs/scenegraph/component/custom.js.map +1 -1
- package/cjs/scenegraph/component/menu.js +2 -2
- package/cjs/scenegraph/component/menu.js.map +1 -1
- package/cjs/scenegraph/component/table-component.d.ts +3 -3
- package/cjs/scenegraph/component/table-component.js +36 -26
- package/cjs/scenegraph/component/table-component.js.map +1 -1
- package/cjs/scenegraph/graphic/chart.d.ts +1 -0
- package/cjs/scenegraph/graphic/chart.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/chart-render.js +7 -2
- package/cjs/scenegraph/graphic/contributions/chart-render.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
- package/cjs/scenegraph/graphic/group.d.ts +4 -0
- package/cjs/scenegraph/graphic/group.js +6 -0
- package/cjs/scenegraph/graphic/group.js.map +1 -1
- package/cjs/scenegraph/graphic/text.js +7 -7
- package/cjs/scenegraph/graphic/text.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.d.ts +3 -4
- package/cjs/scenegraph/group-creater/cell-helper.js +25 -18
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/chart-cell.js +6 -4
- package/cjs/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/image-cell.js +11 -1
- package/cjs/scenegraph/group-creater/cell-type/image-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/progress-bar-cell.js +12 -9
- package/cjs/scenegraph/group-creater/cell-type/progress-bar-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/text-cell.d.ts +1 -1
- package/cjs/scenegraph/group-creater/cell-type/text-cell.js +7 -4
- package/cjs/scenegraph/group-creater/cell-type/text-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/video-cell.js +1 -1
- package/cjs/scenegraph/group-creater/cell-type/video-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/column-helper.d.ts +3 -3
- package/cjs/scenegraph/group-creater/column-helper.js +22 -11
- package/cjs/scenegraph/group-creater/column-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/column.d.ts +0 -6
- package/cjs/scenegraph/group-creater/column.js +3 -12
- package/cjs/scenegraph/group-creater/column.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/proxy.d.ts +0 -2
- package/cjs/scenegraph/group-creater/progress/proxy.js +23 -19
- package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/cjs/scenegraph/layout/auto-height.js +1 -1
- package/cjs/scenegraph/layout/auto-height.js.map +1 -1
- package/cjs/scenegraph/layout/auto-width.js +1 -1
- package/cjs/scenegraph/layout/auto-width.js.map +1 -1
- package/cjs/scenegraph/layout/compute-col-width.d.ts +1 -1
- package/cjs/scenegraph/layout/compute-col-width.js +28 -8
- package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
- package/cjs/scenegraph/layout/frozen.d.ts +3 -0
- package/cjs/scenegraph/layout/frozen.js +66 -0
- package/cjs/scenegraph/layout/frozen.js.map +1 -0
- package/cjs/scenegraph/layout/move-cell.js +5 -1
- package/cjs/scenegraph/layout/move-cell.js.map +1 -1
- package/cjs/scenegraph/layout/update-cell.js +3 -3
- package/cjs/scenegraph/layout/update-cell.js.map +1 -1
- package/cjs/scenegraph/layout/update-height.js +4 -4
- package/cjs/scenegraph/layout/update-height.js.map +1 -1
- package/cjs/scenegraph/layout/update-row.d.ts +3 -0
- package/cjs/scenegraph/layout/update-row.js +81 -0
- package/cjs/scenegraph/layout/update-row.js.map +1 -0
- package/cjs/scenegraph/layout/update-width.js +5 -5
- package/cjs/scenegraph/layout/update-width.js.map +1 -1
- package/cjs/scenegraph/refresh-node/update-chart.d.ts +2 -0
- package/cjs/scenegraph/refresh-node/update-chart.js +26 -0
- package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -0
- package/cjs/scenegraph/scenegraph.d.ts +15 -3
- package/cjs/scenegraph/scenegraph.js +86 -95
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/scenegraph/select/create-select-border.js +1 -0
- package/cjs/scenegraph/select/create-select-border.js.map +1 -1
- package/cjs/scenegraph/stick-text/index.js +52 -40
- package/cjs/scenegraph/stick-text/index.js.map +1 -1
- package/cjs/scenegraph/style/frame-border.d.ts +1 -1
- package/cjs/scenegraph/style/frame-border.js +7 -7
- package/cjs/scenegraph/style/frame-border.js.map +1 -1
- package/cjs/scenegraph/utils/deal-promise-data.d.ts +2 -0
- package/cjs/scenegraph/utils/deal-promise-data.js +14 -0
- package/cjs/scenegraph/utils/deal-promise-data.js.map +1 -0
- package/cjs/scenegraph/utils/empty-group.d.ts +2 -0
- package/cjs/scenegraph/utils/empty-group.js +10 -0
- package/cjs/scenegraph/utils/empty-group.js.map +1 -0
- package/cjs/scenegraph/utils/get-hierarchy-offset.d.ts +2 -0
- package/cjs/scenegraph/utils/get-hierarchy-offset.js +27 -0
- package/cjs/scenegraph/utils/get-hierarchy-offset.js.map +1 -0
- package/cjs/scenegraph/utils/padding.d.ts +1 -1
- package/cjs/scenegraph/utils/padding.js +3 -3
- package/cjs/scenegraph/utils/padding.js.map +1 -1
- package/cjs/scenegraph/utils/text-icon-layout.d.ts +3 -2
- package/cjs/scenegraph/utils/text-icon-layout.js +24 -19
- package/cjs/scenegraph/utils/text-icon-layout.js.map +1 -1
- package/cjs/scenegraph/utils/text-pos.js +1 -1
- package/cjs/scenegraph/utils/text-pos.js.map +1 -1
- package/cjs/state/cell-move/adjust-header.js +9 -2
- package/cjs/state/cell-move/adjust-header.js.map +1 -1
- package/cjs/state/cell-move/index.js +9 -3
- package/cjs/state/cell-move/index.js.map +1 -1
- package/cjs/state/frozen/index.d.ts +2 -0
- package/cjs/state/{pin → frozen}/index.js +2 -2
- package/cjs/state/frozen/index.js.map +1 -0
- package/cjs/state/state.d.ts +1 -1
- package/cjs/state/state.js +16 -12
- package/cjs/state/state.js.map +1 -1
- package/cjs/themes/ARCO.js +1 -1
- package/cjs/themes/ARCO.js.map +1 -1
- package/cjs/themes/BRIGHT.js +1 -1
- package/cjs/themes/BRIGHT.js.map +1 -1
- package/cjs/themes/DARK.js +1 -1
- package/cjs/themes/DARK.js.map +1 -1
- package/cjs/themes/DEFAULT.js +1 -1
- package/cjs/themes/DEFAULT.js.map +1 -1
- package/cjs/themes/theme.d.ts +1 -1
- package/cjs/themes/theme.js +6 -6
- package/cjs/themes/theme.js.map +1 -1
- package/cjs/tools/LimitPromiseQueue.js +1 -2
- package/cjs/tools/NumberMap.js +1 -1
- package/cjs/tools/Rect.js +1 -1
- package/cjs/tools/calc.js +1 -1
- package/cjs/tools/debounce.js +1 -1
- package/cjs/tools/diff-cell.d.ts +10 -0
- package/cjs/tools/diff-cell.js +49 -0
- package/cjs/tools/diff-cell.js.map +1 -0
- package/cjs/tools/dom.js +1 -1
- package/cjs/tools/env.js +1 -1
- package/cjs/tools/helper.d.ts +11 -0
- package/cjs/tools/helper.js +7 -2
- package/cjs/tools/helper.js.map +1 -1
- package/cjs/tooltip/BaseTooltip.js +1 -1
- package/cjs/tooltip/Tooltip.js +2 -1
- package/cjs/tooltip/TooltipHandler.js +1 -1
- package/cjs/ts-types/base-table.d.ts +8 -2
- package/cjs/ts-types/base-table.js +1 -1
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/common.js +1 -1
- package/cjs/ts-types/customElement.d.ts +11 -2
- package/cjs/ts-types/customElement.js +1 -1
- package/cjs/ts-types/customElement.js.map +1 -1
- package/cjs/ts-types/customLayout.js +1 -1
- package/cjs/ts-types/events.js +1 -1
- package/cjs/ts-types/icon.d.ts +4 -5
- package/cjs/ts-types/icon.js +6 -6
- package/cjs/ts-types/icon.js.map +1 -1
- package/cjs/ts-types/list-table/define/basic-define.d.ts +4 -1
- package/cjs/ts-types/list-table/define/basic-define.js.map +1 -1
- package/cjs/ts-types/list-table/layout-map/api.js.map +1 -1
- package/cjs/ts-types/theme.d.ts +1 -1
- package/cjs/ts-types/theme.js.map +1 -1
- package/dist/vtable.es5.js +53155 -0
- package/dist/vtable.es5.min.js +3 -0
- package/dist/vtable.js +17155 -21633
- package/dist/vtable.min.js +15 -3
- package/es/ListTable.js +16 -3
- package/es/ListTable.js.map +1 -1
- package/es/PivotTable.d.ts +2 -1
- package/es/PivotTable.js +16 -2
- package/es/PivotTable.js.map +1 -1
- package/es/body-helper/body-helper.d.ts +1 -0
- package/es/body-helper/body-helper.js +6 -3
- package/es/body-helper/body-helper.js.map +1 -1
- package/es/body-helper/style/ProgressBarStyle.js +14 -8
- package/es/body-helper/style/ProgressBarStyle.js.map +1 -1
- package/es/body-helper/style/Style.d.ts +3 -0
- package/es/body-helper/style/Style.js +21 -14
- package/es/body-helper/style/Style.js.map +1 -1
- package/es/core/BaseTable.d.ts +4 -1
- package/es/core/BaseTable.js +31 -21
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/tableHelper.js +11 -7
- package/es/core/tableHelper.js.map +1 -1
- package/es/data/DataSource.d.ts +4 -1
- package/es/data/DataSource.js +4 -2
- package/es/data/DataSource.js.map +1 -1
- package/es/event/event.d.ts +14 -19
- package/es/event/event.js +16 -333
- package/es/event/event.js.map +1 -1
- package/es/event/listener/container-dom.d.ts +2 -0
- package/es/event/listener/container-dom.js +40 -0
- package/es/event/listener/container-dom.js.map +1 -0
- package/es/event/listener/scroll-bar.d.ts +2 -0
- package/es/event/listener/scroll-bar.js +37 -0
- package/es/event/listener/scroll-bar.js.map +1 -0
- package/es/event/listener/table-group.d.ts +2 -0
- package/es/event/listener/table-group.js +265 -0
- package/es/event/listener/table-group.js.map +1 -0
- package/es/event/listener/touch.d.ts +2 -0
- package/es/event/listener/touch.js +67 -0
- package/es/event/listener/touch.js.map +1 -0
- package/es/event/scroll.d.ts +2 -0
- package/es/event/scroll.js +29 -3
- package/es/event/scroll.js.map +1 -1
- package/es/event/util.d.ts +16 -0
- package/es/event/util.js +24 -0
- package/es/event/util.js.map +1 -0
- package/es/header-helper/header-helper.d.ts +5 -6
- package/es/header-helper/header-helper.js +22 -24
- package/es/header-helper/header-helper.js.map +1 -1
- package/es/icons.js +11 -11
- package/es/icons.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/index.js +1 -2
- package/es/layout/pivot-header-layout.d.ts +4 -1
- package/es/layout/pivot-header-layout.js +17 -13
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/layout/simple-header-layout.d.ts +13 -1
- package/es/layout/simple-header-layout.js +12 -1
- package/es/layout/simple-header-layout.js.map +1 -1
- package/es/render/layout/container.js +1 -1
- package/es/render/layout/container.js.map +1 -1
- package/es/render/layout/element.d.ts +1 -1
- package/es/render/layout/element.js.map +1 -1
- package/es/render/layout/rect.d.ts +2 -2
- package/es/render/layout/rect.js +2 -2
- package/es/render/layout/rect.js.map +1 -1
- package/es/scenegraph/component/custom.js +20 -9
- package/es/scenegraph/component/custom.js.map +1 -1
- package/es/scenegraph/component/menu.js +2 -2
- package/es/scenegraph/component/menu.js.map +1 -1
- package/es/scenegraph/component/table-component.d.ts +3 -3
- package/es/scenegraph/component/table-component.js +36 -26
- package/es/scenegraph/component/table-component.js.map +1 -1
- package/es/scenegraph/graphic/chart.d.ts +1 -0
- package/es/scenegraph/graphic/chart.js.map +1 -1
- package/es/scenegraph/graphic/contributions/chart-render.js +7 -2
- package/es/scenegraph/graphic/contributions/chart-render.js.map +1 -1
- package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
- package/es/scenegraph/graphic/group.d.ts +4 -0
- package/es/scenegraph/graphic/group.js +6 -0
- package/es/scenegraph/graphic/group.js.map +1 -1
- package/es/scenegraph/graphic/text.js +7 -7
- package/es/scenegraph/graphic/text.js.map +1 -1
- package/es/scenegraph/group-creater/cell-helper.d.ts +3 -4
- package/es/scenegraph/group-creater/cell-helper.js +28 -17
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/chart-cell.js +6 -4
- package/es/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/image-cell.js +12 -2
- package/es/scenegraph/group-creater/cell-type/image-cell.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/progress-bar-cell.js +13 -10
- package/es/scenegraph/group-creater/cell-type/progress-bar-cell.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/text-cell.d.ts +1 -1
- package/es/scenegraph/group-creater/cell-type/text-cell.js +7 -4
- package/es/scenegraph/group-creater/cell-type/text-cell.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/video-cell.js +1 -1
- package/es/scenegraph/group-creater/cell-type/video-cell.js.map +1 -1
- package/es/scenegraph/group-creater/column-helper.d.ts +3 -3
- package/es/scenegraph/group-creater/column-helper.js +25 -10
- package/es/scenegraph/group-creater/column-helper.js.map +1 -1
- package/es/scenegraph/group-creater/column.d.ts +0 -6
- package/es/scenegraph/group-creater/column.js +3 -12
- package/es/scenegraph/group-creater/column.js.map +1 -1
- package/es/scenegraph/group-creater/progress/proxy.d.ts +0 -2
- package/es/scenegraph/group-creater/progress/proxy.js +22 -21
- package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/es/scenegraph/layout/auto-height.js +1 -1
- package/es/scenegraph/layout/auto-height.js.map +1 -1
- package/es/scenegraph/layout/auto-width.js +2 -2
- package/es/scenegraph/layout/auto-width.js.map +1 -1
- package/es/scenegraph/layout/compute-col-width.d.ts +1 -1
- package/es/scenegraph/layout/compute-col-width.js +30 -10
- package/es/scenegraph/layout/compute-col-width.js.map +1 -1
- package/es/scenegraph/layout/frozen.d.ts +3 -0
- package/es/scenegraph/layout/frozen.js +58 -0
- package/es/scenegraph/layout/frozen.js.map +1 -0
- package/es/scenegraph/layout/move-cell.js +5 -1
- package/es/scenegraph/layout/move-cell.js.map +1 -1
- package/es/scenegraph/layout/update-cell.js +4 -4
- package/es/scenegraph/layout/update-cell.js.map +1 -1
- package/es/scenegraph/layout/update-height.js +5 -5
- package/es/scenegraph/layout/update-height.js.map +1 -1
- package/es/scenegraph/layout/update-row.d.ts +3 -0
- package/es/scenegraph/layout/update-row.js +73 -0
- package/es/scenegraph/layout/update-row.js.map +1 -0
- package/es/scenegraph/layout/update-width.js +6 -6
- package/es/scenegraph/layout/update-width.js.map +1 -1
- package/es/scenegraph/refresh-node/update-chart.d.ts +2 -0
- package/es/scenegraph/refresh-node/update-chart.js +20 -0
- package/es/scenegraph/refresh-node/update-chart.js.map +1 -0
- package/es/scenegraph/scenegraph.d.ts +15 -3
- package/es/scenegraph/scenegraph.js +92 -94
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/scenegraph/select/create-select-border.js +1 -0
- package/es/scenegraph/select/create-select-border.js.map +1 -1
- package/es/scenegraph/stick-text/index.js +52 -40
- package/es/scenegraph/stick-text/index.js.map +1 -1
- package/es/scenegraph/style/frame-border.d.ts +1 -1
- package/es/scenegraph/style/frame-border.js +9 -9
- package/es/scenegraph/style/frame-border.js.map +1 -1
- package/es/scenegraph/utils/deal-promise-data.d.ts +2 -0
- package/es/scenegraph/utils/deal-promise-data.js +8 -0
- package/es/scenegraph/utils/deal-promise-data.js.map +1 -0
- package/es/scenegraph/utils/empty-group.d.ts +2 -0
- package/es/scenegraph/utils/empty-group.js +6 -0
- package/es/scenegraph/utils/empty-group.js.map +1 -0
- package/es/scenegraph/utils/get-hierarchy-offset.d.ts +2 -0
- package/es/scenegraph/utils/get-hierarchy-offset.js +19 -0
- package/es/scenegraph/utils/get-hierarchy-offset.js.map +1 -0
- package/es/scenegraph/utils/padding.d.ts +1 -1
- package/es/scenegraph/utils/padding.js +1 -1
- package/es/scenegraph/utils/padding.js.map +1 -1
- package/es/scenegraph/utils/text-icon-layout.d.ts +3 -2
- package/es/scenegraph/utils/text-icon-layout.js +27 -19
- package/es/scenegraph/utils/text-icon-layout.js.map +1 -1
- package/es/scenegraph/utils/text-pos.js +2 -2
- package/es/scenegraph/utils/text-pos.js.map +1 -1
- package/es/state/cell-move/adjust-header.js +9 -2
- package/es/state/cell-move/adjust-header.js.map +1 -1
- package/es/state/cell-move/index.js +9 -3
- package/es/state/cell-move/index.js.map +1 -1
- package/es/state/frozen/index.d.ts +2 -0
- package/es/state/{pin → frozen}/index.js +1 -1
- package/es/state/frozen/index.js.map +1 -0
- package/es/state/state.d.ts +1 -1
- package/es/state/state.js +16 -12
- package/es/state/state.js.map +1 -1
- package/es/themes/ARCO.js +1 -1
- package/es/themes/ARCO.js.map +1 -1
- package/es/themes/BRIGHT.js +1 -1
- package/es/themes/BRIGHT.js.map +1 -1
- package/es/themes/DARK.js +1 -1
- package/es/themes/DARK.js.map +1 -1
- package/es/themes/DEFAULT.js +1 -1
- package/es/themes/DEFAULT.js.map +1 -1
- package/es/themes/theme.d.ts +1 -1
- package/es/themes/theme.js +6 -6
- package/es/themes/theme.js.map +1 -1
- package/es/tools/LimitPromiseQueue.js +1 -2
- package/es/tools/NumberMap.js +1 -1
- package/es/tools/Rect.js +1 -1
- package/es/tools/calc.js +1 -1
- package/es/tools/debounce.js +1 -1
- package/es/tools/diff-cell.d.ts +10 -0
- package/es/tools/diff-cell.js +42 -0
- package/es/tools/diff-cell.js.map +1 -0
- package/es/tools/dom.js +1 -1
- package/es/tools/env.js +1 -1
- package/es/tools/helper.d.ts +11 -0
- package/es/tools/helper.js +4 -0
- package/es/tools/helper.js.map +1 -1
- package/es/tooltip/BaseTooltip.js +1 -1
- package/es/tooltip/Tooltip.js +2 -1
- package/es/tooltip/TooltipHandler.js +1 -1
- package/es/ts-types/base-table.d.ts +8 -2
- package/es/ts-types/base-table.js +1 -1
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/common.js +1 -1
- package/es/ts-types/customElement.d.ts +11 -2
- package/es/ts-types/customElement.js +1 -1
- package/es/ts-types/customElement.js.map +1 -1
- package/es/ts-types/customLayout.js +1 -1
- package/es/ts-types/events.js +1 -1
- package/es/ts-types/icon.d.ts +4 -5
- package/es/ts-types/icon.js +6 -6
- package/es/ts-types/icon.js.map +1 -1
- package/es/ts-types/list-table/define/basic-define.d.ts +4 -1
- package/es/ts-types/list-table/define/basic-define.js.map +1 -1
- package/es/ts-types/list-table/layout-map/api.js.map +1 -1
- package/es/ts-types/theme.d.ts +1 -1
- package/es/ts-types/theme.js.map +1 -1
- package/package.json +9 -9
- package/cjs/scenegraph/component/menu.d.ts +0 -41
- package/cjs/scenegraph/graphic/text.d.ts +0 -16
- package/cjs/state/pin/index.d.ts +0 -2
- package/cjs/state/pin/index.js.map +0 -1
- package/es/scenegraph/component/menu.d.ts +0 -41
- package/es/scenegraph/graphic/text.d.ts +0 -16
- package/es/state/pin/index.d.ts +0 -2
- package/es/state/pin/index.js.map +0 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.resetFrozen = exports.dealFrozen = void 0;
|
|
6
|
+
|
|
7
|
+
const group_1 = require("../graphic/group");
|
|
8
|
+
|
|
9
|
+
function dealFrozen(scene) {
|
|
10
|
+
var _a, _b;
|
|
11
|
+
if (scene.table.frozenColCount > scene.table.rowHeaderLevelCount) {
|
|
12
|
+
scene.rowHeaderGroup.setAttribute("height", scene.bodyGroup.attribute.height), scene.rowHeaderGroup.setAttribute("y", scene.bodyGroup.attribute.y),
|
|
13
|
+
scene.cornerHeaderGroup.setAttribute("height", scene.colHeaderGroup.attribute.height);
|
|
14
|
+
for (let i = 0; i < scene.table.frozenColCount - scene.table.rowHeaderLevelCount; i++) moveColumnFromBodyToRowHeader(scene),
|
|
15
|
+
moveColumnFromColHeaderToCornerHeader(scene);
|
|
16
|
+
} else if (scene.table.frozenColCount < scene.table.rowHeaderLevelCount) for (let i = 0; i < scene.table.rowHeaderLevelCount - scene.table.frozenColCount; i++) moveColumnFromRowHeaderToBody(scene),
|
|
17
|
+
moveColumnFromCornerHeaderToColHeader(scene);
|
|
18
|
+
scene.bodyGroup.setAttribute("x", scene.rowHeaderGroup.attribute.width), scene.colHeaderGroup.setAttribute("x", scene.cornerHeaderGroup.attribute.width),
|
|
19
|
+
scene.updateContainer(), scene.updateBorderSizeAndPosition(), scene.isPivot || scene.transpose || scene.component.setFrozenColumnShadow(scene.table.frozenColCount - 1),
|
|
20
|
+
scene.hasFrozen = !0, scene.frozenColCount = scene.table.frozenColCount, scene.frozenRowCount = null !== (_b = null === (_a = scene.colHeaderGroup.firstChild) || void 0 === _a ? void 0 : _a.childrenCount) && void 0 !== _b ? _b : 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function resetFrozen(scene) {
|
|
24
|
+
var _a, _b;
|
|
25
|
+
if (scene.frozenColCount > scene.table.rowHeaderLevelCount) for (let i = 0; i < scene.frozenColCount - scene.table.rowHeaderLevelCount; i++) moveColumnFromRowHeaderToBody(scene),
|
|
26
|
+
moveColumnFromCornerHeaderToColHeader(scene); else if (scene.frozenColCount < scene.table.rowHeaderLevelCount) {
|
|
27
|
+
scene.rowHeaderGroup.setAttribute("height", scene.bodyGroup.attribute.height), scene.rowHeaderGroup.setAttribute("y", scene.bodyGroup.attribute.y),
|
|
28
|
+
scene.cornerHeaderGroup.setAttribute("height", scene.colHeaderGroup.attribute.height);
|
|
29
|
+
for (let i = 0; i < scene.table.rowHeaderLevelCount - scene.frozenColCount; i++) moveColumnFromBodyToRowHeader(scene),
|
|
30
|
+
moveColumnFromColHeaderToCornerHeader(scene);
|
|
31
|
+
}
|
|
32
|
+
scene.bodyGroup.setAttribute("x", scene.rowHeaderGroup.attribute.width), scene.colHeaderGroup.setAttribute("x", scene.cornerHeaderGroup.attribute.width),
|
|
33
|
+
scene.updateContainer(), scene.updateBorderSizeAndPosition(), scene.isPivot || scene.transpose || scene.component.setFrozenColumnShadow(scene.table.frozenColCount - 1),
|
|
34
|
+
scene.hasFrozen = !0, scene.frozenColCount = scene.table.rowHeaderLevelCount, scene.frozenRowCount = null !== (_b = null === (_a = scene.colHeaderGroup.firstChild) || void 0 === _a ? void 0 : _a.childrenCount) && void 0 !== _b ? _b : 0;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function moveColumnFromBodyToRowHeader(scene) {
|
|
38
|
+
const column = scene.bodyGroup.firstChild instanceof group_1.Group ? scene.bodyGroup.firstChild : null;
|
|
39
|
+
column && (scene.rowHeaderGroup.appendChild(column), scene.rowHeaderGroup.setAttribute("width", scene.rowHeaderGroup.attribute.width + column.attribute.width),
|
|
40
|
+
scene.bodyGroup.setAttribute("width", scene.bodyGroup.attribute.width - column.attribute.width));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function moveColumnFromColHeaderToCornerHeader(scene) {
|
|
44
|
+
const headerColumn = scene.colHeaderGroup.firstChild instanceof group_1.Group ? scene.colHeaderGroup.firstChild : null;
|
|
45
|
+
headerColumn && (scene.cornerHeaderGroup.appendChild(headerColumn), scene.cornerHeaderGroup.setAttribute("width", scene.cornerHeaderGroup.attribute.width + headerColumn.attribute.width),
|
|
46
|
+
scene.colHeaderGroup.setAttribute("width", scene.colHeaderGroup.attribute.width - headerColumn.attribute.width));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function moveColumnFromRowHeaderToBody(scene) {
|
|
50
|
+
var _a;
|
|
51
|
+
const column = scene.rowHeaderGroup.lastChild instanceof group_1.Group ? scene.rowHeaderGroup.lastChild : null === (_a = scene.rowHeaderGroup.lastChild) || void 0 === _a ? void 0 : _a._prev;
|
|
52
|
+
column && (scene.bodyGroup.firstChild ? scene.bodyGroup.insertBefore(column, scene.bodyGroup.firstChild) : scene.bodyGroup.appendChild(column),
|
|
53
|
+
scene.bodyGroup.setAttribute("width", scene.bodyGroup.attribute.width + column.attribute.width),
|
|
54
|
+
scene.rowHeaderGroup.setAttribute("width", scene.rowHeaderGroup.attribute.width - column.attribute.width));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function moveColumnFromCornerHeaderToColHeader(scene) {
|
|
58
|
+
var _a;
|
|
59
|
+
const headerColumn = scene.cornerHeaderGroup.lastChild instanceof group_1.Group ? scene.cornerHeaderGroup.lastChild : null === (_a = scene.cornerHeaderGroup.lastChild) || void 0 === _a ? void 0 : _a._prev;
|
|
60
|
+
headerColumn && (scene.colHeaderGroup.firstChild ? scene.colHeaderGroup.insertBefore(headerColumn, scene.colHeaderGroup.firstChild) : scene.bodyGroup.appendChild(headerColumn),
|
|
61
|
+
scene.colHeaderGroup.setAttribute("width", scene.colHeaderGroup.attribute.width + headerColumn.attribute.width),
|
|
62
|
+
scene.cornerHeaderGroup.setAttribute("width", scene.cornerHeaderGroup.attribute.width - headerColumn.attribute.width));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
exports.dealFrozen = dealFrozen, exports.resetFrozen = resetFrozen;
|
|
66
|
+
//# sourceMappingURL=frozen.js.map
|
|
@@ -0,0 +1 @@
|
|
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E,CAAC;KACH;AACH,CAAC","file":"frozen.js","sourcesContent":["import { Group } from '../graphic/group';\nimport type { Scenegraph } from '../scenegraph';\n\nexport function dealFrozen(scene: Scenegraph) {\n if (scene.table.frozenColCount > scene.table.rowHeaderLevelCount) {\n // 将对应列移入rowHeaderGroup\n scene.rowHeaderGroup.setAttribute('height', scene.bodyGroup.attribute.height);\n scene.rowHeaderGroup.setAttribute('y', scene.bodyGroup.attribute.y);\n scene.cornerHeaderGroup.setAttribute('height', scene.colHeaderGroup.attribute.height);\n for (let i = 0; i < scene.table.frozenColCount - scene.table.rowHeaderLevelCount; i++) {\n moveColumnFromBodyToRowHeader(scene);\n moveColumnFromColHeaderToCornerHeader(scene);\n }\n } else if (scene.table.frozenColCount < scene.table.rowHeaderLevelCount) {\n // move columnGroup from rowHeaderGroup into bodyGroup(from cornerHeaderGroup into colHeaderGroup)\n for (let i = 0; i < scene.table.rowHeaderLevelCount - scene.table.frozenColCount; i++) {\n moveColumnFromRowHeaderToBody(scene);\n moveColumnFromCornerHeaderToColHeader(scene);\n }\n }\n scene.bodyGroup.setAttribute('x', scene.rowHeaderGroup.attribute.width);\n scene.colHeaderGroup.setAttribute('x', scene.cornerHeaderGroup.attribute.width);\n\n scene.updateContainer();\n scene.updateBorderSizeAndPosition();\n\n if (!scene.isPivot && !scene.transpose) {\n scene.component.setFrozenColumnShadow(scene.table.frozenColCount - 1);\n }\n scene.hasFrozen = true;\n\n // scene.frozenColCount = scene.rowHeaderGroup.childrenCount;\n scene.frozenColCount = scene.table.frozenColCount;\n scene.frozenRowCount = scene.colHeaderGroup.firstChild?.childrenCount ?? 0;\n}\n\nexport function resetFrozen(scene: Scenegraph) {\n if (scene.frozenColCount > scene.table.rowHeaderLevelCount) {\n // move columnGroup from rowHeaderGroup into bodyGroup(from cornerHeaderGroup into colHeaderGroup)\n for (let i = 0; i < scene.frozenColCount - scene.table.rowHeaderLevelCount; i++) {\n moveColumnFromRowHeaderToBody(scene);\n moveColumnFromCornerHeaderToColHeader(scene);\n }\n } else if (scene.frozenColCount < scene.table.rowHeaderLevelCount) {\n // move columnGroup from bodyGroup into rowHeaderGroup(from colHeaderGroup into cornerHeaderGroup)\n scene.rowHeaderGroup.setAttribute('height', scene.bodyGroup.attribute.height);\n scene.rowHeaderGroup.setAttribute('y', scene.bodyGroup.attribute.y);\n scene.cornerHeaderGroup.setAttribute('height', scene.colHeaderGroup.attribute.height);\n for (let i = 0; i < scene.table.rowHeaderLevelCount - scene.frozenColCount; i++) {\n moveColumnFromBodyToRowHeader(scene);\n moveColumnFromColHeaderToCornerHeader(scene);\n }\n }\n scene.bodyGroup.setAttribute('x', scene.rowHeaderGroup.attribute.width);\n scene.colHeaderGroup.setAttribute('x', scene.cornerHeaderGroup.attribute.width);\n\n scene.updateContainer();\n scene.updateBorderSizeAndPosition();\n\n if (!scene.isPivot && !scene.transpose) {\n scene.component.setFrozenColumnShadow(scene.table.frozenColCount - 1);\n }\n scene.hasFrozen = true;\n\n // scene.frozenColCount = scene.rowHeaderGroup.childrenCount;\n scene.frozenColCount = scene.table.rowHeaderLevelCount;\n scene.frozenRowCount = scene.colHeaderGroup.firstChild?.childrenCount ?? 0;\n}\n\nfunction moveColumnFromBodyToRowHeader(scene: Scenegraph) {\n // deal with bodyGroup\n const column = scene.bodyGroup.firstChild instanceof Group ? scene.bodyGroup.firstChild : null;\n if (column) {\n scene.rowHeaderGroup.appendChild(column);\n // update container width\n scene.rowHeaderGroup.setAttribute('width', scene.rowHeaderGroup.attribute.width + column.attribute.width);\n scene.bodyGroup.setAttribute('width', scene.bodyGroup.attribute.width - column.attribute.width);\n }\n}\n\nfunction moveColumnFromColHeaderToCornerHeader(scene: Scenegraph) {\n // deal width colHeaderGroup\n const headerColumn = scene.colHeaderGroup.firstChild instanceof Group ? scene.colHeaderGroup.firstChild : null;\n if (headerColumn) {\n scene.cornerHeaderGroup.appendChild(headerColumn);\n scene.cornerHeaderGroup.setAttribute(\n 'width',\n scene.cornerHeaderGroup.attribute.width + headerColumn.attribute.width\n );\n scene.colHeaderGroup.setAttribute('width', scene.colHeaderGroup.attribute.width - headerColumn.attribute.width);\n }\n}\n\nfunction moveColumnFromRowHeaderToBody(scene: Scenegraph) {\n const column =\n scene.rowHeaderGroup.lastChild instanceof Group\n ? scene.rowHeaderGroup.lastChild\n : (scene.rowHeaderGroup.lastChild?._prev as Group);\n if (column) {\n if (scene.bodyGroup.firstChild) {\n scene.bodyGroup.insertBefore(column, scene.bodyGroup.firstChild);\n } else {\n scene.bodyGroup.appendChild(column);\n }\n // 更新容器宽度\n scene.bodyGroup.setAttribute('width', scene.bodyGroup.attribute.width + column.attribute.width);\n scene.rowHeaderGroup.setAttribute('width', scene.rowHeaderGroup.attribute.width - column.attribute.width);\n }\n}\n\nfunction moveColumnFromCornerHeaderToColHeader(scene: Scenegraph) {\n // 处理列表头\n const headerColumn =\n scene.cornerHeaderGroup.lastChild instanceof Group\n ? scene.cornerHeaderGroup.lastChild\n : (scene.cornerHeaderGroup.lastChild?._prev as Group);\n if (headerColumn) {\n if (scene.colHeaderGroup.firstChild) {\n scene.colHeaderGroup.insertBefore(headerColumn, scene.colHeaderGroup.firstChild);\n } else {\n scene.bodyGroup.appendChild(headerColumn);\n }\n scene.colHeaderGroup.setAttribute('width', scene.colHeaderGroup.attribute.width + headerColumn.attribute.width);\n scene.cornerHeaderGroup.setAttribute(\n 'width',\n scene.cornerHeaderGroup.attribute.width - headerColumn.attribute.width\n );\n }\n}\n"]}
|
|
@@ -27,13 +27,17 @@ function moveHeaderPosition(colSource, rowSource, colTarget, rowTarget, table) {
|
|
|
27
27
|
sourceColEnd = table.colCount - 1, targetColStart = colTarget, targetColEnd = table.colCount - 1;
|
|
28
28
|
}
|
|
29
29
|
const updateColStart = Math.min(sourceColStart, targetColStart), updateColEnd = Math.max(sourceColEnd, targetColEnd), updateRowStart = Math.min(sourceRowStart, targetRowStart), updateRowEnd = Math.max(sourceRowEnd, targetRowEnd);
|
|
30
|
-
for (let col = updateColStart; col <= updateColEnd; col++) for (let row = updateRowStart; row <= updateRowEnd; row++) scene.updateCellContent(col, row);
|
|
31
30
|
for (let col = updateColStart; col <= updateColEnd; col++) {
|
|
32
31
|
const columnHeaderGroup = table.scenegraph.getColGroup(col, !0), columnGroup = table.scenegraph.getColGroup(col);
|
|
33
32
|
columnHeaderGroup && columnHeaderGroup.setAttribute("width", table.getColWidth(col)),
|
|
34
33
|
columnGroup && columnGroup.setAttribute("width", table.getColWidth(col));
|
|
35
34
|
}
|
|
36
35
|
scene.updateContainer();
|
|
36
|
+
for (let col = updateColStart; col <= updateColEnd; col++) {
|
|
37
|
+
const columnGroup = table.scenegraph.getColGroup(col);
|
|
38
|
+
null == columnGroup || columnGroup.setAttribute("chartInstance", void 0);
|
|
39
|
+
for (let row = updateRowStart; row <= updateRowEnd; row++) scene.updateCellContent(col, row);
|
|
40
|
+
}
|
|
37
41
|
}
|
|
38
42
|
|
|
39
43
|
function changeCell(colSource, rowSource, colTarget, rowTarget, table) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["scenegraph/layout/move-cell.ts"],"names":[],"mappings":";;;AAAA,+CAA0C;AAC1C,4DAA2D;AAG3D,MAAM,gBAAgB,GAAG,IAAI,eAAK,CAAC,EAAE,CAAC,CAAC;AAEvC,SAAgB,kBAAkB,CAChC,SAAiB,EACjB,SAAiB,EACjB,SAAiB,EACjB,SAAiB,EACjB,KAAmB;IAEnB,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC;IAG/B,MAAM,QAAQ,GAAG,KAAK,CAAC,WAAW,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IACzD,MAAM,SAAS,GAAG,QAAQ,KAAK,cAAc,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,KAAK,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IAExG,IAAI,cAAc,GAAG,CAAC,CAAC;IACvB,IAAI,cAAc,GAAG,C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;QAC5E,eAAe,CAAC,QAAQ,GAAG,eAAe,CAAC,GAAG,GAAG,cAAc,CAAC;QAChE,eAAe,CAAC,QAAQ,GAAG,eAAe,CAAC,GAAG,GAAG,cAAc,CAAC;KACjE;IACD,IAAI,OAAO,cAAc,KAAK,QAAQ,IAAI,OAAO,cAAc,KAAK,QAAQ,EAAE;QAC5E,eAAe,CAAC,QAAQ,GAAG,eAAe,CAAC,GAAG,GAAG,cAAc,CAAC;QAChE,eAAe,CAAC,QAAQ,GAAG,eAAe,CAAC,GAAG,GAAG,cAAc,CAAC;KACjE;AACH,CAAC","file":"move-cell.js","sourcesContent":["import { Group } from '@visactor/vrender';\nimport { getCellMergeInfo } from '../utils/get-cell-merge';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\n\nconst groupForPosition = new Group({});\n\nexport function moveHeaderPosition(\n colSource: number,\n rowSource: number,\n colTarget: number,\n rowTarget: number,\n table: BaseTableAPI\n) {\n const scene = table.scenegraph;\n\n // 判断方向\n const cellType = table.getCellType(colTarget, rowTarget);\n const direction = cellType === 'columnHeader' ? 'column' : cellType === 'rowHeader' ? 'row' : undefined;\n\n let sourceColStart = 0;\n let sourceRowStart = 0;\n let sourceColEnd = 0;\n let sourceRowEnd = 0;\n let targetColStart = 0;\n let targetRowStart = 0;\n let targetColEnd = 0;\n let targetRowEnd = 0;\n if (direction === 'column') {\n const sourceMergeInfo = getCellMergeInfo(table, colSource, rowSource);\n const targetMergeInfo = getCellMergeInfo(table, colTarget, rowTarget);\n if (sourceMergeInfo && targetMergeInfo) {\n sourceColStart = sourceMergeInfo.start.col;\n sourceColEnd = sourceMergeInfo.end.col;\n targetColStart = targetMergeInfo.start.col;\n targetColEnd = targetMergeInfo.end.col;\n } else {\n sourceColStart = colSource;\n sourceColEnd = colSource;\n targetColStart = colTarget;\n targetColEnd = colTarget;\n }\n sourceRowStart = rowSource;\n sourceRowEnd = table.rowCount - 1;\n targetRowStart = rowTarget;\n targetRowEnd = table.rowCount - 1;\n } else if (direction === 'row') {\n const sourceMergeInfo = getCellMergeInfo(table, colSource, rowSource);\n const targetMergeInfo = getCellMergeInfo(table, colSource, rowSource);\n if (sourceMergeInfo && targetMergeInfo) {\n sourceRowStart = sourceMergeInfo.start.row;\n sourceRowEnd = sourceMergeInfo.end.row;\n targetRowStart = targetMergeInfo.start.row;\n targetRowEnd = targetMergeInfo.end.row;\n } else {\n sourceRowStart = rowSource;\n sourceRowEnd = rowSource;\n targetRowStart = rowTarget;\n targetRowEnd = rowTarget;\n }\n sourceColStart = colSource;\n sourceColEnd = table.colCount - 1;\n targetColStart = colTarget;\n targetColEnd = table.colCount - 1;\n }\n\n const updateColStart = Math.min(sourceColStart, targetColStart);\n const updateColEnd = Math.max(sourceColEnd, targetColEnd);\n const updateRowStart = Math.min(sourceRowStart, targetRowStart);\n const updateRowEnd = Math.max(sourceRowEnd, targetRowEnd);\n\n for (let col = updateColStart; col <= updateColEnd; col++) {\n // 更新单元格记录全量属性,不更新column theme\n for (let row = updateRowStart; row <= updateRowEnd; row++) {\n scene.updateCellContent(col, row);\n }\n }\n\n // 更新columnGroup列宽\n for (let col = updateColStart; col <= updateColEnd; col++) {\n const columnHeaderGroup = table.scenegraph.getColGroup(col, true);\n const columnGroup = table.scenegraph.getColGroup(col);\n if (columnHeaderGroup) {\n columnHeaderGroup.setAttribute('width', table.getColWidth(col));\n }\n if (columnGroup) {\n columnGroup.setAttribute('width', table.getColWidth(col));\n }\n }\n\n // 更新容器尺寸\n scene.updateContainer();\n}\n\nfunction changeCell(colSource: number, rowSource: number, colTarget: number, rowTarget: number, table: BaseTableAPI) {\n // 记录基础属性\n const scene = table.scenegraph;\n const sourceCellGroup = scene.getCell(colSource, rowSource, true);\n const targetCellGroup = scene.getCell(colTarget, rowTarget, true);\n if (sourceCellGroup.role === 'empty' || targetCellGroup.role === 'empty') {\n return;\n }\n const sourceParent = sourceCellGroup.parent as Group;\n const targetParent = targetCellGroup.parent as Group;\n const { x: sourceX, y: sourceY } = sourceCellGroup.attribute;\n const { x: targetX, y: targetY } = targetCellGroup.attribute;\n\n // 判断merge属性\n let sourceDeltaCol;\n let sourceDeltaRow;\n let targetDeltaCol;\n let targetDeltaRow;\n const sourceMergeCol = sourceCellGroup.mergeCol;\n const sourceMergeRow = sourceCellGroup.mergeRow;\n const targetMergeCol = targetCellGroup.mergeCol;\n const targetMergeRow = targetCellGroup.mergeRow;\n if (typeof sourceMergeCol === 'number' && typeof sourceMergeRow === 'number') {\n sourceDeltaCol = sourceMergeCol - colSource;\n sourceDeltaRow = sourceMergeRow - rowSource;\n }\n if (typeof targetMergeCol === 'number' && typeof targetMergeRow === 'number') {\n targetDeltaCol = targetMergeCol - colTarget;\n targetDeltaRow = targetMergeRow - rowTarget;\n }\n\n // 更新位置\n targetParent.insertAfter(groupForPosition, targetCellGroup);\n sourceParent.insertAfter(targetCellGroup, sourceCellGroup);\n targetParent.insertAfter(sourceCellGroup, groupForPosition);\n targetParent.removeChild(groupForPosition);\n\n // 更新属性\n sourceCellGroup.setAttributes({\n x: targetX,\n y: targetY\n });\n sourceCellGroup.col = colTarget;\n sourceCellGroup.row = rowTarget;\n\n targetCellGroup.setAttributes({\n x: sourceX,\n y: sourceY\n });\n targetCellGroup.col = colSource;\n targetCellGroup.row = rowSource;\n if (typeof sourceDeltaCol === 'number' && typeof sourceDeltaRow === 'number') {\n sourceCellGroup.mergeCol = sourceCellGroup.col + sourceDeltaCol;\n sourceCellGroup.mergeRow = sourceCellGroup.row + sourceDeltaRow;\n }\n if (typeof targetDeltaCol === 'number' && typeof targetDeltaRow === 'number') {\n targetCellGroup.mergeCol = targetCellGroup.col + targetDeltaCol;\n targetCellGroup.mergeRow = targetCellGroup.row + targetDeltaRow;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["scenegraph/layout/move-cell.ts"],"names":[],"mappings":";;;AAAA,+CAA0C;AAC1C,4DAA2D;AAG3D,MAAM,gBAAgB,GAAG,IAAI,eAAK,CAAC,EAAE,CAAC,CAAC;AA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YAAY,CAAC,WAAW,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;IAC3D,YAAY,CAAC,WAAW,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC;IAC5D,YAAY,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;IAG3C,eAAe,CAAC,aAAa,CAAC;QAC5B,CAAC,EAAE,OAAO;QACV,CAAC,EAAE,OAAO;KACX,CAAC,CAAC;IACH,eAAe,CAAC,GAAG,GAAG,SAAS,CAAC;IAChC,eAAe,CAAC,GAAG,GAAG,SAAS,CAAC;IAEhC,eAAe,CAAC,aAAa,CAAC;QAC5B,CAAC,EAAE,OAAO;QACV,CAAC,EAAE,OAAO;KACX,CAAC,CAAC;IACH,eAAe,CAAC,GAAG,GAAG,SAAS,CAAC;IAChC,eAAe,CAAC,GAAG,GAAG,SAAS,CAAC;IAChC,IAAI,OAAO,cAAc,KAAK,QAAQ,IAAI,OAAO,cAAc,KAAK,QAAQ,EAAE;QAC5E,eAAe,CAAC,QAAQ,GAAG,eAAe,CAAC,GAAG,GAAG,cAAc,CAAC;QAChE,eAAe,CAAC,QAAQ,GAAG,eAAe,CAAC,GAAG,GAAG,cAAc,CAAC;KACjE;IACD,IAAI,OAAO,cAAc,KAAK,QAAQ,IAAI,OAAO,cAAc,KAAK,QAAQ,EAAE;QAC5E,eAAe,CAAC,QAAQ,GAAG,eAAe,CAAC,GAAG,GAAG,cAAc,CAAC;QAChE,eAAe,CAAC,QAAQ,GAAG,eAAe,CAAC,GAAG,GAAG,cAAc,CAAC;KACjE;AACH,CAAC","file":"move-cell.js","sourcesContent":["import { Group } from '@visactor/vrender';\nimport { getCellMergeInfo } from '../utils/get-cell-merge';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\n\nconst groupForPosition = new Group({});\n\nexport function moveHeaderPosition(\n colSource: number,\n rowSource: number,\n colTarget: number,\n rowTarget: number,\n table: BaseTableAPI\n) {\n const scene = table.scenegraph;\n\n // 判断方向\n const cellType = table.getCellType(colTarget, rowTarget);\n const direction = cellType === 'columnHeader' ? 'column' : cellType === 'rowHeader' ? 'row' : undefined;\n\n let sourceColStart = 0;\n let sourceRowStart = 0;\n let sourceColEnd = 0;\n let sourceRowEnd = 0;\n let targetColStart = 0;\n let targetRowStart = 0;\n let targetColEnd = 0;\n let targetRowEnd = 0;\n if (direction === 'column') {\n const sourceMergeInfo = getCellMergeInfo(table, colSource, rowSource);\n const targetMergeInfo = getCellMergeInfo(table, colTarget, rowTarget);\n if (sourceMergeInfo && targetMergeInfo) {\n sourceColStart = sourceMergeInfo.start.col;\n sourceColEnd = sourceMergeInfo.end.col;\n targetColStart = targetMergeInfo.start.col;\n targetColEnd = targetMergeInfo.end.col;\n } else {\n sourceColStart = colSource;\n sourceColEnd = colSource;\n targetColStart = colTarget;\n targetColEnd = colTarget;\n }\n sourceRowStart = rowSource;\n sourceRowEnd = table.rowCount - 1;\n targetRowStart = rowTarget;\n targetRowEnd = table.rowCount - 1;\n } else if (direction === 'row') {\n const sourceMergeInfo = getCellMergeInfo(table, colSource, rowSource);\n const targetMergeInfo = getCellMergeInfo(table, colSource, rowSource);\n if (sourceMergeInfo && targetMergeInfo) {\n sourceRowStart = sourceMergeInfo.start.row;\n sourceRowEnd = sourceMergeInfo.end.row;\n targetRowStart = targetMergeInfo.start.row;\n targetRowEnd = targetMergeInfo.end.row;\n } else {\n sourceRowStart = rowSource;\n sourceRowEnd = rowSource;\n targetRowStart = rowTarget;\n targetRowEnd = rowTarget;\n }\n sourceColStart = colSource;\n sourceColEnd = table.colCount - 1;\n targetColStart = colTarget;\n targetColEnd = table.colCount - 1;\n }\n\n const updateColStart = Math.min(sourceColStart, targetColStart);\n const updateColEnd = Math.max(sourceColEnd, targetColEnd);\n const updateRowStart = Math.min(sourceRowStart, targetRowStart);\n const updateRowEnd = Math.max(sourceRowEnd, targetRowEnd);\n\n // 更新columnGroup列宽\n for (let col = updateColStart; col <= updateColEnd; col++) {\n const columnHeaderGroup = table.scenegraph.getColGroup(col, true);\n const columnGroup = table.scenegraph.getColGroup(col);\n if (columnHeaderGroup) {\n columnHeaderGroup.setAttribute('width', table.getColWidth(col));\n }\n if (columnGroup) {\n columnGroup.setAttribute('width', table.getColWidth(col));\n }\n }\n\n // 更新容器尺寸\n scene.updateContainer();\n\n for (let col = updateColStart; col <= updateColEnd; col++) {\n // 将该列的chartInstance清除掉\n const columnGroup = table.scenegraph.getColGroup(col);\n columnGroup?.setAttribute('chartInstance', undefined);\n // 更新单元格记录全量属性,不更新column theme\n for (let row = updateRowStart; row <= updateRowEnd; row++) {\n scene.updateCellContent(col, row);\n }\n }\n}\n\nfunction changeCell(colSource: number, rowSource: number, colTarget: number, rowTarget: number, table: BaseTableAPI) {\n // 记录基础属性\n const scene = table.scenegraph;\n const sourceCellGroup = scene.getCell(colSource, rowSource, true);\n const targetCellGroup = scene.getCell(colTarget, rowTarget, true);\n if (sourceCellGroup.role === 'empty' || targetCellGroup.role === 'empty') {\n return;\n }\n const sourceParent = sourceCellGroup.parent as Group;\n const targetParent = targetCellGroup.parent as Group;\n const { x: sourceX, y: sourceY } = sourceCellGroup.attribute;\n const { x: targetX, y: targetY } = targetCellGroup.attribute;\n\n // 判断merge属性\n let sourceDeltaCol;\n let sourceDeltaRow;\n let targetDeltaCol;\n let targetDeltaRow;\n const sourceMergeCol = sourceCellGroup.mergeCol;\n const sourceMergeRow = sourceCellGroup.mergeRow;\n const targetMergeCol = targetCellGroup.mergeCol;\n const targetMergeRow = targetCellGroup.mergeRow;\n if (typeof sourceMergeCol === 'number' && typeof sourceMergeRow === 'number') {\n sourceDeltaCol = sourceMergeCol - colSource;\n sourceDeltaRow = sourceMergeRow - rowSource;\n }\n if (typeof targetMergeCol === 'number' && typeof targetMergeRow === 'number') {\n targetDeltaCol = targetMergeCol - colTarget;\n targetDeltaRow = targetMergeRow - rowTarget;\n }\n\n // 更新位置\n targetParent.insertAfter(groupForPosition, targetCellGroup);\n sourceParent.insertAfter(targetCellGroup, sourceCellGroup);\n targetParent.insertAfter(sourceCellGroup, groupForPosition);\n targetParent.removeChild(groupForPosition);\n\n // 更新属性\n sourceCellGroup.setAttributes({\n x: targetX,\n y: targetY\n });\n sourceCellGroup.col = colTarget;\n sourceCellGroup.row = rowTarget;\n\n targetCellGroup.setAttributes({\n x: sourceX,\n y: sourceY\n });\n targetCellGroup.col = colSource;\n targetCellGroup.row = rowSource;\n if (typeof sourceDeltaCol === 'number' && typeof sourceDeltaRow === 'number') {\n sourceCellGroup.mergeCol = sourceCellGroup.col + sourceDeltaCol;\n sourceCellGroup.mergeRow = sourceCellGroup.row + sourceDeltaRow;\n }\n if (typeof targetDeltaCol === 'number' && typeof targetDeltaRow === 'number') {\n targetCellGroup.mergeCol = targetCellGroup.col + targetDeltaCol;\n targetCellGroup.mergeRow = targetCellGroup.row + targetDeltaRow;\n }\n}\n"]}
|
|
@@ -20,19 +20,19 @@ function updateCellLayout(scene, cell, col, row, width, height, detaX, detaY, is
|
|
|
20
20
|
const type = scene.table.isHeader(col, row) ? scene.table._getHeaderLayoutMap(col, row).headerType : scene.table.getBodyColumnType(col, row);
|
|
21
21
|
if ("progressbar" === type) {
|
|
22
22
|
const columnDefine = scene.table.getBodyColumnDefine(col, row), style = scene.table._getCellStyle(col, row), value = scene.table.getCellValue(col, row), dataValue = scene.table.getCellOriginValue(col, row), padding = (0,
|
|
23
|
-
padding_1.
|
|
23
|
+
padding_1.getQuadProps)((0, get_prop_1.getProp)("padding", style, col, row, scene.table)), newBarCell = (0,
|
|
24
24
|
progress_bar_cell_1.createProgressBarCell)(columnDefine, style, cell.attribute.width, value, dataValue, col, row, padding, scene.table), oldBarCell = cell.getChildByName("progress-bar");
|
|
25
25
|
cell.insertBefore(newBarCell, oldBarCell), cell.removeChild(oldBarCell), oldBarCell.removeAllChild(),
|
|
26
26
|
oldBarCell.release();
|
|
27
27
|
} else if ("sparkline" === type) {
|
|
28
28
|
cell.removeAllChild();
|
|
29
|
-
const headerStyle = scene.table._getCellStyle(col, row), padding = (0, padding_1.
|
|
29
|
+
const headerStyle = scene.table._getCellStyle(col, row), padding = (0, padding_1.getQuadProps)((0,
|
|
30
30
|
get_prop_1.getProp)("padding", headerStyle, col, row, scene.table));
|
|
31
31
|
(0, spark_line_cell_1.createSparkLineCellGroup)(cell, cell.parent, cell.attribute.x, cell.attribute.y, col, row, cell.attribute.width, cell.attribute.height, padding, scene.table);
|
|
32
32
|
} else if ("image" === type || "video" === type) ; else {
|
|
33
33
|
const style = scene.table._getCellStyle(col, row);
|
|
34
34
|
(0, text_icon_layout_1.updateCellContentWidth)(cell, distWidth, detaX, autoRowHeight, (0,
|
|
35
|
-
padding_1.
|
|
35
|
+
padding_1.getQuadProps)(style.padding), style.textAlign, style.textBaseline, scene);
|
|
36
36
|
const customContainer = cellGroup.getChildByName("custom-container");
|
|
37
37
|
if (customContainer) {
|
|
38
38
|
let customRender, customLayout;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["scenegraph/layout/update-cell.ts"],"names":[],"mappings":";;;AAEA,gDAAqD;AAErD,oFAAqF;AACrF,gFAAsF;AAEtF,4DAA2D;AAC3D,gDAA4C;AAC5C,
|
|
1
|
+
{"version":3,"sources":["scenegraph/layout/update-cell.ts"],"names":[],"mappings":";;;AAEA,gDAAqD;AAErD,oFAAqF;AACrF,gFAAsF;AAEtF,4DAA2D;AAC3D,gDAA4C;AAC5C,8CAAgD;AAChD,gEAAmE;AAMnE,SAAgB,gBAAgB,CAC9B,KAAiB,EACjB,IAAW,EACX,GAAW,EACX,GAAW,EACX,KAAa,EACb,MAAc,EACd,KAAa,EACb,KAAa,EACb,QAAiB,EACjB,YAAqB,EACrB,aAAsB;IAEtB,IAAI,SAAS,CAAC;IACd,IAAI,SAAS,CAAC;IACd,MAAM,SAAS,GAAG,IAAA,iCAAgB,EAAC,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IAG1D,IAAI,SAAS,IAAI,SAAS,CAAC,GAAG,CAAC,GAAG,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AM;gBACL,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,mBAAmB,CAAC,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC;gBAC7E,YAAY,GAAG,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,YAAY,KAAI,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC;gBAChE,YAAY,GAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,YAAY,CAAC;aACrC;YACD,MAAM,YAAY,GAAG,IAAA,uBAAc,EACjC,YAAY,EACZ,YAAY,EACZ,SAAS,CAAC,GAAG,EACb,SAAS,CAAC,GAAG,EACb,SAAS,CAAC,SAAS,CAAC,KAAK,EACzB,SAAS,CAAC,SAAS,CAAC,MAAM,EAC1B,KAAK,EACL,KAAK,EACL,KAAK,CAAC,KAAK,CACZ,CAAC;YACF,SAAS,CAAC,WAAW,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;SACnD;KACF;AACH,CAAC;AA9ID,4CA8IC","file":"update-cell.js","sourcesContent":["import type { ProgressBarStyle } from '../../body-helper/style/ProgressBarStyle';\nimport type { IProgressbarColumnBodyDefine } from '../../ts-types/list-table/define/progressbar-define';\nimport { dealWithCustom } from '../component/custom';\nimport type { Group } from '../graphic/group';\nimport { createProgressBarCell } from '../group-creater/cell-type/progress-bar-cell';\nimport { createSparkLineCellGroup } from '../group-creater/cell-type/spark-line-cell';\nimport type { Scenegraph } from '../scenegraph';\nimport { getCellMergeInfo } from '../utils/get-cell-merge';\nimport { getProp } from '../utils/get-prop';\nimport { getQuadProps } from '../utils/padding';\nimport { updateCellContentWidth } from '../utils/text-icon-layout';\n\n/**\n * @description: 更新单个单元格宽度/高度\n * @return {*}\n */\nexport function updateCellLayout(\n scene: Scenegraph,\n cell: Group,\n col: number,\n row: number,\n width: number,\n height: number,\n detaX: number,\n detaY: number,\n isHeader: boolean,\n autoColWidth: boolean,\n autoRowHeight: boolean\n) {\n let cellGroup;\n let distWidth;\n const mergeInfo = getCellMergeInfo(scene.table, col, row);\n // TO BE FIXED 这里使用横向和纵向来判断单元格merge情况,目前没有横纵都merge的情况,\n // 如果有这里的逻辑要修改\n if (mergeInfo && mergeInfo.end.col - mergeInfo.start.col) {\n // 更新横向merge cell width\n const mergeCell = scene.getCell(mergeInfo.start.col, mergeInfo.start.row);\n const mergeCellWidth = mergeCell.attribute.width;\n mergeCell.setAttribute('width', mergeCellWidth + detaX);\n\n cellGroup = mergeCell;\n distWidth = mergeCell.attribute.width;\n } else if (mergeInfo && mergeInfo.start.row === row) {\n // 更新纵向merge cell width,只更新一次\n cell.setAttribute('width', width + detaX);\n\n cellGroup = cell;\n distWidth = width + detaX;\n } else if (!mergeInfo) {\n cell.setAttribute('width', width + detaX);\n cellGroup = cell;\n distWidth = width + detaX;\n }\n\n if (!cellGroup) {\n // 合并单元格非主单元格,不处理\n return;\n }\n\n // 更新单元格布局\n\n const type = scene.table.isHeader(col, row)\n ? scene.table._getHeaderLayoutMap(col, row).headerType\n : scene.table.getBodyColumnType(col, row);\n if (type === 'progressbar') {\n // 目前先采用重新生成节点的方案\n const columnDefine = scene.table.getBodyColumnDefine(col, row) as IProgressbarColumnBodyDefine;\n const style = scene.table._getCellStyle(col, row) as ProgressBarStyle;\n const value = scene.table.getCellValue(col, row);\n const dataValue = scene.table.getCellOriginValue(col, row);\n const padding = getQuadProps(getProp('padding', style, col, row, scene.table));\n\n const newBarCell = createProgressBarCell(\n columnDefine,\n style,\n cell.attribute.width,\n // cell.attribute.height,\n value,\n dataValue,\n col,\n row,\n padding,\n scene.table\n );\n\n const oldBarCell = cell.getChildByName('progress-bar') as Group;\n // cell.replaceChild(newBarCell, oldBarCell);\n cell.insertBefore(newBarCell, oldBarCell);\n cell.removeChild(oldBarCell);\n oldBarCell.removeAllChild();\n oldBarCell.release();\n } else if (type === 'sparkline') {\n // 目前先采用重新生成节点的方案\n cell.removeAllChild();\n const headerStyle = scene.table._getCellStyle(col, row);\n const padding = getQuadProps(getProp('padding', headerStyle, col, row, scene.table));\n createSparkLineCellGroup(\n cell,\n cell.parent,\n cell.attribute.x,\n cell.attribute.y,\n col,\n row,\n cell.attribute.width,\n cell.attribute.height,\n padding,\n scene.table\n );\n } else if (type === 'image' || type === 'video') {\n // // 只更新背景边框\n // const rect = cell.firstChild as Rect;\n // rect.setAttribute('width', cell.attribute.width);\n } else {\n // 处理文字\n const style = scene.table._getCellStyle(col, row);\n updateCellContentWidth(\n cell,\n distWidth,\n detaX,\n autoRowHeight,\n getQuadProps(style.padding as number),\n style.textAlign,\n style.textBaseline,\n scene\n );\n\n // 处理自定义渲染\n const customContainer = cellGroup.getChildByName('custom-container') as Group;\n if (customContainer) {\n customContainer.clear();\n cellGroup.removeChild(customContainer);\n\n let customRender;\n let customLayout;\n const cellType = scene.table.getCellType(cellGroup.col, cellGroup.row);\n if (cellType !== 'body') {\n const define = scene.table.getHeaderDefine(cellGroup.col, cellGroup.row);\n customRender = define?.headerCustomRender;\n customLayout = define?.headerCustomLayout;\n } else {\n const define = scene.table.getBodyColumnDefine(cellGroup.col, cellGroup.row);\n customRender = define?.customRender || scene.table.customRender;\n customLayout = define?.customLayout;\n }\n const customResult = dealWithCustom(\n customLayout,\n customRender,\n cellGroup.col,\n cellGroup.row,\n cellGroup.attribute.width,\n cellGroup.attribute.height,\n false,\n false,\n scene.table\n );\n cellGroup.appendChild(customResult.elementsGroup);\n }\n }\n}\n"]}
|
|
@@ -54,19 +54,19 @@ function updateCellHeight(scene, cell, col, row, distHeight, detaY, isHeader) {
|
|
|
54
54
|
const type = scene.table.isHeader(col, row) ? scene.table._getHeaderLayoutMap(col, row).headerType : scene.table.getBodyColumnType(col, row);
|
|
55
55
|
if ("progressbar" === type) {
|
|
56
56
|
const columnDefine = scene.table.getBodyColumnDefine(col, row), style = scene.table._getCellStyle(col, row), value = scene.table.getCellValue(col, row), dataValue = scene.table.getCellOriginValue(col, row), padding = (0,
|
|
57
|
-
padding_1.
|
|
57
|
+
padding_1.getQuadProps)((0, get_prop_1.getProp)("padding", style, col, row, scene.table)), newBarCell = (0,
|
|
58
58
|
progress_bar_cell_1.createProgressBarCell)(columnDefine, style, cell.attribute.width, value, dataValue, col, row, padding, scene.table), oldBarCell = cell.getChildByName("progress-bar");
|
|
59
59
|
cell.insertBefore(newBarCell, oldBarCell), cell.removeChild(oldBarCell), oldBarCell.removeAllChild(),
|
|
60
60
|
oldBarCell.release();
|
|
61
61
|
} else if ("sparkline" === type) {
|
|
62
62
|
cell.removeAllChild();
|
|
63
|
-
const headerStyle = scene.table._getCellStyle(col, row), padding = (0, padding_1.
|
|
63
|
+
const headerStyle = scene.table._getCellStyle(col, row), padding = (0, padding_1.getQuadProps)((0,
|
|
64
64
|
get_prop_1.getProp)("padding", headerStyle, col, row, scene.table));
|
|
65
65
|
(0, spark_line_cell_1.createSparkLineCellGroup)(cell, cell.parent, cell.attribute.x, cell.attribute.y, col, row, cell.attribute.width, cell.attribute.height, padding, scene.table);
|
|
66
66
|
} else if ("image" === type || "video" === type) (0, image_cell_1.updateImageCellContentWhileResize)(cell, col, row, scene.table); else {
|
|
67
67
|
const style = scene.table._getCellStyle(col, row);
|
|
68
68
|
(0, text_icon_layout_1.updateCellContentHeight)(cell, distHeight, detaY, scene.table.internalProps.autoRowHeight, (0,
|
|
69
|
-
padding_1.
|
|
69
|
+
padding_1.getQuadProps)(style.padding), style.textAlign, style.textBaseline);
|
|
70
70
|
const customContainer = cell.getChildByName("custom-container");
|
|
71
71
|
if (customContainer) {
|
|
72
72
|
let customRender, customLayout;
|
|
@@ -80,7 +80,7 @@ function updateCellHeight(scene, cell, col, row, distHeight, detaY, isHeader) {
|
|
|
80
80
|
customLayout = null == define ? void 0 : define.customLayout;
|
|
81
81
|
}
|
|
82
82
|
const customResult = (0, custom_1.dealWithCustom)(customLayout, customRender, col, row, cell.attribute.width, cell.attribute.height, !1, !1, scene.table);
|
|
83
|
-
cell.appendChild(customResult.elementsGroup);
|
|
83
|
+
cell.childrenCount > 0 ? cell.insertBefore(customResult.elementsGroup, cell.firstChild) : cell.appendChild(customResult.elementsGroup);
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["scenegraph/layout/update-height.ts"],"names":[],"mappings":";;;AAEA,oFAAqF;AACrF,gFAAsF;AAEtF,4DAA2D;AAC3D,gDAA4C;AAC5C,8CAA8C;AAC9C,gEAAoE;AAEpE,gDAAqD;AACrD,sEAA0F;AAE1F,SAAgB,eAAe,CAAC,KAAiB,EAAE,GAAW,EAAE,KAAa;IAC3E,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,EAAE;QACnD,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QACrC,MAAM,SAAS,GAAG,IAAA,iCAAgB,EAAC,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;QAC1D,IAAI,SAAS,IAAI,SAAS,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,EAAE;YAC5C,SAAS;SACV;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;QAGrC,sBAAsB,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;QAE7F,KAAK,CAAC,4BAA4B,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;KAC9C;IAED,IAAI,QAAQ,GAAG,CAAC,CAAC;IACjB,IAAI,MAAM,GAAG,CAAC,CAAC;IAEf,IAAI,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,sBAAsB,EAAE;QAC5C,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,QAAQ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IAAI,CAAC,SAAS,CAAC,KAAK,EACpB,IAAI,CAAC,SAAS,CAAC,MAAM,EACrB,KAAK,EACL,KAAK,EACL,KAAK,CAAC,KAAK,CACZ,CAAC;YACF,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;SAC9C;KACF;AACH,CAAC;AAxGD,4CAwGC","file":"update-height.js","sourcesContent":["import type { ProgressBarStyle } from '../../body-helper/style/ProgressBarStyle';\nimport type { Group } from '../graphic/group';\nimport { createProgressBarCell } from '../group-creater/cell-type/progress-bar-cell';\nimport { createSparkLineCellGroup } from '../group-creater/cell-type/spark-line-cell';\nimport type { Scenegraph } from '../scenegraph';\nimport { getCellMergeInfo } from '../utils/get-cell-merge';\nimport { getProp } from '../utils/get-prop';\nimport { getPadding } from '../utils/padding';\nimport { updateCellContentHeight } from '../utils/text-icon-layout';\nimport type { IProgressbarColumnBodyDefine } from '../../ts-types/list-table/define/progressbar-define';\nimport { dealWithCustom } from '../component/custom';\nimport { updateImageCellContentWhileResize } from '../group-creater/cell-type/image-cell';\n\nexport function updateRowHeight(scene: Scenegraph, row: number, detaY: number) {\n for (let col = 0; col < scene.table.colCount; col++) {\n const cell = scene.getCell(col, row);\n const mergeInfo = getCellMergeInfo(scene.table, col, row);\n if (mergeInfo && mergeInfo.start.col !== col) {\n continue;\n }\n const height = cell.attribute.height;\n // cell.setAttribute('height', height);\n // (cell.firstChild as Rect).setAttribute('height', cell.attribute.height);\n updateCellHeightForRow(scene, cell, col, row, height, detaY, scene.table.isHeader(col, row));\n\n scene.updateCellContentWhileResize(col, row);\n }\n\n let rowStart = 0;\n let rowEnd = 0;\n // 更新header 高度\n if (row < scene.table.columnHeaderLevelCount) {\n scene.colHeaderGroup.setAttribute('height', scene.colHeaderGroup.attribute.height + detaY);\n scene.rowHeaderGroup.setAttribute('y', scene.colHeaderGroup.attribute.y + detaY);\n scene.bodyGroup.setAttribute('y', scene.bodyGroup.attribute.y + detaY);\n\n rowStart = row + 1;\n rowEnd = scene.table.columnHeaderLevelCount - 1;\n } else {\n rowStart = row + 1;\n // rowEnd = scene.table.rowCount - 1;\n rowEnd = scene.bodyRowEnd;\n }\n\n // 更新以下行位置\n for (let rowIndex = rowStart; rowIndex <= rowEnd; rowIndex++) {\n // if (rowIndex === 2) debugger;\n for (let colIndex = 0; colIndex < scene.table.colCount; colIndex++) {\n const cellGroup = scene.getCell(colIndex, rowIndex);\n const mergeInfo = getCellMergeInfo(scene.table, colIndex, rowIndex);\n if (mergeInfo && (mergeInfo.start.col !== colIndex || mergeInfo.start.row !== rowIndex)) {\n continue;\n }\n\n cellGroup.setAttribute('y', cellGroup.attribute.y + detaY);\n }\n }\n\n // 更新table行高存储\n scene.table.setRowHeight(row, scene.table.getRowHeight(row) + detaY, true);\n}\n\n/**\n * @description: 更新单个单元格高度\n * @return {*}\n */\nexport function updateCellHeightForRow(\n scene: Scenegraph,\n cell: Group,\n col: number,\n row: number,\n height: number,\n detaY: number,\n isHeader: boolean\n // autoRowHeight: boolean\n) {\n let cellGroup;\n let distHeight;\n const mergeInfo = getCellMergeInfo(scene.table, col, row);\n // TO BE FIXED 这里使用横向和纵向来判断单元格merge情况,目前没有横纵都merge的情况,\n // 如果有这里的逻辑要修改\n if (mergeInfo && mergeInfo.end.col - mergeInfo.start.col && mergeInfo.start.col === col) {\n // 更新横向merge cell height,只更新一次\n const mergeCell = scene.getCell(mergeInfo.start.col, mergeInfo.start.row);\n const mergeCellheight = mergeCell.attribute.height;\n mergeCell.setAttribute('height', mergeCellheight + detaY);\n\n cellGroup = mergeCell;\n distHeight = mergeCell.attribute.height;\n } else if (mergeInfo) {\n // 更新纵向merge cell width\n cell.setAttribute('height', height + detaY);\n\n cellGroup = cell;\n distHeight = height + detaY;\n } else if (!mergeInfo) {\n cell.setAttribute('height', height + detaY);\n cellGroup = cell;\n distHeight = height + detaY;\n // cell.setTheme({\n // rect: {\n // height: cell.attribute.height,\n // },\n // });\n }\n\n if (!cellGroup) {\n // 合并单元格非主单元格,不处理\n return;\n }\n\n updateCellHeight(scene, cellGroup, col, row, distHeight, detaY, isHeader);\n}\n\nexport function updateCellHeightForColumn(\n scene: Scenegraph,\n cell: Group,\n col: number,\n row: number,\n height: number,\n detaY: number,\n isHeader: boolean\n) {\n let cellGroup;\n // let distHeight;\n const mergeInfo = getCellMergeInfo(scene.table, col, row);\n if (mergeInfo && mergeInfo.end.row - mergeInfo.start.row) {\n cell = scene.getCell(mergeInfo.start.col, mergeInfo.start.row);\n if (row === mergeInfo.start.row) {\n // 初始化高度\n (cell as any)._tempHeight = height;\n return;\n } else if (row === mergeInfo.end.row) {\n cell.setAttribute('height', (cell as any)._tempHeight + height);\n cellGroup = cell;\n height = cell.attribute.height;\n // updateCellHeight(scene, cellGroup, col, row, cell.attribute.height, 0, isHeader);\n } else {\n // 累加高度\n (cell as any)._tempHeight += height;\n return;\n }\n } else if (mergeInfo) {\n cell = scene.getCell(mergeInfo.start.col, mergeInfo.start.row);\n cell.setAttribute('height', height);\n cellGroup = cell;\n\n // const rect = cell.firstChild as Rect;\n // rect.setAttribute('height', cell.attribute.height);\n } else {\n cell.setAttribute('height', height);\n cellGroup = cell;\n }\n updateCellHeight(scene, cellGroup, col, row, height, 0, isHeader);\n}\n\nexport function updateCellHeight(\n scene: Scenegraph,\n cell: Group,\n col: number,\n row: number,\n distHeight: number,\n detaY: number,\n isHeader: boolean\n) {\n // 更新单元格布局\n const type = scene.table.isHeader(col, row)\n ? scene.table._getHeaderLayoutMap(col, row).headerType\n : scene.table.getBodyColumnType(col, row);\n if (type === 'progressbar') {\n // 目前先采用重新生成节点的方案\n const columnDefine = scene.table.getBodyColumnDefine(col, row) as IProgressbarColumnBodyDefine;\n const style = scene.table._getCellStyle(col, row) as ProgressBarStyle;\n const value = scene.table.getCellValue(col, row);\n const dataValue = scene.table.getCellOriginValue(col, row);\n const padding = getPadding(getProp('padding', style, col, row, scene.table));\n\n const newBarCell = createProgressBarCell(\n columnDefine,\n style,\n cell.attribute.width,\n // cell.attribute.height,\n value,\n dataValue,\n col,\n row,\n padding,\n scene.table\n );\n\n const oldBarCell = cell.getChildByName('progress-bar') as Group;\n // cell.replaceChild(newBarCell, oldBarCell);\n cell.insertBefore(newBarCell, oldBarCell);\n cell.removeChild(oldBarCell);\n oldBarCell.removeAllChild();\n oldBarCell.release();\n } else if (type === 'sparkline') {\n // 目前先采用重新生成节点的方案\n cell.removeAllChild();\n const headerStyle = scene.table._getCellStyle(col, row);\n const padding = getPadding(getProp('padding', headerStyle, col, row, scene.table));\n createSparkLineCellGroup(\n cell,\n cell.parent,\n cell.attribute.x,\n cell.attribute.y,\n col,\n row,\n cell.attribute.width,\n cell.attribute.height,\n padding,\n scene.table\n );\n } else if (type === 'image' || type === 'video') {\n updateImageCellContentWhileResize(cell, col, row, scene.table);\n } else {\n // 处理文字\n const style = scene.table._getCellStyle(col, row);\n updateCellContentHeight(\n cell,\n distHeight,\n detaY,\n scene.table.internalProps.autoRowHeight,\n getPadding(style.padding as number),\n style.textAlign,\n style.textBaseline\n );\n\n // 处理自定义渲染\n const customContainer = cell.getChildByName('custom-container') as Group;\n if (customContainer) {\n customContainer.clear();\n cell.removeChild(customContainer);\n\n let customRender;\n let customLayout;\n const cellType = scene.table.getCellType(col, row);\n if (cellType !== 'body') {\n const define = scene.table.getHeaderDefine(col, row);\n customRender = define?.headerCustomRender;\n customLayout = define?.headerCustomLayout;\n } else {\n const define = scene.table.getBodyColumnDefine(col, row);\n customRender = define?.customRender || scene.table.customRender;\n customLayout = define?.customLayout;\n }\n const customResult = dealWithCustom(\n customLayout,\n customRender,\n col,\n row,\n cell.attribute.width,\n cell.attribute.height,\n false,\n false,\n scene.table\n );\n cell.appendChild(customResult.elementsGroup);\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["scenegraph/layout/update-height.ts"],"names":[],"mappings":";;;AAEA,oFAAqF;AACrF,gFAAsF;AAEtF,4DAA2D;AAC3D,gDAA4C;AAC5C,8CAAgD;AAChD,gEAAoE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CAAC,WAAW,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;aAC9C;SACF;KACF;AACH,CAAC;AA5GD,4CA4GC","file":"update-height.js","sourcesContent":["import type { ProgressBarStyle } from '../../body-helper/style/ProgressBarStyle';\nimport type { Group } from '../graphic/group';\nimport { createProgressBarCell } from '../group-creater/cell-type/progress-bar-cell';\nimport { createSparkLineCellGroup } from '../group-creater/cell-type/spark-line-cell';\nimport type { Scenegraph } from '../scenegraph';\nimport { getCellMergeInfo } from '../utils/get-cell-merge';\nimport { getProp } from '../utils/get-prop';\nimport { getQuadProps } from '../utils/padding';\nimport { updateCellContentHeight } from '../utils/text-icon-layout';\nimport type { IProgressbarColumnBodyDefine } from '../../ts-types/list-table/define/progressbar-define';\nimport { dealWithCustom } from '../component/custom';\nimport { updateImageCellContentWhileResize } from '../group-creater/cell-type/image-cell';\n\nexport function updateRowHeight(scene: Scenegraph, row: number, detaY: number) {\n for (let col = 0; col < scene.table.colCount; col++) {\n const cell = scene.getCell(col, row);\n const mergeInfo = getCellMergeInfo(scene.table, col, row);\n if (mergeInfo && mergeInfo.start.col !== col) {\n continue;\n }\n const height = cell.attribute.height;\n // cell.setAttribute('height', height);\n // (cell.firstChild as Rect).setAttribute('height', cell.attribute.height);\n updateCellHeightForRow(scene, cell, col, row, height, detaY, scene.table.isHeader(col, row));\n\n scene.updateCellContentWhileResize(col, row);\n }\n\n let rowStart = 0;\n let rowEnd = 0;\n // 更新header 高度\n if (row < scene.table.columnHeaderLevelCount) {\n scene.colHeaderGroup.setAttribute('height', scene.colHeaderGroup.attribute.height + detaY);\n scene.rowHeaderGroup.setAttribute('y', scene.colHeaderGroup.attribute.y + detaY);\n scene.bodyGroup.setAttribute('y', scene.bodyGroup.attribute.y + detaY);\n\n rowStart = row + 1;\n rowEnd = scene.table.columnHeaderLevelCount - 1;\n } else {\n rowStart = row + 1;\n // rowEnd = scene.table.rowCount - 1;\n rowEnd = scene.bodyRowEnd;\n }\n\n // 更新以下行位置\n for (let rowIndex = rowStart; rowIndex <= rowEnd; rowIndex++) {\n // if (rowIndex === 2) debugger;\n for (let colIndex = 0; colIndex < scene.table.colCount; colIndex++) {\n const cellGroup = scene.getCell(colIndex, rowIndex);\n const mergeInfo = getCellMergeInfo(scene.table, colIndex, rowIndex);\n if (mergeInfo && (mergeInfo.start.col !== colIndex || mergeInfo.start.row !== rowIndex)) {\n continue;\n }\n\n cellGroup.setAttribute('y', cellGroup.attribute.y + detaY);\n }\n }\n\n // 更新table行高存储\n scene.table.setRowHeight(row, scene.table.getRowHeight(row) + detaY, true);\n}\n\n/**\n * @description: 更新单个单元格高度\n * @return {*}\n */\nexport function updateCellHeightForRow(\n scene: Scenegraph,\n cell: Group,\n col: number,\n row: number,\n height: number,\n detaY: number,\n isHeader: boolean\n // autoRowHeight: boolean\n) {\n let cellGroup;\n let distHeight;\n const mergeInfo = getCellMergeInfo(scene.table, col, row);\n // TO BE FIXED 这里使用横向和纵向来判断单元格merge情况,目前没有横纵都merge的情况,\n // 如果有这里的逻辑要修改\n if (mergeInfo && mergeInfo.end.col - mergeInfo.start.col && mergeInfo.start.col === col) {\n // 更新横向merge cell height,只更新一次\n const mergeCell = scene.getCell(mergeInfo.start.col, mergeInfo.start.row);\n const mergeCellheight = mergeCell.attribute.height;\n mergeCell.setAttribute('height', mergeCellheight + detaY);\n\n cellGroup = mergeCell;\n distHeight = mergeCell.attribute.height;\n } else if (mergeInfo) {\n // 更新纵向merge cell width\n cell.setAttribute('height', height + detaY);\n\n cellGroup = cell;\n distHeight = height + detaY;\n } else if (!mergeInfo) {\n cell.setAttribute('height', height + detaY);\n cellGroup = cell;\n distHeight = height + detaY;\n // cell.setTheme({\n // rect: {\n // height: cell.attribute.height,\n // },\n // });\n }\n\n if (!cellGroup) {\n // 合并单元格非主单元格,不处理\n return;\n }\n\n updateCellHeight(scene, cellGroup, col, row, distHeight, detaY, isHeader);\n}\n\nexport function updateCellHeightForColumn(\n scene: Scenegraph,\n cell: Group,\n col: number,\n row: number,\n height: number,\n detaY: number,\n isHeader: boolean\n) {\n let cellGroup;\n // let distHeight;\n const mergeInfo = getCellMergeInfo(scene.table, col, row);\n if (mergeInfo && mergeInfo.end.row - mergeInfo.start.row) {\n cell = scene.getCell(mergeInfo.start.col, mergeInfo.start.row);\n if (row === mergeInfo.start.row) {\n // 初始化高度\n (cell as any)._tempHeight = height;\n return;\n } else if (row === mergeInfo.end.row) {\n cell.setAttribute('height', (cell as any)._tempHeight + height);\n cellGroup = cell;\n height = cell.attribute.height;\n // updateCellHeight(scene, cellGroup, col, row, cell.attribute.height, 0, isHeader);\n } else {\n // 累加高度\n (cell as any)._tempHeight += height;\n return;\n }\n } else if (mergeInfo) {\n cell = scene.getCell(mergeInfo.start.col, mergeInfo.start.row);\n cell.setAttribute('height', height);\n cellGroup = cell;\n\n // const rect = cell.firstChild as Rect;\n // rect.setAttribute('height', cell.attribute.height);\n } else {\n cell.setAttribute('height', height);\n cellGroup = cell;\n }\n updateCellHeight(scene, cellGroup, col, row, height, 0, isHeader);\n}\n\nexport function updateCellHeight(\n scene: Scenegraph,\n cell: Group,\n col: number,\n row: number,\n distHeight: number,\n detaY: number,\n isHeader: boolean\n) {\n // 更新单元格布局\n const type = scene.table.isHeader(col, row)\n ? scene.table._getHeaderLayoutMap(col, row).headerType\n : scene.table.getBodyColumnType(col, row);\n if (type === 'progressbar') {\n // 目前先采用重新生成节点的方案\n const columnDefine = scene.table.getBodyColumnDefine(col, row) as IProgressbarColumnBodyDefine;\n const style = scene.table._getCellStyle(col, row) as ProgressBarStyle;\n const value = scene.table.getCellValue(col, row);\n const dataValue = scene.table.getCellOriginValue(col, row);\n const padding = getQuadProps(getProp('padding', style, col, row, scene.table));\n\n const newBarCell = createProgressBarCell(\n columnDefine,\n style,\n cell.attribute.width,\n // cell.attribute.height,\n value,\n dataValue,\n col,\n row,\n padding,\n scene.table\n );\n\n const oldBarCell = cell.getChildByName('progress-bar') as Group;\n // cell.replaceChild(newBarCell, oldBarCell);\n cell.insertBefore(newBarCell, oldBarCell);\n cell.removeChild(oldBarCell);\n oldBarCell.removeAllChild();\n oldBarCell.release();\n } else if (type === 'sparkline') {\n // 目前先采用重新生成节点的方案\n cell.removeAllChild();\n const headerStyle = scene.table._getCellStyle(col, row);\n const padding = getQuadProps(getProp('padding', headerStyle, col, row, scene.table));\n createSparkLineCellGroup(\n cell,\n cell.parent,\n cell.attribute.x,\n cell.attribute.y,\n col,\n row,\n cell.attribute.width,\n cell.attribute.height,\n padding,\n scene.table\n );\n } else if (type === 'image' || type === 'video') {\n updateImageCellContentWhileResize(cell, col, row, scene.table);\n } else {\n // 处理文字\n const style = scene.table._getCellStyle(col, row);\n updateCellContentHeight(\n cell,\n distHeight,\n detaY,\n scene.table.internalProps.autoRowHeight,\n getQuadProps(style.padding as number),\n style.textAlign,\n style.textBaseline\n );\n\n // 处理自定义渲染\n const customContainer = cell.getChildByName('custom-container') as Group;\n if (customContainer) {\n customContainer.clear();\n cell.removeChild(customContainer);\n\n let customRender;\n let customLayout;\n const cellType = scene.table.getCellType(col, row);\n if (cellType !== 'body') {\n const define = scene.table.getHeaderDefine(col, row);\n customRender = define?.headerCustomRender;\n customLayout = define?.headerCustomLayout;\n } else {\n const define = scene.table.getBodyColumnDefine(col, row);\n customRender = define?.customRender || scene.table.customRender;\n customLayout = define?.customLayout;\n }\n const customResult = dealWithCustom(\n customLayout,\n customRender,\n col,\n row,\n cell.attribute.width,\n cell.attribute.height,\n false,\n false,\n scene.table\n );\n if (cell.childrenCount > 0) {\n cell.insertBefore(customResult.elementsGroup, cell.firstChild);\n } else {\n cell.appendChild(customResult.elementsGroup);\n }\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.updateRow = void 0;
|
|
6
|
+
|
|
7
|
+
const cell_helper_1 = require("../group-creater/cell-helper");
|
|
8
|
+
|
|
9
|
+
function updateRow(removeCells, addCells, table) {
|
|
10
|
+
const scene = table.scenegraph, removeRows = deduplication(removeCells.map((cell => cell.row))).sort(((a, b) => a - b)), addRows = deduplication(addCells.map((cell => cell.row))).sort(((a, b) => a - b));
|
|
11
|
+
removeRows.forEach((row => {
|
|
12
|
+
removeRow(row, scene);
|
|
13
|
+
})), removeRows.length && resetRowNumber(scene), addRows.forEach((row => {
|
|
14
|
+
addRow(row, scene);
|
|
15
|
+
})), resetRowNumberAndY(scene);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function removeRow(row, scene) {
|
|
19
|
+
for (let col = 0; col < scene.table.colCount; col++) {
|
|
20
|
+
const colGroup = scene.getColGroup(col, !1);
|
|
21
|
+
let cellGroup;
|
|
22
|
+
colGroup.forEachChildren((cell => cell.row === row && (cellGroup = cell, !0))),
|
|
23
|
+
cellGroup && colGroup.removeChild(cellGroup);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function addRow(row, scene) {
|
|
28
|
+
var _a;
|
|
29
|
+
for (let col = 0; col < scene.table.colCount; col++) {
|
|
30
|
+
const cellGroup = (0, cell_helper_1.updateCell)(col, row, scene.table, !0);
|
|
31
|
+
if (!cellGroup) continue;
|
|
32
|
+
const colGroup = scene.getColGroup(col);
|
|
33
|
+
if (colGroup.firstChild && row < colGroup.firstChild.row) colGroup.insertBefore(cellGroup, colGroup.firstChild); else if (colGroup.lastChild && row > colGroup.lastChild.row) colGroup.appendChild(cellGroup); else {
|
|
34
|
+
let cellBefore;
|
|
35
|
+
colGroup.forEachChildren((cellGroup => cellGroup.row === row && (cellBefore = cellGroup,
|
|
36
|
+
!0))), cellBefore !== cellGroup && colGroup.insertBefore(cellGroup, cellBefore);
|
|
37
|
+
}
|
|
38
|
+
let rowIndex = null === (_a = colGroup.firstChild) || void 0 === _a ? void 0 : _a.row;
|
|
39
|
+
colGroup.forEachChildren((cellGroup => {
|
|
40
|
+
cellGroup.row = rowIndex, rowIndex++;
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function deduplication(array) {
|
|
46
|
+
const result = [];
|
|
47
|
+
for (let i = 0; i < array.length; i++) -1 === result.indexOf(array[i]) && result.push(array[i]);
|
|
48
|
+
return result;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function resetRowNumber(scene) {
|
|
52
|
+
var _a, _b;
|
|
53
|
+
for (let col = 0; col < scene.table.colCount; col++) {
|
|
54
|
+
const headerColGroup = scene.getColGroup(col, !0), colGroup = scene.getColGroup(col, !1);
|
|
55
|
+
let rowIndex = null === (_a = headerColGroup.firstChild) || void 0 === _a ? void 0 : _a.row;
|
|
56
|
+
headerColGroup.forEachChildren((cellGroup => {
|
|
57
|
+
cellGroup.row = rowIndex, rowIndex++;
|
|
58
|
+
})), rowIndex = null === (_b = colGroup.firstChild) || void 0 === _b ? void 0 : _b.row,
|
|
59
|
+
colGroup.forEachChildren((cellGroup => {
|
|
60
|
+
cellGroup.row = rowIndex, rowIndex++;
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function resetRowNumberAndY(scene) {
|
|
66
|
+
var _a, _b;
|
|
67
|
+
let newTotalHeight = 0;
|
|
68
|
+
for (let col = 0; col < scene.table.colCount; col++) {
|
|
69
|
+
const headerColGroup = scene.getColGroup(col, !0), colGroup = scene.getColGroup(col, !1);
|
|
70
|
+
let rowIndex = null === (_a = headerColGroup.firstChild) || void 0 === _a ? void 0 : _a.row, y = 0;
|
|
71
|
+
rowIndex = null === (_b = colGroup.firstChild) || void 0 === _b ? void 0 : _b.row,
|
|
72
|
+
y = 0, colGroup.forEachChildren((cellGroup => {
|
|
73
|
+
cellGroup.row = rowIndex, rowIndex++, "cell" === cellGroup.role && (cellGroup.setAttribute("y", y),
|
|
74
|
+
y += cellGroup.attribute.height);
|
|
75
|
+
})), newTotalHeight = y;
|
|
76
|
+
}
|
|
77
|
+
scene.updateContainerHeight(scene.table.frozenRowCount, newTotalHeight - scene.bodyGroup.attribute.height);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
exports.updateRow = updateRow;
|
|
81
|
+
//# sourceMappingURL=update-row.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["scenegraph/layout/update-row.ts"],"names":[],"mappings":";;;AAGA,8DAA0D;AAM1D,SAAgB,SAAS,CAAC,WAA0B,EAAE,QAAuB,EAAE,KAAmB;IAChG,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC;IAE/B,MAAM,UAAU,GAAG,aAAa,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1F,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAGpF,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QACvB,SAAS,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACxB,CAAC,CAAC,CAAC;IAEH,IAAI,UAAU,CAAC,MAAM,EAAE;QACrB,cAAc,CAAC,KAAK,CAAC,CAAC;KACvB;IAGD,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QACpB,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACrB,CAAC,CAAC,CAAC;IAGH,kBAAkB,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC;AAtBD,8BAsBC;AAED,SAAS,SAAS,CAAC,GAAW,EAAE,KAAiB;IAC/C,KAAK,IAAI,GAAG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IAAI,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC;QAClC,CAAC,CAAC,CAAC;QACH,cAAc,GAAG,CAAC,CAAC;KACpB;IAGD,KAAK,CAAC,qBAAqB,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,EAAE,cAAc,GAAG,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;AAC7G,CAAC","file":"update-row.js","sourcesContent":["import type { CellAddress } from '../../ts-types';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport type { Group } from '../graphic/group';\nimport { updateCell } from '../group-creater/cell-helper';\nimport type { Scenegraph } from '../scenegraph';\n\n/**\n * add and remove rows in scenegraph\n */\nexport function updateRow(removeCells: CellAddress[], addCells: CellAddress[], table: BaseTableAPI) {\n const scene = table.scenegraph;\n // deduplication\n const removeRows = deduplication(removeCells.map(cell => cell.row)).sort((a, b) => a - b);\n const addRows = deduplication(addCells.map(cell => cell.row)).sort((a, b) => a - b);\n\n // remove cells\n removeRows.forEach(row => {\n removeRow(row, scene);\n });\n\n if (removeRows.length) {\n resetRowNumber(scene);\n }\n\n // add cells\n addRows.forEach(row => {\n addRow(row, scene);\n });\n\n // reset attribute y and row number in CellGroup\n resetRowNumberAndY(scene);\n}\n\nfunction removeRow(row: number, scene: Scenegraph) {\n for (let col = 0; col < scene.table.colCount; col++) {\n // const headerColGroup = scene.getColGroup(col, true);\n const colGroup = scene.getColGroup(col, false);\n\n // // remove cellGroup in headerColGroup\n // let headerCellGroup;\n // headerColGroup.forEachChildren((cellGroup: Group) => {\n // if (cellGroup.row === row) {\n // headerCellGroup = cellGroup;\n // return true;\n // }\n // return false;\n // });\n // if (headerCellGroup) {\n // headerColGroup.removeChild(headerCellGroup);\n // }\n\n // remove cellGroup in colGroup\n let cellGroup;\n colGroup.forEachChildren((cell: Group) => {\n if (cell.row === row) {\n cellGroup = cell;\n return true;\n }\n return false;\n });\n if (cellGroup) {\n colGroup.removeChild(cellGroup);\n }\n }\n}\n\nfunction addRow(row: number, scene: Scenegraph) {\n for (let col = 0; col < scene.table.colCount; col++) {\n // create cellGroup\n const cellGroup = updateCell(col, row, scene.table, true);\n\n if (!cellGroup) {\n // TODO: deal with data promise situation\n continue;\n }\n\n // insert cellGroup in colGroup\n const colGroup = scene.getColGroup(col);\n if (colGroup.firstChild && row < (colGroup.firstChild as Group).row) {\n colGroup.insertBefore(cellGroup, colGroup.firstChild);\n } else if (colGroup.lastChild && row > (colGroup.lastChild as Group).row) {\n colGroup.appendChild(cellGroup);\n } else {\n let cellBefore;\n colGroup.forEachChildren((cellGroup: Group) => {\n if (cellGroup.row === row) {\n cellBefore = cellGroup;\n return true;\n }\n return false;\n });\n if (cellBefore !== cellGroup) {\n colGroup.insertBefore(cellGroup, cellBefore);\n }\n }\n\n // reset row number\n let rowIndex = (colGroup.firstChild as Group)?.row;\n colGroup.forEachChildren((cellGroup: Group) => {\n cellGroup.row = rowIndex;\n rowIndex++;\n });\n }\n}\n\n// array deduplication\nfunction deduplication(array: number[]) {\n const result = [];\n for (let i = 0; i < array.length; i++) {\n if (result.indexOf(array[i]) === -1) {\n result.push(array[i]);\n }\n }\n return result;\n}\n\nfunction resetRowNumber(scene: Scenegraph) {\n for (let col = 0; col < scene.table.colCount; col++) {\n const headerColGroup = scene.getColGroup(col, true);\n const colGroup = scene.getColGroup(col, false);\n // reset row number\n let rowIndex = (headerColGroup.firstChild as Group)?.row;\n headerColGroup.forEachChildren((cellGroup: Group) => {\n cellGroup.row = rowIndex;\n rowIndex++;\n });\n rowIndex = (colGroup.firstChild as Group)?.row;\n colGroup.forEachChildren((cellGroup: Group) => {\n cellGroup.row = rowIndex;\n rowIndex++;\n });\n }\n}\n\nfunction resetRowNumberAndY(scene: Scenegraph) {\n let newTotalHeight = 0;\n for (let col = 0; col < scene.table.colCount; col++) {\n const headerColGroup = scene.getColGroup(col, true);\n const colGroup = scene.getColGroup(col, false);\n // reset row number\n let rowIndex = (headerColGroup.firstChild as Group)?.row;\n let y = 0;\n // headerColGroup.forEachChildren((cellGroup: Group) => {\n // cellGroup.row = rowIndex;\n // rowIndex++;\n // if (cellGroup.role !== 'cell') {\n // return;\n // }\n // cellGroup.setAttribute('y', y);\n // y+= cellGroup.attribute.height;\n // });\n rowIndex = (colGroup.firstChild as Group)?.row;\n y = 0;\n colGroup.forEachChildren((cellGroup: Group) => {\n cellGroup.row = rowIndex;\n rowIndex++;\n if (cellGroup.role !== 'cell') {\n return;\n }\n cellGroup.setAttribute('y', y);\n y += cellGroup.attribute.height;\n });\n newTotalHeight = y;\n }\n\n // update table size\n scene.updateContainerHeight(scene.table.frozenRowCount, newTotalHeight - scene.bodyGroup.attribute.height);\n}\n"]}
|
|
@@ -9,7 +9,7 @@ const image_cell_1 = require("../group-creater/cell-type/image-cell"), progress_
|
|
|
9
9
|
function updateColWidth(scene, col, detaX) {
|
|
10
10
|
const {autoRowHeight: autoRowHeight} = scene.table.internalProps;
|
|
11
11
|
let needRerangeRow = !1;
|
|
12
|
-
const colOrCornerHeaderColumn = scene.getColGroup(col, !0), oldColOrCornerHeaderColumnWidth = colOrCornerHeaderColumn.attribute.width;
|
|
12
|
+
const colOrCornerHeaderColumn = scene.getColGroup(col, !0), oldColOrCornerHeaderColumnWidth = null == colOrCornerHeaderColumn ? void 0 : colOrCornerHeaderColumn.attribute.width;
|
|
13
13
|
if (null == colOrCornerHeaderColumn || colOrCornerHeaderColumn.setAttribute("width", oldColOrCornerHeaderColumnWidth + detaX),
|
|
14
14
|
null == colOrCornerHeaderColumn || colOrCornerHeaderColumn.forEachChildren(((cell, index) => {
|
|
15
15
|
if (updateCellWidth(scene, cell, col, cell.row, oldColOrCornerHeaderColumnWidth, detaX, index < scene.table.columnHeaderLevelCount, autoRowHeight)) {
|
|
@@ -74,19 +74,19 @@ function updateCellWidth(scene, cell, col, row, width, detaX, isHeader, autoRowH
|
|
|
74
74
|
let isHeightChange = !1;
|
|
75
75
|
if ("progressbar" === type) {
|
|
76
76
|
const columnDefine = scene.table.getBodyColumnDefine(col, row), style = scene.table._getCellStyle(col, row), value = scene.table.getCellValue(col, row), dataValue = scene.table.getCellOriginValue(col, row), padding = (0,
|
|
77
|
-
padding_1.
|
|
77
|
+
padding_1.getQuadProps)((0, get_prop_1.getProp)("padding", style, col, row, scene.table)), newBarCell = (0,
|
|
78
78
|
progress_bar_cell_1.createProgressBarCell)(columnDefine, style, cellGroup.attribute.width, value, dataValue, col, row, padding, scene.table), oldBarCell = cellGroup.getChildByName("progress-bar");
|
|
79
79
|
cellGroup.insertBefore(newBarCell, oldBarCell), cellGroup.removeChild(oldBarCell),
|
|
80
80
|
oldBarCell.removeAllChild(), oldBarCell.release();
|
|
81
81
|
} else if ("sparkline" === type) {
|
|
82
82
|
cellGroup.removeAllChild();
|
|
83
|
-
const headerStyle = scene.table._getCellStyle(col, row), padding = (0, padding_1.
|
|
83
|
+
const headerStyle = scene.table._getCellStyle(col, row), padding = (0, padding_1.getQuadProps)((0,
|
|
84
84
|
get_prop_1.getProp)("padding", headerStyle, col, row, scene.table));
|
|
85
85
|
(0, spark_line_cell_1.createSparkLineCellGroup)(cellGroup, cellGroup.parent, cellGroup.attribute.x, cellGroup.attribute.y, col, row, cellGroup.attribute.width, cellGroup.attribute.height, padding, scene.table);
|
|
86
86
|
} else if ("image" === type || "video" === type) (0, image_cell_1.updateImageCellContentWhileResize)(cellGroup, col, row, scene.table); else {
|
|
87
87
|
const style = scene.table._getCellStyle(col, row);
|
|
88
88
|
isHeightChange = (0, text_icon_layout_1.updateCellContentWidth)(cellGroup, distWidth, detaX, autoRowHeight, (0,
|
|
89
|
-
padding_1.
|
|
89
|
+
padding_1.getQuadProps)(style.padding), style.textAlign, style.textBaseline, scene);
|
|
90
90
|
}
|
|
91
91
|
return isHeightChange;
|
|
92
92
|
}
|
|
@@ -113,7 +113,7 @@ function getCleanCellHeight(cell, scene) {
|
|
|
113
113
|
cell.forEachChildren((child => {
|
|
114
114
|
"icon-left" !== child.role && "icon-right" !== child.role && "text" !== child.name && "content" !== child.name || (maxHeight = Math.max(maxHeight, child.AABBBounds.height()));
|
|
115
115
|
}));
|
|
116
|
-
const padding = (0, padding_1.
|
|
116
|
+
const padding = (0, padding_1.getQuadProps)(scene.table._getCellStyle(cell.col, cell.row).padding);
|
|
117
117
|
return maxHeight + padding[0] + padding[2];
|
|
118
118
|
}
|
|
119
119
|
|