list detail layout realType usage

This commit is contained in:
Yuri Kuznetsov
2023-11-17 10:33:16 +02:00
parent ad63cfeae4
commit ef13eee386
4 changed files with 26 additions and 3 deletions

View File

@@ -84,6 +84,7 @@ class LayoutBaseView extends View {
this.events = _.clone(this.events);
this.scope = this.options.scope;
this.type = this.options.type;
this.realType = this.options.realType;
this.setId = this.options.setId;
this.em = this.options.em;

View File

@@ -286,7 +286,17 @@ define('views/admin/layouts/detail', ['views/admin/layouts/grid'], function (Dep
var layoutList = model.getFieldParam(name, 'layoutAvailabilityList');
if (layoutList && !layoutList.includes(this.type)) {
let realType = this.realType;
if (realType === 'detailSmall') {
realType = 'detail';
}
if (
layoutList &&
!layoutList.includes(this.type) &&
!layoutList.includes(realType)
) {
return;
}

View File

@@ -272,6 +272,7 @@ class LayoutIndexView extends View {
fullSelector: '#layout-content',
scope: scope,
type: type,
realType: typeReal,
setId: this.setId,
em: this.em,
}, view => {

View File

@@ -259,10 +259,21 @@ define('views/admin/layouts/list', ['views/admin/layouts/rows'], function (Dep)
return false;
}
/** @type {string[]|null} */
const layoutList = model.getFieldParam(name, 'layoutAvailabilityList');
if (layoutList && !~layoutList.indexOf(this.type)) {
return;
let realType = this.realType;
if (realType === 'listSmall') {
realType = 'list';
}
if (
layoutList &&
!layoutList.includes(this.type) &&
!layoutList.includes(realType)
) {
return false;
}
return !model.getFieldParam(name, 'disabled') &&