dbm 1.1.15 → 1.1.16

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.
@@ -48,6 +48,12 @@ export default class FlowProperty extends Dbm.flow.FlowBaseObject {
48
48
  return this;
49
49
  }
50
50
 
51
+ delayValue(aToValue, aDelay = 0) {
52
+ Dbm.getInstance().repository.getItem("propertyUpdater").controller.delayUpdateProperty(this, aToValue, aDelay);
53
+
54
+ return this;
55
+ }
56
+
51
57
  getMostUpstreamProperty() {
52
58
 
53
59
  let debugCounter = 0;
@@ -0,0 +1,39 @@
1
+ import Dbm from "../../../../index.js";
2
+
3
+ export default class UpdateObjectParent extends Dbm.flow.FlowUpdateFunction {
4
+
5
+ _construct() {
6
+ super._construct();
7
+
8
+ this.input.register("object", null);
9
+ this.input.register("parent", null);
10
+ this.input.register("added", false);
11
+
12
+ this.output.register("dynamicUpdate", 0);
13
+ }
14
+
15
+ _update() {
16
+ console.log("UpdateObjectParent::_update");
17
+
18
+ let dynamicUpdate = this.output.dynamicUpdate;
19
+ dynamicUpdate++;
20
+
21
+ let object = this.input.object;
22
+ //MENOTE: if object is changed, it doesn't remove the old one from the parent
23
+
24
+ if(object) {
25
+ let parent = this.input.parent;
26
+
27
+ if(parent && this.input.added) {
28
+ parent.add(object);
29
+ }
30
+ else {
31
+ if(object.parent) {
32
+ object.parent.remove(object);
33
+ }
34
+ }
35
+ }
36
+
37
+ this.output.dynamicUpdate = dynamicUpdate;
38
+ }
39
+ }
@@ -1,6 +1,7 @@
1
1
  import Dbm from "../../../../index.js";
2
2
 
3
3
  export {default as UpdateObjectPosition} from "./UpdateObjectPosition.js";
4
+ export {default as UpdateObjectParent} from "./UpdateObjectParent.js";
4
5
 
5
6
  export const updateObjectPosition = function(aObject, aX = 0, aY = 0, aZ = 0, aRotationX = 0, aRotationY = 0, aRotationZ = 0, aScaleX = 1, aScaleY = 1, aScaleZ = 1) {
6
7
  let newUpdateObjectPosition = new Dbm.flow.updatefunctions.thirdparty.threejs.UpdateObjectPosition();
@@ -23,4 +24,18 @@ export const updateObjectPosition = function(aObject, aX = 0, aY = 0, aZ = 0, aR
23
24
  newUpdateObjectPosition.output.properties.dynamicUpdate.startUpdating();
24
25
 
25
26
  return newUpdateObjectPosition;
27
+ }
28
+
29
+ export const updateObjectParent = function(aObject, aParent, aAdded = false) {
30
+ let newUpdateFunction = new Dbm.flow.updatefunctions.thirdparty.threejs.UpdateObjectParent();
31
+
32
+ let inputProperties = newUpdateFunction.input.properties;
33
+ inputProperties.object.setOrConnect(aObject);
34
+
35
+ inputProperties.parent.setOrConnect(aParent);
36
+ inputProperties.added.setOrConnect(aAdded);
37
+
38
+ newUpdateFunction.output.properties.dynamicUpdate.startUpdating();
39
+
40
+ return newUpdateFunction;
26
41
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dbm",
3
- "version": "1.1.15",
3
+ "version": "1.1.16",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "scripts": {},
@@ -0,0 +1,80 @@
1
+ import React from "react";
2
+ import Dbm from "../../../../index.js";
3
+
4
+ export default class SelectObjectsField 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
+ this.context.moduleData.editorData.editorBlock.dataUpdated();
44
+ }
45
+
46
+ _objectChanged() {
47
+ //console.log("_objectChanged");
48
+
49
+ this.item.value = this._getObjectData();
50
+ }
51
+
52
+ _add(aArrayEditor) {
53
+ console.log("_add");
54
+ console.log(aArrayEditor);
55
+
56
+ let newItemData = this.getPropValueWithDefault("newItemData", {});
57
+
58
+ aArrayEditor.push(newItemData);
59
+ }
60
+
61
+ _removeItem(aArrayEditor, aItem) {
62
+ aArrayEditor.removeItem(aItem);
63
+ }
64
+
65
+ _renderMainElement() {
66
+
67
+
68
+ return this._createMainElement(Dbm.react.form.EditArray, {value: this.item.properties.value},
69
+ React.createElement("div", {},
70
+ this.getPropValue("children"),
71
+ React.createElement(Dbm.react.interaction.CommandButton, {command: Dbm.commands.callFunction(this._removeItem, [Dbm.react.source.contextVariable("arrayEditor"), Dbm.react.source.contextVariable("item")])},
72
+ React.createElement("div", {}, "Remove")
73
+ )
74
+ ),
75
+ React.createElement(Dbm.react.interaction.CommandButton, {"data-slot": "after", command: Dbm.commands.callFunction(this._add.bind(this), [Dbm.react.source.contextVariable("arrayEditor")])},
76
+ React.createElement("div", {className: "action-button action-button-padding"}, "Add")
77
+ )
78
+ );
79
+ }
80
+ }
@@ -52,6 +52,6 @@ export default class SelectObjectField extends Dbm.react.BaseObject {
52
52
  }
53
53
 
54
54
  _renderMainElement() {
55
- return this._createMainElement(Dbm.react.form.GraphApiObjectSelection, {value: this.item.properties.value, objectType: this.getPropValue("objectType"), className: "standard-field standard-field-padding full-width"});
55
+ return this._createMainElement(Dbm.react.form.GraphApiObjectSelection, {value: this.item.properties.value, objectType: this.getPropValue("objectType"), encoding: this.getPropValue("encoding"), nameField: this.getPropValue("nameField"), className: "standard-field standard-field-padding full-width"});
56
56
  }
57
57
  }
@@ -19,8 +19,6 @@ export default class SelectObjectsField extends Dbm.react.BaseObject {
19
19
 
20
20
  let editorData = Dbm.objectPath(this.context, "moduleData.editorData");
21
21
 
22
- console.log(">>>>>", editorData);
23
-
24
22
  let returnData = editorData.data[fieldName];
25
23
  if(!returnData) {
26
24
  returnData = [];
@@ -31,7 +29,7 @@ export default class SelectObjectsField extends Dbm.react.BaseObject {
31
29
 
32
30
 
33
31
  _valueChanged() {
34
- console.log("_valueChanged");
32
+ //console.log("_valueChanged");
35
33
 
36
34
  let fieldName = this.getPropValue("name");
37
35
  let newValue = this.item.value;
@@ -4,4 +4,5 @@ export {default as ImageField} from "./ImageField.js";
4
4
  export {default as CheckboxField} from "./CheckboxField.js";
5
5
  export {default as SelectObjectField} from "./SelectObjectField.js";
6
6
  export {default as SelectObjectsField} from "./SelectObjectsField.js";
7
- export {default as SelectionField} from "./SelectionField.js";
7
+ export {default as SelectionField} from "./SelectionField.js";
8
+ export {default as ArrayField} from "./ArrayField.js";
@@ -27,7 +27,6 @@ export default class ContentBlock extends Dbm.react.BaseObject {
27
27
  _loaded(aRequest) {
28
28
  //console.log("_loaded");
29
29
  this.item.item = aRequest.items[0];
30
-
31
30
  }
32
31
 
33
32
  _renderMainElement() {
@@ -214,8 +214,8 @@ export let registerAllBlocks = function() {
214
214
  createElement(Dbm.react.admin.editor.fields.TextField, {name: "text1"})
215
215
  ),
216
216
  createElement("div", {className: "spacing medium"}),
217
- createElement(Dbm.react.form.LabelledArea, {label: "Intial sections"},
218
- createElement(Dbm.react.admin.editor.fields.SelectObjectsField, {objectType: "helpSection", name:"initialSections"})
217
+ createElement(Dbm.react.form.LabelledArea, {label: "Initial sections"},
218
+ createElement(Dbm.react.admin.editor.fields.SelectObjectsField, {objectType: "helpSection", name:"initialSections", "encoding": "title", "nameField": "title"})
219
219
  ),
220
220
  );
221
221
  registerBlock("faq/askAQuestion", "FAQ / Ask a question", createElement(Dbm.react.blocks.faq.AskAQuestion, {}), editor, {}, {"text1": true, "text2": true});
@@ -156,6 +156,8 @@ export default class CookieBar extends Dbm.react.BaseObject {
156
156
  Dbm.getInstance().repository.getItem("trackingController").allowStatistics = true;
157
157
  Dbm.getInstance().repository.getItem("trackingController").allowMarketing = true;
158
158
 
159
+ Dbm.getInstance().repository.getItem("userSettings").setValue("hideCookieBar", true);
160
+
159
161
  this.getDynamicProp("open").getMostUpstreamProperty().setValue(false);
160
162
  }
161
163
 
@@ -175,6 +177,8 @@ export default class CookieBar extends Dbm.react.BaseObject {
175
177
  Dbm.getInstance().repository.getItem("trackingController").allowStatistics = false;
176
178
  Dbm.getInstance().repository.getItem("trackingController").allowMarketing = false;
177
179
 
180
+ Dbm.getInstance().repository.getItem("userSettings").setValue("hideCookieBar", true);
181
+
178
182
  this.getDynamicProp("open").getMostUpstreamProperty().setValue(false);
179
183
  }
180
184
 
@@ -0,0 +1,28 @@
1
+ import React from "react";
2
+ import Dbm from "../../index.js";
3
+
4
+ export default class EditObjectProperty extends Dbm.react.BaseObject {
5
+ _construct() {
6
+ super._construct();
7
+
8
+ this._valueSelector = new Dbm.flow.controllers.transform.PartOfObject();
9
+
10
+ this._valueSelector.item.properties.object.connectInput(this.getDynamicPropWithoutState("value", {}));
11
+ this._valueSelector.item.properties.path.connectInput(this.getDynamicPropWithoutState("path", {}));
12
+
13
+ this.item.requireProperty("value", []).connectInput(this._valueSelector.item.properties.value);
14
+
15
+ }
16
+
17
+ _renderMainElement() {
18
+
19
+ let children = this.getPropValue("children");
20
+
21
+ return this._createMainElement("div", {},
22
+ React.createElement(Dbm.react.context.AddContextVariables, {values: {"value": this.item.properties.value}},
23
+ children
24
+ )
25
+ );
26
+ }
27
+ }
28
+
@@ -7,4 +7,5 @@ export {default as GraphApiObjectSelection} from "./GraphApiObjectSelection.js";
7
7
  export {default as GraphApiSelectOrCreateObject} from "./GraphApiSelectOrCreateObject.js";
8
8
  export {default as GraphApiImage} from "./GraphApiImage.js";
9
9
  export {default as EditArray} from "./EditArray.js";
10
- export {default as TextArea} from "./TextArea.js";
10
+ export {default as TextArea} from "./TextArea.js";
11
+ export {default as EditObjectProperty} from "./EditObjectProperty.js";
@@ -40,6 +40,9 @@ export default class Controller extends Dbm.core.BaseObject {
40
40
  setupPermissionsFromCookies() {
41
41
  this.item.allowStatistics = Cookies.get("cookie/allowStatistics") === "1";
42
42
  this.item.allowMarketing = Cookies.get("cookie/allowMarketing") === "1";
43
+
44
+ let cookieBarHiddenInitialSetting = Cookies.get("cookie/hideCookieBar") === "1";
45
+ let showingCookieBar = Dbm.getInstance().repository.getItem("userSettings").setValue("hideCookieBar", cookieBarHiddenInitialSetting);
43
46
 
44
47
  return this;
45
48
  }
@@ -108,7 +108,30 @@ export default class PropertyUpdater extends Dbm.core.BaseObject {
108
108
  if(!aEasing) {
109
109
  aEasing = Easing.Quadratic.Out;
110
110
  }
111
- let tween = new Tween(tweenObject).to({"envelope": aToValue}, 1000*aTime).delay(1000*aDelay).easing(aEasing).onUpdate(function(aData) {aProperty.value = aData.envelope}).onComplete(() => {this.removeTween(tween)}).start();
111
+
112
+ let tween = new Tween(tweenObject).to({"envelope": aToValue}, 1000*aTime).delay(1000*aDelay).easing(aEasing).onUpdate(function(aData) {
113
+ aProperty.value = aData.envelope;
114
+ }).onComplete(() => {this.removeTween(tween)}).start();
115
+
116
+ let tweens = [].concat(this.item.tweens);
117
+ tweens.push(tween);
118
+ this.item.tweens = tweens;
119
+
120
+ this._currentTweens.set(aProperty, tween);
121
+
122
+ return this;
123
+ }
124
+
125
+ delayUpdateProperty(aProperty, aToValue, aDelay = 0) {
126
+ if(this._currentTweens.has(aProperty)) {
127
+ this._currentTweens.get(aProperty).stop();
128
+ }
129
+
130
+ let tweenObject = {"envelope": aProperty.value};
131
+
132
+ let tween = new Tween(tweenObject).to({"envelope": aToValue}, 0).delay(1000*aDelay).onUpdate(function(aData) {
133
+ aProperty.value = aToValue;
134
+ }).onComplete(() => {this.removeTween(tween)}).start();
112
135
 
113
136
  let tweens = [].concat(this.item.tweens);
114
137
  tweens.push(tween);