@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.
- package/cjs/components/checkbox/checkbox.js +2 -2
- package/cjs/components/checkbox/checkbox.js.map +1 -1
- package/cjs/components/radio/radio.js +2 -2
- package/cjs/components/radio/radio.js.map +1 -1
- package/cjs/components/tag/tag.js +2 -2
- package/cjs/components/tag/tag.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/table-components/custom/vtable-react-attribute-plugin.d.ts +1 -0
- package/cjs/table-components/custom/vtable-react-attribute-plugin.js +8 -0
- package/cjs/table-components/custom/vtable-react-attribute-plugin.js.map +1 -1
- package/dist/react-vtable.js +16 -4
- package/dist/react-vtable.min.js +2 -2
- package/es/components/checkbox/checkbox.js +2 -2
- package/es/components/checkbox/checkbox.js.map +1 -1
- package/es/components/radio/radio.js +2 -2
- package/es/components/radio/radio.js.map +1 -1
- package/es/components/tag/tag.js +2 -2
- package/es/components/tag/tag.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/table-components/custom/vtable-react-attribute-plugin.d.ts +1 -0
- package/es/table-components/custom/vtable-react-attribute-plugin.js +9 -1
- package/es/table-components/custom/vtable-react-attribute-plugin.js.map +1 -1
- package/package.json +4 -4
|
@@ -53,7 +53,7 @@ function CheckboxComponent(baseProps, ref) {
|
|
|
53
53
|
var _a;
|
|
54
54
|
null === (_a = checkboxRef.current) || void 0 === _a || _a.removeEventListener("checkbox_state_change", handleChange);
|
|
55
55
|
};
|
|
56
|
-
}), []), react_1.default.createElement(checkbox_1.Checkbox, {
|
|
56
|
+
}), []), react_1.default.createElement(checkbox_1.Checkbox, Object.assign({
|
|
57
57
|
ref: checkboxRef,
|
|
58
58
|
attribute: Object.assign({
|
|
59
59
|
text: Object.assign(Object.assign({}, textStyle), {
|
|
@@ -62,7 +62,7 @@ function CheckboxComponent(baseProps, ref) {
|
|
|
62
62
|
box: boxStyle,
|
|
63
63
|
icon: iconStyle
|
|
64
64
|
}, rest)
|
|
65
|
-
});
|
|
65
|
+
}, rest));
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
exports.Checkbox = react_1.default.forwardRef(CheckboxComponent), exports.Checkbox.displayName = "Checkbox";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/checkbox/checkbox.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,6DAAuE;AACvE,6CAAyC;AACzC,+CAAsD;AAiBtD,MAAM,YAAY,GAAkB,EAAE,CAAC;AAEvC,SAAS,iBAAiB,CAAC,SAAwB,EAAE,GAA+B;IAClF,MAAM,KAAK,GAAkB,IAAA,cAAK,EAAC,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,eAAK,CAAC,MAAM,CAAkB,IAAI,CAAC,CAAC;IACtD,WAAW,GAAG,GAAG,CAAC,CAAC,CAAE,GAAwC,CAAC,CAAC,CAAC,WAAW,CAAC;IAE5E,MAAM,YAAY,GAAG,IAAA,mBAAW,EAAC,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,IAAA,iBAAS,EAAC,GAAG,EAAE;;QACb,MAAA,WAAW,CAAC,OAAO,0CAAE,gBAAgB,CAAC,uBAAuB,EAAE,YAAY,CAAC,CAAC;QAC7E,OAAO,GAAG,EAAE;;YACV,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C,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACL,8BAAC,mBAAS,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;AAEY,QAAA,QAAQ,GAAG,eAAK,CAAC,UAAU,CAAiC,iBAAiB,CAAC,CAAC;AAE5F,gBAAQ,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"]}
|
|
@@ -49,7 +49,7 @@ function RadioComponent(baseProps, ref) {
|
|
|
49
49
|
return (0, react_1.useEffect)((() => (radioRef.current.addEventListener("radio_checked", handleChange),
|
|
50
50
|
() => {
|
|
51
51
|
radioRef.current.removeEventListener("radio_checked", handleChange);
|
|
52
|
-
})), []), react_1.default.createElement(radio_1.Radio, {
|
|
52
|
+
})), []), react_1.default.createElement(radio_1.Radio, Object.assign({
|
|
53
53
|
ref: radioRef,
|
|
54
54
|
attribute: Object.assign({
|
|
55
55
|
text: Object.assign(Object.assign({}, textStyle), {
|
|
@@ -57,7 +57,7 @@ function RadioComponent(baseProps, ref) {
|
|
|
57
57
|
}),
|
|
58
58
|
circle: circleStyle
|
|
59
59
|
}, rest)
|
|
60
|
-
});
|
|
60
|
+
}, rest));
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
exports.Radio = react_1.default.forwardRef(RadioComponent), exports.Radio.displayName = "Radio";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/radio/radio.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,uDAA8D;AAC9D,6CAAyC;AACzC,+CAAsD;AAetD,MAAM,YAAY,GAAe,EAAE,CAAC;AAEpC,SAAS,cAAc,CAAC,SAAqB,EAAE,GAA4B;IACzE,MAAM,KAAK,GAAe,IAAA,cAAK,EAAC,EAAE,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;IAC7D,MAAM,EAAE,SAAS,EAAE,WAAW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AChD,QAAQ,GAAG,GAAG,CAAC,CAAC,CAAE,GAAqC,CAAC,CAAC,CAAC,QAAQ,CAAC;IAEnE,MAAM,YAAY,GAAG,IAAA,mBAAW,EAAC,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,IAAA,iBAAS,EAAC,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,8BAAC,aAAM,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;AAEY,QAAA,KAAK,GAAG,eAAK,CAAC,UAAU,CAA2B,cAAc,CAAC,CAAC;AAEhF,aAAK,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"]}
|
|
@@ -35,13 +35,13 @@ const tag_1 = require("../vrender-components/tag"), vutils_1 = require("@visacto
|
|
|
35
35
|
function TagComponent(baseProps, ref) {
|
|
36
36
|
const props = (0, vutils_1.merge)({}, defaultProps, baseProps), {attribute: attribute, panelStyle: panelStyle, children: children} = props, rest = __rest(props, [ "attribute", "panelStyle", "children" ]);
|
|
37
37
|
let tagRef = react_1.default.useRef(null);
|
|
38
|
-
return tagRef = ref || tagRef, react_1.default.createElement(tag_1.Tag, {
|
|
38
|
+
return tagRef = ref || tagRef, react_1.default.createElement(tag_1.Tag, Object.assign({
|
|
39
39
|
ref: tagRef,
|
|
40
40
|
attribute: null != attribute ? attribute : Object.assign({
|
|
41
41
|
text: children,
|
|
42
42
|
panel: panelStyle
|
|
43
43
|
}, rest)
|
|
44
|
-
});
|
|
44
|
+
}, rest));
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
exports.Tag = react_1.default.forwardRef(TagComponent), exports.Tag.displayName = "Tag";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/tag/tag.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AASA,mDAAwD;AACxD,6CAAyC;AACzC,kDAAyC;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,IAAA,cAAK,EAAC,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,eAAK,CAAC,MAAM,CAAa,IAAI,CAAC,CAAC;IAC5C,MAAM,GAAG,GAAG,CAAC,CAAC,CAAE,GAAmC,CAAC,CAAC,CAAC,MAAM,CAAC;IAE7D,OAAO,CACL,8BAAC,SAAI,
|
|
1
|
+
{"version":3,"sources":["components/tag/tag.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AASA,mDAAwD;AACxD,6CAAyC;AACzC,kDAAyC;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,IAAA,cAAK,EAAC,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,eAAK,CAAC,MAAM,CAAa,IAAI,CAAC,CAAC;IAC5C,MAAM,GAAG,GAAG,CAAC,CAAC,CAAE,GAAmC,CAAC,CAAC,CAAC,MAAM,CAAC;IAE7D,OAAO,CACL,8BAAC,SAAI,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;AAEY,QAAA,GAAG,GAAG,eAAK,CAAC,UAAU,CAAuB,YAAY,CAAC,CAAC;AAExE,WAAG,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/cjs/index.d.ts
CHANGED
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.7.
|
|
21
|
+
__exportStar(require("./components"), exports), exports.version = "1.7.4";
|
|
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,OAAO,CAAC","file":"index.js","sourcesContent":["export * from './tables';\nexport * from './table-components';\nexport * from './components';\n\nexport const version = \"1.7.
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,qDAAmC;AACnC,+CAA6B;AAEhB,QAAA,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
|
}
|
|
@@ -86,6 +86,14 @@ class VTableReactAttributePlugin extends vrender_1.ReactAttributePlugin {
|
|
|
86
86
|
graphic: graphic
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
|
+
drawHTML() {
|
|
90
|
+
"browser" === vrender_1.application.global.env && (this.pluginService.stage.children.sort(((a, b) => {
|
|
91
|
+
var _a, _b;
|
|
92
|
+
return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : vrender_1.DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : vrender_1.DefaultAttribute.zIndex);
|
|
93
|
+
})).forEach((group => {
|
|
94
|
+
this.renderGroupHTML(group);
|
|
95
|
+
})), this.clearCacheContainer());
|
|
96
|
+
}
|
|
89
97
|
}
|
|
90
98
|
|
|
91
99
|
exports.VTableReactAttributePlugin = VTableReactAttributePlugin;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["table-components/custom/vtable-react-attribute-plugin.ts"],"names":[],"mappings":";;;AAQA,yDAAgF;AAChF,6CAAuH;AAGvH,MAAa,0BAA2B,SAAQ,8BAAoB;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,C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AAA,4BAAmB,EAAC,OAAO,CAAC,KAAe,CAAC,CAAE,CAAC;SACzF;QAGD,qBAAW,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;AA7JD,gEA6JC","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,yDAAkG;AAClG,6CAAuH;AAGvH,MAAa,0BAA2B,SAAQ,8BAAoB;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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AAa,EAAE;YAC1C,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,MAAM,EAAE,OAAO,CAAC,KAAK;YACrB,KAAK,EAAE,cAAc;YACrB,OAAO;SACwB,CAAC,CAAC;IACrC,CAAC;IAES,QAAQ;QAChB,IAAI,qBAAW,CAAC,MAAM,CAAC,GAAG,KAAK,SAAS,EAAE;YACvC,IAAI,CAAC,aAAa,CAAC,KAAa,CAAC,QAAQ;iBACvC,IAAI,CAAC,CAAC,CAAW,EAAE,CAAW,EAAE,EAAE;;gBACjC,OAAO,CAAC,MAAA,CAAC,CAAC,SAAS,CAAC,MAAM,mCAAI,0BAAgB,CAAC,MAAM,CAAC,GAAG,CAAC,MAAA,CAAC,CAAC,SAAS,CAAC,MAAM,mCAAI,0BAAgB,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;AA3KD,gEA2KC","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/dist/react-vtable.js
CHANGED
|
@@ -12476,6 +12476,18 @@
|
|
|
12476
12476
|
graphic
|
|
12477
12477
|
});
|
|
12478
12478
|
}
|
|
12479
|
+
drawHTML() {
|
|
12480
|
+
if (application.global.env === 'browser') {
|
|
12481
|
+
this.pluginService.stage.children
|
|
12482
|
+
.sort((a, b) => {
|
|
12483
|
+
return (a.attribute.zIndex ?? DefaultAttribute.zIndex) - (b.attribute.zIndex ?? DefaultAttribute.zIndex);
|
|
12484
|
+
})
|
|
12485
|
+
.forEach((group) => {
|
|
12486
|
+
this.renderGroupHTML(group);
|
|
12487
|
+
});
|
|
12488
|
+
this.clearCacheContainer();
|
|
12489
|
+
}
|
|
12490
|
+
}
|
|
12479
12491
|
}
|
|
12480
12492
|
|
|
12481
12493
|
const reactEnvModule = new ContainerModule((bind, unbind, isBound, rebind) => {
|
|
@@ -19236,7 +19248,7 @@
|
|
|
19236
19248
|
text: children,
|
|
19237
19249
|
panel: panelStyle,
|
|
19238
19250
|
...rest
|
|
19239
|
-
} }));
|
|
19251
|
+
}, ...rest }));
|
|
19240
19252
|
}
|
|
19241
19253
|
const Tag = React.forwardRef(TagComponent);
|
|
19242
19254
|
Tag.displayName = 'Tag';
|
|
@@ -19265,7 +19277,7 @@
|
|
|
19265
19277
|
},
|
|
19266
19278
|
circle: circleStyle,
|
|
19267
19279
|
...rest
|
|
19268
|
-
} }));
|
|
19280
|
+
}, ...rest }));
|
|
19269
19281
|
}
|
|
19270
19282
|
const Radio = React.forwardRef(RadioComponent);
|
|
19271
19283
|
Radio.displayName = 'Radio';
|
|
@@ -19295,12 +19307,12 @@
|
|
|
19295
19307
|
box: boxStyle,
|
|
19296
19308
|
icon: iconStyle,
|
|
19297
19309
|
...rest
|
|
19298
|
-
} }));
|
|
19310
|
+
}, ...rest }));
|
|
19299
19311
|
}
|
|
19300
19312
|
const Checkbox = React.forwardRef(CheckboxComponent);
|
|
19301
19313
|
Checkbox.displayName = 'Checkbox';
|
|
19302
19314
|
|
|
19303
|
-
const version = "1.7.
|
|
19315
|
+
const version = "1.7.4";
|
|
19304
19316
|
|
|
19305
19317
|
Object.defineProperty(exports, 'register', {
|
|
19306
19318
|
enumerable: true,
|