@visactor/react-vtable 1.7.2 → 1.7.4

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.
@@ -30,7 +30,7 @@ function CheckboxComponent(baseProps, ref) {
30
30
  var _a;
31
31
  null === (_a = checkboxRef.current) || void 0 === _a || _a.removeEventListener("checkbox_state_change", handleChange);
32
32
  };
33
- }), []), React.createElement(VCheckbox, {
33
+ }), []), React.createElement(VCheckbox, Object.assign({
34
34
  ref: checkboxRef,
35
35
  attribute: Object.assign({
36
36
  text: Object.assign(Object.assign({}, textStyle), {
@@ -39,7 +39,7 @@ function CheckboxComponent(baseProps, ref) {
39
39
  box: boxStyle,
40
40
  icon: iconStyle
41
41
  }, rest)
42
- });
42
+ }, rest));
43
43
  }
44
44
 
45
45
  export const Checkbox = React.forwardRef(CheckboxComponent);
@@ -1 +1 @@
1
- {"version":3,"sources":["components/checkbox/checkbox.tsx"],"names":[],"mappings":";;;;;;;;;;;AASA,OAAO,EAAE,QAAQ,IAAI,SAAS,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAiBtD,MAAM,YAAY,GAAkB,EAAE,CAAC;AAEvC,SAAS,iBAAiB,CAAC,SAAwB,EAAE,GAA+B;IAClF,MAAM,KAAK,GAAkB,KAAK,CAAC,EAAE,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;IAChE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,KAAc,KAAK,EAAd,IAAI,UAAK,KAAK,EAA7D,kDAAqD,CAAQ,CAAC;IACpE,IAAI,WAAW,GAAG,KAAK,CAAC,MAAM,CAAkB,IAAI,CAAC,CAAC;IACtD,WAAW,GAAG,GAAG,CAAC,CAAC,CAAE,GAAwC,CAAC,CAAC,CAAC,WAAW,CAAC;IAE5E,MAAM,YAAY,GAAG,WAAW,CAAC,CAAC,KAAkC,EAAE,EAAE;QACtE,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACnE,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,SAAS,CAAC,GAAG,EAAE;;QACb,MAAA,WAAW,CAAC,OAAO,0CAAE,gBAAgB,CAAC,uBAAuB,EAAE,YAAY,CAAC,CAAC;QAC7E,OAAO,GAAG,EAAE;;YACV,MAAA,WAAW,CAAC,OAAO,0CAAE,mBAAmB,CAAC,uBAAuB,EAAE,YAAY,CAAC,CAAC;QAClF,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACL,oBAAC,SAAS,IACR,GAAG,EAAE,WAAW,EAChB,SAAS,kBACP,IAAI,kCACC,SAAS,KACZ,IAAI,EAAE,QAAQ,KAEhB,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,SAAS,IACZ,IAAI,IAEE,CACd,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAiC,iBAAiB,CAAC,CAAC;AAE5F,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAC","file":"checkbox.js","sourcesContent":["import type {\n BackgroundAttributes,\n Cursor,\n IRectGraphicAttribute,\n ITextGraphicAttribute,\n Padding,\n CheckBox as VRenderCheckbox,\n CheckboxAttributes\n} from '@visactor/vtable/es/vrender';\nimport { Checkbox as VCheckbox } from '../vrender-components/checkbox';\nimport { merge } from '@visactor/vutils';\nimport React, { useCallback, useEffect } from 'react';\n\nexport interface CheckboxProps {\n children?: string;\n textStyle?: CheckboxAttributes['text'];\n boxStyle?: CheckboxAttributes['box'];\n iconStyle?: CheckboxAttributes['icon'];\n checked?: boolean;\n indeterminate?: boolean;\n interactive?: boolean;\n disabled?: boolean;\n disableCursor?: Cursor;\n spaceBetweenTextAndIcon?: number;\n visible?: boolean;\n onChange?: (checked: boolean) => void;\n}\n\nconst defaultProps: CheckboxProps = {};\n\nfunction CheckboxComponent(baseProps: CheckboxProps, ref: React.Ref<VRenderCheckbox>) {\n const props: CheckboxProps = merge({}, defaultProps, baseProps);\n const { textStyle, boxStyle, iconStyle, children, ...rest } = props;\n let checkboxRef = React.useRef<VRenderCheckbox>(null);\n checkboxRef = ref ? (ref as React.RefObject<VRenderCheckbox>) : checkboxRef;\n\n const handleChange = useCallback((event: { target: VRenderCheckbox }) => {\n props.onChange && props.onChange(event.target.attribute.checked);\n }, []);\n\n useEffect(() => {\n checkboxRef.current?.addEventListener('checkbox_state_change', handleChange);\n return () => {\n checkboxRef.current?.removeEventListener('checkbox_state_change', handleChange);\n };\n }, []);\n\n return (\n <VCheckbox\n ref={checkboxRef}\n attribute={{\n text: {\n ...textStyle,\n text: children\n },\n box: boxStyle,\n icon: iconStyle,\n ...rest\n }}\n ></VCheckbox>\n );\n}\n\nexport const Checkbox = React.forwardRef<VRenderCheckbox, CheckboxProps>(CheckboxComponent);\n\nCheckbox.displayName = 'Checkbox';\n"]}
1
+ {"version":3,"sources":["components/checkbox/checkbox.tsx"],"names":[],"mappings":";;;;;;;;;;;AASA,OAAO,EAAE,QAAQ,IAAI,SAAS,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAiBtD,MAAM,YAAY,GAAkB,EAAE,CAAC;AAEvC,SAAS,iBAAiB,CAAC,SAAwB,EAAE,GAA+B;IAClF,MAAM,KAAK,GAAkB,KAAK,CAAC,EAAE,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;IAChE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,KAAc,KAAK,EAAd,IAAI,UAAK,KAAK,EAA7D,kDAAqD,CAAQ,CAAC;IACpE,IAAI,WAAW,GAAG,KAAK,CAAC,MAAM,CAAkB,IAAI,CAAC,CAAC;IACtD,WAAW,GAAG,GAAG,CAAC,CAAC,CAAE,GAAwC,CAAC,CAAC,CAAC,WAAW,CAAC;IAE5E,MAAM,YAAY,GAAG,WAAW,CAAC,CAAC,KAAkC,EAAE,EAAE;QACtE,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACnE,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,SAAS,CAAC,GAAG,EAAE;;QACb,MAAA,WAAW,CAAC,OAAO,0CAAE,gBAAgB,CAAC,uBAAuB,EAAE,YAAY,CAAC,CAAC;QAC7E,OAAO,GAAG,EAAE;;YACV,MAAA,WAAW,CAAC,OAAO,0CAAE,mBAAmB,CAAC,uBAAuB,EAAE,YAAY,CAAC,CAAC;QAClF,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACL,oBAAC,SAAS,kBACR,GAAG,EAAE,WAAW,EAChB,SAAS,kBACP,IAAI,kCACC,SAAS,KACZ,IAAI,EAAE,QAAQ,KAEhB,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,SAAS,IACZ,IAAI,KAEL,IAAI,EACG,CACd,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAiC,iBAAiB,CAAC,CAAC;AAE5F,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAC","file":"checkbox.js","sourcesContent":["import type {\n BackgroundAttributes,\n Cursor,\n IRectGraphicAttribute,\n ITextGraphicAttribute,\n Padding,\n CheckBox as VRenderCheckbox,\n CheckboxAttributes\n} from '@visactor/vtable/es/vrender';\nimport { Checkbox as VCheckbox } from '../vrender-components/checkbox';\nimport { merge } from '@visactor/vutils';\nimport React, { useCallback, useEffect } from 'react';\n\nexport interface CheckboxProps {\n children?: string;\n textStyle?: CheckboxAttributes['text'];\n boxStyle?: CheckboxAttributes['box'];\n iconStyle?: CheckboxAttributes['icon'];\n checked?: boolean;\n indeterminate?: boolean;\n interactive?: boolean;\n disabled?: boolean;\n disableCursor?: Cursor;\n spaceBetweenTextAndIcon?: number;\n visible?: boolean;\n onChange?: (checked: boolean) => void;\n}\n\nconst defaultProps: CheckboxProps = {};\n\nfunction CheckboxComponent(baseProps: CheckboxProps, ref: React.Ref<VRenderCheckbox>) {\n const props: CheckboxProps = merge({}, defaultProps, baseProps);\n const { textStyle, boxStyle, iconStyle, children, ...rest } = props;\n let checkboxRef = React.useRef<VRenderCheckbox>(null);\n checkboxRef = ref ? (ref as React.RefObject<VRenderCheckbox>) : checkboxRef;\n\n const handleChange = useCallback((event: { target: VRenderCheckbox }) => {\n props.onChange && props.onChange(event.target.attribute.checked);\n }, []);\n\n useEffect(() => {\n checkboxRef.current?.addEventListener('checkbox_state_change', handleChange);\n return () => {\n checkboxRef.current?.removeEventListener('checkbox_state_change', handleChange);\n };\n }, []);\n\n return (\n <VCheckbox\n ref={checkboxRef}\n attribute={{\n text: {\n ...textStyle,\n text: children\n },\n box: boxStyle,\n icon: iconStyle,\n ...rest\n }}\n {...rest} // for REACT_TO_CANOPUS_EVENTS\n ></VCheckbox>\n );\n}\n\nexport const Checkbox = React.forwardRef<VRenderCheckbox, CheckboxProps>(CheckboxComponent);\n\nCheckbox.displayName = 'Checkbox';\n"]}
@@ -26,7 +26,7 @@ function RadioComponent(baseProps, ref) {
26
26
  return useEffect((() => (radioRef.current.addEventListener("radio_checked", handleChange),
27
27
  () => {
28
28
  radioRef.current.removeEventListener("radio_checked", handleChange);
29
- })), []), React.createElement(VRadio, {
29
+ })), []), React.createElement(VRadio, Object.assign({
30
30
  ref: radioRef,
31
31
  attribute: Object.assign({
32
32
  text: Object.assign(Object.assign({}, textStyle), {
@@ -34,7 +34,7 @@ function RadioComponent(baseProps, ref) {
34
34
  }),
35
35
  circle: circleStyle
36
36
  }, rest)
37
- });
37
+ }, rest));
38
38
  }
39
39
 
40
40
  export const Radio = React.forwardRef(RadioComponent);
@@ -1 +1 @@
1
- {"version":3,"sources":["components/radio/radio.tsx"],"names":[],"mappings":";;;;;;;;;;;AASA,OAAO,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAetD,MAAM,YAAY,GAAe,EAAE,CAAC;AAEpC,SAAS,cAAc,CAAC,SAAqB,EAAE,GAA4B;IACzE,MAAM,KAAK,GAAe,KAAK,CAAC,EAAE,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;IAC7D,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,KAAc,KAAK,EAAd,IAAI,UAAK,KAAK,EAArD,wCAA6C,CAAQ,CAAC;IAC5D,IAAI,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAe,IAAI,CAAC,CAAC;IAChD,QAAQ,GAAG,GAAG,CAAC,CAAC,CAAE,GAAqC,CAAC,CAAC,CAAC,QAAQ,CAAC;IAEnE,MAAM,YAAY,GAAG,WAAW,CAAC,CAAC,KAA+B,EAAE,EAAE;QACnE,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACnE,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,SAAS,CAAC,GAAG,EAAE;QACb,QAAQ,CAAC,OAAO,CAAC,gBAAgB,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC;QACjE,OAAO,GAAG,EAAE;YACV,QAAQ,CAAC,OAAO,CAAC,mBAAmB,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC;QACtE,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACL,oBAAC,MAAM,IACL,GAAG,EAAE,QAAQ,EACb,SAAS,kBACP,IAAI,kCACC,SAAS,KACZ,IAAI,EAAE,QAAQ,KAEhB,MAAM,EAAE,WAAW,IAChB,IAAI,IAED,CACX,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAA2B,cAAc,CAAC,CAAC;AAEhF,KAAK,CAAC,WAAW,GAAG,OAAO,CAAC","file":"radio.js","sourcesContent":["import type {\n BackgroundAttributes,\n Cursor,\n IRectGraphicAttribute,\n ITextGraphicAttribute,\n Padding,\n Radio as VRenderRadio,\n RadioAttributes\n} from '@visactor/vtable/es/vrender';\nimport { Radio as VRadio } from '../vrender-components/radio';\nimport { merge } from '@visactor/vutils';\nimport React, { useCallback, useEffect } from 'react';\n\nexport interface RadioProps {\n children?: string;\n textStyle?: RadioAttributes['text'];\n circleStyle?: RadioAttributes['circle'];\n checked?: boolean;\n interactive?: boolean;\n disabled?: boolean;\n disableCursor?: Cursor;\n spaceBetweenTextAndIcon?: number;\n visible?: boolean;\n onChange?: (checked: boolean) => void;\n}\n\nconst defaultProps: RadioProps = {};\n\nfunction RadioComponent(baseProps: RadioProps, ref: React.Ref<VRenderRadio>) {\n const props: RadioProps = merge({}, defaultProps, baseProps);\n const { textStyle, circleStyle, children, ...rest } = props;\n let radioRef = React.useRef<VRenderRadio>(null);\n radioRef = ref ? (ref as React.RefObject<VRenderRadio>) : radioRef;\n\n const handleChange = useCallback((event: { target: VRenderRadio }) => {\n props.onChange && props.onChange(event.target.attribute.checked);\n }, []);\n\n useEffect(() => {\n radioRef.current.addEventListener('radio_checked', handleChange);\n return () => {\n radioRef.current.removeEventListener('radio_checked', handleChange);\n };\n }, []);\n\n return (\n <VRadio\n ref={radioRef}\n attribute={{\n text: {\n ...textStyle,\n text: children\n },\n circle: circleStyle,\n ...rest\n }}\n ></VRadio>\n );\n}\n\nexport const Radio = React.forwardRef<VRenderRadio, RadioProps>(RadioComponent);\n\nRadio.displayName = 'Radio';\n"]}
1
+ {"version":3,"sources":["components/radio/radio.tsx"],"names":[],"mappings":";;;;;;;;;;;AASA,OAAO,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAetD,MAAM,YAAY,GAAe,EAAE,CAAC;AAEpC,SAAS,cAAc,CAAC,SAAqB,EAAE,GAA4B;IACzE,MAAM,KAAK,GAAe,KAAK,CAAC,EAAE,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;IAC7D,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,KAAc,KAAK,EAAd,IAAI,UAAK,KAAK,EAArD,wCAA6C,CAAQ,CAAC;IAC5D,IAAI,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAe,IAAI,CAAC,CAAC;IAChD,QAAQ,GAAG,GAAG,CAAC,CAAC,CAAE,GAAqC,CAAC,CAAC,CAAC,QAAQ,CAAC;IAEnE,MAAM,YAAY,GAAG,WAAW,CAAC,CAAC,KAA+B,EAAE,EAAE;QACnE,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACnE,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,SAAS,CAAC,GAAG,EAAE;QACb,QAAQ,CAAC,OAAO,CAAC,gBAAgB,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC;QACjE,OAAO,GAAG,EAAE;YACV,QAAQ,CAAC,OAAO,CAAC,mBAAmB,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC;QACtE,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACL,oBAAC,MAAM,kBACL,GAAG,EAAE,QAAQ,EACb,SAAS,kBACP,IAAI,kCACC,SAAS,KACZ,IAAI,EAAE,QAAQ,KAEhB,MAAM,EAAE,WAAW,IAChB,IAAI,KAEL,IAAI,EACA,CACX,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAA2B,cAAc,CAAC,CAAC;AAEhF,KAAK,CAAC,WAAW,GAAG,OAAO,CAAC","file":"radio.js","sourcesContent":["import type {\n BackgroundAttributes,\n Cursor,\n IRectGraphicAttribute,\n ITextGraphicAttribute,\n Padding,\n Radio as VRenderRadio,\n RadioAttributes\n} from '@visactor/vtable/es/vrender';\nimport { Radio as VRadio } from '../vrender-components/radio';\nimport { merge } from '@visactor/vutils';\nimport React, { useCallback, useEffect } from 'react';\n\nexport interface RadioProps {\n children?: string;\n textStyle?: RadioAttributes['text'];\n circleStyle?: RadioAttributes['circle'];\n checked?: boolean;\n interactive?: boolean;\n disabled?: boolean;\n disableCursor?: Cursor;\n spaceBetweenTextAndIcon?: number;\n visible?: boolean;\n onChange?: (checked: boolean) => void;\n}\n\nconst defaultProps: RadioProps = {};\n\nfunction RadioComponent(baseProps: RadioProps, ref: React.Ref<VRenderRadio>) {\n const props: RadioProps = merge({}, defaultProps, baseProps);\n const { textStyle, circleStyle, children, ...rest } = props;\n let radioRef = React.useRef<VRenderRadio>(null);\n radioRef = ref ? (ref as React.RefObject<VRenderRadio>) : radioRef;\n\n const handleChange = useCallback((event: { target: VRenderRadio }) => {\n props.onChange && props.onChange(event.target.attribute.checked);\n }, []);\n\n useEffect(() => {\n radioRef.current.addEventListener('radio_checked', handleChange);\n return () => {\n radioRef.current.removeEventListener('radio_checked', handleChange);\n };\n }, []);\n\n return (\n <VRadio\n ref={radioRef}\n attribute={{\n text: {\n ...textStyle,\n text: children\n },\n circle: circleStyle,\n ...rest\n }}\n {...rest} // for REACT_TO_CANOPUS_EVENTS\n ></VRadio>\n );\n}\n\nexport const Radio = React.forwardRef<VRenderRadio, RadioProps>(RadioComponent);\n\nRadio.displayName = 'Radio';\n"]}
@@ -31,13 +31,13 @@ const defaultProps = {
31
31
  function TagComponent(baseProps, ref) {
32
32
  const props = merge({}, defaultProps, baseProps), {attribute: attribute, panelStyle: panelStyle, children: children} = props, rest = __rest(props, [ "attribute", "panelStyle", "children" ]);
33
33
  let tagRef = React.useRef(null);
34
- return tagRef = ref || tagRef, React.createElement(VTag, {
34
+ return tagRef = ref || tagRef, React.createElement(VTag, Object.assign({
35
35
  ref: tagRef,
36
36
  attribute: null != attribute ? attribute : Object.assign({
37
37
  text: children,
38
38
  panel: panelStyle
39
39
  }, rest)
40
- });
40
+ }, rest));
41
41
  }
42
42
 
43
43
  export const Tag = React.forwardRef(TagComponent);
@@ -1 +1 @@
1
- {"version":3,"sources":["components/tag/tag.tsx"],"names":[],"mappings":";;;;;;;;;;;AASA,OAAO,EAAE,GAAG,IAAI,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,KAAoB,MAAM,OAAO,CAAC;AAazC,MAAM,YAAY,GAAa;IAC7B,SAAS,EAAE;QACT,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,YAAY;QACxB,IAAI,EAAE,mBAAmB;KAC1B;IAED,UAAU,EAAE;QACV,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,SAAS;QACf,SAAS,EAAE,CAAC;QACZ,YAAY,EAAE,CAAC;KAChB;CACF,CAAC;AAEF,SAAS,YAAY,CAAC,SAAmB,EAAE,GAA0B;IACnE,MAAM,KAAK,GAAa,KAAK,CAAC,EAAE,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;IAC3D,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,KAAc,KAAK,EAAd,IAAI,UAAK,KAAK,EAApD,uCAA4C,CAAQ,CAAC;IAC3D,IAAI,MAAM,GAAG,KAAK,CAAC,MAAM,CAAa,IAAI,CAAC,CAAC;IAC5C,MAAM,GAAG,GAAG,CAAC,CAAC,CAAE,GAAmC,CAAC,CAAC,CAAC,MAAM,CAAC;IAE7D,OAAO,CACL,oBAAC,IAAI,IACH,GAAG,EAAE,MAAM,EACX,SAAS,EACP,SAAS,aAAT,SAAS,cAAT,SAAS,mBACP,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,UAAiB,IACrB,IAAI,CACR,GAEG,CACT,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,GAAG,GAAG,KAAK,CAAC,UAAU,CAAuB,YAAY,CAAC,CAAC;AAExE,GAAG,CAAC,WAAW,GAAG,KAAK,CAAC","file":"tag.js","sourcesContent":["import type {\n BackgroundAttributes,\n Cursor,\n IRectGraphicAttribute,\n ITextGraphicAttribute,\n Padding,\n Tag as VRenderTag,\n TagAttributes\n} from '@visactor/vtable/es/vrender';\nimport { Tag as VTag } from '../vrender-components/tag';\nimport { merge } from '@visactor/vutils';\nimport React, { useEffect } from 'react';\n\nexport interface TagProps {\n attribute?: TagAttributes;\n children?: string;\n textStyle?: Partial<ITextGraphicAttribute>;\n panelStyle?: Partial<IRectGraphicAttribute>;\n padding?: Padding;\n minWidth?: number;\n maxWidth?: number;\n visible?: boolean;\n}\n\nconst defaultProps: TagProps = {\n textStyle: {\n fontSize: 14,\n fontFamily: 'sans-serif',\n fill: 'rgb(51, 101, 238)'\n },\n // padding: [8, 10],\n panelStyle: {\n visible: true,\n fill: '#e6fffb',\n lineWidth: 1,\n cornerRadius: 4\n }\n};\n\nfunction TagComponent(baseProps: TagProps, ref: React.Ref<VRenderTag>) {\n const props: TagProps = merge({}, defaultProps, baseProps);\n const { attribute, panelStyle, children, ...rest } = props;\n let tagRef = React.useRef<VRenderTag>(null);\n tagRef = ref ? (ref as React.RefObject<VRenderTag>) : tagRef;\n\n return (\n <VTag\n ref={tagRef}\n attribute={\n attribute ?? {\n text: children,\n panel: panelStyle as any,\n ...rest\n }\n }\n ></VTag>\n );\n}\n\nexport const Tag = React.forwardRef<VRenderTag, TagProps>(TagComponent);\n\nTag.displayName = 'Tag';\n"]}
1
+ {"version":3,"sources":["components/tag/tag.tsx"],"names":[],"mappings":";;;;;;;;;;;AASA,OAAO,EAAE,GAAG,IAAI,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,KAAoB,MAAM,OAAO,CAAC;AAazC,MAAM,YAAY,GAAa;IAC7B,SAAS,EAAE;QACT,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,YAAY;QACxB,IAAI,EAAE,mBAAmB;KAC1B;IAED,UAAU,EAAE;QACV,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,SAAS;QACf,SAAS,EAAE,CAAC;QACZ,YAAY,EAAE,CAAC;KAChB;CACF,CAAC;AAEF,SAAS,YAAY,CAAC,SAAmB,EAAE,GAA0B;IACnE,MAAM,KAAK,GAAa,KAAK,CAAC,EAAE,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;IAC3D,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,KAAc,KAAK,EAAd,IAAI,UAAK,KAAK,EAApD,uCAA4C,CAAQ,CAAC;IAC3D,IAAI,MAAM,GAAG,KAAK,CAAC,MAAM,CAAa,IAAI,CAAC,CAAC;IAC5C,MAAM,GAAG,GAAG,CAAC,CAAC,CAAE,GAAmC,CAAC,CAAC,CAAC,MAAM,CAAC;IAE7D,OAAO,CACL,oBAAC,IAAI,kBACH,GAAG,EAAE,MAAM,EACX,SAAS,EACP,SAAS,aAAT,SAAS,cAAT,SAAS,mBACP,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,UAAiB,IACrB,IAAI,CACR,IAEC,IAAI,EACF,CACT,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,GAAG,GAAG,KAAK,CAAC,UAAU,CAAuB,YAAY,CAAC,CAAC;AAExE,GAAG,CAAC,WAAW,GAAG,KAAK,CAAC","file":"tag.js","sourcesContent":["import type {\n BackgroundAttributes,\n Cursor,\n IRectGraphicAttribute,\n ITextGraphicAttribute,\n Padding,\n Tag as VRenderTag,\n TagAttributes\n} from '@visactor/vtable/es/vrender';\nimport { Tag as VTag } from '../vrender-components/tag';\nimport { merge } from '@visactor/vutils';\nimport React, { useEffect } from 'react';\n\nexport interface TagProps {\n attribute?: TagAttributes;\n children?: string;\n textStyle?: Partial<ITextGraphicAttribute>;\n panelStyle?: Partial<IRectGraphicAttribute>;\n padding?: Padding;\n minWidth?: number;\n maxWidth?: number;\n visible?: boolean;\n}\n\nconst defaultProps: TagProps = {\n textStyle: {\n fontSize: 14,\n fontFamily: 'sans-serif',\n fill: 'rgb(51, 101, 238)'\n },\n // padding: [8, 10],\n panelStyle: {\n visible: true,\n fill: '#e6fffb',\n lineWidth: 1,\n cornerRadius: 4\n }\n};\n\nfunction TagComponent(baseProps: TagProps, ref: React.Ref<VRenderTag>) {\n const props: TagProps = merge({}, defaultProps, baseProps);\n const { attribute, panelStyle, children, ...rest } = props;\n let tagRef = React.useRef<VRenderTag>(null);\n tagRef = ref ? (ref as React.RefObject<VRenderTag>) : tagRef;\n\n return (\n <VTag\n ref={tagRef}\n attribute={\n attribute ?? {\n text: children,\n panel: panelStyle as any,\n ...rest\n }\n }\n {...rest} // for REACT_TO_CANOPUS_EVENTS\n ></VTag>\n );\n}\n\nexport const Tag = React.forwardRef<VRenderTag, TagProps>(TagComponent);\n\nTag.displayName = 'Tag';\n"]}
package/es/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.7.2";
4
+ export declare const version = "1.7.4";
package/es/index.js CHANGED
@@ -4,5 +4,5 @@ export * from "./table-components";
4
4
 
5
5
  export * from "./components";
6
6
 
7
- export const version = "1.7.2";
7
+ export const version = "1.7.4";
8
8
  //# sourceMappingURL=index.js.map
package/es/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAE7B,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC","file":"index.js","sourcesContent":["export * from './tables';\nexport * from './table-components';\nexport * from './components';\n\nexport const version = \"1.7.2\";\n"]}
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAE7B,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC","file":"index.js","sourcesContent":["export * from './tables';\nexport * from './table-components';\nexport * from './components';\n\nexport const version = \"1.7.4\";\n"]}
@@ -8,4 +8,5 @@ export declare class VTableReactAttributePlugin extends ReactAttributePlugin {
8
8
  nativeContainer: any;
9
9
  };
10
10
  updateStyleOfWrapContainer(graphic: IGraphic, stage: IStage, wrapContainer: HTMLElement, nativeContainer: HTMLElement, options: SimpleDomStyleOptions & CommonDomOptions): void;
11
+ protected drawHTML(): void;
11
12
  }
@@ -1,4 +1,4 @@
1
- import { ReactAttributePlugin, application } from "@visactor/vtable/es/vrender";
1
+ import { DefaultAttribute, ReactAttributePlugin, application } from "@visactor/vtable/es/vrender";
2
2
 
3
3
  import { calculateAnchorOfBounds, isFunction, isNil, isObject, isString, styleStringToObject } from "@visactor/vutils";
4
4
 
@@ -80,5 +80,13 @@ export class VTableReactAttributePlugin extends ReactAttributePlugin {
80
80
  graphic: graphic
81
81
  });
82
82
  }
83
+ drawHTML() {
84
+ "browser" === application.global.env && (this.pluginService.stage.children.sort(((a, b) => {
85
+ var _a, _b;
86
+ return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
87
+ })).forEach((group => {
88
+ this.renderGroupHTML(group);
89
+ })), this.clearCacheContainer());
90
+ }
83
91
  }
84
92
  //# sourceMappingURL=vtable-react-attribute-plugin.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["table-components/custom/vtable-react-attribute-plugin.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAChF,OAAO,EAAE,uBAAuB,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAGvH,MAAM,OAAO,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,MAAM,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,MAAA,OAAO,CAAC,EAAE,mCAAI,OAAO,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;QAE9E,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,I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GACd,IAAI,CAAC,kBAAkB,CAAC,OAAgB,CAAC,CAC7C,CAAC;SACH;QAED,IAAI,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YAC7B,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,CAC7B,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,EACvE,OAAO,EACP,aAAa,CACd,CAAC;YAEF,IAAI,SAAS,EAAE;gBACb,cAAc,mCAAQ,cAAc,GAAK,SAAS,CAAE,CAAC;aACtD;SACF;aAAM,IAAI,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YAClC,cAAc,mCAAQ,cAAc,GAAK,OAAO,CAAC,KAAK,CAAE,CAAC;SAC1D;aAAM,IAAI,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,KAAK,EAAE;YACnD,cAAc,mCAAQ,cAAc,GAAK,mBAAmB,CAAC,OAAO,CAAC,KAAe,CAAC,CAAE,CAAC;SACzF;QAGD,WAAW,CAAC,MAAM,CAAC,SAAS,CAAC,aAAa,EAAE;YAC1C,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,MAAM,EAAE,OAAO,CAAC,KAAK;YACrB,KAAK,EAAE,cAAc;YACrB,OAAO;SACwB,CAAC,CAAC;IACrC,CAAC;CACF","file":"vtable-react-attribute-plugin.js","sourcesContent":["import type {\n CommonDomOptions,\n CreateDOMParamsType,\n IGraphic,\n IStage,\n IText,\n SimpleDomStyleOptions\n} from '@visactor/vtable/es/vrender';\nimport { ReactAttributePlugin, application } from '@visactor/vtable/es/vrender';\nimport { calculateAnchorOfBounds, isFunction, isNil, isObject, isString, styleStringToObject } from '@visactor/vutils';\nimport type { CreateDOMParamsTypeForVTable } from './vtable-browser-env-contribution';\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 } as CreateDOMParamsTypeForVTable);\n }\n}\n"]}
1
+ {"version":3,"sources":["table-components/custom/vtable-react-attribute-plugin.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAClG,OAAO,EAAE,uBAAuB,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAGvH,MAAM,OAAO,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,MAAM,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,MAAA,OAAO,CAAC,EAAE,mCAAI,OAAO,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;QAE9E,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,SA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B,CAAC,MAAM,CAAC,CAAC;YAC3G,CAAC,CAAC;iBACD,OAAO,CAAC,CAAC,KAAa,EAAE,EAAE;gBACzB,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;YAC9B,CAAC,CAAC,CAAC;YAEL,IAAI,CAAC,mBAAmB,EAAE,CAAC;SAC5B;IACH,CAAC;CACF","file":"vtable-react-attribute-plugin.js","sourcesContent":["import type {\n CommonDomOptions,\n CreateDOMParamsType,\n IGraphic,\n IGroup,\n IStage,\n IText,\n SimpleDomStyleOptions\n} from '@visactor/vtable/es/vrender';\nimport { DefaultAttribute, ReactAttributePlugin, application } from '@visactor/vtable/es/vrender';\nimport { calculateAnchorOfBounds, isFunction, isNil, isObject, isString, styleStringToObject } from '@visactor/vutils';\nimport type { CreateDOMParamsTypeForVTable } from './vtable-browser-env-contribution';\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 } as CreateDOMParamsTypeForVTable);\n }\n\n protected drawHTML() {\n if (application.global.env === 'browser') {\n (this.pluginService.stage as any).children // fix interactive layer problem\n .sort((a: IGraphic, b: IGraphic) => {\n return (a.attribute.zIndex ?? DefaultAttribute.zIndex) - (b.attribute.zIndex ?? DefaultAttribute.zIndex);\n })\n .forEach((group: IGroup) => {\n this.renderGroupHTML(group);\n });\n\n this.clearCacheContainer();\n }\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visactor/react-vtable",
3
- "version": "1.7.2",
3
+ "version": "1.7.4",
4
4
  "description": "The react version of VTable",
5
5
  "keywords": [
6
6
  "react",
@@ -46,7 +46,7 @@
46
46
  "@visactor/vutils": "~0.18.13",
47
47
  "react-is": "^18.2.0",
48
48
  "react-reconciler": "0.29.2",
49
- "@visactor/vtable": "1.7.2"
49
+ "@visactor/vtable": "1.7.4"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@visactor/vchart": "1.12.1",
@@ -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/eslint-config": "0.0.1",
96
- "@internal/ts-config": "0.0.1"
95
+ "@internal/ts-config": "0.0.1",
96
+ "@internal/eslint-config": "0.0.1"
97
97
  },
98
98
  "scripts": {
99
99
  "start": "vite ./demo",