@visactor/vtable 1.22.11-alpha.9 → 1.22.11

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 (103) hide show
  1. package/cjs/ListTable.d.ts +7 -34
  2. package/cjs/ListTable.js +18 -138
  3. package/cjs/ListTable.js.map +1 -1
  4. package/cjs/PivotTable-all.js.map +1 -1
  5. package/cjs/components/index.js +1 -1
  6. package/cjs/core/BaseTable.d.ts +3 -0
  7. package/cjs/core/BaseTable.js +22 -6
  8. package/cjs/core/BaseTable.js.map +1 -1
  9. package/cjs/core/TABLE_EVENT_TYPE.d.ts +0 -1
  10. package/cjs/core/TABLE_EVENT_TYPE.js +0 -1
  11. package/cjs/core/TABLE_EVENT_TYPE.js.map +1 -1
  12. package/cjs/core/record-helper.d.ts +2 -4
  13. package/cjs/core/record-helper.js +47 -120
  14. package/cjs/core/record-helper.js.map +1 -1
  15. package/cjs/data/DataSource.d.ts +4 -13
  16. package/cjs/data/DataSource.js +60 -174
  17. package/cjs/data/DataSource.js.map +1 -1
  18. package/cjs/dataset/dataset.js +92 -84
  19. package/cjs/dataset/dataset.js.map +1 -1
  20. package/cjs/edit/edit-manager.js +10 -9
  21. package/cjs/edit/edit-manager.js.map +1 -1
  22. package/cjs/event/event.d.ts +1 -2
  23. package/cjs/event/event.js +9 -20
  24. package/cjs/event/event.js.map +1 -1
  25. package/cjs/index.d.ts +1 -1
  26. package/cjs/index.js +1 -1
  27. package/cjs/index.js.map +1 -1
  28. package/cjs/layout/pivot-header-layout.js +1 -1
  29. package/cjs/layout/pivot-header-layout.js.map +1 -1
  30. package/cjs/plugins/custom-cell-style.d.ts +5 -5
  31. package/cjs/plugins/custom-cell-style.js +64 -25
  32. package/cjs/plugins/custom-cell-style.js.map +1 -1
  33. package/cjs/scenegraph/group-creater/cell-type/progress-bar-cell.js.map +1 -1
  34. package/cjs/scenegraph/layout/update-row.js +16 -1
  35. package/cjs/scenegraph/layout/update-row.js.map +1 -1
  36. package/cjs/scenegraph/select/update-select-border.js.map +1 -1
  37. package/cjs/state/select/update-position.js +3 -3
  38. package/cjs/state/select/update-position.js.map +1 -1
  39. package/cjs/ts-types/base-table.d.ts +5 -2
  40. package/cjs/ts-types/base-table.js.map +1 -1
  41. package/cjs/ts-types/events.d.ts +0 -15
  42. package/cjs/ts-types/events.js.map +1 -1
  43. package/cjs/ts-types/new-data-set.d.ts +1 -0
  44. package/cjs/ts-types/new-data-set.js.map +1 -1
  45. package/cjs/ts-types/table-engine.d.ts +6 -33
  46. package/cjs/ts-types/table-engine.js.map +1 -1
  47. package/cjs/vrender.js.map +1 -1
  48. package/dist/vtable.js +332 -735
  49. package/dist/vtable.min.js +2 -2
  50. package/es/ListTable.d.ts +7 -34
  51. package/es/ListTable.js +18 -134
  52. package/es/ListTable.js.map +1 -1
  53. package/es/PivotTable-all.js.map +1 -1
  54. package/es/components/index.js +1 -1
  55. package/es/core/BaseTable.d.ts +3 -0
  56. package/es/core/BaseTable.js +22 -6
  57. package/es/core/BaseTable.js.map +1 -1
  58. package/es/core/TABLE_EVENT_TYPE.d.ts +0 -1
  59. package/es/core/TABLE_EVENT_TYPE.js +0 -1
  60. package/es/core/TABLE_EVENT_TYPE.js.map +1 -1
  61. package/es/core/record-helper.d.ts +2 -4
  62. package/es/core/record-helper.js +43 -114
  63. package/es/core/record-helper.js.map +1 -1
  64. package/es/data/DataSource.d.ts +4 -13
  65. package/es/data/DataSource.js +60 -174
  66. package/es/data/DataSource.js.map +1 -1
  67. package/es/dataset/dataset.js +92 -84
  68. package/es/dataset/dataset.js.map +1 -1
  69. package/es/edit/edit-manager.js +10 -9
  70. package/es/edit/edit-manager.js.map +1 -1
  71. package/es/event/event.d.ts +1 -2
  72. package/es/event/event.js +9 -20
  73. package/es/event/event.js.map +1 -1
  74. package/es/index.d.ts +1 -1
  75. package/es/index.js +1 -1
  76. package/es/index.js.map +1 -1
  77. package/es/layout/pivot-header-layout.js +1 -1
  78. package/es/layout/pivot-header-layout.js.map +1 -1
  79. package/es/plugins/custom-cell-style.d.ts +5 -5
  80. package/es/plugins/custom-cell-style.js +62 -25
  81. package/es/plugins/custom-cell-style.js.map +1 -1
  82. package/es/scenegraph/group-creater/cell-type/progress-bar-cell.js.map +1 -1
  83. package/es/scenegraph/layout/update-row.js +16 -1
  84. package/es/scenegraph/layout/update-row.js.map +1 -1
  85. package/es/scenegraph/select/update-select-border.js.map +1 -1
  86. package/es/state/select/update-position.js +4 -2
  87. package/es/state/select/update-position.js.map +1 -1
  88. package/es/ts-types/base-table.d.ts +5 -2
  89. package/es/ts-types/base-table.js.map +1 -1
  90. package/es/ts-types/events.d.ts +0 -15
  91. package/es/ts-types/events.js.map +1 -1
  92. package/es/ts-types/new-data-set.d.ts +1 -0
  93. package/es/ts-types/new-data-set.js.map +1 -1
  94. package/es/ts-types/table-engine.d.ts +6 -33
  95. package/es/ts-types/table-engine.js.map +1 -1
  96. package/es/vrender.js.map +1 -1
  97. package/package.json +3 -3
  98. package/cjs/core/index.d.ts +0 -1
  99. package/cjs/core/index.js +0 -30
  100. package/cjs/core/index.js.map +0 -1
  101. package/es/core/index.d.ts +0 -1
  102. package/es/core/index.js +0 -2
  103. package/es/core/index.js.map +0 -1
@@ -9,12 +9,12 @@ export declare class CustomCellStylePlugin {
9
9
  table: BaseTableAPI;
10
10
  customCellStyle: CustomCellStyle[];
11
11
  customCellStyleArrangement: CustomCellStyleArrangement[];
12
+ private _customCellStyleArrangementIndex;
13
+ private _customCellStyleArrangementTombstoneCount;
12
14
  constructor(table: BaseTableAPI, customCellStyle: CustomCellStyle[], customCellStyleArrangement: CustomCellStyleArrangement[]);
13
- clearCustomCellStyleArrangement(): void;
14
- addCustomCellStyleArrangement(cellPosition: {
15
- col: number;
16
- row: number;
17
- }, customStyleId: string | undefined | null): void;
15
+ private _getCustomCellStyleArrangementKey;
16
+ private _rebuildCustomCellStyleArrangementIndex;
17
+ private _compactCustomCellStyleArrangementIfNeeded;
18
18
  getCustomCellStyle(col: number, row: number): any;
19
19
  getCustomCellStyleIds(col: number, row: number): string[];
20
20
  getCustomCellStyleOption(customStyleId: string): CustomCellStyle;
@@ -8,22 +8,41 @@ const vutils_1 = require("@visactor/vutils"), ts_types_1 = require("../ts-types"
8
8
 
9
9
  class CustomCellStylePlugin {
10
10
  constructor(table, customCellStyle, customCellStyleArrangement) {
11
- this.table = table, this.customCellStyle = customCellStyle, this.customCellStyleArrangement = customCellStyleArrangement;
11
+ this.table = table, this.customCellStyle = customCellStyle, this.customCellStyleArrangement = customCellStyleArrangement,
12
+ this._customCellStyleArrangementIndex = new Map, this._customCellStyleArrangementTombstoneCount = 0,
13
+ this._rebuildCustomCellStyleArrangementIndex();
12
14
  }
13
- clearCustomCellStyleArrangement() {
14
- this.customCellStyleArrangement = [];
15
+ _getCustomCellStyleArrangementKey(cellPos) {
16
+ if (cellPos.range) {
17
+ const {start: start, end: end} = cellPos.range;
18
+ return `range:${start.col},${start.row},${end.col},${end.row}`;
19
+ }
20
+ if (void 0 !== cellPos.col && void 0 !== cellPos.row) return `cell:${cellPos.col},${cellPos.row}`;
21
+ }
22
+ _rebuildCustomCellStyleArrangementIndex() {
23
+ this._customCellStyleArrangementIndex.clear(), this._customCellStyleArrangementTombstoneCount = 0;
24
+ for (let i = 0; i < this.customCellStyleArrangement.length; i++) {
25
+ if (!(0, vutils_1.isValid)(this.customCellStyleArrangement[i].customStyleId)) {
26
+ this._customCellStyleArrangementTombstoneCount++;
27
+ continue;
28
+ }
29
+ const key = this._getCustomCellStyleArrangementKey(this.customCellStyleArrangement[i].cellPosition);
30
+ key && this._customCellStyleArrangementIndex.set(key, i);
31
+ }
15
32
  }
16
- addCustomCellStyleArrangement(cellPosition, customStyleId) {
17
- this.customCellStyleArrangement.push({
18
- cellPosition: cellPosition,
19
- customStyleId: customStyleId
20
- });
33
+ _compactCustomCellStyleArrangementIfNeeded() {
34
+ const length = this.customCellStyleArrangement.length;
35
+ if (this._customCellStyleArrangementTombstoneCount < 2048) return;
36
+ if (4 * this._customCellStyleArrangementTombstoneCount < length) return;
37
+ const compacted = this.customCellStyleArrangement.filter((style => (0, vutils_1.isValid)(style.customStyleId)));
38
+ compacted.length !== this.customCellStyleArrangement.length ? (this.customCellStyleArrangement.length = 0,
39
+ this.customCellStyleArrangement.push(...compacted), this._rebuildCustomCellStyleArrangementIndex()) : this._customCellStyleArrangementTombstoneCount = 0;
21
40
  }
22
41
  getCustomCellStyle(col, row) {
23
42
  const customStyleIds = this.getCustomCellStyleIds(col, row);
24
43
  if (customStyleIds.length) {
25
44
  const styles = [];
26
- return customStyleIds.forEach((customStyleId => {
45
+ if (customStyleIds.forEach((customStyleId => {
27
46
  const styleOption = this.getCustomCellStyleOption(customStyleId);
28
47
  if ((0, vutils_1.isFunction)(null == styleOption ? void 0 : styleOption.style)) {
29
48
  const style = styleOption.style({
@@ -36,13 +55,14 @@ class CustomCellStylePlugin {
36
55
  });
37
56
  styles.push(style);
38
57
  } else (null == styleOption ? void 0 : styleOption.style) && styles.push(styleOption.style);
39
- })), (0, vutils_1.merge)({}, ...styles);
58
+ })), !styles.length) return;
59
+ return (0, vutils_1.merge)({}, ...styles);
40
60
  }
41
61
  }
42
62
  getCustomCellStyleIds(col, row) {
43
63
  const customStyleIds = [], range = this.table.getCellRange(col, row);
44
64
  for (let c = range.start.col; c <= range.end.col; c++) for (let r = range.start.row; r <= range.end.row; r++) this.customCellStyleArrangement.forEach((style => {
45
- style.cellPosition.range ? style.cellPosition.range.start.col <= c && style.cellPosition.range.end.col >= c && style.cellPosition.range.start.row <= r && style.cellPosition.range.end.row >= r && customStyleIds.push(style.customStyleId) : style.cellPosition.col === c && style.cellPosition.row === r && customStyleIds.push(style.customStyleId);
65
+ (0, vutils_1.isValid)(style.customStyleId) && (style.cellPosition.range ? style.cellPosition.range.start.col <= c && style.cellPosition.range.end.col >= c && style.cellPosition.range.start.row <= r && style.cellPosition.range.end.row >= r && customStyleIds.push(style.customStyleId) : style.cellPosition.col === c && style.cellPosition.row === r && customStyleIds.push(style.customStyleId));
46
66
  }));
47
67
  return customStyleIds;
48
68
  }
@@ -63,21 +83,39 @@ class CustomCellStylePlugin {
63
83
  })), this.table.scenegraph.updateNextFrame();
64
84
  }
65
85
  arrangeCustomCellStyle(cellPos, customStyleId, forceFastUpdate) {
66
- var _a;
67
- const index = this.customCellStyleArrangement.findIndex((style => style.cellPosition.range && cellPos.range ? style.cellPosition.range.start.col === cellPos.range.start.col && style.cellPosition.range.start.row === cellPos.range.start.row && style.cellPosition.range.end.col === cellPos.range.end.col && style.cellPosition.range.end.row === cellPos.range.end.row : style.cellPosition.col === cellPos.col && style.cellPosition.row === cellPos.row));
68
- if (-1 === index && !customStyleId) return;
69
- if (-1 === index && customStyleId) this.customCellStyleArrangement.push({
70
- cellPosition: {
71
- col: cellPos.col,
72
- row: cellPos.row,
73
- range: cellPos.range
74
- },
75
- customStyleId: customStyleId
76
- }); else {
86
+ var _a, _b;
87
+ const inputKey = this._getCustomCellStyleArrangementKey(cellPos);
88
+ let index = inputKey && null !== (_a = this._customCellStyleArrangementIndex.get(inputKey)) && void 0 !== _a ? _a : -1;
89
+ if (inputKey && -1 !== index) {
90
+ const item = this.customCellStyleArrangement[index], itemKey = item ? this._getCustomCellStyleArrangementKey(item.cellPosition) : void 0;
91
+ item && (0, vutils_1.isValid)(item.customStyleId) && itemKey === inputKey || (index = this.customCellStyleArrangement.findIndex((style => !!(0,
92
+ vutils_1.isValid)(style.customStyleId) && this._getCustomCellStyleArrangementKey(style.cellPosition) === inputKey)),
93
+ -1 !== index ? this._customCellStyleArrangementIndex.set(inputKey, index) : this._customCellStyleArrangementIndex.delete(inputKey));
94
+ }
95
+ if (-1 !== index || inputKey || (index = this.customCellStyleArrangement.findIndex((style => !!(0,
96
+ vutils_1.isValid)(style.customStyleId) && (style.cellPosition.range && cellPos.range ? style.cellPosition.range.start.col === cellPos.range.start.col && style.cellPosition.range.start.row === cellPos.range.start.row && style.cellPosition.range.end.col === cellPos.range.end.col && style.cellPosition.range.end.row === cellPos.range.end.row : style.cellPosition.col === cellPos.col && style.cellPosition.row === cellPos.row)))),
97
+ -1 === index && !customStyleId) return;
98
+ if (-1 === index && customStyleId) {
99
+ this.customCellStyleArrangement.push({
100
+ cellPosition: {
101
+ col: cellPos.col,
102
+ row: cellPos.row,
103
+ range: cellPos.range
104
+ },
105
+ customStyleId: customStyleId
106
+ });
107
+ const pushedIndex = this.customCellStyleArrangement.length - 1, pushedKey = this._getCustomCellStyleArrangementKey(this.customCellStyleArrangement[pushedIndex].cellPosition);
108
+ pushedKey && this._customCellStyleArrangementIndex.set(pushedKey, pushedIndex);
109
+ } else {
77
110
  if (this.customCellStyleArrangement[index].customStyleId === customStyleId) return;
78
- customStyleId ? this.customCellStyleArrangement[index].customStyleId = customStyleId : this.customCellStyleArrangement.splice(index, 1);
111
+ if (customStyleId) this.customCellStyleArrangement[index].customStyleId = customStyleId; else {
112
+ const existedKey = this._getCustomCellStyleArrangementKey(this.customCellStyleArrangement[index].cellPosition);
113
+ (0, vutils_1.isValid)(this.customCellStyleArrangement[index].customStyleId) && this._customCellStyleArrangementTombstoneCount++,
114
+ this.customCellStyleArrangement[index].customStyleId = null, existedKey && this._customCellStyleArrangementIndex.delete(existedKey),
115
+ this._compactCustomCellStyleArrangementIfNeeded();
116
+ }
79
117
  }
80
- const style = null === (_a = this.getCustomCellStyleOption(customStyleId)) || void 0 === _a ? void 0 : _a.style;
118
+ const style = customStyleId ? null === (_b = this.getCustomCellStyleOption(customStyleId)) || void 0 === _b ? void 0 : _b.style : void 0;
81
119
  if (style) {
82
120
  forceFastUpdate = !0;
83
121
  for (const key in style) if (-1 === ts_types_1.cellStyleKeys.indexOf(key)) {
@@ -92,7 +130,8 @@ class CustomCellStylePlugin {
92
130
  this.table.scenegraph.updateNextFrame();
93
131
  }
94
132
  updateCustomCell(customCellStyle, customCellStyleArrangement) {
95
- this.customCellStyle.length = 0, this.customCellStyleArrangement.length = 0, customCellStyle.forEach((cellStyle => {
133
+ this.customCellStyle.length = 0, this.customCellStyleArrangement.length = 0, this._customCellStyleArrangementIndex.clear(),
134
+ this._customCellStyleArrangementTombstoneCount = 0, customCellStyle.forEach((cellStyle => {
96
135
  this.registerCustomCellStyle(cellStyle.id, cellStyle.style);
97
136
  })), customCellStyleArrangement.forEach((cellStyle => {
98
137
  this.arrangeCustomCellStyle(cellStyle.cellPosition, cellStyle.customStyleId);
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugins/custom-cell-style.ts"],"names":[],"mappings":";;;AAAA,6CAA8D;AAE9D,0CAMqB;AAErB,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,+BAA+B;QAC7B,IAAI,CAAC,0BAA0B,GAAG,EAAE,CAAC;IACvC,CAAC;IAED,6BAA6B,CAC3B,YAGC,EACD,aAAwC;QAExC,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAAC;YACnC,YAAY;YACZ,aAAa;SACd,CAAC,CAAC;IACL,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,IAAA,mBAAU,EAAC,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,KAAK,CAAC,EAAE;oBAClC,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAA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IAAI,eAAe,EAAE;QACjC,MAAM,KAAK,GAAI,eAAuB,CAAC,GAAG,CAAC,CAAC;QAC5C,IAAI,IAAA,gBAAO,EAAC,KAAK,CAAC,EAAE;YACjB,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 { isFunction, isValid, merge } from '@visactor/vutils';\nimport type { BaseTableAPI } from '../ts-types/base-table';\nimport {\n cellStyleKeys,\n type CellRange,\n type ColumnStyleOption,\n type CustomCellStyle,\n type CustomCellStyleArrangement\n} from '../ts-types';\nimport type { Style } from '../body-helper/style';\nimport { Factory } from '../core/factory';\nimport type { StylePropertyFunctionArg } from '../ts-types/style-define';\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 clearCustomCellStyleArrangement() {\n this.customCellStyleArrangement = [];\n }\n\n addCustomCellStyleArrangement(\n cellPosition: {\n col: number;\n row: number;\n },\n customStyleId: string | undefined | null\n ) {\n this.customCellStyleArrangement.push({\n cellPosition,\n customStyleId\n });\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 (isFunction(styleOption?.style)) {\n const style = styleOption.style({\n col,\n row,\n table: this.table,\n value: this.table.getCellValue(col, row),\n dataValue: this.table.getCellOriginValue(col, row),\n cellHeaderPaths: this.table.getCellHeaderPaths(col, row)\n });\n styles.push(style);\n } else 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(\n customStyleId: string,\n customStyle: ColumnStyleOption | ((styleArg: StylePropertyFunctionArg) => ColumnStyleOption) | undefined | null\n ) {\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 forceFastUpdate?: boolean\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 const style = this.getCustomCellStyleOption(customStyleId)?.style;\n // let forceFastUpdate;\n if (style) {\n forceFastUpdate = true;\n for (const key in style) {\n if (cellStyleKeys.indexOf(key) === -1) {\n forceFastUpdate = false;\n break;\n }\n }\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, forceFastUpdate);\n }\n }\n // this.table.scenegraph.updateCellContent(col, row);\n }\n }\n } else {\n this.table.scenegraph.updateCellContent(cellPos.col, cellPos.row, forceFastUpdate);\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 (isValid(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
+ {"version":3,"sources":["../src/plugins/custom-cell-style.ts"],"names":[],"mappings":";;;AAAA,6CAA8D;AAE9D,0CAMqB;AAErB,6CAA0C;AAU1C,MAAa,qBAAqB;IAOhC,YACE,KAAmB,EACnB,eAAkC,EAClC,0BAAwD;QAExD,IAA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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 { isFunction, isValid, merge } from '@visactor/vutils';\nimport type { BaseTableAPI } from '../ts-types/base-table';\nimport {\n cellStyleKeys,\n type CellRange,\n type ColumnStyleOption,\n type CustomCellStyle,\n type CustomCellStyleArrangement\n} from '../ts-types';\nimport type { Style } from '../body-helper/style';\nimport { Factory } from '../core/factory';\nimport type { StylePropertyFunctionArg } from '../ts-types/style-define';\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 private _customCellStyleArrangementIndex: Map<string, number>;\n private _customCellStyleArrangementTombstoneCount: number;\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 this._customCellStyleArrangementIndex = new Map();\n this._customCellStyleArrangementTombstoneCount = 0;\n this._rebuildCustomCellStyleArrangementIndex();\n }\n\n private _getCustomCellStyleArrangementKey(cellPos: { col?: number; row?: number; range?: CellRange }) {\n if (cellPos.range) {\n const { start, end } = cellPos.range;\n return `range:${start.col},${start.row},${end.col},${end.row}`;\n }\n if (cellPos.col === undefined || cellPos.row === undefined) {\n return undefined;\n }\n return `cell:${cellPos.col},${cellPos.row}`;\n }\n\n private _rebuildCustomCellStyleArrangementIndex() {\n this._customCellStyleArrangementIndex.clear();\n this._customCellStyleArrangementTombstoneCount = 0;\n for (let i = 0; i < this.customCellStyleArrangement.length; i++) {\n if (!isValid((this.customCellStyleArrangement[i] as any).customStyleId)) {\n this._customCellStyleArrangementTombstoneCount++;\n continue;\n }\n const key = this._getCustomCellStyleArrangementKey(this.customCellStyleArrangement[i].cellPosition);\n if (key) {\n this._customCellStyleArrangementIndex.set(key, i);\n }\n }\n }\n\n private _compactCustomCellStyleArrangementIfNeeded() {\n const length = this.customCellStyleArrangement.length;\n if (this._customCellStyleArrangementTombstoneCount < 2048) {\n return;\n }\n if (this._customCellStyleArrangementTombstoneCount * 4 < length) {\n return;\n }\n const compacted = this.customCellStyleArrangement.filter(style => isValid((style as any).customStyleId));\n if (compacted.length === this.customCellStyleArrangement.length) {\n this._customCellStyleArrangementTombstoneCount = 0;\n return;\n }\n this.customCellStyleArrangement.length = 0;\n this.customCellStyleArrangement.push(...compacted);\n this._rebuildCustomCellStyleArrangementIndex();\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 (isFunction(styleOption?.style)) {\n const style = styleOption.style({\n col,\n row,\n table: this.table,\n value: this.table.getCellValue(col, row),\n dataValue: this.table.getCellOriginValue(col, row),\n cellHeaderPaths: this.table.getCellHeaderPaths(col, row)\n });\n styles.push(style);\n } else if (styleOption?.style) {\n styles.push(styleOption.style);\n }\n });\n\n if (!styles.length) {\n return undefined;\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 (!isValid(style.customStyleId)) {\n return;\n }\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 as string);\n }\n } else if (style.cellPosition.col === c && style.cellPosition.row === r) {\n // customStyleId = style.customStyleId;\n customStyleIds.push(style.customStyleId as string);\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(\n customStyleId: string,\n customStyle: ColumnStyleOption | ((styleArg: StylePropertyFunctionArg) => ColumnStyleOption) | undefined | null\n ) {\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 forceFastUpdate?: boolean\n ) {\n const inputKey = this._getCustomCellStyleArrangementKey(cellPos);\n let index = inputKey ? this._customCellStyleArrangementIndex.get(inputKey) ?? -1 : -1;\n if (inputKey && index !== -1) {\n const item = this.customCellStyleArrangement[index];\n const itemKey = item ? this._getCustomCellStyleArrangementKey(item.cellPosition) : undefined;\n if (!item || !isValid((item as any).customStyleId) || itemKey !== inputKey) {\n index = this.customCellStyleArrangement.findIndex(style => {\n if (!isValid((style as any).customStyleId)) {\n return false;\n }\n return this._getCustomCellStyleArrangementKey(style.cellPosition) === inputKey;\n });\n if (index !== -1) {\n this._customCellStyleArrangementIndex.set(inputKey, index);\n } else {\n this._customCellStyleArrangementIndex.delete(inputKey);\n }\n }\n }\n if (index === -1 && !inputKey) {\n index = this.customCellStyleArrangement.findIndex(style => {\n if (!isValid((style as any).customStyleId)) {\n return false;\n }\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\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 const pushedIndex = this.customCellStyleArrangement.length - 1;\n const pushedKey = this._getCustomCellStyleArrangementKey(\n this.customCellStyleArrangement[pushedIndex].cellPosition\n );\n if (pushedKey) {\n this._customCellStyleArrangementIndex.set(pushedKey, pushedIndex);\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 const existedKey = this._getCustomCellStyleArrangementKey(this.customCellStyleArrangement[index].cellPosition);\n if (isValid((this.customCellStyleArrangement[index] as any).customStyleId)) {\n this._customCellStyleArrangementTombstoneCount++;\n }\n (this.customCellStyleArrangement[index] as any).customStyleId = null;\n if (existedKey) {\n this._customCellStyleArrangementIndex.delete(existedKey);\n }\n this._compactCustomCellStyleArrangementIfNeeded();\n }\n\n const style = customStyleId ? this.getCustomCellStyleOption(customStyleId)?.style : undefined;\n // let forceFastUpdate;\n if (style) {\n forceFastUpdate = true;\n for (const key in style) {\n if (cellStyleKeys.indexOf(key) === -1) {\n forceFastUpdate = false;\n break;\n }\n }\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, forceFastUpdate);\n }\n }\n // this.table.scenegraph.updateCellContent(col, row);\n }\n }\n } else {\n this.table.scenegraph.updateCellContent(cellPos.col, cellPos.row, forceFastUpdate);\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 this._customCellStyleArrangementIndex.clear();\n this._customCellStyleArrangementTombstoneCount = 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 (isValid(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 +1 @@
1
- {"version":3,"sources":["../src/scenegraph/group-creater/cell-type/progress-bar-cell.ts"],"names":[],"mappings":";;;AAAA,gDAA4D;AAE5D,kDAAwD;AACxD,+CAA4C;AAC5C,mDAA+C;AAC/C,iDAAmD;AAEnD,6CAA4C;AAG5C,SAAgB,qBAAqB,CACnC,iBAKC,EACD,KAAuB,EACvB,KAAa,EAEb,KAAa,EACb,SAAiB,EACjB,GAAW,EACX,GAAW,EACX,OAAyC,EACzC,KAAmB,EACnB,KAAiB;;IAEjB,IAAI,iBAAiB,CAAC,WAAW,EAAE;QACjC,MAAM,WAAW,GAAG,IAAA,mBAAU,EAAC,iBAAiB,CAAC,WAAW,EAAE;YAC5D,GAAG;YACH,GAAG;YACH,KAAK;YACL,KAAK;YACL,SAAS;YACT,eAAe,EAAE,SAAS;SAC3B,CAAC,CAAC;QACH,SAAS,GAAG,MAAA,MAAC,KAAK,CAAC,mBAAmB,CAAC,GAAG,EAAE,GAAG,CAAS,0CAAG,WAAW,CAAC,mCAAI,SAAS,CAAC;KACtF;IAED,MAAM,OAAO,GACX,MAAA,IAAA,mBAAU,EAAC,iBAAiB,CAAC,OAAO,EAAE;QACpC,GAAG;QACH,GAAG;QACH,KAAK;QACL,KAAK;QACL,SAAS;QACT,eAAe,EAAE,SAAS;KAC3B,CAAC,mCAAI,SAAS,CAAC;IAElB,MAAM,GAAG,GACP,MAAA,IAAA,mBAAU,EAAC,iBAAiB,CAAC,GAAG,EAAE;QAChC,GAAG;QACH,GAAG;QACH,KAAK;QACL,KAAK;QACL,SAAS;QACT,eAAe,EAAE,SAAS;KAC3B,CAAC,mCAAI,CAAC,CAAC;IACV,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IAAI,GAAG,OAAO,CAAC,KAAK;wBAC/B,CAAC,EAAE,OAAO,CAAC,GAAG,GAAG,OAAO,CAAC,MAAM,GAAG,YAAY,GAAG,CAAC;qBACnD,CAAC,CAAC;iBACJ;gBACD,MAAM,OAAO,GAAG,IAAA,oBAAU,EAAC;oBACzB,CAAC,EAAE,CAAC;oBACJ,CAAC,EAAE,CAAC;oBACJ,MAAM,EAAE,kBAAkB;oBAC1B,SAAS;oBACT,MAAM;iBACP,CAAC,CAAC;gBACH,uBAAuB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;aAC3C;SACF;KACF;IACD,OAAO,uBAAuB,CAAC;AACjC,CAAC;AAtlBD,sDAslBC","file":"progress-bar-cell.js","sourcesContent":["import { createRect, createLine } from './../../../vrender';\nimport type { ProgressBarStyle } from '../../../body-helper/style/ProgressBarStyle';\nimport { str, getOrApply } from '../../../tools/helper';\nimport { Group } from '../../graphic/group';\nimport { getProp } from '../../utils/get-prop';\nimport { getQuadProps } from '../../utils/padding';\nimport type { BaseTableAPI } from '../../../ts-types/base-table';\nimport { isNumber } from '@visactor/vutils';\nimport type { CellRange, StylePropertyFunctionArg } from '../../../ts-types';\n\nexport function createProgressBarCell(\n progressBarDefine: {\n min?: number | ((args: StylePropertyFunctionArg) => number);\n max?: number | ((args: StylePropertyFunctionArg) => number);\n barType?: 'default' | 'negative' | 'negative_no_axis'; // 进度图类型\n dependField?: string; // 指定其他列数据(风神使用),\n },\n style: ProgressBarStyle,\n width: number,\n // height: number,\n value: string,\n dataValue: string,\n col: number,\n row: number,\n padding: [number, number, number, number],\n table: BaseTableAPI,\n range?: CellRange\n) {\n if (progressBarDefine.dependField) {\n const dependField = getOrApply(progressBarDefine.dependField, {\n col,\n row,\n table,\n value,\n dataValue,\n cellHeaderPaths: undefined\n });\n dataValue = (table.getCellOriginRecord(col, row) as any)?.[dependField] ?? dataValue;\n }\n\n const barType =\n getOrApply(progressBarDefine.barType, {\n col,\n row,\n table,\n value,\n dataValue,\n cellHeaderPaths: undefined\n }) ?? 'default';\n\n const min: number =\n getOrApply(progressBarDefine.min, {\n col,\n row,\n table,\n value,\n dataValue,\n cellHeaderPaths: undefined\n }) ?? 0;\n const max: number =\n getOrApply(progressBarDefine.max, {\n col,\n row,\n table,\n value,\n dataValue,\n cellHeaderPaths: undefined\n }) ?? min + 100;\n\n let height = 0;\n if (range) {\n height = table.getRowsHeight(range.start.row, range.end.row);\n } else {\n height = table.getRowHeight(row);\n }\n \n // 检查是否有主从表插件,如果有则使用原始高度\n if ((table as any).pluginManager) {\n const masterDetailPlugin = (table as any).pluginManager.getPluginByName('Master Detail Plugin');\n if (masterDetailPlugin) {\n // 如果是展开行,使用原始高度而不是展开后的高度\n const bodyRowIndex = row - table.columnHeaderLevelCount;\n const internalProps = (table as any).internalProps;\n const originalHeight = internalProps?.originalRowHeights?.get(bodyRowIndex);\n if (originalHeight !== undefined && originalHeight > 0) {\n height = originalHeight;\n }\n }\n }\n let contentWidth = width;\n let contentHeight = height;\n let _contentOffset = 0;\n if (isNumber(table.theme._contentOffset)) {\n _contentOffset = table.theme._contentOffset;\n }\n const percentCompleteBarGroup = new Group({\n x: -_contentOffset,\n y: -_contentOffset,\n width: contentWidth,\n height: contentHeight\n });\n percentCompleteBarGroup.name = 'progress-bar';\n\n const {\n showBar,\n barColor,\n barBgColor,\n // bgColor,\n barPositiveColor,\n barNegativeColor,\n barAxisColor,\n barRightToLeft,\n showBarMark,\n barMarkPositiveColor,\n barMarkNegativeColor,\n barMarkWidth,\n barMarkPosition,\n barMarkInBar\n } = style;\n let { barHeight, barBottom, barPadding } = style;\n // const { col, row, dataValue: originalValue } = context;\n\n // 完善四元组\n if (barPadding.length === 1) {\n barPadding = [barPadding[0], barPadding[0], barPadding[0], barPadding[0]];\n } else if (barPadding.length === 2) {\n barPadding = [barPadding[0], barPadding[1], barPadding[0], barPadding[1]];\n } else if (barPadding.length === 3) {\n barPadding = [barPadding[0], barPadding[1], barPadding[2], barPadding[1]];\n }\n\n // 将百分比值转换为数值\n barPadding = barPadding.map((v, i) => {\n if (typeof v === 'string' && str.endsWith(v, '%')) {\n const num = Number(v.substr(0, v.length - 1));\n if (i === 0 || i === 2) {\n return (height * num) / 100;\n }\n return (width * num) / 100;\n }\n return Number(v);\n });\n\n const borderWidth = getQuadProps(getProp('borderLineWidth', style, col, row, table));\n const barPaddingTop = Math.max((barPadding as number[])[0], Math.ceil(borderWidth[0] / 2));\n let barPaddingRight = Math.max((barPadding as number[])[1], Math.floor(borderWidth[1] / 2));\n const barPaddingBottom = Math.max((barPadding as number[])[2], Math.floor(borderWidth[2] / 2));\n let barPaddingLeft = Math.max((barPadding as number[])[3], Math.ceil(borderWidth[3] / 2));\n\n if (showBarMark && barMarkWidth > 0 && barMarkPosition === 'right' && barMarkInBar === false) {\n barPaddingRight += barMarkWidth;\n barPaddingLeft += barMarkWidth;\n }\n\n contentWidth -= barPaddingRight + barPaddingLeft;\n contentHeight -= barPaddingBottom + barPaddingTop;\n if (row === table.rowCount - 1 && [0, '0'].includes(barBottom)) {\n // 单元格边框在表格边界会向内缩进1px,为了避免进度图矩形覆盖边框,这里在最后一行向内缩进1px\n // 详见 packages/vtable/src/scenegraph/graphic/contributions/group-contribution-render.ts getCellSizeForDraw()\n contentHeight -= 1;\n }\n\n // if (barPaddingTop & 1) {\n // // barPaddingTop += 0.5;\n // contentWidth += borderWidth[0];\n // }\n // if (barPaddingLeft & 1) {\n // // barPaddingLeft += 0.5;\n // contentHeight += borderWidth[0];\n // }\n\n const top = barPaddingTop;\n const left = barPaddingLeft;\n const right = contentWidth;\n const bottom = contentHeight;\n\n if (typeof barHeight === 'string' && str.endsWith(barHeight, '%')) {\n barHeight = Number(barHeight.substr(0, barHeight.length - 1));\n barHeight = (contentHeight * barHeight) / 100;\n } else {\n barHeight = Number(barHeight);\n }\n if (typeof barBottom === 'string' && str.endsWith(barBottom, '%')) {\n barBottom = Number(barBottom.substr(0, barBottom.length - 1));\n barBottom = (contentHeight * barBottom) / 100;\n } else {\n barBottom = Number(barBottom);\n }\n\n const show = getOrApply(showBar as any, {\n col,\n row,\n table,\n context: null,\n value,\n dataValue\n });\n\n if (show) {\n let svalue = `${dataValue}`;\n if (str.endsWith(svalue, '%')) {\n svalue = svalue.substr(0, svalue.length - 1);\n }\n const num = Number(svalue);\n if (isNaN(num)) {\n return percentCompleteBarGroup;\n }\n\n if ((barType ?? 'default') === 'default') {\n const percentile = num < min ? 0 : num > max ? 1 : (num - min) / (max - min);\n\n const barMaxWidth = contentWidth;\n const barTop = top + contentHeight - (barHeight as number) - (barBottom as number);\n // const barLeft = 0 + barPaddingLeft;\n let barSize = Math.min(barMaxWidth * percentile, barMaxWidth);\n const barLeft = barRightToLeft ? left + right - barSize : left;\n if (col === table.colCount - 1 && percentile === 1 && !barRightToLeft) {\n // 单元格边框在表格边界会向内缩进1px,为了避免进度图矩形覆盖边框,这里在最后一行向内缩进1px\n // 详见 packages/vtable/src/scenegraph/graphic/contributions/group-contribution-render.ts getCellSizeForDraw()\n barSize -= 1;\n }\n const bgFillColor = getOrApply(barBgColor as any, {\n col,\n row,\n table,\n context: null,\n value,\n dataValue,\n percentile\n });\n\n if (bgFillColor) {\n const barBack = createRect({\n x: barLeft,\n y: barTop,\n width: barMaxWidth,\n height: barHeight,\n fill: bgFillColor\n });\n percentCompleteBarGroup.addChild(barBack);\n }\n\n const fillColor =\n getOrApply(barColor as any, {\n col,\n row,\n table,\n context: null,\n value,\n dataValue,\n percentile\n }) || '#20a8d8';\n const barMain = createRect({\n x: barLeft,\n y: barTop,\n width: barSize,\n height: barHeight,\n fill: fillColor\n });\n percentCompleteBarGroup.addChild(barMain);\n } else if (barType === 'negative') {\n // negative模式参考风神现有数据条样式,显示坐标轴和正负数据条\n // 计算坐标轴位置\n const negativeRange = min < 0 ? -min : 0;\n const positiveRange = max > 0 ? max : 0;\n\n const negativeFactor = negativeRange / (negativeRange + positiveRange);\n const positiveFactor = 1 - negativeFactor;\n\n // 计算rate\n const positiveRate = num > 0 ? num / positiveRange : 0;\n const negativeRate = num < 0 ? -num / negativeRange : 0;\n\n // 绘制\n // 绘制背景\n const barMaxWidth = contentWidth;\n const barTop = top + contentHeight - (barHeight as number) - (barBottom as number);\n const barLeft = left;\n const bgFillColor = getOrApply(barBgColor as any, {\n col,\n row,\n table,\n context: null,\n value,\n dataValue,\n percentile: positiveRate\n });\n if (bgFillColor) {\n const barBack = createRect({\n x: barLeft,\n y: barTop,\n width: barMaxWidth,\n height: barHeight,\n fill: bgFillColor\n });\n percentCompleteBarGroup.addChild(barBack);\n }\n\n // 坐标轴距离左侧边界距离\n const positiveLeft = barRightToLeft ? positiveFactor * barMaxWidth : negativeFactor * barMaxWidth;\n\n // 绘制负值区域\n const barSizeNega = Math.min(barMaxWidth * negativeFactor * negativeRate, barMaxWidth);\n const barRectNega = barRightToLeft\n ? {\n left: barLeft + positiveLeft,\n top: barTop,\n width: barSizeNega,\n height: barHeight as number\n }\n : {\n left: barLeft + positiveLeft - barSizeNega,\n top: barTop,\n width: barSizeNega,\n height: barHeight as number\n };\n const barNagiFillColor =\n getOrApply(barNegativeColor as any, {\n col,\n row,\n table,\n context: null,\n value,\n dataValue,\n percentile: negativeRate\n }) || '#20a8d8';\n const barNega = createRect({\n x: barRectNega.left,\n y: barRectNega.top,\n width: barRectNega.width,\n height: barRectNega.height,\n fill: barNagiFillColor\n });\n percentCompleteBarGroup.addChild(barNega);\n\n // 绘制正值区域\n let barSizePosi = Math.min(barMaxWidth * positiveFactor * positiveRate, barMaxWidth);\n if (col === table.colCount - 1 && positiveRate === 1 && !barRightToLeft) {\n // 单元格边框在表格边界会向内缩进1px,为了避免进度图矩形覆盖边框,这里在最后一行向内缩进1px\n // 详见 packages/vtable/src/scenegraph/graphic/contributions/group-contribution-render.ts getCellSizeForDraw()\n barSizePosi -= 1;\n }\n const barRectPosi = barRightToLeft\n ? {\n left: barLeft + positiveLeft - barSizePosi,\n top: barTop,\n width: barSizePosi,\n height: barHeight as number\n }\n : {\n left: barLeft + positiveLeft,\n top: barTop,\n width: barSizePosi,\n height: barHeight as number\n };\n const barPosiFillColor =\n getOrApply(barPositiveColor as any, {\n col,\n row,\n table,\n context: null,\n value,\n dataValue,\n percentile: positiveRate\n }) || '#20a8d8';\n const barPosi = createRect({\n x: barRectPosi.left,\n y: barRectPosi.top,\n width: barRectPosi.width,\n height: barRectPosi.height,\n fill: barPosiFillColor\n });\n percentCompleteBarGroup.addChild(barPosi);\n\n // 绘制坐标轴\n const lineLeft = barRightToLeft ? barRectNega.left : barRectPosi.left;\n const lineStrokeColor = getOrApply(barAxisColor as any, {\n col,\n row,\n table,\n context: null,\n value,\n dataValue,\n percentile: positiveRate\n });\n const line = createLine({\n x: 0,\n y: 0,\n stroke: lineStrokeColor,\n lineWidth: 1,\n lineDash: [2, 2],\n points: [\n { x: lineLeft, y: 0 },\n { x: lineLeft, y: height }\n ]\n });\n percentCompleteBarGroup.addChild(line);\n\n // 绘制mark\n if (showBarMark && (positiveRate || negativeRate)) {\n const lineWidth = barMarkWidth;\n const points = [];\n let barMarkStrokeColor;\n if (positiveRate > 0) {\n barMarkStrokeColor =\n getOrApply(barMarkPositiveColor as any, {\n col,\n row,\n table,\n context: null,\n value,\n dataValue,\n percentile: positiveRate\n }) || '#20a8d8';\n if (barMarkPosition === 'right') {\n const markLeft = barRightToLeft\n ? barRectPosi.left + barMarkWidth / 2\n : barRectPosi.left + barRectPosi.width + (barMarkInBar ? -barMarkWidth / 2 : barMarkWidth / 2);\n points.push({ x: markLeft, y: barRectPosi.top });\n points.push({ x: markLeft, y: barRectPosi.top + barRectPosi.height });\n } else if (barMarkPosition === 'bottom') {\n points.push({\n x: barRectPosi.left,\n y: barRectPosi.top + barRectPosi.height - barMarkWidth / 2\n });\n points.push({\n x: barRectPosi.left + barRectPosi.width,\n y: barRectPosi.top + barRectPosi.height - barMarkWidth / 2\n });\n }\n } else if (negativeRate > 0) {\n barMarkStrokeColor =\n getOrApply(barMarkNegativeColor as any, {\n col,\n row,\n table,\n context: null,\n value,\n dataValue,\n percentile: negativeRate\n }) || '#20a8d8';\n if (barMarkPosition === 'right') {\n const markLeft = barRightToLeft\n ? barRectNega.left + barRectNega.width - barMarkWidth / 2\n : barRectNega.left + barMarkWidth / 2;\n points.push({ x: markLeft, y: barRectNega.top });\n points.push({ x: markLeft, y: barRectNega.top + barRectNega.height });\n } else if (barMarkPosition === 'bottom') {\n points.push({\n x: barRectNega.left,\n y: barRectNega.top + barRectNega.height - barMarkWidth / 2\n });\n points.push({\n x: barRectNega.left + barRectNega.width,\n y: barRectNega.top + barRectNega.height - barMarkWidth / 2\n });\n }\n }\n const barMark = createLine({\n x: 0,\n y: 0,\n stroke: barMarkStrokeColor,\n lineWidth,\n points\n });\n percentCompleteBarGroup.addChild(barMark);\n }\n } else if (barType === 'negative_no_axis') {\n // negative_no_axis模式不显示坐标轴,正负数据条同向,区分颜色\n // 计算range\n const _negativeRange = min < 0 ? -min : 0;\n const _positiveRange = max > 0 ? max : 0;\n const range = Math.max(_negativeRange, _positiveRange);\n\n // 计算rate\n const percentile = range === 0 ? 0 : Math.abs(num) / range;\n\n // 绘制\n // 绘制背景\n // const barMaxWidth = width - barPaddingLeft - barPaddingRight - 1; /*罫線*/\n const barMaxWidth = contentWidth;\n let barSize = Math.min(barMaxWidth * percentile, barMaxWidth);\n if (col === table.colCount - 1 && percentile === 1 && !barRightToLeft) {\n // 单元格边框在表格边界会向内缩进1px,为了避免进度图矩形覆盖边框,这里在最后一行向内缩进1px\n // 详见 packages/vtable/src/scenegraph/graphic/contributions/group-contribution-render.ts getCellSizeForDraw()\n barSize -= 1;\n }\n // const barTop = bottom - barPaddingBottom - (barHeight as number) - (barBottom as number) - 1; /*罫線*/\n const barTop = top + contentHeight - (barHeight as number) - (barBottom as number);\n // const barLeft = barRightToLeft ? right - barPaddingRight - barSize : left + barPaddingLeft;\n const barLeft = barRightToLeft ? left + right - barSize : left;\n\n const bgFillColor = getOrApply(barBgColor as any, {\n col,\n row,\n table,\n context: null,\n value,\n dataValue,\n percentile\n });\n if (bgFillColor) {\n const barBack = createRect({\n x: barLeft,\n y: barTop,\n width: barMaxWidth,\n height: barHeight,\n fill: bgFillColor\n });\n percentCompleteBarGroup.addChild(barBack);\n }\n\n // 绘制bar\n const barRect = {\n left: barLeft,\n top: barTop,\n width: barSize,\n height: barHeight as number\n };\n let barRectFillColor;\n if (num >= 0) {\n barRectFillColor =\n getOrApply(barPositiveColor as any, {\n col,\n row,\n table,\n context: null,\n value,\n percentile,\n dataValue\n }) || '#20a8d8';\n } else {\n barRectFillColor =\n getOrApply(barNegativeColor as any, {\n col,\n row,\n table,\n context: null,\n value,\n dataValue,\n percentile\n }) || '#20a8d8';\n }\n const bar = createRect({\n x: barRect.left,\n y: barRect.top,\n width: barRect.width,\n height: barRect.height,\n fill: barRectFillColor\n });\n percentCompleteBarGroup.addChild(bar);\n\n // 绘制mark\n if (showBarMark && num) {\n const lineWidth = barMarkWidth;\n const points = [];\n let barMarkStrokeColor;\n if (num >= 0) {\n barMarkStrokeColor =\n getOrApply(barMarkPositiveColor as any, {\n col,\n row,\n table,\n context: null,\n value,\n dataValue,\n percentile\n }) || '#20a8d8';\n } else {\n barMarkStrokeColor =\n getOrApply(barMarkNegativeColor as any, {\n col,\n row,\n table,\n context: null,\n value,\n dataValue,\n percentile\n }) || '#20a8d8';\n }\n if (barMarkPosition === 'right') {\n const markLeft = barRightToLeft\n ? barRect.left + barMarkWidth / 2\n : barRect.left + barRect.width - barMarkWidth / 2;\n points.push({ x: markLeft, y: barRect.top });\n points.push({ x: markLeft, y: barRect.top + barRect.height });\n } else if (barMarkPosition === 'bottom') {\n points.push({\n x: barRect.left,\n y: barRect.top + barRect.height - barMarkWidth / 2\n });\n points.push({\n x: barRect.left + barRect.width,\n y: barRect.top + barRect.height - barMarkWidth / 2\n });\n }\n const barMark = createLine({\n x: 0,\n y: 0,\n stroke: barMarkStrokeColor,\n lineWidth,\n points\n });\n percentCompleteBarGroup.addChild(barMark);\n }\n }\n }\n return percentCompleteBarGroup;\n}\n\nexport type CreateProgressBarCell = typeof createProgressBarCell;\n"]}
1
+ {"version":3,"sources":["../src/scenegraph/group-creater/cell-type/progress-bar-cell.ts"],"names":[],"mappings":";;;AAAA,gDAA4D;AAE5D,kDAAwD;AACxD,+CAA4C;AAC5C,mDAA+C;AAC/C,iDAAmD;AAEnD,6CAA4C;AAG5C,SAAgB,qBAAqB,CACnC,iBAKC,EACD,KAAuB,EACvB,KAAa,EAEb,KAAa,EACb,SAAiB,EACjB,GAAW,EACX,GAAW,EACX,OAAyC,EACzC,KAAmB,EACnB,KAAiB;;IAEjB,IAAI,iBAAiB,CAAC,WAAW,EAAE;QACjC,MAAM,WAAW,GAAG,IAAA,mBAAU,EAAC,iBAAiB,CAAC,WAAW,EAAE;YAC5D,GAAG;YACH,GAAG;YACH,KAAK;YACL,KAAK;YACL,SAAS;YACT,eAAe,EAAE,SAAS;SAC3B,CAAC,CAAC;QACH,SAAS,GAAG,MAAA,MAAC,KAAK,CAAC,mBAAmB,CAAC,GAAG,EAAE,GAAG,CAAS,0CAAG,WAAW,CAAC,mCAAI,SAAS,CAAC;KACtF;IAED,MAAM,OAAO,GACX,MAAA,IAAA,mBAAU,EAAC,iBAAiB,CAAC,OAAO,EAAE;QACpC,GAAG;QACH,GAAG;QACH,KAAK;QACL,KAAK;QACL,SAAS;QACT,eAAe,EAAE,SAAS;KAC3B,CAAC,mCAAI,SAAS,CAAC;IAElB,MAAM,GAAG,GACP,MAAA,IAAA,mBAAU,EAAC,iBAAiB,CAAC,GAAG,EAAE;QAChC,GAAG;QACH,GAAG;QACH,KAAK;QACL,KAAK;QACL,SAAS;QACT,eAAe,EAAE,SAAS;KAC3B,CAAC,mCAAI,CAAC,CAAC;IACV,MAAM,GAAG,GACP,MAAA,IAAA,mBAAU,EAAC,iBAAiB,CAAC,GAAG,EAAE;QAChC,GAAG;QACH,GAAG;QACH,KAAK;QACL,KAAK;QACL,SAAS;QACT,eAAe,EAAE,SAAS;KA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MAAM,OAAO,GAAG,IAAA,oBAAU,EAAC;oBACzB,CAAC,EAAE,CAAC;oBACJ,CAAC,EAAE,CAAC;oBACJ,MAAM,EAAE,kBAAkB;oBAC1B,SAAS;oBACT,MAAM;iBACP,CAAC,CAAC;gBACH,uBAAuB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;aAC3C;SACF;KACF;IACD,OAAO,uBAAuB,CAAC;AACjC,CAAC;AAtlBD,sDAslBC","file":"progress-bar-cell.js","sourcesContent":["import { createRect, createLine } from './../../../vrender';\nimport type { ProgressBarStyle } from '../../../body-helper/style/ProgressBarStyle';\nimport { str, getOrApply } from '../../../tools/helper';\nimport { Group } from '../../graphic/group';\nimport { getProp } from '../../utils/get-prop';\nimport { getQuadProps } from '../../utils/padding';\nimport type { BaseTableAPI } from '../../../ts-types/base-table';\nimport { isNumber } from '@visactor/vutils';\nimport type { CellRange, StylePropertyFunctionArg } from '../../../ts-types';\n\nexport function createProgressBarCell(\n progressBarDefine: {\n min?: number | ((args: StylePropertyFunctionArg) => number);\n max?: number | ((args: StylePropertyFunctionArg) => number);\n barType?: 'default' | 'negative' | 'negative_no_axis'; // 进度图类型\n dependField?: string; // 指定其他列数据(风神使用),\n },\n style: ProgressBarStyle,\n width: number,\n // height: number,\n value: string,\n dataValue: string,\n col: number,\n row: number,\n padding: [number, number, number, number],\n table: BaseTableAPI,\n range?: CellRange\n) {\n if (progressBarDefine.dependField) {\n const dependField = getOrApply(progressBarDefine.dependField, {\n col,\n row,\n table,\n value,\n dataValue,\n cellHeaderPaths: undefined\n });\n dataValue = (table.getCellOriginRecord(col, row) as any)?.[dependField] ?? dataValue;\n }\n\n const barType =\n getOrApply(progressBarDefine.barType, {\n col,\n row,\n table,\n value,\n dataValue,\n cellHeaderPaths: undefined\n }) ?? 'default';\n\n const min: number =\n getOrApply(progressBarDefine.min, {\n col,\n row,\n table,\n value,\n dataValue,\n cellHeaderPaths: undefined\n }) ?? 0;\n const max: number =\n getOrApply(progressBarDefine.max, {\n col,\n row,\n table,\n value,\n dataValue,\n cellHeaderPaths: undefined\n }) ?? min + 100;\n\n let height = 0;\n if (range) {\n height = table.getRowsHeight(range.start.row, range.end.row);\n } else {\n height = table.getRowHeight(row);\n }\n\n // 检查是否有主从表插件,如果有则使用原始高度\n if ((table as any).pluginManager) {\n const masterDetailPlugin = (table as any).pluginManager.getPluginByName('Master Detail Plugin');\n if (masterDetailPlugin) {\n // 如果是展开行,使用原始高度而不是展开后的高度\n const bodyRowIndex = row - table.columnHeaderLevelCount;\n const internalProps = (table as any).internalProps;\n const originalHeight = internalProps?.originalRowHeights?.get(bodyRowIndex);\n if (originalHeight !== undefined && originalHeight > 0) {\n height = originalHeight;\n }\n }\n }\n let contentWidth = width;\n let contentHeight = height;\n let _contentOffset = 0;\n if (isNumber(table.theme._contentOffset)) {\n _contentOffset = table.theme._contentOffset;\n }\n const percentCompleteBarGroup = new Group({\n x: -_contentOffset,\n y: -_contentOffset,\n width: contentWidth,\n height: contentHeight\n });\n percentCompleteBarGroup.name = 'progress-bar';\n\n const {\n showBar,\n barColor,\n barBgColor,\n // bgColor,\n barPositiveColor,\n barNegativeColor,\n barAxisColor,\n barRightToLeft,\n showBarMark,\n barMarkPositiveColor,\n barMarkNegativeColor,\n barMarkWidth,\n barMarkPosition,\n barMarkInBar\n } = style;\n let { barHeight, barBottom, barPadding } = style;\n // const { col, row, dataValue: originalValue } = context;\n\n // 完善四元组\n if (barPadding.length === 1) {\n barPadding = [barPadding[0], barPadding[0], barPadding[0], barPadding[0]];\n } else if (barPadding.length === 2) {\n barPadding = [barPadding[0], barPadding[1], barPadding[0], barPadding[1]];\n } else if (barPadding.length === 3) {\n barPadding = [barPadding[0], barPadding[1], barPadding[2], barPadding[1]];\n }\n\n // 将百分比值转换为数值\n barPadding = barPadding.map((v, i) => {\n if (typeof v === 'string' && str.endsWith(v, '%')) {\n const num = Number(v.substr(0, v.length - 1));\n if (i === 0 || i === 2) {\n return (height * num) / 100;\n }\n return (width * num) / 100;\n }\n return Number(v);\n });\n\n const borderWidth = getQuadProps(getProp('borderLineWidth', style, col, row, table));\n const barPaddingTop = Math.max((barPadding as number[])[0], Math.ceil(borderWidth[0] / 2));\n let barPaddingRight = Math.max((barPadding as number[])[1], Math.floor(borderWidth[1] / 2));\n const barPaddingBottom = Math.max((barPadding as number[])[2], Math.floor(borderWidth[2] / 2));\n let barPaddingLeft = Math.max((barPadding as number[])[3], Math.ceil(borderWidth[3] / 2));\n\n if (showBarMark && barMarkWidth > 0 && barMarkPosition === 'right' && barMarkInBar === false) {\n barPaddingRight += barMarkWidth;\n barPaddingLeft += barMarkWidth;\n }\n\n contentWidth -= barPaddingRight + barPaddingLeft;\n contentHeight -= barPaddingBottom + barPaddingTop;\n if (row === table.rowCount - 1 && [0, '0'].includes(barBottom)) {\n // 单元格边框在表格边界会向内缩进1px,为了避免进度图矩形覆盖边框,这里在最后一行向内缩进1px\n // 详见 packages/vtable/src/scenegraph/graphic/contributions/group-contribution-render.ts getCellSizeForDraw()\n contentHeight -= 1;\n }\n\n // if (barPaddingTop & 1) {\n // // barPaddingTop += 0.5;\n // contentWidth += borderWidth[0];\n // }\n // if (barPaddingLeft & 1) {\n // // barPaddingLeft += 0.5;\n // contentHeight += borderWidth[0];\n // }\n\n const top = barPaddingTop;\n const left = barPaddingLeft;\n const right = contentWidth;\n const bottom = contentHeight;\n\n if (typeof barHeight === 'string' && str.endsWith(barHeight, '%')) {\n barHeight = Number(barHeight.substr(0, barHeight.length - 1));\n barHeight = (contentHeight * barHeight) / 100;\n } else {\n barHeight = Number(barHeight);\n }\n if (typeof barBottom === 'string' && str.endsWith(barBottom, '%')) {\n barBottom = Number(barBottom.substr(0, barBottom.length - 1));\n barBottom = (contentHeight * barBottom) / 100;\n } else {\n barBottom = Number(barBottom);\n }\n\n const show = getOrApply(showBar as any, {\n col,\n row,\n table,\n context: null,\n value,\n dataValue\n });\n\n if (show) {\n let svalue = `${dataValue}`;\n if (str.endsWith(svalue, '%')) {\n svalue = svalue.substr(0, svalue.length - 1);\n }\n const num = Number(svalue);\n if (isNaN(num)) {\n return percentCompleteBarGroup;\n }\n\n if ((barType ?? 'default') === 'default') {\n const percentile = num < min ? 0 : num > max ? 1 : (num - min) / (max - min);\n\n const barMaxWidth = contentWidth;\n const barTop = top + contentHeight - (barHeight as number) - (barBottom as number);\n // const barLeft = 0 + barPaddingLeft;\n let barSize = Math.min(barMaxWidth * percentile, barMaxWidth);\n const barLeft = barRightToLeft ? left + right - barSize : left;\n if (col === table.colCount - 1 && percentile === 1 && !barRightToLeft) {\n // 单元格边框在表格边界会向内缩进1px,为了避免进度图矩形覆盖边框,这里在最后一行向内缩进1px\n // 详见 packages/vtable/src/scenegraph/graphic/contributions/group-contribution-render.ts getCellSizeForDraw()\n barSize -= 1;\n }\n const bgFillColor = getOrApply(barBgColor as any, {\n col,\n row,\n table,\n context: null,\n value,\n dataValue,\n percentile\n });\n\n if (bgFillColor) {\n const barBack = createRect({\n x: barLeft,\n y: barTop,\n width: barMaxWidth,\n height: barHeight,\n fill: bgFillColor\n });\n percentCompleteBarGroup.addChild(barBack);\n }\n\n const fillColor =\n getOrApply(barColor as any, {\n col,\n row,\n table,\n context: null,\n value,\n dataValue,\n percentile\n }) || '#20a8d8';\n const barMain = createRect({\n x: barLeft,\n y: barTop,\n width: barSize,\n height: barHeight,\n fill: fillColor\n });\n percentCompleteBarGroup.addChild(barMain);\n } else if (barType === 'negative') {\n // negative模式参考风神现有数据条样式,显示坐标轴和正负数据条\n // 计算坐标轴位置\n const negativeRange = min < 0 ? -min : 0;\n const positiveRange = max > 0 ? max : 0;\n\n const negativeFactor = negativeRange / (negativeRange + positiveRange);\n const positiveFactor = 1 - negativeFactor;\n\n // 计算rate\n const positiveRate = num > 0 ? num / positiveRange : 0;\n const negativeRate = num < 0 ? -num / negativeRange : 0;\n\n // 绘制\n // 绘制背景\n const barMaxWidth = contentWidth;\n const barTop = top + contentHeight - (barHeight as number) - (barBottom as number);\n const barLeft = left;\n const bgFillColor = getOrApply(barBgColor as any, {\n col,\n row,\n table,\n context: null,\n value,\n dataValue,\n percentile: positiveRate\n });\n if (bgFillColor) {\n const barBack = createRect({\n x: barLeft,\n y: barTop,\n width: barMaxWidth,\n height: barHeight,\n fill: bgFillColor\n });\n percentCompleteBarGroup.addChild(barBack);\n }\n\n // 坐标轴距离左侧边界距离\n const positiveLeft = barRightToLeft ? positiveFactor * barMaxWidth : negativeFactor * barMaxWidth;\n\n // 绘制负值区域\n const barSizeNega = Math.min(barMaxWidth * negativeFactor * negativeRate, barMaxWidth);\n const barRectNega = barRightToLeft\n ? {\n left: barLeft + positiveLeft,\n top: barTop,\n width: barSizeNega,\n height: barHeight as number\n }\n : {\n left: barLeft + positiveLeft - barSizeNega,\n top: barTop,\n width: barSizeNega,\n height: barHeight as number\n };\n const barNagiFillColor =\n getOrApply(barNegativeColor as any, {\n col,\n row,\n table,\n context: null,\n value,\n dataValue,\n percentile: negativeRate\n }) || '#20a8d8';\n const barNega = createRect({\n x: barRectNega.left,\n y: barRectNega.top,\n width: barRectNega.width,\n height: barRectNega.height,\n fill: barNagiFillColor\n });\n percentCompleteBarGroup.addChild(barNega);\n\n // 绘制正值区域\n let barSizePosi = Math.min(barMaxWidth * positiveFactor * positiveRate, barMaxWidth);\n if (col === table.colCount - 1 && positiveRate === 1 && !barRightToLeft) {\n // 单元格边框在表格边界会向内缩进1px,为了避免进度图矩形覆盖边框,这里在最后一行向内缩进1px\n // 详见 packages/vtable/src/scenegraph/graphic/contributions/group-contribution-render.ts getCellSizeForDraw()\n barSizePosi -= 1;\n }\n const barRectPosi = barRightToLeft\n ? {\n left: barLeft + positiveLeft - barSizePosi,\n top: barTop,\n width: barSizePosi,\n height: barHeight as number\n }\n : {\n left: barLeft + positiveLeft,\n top: barTop,\n width: barSizePosi,\n height: barHeight as number\n };\n const barPosiFillColor =\n getOrApply(barPositiveColor as any, {\n col,\n row,\n table,\n context: null,\n value,\n dataValue,\n percentile: positiveRate\n }) || '#20a8d8';\n const barPosi = createRect({\n x: barRectPosi.left,\n y: barRectPosi.top,\n width: barRectPosi.width,\n height: barRectPosi.height,\n fill: barPosiFillColor\n });\n percentCompleteBarGroup.addChild(barPosi);\n\n // 绘制坐标轴\n const lineLeft = barRightToLeft ? barRectNega.left : barRectPosi.left;\n const lineStrokeColor = getOrApply(barAxisColor as any, {\n col,\n row,\n table,\n context: null,\n value,\n dataValue,\n percentile: positiveRate\n });\n const line = createLine({\n x: 0,\n y: 0,\n stroke: lineStrokeColor,\n lineWidth: 1,\n lineDash: [2, 2],\n points: [\n { x: lineLeft, y: 0 },\n { x: lineLeft, y: height }\n ]\n });\n percentCompleteBarGroup.addChild(line);\n\n // 绘制mark\n if (showBarMark && (positiveRate || negativeRate)) {\n const lineWidth = barMarkWidth;\n const points = [];\n let barMarkStrokeColor;\n if (positiveRate > 0) {\n barMarkStrokeColor =\n getOrApply(barMarkPositiveColor as any, {\n col,\n row,\n table,\n context: null,\n value,\n dataValue,\n percentile: positiveRate\n }) || '#20a8d8';\n if (barMarkPosition === 'right') {\n const markLeft = barRightToLeft\n ? barRectPosi.left + barMarkWidth / 2\n : barRectPosi.left + barRectPosi.width + (barMarkInBar ? -barMarkWidth / 2 : barMarkWidth / 2);\n points.push({ x: markLeft, y: barRectPosi.top });\n points.push({ x: markLeft, y: barRectPosi.top + barRectPosi.height });\n } else if (barMarkPosition === 'bottom') {\n points.push({\n x: barRectPosi.left,\n y: barRectPosi.top + barRectPosi.height - barMarkWidth / 2\n });\n points.push({\n x: barRectPosi.left + barRectPosi.width,\n y: barRectPosi.top + barRectPosi.height - barMarkWidth / 2\n });\n }\n } else if (negativeRate > 0) {\n barMarkStrokeColor =\n getOrApply(barMarkNegativeColor as any, {\n col,\n row,\n table,\n context: null,\n value,\n dataValue,\n percentile: negativeRate\n }) || '#20a8d8';\n if (barMarkPosition === 'right') {\n const markLeft = barRightToLeft\n ? barRectNega.left + barRectNega.width - barMarkWidth / 2\n : barRectNega.left + barMarkWidth / 2;\n points.push({ x: markLeft, y: barRectNega.top });\n points.push({ x: markLeft, y: barRectNega.top + barRectNega.height });\n } else if (barMarkPosition === 'bottom') {\n points.push({\n x: barRectNega.left,\n y: barRectNega.top + barRectNega.height - barMarkWidth / 2\n });\n points.push({\n x: barRectNega.left + barRectNega.width,\n y: barRectNega.top + barRectNega.height - barMarkWidth / 2\n });\n }\n }\n const barMark = createLine({\n x: 0,\n y: 0,\n stroke: barMarkStrokeColor,\n lineWidth,\n points\n });\n percentCompleteBarGroup.addChild(barMark);\n }\n } else if (barType === 'negative_no_axis') {\n // negative_no_axis模式不显示坐标轴,正负数据条同向,区分颜色\n // 计算range\n const _negativeRange = min < 0 ? -min : 0;\n const _positiveRange = max > 0 ? max : 0;\n const range = Math.max(_negativeRange, _positiveRange);\n\n // 计算rate\n const percentile = range === 0 ? 0 : Math.abs(num) / range;\n\n // 绘制\n // 绘制背景\n // const barMaxWidth = width - barPaddingLeft - barPaddingRight - 1; /*罫線*/\n const barMaxWidth = contentWidth;\n let barSize = Math.min(barMaxWidth * percentile, barMaxWidth);\n if (col === table.colCount - 1 && percentile === 1 && !barRightToLeft) {\n // 单元格边框在表格边界会向内缩进1px,为了避免进度图矩形覆盖边框,这里在最后一行向内缩进1px\n // 详见 packages/vtable/src/scenegraph/graphic/contributions/group-contribution-render.ts getCellSizeForDraw()\n barSize -= 1;\n }\n // const barTop = bottom - barPaddingBottom - (barHeight as number) - (barBottom as number) - 1; /*罫線*/\n const barTop = top + contentHeight - (barHeight as number) - (barBottom as number);\n // const barLeft = barRightToLeft ? right - barPaddingRight - barSize : left + barPaddingLeft;\n const barLeft = barRightToLeft ? left + right - barSize : left;\n\n const bgFillColor = getOrApply(barBgColor as any, {\n col,\n row,\n table,\n context: null,\n value,\n dataValue,\n percentile\n });\n if (bgFillColor) {\n const barBack = createRect({\n x: barLeft,\n y: barTop,\n width: barMaxWidth,\n height: barHeight,\n fill: bgFillColor\n });\n percentCompleteBarGroup.addChild(barBack);\n }\n\n // 绘制bar\n const barRect = {\n left: barLeft,\n top: barTop,\n width: barSize,\n height: barHeight as number\n };\n let barRectFillColor;\n if (num >= 0) {\n barRectFillColor =\n getOrApply(barPositiveColor as any, {\n col,\n row,\n table,\n context: null,\n value,\n percentile,\n dataValue\n }) || '#20a8d8';\n } else {\n barRectFillColor =\n getOrApply(barNegativeColor as any, {\n col,\n row,\n table,\n context: null,\n value,\n dataValue,\n percentile\n }) || '#20a8d8';\n }\n const bar = createRect({\n x: barRect.left,\n y: barRect.top,\n width: barRect.width,\n height: barRect.height,\n fill: barRectFillColor\n });\n percentCompleteBarGroup.addChild(bar);\n\n // 绘制mark\n if (showBarMark && num) {\n const lineWidth = barMarkWidth;\n const points = [];\n let barMarkStrokeColor;\n if (num >= 0) {\n barMarkStrokeColor =\n getOrApply(barMarkPositiveColor as any, {\n col,\n row,\n table,\n context: null,\n value,\n dataValue,\n percentile\n }) || '#20a8d8';\n } else {\n barMarkStrokeColor =\n getOrApply(barMarkNegativeColor as any, {\n col,\n row,\n table,\n context: null,\n value,\n dataValue,\n percentile\n }) || '#20a8d8';\n }\n if (barMarkPosition === 'right') {\n const markLeft = barRightToLeft\n ? barRect.left + barMarkWidth / 2\n : barRect.left + barRect.width - barMarkWidth / 2;\n points.push({ x: markLeft, y: barRect.top });\n points.push({ x: markLeft, y: barRect.top + barRect.height });\n } else if (barMarkPosition === 'bottom') {\n points.push({\n x: barRect.left,\n y: barRect.top + barRect.height - barMarkWidth / 2\n });\n points.push({\n x: barRect.left + barRect.width,\n y: barRect.top + barRect.height - barMarkWidth / 2\n });\n }\n const barMark = createLine({\n x: 0,\n y: 0,\n stroke: barMarkStrokeColor,\n lineWidth,\n points\n });\n percentCompleteBarGroup.addChild(barMark);\n }\n }\n }\n return percentCompleteBarGroup;\n}\n\nexport type CreateProgressBarCell = typeof createProgressBarCell;\n"]}
@@ -36,7 +36,7 @@ function updateRow(removeCells, addCells, updateCells, table, skipUpdateProxy) {
36
36
  rowUpdatePos = (0, vutils_1.isValid)(rowUpdatePos) ? (0, vutils_1.isValid)(pos) ? Math.min(rowUpdatePos, pos) : rowUpdatePos : pos;
37
37
  }
38
38
  let updateAfter;
39
- if (scene.table._clearRowRangeHeightsMap(), addRows.forEach((row => {
39
+ if (scene.table._clearRowRangeHeightsMap(), verifyProxyRowStatus(scene), addRows.forEach((row => {
40
40
  const needUpdateAfter = addRow(row, scene, skipUpdateProxy);
41
41
  updateAfter = null != updateAfter ? updateAfter : needUpdateAfter, rowHeightsMap.insert(row);
42
42
  })), resetRowNumberAndY(scene), addRows.length) {
@@ -288,5 +288,20 @@ function setRowSeriesNumberCellNeedUpdate(startUpdateRow, scene) {
288
288
  cell_helper_1.updateCell)(0, row, scene.table, !1);
289
289
  }
290
290
 
291
+ function verifyProxyRowStatus(scene) {
292
+ const proxy = scene.proxy, {rowStart: rowStart, rowEnd: rowEnd, rowLimit: rowLimit, totalRow: totalRow} = proxy;
293
+ if (rowStart > rowEnd) return proxy.rowStart = scene.table.columnHeaderLevelCount,
294
+ proxy.rowEnd = Math.min(totalRow, proxy.rowStart + rowLimit - 1), void (proxy.currentRow = 0);
295
+ if (rowStart + rowLimit - 1 > totalRow) {
296
+ const oldRowStart = proxy.rowStart, newRowStart = Math.max(scene.table.columnHeaderLevelCount, totalRow - rowLimit + 1);
297
+ if (newRowStart === oldRowStart) return;
298
+ proxy.rowStart = newRowStart, proxy.rowEnd = Math.min(totalRow, newRowStart + rowLimit - 1),
299
+ proxy.currentRow = proxy.rowEnd + 1;
300
+ const addRowCount = oldRowStart - proxy.rowStart;
301
+ for (let i = 0; i < addRowCount; i++) addRowCellGroup(proxy.rowStart + i, scene);
302
+ proxy.rowUpdatePos = proxy.rowStart;
303
+ }
304
+ }
305
+
291
306
  exports.updateRow = updateRow;
292
307
  //# sourceMappingURL=update-row.js.map