dbm 1.2.7 → 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.
- package/commands/index.js +6 -1
- package/ecommerce/CartLineItem.js +2 -2
- package/ecommerce/LocalStorageCartLoader.js +0 -2
- package/flow/updatefunctions/thirdparty/google/maps/AutoComplete.js +2 -2
- package/graphapi/index.js +1 -2
- package/graphapi/webclient/admin/ItemEditor.js +9 -2
- package/graphapi/webclient/decode/index.js +9 -0
- package/package.json +1 -1
- package/react/ChildFunctions.js +55 -1
- package/react/admin/editorsgroup/EditPartOfObject.js +32 -0
- package/react/admin/editorsgroup/index.js +2 -1
- package/react/admin/objects/itemeditors/DraggableHierarchyDisplay.js +45 -0
- package/react/admin/objects/itemeditors/HierarchyOrderedRelationsList.js +335 -0
- package/react/admin/objects/itemeditors/RelationsList.js +77 -0
- package/react/admin/objects/itemeditors/index.js +4 -1
- package/react/animation/AnimatedElement.js +4 -0
- package/react/area/FixedWidthInfiniteSlideshow.js +8 -1
- package/react/area/HasData.js +1 -1
- package/react/area/InsertElement.js +9 -2
- package/react/area/OpenCloseExpandableArea.js +6 -2
- package/react/area/PopoverLayer.js +1 -2
- package/react/blocks/admin/objects/Edit.js +1 -1
- package/react/blocks/index.js +89 -1
- package/react/form/Dropdown.js +2 -4
- package/react/interaction/CommandButton.js +12 -64
- package/react/interaction/HoverArea.js +77 -0
- package/react/interaction/HoverDropdown.js +38 -0
- package/react/interaction/drag/DraggableItem.js +94 -0
- package/react/interaction/drag/index.js +3 -0
- package/react/interaction/index.js +5 -1
- package/react/source/index.js +10 -2
- package/site/translation/TranslationLoader.js +3 -3
- package/tracking/index.js +1 -1
- package/graphapi/admin/EditGroup.js +0 -50
- package/graphapi/admin/index.js +0 -1
|
@@ -11,4 +11,7 @@ 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
13
|
export {default as Field} from "./Field.js";
|
|
14
|
-
export {default as Url} from "./Url.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
|
|
package/react/area/HasData.js
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
|
@@ -22,19 +22,23 @@ export default class OpenCloseExpandableArea extends Dbm.react.BaseObject {
|
|
|
22
22
|
|
|
23
23
|
this.item.setValue("animation", Dbm.react.animation.connectedAnimation(transformToStyle.output.properties.value));
|
|
24
24
|
}
|
|
25
|
+
|
|
26
|
+
_removedUsedProps(aProps) {
|
|
27
|
+
delete aProps["open"];
|
|
28
|
+
}
|
|
25
29
|
|
|
26
30
|
_transformToStyle(aEnvelope) {
|
|
27
31
|
//console.log("_transformToStyle");
|
|
28
32
|
//console.log(aEnvelope, this, this.item.element);
|
|
29
33
|
|
|
30
34
|
if(aEnvelope === 0) {
|
|
31
|
-
return {"height": "0px", "overflow": "
|
|
35
|
+
return {"height": "0px", "overflow-x": "visible", "overflow-y": "clip", "display": "none", "visibility": "hidden"};
|
|
32
36
|
}
|
|
33
37
|
else if(aEnvelope === 1 || !this.item.element) {
|
|
34
38
|
return {};
|
|
35
39
|
}
|
|
36
40
|
|
|
37
|
-
return {"height": (this.item.element.clientHeight*aEnvelope) + "px", "overflow": "
|
|
41
|
+
return {"height": (this.item.element.clientHeight*aEnvelope) + "px", "overflow-x": "visible","overflow-y": "clip"};
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
_renderMainElement() {
|
|
@@ -31,9 +31,8 @@ export default class PopoverLayer extends Dbm.react.BaseObject {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
_updateOpen() {
|
|
34
|
-
console.log("_updateOpen");
|
|
34
|
+
//console.log("_updateOpen");
|
|
35
35
|
let open = this.getPropValue("open");
|
|
36
|
-
console.log(open, this.item.popoverElement);
|
|
37
36
|
|
|
38
37
|
this.item.position._callback_scroll(null);
|
|
39
38
|
this.item.size._callback_sizeChanged(null);
|
|
@@ -25,7 +25,7 @@ export default class Edit extends Dbm.react.BaseObject {
|
|
|
25
25
|
let url = new URL(document.location.href);
|
|
26
26
|
let id = url.searchParams.get("id");
|
|
27
27
|
|
|
28
|
-
return React.createElement("div", {className: "content-narrow"},
|
|
28
|
+
return React.createElement("div", {className: "content-narrow admin-font-settings"},
|
|
29
29
|
React.createElement(Dbm.react.context.AddContextVariables, {values: {"editorGroup": this.item.editorGroup}},
|
|
30
30
|
React.createElement(Dbm.react.admin.objects.EditObject, {id: id}),
|
|
31
31
|
React.createElement("div", {className: "spacing standard"}),
|
package/react/blocks/index.js
CHANGED
|
@@ -334,10 +334,15 @@ export let registerAllBlocks = function() {
|
|
|
334
334
|
}
|
|
335
335
|
|
|
336
336
|
{
|
|
337
|
-
let itemEditor = Dbm.getInstance().repository.getItem("admin/itemEditors/
|
|
337
|
+
let itemEditor = Dbm.getInstance().repository.getItem("admin/itemEditors/nameWithTranslations");
|
|
338
338
|
itemEditor.setValue("element", createElement(Dbm.react.admin.objects.itemeditors.Name, {}));
|
|
339
339
|
}
|
|
340
340
|
|
|
341
|
+
{
|
|
342
|
+
let itemEditor = Dbm.getInstance().repository.getItem("admin/itemEditors/name");
|
|
343
|
+
itemEditor.setValue("element", createElement(Dbm.react.admin.objects.itemeditors.Field, {"label": "Name", "fieldName": "name"}));
|
|
344
|
+
}
|
|
345
|
+
|
|
341
346
|
{
|
|
342
347
|
let itemEditor = Dbm.getInstance().repository.getItem("admin/itemEditors/link");
|
|
343
348
|
itemEditor.setValue("element", createElement(Dbm.react.admin.objects.itemeditors.Link, {}));
|
|
@@ -389,6 +394,61 @@ export let registerAllBlocks = function() {
|
|
|
389
394
|
nameField: "identifier"
|
|
390
395
|
}));
|
|
391
396
|
}
|
|
397
|
+
|
|
398
|
+
{
|
|
399
|
+
let itemEditor = Dbm.getInstance().repository.getItem("admin/itemEditors/language");
|
|
400
|
+
itemEditor.setValue("element", createElement(Dbm.react.admin.objects.itemeditors.SingleRelation, {
|
|
401
|
+
"label": "Language",
|
|
402
|
+
"direction": "in",
|
|
403
|
+
"relationType": "for",
|
|
404
|
+
"objectType": "language",
|
|
405
|
+
encoding: "name",
|
|
406
|
+
nameField: "name"
|
|
407
|
+
}));
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
{
|
|
411
|
+
let itemEditor = Dbm.getInstance().repository.getItem("admin/itemEditors/menuItems");
|
|
412
|
+
itemEditor.setValue("element", createElement(Dbm.react.admin.objects.itemeditors.HierarchyOrderedRelationsList, {
|
|
413
|
+
"label": "Menu items",
|
|
414
|
+
"direction": "in",
|
|
415
|
+
"relationType": "in",
|
|
416
|
+
"objectType": "menuItem",
|
|
417
|
+
"orderFieldName": "order"
|
|
418
|
+
},
|
|
419
|
+
createElement("div", {"className": ""},
|
|
420
|
+
createElement(Dbm.react.admin.EditObject, {"item": Dbm.react.source.item()},
|
|
421
|
+
createElement("div", {"className": "flex-row small-item-spacing halfs"},
|
|
422
|
+
createElement("div", {"className": "flex-row-item"},
|
|
423
|
+
createElement(Dbm.react.admin.editorsgroup.EditField, {fieldName: "label"},
|
|
424
|
+
createElement(Dbm.react.form.FormField, {"placeholder": "Label", "value": Dbm.react.source.contextVariable("valueEditor.editValue.value"), className: "standard-field standard-field-padding full-width"})
|
|
425
|
+
)
|
|
426
|
+
),
|
|
427
|
+
createElement("div", {"className": "flex-row-item"},
|
|
428
|
+
createElement(Dbm.react.admin.editorsgroup.EditField, {fieldName: "link"},
|
|
429
|
+
createElement(Dbm.react.admin.editorsgroup.EditPartOfObject, {"value": Dbm.react.source.contextVariable("valueEditor.editValue.value"), path: "url"},
|
|
430
|
+
createElement(Dbm.react.form.FormField, {"placeholder": "Url", "value": Dbm.react.source.contextVariable("value"), className: "standard-field standard-field-padding full-width"})
|
|
431
|
+
)
|
|
432
|
+
)
|
|
433
|
+
)
|
|
434
|
+
)
|
|
435
|
+
|
|
436
|
+
)
|
|
437
|
+
)
|
|
438
|
+
));
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
{
|
|
442
|
+
let itemEditor = Dbm.getInstance().repository.getItem("admin/itemEditors/menuLocation/menu");
|
|
443
|
+
itemEditor.setValue("element", createElement(Dbm.react.admin.objects.itemeditors.SingleRelation, {
|
|
444
|
+
"label": "Menu",
|
|
445
|
+
"direction": "in",
|
|
446
|
+
"relationType": "at",
|
|
447
|
+
"objectType": "menu",
|
|
448
|
+
encoding: "name",
|
|
449
|
+
nameField: "name"
|
|
450
|
+
}));
|
|
451
|
+
}
|
|
392
452
|
|
|
393
453
|
{
|
|
394
454
|
let objectTypeEditor = Dbm.getInstance().repository.getItem("admin/objectTypeEditors/page");
|
|
@@ -485,6 +545,34 @@ export let registerAllBlocks = function() {
|
|
|
485
545
|
objectTypeEditor.editors = newArray;
|
|
486
546
|
}
|
|
487
547
|
|
|
548
|
+
{
|
|
549
|
+
let objectTypeEditor = Dbm.getInstance().repository.getItem("admin/objectTypeEditors/menu");
|
|
550
|
+
if(!objectTypeEditor.editors) {
|
|
551
|
+
objectTypeEditor.setValue("editors", []);
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
let newArray = [].concat(objectTypeEditor.editors);
|
|
555
|
+
newArray.push(Dbm.getInstance().repository.getItem("admin/itemEditors/name"));
|
|
556
|
+
newArray.push(Dbm.getInstance().repository.getItem("admin/itemEditors/language"));
|
|
557
|
+
newArray.push(Dbm.getInstance().repository.getItem("admin/itemEditors/menuItems"));
|
|
558
|
+
|
|
559
|
+
objectTypeEditor.editors = newArray;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
{
|
|
563
|
+
let objectTypeEditor = Dbm.getInstance().repository.getItem("admin/objectTypeEditors/menuLocation");
|
|
564
|
+
if(!objectTypeEditor.editors) {
|
|
565
|
+
objectTypeEditor.setValue("editors", []);
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
let newArray = [].concat(objectTypeEditor.editors);
|
|
569
|
+
newArray.push(Dbm.getInstance().repository.getItem("admin/itemEditors/name"));
|
|
570
|
+
newArray.push(Dbm.getInstance().repository.getItem("admin/itemEditors/identifier"));
|
|
571
|
+
newArray.push(Dbm.getInstance().repository.getItem("admin/itemEditors/menuLocation/menu"));
|
|
572
|
+
|
|
573
|
+
objectTypeEditor.editors = newArray;
|
|
574
|
+
}
|
|
575
|
+
|
|
488
576
|
|
|
489
577
|
let admin = Dbm.getInstance().repository.getItem("admin");
|
|
490
578
|
admin.requireProperty("pageEditors", []);
|
package/react/form/Dropdown.js
CHANGED
|
@@ -26,7 +26,7 @@ export default class Dropdown extends Dbm.react.BaseObject {
|
|
|
26
26
|
dropClassName += " " + "top-right";
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
return this._createMainElement("div", {className: "absolute-container
|
|
29
|
+
return this._createMainElement("div", {className: "absolute-container"},
|
|
30
30
|
React.createElement(Dbm.react.interaction.CommandButton, {"command": Dbm.commands.setProperty(openProperty, true)},
|
|
31
31
|
React.createElement("div", {"className": "cursor-pointer"},
|
|
32
32
|
React.createElement(Dbm.react.area.InsertElement, {"element": buttonElement})
|
|
@@ -36,9 +36,7 @@ export default class Dropdown extends Dbm.react.BaseObject {
|
|
|
36
36
|
React.createElement("div", {className: dropClassName},
|
|
37
37
|
React.createElement(Dbm.react.area.OpenCloseExpandableArea, {"open": openProperty},
|
|
38
38
|
React.createElement(Dbm.react.interaction.ClickOutsideTrigger, {"command": Dbm.commands.setProperty(openProperty, false)},
|
|
39
|
-
React.createElement(
|
|
40
|
-
React.createElement(Dbm.react.area.InsertElement, {"element": mainChildren})
|
|
41
|
-
)
|
|
39
|
+
React.createElement(Dbm.react.area.InsertElement, {"element": mainChildren})
|
|
42
40
|
)
|
|
43
41
|
)
|
|
44
42
|
)
|
|
@@ -18,74 +18,13 @@ export default class CommandButton extends Dbm.react.BaseObject {
|
|
|
18
18
|
}
|
|
19
19
|
if(commands) {
|
|
20
20
|
commands = Dbm.utils.ArrayFunctions.singleOrArray(commands);
|
|
21
|
-
|
|
22
|
-
let currentArray = commands;
|
|
23
|
-
let currentArrayLength = currentArray.length;
|
|
24
|
-
for(let i = 0; i < currentArrayLength; i++) {
|
|
25
|
-
let command = currentArray[i];
|
|
26
|
-
try {
|
|
27
|
-
command.perform(this, aEvent);
|
|
28
|
-
}
|
|
29
|
-
catch(theError) {
|
|
30
|
-
console.error("Error while running command", theError, command);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
}
|
|
21
|
+
Dbm.commands.performCommands(commands, this, aEvent);
|
|
34
22
|
}
|
|
35
23
|
else{
|
|
36
24
|
console.warn("Button doesn't have any commands", this);
|
|
37
25
|
}
|
|
38
26
|
}
|
|
39
27
|
|
|
40
|
-
_performClone(aChild, aProps) {
|
|
41
|
-
|
|
42
|
-
if(aChild instanceof Array) {
|
|
43
|
-
let returnArray = [];
|
|
44
|
-
|
|
45
|
-
let currentArray = aChild;
|
|
46
|
-
let currentArrayLength = currentArray.length;
|
|
47
|
-
for(let i = 0; i < currentArrayLength; i++) {
|
|
48
|
-
let currentChild = currentArray[i];
|
|
49
|
-
returnArray.push(this._performClone(currentChild, aProps));
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return returnArray;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
let newProps = aProps;
|
|
56
|
-
/*
|
|
57
|
-
//MENOTE: this is a more generalized version, but we never pass in className in this function
|
|
58
|
-
if(aChild && aChild.props && aChild.props.className) {
|
|
59
|
-
newProps = {...aProps};
|
|
60
|
-
|
|
61
|
-
if(aProps.className) {
|
|
62
|
-
newProps.className = aProps.className + " " + aChild.props.className;
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
newProps.className = aChild.props.className;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
*/
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
let callArray = [aChild, newProps];
|
|
72
|
-
|
|
73
|
-
if(aChild && aChild.props) {
|
|
74
|
-
let firstChildChildren = aChild.props.children;
|
|
75
|
-
if(!firstChildChildren) {
|
|
76
|
-
//MENOTE: do nothing
|
|
77
|
-
}
|
|
78
|
-
else if(firstChildChildren instanceof Array) {
|
|
79
|
-
callArray = callArray.concat(firstChildChildren);
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
callArray.push(firstChildChildren);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return React.cloneElement.apply(React, callArray);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
28
|
_renderMainElement() {
|
|
90
29
|
|
|
91
30
|
let children = Dbm.utils.ArrayFunctions.singleOrArray(this.getPropValue("children"));
|
|
@@ -98,10 +37,10 @@ export default class CommandButton extends Dbm.react.BaseObject {
|
|
|
98
37
|
let currentChild = currentArray[i];
|
|
99
38
|
if(currentChild) {
|
|
100
39
|
if(typeof(currentChild) === "string") {
|
|
101
|
-
replacedChildren.push(React.createElement("span"
|
|
40
|
+
replacedChildren.push(React.createElement("span", {"onClick": this._callback_clickBound, onKeyDown: CommandButton.callback_keyDown}, currentChild));
|
|
102
41
|
}
|
|
103
42
|
else {
|
|
104
|
-
replacedChildren.push(
|
|
43
|
+
replacedChildren.push(Dbm.react.ChildFunctions.clone(currentChild, {"onClick": this._callback_clickBound, onKeyDown: CommandButton.callback_keyDown}));
|
|
105
44
|
}
|
|
106
45
|
}
|
|
107
46
|
else {
|
|
@@ -109,8 +48,17 @@ export default class CommandButton extends Dbm.react.BaseObject {
|
|
|
109
48
|
}
|
|
110
49
|
}
|
|
111
50
|
|
|
51
|
+
if(currentArrayLength === 1) {
|
|
52
|
+
return replacedChildren[0];
|
|
53
|
+
}
|
|
112
54
|
|
|
113
55
|
return React.createElement(React.Fragment, {}, replacedChildren);
|
|
114
56
|
}
|
|
57
|
+
|
|
58
|
+
static callback_keyDown(aEvent) {
|
|
59
|
+
if(aEvent.key === "Enter") {
|
|
60
|
+
aEvent.target.click();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
115
63
|
}
|
|
116
64
|
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Dbm from "../../index.js";
|
|
3
|
+
|
|
4
|
+
export default class HoverArea extends Dbm.react.BaseObject {
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
|
|
8
|
+
this.getDynamicPropWithoutState("over", false);
|
|
9
|
+
|
|
10
|
+
this._callback_overBound = this._callback_over.bind(this);
|
|
11
|
+
this._callback_outBound = this._callback_out.bind(this);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
_callback_over(aEvent) {
|
|
15
|
+
//console.log("_callback_over");
|
|
16
|
+
//console.log(aEvent);
|
|
17
|
+
|
|
18
|
+
this.getDynamicProp("over").getMostUpstreamProperty().setValue(true);
|
|
19
|
+
|
|
20
|
+
let commands = this.getPropValue("overCommands");
|
|
21
|
+
if(!commands) {
|
|
22
|
+
commands = this.getPropValue("overCommand");
|
|
23
|
+
}
|
|
24
|
+
if(commands) {
|
|
25
|
+
commands = Dbm.utils.ArrayFunctions.singleOrArray(commands);
|
|
26
|
+
Dbm.commands.performCommands(commands, this, aEvent);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
_callback_out(aEvent) {
|
|
31
|
+
//console.log("_callback_out");
|
|
32
|
+
//console.log(aEvent);
|
|
33
|
+
|
|
34
|
+
this.getDynamicProp("over").getMostUpstreamProperty().setValue(false);
|
|
35
|
+
|
|
36
|
+
let commands = this.getPropValue("outCommands");
|
|
37
|
+
if(!commands) {
|
|
38
|
+
commands = this.getPropValue("outCommand");
|
|
39
|
+
}
|
|
40
|
+
if(commands) {
|
|
41
|
+
commands = Dbm.utils.ArrayFunctions.singleOrArray(commands);
|
|
42
|
+
Dbm.commands.performCommands(commands, this, aEvent);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
_renderMainElement() {
|
|
47
|
+
|
|
48
|
+
let children = Dbm.utils.ArrayFunctions.singleOrArray(this.getPropValue("children"));
|
|
49
|
+
|
|
50
|
+
let replacedChildren = [];
|
|
51
|
+
|
|
52
|
+
let currentArray = children;
|
|
53
|
+
let currentArrayLength = currentArray.length;
|
|
54
|
+
for(let i = 0; i < currentArrayLength; i++) {
|
|
55
|
+
let currentChild = currentArray[i];
|
|
56
|
+
if(currentChild) {
|
|
57
|
+
if(typeof(currentChild) === "string") {
|
|
58
|
+
replacedChildren.push(React.createElement("span", {"onMouseEnter": this._callback_overBound, onMouseLeave: this._callback_outBound}, currentChild));
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
replacedChildren.push(Dbm.react.ChildFunctions.clone(currentChild, {"onMouseEnter": this._callback_overBound, onMouseLeave: this._callback_outBound}));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
replacedChildren.push(currentChild);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
if(currentArrayLength === 1) {
|
|
71
|
+
return replacedChildren[0];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return React.createElement(React.Fragment, {}, replacedChildren);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Dbm from "../../index.js";
|
|
3
|
+
|
|
4
|
+
export default class HoverDropdown extends Dbm.react.BaseObject {
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
|
|
8
|
+
let startValue = this.getPropValue("startState") === "open";
|
|
9
|
+
let openProperty = this.getDynamicPropWithoutState("open", startValue);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
_renderMainElement() {
|
|
13
|
+
|
|
14
|
+
let children = Dbm.utils.ArrayFunctions.singleOrArray(this.getPropValue("children"));
|
|
15
|
+
|
|
16
|
+
let slots = Dbm.react.ChildFunctions.splitIntoSlots(children);
|
|
17
|
+
|
|
18
|
+
let buttonElement = slots["button"];
|
|
19
|
+
let mainChildren = slots.main;
|
|
20
|
+
|
|
21
|
+
let openProperty = this.getDynamicProp("open");
|
|
22
|
+
|
|
23
|
+
let dropClassName = "position-absolute full-width";
|
|
24
|
+
|
|
25
|
+
return React.createElement(Dbm.react.interaction.HoverArea, {"over": openProperty},
|
|
26
|
+
this._createMainElement("div", {className: "absolute-container"},
|
|
27
|
+
React.createElement(Dbm.react.area.InsertElement, {"element": buttonElement}),
|
|
28
|
+
React.createElement(Dbm.react.area.PopoverLayer, {className: "position-absolute bottom-left full-width", "open": openProperty},
|
|
29
|
+
React.createElement("div", {className: dropClassName},
|
|
30
|
+
React.createElement(Dbm.react.area.OpenCloseExpandableArea, {"open": openProperty},
|
|
31
|
+
React.createElement(Dbm.react.area.InsertElement, {"element": mainChildren})
|
|
32
|
+
)
|
|
33
|
+
)
|
|
34
|
+
)
|
|
35
|
+
)
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Dbm from "../../../index.js";
|
|
3
|
+
|
|
4
|
+
export default class DraggableItem extends Dbm.react.BaseObject {
|
|
5
|
+
_construct() {
|
|
6
|
+
super._construct();
|
|
7
|
+
|
|
8
|
+
this._callback_dragStartBound = this._callback_dragStart.bind(this);
|
|
9
|
+
this._callback_dragOverBound = this._callback_dragOver.bind(this);
|
|
10
|
+
this._callback_dragOutBound = this._callback_dragOut.bind(this);
|
|
11
|
+
this._callback_dragEndBound = this._callback_dragEnd.bind(this);
|
|
12
|
+
this._callback_dropBound = this._callback_drop.bind(this);
|
|
13
|
+
|
|
14
|
+
this.item.requireProperty("dragged", false);
|
|
15
|
+
this.item.requireProperty("over", false);
|
|
16
|
+
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
_callback_dragStart(aEvent) {
|
|
20
|
+
console.log("_dragStart");
|
|
21
|
+
//console.log(aEvent, aIndex);
|
|
22
|
+
|
|
23
|
+
let currentNode = this.item.mainElement;
|
|
24
|
+
|
|
25
|
+
aEvent.dataTransfer.effectAllowed = "move";
|
|
26
|
+
aEvent.dataTransfer.setDragImage(currentNode, 0, 0);
|
|
27
|
+
|
|
28
|
+
let dragData = this.getPropValueWithDefault("dragData", {});
|
|
29
|
+
|
|
30
|
+
aEvent.dataTransfer.setData("text/plain", JSON.stringify(dragData));
|
|
31
|
+
|
|
32
|
+
this.item.dragged = true;
|
|
33
|
+
|
|
34
|
+
let dragController = this.context.dragController;
|
|
35
|
+
if(dragController) {
|
|
36
|
+
dragController.startDrag(this);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
_callback_dragOver(aEvent) {
|
|
41
|
+
console.log("_dragOver");
|
|
42
|
+
//console.log(aEvent, aIndex);
|
|
43
|
+
|
|
44
|
+
aEvent.preventDefault();
|
|
45
|
+
|
|
46
|
+
this.item.over = true;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
_callback_dragOut(aEvent) {
|
|
50
|
+
console.log("_callback_dragOut");
|
|
51
|
+
//console.log(aEvent, aIndex);
|
|
52
|
+
|
|
53
|
+
aEvent.preventDefault();
|
|
54
|
+
|
|
55
|
+
this.item.over = false;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
_callback_dragEnd(aEvent) {
|
|
59
|
+
console.log("_dragEnd");
|
|
60
|
+
//console.log(aEvent, aIndex);
|
|
61
|
+
|
|
62
|
+
this.item.dragged = false;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
_callback_drop(aEvent) {
|
|
66
|
+
console.log("_callback_drop");
|
|
67
|
+
this.item.over = false;
|
|
68
|
+
|
|
69
|
+
console.log(aEvent, aEvent.dataTransfer.getData("text"));
|
|
70
|
+
|
|
71
|
+
let data = null;
|
|
72
|
+
let dataString = aEvent.dataTransfer.getData("text");
|
|
73
|
+
if(dataString) {
|
|
74
|
+
data = JSON.parse(dataString);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
let dragController = this.context.dragController;
|
|
78
|
+
if(dragController) {
|
|
79
|
+
dragController.itemDroppedOn(this, data);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
_renderMainElement() {
|
|
84
|
+
|
|
85
|
+
let children = this.getPropValue("children");
|
|
86
|
+
|
|
87
|
+
let draggable = !this.getPropValue("skipDraggable");
|
|
88
|
+
|
|
89
|
+
return this._createMainElement("div", {"ref": this.createRef("mainElement"), "draggable": draggable, "onDragStart": this._callback_dragStartBound, "onDragOver": this._callback_dragOverBound, "onDragLeave": this._callback_dragOutBound, "onDragEnd": this._callback_dragEndBound, "onDrop": this._callback_dropBound},
|
|
90
|
+
children
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import Dbm from "../../index.js";
|
|
2
2
|
|
|
3
|
+
export * as drag from "./drag/index.js";
|
|
4
|
+
|
|
3
5
|
export {default as CommandButton} from "./CommandButton.js";
|
|
4
6
|
export {default as ConfirmButton} from "./ConfirmButton.js";
|
|
5
|
-
export {default as ClickOutsideTrigger} from "./ClickOutsideTrigger.js";
|
|
7
|
+
export {default as ClickOutsideTrigger} from "./ClickOutsideTrigger.js";
|
|
8
|
+
export {default as HoverArea} from "./HoverArea.js";
|
|
9
|
+
export {default as HoverDropdown} from "./HoverDropdown.js";
|
package/react/source/index.js
CHANGED
|
@@ -2,14 +2,22 @@ import Dbm from "../../index.js";
|
|
|
2
2
|
|
|
3
3
|
export {default as ContextVariableSource} from "./ContextVariableSource.js";
|
|
4
4
|
|
|
5
|
-
export
|
|
5
|
+
export const contextVariable = function(aPath) {
|
|
6
6
|
let newSource = new Dbm.react.source.ContextVariableSource();
|
|
7
7
|
newSource.item.path = aPath;
|
|
8
8
|
|
|
9
9
|
return newSource;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export
|
|
12
|
+
export const item = function(aPath = null) {
|
|
13
|
+
let fullPath = "item";
|
|
14
|
+
if(aPath) {
|
|
15
|
+
fullPath += "." + aPath;
|
|
16
|
+
}
|
|
17
|
+
return contextVariable(fullPath);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const blockData = function(aPath) {
|
|
13
21
|
//METODO: check if blockdata is a source
|
|
14
22
|
return contextVariable("blockData." + aPath);
|
|
15
23
|
}
|
|
@@ -12,7 +12,7 @@ export default class TranslationLoader extends Dbm.core.BaseObject {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
_loadTranslation() {
|
|
15
|
-
console.log("_loadTranslation");
|
|
15
|
+
//console.log("_loadTranslation");
|
|
16
16
|
|
|
17
17
|
let language = this.item.language;
|
|
18
18
|
|
|
@@ -39,8 +39,8 @@ export default class TranslationLoader extends Dbm.core.BaseObject {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
_translationLoaded(aLanguage, aLoader) {
|
|
42
|
-
console.log("_translationLoaded");
|
|
43
|
-
console.log(aLanguage, aLoader);
|
|
42
|
+
//console.log("_translationLoaded");
|
|
43
|
+
//console.log(aLanguage, aLoader);
|
|
44
44
|
|
|
45
45
|
let data = aLoader.item.data;
|
|
46
46
|
aLanguage.setValue("translations", data);
|
package/tracking/index.js
CHANGED
|
@@ -28,7 +28,7 @@ export const setCurrency = function(aCurrency) {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
export const addTagManagerTracking = function(aId) {
|
|
31
|
-
console.log("addTagManagerTracking");
|
|
31
|
+
//console.log("addTagManagerTracking");
|
|
32
32
|
let tracker = new Dbm.tracking.TagManagerTracker();
|
|
33
33
|
tracker.item.tagManagerId = aId;
|
|
34
34
|
Dbm.getInstance().repository.getItem("trackingController").controller.addTracker(tracker.item);
|