Skip to content

Commit 80c09f9

Browse files
author
gitlabci
committed
Merge branch '2023.11' into 2024.11
2 parents 8c8234f + cfc2452 commit 80c09f9

File tree

14 files changed

+213
-299
lines changed

14 files changed

+213
-299
lines changed

tine20/Addressbook/js/ContactGrid.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Tine.Addressbook.ContactGridPanel = Ext.extend(Tine.widgets.grid.GridPanel, {
8282
* @param {Folder|Account} record
8383
* @return {String}
8484
*/
85-
oneColumnRenderer: function(folderId, metadata, record) {
85+
responsiveRenderer: function(folderId, metadata, record) {
8686
const block = document.createElement('div');
8787
block.className = 'responsive-title';
8888

tine20/Addressbook/js/ContactGridDetailsPanel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Tine.Addressbook.ContactGridDetailsPanel = Ext.extend(Tine.widgets.grid.DetailsP
5757
htmlEncode: false,
5858
cls: 'responsive-title',
5959
renderer: (value, metaData, record) => {
60-
return Tine.Addressbook.ContactGridPanel.prototype.oneColumnRenderer.call(this, null, null, record)
60+
return Tine.Addressbook.ContactGridPanel.prototype.responsiveRenderer.call(this, null, null, record)
6161
}
6262
}]
6363
}, {

tine20/Felamimail/js/GridPanel.js

Lines changed: 65 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
* @copyright Copyright (c) 2007-2021 Metaways Infosystems GmbH (http://www.metaways.de)
88
*/
99

10-
import {getLayoutClassByMode} from "../../Tinebase/js/util/responsiveLayout";
11-
1210
Ext.namespace('Tine.Felamimail');
1311

1412
require('./MessageFileAction');
@@ -831,7 +829,7 @@ Tine.Felamimail.GridPanel = Ext.extend(Tine.widgets.grid.GridPanel, {
831829
* @param {Folder|Account} record
832830
* @return {String}
833831
*/
834-
oneColumnRenderer: function(folderId, metadata, record) {
832+
responsiveRenderer: function(folderId, metadata, record) {
835833
const block = document.createElement('div');
836834

837835
const flagIcons = record.getFlagIcons();
@@ -1657,6 +1655,7 @@ Tine.Felamimail.GridPanel = Ext.extend(Tine.widgets.grid.GridPanel, {
16571655
},
16581656

16591657
onStoreBeforeLoadFolderChange: function (store, options) {
1658+
this.updateGridState();
16601659
this.updateDefaultfilter(options.params, this.sentFolderSelected);
16611660
},
16621661

@@ -1711,40 +1710,80 @@ Tine.Felamimail.GridPanel = Ext.extend(Tine.widgets.grid.GridPanel, {
17111710

17121711
params.filter[0].filters[0].filters = targetFilters;
17131712
},
1714-
1715-
getStateIdSuffix() {
1716-
this.resolveSendFolderPath();
1717-
this.folderSuffix = this.sentFolderSelected ? '-SendFolder' : '';
1718-
return `${this.stateIdSuffix}${this.folderSuffix}`;
1719-
},
17201713

17211714
/**
1722-
* if send, draft, template folders are selected, do the following:
1723-
*
1724-
* - hide from email + name columns from grid
1725-
* - show to column in grid
1715+
* // if send, draft, template folders are selected, do the following:
1716+
* // - hide from email + name columns from grid
1717+
* // - show to column in grid
1718+
* // - save this state
1719+
* // - if grid state is changed by user, do not change columns by user
1720+
*
1721+
* // if switched from send, draft, template to "normal" folder
1722+
* // - switch to default state
17261723
*/
1727-
updateGridState: async function () {
1728-
this.grid.stateId = this.getResolvedGridStateId();
1724+
updateGridState: function () {
1725+
this.resolveSendFolderPath();
1726+
let stateId = this.sentFolderSelected ? this.sendFolderGridStateId : this.gridConfig.stateId;
1727+
const isEastLayout = this.detailsPanelRegion === 'east';
1728+
if (isEastLayout && !stateId.includes('_DetailsPanel_East')) stateId = stateId + '_DetailsPanel_East';
1729+
const isStateIdChanged = this.grid.stateId !== stateId;
1730+
if (!Ext.state.Manager.get(stateId)) this.grid.saveState();
1731+
this.grid.stateId = stateId;
1732+
1733+
const stateIdDefault = isEastLayout ? stateId : this.gridConfig.stateId;
1734+
const stateStored = Ext.state.Manager.get(stateIdDefault);
1735+
const stateCurrent = this.grid.getState();
1736+
let stateCloned = stateStored;
1737+
if (!isStateIdChanged || !stateStored) stateCloned = stateCurrent;
1738+
let stateClonedResolved = JSON.parse(JSON.stringify(stateCloned));
1739+
1740+
if (stateClonedResolved?.columns && isEastLayout) {
1741+
const stateClonedResolvedVisibleColumns = stateClonedResolved.columns.filter((col) => { return !col.hidden;});
1742+
if (stateClonedResolvedVisibleColumns.length === 0) {
1743+
const restoreStateId = stateId.replace('_DetailsPanel_East', '');
1744+
const restoreState = Ext.state.Manager.get(restoreStateId);
1745+
const restoreStateVisibleColumns = restoreState.columns.filter((col) => { return !col.hidden;});
1746+
if (restoreStateVisibleColumns === 0) {
1747+
stateClonedResolved.columns.forEach((c) => {c.hidden = c.id === 'responsive';})
1748+
} else {
1749+
stateClonedResolved.columns.forEach((c, idx) => {c.hidden = restoreState.columns[idx].hidden ?? false;})
1750+
}
1751+
}
1752+
}
17291753

1730-
if (this.grid.stateId.includes(this.sendFolderGridStateId)) {
1754+
if (stateId.includes(this.sendFolderGridStateId)) {
1755+
let refState = Ext.state.Manager.get(stateId);
1756+
if (refState) stateClonedResolved = JSON.parse(JSON.stringify(refState));
1757+
1758+
// - hide from email + name columns from grid
1759+
// - show to column in grid
17311760
const customHideCols = {
1732-
'from_email': true,
1733-
'from_name': true,
1734-
'to': false,
1761+
'from_email' : true,
1762+
'from_name' : true,
1763+
'to' : false,
17351764
}
1765+
//overwrite custom states
17361766
_.each(customHideCols, (isHidden, colId) => {
1737-
const idx = _.findIndex(this.grid.colModel.config, {id: colId});
1738-
if (idx > -1 && isHidden !== _.get(this.grid.colModel.config[idx], 'hidden', false)) {
1739-
this.grid.colModel.setHidden(idx, isHidden, true);
1767+
const idx = _.findIndex(stateClonedResolved.columns, {id: colId});
1768+
isHidden = !refState ? isHidden : _.get(_.find(refState.columns, {id: colId}), 'hidden', false);
1769+
1770+
if (idx > -1 && isHidden !== _.get(stateClonedResolved.columns[idx], 'hidden', false)) {
1771+
if (isHidden) {
1772+
stateClonedResolved.columns[idx].hidden = true;
1773+
} else {
1774+
delete stateClonedResolved.columns[idx].hidden;
1775+
}
17401776
}
17411777
})
17421778
}
1743-
1744-
if (this.grid && !Ext.state.Manager.get(this.grid.stateId)) {
1745-
await this.grid.saveState();
1779+
1780+
if (!isStateIdChanged) {
1781+
stateClonedResolved.sort = this.store.getSortState();
17461782
}
1747-
this.grid.view.layout();
1783+
this.grid.applyState(stateClonedResolved);
1784+
// save state
1785+
this.grid.saveState();
1786+
if (isStateIdChanged) this.getView().refresh(true);
17481787
},
17491788

17501789
/**

tine20/Tinebase/ModelConfiguration/Const.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@ class Tinebase_ModelConfiguration_Const {
203203
*/
204204
public const REQUIRED_RIGHT = 'requiredRight';
205205
public const RESOLVE_DELETED = 'resolveDeleted';
206-
public const RESPONSIVE_LEVEL = 'responsiveLevel';
207206
public const RUN_CONVERT_TO_RECORD_FROM_JSON = 'runConvertToRecordFromJson';
208207

209208
/**
@@ -283,10 +282,6 @@ class Tinebase_ModelConfiguration_Const {
283282
public const UNIQUE_CONSTRAINTS = 'uniqueConstraints';
284283
public const UNSIGNED = 'unsigned';
285284
public const UI_CONFIG = 'uiconfig';
286-
public const UI_CONFIG_LAYOUT_SMALL = 'small';
287-
public const UI_CONFIG_LAYOUT_MEDIUM = 'medium';
288-
public const UI_CONFIG_LAYOUT_BIG = 'big';
289-
public const UI_CONFIG_LAYOUT_LARGE = 'large';
290285

291286
public const VALIDATORS = 'validators';
292287
public const VERSION = 'version';

tine20/Tinebase/css/Tinebase.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1319,7 +1319,7 @@ textarea.x-form-field.tinebase-editmultipledialog-noneedit {
13191319
}
13201320

13211321
.x-cols-icon {
1322-
background: url(../../images/icon-set/icon_column.svg) !important;
1322+
background: url(../../images/icon-set/icon_column_neg.svg) !important;
13231323
}
13241324

13251325

tine20/Tinebase/js/StateProvider.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,17 @@ Ext.extend(Tine.Tinebase.StateProvider, Ext.state.Provider, {
4545
set: async function (name, value) {
4646
if (typeof value == "undefined" || value === null) {
4747
await this.clear(name);
48+
return;
4849
}
50+
4951
const encodedValue = this.encodeValue(value);
5052
const currentStateEncodedValue = this.encodeValue(this.state[name]);
51-
53+
5254
if (!this.state[name] || (currentStateEncodedValue !== encodedValue)) {
5355
// persistent save
5456
await Tine.Tinebase.setState(name, encodedValue);
5557
}
58+
5659
Tine.Tinebase.StateProvider.superclass.set.call(this, name, value);
5760
}
5861
});
Lines changed: 9 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,16 @@
11
/**
22
* returns matching size class
33
* @param {Number} px
4-
* @param columns
4+
* @param {Object} clss {clsName: px}
55
*/
6-
const getLayoutClassByWidth = (px, columns) => {
7-
const config = getDefaultLayoutClasses(columns);
8-
let result = config[config.length - 1];
9-
config.some((config) => {
10-
if (px <= config.width) {
11-
result = config;
12-
return true;
13-
}
14-
})
15-
return result;
16-
}
17-
18-
const getLayoutClassByMode = (mode, columns) => {
19-
const config = getDefaultLayoutClasses(columns);
20-
let result = config[config.length - 1];
21-
config.some((config) => {
22-
if (mode === config.name) {
23-
result = config;
24-
return true;
25-
}
26-
})
27-
return result;
28-
}
29-
30-
const getDefaultLayoutClasses = (columns = []) => {
31-
const defaultConfigs = [
32-
{level: 0, name: 'oneColumn', width: 400},
33-
{level: 1, name: 'small', width: 600},
34-
{level: 2, name: 'medium', width: 1000},
35-
{level: 3, name: 'big', width: 1800},
36-
{level: 4, name: 'large', width: Infinity},
37-
];
38-
const supportLevels = ['oneColumn', 'big'].concat([...new Set(columns.map((col) => col?.responsiveLevel).filter(Boolean))]);
39-
return defaultConfigs.filter(config => supportLevels.includes(config.name));
6+
const getCls = (px, clss) => {
7+
const clsNames = Object.keys(clss)
8+
for (let idx=0; idx<=clsNames.length; idx++) {
9+
if (px <= clss[clsNames[idx]]) break
10+
}
11+
return clsNames[idx]
4012
}
4113

4214
export {
43-
getLayoutClassByWidth,
44-
getLayoutClassByMode,
45-
}
15+
getCls
16+
}

tine20/Tinebase/js/widgets/grid/ColumnManager.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -163,14 +163,6 @@ Tine.widgets.grid.ColumnManager = function() {
163163
if (fieldDefinition.hasOwnProperty('summaryType')) {
164164
column.summaryType = fieldDefinition.summaryType;
165165
}
166-
167-
if (fieldDefinition?.uiconfig?.responsiveLevel) {
168-
column.responsiveLevel = fieldDefinition.uiconfig.responsiveLevel;
169-
}
170-
171-
if (fieldDefinition?.shy) {
172-
column.responsiveLevel = 'large';
173-
}
174166

175167
// NOTE: app might be from owningApp whereas appName ist the models app
176168
var renderer = Tine.widgets.grid.RendererManager.get(appName, modelName, fieldName, Tine.widgets.grid.RendererManager.CATEGORY_GRIDPANEL);

0 commit comments

Comments
 (0)