@visactor/react-vtable 1.22.9-alpha.2 → 1.22.9-alpha.3

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 (73) hide show
  1. package/cjs/components/avatar/avatar.js +1 -0
  2. package/cjs/components/avatar/avatar.js.map +1 -1
  3. package/cjs/containers/withContainer.d.ts +1 -1
  4. package/cjs/containers/withContainer.js.map +1 -1
  5. package/cjs/context/table.d.ts +1 -1
  6. package/cjs/context/table.js.map +1 -1
  7. package/cjs/index.d.ts +1 -1
  8. package/cjs/index.js +1 -1
  9. package/cjs/index.js.map +1 -1
  10. package/cjs/table-components/base-component.d.ts +5 -1
  11. package/cjs/table-components/base-component.js +3 -2
  12. package/cjs/table-components/base-component.js.map +1 -1
  13. package/cjs/table-components/component/emptyTip.d.ts +4 -1
  14. package/cjs/table-components/component/menu.d.ts +4 -1
  15. package/cjs/table-components/component/title.d.ts +4 -1
  16. package/cjs/table-components/component/tooltip.d.ts +4 -1
  17. package/cjs/table-components/list/list-column.d.ts +5 -1
  18. package/cjs/table-components/pivot/pivot-corner.d.ts +4 -1
  19. package/cjs/table-components/pivot/pivot-dimension.d.ts +12 -3
  20. package/cjs/table-components/pivot/pivot-dimension.js.map +1 -1
  21. package/cjs/table-components/pivot/pivot-header-title.d.ts +8 -2
  22. package/cjs/table-components/pivot/pivot-indicator.d.ts +4 -1
  23. package/cjs/tables/base-table.d.ts +1 -2
  24. package/cjs/tables/base-table.js +1 -1
  25. package/cjs/tables/base-table.js.map +1 -1
  26. package/cjs/tables/list-table-simple.d.ts +2 -4
  27. package/cjs/tables/list-table-simple.js.map +1 -1
  28. package/cjs/tables/list-table.d.ts +2 -4
  29. package/cjs/tables/list-table.js.map +1 -1
  30. package/cjs/tables/pivot-chart.d.ts +2 -4
  31. package/cjs/tables/pivot-chart.js.map +1 -1
  32. package/cjs/tables/pivot-table-simple.d.ts +2 -4
  33. package/cjs/tables/pivot-table-simple.js.map +1 -1
  34. package/cjs/tables/pivot-table.d.ts +2 -4
  35. package/cjs/tables/pivot-table.js.map +1 -1
  36. package/dist/react-vtable.js +1449 -1607
  37. package/dist/react-vtable.min.js +2 -2
  38. package/es/components/avatar/avatar.js +1 -0
  39. package/es/components/avatar/avatar.js.map +1 -1
  40. package/es/containers/withContainer.d.ts +1 -1
  41. package/es/containers/withContainer.js.map +1 -1
  42. package/es/context/table.d.ts +1 -1
  43. package/es/context/table.js.map +1 -1
  44. package/es/index.d.ts +1 -1
  45. package/es/index.js +1 -1
  46. package/es/index.js.map +1 -1
  47. package/es/table-components/base-component.d.ts +5 -1
  48. package/es/table-components/base-component.js +3 -2
  49. package/es/table-components/base-component.js.map +1 -1
  50. package/es/table-components/component/emptyTip.d.ts +4 -1
  51. package/es/table-components/component/menu.d.ts +4 -1
  52. package/es/table-components/component/title.d.ts +4 -1
  53. package/es/table-components/component/tooltip.d.ts +4 -1
  54. package/es/table-components/list/list-column.d.ts +5 -1
  55. package/es/table-components/pivot/pivot-corner.d.ts +4 -1
  56. package/es/table-components/pivot/pivot-dimension.d.ts +12 -3
  57. package/es/table-components/pivot/pivot-dimension.js.map +1 -1
  58. package/es/table-components/pivot/pivot-header-title.d.ts +8 -2
  59. package/es/table-components/pivot/pivot-indicator.d.ts +4 -1
  60. package/es/tables/base-table.d.ts +1 -2
  61. package/es/tables/base-table.js +1 -1
  62. package/es/tables/base-table.js.map +1 -1
  63. package/es/tables/list-table-simple.d.ts +2 -4
  64. package/es/tables/list-table-simple.js.map +1 -1
  65. package/es/tables/list-table.d.ts +2 -4
  66. package/es/tables/list-table.js.map +1 -1
  67. package/es/tables/pivot-chart.d.ts +2 -4
  68. package/es/tables/pivot-chart.js.map +1 -1
  69. package/es/tables/pivot-table-simple.d.ts +2 -4
  70. package/es/tables/pivot-table-simple.js.map +1 -1
  71. package/es/tables/pivot-table.d.ts +2 -4
  72. package/es/tables/pivot-table.js.map +1 -1
  73. package/package.json +4 -4
@@ -67,6 +67,7 @@ function getGroupAttribute(props) {
67
67
  height: size,
68
68
  clip: !0,
69
69
  cornerRadius: "circle" === shape ? size / 2 : null !== (_a = panelStyle.cornerRadius) && void 0 !== _a ? _a : 2,
70
+ cornerType: "round",
70
71
  display: "flex",
71
72
  alignItems: "center",
72
73
  justifyContent: "center",
@@ -1 +1 @@
1
- {"version":3,"sources":["components/avatar/avatar.tsx"],"names":[],"mappings":";;;;;;AACA,yDASqC;AAErC,6CAAmD;AAEnD,kDAAyC;AACzC,6DAA4D;AAc5D,MAAM,YAAY,GAAgB;IAChC,SAAS,EAAE;QACT,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,YAAY;QACxB,IAAI,EAAE,MAAM;KACb;IACD,UAAU,EAAE;QACV,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,oBAAoB;QAC1B,SAAS,EAAE,CAAC;QACZ,YAAY,EAAE,CAAC;KAChB;IACD,IAAI,EAAE,EAAE;IACR,KAAK,EAAE,QAAQ;IACf,eAAe,EAAE,IAAI;CAEtB,CAAC;AAEF,SAAS,eAAe,CAAC,SAAsB,EAAE,GAAsB;IACrE,MAAM,KAAK,GAAgB,IAAA,cAAK,EAAC,EAAE,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;IAC9D,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAC1C,IAAI,SAAS,GAAG,eAAK,CAAC,MAAM,CAAS,IAAI,CAAC,CAAC;IAC3C,SAAS,GAAG,GAAG,CAAC,CAAC,CAAE,GAA+B,CAAC,CAAC,CAAC,SAAS,CAAC;IAE/D,MAAM,WAAW,GAAyC,eAAK,CAAC,WAAW,CACzE,CAAC,KAAU,EAAQ,EAAE;QACnB,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC,EACD,CAAC,OAAO,CAAC,CACV,CAAC;IAEF,MAAM,cAAc,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAChD,IAAI,IAAA,i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CAAC,EAC1E,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,QAAQ,EACpB,cAAc,EAAE,QAAQ,EACxB,UAAU,EAAE,IAAI,EAChB,IAAI,EAAE,SAAS,GAChB,CAAC;IACF,OAAO,SAAS,CAAC;AACnB,CAAC;AAEY,QAAA,MAAM,GAAG,eAAK,CAAC,UAAU,CAAsB,eAAe,CAAC,CAAC;AAE7E,cAAM,CAAC,WAAW,GAAG,QAAQ,CAAC;AAG9B,SAAS,kBAAkB,CAAC,IAAY,EAAE,SAAgC;IACxE,MAAM,SAAS,GAAG,IAAA,yBAAe,EAAC,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,KAAK,CAAC;IACnE,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;IACrC,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;IACrE,SAAS,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAChC,CAAC","file":"avatar.js","sourcesContent":["import type { IGroup, IGroupAttribute } from '@visactor/vtable/es/vrender';\nimport {\n measureTextSize,\n type BackgroundAttributes,\n type Cursor,\n type IRectGraphicAttribute,\n type ITextGraphicAttribute,\n type Padding,\n type Tag,\n type TagAttributes\n} from '@visactor/vtable/es/vrender';\nimport { Tag as VTag } from '../vrender-components/tag';\nimport { isString, merge } from '@visactor/vutils';\nimport type { ReactElement } from 'react';\nimport React, { useEffect } from 'react';\nimport { Group, Image, Text } from '../../table-components';\n\nexport interface AvatarProps {\n children?: string | React.ReactNode;\n textStyle?: Partial<ITextGraphicAttribute>;\n panelStyle?: BackgroundAttributes;\n size?: number;\n shape?: 'circle' | 'square';\n visible?: boolean;\n cursor?: Cursor;\n autoFixFontSize?: boolean;\n onClick?: (e: Event) => void;\n}\n\nconst defaultProps: AvatarProps = {\n textStyle: {\n fontSize: 14,\n fontFamily: 'sans-serif',\n fill: '#FFF'\n },\n panelStyle: {\n visible: true,\n fill: 'rgb(201, 205, 212)',\n lineWidth: 1,\n cornerRadius: 2\n },\n size: 40,\n shape: 'circle',\n autoFixFontSize: true\n // cursor: 'pointer',\n};\n\nfunction AvatarComponent(baseProps: AvatarProps, ref: React.Ref<IGroup>) {\n const props: AvatarProps = merge({}, defaultProps, baseProps);\n const { size, children, onClick } = props;\n let avatarRef = React.useRef<IGroup>(null);\n avatarRef = ref ? (ref as React.RefObject<IGroup>) : avatarRef;\n\n const handleClick: React.MouseEventHandler<HTMLElement> = React.useCallback(\n (event: any): void => {\n onClick && onClick(event);\n },\n [onClick]\n );\n\n const groupAttribute = getGroupAttribute(props);\n if (isString(children)) {\n const textAttribute = getTextAttribute(props);\n return (\n <Group ref={avatarRef} attribute={groupAttribute} onClick={handleClick}>\n <Text attribute={textAttribute}></Text>\n </Group>\n );\n }\n if ((children as ReactElement).type === 'image') {\n (children as ReactElement).props.attribute.width = size;\n (children as ReactElement).props.attribute.height = size;\n }\n return (\n <Group ref={avatarRef} attribute={groupAttribute} onClick={handleClick}>\n {children}\n </Group>\n );\n}\n\nfunction getTextAttribute(props: AvatarProps) {\n const { textStyle, size, children, autoFixFontSize } = props;\n\n const attribute: ITextGraphicAttribute = {\n text: children as string,\n ...textStyle\n };\n\n if (autoFixFontSize) {\n getAutoFixFontSize(size, attribute);\n }\n\n return attribute;\n}\nfunction getGroupAttribute(props: AvatarProps) {\n const { panelStyle, size, shape } = props;\n const attribute: IGroupAttribute = {\n ...panelStyle,\n width: size,\n height: size,\n clip: true,\n cornerRadius: shape === 'circle' ? size / 2 : panelStyle.cornerRadius ?? 2,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n visibleAll: true,\n path: undefined\n };\n return attribute;\n}\n\nexport const Avatar = React.forwardRef<IGroup, AvatarProps>(AvatarComponent);\n\nAvatar.displayName = 'Avatar';\n\n// auto adjust font size\nfunction getAutoFixFontSize(size: number, attribute: ITextGraphicAttribute) {\n const textWidth = measureTextSize(attribute.text, attribute).width;\n const scale = size / (textWidth + 8);\n const fontSize = Math.max(Math.floor(attribute.fontSize * scale), 6);\n attribute.fontSize = fontSize;\n}\n"]}
1
+ {"version":3,"sources":["components/avatar/avatar.tsx"],"names":[],"mappings":";;;;;;AACA,yDASqC;AAErC,6CAAmD;AAEnD,kDAAyC;AACzC,6DAA4D;AAc5D,MAAM,YAAY,GAAgB;IAChC,SAAS,EAAE;QACT,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,YAAY;QACxB,IAAI,EAAE,MAAM;KACb;IACD,UAAU,EAAE;QACV,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,oBAAoB;QAC1B,SAAS,EAAE,CAAC;QACZ,YAAY,EAAE,CAAC;KAChB;IACD,IAAI,EAAE,EAAE;IACR,KAAK,EAAE,QAAQ;IACf,eAAe,EAAE,IAAI;CAEtB,CAAC;AAEF,SAAS,eAAe,CAAC,SAAsB,EAAE,GAAsB;IACrE,MAAM,KAAK,GAAgB,IAAA,cAAK,EAAC,EAAE,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;IAC9D,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAC1C,IAAI,SAAS,GAAG,eAAK,CAAC,MAAM,CAAS,IAAI,CAAC,CAAC;IAC3C,SAAS,GAAG,GAAG,CAAC,CAAC,CAAE,GAA+B,CAAC,CAAC,CAAC,SAAS,CAAC;IAE/D,MAAM,WAAW,GAAyC,eAAK,CAAC,WAAW,CACzE,CAAC,KAAU,EAAQ,EAAE;QACnB,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC,EACD,CAAC,OAAO,CAAC,CACV,CAAC;IAEF,MAAM,cAAc,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAChD,IAAI,IAAA,iBAAQ,EAAC,QAAQ,CAAC,EAAE;QACtB,MAAM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EAAE,MAAM,EACf,UAAU,EAAE,QAAQ,EACpB,cAAc,EAAE,QAAQ,EACxB,UAAU,EAAE,IAAI,EAChB,IAAI,EAAE,SAAS,GAChB,CAAC;IACF,OAAO,SAAS,CAAC;AACnB,CAAC;AAEY,QAAA,MAAM,GAAG,eAAK,CAAC,UAAU,CAAsB,eAAe,CAAC,CAAC;AAE7E,cAAM,CAAC,WAAW,GAAG,QAAQ,CAAC;AAG9B,SAAS,kBAAkB,CAAC,IAAY,EAAE,SAAgC;IACxE,MAAM,SAAS,GAAG,IAAA,yBAAe,EAAC,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,KAAK,CAAC;IACnE,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;IACrC,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;IACrE,SAAS,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAChC,CAAC","file":"avatar.js","sourcesContent":["import type { IGroup, IGroupAttribute } from '@visactor/vtable/es/vrender';\nimport {\n measureTextSize,\n type BackgroundAttributes,\n type Cursor,\n type IRectGraphicAttribute,\n type ITextGraphicAttribute,\n type Padding,\n type Tag,\n type TagAttributes\n} from '@visactor/vtable/es/vrender';\nimport { Tag as VTag } from '../vrender-components/tag';\nimport { isString, merge } from '@visactor/vutils';\nimport type { ReactElement } from 'react';\nimport React, { useEffect } from 'react';\nimport { Group, Image, Text } from '../../table-components';\n\nexport interface AvatarProps {\n children?: string | React.ReactNode;\n textStyle?: Partial<ITextGraphicAttribute>;\n panelStyle?: BackgroundAttributes;\n size?: number;\n shape?: 'circle' | 'square';\n visible?: boolean;\n cursor?: Cursor;\n autoFixFontSize?: boolean;\n onClick?: (e: Event) => void;\n}\n\nconst defaultProps: AvatarProps = {\n textStyle: {\n fontSize: 14,\n fontFamily: 'sans-serif',\n fill: '#FFF'\n },\n panelStyle: {\n visible: true,\n fill: 'rgb(201, 205, 212)',\n lineWidth: 1,\n cornerRadius: 2\n },\n size: 40,\n shape: 'circle',\n autoFixFontSize: true\n // cursor: 'pointer',\n};\n\nfunction AvatarComponent(baseProps: AvatarProps, ref: React.Ref<IGroup>) {\n const props: AvatarProps = merge({}, defaultProps, baseProps);\n const { size, children, onClick } = props;\n let avatarRef = React.useRef<IGroup>(null);\n avatarRef = ref ? (ref as React.RefObject<IGroup>) : avatarRef;\n\n const handleClick: React.MouseEventHandler<HTMLElement> = React.useCallback(\n (event: any): void => {\n onClick && onClick(event);\n },\n [onClick]\n );\n\n const groupAttribute = getGroupAttribute(props);\n if (isString(children)) {\n const textAttribute = getTextAttribute(props);\n return (\n <Group ref={avatarRef} attribute={groupAttribute} onClick={handleClick}>\n <Text attribute={textAttribute}></Text>\n </Group>\n );\n }\n if ((children as ReactElement).type === 'image') {\n (children as ReactElement).props.attribute.width = size;\n (children as ReactElement).props.attribute.height = size;\n }\n return (\n <Group ref={avatarRef} attribute={groupAttribute} onClick={handleClick}>\n {children}\n </Group>\n );\n}\n\nfunction getTextAttribute(props: AvatarProps) {\n const { textStyle, size, children, autoFixFontSize } = props;\n\n const attribute: ITextGraphicAttribute = {\n text: children as string,\n ...textStyle\n };\n\n if (autoFixFontSize) {\n getAutoFixFontSize(size, attribute);\n }\n\n return attribute;\n}\nfunction getGroupAttribute(props: AvatarProps) {\n const { panelStyle, size, shape } = props;\n const attribute: IGroupAttribute = {\n ...panelStyle,\n width: size,\n height: size,\n clip: true,\n cornerRadius: shape === 'circle' ? size / 2 : panelStyle.cornerRadius ?? 2,\n cornerType: 'round', // 添加必需的 cornerType 属性\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n visibleAll: true,\n path: undefined\n };\n return attribute;\n}\n\nexport const Avatar = React.forwardRef<IGroup, AvatarProps>(AvatarComponent);\n\nAvatar.displayName = 'Avatar';\n\n// auto adjust font size\nfunction getAutoFixFontSize(size: number, attribute: ITextGraphicAttribute) {\n const textWidth = measureTextSize(attribute.text, attribute).width;\n const scale = size / (textWidth + 8);\n const fontSize = Math.max(Math.floor(attribute.fontSize * scale), 6);\n attribute.fontSize = fontSize;\n}\n"]}
@@ -5,4 +5,4 @@ export interface ContainerProps {
5
5
  width?: number | string;
6
6
  height?: number | string;
7
7
  }
8
- export default function withContainer<Props extends ContainerProps, CompProps>(Comp: typeof React.Component<any, CompProps>, name?: string, getProps?: (props: any) => CompProps): React.ForwardRefExoticComponent<React.PropsWithoutRef<CompProps & Props> & React.RefAttributes<any>>;
8
+ export default function withContainer<Props extends ContainerProps, CompProps>(Comp: typeof React.Component<any, CompProps>, name?: string, getProps?: (props: any) => CompProps): React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<any>>;
@@ -1 +1 @@
1
- {"version":3,"sources":["containers/withContainer.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiE;AASjE,SAAwB,aAAa,CACnC,IAA4C,EAC5C,IAAI,GAAG,gBAAgB,EACvB,QAAoC;IAEpC,MAAM,GAAG,GAAG,eAAK,CAAC,UAAU,CAAyB,CAAC,KAAwB,EAAE,GAAG,EAAE,EAAE;QACrF,MAAM,SAAS,GAAG,IAAA,cAAM,GAAE,CAAC;QAC3B,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;QAC5C,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,KAAiB,KAAK,EAAjB,OAAO,UAAK,KAAK,EAA/C,+BAAuC,CAAQ,CAAC;QAEtD,IAAA,uBAAe,EAAC,GAAG,EAAE;YACnB,SAAS,CAAC,IAAI,CAAC,CAAC;QAClB,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,OAAO,CACL,uCACE,GAAG,EAAE,SAAS,EACd,SAAS,EAAE,SAAS,EACpB,KAAK,kBACH,QAAQ,EAAE,UAAU,EACpB,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,MAAM,EAC9B,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,MAAM,IACzB,KAAK,KAGT,MAAM,CAAC,CAAC,CAAC,CACR,8BAAC,IAAI,kBAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,CAAC,OAAO,IAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAE,OAAqB,CAAC,EAAI,CAC9G,CAAC,CAAC,CAAC,CACF,6DAAK,CACN,CACG,CACP,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,GAAG,CAAC,WAAW,GAAG,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC;IACpC,OAAO,GAAG,CAAC;AACb,CAAC;AAnCD,gCAmCC","file":"withContainer.js","sourcesContent":["import React, { useRef, useState, useLayoutEffect } from 'react';\n\nexport interface ContainerProps {\n style?: React.CSSProperties;\n className?: string;\n width?: number | string;\n height?: number | string;\n}\n\nexport default function withContainer<Props extends ContainerProps, CompProps>(\n Comp: typeof React.Component<any, CompProps>,\n name = 'TableContainer',\n getProps?: (props: any) => CompProps\n) {\n const Cls = React.forwardRef<any, CompProps & Props>((props: CompProps & Props, ref) => {\n const container = useRef();\n const [inited, setInited] = useState(false);\n const { className, style, width, ...options } = props;\n\n useLayoutEffect(() => {\n setInited(true);\n }, []);\n\n return (\n <div\n ref={container}\n className={className}\n style={{\n position: 'relative',\n height: props.height || '100%',\n width: props.width || '100%',\n ...style\n }}\n >\n {inited ? (\n <Comp ref={ref} container={container.current} {...(getProps ? getProps(options) : (options as CompProps))} />\n ) : (\n <></>\n )}\n </div>\n );\n });\n Cls.displayName = name || Comp.name;\n return Cls;\n}\n"]}
1
+ {"version":3,"sources":["containers/withContainer.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiE;AASjE,SAAwB,aAAa,CACnC,IAA4C,EAC5C,IAAI,GAAG,gBAAgB,EACvB,QAAoC;IAEpC,MAAM,GAAG,GAAG,eAAK,CAAC,UAAU,CAAW,CAAC,KAAU,EAAE,GAAG,EAAE,EAAE;QACzD,MAAM,SAAS,GAAG,IAAA,cAAM,GAAE,CAAC;QAC3B,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;QAC5C,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,KAAiB,KAAK,EAAjB,OAAO,UAAK,KAAK,EAA/C,+BAAuC,CAAQ,CAAC;QAEtD,IAAA,uBAAe,EAAC,GAAG,EAAE;YACnB,SAAS,CAAC,IAAI,CAAC,CAAC;QAClB,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,OAAO,CACL,uCACE,GAAG,EAAE,SAAS,EACd,SAAS,EAAE,SAAS,EACpB,KAAK,kBACH,QAAQ,EAAE,UAAU,EACpB,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,MAAM,EAC9B,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,MAAM,IACzB,KAAK,KAGT,MAAM,CAAC,CAAC,CAAC,CACR,8BAAC,IAAI,kBAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,CAAC,OAAO,IAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAE,OAAqB,CAAC,EAAI,CAC9G,CAAC,CAAC,CAAC,CACF,6DAAK,CACN,CACG,CACP,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,GAAG,CAAC,WAAW,GAAG,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC;IACpC,OAAO,GAAG,CAAC;AACb,CAAC;AAnCD,gCAmCC","file":"withContainer.js","sourcesContent":["import React, { useRef, useState, useLayoutEffect } from 'react';\n\nexport interface ContainerProps {\n style?: React.CSSProperties;\n className?: string;\n width?: number | string;\n height?: number | string;\n}\n\nexport default function withContainer<Props extends ContainerProps, CompProps>(\n Comp: typeof React.Component<any, CompProps>,\n name = 'TableContainer',\n getProps?: (props: any) => CompProps\n) {\n const Cls = React.forwardRef<any, any>((props: any, ref) => {\n const container = useRef();\n const [inited, setInited] = useState(false);\n const { className, style, width, ...options } = props;\n\n useLayoutEffect(() => {\n setInited(true);\n }, []);\n\n return (\n <div\n ref={container}\n className={className}\n style={{\n position: 'relative',\n height: props.height || '100%',\n width: props.width || '100%',\n ...style\n }}\n >\n {inited ? (\n <Comp ref={ref} container={container.current} {...(getProps ? getProps(options) : (options as CompProps))} />\n ) : (\n <></>\n )}\n </div>\n );\n });\n Cls.displayName = name || Comp.name;\n return Cls;\n}\n"]}
@@ -5,5 +5,5 @@ export interface TableContextType {
5
5
  isChildrenUpdated?: boolean;
6
6
  }
7
7
  declare const TableContext: React.Context<TableContextType>;
8
- export declare function withTableInstance<T>(Component: typeof React.Component): React.ForwardRefExoticComponent<React.PropsWithoutRef<T> & React.RefAttributes<any>>;
8
+ export declare function withTableInstance<T>(Component: typeof React.Component): React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<any>>;
9
9
  export default TableContext;
@@ -1 +1 @@
1
- {"version":3,"sources":["context/table.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAS1B,MAAM,YAAY,GAAG,eAAK,CAAC,aAAa,CAAmB,IAAI,CAAC,CAAC;AACjE,YAAY,CAAC,WAAW,GAAG,cAAc,CAAC;AAE1C,SAAgB,iBAAiB,CAAI,SAAiC;IACpE,MAAM,GAAG,GAAG,eAAK,CAAC,UAAU,CAAS,CAAC,KAAQ,EAAE,GAAG,EAAE,EAAE;QACrD,OAAO,CACL,8BAAC,YAAY,CAAC,QAAQ,QACnB,CAAC,GAAqB,EAAE,EAAE,CAAC,8BAAC,SAAS,kBAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,IAAM,KAAK,EAAI,CAC1D,CACzB,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,GAAG,CAAC,WAAW,GAAG,SAAS,CAAC,IAAI,CAAC;IACjC,OAAO,GAAG,CAAC;AACb,CAAC;AAVD,8CAUC;AAED,kBAAe,YAAY,CAAC","file":"table.js","sourcesContent":["import React from 'react';\nimport type { ListTable, PivotTable, PivotChart } from '@visactor/vtable';\n\nexport interface TableContextType {\n table?: ListTable | PivotTable | PivotChart;\n // optionFromChildren: any;\n isChildrenUpdated?: boolean;\n}\n\nconst TableContext = React.createContext<TableContextType>(null);\nTableContext.displayName = 'TableContext';\n\nexport function withTableInstance<T>(Component: typeof React.Component) {\n const Com = React.forwardRef<any, T>((props: T, ref) => {\n return (\n <TableContext.Consumer>\n {(ctx: TableContextType) => <Component ref={ref} table={ctx.table} {...props} />}\n </TableContext.Consumer>\n );\n });\n Com.displayName = Component.name;\n return Com;\n}\n\nexport default TableContext;\n"]}
1
+ {"version":3,"sources":["context/table.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAS1B,MAAM,YAAY,GAAG,eAAK,CAAC,aAAa,CAAmB,IAAI,CAAC,CAAC;AACjE,YAAY,CAAC,WAAW,GAAG,cAAc,CAAC;AAE1C,SAAgB,iBAAiB,CAAI,SAAiC;IACpE,MAAM,GAAG,GAAG,eAAK,CAAC,UAAU,CAAW,CAAC,KAAU,EAAE,GAAG,EAAE,EAAE;QACzD,OAAO,CACL,8BAAC,YAAY,CAAC,QAAQ,QACnB,CAAC,GAAqB,EAAE,EAAE,CAAC,8BAAC,SAAS,kBAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,IAAM,KAAK,EAAI,CAC1D,CACzB,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,GAAG,CAAC,WAAW,GAAG,SAAS,CAAC,IAAI,CAAC;IACjC,OAAO,GAAG,CAAC;AACb,CAAC;AAVD,8CAUC;AAED,kBAAe,YAAY,CAAC","file":"table.js","sourcesContent":["import React from 'react';\nimport type { ListTable, PivotTable, PivotChart } from '@visactor/vtable';\n\nexport interface TableContextType {\n table?: ListTable | PivotTable | PivotChart;\n // optionFromChildren: any;\n isChildrenUpdated?: boolean;\n}\n\nconst TableContext = React.createContext<TableContextType>(null);\nTableContext.displayName = 'TableContext';\n\nexport function withTableInstance<T>(Component: typeof React.Component) {\n const Com = React.forwardRef<any, any>((props: any, ref) => {\n return (\n <TableContext.Consumer>\n {(ctx: TableContextType) => <Component ref={ref} table={ctx.table} {...props} />}\n </TableContext.Consumer>\n );\n });\n Com.displayName = Component.name;\n return Com;\n}\n\nexport default TableContext;\n"]}
package/cjs/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export * from './tables';
2
2
  export * from './table-components';
3
3
  export * from './components';
4
- export declare const version = "1.22.9-alpha.2";
4
+ export declare const version = "1.22.9-alpha.3";
package/cjs/index.js CHANGED
@@ -18,5 +18,5 @@ var __createBinding = this && this.__createBinding || (Object.create ? function(
18
18
  Object.defineProperty(exports, "__esModule", {
19
19
  value: !0
20
20
  }), exports.version = void 0, __exportStar(require("./tables"), exports), __exportStar(require("./table-components"), exports),
21
- __exportStar(require("./components"), exports), exports.version = "1.22.9-alpha.2";
21
+ __exportStar(require("./components"), exports), exports.version = "1.22.9-alpha.3";
22
22
  //# sourceMappingURL=index.js.map
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,qDAAmC;AACnC,+CAA6B;AAEhB,QAAA,OAAO,GAAG,gBAAgB,CAAC","file":"index.js","sourcesContent":["export * from './tables';\nexport * from './table-components';\nexport * from './components';\n\nexport const version = \"1.22.9-alpha.2\";\n"]}
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,qDAAmC;AACnC,+CAA6B;AAEhB,QAAA,OAAO,GAAG,gBAAgB,CAAC","file":"index.js","sourcesContent":["export * from './tables';\nexport * from './table-components';\nexport * from './components';\n\nexport const version = \"1.22.9-alpha.3\";\n"]}
@@ -1,3 +1,4 @@
1
+ import type { ReactElement } from 'react';
1
2
  import React from 'react';
2
3
  export interface BaseComponentProps {
3
4
  id?: string | number;
@@ -8,5 +9,8 @@ type ComponentProps = BaseComponentProps & {
8
9
  componentId?: string;
9
10
  componentIndex?: number;
10
11
  };
11
- export declare const createComponent: <T extends ComponentProps>(componentName: string, optionName: string, supportedEvents?: Record<string, string> | null, isSingle?: boolean) => React.FC<T>;
12
+ export declare const createComponent: <T extends ComponentProps>(componentName: string, optionName: string, supportedEvents?: Record<string, string> | null, isSingle?: boolean) => {
13
+ (props: T): React.ReactElement | null;
14
+ displayName: string;
15
+ };
12
16
  export {};
@@ -40,9 +40,10 @@ const react_1 = __importStar(require("react")), vutils_1 = require("@visactor/vu
40
40
  updateId.current = props.updateId;
41
41
  !!supportedEvents && (0, eventsUtils_1.bindEventsToTable)(context.table, props, eventsBinded.current, supportedEvents) && (eventsBinded.current = props);
42
42
  }
43
- return (0, react_1.useEffect)((() => () => {
43
+ (0, react_1.useEffect)((() => () => {
44
44
  supportedEvents && (0, eventsUtils_1.bindEventsToTable)(context.table, null, eventsBinded.current, supportedEvents);
45
- }), []), parseCustomChildren(props.children, props.componentId);
45
+ }), []);
46
+ return parseCustomChildren(props.children, props.componentId);
46
47
  };
47
48
  return Comp.displayName = componentName, Comp.parseOption = props => {
48
49
  const newComponentOption = (0, vutils_1.pickWithout)(props, notOptionKeys);
@@ -1 +1 @@
1
- {"version":3,"sources":["table-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,GA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;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
+ {"version":3,"sources":["table-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,GAAG,CAAC,KAAQ,EAA6B,EAAE;QACnD,MAAM,OAAO,GAAG,IAAA,kBAAU,EAAC,eAAgB,CAAC,CAAC;QAG7C,MAAM,YAAY,GAAG,eAAK,CAAC,MAAM,CAAI,IAAI,CAAC,CAAC;QAC3C,MAAM,QAAQ,GAAG,eAAK,CAAC,MAAM,CAAS,KAAK,CAAC,QAAQ,CAAC,CAAC;QAGtD,IAAI,KAAK,CAAC,QAAQ,KAAK,QAAQ,CAAC,OAAO,EAAE;YAEvC,QAAQ,CAAC,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC;YAGlC,MAAM,mBAAmB,GAAG,eAAe;gBACzC,CAAC,CAAC,IAAA,+BAAiB,EAAC,OAAO,CA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O,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 = (props: T): React.ReactElement | null => {\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 as any, eventsBinded.current as any, 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 as any, 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 const result = parseCustomChildren(props.children, props.componentId);\n return result as React.ReactElement | null;\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"]}
@@ -17,4 +17,7 @@ export type EmptyTipProps = {
17
17
  image: string;
18
18
  };
19
19
  } & BaseComponentProps;
20
- export declare const EmptyTip: import("react").FC<EmptyTipProps>;
20
+ export declare const EmptyTip: {
21
+ (props: EmptyTipProps): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
22
+ displayName: string;
23
+ };
@@ -8,4 +8,7 @@ export type MenuProps = {
8
8
  dropDownMenuHighlight?: TYPES.DropDownMenuHighlightInfo[];
9
9
  contextMenuWorkOnlyCell?: boolean;
10
10
  } & BaseComponentProps;
11
- export declare const Menu: import("react").FC<MenuProps>;
11
+ export declare const Menu: {
12
+ (props: MenuProps): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
13
+ displayName: string;
14
+ };
@@ -1,4 +1,7 @@
1
1
  import type { TYPES } from '@visactor/vtable';
2
2
  import type { BaseComponentProps } from '../base-component';
3
3
  export type TitleProps = TYPES.ITitle & BaseComponentProps;
4
- export declare const Title: import("react").FC<TitleProps>;
4
+ export declare const Title: {
5
+ (props: TitleProps): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
6
+ displayName: string;
7
+ };
@@ -4,4 +4,7 @@ export type TooltipProps = {
4
4
  isShowOverflowTextTooltip?: boolean;
5
5
  confine?: boolean;
6
6
  } & BaseComponentProps;
7
- export declare const Tooltip: import("react").FC<TooltipProps>;
7
+ export declare const Tooltip: {
8
+ (props: TooltipProps): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
9
+ displayName: string;
10
+ };
@@ -1,4 +1,8 @@
1
+ import type { ReactElement } from 'react';
1
2
  import type { BaseComponentProps } from '../base-component';
2
3
  import type { ColumnDefine } from '@visactor/vtable';
3
4
  export type ListColumnProps = Omit<ColumnDefine, 'columns'> & BaseComponentProps;
4
- export declare const ListColumn: import("react").FC<ListColumnProps>;
5
+ export declare const ListColumn: {
6
+ (props: ListColumnProps): ReactElement<any, string | import("react").JSXElementConstructor<any>>;
7
+ displayName: string;
8
+ };
@@ -1,4 +1,7 @@
1
1
  import type { BaseComponentProps } from '../base-component';
2
2
  import type { ICornerDefine } from '@visactor/vtable';
3
3
  export type PivotCornerProps = ICornerDefine & BaseComponentProps;
4
- export declare const PivotCorner: import("react").FC<PivotCornerProps>;
4
+ export declare const PivotCorner: {
5
+ (props: PivotCornerProps): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
6
+ displayName: string;
7
+ };
@@ -1,6 +1,15 @@
1
1
  import type { BaseComponentProps } from '../base-component';
2
- import type { IRowDimension, IColumnDimension } from '@visactor/vtable';
2
+ import type { TYPES } from '@visactor/vtable';
3
+ type IRowDimension = TYPES.IRowDimension;
4
+ type IColumnDimension = TYPES.IColumnDimension;
3
5
  export type RowPivotDimensionProps = IRowDimension & BaseComponentProps;
4
6
  export type ColumnPivotDimensionProps = IColumnDimension & BaseComponentProps;
5
- export declare const PivotColumnDimension: import("react").FC<any>;
6
- export declare const PivotRowDimension: import("react").FC<any>;
7
+ export declare const PivotColumnDimension: {
8
+ (props: ColumnPivotDimensionProps): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
9
+ displayName: string;
10
+ };
11
+ export declare const PivotRowDimension: {
12
+ (props: RowPivotDimensionProps): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
13
+ displayName: string;
14
+ };
15
+ export {};
@@ -1 +1 @@
1
- {"version":3,"sources":["table-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
+ {"version":3,"sources":["table-components/pivot/pivot-dimension.tsx"],"names":[],"mappings":";;;AACA,sDAAoD;AAQvC,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 { TYPES } from '@visactor/vtable';\ntype IRowDimension = TYPES.IRowDimension;\ntype IColumnDimension = TYPES.IColumnDimension;\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,5 +1,11 @@
1
1
  import type { BaseComponentProps } from '../base-component';
2
2
  import type { ITitleDefine } from '@visactor/vtable';
3
3
  export type PivotHeaderTitleProps = ITitleDefine & BaseComponentProps;
4
- export declare const PivotColumnHeaderTitle: import("react").FC<PivotHeaderTitleProps>;
5
- export declare const PivotRowHeaderTitle: import("react").FC<PivotHeaderTitleProps>;
4
+ export declare const PivotColumnHeaderTitle: {
5
+ (props: PivotHeaderTitleProps): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
6
+ displayName: string;
7
+ };
8
+ export declare const PivotRowHeaderTitle: {
9
+ (props: PivotHeaderTitleProps): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
10
+ displayName: string;
11
+ };
@@ -1,4 +1,7 @@
1
1
  import type { BaseComponentProps } from '../base-component';
2
2
  import type { IIndicator } from '@visactor/vtable';
3
3
  export type PivotIndicatorProps = IIndicator & BaseComponentProps;
4
- export declare const PivotIndicator: import("react").FC<PivotIndicatorProps>;
4
+ export declare const PivotIndicator: {
5
+ (props: PivotIndicatorProps): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
6
+ displayName: string;
7
+ };
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import type { ContainerProps } from '../containers/withContainer';
3
2
  import type { EventsProps } from '../eventsUtils';
4
3
  import { VTableReactAttributePlugin } from '../table-components/custom/vtable-react-attribute-plugin';
5
4
  import type { ListTable, PivotTable, PivotChart, ListTableConstructorOptions, PivotTableConstructorOptions, PivotChartConstructorOptions } from '@visactor/vtable';
@@ -21,5 +20,5 @@ export type BaseTableProps = EventsProps & IOption & {
21
20
  onError?: (err: Error) => void;
22
21
  };
23
22
  type Props = React.PropsWithChildren<BaseTableProps>;
24
- export declare const createTable: <T extends Props>(componentName: string, defaultProps?: Partial<T>, callback?: (props: T) => T) => React.ForwardRefExoticComponent<React.PropsWithoutRef<T & ContainerProps> & React.RefAttributes<any>>;
23
+ export declare const createTable: <T extends Props>(componentName: string, defaultProps?: Partial<T>, callback?: (props: T) => T) => React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<any>>;
25
24
  export {};
@@ -169,7 +169,7 @@ const notOptionKeys = [ ...constants_1.REACT_PRIVATE_PROPS, ...eventsUtils_1.TAB
169
169
  }), []), react_1.default.createElement(table_1.default.Provider, {
170
170
  value: tableContext.current
171
171
  }, (0, util_1.toArray)(props.children).map(((child, index) => {
172
- if ("string" == typeof child) return;
172
+ if ("string" == typeof child) return null;
173
173
  const childId = getComponentId(child, index);
174
174
  return react_1.default.createElement(react_1.default.Fragment, {
175
175
  key: childId
@@ -1 +1 @@
1
- {"version":3,"sources":["tables/base-table.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,+CAA6F;AAE7F,gFAAwD;AAExD,6DAAgD;AAChD,6CAAyE;AACzE,kCAAkC;AAClC,4CAAmD;AAanD,gDAAoF;AACpF,4GAAsG;AACtG,gHAA4F;AAC5F,yDAAsE;AA0CtE,IAAI,IAAA,sBAAY,GAAE,EAAE;IAClB,mBAAS,CAAC,IAAI,CAAC,gDAAc,CAAC,CAAC;CAChC;AAID,MAAM,aAAa,GAAG;IACpB,GAAG,+BAAmB;IACtB,GAAG,+BAAiB;IACpB,kBAAkB;IAClB,SAAS;I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BtB;AAEF,SAAS,gBAAgB,CACvB,YAAiC,EACjC,iBAA0E,EAC1E,KAAc;IAEd,IAAI,KAAK,CAAC,YAAY,EAAE,EAAE;QACxB,OAAO,iBAAiB,CAAC;KAC1B;IACD,MAAM,iBAAiB,GAAqC,EAAE,CAAC;IAC/D,YAAY,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QAClC,iBAAiB,CAAC,IAAI,CAAC;YACrB,GAAG;YACH,KAAK;SACN,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH,OAAO,iBAAiB,CAAC;AAC3B,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, isNumber, 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';\nimport type { TYPES } from '@visactor/vtable';\n\nexport type IVTable = ListTable | PivotTable | PivotChart;\nexport type IOption = ListTableConstructorOptions | PivotTableConstructorOptions | PivotChartConstructorOptions;\n\nexport type BaseTableProps = EventsProps &\n IOption & {\n vtableConstrouctor?: any;\n type?: string;\n /** 上层container */\n container?: HTMLDivElement;\n /** option */\n option?: IOption;\n /** 数据 */\n records?: Record<string, unknown>[];\n /** 画布宽度 */\n width?: number | string;\n /** 画布高度 */\n height?: number | string;\n skipFunctionDiff?: boolean;\n keepColumnWidthChange?: boolean;\n\n ReactDOM?: any;\n\n reactAttributePlugin?: VTableReactAttributePlugin;\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 ((child as React.ReactElement).key) {\n optionResult.option.key = (child as React.ReactElement).key;\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 const keepColumnWidthChange = !!props.keepColumnWidthChange;\n const columnWidths = useRef<Map<string, number>>(new Map());\n const pivotColumnWidths = useRef<{ dimensions: TYPES.IDimensionInfo[]; width: number }[]>([]);\n const pivotHeaderColumnWidths = useRef<number[]>([]);\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\n return {\n records: props.records,\n ...prevOption.current,\n ...optionFromChildren.current,\n clearDOM: false,\n customConfig: {\n ...prevOption.current.customConfig,\n createReactContainer: true\n }\n // ...tableContext.current?.optionFromChildren\n };\n },\n [hasOption, hasRecords]\n );\n\n const createTable = useCallback(\n (props: Props) => {\n const vtable = new props.vtableConstrouctor(props.container, parseOption(props));\n vtable.scenegraph.stage.reactAttribute = props.ReactDOM;\n vtable.scenegraph.stage.pluginService.register(props.reactAttributePlugin ?? new VTableReactAttributePlugin());\n vtable.scenegraph.stage.params.ReactDOM = props.ReactDOM;\n tableContext.current = { ...tableContext.current, table: vtable };\n isUnmount.current = false;\n\n columnWidths.current.clear();\n pivotColumnWidths.current = [];\n pivotHeaderColumnWidths.current = [];\n\n vtable.on('resize_column_end', (args: { col: number; colWidths: number[] }) => {\n const table = tableContext.current.table;\n if (!keepColumnWidthChange) {\n return;\n }\n const { col, colWidths } = args;\n const width = colWidths[col];\n if (vtable.isPivotTable()) {\n const path = (table as PivotTable).getCellHeaderPaths(col, table.columnHeaderLevelCount);\n let dimensions;\n if (path.cellLocation === 'rowHeader') {\n dimensions = path.rowHeaderPaths as TYPES.IDimensionInfo[];\n } else {\n dimensions = path.colHeaderPaths as TYPES.IDimensionInfo[];\n }\n\n let found = false;\n pivotColumnWidths.current.forEach(item => {\n if (JSON.stringify(item.dimensions) === JSON.stringify(dimensions)) {\n item.width = width;\n found = true;\n }\n });\n if (!found) {\n pivotColumnWidths.current.push({ dimensions, width });\n }\n } else {\n const define = table.getBodyColumnDefine(col, 0);\n if ((define as any)?.key) {\n columnWidths.current.set((define as any).key, width);\n }\n }\n });\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 const option = parseOption(props);\n if (keepColumnWidthChange) {\n const columnWidthConfig = updateWidthCache(\n columnWidths.current,\n pivotColumnWidths.current,\n tableContext.current.table\n );\n (option as any).columnWidthConfig = columnWidthConfig;\n (option as any).columnWidthConfigForRowHeader = columnWidthConfig;\n }\n // eslint-disable-next-line promise/catch-or-return\n tableContext.current.table.updateOption(option as any);\n handleTableRender();\n eventsBinded.current = props;\n } else if (\n hasRecords &&\n !isEqual(eventsBinded.current.records, props.records, { skipFunction: skipFunctionDiff })\n ) {\n if (keepColumnWidthChange) {\n const columnWidthConfig = updateWidthCache(\n columnWidths.current,\n pivotColumnWidths.current,\n tableContext.current.table\n );\n (tableContext.current.table.internalProps as any).columnWidthConfig = columnWidthConfig;\n (tableContext.current.table.internalProps as any).columnWidthConfigForRowHeader = columnWidthConfig;\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 const option = parseOption(props);\n if (keepColumnWidthChange) {\n const columnWidthConfig = updateWidthCache(\n columnWidths.current,\n pivotColumnWidths.current,\n tableContext.current.table\n );\n (option as any).columnWidthConfig = columnWidthConfig;\n (option as any).columnWidthConfigForRowHeader = columnWidthConfig;\n }\n tableContext.current.table.updateOption(option as any);\n\n // columnWidths.current = [];\n handleTableRender();\n eventsBinded.current = props;\n } else if (hasRecords && !isEqual(props.records, prevRecords.current, { skipFunction: skipFunctionDiff })) {\n prevRecords.current = props.records;\n\n if (keepColumnWidthChange) {\n const columnWidthConfig = updateWidthCache(\n columnWidths.current,\n pivotColumnWidths.current,\n tableContext.current.table\n );\n (tableContext.current.table.internalProps as any).columnWidthConfig = columnWidthConfig;\n (tableContext.current.table.internalProps as any).columnWidthConfigForRowHeader = columnWidthConfig;\n }\n\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\nfunction updateWidthCache(\n columnWidths: Map<string, number>,\n pivotColumnWidths: { dimensions: TYPES.IDimensionInfo[]; width: number }[],\n table: IVTable\n) {\n if (table.isPivotTable()) {\n return pivotColumnWidths;\n }\n const columnWidthConfig: { key: string; width: number }[] = [];\n columnWidths.forEach((width, key) => {\n columnWidthConfig.push({\n key,\n width\n });\n });\n return columnWidthConfig;\n}\n"]}
1
+ {"version":3,"sources":["tables/base-table.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,+CAA6F;AAE7F,gFAAwD;AAExD,6DAAgD;AAChD,6CAAyE;AACzE,kCAAkC;AAClC,4CAAmD;AAanD,gDAAoF;AACpF,4GAAsG;AACtG,gHAA4F;AAC5F,yDAAsE;AA0CtE,IAAI,IAAA,sBAAY,GAAE,EAAE;IAClB,mBAAS,CAAC,IAAI,CAAC,gDAAc,CAAC,CAAC;CAChC;AAID,MAAM,aAAa,GAAG;IACpB,GAAG,+BAAmB;IACtB,GAAG,+BAAiB;IACpB,kBAAkB;IAClB,SAAS;IACT,SAAS;IACT,QAAQ;IACR,SAAS;IACT,WAAW;IACX,oBAAoB;CACrB,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,KAAsB,EAAE,KAAa,EAAE,EAAE;IAC/D,MAAM,aAAa,GAAG,KAAK,IAAK,KAAa,CAAC,IAAI,IAAI,CAAE,KAAa,CAAC,IAAI,CAAC,WAAW,IAAK,KAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpH,OAAO,GAAG,aAAa,IAAI,KAAK,EAAE,CAAC;AACrC,CAAC,CAAC;AAEF,MAAM,uBAAuB,GAAG,CAAC,KAAY,EAAE,EAAE;IAC/C,MAAM,kBAAkB,GAAwD,EAAS,CAAC;IAE1F,IAAA,cAAO,EAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QAC3C,MAAM,WAAW,GAAG,KAAK,IAAK,KAAa,CAAC,IAAI,IAAK,KAAa,CAAC,IAAI,CAAC,WAAW,CAAC;QAEpF,IAAI,WAAW,IAAK,KAAa,CAAC,KAAK,EAAE;YACvC,MAAM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AAW,EAAE,OAAO;YACpB,cAAc,EAAE,KAAK;SACtB,CAAC,CACa,CAClB,CAAC;IACJ,CAAC,CAAC,CACwB,CAC7B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEI,MAAM,WAAW,GAAG,CACzB,aAAqB,EACrB,YAAyB,EACzB,QAA0B,EAC1B,EAAE;IACF,MAAM,GAAG,GAAG,IAAA,uBAAa,EAAoB,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;AAvBW,QAAA,WAAW,eAuBtB;AAEF,SAAS,gBAAgB,CACvB,YAAiC,EACjC,iBAA0E,EAC1E,KAAc;IAEd,IAAI,KAAK,CAAC,YAAY,EAAE,EAAE;QACxB,OAAO,iBAAiB,CAAC;KAC1B;IACD,MAAM,iBAAiB,GAAqC,EAAE,CAAC;IAC/D,YAAY,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QAClC,iBAAiB,CAAC,IAAI,CAAC;YACrB,GAAG;YACH,KAAK;SACN,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH,OAAO,iBAAiB,CAAC;AAC3B,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, isNumber, 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';\nimport type { TYPES } from '@visactor/vtable';\n\nexport type IVTable = ListTable | PivotTable | PivotChart;\nexport type IOption = ListTableConstructorOptions | PivotTableConstructorOptions | PivotChartConstructorOptions;\n\nexport type BaseTableProps = EventsProps &\n IOption & {\n vtableConstrouctor?: any;\n type?: string;\n /** 上层container */\n container?: HTMLDivElement;\n /** option */\n option?: IOption;\n /** 数据 */\n records?: Record<string, unknown>[];\n /** 画布宽度 */\n width?: number | string;\n /** 画布高度 */\n height?: number | string;\n skipFunctionDiff?: boolean;\n keepColumnWidthChange?: boolean;\n\n ReactDOM?: any;\n\n reactAttributePlugin?: VTableReactAttributePlugin;\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 ((child as React.ReactElement).key) {\n optionResult.option.key = (child as React.ReactElement).key;\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 const keepColumnWidthChange = !!props.keepColumnWidthChange;\n const columnWidths = useRef<Map<string, number>>(new Map());\n const pivotColumnWidths = useRef<{ dimensions: TYPES.IDimensionInfo[]; width: number }[]>([]);\n const pivotHeaderColumnWidths = useRef<number[]>([]);\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\n return {\n records: props.records,\n ...prevOption.current,\n ...optionFromChildren.current,\n clearDOM: false,\n customConfig: {\n ...prevOption.current.customConfig,\n createReactContainer: true\n }\n // ...tableContext.current?.optionFromChildren\n };\n },\n [hasOption, hasRecords]\n );\n\n const createTable = useCallback(\n (props: Props) => {\n const vtable = new props.vtableConstrouctor(props.container, parseOption(props));\n vtable.scenegraph.stage.reactAttribute = props.ReactDOM;\n vtable.scenegraph.stage.pluginService.register(props.reactAttributePlugin ?? new VTableReactAttributePlugin());\n vtable.scenegraph.stage.params.ReactDOM = props.ReactDOM;\n tableContext.current = { ...tableContext.current, table: vtable };\n isUnmount.current = false;\n\n columnWidths.current.clear();\n pivotColumnWidths.current = [];\n pivotHeaderColumnWidths.current = [];\n\n vtable.on('resize_column_end', (args: { col: number; colWidths: number[] }) => {\n const table = tableContext.current.table;\n if (!keepColumnWidthChange) {\n return;\n }\n const { col, colWidths } = args;\n const width = colWidths[col];\n if (vtable.isPivotTable()) {\n const path = (table as PivotTable).getCellHeaderPaths(col, table.columnHeaderLevelCount);\n let dimensions: TYPES.IDimensionInfo[];\n if (path.cellLocation === 'rowHeader') {\n dimensions = path.rowHeaderPaths as TYPES.IDimensionInfo[];\n } else {\n dimensions = path.colHeaderPaths as TYPES.IDimensionInfo[];\n }\n\n let found = false;\n pivotColumnWidths.current.forEach(item => {\n if (JSON.stringify(item.dimensions) === JSON.stringify(dimensions)) {\n item.width = width;\n found = true;\n }\n });\n if (!found) {\n pivotColumnWidths.current.push({ dimensions, width });\n }\n } else {\n const define = table.getBodyColumnDefine(col, 0);\n if ((define as any)?.key) {\n columnWidths.current.set((define as any).key, width);\n }\n }\n });\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 const option = parseOption(props);\n if (keepColumnWidthChange) {\n const columnWidthConfig = updateWidthCache(\n columnWidths.current,\n pivotColumnWidths.current,\n tableContext.current.table\n );\n (option as any).columnWidthConfig = columnWidthConfig;\n (option as any).columnWidthConfigForRowHeader = columnWidthConfig;\n }\n // eslint-disable-next-line promise/catch-or-return\n tableContext.current.table.updateOption(option as any);\n handleTableRender();\n eventsBinded.current = props;\n } else if (\n hasRecords &&\n !isEqual(eventsBinded.current.records, props.records, { skipFunction: skipFunctionDiff })\n ) {\n if (keepColumnWidthChange) {\n const columnWidthConfig = updateWidthCache(\n columnWidths.current,\n pivotColumnWidths.current,\n tableContext.current.table\n );\n (tableContext.current.table.internalProps as any).columnWidthConfig = columnWidthConfig;\n (tableContext.current.table.internalProps as any).columnWidthConfigForRowHeader = columnWidthConfig;\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 const option = parseOption(props);\n if (keepColumnWidthChange) {\n const columnWidthConfig = updateWidthCache(\n columnWidths.current,\n pivotColumnWidths.current,\n tableContext.current.table\n );\n (option as any).columnWidthConfig = columnWidthConfig;\n (option as any).columnWidthConfigForRowHeader = columnWidthConfig;\n }\n tableContext.current.table.updateOption(option as any);\n\n // columnWidths.current = [];\n handleTableRender();\n eventsBinded.current = props;\n } else if (hasRecords && !isEqual(props.records, prevRecords.current, { skipFunction: skipFunctionDiff })) {\n prevRecords.current = props.records;\n\n if (keepColumnWidthChange) {\n const columnWidthConfig = updateWidthCache(\n columnWidths.current,\n pivotColumnWidths.current,\n tableContext.current.table\n );\n (tableContext.current.table.internalProps as any).columnWidthConfig = columnWidthConfig;\n (tableContext.current.table.internalProps as any).columnWidthConfigForRowHeader = columnWidthConfig;\n }\n\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 null;\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\nfunction updateWidthCache(\n columnWidths: Map<string, number>,\n pivotColumnWidths: { dimensions: TYPES.IDimensionInfo[]; width: number }[],\n table: IVTable\n) {\n if (table.isPivotTable()) {\n return pivotColumnWidths;\n }\n const columnWidthConfig: { key: string; width: number }[] = [];\n columnWidths.forEach((width, key) => {\n columnWidthConfig.push({\n key,\n width\n });\n });\n return columnWidthConfig;\n}\n"]}
@@ -1,8 +1,6 @@
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'>, Omit<ListTableConstructorOptions, 'container'> {
4
+ export interface ListTableProps extends Omit<BaseTableProps, 'records' | 'columnWidthConfig' | 'columns' | 'dragOrder' | 'resize'>, Omit<ListTableConstructorOptions, 'container'> {
5
5
  }
6
- export declare const ListTableSimple: React.ForwardRefExoticComponent<ListTableProps & {
7
- children?: React.ReactNode;
8
- } & import("../containers/withContainer").ContainerProps & React.RefAttributes<any>>;
6
+ export declare const ListTableSimple: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<any>>;
@@ -1 +1 @@
1
- {"version":3,"sources":["tables/list-table-simple.tsx"],"names":[],"mappings":";;;AAEA,6CAA4E;AAE5E,6CAA2C;AAM9B,QAAA,eAAe,GAAG,IAAA,wBAAW,EAA0C,WAAW,EAAE;IAC/F,IAAI,EAAE,YAAY;IAClB,kBAAkB,EAAE,wBAA4B;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
+ {"version":3,"sources":["tables/list-table-simple.tsx"],"names":[],"mappings":";;;AAEA,6CAA4E;AAE5E,6CAA2C;AAM9B,QAAA,eAAe,GAAG,IAAA,wBAAW,EAA0C,WAAW,EAAE;IAC/F,IAAI,EAAE,YAAY;IAClB,kBAAkB,EAAE,wBAA4B;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' | 'columnWidthConfig' | 'columns' | 'dragOrder' | 'resize'>,\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,8 +1,6 @@
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'>, Omit<ListTableConstructorOptions, 'container'> {
4
+ export interface ListTableProps extends Omit<BaseTableProps, 'records' | 'columnWidthConfig' | 'columns' | 'dragOrder' | 'resize'>, Omit<ListTableConstructorOptions, 'container'> {
5
5
  }
6
- export declare const ListTable: React.ForwardRefExoticComponent<ListTableProps & {
7
- children?: React.ReactNode;
8
- } & import("../containers/withContainer").ContainerProps & React.RefAttributes<any>>;
6
+ export declare const ListTable: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<any>>;
@@ -1 +1 @@
1
- {"version":3,"sources":["tables/list-table.tsx"],"names":[],"mappings":";;;AAEA,6CAAsE;AAEtE,6CAA2C;AAM9B,QAAA,SAAS,GAAG,IAAA,wBAAW,EAA0C,WAAW,EAAE;IACzF,IAAI,EAAE,YAAY;IAClB,kBAAkB,EAAE,kBAA4B;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
+ {"version":3,"sources":["tables/list-table.tsx"],"names":[],"mappings":";;;AAEA,6CAAsE;AAEtE,6CAA2C;AAM9B,QAAA,SAAS,GAAG,IAAA,wBAAW,EAA0C,WAAW,EAAE;IACzF,IAAI,EAAE,YAAY;IAClB,kBAAkB,EAAE,kBAA4B;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' | 'columnWidthConfig' | 'columns' | 'dragOrder' | 'resize'>,\n Omit<ListTableConstructorOptions, 'container'> {}\n\nexport const ListTable = createTable<React.PropsWithChildren<ListTableProps>>('ListTable', {\n type: 'list-table',\n vtableConstrouctor: ListTableConstrouctor as any\n});\n"]}
@@ -4,10 +4,8 @@ import type { BaseTableProps } from './base-table';
4
4
  interface AnyRecords {
5
5
  records: Record<string, unknown>[];
6
6
  }
7
- export interface PivotChartProps extends Omit<BaseTableProps, 'records'>, Omit<PivotChartConstructorOptions, 'container' | 'records'>, AnyRecords {
7
+ export interface PivotChartProps extends Omit<BaseTableProps, 'records' | 'columnWidthConfig' | 'columns' | 'dragOrder' | 'resize'>, Omit<PivotChartConstructorOptions, 'container' | 'records'>, AnyRecords {
8
8
  }
9
- export declare const PivotChart: React.ForwardRefExoticComponent<PivotChartProps & {
10
- children?: React.ReactNode;
11
- } & import("../containers/withContainer").ContainerProps & React.RefAttributes<any>>;
9
+ export declare const PivotChart: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<any>>;
12
10
  export declare function registerChartModule(name: string, chart: any): void;
13
11
  export {};
@@ -1 +1 @@
1
- {"version":3,"sources":["tables/pivot-chart.tsx"],"names":[],"mappings":";;;AACA,6CAA4C;AAE5C,6CAAwE;AAExE,6CAA2C;AAU9B,QAAA,UAAU,GAAG,IAAA,wBAAW,EAA2C,YAAY,EAAE;IAC5F,IAAI,EAAE,aAAa;IACnB,kBAAkB,EAAE,mBAA6B;CAClD,CAAC,CAAC;AAEH,SAAgB,mBAAmB,CAAC,IAAY,EAAE,KAAU;IAC1D,iBAAQ,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AACpC,CAAC;AAFD,kDAEC","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"]}
1
+ {"version":3,"sources":["tables/pivot-chart.tsx"],"names":[],"mappings":";;;AACA,6CAA4C;AAE5C,6CAAwE;AAExE,6CAA2C;AAU9B,QAAA,UAAU,GAAG,IAAA,wBAAW,EAA2C,YAAY,EAAE;IAC5F,IAAI,EAAE,aAAa;IACnB,kBAAkB,EAAE,mBAA6B;CAClD,CAAC,CAAC;AAEH,SAAgB,mBAAmB,CAAC,IAAY,EAAE,KAAU;IAC1D,iBAAQ,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AACpC,CAAC;AAFD,kDAEC","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' | 'columnWidthConfig' | 'columns' | 'dragOrder' | 'resize'>,\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"]}
@@ -1,8 +1,6 @@
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'>, Omit<PivotTableConstructorOptions, 'container'> {
4
+ export interface PivotTableProps extends Omit<BaseTableProps, 'records' | 'columnWidthConfig' | 'columns' | 'dragOrder' | 'resize'>, Omit<PivotTableConstructorOptions, 'container'> {
5
5
  }
6
- export declare const PivotTableSimple: React.ForwardRefExoticComponent<PivotTableProps & {
7
- children?: React.ReactNode;
8
- } & import("../containers/withContainer").ContainerProps & React.RefAttributes<any>>;
6
+ export declare const PivotTableSimple: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<any>>;
@@ -1 +1 @@
1
- {"version":3,"sources":["tables/pivot-table-simple.tsx"],"names":[],"mappings":";;;AAEA,6CAA8E;AAE9E,6CAA2C;AAM9B,QAAA,gBAAgB,GAAG,IAAA,wBAAW,EAA2C,YAAY,EAAE;IAClG,IAAI,EAAE,aAAa;IACnB,kBAAkB,EAAE,yBAA6B;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
+ {"version":3,"sources":["tables/pivot-table-simple.tsx"],"names":[],"mappings":";;;AAEA,6CAA8E;AAE9E,6CAA2C;AAM9B,QAAA,gBAAgB,GAAG,IAAA,wBAAW,EAA2C,YAAY,EAAE;IAClG,IAAI,EAAE,aAAa;IACnB,kBAAkB,EAAE,yBAA6B;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' | 'columnWidthConfig' | 'columns' | 'dragOrder' | 'resize'>,\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,8 +1,6 @@
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'>, Omit<PivotTableConstructorOptions, 'container'> {
4
+ export interface PivotTableProps extends Omit<BaseTableProps, 'records' | 'columnWidthConfig' | 'columns' | 'dragOrder' | 'resize'>, Omit<PivotTableConstructorOptions, 'container'> {
5
5
  }
6
- export declare const PivotTable: React.ForwardRefExoticComponent<PivotTableProps & {
7
- children?: React.ReactNode;
8
- } & import("../containers/withContainer").ContainerProps & React.RefAttributes<any>>;
6
+ export declare const PivotTable: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<any>>;
@@ -1 +1 @@
1
- {"version":3,"sources":["tables/pivot-table.tsx"],"names":[],"mappings":";;;AAEA,6CAAwE;AAExE,6CAA2C;AAM9B,QAAA,UAAU,GAAG,IAAA,wBAAW,EAA2C,YAAY,EAAE;IAC5F,IAAI,EAAE,aAAa;IACnB,kBAAkB,EAAE,mBAA6B;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"]}
1
+ {"version":3,"sources":["tables/pivot-table.tsx"],"names":[],"mappings":";;;AAEA,6CAAwE;AAExE,6CAA2C;AAM9B,QAAA,UAAU,GAAG,IAAA,wBAAW,EAA2C,YAAY,EAAE;IAC5F,IAAI,EAAE,aAAa;IACnB,kBAAkB,EAAE,mBAA6B;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' | 'columnWidthConfig' | 'columns' | 'dragOrder' | 'resize'>,\n Omit<PivotTableConstructorOptions, 'container'> {}\n\nexport const PivotTable = createTable<React.PropsWithChildren<PivotTableProps>>('PivotTable', {\n type: 'pivot-table',\n vtableConstrouctor: PivotTableConstrouctor as any\n});\n"]}