Widget Factory traces
This commit is contained in:
18
dist/tryton-sao.css
vendored
18
dist/tryton-sao.css
vendored
@@ -11757,6 +11757,24 @@ html[theme="default"] .ag-grid-tree-grouping-panel input[type="checkbox"]:after
|
|||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ag-grid-tree-host .ag-grid-right-aligned-cell,
|
||||||
|
.ag-grid-tree-host .ag-grid-right-aligned-cell .cell,
|
||||||
|
.ag-grid-tree-host .ag-grid-right-aligned-cell .widget,
|
||||||
|
.ag-grid-tree-host .ag-grid-right-aligned-cell .widget > *,
|
||||||
|
.ag-grid-tree-host .ag-grid-right-aligned-cell .ag-grid-special-cell,
|
||||||
|
.ag-grid-tree-host .ag-grid-right-aligned-cell .ag-grid-aggregate-cell {
|
||||||
|
text-align: right;
|
||||||
|
text-align: end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ag-grid-tree-host .ag-grid-right-aligned-cell .cell {
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ag-grid-tree-host .ag-grid-right-aligned-header .ag-header-cell-label {
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
.ag-grid-tree-host .ag-header-cell-comp-wrapper {
|
.ag-grid-tree-host .ag-header-cell-comp-wrapper {
|
||||||
padding-left: 6px;
|
padding-left: 6px;
|
||||||
}
|
}
|
||||||
|
|||||||
47
dist/tryton-sao.js
vendored
47
dist/tryton-sao.js
vendored
@@ -15037,6 +15037,19 @@ function eval_pyson(value){
|
|||||||
|
|
||||||
var WidgetFactory = Sao.View.FormXMLViewParser.WIDGETS[
|
var WidgetFactory = Sao.View.FormXMLViewParser.WIDGETS[
|
||||||
attributes.widget];
|
attributes.widget];
|
||||||
|
if (!WidgetFactory) {
|
||||||
|
console.error('[FORM][UNKNOWN_WIDGET]', {
|
||||||
|
viewId: this.view.view_id,
|
||||||
|
model: this.view.screen && this.view.screen.model_name,
|
||||||
|
field: name,
|
||||||
|
widget: attributes.widget,
|
||||||
|
fieldAttributes: this.field_attrs[name],
|
||||||
|
attributes: attributes,
|
||||||
|
node: node.outerHTML,
|
||||||
|
availableWidgets: Object.keys(
|
||||||
|
Sao.View.FormXMLViewParser.WIDGETS).sort(),
|
||||||
|
});
|
||||||
|
}
|
||||||
var widget = new WidgetFactory(this.view, attributes);
|
var widget = new WidgetFactory(this.view, attributes);
|
||||||
if (!this.view.widgets[name]) {
|
if (!this.view.widgets[name]) {
|
||||||
this.view.widgets[name] = [];
|
this.view.widgets[name] = [];
|
||||||
@@ -24748,10 +24761,17 @@ function eval_pyson(value){
|
|||||||
var is_hidden = invisible || optional ||
|
var is_hidden = invisible || optional ||
|
||||||
(column.attributes.name === this.screen.exclude_field);
|
(column.attributes.name === this.screen.exclude_field);
|
||||||
var default_width = this._get_default_column_width(column);
|
var default_width = this._get_default_column_width(column);
|
||||||
|
var right_aligned = this._is_right_aligned_column(column);
|
||||||
var col_def = {
|
var col_def = {
|
||||||
colId: name,
|
colId: name,
|
||||||
field: name,
|
field: name,
|
||||||
headerName: column.attributes.string || '',
|
headerName: column.attributes.string || '',
|
||||||
|
type: right_aligned ? 'rightAligned' : null,
|
||||||
|
cellClass: right_aligned ?
|
||||||
|
'ag-grid-right-aligned-cell ag-right-aligned-cell' : null,
|
||||||
|
cellStyle: right_aligned ? {textAlign: 'right'} : null,
|
||||||
|
headerClass: right_aligned ?
|
||||||
|
'ag-grid-right-aligned-header ag-right-aligned-header' : null,
|
||||||
sortable: !grouping_active && Boolean(column.sortable),
|
sortable: !grouping_active && Boolean(column.sortable),
|
||||||
filter: grouping_active ? false : this._get_column_filter(column),
|
filter: grouping_active ? false : this._get_column_filter(column),
|
||||||
filterParams: grouping_active ? null :
|
filterParams: grouping_active ? null :
|
||||||
@@ -24810,10 +24830,37 @@ function eval_pyson(value){
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
console.info('[AGGRID][ALIGN_COLUMN]', {
|
||||||
|
colId: name,
|
||||||
|
label: column.attributes.string || '',
|
||||||
|
widget: column.attributes.widget || '',
|
||||||
|
className: column.class_ || '',
|
||||||
|
rightAligned: right_aligned,
|
||||||
|
cellClass: col_def.cellClass,
|
||||||
|
headerClass: col_def.headerClass,
|
||||||
|
});
|
||||||
|
|
||||||
column_defs.push(col_def);
|
column_defs.push(col_def);
|
||||||
});
|
});
|
||||||
return column_defs;
|
return column_defs;
|
||||||
},
|
},
|
||||||
|
_is_right_aligned_column: function(column) {
|
||||||
|
if (!column || !column.attributes) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (column instanceof Sao.View.Tree.IntegerColumn ||
|
||||||
|
column instanceof Sao.View.Tree.FloatColumn) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (~['integer', 'float', 'numeric'].indexOf(
|
||||||
|
column.attributes.widget || '')) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
var name = column.attributes.name || '';
|
||||||
|
var label = column.attributes.string || name;
|
||||||
|
return /amount|quantity|qty|price|premium|discount|tax|debit|credit|balance|solde|total/i.test(
|
||||||
|
name + ' ' + label);
|
||||||
|
},
|
||||||
_get_default_column_width: function(column) {
|
_get_default_column_width: function(column) {
|
||||||
var name = column && column.attributes && column.attributes.name || '';
|
var name = column && column.attributes && column.attributes.name || '';
|
||||||
var label = column && column.attributes &&
|
var label = column && column.attributes &&
|
||||||
|
|||||||
@@ -11757,6 +11757,24 @@ html[theme="default"] .ag-grid-tree-grouping-panel input[type="checkbox"]:after
|
|||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ag-grid-tree-host .ag-grid-right-aligned-cell,
|
||||||
|
.ag-grid-tree-host .ag-grid-right-aligned-cell .cell,
|
||||||
|
.ag-grid-tree-host .ag-grid-right-aligned-cell .widget,
|
||||||
|
.ag-grid-tree-host .ag-grid-right-aligned-cell .widget > *,
|
||||||
|
.ag-grid-tree-host .ag-grid-right-aligned-cell .ag-grid-special-cell,
|
||||||
|
.ag-grid-tree-host .ag-grid-right-aligned-cell .ag-grid-aggregate-cell {
|
||||||
|
text-align: right;
|
||||||
|
text-align: end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ag-grid-tree-host .ag-grid-right-aligned-cell .cell {
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ag-grid-tree-host .ag-grid-right-aligned-header .ag-header-cell-label {
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
.ag-grid-tree-host .ag-header-cell-comp-wrapper {
|
.ag-grid-tree-host .ag-header-cell-comp-wrapper {
|
||||||
padding-left: 6px;
|
padding-left: 6px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15037,6 +15037,19 @@ function eval_pyson(value){
|
|||||||
|
|
||||||
var WidgetFactory = Sao.View.FormXMLViewParser.WIDGETS[
|
var WidgetFactory = Sao.View.FormXMLViewParser.WIDGETS[
|
||||||
attributes.widget];
|
attributes.widget];
|
||||||
|
if (!WidgetFactory) {
|
||||||
|
console.error('[FORM][UNKNOWN_WIDGET]', {
|
||||||
|
viewId: this.view.view_id,
|
||||||
|
model: this.view.screen && this.view.screen.model_name,
|
||||||
|
field: name,
|
||||||
|
widget: attributes.widget,
|
||||||
|
fieldAttributes: this.field_attrs[name],
|
||||||
|
attributes: attributes,
|
||||||
|
node: node.outerHTML,
|
||||||
|
availableWidgets: Object.keys(
|
||||||
|
Sao.View.FormXMLViewParser.WIDGETS).sort(),
|
||||||
|
});
|
||||||
|
}
|
||||||
var widget = new WidgetFactory(this.view, attributes);
|
var widget = new WidgetFactory(this.view, attributes);
|
||||||
if (!this.view.widgets[name]) {
|
if (!this.view.widgets[name]) {
|
||||||
this.view.widgets[name] = [];
|
this.view.widgets[name] = [];
|
||||||
@@ -24748,10 +24761,17 @@ function eval_pyson(value){
|
|||||||
var is_hidden = invisible || optional ||
|
var is_hidden = invisible || optional ||
|
||||||
(column.attributes.name === this.screen.exclude_field);
|
(column.attributes.name === this.screen.exclude_field);
|
||||||
var default_width = this._get_default_column_width(column);
|
var default_width = this._get_default_column_width(column);
|
||||||
|
var right_aligned = this._is_right_aligned_column(column);
|
||||||
var col_def = {
|
var col_def = {
|
||||||
colId: name,
|
colId: name,
|
||||||
field: name,
|
field: name,
|
||||||
headerName: column.attributes.string || '',
|
headerName: column.attributes.string || '',
|
||||||
|
type: right_aligned ? 'rightAligned' : null,
|
||||||
|
cellClass: right_aligned ?
|
||||||
|
'ag-grid-right-aligned-cell ag-right-aligned-cell' : null,
|
||||||
|
cellStyle: right_aligned ? {textAlign: 'right'} : null,
|
||||||
|
headerClass: right_aligned ?
|
||||||
|
'ag-grid-right-aligned-header ag-right-aligned-header' : null,
|
||||||
sortable: !grouping_active && Boolean(column.sortable),
|
sortable: !grouping_active && Boolean(column.sortable),
|
||||||
filter: grouping_active ? false : this._get_column_filter(column),
|
filter: grouping_active ? false : this._get_column_filter(column),
|
||||||
filterParams: grouping_active ? null :
|
filterParams: grouping_active ? null :
|
||||||
@@ -24810,10 +24830,37 @@ function eval_pyson(value){
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
console.info('[AGGRID][ALIGN_COLUMN]', {
|
||||||
|
colId: name,
|
||||||
|
label: column.attributes.string || '',
|
||||||
|
widget: column.attributes.widget || '',
|
||||||
|
className: column.class_ || '',
|
||||||
|
rightAligned: right_aligned,
|
||||||
|
cellClass: col_def.cellClass,
|
||||||
|
headerClass: col_def.headerClass,
|
||||||
|
});
|
||||||
|
|
||||||
column_defs.push(col_def);
|
column_defs.push(col_def);
|
||||||
});
|
});
|
||||||
return column_defs;
|
return column_defs;
|
||||||
},
|
},
|
||||||
|
_is_right_aligned_column: function(column) {
|
||||||
|
if (!column || !column.attributes) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (column instanceof Sao.View.Tree.IntegerColumn ||
|
||||||
|
column instanceof Sao.View.Tree.FloatColumn) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (~['integer', 'float', 'numeric'].indexOf(
|
||||||
|
column.attributes.widget || '')) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
var name = column.attributes.name || '';
|
||||||
|
var label = column.attributes.string || name;
|
||||||
|
return /amount|quantity|qty|price|premium|discount|tax|debit|credit|balance|solde|total/i.test(
|
||||||
|
name + ' ' + label);
|
||||||
|
},
|
||||||
_get_default_column_width: function(column) {
|
_get_default_column_width: function(column) {
|
||||||
var name = column && column.attributes && column.attributes.name || '';
|
var name = column && column.attributes && column.attributes.name || '';
|
||||||
var label = column && column.attributes &&
|
var label = column && column.attributes &&
|
||||||
|
|||||||
Reference in New Issue
Block a user