@visactor/react-vtable 1.25.0 → 1.25.1-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/avatar/avatar.js.map +1 -1
- package/cjs/components/button/button.js +12 -7
- package/cjs/components/button/button.js.map +1 -1
- package/cjs/components/link/link.js +12 -7
- package/cjs/components/link/link.js.map +1 -1
- package/cjs/components/popover/popover.js +6 -3
- package/cjs/components/popover/popover.js.map +1 -1
- package/cjs/containers/withContainer.js +2 -1
- package/cjs/containers/withContainer.js.map +1 -1
- package/cjs/context/table.d.ts +1 -0
- package/cjs/context/table.js +1 -2
- package/cjs/context/table.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/base-component.js +3 -1
- package/cjs/table-components/base-component.js.map +1 -1
- package/cjs/table-components/custom/custom-layout.js +20 -6
- package/cjs/table-components/custom/custom-layout.js.map +1 -1
- package/cjs/table-components/custom/reconciler.d.ts +5 -4
- package/cjs/table-components/custom/reconciler.js +77 -39
- package/cjs/table-components/custom/reconciler.js.map +1 -1
- package/cjs/tables/base-table.js +5 -2
- package/cjs/tables/base-table.js.map +1 -1
- package/dist/react-vtable.js +1664 -1555
- package/dist/react-vtable.min.js +2 -2
- package/es/components/avatar/avatar.js.map +1 -1
- package/es/components/button/button.js +12 -7
- package/es/components/button/button.js.map +1 -1
- package/es/components/link/link.js +12 -7
- package/es/components/link/link.js.map +1 -1
- package/es/components/popover/popover.js +6 -3
- package/es/components/popover/popover.js.map +1 -1
- package/es/containers/withContainer.js +2 -1
- package/es/containers/withContainer.js.map +1 -1
- package/es/context/table.d.ts +1 -0
- package/es/context/table.js +1 -2
- package/es/context/table.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/base-component.js +3 -1
- package/es/table-components/base-component.js.map +1 -1
- package/es/table-components/custom/custom-layout.js +19 -7
- package/es/table-components/custom/custom-layout.js.map +1 -1
- package/es/table-components/custom/reconciler.d.ts +5 -4
- package/es/table-components/custom/reconciler.js +49 -13
- package/es/table-components/custom/reconciler.js.map +1 -1
- package/es/tables/base-table.js +5 -2
- package/es/tables/base-table.js.map +1 -1
- package/package.json +18 -12
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { application, REACT_TO_CANOPUS_EVENTS } from "@visactor/vtable/es/vrender";
|
|
1
|
+
import { application, REACT_TO_CANOPUS_EVENTS, Group, Text } from "@visactor/vtable/es/vrender";
|
|
2
2
|
|
|
3
3
|
import { isFunction, isNumber, merge } from "@visactor/vutils";
|
|
4
4
|
|
|
@@ -6,13 +6,19 @@ import React from "react";
|
|
|
6
6
|
|
|
7
7
|
import ReactReconciler from "react-reconciler";
|
|
8
8
|
|
|
9
|
-
import { DefaultEventPriority } from "react-reconciler/constants.js";
|
|
9
|
+
import { ConcurrentRoot, DefaultEventPriority, LegacyRoot } from "react-reconciler/constants.js";
|
|
10
10
|
|
|
11
11
|
import { createVRenderComponent } from "../../components/vrender-components/component-creater";
|
|
12
12
|
|
|
13
|
+
const rendererPackageName = "react-vtable", rendererVersion = "string" == typeof React.version && React.version.length > 0 ? React.version : "0.0.0";
|
|
14
|
+
|
|
15
|
+
let currentUpdatePriority = DefaultEventPriority;
|
|
16
|
+
|
|
13
17
|
export const reconcilor = ReactReconciler({
|
|
14
18
|
supportsMutation: !0,
|
|
15
19
|
supportsPersistence: !1,
|
|
20
|
+
rendererVersion: rendererVersion,
|
|
21
|
+
rendererPackageName: "react-vtable",
|
|
16
22
|
createInstance: (type, props, instance) => {
|
|
17
23
|
const graphic = createGraphic(type, props);
|
|
18
24
|
if (graphic) return bindEventsToGraphic(graphic, props), graphic;
|
|
@@ -24,16 +30,25 @@ export const reconcilor = ReactReconciler({
|
|
|
24
30
|
finalizeInitialChildren: () => !1,
|
|
25
31
|
prepareUpdate: () => !0,
|
|
26
32
|
shouldSetTextContent: () => !1,
|
|
27
|
-
getRootHostContext: () =>
|
|
28
|
-
getChildHostContext: () =>
|
|
33
|
+
getRootHostContext: () => ({}),
|
|
34
|
+
getChildHostContext: () => ({}),
|
|
29
35
|
getPublicInstance: instance => instance,
|
|
30
36
|
prepareForCommit: () => null,
|
|
31
37
|
resetAfterCommit: () => {},
|
|
32
38
|
preparePortalMount: () => null,
|
|
33
39
|
scheduleTimeout: setTimeout,
|
|
34
40
|
cancelTimeout: clearTimeout,
|
|
41
|
+
supportsMicrotasks: !0,
|
|
42
|
+
scheduleMicrotask: callback => {
|
|
43
|
+
Promise.resolve().then(callback);
|
|
44
|
+
},
|
|
35
45
|
noTimeout: -1,
|
|
36
46
|
isPrimaryRenderer: !1,
|
|
47
|
+
setCurrentUpdatePriority: newPriority => {
|
|
48
|
+
currentUpdatePriority = newPriority;
|
|
49
|
+
},
|
|
50
|
+
getCurrentUpdatePriority: () => currentUpdatePriority,
|
|
51
|
+
resolveUpdatePriority: () => currentUpdatePriority,
|
|
37
52
|
getCurrentEventPriority: () => DefaultEventPriority,
|
|
38
53
|
getInstanceFromNode: node => null,
|
|
39
54
|
beforeActiveInstanceBlur: () => {},
|
|
@@ -42,6 +57,11 @@ export const reconcilor = ReactReconciler({
|
|
|
42
57
|
getInstanceFromScope: () => {},
|
|
43
58
|
detachDeletedInstance: () => {},
|
|
44
59
|
supportsHydration: !1,
|
|
60
|
+
maySuspendCommit: () => !1,
|
|
61
|
+
preloadInstance: () => null,
|
|
62
|
+
startSuspendingCommit: () => null,
|
|
63
|
+
suspendInstance: () => {},
|
|
64
|
+
waitForCommitToBeReady: () => null,
|
|
45
65
|
appendChild: (parentInstance, child) => {
|
|
46
66
|
parentInstance.add(child);
|
|
47
67
|
},
|
|
@@ -60,8 +80,14 @@ export const reconcilor = ReactReconciler({
|
|
|
60
80
|
removeChildFromContainer: (parentInstance, child) => {
|
|
61
81
|
child.delete();
|
|
62
82
|
},
|
|
63
|
-
commitUpdate: (
|
|
64
|
-
|
|
83
|
+
commitUpdate: (...args) => {
|
|
84
|
+
const instance = args[0];
|
|
85
|
+
if ("string" == typeof args[1]) {
|
|
86
|
+
const oldProps = args[2];
|
|
87
|
+
return void updateGraphicProps(instance, args[3], oldProps);
|
|
88
|
+
}
|
|
89
|
+
const oldProps = args[3];
|
|
90
|
+
updateGraphicProps(instance, args[4], oldProps);
|
|
65
91
|
},
|
|
66
92
|
hideInstance: instance => {
|
|
67
93
|
instance.setAttribute("visible", !1);
|
|
@@ -75,9 +101,25 @@ export const reconcilor = ReactReconciler({
|
|
|
75
101
|
commitTextUpdate: (textInstance, oldText, newText) => {}
|
|
76
102
|
});
|
|
77
103
|
|
|
104
|
+
const injectIntoDevTools = reconcilor.injectIntoDevTools;
|
|
105
|
+
|
|
106
|
+
"function" == typeof injectIntoDevTools && (0 === injectIntoDevTools.length ? injectIntoDevTools() : injectIntoDevTools({
|
|
107
|
+
bundleType: 0,
|
|
108
|
+
version: rendererVersion,
|
|
109
|
+
rendererPackageName: "react-vtable"
|
|
110
|
+
}));
|
|
111
|
+
|
|
112
|
+
export const createReconcilerContainer = (container, identifierPrefix = "custom", reportError) => {
|
|
113
|
+
var _a;
|
|
114
|
+
const createContainer = reconcilor.createContainer, noop = () => {}, onUncaughtError = reportError ? error => reportError("uncaught", error) : noop, onCaughtError = reportError ? error => reportError("caught", error) : noop, onRecoverableError = reportError ? error => reportError("recoverable", error) : noop, majorVersion = Number.parseInt(String(null !== (_a = React.version) && void 0 !== _a ? _a : "0").split(".")[0], 10);
|
|
115
|
+
return createContainer(container, Number.isFinite(majorVersion) && majorVersion >= 19 ? ConcurrentRoot : LegacyRoot, null, !1, !1, identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, null);
|
|
116
|
+
};
|
|
117
|
+
|
|
78
118
|
function createGraphic(type, props) {
|
|
79
119
|
const component = createVRenderComponent(type, props);
|
|
80
120
|
if (component) return component;
|
|
121
|
+
if ("group" === type) return new Group(props.attribute ? props.attribute : props);
|
|
122
|
+
if ("text" === type) return new Text(props.attribute ? props.attribute : props);
|
|
81
123
|
if (!application.graphicService.creator[type]) return;
|
|
82
124
|
return application.graphicService.creator[type](props.attribute);
|
|
83
125
|
}
|
|
@@ -101,10 +143,4 @@ function updateGraphicProps(graphic, newProps, oldProps) {
|
|
|
101
143
|
plugin && plugin.tryLayoutChildren(graphic);
|
|
102
144
|
}
|
|
103
145
|
}
|
|
104
|
-
|
|
105
|
-
//# sourceMappingURL=reconciler.js.map
|
|
106
|
-
reconcilor.injectIntoDevTools({
|
|
107
|
-
bundleType: 0,
|
|
108
|
-
version: React.version,
|
|
109
|
-
rendererPackageName: "react-vtable"
|
|
110
|
-
});
|
|
146
|
+
//# sourceMappingURL=reconciler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["table-components/custom/reconciler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,uBAAuB,EAAO,MAAM,6BAA6B,CAAC;AAExF,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,eAAe,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,uDAAuD,CAAC;AAI/F,MAAM,CAAC,MAAM,UAAU,GAAG,eAAe,CAAC;IACxC,gBAAgB,EAAE,IAAI;IACtB,mBAAmB,EAAE,KAAK;IAE1B,cAAc,EAAE,CAAC,IAAY,EAAE,KAAU,EAAE,QAAQ,EAAE,EAAE;QACrD,MAAM,OAAO,GAAG,aAAa,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC3C,IAAI,OAAO,EAAE;YACX,mBAAmB,CAAC,OAAmB,EAAE,KAAK,CAAC,CAAC;SACjD;aAAM;YACL,OAAO,SAAS,CAAC;SAGlB;QACD,OAAO,OAAO,CAA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exLayoutPlugin, Graphic, IGraphic, IGraphicCreator } from '@visactor/vtable/es/vrender';\nimport { isFunction, isNumber, merge } from '@visactor/vutils';\nimport React from 'react';\nimport ReactReconciler from 'react-reconciler';\nimport { DefaultEventPriority } from 'react-reconciler/constants.js';\nimport { createVRenderComponent } from '../../components/vrender-components/component-creater';\n\ntype Instance = Graphic;\n\nexport const reconcilor = ReactReconciler({\n supportsMutation: true,\n supportsPersistence: false,\n\n createInstance: (type: string, props: any, instance) => {\n const graphic = createGraphic(type, props);\n if (graphic) {\n bindEventsToGraphic(graphic as IGraphic, props);\n } else {\n return undefined;\n // createInstance\n // graphic = createGraphic('group', {});\n }\n return graphic;\n },\n\n createTextInstance: (text, instance) => {\n // const textGraphic = createText({ text });\n // return textGraphic;\n // debugger;\n // return document.createTextNode(text);\n return undefined;\n },\n\n appendInitialChild: (parentInstance: Instance, childInstance: Instance) => {\n parentInstance.add(childInstance);\n },\n\n finalizeInitialChildren: () => false,\n\n prepareUpdate: () => true,\n\n shouldSetTextContent: () => false,\n\n getRootHostContext: () => null,\n\n getChildHostContext: () => null,\n\n getPublicInstance: (instance: Instance) => {\n return instance;\n },\n\n prepareForCommit: () => null,\n\n resetAfterCommit: () => undefined,\n\n preparePortalMount: () => null,\n\n // eslint-disable-next-line no-undef\n scheduleTimeout: setTimeout,\n // eslint-disable-next-line no-undef\n cancelTimeout: clearTimeout,\n\n noTimeout: -1,\n isPrimaryRenderer: false,\n\n getCurrentEventPriority: () => DefaultEventPriority,\n\n getInstanceFromNode: node => null,\n\n beforeActiveInstanceBlur: () => undefined,\n\n afterActiveInstanceBlur: () => undefined,\n\n prepareScopeUpdate: () => undefined,\n\n getInstanceFromScope: () => undefined,\n\n detachDeletedInstance: () => undefined,\n\n supportsHydration: false,\n\n appendChild: (parentInstance: Instance, child: Instance) => {\n parentInstance.add(child);\n },\n appendChildToContainer: (container: Instance, child: Instance) => {\n container.add(child);\n },\n\n insertBefore: (parentInstance: Instance, child: Instance, beforeChild: Instance) => {\n parentInstance.insertBefore(child, beforeChild);\n },\n\n insertInContainerBefore: (parentInstance: Instance, child: Instance, beforeChild: Instance) => {\n parentInstance.insertBefore(child, beforeChild);\n },\n\n removeChild: (parentInstance: Instance, child: Instance) => {\n child.delete();\n },\n\n removeChildFromContainer: (parentInstance: Instance, child: Instance) => {\n child.delete();\n },\n\n commitUpdate: (instance, updatePayload, type, oldProps, newProps) => {\n updateGraphicProps(instance, newProps, oldProps);\n },\n\n hideInstance: (instance: Instance) => {\n instance.setAttribute('visible', false);\n },\n\n unhideInstance: (instance, props) => {\n instance.setAttribute('visible', true);\n },\n\n clearContainer: (container: Instance) => {\n container.removeAllChild();\n },\n\n commitTextUpdate: (textInstance: any, oldText: string, newText: string) => {\n // debugger;\n }\n});\n\nreconcilor.injectIntoDevTools({\n // findFiberByHostInstance: () => {},\n // @ts-ignore\n // eslint-disable-next-line no-undef\n bundleType: \"production\" !== 'production' ? 1 : 0,\n version: React.version,\n rendererPackageName: 'react-vtable'\n});\n\nfunction createGraphic(type: string, props: any) {\n const component = createVRenderComponent(type, props);\n if (component) {\n return component;\n }\n if (!application.graphicService.creator[type as keyof IGraphicCreator]) {\n return undefined;\n }\n const graphic = application.graphicService.creator[type as keyof IGraphicCreator]((props as any).attribute);\n return graphic;\n}\n\nfunction isEventProp(key: string, props: any) {\n return key.startsWith('on') && isFunction(props[key]);\n}\n\nfunction bindEventsToGraphic(graphic: IGraphic, props: any) {\n for (const key in props) {\n if (isEventProp(key, props) && REACT_TO_CANOPUS_EVENTS[key as keyof typeof REACT_TO_CANOPUS_EVENTS]) {\n graphic.addEventListener(REACT_TO_CANOPUS_EVENTS[key as keyof typeof REACT_TO_CANOPUS_EVENTS], props[key]);\n }\n }\n}\n\nfunction updateGraphicProps(graphic: IGraphic, newProps: any, oldProps: any) {\n // deal width event update\n for (const propKey in oldProps) {\n if (isEventProp(propKey, oldProps) && oldProps[propKey] !== newProps[propKey]) {\n graphic.removeEventListener(\n REACT_TO_CANOPUS_EVENTS[propKey as keyof typeof REACT_TO_CANOPUS_EVENTS],\n oldProps[propKey]\n );\n }\n }\n for (const propKey in newProps) {\n if (isEventProp(propKey, newProps) && oldProps[propKey] !== newProps[propKey]) {\n graphic.addEventListener(\n REACT_TO_CANOPUS_EVENTS[propKey as keyof typeof REACT_TO_CANOPUS_EVENTS],\n newProps[propKey]\n );\n }\n }\n const attribute = newProps.attribute ?? merge({}, newProps);\n\n // update all attribute\n graphic.initAttributes(attribute);\n if (graphic.type === 'image') {\n graphic.loadImage(attribute.image);\n }\n\n if (\n attribute.display === 'flex' &&\n attribute.width === undefined &&\n attribute.height === undefined &&\n isNumber(oldProps.attribute.width) &&\n isNumber(oldProps.attribute.height)\n ) {\n const plugin = graphic.stage.pluginService.findPluginsByName('FlexLayoutPlugin')[0] as FlexLayoutPlugin;\n if (plugin) {\n plugin.tryLayoutChildren(graphic);\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["table-components/custom/reconciler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,uBAAuB,EAAE,KAAK,EAAO,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAErG,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,eAAe,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AACjG,OAAO,EAAE,sBAAsB,EAAE,MAAM,uDAAuD,CAAC;AAI/F,MAAM,mBAAmB,GAAG,cAAc,CAAC;AAC3C,MAAM,eAAe,GACnB,OAAQ,KAAa,CAAC,OAAO,KAAK,QAAQ,IAAK,KAAa,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAE,KAAa,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;AAWrH,IAAI,qBAA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AQ,CAAC,SAAS,mCAAI,KAAK,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;IAG5D,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;IAClC,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO,EAAE;QAC5B,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;KACpC;IAED,IACE,SAAS,CAAC,OAAO,KAAK,MAAM;QAC5B,SAAS,CAAC,KAAK,KAAK,SAAS;QAC7B,SAAS,CAAC,MAAM,KAAK,SAAS;QAC9B,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC;QAClC,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,EACnC;QACA,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAqB,CAAC;QACxG,IAAI,MAAM,EAAE;YACV,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;SACnC;KACF;AACH,CAAC","file":"reconciler.js","sourcesContent":["import { application, REACT_TO_CANOPUS_EVENTS, Group, Tag, Text } from '@visactor/vtable/es/vrender';\nimport type { FlexLayoutPlugin, Graphic, IGraphic, IGraphicCreator } from '@visactor/vtable/es/vrender';\nimport { isFunction, isNumber, merge } from '@visactor/vutils';\nimport React from 'react';\nimport ReactReconciler from 'react-reconciler';\nimport { ConcurrentRoot, DefaultEventPriority, LegacyRoot } from 'react-reconciler/constants.js';\nimport { createVRenderComponent } from '../../components/vrender-components/component-creater';\n\ndeclare const process: any;\n\nconst rendererPackageName = 'react-vtable';\nconst rendererVersion =\n typeof (React as any).version === 'string' && (React as any).version.length > 0 ? (React as any).version : '0.0.0';\n\n/**\n * react-reconciler 与 React 主版本强绑定:\n * - React18 对应 react-reconciler@0.29.x\n * - React19 对应 react-reconciler@0.31.x\n *\n * 本仓库默认依赖树以 React18 为主;React19 Demo 通过 Vite alias 指向 .react19-deps 的 react-reconciler,\n * 避免因版本不匹配出现运行时报错(例如读取内部字段 undefined)。\n */\ntype Instance = any;\nlet currentUpdatePriority: number = DefaultEventPriority;\n\nexport type ReconcilerErrorType = 'uncaught' | 'caught' | 'recoverable';\nexport type ReconcilerErrorReporter = (type: ReconcilerErrorType, error: unknown) => void;\n\nexport const reconcilor = (ReactReconciler as any)({\n supportsMutation: true,\n supportsPersistence: false,\n rendererVersion,\n rendererPackageName,\n\n createInstance: (type: string, props: any, instance: any): any => {\n const graphic = createGraphic(type, props);\n if (graphic) {\n bindEventsToGraphic(graphic as IGraphic, props);\n } else {\n return undefined;\n // createInstance\n // graphic = createGraphic('group', {});\n }\n return graphic;\n },\n\n createTextInstance: (text: string, instance: any): any => {\n // const textGraphic = createText({ text });\n // return textGraphic;\n // debugger;\n // return document.createTextNode(text);\n return undefined;\n },\n\n appendInitialChild: (parentInstance: Instance, childInstance: Instance) => {\n parentInstance.add(childInstance);\n },\n\n finalizeInitialChildren: () => false,\n\n prepareUpdate: () => true,\n\n shouldSetTextContent: () => false,\n\n getRootHostContext: (): Record<string, never> => ({}),\n\n getChildHostContext: (): Record<string, never> => ({}),\n\n getPublicInstance: (instance: Instance): any => {\n return instance;\n },\n\n prepareForCommit: (): null => null,\n\n resetAfterCommit: (): undefined => undefined,\n\n preparePortalMount: (): null => null,\n\n // eslint-disable-next-line no-undef\n scheduleTimeout: setTimeout,\n // eslint-disable-next-line no-undef\n cancelTimeout: clearTimeout,\n supportsMicrotasks: true,\n scheduleMicrotask: (callback: () => void) => {\n Promise.resolve().then(callback);\n },\n\n noTimeout: -1,\n isPrimaryRenderer: false,\n\n setCurrentUpdatePriority: (newPriority: number): void => {\n currentUpdatePriority = newPriority;\n },\n\n getCurrentUpdatePriority: (): number => {\n return currentUpdatePriority;\n },\n\n resolveUpdatePriority: (): number => {\n return currentUpdatePriority;\n },\n\n getCurrentEventPriority: (): number => DefaultEventPriority,\n\n getInstanceFromNode: (node: any): null => null,\n\n beforeActiveInstanceBlur: (): undefined => undefined,\n\n afterActiveInstanceBlur: (): undefined => undefined,\n\n prepareScopeUpdate: (): undefined => undefined,\n\n getInstanceFromScope: (): undefined => undefined,\n\n detachDeletedInstance: (): undefined => undefined,\n\n supportsHydration: false,\n maySuspendCommit: (): boolean => false,\n preloadInstance: (): null => null,\n startSuspendingCommit: (): null => null,\n suspendInstance: (): undefined => undefined,\n waitForCommitToBeReady: (): null => null,\n\n appendChild: (parentInstance: Instance, child: Instance) => {\n parentInstance.add(child);\n },\n appendChildToContainer: (container: Instance, child: Instance) => {\n container.add(child);\n },\n\n insertBefore: (parentInstance: Instance, child: Instance, beforeChild: Instance) => {\n parentInstance.insertBefore(child, beforeChild);\n },\n\n insertInContainerBefore: (parentInstance: Instance, child: Instance, beforeChild: Instance) => {\n parentInstance.insertBefore(child, beforeChild);\n },\n\n removeChild: (parentInstance: Instance, child: Instance) => {\n child.delete();\n },\n\n removeChildFromContainer: (parentInstance: Instance, child: Instance) => {\n child.delete();\n },\n\n commitUpdate: (...args: any[]): void => {\n const instance = args[0];\n if (typeof args[1] === 'string') {\n const oldProps = args[2];\n const newProps = args[3];\n updateGraphicProps(instance, newProps, oldProps);\n return;\n }\n const oldProps = args[3];\n const newProps = args[4];\n updateGraphicProps(instance, newProps, oldProps);\n },\n\n hideInstance: (instance: Instance) => {\n instance.setAttribute('visible', false);\n },\n\n unhideInstance: (instance: any, props: any): void => {\n instance.setAttribute('visible', true);\n },\n\n clearContainer: (container: Instance) => {\n container.removeAllChild();\n },\n\n commitTextUpdate: (textInstance: any, oldText: string, newText: string) => {\n // debugger;\n }\n});\n\nconst injectIntoDevTools = (reconcilor as any).injectIntoDevTools;\nif (typeof injectIntoDevTools === 'function') {\n if (injectIntoDevTools.length === 0) {\n injectIntoDevTools();\n } else {\n injectIntoDevTools({\n bundleType: \"production\" !== 'production' ? 1 : 0,\n version: rendererVersion,\n rendererPackageName\n });\n }\n}\n\nexport const createReconcilerContainer = (\n container: Instance,\n identifierPrefix = 'custom',\n reportError?: ReconcilerErrorReporter\n) => {\n const createContainer = (reconcilor as any).createContainer;\n const hydrationCallbacks: null = null;\n const isStrictMode = false;\n const concurrentUpdatesByDefaultOverride = false;\n const noop = (): void => undefined;\n // React19 的 createContainer 需要传入 error callbacks;这里不做任何全局 side-effect,\n // 由上层(例如 BaseTable 的 onError)选择是否接收这些错误。\n const onUncaughtError = reportError ? (error: unknown) => reportError('uncaught', error) : noop;\n const onCaughtError = reportError ? (error: unknown) => reportError('caught', error) : noop;\n const onRecoverableError = reportError ? (error: unknown) => reportError('recoverable', error) : noop;\n const transitionCallbacks: null = null;\n\n const majorVersion = Number.parseInt(String((React as any).version ?? '0').split('.')[0], 10);\n const rootTag = Number.isFinite(majorVersion) && majorVersion >= 19 ? ConcurrentRoot : LegacyRoot;\n return createContainer(\n container as any,\n rootTag,\n hydrationCallbacks,\n isStrictMode,\n concurrentUpdatesByDefaultOverride,\n identifierPrefix,\n onUncaughtError,\n onCaughtError,\n onRecoverableError,\n transitionCallbacks\n );\n};\n\nfunction createGraphic(type: string, props: any) {\n const component = createVRenderComponent(type, props);\n if (component) {\n return component;\n }\n if (type === 'group') {\n return new Group(props.attribute ? props.attribute : props);\n }\n if (type === 'text') {\n return new Text(props.attribute ? props.attribute : props);\n }\n if (!application.graphicService.creator[type as keyof IGraphicCreator]) {\n return undefined;\n }\n const graphic = application.graphicService.creator[type as keyof IGraphicCreator]((props as any).attribute);\n return graphic;\n}\n\nfunction isEventProp(key: string, props: any) {\n return key.startsWith('on') && isFunction(props[key]);\n}\n\nfunction bindEventsToGraphic(graphic: IGraphic, props: any) {\n for (const key in props) {\n if (isEventProp(key, props) && REACT_TO_CANOPUS_EVENTS[key as keyof typeof REACT_TO_CANOPUS_EVENTS]) {\n graphic.addEventListener(REACT_TO_CANOPUS_EVENTS[key as keyof typeof REACT_TO_CANOPUS_EVENTS], props[key]);\n }\n }\n}\n\nfunction updateGraphicProps(graphic: IGraphic, newProps: any, oldProps: any) {\n // deal width event update\n for (const propKey in oldProps) {\n if (isEventProp(propKey, oldProps) && oldProps[propKey] !== newProps[propKey]) {\n graphic.removeEventListener(\n REACT_TO_CANOPUS_EVENTS[propKey as keyof typeof REACT_TO_CANOPUS_EVENTS],\n oldProps[propKey]\n );\n }\n }\n for (const propKey in newProps) {\n if (isEventProp(propKey, newProps) && oldProps[propKey] !== newProps[propKey]) {\n graphic.addEventListener(\n REACT_TO_CANOPUS_EVENTS[propKey as keyof typeof REACT_TO_CANOPUS_EVENTS],\n newProps[propKey]\n );\n }\n }\n const attribute = newProps.attribute ?? merge({}, newProps);\n\n // update all attribute\n graphic.initAttributes(attribute);\n if (graphic.type === 'image') {\n graphic.loadImage(attribute.image);\n }\n\n if (\n attribute.display === 'flex' &&\n attribute.width === undefined &&\n attribute.height === undefined &&\n isNumber(oldProps.attribute.width) &&\n isNumber(oldProps.attribute.height)\n ) {\n const plugin = graphic.stage.pluginService.findPluginsByName('FlexLayoutPlugin')[0] as FlexLayoutPlugin;\n if (plugin) {\n plugin.tryLayoutChildren(graphic);\n }\n }\n}\n"]}
|
package/es/tables/base-table.js
CHANGED
|
@@ -38,7 +38,9 @@ const notOptionKeys = [ ...REACT_PRIVATE_PROPS, ...TABLE_EVENTS_KEYS, "skipFunct
|
|
|
38
38
|
var _a;
|
|
39
39
|
return null === (_a = tableContext.current) || void 0 === _a ? void 0 : _a.table;
|
|
40
40
|
}));
|
|
41
|
-
const hasOption = !!props.option, hasRecords = !!props.records, isUnmount = useRef(!1), prevOption = useRef(pickWithout(props, notOptionKeys)), optionFromChildren = useRef(null), prevRecords = useRef(props.records), eventsBinded = React.useRef(null), skipFunctionDiff = !!props.skipFunctionDiff, keepColumnWidthChange = !!props.keepColumnWidthChange, columnWidths = useRef(new Map), pivotColumnWidths = useRef([]), pivotHeaderColumnWidths = useRef([])
|
|
41
|
+
const hasOption = !!props.option, hasRecords = !!props.records, isUnmount = useRef(!1), prevOption = useRef(pickWithout(props, notOptionKeys)), optionFromChildren = useRef(null), prevRecords = useRef(props.records), eventsBinded = React.useRef(null), skipFunctionDiff = !!props.skipFunctionDiff, keepColumnWidthChange = !!props.keepColumnWidthChange, columnWidths = useRef(new Map), pivotColumnWidths = useRef([]), pivotHeaderColumnWidths = useRef([]);
|
|
42
|
+
tableContext.current && (tableContext.current.onError = props.onError);
|
|
43
|
+
const parseOption = useCallback((props => hasOption && props.option ? hasRecords && props.records ? Object.assign(Object.assign({}, props.option), {
|
|
42
44
|
clearDOM: !1,
|
|
43
45
|
records: props.records
|
|
44
46
|
}) : Object.assign(Object.assign({}, props.option), {
|
|
@@ -55,7 +57,8 @@ const notOptionKeys = [ ...REACT_PRIVATE_PROPS, ...TABLE_EVENTS_KEYS, "skipFunct
|
|
|
55
57
|
const vtable = new props.vtableConstrouctor(props.container, parseOption(props));
|
|
56
58
|
vtable.scenegraph.stage.reactAttribute = props.ReactDOM, vtable.scenegraph.stage.pluginService.register(null !== (_a = props.reactAttributePlugin) && void 0 !== _a ? _a : new VTableReactAttributePlugin),
|
|
57
59
|
vtable.scenegraph.stage.params.ReactDOM = props.ReactDOM, tableContext.current = Object.assign(Object.assign({}, tableContext.current), {
|
|
58
|
-
table: vtable
|
|
60
|
+
table: vtable,
|
|
61
|
+
onError: props.onError
|
|
59
62
|
}), isUnmount.current = !1, columnWidths.current.clear(), pivotColumnWidths.current = [],
|
|
60
63
|
pivotHeaderColumnWidths.current = [], vtable.on("resize_column_end", (args => {
|
|
61
64
|
const table = tableContext.current.table;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["tables/base-table.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAE7F,OAAO,aAAa,MAAM,6BAA6B,CAAC;AAExD,OAAO,gBAAgB,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,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,MAAM,WAAW,GAAG,CACzB,aAAqB,EACrB,YAAyB,EACzB,QAA0B,EAC1B,EAAE;IACF,MAAM,GAAG,GAAG,aAAa,CAAoB,SAAgB,EAAE,aAAa,EAAE,CAAC,KAAQ,EAAE,EAAE;QAGzF,IAAI,YAAY,EAAE;YAChB,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;SAC3C;QASD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;IACH,GAAG,CAAC,WAAW,GAAG,aAAa,CAAC;IAChC,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;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
|
+
{"version":3,"sources":["tables/base-table.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAE7F,OAAO,aAAa,MAAM,6BAA6B,CAAC;AAExD,OAAO,gBAAgB,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAY,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAanD,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACpF,OAAO,EAAE,0BAA0B,EAAE,MAAM,0DAA0D,CAAC;AACtG,OAAO,EAAE,cAAc,EAAE,MAAM,4DAA4D,CAAC;AAC5F,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AA0CtE,IAAI,YAAY,EAAE,EAAE;IAClB,SAAS,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C,CAAC,CAAC;IACH,GAAG,CAAC,WAAW,GAAG,aAAa,CAAC;IAChC,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;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 if (tableContext.current) {\n tableContext.current.onError = props.onError;\n }\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, onError: props.onError };\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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visactor/react-vtable",
|
|
3
|
-
"version": "1.25.0",
|
|
3
|
+
"version": "1.25.1-alpha.0",
|
|
4
4
|
"description": "The react version of VTable",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -42,21 +42,25 @@
|
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"react": "^18.2.0 || ^19.0.0",
|
|
47
|
+
"react-dom": "^18.2.0 || ^19.0.0"
|
|
48
|
+
},
|
|
45
49
|
"dependencies": {
|
|
50
|
+
"@visactor/vtable": "1.25.1-alpha.0",
|
|
46
51
|
"@visactor/vutils": "~1.0.17",
|
|
47
52
|
"react-is": "^18.2.0",
|
|
48
|
-
"react-reconciler": "0.29.
|
|
49
|
-
"@visactor/vtable": "1.25.0"
|
|
53
|
+
"react-reconciler": "0.29.0"
|
|
50
54
|
},
|
|
51
55
|
"devDependencies": {
|
|
52
56
|
"cross-env": "^7.0.3",
|
|
53
57
|
"increase-memory-limit": "^1.0.7",
|
|
54
58
|
"@visactor/vchart": "2.0.13-alpha.10",
|
|
55
59
|
"@rushstack/eslint-patch": "~1.1.4",
|
|
56
|
-
"react": "
|
|
57
|
-
"react-dom": "
|
|
58
|
-
"@types/react": "
|
|
59
|
-
"@types/react-dom": "
|
|
60
|
+
"react": "18.2.0",
|
|
61
|
+
"react-dom": "18.2.0",
|
|
62
|
+
"@types/react": "18.2.79",
|
|
63
|
+
"@types/react-dom": "18.2.25",
|
|
60
64
|
"@vitejs/plugin-react": "3.1.0",
|
|
61
65
|
"eslint": "~8.18.0",
|
|
62
66
|
"vite": "3.2.6",
|
|
@@ -91,14 +95,16 @@
|
|
|
91
95
|
"form-data": "~4.0.0",
|
|
92
96
|
"axios": "^1.4.0",
|
|
93
97
|
"@types/react-is": "^17.0.3",
|
|
94
|
-
"@arco-design/web-react": "2.
|
|
95
|
-
"@types/react-reconciler": "0.28.
|
|
98
|
+
"@arco-design/web-react": "2.66.12",
|
|
99
|
+
"@types/react-reconciler": "0.28.9",
|
|
100
|
+
"@internal/ts-config": "0.0.1",
|
|
96
101
|
"@internal/bundler": "0.0.1",
|
|
97
|
-
"@internal/eslint-config": "0.0.1"
|
|
98
|
-
"@internal/ts-config": "0.0.1"
|
|
102
|
+
"@internal/eslint-config": "0.0.1"
|
|
99
103
|
},
|
|
100
104
|
"scripts": {
|
|
101
|
-
"start": "vite ./demo",
|
|
105
|
+
"start": "vite ./demo --port 3100",
|
|
106
|
+
"setup:react19-deps": "node ./demo/scripts/ensure-react19-deps.cjs",
|
|
107
|
+
"start:react19": "npm run setup:react19-deps && vite --config ./demo/vite.config.react19.ts ./demo",
|
|
102
108
|
"build": "npm run fix-memory-limit && bundle --clean",
|
|
103
109
|
"compile": "tsc --noEmit",
|
|
104
110
|
"eslint": "eslint --debug --fix src/",
|