@visactor/react-vtable 1.22.3-alpha.0 → 1.22.4-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/components/tag/tag.js +1 -2
- package/cjs/components/vrender-components/checkbox.js +2 -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.js +2 -2
- package/cjs/table-components/custom/vtable-react-attribute-plugin.js.map +1 -1
- package/dist/react-vtable.js +2 -2
- package/dist/react-vtable.min.js +2 -2
- package/es/components/tag/tag.js +1 -2
- package/es/components/vrender-components/checkbox.js +2 -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.js +3 -1
- package/es/table-components/custom/vtable-react-attribute-plugin.js.map +1 -1
- package/package.json +2 -2
|
@@ -44,5 +44,4 @@ function TagComponent(baseProps, ref) {
|
|
|
44
44
|
}, rest));
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
exports.Tag = react_1.default.forwardRef(TagComponent), exports.Tag.displayName = "Tag";
|
|
48
|
-
//# sourceMappingURL=tag.js.map
|
|
47
|
+
exports.Tag = react_1.default.forwardRef(TagComponent), exports.Tag.displayName = "Tag";
|
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.22.
|
|
21
|
+
__exportStar(require("./components"), exports), exports.version = "1.22.4-alpha.0";
|
|
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.
|
|
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.4-alpha.0\";\n"]}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: !0
|
|
5
5
|
}), exports.VTableReactAttributePlugin = void 0;
|
|
6
6
|
|
|
7
|
-
const vrender_1 = require("@visactor/vtable/es/vrender"), vutils_1 = require("@visactor/vutils");
|
|
7
|
+
const vrender_1 = require("@visactor/vtable/es/vrender"), vutils_1 = require("@visactor/vutils"), vtable_1 = require("@visactor/vtable");
|
|
8
8
|
|
|
9
9
|
class VTableReactAttributePlugin extends vrender_1.ReactAttributePlugin {
|
|
10
10
|
removeElement(id) {
|
|
@@ -125,7 +125,7 @@ function checkFrozenContainer(graphic) {
|
|
|
125
125
|
|
|
126
126
|
function getTargetGroup(target) {
|
|
127
127
|
for (;target && target.parent; ) {
|
|
128
|
-
if (
|
|
128
|
+
if (target.name === vtable_1.CUSTOM_CONTAINER_NAME) return target;
|
|
129
129
|
target = target.parent;
|
|
130
130
|
}
|
|
131
131
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["table-components/custom/vtable-react-attribute-plugin.ts"],"names":[],"mappings":";;;AASA,yDAAkG;AAClG,6CAAuH;AAGvH,MAAa,0BAA2B,SAAQ,8BAAoB;IAalE,aAAa,CAAC,EA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IAAI,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,mBAAmB,EAAE;QACtG,SAAS,GAAG,KAAK,CAAC,6BAA6B,CAAC;KACjD;IAGD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,cAAc,CAAC,MAAW;IACjC,OAAO,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE;QAC9B,IAAI,MAAM,CAAC,IAAI,KAAK,kBAAkB,EAAE;YACtC,OAAO,MAAM,CAAC;SACf;QACD,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;KACxB;IACD,OAAO,IAAI,CAAC;AACd,CAAC","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 declare htmlMap: Record<\n string,\n {\n root?: any;\n unmount?: () => void;\n wrapContainer: HTMLElement;\n nativeContainer: HTMLElement;\n container: string | HTMLElement | null;\n renderId: number;\n graphic: IGraphic;\n }\n >;\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 } = react;\n let { container } = react;\n // deal with frozen container\n if (container) {\n container = checkFrozenContainer(graphic);\n }\n\n if (!(element && ReactDOM && (ReactDOM.createRoot || ReactDOM.render))) {\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 if (!this.htmlMap) {\n this.htmlMap = {};\n }\n\n if (ReactDOM.createRoot) {\n const root = ReactDOM.createRoot(wrapContainer);\n root.render(element);\n this.htmlMap[id] = { root, wrapContainer, nativeContainer, container, renderId: this.renderId, graphic };\n } else {\n ReactDOM.render(element, wrapContainer);\n\n this.htmlMap[id] = {\n wrapContainer,\n nativeContainer,\n container,\n renderId: this.renderId,\n unmount: () => {\n ReactDOM.unmountComponentAtNode(wrapContainer);\n },\n graphic\n };\n }\n }\n } else {\n // update react element\n if (ReactDOM.createRoot) {\n this.htmlMap[id].root.render(element);\n } else {\n ReactDOM.render(element, this.htmlMap[id].wrapContainer);\n }\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, penetrateEventList = [] } = 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 if (calculateStyle.pointerEvents !== 'none') {\n // 删除所有的事件\n this.removeWrapContainerEventListener(wrapContainer);\n // 监听所有的事件\n penetrateEventList.forEach(event => {\n if (event === 'wheel') {\n wrapContainer.addEventListener('wheel', this.onWheel);\n\n // hack for preventing drag touch cause page jump\n wrapContainer.addEventListener(\n 'wheel',\n e => {\n e.preventDefault();\n },\n true\n );\n }\n });\n }\n\n // 定位wrapGroup\n if (!wrapContainer.style.position) {\n wrapContainer.style.position = 'absolute';\n // nativeContainer.style.position = 'relative'; // 'relative' will cause the problem of container position\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.height,\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\nfunction checkFrozenContainer(graphic: IGraphic) {\n const targetGroup = getTargetGroup(graphic);\n if (!targetGroup) {\n return null;\n }\n const { col, row, stage } = targetGroup;\n let { container } = graphic.attribute.react;\n const { table } = stage as any;\n // deal with react dom container\n if (\n container === table.bodyDomContainer &&\n col < table.frozenColCount &&\n row >= table.rowCount - table.bottomFrozenRowCount\n ) {\n container = table.bottomFrozenBodyDomContainer;\n } else if (\n container === table.bodyDomContainer &&\n col >= table.colCount - table.rightFrozenColCount &&\n row >= table.rowCount - table.bottomFrozenRowCount\n ) {\n container = table.rightFrozenBottomDomContainer;\n } else if (container === table.bodyDomContainer && row >= table.rowCount - table.bottomFrozenRowCount) {\n container = table.bottomFrozenBodyDomContainer;\n } else if (container === table.bodyDomContainer && col < table.frozenColCount) {\n container = table.frozenBodyDomContainer;\n } else if (container === table.bodyDomContainer && col >= table.colCount - table.rightFrozenColCount) {\n container = table.rightFrozenBodyDomContainer;\n } else if (container === table.headerDomContainer && col < table.frozenColCount) {\n container = table.frozenHeaderDomContainer;\n } else if (container === table.headerDomContainer && col >= table.colCount - table.rightFrozenColCount) {\n container = table.rightFrozenHeaderDomContainer;\n }\n\n // graphic.attribute.react.container = container;\n return container;\n}\n\nfunction getTargetGroup(target: any) {\n while (target && target.parent) {\n if (target.name === 'custom-container') {\n return target;\n }\n target = target.parent;\n }\n return null;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["table-components/custom/vtable-react-attribute-plugin.ts"],"names":[],"mappings":";;;AASA,yDAAkG;AAClG,6CAAuH;AAEvH,6CAAyD;AAEzD,MAAa,0BAA2B,SAAQ,8BAAoB;IAalE,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,GAAG,KAAK,CAAC;QAC1B,IAAI,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;QAE1B,IAAI,SAAS,EAAE;YACb,SAAS,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;SAC3C;QAED,IAAI,CAAC,CAAC,OAAO,IAAI,QAAQ,IAAI,CAAC,QAAQ,CAAC,UAAU,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE;YACtE,OAAO;SACR;QACD,MAAM,EAAE,GAAG,IAAA,cAAK,EAAC,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,I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AI,GAAG,IAAI,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,mBAAmB,EAAE;QACpG,SAAS,GAAG,KAAK,CAAC,2BAA2B,CAAC;KAC/C;SAAM,IAAI,SAAS,KAAK,KAAK,CAAC,kBAAkB,IAAI,GAAG,GAAG,KAAK,CAAC,cAAc,EAAE;QAC/E,SAAS,GAAG,KAAK,CAAC,wBAAwB,CAAC;KAC5C;SAAM,IAAI,SAAS,KAAK,KAAK,CAAC,kBAAkB,IAAI,GAAG,IAAI,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC,mBAAmB,EAAE;QACtG,SAAS,GAAG,KAAK,CAAC,6BAA6B,CAAC;KACjD;IAGD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,cAAc,CAAC,MAAW;IACjC,OAAO,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE;QAC9B,IAAI,MAAM,CAAC,IAAI,KAAK,8BAAqB,EAAE;YACzC,OAAO,MAAM,CAAC;SACf;QACD,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;KACxB;IACD,OAAO,IAAI,CAAC;AACd,CAAC","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';\nimport { CUSTOM_CONTAINER_NAME } from '@visactor/vtable';\n\nexport class VTableReactAttributePlugin extends ReactAttributePlugin {\n declare htmlMap: Record<\n string,\n {\n root?: any;\n unmount?: () => void;\n wrapContainer: HTMLElement;\n nativeContainer: HTMLElement;\n container: string | HTMLElement | null;\n renderId: number;\n graphic: IGraphic;\n }\n >;\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 } = react;\n let { container } = react;\n // deal with frozen container\n if (container) {\n container = checkFrozenContainer(graphic);\n }\n\n if (!(element && ReactDOM && (ReactDOM.createRoot || ReactDOM.render))) {\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 if (!this.htmlMap) {\n this.htmlMap = {};\n }\n\n if (ReactDOM.createRoot) {\n const root = ReactDOM.createRoot(wrapContainer);\n root.render(element);\n this.htmlMap[id] = { root, wrapContainer, nativeContainer, container, renderId: this.renderId, graphic };\n } else {\n ReactDOM.render(element, wrapContainer);\n\n this.htmlMap[id] = {\n wrapContainer,\n nativeContainer,\n container,\n renderId: this.renderId,\n unmount: () => {\n ReactDOM.unmountComponentAtNode(wrapContainer);\n },\n graphic\n };\n }\n }\n } else {\n // update react element\n if (ReactDOM.createRoot) {\n this.htmlMap[id].root.render(element);\n } else {\n ReactDOM.render(element, this.htmlMap[id].wrapContainer);\n }\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, penetrateEventList = [] } = 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 if (calculateStyle.pointerEvents !== 'none') {\n // 删除所有的事件\n this.removeWrapContainerEventListener(wrapContainer);\n // 监听所有的事件\n penetrateEventList.forEach(event => {\n if (event === 'wheel') {\n wrapContainer.addEventListener('wheel', this.onWheel);\n\n // hack for preventing drag touch cause page jump\n wrapContainer.addEventListener(\n 'wheel',\n e => {\n e.preventDefault();\n },\n true\n );\n }\n });\n }\n\n // 定位wrapGroup\n if (!wrapContainer.style.position) {\n wrapContainer.style.position = 'absolute';\n // nativeContainer.style.position = 'relative'; // 'relative' will cause the problem of container position\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.height,\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\nfunction checkFrozenContainer(graphic: IGraphic) {\n const targetGroup = getTargetGroup(graphic);\n if (!targetGroup) {\n return null;\n }\n const { col, row, stage } = targetGroup;\n let { container } = graphic.attribute.react;\n const { table } = stage as any;\n // deal with react dom container\n if (\n container === table.bodyDomContainer &&\n col < table.frozenColCount &&\n row >= table.rowCount - table.bottomFrozenRowCount\n ) {\n container = table.bottomFrozenBodyDomContainer;\n } else if (\n container === table.bodyDomContainer &&\n col >= table.colCount - table.rightFrozenColCount &&\n row >= table.rowCount - table.bottomFrozenRowCount\n ) {\n container = table.rightFrozenBottomDomContainer;\n } else if (container === table.bodyDomContainer && row >= table.rowCount - table.bottomFrozenRowCount) {\n container = table.bottomFrozenBodyDomContainer;\n } else if (container === table.bodyDomContainer && col < table.frozenColCount) {\n container = table.frozenBodyDomContainer;\n } else if (container === table.bodyDomContainer && col >= table.colCount - table.rightFrozenColCount) {\n container = table.rightFrozenBodyDomContainer;\n } else if (container === table.headerDomContainer && col < table.frozenColCount) {\n container = table.frozenHeaderDomContainer;\n } else if (container === table.headerDomContainer && col >= table.colCount - table.rightFrozenColCount) {\n container = table.rightFrozenHeaderDomContainer;\n }\n\n // graphic.attribute.react.container = container;\n return container;\n}\n\nfunction getTargetGroup(target: any) {\n while (target && target.parent) {\n if (target.name === CUSTOM_CONTAINER_NAME) {\n return target;\n }\n target = target.parent;\n }\n return null;\n}\n"]}
|
package/dist/react-vtable.js
CHANGED
|
@@ -12891,7 +12891,7 @@
|
|
|
12891
12891
|
}
|
|
12892
12892
|
function getTargetGroup(target) {
|
|
12893
12893
|
while (target && target.parent) {
|
|
12894
|
-
if (target.name ===
|
|
12894
|
+
if (target.name === vtable.CUSTOM_CONTAINER_NAME) {
|
|
12895
12895
|
return target;
|
|
12896
12896
|
}
|
|
12897
12897
|
target = target.parent;
|
|
@@ -19816,7 +19816,7 @@
|
|
|
19816
19816
|
const Checkbox = React.forwardRef(CheckboxComponent);
|
|
19817
19817
|
Checkbox.displayName = 'Checkbox';
|
|
19818
19818
|
|
|
19819
|
-
const version = "1.22.
|
|
19819
|
+
const version = "1.22.4-alpha.0";
|
|
19820
19820
|
|
|
19821
19821
|
Object.defineProperty(exports, 'register', {
|
|
19822
19822
|
enumerable: true,
|