@visactor/vtable 1.11.3 → 1.11.5

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.
Files changed (63) hide show
  1. package/cjs/ListTable-all.js +6 -5
  2. package/cjs/ListTable-all.js.map +1 -1
  3. package/cjs/PivotTable.js +14 -3
  4. package/cjs/PivotTable.js.map +1 -1
  5. package/cjs/core/BaseTable.d.ts +2 -2
  6. package/cjs/core/BaseTable.js +13 -8
  7. package/cjs/core/BaseTable.js.map +1 -1
  8. package/cjs/core/style-helper.js +6 -6
  9. package/cjs/core/style-helper.js.map +1 -1
  10. package/cjs/index.d.ts +1 -4
  11. package/cjs/index.js +2 -3
  12. package/cjs/index.js.map +1 -1
  13. package/cjs/plugins/custom-cell-style.d.ts +6 -2
  14. package/cjs/plugins/custom-cell-style.js +8 -2
  15. package/cjs/plugins/custom-cell-style.js.map +1 -1
  16. package/cjs/plugins/invert-highlight.d.ts +0 -18
  17. package/cjs/plugins/invert-highlight.js +3 -52
  18. package/cjs/plugins/invert-highlight.js.map +1 -1
  19. package/cjs/plugins/list-tree-stick-cell.d.ts +3 -1
  20. package/cjs/plugins/list-tree-stick-cell.js +1 -1
  21. package/cjs/plugins/list-tree-stick-cell.js.map +1 -1
  22. package/cjs/ts-types/base-table.d.ts +4 -4
  23. package/cjs/ts-types/base-table.js.map +1 -1
  24. package/cjs/vrender.js.map +1 -1
  25. package/dist/vtable.js +188 -517
  26. package/dist/vtable.min.js +2 -2
  27. package/es/ListTable-all.js +5 -3
  28. package/es/ListTable-all.js.map +1 -1
  29. package/es/PivotTable.js +14 -3
  30. package/es/PivotTable.js.map +1 -1
  31. package/es/core/BaseTable.d.ts +2 -2
  32. package/es/core/BaseTable.js +12 -9
  33. package/es/core/BaseTable.js.map +1 -1
  34. package/es/core/style-helper.js +7 -7
  35. package/es/core/style-helper.js.map +1 -1
  36. package/es/index.d.ts +1 -4
  37. package/es/index.js +1 -7
  38. package/es/index.js.map +1 -1
  39. package/es/plugins/custom-cell-style.d.ts +6 -2
  40. package/es/plugins/custom-cell-style.js +6 -0
  41. package/es/plugins/custom-cell-style.js.map +1 -1
  42. package/es/plugins/invert-highlight.d.ts +0 -18
  43. package/es/plugins/invert-highlight.js +0 -55
  44. package/es/plugins/invert-highlight.js.map +1 -1
  45. package/es/plugins/list-tree-stick-cell.d.ts +3 -1
  46. package/es/plugins/list-tree-stick-cell.js +4 -4
  47. package/es/plugins/list-tree-stick-cell.js.map +1 -1
  48. package/es/ts-types/base-table.d.ts +4 -4
  49. package/es/ts-types/base-table.js.map +1 -1
  50. package/es/vrender.js.map +1 -1
  51. package/package.json +3 -3
  52. package/cjs/plugins/carousel-animation.d.ts +0 -48
  53. package/cjs/plugins/carousel-animation.js +0 -71
  54. package/cjs/plugins/carousel-animation.js.map +0 -1
  55. package/cjs/plugins/header-highlight.d.ts +0 -21
  56. package/cjs/plugins/header-highlight.js +0 -108
  57. package/cjs/plugins/header-highlight.js.map +0 -1
  58. package/es/plugins/carousel-animation.d.ts +0 -48
  59. package/es/plugins/carousel-animation.js +0 -63
  60. package/es/plugins/carousel-animation.js.map +0 -1
  61. package/es/plugins/header-highlight.d.ts +0 -21
  62. package/es/plugins/header-highlight.js +0 -100
  63. package/es/plugins/header-highlight.js.map +0 -1
@@ -29,11 +29,11 @@ Object.defineProperty(exports, "__esModule", {
29
29
  value: !0
30
30
  }), exports.getCellStyle = void 0;
31
31
 
32
- const custom_cell_style_1 = require("../plugins/custom-cell-style"), get_axis_config_1 = require("../layout/chart-helper/get-axis-config"), vutils_1 = require("@visactor/vutils"), headerStyleContents = __importStar(require("../header-helper/style")), columnStyleContents = __importStar(require("../body-helper/style")), EMPTY_STYLE = {};
32
+ const get_axis_config_1 = require("../layout/chart-helper/get-axis-config"), vutils_1 = require("@visactor/vutils"), headerStyleContents = __importStar(require("../header-helper/style")), columnStyleContents = __importStar(require("../body-helper/style")), custom_cell_style_1 = require("../plugins/custom-cell-style"), EMPTY_STYLE = {};
33
33
 
34
34
  function getCellStyle(col, row, table) {
35
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
36
- const customCellStyle = table.customCellStylePlugin.getCustomCellStyle(col, row), {layoutMap: layoutMap} = table.internalProps;
35
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
36
+ const customCellStyle = null === (_a = table.customCellStylePlugin) || void 0 === _a ? void 0 : _a.getCustomCellStyle(col, row), {layoutMap: layoutMap} = table.internalProps;
37
37
  if (layoutMap.isHeader(col, row)) {
38
38
  let cacheKey;
39
39
  if (!table.isPivotTable() || table.isBottomFrozenRow(row) || table.isRightFrozenColumn(col)) cacheKey = `${col}-${row}`; else {
@@ -45,9 +45,9 @@ function getCellStyle(col, row, table) {
45
45
  const hd = layoutMap.getHeader(col, row);
46
46
  let paddingForAxis;
47
47
  if (table.isPivotChart() && (0, get_axis_config_1.isTopOrBottomAxis)(col, row, layoutMap) && layoutMap.isAxisCell(col, row)) {
48
- paddingForAxis = null !== (_b = null === (_a = layoutMap.getBody(col, table.rowHeaderLevelCount).style) || void 0 === _a ? void 0 : _a.padding) && void 0 !== _b ? _b : table.theme.bodyStyle.padding;
48
+ paddingForAxis = null !== (_c = null === (_b = layoutMap.getBody(col, table.rowHeaderLevelCount).style) || void 0 === _b ? void 0 : _b.padding) && void 0 !== _c ? _c : table.theme.bodyStyle.padding;
49
49
  } else if (table.isPivotChart() && (0, get_axis_config_1.isLeftOrRightAxis)(col, row, layoutMap) && layoutMap.isAxisCell(col, row)) {
50
- paddingForAxis = null !== (_d = null === (_c = layoutMap.getBody(table.columnHeaderLevelCount, row).style) || void 0 === _c ? void 0 : _c.padding) && void 0 !== _d ? _d : table.theme.bodyStyle.padding;
50
+ paddingForAxis = null !== (_e = null === (_d = layoutMap.getBody(table.columnHeaderLevelCount, row).style) || void 0 === _d ? void 0 : _d.padding) && void 0 !== _e ? _e : table.theme.bodyStyle.padding;
51
51
  }
52
52
  if ((!hd || hd.isEmpty) && (layoutMap.isLeftBottomCorner(col, row) || layoutMap.isRightBottomCorner(col, row) || layoutMap.isCornerHeader(col, row) || layoutMap.isRightTopCorner(col, row))) return EMPTY_STYLE;
53
53
  const styleClass = table.internalProps.headerHelper.getStyleClass((null == hd ? void 0 : hd.headerType) || "text");
@@ -83,7 +83,7 @@ function getCellStyle(col, row, table) {
83
83
  return table.headerStyleCache.set(cacheKey, cacheStyle), customCellStyle ? (0, custom_cell_style_1.mergeStyle)(cacheStyle, customCellStyle) : cacheStyle;
84
84
  }
85
85
  let bgColorFunc, cacheKey;
86
- (null === (_f = null === (_e = table.internalProps) || void 0 === _e ? void 0 : _e.dataConfig) || void 0 === _f ? void 0 : _f.mappingRules) && !table.isHeader(col, row) && (null === (_j = null === (_h = null === (_g = table.internalProps) || void 0 === _g ? void 0 : _g.dataConfig) || void 0 === _h ? void 0 : _h.mappingRules) || void 0 === _j || _j.forEach(((mappingRule, i) => {
86
+ (null === (_g = null === (_f = table.internalProps) || void 0 === _f ? void 0 : _f.dataConfig) || void 0 === _g ? void 0 : _g.mappingRules) && !table.isHeader(col, row) && (null === (_k = null === (_j = null === (_h = table.internalProps) || void 0 === _h ? void 0 : _h.dataConfig) || void 0 === _j ? void 0 : _j.mappingRules) || void 0 === _k || _k.forEach(((mappingRule, i) => {
87
87
  mappingRule.bgColor && table.internalProps.layoutMap.getIndicatorKey(col, row) === mappingRule.bgColor.indicatorKey && (bgColorFunc = mappingRule.bgColor.mapping);
88
88
  })));
89
89
  const cellType = table.getCellType(col, row), rawRecord = table.getCellOriginRecord(col, row);
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/core/style-helper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oEAA0D;AAE1D,4EAA8F;AAC9F,6CAA8C;AAC9C,4EAA8D;AAC9D,0EAA4D;AAI5D,MAAM,WAAW,GAAG,EAAE,CAAC;AAQvB,SAAgB,YAAY,CAAC,GAAW,EAAE,GAAW,EAAE,KAAmB;;IACxE,MAAM,eA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aderLayoutMap } from '../layout/pivot-header-layout';\nimport { isLeftOrRightAxis, isTopOrBottomAxis } from '../layout/chart-helper/get-axis-config';\nimport { isFunction } from '@visactor/vutils';\nimport * as headerStyleContents from '../header-helper/style';\nimport * as columnStyleContents from '../body-helper/style';\nimport type { BaseTableAPI, HeaderData, PivotTableProtected } from '../ts-types/base-table';\nimport type { ColorPropertyDefine, FullExtendStyle, MappingRule } from '../ts-types';\n\nconst EMPTY_STYLE = {};\n\n/**\n * 获取单元格的样式 内部逻辑使用 获取到的样式并不是计算后的\n * @param col\n * @param row\n * @returns\n */\nexport function getCellStyle(col: number, row: number, table: BaseTableAPI): FullExtendStyle {\n const customCellStyle = table.customCellStylePlugin.getCustomCellStyle(col, row);\n const { layoutMap } = table.internalProps;\n const isHeader = layoutMap.isHeader(col, row);\n if (isHeader) {\n // const cacheKey = `${col}-${row}`;\n let cacheKey;\n if (table.isPivotTable() && !table.isBottomFrozenRow(row) && !table.isRightFrozenColumn(col)) {\n // use dimensionKey&indicatorKey to cache style object in pivot table\n const define = table.getHeaderDefine(col, row) as any;\n const isCorner = table.isCornerHeader(col, row);\n cacheKey = define?.dimensionKey\n ? isCorner\n ? `dim-cor-${define.dimensionKey}`\n : `dim-${define.dimensionKey}`\n : define?.indicatorKey\n ? `ind-${define.indicatorKey}`\n : `${col}-${row}`;\n } else {\n cacheKey = `${col}-${row}`;\n }\n let cacheStyle = table.headerStyleCache.get(cacheKey);\n if (cacheStyle) {\n if (customCellStyle) {\n return mergeStyle(cacheStyle, customCellStyle);\n }\n return cacheStyle;\n }\n const hd = layoutMap.getHeader(col, row);\n\n let paddingForAxis;\n if (\n table.isPivotChart() &&\n isTopOrBottomAxis(col, row, layoutMap as PivotHeaderLayoutMap) &&\n layoutMap.isAxisCell(col, row)\n ) {\n // get chart padding for axis cell\n const chartColumn = layoutMap.getBody(col, table.rowHeaderLevelCount);\n const padding = (chartColumn.style as any)?.padding ?? table.theme.bodyStyle.padding;\n paddingForAxis = padding;\n } else if (\n table.isPivotChart() &&\n isLeftOrRightAxis(col, row, layoutMap as PivotHeaderLayoutMap) &&\n layoutMap.isAxisCell(col, row)\n ) {\n // get chart padding for axis cell\n const chartColumn = layoutMap.getBody(table.columnHeaderLevelCount, row);\n const padding = (chartColumn.style as any)?.padding ?? table.theme.bodyStyle.padding;\n paddingForAxis = padding;\n }\n\n if (\n (!hd || (hd as HeaderData).isEmpty) &&\n (layoutMap.isLeftBottomCorner(col, row) ||\n layoutMap.isRightBottomCorner(col, row) ||\n layoutMap.isCornerHeader(col, row) ||\n layoutMap.isRightTopCorner(col, row))\n ) {\n return EMPTY_STYLE;\n }\n\n const styleClass = table.internalProps.headerHelper.getStyleClass((hd as HeaderData)?.headerType || 'text');\n if (layoutMap.isBottomFrozenRow(col, row) && table.theme.bottomFrozenStyle) {\n cacheStyle = <FullExtendStyle>headerStyleContents.of(\n paddingForAxis ? { padding: paddingForAxis } : {},\n table.theme.bottomFrozenStyle,\n {\n col,\n row,\n table: table as BaseTableAPI,\n value: table.getCellValue(col, row),\n dataValue: table.getCellOriginValue(col, row),\n cellHeaderPaths: table.getCellHeaderPaths(col, row)\n },\n styleClass,\n table.options.autoWrapText,\n table.theme\n );\n } else if (layoutMap.isRightFrozenColumn(col, row) && table.theme.rightFrozenStyle) {\n cacheStyle = <FullExtendStyle>headerStyleContents.of(\n paddingForAxis ? { padding: paddingForAxis } : {},\n table.theme.rightFrozenStyle,\n {\n col,\n row,\n table: table as BaseTableAPI,\n value: table.getCellValue(col, row),\n dataValue: table.getCellOriginValue(col, row),\n cellHeaderPaths: table.getCellHeaderPaths(col, row)\n },\n styleClass,\n table.options.autoWrapText,\n table.theme\n );\n } else {\n // let defaultStyle;\n // if (layoutMap.isColumnHeader(col, row) || layoutMap.isBottomFrozenRow(col, row)) {\n // defaultStyle = table.theme.headerStyle;\n // } else if (table.internalProps.transpose && layoutMap.isRowHeader(col, row)) {\n // defaultStyle = table.theme.headerStyle;\n // } else if (layoutMap.isRowHeader(col, row) || layoutMap.isRightFrozenColumn(col, row)) {\n // defaultStyle = table.theme.rowHeaderStyle;\n // } else {\n // defaultStyle = table.theme.cornerHeaderStyle;\n // }\n // const styleClass = hd.headerType.StyleClass; //BaseHeader文件\n // const { style } = hd;\n const style = hd?.style || {};\n if (paddingForAxis) {\n (style as any).padding = paddingForAxis;\n }\n cacheStyle = <FullExtendStyle>headerStyleContents.of(\n style,\n // defaultStyle,\n layoutMap.isColumnHeader(col, row) || layoutMap.isBottomFrozenRow(col, row)\n ? table.theme.headerStyle\n : layoutMap.isRowHeader(col, row) || layoutMap.isRightFrozenColumn(col, row)\n ? table.theme.rowHeaderStyle\n : table.theme.cornerHeaderStyle,\n {\n col,\n row,\n table: table as BaseTableAPI,\n value: table.getCellValue(col, row),\n dataValue: table.getCellOriginValue(col, row),\n cellHeaderPaths: table.getCellHeaderPaths(col, row)\n },\n styleClass,\n table.options.autoWrapText,\n table.theme\n );\n }\n table.headerStyleCache.set(cacheKey, cacheStyle);\n if (customCellStyle) {\n return mergeStyle(cacheStyle, customCellStyle);\n }\n return cacheStyle;\n }\n\n let bgColorFunc: ColorPropertyDefine;\n // 判断是否有mapping 遍历dataset中mappingRules\n if ((table.internalProps as PivotTableProtected)?.dataConfig?.mappingRules && !table.isHeader(col, row)) {\n (table.internalProps as PivotTableProtected)?.dataConfig?.mappingRules?.forEach(\n (mappingRule: MappingRule, i: number) => {\n if (\n mappingRule.bgColor &&\n (table.internalProps.layoutMap as PivotHeaderLayoutMap).getIndicatorKey(col, row) ===\n mappingRule.bgColor.indicatorKey\n ) {\n bgColorFunc = mappingRule.bgColor.mapping;\n }\n }\n );\n // // 判断是否有mapping 遍历dataset中mappingRules 但这里还需要根据fieldName来判断\n // if (bgColorFunc && typeof bgColorFunc === 'function') {\n // const cellValue = table.getCellOriginValue(col, row);\n // bgColor = bgColorFunc(this, cellValue);\n // }\n }\n\n let cacheKey;\n const cellType = table.getCellType(col, row);\n const rawRecord = table.getCellOriginRecord(col, row);\n\n //如果是主体部分,获取相应的style\n if (rawRecord?.vtableMerge) {\n cacheKey = 'merge-title';\n } else if (table.isSeriesNumberInBody(col, row)) {\n // 如果是行序号\n cacheKey = `${col}-series-` + cellType;\n } else if (\n (table.isListTable() && !(table as any).transpose) ||\n (table.isPivotTable() && (table.internalProps.layoutMap as PivotHeaderLayoutMap).indicatorsAsCol)\n ) {\n cacheKey = col + cellType;\n } else {\n cacheKey = row + cellType;\n }\n let cacheStyle;\n\n if (rawRecord?.vtableMerge) {\n cacheStyle = table.bodyMergeTitleCache.get(cacheKey);\n } else if (layoutMap.isBottomFrozenRow(row)) {\n cacheStyle = table.bodyBottomStyleCache.get(cacheKey);\n } else {\n cacheStyle = table.bodyStyleCache.get(cacheKey);\n }\n if (cacheStyle) {\n if (customCellStyle) {\n return mergeStyle(cacheStyle, customCellStyle);\n }\n return cacheStyle;\n }\n const column = layoutMap.getBody(col, row);\n // const styleClass = column?.cellType?.StyleClass; //BaseColumn文件\n const styleClass = table.internalProps.bodyHelper.getStyleClass(table.getCellType(col, row));\n const style = column?.style;\n cacheStyle = <FullExtendStyle>columnStyleContents.of(\n style,\n rawRecord?.vtableMerge && table.theme.groupTitleStyle\n ? table.theme.groupTitleStyle\n : layoutMap.isBottomFrozenRow(row) && table.theme.bottomFrozenStyle\n ? table.theme.bottomFrozenStyle\n : layoutMap.isRightFrozenColumn(col) && table.theme.rightFrozenStyle\n ? table.theme.rightFrozenStyle\n : table.theme.bodyStyle,\n {\n col,\n row,\n table: table,\n value: table.getCellValue(col, row),\n dataValue: table.getCellOriginValue(col, row),\n cellHeaderPaths: table.getCellHeaderPaths(col, row)\n },\n styleClass,\n table.options.autoWrapText,\n table.theme\n );\n if (bgColorFunc) {\n cacheStyle = mergeStyle(cacheStyle as any, { bgColor: bgColorFunc });\n }\n if (!isFunction(style)) {\n if (layoutMap.isBottomFrozenRow(row)) {\n table.bodyBottomStyleCache.set(cacheKey, cacheStyle);\n } else {\n table.bodyStyleCache.set(cacheKey, cacheStyle);\n }\n }\n if (customCellStyle) {\n return mergeStyle(cacheStyle as any, customCellStyle);\n }\n return cacheStyle;\n}\n"]}
1
+ {"version":3,"sources":["../src/core/style-helper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,4EAA8F;AAC9F,6CAA8C;AAC9C,4EAA8D;AAC9D,0EAA4D;AAG5D,oEAA0D;AAE1D,MAAM,WAAW,GAAG,EAAE,CAAC;AAQvB,SAAgB,YAAY,CAAC,GAAW,EAAE,GAAW,EAAE,KAAmB;;IACxE,MAAM,eAAe,GAAG,MAAA,KAAK,CAAC,qBAAqB,0CAAE,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAClF,MAAM,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC,aAAa,CAAC;IAC1C,MAAM,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAC9C,IAAI,QAAQ,EAAE;QAEZ,IAAI,QAAQ,CAAC;QACb,IAAI,KAAK,CAAC,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,GAAG,CAAC,EAAE;YAE5F,MAAM,MAAM,GAAG,KAAK,CAAC,eAAe,CAAC,GAAG,EAAE,GAAG,CAAQ,CAAC;YACtD,MAAM,QAAQ,GAAG,KAAK,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;YAChD,QAAQ,GAAG,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,YAAY;gBAC7B,CAAC,CAAC,QAAQ;oBACR,CAAC,CAAC,WAAW,MAAM,CAAC,YAAY,EAAE;oBAClC,CAAC,CAAC,OAAO,MAAM,CAAC,YAAY,EAAE;gBAChC,CAAC,CAAC,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,YAAY;oBACtB,CAAC,CAAC,OAAO,MAAM,CAAC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AAoB,CAAC,GAAG,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;SACtD;aAAM;YACL,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;SAChD;KACF;IACD,IAAI,eAAe,EAAE;QACnB,OAAO,IAAA,8BAAU,EAAC,UAAiB,EAAE,eAAe,CAAC,CAAC;KACvD;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAxOD,oCAwOC","file":"style-helper.js","sourcesContent":["import type { PivotHeaderLayoutMap } from '../layout/pivot-header-layout';\nimport { isLeftOrRightAxis, isTopOrBottomAxis } from '../layout/chart-helper/get-axis-config';\nimport { isFunction } from '@visactor/vutils';\nimport * as headerStyleContents from '../header-helper/style';\nimport * as columnStyleContents from '../body-helper/style';\nimport type { BaseTableAPI, HeaderData, PivotTableProtected } from '../ts-types/base-table';\nimport type { ColorPropertyDefine, FullExtendStyle, MappingRule } from '../ts-types';\nimport { mergeStyle } from '../plugins/custom-cell-style';\n\nconst EMPTY_STYLE = {};\n\n/**\n * 获取单元格的样式 内部逻辑使用 获取到的样式并不是计算后的\n * @param col\n * @param row\n * @returns\n */\nexport function getCellStyle(col: number, row: number, table: BaseTableAPI): FullExtendStyle {\n const customCellStyle = table.customCellStylePlugin?.getCustomCellStyle(col, row);\n const { layoutMap } = table.internalProps;\n const isHeader = layoutMap.isHeader(col, row);\n if (isHeader) {\n // const cacheKey = `${col}-${row}`;\n let cacheKey;\n if (table.isPivotTable() && !table.isBottomFrozenRow(row) && !table.isRightFrozenColumn(col)) {\n // use dimensionKey&indicatorKey to cache style object in pivot table\n const define = table.getHeaderDefine(col, row) as any;\n const isCorner = table.isCornerHeader(col, row);\n cacheKey = define?.dimensionKey\n ? isCorner\n ? `dim-cor-${define.dimensionKey}`\n : `dim-${define.dimensionKey}`\n : define?.indicatorKey\n ? `ind-${define.indicatorKey}`\n : `${col}-${row}`;\n } else {\n cacheKey = `${col}-${row}`;\n }\n let cacheStyle = table.headerStyleCache.get(cacheKey);\n if (cacheStyle) {\n if (customCellStyle) {\n return mergeStyle(cacheStyle, customCellStyle);\n }\n return cacheStyle;\n }\n const hd = layoutMap.getHeader(col, row);\n\n let paddingForAxis;\n if (\n table.isPivotChart() &&\n isTopOrBottomAxis(col, row, layoutMap as PivotHeaderLayoutMap) &&\n layoutMap.isAxisCell(col, row)\n ) {\n // get chart padding for axis cell\n const chartColumn = layoutMap.getBody(col, table.rowHeaderLevelCount);\n const padding = (chartColumn.style as any)?.padding ?? table.theme.bodyStyle.padding;\n paddingForAxis = padding;\n } else if (\n table.isPivotChart() &&\n isLeftOrRightAxis(col, row, layoutMap as PivotHeaderLayoutMap) &&\n layoutMap.isAxisCell(col, row)\n ) {\n // get chart padding for axis cell\n const chartColumn = layoutMap.getBody(table.columnHeaderLevelCount, row);\n const padding = (chartColumn.style as any)?.padding ?? table.theme.bodyStyle.padding;\n paddingForAxis = padding;\n }\n\n if (\n (!hd || (hd as HeaderData).isEmpty) &&\n (layoutMap.isLeftBottomCorner(col, row) ||\n layoutMap.isRightBottomCorner(col, row) ||\n layoutMap.isCornerHeader(col, row) ||\n layoutMap.isRightTopCorner(col, row))\n ) {\n return EMPTY_STYLE;\n }\n\n const styleClass = table.internalProps.headerHelper.getStyleClass((hd as HeaderData)?.headerType || 'text');\n if (layoutMap.isBottomFrozenRow(col, row) && table.theme.bottomFrozenStyle) {\n cacheStyle = <FullExtendStyle>headerStyleContents.of(\n paddingForAxis ? { padding: paddingForAxis } : {},\n table.theme.bottomFrozenStyle,\n {\n col,\n row,\n table: table as BaseTableAPI,\n value: table.getCellValue(col, row),\n dataValue: table.getCellOriginValue(col, row),\n cellHeaderPaths: table.getCellHeaderPaths(col, row)\n },\n styleClass,\n table.options.autoWrapText,\n table.theme\n );\n } else if (layoutMap.isRightFrozenColumn(col, row) && table.theme.rightFrozenStyle) {\n cacheStyle = <FullExtendStyle>headerStyleContents.of(\n paddingForAxis ? { padding: paddingForAxis } : {},\n table.theme.rightFrozenStyle,\n {\n col,\n row,\n table: table as BaseTableAPI,\n value: table.getCellValue(col, row),\n dataValue: table.getCellOriginValue(col, row),\n cellHeaderPaths: table.getCellHeaderPaths(col, row)\n },\n styleClass,\n table.options.autoWrapText,\n table.theme\n );\n } else {\n // let defaultStyle;\n // if (layoutMap.isColumnHeader(col, row) || layoutMap.isBottomFrozenRow(col, row)) {\n // defaultStyle = table.theme.headerStyle;\n // } else if (table.internalProps.transpose && layoutMap.isRowHeader(col, row)) {\n // defaultStyle = table.theme.headerStyle;\n // } else if (layoutMap.isRowHeader(col, row) || layoutMap.isRightFrozenColumn(col, row)) {\n // defaultStyle = table.theme.rowHeaderStyle;\n // } else {\n // defaultStyle = table.theme.cornerHeaderStyle;\n // }\n // const styleClass = hd.headerType.StyleClass; //BaseHeader文件\n // const { style } = hd;\n const style = hd?.style || {};\n if (paddingForAxis) {\n (style as any).padding = paddingForAxis;\n }\n cacheStyle = <FullExtendStyle>headerStyleContents.of(\n style,\n // defaultStyle,\n layoutMap.isColumnHeader(col, row) || layoutMap.isBottomFrozenRow(col, row)\n ? table.theme.headerStyle\n : layoutMap.isRowHeader(col, row) || layoutMap.isRightFrozenColumn(col, row)\n ? table.theme.rowHeaderStyle\n : table.theme.cornerHeaderStyle,\n {\n col,\n row,\n table: table as BaseTableAPI,\n value: table.getCellValue(col, row),\n dataValue: table.getCellOriginValue(col, row),\n cellHeaderPaths: table.getCellHeaderPaths(col, row)\n },\n styleClass,\n table.options.autoWrapText,\n table.theme\n );\n }\n table.headerStyleCache.set(cacheKey, cacheStyle);\n if (customCellStyle) {\n return mergeStyle(cacheStyle, customCellStyle);\n }\n return cacheStyle;\n }\n\n let bgColorFunc: ColorPropertyDefine;\n // 判断是否有mapping 遍历dataset中mappingRules\n if ((table.internalProps as PivotTableProtected)?.dataConfig?.mappingRules && !table.isHeader(col, row)) {\n (table.internalProps as PivotTableProtected)?.dataConfig?.mappingRules?.forEach(\n (mappingRule: MappingRule, i: number) => {\n if (\n mappingRule.bgColor &&\n (table.internalProps.layoutMap as PivotHeaderLayoutMap).getIndicatorKey(col, row) ===\n mappingRule.bgColor.indicatorKey\n ) {\n bgColorFunc = mappingRule.bgColor.mapping;\n }\n }\n );\n // // 判断是否有mapping 遍历dataset中mappingRules 但这里还需要根据fieldName来判断\n // if (bgColorFunc && typeof bgColorFunc === 'function') {\n // const cellValue = table.getCellOriginValue(col, row);\n // bgColor = bgColorFunc(this, cellValue);\n // }\n }\n\n let cacheKey;\n const cellType = table.getCellType(col, row);\n const rawRecord = table.getCellOriginRecord(col, row);\n\n //如果是主体部分,获取相应的style\n if (rawRecord?.vtableMerge) {\n cacheKey = 'merge-title';\n } else if (table.isSeriesNumberInBody(col, row)) {\n // 如果是行序号\n cacheKey = `${col}-series-` + cellType;\n } else if (\n (table.isListTable() && !(table as any).transpose) ||\n (table.isPivotTable() && (table.internalProps.layoutMap as PivotHeaderLayoutMap).indicatorsAsCol)\n ) {\n cacheKey = col + cellType;\n } else {\n cacheKey = row + cellType;\n }\n let cacheStyle;\n\n if (rawRecord?.vtableMerge) {\n cacheStyle = table.bodyMergeTitleCache.get(cacheKey);\n } else if (layoutMap.isBottomFrozenRow(row)) {\n cacheStyle = table.bodyBottomStyleCache.get(cacheKey);\n } else {\n cacheStyle = table.bodyStyleCache.get(cacheKey);\n }\n if (cacheStyle) {\n if (customCellStyle) {\n return mergeStyle(cacheStyle, customCellStyle);\n }\n return cacheStyle;\n }\n const column = layoutMap.getBody(col, row);\n // const styleClass = column?.cellType?.StyleClass; //BaseColumn文件\n const styleClass = table.internalProps.bodyHelper.getStyleClass(table.getCellType(col, row));\n const style = column?.style;\n cacheStyle = <FullExtendStyle>columnStyleContents.of(\n style,\n rawRecord?.vtableMerge && table.theme.groupTitleStyle\n ? table.theme.groupTitleStyle\n : layoutMap.isBottomFrozenRow(row) && table.theme.bottomFrozenStyle\n ? table.theme.bottomFrozenStyle\n : layoutMap.isRightFrozenColumn(col) && table.theme.rightFrozenStyle\n ? table.theme.rightFrozenStyle\n : table.theme.bodyStyle,\n {\n col,\n row,\n table: table,\n value: table.getCellValue(col, row),\n dataValue: table.getCellOriginValue(col, row),\n cellHeaderPaths: table.getCellHeaderPaths(col, row)\n },\n styleClass,\n table.options.autoWrapText,\n table.theme\n );\n if (bgColorFunc) {\n cacheStyle = mergeStyle(cacheStyle as any, { bgColor: bgColorFunc });\n }\n if (!isFunction(style)) {\n if (layoutMap.isBottomFrozenRow(row)) {\n table.bodyBottomStyleCache.set(cacheKey, cacheStyle);\n } else {\n table.bodyStyleCache.set(cacheKey, cacheStyle);\n }\n }\n if (customCellStyle) {\n return mergeStyle(cacheStyle as any, customCellStyle);\n }\n return cacheStyle;\n}\n"]}
package/cjs/index.d.ts CHANGED
@@ -19,7 +19,7 @@ import { restoreMeasureText, setCustomAlphabetCharSet } from './scenegraph/utils
19
19
  export { getDataCellPath } from './tools/get-data-path';
20
20
  export * from './render/jsx';
21
21
  export { getTargetCell } from './event/util';
22
- export declare const version = "1.11.3";
22
+ export declare const version = "1.11.5";
23
23
  export { TYPES, core, ListTable, ListTableSimple, ListTableConstructorOptions, PivotTable, PivotTableSimple, PivotTableConstructorOptions, PivotChartConstructorOptions, PivotChart, GanttConstructorOptions, IHeaderTreeDefine, IDimension, IIndicator, ITitleDefine, ICornerDefine, ColumnsDefine, ColumnDefine, LinkColumnDefine, ChartColumnDefine, ImageColumnDefine, SparklineColumnDefine, ProgressbarColumnDefine, TextColumnDefine, GroupColumnDefine, TextAlignType, TextBaselineType, themes, data, MousePointerCellEvent, getIcons, clearGlobal, register, DataStatistics, CustomLayout, updateCell, renderChart, graphicUtil, setCustomAlphabetCharSet, restoreMeasureText };
24
24
  declare function getIcons(): {
25
25
  [key: string]: TYPES.ColumnIconOption;
@@ -30,6 +30,3 @@ export * from './scenegraph/group-creater/cell-type';
30
30
  export { TABLE_EVENT_TYPE } from './core/TABLE_EVENT_TYPE';
31
31
  export { PIVOT_CHART_EVENT_TYPE, PIVOT_TABLE_EVENT_TYPE } from './ts-types/pivot-table/PIVOT_TABLE_EVENT_TYPE';
32
32
  export { EventTarget } from './event/EventTarget';
33
- export * from './plugins/invert-highlight';
34
- export * from './plugins/carousel-animation';
35
- export * from './plugins/header-highlight';
package/cjs/index.js CHANGED
@@ -169,7 +169,7 @@ Object.defineProperty(exports, "getTargetCell", {
169
169
  get: function() {
170
170
  return util_1.getTargetCell;
171
171
  }
172
- }), exports.version = "1.11.3", exports.getIcons = getIcons, exports.clearGlobal = clearGlobal,
172
+ }), exports.version = "1.11.5", exports.getIcons = getIcons, exports.clearGlobal = clearGlobal,
173
173
  TYPES.AggregationType, __exportStar(require("./components"), exports), __exportStar(require("./scenegraph/group-creater/cell-type"), exports);
174
174
 
175
175
  var TABLE_EVENT_TYPE_1 = require("./core/TABLE_EVENT_TYPE");
@@ -202,6 +202,5 @@ Object.defineProperty(exports, "EventTarget", {
202
202
  get: function() {
203
203
  return EventTarget_1.EventTarget;
204
204
  }
205
- }), __exportStar(require("./plugins/invert-highlight"), exports), __exportStar(require("./plugins/carousel-animation"), exports),
206
- __exportStar(require("./plugins/header-highlight"), exports);
205
+ });
207
206
  //# sourceMappingURL=index.js.map
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,uCAA4D;AAyG1D,4FAzGO,qBAAW,OAyGP;AAxGb,IAAA,4BAAkB,GAAE,CAAC;AAErB,kDAAoC;AA6DlC,sBAAK;AA5DP,6CAA+B;AA6D7B,oBAAI;AA5DN,6CAA+B;AAuF7B,oBAAI;AAtFN,+CAAiC;AACjC,qDAAuC;AA0FrC,4BAAQ;AAzFV,iDAAmC;AAmFjC,wBAAM;AAlFR,yEAA2D;AA4FzD,wCAAc;AArEhB,mDAA4D;AAkC1D,0FAlCuB,4BAAS,OAkCvB;AAjCX,yDAAqD;AAkCnD,gGAlCO,kCAAe,OAkCP;AAhCjB,qDAA+D;AAkC7D,2FAlCwB,8BAAU,OAkCxB;AAjCZ,2DAAuD;AAkCrD,iGAlCO,oCAAgB,OAkCP;AAjClB,6CAA0C;AAoCxC,2FApCO,uBAAU,OAoCP;AAlCZ,8DAAgD;AA+D9C,oCAAY;AA7Dd,wEAAoE;AA8DlE,2FA9DO,wBAAU,OA8DP;AA7DZ,gGAAqF;AA8DnF,4FA9DO,iCAAW,OA8DP;AA7Db,kEAA+F;AAgE7F,mGAhEO,iCAAkB,OAgEP;AADlB,yGA/D2B,uCAAwB,OA+D3B;AA1D1B,uDAAwD;AAA/C,gHAAA,eAAe,OAAA;AACxB,+CAA6B;AAC7B,qCAA6C;AAApC,qGAAA,aAAa,OAAA;AAKT,QAAA,OAAO,GAAG,QAAQ,CAAC;AAyDhC,SAAS,QAAQ;IAGf,OAAO,KAAK,CAAC,GAAG,EAAE,CAAC;AACrB,CAAC;AAtBC,4BAAQ;AAwBV,SAAS,WAAW;IAClB,QAAQ,CAAC,QAAQ,EAAE,CAAC;AAGtB,CAAC;AA3BC,kCAAW;AA4Bb,KAAK,CAAC,eAAe,CAAC;AAEtB,+CAA6B;AAC7B,uEAAqD;AAErD,4DAA2D;AAAlD,oHAAA,gBAAgB,OAAA;AACzB,wFAA+G;AAAtG,gIAAA,sBAAsB,OAAA;AAAE,gIAAA,sBAAsB,OAAA;AAEvD,mDAAkD;AAAzC,0GAAA,WAAW,OAAA;AACpB,6DAA2C;AAC3C,+DAA6C;AAC7C,6DAA2C","file":"index.js","sourcesContent":["/* eslint-disable sort-imports */\nimport { graphicUtil, registerForVrender } from './vrender';\nregisterForVrender();\n\nimport * as TYPES from './ts-types';\nimport * as core from './core';\nimport * as data from './data';\nimport * as icons from './icons';\nimport * as register from './register';\nimport * as themes from './themes';\nimport * as DataStatistics from './dataset/DataStatistics';\nimport type {\n ColumnDefine,\n ColumnsDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n ListTableConstructorOptions,\n PivotTableConstructorOptions,\n PivotChartConstructorOptions,\n GanttConstructorOptions,\n IHeaderTreeDefine,\n IDimension,\n IIndicator,\n ITitleDefine,\n ICornerDefine,\n TextAlignType,\n TextBaselineType\n} from './ts-types';\nimport { ListTableAll as ListTable } from './ListTable-all';\nimport { ListTableSimple } from './ListTable-simple';\n// import { PivotTable } from './PivotTable';\nimport { PivotTableAll as PivotTable } from './PivotTable-all';\nimport { PivotTableSimple } from './PivotTable-simple';\nimport { PivotChart } from './PivotChart';\nimport type { MousePointerCellEvent } from './ts-types/events';\nimport * as CustomLayout from './render/layout';\n\nimport { updateCell } from './scenegraph/group-creater/cell-helper';\nimport { renderChart } from './scenegraph/graphic/contributions/chart-render-helper';\nimport { restoreMeasureText, setCustomAlphabetCharSet } from './scenegraph/utils/text-measure';\n\n// import { container, loadCanvasPicker } from '@src/vrender';\n// loadCanvasPicker(container);\n\nexport { getDataCellPath } from './tools/get-data-path';\nexport * from './render/jsx';\nexport { getTargetCell } from './event/util';\n\n// export * as VRender from './vrender';\n// import * as VRender from './vrender';\n\nexport const version = \"1.11.3\";\n/**\n * @namespace VTable\n */\nexport {\n /**\n * Types\n * @namespace VTable.TYPES\n */\n TYPES,\n core,\n ListTable,\n ListTableSimple,\n ListTableConstructorOptions,\n PivotTable,\n PivotTableSimple,\n PivotTableConstructorOptions,\n PivotChartConstructorOptions,\n PivotChart,\n GanttConstructorOptions,\n IHeaderTreeDefine,\n IDimension,\n IIndicator,\n ITitleDefine,\n ICornerDefine,\n ColumnsDefine,\n ColumnDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n TextAlignType,\n TextBaselineType,\n themes,\n data,\n MousePointerCellEvent,\n getIcons,\n clearGlobal,\n //plugin registers\n register,\n /**\n * 暂不推荐使用\n */\n DataStatistics,\n CustomLayout,\n updateCell,\n renderChart,\n graphicUtil,\n setCustomAlphabetCharSet,\n restoreMeasureText\n // VRender // should use import {xxx} from '@visactor/vtable/es/vrender'\n};\n\n/** @private */\nfunction getIcons(): {\n [key: string]: TYPES.ColumnIconOption;\n} {\n return icons.get();\n}\n/** 清理内部的全局变量 如注册的icon theme等 以及共享的header column类实例 */\nfunction clearGlobal() {\n register.clearAll();\n // headers.type.clearGlobal();\n // columns.type.clearGlobal();\n}\nTYPES.AggregationType;\n\nexport * from './components';\nexport * from './scenegraph/group-creater/cell-type';\n\nexport { TABLE_EVENT_TYPE } from './core/TABLE_EVENT_TYPE';\nexport { PIVOT_CHART_EVENT_TYPE, PIVOT_TABLE_EVENT_TYPE } from './ts-types/pivot-table/PIVOT_TABLE_EVENT_TYPE';\n\nexport { EventTarget } from './event/EventTarget';\nexport * from './plugins/invert-highlight';\nexport * from './plugins/carousel-animation';\nexport * from './plugins/header-highlight';\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,uCAA4D;AAyG1D,4FAzGO,qBAAW,OAyGP;AAxGb,IAAA,4BAAkB,GAAE,CAAC;AAErB,kDAAoC;AA6DlC,sBAAK;AA5DP,6CAA+B;AA6D7B,oBAAI;AA5DN,6CAA+B;AAuF7B,oBAAI;AAtFN,+CAAiC;AACjC,qDAAuC;AA0FrC,4BAAQ;AAzFV,iDAAmC;AAmFjC,wBAAM;AAlFR,yEAA2D;AA4FzD,wCAAc;AArEhB,mDAA4D;AAkC1D,0FAlCuB,4BAAS,OAkCvB;AAjCX,yDAAqD;AAkCnD,gGAlCO,kCAAe,OAkCP;AAhCjB,qDAA+D;AAkC7D,2FAlCwB,8BAAU,OAkCxB;AAjCZ,2DAAuD;AAkCrD,iGAlCO,oCAAgB,OAkCP;AAjClB,6CAA0C;AAoCxC,2FApCO,uBAAU,OAoCP;AAlCZ,8DAAgD;AA+D9C,oCAAY;AA7Dd,wEAAoE;AA8DlE,2FA9DO,wBAAU,OA8DP;AA7DZ,gGAAqF;AA8DnF,4FA9DO,iCAAW,OA8DP;AA7Db,kEAA+F;AAgE7F,mGAhEO,iCAAkB,OAgEP;AADlB,yGA/D2B,uCAAwB,OA+D3B;AA1D1B,uDAAwD;AAA/C,gHAAA,eAAe,OAAA;AACxB,+CAA6B;AAC7B,qCAA6C;AAApC,qGAAA,aAAa,OAAA;AAKT,QAAA,OAAO,GAAG,QAAQ,CAAC;AAyDhC,SAAS,QAAQ;IAGf,OAAO,KAAK,CAAC,GAAG,EAAE,CAAC;AACrB,CAAC;AAtBC,4BAAQ;AAwBV,SAAS,WAAW;IAClB,QAAQ,CAAC,QAAQ,EAAE,CAAC;AAGtB,CAAC;AA3BC,kCAAW;AA4Bb,KAAK,CAAC,eAAe,CAAC;AAEtB,+CAA6B;AAC7B,uEAAqD;AAErD,4DAA2D;AAAlD,oHAAA,gBAAgB,OAAA;AACzB,wFAA+G;AAAtG,gIAAA,sBAAsB,OAAA;AAAE,gIAAA,sBAAsB,OAAA;AAEvD,mDAAkD;AAAzC,0GAAA,WAAW,OAAA","file":"index.js","sourcesContent":["/* eslint-disable sort-imports */\nimport { graphicUtil, registerForVrender } from './vrender';\nregisterForVrender();\n\nimport * as TYPES from './ts-types';\nimport * as core from './core';\nimport * as data from './data';\nimport * as icons from './icons';\nimport * as register from './register';\nimport * as themes from './themes';\nimport * as DataStatistics from './dataset/DataStatistics';\nimport type {\n ColumnDefine,\n ColumnsDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n ListTableConstructorOptions,\n PivotTableConstructorOptions,\n PivotChartConstructorOptions,\n GanttConstructorOptions,\n IHeaderTreeDefine,\n IDimension,\n IIndicator,\n ITitleDefine,\n ICornerDefine,\n TextAlignType,\n TextBaselineType\n} from './ts-types';\nimport { ListTableAll as ListTable } from './ListTable-all';\nimport { ListTableSimple } from './ListTable-simple';\n// import { PivotTable } from './PivotTable';\nimport { PivotTableAll as PivotTable } from './PivotTable-all';\nimport { PivotTableSimple } from './PivotTable-simple';\nimport { PivotChart } from './PivotChart';\nimport type { MousePointerCellEvent } from './ts-types/events';\nimport * as CustomLayout from './render/layout';\n\nimport { updateCell } from './scenegraph/group-creater/cell-helper';\nimport { renderChart } from './scenegraph/graphic/contributions/chart-render-helper';\nimport { restoreMeasureText, setCustomAlphabetCharSet } from './scenegraph/utils/text-measure';\n\n// import { container, loadCanvasPicker } from '@src/vrender';\n// loadCanvasPicker(container);\n\nexport { getDataCellPath } from './tools/get-data-path';\nexport * from './render/jsx';\nexport { getTargetCell } from './event/util';\n\n// export * as VRender from './vrender';\n// import * as VRender from './vrender';\n\nexport const version = \"1.11.5\";\n/**\n * @namespace VTable\n */\nexport {\n /**\n * Types\n * @namespace VTable.TYPES\n */\n TYPES,\n core,\n ListTable,\n ListTableSimple,\n ListTableConstructorOptions,\n PivotTable,\n PivotTableSimple,\n PivotTableConstructorOptions,\n PivotChartConstructorOptions,\n PivotChart,\n GanttConstructorOptions,\n IHeaderTreeDefine,\n IDimension,\n IIndicator,\n ITitleDefine,\n ICornerDefine,\n ColumnsDefine,\n ColumnDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n TextAlignType,\n TextBaselineType,\n themes,\n data,\n MousePointerCellEvent,\n getIcons,\n clearGlobal,\n //plugin registers\n register,\n /**\n * 暂不推荐使用\n */\n DataStatistics,\n CustomLayout,\n updateCell,\n renderChart,\n graphicUtil,\n setCustomAlphabetCharSet,\n restoreMeasureText\n // VRender // should use import {xxx} from '@visactor/vtable/es/vrender'\n};\n\n/** @private */\nfunction getIcons(): {\n [key: string]: TYPES.ColumnIconOption;\n} {\n return icons.get();\n}\n/** 清理内部的全局变量 如注册的icon theme等 以及共享的header column类实例 */\nfunction clearGlobal() {\n register.clearAll();\n // headers.type.clearGlobal();\n // columns.type.clearGlobal();\n}\nTYPES.AggregationType;\n\nexport * from './components';\nexport * from './scenegraph/group-creater/cell-type';\n\nexport { TABLE_EVENT_TYPE } from './core/TABLE_EVENT_TYPE';\nexport { PIVOT_CHART_EVENT_TYPE, PIVOT_TABLE_EVENT_TYPE } from './ts-types/pivot-table/PIVOT_TABLE_EVENT_TYPE';\n\nexport { EventTarget } from './event/EventTarget';\n"]}
@@ -1,6 +1,9 @@
1
- import type { Style } from '../body-helper/style';
2
- import type { CellRange, ColumnStyleOption, CustomCellStyle, CustomCellStyleArrangement } from '../ts-types';
3
1
  import type { BaseTableAPI } from '../ts-types/base-table';
2
+ import type { CellRange, ColumnStyleOption, CustomCellStyle, CustomCellStyleArrangement } from '../ts-types';
3
+ import type { Style } from '../body-helper/style';
4
+ export interface ICustomCellStylePlugin {
5
+ new (table: BaseTableAPI, customCellStyle: CustomCellStyle[], customCellStyleArrangement: CustomCellStyleArrangement[]): CustomCellStylePlugin;
6
+ }
4
7
  export declare class CustomCellStylePlugin {
5
8
  table: BaseTableAPI;
6
9
  customCellStyle: CustomCellStyle[];
@@ -19,3 +22,4 @@ export declare class CustomCellStylePlugin {
19
22
  hasCustomCellStyle(customStyleId: string): boolean;
20
23
  }
21
24
  export declare function mergeStyle(cacheStyle: Style, customCellStyle: ColumnStyleOption): Style;
25
+ export declare const registerCustomCellStylePlugin: () => void;
@@ -2,9 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
- }), exports.mergeStyle = exports.CustomCellStylePlugin = void 0;
5
+ }), exports.registerCustomCellStylePlugin = exports.mergeStyle = exports.CustomCellStylePlugin = void 0;
6
6
 
7
- const vutils_1 = require("@visactor/vutils");
7
+ const vutils_1 = require("@visactor/vutils"), factory_1 = require("../core/factory");
8
8
 
9
9
  class CustomCellStylePlugin {
10
10
  constructor(table, customCellStyle, customCellStyleArrangement) {
@@ -86,4 +86,10 @@ function mergeStyle(cacheStyle, customCellStyle) {
86
86
  }
87
87
 
88
88
  exports.CustomCellStylePlugin = CustomCellStylePlugin, exports.mergeStyle = mergeStyle;
89
+
90
+ const registerCustomCellStylePlugin = () => {
91
+ factory_1.Factory.registerComponent("customCellStylePlugin", CustomCellStylePlugin);
92
+ };
93
+
94
+ exports.registerCustomCellStylePlugin = registerCustomCellStylePlugin;
89
95
  //# sourceMappingURL=custom-cell-style.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugins/custom-cell-style.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AAWzC,MAAa,qBAAqB;IAKhC,YACE,KAAmB,EACnB,eAAkC,EAClC,0BAAwD;QAExD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,0BAA0B,GAAG,0BAA0B,CAAC;IAC/D,CAAC;IAED,kBAAkB,CAAC,GAAW,EAAE,GAAW;QACzC,MAAM,cAAc,GAAG,IAAI,CAAC,qBAAqB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAC5D,IAAI,cAAc,CAAC,MAAM,EAAE;YACzB,MAAM,MAAM,GAAwB,EAAE,CAAC;YAEvC,cAAc,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;gBACrC,MAAM,WAAW,GAAG,IAAI,CAAC,wBAAwB,CAAC,aAAa,CAAC,CAAC;gBACjE,IAAI,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,KAAK,EAAE;oBACtB,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;iBAChC;YACH,CAAC,CAAC,CAAC;YAEH,OAAO,IAAA,cAAK,EAAC,EAAE,EAAE,GAAG,MAAM,CAAC,CAAC;SAG7B;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,qBAAqB,CAAC,GAAW,EAAE,GAAW;QAE5C,MAAM,cAAc,GAAa,EAAE,CAAC;QAEpC,MAAM,K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C;CACF;AAjMD,sDAiMC;AAED,SAAgB,UAAU,CAAC,UAAiB,EAAE,eAAkC;IAC9E,UAAU,GAAG,UAAU,CAAC,KAAK,EAAE,CAAC;IAEhC,KAAK,MAAM,GAAG,IAAI,eAAe,EAAE;QACjC,MAAM,KAAK,GAAI,eAAuB,CAAC,GAAG,CAAC,CAAC;QAC5C,IAAI,KAAK,EAAE;YACR,UAAkB,CAAC,IAAI,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC;SACxC;KACF;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAXD,gCAWC","file":"custom-cell-style.js","sourcesContent":["import { merge } from '@visactor/vutils';\nimport type { Style } from '../body-helper/style';\nimport type {\n CellRange,\n ColumnStyleOption,\n CustomCellStyle,\n CustomCellStyleArrangement,\n FullExtendStyle\n} from '../ts-types';\nimport type { BaseTableAPI } from '../ts-types/base-table';\n\nexport class CustomCellStylePlugin {\n table: BaseTableAPI;\n customCellStyle: CustomCellStyle[];\n customCellStyleArrangement: CustomCellStyleArrangement[];\n\n constructor(\n table: BaseTableAPI,\n customCellStyle: CustomCellStyle[],\n customCellStyleArrangement: CustomCellStyleArrangement[]\n ) {\n this.table = table;\n this.customCellStyle = customCellStyle;\n this.customCellStyleArrangement = customCellStyleArrangement;\n }\n\n getCustomCellStyle(col: number, row: number) {\n const customStyleIds = this.getCustomCellStyleIds(col, row);\n if (customStyleIds.length) {\n const styles: ColumnStyleOption[] = [];\n\n customStyleIds.forEach(customStyleId => {\n const styleOption = this.getCustomCellStyleOption(customStyleId);\n if (styleOption?.style) {\n styles.push(styleOption.style);\n }\n });\n\n return merge({}, ...styles);\n // const styleOption = this.getCustomCellStyleOption(customStyleId);\n // return styleOption?.style;\n }\n return undefined;\n }\n\n getCustomCellStyleIds(col: number, row: number) {\n // let customStyleId;\n const customStyleIds: string[] = [];\n\n const range = this.table.getCellRange(col, row);\n for (let c = range.start.col; c <= range.end.col; c++) {\n for (let r = range.start.row; r <= range.end.row; r++) {\n // eslint-disable-next-line no-loop-func\n this.customCellStyleArrangement.forEach(style => {\n if (style.cellPosition.range) {\n if (\n style.cellPosition.range.start.col <= c &&\n style.cellPosition.range.end.col >= c &&\n style.cellPosition.range.start.row <= r &&\n style.cellPosition.range.end.row >= r\n ) {\n // customStyleId = style.customStyleId;\n customStyleIds.push(style.customStyleId);\n }\n } else if (style.cellPosition.col === c && style.cellPosition.row === r) {\n // customStyleId = style.customStyleId;\n customStyleIds.push(style.customStyleId);\n }\n });\n }\n }\n\n return customStyleIds;\n }\n\n getCustomCellStyleOption(customStyleId: string) {\n return this.customCellStyle.find(style => style.id === customStyleId);\n }\n\n registerCustomCellStyle(customStyleId: string, customStyle: ColumnStyleOption | undefined | null) {\n const index = this.customCellStyle.findIndex(style => style.id === customStyleId);\n if (index === -1) {\n this.customCellStyle.push({\n id: customStyleId,\n style: customStyle\n });\n } else {\n this.customCellStyle[index] = {\n id: customStyleId,\n style: customStyle\n };\n }\n\n this.customCellStyleArrangement.forEach(cellStyle => {\n const cellPos = cellStyle.cellPosition;\n if (cellStyle.customStyleId === customStyleId) {\n if (cellPos.range) {\n for (\n let col = Math.max(0, cellPos.range.start.col);\n col <= Math.min(this.table.colCount - 1, cellPos.range.end.col);\n col++\n ) {\n for (\n let row = Math.max(0, cellPos.range.start.row);\n row <= Math.min(this.table.rowCount - 1, cellPos.range.end.row);\n row++\n ) {\n this.table.scenegraph.updateCellContent(col, row);\n }\n }\n } else {\n this.table.scenegraph.updateCellContent(cellPos.col, cellPos.row);\n }\n }\n });\n this.table.scenegraph.updateNextFrame();\n }\n\n arrangeCustomCellStyle(\n cellPos: {\n col?: number;\n row?: number;\n range?: CellRange;\n },\n customStyleId: string | undefined | null\n ) {\n const index = this.customCellStyleArrangement.findIndex(style => {\n if (style.cellPosition.range && cellPos.range) {\n return (\n style.cellPosition.range.start.col === cellPos.range.start.col &&\n style.cellPosition.range.start.row === cellPos.range.start.row &&\n style.cellPosition.range.end.col === cellPos.range.end.col &&\n style.cellPosition.range.end.row === cellPos.range.end.row\n );\n }\n return style.cellPosition.col === cellPos.col && style.cellPosition.row === cellPos.row;\n });\n\n if (index === -1 && !customStyleId) {\n // do nothing\n return;\n } else if (index === -1 && customStyleId) {\n // add new style\n this.customCellStyleArrangement.push({\n cellPosition: {\n col: cellPos.col,\n row: cellPos.row,\n range: cellPos.range\n },\n customStyleId: customStyleId\n });\n } else if (this.customCellStyleArrangement[index].customStyleId === customStyleId) {\n // same style\n return;\n } else if (customStyleId) {\n // update style\n this.customCellStyleArrangement[index].customStyleId = customStyleId;\n } else {\n // delete useless style\n this.customCellStyleArrangement.splice(index, 1);\n }\n\n // update cell group\n if (cellPos.range) {\n for (\n let col = Math.max(0, cellPos.range.start.col);\n col <= Math.min(this.table.colCount - 1, cellPos.range.end.col);\n col++\n ) {\n for (\n let row = Math.max(0, cellPos.range.start.row);\n row <= Math.min(this.table.rowCount - 1, cellPos.range.end.row);\n row++\n ) {\n const range = this.table.getCellRange(col, row);\n for (let c = range.start.col; c <= range.end.col; c++) {\n for (let r = range.start.row; r <= range.end.row; r++) {\n this.table.scenegraph.updateCellContent(c, r);\n }\n }\n // this.table.scenegraph.updateCellContent(col, row);\n }\n }\n } else {\n this.table.scenegraph.updateCellContent(cellPos.col, cellPos.row);\n }\n\n this.table.scenegraph.updateNextFrame();\n }\n\n updateCustomCell(customCellStyle: CustomCellStyle[], customCellStyleArrangement: CustomCellStyleArrangement[]) {\n this.customCellStyle.length = 0;\n this.customCellStyleArrangement.length = 0;\n customCellStyle.forEach((cellStyle: CustomCellStyle) => {\n this.registerCustomCellStyle(cellStyle.id, cellStyle.style);\n });\n customCellStyleArrangement.forEach((cellStyle: CustomCellStyleArrangement) => {\n this.arrangeCustomCellStyle(cellStyle.cellPosition, cellStyle.customStyleId);\n });\n }\n\n hasCustomCellStyle(customStyleId: string) {\n return this.customCellStyle.some(style => style.id === customStyleId);\n }\n}\n\nexport function mergeStyle(cacheStyle: Style, customCellStyle: ColumnStyleOption): Style {\n cacheStyle = cacheStyle.clone();\n\n for (const key in customCellStyle) {\n const value = (customCellStyle as any)[key];\n if (value) {\n (cacheStyle as any)[`_${key}`] = value;\n }\n }\n\n return cacheStyle;\n}\n"]}
1
+ {"version":3,"sources":["../src/plugins/custom-cell-style.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AAIzC,6CAA0C;AAU1C,MAAa,qBAAqB;IAKhC,YACE,KAAmB,EACnB,eAAkC,EAClC,0BAAwD;QAExD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,0BAA0B,GAAG,0BAA0B,CAAC;IAC/D,CAAC;IAED,kBAAkB,CAAC,GAAW,EAAE,GAAW;QACzC,MAAM,cAAc,GAAG,IAAI,CAAC,qBAAqB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAC5D,IAAI,cAAc,CAAC,MAAM,EAAE;YACzB,MAAM,MAAM,GAAwB,EAAE,CAAC;YAEvC,cAAc,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;gBACrC,MAAM,WAAW,GAAG,IAAI,CAAC,wBAAwB,CAAC,aAAa,CAAC,CAAC;gBACjE,IAAI,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,KAAK,EAAE;oBACtB,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;iBAChC;YACH,CAAC,CAAC,CAAC;YAEH,OAAO,IAAA,cAAK,EAAC,EAAE,EAAE,GAAG,MAAM,CAAC,CAAC;SAG7B;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,qBAAqB,CAAC,GAAW,EAAE,GAAW;QAE5C,MAAM,cAAc,GAAa,EAAE,CAAC;QAEpC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAChD,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,E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AG,IAAI,eAAe,EAAE;QACjC,MAAM,KAAK,GAAI,eAAuB,CAAC,GAAG,CAAC,CAAC;QAC5C,IAAI,KAAK,EAAE;YACR,UAAkB,CAAC,IAAI,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC;SACxC;KACF;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAXD,gCAWC;AAEM,MAAM,6BAA6B,GAAG,GAAG,EAAE;IAChD,iBAAO,CAAC,iBAAiB,CAAC,uBAAuB,EAAE,qBAAqB,CAAC,CAAC;AAC5E,CAAC,CAAC;AAFW,QAAA,6BAA6B,iCAExC","file":"custom-cell-style.js","sourcesContent":["import { merge } from '@visactor/vutils';\nimport type { BaseTableAPI } from '../ts-types/base-table';\nimport type { CellRange, ColumnStyleOption, CustomCellStyle, CustomCellStyleArrangement } from '../ts-types';\nimport type { Style } from '../body-helper/style';\nimport { Factory } from '../core/factory';\n\nexport interface ICustomCellStylePlugin {\n new (\n table: BaseTableAPI,\n customCellStyle: CustomCellStyle[],\n customCellStyleArrangement: CustomCellStyleArrangement[]\n ): CustomCellStylePlugin;\n}\n\nexport class CustomCellStylePlugin {\n table: BaseTableAPI;\n customCellStyle: CustomCellStyle[];\n customCellStyleArrangement: CustomCellStyleArrangement[];\n\n constructor(\n table: BaseTableAPI,\n customCellStyle: CustomCellStyle[],\n customCellStyleArrangement: CustomCellStyleArrangement[]\n ) {\n this.table = table;\n this.customCellStyle = customCellStyle;\n this.customCellStyleArrangement = customCellStyleArrangement;\n }\n\n getCustomCellStyle(col: number, row: number) {\n const customStyleIds = this.getCustomCellStyleIds(col, row);\n if (customStyleIds.length) {\n const styles: ColumnStyleOption[] = [];\n\n customStyleIds.forEach(customStyleId => {\n const styleOption = this.getCustomCellStyleOption(customStyleId);\n if (styleOption?.style) {\n styles.push(styleOption.style);\n }\n });\n\n return merge({}, ...styles);\n // const styleOption = this.getCustomCellStyleOption(customStyleId);\n // return styleOption?.style;\n }\n return undefined;\n }\n\n getCustomCellStyleIds(col: number, row: number) {\n // let customStyleId;\n const customStyleIds: string[] = [];\n\n const range = this.table.getCellRange(col, row);\n for (let c = range.start.col; c <= range.end.col; c++) {\n for (let r = range.start.row; r <= range.end.row; r++) {\n // eslint-disable-next-line no-loop-func\n this.customCellStyleArrangement.forEach(style => {\n if (style.cellPosition.range) {\n if (\n style.cellPosition.range.start.col <= c &&\n style.cellPosition.range.end.col >= c &&\n style.cellPosition.range.start.row <= r &&\n style.cellPosition.range.end.row >= r\n ) {\n // customStyleId = style.customStyleId;\n customStyleIds.push(style.customStyleId);\n }\n } else if (style.cellPosition.col === c && style.cellPosition.row === r) {\n // customStyleId = style.customStyleId;\n customStyleIds.push(style.customStyleId);\n }\n });\n }\n }\n\n return customStyleIds;\n }\n\n getCustomCellStyleOption(customStyleId: string) {\n return this.customCellStyle.find(style => style.id === customStyleId);\n }\n\n registerCustomCellStyle(customStyleId: string, customStyle: ColumnStyleOption | undefined | null) {\n const index = this.customCellStyle.findIndex(style => style.id === customStyleId);\n if (index === -1) {\n this.customCellStyle.push({\n id: customStyleId,\n style: customStyle\n });\n } else {\n this.customCellStyle[index] = {\n id: customStyleId,\n style: customStyle\n };\n }\n\n this.customCellStyleArrangement.forEach(cellStyle => {\n const cellPos = cellStyle.cellPosition;\n if (cellStyle.customStyleId === customStyleId) {\n if (cellPos.range) {\n for (\n let col = Math.max(0, cellPos.range.start.col);\n col <= Math.min(this.table.colCount - 1, cellPos.range.end.col);\n col++\n ) {\n for (\n let row = Math.max(0, cellPos.range.start.row);\n row <= Math.min(this.table.rowCount - 1, cellPos.range.end.row);\n row++\n ) {\n this.table.scenegraph.updateCellContent(col, row);\n }\n }\n } else {\n this.table.scenegraph.updateCellContent(cellPos.col, cellPos.row);\n }\n }\n });\n this.table.scenegraph.updateNextFrame();\n }\n\n arrangeCustomCellStyle(\n cellPos: {\n col?: number;\n row?: number;\n range?: CellRange;\n },\n customStyleId: string | undefined | null\n ) {\n const index = this.customCellStyleArrangement.findIndex(style => {\n if (style.cellPosition.range && cellPos.range) {\n return (\n style.cellPosition.range.start.col === cellPos.range.start.col &&\n style.cellPosition.range.start.row === cellPos.range.start.row &&\n style.cellPosition.range.end.col === cellPos.range.end.col &&\n style.cellPosition.range.end.row === cellPos.range.end.row\n );\n }\n return style.cellPosition.col === cellPos.col && style.cellPosition.row === cellPos.row;\n });\n\n if (index === -1 && !customStyleId) {\n // do nothing\n return;\n } else if (index === -1 && customStyleId) {\n // add new style\n this.customCellStyleArrangement.push({\n cellPosition: {\n col: cellPos.col,\n row: cellPos.row,\n range: cellPos.range\n },\n customStyleId: customStyleId\n });\n } else if (this.customCellStyleArrangement[index].customStyleId === customStyleId) {\n // same style\n return;\n } else if (customStyleId) {\n // update style\n this.customCellStyleArrangement[index].customStyleId = customStyleId;\n } else {\n // delete useless style\n this.customCellStyleArrangement.splice(index, 1);\n }\n\n // update cell group\n if (cellPos.range) {\n for (\n let col = Math.max(0, cellPos.range.start.col);\n col <= Math.min(this.table.colCount - 1, cellPos.range.end.col);\n col++\n ) {\n for (\n let row = Math.max(0, cellPos.range.start.row);\n row <= Math.min(this.table.rowCount - 1, cellPos.range.end.row);\n row++\n ) {\n const range = this.table.getCellRange(col, row);\n for (let c = range.start.col; c <= range.end.col; c++) {\n for (let r = range.start.row; r <= range.end.row; r++) {\n this.table.scenegraph.updateCellContent(c, r);\n }\n }\n // this.table.scenegraph.updateCellContent(col, row);\n }\n }\n } else {\n this.table.scenegraph.updateCellContent(cellPos.col, cellPos.row);\n }\n\n this.table.scenegraph.updateNextFrame();\n }\n\n updateCustomCell(customCellStyle: CustomCellStyle[], customCellStyleArrangement: CustomCellStyleArrangement[]) {\n this.customCellStyle.length = 0;\n this.customCellStyleArrangement.length = 0;\n customCellStyle.forEach((cellStyle: CustomCellStyle) => {\n this.registerCustomCellStyle(cellStyle.id, cellStyle.style);\n });\n customCellStyleArrangement.forEach((cellStyle: CustomCellStyleArrangement) => {\n this.arrangeCustomCellStyle(cellStyle.cellPosition, cellStyle.customStyleId);\n });\n }\n\n hasCustomCellStyle(customStyleId: string) {\n return this.customCellStyle.some(style => style.id === customStyleId);\n }\n}\n\nexport function mergeStyle(cacheStyle: Style, customCellStyle: ColumnStyleOption): Style {\n cacheStyle = cacheStyle.clone();\n\n for (const key in customCellStyle) {\n const value = (customCellStyle as any)[key];\n if (value) {\n (cacheStyle as any)[`_${key}`] = value;\n }\n }\n\n return cacheStyle;\n}\n\nexport const registerCustomCellStylePlugin = () => {\n Factory.registerComponent('customCellStylePlugin', CustomCellStylePlugin);\n};\n\n// export type ICustomCellStylePlugin = typeof CustomCellStylePlugin;\n"]}
@@ -1,19 +1 @@
1
- import type { Group } from '../scenegraph/graphic/group';
2
- import type { CellRange } from '../ts-types';
3
- import type { BaseTableAPI } from '../ts-types/base-table';
4
- export interface InvertHighlightPluginOptions {
5
- fill?: string;
6
- opacity?: number;
7
- }
8
- export declare class InvertHighlightPlugin {
9
- table: BaseTableAPI;
10
- range?: CellRange;
11
- _fill: string;
12
- _opacity: number;
13
- constructor(table: BaseTableAPI, options?: InvertHighlightPluginOptions);
14
- setInvertHighlightRange(range?: CellRange): void;
15
- deleteAllCellGroupShadow(): void;
16
- updateCellGroupShadow(): void;
17
- updateCellGroupShadowInContainer(container: Group, range?: CellRange): void;
18
- }
19
1
  export declare function onBeforeAttributeUpdateForInvertHighlight(val: Record<string, any>, attribute: any): void;
@@ -2,58 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
- }), exports.onBeforeAttributeUpdateForInvertHighlight = exports.InvertHighlightPlugin = void 0;
5
+ }), exports.onBeforeAttributeUpdateForInvertHighlight = void 0;
6
6
 
7
- const vrender_1 = require("./../vrender"), cell_range_1 = require("../tools/cell-range"), helper_1 = require("../tools/helper"), vutils_1 = require("@visactor/vutils");
8
-
9
- class InvertHighlightPlugin {
10
- constructor(table, options) {
11
- var _a, _b;
12
- this.table = table, this._fill = null !== (_a = null == options ? void 0 : options.fill) && void 0 !== _a ? _a : "#000",
13
- this._opacity = null !== (_b = null == options ? void 0 : options.opacity) && void 0 !== _b ? _b : .5;
14
- }
15
- setInvertHighlightRange(range) {
16
- (0, cell_range_1.isSameRange)(this.range, range) || (this.range = range, range ? this.updateCellGroupShadow() : this.deleteAllCellGroupShadow(),
17
- this.table.scenegraph.updateNextFrame());
18
- }
19
- deleteAllCellGroupShadow() {
20
- this.table.isPivotTable() || (this.updateCellGroupShadowInContainer(this.table.scenegraph.rowHeaderGroup),
21
- this.updateCellGroupShadowInContainer(this.table.scenegraph.leftBottomCornerGroup)),
22
- this.updateCellGroupShadowInContainer(this.table.scenegraph.bodyGroup), this.updateCellGroupShadowInContainer(this.table.scenegraph.rightFrozenGroup),
23
- this.updateCellGroupShadowInContainer(this.table.scenegraph.bottomFrozenGroup),
24
- this.updateCellGroupShadowInContainer(this.table.scenegraph.rightBottomCornerGroup);
25
- }
26
- updateCellGroupShadow() {
27
- this.table.isPivotTable() || (this.updateCellGroupShadowInContainer(this.table.scenegraph.rowHeaderGroup, this.range),
28
- this.updateCellGroupShadowInContainer(this.table.scenegraph.leftBottomCornerGroup, this.range)),
29
- this.updateCellGroupShadowInContainer(this.table.scenegraph.bodyGroup, this.range),
30
- this.updateCellGroupShadowInContainer(this.table.scenegraph.rightFrozenGroup, this.range),
31
- this.updateCellGroupShadowInContainer(this.table.scenegraph.bottomFrozenGroup),
32
- this.range, this.updateCellGroupShadowInContainer(this.table.scenegraph.rightBottomCornerGroup, this.range);
33
- }
34
- updateCellGroupShadowInContainer(container, range) {
35
- container.forEachChildrenSkipChild((column => {
36
- "column" === column.role && column.forEachChildrenSkipChild((cell => {
37
- if ("cell" !== cell.role) return;
38
- cell.attachShadow(cell.shadowRoot);
39
- const shadowGroup = cell.shadowRoot;
40
- if (range) {
41
- if ((0, helper_1.cellInRange)(range, cell.col, cell.row)) shadowGroup.removeAllChild(); else if (!shadowGroup.firstChild) {
42
- const shadowRect = (0, vrender_1.createRect)({
43
- x: 0,
44
- y: 0,
45
- width: cell.attribute.width,
46
- height: cell.attribute.height,
47
- fill: this._fill,
48
- opacity: this._opacity
49
- });
50
- shadowRect.name = "shadow-rect", shadowGroup.appendChild(shadowRect);
51
- }
52
- } else shadowGroup.removeAllChild();
53
- }));
54
- }));
55
- }
56
- }
7
+ const vutils_1 = require("@visactor/vutils");
57
8
 
58
9
  function onBeforeAttributeUpdateForInvertHighlight(val, attribute) {
59
10
  var _a, _b;
@@ -68,5 +19,5 @@ function onBeforeAttributeUpdateForInvertHighlight(val, attribute) {
68
19
  }
69
20
  }
70
21
 
71
- exports.InvertHighlightPlugin = InvertHighlightPlugin, exports.onBeforeAttributeUpdateForInvertHighlight = onBeforeAttributeUpdateForInvertHighlight;
22
+ exports.onBeforeAttributeUpdateForInvertHighlight = onBeforeAttributeUpdateForInvertHighlight;
72
23
  //# sourceMappingURL=invert-highlight.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugins/invert-highlight.ts"],"names":[],"mappings":";;;AACA,0CAA0C;AAE1C,oDAAkD;AAGlD,4CAA8C;AAC9C,6CAA2C;AAO3C,MAAa,qBAAqB;IAMhC,YAAY,KAAmB,EAAE,OAAsC;;QACrE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QAEnB,IAAI,CAAC,KAAK,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,mCAAI,MAAM,CAAC;QACrC,IAAI,CAAC,QAAQ,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,mCAAI,GAAG,CAAC;IAC1C,CAAC;IAED,uBAAuB,CAAC,KAAiB;QACvC,IAAI,IAAA,wBAAW,EAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE;YAClC,OAAO;SACR;QAED,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,EAAE;YAEV,IAAI,CAAC,wBAAwB,EAAE,CAAC;SACjC;aAAM;YAEL,IAAI,C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AAG,aAAa,CAAC;wBAChC,WAAW,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;qBACrC;gBACH,CAAC,CAAC,CAAC;aACJ;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAnFD,sDAmFC;AAED,SAAgB,yCAAyC,CAAC,GAAwB,EAAE,SAAc;;IAEhG,MAAM,OAAO,GAAG,IAAW,CAAC;IAC5B,IAAI,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,UAAU,CAAC,aAAa,IAAI,CAAC,IAAA,gBAAO,EAAC,GAAG,CAAC,KAAK,CAAC,IAAI,IAAA,gBAAO,EAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE;QACzG,MAAM,UAAU,GAAI,OAAO,CAAC,UAAoB,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAS,CAAC;QAC9F,IAAI,UAAU,EAAE;YACd,UAAU,CAAC,aAAa,CAAC;gBACvB,KAAK,EAAE,MAAA,GAAG,CAAC,KAAK,mCAAI,UAAU,CAAC,SAAS,CAAC,KAAK;gBAC9C,MAAM,EAAE,MAAA,GAAG,CAAC,MAAM,mCAAI,UAAU,CAAC,SAAS,CAAC,MAAM;aAClD,CAAC,CAAC;SACJ;KACF;AACH,CAAC;AAZD,8FAYC","file":"invert-highlight.js","sourcesContent":["import type { Rect } from './../vrender';\nimport { createRect } from './../vrender';\nimport type { Group } from '../scenegraph/graphic/group';\nimport { isSameRange } from '../tools/cell-range';\nimport type { CellRange } from '../ts-types';\nimport type { BaseTableAPI } from '../ts-types/base-table';\nimport { cellInRange } from '../tools/helper';\nimport { isValid } from '@visactor/vutils';\n\nexport interface InvertHighlightPluginOptions {\n fill?: string;\n opacity?: number;\n}\n\nexport class InvertHighlightPlugin {\n table: BaseTableAPI;\n range?: CellRange;\n _fill: string;\n _opacity: number;\n\n constructor(table: BaseTableAPI, options?: InvertHighlightPluginOptions) {\n this.table = table;\n\n this._fill = options?.fill ?? '#000';\n this._opacity = options?.opacity ?? 0.5;\n }\n\n setInvertHighlightRange(range?: CellRange) {\n if (isSameRange(this.range, range)) {\n return;\n }\n\n this.range = range;\n if (!range) {\n // reset highlight\n this.deleteAllCellGroupShadow();\n } else {\n // update highlight\n this.updateCellGroupShadow();\n }\n\n this.table.scenegraph.updateNextFrame();\n }\n\n deleteAllCellGroupShadow() {\n if (!this.table.isPivotTable()) {\n this.updateCellGroupShadowInContainer(this.table.scenegraph.rowHeaderGroup);\n this.updateCellGroupShadowInContainer(this.table.scenegraph.leftBottomCornerGroup);\n }\n this.updateCellGroupShadowInContainer(this.table.scenegraph.bodyGroup);\n this.updateCellGroupShadowInContainer(this.table.scenegraph.rightFrozenGroup);\n this.updateCellGroupShadowInContainer(this.table.scenegraph.bottomFrozenGroup);\n this.updateCellGroupShadowInContainer(this.table.scenegraph.rightBottomCornerGroup);\n }\n\n updateCellGroupShadow() {\n if (!this.table.isPivotTable()) {\n this.updateCellGroupShadowInContainer(this.table.scenegraph.rowHeaderGroup, this.range);\n this.updateCellGroupShadowInContainer(this.table.scenegraph.leftBottomCornerGroup, this.range);\n }\n this.updateCellGroupShadowInContainer(this.table.scenegraph.bodyGroup, this.range);\n this.updateCellGroupShadowInContainer(this.table.scenegraph.rightFrozenGroup, this.range);\n this.updateCellGroupShadowInContainer(this.table.scenegraph.bottomFrozenGroup), this.range;\n this.updateCellGroupShadowInContainer(this.table.scenegraph.rightBottomCornerGroup, this.range);\n }\n updateCellGroupShadowInContainer(container: Group, range?: CellRange) {\n container.forEachChildrenSkipChild((column: Group) => {\n if (column.role === 'column') {\n column.forEachChildrenSkipChild((cell: Group) => {\n if (cell.role !== 'cell') {\n return;\n }\n cell.attachShadow(cell.shadowRoot);\n const shadowGroup = cell.shadowRoot;\n if (!range) {\n // no highlight\n shadowGroup.removeAllChild();\n } else if (cellInRange(range, cell.col, cell.row)) {\n // inside highlight\n shadowGroup.removeAllChild();\n } else if (!shadowGroup.firstChild) {\n // outside highlight\n const shadowRect = createRect({\n x: 0,\n y: 0,\n width: cell.attribute.width,\n height: cell.attribute.height,\n fill: this._fill,\n opacity: this._opacity\n });\n shadowRect.name = 'shadow-rect';\n shadowGroup.appendChild(shadowRect);\n }\n });\n }\n });\n }\n}\n\nexport function onBeforeAttributeUpdateForInvertHighlight(val: Record<string, any>, attribute: any) {\n // @ts-ignore\n const graphic = this as any;\n if (graphic.shadowRoot && graphic.shadowRoot.childrenCount && (isValid(val.width) || isValid(val.height))) {\n const shadowRect = (graphic.shadowRoot as Group).findChildrenByName('shadow-rect')[0] as Rect;\n if (shadowRect) {\n shadowRect.setAttributes({\n width: val.width ?? shadowRect.attribute.width,\n height: val.height ?? shadowRect.attribute.height\n });\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/plugins/invert-highlight.ts"],"names":[],"mappings":";;;AACA,6CAA2C;AAE3C,SAAgB,yCAAyC,CAAC,GAAwB,EAAE,SAAc;;IAEhG,MAAM,OAAO,GAAG,IAAW,CAAC;IAC5B,IAAI,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,UAAU,CAAC,aAAa,IAAI,CAAC,IAAA,gBAAO,EAAC,GAAG,CAAC,KAAK,CAAC,IAAI,IAAA,gBAAO,EAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE;QACzG,MAAM,UAAU,GAAI,OAAO,CAAC,UAAoB,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAS,CAAC;QAC9F,IAAI,UAAU,EAAE;YACd,UAAU,CAAC,aAAa,CAAC;gBACvB,KAAK,EAAE,MAAA,GAAG,CAAC,KAAK,mCAAI,UAAU,CAAC,SAAS,CAAC,KAAK;gBAC9C,MAAM,EAAE,MAAA,GAAG,CAAC,MAAM,mCAAI,UAAU,CAAC,SAAS,CAAC,MAAM;aAClD,CAAC,CAAC;SACJ;KACF;AACH,CAAC;AAZD,8FAYC","file":"invert-highlight.js","sourcesContent":["import type { Group, Rect } from './../vrender';\nimport { isValid } from '@visactor/vutils';\n\nexport function onBeforeAttributeUpdateForInvertHighlight(val: Record<string, any>, attribute: any) {\n // @ts-ignore\n const graphic = this as any;\n if (graphic.shadowRoot && graphic.shadowRoot.childrenCount && (isValid(val.width) || isValid(val.height))) {\n const shadowRect = (graphic.shadowRoot as Group).findChildrenByName('shadow-rect')[0] as Rect;\n if (shadowRect) {\n shadowRect.setAttributes({\n width: val.width ?? shadowRect.attribute.width,\n height: val.height ?? shadowRect.attribute.height\n });\n }\n }\n}\n"]}
@@ -1,4 +1,7 @@
1
1
  import type { ListTable } from '../ListTable';
2
+ export interface IListTreeStickCellPlugin {
3
+ new (table: ListTable): ListTreeStickCellPlugin;
4
+ }
2
5
  export declare class ListTreeStickCellPlugin {
3
6
  table: ListTable;
4
7
  titleRows: number[];
@@ -13,4 +16,3 @@ export declare class ListTreeStickCellPlugin {
13
16
  updateScenegraph(): void;
14
17
  }
15
18
  export declare const registerListTreeStickCellPlugin: () => void;
16
- export type IListTreeStickCellPlugin = typeof ListTreeStickCellPlugin;
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  }), exports.registerListTreeStickCellPlugin = exports.ListTreeStickCellPlugin = void 0;
6
6
 
7
- const vutils_1 = require("@visactor/vutils"), factory_1 = require("../core/factory"), group_1 = require("../scenegraph/graphic/group"), vrender_1 = require("../vrender"), cell_helper_1 = require("../scenegraph/group-creater/cell-helper"), util_1 = require("../event/util");
7
+ const vutils_1 = require("@visactor/vutils"), group_1 = require("../scenegraph/graphic/group"), cell_helper_1 = require("../scenegraph/group-creater/cell-helper"), vrender_1 = require("./../vrender"), factory_1 = require("../core/factory"), util_1 = require("../event/util");
8
8
 
9
9
  class ListTreeStickCellPlugin {
10
10
  constructor(table) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugins/list-tree-stick-cell.ts"],"names":[],"mappings":";;;AAAA,6CAAoD;AAEpD,6CAA0C;AAC1C,uDAAoD;AACpD,wCAAsD;AACtD,yEAAqE;AACrE,wCAA8C;AAE9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,OAAO,CAAC,GAAG,CAAC,CAAC;YAExC,WAAW,CAAC,GAAG,GAAG,QAAQ,EAAE,KAAK,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;KACJ;IAED,MAAM,WAAW,GAAG,cAAc,CAAC,MAAM,CAAC,UAAU,CAAC;IACrD,MAAM,iBAAiB,GAAG,iBAAiB,CAAC,MAAM,CAAC,UAAU,CAAC;IAC9D,WAAW,CAAC,cAAc,EAAE,CAAC;IAC7B,iBAAiB,CAAC,cAAc,EAAE,CAAC;IAEnC,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC;AAC5C,CAAC;AAED,SAAS,WAAW,CAAC,GAAW,EAAE,KAAgB;IAChD,MAAM,SAAS,GAAG,KAAK,CAAC,YAAY,EAAE,CAAC;IAEvC,IAAI,IAAA,gBAAO,EAAC,GAAG,CAAC,IAAI,GAAG,IAAI,KAAK,CAAC,cAAc,EAAE;QAC/C,MAAM,YAAY,GAAG,KAAK,CAAC,mBAAmB,EAAE,CAAC;QACjD,MAAM,GAAG,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC;QAC5C,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,YAAY,EAAE,KAAK,CAAC,gBAAgB,EAAE,GAAG,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;KACjG;IACD,KAAK,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC;AACrC,CAAC;AAEM,MAAM,+BAA+B,GAAG,GAAG,EAAE;IAClD,iBAAO,CAAC,iBAAiB,CAAC,yBAAyB,EAAE,uBAAuB,CAAC,CAAC;AAChF,CAAC,CAAC;AAFW,QAAA,+BAA+B,mCAE1C","file":"list-tree-stick-cell.js","sourcesContent":["import { isArray, isValid } from '@visactor/vutils';\nimport type { ListTable } from '../ListTable';\nimport { Factory } from '../core/factory';\nimport { Group } from '../scenegraph/graphic/group';\nimport { createRect, type Graphic } from '../vrender';\nimport { updateCell } from '../scenegraph/group-creater/cell-helper';\nimport { getTargetCell } from '../event/util';\n\nexport class ListTreeStickCellPlugin {\n table: ListTable;\n titleRows: number[] = [];\n showedTitleRows: number[] = [];\n rowNow: number = -1;\n skipStartRow: number = -1;\n skipEndRow: number = -1;\n\n constructor(table: ListTable) {\n this.table = table;\n\n this.table.on('scroll', e => {\n if (e.scrollDirection !== 'vertical') {\n return;\n }\n this.updateGroupTitle();\n });\n\n this.table.on('resize_column', e => {\n this.updateGroupTitle();\n });\n }\n\n updateGroupTitle() {\n // this.updateGroupTitleInfo();\n if (this.table.scrollTop === 0) {\n // do nothing\n this.titleRows = [];\n this.showedTitleRows = [];\n } else if (\n this.skipStartRow !== -1 &&\n this.skipEndRow !== -1 &&\n this.skipStartRow !== this.table.scenegraph.proxy.bodyTopRow - 1\n ) {\n if (\n this.table.scenegraph.proxy.screenTopRow <= this.skipStartRow ||\n this.table.scenegraph.proxy.screenTopRow >= this.skipEndRow\n ) {\n this.skipStartRow = -1;\n this.skipEndRow = -1;\n this.updateGroupTitleInfo();\n } else {\n // const row = this.table.scenegraph.proxy.screenTopRow + titleRows.length;\n // nowRow = row;\n // renderLast = true;\n // do nothing\n }\n } else {\n this.skipStartRow = -1;\n this.skipEndRow = -1;\n this.updateGroupTitleInfo();\n }\n\n this.updateScenegraph();\n }\n\n updateGroupTitleInfo() {\n this.rowNow = this.table.scenegraph.proxy.screenTopRow + this.titleRows.length;\n const recordIndex = this.table.getRecordIndexByCell(0, this.rowNow); // [0, 0, 6]/0\n const nextRecordIndex = this.table.getRecordIndexByCell(0, this.rowNow + 1);\n this.getTitleRowsByRecordIndex(recordIndex, nextRecordIndex);\n }\n\n getTitleRowsByRecordIndex(recordIndex: number | number[], nextRecordIndex: number | number[]) {\n const titleRecords = [];\n if (!isArray(recordIndex)) {\n recordIndex = [recordIndex];\n }\n if (!isArray(nextRecordIndex)) {\n nextRecordIndex = [nextRecordIndex];\n }\n\n for (let i = 0; i < recordIndex.length; i++) {\n const index = recordIndex.slice(0, i + 1);\n const record = this.table.dataSource.getRaw(index as unknown as number);\n titleRecords.push(record);\n }\n\n const titleRows = [];\n // const isTitle = !(recordIndex.length === (this.table.options.groupBy as any).length + 1);\n const isTitle = nextRecordIndex.length === recordIndex.length + 1;\n let titleIndex = recordIndex.slice(0, !isTitle ? recordIndex.length - 1 : recordIndex.length);\n const currentIndexedData = this.table.dataSource.currentIndexedData;\n const startIndex = this.rowNow - this.table.columnHeaderLevelCount;\n\n for (let i = startIndex; i >= 0; i--) {\n const currentIndex = currentIndexedData[i];\n if (isArray(currentIndex) && titleIndex.length === currentIndex.length) {\n let isMatch = true;\n for (let j = 0; j < currentIndex.length; j++) {\n if (currentIndex[j] !== titleIndex[j]) {\n isMatch = false;\n break;\n }\n }\n if (isMatch) {\n titleRows.push(i + this.table.columnHeaderLevelCount);\n titleIndex = titleIndex.slice(0, titleIndex.length - 1);\n }\n } else if (currentIndex === recordIndex[0]) {\n titleRows.push(i + this.table.columnHeaderLevelCount);\n break;\n }\n }\n\n this.titleRows = titleRows.reverse();\n }\n\n updateScenegraph() {\n const { table } = this;\n const { shadowGroup, shadowGroupFrozen } = prepareShadowRoot(table);\n\n this.showedTitleRows.length = 0;\n let skip = 0;\n for (let col = 0; col < table.colCount; col++) {\n let colGroup;\n if (col < table.frozenColCount) {\n colGroup = new Group({\n x: table.getColsWidth(0, col - 1),\n y: table.getFrozenRowsHeight()\n });\n shadowGroupFrozen.add(colGroup);\n } else {\n colGroup = new Group({\n x: table.getColsWidth(table.frozenColCount, col - 1),\n y: table.getFrozenRowsHeight()\n });\n shadowGroup.add(colGroup);\n }\n colGroup.col = col;\n for (let i = 0; i < this.titleRows.length; i++) {\n const row = this.titleRows[i];\n if (isSkipRow(row, this.rowNow, table.scenegraph.proxy.screenTopRow, this.titleRows)) {\n // skipOne = true;\n col === 0 && skip++;\n continue;\n }\n if (col === 0) {\n this.showedTitleRows.push(row);\n }\n const cell = table.scenegraph.getCell(col, row);\n if (cell.role === 'cell') {\n const newCell = cloneGraphic(cell);\n newCell.setAttributes({\n y: i * 40\n });\n colGroup.add(newCell);\n } else {\n // create a fake cellGroup for title\n const newCell = updateCell(col, row, table, true, true);\n newCell.setAttributes({\n y: i * 40\n });\n colGroup.add(newCell);\n }\n }\n }\n\n if (skip > 0 && this.skipStartRow === -1 && this.skipEndRow === -1) {\n this.skipStartRow = table.scenegraph.proxy.screenTopRow - 1;\n this.skipEndRow = table.scenegraph.proxy.screenTopRow + 1;\n }\n }\n}\n\nfunction isSkipRow(row: number, topRow: number, screenTopRow: number, titleRows: number[]) {\n if (row === topRow && row !== screenTopRow + titleRows.length - 1) {\n return true;\n }\n\n const rowIndex = titleRows.indexOf(row);\n const rowLimit = screenTopRow + rowIndex + 1;\n if (row === rowLimit && row < topRow) {\n return true;\n }\n\n return false;\n}\n\nfunction cloneGraphic(graphic: Graphic) {\n const newGraphic = graphic.clone();\n (newGraphic as any).role = (graphic as any).role;\n (newGraphic as any).col = (graphic as any).col;\n (newGraphic as any).row = (graphic as any).row;\n (newGraphic as any).mergeStartCol = (graphic as any).mergeStartCol;\n (newGraphic as any).mergeStartRow = (graphic as any).mergeStartRow;\n (newGraphic as any).mergeEndCol = (graphic as any).mergeEndCol;\n (newGraphic as any).mergeEndRow = (graphic as any).mergeEndRow;\n (newGraphic as any).contentWidth = (graphic as any).contentWidth;\n (newGraphic as any).contentHeight = (graphic as any).contentHeight;\n\n if ((newGraphic as any).role === 'cell') {\n // hack for vrender not support shadow group pick\n const hackRect = createRect({\n x: 0,\n y: 0,\n width: newGraphic.attribute.width,\n height: newGraphic.attribute.height\n });\n newGraphic.add(hackRect);\n }\n\n if (graphic.type === 'group') {\n const newGroup = newGraphic as Group;\n graphic.forEachChildren(child => {\n const newChild = cloneGraphic(child as any);\n newGroup.add(newChild);\n });\n }\n return newGraphic;\n}\n\nfunction prepareShadowRoot(table: ListTable) {\n const colHeaderGroup = table.scenegraph.colHeaderGroup;\n const cornerHeaderGroup = table.scenegraph.cornerHeaderGroup;\n if (!colHeaderGroup.border) {\n const hackBorder = createRect({\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n cursor: 'pointer'\n });\n colHeaderGroup.add(hackBorder);\n colHeaderGroup.border = hackBorder;\n (hackBorder as any).attachShadow(hackBorder.shadowRoot);\n hackBorder.name = 'border-rect';\n\n hackBorder.addEventListener('click', (e: any) => {\n const titleRows = table.listTreeStickCellPlugin.titleRows;\n const { shadowTarget } = e.pickParams;\n const cellGroup = getTargetCell(shadowTarget);\n const { col, row } = cellGroup;\n const rowIndex = titleRows.indexOf(row);\n // table.scrollToCell({ col, row: row - rowIndex });\n scrollToRow(row - rowIndex, table);\n });\n }\n\n if (!cornerHeaderGroup.border) {\n const hackBorder = createRect({\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n cursor: 'pointer'\n });\n cornerHeaderGroup.add(hackBorder);\n cornerHeaderGroup.border = hackBorder;\n (hackBorder as any).attachShadow(hackBorder.shadowRoot);\n hackBorder.name = 'border-rect';\n\n hackBorder.addEventListener('click', (e: any) => {\n const titleRows = table.listTreeStickCellPlugin.titleRows;\n const { shadowTarget } = e.pickParams;\n const cellGroup = getTargetCell(shadowTarget);\n const { col, row } = cellGroup;\n const rowIndex = titleRows.indexOf(row);\n // table.scrollToCell({ col, row: row - rowIndex });\n scrollToRow(row - rowIndex, table);\n });\n }\n\n const shadowGroup = colHeaderGroup.border.shadowRoot;\n const shadowGroupFrozen = cornerHeaderGroup.border.shadowRoot;\n shadowGroup.removeAllChild();\n shadowGroupFrozen.removeAllChild();\n\n return { shadowGroup, shadowGroupFrozen };\n}\n\nfunction scrollToRow(row: number, table: ListTable) {\n const drawRange = table.getDrawRange();\n\n if (isValid(row) && row >= table.frozenRowCount) {\n const frozenHeight = table.getFrozenRowsHeight();\n const top = table.getRowsHeight(0, row - 1);\n table.scrollTop = Math.min(top - frozenHeight, table.getAllRowsHeight() - drawRange.height) - 1;\n }\n table.scenegraph.updateNextFrame();\n}\n\nexport const registerListTreeStickCellPlugin = () => {\n Factory.registerComponent('listTreeStickCellPlugin', ListTreeStickCellPlugin);\n};\n\nexport type IListTreeStickCellPlugin = typeof ListTreeStickCellPlugin;\n"]}
1
+ {"version":3,"sources":["../src/plugins/list-tree-stick-cell.ts"],"names":[],"mappings":";;;AAAA,6CAAoD;AAEpD,uDAAoD;AACpD,yEAAqE;AAErE,0CAA0C;AAC1C,6CAA0C;AAC1C,wCAA8C;AAM9C,MAAa,uBAAuB;IAQlC,YAAY,KAAgB;QAN5B,cAAS,GAAa,EAAE,CAAC;QACzB,oBAAe,GAAa,EAAE,CAAC;QAC/B,WAAM,GAAW,CAAC,CAAC,CAAC;QACpB,iBAAY,GAAW,CAAC,CAAC,CAAC;QAC1B,eAAU,GAAW,CAAC,CAAC,CAAC;QAGtB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QAEnB,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE;YAC1B,IAAI,CAAC,CAAC,eAAe,KAAK,UAAU,EAAE;gBACpC,OAAO;aACR;YACD,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC1B,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,eAAe,EAAE,CAAC,CAAC,EAAE;YACjC,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC1B,CAAC,CAAC,CAAC;IACL,CAAC;IAED,gBAAgB;QAEd,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,KAAK,CAAC,EAAE;YAE9B,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;YACpB,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;SAC3B;aAAM,IACL,IAAI,CAAC,YAAY,KAAK,CAAC,CAAC;YACxB,IAAI,CAAC,UAAU,KAAK,CAAC,CAAC;YACtB,IAAI,CAAC,YAAY,KAAK,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAA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;AAEM,MAAM,+BAA+B,GAAG,GAAG,EAAE;IAClD,iBAAO,CAAC,iBAAiB,CAAC,yBAAyB,EAAE,uBAAuB,CAAC,CAAC;AAChF,CAAC,CAAC;AAFW,QAAA,+BAA+B,mCAE1C","file":"list-tree-stick-cell.js","sourcesContent":["import { isArray, isValid } from '@visactor/vutils';\nimport type { ListTable } from '../ListTable';\nimport { Group } from '../scenegraph/graphic/group';\nimport { updateCell } from '../scenegraph/group-creater/cell-helper';\nimport type { Graphic } from './../vrender';\nimport { createRect } from './../vrender';\nimport { Factory } from '../core/factory';\nimport { getTargetCell } from '../event/util';\n\nexport interface IListTreeStickCellPlugin {\n new (table: ListTable): ListTreeStickCellPlugin;\n}\n\nexport class ListTreeStickCellPlugin {\n table: ListTable;\n titleRows: number[] = [];\n showedTitleRows: number[] = [];\n rowNow: number = -1;\n skipStartRow: number = -1;\n skipEndRow: number = -1;\n\n constructor(table: ListTable) {\n this.table = table;\n\n this.table.on('scroll', e => {\n if (e.scrollDirection !== 'vertical') {\n return;\n }\n this.updateGroupTitle();\n });\n\n this.table.on('resize_column', e => {\n this.updateGroupTitle();\n });\n }\n\n updateGroupTitle() {\n // this.updateGroupTitleInfo();\n if (this.table.scrollTop === 0) {\n // do nothing\n this.titleRows = [];\n this.showedTitleRows = [];\n } else if (\n this.skipStartRow !== -1 &&\n this.skipEndRow !== -1 &&\n this.skipStartRow !== this.table.scenegraph.proxy.bodyTopRow - 1\n ) {\n if (\n this.table.scenegraph.proxy.screenTopRow <= this.skipStartRow ||\n this.table.scenegraph.proxy.screenTopRow >= this.skipEndRow\n ) {\n this.skipStartRow = -1;\n this.skipEndRow = -1;\n this.updateGroupTitleInfo();\n } else {\n // const row = this.table.scenegraph.proxy.screenTopRow + titleRows.length;\n // nowRow = row;\n // renderLast = true;\n // do nothing\n }\n } else {\n this.skipStartRow = -1;\n this.skipEndRow = -1;\n this.updateGroupTitleInfo();\n }\n\n this.updateScenegraph();\n }\n\n updateGroupTitleInfo() {\n this.rowNow = this.table.scenegraph.proxy.screenTopRow + this.titleRows.length;\n const recordIndex = this.table.getRecordIndexByCell(0, this.rowNow); // [0, 0, 6]/0\n const nextRecordIndex = this.table.getRecordIndexByCell(0, this.rowNow + 1);\n this.getTitleRowsByRecordIndex(recordIndex, nextRecordIndex);\n }\n\n getTitleRowsByRecordIndex(recordIndex: number | number[], nextRecordIndex: number | number[]) {\n const titleRecords = [];\n if (!isArray(recordIndex)) {\n recordIndex = [recordIndex];\n }\n if (!isArray(nextRecordIndex)) {\n nextRecordIndex = [nextRecordIndex];\n }\n\n for (let i = 0; i < recordIndex.length; i++) {\n const index = recordIndex.slice(0, i + 1);\n const record = this.table.dataSource.getRaw(index as unknown as number);\n titleRecords.push(record);\n }\n\n const titleRows = [];\n // const isTitle = !(recordIndex.length === (this.table.options.groupBy as any).length + 1);\n const isTitle = nextRecordIndex.length === recordIndex.length + 1;\n let titleIndex = recordIndex.slice(0, !isTitle ? recordIndex.length - 1 : recordIndex.length);\n const currentIndexedData = this.table.dataSource.currentIndexedData;\n const startIndex = this.rowNow - this.table.columnHeaderLevelCount;\n\n for (let i = startIndex; i >= 0; i--) {\n const currentIndex = currentIndexedData[i];\n if (isArray(currentIndex) && titleIndex.length === currentIndex.length) {\n let isMatch = true;\n for (let j = 0; j < currentIndex.length; j++) {\n if (currentIndex[j] !== titleIndex[j]) {\n isMatch = false;\n break;\n }\n }\n if (isMatch) {\n titleRows.push(i + this.table.columnHeaderLevelCount);\n titleIndex = titleIndex.slice(0, titleIndex.length - 1);\n }\n } else if (currentIndex === recordIndex[0]) {\n titleRows.push(i + this.table.columnHeaderLevelCount);\n break;\n }\n }\n\n this.titleRows = titleRows.reverse();\n }\n\n updateScenegraph() {\n const { table } = this;\n const { shadowGroup, shadowGroupFrozen } = prepareShadowRoot(table);\n\n this.showedTitleRows.length = 0;\n let skip = 0;\n for (let col = 0; col < table.colCount; col++) {\n let colGroup;\n if (col < table.frozenColCount) {\n colGroup = new Group({\n x: table.getColsWidth(0, col - 1),\n y: table.getFrozenRowsHeight()\n });\n shadowGroupFrozen.add(colGroup);\n } else {\n colGroup = new Group({\n x: table.getColsWidth(table.frozenColCount, col - 1),\n y: table.getFrozenRowsHeight()\n });\n shadowGroup.add(colGroup);\n }\n colGroup.col = col;\n for (let i = 0; i < this.titleRows.length; i++) {\n const row = this.titleRows[i];\n if (isSkipRow(row, this.rowNow, table.scenegraph.proxy.screenTopRow, this.titleRows)) {\n // skipOne = true;\n col === 0 && skip++;\n continue;\n }\n if (col === 0) {\n this.showedTitleRows.push(row);\n }\n const cell = table.scenegraph.getCell(col, row);\n if (cell.role === 'cell') {\n const newCell = cloneGraphic(cell);\n newCell.setAttributes({\n y: i * 40\n });\n colGroup.add(newCell);\n } else {\n // create a fake cellGroup for title\n const newCell = updateCell(col, row, table, true, true);\n newCell.setAttributes({\n y: i * 40\n });\n colGroup.add(newCell);\n }\n }\n }\n\n if (skip > 0 && this.skipStartRow === -1 && this.skipEndRow === -1) {\n this.skipStartRow = table.scenegraph.proxy.screenTopRow - 1;\n this.skipEndRow = table.scenegraph.proxy.screenTopRow + 1;\n }\n }\n}\n\nfunction isSkipRow(row: number, topRow: number, screenTopRow: number, titleRows: number[]) {\n if (row === topRow && row !== screenTopRow + titleRows.length - 1) {\n return true;\n }\n\n const rowIndex = titleRows.indexOf(row);\n const rowLimit = screenTopRow + rowIndex + 1;\n if (row === rowLimit && row < topRow) {\n return true;\n }\n\n return false;\n}\n\nfunction cloneGraphic(graphic: Graphic) {\n const newGraphic = graphic.clone();\n (newGraphic as any).role = (graphic as any).role;\n (newGraphic as any).col = (graphic as any).col;\n (newGraphic as any).row = (graphic as any).row;\n (newGraphic as any).mergeStartCol = (graphic as any).mergeStartCol;\n (newGraphic as any).mergeStartRow = (graphic as any).mergeStartRow;\n (newGraphic as any).mergeEndCol = (graphic as any).mergeEndCol;\n (newGraphic as any).mergeEndRow = (graphic as any).mergeEndRow;\n (newGraphic as any).contentWidth = (graphic as any).contentWidth;\n (newGraphic as any).contentHeight = (graphic as any).contentHeight;\n\n if ((newGraphic as any).role === 'cell') {\n // hack for vrender not support shadow group pick\n const hackRect = createRect({\n x: 0,\n y: 0,\n width: newGraphic.attribute.width,\n height: newGraphic.attribute.height\n });\n newGraphic.add(hackRect);\n }\n\n if (graphic.type === 'group') {\n const newGroup = newGraphic as Group;\n graphic.forEachChildren(child => {\n const newChild = cloneGraphic(child as any);\n newGroup.add(newChild);\n });\n }\n return newGraphic;\n}\n\nfunction prepareShadowRoot(table: ListTable) {\n const colHeaderGroup = table.scenegraph.colHeaderGroup;\n const cornerHeaderGroup = table.scenegraph.cornerHeaderGroup;\n if (!colHeaderGroup.border) {\n const hackBorder = createRect({\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n cursor: 'pointer'\n });\n colHeaderGroup.add(hackBorder);\n colHeaderGroup.border = hackBorder;\n (hackBorder as any).attachShadow(hackBorder.shadowRoot);\n hackBorder.name = 'border-rect';\n\n hackBorder.addEventListener('click', (e: any) => {\n const titleRows = table.listTreeStickCellPlugin.titleRows;\n const { shadowTarget } = e.pickParams;\n const cellGroup = getTargetCell(shadowTarget);\n const { col, row } = cellGroup;\n const rowIndex = titleRows.indexOf(row);\n // table.scrollToCell({ col, row: row - rowIndex });\n scrollToRow(row - rowIndex, table);\n });\n }\n\n if (!cornerHeaderGroup.border) {\n const hackBorder = createRect({\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n cursor: 'pointer'\n });\n cornerHeaderGroup.add(hackBorder);\n cornerHeaderGroup.border = hackBorder;\n (hackBorder as any).attachShadow(hackBorder.shadowRoot);\n hackBorder.name = 'border-rect';\n\n hackBorder.addEventListener('click', (e: any) => {\n const titleRows = table.listTreeStickCellPlugin.titleRows;\n const { shadowTarget } = e.pickParams;\n const cellGroup = getTargetCell(shadowTarget);\n const { col, row } = cellGroup;\n const rowIndex = titleRows.indexOf(row);\n // table.scrollToCell({ col, row: row - rowIndex });\n scrollToRow(row - rowIndex, table);\n });\n }\n\n const shadowGroup = colHeaderGroup.border.shadowRoot;\n const shadowGroupFrozen = cornerHeaderGroup.border.shadowRoot;\n shadowGroup.removeAllChild();\n shadowGroupFrozen.removeAllChild();\n\n return { shadowGroup, shadowGroupFrozen };\n}\n\nfunction scrollToRow(row: number, table: ListTable) {\n const drawRange = table.getDrawRange();\n\n if (isValid(row) && row >= table.frozenRowCount) {\n const frozenHeight = table.getFrozenRowsHeight();\n const top = table.getRowsHeight(0, row - 1);\n table.scrollTop = Math.min(top - frozenHeight, table.getAllRowsHeight() - drawRange.height) - 1;\n }\n table.scenegraph.updateNextFrame();\n}\n\nexport const registerListTreeStickCellPlugin = () => {\n Factory.registerComponent('listTreeStickCellPlugin', ListTreeStickCellPlugin);\n};\n\n// export type IListTreeStickCellPlugin = typeof ListTreeStickCellPlugin;\n"]}
@@ -36,12 +36,12 @@ import type { NumberRangeMap } from '../layout/row-height-map';
36
36
  import type { RowSeriesNumberHelper } from '../core/row-series-number-helper';
37
37
  import type { ReactCustomLayout } from '../components/react/react-custom-layout';
38
38
  import type { ISortedMapItem } from '../data/DataSource';
39
- import type { IAnimationAppear } from './animation/appear';
39
+ import type { IAnimationAppear, ITableAnimationOption } from './animation/appear';
40
40
  import type { IEmptyTip } from './component/empty-tip';
41
41
  import type { EmptyTip } from '../components/empty-tip/empty-tip';
42
- import type { CustomCellStylePlugin } from '../plugins/custom-cell-style';
43
42
  import type { EditManeger } from '../edit/edit-manager';
44
- import type { ITableAnimationOption, TableAnimationManager } from '../core/animation';
43
+ import type { TableAnimationManager } from '../core/animation';
44
+ import type { CustomCellStylePlugin } from '../plugins/custom-cell-style';
45
45
  export interface IBaseTableProtected {
46
46
  element: HTMLElement;
47
47
  handler: EventHandler;
@@ -550,7 +550,7 @@ export interface BaseTableAPI {
550
550
  hideMoverLine: (col: number, row: number) => void;
551
551
  disableScroll: () => void;
552
552
  enableScroll: () => void;
553
- customCellStylePlugin: CustomCellStylePlugin;
553
+ customCellStylePlugin?: CustomCellStylePlugin;
554
554
  headerStyleCache: Map<string, any>;
555
555
  bodyBottomStyleCache: Map<string, any>;
556
556
  bodyStyleCache: Map<string, any>;