Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/1.4' into 1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
mattamon committed Apr 5, 2024
2 parents b9f1d16 + 1830dbf commit 9ecf5e5
Show file tree
Hide file tree
Showing 20 changed files with 117 additions and 197 deletions.
9 changes: 9 additions & 0 deletions public/js/pimcore/asset/metadata/tags/abstract.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,5 +160,14 @@ pimcore.asset.metadata.tags.abstract = Class.create({

handleGridOpenAction:function (grid, rowIndex) {

},

initEditorConfig: function (field) {
const editorConfig = {};
if (field.config && field.config.width && field.config.width !== '100%' && intval(field.config.width) > 10) {
editorConfig.width = field.config.width;
}

return editorConfig;
}
});
10 changes: 1 addition & 9 deletions public/js/pimcore/asset/metadata/tags/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,7 @@ pimcore.asset.metadata.tags.input = Class.create(pimcore.asset.metadata.tags.abs
},

getGridColumnEditor: function(field) {
var editorConfig = {};

if (field.config) {
if (field.config.width) {
if (intval(field.config.width) > 10) {
editorConfig.width = field.config.width;
}
}
}
const editorConfig = this.initEditorConfig(field);

return new Ext.form.TextField(editorConfig);
},
Expand Down
42 changes: 12 additions & 30 deletions public/js/pimcore/asset/metadata/tags/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,32 +47,24 @@ pimcore.asset.metadata.tags.select = Class.create(pimcore.asset.metadata.tags.ab
},

getCellEditor: function (field, record) {
var key = field.key;
const key = field.key;

var value = record.data[key];
var options = record.data[key + "%options"];
const value = record.data[key];
let options = record.data[key + '%options'];
options = this.prepareStoreDataAndFilterLabels(options);

var store = new Ext.data.Store({
const store = new Ext.data.Store({
autoDestroy: true,
fields: ['key', 'value'],
data: options
});
var editorConfig = {};

if (field.config) {
if (field.config.width) {
if (intval(field.config.width) > 10) {
editorConfig.width = field.config.width;
}
}
}
let editorConfig = this.initEditorConfig(field);

editorConfig = Object.assign(editorConfig, {
store: store,
triggerAction: "all",
triggerAction: 'all',
editable: false,
mode: "local",
mode: 'local',
valueField: 'value',
displayField: 'key',
value: value,
Expand All @@ -87,29 +79,19 @@ pimcore.asset.metadata.tags.select = Class.create(pimcore.asset.metadata.tags.ab
},

getGridColumnEditor: function(field) {

var storeData = this.prepareStoreDataAndFilterLabels(field.layout.config);
var store = new Ext.data.Store({
const storeData = this.prepareStoreDataAndFilterLabels(field.layout.config);
const store = new Ext.data.Store({
autoDestroy: true,
fields: ['key', 'value'],
data: storeData
});

var editorConfig = {};

if (field.config) {
if (field.config.width) {
if (intval(field.config.width) > 10) {
editorConfig.width = field.config.width;
}
}
}
let editorConfig = this.initEditorConfig(field);

editorConfig = Object.assign(editorConfig, {
store: store,
triggerAction: "all",
triggerAction: 'all',
editable: false,
mode: "local",
mode: 'local',
valueField: 'value',
displayField: 'key',
displayTpl: Ext.create('Ext.XTemplate',
Expand Down
17 changes: 4 additions & 13 deletions public/js/pimcore/asset/metadata/tags/textarea.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,10 @@ pimcore.asset.metadata.tags.textarea = Class.create(pimcore.asset.metadata.tags.
},

getGridColumnEditor: function(field) {
var editorConfig = {};

if (field.config) {
if (field.config.width) {
if (intval(field.config.width) > 10) {
editorConfig.width = field.config.width;
}
}
}
if (field.type == 'textarea') {
const editorConfig = this.initEditorConfig(field);

// TEXTAREA
if (field.type == "textarea") {
return new Ext.form.TextArea(editorConfig);
return new Ext.form.TextArea(editorConfig);
}
},

Expand Down Expand Up @@ -115,4 +106,4 @@ pimcore.asset.metadata.tags.textarea = Class.create(pimcore.asset.metadata.tags.
return "";
}
}
});
});
3 changes: 2 additions & 1 deletion public/js/pimcore/element/helpers/gridCellEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ Ext.define('pimcore.element.helpers.gridCellEditor', {
}

tag.updateContext({
cellEditing: true
cellEditing: true,
fieldname: fieldInfo.key
});

if (typeof tag["finishSetup"] !== "undefined") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ pimcore.object.gridcolumn.operator.stringcontains = Class.create(pimcore.object.

commitData: function(params) {
this.node.set('isOperator', true);
this.node.data.configAttributes.label = this.textField.getValue();
this.node.data.configAttributes.search = this.searchField.getValue();
this.node.data.configAttributes.insensitive = this.insensitiveField.getValue();
this.node.set('text', this.textField.getValue());
Expand All @@ -149,4 +150,4 @@ pimcore.object.gridcolumn.operator.stringcontains = Class.create(pimcore.object.
}
return true;
}
});
});
2 changes: 1 addition & 1 deletion public/js/pimcore/object/helpers/grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ pimcore.object.helpers.grid = Class.create({
getColumnWidth: function(field, defaultValue) {
if (field.width) {
return field.width;
} else if(field.layout && field.layout.width) {
} else if (field.layout && field.layout.width && field.layout.width !== '100%' && intval(field.layout.width) > 10) {
return field.layout.width;
} else {
return defaultValue;
Expand Down
9 changes: 9 additions & 0 deletions public/js/pimcore/object/tags/abstract.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,4 +311,13 @@ pimcore.object.tags.abstract = Class.create({
this.globalLanguage = pimcore.globalmanager.get('global_language_' + this.getContext().objectId);
}
},

initEditorConfig: function (field) {
const editorConfig = {};
if (field.config && field.config.width && field.config.width !== '100%' && intval(field.config.width) > 10) {
editorConfig.width = field.config.width;
}

return editorConfig;
}
});
36 changes: 12 additions & 24 deletions public/js/pimcore/object/tags/booleanSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,28 +56,22 @@ pimcore.object.tags.booleanSelect = Class.create(pimcore.object.tags.abstract, {

},

getCellEditor: function ( field, record) {
var key = field.key;
if(field.layout.noteditable) {
getCellEditor: function (field, record) {
if (field.layout.noteditable) {
return null;
}

var value = record.data[key];
var options = record.data[key + "%options"];
const key = field.key;
const value = record.data[key];
const options = record.data[key + "%options"];

var store = new Ext.data.Store({
const store = new Ext.data.Store({
autoDestroy: true,
fields: ['key',"value"],
data: options
});

var editorConfig = {};

if (field.config) {
if (field.config.width) {
editorConfig.width = field.config.width;
}
}
let editorConfig = this.initEditorConfig(field);

editorConfig = Object.assign(editorConfig, {
store: store,
Expand All @@ -93,11 +87,11 @@ pimcore.object.tags.booleanSelect = Class.create(pimcore.object.tags.abstract, {
},

getGridColumnEditor: function(field) {
if(field.layout.noteditable) {
if (field.layout.noteditable) {
return null;
}

var store = new Ext.data.JsonStore({
const store = new Ext.data.JsonStore({
autoDestroy: true,
proxy: {
type: 'memory',
Expand All @@ -111,19 +105,13 @@ pimcore.object.tags.booleanSelect = Class.create(pimcore.object.tags.abstract, {
data: field.layout
});

var editorConfig = {};

if (field.config) {
if (field.config.width) {
editorConfig.width = field.config.width;
}
}
let editorConfig = this.initEditorConfig(field);

editorConfig = Object.assign(editorConfig, {
store: store,
triggerAction: "all",
triggerAction: 'all',
editable: false,
mode: "local",
mode: 'local',
valueField: 'value',
displayField: 'key'
});
Expand Down
15 changes: 4 additions & 11 deletions public/js/pimcore/object/tags/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,12 @@ pimcore.object.tags.input = Class.create(pimcore.object.tags.abstract, {
},

getGridColumnEditor: function(field) {
var editorConfig = {};

if (field.config) {
if (field.config.width) {
if (intval(field.config.width) > 10) {
editorConfig.width = field.config.width;
}
}
}

if(field.layout.noteditable) {
if (field.layout.noteditable) {
return null;
}

const editorConfig = this.initEditorConfig(field);

return new Ext.form.TextField(editorConfig);
},

Expand Down
48 changes: 18 additions & 30 deletions public/js/pimcore/object/tags/numeric.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,44 +33,32 @@ pimcore.object.tags.numeric = Class.create(pimcore.object.tags.abstract, {
},

getGridColumnEditor: function (field) {
var editorConfig = {};

var decimalPrecision = 20;

if (field.layout.noteditable) {
return null;
}

if (field.config) {
if (field.config.width) {
if (intval(field.config.width) > 10) {
editorConfig.width = field.config.width;
}
}
}

if (field.layout["unsigned"]) {
editorConfig.minValue = 0;
}
if (field.type == 'numeric') {
const editorConfig = this.initEditorConfig(field);

if (is_numeric(field.layout["minValue"])) {
editorConfig.minValue = field.layout.minValue;
}
if (field.layout['unsigned']) {
editorConfig.minValue = 0;
}

if (is_numeric(field.layout["maxValue"])) {
editorConfig.maxValue = field.layout.maxValue;
}
if (is_numeric(field.layout['minValue'])) {
editorConfig.minValue = field.layout.minValue;
}

if (field.layout["integer"]) {
editorConfig.decimalPrecision = 0;
} else if (field.layout["decimalPrecision"]) {
editorConfig.decimalPrecision = field.layout["decimalPrecision"];
} else {
editorConfig.decimalPrecision = 20;
}
if (is_numeric(field.layout['maxValue'])) {
editorConfig.maxValue = field.layout.maxValue;
}

if (field.type == "numeric") {
editorConfig.decimalPrecision = decimalPrecision;
if (field.layout['integer']) {
editorConfig.decimalPrecision = 0;
} else if (field.layout['decimalPrecision']) {
editorConfig.decimalPrecision = field.layout['decimalPrecision'];
} else {
editorConfig.decimalPrecision = 20;
}

// we have to use Number since the spinner trigger don't work in grid -> seems to be a bug of Ext
return new Ext.form.field.Number(editorConfig);
Expand Down
11 changes: 3 additions & 8 deletions public/js/pimcore/object/tags/rgbaColor.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,12 @@ pimcore.object.tags.rgbaColor = Class.create(pimcore.object.tags.abstract, {
},

getGridColumnEditor: function (field) {
var editorConfig = {};

if (field.config) {
if (field.config.width) {
editorConfig.width = field.config.width;
}
}

if (field.layout.noteditable) {
return null;
}

const editorConfig = this.initEditorConfig(field);

return new Ext.form.TextField(editorConfig);
},

Expand Down
Loading

0 comments on commit 9ecf5e5

Please sign in to comment.