@visactor/react-vtable 1.6.0-alpha.5 → 1.6.1
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.d.ts +15 -0
- package/cjs/components/avatar/avatar.js +84 -0
- package/cjs/components/avatar/avatar.js.map +1 -0
- package/cjs/components/button/button.d.ts +27 -0
- package/cjs/components/button/button.js +107 -0
- package/cjs/components/button/button.js.map +1 -0
- package/cjs/components/checkbox/checkbox.d.ts +17 -0
- package/cjs/components/checkbox/checkbox.js +69 -0
- package/cjs/components/checkbox/checkbox.js.map +1 -0
- package/cjs/components/index.d.ts +7 -19
- package/cjs/components/index.js +4 -101
- package/cjs/components/index.js.map +1 -1
- package/cjs/components/link/link.d.ts +30 -0
- package/cjs/components/link/link.js +119 -0
- package/cjs/components/link/link.js.map +1 -0
- package/cjs/components/popover/popover.d.ts +13 -0
- package/cjs/components/popover/popover.js +281 -0
- package/cjs/components/popover/popover.js.map +1 -0
- package/cjs/components/radio/radio.d.ts +15 -0
- package/cjs/components/radio/radio.js +64 -0
- package/cjs/components/radio/radio.js.map +1 -0
- package/cjs/components/tag/tag.d.ts +13 -0
- package/cjs/components/tag/tag.js +47 -0
- package/cjs/components/tag/tag.js.map +1 -0
- package/cjs/components/vrender-components/checkbox.d.ts +4 -0
- package/cjs/components/vrender-components/checkbox.js +6 -0
- package/cjs/components/vrender-components/checkbox.js.map +1 -0
- package/cjs/components/vrender-components/component-creater.d.ts +2 -0
- package/cjs/components/vrender-components/component-creater.js +22 -0
- package/cjs/components/vrender-components/component-creater.js.map +1 -0
- package/cjs/components/vrender-components/radio.d.ts +4 -0
- package/cjs/components/vrender-components/radio.js +6 -0
- package/cjs/components/vrender-components/radio.js.map +1 -0
- package/cjs/components/vrender-components/tag.d.ts +4 -0
- package/cjs/components/vrender-components/tag.js +6 -0
- package/cjs/components/vrender-components/tag.js.map +1 -0
- package/cjs/components/vrender-components/type.d.ts +6 -0
- package/cjs/components/vrender-components/type.js +6 -0
- package/cjs/components/vrender-components/type.js.map +1 -0
- package/cjs/constants.js +2 -1
- package/cjs/containers/withContainer.js +1 -2
- package/cjs/eventsUtils.d.ts +1 -1
- package/cjs/eventsUtils.js +1 -1
- package/cjs/eventsUtils.js.map +1 -1
- package/cjs/index.d.ts +2 -2
- package/cjs/index.js +2 -2
- package/cjs/index.js.map +1 -1
- package/cjs/{components → table-components}/base-component.js +1 -0
- package/cjs/table-components/base-component.js.map +1 -0
- package/cjs/table-components/component/emptyTip.js.map +1 -0
- package/cjs/table-components/component/menu.js.map +1 -0
- package/cjs/table-components/component/title.d.ts +4 -0
- package/cjs/table-components/component/title.js +10 -0
- package/cjs/table-components/component/title.js.map +1 -0
- package/cjs/table-components/component/tooltip.js.map +1 -0
- package/cjs/{components → table-components}/custom/custom-layout.d.ts +1 -1
- package/cjs/{components → table-components}/custom/custom-layout.js +2 -6
- package/cjs/table-components/custom/custom-layout.js.map +1 -0
- package/{es/components → cjs/table-components}/custom/graphic.d.ts +1 -14
- package/cjs/table-components/custom/graphic.js.map +1 -0
- package/cjs/table-components/custom/reconciler.d.ts +5 -0
- package/cjs/{components → table-components}/custom/reconciler.js +12 -10
- package/cjs/table-components/custom/reconciler.js.map +1 -0
- package/cjs/table-components/custom/vtable-browser-env-contribution.d.ts +7 -0
- package/cjs/{components → table-components}/custom/vtable-browser-env-contribution.js +4 -4
- package/cjs/table-components/custom/vtable-browser-env-contribution.js.map +1 -0
- package/{es/components → cjs/table-components}/custom/vtable-react-attribute-plugin.d.ts +2 -8
- package/cjs/{components → table-components}/custom/vtable-react-attribute-plugin.js +6 -6
- package/cjs/table-components/custom/vtable-react-attribute-plugin.js.map +1 -0
- package/cjs/table-components/custom-component.js.map +1 -0
- package/cjs/table-components/index.d.ts +19 -0
- package/cjs/table-components/index.js +130 -0
- package/cjs/table-components/index.js.map +1 -0
- package/cjs/table-components/list/list-column.js.map +1 -0
- package/cjs/table-components/pivot/pivot-corner.js.map +1 -0
- package/cjs/table-components/pivot/pivot-dimension.js.map +1 -0
- package/cjs/table-components/pivot/pivot-header-title.js.map +1 -0
- package/cjs/table-components/pivot/pivot-indicator.js.map +1 -0
- package/cjs/tables/base-table.d.ts +5 -4
- package/cjs/tables/base-table.js +6 -10
- package/cjs/tables/base-table.js.map +1 -1
- package/cjs/tables/index.d.ts +2 -0
- package/cjs/tables/index.js +19 -1
- package/cjs/tables/index.js.map +1 -1
- package/cjs/tables/list-table-simple.d.ts +8 -0
- package/cjs/tables/list-table-simple.js +13 -0
- package/cjs/tables/list-table-simple.js.map +1 -0
- package/cjs/tables/list-table.d.ts +1 -1
- package/cjs/tables/list-table.js +5 -2
- package/cjs/tables/list-table.js.map +1 -1
- package/cjs/tables/pivot-chart.d.ts +5 -1
- package/cjs/tables/pivot-chart.js +6 -29
- package/cjs/tables/pivot-chart.js.map +1 -1
- package/cjs/tables/pivot-table-simple.d.ts +8 -0
- package/cjs/tables/pivot-table-simple.js +13 -0
- package/cjs/tables/pivot-table-simple.js.map +1 -0
- package/cjs/tables/pivot-table.d.ts +1 -1
- package/cjs/tables/pivot-table.js +5 -2
- package/cjs/tables/pivot-table.js.map +1 -1
- package/cjs/util.js +1 -2
- package/cjs/vtable.d.ts +1 -2
- package/cjs/vtable.js +0 -33
- package/cjs/vtable.js.map +1 -1
- package/es/components/avatar/avatar.d.ts +15 -0
- package/es/components/avatar/avatar.js +82 -0
- package/es/components/avatar/avatar.js.map +1 -0
- package/es/components/button/button.d.ts +27 -0
- package/es/components/button/button.js +84 -0
- package/es/components/button/button.js.map +1 -0
- package/es/components/checkbox/checkbox.d.ts +17 -0
- package/es/components/checkbox/checkbox.js +48 -0
- package/es/components/checkbox/checkbox.js.map +1 -0
- package/es/components/index.d.ts +7 -19
- package/es/components/index.js +7 -17
- package/es/components/index.js.map +1 -1
- package/es/components/link/link.d.ts +30 -0
- package/es/components/link/link.js +96 -0
- package/es/components/link/link.js.map +1 -0
- package/es/components/popover/popover.d.ts +13 -0
- package/es/components/popover/popover.js +258 -0
- package/es/components/popover/popover.js.map +1 -0
- package/es/components/radio/radio.d.ts +15 -0
- package/es/components/radio/radio.js +43 -0
- package/es/components/radio/radio.js.map +1 -0
- package/es/components/tag/tag.d.ts +13 -0
- package/es/components/tag/tag.js +45 -0
- package/es/components/tag/tag.js.map +1 -0
- package/es/components/vrender-components/checkbox.d.ts +4 -0
- package/es/components/vrender-components/checkbox.js +2 -0
- package/es/components/vrender-components/checkbox.js.map +1 -0
- package/es/components/vrender-components/component-creater.d.ts +2 -0
- package/es/components/vrender-components/component-creater.js +14 -0
- package/es/components/vrender-components/component-creater.js.map +1 -0
- package/es/components/vrender-components/radio.d.ts +4 -0
- package/es/components/vrender-components/radio.js +2 -0
- package/es/components/vrender-components/radio.js.map +1 -0
- package/es/components/vrender-components/tag.d.ts +4 -0
- package/es/components/vrender-components/tag.js +2 -0
- package/es/components/vrender-components/tag.js.map +1 -0
- package/es/components/vrender-components/type.d.ts +6 -0
- package/es/components/vrender-components/type.js +2 -0
- package/es/components/vrender-components/type.js.map +1 -0
- package/es/constants.js +2 -1
- package/es/containers/withContainer.js +1 -2
- package/es/eventsUtils.d.ts +1 -1
- package/es/eventsUtils.js +2 -2
- package/es/eventsUtils.js.map +1 -1
- package/es/index.d.ts +2 -2
- package/es/index.js +3 -3
- package/es/index.js.map +1 -1
- package/es/{components → table-components}/base-component.js +2 -1
- package/es/table-components/base-component.js.map +1 -0
- package/es/table-components/component/emptyTip.js.map +1 -0
- package/es/table-components/component/menu.js.map +1 -0
- package/es/table-components/component/title.d.ts +4 -0
- package/es/table-components/component/title.js +4 -0
- package/es/table-components/component/title.js.map +1 -0
- package/es/table-components/component/tooltip.js.map +1 -0
- package/es/{components → table-components}/custom/custom-layout.d.ts +1 -1
- package/es/{components → table-components}/custom/custom-layout.js +1 -7
- package/es/table-components/custom/custom-layout.js.map +1 -0
- package/{cjs/components → es/table-components}/custom/graphic.d.ts +1 -14
- package/es/table-components/custom/graphic.js.map +1 -0
- package/es/table-components/custom/reconciler.d.ts +5 -0
- package/es/{components → table-components}/custom/reconciler.js +9 -8
- package/es/table-components/custom/reconciler.js.map +1 -0
- package/es/table-components/custom/vtable-browser-env-contribution.d.ts +7 -0
- package/es/{components → table-components}/custom/vtable-browser-env-contribution.js +3 -3
- package/es/table-components/custom/vtable-browser-env-contribution.js.map +1 -0
- package/{cjs/components → es/table-components}/custom/vtable-react-attribute-plugin.d.ts +2 -8
- package/es/{components → table-components}/custom/vtable-react-attribute-plugin.js +1 -3
- package/es/table-components/custom/vtable-react-attribute-plugin.js.map +1 -0
- package/es/table-components/custom-component.js.map +1 -0
- package/es/table-components/index.d.ts +19 -0
- package/es/table-components/index.js +24 -0
- package/es/table-components/index.js.map +1 -0
- package/es/table-components/list/list-column.js.map +1 -0
- package/es/table-components/pivot/pivot-corner.js.map +1 -0
- package/es/table-components/pivot/pivot-dimension.js.map +1 -0
- package/es/table-components/pivot/pivot-header-title.js.map +1 -0
- package/es/table-components/pivot/pivot-indicator.js.map +1 -0
- package/es/tables/base-table.d.ts +5 -4
- package/es/tables/base-table.js +7 -13
- package/es/tables/base-table.js.map +1 -1
- package/es/tables/index.d.ts +2 -0
- package/es/tables/index.js +4 -0
- package/es/tables/index.js.map +1 -1
- package/es/tables/list-table-simple.d.ts +8 -0
- package/es/tables/list-table-simple.js +9 -0
- package/es/tables/list-table-simple.js.map +1 -0
- package/es/tables/list-table.d.ts +1 -1
- package/es/tables/list-table.js +6 -1
- package/es/tables/list-table.js.map +1 -1
- package/es/tables/pivot-chart.d.ts +5 -1
- package/es/tables/pivot-chart.js +8 -3
- package/es/tables/pivot-chart.js.map +1 -1
- package/es/tables/pivot-table-simple.d.ts +8 -0
- package/es/tables/pivot-table-simple.js +9 -0
- package/es/tables/pivot-table-simple.js.map +1 -0
- package/es/tables/pivot-table.d.ts +1 -1
- package/es/tables/pivot-table.js +6 -1
- package/es/tables/pivot-table.js.map +1 -1
- package/es/util.js +1 -2
- package/es/vtable.d.ts +1 -2
- package/es/vtable.js +1 -3
- package/es/vtable.js.map +1 -1
- package/package.json +6 -6
- package/cjs/components/base-component.js.map +0 -1
- package/cjs/components/component/emptyTip.js.map +0 -1
- package/cjs/components/component/menu.js.map +0 -1
- package/cjs/components/component/tooltip.js.map +0 -1
- package/cjs/components/custom/component.d.ts +0 -16
- package/cjs/components/custom/component.js +0 -7
- package/cjs/components/custom/component.js.map +0 -1
- package/cjs/components/custom/custom-layout.js.map +0 -1
- package/cjs/components/custom/graphic.js.map +0 -1
- package/cjs/components/custom/reconciler.d.ts +0 -5
- package/cjs/components/custom/reconciler.js.map +0 -1
- package/cjs/components/custom/vtable-browser-env-contribution.d.ts +0 -2
- package/cjs/components/custom/vtable-browser-env-contribution.js.map +0 -1
- package/cjs/components/custom/vtable-react-attribute-plugin.js.map +0 -1
- package/cjs/components/custom-component.js.map +0 -1
- package/cjs/components/list/list-column.js.map +0 -1
- package/cjs/components/pivot/pivot-corner.js.map +0 -1
- package/cjs/components/pivot/pivot-dimension.js.map +0 -1
- package/cjs/components/pivot/pivot-header-title.js.map +0 -1
- package/cjs/components/pivot/pivot-indicator.js.map +0 -1
- package/dist/react-vtable.js +0 -13799
- package/dist/react-vtable.min.js +0 -46
- package/es/components/base-component.js.map +0 -1
- package/es/components/component/emptyTip.js.map +0 -1
- package/es/components/component/menu.js.map +0 -1
- package/es/components/component/tooltip.js.map +0 -1
- package/es/components/custom/component.d.ts +0 -16
- package/es/components/custom/component.js +0 -6
- package/es/components/custom/component.js.map +0 -1
- package/es/components/custom/custom-layout.js.map +0 -1
- package/es/components/custom/graphic.js.map +0 -1
- package/es/components/custom/reconciler.d.ts +0 -5
- package/es/components/custom/reconciler.js.map +0 -1
- package/es/components/custom/vtable-browser-env-contribution.d.ts +0 -2
- package/es/components/custom/vtable-browser-env-contribution.js.map +0 -1
- package/es/components/custom/vtable-react-attribute-plugin.js.map +0 -1
- package/es/components/custom-component.js.map +0 -1
- package/es/components/list/list-column.js.map +0 -1
- package/es/components/pivot/pivot-corner.js.map +0 -1
- package/es/components/pivot/pivot-dimension.js.map +0 -1
- package/es/components/pivot/pivot-header-title.js.map +0 -1
- package/es/components/pivot/pivot-indicator.js.map +0 -1
- /package/cjs/{components → table-components}/base-component.d.ts +0 -0
- /package/cjs/{components → table-components}/component/emptyTip.d.ts +0 -0
- /package/cjs/{components → table-components}/component/emptyTip.js +0 -0
- /package/cjs/{components → table-components}/component/menu.d.ts +0 -0
- /package/cjs/{components → table-components}/component/menu.js +0 -0
- /package/cjs/{components → table-components}/component/tooltip.d.ts +0 -0
- /package/cjs/{components → table-components}/component/tooltip.js +0 -0
- /package/cjs/{components → table-components}/custom/graphic.js +0 -0
- /package/cjs/{components → table-components}/custom-component.d.ts +0 -0
- /package/cjs/{components → table-components}/custom-component.js +0 -0
- /package/cjs/{components → table-components}/list/list-column.d.ts +0 -0
- /package/cjs/{components → table-components}/list/list-column.js +0 -0
- /package/cjs/{components → table-components}/pivot/pivot-corner.d.ts +0 -0
- /package/cjs/{components → table-components}/pivot/pivot-corner.js +0 -0
- /package/cjs/{components → table-components}/pivot/pivot-dimension.d.ts +0 -0
- /package/cjs/{components → table-components}/pivot/pivot-dimension.js +0 -0
- /package/cjs/{components → table-components}/pivot/pivot-header-title.d.ts +0 -0
- /package/cjs/{components → table-components}/pivot/pivot-header-title.js +0 -0
- /package/cjs/{components → table-components}/pivot/pivot-indicator.d.ts +0 -0
- /package/cjs/{components → table-components}/pivot/pivot-indicator.js +0 -0
- /package/es/{components → table-components}/base-component.d.ts +0 -0
- /package/es/{components → table-components}/component/emptyTip.d.ts +0 -0
- /package/es/{components → table-components}/component/emptyTip.js +0 -0
- /package/es/{components → table-components}/component/menu.d.ts +0 -0
- /package/es/{components → table-components}/component/menu.js +0 -0
- /package/es/{components → table-components}/component/tooltip.d.ts +0 -0
- /package/es/{components → table-components}/component/tooltip.js +0 -0
- /package/es/{components → table-components}/custom/graphic.js +0 -0
- /package/es/{components → table-components}/custom-component.d.ts +0 -0
- /package/es/{components → table-components}/custom-component.js +0 -0
- /package/es/{components → table-components}/list/list-column.d.ts +0 -0
- /package/es/{components → table-components}/list/list-column.js +0 -0
- /package/es/{components → table-components}/pivot/pivot-corner.d.ts +0 -0
- /package/es/{components → table-components}/pivot/pivot-corner.js +0 -0
- /package/es/{components → table-components}/pivot/pivot-dimension.d.ts +0 -0
- /package/es/{components → table-components}/pivot/pivot-dimension.js +0 -0
- /package/es/{components → table-components}/pivot/pivot-header-title.d.ts +0 -0
- /package/es/{components → table-components}/pivot/pivot-header-title.js +0 -0
- /package/es/{components → table-components}/pivot/pivot-indicator.d.ts +0 -0
- /package/es/{components → table-components}/pivot/pivot-indicator.js +0 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.createVRenderComponent = void 0;
|
|
6
|
+
|
|
7
|
+
const vrender_1 = require("@visactor/vtable/es/vrender");
|
|
8
|
+
|
|
9
|
+
function createVRenderComponent(type, props) {
|
|
10
|
+
if ("tag" === type) {
|
|
11
|
+
return new vrender_1.Tag(props.attribute ? props.attribute : props);
|
|
12
|
+
}
|
|
13
|
+
if ("radio" === type) {
|
|
14
|
+
return new vrender_1.Radio(props.attribute ? props.attribute : props);
|
|
15
|
+
}
|
|
16
|
+
if ("checkbox" === type) {
|
|
17
|
+
return new vrender_1.CheckBox(props.attribute ? props.attribute : props);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
exports.createVRenderComponent = createVRenderComponent;
|
|
22
|
+
//# sourceMappingURL=component-creater.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components/vrender-components/component-creater.ts"],"names":[],"mappings":";;;AAAA,yDAAmE;AAEnE,SAAgB,sBAAsB,CAAC,IAAY,EAAE,KAAU;IAE7D,IAAI,IAAI,KAAK,KAAK,EAAE;QAClB,MAAM,GAAG,GAAG,IAAI,aAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAC/D,OAAO,GAAG,CAAC;KACZ;SAAM,IAAI,IAAI,KAAK,OAAO,EAAE;QAC3B,MAAM,KAAK,GAAG,IAAI,eAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACnE,OAAO,KAAK,CAAC;KACd;SAAM,IAAI,IAAI,KAAK,UAAU,EAAE;QAC9B,MAAM,QAAQ,GAAG,IAAI,kBAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACzE,OAAO,QAAQ,CAAC;KACjB;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAbD,wDAaC","file":"component-creater.js","sourcesContent":["import { CheckBox, Radio, Tag } from '@visactor/vtable/es/vrender';\n\nexport function createVRenderComponent(type: string, props: any) {\n // may have unwanted onxxx prop\n if (type === 'tag') {\n const tag = new Tag(props.attribute ? props.attribute : props);\n return tag;\n } else if (type === 'radio') {\n const radio = new Radio(props.attribute ? props.attribute : props);\n return radio;\n } else if (type === 'checkbox') {\n const checkbox = new CheckBox(props.attribute ? props.attribute : props);\n return checkbox;\n }\n return undefined;\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ReactElement, JSXElementConstructor } from 'react';
|
|
2
|
+
import type { Radio as VRadio, RadioAttributes } from '@visactor/vtable/es/vrender';
|
|
3
|
+
import type { GraphicProps } from './type';
|
|
4
|
+
export declare const Radio: (props: GraphicProps<RadioAttributes, VRadio>) => ReactElement<GraphicProps<RadioAttributes, VRadio>, JSXElementConstructor<GraphicProps<RadioAttributes, VRadio>>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components/vrender-components/radio.tsx"],"names":[],"mappings":";;;AAKa,QAAA,KAAK,GAGhB,OAAc,CAAC","file":"radio.js","sourcesContent":["import type { ReactElement, JSXElementConstructor } from 'react';\nimport type { Radio as VRadio, RadioAttributes } from '@visactor/vtable/es/vrender';\nimport type { GraphicProps } from './type';\n\n// component from vrender-component\nexport const Radio: (\n props: GraphicProps<RadioAttributes, VRadio>\n) => ReactElement<GraphicProps<RadioAttributes, VRadio>, JSXElementConstructor<GraphicProps<RadioAttributes, VRadio>>> =\n 'radio' as any;\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ReactElement, JSXElementConstructor } from 'react';
|
|
2
|
+
import type { Tag as VTag, TagAttributes } from '@visactor/vtable/es/vrender';
|
|
3
|
+
import type { GraphicProps } from './type';
|
|
4
|
+
export declare const Tag: (props: GraphicProps<TagAttributes, VTag>) => ReactElement<GraphicProps<TagAttributes, VTag>, JSXElementConstructor<GraphicProps<TagAttributes, VTag>>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components/vrender-components/tag.tsx"],"names":[],"mappings":";;;AAKa,QAAA,GAAG,GAGd,KAAY,CAAC","file":"tag.js","sourcesContent":["import type { ReactElement, JSXElementConstructor } from 'react';\nimport type { Tag as VTag, TagAttributes } from '@visactor/vtable/es/vrender';\nimport type { GraphicProps } from './type';\n\n// component from vrender-component\nexport const Tag: (\n props: GraphicProps<TagAttributes, VTag>\n) => ReactElement<GraphicProps<TagAttributes, VTag>, JSXElementConstructor<GraphicProps<TagAttributes, VTag>>> =\n 'tag' as any;\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Ref } from 'react';
|
|
2
|
+
import type { IEventParamsType } from '@visactor/vtable/es/vrender';
|
|
3
|
+
export type GraphicProps<IGraphicGraphicAttribute, IGraphic> = {
|
|
4
|
+
attribute?: IGraphicGraphicAttribute;
|
|
5
|
+
ref?: Ref<IGraphic>;
|
|
6
|
+
} & IGraphicGraphicAttribute & IEventParamsType;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components/vrender-components/type.ts"],"names":[],"mappings":"","file":"type.js","sourcesContent":["import type { Ref } from 'react';\nimport type { IEventParamsType } from '@visactor/vtable/es/vrender';\n\nexport type GraphicProps<IGraphicGraphicAttribute, IGraphic> = {\n attribute?: IGraphicGraphicAttribute;\n ref?: Ref<IGraphic>;\n} & IGraphicGraphicAttribute &\n IEventParamsType;\n"]}
|
package/cjs/constants.js
CHANGED
|
@@ -2,4 +2,5 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: !0
|
|
5
|
-
}), exports.REACT_PRIVATE_PROPS = void 0, exports.REACT_PRIVATE_PROPS = [ "children", "hooks", "ref" ];
|
|
5
|
+
}), exports.REACT_PRIVATE_PROPS = void 0, exports.REACT_PRIVATE_PROPS = [ "children", "hooks", "ref" ];
|
|
6
|
+
//# sourceMappingURL=constants.js.map
|
package/cjs/eventsUtils.d.ts
CHANGED
|
@@ -103,4 +103,4 @@ export declare const TABLE_EVENTS: {
|
|
|
103
103
|
};
|
|
104
104
|
export declare const TABLE_EVENTS_KEYS: string[];
|
|
105
105
|
export declare const findEventProps: <T extends EventsProps>(props: T, supportedEvents?: Record<string, string>) => EventsProps;
|
|
106
|
-
export declare const bindEventsToTable: <T>(table: IVTable, newProps?: T, prevProps?: T, supportedEvents?: Record<string, string>) => boolean;
|
|
106
|
+
export declare const bindEventsToTable: <T extends EventsProps>(table: IVTable, newProps?: T, prevProps?: T, supportedEvents?: Record<string, string>) => boolean;
|
package/cjs/eventsUtils.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: !0
|
|
5
5
|
}), exports.bindEventsToTable = exports.findEventProps = exports.TABLE_EVENTS_KEYS = exports.TABLE_EVENTS = void 0;
|
|
6
6
|
|
|
7
|
-
const vtable_1 = require("@visactor/vtable"), EVENT_TYPE = Object.assign(Object.assign(Object.assign({}, vtable_1.
|
|
7
|
+
const vtable_1 = require("@visactor/vtable"), EVENT_TYPE = Object.assign(Object.assign(Object.assign({}, vtable_1.TABLE_EVENT_TYPE), vtable_1.PIVOT_TABLE_EVENT_TYPE), vtable_1.PIVOT_CHART_EVENT_TYPE);
|
|
8
8
|
|
|
9
9
|
exports.TABLE_EVENTS = {
|
|
10
10
|
onClickCell: EVENT_TYPE.CLICK_CELL,
|
package/cjs/eventsUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["eventsUtils.ts"],"names":[],"mappings":";;;AAAA,6CAAqE;AAMrE,MAAM,UAAU,iDACX,kBAAS,CAAC,UAAU,GACpB,mBAAU,CAAC,UAAU,GACrB,mBAAU,CAAC,UAAU,CACzB,CAAC;AAmEW,QAAA,YAAY,GAAG;IAC1B,WAAW,EAAE,UAAU,CAAC,UAAU;IAClC,cAAc,EAAE,UAAU,CAAC,aAAa;IACxC,eAAe,EAAE,UAAU,CAAC,cAAc;IAC1C,aAAa,EAAE,UAAU,CAAC,YAAY;IACtC,cAAc,EAAE,UAAU,CAAC,aAAa;IACxC,eAAe,EAAE,UAAU,CAAC,cAAc;IAC1C,SAAS,EAAE,UAAU,CAAC,OAAO;IAC7B,iBAAiB,EAAE,UAAU,CAAC,gBAAgB;IAC9C,iBAAiB,EAAE,UAAU,CAAC,gBAAgB;IAC9C,gBAAgB,EAAE,UAAU,CAAC,eAAe;IAC5C,eAAe,EAAE,UAAU,CAAC,cAAc;IAC1C,gBAAgB,EAAE,UAAU,CAAC,eAAe;IAC5C,gBAAgB,EAAE,UAAU,CAAC,eAAe;IAC5C,iBAAiB,EAAE,UAAU,CAAC,gBAAgB;IAC9C,cAAc,EAAE,UAAU,CAAC,aAAa;IACxC,iBAAiB,EAAE,UAAU,CAAC,iBAAiB;IAC/C,sBAAsB,EAAE,UAAU,CAAC,sBAAsB;IACzD,WAAW,EAAE,UAAU,C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CAAC,QAAQ,CAAC,CAAC,CAAC;aAC3D;QACH,CAAC,CAAC,CAAC;KACJ;IAED,IAAI,aAAa,EAAE;QACjB,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YAC5C,IAAI,CAAC,cAAc,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,cAAc,CAAC,QAAQ,CAAC,KAAK,aAAa,CAAC,QAAQ,CAAC,EAAE;gBACxG,KAAK,CAAC,EAAE,CAAC,eAAe,CAAC,QAAQ,CAAmD,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC;aAChH;QACH,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AA9BW,QAAA,iBAAiB,qBA8B5B","file":"eventsUtils.js","sourcesContent":["import { ListTable, PivotTable, PivotChart } from '@visactor/vtable';\nimport type { IVTable } from './tables/base-table';\nimport type { TYPES } from '@visactor/vtable';\n\nexport type EventCallback<Params> = (params: Params) => void;\n\nconst EVENT_TYPE = {\n ...ListTable.EVENT_TYPE,\n ...PivotTable.EVENT_TYPE,\n ...PivotChart.EVENT_TYPE\n};\n\nexport interface EventsProps {\n onClickCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['click_cell']>;\n onDblClickCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['dblclick_cell']>;\n onMouseDownCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mousedown_cell']>;\n onMouseUpCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseup_cell']>;\n onSelectedCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['selected_cell']>;\n onSelectedClear?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['selected_clear']>;\n onKeyDown?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['keydown']>;\n onMouseEnterTable?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseenter_table']>;\n onMouseLeaveTable?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseleave_table']>;\n onMouseDownTable?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mousedown_table']>;\n onMouseMoveCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mousemove_cell']>;\n onMouseEnterCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseenter_cell']>;\n onMouseLeaveCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseleave_cell']>;\n onContextMenuCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['contextmenu_cell']>;\n onResizeColumn?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['resize_column']>;\n onResizeColumnEnd?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['resize_column_end']>;\n onChangeHeaderPosition?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['change_header_position']>;\n onSortClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['sort_click']>;\n onFreezeClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['freeze_click']>;\n onScroll?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['scroll']>;\n onDropdownMenuClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['dropdown_menu_click']>;\n onMouseOverChartSymbol?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseover_chart_symbol']>;\n onDragSelectEnd?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['drag_select_end']>;\n\n onDropdownIconClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['dropdown_icon_click']>;\n onDropdownMenuClear?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['dropdown_menu_clear']>;\n\n onTreeHierarchyStateChange?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['tree_hierarchy_state_change']>;\n\n onShowMenu?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['show_menu']>;\n onHideMenu?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['hide_menu']>;\n\n onIconClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['icon_click']>;\n\n onLegendItemClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['legend_item_click']>;\n onLegendItemHover?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['legend_item_hover']>;\n onLegendItemUnHover?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['legend_item_unHover']>;\n onLegendChange?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['legend_change']>;\n\n onMouseEnterAxis?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseenter_axis']>;\n onMouseLeaveAxis?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseleave_axis']>;\n\n onCheckboxStateChange?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['checkbox_state_change']>;\n onRadioStateChange?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['radio_state_change']>;\n onAfterRender?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['after_render']>;\n onInitialized?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['initialized']>;\n\n // pivot table only\n onPivotSortClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['pivot_sort_click']>;\n onDrillMenuClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['drillmenu_click']>;\n\n // pivot chart only\n onVChartEventType?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['vchart_event_type']>;\n\n onChangCellValue?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['change_cell_value']>;\n\n onMousedownFillHandle?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mousedown_fill_handle']>;\n onDragFillHandleEnd?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['drag_fill_handle_end']>;\n onDblclickFillHandle?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['dblclick_fill_handle']>;\n\n onScrollVerticalEnd?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['scroll_vertical_end']>;\n onScrollHorizontalEnd?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['scroll_horizontal_end']>;\n}\n\nexport const TABLE_EVENTS = {\n onClickCell: EVENT_TYPE.CLICK_CELL,\n onDblClickCell: EVENT_TYPE.DBLCLICK_CELL,\n onMouseDownCell: EVENT_TYPE.MOUSEDOWN_CELL,\n onMouseUpCell: EVENT_TYPE.MOUSEUP_CELL,\n onSelectedCell: EVENT_TYPE.SELECTED_CELL,\n onSelectedClear: EVENT_TYPE.SELECTED_CLEAR,\n onKeyDown: EVENT_TYPE.KEYDOWN,\n onMouseEnterTable: EVENT_TYPE.MOUSEENTER_TABLE,\n onMouseLeaveTable: EVENT_TYPE.MOUSELEAVE_TABLE,\n onMouseDownTable: EVENT_TYPE.MOUSEDOWN_TABLE,\n onMouseMoveCell: EVENT_TYPE.MOUSEMOVE_CELL,\n onMouseEnterCell: EVENT_TYPE.MOUSEENTER_CELL,\n onMouseLeaveCell: EVENT_TYPE.MOUSELEAVE_CELL,\n onContextMenuCell: EVENT_TYPE.CONTEXTMENU_CELL,\n onResizeColumn: EVENT_TYPE.RESIZE_COLUMN,\n onResizeColumnEnd: EVENT_TYPE.RESIZE_COLUMN_END,\n onChangeHeaderPosition: EVENT_TYPE.CHANGE_HEADER_POSITION,\n onSortClick: EVENT_TYPE.SORT_CLICK,\n onFreezeClick: EVENT_TYPE.FREEZE_CLICK,\n onScroll: EVENT_TYPE.SCROLL,\n onDropdownMenuClick: EVENT_TYPE.DROPDOWN_MENU_CLICK,\n onMouseOverChartSymbol: EVENT_TYPE.MOUSEOVER_CHART_SYMBOL,\n onDragSelectEnd: EVENT_TYPE.DRAG_SELECT_END,\n\n onDropdownIconClick: EVENT_TYPE.DROPDOWN_ICON_CLICK,\n onDropdownMenuClear: EVENT_TYPE.DROPDOWN_MENU_CLEAR,\n\n onTreeHierarchyStateChange: EVENT_TYPE.TREE_HIERARCHY_STATE_CHANGE,\n\n onShowMenu: EVENT_TYPE.SHOW_MENU,\n onHideMenu: EVENT_TYPE.HIDE_MENU,\n\n onIconClick: EVENT_TYPE.ICON_CLICK,\n\n onLegendItemClick: EVENT_TYPE.LEGEND_ITEM_CLICK,\n onLegendItemHover: EVENT_TYPE.LEGEND_ITEM_HOVER,\n onLegendItemUnHover: EVENT_TYPE.LEGEND_ITEM_UNHOVER,\n onLegendChange: EVENT_TYPE.LEGEND_CHANGE,\n\n onMouseEnterAxis: EVENT_TYPE.MOUSEENTER_AXIS,\n onMouseLeaveAxis: EVENT_TYPE.MOUSELEAVE_AXIS,\n\n onCheckboxStateChange: EVENT_TYPE.CHECKBOX_STATE_CHANGE,\n onRadioStateChange: EVENT_TYPE.RADIO_STATE_CHANGE,\n onAfterRender: EVENT_TYPE.AFTER_RENDER,\n onInitialized: EVENT_TYPE.INITIALIZED,\n\n // pivot table only\n onPivotSortClick: EVENT_TYPE.PIVOT_SORT_CLICK,\n onDrillMenuClick: EVENT_TYPE.DRILLMENU_CLICK,\n\n // pivot chart only\n onVChartEventType: EVENT_TYPE.VCHART_EVENT_TYPE,\n\n onChangCellValue: EVENT_TYPE.CHANGE_CELL_VALUE,\n onMousedownFillHandle: EVENT_TYPE.MOUSEDOWN_FILL_HANDLE,\n onDragFillHandleEnd: EVENT_TYPE.DRAG_FILL_HANDLE_END,\n onDblclickFillHandle: EVENT_TYPE.DBLCLICK_FILL_HANDLE,\n onScrollVerticalEnd: EVENT_TYPE.SCROLL_VERTICAL_END,\n onScrollHorizontalEnd: EVENT_TYPE.SCROLL_HORIZONTAL_END\n};\n\nexport const TABLE_EVENTS_KEYS = Object.keys(TABLE_EVENTS);\n\nexport const findEventProps = <T extends EventsProps>(\n props: T,\n supportedEvents: Record<string, string> = TABLE_EVENTS\n): EventsProps => {\n const result: EventsProps = {};\n\n Object.keys(props).forEach(key => {\n if (supportedEvents[key] && props[key]) {\n result[key] = props[key];\n }\n });\n\n return result;\n};\n\nexport const bindEventsToTable = <T>(\n table: IVTable,\n newProps?: T | null,\n prevProps?: T | null,\n supportedEvents: Record<string, string> = TABLE_EVENTS\n) => {\n if ((!newProps && !prevProps) || !table) {\n return false;\n }\n\n const prevEventProps = prevProps ? findEventProps(prevProps, supportedEvents) : null;\n const newEventProps = newProps ? findEventProps(newProps, supportedEvents) : null;\n\n if (prevEventProps) {\n Object.keys(prevEventProps).forEach(eventKey => {\n if (!newEventProps || !newEventProps[eventKey] || newEventProps[eventKey] !== prevEventProps[eventKey]) {\n table.off(supportedEvents[eventKey], prevProps[eventKey]);\n }\n });\n }\n\n if (newEventProps) {\n Object.keys(newEventProps).forEach(eventKey => {\n if (!prevEventProps || !prevEventProps[eventKey] || prevEventProps[eventKey] !== newEventProps[eventKey]) {\n table.on(supportedEvents[eventKey] as keyof TYPES.TableEventHandlersEventArgumentMap, newEventProps[eventKey]);\n }\n });\n }\n\n return true;\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["eventsUtils.ts"],"names":[],"mappings":";;;AAGA,6CAAoG;AAIpG,MAAM,UAAU,iDAIX,yBAAgB,GAChB,+BAAsB,GACtB,+BAAsB,CAC1B,CAAC;AAkEW,QAAA,YAAY,GAAG;IAC1B,WAAW,EAAE,UAAU,CAAC,UAAU;IAClC,cAAc,EAAE,UAAU,CAAC,aAAa;IACxC,eAAe,EAAE,UAAU,CAAC,cAAc;IAC1C,aAAa,EAAE,UAAU,CAAC,YAAY;IACtC,cAAc,EAAE,UAAU,CAAC,aAAa;IACxC,eAAe,EAAE,UAAU,CAAC,cAAc;IAC1C,SAAS,EAAE,UAAU,CAAC,OAAO;IAC7B,iBAAiB,EAAE,UAAU,CAAC,gBAAgB;IAC9C,iBAAiB,EAAE,UAAU,CAAC,gBAAgB;IAC9C,gBAAgB,EAAE,UAAU,CAAC,eAAe;IAC5C,eAAe,EAAE,UAAU,CAAC,cAAc;IAC1C,gBAAgB,EAAE,UAAU,CAAC,eAAe;IAC5C,gBAAgB,EAAE,UAAU,CAAC,eAAe;IAC5C,iBAAiB,EAAE,UAAU,CAAC,gBAAgB;IAC9C,cAAc,EAAE,UAAU,CAAC,aAAa;IACxC,iBAAiB,EAAE,UAAU,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AAC,QAA6B,CAAC,EAC9F;gBACA,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,QAA6B,CAAQ,CAAC,CAAC;aACvF;QACH,CAAC,CAAC,CAAC;KACJ;IAED,IAAI,aAAa,EAAE;QACjB,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YAC5C,IACE,CAAC,cAAc;gBACf,CAAC,cAAc,CAAC,QAA6B,CAAC;gBAC9C,cAAc,CAAC,QAA6B,CAAC,KAAK,aAAa,CAAC,QAA6B,CAAC,EAC9F;gBACA,KAAK,CAAC,EAAE,CACN,eAAe,CAAC,QAAQ,CAAmD,EAC3E,aAAa,CAAC,QAA6B,CAAQ,CACpD,CAAC;aACH;QACH,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAzCW,QAAA,iBAAiB,qBAyC5B","file":"eventsUtils.js","sourcesContent":["// import { ListTable, PivotTable, PivotChart } from '@visactor/vtable';\nimport type { IVTable } from './tables/base-table';\nimport type { TYPES } from '@visactor/vtable';\nimport { TABLE_EVENT_TYPE, PIVOT_CHART_EVENT_TYPE, PIVOT_TABLE_EVENT_TYPE } from '@visactor/vtable';\n\nexport type EventCallback<Params> = (params: Params) => void;\n\nconst EVENT_TYPE = {\n // ...ListTable.EVENT_TYPE,\n // ...PivotTable.EVENT_TYPE,\n // ...PivotChart.EVENT_TYPE,\n ...TABLE_EVENT_TYPE,\n ...PIVOT_TABLE_EVENT_TYPE,\n ...PIVOT_CHART_EVENT_TYPE\n};\nexport interface EventsProps {\n onClickCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['click_cell']>;\n onDblClickCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['dblclick_cell']>;\n onMouseDownCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mousedown_cell']>;\n onMouseUpCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseup_cell']>;\n onSelectedCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['selected_cell']>;\n onSelectedClear?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['selected_clear']>;\n onKeyDown?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['keydown']>;\n onMouseEnterTable?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseenter_table']>;\n onMouseLeaveTable?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseleave_table']>;\n onMouseDownTable?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mousedown_table']>;\n onMouseMoveCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mousemove_cell']>;\n onMouseEnterCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseenter_cell']>;\n onMouseLeaveCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseleave_cell']>;\n onContextMenuCell?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['contextmenu_cell']>;\n onResizeColumn?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['resize_column']>;\n onResizeColumnEnd?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['resize_column_end']>;\n onChangeHeaderPosition?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['change_header_position']>;\n onSortClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['sort_click']>;\n onFreezeClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['freeze_click']>;\n onScroll?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['scroll']>;\n onDropdownMenuClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['dropdown_menu_click']>;\n onMouseOverChartSymbol?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseover_chart_symbol']>;\n onDragSelectEnd?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['drag_select_end']>;\n\n onDropdownIconClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['dropdown_icon_click']>;\n onDropdownMenuClear?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['dropdown_menu_clear']>;\n\n onTreeHierarchyStateChange?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['tree_hierarchy_state_change']>;\n\n onShowMenu?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['show_menu']>;\n onHideMenu?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['hide_menu']>;\n\n onIconClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['icon_click']>;\n\n onLegendItemClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['legend_item_click']>;\n onLegendItemHover?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['legend_item_hover']>;\n onLegendItemUnHover?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['legend_item_unHover']>;\n onLegendChange?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['legend_change']>;\n\n onMouseEnterAxis?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseenter_axis']>;\n onMouseLeaveAxis?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mouseleave_axis']>;\n\n onCheckboxStateChange?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['checkbox_state_change']>;\n onRadioStateChange?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['radio_state_change']>;\n onAfterRender?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['after_render']>;\n onInitialized?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['initialized']>;\n\n // pivot table only\n onPivotSortClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['pivot_sort_click']>;\n onDrillMenuClick?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['drillmenu_click']>;\n\n // pivot chart only\n onVChartEventType?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['vchart_event_type']>;\n\n onChangCellValue?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['change_cell_value']>;\n\n onMousedownFillHandle?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['mousedown_fill_handle']>;\n onDragFillHandleEnd?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['drag_fill_handle_end']>;\n onDblclickFillHandle?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['dblclick_fill_handle']>;\n\n onScrollVerticalEnd?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['scroll_vertical_end']>;\n onScrollHorizontalEnd?: EventCallback<TYPES.TableEventHandlersEventArgumentMap['scroll_horizontal_end']>;\n}\n\nexport const TABLE_EVENTS = {\n onClickCell: EVENT_TYPE.CLICK_CELL,\n onDblClickCell: EVENT_TYPE.DBLCLICK_CELL,\n onMouseDownCell: EVENT_TYPE.MOUSEDOWN_CELL,\n onMouseUpCell: EVENT_TYPE.MOUSEUP_CELL,\n onSelectedCell: EVENT_TYPE.SELECTED_CELL,\n onSelectedClear: EVENT_TYPE.SELECTED_CLEAR,\n onKeyDown: EVENT_TYPE.KEYDOWN,\n onMouseEnterTable: EVENT_TYPE.MOUSEENTER_TABLE,\n onMouseLeaveTable: EVENT_TYPE.MOUSELEAVE_TABLE,\n onMouseDownTable: EVENT_TYPE.MOUSEDOWN_TABLE,\n onMouseMoveCell: EVENT_TYPE.MOUSEMOVE_CELL,\n onMouseEnterCell: EVENT_TYPE.MOUSEENTER_CELL,\n onMouseLeaveCell: EVENT_TYPE.MOUSELEAVE_CELL,\n onContextMenuCell: EVENT_TYPE.CONTEXTMENU_CELL,\n onResizeColumn: EVENT_TYPE.RESIZE_COLUMN,\n onResizeColumnEnd: EVENT_TYPE.RESIZE_COLUMN_END,\n onChangeHeaderPosition: EVENT_TYPE.CHANGE_HEADER_POSITION,\n onSortClick: EVENT_TYPE.SORT_CLICK,\n onFreezeClick: EVENT_TYPE.FREEZE_CLICK,\n onScroll: EVENT_TYPE.SCROLL,\n onDropdownMenuClick: EVENT_TYPE.DROPDOWN_MENU_CLICK,\n onMouseOverChartSymbol: EVENT_TYPE.MOUSEOVER_CHART_SYMBOL,\n onDragSelectEnd: EVENT_TYPE.DRAG_SELECT_END,\n\n onDropdownIconClick: EVENT_TYPE.DROPDOWN_ICON_CLICK,\n onDropdownMenuClear: EVENT_TYPE.DROPDOWN_MENU_CLEAR,\n\n onTreeHierarchyStateChange: EVENT_TYPE.TREE_HIERARCHY_STATE_CHANGE,\n\n onShowMenu: EVENT_TYPE.SHOW_MENU,\n onHideMenu: EVENT_TYPE.HIDE_MENU,\n\n onIconClick: EVENT_TYPE.ICON_CLICK,\n\n onLegendItemClick: EVENT_TYPE.LEGEND_ITEM_CLICK,\n onLegendItemHover: EVENT_TYPE.LEGEND_ITEM_HOVER,\n onLegendItemUnHover: EVENT_TYPE.LEGEND_ITEM_UNHOVER,\n onLegendChange: EVENT_TYPE.LEGEND_CHANGE,\n\n onMouseEnterAxis: EVENT_TYPE.MOUSEENTER_AXIS,\n onMouseLeaveAxis: EVENT_TYPE.MOUSELEAVE_AXIS,\n\n onCheckboxStateChange: EVENT_TYPE.CHECKBOX_STATE_CHANGE,\n onRadioStateChange: EVENT_TYPE.RADIO_STATE_CHANGE,\n onAfterRender: EVENT_TYPE.AFTER_RENDER,\n onInitialized: EVENT_TYPE.INITIALIZED,\n\n // pivot table only\n onPivotSortClick: EVENT_TYPE.PIVOT_SORT_CLICK,\n onDrillMenuClick: EVENT_TYPE.DRILLMENU_CLICK,\n\n // pivot chart only\n onVChartEventType: EVENT_TYPE.VCHART_EVENT_TYPE,\n\n onChangCellValue: EVENT_TYPE.CHANGE_CELL_VALUE,\n onMousedownFillHandle: EVENT_TYPE.MOUSEDOWN_FILL_HANDLE,\n onDragFillHandleEnd: EVENT_TYPE.DRAG_FILL_HANDLE_END,\n onDblclickFillHandle: EVENT_TYPE.DBLCLICK_FILL_HANDLE,\n onScrollVerticalEnd: EVENT_TYPE.SCROLL_VERTICAL_END,\n onScrollHorizontalEnd: EVENT_TYPE.SCROLL_HORIZONTAL_END\n};\n\nexport const TABLE_EVENTS_KEYS = Object.keys(TABLE_EVENTS);\n\nexport const findEventProps = <T extends EventsProps>(\n props: T,\n supportedEvents: Record<string, string> = TABLE_EVENTS\n): EventsProps => {\n const result: EventsProps = {};\n\n Object.keys(props).forEach(key => {\n if (supportedEvents[key] && props[key as keyof EventsProps]) {\n result[key as keyof EventsProps] = props[key as keyof EventsProps] as any;\n }\n });\n\n return result;\n};\n\nexport const bindEventsToTable = <T extends EventsProps>(\n table: IVTable,\n newProps?: T | null,\n prevProps?: T | null,\n supportedEvents: Record<string, string> = TABLE_EVENTS\n) => {\n if ((!newProps && !prevProps) || !table) {\n return false;\n }\n\n const prevEventProps: EventsProps = prevProps ? findEventProps(prevProps, supportedEvents) : null;\n const newEventProps: EventsProps = newProps ? findEventProps(newProps, supportedEvents) : null;\n\n if (prevEventProps) {\n Object.keys(prevEventProps).forEach(eventKey => {\n if (\n !newEventProps ||\n !newEventProps[eventKey as keyof EventsProps] ||\n newEventProps[eventKey as keyof EventsProps] !== prevEventProps[eventKey as keyof EventsProps]\n ) {\n table.off(supportedEvents[eventKey], prevProps[eventKey as keyof EventsProps] as any);\n }\n });\n }\n\n if (newEventProps) {\n Object.keys(newEventProps).forEach(eventKey => {\n if (\n !prevEventProps ||\n !prevEventProps[eventKey as keyof EventsProps] ||\n prevEventProps[eventKey as keyof EventsProps] !== newEventProps[eventKey as keyof EventsProps]\n ) {\n table.on(\n supportedEvents[eventKey] as keyof TYPES.TableEventHandlersEventArgumentMap,\n newEventProps[eventKey as keyof EventsProps] as any\n );\n }\n });\n }\n\n return true;\n};\n"]}
|
package/cjs/index.d.ts
CHANGED
package/cjs/index.js
CHANGED
|
@@ -17,6 +17,6 @@ var __createBinding = this && this.__createBinding || (Object.create ? function(
|
|
|
17
17
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", {
|
|
19
19
|
value: !0
|
|
20
|
-
}), exports.version = void 0, __exportStar(require("./tables"), exports), __exportStar(require("./components"), exports),
|
|
21
|
-
__exportStar(require("./
|
|
20
|
+
}), exports.version = void 0, __exportStar(require("./tables"), exports), __exportStar(require("./table-components"), exports),
|
|
21
|
+
__exportStar(require("./components"), exports), exports.version = "1.6.1";
|
|
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,+CAA6B;
|
|
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.6.1\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["table-components/base-component.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,+CAAqD;AACrD,6CAA+D;AAG/D,6DAAgD;AAChD,gDAAmD;AAEnD,0DAAsD;AAS/C,MAAM,eAAe,GAAG,CAC7B,aAAqB,EACrB,UAAkB,EAClB,eAA+C,EAC/C,QAAkB,EAClB,EAAE;IACF,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,UAAU,EAAE,gBAAgB,EAAE,UAAU,CAAC,CAAC;IACpE,MAAM,aAAa,GAAG,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;IAErG,MAAM,IAAI,GAAgB,CAAC,KAAQ,EAAE,EAAE;QACrC,MAAM,OAAO,GAAG,IAAA,kBAAU,EAAC,eAAgB,CAAC,CAAC;QAG7C,MAAM,YAAY,GAAG,eAAK,CAAC,MAAM,CAAI,IAAI,CAAC,CAAC;QAC3C,MAAM,QAAQ,GAAG,eAAK,CAAC,MAAM,CAAS,KAAK,CAAC,QAAQ,CAAC,CAAC;QAGtD,IAAI,KAAK,CAAC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AAED,SAAS,mBAAmB,CAAC,QAAmB,EAAE,WAAmB;IACnE,IAAI,cAAc,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;QACvD,OAAO,eAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAwB,EAAE,CAAC,KAAmB,EAAE,KAAK,EAAE,EAAE;YACjF,IAAI,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE;gBACxB,OAAO,mBAAmB,CAAC,KAAK,CAAC,KAAK,CAAC,QAAwB,EAAE,WAAW,GAAG,GAAG,GAAG,KAAK,CAAC,CAAC;aAC7F;iBAAM,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,eAAe,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,sBAAsB,EAAE;gBAC9F,OAAO,eAAK,CAAC,aAAa,CAAC,4BAAY,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE,EAAE,KAAK,CAAC,CAAC;aAC/E;YACD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;KACJ;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,cAAc,CAAC,GAAQ;IAC9B,OAAO,GAAG,IAAI,GAAG,CAAC,QAAQ,KAAK,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AAC7D,CAAC","file":"base-component.js","sourcesContent":["import type { ReactElement, ReactNode } from 'react';\nimport React, { useContext, useEffect } from 'react';\nimport { isEqual, isNil, pickWithout } from '@visactor/vutils';\n\nimport type { TableContextType } from '../context/table';\nimport RootTableContext from '../context/table';\nimport { bindEventsToTable } from '../eventsUtils';\nimport { uid } from '../util';\nimport { CustomLayout } from './custom/custom-layout';\n\nexport interface BaseComponentProps {\n id?: string | number;\n children?: React.ReactNode;\n}\n\ntype ComponentProps = BaseComponentProps & { updateId?: number; componentId?: string; componentIndex?: number };\n\nexport const createComponent = <T extends ComponentProps>(\n componentName: string,\n optionName: string,\n supportedEvents?: Record<string, string> | null,\n isSingle?: boolean\n) => {\n const ignoreKeys = ['id', 'updateId', 'componentIndex', 'children'];\n const notOptionKeys = supportedEvents ? Object.keys(supportedEvents).concat(ignoreKeys) : ignoreKeys;\n\n const Comp: React.FC<T> = (props: T) => {\n const context = useContext(RootTableContext);\n // const id = React.useRef<string | number>(isNil(props.id) ? uid(optionName) : props.id);\n\n const eventsBinded = React.useRef<T>(null);\n const updateId = React.useRef<number>(props.updateId);\n // const componentOption = React.useRef<Partial<T>>();\n\n if (props.updateId !== updateId.current) {\n // update triggered by table when table is rendered\n updateId.current = props.updateId;\n\n // rebind events after table render\n const hasPrevEventsBinded = supportedEvents\n ? bindEventsToTable(context.table, props, eventsBinded.current, supportedEvents)\n : false;\n if (hasPrevEventsBinded) {\n eventsBinded.current = props;\n }\n // } else {\n // const newComponentOption: Partial<T> = pickWithout<T>(props, notOptionKeys);\n\n // if (!isEqual(newComponentOption, componentOption.current)) {\n // componentOption.current = newComponentOption;\n // updateToContext(context, id.current, optionName, isSingle, newComponentOption);\n // }\n }\n\n useEffect(() => {\n return () => {\n if (supportedEvents) {\n bindEventsToTable(context.table, null, eventsBinded.current, supportedEvents);\n }\n // deleteToContext(context, id.current, optionName, isSingle);\n };\n }, []);\n\n // children are all custom layout temply\n // return props.children\n // ? React.cloneElement(props.children as ReactElement, { componentIndex: props.componentIndex })\n // : null;\n // if (props.children) {\n // return React.Children.map(props.children as ReactElement, (child: ReactElement) => {\n // if (child.props.role === 'custom-layout' || child.props.role === 'header-custom-layout') {\n // return React.createElement(CustomLayout, { componentId: props.componentId }, child);\n // }\n // });\n // }\n return parseCustomChildren(props.children, props.componentId);\n };\n\n Comp.displayName = componentName;\n\n (Comp as any).parseOption = (props: T & { updateId?: number; componentId?: string }) => {\n const newComponentOption: Partial<T> = pickWithout<T>(props, notOptionKeys);\n // deal width customLayout\n if (props.children) {\n const { children } = props;\n React.Children.map(children as ReactElement, (child: ReactElement, index) => {\n parseChild(child, props, newComponentOption, notOptionKeys, props.componentId + '-' + index);\n });\n }\n // if (props.children && (props.children as React.ReactElement).props.role === 'custom-layout') {\n // (newComponentOption as any).customLayout = 'react-custom-layout';\n // }\n\n return {\n option: newComponentOption,\n optionName,\n isSingle\n };\n };\n\n return Comp;\n};\n\nfunction parseChild(\n child: ReactElement,\n componentProps: any,\n newComponentOption: any,\n notOptionKeys: string[],\n componentId: string\n) {\n if (child.props.role === 'custom-layout') {\n (newComponentOption as any).customLayout = 'react-custom-layout';\n (newComponentOption as any).customLayoutComponentId = componentId;\n }\n if (child.props.role === 'header-custom-layout') {\n (newComponentOption as any).headerCustomLayout = 'react-custom-layout';\n (newComponentOption as any).headerCustomLayoutComponentId = componentId;\n }\n if ((child.type as any).displayName === 'ListColumn') {\n if (!newComponentOption.columns) {\n newComponentOption.columns = [];\n }\n const childOption = pickWithout(child.props, notOptionKeys);\n newComponentOption.columns.push(childOption);\n childOption.componentId = componentId;\n if (child.props.children) {\n React.Children.map(child.props.children as ReactElement, (child: ReactElement, index) => {\n parseChild(child, componentProps, childOption, notOptionKeys, componentId + '-' + index);\n });\n }\n }\n}\n\nfunction parseCustomChildren(children: ReactNode, componentId: string): ReactNode | undefined {\n if (isReactElement(children) || Array.isArray(children)) {\n return React.Children.map(children as ReactElement, (child: ReactElement, index) => {\n if (child.props.children) {\n return parseCustomChildren(child.props.children as ReactElement, componentId + '-' + index);\n } else if (child.props.role === 'custom-layout' || child.props.role === 'header-custom-layout') {\n return React.createElement(CustomLayout, { componentId: componentId }, child);\n }\n return null;\n });\n }\n return null;\n}\n\nfunction isReactElement(obj: any) {\n return obj && obj.$$typeof === Symbol.for('react.element');\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["table-components/component/emptyTip.tsx"],"names":[],"mappings":";;;AAAA,sDAAoD;AAsBvC,QAAA,QAAQ,GAAG,IAAA,gCAAe,EAAgB,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC","file":"emptyTip.js","sourcesContent":["import { createComponent } from '../base-component';\nimport type { BaseComponentProps } from '../base-component';\n\nexport type EmptyTipProps = {\n text?: string;\n textStyle?: {\n fontSize?: number;\n fontFamily?: string;\n fontWeight?: string | number;\n fontVariant?: string;\n lineHeight?: number | string;\n underline?: number;\n lineThrough?: number;\n color?: string;\n };\n icon?: {\n width?: number;\n height?: number;\n image: string;\n };\n} & BaseComponentProps;\n\nexport const EmptyTip = createComponent<EmptyTipProps>('EmptyTip', 'emptyTip', undefined, true);\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["table-components/component/menu.tsx"],"names":[],"mappings":";;;AACA,sDAAoD;AAcvC,QAAA,IAAI,GAAG,IAAA,gCAAe,EAAY,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC","file":"menu.js","sourcesContent":["import type { BaseComponentProps } from '../base-component';\nimport { createComponent } from '../base-component';\nimport type { TYPES } from '@visactor/vtable';\n\nexport type MenuProps = {\n /** 代替原来的option.menuType html目前实现较完整 先默认html渲染方式*/\n renderMode?: 'canvas' | 'html';\n /** 内置下拉菜单的全局设置项 目前只针对基本表格有效 会对每个表头单元格开启默认的下拉菜单功能。代替原来的option.dropDownMenu*/\n defaultHeaderMenuItems?: TYPES.MenuListItem[];\n /** 右键菜单。代替原来的option.contextmenu */\n contextMenuItems?: TYPES.MenuListItem[] | ((field: string, row: number, col: number) => TYPES.MenuListItem[]);\n /** 设置选中状态的菜单。代替原来的option.dropDownMenuHighlight */\n dropDownMenuHighlight?: TYPES.DropDownMenuHighlightInfo[];\n} & BaseComponentProps;\n\nexport const Menu = createComponent<MenuProps>('Menu', 'menu', undefined, true);\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.Title = void 0;
|
|
6
|
+
|
|
7
|
+
const base_component_1 = require("../base-component");
|
|
8
|
+
|
|
9
|
+
exports.Title = (0, base_component_1.createComponent)("Title", "title", void 0, !0);
|
|
10
|
+
//# sourceMappingURL=title.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["table-components/component/title.tsx"],"names":[],"mappings":";;;AAEA,sDAAoD;AAIvC,QAAA,KAAK,GAAG,IAAA,gCAAe,EAAa,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC","file":"title.js","sourcesContent":["import type { TYPES } from '@visactor/vtable';\nimport type { BaseComponentProps } from '../base-component';\nimport { createComponent } from '../base-component';\n\nexport type TitleProps = TYPES.ITitle & BaseComponentProps;\n\nexport const Title = createComponent<TitleProps>('Title', 'title', undefined, true);\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["table-components/component/tooltip.tsx"],"names":[],"mappings":";;;AACA,sDAAoD;AAWvC,QAAA,OAAO,GAAG,IAAA,gCAAe,EAAe,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC","file":"tooltip.js","sourcesContent":["import type { BaseComponentProps } from '../base-component';\nimport { createComponent } from '../base-component';\n\nexport type TooltipProps = {\n /** html目前实现较完整 先默认html渲染方式 */\n renderMode?: 'html'; // 目前暂不支持canvas方案\n /** 代替原来hover:isShowTooltip配置 暂时需要将renderMode配置为html才能显示,canvas的还未开发*/\n isShowOverflowTextTooltip?: boolean;\n /** 是否将 tooltip 框限制在画布区域内,默认开启。针对renderMode:\"html\"有效 */\n confine?: boolean;\n} & BaseComponentProps;\n\nexport const Tooltip = createComponent<TooltipProps>('Tooltip', 'tooltip', undefined, true);\n"]}
|
|
@@ -33,7 +33,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
33
33
|
value: !0
|
|
34
34
|
}), exports.CustomLayout = void 0;
|
|
35
35
|
|
|
36
|
-
const react_1 = __importStar(require("react")), table_1 = __importDefault(require("../../context/table")),
|
|
36
|
+
const react_1 = __importStar(require("react")), table_1 = __importDefault(require("../../context/table")), vrender_1 = require("@visactor/vtable/es/vrender"), reconciler_1 = require("./reconciler"), constants_1 = require("react-reconciler/constants"), CustomLayout = (props, ref) => {
|
|
37
37
|
const {componentId: componentId, children: children} = props;
|
|
38
38
|
if (!(0, react_1.isValidElement)(children)) return null;
|
|
39
39
|
const context = (0, react_1.useContext)(table_1.default), {table: table} = context, isHeaderCustomLayout = "header-custom-layout" === children.props.role, container = (0,
|
|
@@ -44,7 +44,7 @@ const react_1 = __importStar(require("react")), table_1 = __importDefault(requir
|
|
|
44
44
|
const currentContainer = container.current.get(key);
|
|
45
45
|
reconcilorUpdateContainer(children, currentContainer, args), group = currentContainer.containerInfo;
|
|
46
46
|
} else {
|
|
47
|
-
group = new Group({});
|
|
47
|
+
group = new vrender_1.Group({});
|
|
48
48
|
const currentContainer = reconciler_1.reconcilor.createContainer(group, constants_1.LegacyRoot, null, null, null, "custom", null, null);
|
|
49
49
|
container.current.set(key, currentContainer), reconcilorUpdateContainer(children, currentContainer, args);
|
|
50
50
|
}
|
|
@@ -94,10 +94,6 @@ function reconcilorUpdateContainer(children, currentContainer, args) {
|
|
|
94
94
|
reconciler_1.reconcilor.updateContainer(react_1.default.cloneElement(children, Object.assign({}, args)), currentContainer, null);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
function isReactElement(obj) {
|
|
98
|
-
return obj && obj.$$typeof === Symbol.for("react.element");
|
|
99
|
-
}
|
|
100
|
-
|
|
101
97
|
function getCellRect(col, row, table) {
|
|
102
98
|
const range = table.getCellRange(col, row);
|
|
103
99
|
return table.getCellsRect(range.start.col, range.start.row, range.end.col, range.end.row);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["table-components/custom/custom-layout.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,+CAAgG;AAChG,gEAAmD;AACnD,yDAAoD;AAGpD,6CAA0C;AAC1C,0DAAwD;AASjD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;oBACzC,IAAI,EAAE;wBACJ,IAAI,EAAE,CAAC;wBACP,GAAG,EAAE,CAAC;wBACN,KAAK,EAAE,KAAK;wBACZ,MAAM,EAAE,MAAM;wBACd,KAAK;wBACL,MAAM;qBACP;oBACD,KAAK;iBACN,CAAC;gBAEF,MAAM,KAAK,GAAG,gBAAgB,CAAC,aAAa,CAAC;gBAC7C,yBAAyB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,IAAI,CAAC,CAAC;gBAE5D,KAAK,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC;YACrC,CAAC,CAAC,CAAC;SACJ;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAvHW,QAAA,YAAY,gBAuHvB;AAEF,SAAS,yBAAyB,CAAC,QAAsB,EAAE,gBAAqB,EAAE,IAAS;IACzF,uBAAU,CAAC,eAAe,CAAC,eAAK,CAAC,YAAY,CAAC,QAAQ,oBAAO,IAAI,EAAG,EAAE,gBAAgB,EAAE,IAAI,CAAC,CAAC;AAUhG,CAAC;AAED,SAAS,WAAW,CAAC,GAAW,EAAE,GAAW,EAAE,KAAU;IACvD,MAAM,KAAK,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAC3C,MAAM,IAAI,GAAG,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAChG,OAAO,IAAI,CAAC;AACd,CAAC","file":"custom-layout.js","sourcesContent":["/* eslint-disable react-hooks/rules-of-hooks */\nimport type { PropsWithChildren, ReactElement } from 'react';\nimport React, { isValidElement, useCallback, useContext, useLayoutEffect, useRef } from 'react';\nimport RootTableContext from '../../context/table';\nimport { Group } from '@visactor/vtable/es/vrender';\nimport type { ICustomLayoutFuc, CustomRenderFunctionArg } from '@visactor/vtable/es/ts-types';\nimport type { FiberRoot } from 'react-reconciler';\nimport { reconcilor } from './reconciler';\nimport { LegacyRoot } from 'react-reconciler/constants';\n\ntype CustomLayoutProps = { componentId: string };\n\nexport type CustomLayoutFunctionArg = Partial<CustomRenderFunctionArg> & {\n role?: 'custom-layout' | 'header-custom-layout';\n renderDefault?: boolean;\n};\n\nexport const CustomLayout: React.FC<CustomLayoutProps> = (props: PropsWithChildren<CustomLayoutProps>, ref) => {\n const { componentId, children } = props;\n if (!isValidElement(children)) {\n return null;\n }\n const context = useContext(RootTableContext);\n const { table } = context;\n\n const isHeaderCustomLayout = children.props.role === 'header-custom-layout';\n\n // react customLayout component container cache\n const container = useRef<Map<string, FiberRoot>>(new Map());\n\n // customLayout function for vtable\n const createGraphic: ICustomLayoutFuc = useCallback(\n args => {\n const key = `${args.col}-${args.row}`;\n let group;\n if (container.current.has(key)) {\n const currentContainer = container.current.get(key);\n // reconcilor.updateContainer(React.cloneElement(children, { ...args }), currentContainer, null);\n reconcilorUpdateContainer(children, currentContainer, args);\n group = currentContainer.containerInfo;\n // 这里更新group,可能会残留dx dy\n } else {\n group = new Group({});\n const currentContainer = reconcilor.createContainer(group, LegacyRoot, null, null, null, 'custom', null, null);\n container.current.set(key, currentContainer);\n reconcilorUpdateContainer(children, currentContainer, args);\n // const ele = React.cloneElement(children, { ...args });\n // reconcilor.updateContainer(ele, currentContainer, null);\n }\n\n return {\n rootContainer: group,\n renderDefault: !!children.props.renderDefault\n };\n },\n [children]\n );\n\n const removeContainer = useCallback((col: number, row: number) => {\n const key = `${col}-${row}`;\n if (container.current.has(key)) {\n const currentContainer = container.current.get(key);\n reconcilor.updateContainer(null, currentContainer, null);\n // group = currentContainer.containerInfo;\n container.current.delete(key);\n }\n }, []);\n\n const removeAllContainer = useCallback(() => {\n container.current.forEach((value, key) => {\n const currentContainer = value;\n reconcilor.updateContainer(null, currentContainer, null);\n });\n container.current.clear();\n }, []);\n\n useLayoutEffect(() => {\n // init and release\n // eslint-disable-next-line no-undef\n console.log('init', props, table);\n // table && (table._reactCreateGraphic = createGraphic); // never go to here\n // table?.renderWithRecreateCells();\n return () => {\n // eslint-disable-next-line no-undef\n console.log('release', props, table);\n };\n }, []);\n\n useLayoutEffect(() => {\n // update props\n // eslint-disable-next-line no-undef\n console.log('update props', props, table);\n\n table?.checkReactCustomLayout(removeAllContainer); // init reactCustomLayout component\n if (table && !table.reactCustomLayout?.hasReactCreateGraphic(componentId, isHeaderCustomLayout)) {\n table.reactCustomLayout?.setReactCreateGraphic(\n componentId,\n createGraphic,\n // container.current,\n isHeaderCustomLayout\n ); // set customLayout function\n table.reactCustomLayout?.setReactRemoveGraphic(componentId, removeContainer, isHeaderCustomLayout); // set customLayout function\n table.reactCustomLayout?.updateCustomCell(componentId, isHeaderCustomLayout); // update cell content\n } else if (table) {\n // update all container\n container.current.forEach((value, key) => {\n const [col, row] = key.split('-').map(Number);\n // const width = table.getColWidth(col); // to be fixed: may be merge cell\n // const height = table.getRowHeight(row); // to be fixed: may be merge cell\n const { width, height } = getCellRect(col, row, table);\n const currentContainer = value;\n const args = {\n col,\n row,\n dataValue: table.getCellOriginValue(col, row),\n value: table.getCellValue(col, row) || '',\n rect: {\n left: 0,\n top: 0,\n right: width,\n bottom: height,\n width,\n height\n },\n table\n };\n // update element in container\n const group = currentContainer.containerInfo;\n reconcilorUpdateContainer(children, currentContainer, args);\n // reconcilor.updateContainer(React.cloneElement(children, { ...args }), currentContainer, null);\n table.scenegraph.updateNextFrame();\n });\n }\n });\n\n return null;\n};\n\nfunction reconcilorUpdateContainer(children: ReactElement, currentContainer: any, args: any) {\n reconcilor.updateContainer(React.cloneElement(children, { ...args }), currentContainer, null);\n // group = group.firstChild;\n // if (isReactElement(group.attribute.html?.dom)) {\n // const div = document.createElement('div');\n // const root = ReactDOM.createRoot(div as HTMLElement);\n // root.render(group.attribute.html.dom);\n // group.attribute.html.dom = div;\n // // debugger;\n // // group.html.dom = div;\n // }\n}\n\nfunction getCellRect(col: number, row: number, table: any) {\n const range = table.getCellRange(col, row);\n const rect = table.getCellsRect(range.start.col, range.start.row, range.end.col, range.end.row);\n return rect;\n}\n"]}
|
|
@@ -1,18 +1,5 @@
|
|
|
1
1
|
import type { ReactElement, ReactNode, Ref, JSXElementConstructor } from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
type IGraphic = VRender.IGraphic;
|
|
4
|
-
type IGroupGraphicAttribute = VRender.IGroupGraphicAttribute;
|
|
5
|
-
type ITextGraphicAttribute = VRender.ITextGraphicAttribute;
|
|
6
|
-
type IEventParamsType = VRender.IEventParamsType;
|
|
7
|
-
type IArcGraphicAttribute = VRender.IArcGraphicAttribute;
|
|
8
|
-
type ICircleGraphicAttribute = VRender.ICircleGraphicAttribute;
|
|
9
|
-
type IImageGraphicAttribute = VRender.IImageGraphicAttribute;
|
|
10
|
-
type ILineGraphicAttribute = VRender.ILineGraphicAttribute;
|
|
11
|
-
type IPathGraphicAttribute = VRender.IPathGraphicAttribute;
|
|
12
|
-
type IRectGraphicAttribute = VRender.IRectGraphicAttribute;
|
|
13
|
-
type ISymbolGraphicAttribute = VRender.ISymbolGraphicAttribute;
|
|
14
|
-
type IRichTextGraphicAttribute = VRender.IRichTextGraphicAttribute;
|
|
15
|
-
type IPolygonGraphicAttribute = VRender.IPolygonGraphicAttribute;
|
|
2
|
+
import type { IGraphic, IGroupGraphicAttribute, ITextGraphicAttribute, IEventParamsType, IArcGraphicAttribute, ICircleGraphicAttribute, IImageGraphicAttribute, ILineGraphicAttribute, IPathGraphicAttribute, IRectGraphicAttribute, ISymbolGraphicAttribute, IRichTextGraphicAttribute, IPolygonGraphicAttribute } from '@visactor/vtable/es/vrender';
|
|
16
3
|
type GraphicProps<IGraphicGraphicAttribute> = {
|
|
17
4
|
attribute: IGraphicGraphicAttribute;
|
|
18
5
|
ref?: Ref<IGraphic>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["table-components/custom/graphic.ts"],"names":[],"mappings":";;;AA2Ba,QAAA,KAAK,GAGhB,OAAc,CAAC;AAEJ,QAAA,IAAI,GAGf,MAAa,CAAC;AAEH,QAAA,GAAG,GAGd,KAAY,CAAC;AAEF,QAAA,MAAM,GAGjB,QAAe,CAAC;AAEL,QAAA,KAAK,GAGhB,OAAc,CAAC;AAEJ,QAAA,IAAI,GAGf,MAAa,CAAC;AAEH,QAAA,IAAI,GAGf,MAAa,CAAC;AAEH,QAAA,IAAI,GAGf,MAAa,CAAC;AAEH,QAAA,MAAM,GAGjB,QAAe,CAAC;AAEL,QAAA,QAAQ,GAKjB,UAAiB,CAAC;AAET,QAAA,OAAO,GAKhB,SAAgB,CAAC","file":"graphic.js","sourcesContent":["// export const Group = 'group';\n// export const Rect = 'rect';\n// export const Text = 'text';\n\nimport type { ReactElement, ReactNode, Ref, JSXElementConstructor } from 'react';\nimport type {\n IGraphic,\n IGroupGraphicAttribute,\n ITextGraphicAttribute,\n IEventParamsType,\n IArcGraphicAttribute,\n ICircleGraphicAttribute,\n IImageGraphicAttribute,\n ILineGraphicAttribute,\n IPathGraphicAttribute,\n IRectGraphicAttribute,\n ISymbolGraphicAttribute,\n IRichTextGraphicAttribute,\n IPolygonGraphicAttribute\n} from '@visactor/vtable/es/vrender';\n\ntype GraphicProps<IGraphicGraphicAttribute> = {\n attribute: IGraphicGraphicAttribute;\n ref?: Ref<IGraphic>;\n children?: ReactNode;\n} & IEventParamsType;\n\nexport const Group: (\n props: GraphicProps<IGroupGraphicAttribute>\n) => ReactElement<GraphicProps<IGroupGraphicAttribute>, JSXElementConstructor<GraphicProps<IGroupGraphicAttribute>>> =\n 'group' as any;\n\nexport const Text: (\n props: GraphicProps<ITextGraphicAttribute>\n) => ReactElement<GraphicProps<ITextGraphicAttribute>, JSXElementConstructor<GraphicProps<ITextGraphicAttribute>>> =\n 'text' as any;\n\nexport const Arc: (\n props: GraphicProps<IArcGraphicAttribute>\n) => ReactElement<GraphicProps<IArcGraphicAttribute>, JSXElementConstructor<GraphicProps<IArcGraphicAttribute>>> =\n 'arc' as any;\n\nexport const Circle: (\n props: GraphicProps<ICircleGraphicAttribute>\n) => ReactElement<GraphicProps<ICircleGraphicAttribute>, JSXElementConstructor<GraphicProps<ICircleGraphicAttribute>>> =\n 'circle' as any;\n\nexport const Image: (\n props: GraphicProps<IImageGraphicAttribute>\n) => ReactElement<GraphicProps<IImageGraphicAttribute>, JSXElementConstructor<GraphicProps<IImageGraphicAttribute>>> =\n 'image' as any;\n\nexport const Line: (\n props: GraphicProps<ILineGraphicAttribute>\n) => ReactElement<GraphicProps<ILineGraphicAttribute>, JSXElementConstructor<GraphicProps<ILineGraphicAttribute>>> =\n 'line' as any;\n\nexport const Path: (\n props: GraphicProps<IPathGraphicAttribute>\n) => ReactElement<GraphicProps<IPathGraphicAttribute>, JSXElementConstructor<GraphicProps<IPathGraphicAttribute>>> =\n 'path' as any;\n\nexport const Rect: (\n props: GraphicProps<IRectGraphicAttribute>\n) => ReactElement<GraphicProps<IRectGraphicAttribute>, JSXElementConstructor<GraphicProps<IRectGraphicAttribute>>> =\n 'rect' as any;\n\nexport const Symbol: (\n props: GraphicProps<ISymbolGraphicAttribute>\n) => ReactElement<GraphicProps<ISymbolGraphicAttribute>, JSXElementConstructor<GraphicProps<ISymbolGraphicAttribute>>> =\n 'symbol' as any;\n\nexport const RichText: (\n props: GraphicProps<IRichTextGraphicAttribute>\n) => ReactElement<\n GraphicProps<IRichTextGraphicAttribute>,\n JSXElementConstructor<GraphicProps<IRichTextGraphicAttribute>>\n> = 'richtext' as any;\n\nexport const Polygon: (\n props: GraphicProps<IPolygonGraphicAttribute>\n) => ReactElement<\n GraphicProps<IPolygonGraphicAttribute>,\n JSXElementConstructor<GraphicProps<IPolygonGraphicAttribute>>\n> = 'polygon' as any;\n"]}
|
|
@@ -10,14 +10,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
10
10
|
value: !0
|
|
11
11
|
}), exports.reconcilor = void 0;
|
|
12
12
|
|
|
13
|
-
const
|
|
13
|
+
const vrender_1 = require("@visactor/vtable/es/vrender"), vutils_1 = require("@visactor/vutils"), react_1 = __importDefault(require("react")), react_reconciler_1 = __importDefault(require("react-reconciler")), constants_js_1 = require("react-reconciler/constants.js"), component_creater_1 = require("../../components/vrender-components/component-creater");
|
|
14
14
|
|
|
15
15
|
function createGraphic(type, props) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return application.graphicService.creator[type](props.attribute);
|
|
16
|
+
const component = (0, component_creater_1.createVRenderComponent)(type, props);
|
|
17
|
+
if (component) return component;
|
|
18
|
+
if (!vrender_1.application.graphicService.creator[type]) return;
|
|
19
|
+
return vrender_1.application.graphicService.creator[type](props.attribute);
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
function isEventProp(key, props) {
|
|
@@ -25,13 +24,16 @@ function isEventProp(key, props) {
|
|
|
25
24
|
}
|
|
26
25
|
|
|
27
26
|
function bindEventsToGraphic(graphic, props) {
|
|
28
|
-
for (const key in props) isEventProp(key, props) && graphic.addEventListener(REACT_TO_CANOPUS_EVENTS[key], props[key]);
|
|
27
|
+
for (const key in props) isEventProp(key, props) && vrender_1.REACT_TO_CANOPUS_EVENTS[key] && graphic.addEventListener(vrender_1.REACT_TO_CANOPUS_EVENTS[key], props[key]);
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
function updateGraphicProps(graphic, newProps, oldProps) {
|
|
32
|
-
|
|
33
|
-
for (const propKey in
|
|
34
|
-
|
|
31
|
+
var _a;
|
|
32
|
+
for (const propKey in oldProps) isEventProp(propKey, oldProps) && oldProps[propKey] !== newProps[propKey] && graphic.removeEventListener(vrender_1.REACT_TO_CANOPUS_EVENTS[propKey], oldProps[propKey]);
|
|
33
|
+
for (const propKey in newProps) isEventProp(propKey, newProps) && oldProps[propKey] !== newProps[propKey] && graphic.addEventListener(vrender_1.REACT_TO_CANOPUS_EVENTS[propKey], newProps[propKey]);
|
|
34
|
+
const attribute = null !== (_a = newProps.attribute) && void 0 !== _a ? _a : (0,
|
|
35
|
+
vutils_1.merge)({}, newProps);
|
|
36
|
+
graphic.initAttributes(attribute), "image" === graphic.type && graphic.loadImage(attribute.image);
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
//# sourceMappingURL=reconciler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["table-components/custom/reconciler.ts"],"names":[],"mappings":";;;;;;AAAA,yDAAwF;AAExF,6CAAqD;AACrD,kDAA0B;AAC1B,wEAA+C;AAC/C,gEAAqE;AACrE,6FAA+F;AAIlF,QAAA,UAAU,GAAG,IAAA,0BAAe,EAAC;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,CAAC;IACjB,CAAC;IAED,kBAAkB,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE;QAKrC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,kBAAkB,EAAE,CAAC,cAAwB,EAAE,aAAuB,EAAE,EAAE;QACxE,cAAc,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IACpC,CAAC;IAED,uBAAuB,EAAE,GAAG,EAAE,CAAC,KAAK;IAEpC,aAAa,EAAE,GAAG,EAAE,CAAC,IAAI;IAEzB,oBAAoB,EAAE,GAAG,EAAE,CAAC,KAAK;IAEjC,kBAAkB,EAAE,GAAG,EAAE,CAAC,IAAI;IAE9B,mBAAmB,EAAE,GAAG,EAAE,CAAC,IAAI;IAE/B,iBAAiB,EAAE,CAAC,QAAkB,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ED,MAAM,SAAS,GAAG,MAAA,QAAQ,CAAC,SAAS,mCAAI,IAAA,cAAK,EAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;IAC5D,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;AACH,CAAC","file":"reconciler.js","sourcesContent":["import { application, REACT_TO_CANOPUS_EVENTS, Tag } from '@visactor/vtable/es/vrender';\nimport type { Graphic, IGraphic, IGraphicCreator } from '@visactor/vtable/es/vrender';\nimport { isFunction, 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: process.env.NODE_ENV !== '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 // update all attribute\n const attribute = newProps.attribute ?? merge({}, newProps);\n graphic.initAttributes(attribute);\n if (graphic.type === 'image') {\n graphic.loadImage(attribute.image);\n }\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CreateDOMParamsType, IGraphic } from '@visactor/vtable/es/vrender';
|
|
2
|
+
import { ContainerModule } from '@visactor/vtable/es/vrender';
|
|
3
|
+
export type CreateDOMParamsTypeForVTable = CreateDOMParamsType & {
|
|
4
|
+
graphic: IGraphic;
|
|
5
|
+
style?: Record<string, any>;
|
|
6
|
+
};
|
|
7
|
+
export declare const reactEnvModule: ContainerModule;
|
|
@@ -4,13 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: !0
|
|
5
5
|
}), exports.reactEnvModule = void 0;
|
|
6
6
|
|
|
7
|
-
const vtable_1 = require("@visactor/vtable"),
|
|
7
|
+
const vtable_1 = require("@visactor/vtable"), vrender_1 = require("@visactor/vtable/es/vrender"), vutils_1 = require("@visactor/vutils");
|
|
8
8
|
|
|
9
|
-
exports.reactEnvModule = new ContainerModule(((bind, unbind, isBound, rebind) => {
|
|
10
|
-
bind(VTableBrowserEnvContribution).toSelf().inSingletonScope(), isBound(EnvContribution) ? rebind(EnvContribution).toService(VTableBrowserEnvContribution) : bind(EnvContribution).toService(VTableBrowserEnvContribution);
|
|
9
|
+
exports.reactEnvModule = new vrender_1.ContainerModule(((bind, unbind, isBound, rebind) => {
|
|
10
|
+
bind(VTableBrowserEnvContribution).toSelf().inSingletonScope(), isBound(vrender_1.EnvContribution) ? rebind(vrender_1.EnvContribution).toService(VTableBrowserEnvContribution) : bind(vrender_1.EnvContribution).toService(VTableBrowserEnvContribution);
|
|
11
11
|
}));
|
|
12
12
|
|
|
13
|
-
class VTableBrowserEnvContribution extends BrowserEnvContribution {
|
|
13
|
+
class VTableBrowserEnvContribution extends vrender_1.BrowserEnvContribution {
|
|
14
14
|
updateDom(dom, params) {
|
|
15
15
|
var _a, _b;
|
|
16
16
|
const tableDiv = dom.parentElement;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["table-components/custom/vtable-browser-env-contribution.ts"],"names":[],"mappings":";;;AAAA,6CAAiD;AAEjD,yDAAuG;AACvG,6CAA4C;AAO/B,QAAA,cAAc,GAAG,IAAI,yBAAe,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;IAClF,IAAI,CAAC,4BAA4B,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC/D,IAAI,OAAO,CAAC,yBAAe,CAAC,EAAE;QAC5B,MAAM,CAAC,yBAAe,CAAC,CAAC,SAAS,CAAC,4BAA4B,CAAC,CAAC;KACjE;SAAM;QACL,IAAI,CAAC,yBAAe,CAAC,CAAC,SAAS,CAAC,4BAA4B,CAAC,CAAC;KAC/D;AACH,CAAC,CAAC,CAAC;AAEH,MAAM,4BAA6B,SAAQ,gCAAsB;IAC/D,SAAS,CAAC,GAAgB,EAAE,M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AC,CAAC,OAAO,CAAC,CAAC,CAAM,EAAE,EAAE;oBACpC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;gBAC1B,CAAC,CAAC,CAAC;aACJ;SACF;QACD,IAAI,KAAK,IAAI,IAAI,EAAE;YACjB,GAAG,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,KAAK,IAAI,CAAC;SAChC;QACD,IAAI,MAAM,IAAI,IAAI,EAAE;YAClB,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC;SAClC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF","file":"vtable-browser-env-contribution.js","sourcesContent":["import { getTargetCell } from '@visactor/vtable';\nimport type { CreateDOMParamsType, IGraphic } from '@visactor/vtable/es/vrender';\nimport { ContainerModule, EnvContribution, BrowserEnvContribution } from '@visactor/vtable/es/vrender';\nimport { isString } from '@visactor/vutils';\n\nexport type CreateDOMParamsTypeForVTable = CreateDOMParamsType & {\n graphic: IGraphic;\n style?: Record<string, any>;\n};\n\nexport const reactEnvModule = new ContainerModule((bind, unbind, isBound, rebind) => {\n bind(VTableBrowserEnvContribution).toSelf().inSingletonScope();\n if (isBound(EnvContribution)) {\n rebind(EnvContribution).toService(VTableBrowserEnvContribution);\n } else {\n bind(EnvContribution).toService(VTableBrowserEnvContribution);\n }\n});\n\nclass VTableBrowserEnvContribution extends BrowserEnvContribution {\n updateDom(dom: HTMLElement, params: CreateDOMParamsTypeForVTable): boolean {\n const tableDiv = dom.parentElement;\n if (tableDiv) {\n const top = parseInt(params.style.top, 10);\n const left = parseInt(params.style.left, 10);\n\n let domWidth;\n let domHeight;\n if ((dom.style.display = 'none')) {\n const cellGroup = getTargetCell(params.graphic);\n domWidth = cellGroup.attribute.width ?? 1;\n domHeight = cellGroup.attribute.height ?? 1;\n } else {\n domWidth = dom.offsetWidth;\n domHeight = dom.offsetHeight;\n }\n if (top + domHeight < 0 || left + domWidth < 0 || top > tableDiv.offsetHeight || left > tableDiv.offsetWidth) {\n dom.style.display = 'none';\n return false;\n }\n }\n\n const { width, height, style } = params;\n\n if (style) {\n if (isString(style)) {\n dom.setAttribute('style', style);\n } else {\n Object.keys(style).forEach((k: any) => {\n dom.style[k] = style[k];\n });\n }\n }\n if (width != null) {\n dom.style.width = `${width}px`;\n }\n if (height != null) {\n dom.style.height = `${height}px`;\n }\n\n return true;\n }\n}\n"]}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
type CommonDomOptions = VRender.CommonDomOptions;
|
|
4
|
-
type CreateDOMParamsType = VRender.CreateDOMParamsType;
|
|
5
|
-
type IGraphic = VRender.CreateDOMParamsType;
|
|
6
|
-
type IStage = VRender.CreateDOMParamsType;
|
|
7
|
-
type SimpleDomStyleOptions = VRender.CreateDOMParamsType;
|
|
1
|
+
import type { CommonDomOptions, CreateDOMParamsType, IGraphic, IStage, SimpleDomStyleOptions } from '@visactor/vtable/es/vrender';
|
|
2
|
+
import { ReactAttributePlugin } from '@visactor/vtable/es/vrender';
|
|
8
3
|
export declare class VTableReactAttributePlugin extends ReactAttributePlugin {
|
|
9
4
|
removeElement(id: string): void;
|
|
10
5
|
renderGraphicHTML(graphic: IGraphic): void;
|
|
@@ -14,4 +9,3 @@ export declare class VTableReactAttributePlugin extends ReactAttributePlugin {
|
|
|
14
9
|
};
|
|
15
10
|
updateStyleOfWrapContainer(graphic: IGraphic, stage: IStage, wrapContainer: HTMLElement, nativeContainer: HTMLElement, options: SimpleDomStyleOptions & CommonDomOptions): void;
|
|
16
11
|
}
|
|
17
|
-
export {};
|
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: !0
|
|
5
5
|
}), exports.VTableReactAttributePlugin = void 0;
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const vrender_1 = require("@visactor/vtable/es/vrender"), vutils_1 = require("@visactor/vutils");
|
|
8
8
|
|
|
9
|
-
class VTableReactAttributePlugin extends ReactAttributePlugin {
|
|
9
|
+
class VTableReactAttributePlugin extends vrender_1.ReactAttributePlugin {
|
|
10
10
|
removeElement(id) {
|
|
11
11
|
super.removeElement(id), delete this.htmlMap[id];
|
|
12
12
|
}
|
|
@@ -40,9 +40,9 @@ class VTableReactAttributePlugin extends ReactAttributePlugin {
|
|
|
40
40
|
}
|
|
41
41
|
getWrapContainer(stage, userContainer, domParams) {
|
|
42
42
|
let nativeContainer;
|
|
43
|
-
return nativeContainer = userContainer ? "string" == typeof userContainer ? application.global.getElementById(userContainer) : userContainer : stage.window.getContainer(),
|
|
43
|
+
return nativeContainer = userContainer ? "string" == typeof userContainer ? vrender_1.application.global.getElementById(userContainer) : userContainer : stage.window.getContainer(),
|
|
44
44
|
{
|
|
45
|
-
wrapContainer: application.global.createDom(Object.assign({
|
|
45
|
+
wrapContainer: vrender_1.application.global.createDom(Object.assign({
|
|
46
46
|
tagName: "div",
|
|
47
47
|
parent: nativeContainer
|
|
48
48
|
}, domParams)),
|
|
@@ -65,7 +65,7 @@ class VTableReactAttributePlugin extends ReactAttributePlugin {
|
|
|
65
65
|
const anchor = (0, vutils_1.calculateAnchorOfBounds)(b, anchorType);
|
|
66
66
|
left = anchor.x, top = anchor.y;
|
|
67
67
|
}
|
|
68
|
-
const containerTL = application.global.getElementTopLeft(nativeContainer, !1), windowTL = stage.window.getTopLeft(!1), offsetX = left + windowTL.left - containerTL.left, offsetTop = top + windowTL.top - containerTL.top;
|
|
68
|
+
const containerTL = vrender_1.application.global.getElementTopLeft(nativeContainer, !1), windowTL = stage.window.getTopLeft(!1), offsetX = left + windowTL.left - containerTL.left, offsetTop = top + windowTL.top - containerTL.top;
|
|
69
69
|
if (calculateStyle.left = `${offsetX}px`, calculateStyle.top = `${offsetTop}px`,
|
|
70
70
|
"text" === graphic.type && "position" === anchorType && (calculateStyle = Object.assign(Object.assign({}, calculateStyle), this.getTransformOfText(graphic))),
|
|
71
71
|
(0, vutils_1.isFunction)(options.style)) {
|
|
@@ -79,7 +79,7 @@ class VTableReactAttributePlugin extends ReactAttributePlugin {
|
|
|
79
79
|
} else (0, vutils_1.isObject)(options.style) ? calculateStyle = Object.assign(Object.assign({}, calculateStyle), options.style) : (0,
|
|
80
80
|
vutils_1.isString)(options.style) && options.style && (calculateStyle = Object.assign(Object.assign({}, calculateStyle), (0,
|
|
81
81
|
vutils_1.styleStringToObject)(options.style)));
|
|
82
|
-
application.global.updateDom(wrapContainer, {
|
|
82
|
+
vrender_1.application.global.updateDom(wrapContainer, {
|
|
83
83
|
width: options.width,
|
|
84
84
|
height: options.width,
|
|
85
85
|
style: calculateStyle,
|
|
@@ -0,0 +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,CAAC;QAC5B,IAAI,CAAC,KAAK,EAAE;YACV,OAAO;SACR;QACD,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC;QACvC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;QACrC,IAAI,CAAC,CAAC,OAAO,IAAI,QAAQ,IAAI,QAAQ,CAAC,UAAU,CAAC,EAAE;YACjD,OAAO;SACR;QACD,MAAM,EAAE,GAAG,IAAA,cAAK,EAAC,KAAK,CAAC,EAAE,CAAC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MParamsType,\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"]}
|