goblin-gadgets 4.0.0 → 4.0.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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "goblin-gadgets",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"description": "Gadgets library",
|
|
5
5
|
"main": "./builders/builders.js",
|
|
6
6
|
"scripts": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"immutable": "4.0.0-rc.14",
|
|
19
19
|
"xcraft-core-goblin": "^5.0.0",
|
|
20
|
-
"xcraft-core-stones": "^0.
|
|
20
|
+
"xcraft-core-stones": "^0.4.0",
|
|
21
21
|
"xcraft-core-utils": "^4.0.0",
|
|
22
22
|
"goblin-nabu": "^2.0.0",
|
|
23
23
|
"goblin-toolbox": "^1.0.0",
|
package/test/code-parser.spec.js
CHANGED
|
@@ -28,6 +28,14 @@ describe('goblin.gadgets', function () {
|
|
|
28
28
|
});
|
|
29
29
|
});
|
|
30
30
|
|
|
31
|
+
it('parseCode other string', function () {
|
|
32
|
+
const code = `<Button text='hello "world"'/>`;
|
|
33
|
+
const res = parseCode(code);
|
|
34
|
+
assert.deepStrictEqual(res, {
|
|
35
|
+
text: 'hello "world"',
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
|
31
39
|
it('parseCode boolean', function () {
|
|
32
40
|
const code = `<Button visibility={true} show={true}/>`;
|
|
33
41
|
const res = parseCode(code);
|
|
@@ -19,8 +19,8 @@ class DynamicToolbar extends Widget {
|
|
|
19
19
|
showToolbar: false,
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
this.toolbar =
|
|
23
|
-
this.toolbarButton =
|
|
22
|
+
this.toolbar = React.createRef();
|
|
23
|
+
this.toolbarButton = React.createRef();
|
|
24
24
|
this.counter = 0;
|
|
25
25
|
|
|
26
26
|
this.onShowToolbar = this.onShowToolbar.bind(this);
|
|
@@ -38,8 +38,9 @@ class DynamicToolbar extends Widget {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
onShowToolbar() {
|
|
41
|
-
if (this.toolbarButton) {
|
|
42
|
-
const rect = this.toolbarButton.getBoundingClientRect();
|
|
41
|
+
if (this.toolbarButton.current) {
|
|
42
|
+
const rect = this.toolbarButton.current.getBoundingClientRect();
|
|
43
|
+
|
|
43
44
|
this.ToolbarLeft = rect.left;
|
|
44
45
|
this.ToolbarTop = rect.top;
|
|
45
46
|
}
|
|
@@ -57,8 +58,9 @@ class DynamicToolbar extends Widget {
|
|
|
57
58
|
|
|
58
59
|
let x = e.clientX;
|
|
59
60
|
let y = e.clientY;
|
|
60
|
-
if (this.toolbar) {
|
|
61
|
-
const rect = this.toolbar.getBoundingClientRect();
|
|
61
|
+
if (this.toolbar.current) {
|
|
62
|
+
const rect = this.toolbar.current.getBoundingClientRect();
|
|
63
|
+
|
|
62
64
|
const margin = this.props.detectMargin ? this.props.detectMargin : 20;
|
|
63
65
|
if (
|
|
64
66
|
x < rect.left - margin ||
|
|
@@ -75,14 +77,13 @@ class DynamicToolbar extends Widget {
|
|
|
75
77
|
renderHoverButton() {
|
|
76
78
|
const style = this.styles.classNames.hoverButton;
|
|
77
79
|
return (
|
|
78
|
-
<div className={style}>
|
|
80
|
+
<div className={style} ref={this.toolbarButton}>
|
|
79
81
|
<Button
|
|
80
82
|
width="24px"
|
|
81
83
|
height="24px"
|
|
82
84
|
kind="dynamic-toolbar-top-left"
|
|
83
85
|
glyph={this.props.glyph || 'solid/ellipsis-h'}
|
|
84
86
|
mouseOver={this.onShowToolbar}
|
|
85
|
-
ref={(node) => (this.toolbarButton = node)}
|
|
86
87
|
/>
|
|
87
88
|
</div>
|
|
88
89
|
);
|
|
@@ -106,7 +107,7 @@ class DynamicToolbar extends Widget {
|
|
|
106
107
|
: this.styles.classNames.boxHidden; // toolbar hidden to left
|
|
107
108
|
|
|
108
109
|
return (
|
|
109
|
-
<div className={boxClass} ref={
|
|
110
|
+
<div className={boxClass} ref={this.toolbar}>
|
|
110
111
|
{this.props.children}
|
|
111
112
|
</div>
|
|
112
113
|
);
|
|
@@ -6,7 +6,7 @@ module.exports = function parseCode(code) {
|
|
|
6
6
|
const [_, name, propsStr, children] = matchComponent;
|
|
7
7
|
|
|
8
8
|
// Match propName, opening brace for propValue and propValue
|
|
9
|
-
const propsRegex = /\s+(\w+)=(?:("[^"]*")|{(.*?(?=}
|
|
9
|
+
const propsRegex = /\s+(\w+)=(?:("[^"]*"|'[^']*')|{(.*?(?=}))})/g;
|
|
10
10
|
|
|
11
11
|
let match;
|
|
12
12
|
const props = {};
|
package/widgets/wizard/widget.js
CHANGED
|
@@ -75,7 +75,7 @@ class Wizard extends Form {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
getGlobalSettingValue(id) {
|
|
78
|
-
return this.
|
|
78
|
+
return this.getBackendState(`${this.props.id}.globalSettings.${id}.value`);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
setGlobalSettingValue(id, value) {
|
|
@@ -91,21 +91,21 @@ class Wizard extends Form {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
get widgets() {
|
|
94
|
-
return this.
|
|
94
|
+
return this.getBackendState(`${this.props.id}.properties`);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
get properties() {
|
|
98
|
-
return this.
|
|
98
|
+
return this.getBackendState(`${this.props.id}.properties`).get(this.widget);
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
get previewSettings() {
|
|
102
|
-
return this.
|
|
102
|
+
return this.getBackendState(`${this.props.id}.previewSettings`).filter(
|
|
103
103
|
(preview) => preview.size > 0
|
|
104
104
|
);
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
getPreviewSettingValue(id) {
|
|
108
|
-
return this.
|
|
108
|
+
return this.getBackendState(`${this.props.id}.previewSettings.${id}.value`);
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
setPreviewSettingValue(id, value) {
|
|
@@ -225,7 +225,10 @@ class Wizard extends Form {
|
|
|
225
225
|
width="32px"
|
|
226
226
|
focusable={true}
|
|
227
227
|
onChange={() => {
|
|
228
|
-
this.setModelValue(
|
|
228
|
+
this.setModelValue(
|
|
229
|
+
model,
|
|
230
|
+
!this.getBackendState(this.props.id + model)
|
|
231
|
+
);
|
|
229
232
|
}}
|
|
230
233
|
/>
|
|
231
234
|
</Container>
|