dbm 1.2.9 → 1.4.1
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/css/admin.css +99 -0
- package/css/all.css +8 -0
- package/css/elements.css +27 -0
- package/css/icons.css +40 -0
- package/css/ratio.css +11 -0
- package/css/rows.css +28 -0
- package/css/tags.css +114 -0
- package/css/utils.css +256 -0
- package/css/variables.css +3 -0
- package/graphapi/webclient/decode/Relations.js +18 -11
- package/loading/ImageLoader.js +65 -0
- package/loading/index.js +27 -1
- package/package.json +10 -4
- package/react/BaseObject.js +5 -3
- package/react/admin/CreatePage.js +2 -2
- package/react/admin/objects/itemeditors/FormattedField.js +21 -0
- package/react/admin/objects/itemeditors/FormattedFieldWithTranslations.js +38 -0
- package/react/admin/objects/itemeditors/MultipleRelations.js +147 -0
- package/react/admin/objects/itemeditors/RichTextField.js +21 -0
- package/react/admin/objects/itemeditors/RichTextFieldWithTranslations.js +38 -0
- package/react/admin/objects/itemeditors/index.js +5 -0
- package/react/area/InsertElement.js +2 -1
- package/react/blocks/faq/AskAQuestion.js +1 -0
- package/react/image/gallery/ImageGallery.js +84 -0
- package/react/image/gallery/ImageGallerySection.js +220 -0
- package/react/image/gallery/index.js +2 -0
- package/react/image/index.js +3 -1
- package/react/index.js +2 -0
- package/react/svg/GlobalFilters.js +22 -0
- package/react/svg/MatrixFilter.js +25 -0
- package/react/svg/index.js +43 -0
- package/react/thirdparty/index.js +2 -0
- package/react/thirdparty/tinymce/Editor.js +106 -0
- package/react/thirdparty/tinymce/InlineEditor.js +28 -0
- package/react/thirdparty/tinymce/index.js +2 -0
- package/react/thirdparty/vimeo/Player.js +65 -0
- package/react/thirdparty/vimeo/index.js +1 -0
- package/repository/Item.js +28 -0
- package/utils/ArrayFunctions.js +69 -0
- package/utils/StringFunctions.js +12 -1
- package/utils/index.js +2 -1
- package/utils/svg/ColorMatrixFunctions.js +12 -0
- package/utils/svg/index.js +1 -0
package/loading/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import Dbm from "../index.js";
|
|
2
2
|
export {default as ScriptLoader} from "./ScriptLoader.js";
|
|
3
3
|
export {default as JsonLoader} from "./JsonLoader.js";
|
|
4
|
+
export {default as ImageLoader} from "./ImageLoader.js";
|
|
4
5
|
export * as LoadingStatus from "./LoadingStatus.js";
|
|
5
6
|
|
|
6
7
|
export * as node from "./node/index.js";
|
|
7
8
|
|
|
8
|
-
export
|
|
9
|
+
export const loadScript = function(aUrl) {
|
|
9
10
|
|
|
10
11
|
let loaderName = "loader-" + aUrl;
|
|
11
12
|
let loaderItem = Dbm.getInstance().repository.getItemIfExists(loaderName);
|
|
@@ -22,5 +23,30 @@ export let loadScript = function(aUrl) {
|
|
|
22
23
|
|
|
23
24
|
loader.load();
|
|
24
25
|
|
|
26
|
+
return loader;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const getImageLoader = function(aUrl) {
|
|
30
|
+
let loaderName = "imageLoader-" + aUrl;
|
|
31
|
+
let loaderItem = Dbm.getInstance().repository.getItemIfExists(loaderName);
|
|
32
|
+
|
|
33
|
+
let loader;
|
|
34
|
+
if(!loaderItem) {
|
|
35
|
+
loader = new Dbm.loading.ImageLoader();
|
|
36
|
+
loader.item.register(loaderName);
|
|
37
|
+
loader.setUrl(aUrl);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
loader = loaderItem.controller;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return loader;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const loadImage = function(aUrl) {
|
|
47
|
+
|
|
48
|
+
let loader = getImageLoader(aUrl);
|
|
49
|
+
loader.load();
|
|
50
|
+
|
|
25
51
|
return loader;
|
|
26
52
|
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dbm",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./index.js",
|
|
8
|
+
"./css/all.css": "./css/all.css"
|
|
9
|
+
},
|
|
6
10
|
"scripts": {},
|
|
7
11
|
"keywords": [],
|
|
8
12
|
"author": "",
|
|
@@ -10,8 +14,10 @@
|
|
|
10
14
|
"description": "",
|
|
11
15
|
"dependencies": {
|
|
12
16
|
"@tweenjs/tween.js": "^25.0.0",
|
|
13
|
-
"js-cookie": "^3.0.5"
|
|
14
|
-
|
|
15
|
-
|
|
17
|
+
"js-cookie": "^3.0.5"
|
|
18
|
+
},
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"react": ">=18",
|
|
21
|
+
"react-dom": ">=18"
|
|
16
22
|
}
|
|
17
23
|
}
|
package/react/BaseObject.js
CHANGED
|
@@ -164,7 +164,10 @@ export default class BaseObject extends Component {
|
|
|
164
164
|
_copyProps(aProps) {
|
|
165
165
|
let newProps = {...aProps};
|
|
166
166
|
|
|
167
|
-
|
|
167
|
+
let incomingProps = {...this.props};
|
|
168
|
+
this._removedUsedProps(incomingProps);
|
|
169
|
+
|
|
170
|
+
for(let objectName in incomingProps) {
|
|
168
171
|
let currentValue = this.getPropValue(objectName);
|
|
169
172
|
switch(objectName) {
|
|
170
173
|
case "className":
|
|
@@ -203,8 +206,7 @@ export default class BaseObject extends Component {
|
|
|
203
206
|
break;
|
|
204
207
|
}
|
|
205
208
|
}
|
|
206
|
-
|
|
207
|
-
this._removedUsedProps(newProps);
|
|
209
|
+
|
|
208
210
|
return newProps;
|
|
209
211
|
}
|
|
210
212
|
|
|
@@ -101,13 +101,13 @@ export default class CreatePage extends Dbm.react.BaseObject {
|
|
|
101
101
|
{"type": "setUrl", "data": {"value": fullUrl}}
|
|
102
102
|
]
|
|
103
103
|
|
|
104
|
-
let request = Dbm.
|
|
104
|
+
let request = Dbm.getGraphApi().createItem(["page"], "public", changes);
|
|
105
105
|
|
|
106
106
|
Dbm.flow.addUpdateCommand(request.properties.status, Dbm.commands.callFunction(this._pageCreated.bind(this), [fullUrl]));
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
_pageCreated(aUrl) {
|
|
110
|
-
Dbm.
|
|
110
|
+
Dbm.getRepositoryItem("siteNavigation").controller.navigate(aUrl);
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
_renderMainElement() {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Dbm from "../../../../index.js";
|
|
3
|
+
|
|
4
|
+
export default class FormattedField extends Dbm.react.BaseObject {
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
_renderMainElement() {
|
|
10
|
+
|
|
11
|
+
let label = this.getPropValue("label");
|
|
12
|
+
let fieldName = this.getPropValue("fieldName");
|
|
13
|
+
|
|
14
|
+
return React.createElement("div", {},
|
|
15
|
+
React.createElement(Dbm.react.form.LabelledArea, {label: label}),
|
|
16
|
+
React.createElement(Dbm.react.admin.editorsgroup.EditField, {"fieldName": fieldName},
|
|
17
|
+
React.createElement(Dbm.react.thirdparty.tinymce.InlineEditor, {value: Dbm.react.source.contextVariable("valueEditor.editValue.value"), className: "standard-field standard-field-padding full-width"})
|
|
18
|
+
)
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Dbm from "../../../../index.js";
|
|
3
|
+
|
|
4
|
+
export default class FormattedFieldWithTranslations extends Dbm.react.BaseObject {
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
_renderMainElement() {
|
|
10
|
+
|
|
11
|
+
let label = this.getPropValue("label");
|
|
12
|
+
let fieldName = this.getPropValue("fieldName");
|
|
13
|
+
|
|
14
|
+
let fieldNameSource = Dbm.react.source.contextVariable("fieldName");
|
|
15
|
+
let editorValueSource = Dbm.react.source.contextVariable("valueEditor.editValue.value");
|
|
16
|
+
|
|
17
|
+
return React.createElement("div", {},
|
|
18
|
+
React.createElement("label", {className: "standard-field-label"}, label),
|
|
19
|
+
React.createElement(Dbm.react.context.AddContextVariables, {values: {"fieldName": fieldName}},
|
|
20
|
+
React.createElement(Dbm.react.admin.editorsgroup.EditField, {"fieldName": fieldNameSource},
|
|
21
|
+
React.createElement(Dbm.react.thirdparty.tinymce.InlineEditor, {value: editorValueSource, className: "standard-field standard-field-padding full-width"})
|
|
22
|
+
),
|
|
23
|
+
React.createElement(Dbm.react.area.List, {items: Dbm.getRepositoryItem("site").properties.availableLanguages, as: "language"},
|
|
24
|
+
React.createElement("div", {className: "flex-row small-item-spacing vertically-center-items"},
|
|
25
|
+
React.createElement("div", {className: "flex-row-item flex-no-resize"},
|
|
26
|
+
Dbm.react.text.text(Dbm.react.source.contextVariable("language.code"))
|
|
27
|
+
),
|
|
28
|
+
React.createElement("div", {className: "flex-row-item flex-resize"},
|
|
29
|
+
React.createElement(Dbm.react.admin.editorsgroup.EditFieldTranslation, {"fieldName": fieldNameSource, "language": Dbm.react.source.contextVariable("language.code")},
|
|
30
|
+
React.createElement(Dbm.react.thirdparty.tinymce.InlineEditor, {value: editorValueSource, className: "standard-field standard-field-padding full-width"})
|
|
31
|
+
),
|
|
32
|
+
)
|
|
33
|
+
)
|
|
34
|
+
)
|
|
35
|
+
)
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Dbm from "../../../../index.js";
|
|
3
|
+
|
|
4
|
+
export default class MultipleRelations extends Dbm.react.BaseObject {
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
|
|
8
|
+
let objectType = this.getPropValue("objectType");
|
|
9
|
+
let encodings = this.getPropValueWithDefault("encodings", ["name"]);
|
|
10
|
+
let visibility = this.getPropValueWithDefault("visibility", "private");
|
|
11
|
+
|
|
12
|
+
this.item.requireProperty("items", []);
|
|
13
|
+
this.item.requireProperty("loaded", false);
|
|
14
|
+
|
|
15
|
+
{
|
|
16
|
+
let request = Dbm.getGraphApi().requestRange(
|
|
17
|
+
[
|
|
18
|
+
{"type": "byObjectType", "objectType": objectType},
|
|
19
|
+
{"type": "includeDraft"},
|
|
20
|
+
{"type": "includePrivate"}
|
|
21
|
+
],
|
|
22
|
+
encodings
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
Dbm.flow.addUpdateCommandWhenMatched(request.properties.status, Dbm.loading.LoadingStatus.LOADED, Dbm.commands.callFunction(this._itemsLoaded.bind(this), [request]));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
//console.log(this._getEditor());
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
_itemsLoaded(aRequest) {
|
|
33
|
+
console.log("_itemsLoaded");
|
|
34
|
+
console.log(aRequest);
|
|
35
|
+
|
|
36
|
+
let nameField = this.getPropValueWithDefault("nameField", "name");
|
|
37
|
+
|
|
38
|
+
let currentArray = [].concat(aRequest.items);
|
|
39
|
+
Dbm.utils.ArrayFunctions.sortOnField(currentArray, nameField);
|
|
40
|
+
|
|
41
|
+
this.item.items = currentArray;
|
|
42
|
+
this.item.loaded = true;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
_getEditor() {
|
|
46
|
+
let itemEditor = this.context.itemEditor;
|
|
47
|
+
|
|
48
|
+
let direction = this.getPropValue("direction");
|
|
49
|
+
let relationType = this.getPropValue("relationType");
|
|
50
|
+
let objectType = this.getPropValue("objectType");
|
|
51
|
+
|
|
52
|
+
let editor = null;
|
|
53
|
+
if(direction === "in") {
|
|
54
|
+
editor = itemEditor.getAdminMultipleIncomingRelationsEditor(relationType, objectType);
|
|
55
|
+
}
|
|
56
|
+
else if(direction === "out") {
|
|
57
|
+
editor = itemEditor.getAdminMultipleOutgoingRelationsEditor(relationType, objectType);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
console.error("Unknown direction", direction, this);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return editor;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
_add(aItem) {
|
|
67
|
+
console.log("_add");
|
|
68
|
+
console.log(aItem);
|
|
69
|
+
|
|
70
|
+
let editor = this._getEditor();
|
|
71
|
+
|
|
72
|
+
let newValues = [].concat(editor.value);
|
|
73
|
+
newValues.push(aItem.id);
|
|
74
|
+
editor.value = newValues;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
_remove(aId) {
|
|
78
|
+
console.log("_remove");
|
|
79
|
+
console.log(aId);
|
|
80
|
+
|
|
81
|
+
let editor = this._getEditor();
|
|
82
|
+
|
|
83
|
+
let newValues = [].concat(editor.value);
|
|
84
|
+
|
|
85
|
+
let index = newValues.indexOf(aId);
|
|
86
|
+
if(index >= 0) {
|
|
87
|
+
newValues.splice(index, 1);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
editor.value = newValues;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
_renderMainElement() {
|
|
94
|
+
|
|
95
|
+
let label = this.getPropValue("label");
|
|
96
|
+
let direction = this.getPropValue("direction");
|
|
97
|
+
let relationType = this.getPropValue("relationType");
|
|
98
|
+
let objectType = this.getPropValue("objectType");
|
|
99
|
+
|
|
100
|
+
return React.createElement("div", {},
|
|
101
|
+
React.createElement(Dbm.react.form.LabelledArea, {label: label}),
|
|
102
|
+
React.createElement(Dbm.react.area.HasData, {check: this.item.properties.loaded},
|
|
103
|
+
React.createElement("div", {},
|
|
104
|
+
React.createElement("div", {"className": "standard-alternating-rows"},
|
|
105
|
+
React.createElement(Dbm.react.admin.editorsgroup.EditMultipleRelations, {"direction": direction, "relationType": relationType, "objectType": objectType},
|
|
106
|
+
React.createElement(Dbm.react.area.List, {items: Dbm.react.source.contextVariable("valueEditor.editValue.value")},
|
|
107
|
+
React.createElement("div", {"className": "flex-row small-item-spacing justify-between"},
|
|
108
|
+
React.createElement("div", {"className": "flex-row"},
|
|
109
|
+
React.createElement(Dbm.react.context.AddItemByIdToContext, {id: Dbm.react.source.item()},
|
|
110
|
+
Dbm.react.text.text(Dbm.react.source.item("name"))
|
|
111
|
+
)
|
|
112
|
+
),
|
|
113
|
+
React.createElement("div", {"className": "flex-row"},
|
|
114
|
+
React.createElement(Dbm.react.interaction.CommandButton, {"commands": [Dbm.commands.callFunction(this._remove.bind(this), [Dbm.react.source.item()])]},
|
|
115
|
+
React.createElement(Dbm.react.image.Image, {"src": "/assets/img/icons/remove.svg", "className": "background-contain cursor-pointer action-icon-color field-icon"})
|
|
116
|
+
)
|
|
117
|
+
)
|
|
118
|
+
)
|
|
119
|
+
)
|
|
120
|
+
)
|
|
121
|
+
),
|
|
122
|
+
React.createElement("div", {"className": "spacing small"}),
|
|
123
|
+
React.createElement("div", {"className": "flex-row"},
|
|
124
|
+
React.createElement(Dbm.react.form.Dropdown, {"position": "right"},
|
|
125
|
+
React.createElement("div", {"data-slot": "button", "className": "action-button action-button-padding"},
|
|
126
|
+
"Add"
|
|
127
|
+
),
|
|
128
|
+
React.createElement("div", {"className": "dropdown-menu-max-height standard-dropdown"},
|
|
129
|
+
React.createElement(Dbm.react.area.List, {items: this.item.properties.items, "as": "relatedItem"},
|
|
130
|
+
React.createElement(Dbm.react.interaction.CommandButton, {"commands": [
|
|
131
|
+
Dbm.commands.callFunction(this._add.bind(this), [Dbm.react.source.contextVariable("relatedItem")]),
|
|
132
|
+
Dbm.commands.setProperty(Dbm.react.source.contextVariable("open"), false)
|
|
133
|
+
]},
|
|
134
|
+
React.createElement("div", {className: "standard-dropdown-row standard-dropdown-row-padding hover-row cursor-pointer"},
|
|
135
|
+
Dbm.react.text.text(Dbm.react.source.contextVariable("relatedItem.name"))
|
|
136
|
+
)
|
|
137
|
+
),
|
|
138
|
+
)
|
|
139
|
+
)
|
|
140
|
+
)
|
|
141
|
+
)
|
|
142
|
+
)
|
|
143
|
+
),
|
|
144
|
+
|
|
145
|
+
)
|
|
146
|
+
}
|
|
147
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
|
|
9
|
+
_renderMainElement() {
|
|
10
|
+
|
|
11
|
+
let label = this.getPropValue("label");
|
|
12
|
+
let fieldName = this.getPropValue("fieldName");
|
|
13
|
+
|
|
14
|
+
return React.createElement("div", {},
|
|
15
|
+
React.createElement(Dbm.react.form.LabelledArea, {label: label}),
|
|
16
|
+
React.createElement(Dbm.react.admin.editorsgroup.EditField, {"fieldName": fieldName},
|
|
17
|
+
React.createElement(Dbm.react.thirdparty.tinymce.Editor, {value: Dbm.react.source.contextVariable("valueEditor.editValue.value"), className: "standard-field standard-field-padding full-width"})
|
|
18
|
+
)
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Dbm from "../../../../index.js";
|
|
3
|
+
|
|
4
|
+
export default class RichTextFieldWithTranslations extends Dbm.react.BaseObject {
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
_renderMainElement() {
|
|
10
|
+
|
|
11
|
+
let label = this.getPropValue("label");
|
|
12
|
+
let fieldName = this.getPropValue("fieldName");
|
|
13
|
+
|
|
14
|
+
let fieldNameSource = Dbm.react.source.contextVariable("fieldName");
|
|
15
|
+
let editorValueSource = Dbm.react.source.contextVariable("valueEditor.editValue.value");
|
|
16
|
+
|
|
17
|
+
return React.createElement("div", {},
|
|
18
|
+
React.createElement("label", {className: "standard-field-label"}, label),
|
|
19
|
+
React.createElement(Dbm.react.context.AddContextVariables, {values: {"fieldName": fieldName}},
|
|
20
|
+
React.createElement(Dbm.react.admin.editorsgroup.EditField, {"fieldName": fieldNameSource},
|
|
21
|
+
React.createElement(Dbm.react.thirdparty.tinymce.Editor, {value: editorValueSource, className: "standard-field standard-field-padding full-width"})
|
|
22
|
+
),
|
|
23
|
+
React.createElement(Dbm.react.area.List, {items: Dbm.getRepositoryItem("site").properties.availableLanguages, as: "language"},
|
|
24
|
+
React.createElement("div", {className: "flex-row small-item-spacing vertically-center-items"},
|
|
25
|
+
React.createElement("div", {className: "flex-row-item flex-no-resize"},
|
|
26
|
+
Dbm.react.text.text(Dbm.react.source.contextVariable("language.code"))
|
|
27
|
+
),
|
|
28
|
+
React.createElement("div", {className: "flex-row-item flex-resize"},
|
|
29
|
+
React.createElement(Dbm.react.admin.editorsgroup.EditFieldTranslation, {"fieldName": fieldNameSource, "language": Dbm.react.source.contextVariable("language.code")},
|
|
30
|
+
React.createElement(Dbm.react.thirdparty.tinymce.Editor, {value: editorValueSource, className: "standard-field standard-field-padding full-width"})
|
|
31
|
+
),
|
|
32
|
+
)
|
|
33
|
+
)
|
|
34
|
+
)
|
|
35
|
+
)
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -15,3 +15,8 @@ export {default as Url} from "./Url.js";
|
|
|
15
15
|
export {default as RelationsList} from "./RelationsList.js";
|
|
16
16
|
export {default as HierarchyOrderedRelationsList} from "./HierarchyOrderedRelationsList.js";
|
|
17
17
|
export {default as DraggableHierarchyDisplay} from "./DraggableHierarchyDisplay.js";
|
|
18
|
+
export {default as MultipleRelations} from "./MultipleRelations.js";
|
|
19
|
+
export {default as RichTextField} from "./RichTextField.js";
|
|
20
|
+
export {default as RichTextFieldWithTranslations} from "./RichTextFieldWithTranslations.js";
|
|
21
|
+
export {default as FormattedField} from "./FormattedField.js";
|
|
22
|
+
export {default as FormattedFieldWithTranslations} from "./FormattedFieldWithTranslations.js";
|
|
@@ -7,6 +7,7 @@ export default class InsertElement extends Dbm.react.BaseObject {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
_removedUsedProps(aProps) {
|
|
10
|
+
//console.log("_removedUsedProps");
|
|
10
11
|
delete aProps["element"];
|
|
11
12
|
}
|
|
12
13
|
|
|
@@ -20,7 +21,7 @@ export default class InsertElement extends Dbm.react.BaseObject {
|
|
|
20
21
|
return React.createElement("div", {}, "No element set");
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
let props = this._copyProps(
|
|
24
|
+
let props = this._copyProps(element.props);
|
|
24
25
|
|
|
25
26
|
let returnElement = Dbm.react.ChildFunctions.clone(element, props);
|
|
26
27
|
return returnElement;
|
|
@@ -66,6 +66,7 @@ export default class AskAQuestion extends Dbm.react.BaseObject {
|
|
|
66
66
|
let currentRow = new Dbm.repository.Item();
|
|
67
67
|
currentRow.setId("_dbmInternal/row" + Dbm.getInstance().getNextId());
|
|
68
68
|
currentRow.setValue("item", currentItem);
|
|
69
|
+
console.log(">>>>>>>", this._getOpenProperty(i));
|
|
69
70
|
currentRow.setValue("element", React.createElement(Dbm.react.blocks.faq.HelpSectionRowItem, {"open": this._getOpenProperty(i), "startState": (i === 0 ? "open" : "close")}));
|
|
70
71
|
rows.push(currentRow);
|
|
71
72
|
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import Dbm from "../../../index.js";
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
export default class ImageGallery extends Dbm.react.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
|
+
elementSize.input.properties.element.connectInput(this.item.properties.widthElement);
|
|
13
|
+
elementSize.start();
|
|
14
|
+
this.item.requireProperty("width", 0).connectInput(elementSize.output.properties.width);
|
|
15
|
+
|
|
16
|
+
let images = this.getPropValue("images");
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
this.item.requireProperty("sections", []);
|
|
20
|
+
|
|
21
|
+
let allLoaded = Dbm.flow.updatefunctions.logic.allAtValue(Dbm.loading.LoadingStatus.LOADED);
|
|
22
|
+
this.item.requireProperty("loaded", false);
|
|
23
|
+
Dbm.flow.runWhenMatched(this.item.properties.loaded, true, Dbm.commands.callFunction(this._loaded.bind(this)));
|
|
24
|
+
|
|
25
|
+
let urlPath = this.getPropValueWithDefault("urlPath", "url");
|
|
26
|
+
|
|
27
|
+
let imageLoaders = [];
|
|
28
|
+
let currentArray = images;
|
|
29
|
+
let currentArrayLength = currentArray.length;
|
|
30
|
+
for(let i = 0; i < currentArrayLength; i++) {
|
|
31
|
+
let currentData = currentArray[i];
|
|
32
|
+
console.log(currentData);
|
|
33
|
+
let currentUrl = Dbm.objectPath(currentData, urlPath);
|
|
34
|
+
console.log(currentUrl);
|
|
35
|
+
let loader = Dbm.loading.loadImage(currentUrl);
|
|
36
|
+
imageLoaders.push(loader.item);
|
|
37
|
+
allLoaded.addCheck(loader.item.properties.status);
|
|
38
|
+
}
|
|
39
|
+
this.item.setValue("images", imageLoaders);
|
|
40
|
+
|
|
41
|
+
this.item.properties.loaded.connectInput(allLoaded.output.properties.value);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
_removedUsedProps(aProps) {
|
|
45
|
+
delete aProps["images"];
|
|
46
|
+
delete aProps["urlPath"];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
_loaded() {
|
|
50
|
+
console.log("loaded");
|
|
51
|
+
console.log(this.item.images);
|
|
52
|
+
|
|
53
|
+
let groups = Dbm.utils.ArrayFunctions.splitArray(this.item.images, 4);
|
|
54
|
+
|
|
55
|
+
let length = groups.length;
|
|
56
|
+
if(length > 1 && groups[length - 1].length === 1) {
|
|
57
|
+
let last = groups[length-1];
|
|
58
|
+
let prev = groups[length-2];
|
|
59
|
+
|
|
60
|
+
let lastInPrevious = prev.pop();
|
|
61
|
+
last.unshift(lastInPrevious);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
let sections = [];
|
|
65
|
+
let currentArray = groups;
|
|
66
|
+
let currentArrayLength = currentArray.length;
|
|
67
|
+
for(let i = 0; i < currentArrayLength; i++) {
|
|
68
|
+
let section = React.createElement(Dbm.react.image.gallery.ImageGallerySection, {"images": currentArray[i], width: this.item.properties.width, spacing: 20});
|
|
69
|
+
sections.push({"id": i, "element": section});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
this.item.sections = sections;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
_renderMainElement() {
|
|
76
|
+
|
|
77
|
+
return this._createMainElement("div", {ref: this.createRef("widthElement")},
|
|
78
|
+
React.createElement(Dbm.react.area.List, {items: this.item.properties.sections},
|
|
79
|
+
React.createElement(Dbm.react.area.InsertElement, {"element": Dbm.react.source.item("element")}),
|
|
80
|
+
React.createElement("div", {"data-slot": "spacing", "className": "spacing", "style": {"height": 20}})
|
|
81
|
+
)
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
}
|