native-document 1.0.138 → 1.0.139
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/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import {classPropertyAccumulator, cssPropertyAccumulator} from "../../utils";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
*
|
|
3
5
|
* @class
|
|
4
6
|
*/
|
|
5
7
|
export default function BaseComponent() {
|
|
6
8
|
this.$description = {};
|
|
9
|
+
this.$editableProps = null;
|
|
7
10
|
}
|
|
8
11
|
|
|
9
12
|
Object.defineProperty( BaseComponent.prototype, 'nd', {
|
|
@@ -83,4 +86,31 @@ BaseComponent.prototype.render = function(renderFn) {
|
|
|
83
86
|
}
|
|
84
87
|
this.$description.render = renderFn;
|
|
85
88
|
return this;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
BaseComponent.prototype.getEditableProps = function() {
|
|
92
|
+
if(!this.$editableProps) {
|
|
93
|
+
const rawProps = this.$description.props || {};
|
|
94
|
+
this.$editableProps = {
|
|
95
|
+
...rawProps,
|
|
96
|
+
class: classPropertyAccumulator(this.$description.props.class),
|
|
97
|
+
style: cssPropertyAccumulator(this.$description.props.style)
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return this.$editableProps;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
BaseComponent.prototype.resolveProps = function() {
|
|
105
|
+
if(!this.$editableProps) {
|
|
106
|
+
return { ...this.$description.props };
|
|
107
|
+
}
|
|
108
|
+
const props = { ...this.$editableProps };
|
|
109
|
+
if(props.class) {
|
|
110
|
+
props.class = props.class.value();
|
|
111
|
+
}
|
|
112
|
+
if(props.style) {
|
|
113
|
+
props.style = props.style.value();
|
|
114
|
+
}
|
|
115
|
+
return props;
|
|
86
116
|
};
|