dbm 1.1.9 → 1.1.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.
@@ -4,6 +4,7 @@ export default class SourceBaseObject extends Dbm.core.BaseObject {
4
4
  _construct() {
5
5
  super._construct();
6
6
 
7
+ this._log = false;
7
8
  this.item.setValue("path", null);
8
9
  }
9
10
 
@@ -20,10 +21,20 @@ export default class SourceBaseObject extends Dbm.core.BaseObject {
20
21
 
21
22
  let path = this.item.path;
22
23
  let baseObject = this.getBaseObject(aFromObject, aEventData);
24
+
25
+ if(this._log) {
26
+ console.log("Source>>>>>", baseObject, path);
27
+ }
28
+
23
29
  if(!path) {
24
30
  return baseObject;
25
31
  }
26
32
 
27
33
  return Dbm.objectPath(baseObject, path);
28
34
  }
35
+
36
+ addLogs() {
37
+ this._log = true;
38
+ return this;
39
+ }
29
40
  }
@@ -4,6 +4,8 @@ export default class WebSocketConnection extends Dbm.core.BaseObject {
4
4
  _construct() {
5
5
  super._construct();
6
6
 
7
+ this._connectBound = this._connect.bind(this);
8
+
7
9
  this._url = null;
8
10
  this._webSocket = null;
9
11
  this._reconnectIfDisconnected = false;
@@ -161,7 +163,7 @@ export default class WebSocketConnection extends Dbm.core.BaseObject {
161
163
  this.item.setValue("status", 0);
162
164
 
163
165
  if(this._reconnectIfDisconnected) {
164
- this._connect();
166
+ setTimeout(this._connectBound, 2*1000);
165
167
  }
166
168
  }
167
169
 
@@ -58,7 +58,7 @@ export const fullSetup = function() {
58
58
  {
59
59
  let name = "urlRequest";
60
60
  let currentDecoder = new Dbm.graphapi.webclient.decode.DecodeBaseObject();
61
- currentDecoder.item.setValue("copyFields", ["meta/description"]);
61
+ currentDecoder.item.setValue("copyFields", ["meta/description", "seo/noIndex", "seo/noFollow"]);
62
62
  currentDecoder.item.setValue("encodingType", name);
63
63
  currentDecoder.item.register(decodePrefix + name);
64
64
  }
@@ -117,4 +117,12 @@ export const fullSetup = function() {
117
117
  currentDecoder.item.setValue("encodingType", name);
118
118
  currentDecoder.item.register(decodePrefix + name);
119
119
  }
120
+
121
+ {
122
+ let name = "admin_fields";
123
+ let currentDecoder = new Dbm.graphapi.webclient.decode.DecodeBaseObject();
124
+ currentDecoder.item.setValue("copyFields", ["fields"]);
125
+ currentDecoder.item.setValue("encodingType", name);
126
+ currentDecoder.item.register(decodePrefix + name);
127
+ }
120
128
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dbm",
3
- "version": "1.1.9",
3
+ "version": "1.1.10",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "scripts": {},
@@ -53,8 +53,7 @@ export default class BaseObject extends Component {
53
53
 
54
54
  getDynamicProp(aName, aInitialValue = null) {
55
55
  if(!this._dynamicProps[aName]) {
56
- let newProperty = new Dbm.flow.FlowProperty();
57
- newProperty.value = aInitialValue;
56
+ let newProperty = this.item.requireProperty("props/" + aName, aInitialValue);
58
57
  this._dynamicProps[aName] = newProperty;
59
58
  let updateState = this._getStateUpdate();
60
59
  let stateProperty = updateState.input.register(aName, aInitialValue);
@@ -65,8 +64,7 @@ export default class BaseObject extends Component {
65
64
 
66
65
  getDynamicPropWithoutState(aName, aInitialValue = null) {
67
66
  if(!this._dynamicProps[aName]) {
68
- let newProperty = new Dbm.flow.FlowProperty();
69
- newProperty.value = aInitialValue;
67
+ let newProperty = this.item.requireProperty("props/" + aName, aInitialValue);
70
68
  this._dynamicProps[aName] = newProperty;
71
69
  }
72
70
  return this._dynamicProps[aName];
@@ -23,6 +23,9 @@ export default class EditPage extends Dbm.react.BaseObject {
23
23
  let descriptionLength = Dbm.flow.updatefunctions.basic.length(descriptionEditor.item.editValue.value);
24
24
  this.item.requireProperty("descriptionLength", 0).connectInput(descriptionLength.output.properties.length);
25
25
 
26
+ itemEditor.addFieldEditor("seo/noIndex", page["seo/noIndex"], "seo/noIndex");
27
+ itemEditor.addFieldEditor("seo/noFollow", page["seo/noFollow"], "seo/noFollow");
28
+
26
29
  this.item.requireProperty("importText", "");
27
30
  }
28
31
 
@@ -169,6 +172,17 @@ export default class EditPage extends Dbm.react.BaseObject {
169
172
  " / ",
170
173
  "155"
171
174
  )
175
+ ),
176
+
177
+ React.createElement("div", {className: "flex-row small-item-spacing"},
178
+ React.createElement("div", {className: "flex-row-item"},
179
+ React.createElement(Dbm.react.form.Checkbox, {checked: itemEditor.getEditor("seo/noIndex").item.editValue.value}),
180
+ "Noindex"
181
+ ),
182
+ React.createElement("div", {className: "flex-row-item"},
183
+ React.createElement(Dbm.react.form.Checkbox, {checked: itemEditor.getEditor("seo/noFollow").item.editValue.value}),
184
+ "Nofollow"
185
+ ),
172
186
  )
173
187
  ),
174
188
  React.createElement("div", {className: "spacing standard"}),
@@ -3,4 +3,5 @@ export {default as EditPage} from "./EditPage.js";
3
3
  export {default as SelectImageFromLibrary} from "./SelectImageFromLibrary.js";
4
4
 
5
5
  export * as editor from "./editor/index.js";
6
- export * as pages from "./pages/index.js";
6
+ export * as pages from "./pages/index.js";
7
+ export * as website from "./website/index.js";
@@ -0,0 +1,153 @@
1
+ import React from "react";
2
+ import Dbm from "../../../index.js";
3
+
4
+ export default class EditWebsite extends Dbm.react.BaseObject {
5
+ _construct() {
6
+ super._construct();
7
+
8
+ let graphApi = Dbm.getInstance().repository.getItem("graphApi").controller;
9
+
10
+ this.item.requireProperty("itemEditor", null);
11
+ this.item.requireProperty("locationEditor", null);
12
+
13
+ let allLoaded = Dbm.flow.updatefunctions.logic.allAtValue(Dbm.loading.LoadingStatus.LOADED);
14
+ this.item.requireProperty("loaded", false);
15
+ Dbm.flow.addUpdateCommandWhenMatched(this.item.properties.loaded, true, Dbm.commands.callFunction(this._allLoaded.bind(this), []));
16
+
17
+ let id = this.context.item.id;
18
+
19
+ {
20
+ let request = graphApi.requestRange(
21
+ [
22
+ {"type": "includePrivate"},
23
+ {"type": "includeDraft"},
24
+ {"type": "idSelection", "ids": [id]},
25
+ ],
26
+ ["admin_fields"]
27
+ );
28
+ Dbm.flow.addUpdateCommandWhenMatched(request.properties.status, Dbm.loading.LoadingStatus.LOADED, Dbm.commands.callFunction(this._dataLoaded.bind(this), [request]));
29
+ allLoaded.addCheck(request.properties.status);
30
+ }
31
+
32
+ {
33
+ let request = graphApi.requestRange(
34
+ [
35
+ {"type": "includePrivate"},
36
+ {"type": "includeDraft"},
37
+ {"type": "objectRelationQuery", "fromIds": [id], "path": "out:at:location"},
38
+ ],
39
+ ["admin_fields"]
40
+ );
41
+ Dbm.flow.addUpdateCommandWhenMatched(request.properties.status, Dbm.loading.LoadingStatus.LOADED, Dbm.commands.callFunction(this._locationLoaded.bind(this), [request]));
42
+ allLoaded.addCheck(request.properties.status);
43
+ }
44
+
45
+ this.item.properties.loaded.connectInput(allLoaded.output.properties.value);
46
+ }
47
+
48
+ _dataLoaded(aRequest) {
49
+ console.log("_dataLoaded");
50
+ console.log(aRequest);
51
+
52
+ let item = aRequest.items[0];
53
+ let id = item.id;
54
+
55
+ let editorGroup = this.context.editorGroup;
56
+ let itemEditor = editorGroup.getItemEditor(id);
57
+
58
+ itemEditor.addFieldEditor("name", Dbm.objectPath(item, "fields.name"), "name");
59
+ itemEditor.addFieldEditor("phoneNumber", Dbm.objectPath(item, "fields.phoneNumber"), "phoneNumber");
60
+ itemEditor.addFieldEditor("email", Dbm.objectPath(item, "fields.email"), "email");
61
+ itemEditor.addFieldEditor("priceRangeDescription", Dbm.objectPath(item, "fields.priceRangeDescription"), "priceRangeDescription");
62
+
63
+ itemEditor.addFieldEditor("rating/value", Dbm.objectPath(item, "fields.rating/value"), "rating/value");
64
+ itemEditor.addFieldEditor("rating/count", Dbm.objectPath(item, "fields.rating/count"), "rating/count");
65
+ itemEditor.addFieldEditor("rating/min", Dbm.objectPath(item, "fields.rating/min"), "rating/min");
66
+ itemEditor.addFieldEditor("rating/max", Dbm.objectPath(item, "fields.rating/max"), "rating/max");
67
+
68
+ this.item.setValue("itemEditor", itemEditor);
69
+ }
70
+
71
+ _locationLoaded(aRequest) {
72
+ console.log("_locationLoaded");
73
+ console.log(aRequest);
74
+
75
+ let item = aRequest.items[0];
76
+ let id = item.id;
77
+
78
+ let editorGroup = this.context.editorGroup;
79
+ let itemEditor = editorGroup.getItemEditor(id);
80
+
81
+ itemEditor.addFieldEditor("street", Dbm.objectPath(item, "fields.street"), "street");
82
+ itemEditor.addFieldEditor("city", Dbm.objectPath(item, "fields.city"), "city");
83
+ itemEditor.addFieldEditor("postCode", Dbm.objectPath(item, "fields.postCode"), "postCode");
84
+ itemEditor.addFieldEditor("country", Dbm.objectPath(item, "fields.country"), "country");
85
+
86
+ itemEditor.addFieldEditor("latitude", Dbm.objectPath(item, "fields.latitude"), "latitude");
87
+ itemEditor.addFieldEditor("longitude", Dbm.objectPath(item, "fields.longitude"), "longitude");
88
+
89
+ this.item.setValue("locationEditor", itemEditor);
90
+ }
91
+
92
+ _allLoaded() {
93
+ console.log("_allLoaded");
94
+ }
95
+
96
+ _renderMainElement() {
97
+
98
+
99
+ return React.createElement("div", {},
100
+ React.createElement(Dbm.react.area.HasData, {"check": this.item.properties.loaded},
101
+ React.createElement(Dbm.react.context.AddContextVariables, {values: {"itemEditor": this.item.properties.itemEditor}},
102
+ React.createElement(Dbm.react.form.LabelledArea, {"label": "Name"},
103
+ React.createElement(Dbm.react.form.FormField, {"value": Dbm.react.source.contextVariable("itemEditor.value.item.editor_name.item.editValue.item.properties.value"), className: "standard-field standard-field-padding full-width"})
104
+ ),
105
+ React.createElement(Dbm.react.form.LabelledArea, {"label": "Phone number"},
106
+ React.createElement(Dbm.react.form.FormField, {"value": Dbm.react.source.contextVariable("itemEditor.value.item.editor_phoneNumber.item.editValue.item.properties.value"), className: "standard-field standard-field-padding full-width"}),
107
+ ),
108
+ React.createElement(Dbm.react.form.LabelledArea, {"label": "Email"},
109
+ React.createElement(Dbm.react.form.FormField, {"value": Dbm.react.source.contextVariable("itemEditor.value.item.editor_email.item.editValue.item.properties.value"), className: "standard-field standard-field-padding full-width"}),
110
+ ),
111
+ React.createElement(Dbm.react.form.LabelledArea, {"label": "Price range description"},
112
+ React.createElement(Dbm.react.form.FormField, {"value": Dbm.react.source.contextVariable("itemEditor.value.item.editor_priceRangeDescription.item.editValue.item.properties.value"), className: "standard-field standard-field-padding full-width"}),
113
+ ),
114
+ React.createElement(Dbm.react.form.LabelledArea, {"label": "Rating"},
115
+ React.createElement(Dbm.react.form.FormField, {"value": Dbm.react.source.contextVariable("itemEditor.value.item.editor_rating/value.item.editValue.item.properties.value"), className: "standard-field standard-field-padding full-width"}),
116
+ ),
117
+ React.createElement(Dbm.react.form.LabelledArea, {"label": "Rating (count)"},
118
+ React.createElement(Dbm.react.form.FormField, {"value": Dbm.react.source.contextVariable("itemEditor.value.item.editor_rating/count.item.editValue.item.properties.value"), className: "standard-field standard-field-padding full-width"}),
119
+ ),
120
+ React.createElement(Dbm.react.form.LabelledArea, {"label": "Min"},
121
+ React.createElement(Dbm.react.form.FormField, {"value": Dbm.react.source.contextVariable("itemEditor.value.item.editor_rating/min.item.editValue.item.properties.value"), className: "standard-field standard-field-padding full-width"}),
122
+ ),
123
+ React.createElement(Dbm.react.form.LabelledArea, {"label": "Max"},
124
+ React.createElement(Dbm.react.form.FormField, {"value": Dbm.react.source.contextVariable("itemEditor.value.item.editor_rating/max.item.editValue.item.properties.value"), className: "standard-field standard-field-padding full-width"}),
125
+ ),
126
+ ),
127
+ React.createElement(Dbm.react.context.AddContextVariables, {values: {"itemEditor": this.item.properties.locationEditor}},
128
+ React.createElement(Dbm.react.form.LabelledArea, {"label": "Street"},
129
+ React.createElement(Dbm.react.form.FormField, {"value": Dbm.react.source.contextVariable("itemEditor.value.item.editor_street.item.editValue.item.properties.value"), className: "standard-field standard-field-padding full-width"})
130
+ ),
131
+ React.createElement(Dbm.react.form.LabelledArea, {"label": "Post code"},
132
+ React.createElement(Dbm.react.form.FormField, {"value": Dbm.react.source.contextVariable("itemEditor.value.item.editor_postCode.item.editValue.item.properties.value"), className: "standard-field standard-field-padding full-width"}),
133
+ ),
134
+ React.createElement(Dbm.react.form.LabelledArea, {"label": "City"},
135
+ React.createElement(Dbm.react.form.FormField, {"value": Dbm.react.source.contextVariable("itemEditor.value.item.editor_city.item.editValue.item.properties.value"), className: "standard-field standard-field-padding full-width"}),
136
+ ),
137
+ React.createElement(Dbm.react.form.LabelledArea, {"label": "Country code"},
138
+ React.createElement(Dbm.react.form.FormField, {"value": Dbm.react.source.contextVariable("itemEditor.value.item.editor_country.item.editValue.item.properties.value"), className: "standard-field standard-field-padding full-width"}),
139
+ ),
140
+ React.createElement(Dbm.react.form.LabelledArea, {"label": "Latitude"},
141
+ React.createElement(Dbm.react.form.FormField, {"value": Dbm.react.source.contextVariable("itemEditor.value.item.editor_latitude.item.editValue.item.properties.value"), className: "standard-field standard-field-padding full-width"}),
142
+ ),
143
+ React.createElement(Dbm.react.form.LabelledArea, {"label": "Longitude"},
144
+ React.createElement(Dbm.react.form.FormField, {"value": Dbm.react.source.contextVariable("itemEditor.value.item.editor_longitude.item.editValue.item.properties.value"), className: "standard-field standard-field-padding full-width"}),
145
+ )
146
+ )
147
+
148
+ )
149
+
150
+ );
151
+ }
152
+ }
153
+
@@ -0,0 +1,167 @@
1
+ import React from "react";
2
+ import Dbm from "../../../index.js";
3
+
4
+ export default class EditWebsite extends Dbm.react.BaseObject {
5
+ _construct() {
6
+ super._construct();
7
+
8
+ let graphApi = Dbm.getInstance().repository.getItem("graphApi").controller;
9
+
10
+ let editorGroup = new Dbm.graphapi.webclient.admin.EditorGroup();
11
+ this.item.setValue("editorGroup", editorGroup);
12
+ this.item.requireProperty("changed", false).connectInput(editorGroup.item.properties.changed);
13
+
14
+ this.item.requireProperty("websiteEditor", null);
15
+ this.item.requireProperty("organizationEditor", null);
16
+ this.item.requireProperty("localBusinesses", []);
17
+
18
+ /*
19
+ let itemEditor = editorGroup.getItemEditor(id);
20
+
21
+ itemEditor.addFieldEditor("title", page.title, "title");
22
+ itemEditor.addFieldEditor("navigationName", page.navigationName); //METODO: add update encoding
23
+ itemEditor.addFieldEditor("content", page.content, "content");
24
+ itemEditor.addEditor("url", page.url, Dbm.graphapi.webclient.admin.SaveFunctions.setUrl, "url");
25
+
26
+ let descriptionEditor = itemEditor.addFieldEditor("meta/description", page["meta/description"], "meta/description");
27
+ let descriptionLength = Dbm.flow.updatefunctions.basic.length(descriptionEditor.item.editValue.value);
28
+ this.item.requireProperty("descriptionLength", 0).connectInput(descriptionLength.output.properties.length);
29
+
30
+ this.item.requireProperty("importText", "");
31
+ */
32
+
33
+ let allLoaded = Dbm.flow.updatefunctions.logic.allAtValue(Dbm.loading.LoadingStatus.LOADED);
34
+ this.item.requireProperty("loaded", false);
35
+ Dbm.flow.addUpdateCommandWhenMatched(this.item.properties.loaded, true, Dbm.commands.callFunction(this._allLoaded.bind(this), []));
36
+
37
+ {
38
+ let request = graphApi.requestRange(
39
+ [
40
+ {"type": "includePrivate"},
41
+ {"type": "includeDraft"},
42
+ {"type": "globalObjectRelationQuery", "identifer": "website", "path": "(root)"},
43
+ ],
44
+ ["admin_fields"]
45
+ );
46
+ Dbm.flow.addUpdateCommandWhenMatched(request.properties.status, Dbm.loading.LoadingStatus.LOADED, Dbm.commands.callFunction(this._websiteLoaded.bind(this), [request]));
47
+ allLoaded.addCheck(request.properties.status);
48
+ }
49
+
50
+ {
51
+ let request = graphApi.requestRange(
52
+ [
53
+ {"type": "includePrivate"},
54
+ {"type": "includeDraft"},
55
+ {"type": "globalObjectRelationQuery", "identifer": "website", "path": "out:by:organization"},
56
+ ],
57
+ ["admin_fields"]
58
+ );
59
+ Dbm.flow.addUpdateCommandWhenMatched(request.properties.status, Dbm.loading.LoadingStatus.LOADED, Dbm.commands.callFunction(this._organizationLoaded.bind(this), [request]));
60
+ allLoaded.addCheck(request.properties.status);
61
+ }
62
+
63
+ {
64
+ let request = graphApi.requestRange(
65
+ [
66
+ {"type": "includePrivate"},
67
+ {"type": "includeDraft"},
68
+ {"type": "globalObjectRelationQuery", "identifer": "website", "path": "out:by:organization,in:in:localBusiness"},
69
+ ],
70
+ ["admin_fields"]
71
+ );
72
+ Dbm.flow.addUpdateCommandWhenMatched(request.properties.status, Dbm.loading.LoadingStatus.LOADED, Dbm.commands.callFunction(this._localBusinessesLoaded.bind(this), [request]));
73
+ allLoaded.addCheck(request.properties.status);
74
+ }
75
+
76
+ this.item.properties.loaded.connectInput(allLoaded.output.properties.value);
77
+ }
78
+
79
+ _websiteLoaded(aRequest) {
80
+ console.log("_websiteLoaded");
81
+ console.log(aRequest);
82
+
83
+ let item = aRequest.items[0];
84
+ let id = item.id;
85
+
86
+ let editorGroup = this.item.editorGroup;
87
+ let itemEditor = editorGroup.getItemEditor(id);
88
+
89
+ itemEditor.addFieldEditor("name", Dbm.objectPath(item, "fields.name"), "name");
90
+
91
+ this.item.setValue("websiteEditor", itemEditor);
92
+ }
93
+
94
+ _organizationLoaded(aRequest) {
95
+ console.log("_organizationLoaded");
96
+ console.log(aRequest);
97
+
98
+ let item = aRequest.items[0];
99
+ let id = item.id;
100
+
101
+ let editorGroup = this.item.editorGroup;
102
+ let itemEditor = editorGroup.getItemEditor(id);
103
+
104
+ itemEditor.addFieldEditor("name", Dbm.objectPath(item, "fields.name"), "name");
105
+
106
+ this.item.setValue("organizationEditor", itemEditor);
107
+ }
108
+
109
+ _localBusinessesLoaded(aRequest) {
110
+ console.log("_localBusinessesLoaded");
111
+ console.log(aRequest);
112
+
113
+ this.item.localBusinesses = aRequest.items;
114
+ }
115
+
116
+ _allLoaded() {
117
+ console.log("_allLoaded");
118
+ }
119
+
120
+ _save() {
121
+ console.log("_save");
122
+
123
+ let editorGroup = this.item.editorGroup;
124
+
125
+ let saveData = editorGroup.getSaveData();
126
+
127
+ saveData.save();
128
+ }
129
+
130
+ _renderMainElement() {
131
+
132
+
133
+ let editorGroup = this.item.editorGroup;
134
+
135
+ return React.createElement("div", {},
136
+ React.createElement(Dbm.react.area.HasData, {"check": this.item.properties.loaded},
137
+ React.createElement(Dbm.react.context.AddContextVariables, {values: {"editorGroup": editorGroup}},
138
+ React.createElement(Dbm.react.context.AddContextVariables, {values: {"itemEditor": this.item.properties.websiteEditor}},
139
+ React.createElement(Dbm.react.form.FormField, {"value": Dbm.react.source.contextVariable("itemEditor.value.item.editor_name.item.editValue.item.properties.value"), className: "standard-field standard-field-padding full-width"}),
140
+ ),
141
+ React.createElement("div", {className: "spacing standard"}),
142
+ React.createElement(Dbm.react.context.AddContextVariables, {values: {"itemEditor": this.item.properties.organizationEditor}},
143
+ React.createElement(Dbm.react.form.LabelledArea, {"label": "Website "},
144
+ React.createElement(Dbm.react.form.LabelledArea, {"label": "Organization name"},
145
+ React.createElement(Dbm.react.form.FormField, {"value": Dbm.react.source.contextVariable("itemEditor.value.item.editor_name.item.editValue.item.properties.value"), className: "standard-field standard-field-padding full-width"}),
146
+ )
147
+ )
148
+ ),
149
+ React.createElement(Dbm.react.area.List, {items: this.item.properties.localBusinesses},
150
+ React.createElement(Dbm.react.admin.website.EditLocalBusiness, {})
151
+ ),
152
+ React.createElement("div", {className: "spacing standard"}),
153
+ React.createElement("div", {className: "save-all-position"},
154
+ React.createElement(Dbm.react.area.OpenCloseExpandableArea, {open: this.item.properties.changed},
155
+ React.createElement("div", {"className": "standard-button standard-button-padding", "onClick": () => {this._save()}},
156
+ "Save all changes"
157
+ )
158
+ )
159
+ )
160
+ )
161
+
162
+ )
163
+
164
+ );
165
+ }
166
+ }
167
+
@@ -0,0 +1,2 @@
1
+ export {default as EditWebsite} from "./EditWebsite.js";
2
+ export {default as EditLocalBusiness} from "./EditLocalBusiness.js";
@@ -0,0 +1,64 @@
1
+ import React from "react";
2
+ import Dbm from "../../../index.js";
3
+
4
+ export default class Card extends Dbm.react.BaseObject {
5
+ _construct() {
6
+ super._construct();
7
+
8
+ let mobileLayout = React.createElement(Dbm.react.text.Link, {"href": Dbm.react.source.blockData("url"), "className": "custom-styled-link"},
9
+ React.createElement("div", {"className": "standard-card standard-card-padding"},
10
+ React.createElement(Dbm.react.image.WidthScaledImage, {image: Dbm.react.source.blockData("image"), targetWidth: 300, className: "card-image-mobile background-cover"}),
11
+ React.createElement("div", {"className": "spacing small"}),
12
+ React.createElement("div", {},
13
+ React.createElement("h3", {"className": "no-margins"},
14
+ Dbm.react.text.text(Dbm.react.source.blockData("title"))
15
+ ),
16
+ Dbm.react.text.htmlText(Dbm.react.source.blockData("text")),
17
+ React.createElement("div", {"className": "flex-row justify-between"},
18
+ React.createElement("div", {"className": "flex-row-item"}),
19
+ React.createElement("div", {"className": "flex-row-item"},
20
+ Dbm.react.text.text(Dbm.react.source.blockData("buttonText")),
21
+ )
22
+ )
23
+ )
24
+ )
25
+ );
26
+
27
+ let desktopLayout = React.createElement(Dbm.react.text.Link, {"href": Dbm.react.source.blockData("url"), "className": "custom-styled-link"},
28
+ React.createElement("div", {"className": "standard-card standard-card-padding"},
29
+ React.createElement("div", {"className": "flex-row small-item-spacing"},
30
+ React.createElement("div", {"className": "flex-row-item flex-no-resize"},
31
+ React.createElement(Dbm.react.image.WidthScaledImage, {image: Dbm.react.source.blockData("image"), targetWidth: 200, className: "card-image-desktop background-cover"})
32
+ ),
33
+ React.createElement("div", {"className": "flex-row-item flex-resize"},
34
+ React.createElement("h3", {"className": "no-margins"},
35
+ Dbm.react.text.text(Dbm.react.source.blockData("title"))
36
+ ),
37
+ Dbm.react.text.htmlText(Dbm.react.source.blockData("text")),
38
+ React.createElement("div", {"className": "flex-row justify-between"},
39
+ React.createElement("div", {"className": "flex-row-item"}),
40
+ React.createElement("div", {"className": "flex-row-item"},
41
+ Dbm.react.text.text(Dbm.react.source.blockData("buttonText")),
42
+ )
43
+ )
44
+ )
45
+ )
46
+ )
47
+ );
48
+
49
+
50
+
51
+
52
+
53
+ this.responsiveLayout = Dbm.react.area.responsiveLayout(mobileLayout).addLayout(desktopLayout, 600);
54
+ }
55
+
56
+ _renderMainElement() {
57
+
58
+ return React.createElement("div", {
59
+ className: "content-narrow"
60
+ }, React.createElement("div", {
61
+ ref: this.createRef("mainElement")
62
+ }, this.responsiveLayout.mainElement));
63
+ }
64
+ }
@@ -0,0 +1 @@
1
+ export {default as Card} from "./Card.js";
@@ -0,0 +1,52 @@
1
+ import React from "react";
2
+ import Dbm from "../../../index.js";
3
+
4
+ export default class DoubleImage extends Dbm.react.BaseObject {
5
+ _construct() {
6
+ super._construct();
7
+
8
+ let mobileLayout = React.createElement("div", null, /*#__PURE__*/React.createElement(Dbm.react.image.WidthScaledImage, {
9
+ elementType: "img",
10
+ image: Dbm.react.source.blockData("image1"),
11
+ targetWidth: 530,
12
+ className: "full-width"
13
+ }), /*#__PURE__*/React.createElement("div", {
14
+ className: "spacing small"
15
+ }), /*#__PURE__*/React.createElement(Dbm.react.image.WidthScaledImage, {
16
+ elementType: "img",
17
+ image: Dbm.react.source.blockData("image2"),
18
+ targetWidth: 530,
19
+ className: "full-width"
20
+ }));
21
+
22
+ let desktopLayout = React.createElement(Dbm.react.BaseObject, {
23
+ className: "flex-row small-item-spacing halfs",
24
+ style: this.item.properties.halfHeightStyle
25
+ }, /*#__PURE__*/React.createElement("div", {
26
+ className: "flex-row-item"
27
+ }, /*#__PURE__*/React.createElement(Dbm.react.image.WidthScaledImage, {
28
+ elementType: "img",
29
+ image: Dbm.react.source.blockData("image1"),
30
+ targetWidth: 530,
31
+ className: "full-width"
32
+ })), /*#__PURE__*/React.createElement("div", {
33
+ className: "flex-row-item"
34
+ }, /*#__PURE__*/React.createElement(Dbm.react.image.WidthScaledImage, {
35
+ elementType: "img",
36
+ image: Dbm.react.source.blockData("image2"),
37
+ targetWidth: 530,
38
+ className: "full-width"
39
+ })));;
40
+
41
+ this.responsiveLayout = Dbm.react.area.responsiveLayout(mobileLayout).addLayout(desktopLayout, 600);
42
+ }
43
+
44
+ _renderMainElement() {
45
+
46
+ return React.createElement("div", {
47
+ className: "centered-site"
48
+ }, React.createElement("div", {
49
+ ref: this.createRef("mainElement")
50
+ }, this.responsiveLayout.mainElement));
51
+ }
52
+ }
@@ -0,0 +1,136 @@
1
+ import React from "react";
2
+ import Dbm from "../../../index.js";
3
+
4
+ export default class ImageGallery extends Dbm.react.BaseObject {
5
+ _construct() {
6
+ super._construct();
7
+
8
+ let elementSize = new Dbm.flow.updatefunctions.dom.ElementSize();
9
+ this.item.setValue("elementSize", elementSize);
10
+
11
+ elementSize.input.properties.element.connectInput(this.item.requireProperty("mainElement", null));
12
+ elementSize.start();
13
+
14
+ {
15
+ let heightRatio = Dbm.flow.updatefunctions.logic.multiply(elementSize.output.properties.width, 0.5);
16
+ let styleObject = new Dbm.flow.updatefunctions.dom.StyleObject();
17
+ styleObject.addProperty("height", heightRatio.output.properties.result, "px");
18
+ this.item.propertyInput("halfHeightStyle", styleObject.output.properties.style);
19
+ }
20
+
21
+ {
22
+ let styleObject = new Dbm.flow.updatefunctions.dom.StyleObject();
23
+ styleObject.addProperty("height", elementSize.output.properties.width, "px");
24
+ this.item.propertyInput("fullHeightStyle", styleObject.output.properties.style);
25
+ }
26
+
27
+ {
28
+ let heightRatio = Dbm.flow.updatefunctions.logic.multiply(elementSize.output.properties.width, 3/4);
29
+ let styleObject = new Dbm.flow.updatefunctions.dom.StyleObject();
30
+ styleObject.addProperty("height", heightRatio.output.properties.result, "px");
31
+ this.item.propertyInput("fourThreeHeightStyle", styleObject.output.properties.style);
32
+ }
33
+
34
+ {
35
+ let heightRatio = Dbm.flow.updatefunctions.logic.multiply(elementSize.output.properties.width, 1/3);
36
+ let styleObject = new Dbm.flow.updatefunctions.dom.StyleObject();
37
+ styleObject.addProperty("height", heightRatio.output.properties.result, "px");
38
+ this.item.propertyInput("thirdHeightStyle", styleObject.output.properties.style);
39
+ }
40
+
41
+ let mobileLayout = React.createElement("div", null, /*#__PURE__*/React.createElement(Dbm.react.BaseObject, {
42
+ style: this.item.properties.fullHeightStyle
43
+ }, /*#__PURE__*/React.createElement(Dbm.react.image.CoverScaledImage, {
44
+ image: Dbm.react.source.blockData("image1"),
45
+ targetWidth: 600,
46
+ targetHeight: 600,
47
+ className: "full-size background-cover"
48
+ })), /*#__PURE__*/React.createElement("div", {
49
+ className: "spacing small"
50
+ }), /*#__PURE__*/React.createElement(Dbm.react.BaseObject, {
51
+ className: "flex-row small-item-spacing halfs",
52
+ style: this.item.properties.thirdHeightStyle
53
+ }, /*#__PURE__*/React.createElement("div", {
54
+ className: "flex-row-item"
55
+ }, /*#__PURE__*/React.createElement("div", {
56
+ className: "full-size placeholder-background"
57
+ }, /*#__PURE__*/React.createElement(Dbm.react.image.WidthScaledImage, {
58
+ image: Dbm.react.source.blockData("image2"),
59
+ targetWidth: 300,
60
+ className: "full-size background-cover"
61
+ }))), /*#__PURE__*/React.createElement("div", {
62
+ className: "flex-row-item"
63
+ }, /*#__PURE__*/React.createElement("div", {
64
+ className: "full-size placeholder-background"
65
+ }, /*#__PURE__*/React.createElement(Dbm.react.image.WidthScaledImage, {
66
+ image: Dbm.react.source.blockData("image3"),
67
+ targetWidth: 300,
68
+ className: "full-size background-cover"
69
+ })))), /*#__PURE__*/React.createElement("div", {
70
+ className: "spacing small"
71
+ }), /*#__PURE__*/React.createElement(Dbm.react.BaseObject, {
72
+ style: this.item.properties.fourThreeHeightStyle
73
+ }, /*#__PURE__*/React.createElement(Dbm.react.image.CoverScaledImage, {
74
+ image: Dbm.react.source.blockData("image4"),
75
+ targetWidth: 600,
76
+ targetHeight: 450,
77
+ className: "full-size background-cover"
78
+ })));
79
+
80
+ let desktopLayout = React.createElement(Dbm.react.BaseObject, {
81
+ className: "flex-row small-item-spacing halfs",
82
+ style: this.item.properties.halfHeightStyle
83
+ }, /*#__PURE__*/React.createElement("div", {
84
+ className: "flex-row-item"
85
+ }, /*#__PURE__*/React.createElement("div", {
86
+ className: "full-size placeholder-background"
87
+ }, /*#__PURE__*/React.createElement(Dbm.react.image.CoverScaledImage, {
88
+ image: Dbm.react.source.blockData("image1"),
89
+ targetWidth: 530,
90
+ targetHeight: 530,
91
+ className: "full-size background-cover"
92
+ }))), /*#__PURE__*/React.createElement("div", {
93
+ className: "flex-row-item flex-column small-item-spacing"
94
+ }, /*#__PURE__*/React.createElement("div", {
95
+ className: "flex-column-item flex-resize"
96
+ }, /*#__PURE__*/React.createElement("div", {
97
+ className: "flex-row small-item-spacing halfs full-height"
98
+ }, /*#__PURE__*/React.createElement("div", {
99
+ className: "flex-row-item"
100
+ }, /*#__PURE__*/React.createElement("div", {
101
+ className: "full-size placeholder-background"
102
+ }, /*#__PURE__*/React.createElement(Dbm.react.image.WidthScaledImage, {
103
+ image: Dbm.react.source.blockData("image2"),
104
+ targetWidth: 260,
105
+ className: "full-size background-cover"
106
+ }))), /*#__PURE__*/React.createElement("div", {
107
+ className: "flex-row-item"
108
+ }, /*#__PURE__*/React.createElement("div", {
109
+ className: "full-size placeholder-background"
110
+ }, /*#__PURE__*/React.createElement(Dbm.react.image.WidthScaledImage, {
111
+ image: Dbm.react.source.blockData("image3"),
112
+ targetWidth: 260,
113
+ className: "full-size background-cover"
114
+ }))))), /*#__PURE__*/React.createElement("div", {
115
+ className: "flex-column-item flex-no-resize"
116
+ }, /*#__PURE__*/React.createElement(Dbm.react.BaseObject, {
117
+ className: "full-size placeholder-background",
118
+ style: this.item.properties.thirdHeightStyle
119
+ }, /*#__PURE__*/React.createElement(Dbm.react.image.WidthScaledImage, {
120
+ image: Dbm.react.source.blockData("image4"),
121
+ targetWidth: 530,
122
+ className: "full-size background-cover"
123
+ })))));
124
+
125
+ this.responsiveLayout = Dbm.react.area.responsiveLayout(mobileLayout).addLayout(desktopLayout, 600);
126
+ }
127
+
128
+ _renderMainElement() {
129
+
130
+ return React.createElement("div", {
131
+ className: "centered-site"
132
+ }, /*#__PURE__*/React.createElement("div", {
133
+ ref: this.createRef("mainElement")
134
+ }, this.responsiveLayout.mainElement));
135
+ }
136
+ }
@@ -0,0 +1,2 @@
1
+ export {default as ImageGallery} from "./ImageGallery.js";
2
+ export {default as DoubleImage} from "./DoubleImage.js";
@@ -1,6 +1,8 @@
1
1
  import Dbm from "../../index.js";
2
2
  import {createElement} from "react";
3
3
 
4
+ export * as gallery from "./gallery/index.js";
5
+ export * as content from "./content/index.js";
4
6
  export {default as Image} from "./Image.js";
5
7
 
6
8
  export let createToolConfiguration = function(aId, aName, aInitialData = {}, aSanitizeSettings = {}, aIcon = null) {
@@ -101,4 +103,66 @@ export let registerAllBlocks = function() {
101
103
  registerBlock("cookie/settings", "Cookie settings", createElement(Dbm.react.cookies.CookieSettings));
102
104
  registerBlock("login/loginForm", "Login form", createElement(Dbm.react.login.LoginForm));
103
105
  registerBlock("admin/pageList", "Admin / Page list", createElement(Dbm.react.admin.pages.PageList), createElement(Dbm.react.admin.pages.PageList));
106
+ registerBlock("admin/website", "Admin / Edit website", createElement(Dbm.react.admin.website.EditWebsite));
107
+
108
+
109
+ {
110
+ let editor = createElement(Dbm.react.admin.editor.EditorBlockName, {},
111
+ createElement(Dbm.react.form.LabelledArea, {label: "Image 1"},
112
+ createElement(Dbm.react.admin.editor.fields.ImageField, {name: "image1"})
113
+ ),
114
+ createElement("div", {className: "spacing medium"}),
115
+ createElement(Dbm.react.form.LabelledArea, {label: "Image 2"},
116
+ createElement(Dbm.react.admin.editor.fields.ImageField, {name: "image2"})
117
+ ),
118
+ createElement("div", {className: "spacing medium"}),
119
+ createElement(Dbm.react.form.LabelledArea, {label: "Image 3"},
120
+ createElement(Dbm.react.admin.editor.fields.ImageField, {name: "image3"})
121
+ ),
122
+ createElement("div", {className: "spacing medium"}),
123
+ createElement(Dbm.react.form.LabelledArea, {label: "Image 4"},
124
+ createElement(Dbm.react.admin.editor.fields.ImageField, {name: "image4"})
125
+ ),
126
+ createElement("div", {className: "spacing medium"})
127
+ );
128
+ registerBlock("gallery/imageGallery", "Image gallery", createElement(Dbm.react.blocks.gallery.ImageGallery, {}), editor);
129
+ }
130
+
131
+ {
132
+ let editor = createElement(Dbm.react.admin.editor.EditorBlockName, {},
133
+ createElement(Dbm.react.form.LabelledArea, {label: "Image 1"},
134
+ createElement(Dbm.react.admin.editor.fields.ImageField, {name: "image1"})
135
+ ),
136
+ createElement("div", {className: "spacing medium"}),
137
+ createElement(Dbm.react.form.LabelledArea, {label: "Image 2"},
138
+ createElement(Dbm.react.admin.editor.fields.ImageField, {name: "image2"})
139
+ )
140
+ );
141
+ registerBlock("gallery/doubleImage", "Double image", createElement(Dbm.react.blocks.gallery.DoubleImage, {}), editor);
142
+ }
143
+
144
+ {
145
+ let editor = createElement(Dbm.react.admin.editor.EditorBlockName, {},
146
+ createElement(Dbm.react.form.LabelledArea, {label: "Image"},
147
+ createElement(Dbm.react.admin.editor.fields.ImageField, {name: "image"})
148
+ ),
149
+ createElement("div", {className: "spacing medium"}),
150
+ createElement(Dbm.react.form.LabelledArea, {label: "Title"},
151
+ createElement(Dbm.react.admin.editor.fields.TextField, {name: "title"})
152
+ ),
153
+ createElement("div", {className: "spacing medium"}),
154
+ createElement(Dbm.react.form.LabelledArea, {label: "Content"},
155
+ createElement(Dbm.react.admin.editor.fields.RichTextField, {name: "text"})
156
+ ),
157
+ createElement("div", {className: "spacing medium"}),
158
+ createElement(Dbm.react.form.LabelledArea, {label: "Url"},
159
+ createElement(Dbm.react.admin.editor.fields.TextField, {name: "url"})
160
+ ),
161
+ createElement("div", {className: "spacing medium"}),
162
+ createElement(Dbm.react.form.LabelledArea, {label: "Button"},
163
+ createElement(Dbm.react.admin.editor.fields.TextField, {name: "buttonText"})
164
+ )
165
+ );
166
+ registerBlock("content/card", "Card", createElement(Dbm.react.blocks.content.Card, {}), editor, {}, {"title": true, "text": true, "button": true});
167
+ }
104
168
  }
@@ -51,14 +51,13 @@ export default class CookieBar extends Dbm.react.BaseObject {
51
51
  )
52
52
  ),
53
53
  React.createElement("div", {"className": "spacing small"}),
54
- React.createElement("a", {"href": "/cookie-settings/", className:"custom-styled-link"},
55
- React.createElement("div", {"className": "secondary-button standard-button-padding text-align-center"}, "Settings")
56
- ),
57
-
54
+ React.createElement("div", {"className": "standard-button standard-button-padding text-align-center", onClick: () => this._acceptAll()}, "Allow all"),
58
55
  React.createElement("div", {"className": "spacing small"}),
59
56
  React.createElement("div", {"className": "secondary-button standard-button-padding text-align-center", onClick: () => this._rejectAll()}, "Only necessary"),
60
57
  React.createElement("div", {"className": "spacing small"}),
61
- React.createElement("div", {"className": "standard-button standard-button-padding text-align-center", onClick: () => this._acceptAll()}, "Allow all")
58
+ React.createElement("a", {"href": "/cookie-settings/", className:"custom-styled-link"},
59
+ React.createElement("div", {"className": "secondary-button standard-button-padding text-align-center"}, "Settings")
60
+ )
62
61
 
63
62
  );
64
63