@visactor/react-vtable 1.6.0-alpha.5 → 1.6.1

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 (289) hide show
  1. package/cjs/components/avatar/avatar.d.ts +15 -0
  2. package/cjs/components/avatar/avatar.js +84 -0
  3. package/cjs/components/avatar/avatar.js.map +1 -0
  4. package/cjs/components/button/button.d.ts +27 -0
  5. package/cjs/components/button/button.js +107 -0
  6. package/cjs/components/button/button.js.map +1 -0
  7. package/cjs/components/checkbox/checkbox.d.ts +17 -0
  8. package/cjs/components/checkbox/checkbox.js +69 -0
  9. package/cjs/components/checkbox/checkbox.js.map +1 -0
  10. package/cjs/components/index.d.ts +7 -19
  11. package/cjs/components/index.js +4 -101
  12. package/cjs/components/index.js.map +1 -1
  13. package/cjs/components/link/link.d.ts +30 -0
  14. package/cjs/components/link/link.js +119 -0
  15. package/cjs/components/link/link.js.map +1 -0
  16. package/cjs/components/popover/popover.d.ts +13 -0
  17. package/cjs/components/popover/popover.js +281 -0
  18. package/cjs/components/popover/popover.js.map +1 -0
  19. package/cjs/components/radio/radio.d.ts +15 -0
  20. package/cjs/components/radio/radio.js +64 -0
  21. package/cjs/components/radio/radio.js.map +1 -0
  22. package/cjs/components/tag/tag.d.ts +13 -0
  23. package/cjs/components/tag/tag.js +47 -0
  24. package/cjs/components/tag/tag.js.map +1 -0
  25. package/cjs/components/vrender-components/checkbox.d.ts +4 -0
  26. package/cjs/components/vrender-components/checkbox.js +6 -0
  27. package/cjs/components/vrender-components/checkbox.js.map +1 -0
  28. package/cjs/components/vrender-components/component-creater.d.ts +2 -0
  29. package/cjs/components/vrender-components/component-creater.js +22 -0
  30. package/cjs/components/vrender-components/component-creater.js.map +1 -0
  31. package/cjs/components/vrender-components/radio.d.ts +4 -0
  32. package/cjs/components/vrender-components/radio.js +6 -0
  33. package/cjs/components/vrender-components/radio.js.map +1 -0
  34. package/cjs/components/vrender-components/tag.d.ts +4 -0
  35. package/cjs/components/vrender-components/tag.js +6 -0
  36. package/cjs/components/vrender-components/tag.js.map +1 -0
  37. package/cjs/components/vrender-components/type.d.ts +6 -0
  38. package/cjs/components/vrender-components/type.js +6 -0
  39. package/cjs/components/vrender-components/type.js.map +1 -0
  40. package/cjs/constants.js +2 -1
  41. package/cjs/containers/withContainer.js +1 -2
  42. package/cjs/eventsUtils.d.ts +1 -1
  43. package/cjs/eventsUtils.js +1 -1
  44. package/cjs/eventsUtils.js.map +1 -1
  45. package/cjs/index.d.ts +2 -2
  46. package/cjs/index.js +2 -2
  47. package/cjs/index.js.map +1 -1
  48. package/cjs/{components → table-components}/base-component.js +1 -0
  49. package/cjs/table-components/base-component.js.map +1 -0
  50. package/cjs/table-components/component/emptyTip.js.map +1 -0
  51. package/cjs/table-components/component/menu.js.map +1 -0
  52. package/cjs/table-components/component/title.d.ts +4 -0
  53. package/cjs/table-components/component/title.js +10 -0
  54. package/cjs/table-components/component/title.js.map +1 -0
  55. package/cjs/table-components/component/tooltip.js.map +1 -0
  56. package/cjs/{components → table-components}/custom/custom-layout.d.ts +1 -1
  57. package/cjs/{components → table-components}/custom/custom-layout.js +2 -6
  58. package/cjs/table-components/custom/custom-layout.js.map +1 -0
  59. package/{es/components → cjs/table-components}/custom/graphic.d.ts +1 -14
  60. package/cjs/table-components/custom/graphic.js.map +1 -0
  61. package/cjs/table-components/custom/reconciler.d.ts +5 -0
  62. package/cjs/{components → table-components}/custom/reconciler.js +12 -10
  63. package/cjs/table-components/custom/reconciler.js.map +1 -0
  64. package/cjs/table-components/custom/vtable-browser-env-contribution.d.ts +7 -0
  65. package/cjs/{components → table-components}/custom/vtable-browser-env-contribution.js +4 -4
  66. package/cjs/table-components/custom/vtable-browser-env-contribution.js.map +1 -0
  67. package/{es/components → cjs/table-components}/custom/vtable-react-attribute-plugin.d.ts +2 -8
  68. package/cjs/{components → table-components}/custom/vtable-react-attribute-plugin.js +6 -6
  69. package/cjs/table-components/custom/vtable-react-attribute-plugin.js.map +1 -0
  70. package/cjs/table-components/custom-component.js.map +1 -0
  71. package/cjs/table-components/index.d.ts +19 -0
  72. package/cjs/table-components/index.js +130 -0
  73. package/cjs/table-components/index.js.map +1 -0
  74. package/cjs/table-components/list/list-column.js.map +1 -0
  75. package/cjs/table-components/pivot/pivot-corner.js.map +1 -0
  76. package/cjs/table-components/pivot/pivot-dimension.js.map +1 -0
  77. package/cjs/table-components/pivot/pivot-header-title.js.map +1 -0
  78. package/cjs/table-components/pivot/pivot-indicator.js.map +1 -0
  79. package/cjs/tables/base-table.d.ts +5 -4
  80. package/cjs/tables/base-table.js +6 -10
  81. package/cjs/tables/base-table.js.map +1 -1
  82. package/cjs/tables/index.d.ts +2 -0
  83. package/cjs/tables/index.js +19 -1
  84. package/cjs/tables/index.js.map +1 -1
  85. package/cjs/tables/list-table-simple.d.ts +8 -0
  86. package/cjs/tables/list-table-simple.js +13 -0
  87. package/cjs/tables/list-table-simple.js.map +1 -0
  88. package/cjs/tables/list-table.d.ts +1 -1
  89. package/cjs/tables/list-table.js +5 -2
  90. package/cjs/tables/list-table.js.map +1 -1
  91. package/cjs/tables/pivot-chart.d.ts +5 -1
  92. package/cjs/tables/pivot-chart.js +6 -29
  93. package/cjs/tables/pivot-chart.js.map +1 -1
  94. package/cjs/tables/pivot-table-simple.d.ts +8 -0
  95. package/cjs/tables/pivot-table-simple.js +13 -0
  96. package/cjs/tables/pivot-table-simple.js.map +1 -0
  97. package/cjs/tables/pivot-table.d.ts +1 -1
  98. package/cjs/tables/pivot-table.js +5 -2
  99. package/cjs/tables/pivot-table.js.map +1 -1
  100. package/cjs/util.js +1 -2
  101. package/cjs/vtable.d.ts +1 -2
  102. package/cjs/vtable.js +0 -33
  103. package/cjs/vtable.js.map +1 -1
  104. package/es/components/avatar/avatar.d.ts +15 -0
  105. package/es/components/avatar/avatar.js +82 -0
  106. package/es/components/avatar/avatar.js.map +1 -0
  107. package/es/components/button/button.d.ts +27 -0
  108. package/es/components/button/button.js +84 -0
  109. package/es/components/button/button.js.map +1 -0
  110. package/es/components/checkbox/checkbox.d.ts +17 -0
  111. package/es/components/checkbox/checkbox.js +48 -0
  112. package/es/components/checkbox/checkbox.js.map +1 -0
  113. package/es/components/index.d.ts +7 -19
  114. package/es/components/index.js +7 -17
  115. package/es/components/index.js.map +1 -1
  116. package/es/components/link/link.d.ts +30 -0
  117. package/es/components/link/link.js +96 -0
  118. package/es/components/link/link.js.map +1 -0
  119. package/es/components/popover/popover.d.ts +13 -0
  120. package/es/components/popover/popover.js +258 -0
  121. package/es/components/popover/popover.js.map +1 -0
  122. package/es/components/radio/radio.d.ts +15 -0
  123. package/es/components/radio/radio.js +43 -0
  124. package/es/components/radio/radio.js.map +1 -0
  125. package/es/components/tag/tag.d.ts +13 -0
  126. package/es/components/tag/tag.js +45 -0
  127. package/es/components/tag/tag.js.map +1 -0
  128. package/es/components/vrender-components/checkbox.d.ts +4 -0
  129. package/es/components/vrender-components/checkbox.js +2 -0
  130. package/es/components/vrender-components/checkbox.js.map +1 -0
  131. package/es/components/vrender-components/component-creater.d.ts +2 -0
  132. package/es/components/vrender-components/component-creater.js +14 -0
  133. package/es/components/vrender-components/component-creater.js.map +1 -0
  134. package/es/components/vrender-components/radio.d.ts +4 -0
  135. package/es/components/vrender-components/radio.js +2 -0
  136. package/es/components/vrender-components/radio.js.map +1 -0
  137. package/es/components/vrender-components/tag.d.ts +4 -0
  138. package/es/components/vrender-components/tag.js +2 -0
  139. package/es/components/vrender-components/tag.js.map +1 -0
  140. package/es/components/vrender-components/type.d.ts +6 -0
  141. package/es/components/vrender-components/type.js +2 -0
  142. package/es/components/vrender-components/type.js.map +1 -0
  143. package/es/constants.js +2 -1
  144. package/es/containers/withContainer.js +1 -2
  145. package/es/eventsUtils.d.ts +1 -1
  146. package/es/eventsUtils.js +2 -2
  147. package/es/eventsUtils.js.map +1 -1
  148. package/es/index.d.ts +2 -2
  149. package/es/index.js +3 -3
  150. package/es/index.js.map +1 -1
  151. package/es/{components → table-components}/base-component.js +2 -1
  152. package/es/table-components/base-component.js.map +1 -0
  153. package/es/table-components/component/emptyTip.js.map +1 -0
  154. package/es/table-components/component/menu.js.map +1 -0
  155. package/es/table-components/component/title.d.ts +4 -0
  156. package/es/table-components/component/title.js +4 -0
  157. package/es/table-components/component/title.js.map +1 -0
  158. package/es/table-components/component/tooltip.js.map +1 -0
  159. package/es/{components → table-components}/custom/custom-layout.d.ts +1 -1
  160. package/es/{components → table-components}/custom/custom-layout.js +1 -7
  161. package/es/table-components/custom/custom-layout.js.map +1 -0
  162. package/{cjs/components → es/table-components}/custom/graphic.d.ts +1 -14
  163. package/es/table-components/custom/graphic.js.map +1 -0
  164. package/es/table-components/custom/reconciler.d.ts +5 -0
  165. package/es/{components → table-components}/custom/reconciler.js +9 -8
  166. package/es/table-components/custom/reconciler.js.map +1 -0
  167. package/es/table-components/custom/vtable-browser-env-contribution.d.ts +7 -0
  168. package/es/{components → table-components}/custom/vtable-browser-env-contribution.js +3 -3
  169. package/es/table-components/custom/vtable-browser-env-contribution.js.map +1 -0
  170. package/{cjs/components → es/table-components}/custom/vtable-react-attribute-plugin.d.ts +2 -8
  171. package/es/{components → table-components}/custom/vtable-react-attribute-plugin.js +1 -3
  172. package/es/table-components/custom/vtable-react-attribute-plugin.js.map +1 -0
  173. package/es/table-components/custom-component.js.map +1 -0
  174. package/es/table-components/index.d.ts +19 -0
  175. package/es/table-components/index.js +24 -0
  176. package/es/table-components/index.js.map +1 -0
  177. package/es/table-components/list/list-column.js.map +1 -0
  178. package/es/table-components/pivot/pivot-corner.js.map +1 -0
  179. package/es/table-components/pivot/pivot-dimension.js.map +1 -0
  180. package/es/table-components/pivot/pivot-header-title.js.map +1 -0
  181. package/es/table-components/pivot/pivot-indicator.js.map +1 -0
  182. package/es/tables/base-table.d.ts +5 -4
  183. package/es/tables/base-table.js +7 -13
  184. package/es/tables/base-table.js.map +1 -1
  185. package/es/tables/index.d.ts +2 -0
  186. package/es/tables/index.js +4 -0
  187. package/es/tables/index.js.map +1 -1
  188. package/es/tables/list-table-simple.d.ts +8 -0
  189. package/es/tables/list-table-simple.js +9 -0
  190. package/es/tables/list-table-simple.js.map +1 -0
  191. package/es/tables/list-table.d.ts +1 -1
  192. package/es/tables/list-table.js +6 -1
  193. package/es/tables/list-table.js.map +1 -1
  194. package/es/tables/pivot-chart.d.ts +5 -1
  195. package/es/tables/pivot-chart.js +8 -3
  196. package/es/tables/pivot-chart.js.map +1 -1
  197. package/es/tables/pivot-table-simple.d.ts +8 -0
  198. package/es/tables/pivot-table-simple.js +9 -0
  199. package/es/tables/pivot-table-simple.js.map +1 -0
  200. package/es/tables/pivot-table.d.ts +1 -1
  201. package/es/tables/pivot-table.js +6 -1
  202. package/es/tables/pivot-table.js.map +1 -1
  203. package/es/util.js +1 -2
  204. package/es/vtable.d.ts +1 -2
  205. package/es/vtable.js +1 -3
  206. package/es/vtable.js.map +1 -1
  207. package/package.json +6 -6
  208. package/cjs/components/base-component.js.map +0 -1
  209. package/cjs/components/component/emptyTip.js.map +0 -1
  210. package/cjs/components/component/menu.js.map +0 -1
  211. package/cjs/components/component/tooltip.js.map +0 -1
  212. package/cjs/components/custom/component.d.ts +0 -16
  213. package/cjs/components/custom/component.js +0 -7
  214. package/cjs/components/custom/component.js.map +0 -1
  215. package/cjs/components/custom/custom-layout.js.map +0 -1
  216. package/cjs/components/custom/graphic.js.map +0 -1
  217. package/cjs/components/custom/reconciler.d.ts +0 -5
  218. package/cjs/components/custom/reconciler.js.map +0 -1
  219. package/cjs/components/custom/vtable-browser-env-contribution.d.ts +0 -2
  220. package/cjs/components/custom/vtable-browser-env-contribution.js.map +0 -1
  221. package/cjs/components/custom/vtable-react-attribute-plugin.js.map +0 -1
  222. package/cjs/components/custom-component.js.map +0 -1
  223. package/cjs/components/list/list-column.js.map +0 -1
  224. package/cjs/components/pivot/pivot-corner.js.map +0 -1
  225. package/cjs/components/pivot/pivot-dimension.js.map +0 -1
  226. package/cjs/components/pivot/pivot-header-title.js.map +0 -1
  227. package/cjs/components/pivot/pivot-indicator.js.map +0 -1
  228. package/dist/react-vtable.js +0 -13799
  229. package/dist/react-vtable.min.js +0 -46
  230. package/es/components/base-component.js.map +0 -1
  231. package/es/components/component/emptyTip.js.map +0 -1
  232. package/es/components/component/menu.js.map +0 -1
  233. package/es/components/component/tooltip.js.map +0 -1
  234. package/es/components/custom/component.d.ts +0 -16
  235. package/es/components/custom/component.js +0 -6
  236. package/es/components/custom/component.js.map +0 -1
  237. package/es/components/custom/custom-layout.js.map +0 -1
  238. package/es/components/custom/graphic.js.map +0 -1
  239. package/es/components/custom/reconciler.d.ts +0 -5
  240. package/es/components/custom/reconciler.js.map +0 -1
  241. package/es/components/custom/vtable-browser-env-contribution.d.ts +0 -2
  242. package/es/components/custom/vtable-browser-env-contribution.js.map +0 -1
  243. package/es/components/custom/vtable-react-attribute-plugin.js.map +0 -1
  244. package/es/components/custom-component.js.map +0 -1
  245. package/es/components/list/list-column.js.map +0 -1
  246. package/es/components/pivot/pivot-corner.js.map +0 -1
  247. package/es/components/pivot/pivot-dimension.js.map +0 -1
  248. package/es/components/pivot/pivot-header-title.js.map +0 -1
  249. package/es/components/pivot/pivot-indicator.js.map +0 -1
  250. /package/cjs/{components → table-components}/base-component.d.ts +0 -0
  251. /package/cjs/{components → table-components}/component/emptyTip.d.ts +0 -0
  252. /package/cjs/{components → table-components}/component/emptyTip.js +0 -0
  253. /package/cjs/{components → table-components}/component/menu.d.ts +0 -0
  254. /package/cjs/{components → table-components}/component/menu.js +0 -0
  255. /package/cjs/{components → table-components}/component/tooltip.d.ts +0 -0
  256. /package/cjs/{components → table-components}/component/tooltip.js +0 -0
  257. /package/cjs/{components → table-components}/custom/graphic.js +0 -0
  258. /package/cjs/{components → table-components}/custom-component.d.ts +0 -0
  259. /package/cjs/{components → table-components}/custom-component.js +0 -0
  260. /package/cjs/{components → table-components}/list/list-column.d.ts +0 -0
  261. /package/cjs/{components → table-components}/list/list-column.js +0 -0
  262. /package/cjs/{components → table-components}/pivot/pivot-corner.d.ts +0 -0
  263. /package/cjs/{components → table-components}/pivot/pivot-corner.js +0 -0
  264. /package/cjs/{components → table-components}/pivot/pivot-dimension.d.ts +0 -0
  265. /package/cjs/{components → table-components}/pivot/pivot-dimension.js +0 -0
  266. /package/cjs/{components → table-components}/pivot/pivot-header-title.d.ts +0 -0
  267. /package/cjs/{components → table-components}/pivot/pivot-header-title.js +0 -0
  268. /package/cjs/{components → table-components}/pivot/pivot-indicator.d.ts +0 -0
  269. /package/cjs/{components → table-components}/pivot/pivot-indicator.js +0 -0
  270. /package/es/{components → table-components}/base-component.d.ts +0 -0
  271. /package/es/{components → table-components}/component/emptyTip.d.ts +0 -0
  272. /package/es/{components → table-components}/component/emptyTip.js +0 -0
  273. /package/es/{components → table-components}/component/menu.d.ts +0 -0
  274. /package/es/{components → table-components}/component/menu.js +0 -0
  275. /package/es/{components → table-components}/component/tooltip.d.ts +0 -0
  276. /package/es/{components → table-components}/component/tooltip.js +0 -0
  277. /package/es/{components → table-components}/custom/graphic.js +0 -0
  278. /package/es/{components → table-components}/custom-component.d.ts +0 -0
  279. /package/es/{components → table-components}/custom-component.js +0 -0
  280. /package/es/{components → table-components}/list/list-column.d.ts +0 -0
  281. /package/es/{components → table-components}/list/list-column.js +0 -0
  282. /package/es/{components → table-components}/pivot/pivot-corner.d.ts +0 -0
  283. /package/es/{components → table-components}/pivot/pivot-corner.js +0 -0
  284. /package/es/{components → table-components}/pivot/pivot-dimension.d.ts +0 -0
  285. /package/es/{components → table-components}/pivot/pivot-dimension.js +0 -0
  286. /package/es/{components → table-components}/pivot/pivot-header-title.d.ts +0 -0
  287. /package/es/{components → table-components}/pivot/pivot-header-title.js +0 -0
  288. /package/es/{components → table-components}/pivot/pivot-indicator.d.ts +0 -0
  289. /package/es/{components → table-components}/pivot/pivot-indicator.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["tables/base-table.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MA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AE,CAAC,KAAQ,EAAE,EAAE;QACzF,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;QAElB,IAAI,QAAQ,EAAE;YACZ,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC;SACxB;QAED,IAAI,IAAI,EAAE;YACR,uCAAY,KAAK,KAAE,IAAI,IAAG;SAC3B;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;IACH,GAAG,CAAC,WAAW,GAAG,aAAa,CAAC;IAChC,OAAO,GAAG,CAAC;AACb,CAAC,CAAC","file":"base-table.js","sourcesContent":["/* eslint-disable react/display-name */\n// import * as VTable from '@visactor/vtable';\nimport { VTable } from '../vtable';\nimport React, { useState, useEffect, useRef, useImperativeHandle, useCallback } from 'react';\nimport type { ContainerProps } from '../containers/withContainer';\nimport withContainer from '../containers/withContainer';\nimport type { TableContextType } from '../context/table';\nimport RootTableContext from '../context/table';\nimport { isEqual, isNil, pickWithout } from '@visactor/vutils';\nimport { toArray } from '../util';\nimport { REACT_PRIVATE_PROPS } from '../constants';\nimport type { IMarkElement } from '../components';\nimport type {\n EventsProps\n // LegendEventProps,\n // ScrollBarEventProps,\n // BrushEventProps,\n // DataZoomEventProps,\n // PlayerEventProps,\n // DimensionEventProps,\n // HierarchyEventProps,\n // TableLifeCycleEventProps\n} from '../eventsUtils';\nimport { bindEventsToTable, TABLE_EVENTS_KEYS, TABLE_EVENTS } from '../eventsUtils';\nimport { VTableReactAttributePlugin } from '../components/custom/vtable-react-attribute-plugin';\nimport { reactEnvModule } from '../components/custom/vtable-browser-env-contribution';\nconst { container, isBrowserEnv } = VTable.VRender;\n\nexport type IVTable = VTable.ListTable | VTable.PivotTable | VTable.PivotChart;\nexport type IOption =\n | VTable.ListTableConstructorOptions\n | VTable.PivotTableConstructorOptions\n | VTable.PivotChartConstructorOptions;\n\nexport interface BaseTableProps extends EventsProps {\n type?: string;\n /** 上层container */\n container?: HTMLDivElement;\n /** option */\n option?: any;\n /** 数据 */\n records?: Record<string, unknown>[];\n /** 画布宽度 */\n width?: number;\n /** 画布高度 */\n height?: number;\n skipFunctionDiff?: boolean;\n\n ReactDOM?: any;\n\n /** 表格渲染完成事件 */\n onReady?: (instance: IVTable, isInitial: boolean) => void;\n /** throw error when chart run into an error */\n onError?: (err: Error) => void;\n}\n\n// for react-vtable\nif (isBrowserEnv()) {\n container.load(reactEnvModule);\n}\n\ntype Props = React.PropsWithChildren<BaseTableProps>;\n\nconst notOptionKeys = [\n ...REACT_PRIVATE_PROPS,\n ...TABLE_EVENTS_KEYS,\n 'skipFunctionDiff',\n 'onError',\n 'onReady',\n 'option',\n 'records',\n 'container'\n];\n\nconst getComponentId = (child: React.ReactNode, index: number) => {\n const componentName = child && (child as any).type && ((child as any).type.displayName || (child as any).type.name);\n return `${componentName}-${index}`;\n};\n\nconst parseOptionFromChildren = (props: Props) => {\n const optionFromChildren: Omit<IOption, 'type' | 'data' | 'width' | 'height'> = {};\n\n toArray(props.children).map((child, index) => {\n const parseOption = child && (child as any).type && (child as any).type.parseOption;\n\n if (parseOption && (child as any).props) {\n const childProps = isNil((child as any).props.componentId)\n ? {\n ...(child as any).props,\n componentId: getComponentId(child, index)\n }\n : (child as any).props;\n\n const optionResult = parseOption(childProps);\n\n if (optionResult.isSingle) {\n optionFromChildren[optionResult.optionName] = optionResult.option;\n } else {\n if (!optionFromChildren[optionResult.optionName]) {\n optionFromChildren[optionResult.optionName] = [];\n }\n\n optionFromChildren[optionResult.optionName].push(optionResult.option);\n }\n }\n });\n\n return optionFromChildren;\n};\n\nconst BaseTable: React.FC<Props> = React.forwardRef((props, ref) => {\n const [updateId, setUpdateId] = useState<number>(0);\n const tableContext = useRef<TableContextType>({});\n useImperativeHandle(ref, () => tableContext.current?.table);\n const hasOption = !!props.option;\n const hasRecords = !!props.records;\n const isUnmount = useRef<boolean>(false);\n const prevOption = useRef(pickWithout(props, notOptionKeys));\n const optionFromChildren = useRef<Omit<IOption, 'records'>>(null);\n const prevRecords = useRef(props.records);\n const eventsBinded = React.useRef<BaseTableProps>(null);\n const skipFunctionDiff = !!props.skipFunctionDiff;\n\n const parseOption = useCallback(\n (props: Props) => {\n if (hasOption && props.option) {\n if (hasRecords && props.records) {\n return {\n ...props.option,\n clearDOM: false,\n records: props.records\n };\n }\n return {\n ...props.option,\n clearDOM: false\n };\n }\n return {\n records: props.records,\n ...prevOption.current,\n ...optionFromChildren.current,\n clearDOM: false,\n customConfig: {\n createReactContainer: true\n }\n // ...tableContext.current?.optionFromChildren\n } as IOption;\n },\n [hasOption, hasRecords]\n );\n\n const createTable = useCallback(\n (props: Props) => {\n let vtable;\n if (props.type === 'pivot-table') {\n vtable = new VTable.PivotTable(props.container, parseOption(props));\n } else if (props.type === 'pivot-chart') {\n vtable = new VTable.PivotChart(props.container, parseOption(props));\n } else {\n vtable = new VTable.ListTable(props.container, parseOption(props));\n }\n // vtable.scenegraph.stage.enableReactAttribute(ReactDOM);\n vtable.scenegraph.stage.reactAttribute = props.ReactDOM;\n vtable.scenegraph.stage.pluginService.register(new VTableReactAttributePlugin());\n vtable.scenegraph.stage.params.ReactDOM = props.ReactDOM;\n tableContext.current = { ...tableContext.current, table: vtable };\n isUnmount.current = false;\n },\n [parseOption]\n );\n\n const handleTableRender = useCallback(() => {\n if (!isUnmount.current) {\n if (!tableContext.current || !tableContext.current.table) {\n return;\n }\n // rebind events after render\n bindEventsToTable(tableContext.current.table, props, eventsBinded.current, TABLE_EVENTS);\n\n // to be fixed\n // will cause another useEffect\n setUpdateId(updateId + 1);\n if (props.onReady) {\n props.onReady(tableContext.current.table, updateId === 0);\n }\n }\n }, [updateId, setUpdateId, props]);\n\n const renderTable = useCallback(() => {\n if (tableContext.current.table) {\n // eslint-disable-next-line promise/catch-or-return\n tableContext.current.table.render();\n handleTableRender();\n }\n }, [handleTableRender]);\n\n useEffect(() => {\n const newOptionFromChildren = hasOption ? null : parseOptionFromChildren(props);\n\n if (!tableContext.current?.table) {\n if (!hasOption) {\n optionFromChildren.current = newOptionFromChildren;\n }\n\n createTable(props);\n renderTable();\n // bindEventsToTable(tableContext.current.table, props, null, TABLE_EVENTS);\n // tableContext.current = {\n // ...tableContext.current,\n // isChildrenUpdated: false\n // };\n eventsBinded.current = props;\n return;\n }\n\n if (hasOption) {\n if (!isEqual(eventsBinded.current.option, props.option, { skipFunction: skipFunctionDiff })) {\n // eslint-disable-next-line promise/catch-or-return\n tableContext.current.table.updateOption(parseOption(props));\n handleTableRender();\n eventsBinded.current = props;\n } else if (\n hasRecords &&\n !isEqual(eventsBinded.current.records, props.records, { skipFunction: skipFunctionDiff })\n ) {\n tableContext.current.table.setRecords(props.records as any[]);\n handleTableRender();\n eventsBinded.current = props;\n }\n return;\n }\n\n const newOption = pickWithout(props, notOptionKeys);\n\n if (\n !isEqual(newOption, prevOption.current, { skipFunction: skipFunctionDiff }) ||\n // tableContext.current.isChildrenUpdated\n !isEqual(newOptionFromChildren, optionFromChildren.current, { skipFunction: skipFunctionDiff })\n ) {\n prevOption.current = newOption;\n optionFromChildren.current = newOptionFromChildren;\n\n // eslint-disable-next-line promise/catch-or-return\n tableContext.current.table.updateOption(parseOption(props));\n handleTableRender();\n eventsBinded.current = props;\n } else if (hasRecords && !isEqual(props.records, prevRecords.current, { skipFunction: skipFunctionDiff })) {\n prevRecords.current = props.records;\n tableContext.current.table.setRecords(props.records);\n handleTableRender();\n eventsBinded.current = props;\n }\n // tableContext.current = {\n // ...tableContext.current,\n // isChildrenUpdated: false\n // };\n }, [createTable, hasOption, hasRecords, parseOption, handleTableRender, renderTable, skipFunctionDiff, props]);\n\n useEffect(() => {\n return () => {\n if (tableContext) {\n if (tableContext.current && tableContext.current.table) {\n tableContext.current.table.release();\n tableContext.current = null;\n }\n }\n eventsBinded.current = null;\n isUnmount.current = true;\n };\n }, []);\n\n return (\n <RootTableContext.Provider value={tableContext.current}>\n {toArray(props.children).map((child: React.ReactNode, index: number) => {\n if (typeof child === 'string') {\n return;\n }\n\n const childId = getComponentId(child, index);\n\n // const componentName =\n // child && (child as any).type && ((child as any).type.displayName || (child as any).type.name);\n // const childId = `${componentName}-${index}`;\n\n return (\n // <React.Fragment key={(child as any)?.props?.id ?? (child as any)?.id ?? `child-${index}`}>\n // {React.cloneElement(child as IMarkElement, {\n // updateId: updateId\n // })}\n // </React.Fragment>\n <React.Fragment key={childId}>\n {React.cloneElement(child as React.ReactElement<any, React.JSXElementConstructor<any>>, {\n updateId: updateId,\n componentId: childId,\n componentIndex: index\n })}\n </React.Fragment>\n );\n })}\n </RootTableContext.Provider>\n );\n});\n\nexport const createTable = <T extends Props>(componentName: string, type?: string, callback?: (props: T) => T) => {\n const Com = withContainer<ContainerProps, T>(BaseTable as any, componentName, (props: T) => {\n props.type = type;\n\n if (callback) {\n return callback(props);\n }\n\n if (type) {\n return { ...props, type };\n }\n return props;\n });\n Com.displayName = componentName;\n return Com;\n};\n"]}
1
+ {"version":3,"sources":["tables/base-table.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAE7F,OAAO,aAAa,MAAM,6BAA6B,CAAC;AAExD,OAAO,gBAAgB,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAanD,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACpF,OAAO,EAAE,0BAA0B,EAAE,MAAM,0DAA0D,CAAC;AACtG,OAAO,EAAE,cAAc,EAAE,MAAM,4DAA4D,CAAC;AAC5F,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAqCtE,IAAI,YAAY,EAAE,EAAE;IAClB,SA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CAClB,CAAC;IACJ,CAAC,CAAC,CACwB,CAC7B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,aAAqB,EACrB,YAAyB,EACzB,QAA0B,EAC1B,EAAE;IACF,MAAM,GAAG,GAAG,aAAa,CAAoB,SAAgB,EAAE,aAAa,EAAE,CAAC,KAAQ,EAAE,EAAE;QAGzF,IAAI,YAAY,EAAE;YAChB,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;SAC3C;QASD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;IACH,GAAG,CAAC,WAAW,GAAG,aAAa,CAAC;IAChC,OAAO,GAAG,CAAC;AACb,CAAC,CAAC","file":"base-table.js","sourcesContent":["/* eslint-disable react/display-name */\n// import * as VTable from '@visactor/vtable';\n// import { VTable } from '../vtable';\nimport React, { useState, useEffect, useRef, useImperativeHandle, useCallback } from 'react';\nimport type { ContainerProps } from '../containers/withContainer';\nimport withContainer from '../containers/withContainer';\nimport type { TableContextType } from '../context/table';\nimport RootTableContext from '../context/table';\nimport { isEqual, isNil, pickWithout } from '@visactor/vutils';\nimport { toArray } from '../util';\nimport { REACT_PRIVATE_PROPS } from '../constants';\nimport type { IMarkElement } from '../table-components';\nimport type {\n EventsProps\n // LegendEventProps,\n // ScrollBarEventProps,\n // BrushEventProps,\n // DataZoomEventProps,\n // PlayerEventProps,\n // DimensionEventProps,\n // HierarchyEventProps,\n // TableLifeCycleEventProps\n} from '../eventsUtils';\nimport { bindEventsToTable, TABLE_EVENTS_KEYS, TABLE_EVENTS } from '../eventsUtils';\nimport { VTableReactAttributePlugin } from '../table-components/custom/vtable-react-attribute-plugin';\nimport { reactEnvModule } from '../table-components/custom/vtable-browser-env-contribution';\nimport { container, isBrowserEnv } from '@visactor/vtable/es/vrender';\nimport type {\n ListTable,\n PivotTable,\n PivotChart,\n ListTableConstructorOptions,\n PivotTableConstructorOptions,\n PivotChartConstructorOptions\n} from '@visactor/vtable';\n\nexport type IVTable = ListTable | PivotTable | PivotChart;\nexport type IOption = ListTableConstructorOptions | PivotTableConstructorOptions | PivotChartConstructorOptions;\n\nexport interface BaseTableProps extends EventsProps {\n vtableConstrouctor?: any;\n type?: string;\n /** 上层container */\n container?: HTMLDivElement;\n /** option */\n option?: any;\n /** 数据 */\n records?: Record<string, unknown>[];\n /** 画布宽度 */\n width?: number;\n /** 画布高度 */\n height?: number;\n skipFunctionDiff?: boolean;\n\n ReactDOM?: any;\n\n /** 表格渲染完成事件 */\n onReady?: (instance: IVTable, isInitial: boolean) => void;\n /** throw error when chart run into an error */\n onError?: (err: Error) => void;\n}\n\n// for react-vtable\nif (isBrowserEnv()) {\n container.load(reactEnvModule);\n}\n\ntype Props = React.PropsWithChildren<BaseTableProps>;\n\nconst notOptionKeys = [\n ...REACT_PRIVATE_PROPS,\n ...TABLE_EVENTS_KEYS,\n 'skipFunctionDiff',\n 'onError',\n 'onReady',\n 'option',\n 'records',\n 'container',\n 'vtableConstrouctor'\n];\n\nconst getComponentId = (child: React.ReactNode, index: number) => {\n const componentName = child && (child as any).type && ((child as any).type.displayName || (child as any).type.name);\n return `${componentName}-${index}`;\n};\n\nconst parseOptionFromChildren = (props: Props) => {\n const optionFromChildren: Omit<IOption, 'type' | 'data' | 'width' | 'height'> = {} as any;\n\n toArray(props.children).map((child, index) => {\n const parseOption = child && (child as any).type && (child as any).type.parseOption;\n\n if (parseOption && (child as any).props) {\n const childProps = isNil((child as any).props.componentId)\n ? {\n ...(child as any).props,\n componentId: getComponentId(child, index)\n }\n : (child as any).props;\n\n const optionResult = parseOption(childProps) as {\n optionName: keyof Omit<IOption, 'type' | 'data' | 'width' | 'height'>;\n isSingle: boolean;\n option: any;\n };\n\n if (optionResult.isSingle) {\n optionFromChildren[optionResult.optionName] = optionResult.option as never;\n } else {\n if (!optionFromChildren[optionResult.optionName]) {\n optionFromChildren[optionResult.optionName] = [] as never;\n }\n\n optionFromChildren[optionResult.optionName].push(optionResult.option);\n }\n }\n });\n\n return optionFromChildren;\n};\n\nconst BaseTable: React.FC<Props> = React.forwardRef((props, ref) => {\n const [updateId, setUpdateId] = useState<number>(0);\n const tableContext = useRef<TableContextType>({});\n useImperativeHandle(ref, () => tableContext.current?.table);\n const hasOption = !!props.option;\n const hasRecords = !!props.records;\n const isUnmount = useRef<boolean>(false);\n const prevOption = useRef(pickWithout(props, notOptionKeys));\n const optionFromChildren = useRef<Omit<IOption, 'records'>>(null);\n const prevRecords = useRef(props.records);\n const eventsBinded = React.useRef<BaseTableProps>(null);\n const skipFunctionDiff = !!props.skipFunctionDiff;\n\n const parseOption = useCallback(\n (props: Props) => {\n if (hasOption && props.option) {\n if (hasRecords && props.records) {\n return {\n ...props.option,\n clearDOM: false,\n records: props.records\n };\n }\n return {\n ...props.option,\n clearDOM: false\n };\n }\n return {\n records: props.records,\n ...prevOption.current,\n ...optionFromChildren.current,\n clearDOM: false,\n customConfig: {\n createReactContainer: true\n }\n // ...tableContext.current?.optionFromChildren\n } as IOption;\n },\n [hasOption, hasRecords]\n );\n\n const createTable = useCallback(\n (props: Props) => {\n // let vtable;\n // if (props.type === 'pivot-table') {\n // vtable = new VTable.PivotTable(props.container, parseOption(props));\n // } else if (props.type === 'pivot-chart') {\n // vtable = new VTable.PivotChart(props.container, parseOption(props));\n // } else {\n // vtable = new VTable.ListTable(props.container, parseOption(props));\n // }\n const vtable = new props.vtableConstrouctor(props.container, parseOption(props));\n // vtable.scenegraph.stage.enableReactAttribute(ReactDOM);\n vtable.scenegraph.stage.reactAttribute = props.ReactDOM;\n vtable.scenegraph.stage.pluginService.register(new VTableReactAttributePlugin());\n vtable.scenegraph.stage.params.ReactDOM = props.ReactDOM;\n tableContext.current = { ...tableContext.current, table: vtable };\n isUnmount.current = false;\n },\n [parseOption]\n );\n\n const handleTableRender = useCallback(() => {\n if (!isUnmount.current) {\n if (!tableContext.current || !tableContext.current.table) {\n return;\n }\n // rebind events after render\n bindEventsToTable(tableContext.current.table, props, eventsBinded.current, TABLE_EVENTS);\n\n // to be fixed\n // will cause another useEffect\n setUpdateId(updateId + 1);\n if (props.onReady) {\n props.onReady(tableContext.current.table, updateId === 0);\n }\n }\n }, [updateId, setUpdateId, props]);\n\n const renderTable = useCallback(() => {\n if (tableContext.current.table) {\n // eslint-disable-next-line promise/catch-or-return\n tableContext.current.table.render();\n handleTableRender();\n }\n }, [handleTableRender]);\n\n useEffect(() => {\n const newOptionFromChildren = hasOption ? null : parseOptionFromChildren(props);\n\n if (!tableContext.current?.table) {\n if (!hasOption) {\n optionFromChildren.current = newOptionFromChildren;\n }\n\n createTable(props);\n renderTable();\n // bindEventsToTable(tableContext.current.table, props, null, TABLE_EVENTS);\n // tableContext.current = {\n // ...tableContext.current,\n // isChildrenUpdated: false\n // };\n eventsBinded.current = props;\n return;\n }\n\n if (hasOption) {\n if (!isEqual(eventsBinded.current.option, props.option, { skipFunction: skipFunctionDiff })) {\n // eslint-disable-next-line promise/catch-or-return\n tableContext.current.table.updateOption(parseOption(props));\n handleTableRender();\n eventsBinded.current = props;\n } else if (\n hasRecords &&\n !isEqual(eventsBinded.current.records, props.records, { skipFunction: skipFunctionDiff })\n ) {\n tableContext.current.table.setRecords(props.records as any[]);\n handleTableRender();\n eventsBinded.current = props;\n }\n return;\n }\n\n const newOption = pickWithout(props, notOptionKeys);\n\n if (\n !isEqual(newOption, prevOption.current, { skipFunction: skipFunctionDiff }) ||\n // tableContext.current.isChildrenUpdated\n !isEqual(newOptionFromChildren, optionFromChildren.current, { skipFunction: skipFunctionDiff })\n ) {\n prevOption.current = newOption;\n optionFromChildren.current = newOptionFromChildren;\n\n // eslint-disable-next-line promise/catch-or-return\n tableContext.current.table.updateOption(parseOption(props));\n handleTableRender();\n eventsBinded.current = props;\n } else if (hasRecords && !isEqual(props.records, prevRecords.current, { skipFunction: skipFunctionDiff })) {\n prevRecords.current = props.records;\n tableContext.current.table.setRecords(props.records);\n handleTableRender();\n eventsBinded.current = props;\n }\n // tableContext.current = {\n // ...tableContext.current,\n // isChildrenUpdated: false\n // };\n }, [createTable, hasOption, hasRecords, parseOption, handleTableRender, renderTable, skipFunctionDiff, props]);\n\n useEffect(() => {\n return () => {\n if (tableContext) {\n if (tableContext.current && tableContext.current.table) {\n tableContext.current.table.release();\n tableContext.current = null;\n }\n }\n eventsBinded.current = null;\n isUnmount.current = true;\n };\n }, []);\n\n return (\n <RootTableContext.Provider value={tableContext.current}>\n {toArray(props.children).map((child: React.ReactNode, index: number) => {\n if (typeof child === 'string') {\n return;\n }\n\n const childId = getComponentId(child, index);\n\n // const componentName =\n // child && (child as any).type && ((child as any).type.displayName || (child as any).type.name);\n // const childId = `${componentName}-${index}`;\n\n return (\n // <React.Fragment key={(child as any)?.props?.id ?? (child as any)?.id ?? `child-${index}`}>\n // {React.cloneElement(child as IMarkElement, {\n // updateId: updateId\n // })}\n // </React.Fragment>\n <React.Fragment key={childId}>\n {React.cloneElement(child as React.ReactElement<any, React.JSXElementConstructor<any>>, {\n updateId: updateId,\n componentId: childId,\n componentIndex: index\n })}\n </React.Fragment>\n );\n })}\n </RootTableContext.Provider>\n );\n});\n\nexport const createTable = <T extends Props>(\n componentName: string,\n defaultProps?: Partial<T>,\n callback?: (props: T) => T\n) => {\n const Com = withContainer<ContainerProps, T>(BaseTable as any, componentName, (props: T) => {\n // props.type = type;\n\n if (defaultProps) {\n return Object.assign(props, defaultProps);\n }\n\n // if (callback) {\n // return callback(props);\n // }\n\n // if (type) {\n // return { ...props, type };\n // }\n return props;\n });\n Com.displayName = componentName;\n return Com;\n};\n"]}
@@ -1,3 +1,5 @@
1
1
  export { ListTable } from './list-table';
2
2
  export { PivotTable } from './pivot-table';
3
3
  export { PivotChart, registerChartModule } from './pivot-chart';
4
+ export { ListTableSimple } from './list-table-simple';
5
+ export { PivotTableSimple } from './pivot-table-simple';
@@ -3,4 +3,8 @@ export { ListTable } from "./list-table";
3
3
  export { PivotTable } from "./pivot-table";
4
4
 
5
5
  export { PivotChart, registerChartModule } from "./pivot-chart";
6
+
7
+ export { ListTableSimple } from "./list-table-simple";
8
+
9
+ export { PivotTableSimple } from "./pivot-table-simple";
6
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["tables/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC","file":"index.js","sourcesContent":["export { ListTable } from './list-table';\nexport { PivotTable } from './pivot-table';\nexport { PivotChart, registerChartModule } from './pivot-chart';\n"]}
1
+ {"version":3,"sources":["tables/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC","file":"index.js","sourcesContent":["export { ListTable } from './list-table';\nexport { PivotTable } from './pivot-table';\nexport { PivotChart, registerChartModule } from './pivot-chart';\nexport { ListTableSimple } from './list-table-simple';\nexport { PivotTableSimple } from './pivot-table-simple';\n"]}
@@ -0,0 +1,8 @@
1
+ import type React from 'react';
2
+ import type { ListTableConstructorOptions } from '@visactor/vtable';
3
+ import type { BaseTableProps } from './base-table';
4
+ export interface ListTableProps extends Omit<BaseTableProps, 'records'>, Omit<ListTableConstructorOptions, 'container'> {
5
+ }
6
+ export declare const ListTableSimple: React.ForwardRefExoticComponent<ListTableProps & {
7
+ children?: React.ReactNode;
8
+ } & import("../containers/withContainer").ContainerProps & React.RefAttributes<any>>;
@@ -0,0 +1,9 @@
1
+ import { ListTableSimple as ListTableConstrouctor } from "@visactor/vtable";
2
+
3
+ import { createTable } from "./base-table";
4
+
5
+ export const ListTableSimple = createTable("ListTable", {
6
+ type: "list-table",
7
+ vtableConstrouctor: ListTableConstrouctor
8
+ });
9
+ //# sourceMappingURL=list-table-simple.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["tables/list-table-simple.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,IAAI,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAE5E,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAM3C,MAAM,CAAC,MAAM,eAAe,GAAG,WAAW,CAA0C,WAAW,EAAE;IAC/F,IAAI,EAAE,YAAY;IAClB,kBAAkB,EAAE,qBAA4B;CACjD,CAAC,CAAC","file":"list-table-simple.js","sourcesContent":["import type React from 'react';\nimport type { ListTableConstructorOptions } from '@visactor/vtable';\nimport { ListTableSimple as ListTableConstrouctor } from '@visactor/vtable';\nimport type { BaseTableProps } from './base-table';\nimport { createTable } from './base-table';\n\nexport interface ListTableProps\n extends Omit<BaseTableProps, 'records'>,\n Omit<ListTableConstructorOptions, 'container'> {}\n\nexport const ListTableSimple = createTable<React.PropsWithChildren<ListTableProps>>('ListTable', {\n type: 'list-table',\n vtableConstrouctor: ListTableConstrouctor as any\n});\n"]}
@@ -1,7 +1,7 @@
1
1
  import type React from 'react';
2
2
  import type { ListTableConstructorOptions } from '@visactor/vtable';
3
3
  import type { BaseTableProps } from './base-table';
4
- export interface ListTableProps extends Omit<BaseTableProps, 'records' | 'type'>, Omit<ListTableConstructorOptions, 'container'> {
4
+ export interface ListTableProps extends Omit<BaseTableProps, 'records'>, Omit<ListTableConstructorOptions, 'container'> {
5
5
  }
6
6
  export declare const ListTable: React.ForwardRefExoticComponent<ListTableProps & {
7
7
  children?: React.ReactNode;
@@ -1,4 +1,9 @@
1
+ import { ListTable as ListTableConstrouctor } from "@visactor/vtable";
2
+
1
3
  import { createTable } from "./base-table";
2
4
 
3
- export const ListTable = createTable("ListTable", "list-table");
5
+ export const ListTable = createTable("ListTable", {
6
+ type: "list-table",
7
+ vtableConstrouctor: ListTableConstrouctor
8
+ });
4
9
  //# sourceMappingURL=list-table.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["tables/list-table.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAM3C,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAA0C,WAAW,EAAE,YAAY,CAAC,CAAC","file":"list-table.js","sourcesContent":["import type React from 'react';\nimport type { ListTableConstructorOptions } from '@visactor/vtable';\nimport type { BaseTableProps } from './base-table';\nimport { createTable } from './base-table';\n\nexport interface ListTableProps\n extends Omit<BaseTableProps, 'records' | 'type'>,\n Omit<ListTableConstructorOptions, 'container'> {}\n\nexport const ListTable = createTable<React.PropsWithChildren<ListTableProps>>('ListTable', 'list-table');\n"]}
1
+ {"version":3,"sources":["tables/list-table.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,IAAI,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAM3C,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAA0C,WAAW,EAAE;IACzF,IAAI,EAAE,YAAY;IAClB,kBAAkB,EAAE,qBAA4B;CACjD,CAAC,CAAC","file":"list-table.js","sourcesContent":["import type React from 'react';\nimport type { ListTableConstructorOptions } from '@visactor/vtable';\nimport { ListTable as ListTableConstrouctor } from '@visactor/vtable';\nimport type { BaseTableProps } from './base-table';\nimport { createTable } from './base-table';\n\nexport interface ListTableProps\n extends Omit<BaseTableProps, 'records'>,\n Omit<ListTableConstructorOptions, 'container'> {}\n\nexport const ListTable = createTable<React.PropsWithChildren<ListTableProps>>('ListTable', {\n type: 'list-table',\n vtableConstrouctor: ListTableConstrouctor as any\n});\n"]}
@@ -1,9 +1,13 @@
1
1
  import type React from 'react';
2
2
  import type { PivotChartConstructorOptions } from '@visactor/vtable';
3
3
  import type { BaseTableProps } from './base-table';
4
- export interface PivotChartProps extends Omit<BaseTableProps, 'records' | 'type'>, Omit<PivotChartConstructorOptions, 'container'> {
4
+ interface AnyRecords {
5
+ records: Record<string, unknown>[];
6
+ }
7
+ export interface PivotChartProps extends Omit<BaseTableProps, 'records'>, Omit<PivotChartConstructorOptions, 'container' | 'records'>, AnyRecords {
5
8
  }
6
9
  export declare const PivotChart: React.ForwardRefExoticComponent<PivotChartProps & {
7
10
  children?: React.ReactNode;
8
11
  } & import("../containers/withContainer").ContainerProps & React.RefAttributes<any>>;
9
12
  export declare function registerChartModule(name: string, chart: any): void;
13
+ export {};
@@ -1,10 +1,15 @@
1
- import * as VTable from "@visactor/vtable";
1
+ import { register } from "@visactor/vtable";
2
+
3
+ import { PivotChart as PivotChartConstrouctor } from "@visactor/vtable";
2
4
 
3
5
  import { createTable } from "./base-table";
4
6
 
5
- export const PivotChart = createTable("PivotChart", "pivot-chart");
7
+ export const PivotChart = createTable("PivotChart", {
8
+ type: "pivot-chart",
9
+ vtableConstrouctor: PivotChartConstrouctor
10
+ });
6
11
 
7
12
  export function registerChartModule(name, chart) {
8
- VTable.register.chartModule(name, chart);
13
+ register.chartModule(name, chart);
9
14
  }
10
15
  //# sourceMappingURL=pivot-chart.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["tables/pivot-chart.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAG3C,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAM3C,MAAM,CAAC,MAAM,UAAU,GAAG,WAAW,CAA2C,YAAY,EAAE,aAAa,CAAC,CAAC;AAE7G,MAAM,UAAU,mBAAmB,CAAC,IAAY,EAAE,KAAU;IAC1D,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC3C,CAAC","file":"pivot-chart.js","sourcesContent":["import type React from 'react';\nimport * as VTable from '@visactor/vtable';\nimport type { PivotChartConstructorOptions } from '@visactor/vtable';\nimport type { BaseTableProps } from './base-table';\nimport { createTable } from './base-table';\n\nexport interface PivotChartProps\n extends Omit<BaseTableProps, 'records' | 'type'>,\n Omit<PivotChartConstructorOptions, 'container'> {}\n\nexport const PivotChart = createTable<React.PropsWithChildren<PivotChartProps>>('PivotChart', 'pivot-chart');\n\nexport function registerChartModule(name: string, chart: any) {\n VTable.register.chartModule(name, chart);\n}\n"]}
1
+ {"version":3,"sources":["tables/pivot-chart.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,UAAU,IAAI,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAExE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAU3C,MAAM,CAAC,MAAM,UAAU,GAAG,WAAW,CAA2C,YAAY,EAAE;IAC5F,IAAI,EAAE,aAAa;IACnB,kBAAkB,EAAE,sBAA6B;CAClD,CAAC,CAAC;AAEH,MAAM,UAAU,mBAAmB,CAAC,IAAY,EAAE,KAAU;IAC1D,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AACpC,CAAC","file":"pivot-chart.js","sourcesContent":["import type React from 'react';\nimport { register } from '@visactor/vtable';\nimport type { PivotChartConstructorOptions } from '@visactor/vtable';\nimport { PivotChart as PivotChartConstrouctor } from '@visactor/vtable';\nimport type { BaseTableProps } from './base-table';\nimport { createTable } from './base-table';\n\ninterface AnyRecords {\n records: Record<string, unknown>[];\n}\nexport interface PivotChartProps\n extends Omit<BaseTableProps, 'records'>,\n Omit<PivotChartConstructorOptions, 'container' | 'records'>,\n AnyRecords {}\n\nexport const PivotChart = createTable<React.PropsWithChildren<PivotChartProps>>('PivotChart', {\n type: 'pivot-chart',\n vtableConstrouctor: PivotChartConstrouctor as any\n});\n\nexport function registerChartModule(name: string, chart: any) {\n register.chartModule(name, chart);\n}\n"]}
@@ -0,0 +1,8 @@
1
+ import type React from 'react';
2
+ import type { PivotTableConstructorOptions } from '@visactor/vtable';
3
+ import type { BaseTableProps } from './base-table';
4
+ export interface PivotTableProps extends Omit<BaseTableProps, 'records'>, Omit<PivotTableConstructorOptions, 'container'> {
5
+ }
6
+ export declare const PivotTableSimple: React.ForwardRefExoticComponent<PivotTableProps & {
7
+ children?: React.ReactNode;
8
+ } & import("../containers/withContainer").ContainerProps & React.RefAttributes<any>>;
@@ -0,0 +1,9 @@
1
+ import { PivotTableSimple as PivotTableConstrouctor } from "@visactor/vtable";
2
+
3
+ import { createTable } from "./base-table";
4
+
5
+ export const PivotTableSimple = createTable("PivotTable", {
6
+ type: "pivot-table",
7
+ vtableConstrouctor: PivotTableConstrouctor
8
+ });
9
+ //# sourceMappingURL=pivot-table-simple.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["tables/pivot-table-simple.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,IAAI,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE9E,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAM3C,MAAM,CAAC,MAAM,gBAAgB,GAAG,WAAW,CAA2C,YAAY,EAAE;IAClG,IAAI,EAAE,aAAa;IACnB,kBAAkB,EAAE,sBAA6B;CAClD,CAAC,CAAC","file":"pivot-table-simple.js","sourcesContent":["import type React from 'react';\nimport type { PivotTableConstructorOptions } from '@visactor/vtable';\nimport { PivotTableSimple as PivotTableConstrouctor } from '@visactor/vtable';\nimport type { BaseTableProps } from './base-table';\nimport { createTable } from './base-table';\n\nexport interface PivotTableProps\n extends Omit<BaseTableProps, 'records'>,\n Omit<PivotTableConstructorOptions, 'container'> {}\n\nexport const PivotTableSimple = createTable<React.PropsWithChildren<PivotTableProps>>('PivotTable', {\n type: 'pivot-table',\n vtableConstrouctor: PivotTableConstrouctor as any\n});\n"]}
@@ -1,7 +1,7 @@
1
1
  import type React from 'react';
2
2
  import type { PivotTableConstructorOptions } from '@visactor/vtable';
3
3
  import type { BaseTableProps } from './base-table';
4
- export interface PivotTableProps extends Omit<BaseTableProps, 'records' | 'type'>, Omit<PivotTableConstructorOptions, 'container'> {
4
+ export interface PivotTableProps extends Omit<BaseTableProps, 'records'>, Omit<PivotTableConstructorOptions, 'container'> {
5
5
  }
6
6
  export declare const PivotTable: React.ForwardRefExoticComponent<PivotTableProps & {
7
7
  children?: React.ReactNode;
@@ -1,4 +1,9 @@
1
+ import { PivotTable as PivotTableConstrouctor } from "@visactor/vtable";
2
+
1
3
  import { createTable } from "./base-table";
2
4
 
3
- export const PivotTable = createTable("PivotTable", "pivot-table");
5
+ export const PivotTable = createTable("PivotTable", {
6
+ type: "pivot-table",
7
+ vtableConstrouctor: PivotTableConstrouctor
8
+ });
4
9
  //# sourceMappingURL=pivot-table.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["tables/pivot-table.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAM3C,MAAM,CAAC,MAAM,UAAU,GAAG,WAAW,CAA2C,YAAY,EAAE,aAAa,CAAC,CAAC","file":"pivot-table.js","sourcesContent":["import type React from 'react';\nimport type { PivotTableConstructorOptions } from '@visactor/vtable';\nimport type { BaseTableProps } from './base-table';\nimport { createTable } from './base-table';\n\nexport interface PivotTableProps\n extends Omit<BaseTableProps, 'records' | 'type'>,\n Omit<PivotTableConstructorOptions, 'container'> {}\n\nexport const PivotTable = createTable<React.PropsWithChildren<PivotTableProps>>('PivotTable', 'pivot-table');\n"]}
1
+ {"version":3,"sources":["tables/pivot-table.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,IAAI,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAExE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAM3C,MAAM,CAAC,MAAM,UAAU,GAAG,WAAW,CAA2C,YAAY,EAAE;IAC5F,IAAI,EAAE,aAAa;IACnB,kBAAkB,EAAE,sBAA6B;CAClD,CAAC,CAAC","file":"pivot-table.js","sourcesContent":["import type React from 'react';\nimport type { PivotTableConstructorOptions } from '@visactor/vtable';\nimport { PivotTable as PivotTableConstrouctor } from '@visactor/vtable';\nimport type { BaseTableProps } from './base-table';\nimport { createTable } from './base-table';\n\nexport interface PivotTableProps\n extends Omit<BaseTableProps, 'records'>,\n Omit<PivotTableConstructorOptions, 'container'> {}\n\nexport const PivotTable = createTable<React.PropsWithChildren<PivotTableProps>>('PivotTable', {\n type: 'pivot-table',\n vtableConstrouctor: PivotTableConstrouctor as any\n});\n"]}
package/es/util.js CHANGED
@@ -32,5 +32,4 @@ export const findAllByType = (children, type) => {
32
32
  export const findChildByType = (children, type) => {
33
33
  const result = findAllByType(children, type);
34
34
  return null == result ? void 0 : result[0];
35
- };
36
- //# sourceMappingURL=util.js.map
35
+ };
package/es/vtable.d.ts CHANGED
@@ -1,2 +1 @@
1
- import * as VTable from '@visactor/vtable';
2
- export { VTable };
1
+
package/es/vtable.js CHANGED
@@ -1,4 +1,2 @@
1
- import * as VTable from "@visactor/vtable";
2
-
3
- export { VTable };
1
+ "use strict";
4
2
  //# sourceMappingURL=vtable.js.map
package/es/vtable.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["vtable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EAAE,MAAM,EAAE,CAAC","file":"vtable.js","sourcesContent":["import * as VTable from '@visactor/vtable';\n\nexport { VTable };\n"]}
1
+ {"version":3,"sources":["vtable.ts"],"names":[],"mappings":"","file":"vtable.js","sourcesContent":["// import * as VTable from '@visactor/vtable';\n\n// export { VTable };\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visactor/react-vtable",
3
- "version": "1.6.0-alpha.5",
3
+ "version": "1.6.1",
4
4
  "description": "The react version of VTable",
5
5
  "keywords": [
6
6
  "react",
@@ -43,10 +43,10 @@
43
43
  "access": "public"
44
44
  },
45
45
  "dependencies": {
46
- "@visactor/vtable": "1.6.0-alpha.5",
47
- "@visactor/vutils": "~0.18.9",
46
+ "@visactor/vutils": "~0.18.13",
48
47
  "react-is": "^18.2.0",
49
- "react-reconciler": "0.29.2"
48
+ "react-reconciler": "0.29.2",
49
+ "@visactor/vtable": "1.6.1"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@visactor/vchart": "1.11.10",
@@ -92,8 +92,8 @@
92
92
  "@arco-design/web-react": "2.60.2",
93
93
  "@types/react-reconciler": "0.28.8",
94
94
  "@internal/bundler": "0.0.1",
95
- "@internal/ts-config": "0.0.1",
96
- "@internal/eslint-config": "0.0.1"
95
+ "@internal/eslint-config": "0.0.1",
96
+ "@internal/ts-config": "0.0.1"
97
97
  },
98
98
  "scripts": {
99
99
  "start": "vite ./demo",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["components/base-component.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+CAAqD;AACrD,6CAA+D;AAG/D,6DAAgD;AAChD,gDAAmD;AAEnD,0DAAsD;AAS/C,MAAM,eAAe,GAAG,CAC7B,aAAqB,EACrB,UAAkB,EAClB,eAA+C,EAC/C,QAAkB,EAClB,EAAE;IACF,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,UAAU,EAAE,gBAAgB,EAAE,UAAU,CAAC,CAAC;IACpE,MAAM,aAAa,GAAG,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;IAErG,MAAM,IAAI,GAAgB,CAAC,KAAQ,EAAE,EAAE;QACrC,MAAM,OAAO,GAAG,IAAA,kBAAU,EAAC,eAAgB,CAAC,CAAC;QAG7C,MAAM,YAAY,GAAG,eAAK,CAAC,MAAM,CAAI,IAAI,CAAC,CAAC;QAC3C,MAAM,QAAQ,GAAG,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G,GAAG,GAAG,KAAK,CAAC,CAAC;YAC3F,CAAC,CAAC,CAAC;SACJ;KACF;AACH,CAAC;AAED,SAAS,mBAAmB,CAAC,QAAmB,EAAE,WAAmB;IACnE,IAAI,cAAc,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;QACvD,OAAO,eAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAwB,EAAE,CAAC,KAAmB,EAAE,KAAK,EAAE,EAAE;YACjF,IAAI,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE;gBACxB,OAAO,mBAAmB,CAAC,KAAK,CAAC,KAAK,CAAC,QAAwB,EAAE,WAAW,GAAG,GAAG,GAAG,KAAK,CAAC,CAAC;aAC7F;iBAAM,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,eAAe,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,sBAAsB,EAAE;gBAC9F,OAAO,eAAK,CAAC,aAAa,CAAC,4BAAY,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE,EAAE,KAAK,CAAC,CAAC;aAC/E;YACD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;KACJ;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,cAAc,CAAC,GAAQ;IAC9B,OAAO,GAAG,IAAI,GAAG,CAAC,QAAQ,KAAK,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AAC7D,CAAC","file":"base-component.js","sourcesContent":["import type { ReactElement, ReactNode } from 'react';\nimport React, { useContext, useEffect } from 'react';\nimport { isEqual, isNil, pickWithout } from '@visactor/vutils';\n\nimport type { TableContextType } from '../context/table';\nimport RootTableContext from '../context/table';\nimport { bindEventsToTable } from '../eventsUtils';\nimport { uid } from '../util';\nimport { CustomLayout } from './custom/custom-layout';\n\nexport interface BaseComponentProps {\n id?: string | number;\n children?: React.ReactNode;\n}\n\ntype ComponentProps = BaseComponentProps & { updateId?: number; componentId?: string; componentIndex?: number };\n\nexport const createComponent = <T extends ComponentProps>(\n componentName: string,\n optionName: string,\n supportedEvents?: Record<string, string> | null,\n isSingle?: boolean\n) => {\n const ignoreKeys = ['id', 'updateId', 'componentIndex', 'children'];\n const notOptionKeys = supportedEvents ? Object.keys(supportedEvents).concat(ignoreKeys) : ignoreKeys;\n\n const Comp: React.FC<T> = (props: T) => {\n const context = useContext(RootTableContext);\n // const id = React.useRef<string | number>(isNil(props.id) ? uid(optionName) : props.id);\n\n const eventsBinded = React.useRef<T>(null);\n const updateId = React.useRef<number>(props.updateId);\n // const componentOption = React.useRef<Partial<T>>();\n\n if (props.updateId !== updateId.current) {\n // update triggered by table when table is rendered\n updateId.current = props.updateId;\n\n // rebind events after table render\n const hasPrevEventsBinded = supportedEvents\n ? bindEventsToTable(context.table, props, eventsBinded.current, supportedEvents)\n : false;\n if (hasPrevEventsBinded) {\n eventsBinded.current = props;\n }\n // } else {\n // const newComponentOption: Partial<T> = pickWithout<T>(props, notOptionKeys);\n\n // if (!isEqual(newComponentOption, componentOption.current)) {\n // componentOption.current = newComponentOption;\n // updateToContext(context, id.current, optionName, isSingle, newComponentOption);\n // }\n }\n\n useEffect(() => {\n return () => {\n if (supportedEvents) {\n bindEventsToTable(context.table, null, eventsBinded.current, supportedEvents);\n }\n // deleteToContext(context, id.current, optionName, isSingle);\n };\n }, []);\n\n // children are all custom layout temply\n // return props.children\n // ? React.cloneElement(props.children as ReactElement, { componentIndex: props.componentIndex })\n // : null;\n // if (props.children) {\n // return React.Children.map(props.children as ReactElement, (child: ReactElement) => {\n // if (child.props.role === 'custom-layout' || child.props.role === 'header-custom-layout') {\n // return React.createElement(CustomLayout, { componentId: props.componentId }, child);\n // }\n // });\n // }\n return parseCustomChildren(props.children, props.componentId);\n };\n\n Comp.displayName = componentName;\n\n (Comp as any).parseOption = (props: T & { updateId?: number; componentId?: string }) => {\n const newComponentOption: Partial<T> = pickWithout<T>(props, notOptionKeys);\n // deal width customLayout\n if (props.children) {\n const { children } = props;\n React.Children.map(children as ReactElement, (child: ReactElement, index) => {\n parseChild(child, props, newComponentOption, notOptionKeys, props.componentId + '-' + index);\n });\n }\n // if (props.children && (props.children as React.ReactElement).props.role === 'custom-layout') {\n // (newComponentOption as any).customLayout = 'react-custom-layout';\n // }\n\n return {\n option: newComponentOption,\n optionName,\n isSingle\n };\n };\n\n return Comp;\n};\n\nfunction parseChild(\n child: ReactElement,\n componentProps: any,\n newComponentOption: any,\n notOptionKeys: string[],\n componentId: string\n) {\n if (child.props.role === 'custom-layout') {\n (newComponentOption as any).customLayout = 'react-custom-layout';\n (newComponentOption as any).customLayoutComponentId = componentId;\n }\n if (child.props.role === 'header-custom-layout') {\n (newComponentOption as any).headerCustomLayout = 'react-custom-layout';\n (newComponentOption as any).headerCustomLayoutComponentId = componentId;\n }\n if ((child.type as any).displayName === 'ListColumn') {\n if (!newComponentOption.columns) {\n newComponentOption.columns = [];\n }\n const childOption = pickWithout(child.props, notOptionKeys);\n newComponentOption.columns.push(childOption);\n childOption.componentId = componentId;\n if (child.props.children) {\n React.Children.map(child.props.children as ReactElement, (child: ReactElement, index) => {\n parseChild(child, componentProps, childOption, notOptionKeys, componentId + '-' + index);\n });\n }\n }\n}\n\nfunction parseCustomChildren(children: ReactNode, componentId: string): ReactNode | undefined {\n if (isReactElement(children) || Array.isArray(children)) {\n return React.Children.map(children as ReactElement, (child: ReactElement, index) => {\n if (child.props.children) {\n return parseCustomChildren(child.props.children as ReactElement, componentId + '-' + index);\n } else if (child.props.role === 'custom-layout' || child.props.role === 'header-custom-layout') {\n return React.createElement(CustomLayout, { componentId: componentId }, child);\n }\n return null;\n });\n }\n return null;\n}\n\nfunction isReactElement(obj: any) {\n return obj && obj.$$typeof === Symbol.for('react.element');\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["components/component/emptyTip.tsx"],"names":[],"mappings":";;;AAAA,sDAAoD;AAsBvC,QAAA,QAAQ,GAAG,IAAA,gCAAe,EAAgB,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC","file":"emptyTip.js","sourcesContent":["import { createComponent } from '../base-component';\nimport type { BaseComponentProps } from '../base-component';\n\nexport type EmptyTipProps = {\n text?: string;\n textStyle?: {\n fontSize?: number;\n fontFamily?: string;\n fontWeight?: string | number;\n fontVariant?: string;\n lineHeight?: number | string;\n underline?: number;\n lineThrough?: number;\n color?: string;\n };\n icon?: {\n width?: number;\n height?: number;\n image: string;\n };\n} & BaseComponentProps;\n\nexport const EmptyTip = createComponent<EmptyTipProps>('EmptyTip', 'emptyTip', undefined, true);\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["components/component/menu.tsx"],"names":[],"mappings":";;;AACA,sDAAoD;AAcvC,QAAA,IAAI,GAAG,IAAA,gCAAe,EAAY,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC","file":"menu.js","sourcesContent":["import type { BaseComponentProps } from '../base-component';\nimport { createComponent } from '../base-component';\nimport type { TYPES } from '@visactor/vtable';\n\nexport type MenuProps = {\n /** 代替原来的option.menuType html目前实现较完整 先默认html渲染方式*/\n renderMode?: 'canvas' | 'html';\n /** 内置下拉菜单的全局设置项 目前只针对基本表格有效 会对每个表头单元格开启默认的下拉菜单功能。代替原来的option.dropDownMenu*/\n defaultHeaderMenuItems?: TYPES.MenuListItem[];\n /** 右键菜单。代替原来的option.contextmenu */\n contextMenuItems?: TYPES.MenuListItem[] | ((field: string, row: number, col: number) => TYPES.MenuListItem[]);\n /** 设置选中状态的菜单。代替原来的option.dropDownMenuHighlight */\n dropDownMenuHighlight?: TYPES.DropDownMenuHighlightInfo[];\n} & BaseComponentProps;\n\nexport const Menu = createComponent<MenuProps>('Menu', 'menu', undefined, true);\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["components/component/tooltip.tsx"],"names":[],"mappings":";;;AACA,sDAAoD;AAWvC,QAAA,OAAO,GAAG,IAAA,gCAAe,EAAe,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC","file":"tooltip.js","sourcesContent":["import type { BaseComponentProps } from '../base-component';\nimport { createComponent } from '../base-component';\n\nexport type TooltipProps = {\n /** html目前实现较完整 先默认html渲染方式 */\n renderMode?: 'html'; // 目前暂不支持canvas方案\n /** 代替原来hover:isShowTooltip配置 暂时需要将renderMode配置为html才能显示,canvas的还未开发*/\n isShowOverflowTextTooltip?: boolean;\n /** 是否将 tooltip 框限制在画布区域内,默认开启。针对renderMode:\"html\"有效 */\n confine?: boolean;\n} & BaseComponentProps;\n\nexport const Tooltip = createComponent<TooltipProps>('Tooltip', 'tooltip', undefined, true);\n"]}
@@ -1,16 +0,0 @@
1
- import type { ReactElement, ReactNode, Ref, JSXElementConstructor } from 'react';
2
- import type { VRender } from '@visactor/vtable';
3
- type IGraphic = VRender.IGraphic;
4
- type TagAttributes = VRender.TagAttributes;
5
- type RadioAttributes = VRender.RadioAttributes;
6
- type CheckboxAttributes = VRender.CheckboxAttributes;
7
- type IEventParamsType = VRender.IEventParamsType;
8
- type GraphicProps<IGraphicGraphicAttribute> = {
9
- attribute: IGraphicGraphicAttribute;
10
- ref?: Ref<IGraphic>;
11
- children?: ReactNode;
12
- } & IEventParamsType;
13
- export declare const Tag: (props: GraphicProps<TagAttributes>) => ReactElement<GraphicProps<TagAttributes>, JSXElementConstructor<GraphicProps<TagAttributes>>>;
14
- export declare const Radio: (props: GraphicProps<RadioAttributes>) => ReactElement<GraphicProps<RadioAttributes>, JSXElementConstructor<GraphicProps<RadioAttributes>>>;
15
- export declare const Checkbox: (props: GraphicProps<CheckboxAttributes>) => ReactElement<GraphicProps<CheckboxAttributes>, JSXElementConstructor<GraphicProps<CheckboxAttributes>>>;
16
- export {};
@@ -1,7 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: !0
5
- }), exports.Checkbox = exports.Radio = exports.Tag = void 0, exports.Tag = "tag",
6
- exports.Radio = "radio", exports.Checkbox = "checkbox";
7
- //# sourceMappingURL=component.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["components/custom/component.ts"],"names":[],"mappings":";;;AAca,QAAA,GAAG,GAEqF,KAAY,CAAC;AAErG,QAAA,KAAK,GAEuF,OAAc,CAAC;AAE3G,QAAA,QAAQ,GAGnB,UAAiB,CAAC","file":"component.js","sourcesContent":["import type { ReactElement, ReactNode, Ref, JSXElementConstructor } from 'react';\nimport type { VRender } from '@visactor/vtable';\ntype IGraphic = VRender.IGraphic;\ntype TagAttributes = VRender.TagAttributes;\ntype RadioAttributes = VRender.RadioAttributes;\ntype CheckboxAttributes = VRender.CheckboxAttributes;\ntype IEventParamsType = VRender.IEventParamsType;\n\ntype GraphicProps<IGraphicGraphicAttribute> = {\n attribute: IGraphicGraphicAttribute;\n ref?: Ref<IGraphic>;\n children?: ReactNode;\n} & IEventParamsType;\n\nexport const Tag: (\n props: GraphicProps<TagAttributes>\n) => ReactElement<GraphicProps<TagAttributes>, JSXElementConstructor<GraphicProps<TagAttributes>>> = 'tag' as any;\n\nexport const Radio: (\n props: GraphicProps<RadioAttributes>\n) => ReactElement<GraphicProps<RadioAttributes>, JSXElementConstructor<GraphicProps<RadioAttributes>>> = 'radio' as any;\n\nexport const Checkbox: (\n props: GraphicProps<CheckboxAttributes>\n) => ReactElement<GraphicProps<CheckboxAttributes>, JSXElementConstructor<GraphicProps<CheckboxAttributes>>> =\n 'checkbox' as any;\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["components/custom/custom-layout.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,+CAAgG;AAChG,gEAAmD;AACnD,6CAA2C;AAG3C,6CAA0C;AAC1C,0DAAwD;AAExD,MAAM,EAAE,KAAK,EAAE,GAAG,gBAAO,CAAC;AAQnB,MAAM,YAAY,GAAgC,CAAC,KAA2C,EAAE,GAAG,EAAE,EAAE;IAC5G,MAAM,EAAE,WAAW,EAAE,QAAQ,EA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,MAAM,EAAE,MAAM;wBACd,KAAK;wBACL,MAAM;qBACP;oBACD,KAAK;iBACN,CAAC;gBAEF,MAAM,KAAK,GAAG,gBAAgB,CAAC,aAAa,CAAC;gBAC7C,yBAAyB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,IAAI,CAAC,CAAC;gBAE5D,KAAK,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC;YACrC,CAAC,CAAC,CAAC;SACJ;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAvHW,QAAA,YAAY,gBAuHvB;AAEF,SAAS,yBAAyB,CAAC,QAAsB,EAAE,gBAAqB,EAAE,IAAS;IACzF,uBAAU,CAAC,eAAe,CAAC,eAAK,CAAC,YAAY,CAAC,QAAQ,oBAAO,IAAI,EAAG,EAAE,gBAAgB,EAAE,IAAI,CAAC,CAAC;AAUhG,CAAC;AAED,SAAS,cAAc,CAAC,GAAG;IACzB,OAAO,GAAG,IAAI,GAAG,CAAC,QAAQ,KAAK,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AAC7D,CAAC;AAED,SAAS,WAAW,CAAC,GAAW,EAAE,GAAW,EAAE,KAAU;IACvD,MAAM,KAAK,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAC3C,MAAM,IAAI,GAAG,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAChG,OAAO,IAAI,CAAC;AACd,CAAC","file":"custom-layout.js","sourcesContent":["/* eslint-disable react-hooks/rules-of-hooks */\nimport type { PropsWithChildren, ReactElement } from 'react';\nimport React, { isValidElement, useCallback, useContext, useLayoutEffect, useRef } from 'react';\nimport RootTableContext from '../../context/table';\nimport { VRender } from '@visactor/vtable';\nimport type { ICustomLayoutFuc, CustomRenderFunctionArg } from '@visactor/vtable/src/ts-types';\nimport type { FiberRoot } from 'react-reconciler';\nimport { reconcilor } from './reconciler';\nimport { LegacyRoot } from 'react-reconciler/constants';\n\nconst { Group } = VRender;\ntype CustomLayoutProps = { componentId: string };\n\nexport type CustomLayoutFunctionArg = Partial<CustomRenderFunctionArg> & {\n role?: 'custom-layout' | 'header-custom-layout';\n renderDefault?: boolean;\n};\n\nexport const CustomLayout: React.FC<CustomLayoutProps> = (props: PropsWithChildren<CustomLayoutProps>, ref) => {\n const { componentId, children } = props;\n if (!isValidElement(children)) {\n return null;\n }\n const context = useContext(RootTableContext);\n const { table } = context;\n\n const isHeaderCustomLayout = children.props.role === 'header-custom-layout';\n\n // react customLayout component container cache\n const container = useRef<Map<string, FiberRoot>>(new Map());\n\n // customLayout function for vtable\n const createGraphic: ICustomLayoutFuc = useCallback(\n args => {\n const key = `${args.col}-${args.row}`;\n let group;\n if (container.current.has(key)) {\n const currentContainer = container.current.get(key);\n // reconcilor.updateContainer(React.cloneElement(children, { ...args }), currentContainer, null);\n reconcilorUpdateContainer(children, currentContainer, args);\n group = currentContainer.containerInfo;\n // 这里更新group,可能会残留dx dy\n } else {\n group = new Group({});\n const currentContainer = reconcilor.createContainer(group, LegacyRoot, null, null, null, 'custom', null, null);\n container.current.set(key, currentContainer);\n reconcilorUpdateContainer(children, currentContainer, args);\n // const ele = React.cloneElement(children, { ...args });\n // reconcilor.updateContainer(ele, currentContainer, null);\n }\n\n return {\n rootContainer: group,\n renderDefault: !!children.props.renderDefault\n };\n },\n [children]\n );\n\n const removeContainer = useCallback((col: number, row: number) => {\n const key = `${col}-${row}`;\n if (container.current.has(key)) {\n const currentContainer = container.current.get(key);\n reconcilor.updateContainer(null, currentContainer, null);\n // group = currentContainer.containerInfo;\n container.current.delete(key);\n }\n }, []);\n\n const removeAllContainer = useCallback(() => {\n container.current.forEach((value, key) => {\n const currentContainer = value;\n reconcilor.updateContainer(null, currentContainer, null);\n });\n container.current.clear();\n }, []);\n\n useLayoutEffect(() => {\n // init and release\n // eslint-disable-next-line no-undef\n console.log('init', props, table);\n // table && (table._reactCreateGraphic = createGraphic); // never go to here\n // table?.renderWithRecreateCells();\n return () => {\n // eslint-disable-next-line no-undef\n console.log('release', props, table);\n };\n }, []);\n\n useLayoutEffect(() => {\n // update props\n // eslint-disable-next-line no-undef\n console.log('update props', props, table);\n\n table?.checkReactCustomLayout(removeAllContainer); // init reactCustomLayout component\n if (table && !table.reactCustomLayout?.hasReactCreateGraphic(componentId, isHeaderCustomLayout)) {\n table.reactCustomLayout?.setReactCreateGraphic(\n componentId,\n createGraphic,\n // container.current,\n isHeaderCustomLayout\n ); // set customLayout function\n table.reactCustomLayout?.setReactRemoveGraphic(componentId, removeContainer, isHeaderCustomLayout); // set customLayout function\n table.reactCustomLayout?.updateCustomCell(componentId, isHeaderCustomLayout); // update cell content\n } else if (table) {\n // update all container\n container.current.forEach((value, key) => {\n const [col, row] = key.split('-').map(Number);\n // const width = table.getColWidth(col); // to be fixed: may be merge cell\n // const height = table.getRowHeight(row); // to be fixed: may be merge cell\n const { width, height } = getCellRect(col, row, table);\n const currentContainer = value;\n const args = {\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 // update element in container\n const group = currentContainer.containerInfo;\n reconcilorUpdateContainer(children, currentContainer, args);\n // reconcilor.updateContainer(React.cloneElement(children, { ...args }), currentContainer, null);\n table.scenegraph.updateNextFrame();\n });\n }\n });\n\n return null;\n};\n\nfunction reconcilorUpdateContainer(children: ReactElement, currentContainer: any, args: any) {\n reconcilor.updateContainer(React.cloneElement(children, { ...args }), currentContainer, null);\n // group = group.firstChild;\n // if (isReactElement(group.attribute.html?.dom)) {\n // const div = document.createElement('div');\n // const root = ReactDOM.createRoot(div as HTMLElement);\n // root.render(group.attribute.html.dom);\n // group.attribute.html.dom = div;\n // // debugger;\n // // group.html.dom = div;\n // }\n}\n\nfunction isReactElement(obj) {\n return obj && obj.$$typeof === Symbol.for('react.element');\n}\n\nfunction getCellRect(col: number, row: number, table: any) {\n const range = table.getCellRange(col, row);\n const rect = table.getCellsRect(range.start.col, range.start.row, range.end.col, range.end.row);\n return rect;\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["components/custom/graphic.ts"],"names":[],"mappings":";;;AA2Ba,QAAA,KAAK,GAGhB,OAAc,CAAC;AAEJ,QAAA,IAAI,GAGf,MAAa,CAAC;AAEH,QAAA,GAAG,GAGd,KAAY,CAAC;AAEF,QAAA,MAAM,GAGjB,QAAe,CAAC;AAEL,QAAA,KAAK,GAGhB,OAAc,CAAC;AAEJ,QAAA,IAAI,GAGf,MAAa,CAAC;AAEH,QAAA,IAAI,GAGf,MAAa,CAAC;AAEH,QAAA,IAAI,GAGf,MAAa,CAAC;AAEH,QAAA,MAAM,GAGjB,QAAe,CAAC;AAEL,QAAA,QAAQ,GAKjB,UAAiB,CAAC;AAET,QAAA,OAAO,GAKhB,SAAgB,CAAC","file":"graphic.js","sourcesContent":["// export const Group = 'group';\n// export const Rect = 'rect';\n// export const Text = 'text';\n\nimport type { ReactElement, ReactNode, Ref, JSXElementConstructor } from 'react';\nimport type { VRender } from '@visactor/vtable';\n\ntype IGraphic = VRender.IGraphic;\ntype IGroupGraphicAttribute = VRender.IGroupGraphicAttribute;\ntype ITextGraphicAttribute = VRender.ITextGraphicAttribute;\ntype IEventParamsType = VRender.IEventParamsType;\ntype IArcGraphicAttribute = VRender.IArcGraphicAttribute;\ntype ICircleGraphicAttribute = VRender.ICircleGraphicAttribute;\ntype IImageGraphicAttribute = VRender.IImageGraphicAttribute;\ntype ILineGraphicAttribute = VRender.ILineGraphicAttribute;\ntype IPathGraphicAttribute = VRender.IPathGraphicAttribute;\ntype IRectGraphicAttribute = VRender.IRectGraphicAttribute;\ntype ISymbolGraphicAttribute = VRender.ISymbolGraphicAttribute;\ntype IRichTextGraphicAttribute = VRender.IRichTextGraphicAttribute;\ntype IPolygonGraphicAttribute = VRender.IPolygonGraphicAttribute;\n\ntype GraphicProps<IGraphicGraphicAttribute> = {\n attribute: IGraphicGraphicAttribute;\n ref?: Ref<IGraphic>;\n children?: ReactNode;\n} & IEventParamsType;\n\nexport const Group: (\n props: GraphicProps<IGroupGraphicAttribute>\n) => ReactElement<GraphicProps<IGroupGraphicAttribute>, JSXElementConstructor<GraphicProps<IGroupGraphicAttribute>>> =\n 'group' as any;\n\nexport const Text: (\n props: GraphicProps<ITextGraphicAttribute>\n) => ReactElement<GraphicProps<ITextGraphicAttribute>, JSXElementConstructor<GraphicProps<ITextGraphicAttribute>>> =\n 'text' as any;\n\nexport const Arc: (\n props: GraphicProps<IArcGraphicAttribute>\n) => ReactElement<GraphicProps<IArcGraphicAttribute>, JSXElementConstructor<GraphicProps<IArcGraphicAttribute>>> =\n 'arc' as any;\n\nexport const Circle: (\n props: GraphicProps<ICircleGraphicAttribute>\n) => ReactElement<GraphicProps<ICircleGraphicAttribute>, JSXElementConstructor<GraphicProps<ICircleGraphicAttribute>>> =\n 'circle' as any;\n\nexport const Image: (\n props: GraphicProps<IImageGraphicAttribute>\n) => ReactElement<GraphicProps<IImageGraphicAttribute>, JSXElementConstructor<GraphicProps<IImageGraphicAttribute>>> =\n 'image' as any;\n\nexport const Line: (\n props: GraphicProps<ILineGraphicAttribute>\n) => ReactElement<GraphicProps<ILineGraphicAttribute>, JSXElementConstructor<GraphicProps<ILineGraphicAttribute>>> =\n 'line' as any;\n\nexport const Path: (\n props: GraphicProps<IPathGraphicAttribute>\n) => ReactElement<GraphicProps<IPathGraphicAttribute>, JSXElementConstructor<GraphicProps<IPathGraphicAttribute>>> =\n 'path' as any;\n\nexport const Rect: (\n props: GraphicProps<IRectGraphicAttribute>\n) => ReactElement<GraphicProps<IRectGraphicAttribute>, JSXElementConstructor<GraphicProps<IRectGraphicAttribute>>> =\n 'rect' as any;\n\nexport const Symbol: (\n props: GraphicProps<ISymbolGraphicAttribute>\n) => ReactElement<GraphicProps<ISymbolGraphicAttribute>, JSXElementConstructor<GraphicProps<ISymbolGraphicAttribute>>> =\n 'symbol' as any;\n\nexport const RichText: (\n props: GraphicProps<IRichTextGraphicAttribute>\n) => ReactElement<\n GraphicProps<IRichTextGraphicAttribute>,\n JSXElementConstructor<GraphicProps<IRichTextGraphicAttribute>>\n> = 'richtext' as any;\n\nexport const Polygon: (\n props: GraphicProps<IPolygonGraphicAttribute>\n) => ReactElement<\n GraphicProps<IPolygonGraphicAttribute>,\n JSXElementConstructor<GraphicProps<IPolygonGraphicAttribute>>\n> = 'polygon' as any;\n"]}
@@ -1,5 +0,0 @@
1
- import { VRender } from '@visactor/vtable';
2
- import ReactReconciler from 'react-reconciler';
3
- type Graphic = VRender.Graphic;
4
- export declare const reconcilor: ReactReconciler.Reconciler<Graphic, any, any, Graphic, Graphic>;
5
- export {};
@@ -1 +0,0 @@
1
- {"version":3,"sources":["components/custom/reconciler.ts"],"names":[],"mappings":";;;;;;AAAA,6CAA2C;AAC3C,6CAA8C;AAC9C,kDAA0B;AAC1B,wEAA+C;AAC/C,gEAAqE;AAErE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,uBAAuB,EAAE,GAAG,EAAE,GAAG,gBAAO,CAAC;AAI7D,QAAA,UAAU,GAAG,IAAA,0BAAe,EAAC;IACxC,gBAAgB,EAAE,IAAI;IACtB,mBAAmB,EAAE,KAAK;IAE1B,cAAc,EAAE,CAAC,IAAY,EAAE,KAAU,EAAE,QAAQ,EAAE,EAAE;QACrD,MAAM,OAAO,GAAG,aAAa,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC3C,IAAI,OAAO,EAAE;YACX,mBAAmB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;SACrC;aAAM;YACL,OAAO,SAAS,CAAC;SAGlB;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,kBAAkB,EAAE,CAAC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AC,EAAE;YAC7E,OAAO,CAAC,mBAAmB,CAAC,uBAAuB,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;SAClF;KACF;IACD,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;QAC9B,IAAI,WAAW,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,QAAQ,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,OAAO,CAAC,EAAE;YAC7E,OAAO,CAAC,gBAAgB,CAAC,uBAAuB,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;SAC/E;KACF;IAGD,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC3C,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO,EAAE;QAC5B,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;KAC7C;AACH,CAAC","file":"reconciler.js","sourcesContent":["import { VRender } from '@visactor/vtable';\nimport { isFunction } from '@visactor/vutils';\nimport React from 'react';\nimport ReactReconciler from 'react-reconciler';\nimport { DefaultEventPriority } from 'react-reconciler/constants.js';\n\nconst { application, createText, REACT_TO_CANOPUS_EVENTS, Tag } = VRender;\ntype Graphic = VRender.Graphic;\ntype Instance = Graphic;\n\nexport const reconcilor = ReactReconciler({\n supportsMutation: true,\n supportsPersistence: false,\n\n createInstance: (type: string, props: any, instance) => {\n const graphic = createGraphic(type, props);\n if (graphic) {\n bindEventsToGraphic(graphic, props);\n } else {\n return undefined;\n // createInstance\n // graphic = createGraphic('group', {});\n }\n return graphic;\n },\n\n createTextInstance: (text, instance) => {\n // const textGraphic = createText({ text });\n // return textGraphic;\n // debugger;\n // return document.createTextNode(text);\n return undefined;\n },\n\n appendInitialChild: (parentInstance: Instance, childInstance: Instance) => {\n parentInstance.add(childInstance);\n },\n\n finalizeInitialChildren: () => false,\n\n prepareUpdate: () => true,\n\n shouldSetTextContent: () => false,\n\n getRootHostContext: () => null,\n\n getChildHostContext: () => null,\n\n getPublicInstance: (instance: Instance) => {\n return instance;\n },\n\n prepareForCommit: () => null,\n\n resetAfterCommit: () => undefined,\n\n preparePortalMount: () => null,\n\n // eslint-disable-next-line no-undef\n scheduleTimeout: setTimeout,\n // eslint-disable-next-line no-undef\n cancelTimeout: clearTimeout,\n\n noTimeout: -1,\n isPrimaryRenderer: false,\n\n getCurrentEventPriority: () => DefaultEventPriority,\n\n getInstanceFromNode: node => null,\n\n beforeActiveInstanceBlur: () => undefined,\n\n afterActiveInstanceBlur: () => undefined,\n\n prepareScopeUpdate: () => undefined,\n\n getInstanceFromScope: () => undefined,\n\n detachDeletedInstance: () => undefined,\n\n supportsHydration: false,\n\n appendChild: (parentInstance: Instance, child: Instance) => {\n parentInstance.add(child);\n },\n appendChildToContainer: (container: Instance, child: Instance) => {\n container.add(child);\n },\n\n insertBefore: (parentInstance: Instance, child: Instance, beforeChild: Instance) => {\n parentInstance.insertBefore(child, beforeChild);\n },\n\n insertInContainerBefore: (parentInstance: Instance, child: Instance, beforeChild: Instance) => {\n parentInstance.insertBefore(child, beforeChild);\n },\n\n removeChild: (parentInstance: Instance, child: Instance) => {\n child.delete();\n },\n\n removeChildFromContainer: (parentInstance: Instance, child: Instance) => {\n child.delete();\n },\n\n commitUpdate: (instance, updatePayload, type, oldProps, newProps) => {\n updateGraphicProps(instance, newProps, oldProps);\n },\n\n hideInstance: (instance: Instance) => {\n instance.setAttribute('visible', false);\n },\n\n unhideInstance: (instance, props) => {\n instance.setAttribute('visible', true);\n },\n\n clearContainer: (container: Instance) => {\n container.removeAllChild();\n },\n\n commitTextUpdate: (textInstance: any, oldText: string, newText: string) => {\n // debugger;\n }\n});\n\nreconcilor.injectIntoDevTools({\n // findFiberByHostInstance: () => {},\n // @ts-ignore\n // eslint-disable-next-line no-undef\n bundleType: process.env.NODE_ENV !== 'production' ? 1 : 0,\n version: React.version,\n rendererPackageName: 'react-vtable'\n});\n\nfunction createGraphic(type: string, props: any) {\n // may have unwanted onxxx prop\n if (type === 'tag') {\n const tag = new Tag(props.attribute);\n return tag;\n } else if (!application.graphicService.creator[type]) {\n return;\n }\n const graphic = application.graphicService.creator[type]((props as any).attribute);\n return graphic;\n}\n\nfunction isEventProp(key: string, props: any) {\n return key.startsWith('on') && isFunction(props[key]);\n}\n\nfunction bindEventsToGraphic(graphic: Graphic, props: any) {\n for (const key in props) {\n if (isEventProp(key, props)) {\n graphic.addEventListener(REACT_TO_CANOPUS_EVENTS[key], props[key]);\n }\n }\n}\n\nfunction updateGraphicProps(graphic: Graphic, newProps: any, oldProps: any) {\n // deal width event update\n for (const propKey in oldProps) {\n if (isEventProp(propKey, oldProps) && oldProps[propKey] !== newProps[propKey]) {\n graphic.removeEventListener(REACT_TO_CANOPUS_EVENTS[propKey], oldProps[propKey]);\n }\n }\n for (const propKey in newProps) {\n if (isEventProp(propKey, newProps) && oldProps[propKey] !== newProps[propKey]) {\n graphic.addEventListener(REACT_TO_CANOPUS_EVENTS[propKey], newProps[propKey]);\n }\n }\n\n // update all attribute\n graphic.initAttributes(newProps.attribute);\n if (graphic.type === 'image') {\n graphic.loadImage(newProps.attribute.image);\n }\n}\n"]}
@@ -1,2 +0,0 @@
1
- import { VRender } from '@visactor/vtable';
2
- export declare const reactEnvModule: VRender.ContainerModule;
@@ -1 +0,0 @@
1
- {"version":3,"sources":["components/custom/vtable-browser-env-contribution.ts"],"names":[],"mappings":";;;AAAA,6CAA0D;AAC1D,6CAA4C;AAE5C,MAAM,EAAE,eAAe,EAAE,eAAe,EAAE,sBAAsB,EAAE,GAAG,gBAAO,CAAC;AAGhE,QAAA,cAAc,GAAG,IAAI,eAAe,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;IAClF,IAAI,CAAC,4BAA4B,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC/D,IAAI,OAAO,CAAC,eAAe,C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;QAED,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;QAExC,IAAI,KAAK,EAAE;YACT,IAAI,IAAA,iBAAQ,EAAC,KAAK,CAAC,EAAE;gBACnB,GAAG,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;aAClC;iBAAM;gBACL,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;oBAC7B,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;gBAC1B,CAAC,CAAC,CAAC;aACJ;SACF;QACD,IAAI,KAAK,IAAI,IAAI,EAAE;YACjB,GAAG,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,KAAK,IAAI,CAAC;SAChC;QACD,IAAI,MAAM,IAAI,IAAI,EAAE;YAClB,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC;SAClC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF","file":"vtable-browser-env-contribution.js","sourcesContent":["import { getTargetCell, VRender } from '@visactor/vtable';\nimport { isString } from '@visactor/vutils';\n\nconst { ContainerModule, EnvContribution, BrowserEnvContribution } = VRender;\ntype CreateDOMParamsType = VRender.CreateDOMParamsType;\n\nexport const reactEnvModule = new ContainerModule((bind, unbind, isBound, rebind) => {\n bind(VTableBrowserEnvContribution).toSelf().inSingletonScope();\n if (isBound(EnvContribution)) {\n rebind(EnvContribution).toService(VTableBrowserEnvContribution);\n } else {\n bind(EnvContribution).toService(VTableBrowserEnvContribution);\n }\n});\n\nclass VTableBrowserEnvContribution extends BrowserEnvContribution {\n updateDom(dom: HTMLElement, params: CreateDOMParamsType): boolean {\n const tableDiv = dom.parentElement;\n if (tableDiv) {\n const top = parseInt(params.style.top, 10);\n const left = parseInt(params.style.left, 10);\n\n let domWidth;\n let domHeight;\n if ((dom.style.display = 'none')) {\n const cellGroup = getTargetCell(params.graphic);\n domWidth = cellGroup.attribute.width ?? 1;\n domHeight = cellGroup.attribute.height ?? 1;\n } else {\n domWidth = dom.offsetWidth;\n domHeight = dom.offsetHeight;\n }\n if (top + domHeight < 0 || left + domWidth < 0 || top > tableDiv.offsetHeight || left > tableDiv.offsetWidth) {\n dom.style.display = 'none';\n return false;\n }\n }\n\n const { width, height, style } = params;\n\n if (style) {\n if (isString(style)) {\n dom.setAttribute('style', style);\n } else {\n Object.keys(style).forEach(k => {\n dom.style[k] = style[k];\n });\n }\n }\n if (width != null) {\n dom.style.width = `${width}px`;\n }\n if (height != null) {\n dom.style.height = `${height}px`;\n }\n\n return true;\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["components/custom/vtable-react-attribute-plugin.ts"],"names":[],"mappings":";;;AAAA,6CAA2C;AAC3C,6CAAuH;AAEvH,MAAM,EAAE,oBAAoB,EAAE,WAAW,EAAE,GAAG,gBAAO,CAAC;AAQtD,MAAa,0BAA2B,SAAQ,oBAAoB;IAClE,aAAa,CAAC,EAAU;QACtB,KAAK,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QACxB,OAAO,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC1B,CAAC;IAED,iBAAiB,CAAC,OAAiB;;QACjC,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC;QACpC,IAAI,CAAC,KAAK,EAAE;YACV,OAAO;SACR;QACD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC5B,IAAI,CAAC,KAAK,EAAE;YACV,OAAO;SACR;QACD,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC;QACvC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;QACrC,IAAI,CAAC,CAAC,OAAO,IAAI,QAAQ,IAAI,QAAQ,CAAC,UAAU,CAAC,EAAE;YACjD,OAAO;SACR;QACD,M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-react-attribute-plugin.js","sourcesContent":["import { VRender } from '@visactor/vtable';\nimport { calculateAnchorOfBounds, isFunction, isNil, isObject, isString, styleStringToObject } from '@visactor/vutils';\n\nconst { ReactAttributePlugin, application } = VRender;\ntype CommonDomOptions = VRender.CommonDomOptions;\ntype CreateDOMParamsType = VRender.CreateDOMParamsType;\ntype IGraphic = VRender.CreateDOMParamsType;\ntype IStage = VRender.CreateDOMParamsType;\ntype IText = VRender.CreateDOMParamsType;\ntype SimpleDomStyleOptions = VRender.CreateDOMParamsType;\n\nexport class VTableReactAttributePlugin extends ReactAttributePlugin {\n removeElement(id: string) {\n super.removeElement(id);\n delete this.htmlMap[id];\n }\n\n renderGraphicHTML(graphic: IGraphic) {\n const { react } = graphic.attribute;\n if (!react) {\n return;\n }\n const stage = graphic.stage;\n if (!stage) {\n return;\n }\n const ReactDOM = stage.params.ReactDOM;\n const { element, container } = react;\n if (!(element && ReactDOM && ReactDOM.createRoot)) {\n return;\n }\n const id = isNil(react.id) ? `${graphic.id ?? graphic._uid}_react` : react.id;\n\n if (this.htmlMap && this.htmlMap[id] && container && container !== this.htmlMap[id].container) {\n this.removeElement(id);\n }\n\n if (!this.htmlMap || !this.htmlMap[id]) {\n // createa a wrapper contianer to be the root of react element\n const { wrapContainer, nativeContainer } = this.getWrapContainer(stage, container);\n\n if (wrapContainer) {\n const root = ReactDOM.createRoot(wrapContainer);\n root.render(element);\n\n if (!this.htmlMap) {\n this.htmlMap = {};\n }\n\n this.htmlMap[id] = { root, wrapContainer, nativeContainer, container, renderId: this.renderId };\n }\n } else {\n // update react element\n this.htmlMap[id].root.render(element);\n }\n\n if (!this.htmlMap || !this.htmlMap[id]) {\n return;\n }\n\n const { wrapContainer, nativeContainer } = this.htmlMap[id];\n\n this.updateStyleOfWrapContainer(graphic, stage, wrapContainer, nativeContainer, react);\n this.htmlMap[id].renderId = this.renderId;\n }\n\n getWrapContainer(stage: IStage, userContainer?: string | HTMLElement | null, domParams?: CreateDOMParamsType) {\n let nativeContainer;\n if (userContainer) {\n if (typeof userContainer === 'string') {\n nativeContainer = application.global.getElementById(userContainer);\n } else {\n nativeContainer = userContainer;\n }\n } else {\n nativeContainer = stage.window.getContainer();\n }\n // 创建wrapGroup\n return {\n wrapContainer: application.global.createDom({ tagName: 'div', parent: nativeContainer, ...domParams }),\n nativeContainer\n };\n }\n\n updateStyleOfWrapContainer(\n graphic: IGraphic,\n stage: IStage,\n wrapContainer: HTMLElement,\n nativeContainer: HTMLElement,\n options: SimpleDomStyleOptions & CommonDomOptions\n ) {\n const { pointerEvents } = options;\n let calculateStyle = this.parseDefaultStyleFromGraphic(graphic);\n\n calculateStyle.display = graphic.attribute.visible !== false ? 'block' : 'none';\n // 事件穿透\n calculateStyle.pointerEvents = pointerEvents === true ? 'all' : pointerEvents ? pointerEvents : 'none';\n // 定位wrapGroup\n if (!wrapContainer.style.position) {\n wrapContainer.style.position = 'absolute';\n nativeContainer.style.position = 'relative';\n }\n let left: number = 0;\n let top: number = 0;\n const b = graphic.globalAABBBounds;\n\n let anchorType = options.anchorType;\n\n if (isNil(anchorType)) {\n anchorType = graphic.type === 'text' ? 'position' : 'boundsLeftTop';\n }\n\n if (anchorType === 'boundsLeftTop') {\n // 兼容老的配置,统一配置\n anchorType = 'top-left';\n }\n if (anchorType === 'position' || b.empty()) {\n const matrix = graphic.globalTransMatrix;\n left = matrix.e;\n top = matrix.f;\n } else {\n const anchor = calculateAnchorOfBounds(b, anchorType);\n\n left = anchor.x;\n top = anchor.y;\n }\n\n // 查看wrapGroup的位置\n // const wrapGroupTL = application.global.getElementTopLeft(wrapGroup, false);\n const containerTL = application.global.getElementTopLeft(nativeContainer, false);\n const windowTL = stage.window.getTopLeft(false);\n const offsetX = left + windowTL.left - containerTL.left;\n const offsetTop = top + windowTL.top - containerTL.top;\n // wrapGroup.style.transform = `translate(${offsetX}px, ${offsetTop}px)`;\n calculateStyle.left = `${offsetX}px`;\n calculateStyle.top = `${offsetTop}px`;\n\n if (graphic.type === 'text' && anchorType === 'position') {\n calculateStyle = {\n ...calculateStyle,\n ...this.getTransformOfText(graphic as IText)\n };\n }\n\n if (isFunction(options.style)) {\n const userStyle = options.style(\n { top: offsetTop, left: offsetX, width: b.width(), height: b.height() },\n graphic,\n wrapContainer\n );\n\n if (userStyle) {\n calculateStyle = { ...calculateStyle, ...userStyle };\n }\n } else if (isObject(options.style)) {\n calculateStyle = { ...calculateStyle, ...options.style };\n } else if (isString(options.style) && options.style) {\n calculateStyle = { ...calculateStyle, ...styleStringToObject(options.style as string) };\n }\n\n // 更新样式\n application.global.updateDom(wrapContainer, {\n width: options.width,\n height: options.width,\n style: calculateStyle,\n graphic\n });\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["components/custom-component.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+CAOe;AACf,6DAAgD;AAChD,6CAAmD;AAyB5C,MAAM,eAAe,GAAmC,CAAC,SAA+B,EAAE,EAAE;IACjG,MAAM,OAAO,GAAG,IAAA,kBAAU,EAAC,eAAgB,CAAC,CAAC;IAC7C,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IAM1B,MAAM,KAAK,GAAG,aAAa,CAAuB,SAAS,EAAE;QAC3D,KAAK,EAAE;YACL,IAAI,EAAE,CAAC;YACP,GAAG,EAAE,CAAC;SACP;QACD,SAAS,EAAE,yBAAyB;QACpC,WAAW,EAAE,UAAU;QACvB,CAAC,EAAE,CAAC;QACJ,CAAC,EAAE,CAAC;QACJ,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;QACT,GAAG,EAAE,CAAC;QACN,GAAG,EAAE,CAAC;QACN,MAAM,EAAE,UAAU;QAClB,EAAE,EAAE,CAAC;QACL,EAAE,EAAE,CAAC;KACN,CAAC,CAAC;IACH,MAAM,EAAE,WAAW,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EA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["import type { ReactElement } from 'react';\nimport React, {\n type CSSProperties,\n type ReactNode,\n type HTMLAttributes,\n type DetailedHTMLProps,\n useContext,\n useMemo\n} from 'react';\nimport RootTableContext from '../context/table';\nimport { isNumber, merge } from '@visactor/vutils';\n\nexport interface CustomComponentProps\n extends Omit<DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>, 'className' | 'ref'> {\n style?: CSSProperties;\n // className?: string | string[];\n className?: string;\n\n // for table\n displayMode: 'position' | 'cell';\n x?: number;\n y?: number;\n width?: number | string;\n height?: number | string;\n // width?: number;\n // height?: number;\n row?: number;\n col?: number;\n anchor?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';\n dx?: number | string;\n dy?: number | string;\n // dx?: number;\n // dy?: number;\n}\n\nexport const CustomComponent: React.FC<CustomComponentProps> = (baseProps: CustomComponentProps) => {\n const context = useContext(RootTableContext);\n const { table } = context;\n\n // if (!table) {\n // return null;\n // }\n\n const props = useMergeProps<CustomComponentProps>(baseProps, {\n style: {\n left: 0,\n top: 0\n },\n className: 'vtable-custom-component',\n displayMode: 'position',\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n row: 0,\n col: 0,\n anchor: 'top-left',\n dx: 0,\n dy: 0\n });\n const { displayMode, x, y, width, height, row, col, anchor, dx, dy, className, children, style } = props;\n\n let styleLeft;\n let styleTop;\n let styleWidth;\n let styleHeight;\n\n if (displayMode === 'position') {\n styleLeft = x + (dx as number) + 'px';\n styleTop = y + (dy as number) + 'px';\n styleWidth = width + 'px';\n styleHeight = height + 'px';\n } else if (displayMode === 'cell') {\n const cellRect =\n table && col >= 0 && row >= 0\n ? table?.getCellRelativeRect(col, row)\n : { width: 0, height: 0, left: -9999, top: -9999 };\n styleWidth = dealWidthNumber(width, cellRect.width) + 'px';\n styleHeight = dealWidthNumber(height, cellRect.height) + 'px';\n if (anchor === 'top-left') {\n styleLeft = cellRect.left + dealWidthNumber(dx, cellRect.width) + 'px';\n styleTop = cellRect.top + dealWidthNumber(dy, cellRect.height) + 'px';\n } else if (anchor === 'top-right') {\n styleLeft = cellRect.left + dealWidthNumber(dx, cellRect.width) + cellRect.width + 'px';\n styleTop = cellRect.top + dealWidthNumber(dy, cellRect.height) + 'px';\n } else if (anchor === 'bottom-left') {\n styleLeft = cellRect.left + dealWidthNumber(dx, cellRect.width) + 'px';\n styleTop = cellRect.top + dealWidthNumber(dy, cellRect.height) + cellRect.height + 'px';\n } else if (anchor === 'bottom-right') {\n styleLeft = cellRect.left + dealWidthNumber(dx, cellRect.width) + cellRect.width + 'px';\n styleTop = cellRect.top + dealWidthNumber(dy, cellRect.height) + cellRect.height + 'px';\n }\n }\n\n const componentStyle = merge({}, style, {\n position: 'absolute',\n zIndex: 1000,\n width: styleWidth,\n height: styleHeight,\n left: styleLeft,\n top: styleTop\n });\n\n return (\n <div className={className} style={componentStyle}>\n {React.Children.map(children, (child: ReactNode) => {\n if (child) {\n return React.cloneElement(child as ReactElement, {});\n }\n return child;\n })}\n </div>\n );\n};\n\n// export const CustomComponent = forwardRef<unknown, CustomComponentProps>(CustomComponent1);\n\nexport default function useMergeProps<PropsType>(\n componentProps: PropsType,\n defaultProps: Partial<PropsType>\n): PropsType {\n const _defaultProps = useMemo(() => {\n return { ...defaultProps };\n }, [defaultProps]);\n\n const props = useMemo(() => {\n const mProps = merge({}, componentProps);\n\n // https://github.com/facebook/react/blob/cae635054e17a6f107a39d328649137b83f25972/packages/react/src/ReactElement.js#L312\n for (const propName in _defaultProps) {\n if (mProps[propName] === undefined) {\n mProps[propName] = _defaultProps[propName];\n }\n }\n\n return mProps;\n }, [componentProps, _defaultProps]);\n\n return props;\n}\n\nfunction dealWidthNumber(value: string | number, refenceValue: number) {\n if (isNumber(value)) {\n return value;\n }\n\n if (typeof value === 'string' && value.endsWith('%')) {\n return (Number(value.slice(0, -1)) / 100) * refenceValue;\n }\n\n return 0;\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["components/list/list-column.tsx"],"names":[],"mappings":";;;AAEA,sDAAoD;AAKvC,QAAA,UAAU,GAAG,IAAA,gCAAe,EAAkB,YAAY,EAAE,SAAS,CAAC,CAAC","file":"list-column.js","sourcesContent":["import type { ReactElement, ReactNode } from 'react';\nimport type { BaseComponentProps } from '../base-component';\nimport { createComponent } from '../base-component';\nimport type { ColumnDefine } from '@visactor/vtable';\n\nexport type ListColumnProps = Omit<ColumnDefine, 'columns'> & BaseComponentProps;\n\nexport const ListColumn = createComponent<ListColumnProps>('ListColumn', 'columns');\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["components/pivot/pivot-corner.tsx"],"names":[],"mappings":";;;AACA,sDAAoD;AAKvC,QAAA,WAAW,GAAG,IAAA,gCAAe,EAAmB,aAAa,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC","file":"pivot-corner.js","sourcesContent":["import type { BaseComponentProps } from '../base-component';\nimport { createComponent } from '../base-component';\nimport type { ICornerDefine } from '@visactor/vtable';\n\nexport type PivotCornerProps = ICornerDefine & BaseComponentProps;\n\nexport const PivotCorner = createComponent<PivotCornerProps>('PivotCorner', 'corner', undefined, true);\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["components/pivot/pivot-dimension.tsx"],"names":[],"mappings":";;;AACA,sDAAoD;AAMvC,QAAA,oBAAoB,GAAG,IAAA,gCAAe,EAA4B,sBAAsB,EAAE,SAAS,CAAC,CAAC;AACrG,QAAA,iBAAiB,GAAG,IAAA,gCAAe,EAAyB,mBAAmB,EAAE,MAAM,CAAC,CAAC","file":"pivot-dimension.js","sourcesContent":["import type { BaseComponentProps } from '../base-component';\nimport { createComponent } from '../base-component';\nimport type { IRowDimension, IColumnDimension } from '@visactor/vtable';\n\nexport type RowPivotDimensionProps = IRowDimension & BaseComponentProps;\nexport type ColumnPivotDimensionProps = IColumnDimension & BaseComponentProps;\n\nexport const PivotColumnDimension = createComponent<ColumnPivotDimensionProps>('PivotColumnDimension', 'columns');\nexport const PivotRowDimension = createComponent<RowPivotDimensionProps>('PivotRowDimension', 'rows');\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["components/pivot/pivot-header-title.tsx"],"names":[],"mappings":";;;AACA,sDAAoD;AAKvC,QAAA,sBAAsB,GAAG,IAAA,gCAAe,EACnD,wBAAwB,EACxB,mBAAmB,EACnB,SAAS,EACT,IAAI,CACL,CAAC;AACW,QAAA,mBAAmB,GAAG,IAAA,gCAAe,EAChD,qBAAqB,EACrB,gBAAgB,EAChB,SAAS,EACT,IAAI,CACL,CAAC","file":"pivot-header-title.js","sourcesContent":["import type { BaseComponentProps } from '../base-component';\nimport { createComponent } from '../base-component';\nimport type { ITitleDefine } from '@visactor/vtable';\n\nexport type PivotHeaderTitleProps = ITitleDefine & BaseComponentProps;\n\nexport const PivotColumnHeaderTitle = createComponent<PivotHeaderTitleProps>(\n 'PivotColumnHeaderTitle',\n 'columnHeaderTitle',\n undefined,\n true\n);\nexport const PivotRowHeaderTitle = createComponent<PivotHeaderTitleProps>(\n 'PivotRowHeaderTitle',\n 'rowHeaderTitle',\n undefined,\n true\n);\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["components/pivot/pivot-indicator.ts"],"names":[],"mappings":";;;AACA,sDAAoD;AAKvC,QAAA,cAAc,GAAG,IAAA,gCAAe,EAAsB,gBAAgB,EAAE,YAAY,CAAC,CAAC","file":"pivot-indicator.js","sourcesContent":["import type { BaseComponentProps } from '../base-component';\nimport { createComponent } from '../base-component';\nimport type { IIndicator } from '@visactor/vtable';\n\nexport type PivotIndicatorProps = IIndicator & BaseComponentProps;\n\nexport const PivotIndicator = createComponent<PivotIndicatorProps>('PivotIndicator', 'indicators');\n"]}