dbm 1.2.6 → 1.2.8

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 (71) hide show
  1. package/commands/CommandBaseObject.js +4 -0
  2. package/commands/SetProperty.js +2 -2
  3. package/commands/index.js +6 -1
  4. package/ecommerce/CartLineItem.js +2 -2
  5. package/ecommerce/LocalStorageCartLoader.js +0 -2
  6. package/flow/updatefunctions/dom/ElementPosition.js +10 -1
  7. package/flow/updatefunctions/thirdparty/google/maps/AutoComplete.js +2 -2
  8. package/graphapi/index.js +1 -2
  9. package/graphapi/webclient/WebSocketConnection.js +2 -0
  10. package/graphapi/webclient/admin/ItemEditor.js +54 -0
  11. package/graphapi/webclient/decode/index.js +9 -0
  12. package/package.json +1 -1
  13. package/react/AddProps.js +127 -0
  14. package/react/BaseObject.js +1 -1
  15. package/react/ChildFunctions.js +55 -1
  16. package/react/admin/EditLanguage.js +91 -0
  17. package/react/admin/EditObject.js +1 -1
  18. package/react/admin/EditObjectById.js +1 -1
  19. package/react/admin/EditPage.js +25 -35
  20. package/react/admin/EditTranslationGroup.js +174 -0
  21. package/react/admin/PageTranslations.js +226 -0
  22. package/react/admin/SelectTranslation.js +72 -0
  23. package/react/admin/editorsgroup/EditItem.js +1 -1
  24. package/react/admin/editorsgroup/EditMultipleRelations.js +39 -0
  25. package/react/admin/editorsgroup/EditPartOfObject.js +32 -0
  26. package/react/admin/editorsgroup/EditRelation.js +2 -7
  27. package/react/admin/editorsgroup/EditUrl.js +22 -0
  28. package/react/admin/editorsgroup/index.js +4 -1
  29. package/react/admin/index.js +4 -0
  30. package/react/admin/objects/itemeditors/DraggableHierarchyDisplay.js +45 -0
  31. package/react/admin/objects/itemeditors/HierarchyOrderedRelationsList.js +335 -0
  32. package/react/admin/objects/itemeditors/RelationsList.js +77 -0
  33. package/react/admin/objects/itemeditors/Url.js +21 -0
  34. package/react/admin/objects/itemeditors/index.js +5 -1
  35. package/react/animation/AnimatedElement.js +4 -0
  36. package/react/area/FixedWidthInfiniteSlideshow.js +8 -1
  37. package/react/area/HasData.js +1 -1
  38. package/react/area/InsertElement.js +9 -2
  39. package/react/area/InsertElementWithChildren.js +33 -0
  40. package/react/area/OpenCloseExpandableArea.js +10 -3
  41. package/react/area/PopoverLayer.js +64 -0
  42. package/react/area/index.js +2 -0
  43. package/react/blocks/admin/objects/Edit.js +1 -1
  44. package/react/blocks/index.js +169 -3
  45. package/react/blocks/redirect/SignedInRedirect.js +38 -0
  46. package/react/blocks/redirect/index.js +1 -0
  47. package/react/blocks/section/ColoredBackgroundSection.js +32 -0
  48. package/react/blocks/section/ColoredBoxSection.js +30 -0
  49. package/react/blocks/section/index.js +2 -0
  50. package/react/blocks/signin/SignIn.js +14 -0
  51. package/react/blocks/signin/index.js +1 -0
  52. package/react/context/AddItemByIdToContext.js +5 -2
  53. package/react/form/Dropdown.js +46 -0
  54. package/react/form/Option.js +1 -1
  55. package/react/form/index.js +2 -1
  56. package/react/interaction/CommandButton.js +12 -64
  57. package/react/interaction/HoverArea.js +77 -0
  58. package/react/interaction/HoverDropdown.js +38 -0
  59. package/react/interaction/drag/DraggableItem.js +94 -0
  60. package/react/interaction/drag/index.js +3 -0
  61. package/react/interaction/index.js +5 -1
  62. package/react/login/LoginForm.js +4 -4
  63. package/react/source/index.js +10 -2
  64. package/site/index.js +3 -0
  65. package/site/translation/TranslationLoader.js +3 -3
  66. package/tracking/index.js +1 -1
  67. package/utils/ArrayFunctions.js +21 -16
  68. package/utils/TranslationFunctions.js +49 -0
  69. package/utils/index.js +1 -0
  70. package/graphapi/admin/EditGroup.js +0 -50
  71. package/graphapi/admin/index.js +0 -1
@@ -5,23 +5,18 @@ export default class EditRelation extends Dbm.react.BaseObject {
5
5
  _constructAfterProps() {
6
6
  super._constructAfterProps();
7
7
 
8
- let item = this.context.item;
9
8
  let itemEditor = this.context.itemEditor;
10
9
  let editor;
11
10
 
12
-
13
11
  let direction = this.getPropValue("direction");
14
12
  let relationType = this.getPropValue("relationType");
15
13
  let objectType = this.getPropValue("objectType");
16
14
 
17
- let relations = Dbm.utils.ArrayFunctions.filterByField(Dbm.objectPath(item, "relations/" + direction + "." + relationType + ".objects"), "objectTypes", objectType, "arrayContains");
18
- let relation = (relations && relations.length) ? relations[0].id : null;
19
-
20
15
  if(direction == "in") {
21
- editor = itemEditor.addIncomingRelationEditor(relationType, objectType, relation, ["relations"]);
16
+ editor = itemEditor.getDefaultIncomingRelationEditor(relationType, objectType);
22
17
  }
23
18
  else if(direction == "out") {
24
- editor = itemEditor.addOutgoingRelationEditor(relationType, objectType, relation, ["relations"]);
19
+ editor = itemEditor.getDefaultOutgoingRelationEditor(relationType, objectType);
25
20
  }
26
21
  else {
27
22
  console.error("Unknown direction", direction, this);
@@ -0,0 +1,22 @@
1
+ import React from "react";
2
+ import Dbm from "../../../index.js";
3
+
4
+ export default class EditUrl extends Dbm.react.BaseObject {
5
+ _constructAfterProps() {
6
+ super._constructAfterProps();
7
+
8
+ let itemEditor = this.context.itemEditor;
9
+
10
+ let editor = itemEditor.getAdminUrlEditor();
11
+ this.item.setValue("editor", editor.item);
12
+ }
13
+
14
+ _renderMainElement() {
15
+
16
+ let children = this.getPropValue("children")
17
+
18
+ return React.createElement("div", {},
19
+ React.createElement(Dbm.react.context.AddContextVariables, {"values": {"valueEditor": this.item.editor}}, children)
20
+ );
21
+ }
22
+ }
@@ -3,4 +3,7 @@ export {default as EditItem} from "./EditItem.js";
3
3
  export {default as EditRelation} from "./EditRelation.js";
4
4
  export {default as EditVisibility} from "./EditVisibility.js";
5
5
  export {default as EditIdentifer} from "./EditIdentifer.js";
6
- export {default as EditFieldTranslation} from "./EditFieldTranslation.js";
6
+ export {default as EditFieldTranslation} from "./EditFieldTranslation.js";
7
+ export {default as EditMultipleRelations} from "./EditMultipleRelations.js";
8
+ export {default as EditUrl} from "./EditUrl.js";
9
+ export {default as EditPartOfObject} from "./EditPartOfObject.js";
@@ -6,6 +6,10 @@ export {default as EditObjectById} from "./EditObjectById.js";
6
6
  export {default as EditorGroup} from "./EditorGroup.js";
7
7
  export {default as SaveAllButton} from "./SaveAllButton.js";
8
8
  export {default as EditObject} from "./EditObject.js";
9
+ export {default as PageTranslations} from "./PageTranslations.js";
10
+ export {default as EditLanguage} from "./EditLanguage.js";
11
+ export {default as EditTranslationGroup} from "./EditTranslationGroup.js";
12
+ export {default as SelectTranslation} from "./SelectTranslation.js";
9
13
 
10
14
  export * as editor from "./editor/index.js";
11
15
  export * as pages from "./pages/index.js";
@@ -0,0 +1,45 @@
1
+ import React from "react";
2
+ import Dbm from "../../../../index.js";
3
+
4
+ export default class DraggableHierarchyDisplay extends Dbm.react.BaseObject {
5
+ _construct() {
6
+ super._construct();
7
+ }
8
+
9
+ _renderMainElement() {
10
+
11
+ let children = this.getPropValue("children");
12
+
13
+ return React.createElement("div", {},
14
+ React.createElement(Dbm.react.context.AddItemToContext, {"item": Dbm.react.source.contextVariable("hierarchyItem.linkedItem")},
15
+ React.createElement(Dbm.react.interaction.drag.DraggableItem, {skipDraggable: true, moveMode: "insertBefore"},
16
+ React.createElement("div", {className: "flex-row micro-item-spacing"},
17
+ React.createElement("div", {className: "flex-row-item flex-no-resize cursor-grab", draggable: true},
18
+ React.createElement("div", {className: "spacing small"}),
19
+ React.createElement(Dbm.react.image.Image, {"src": "/assets/img/icons/drag-handle.svg", "className": "background-contain drag-handle-icon action-icon-color"})
20
+ ),
21
+ React.createElement("div", {className: "flex-row-item flex-resize"},
22
+ children
23
+ )
24
+ )
25
+
26
+ )
27
+ ),
28
+ React.createElement("div", {className: "hierarchy-indent"},
29
+ React.createElement("div", {className: "spacing small"}),
30
+ React.createElement(Dbm.react.area.HasData, {check: Dbm.react.source.contextVariable("hierarchyItem.properties.children"), checkType: "notEmpty"},
31
+ React.createElement(Dbm.react.area.List, {items: Dbm.react.source.contextVariable("hierarchyItem.properties.children"), as: "hierarchyItem"},
32
+ React.createElement(Dbm.react.admin.objects.itemeditors.DraggableHierarchyDisplay, {}, children),
33
+ React.createElement("div", {"data-slot": "spacing", className: "spacing small"}),
34
+ ),
35
+ React.createElement("div", {className: "spacing small"})
36
+ ),
37
+ React.createElement(Dbm.react.interaction.drag.DraggableItem, {skipDraggable: true, moveMode: "appendChild"},
38
+ React.createElement("div", {className: "append-drop-position centered-cell-holder"},
39
+ React.createElement("div", {})
40
+ )
41
+ )
42
+ )
43
+ )
44
+ }
45
+ }
@@ -0,0 +1,335 @@
1
+ import React from "react";
2
+ import Dbm from "../../../../index.js";
3
+
4
+ export default class HierarchyOrderedRelationsList extends Dbm.react.BaseObject {
5
+ _construct() {
6
+ super._construct();
7
+
8
+ this._internalId = Dbm.getInstance().getNextId();
9
+ let itemEditor = this.context.itemEditor;
10
+
11
+ this._draggedElement = null;
12
+ this._hierachyMap = {};
13
+
14
+ let hierarchyHolder = new Dbm.repository.Item();
15
+ hierarchyHolder.setValue("children", []);
16
+
17
+ this.item.requireProperty("hierarchy", hierarchyHolder);
18
+
19
+ let direction = this.getPropValue("direction");
20
+ let relationType = this.getPropValue("relationType");
21
+ let objectType = this.getPropValue("objectType");
22
+
23
+ let orderFieldName = this.getPropValue("orderFieldName");
24
+
25
+ this._relationsEditor;
26
+ if(direction === "in") {
27
+ this._relationsEditor = itemEditor.getAdminMultipleIncomingRelationsEditor(relationType, objectType);
28
+ }
29
+ else if(direction === "out") {
30
+ this._relationsEditor = itemEditor.getAdminMultipleOutgoingRelationsEditor(relationType, objectType);
31
+ }
32
+ else {
33
+ console.error("Unknown direction", direction, this);
34
+ }
35
+
36
+ this._orderEditor = itemEditor.getAdminFieldEditor(orderFieldName);
37
+
38
+ let updateCommand = Dbm.commands.callFunction(this._updateHierarchy.bind(this));
39
+
40
+ Dbm.flow.addUpdateCommand(this._relationsEditor.valueProperty, updateCommand);
41
+ Dbm.flow.addUpdateCommand(this._orderEditor.valueProperty, updateCommand);
42
+ this._updateHierarchy();
43
+
44
+ }
45
+
46
+ _removeMissingPartsOfHierarchy(aHierarchy, aMustBeInArray) {
47
+ //console.log("_removeMissingPartsOfHierarchy");
48
+ //console.log(aHierarchy, aMustBeInArray);
49
+ let currentArray = aHierarchy;
50
+ let currentArrayLength = currentArray.length;
51
+
52
+ for(let i = 0; i < currentArrayLength; i++) {
53
+ let currentItem = currentArray[i];
54
+ if(aMustBeInArray.indexOf(currentItem.id) !== -1) {
55
+ this._removeMissingPartsOfHierarchy(currentItem.children, aMustBeInArray);
56
+ }
57
+ }
58
+ }
59
+
60
+ _getAllIdsFromHierarchy(aItems, aReturnArray) {
61
+ let currentArray = aItems;
62
+ let currentArrayLength = currentArray.length;
63
+ for(let i = 0; i < currentArrayLength; i++) {
64
+ let currentItem = currentArray[i];
65
+
66
+ aReturnArray.push(currentItem.id);
67
+ this._getAllIdsFromHierarchy(currentItem.children, aReturnArray);
68
+ }
69
+ }
70
+
71
+ _getFullHierarchy() {
72
+ let relations = this._relationsEditor.value;
73
+ let hierarchyValue = this._orderEditor.value;
74
+ if(hierarchyValue) {
75
+ hierarchyValue = JSON.parse(JSON.stringify(hierarchyValue));
76
+ }
77
+ else {
78
+ hierarchyValue = [];
79
+ }
80
+
81
+ this._removeMissingPartsOfHierarchy(hierarchyValue, relations);
82
+
83
+ let usedIds = [];
84
+
85
+ this._getAllIdsFromHierarchy(hierarchyValue, usedIds);
86
+ let missingIds = Dbm.utils.ArrayFunctions.getUnselectedItems(usedIds, relations);
87
+
88
+ {
89
+
90
+ let currentArray = missingIds;
91
+ let currentArrayLength = currentArray.length;
92
+ for(let i = 0; i < currentArrayLength; i++) {
93
+ let currentId = currentArray[i];
94
+ hierarchyValue.push({id: currentId, children: []});
95
+ }
96
+ }
97
+
98
+ return hierarchyValue;
99
+ }
100
+
101
+ _updateHierarchy() {
102
+ this._updateHierarchyItems(this.item.hierarchy, this._getFullHierarchy());
103
+ }
104
+
105
+ _getHierarchyItem(aId) {
106
+ let returnItem = this._hierachyMap["item" + aId];
107
+ if(!returnItem) {
108
+ returnItem = new Dbm.repository.Item();
109
+ returnItem.setId("_internalHierarchy/" + this._internalId + "/" + aId);
110
+ returnItem.setValue("linkedItem", Dbm.getRepositoryItem(aId));
111
+ returnItem.setValue("children", []);
112
+ this._hierachyMap["item" + aId] = returnItem;
113
+ }
114
+
115
+ return returnItem;
116
+ }
117
+
118
+ _updateHierarchyItems(aHierarchyItem, aItems) {
119
+ //console.log("_updateHierarchyItems");
120
+ let newItems = [];
121
+ let hierarchyChildren = aHierarchyItem.children;
122
+ let hasChange = (hierarchyChildren.length !== aItems.length);
123
+
124
+ let currentArray = aItems;
125
+ let currentArrayLength = currentArray.length;
126
+ for(let i = 0; i < currentArrayLength; i++) {
127
+ let currentItem = currentArray[i];
128
+ let hierarchyItem = this._getHierarchyItem(currentItem.id);
129
+ newItems.push(hierarchyItem);
130
+ this._updateHierarchyItems(hierarchyItem, currentItem.children);
131
+ if(!hasChange && hierarchyChildren[i] !== hierarchyItem) {
132
+ hasChange = true;
133
+ }
134
+ }
135
+
136
+ if(hasChange) {
137
+ aHierarchyItem.children = newItems;
138
+ }
139
+ }
140
+
141
+ startDrag(aComponent) {
142
+ console.log("startDrag");
143
+ console.log(aComponent);
144
+
145
+ this._draggedElement = aComponent;
146
+ }
147
+
148
+ _findPosition(aItem, aChildren) {
149
+ let index = aChildren.indexOf(aItem);
150
+ if(index !== -1) {
151
+ return [index];
152
+ }
153
+
154
+ let currentArray = aChildren;
155
+ let currentArrayLength = currentArray.length;
156
+ for(let i = 0; i < currentArrayLength; i++) {
157
+ let currentChild = currentArray[i];
158
+ let childIndex = this._findPosition(aItem, currentChild.children);
159
+ if(childIndex) {
160
+ childIndex.unshift(i)
161
+ return childIndex;
162
+ }
163
+ }
164
+
165
+ return null;
166
+ }
167
+
168
+ _isInside(aLastPosition, aNewPosition) {
169
+ return aNewPosition.join(".").indexOf(aLastPosition.join(".")) === 0;
170
+ }
171
+
172
+ itemDroppedOn(aComponent, aData) {
173
+ //console.log("itemDroppedOn");
174
+ //console.log(aComponent, aData);
175
+
176
+ let mode = aComponent.getPropValue("moveMode");
177
+
178
+ console.log(mode);
179
+
180
+ let hierarchyValue = this._getFullHierarchy();
181
+
182
+ if(mode === "insertBefore") {
183
+
184
+ let lastDeepIndex = this._findPosition(this._draggedElement.context.hierarchyItem, this.item.hierarchy.children);
185
+ let newDeepIndex = this._findPosition(aComponent.context.hierarchyItem, this.item.hierarchy.children);
186
+
187
+ if(this._isInside(lastDeepIndex, newDeepIndex)) {
188
+ return;
189
+ }
190
+
191
+ let removeIndex = lastDeepIndex.pop();
192
+ let removeArray;
193
+ if(lastDeepIndex.length === 0) {
194
+ removeArray = hierarchyValue;
195
+ }
196
+ else {
197
+ removeArray = Dbm.objectPath(hierarchyValue, lastDeepIndex.join(".children.") + ".children");
198
+ }
199
+
200
+ let addIndex = newDeepIndex.pop();
201
+ let addArray;
202
+ if(newDeepIndex.length === 0) {
203
+ addArray = hierarchyValue;
204
+ }
205
+ else {
206
+ addArray = Dbm.objectPath(hierarchyValue, newDeepIndex.join(".children.") + ".children");
207
+ }
208
+
209
+ let movedItem = removeArray.splice(removeIndex, 1)[0];
210
+
211
+ if(addIndex > removeIndex && removeArray === addArray) {
212
+ addIndex--;
213
+ }
214
+
215
+ addArray.splice(addIndex, 0, movedItem);
216
+ }
217
+ else if(mode === "appendChild") {
218
+ let lastDeepIndex = this._findPosition(this._draggedElement.context.hierarchyItem, this.item.hierarchy.children);
219
+ let newDeepIndex = this._findPosition(aComponent.context.hierarchyItem, this.item.hierarchy.children);
220
+
221
+ if(this._isInside(lastDeepIndex, newDeepIndex)) {
222
+ return;
223
+ }
224
+
225
+ let removeIndex = lastDeepIndex.pop();
226
+ let removeArray;
227
+ if(lastDeepIndex.length === 0) {
228
+ removeArray = hierarchyValue;
229
+ }
230
+ else {
231
+ removeArray = Dbm.objectPath(hierarchyValue, lastDeepIndex.join(".children.") + ".children");
232
+ }
233
+
234
+ let addArray = Dbm.objectPath(hierarchyValue, newDeepIndex.join(".children.") + ".children");
235
+
236
+ let movedItem = removeArray.splice(removeIndex, 1)[0];
237
+ addArray.push(movedItem);
238
+ }
239
+ else if(mode === "last") {
240
+ let lastDeepIndex = this._findPosition(this._draggedElement.context.hierarchyItem, this.item.hierarchy.children);
241
+
242
+ let removeIndex = lastDeepIndex.pop();
243
+ let removeArray;
244
+ if(lastDeepIndex.length === 0) {
245
+ removeArray = hierarchyValue;
246
+ }
247
+ else {
248
+ removeArray = Dbm.objectPath(hierarchyValue, lastDeepIndex.join(".children.") + ".children");
249
+ }
250
+
251
+ let addArray = hierarchyValue;
252
+
253
+ let movedItem = removeArray.splice(removeIndex, 1)[0];
254
+ addArray.push(movedItem);
255
+ }
256
+
257
+ this._orderEditor.value = hierarchyValue;
258
+ }
259
+
260
+ _create() {
261
+ console.log("_create");
262
+ let objectType = this.getPropValue("objectType");
263
+ let encodings = this.getPropValueWithDefault("encodings", ["id"]);
264
+ let visibility = this.getPropValueWithDefault("visibility", "private");
265
+
266
+ let changes = [];
267
+
268
+ let request = Dbm.getGraphApi().createItem([objectType], visibility, changes, encodings);
269
+
270
+ Dbm.flow.addUpdateCommand(request.properties.status, Dbm.commands.callFunction(this._created.bind(this), [Dbm.core.source.staticObject(request, "item")]));
271
+ }
272
+
273
+ _created(aItem) {
274
+ console.log("_created");
275
+ console.log(aItem);
276
+
277
+ let itemEditor = this.context.itemEditor;
278
+
279
+ let direction = this.getPropValue("direction");
280
+ let relationType = this.getPropValue("relationType");
281
+ let objectType = this.getPropValue("objectType");
282
+
283
+ let editor;
284
+ if(direction === "in") {
285
+ editor = itemEditor.getAdminMultipleIncomingRelationsEditor(relationType, objectType);
286
+ }
287
+ else if(direction === "out") {
288
+ editor = itemEditor.getAdminMultipleOutgoingRelationsEditor(relationType, objectType);
289
+ }
290
+ else {
291
+ console.error("Unknown direction", direction, this);
292
+ }
293
+
294
+ let newValues = [].concat(editor.value);
295
+ newValues.push(aItem.id);
296
+ editor.value = newValues;
297
+ }
298
+
299
+ _renderMainElement() {
300
+
301
+ let label = this.getPropValue("label");
302
+ let children = this.getPropValue("children");
303
+
304
+ return React.createElement("div", {},
305
+ React.createElement(Dbm.react.context.AddContextVariables, {"values": {"dragController": this}},
306
+ React.createElement(Dbm.react.form.LabelledArea, {label: label}),
307
+ React.createElement("div", {"className": ""},
308
+ React.createElement(Dbm.react.area.List, {items: this.item.hierarchy.properties.children, as: "hierarchyItem"},
309
+ React.createElement(Dbm.react.context.AddItemToContext, {"item": Dbm.react.source.contextVariable("hierarchyItem.linkedItem")},
310
+ React.createElement(Dbm.react.admin.objects.itemeditors.DraggableHierarchyDisplay, {},
311
+ children
312
+ )
313
+ ),
314
+ React.createElement("div", {"data-slot": "spacing", className: "spacing small"})
315
+ )
316
+ ),
317
+ React.createElement("div", {"className": "spacing small"}),
318
+ React.createElement(Dbm.react.interaction.drag.DraggableItem, {skipDraggable: true, moveMode: "last"},
319
+ React.createElement("div", {className: "append-drop-position centered-cell-holder"},
320
+ React.createElement("div", {})
321
+ )
322
+ ),
323
+ React.createElement("div", {"className": "spacing small"}),
324
+ React.createElement("div", {"className": "flex-row"},
325
+ React.createElement(Dbm.react.interaction.CommandButton, {command: Dbm.commands.callFunction(this._create.bind(this))},
326
+ React.createElement("div", {"className": "action-button action-button-padding"},
327
+ "Add"
328
+ )
329
+ )
330
+ )
331
+ )
332
+
333
+ )
334
+ }
335
+ }
@@ -0,0 +1,77 @@
1
+ import React from "react";
2
+ import Dbm from "../../../../index.js";
3
+
4
+ export default class RelationsList extends Dbm.react.BaseObject {
5
+ _construct() {
6
+ super._construct();
7
+ }
8
+
9
+ _create() {
10
+ console.log("_create");
11
+ let objectType = this.getPropValue("objectType");
12
+ let encodings = this.getPropValueWithDefault("encodings", ["id"]);
13
+ let visibility = this.getPropValueWithDefault("visibility", "private");
14
+
15
+ let changes = [];
16
+
17
+ let request = Dbm.getInstance().repository.getItem("graphApi").controller.createItem([objectType], visibility, changes, encodings);
18
+
19
+ Dbm.flow.addUpdateCommand(request.properties.status, Dbm.commands.callFunction(this._created.bind(this), [Dbm.core.source.staticObject(request, "item")]));
20
+ }
21
+
22
+ _created(aItem) {
23
+ console.log("_created");
24
+ console.log(aItem);
25
+
26
+ let itemEditor = this.context.itemEditor;
27
+
28
+ let direction = this.getPropValue("direction");
29
+ let relationType = this.getPropValue("relationType");
30
+ let objectType = this.getPropValue("objectType");
31
+
32
+ let editor;
33
+ if(direction === "in") {
34
+ editor = itemEditor.getAdminMultipleIncomingRelationsEditor(relationType, objectType);
35
+ }
36
+ else if(direction === "out") {
37
+ editor = itemEditor.getAdminMultipleOutgoingRelationsEditor(relationType, objectType);
38
+ }
39
+ else {
40
+ console.error("Unknown direction", direction, this);
41
+ }
42
+
43
+ let newValues = [].concat(editor.value);
44
+ newValues.push(aItem.id);
45
+ editor.value = newValues;
46
+ }
47
+
48
+ _renderMainElement() {
49
+
50
+ let id = this.context.item.id;
51
+
52
+ let label = this.getPropValue("label");
53
+ let direction = this.getPropValue("direction");
54
+ let relationType = this.getPropValue("relationType");
55
+ let objectType = this.getPropValue("objectType");
56
+ let children = this.getPropValue("children");
57
+
58
+ return React.createElement("div", {},
59
+ React.createElement(Dbm.react.form.LabelledArea, {label: label}),
60
+ React.createElement("div", {"className": "standard-alternating-rows"},
61
+ React.createElement(Dbm.react.admin.editorsgroup.EditMultipleRelations, {"direction": direction, "relationType": relationType, "objectType": objectType},
62
+ React.createElement(Dbm.react.area.List, {items: Dbm.react.source.contextVariable("valueEditor.editValue.value")},
63
+ children
64
+ )
65
+ )
66
+ ),
67
+ React.createElement("div", {"className": "spacing small"}),
68
+ React.createElement("div", {"className": "flex-row"},
69
+ React.createElement(Dbm.react.interaction.CommandButton, {command: Dbm.commands.callFunction(this._create.bind(this))},
70
+ React.createElement("div", {"className": "action-button action-button-padding"},
71
+ "Add"
72
+ )
73
+ )
74
+ )
75
+ )
76
+ }
77
+ }
@@ -0,0 +1,21 @@
1
+ import React from "react";
2
+ import Dbm from "../../../../index.js";
3
+
4
+ export default class Url extends Dbm.react.BaseObject {
5
+ _construct() {
6
+ super._construct();
7
+ }
8
+
9
+ _renderMainElement() {
10
+
11
+ let id = this.context.item.id;
12
+
13
+ return React.createElement("div", {},
14
+ React.createElement(Dbm.react.form.LabelledArea, {label: "Url"},
15
+ React.createElement(Dbm.react.admin.editorsgroup.EditUrl, {},
16
+ React.createElement(Dbm.react.form.FormField, {value: Dbm.react.source.contextVariable("valueEditor.editValue.value"), className: "standard-field standard-field-padding full-width"})
17
+ )
18
+ )
19
+ )
20
+ }
21
+ }
@@ -10,4 +10,8 @@ export {default as PageRepresentation} from "./PageRepresentation.js";
10
10
  export {default as MainImage} from "./MainImage.js";
11
11
  export {default as Identifier} from "./Identifier.js";
12
12
  export {default as SingleRelation} from "./SingleRelation.js";
13
- export {default as Field} from "./Field.js";
13
+ export {default as Field} from "./Field.js";
14
+ export {default as Url} from "./Url.js";
15
+ export {default as RelationsList} from "./RelationsList.js";
16
+ export {default as HierarchyOrderedRelationsList} from "./HierarchyOrderedRelationsList.js";
17
+ export {default as DraggableHierarchyDisplay} from "./DraggableHierarchyDisplay.js";
@@ -10,6 +10,10 @@ export default class AnimatedElement extends Dbm.react.BaseObject {
10
10
  controller.propertyInput("element", this.item.requireProperty("animationElement", null));
11
11
  }
12
12
 
13
+ _removedUsedProps(aProps) {
14
+ delete aProps["controller"];
15
+ }
16
+
13
17
  _renderMainElement() {
14
18
  //console.log("AnimatedElement::_renderMainElement");
15
19
  //console.log(this);
@@ -8,6 +8,13 @@ export default class FixedWidthInfiniteSlideshow extends Dbm.react.BaseObject {
8
8
 
9
9
  }
10
10
 
11
+ _removedUsedProps(aProps) {
12
+ delete aProps["viewWidth"];
13
+ delete aProps["prepareLength"];
14
+ delete aProps["elementWidth"];
15
+ delete aProps["spacing"];
16
+ }
17
+
11
18
  _renderMainElement() {
12
19
  //console.log("FixedWidthInfiniteSlideshow::render");
13
20
  //console.log(this);
@@ -19,7 +26,7 @@ export default class FixedWidthInfiniteSlideshow extends Dbm.react.BaseObject {
19
26
 
20
27
  let index = this.getPropValue("index");
21
28
 
22
- let elements = this.getPropValue("children");;
29
+ let elements = this.getPropValue("children");
23
30
 
24
31
  let numberOfElements = elements.length;
25
32
 
@@ -26,7 +26,7 @@ export default class HasData extends Dbm.react.BaseObject {
26
26
 
27
27
  let compareFunction = Dbm.getInstance().repository.getItem("compareFunctions/" + checkType).compare;
28
28
  if(!compareFunction) {
29
- console.warn("No copmare function registered for: " + checkType + ". Using default", this, data, checkType, compareValue);
29
+ console.warn("No compare function registered for: " + checkType + ". Using default", this, data, checkType, compareValue);
30
30
  compareFunction = Dbm.utils.CompareFunctions.objectExists;
31
31
  }
32
32
 
@@ -6,7 +6,11 @@ export default class InsertElement extends Dbm.react.BaseObject {
6
6
  super._construct();
7
7
  }
8
8
 
9
- render() {
9
+ _removedUsedProps(aProps) {
10
+ delete aProps["element"];
11
+ }
12
+
13
+ _renderMainElement() {
10
14
  //console.log("InsertElement::render");
11
15
  //console.log(this);
12
16
 
@@ -16,7 +20,10 @@ export default class InsertElement extends Dbm.react.BaseObject {
16
20
  return React.createElement("div", {}, "No element set");
17
21
  }
18
22
 
19
- return element;
23
+ let props = this._copyProps(this.props);
24
+
25
+ let returnElement = Dbm.react.ChildFunctions.clone(element, props);
26
+ return returnElement;
20
27
  }
21
28
  }
22
29
 
@@ -0,0 +1,33 @@
1
+ import React from "react";
2
+ import Dbm from "../../index.js";
3
+
4
+ export default class InsertElementWithChildren extends Dbm.react.BaseObject {
5
+ _construct() {
6
+ super._construct();
7
+ }
8
+
9
+ _performCloneWithNewChildren(aElement, aChildren) {
10
+ var callArray = [aElement, {}];
11
+
12
+ callArray = callArray.concat(aChildren);
13
+
14
+ return React.cloneElement.apply(React, callArray);
15
+ }
16
+
17
+ render() {
18
+ //console.log("InsertElementWithChildren::render");
19
+ //console.log(this);
20
+
21
+ let element = this.getPropValue("element");
22
+ let children = this.getPropValue("children");
23
+
24
+ if(!element) {
25
+ return React.createElement("div", {}, "No element set");
26
+ }
27
+
28
+ return this._performCloneWithNewChildren(element, children);
29
+ }
30
+ }
31
+
32
+
33
+