Badge
This commit is contained in:
18
dist/tryton-sao.css
vendored
18
dist/tryton-sao.css
vendored
@@ -11774,9 +11774,19 @@ html[theme="default"] .ag-grid-tree-grouping-panel input[type="checkbox"]:after
|
|||||||
.ag-grid-tree-host .ag-grid-badge-cell {
|
.ag-grid-tree-host .ag-grid-badge-cell {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ag-grid-tree-host .ag-grid-badge-column-cell {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ag-grid-tree-host .ag-grid-badge-column-header .ag-header-cell-label {
|
||||||
|
justify-content: center;
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.ag-grid-tree-host .ag-grid-badge {
|
.ag-grid-tree-host .ag-grid-badge {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -11785,15 +11795,19 @@ html[theme="default"] .ag-grid-tree-grouping-panel input[type="checkbox"]:after
|
|||||||
padding: 2px 10px;
|
padding: 2px 10px;
|
||||||
border-radius: 999px;
|
border-radius: 999px;
|
||||||
background: #6c757d;
|
background: #6c757d;
|
||||||
color: #fff;
|
color: #f7fbf9;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
font-weight: 700;
|
font-weight: 500;
|
||||||
line-height: 1.35;
|
line-height: 1.35;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ag-grid-tree-host .ag-grid-badge-bold {
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
.ag-grid-tree-host .ag-grid-right-aligned-header .ag-header-cell-label {
|
.ag-grid-tree-host .ag-grid-right-aligned-header .ag-header-cell-label {
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
}
|
}
|
||||||
|
|||||||
42
dist/tryton-sao.js
vendored
42
dist/tryton-sao.js
vendored
@@ -24762,16 +24762,21 @@ function eval_pyson(value){
|
|||||||
(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 right_aligned = this._is_right_aligned_column(column);
|
||||||
|
var badge_column = this._is_badge_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,
|
type: right_aligned ? 'rightAligned' : null,
|
||||||
cellClass: right_aligned ?
|
cellClass: badge_column ? 'ag-grid-badge-column-cell' :
|
||||||
'ag-grid-right-aligned-cell ag-right-aligned-cell' : null,
|
(right_aligned ?
|
||||||
cellStyle: right_aligned ? {textAlign: 'right'} : null,
|
'ag-grid-right-aligned-cell ag-right-aligned-cell' : null),
|
||||||
headerClass: right_aligned ?
|
cellStyle: right_aligned && !badge_column ?
|
||||||
'ag-grid-right-aligned-header ag-right-aligned-header' : null,
|
{textAlign: 'right'} : null,
|
||||||
|
headerClass: badge_column ? 'ag-grid-badge-column-header' :
|
||||||
|
(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 :
|
||||||
@@ -24814,7 +24819,7 @@ function eval_pyson(value){
|
|||||||
if (!params.data.__record) {
|
if (!params.data.__record) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
if (this._is_badge_column(column)) {
|
if (badge_column) {
|
||||||
return this._render_badge_cell(
|
return this._render_badge_cell(
|
||||||
column, params.data.__record);
|
column, params.data.__record);
|
||||||
}
|
}
|
||||||
@@ -26079,15 +26084,18 @@ function eval_pyson(value){
|
|||||||
color = color === null || color === undefined ? '' :
|
color = color === null || color === undefined ? '' :
|
||||||
String(color).trim();
|
String(color).trim();
|
||||||
var palette = {
|
var palette = {
|
||||||
red: '#dc3545',
|
red: '#e06a6a',
|
||||||
danger: '#dc3545',
|
danger: '#e06a6a',
|
||||||
orange: '#f59f00',
|
coral: '#e06a6a',
|
||||||
warning: '#f59f00',
|
orange: '#d99a2b',
|
||||||
|
warning: '#d99a2b',
|
||||||
|
amber: '#d99a2b',
|
||||||
yellow: '#f1c40f',
|
yellow: '#f1c40f',
|
||||||
green: '#28a745',
|
green: '#2b8c87',
|
||||||
success: '#28a745',
|
success: '#2b8c87',
|
||||||
blue: '#17a2b8',
|
teal: '#2b8c87',
|
||||||
info: '#17a2b8',
|
blue: '#57c1b9',
|
||||||
|
info: '#57c1b9',
|
||||||
gray: '#6c757d',
|
gray: '#6c757d',
|
||||||
grey: '#6c757d',
|
grey: '#6c757d',
|
||||||
muted: '#6c757d',
|
muted: '#6c757d',
|
||||||
@@ -26101,6 +26109,9 @@ function eval_pyson(value){
|
|||||||
var mapped = this._parse_badge_colors(attributes.badge_colors);
|
var mapped = this._parse_badge_colors(attributes.badge_colors);
|
||||||
if (Object.prototype.hasOwnProperty.call(mapped, text)) {
|
if (Object.prototype.hasOwnProperty.call(mapped, text)) {
|
||||||
color = mapped[text];
|
color = mapped[text];
|
||||||
|
} else if (Object.prototype.hasOwnProperty.call(
|
||||||
|
mapped, String(text).toLowerCase())) {
|
||||||
|
color = mapped[String(text).toLowerCase()];
|
||||||
}
|
}
|
||||||
if (!color && attributes.badge_color_field) {
|
if (!color && attributes.badge_color_field) {
|
||||||
color = this._get_record_field_value(
|
color = this._get_record_field_value(
|
||||||
@@ -26139,6 +26150,9 @@ function eval_pyson(value){
|
|||||||
'class': 'ag-grid-badge',
|
'class': 'ag-grid-badge',
|
||||||
'text': text,
|
'text': text,
|
||||||
});
|
});
|
||||||
|
if (parseInt(column.attributes.badge_bold || '0', 10)) {
|
||||||
|
badge.addClass('ag-grid-badge-bold');
|
||||||
|
}
|
||||||
var colors = this._get_badge_colors(column, record, text);
|
var colors = this._get_badge_colors(column, record, text);
|
||||||
if (colors.background) {
|
if (colors.background) {
|
||||||
badge.css('background-color', colors.background);
|
badge.css('background-color', colors.background);
|
||||||
|
|||||||
@@ -11774,9 +11774,19 @@ html[theme="default"] .ag-grid-tree-grouping-panel input[type="checkbox"]:after
|
|||||||
.ag-grid-tree-host .ag-grid-badge-cell {
|
.ag-grid-tree-host .ag-grid-badge-cell {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ag-grid-tree-host .ag-grid-badge-column-cell {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ag-grid-tree-host .ag-grid-badge-column-header .ag-header-cell-label {
|
||||||
|
justify-content: center;
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.ag-grid-tree-host .ag-grid-badge {
|
.ag-grid-tree-host .ag-grid-badge {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -11785,15 +11795,19 @@ html[theme="default"] .ag-grid-tree-grouping-panel input[type="checkbox"]:after
|
|||||||
padding: 2px 10px;
|
padding: 2px 10px;
|
||||||
border-radius: 999px;
|
border-radius: 999px;
|
||||||
background: #6c757d;
|
background: #6c757d;
|
||||||
color: #fff;
|
color: #f7fbf9;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
font-weight: 700;
|
font-weight: 500;
|
||||||
line-height: 1.35;
|
line-height: 1.35;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ag-grid-tree-host .ag-grid-badge-bold {
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
.ag-grid-tree-host .ag-grid-right-aligned-header .ag-header-cell-label {
|
.ag-grid-tree-host .ag-grid-right-aligned-header .ag-header-cell-label {
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24762,16 +24762,21 @@ function eval_pyson(value){
|
|||||||
(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 right_aligned = this._is_right_aligned_column(column);
|
||||||
|
var badge_column = this._is_badge_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,
|
type: right_aligned ? 'rightAligned' : null,
|
||||||
cellClass: right_aligned ?
|
cellClass: badge_column ? 'ag-grid-badge-column-cell' :
|
||||||
'ag-grid-right-aligned-cell ag-right-aligned-cell' : null,
|
(right_aligned ?
|
||||||
cellStyle: right_aligned ? {textAlign: 'right'} : null,
|
'ag-grid-right-aligned-cell ag-right-aligned-cell' : null),
|
||||||
headerClass: right_aligned ?
|
cellStyle: right_aligned && !badge_column ?
|
||||||
'ag-grid-right-aligned-header ag-right-aligned-header' : null,
|
{textAlign: 'right'} : null,
|
||||||
|
headerClass: badge_column ? 'ag-grid-badge-column-header' :
|
||||||
|
(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 :
|
||||||
@@ -24814,7 +24819,7 @@ function eval_pyson(value){
|
|||||||
if (!params.data.__record) {
|
if (!params.data.__record) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
if (this._is_badge_column(column)) {
|
if (badge_column) {
|
||||||
return this._render_badge_cell(
|
return this._render_badge_cell(
|
||||||
column, params.data.__record);
|
column, params.data.__record);
|
||||||
}
|
}
|
||||||
@@ -26079,15 +26084,18 @@ function eval_pyson(value){
|
|||||||
color = color === null || color === undefined ? '' :
|
color = color === null || color === undefined ? '' :
|
||||||
String(color).trim();
|
String(color).trim();
|
||||||
var palette = {
|
var palette = {
|
||||||
red: '#dc3545',
|
red: '#e06a6a',
|
||||||
danger: '#dc3545',
|
danger: '#e06a6a',
|
||||||
orange: '#f59f00',
|
coral: '#e06a6a',
|
||||||
warning: '#f59f00',
|
orange: '#d99a2b',
|
||||||
|
warning: '#d99a2b',
|
||||||
|
amber: '#d99a2b',
|
||||||
yellow: '#f1c40f',
|
yellow: '#f1c40f',
|
||||||
green: '#28a745',
|
green: '#2b8c87',
|
||||||
success: '#28a745',
|
success: '#2b8c87',
|
||||||
blue: '#17a2b8',
|
teal: '#2b8c87',
|
||||||
info: '#17a2b8',
|
blue: '#57c1b9',
|
||||||
|
info: '#57c1b9',
|
||||||
gray: '#6c757d',
|
gray: '#6c757d',
|
||||||
grey: '#6c757d',
|
grey: '#6c757d',
|
||||||
muted: '#6c757d',
|
muted: '#6c757d',
|
||||||
@@ -26101,6 +26109,9 @@ function eval_pyson(value){
|
|||||||
var mapped = this._parse_badge_colors(attributes.badge_colors);
|
var mapped = this._parse_badge_colors(attributes.badge_colors);
|
||||||
if (Object.prototype.hasOwnProperty.call(mapped, text)) {
|
if (Object.prototype.hasOwnProperty.call(mapped, text)) {
|
||||||
color = mapped[text];
|
color = mapped[text];
|
||||||
|
} else if (Object.prototype.hasOwnProperty.call(
|
||||||
|
mapped, String(text).toLowerCase())) {
|
||||||
|
color = mapped[String(text).toLowerCase()];
|
||||||
}
|
}
|
||||||
if (!color && attributes.badge_color_field) {
|
if (!color && attributes.badge_color_field) {
|
||||||
color = this._get_record_field_value(
|
color = this._get_record_field_value(
|
||||||
@@ -26139,6 +26150,9 @@ function eval_pyson(value){
|
|||||||
'class': 'ag-grid-badge',
|
'class': 'ag-grid-badge',
|
||||||
'text': text,
|
'text': text,
|
||||||
});
|
});
|
||||||
|
if (parseInt(column.attributes.badge_bold || '0', 10)) {
|
||||||
|
badge.addClass('ag-grid-badge-bold');
|
||||||
|
}
|
||||||
var colors = this._get_badge_colors(column, record, text);
|
var colors = this._get_badge_colors(column, record, text);
|
||||||
if (colors.background) {
|
if (colors.background) {
|
||||||
badge.css('background-color', colors.background);
|
badge.css('background-color', colors.background);
|
||||||
|
|||||||
Reference in New Issue
Block a user