@visactor/vtable 0.19.2-alpha.2 → 0.20.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/cjs/ListTable.d.ts +12 -2
- package/cjs/ListTable.js +81 -24
- package/cjs/ListTable.js.map +1 -1
- package/cjs/PivotChart.d.ts +2 -1
- package/cjs/PivotChart.js +5 -1
- package/cjs/PivotChart.js.map +1 -1
- package/cjs/PivotTable.d.ts +5 -2
- package/cjs/PivotTable.js +13 -5
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/body-helper/body-helper.js +1 -0
- package/cjs/body-helper/body-helper.js.map +1 -1
- package/cjs/core/BaseTable.d.ts +2 -2
- package/cjs/core/BaseTable.js +22 -18
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/tableHelper.d.ts +2 -2
- package/cjs/core/tableHelper.js +4 -6
- package/cjs/core/tableHelper.js.map +1 -1
- package/cjs/data/CachedDataSource.d.ts +4 -3
- package/cjs/data/CachedDataSource.js +5 -4
- package/cjs/data/CachedDataSource.js.map +1 -1
- package/cjs/data/DataSource.d.ts +22 -3
- package/cjs/data/DataSource.js +93 -7
- package/cjs/data/DataSource.js.map +1 -1
- package/cjs/dataset/dataset-pivot-table.d.ts +3 -3
- package/cjs/dataset/dataset-pivot-table.js +1 -0
- package/cjs/dataset/dataset-pivot-table.js.map +1 -1
- package/cjs/dataset/dataset.d.ts +3 -3
- package/cjs/dataset/dataset.js +3 -0
- package/cjs/dataset/dataset.js.map +1 -1
- package/cjs/dataset/statistics-helper.d.ts +24 -3
- package/cjs/dataset/statistics-helper.js +75 -9
- package/cjs/dataset/statistics-helper.js.map +1 -1
- package/cjs/edit/edit-manager.js +5 -4
- package/cjs/edit/edit-manager.js.map +1 -1
- package/cjs/event/listener/table-group.js +14 -4
- package/cjs/event/listener/table-group.js.map +1 -1
- package/cjs/event/media-click.js +2 -1
- package/cjs/event/scroll.js +0 -1
- package/cjs/event/sparkline-event.js +1 -1
- package/cjs/event/sparkline-event.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/layout/chart-helper/get-chart-spec.d.ts +1 -0
- package/cjs/layout/chart-helper/get-chart-spec.js +34 -9
- package/cjs/layout/chart-helper/get-chart-spec.js.map +1 -1
- package/cjs/layout/layout-helper.d.ts +4 -63
- package/cjs/layout/layout-helper.js +25 -247
- package/cjs/layout/layout-helper.js.map +1 -1
- package/cjs/layout/pivot-header-layout.d.ts +6 -3
- package/cjs/layout/pivot-header-layout.js +26 -15
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/layout/row-height-map.js +2 -1
- package/cjs/layout/row-height-map.js.map +1 -1
- package/cjs/layout/simple-header-layout.d.ts +25 -2
- package/cjs/layout/simple-header-layout.js +130 -18
- package/cjs/layout/simple-header-layout.js.map +1 -1
- package/cjs/layout/tree-helper.d.ts +63 -0
- package/cjs/layout/tree-helper.js +259 -0
- package/cjs/layout/tree-helper.js.map +1 -0
- package/cjs/scenegraph/graphic/chart.d.ts +2 -1
- package/cjs/scenegraph/graphic/chart.js +21 -18
- package/cjs/scenegraph/graphic/chart.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/chart-render-helper.js +4 -1
- package/cjs/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/chart-render.js +2 -2
- package/cjs/scenegraph/graphic/contributions/chart-render.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.js +19 -8
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/chart-cell.d.ts +1 -1
- package/cjs/scenegraph/group-creater/cell-type/chart-cell.js +2 -2
- package/cjs/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/image-cell.d.ts +1 -1
- package/cjs/scenegraph/group-creater/cell-type/image-cell.js +9 -5
- package/cjs/scenegraph/group-creater/cell-type/image-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/video-cell.js +1 -1
- package/cjs/scenegraph/group-creater/cell-type/video-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/column-helper.js +5 -5
- package/cjs/scenegraph/group-creater/column-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/update-position/sort-vertical.js +5 -2
- package/cjs/scenegraph/group-creater/progress/update-position/sort-vertical.js.map +1 -1
- package/cjs/scenegraph/scenegraph.js +24 -11
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/scenegraph/style/frame-border.js +7 -4
- package/cjs/scenegraph/style/frame-border.js.map +1 -1
- package/cjs/state/hover/is-cell-hover.js +1 -1
- package/cjs/state/hover/is-cell-hover.js.map +1 -1
- package/cjs/state/sort/index.js +2 -5
- package/cjs/state/sort/index.js.map +1 -1
- package/cjs/state/state.d.ts +0 -1
- package/cjs/state/state.js +3 -4
- package/cjs/state/state.js.map +1 -1
- package/cjs/themes/theme.js +3 -0
- package/cjs/themes/theme.js.map +1 -1
- package/cjs/tools/get-data-path/create-dataset.js.map +1 -1
- package/cjs/tools/isx.d.ts +1 -1
- package/cjs/tools/util.d.ts +1 -1
- package/cjs/ts-types/base-table.d.ts +6 -5
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/list-table/define/basic-define.d.ts +2 -0
- package/cjs/ts-types/list-table/define/basic-define.js.map +1 -1
- package/cjs/ts-types/list-table/layout-map/api.d.ts +5 -4
- package/cjs/ts-types/list-table/layout-map/api.js.map +1 -1
- package/cjs/ts-types/new-data-set.d.ts +27 -6
- package/cjs/ts-types/new-data-set.js +1 -1
- package/cjs/ts-types/new-data-set.js.map +1 -1
- package/cjs/ts-types/table-engine.d.ts +17 -5
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/cjs/ts-types/theme.d.ts +1 -0
- package/cjs/ts-types/theme.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +1306 -544
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.d.ts +12 -2
- package/es/ListTable.js +81 -24
- package/es/ListTable.js.map +1 -1
- package/es/PivotChart.d.ts +2 -1
- package/es/PivotChart.js +5 -1
- package/es/PivotChart.js.map +1 -1
- package/es/PivotTable.d.ts +5 -2
- package/es/PivotTable.js +13 -5
- package/es/PivotTable.js.map +1 -1
- package/es/body-helper/body-helper.js +1 -0
- package/es/body-helper/body-helper.js.map +1 -1
- package/es/core/BaseTable.d.ts +2 -2
- package/es/core/BaseTable.js +22 -18
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/tableHelper.d.ts +2 -2
- package/es/core/tableHelper.js +4 -6
- package/es/core/tableHelper.js.map +1 -1
- package/es/data/CachedDataSource.d.ts +4 -3
- package/es/data/CachedDataSource.js +5 -4
- package/es/data/CachedDataSource.js.map +1 -1
- package/es/data/DataSource.d.ts +22 -3
- package/es/data/DataSource.js +91 -7
- package/es/data/DataSource.js.map +1 -1
- package/es/dataset/dataset-pivot-table.d.ts +3 -3
- package/es/dataset/dataset-pivot-table.js +1 -0
- package/es/dataset/dataset-pivot-table.js.map +1 -1
- package/es/dataset/dataset.d.ts +3 -3
- package/es/dataset/dataset.js +3 -0
- package/es/dataset/dataset.js.map +1 -1
- package/es/dataset/statistics-helper.d.ts +24 -3
- package/es/dataset/statistics-helper.js +72 -8
- package/es/dataset/statistics-helper.js.map +1 -1
- package/es/edit/edit-manager.js +5 -4
- package/es/edit/edit-manager.js.map +1 -1
- package/es/event/listener/table-group.js +14 -4
- package/es/event/listener/table-group.js.map +1 -1
- package/es/event/media-click.js +2 -1
- package/es/event/scroll.js +1 -2
- package/es/event/sparkline-event.js +1 -1
- package/es/event/sparkline-event.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/layout/chart-helper/get-chart-spec.d.ts +1 -0
- package/es/layout/chart-helper/get-chart-spec.js +29 -4
- package/es/layout/chart-helper/get-chart-spec.js.map +1 -1
- package/es/layout/layout-helper.d.ts +4 -63
- package/es/layout/layout-helper.js +19 -246
- package/es/layout/layout-helper.js.map +1 -1
- package/es/layout/pivot-header-layout.d.ts +6 -3
- package/es/layout/pivot-header-layout.js +17 -6
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/layout/row-height-map.js +2 -1
- package/es/layout/row-height-map.js.map +1 -1
- package/es/layout/simple-header-layout.d.ts +25 -2
- package/es/layout/simple-header-layout.js +130 -17
- package/es/layout/simple-header-layout.js.map +1 -1
- package/es/layout/tree-helper.d.ts +63 -0
- package/es/layout/tree-helper.js +256 -0
- package/es/layout/tree-helper.js.map +1 -0
- package/es/scenegraph/graphic/chart.d.ts +2 -1
- package/es/scenegraph/graphic/chart.js +21 -17
- package/es/scenegraph/graphic/chart.js.map +1 -1
- package/es/scenegraph/graphic/contributions/chart-render-helper.js +4 -1
- package/es/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
- package/es/scenegraph/graphic/contributions/chart-render.js +2 -2
- package/es/scenegraph/graphic/contributions/chart-render.js.map +1 -1
- package/es/scenegraph/group-creater/cell-helper.js +20 -7
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/chart-cell.d.ts +1 -1
- package/es/scenegraph/group-creater/cell-type/chart-cell.js +2 -2
- package/es/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/image-cell.d.ts +1 -1
- package/es/scenegraph/group-creater/cell-type/image-cell.js +9 -5
- package/es/scenegraph/group-creater/cell-type/image-cell.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/video-cell.js +1 -1
- package/es/scenegraph/group-creater/cell-type/video-cell.js.map +1 -1
- package/es/scenegraph/group-creater/column-helper.js +5 -5
- package/es/scenegraph/group-creater/column-helper.js.map +1 -1
- package/es/scenegraph/group-creater/progress/update-position/sort-vertical.js +6 -3
- package/es/scenegraph/group-creater/progress/update-position/sort-vertical.js.map +1 -1
- package/es/scenegraph/scenegraph.js +24 -11
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/scenegraph/style/frame-border.js +7 -4
- package/es/scenegraph/style/frame-border.js.map +1 -1
- package/es/state/hover/is-cell-hover.js +1 -1
- package/es/state/hover/is-cell-hover.js.map +1 -1
- package/es/state/sort/index.js +2 -5
- package/es/state/sort/index.js.map +1 -1
- package/es/state/state.d.ts +0 -1
- package/es/state/state.js +3 -4
- package/es/state/state.js.map +1 -1
- package/es/themes/theme.js +3 -0
- package/es/themes/theme.js.map +1 -1
- package/es/tools/get-data-path/create-dataset.js.map +1 -1
- package/es/tools/isx.d.ts +1 -1
- package/es/tools/util.d.ts +1 -1
- package/es/ts-types/base-table.d.ts +6 -5
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/list-table/define/basic-define.d.ts +2 -0
- package/es/ts-types/list-table/define/basic-define.js.map +1 -1
- package/es/ts-types/list-table/layout-map/api.d.ts +5 -4
- package/es/ts-types/list-table/layout-map/api.js.map +1 -1
- package/es/ts-types/new-data-set.d.ts +27 -6
- package/es/ts-types/new-data-set.js +1 -1
- package/es/ts-types/new-data-set.js.map +1 -1
- package/es/ts-types/table-engine.d.ts +17 -5
- package/es/ts-types/table-engine.js.map +1 -1
- package/es/ts-types/theme.d.ts +1 -0
- package/es/ts-types/theme.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +3 -3
- package/cjs/data/FilterDataSource.d.ts +0 -1
- package/cjs/data/FilterDataSource.js +0 -1
- package/cjs/data/FilterDataSource.js.map +0 -1
- package/es/data/FilterDataSource.d.ts +0 -1
- package/es/data/FilterDataSource.js +0 -1
- package/es/data/FilterDataSource.js.map +0 -1
|
@@ -6,6 +6,7 @@ import type { ColumnIconOption } from '../../icon';
|
|
|
6
6
|
import type { MenuListItem } from '../../menu';
|
|
7
7
|
import type { BaseTableAPI } from '../../base-table';
|
|
8
8
|
import type { IEditor } from '@visactor/vtable-editors';
|
|
9
|
+
import type { Aggregation, CustomAggregation } from '../../new-data-set';
|
|
9
10
|
export interface IBasicHeaderDefine {
|
|
10
11
|
title?: string | (() => string);
|
|
11
12
|
headerIcon?: string | ColumnIconOption | (string | ColumnIconOption)[];
|
|
@@ -43,4 +44,5 @@ export interface IBasicColumnBodyDefine {
|
|
|
43
44
|
editor?: string | IEditor | ((args: BaseCellInfo & {
|
|
44
45
|
table: BaseTableAPI;
|
|
45
46
|
}) => string | IEditor);
|
|
47
|
+
aggregation?: Aggregation | CustomAggregation | (Aggregation | CustomAggregation)[];
|
|
46
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ts-types/list-table/define/basic-define.ts"],"names":[],"mappings":"","file":"basic-define.js","sourcesContent":["import type { BaseCellInfo, CellInfo, MergeCellOption, SortOption } from '../../common';\nimport type { ICustomRender } from '../../customElement';\nimport type { ICustomLayout } from '../../customLayout';\nimport type { FieldDef, FieldFormat, FieldKeyDef } from '../../table-engine';\nimport type { ColumnIconOption } from '../../icon';\nimport type { MenuListItem } from '../../menu';\nimport type { BaseTableAPI } from '../../base-table';\nimport type { IEditor } from '@visactor/vtable-editors';\n\n// eslint-disable-next-line no-unused-vars\nexport interface IBasicHeaderDefine {\n // 表头的标题\n title?: string | (() => string); //支持图文混合\n /**
|
|
1
|
+
{"version":3,"sources":["../src/ts-types/list-table/define/basic-define.ts"],"names":[],"mappings":"","file":"basic-define.js","sourcesContent":["import type { BaseCellInfo, CellInfo, MergeCellOption, SortOption } from '../../common';\nimport type { ICustomRender } from '../../customElement';\nimport type { ICustomLayout } from '../../customLayout';\nimport type { FieldDef, FieldFormat, FieldKeyDef } from '../../table-engine';\nimport type { ColumnIconOption } from '../../icon';\nimport type { MenuListItem } from '../../menu';\nimport type { BaseTableAPI } from '../../base-table';\nimport type { IEditor } from '@visactor/vtable-editors';\nimport type { Aggregation, CustomAggregation } from '../../new-data-set';\n\n// eslint-disable-next-line no-unused-vars\nexport interface IBasicHeaderDefine {\n // 表头的标题\n title?: string | (() => string); //支持图文混合\n /** 表头Icon配置 */\n headerIcon?: string | ColumnIconOption | (string | ColumnIconOption)[];\n // | ((args: CellInfo) => string | ColumnIconOption | (string | ColumnIconOption)[]);\n\n // headerStyle?: HeaderStyleOption | null;\n // style?: ColumnStyleOption | null;\n // headerType?: HeaderTypeOption | headerType.BaseHeader | null;\n /** sort排序规则 */\n sort?: SortOption;\n /** 显示sort排序icon。为了仅仅显示图标,无排序逻辑 */\n showSort?: boolean;\n /** 该列不支持hover交互行为 */\n disableHover?: boolean;\n // /** 点击表头单元格时连带body整行或整列选中 或仅选中当前单元格,默认或整行或整列选中*/\n // headerSelectMode?: 'inline' | 'cell';\n /** 该列不支持选中 */\n disableSelect?: boolean;\n /** 该列表头不支持hover交互行为 */\n disableHeaderHover?: boolean;\n /** 该列表头不支持选中 */\n disableHeaderSelect?: boolean;\n /** 表头hover时的描述信息 会以tooltip形式展示出来 */\n description?: string;\n /** 下拉菜单项配置 */\n dropDownMenu?: MenuListItem[];\n /** 表头自定义渲染函数 */\n headerCustomRender?: ICustomRender;\n /** 表头自定义渲染元素定义 */\n headerCustomLayout?: ICustomLayout;\n /** 是否可以拖拽表头 */\n dragHeader?: boolean;\n /**\n * 列宽计算模式,only-header只考虑表头的内容 only-body只考虑body的内容 normal能被显示出来的所有内容\n */\n columnWidthComputeMode?: 'normal' | 'only-header' | 'only-body';\n /**\n * 是否禁用调整列宽,如果是转置表格或者是透视表的指标是行方向指定 那该配置不生效\n */\n disableColumnResize?: boolean;\n headerEditor?: string | IEditor | ((args: BaseCellInfo & { table: BaseTableAPI }) => string | IEditor);\n}\n\nexport interface IBasicColumnBodyDefine {\n field: FieldDef;\n /** @deprecated 已不维护 */\n fieldKey?: FieldKeyDef;\n fieldFormat?: FieldFormat;\n width?: number | string;\n minWidth?: number | string;\n maxWidth?: number | string;\n //是否展示为树形结构\n tree?: boolean;\n icon?:\n | string\n | ColumnIconOption\n | (string | ColumnIconOption)[]\n | ((args: CellInfo & { table: BaseTableAPI }) => string | ColumnIconOption | (string | ColumnIconOption)[]);\n\n // cellType?: ColumnTypeOption | BaseColumn<T, any> | null;\n\n // /** 如果是绘制图表库组件的图表类型 需要将注入的组件名称 写到chartType */\n // chartModule?: string;\n // /** 如果是绘制图表库组件的图表类型 统一图表配置chartSpec */\n // chartSpec?: any | ((arg0: CellInfo) => any);\n // sparklineSpec?: SparklineSpec | ((arg0: CellInfo) => SparklineSpec);\n // style?: ColumnStyleOption | null;\n /** 是否对相同内容合并单元格 **/\n mergeCell?: MergeCellOption;\n customRender?: ICustomRender;\n customLayout?: ICustomLayout;\n editor?: string | IEditor | ((args: BaseCellInfo & { table: BaseTableAPI }) => string | IEditor);\n aggregation?: Aggregation | CustomAggregation | (Aggregation | CustomAggregation)[];\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { CellAddress, CellRange, ColumnIconOption, ColumnStyle, ColumnStyleOption, FieldDef, FieldFormat, HeaderStyleOption, LayoutObjectId, MenuListItem, CellInfo, PivotInfo,
|
|
1
|
+
import type { CellAddress, CellRange, ColumnIconOption, ColumnStyle, ColumnStyleOption, FieldDef, FieldFormat, HeaderStyleOption, LayoutObjectId, MenuListItem, CellInfo, PivotInfo, CustomRenderFunctionArg, SparklineSpec, HierarchyState, Aggregation } from '../../';
|
|
2
|
+
import type { Aggregator } from '../../../dataset/statistics-helper';
|
|
2
3
|
import type { HeaderDefine, ColumnDefine, ColumnBodyDefine } from '../define';
|
|
3
4
|
export type { HeaderDefine, ColumnDefine, ColumnBodyDefine, ColumnsDefine, LinkColumnDefine, ChartColumnDefine, ImageColumnDefine, SparklineColumnDefine, ProgressbarColumnDefine, TextColumnDefine, GroupColumnDefine } from '../define';
|
|
4
5
|
export interface HeaderData extends WidthData {
|
|
@@ -7,7 +8,6 @@ export interface HeaderData extends WidthData {
|
|
|
7
8
|
headerIcon?: string | ColumnIconOption | (string | ColumnIconOption)[] | ((args: CellInfo) => string | ColumnIconOption | (string | ColumnIconOption)[]);
|
|
8
9
|
icons?: (string | ColumnIconOption)[] | ((args: CellInfo) => (string | ColumnIconOption)[]);
|
|
9
10
|
field: FieldDef;
|
|
10
|
-
fieldKey?: FieldKeyDef;
|
|
11
11
|
fieldFormat?: FieldFormat;
|
|
12
12
|
style?: HeaderStyleOption | ColumnStyle | null | undefined;
|
|
13
13
|
headerType: 'text' | 'link' | 'image' | 'video' | 'checkbox';
|
|
@@ -32,10 +32,9 @@ export interface WidthData {
|
|
|
32
32
|
export interface ColumnData extends WidthData {
|
|
33
33
|
id: LayoutObjectId;
|
|
34
34
|
field: FieldDef;
|
|
35
|
-
fieldKey?: FieldKeyDef;
|
|
36
35
|
fieldFormat?: FieldFormat;
|
|
37
36
|
icon?: string | ColumnIconOption | (string | ColumnIconOption)[] | ((args: CellInfo) => string | ColumnIconOption | (string | ColumnIconOption)[]);
|
|
38
|
-
cellType: 'text' | 'link' | 'image' | 'video' | 'sparkline' | 'progressbar' | 'chart';
|
|
37
|
+
cellType: 'text' | 'link' | 'image' | 'video' | 'sparkline' | 'progressbar' | 'chart' | 'checkbox';
|
|
39
38
|
chartModule?: string;
|
|
40
39
|
chartSpec?: any | ((arg0: CellInfo) => any);
|
|
41
40
|
chartInstance?: any;
|
|
@@ -45,6 +44,8 @@ export interface ColumnData extends WidthData {
|
|
|
45
44
|
templateLink?: string;
|
|
46
45
|
columnWidthComputeMode?: 'normal' | 'only-header' | 'only-body';
|
|
47
46
|
disableColumnResize?: boolean;
|
|
47
|
+
aggregation?: Aggregation | Aggregation[];
|
|
48
|
+
aggregator?: Aggregator | Aggregator[];
|
|
48
49
|
}
|
|
49
50
|
export interface IndicatorData extends WidthData {
|
|
50
51
|
id: LayoutObjectId;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ts-types/list-table/layout-map/api.ts"],"names":[],"mappings":"","file":"api.js","sourcesContent":["import type {\n CellAddress,\n CellRange,\n ColumnIconOption,\n ColumnStyle,\n ColumnStyleOption,\n // ColumnTypeOption,\n FieldDef,\n FieldFormat,\n HeaderStyleOption,\n LayoutObjectId,\n MenuListItem,\n IPivotTableCellHeaderPaths,\n CellInfo,\n // ICustomRenderFuc,\n // ICustomRenderObj,\n PivotInfo,\n FieldKeyDef,\n CustomRenderFunctionArg,\n SparklineSpec,\n HierarchyState\n} from '../../';\n\nimport type { HeaderDefine, ColumnDefine, ColumnBodyDefine } from '../define';\n\n// todo: 修改引用这些类型的路径\nexport type {\n HeaderDefine,\n ColumnDefine,\n ColumnBodyDefine,\n ColumnsDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine\n} from '../define';\n\n/**\n * layout中组织表头的信息类 和HeaderDefine对应\n */\nexport interface HeaderData extends WidthData {\n id: LayoutObjectId;\n title?: string | (() => string);\n // captionIcon?: ColumnIconOption;\n headerIcon?:\n | string\n | ColumnIconOption\n | (string | ColumnIconOption)[]\n | ((args: CellInfo) => string | ColumnIconOption | (string | ColumnIconOption)[]);\n icons?: (string | ColumnIconOption)[] | ((args: CellInfo) => (string | ColumnIconOption)[]);\n\n field: FieldDef;\n
|
|
1
|
+
{"version":3,"sources":["../src/ts-types/list-table/layout-map/api.ts"],"names":[],"mappings":"","file":"api.js","sourcesContent":["import type {\n CellAddress,\n CellRange,\n ColumnIconOption,\n ColumnStyle,\n ColumnStyleOption,\n // ColumnTypeOption,\n FieldDef,\n FieldFormat,\n HeaderStyleOption,\n LayoutObjectId,\n MenuListItem,\n IPivotTableCellHeaderPaths,\n CellInfo,\n // ICustomRenderFuc,\n // ICustomRenderObj,\n PivotInfo,\n FieldKeyDef,\n CustomRenderFunctionArg,\n SparklineSpec,\n HierarchyState,\n Aggregation\n} from '../../';\nimport type { Aggregator } from '../../../dataset/statistics-helper';\n\nimport type { HeaderDefine, ColumnDefine, ColumnBodyDefine } from '../define';\n\n// todo: 修改引用这些类型的路径\nexport type {\n HeaderDefine,\n ColumnDefine,\n ColumnBodyDefine,\n ColumnsDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine\n} from '../define';\n\n/**\n * layout中组织表头的信息类 和HeaderDefine对应\n */\nexport interface HeaderData extends WidthData {\n id: LayoutObjectId;\n title?: string | (() => string);\n // captionIcon?: ColumnIconOption;\n headerIcon?:\n | string\n | ColumnIconOption\n | (string | ColumnIconOption)[]\n | ((args: CellInfo) => string | ColumnIconOption | (string | ColumnIconOption)[]);\n icons?: (string | ColumnIconOption)[] | ((args: CellInfo) => (string | ColumnIconOption)[]);\n\n field: FieldDef;\n fieldFormat?: FieldFormat;\n style?: HeaderStyleOption | ColumnStyle | null | undefined;\n headerType: 'text' | 'link' | 'image' | 'video' | 'checkbox'; // headerType.BaseHeader;\n define: ColumnDefine;\n // sortIconPosition?: RectProps;\n // freezeIconPosition?: RectProps;\n /**存储图标的位置 坐标及宽高 是包括了boxWidth boxWidth 共getHitIcon方法使用 计算是否命中图标*/\n // iconPositionList?: { [key in IconFuncTypeEnum]?: RectProps & { icon: ColumnIconOption } };\n dropDownMenu?: MenuListItem[];\n pivotInfo?: PivotInfo;\n /**\n * 维度层级level 从0开始:第0层 第1层\n */\n hierarchyLevel?: number;\n /**\n * 维度总层级数\n */\n dimensionTotalLevel?: number;\n /**\n * 层级展开or折叠状态\n */\n hierarchyState?: HierarchyState;\n columnWidthComputeMode?: 'normal' | 'only-header' | 'only-body';\n\n showSort?: boolean;\n\n /**\n * 表头描述 鼠标hover会提示该信息\n */\n description?: string | ((args: CellInfo) => string);\n\n // header内容为空\n isEmpty?: boolean;\n\n /** 记录当前表头节点的上级表头结点的cellId */\n parentCellId?: LayoutObjectId;\n}\n\nexport interface WidthData {\n width?: number | string;\n minWidth?: number | string;\n maxWidth?: number | string;\n columnWidthComputeMode?: 'normal' | 'only-header' | 'only-body';\n}\n/**\n * layout中组织body列的信息类 和ColumnDefine对应\n */\nexport interface ColumnData extends WidthData {\n id: LayoutObjectId;\n field: FieldDef;\n // fieldKey?: FieldKeyDef;\n fieldFormat?: FieldFormat;\n // icon?: ColumnIconOption | ColumnIconOption[];\n icon?:\n | string\n | ColumnIconOption\n | (string | ColumnIconOption)[]\n | ((args: CellInfo) => string | ColumnIconOption | (string | ColumnIconOption)[]);\n\n cellType: 'text' | 'link' | 'image' | 'video' | 'sparkline' | 'progressbar' | 'chart' | 'checkbox'; //BaseColumn<T, any>;\n /** 如果是绘制图表库组件的图表类型 需要将注入的组件名称 写到chartType */\n chartModule?: string;\n /** 如果是绘制图表库组件的图表类型 统一图表配置chartSpec */\n chartSpec?: any | ((arg0: CellInfo) => any);\n chartInstance?: any;\n sparklineSpec?: SparklineSpec | ((arg0: CellInfo) => SparklineSpec);\n style: ColumnStyleOption | null | undefined;\n define: ColumnDefine;\n templateLink?: string;\n columnWidthComputeMode?: 'normal' | 'only-header' | 'only-body';\n /**存储图标的位置 坐标及宽高 是包括了boxWidth boxWidth 共getHitIcon方法使用 计算是否命中图标*/\n // iconPositionList?: { [key in IconFuncTypeEnum]?: RectProps & { icon: ColumnIconOption } };\n /**\n * 是否禁用调整列宽,如果是转置表格或者是透视表的指标是行方向指定 那该配置不生效\n */\n disableColumnResize?: boolean;\n aggregation?: Aggregation | Aggregation[];\n aggregator?: Aggregator | Aggregator[];\n}\n\nexport interface IndicatorData extends WidthData {\n id: LayoutObjectId;\n field: string | number;\n /**\n * 唯一标识一种指标\n */\n indicatorKey: string;\n // fieldKey: FieldKeyDef;\n fieldFormat?: FieldFormat;\n cellType: 'text' | 'link' | 'image' | 'video' | 'sparkline' | 'progressbar' | 'chart'; //BaseColumn<T, any>;\n chartModule?: string;\n chartSpec?: any | ((arg0: CustomRenderFunctionArg) => any);\n chartInstance?: any;\n style?: ColumnStyleOption | null | undefined;\n define: ColumnDefine;\n // headerIcon?:\n // | (string | ColumnIconOption)[]\n // | ((args: CellInfo) => (string | ColumnIconOption)[]);\n icon?:\n | string\n | ColumnIconOption\n | (string | ColumnIconOption)[]\n | ((args: CellInfo) => string | ColumnIconOption | (string | ColumnIconOption)[]);\n sparklineSpec?: SparklineSpec | ((arg0: CustomRenderFunctionArg) => SparklineSpec);\n /**\n * 是否禁用调整列宽,如果是转置表格或者是透视表的指标是行方向指定 那该配置不生效\n */\n disableColumnResize?: boolean;\n}\n\n// Simple header\n\n// export interface GroupHeaderDefine extends HeaderDefine {\n// columns: HeadersDefine;\n// hideColumnsSubHeader?: boolean;\n// dropDownMenu?: MenuListItem[];\n// }\n// type Either<X, Y> =\n// | ({\n// [KX in keyof X]: X[KX];\n// } & {\n// [KY in Exclude<keyof Y, keyof X>]?: never;\n// })\n// | ({\n// [KY in keyof Y]: Y[KY];\n// } & {\n// [KX in Exclude<keyof X, keyof Y>]?: never;\n// });\n// export type HeaderColumnDefine = Either<GroupHeaderDefine, ColumnDefine>;\n// export type HeadersDefine = HeaderColumnDefine[];\n\n// Advanced layout\n\n// export interface HeaderCellDefine extends HeaderDefine {\n// colSpan?: number;\n// rowSpan?: number;\n// }\nexport type HeaderCellDefine = HeaderDefine & {\n colSpan?: number;\n rowSpan?: number;\n};\n\n// export interface CellDefine extends ColumnDefine {\n// colSpan?: number;\n// rowSpan?: number;\n// }\n\nexport type CellDefine = ColumnBodyDefine & {\n colSpan?: number;\n rowSpan?: number;\n};\n\nexport type ArrayLayoutDefine = CellDefine[][];\n/** @internal */\ninterface LayoutMapAPI {\n readonly headerLevelCount: number;\n readonly rowHeaderLevelCount: number;\n readonly columnHeaderLevelCount: number;\n readonly bodyRowSpanCount: number;\n readonly colCount: number | undefined;\n readonly rowCount: number | undefined;\n readonly columnWidths: WidthData[];\n readonly headerObjects: HeaderData[];\n readonly columnObjects: ColumnData[] | IndicatorData[];\n // transpose: boolean;\n // showHeader: boolean;\n isHeader: (col: number, row: number) => boolean;\n // isHeaderNode(col: number, row: number): boolean; //是否为叶子表头\n /**获取单元格header对象 包括field style type 等 */\n getHeader: (col: number, row: number) => HeaderData;\n /**获取对应header的field */\n getHeaderField: (col: number, row: number) => FieldDef;\n // getHeaderFieldKey(col: number, row: number): FieldKeyDef;\n /**获取单元格column对象 包括field style type 等 */\n getBody: (col: number, row: number) => ColumnData | IndicatorData;\n /**获取单元格标识key */\n getCellId: (col: number, row: number) => LayoutObjectId;\n getCellRange: (col: number, row: number) => CellRange;\n // getCellRangeTranspose(col: number, row: number): CellRange;\n // getBodyLayoutRangeById: (id: LayoutObjectId) => CellRange;\n getHeaderCellAdressById: (id: number) => CellAddress | undefined;\n getHeaderCellAddressByField: (field: string) => CellAddress | undefined;\n getRecordIndexByCell: (col: number, row: number) => number;\n getRecordStartRowByRecordIndex: (index: number) => number;\n /** 从定义中获取一列配置项width的定义值 */\n getColumnWidthDefined: (col: number) => WidthData;\n release: () => void;\n\n isFrozenColumn: (col: number, row?: number) => boolean;\n isRightFrozenColumn: (col: number, row?: number) => boolean;\n isFrozenRow: (col: number, row?: number) => boolean;\n isBottomFrozenRow: (col: number, row?: number) => boolean;\n}\n\nexport type { LayoutMapAPI };\n"]}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Either } from '../tools/helper';
|
|
2
|
+
import type { BaseTableAPI } from './base-table';
|
|
1
3
|
export interface TotalsStatus {
|
|
2
4
|
isRowTotal: boolean;
|
|
3
5
|
isRowSubTotal: boolean;
|
|
@@ -11,7 +13,8 @@ export declare enum AggregationType {
|
|
|
11
13
|
MIN = "MIN",
|
|
12
14
|
MAX = "MAX",
|
|
13
15
|
AVG = "AVG",
|
|
14
|
-
COUNT = "COUNT"
|
|
16
|
+
COUNT = "COUNT",
|
|
17
|
+
CUSTOM = "CUSTOM"
|
|
15
18
|
}
|
|
16
19
|
export declare enum SortType {
|
|
17
20
|
ASC = "ASC",
|
|
@@ -57,17 +60,19 @@ export interface SortFuncRule {
|
|
|
57
60
|
}
|
|
58
61
|
export type SortRule = SortTypeRule | SortByRule | SortByIndicatorRule | SortFuncRule;
|
|
59
62
|
export type SortRules = SortRule[];
|
|
60
|
-
export interface
|
|
63
|
+
export interface FilterFuncRule {
|
|
64
|
+
filterFunc?: (row: Record<string, any>) => boolean;
|
|
65
|
+
}
|
|
66
|
+
export interface FilterValueRule {
|
|
61
67
|
filterKey?: string;
|
|
62
68
|
filteredValues?: unknown[];
|
|
63
|
-
filterFunc?: (row: Record<string, any>) => boolean;
|
|
64
69
|
}
|
|
65
|
-
export type FilterRules =
|
|
70
|
+
export type FilterRules = Either<FilterFuncRule, FilterValueRule>[];
|
|
66
71
|
export interface AggregationRule<T extends AggregationType> {
|
|
67
72
|
indicatorKey: string;
|
|
68
73
|
field: T extends AggregationType.RECORD ? string[] | string : string;
|
|
69
74
|
aggregationType: T;
|
|
70
|
-
formatFun?: (
|
|
75
|
+
formatFun?: (value: number, col: number, row: number, table: BaseTableAPI) => number | string;
|
|
71
76
|
}
|
|
72
77
|
export type AggregationRules = AggregationRule<AggregationType>[];
|
|
73
78
|
export interface MappingRule {
|
|
@@ -94,13 +99,18 @@ export interface DerivedFieldRule {
|
|
|
94
99
|
derivedFunc?: (record: Record<string, any>) => any;
|
|
95
100
|
}
|
|
96
101
|
export type DerivedFieldRules = DerivedFieldRule[];
|
|
97
|
-
export interface
|
|
102
|
+
export interface IListTableDataConfig {
|
|
103
|
+
filterRules?: FilterRules;
|
|
104
|
+
}
|
|
105
|
+
export interface IPivotTableDataConfig {
|
|
98
106
|
aggregationRules?: AggregationRules;
|
|
99
107
|
sortRules?: SortRules;
|
|
100
108
|
filterRules?: FilterRules;
|
|
101
109
|
totals?: Totals;
|
|
102
110
|
mappingRules?: MappingRules;
|
|
103
111
|
derivedFieldRules?: DerivedFieldRules;
|
|
112
|
+
}
|
|
113
|
+
export interface IPivotChartDataConfig extends IPivotTableDataConfig {
|
|
104
114
|
collectValuesBy?: Record<string, CollectValueBy>;
|
|
105
115
|
isPivotChart?: boolean;
|
|
106
116
|
dimensionSortArray?: string[];
|
|
@@ -116,3 +126,14 @@ export type CollectedValue = {
|
|
|
116
126
|
max?: number;
|
|
117
127
|
min?: number;
|
|
118
128
|
} | Array<string>;
|
|
129
|
+
export type Aggregation = {
|
|
130
|
+
aggregationType: AggregationType;
|
|
131
|
+
showOnTop?: boolean;
|
|
132
|
+
formatFun?: (value: number, col: number, row: number, table: BaseTableAPI) => string | number;
|
|
133
|
+
};
|
|
134
|
+
export type CustomAggregation = {
|
|
135
|
+
aggregationType: AggregationType.CUSTOM;
|
|
136
|
+
aggregationFun: (values: any[], records: any[]) => any;
|
|
137
|
+
showOnTop?: boolean;
|
|
138
|
+
formatFun?: (value: number, col: number, row: number, table: BaseTableAPI) => string | number;
|
|
139
|
+
};
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
}), exports.SortType = exports.AggregationType = void 0, function(AggregationType) {
|
|
8
8
|
AggregationType.RECORD = "RECORD", AggregationType.NONE = "NONE", AggregationType.SUM = "SUM",
|
|
9
9
|
AggregationType.MIN = "MIN", AggregationType.MAX = "MAX", AggregationType.AVG = "AVG",
|
|
10
|
-
AggregationType.COUNT = "COUNT";
|
|
10
|
+
AggregationType.COUNT = "COUNT", AggregationType.CUSTOM = "CUSTOM";
|
|
11
11
|
}(AggregationType = exports.AggregationType || (exports.AggregationType = {})),
|
|
12
12
|
function(SortType) {
|
|
13
13
|
SortType.ASC = "ASC", SortType.DESC = "DESC";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ts-types/new-data-set.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"sources":["../src/ts-types/new-data-set.ts"],"names":[],"mappings":";;;AAWA,IAAY,eASX;AATD,WAAY,eAAe;IACzB,oCAAiB,CAAA;IACjB,gCAAa,CAAA;IACb,8BAAW,CAAA;IACX,8BAAW,CAAA;IACX,8BAAW,CAAA;IACX,8BAAW,CAAA;IACX,kCAAe,CAAA;IACf,oCAAiB,CAAA;AACnB,CAAC,EATW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAS1B;AACD,IAAY,QAGX;AAHD,WAAY,QAAQ;IAClB,uBAAW,CAAA;IACX,yBAAa,CAAA;AACf,CAAC,EAHW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAGnB","file":"new-data-set.js","sourcesContent":["import type { Either } from '../tools/helper';\nimport type { BaseTableAPI } from './base-table';\n\n//#region 总计小计\nexport interface TotalsStatus {\n isRowTotal: boolean;\n isRowSubTotal: boolean;\n isColTotal: boolean;\n isColSubTotal: boolean;\n}\n\nexport enum AggregationType {\n RECORD = 'RECORD',\n NONE = 'NONE', //不做聚合 只获取其中一条数据作为节点的record 取其field\n SUM = 'SUM',\n MIN = 'MIN',\n MAX = 'MAX',\n AVG = 'AVG',\n COUNT = 'COUNT',\n CUSTOM = 'CUSTOM'\n}\nexport enum SortType {\n ASC = 'ASC',\n DESC = 'DESC'\n}\nexport interface CalcTotals {\n aggregationType?: AggregationType; // 聚合方式\n // calcFunc?: (query: Record<string, any>, arr: Record<string, any>[]) => number;\n}\n\nexport interface Total {\n /** 是否显示总计; 如果配置了total对象,showGrandTotals默认false */\n showGrandTotals: boolean;\n /** 是否显示小计; 如果配置了total对象,showSubTotals默认为true */\n showSubTotals: boolean;\n\n // // 计算总计方法\n // calcGrandTotals?: CalcTotals;\n // // 计算小计方法\n // calcSubTotals?: CalcTotals;\n /** 小计汇总维度定义 */\n subTotalsDimensions?: string[];\n /** 汇总节点显示名称 默认'总计' */\n grandTotalLabel?: string;\n /** 汇总节点显示名称 默认'小计' */\n subTotalLabel?: string;\n}\n\nexport interface Totals {\n row?: Total & {\n /** 总计显示在上 默认false */\n showGrandTotalsOnTop?: boolean;\n /** 小计显示在上 默认false */\n showSubTotalsOnTop?: boolean;\n };\n column?: Total & {\n /** 总计显示在左 默认false */\n showGrandTotalsOnLeft?: boolean;\n /** 小计显示在左 默认false */\n showSubTotalsOnLeft?: boolean;\n };\n}\n\n//#endregion 总计小计\n\n//#region 排序规则\n// export interface SortRule {\n// //排序维度\n// sortField: string;\n// //以下均为排序方法\n// //1. 指定排序类型\n// sortType?: SortType;\n// //2. 按维度成员指定排序\n// sortBy?: string[];\n// //3. 按指标值排序\n// sortByIndicator?: string;\n// //如果按指标值排序,还需要指定另外一个(行或列)方向的底层维度成员具体值\n// query?: string[];\n// //4. 自定义排序方法function\n// sortFunc?: (a: any, b: any) => number;\n// }\n//以下均为排序方法\n//1. 指定排序类型\nexport interface SortTypeRule {\n /**排序维度 */\n sortField: string;\n /**升序降序 ASC or DESC*/\n sortType?: SortType;\n}\n//2. 按维度成员指定排序\nexport interface SortByRule {\n /**排序维度 */\n sortField: string;\n /**根据指定具体顺序排序 */\n sortBy?: string[];\n}\n//3. 按指标值排序\nexport interface SortByIndicatorRule {\n /**排序维度 */\n sortField: string;\n /**升序降序 ASC or DESC*/\n sortType?: SortType;\n /**排序根据某个指标值 */\n sortByIndicator?: string;\n /**如果按指标值排序,还需要指定另外一个(行或列)方向的底层维度成员具体值。例如按照办公用品下的纸张 ['办公用品', '纸张'] */\n query?: string[];\n}\n//4. 自定义排序方法function\nexport interface SortFuncRule {\n /**排序维度 */\n sortField: string;\n /**自定义排序函数 */\n sortFunc?: (a: any, b: any) => number;\n}\n//自定义排序方法参数\n// export interface SortFuncParam extends SortRule {\n// data: Array<string | Record<string, any>>;\n// }\nexport type SortRule = SortTypeRule | SortByRule | SortByIndicatorRule | SortFuncRule;\nexport type SortRules = SortRule[];\n//#endregion 排序规则\n\n//#region 过滤规则\nexport interface FilterFuncRule {\n filterFunc?: (row: Record<string, any>) => boolean;\n}\nexport interface FilterValueRule {\n filterKey?: string;\n filteredValues?: unknown[];\n}\nexport type FilterRules = Either<FilterFuncRule, FilterValueRule>[];\n//#endregion 过滤规则\n\n//#region 聚合规则\nexport interface AggregationRule<T extends AggregationType> {\n /** 区别于field 重新起个key值,供配置indicators使用 */\n indicatorKey: string;\n // 可以收集单个字段的聚合结果,或者收集多个字段的聚合结果\n field: T extends AggregationType.RECORD ? string[] | string : string;\n aggregationType: T;\n /**计算结果格式化 */\n formatFun?: (value: number, col: number, row: number, table: BaseTableAPI) => number | string;\n}\nexport type AggregationRules = AggregationRule<AggregationType>[];\n//#endregion 聚合规则\n\n//#region 映射规则\nexport interface MappingRule {\n label?: LabelMapping;\n symbol?: SymbolMapping;\n bgColor?: MappingFuncRule;\n}\nexport type MappingRules = MappingRule[];\nexport interface LabelMapping {\n text?: MappingFuncRule;\n color?: MappingFuncRule;\n}\nexport interface SymbolMapping {\n shape?: 'circle' | 'rect';\n color?: MappingFuncRule;\n size?: MappingFuncRule;\n}\n\nexport type MappingFuncRule = {\n indicatorKey: string;\n mapping?: (table: any, value: number) => string;\n};\n\n//#endregion 映射规则\nexport interface DerivedFieldRule {\n fieldName?: string;\n derivedFunc?: (record: Record<string, any>) => any;\n}\nexport type DerivedFieldRules = DerivedFieldRule[];\n/**\n * 基本表数据处理配置\n */\nexport interface IListTableDataConfig {\n // aggregationRules?: AggregationRules; //按照行列维度聚合值计算规则;\n // sortRules?: SortTypeRule | SortByRule | SortFuncRule; //排序规则 不能简单的将sortState挪到这里 sort的规则在column中配置的;\n filterRules?: FilterRules; //过滤规则;\n // totals?: Totals; //小计或总计;\n // derivedFieldRules?: DerivedFieldRules;\n}\n/**\n * 透视表数据处理配置\n */\nexport interface IPivotTableDataConfig {\n aggregationRules?: AggregationRules; //按照行列维度聚合值计算规则;\n sortRules?: SortRules; //排序规则;\n filterRules?: FilterRules; //过滤规则;\n totals?: Totals; //小计或总计;\n /**\n * 目前mappding还不太好用 不建议使用 建议先用style\n */\n mappingRules?: MappingRules;\n derivedFieldRules?: DerivedFieldRules;\n}\n\n/**\n * 透视图数据处理配置\n */\nexport interface IPivotChartDataConfig extends IPivotTableDataConfig {\n /**\n * PivotChart专有\n */\n collectValuesBy?: Record<string, CollectValueBy>;\n /**\n * PivotChart专有\n */\n isPivotChart?: boolean;\n /**\n * PivotChart专有\n */\n dimensionSortArray?: string[];\n}\n\n/** 在处理数据的过程中 去额外收集某个维度的维度值范围 可为离散值或者连续值范围 */\nexport type CollectValueBy = {\n /** 要收集的字段按什么进行分组 */\n by: string[];\n /** 是否计算一个range范围 true的话对应的收集数据的结果为{max:number,min:number} */\n range?: boolean;\n /** 收集是按照sumBy字段相同的进行分组聚合 聚合结果求最大最小值;如果不设置该值 则按单条数据求最大最小值 */\n sumBy?: string[];\n /** 帮助计算列宽使用 如果是chart图表 收集的是xFiled的维度值 可以根据维度值的个数乘于图元宽度计算一个最优列宽*/\n type?: 'xField' | 'yField' | undefined;\n /** 如果是收集的离散值,离散值的排序依据 */\n sortBy?: string[];\n};\nexport type CollectedValue = { max?: number; min?: number } | Array<string>;\n\n//#region 提供给基本表格的类型\nexport type Aggregation = {\n aggregationType: AggregationType;\n showOnTop?: boolean;\n formatFun?: (value: number, col: number, row: number, table: BaseTableAPI) => string | number;\n};\n\nexport type CustomAggregation = {\n aggregationType: AggregationType.CUSTOM;\n aggregationFun: (values: any[], records: any[]) => any;\n showOnTop?: boolean;\n formatFun?: (value: number, col: number, row: number, table: BaseTableAPI) => string | number;\n};\n//#endregion\n"]}
|
|
@@ -3,8 +3,8 @@ import type { SvgIcon } from './icon';
|
|
|
3
3
|
export type { HeaderData } from './list-table/layout-map/api';
|
|
4
4
|
export type LayoutObjectId = number | string;
|
|
5
5
|
import type { Rect } from '../tools/Rect';
|
|
6
|
-
import type { BaseTableAPI, BaseTableConstructorOptions } from './base-table';
|
|
7
|
-
import type {
|
|
6
|
+
import type { BaseTableAPI, BaseTableConstructorOptions, ListTableProtected } from './base-table';
|
|
7
|
+
import type { Aggregation, AggregationType, CustomAggregation, FilterRules, IPivotTableDataConfig } from './new-data-set';
|
|
8
8
|
import type { Either } from '../tools/helper';
|
|
9
9
|
import type { IChartIndicator, IColumnDimension, ICornerDefine, IIndicator, IRowDimension, ITitleDefine } from './pivot-table';
|
|
10
10
|
import type { ColumnsDefine } from './list-table';
|
|
@@ -70,7 +70,6 @@ export interface DataSourceAPI {
|
|
|
70
70
|
}
|
|
71
71
|
export interface SortState {
|
|
72
72
|
field: FieldDef;
|
|
73
|
-
fieldKey?: FieldKeyDef;
|
|
74
73
|
order: SortOrder;
|
|
75
74
|
}
|
|
76
75
|
export interface PivotSortState {
|
|
@@ -103,11 +102,16 @@ export interface ListTableConstructorOptions extends BaseTableConstructorOptions
|
|
|
103
102
|
}) => string | IEditor);
|
|
104
103
|
editCellTrigger?: 'doubleclick' | 'click' | 'api';
|
|
105
104
|
frozenColDragHeaderMode?: 'disabled' | 'adjustFrozenCount' | 'fixedFrozenCount';
|
|
105
|
+
aggregation?: Aggregation | CustomAggregation | (Aggregation | CustomAggregation)[] | ((args: {
|
|
106
|
+
col: number;
|
|
107
|
+
field: string;
|
|
108
|
+
}) => Aggregation | CustomAggregation | (Aggregation | CustomAggregation)[] | null);
|
|
106
109
|
}
|
|
107
110
|
export interface ListTableAPI extends BaseTableAPI {
|
|
108
111
|
options: ListTableConstructorOptions;
|
|
109
112
|
editorManager: EditManeger;
|
|
110
113
|
sortState: SortState[] | SortState | null;
|
|
114
|
+
internalProps: ListTableProtected;
|
|
111
115
|
isListTable: () => true;
|
|
112
116
|
isPivotTable: () => false;
|
|
113
117
|
changeCellValue: (col: number, row: number, value: string | number | null) => void;
|
|
@@ -119,6 +123,15 @@ export interface ListTableAPI extends BaseTableAPI {
|
|
|
119
123
|
addRecord: (record: any, recordIndex?: number) => void;
|
|
120
124
|
addRecords: (records: any[], recordIndex?: number) => void;
|
|
121
125
|
deleteRecords: (recordIndexs: number[]) => void;
|
|
126
|
+
updateRecords: (records: any[], recordIndexs: number[]) => void;
|
|
127
|
+
updateFilterRules: (filterRules: FilterRules) => void;
|
|
128
|
+
getAggregateValuesByField: (field: string | number) => {
|
|
129
|
+
col: number;
|
|
130
|
+
aggregateValue: {
|
|
131
|
+
aggregationType: AggregationType;
|
|
132
|
+
value: number | string;
|
|
133
|
+
}[];
|
|
134
|
+
}[];
|
|
122
135
|
}
|
|
123
136
|
export interface PivotTableConstructorOptions extends BaseTableConstructorOptions {
|
|
124
137
|
records?: any[];
|
|
@@ -143,8 +156,7 @@ export interface PivotTableConstructorOptions extends BaseTableConstructorOption
|
|
|
143
156
|
showRowHeader?: boolean;
|
|
144
157
|
columnHeaderTitle?: ITitleDefine;
|
|
145
158
|
rowHeaderTitle?: ITitleDefine;
|
|
146
|
-
dataConfig?:
|
|
147
|
-
enableDataAnalysis?: boolean;
|
|
159
|
+
dataConfig?: IPivotTableDataConfig;
|
|
148
160
|
indicatorTitle?: string;
|
|
149
161
|
pagination?: IPagination;
|
|
150
162
|
extensionRows?: IExtensionRowDefine[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ts-types/table-engine.ts"],"names":[],"mappings":";;;AAiZA,IAAY,SAKX;AALD,WAAY,SAAS;IACnB,wBAAW,CAAA;IACX,8BAAiB,CAAA;IACjB,0BAAa,CAAA;IACb,4BAAe,CAAA;AACjB,CAAC,EALW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAKpB;AAED,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,mCAAiB,CAAA;IACjB,uCAAqB,CAAA;IACrB,+BAAa,CAAA;AACf,CAAC,EAJW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAIzB","file":"table-engine.js","sourcesContent":["import type { RectProps, MaybePromiseOrUndefined, IDimensionInfo, SortOrder, BaseCellInfo } from './common';\nimport type { SvgIcon } from './icon';\nexport type { HeaderData } from './list-table/layout-map/api';\nexport type LayoutObjectId = number | string;\nimport type { Rect } from '../tools/Rect';\nimport type { BaseTableAPI, BaseTableConstructorOptions } from './base-table';\nimport type { IDataConfig } from './new-data-set';\nimport type { Either } from '../tools/helper';\nimport type {\n IChartIndicator,\n IColumnDimension,\n ICornerDefine,\n IDimension,\n IIndicator,\n IRowDimension,\n ITitleDefine\n} from './pivot-table';\nimport type { ColumnsDefine } from './list-table';\nimport type { ICellAxisOption, ITableAxisOption } from './component/axis';\nimport type { IEditor } from '@visactor/vtable-editors';\nimport type { ITextStyleOption } from '../body-helper/style';\nimport type { DataSource } from '../data';\nimport type { EditManeger } from '../edit/edit-manager';\nimport type { ICustomRender } from './customElement';\nimport type { ICustomLayout } from './customLayout';\n\nexport interface CellAddress {\n col: number;\n row: number;\n}\nexport interface CellAddressWithBound {\n col: number;\n row: number;\n rect?: RectProps;\n x?: number;\n y?: number;\n}\nexport interface CellRange {\n start: CellAddress;\n end: CellAddress;\n}\n\nexport type FieldGetter = (record: any, col?: number, row?: number, table?: BaseTableAPI) => any;\nexport type FieldSetter = (record: any, value: any) => void;\nexport interface FieldAssessor {\n get: FieldGetter;\n set: FieldSetter;\n}\n\nexport type FieldDef = string | number | string[];\nexport type FieldKeyDef = string | number;\nexport type FieldFormat = FieldGetter | FieldAssessor;\n\nexport type FieldData = MaybePromiseOrUndefined;\n\nexport type WidthModeDef = 'standard' | 'adaptive' | 'autoWidth';\nexport type HeightModeDef = 'standard' | 'adaptive' | 'autoHeight';\nexport type ShowColumnRowType = 'column' | 'row' | 'none';\n/** 单元格所处表格哪部分 */\nexport type CellLocation = 'body' | 'rowHeader' | 'columnHeader' | 'cornerHeader';\nexport type CellSubLocation =\n | 'body'\n | 'rowHeader'\n | 'columnHeader'\n | 'cornerHeader'\n | 'bottomFrozen'\n | 'rightFrozen'\n | 'rightTopCorner'\n | 'leftBottomCorner'\n | 'rightBottomCorner';\n\nexport interface TableKeyboardOptions {\n /** tab键 默认为true。开启tab键移动选中单元格,如果当前是在编辑单元格 则移动到下一个单元格也是编辑状态 */\n moveFocusCellOnTab?: boolean;\n /** enter键 默认true 如果选中单元格可编辑则进入单元格编辑*/\n editCellOnEnter?: boolean;\n /** 默认不开启即false。开启这个配置的话,如果当前是在编辑中的单元格,方向键可以移动到下个单元格并进入编辑状态,而不是编辑文本内字符串的光标移动。上下左右方向键切换选中单元格不受该配置影响,*/\n moveEditCellOnArrowKeys?: boolean;\n /** 开启快捷键全选 默认:false */\n selectAllOnCtrlA?: boolean;\n /** 快捷键复制 默认:false*/\n copySelected?: boolean; //这个copy是和浏览器的快捷键一致的\n /** 快捷键粘贴。粘贴内容到指定位置(即需要有选中状态),支持批量粘贴。 默认:false */\n pasteValueToCell?: boolean; //paste是和浏览器的快捷键一致的\n}\nexport interface TableEventOptions {\n /** 是否阻止右键的默认行为, 默认为true。*/\n preventDefaultContextMenu?: boolean;\n}\nexport interface DataSourceAPI {\n clearCurrentIndexedData: () => void;\n length: number;\n get: (index: number) => MaybePromiseOrUndefined;\n getField: <F extends FieldDef>(index: number, field: F, col: number, row: number, table: BaseTableAPI) => FieldData;\n hasField: (index: number, field: FieldDef) => boolean;\n sort: (field: FieldDef, order: SortOrder, orderFn: (v1: any, v2: any, order: SortOrder) => -1 | 0 | 1) => void;\n clearSortedMap: () => void;\n updatePagination: (pagination: IPagination) => void;\n getIndexKey: (index: number) => number | number[];\n /** 数据是否为树形结构 且可以展开收起 */\n enableHierarchyState: boolean;\n}\n\nexport interface SortState {\n /** 排序依据字段 */\n field: FieldDef;\n\n fieldKey?: FieldKeyDef;\n /** 排序规则 */\n order: SortOrder;\n}\nexport interface PivotSortState {\n col: number;\n row: number;\n order: SortOrder;\n}\n\n/**\n * 分页配置\n */\nexport interface IPagination {\n /** 数据总条数 透视表中这个数据会自动加上 不需用户传入*/\n totalCount?: number;\n /** 每页显示数据条数 */\n perPageCount: number;\n /** 每页显示条数 */\n currentPage?: number;\n}\nexport type HeaderValues = Map<any, any>;\nexport interface ListTableConstructorOptions extends BaseTableConstructorOptions {\n /**\n * 数据集合\n */\n records?: any[];\n /**\n * 传入用户实例化的数据对象 目前不完善\n */\n dataSource?: DataSource;\n /**\n * 是否显示表头\n */\n showHeader?: boolean;\n /**\n * Simple header property\n */\n columns?: ColumnsDefine; //请不要再这个上面修改配置,这里相当于是一个原始值备份,有一个内部专用的protectspace.columns\n /**\n *@deprecated 已废弃 请使用columns\n */\n header?: ColumnsDefine;\n\n transpose?: boolean; //是否转置\n /**\n * 展示为tree的列 层级缩进值\n */\n hierarchyIndent?: number;\n /** 展开层数 默认为1只显示根节点*/\n hierarchyExpandLevel?: number;\n\n /** 分页配置 */\n pagination?: IPagination;\n\n /**\n * 排序状态\n */\n sortState?: SortState | SortState[];\n /** 全局设置表头编辑器 */\n headerEditor?: string | IEditor | ((args: BaseCellInfo & { table: BaseTableAPI }) => string | IEditor);\n /** 全局设置编辑器 */\n editor?: string | IEditor | ((args: BaseCellInfo & { table: BaseTableAPI }) => string | IEditor);\n /** 编辑触发时机 双击事件 单击事件 api手动开启编辑。默认为双击'doubleclick' */\n editCellTrigger?: 'doubleclick' | 'click' | 'api';\n /** 拖拽表头移动位置 针对冻结部分的规则 默认为fixedFrozenCount\n * \"disabled\"(禁止调整冻结列位置):不允许其他列的表头移入冻结列,也不允许冻结列移出,冻结列保持不变。\n * \"adjustFrozenCount\"(根据交互结果调整冻结数量):允许其他列的表头移入冻结列,及冻结列移出,并根据拖拽的动作调整冻结列的数量。当其他列的表头被拖拽进入冻结列位置时,冻结列数量增加;当其他列的表头被拖拽移出冻结列位置时,冻结列数量减少。\n * \"fixedFrozenCount\"(可调整冻结列,并维持冻结数量不变):允许自由拖拽其他列的表头移入或移出冻结列位置,同时保持冻结列的数量不变。\n */\n frozenColDragHeaderMode?: 'disabled' | 'adjustFrozenCount' | 'fixedFrozenCount';\n}\n\nexport interface ListTableAPI extends BaseTableAPI {\n options: ListTableConstructorOptions;\n editorManager: EditManeger;\n sortState: SortState[] | SortState | null;\n // internalProps: ListTableProtected;\n isListTable: () => true;\n isPivotTable: () => false;\n /** 设置单元格的value值,注意对应的是源数据的原始值,vtable实例records会做对应修改 */\n changeCellValue: (col: number, row: number, value: string | number | null) => void;\n /**\n * 批量更新多个单元格的数据\n * @param col 粘贴数据的起始列号\n * @param row 粘贴数据的起始行号\n * @param values 多个单元格的数据数组\n */\n changeCellValues: (col: number, row: number, values: (string | number)[][]) => void;\n getFieldData: (field: FieldDef | FieldFormat | undefined, col: number, row: number) => FieldData;\n //#region 编辑器相关demo\n /** 获取单元格配置的编辑器 */\n getEditor: (col: number, row: number) => IEditor;\n /** 开启单元格编辑 */\n startEditCell: (col?: number, row?: number) => void;\n /** 结束编辑 */\n completeEditCell: () => void;\n //#endregion\n addRecord: (record: any, recordIndex?: number) => void;\n addRecords: (records: any[], recordIndex?: number) => void;\n deleteRecords: (recordIndexs: number[]) => void;\n}\nexport interface PivotTableConstructorOptions extends BaseTableConstructorOptions {\n /**\n * 数据集合\n */\n records?: any[];\n /**\n * 调整列宽的生效范围:'column' | 'indicator' | 'all' | 'indicatorGroup',单列|按指标|所有列|属于同一维度值的多个指标\n */\n columnResizeType?: 'column' | 'indicator' | 'all' | 'indicatorGroup';\n /** 设置排序状态,只对应按钮展示效果 无数据排序逻辑 */\n pivotSortState?: {\n dimensions: IDimensionInfo[];\n order: SortOrder;\n }[];\n\n //#region layout中挪到外层的属性\n /**层级维度结构显示形式 */\n rowHierarchyType?: 'grid' | 'tree';\n /**展开层数 */\n rowExpandLevel?: number;\n /**子层级维度缩进距离 */\n rowHierarchyIndent?: number;\n /** 列表头维度结构 */\n columnTree?: IHeaderTreeDefine[];\n /** 行表头维度结构 */\n rowTree?: IHeaderTreeDefine[];\n /** 定义各个维度和各个指标的具体配置项和样式定义 rows 和 dimension 代替掉 */\n // dimensions?: IDimension[];\n\n /** 定义行上各个维度具体配置项和样式定义 */\n rows?: (IRowDimension | string)[]; // (string | IDimension)[]; 后续支持数据分析的透视表 支持string配置\n /** 定义列上各个维度具体配置项和样式定义 */\n columns?: (IColumnDimension | string)[]; // (string | IDimension)[];\n /** 定义指标具体配置项和样式定义 包含表头和body的定义*/\n indicators?: (IIndicator | string)[]; // (string | IIndicator)[];\n\n /** 指标以列展示 ———有数据分析的透视表才需要配置这个 */\n indicatorsAsCol?: boolean;\n /** 指标在具体维度展示的层级顺序,从0开始 ———有数据分析的透视表才需要配置这个 */\n indicatorIndex?: number;\n /** 是否隐藏指标名称 */\n hideIndicatorName?: boolean; //\n /** 指标维度key 注意非具体指标key 数据分析的透视表才需要配置这个 */\n // indicatorDimensionKey?: string;\n /** 角头单元格配置项和样式定义 */\n corner?: ICornerDefine;\n /**\n * boolean 是否显示列维度值表头\n */\n showColumnHeader?: boolean;\n /**\n * boolean 是否显示行维度值表头\n */\n showRowHeader?: boolean;\n /**\n * 列表头增加一行来显示维度名称 可以自定义或者显示dimension.title组合名\n */\n columnHeaderTitle?: ITitleDefine;\n /**\n * 行表头的增加一列来显示维度名称 可以自定义或者显示dimension.title组合名\n */\n rowHeaderTitle?: ITitleDefine;\n //#endregion\n /** 数据分析相关配置 enableDataAnalysis开启后该配置才会有效 */\n dataConfig?: IDataConfig;\n /**\n * 透视表是否开启数据分析 默认false\n * 如果传入数据是明细数据需要聚合分析则开启 赋值为true\n * 如传入数据是经过聚合好的为了提升性能这里设为false即可,同时呢需要传入自己组织好的行头树结构columnTree和rowTree\n */\n enableDataAnalysis?: boolean;\n /** 指标标题 用于显示到角头的值*/\n indicatorTitle?: string;\n /** 分页配置 */\n pagination?: IPagination;\n\n extensionRows?: IExtensionRowDefine[];\n editor?: string | IEditor | ((args: BaseCellInfo & { table: BaseTableAPI }) => string | IEditor);\n}\nexport interface PivotChartConstructorOptions extends BaseTableConstructorOptions {\n /**\n * 数据集合, 平坦数据集合。另外一种特殊方式是传入分组后的数据,分组依据为指标\n */\n records?: any[] | Record<string, any[]>;\n /**\n * 调整列宽的生效范围:'column' | 'indicator' | 'all' | 'indicatorGroup',单列|按指标|所有列|属于同一维度值的多个指标\n */\n columnResizeType?: 'column' | 'indicator' | 'all' | 'indicatorGroup';\n /** 列表头维度结构 */\n columnTree?: IHeaderTreeDefine[];\n /** 行表头维度结构 */\n rowTree?: IHeaderTreeDefine[];\n /** 定义各个维度和各个指标的具体配置项和样式定义 rows 和 dimension 代替掉 */\n // dimensions?: IDimension[];\n\n /** 定义行上各个维度具体配置项和样式定义 */\n rows?: (IRowDimension | string)[]; // (string | IDimension)[]; 后续支持数据分析的透视表 支持string配置\n /** 定义列上各个维度具体配置项和样式定义 */\n columns?: (IColumnDimension | string)[]; // (string | IDimension)[];\n /** 定义指标具体配置项和样式定义 包含表头和body的定义*/\n indicators?: (IChartIndicator | string)[]; // (string | IIndicator)[];\n\n /** 指标以列展示 ———有数据分析的透视表才需要配置这个 */\n indicatorsAsCol?: boolean;\n /** 是否隐藏指标名称 */\n hideIndicatorName?: boolean; //\n /** 角头单元格配置项和样式定义 */\n corner?: ICornerDefine;\n /**\n * boolean 是否显示列维度值表头\n */\n showColumnHeader?: boolean;\n /**\n * boolean 是否显示行维度值表头\n */\n showRowHeader?: boolean;\n /**\n * 列表头增加一行来显示维度名称 可以自定义或者显示dimension.title组合名\n */\n columnHeaderTitle?: ITitleDefine;\n /**\n * 行表头的增加一列来显示维度名称 可以自定义或者显示dimension.title组合名\n */\n rowHeaderTitle?: ITitleDefine;\n /** 指标标题 用于显示到角头的值*/\n indicatorTitle?: string;\n\n axes?: ITableAxisOption[];\n}\nexport interface PivotTableAPI extends BaseTableAPI {\n records?: any;\n options: PivotTableConstructorOptions;\n editorManager: EditManeger;\n // internalProps: PivotTableProtected;\n pivotSortState: PivotSortState[];\n isListTable: () => false;\n isPivotTable: () => true;\n getPivotSortState: (col: number, row: number) => SortOrder;\n toggleHierarchyState: (col: number, row: number) => void;\n /** 设置单元格的value值,注意对应的是源数据的原始值,vtable实例records会做对应修改 */\n changeCellValue: (col: number, row: number, value: string | number | null) => void;\n /**\n * 批量更新多个单元格的数据\n * @param col 粘贴数据的起始列号\n * @param row 粘贴数据的起始行号\n * @param values 多个单元格的数据数组\n */\n changeCellValues: (col: number, row: number, values: (string | number)[][]) => void;\n}\nexport interface PivotChartAPI extends BaseTableAPI {\n records?: any | Record<string, any[]>;\n options: PivotChartConstructorOptions;\n // internalProps: PivotTableProtected;\n isListTable: () => false;\n isPivotTable: () => true;\n}\nexport type SetPasteValueTestData = CellAddress & {\n table: BaseTableAPI;\n record: any;\n value: string;\n\n oldValue: any;\n};\n\nexport interface InlineAPI {\n width: (arg: { ctx: CanvasRenderingContext2D }) => number;\n font: () => string | null;\n color: () => string | null;\n canDraw: () => boolean;\n onReady: (callback: Function) => void;\n\n draw: (opt: any) => void;\n canBreak: () => boolean;\n}\n\nexport interface CellContext {\n readonly col: number;\n readonly row: number;\n /**format之后的值 */\n readonly value: FieldData;\n /**原始值 */\n readonly dataValue: FieldData;\n showIcon?: SvgIcon;\n getContext: () => CanvasRenderingContext2D;\n toCurrentContext: () => CellContext;\n getDrawRect: () => RectProps | null;\n getRect: () => RectProps;\n setRectFilter: (rectFilter: (base: RectProps) => RectProps) => void;\n updateRect: (rect: Rect | RectProps) => void;\n updateDrawRect: (rect: Rect | RectProps) => void;\n}\n\nexport enum Placement {\n top = 'top',\n bottom = 'bottom',\n left = 'left',\n right = 'right'\n}\n\nexport enum HierarchyState {\n expand = 'expand',\n collapse = 'collapse',\n none = 'none'\n}\nexport type IHeaderTreeDefine = Either<IDimensionHeaderNode, IIndicatorHeaderNode>;\nexport interface IIndicatorHeaderNode {\n /**\n * 指标的key值 对应数据集的字段名\n */\n indicatorKey: string | number;\n /**\n * 指标名称 如:“销售额”,“例如”, 对应到单元格显示的值。可不填,不填的话 从indicators的对应配置中取值显示\n */\n value?: string;\n /** 维度成员下的子维度树结构 */\n children?: IHeaderTreeDefine[] | null;\n}\nexport interface IDimensionHeaderNode {\n /**\n * 维度的唯一标识,对应数据集的字段名称\n */\n dimensionKey: string | number;\n /** 维度成员值 */\n value: string;\n /** 维度成员下的子维度树结构 */\n children?: IHeaderTreeDefine[] | null;\n /** 折叠状态 TODO */\n hierarchyState?: HierarchyState;\n}\n\nexport interface IExtensionRowDefine {\n rows: (IRowDimension | string)[];\n rowTree: IHeaderTreeDefine[] | ((args: { dimensionKey: string | number; value: string }[]) => IHeaderTreeDefine[]);\n}\n\nexport type StickCell = { col: number; row: number; dx: number; dy: number };\n\nexport type CustomMergeCell = (col: number, row: number, table: BaseTableAPI) => undefined | CustomMerge;\nexport type CustomMerge = {\n range: CellRange;\n text?: string;\n style?: ITextStyleOption;\n customLayout?: ICustomLayout;\n customRender?: ICustomRender;\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/ts-types/table-engine.ts"],"names":[],"mappings":";;;AAkaA,IAAY,SAKX;AALD,WAAY,SAAS;IACnB,wBAAW,CAAA;IACX,8BAAiB,CAAA;IACjB,0BAAa,CAAA;IACb,4BAAe,CAAA;AACjB,CAAC,EALW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAKpB;AAED,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,mCAAiB,CAAA;IACjB,uCAAqB,CAAA;IACrB,+BAAa,CAAA;AACf,CAAC,EAJW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAIzB","file":"table-engine.js","sourcesContent":["import type { RectProps, MaybePromiseOrUndefined, IDimensionInfo, SortOrder, BaseCellInfo } from './common';\nimport type { SvgIcon } from './icon';\nexport type { HeaderData } from './list-table/layout-map/api';\nexport type LayoutObjectId = number | string;\nimport type { Rect } from '../tools/Rect';\nimport type { BaseTableAPI, BaseTableConstructorOptions, ListTableProtected } from './base-table';\nimport type {\n Aggregation,\n AggregationType,\n CustomAggregation,\n FilterRules,\n IPivotTableDataConfig\n} from './new-data-set';\nimport type { Either } from '../tools/helper';\nimport type {\n IChartIndicator,\n IColumnDimension,\n ICornerDefine,\n IDimension,\n IIndicator,\n IRowDimension,\n ITitleDefine\n} from './pivot-table';\nimport type { ColumnsDefine } from './list-table';\nimport type { ICellAxisOption, ITableAxisOption } from './component/axis';\nimport type { IEditor } from '@visactor/vtable-editors';\nimport type { ITextStyleOption } from '../body-helper/style';\nimport type { DataSource } from '../data';\nimport type { EditManeger } from '../edit/edit-manager';\nimport type { ICustomRender } from './customElement';\nimport type { ICustomLayout } from './customLayout';\n\nexport interface CellAddress {\n col: number;\n row: number;\n}\nexport interface CellAddressWithBound {\n col: number;\n row: number;\n rect?: RectProps;\n x?: number;\n y?: number;\n}\nexport interface CellRange {\n start: CellAddress;\n end: CellAddress;\n}\n\nexport type FieldGetter = (record: any, col?: number, row?: number, table?: BaseTableAPI) => any;\nexport type FieldSetter = (record: any, value: any) => void;\nexport interface FieldAssessor {\n get: FieldGetter;\n set: FieldSetter;\n}\n\nexport type FieldDef = string | number | string[];\nexport type FieldKeyDef = string | number;\nexport type FieldFormat = FieldGetter | FieldAssessor;\n\nexport type FieldData = MaybePromiseOrUndefined;\n\nexport type WidthModeDef = 'standard' | 'adaptive' | 'autoWidth';\nexport type HeightModeDef = 'standard' | 'adaptive' | 'autoHeight';\nexport type ShowColumnRowType = 'column' | 'row' | 'none';\n/** 单元格所处表格哪部分 */\nexport type CellLocation = 'body' | 'rowHeader' | 'columnHeader' | 'cornerHeader';\nexport type CellSubLocation =\n | 'body'\n | 'rowHeader'\n | 'columnHeader'\n | 'cornerHeader'\n | 'bottomFrozen'\n | 'rightFrozen'\n | 'rightTopCorner'\n | 'leftBottomCorner'\n | 'rightBottomCorner';\n\nexport interface TableKeyboardOptions {\n /** tab键 默认为true。开启tab键移动选中单元格,如果当前是在编辑单元格 则移动到下一个单元格也是编辑状态 */\n moveFocusCellOnTab?: boolean;\n /** enter键 默认true 如果选中单元格可编辑则进入单元格编辑*/\n editCellOnEnter?: boolean;\n /** 默认不开启即false。开启这个配置的话,如果当前是在编辑中的单元格,方向键可以移动到下个单元格并进入编辑状态,而不是编辑文本内字符串的光标移动。上下左右方向键切换选中单元格不受该配置影响,*/\n moveEditCellOnArrowKeys?: boolean;\n /** 开启快捷键全选 默认:false */\n selectAllOnCtrlA?: boolean;\n /** 快捷键复制 默认:false*/\n copySelected?: boolean; //这个copy是和浏览器的快捷键一致的\n /** 快捷键粘贴。粘贴内容到指定位置(即需要有选中状态),支持批量粘贴。 默认:false */\n pasteValueToCell?: boolean; //paste是和浏览器的快捷键一致的\n}\nexport interface TableEventOptions {\n /** 是否阻止右键的默认行为, 默认为true。*/\n preventDefaultContextMenu?: boolean;\n}\nexport interface DataSourceAPI {\n clearCurrentIndexedData: () => void;\n length: number;\n get: (index: number) => MaybePromiseOrUndefined;\n getField: <F extends FieldDef>(index: number, field: F, col: number, row: number, table: BaseTableAPI) => FieldData;\n hasField: (index: number, field: FieldDef) => boolean;\n sort: (field: FieldDef, order: SortOrder, orderFn: (v1: any, v2: any, order: SortOrder) => -1 | 0 | 1) => void;\n clearSortedMap: () => void;\n updatePagination: (pagination: IPagination) => void;\n getIndexKey: (index: number) => number | number[];\n /** 数据是否为树形结构 且可以展开收起 */\n enableHierarchyState: boolean;\n}\n\nexport interface SortState {\n /** 排序依据字段 */\n field: FieldDef;\n /** 排序规则 */\n order: SortOrder;\n}\nexport interface PivotSortState {\n col: number;\n row: number;\n order: SortOrder;\n}\n\n/**\n * 分页配置\n */\nexport interface IPagination {\n /** 数据总条数 透视表中这个数据会自动加上 不需用户传入*/\n totalCount?: number;\n /** 每页显示数据条数 */\n perPageCount: number;\n /** 每页显示条数 */\n currentPage?: number;\n}\nexport type HeaderValues = Map<any, any>;\nexport interface ListTableConstructorOptions extends BaseTableConstructorOptions {\n /**\n * 数据集合\n */\n records?: any[];\n /**\n * 传入用户实例化的数据对象 目前不完善\n */\n dataSource?: DataSource;\n /**\n * 是否显示表头\n */\n showHeader?: boolean;\n /**\n * Simple header property\n */\n columns?: ColumnsDefine; //请不要再这个上面修改配置,这里相当于是一个原始值备份,有一个内部专用的protectspace.columns\n /**\n *@deprecated 已废弃 请使用columns\n */\n header?: ColumnsDefine;\n\n transpose?: boolean; //是否转置\n /**\n * 展示为tree的列 层级缩进值\n */\n hierarchyIndent?: number;\n /** 展开层数 默认为1只显示根节点*/\n hierarchyExpandLevel?: number;\n\n /** 分页配置 */\n pagination?: IPagination;\n\n /**\n * 排序状态\n */\n sortState?: SortState | SortState[];\n /** 数据分析相关配置 enableDataAnalysis开启后该配置才会有效 */\n // dataConfig?: IListTableDataConfig;\n /** 全局设置表头编辑器 */\n headerEditor?: string | IEditor | ((args: BaseCellInfo & { table: BaseTableAPI }) => string | IEditor);\n /** 全局设置编辑器 */\n editor?: string | IEditor | ((args: BaseCellInfo & { table: BaseTableAPI }) => string | IEditor);\n /** 编辑触发时机 双击事件 单击事件 api手动开启编辑。默认为双击'doubleclick' */\n editCellTrigger?: 'doubleclick' | 'click' | 'api';\n /** 拖拽表头移动位置 针对冻结部分的规则 默认为fixedFrozenCount\n * \"disabled\"(禁止调整冻结列位置):不允许其他列的表头移入冻结列,也不允许冻结列移出,冻结列保持不变。\n * \"adjustFrozenCount\"(根据交互结果调整冻结数量):允许其他列的表头移入冻结列,及冻结列移出,并根据拖拽的动作调整冻结列的数量。当其他列的表头被拖拽进入冻结列位置时,冻结列数量增加;当其他列的表头被拖拽移出冻结列位置时,冻结列数量减少。\n * \"fixedFrozenCount\"(可调整冻结列,并维持冻结数量不变):允许自由拖拽其他列的表头移入或移出冻结列位置,同时保持冻结列的数量不变。\n */\n frozenColDragHeaderMode?: 'disabled' | 'adjustFrozenCount' | 'fixedFrozenCount';\n aggregation?:\n | Aggregation\n | CustomAggregation\n | (Aggregation | CustomAggregation)[]\n | ((args: {\n col: number;\n field: string;\n }) => Aggregation | CustomAggregation | (Aggregation | CustomAggregation)[] | null);\n}\n\nexport interface ListTableAPI extends BaseTableAPI {\n options: ListTableConstructorOptions;\n editorManager: EditManeger;\n sortState: SortState[] | SortState | null;\n // /** 数据分析相关配置 */\n // dataConfig?: IListTableDataConfig;\n internalProps: ListTableProtected;\n isListTable: () => true;\n isPivotTable: () => false;\n /** 设置单元格的value值,注意对应的是源数据的原始值,vtable实例records会做对应修改 */\n changeCellValue: (col: number, row: number, value: string | number | null) => void;\n /**\n * 批量更新多个单元格的数据\n * @param col 粘贴数据的起始列号\n * @param row 粘贴数据的起始行号\n * @param values 多个单元格的数据数组\n */\n changeCellValues: (col: number, row: number, values: (string | number)[][]) => void;\n getFieldData: (field: FieldDef | FieldFormat | undefined, col: number, row: number) => FieldData;\n //#region 编辑器相关demo\n /** 获取单元格配置的编辑器 */\n getEditor: (col: number, row: number) => IEditor;\n /** 开启单元格编辑 */\n startEditCell: (col?: number, row?: number) => void;\n /** 结束编辑 */\n completeEditCell: () => void;\n //#endregion\n addRecord: (record: any, recordIndex?: number) => void;\n addRecords: (records: any[], recordIndex?: number) => void;\n deleteRecords: (recordIndexs: number[]) => void;\n updateRecords: (records: any[], recordIndexs: number[]) => void;\n updateFilterRules: (filterRules: FilterRules) => void;\n getAggregateValuesByField: (field: string | number) => {\n col: number;\n aggregateValue: { aggregationType: AggregationType; value: number | string }[];\n }[];\n}\nexport interface PivotTableConstructorOptions extends BaseTableConstructorOptions {\n /**\n * 数据集合\n */\n records?: any[];\n /**\n * 调整列宽的生效范围:'column' | 'indicator' | 'all' | 'indicatorGroup',单列|按指标|所有列|属于同一维度值的多个指标\n */\n columnResizeType?: 'column' | 'indicator' | 'all' | 'indicatorGroup';\n /** 设置排序状态,只对应按钮展示效果 无数据排序逻辑 */\n pivotSortState?: {\n dimensions: IDimensionInfo[];\n order: SortOrder;\n }[];\n\n //#region layout中挪到外层的属性\n /**层级维度结构显示形式 */\n rowHierarchyType?: 'grid' | 'tree';\n /**展开层数 */\n rowExpandLevel?: number;\n /**子层级维度缩进距离 */\n rowHierarchyIndent?: number;\n /** 列表头维度结构 */\n columnTree?: IHeaderTreeDefine[];\n /** 行表头维度结构 */\n rowTree?: IHeaderTreeDefine[];\n /** 定义各个维度和各个指标的具体配置项和样式定义 rows 和 dimension 代替掉 */\n // dimensions?: IDimension[];\n\n /** 定义行上各个维度具体配置项和样式定义 */\n rows?: (IRowDimension | string)[]; // (string | IDimension)[]; 后续支持数据分析的透视表 支持string配置\n /** 定义列上各个维度具体配置项和样式定义 */\n columns?: (IColumnDimension | string)[]; // (string | IDimension)[];\n /** 定义指标具体配置项和样式定义 包含表头和body的定义*/\n indicators?: (IIndicator | string)[]; // (string | IIndicator)[];\n\n /** 指标以列展示 ———有数据分析的透视表才需要配置这个 */\n indicatorsAsCol?: boolean;\n /** 指标在具体维度展示的层级顺序,从0开始 ———有数据分析的透视表才需要配置这个 */\n indicatorIndex?: number;\n /** 是否隐藏指标名称 */\n hideIndicatorName?: boolean; //\n /** 指标维度key 注意非具体指标key 数据分析的透视表才需要配置这个 */\n // indicatorDimensionKey?: string;\n /** 角头单元格配置项和样式定义 */\n corner?: ICornerDefine;\n /**\n * boolean 是否显示列维度值表头\n */\n showColumnHeader?: boolean;\n /**\n * boolean 是否显示行维度值表头\n */\n showRowHeader?: boolean;\n /**\n * 列表头增加一行来显示维度名称 可以自定义或者显示dimension.title组合名\n */\n columnHeaderTitle?: ITitleDefine;\n /**\n * 行表头的增加一列来显示维度名称 可以自定义或者显示dimension.title组合名\n */\n rowHeaderTitle?: ITitleDefine;\n //#endregion\n /** 数据分析相关配置 enableDataAnalysis开启后该配置才会有效 */\n dataConfig?: IPivotTableDataConfig;\n\n /** 指标标题 用于显示到角头的值*/\n indicatorTitle?: string;\n /** 分页配置 */\n pagination?: IPagination;\n\n extensionRows?: IExtensionRowDefine[];\n editor?: string | IEditor | ((args: BaseCellInfo & { table: BaseTableAPI }) => string | IEditor);\n}\nexport interface PivotChartConstructorOptions extends BaseTableConstructorOptions {\n /**\n * 数据集合, 平坦数据集合。另外一种特殊方式是传入分组后的数据,分组依据为指标\n */\n records?: any[] | Record<string, any[]>;\n /**\n * 调整列宽的生效范围:'column' | 'indicator' | 'all' | 'indicatorGroup',单列|按指标|所有列|属于同一维度值的多个指标\n */\n columnResizeType?: 'column' | 'indicator' | 'all' | 'indicatorGroup';\n /** 列表头维度结构 */\n columnTree?: IHeaderTreeDefine[];\n /** 行表头维度结构 */\n rowTree?: IHeaderTreeDefine[];\n /** 定义各个维度和各个指标的具体配置项和样式定义 rows 和 dimension 代替掉 */\n // dimensions?: IDimension[];\n\n /** 定义行上各个维度具体配置项和样式定义 */\n rows?: (IRowDimension | string)[]; // (string | IDimension)[]; 后续支持数据分析的透视表 支持string配置\n /** 定义列上各个维度具体配置项和样式定义 */\n columns?: (IColumnDimension | string)[]; // (string | IDimension)[];\n /** 定义指标具体配置项和样式定义 包含表头和body的定义*/\n indicators?: (IChartIndicator | string)[]; // (string | IIndicator)[];\n\n /** 指标以列展示 ———有数据分析的透视表才需要配置这个 */\n indicatorsAsCol?: boolean;\n /** 是否隐藏指标名称 */\n hideIndicatorName?: boolean; //\n /** 角头单元格配置项和样式定义 */\n corner?: ICornerDefine;\n /**\n * boolean 是否显示列维度值表头\n */\n showColumnHeader?: boolean;\n /**\n * boolean 是否显示行维度值表头\n */\n showRowHeader?: boolean;\n /**\n * 列表头增加一行来显示维度名称 可以自定义或者显示dimension.title组合名\n */\n columnHeaderTitle?: ITitleDefine;\n /**\n * 行表头的增加一列来显示维度名称 可以自定义或者显示dimension.title组合名\n */\n rowHeaderTitle?: ITitleDefine;\n /** 指标标题 用于显示到角头的值*/\n indicatorTitle?: string;\n\n axes?: ITableAxisOption[];\n}\nexport interface PivotTableAPI extends BaseTableAPI {\n records?: any;\n options: PivotTableConstructorOptions;\n editorManager: EditManeger;\n // internalProps: PivotTableProtected;\n pivotSortState: PivotSortState[];\n isListTable: () => false;\n isPivotTable: () => true;\n getPivotSortState: (col: number, row: number) => SortOrder;\n toggleHierarchyState: (col: number, row: number) => void;\n /** 设置单元格的value值,注意对应的是源数据的原始值,vtable实例records会做对应修改 */\n changeCellValue: (col: number, row: number, value: string | number | null) => void;\n /**\n * 批量更新多个单元格的数据\n * @param col 粘贴数据的起始列号\n * @param row 粘贴数据的起始行号\n * @param values 多个单元格的数据数组\n */\n changeCellValues: (col: number, row: number, values: (string | number)[][]) => void;\n}\nexport interface PivotChartAPI extends BaseTableAPI {\n records?: any | Record<string, any[]>;\n options: PivotChartConstructorOptions;\n // internalProps: PivotTableProtected;\n isListTable: () => false;\n isPivotTable: () => true;\n}\nexport type SetPasteValueTestData = CellAddress & {\n table: BaseTableAPI;\n record: any;\n value: string;\n\n oldValue: any;\n};\n\nexport interface InlineAPI {\n width: (arg: { ctx: CanvasRenderingContext2D }) => number;\n font: () => string | null;\n color: () => string | null;\n canDraw: () => boolean;\n onReady: (callback: Function) => void;\n\n draw: (opt: any) => void;\n canBreak: () => boolean;\n}\n\nexport interface CellContext {\n readonly col: number;\n readonly row: number;\n /**format之后的值 */\n readonly value: FieldData;\n /**原始值 */\n readonly dataValue: FieldData;\n showIcon?: SvgIcon;\n getContext: () => CanvasRenderingContext2D;\n toCurrentContext: () => CellContext;\n getDrawRect: () => RectProps | null;\n getRect: () => RectProps;\n setRectFilter: (rectFilter: (base: RectProps) => RectProps) => void;\n updateRect: (rect: Rect | RectProps) => void;\n updateDrawRect: (rect: Rect | RectProps) => void;\n}\n\nexport enum Placement {\n top = 'top',\n bottom = 'bottom',\n left = 'left',\n right = 'right'\n}\n\nexport enum HierarchyState {\n expand = 'expand',\n collapse = 'collapse',\n none = 'none'\n}\nexport type IHeaderTreeDefine = Either<IDimensionHeaderNode, IIndicatorHeaderNode>;\nexport interface IIndicatorHeaderNode {\n /**\n * 指标的key值 对应数据集的字段名\n */\n indicatorKey: string | number;\n /**\n * 指标名称 如:“销售额”,“例如”, 对应到单元格显示的值。可不填,不填的话 从indicators的对应配置中取值显示\n */\n value?: string;\n /** 维度成员下的子维度树结构 */\n children?: IHeaderTreeDefine[] | null;\n}\nexport interface IDimensionHeaderNode {\n /**\n * 维度的唯一标识,对应数据集的字段名称\n */\n dimensionKey: string | number;\n /** 维度成员值 */\n value: string;\n /** 维度成员下的子维度树结构 */\n children?: IHeaderTreeDefine[] | null;\n /** 折叠状态 TODO */\n hierarchyState?: HierarchyState;\n}\n\nexport interface IExtensionRowDefine {\n rows: (IRowDimension | string)[];\n rowTree: IHeaderTreeDefine[] | ((args: { dimensionKey: string | number; value: string }[]) => IHeaderTreeDefine[]);\n}\n\nexport type StickCell = { col: number; row: number; dx: number; dy: number };\n\nexport type CustomMergeCell = (col: number, row: number, table: BaseTableAPI) => undefined | CustomMerge;\nexport type CustomMerge = {\n range: CellRange;\n text?: string;\n style?: ITextStyleOption;\n customLayout?: ICustomLayout;\n customRender?: ICustomRender;\n};\n"]}
|
package/cjs/ts-types/theme.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ts-types/theme.ts"],"names":[],"mappings":"","file":"theme.js","sourcesContent":["/* eslint-disable sort-imports */\nimport type { ColorsDef, LineDashsDef, LineWidthsDef, LineWidthsPropertyDefine } from '.';\nimport type { ITextStyleOption } from './column/style';\nimport type { ColorPropertyDefine, ColorsPropertyDefine } from './style-define';\nimport type { ColumnIconOption } from './icon';\nimport type { ICellAxisOption } from './component/axis';\nimport type { PopTipAttributes } from '@visactor/vrender-components';\n// ****** Custom Theme *******\nexport type PartialTableThemeDefine = Partial<ITableThemeDefine>;\nexport type ThemeStyle = ITextStyleOption & {\n hover?: Omit<InteractionStyle, 'cellBorderColor' | 'cellBorderLineWidth'>; //鼠标hover到某个单元格\n // click?: Omit<InteractionStyle, 'inlineRowBgColor' | 'inlineColumnBgColor'>; //鼠标点击到某个单元格\n frameStyle?: FrameStyle;\n};\nexport type InteractionStyle = {\n cellBorderColor?: ColorsPropertyDefine; //交互所在单元格的边框颜色\n cellBorderLineWidth?: LineWidthsPropertyDefine;\n // cellBorderLineDash?:LineDashsPropertyDefine,//用到的场景应该不多\n cellBgColor?: ColorPropertyDefine; //交互所在单元格的背景颜色\n // inlineRowBorderColor?: ColorsPropertyDefine,//交互所在整行的边框颜色\n inlineRowBgColor?: ColorPropertyDefine; //交互所在整行的背景颜色\n // inlineColBorderColor?: ColorsPropertyDefine,//交互所在整列的边框颜色\n inlineColumnBgColor?: ColorPropertyDefine; //交互所在整列的背景颜色\n // headerHighlightBorderColor?:ColorPropertyDefine,//表头底部高亮线\n};\nexport type FrameStyle = {\n borderColor?: ColorsDef;\n borderLineWidth?: LineWidthsDef;\n borderLineDash?: LineDashsDef;\n};\nexport type TableFrameStyle = FrameStyle & {\n shadowBlur?: number; //阴影宽度\n shadowOffsetX?: number; //x方向偏移\n shadowOffsetY?: number; //Y方向偏移\n shadowColor?: string; //阴影颜色\n cornerRadius?: number; //边框圆角半径\n};\nexport type menuStyle = {\n color?: string;\n highlightColor?: string;\n fontSize?: number;\n fontFamily?: string;\n highlightFontSize?: number;\n highlightFontFamily?: string;\n hoverBgColor?: string;\n};\nexport type ScrollStyle = {\n /**滚动条滚动的颜色 */\n scrollRailColor?: string;\n /**滚动条滑块的颜色 */\n scrollSliderColor?: string;\n /**滚动条宽度大小 */\n width?: number;\n /**滚动条是否可见 'always' | 'scrolling' | 'none' | 'focus',常驻|滚动时|不显示|聚焦在画布上时 */\n visible?: 'always' | 'scrolling' | 'none' | 'focus';\n /*** 悬浮与容器上,还是独立于容器外 */\n hoverOn?: boolean;\n};\n/**\n * 气泡框,按钮的的解释信息\n */\nexport type TooltipStyle = {\n fontFamily?: string;\n fontSize?: number;\n color?: string;\n padding?: number[];\n bgColor?: string;\n /** !目前未实现该逻辑。触发行为:hover or click */\n // trigger?: string | string[];\n /**气泡框位置,可选 top left right bottom */\n // placement?: Placement;\n};\nexport interface ITableThemeDefine {\n /** 表格绘制范围外的canvas上填充的颜色 */\n underlayBackgroundColor?: string;\n // selectionBgColor?: ColorPropertyDefine; //多选单元格背景色 手动设置的多选 非框选\n defaultStyle?: ThemeStyle;\n cornerHeaderStyle?: ThemeStyle; //角头样式\n cornerRightTopCellStyle?: ThemeStyle; // 右上角占位单元格样式\n cornerLeftBottomCellStyle?: ThemeStyle; // 左下角占位单元格样式\n cornerRightBottomCellStyle?: ThemeStyle; // 右下角占位单元格样式\n rightFrozenStyle?: ThemeStyle; // 右侧冻结单元格样式\n bottomFrozenStyle?: ThemeStyle; // 下部冻结单元格样式\n headerStyle?: ThemeStyle;\n rowHeaderStyle?: ThemeStyle;\n bodyStyle?: ThemeStyle;\n frameStyle?: TableFrameStyle;\n //列调整宽度的直线\n columnResize?: {\n lineColor: ColorPropertyDefine; //上面线的颜色\n bgColor?: ColorPropertyDefine; //背景线的颜色\n lineWidth: number; //上面线的宽度\n width?: number; //背景线的宽度\n labelColor?: string; //label的颜色\n labelFontSize?: number; //label的字体大小\n labelFontFamily?: string; //label的字体\n labelBackgroundFill?: string; //label的背景填充\n labelBackgroundCornerRadius?: number; //label的背景圆角\n };\n //拖拽表格换位分割线的样式\n dragHeaderSplitLine?: {\n lineColor: ColorPropertyDefine; //上面线的颜色\n lineWidth: number; //上面线的宽度\n shadowBlockColor?: string; //拖拽时阴影区域的颜色\n };\n //冻结列后面的效果\n frozenColumnLine?: {\n shadow?: {\n //默认效果 会有阴影配置\n width: number; //阴影整体宽度\n startColor: string; //开始颜色\n endColor: string; //结束颜色\n };\n /** TODO 暂未生效 */\n border?: {\n //有些需求要两种效果 这里配置滚动前的边框效果(实现方式是两条线叠加产生),滚动后按上面的阴影效果\n lineColor: ColorPropertyDefine; //上面线的颜色\n bgColor?: ColorPropertyDefine; //背景线的颜色\n lineWidth: number; //上面线的宽度\n width?: number; //背景线的宽度\n };\n };\n\n // menuStyle?: menuStyle;\n scrollStyle?: ScrollStyle;\n tooltipStyle?: TooltipStyle;\n // selectHeaderHighlight?: boolean;\n /** 选择框样式 */\n selectionStyle?: //Omit<InteractionStyle, 'inlineRowBgColor' | 'inlineColumnBgColor'>; //鼠标点击到某个单元格\n {\n cellBorderColor?: string; //边框颜色\n cellBorderLineWidth?: number; //边框线宽度\n cellBgColor?: string; //选择框背景颜色\n };\n\n // style for axis\n axisStyle?: {\n defaultAxisStyle?: Omit<ICellAxisOption, 'type' | 'domain' | 'range' | 'orient' | '__ticksForVTable'>;\n leftAxisStyle?: Omit<ICellAxisOption, 'type' | 'domain' | 'range' | 'orient' | '__ticksForVTable'>;\n rightAxisStyle?: Omit<ICellAxisOption, 'type' | 'domain' | 'range' | 'orient' | '__ticksForVTable'>;\n topAxisStyle?: Omit<ICellAxisOption, 'type' | 'domain' | 'range' | 'orient' | '__ticksForVTable'>;\n bottomAxisStyle?: Omit<ICellAxisOption, 'type' | 'domain' | 'range' | 'orient' | '__ticksForVTable'>;\n };\n\n // style for text pop tip\n textPopTipStyle?: PopTipAttributes;\n}\n\nexport type RequiredTableThemeDefine = Required<ITableThemeDefine>;\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/ts-types/theme.ts"],"names":[],"mappings":"","file":"theme.js","sourcesContent":["/* eslint-disable sort-imports */\nimport type { ColorsDef, LineDashsDef, LineWidthsDef, LineWidthsPropertyDefine } from '.';\nimport type { ITextStyleOption } from './column/style';\nimport type { ColorPropertyDefine, ColorsPropertyDefine } from './style-define';\nimport type { ColumnIconOption } from './icon';\nimport type { ICellAxisOption } from './component/axis';\nimport type { PopTipAttributes } from '@visactor/vrender-components';\n// ****** Custom Theme *******\nexport type PartialTableThemeDefine = Partial<ITableThemeDefine>;\nexport type ThemeStyle = ITextStyleOption & {\n hover?: Omit<InteractionStyle, 'cellBorderColor' | 'cellBorderLineWidth'>; //鼠标hover到某个单元格\n // click?: Omit<InteractionStyle, 'inlineRowBgColor' | 'inlineColumnBgColor'>; //鼠标点击到某个单元格\n frameStyle?: FrameStyle;\n};\nexport type InteractionStyle = {\n cellBorderColor?: ColorsPropertyDefine; //交互所在单元格的边框颜色\n cellBorderLineWidth?: LineWidthsPropertyDefine;\n // cellBorderLineDash?:LineDashsPropertyDefine,//用到的场景应该不多\n cellBgColor?: ColorPropertyDefine; //交互所在单元格的背景颜色\n // inlineRowBorderColor?: ColorsPropertyDefine,//交互所在整行的边框颜色\n inlineRowBgColor?: ColorPropertyDefine; //交互所在整行的背景颜色\n // inlineColBorderColor?: ColorsPropertyDefine,//交互所在整列的边框颜色\n inlineColumnBgColor?: ColorPropertyDefine; //交互所在整列的背景颜色\n // headerHighlightBorderColor?:ColorPropertyDefine,//表头底部高亮线\n};\nexport type FrameStyle = {\n borderColor?: ColorsDef;\n borderLineWidth?: LineWidthsDef;\n borderLineDash?: LineDashsDef;\n innerBorder?: boolean;\n};\nexport type TableFrameStyle = FrameStyle & {\n shadowBlur?: number; //阴影宽度\n shadowOffsetX?: number; //x方向偏移\n shadowOffsetY?: number; //Y方向偏移\n shadowColor?: string; //阴影颜色\n cornerRadius?: number; //边框圆角半径\n};\nexport type menuStyle = {\n color?: string;\n highlightColor?: string;\n fontSize?: number;\n fontFamily?: string;\n highlightFontSize?: number;\n highlightFontFamily?: string;\n hoverBgColor?: string;\n};\nexport type ScrollStyle = {\n /**滚动条滚动的颜色 */\n scrollRailColor?: string;\n /**滚动条滑块的颜色 */\n scrollSliderColor?: string;\n /**滚动条宽度大小 */\n width?: number;\n /**滚动条是否可见 'always' | 'scrolling' | 'none' | 'focus',常驻|滚动时|不显示|聚焦在画布上时 */\n visible?: 'always' | 'scrolling' | 'none' | 'focus';\n /*** 悬浮与容器上,还是独立于容器外 */\n hoverOn?: boolean;\n};\n/**\n * 气泡框,按钮的的解释信息\n */\nexport type TooltipStyle = {\n fontFamily?: string;\n fontSize?: number;\n color?: string;\n padding?: number[];\n bgColor?: string;\n /** !目前未实现该逻辑。触发行为:hover or click */\n // trigger?: string | string[];\n /**气泡框位置,可选 top left right bottom */\n // placement?: Placement;\n};\nexport interface ITableThemeDefine {\n /** 表格绘制范围外的canvas上填充的颜色 */\n underlayBackgroundColor?: string;\n // selectionBgColor?: ColorPropertyDefine; //多选单元格背景色 手动设置的多选 非框选\n defaultStyle?: ThemeStyle;\n cornerHeaderStyle?: ThemeStyle; //角头样式\n cornerRightTopCellStyle?: ThemeStyle; // 右上角占位单元格样式\n cornerLeftBottomCellStyle?: ThemeStyle; // 左下角占位单元格样式\n cornerRightBottomCellStyle?: ThemeStyle; // 右下角占位单元格样式\n rightFrozenStyle?: ThemeStyle; // 右侧冻结单元格样式\n bottomFrozenStyle?: ThemeStyle; // 下部冻结单元格样式\n headerStyle?: ThemeStyle;\n rowHeaderStyle?: ThemeStyle;\n bodyStyle?: ThemeStyle;\n frameStyle?: TableFrameStyle;\n //列调整宽度的直线\n columnResize?: {\n lineColor: ColorPropertyDefine; //上面线的颜色\n bgColor?: ColorPropertyDefine; //背景线的颜色\n lineWidth: number; //上面线的宽度\n width?: number; //背景线的宽度\n labelColor?: string; //label的颜色\n labelFontSize?: number; //label的字体大小\n labelFontFamily?: string; //label的字体\n labelBackgroundFill?: string; //label的背景填充\n labelBackgroundCornerRadius?: number; //label的背景圆角\n };\n //拖拽表格换位分割线的样式\n dragHeaderSplitLine?: {\n lineColor: ColorPropertyDefine; //上面线的颜色\n lineWidth: number; //上面线的宽度\n shadowBlockColor?: string; //拖拽时阴影区域的颜色\n };\n //冻结列后面的效果\n frozenColumnLine?: {\n shadow?: {\n //默认效果 会有阴影配置\n width: number; //阴影整体宽度\n startColor: string; //开始颜色\n endColor: string; //结束颜色\n };\n /** TODO 暂未生效 */\n border?: {\n //有些需求要两种效果 这里配置滚动前的边框效果(实现方式是两条线叠加产生),滚动后按上面的阴影效果\n lineColor: ColorPropertyDefine; //上面线的颜色\n bgColor?: ColorPropertyDefine; //背景线的颜色\n lineWidth: number; //上面线的宽度\n width?: number; //背景线的宽度\n };\n };\n\n // menuStyle?: menuStyle;\n scrollStyle?: ScrollStyle;\n tooltipStyle?: TooltipStyle;\n // selectHeaderHighlight?: boolean;\n /** 选择框样式 */\n selectionStyle?: //Omit<InteractionStyle, 'inlineRowBgColor' | 'inlineColumnBgColor'>; //鼠标点击到某个单元格\n {\n cellBorderColor?: string; //边框颜色\n cellBorderLineWidth?: number; //边框线宽度\n cellBgColor?: string; //选择框背景颜色\n };\n\n // style for axis\n axisStyle?: {\n defaultAxisStyle?: Omit<ICellAxisOption, 'type' | 'domain' | 'range' | 'orient' | '__ticksForVTable'>;\n leftAxisStyle?: Omit<ICellAxisOption, 'type' | 'domain' | 'range' | 'orient' | '__ticksForVTable'>;\n rightAxisStyle?: Omit<ICellAxisOption, 'type' | 'domain' | 'range' | 'orient' | '__ticksForVTable'>;\n topAxisStyle?: Omit<ICellAxisOption, 'type' | 'domain' | 'range' | 'orient' | '__ticksForVTable'>;\n bottomAxisStyle?: Omit<ICellAxisOption, 'type' | 'domain' | 'range' | 'orient' | '__ticksForVTable'>;\n };\n\n // style for text pop tip\n textPopTipStyle?: PopTipAttributes;\n}\n\nexport type RequiredTableThemeDefine = Required<ITableThemeDefine>;\n"]}
|
package/cjs/vrender.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/vrender.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kCAAgC;AAChC,yDAA8F;AAC9F,yDAAqE;AACrE,yDAmBgC;AAIhC,IAAI,QAAQ,GAAG,KAAK,CAAC;AACrB,SAAgB,kBAAkB;IAChC,IAAI,QAAQ,EAAE;QACZ,OAAO;KACR;IACD,QAAQ,GAAG,IAAI,CAAC;IAEhB,IAAA,+BAAgB,GAAE,CAAC;IAEnB,IAAI,IAAA,2BAAY,GAAE,EAAE;QAClB,IAAA,6BAAc,EAAC,wBAAS,CAAC,CAAC;KAC3B;SAAM,IAAI,IAAA,wBAAS,GAAE,EAAE;QACtB,IAAA,0BAAW,EAAC,wBAAS,CAAC,CAAC;KACxB;IACD,IAAA,0BAAW,GAAE,CAAC;IACd,IAAA,4BAAa,GAAE,CAAC;IAChB,IAAA,2BAAY,GAAE,CAAC;IACf,IAAA,6BAAc,GAAE,CAAC;IACjB,IAAA,4BAAa,GAAE,CAAC;IAChB,IAAA,4BAAa,GAAE,CAAC;IAChB,IAAA,4BAAa,GAAE,CAAC;IAChB,IAAA,2BAAY,GAAE,CAAC;IACf,IAAA,2BAAY,GAAE,CAAC;IACf,IAAA,8BAAe,GAAE,CAAC;IAClB,IAAA,gCAAiB,GAAE,CAAC;IACpB,IAAA,2BAAY,GAAE,CAAC;IACf,IAAA,6BAAc,GAAE,CAAC;IACjB,IAAA,+BAAgB,GAAE,CAAC;IACnB,IAAA,iCAAkB,GAAE,CAAC;IACrB,IAAA,6BAAc,GAAE,CAAC;IACjB,IAAA,2BAAY,GAAE,CAAC;IACf,IAAA,+BAAgB,GAAE,CAAC;AACrB,CAAC;AA/BD,gDA+BC;AAED,yDAAuC;AACvC,yDAAuC","file":"vrender.js","sourcesContent":["import '@visactor/vrender-core';\nimport { container, isBrowserEnv, isNodeEnv, preLoadAllModule } from '@visactor/vrender-core';\nimport { loadBrowserEnv, loadNodeEnv } from '@visactor/vrender-kits';\nimport {\n registerArc,\n registerArc3d,\n registerArea,\n registerCircle,\n registerGlyph,\n registerGroup,\n registerImage,\n registerLine,\n registerPath,\n registerPolygon,\n registerPyramid3d,\n registerRect,\n registerRect3d,\n registerRichtext,\n registerShadowRoot,\n registerSymbol,\n registerText,\n registerWrapText\n} from '@visactor/vrender-kits';\n// 导出版本号\n// export const version = \"0.
|
|
1
|
+
{"version":3,"sources":["../src/vrender.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kCAAgC;AAChC,yDAA8F;AAC9F,yDAAqE;AACrE,yDAmBgC;AAIhC,IAAI,QAAQ,GAAG,KAAK,CAAC;AACrB,SAAgB,kBAAkB;IAChC,IAAI,QAAQ,EAAE;QACZ,OAAO;KACR;IACD,QAAQ,GAAG,IAAI,CAAC;IAEhB,IAAA,+BAAgB,GAAE,CAAC;IAEnB,IAAI,IAAA,2BAAY,GAAE,EAAE;QAClB,IAAA,6BAAc,EAAC,wBAAS,CAAC,CAAC;KAC3B;SAAM,IAAI,IAAA,wBAAS,GAAE,EAAE;QACtB,IAAA,0BAAW,EAAC,wBAAS,CAAC,CAAC;KACxB;IACD,IAAA,0BAAW,GAAE,CAAC;IACd,IAAA,4BAAa,GAAE,CAAC;IAChB,IAAA,2BAAY,GAAE,CAAC;IACf,IAAA,6BAAc,GAAE,CAAC;IACjB,IAAA,4BAAa,GAAE,CAAC;IAChB,IAAA,4BAAa,GAAE,CAAC;IAChB,IAAA,4BAAa,GAAE,CAAC;IAChB,IAAA,2BAAY,GAAE,CAAC;IACf,IAAA,2BAAY,GAAE,CAAC;IACf,IAAA,8BAAe,GAAE,CAAC;IAClB,IAAA,gCAAiB,GAAE,CAAC;IACpB,IAAA,2BAAY,GAAE,CAAC;IACf,IAAA,6BAAc,GAAE,CAAC;IACjB,IAAA,+BAAgB,GAAE,CAAC;IACnB,IAAA,iCAAkB,GAAE,CAAC;IACrB,IAAA,6BAAc,GAAE,CAAC;IACjB,IAAA,2BAAY,GAAE,CAAC;IACf,IAAA,+BAAgB,GAAE,CAAC;AACrB,CAAC;AA/BD,gDA+BC;AAED,yDAAuC;AACvC,yDAAuC","file":"vrender.js","sourcesContent":["import '@visactor/vrender-core';\nimport { container, isBrowserEnv, isNodeEnv, preLoadAllModule } from '@visactor/vrender-core';\nimport { loadBrowserEnv, loadNodeEnv } from '@visactor/vrender-kits';\nimport {\n registerArc,\n registerArc3d,\n registerArea,\n registerCircle,\n registerGlyph,\n registerGroup,\n registerImage,\n registerLine,\n registerPath,\n registerPolygon,\n registerPyramid3d,\n registerRect,\n registerRect3d,\n registerRichtext,\n registerShadowRoot,\n registerSymbol,\n registerText,\n registerWrapText\n} from '@visactor/vrender-kits';\n// 导出版本号\n// export const version = \"0.20.0\";\n\nlet registed = false;\nexport function registerForVrender() {\n if (registed) {\n return;\n }\n registed = true;\n // 注册内置组件\n preLoadAllModule();\n\n if (isBrowserEnv()) {\n loadBrowserEnv(container);\n } else if (isNodeEnv()) {\n loadNodeEnv(container);\n }\n registerArc();\n registerArc3d();\n registerArea();\n registerCircle();\n registerGlyph();\n registerGroup();\n registerImage();\n registerLine();\n registerPath();\n registerPolygon();\n registerPyramid3d();\n registerRect();\n registerRect3d();\n registerRichtext();\n registerShadowRoot();\n registerSymbol();\n registerText();\n registerWrapText();\n}\n\nexport * from '@visactor/vrender-core';\nexport * from '@visactor/vrender-kits';\n"]}
|