@visactor/vtable 0.9.1 → 0.9.2-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/ListTable.d.ts +2 -1
- package/cjs/ListTable.js +17 -13
- package/cjs/ListTable.js.map +1 -1
- package/cjs/PivotChart.d.ts +68 -0
- package/cjs/PivotChart.js +427 -0
- package/cjs/PivotChart.js.map +1 -0
- package/cjs/PivotTable.d.ts +2 -1
- package/cjs/PivotTable.js +18 -13
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/body-helper/style/MultilineTextStyle.js +2 -2
- package/cjs/body-helper/style/MultilineTextStyle.js.map +1 -1
- package/cjs/body-helper/style/ProgressBarStyle.js +15 -15
- package/cjs/body-helper/style/ProgressBarStyle.js.map +1 -1
- package/cjs/body-helper/style/Style.d.ts +0 -1
- package/cjs/body-helper/style/Style.js +25 -28
- package/cjs/body-helper/style/Style.js.map +1 -1
- package/cjs/components/axis/axis.d.ts +45 -0
- package/cjs/components/axis/axis.js +146 -0
- package/cjs/components/axis/axis.js.map +1 -0
- package/cjs/components/axis/band-scale.d.ts +18 -0
- package/cjs/components/axis/band-scale.js +54 -0
- package/cjs/components/axis/band-scale.js.map +1 -0
- package/cjs/components/axis/get-axis-attributes.d.ts +136 -0
- package/cjs/components/axis/get-axis-attributes.js +169 -0
- package/cjs/components/axis/get-axis-attributes.js.map +1 -0
- package/cjs/components/axis/label-overlap.d.ts +3 -0
- package/cjs/components/axis/label-overlap.js +46 -0
- package/cjs/components/axis/label-overlap.js.map +1 -0
- package/cjs/components/axis/linear-scale.d.ts +45 -0
- package/cjs/components/axis/linear-scale.js +120 -0
- package/cjs/components/axis/linear-scale.js.map +1 -0
- package/cjs/components/legend/get-legend-attributes.d.ts +5 -0
- package/cjs/components/legend/get-legend-attributes.js +90 -0
- package/cjs/components/legend/get-legend-attributes.js.map +1 -0
- package/cjs/components/legend/legend.d.ts +23 -0
- package/cjs/components/legend/legend.js +94 -0
- package/cjs/components/legend/legend.js.map +1 -0
- package/cjs/{menu → components/menu}/dom/BaseMenu.d.ts +2 -2
- package/cjs/components/menu/dom/BaseMenu.js.map +1 -0
- package/cjs/components/menu/dom/Menu.js.map +1 -0
- package/{es → cjs/components}/menu/dom/MenuHandler.d.ts +2 -2
- package/cjs/{menu → components/menu}/dom/MenuHandler.js +1 -1
- package/cjs/components/menu/dom/MenuHandler.js.map +1 -0
- package/cjs/{menu → components/menu}/dom/logic/MenuContainer.d.ts +2 -2
- package/cjs/{menu → components/menu}/dom/logic/MenuContainer.js +2 -2
- package/cjs/components/menu/dom/logic/MenuContainer.js.map +1 -0
- package/cjs/{menu → components/menu}/dom/logic/MenuElement.d.ts +2 -2
- package/cjs/{menu → components/menu}/dom/logic/MenuElement.js +4 -4
- package/cjs/components/menu/dom/logic/MenuElement.js.map +1 -0
- package/cjs/components/menu/dom/logic/MenuElementStyle.js.map +1 -0
- package/cjs/components/title/title.d.ts +12 -0
- package/cjs/components/title/title.js +66 -0
- package/cjs/components/title/title.js.map +1 -0
- package/cjs/{tooltip → components/tooltip}/BaseTooltip.d.ts +3 -3
- package/cjs/components/tooltip/BaseTooltip.js.map +1 -0
- package/cjs/components/tooltip/Tooltip.js.map +1 -0
- package/{es → cjs/components}/tooltip/TooltipHandler.d.ts +4 -4
- package/cjs/{tooltip → components/tooltip}/TooltipHandler.js +1 -1
- package/cjs/components/tooltip/TooltipHandler.js.map +1 -0
- package/cjs/{tooltip → components/tooltip}/logic/BubbleTooltipElement.d.ts +4 -4
- package/cjs/{tooltip → components/tooltip}/logic/BubbleTooltipElement.js +1 -1
- package/cjs/components/tooltip/logic/BubbleTooltipElement.js.map +1 -0
- package/cjs/components/tooltip/logic/BubbleTooltipElementStyle.js.map +1 -0
- package/cjs/components/util/orient.d.ts +3 -0
- package/cjs/components/util/orient.js +14 -0
- package/cjs/components/util/orient.js.map +1 -0
- package/cjs/components/util/register.d.ts +3 -0
- package/cjs/components/util/register.js +15 -0
- package/cjs/components/util/register.js.map +1 -0
- package/cjs/components/util/tick-data/config.d.ts +1 -0
- package/cjs/components/util/tick-data/config.js +6 -0
- package/cjs/components/util/tick-data/config.js.map +1 -0
- package/cjs/components/util/tick-data/continuous.d.ts +2 -0
- package/cjs/components/util/tick-data/continuous.js +39 -0
- package/cjs/components/util/tick-data/continuous.js.map +1 -0
- package/cjs/components/util/tick-data/discrete/linear.d.ts +2 -0
- package/cjs/components/util/tick-data/discrete/linear.js +66 -0
- package/cjs/components/util/tick-data/discrete/linear.js.map +1 -0
- package/cjs/components/util/tick-data/discrete/polar-angle.d.ts +2 -0
- package/cjs/components/util/tick-data/discrete/polar-angle.js +46 -0
- package/cjs/components/util/tick-data/discrete/polar-angle.js.map +1 -0
- package/cjs/components/util/tick-data/index.d.ts +2 -0
- package/cjs/components/util/tick-data/index.js +17 -0
- package/cjs/components/util/tick-data/index.js.map +1 -0
- package/cjs/components/util/tick-data/util.d.ts +21 -0
- package/cjs/components/util/tick-data/util.js +115 -0
- package/cjs/components/util/tick-data/util.js.map +1 -0
- package/cjs/components/util/transform.d.ts +5 -0
- package/cjs/components/util/transform.js +45 -0
- package/cjs/components/util/transform.js.map +1 -0
- package/cjs/core/BaseTable.d.ts +19 -6
- package/cjs/core/BaseTable.js +103 -44
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/TABLE_EVENT_TYPE.d.ts +3 -0
- package/cjs/core/TABLE_EVENT_TYPE.js +4 -1
- package/cjs/core/TABLE_EVENT_TYPE.js.map +1 -1
- package/cjs/core/style.js +1 -1
- package/cjs/core/style.js.map +1 -1
- package/cjs/core/tableHelper.js +1 -2
- package/cjs/data/CachedDataSource.js +2 -1
- package/cjs/data/DataSource.js +2 -2
- package/cjs/data/DataSource.js.map +1 -1
- package/cjs/dataset/dataset.d.ts +12 -19
- package/cjs/dataset/dataset.js +168 -196
- package/cjs/dataset/dataset.js.map +1 -1
- package/cjs/dataset/statistics-helper.d.ts +68 -0
- package/cjs/dataset/statistics-helper.js +173 -0
- package/cjs/dataset/statistics-helper.js.map +1 -0
- package/cjs/dataset/util/zero-align.d.ts +10 -0
- package/cjs/dataset/util/zero-align.js +119 -0
- package/cjs/dataset/util/zero-align.js.map +1 -0
- package/cjs/event/EventHandler.js.map +1 -1
- package/cjs/event/EventTarget.d.ts +5 -5
- package/cjs/event/EventTarget.js +2 -2
- package/cjs/event/EventTarget.js.map +1 -1
- package/cjs/event/VChartEventProxy.d.ts +1 -0
- package/cjs/event/VChartEventProxy.js +1 -0
- package/cjs/event/VChartEventProxy.js.map +1 -0
- package/cjs/event/event.js +8 -5
- package/cjs/event/event.js.map +1 -1
- package/cjs/event/listener/table-group.js +8 -6
- package/cjs/event/listener/table-group.js.map +1 -1
- package/cjs/event/pivot-chart/axis-click.d.ts +2 -0
- package/cjs/event/pivot-chart/axis-click.js +42 -0
- package/cjs/event/pivot-chart/axis-click.js.map +1 -0
- package/cjs/event/sparkline-event.js.map +1 -1
- package/cjs/event/util.js +0 -1
- package/cjs/header-helper/header-helper.js +1 -1
- package/cjs/header-helper/header-helper.js.map +1 -1
- package/cjs/header-helper/style/MultilineTextHeaderStyle.js +2 -2
- package/cjs/header-helper/style/MultilineTextHeaderStyle.js.map +1 -1
- package/cjs/header-helper/style/Style.d.ts +0 -1
- package/cjs/header-helper/style/Style.js +25 -28
- package/cjs/header-helper/style/Style.js.map +1 -1
- package/cjs/index.d.ts +4 -3
- package/cjs/index.js +11 -2
- package/cjs/index.js.map +1 -1
- package/cjs/layout/index.js +2 -1
- package/cjs/layout/pivot-chart/get-axis-config.d.ts +2 -0
- package/cjs/layout/pivot-chart/get-axis-config.js +118 -0
- package/cjs/layout/pivot-chart/get-axis-config.js.map +1 -0
- package/cjs/layout/pivot-chart/get-chart-spec.d.ts +4 -0
- package/cjs/layout/pivot-chart/get-chart-spec.js +118 -0
- package/cjs/layout/pivot-chart/get-chart-spec.js.map +1 -0
- package/cjs/layout/pivot-header-layout.d.ts +13 -5
- package/cjs/layout/pivot-header-layout.js +68 -12
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/layout/pivot-layout.d.ts +55 -8
- package/cjs/layout/pivot-layout.js +419 -89
- package/cjs/layout/pivot-layout.js.map +1 -1
- package/cjs/layout/simple-header-layout.d.ts +10 -0
- package/cjs/layout/simple-header-layout.js +40 -0
- package/cjs/layout/simple-header-layout.js.map +1 -1
- package/cjs/render/layout/container.js +13 -0
- package/cjs/render/layout/container.js.map +1 -1
- package/cjs/scenegraph/component/table-component.js +3 -3
- package/cjs/scenegraph/component/table-component.js.map +1 -1
- package/cjs/scenegraph/graphic/chart.d.ts +3 -0
- package/cjs/scenegraph/graphic/chart.js +21 -6
- package/cjs/scenegraph/graphic/chart.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/chart-render.js +15 -3
- package/cjs/scenegraph/graphic/contributions/chart-render.js.map +1 -1
- package/cjs/scenegraph/graphic/text.js +5 -5
- package/cjs/scenegraph/graphic/text.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.d.ts +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.js +21 -12
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/chart-cell.d.ts +2 -1
- package/cjs/scenegraph/group-creater/cell-type/chart-cell.js +6 -5
- package/cjs/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/image-cell.d.ts +1 -1
- package/cjs/scenegraph/group-creater/cell-type/image-cell.js +1 -2
- package/cjs/scenegraph/group-creater/cell-type/image-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/spark-line-cell.d.ts +2 -1
- package/cjs/scenegraph/group-creater/cell-type/spark-line-cell.js +2 -3
- package/cjs/scenegraph/group-creater/cell-type/spark-line-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/text-cell.d.ts +1 -2
- package/cjs/scenegraph/group-creater/cell-type/text-cell.js +6 -18
- package/cjs/scenegraph/group-creater/cell-type/text-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/video-cell.d.ts +1 -1
- package/cjs/scenegraph/group-creater/cell-type/video-cell.js +1 -2
- package/cjs/scenegraph/group-creater/cell-type/video-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/column-helper.js +9 -30
- package/cjs/scenegraph/group-creater/column-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/column.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.d.ts +3 -0
- package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js +71 -0
- package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -0
- package/cjs/scenegraph/group-creater/progress/proxy.d.ts +31 -12
- package/cjs/scenegraph/group-creater/progress/proxy.js +117 -128
- package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.d.ts +2 -0
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.js +112 -0
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.js.map +1 -0
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.d.ts +2 -0
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +109 -0
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js.map +1 -0
- package/cjs/scenegraph/group-creater/progress/update-position/update-auto-row.d.ts +2 -0
- package/cjs/scenegraph/group-creater/progress/update-position/update-auto-row.js +24 -0
- package/cjs/scenegraph/group-creater/progress/update-position/update-auto-row.js.map +1 -0
- package/cjs/scenegraph/layout/compute-col-width.d.ts +9 -1
- package/cjs/scenegraph/layout/compute-col-width.js +33 -23
- package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
- package/cjs/scenegraph/layout/compute-row-height.d.ts +3 -0
- package/cjs/scenegraph/layout/compute-row-height.js +173 -0
- package/cjs/scenegraph/layout/compute-row-height.js.map +1 -0
- package/cjs/scenegraph/layout/move-cell.js +1 -1
- package/cjs/scenegraph/layout/move-cell.js.map +1 -1
- package/cjs/scenegraph/layout/update-cell.js +3 -2
- package/cjs/scenegraph/layout/update-cell.js.map +1 -1
- package/cjs/scenegraph/layout/update-height.js +4 -3
- package/cjs/scenegraph/layout/update-height.js.map +1 -1
- package/cjs/scenegraph/layout/update-row.js +1 -1
- package/cjs/scenegraph/layout/update-row.js.map +1 -1
- package/cjs/scenegraph/layout/update-width.js +4 -3
- package/cjs/scenegraph/layout/update-width.js.map +1 -1
- package/cjs/scenegraph/refresh-node/update-chart.d.ts +3 -0
- package/cjs/scenegraph/refresh-node/update-chart.js +48 -5
- package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -1
- package/cjs/scenegraph/scenegraph.d.ts +13 -5
- package/cjs/scenegraph/scenegraph.js +163 -56
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/scenegraph/stick-text/index.d.ts +1 -0
- package/cjs/scenegraph/stick-text/index.js +23 -7
- package/cjs/scenegraph/stick-text/index.js.map +1 -1
- package/cjs/scenegraph/style/frame-border.js +1 -5
- package/cjs/scenegraph/style/frame-border.js.map +1 -1
- package/cjs/scenegraph/utils/text-icon-layout.d.ts +2 -1
- package/cjs/scenegraph/utils/text-icon-layout.js +6 -5
- package/cjs/scenegraph/utils/text-icon-layout.js.map +1 -1
- package/cjs/state/hover/col.js +4 -4
- package/cjs/state/hover/col.js.map +1 -1
- package/cjs/state/state.js +1 -1
- package/cjs/state/state.js.map +1 -1
- package/cjs/themes/DEFAULT.js +1 -2
- package/cjs/tools/LimitPromiseQueue.js +2 -1
- package/cjs/tools/NumberMap.d.ts +1 -0
- package/cjs/tools/NumberMap.js +3 -0
- package/cjs/tools/NumberMap.js.map +1 -1
- package/cjs/tools/calc.d.ts +3 -0
- package/cjs/tools/calc.js +11 -3
- package/cjs/tools/calc.js.map +1 -1
- package/cjs/tools/diff-cell.js +2 -2
- package/cjs/tools/dom.js +1 -1
- package/cjs/tools/env.js +1 -1
- package/cjs/ts-types/base-table.d.ts +41 -12
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/column/style.d.ts +0 -1
- package/cjs/ts-types/column/style.js.map +1 -1
- package/cjs/ts-types/component/axis.d.ts +12 -0
- package/cjs/ts-types/component/axis.js +6 -0
- package/cjs/ts-types/component/axis.js.map +1 -0
- package/cjs/ts-types/component/legend.d.ts +5 -0
- package/cjs/ts-types/component/legend.js +6 -0
- package/cjs/ts-types/component/legend.js.map +1 -0
- package/cjs/ts-types/component/title.d.ts +47 -0
- package/cjs/ts-types/component/title.js +6 -0
- package/cjs/ts-types/component/title.js.map +1 -0
- package/cjs/ts-types/component/util.d.ts +1 -0
- package/cjs/ts-types/component/util.js +6 -0
- package/cjs/ts-types/component/util.js.map +1 -0
- package/cjs/ts-types/events.d.ts +100 -83
- package/cjs/ts-types/events.js.map +1 -1
- package/cjs/ts-types/list-table/layout-map/api.d.ts +4 -0
- package/cjs/ts-types/list-table/layout-map/api.js.map +1 -1
- package/cjs/ts-types/new-data-set.d.ts +18 -5
- package/cjs/ts-types/new-data-set.js +2 -2
- package/cjs/ts-types/new-data-set.js.map +1 -1
- package/cjs/ts-types/pivot-table/PIVOT_TABLE_EVENT_TYPE.d.ts +4 -0
- package/cjs/ts-types/pivot-table/PIVOT_TABLE_EVENT_TYPE.js +3 -1
- package/cjs/ts-types/pivot-table/PIVOT_TABLE_EVENT_TYPE.js.map +1 -1
- package/cjs/ts-types/pivot-table/corner.d.ts +3 -3
- package/cjs/ts-types/pivot-table/corner.js.map +1 -1
- package/cjs/ts-types/pivot-table/indicator/index.d.ts +1 -0
- package/cjs/ts-types/pivot-table/indicator/index.js.map +1 -1
- package/cjs/ts-types/pivot-table/title.d.ts +1 -1
- package/cjs/ts-types/pivot-table/title.js.map +1 -1
- package/cjs/ts-types/table-engine.d.ts +27 -3
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/dist/vtable.js +29113 -17684
- package/dist/vtable.min.js +4 -2
- package/es/ListTable.d.ts +2 -1
- package/es/ListTable.js +17 -13
- package/es/ListTable.js.map +1 -1
- package/es/PivotChart.d.ts +68 -0
- package/es/PivotChart.js +437 -0
- package/es/PivotChart.js.map +1 -0
- package/es/PivotTable.d.ts +2 -1
- package/es/PivotTable.js +19 -14
- package/es/PivotTable.js.map +1 -1
- package/es/body-helper/style/MultilineTextStyle.js +2 -2
- package/es/body-helper/style/MultilineTextStyle.js.map +1 -1
- package/es/body-helper/style/ProgressBarStyle.js +15 -15
- package/es/body-helper/style/ProgressBarStyle.js.map +1 -1
- package/es/body-helper/style/Style.d.ts +0 -1
- package/es/body-helper/style/Style.js +25 -28
- package/es/body-helper/style/Style.js.map +1 -1
- package/es/components/axis/axis.d.ts +45 -0
- package/es/components/axis/axis.js +155 -0
- package/es/components/axis/axis.js.map +1 -0
- package/es/components/axis/band-scale.d.ts +18 -0
- package/es/components/axis/band-scale.js +46 -0
- package/es/components/axis/band-scale.js.map +1 -0
- package/es/components/axis/get-axis-attributes.d.ts +136 -0
- package/es/components/axis/get-axis-attributes.js +166 -0
- package/es/components/axis/get-axis-attributes.js.map +1 -0
- package/es/components/axis/label-overlap.d.ts +3 -0
- package/es/components/axis/label-overlap.js +39 -0
- package/es/components/axis/label-overlap.js.map +1 -0
- package/es/components/axis/linear-scale.d.ts +45 -0
- package/es/components/axis/linear-scale.js +104 -0
- package/es/components/axis/linear-scale.js.map +1 -0
- package/es/components/legend/get-legend-attributes.d.ts +5 -0
- package/es/components/legend/get-legend-attributes.js +84 -0
- package/es/components/legend/get-legend-attributes.js.map +1 -0
- package/es/components/legend/legend.d.ts +23 -0
- package/es/components/legend/legend.js +93 -0
- package/es/components/legend/legend.js.map +1 -0
- package/es/{menu → components/menu}/dom/BaseMenu.d.ts +2 -2
- package/es/components/menu/dom/BaseMenu.js.map +1 -0
- package/es/components/menu/dom/Menu.js.map +1 -0
- package/{cjs → es/components}/menu/dom/MenuHandler.d.ts +2 -2
- package/es/{menu → components/menu}/dom/MenuHandler.js +2 -2
- package/es/components/menu/dom/MenuHandler.js.map +1 -0
- package/es/{menu → components/menu}/dom/logic/MenuContainer.d.ts +2 -2
- package/es/{menu → components/menu}/dom/logic/MenuContainer.js +4 -4
- package/es/components/menu/dom/logic/MenuContainer.js.map +1 -0
- package/es/{menu → components/menu}/dom/logic/MenuElement.d.ts +2 -2
- package/es/{menu → components/menu}/dom/logic/MenuElement.js +9 -9
- package/es/components/menu/dom/logic/MenuElement.js.map +1 -0
- package/es/components/menu/dom/logic/MenuElementStyle.js.map +1 -0
- package/es/components/title/title.d.ts +12 -0
- package/es/components/title/title.js +61 -0
- package/es/components/title/title.js.map +1 -0
- package/es/{tooltip → components/tooltip}/BaseTooltip.d.ts +3 -3
- package/es/components/tooltip/BaseTooltip.js.map +1 -0
- package/es/components/tooltip/Tooltip.js.map +1 -0
- package/{cjs → es/components}/tooltip/TooltipHandler.d.ts +4 -4
- package/es/{tooltip → components/tooltip}/TooltipHandler.js +4 -4
- package/es/components/tooltip/TooltipHandler.js.map +1 -0
- package/es/{tooltip → components/tooltip}/logic/BubbleTooltipElement.d.ts +4 -4
- package/es/{tooltip → components/tooltip}/logic/BubbleTooltipElement.js +4 -4
- package/es/components/tooltip/logic/BubbleTooltipElement.js.map +1 -0
- package/es/components/tooltip/logic/BubbleTooltipElementStyle.js.map +1 -0
- package/es/components/util/orient.d.ts +3 -0
- package/es/components/util/orient.js +8 -0
- package/es/components/util/orient.js.map +1 -0
- package/es/components/util/register.d.ts +3 -0
- package/es/components/util/register.js +8 -0
- package/es/components/util/register.js.map +1 -0
- package/es/components/util/tick-data/config.d.ts +1 -0
- package/es/components/util/tick-data/config.js +2 -0
- package/es/components/util/tick-data/config.js.map +1 -0
- package/es/components/util/tick-data/continuous.d.ts +2 -0
- package/es/components/util/tick-data/continuous.js +38 -0
- package/es/components/util/tick-data/continuous.js.map +1 -0
- package/es/components/util/tick-data/discrete/linear.d.ts +2 -0
- package/es/components/util/tick-data/discrete/linear.js +59 -0
- package/es/components/util/tick-data/discrete/linear.js.map +1 -0
- package/es/components/util/tick-data/discrete/polar-angle.d.ts +2 -0
- package/es/components/util/tick-data/discrete/polar-angle.js +39 -0
- package/es/components/util/tick-data/discrete/polar-angle.js.map +1 -0
- package/es/components/util/tick-data/index.d.ts +2 -0
- package/es/components/util/tick-data/index.js +19 -0
- package/es/components/util/tick-data/index.js.map +1 -0
- package/es/components/util/tick-data/util.d.ts +21 -0
- package/es/components/util/tick-data/util.js +104 -0
- package/es/components/util/tick-data/util.js.map +1 -0
- package/es/components/util/transform.d.ts +5 -0
- package/es/components/util/transform.js +34 -0
- package/es/components/util/transform.js.map +1 -0
- package/es/core/BaseTable.d.ts +19 -6
- package/es/core/BaseTable.js +107 -46
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/TABLE_EVENT_TYPE.d.ts +3 -0
- package/es/core/TABLE_EVENT_TYPE.js +4 -1
- package/es/core/TABLE_EVENT_TYPE.js.map +1 -1
- package/es/core/style.js +1 -1
- package/es/core/style.js.map +1 -1
- package/es/core/tableHelper.js +1 -2
- package/es/data/CachedDataSource.js +2 -1
- package/es/data/DataSource.js +2 -2
- package/es/data/DataSource.js.map +1 -1
- package/es/dataset/dataset.d.ts +12 -19
- package/es/dataset/dataset.js +161 -187
- package/es/dataset/dataset.js.map +1 -1
- package/es/dataset/statistics-helper.d.ts +68 -0
- package/es/dataset/statistics-helper.js +152 -0
- package/es/dataset/statistics-helper.js.map +1 -0
- package/es/dataset/util/zero-align.d.ts +10 -0
- package/es/dataset/util/zero-align.js +111 -0
- package/es/dataset/util/zero-align.js.map +1 -0
- package/es/event/EventHandler.js.map +1 -1
- package/es/event/EventTarget.d.ts +5 -5
- package/es/event/EventTarget.js +2 -2
- package/es/event/EventTarget.js.map +1 -1
- package/es/event/VChartEventProxy.d.ts +1 -0
- package/es/event/VChartEventProxy.js +1 -0
- package/es/event/VChartEventProxy.js.map +1 -0
- package/es/event/event.js +10 -5
- package/es/event/event.js.map +1 -1
- package/es/event/listener/table-group.js +8 -6
- package/es/event/listener/table-group.js.map +1 -1
- package/es/event/pivot-chart/axis-click.d.ts +2 -0
- package/es/event/pivot-chart/axis-click.js +36 -0
- package/es/event/pivot-chart/axis-click.js.map +1 -0
- package/es/event/sparkline-event.js.map +1 -1
- package/es/event/util.js +1 -2
- package/es/header-helper/header-helper.js +1 -1
- package/es/header-helper/header-helper.js.map +1 -1
- package/es/header-helper/style/MultilineTextHeaderStyle.js +2 -2
- package/es/header-helper/style/MultilineTextHeaderStyle.js.map +1 -1
- package/es/header-helper/style/Style.d.ts +0 -1
- package/es/header-helper/style/Style.js +25 -28
- package/es/header-helper/style/Style.js.map +1 -1
- package/es/index.d.ts +4 -3
- package/es/index.js +4 -2
- package/es/index.js.map +1 -1
- package/es/layout/index.js +2 -1
- package/es/layout/pivot-chart/get-axis-config.d.ts +2 -0
- package/es/layout/pivot-chart/get-axis-config.js +110 -0
- package/es/layout/pivot-chart/get-axis-config.js.map +1 -0
- package/es/layout/pivot-chart/get-chart-spec.d.ts +4 -0
- package/es/layout/pivot-chart/get-chart-spec.js +109 -0
- package/es/layout/pivot-chart/get-chart-spec.js.map +1 -0
- package/es/layout/pivot-header-layout.d.ts +13 -5
- package/es/layout/pivot-header-layout.js +67 -11
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/layout/pivot-layout.d.ts +55 -8
- package/es/layout/pivot-layout.js +422 -87
- package/es/layout/pivot-layout.js.map +1 -1
- package/es/layout/simple-header-layout.d.ts +10 -0
- package/es/layout/simple-header-layout.js +40 -0
- package/es/layout/simple-header-layout.js.map +1 -1
- package/es/render/layout/container.js +13 -0
- package/es/render/layout/container.js.map +1 -1
- package/es/scenegraph/component/table-component.js +3 -3
- package/es/scenegraph/component/table-component.js.map +1 -1
- package/es/scenegraph/graphic/chart.d.ts +3 -0
- package/es/scenegraph/graphic/chart.js +22 -5
- package/es/scenegraph/graphic/chart.js.map +1 -1
- package/es/scenegraph/graphic/contributions/chart-render.js +15 -3
- package/es/scenegraph/graphic/contributions/chart-render.js.map +1 -1
- package/es/scenegraph/graphic/text.js +5 -5
- package/es/scenegraph/graphic/text.js.map +1 -1
- package/es/scenegraph/group-creater/cell-helper.d.ts +1 -1
- package/es/scenegraph/group-creater/cell-helper.js +22 -10
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/chart-cell.d.ts +2 -1
- package/es/scenegraph/group-creater/cell-type/chart-cell.js +5 -6
- package/es/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/image-cell.d.ts +1 -1
- package/es/scenegraph/group-creater/cell-type/image-cell.js +0 -3
- package/es/scenegraph/group-creater/cell-type/image-cell.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/spark-line-cell.d.ts +2 -1
- package/es/scenegraph/group-creater/cell-type/spark-line-cell.js +1 -4
- package/es/scenegraph/group-creater/cell-type/spark-line-cell.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/text-cell.d.ts +1 -2
- package/es/scenegraph/group-creater/cell-type/text-cell.js +3 -17
- package/es/scenegraph/group-creater/cell-type/text-cell.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/video-cell.d.ts +1 -1
- package/es/scenegraph/group-creater/cell-type/video-cell.js +0 -3
- package/es/scenegraph/group-creater/cell-type/video-cell.js.map +1 -1
- package/es/scenegraph/group-creater/column-helper.js +8 -29
- package/es/scenegraph/group-creater/column-helper.js.map +1 -1
- package/es/scenegraph/group-creater/column.js.map +1 -1
- package/es/scenegraph/group-creater/progress/create-group-for-first-screen.d.ts +3 -0
- package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js +65 -0
- package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -0
- package/es/scenegraph/group-creater/progress/proxy.d.ts +31 -12
- package/es/scenegraph/group-creater/progress/proxy.js +124 -130
- package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.d.ts +2 -0
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.js +104 -0
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.js.map +1 -0
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.d.ts +2 -0
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +102 -0
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js.map +1 -0
- package/es/scenegraph/group-creater/progress/update-position/update-auto-row.d.ts +2 -0
- package/es/scenegraph/group-creater/progress/update-position/update-auto-row.js +18 -0
- package/es/scenegraph/group-creater/progress/update-position/update-auto-row.js.map +1 -0
- package/es/scenegraph/layout/compute-col-width.d.ts +9 -1
- package/es/scenegraph/layout/compute-col-width.js +31 -22
- package/es/scenegraph/layout/compute-col-width.js.map +1 -1
- package/es/scenegraph/layout/compute-row-height.d.ts +3 -0
- package/es/scenegraph/layout/compute-row-height.js +175 -0
- package/es/scenegraph/layout/compute-row-height.js.map +1 -0
- package/es/scenegraph/layout/move-cell.js +1 -1
- package/es/scenegraph/layout/move-cell.js.map +1 -1
- package/es/scenegraph/layout/update-cell.js +3 -1
- package/es/scenegraph/layout/update-cell.js.map +1 -1
- package/es/scenegraph/layout/update-height.js +4 -2
- package/es/scenegraph/layout/update-height.js.map +1 -1
- package/es/scenegraph/layout/update-row.js +1 -1
- package/es/scenegraph/layout/update-row.js.map +1 -1
- package/es/scenegraph/layout/update-width.js +4 -2
- package/es/scenegraph/layout/update-width.js.map +1 -1
- package/es/scenegraph/refresh-node/update-chart.d.ts +3 -0
- package/es/scenegraph/refresh-node/update-chart.js +45 -4
- package/es/scenegraph/refresh-node/update-chart.js.map +1 -1
- package/es/scenegraph/scenegraph.d.ts +13 -5
- package/es/scenegraph/scenegraph.js +165 -58
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/scenegraph/stick-text/index.d.ts +1 -0
- package/es/scenegraph/stick-text/index.js +21 -5
- package/es/scenegraph/stick-text/index.js.map +1 -1
- package/es/scenegraph/style/frame-border.js +1 -5
- package/es/scenegraph/style/frame-border.js.map +1 -1
- package/es/scenegraph/utils/text-icon-layout.d.ts +2 -1
- package/es/scenegraph/utils/text-icon-layout.js +4 -4
- package/es/scenegraph/utils/text-icon-layout.js.map +1 -1
- package/es/state/hover/col.js +4 -4
- package/es/state/hover/col.js.map +1 -1
- package/es/state/state.js +1 -1
- package/es/state/state.js.map +1 -1
- package/es/themes/DEFAULT.js +1 -2
- package/es/tools/LimitPromiseQueue.js +2 -1
- package/es/tools/NumberMap.d.ts +1 -0
- package/es/tools/NumberMap.js +3 -0
- package/es/tools/NumberMap.js.map +1 -1
- package/es/tools/calc.d.ts +3 -0
- package/es/tools/calc.js +10 -0
- package/es/tools/calc.js.map +1 -1
- package/es/tools/diff-cell.js +1 -1
- package/es/tools/dom.js +1 -1
- package/es/tools/env.js +1 -1
- package/es/ts-types/base-table.d.ts +41 -12
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/column/style.d.ts +0 -1
- package/es/ts-types/column/style.js.map +1 -1
- package/es/ts-types/component/axis.d.ts +12 -0
- package/es/ts-types/component/axis.js +2 -0
- package/es/ts-types/component/axis.js.map +1 -0
- package/es/ts-types/component/legend.d.ts +5 -0
- package/es/ts-types/component/legend.js +2 -0
- package/es/ts-types/component/legend.js.map +1 -0
- package/es/ts-types/component/title.d.ts +47 -0
- package/es/ts-types/component/title.js +2 -0
- package/es/ts-types/component/title.js.map +1 -0
- package/es/ts-types/component/util.d.ts +1 -0
- package/es/ts-types/component/util.js +2 -0
- package/es/ts-types/component/util.js.map +1 -0
- package/es/ts-types/events.d.ts +100 -83
- package/es/ts-types/events.js.map +1 -1
- package/es/ts-types/list-table/layout-map/api.d.ts +4 -0
- package/es/ts-types/list-table/layout-map/api.js.map +1 -1
- package/es/ts-types/new-data-set.d.ts +18 -5
- package/es/ts-types/new-data-set.js +2 -2
- package/es/ts-types/new-data-set.js.map +1 -1
- package/es/ts-types/pivot-table/PIVOT_TABLE_EVENT_TYPE.d.ts +4 -0
- package/es/ts-types/pivot-table/PIVOT_TABLE_EVENT_TYPE.js +4 -0
- package/es/ts-types/pivot-table/PIVOT_TABLE_EVENT_TYPE.js.map +1 -1
- package/es/ts-types/pivot-table/corner.d.ts +3 -3
- package/es/ts-types/pivot-table/corner.js.map +1 -1
- package/es/ts-types/pivot-table/indicator/index.d.ts +1 -0
- package/es/ts-types/pivot-table/indicator/index.js.map +1 -1
- package/es/ts-types/pivot-table/title.d.ts +1 -1
- package/es/ts-types/pivot-table/title.js.map +1 -1
- package/es/ts-types/table-engine.d.ts +27 -3
- package/es/ts-types/table-engine.js.map +1 -1
- package/package.json +13 -7
- package/cjs/menu/dom/BaseMenu.js.map +0 -1
- package/cjs/menu/dom/Menu.js.map +0 -1
- package/cjs/menu/dom/MenuHandler.js.map +0 -1
- package/cjs/menu/dom/logic/MenuContainer.js.map +0 -1
- package/cjs/menu/dom/logic/MenuElement.js.map +0 -1
- package/cjs/menu/dom/logic/MenuElementStyle.js.map +0 -1
- package/cjs/scenegraph/layout/auto-width.d.ts +0 -2
- package/cjs/scenegraph/layout/auto-width.js +0 -85
- package/cjs/scenegraph/layout/auto-width.js.map +0 -1
- package/cjs/tooltip/BaseTooltip.js.map +0 -1
- package/cjs/tooltip/Tooltip.js.map +0 -1
- package/cjs/tooltip/TooltipHandler.js.map +0 -1
- package/cjs/tooltip/logic/BubbleTooltipElement.js.map +0 -1
- package/cjs/tooltip/logic/BubbleTooltipElementStyle.js.map +0 -1
- package/dist/vtable.es5.js +0 -53155
- package/dist/vtable.es5.min.js +0 -3
- package/es/menu/dom/BaseMenu.js.map +0 -1
- package/es/menu/dom/Menu.js.map +0 -1
- package/es/menu/dom/MenuHandler.js.map +0 -1
- package/es/menu/dom/logic/MenuContainer.js.map +0 -1
- package/es/menu/dom/logic/MenuElement.js.map +0 -1
- package/es/menu/dom/logic/MenuElementStyle.js.map +0 -1
- package/es/scenegraph/layout/auto-width.d.ts +0 -2
- package/es/scenegraph/layout/auto-width.js +0 -82
- package/es/scenegraph/layout/auto-width.js.map +0 -1
- package/es/tooltip/BaseTooltip.js.map +0 -1
- package/es/tooltip/Tooltip.js.map +0 -1
- package/es/tooltip/TooltipHandler.js.map +0 -1
- package/es/tooltip/logic/BubbleTooltipElement.js.map +0 -1
- package/es/tooltip/logic/BubbleTooltipElementStyle.js.map +0 -1
- /package/cjs/{menu → components/menu}/dom/BaseMenu.js +0 -0
- /package/cjs/{menu → components/menu}/dom/Menu.d.ts +0 -0
- /package/cjs/{menu → components/menu}/dom/Menu.js +0 -0
- /package/cjs/{menu → components/menu}/dom/logic/MenuElementStyle.d.ts +0 -0
- /package/cjs/{menu → components/menu}/dom/logic/MenuElementStyle.js +0 -0
- /package/cjs/{tooltip → components/tooltip}/BaseTooltip.js +0 -0
- /package/cjs/{tooltip → components/tooltip}/Tooltip.d.ts +0 -0
- /package/cjs/{tooltip → components/tooltip}/Tooltip.js +0 -0
- /package/cjs/{tooltip → components/tooltip}/logic/BubbleTooltipElementStyle.d.ts +0 -0
- /package/cjs/{tooltip → components/tooltip}/logic/BubbleTooltipElementStyle.js +0 -0
- /package/es/{menu → components/menu}/dom/BaseMenu.js +0 -0
- /package/es/{menu → components/menu}/dom/Menu.d.ts +0 -0
- /package/es/{menu → components/menu}/dom/Menu.js +0 -0
- /package/es/{menu → components/menu}/dom/logic/MenuElementStyle.d.ts +0 -0
- /package/es/{menu → components/menu}/dom/logic/MenuElementStyle.js +0 -0
- /package/es/{tooltip → components/tooltip}/BaseTooltip.js +0 -0
- /package/es/{tooltip → components/tooltip}/Tooltip.d.ts +0 -0
- /package/es/{tooltip → components/tooltip}/Tooltip.js +0 -0
- /package/es/{tooltip → components/tooltip}/logic/BubbleTooltipElementStyle.d.ts +0 -0
- /package/es/{tooltip → components/tooltip}/logic/BubbleTooltipElementStyle.js +0 -0
package/es/dataset/dataset.js
CHANGED
|
@@ -1,32 +1,46 @@
|
|
|
1
|
+
import { isArray } from "@visactor/vutils";
|
|
2
|
+
|
|
3
|
+
import { isValid } from "../tools/util";
|
|
4
|
+
|
|
1
5
|
import { AggregationType, SortType } from "../ts-types";
|
|
2
6
|
|
|
7
|
+
import { AvgAggregator, CountAggregator, MaxAggregator, MinAggregator, RecordAggregator, SumAggregator, naturalSort, sortBy, typeSort } from "./statistics-helper";
|
|
8
|
+
|
|
9
|
+
import { getNewRangeToAlign } from "./util/zero-align";
|
|
10
|
+
|
|
3
11
|
export class Dataset {
|
|
4
|
-
constructor(dataConfig, rows, columns,
|
|
5
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
12
|
+
constructor(dataConfig, rows, columns, indicatorKeys, records, customColTree, customRowTree) {
|
|
13
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
|
|
6
14
|
this.tree = {}, this.colFlatKeys = {}, this.rowFlatKeys = {}, this.colKeys = [],
|
|
7
15
|
this.rowKeys = [], this.rowOrder = "key_a_to_z", this.colOrder = "key_a_to_z", this.sorted = !1,
|
|
8
16
|
this.indicatorStatistics = [], this.aggregators = {}, this.stringJoinChar = String.fromCharCode(0),
|
|
9
|
-
this.rowsIsTotal = [], this.colsIsTotal = [], this.
|
|
10
|
-
this.
|
|
11
|
-
this.
|
|
12
|
-
this.
|
|
13
|
-
this.
|
|
14
|
-
this.
|
|
15
|
-
this.
|
|
16
|
-
this.
|
|
17
|
-
this.
|
|
18
|
-
|
|
17
|
+
this.rowsIsTotal = [], this.colsIsTotal = [], this.collectedValues = {}, this.registerAggregators(),
|
|
18
|
+
this.dataConfig = dataConfig, this.sortRules = null === (_a = this.dataConfig) || void 0 === _a ? void 0 : _a.sortRules,
|
|
19
|
+
this.aggregationRules = null === (_b = this.dataConfig) || void 0 === _b ? void 0 : _b.aggregationRules,
|
|
20
|
+
this.derivedFieldRules = null === (_c = this.dataConfig) || void 0 === _c ? void 0 : _c.derivedFieldRules,
|
|
21
|
+
this.mappingRules = null === (_d = this.dataConfig) || void 0 === _d ? void 0 : _d.mappingRules,
|
|
22
|
+
this.totals = null === (_e = this.dataConfig) || void 0 === _e ? void 0 : _e.totals,
|
|
23
|
+
this.rows = rows, this.columns = columns, this.indicatorKeys = indicatorKeys, this.colGrandTotalLabel = null !== (_h = null === (_g = null === (_f = this.totals) || void 0 === _f ? void 0 : _f.column) || void 0 === _g ? void 0 : _g.grandTotalLabel) && void 0 !== _h ? _h : "总计",
|
|
24
|
+
this.colSubTotalLabel = null !== (_l = null === (_k = null === (_j = this.totals) || void 0 === _j ? void 0 : _j.column) || void 0 === _k ? void 0 : _k.subTotalLabel) && void 0 !== _l ? _l : "小计",
|
|
25
|
+
this.rowGrandTotalLabel = null !== (_p = null === (_o = null === (_m = this.totals) || void 0 === _m ? void 0 : _m.row) || void 0 === _o ? void 0 : _o.grandTotalLabel) && void 0 !== _p ? _p : "总计",
|
|
26
|
+
this.rowSubTotalLabel = null !== (_s = null === (_r = null === (_q = this.totals) || void 0 === _q ? void 0 : _q.row) || void 0 === _r ? void 0 : _r.subTotalLabel) && void 0 !== _s ? _s : "小计",
|
|
27
|
+
this.collectValuesBy = null !== (_u = null === (_t = this.dataConfig) || void 0 === _t ? void 0 : _t.collectValuesBy) && void 0 !== _u ? _u : {
|
|
28
|
+
230417170554008: {
|
|
29
|
+
by: [ "230417171050031", "230417171050028" ]
|
|
30
|
+
}
|
|
31
|
+
}, this.rowsIsTotal = new Array(this.rows.length).fill(!1), this.colsIsTotal = new Array(this.columns.length).fill(!1);
|
|
32
|
+
for (let i = 0, len = null === (_x = null === (_w = null === (_v = this.totals) || void 0 === _v ? void 0 : _v.row) || void 0 === _w ? void 0 : _w.subTotalsDimensions) || void 0 === _x ? void 0 : _x.length; i < len; i++) {
|
|
19
33
|
const dimension = this.totals.row.subTotalsDimensions[i], dimensionIndex = this.rows.indexOf(dimension);
|
|
20
34
|
this.rowsIsTotal[dimensionIndex] = !0;
|
|
21
35
|
}
|
|
22
|
-
for (let i = 0, len = null === (
|
|
36
|
+
for (let i = 0, len = null === (_0 = null === (_z = null === (_y = this.totals) || void 0 === _y ? void 0 : _y.column) || void 0 === _z ? void 0 : _z.subTotalsDimensions) || void 0 === _0 ? void 0 : _0.length; i < len; i++) {
|
|
23
37
|
const dimension = this.totals.column.subTotalsDimensions[i], dimensionIndex = this.columns.indexOf(dimension);
|
|
24
38
|
this.colsIsTotal[dimensionIndex] = !0;
|
|
25
39
|
}
|
|
26
40
|
if (records) {
|
|
27
41
|
this.records = records;
|
|
28
42
|
const t0 = "undefined" != typeof window ? window.performance.now() : 0;
|
|
29
|
-
this.setRecords(records);
|
|
43
|
+
this.setRecords(records), this.processCollectedValuesWithSumBy();
|
|
30
44
|
const t1 = "undefined" != typeof window ? window.performance.now() : 0;
|
|
31
45
|
console.log("processRecords:", t1 - t0);
|
|
32
46
|
const t4 = "undefined" != typeof window ? window.performance.now() : 0;
|
|
@@ -38,36 +52,53 @@ export class Dataset {
|
|
|
38
52
|
const t3 = "undefined" != typeof window ? window.performance.now() : 0;
|
|
39
53
|
console.log("sortKeys:", t3 - t2);
|
|
40
54
|
const t7 = "undefined" != typeof window ? window.performance.now() : 0;
|
|
41
|
-
this.rowKeysPath = this.TreeToArr(this.ArrToTree(this.rowKeys, this.rowsIsTotal, (null === (
|
|
42
|
-
this.colKeysPath = this.TreeToArr(this.ArrToTree(this.colKeys, this.colsIsTotal, (null === (
|
|
55
|
+
this.rowKeysPath = customRowTree ? this.TreeToArr2(customRowTree) : this.TreeToArr(this.ArrToTree(this.rowKeys, this.rowsIsTotal, (null === (_2 = null === (_1 = null == this ? void 0 : this.totals) || void 0 === _1 ? void 0 : _1.row) || void 0 === _2 ? void 0 : _2.showGrandTotals) || 0 === this.columns.length, this.rowGrandTotalLabel, this.rowSubTotalLabel)),
|
|
56
|
+
this.colKeysPath = customColTree ? this.TreeToArr2(customColTree) : this.TreeToArr(this.ArrToTree(this.colKeys, this.colsIsTotal, (null === (_4 = null === (_3 = this.totals) || void 0 === _3 ? void 0 : _3.column) || void 0 === _4 ? void 0 : _4.showGrandTotals) || 0 === this.rows.length, this.colGrandTotalLabel, this.colSubTotalLabel));
|
|
43
57
|
const t8 = "undefined" != typeof window ? window.performance.now() : 0;
|
|
44
|
-
console.log("TreeToArr:", t8 - t7);
|
|
58
|
+
console.log("TreeToArr:", t8 - t7), this.dataConfig.isPivotChart && this.dealWithZeroAlign();
|
|
45
59
|
}
|
|
46
|
-
delete this.rowFlatKeys, delete this.colFlatKeys;
|
|
47
60
|
}
|
|
48
61
|
registerAggregator(type, aggregator) {
|
|
49
62
|
this.aggregators[type] = aggregator;
|
|
50
63
|
}
|
|
51
64
|
registerAggregators() {
|
|
52
|
-
this.registerAggregator(AggregationType.
|
|
53
|
-
this.registerAggregator(AggregationType.
|
|
54
|
-
this.registerAggregator(AggregationType.AVG, AvgAggregator);
|
|
65
|
+
this.registerAggregator(AggregationType.RECORD, RecordAggregator), this.registerAggregator(AggregationType.SUM, SumAggregator),
|
|
66
|
+
this.registerAggregator(AggregationType.COUNT, CountAggregator), this.registerAggregator(AggregationType.MAX, MaxAggregator),
|
|
67
|
+
this.registerAggregator(AggregationType.MIN, MinAggregator), this.registerAggregator(AggregationType.AVG, AvgAggregator);
|
|
55
68
|
}
|
|
56
69
|
setRecords(records) {
|
|
57
70
|
this.processRecords();
|
|
58
71
|
}
|
|
72
|
+
processCollectedValuesWithSumBy() {
|
|
73
|
+
var _a;
|
|
74
|
+
for (const field in this.collectedValues) if (null === (_a = this.collectValuesBy[field]) || void 0 === _a ? void 0 : _a.sumBy) for (const byKeys in this.collectedValues[field]) {
|
|
75
|
+
const max = Object.values(this.collectedValues[field][byKeys]).reduce(((acc, cur) => cur.value() > acc ? cur.value() : acc), Number.MIN_SAFE_INTEGER), min = Object.values(this.collectedValues[field][byKeys]).reduce(((acc, cur) => cur.value() < acc ? cur.value() : acc), Number.MAX_SAFE_INTEGER);
|
|
76
|
+
this.collectedValues[field][byKeys] = {}, this.collectedValues[field][byKeys].max = max,
|
|
77
|
+
this.collectedValues[field][byKeys].min = min;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
59
80
|
processRecords() {
|
|
81
|
+
var _a, _b;
|
|
82
|
+
let isNeedFilter = !1;
|
|
83
|
+
(null === (_b = null === (_a = this.dataConfig) || void 0 === _a ? void 0 : _a.filterRules) || void 0 === _b ? void 0 : _b.length) >= 1 && (isNeedFilter = !0);
|
|
60
84
|
for (let i = 0, len = this.records.length; i < len; i++) {
|
|
61
85
|
const record = this.records[i];
|
|
62
|
-
this.filterRecord(record)
|
|
86
|
+
isNeedFilter && !this.filterRecord(record) || this.processRecord(record);
|
|
63
87
|
}
|
|
88
|
+
this.rowFlatKeys = {}, this.colFlatKeys = {};
|
|
64
89
|
}
|
|
65
90
|
filterRecord(record) {
|
|
66
91
|
var _a, _b;
|
|
67
92
|
let isReserved = !0;
|
|
68
|
-
for (let i = 0; i <
|
|
69
|
-
const filterRule = this.dataConfig.filterRules[i];
|
|
70
|
-
if (
|
|
93
|
+
for (let i = 0; i < this.dataConfig.filterRules.length; i++) {
|
|
94
|
+
const filterRule = null === (_a = this.dataConfig) || void 0 === _a ? void 0 : _a.filterRules[i];
|
|
95
|
+
if (filterRule.filterKey) {
|
|
96
|
+
const filterValue = record[filterRule.filterKey];
|
|
97
|
+
if (-1 === filterRule.filteredValues.indexOf(filterValue)) {
|
|
98
|
+
isReserved = !1;
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
} else if (!(null === (_b = filterRule.filterFunc) || void 0 === _b ? void 0 : _b.call(filterRule, record))) {
|
|
71
102
|
isReserved = !1;
|
|
72
103
|
break;
|
|
73
104
|
}
|
|
@@ -75,7 +106,7 @@ export class Dataset {
|
|
|
75
106
|
return isReserved;
|
|
76
107
|
}
|
|
77
108
|
processRecord(record) {
|
|
78
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
109
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
79
110
|
null === (_a = this.derivedFieldRules) || void 0 === _a || _a.forEach(((derivedFieldRule, i) => {
|
|
80
111
|
record[derivedFieldRule.fieldName] = derivedFieldRule.derivedFunc(record);
|
|
81
112
|
}));
|
|
@@ -88,30 +119,47 @@ export class Dataset {
|
|
|
88
119
|
const colAttr = this.columns[n];
|
|
89
120
|
colKey.push(record[colAttr]);
|
|
90
121
|
}
|
|
122
|
+
for (const field in this.collectValuesBy) if (record[field]) {
|
|
123
|
+
this.collectedValues[field] || (this.collectedValues[field] = {});
|
|
124
|
+
const collectKeys = this.collectValuesBy[field].by.map((byField => record[byField])).join(this.stringJoinChar);
|
|
125
|
+
if (this.collectedValues[field][collectKeys] || (this.collectValuesBy[field].sumBy ? this.collectedValues[field][collectKeys] = {} : this.collectValuesBy[field].range ? this.collectedValues[field][collectKeys] = {
|
|
126
|
+
min: Number.MAX_SAFE_INTEGER,
|
|
127
|
+
max: Number.MIN_SAFE_INTEGER
|
|
128
|
+
} : this.collectedValues[field][collectKeys] = new Set), this.collectValuesBy[field].sumBy) {
|
|
129
|
+
const sumByKeys = this.collectValuesBy[field].sumBy.map((byField => record[byField])).join(this.stringJoinChar);
|
|
130
|
+
this.collectedValues[field][collectKeys][sumByKeys] || (this.collectedValues[field][collectKeys][sumByKeys] = new this.aggregators[AggregationType.SUM](field)),
|
|
131
|
+
this.collectedValues[field][collectKeys][sumByKeys].push(record);
|
|
132
|
+
} else if (this.collectValuesBy[field].range) {
|
|
133
|
+
const fieldRange = this.collectedValues[field][collectKeys];
|
|
134
|
+
fieldRange.max = Math.max(record[field], fieldRange.max), fieldRange.min = Math.min(record[field], fieldRange.min);
|
|
135
|
+
} else {
|
|
136
|
+
this.collectedValues[field][collectKeys].add(record[field]);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
91
139
|
const flatRowKey = rowKey.join(this.stringJoinChar), flatColKey = colKey.join(this.stringJoinChar);
|
|
92
140
|
if (0 !== rowKey.length && (this.rowFlatKeys[flatRowKey] || (this.rowKeys.push(rowKey),
|
|
93
141
|
this.rowFlatKeys[flatRowKey] = 1)), 0 !== colKey.length && (this.colFlatKeys[flatColKey] || (this.colKeys.push(colKey),
|
|
94
142
|
this.colFlatKeys[flatColKey] = 1)), 0 !== colKey.length || 0 !== rowKey.length) {
|
|
95
143
|
this.tree[flatRowKey] || (this.tree[flatRowKey] = {}), (null === (_b = this.tree[flatRowKey]) || void 0 === _b ? void 0 : _b[flatColKey]) || (this.tree[flatRowKey][flatColKey] = []);
|
|
96
|
-
for (let i = 0; i < this.
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
null === (
|
|
144
|
+
for (let i = 0; i < this.indicatorKeys.length; i++) {
|
|
145
|
+
const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
|
|
146
|
+
if ((null === (_d = null === (_c = this.tree[flatRowKey]) || void 0 === _c ? void 0 : _c[flatColKey]) || void 0 === _d ? void 0 : _d[i]) || (this.tree[flatRowKey][flatColKey][i] = new this.aggregators[null !== (_e = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _e ? _e : AggregationType.SUM](null !== (_f = null == aggRule ? void 0 : aggRule.field) && void 0 !== _f ? _f : this.indicatorKeys[i], null == aggRule ? void 0 : aggRule.formatFun)),
|
|
147
|
+
null == aggRule ? void 0 : aggRule.field) if ("string" == typeof (null == aggRule ? void 0 : aggRule.field)) isValid(record[null == aggRule ? void 0 : aggRule.field]) && (null === (_h = null === (_g = this.tree[flatRowKey]) || void 0 === _g ? void 0 : _g[flatColKey]) || void 0 === _h || _h[i].push(record)); else {
|
|
148
|
+
(null == aggRule ? void 0 : aggRule.field.find((field => record[field]))) && (null === (_k = null === (_j = this.tree[flatRowKey]) || void 0 === _j ? void 0 : _j[flatColKey]) || void 0 === _k || _k[i].push(record));
|
|
149
|
+
} else isValid(record[this.indicatorKeys[i]]) && (null === (_m = null === (_l = this.tree[flatRowKey]) || void 0 === _l ? void 0 : _l[flatColKey]) || void 0 === _m || _m[i].push(record));
|
|
102
150
|
}
|
|
103
151
|
}
|
|
104
|
-
if (this.mappingRules) for (let i = 0; i < this.
|
|
152
|
+
if (this.mappingRules) for (let i = 0; i < this.indicatorKeys.length; i++) {
|
|
105
153
|
if (!this.indicatorStatistics[i]) {
|
|
106
|
-
const aggRule = this.getAggregatorRule(this.
|
|
154
|
+
const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
|
|
107
155
|
this.indicatorStatistics[i] = {
|
|
108
|
-
max: new this.aggregators[AggregationType.MAX](this.
|
|
109
|
-
min: new this.aggregators[AggregationType.MIN](this.
|
|
110
|
-
total: new this.aggregators[null !== (
|
|
156
|
+
max: new this.aggregators[AggregationType.MAX](this.indicatorKeys[i]),
|
|
157
|
+
min: new this.aggregators[AggregationType.MIN](this.indicatorKeys[i]),
|
|
158
|
+
total: new this.aggregators[null !== (_o = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _o ? _o : AggregationType.SUM](null !== (_p = null == aggRule ? void 0 : aggRule.field) && void 0 !== _p ? _p : this.indicatorKeys[i], null == aggRule ? void 0 : aggRule.formatFun)
|
|
111
159
|
};
|
|
112
160
|
}
|
|
113
|
-
this.indicatorStatistics[i].max.push(null === (
|
|
114
|
-
this.indicatorStatistics[i].min.push(null === (
|
|
161
|
+
this.indicatorStatistics[i].max.push(null === (_r = null === (_q = this.tree[flatRowKey]) || void 0 === _q ? void 0 : _q[flatColKey]) || void 0 === _r ? void 0 : _r[i].value()),
|
|
162
|
+
this.indicatorStatistics[i].min.push(null === (_t = null === (_s = this.tree[flatRowKey]) || void 0 === _s ? void 0 : _s[flatColKey]) || void 0 === _t ? void 0 : _t[i].value()),
|
|
115
163
|
this.indicatorStatistics[i].total.push(record);
|
|
116
164
|
}
|
|
117
165
|
}
|
|
@@ -120,13 +168,17 @@ export class Dataset {
|
|
|
120
168
|
this.sorted = !1, this.sortRules = sortRules, this.sortKeys(), this.rowKeysPath = this.TreeToArr(this.ArrToTree(this.rowKeys, this.rowsIsTotal, (null === (_b = null === (_a = null == this ? void 0 : this.totals) || void 0 === _a ? void 0 : _a.row) || void 0 === _b ? void 0 : _b.showGrandTotals) || 0 === this.columns.length, this.rowGrandTotalLabel, this.rowSubTotalLabel)),
|
|
121
169
|
this.colKeysPath = this.TreeToArr(this.ArrToTree(this.colKeys, this.colsIsTotal, (null === (_d = null === (_c = this.totals) || void 0 === _c ? void 0 : _c.column) || void 0 === _d ? void 0 : _d.showGrandTotals) || 0 === this.rows.length, this.colGrandTotalLabel, this.colSubTotalLabel));
|
|
122
170
|
}
|
|
171
|
+
updateFilterRules(filterRules, isResetTree = !1) {
|
|
172
|
+
if (this.filterRules = filterRules, isResetTree) this.tree = {}; else for (const treeRowKey in this.tree) for (const treeColKey in this.tree[treeRowKey]) for (let i = 0; i < this.tree[treeRowKey][treeColKey].length; i++) this.tree[treeRowKey][treeColKey][i].reset();
|
|
173
|
+
this.collectedValues = {}, this.processRecords(), this.processCollectedValuesWithSumBy();
|
|
174
|
+
}
|
|
123
175
|
getAggregatorRule(indicatorKey) {
|
|
124
176
|
var _a;
|
|
125
177
|
return null === (_a = this.aggregationRules) || void 0 === _a ? void 0 : _a.find(((value, index) => indicatorKey === value.indicatorKey));
|
|
126
178
|
}
|
|
127
179
|
getAggregator(rowKey = [], colKey = [], indicator) {
|
|
128
180
|
var _a, _b;
|
|
129
|
-
const indicatorIndex = this.
|
|
181
|
+
const indicatorIndex = this.indicatorKeys.indexOf(indicator);
|
|
130
182
|
let agg, flatRowKey, flatColKey;
|
|
131
183
|
return flatRowKey = "string" == typeof rowKey ? rowKey : rowKey.join(this.stringJoinChar),
|
|
132
184
|
flatColKey = "string" == typeof colKey ? colKey : colKey.join(this.stringJoinChar),
|
|
@@ -135,7 +187,8 @@ export class Dataset {
|
|
|
135
187
|
className: "",
|
|
136
188
|
push() {},
|
|
137
189
|
value: () => null,
|
|
138
|
-
formatValue: () => ""
|
|
190
|
+
formatValue: () => "",
|
|
191
|
+
reset() {}
|
|
139
192
|
};
|
|
140
193
|
}
|
|
141
194
|
sortKeys() {
|
|
@@ -243,10 +296,10 @@ export class Dataset {
|
|
|
243
296
|
colTotalKey.push(null !== (_f = null === (_e = null === (_d = that.totals) || void 0 === _d ? void 0 : _d.column) || void 0 === _e ? void 0 : _e.subTotalLabel) && void 0 !== _f ? _f : "小计");
|
|
244
297
|
const flatColTotalKey = colTotalKey.join(this.stringJoinChar);
|
|
245
298
|
this.tree[flatRowKey][flatColTotalKey] || (this.tree[flatRowKey][flatColTotalKey] = []);
|
|
246
|
-
for (let i = 0; i < this.
|
|
299
|
+
for (let i = 0; i < this.indicatorKeys.length; i++) {
|
|
247
300
|
if (!this.tree[flatRowKey][flatColTotalKey][i]) {
|
|
248
|
-
const aggRule = this.getAggregatorRule(this.
|
|
249
|
-
this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[null !== (_g = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _g ? _g : AggregationType.SUM](null !== (_h = null == aggRule ? void 0 : aggRule.field) && void 0 !== _h ? _h : this.
|
|
301
|
+
const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
|
|
302
|
+
this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[null !== (_g = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _g ? _g : AggregationType.SUM](null !== (_h = null == aggRule ? void 0 : aggRule.field) && void 0 !== _h ? _h : this.indicatorKeys[i], null == aggRule ? void 0 : aggRule.formatFun);
|
|
250
303
|
}
|
|
251
304
|
this.tree[flatRowKey][flatColTotalKey][i].push(null === (_k = null === (_j = that.tree[flatRowKey]) || void 0 === _j ? void 0 : _j[flatColKey]) || void 0 === _k ? void 0 : _k[i]);
|
|
252
305
|
}
|
|
@@ -255,10 +308,10 @@ export class Dataset {
|
|
|
255
308
|
if ((null === (_m = null === (_l = that.totals) || void 0 === _l ? void 0 : _l.column) || void 0 === _m ? void 0 : _m.showGrandTotals) || 0 === this.rows.length) {
|
|
256
309
|
const flatColTotalKey = that.colGrandTotalLabel;
|
|
257
310
|
this.tree[flatRowKey][flatColTotalKey] || (this.tree[flatRowKey][flatColTotalKey] = []);
|
|
258
|
-
for (let i = 0; i < this.
|
|
311
|
+
for (let i = 0; i < this.indicatorKeys.length; i++) {
|
|
259
312
|
if (!this.tree[flatRowKey][flatColTotalKey][i]) {
|
|
260
|
-
const aggRule = this.getAggregatorRule(this.
|
|
261
|
-
this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[null !== (_o = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _o ? _o : AggregationType.SUM](null !== (_p = null == aggRule ? void 0 : aggRule.field) && void 0 !== _p ? _p : this.
|
|
313
|
+
const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
|
|
314
|
+
this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[null !== (_o = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _o ? _o : AggregationType.SUM](null !== (_p = null == aggRule ? void 0 : aggRule.field) && void 0 !== _p ? _p : this.indicatorKeys[i], null == aggRule ? void 0 : aggRule.formatFun);
|
|
262
315
|
}
|
|
263
316
|
this.tree[flatRowKey][flatColTotalKey][i].push(null === (_r = null === (_q = that.tree[flatRowKey]) || void 0 === _q ? void 0 : _q[flatColKey]) || void 0 === _r ? void 0 : _r[i]);
|
|
264
317
|
}
|
|
@@ -277,29 +330,29 @@ export class Dataset {
|
|
|
277
330
|
if (this.tree[flatRowTotalKey] || (this.tree[flatRowTotalKey] = {}, rowTotalKeys.push(flatRowTotalKey)),
|
|
278
331
|
!this.tree[flatRowTotalKey][flatColKey]) {
|
|
279
332
|
this.tree[flatRowTotalKey][flatColKey] = [];
|
|
280
|
-
for (let i = 0; i < this.
|
|
333
|
+
for (let i = 0; i < this.indicatorKeys.length; i++) {
|
|
281
334
|
if (!this.tree[flatRowTotalKey][flatColKey][i]) {
|
|
282
|
-
const aggRule = this.getAggregatorRule(this.
|
|
283
|
-
this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[null !== (_g = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _g ? _g : AggregationType.SUM](null !== (_h = null == aggRule ? void 0 : aggRule.field) && void 0 !== _h ? _h : this.
|
|
335
|
+
const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
|
|
336
|
+
this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[null !== (_g = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _g ? _g : AggregationType.SUM](null !== (_h = null == aggRule ? void 0 : aggRule.field) && void 0 !== _h ? _h : this.indicatorKeys[i], null == aggRule ? void 0 : aggRule.formatFun);
|
|
284
337
|
}
|
|
285
338
|
this.tree[flatRowTotalKey][flatColKey][i].push(null === (_k = null === (_j = that.tree[flatRowKey]) || void 0 === _j ? void 0 : _j[flatColKey]) || void 0 === _k ? void 0 : _k[i]);
|
|
286
339
|
}
|
|
287
340
|
}
|
|
288
341
|
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
this.tree[flatRowTotalKey][flatColKey][i].push(null === (_r = null === (_q = that.tree[flatRowKey]) || void 0 === _q ? void 0 : _q[flatColKey]) || void 0 === _r ? void 0 : _r[i]);
|
|
342
|
+
}
|
|
343
|
+
if ((null === (_m = null === (_l = that.totals) || void 0 === _l ? void 0 : _l.row) || void 0 === _m ? void 0 : _m.showGrandTotals) || 0 === this.columns.length) {
|
|
344
|
+
const flatRowTotalKey = that.rowGrandTotalLabel;
|
|
345
|
+
this.tree[flatRowTotalKey] || (this.tree[flatRowTotalKey] = {}, rowTotalKeys.push(flatRowTotalKey)),
|
|
346
|
+
this.tree[flatRowTotalKey][flatColKey] || (this.tree[flatRowTotalKey][flatColKey] = []);
|
|
347
|
+
for (let i = 0; i < this.indicatorKeys.length; i++) {
|
|
348
|
+
if (!this.tree[flatRowTotalKey][flatColKey][i]) {
|
|
349
|
+
const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
|
|
350
|
+
this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[null !== (_o = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _o ? _o : AggregationType.SUM](null !== (_p = null == aggRule ? void 0 : aggRule.field) && void 0 !== _p ? _p : this.indicatorKeys[i], null == aggRule ? void 0 : aggRule.formatFun);
|
|
299
351
|
}
|
|
352
|
+
this.tree[flatRowTotalKey][flatColKey][i].push(null === (_r = null === (_q = that.tree[flatRowKey]) || void 0 === _q ? void 0 : _q[flatColKey]) || void 0 === _r ? void 0 : _r[i]);
|
|
300
353
|
}
|
|
301
|
-
colCompute(flatRowKey, flatColKey);
|
|
302
354
|
}
|
|
355
|
+
colCompute(flatRowKey, flatColKey);
|
|
303
356
|
}));
|
|
304
357
|
})), rowTotalKeys.forEach((flatRowKey => {
|
|
305
358
|
Object.keys(that.tree[flatRowKey]).forEach((flatColKey => {
|
|
@@ -320,33 +373,33 @@ export class Dataset {
|
|
|
320
373
|
if (!item) {
|
|
321
374
|
if (item = {
|
|
322
375
|
id: flatKey,
|
|
323
|
-
|
|
376
|
+
children: []
|
|
324
377
|
}, subTotalFlags[index]) {
|
|
325
|
-
let curChild = item.
|
|
378
|
+
let curChild = item.children;
|
|
326
379
|
for (let i = index; i < list.length - 1; i++) {
|
|
327
380
|
const totalChild = {
|
|
328
381
|
id: `${flatKey}${concatStr}${subTotalLabel}`,
|
|
329
|
-
|
|
382
|
+
children: []
|
|
330
383
|
};
|
|
331
|
-
curChild.push(totalChild), curChild = totalChild.
|
|
384
|
+
curChild.push(totalChild), curChild = totalChild.children;
|
|
332
385
|
}
|
|
333
386
|
}
|
|
334
|
-
map.set(flatKey, item), node ? subTotalFlags[index - 1] ? node.
|
|
387
|
+
map.set(flatKey, item), node ? subTotalFlags[index - 1] ? node.children.splice(node.children.length - 1, 0, item) : node.children.push(item) : result.push(item);
|
|
335
388
|
}
|
|
336
389
|
node = item;
|
|
337
390
|
}));
|
|
338
391
|
}(item))), isGrandTotal) {
|
|
339
392
|
const node = {
|
|
340
393
|
id: grandTotalLabel,
|
|
341
|
-
|
|
394
|
+
children: []
|
|
342
395
|
};
|
|
343
|
-
let curChild = node.
|
|
396
|
+
let curChild = node.children;
|
|
344
397
|
for (let i = 1; i < subTotalFlags.length; i++) {
|
|
345
398
|
const totalChild = {
|
|
346
399
|
id: grandTotalLabel,
|
|
347
|
-
|
|
400
|
+
children: []
|
|
348
401
|
};
|
|
349
|
-
curChild.push(totalChild), curChild = totalChild.
|
|
402
|
+
curChild.push(totalChild), curChild = totalChild.children;
|
|
350
403
|
}
|
|
351
404
|
result.push(node);
|
|
352
405
|
}
|
|
@@ -356,127 +409,48 @@ export class Dataset {
|
|
|
356
409
|
const result = [];
|
|
357
410
|
function getPath(node, arr) {
|
|
358
411
|
var _a;
|
|
359
|
-
arr.push(node.id), node.
|
|
412
|
+
arr.push(node.id), node.children.length > 0 ? null === (_a = node.children) || void 0 === _a || _a.forEach((childItem => getPath(childItem, [ ...arr ]))) : result.push(arr);
|
|
360
413
|
}
|
|
361
414
|
return tree.forEach((treeNode => getPath(treeNode, []))), result;
|
|
362
415
|
}
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
return this._formatedValue || (this.formatFun ? this._formatedValue = this.formatFun(this.value()) : this._formatedValue = this.value()),
|
|
372
|
-
this._formatedValue;
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
class SumAggregator extends Aggregator {
|
|
377
|
-
constructor() {
|
|
378
|
-
super(...arguments), this.type = AggregationType.SUM, this.sum = 0;
|
|
379
|
-
}
|
|
380
|
-
push(record) {
|
|
381
|
-
this.isRecord && ("Aggregator" === record.className ? this.records.push(...record.records) : this.records.push(record)),
|
|
382
|
-
"Aggregator" === record.className ? this.sum += record.value() : isNaN(parseFloat(record[this.field])) || (this.sum += parseFloat(record[this.field]));
|
|
383
|
-
}
|
|
384
|
-
value() {
|
|
385
|
-
return this.sum;
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
class CountAggregator extends Aggregator {
|
|
390
|
-
constructor() {
|
|
391
|
-
super(...arguments), this.type = AggregationType.COUNT, this.count = 0;
|
|
392
|
-
}
|
|
393
|
-
push(record) {
|
|
394
|
-
this.isRecord && ("Aggregator" === record.className ? this.records.push(...record.records) : this.records.push(record)),
|
|
395
|
-
"Aggregator" === record.className ? this.count += record.value() : this.count++;
|
|
396
|
-
}
|
|
397
|
-
value() {
|
|
398
|
-
return this.count;
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
class AvgAggregator extends Aggregator {
|
|
403
|
-
constructor() {
|
|
404
|
-
super(...arguments), this.type = AggregationType.AVG, this.sum = 0, this.count = 0;
|
|
405
|
-
}
|
|
406
|
-
push(record) {
|
|
407
|
-
this.isRecord && ("Aggregator" === record.className ? this.records.push(...record.records) : this.records.push(record)),
|
|
408
|
-
"Aggregator" === record.className && record.type === AggregationType.AVG ? (this.sum += record.sum,
|
|
409
|
-
this.count += record.count) : isNaN(parseFloat(record[this.field])) || (this.sum += parseFloat(record[this.field]),
|
|
410
|
-
this.count++);
|
|
411
|
-
}
|
|
412
|
-
value() {
|
|
413
|
-
return this.sum / this.count;
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
class MaxAggregator extends Aggregator {
|
|
418
|
-
constructor() {
|
|
419
|
-
super(...arguments), this.type = AggregationType.MAX, this.max = Number.MIN_SAFE_INTEGER,
|
|
420
|
-
this.isRecord = !1;
|
|
421
|
-
}
|
|
422
|
-
push(record) {
|
|
423
|
-
this.isRecord && ("Aggregator" === record.className ? this.records.push(...record.records) : this.records.push(record)),
|
|
424
|
-
"number" == typeof record ? this.max = record > this.max ? record : this.max : "number" == typeof record[this.field] ? this.max = record[this.field] > this.max ? record[this.field] : this.max : isNaN(record[this.field]) || (this.max = parseFloat(record[this.field]) > this.max ? parseFloat(record[this.field]) : this.max);
|
|
425
|
-
}
|
|
426
|
-
value() {
|
|
427
|
-
return this.max;
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
class MinAggregator extends Aggregator {
|
|
432
|
-
constructor() {
|
|
433
|
-
super(...arguments), this.type = AggregationType.MIN, this.min = Number.MAX_SAFE_INTEGER,
|
|
434
|
-
this.isRecord = !1;
|
|
435
|
-
}
|
|
436
|
-
push(record) {
|
|
437
|
-
this.isRecord && ("Aggregator" === record.className ? this.records.push(...record.records) : this.records.push(record)),
|
|
438
|
-
"number" == typeof record ? this.min = record < this.min ? record : this.min : "number" == typeof record[this.field] && (this.min = record[this.field] < this.min ? record[this.field] : this.min);
|
|
416
|
+
TreeToArr2(tree) {
|
|
417
|
+
const result = [];
|
|
418
|
+
function getPath(node, arr) {
|
|
419
|
+
var _a, _b;
|
|
420
|
+
arr.push(arr.length > 0 ? [ arr[arr.length - 1], node.value ].join(String.fromCharCode(0)) : node.value),
|
|
421
|
+
(null === (_a = node.children) || void 0 === _a ? void 0 : _a.length) > 0 && !node.children[0].indicatorKey ? null === (_b = node.children) || void 0 === _b || _b.forEach((childItem => getPath(childItem, [ ...arr ]))) : result.push(arr);
|
|
422
|
+
}
|
|
423
|
+
return tree.forEach((treeNode => getPath(treeNode, []))), result;
|
|
439
424
|
}
|
|
440
|
-
|
|
441
|
-
|
|
425
|
+
dealWithZeroAlign() {
|
|
426
|
+
const indicatorsToAlign = [];
|
|
427
|
+
for (let i = 0; i < this.aggregationRules.length; i++) {
|
|
428
|
+
const rule = this.aggregationRules[i];
|
|
429
|
+
isArray(rule.field) && 2 === rule.field.length && indicatorsToAlign.push(rule.field);
|
|
430
|
+
}
|
|
431
|
+
indicatorsToAlign.forEach((indicatorToAlign => {
|
|
432
|
+
const indicator1 = indicatorToAlign[0], indicator2 = indicatorToAlign[1], collectedValue1 = this.collectedValues[indicator1], collectedValue2 = this.collectedValues[indicator2];
|
|
433
|
+
this.collectedValues[indicator1 + "_align"] = {}, this.collectedValues[indicator2 + "_align"] = {};
|
|
434
|
+
for (const key in collectedValue1) {
|
|
435
|
+
const range1 = collectedValue1[key], range2 = collectedValue2[key], newRanges = getNewRangeToAlign(range1, range2);
|
|
436
|
+
if (newRanges) {
|
|
437
|
+
const {range1: newRange1, range2: newRange2} = newRanges;
|
|
438
|
+
this.collectedValues[indicator1 + "_align"][key] = {
|
|
439
|
+
min: newRange1[0],
|
|
440
|
+
max: newRange1[1]
|
|
441
|
+
}, this.collectedValues[indicator2 + "_align"][key] = {
|
|
442
|
+
min: newRange2[0],
|
|
443
|
+
max: newRange2[1]
|
|
444
|
+
};
|
|
445
|
+
} else this.collectedValues[indicator1 + "_align"][key] = {
|
|
446
|
+
min: range1.min,
|
|
447
|
+
max: range1.max
|
|
448
|
+
}, this.collectedValues[indicator2 + "_align"][key] = {
|
|
449
|
+
min: range2.min,
|
|
450
|
+
max: range2.max
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
}));
|
|
442
454
|
}
|
|
443
455
|
}
|
|
444
|
-
|
|
445
|
-
function indicatorSort(a, b) {
|
|
446
|
-
return a && b ? a.toString().localeCompare(b.toString(), "zh") : a ? 1 : -1;
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
function typeSort(a, b) {
|
|
450
|
-
return a && b ? a.toString().localeCompare(b.toString(), "zh") : a ? 1 : -1;
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
function naturalSort(as, bs) {
|
|
454
|
-
const rx = /(\d+)|(\D+)/g, rd = /\d/, rz = /^0/;
|
|
455
|
-
let a, a1, b, b1, nas = 0, nbs = 0;
|
|
456
|
-
if (null !== bs && null === as) return -1;
|
|
457
|
-
if (null !== as && null === bs) return 1;
|
|
458
|
-
if ("number" == typeof as && isNaN(as)) return -1;
|
|
459
|
-
if ("number" == typeof bs && isNaN(bs)) return 1;
|
|
460
|
-
if (nas = +as, nbs = +bs, nas < nbs) return -1;
|
|
461
|
-
if (nas > nbs) return 1;
|
|
462
|
-
if ("number" == typeof as && "number" != typeof bs) return -1;
|
|
463
|
-
if ("number" == typeof bs && "number" != typeof as) return 1;
|
|
464
|
-
if ("number" == typeof as && "number" == typeof bs) return 0;
|
|
465
|
-
if (isNaN(nbs) && !isNaN(nas)) return -1;
|
|
466
|
-
if (isNaN(nas) && !isNaN(nbs)) return 1;
|
|
467
|
-
if (a = String(as), b = String(bs), a === b) return 0;
|
|
468
|
-
if (!rd.test(a) || !rd.test(b)) return a > b ? 1 : -1;
|
|
469
|
-
for (a = a.match(rx), b = b.match(rx); a.length && b.length; ) if (a1 = a.shift(),
|
|
470
|
-
b1 = b.shift(), a1 !== b1) return rd.test(a1) && rd.test(b1) ? a1.replace(rz, ".0") - b1.replace(rz, ".0") : a1 > b1 ? 1 : -1;
|
|
471
|
-
return a.length - b.length;
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
function sortBy(order) {
|
|
475
|
-
let x;
|
|
476
|
-
const mapping = {}, lowercase_mapping = {};
|
|
477
|
-
for (let i = 0; i < order.length; i++) x = order[i], mapping[x] = i, "string" == typeof x && (lowercase_mapping[x.toLowerCase()] = i);
|
|
478
|
-
return function(a, b) {
|
|
479
|
-
return null !== mapping[a] && void 0 !== mapping[a] && null !== mapping[b] && void 0 !== mapping[b] ? mapping[a] - mapping[b] : null !== mapping[a] && void 0 !== mapping[a] ? -1 : null !== mapping[b] && void 0 !== mapping[b] ? 1 : null !== lowercase_mapping[a] && void 0 !== mapping[a] && null !== lowercase_mapping[b] && void 0 !== mapping[b] ? lowercase_mapping[a] - lowercase_mapping[b] : null === lowercase_mapping[a] || void 0 === mapping[a] || null === lowercase_mapping[b] || void 0 === mapping[b] ? 0 : null !== lowercase_mapping[a] && void 0 !== mapping[a] ? -1 : null !== lowercase_mapping[b] && void 0 !== mapping[b] ? 1 : naturalSort(a, b);
|
|
480
|
-
};
|
|
481
|
-
}
|
|
482
456
|
//# sourceMappingURL=dataset.js.map
|