dbm 1.0.5 → 1.1.0
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/flow/updatefunctions/dom/ElementPosition.js +1 -1
- package/flow/updatefunctions/dom/HorizontalFlip.js +5 -6
- package/flow/updatefunctions/dom/StyleObject.js +1 -1
- package/flow/updatefunctions/logic/Switch.js +6 -0
- package/graphapi/webclient/WebSocketConnection.js +13 -8
- package/graphapi/webclient/decode/index.js +16 -0
- package/loading/node/TextLoader.js +6 -5
- package/package.json +1 -1
- package/react/BaseObject.js +18 -7
- package/react/ChildFunctions.js +27 -0
- package/react/admin/EditPage.js +12 -1
- package/react/admin/{Editor.js → editor/Editor.js} +27 -11
- package/react/admin/{EditorBlock.js → editor/EditorBlock.js} +15 -4
- package/react/admin/editor/EditorBlockFields.js +23 -0
- package/react/admin/editor/EditorBlockName.js +28 -0
- package/react/admin/editor/fields/CheckboxField.js +54 -0
- package/react/admin/editor/fields/ImageField.js +137 -0
- package/react/admin/editor/fields/RichTextField.js +75 -0
- package/react/admin/editor/fields/TextField.js +53 -0
- package/react/admin/editor/fields/index.js +4 -0
- package/react/admin/editor/index.js +6 -0
- package/react/admin/index.js +3 -4
- package/react/animation/AnimatedElement.js +22 -0
- package/react/animation/AnimationController.js +53 -0
- package/react/animation/index.js +22 -0
- package/react/area/HasData.js +5 -0
- package/react/area/InsertElement.js +1 -1
- package/react/area/List.js +46 -0
- package/react/area/OpenCloseExpandableArea.js +5 -3
- package/react/area/ResponsiveLayout.js +48 -0
- package/react/area/index.js +12 -1
- package/react/blocks/Image.js +17 -0
- package/react/blocks/index.js +69 -55
- package/react/cookies/CookieSettings.js +1 -1
- package/react/form/Checkbox.js +2 -1
- package/react/form/FormField.js +1 -0
- package/react/form/LabelledArea.js +22 -0
- package/react/form/index.js +2 -1
- package/react/image/CoverScaledImage.js +32 -0
- package/react/image/Image.js +37 -0
- package/react/image/WidthScaledImage.js +30 -0
- package/react/image/index.js +3 -0
- package/react/index.js +6 -1
- package/react/login/LoginForm.js +1 -1
- package/react/source/index.js +15 -1
- package/react/text/Link.js +18 -0
- package/react/text/index.js +1 -0
- package/site/SiteDataLoader.js +1 -1
- package/tracking/Controller.js +1 -1
- package/updater/IntervalTimer.js +40 -0
- package/updater/index.js +14 -1
- package/utils/ArrayFunctions.js +58 -4
- package/utils/UrlFunctions.js +77 -0
- package/utils/index.js +2 -1
- package/react/admin/EditorBlockName.js +0 -19
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Dbm from "../../../../index.js";
|
|
3
|
+
|
|
4
|
+
export default class ImageField extends Dbm.react.BaseObject {
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
|
|
8
|
+
this._valueChangedBound = this._valueChanged.bind(this);
|
|
9
|
+
this._objectChangedBound = this._objectChanged.bind(this);
|
|
10
|
+
this._callback_fileChangedBound = this._callback_fileChanged.bind(this);
|
|
11
|
+
|
|
12
|
+
let fieldName = this.getPropValue("name");
|
|
13
|
+
|
|
14
|
+
let editorData = Dbm.objectPath(this.context, "moduleData.editorData");
|
|
15
|
+
|
|
16
|
+
Dbm.flow.addUpdateCommand(this.item.requireProperty("value", this._getObjectData()), Dbm.commands.callFunction(this._valueChangedBound));
|
|
17
|
+
|
|
18
|
+
Dbm.flow.addUpdateCommand(editorData.properties.data, Dbm.commands.callFunction(this._objectChangedBound));
|
|
19
|
+
|
|
20
|
+
let imageElement = React.createElement("div", {className: "flex-row small-item-spacing"},
|
|
21
|
+
React.createElement("div", {className: "flex-row-item flex-no-resize"},
|
|
22
|
+
React.createElement(Dbm.react.image.Image, {"src": Dbm.react.source.contextVariable("moduleData.editorData.data." + fieldName + ".url"), className: "editor-preview background-contain"}),
|
|
23
|
+
),
|
|
24
|
+
React.createElement("div", {className: "flex-row-item flex-resize"},
|
|
25
|
+
Dbm.react.text.text(Dbm.react.source.contextVariable("moduleData.editorData.data." + fieldName + ".url"))
|
|
26
|
+
),
|
|
27
|
+
React.createElement("div", {className: "flex-row-item flex-no-resize"},
|
|
28
|
+
React.createElement("div", {onClick: () => {this.removeImage()}}, "Remove")
|
|
29
|
+
)
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
let uploadElement = React.createElement("input", {"type": "file", onChange: this._callback_fileChangedBound, className: "full-width"});
|
|
33
|
+
|
|
34
|
+
let elementSwitch =Dbm.flow.updatefunctions.logic.switchValue(this.item.properties.value).setDefaultValue(imageElement).addCase(null, uploadElement);
|
|
35
|
+
|
|
36
|
+
this.item.requireProperty("element", null).connectInput(elementSwitch.output.properties.value);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
_getObjectData() {
|
|
40
|
+
let fieldName = this.getPropValue("name");
|
|
41
|
+
|
|
42
|
+
let editorData = Dbm.objectPath(this.context, "moduleData.editorData");
|
|
43
|
+
|
|
44
|
+
let returnData = editorData.data[fieldName];
|
|
45
|
+
if(!returnData) {
|
|
46
|
+
returnData = null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return returnData;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
_valueChanged() {
|
|
53
|
+
//console.log("_valueChanged");
|
|
54
|
+
|
|
55
|
+
let fieldName = this.getPropValue("name");
|
|
56
|
+
let newValue = this.item.value;
|
|
57
|
+
let editorData = Dbm.objectPath(this.context, "moduleData.editorData");
|
|
58
|
+
|
|
59
|
+
let newData = {...editorData.data};
|
|
60
|
+
newData[fieldName] = newValue;
|
|
61
|
+
|
|
62
|
+
editorData.data = newData;
|
|
63
|
+
this.context.moduleData.editorData.editorBlock.dataUpdated();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
_objectChanged() {
|
|
67
|
+
//console.log("_objectChanged");
|
|
68
|
+
|
|
69
|
+
let fieldName = this.getPropValue("name");
|
|
70
|
+
let editorData = Dbm.objectPath(this.context, "moduleData.editorData");
|
|
71
|
+
|
|
72
|
+
this.item.value = this._getObjectData();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
_callback_fileChanged(aEvent) {
|
|
76
|
+
console.log("_callback_fileChanged");
|
|
77
|
+
console.log(aEvent, aEvent.target.files);
|
|
78
|
+
|
|
79
|
+
let files = aEvent.target.files;
|
|
80
|
+
if(files.length > 0) {
|
|
81
|
+
this.uploadImage(files[0]);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
removeImage() {
|
|
86
|
+
this.item.value = null;
|
|
87
|
+
|
|
88
|
+
return this;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
uploadImage(aFile) {
|
|
92
|
+
|
|
93
|
+
let graphApi = Dbm.getInstance().repository.getItem("graphApi").controller;
|
|
94
|
+
|
|
95
|
+
let preSign = graphApi.requestData("fileUpload", {"fileName": aFile.name, "mimeType": aFile.type});
|
|
96
|
+
|
|
97
|
+
Dbm.flow.addDirectUpdateCommand(preSign.getProperty("status"), Dbm.commands.callFunction(this._statusChanged.bind(this), [preSign, aFile]));
|
|
98
|
+
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
_statusChanged(aPreSign, aFile) {
|
|
102
|
+
console.log("_statusChanged");
|
|
103
|
+
console.log(aPreSign, aFile);
|
|
104
|
+
|
|
105
|
+
if(aPreSign.status === 1) {
|
|
106
|
+
let url = aPreSign.data.url;
|
|
107
|
+
console.log(url, aPreSign.data);
|
|
108
|
+
|
|
109
|
+
let headers = {
|
|
110
|
+
'Content-Type': aFile.type,
|
|
111
|
+
'Cache-Control': 'no-cache',
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
let additionalHeaders = aPreSign.data.additionalHeaders;
|
|
115
|
+
for(let objectName in additionalHeaders) {
|
|
116
|
+
headers[objectName] = additionalHeaders[objectName];
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
fetch(url, {
|
|
120
|
+
method: 'PUT',
|
|
121
|
+
headers: new Headers(headers),
|
|
122
|
+
body: aFile
|
|
123
|
+
}).then(() => {
|
|
124
|
+
this.item.value = {url: aPreSign.data.publicUrl, resizeUrl: aPreSign.data.publicResizeUrl, identifier: aPreSign.data.identifier};
|
|
125
|
+
console.log("Uploaded", this.item.value);
|
|
126
|
+
//METODO: send update to editor
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
_renderMainElement() {
|
|
133
|
+
return this._createMainElement("div", {},
|
|
134
|
+
React.createElement(Dbm.react.area.InsertElement, {element: this.item.properties.element})
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Dbm from "../../../../index.js";
|
|
3
|
+
|
|
4
|
+
export default class RichTextField extends Dbm.react.BaseObject {
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
|
|
8
|
+
this._valueChangedBound = this._valueChanged.bind(this);
|
|
9
|
+
this._objectChangedBound = this._objectChanged.bind(this);
|
|
10
|
+
this._elementChangedBound = this._elementChanged.bind(this);
|
|
11
|
+
this._callback_inputBound = this._callback_input.bind(this);
|
|
12
|
+
|
|
13
|
+
this.createRef("contentElement");
|
|
14
|
+
Dbm.flow.addUpdateCommand(this.item.properties.contentElement, Dbm.commands.callFunction(this._elementChangedBound));
|
|
15
|
+
|
|
16
|
+
Dbm.flow.addUpdateCommand(this.item.requireProperty("value", this._getObjectData()), Dbm.commands.callFunction(this._valueChangedBound));
|
|
17
|
+
|
|
18
|
+
let editorData = Dbm.objectPath(this.context, "moduleData.editorData");
|
|
19
|
+
Dbm.flow.addUpdateCommand(editorData.properties.data, Dbm.commands.callFunction(this._objectChangedBound));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
_getObjectData() {
|
|
23
|
+
let fieldName = this.getPropValue("name");
|
|
24
|
+
|
|
25
|
+
let editorData = Dbm.objectPath(this.context, "moduleData.editorData");
|
|
26
|
+
|
|
27
|
+
let returnData = editorData.data[fieldName];
|
|
28
|
+
if(!returnData) {
|
|
29
|
+
returnData = "";
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return returnData;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
_valueChanged() {
|
|
36
|
+
//console.log("_valueChanged");
|
|
37
|
+
|
|
38
|
+
let fieldName = this.getPropValue("name");
|
|
39
|
+
let newValue = this.item.value;
|
|
40
|
+
let editorData = Dbm.objectPath(this.context, "moduleData.editorData");
|
|
41
|
+
|
|
42
|
+
let newData = {...editorData.data};
|
|
43
|
+
newData[fieldName] = newValue;
|
|
44
|
+
|
|
45
|
+
editorData.data = newData;
|
|
46
|
+
|
|
47
|
+
if(this.item.contentElement && newValue !== this.item.contentElement.innerHTML) {
|
|
48
|
+
this.item.contentElement.innerHTML = newValue;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
_objectChanged() {
|
|
53
|
+
//console.log("_objectChanged");
|
|
54
|
+
|
|
55
|
+
this.item.value = this._getObjectData();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
_elementChanged() {
|
|
59
|
+
//console.log("_elementChanged");
|
|
60
|
+
|
|
61
|
+
this.item.contentElement.innerHTML = this.item.value;
|
|
62
|
+
this.item.contentElement.addEventListener("input", this._callback_inputBound, false);
|
|
63
|
+
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
_callback_input(aEvent) {
|
|
67
|
+
//console.log("_callback_input");
|
|
68
|
+
|
|
69
|
+
this.item.value = "" + this.item.contentElement.innerHTML;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
_renderMainElement() {
|
|
73
|
+
return this._createMainElement("div", {contentEditable: true, ref: this.createRef("contentElement"), className: "standard-field standard-field-padding"});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Dbm from "../../../../index.js";
|
|
3
|
+
|
|
4
|
+
export default class TextField extends Dbm.react.BaseObject {
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
|
|
8
|
+
this._valueChangedBound = this._valueChanged.bind(this);
|
|
9
|
+
this._objectChangedBound = this._objectChanged.bind(this);
|
|
10
|
+
|
|
11
|
+
Dbm.flow.addUpdateCommand(this.item.requireProperty("value", this._getObjectData()), Dbm.commands.callFunction(this._valueChangedBound));
|
|
12
|
+
|
|
13
|
+
let editorData = Dbm.objectPath(this.context, "moduleData.editorData");
|
|
14
|
+
Dbm.flow.addUpdateCommand(editorData.properties.data, Dbm.commands.callFunction(this._objectChangedBound));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
_getObjectData() {
|
|
18
|
+
let fieldName = this.getPropValue("name");
|
|
19
|
+
|
|
20
|
+
let editorData = Dbm.objectPath(this.context, "moduleData.editorData");
|
|
21
|
+
|
|
22
|
+
let returnData = editorData.data[fieldName];
|
|
23
|
+
if(!returnData) {
|
|
24
|
+
returnData = "";
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return returnData;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
_valueChanged() {
|
|
32
|
+
//console.log("_valueChanged");
|
|
33
|
+
|
|
34
|
+
let fieldName = this.getPropValue("name");
|
|
35
|
+
let newValue = this.item.value;
|
|
36
|
+
let editorData = Dbm.objectPath(this.context, "moduleData.editorData");
|
|
37
|
+
|
|
38
|
+
let newData = {...editorData.data};
|
|
39
|
+
newData[fieldName] = newValue;
|
|
40
|
+
|
|
41
|
+
editorData.data = newData;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
_objectChanged() {
|
|
45
|
+
//console.log("_objectChanged");
|
|
46
|
+
|
|
47
|
+
this.item.value = this._getObjectData();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
_renderMainElement() {
|
|
51
|
+
return this._createMainElement(Dbm.react.form.FormField, {value: this.item.properties.value, className: "standard-field standard-field-padding full-width"});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export {default as Editor} from "./Editor.js";
|
|
2
|
+
export {default as EditorBlock} from "./EditorBlock.js";
|
|
3
|
+
export {default as EditorBlockName} from "./EditorBlockName.js";
|
|
4
|
+
export {default as EditorBlockFields} from "./EditorBlockFields.js";
|
|
5
|
+
|
|
6
|
+
export * as fields from "./fields/index.js";
|
package/react/admin/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export {default as Editor} from "./Editor.js";
|
|
2
|
-
export {default as EditorBlock} from "./EditorBlock.js";
|
|
3
|
-
export {default as EditorBlockName} from "./EditorBlockName.js";
|
|
4
1
|
export {default as CreatePage} from "./CreatePage.js";
|
|
5
|
-
export {default as EditPage} from "./EditPage.js";
|
|
2
|
+
export {default as EditPage} from "./EditPage.js";
|
|
3
|
+
|
|
4
|
+
export * as editor from "./editor/index.js";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Dbm from "../../index.js";
|
|
3
|
+
|
|
4
|
+
export default class AnimatedElement extends Dbm.react.BaseObject {
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
|
|
8
|
+
let controller = this.getPropValue("controller");
|
|
9
|
+
|
|
10
|
+
controller.propertyInput("element", this.item.requireProperty("animationElement", null));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
_renderMainElement() {
|
|
14
|
+
//console.log("AnimatedElement::_renderMainElement");
|
|
15
|
+
//console.log(this);
|
|
16
|
+
|
|
17
|
+
let controller = this.getPropValue("controller");
|
|
18
|
+
let children = this.getPropValue("children");
|
|
19
|
+
|
|
20
|
+
return this._createMainElement("div", {"ref": this.createRef("animationElement"), "style": controller.jsxStyle}, children);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Dbm from "../../index.js";
|
|
3
|
+
|
|
4
|
+
export default class AnimationController extends Dbm.core.BaseObject {
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
|
|
8
|
+
let updateStyleCommand = Dbm.commands.callFunction(this._updateStyle.bind(this));
|
|
9
|
+
|
|
10
|
+
Dbm.flow.addUpdateCommand(this.item.requireProperty("element", null), updateStyleCommand);
|
|
11
|
+
Dbm.flow.addUpdateCommand(this.item.requireProperty("style", {}), updateStyleCommand);
|
|
12
|
+
|
|
13
|
+
//METODO: add conversion to jsx
|
|
14
|
+
|
|
15
|
+
this.item.requireProperty("jsxStyle", {});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
_updateStyle() {
|
|
19
|
+
//console.log("_updateStyle");
|
|
20
|
+
let element = this.item.element;
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
if(element) {
|
|
25
|
+
|
|
26
|
+
let styleArray = [];
|
|
27
|
+
|
|
28
|
+
let styleObject = this.item.style;
|
|
29
|
+
for(let objectName in styleObject) {
|
|
30
|
+
styleArray.push(objectName + ": " + styleObject[objectName]);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
element.style = styleArray.join("; ");
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
_convertStyleToJsx() {
|
|
40
|
+
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
insertElement(aChildren) {
|
|
44
|
+
|
|
45
|
+
let reactElement = this.item.reactElement;
|
|
46
|
+
if(!reactElement) {
|
|
47
|
+
reactElement = React.createElement(Dbm.react.animation.AnimatedElement, {controller: this.item}, aChildren);
|
|
48
|
+
this.item.setValue("reactElement", reactElement);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return reactElement;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import Dbm from "../../index.js";
|
|
2
|
+
|
|
3
|
+
export {default as AnimatedElement} from "./AnimatedElement.js";
|
|
4
|
+
export {default as AnimationController} from "./AnimationController.js";
|
|
5
|
+
|
|
6
|
+
export const freeStyleAnimation = function() {
|
|
7
|
+
let newAnimationController = new Dbm.react.animation.AnimationController();
|
|
8
|
+
|
|
9
|
+
let styleObject = new Dbm.flow.updatefunctions.dom.StyleObject();
|
|
10
|
+
newAnimationController.item.propertyInput("style", styleObject.output.properties.style);
|
|
11
|
+
newAnimationController.item.setValue("styleProperties", styleObject);
|
|
12
|
+
|
|
13
|
+
return newAnimationController;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const connectedAnimation = function(aStyleProperty) {
|
|
17
|
+
let newAnimationController = new Dbm.react.animation.AnimationController();
|
|
18
|
+
|
|
19
|
+
newAnimationController.item.propertyInput("style", aStyleProperty);
|
|
20
|
+
|
|
21
|
+
return newAnimationController;
|
|
22
|
+
}
|
package/react/area/HasData.js
CHANGED
|
@@ -11,6 +11,11 @@ export default class HasData extends Dbm.react.BaseObject {
|
|
|
11
11
|
//console.log(this);
|
|
12
12
|
|
|
13
13
|
let data = this.getPropValue("check");
|
|
14
|
+
let checkType = this.getPropValue("checkType");
|
|
15
|
+
|
|
16
|
+
if(checkType === "invert/default") {
|
|
17
|
+
data = !data;
|
|
18
|
+
}
|
|
14
19
|
|
|
15
20
|
if(data) {
|
|
16
21
|
return React.createElement(React.Fragment, {}, this.getPropValue("children"));
|
|
@@ -10,7 +10,7 @@ export default class InsertElement extends Dbm.react.BaseObject {
|
|
|
10
10
|
//console.log("InsertElement::render");
|
|
11
11
|
//console.log(this);
|
|
12
12
|
|
|
13
|
-
let element = this.
|
|
13
|
+
let element = this.getPropValue("element");
|
|
14
14
|
|
|
15
15
|
if(!element) {
|
|
16
16
|
return React.createElement("div", {}, "No element set");
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Dbm from "../../index.js";
|
|
3
|
+
|
|
4
|
+
export default class List extends Dbm.react.BaseObject {
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
_renderMainElement() {
|
|
10
|
+
//console.log("List::_renderMainElement");
|
|
11
|
+
//console.log(this);
|
|
12
|
+
|
|
13
|
+
let items = this.getPropValue("items");
|
|
14
|
+
let children = this.getPropValue("children");
|
|
15
|
+
let keyField = this.getPropValue("keyField");
|
|
16
|
+
if(!keyField) {
|
|
17
|
+
keyField = "id";
|
|
18
|
+
}
|
|
19
|
+
let as = this.getPropValue("as");
|
|
20
|
+
if(!as) {
|
|
21
|
+
as = "item";
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
let slots = Dbm.react.ChildFunctions.splitIntoSlots(children);
|
|
25
|
+
|
|
26
|
+
let spacingElement = slots.spacing;
|
|
27
|
+
let mainChildren = slots.main;
|
|
28
|
+
|
|
29
|
+
let currentArray = items;
|
|
30
|
+
let currentArrayLength = currentArray.length;
|
|
31
|
+
let newChildren = [];
|
|
32
|
+
for(let i = 0; i < currentArrayLength; i++) {
|
|
33
|
+
if(spacingElement && i > 0) {
|
|
34
|
+
newChildren.push(React.createElement(React.Fragment, {key: "spacing" + (i-1)}, spacingElement));
|
|
35
|
+
}
|
|
36
|
+
let currentItem = currentArray[i];
|
|
37
|
+
let values = {};
|
|
38
|
+
values[as] = currentItem;
|
|
39
|
+
let key = Dbm.objectPath(currentItem, keyField);
|
|
40
|
+
newChildren.push(React.createElement(Dbm.react.context.AddContextVariables, {key: key, values: values}, mainChildren));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return React.createElement(React.Fragment, {}, newChildren);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
@@ -13,11 +13,13 @@ export default class OpenCloseExpandableArea extends Dbm.react.BaseObject {
|
|
|
13
13
|
let transformToStyle = Dbm.flow.updatefunctions.basic.transformValue(animateValueObject.properties.output, this._transformToStyle.bind(this));
|
|
14
14
|
|
|
15
15
|
this.item.requireProperty("animationStyle", {}).connectInput(transformToStyle.output.properties.value);
|
|
16
|
+
|
|
17
|
+
this.item.setValue("animation", Dbm.react.animation.connectedAnimation(transformToStyle.output.properties.value));
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
_transformToStyle(aEnvelope) {
|
|
19
|
-
console.log("_transformToStyle");
|
|
20
|
-
console.log(aEnvelope, this, this.item.element);
|
|
21
|
+
//console.log("_transformToStyle");
|
|
22
|
+
//console.log(aEnvelope, this, this.item.element);
|
|
21
23
|
|
|
22
24
|
if(aEnvelope === 0) {
|
|
23
25
|
return {"height": "0px", "overflow": "hidden"};
|
|
@@ -33,7 +35,7 @@ export default class OpenCloseExpandableArea extends Dbm.react.BaseObject {
|
|
|
33
35
|
//console.log("OpenCloseExpandableArea::_renderMainElement");
|
|
34
36
|
//console.log(this);
|
|
35
37
|
|
|
36
|
-
return this._createMainElement(Dbm.react.
|
|
38
|
+
return this._createMainElement(Dbm.react.animation.AnimatedElement, {"className": "animation-element", "controller": this.item.animation.item},
|
|
37
39
|
React.createElement("div", {"ref": this.createRef("element")},
|
|
38
40
|
this.getPropValue("children")
|
|
39
41
|
)
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import Dbm from "../../index.js";
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
export default class ResponsiveLayout extends Dbm.core.BaseObject {
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
|
|
8
|
+
this.item.setValue("widthElement", null);
|
|
9
|
+
|
|
10
|
+
let elementSize = new Dbm.flow.updatefunctions.dom.ElementSize();
|
|
11
|
+
this.item.setValue("elementSize", elementSize);
|
|
12
|
+
|
|
13
|
+
elementSize.input.properties.element.connectInput(this.item.properties.widthElement);
|
|
14
|
+
elementSize.start();
|
|
15
|
+
|
|
16
|
+
let layoutSwitch = new Dbm.flow.updatefunctions.logic.RangeSwitch();
|
|
17
|
+
layoutSwitch.input.properties.value.connectInput(elementSize.output.properties.width);
|
|
18
|
+
|
|
19
|
+
this.item.setValue("layoutSwitch", layoutSwitch)
|
|
20
|
+
|
|
21
|
+
this.item.setValue("element", null);
|
|
22
|
+
this.item.properties.element.connectInput(layoutSwitch.output.properties.value);
|
|
23
|
+
|
|
24
|
+
let refToProperty = new Dbm.react.RefToProperty();
|
|
25
|
+
refToProperty.property = this.item.properties.widthElement;
|
|
26
|
+
this.item.setValue("ref/widthElement", refToProperty);
|
|
27
|
+
|
|
28
|
+
this.item.setValue("mainElement", React.createElement("div", {ref: refToProperty},
|
|
29
|
+
React.createElement(Dbm.react.area.InsertElement, {element: this.item.properties.element})
|
|
30
|
+
));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
setDefaultLayout(aElement) {
|
|
34
|
+
this.item.layoutSwitch.input.defaultValue = React.createElement(React.Fragment, {"key": "default"}, aElement);
|
|
35
|
+
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
addLayout(aElement, aMinSize = null, aMaxSize = null) {
|
|
40
|
+
this.item.layoutSwitch.addValueForRange(React.createElement(React.Fragment, {"key": "layout_" + this.item.layoutSwitch.input.ranges.length}, aElement), aMinSize, aMaxSize);
|
|
41
|
+
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
get mainElement() {
|
|
46
|
+
return this.item.mainElement;
|
|
47
|
+
}
|
|
48
|
+
}
|
package/react/area/index.js
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
|
+
import Dbm from "../../index.js";
|
|
2
|
+
|
|
1
3
|
export {default as InsertElement} from "./InsertElement.js";
|
|
2
4
|
export {default as HasData} from "./HasData.js";
|
|
3
5
|
export {default as ScrollActivatedArea} from "./ScrollActivatedArea.js";
|
|
4
|
-
export {default as OpenCloseExpandableArea} from "./OpenCloseExpandableArea.js";
|
|
6
|
+
export {default as OpenCloseExpandableArea} from "./OpenCloseExpandableArea.js";
|
|
7
|
+
export {default as ResponsiveLayout} from "./ResponsiveLayout.js";
|
|
8
|
+
export {default as List} from "./List.js";
|
|
9
|
+
|
|
10
|
+
export let responsiveLayout = function(aDefaultLayout) {
|
|
11
|
+
let newResponsiveLayout = new Dbm.react.area.ResponsiveLayout();
|
|
12
|
+
newResponsiveLayout.setDefaultLayout(aDefaultLayout);
|
|
13
|
+
|
|
14
|
+
return newResponsiveLayout;
|
|
15
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Dbm from "../../index.js";
|
|
3
|
+
|
|
4
|
+
export default class Image extends Dbm.react.BaseObject {
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
_renderMainElement() {
|
|
10
|
+
|
|
11
|
+
let url = Dbm.utils.UrlFunctions.createScaledImageUrl(Dbm.objectPath(this.context, "blockData.file"), 800);
|
|
12
|
+
|
|
13
|
+
return this._createMainElement("div", {},
|
|
14
|
+
React.createElement(Dbm.react.image.Image, {elementType: "img", className: "full-width", src: url, alt: Dbm.react.source.blockData("caption")} )
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
}
|