@visactor/vtable 0.9.2-alpha.3 → 0.9.3-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. package/cjs/PivotChart.d.ts +1 -0
  2. package/cjs/PivotChart.js +8 -0
  3. package/cjs/PivotChart.js.map +1 -1
  4. package/cjs/chartModule.js +14 -0
  5. package/cjs/chartModule.js.map +1 -0
  6. package/cjs/core/BaseTable.js +26 -9
  7. package/cjs/core/BaseTable.js.map +1 -1
  8. package/cjs/core/TABLE_EVENT_TYPE.d.ts +2 -0
  9. package/cjs/core/TABLE_EVENT_TYPE.js +3 -1
  10. package/cjs/core/TABLE_EVENT_TYPE.js.map +1 -1
  11. package/cjs/dataset/dataset-pivot-table.d.ts +60 -0
  12. package/cjs/dataset/dataset-pivot-table.js +387 -0
  13. package/cjs/dataset/dataset-pivot-table.js.map +1 -0
  14. package/cjs/dataset/dataset.d.ts +2 -0
  15. package/cjs/dataset/dataset.js +32 -21
  16. package/cjs/dataset/dataset.js.map +1 -1
  17. package/cjs/event/event.js +2 -2
  18. package/cjs/event/event.js.map +1 -1
  19. package/cjs/event/pivot-chart/axis-hover.d.ts +2 -0
  20. package/cjs/event/pivot-chart/axis-hover.js +41 -0
  21. package/cjs/event/pivot-chart/axis-hover.js.map +1 -0
  22. package/cjs/event/scroll.js +4 -3
  23. package/cjs/event/scroll.js.map +1 -1
  24. package/cjs/event/sparkline-event.js +1 -2
  25. package/cjs/event/util.js +1 -0
  26. package/cjs/index.d.ts +1 -1
  27. package/cjs/index.js +1 -1
  28. package/cjs/index.js.map +1 -1
  29. package/cjs/layout/{pivot-chart → chart-helper}/get-axis-config.js +4 -4
  30. package/cjs/layout/chart-helper/get-axis-config.js.map +1 -0
  31. package/cjs/layout/chart-helper/get-chart-spec.d.ts +7 -0
  32. package/cjs/layout/{pivot-chart → chart-helper}/get-chart-spec.js +23 -6
  33. package/cjs/layout/chart-helper/get-chart-spec.js.map +1 -0
  34. package/cjs/layout/pivot-header-layout.d.ts +2 -0
  35. package/cjs/layout/pivot-header-layout.js +8 -2
  36. package/cjs/layout/pivot-header-layout.js.map +1 -1
  37. package/cjs/layout/pivot-layout.d.ts +1 -0
  38. package/cjs/layout/pivot-layout.js +12 -8
  39. package/cjs/layout/pivot-layout.js.map +1 -1
  40. package/cjs/layout/simple-header-layout.d.ts +2 -0
  41. package/cjs/layout/simple-header-layout.js +9 -2
  42. package/cjs/layout/simple-header-layout.js.map +1 -1
  43. package/cjs/plugins/{chartTypes.js → chartModules.js} +1 -1
  44. package/cjs/plugins/chartModules.js.map +1 -0
  45. package/cjs/register.d.ts +1 -1
  46. package/cjs/register.js +6 -6
  47. package/cjs/register.js.map +1 -1
  48. package/cjs/render/layout/text.d.ts +33 -4
  49. package/cjs/render/layout/text.js +9 -3
  50. package/cjs/render/layout/text.js.map +1 -1
  51. package/cjs/scenegraph/component/custom.js +17 -16
  52. package/cjs/scenegraph/component/custom.js.map +1 -1
  53. package/cjs/scenegraph/component/menu.d.ts +41 -0
  54. package/cjs/scenegraph/graphic/chart.d.ts +1 -1
  55. package/cjs/scenegraph/graphic/chart.js +9 -12
  56. package/cjs/scenegraph/graphic/chart.js.map +1 -1
  57. package/cjs/scenegraph/graphic/contributions/chart-render.js +10 -3
  58. package/cjs/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  59. package/cjs/scenegraph/graphic/contributions/group-contribution-render.d.ts +9 -9
  60. package/cjs/scenegraph/graphic/contributions/group-contribution-render.js +48 -29
  61. package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  62. package/cjs/scenegraph/graphic/contributions/image-contribution-render.d.ts +3 -3
  63. package/cjs/scenegraph/graphic/contributions/image-contribution-render.js +2 -2
  64. package/cjs/scenegraph/graphic/contributions/image-contribution-render.js.map +1 -1
  65. package/cjs/scenegraph/graphic/contributions/rect-contribution-render.d.ts +3 -3
  66. package/cjs/scenegraph/graphic/contributions/rect-contribution-render.js +2 -2
  67. package/cjs/scenegraph/graphic/contributions/rect-contribution-render.js.map +1 -1
  68. package/cjs/scenegraph/graphic/text.d.ts +15 -0
  69. package/cjs/scenegraph/group-creater/cell-helper.js +2 -1
  70. package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
  71. package/cjs/scenegraph/group-creater/cell-type/chart-cell.d.ts +1 -1
  72. package/cjs/scenegraph/group-creater/cell-type/chart-cell.js +4 -4
  73. package/cjs/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
  74. package/cjs/scenegraph/layout/update-width.js +32 -2
  75. package/cjs/scenegraph/layout/update-width.js.map +1 -1
  76. package/cjs/scenegraph/refresh-node/update-chart.js +31 -5
  77. package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -1
  78. package/cjs/scenegraph/scenegraph.d.ts +1 -2
  79. package/cjs/scenegraph/scenegraph.js +11 -41
  80. package/cjs/scenegraph/scenegraph.js.map +1 -1
  81. package/cjs/scenegraph/stick-text/index.js +4 -4
  82. package/cjs/scenegraph/stick-text/index.js.map +1 -1
  83. package/cjs/scenegraph/style/corner-cell.d.ts +3 -0
  84. package/cjs/scenegraph/style/corner-cell.js +29 -0
  85. package/cjs/scenegraph/style/corner-cell.js.map +1 -0
  86. package/cjs/scenegraph/style/frame-border.d.ts +1 -0
  87. package/cjs/scenegraph/style/frame-border.js +2 -2
  88. package/cjs/scenegraph/style/frame-border.js.map +1 -1
  89. package/cjs/scenegraph/utils/get-cell-merge.js +2 -1
  90. package/cjs/scenegraph/utils/get-cell-merge.js.map +1 -1
  91. package/cjs/themes/DARK.js +1 -2
  92. package/cjs/themes/DEFAULT.js +2 -1
  93. package/cjs/themes/theme.d.ts +10 -0
  94. package/cjs/themes/theme.js +50 -4
  95. package/cjs/themes/theme.js.map +1 -1
  96. package/cjs/tools/debounce.js +1 -1
  97. package/cjs/ts-types/customElement.d.ts +2 -0
  98. package/cjs/ts-types/customElement.js.map +1 -1
  99. package/cjs/ts-types/events.d.ts +8 -0
  100. package/cjs/ts-types/events.js.map +1 -1
  101. package/cjs/ts-types/list-table/define/basic-define.js.map +1 -1
  102. package/cjs/ts-types/list-table/define/chart-define.d.ts +1 -1
  103. package/cjs/ts-types/list-table/define/chart-define.js.map +1 -1
  104. package/cjs/ts-types/list-table/layout-map/api.d.ts +2 -2
  105. package/cjs/ts-types/list-table/layout-map/api.js.map +1 -1
  106. package/cjs/ts-types/new-data-set.d.ts +1 -0
  107. package/cjs/ts-types/new-data-set.js.map +1 -1
  108. package/cjs/ts-types/pivot-table/indicator/basic-indicator.js.map +1 -1
  109. package/cjs/ts-types/pivot-table/indicator/chart-indicator.d.ts +1 -1
  110. package/cjs/ts-types/pivot-table/indicator/chart-indicator.js.map +1 -1
  111. package/cjs/ts-types/theme.d.ts +5 -0
  112. package/cjs/ts-types/theme.js.map +1 -1
  113. package/dist/vtable.js +35578 -33046
  114. package/dist/vtable.min.js +4 -4
  115. package/es/PivotChart.d.ts +1 -0
  116. package/es/PivotChart.js +8 -0
  117. package/es/PivotChart.js.map +1 -1
  118. package/es/{chartType.js → chartModule.js} +2 -2
  119. package/es/chartModule.js.map +1 -0
  120. package/es/core/BaseTable.js +26 -9
  121. package/es/core/BaseTable.js.map +1 -1
  122. package/es/core/TABLE_EVENT_TYPE.d.ts +2 -0
  123. package/es/core/TABLE_EVENT_TYPE.js +3 -1
  124. package/es/core/TABLE_EVENT_TYPE.js.map +1 -1
  125. package/es/dataset/dataset-pivot-table.d.ts +60 -0
  126. package/es/dataset/dataset-pivot-table.js +378 -0
  127. package/es/dataset/dataset-pivot-table.js.map +1 -0
  128. package/es/dataset/dataset.d.ts +2 -0
  129. package/es/dataset/dataset.js +29 -18
  130. package/es/dataset/dataset.js.map +1 -1
  131. package/es/event/event.js +3 -1
  132. package/es/event/event.js.map +1 -1
  133. package/es/event/pivot-chart/axis-hover.d.ts +2 -0
  134. package/es/event/pivot-chart/axis-hover.js +33 -0
  135. package/es/event/pivot-chart/axis-hover.js.map +1 -0
  136. package/es/event/scroll.js +4 -3
  137. package/es/event/scroll.js.map +1 -1
  138. package/es/event/sparkline-event.js +1 -2
  139. package/es/event/util.js +2 -1
  140. package/es/index.d.ts +1 -1
  141. package/es/index.js +1 -1
  142. package/es/index.js.map +1 -1
  143. package/es/layout/{pivot-chart → chart-helper}/get-axis-config.js +4 -4
  144. package/es/layout/chart-helper/get-axis-config.js.map +1 -0
  145. package/es/layout/chart-helper/get-chart-spec.d.ts +7 -0
  146. package/es/layout/{pivot-chart → chart-helper}/get-chart-spec.js +21 -4
  147. package/es/layout/chart-helper/get-chart-spec.js.map +1 -0
  148. package/es/layout/pivot-header-layout.d.ts +2 -0
  149. package/es/layout/pivot-header-layout.js +9 -1
  150. package/es/layout/pivot-header-layout.js.map +1 -1
  151. package/es/layout/pivot-layout.d.ts +1 -0
  152. package/es/layout/pivot-layout.js +13 -9
  153. package/es/layout/pivot-layout.js.map +1 -1
  154. package/es/layout/simple-header-layout.d.ts +2 -0
  155. package/es/layout/simple-header-layout.js +10 -1
  156. package/es/layout/simple-header-layout.js.map +1 -1
  157. package/es/plugins/chartModules.js +2 -0
  158. package/es/plugins/chartModules.js.map +1 -0
  159. package/es/register.d.ts +1 -1
  160. package/es/register.js +3 -3
  161. package/es/register.js.map +1 -1
  162. package/es/render/layout/text.d.ts +33 -4
  163. package/es/render/layout/text.js +9 -3
  164. package/es/render/layout/text.js.map +1 -1
  165. package/es/scenegraph/component/custom.js +17 -16
  166. package/es/scenegraph/component/custom.js.map +1 -1
  167. package/es/scenegraph/component/menu.d.ts +41 -0
  168. package/es/scenegraph/graphic/chart.d.ts +1 -1
  169. package/es/scenegraph/graphic/chart.js +8 -11
  170. package/es/scenegraph/graphic/chart.js.map +1 -1
  171. package/es/scenegraph/graphic/contributions/chart-render.js +10 -3
  172. package/es/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  173. package/es/scenegraph/graphic/contributions/group-contribution-render.d.ts +9 -9
  174. package/es/scenegraph/graphic/contributions/group-contribution-render.js +48 -29
  175. package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  176. package/es/scenegraph/graphic/contributions/image-contribution-render.d.ts +3 -3
  177. package/es/scenegraph/graphic/contributions/image-contribution-render.js +2 -2
  178. package/es/scenegraph/graphic/contributions/image-contribution-render.js.map +1 -1
  179. package/es/scenegraph/graphic/contributions/rect-contribution-render.d.ts +3 -3
  180. package/es/scenegraph/graphic/contributions/rect-contribution-render.js +2 -2
  181. package/es/scenegraph/graphic/contributions/rect-contribution-render.js.map +1 -1
  182. package/es/scenegraph/graphic/text.d.ts +15 -0
  183. package/es/scenegraph/group-creater/cell-helper.js +2 -1
  184. package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
  185. package/es/scenegraph/group-creater/cell-type/chart-cell.d.ts +1 -1
  186. package/es/scenegraph/group-creater/cell-type/chart-cell.js +4 -4
  187. package/es/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
  188. package/es/scenegraph/layout/update-width.js +33 -1
  189. package/es/scenegraph/layout/update-width.js.map +1 -1
  190. package/es/scenegraph/refresh-node/update-chart.js +27 -2
  191. package/es/scenegraph/refresh-node/update-chart.js.map +1 -1
  192. package/es/scenegraph/scenegraph.d.ts +1 -2
  193. package/es/scenegraph/scenegraph.js +11 -40
  194. package/es/scenegraph/scenegraph.js.map +1 -1
  195. package/es/scenegraph/stick-text/index.js +4 -4
  196. package/es/scenegraph/stick-text/index.js.map +1 -1
  197. package/es/scenegraph/style/corner-cell.d.ts +3 -0
  198. package/es/scenegraph/style/corner-cell.js +25 -0
  199. package/es/scenegraph/style/corner-cell.js.map +1 -0
  200. package/es/scenegraph/style/frame-border.d.ts +1 -0
  201. package/es/scenegraph/style/frame-border.js +1 -1
  202. package/es/scenegraph/style/frame-border.js.map +1 -1
  203. package/es/scenegraph/utils/get-cell-merge.js +2 -1
  204. package/es/scenegraph/utils/get-cell-merge.js.map +1 -1
  205. package/es/themes/DARK.js +1 -2
  206. package/es/themes/DEFAULT.js +2 -1
  207. package/es/themes/theme.d.ts +10 -0
  208. package/es/themes/theme.js +50 -4
  209. package/es/themes/theme.js.map +1 -1
  210. package/es/tools/debounce.js +1 -1
  211. package/es/ts-types/customElement.d.ts +2 -0
  212. package/es/ts-types/customElement.js.map +1 -1
  213. package/es/ts-types/events.d.ts +8 -0
  214. package/es/ts-types/events.js.map +1 -1
  215. package/es/ts-types/list-table/define/basic-define.js.map +1 -1
  216. package/es/ts-types/list-table/define/chart-define.d.ts +1 -1
  217. package/es/ts-types/list-table/define/chart-define.js.map +1 -1
  218. package/es/ts-types/list-table/layout-map/api.d.ts +2 -2
  219. package/es/ts-types/list-table/layout-map/api.js.map +1 -1
  220. package/es/ts-types/new-data-set.d.ts +1 -0
  221. package/es/ts-types/new-data-set.js.map +1 -1
  222. package/es/ts-types/pivot-table/indicator/basic-indicator.js.map +1 -1
  223. package/es/ts-types/pivot-table/indicator/chart-indicator.d.ts +1 -1
  224. package/es/ts-types/pivot-table/indicator/chart-indicator.js.map +1 -1
  225. package/es/ts-types/theme.d.ts +5 -0
  226. package/es/ts-types/theme.js.map +1 -1
  227. package/package.json +9 -9
  228. package/cjs/chartType.js +0 -14
  229. package/cjs/chartType.js.map +0 -1
  230. package/cjs/layout/pivot-chart/get-axis-config.js.map +0 -1
  231. package/cjs/layout/pivot-chart/get-chart-spec.d.ts +0 -4
  232. package/cjs/layout/pivot-chart/get-chart-spec.js.map +0 -1
  233. package/cjs/plugins/chartTypes.js.map +0 -1
  234. package/es/chartType.js.map +0 -1
  235. package/es/layout/pivot-chart/get-axis-config.js.map +0 -1
  236. package/es/layout/pivot-chart/get-chart-spec.d.ts +0 -4
  237. package/es/layout/pivot-chart/get-chart-spec.js.map +0 -1
  238. package/es/plugins/chartTypes.js +0 -2
  239. package/es/plugins/chartTypes.js.map +0 -1
  240. /package/cjs/{chartType.d.ts → chartModule.d.ts} +0 -0
  241. /package/cjs/layout/{pivot-chart → chart-helper}/get-axis-config.d.ts +0 -0
  242. /package/cjs/plugins/{chartTypes.d.ts → chartModules.d.ts} +0 -0
  243. /package/es/{chartType.d.ts → chartModule.d.ts} +0 -0
  244. /package/es/layout/{pivot-chart → chart-helper}/get-axis-config.d.ts +0 -0
  245. /package/es/plugins/{chartTypes.d.ts → chartModules.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["scenegraph/component/custom.ts"],"names":[],"mappings":";;;AACA,+CAAqH;AACrH,2CAAiE;AAEjE,4CAAyC;AACzC,0CAAuC;AACvC,0CAA2C;AAI3C,SAAgB,cAAc,CAC5B,YAA2B,EAC3B,YAA2B,EAC3B,GAAW,EACX,GAAW,EACX,KAAa,EACb,MAAc,EACd,SAAkB,EAClB,UAAmB,EACnB,KAAmB;IAEnB,IAAI,aAAa,GAAG,IAAI,CAAC;IACzB,IAAI,aAAqB,CAAC;IAC1B,IAAI,cAAsB,CAAC;IAC3B,IAAI,cAAc,CAAC;IACnB,IAAI,OAAO,YAAY,KAAK,UAAU,EAAE;QACtC,MAAM,GAAG,GAAG;YACV,GAAG;YACH,GAAG;YACH,SAAS,EAAE,KAAK,CAAC,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC;YAC7C,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE;YACzC,IAAI,EAAE;gBACJ,IAAI,EAAE,CAAC;gBACP,GAAG,EAAE,CAAC;gBACN,KAAK,EAAE,KAAK;gBACZ,MAAM,EAAE,MAAM;gBACd,KAAK;gBACL,MAAM;aACP;YACD,KAAK;SACN,CAAC;QACF,MAAM,eAAe,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;QAG1C,cAAc,GAAG,eAAe,CAAC,aAAa,CAAC,WAAW,CAAC,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QACpF,aAAa,GAAG,eAAe,CAAC,aAAa,CAAC;KAC/C;SAAM,IAAI,OAAO,YAAY,KAAK,UAAU,EAAE;QAC7C,MAAM,GAAG,GAAG;YACV,GAAG;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,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC;KACzC;IACD,OAAO,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AAC3B,CAAC","file":"custom.js","sourcesContent":["import type { Cursor } from '@visactor/vrender';\nimport { createArc, createCircle, createLine, createRect, TextAlignType, TextBaselineType } from '@visactor/vrender';\nimport { isFunction, isString, isValid } from '../../tools/util';\nimport type { ICustomLayout, ICustomRender, ICustomRenderElement, ICustomRenderElements } from '../../ts-types';\nimport { Group } from '../graphic/group';\nimport { Icon } from '../graphic/icon';\nimport { WrapText } from '../graphic/text';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport type { Rect } from '../../render/layout';\n\nexport function dealWithCustom(\n customLayout: ICustomLayout,\n customRender: ICustomRender,\n col: number,\n row: number,\n width: number,\n height: number,\n autoWidth: boolean,\n autoHeight: boolean,\n table: BaseTableAPI\n) {\n let renderDefault = true;\n let expectedWidth: number;\n let expectedHeight: number;\n let customElements;\n if (typeof customLayout === 'function') {\n const arg = {\n col,\n row,\n dataValue: table.getCellOriginValue(col, row),\n value: table.getCellValue(col, row) || '',\n rect: {\n left: 0,\n top: 0,\n right: width,\n bottom: height,\n width,\n height\n },\n table\n };\n const customRenderObj = customLayout(arg);\n // expectedWidth = customRenderObj.expectedWidth;\n // expectedHeight = customRenderObj.expectedHeight;\n customElements = customRenderObj.rootContainer.getElements(undefined, false, false);\n renderDefault = customRenderObj.renderDefault;\n } else if (typeof customRender === 'function') {\n const arg = {\n col,\n row,\n dataValue: table.getCellOriginValue(col, row),\n value: table.getCellValue(col, row) || '',\n rect: {\n left: 0,\n top: 0,\n right: width,\n bottom: height,\n width,\n height\n },\n table\n };\n const customRenderObj = customRender(arg);\n if (customRenderObj) {\n customElements = customRenderObj.elements;\n renderDefault = customRenderObj.renderDefault;\n expectedWidth = customRenderObj.expectedWidth;\n expectedHeight = customRenderObj.expectedHeight;\n }\n } else if (customRender) {\n expectedWidth = customRender.expectedWidth;\n expectedHeight = customRender.expectedHeight;\n customElements = customRender.elements;\n renderDefault = customRender.renderDefault;\n }\n\n let elementsGroup: Group;\n if (customElements) {\n const value = table.getCellValue(col, row);\n elementsGroup = adjustElementToGroup(\n customElements,\n autoWidth ? expectedWidth : width,\n autoHeight ? expectedHeight : height,\n value\n );\n }\n\n return {\n elementsGroup,\n renderDefault\n };\n}\n\nfunction adjustElementToGroup(\n elements: ICustomRenderElements,\n width: number,\n height: number,\n value: any\n): Group | undefined {\n const customGroup = new Group({\n x: 0,\n y: 0,\n width,\n height,\n fill: false,\n stroke: false,\n pickable: false\n });\n customGroup.name = 'custom-container';\n\n const elementsAdjusted = adjustElementsPos(elements, width, height, value);\n elementsAdjusted.forEach(element => {\n switch (element.type) {\n case 'arc':\n const arc = createArc({\n x: element.x as number,\n y: element.y as number,\n dx: (element.dx ?? 0) as number,\n dy: (element.dy ?? 0) as number,\n fill: element.fill as string,\n stroke: element.stroke as string,\n outerRadius: element.radius as number,\n startAngle: element.startAngle as number,\n endAngle: element.endAngle as number,\n pickable: !!element.clickable,\n cursor: element.cursor as Cursor\n });\n customGroup.appendChild(arc);\n break;\n case 'text':\n if (element.background) {\n const expandX = element.background?.expandX ?? 0;\n const expandY = element.background?.expandY ?? 0;\n const textBackRect = createRect({\n x: (element.x as number) - expandX,\n y: (element.y as number) - expandY,\n dx: (element.dx ?? 0) as number,\n dy: (element.dy ?? 0) as number,\n width: element.width + expandX * 2,\n height: element.height + expandY * 2,\n cornerRadius: element.background?.cornerRadius ?? 0,\n // fill: true,\n fill: element.background?.fill ?? '#888'\n });\n customGroup.appendChild(textBackRect);\n }\n const text = new WrapText(\n Object.assign(\n {\n pickable: !!element.clickable\n },\n element as any\n )\n );\n customGroup.appendChild(text);\n break;\n case 'rect':\n const rect = createRect({\n x: element.x as number,\n y: element.y as number,\n dx: (element.dx ?? 0) as number,\n dy: (element.dy ?? 0) as number,\n width: element.width as number,\n height: element.height as number,\n cornerRadius: element.radius as number,\n fill: element.fill as string,\n stroke: element.stroke as string,\n pickable: !!element.clickable,\n cursor: element.cursor as Cursor\n });\n customGroup.appendChild(rect);\n break;\n case 'circle':\n const circle = createCircle({\n x: element.x as number,\n y: element.y as number,\n dx: (element.dx ?? 0) as number,\n dy: (element.dy ?? 0) as number,\n radius: element.radius as number,\n fill: element.fill as string,\n stroke: element.stroke as string,\n pickable: !!element.clickable,\n cursor: element.cursor as Cursor\n });\n customGroup.appendChild(circle);\n break;\n case 'icon':\n const icon = new Icon({\n x: element.x as number,\n y: element.y as number,\n dx: (element.dx ?? 0) as number,\n dy: (element.dy ?? 0) as number,\n width: element.width as number,\n height: element.height as number,\n image: element.svg as string,\n backgroundWidth: element.hover ? ((element.hover.width ?? element.width) as number) : undefined,\n backgroundHeight: element.hover ? ((element.hover.width ?? element.width) as number) : undefined,\n backgroundColor: element.hover ? element.hover.bgColor ?? 'rgba(22,44,66,0.2)' : undefined,\n pickable: !!element.clickable,\n cursor: element.cursor as Cursor\n });\n icon.role = 'icon-custom';\n customGroup.appendChild(icon);\n break;\n case 'image':\n const image = new Icon({\n x: element.x as number,\n y: element.y as number,\n dx: (element.dx ?? 0) as number,\n dy: (element.dy ?? 0) as number,\n width: element.width as number,\n height: element.height as number,\n image: element.src as string,\n backgroundWidth: element.hover ? ((element.hover.width ?? element.width) as number) : undefined,\n backgroundHeight: element.hover ? ((element.hover.width ?? element.width) as number) : undefined,\n backgroundColor: element.hover ? element.hover.bgColor ?? 'rgba(22,44,66,0.2)' : undefined,\n pickable: !!element.clickable,\n cursor: element.cursor as Cursor,\n shape: element.shape\n });\n image.role = 'image-custom';\n customGroup.appendChild(image);\n break;\n\n case 'line':\n const line = createLine({\n points: element.points,\n stroke: element.stroke as string,\n pickable: !!element.clickable,\n cursor: element.cursor as Cursor\n });\n customGroup.appendChild(line);\n break;\n }\n });\n\n return customGroup;\n}\n\nfunction adjustElementsPos(\n originalElements: ICustomRenderElements,\n // rect: RectProps,\n width: number,\n height: number,\n // borderLineWidths: number[],\n value: any\n): ICustomRenderElements {\n const result: ICustomRenderElements = [];\n // const { left, top, width, height } = rect;\n const left = 0;\n const top = 0;\n const borderLineWidths = [0, 0, 0, 0];\n\n for (let i = 0; i < originalElements.length; i++) {\n const originalElement = originalElements[i];\n const element = Object.assign({}, originalElement);\n // 执行相关函数\n for (const name in element) {\n if (element.hasOwnProperty(name) && isFunction(element[name])) {\n element[name] = (element[name] as Function)(value);\n }\n }\n\n // 转换字符串值(百分比、px)\n const rect = element as Rect;\n if (isValid(rect.x)) {\n rect.x = isString(rect.x)\n ? transformString((rect as any).x as string, width - borderLineWidths[1])\n : Number(rect.x);\n rect.y = isString(rect.y)\n ? transformString((rect as any).y as string, height - borderLineWidths[2])\n : Number(rect.y);\n }\n if ('width' in element) {\n element.width = isString(element.width)\n ? transformString(element.width as string, width - borderLineWidths[1])\n : Number(element.width);\n }\n if ('height' in element) {\n element.height = isString(element.height)\n ? transformString(element.height as string, height - borderLineWidths[2])\n : Number(element.height);\n }\n if ('radius' in element) {\n element.radius = isString(element.radius)\n ? transformString(element.radius as string, Math.min(width - borderLineWidths[1], height - borderLineWidths[2]))\n : Number(element.radius);\n }\n if ('hover' in element) {\n // 转换字符串值(百分比、px)\n element.hover.x = isString(element.hover.x)\n ? transformString(element.hover.x as string, width - borderLineWidths[1])\n : Number(element.hover.x);\n element.hover.y = isString(element.hover.y)\n ? transformString(element.hover.y as string, height - borderLineWidths[2])\n : Number(element.hover.y);\n element.hover.width = isString(element.hover.width)\n ? transformString(element.hover.width as string, width - borderLineWidths[1])\n : Number(element.hover.width);\n\n element.hover.height = isString(element.hover.height)\n ? transformString(element.hover.height as string, height - borderLineWidths[2])\n : Number(element.hover.height);\n element.hover.x += left;\n element.hover.y += top;\n }\n // 矫正位置\n rect.x = rect.x + left;\n rect.y = rect.y + top;\n\n result.push(element as unknown as ICustomRenderElement);\n }\n\n return result;\n}\n\nfunction transformString(str: string, size?: number): number {\n if (str.endsWith('px')) {\n return parseInt(str, 10);\n } else if (str.endsWith('%') && size) {\n return (parseInt(str, 10) / 100) * size;\n }\n return parseInt(str, 10);\n}\n"]}
1
+ {"version":3,"sources":["scenegraph/component/custom.ts"],"names":[],"mappings":";;;AACA,+CAAqH;AACrH,2CAAiE;AAEjE,4CAAyC;AACzC,0CAAuC;AACvC,0CAA2C;AAI3C,SAAgB,cAAc,CAC5B,YAA2B,EAC3B,YAA2B,EAC3B,GAAW,EACX,GAAW,EACX,KAAa,EACb,MAAc,EACd,SAAkB,EAClB,UAAmB,EACnB,KAAmB;IAEnB,IAAI,aAAa,GAAG,IAAI,CAAC;IACzB,IAAI,aAAqB,CAAC;IAC1B,IAAI,cAAsB,CAAC;IAC3B,IAAI,cAAc,CAAC;IACnB,IAAI,OAAO,YAAY,KAAK,UAAU,EAAE;QACtC,MAAM,GAAG,GAAG;YACV,GAAG;YACH,GAAG;YACH,SAAS,EAAE,KAAK,CAAC,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC;YAC7C,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE;YACzC,IAAI,EAAE;gBACJ,IAAI,EAAE,CAAC;gBACP,GAAG,EAAE,CAAC;gBACN,KAAK,EAAE,KAAK;gBACZ,MAAM,EAAE,MAAM;gBACd,KAAK;gBACL,MAAM;aACP;YACD,KAAK;SACN,CAAC;QACF,MAAM,eAAe,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;QAG1C,cAAc,GAAG,eAAe,CAAC,aAAa,CAAC,WAAW,CAAC,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QACpF,aAAa,GAAG,eAAe,CAAC,aAAa,CAAC;KAC/C;SAAM,IAAI,OAAO,YAAY,KAAK,UAAU,EAAE;QAC7C,MAAM,GAAG,GAAG;YACV,GAAG;YACH,GAAG;YACH,SAAS,EAAE,KAAK,CAAC,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC;YAC7C,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AG,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC;KACzC;IACD,OAAO,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AAC3B,CAAC","file":"custom.js","sourcesContent":["import type { Cursor } from '@visactor/vrender';\nimport { createArc, createCircle, createLine, createRect, TextAlignType, TextBaselineType } from '@visactor/vrender';\nimport { isFunction, isString, isValid } from '../../tools/util';\nimport type { ICustomLayout, ICustomRender, ICustomRenderElement, ICustomRenderElements } from '../../ts-types';\nimport { Group } from '../graphic/group';\nimport { Icon } from '../graphic/icon';\nimport { WrapText } from '../graphic/text';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport type { Rect } from '../../render/layout';\n\nexport function dealWithCustom(\n customLayout: ICustomLayout,\n customRender: ICustomRender,\n col: number,\n row: number,\n width: number,\n height: number,\n autoWidth: boolean,\n autoHeight: boolean,\n table: BaseTableAPI\n) {\n let renderDefault = true;\n let expectedWidth: number;\n let expectedHeight: number;\n let customElements;\n if (typeof customLayout === 'function') {\n const arg = {\n col,\n row,\n dataValue: table.getCellOriginValue(col, row),\n value: table.getCellValue(col, row) || '',\n rect: {\n left: 0,\n top: 0,\n right: width,\n bottom: height,\n width,\n height\n },\n table\n };\n const customRenderObj = customLayout(arg);\n // expectedWidth = customRenderObj.expectedWidth;\n // expectedHeight = customRenderObj.expectedHeight;\n customElements = customRenderObj.rootContainer.getElements(undefined, false, false);\n renderDefault = customRenderObj.renderDefault;\n } else if (typeof customRender === 'function') {\n const arg = {\n col,\n row,\n dataValue: table.getCellOriginValue(col, row),\n value: table.getCellValue(col, row) || '',\n rect: {\n left: 0,\n top: 0,\n right: width,\n bottom: height,\n width,\n height\n },\n table\n };\n const customRenderObj = customRender(arg);\n if (customRenderObj) {\n customElements = customRenderObj.elements;\n renderDefault = customRenderObj.renderDefault;\n expectedWidth = customRenderObj.expectedWidth;\n expectedHeight = customRenderObj.expectedHeight;\n }\n } else if (customRender) {\n expectedWidth = customRender.expectedWidth;\n expectedHeight = customRender.expectedHeight;\n customElements = customRender.elements;\n renderDefault = customRender.renderDefault;\n }\n\n let elementsGroup: Group;\n if (customElements) {\n const value = table.getCellValue(col, row);\n elementsGroup = adjustElementToGroup(\n customElements,\n autoWidth ? expectedWidth : width,\n autoHeight ? expectedHeight : height,\n value\n );\n }\n\n return {\n elementsGroup,\n renderDefault\n };\n}\n\nfunction adjustElementToGroup(\n elements: ICustomRenderElements,\n width: number,\n height: number,\n value: any\n): Group | undefined {\n const customGroup = new Group({\n x: 0,\n y: 0,\n width,\n height,\n fill: false,\n stroke: false,\n pickable: false\n });\n customGroup.name = 'custom-container';\n\n const elementsAdjusted = adjustElementsPos(elements, width, height, value);\n elementsAdjusted.forEach(element => {\n switch (element.type) {\n case 'arc':\n const arc = createArc({\n x: element.x as number,\n y: element.y as number,\n dx: (element.dx ?? 0) as number,\n dy: (element.dy ?? 0) as number,\n fill: element.fill as string,\n stroke: element.stroke as string,\n outerRadius: element.radius as number,\n startAngle: element.startAngle as number,\n endAngle: element.endAngle as number,\n pickable: !!element.clickable,\n cursor: element.cursor as Cursor\n });\n customGroup.appendChild(arc);\n break;\n case 'text':\n if (element.background) {\n const expandX = element.background?.expandX ?? 0;\n const expandY = element.background?.expandY ?? 0;\n const textBackRect = createRect({\n x: (element.x as number) - expandX,\n y: (element.y as number) - expandY,\n dx: (element.dx ?? 0) as number,\n dy: (element.dy ?? 0) as number,\n width: element.width + expandX * 2,\n height: element.height + expandY * 2,\n cornerRadius: element.background?.cornerRadius ?? 0,\n // fill: true,\n fill: element.background?.fill ?? '#888'\n });\n customGroup.appendChild(textBackRect);\n }\n const text = new WrapText(\n Object.assign(\n {\n pickable: !!element.clickable,\n fill: element.color ?? element.fill\n },\n element as any\n )\n );\n customGroup.appendChild(text);\n break;\n case 'rect':\n const rect = createRect({\n x: element.x as number,\n y: element.y as number,\n dx: (element.dx ?? 0) as number,\n dy: (element.dy ?? 0) as number,\n width: element.width as number,\n height: element.height as number,\n cornerRadius: element.radius as number,\n fill: element.fill as string,\n stroke: element.stroke as string,\n pickable: !!element.clickable,\n cursor: element.cursor as Cursor\n });\n customGroup.appendChild(rect);\n break;\n case 'circle':\n const circle = createCircle({\n x: element.x as number,\n y: element.y as number,\n dx: (element.dx ?? 0) as number,\n dy: (element.dy ?? 0) as number,\n radius: element.radius as number,\n fill: element.fill as string,\n stroke: element.stroke as string,\n pickable: !!element.clickable,\n cursor: element.cursor as Cursor\n });\n customGroup.appendChild(circle);\n break;\n case 'icon':\n const icon = new Icon({\n x: element.x as number,\n y: element.y as number,\n dx: (element.dx ?? 0) as number,\n dy: (element.dy ?? 0) as number,\n width: element.width as number,\n height: element.height as number,\n image: element.svg as string,\n backgroundWidth: element.hover ? ((element.hover.width ?? element.width) as number) : undefined,\n backgroundHeight: element.hover ? ((element.hover.width ?? element.width) as number) : undefined,\n backgroundColor: element.hover ? element.hover.bgColor ?? 'rgba(22,44,66,0.2)' : undefined,\n pickable: !!element.clickable,\n cursor: element.cursor as Cursor\n });\n icon.role = 'icon-custom';\n customGroup.appendChild(icon);\n break;\n case 'image':\n const image = new Icon({\n x: element.x as number,\n y: element.y as number,\n dx: (element.dx ?? 0) as number,\n dy: (element.dy ?? 0) as number,\n width: element.width as number,\n height: element.height as number,\n image: element.src as string,\n backgroundWidth: element.hover ? ((element.hover.width ?? element.width) as number) : undefined,\n backgroundHeight: element.hover ? ((element.hover.width ?? element.width) as number) : undefined,\n backgroundColor: element.hover ? element.hover.bgColor ?? 'rgba(22,44,66,0.2)' : undefined,\n pickable: !!element.clickable,\n cursor: element.cursor as Cursor,\n shape: element.shape\n });\n image.role = 'image-custom';\n customGroup.appendChild(image);\n break;\n\n case 'line':\n const line = createLine({\n points: element.points,\n stroke: element.stroke as string,\n pickable: !!element.clickable,\n cursor: element.cursor as Cursor\n });\n customGroup.appendChild(line);\n break;\n }\n });\n\n return customGroup;\n}\n\nfunction adjustElementsPos(\n originalElements: ICustomRenderElements,\n // rect: RectProps,\n width: number,\n height: number,\n // borderLineWidths: number[],\n value: any\n): ICustomRenderElements {\n const result: ICustomRenderElements = [];\n // const { left, top, width, height } = rect;\n const left = 0;\n const top = 0;\n const borderLineWidths = [0, 0, 0, 0];\n\n for (let i = 0; i < originalElements.length; i++) {\n const originalElement = originalElements[i];\n const element = Object.assign({}, originalElement);\n // 执行相关函数\n for (const name in element) {\n if (element.hasOwnProperty(name) && isFunction(element[name])) {\n element[name] = (element[name] as Function)(value);\n }\n }\n\n // 转换字符串值(百分比、px)\n const rect = element as Rect;\n if (isValid(rect.x)) {\n rect.x = isString(rect.x)\n ? transformString((rect as any).x as string, width - borderLineWidths[1])\n : Number(rect.x);\n rect.y = isString(rect.y)\n ? transformString((rect as any).y as string, height - borderLineWidths[2])\n : Number(rect.y);\n }\n if ('width' in element) {\n element.width = isString(element.width)\n ? transformString(element.width as string, width - borderLineWidths[1])\n : Number(element.width);\n }\n if ('height' in element) {\n element.height = isString(element.height)\n ? transformString(element.height as string, height - borderLineWidths[2])\n : Number(element.height);\n }\n if ('radius' in element) {\n element.radius = isString(element.radius)\n ? transformString(element.radius as string, Math.min(width - borderLineWidths[1], height - borderLineWidths[2]))\n : Number(element.radius);\n }\n if ('hover' in element) {\n // 转换字符串值(百分比、px)\n element.hover.x = isString(element.hover.x)\n ? transformString(element.hover.x as string, width - borderLineWidths[1])\n : Number(element.hover.x);\n element.hover.y = isString(element.hover.y)\n ? transformString(element.hover.y as string, height - borderLineWidths[2])\n : Number(element.hover.y);\n element.hover.width = isString(element.hover.width)\n ? transformString(element.hover.width as string, width - borderLineWidths[1])\n : Number(element.hover.width);\n\n element.hover.height = isString(element.hover.height)\n ? transformString(element.hover.height as string, height - borderLineWidths[2])\n : Number(element.hover.height);\n element.hover.x += left;\n element.hover.y += top;\n }\n // 矫正位置\n rect.x = rect.x + left;\n rect.y = rect.y + top;\n\n result.push(element as unknown as ICustomRenderElement);\n }\n\n return result;\n}\n\nfunction transformString(str: string, size?: number): number {\n if (str.endsWith('px')) {\n return parseInt(str, 10);\n } else if (str.endsWith('%') && size) {\n return (parseInt(str, 10) / 100) * size;\n }\n return parseInt(str, 10);\n}\n"]}
@@ -0,0 +1,41 @@
1
+ import type { IGroup } from '@visactor/vrender';
2
+ import type { MenuListItem } from '../../ts-types';
3
+ import { Group } from '../graphic/group';
4
+ import type { BaseTableAPI } from '../../ts-types/base-table';
5
+ export declare enum MenuType {
6
+ 'dropDown' = "dropDown",
7
+ 'contextmenu' = "contextmenu",
8
+ 'custom' = "custom"
9
+ }
10
+ type MenuInfo = MenuListItem[];
11
+ export declare class MenuHandler {
12
+ private _table;
13
+ private _menuInstance;
14
+ private _menuInfo;
15
+ constructor(table: BaseTableAPI);
16
+ bindTableComponent(componentGroup: Group): void;
17
+ dispose(): void;
18
+ attach(x: number, y: number, col: number, row: number, type: MenuType, menuInfo?: MenuInfo): void;
19
+ updateMenuInfo(col: number, row: number, type: MenuType, menuInfo: MenuListItem[], highlightIndex: number): void;
20
+ checkDropDownMenuChange(col: number, row: number): boolean;
21
+ checkContextMenuChange(x: number, y: number): boolean;
22
+ updateMenuInstance(menuInfo: MenuInfo, highlightIndex: number): void;
23
+ updatePosition(x: number, y: number): void;
24
+ addToScene(): void;
25
+ detach(): void;
26
+ getMenuInfo(col: number, row: number, type: MenuType): {
27
+ menuInfo: MenuListItem[];
28
+ highlightIndex: number;
29
+ };
30
+ bindEvent(): void;
31
+ getEventInfo(target: IGroup): {
32
+ col: number;
33
+ row: number;
34
+ menuKey: string;
35
+ dropDownIndex: number;
36
+ text: string;
37
+ highlight: boolean;
38
+ };
39
+ get bounds(): import("@visactor/vutils").IBounds;
40
+ }
41
+ export {};
@@ -3,7 +3,7 @@ import { Group } from '@visactor/vrender';
3
3
  import type { BaseTableAPI } from '../../ts-types/base-table';
4
4
  interface IChartGraphicAttribute extends IGroupGraphicAttribute {
5
5
  canvas: HTMLCanvasElement;
6
- dataId: string;
6
+ dataId: string | Record<string, string>;
7
7
  data: any;
8
8
  spec: any;
9
9
  axes: any;
@@ -10,18 +10,15 @@ exports.CHART_NUMBER_TYPE = (0, vrender_1.genNumberType)();
10
10
 
11
11
  class Chart extends vrender_1.Group {
12
12
  constructor(params) {
13
- if (super(params), this.type = "chart", this.numberType = exports.CHART_NUMBER_TYPE,
14
- params.chartInstance) this.chartInstance = params.chartInstance; else {
15
- params.canvas.getContext("2d");
16
- params.chartInstance = this.chartInstance = new params.ClassType(params.spec, {
17
- renderCanvas: params.canvas,
18
- mode: "desktop-browser",
19
- canvasControled: !1,
20
- viewBox: params.viewBox,
21
- interactive: !1,
22
- animation: !1
23
- }), this.chartInstance.renderSync();
24
- }
13
+ super(params), this.type = "chart", this.numberType = exports.CHART_NUMBER_TYPE,
14
+ params.chartInstance ? this.chartInstance = params.chartInstance : (params.chartInstance = this.chartInstance = new params.ClassType(params.spec, {
15
+ renderCanvas: params.canvas,
16
+ mode: "desktop-browser",
17
+ canvasControled: !1,
18
+ viewBox: params.viewBox,
19
+ interactive: !1,
20
+ animation: !1
21
+ }), this.chartInstance.renderSync());
25
22
  }
26
23
  activate(table) {
27
24
  var _a, _b, _c, _d;
@@ -1 +1 @@
1
- {"version":3,"sources":["scenegraph/graphic/chart.ts"],"names":[],"mappings":";;;AACA,+CAAyD;AACzD,6CAAqD;AAuBxC,QAAA,iBAAiB,GAAG,IAAA,uBAAa,GAAE,CAAC;AAEjD,MAAa,KAAM,SAAQ,eAAK;IAQ9B,YAAY,MAA8B;QACxC,KAAK,CAAC,MAAM,CAAC,CAAC;QARhB,SAAI,GAAgB,OAAc,CAAC;QASjC,IAAI,CAAC,UAAU,GAAG,yBAAiB,CAAC;QAGpC,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE;YACzB,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAC3C,MAAM,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,GAAG,IAAI,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI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AC,IAAI,GAAG,IAAI,CAAC;IAC7B,CAAC;;AApHH,sBAqHC;AAfQ,UAAI,GAAW,CAAC,CAAC","file":"chart.js","sourcesContent":["import type { GraphicType, IGroupGraphicAttribute } from '@visactor/vrender';\nimport { genNumberType, Group } from '@visactor/vrender';\nimport { Bounds, cloneDeep } from '@visactor/vutils';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport type { PivotChart } from '../../PivotChart';\nimport { clearChartCacheImage, updateChartSize } from '../refresh-node/update-chart';\nimport type { PivotLayoutMap } from '../../layout/pivot-layout';\n\ninterface IChartGraphicAttribute extends IGroupGraphicAttribute {\n canvas: HTMLCanvasElement;\n dataId: string;\n data: any;\n spec: any;\n axes: any;\n ClassType: any;\n chartInstance: any;\n cellPadding: number[];\n viewBox: {\n x1: number;\n y1: number;\n x2: number;\n y2: number;\n };\n}\n\nexport const CHART_NUMBER_TYPE = genNumberType();\n\nexport class Chart extends Group {\n type: GraphicType = 'chart' as any;\n declare attribute: IChartGraphicAttribute;\n chartInstance: any;\n activeChartInstance: any;\n active: boolean;\n cacheCanvas: HTMLCanvasElement; // HTMLCanvasElement\n\n constructor(params: IChartGraphicAttribute) {\n super(params);\n this.numberType = CHART_NUMBER_TYPE;\n\n // 创建chart\n if (!params.chartInstance) {\n const ctx = params.canvas.getContext('2d');\n params.chartInstance = this.chartInstance = new params.ClassType(params.spec, {\n renderCanvas: params.canvas,\n mode: 'desktop-browser',\n canvasControled: false,\n viewBox: params.viewBox,\n interactive: false,\n animation: false\n });\n this.chartInstance.renderSync();\n } else {\n this.chartInstance = params.chartInstance;\n }\n\n // this.chart.load().then((cache) => {\n // this.cacheCanvas = cache;\n // this.deactivate();\n // });\n }\n /**\n * 激活该图表元素\n * @param table\n */\n activate(table: BaseTableAPI) {\n this.active = true;\n // this.chart = new TestChart(this.attribute.spec);\n // const ctx = this.attribute.canvas.getContext('2d');\n const { x1, y1, x2, y2 } = this.attribute.viewBox;\n //获取渲染区域的bound 考虑被表头遮住部分的情况\n const tableBound = table.scenegraph.tableGroup.globalAABBBounds;\n const bodyBound = new Bounds();\n bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();\n bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();\n bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();\n bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();\n const clipBound = bodyBound.intersect({\n x1: x1 - table.scrollLeft,\n x2: x2 - table.scrollLeft,\n y1: y1 - table.scrollTop,\n y2: y2 - table.scrollTop\n });\n this.activeChartInstance = new this.attribute.ClassType(this.attribute.spec, {\n renderCanvas: this.attribute.canvas,\n mode: 'desktop-browser',\n canvasControled: false,\n viewBox: {\n x1: x1 - table.scrollLeft,\n x2: x2 - table.scrollLeft,\n y1: y1 - table.scrollTop,\n y2: y2 - table.scrollTop\n },\n animation: false,\n interactive: true,\n beforeRender: (stage: any) => {\n const ctx = stage.window.getContext();\n ctx.inuse = true;\n ctx.clearMatrix();\n ctx.setTransformForCurrent(true);\n ctx.beginPath();\n ctx.rect(clipBound.x1, clipBound.y1, clipBound.x2 - clipBound.x1, clipBound.y2 - clipBound.y1);\n ctx.clip();\n },\n afterRender(stage: any) {\n const ctx = stage.window.getContext();\n ctx.inuse = false;\n }\n });\n // this.activeChartInstance.updateData('data', this.attribute.data);\n this.activeChartInstance.renderSync();\n\n (table.internalProps.layoutMap as any)?.updateDataStateToActiveChartInstance?.(this.activeChartInstance);\n this.activeChartInstance.on('click', (params: any) => {\n console.log('click captured', params);\n if (Chart.temp) {\n table.scenegraph.updateChartState(params?.datum);\n }\n });\n this.activeChartInstance.on('brushEnd', (params: any) => {\n console.log('brushEnd captured', params);\n table.scenegraph.updateChartState(params?.value?.inBrushData);\n Chart.temp = 0;\n setTimeout(() => {\n Chart.temp = 1;\n }, 0);\n });\n (table as PivotChart)._bindChartEvent?.(this.activeChartInstance);\n console.log('active');\n }\n static temp: number = 1;\n /**\n * 图表失去焦点\n * @param table\n */\n deactivate() {\n this.active = false;\n this.activeChartInstance.release();\n this.activeChartInstance = null;\n console.log('deactivate');\n }\n /** 更新图表对应数据 */\n updateData(data: any) {\n this.attribute.data = data;\n }\n}\n"]}
1
+ {"version":3,"sources":["scenegraph/graphic/chart.ts"],"names":[],"mappings":";;;AACA,+CAAyD;AACzD,6CAAqD;AAuBxC,QAAA,iBAAiB,GAAG,IAAA,uBAAa,GAAE,CAAC;AAEjD,MAAa,KAAM,SAAQ,eAAK;IAQ9B,YAAY,MAA8B;QACxC,KAAK,CAAC,MAAM,CAAC,CAAC;QARhB,SAAI,GAAgB,OAAc,CAAC;QASjC,IAAI,CAAC,UAAU,GAAG,yBAAiB,CAAC;QAGpC,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE;YACzB,MAAM,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,GAAG,IAAI,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE;gBAC5E,YAAY,EAAE,MAAM,CAAC,MAAM;gBAC3B,IAAI,EAAE,iBAAiB;gBACvB,eAAe,EAAE,KAAK;gBACtB,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,WAAW,EAAE,KAAK;gBAClB,SAAS,EAAE,KAAK;aACjB,CAAC,CAAC;YACH,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC;SACjC;aAAM;YACL,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,aAAa,CAAC;SAC3C;IAMH,CAAC;IAKD,QAAQ,CAAC,KAAmB;;QAC1B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QAGnB,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;QAElD,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,gBAAgB,CAAC;QAChE,MAAM,SAAS,GAAG,IAAI,eAAM,EAAE,CAAC;QAC/B,SAAS,CAA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CAAC;YAC9D,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC;YACf,UAAU,CAAC,GAAG,EAAE;gBACd,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC;YACjB,CAAC,EAAE,CAAC,CAAC,CAAC;QACR,CAAC,CAAC,CAAC;QACH,MAAA,MAAC,KAAoB,EAAC,eAAe,mDAAG,IAAI,CAAC,mBAAmB,CAAC,CAAC;QAClE,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACxB,CAAC;IAMD,UAAU;QACR,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,CAAC;QACnC,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;QAChC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAC5B,CAAC;IAED,UAAU,CAAC,IAAS;QAClB,IAAI,CAAC,SAAS,CAAC,IAAI,GAAG,IAAI,CAAC;IAC7B,CAAC;;AAnHH,sBAoHC;AAfQ,UAAI,GAAW,CAAC,CAAC","file":"chart.js","sourcesContent":["import type { GraphicType, IGroupGraphicAttribute } from '@visactor/vrender';\nimport { genNumberType, Group } from '@visactor/vrender';\nimport { Bounds, cloneDeep } from '@visactor/vutils';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport type { PivotChart } from '../../PivotChart';\nimport { clearChartCacheImage, updateChartSize } from '../refresh-node/update-chart';\nimport type { PivotLayoutMap } from '../../layout/pivot-layout';\n\ninterface IChartGraphicAttribute extends IGroupGraphicAttribute {\n canvas: HTMLCanvasElement;\n dataId: string | Record<string, string>; //如果是spec外层的dataId,则是string,否则通过series获取到的是Record<string, string> <dataId, series-chart的指标key用于过滤数据>\n data: any;\n spec: any;\n axes: any;\n ClassType: any;\n chartInstance: any;\n cellPadding: number[];\n viewBox: {\n x1: number;\n y1: number;\n x2: number;\n y2: number;\n };\n}\n\nexport const CHART_NUMBER_TYPE = genNumberType();\n\nexport class Chart extends Group {\n type: GraphicType = 'chart' as any;\n declare attribute: IChartGraphicAttribute;\n chartInstance: any;\n activeChartInstance: any;\n active: boolean;\n cacheCanvas: HTMLCanvasElement; // HTMLCanvasElement\n\n constructor(params: IChartGraphicAttribute) {\n super(params);\n this.numberType = CHART_NUMBER_TYPE;\n\n // 创建chart\n if (!params.chartInstance) {\n params.chartInstance = this.chartInstance = new params.ClassType(params.spec, {\n renderCanvas: params.canvas,\n mode: 'desktop-browser',\n canvasControled: false,\n viewBox: params.viewBox,\n interactive: false,\n animation: false\n });\n this.chartInstance.renderSync();\n } else {\n this.chartInstance = params.chartInstance;\n }\n\n // this.chart.load().then((cache) => {\n // this.cacheCanvas = cache;\n // this.deactivate();\n // });\n }\n /**\n * 激活该图表元素\n * @param table\n */\n activate(table: BaseTableAPI) {\n this.active = true;\n // this.chart = new TestChart(this.attribute.spec);\n // const ctx = this.attribute.canvas.getContext('2d');\n const { x1, y1, x2, y2 } = this.attribute.viewBox;\n //获取渲染区域的bound 考虑被表头遮住部分的情况\n const tableBound = table.scenegraph.tableGroup.globalAABBBounds;\n const bodyBound = new Bounds();\n bodyBound.x1 = tableBound.x1 + table.getFrozenColsWidth();\n bodyBound.x2 = tableBound.x2 - table.getRightFrozenColsWidth();\n bodyBound.y1 = tableBound.y1 + table.getFrozenRowsHeight();\n bodyBound.y2 = tableBound.y2 - table.getBottomFrozenRowsHeight();\n const clipBound = bodyBound.intersect({\n x1: x1 - table.scrollLeft,\n x2: x2 - table.scrollLeft,\n y1: y1 - table.scrollTop,\n y2: y2 - table.scrollTop\n });\n this.activeChartInstance = new this.attribute.ClassType(this.attribute.spec, {\n renderCanvas: this.attribute.canvas,\n mode: 'desktop-browser',\n canvasControled: false,\n viewBox: {\n x1: x1 - table.scrollLeft,\n x2: x2 - table.scrollLeft,\n y1: y1 - table.scrollTop,\n y2: y2 - table.scrollTop\n },\n animation: false,\n interactive: true,\n beforeRender: (stage: any) => {\n const ctx = stage.window.getContext();\n ctx.inuse = true;\n ctx.clearMatrix();\n ctx.setTransformForCurrent(true);\n ctx.beginPath();\n ctx.rect(clipBound.x1, clipBound.y1, clipBound.x2 - clipBound.x1, clipBound.y2 - clipBound.y1);\n ctx.clip();\n },\n afterRender(stage: any) {\n const ctx = stage.window.getContext();\n ctx.inuse = false;\n }\n });\n // this.activeChartInstance.updateData('data', this.attribute.data);\n this.activeChartInstance.renderSync();\n\n (table.internalProps.layoutMap as any)?.updateDataStateToActiveChartInstance?.(this.activeChartInstance);\n this.activeChartInstance.on('click', (params: any) => {\n console.log('click captured', params);\n if (Chart.temp) {\n table.scenegraph.updateChartState(params?.datum);\n }\n });\n this.activeChartInstance.on('brushEnd', (params: any) => {\n console.log('brushEnd captured', params);\n table.scenegraph.updateChartState(params?.value?.inBrushData);\n Chart.temp = 0;\n setTimeout(() => {\n Chart.temp = 1;\n }, 0);\n });\n (table as PivotChart)._bindChartEvent?.(this.activeChartInstance);\n console.log('active');\n }\n static temp: number = 1;\n /**\n * 图表失去焦点\n * @param table\n */\n deactivate() {\n this.active = false;\n this.activeChartInstance.release();\n this.activeChartInstance = null;\n console.log('deactivate');\n }\n /** 更新图表对应数据 */\n updateData(data: any) {\n this.attribute.data = data;\n }\n}\n"]}
@@ -19,10 +19,14 @@ let DefaultCanvasChartRender = class {
19
19
  this.numberType = chart_1.CHART_NUMBER_TYPE;
20
20
  }
21
21
  drawShape(chart, context, x, y, drawContext, params, fillCb, strokeCb) {
22
+ var _a, _b;
22
23
  const groupAttribute = (0, vrender_1.getTheme)(chart, null == params ? void 0 : params.theme).group, {dataId: dataId, data: data, viewBox: viewBox} = chart.attribute, {width: width = groupAttribute.width, height: height = groupAttribute.height} = chart.attribute, {chartInstance: chartInstance, active: active, cacheCanvas: cacheCanvas, activeChartInstance: activeChartInstance} = chart;
23
- if (!active && cacheCanvas) context.drawImage(cacheCanvas, x, y, width, height); else if (activeChartInstance) activeChartInstance.updateDataSync("data", null != data ? data : []); else {
24
+ if (!active && cacheCanvas) context.drawImage(cacheCanvas, x, y, width, height); else if (activeChartInstance) if ("string" == typeof dataId) activeChartInstance.updateDataSync(dataId, null != data ? data : []); else for (const dataIdStr in dataId) {
25
+ const dataIdAndField = dataId[dataIdStr];
26
+ activeChartInstance.updateDataSync(dataIdStr, dataIdAndField ? null !== (_a = data.filter((item => item.hasOwnProperty(dataIdAndField)))) && void 0 !== _a ? _a : [] : null != data ? data : []);
27
+ } else {
24
28
  const {axes: axes} = chart.attribute;
25
- axes.forEach(((axis, index) => {
29
+ if (axes.forEach(((axis, index) => {
26
30
  var _a, _b, _c, _d;
27
31
  if ("linear" === axis.type) {
28
32
  chartInstance._chart._components[index]._domain = {
@@ -38,7 +42,10 @@ let DefaultCanvasChartRender = class {
38
42
  x2: viewBox.x2 - chart.getRootNode().table.scrollLeft,
39
43
  y1: viewBox.y1 - chart.getRootNode().table.scrollTop,
40
44
  y2: viewBox.y2 - chart.getRootNode().table.scrollTop
41
- }), chartInstance.updateDataSync(dataId, null != data ? data : []);
45
+ }), "string" == typeof dataId) chartInstance.updateDataSync(dataId, null != data ? data : []); else for (const dataIdStr in dataId) {
46
+ const dataIdAndField = dataId[dataIdStr];
47
+ chartInstance.updateDataSync(dataIdStr, dataIdAndField ? null !== (_b = data.filter((item => item.hasOwnProperty(dataIdAndField)))) && void 0 !== _b ? _b : [] : null != data ? data : []);
48
+ }
42
49
  const sg = chartInstance.getStage();
43
50
  chart.cacheCanvas = sg.toCanvas();
44
51
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["scenegraph/graphic/contributions/chart-render.ts"],"names":[],"mappings":";;;;;;;;;AAUA,+CAA0G;AAC1G,yCAAsD;AAEtD,oCAA6C;AAEhC,QAAA,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;AACxC,QAAA,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;AAGtE,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAA9B;QAEL,eAAU,GAA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YACH,CAAC,CAAC,CAAC;SACJ;aAAM,IAAI,IAAI,EAAE;YACf,OAAO,CAAC,OAAO,EAAE,CAAC;SACnB;aAAM;YACL,OAAO,CAAC,sBAAsB,EAAE,CAAC;SAClC;IACH,CAAC;CACF,CAAA;AArHY,wBAAwB;IADpC,IAAA,sBAAU,GAAE;GACA,wBAAwB,CAqHpC;AArHY,4DAAwB","file":"chart-render.js","sourcesContent":["import type {\n IGraphicAttribute,\n IContext2d,\n IDrawContext,\n IGraphicRender,\n IGraphicRenderDrawParams,\n IMarkAttribute,\n IRenderService,\n IThemeAttribute\n} from '@visactor/vrender';\nimport { ContributionProvider, getTheme, IGroupRenderContribution, createImage } from '@visactor/vrender';\nimport { inject, injectable, named } from 'inversify';\nimport type { Chart } from '../chart';\nimport { CHART_NUMBER_TYPE } from '../chart';\n\nexport const ChartRender = Symbol.for('ChartRender');\nexport const ChartRenderContribution = Symbol.for('ChartRenderContribution');\n\n@injectable()\nexport class DefaultCanvasChartRender implements IGraphicRender {\n type: 'chart';\n numberType: number = CHART_NUMBER_TYPE;\n\n drawShape(\n chart: Chart,\n context: IContext2d,\n x: number,\n y: number,\n drawContext: IDrawContext,\n params?: IGraphicRenderDrawParams,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean\n ) {\n const groupAttribute = getTheme(chart, params?.theme).group;\n\n const { dataId, data, viewBox } = chart.attribute;\n const { width = groupAttribute.width, height = groupAttribute.height } = chart.attribute;\n\n const { chartInstance, active, cacheCanvas, activeChartInstance } = chart;\n // console.log('render chart', chart.parent.col, chart.parent.row, viewBox, cacheCanvas);\n if (!active && cacheCanvas) {\n context.drawImage(cacheCanvas, x, y, width, height);\n } else if (activeChartInstance) {\n activeChartInstance.updateDataSync('data', data ?? []);\n } else {\n // console.log('viewBox', viewBox);\n const { axes } = chart.attribute;\n axes.forEach((axis: any, index: number) => {\n if (axis.type === 'linear') {\n const chartAxis = chartInstance._chart._components[index];\n chartAxis._domain = {\n min: axis.range?.min ?? 0,\n max: axis.range?.max ?? 0\n };\n } else if (axis.type === 'band') {\n const chartAxis = chartInstance._chart._components[index];\n chartAxis._spec.domain = axis.domain.slice(0);\n chartAxis.updateScaleDomain();\n }\n });\n chartInstance.updateViewBox({\n x1: viewBox.x1 - (chart.getRootNode() as any).table.scrollLeft,\n x2: viewBox.x2 - (chart.getRootNode() as any).table.scrollLeft,\n y1: viewBox.y1 - (chart.getRootNode() as any).table.scrollTop,\n y2: viewBox.y2 - (chart.getRootNode() as any).table.scrollTop\n });\n chartInstance.updateDataSync(dataId, data ?? []);\n const sg = chartInstance.getStage();\n chart.cacheCanvas = sg.toCanvas(); // 截图空白问题 因为开启了动画 首屏截图是无数据的TODO\n }\n }\n\n draw(chart: Chart, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n const { context } = drawContext;\n if (!context) {\n return;\n }\n // debugger;\n const { clip } = chart.attribute;\n if (clip) {\n context.save();\n } else {\n context.highPerformanceSave();\n }\n // group直接transform\n context.transformFromMatrix(chart.transMatrix, true);\n\n context.beginPath();\n // 如果跳过绘制,那就不绘制\n if (params.skipDraw) {\n this.drawShape(\n chart,\n context,\n 0,\n 0,\n drawContext,\n params,\n () => false,\n () => false\n );\n } else {\n this.drawShape(chart, context, 0, 0, drawContext);\n }\n\n // 绘制子元素的时候要添加scroll\n const chartAttribute = getTheme(chart, params?.theme).group;\n const { scrollX = chartAttribute.scrollX, scrollY = chartAttribute.scrollY } = chart.attribute;\n if (scrollX || scrollY) {\n context.translate(scrollX, scrollY);\n }\n let p: any;\n if (params && params.drawingCb) {\n p = params.drawingCb();\n }\n if (p && p.then) {\n p.then(() => {\n if (clip) {\n context.restore();\n } else {\n context.highPerformanceRestore();\n }\n });\n } else if (clip) {\n context.restore();\n } else {\n context.highPerformanceRestore();\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["scenegraph/graphic/contributions/chart-render.ts"],"names":[],"mappings":";;;;;;;;;AAUA,+CAA0G;AAC1G,yCAAsD;AAEtD,oCAA6C;AAEhC,QAAA,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;AACxC,QAAA,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;AAGtE,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAA9B;QAEL,eAAU,GAAW,yBAAiB,CAAC;IAgJzC,CAAC;IA9IC,SAAS,CACP,KAAY,EACZ,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,WAAyB,EACzB,MAAiC,EACjC,MAIY,EACZ,QAIY;;QAEZ,MAAM,cAAc,GAAG,IAAA,kBAAQ,EAAC,KAAK,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,CAAC,CAAC,KAAK,CAAC;QAE5D,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,SAAS,CAAC;QAClD,MAAM,EAAE,KAAK,GAAG,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,SAAS,CAAC;QAEzF,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE,mBAAmB,EAAE,GAAG,KAAK,CAAC;QAE1E,IAAI,CAAC,MAAM,IAAI,WAAW,EAAE;YAC1B,OAAO,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;SACrD;aAAM,IAAI,mBAAmB,EAAE;YAC9B,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;gBAC9B,mBAAmB,CAAC,cAAc,CAAC,MAAM,EAAE,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI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oBACL,OAAO,CAAC,sBAAsB,EAAE,CAAC;iBAClC;YACH,CAAC,CAAC,CAAC;SACJ;aAAM,IAAI,IAAI,EAAE;YACf,OAAO,CAAC,OAAO,EAAE,CAAC;SACnB;aAAM;YACL,OAAO,CAAC,sBAAsB,EAAE,CAAC;SAClC;IACH,CAAC;CACF,CAAA;AAlJY,wBAAwB;IADpC,IAAA,sBAAU,GAAE;GACA,wBAAwB,CAkJpC;AAlJY,4DAAwB","file":"chart-render.js","sourcesContent":["import type {\n IGraphicAttribute,\n IContext2d,\n IDrawContext,\n IGraphicRender,\n IGraphicRenderDrawParams,\n IMarkAttribute,\n IRenderService,\n IThemeAttribute\n} from '@visactor/vrender';\nimport { ContributionProvider, getTheme, IGroupRenderContribution, createImage } from '@visactor/vrender';\nimport { inject, injectable, named } from 'inversify';\nimport type { Chart } from '../chart';\nimport { CHART_NUMBER_TYPE } from '../chart';\n\nexport const ChartRender = Symbol.for('ChartRender');\nexport const ChartRenderContribution = Symbol.for('ChartRenderContribution');\n\n@injectable()\nexport class DefaultCanvasChartRender implements IGraphicRender {\n type: 'chart';\n numberType: number = CHART_NUMBER_TYPE;\n\n drawShape(\n chart: Chart,\n context: IContext2d,\n x: number,\n y: number,\n drawContext: IDrawContext,\n params?: IGraphicRenderDrawParams,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean\n ) {\n const groupAttribute = getTheme(chart, params?.theme).group;\n\n const { dataId, data, viewBox } = chart.attribute;\n const { width = groupAttribute.width, height = groupAttribute.height } = chart.attribute;\n\n const { chartInstance, active, cacheCanvas, activeChartInstance } = chart;\n // console.log('render chart', chart.parent.col, chart.parent.row, viewBox, cacheCanvas);\n if (!active && cacheCanvas) {\n context.drawImage(cacheCanvas, x, y, width, height);\n } else if (activeChartInstance) {\n if (typeof dataId === 'string') {\n activeChartInstance.updateDataSync(dataId, data ?? []);\n } else {\n // 如果是组合图有series系列 需要组个设置数据 这里的data包括的单元格完整数据 需要根据key过滤\n for (const dataIdStr in dataId) {\n const dataIdAndField = dataId[dataIdStr];\n activeChartInstance.updateDataSync(\n dataIdStr,\n dataIdAndField\n ? data.filter((item: any) => {\n return item.hasOwnProperty(dataIdAndField);\n }) ?? []\n : data ?? []\n );\n }\n }\n } else {\n // console.log('viewBox', viewBox);\n const { axes } = chart.attribute;\n axes.forEach((axis: any, index: number) => {\n if (axis.type === 'linear') {\n const chartAxis = chartInstance._chart._components[index];\n chartAxis._domain = {\n min: axis.range?.min ?? 0,\n max: axis.range?.max ?? 0\n };\n } else if (axis.type === 'band') {\n const chartAxis = chartInstance._chart._components[index];\n chartAxis._spec.domain = axis.domain.slice(0);\n chartAxis.updateScaleDomain();\n }\n });\n chartInstance.updateViewBox({\n x1: viewBox.x1 - (chart.getRootNode() as any).table.scrollLeft,\n x2: viewBox.x2 - (chart.getRootNode() as any).table.scrollLeft,\n y1: viewBox.y1 - (chart.getRootNode() as any).table.scrollTop,\n y2: viewBox.y2 - (chart.getRootNode() as any).table.scrollTop\n });\n if (typeof dataId === 'string') {\n chartInstance.updateDataSync(dataId, data ?? []);\n } else {\n for (const dataIdStr in dataId) {\n const dataIdAndField = dataId[dataIdStr];\n chartInstance.updateDataSync(\n dataIdStr,\n dataIdAndField\n ? data.filter((item: any) => {\n return item.hasOwnProperty(dataIdAndField);\n }) ?? []\n : data ?? []\n );\n }\n }\n const sg = chartInstance.getStage();\n chart.cacheCanvas = sg.toCanvas(); // 截图空白问题 因为开启了动画 首屏截图是无数据的TODO\n }\n }\n\n draw(chart: Chart, renderService: IRenderService, drawContext: IDrawContext, params?: IGraphicRenderDrawParams) {\n const { context } = drawContext;\n if (!context) {\n return;\n }\n // debugger;\n const { clip } = chart.attribute;\n if (clip) {\n context.save();\n } else {\n context.highPerformanceSave();\n }\n // group直接transform\n context.transformFromMatrix(chart.transMatrix, true);\n\n context.beginPath();\n // 如果跳过绘制,那就不绘制\n if (params.skipDraw) {\n this.drawShape(\n chart,\n context,\n 0,\n 0,\n drawContext,\n params,\n () => false,\n () => false\n );\n } else {\n this.drawShape(chart, context, 0, 0, drawContext);\n }\n\n // 绘制子元素的时候要添加scroll\n const chartAttribute = getTheme(chart, params?.theme).group;\n const { scrollX = chartAttribute.scrollX, scrollY = chartAttribute.scrollY } = chart.attribute;\n if (scrollX || scrollY) {\n context.translate(scrollX, scrollY);\n }\n let p: any;\n if (params && params.drawingCb) {\n p = params.drawingCb();\n }\n if (p && p.then) {\n p.then(() => {\n if (clip) {\n context.restore();\n } else {\n context.highPerformanceRestore();\n }\n });\n } else if (clip) {\n context.restore();\n } else {\n context.highPerformanceRestore();\n }\n }\n}\n"]}
@@ -1,10 +1,10 @@
1
- import type { IGroup, IContext2d, IGroupGraphicAttribute, IMarkAttribute, IGraphicAttribute, IThemeAttribute, IGroupRenderContribution } from '@visactor/vrender';
1
+ import type { IGroup, IContext2d, IGroupGraphicAttribute, IMarkAttribute, IGraphicAttribute, IThemeAttribute, IGroupRenderContribution, IDrawContext } from '@visactor/vrender';
2
2
  import { BaseRenderContributionTime } from '@visactor/vrender';
3
3
  export declare class SplitGroupBeforeRenderContribution implements IGroupRenderContribution {
4
4
  time: BaseRenderContributionTime;
5
5
  useStyle: boolean;
6
6
  order: number;
7
- drawShape(group: IGroup, context: IContext2d, x: number, y: number, doFill: boolean, doStroke: boolean, fVisible: boolean, sVisible: boolean, groupAttribute: Required<IGroupGraphicAttribute>, fillCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, strokeCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, doFillOrStroke?: {
7
+ drawShape(group: IGroup, context: IContext2d, x: number, y: number, doFill: boolean, doStroke: boolean, fVisible: boolean, sVisible: boolean, groupAttribute: Required<IGroupGraphicAttribute>, drawContext: IDrawContext, fillCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, strokeCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, doFillOrStroke?: {
8
8
  doFill: boolean;
9
9
  doStroke: boolean;
10
10
  }): void;
@@ -13,7 +13,7 @@ export declare class SplitGroupAfterRenderContribution implements IGroupRenderCo
13
13
  time: BaseRenderContributionTime;
14
14
  useStyle: boolean;
15
15
  order: number;
16
- drawShape(group: IGroup, context: IContext2d, x: number, y: number, doFill: boolean, doStroke: boolean, fVisible: boolean, sVisible: boolean, groupAttribute: Required<IGroupGraphicAttribute>, fillCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, strokeCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean): void;
16
+ drawShape(group: IGroup, context: IContext2d, x: number, y: number, doFill: boolean, doStroke: boolean, fVisible: boolean, sVisible: boolean, groupAttribute: Required<IGroupGraphicAttribute>, drawContext: IDrawContext, fillCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, strokeCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean): void;
17
17
  }
18
18
  export declare function getWidthInfo(widthArray: number[] | number): {
19
19
  isSplitDraw: boolean;
@@ -27,7 +27,7 @@ export declare class DashGroupBeforeRenderContribution implements IGroupRenderCo
27
27
  time: BaseRenderContributionTime;
28
28
  useStyle: boolean;
29
29
  order: number;
30
- drawShape(group: IGroup, context: IContext2d, x: number, y: number, doFill: boolean, doStroke: boolean, fVisible: boolean, sVisible: boolean, groupAttribute: Required<IGroupGraphicAttribute>, fillCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, strokeCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, doFillOrStroke?: {
30
+ drawShape(group: IGroup, context: IContext2d, x: number, y: number, doFill: boolean, doStroke: boolean, fVisible: boolean, sVisible: boolean, groupAttribute: Required<IGroupGraphicAttribute>, drawContext: IDrawContext, fillCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, strokeCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, doFillOrStroke?: {
31
31
  doFill: boolean;
32
32
  doStroke: boolean;
33
33
  }): void;
@@ -36,13 +36,13 @@ export declare class DashGroupAfterRenderContribution implements IGroupRenderCon
36
36
  time: BaseRenderContributionTime;
37
37
  useStyle: boolean;
38
38
  order: number;
39
- drawShape(group: IGroup, context: IContext2d, x: number, y: number, doFill: boolean, doStroke: boolean, fVisible: boolean, sVisible: boolean, groupAttribute: Required<IGroupGraphicAttribute>, fillCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, strokeCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean): void;
39
+ drawShape(group: IGroup, context: IContext2d, x: number, y: number, doFill: boolean, doStroke: boolean, fVisible: boolean, sVisible: boolean, groupAttribute: Required<IGroupGraphicAttribute>, drawContext: IDrawContext, fillCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, strokeCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean): void;
40
40
  }
41
41
  export declare class AdjustPosGroupBeforeRenderContribution implements IGroupRenderContribution {
42
42
  time: BaseRenderContributionTime;
43
43
  useStyle: boolean;
44
44
  order: number;
45
- drawShape(group: IGroup, context: IContext2d, x: number, y: number, doFill: boolean, doStroke: boolean, fVisible: boolean, sVisible: boolean, groupAttribute: Required<IGroupGraphicAttribute>, fillCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, strokeCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, doFillOrStroke?: {
45
+ drawShape(group: IGroup, context: IContext2d, x: number, y: number, doFill: boolean, doStroke: boolean, fVisible: boolean, sVisible: boolean, groupAttribute: Required<IGroupGraphicAttribute>, drawContext: IDrawContext, fillCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, strokeCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, doFillOrStroke?: {
46
46
  doFill: boolean;
47
47
  doStroke: boolean;
48
48
  }): void;
@@ -51,13 +51,13 @@ export declare class AdjustPosGroupAfterRenderContribution implements IGroupRend
51
51
  time: BaseRenderContributionTime;
52
52
  useStyle: boolean;
53
53
  order: number;
54
- drawShape(group: IGroup, context: IContext2d, x: number, y: number, doFill: boolean, doStroke: boolean, fVisible: boolean, sVisible: boolean, groupAttribute: Required<IGroupGraphicAttribute>, fillCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, strokeCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean): void;
54
+ drawShape(group: IGroup, context: IContext2d, x: number, y: number, doFill: boolean, doStroke: boolean, fVisible: boolean, sVisible: boolean, groupAttribute: Required<IGroupGraphicAttribute>, drawContext: IDrawContext, fillCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, strokeCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean): void;
55
55
  }
56
56
  export declare class AdjustColorGroupBeforeRenderContribution implements IGroupRenderContribution {
57
57
  time: BaseRenderContributionTime;
58
58
  useStyle: boolean;
59
59
  order: number;
60
- drawShape(group: IGroup, context: IContext2d, x: number, y: number, doFill: boolean, doStroke: boolean, fVisible: boolean, sVisible: boolean, groupAttribute: Required<IGroupGraphicAttribute>, fillCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, strokeCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, doFillOrStroke?: {
60
+ drawShape(group: IGroup, context: IContext2d, x: number, y: number, doFill: boolean, doStroke: boolean, fVisible: boolean, sVisible: boolean, groupAttribute: Required<IGroupGraphicAttribute>, drawContext: IDrawContext, fillCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, strokeCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, doFillOrStroke?: {
61
61
  doFill: boolean;
62
62
  doStroke: boolean;
63
63
  }): void;
@@ -66,5 +66,5 @@ export declare class AdjustColorGroupAfterRenderContribution implements IGroupRe
66
66
  time: BaseRenderContributionTime;
67
67
  useStyle: boolean;
68
68
  order: number;
69
- drawShape(group: IGroup, context: IContext2d, x: number, y: number, doFill: boolean, doStroke: boolean, fVisible: boolean, sVisible: boolean, groupAttribute: Required<IGroupGraphicAttribute>, fillCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, strokeCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean): void;
69
+ drawShape(group: IGroup, context: IContext2d, x: number, y: number, doFill: boolean, doStroke: boolean, fVisible: boolean, sVisible: boolean, groupAttribute: Required<IGroupGraphicAttribute>, drawContext: IDrawContext, fillCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean, strokeCb?: (ctx: IContext2d, markAttribute: Partial<IMarkAttribute & IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean): void;
70
70
  }
@@ -17,7 +17,7 @@ let SplitGroupBeforeRenderContribution = class {
17
17
  this.time = vrender_1.BaseRenderContributionTime.beforeFillStroke, this.useStyle = !0,
18
18
  this.order = 0;
19
19
  }
20
- drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, fillCb, strokeCb, doFillOrStroke) {
20
+ drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, drawContext, fillCb, strokeCb, doFillOrStroke) {
21
21
  const {stroke: stroke = groupAttribute.stroke, strokeArrayWidth: strokeArrayWidth = groupAttribute.strokeArrayWidth, strokeArrayColor: strokeArrayColor = groupAttribute.strokeArrayColor} = group.attribute;
22
22
  stroke && (Array.isArray(strokeArrayWidth) || Array.isArray(strokeArrayColor)) && (doFillOrStroke.doStroke = !1);
23
23
  }
@@ -31,10 +31,18 @@ let SplitGroupAfterRenderContribution = class {
31
31
  this.time = vrender_1.BaseRenderContributionTime.afterFillStroke, this.useStyle = !0,
32
32
  this.order = 0;
33
33
  }
34
- drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, fillCb, strokeCb) {
34
+ drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, drawContext, fillCb, strokeCb) {
35
35
  const {width: width = groupAttribute.width, height: height = groupAttribute.height, stroke: stroke = groupAttribute.stroke, strokeArrayColor: strokeArrayColor = groupAttribute.strokeArrayColor, strokeArrayWidth: strokeArrayWidth = groupAttribute.strokeArrayWidth, lineWidth: lineWidth = groupAttribute.lineWidth, strokeColor: strokeColor = groupAttribute.stroke} = group.attribute;
36
- stroke && (Array.isArray(strokeArrayWidth) || 0 !== lineWidth) && (Array.isArray(strokeArrayColor) || Array.isArray(strokeArrayWidth)) && (("number" == typeof lineWidth && 1 & lineWidth || Array.isArray(strokeArrayWidth) && strokeArrayWidth.some((width => 1 & width))) && (x = Math.floor(x) + .5,
37
- y = Math.floor(y) + .5), renderStroke(group, context, x, y, groupAttribute, stroke, strokeArrayWidth || lineWidth, strokeArrayColor || strokeColor, Math.ceil(width), Math.ceil(height)));
36
+ if (!stroke || !Array.isArray(strokeArrayWidth) && 0 === lineWidth) return;
37
+ let widthForStroke, heightForStroke;
38
+ if (Array.isArray(strokeArrayColor) || Array.isArray(strokeArrayWidth)) {
39
+ if ("number" == typeof lineWidth && 1 & lineWidth || Array.isArray(strokeArrayWidth) && strokeArrayWidth.some((width => 1 & width))) {
40
+ x = Math.floor(x) + .5, y = Math.floor(y) + .5;
41
+ const {width: widthFroDraw, height: heightFroDraw} = getCellSizeForDraw(group, Math.ceil(width), Math.ceil(height));
42
+ widthForStroke = widthFroDraw, heightForStroke = heightFroDraw;
43
+ } else widthForStroke = Math.ceil(width), heightForStroke = Math.ceil(height);
44
+ renderStroke(group, context, x, y, groupAttribute, stroke, strokeArrayWidth || lineWidth, strokeArrayColor || strokeColor, widthForStroke, heightForStroke);
45
+ }
38
46
  }
39
47
  };
40
48
 
@@ -96,7 +104,7 @@ let DashGroupBeforeRenderContribution = class {
96
104
  this.time = vrender_1.BaseRenderContributionTime.beforeFillStroke, this.useStyle = !0,
97
105
  this.order = 0;
98
106
  }
99
- drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, fillCb, strokeCb, doFillOrStroke) {
107
+ drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, drawContext, fillCb, strokeCb, doFillOrStroke) {
100
108
  const {lineDash: lineDash = groupAttribute.lineDash, stroke: stroke = groupAttribute.stroke, strokeArrayColor: strokeArrayColor = groupAttribute.strokeArrayColor, strokeArrayWidth: strokeArrayWidth = groupAttribute.strokeArrayWidth} = group.attribute;
101
109
  stroke && Array.isArray(lineDash) && lineDash.length && !Array.isArray(strokeArrayColor) && !Array.isArray(strokeArrayWidth) && (doFillOrStroke.doStroke = !1);
102
110
  }
@@ -110,19 +118,23 @@ let DashGroupAfterRenderContribution = class {
110
118
  this.time = vrender_1.BaseRenderContributionTime.afterFillStroke, this.useStyle = !0,
111
119
  this.order = 0;
112
120
  }
113
- drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, fillCb, strokeCb) {
121
+ drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, drawContext, fillCb, strokeCb) {
114
122
  const {lineDash: lineDash = groupAttribute.lineDash, stroke: stroke = groupAttribute.stroke, strokeArrayColor: strokeArrayColor = groupAttribute.strokeArrayColor, strokeArrayWidth: strokeArrayWidth = groupAttribute.strokeArrayWidth, lineWidth: lineWidth = groupAttribute.lineWidth} = group.attribute;
115
123
  if (!stroke || !Array.isArray(lineDash) || !lineDash.length || Array.isArray(strokeArrayColor) || Array.isArray(strokeArrayWidth)) return;
116
- let {width: width = groupAttribute.width, height: height = groupAttribute.height} = group.attribute;
117
- width = Math.ceil(width), height = Math.ceil(height), 1 & lineWidth && (x = Math.floor(x) + .5,
118
- y = Math.floor(y) + .5), context.setStrokeStyle(group, group.attribute, x, y, groupAttribute),
119
- context.beginPath(), context.moveTo(x, y), context.lineTo(x + width, y), context.lineDashOffset = context.currentMatrix.e / context.currentMatrix.a,
120
- context.stroke(), context.beginPath(), context.moveTo(x + width, y), context.lineTo(x + width, y + height),
124
+ let widthForStroke, heightForStroke, {width: width = groupAttribute.width, height: height = groupAttribute.height} = group.attribute;
125
+ if (width = Math.ceil(width), height = Math.ceil(height), 1 & lineWidth) {
126
+ x = Math.floor(x) + .5, y = Math.floor(y) + .5;
127
+ const {width: widthFroDraw, height: heightFroDraw} = getCellSizeForDraw(group, Math.ceil(width), Math.ceil(height));
128
+ widthForStroke = widthFroDraw, heightForStroke = heightFroDraw;
129
+ } else widthForStroke = Math.ceil(width), heightForStroke = Math.ceil(height);
130
+ context.setStrokeStyle(group, group.attribute, x, y, groupAttribute), context.beginPath(),
131
+ context.moveTo(x, y), context.lineTo(x + widthForStroke, y), context.lineDashOffset = context.currentMatrix.e / context.currentMatrix.a,
132
+ context.stroke(), context.beginPath(), context.moveTo(x + widthForStroke, y), context.lineTo(x + widthForStroke, y + heightForStroke),
121
133
  context.lineDashOffset = context.currentMatrix.f / context.currentMatrix.d, context.stroke(),
122
- context.beginPath(), context.moveTo(x, y + height), context.lineTo(x + width, y + height),
134
+ context.beginPath(), context.moveTo(x, y + heightForStroke), context.lineTo(x + widthForStroke, y + heightForStroke),
123
135
  context.lineDashOffset = context.currentMatrix.e / context.currentMatrix.a, context.stroke(),
124
- context.beginPath(), context.moveTo(x, y), context.lineTo(x, y + height), context.lineDashOffset = context.currentMatrix.f / context.currentMatrix.d,
125
- context.stroke();
136
+ context.beginPath(), context.moveTo(x, y), context.lineTo(x, y + heightForStroke),
137
+ context.lineDashOffset = context.currentMatrix.f / context.currentMatrix.d, context.stroke();
126
138
  }
127
139
  };
128
140
 
@@ -134,7 +146,7 @@ let AdjustPosGroupBeforeRenderContribution = class {
134
146
  this.time = vrender_1.BaseRenderContributionTime.beforeFillStroke, this.useStyle = !0,
135
147
  this.order = 0;
136
148
  }
137
- drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, fillCb, strokeCb, doFillOrStroke) {
149
+ drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, drawContext, fillCb, strokeCb, doFillOrStroke) {
138
150
  const {lineWidth: lineWidth = groupAttribute.lineWidth, stroke: stroke = groupAttribute.stroke, lineDash: lineDash = groupAttribute.lineDash, strokeArrayWidth: strokeArrayWidth = groupAttribute.strokeArrayWidth, strokeArrayColor: strokeArrayColor = groupAttribute.strokeArrayColor} = group.attribute;
139
151
  stroke && Array.isArray(lineDash) && !lineDash.length && !Array.isArray(strokeArrayColor) && !Array.isArray(strokeArrayWidth) && 1 & lineWidth && (doFillOrStroke.doStroke = !1);
140
152
  }
@@ -148,18 +160,11 @@ let AdjustPosGroupAfterRenderContribution = class {
148
160
  this.time = vrender_1.BaseRenderContributionTime.afterFillStroke, this.useStyle = !0,
149
161
  this.order = 0;
150
162
  }
151
- drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, fillCb, strokeCb) {
152
- const {lineWidth: lineWidth = groupAttribute.lineWidth, stroke: stroke = groupAttribute.stroke, lineDash: lineDash = groupAttribute.lineDash, strokeArrayWidth: strokeArrayWidth = groupAttribute.strokeArrayWidth, strokeArrayColor: strokeArrayColor = groupAttribute.strokeArrayColor} = group.attribute;
153
- let {width: width = groupAttribute.width, height: height = groupAttribute.height} = group.attribute;
154
- if (width = Math.ceil(width), height = Math.ceil(height), stroke && Array.isArray(lineDash) && !lineDash.length && !Array.isArray(strokeArrayColor) && !Array.isArray(strokeArrayWidth) && 1 & lineWidth) {
155
- if ("cell" === group.role) {
156
- const table = group.stage.table;
157
- let col = group.col, row = group.row;
158
- const mergeInfo = (0, get_cell_merge_1.getCellMergeInfo)(table, col, row);
159
- mergeInfo && (col = mergeInfo.end.col, row = mergeInfo.end.row), (table && col === table.colCount - 1 || table && col === table.frozenColCount - 1 && table.scrollLeft) && (width -= 1),
160
- (table && row === table.rowCount - 1 || table && row === table.frozenRowCount - 1 && table.scrollTop) && (height -= 1);
161
- }
162
- context.beginPath(), x = Math.floor(x) + .5, y = Math.floor(y) + .5, context.rect(x, y, width, height),
163
+ drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, drawContext, fillCb, strokeCb) {
164
+ const {lineWidth: lineWidth = groupAttribute.lineWidth, stroke: stroke = groupAttribute.stroke, lineDash: lineDash = groupAttribute.lineDash, strokeArrayWidth: strokeArrayWidth = groupAttribute.strokeArrayWidth, strokeArrayColor: strokeArrayColor = groupAttribute.strokeArrayColor} = group.attribute, {width: width = groupAttribute.width, height: height = groupAttribute.height} = group.attribute;
165
+ if (stroke && Array.isArray(lineDash) && !lineDash.length && !Array.isArray(strokeArrayColor) && !Array.isArray(strokeArrayWidth) && 1 & lineWidth) {
166
+ const {width: widthFroDraw, height: heightFroDraw} = getCellSizeForDraw(group, Math.ceil(width), Math.ceil(height));
167
+ context.beginPath(), x = Math.floor(x) + .5, y = Math.floor(y) + .5, context.rect(x, y, widthFroDraw, heightFroDraw),
163
168
  context.setStrokeStyle(group, group.attribute, x, y, groupAttribute), context.stroke();
164
169
  }
165
170
  }
@@ -173,7 +178,7 @@ let AdjustColorGroupBeforeRenderContribution = class {
173
178
  this.time = vrender_1.BaseRenderContributionTime.beforeFillStroke, this.useStyle = !0,
174
179
  this.order = 0;
175
180
  }
176
- drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, fillCb, strokeCb, doFillOrStroke) {
181
+ drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, drawContext, fillCb, strokeCb, doFillOrStroke) {
177
182
  if ("cell" === group.role) {
178
183
  const table = group.stage.table, hoverColor = (0, is_cell_hover_1.getCellHoverColor)(group, table);
179
184
  hoverColor && (group.oldColor = group.attribute.fill, group.attribute.fill = hoverColor);
@@ -189,11 +194,25 @@ let AdjustColorGroupAfterRenderContribution = class {
189
194
  this.time = vrender_1.BaseRenderContributionTime.afterFillStroke, this.useStyle = !0,
190
195
  this.order = 0;
191
196
  }
192
- drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, fillCb, strokeCb) {
197
+ drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, drawContext, fillCb, strokeCb) {
193
198
  "oldColor" in group && (group.attribute.fill = group.oldColor, delete group.oldColor);
194
199
  }
195
200
  };
196
201
 
202
+ function getCellSizeForDraw(group, width, height) {
203
+ const table = group.stage.table;
204
+ if ("cell" === group.role) {
205
+ let col = group.col, row = group.row;
206
+ const mergeInfo = (0, get_cell_merge_1.getCellMergeInfo)(table, col, row);
207
+ mergeInfo && (col = mergeInfo.end.col, row = mergeInfo.end.row), (table && col === table.colCount - 1 || table && col === table.frozenColCount - 1 && table.scrollLeft) && (width -= 1),
208
+ (table && row === table.rowCount - 1 || table && row === table.frozenRowCount - 1 && table.scrollTop) && (height -= 1);
209
+ } else "corner-frozen" === group.role && (table.scrollLeft && (width -= 1), table.scrollTop && (height -= 1));
210
+ return {
211
+ width: width,
212
+ height: height
213
+ };
214
+ }
215
+
197
216
  AdjustColorGroupAfterRenderContribution = __decorate([ (0, inversify_1.injectable)() ], AdjustColorGroupAfterRenderContribution),
198
217
  exports.AdjustColorGroupAfterRenderContribution = AdjustColorGroupAfterRenderContribution;
199
218
  //# sourceMappingURL=group-contribution-render.js.map