k-vtable 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/ListTable.d.ts +3 -1
- package/cjs/ListTable.js +41 -18
- package/cjs/ListTable.js.map +1 -1
- package/cjs/PivotChart.js +3 -5
- package/cjs/PivotChart.js.map +1 -1
- package/cjs/PivotTable.js +2 -4
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/body-helper/style.d.ts +1 -1
- package/cjs/body-helper/style.js.map +1 -1
- package/cjs/chartModule.d.ts +3 -0
- package/cjs/chartModule.js +7 -3
- package/cjs/chartModule.js.map +1 -1
- package/cjs/components/axis/axis.js.map +1 -1
- package/cjs/components/menu/dom/MenuHandler.js +1 -1
- package/cjs/components/menu/dom/MenuHandler.js.map +1 -1
- package/cjs/components/menu/dom/logic/MenuElement.js +12 -7
- package/cjs/components/menu/dom/logic/MenuElement.js.map +1 -1
- package/cjs/components/menu/dom/logic/MenuElementStyle.js +1 -1
- package/cjs/components/menu/dom/logic/MenuElementStyle.js.map +1 -1
- package/cjs/components/tooltip/TooltipHandler.js +1 -1
- package/cjs/components/tooltip/TooltipHandler.js.map +1 -1
- package/cjs/core/BaseTable.d.ts +6 -2
- package/cjs/core/BaseTable.js +62 -39
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/TABLE_EVENT_TYPE.d.ts +5 -0
- package/cjs/core/TABLE_EVENT_TYPE.js +6 -1
- package/cjs/core/TABLE_EVENT_TYPE.js.map +1 -1
- package/cjs/core/record-helper.d.ts +1 -1
- package/cjs/core/record-helper.js +6 -4
- package/cjs/core/record-helper.js.map +1 -1
- package/cjs/core/tableHelper.js +16 -13
- package/cjs/core/tableHelper.js.map +1 -1
- package/cjs/data/CachedDataSource.js +5 -5
- package/cjs/data/CachedDataSource.js.map +1 -1
- package/cjs/data/DataSource.js +10 -4
- package/cjs/data/DataSource.js.map +1 -1
- package/cjs/edit/edit-manager.d.ts +1 -0
- package/cjs/edit/edit-manager.js +9 -5
- package/cjs/edit/edit-manager.js.map +1 -1
- package/cjs/event/event.d.ts +3 -2
- package/cjs/event/event.js +3 -3
- package/cjs/event/event.js.map +1 -1
- package/cjs/event/listener/container-dom.js +91 -35
- package/cjs/event/listener/container-dom.js.map +1 -1
- package/cjs/event/listener/table-group.js +8 -38
- package/cjs/event/listener/table-group.js.map +1 -1
- package/cjs/event/listener/touch.js +31 -21
- package/cjs/event/listener/touch.js.map +1 -1
- package/cjs/event/self-event-listener/list-table/checkbox.d.ts +2 -0
- package/cjs/event/self-event-listener/list-table/checkbox.js +47 -34
- package/cjs/event/self-event-listener/list-table/checkbox.js.map +1 -1
- package/cjs/header-helper/style.d.ts +1 -1
- package/cjs/header-helper/style.js.map +1 -1
- package/cjs/icons.d.ts +3 -0
- package/cjs/icons.js +3 -3
- package/cjs/icons.js.map +1 -1
- package/cjs/index.d.ts +5 -3
- package/cjs/index.js +11 -2
- package/cjs/index.js.map +1 -1
- package/cjs/layout/pivot-header-layout.js +9 -6
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/layout/simple-header-layout.d.ts +3 -1
- package/cjs/layout/simple-header-layout.js +14 -8
- package/cjs/layout/simple-header-layout.js.map +1 -1
- package/cjs/plugins/custom-cell-style.js +1 -1
- package/cjs/plugins/index.d.ts +3 -0
- package/cjs/plugins/index.js +24 -0
- package/cjs/plugins/index.js.map +1 -0
- package/cjs/plugins/interface.d.ts +10 -0
- package/cjs/plugins/interface.js +6 -0
- package/cjs/plugins/interface.js.map +1 -0
- package/cjs/plugins/plugin-manager.d.ts +14 -0
- package/cjs/plugins/plugin-manager.js +55 -0
- package/cjs/plugins/plugin-manager.js.map +1 -0
- package/cjs/register.js +4 -4
- package/cjs/register.js.map +1 -1
- package/cjs/scenegraph/component/checkbox-content.d.ts +34 -0
- package/cjs/scenegraph/component/checkbox-content.js +97 -0
- package/cjs/scenegraph/component/checkbox-content.js.map +1 -0
- package/cjs/scenegraph/component/menu.js.map +1 -1
- package/cjs/scenegraph/component/table-component.d.ts +2 -0
- package/cjs/scenegraph/component/table-component.js +38 -24
- package/cjs/scenegraph/component/table-component.js.map +1 -1
- package/cjs/scenegraph/graphic/chart.d.ts +2 -2
- package/cjs/scenegraph/graphic/chart.js +1 -1
- package/cjs/scenegraph/graphic/chart.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/chart-render-helper.js +9 -7
- package/cjs/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/group-contribution-render.d.ts +6 -0
- package/cjs/scenegraph/graphic/contributions/group-contribution-render.js +27 -2
- package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/index.js +6 -2
- package/cjs/scenegraph/graphic/contributions/index.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/picker-interceptor.d.ts +8 -0
- package/cjs/scenegraph/graphic/contributions/picker-interceptor.js +42 -0
- package/cjs/scenegraph/graphic/contributions/picker-interceptor.js.map +1 -0
- package/cjs/scenegraph/graphic/contributions/rect-contribution-render.js +2 -2
- package/cjs/scenegraph/graphic/contributions/rect-contribution-render.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/vchart-graphic-picker.d.ts +6 -0
- package/cjs/scenegraph/graphic/contributions/vchart-graphic-picker.js +25 -0
- package/cjs/scenegraph/graphic/contributions/vchart-graphic-picker.js.map +1 -0
- package/cjs/scenegraph/group-creater/cell-helper.js +9 -2
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/checkbox-cell.d.ts +2 -2
- package/cjs/scenegraph/group-creater/cell-type/checkbox-cell.js +54 -15
- package/cjs/scenegraph/group-creater/cell-type/checkbox-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/image-cell.js +5 -3
- package/cjs/scenegraph/group-creater/cell-type/image-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/column-helper.js +2 -1
- package/cjs/scenegraph/group-creater/column-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js +4 -2
- package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/proxy.js +2 -2
- package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
- package/cjs/scenegraph/layout/frozen.js +32 -13
- package/cjs/scenegraph/layout/frozen.js.map +1 -1
- package/cjs/scenegraph/layout/update-col.js +2 -1
- package/cjs/scenegraph/layout/update-col.js.map +1 -1
- package/cjs/scenegraph/layout/update-row.js +2 -1
- package/cjs/scenegraph/layout/update-row.js.map +1 -1
- package/cjs/scenegraph/scenegraph.js +18 -8
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/scenegraph/select/update-select-border.js +2 -1
- package/cjs/scenegraph/select/update-select-border.js.map +1 -1
- package/cjs/scenegraph/stick-text/index.d.ts +2 -0
- package/cjs/scenegraph/stick-text/index.js +10 -6
- package/cjs/scenegraph/stick-text/index.js.map +1 -1
- package/cjs/state/checkbox/checkbox.js +4 -3
- package/cjs/state/checkbox/checkbox.js.map +1 -1
- package/cjs/state/hover/update-position.js +3 -1
- package/cjs/state/hover/update-position.js.map +1 -1
- package/cjs/state/select/update-position.js +138 -44
- package/cjs/state/select/update-position.js.map +1 -1
- package/cjs/state/state.d.ts +1 -0
- package/cjs/state/state.js +10 -8
- package/cjs/state/state.js.map +1 -1
- package/cjs/themes/ARCO.js +2 -1
- package/cjs/themes/ARCO.js.map +1 -1
- package/cjs/themes/BRIGHT.js +2 -1
- package/cjs/themes/BRIGHT.js.map +1 -1
- package/cjs/themes/DARK.js +2 -1
- package/cjs/themes/DARK.js.map +1 -1
- package/cjs/themes/DEFAULT.js +2 -1
- package/cjs/themes/DEFAULT.js.map +1 -1
- package/cjs/themes/{theme.js → theme-define.js} +9 -1
- package/cjs/themes/theme-define.js.map +1 -0
- package/cjs/{plugins → themes}/themes.d.ts +1 -1
- package/cjs/themes/themes.js.map +1 -0
- package/cjs/themes.d.ts +1 -1
- package/cjs/themes.js +9 -8
- package/cjs/themes.js.map +1 -1
- package/cjs/tools/cell-range.js +2 -1
- package/cjs/tools/cell-range.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +11 -2
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/events.d.ts +25 -0
- package/cjs/ts-types/events.js.map +1 -1
- package/cjs/ts-types/index.d.ts +1 -0
- package/cjs/ts-types/index.js +1 -1
- package/cjs/ts-types/index.js.map +1 -1
- package/cjs/ts-types/list-table/define/checkbox-define.d.ts +1 -0
- package/cjs/ts-types/list-table/define/checkbox-define.js.map +1 -1
- package/cjs/ts-types/menu.d.ts +1 -0
- package/cjs/ts-types/menu.js.map +1 -1
- package/cjs/ts-types/table-engine.d.ts +5 -1
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/cjs/ts-types/theme.d.ts +2 -0
- package/cjs/ts-types/theme.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +18294 -15890
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.d.ts +3 -1
- package/es/ListTable.js +42 -17
- package/es/ListTable.js.map +1 -1
- package/es/PivotChart.js +2 -6
- package/es/PivotChart.js.map +1 -1
- package/es/PivotTable.js +2 -4
- package/es/PivotTable.js.map +1 -1
- package/es/body-helper/style.d.ts +1 -1
- package/es/body-helper/style.js.map +1 -1
- package/es/chartModule.d.ts +3 -0
- package/es/chartModule.js +2 -2
- package/es/chartModule.js.map +1 -1
- package/es/components/axis/axis.js.map +1 -1
- package/es/components/menu/dom/MenuHandler.js +1 -1
- package/es/components/menu/dom/MenuHandler.js.map +1 -1
- package/es/components/menu/dom/logic/MenuElement.js +12 -7
- package/es/components/menu/dom/logic/MenuElement.js.map +1 -1
- package/es/components/menu/dom/logic/MenuElementStyle.js +1 -1
- package/es/components/menu/dom/logic/MenuElementStyle.js.map +1 -1
- package/es/components/tooltip/TooltipHandler.js +1 -1
- package/es/components/tooltip/TooltipHandler.js.map +1 -1
- package/es/core/BaseTable.d.ts +6 -2
- package/es/core/BaseTable.js +59 -36
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/TABLE_EVENT_TYPE.d.ts +5 -0
- package/es/core/TABLE_EVENT_TYPE.js +6 -1
- package/es/core/TABLE_EVENT_TYPE.js.map +1 -1
- package/es/core/record-helper.d.ts +1 -1
- package/es/core/record-helper.js +6 -4
- package/es/core/record-helper.js.map +1 -1
- package/es/core/tableHelper.js +16 -13
- package/es/core/tableHelper.js.map +1 -1
- package/es/data/CachedDataSource.js +5 -5
- package/es/data/CachedDataSource.js.map +1 -1
- package/es/data/DataSource.js +10 -4
- package/es/data/DataSource.js.map +1 -1
- package/es/edit/edit-manager.d.ts +1 -0
- package/es/edit/edit-manager.js +9 -5
- package/es/edit/edit-manager.js.map +1 -1
- package/es/event/event.d.ts +3 -2
- package/es/event/event.js +5 -5
- package/es/event/event.js.map +1 -1
- package/es/event/listener/container-dom.js +91 -35
- package/es/event/listener/container-dom.js.map +1 -1
- package/es/event/listener/table-group.js +9 -39
- package/es/event/listener/table-group.js.map +1 -1
- package/es/event/listener/touch.js +32 -20
- package/es/event/listener/touch.js.map +1 -1
- package/es/event/self-event-listener/list-table/checkbox.d.ts +2 -0
- package/es/event/self-event-listener/list-table/checkbox.js +43 -29
- package/es/event/self-event-listener/list-table/checkbox.js.map +1 -1
- package/es/header-helper/style.d.ts +1 -1
- package/es/header-helper/style.js.map +1 -1
- package/es/icons.d.ts +3 -0
- package/es/icons.js +3 -1
- package/es/icons.js.map +1 -1
- package/es/index.d.ts +5 -3
- package/es/index.js +5 -3
- package/es/index.js.map +1 -1
- package/es/layout/pivot-header-layout.js +9 -6
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/layout/simple-header-layout.d.ts +3 -1
- package/es/layout/simple-header-layout.js +15 -7
- package/es/layout/simple-header-layout.js.map +1 -1
- package/es/plugins/custom-cell-style.js +1 -1
- package/es/plugins/index.d.ts +3 -0
- package/es/plugins/index.js +4 -0
- package/es/plugins/index.js.map +1 -0
- package/es/plugins/interface.d.ts +10 -0
- package/es/plugins/interface.js +2 -0
- package/es/plugins/interface.js.map +1 -0
- package/es/plugins/plugin-manager.d.ts +14 -0
- package/es/plugins/plugin-manager.js +47 -0
- package/es/plugins/plugin-manager.js.map +1 -0
- package/es/register.js +3 -3
- package/es/register.js.map +1 -1
- package/es/scenegraph/component/checkbox-content.d.ts +34 -0
- package/es/scenegraph/component/checkbox-content.js +91 -0
- package/es/scenegraph/component/checkbox-content.js.map +1 -0
- package/es/scenegraph/component/menu.js.map +1 -1
- package/es/scenegraph/component/table-component.d.ts +2 -0
- package/es/scenegraph/component/table-component.js +38 -24
- package/es/scenegraph/component/table-component.js.map +1 -1
- package/es/scenegraph/graphic/chart.d.ts +2 -2
- package/es/scenegraph/graphic/chart.js +2 -2
- package/es/scenegraph/graphic/chart.js.map +1 -1
- package/es/scenegraph/graphic/contributions/chart-render-helper.js +9 -7
- package/es/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
- package/es/scenegraph/graphic/contributions/group-contribution-render.d.ts +6 -0
- package/es/scenegraph/graphic/contributions/group-contribution-render.js +26 -1
- package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
- package/es/scenegraph/graphic/contributions/index.js +7 -3
- package/es/scenegraph/graphic/contributions/index.js.map +1 -1
- package/es/scenegraph/graphic/contributions/picker-interceptor.d.ts +8 -0
- package/es/scenegraph/graphic/contributions/picker-interceptor.js +37 -0
- package/es/scenegraph/graphic/contributions/picker-interceptor.js.map +1 -0
- package/es/scenegraph/graphic/contributions/rect-contribution-render.js +2 -2
- package/es/scenegraph/graphic/contributions/rect-contribution-render.js.map +1 -1
- package/es/scenegraph/graphic/contributions/vchart-graphic-picker.d.ts +6 -0
- package/es/scenegraph/graphic/contributions/vchart-graphic-picker.js +23 -0
- package/es/scenegraph/graphic/contributions/vchart-graphic-picker.js.map +1 -0
- package/es/scenegraph/group-creater/cell-helper.js +9 -2
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/checkbox-cell.d.ts +2 -2
- package/es/scenegraph/group-creater/cell-type/checkbox-cell.js +60 -15
- package/es/scenegraph/group-creater/cell-type/checkbox-cell.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/image-cell.js +5 -3
- package/es/scenegraph/group-creater/cell-type/image-cell.js.map +1 -1
- package/es/scenegraph/group-creater/column-helper.js +2 -1
- package/es/scenegraph/group-creater/column-helper.js.map +1 -1
- package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js +2 -2
- package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
- package/es/scenegraph/group-creater/progress/proxy.js +4 -3
- package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/es/scenegraph/layout/compute-col-width.js.map +1 -1
- package/es/scenegraph/layout/frozen.js +32 -13
- package/es/scenegraph/layout/frozen.js.map +1 -1
- package/es/scenegraph/layout/update-col.js +3 -0
- package/es/scenegraph/layout/update-col.js.map +1 -1
- package/es/scenegraph/layout/update-row.js +3 -0
- package/es/scenegraph/layout/update-row.js.map +1 -1
- package/es/scenegraph/scenegraph.js +18 -8
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/scenegraph/select/update-select-border.js +2 -1
- package/es/scenegraph/select/update-select-border.js.map +1 -1
- package/es/scenegraph/stick-text/index.d.ts +2 -0
- package/es/scenegraph/stick-text/index.js +7 -4
- package/es/scenegraph/stick-text/index.js.map +1 -1
- package/es/state/checkbox/checkbox.js +4 -3
- package/es/state/checkbox/checkbox.js.map +1 -1
- package/es/state/hover/update-position.js +3 -1
- package/es/state/hover/update-position.js.map +1 -1
- package/es/state/select/update-position.js +138 -44
- package/es/state/select/update-position.js.map +1 -1
- package/es/state/state.d.ts +1 -0
- package/es/state/state.js +10 -8
- package/es/state/state.js.map +1 -1
- package/es/themes/ARCO.js +2 -1
- package/es/themes/ARCO.js.map +1 -1
- package/es/themes/BRIGHT.js +2 -1
- package/es/themes/BRIGHT.js.map +1 -1
- package/es/themes/DARK.js +2 -1
- package/es/themes/DARK.js.map +1 -1
- package/es/themes/DEFAULT.js +2 -1
- package/es/themes/DEFAULT.js.map +1 -1
- package/es/themes/{theme.js → theme-define.js} +9 -1
- package/es/themes/theme-define.js.map +1 -0
- package/es/{plugins → themes}/themes.d.ts +1 -1
- package/es/themes/themes.js.map +1 -0
- package/es/themes.d.ts +1 -1
- package/es/themes.js +2 -2
- package/es/themes.js.map +1 -1
- package/es/tools/cell-range.js +2 -1
- package/es/tools/cell-range.js.map +1 -1
- package/es/ts-types/base-table.d.ts +11 -2
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/events.d.ts +25 -0
- package/es/ts-types/events.js.map +1 -1
- package/es/ts-types/index.d.ts +1 -0
- package/es/ts-types/index.js +2 -0
- package/es/ts-types/index.js.map +1 -1
- package/es/ts-types/list-table/define/checkbox-define.d.ts +1 -0
- package/es/ts-types/list-table/define/checkbox-define.js.map +1 -1
- package/es/ts-types/menu.d.ts +1 -0
- package/es/ts-types/menu.js.map +1 -1
- package/es/ts-types/table-engine.d.ts +5 -1
- package/es/ts-types/table-engine.js.map +1 -1
- package/es/ts-types/theme.d.ts +2 -0
- package/es/ts-types/theme.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +6 -6
- package/cjs/plugins/chartModules.d.ts +0 -3
- package/cjs/plugins/chartModules.js +0 -6
- package/cjs/plugins/chartModules.js.map +0 -1
- package/cjs/plugins/icons.d.ts +0 -12
- package/cjs/plugins/icons.js +0 -26
- package/cjs/plugins/icons.js.map +0 -1
- package/cjs/plugins/themes.js.map +0 -1
- package/cjs/scenegraph/component/menu.d.ts +0 -41
- package/cjs/scenegraph/utils/text-measure.d.ts +0 -38
- package/cjs/themes/theme.js.map +0 -1
- package/es/plugins/chartModules.d.ts +0 -3
- package/es/plugins/chartModules.js +0 -2
- package/es/plugins/chartModules.js.map +0 -1
- package/es/plugins/icons.d.ts +0 -12
- package/es/plugins/icons.js +0 -22
- package/es/plugins/icons.js.map +0 -1
- package/es/plugins/themes.js.map +0 -1
- package/es/scenegraph/component/menu.d.ts +0 -41
- package/es/scenegraph/utils/text-measure.d.ts +0 -38
- package/es/themes/theme.js.map +0 -1
- /package/cjs/themes/{theme.d.ts → theme-define.d.ts} +0 -0
- /package/cjs/{plugins → themes}/themes.js +0 -0
- /package/es/themes/{theme.d.ts → theme-define.d.ts} +0 -0
- /package/es/{plugins → themes}/themes.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/menu/dom/logic/MenuElementStyle.ts"],"names":[],"mappings":";;;AAAA,+CAA4C;AAE5C,SAAgB,WAAW;IACzB,IAAI,SAAG,CAAC,IAAI,KAAK,MAAM,EAAE;QACvB,OAAO;KACR;IACD,MAAM,YAAY,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IACrD,YAAY,CAAC,EAAE,GAAG,wBAAwB,CAAC;IAC3C,YAAY,CAAC,WAAW,GAAG
|
|
1
|
+
{"version":3,"sources":["../src/components/menu/dom/logic/MenuElementStyle.ts"],"names":[],"mappings":";;;AAAA,+CAA4C;AAE5C,SAAgB,WAAW;IACzB,IAAI,SAAG,CAAC,IAAI,KAAK,MAAM,EAAE;QACvB,OAAO;KACR;IACD,MAAM,YAAY,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IACrD,YAAY,CAAC,EAAE,GAAG,wBAAwB,CAAC;IAC3C,YAAY,CAAC,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkG5B,CAAC;IAEA,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;AAC1C,CAAC;AA3GD,kCA2GC","file":"MenuElementStyle.js","sourcesContent":["import { Env } from '../../../../tools/env';\n\nexport function importStyle() {\n if (Env.mode === 'node') {\n return;\n }\n const styleElement = document.createElement('style');\n styleElement.id = 'vtable-menu-styleSheet';\n styleElement.textContent = `\n@keyframes vtable__menu-element--shown-animation {\n\t0% {\n\t\topacity: 0;\n\t}\n\t100% {\n\t\topacity: 1;\n\t}\n}\n.vtable__menu-element {\n\tposition: absolute;\n\tbox-sizing: border-box;\n\tborder-radius: 4px;\n\tbackground-color: #fff;\n\tpadding: 6px 0;\n\t/* pointer-events: none; */\n\tuser-select: none;\n\tcolor: #000;\n\tmax-width: 300px;\n\tz-index: 99999;\n\tborder: #CCC 0.5px solid;\n\tcursor: default;\n\twidth: max-content;\n\tbox-shadow: 0px 8px 16px rgba(27, 31, 35, 0.12);\n max-height: 100%;\n overflow-y: auto;\n}\n.vtable__menu-element--hidden {\n\topacity: 0;\n\t/* transform: translate(-50%, -50%); */\n\ttransition: opacity 75ms linear;\n\tz-index: -9999;\n}\n.vtable__menu-element--shown {\n\topacity: 1;\n\t/* transform: translate(-50%, -50%); */\n\tanimation: vtable__menu-element--shown-animation 150ms ease-out;\n}\n.vtable__menu-element__content {\n\tfont-family: Roboto;\n\tfont-size: 12px;\n\toverflow: hidden;\n\tdisplay: inline-block;\n\t/* height: 100%; */\n\tline-height: 30px;\n}\n.vtable__menu-element__item {\n\theight: 32px;\n\tpadding: 0px 12px;\n\tcursor: pointer;\n\tposition: relative;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: flex-start;\n}\n.vtable__menu-element__item:hover {\n\tbackground-color: rgba(27, 31, 35, 0.06);\n}\n.vtable__menu-element__icon{\n\t/* vertical-align: top; */\n\tdisplay: flex;\n\t/* line-height: 30px; */\n\tmargin-right: 6px;\n}\n.vtable__menu-element__no-event {\n\tpointer-events: none;\n}\n.vtable__menu-element--select {\n\tcolor: #2E68CF;\n}\n.vtable__menu-element--normal {\n\tcolor: rgba(20, 20, 20, 0.9);;\n}\n.vtable__menu-element__item-disabled {\n color: rgba(0, 0, 0, 0.25);\n cursor: not-allowed;\n\t background-color: #fff;\n}\n.vtable__menu-element__item-disabled:hover {\n\t background-color: #fff;\n}\n.vtable__menu-element__split {\n\theight: 0px;\n\tborder: 1px solid rgb(209, 213, 218);\n\tmargin: 5px 0;\n}\n.vtable__menu-element__title {\n\tcolor: rgb(149, 149, 149);\n}\n.vtable__menu-element__arrow {\n\tposition: absolute;\n\tright: 3px;\n\tfont-weight: bold;\n\tmargin-top: 1px;\n}\n.vtable__menu-element__item-text {\n\tmargin-right: 15px;\n}\n`;\n\n document.head.appendChild(styleElement);\n}\n"]}
|
|
@@ -68,7 +68,7 @@ class TooltipHandler {
|
|
|
68
68
|
var _a, _b;
|
|
69
69
|
if (!(0, util_1.isMobile)()) {
|
|
70
70
|
if (null === (_b = null === (_a = this._attachInfo) || void 0 === _a ? void 0 : _a.tooltipOptions) || void 0 === _b ? void 0 : _b.referencePosition) {
|
|
71
|
-
const position = this._attachInfo.tooltipOptions.referencePosition, {event: event} = e, {left: left, right: right, top: top, bottom: bottom} = position.rect, abstractPos = table._getMouseAbstractPoint(event
|
|
71
|
+
const position = this._attachInfo.tooltipOptions.referencePosition, {event: event} = e, {left: left, right: right, top: top, bottom: bottom} = position.rect, abstractPos = table._getMouseAbstractPoint(event);
|
|
72
72
|
abstractPos.inTable && abstractPos.x >= left - 5 && abstractPos.x <= right + 5 && abstractPos.y >= top - 5 && abstractPos.y <= bottom + 5 || this._unbindFromCell();
|
|
73
73
|
}
|
|
74
74
|
this._attachInfo && table.stateManager.menu.isShow && this._bindToCell(e.col, e.row);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/tooltip/TooltipHandler.ts"],"names":[],"mappings":";;;AAGA,uCAA0C;AAC1C,+CAAiD;AACjD,2CAA4C;AAG5C,kEAA+D;AAE/D,6CAA8C;AAC9C,MAAM,wBAAwB,GAAG;IAI/B,gBAAg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8B;;QACrC,IAAI,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,MAAA,IAAI,CAAC,WAAW,0CAAE,cAAc,CAAC,EAAE;YACvF,OAAO,IAAI,CAAC;SACb;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAhOD,wCAgOC","file":"TooltipHandler.js","sourcesContent":["import type { CellRange, RectProps } from '../../ts-types';\nimport type { Placement } from '../../ts-types';\nimport type { BaseTooltip } from './BaseTooltip';\nimport { BubbleTooltip } from './Tooltip';\nimport { cellInRange } from '../../tools/helper';\nimport { isMobile } from '../../tools/util';\n// import { DG_EVENT_TYPE } from '../core/DG_EVENT_TYPE';\nimport type { TooltipOptions } from '../../ts-types/tooltip';\nimport { TABLE_EVENT_TYPE } from '../../core/TABLE_EVENT_TYPE';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport { isFunction } from '@visactor/vutils';\nconst TOOLTIP_INSTANCE_FACTORY = {\n // tooltip(table: BaseTableAPI): BaseTooltip {\n // return new Tooltip(table);\n // },\n 'bubble-tooltip': function (table: BaseTableAPI): BaseTooltip {\n return new BubbleTooltip(table);\n }\n};\ntype AttachInfo = {\n instance?: BaseTooltip;\n range: CellRange;\n tooltipOptions: TooltipOptions;\n};\nexport interface ITooltipHandler {\n new (table: BaseTableAPI, confine: boolean): TooltipHandler;\n}\n\nexport class TooltipHandler {\n private _table: BaseTableAPI;\n private _tooltipInstances?: { [type: string]: BaseTooltip };\n private _attachInfo?: AttachInfo | null;\n private confine?: boolean; //弹出框是否需要限定在canvas区域\n constructor(table: BaseTableAPI, confine: boolean) {\n this._table = table;\n this._tooltipInstances = {};\n this._bindTableEvent(table);\n this.confine = confine;\n }\n release(): void {\n const tooltipInstances = this._tooltipInstances;\n for (const k in tooltipInstances) {\n tooltipInstances[k]?.release?.();\n }\n delete this._tooltipInstances;\n this._attachInfo = null;\n }\n _bindToCell(col: number, row: number, tooltipOptions?: TooltipOptions): void {\n const info = this._attachInfo;\n const instance = this._getTooltipInstanceInfo(col, row);\n if (info && (!instance || info.instance !== instance)) {\n info.instance?.unbindTooltipElement();\n this._attachInfo = null;\n }\n if (!instance) {\n return;\n }\n // const { instance, info: tooltipInstanceInfo } = instanceInfo;\n const attach = instance && instance.bindTooltipElement(col, row, tooltipOptions, this.confine);\n if (attach) {\n const range = this._table.getCellRange(col, row);\n this._attachInfo = { range, instance, tooltipOptions };\n }\n }\n _move(col: number, row: number, tooltipOptions: TooltipOptions): void {\n const info = this._attachInfo;\n if (!info || !cellInRange(info.range, col, row)) {\n return;\n }\n const { instance } = info;\n instance?.moveTooltipElement(col, row, tooltipOptions, this.confine);\n }\n moveToPosition(\n col: number,\n row: number,\n position?: { x: number; y: number },\n referencePosition?: {\n rect: RectProps;\n placement?: Placement;\n }\n ): void {\n const info = this._attachInfo;\n if (!info || !cellInRange(info.range, col, row)) {\n return;\n }\n const { instance } = info;\n this._attachInfo.tooltipOptions.position = position;\n this._attachInfo.tooltipOptions.referencePosition = referencePosition;\n instance?.locateTooltipElement(col, row, position, referencePosition, this.confine);\n }\n _unbindFromCell(): void {\n const info = this._attachInfo;\n if (!info) {\n return;\n }\n const { instance } = info;\n instance?.unbindTooltipElement();\n this._attachInfo = null;\n }\n _isBindCell(col: number, row: number): boolean {\n const info = this._attachInfo;\n if (!info) {\n return false;\n }\n return cellInRange(info.range, col, row);\n }\n _bindTableEvent(table: BaseTableAPI): void {\n // (table.options.hover?.isShowTooltip || table.options.tooltip?.isShowOverflowTextTooltip) &&\n table.on(TABLE_EVENT_TYPE.MOUSEENTER_CELL, e => {\n //移动端不监听mousemove事件 (修改移动端tooltip时加的isMobile判断)\n if (isMobile()) {\n return;\n }\n // dropDownMenu区域不响应\n const { x1: left, x2: right, y1: top, y2: bottom } = table.stateManager.menu.bounds;\n if (\n table.stateManager.menu.isShow &&\n typeof e.x === 'number' &&\n typeof e.y === 'number' &&\n e.x > left &&\n e.x < right &&\n e.y > top &&\n e.y < bottom\n ) {\n return;\n }\n const { col, row } = e;\n this.showTooltip(col, row);\n // if (e.related) {\n // if (this._isBindCell(col, row)) {\n // return;\n // }\n // }\n });\n table.on(TABLE_EVENT_TYPE.MOUSEMOVE_CELL, e => {\n //移动端不监听mousemove事件 (修改移动端tooltip时加的isMobile判断)\n if (isMobile()) {\n return;\n }\n if (this._attachInfo?.tooltipOptions?.referencePosition) {\n const position = this._attachInfo.tooltipOptions.referencePosition;\n const { event } = e;\n const { left, right, top, bottom } = position.rect;\n const abstractPos = table._getMouseAbstractPoint(event, false);\n if (\n !(\n abstractPos.inTable &&\n abstractPos.x >= left - 5 &&\n abstractPos.x <= right + 5 &&\n abstractPos.y >= top - 5 &&\n abstractPos.y <= bottom + 5\n )\n ) {\n // 这里加5px的判断buffer\n this._unbindFromCell();\n }\n }\n // dropDownMenu区域不响应\n if (this._attachInfo && table.stateManager.menu.isShow) {\n this._bindToCell(e.col, e.row);\n }\n });\n table.on(TABLE_EVENT_TYPE.MOUSELEAVE_CELL, e => {\n // if (e.related) {\n // if (this._isBindCell(e.related.col, e.related.row)) {\n // return;\n // }\n // }\n this._unbindFromCell();\n });\n table.on(TABLE_EVENT_TYPE.SELECTED_CELL, e => {\n if (this._isBindCell(e.col, e.row)) {\n this._unbindFromCell();\n }\n });\n table.on(TABLE_EVENT_TYPE.MOUSELEAVE_TABLE, e => {\n this._unbindFromCell();\n });\n table.on(TABLE_EVENT_TYPE.SCROLL, e => {\n this._unbindFromCell();\n // const info = this._attachInfo;\n // if (info?.tooltipOptions && info?.range?.start) {\n // const { col, row } = info.range.start;\n // const rect = table.getCellRangeRelativeRect({ col, row });\n // info.tooltipOptions.referencePosition.rect = rect;\n // this._move(info.range.start.col, info.range.start.row, info.tooltipOptions);\n // }\n });\n }\n showTooltip(col: number, row: number) {\n let tooltipOption;\n const table = this._table;\n const headerDescription = table.getHeaderDescription(col, row);\n if (headerDescription) {\n const rect = table.getCellRangeRelativeRect({ col, row });\n tooltipOption = {\n content: headerDescription,\n referencePosition: {\n placement: table.internalProps.tooltip.position,\n rect\n },\n disappearDelay: table.internalProps.tooltip.overflowTextTooltipDisappearDelay ?? 0,\n style: table.theme.tooltipStyle\n };\n } else if (\n isFunction(table.internalProps.tooltip?.isShowOverflowTextTooltip)\n ? table.internalProps.tooltip.isShowOverflowTextTooltip(col, row, table)\n : table.internalProps.tooltip.isShowOverflowTextTooltip\n ) {\n const overflowText = table.getCellOverflowText(col, row);\n const rect = table.getCellRangeRelativeRect({ col, row });\n if (overflowText) {\n tooltipOption = {\n content: headerDescription\n ? `${headerDescription}\n ${overflowText}`\n : overflowText,\n referencePosition: {\n placement: table.internalProps.tooltip.position,\n rect\n },\n disappearDelay: table.internalProps.tooltip.overflowTextTooltipDisappearDelay ?? 0,\n style: table.theme.tooltipStyle\n };\n }\n }\n if (tooltipOption) {\n this._bindToCell(col, row, tooltipOption);\n } else {\n this._unbindFromCell();\n }\n }\n _getTooltipInstanceInfo(col: number, row: number): BaseTooltip | null {\n const table = this._table;\n const tooltipInstances = this._tooltipInstances;\n // const info = getTooltipInstanceInfo(table, col, row, tooltipOptions);\n // if (!info) {\n // return null;\n // }\n const tooltipType = 'bubble-tooltip';\n // const { tooltipType } = info;\n const instance =\n (tooltipInstances && tooltipInstances[tooltipType]) ||\n (tooltipInstances && (tooltipInstances[tooltipType] = TOOLTIP_INSTANCE_FACTORY[tooltipType](table)));\n return instance;\n }\n isBinded(tooltipOptions: TooltipOptions) {\n if (JSON.stringify(tooltipOptions) === JSON.stringify(this._attachInfo?.tooltipOptions)) {\n return true;\n }\n return false;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/tooltip/TooltipHandler.ts"],"names":[],"mappings":";;;AAGA,uCAA0C;AAC1C,+CAAiD;AACjD,2CAA4C;AAG5C,kEAA+D;AAE/D,6CAA8C;AAC9C,MAAM,wBAAwB,GAAG;IAI/B,gBAAgB,EAAE,UAAU,KAAmB;QAC7C,OAAO,IAAI,uBAAa,CAAC,KAAK,CA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,CAAC,MAAA,IAAI,CAAC,WAAW,0CAAE,cAAc,CAAC,EAAE;YACvF,OAAO,IAAI,CAAC;SACb;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAhOD,wCAgOC","file":"TooltipHandler.js","sourcesContent":["import type { CellRange, RectProps } from '../../ts-types';\nimport type { Placement } from '../../ts-types';\nimport type { BaseTooltip } from './BaseTooltip';\nimport { BubbleTooltip } from './Tooltip';\nimport { cellInRange } from '../../tools/helper';\nimport { isMobile } from '../../tools/util';\n// import { DG_EVENT_TYPE } from '../core/DG_EVENT_TYPE';\nimport type { TooltipOptions } from '../../ts-types/tooltip';\nimport { TABLE_EVENT_TYPE } from '../../core/TABLE_EVENT_TYPE';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport { isFunction } from '@visactor/vutils';\nconst TOOLTIP_INSTANCE_FACTORY = {\n // tooltip(table: BaseTableAPI): BaseTooltip {\n // return new Tooltip(table);\n // },\n 'bubble-tooltip': function (table: BaseTableAPI): BaseTooltip {\n return new BubbleTooltip(table);\n }\n};\ntype AttachInfo = {\n instance?: BaseTooltip;\n range: CellRange;\n tooltipOptions: TooltipOptions;\n};\nexport interface ITooltipHandler {\n new (table: BaseTableAPI, confine: boolean): TooltipHandler;\n}\n\nexport class TooltipHandler {\n private _table: BaseTableAPI;\n private _tooltipInstances?: { [type: string]: BaseTooltip };\n private _attachInfo?: AttachInfo | null;\n private confine?: boolean; //弹出框是否需要限定在canvas区域\n constructor(table: BaseTableAPI, confine: boolean) {\n this._table = table;\n this._tooltipInstances = {};\n this._bindTableEvent(table);\n this.confine = confine;\n }\n release(): void {\n const tooltipInstances = this._tooltipInstances;\n for (const k in tooltipInstances) {\n tooltipInstances[k]?.release?.();\n }\n delete this._tooltipInstances;\n this._attachInfo = null;\n }\n _bindToCell(col: number, row: number, tooltipOptions?: TooltipOptions): void {\n const info = this._attachInfo;\n const instance = this._getTooltipInstanceInfo(col, row);\n if (info && (!instance || info.instance !== instance)) {\n info.instance?.unbindTooltipElement();\n this._attachInfo = null;\n }\n if (!instance) {\n return;\n }\n // const { instance, info: tooltipInstanceInfo } = instanceInfo;\n const attach = instance && instance.bindTooltipElement(col, row, tooltipOptions, this.confine);\n if (attach) {\n const range = this._table.getCellRange(col, row);\n this._attachInfo = { range, instance, tooltipOptions };\n }\n }\n _move(col: number, row: number, tooltipOptions: TooltipOptions): void {\n const info = this._attachInfo;\n if (!info || !cellInRange(info.range, col, row)) {\n return;\n }\n const { instance } = info;\n instance?.moveTooltipElement(col, row, tooltipOptions, this.confine);\n }\n moveToPosition(\n col: number,\n row: number,\n position?: { x: number; y: number },\n referencePosition?: {\n rect: RectProps;\n placement?: Placement;\n }\n ): void {\n const info = this._attachInfo;\n if (!info || !cellInRange(info.range, col, row)) {\n return;\n }\n const { instance } = info;\n this._attachInfo.tooltipOptions.position = position;\n this._attachInfo.tooltipOptions.referencePosition = referencePosition;\n instance?.locateTooltipElement(col, row, position, referencePosition, this.confine);\n }\n _unbindFromCell(): void {\n const info = this._attachInfo;\n if (!info) {\n return;\n }\n const { instance } = info;\n instance?.unbindTooltipElement();\n this._attachInfo = null;\n }\n _isBindCell(col: number, row: number): boolean {\n const info = this._attachInfo;\n if (!info) {\n return false;\n }\n return cellInRange(info.range, col, row);\n }\n _bindTableEvent(table: BaseTableAPI): void {\n // (table.options.hover?.isShowTooltip || table.options.tooltip?.isShowOverflowTextTooltip) &&\n table.on(TABLE_EVENT_TYPE.MOUSEENTER_CELL, e => {\n //移动端不监听mousemove事件 (修改移动端tooltip时加的isMobile判断)\n if (isMobile()) {\n return;\n }\n // dropDownMenu区域不响应\n const { x1: left, x2: right, y1: top, y2: bottom } = table.stateManager.menu.bounds;\n if (\n table.stateManager.menu.isShow &&\n typeof e.x === 'number' &&\n typeof e.y === 'number' &&\n e.x > left &&\n e.x < right &&\n e.y > top &&\n e.y < bottom\n ) {\n return;\n }\n const { col, row } = e;\n this.showTooltip(col, row);\n // if (e.related) {\n // if (this._isBindCell(col, row)) {\n // return;\n // }\n // }\n });\n table.on(TABLE_EVENT_TYPE.MOUSEMOVE_CELL, e => {\n //移动端不监听mousemove事件 (修改移动端tooltip时加的isMobile判断)\n if (isMobile()) {\n return;\n }\n if (this._attachInfo?.tooltipOptions?.referencePosition) {\n const position = this._attachInfo.tooltipOptions.referencePosition;\n const { event } = e;\n const { left, right, top, bottom } = position.rect;\n const abstractPos = table._getMouseAbstractPoint(event);\n if (\n !(\n abstractPos.inTable &&\n abstractPos.x >= left - 5 &&\n abstractPos.x <= right + 5 &&\n abstractPos.y >= top - 5 &&\n abstractPos.y <= bottom + 5\n )\n ) {\n // 这里加5px的判断buffer\n this._unbindFromCell();\n }\n }\n // dropDownMenu区域不响应\n if (this._attachInfo && table.stateManager.menu.isShow) {\n this._bindToCell(e.col, e.row);\n }\n });\n table.on(TABLE_EVENT_TYPE.MOUSELEAVE_CELL, e => {\n // if (e.related) {\n // if (this._isBindCell(e.related.col, e.related.row)) {\n // return;\n // }\n // }\n this._unbindFromCell();\n });\n table.on(TABLE_EVENT_TYPE.SELECTED_CELL, e => {\n if (this._isBindCell(e.col, e.row)) {\n this._unbindFromCell();\n }\n });\n table.on(TABLE_EVENT_TYPE.MOUSELEAVE_TABLE, e => {\n this._unbindFromCell();\n });\n table.on(TABLE_EVENT_TYPE.SCROLL, e => {\n this._unbindFromCell();\n // const info = this._attachInfo;\n // if (info?.tooltipOptions && info?.range?.start) {\n // const { col, row } = info.range.start;\n // const rect = table.getCellRangeRelativeRect({ col, row });\n // info.tooltipOptions.referencePosition.rect = rect;\n // this._move(info.range.start.col, info.range.start.row, info.tooltipOptions);\n // }\n });\n }\n showTooltip(col: number, row: number) {\n let tooltipOption;\n const table = this._table;\n const headerDescription = table.getHeaderDescription(col, row);\n if (headerDescription) {\n const rect = table.getCellRangeRelativeRect({ col, row });\n tooltipOption = {\n content: headerDescription,\n referencePosition: {\n placement: table.internalProps.tooltip.position,\n rect\n },\n disappearDelay: table.internalProps.tooltip.overflowTextTooltipDisappearDelay ?? 0,\n style: table.theme.tooltipStyle\n };\n } else if (\n isFunction(table.internalProps.tooltip?.isShowOverflowTextTooltip)\n ? table.internalProps.tooltip.isShowOverflowTextTooltip(col, row, table)\n : table.internalProps.tooltip.isShowOverflowTextTooltip\n ) {\n const overflowText = table.getCellOverflowText(col, row);\n const rect = table.getCellRangeRelativeRect({ col, row });\n if (overflowText) {\n tooltipOption = {\n content: headerDescription\n ? `${headerDescription}\n ${overflowText}`\n : overflowText,\n referencePosition: {\n placement: table.internalProps.tooltip.position,\n rect\n },\n disappearDelay: table.internalProps.tooltip.overflowTextTooltipDisappearDelay ?? 0,\n style: table.theme.tooltipStyle\n };\n }\n }\n if (tooltipOption) {\n this._bindToCell(col, row, tooltipOption);\n } else {\n this._unbindFromCell();\n }\n }\n _getTooltipInstanceInfo(col: number, row: number): BaseTooltip | null {\n const table = this._table;\n const tooltipInstances = this._tooltipInstances;\n // const info = getTooltipInstanceInfo(table, col, row, tooltipOptions);\n // if (!info) {\n // return null;\n // }\n const tooltipType = 'bubble-tooltip';\n // const { tooltipType } = info;\n const instance =\n (tooltipInstances && tooltipInstances[tooltipType]) ||\n (tooltipInstances && (tooltipInstances[tooltipType] = TOOLTIP_INSTANCE_FACTORY[tooltipType](table)));\n return instance;\n }\n isBinded(tooltipOptions: TooltipOptions) {\n if (JSON.stringify(tooltipOptions) === JSON.stringify(this._attachInfo?.tooltipOptions)) {\n return true;\n }\n return false;\n }\n}\n"]}
|
package/cjs/core/BaseTable.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { TABLE_EVENT_TYPE } from './TABLE_EVENT_TYPE';
|
|
|
4
4
|
import { EventTarget } from '../event/EventTarget';
|
|
5
5
|
import { NumberMap } from '../tools/NumberMap';
|
|
6
6
|
import { Rect } from '../tools/Rect';
|
|
7
|
-
import type { TableTheme } from '../themes/theme';
|
|
7
|
+
import type { TableTheme } from '../themes/theme-define';
|
|
8
8
|
import { Scenegraph } from '../scenegraph/scenegraph';
|
|
9
9
|
import { StateManager } from '../state/state';
|
|
10
10
|
import { EventManager } from '../event/event';
|
|
@@ -23,6 +23,7 @@ import type { EditManager } from '../edit/edit-manager';
|
|
|
23
23
|
import { TableAnimationManager } from './animation';
|
|
24
24
|
import type { ITableAnimationOption } from '../ts-types/animation/appear';
|
|
25
25
|
import type { CustomCellStylePlugin } from '../plugins/custom-cell-style';
|
|
26
|
+
import { PluginManager } from '../plugins/plugin-manager';
|
|
26
27
|
export declare abstract class BaseTable extends EventTarget implements BaseTableAPI {
|
|
27
28
|
internalProps: IBaseTableProtected;
|
|
28
29
|
showFrozenIcon: boolean;
|
|
@@ -77,6 +78,8 @@ export declare abstract class BaseTable extends EventTarget implements BaseTable
|
|
|
77
78
|
columnWidthComputeMode?: 'normal' | 'only-header' | 'only-body';
|
|
78
79
|
reactCustomLayout?: ReactCustomLayout;
|
|
79
80
|
_hasAutoImageColumn?: boolean;
|
|
81
|
+
pluginManager: PluginManager;
|
|
82
|
+
rotateDegree?: number;
|
|
80
83
|
constructor(container: HTMLElement, options?: BaseTableConstructorOptions);
|
|
81
84
|
_adjustCanvasSizeByOption(): void;
|
|
82
85
|
throttleInvalidate: (this: any, ...args: any[]) => void;
|
|
@@ -176,6 +179,7 @@ export declare abstract class BaseTable extends EventTarget implements BaseTable
|
|
|
176
179
|
_setColContentWidth(col: number, width: string | number): void;
|
|
177
180
|
getAllRowsHeight(): number;
|
|
178
181
|
getAllColsWidth(): number;
|
|
182
|
+
getColsWidths(): number[];
|
|
179
183
|
getMaxColWidth(col: number): number;
|
|
180
184
|
setMaxColWidth(col: number, maxwidth: string | number): void;
|
|
181
185
|
getMinColWidth(col: number): number;
|
|
@@ -252,7 +256,7 @@ export declare abstract class BaseTable extends EventTarget implements BaseTable
|
|
|
252
256
|
getBottomFrozenRowsHeight(): number;
|
|
253
257
|
getRightFrozenColsWidth(): number;
|
|
254
258
|
getDrawRange(): Rect;
|
|
255
|
-
_getMouseAbstractPoint(evt: TouchEvent | MouseEvent | undefined
|
|
259
|
+
_getMouseAbstractPoint(evt: TouchEvent | MouseEvent | undefined): {
|
|
256
260
|
x: number;
|
|
257
261
|
y: number;
|
|
258
262
|
inTable: boolean;
|
package/cjs/core/BaseTable.js
CHANGED
|
@@ -33,7 +33,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
33
33
|
value: !0
|
|
34
34
|
}), exports.BaseTable = void 0;
|
|
35
35
|
|
|
36
|
-
const columnStyleContents = __importStar(require("../body-helper/style")), style_1 = require("./style"), style = __importStar(require("../tools/style")), ts_types_1 = require("../ts-types"), helper_1 = require("../tools/helper"), TABLE_EVENT_TYPE_1 = require("./TABLE_EVENT_TYPE"), EventHandler_1 = require("../event/EventHandler"), EventTarget_1 = require("../event/EventTarget"), NumberMap_1 = require("../tools/NumberMap"), Rect_1 = require("../tools/Rect"), util_1 = require("../tools/util"), themes_1 = __importDefault(require("../themes")), env_1 = require("../tools/env"), scenegraph_1 = require("../scenegraph/scenegraph"), state_1 = require("../state/state"), event_1 = require("../event/event"), body_helper_1 = require("../body-helper/body-helper"), header_helper_1 = require("../header-helper/header-helper"), vutils_1 = require("@visactor/vutils"), text_measure_1 = require("../scenegraph/utils/text-measure"), get_prop_1 = require("../scenegraph/utils/get-prop"),
|
|
36
|
+
const columnStyleContents = __importStar(require("../body-helper/style")), style_1 = require("./style"), style = __importStar(require("../tools/style")), ts_types_1 = require("../ts-types"), helper_1 = require("../tools/helper"), TABLE_EVENT_TYPE_1 = require("./TABLE_EVENT_TYPE"), EventHandler_1 = require("../event/EventHandler"), EventTarget_1 = require("../event/EventTarget"), NumberMap_1 = require("../tools/NumberMap"), Rect_1 = require("../tools/Rect"), util_1 = require("../tools/util"), themes_1 = __importDefault(require("../themes")), env_1 = require("../tools/env"), scenegraph_1 = require("../scenegraph/scenegraph"), state_1 = require("../state/state"), event_1 = require("../event/event"), body_helper_1 = require("../body-helper/body-helper"), header_helper_1 = require("../header-helper/header-helper"), vutils_1 = require("@visactor/vutils"), text_measure_1 = require("../scenegraph/utils/text-measure"), get_prop_1 = require("../scenegraph/utils/get-prop"), tableHelper_1 = require("./tableHelper"), FouseInput_1 = require("./FouseInput"), pixel_ratio_1 = require("../tools/pixel-ratio"), chart_render_helper_1 = require("../scenegraph/graphic/contributions/chart-render-helper"), row_height_map_1 = require("../layout/row-height-map"), row_series_number_helper_1 = require("./row-series-number-helper"), update_select_border_1 = require("../scenegraph/select/update-select-border"), react_custom_layout_1 = require("../components/react/react-custom-layout"), layout_helper_1 = require("../layout/layout-helper"), factory_1 = require("./factory"), get_cell_position_1 = require("./utils/get-cell-position"), style_helper_1 = require("./style-helper"), frozen_react_1 = require("../scenegraph/layout/frozen-react"), icons_1 = require("../icons"), animation_1 = require("./animation"), check_in_select_1 = require("../state/common/check-in-select"), is_cell_select_highlight_1 = require("../state/select/is-cell-select-highlight"), get_custom_merge_cell_func_1 = require("./utils/get-custom-merge-cell-func"), vrender_1 = require("./../vrender"), plugin_manager_1 = require("../plugins/plugin-manager"), {toBoxArray: toBoxArray} = helper_1.style, {isTouchEvent: isTouchEvent} = helper_1.event, rangeReg = /^\$(\d+)\$(\d+)$/;
|
|
37
37
|
|
|
38
38
|
(0, style_1.importStyle)();
|
|
39
39
|
|
|
@@ -43,11 +43,16 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
43
43
|
}
|
|
44
44
|
constructor(container, options = {}) {
|
|
45
45
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
46
|
-
if (super(), this.showFrozenIcon = !0, this.version = "1.
|
|
46
|
+
if (super(), this.showFrozenIcon = !0, this.version = "1.0.2", this.id = `VTable${Date.now()}`,
|
|
47
47
|
this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = (0, util_1.throttle2)(this.render.bind(this), 200),
|
|
48
|
-
|
|
48
|
+
"node" === env_1.Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container,
|
|
49
|
+
container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
|
|
50
|
+
this.pluginManager = new plugin_manager_1.PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE_1.TABLE_EVENT_TYPE.BEFORE_INIT, {
|
|
51
|
+
options: options,
|
|
52
|
+
container: container
|
|
53
|
+
}), container = options.container && options.container instanceof HTMLElement ? options.container : container,
|
|
49
54
|
!1 === (null === (_a = options.customConfig) || void 0 === _a ? void 0 : _a.imageAnonymous) && (vrender_1.vglobal.isImageAnonymous = !1);
|
|
50
|
-
const {frozenColCount: frozenColCount = 0, unfreezeAllOnExceedsMaxWidth: unfreezeAllOnExceedsMaxWidth, frozenRowCount: frozenRowCount, defaultRowHeight: defaultRowHeight = 40, defaultHeaderRowHeight: defaultHeaderRowHeight, defaultColWidth: defaultColWidth = 80, defaultHeaderColWidth: defaultHeaderColWidth, widthMode: widthMode = "standard", heightMode: heightMode = "standard", autoFillWidth: autoFillWidth = !1, autoFillHeight: autoFillHeight = !1, widthAdaptiveMode: widthAdaptiveMode = "only-body", heightAdaptiveMode: heightAdaptiveMode = "only-body", keyboardOptions: keyboardOptions, eventOptions: eventOptions, rowSeriesNumber: rowSeriesNumber, columnResizeMode: columnResizeMode, rowResizeMode: rowResizeMode = "none", resize: resize, dragHeaderMode: dragHeaderMode, dragOrder: dragOrder, showFrozenIcon: showFrozenIcon, allowFrozenColCount: allowFrozenColCount, padding: padding, hover: hover, menu: menu, select: click, customRender: customRender, pixelRatio: pixelRatio = pixel_ratio_1.defaultPixelRatio, renderChartAsync: renderChartAsync, renderChartAsyncBatchCount: renderChartAsyncBatchCount, mode: mode, modeParams: modeParams, canvasWidth: canvasWidth, canvasHeight: canvasHeight, overscrollBehavior: overscrollBehavior, limitMinWidth: limitMinWidth, limitMinHeight: limitMinHeight, clearDOM: clearDOM = !0} = options;
|
|
55
|
+
const {frozenColCount: frozenColCount = 0, unfreezeAllOnExceedsMaxWidth: unfreezeAllOnExceedsMaxWidth, frozenRowCount: frozenRowCount, defaultRowHeight: defaultRowHeight = 40, defaultHeaderRowHeight: defaultHeaderRowHeight, defaultColWidth: defaultColWidth = 80, defaultHeaderColWidth: defaultHeaderColWidth, widthMode: widthMode = "standard", heightMode: heightMode = "standard", autoFillWidth: autoFillWidth = !1, autoFillHeight: autoFillHeight = !1, widthAdaptiveMode: widthAdaptiveMode = "only-body", heightAdaptiveMode: heightAdaptiveMode = "only-body", keyboardOptions: keyboardOptions, eventOptions: eventOptions, rowSeriesNumber: rowSeriesNumber, enableCheckboxCascade: enableCheckboxCascade, columnResizeMode: columnResizeMode, rowResizeMode: rowResizeMode = "none", resize: resize, dragHeaderMode: dragHeaderMode, dragOrder: dragOrder, showFrozenIcon: showFrozenIcon, allowFrozenColCount: allowFrozenColCount, padding: padding, hover: hover, menu: menu, select: click, customRender: customRender, pixelRatio: pixelRatio = pixel_ratio_1.defaultPixelRatio, renderChartAsync: renderChartAsync, renderChartAsyncBatchCount: renderChartAsyncBatchCount, mode: mode, modeParams: modeParams, canvasWidth: canvasWidth, canvasHeight: canvasHeight, overscrollBehavior: overscrollBehavior, limitMinWidth: limitMinWidth, limitMinHeight: limitMinHeight, clearDOM: clearDOM = !0} = options;
|
|
51
56
|
this.container = container, this.options = options, this._widthMode = widthMode,
|
|
52
57
|
this._heightMode = heightMode, this._widthAdaptiveMode = widthAdaptiveMode, this._heightAdaptiveMode = heightAdaptiveMode,
|
|
53
58
|
this._autoFillWidth = autoFillWidth, this._autoFillHeight = autoFillHeight, this.customRender = customRender,
|
|
@@ -79,7 +84,8 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
79
84
|
internalProps.defaultRowHeight = defaultRowHeight, internalProps.defaultHeaderRowHeight = null != defaultHeaderRowHeight ? defaultHeaderRowHeight : defaultRowHeight,
|
|
80
85
|
internalProps.defaultColWidth = defaultColWidth, internalProps.defaultHeaderColWidth = null != defaultHeaderColWidth ? defaultHeaderColWidth : defaultColWidth,
|
|
81
86
|
internalProps.keyboardOptions = keyboardOptions, internalProps.eventOptions = eventOptions,
|
|
82
|
-
internalProps.rowSeriesNumber = rowSeriesNumber, internalProps.
|
|
87
|
+
internalProps.rowSeriesNumber = rowSeriesNumber, internalProps.enableCheckboxCascade = enableCheckboxCascade,
|
|
88
|
+
internalProps.columnResizeMode = null !== (_d = null == resize ? void 0 : resize.columnResizeMode) && void 0 !== _d ? _d : columnResizeMode,
|
|
83
89
|
internalProps.rowResizeMode = null !== (_e = null == resize ? void 0 : resize.rowResizeMode) && void 0 !== _e ? _e : rowResizeMode,
|
|
84
90
|
internalProps.dragHeaderMode = null !== (_g = null !== (_f = null == dragOrder ? void 0 : dragOrder.dragHeaderMode) && void 0 !== _f ? _f : dragHeaderMode) && void 0 !== _g ? _g : "none",
|
|
85
91
|
internalProps.renderChartAsync = renderChartAsync, (0, chart_render_helper_1.setBatchRenderChartCount)(renderChartAsyncBatchCount),
|
|
@@ -96,7 +102,7 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
96
102
|
return "node" === env_1.Env.mode ? that.canvasWidth / (null != pixelRatio ? pixelRatio : 1) : this._.canvas.width / (null !== (_a = this._.context.pixelRatio) && void 0 !== _a ? _a : window.devicePixelRatio);
|
|
97
103
|
}
|
|
98
104
|
}, internalProps.cellTextOverflows = {}, internalProps.focusedTable = !1, internalProps.theme = themes_1.default.of(null !== (_h = options.theme) && void 0 !== _h ? _h : themes_1.default.DEFAULT),
|
|
99
|
-
internalProps.theme.isPivot = this.isPivotTable(), (0,
|
|
105
|
+
internalProps.theme.isPivot = this.isPivotTable(), (0, icons_1.setIconColor)(internalProps.theme.functionalIconsStyle),
|
|
100
106
|
container ? (clearDOM && (container.innerHTML = ""), container.appendChild(internalProps.element),
|
|
101
107
|
this._updateSize()) : this._updateSize(), internalProps.bodyHelper = new body_helper_1.BodyHelper(this),
|
|
102
108
|
internalProps.headerHelper = new header_helper_1.HeaderHelper(this), internalProps.rowSeriesNumberHelper = new row_series_number_helper_1.RowSeriesNumberHelper(this),
|
|
@@ -450,6 +456,7 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
450
456
|
this.tableNoFrameWidth = width - ((null !== (_y = lineWidths[1]) && void 0 !== _y ? _y : 0) + (null !== (_z = shadowWidths[1]) && void 0 !== _z ? _z : 0)) - ((null !== (_0 = lineWidths[3]) && void 0 !== _0 ? _0 : 0) + (null !== (_1 = shadowWidths[3]) && void 0 !== _1 ? _1 : 0)),
|
|
451
457
|
this.tableNoFrameHeight = height - ((null !== (_2 = lineWidths[0]) && void 0 !== _2 ? _2 : 0) + (null !== (_3 = shadowWidths[0]) && void 0 !== _3 ? _3 : 0)) - ((null !== (_4 = lineWidths[2]) && void 0 !== _4 ? _4 : 0) + (null !== (_5 = shadowWidths[2]) && void 0 !== _5 ? _5 : 0)));
|
|
452
458
|
}
|
|
459
|
+
this._clearColRangeWidthsMap(), this._clearRowRangeHeightsMap();
|
|
453
460
|
}
|
|
454
461
|
updateViewBox(newViewBox) {
|
|
455
462
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
@@ -587,6 +594,11 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
587
594
|
if (this.internalProps.colCount <= 0) return 0;
|
|
588
595
|
return this.getColsWidth(0, this.internalProps.colCount - 1);
|
|
589
596
|
}
|
|
597
|
+
getColsWidths() {
|
|
598
|
+
const maxCount = this.colCount, widths = [];
|
|
599
|
+
for (let col = 0; col < maxCount; col++) widths.push(this.getColWidth(col));
|
|
600
|
+
return widths;
|
|
601
|
+
}
|
|
590
602
|
getMaxColWidth(col) {
|
|
591
603
|
var _a;
|
|
592
604
|
const obj = this.colWidthsLimit[col];
|
|
@@ -658,13 +670,13 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
658
670
|
getCellsRect(startCol, startRow, endCol, endRow) {
|
|
659
671
|
var _a, _b, _c, _d, _e, _f;
|
|
660
672
|
let absoluteLeft = this.getColsWidth(0, startCol - 1) || 0, width = this.getColsWidth(startCol, endCol);
|
|
661
|
-
const scrollLeft = this.scrollLeft;
|
|
662
|
-
this.isLeftFrozenColumn(startCol) && this.isRightFrozenColumn(endCol) ? width = this.tableNoFrameWidth - (null !== (_a = this.getColsWidth(startCol + 1, this.colCount - 1)) && void 0 !== _a ? _a : 0) - absoluteLeft : this.isLeftFrozenColumn(startCol) && !this.isLeftFrozenColumn(endCol) ? width = Math.max(width - scrollLeft, this.getColsWidth(startCol, this.frozenColCount - 1)) : !this.isRightFrozenColumn(startCol) && this.isRightFrozenColumn(endCol) ? (absoluteLeft = Math.min(absoluteLeft - scrollLeft,
|
|
663
|
-
width =
|
|
673
|
+
const scrollLeft = this.scrollLeft, tableWidth = Math.min(this.tableNoFrameWidth, this.getAllColsWidth()), tableHeight = Math.min(this.tableNoFrameHeight, this.getAllRowsHeight());
|
|
674
|
+
this.isLeftFrozenColumn(startCol) && this.isRightFrozenColumn(endCol) ? width = this.tableNoFrameWidth - (null !== (_a = this.getColsWidth(startCol + 1, this.colCount - 1)) && void 0 !== _a ? _a : 0) - absoluteLeft : this.isLeftFrozenColumn(startCol) && !this.isLeftFrozenColumn(endCol) ? width = Math.max(width - scrollLeft, this.getColsWidth(startCol, this.frozenColCount - 1)) : !this.isRightFrozenColumn(startCol) && this.isRightFrozenColumn(endCol) ? (absoluteLeft = Math.min(absoluteLeft - scrollLeft, tableWidth - this.getRightFrozenColsWidth()),
|
|
675
|
+
width = tableWidth - (null !== (_b = this.getColsWidth(startCol + 1, this.colCount - 1)) && void 0 !== _b ? _b : 0) - absoluteLeft) : this.isRightFrozenColumn(startCol) && (absoluteLeft = tableWidth - (null !== (_c = this.getColsWidth(startCol, this.colCount - 1)) && void 0 !== _c ? _c : 0));
|
|
664
676
|
let absoluteTop = this.getRowsHeight(0, startRow - 1), height = this.getRowsHeight(startRow, endRow);
|
|
665
677
|
const scrollTop = this.scrollTop;
|
|
666
|
-
return this.isTopFrozenRow(startRow) && this.isBottomFrozenRow(endRow) ? height = this.tableNoFrameHeight - (null !== (_d = this.getRowsHeight(startRow + 1, this.rowCount - 1)) && void 0 !== _d ? _d : 0) - absoluteTop : this.isTopFrozenRow(startRow) && !this.isTopFrozenRow(endRow) ? height = Math.max(height - scrollTop, this.getRowsHeight(startRow, this.frozenRowCount - 1)) : !this.isBottomFrozenRow(startRow) && this.isBottomFrozenRow(endRow) ? (absoluteTop = Math.min(absoluteTop - scrollTop,
|
|
667
|
-
height =
|
|
678
|
+
return this.isTopFrozenRow(startRow) && this.isBottomFrozenRow(endRow) ? height = this.tableNoFrameHeight - (null !== (_d = this.getRowsHeight(startRow + 1, this.rowCount - 1)) && void 0 !== _d ? _d : 0) - absoluteTop : this.isTopFrozenRow(startRow) && !this.isTopFrozenRow(endRow) ? height = Math.max(height - scrollTop, this.getRowsHeight(startRow, this.frozenRowCount - 1)) : !this.isBottomFrozenRow(startRow) && this.isBottomFrozenRow(endRow) ? (absoluteTop = Math.min(absoluteTop - scrollTop, tableHeight - this.getBottomFrozenRowsHeight()),
|
|
679
|
+
height = tableHeight - (null !== (_e = this.getRowsHeight(startRow + 1, this.rowCount - 1)) && void 0 !== _e ? _e : 0) - absoluteTop) : this.isBottomFrozenRow(startRow) && (absoluteTop = tableHeight - (null !== (_f = this.getRowsHeight(startRow, this.rowCount - 1)) && void 0 !== _f ? _f : 0)),
|
|
668
680
|
new Rect_1.Rect(Math.round(absoluteLeft), Math.round(absoluteTop), Math.round(width), Math.round(height));
|
|
669
681
|
}
|
|
670
682
|
getCellsRectWidth(startCol, startRow, endCol, endRow) {
|
|
@@ -829,8 +841,7 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
829
841
|
if (this.isReleased) return;
|
|
830
842
|
null === (_b = null === (_a = internalProps.tooltipHandler) || void 0 === _a ? void 0 : _a.release) || void 0 === _b || _b.call(_a),
|
|
831
843
|
null === (_d = null === (_c = internalProps.menuHandler) || void 0 === _c ? void 0 : _c.release) || void 0 === _d || _d.call(_c),
|
|
832
|
-
|
|
833
|
-
null === (_g = null === (_f = internalProps.handler) || void 0 === _f ? void 0 : _f.release) || void 0 === _g || _g.call(_f),
|
|
844
|
+
null === (_e = super.release) || void 0 === _e || _e.call(this), null === (_g = null === (_f = internalProps.handler) || void 0 === _f ? void 0 : _f.release) || void 0 === _g || _g.call(_f),
|
|
834
845
|
this.eventManager.release(), null === (_j = null === (_h = internalProps.focusControl) || void 0 === _h ? void 0 : _h.release) || void 0 === _j || _j.call(_h),
|
|
835
846
|
null === (_k = internalProps.legends) || void 0 === _k || _k.forEach((legend => {
|
|
836
847
|
null == legend || legend.release();
|
|
@@ -845,15 +856,16 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
845
856
|
parentElement && !this.options.canvas && parentElement.removeChild(internalProps.element),
|
|
846
857
|
null === (_q = null === (_p = null === (_o = this.editorManager) || void 0 === _o ? void 0 : _o.editingEditor) || void 0 === _p ? void 0 : _p.onEnd) || void 0 === _q || _q.call(_p),
|
|
847
858
|
this.isReleased = !0, this.scenegraph = null, this.internalProps = null, null === (_r = this.reactCustomLayout) || void 0 === _r || _r.clearCache(),
|
|
848
|
-
(0, chart_render_helper_1.clearChartRenderQueue)();
|
|
859
|
+
this.pluginManager.release(), (0, chart_render_helper_1.clearChartRenderQueue)();
|
|
849
860
|
}
|
|
850
861
|
fireListeners(type, event) {
|
|
851
862
|
return super.fireListeners(type, event);
|
|
852
863
|
}
|
|
853
864
|
updateOption(options) {
|
|
854
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
855
|
-
this.
|
|
856
|
-
|
|
865
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
866
|
+
null === (_a = this.editorManager) || void 0 === _a || _a.cancelEdit(), this.options = options,
|
|
867
|
+
this._hasAutoImageColumn = void 0;
|
|
868
|
+
const {frozenColCount: frozenColCount = 0, unfreezeAllOnExceedsMaxWidth: unfreezeAllOnExceedsMaxWidth, defaultRowHeight: defaultRowHeight = 40, defaultHeaderRowHeight: defaultHeaderRowHeight, defaultColWidth: defaultColWidth = 80, defaultHeaderColWidth: defaultHeaderColWidth = 80, keyboardOptions: keyboardOptions, eventOptions: eventOptions, rowSeriesNumber: rowSeriesNumber, enableCheckboxCascade: enableCheckboxCascade, columnResizeMode: columnResizeMode, rowResizeMode: rowResizeMode = "none", resize: resize, dragHeaderMode: dragHeaderMode, dragOrder: dragOrder, showFrozenIcon: showFrozenIcon, allowFrozenColCount: allowFrozenColCount, padding: padding, hover: hover, menu: menu, select: click, pixelRatio: pixelRatio, widthMode: widthMode, heightMode: heightMode, autoFillWidth: autoFillWidth, autoFillHeight: autoFillHeight, widthAdaptiveMode: widthAdaptiveMode, heightAdaptiveMode: heightAdaptiveMode, customRender: customRender, renderChartAsync: renderChartAsync, renderChartAsyncBatchCount: renderChartAsyncBatchCount, canvasWidth: canvasWidth, canvasHeight: canvasHeight, overscrollBehavior: overscrollBehavior, limitMinWidth: limitMinWidth, limitMinHeight: limitMinHeight} = options;
|
|
857
869
|
pixelRatio && pixelRatio !== this.internalProps.pixelRatio && (this.internalProps.pixelRatio = pixelRatio),
|
|
858
870
|
padding && ("number" == typeof padding ? (this.padding.top = padding, this.padding.left = padding,
|
|
859
871
|
this.padding.bottom = padding, this.padding.right = padding) : (padding.top && (this.padding.top = padding.top),
|
|
@@ -868,31 +880,32 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
868
880
|
this.canvasHeight = (0, vutils_1.isNumber)(canvasHeight) ? canvasHeight : void 0;
|
|
869
881
|
const internalProps = this.internalProps;
|
|
870
882
|
if ("node" === env_1.Env.mode || options.canvas || (0, tableHelper_1.updateRootElementPadding)(internalProps.element, this.padding),
|
|
871
|
-
this.columnWidthComputeMode = null !== (
|
|
883
|
+
this.columnWidthComputeMode = null !== (_b = options.columnWidthComputeMode) && void 0 !== _b ? _b : "normal",
|
|
872
884
|
internalProps.frozenColCount = frozenColCount, internalProps.unfreezeAllOnExceedsMaxWidth = null == unfreezeAllOnExceedsMaxWidth || unfreezeAllOnExceedsMaxWidth,
|
|
873
885
|
internalProps.defaultRowHeight = defaultRowHeight, internalProps.defaultHeaderRowHeight = null != defaultHeaderRowHeight ? defaultHeaderRowHeight : defaultRowHeight,
|
|
874
886
|
internalProps.defaultColWidth = defaultColWidth, internalProps.defaultHeaderColWidth = null != defaultHeaderColWidth ? defaultHeaderColWidth : defaultColWidth,
|
|
875
887
|
internalProps.keyboardOptions = keyboardOptions, internalProps.eventOptions = eventOptions,
|
|
876
|
-
internalProps.rowSeriesNumber = rowSeriesNumber, internalProps.
|
|
877
|
-
internalProps.
|
|
878
|
-
internalProps.
|
|
888
|
+
internalProps.rowSeriesNumber = rowSeriesNumber, internalProps.enableCheckboxCascade = enableCheckboxCascade,
|
|
889
|
+
internalProps.columnResizeMode = null !== (_c = null == resize ? void 0 : resize.columnResizeMode) && void 0 !== _c ? _c : columnResizeMode,
|
|
890
|
+
internalProps.rowResizeMode = null !== (_d = null == resize ? void 0 : resize.rowResizeMode) && void 0 !== _d ? _d : rowResizeMode,
|
|
891
|
+
internalProps.dragHeaderMode = null !== (_f = null !== (_e = null == dragOrder ? void 0 : dragOrder.dragHeaderMode) && void 0 !== _e ? _e : dragHeaderMode) && void 0 !== _f ? _f : "none",
|
|
879
892
|
internalProps.renderChartAsync = renderChartAsync, (0, chart_render_helper_1.setBatchRenderChartCount)(renderChartAsyncBatchCount),
|
|
880
893
|
internalProps.overscrollBehavior = null != overscrollBehavior ? overscrollBehavior : "auto",
|
|
881
894
|
internalProps.cellTextOverflows = {}, internalProps._rowHeightsMap = new row_height_map_1.NumberRangeMap(this),
|
|
882
895
|
internalProps._rowRangeHeightsMap = new Map, internalProps._colRangeWidthsMap = new Map,
|
|
883
896
|
internalProps._widthResizedColMap = new Set, internalProps._heightResizedRowMap = new Set,
|
|
884
897
|
this.colWidthsMap = new NumberMap_1.NumberMap, this.colContentWidthsMap = new NumberMap_1.NumberMap,
|
|
885
|
-
this.colWidthsLimit = {}, internalProps.stick.changedCells.clear(), internalProps.theme = themes_1.default.of(null !== (
|
|
886
|
-
internalProps.theme.isPivot = this.isPivotTable(), (0,
|
|
898
|
+
this.colWidthsLimit = {}, internalProps.stick.changedCells.clear(), internalProps.theme = themes_1.default.of(null !== (_g = options.theme) && void 0 !== _g ? _g : themes_1.default.DEFAULT),
|
|
899
|
+
internalProps.theme.isPivot = this.isPivotTable(), (0, icons_1.setIconColor)(internalProps.theme.functionalIconsStyle),
|
|
887
900
|
this.scenegraph.updateStageBackground(), internalProps.autoWrapText = options.autoWrapText,
|
|
888
|
-
internalProps.enableLineBreak = options.enableLineBreak, internalProps.allowFrozenColCount = null !== (
|
|
889
|
-
internalProps.limitMaxAutoWidth = null !== (
|
|
901
|
+
internalProps.enableLineBreak = options.enableLineBreak, internalProps.allowFrozenColCount = null !== (_h = options.allowFrozenColCount) && void 0 !== _h ? _h : 0,
|
|
902
|
+
internalProps.limitMaxAutoWidth = null !== (_j = options.limitMaxAutoWidth) && void 0 !== _j ? _j : 450,
|
|
890
903
|
internalProps.limitMinWidth = null != limitMinWidth ? "number" == typeof limitMinWidth ? limitMinWidth : limitMinWidth ? 10 : 0 : 10,
|
|
891
904
|
internalProps.limitMinHeight = null != limitMinHeight ? "number" == typeof limitMinHeight ? limitMinHeight : limitMinHeight ? 10 : 0 : 10,
|
|
892
|
-
null === (
|
|
905
|
+
null === (_k = internalProps.legends) || void 0 === _k || _k.forEach((legend => {
|
|
893
906
|
null == legend || legend.release();
|
|
894
|
-
})), null === (
|
|
895
|
-
null === (
|
|
907
|
+
})), null === (_l = internalProps.title) || void 0 === _l || _l.release(), internalProps.title = null,
|
|
908
|
+
null === (_m = internalProps.emptyTip) || void 0 === _m || _m.release(), internalProps.emptyTip = null,
|
|
896
909
|
internalProps.layoutMap.release(), (0, chart_render_helper_1.clearChartRenderQueue)(),
|
|
897
910
|
this.scenegraph.clearCells(), this.scenegraph.updateComponent(), this.stateManager.updateOptionSetState(),
|
|
898
911
|
this._updateSize(), this.eventManager.updateEventBinder(), options.legends) {
|
|
@@ -921,15 +934,15 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
921
934
|
}
|
|
922
935
|
if (internalProps.menu = Object.assign({
|
|
923
936
|
renderMode: "html"
|
|
924
|
-
}, options.menu), Array.isArray(null === (
|
|
925
|
-
(Array.isArray(null === (
|
|
937
|
+
}, options.menu), Array.isArray(null === (_o = options.menu) || void 0 === _o ? void 0 : _o.dropDownMenuHighlight) && this.setDropDownMenuHighlight(null === (_p = options.menu) || void 0 === _p ? void 0 : _p.dropDownMenuHighlight),
|
|
938
|
+
(Array.isArray(null === (_q = options.menu) || void 0 === _q ? void 0 : _q.defaultHeaderMenuItems) || "function" == typeof (null === (_r = options.menu) || void 0 === _r ? void 0 : _r.defaultHeaderMenuItems)) && (this.globalDropDownMenu = options.menu.defaultHeaderMenuItems),
|
|
926
939
|
"html" === internalProps.menu.renderMode && !internalProps.menuHandler) {
|
|
927
940
|
const MenuHandler = factory_1.Factory.getComponent("menuHandler");
|
|
928
941
|
internalProps.menuHandler = new MenuHandler(this);
|
|
929
942
|
}
|
|
930
943
|
this.clearCellStyleCache(), this.clearColWidthCache(), this.clearRowHeightCache(),
|
|
931
944
|
internalProps.customMergeCell = (0, get_custom_merge_cell_func_1.getCustomMergeCellFunc)(options.customMergeCell),
|
|
932
|
-
null === (
|
|
945
|
+
null === (_s = this.customCellStylePlugin) || void 0 === _s || _s.updateCustomCell(null !== (_t = options.customCellStyle) && void 0 !== _t ? _t : [], null !== (_u = options.customCellStyleArrangement) && void 0 !== _u ? _u : []),
|
|
933
946
|
this._adjustCanvasSizeByOption();
|
|
934
947
|
}
|
|
935
948
|
renderWithRecreateCells() {
|
|
@@ -968,8 +981,8 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
968
981
|
const width = Math.min(this.tableNoFrameWidth, this.getAllColsWidth()), height = Math.min(this.tableNoFrameHeight, this.getAllRowsHeight());
|
|
969
982
|
return new Rect_1.Rect(this.tableX, this.tableY, width, height);
|
|
970
983
|
}
|
|
971
|
-
_getMouseAbstractPoint(evt
|
|
972
|
-
var _a, _b, _c, _d;
|
|
984
|
+
_getMouseAbstractPoint(evt) {
|
|
985
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
973
986
|
let e;
|
|
974
987
|
if (!evt) return {
|
|
975
988
|
inTable: !1,
|
|
@@ -980,13 +993,23 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
980
993
|
const clientX = e.clientX || e.pageX + window.scrollX, clientY = e.clientY || e.pageY + window.scrollY, rect = this.internalProps.canvas.getBoundingClientRect();
|
|
981
994
|
let inTable = !0;
|
|
982
995
|
rect.right <= clientX && (inTable = !1), rect.bottom <= clientY && (inTable = !1);
|
|
983
|
-
const currentWidth = rect.width, widthRatio = currentWidth / (this.canvas.offsetWidth || currentWidth), currentHeight = rect.height, heightRatio = currentHeight / (this.canvas.offsetHeight || currentHeight),
|
|
984
|
-
|
|
985
|
-
|
|
996
|
+
const currentWidth = rect.width, widthRatio = currentWidth / ((90 === this.rotateDegree ? this.canvas.offsetHeight : this.canvas.offsetWidth) || currentWidth), currentHeight = rect.height, heightRatio = currentHeight / ((90 === this.rotateDegree ? this.canvas.offsetWidth : this.canvas.offsetHeight) || currentHeight), rotateTablePlugin = this.pluginManager.getPluginByName("Rotate Table");
|
|
997
|
+
if (rotateTablePlugin && 90 === this.rotateDegree) {
|
|
998
|
+
const point = {
|
|
999
|
+
x: clientX / widthRatio - (null !== (_b = null === (_a = this.options.viewBox) || void 0 === _a ? void 0 : _a.x1) && void 0 !== _b ? _b : 0),
|
|
1000
|
+
y: clientY / heightRatio - (null !== (_d = null === (_c = this.options.viewBox) || void 0 === _c ? void 0 : _c.y1) && void 0 !== _d ? _d : 0),
|
|
1001
|
+
inTable: inTable
|
|
1002
|
+
};
|
|
1003
|
+
return rotateTablePlugin.matrix.transformPoint(point, point), point;
|
|
1004
|
+
}
|
|
1005
|
+
const point = {
|
|
1006
|
+
x: (clientX - rect.left) / widthRatio - (null !== (_f = null === (_e = this.options.viewBox) || void 0 === _e ? void 0 : _e.x1) && void 0 !== _f ? _f : 0),
|
|
1007
|
+
y: (clientY - rect.top) / heightRatio - (null !== (_h = null === (_g = this.options.viewBox) || void 0 === _g ? void 0 : _g.y1) && void 0 !== _h ? _h : 0),
|
|
986
1008
|
inTable: inTable
|
|
987
1009
|
};
|
|
988
1010
|
if (this.internalProps.modifiedViewBoxTransform && this.scenegraph.stage.window.getViewBoxTransform()) {
|
|
989
|
-
this.scenegraph.stage.window.getViewBoxTransform().transformPoint(point, point)
|
|
1011
|
+
return this.scenegraph.stage.window.getViewBoxTransform().transformPoint(point, point),
|
|
1012
|
+
point;
|
|
990
1013
|
}
|
|
991
1014
|
return point;
|
|
992
1015
|
}
|
|
@@ -1071,7 +1094,7 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
1071
1094
|
set theme(theme) {
|
|
1072
1095
|
this.internalProps.theme = themes_1.default.of(null != theme ? theme : themes_1.default.DEFAULT),
|
|
1073
1096
|
this.internalProps.theme.isPivot = this.isPivotTable(), this.options.theme = theme,
|
|
1074
|
-
(0,
|
|
1097
|
+
(0, icons_1.setIconColor)(this.internalProps.theme.functionalIconsStyle);
|
|
1075
1098
|
}
|
|
1076
1099
|
updateTheme(theme) {
|
|
1077
1100
|
const oldHoverState = {
|
|
@@ -1079,7 +1102,7 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
1079
1102
|
row: this.stateManager.hover.cellPos.row
|
|
1080
1103
|
};
|
|
1081
1104
|
this.internalProps.theme = themes_1.default.of(null != theme ? theme : themes_1.default.DEFAULT),
|
|
1082
|
-
this.internalProps.theme.isPivot = this.isPivotTable(), (0,
|
|
1105
|
+
this.internalProps.theme.isPivot = this.isPivotTable(), (0, icons_1.setIconColor)(this.internalProps.theme.functionalIconsStyle),
|
|
1083
1106
|
this.options.theme = theme, this.scenegraph.updateComponent(), this.scenegraph.updateStageBackground(),
|
|
1084
1107
|
this.scenegraph.clearCells(), this.clearCellStyleCache(), this.scenegraph.createSceneGraph(),
|
|
1085
1108
|
this.stateManager.updateHoverPos(oldHoverState.col, oldHoverState.row), this.render();
|