dbm 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/commands/CallFunction.js +21 -0
  2. package/commands/CommandBaseObject.js +11 -0
  3. package/commands/ResolvePromise.js +20 -0
  4. package/commands/index.js +36 -0
  5. package/core/BaseObject.js +23 -0
  6. package/core/GlobalObject.js +18 -0
  7. package/core/LifeCycleObject.js +25 -0
  8. package/core/index.js +3 -0
  9. package/dbm.js +71 -0
  10. package/flow/DirtyCommands.js +45 -0
  11. package/flow/FlowBaseObject.js +78 -0
  12. package/flow/FlowProperty.js +146 -0
  13. package/flow/FlowUpdateFunction.js +39 -0
  14. package/flow/UpdateFunctionInputs.js +58 -0
  15. package/flow/UpdateFunctionOutputs.js +51 -0
  16. package/flow/index.js +40 -0
  17. package/flow/updatefunctions/basic/CombineString.js +45 -0
  18. package/flow/updatefunctions/basic/RunCommand.js +34 -0
  19. package/flow/updatefunctions/basic/index.js +2 -0
  20. package/flow/updatefunctions/debug/Log.js +30 -0
  21. package/flow/updatefunctions/debug/index.js +1 -0
  22. package/flow/updatefunctions/dom/ElementSize.js +47 -0
  23. package/flow/updatefunctions/dom/StyleObject.js +43 -0
  24. package/flow/updatefunctions/dom/index.js +2 -0
  25. package/flow/updatefunctions/index.js +5 -0
  26. package/flow/updatefunctions/logic/Addition.js +19 -0
  27. package/flow/updatefunctions/logic/Multiplication.js +19 -0
  28. package/flow/updatefunctions/logic/RangeSwitch.js +46 -0
  29. package/flow/updatefunctions/logic/Subtraction.js +19 -0
  30. package/flow/updatefunctions/logic/index.js +38 -0
  31. package/flow/updatefunctions/react/UpdateState.js +22 -0
  32. package/flow/updatefunctions/react/index.js +1 -0
  33. package/graphapi/index.js +1 -0
  34. package/graphapi/webclient/WebSocketConnection.js +236 -0
  35. package/graphapi/webclient/WebSocketRequest.js +30 -0
  36. package/graphapi/webclient/decode/DecodeBaseObject.js +48 -0
  37. package/graphapi/webclient/decode/index.js +59 -0
  38. package/graphapi/webclient/index.js +4 -0
  39. package/index.js +1 -0
  40. package/loading/JsonLoader.js +128 -0
  41. package/loading/LoadingStatus.js +4 -0
  42. package/loading/ScriptLoader.js +40 -0
  43. package/loading/index.js +24 -0
  44. package/package.json +17 -0
  45. package/react/BaseObject.js +179 -0
  46. package/react/RefToProperty.js +20 -0
  47. package/react/admin/Editor.js +153 -0
  48. package/react/admin/EditorBlock.js +53 -0
  49. package/react/admin/EditorBlockName.js +19 -0
  50. package/react/admin/index.js +3 -0
  51. package/react/area/HasData.js +22 -0
  52. package/react/area/InsertElement.js +22 -0
  53. package/react/area/index.js +2 -0
  54. package/react/blocks/index.js +61 -0
  55. package/react/context/AddContextVariables.js +22 -0
  56. package/react/context/Context.js +4 -0
  57. package/react/context/index.js +2 -0
  58. package/react/cookies/CookieBar.js +162 -0
  59. package/react/cookies/CookieSettings.js +118 -0
  60. package/react/cookies/index.js +2 -0
  61. package/react/form/Checkbox.js +28 -0
  62. package/react/form/FormField.js +28 -0
  63. package/react/form/index.js +2 -0
  64. package/react/index.js +13 -0
  65. package/react/login/LoginForm.js +113 -0
  66. package/react/login/index.js +1 -0
  67. package/react/modules/ModuleCreator.js +30 -0
  68. package/react/modules/index.js +1 -0
  69. package/react/source/ContextVariableSource.js +19 -0
  70. package/react/source/index.js +1 -0
  71. package/react/text/HtmlText.js +14 -0
  72. package/react/text/Text.js +13 -0
  73. package/react/text/index.js +19 -0
  74. package/repository/Item.js +70 -0
  75. package/repository/Repository.js +60 -0
  76. package/repository/index.js +2 -0
  77. package/site/SiteDataLoader.js +62 -0
  78. package/site/SiteNavigation.js +242 -0
  79. package/site/index.js +2 -0
  80. package/startup/Controller.js +43 -0
  81. package/startup/Runner.js +40 -0
  82. package/startup/index.js +28 -0
  83. package/tracking/Controller.js +157 -0
  84. package/tracking/DataLayerTracker.js +80 -0
  85. package/tracking/index.js +16 -0
  86. package/updater/PropertyUpdater.js +127 -0
  87. package/updater/RequestAnimationFrameTimer.js +43 -0
  88. package/updater/index.js +16 -0
  89. package/utils/ArrayFunctions.js +20 -0
  90. package/utils/index.js +1 -0
@@ -0,0 +1,53 @@
1
+ import Dbm from "../../index.js";
2
+
3
+ export default class EditorBlock extends Dbm.core.BaseObject {
4
+
5
+ constructor(aSettings){
6
+ super();
7
+
8
+ this._settings = aSettings;
9
+
10
+ this.item.setValue("data", aSettings.data ? aSettings.data : {});
11
+ this.item.setValue("name", aSettings.config ? aSettings.config.name : "Unnamed block");
12
+ this.item.setValue("module", Dbm.getInstance().repository.getItem("moduleCreators/blocks/editor/" + aSettings.config.module));
13
+
14
+ }
15
+
16
+ render(){
17
+ //console.log("render");
18
+
19
+ let holderElement = document.createElement('div');
20
+ this.item.setValue("holderElement", holderElement);
21
+
22
+ let module = this.item.module.controller;
23
+
24
+ if(module) {
25
+ let moduleData = {};
26
+ moduleData["editorData"] = this.item;
27
+
28
+ module.createModule(holderElement, moduleData);
29
+ }
30
+ else {
31
+ console.warn("No module for block " + this.item.module.id);
32
+ }
33
+
34
+ return this.item.holderElement;
35
+ }
36
+
37
+ save(aHolderElement){
38
+ console.log("save");
39
+ console.log(aHolderElement);
40
+
41
+ return this.item.data;
42
+ }
43
+
44
+ static get toolbox() {
45
+
46
+ //'<svg xmlns="http://www.w3.org/2000/svg" viewBox="-0.5 -0.5 16 16" id="Module--Streamline-Streamline-3.0" height="16" width="16"><desc>Module Streamline Icon: https://streamlinehq.com</desc><g><path d="M14.21875 2.65625a0.625 0.625 0 0 1 0.46875 0.625v8.4375a0.625 0.625 0 0 1 -0.42500000000000004 0.59375l-6.55625 2.34375a0.625 0.625 0 0 1 -0.41250000000000003 0L0.725 12.318750000000001a0.625 0.625 0 0 1 -0.41250000000000003 -0.5874999999999999V3.2624999999999997a0.625 0.625 0 0 1 0.46875 -0.625L7.34375 0.33125000000000004a0.6625000000000001 0.6625000000000001 0 0 1 0.3125 0Z" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"></path><path d="m7.5 5.29375 0 9.393749999999999" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"></path><path d="M14.51875 2.8375 7.5 5.29375 0.48125 2.8375" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1"></path></g></svg>'
47
+
48
+ return {
49
+ title: 'DbmBlock',
50
+ icon: null
51
+ };
52
+ }
53
+ }
@@ -0,0 +1,19 @@
1
+ import React from "react";
2
+ import Dbm from "../../index.js";
3
+
4
+ export default class EditorBlockName extends Dbm.react.BaseObject {
5
+ _construct() {
6
+ super._construct();
7
+ }
8
+
9
+ _renderMainElement() {
10
+
11
+ let textSource = new Dbm.react.source.ContextVariableSource();
12
+ textSource.item.path = "moduleData.editorData.name";
13
+
14
+ return React.createElement("div", {"className": "editor-block-box editor-block-box-padding text-align-center"},
15
+ Dbm.react.text.text(textSource),
16
+ );
17
+ }
18
+ }
19
+
@@ -0,0 +1,3 @@
1
+ export {default as Editor} from "./Editor.js";
2
+ export {default as EditorBlock} from "./EditorBlock.js";
3
+ export {default as EditorBlockName} from "./EditorBlockName.js";
@@ -0,0 +1,22 @@
1
+ import React from "react";
2
+ import Dbm from "../../index.js";
3
+
4
+ export default class HasData extends Dbm.react.BaseObject {
5
+ _construct() {
6
+ super._construct();
7
+ }
8
+
9
+ render() {
10
+ //console.log("HasData::render");
11
+ //console.log(this);
12
+
13
+ let data = this.getPropValue("check");
14
+
15
+ if(data) {
16
+ return React.createElement(React.Fragment, {}, this.getPropValue("children"));
17
+ }
18
+
19
+ return null;
20
+ }
21
+ }
22
+
@@ -0,0 +1,22 @@
1
+ import React from "react";
2
+ import Dbm from "../../index.js";
3
+
4
+ export default class InsertElement extends Dbm.react.BaseObject {
5
+ _construct() {
6
+ super._construct();
7
+ }
8
+
9
+ render() {
10
+ //console.log("InsertElement::render");
11
+ //console.log(this);
12
+
13
+ let element = this.getDynamicProp("element").value;
14
+
15
+ if(!element) {
16
+ return React.createElement("div", {}, "No element set");
17
+ }
18
+
19
+ return element;
20
+ }
21
+ }
22
+
@@ -0,0 +1,2 @@
1
+ export {default as InsertElement} from "./InsertElement.js";
2
+ export {default as HasData} from "./HasData.js";
@@ -0,0 +1,61 @@
1
+ import Dbm from "../../index.js";
2
+ import {createElement} from "react";
3
+
4
+ let createToolConfiguration = function(aId, aName, aInitialData = {}, aIcon = null) {
5
+
6
+ let returnObject = {
7
+ "class": Dbm.react.admin.EditorBlock,
8
+ "config": {
9
+ "module": aId,
10
+ "name": aName,
11
+ },
12
+ "data": aInitialData,
13
+ "toolbox": {
14
+ title: aName,
15
+ icon: aIcon
16
+ }
17
+ }
18
+
19
+ return returnObject;
20
+ }
21
+
22
+ export let registerAllBlocks = function() {
23
+
24
+ let displayNameModule = new Dbm.react.modules.ModuleCreator();
25
+
26
+ let displayNameEditor = createElement(Dbm.react.admin.EditorBlockName, {});
27
+ displayNameModule.setMainElement(displayNameEditor);
28
+
29
+ let editorConfigItem = Dbm.getInstance().repository.getItem("editorjs");
30
+ let tools = editorConfigItem.tools ? {...editorConfigItem.tools} : {};
31
+
32
+ {
33
+ let moduleName = "cookie/settings";
34
+
35
+ let editorItem = new Dbm.repository.Item();
36
+ editorItem.setValue("controller", displayNameModule);
37
+ editorItem.register("moduleCreators/blocks/editor/" + moduleName);
38
+
39
+ let elementItem = new Dbm.repository.Item();
40
+ elementItem.setValue("element", createElement(Dbm.react.cookies.CookieSettings));
41
+ elementItem.register("blocks/" + moduleName);
42
+
43
+ tools[moduleName] = createToolConfiguration(moduleName, "Cookie settings");
44
+ }
45
+
46
+ {
47
+ let moduleName = "login/loginForm";
48
+
49
+ let editorItem = new Dbm.repository.Item();
50
+ editorItem.setValue("controller", displayNameModule);
51
+ editorItem.register("moduleCreators/blocks/editor/" + moduleName);
52
+
53
+ let elementItem = new Dbm.repository.Item();
54
+ elementItem.setValue("element", createElement(Dbm.react.login.LoginForm));
55
+ elementItem.register("blocks/" + moduleName);
56
+
57
+ tools[moduleName] = createToolConfiguration(moduleName, "Login form");
58
+ }
59
+
60
+ editorConfigItem.setValue("tools", tools);
61
+ }
@@ -0,0 +1,22 @@
1
+ import React from "react";
2
+ import Dbm from "../../index.js";
3
+
4
+ export default class AddContextVariables extends Dbm.react.BaseObject {
5
+ _construct() {
6
+ super._construct();
7
+ }
8
+
9
+ render() {
10
+ //console.log("AddContextVariables::render");
11
+ //console.log(this);
12
+
13
+ let newContext = {...this.context};
14
+
15
+ let values = this.props.values;
16
+ for(let objectName in values) {
17
+ newContext[objectName] = values[objectName];
18
+ }
19
+
20
+ return React.createElement(Dbm.react.context.Context.Provider, {"value": newContext}, this.props.children);
21
+ }
22
+ }
@@ -0,0 +1,4 @@
1
+ import { createContext } from "react";
2
+
3
+ const dbmContext = createContext();
4
+ export default dbmContext;
@@ -0,0 +1,2 @@
1
+ export {default as Context} from "./Context.js";
2
+ export {default as AddContextVariables} from "./AddContextVariables.js";
@@ -0,0 +1,162 @@
1
+ import React from "react";
2
+ import Dbm from "../../index.js";
3
+ import Cookies from "js-cookie";
4
+
5
+ export default class CookieBar extends Dbm.react.BaseObject {
6
+ _construct() {
7
+ super._construct();
8
+
9
+ this.getDynamicProp("open", false);
10
+
11
+ let shouldShow = Cookies.get("cookie/hideCookieBar") !== "1";
12
+
13
+ this.getDynamicProp("open").getMostUpstreamProperty().setValue(shouldShow);
14
+
15
+ this.item.setValue("widthElement", null);
16
+
17
+ let elementSize = new Dbm.flow.updatefunctions.dom.ElementSize();
18
+ this.item.setValue("elementSize", elementSize);
19
+
20
+ elementSize.input.properties.element.connectInput(this.item.properties.widthElement);
21
+ elementSize.start();
22
+
23
+ let layoutSwitch = new Dbm.flow.updatefunctions.logic.RangeSwitch();
24
+ layoutSwitch.input.properties.value.connectInput(elementSize.output.properties.width);
25
+
26
+ layoutSwitch.input.defaultValue = React.createElement("div", {className: "cookie-bar cookie-bar-padding"},
27
+
28
+ React.createElement("div", {},
29
+ React.createElement("div", {"className": "cookie-bar-title"},
30
+ "Your privacy is important to us"
31
+ ),
32
+ React.createElement("div", {"className": "cookie-bar-description"},
33
+ "We use cookies to improve your experience on our site."
34
+ )
35
+ ),
36
+ React.createElement("div", {"className": "spacing small"}),
37
+ React.createElement("a", {"href": "/cookie-settings/", className:"custom-styled-link"},
38
+ React.createElement("div", {"className": "secondary-button standard-button-padding text-align-center"}, "Settings")
39
+ ),
40
+
41
+ React.createElement("div", {"className": "spacing small"}),
42
+ React.createElement("div", {"className": "secondary-button standard-button-padding text-align-center", onClick: () => this._rejectAll()}, "Only necessary"),
43
+ React.createElement("div", {"className": "spacing small"}),
44
+ React.createElement("div", {"className": "standard-button standard-button-padding text-align-center", onClick: () => this._acceptAll()}, "Allow all")
45
+
46
+ );
47
+
48
+ let tabletLayout = React.createElement("div", {className: "cookie-bar cookie-bar-padding"},
49
+
50
+ React.createElement("div", {},
51
+ React.createElement("div", {"className": "cookie-bar-title"},
52
+ "Your privacy is important to us"
53
+ ),
54
+ React.createElement("div", {"className": "cookie-bar-description"},
55
+ "We use cookies to improve your experience on our site."
56
+ )
57
+ ),
58
+ React.createElement("div", {"className": "spacing small"}),
59
+
60
+ React.createElement("div", {"className": "flex-row small-item-spacing"},
61
+ React.createElement("div", {"className": "flex-row-item"},
62
+ React.createElement("a", {"href": "/cookie-settings/", className:"custom-styled-link"},
63
+ React.createElement("div", {"className": "secondary-button standard-button-padding"}, "Settings")
64
+ )
65
+ ),
66
+ React.createElement("div", {"className": "flex-row-item"},
67
+ React.createElement("div", {"className": "secondary-button standard-button-padding", onClick: () => this._rejectAll()}, "Only necessary")
68
+ ),
69
+ React.createElement("div", {"className": "flex-row-item"},
70
+ React.createElement("div", {"className": "standard-button standard-button-padding", onClick: () => this._acceptAll()}, "Allow all")
71
+ )
72
+ )
73
+ );
74
+
75
+ layoutSwitch.addValueForRange(tabletLayout, 700, 1100);
76
+
77
+ let desktopLayout = React.createElement("div", {className: "cookie-bar cookie-bar-padding"},
78
+ React.createElement("div", {"className": "flex-row small-item-spacing justify-between"},
79
+ React.createElement("div", {"className": "flex-row-item"},
80
+ React.createElement("div", {"className": "cookie-bar-title"},
81
+ "Your privacy is important to us"
82
+ ),
83
+ React.createElement("div", {"className": "cookie-bar-description"},
84
+ "We use cookies to improve your experience on our site."
85
+ )
86
+ ),
87
+ React.createElement("div", {"className": "flex-row-item"},
88
+ React.createElement("div", {"className": "flex-row small-item-spacing"},
89
+ React.createElement("div", {"className": "flex-row-item"},
90
+ React.createElement("a", {"href": "/cookie-settings/", className:"custom-styled-link"},
91
+ React.createElement("div", {"className": "secondary-button standard-button-padding"}, "Settings")
92
+ )
93
+ ),
94
+ React.createElement("div", {"className": "flex-row-item"},
95
+ React.createElement("div", {"className": "secondary-button standard-button-padding", onClick: () => this._rejectAll()}, "Only necessary")
96
+ ),
97
+ React.createElement("div", {"className": "flex-row-item"},
98
+ React.createElement("div", {"className": "standard-button standard-button-padding", onClick: () => this._acceptAll()}, "Allow all")
99
+ )
100
+ )
101
+ )
102
+ )
103
+ );
104
+
105
+ layoutSwitch.addValueForRange(desktopLayout, 1100);
106
+
107
+ this.item.setValue("element", null);
108
+ this.item.properties.element.connectInput(layoutSwitch.output.properties.value);
109
+ }
110
+
111
+ _acceptAll() {
112
+ console.log("_acceptAll");
113
+
114
+ let options = {"expires": 365};
115
+
116
+ Cookies.set("cookie/allowPreferences", "1", options);
117
+ Cookies.set("cookie/allowStatistics", "1", options);
118
+ Cookies.set("cookie/allowMarketing", "1", options);
119
+ Cookies.set("cookie/hideCookieBar", "1", options);
120
+
121
+ let consentTime = (new Date()).toISOString();
122
+
123
+ Cookies.set("cookie/consentTime", consentTime);
124
+
125
+ Dbm.getInstance().repository.getItem("trackingController").allowStatistics = true;
126
+ Dbm.getInstance().repository.getItem("trackingController").allowMarketing = true;
127
+
128
+ this.getDynamicProp("open").getMostUpstreamProperty().setValue(false);
129
+ }
130
+
131
+ _rejectAll() {
132
+
133
+ let options = {"expires": 365};
134
+
135
+ Cookies.set("cookie/allowPreferences", "0", options);
136
+ Cookies.set("cookie/allowStatistics", "0", options);
137
+ Cookies.set("cookie/allowMarketing", "0", options);
138
+ Cookies.set("cookie/hideCookieBar", "1", options);
139
+
140
+ let consentTime = (new Date()).toISOString();
141
+
142
+ Cookies.set("cookie/consentTime", consentTime);
143
+
144
+ Dbm.getInstance().repository.getItem("trackingController").allowStatistics = false;
145
+ Dbm.getInstance().repository.getItem("trackingController").allowMarketing = false;
146
+
147
+ this.getDynamicProp("open").getMostUpstreamProperty().setValue(false);
148
+ }
149
+
150
+ _renderMainElement() {
151
+
152
+ let isOpen = this.getDynamicProp("open").value;
153
+ if(!isOpen) {
154
+ return null;
155
+ }
156
+
157
+ return this._createMainElement("div", {className: "cookie-bar-position", ref: this.createRef("widthElement")},
158
+ React.createElement(Dbm.react.area.InsertElement, {element: this.item.properties.element})
159
+ );
160
+ }
161
+ }
162
+
@@ -0,0 +1,118 @@
1
+ import React from "react";
2
+ import Dbm from "../../index.js";
3
+ import Cookies from "js-cookie";
4
+
5
+ export default class CookieSettings extends Dbm.react.BaseObject {
6
+ _construct() {
7
+ super._construct();
8
+
9
+ let settings = [];
10
+
11
+ {
12
+ let currentItem = this._createSetting("cookie/allowPreferences", "Preferences cookies", "These cookies allow a website to remember choices you have made in the past.");
13
+ settings.push(currentItem);
14
+ }
15
+
16
+ {
17
+ let currentItem = this._createSetting("cookie/allowStatistics", "Statistics cookies", "These cookies collect information about how you use a website, like which pages you visited and which links you clicked on. None of this information can be used to identify you. It is all aggregated and, therefore, anonymized. Their sole purpose is to improve website functions.");
18
+ settings.push(currentItem);
19
+ }
20
+
21
+ {
22
+ let currentItem = this._createSetting("cookie/allowMarketing", "Marketing cookies", "These cookies track your online activity to help advertisers deliver more relevant advertising or to limit how many times you see an ad. These cookies can share that information with other organizations or advertisers.");
23
+ settings.push(currentItem);
24
+ }
25
+
26
+ {
27
+ let currentItem = this._createSetting("cookie/hideCookieBar", "Hide cookie information when websites load", "Hides the cookie information and links that is displayed every time the website is loaded.");
28
+ settings.push(currentItem);
29
+ }
30
+
31
+ this.item.setValue("settings", settings);
32
+
33
+ this.item.setValue("consentTime", Cookies.get("cookie/consentTime"));
34
+ }
35
+
36
+ _createSetting(aName, aTitle, aDescription) {
37
+ let currentItem = new Dbm.repository.Item();
38
+
39
+ let fieldName = "field" + Dbm.getInstance().getNextId();
40
+
41
+ currentItem.setValue("name", aName);
42
+
43
+ let currentValue = Cookies.get(aName) === "1";
44
+ currentItem.setValue("value", currentValue);
45
+
46
+ let element = React.createElement("div", {"className": "flex-row small-item-spacing", "key": aName},
47
+ React.createElement("div", {"className": "flex-row-item"},
48
+ React.createElement(Dbm.react.form.Checkbox, {"type": "checkbox", "checked": currentItem.properties.value, "id": fieldName})
49
+ ),
50
+ React.createElement("div", {"className": "flex-row-item"},
51
+ React.createElement("label", {"htmlFor": fieldName},
52
+ React.createElement("div", {"className": "cookie-settings-title"}, aTitle),
53
+ React.createElement("div", {"className": "small-description cookie-description"}, aDescription)
54
+ ),
55
+ )
56
+ );
57
+ currentItem.setValue("element", element);
58
+
59
+ return currentItem;
60
+ }
61
+
62
+ _save() {
63
+ console.log("_save");
64
+
65
+ let settings = this.item.settings;
66
+ let options = {"expires": 365};
67
+
68
+ let currentArray = settings;
69
+ let currentArrayLength = currentArray.length;
70
+ for(let i = 0; i < currentArrayLength; i++) {
71
+ let currentSetting = currentArray[i];
72
+ let checked = currentSetting.value;
73
+ let name = currentSetting.name;
74
+
75
+ Cookies.set(name, checked ? "1" : "0", options);
76
+
77
+ if(name === "cookie/allowStatistics") {
78
+ console.log(Dbm.getInstance().repository.getItem("trackingController"));
79
+ Dbm.getInstance().repository.getItem("trackingController").allowStatistics = checked;
80
+ }
81
+ else if(name === "cookie/allowMarketing") {
82
+ Dbm.getInstance().repository.getItem("trackingController").allowMarketing = checked;
83
+ }
84
+ }
85
+
86
+ let consentTime = (new Date()).toISOString();
87
+
88
+ Cookies.set("cookie/consentTime", consentTime)
89
+ this.item.setValue("consentTime", consentTime, options);
90
+ }
91
+
92
+ _renderMainElement() {
93
+
94
+ let elements = this.item.settings.map((aSetting) => {
95
+ return aSetting.element;
96
+ })
97
+
98
+ return this._createMainElement("div", {},
99
+ React.createElement("div", {className: "body-text"},
100
+ React.createElement("div", {"className": "flex-row small-item-spacing"},
101
+ React.createElement("div", {"className": "flex-row-item"},
102
+ React.createElement("input", {"type": "checkbox", "checked": true, "disabled": true})
103
+ ),
104
+ React.createElement("div", {"className": "flex-row-item"},
105
+ React.createElement("div", {"className": "cookie-settings-title"}, "Strictly necessary cookies"),
106
+ React.createElement("div", {"className": "small-description cookie-description"}, "These cookies are essential for you to browse the website and use its features, such as accessing secure areas of the site.")
107
+ )
108
+ ),
109
+ elements
110
+ ),
111
+ React.createElement("div", {"className": "spacing standard"}),
112
+ React.createElement("div", {"className": "flex-row justify-center"},
113
+ React.createElement("div", {"className": "standard-button standard-button-padding", onClick: () => this._save()}, "Save")
114
+ )
115
+ );
116
+ }
117
+ }
118
+
@@ -0,0 +1,2 @@
1
+ export {default as CookieSettings} from "./CookieSettings.js";
2
+ export {default as CookieBar} from "./CookieBar.js";
@@ -0,0 +1,28 @@
1
+ import Dbm from "../../index.js";
2
+
3
+ export default class Checkbox extends Dbm.react.BaseObject {
4
+ _construct() {
5
+ super._construct();
6
+
7
+ this.getDynamicProp("checked", false);
8
+
9
+ this._callback_changeBound = this._callback_change.bind(this);
10
+ }
11
+
12
+ _callback_change(aEvent) {
13
+ //console.log("_callback_change");
14
+ //console.log(aEvent);
15
+
16
+ let checked = aEvent.target.checked;
17
+
18
+ this.getDynamicProp("checked").getMostUpstreamProperty().setValue(checked);
19
+ }
20
+
21
+ _renderMainElement() {
22
+
23
+ let checked = this.getDynamicProp("checked").value;
24
+
25
+ return this._createMainElement("input", {"type": "checkbox", "checked": checked, onChange: this._callback_changeBound});
26
+ }
27
+ }
28
+
@@ -0,0 +1,28 @@
1
+ import Dbm from "../../index.js";
2
+
3
+ export default class FormField extends Dbm.react.BaseObject {
4
+ _construct() {
5
+ super._construct();
6
+
7
+ this.getDynamicProp("value", "");
8
+
9
+ this._callback_changeBound = this._callback_change.bind(this);
10
+ }
11
+
12
+ _callback_change(aEvent) {
13
+ //console.log("_callback_change");
14
+ //console.log(aEvent);
15
+
16
+ let value = aEvent.target.value;
17
+
18
+ this.getDynamicProp("value").getMostUpstreamProperty().setValue(value);
19
+ }
20
+
21
+ _renderMainElement() {
22
+
23
+ let value = this.getDynamicProp("value").value;
24
+
25
+ return this._createMainElement("input", {"value": value, onChange: this._callback_changeBound});
26
+ }
27
+ }
28
+
@@ -0,0 +1,2 @@
1
+ export {default as Checkbox} from "./Checkbox.js";
2
+ export {default as FormField} from "./FormField.js";
package/react/index.js ADDED
@@ -0,0 +1,13 @@
1
+ export {default as BaseObject} from "./BaseObject.js";
2
+ export {default as RefToProperty} from "./RefToProperty.js";
3
+
4
+ export * as modules from "./modules/index.js";
5
+ export * as admin from "./admin/index.js";
6
+ export * as blocks from "./blocks/index.js";
7
+ export * as form from "./form/index.js";
8
+ export * as cookies from "./cookies/index.js";
9
+ export * as area from "./area/index.js";
10
+ export * as context from "./context/index.js";
11
+ export * as source from "./source/index.js";
12
+ export * as text from "./text/index.js";
13
+ export * as login from "./login/index.js";