dbm 1.1.10 → 1.1.11

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.
Files changed (36) hide show
  1. package/dbm.js +2 -1
  2. package/ecommerce/Cart.js +79 -0
  3. package/ecommerce/CartLineItem.js +44 -0
  4. package/ecommerce/LocalStorageCartLoader.js +74 -0
  5. package/ecommerce/index.js +16 -0
  6. package/graphapi/webclient/decode/index.js +16 -0
  7. package/package.json +1 -1
  8. package/react/admin/editor/fields/SelectionField.js +55 -0
  9. package/react/admin/editor/fields/index.js +2 -1
  10. package/react/admin/editorsgroup/EditField.js +28 -0
  11. package/react/admin/editorsgroup/index.js +1 -0
  12. package/react/admin/index.js +3 -1
  13. package/react/admin/objects/EditObject.js +50 -0
  14. package/react/admin/objects/InjectObjectTypeEditor.js +30 -0
  15. package/react/admin/objects/ObjectList.js +92 -0
  16. package/react/admin/objects/ObjectListRow.js +35 -0
  17. package/react/admin/objects/index.js +6 -0
  18. package/react/admin/objects/itemeditors/Content.js +48 -0
  19. package/react/admin/objects/itemeditors/Link.js +46 -0
  20. package/react/admin/objects/itemeditors/Name.js +46 -0
  21. package/react/admin/objects/itemeditors/Title.js +46 -0
  22. package/react/admin/objects/itemeditors/Visibility.js +44 -0
  23. package/react/admin/objects/itemeditors/index.js +5 -0
  24. package/react/admin/website/EditWebsite.js +8 -7
  25. package/react/area/List.js +7 -2
  26. package/react/blocks/admin/index.js +1 -0
  27. package/react/blocks/admin/objects/Edit.js +42 -0
  28. package/react/blocks/admin/objects/List.js +17 -0
  29. package/react/blocks/admin/objects/index.js +2 -0
  30. package/react/blocks/content/ContentBlock.js +47 -0
  31. package/react/blocks/content/index.js +2 -1
  32. package/react/blocks/faq/AskAQuestion.js +155 -0
  33. package/react/blocks/faq/index.js +1 -0
  34. package/react/blocks/index.js +124 -0
  35. package/site/SiteNavigation.js +6 -5
  36. package/updater/PropertyUpdater.js +10 -0
package/dbm.js CHANGED
@@ -93,4 +93,5 @@ export * as flow from "./flow/index.js";
93
93
  export * as updater from "./updater/index.js";
94
94
  export * as startup from "./startup/index.js";
95
95
  export * as site from "./site/index.js";
96
- export * as tracking from "./tracking/index.js";
96
+ export * as tracking from "./tracking/index.js";
97
+ export * as ecommerce from "./ecommerce/index.js";
@@ -0,0 +1,79 @@
1
+ import Dbm from "../index.js";
2
+
3
+ export default class Cart extends Dbm.core.BaseObject {
4
+ _construct() {
5
+ super._construct();
6
+
7
+ this._changeCommand = Dbm.commands.callFunction(this._changed.bind(this));
8
+
9
+ this.item.setValue("lineItems", []);
10
+ Dbm.flow.addUpdateCommand(this.item.properties.lineItems, this._changeCommand);
11
+ this.item.setValue("numberOfItems", 0);
12
+ this.item.setValue("numberOfLines", 0);
13
+
14
+ this.item.setValue("changeCount", 0);
15
+
16
+ //METODO: integrate local storage
17
+ }
18
+
19
+ addProduct(aProduct, aQuantity = 1) {
20
+ //console.log("addProduct");
21
+ //console.log(aQuantity);
22
+
23
+ let lineItems = this.item.lineItems;
24
+ let lineItem;
25
+ let index = Dbm.utils.ArrayFunctions.getItemIndexByIfExists(lineItems, "product", aProduct);
26
+
27
+ if(index !== -1) {
28
+ lineItem = lineItems[index];
29
+ lineItem.controller.increaseQuantity(aQuantity);
30
+ }
31
+ else {
32
+ let id = "lineItem" + Dbm.getInstance().getNextId();
33
+ lineItem = new Dbm.ecommerce.CartLineItem();
34
+ lineItem.item.setId(id);
35
+ lineItem.setProduct(aProduct);
36
+ lineItem.setQuantity(aQuantity);
37
+ lineItem.setCart(this.item);
38
+
39
+ Dbm.flow.addUpdateCommand(lineItem.item.properties.quantity, this._changeCommand);
40
+
41
+ let newLineItems = [].concat(lineItems);
42
+ newLineItems.push(lineItem.item);
43
+ this.item.lineItems = newLineItems;
44
+ }
45
+
46
+ return lineItem;
47
+ }
48
+
49
+ removeLineItem(aItem) {
50
+ let lineItems = [].concat(this.item.lineItems);
51
+
52
+ let index = lineItems.indexOf(aItem);
53
+ if(index >= 0) {
54
+ lineItems.splice(index, 1);
55
+ this.item.lineItems = lineItems;
56
+ }
57
+ }
58
+
59
+ _changed() {
60
+ //console.log("_changed");
61
+
62
+ let lineItems = this.item.lineItems;
63
+
64
+ this.item.numberOfLines = lineItems.length;
65
+
66
+ let itemsCount = 0;
67
+ let currentArray = lineItems;
68
+ let currentArrayLength = currentArray.length;
69
+ for(let i = 0; i < currentArrayLength; i++) {
70
+ let currentItem = currentArray[i];
71
+ itemsCount += currentItem.quantity;
72
+ }
73
+
74
+ this.item.numberOfItems = itemsCount;
75
+ this.item.changeCount++;
76
+
77
+ //METODO: calculate totals
78
+ }
79
+ }
@@ -0,0 +1,44 @@
1
+ import Dbm from "../index.js";
2
+
3
+ export default class CartLineItem extends Dbm.core.BaseObject {
4
+ _construct() {
5
+ super._construct();
6
+
7
+ this.item.setValue("cart", null);
8
+ this.item.setValue("product", null);
9
+ this.item.setValue("quantity", 0);
10
+ }
11
+
12
+ setCart(aItem) {
13
+ this.item.cart = aItem;
14
+
15
+ return this;
16
+ }
17
+
18
+ setProduct(aProduct) {
19
+ this.item.product = aProduct;
20
+
21
+ return this;
22
+ }
23
+
24
+ setQuantity(aQuantity) {
25
+ console.log("setQuantity");
26
+ console.log(aQuantity);
27
+
28
+ this.item.quantity = aQuantity;
29
+
30
+ return this;
31
+ }
32
+
33
+ increaseQuantity(aQuantity) {
34
+ this.item.quantity += aQuantity;
35
+
36
+ return this;
37
+ }
38
+
39
+ remove() {
40
+ this.item.cart.controller.removeLineItem(this.item);
41
+
42
+ return this;
43
+ }
44
+ }
@@ -0,0 +1,74 @@
1
+ import Dbm from "../index.js";
2
+
3
+ export default class LocalStorageCartLoader extends Dbm.core.BaseObject {
4
+ _construct() {
5
+ super._construct();
6
+
7
+ this._changeCommand = Dbm.commands.callFunction(this._changed.bind(this));
8
+
9
+ this._isLoading = false;
10
+ this.item.requireProperty("storageKey", "cart");
11
+ this.item.requireProperty("cart", null);
12
+ }
13
+
14
+ setCart(aCart) {
15
+ this.item.cart = aCart;
16
+ Dbm.flow.addUpdateCommand(aCart.properties.changeCount, this._changeCommand);
17
+
18
+ return this;
19
+ }
20
+
21
+ load() {
22
+ //console.log("load");
23
+
24
+ let repository = Dbm.getInstance().repository;
25
+
26
+ this._isLoading = true;
27
+ try {
28
+ let cartDataString = localStorage.getItem(this.item.storageKey);
29
+ if(cartDataString) {
30
+ let cartData = JSON.parse(cartDataString);
31
+ console.log(cartData);
32
+ let currentArray = cartData.lineItems;
33
+ let currentArrayLength = currentArray.length;
34
+ for(let i = 0; i < currentArrayLength; i++) {
35
+ let currentData = currentArray[i];
36
+
37
+ console.log(">>>>>>>>", currentData["quantity"]);
38
+ this.item.cart.controller.addProduct(repository.getItem(currentData["product"]), currentData["quantity"]);
39
+ }
40
+ }
41
+ }
42
+ catch(theError) {
43
+ console.error(theError);
44
+ }
45
+
46
+ this._isLoading = false;
47
+ }
48
+
49
+ _changed() {
50
+ //console.log("_changed");
51
+
52
+ if(this._isLoading) {
53
+ return;
54
+ }
55
+
56
+ let encodedLineItems = [];
57
+
58
+ let currentArray = this.item.cart.lineItems;
59
+ let currentArrayLength = currentArray.length;
60
+ for(let i = 0; i < currentArrayLength; i++) {
61
+ let currentData = currentArray[i];
62
+
63
+ let encodedData = {"product": currentData.product.id, "quantity": currentData.quantity};
64
+ encodedLineItems.push(encodedData);
65
+ }
66
+
67
+ try {
68
+ let cartDataString = localStorage.setItem(this.item.storageKey, JSON.stringify({"lineItems": encodedLineItems}));
69
+ }
70
+ catch(theError) {
71
+ console.error(theError);
72
+ }
73
+ }
74
+ }
@@ -0,0 +1,16 @@
1
+ import Dbm from "../index.js";
2
+
3
+ export {default as Cart} from "./Cart.js";
4
+ export {default as CartLineItem} from "./CartLineItem.js";
5
+ export {default as LocalStorageCartLoader} from "./LocalStorageCartLoader.js";
6
+
7
+ export const setup = function() {
8
+
9
+ let cart = new Dbm.ecommerce.Cart();
10
+ cart.item.register("cart");
11
+
12
+ let localStorageLoader = new Dbm.ecommerce.LocalStorageCartLoader();
13
+ localStorageLoader.setCart(cart.item);
14
+ localStorageLoader.load();
15
+
16
+ }
@@ -125,4 +125,20 @@ export const fullSetup = function() {
125
125
  currentDecoder.item.setValue("encodingType", name);
126
126
  currentDecoder.item.register(decodePrefix + name);
127
127
  }
128
+
129
+ {
130
+ let name = "objectTypes";
131
+ let currentDecoder = new Dbm.graphapi.webclient.decode.DecodeBaseObject();
132
+ currentDecoder.item.setValue("copyFields", ["objectTypes"]);
133
+ currentDecoder.item.setValue("encodingType", name);
134
+ currentDecoder.item.register(decodePrefix + name);
135
+ }
136
+
137
+ {
138
+ let name = "helpSection";
139
+ let currentDecoder = new Dbm.graphapi.webclient.decode.DecodeBaseObject();
140
+ currentDecoder.item.setValue("copyFields", ["title", "link"]);
141
+ currentDecoder.item.setValue("encodingType", name);
142
+ currentDecoder.item.register(decodePrefix + name);
143
+ }
128
144
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dbm",
3
- "version": "1.1.10",
3
+ "version": "1.1.11",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "scripts": {},
@@ -0,0 +1,55 @@
1
+ import React from "react";
2
+ import Dbm from "../../../../index.js";
3
+
4
+ export default class SelectionField 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 = null;
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
+
37
+ let editorData = Dbm.objectPath(this.context, "moduleData.editorData");
38
+
39
+ let newData = {...editorData.data};
40
+ newData[fieldName] = newValue;
41
+
42
+ editorData.data = newData;
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
+ _renderMainElement() {
53
+ return this._createMainElement(Dbm.react.form.Selection, {value: this.item.properties.value, className: "full-width"}, this.getPropValue("children"));
54
+ }
55
+ }
@@ -2,4 +2,5 @@ export {default as TextField} from "./TextField.js";
2
2
  export {default as RichTextField} from "./RichTextField.js";
3
3
  export {default as ImageField} from "./ImageField.js";
4
4
  export {default as CheckboxField} from "./CheckboxField.js";
5
- export {default as SelectObjectField} from "./SelectObjectField.js";
5
+ export {default as SelectObjectField} from "./SelectObjectField.js";
6
+ export {default as SelectionField} from "./SelectionField.js";
@@ -0,0 +1,28 @@
1
+ import React from "react";
2
+ import Dbm from "../../../index.js";
3
+
4
+ export default class EditField extends Dbm.react.BaseObject {
5
+ _construct() {
6
+ super._construct();
7
+
8
+ let item = this.context.item;
9
+ let itemEditor = this.context.itemEditor;
10
+ let fieldName = this.getPropValue("fieldName");
11
+ let initialDataPath = this.getPropValueWithDefault("initialDataPath", fieldName);
12
+ let initialData = Dbm.objectPath(item, initialDataPath);
13
+
14
+ console.log(">>>>>>>>>>", initialData, item, initialDataPath);
15
+
16
+ let editor = itemEditor.addFieldEditor(fieldName, initialData);
17
+ this.item.setValue("editor", editor.item);
18
+ }
19
+
20
+ _renderMainElement() {
21
+
22
+ let children = this.getPropValue("children")
23
+
24
+ return React.createElement("div", {},
25
+ React.createElement(Dbm.react.context.AddContextVariables, {"values": {"valueEditor": this.item.editor}}, children)
26
+ );
27
+ }
28
+ }
@@ -0,0 +1 @@
1
+ export {default as EditField} from "./EditField.js";
@@ -4,4 +4,6 @@ export {default as SelectImageFromLibrary} from "./SelectImageFromLibrary.js";
4
4
 
5
5
  export * as editor from "./editor/index.js";
6
6
  export * as pages from "./pages/index.js";
7
- export * as website from "./website/index.js";
7
+ export * as website from "./website/index.js";
8
+ export * as objects from "./objects/index.js";
9
+ export * as editorsgroup from "./editorsgroup/index.js";
@@ -0,0 +1,50 @@
1
+ import React from "react";
2
+ import Dbm from "../../../index.js";
3
+
4
+ export default class EditObject extends Dbm.react.BaseObject {
5
+ _construct() {
6
+ super._construct();
7
+
8
+ let graphApi = Dbm.getInstance().repository.getItem("graphApi").controller;
9
+
10
+ let id = this.getPropValue("id");
11
+
12
+ let allLoaded = Dbm.flow.updatefunctions.logic.allAtValue(Dbm.loading.LoadingStatus.LOADED);
13
+ this.item.requireProperty("loaded", false);
14
+
15
+ {
16
+ let request = graphApi.requestRange(
17
+ [
18
+ {"type": "includePrivate"},
19
+ {"type": "includeDraft"},
20
+ {"type": "idSelection", "ids": [id]},
21
+ ],
22
+ ["objectTypes"]
23
+ );
24
+ allLoaded.addCheck(request.properties.status);
25
+ }
26
+
27
+ this.item.properties.loaded.connectInput(allLoaded.output.properties.value);
28
+ }
29
+
30
+
31
+
32
+ _renderMainElement() {
33
+
34
+ let id = this.getPropValue("id");
35
+ let item = Dbm.getInstance().repository.getItem(id);
36
+ let itemEditor = this.context.editorGroup.getItemEditor(id);
37
+
38
+ return React.createElement("div", {},
39
+
40
+ React.createElement(Dbm.react.area.HasData, {check: this.item.properties.loaded},
41
+ React.createElement(Dbm.react.context.AddContextVariables, {"values": {"item": item, "itemEditor": itemEditor}},
42
+ React.createElement(Dbm.react.area.List, {items: Dbm.react.source.contextVariable("item.objectTypes"), "as": "objectType", "keyField": "(root)"},
43
+ React.createElement(Dbm.react.admin.objects.InjectObjectTypeEditor, {type: Dbm.react.source.contextVariable("objectType")})
44
+ )
45
+ )
46
+ )
47
+
48
+ )
49
+ }
50
+ }
@@ -0,0 +1,30 @@
1
+ import React from "react";
2
+ import Dbm from "../../../index.js";
3
+
4
+ export default class InjectObjectTypeEditor extends Dbm.react.BaseObject {
5
+ _construct() {
6
+ super._construct();
7
+ }
8
+
9
+
10
+
11
+ _renderMainElement() {
12
+
13
+ let type = this.getPropValue("type");
14
+ let editor = Dbm.getInstance().repository.getItem("admin/objectTypeEditors/" + type);
15
+
16
+ let editors = editor.editors;
17
+ if(!editors) {
18
+ return null;
19
+ }
20
+ let elements = Dbm.utils.ArrayFunctions.mapField(editors, "element");
21
+
22
+ console.log(editors, elements);
23
+
24
+ if(!elements) {
25
+ return null;
26
+ }
27
+
28
+ return React.createElement(Dbm.react.area.InsertElement, {element: elements});
29
+ }
30
+ }
@@ -0,0 +1,92 @@
1
+ import React from "react";
2
+ import Dbm from "../../../index.js";
3
+
4
+ export default class ObjectList extends Dbm.react.BaseObject {
5
+ _construct() {
6
+ super._construct();
7
+
8
+ let graphApi = Dbm.getInstance().repository.getItem("graphApi").controller;
9
+
10
+ this.item.requireProperty("items", []);
11
+
12
+ let objectType = this.getPropValue("objectType");
13
+ let encodings = this.getPropValueWithDefault("encodings", ["name"]);
14
+
15
+ let allLoaded = Dbm.flow.updatefunctions.logic.allAtValue(Dbm.loading.LoadingStatus.LOADED);
16
+ this.item.requireProperty("loaded", false);
17
+
18
+ {
19
+ let request = graphApi.requestRange(
20
+ [
21
+ {"type": "includePrivate"},
22
+ {"type": "includeDraft"},
23
+ {"type": "byObjectType", "objectType": objectType},
24
+ ],
25
+ encodings
26
+ );
27
+ Dbm.flow.addUpdateCommandWhenMatched(request.properties.status, Dbm.loading.LoadingStatus.LOADED, Dbm.commands.callFunction(this._loaded.bind(this), [request]));
28
+ allLoaded.addCheck(request.properties.status);
29
+ }
30
+
31
+ this.item.properties.loaded.connectInput(allLoaded.output.properties.value);
32
+ }
33
+
34
+ _loaded(aRequest) {
35
+ console.log("_loaded");
36
+
37
+ let currentArray = [].concat(aRequest.items);
38
+
39
+ let nameField = this.getPropValueWithDefault("nameField", "name");
40
+ Dbm.utils.ArrayFunctions.sortOnField(currentArray, nameField);
41
+
42
+ this.item.items = currentArray;
43
+ }
44
+
45
+ _create() {
46
+ console.log("_create");
47
+ let objectType = this.getPropValue("objectType");
48
+ let encodings = this.getPropValueWithDefault("encodings", ["name"]);
49
+ let visibility = this.getPropValueWithDefault("visibility", "private");
50
+
51
+ let changes = [
52
+ {"type": "setField", "data": {"value": "Unnamed " + objectType, "field": "name"}}
53
+ ];
54
+
55
+ let request = Dbm.getInstance().repository.getItem("graphApi").controller.createItem([objectType], visibility, changes, encodings);
56
+
57
+ Dbm.flow.addUpdateCommand(request.properties.status, Dbm.commands.callFunction(this._created.bind(this), [request]));
58
+ }
59
+
60
+ _created(aRequest) {
61
+ console.log("_created");
62
+ console.log(aRequest);
63
+
64
+ let newItems = [].concat(this.item.items);
65
+ console.log(newItems);
66
+ newItems.push(aRequest.item);
67
+ this.item.items = newItems;
68
+ }
69
+
70
+ _renderMainElement() {
71
+
72
+ let nameField = this.getPropValueWithDefault("nameField", "name");
73
+
74
+ let id = Dbm.react.source.contextVariable("item.id");
75
+ let text = Dbm.react.source.contextVariable("item." + nameField);
76
+
77
+ return React.createElement("div", {"className": "standard-alternating-rows"},
78
+ React.createElement(Dbm.react.area.List, {items: this.item.properties.items},
79
+ React.createElement(Dbm.react.admin.objects.ObjectListRow, {"id": id, "text": text})
80
+ ),
81
+ React.createElement("div", {"className": "spacing standard"}),
82
+ React.createElement("div", {"className": "flex-row"},
83
+ React.createElement("div", {"className": "flex-row-item"},
84
+ React.createElement(Dbm.react.interaction.CommandButton, {"command": Dbm.commands.callFunction(this._create.bind(this))},
85
+ React.createElement("div", {"className": "standard-button standard-button-padding"}, "Create")
86
+ )
87
+ )
88
+ )
89
+
90
+ )
91
+ }
92
+ }
@@ -0,0 +1,35 @@
1
+ import React from "react";
2
+ import Dbm from "../../../index.js";
3
+
4
+ export default class ObjectListRow extends Dbm.react.BaseObject {
5
+ _construct() {
6
+ super._construct();
7
+ }
8
+
9
+ _renderMainElement() {
10
+
11
+ let id = this.getPropValue("id");
12
+ let text = this.getPropValue("text");
13
+
14
+ let baseUrl = "/admin/items/item/edit/?id={id}";
15
+ let url = baseUrl.split("{id}").join(id);
16
+
17
+ return React.createElement("div", {"className": "standard-row"},
18
+ React.createElement(Dbm.react.text.Link, {"href": url, "className": "custom-styled-link hover-row"},
19
+ React.createElement("div", {"className": "standard-row-padding"},
20
+ React.createElement("div", {"className": "flex-row small-item-spacing"},
21
+ React.createElement("div", {"className": "flex-row-item flex-no-resize"},
22
+ Dbm.react.text.text(id),
23
+ ),
24
+ React.createElement("div", {"className": "flex-row-item flex-resize"},
25
+ Dbm.react.text.text(text)
26
+ ),
27
+ React.createElement("div", {"className": "flex-row-item flex-no-resize"},
28
+ ">"
29
+ ),
30
+ )
31
+ )
32
+ )
33
+ );
34
+ }
35
+ }
@@ -0,0 +1,6 @@
1
+ export {default as ObjectList} from "./ObjectList.js";
2
+ export {default as ObjectListRow} from "./ObjectListRow.js";
3
+ export {default as EditObject} from "./EditObject.js";
4
+ export {default as InjectObjectTypeEditor} from "./InjectObjectTypeEditor.js";
5
+
6
+ export * as itemeditors from "./itemeditors/index.js";
@@ -0,0 +1,48 @@
1
+ import React from "react";
2
+ import Dbm from "../../../../index.js";
3
+
4
+ export default class Content extends Dbm.react.BaseObject {
5
+ _construct() {
6
+ super._construct();
7
+
8
+ let graphApi = Dbm.getInstance().repository.getItem("graphApi").controller;
9
+
10
+ let id = this.context.item.id;
11
+
12
+ let allLoaded = Dbm.flow.updatefunctions.logic.allAtValue(Dbm.loading.LoadingStatus.LOADED);
13
+ this.item.requireProperty("loaded", false);
14
+
15
+ {
16
+ let request = graphApi.requestRange(
17
+ [
18
+ {"type": "includePrivate"},
19
+ {"type": "includeDraft"},
20
+ {"type": "idSelection", "ids": [id]},
21
+ ],
22
+ ["urlRequest", "admin_fields"]
23
+ );
24
+ allLoaded.addCheck(request.properties.status);
25
+ }
26
+
27
+ this.item.properties.loaded.connectInput(allLoaded.output.properties.value);
28
+ }
29
+
30
+ _renderMainElement() {
31
+
32
+ let id = this.context.item.id;
33
+
34
+ return React.createElement("div", {},
35
+
36
+ React.createElement(Dbm.react.area.HasData, {check: this.item.properties.loaded},
37
+ React.createElement(Dbm.react.form.LabelledArea, {label: "Content"},
38
+ React.createElement("div", {className: "standard-field standard-field-padding"},
39
+ React.createElement(Dbm.react.admin.editorsgroup.EditField, {"fieldName": "content"},
40
+ React.createElement(Dbm.react.admin.editor.Editor, {value: Dbm.react.source.contextVariable("valueEditor.editValue.value")})
41
+ )
42
+ )
43
+ )
44
+ )
45
+
46
+ )
47
+ }
48
+ }
@@ -0,0 +1,46 @@
1
+ import React from "react";
2
+ import Dbm from "../../../../index.js";
3
+
4
+ export default class Link extends Dbm.react.BaseObject {
5
+ _construct() {
6
+ super._construct();
7
+
8
+ let graphApi = Dbm.getInstance().repository.getItem("graphApi").controller;
9
+
10
+ let id = this.context.item.id;
11
+
12
+ let allLoaded = Dbm.flow.updatefunctions.logic.allAtValue(Dbm.loading.LoadingStatus.LOADED);
13
+ this.item.requireProperty("loaded", false);
14
+
15
+ {
16
+ let request = graphApi.requestRange(
17
+ [
18
+ {"type": "includePrivate"},
19
+ {"type": "includeDraft"},
20
+ {"type": "idSelection", "ids": [id]},
21
+ ],
22
+ ["admin_fields"]
23
+ );
24
+ allLoaded.addCheck(request.properties.status);
25
+ }
26
+
27
+ this.item.properties.loaded.connectInput(allLoaded.output.properties.value);
28
+ }
29
+
30
+ _renderMainElement() {
31
+
32
+ let id = this.context.item.id;
33
+
34
+ return React.createElement("div", {},
35
+
36
+ React.createElement(Dbm.react.area.HasData, {check: this.item.properties.loaded},
37
+ React.createElement(Dbm.react.form.LabelledArea, {label: "Link"},
38
+ React.createElement(Dbm.react.admin.editorsgroup.EditField, {"fieldName": "link", "initialDataPath": "fields.link"},
39
+ React.createElement(Dbm.react.form.FormField, {value: Dbm.react.source.contextVariable("valueEditor.editValue.value"), className: "standard-field standard-field-padding full-width"})
40
+ )
41
+ )
42
+ )
43
+
44
+ )
45
+ }
46
+ }