@heartlandone/vega-react 1.27.0 → 1.27.2
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.
|
@@ -11,7 +11,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import React, { createElement } from 'react';
|
|
13
13
|
import { attachProps, camelToDashCase, createForwardRef, dashToPascalCase, isCoveredByReact, mergeRefs, } from './utils';
|
|
14
|
-
import { FeatureFlag } from '@heartlandone/vega';
|
|
15
14
|
export const createReactComponent = (tagName, ReactComponentContext, manipulatePropsFunction, defineCustomElement) => {
|
|
16
15
|
if (defineCustomElement !== undefined) {
|
|
17
16
|
defineCustomElement();
|
|
@@ -23,19 +22,9 @@ export const createReactComponent = (tagName, ReactComponentContext, manipulateP
|
|
|
23
22
|
this.setComponentElRef = (element) => {
|
|
24
23
|
this.componentEl = element;
|
|
25
24
|
};
|
|
26
|
-
/**
|
|
27
|
-
* While VEGA components use some keyword like `widnow` which only for browser environment, the SSR will not work as expect.
|
|
28
|
-
* To skip compare for SSR and CSR in Hydation we use same temporary dom. that will avoid Hydation failed and emit error messages.
|
|
29
|
-
* The `canRender` state is work for this, while it false we return the temporary dom for both SSR and CSR to skip Hydation check,
|
|
30
|
-
* while component did mount, we set it as true and then we can realy render the component.
|
|
31
|
-
*/
|
|
32
|
-
this.state = { canRender: false };
|
|
33
25
|
}
|
|
34
26
|
componentDidMount() {
|
|
35
27
|
this.componentDidUpdate(this.props);
|
|
36
|
-
if (FeatureFlag.isEnabled('VEGA_REACT.PREVENT_SSR')) {
|
|
37
|
-
this.setState({ canRender: true });
|
|
38
|
-
}
|
|
39
28
|
}
|
|
40
29
|
componentDidUpdate(prevProps) {
|
|
41
30
|
attachProps(this.componentEl, this.props, prevProps);
|
|
@@ -71,7 +60,7 @@ export const createReactComponent = (tagName, ReactComponentContext, manipulateP
|
|
|
71
60
|
* React.createElement causes all elements to be rendered
|
|
72
61
|
* as <tagname> instead of the actual Web Component.
|
|
73
62
|
*/
|
|
74
|
-
return
|
|
63
|
+
return createElement(tagName, newProps, children);
|
|
75
64
|
}
|
|
76
65
|
static get displayName() {
|
|
77
66
|
return displayName;
|
|
@@ -24,13 +24,11 @@ export const attachProps = (node, newProps, oldProps = {}) => {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
|
-
node
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
});
|
|
27
|
+
node[name] = newProps[name];
|
|
28
|
+
const propType = typeof newProps[name];
|
|
29
|
+
if (propType === 'string') {
|
|
30
|
+
node.setAttribute(camelToDashCase(name), newProps[name]);
|
|
31
|
+
}
|
|
34
32
|
}
|
|
35
33
|
});
|
|
36
34
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heartlandone/vega-react",
|
|
3
3
|
"sideEffects": false,
|
|
4
|
-
"version": "1.27.
|
|
4
|
+
"version": "1.27.2",
|
|
5
5
|
"description": "React specific wrapper for @heartlandone/vega",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"stencil-postbuild": "node ./src/scripts/stencil-post-build-script.js",
|
|
8
7
|
"build": "npm run clean && npm run compile",
|
|
9
8
|
"clean": "rm -rf dist",
|
|
10
9
|
"compile": "npm run tsc",
|
|
@@ -38,7 +37,7 @@
|
|
|
38
37
|
"typescript": "^4.0.0"
|
|
39
38
|
},
|
|
40
39
|
"dependencies": {
|
|
41
|
-
"@heartlandone/vega": "1.27.
|
|
40
|
+
"@heartlandone/vega": "1.27.2"
|
|
42
41
|
},
|
|
43
42
|
"peerDependencies": {
|
|
44
43
|
"react": ">=16.7.0",
|