Skip to content

Commit

Permalink
Merge branch '1.8' into 1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
mcop1 committed Nov 29, 2024
2 parents 0738c32 + 656cfe6 commit 2816d7c
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 7 deletions.
67 changes: 61 additions & 6 deletions src/Resources/public/js/fieldConfigDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ pimcore.plugin.datahub.fieldConfigDialog = Class.create({
doGetRecursiveData: function (node) {
var children = [];
node.eachChild(function (child) {
var attributes = child.data.configAttributes;
var attributes = child.data.configAttributes ?? [];
attributes.children = this.doGetRecursiveData(child);
var childConfig = {
"isOperator": child.data.isOperator ? true : false,
Expand Down Expand Up @@ -265,6 +265,22 @@ pimcore.plugin.datahub.fieldConfigDialog = Class.create({
}
},

addToDragData: function (record, dragData, removeFromParent = false) {
if (!this.checkSupported(record)) {
return;
}

let copy = Ext.apply({}, record.data);
delete copy.id;
dragData.push(
record.createNode(copy)
);

if(removeFromParent) {
record.parentNode.removeChild(record);
}
},

getSelectionPanel: function () {
if (!this.selectionPanel) {
this.selectedConfigItems = [];
Expand Down Expand Up @@ -340,15 +356,54 @@ pimcore.plugin.datahub.fieldConfigDialog = Class.create({

var dragData = [];
records.forEach(function (record) {
if (!this.selectionPanel.getRootNode().findChild("key", record.data.key)) {
if (!this.checkSupported(record)) {
let realOverModel = overModel;

if(target !== source) {
if (record.data.isOperator || this.parentIsOperator(realOverModel)) {
let attr = record.data;
if (record.data.configAttributes) {
attr = record.data.configAttributes;
}
let elementConfig = {
"isOperator": true,
"attributes": attr
}

let element = this.getConfigElement(elementConfig);
let copy = element.getCopyNode(record);
dragData.push(copy);
this.openConfigDialog(element, copy);

return;
}

this.addToDragData(record, dragData);
return;
}

if (dropPosition === "before" || dropPosition === "after") {
realOverModel = overModel.parentNode;
}

if (record.data.isOperator || this.parentIsOperator(realOverModel)) {
let attr = record.data;
if (record.data.isOperator && record.data.configAttributes) {
return;
}
var copy = Ext.apply({}, record.data);
delete copy.id;
copy = record.createNode(copy);
let element = this.getConfigElement(attr);

let copy = element.getCopyNode(record);
dragData.push(copy);

this.openConfigDialog(element, copy);

record.parentNode.removeChild(record);

return;
}

this.addToDragData(record, dragData, true);

}.bind(this));

if (dragData.length === 0) {
Expand Down
3 changes: 2 additions & 1 deletion src/Resources/public/js/queryvalue/DefaultValue.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,15 @@ pimcore.plugin.datahub.queryvalue.defaultvalue = Class.create(pimcore.plugin.dat
},

getCopyNode: function(source) {

var copy = source.createNode({
iconCls: source.data.iconCls,
text: source.data.text,
isTarget: true,
leaf: true,
dataType: source.data.dataType,
qtip: source.data.key,
key: source.data.key,
isOperator: source.data.isOperator ?? false,
configAttributes: {
label: source.data.text,
type: this.type,
Expand Down

0 comments on commit 2816d7c

Please sign in to comment.