isomorfeus-react 16.13.9 → 16.13.10
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.
- checksums.yaml +4 -4
- data/lib/isomorfeus_react/lucid_component/native_component_constructor.rb +1 -1
- data/lib/isomorfeus_react/lucid_component/native_lucid_component_constructor.rb +2 -27
- data/lib/isomorfeus_react_material/lucid_material/component/native_component_constructor.rb +1 -1
- data/lib/react.rb +33 -0
- data/lib/react/component/native_component_constructor.rb +2 -27
- data/lib/react/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53c0609232408add3a50daefcd5b1a0cc8226a5320364378000ce4a2dce7b514
|
4
|
+
data.tar.gz: 8b59169b1677d0d43111bc058033f0f4e19a0fcde099d864b97ecc2ac5d66b34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 629628dadea198a9bf3257c9eeafe9408e7bc428d7557ba01eafe35dc3ffbebf36a72f2964d4b30b944f1edfafcfdf03f05b0ebbf4a1ede6c2c6552279fdf672
|
7
|
+
data.tar.gz: 6b2a9d8587857ee38d9691c62f2ce84556c33ff7fad4c3b111be986a952f7476f271ab7fa20577856a483c0d831683de0b2b6050e65e777bcd902ddfd7eda4a4
|
@@ -27,7 +27,7 @@ module LucidComponent
|
|
27
27
|
new_props.theme = theme;
|
28
28
|
new_props.store = store;
|
29
29
|
return opag.React.createElement(base.lucid_react_component, new_props);
|
30
|
-
},
|
30
|
+
}, Opal.React.props_are_equal);
|
31
31
|
base.react_component.displayName = #{component_name};
|
32
32
|
}
|
33
33
|
end
|
@@ -62,33 +62,8 @@ module LucidComponent
|
|
62
62
|
return this.props.store;
|
63
63
|
}
|
64
64
|
shouldComponentUpdate(next_props, next_state) {
|
65
|
-
|
66
|
-
|
67
|
-
for (var property in next_props) {
|
68
|
-
counter++;
|
69
|
-
if (next_props.hasOwnProperty(property)) {
|
70
|
-
if (!this_props.hasOwnProperty(property)) { return true; };
|
71
|
-
if (property === "children") { if (next_props.children !== this_props.children) { return true; }}
|
72
|
-
else if (typeof next_props[property] === "object" && next_props[property] !== null && typeof next_props[property]['$!='] === "function" &&
|
73
|
-
typeof this_props[property] !== "undefined" && this_props[property] !== null ) {
|
74
|
-
if (#{ !! (`next_props[property]` != `this_props[property]`) }) { return true; }
|
75
|
-
} else if (next_props[property] !== this_props[property]) { return true; }
|
76
|
-
}
|
77
|
-
}
|
78
|
-
if (counter !== Object.keys(this_props).length) { return true; }
|
79
|
-
counter = 0;
|
80
|
-
const this_state = this.state;
|
81
|
-
for (var property in next_state) {
|
82
|
-
counter++;
|
83
|
-
if (next_state.hasOwnProperty(property)) {
|
84
|
-
if (!this_state.hasOwnProperty(property)) { return true; };
|
85
|
-
if (typeof next_state[property] === "object" && next_state[property] !== null && typeof next_state[property]['$!='] === "function" &&
|
86
|
-
typeof this_state[property] !== "undefined" && this_state[property] !== null) {
|
87
|
-
if (#{ !! (`next_state[property]` != `this_state[property]`) }) { return true }
|
88
|
-
} else if (next_state[property] !== this_state[property]) { return true }
|
89
|
-
}
|
90
|
-
}
|
91
|
-
if (counter !== Object.keys(this_state).length) { return true; }
|
65
|
+
if (!Opal.React.props_are_equal(this.props, next_props)) { return true; }
|
66
|
+
if (Opal.React.state_is_not_equal(this.state, next_state)) { return true; }
|
92
67
|
return false;
|
93
68
|
}
|
94
69
|
validateProp(props, propName, componentName) {
|
@@ -27,7 +27,7 @@ module LucidMaterial
|
|
27
27
|
new_props.theme = theme;
|
28
28
|
new_props.store = store;
|
29
29
|
return Opal.global.React.createElement(base.lucid_react_component, new_props);
|
30
|
-
},
|
30
|
+
}, Opal.React.props_are_equal);
|
31
31
|
base.react_component.displayName = #{component_name};
|
32
32
|
}
|
33
33
|
end
|
data/lib/react.rb
CHANGED
@@ -12,6 +12,39 @@ module React
|
|
12
12
|
core.propTypes[prop_name] = core.prototype.validateProp;
|
13
13
|
};
|
14
14
|
|
15
|
+
self.props_are_equal = function(this_props, next_props) {
|
16
|
+
let counter = 0;
|
17
|
+
for (var property in next_props) {
|
18
|
+
counter++;
|
19
|
+
if (next_props.hasOwnProperty(property)) {
|
20
|
+
if (!this_props.hasOwnProperty(property)) { return false; };
|
21
|
+
if (property === "children") { if (next_props.children !== this_props.children) { return false; }}
|
22
|
+
else if (typeof next_props[property] === "object" && next_props[property] !== null && typeof next_props[property]['$!='] === "function" &&
|
23
|
+
typeof this_props[property] !== "undefined" && this_props[property] !== null ) {
|
24
|
+
if (#{ !! (`next_props[property]` != `this_props[property]`) }) { return false; }
|
25
|
+
} else if (next_props[property] !== this_props[property]) { return false; }
|
26
|
+
}
|
27
|
+
}
|
28
|
+
if (counter !== Object.keys(this_props).length) { return false; }
|
29
|
+
return true;
|
30
|
+
};
|
31
|
+
|
32
|
+
self.state_is_not_equal = function(this_state, next_state) {
|
33
|
+
let counter = 0;
|
34
|
+
for (var property in next_state) {
|
35
|
+
counter++;
|
36
|
+
if (next_state.hasOwnProperty(property)) {
|
37
|
+
if (!this_state.hasOwnProperty(property)) { return true; };
|
38
|
+
if (typeof next_state[property] === "object" && next_state[property] !== null && typeof next_state[property]['$!='] === "function" &&
|
39
|
+
typeof this_state[property] !== "undefined" && this_state[property] !== null) {
|
40
|
+
if (#{ !! (`next_state[property]` != `this_state[property]`) }) { return true }
|
41
|
+
} else if (next_state[property] !== this_state[property]) { return true }
|
42
|
+
}
|
43
|
+
}
|
44
|
+
if (counter !== Object.keys(this_state).length) { return true; }
|
45
|
+
return false;
|
46
|
+
};
|
47
|
+
|
15
48
|
self.lower_camelize = function(snake_cased_word) {
|
16
49
|
if (self.prop_dictionary[snake_cased_word]) { return self.prop_dictionary[snake_cased_word]; }
|
17
50
|
let parts = snake_cased_word.split('_');
|
@@ -53,33 +53,8 @@ module React
|
|
53
53
|
if (base.should_component_update_block) {
|
54
54
|
return #{!!`this.__ruby_instance`.instance_exec(React::Component::Props.new(`{props: next_props}`), React::Component::State.new(`{state: next_state }`), &`base.should_component_update_block`)};
|
55
55
|
}
|
56
|
-
|
57
|
-
|
58
|
-
for (var property in next_props) {
|
59
|
-
counter++;
|
60
|
-
if (next_props.hasOwnProperty(property)) {
|
61
|
-
if (!this_props.hasOwnProperty(property)) { return true; };
|
62
|
-
if (property === "children") { if (next_props.children !== this_props.children) { return true; }}
|
63
|
-
else if (typeof next_props[property] === "object" && next_props[property] !== null && typeof next_props[property]['$!='] === "function" &&
|
64
|
-
typeof this_props[property] !== "undefined" && this_props[property] !== null ) {
|
65
|
-
if (#{ !! (`next_props[property]` != `this_props[property]`) }) { return true; }
|
66
|
-
} else if (next_props[property] !== this_props[property]) { return true; }
|
67
|
-
}
|
68
|
-
}
|
69
|
-
if (counter !== Object.keys(this_props).length) { return true; }
|
70
|
-
counter = 0;
|
71
|
-
const this_state = this.state;
|
72
|
-
for (var property in next_state) {
|
73
|
-
counter++;
|
74
|
-
if (next_state.hasOwnProperty(property)) {
|
75
|
-
if (!this_state.hasOwnProperty(property)) { return true; };
|
76
|
-
if (typeof next_state[property] === "object" && next_state[property] !== null && typeof next_state[property]['$!='] === "function" &&
|
77
|
-
typeof this_state[property] !== "undefined" && this_state[property] !== null) {
|
78
|
-
if (#{ !! (`next_state[property]` != `this_state[property]`) }) { return true }
|
79
|
-
} else if (next_state[property] !== this_state[property]) { return true }
|
80
|
-
}
|
81
|
-
}
|
82
|
-
if (counter !== Object.keys(this_state).length) { return true; }
|
56
|
+
if (!Opal.React.props_are_equal(this.props, next_props)) { return true; }
|
57
|
+
if (Opal.React.state_is_not_equal(this.state, next_state)) { return true; }
|
83
58
|
return false;
|
84
59
|
}
|
85
60
|
validateProp(props, propName, componentName) {
|
data/lib/react/version.rb
CHANGED