@visactor/vtable 0.9.0-alpha.0-alpha.0
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/README.md +152 -0
- package/cjs/ListTable.d.ts +38 -0
- package/cjs/ListTable.js +258 -0
- package/cjs/ListTable.js.map +1 -0
- package/cjs/PivotTable.d.ts +50 -0
- package/cjs/PivotTable.js +275 -0
- package/cjs/PivotTable.js.map +1 -0
- package/cjs/body-helper/body-helper.d.ts +14 -0
- package/cjs/body-helper/body-helper.js +99 -0
- package/cjs/body-helper/body-helper.js.map +1 -0
- package/cjs/body-helper/style/ImageStyle.d.ts +7 -0
- package/cjs/body-helper/style/ImageStyle.js +24 -0
- package/cjs/body-helper/style/ImageStyle.js.map +1 -0
- package/cjs/body-helper/style/MultilineTextStyle.d.ts +13 -0
- package/cjs/body-helper/style/MultilineTextStyle.js +38 -0
- package/cjs/body-helper/style/MultilineTextStyle.js.map +1 -0
- package/cjs/body-helper/style/NumberStyle.d.ts +7 -0
- package/cjs/body-helper/style/NumberStyle.js +24 -0
- package/cjs/body-helper/style/NumberStyle.js.map +1 -0
- package/cjs/body-helper/style/ProgressBarStyle.d.ts +52 -0
- package/cjs/body-helper/style/ProgressBarStyle.js +126 -0
- package/cjs/body-helper/style/ProgressBarStyle.js.map +1 -0
- package/cjs/body-helper/style/Style.d.ts +85 -0
- package/cjs/body-helper/style/Style.js +200 -0
- package/cjs/body-helper/style/Style.js.map +1 -0
- package/cjs/body-helper/style.d.ts +10 -0
- package/cjs/body-helper/style.js +52 -0
- package/cjs/body-helper/style.js.map +1 -0
- package/cjs/chartType.d.ts +3 -0
- package/cjs/chartType.js +14 -0
- package/cjs/chartType.js.map +1 -0
- package/cjs/core/BaseTable.d.ts +287 -0
- package/cjs/core/BaseTable.js +1272 -0
- package/cjs/core/BaseTable.js.map +1 -0
- package/cjs/core/FouseInput.d.ts +11 -0
- package/cjs/core/FouseInput.js +38 -0
- package/cjs/core/FouseInput.js.map +1 -0
- package/cjs/core/TABLE_EVENT_TYPE.d.ts +30 -0
- package/cjs/core/TABLE_EVENT_TYPE.js +34 -0
- package/cjs/core/TABLE_EVENT_TYPE.js.map +1 -0
- package/cjs/core/tableHelper.d.ts +28 -0
- package/cjs/core/tableHelper.js +141 -0
- package/cjs/core/tableHelper.js.map +1 -0
- package/cjs/core.d.ts +3 -0
- package/cjs/core.js +24 -0
- package/cjs/core.js.map +1 -0
- package/cjs/data/CachedDataSource.d.ts +16 -0
- package/cjs/data/CachedDataSource.js +54 -0
- package/cjs/data/CachedDataSource.js.map +1 -0
- package/cjs/data/DataSource.d.ts +64 -0
- package/cjs/data/DataSource.js +294 -0
- package/cjs/data/DataSource.js.map +1 -0
- package/cjs/data/FilterDataSource.d.ts +1 -0
- package/cjs/data/FilterDataSource.js +1 -0
- package/cjs/data/FilterDataSource.js.map +1 -0
- package/cjs/data.d.ts +4 -0
- package/cjs/data.js +24 -0
- package/cjs/data.js.map +1 -0
- package/cjs/dataset/DataStatistics.d.ts +10 -0
- package/cjs/dataset/DataStatistics.js +81 -0
- package/cjs/dataset/DataStatistics.js.map +1 -0
- package/cjs/dataset/dataset.d.ts +72 -0
- package/cjs/dataset/dataset.js +490 -0
- package/cjs/dataset/dataset.js.map +1 -0
- package/cjs/dataset/flatDataToObject.d.ts +31 -0
- package/cjs/dataset/flatDataToObject.js +71 -0
- package/cjs/dataset/flatDataToObject.js.map +1 -0
- package/cjs/event/EventHandler.d.ts +45 -0
- package/cjs/event/EventHandler.js +120 -0
- package/cjs/event/EventHandler.js.map +1 -0
- package/cjs/event/EventTarget.d.ts +11 -0
- package/cjs/event/EventTarget.js +59 -0
- package/cjs/event/EventTarget.js.map +1 -0
- package/cjs/event/chart.d.ts +2 -0
- package/cjs/event/chart.js +24 -0
- package/cjs/event/chart.js.map +1 -0
- package/cjs/event/drill.d.ts +3 -0
- package/cjs/event/drill.js +23 -0
- package/cjs/event/drill.js.map +1 -0
- package/cjs/event/event.d.ts +35 -0
- package/cjs/event/event.js +426 -0
- package/cjs/event/event.js.map +1 -0
- package/cjs/event/media-click.d.ts +2 -0
- package/cjs/event/media-click.js +58 -0
- package/cjs/event/media-click.js.map +1 -0
- package/cjs/event/scroll.d.ts +2 -0
- package/cjs/event/scroll.js +23 -0
- package/cjs/event/scroll.js.map +1 -0
- package/cjs/header-helper/header-helper.d.ts +26 -0
- package/cjs/header-helper/header-helper.js +214 -0
- package/cjs/header-helper/header-helper.js.map +1 -0
- package/cjs/header-helper/style/ImageStyle.d.ts +7 -0
- package/cjs/header-helper/style/ImageStyle.js +25 -0
- package/cjs/header-helper/style/ImageStyle.js.map +1 -0
- package/cjs/header-helper/style/MultilineTextHeaderStyle.d.ts +13 -0
- package/cjs/header-helper/style/MultilineTextHeaderStyle.js +38 -0
- package/cjs/header-helper/style/MultilineTextHeaderStyle.js.map +1 -0
- package/cjs/header-helper/style/SortHeaderStyle.d.ts +1 -0
- package/cjs/header-helper/style/SortHeaderStyle.js +3 -0
- package/cjs/header-helper/style/SortHeaderStyle.js.map +1 -0
- package/cjs/header-helper/style/Style.d.ts +88 -0
- package/cjs/header-helper/style/Style.js +208 -0
- package/cjs/header-helper/style/Style.js.map +1 -0
- package/cjs/header-helper/style.d.ts +5 -0
- package/cjs/header-helper/style.js +30 -0
- package/cjs/header-helper/style.js.map +1 -0
- package/cjs/icons.d.ts +4 -0
- package/cjs/icons.js +241 -0
- package/cjs/icons.js.map +1 -0
- package/cjs/index.d.ts +17 -0
- package/cjs/index.js +95 -0
- package/cjs/index.js.map +1 -0
- package/cjs/layout/index.d.ts +1 -0
- package/cjs/layout/index.js +15 -0
- package/cjs/layout/index.js.map +1 -0
- package/cjs/layout/pivot-header-layout.d.ts +155 -0
- package/cjs/layout/pivot-header-layout.js +897 -0
- package/cjs/layout/pivot-header-layout.js.map +1 -0
- package/cjs/layout/pivot-layout.d.ts +86 -0
- package/cjs/layout/pivot-layout.js +422 -0
- package/cjs/layout/pivot-layout.js.map +1 -0
- package/cjs/layout/simple-header-layout.d.ts +67 -0
- package/cjs/layout/simple-header-layout.js +413 -0
- package/cjs/layout/simple-header-layout.js.map +1 -0
- package/cjs/menu/dom/BaseMenu.d.ts +15 -0
- package/cjs/menu/dom/BaseMenu.js +30 -0
- package/cjs/menu/dom/BaseMenu.js.map +1 -0
- package/cjs/menu/dom/Menu.d.ts +9 -0
- package/cjs/menu/dom/Menu.js +24 -0
- package/cjs/menu/dom/Menu.js.map +1 -0
- package/cjs/menu/dom/MenuHandler.d.ts +20 -0
- package/cjs/menu/dom/MenuHandler.js +134 -0
- package/cjs/menu/dom/MenuHandler.js.map +1 -0
- package/cjs/menu/dom/logic/MenuContainer.d.ts +22 -0
- package/cjs/menu/dom/logic/MenuContainer.js +110 -0
- package/cjs/menu/dom/logic/MenuContainer.js.map +1 -0
- package/cjs/menu/dom/logic/MenuElement.css +86 -0
- package/cjs/menu/dom/logic/MenuElement.d.ts +27 -0
- package/cjs/menu/dom/logic/MenuElement.js +278 -0
- package/cjs/menu/dom/logic/MenuElement.js.map +1 -0
- package/cjs/plugins/chartTypes.d.ts +3 -0
- package/cjs/plugins/chartTypes.js +6 -0
- package/cjs/plugins/chartTypes.js.map +1 -0
- package/cjs/plugins/icons.d.ts +12 -0
- package/cjs/plugins/icons.js +26 -0
- package/cjs/plugins/icons.js.map +1 -0
- package/cjs/plugins/themes.d.ts +4 -0
- package/cjs/plugins/themes.js +6 -0
- package/cjs/plugins/themes.js.map +1 -0
- package/cjs/register.d.ts +5 -0
- package/cjs/register.js +35 -0
- package/cjs/register.js.map +1 -0
- package/cjs/render/layout/arc.d.ts +23 -0
- package/cjs/render/layout/arc.js +20 -0
- package/cjs/render/layout/arc.js.map +1 -0
- package/cjs/render/layout/circle.d.ts +19 -0
- package/cjs/render/layout/circle.js +19 -0
- package/cjs/render/layout/circle.js.map +1 -0
- package/cjs/render/layout/container.d.ts +52 -0
- package/cjs/render/layout/container.js +99 -0
- package/cjs/render/layout/container.js.map +1 -0
- package/cjs/render/layout/direction.d.ts +22 -0
- package/cjs/render/layout/direction.js +35 -0
- package/cjs/render/layout/direction.js.map +1 -0
- package/cjs/render/layout/element.d.ts +47 -0
- package/cjs/render/layout/element.js +27 -0
- package/cjs/render/layout/element.js.map +1 -0
- package/cjs/render/layout/group-element.d.ts +25 -0
- package/cjs/render/layout/group-element.js +52 -0
- package/cjs/render/layout/group-element.js.map +1 -0
- package/cjs/render/layout/icon.d.ts +21 -0
- package/cjs/render/layout/icon.js +48 -0
- package/cjs/render/layout/icon.js.map +1 -0
- package/cjs/render/layout/image.d.ts +21 -0
- package/cjs/render/layout/image.js +20 -0
- package/cjs/render/layout/image.js.map +1 -0
- package/cjs/render/layout/index.d.ts +9 -0
- package/cjs/render/layout/index.js +25 -0
- package/cjs/render/layout/index.js.map +1 -0
- package/cjs/render/layout/line.d.ts +32 -0
- package/cjs/render/layout/line.js +88 -0
- package/cjs/render/layout/line.js.map +1 -0
- package/cjs/render/layout/percent-calc.d.ts +8 -0
- package/cjs/render/layout/percent-calc.js +13 -0
- package/cjs/render/layout/percent-calc.js.map +1 -0
- package/cjs/render/layout/rect.d.ts +22 -0
- package/cjs/render/layout/rect.js +19 -0
- package/cjs/render/layout/rect.js.map +1 -0
- package/cjs/render/layout/text.d.ts +22 -0
- package/cjs/render/layout/text.js +26 -0
- package/cjs/render/layout/text.js.map +1 -0
- package/cjs/scenegraph/component/cell-content.d.ts +36 -0
- package/cjs/scenegraph/component/cell-content.js +100 -0
- package/cjs/scenegraph/component/cell-content.js.map +1 -0
- package/cjs/scenegraph/component/cell-mover.d.ts +15 -0
- package/cjs/scenegraph/component/cell-mover.js +107 -0
- package/cjs/scenegraph/component/cell-mover.js.map +1 -0
- package/cjs/scenegraph/component/custom.d.ts +7 -0
- package/cjs/scenegraph/component/custom.js +212 -0
- package/cjs/scenegraph/component/custom.js.map +1 -0
- package/cjs/scenegraph/component/drill-icon.d.ts +9 -0
- package/cjs/scenegraph/component/drill-icon.js +70 -0
- package/cjs/scenegraph/component/drill-icon.js.map +1 -0
- package/cjs/scenegraph/component/menu.d.ts +41 -0
- package/cjs/scenegraph/component/menu.js +214 -0
- package/cjs/scenegraph/component/menu.js.map +1 -0
- package/cjs/scenegraph/component/table-component.d.ts +37 -0
- package/cjs/scenegraph/component/table-component.js +302 -0
- package/cjs/scenegraph/component/table-component.js.map +1 -0
- package/cjs/scenegraph/component/util.d.ts +2 -0
- package/cjs/scenegraph/component/util.js +11 -0
- package/cjs/scenegraph/component/util.js.map +1 -0
- package/cjs/scenegraph/debug-tool/debug-tool.d.ts +36 -0
- package/cjs/scenegraph/debug-tool/debug-tool.js +138 -0
- package/cjs/scenegraph/debug-tool/debug-tool.js.map +1 -0
- package/cjs/scenegraph/debug-tool/index.d.ts +4 -0
- package/cjs/scenegraph/debug-tool/index.js +14 -0
- package/cjs/scenegraph/debug-tool/index.js.map +1 -0
- package/cjs/scenegraph/graphic/chart.d.ts +30 -0
- package/cjs/scenegraph/graphic/chart.js +66 -0
- package/cjs/scenegraph/graphic/chart.js.map +1 -0
- package/cjs/scenegraph/graphic/contributions/chart-render.d.ts +10 -0
- package/cjs/scenegraph/graphic/contributions/chart-render.js +46 -0
- package/cjs/scenegraph/graphic/contributions/chart-render.js.map +1 -0
- package/cjs/scenegraph/graphic/contributions/group-contribution-render.d.ts +70 -0
- package/cjs/scenegraph/graphic/contributions/group-contribution-render.js +195 -0
- package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -0
- package/cjs/scenegraph/graphic/contributions/image-contribution-render.d.ts +20 -0
- package/cjs/scenegraph/graphic/contributions/image-contribution-render.js +46 -0
- package/cjs/scenegraph/graphic/contributions/image-contribution-render.js.map +1 -0
- package/cjs/scenegraph/graphic/contributions/index.d.ts +3 -0
- package/cjs/scenegraph/graphic/contributions/index.js +36 -0
- package/cjs/scenegraph/graphic/contributions/index.js.map +1 -0
- package/cjs/scenegraph/graphic/contributions/rect-contribution-render.d.ts +17 -0
- package/cjs/scenegraph/graphic/contributions/rect-contribution-render.js +47 -0
- package/cjs/scenegraph/graphic/contributions/rect-contribution-render.js.map +1 -0
- package/cjs/scenegraph/graphic/group.d.ts +23 -0
- package/cjs/scenegraph/graphic/group.js +94 -0
- package/cjs/scenegraph/graphic/group.js.map +1 -0
- package/cjs/scenegraph/graphic/icon.d.ts +24 -0
- package/cjs/scenegraph/graphic/icon.js +25 -0
- package/cjs/scenegraph/graphic/icon.js.map +1 -0
- package/cjs/scenegraph/graphic/text.d.ts +16 -0
- package/cjs/scenegraph/graphic/text.js +146 -0
- package/cjs/scenegraph/graphic/text.js.map +1 -0
- package/cjs/scenegraph/group-creater/cell-helper.d.ts +7 -0
- package/cjs/scenegraph/group-creater/cell-helper.js +84 -0
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -0
- package/cjs/scenegraph/group-creater/cell-type/chart-cell.d.ts +3 -0
- package/cjs/scenegraph/group-creater/cell-type/chart-cell.js +78 -0
- package/cjs/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -0
- package/cjs/scenegraph/group-creater/cell-type/image-cell.d.ts +7 -0
- package/cjs/scenegraph/group-creater/cell-type/image-cell.js +123 -0
- package/cjs/scenegraph/group-creater/cell-type/image-cell.js.map +1 -0
- package/cjs/scenegraph/group-creater/cell-type/progress-bar-cell.d.ts +9 -0
- package/cjs/scenegraph/group-creater/cell-type/progress-bar-cell.js +342 -0
- package/cjs/scenegraph/group-creater/cell-type/progress-bar-cell.js.map +1 -0
- package/cjs/scenegraph/group-creater/cell-type/spark-line-cell.d.ts +3 -0
- package/cjs/scenegraph/group-creater/cell-type/spark-line-cell.js +163 -0
- package/cjs/scenegraph/group-creater/cell-type/spark-line-cell.js.map +1 -0
- package/cjs/scenegraph/group-creater/cell-type/text-cell.d.ts +5 -0
- package/cjs/scenegraph/group-creater/cell-type/text-cell.js +64 -0
- package/cjs/scenegraph/group-creater/cell-type/text-cell.js.map +1 -0
- package/cjs/scenegraph/group-creater/cell-type/video-cell.d.ts +4 -0
- package/cjs/scenegraph/group-creater/cell-type/video-cell.js +100 -0
- package/cjs/scenegraph/group-creater/cell-type/video-cell.js.map +1 -0
- package/cjs/scenegraph/group-creater/column-helper.d.ts +24 -0
- package/cjs/scenegraph/group-creater/column-helper.js +136 -0
- package/cjs/scenegraph/group-creater/column-helper.js.map +1 -0
- package/cjs/scenegraph/group-creater/column.d.ts +14 -0
- package/cjs/scenegraph/group-creater/column.js +57 -0
- package/cjs/scenegraph/group-creater/column.js.map +1 -0
- package/cjs/scenegraph/group-creater/progress/proxy.d.ts +45 -0
- package/cjs/scenegraph/group-creater/progress/proxy.js +267 -0
- package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -0
- package/cjs/scenegraph/header-icon/layout.d.ts +3 -0
- package/cjs/scenegraph/header-icon/layout.js +75 -0
- package/cjs/scenegraph/header-icon/layout.js.map +1 -0
- package/cjs/scenegraph/hover-state.d.ts +14 -0
- package/cjs/scenegraph/hover-state.js +27 -0
- package/cjs/scenegraph/hover-state.js.map +1 -0
- package/cjs/scenegraph/layout/auto-height.d.ts +2 -0
- package/cjs/scenegraph/layout/auto-height.js +50 -0
- package/cjs/scenegraph/layout/auto-height.js.map +1 -0
- package/cjs/scenegraph/layout/auto-width.d.ts +2 -0
- package/cjs/scenegraph/layout/auto-width.js +85 -0
- package/cjs/scenegraph/layout/auto-width.js.map +1 -0
- package/cjs/scenegraph/layout/compute-col-width.d.ts +3 -0
- package/cjs/scenegraph/layout/compute-col-width.js +194 -0
- package/cjs/scenegraph/layout/compute-col-width.js.map +1 -0
- package/cjs/scenegraph/layout/move-cell.d.ts +2 -0
- package/cjs/scenegraph/layout/move-cell.js +61 -0
- package/cjs/scenegraph/layout/move-cell.js.map +1 -0
- package/cjs/scenegraph/layout/update-cell.d.ts +3 -0
- package/cjs/scenegraph/layout/update-cell.js +55 -0
- package/cjs/scenegraph/layout/update-cell.js.map +1 -0
- package/cjs/scenegraph/layout/update-height.d.ts +6 -0
- package/cjs/scenegraph/layout/update-height.js +90 -0
- package/cjs/scenegraph/layout/update-height.js.map +1 -0
- package/cjs/scenegraph/layout/update-width.d.ts +2 -0
- package/cjs/scenegraph/layout/update-width.js +103 -0
- package/cjs/scenegraph/layout/update-width.js.map +1 -0
- package/cjs/scenegraph/scenegraph.d.ts +109 -0
- package/cjs/scenegraph/scenegraph.js +798 -0
- package/cjs/scenegraph/scenegraph.js.map +1 -0
- package/cjs/scenegraph/style/frame-border.d.ts +3 -0
- package/cjs/scenegraph/style/frame-border.js +43 -0
- package/cjs/scenegraph/style/frame-border.js.map +1 -0
- package/cjs/scenegraph/utils/border-line.d.ts +8 -0
- package/cjs/scenegraph/utils/border-line.js +51 -0
- package/cjs/scenegraph/utils/border-line.js.map +1 -0
- package/cjs/scenegraph/utils/break-string.d.ts +1 -0
- package/cjs/scenegraph/utils/break-string.js +37 -0
- package/cjs/scenegraph/utils/break-string.js.map +1 -0
- package/cjs/scenegraph/utils/cell-pos.d.ts +4 -0
- package/cjs/scenegraph/utils/cell-pos.js +18 -0
- package/cjs/scenegraph/utils/cell-pos.js.map +1 -0
- package/cjs/scenegraph/utils/font.d.ts +1 -0
- package/cjs/scenegraph/utils/font.js +20 -0
- package/cjs/scenegraph/utils/font.js.map +1 -0
- package/cjs/scenegraph/utils/get-cell-merge.d.ts +3 -0
- package/cjs/scenegraph/utils/get-cell-merge.js +11 -0
- package/cjs/scenegraph/utils/get-cell-merge.js.map +1 -0
- package/cjs/scenegraph/utils/get-prop.d.ts +4 -0
- package/cjs/scenegraph/utils/get-prop.js +44 -0
- package/cjs/scenegraph/utils/get-prop.js.map +1 -0
- package/cjs/scenegraph/utils/icon.d.ts +12 -0
- package/cjs/scenegraph/utils/icon.js +35 -0
- package/cjs/scenegraph/utils/icon.js.map +1 -0
- package/cjs/scenegraph/utils/keep-aspect-ratio.d.ts +4 -0
- package/cjs/scenegraph/utils/keep-aspect-ratio.js +16 -0
- package/cjs/scenegraph/utils/keep-aspect-ratio.js.map +1 -0
- package/cjs/scenegraph/utils/measure-text.d.ts +20 -0
- package/cjs/scenegraph/utils/measure-text.js +111 -0
- package/cjs/scenegraph/utils/measure-text.js.map +1 -0
- package/cjs/scenegraph/utils/padding.d.ts +1 -0
- package/cjs/scenegraph/utils/padding.js +16 -0
- package/cjs/scenegraph/utils/padding.js.map +1 -0
- package/cjs/scenegraph/utils/text-icon-layout.d.ts +9 -0
- package/cjs/scenegraph/utils/text-icon-layout.js +237 -0
- package/cjs/scenegraph/utils/text-icon-layout.js.map +1 -0
- package/cjs/scenegraph/utils/text-pos.d.ts +8 -0
- package/cjs/scenegraph/utils/text-pos.js +27 -0
- package/cjs/scenegraph/utils/text-pos.js.map +1 -0
- package/cjs/state/cell-move/adjust-header.d.ts +3 -0
- package/cjs/state/cell-move/adjust-header.js +20 -0
- package/cjs/state/cell-move/adjust-header.js.map +1 -0
- package/cjs/state/cell-move/index.d.ts +4 -0
- package/cjs/state/cell-move/index.js +60 -0
- package/cjs/state/cell-move/index.js.map +1 -0
- package/cjs/state/common/check-in-select.d.ts +8 -0
- package/cjs/state/common/check-in-select.js +63 -0
- package/cjs/state/common/check-in-select.js.map +1 -0
- package/cjs/state/drill/index.d.ts +2 -0
- package/cjs/state/drill/index.js +15 -0
- package/cjs/state/drill/index.js.map +1 -0
- package/cjs/state/hover/col.d.ts +5 -0
- package/cjs/state/hover/col.js +24 -0
- package/cjs/state/hover/col.js.map +1 -0
- package/cjs/state/hover/is-cell-hover.d.ts +5 -0
- package/cjs/state/hover/is-cell-hover.js +36 -0
- package/cjs/state/hover/is-cell-hover.js.map +1 -0
- package/cjs/state/hover/row.d.ts +5 -0
- package/cjs/state/hover/row.js +22 -0
- package/cjs/state/hover/row.js.map +1 -0
- package/cjs/state/hover/single.d.ts +5 -0
- package/cjs/state/hover/single.js +18 -0
- package/cjs/state/hover/single.js.map +1 -0
- package/cjs/state/hover/update-cell.d.ts +2 -0
- package/cjs/state/hover/update-cell.js +13 -0
- package/cjs/state/hover/update-cell.js.map +1 -0
- package/cjs/state/hover/update-position.d.ts +2 -0
- package/cjs/state/hover/update-position.js +44 -0
- package/cjs/state/hover/update-position.js.map +1 -0
- package/cjs/state/pin/index.d.ts +2 -0
- package/cjs/state/pin/index.js +10 -0
- package/cjs/state/pin/index.js.map +1 -0
- package/cjs/state/select/update-position.d.ts +4 -0
- package/cjs/state/select/update-position.js +111 -0
- package/cjs/state/select/update-position.js.map +1 -0
- package/cjs/state/sort/index.d.ts +2 -0
- package/cjs/state/sort/index.js +41 -0
- package/cjs/state/sort/index.js.map +1 -0
- package/cjs/state/spark-line/index.d.ts +3 -0
- package/cjs/state/spark-line/index.js +98 -0
- package/cjs/state/spark-line/index.js.map +1 -0
- package/cjs/state/state.d.ts +155 -0
- package/cjs/state/state.js +431 -0
- package/cjs/state/state.js.map +1 -0
- package/cjs/themes/ARCO.d.ts +3 -0
- package/cjs/themes/ARCO.js +114 -0
- package/cjs/themes/ARCO.js.map +1 -0
- package/cjs/themes/BRIGHT.d.ts +3 -0
- package/cjs/themes/BRIGHT.js +71 -0
- package/cjs/themes/BRIGHT.js.map +1 -0
- package/cjs/themes/DARK.d.ts +3 -0
- package/cjs/themes/DARK.js +90 -0
- package/cjs/themes/DARK.js.map +1 -0
- package/cjs/themes/DEFAULT.d.ts +3 -0
- package/cjs/themes/DEFAULT.js +89 -0
- package/cjs/themes/DEFAULT.js.map +1 -0
- package/cjs/themes/SIMPLIFY.d.ts +3 -0
- package/cjs/themes/SIMPLIFY.js +46 -0
- package/cjs/themes/SIMPLIFY.js.map +1 -0
- package/cjs/themes/theme.d.ts +34 -0
- package/cjs/themes/theme.js +520 -0
- package/cjs/themes/theme.js.map +1 -0
- package/cjs/themes.d.ts +28 -0
- package/cjs/themes.js +52 -0
- package/cjs/themes.js.map +1 -0
- package/cjs/tools/LimitPromiseQueue.d.ts +8 -0
- package/cjs/tools/LimitPromiseQueue.js +29 -0
- package/cjs/tools/LimitPromiseQueue.js.map +1 -0
- package/cjs/tools/NumberMap.d.ts +16 -0
- package/cjs/tools/NumberMap.js +76 -0
- package/cjs/tools/NumberMap.js.map +1 -0
- package/cjs/tools/Rect.d.ts +24 -0
- package/cjs/tools/Rect.js +69 -0
- package/cjs/tools/Rect.js.map +1 -0
- package/cjs/tools/calc.d.ts +5 -0
- package/cjs/tools/calc.js +197 -0
- package/cjs/tools/calc.js.map +1 -0
- package/cjs/tools/debounce.d.ts +1 -0
- package/cjs/tools/debounce.js +51 -0
- package/cjs/tools/debounce.js.map +1 -0
- package/cjs/tools/dom.d.ts +1 -0
- package/cjs/tools/dom.js +11 -0
- package/cjs/tools/dom.js.map +1 -0
- package/cjs/tools/env.d.ts +19 -0
- package/cjs/tools/env.js +48 -0
- package/cjs/tools/env.js.map +1 -0
- package/cjs/tools/global.d.ts +13 -0
- package/cjs/tools/global.js +12 -0
- package/cjs/tools/global.js.map +1 -0
- package/cjs/tools/helper.d.ts +60 -0
- package/cjs/tools/helper.js +216 -0
- package/cjs/tools/helper.js.map +1 -0
- package/cjs/tools/icons.d.ts +4 -0
- package/cjs/tools/icons.js +10 -0
- package/cjs/tools/icons.js.map +1 -0
- package/cjs/tools/isx.d.ts +16 -0
- package/cjs/tools/isx.js +117 -0
- package/cjs/tools/isx.js.map +1 -0
- package/cjs/tools/sort.d.ts +1 -0
- package/cjs/tools/sort.js +18 -0
- package/cjs/tools/sort.js.map +1 -0
- package/cjs/tools/style.css +60 -0
- package/cjs/tools/style.d.ts +2 -0
- package/cjs/tools/style.js +11 -0
- package/cjs/tools/style.js.map +1 -0
- package/cjs/tools/text-width.d.ts +1 -0
- package/cjs/tools/text-width.js +17 -0
- package/cjs/tools/text-width.js.map +1 -0
- package/cjs/tools/util.d.ts +45 -0
- package/cjs/tools/util.js +299 -0
- package/cjs/tools/util.js.map +1 -0
- package/cjs/tooltip/BaseTooltip.d.ts +22 -0
- package/cjs/tooltip/BaseTooltip.js +35 -0
- package/cjs/tooltip/BaseTooltip.js.map +1 -0
- package/cjs/tooltip/Tooltip.d.ts +5 -0
- package/cjs/tooltip/Tooltip.js +16 -0
- package/cjs/tooltip/Tooltip.js.map +1 -0
- package/cjs/tooltip/TooltipHandler.d.ts +27 -0
- package/cjs/tooltip/TooltipHandler.js +129 -0
- package/cjs/tooltip/TooltipHandler.js.map +1 -0
- package/cjs/tooltip/logic/BubbleTooltipElement.css +63 -0
- package/cjs/tooltip/logic/BubbleTooltipElement.d.ts +33 -0
- package/cjs/tooltip/logic/BubbleTooltipElement.js +152 -0
- package/cjs/tooltip/logic/BubbleTooltipElement.js.map +1 -0
- package/cjs/ts-types/base-table.d.ts +313 -0
- package/cjs/ts-types/base-table.js +6 -0
- package/cjs/ts-types/base-table.js.map +1 -0
- package/cjs/ts-types/chartType.d.ts +53 -0
- package/cjs/ts-types/chartType.js +6 -0
- package/cjs/ts-types/chartType.js.map +1 -0
- package/cjs/ts-types/column/index.d.ts +2 -0
- package/cjs/ts-types/column/index.js +21 -0
- package/cjs/ts-types/column/index.js.map +1 -0
- package/cjs/ts-types/column/style.d.ts +78 -0
- package/cjs/ts-types/column/style.js +6 -0
- package/cjs/ts-types/column/style.js.map +1 -0
- package/cjs/ts-types/column/type.d.ts +2 -0
- package/cjs/ts-types/column/type.js +6 -0
- package/cjs/ts-types/column/type.js.map +1 -0
- package/cjs/ts-types/common.d.ts +72 -0
- package/cjs/ts-types/common.js +6 -0
- package/cjs/ts-types/common.js.map +1 -0
- package/cjs/ts-types/customElement.d.ts +111 -0
- package/cjs/ts-types/customElement.js +6 -0
- package/cjs/ts-types/customElement.js.map +1 -0
- package/cjs/ts-types/customLayout.d.ts +8 -0
- package/cjs/ts-types/customLayout.js +6 -0
- package/cjs/ts-types/customLayout.js.map +1 -0
- package/cjs/ts-types/events.d.ts +182 -0
- package/cjs/ts-types/events.js +6 -0
- package/cjs/ts-types/events.js.map +1 -0
- package/cjs/ts-types/icon.d.ts +86 -0
- package/cjs/ts-types/icon.js +26 -0
- package/cjs/ts-types/icon.js.map +1 -0
- package/cjs/ts-types/index.d.ts +15 -0
- package/cjs/ts-types/index.js +28 -0
- package/cjs/ts-types/index.js.map +1 -0
- package/cjs/ts-types/list-table/define/basic-define.d.ts +36 -0
- package/cjs/ts-types/list-table/define/basic-define.js +6 -0
- package/cjs/ts-types/list-table/define/basic-define.js.map +1 -0
- package/cjs/ts-types/list-table/define/chart-define.d.ts +10 -0
- package/cjs/ts-types/list-table/define/chart-define.js +6 -0
- package/cjs/ts-types/list-table/define/chart-define.js.map +1 -0
- package/cjs/ts-types/list-table/define/image-define.d.ts +15 -0
- package/cjs/ts-types/list-table/define/image-define.js +6 -0
- package/cjs/ts-types/list-table/define/image-define.js.map +1 -0
- package/cjs/ts-types/list-table/define/index.d.ts +21 -0
- package/cjs/ts-types/list-table/define/index.js +6 -0
- package/cjs/ts-types/list-table/define/index.js.map +1 -0
- package/cjs/ts-types/list-table/define/link-define.d.ts +17 -0
- package/cjs/ts-types/list-table/define/link-define.js +6 -0
- package/cjs/ts-types/list-table/define/link-define.js.map +1 -0
- package/cjs/ts-types/list-table/define/multilinetext-define.d.ts +12 -0
- package/cjs/ts-types/list-table/define/multilinetext-define.js +6 -0
- package/cjs/ts-types/list-table/define/multilinetext-define.js.map +1 -0
- package/cjs/ts-types/list-table/define/progressbar-define.d.ts +11 -0
- package/cjs/ts-types/list-table/define/progressbar-define.js +6 -0
- package/cjs/ts-types/list-table/define/progressbar-define.js.map +1 -0
- package/cjs/ts-types/list-table/define/sparkline-define.d.ts +10 -0
- package/cjs/ts-types/list-table/define/sparkline-define.js +6 -0
- package/cjs/ts-types/list-table/define/sparkline-define.js.map +1 -0
- package/cjs/ts-types/list-table/index.d.ts +2 -0
- package/cjs/ts-types/list-table/index.js +21 -0
- package/cjs/ts-types/list-table/index.js.map +1 -0
- package/cjs/ts-types/list-table/layout-map/api.d.ts +92 -0
- package/cjs/ts-types/list-table/layout-map/api.js +6 -0
- package/cjs/ts-types/list-table/layout-map/api.js.map +1 -0
- package/cjs/ts-types/list-table/layout-map/index.d.ts +1 -0
- package/cjs/ts-types/list-table/layout-map/index.js +6 -0
- package/cjs/ts-types/list-table/layout-map/index.js.map +1 -0
- package/cjs/ts-types/menu.d.ts +73 -0
- package/cjs/ts-types/menu.js +6 -0
- package/cjs/ts-types/menu.js.map +1 -0
- package/cjs/ts-types/new-data-set.d.ts +95 -0
- package/cjs/ts-types/new-data-set.js +14 -0
- package/cjs/ts-types/new-data-set.js.map +1 -0
- package/cjs/ts-types/pivot-table/PIVOT_TABLE_EVENT_TYPE.d.ts +6 -0
- package/cjs/ts-types/pivot-table/PIVOT_TABLE_EVENT_TYPE.js +13 -0
- package/cjs/ts-types/pivot-table/PIVOT_TABLE_EVENT_TYPE.js.map +1 -0
- package/cjs/ts-types/pivot-table/corner.d.ts +19 -0
- package/cjs/ts-types/pivot-table/corner.js +6 -0
- package/cjs/ts-types/pivot-table/corner.js.map +1 -0
- package/cjs/ts-types/pivot-table/dimension/basic-dimension.d.ts +25 -0
- package/cjs/ts-types/pivot-table/dimension/basic-dimension.js +6 -0
- package/cjs/ts-types/pivot-table/dimension/basic-dimension.js.map +1 -0
- package/cjs/ts-types/pivot-table/dimension/image-dimension.d.ts +9 -0
- package/cjs/ts-types/pivot-table/dimension/image-dimension.js +6 -0
- package/cjs/ts-types/pivot-table/dimension/image-dimension.js.map +1 -0
- package/cjs/ts-types/pivot-table/dimension/index.d.ts +4 -0
- package/cjs/ts-types/pivot-table/dimension/index.js +6 -0
- package/cjs/ts-types/pivot-table/dimension/index.js.map +1 -0
- package/cjs/ts-types/pivot-table/dimension/link-dimension.d.ts +10 -0
- package/cjs/ts-types/pivot-table/dimension/link-dimension.js +6 -0
- package/cjs/ts-types/pivot-table/dimension/link-dimension.js.map +1 -0
- package/cjs/ts-types/pivot-table/dimension/multilinetext-dimension.d.ts +7 -0
- package/cjs/ts-types/pivot-table/dimension/multilinetext-dimension.js +6 -0
- package/cjs/ts-types/pivot-table/dimension/multilinetext-dimension.js.map +1 -0
- package/cjs/ts-types/pivot-table/index.d.ts +4 -0
- package/cjs/ts-types/pivot-table/index.js +22 -0
- package/cjs/ts-types/pivot-table/index.js.map +1 -0
- package/cjs/ts-types/pivot-table/indicator/basic-indicator.d.ts +26 -0
- package/cjs/ts-types/pivot-table/indicator/basic-indicator.js +6 -0
- package/cjs/ts-types/pivot-table/indicator/basic-indicator.js.map +1 -0
- package/cjs/ts-types/pivot-table/indicator/chart-indicator.d.ts +10 -0
- package/cjs/ts-types/pivot-table/indicator/chart-indicator.js +6 -0
- package/cjs/ts-types/pivot-table/indicator/chart-indicator.js.map +1 -0
- package/cjs/ts-types/pivot-table/indicator/image-indicator.d.ts +15 -0
- package/cjs/ts-types/pivot-table/indicator/image-indicator.js +6 -0
- package/cjs/ts-types/pivot-table/indicator/image-indicator.js.map +1 -0
- package/cjs/ts-types/pivot-table/indicator/index.d.ts +10 -0
- package/cjs/ts-types/pivot-table/indicator/index.js +6 -0
- package/cjs/ts-types/pivot-table/indicator/index.js.map +1 -0
- package/cjs/ts-types/pivot-table/indicator/link-indicator.d.ts +17 -0
- package/cjs/ts-types/pivot-table/indicator/link-indicator.js +6 -0
- package/cjs/ts-types/pivot-table/indicator/link-indicator.js.map +1 -0
- package/cjs/ts-types/pivot-table/indicator/multilinetext-indicator.d.ts +11 -0
- package/cjs/ts-types/pivot-table/indicator/multilinetext-indicator.js +6 -0
- package/cjs/ts-types/pivot-table/indicator/multilinetext-indicator.js.map +1 -0
- package/cjs/ts-types/pivot-table/indicator/progress-indicator.d.ts +11 -0
- package/cjs/ts-types/pivot-table/indicator/progress-indicator.js +6 -0
- package/cjs/ts-types/pivot-table/indicator/progress-indicator.js.map +1 -0
- package/cjs/ts-types/pivot-table/indicator/sparkline-indicator.d.ts +10 -0
- package/cjs/ts-types/pivot-table/indicator/sparkline-indicator.js +6 -0
- package/cjs/ts-types/pivot-table/indicator/sparkline-indicator.js.map +1 -0
- package/cjs/ts-types/pivot-table/title.d.ts +18 -0
- package/cjs/ts-types/pivot-table/title.js +6 -0
- package/cjs/ts-types/pivot-table/title.js.map +1 -0
- package/cjs/ts-types/style-define.d.ts +60 -0
- package/cjs/ts-types/style-define.js +6 -0
- package/cjs/ts-types/style-define.js.map +1 -0
- package/cjs/ts-types/table-engine.d.ts +169 -0
- package/cjs/ts-types/table-engine.js +12 -0
- package/cjs/ts-types/table-engine.js.map +1 -0
- package/cjs/ts-types/theme.d.ts +88 -0
- package/cjs/ts-types/theme.js +6 -0
- package/cjs/ts-types/theme.js.map +1 -0
- package/cjs/ts-types/tooltip.d.ts +22 -0
- package/cjs/ts-types/tooltip.js +6 -0
- package/cjs/ts-types/tooltip.js.map +1 -0
- package/dist/vtable.js +72964 -0
- package/dist/vtable.min.js +17 -0
- package/es/ListTable.d.ts +38 -0
- package/es/ListTable.js +256 -0
- package/es/ListTable.js.map +1 -0
- package/es/PivotTable.d.ts +50 -0
- package/es/PivotTable.js +282 -0
- package/es/PivotTable.js.map +1 -0
- package/es/body-helper/body-helper.d.ts +14 -0
- package/es/body-helper/body-helper.js +80 -0
- package/es/body-helper/body-helper.js.map +1 -0
- package/es/body-helper/style/ImageStyle.d.ts +7 -0
- package/es/body-helper/style/ImageStyle.js +16 -0
- package/es/body-helper/style/ImageStyle.js.map +1 -0
- package/es/body-helper/style/MultilineTextStyle.d.ts +13 -0
- package/es/body-helper/style/MultilineTextStyle.js +30 -0
- package/es/body-helper/style/MultilineTextStyle.js.map +1 -0
- package/es/body-helper/style/NumberStyle.d.ts +7 -0
- package/es/body-helper/style/NumberStyle.js +16 -0
- package/es/body-helper/style/NumberStyle.js.map +1 -0
- package/es/body-helper/style/ProgressBarStyle.d.ts +52 -0
- package/es/body-helper/style/ProgressBarStyle.js +118 -0
- package/es/body-helper/style/ProgressBarStyle.js.map +1 -0
- package/es/body-helper/style/Style.d.ts +85 -0
- package/es/body-helper/style/Style.js +194 -0
- package/es/body-helper/style/Style.js.map +1 -0
- package/es/body-helper/style.d.ts +10 -0
- package/es/body-helper/style.js +20 -0
- package/es/body-helper/style.js.map +1 -0
- package/es/chartType.d.ts +3 -0
- package/es/chartType.js +10 -0
- package/es/chartType.js.map +1 -0
- package/es/core/BaseTable.d.ts +287 -0
- package/es/core/BaseTable.js +1281 -0
- package/es/core/BaseTable.js.map +1 -0
- package/es/core/FouseInput.d.ts +11 -0
- package/es/core/FouseInput.js +30 -0
- package/es/core/FouseInput.js.map +1 -0
- package/es/core/TABLE_EVENT_TYPE.d.ts +30 -0
- package/es/core/TABLE_EVENT_TYPE.js +30 -0
- package/es/core/TABLE_EVENT_TYPE.js.map +1 -0
- package/es/core/tableHelper.d.ts +28 -0
- package/es/core/tableHelper.js +107 -0
- package/es/core/tableHelper.js.map +1 -0
- package/es/core.d.ts +3 -0
- package/es/core.js +6 -0
- package/es/core.js.map +1 -0
- package/es/data/CachedDataSource.d.ts +16 -0
- package/es/data/CachedDataSource.js +48 -0
- package/es/data/CachedDataSource.js.map +1 -0
- package/es/data/DataSource.d.ts +64 -0
- package/es/data/DataSource.js +267 -0
- package/es/data/DataSource.js.map +1 -0
- package/es/data/FilterDataSource.d.ts +1 -0
- package/es/data/FilterDataSource.js +1 -0
- package/es/data/FilterDataSource.js.map +1 -0
- package/es/data.d.ts +4 -0
- package/es/data.js +6 -0
- package/es/data.js.map +1 -0
- package/es/dataset/DataStatistics.d.ts +10 -0
- package/es/dataset/DataStatistics.js +74 -0
- package/es/dataset/DataStatistics.js.map +1 -0
- package/es/dataset/dataset.d.ts +72 -0
- package/es/dataset/dataset.js +482 -0
- package/es/dataset/dataset.js.map +1 -0
- package/es/dataset/flatDataToObject.d.ts +31 -0
- package/es/dataset/flatDataToObject.js +63 -0
- package/es/dataset/flatDataToObject.js.map +1 -0
- package/es/event/EventHandler.d.ts +45 -0
- package/es/event/EventHandler.js +111 -0
- package/es/event/EventHandler.js.map +1 -0
- package/es/event/EventTarget.d.ts +11 -0
- package/es/event/EventTarget.js +50 -0
- package/es/event/EventTarget.js.map +1 -0
- package/es/event/chart.d.ts +2 -0
- package/es/event/chart.js +16 -0
- package/es/event/chart.js.map +1 -0
- package/es/event/drill.d.ts +3 -0
- package/es/event/drill.js +17 -0
- package/es/event/drill.js.map +1 -0
- package/es/event/event.d.ts +35 -0
- package/es/event/event.js +438 -0
- package/es/event/event.js.map +1 -0
- package/es/event/media-click.d.ts +2 -0
- package/es/event/media-click.js +54 -0
- package/es/event/media-click.js.map +1 -0
- package/es/event/scroll.d.ts +2 -0
- package/es/event/scroll.js +17 -0
- package/es/event/scroll.js.map +1 -0
- package/es/header-helper/header-helper.d.ts +26 -0
- package/es/header-helper/header-helper.js +189 -0
- package/es/header-helper/header-helper.js.map +1 -0
- package/es/header-helper/style/ImageStyle.d.ts +7 -0
- package/es/header-helper/style/ImageStyle.js +17 -0
- package/es/header-helper/style/ImageStyle.js.map +1 -0
- package/es/header-helper/style/MultilineTextHeaderStyle.d.ts +13 -0
- package/es/header-helper/style/MultilineTextHeaderStyle.js +30 -0
- package/es/header-helper/style/MultilineTextHeaderStyle.js.map +1 -0
- package/es/header-helper/style/SortHeaderStyle.d.ts +1 -0
- package/es/header-helper/style/SortHeaderStyle.js +3 -0
- package/es/header-helper/style/SortHeaderStyle.js.map +1 -0
- package/es/header-helper/style/Style.d.ts +88 -0
- package/es/header-helper/style/Style.js +202 -0
- package/es/header-helper/style/Style.js.map +1 -0
- package/es/header-helper/style.d.ts +5 -0
- package/es/header-helper/style.js +14 -0
- package/es/header-helper/style.js.map +1 -0
- package/es/icons.d.ts +4 -0
- package/es/icons.js +241 -0
- package/es/icons.js.map +1 -0
- package/es/index.d.ts +17 -0
- package/es/index.js +34 -0
- package/es/index.js.map +1 -0
- package/es/layout/index.d.ts +1 -0
- package/es/layout/index.js +2 -0
- package/es/layout/index.js.map +1 -0
- package/es/layout/pivot-header-layout.d.ts +155 -0
- package/es/layout/pivot-header-layout.js +888 -0
- package/es/layout/pivot-header-layout.js.map +1 -0
- package/es/layout/pivot-layout.d.ts +86 -0
- package/es/layout/pivot-layout.js +416 -0
- package/es/layout/pivot-layout.js.map +1 -0
- package/es/layout/simple-header-layout.d.ts +67 -0
- package/es/layout/simple-header-layout.js +405 -0
- package/es/layout/simple-header-layout.js.map +1 -0
- package/es/menu/dom/BaseMenu.d.ts +15 -0
- package/es/menu/dom/BaseMenu.js +22 -0
- package/es/menu/dom/BaseMenu.js.map +1 -0
- package/es/menu/dom/Menu.d.ts +9 -0
- package/es/menu/dom/Menu.js +18 -0
- package/es/menu/dom/Menu.js.map +1 -0
- package/es/menu/dom/MenuHandler.d.ts +20 -0
- package/es/menu/dom/MenuHandler.js +132 -0
- package/es/menu/dom/MenuHandler.js.map +1 -0
- package/es/menu/dom/logic/MenuContainer.d.ts +22 -0
- package/es/menu/dom/logic/MenuContainer.js +105 -0
- package/es/menu/dom/logic/MenuContainer.js.map +1 -0
- package/es/menu/dom/logic/MenuElement.css +86 -0
- package/es/menu/dom/logic/MenuElement.d.ts +27 -0
- package/es/menu/dom/logic/MenuElement.js +277 -0
- package/es/menu/dom/logic/MenuElement.js.map +1 -0
- package/es/plugins/chartTypes.d.ts +3 -0
- package/es/plugins/chartTypes.js +2 -0
- package/es/plugins/chartTypes.js.map +1 -0
- package/es/plugins/icons.d.ts +12 -0
- package/es/plugins/icons.js +22 -0
- package/es/plugins/icons.js.map +1 -0
- package/es/plugins/themes.d.ts +4 -0
- package/es/plugins/themes.js +2 -0
- package/es/plugins/themes.js.map +1 -0
- package/es/register.d.ts +5 -0
- package/es/register.js +31 -0
- package/es/register.js.map +1 -0
- package/es/render/layout/arc.d.ts +23 -0
- package/es/render/layout/arc.js +12 -0
- package/es/render/layout/arc.js.map +1 -0
- package/es/render/layout/circle.d.ts +19 -0
- package/es/render/layout/circle.js +11 -0
- package/es/render/layout/circle.js.map +1 -0
- package/es/render/layout/container.d.ts +52 -0
- package/es/render/layout/container.js +99 -0
- package/es/render/layout/container.js.map +1 -0
- package/es/render/layout/direction.d.ts +22 -0
- package/es/render/layout/direction.js +31 -0
- package/es/render/layout/direction.js.map +1 -0
- package/es/render/layout/element.d.ts +47 -0
- package/es/render/layout/element.js +19 -0
- package/es/render/layout/element.js.map +1 -0
- package/es/render/layout/group-element.d.ts +25 -0
- package/es/render/layout/group-element.js +46 -0
- package/es/render/layout/group-element.js.map +1 -0
- package/es/render/layout/icon.d.ts +21 -0
- package/es/render/layout/icon.js +19 -0
- package/es/render/layout/icon.js.map +1 -0
- package/es/render/layout/image.d.ts +21 -0
- package/es/render/layout/image.js +12 -0
- package/es/render/layout/image.js.map +1 -0
- package/es/render/layout/index.d.ts +9 -0
- package/es/render/layout/index.js +18 -0
- package/es/render/layout/index.js.map +1 -0
- package/es/render/layout/line.d.ts +32 -0
- package/es/render/layout/line.js +80 -0
- package/es/render/layout/line.js.map +1 -0
- package/es/render/layout/percent-calc.d.ts +8 -0
- package/es/render/layout/percent-calc.js +7 -0
- package/es/render/layout/percent-calc.js.map +1 -0
- package/es/render/layout/rect.d.ts +22 -0
- package/es/render/layout/rect.js +11 -0
- package/es/render/layout/rect.js.map +1 -0
- package/es/render/layout/text.d.ts +22 -0
- package/es/render/layout/text.js +18 -0
- package/es/render/layout/text.js.map +1 -0
- package/es/scenegraph/component/cell-content.d.ts +36 -0
- package/es/scenegraph/component/cell-content.js +98 -0
- package/es/scenegraph/component/cell-content.js.map +1 -0
- package/es/scenegraph/component/cell-mover.d.ts +15 -0
- package/es/scenegraph/component/cell-mover.js +101 -0
- package/es/scenegraph/component/cell-mover.js.map +1 -0
- package/es/scenegraph/component/custom.d.ts +7 -0
- package/es/scenegraph/component/custom.js +211 -0
- package/es/scenegraph/component/custom.js.map +1 -0
- package/es/scenegraph/component/drill-icon.d.ts +9 -0
- package/es/scenegraph/component/drill-icon.js +41 -0
- package/es/scenegraph/component/drill-icon.js.map +1 -0
- package/es/scenegraph/component/menu.d.ts +41 -0
- package/es/scenegraph/component/menu.js +212 -0
- package/es/scenegraph/component/menu.js.map +1 -0
- package/es/scenegraph/component/table-component.d.ts +37 -0
- package/es/scenegraph/component/table-component.js +304 -0
- package/es/scenegraph/component/table-component.js.map +1 -0
- package/es/scenegraph/component/util.d.ts +2 -0
- package/es/scenegraph/component/util.js +5 -0
- package/es/scenegraph/component/util.js.map +1 -0
- package/es/scenegraph/debug-tool/debug-tool.d.ts +36 -0
- package/es/scenegraph/debug-tool/debug-tool.js +126 -0
- package/es/scenegraph/debug-tool/debug-tool.js.map +1 -0
- package/es/scenegraph/debug-tool/index.d.ts +4 -0
- package/es/scenegraph/debug-tool/index.js +6 -0
- package/es/scenegraph/debug-tool/index.js.map +1 -0
- package/es/scenegraph/graphic/chart.d.ts +30 -0
- package/es/scenegraph/graphic/chart.js +59 -0
- package/es/scenegraph/graphic/chart.js.map +1 -0
- package/es/scenegraph/graphic/contributions/chart-render.d.ts +10 -0
- package/es/scenegraph/graphic/contributions/chart-render.js +47 -0
- package/es/scenegraph/graphic/contributions/chart-render.js.map +1 -0
- package/es/scenegraph/graphic/contributions/group-contribution-render.d.ts +70 -0
- package/es/scenegraph/graphic/contributions/group-contribution-render.js +192 -0
- package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -0
- package/es/scenegraph/graphic/contributions/image-contribution-render.d.ts +20 -0
- package/es/scenegraph/graphic/contributions/image-contribution-render.js +42 -0
- package/es/scenegraph/graphic/contributions/image-contribution-render.js.map +1 -0
- package/es/scenegraph/graphic/contributions/index.d.ts +3 -0
- package/es/scenegraph/graphic/contributions/index.js +29 -0
- package/es/scenegraph/graphic/contributions/index.js.map +1 -0
- package/es/scenegraph/graphic/contributions/rect-contribution-render.d.ts +17 -0
- package/es/scenegraph/graphic/contributions/rect-contribution-render.js +45 -0
- package/es/scenegraph/graphic/contributions/rect-contribution-render.js.map +1 -0
- package/es/scenegraph/graphic/group.d.ts +23 -0
- package/es/scenegraph/graphic/group.js +86 -0
- package/es/scenegraph/graphic/group.js.map +1 -0
- package/es/scenegraph/graphic/icon.d.ts +24 -0
- package/es/scenegraph/graphic/icon.js +17 -0
- package/es/scenegraph/graphic/icon.js.map +1 -0
- package/es/scenegraph/graphic/text.d.ts +16 -0
- package/es/scenegraph/graphic/text.js +142 -0
- package/es/scenegraph/graphic/text.js.map +1 -0
- package/es/scenegraph/group-creater/cell-helper.d.ts +7 -0
- package/es/scenegraph/group-creater/cell-helper.js +93 -0
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -0
- package/es/scenegraph/group-creater/cell-type/chart-cell.d.ts +3 -0
- package/es/scenegraph/group-creater/cell-type/chart-cell.js +54 -0
- package/es/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -0
- package/es/scenegraph/group-creater/cell-type/image-cell.d.ts +7 -0
- package/es/scenegraph/group-creater/cell-type/image-cell.js +102 -0
- package/es/scenegraph/group-creater/cell-type/image-cell.js.map +1 -0
- package/es/scenegraph/group-creater/cell-type/progress-bar-cell.d.ts +9 -0
- package/es/scenegraph/group-creater/cell-type/progress-bar-cell.js +337 -0
- package/es/scenegraph/group-creater/cell-type/progress-bar-cell.js.map +1 -0
- package/es/scenegraph/group-creater/cell-type/spark-line-cell.d.ts +3 -0
- package/es/scenegraph/group-creater/cell-type/spark-line-cell.js +165 -0
- package/es/scenegraph/group-creater/cell-type/spark-line-cell.js.map +1 -0
- package/es/scenegraph/group-creater/cell-type/text-cell.d.ts +5 -0
- package/es/scenegraph/group-creater/cell-type/text-cell.js +66 -0
- package/es/scenegraph/group-creater/cell-type/text-cell.js.map +1 -0
- package/es/scenegraph/group-creater/cell-type/video-cell.d.ts +4 -0
- package/es/scenegraph/group-creater/cell-type/video-cell.js +86 -0
- package/es/scenegraph/group-creater/cell-type/video-cell.js.map +1 -0
- package/es/scenegraph/group-creater/column-helper.d.ts +24 -0
- package/es/scenegraph/group-creater/column-helper.js +135 -0
- package/es/scenegraph/group-creater/column-helper.js.map +1 -0
- package/es/scenegraph/group-creater/column.d.ts +14 -0
- package/es/scenegraph/group-creater/column.js +49 -0
- package/es/scenegraph/group-creater/column.js.map +1 -0
- package/es/scenegraph/group-creater/progress/proxy.d.ts +45 -0
- package/es/scenegraph/group-creater/progress/proxy.js +268 -0
- package/es/scenegraph/group-creater/progress/proxy.js.map +1 -0
- package/es/scenegraph/header-icon/layout.d.ts +3 -0
- package/es/scenegraph/header-icon/layout.js +69 -0
- package/es/scenegraph/header-icon/layout.js.map +1 -0
- package/es/scenegraph/hover-state.d.ts +14 -0
- package/es/scenegraph/hover-state.js +19 -0
- package/es/scenegraph/hover-state.js.map +1 -0
- package/es/scenegraph/layout/auto-height.d.ts +2 -0
- package/es/scenegraph/layout/auto-height.js +44 -0
- package/es/scenegraph/layout/auto-height.js.map +1 -0
- package/es/scenegraph/layout/auto-width.d.ts +2 -0
- package/es/scenegraph/layout/auto-width.js +82 -0
- package/es/scenegraph/layout/auto-width.js.map +1 -0
- package/es/scenegraph/layout/compute-col-width.d.ts +3 -0
- package/es/scenegraph/layout/compute-col-width.js +167 -0
- package/es/scenegraph/layout/compute-col-width.js.map +1 -0
- package/es/scenegraph/layout/move-cell.d.ts +2 -0
- package/es/scenegraph/layout/move-cell.js +55 -0
- package/es/scenegraph/layout/move-cell.js.map +1 -0
- package/es/scenegraph/layout/update-cell.d.ts +3 -0
- package/es/scenegraph/layout/update-cell.js +55 -0
- package/es/scenegraph/layout/update-cell.js.map +1 -0
- package/es/scenegraph/layout/update-height.d.ts +6 -0
- package/es/scenegraph/layout/update-height.js +91 -0
- package/es/scenegraph/layout/update-height.js.map +1 -0
- package/es/scenegraph/layout/update-width.d.ts +2 -0
- package/es/scenegraph/layout/update-width.js +105 -0
- package/es/scenegraph/layout/update-width.js.map +1 -0
- package/es/scenegraph/scenegraph.d.ts +109 -0
- package/es/scenegraph/scenegraph.js +818 -0
- package/es/scenegraph/scenegraph.js.map +1 -0
- package/es/scenegraph/style/frame-border.d.ts +3 -0
- package/es/scenegraph/style/frame-border.js +35 -0
- package/es/scenegraph/style/frame-border.js.map +1 -0
- package/es/scenegraph/utils/border-line.d.ts +8 -0
- package/es/scenegraph/utils/border-line.js +45 -0
- package/es/scenegraph/utils/border-line.js.map +1 -0
- package/es/scenegraph/utils/break-string.d.ts +1 -0
- package/es/scenegraph/utils/break-string.js +31 -0
- package/es/scenegraph/utils/break-string.js.map +1 -0
- package/es/scenegraph/utils/cell-pos.d.ts +4 -0
- package/es/scenegraph/utils/cell-pos.js +12 -0
- package/es/scenegraph/utils/cell-pos.js.map +1 -0
- package/es/scenegraph/utils/font.d.ts +1 -0
- package/es/scenegraph/utils/font.js +6 -0
- package/es/scenegraph/utils/font.js.map +1 -0
- package/es/scenegraph/utils/get-cell-merge.d.ts +3 -0
- package/es/scenegraph/utils/get-cell-merge.js +5 -0
- package/es/scenegraph/utils/get-cell-merge.js.map +1 -0
- package/es/scenegraph/utils/get-prop.d.ts +4 -0
- package/es/scenegraph/utils/get-prop.js +36 -0
- package/es/scenegraph/utils/get-prop.js.map +1 -0
- package/es/scenegraph/utils/icon.d.ts +12 -0
- package/es/scenegraph/utils/icon.js +29 -0
- package/es/scenegraph/utils/icon.js.map +1 -0
- package/es/scenegraph/utils/keep-aspect-ratio.d.ts +4 -0
- package/es/scenegraph/utils/keep-aspect-ratio.js +10 -0
- package/es/scenegraph/utils/keep-aspect-ratio.js.map +1 -0
- package/es/scenegraph/utils/measure-text.d.ts +20 -0
- package/es/scenegraph/utils/measure-text.js +114 -0
- package/es/scenegraph/utils/measure-text.js.map +1 -0
- package/es/scenegraph/utils/padding.d.ts +1 -0
- package/es/scenegraph/utils/padding.js +8 -0
- package/es/scenegraph/utils/padding.js.map +1 -0
- package/es/scenegraph/utils/text-icon-layout.d.ts +9 -0
- package/es/scenegraph/utils/text-icon-layout.js +239 -0
- package/es/scenegraph/utils/text-icon-layout.js.map +1 -0
- package/es/scenegraph/utils/text-pos.d.ts +8 -0
- package/es/scenegraph/utils/text-pos.js +20 -0
- package/es/scenegraph/utils/text-pos.js.map +1 -0
- package/es/state/cell-move/adjust-header.d.ts +3 -0
- package/es/state/cell-move/adjust-header.js +14 -0
- package/es/state/cell-move/adjust-header.js.map +1 -0
- package/es/state/cell-move/index.d.ts +4 -0
- package/es/state/cell-move/index.js +52 -0
- package/es/state/cell-move/index.js.map +1 -0
- package/es/state/common/check-in-select.d.ts +8 -0
- package/es/state/common/check-in-select.js +53 -0
- package/es/state/common/check-in-select.js.map +1 -0
- package/es/state/drill/index.d.ts +2 -0
- package/es/state/drill/index.js +9 -0
- package/es/state/drill/index.js.map +1 -0
- package/es/state/hover/col.d.ts +5 -0
- package/es/state/hover/col.js +16 -0
- package/es/state/hover/col.js.map +1 -0
- package/es/state/hover/is-cell-hover.d.ts +5 -0
- package/es/state/hover/is-cell-hover.js +30 -0
- package/es/state/hover/is-cell-hover.js.map +1 -0
- package/es/state/hover/row.d.ts +5 -0
- package/es/state/hover/row.js +14 -0
- package/es/state/hover/row.js.map +1 -0
- package/es/state/hover/single.d.ts +5 -0
- package/es/state/hover/single.js +10 -0
- package/es/state/hover/single.js.map +1 -0
- package/es/state/hover/update-cell.d.ts +2 -0
- package/es/state/hover/update-cell.js +7 -0
- package/es/state/hover/update-cell.js.map +1 -0
- package/es/state/hover/update-position.d.ts +2 -0
- package/es/state/hover/update-position.js +36 -0
- package/es/state/hover/update-position.js.map +1 -0
- package/es/state/pin/index.d.ts +2 -0
- package/es/state/pin/index.js +4 -0
- package/es/state/pin/index.js.map +1 -0
- package/es/state/select/update-position.d.ts +4 -0
- package/es/state/select/update-position.js +103 -0
- package/es/state/select/update-position.js.map +1 -0
- package/es/state/sort/index.d.ts +2 -0
- package/es/state/sort/index.js +35 -0
- package/es/state/sort/index.js.map +1 -0
- package/es/state/spark-line/index.d.ts +3 -0
- package/es/state/spark-line/index.js +92 -0
- package/es/state/spark-line/index.js.map +1 -0
- package/es/state/state.d.ts +155 -0
- package/es/state/state.js +458 -0
- package/es/state/state.js.map +1 -0
- package/es/themes/ARCO.d.ts +3 -0
- package/es/themes/ARCO.js +110 -0
- package/es/themes/ARCO.js.map +1 -0
- package/es/themes/BRIGHT.d.ts +3 -0
- package/es/themes/BRIGHT.js +67 -0
- package/es/themes/BRIGHT.js.map +1 -0
- package/es/themes/DARK.d.ts +3 -0
- package/es/themes/DARK.js +86 -0
- package/es/themes/DARK.js.map +1 -0
- package/es/themes/DEFAULT.d.ts +3 -0
- package/es/themes/DEFAULT.js +85 -0
- package/es/themes/DEFAULT.js.map +1 -0
- package/es/themes/SIMPLIFY.d.ts +3 -0
- package/es/themes/SIMPLIFY.js +42 -0
- package/es/themes/SIMPLIFY.js.map +1 -0
- package/es/themes/theme.d.ts +34 -0
- package/es/themes/theme.js +505 -0
- package/es/themes/theme.js.map +1 -0
- package/es/themes.d.ts +28 -0
- package/es/themes.js +62 -0
- package/es/themes.js.map +1 -0
- package/es/tools/LimitPromiseQueue.d.ts +8 -0
- package/es/tools/LimitPromiseQueue.js +21 -0
- package/es/tools/LimitPromiseQueue.js.map +1 -0
- package/es/tools/NumberMap.d.ts +16 -0
- package/es/tools/NumberMap.js +70 -0
- package/es/tools/NumberMap.js.map +1 -0
- package/es/tools/Rect.d.ts +24 -0
- package/es/tools/Rect.js +61 -0
- package/es/tools/Rect.js.map +1 -0
- package/es/tools/calc.d.ts +5 -0
- package/es/tools/calc.js +191 -0
- package/es/tools/calc.js.map +1 -0
- package/es/tools/debounce.d.ts +1 -0
- package/es/tools/debounce.js +43 -0
- package/es/tools/debounce.js.map +1 -0
- package/es/tools/dom.d.ts +1 -0
- package/es/tools/dom.js +5 -0
- package/es/tools/dom.js.map +1 -0
- package/es/tools/env.d.ts +19 -0
- package/es/tools/env.js +42 -0
- package/es/tools/env.js.map +1 -0
- package/es/tools/global.d.ts +13 -0
- package/es/tools/global.js +26 -0
- package/es/tools/global.js.map +1 -0
- package/es/tools/helper.d.ts +60 -0
- package/es/tools/helper.js +216 -0
- package/es/tools/helper.js.map +1 -0
- package/es/tools/icons.d.ts +4 -0
- package/es/tools/icons.js +4 -0
- package/es/tools/icons.js.map +1 -0
- package/es/tools/isx.d.ts +16 -0
- package/es/tools/isx.js +79 -0
- package/es/tools/isx.js.map +1 -0
- package/es/tools/sort.d.ts +1 -0
- package/es/tools/sort.js +12 -0
- package/es/tools/sort.js.map +1 -0
- package/es/tools/style.css +60 -0
- package/es/tools/style.d.ts +2 -0
- package/es/tools/style.js +5 -0
- package/es/tools/style.js.map +1 -0
- package/es/tools/text-width.d.ts +1 -0
- package/es/tools/text-width.js +9 -0
- package/es/tools/text-width.js.map +1 -0
- package/es/tools/util.d.ts +45 -0
- package/es/tools/util.js +250 -0
- package/es/tools/util.js.map +1 -0
- package/es/tooltip/BaseTooltip.d.ts +22 -0
- package/es/tooltip/BaseTooltip.js +27 -0
- package/es/tooltip/BaseTooltip.js.map +1 -0
- package/es/tooltip/Tooltip.d.ts +5 -0
- package/es/tooltip/Tooltip.js +10 -0
- package/es/tooltip/Tooltip.js.map +1 -0
- package/es/tooltip/TooltipHandler.d.ts +27 -0
- package/es/tooltip/TooltipHandler.js +131 -0
- package/es/tooltip/TooltipHandler.js.map +1 -0
- package/es/tooltip/logic/BubbleTooltipElement.css +63 -0
- package/es/tooltip/logic/BubbleTooltipElement.d.ts +33 -0
- package/es/tooltip/logic/BubbleTooltipElement.js +149 -0
- package/es/tooltip/logic/BubbleTooltipElement.js.map +1 -0
- package/es/ts-types/base-table.d.ts +313 -0
- package/es/ts-types/base-table.js +2 -0
- package/es/ts-types/base-table.js.map +1 -0
- package/es/ts-types/chartType.d.ts +53 -0
- package/es/ts-types/chartType.js +2 -0
- package/es/ts-types/chartType.js.map +1 -0
- package/es/ts-types/column/index.d.ts +2 -0
- package/es/ts-types/column/index.js +4 -0
- package/es/ts-types/column/index.js.map +1 -0
- package/es/ts-types/column/style.d.ts +78 -0
- package/es/ts-types/column/style.js +2 -0
- package/es/ts-types/column/style.js.map +1 -0
- package/es/ts-types/column/type.d.ts +2 -0
- package/es/ts-types/column/type.js +2 -0
- package/es/ts-types/column/type.js.map +1 -0
- package/es/ts-types/common.d.ts +72 -0
- package/es/ts-types/common.js +2 -0
- package/es/ts-types/common.js.map +1 -0
- package/es/ts-types/customElement.d.ts +111 -0
- package/es/ts-types/customElement.js +2 -0
- package/es/ts-types/customElement.js.map +1 -0
- package/es/ts-types/customLayout.d.ts +8 -0
- package/es/ts-types/customLayout.js +2 -0
- package/es/ts-types/customLayout.js.map +1 -0
- package/es/ts-types/events.d.ts +182 -0
- package/es/ts-types/events.js +2 -0
- package/es/ts-types/events.js.map +1 -0
- package/es/ts-types/icon.d.ts +86 -0
- package/es/ts-types/icon.js +28 -0
- package/es/ts-types/icon.js.map +1 -0
- package/es/ts-types/index.d.ts +15 -0
- package/es/ts-types/index.js +30 -0
- package/es/ts-types/index.js.map +1 -0
- package/es/ts-types/list-table/define/basic-define.d.ts +36 -0
- package/es/ts-types/list-table/define/basic-define.js +2 -0
- package/es/ts-types/list-table/define/basic-define.js.map +1 -0
- package/es/ts-types/list-table/define/chart-define.d.ts +10 -0
- package/es/ts-types/list-table/define/chart-define.js +2 -0
- package/es/ts-types/list-table/define/chart-define.js.map +1 -0
- package/es/ts-types/list-table/define/image-define.d.ts +15 -0
- package/es/ts-types/list-table/define/image-define.js +2 -0
- package/es/ts-types/list-table/define/image-define.js.map +1 -0
- package/es/ts-types/list-table/define/index.d.ts +21 -0
- package/es/ts-types/list-table/define/index.js +2 -0
- package/es/ts-types/list-table/define/index.js.map +1 -0
- package/es/ts-types/list-table/define/link-define.d.ts +17 -0
- package/es/ts-types/list-table/define/link-define.js +2 -0
- package/es/ts-types/list-table/define/link-define.js.map +1 -0
- package/es/ts-types/list-table/define/multilinetext-define.d.ts +12 -0
- package/es/ts-types/list-table/define/multilinetext-define.js +2 -0
- package/es/ts-types/list-table/define/multilinetext-define.js.map +1 -0
- package/es/ts-types/list-table/define/progressbar-define.d.ts +11 -0
- package/es/ts-types/list-table/define/progressbar-define.js +2 -0
- package/es/ts-types/list-table/define/progressbar-define.js.map +1 -0
- package/es/ts-types/list-table/define/sparkline-define.d.ts +10 -0
- package/es/ts-types/list-table/define/sparkline-define.js +2 -0
- package/es/ts-types/list-table/define/sparkline-define.js.map +1 -0
- package/es/ts-types/list-table/index.d.ts +2 -0
- package/es/ts-types/list-table/index.js +4 -0
- package/es/ts-types/list-table/index.js.map +1 -0
- package/es/ts-types/list-table/layout-map/api.d.ts +92 -0
- package/es/ts-types/list-table/layout-map/api.js +2 -0
- package/es/ts-types/list-table/layout-map/api.js.map +1 -0
- package/es/ts-types/list-table/layout-map/index.d.ts +1 -0
- package/es/ts-types/list-table/layout-map/index.js +2 -0
- package/es/ts-types/list-table/layout-map/index.js.map +1 -0
- package/es/ts-types/menu.d.ts +73 -0
- package/es/ts-types/menu.js +2 -0
- package/es/ts-types/menu.js.map +1 -0
- package/es/ts-types/new-data-set.d.ts +95 -0
- package/es/ts-types/new-data-set.js +13 -0
- package/es/ts-types/new-data-set.js.map +1 -0
- package/es/ts-types/pivot-table/PIVOT_TABLE_EVENT_TYPE.d.ts +6 -0
- package/es/ts-types/pivot-table/PIVOT_TABLE_EVENT_TYPE.js +9 -0
- package/es/ts-types/pivot-table/PIVOT_TABLE_EVENT_TYPE.js.map +1 -0
- package/es/ts-types/pivot-table/corner.d.ts +19 -0
- package/es/ts-types/pivot-table/corner.js +2 -0
- package/es/ts-types/pivot-table/corner.js.map +1 -0
- package/es/ts-types/pivot-table/dimension/basic-dimension.d.ts +25 -0
- package/es/ts-types/pivot-table/dimension/basic-dimension.js +2 -0
- package/es/ts-types/pivot-table/dimension/basic-dimension.js.map +1 -0
- package/es/ts-types/pivot-table/dimension/image-dimension.d.ts +9 -0
- package/es/ts-types/pivot-table/dimension/image-dimension.js +2 -0
- package/es/ts-types/pivot-table/dimension/image-dimension.js.map +1 -0
- package/es/ts-types/pivot-table/dimension/index.d.ts +4 -0
- package/es/ts-types/pivot-table/dimension/index.js +2 -0
- package/es/ts-types/pivot-table/dimension/index.js.map +1 -0
- package/es/ts-types/pivot-table/dimension/link-dimension.d.ts +10 -0
- package/es/ts-types/pivot-table/dimension/link-dimension.js +2 -0
- package/es/ts-types/pivot-table/dimension/link-dimension.js.map +1 -0
- package/es/ts-types/pivot-table/dimension/multilinetext-dimension.d.ts +7 -0
- package/es/ts-types/pivot-table/dimension/multilinetext-dimension.js +2 -0
- package/es/ts-types/pivot-table/dimension/multilinetext-dimension.js.map +1 -0
- package/es/ts-types/pivot-table/index.d.ts +4 -0
- package/es/ts-types/pivot-table/index.js +8 -0
- package/es/ts-types/pivot-table/index.js.map +1 -0
- package/es/ts-types/pivot-table/indicator/basic-indicator.d.ts +26 -0
- package/es/ts-types/pivot-table/indicator/basic-indicator.js +2 -0
- package/es/ts-types/pivot-table/indicator/basic-indicator.js.map +1 -0
- package/es/ts-types/pivot-table/indicator/chart-indicator.d.ts +10 -0
- package/es/ts-types/pivot-table/indicator/chart-indicator.js +2 -0
- package/es/ts-types/pivot-table/indicator/chart-indicator.js.map +1 -0
- package/es/ts-types/pivot-table/indicator/image-indicator.d.ts +15 -0
- package/es/ts-types/pivot-table/indicator/image-indicator.js +2 -0
- package/es/ts-types/pivot-table/indicator/image-indicator.js.map +1 -0
- package/es/ts-types/pivot-table/indicator/index.d.ts +10 -0
- package/es/ts-types/pivot-table/indicator/index.js +2 -0
- package/es/ts-types/pivot-table/indicator/index.js.map +1 -0
- package/es/ts-types/pivot-table/indicator/link-indicator.d.ts +17 -0
- package/es/ts-types/pivot-table/indicator/link-indicator.js +2 -0
- package/es/ts-types/pivot-table/indicator/link-indicator.js.map +1 -0
- package/es/ts-types/pivot-table/indicator/multilinetext-indicator.d.ts +11 -0
- package/es/ts-types/pivot-table/indicator/multilinetext-indicator.js +2 -0
- package/es/ts-types/pivot-table/indicator/multilinetext-indicator.js.map +1 -0
- package/es/ts-types/pivot-table/indicator/progress-indicator.d.ts +11 -0
- package/es/ts-types/pivot-table/indicator/progress-indicator.js +2 -0
- package/es/ts-types/pivot-table/indicator/progress-indicator.js.map +1 -0
- package/es/ts-types/pivot-table/indicator/sparkline-indicator.d.ts +10 -0
- package/es/ts-types/pivot-table/indicator/sparkline-indicator.js +2 -0
- package/es/ts-types/pivot-table/indicator/sparkline-indicator.js.map +1 -0
- package/es/ts-types/pivot-table/title.d.ts +18 -0
- package/es/ts-types/pivot-table/title.js +2 -0
- package/es/ts-types/pivot-table/title.js.map +1 -0
- package/es/ts-types/style-define.d.ts +60 -0
- package/es/ts-types/style-define.js +2 -0
- package/es/ts-types/style-define.js.map +1 -0
- package/es/ts-types/table-engine.d.ts +169 -0
- package/es/ts-types/table-engine.js +12 -0
- package/es/ts-types/table-engine.js.map +1 -0
- package/es/ts-types/theme.d.ts +88 -0
- package/es/ts-types/theme.js +2 -0
- package/es/ts-types/theme.js.map +1 -0
- package/es/ts-types/tooltip.d.ts +22 -0
- package/es/ts-types/tooltip.js +2 -0
- package/es/ts-types/tooltip.js.map +1 -0
- package/package.json +95 -0
package/es/themes.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { extend, getIgnoreCase } from "./tools/helper";
|
|
2
|
+
|
|
3
|
+
import darkTheme from "./themes/DARK";
|
|
4
|
+
|
|
5
|
+
import brightTheme from "./themes/BRIGHT";
|
|
6
|
+
|
|
7
|
+
import arcoTheme from "./themes/ARCO";
|
|
8
|
+
|
|
9
|
+
import defaultTheme from "./themes/DEFAULT";
|
|
10
|
+
|
|
11
|
+
import materialDesignTheme from "./themes/SIMPLIFY";
|
|
12
|
+
|
|
13
|
+
import { themes as plugins } from "./plugins/themes";
|
|
14
|
+
|
|
15
|
+
import { TableTheme } from "./themes/theme";
|
|
16
|
+
|
|
17
|
+
export const DARK = new TableTheme(darkTheme, darkTheme);
|
|
18
|
+
|
|
19
|
+
export const BRIGHT = new TableTheme(brightTheme, brightTheme);
|
|
20
|
+
|
|
21
|
+
export const ARCO = new TableTheme(arcoTheme, arcoTheme);
|
|
22
|
+
|
|
23
|
+
export const DEFAULT = new TableTheme(defaultTheme, defaultTheme);
|
|
24
|
+
|
|
25
|
+
export const SIMPLIFY = new TableTheme(materialDesignTheme, materialDesignTheme);
|
|
26
|
+
|
|
27
|
+
const builtin = {
|
|
28
|
+
DEFAULT: DEFAULT,
|
|
29
|
+
SIMPLIFY: SIMPLIFY,
|
|
30
|
+
ARCO: ARCO,
|
|
31
|
+
DARK: DARK,
|
|
32
|
+
BRIGHT: BRIGHT
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const theme = {
|
|
36
|
+
TableTheme: TableTheme
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export function of(value) {
|
|
40
|
+
if (!value) return null;
|
|
41
|
+
if ("string" == typeof value) {
|
|
42
|
+
const t = getIgnoreCase(get(), value);
|
|
43
|
+
return t ? t instanceof TableTheme ? t : new TableTheme(t, t) : null;
|
|
44
|
+
}
|
|
45
|
+
return value instanceof TableTheme ? value : new TableTheme(value, value);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function get() {
|
|
49
|
+
return extend(builtin, plugins);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export default {
|
|
53
|
+
DARK: DARK,
|
|
54
|
+
BRIGHT: BRIGHT,
|
|
55
|
+
ARCO: ARCO,
|
|
56
|
+
DEFAULT: DEFAULT,
|
|
57
|
+
SIMPLIFY: SIMPLIFY,
|
|
58
|
+
theme: theme,
|
|
59
|
+
of: of,
|
|
60
|
+
get: get
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=themes.js.map
|
package/es/themes.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["themes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,SAAS,MAAM,eAAe,CAAC;AACtC,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,SAAS,MAAM,eAAe,CAAC;AACtC,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,mBAAmB,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,gBA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,IAAI;IACJ,MAAM;IACN,IAAI;IACJ,OAAO;IACP,QAAQ;IACR,KAAK;IACL,EAAE;IACF,GAAG;CACJ,CAAC","file":"themes.js","sourcesContent":["/* eslint-disable sort-imports */\nimport { extend, getIgnoreCase } from './tools/helper';\nimport darkTheme from './themes/DARK';\nimport brightTheme from './themes/BRIGHT';\nimport arcoTheme from './themes/ARCO';\nimport defaultTheme from './themes/DEFAULT';\nimport materialDesignTheme from './themes/SIMPLIFY';\nimport { themes as plugins } from './plugins/themes';\nimport { TableTheme } from './themes/theme';\nimport type { ITableThemeDefine } from './ts-types';\nexport const DARK = new TableTheme(darkTheme, darkTheme);\nexport const BRIGHT = new TableTheme(brightTheme, brightTheme);\nexport const ARCO = new TableTheme(arcoTheme, arcoTheme);\nexport const DEFAULT = new TableTheme(defaultTheme, defaultTheme);\nexport const SIMPLIFY = new TableTheme(materialDesignTheme, materialDesignTheme);\n\nconst builtin: { [key: string]: TableTheme } = {\n DEFAULT,\n SIMPLIFY,\n ARCO,\n DARK,\n BRIGHT\n};\n// let defTheme = DEFAULT;\nexport const theme = { TableTheme };\nexport function of(value: ITableThemeDefine | string | undefined | null): TableTheme | null {\n if (!value) {\n return null;\n }\n if (typeof value === 'string') {\n const t = getIgnoreCase(get(), value);\n if (t) {\n if (t instanceof TableTheme) {\n return t;\n }\n return new TableTheme(t, t);\n }\n return null;\n }\n if (value instanceof TableTheme) {\n return value;\n }\n return new TableTheme(value, value);\n}\n\nexport function get(): { [key: string]: TableTheme } {\n return extend(builtin, plugins);\n}\nexport { ITableThemeDefine };\nexport default {\n DARK,\n BRIGHT,\n ARCO,\n DEFAULT,\n SIMPLIFY,\n theme,\n of,\n get\n};\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare class LimitPromiseQueue {
|
|
2
|
+
max: number;
|
|
3
|
+
_count: number;
|
|
4
|
+
_pendingTaskQueue: Function[];
|
|
5
|
+
constructor(max: number);
|
|
6
|
+
call(caller: any, ...arg: any[]): Promise<unknown>;
|
|
7
|
+
_createTask(caller: Function, arg: any[], resolve: any, reject: any): () => void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export class LimitPromiseQueue {
|
|
2
|
+
constructor(max) {
|
|
3
|
+
this.max = max, this._count = 0, this._pendingTaskQueue = [];
|
|
4
|
+
}
|
|
5
|
+
call(caller, ...arg) {
|
|
6
|
+
return new Promise(((resolve, reject) => {
|
|
7
|
+
const task = this._createTask(caller, arg, resolve, reject);
|
|
8
|
+
this._count >= this.max ? this._pendingTaskQueue.push(task) : task();
|
|
9
|
+
}));
|
|
10
|
+
}
|
|
11
|
+
_createTask(caller, arg, resolve, reject) {
|
|
12
|
+
return () => {
|
|
13
|
+
this._count++, caller(...arg).then(resolve).catch(reject).finally((() => {
|
|
14
|
+
if (console.log("finally"), this._count--, this._pendingTaskQueue.length) {
|
|
15
|
+
this._pendingTaskQueue.shift()();
|
|
16
|
+
}
|
|
17
|
+
}));
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=LimitPromiseQueue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["tools/LimitPromiseQueue.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,iBAAiB;IAI5B,YAAY,GAAW;QACrB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAChB,IAAI,CAAC,iBAAiB,GAAG,EAAE,CAAC;IAC9B,CAAC;IAOD,IAAI,CAAC,MAAW,EAAE,GAAG,GAAU;QAC7B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;YAC5D,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,GAAG,EAAE;gBAC3B,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aACnC;iBAAM;gBACL,IAAI,EAAE,CAAC;aACR;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAWD,WAAW,CAAC,MAAgB,EAAE,GAAU,EAAE,OAAY,EAAE,MAAW;QACjE,OAAO,GAAG,EAAE;YAEV,IAAI,CAAC,MAAM,EAAE,CAAC;YAEd,MAAM,CAAC,GAAG,GAAG,CAAC;iBACX,IAAI,CAAC,OAAO,CAAC;iBACb,KAAK,CAAC,MAAM,CAAC;iBACb,OAAO,CAAC,GAAG,EAAE;gBACZ,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;gBAEvB,IAAI,CAAC,MAAM,EAAE,CAAC;gBACd,IAAI,IAAI,CAAC,iBAAiB,CAAC,MAAM,EAAE;oBACjC,MAAM,IAAI,GAAG,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;oBAC5C,IAAI,EAAE,CAAC;iBACR;YACH,CAAC,CAAC,CAAC;QACP,CAAC,CAAC;IACJ,CAAC;CACF","file":"LimitPromiseQueue.js","sourcesContent":["export class LimitPromiseQueue {\n max: number;\n _count: number;\n _pendingTaskQueue: Function[];\n constructor(max: number) {\n this.max = max;\n this._count = 0;\n this._pendingTaskQueue = [];\n }\n /**\n * 调用器,将异步任务函数和它的参数传入\n * @param caller 异步任务函数,返回Promise的函数\n * @param args 异步任务函数的参数列表\n * @returns {Promise} 返回一个新的Promise\n */\n call(caller: any, ...arg: any[]) {\n return new Promise((resolve, reject) => {\n const task = this._createTask(caller, arg, resolve, reject);\n if (this._count >= this.max) {\n this._pendingTaskQueue.push(task);\n } else {\n task();\n }\n });\n }\n\n /**\n * 创建一个任务\n * @param caller 实际执行的函数\n * @param args 执行函数的参数\n * @param resolve\n * @param reject\n * @returns {Function} 返回一个任务函数\n * @private\n */\n _createTask(caller: Function, arg: any[], resolve: any, reject: any) {\n return () => {\n // 当前请求数量加一\n this._count++;\n // 实际上是在这里调用了异步任务,并将异步任务的返回(resolve和reject)抛给了上层\n caller(...arg)\n .then(resolve)\n .catch(reject)\n .finally(() => {\n console.log('finally');\n // 任务队列的消费区,利用Promise的finally方法,在异步任务结束后,取出下一个任务执行\n this._count--;\n if (this._pendingTaskQueue.length) {\n const task = this._pendingTaskQueue.shift();\n task();\n }\n });\n };\n }\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare class NumberMap<T> {
|
|
2
|
+
private _keys;
|
|
3
|
+
private _vals;
|
|
4
|
+
private _sorted;
|
|
5
|
+
count(): number;
|
|
6
|
+
values(): {
|
|
7
|
+
[key: number]: T;
|
|
8
|
+
};
|
|
9
|
+
valueArr(): T[];
|
|
10
|
+
adjustOrder(sourceIndex: number, targetIndex: number, moveCount: number): void;
|
|
11
|
+
put(key: number, value: T): void;
|
|
12
|
+
get(key: number): T | undefined;
|
|
13
|
+
has(key: number): boolean;
|
|
14
|
+
contain(value: T): boolean;
|
|
15
|
+
each(keyFrom: number, keyTo: number, fn: (t: T, k: number) => boolean | void): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { isValid } from "../tools/util";
|
|
2
|
+
|
|
3
|
+
const indexFirst = (arr, elm) => {
|
|
4
|
+
let low = 0, high = arr.length - 1;
|
|
5
|
+
for (;low <= high; ) {
|
|
6
|
+
const i = Math.floor((low + high) / 2);
|
|
7
|
+
if (arr[i] === elm) return i;
|
|
8
|
+
arr[i] > elm ? high = i - 1 : low = i + 1;
|
|
9
|
+
}
|
|
10
|
+
return high < 0 ? 0 : high;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export class NumberMap {
|
|
14
|
+
constructor() {
|
|
15
|
+
this._keys = [], this._vals = {}, this._sorted = !1;
|
|
16
|
+
}
|
|
17
|
+
count() {
|
|
18
|
+
return this._keys.length;
|
|
19
|
+
}
|
|
20
|
+
values() {
|
|
21
|
+
return this._vals;
|
|
22
|
+
}
|
|
23
|
+
valueArr() {
|
|
24
|
+
return Object.values(this._vals);
|
|
25
|
+
}
|
|
26
|
+
adjustOrder(sourceIndex, targetIndex, moveCount) {
|
|
27
|
+
const {_keys: keys} = this;
|
|
28
|
+
if (this._sorted || (keys.sort(((a, b) => a < b ? -1 : a > b ? 1 : 0)), this._sorted = !0),
|
|
29
|
+
sourceIndex > targetIndex) {
|
|
30
|
+
const sourceVals = [];
|
|
31
|
+
for (let i = indexFirst(keys, sourceIndex + moveCount - 1); i >= 0; i--) {
|
|
32
|
+
const key = keys[i];
|
|
33
|
+
if (key >= sourceIndex) sourceVals.push(this.get(key)); else if (targetIndex <= key && key < sourceIndex) this.put(key + moveCount, this.get(key)); else if (key < targetIndex) break;
|
|
34
|
+
}
|
|
35
|
+
for (let i = 0; i < moveCount; i++) this.put(targetIndex + i, sourceVals[moveCount - 1 - i]);
|
|
36
|
+
}
|
|
37
|
+
const {length: length} = keys;
|
|
38
|
+
if (sourceIndex < targetIndex) {
|
|
39
|
+
const sourceVals = [];
|
|
40
|
+
for (let i = indexFirst(keys, sourceIndex); i < length; i++) {
|
|
41
|
+
const key = keys[i];
|
|
42
|
+
if (key >= sourceIndex && key < sourceIndex + moveCount) sourceVals.push(this.get(key)); else if (sourceIndex + moveCount <= key && key <= targetIndex) this.put(key - moveCount, this.get(key)); else if (key > targetIndex) break;
|
|
43
|
+
}
|
|
44
|
+
for (let i = 0; i < moveCount; i++) this.put(targetIndex + i, sourceVals[i]);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
put(key, value) {
|
|
48
|
+
key in this._vals || (this._keys.push(key), this._sorted = !1), this._vals[key] = value;
|
|
49
|
+
}
|
|
50
|
+
get(key) {
|
|
51
|
+
return this._vals[key];
|
|
52
|
+
}
|
|
53
|
+
has(key) {
|
|
54
|
+
return isValid(this._vals[key]);
|
|
55
|
+
}
|
|
56
|
+
contain(value) {
|
|
57
|
+
return Object.values(this._vals).indexOf(value) >= 0;
|
|
58
|
+
}
|
|
59
|
+
each(keyFrom, keyTo, fn) {
|
|
60
|
+
const {_keys: keys} = this, {length: length} = keys;
|
|
61
|
+
this._sorted || (keys.sort(((a, b) => a < b ? -1 : a > b ? 1 : 0)), this._sorted = !0);
|
|
62
|
+
for (let i = indexFirst(keys, keyFrom); i < length; i++) {
|
|
63
|
+
const key = keys[i];
|
|
64
|
+
if (keyFrom <= key && key <= keyTo) {
|
|
65
|
+
if (!1 === fn(this.get(key), key)) break;
|
|
66
|
+
} else if (keyTo < key) return;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=NumberMap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["tools/NumberMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,MAAM,UAAU,GAAG,CAAC,GAAa,EAAE,GAAW,EAAU,EAAE;IACxD,IAAI,GAAG,GAAG,CAAC,CAAC;IACZ,IAAI,IAAI,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;IAC1B,OAAO,GAAG,IAAI,IAAI,EAAE;QAClB,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QACvC,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;YAClB,OAAO,CAAC,CAAC;SACV;aAAM,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,EAAE;YACvB,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;SACd;aAAM;YACL,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;SACb;KACF;IACD,OAAO,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC7B,CAAC,CAAC;AAEF,MAAM,OAAO,SAAS;IAAtB;QACU,UAAK,GAAa,EAAE,CAAC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EAAE,CAAC,EAAE,EAAE;YACvD,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YACpB,IAAI,OAAO,IAAI,GAAG,IAAI,GAAG,IAAI,KAAK,EAAE;gBAClC,MAAM,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAM,EAAE,GAAG,CAAC,CAAC;gBAC5C,IAAI,OAAO,KAAK,KAAK,EAAE;oBACrB,MAAM;iBACP;aACF;iBAAM,IAAI,KAAK,GAAG,GAAG,EAAE;gBACtB,OAAO;aACR;SACF;IACH,CAAC;CACF","file":"NumberMap.js","sourcesContent":["import { isValid } from '../tools/util';\n\nconst indexFirst = (arr: number[], elm: number): number => {\n let low = 0;\n let high = arr.length - 1;\n while (low <= high) {\n const i = Math.floor((low + high) / 2);\n if (arr[i] === elm) {\n return i;\n } else if (arr[i] > elm) {\n high = i - 1;\n } else {\n low = i + 1;\n }\n }\n return high < 0 ? 0 : high;\n};\n\nexport class NumberMap<T> {\n private _keys: number[] = [];\n private _vals: { [key: number]: T } = {};\n private _sorted = false;\n count() {\n return this._keys.length;\n }\n values() {\n return this._vals;\n }\n valueArr() {\n return Object.values(this._vals);\n }\n /**\n * 将sourceIndex位置开始 往后moveCount个值 调整到targetIndex位置处\n * @param sourceIndex\n * @param targetIndex\n * @param moveCount\n */\n adjustOrder(sourceIndex: number, targetIndex: number, moveCount: number) {\n const { _keys: keys } = this;\n if (!this._sorted) {\n keys.sort((a, b) => {\n if (a < b) {\n return -1;\n }\n if (a > b) {\n return 1;\n }\n return 0;\n });\n this._sorted = true;\n }\n if (sourceIndex > targetIndex) {\n const sourceVals = [];\n for (let i = indexFirst(keys, sourceIndex + moveCount - 1); i >= 0; i--) {\n const key = keys[i];\n if (key >= sourceIndex) {\n sourceVals.push(this.get(key));\n } else if (targetIndex <= key && key < sourceIndex) {\n this.put(key + moveCount, this.get(key));\n } else if (key < targetIndex) {\n break;\n }\n }\n for (let i = 0; i < moveCount; i++) {\n this.put(targetIndex + i, sourceVals[moveCount - 1 - i]);\n }\n }\n const { length } = keys;\n if (sourceIndex < targetIndex) {\n const sourceVals = [];\n for (let i = indexFirst(keys, sourceIndex); i < length; i++) {\n const key = keys[i];\n if (key >= sourceIndex && key < sourceIndex + moveCount) {\n sourceVals.push(this.get(key));\n } else if (sourceIndex + moveCount <= key && key <= targetIndex) {\n this.put(key - moveCount, this.get(key));\n } else if (key > targetIndex) {\n break;\n }\n }\n for (let i = 0; i < moveCount; i++) {\n this.put(targetIndex + i, sourceVals[i]);\n }\n }\n }\n put(key: number, value: T): void {\n if (!(key in this._vals)) {\n this._keys.push(key);\n this._sorted = false;\n }\n this._vals[key] = value;\n }\n get(key: number): T | undefined {\n return this._vals[key];\n }\n has(key: number): boolean {\n return isValid(this._vals[key]);\n }\n contain(value: T): boolean {\n return Object.values(this._vals).indexOf(value) >= 0;\n }\n each(keyFrom: number, keyTo: number, fn: (t: T, k: number) => boolean | void): void {\n const { _keys: keys } = this;\n const { length } = keys;\n if (!this._sorted) {\n keys.sort((a, b) => {\n if (a < b) {\n return -1;\n }\n if (a > b) {\n return 1;\n }\n return 0;\n });\n this._sorted = true;\n }\n\n for (let i = indexFirst(keys, keyFrom); i < length; i++) {\n const key = keys[i];\n if (keyFrom <= key && key <= keyTo) {\n const callRes = fn(this.get(key) as T, key);\n if (callRes === false) {\n break;\n }\n } else if (keyTo < key) {\n return;\n }\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Bounds } from '@visactor/vutils';
|
|
2
|
+
import type { RectProps } from '../ts-types';
|
|
3
|
+
export declare class Rect implements RectProps {
|
|
4
|
+
bounds: Bounds;
|
|
5
|
+
constructor(left: number, top: number, width: number, height: number);
|
|
6
|
+
static bounds(left: number, top: number, right: number, bottom: number): Rect;
|
|
7
|
+
get left(): number;
|
|
8
|
+
set left(left: number);
|
|
9
|
+
get top(): number;
|
|
10
|
+
set top(top: number);
|
|
11
|
+
get right(): number;
|
|
12
|
+
set right(right: number);
|
|
13
|
+
get bottom(): number;
|
|
14
|
+
set bottom(bottom: number);
|
|
15
|
+
get width(): number;
|
|
16
|
+
set width(width: number);
|
|
17
|
+
get height(): number;
|
|
18
|
+
set height(height: number);
|
|
19
|
+
offsetLeft(offset: number): void;
|
|
20
|
+
offsetTop(offset: number): void;
|
|
21
|
+
copy(): Rect;
|
|
22
|
+
contains(another: Rect): boolean;
|
|
23
|
+
inPoint(x: number, y: number): boolean;
|
|
24
|
+
}
|
package/es/tools/Rect.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Bounds } from "@visactor/vutils";
|
|
2
|
+
|
|
3
|
+
export class Rect {
|
|
4
|
+
constructor(left, top, width, height) {
|
|
5
|
+
this.bounds = new Bounds, this.bounds.set(left, top, left + width, top + height);
|
|
6
|
+
}
|
|
7
|
+
static bounds(left, top, right, bottom) {
|
|
8
|
+
return new Rect(left, top, Math.round(right - left), Math.round(bottom - top));
|
|
9
|
+
}
|
|
10
|
+
get left() {
|
|
11
|
+
return this.bounds.x1;
|
|
12
|
+
}
|
|
13
|
+
set left(left) {
|
|
14
|
+
this.bounds.x1 = left;
|
|
15
|
+
}
|
|
16
|
+
get top() {
|
|
17
|
+
return this.bounds.y1;
|
|
18
|
+
}
|
|
19
|
+
set top(top) {
|
|
20
|
+
this.bounds.y1 = top;
|
|
21
|
+
}
|
|
22
|
+
get right() {
|
|
23
|
+
return this.bounds.x2;
|
|
24
|
+
}
|
|
25
|
+
set right(right) {
|
|
26
|
+
this.bounds.x2 = right;
|
|
27
|
+
}
|
|
28
|
+
get bottom() {
|
|
29
|
+
return this.bounds.y2;
|
|
30
|
+
}
|
|
31
|
+
set bottom(bottom) {
|
|
32
|
+
this.bounds.y2 = bottom;
|
|
33
|
+
}
|
|
34
|
+
get width() {
|
|
35
|
+
return this.bounds.width();
|
|
36
|
+
}
|
|
37
|
+
set width(width) {
|
|
38
|
+
this.bounds.x2 = this.bounds.x1 + width;
|
|
39
|
+
}
|
|
40
|
+
get height() {
|
|
41
|
+
return this.bounds.height();
|
|
42
|
+
}
|
|
43
|
+
set height(height) {
|
|
44
|
+
this.bounds.y2 = this.bounds.y1 + height;
|
|
45
|
+
}
|
|
46
|
+
offsetLeft(offset) {
|
|
47
|
+
this.bounds.translate(offset, 0);
|
|
48
|
+
}
|
|
49
|
+
offsetTop(offset) {
|
|
50
|
+
this.bounds.translate(0, offset);
|
|
51
|
+
}
|
|
52
|
+
copy() {
|
|
53
|
+
return new Rect(this.left, this.top, this.width, this.height);
|
|
54
|
+
}
|
|
55
|
+
contains(another) {
|
|
56
|
+
return this.bounds.encloses(another.bounds);
|
|
57
|
+
}
|
|
58
|
+
inPoint(x, y) {
|
|
59
|
+
return this.bounds.contains(x, y);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["tools/Rect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAG1C,MAAM,OAAO,IAAI;IAEf,YAAY,IAAY,EAAE,GAAW,EAAE,KAAa,EAAE,MAAc;QAClE,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,GAAG,KAAK,EAAE,GAAG,GAAG,MAAM,CAAC,CAAC;IACzD,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,IAAY,EAAE,GAAW,EAAE,KAAa,EAAE,MAAc;QACpE,OAAO,IAAI,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC;IACjF,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;IACxB,CAAC;I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C,CAAC;IACnC,CAAC;IACD,IAAI;QACF,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAChE,CAAC;IACD,QAAQ,CAAC,OAAa;QACpB,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;IACD,OAAO,CAAC,CAAS,EAAE,CAAS;QAC1B,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACpC,CAAC;CACF","file":"Rect.js","sourcesContent":["import { Bounds } from '@visactor/vutils';\nimport type { RectProps } from '../ts-types';\n\nexport class Rect implements RectProps {\n bounds: Bounds;\n constructor(left: number, top: number, width: number, height: number) {\n this.bounds = new Bounds();\n this.bounds.set(left, top, left + width, top + height);\n }\n\n static bounds(left: number, top: number, right: number, bottom: number): Rect {\n return new Rect(left, top, Math.round(right - left), Math.round(bottom - top));\n }\n\n get left(): number {\n return this.bounds.x1;\n }\n set left(left: number) {\n this.bounds.x1 = left;\n }\n get top(): number {\n return this.bounds.y1;\n }\n set top(top: number) {\n this.bounds.y1 = top;\n }\n get right(): number {\n return this.bounds.x2;\n }\n set right(right: number) {\n this.bounds.x2 = right;\n }\n get bottom(): number {\n return this.bounds.y2;\n }\n set bottom(bottom: number) {\n this.bounds.y2 = bottom;\n }\n get width(): number {\n return this.bounds.width();\n }\n set width(width: number) {\n this.bounds.x2 = this.bounds.x1 + width;\n }\n get height(): number {\n return this.bounds.height();\n }\n set height(height: number) {\n this.bounds.y2 = this.bounds.y1 + height;\n }\n\n offsetLeft(offset: number): void {\n this.bounds.translate(offset, 0);\n }\n offsetTop(offset: number): void {\n this.bounds.translate(0, offset);\n }\n copy(): Rect {\n return new Rect(this.left, this.top, this.width, this.height);\n }\n contains(another: Rect): boolean {\n return this.bounds.encloses(another.bounds);\n }\n inPoint(x: number, y: number): boolean {\n return this.bounds.contains(x, y);\n }\n}\n"]}
|
package/es/tools/calc.js
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { array } from "./helper";
|
|
2
|
+
|
|
3
|
+
const TYPE_PAREN = 0, TYPE_UNIT = 1, TYPE_OPERATOR = 2, TYPE_NUMBER = 3, NODE_TYPE_UNIT = 10, NODE_TYPE_BINARY_EXPRESSION = 11, NODE_TYPE_NUMBER = 12, TABULATION = 9, CARRIAGE_RETURN = 13, LINE_FEED = 10, FORM_FEED = 12, SPACE = 32, PERCENT = 37, FULL_STOP = 46, DIGIT_0 = 48, DIGIT_9 = 57, LATIN_CAPITAL_A = 65, LATIN_CAPITAL_Z = 90, LATIN_SMALL_A = 97, LATIN_SMALL_Z = 122;
|
|
4
|
+
|
|
5
|
+
function isUpperLetter(cp) {
|
|
6
|
+
return cp >= LATIN_CAPITAL_A && cp <= LATIN_CAPITAL_Z;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function isLowerLetter(cp) {
|
|
10
|
+
return cp >= LATIN_SMALL_A && cp <= LATIN_SMALL_Z;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function isLetter(cp) {
|
|
14
|
+
return isLowerLetter(cp) || isUpperLetter(cp);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function isWhitespace(cp) {
|
|
18
|
+
return cp === TABULATION || cp === LINE_FEED || cp === FORM_FEED || cp === CARRIAGE_RETURN || cp === SPACE;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function isDigit(cp) {
|
|
22
|
+
return cp >= DIGIT_0 && cp <= DIGIT_9;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function isDot(cp) {
|
|
26
|
+
return cp === FULL_STOP;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function isUnit(cp) {
|
|
30
|
+
return isLetter(cp) || cp === PERCENT;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function createError(calc) {
|
|
34
|
+
return new Error(`calc parse error: ${calc}`);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function tokenize(calc) {
|
|
38
|
+
const exp = calc.replace(/calc\(/g, "(").trim(), tokens = [], len = exp.length;
|
|
39
|
+
for (let index = 0; index < len; index++) {
|
|
40
|
+
const c = exp[index], cp = c.charCodeAt(0);
|
|
41
|
+
if ("(" === c || ")" === c) tokens.push({
|
|
42
|
+
value: c,
|
|
43
|
+
type: TYPE_PAREN
|
|
44
|
+
}); else if ("*" === c || "/" === c) tokens.push({
|
|
45
|
+
value: c,
|
|
46
|
+
type: TYPE_OPERATOR
|
|
47
|
+
}); else if ("+" === c || "-" === c) index = parseSign(c, index + 1) - 1; else if (isDigit(cp) || isDot(cp)) index = parseNum(c, index + 1) - 1; else if (!isWhitespace(cp)) throw createError(calc);
|
|
48
|
+
}
|
|
49
|
+
function parseSign(sign, start) {
|
|
50
|
+
if (start < len) {
|
|
51
|
+
const c = exp[start], cp = c.charCodeAt(0);
|
|
52
|
+
if (isDigit(cp) || isDot(cp)) return parseNum(sign + c, start + 1);
|
|
53
|
+
}
|
|
54
|
+
return tokens.push({
|
|
55
|
+
value: sign,
|
|
56
|
+
type: TYPE_OPERATOR
|
|
57
|
+
}), start;
|
|
58
|
+
}
|
|
59
|
+
function parseNum(num, start) {
|
|
60
|
+
let index = start;
|
|
61
|
+
for (;index < len; index++) {
|
|
62
|
+
const c = exp[index], cp = c.charCodeAt(0);
|
|
63
|
+
if (isDigit(cp)) num += c; else {
|
|
64
|
+
if ("." !== c) {
|
|
65
|
+
if (isUnit(cp)) return parseUnit(num, c, index + 1);
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
if (num.indexOf(".") >= 0) throw createError(calc);
|
|
69
|
+
num += c;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if ("." === num) throw createError(calc);
|
|
73
|
+
return tokens.push({
|
|
74
|
+
value: parseFloat(num),
|
|
75
|
+
type: TYPE_NUMBER
|
|
76
|
+
}), index;
|
|
77
|
+
}
|
|
78
|
+
function parseUnit(num, unit, start) {
|
|
79
|
+
let index = start;
|
|
80
|
+
for (;index < len; index++) {
|
|
81
|
+
const c = exp[index];
|
|
82
|
+
if (!isUnit(c.charCodeAt(0))) break;
|
|
83
|
+
unit += c;
|
|
84
|
+
}
|
|
85
|
+
return tokens.push({
|
|
86
|
+
value: parseFloat(num),
|
|
87
|
+
unit: unit,
|
|
88
|
+
type: TYPE_UNIT
|
|
89
|
+
}), index;
|
|
90
|
+
}
|
|
91
|
+
return tokens;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const PRECEDENCE = {
|
|
95
|
+
"*": 3,
|
|
96
|
+
"/": 3,
|
|
97
|
+
"+": 2,
|
|
98
|
+
"-": 2
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
function lex(tokens, calc) {
|
|
102
|
+
function buildBinaryExpNode(stack) {
|
|
103
|
+
const right = stack.pop(), op = stack.pop(), left = stack.pop();
|
|
104
|
+
if (!(left && left.nodeType && op && op.type === TYPE_OPERATOR && right && right.nodeType)) throw createError(calc);
|
|
105
|
+
return {
|
|
106
|
+
nodeType: NODE_TYPE_BINARY_EXPRESSION,
|
|
107
|
+
left: left,
|
|
108
|
+
op: op,
|
|
109
|
+
right: right
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
const stack = [];
|
|
113
|
+
for (;tokens.length; ) {
|
|
114
|
+
const token = tokens.shift();
|
|
115
|
+
if (token.type === TYPE_PAREN && "(" === token.value) {
|
|
116
|
+
let deep = 0;
|
|
117
|
+
const closeIndex = array.findIndex(tokens, (t => {
|
|
118
|
+
if (t.type === TYPE_PAREN && "(" === t.value) deep++; else if (t.type === TYPE_PAREN && ")" === t.value) {
|
|
119
|
+
if (!deep) return !0;
|
|
120
|
+
deep--;
|
|
121
|
+
}
|
|
122
|
+
return !1;
|
|
123
|
+
}));
|
|
124
|
+
if (-1 === closeIndex) throw createError(calc);
|
|
125
|
+
stack.push(lex(tokens.splice(0, closeIndex), calc)), tokens.shift();
|
|
126
|
+
} else if (token.type === TYPE_OPERATOR) {
|
|
127
|
+
if (stack.length >= 3) {
|
|
128
|
+
const beforeOp = stack[stack.length - 2].value;
|
|
129
|
+
PRECEDENCE[token.value] <= PRECEDENCE[beforeOp] && stack.push(buildBinaryExpNode(stack));
|
|
130
|
+
}
|
|
131
|
+
stack.push(token);
|
|
132
|
+
} else if (token.type === TYPE_UNIT) {
|
|
133
|
+
const {value: num, unit: unit} = token;
|
|
134
|
+
stack.push({
|
|
135
|
+
nodeType: NODE_TYPE_UNIT,
|
|
136
|
+
value: num,
|
|
137
|
+
unit: unit
|
|
138
|
+
});
|
|
139
|
+
} else token.type === TYPE_NUMBER && stack.push({
|
|
140
|
+
nodeType: NODE_TYPE_NUMBER,
|
|
141
|
+
value: token.value
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
for (;stack.length > 1; ) stack.push(buildBinaryExpNode(stack));
|
|
145
|
+
return stack[0];
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function parse(calcStr) {
|
|
149
|
+
return lex(tokenize(calcStr), calcStr);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function calcNode(node, context) {
|
|
153
|
+
if (node.nodeType === NODE_TYPE_BINARY_EXPRESSION) {
|
|
154
|
+
const left = calcNode(node.left, context), right = calcNode(node.right, context);
|
|
155
|
+
switch (node.op.value) {
|
|
156
|
+
case "+":
|
|
157
|
+
return left + right;
|
|
158
|
+
|
|
159
|
+
case "-":
|
|
160
|
+
return left - right;
|
|
161
|
+
|
|
162
|
+
case "*":
|
|
163
|
+
return left * right;
|
|
164
|
+
|
|
165
|
+
case "/":
|
|
166
|
+
return left / right;
|
|
167
|
+
|
|
168
|
+
default:
|
|
169
|
+
throw new Error(`calc error. unknown operator: ${node.op.value}`);
|
|
170
|
+
}
|
|
171
|
+
} else if (node.nodeType === NODE_TYPE_UNIT) switch (node.unit) {
|
|
172
|
+
case "%":
|
|
173
|
+
return node.value * context.full / 100;
|
|
174
|
+
|
|
175
|
+
case "px":
|
|
176
|
+
return node.value;
|
|
177
|
+
|
|
178
|
+
default:
|
|
179
|
+
throw new Error(`calc error. unknown unit: ${node.unit}`);
|
|
180
|
+
} else if (node.nodeType === NODE_TYPE_NUMBER) return node.value;
|
|
181
|
+
throw new Error("calc error.");
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function toPxInternal(value, context) {
|
|
185
|
+
return calcNode(parse(value), context);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export function toPx(value, context) {
|
|
189
|
+
return "string" == typeof value ? toPxInternal(value.trim(), context) : value - 0;
|
|
190
|
+
}
|
|
191
|
+
//# sourceMappingURL=calc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["tools/calc.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,MAAM,UAAU,GAAG,CAAC,CAAC;AACrB,MAAM,SAAS,GAAG,CAAC,CAAC;AACpB,MAAM,aAAa,GAAG,CAAC,CAAC;AACxB,MAAM,WAAW,GAAG,CAAC,CAAC;AAEtB,MAAM,cAAc,GAAG,EAAE,CAAC;AAC1B,MAAM,2BAA2B,GAAG,EAAE,CAAC;AACvC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAsC5B,MAAM,UAAU,GAAG,IAAI,CAAC;AACxB,MAAM,eAAe,GAAG,IAAI,CAAC;AAC7B,MAAM,SAAS,GAAG,IAAI,CAAC;AACvB,MAAM,SAAS,GAAG,IAAI,CAAC;AACvB,MAAM,KAAK,GAAG,IAAI,CAAC;AACnB,MAAM,OAAO,GAAG,IAAI,CAAC;AACrB,MAAM,SAAS,GAAG,IAAI,CAAC;AACvB,MAAM,OAAO,GAAG,IAAI,CAAC;AACrB,MAAM,OAAO,GAAG,IAAI,CAAC;AACrB,MAAM,eAAe,GAAG,IAAI,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AAI,GAAG,KAAK,CAAC;YACtB;gBAEE,MAAM,IAAI,KAAK,CAAC,iCAAiC,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC;SACrE;KACF;SAAM,IAAI,IAAI,CAAC,QAAQ,KAAK,cAAc,EAAE;QAC3C,QAAQ,IAAI,CAAC,IAAI,EAAE;YACjB,KAAK,GAAG;gBACN,OAAO,CAAC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC;YAG3C,KAAK,IAAI;gBACP,OAAO,IAAI,CAAC,KAAK,CAAC;YACpB;gBACE,MAAM,IAAI,KAAK,CAAC,6BAA6B,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;SAC7D;KACF;SAAM,IAAI,IAAI,CAAC,QAAQ,KAAK,gBAAgB,EAAE;QAC7C,OAAO,IAAI,CAAC,KAAK,CAAC;KACnB;IACD,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC;AACjC,CAAC;AAED,SAAS,YAAY,CAAC,KAAa,EAAE,OAAoB;IACvD,MAAM,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;IACzB,OAAO,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAChC,CAAC;AAOD,MAAM,UAAU,IAAI,CAAC,KAAsB,EAAE,OAAoB;IAC/D,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC7B,OAAO,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;KAC5C;IACD,OAAO,KAAK,GAAG,CAAC,CAAC;AACnB,CAAC","file":"calc.js","sourcesContent":["/* Adapted from cheetah-grid by yosuke ota\n *url:https://github.com/future-architect/cheetah-grid/blob/master/packages/cheetah-grid/src/js/internal/calc.ts\n *License: https://github.com/future-architect/cheetah-grid/blob/master/LICENSE\n * @license\n */\n\nimport { array } from './helper';\n\nconst TYPE_PAREN = 0;\nconst TYPE_UNIT = 1;\nconst TYPE_OPERATOR = 2;\nconst TYPE_NUMBER = 3;\n\nconst NODE_TYPE_UNIT = 10;\nconst NODE_TYPE_BINARY_EXPRESSION = 11;\nconst NODE_TYPE_NUMBER = 12;\n\ntype Ops = '-' | '+' | '*' | '/';\ntype ParenToken = {\n value: '(' | ')';\n type: typeof TYPE_PAREN;\n};\ntype UnitToken = {\n unit: string;\n value: number;\n type: typeof TYPE_UNIT;\n};\ntype OpToken = {\n value: Ops;\n type: typeof TYPE_OPERATOR;\n};\ntype NumToken = {\n value: number;\n type: typeof TYPE_NUMBER;\n};\ntype Token = ParenToken | UnitToken | OpToken | NumToken;\ntype UnitNode = {\n nodeType: typeof NODE_TYPE_UNIT;\n unit: string;\n value: number;\n};\ntype BinaryNode = {\n nodeType: typeof NODE_TYPE_BINARY_EXPRESSION;\n left: Node;\n op: OpToken;\n right: Node;\n};\ntype NumNode = {\n nodeType: typeof NODE_TYPE_NUMBER;\n value: number;\n};\ntype Node = UnitNode | BinaryNode | NumNode;\n\nconst TABULATION = 0x09;\nconst CARRIAGE_RETURN = 0x0d;\nconst LINE_FEED = 0x0a;\nconst FORM_FEED = 0x0c;\nconst SPACE = 0x20;\nconst PERCENT = 0x25;\nconst FULL_STOP = 0x2e;\nconst DIGIT_0 = 0x30;\nconst DIGIT_9 = 0x39;\nconst LATIN_CAPITAL_A = 0x41;\nconst LATIN_CAPITAL_Z = 0x5a;\nconst LATIN_SMALL_A = 0x61;\nconst LATIN_SMALL_Z = 0x7a;\nfunction isUpperLetter(cp: number): boolean {\n return cp >= LATIN_CAPITAL_A && cp <= LATIN_CAPITAL_Z;\n}\nfunction isLowerLetter(cp: number): boolean {\n return cp >= LATIN_SMALL_A && cp <= LATIN_SMALL_Z;\n}\nfunction isLetter(cp: number): boolean {\n return isLowerLetter(cp) || isUpperLetter(cp);\n}\nfunction isWhitespace(cp: number): boolean {\n return cp === TABULATION || cp === LINE_FEED || cp === FORM_FEED || cp === CARRIAGE_RETURN || cp === SPACE;\n}\nfunction isDigit(cp: number): boolean {\n return cp >= DIGIT_0 && cp <= DIGIT_9;\n}\nfunction isDot(cp: number): boolean {\n return cp === FULL_STOP;\n}\nfunction isUnit(cp: number): boolean {\n return isLetter(cp) || cp === PERCENT;\n}\n\nfunction createError(calc: string): Error {\n return new Error(`calc parse error: ${calc}`);\n}\n\n/**\n * tokenize\n * @param {string} calc calc expression\n * @returns {Array} tokens\n * @private\n */\nfunction tokenize(calc: string): Token[] {\n const exp = calc.replace(/calc\\(/g, '(').trim();\n\n const tokens: Token[] = [];\n const len = exp.length;\n for (let index = 0; index < len; index++) {\n const c = exp[index];\n const cp = c.charCodeAt(0);\n if (c === '(' || c === ')') {\n tokens.push({ value: c, type: TYPE_PAREN });\n } else if (c === '*' || c === '/') {\n tokens.push({ value: c, type: TYPE_OPERATOR });\n } else if (c === '+' || c === '-') {\n index = parseSign(c, index + 1) - 1;\n } else if (isDigit(cp) || isDot(cp)) {\n index = parseNum(c, index + 1) - 1;\n } else if (isWhitespace(cp)) {\n // skip\n } else {\n throw createError(calc);\n }\n }\n\n function parseSign(sign: '+' | '-', start: number): number {\n if (start < len) {\n const c = exp[start];\n const cp = c.charCodeAt(0);\n if (isDigit(cp) || isDot(cp)) {\n return parseNum(sign + c, start + 1);\n }\n }\n tokens.push({ value: sign, type: TYPE_OPERATOR });\n return start;\n }\n function parseNum(num: string, start: number): number {\n let index = start;\n for (; index < len; index++) {\n const c = exp[index];\n const cp = c.charCodeAt(0);\n if (isDigit(cp)) {\n num += c;\n } else if (c === '.') {\n if (num.indexOf('.') >= 0) {\n throw createError(calc);\n }\n num += c;\n } else if (isUnit(cp)) {\n return parseUnit(num, c, index + 1);\n } else {\n break;\n }\n }\n if (num === '.') {\n throw createError(calc);\n }\n tokens.push({ value: parseFloat(num), type: TYPE_NUMBER });\n return index;\n }\n function parseUnit(num: string, unit: string, start: number): number {\n let index = start;\n for (; index < len; index++) {\n const c = exp[index];\n const cp = c.charCodeAt(0);\n if (isUnit(cp)) {\n unit += c;\n } else {\n break;\n }\n }\n tokens.push({ value: parseFloat(num), unit, type: TYPE_UNIT });\n return index;\n }\n return tokens;\n}\n\nconst PRECEDENCE = {\n '*': 3,\n '/': 3,\n '+': 2,\n '-': 2\n};\n\nfunction lex(tokens: Token[], calc: string): Node {\n function buildBinaryExpNode(stack: (Node | OpToken)[]): BinaryNode {\n const right = stack.pop() as Node;\n const op = stack.pop() as OpToken;\n const left = stack.pop() as Node;\n\n if (!left || !left.nodeType || !op || op.type !== TYPE_OPERATOR || !right || !right.nodeType) {\n throw createError(calc);\n }\n return {\n nodeType: NODE_TYPE_BINARY_EXPRESSION,\n left,\n op,\n right\n };\n }\n\n const stack: (Node | OpToken)[] = [];\n\n while (tokens.length) {\n const token = tokens.shift() as Token;\n if (token.type === TYPE_PAREN && token.value === '(') {\n let deep = 0;\n const closeIndex = array.findIndex(tokens, t => {\n if (t.type === TYPE_PAREN && t.value === '(') {\n deep++;\n } else if (t.type === TYPE_PAREN && t.value === ')') {\n if (!deep) {\n return true;\n }\n deep--;\n }\n return false;\n });\n if (closeIndex === -1) {\n throw createError(calc);\n }\n\n stack.push(lex(tokens.splice(0, closeIndex), calc));\n tokens.shift();\n } else if (token.type === TYPE_OPERATOR) {\n if (stack.length >= 3) {\n const beforeOp = (stack[stack.length - 2] as OpToken).value;\n if (PRECEDENCE[token.value] <= PRECEDENCE[beforeOp]) {\n stack.push(buildBinaryExpNode(stack));\n }\n }\n stack.push(token);\n } else if (token.type === TYPE_UNIT) {\n const { value: num, unit } = token;\n stack.push({\n nodeType: NODE_TYPE_UNIT,\n value: num,\n unit\n });\n } else if (token.type === TYPE_NUMBER) {\n stack.push({\n nodeType: NODE_TYPE_NUMBER,\n value: token.value\n });\n }\n }\n while (stack.length > 1) {\n stack.push(buildBinaryExpNode(stack));\n }\n return stack[0] as Node;\n}\n\nfunction parse(calcStr: string): Node {\n const tokens = tokenize(calcStr);\n return lex(tokens, calcStr);\n}\n\nfunction calcNode(node: Node, context: CalcContext): number {\n if (node.nodeType === NODE_TYPE_BINARY_EXPRESSION) {\n const left = calcNode(node.left, context);\n const right = calcNode(node.right, context);\n\n switch (node.op.value) {\n case '+':\n return left + right;\n case '-':\n return left - right;\n case '*':\n return left * right;\n case '/':\n return left / right;\n default:\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n throw new Error(`calc error. unknown operator: ${node.op.value}`);\n }\n } else if (node.nodeType === NODE_TYPE_UNIT) {\n switch (node.unit) {\n case '%':\n return (node.value * context.full) / 100;\n // case 'em':\n // return node.value * context.em;\n case 'px':\n return node.value;\n default:\n throw new Error(`calc error. unknown unit: ${node.unit}`);\n }\n } else if (node.nodeType === NODE_TYPE_NUMBER) {\n return node.value;\n }\n throw new Error('calc error.');\n}\n\nfunction toPxInternal(value: string, context: CalcContext): number {\n const ast = parse(value);\n return calcNode(ast, context);\n}\n\ntype CalcContext = {\n full: number;\n // em: number;\n};\n\nexport function toPx(value: string | number, context: CalcContext): number {\n if (typeof value === 'string') {\n return toPxInternal(value.trim(), context);\n }\n return value - 0;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function debounce(func: Function, wait?: number, options?: any): (this: any, ...args: any) => any;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { isObject } from "./isx";
|
|
2
|
+
|
|
3
|
+
export function debounce(func, wait, options) {
|
|
4
|
+
let lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, maxing = !1, leading = !1, trailing = !0;
|
|
5
|
+
const useRAF = !wait && 0 !== wait && "function" == typeof requestAnimationFrame;
|
|
6
|
+
if ("function" != typeof func) throw new TypeError("Expected a function");
|
|
7
|
+
function invokeFunc(time) {
|
|
8
|
+
const args = lastArgs, thisArg = lastThis;
|
|
9
|
+
return lastThis = void 0, lastArgs = void 0, lastInvokeTime = time, result = func.apply(thisArg, args),
|
|
10
|
+
result;
|
|
11
|
+
}
|
|
12
|
+
function startTimer(pendingFunc, wait) {
|
|
13
|
+
return useRAF ? requestAnimationFrame(pendingFunc) : setTimeout(pendingFunc, wait);
|
|
14
|
+
}
|
|
15
|
+
function shouldInvoke(time) {
|
|
16
|
+
const timeSinceLastCall = time - lastCallTime;
|
|
17
|
+
return void 0 === lastCallTime || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && time - lastInvokeTime >= maxWait;
|
|
18
|
+
}
|
|
19
|
+
function timerExpired() {
|
|
20
|
+
const time = Date.now();
|
|
21
|
+
if (shouldInvoke(time)) return function(time) {
|
|
22
|
+
return timerId = void 0, trailing && lastArgs ? invokeFunc(time) : (lastThis = void 0,
|
|
23
|
+
lastArgs = void 0, result);
|
|
24
|
+
}(time);
|
|
25
|
+
timerId = startTimer(timerExpired, function(time) {
|
|
26
|
+
const timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait && -(time - lastCallTime);
|
|
27
|
+
return maxing ? Math.min(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
|
|
28
|
+
}(time));
|
|
29
|
+
}
|
|
30
|
+
return wait = +wait || 0, isObject(options) && (leading = !!options.leading, maxing = "maxWait" in options,
|
|
31
|
+
maxing && (maxWait = Math.max(+options.maxWait || 0, wait)), trailing = "trailing" in options ? !!options.trailing : trailing),
|
|
32
|
+
function(...args) {
|
|
33
|
+
const time = Date.now(), isInvoking = shouldInvoke(time);
|
|
34
|
+
if (lastArgs = args, lastThis = this, lastCallTime = time, isInvoking) {
|
|
35
|
+
if (void 0 === timerId) return function(time) {
|
|
36
|
+
return lastInvokeTime = time, timerId = startTimer(timerExpired, wait), leading ? invokeFunc(time) : result;
|
|
37
|
+
}(lastCallTime);
|
|
38
|
+
if (maxing) return timerId = startTimer(timerExpired, wait), invokeFunc(lastCallTime);
|
|
39
|
+
}
|
|
40
|
+
return void 0 === timerId && (timerId = startTimer(timerExpired, wait)), result;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=debounce.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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,CAAC;QAE9C,MAAM,mBAAmB,GAAG,IAAI,GAAG,cAAc,CAAC;QAElD,OAAO,CAEL,YAAY,KAAK,SAAS;YAC1B,iBAAiB,IAAK,IAAe;YACrC,iBAAiB,GAAG,CAAC;YACrB,CAAC,MAAM,IAAI,mBAAmB,IAAI,OAAO,CAAC,CAC3C,CAAC;IACJ,CAAC;IAGD,SAAS,YAAY;QACnB,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAExB,IAAI,YAAY,CAAC,IAAI,CAAC,EAAE;YACtB,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC;SAC3B;QAGD,OAAO,GAAG,UAAU,CAAC,YAAY,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1D,CAAC;IAED,SAAS,SAAS,CAAY,GAAG,IAAS;QACxC,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACxB,MAAM,UAAU,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;QAEtC,QAAQ,GAAG,IAAI,CAAC;QAChB,QAAQ,GAAG,IAAI,CAAC;QAChB,YAAY,GAAG,IAAI,CAAC;QAEpB,IAAI,UAAU,EAAE;YAEd,IAAI,OAAO,KAAK,SAAS,EAAE;gBACzB,OAAO,WAAW,CAAC,YAAY,CAAC,CAAC;aAClC;YACD,IAAI,MAAM,EAAE;gBAEV,OAAO,GAAG,UAAU,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;gBACzC,OAAO,UAAU,CAAC,YAAY,CAAC,CAAC;aACjC;SACF;QAID,IAAI,OAAO,KAAK,SAAS,EAAE;YAEzB,OAAO,GAAG,UAAU,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;SAC1C;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","file":"debounce.js","sourcesContent":["import { isObject } from './isx';\n\nexport function debounce(func: Function, wait?: number, options?: any) {\n let lastArgs: any;\n let lastThis: any;\n let maxWait: number; // 最长等待时间\n let result: any; // 存储 func 函数的返回值\n let timerId: number | undefined; // 定时器 id\n let lastCallTime: number; // 最近一次 执行 debounced 函数时的时间\n\n // 最近一次执行 func 时的时间戳\n let lastInvokeTime = 0;\n // options 是否 传入了 maxWait\n let maxing = false;\n // 是否在延迟开始前调用函数\n let leading = false;\n // 是否在延迟结束后调用函数\n let trailing = true;\n\n const useRAF = !wait && wait !== 0 && typeof requestAnimationFrame === 'function';\n\n if (typeof func !== 'function') {\n throw new TypeError('Expected a function');\n }\n\n wait = +(wait as number) || 0;\n\n if (isObject(options)) {\n leading = !!options.leading;\n\n maxing = 'maxWait' in options;\n if (maxing) {\n maxWait = Math.max(+options.maxWait || 0, wait);\n }\n\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time: number) {\n const args = lastArgs;\n const thisArg = lastThis;\n\n lastThis = undefined;\n lastArgs = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n // 开启定时器\n function startTimer(pendingFunc: any, wait: number) {\n if (useRAF) {\n return requestAnimationFrame(pendingFunc);\n }\n return setTimeout(pendingFunc, wait);\n }\n\n // 清除定时器\n // function cancelTimer(id: number) {\n // if (useRAF) {\n // return cancelAnimationFrame(id);\n // }\n // clearTimeout(id);\n // }\n\n // 在延迟开始前调用\n function leadingEdge(time: number) {\n // 记录 函数被调用时 的时间戳\n lastInvokeTime = time;\n //@ts-ignore\n timerId = startTimer(timerExpired, wait);\n return leading ? invokeFunc(time) : result;\n }\n\n // 在延迟结束后调用\n function trailingEdge(time: number) {\n timerId = undefined;\n\n // lastArgs 在 debounced 函数执行时赋值\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n\n // 重置参数和作用域\n lastThis = undefined;\n lastArgs = undefined;\n return result;\n }\n\n function remainingWait(time: number) {\n // 计算 time 与最近一次调用 debounced 函数的时间差\n const timeSinceLastCall = time - lastCallTime;\n // 计算 time 与最近一次调用 func 函数的时间差\n const timeSinceLastInvoke = time - lastInvokeTime;\n // 用 wait 减去已经等待的时间\n const timeWaiting = wait && -timeSinceLastCall;\n\n return maxing ? Math.min(timeWaiting as number, maxWait - timeSinceLastInvoke) : timeWaiting;\n }\n\n // 是否可以执行函数\n function shouldInvoke(time: number) {\n // 计算 time 与最近一次调用 debounced 函数的时间差\n const timeSinceLastCall = time - lastCallTime;\n // 计算 time 与最近一次调用 func 函数的时间差\n const timeSinceLastInvoke = time - lastInvokeTime;\n\n return (\n // 是不是第一次执行 debouned 函数\n lastCallTime === undefined ||\n timeSinceLastCall >= (wait as number) ||\n timeSinceLastCall < 0 ||\n (maxing && timeSinceLastInvoke >= maxWait)\n );\n }\n\n // 封装执行函数,用于 wait 延迟结束后执行\n function timerExpired() {\n const time = Date.now();\n // 根据时间来判断是否可以执行 func 函数\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // 重新计算时间,重新建一个定时器\n // @ts-ignore\n timerId = startTimer(timerExpired, remainingWait(time));\n }\n\n function debounced(this: any, ...args: any) {\n const time = Date.now();\n const isInvoking = shouldInvoke(time);\n\n lastArgs = args;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n // 第一次执行时\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // @ts-ignore\n timerId = startTimer(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n\n // 因为 trailingEdge 函数内部会执行 timerId = undefined\n // trailingEdge 函数执行之后,又触发了 debounced\n if (timerId === undefined) {\n // @ts-ignore\n timerId = startTimer(timerExpired, wait);\n }\n\n return result;\n }\n\n return debounced;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function createElement(tagName: string, classNames?: string[]): HTMLElement;
|
package/es/tools/dom.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["tools/dom.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,aAAa,CAAC,OAAe,EAAE,UAAqB;IAClE,MAAM,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAChD,IAAI,UAAU,EAAE;QACd,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,CAAC;KACtC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC","file":"dom.js","sourcesContent":["export function createElement(tagName: string, classNames?: string[]): HTMLElement {\n const element = document.createElement(tagName);\n if (classNames) {\n element.classList.add(...classNames);\n }\n return element;\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type EnvMode = 'browser' | 'node' | 'worker' | 'miniApp' | 'desktop-miniApp';
|
|
2
|
+
export type LooseFunction = (...args: any) => any;
|
|
3
|
+
export declare class Env {
|
|
4
|
+
static _mode: EnvMode;
|
|
5
|
+
static get mode(): EnvMode;
|
|
6
|
+
static set mode(mode: EnvMode);
|
|
7
|
+
static dpr: number;
|
|
8
|
+
static CreateCanvas?: LooseFunction;
|
|
9
|
+
static LoadImage?: LooseFunction;
|
|
10
|
+
static RequestAnimationFrame?: LooseFunction;
|
|
11
|
+
static CancelAnimationFrame?: LooseFunction;
|
|
12
|
+
static RegisterCreateCanvas(func: LooseFunction): void;
|
|
13
|
+
static RegisterLoadImage(func: LooseFunction): void;
|
|
14
|
+
static GetCreateCanvasFunc(): LooseFunction | undefined;
|
|
15
|
+
static RegisterRequestAnimationFrame(func: LooseFunction): void;
|
|
16
|
+
static GetRequestAnimationFrame(): LooseFunction;
|
|
17
|
+
static RegisterCancelAnimationFrame(func: LooseFunction): void;
|
|
18
|
+
static GetCancelAnimationFrame(): LooseFunction;
|
|
19
|
+
}
|