Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/themify-.../js/editor/modules
File: row.mjs
(api => {
[0] Fix | Delete
"use strict";
[1] Fix | Delete
api.Row = class extends api.Base {
[2] Fix | Delete
constructor(fields) {
[3] Fix | Delete
super(fields);
[4] Fix | Delete
if(fields.sizes?.length!==undefined){
[5] Fix | Delete
fields.sizes = {};
[6] Fix | Delete
}
[7] Fix | Delete
this.convertToGrid(fields);//convert old data to grid
[8] Fix | Delete
if (!(this instanceof  api.Subrow )) {//hack js isn't real OOP,doesn't recognize child class props/method in constructor
[9] Fix | Delete
this.type = 'row';
[10] Fix | Delete
this.initialize();
[11] Fix | Delete
this.render();
[12] Fix | Delete
}
[13] Fix | Delete
}
[14] Fix | Delete
static getSettingsName(slug) {
[15] Fix | Delete
return i18n.ropt;
[16] Fix | Delete
}
[17] Fix | Delete
static getOptions() {
[18] Fix | Delete
return [
[19] Fix | Delete
{
[20] Fix | Delete
id: 'row_width',
[21] Fix | Delete
label: 'rw',
[22] Fix | Delete
type: 'layout',
[23] Fix | Delete
mode: 'sprite',
[24] Fix | Delete
options: [
[25] Fix | Delete
{
[26] Fix | Delete
img: 'row_default',
[27] Fix | Delete
label: 'def'
[28] Fix | Delete
},
[29] Fix | Delete
{
[30] Fix | Delete
img: 'row_fullwidth',
[31] Fix | Delete
value: 'fullwidth',
[32] Fix | Delete
label: 'box'
[33] Fix | Delete
},
[34] Fix | Delete
{
[35] Fix | Delete
img: 'row_fullwidth_content',
[36] Fix | Delete
value: 'fullwidth-content',
[37] Fix | Delete
label: 'fw'
[38] Fix | Delete
}
[39] Fix | Delete
]
[40] Fix | Delete
},
[41] Fix | Delete
{
[42] Fix | Delete
id: 'row_height',
[43] Fix | Delete
label: 'rh',
[44] Fix | Delete
type: 'layout',
[45] Fix | Delete
mode: 'sprite',
[46] Fix | Delete
options: [
[47] Fix | Delete
{
[48] Fix | Delete
img: 'row_default',
[49] Fix | Delete
label: 'def'
[50] Fix | Delete
},
[51] Fix | Delete
{
[52] Fix | Delete
img: 'row_fullheight',
[53] Fix | Delete
value: 'fullheight',
[54] Fix | Delete
label: 'fh'
[55] Fix | Delete
}
[56] Fix | Delete
]
[57] Fix | Delete
},
[58] Fix | Delete
{
[59] Fix | Delete
type:'grid'
[60] Fix | Delete
},
[61] Fix | Delete
{
[62] Fix | Delete
id: 'custom_css_row',
[63] Fix | Delete
type: 'custom_css'
[64] Fix | Delete
},
[65] Fix | Delete
{
[66] Fix | Delete
id: 'row_anchor',
[67] Fix | Delete
type: 'row_anchor',
[68] Fix | Delete
label: 'ranc',
[69] Fix | Delete
class: 'large',
[70] Fix | Delete
help: 'ranch'
[71] Fix | Delete
},
[72] Fix | Delete
{
[73] Fix | Delete
id: 'hide_anchor',
[74] Fix | Delete
type: 'checkbox',
[75] Fix | Delete
label: '',
[76] Fix | Delete
options: [
[77] Fix | Delete
{
[78] Fix | Delete
name: '1',
[79] Fix | Delete
value: 'hranc'
[80] Fix | Delete
}
[81] Fix | Delete
]
[82] Fix | Delete
},
[83] Fix | Delete
{
[84] Fix | Delete
type: 'custom_css_id'
[85] Fix | Delete
},
[86] Fix | Delete
{
[87] Fix | Delete
type: 'clickable'
[88] Fix | Delete
}
[89] Fix | Delete
];
[90] Fix | Delete
}
[91] Fix | Delete
initialize() {
[92] Fix | Delete
super.initialize();
[93] Fix | Delete
}
[94] Fix | Delete
defaults() {
[95] Fix | Delete
return {
[96] Fix | Delete
cols: [],
[97] Fix | Delete
styling: {}
[98] Fix | Delete
};
[99] Fix | Delete
}
[100] Fix | Delete
attributes() {
[101] Fix | Delete
const data = this.get('styling'),
[102] Fix | Delete
attr = {
[103] Fix | Delete
class: 'module_row tb_active_row tb_' + this.id
[104] Fix | Delete
};
[105] Fix | Delete
if (data !== null) {
[106] Fix | Delete
if (data.custom_css_row !== undefined && data.custom_css_row !== '') {
[107] Fix | Delete
attr.class += ' ' + data.custom_css_row;
[108] Fix | Delete
}
[109] Fix | Delete
if (data.row_width === 'fullwidth-content') {
[110] Fix | Delete
attr.class += ' fullwidth';
[111] Fix | Delete
}
[112] Fix | Delete
if (data.custom_css_id !== undefined && data.custom_css_id !== '') {
[113] Fix | Delete
attr.id = data.custom_css_id;
[114] Fix | Delete
}
[115] Fix | Delete
}
[116] Fix | Delete
return attr;
[117] Fix | Delete
}
[118] Fix | Delete
render() {
[119] Fix | Delete
let not_empty = false,
[120] Fix | Delete
cols = this.get('cols');
[121] Fix | Delete
if(!Array.isArray(cols)){//very very old saved data can be object, not array.
[122] Fix | Delete
cols=Object.values(cols);
[123] Fix | Delete
}
[124] Fix | Delete
const isSubRow=this.type === 'subrow',
[125] Fix | Delete
container = isSubRow?this.el.tfClass('module_subrow')[0]:this.el.tfClass(this.type + '_inner')[0],
[126] Fix | Delete
fr = createDocumentFragment(),
[127] Fix | Delete
len = cols.length,
[128] Fix | Delete
cl=[];
[129] Fix | Delete
[130] Fix | Delete
if (len > 0) {
[131] Fix | Delete
if (len > 1 && this.get('desktop_dir') === 'rtl') { //it's old version data. Should follow dom order in desktop mode
[132] Fix | Delete
cols = cols.reverse();
[133] Fix | Delete
}
[134] Fix | Delete
for (let i = 0; i < len; ++i) {
[135] Fix | Delete
if (cols[i] !== undefined && cols[i] !== null) {
[136] Fix | Delete
let c = new api.Column(cols[i], isSubRow);
[137] Fix | Delete
[138] Fix | Delete
fr.appendChild(c.el);
[139] Fix | Delete
if (not_empty === false) {
[140] Fix | Delete
let m = c.get('modules');
[141] Fix | Delete
not_empty = m?.length > 0;
[142] Fix | Delete
}
[143] Fix | Delete
if (len > 1 && (i === 0 || i === (len - 1))) {
[144] Fix | Delete
c.el.classList.add((i === 0 ? 'first' : 'last'));
[145] Fix | Delete
}
[146] Fix | Delete
}
[147] Fix | Delete
}
[148] Fix | Delete
cl.push('tb_col_count_' + len);
[149] Fix | Delete
if (len > 1) {
[150] Fix | Delete
//backward compatibility
[151] Fix | Delete
const sizes = this.get('sizes');
[152] Fix | Delete
if (!api.isFrontend) {
[153] Fix | Delete
const points = api.breakpointsReverse,
[154] Fix | Delete
st = this.get('styling'),
[155] Fix | Delete
data = {grid: Object.assign({count: len, model: this}, sizes)};
[156] Fix | Delete
data.grid.desktop_size??= len;
[157] Fix | Delete
for (let i = points.length - 1; i > -1; --i) {
[158] Fix | Delete
let vals = ThemifyStyles.fields.grid.call(ThemifyStyles, 'grid', this.type, {}, data, this.id, st, points[i], true);
[159] Fix | Delete
this.setGridCss(vals, points[i]);
[160] Fix | Delete
}
[161] Fix | Delete
}
[162] Fix | Delete
let align = sizes.desktop_align;
[163] Fix | Delete
if (align === undefined) {
[164] Fix | Delete
align = api.isFullSection === true ? 'center' : 'start';
[165] Fix | Delete
}
[166] Fix | Delete
if (align === 'start') {
[167] Fix | Delete
align = 'top';
[168] Fix | Delete
} else {
[169] Fix | Delete
align = align === 'center' ? 'middle' : 'bottom';
[170] Fix | Delete
}
[171] Fix | Delete
cl.push('col_align_' + align);
[172] Fix | Delete
if (sizes.desktop_dir === 'rtl') {
[173] Fix | Delete
cl.push('direction_rtl');
[174] Fix | Delete
}
[175] Fix | Delete
if (sizes.desktop_gutter === 'narrow' || sizes.desktop_gutter === 'none') {//backward
[176] Fix | Delete
cl.push('gutter-' + sizes.desktop_gutter);
[177] Fix | Delete
}
[178] Fix | Delete
if (sizes.desktop_auto_h === 1) {
[179] Fix | Delete
cl.push('col_auto_height');
[180] Fix | Delete
}
[181] Fix | Delete
}
[182] Fix | Delete
} else {
[183] Fix | Delete
let col = new api.Column({}, isSubRow);
[184] Fix | Delete
fr.appendChild(col.el);
[185] Fix | Delete
cl.push('tb_col_count_1');
[186] Fix | Delete
}
[187] Fix | Delete
if (!isSubRow) {
[188] Fix | Delete
const anchor = this.get('row_anchor'),
[189] Fix | Delete
custom_css_id = this.get('custom_css_id');
[190] Fix | Delete
if (anchor !== undefined && anchor !== '') {
[191] Fix | Delete
this.el.tfClass('tb_row_anchor')[0].textContent = anchor || '';
[192] Fix | Delete
}
[193] Fix | Delete
if (custom_css_id !== undefined && custom_css_id !== '') {
[194] Fix | Delete
this.el.tfClass('tb_row_id')[0].textContent = custom_css_id;
[195] Fix | Delete
}
[196] Fix | Delete
container.appendChild(fr);
[197] Fix | Delete
}
[198] Fix | Delete
else{
[199] Fix | Delete
cl.push('tb_' + this.id);
[200] Fix | Delete
container.prepend(fr);
[201] Fix | Delete
}
[202] Fix | Delete
container.className += ' ' + cl.join(' ');
[203] Fix | Delete
this.visibilityLabel();
[204] Fix | Delete
return this;
[205] Fix | Delete
}
[206] Fix | Delete
convertToGrid(fields) {
[207] Fix | Delete
const points = api.breakpointsReverse,
[208] Fix | Delete
bpLength = points.length,
[209] Fix | Delete
cols = fields.cols,
[210] Fix | Delete
count = cols?.length || 0;
[211] Fix | Delete
let sizes = fields.sizes;
[212] Fix | Delete
[213] Fix | Delete
if (sizes === undefined) {//this key should always exist in the grid version,even if it's empty
[214] Fix | Delete
sizes = {};
[215] Fix | Delete
let align = fields.column_alignment,
[216] Fix | Delete
colh = fields.column_h;
[217] Fix | Delete
[218] Fix | Delete
if (count > 1) {
[219] Fix | Delete
[220] Fix | Delete
const gutter = fields.gutter;
[221] Fix | Delete
if (gutter && gutter !== 'gutter' && gutter !== 'gutter-default') {
[222] Fix | Delete
sizes.desktop_gutter = gutter.replace('gutter-', '');
[223] Fix | Delete
}
[224] Fix | Delete
const g = sizes.desktop_gutter || 'def',
[225] Fix | Delete
gridClass = [],
[226] Fix | Delete
gridWidth = [];
[227] Fix | Delete
let hasCustomWidth = false;
[228] Fix | Delete
for (let i = 0; i < count; ++i) {
[229] Fix | Delete
let custom_w = cols[i].grid_width;
[230] Fix | Delete
if (custom_w) {
[231] Fix | Delete
hasCustomWidth = true;
[232] Fix | Delete
gridWidth.push(custom_w);
[233] Fix | Delete
delete cols[i].grid_width;
[234] Fix | Delete
}
[235] Fix | Delete
if (cols[i].grid_class) {
[236] Fix | Delete
gridClass.push(cols[i].grid_class);
[237] Fix | Delete
if (!custom_w) {
[238] Fix | Delete
gridWidth.push(cols[i].grid_class);
[239] Fix | Delete
}
[240] Fix | Delete
}
[241] Fix | Delete
}
[242] Fix | Delete
let desktop_size,
[243] Fix | Delete
useResizing = hasCustomWidth;
[244] Fix | Delete
[245] Fix | Delete
if (useResizing === false && g !== 'def' && gridClass.length > 0) {
[246] Fix | Delete
desktop_size = ThemifyStyles.gridBackwardCompatibility(gridClass);
[247] Fix | Delete
//in old version gutter narrow,none have been done wrong for sizes 1_2,2_1,1_1_2,1_2_1 and etc we need to convert them to custom sizes to save the same layout
[248] Fix | Delete
useResizing = desktop_size.includes('_');
[249] Fix | Delete
}
[250] Fix | Delete
if (useResizing === true) {
[251] Fix | Delete
const colSizes = ThemifyStyles.getOldColsSizes(g);
[252] Fix | Delete
for (let i = gridWidth.length - 1; i > -1; --i) {
[253] Fix | Delete
if (typeof gridWidth[i] === 'string' && gridWidth[i].includes('col')) {
[254] Fix | Delete
let cl = gridWidth[i].split(' ')[0].replace(/tb_3col|tablet_landscape|tablet|mobile|column|first|last/ig, '').trim();
[255] Fix | Delete
if (colSizes[cl] !== undefined) {
[256] Fix | Delete
gridWidth[i] = colSizes[cl];
[257] Fix | Delete
} else {
[258] Fix | Delete
gridWidth.splice(i, 1);
[259] Fix | Delete
}
[260] Fix | Delete
}
[261] Fix | Delete
}
[262] Fix | Delete
const min = Math.min.apply(null, gridWidth);
[263] Fix | Delete
for (let i = gridWidth.length - 1; i > -1; --i) {
[264] Fix | Delete
gridWidth[i] = min === gridWidth[i] ? '1fr' : (parseFloat((gridWidth[i] / min).toFixed(5)).toString() + 'fr');
[265] Fix | Delete
}
[266] Fix | Delete
desktop_size = gridWidth.join(' ');
[267] Fix | Delete
} else if (!desktop_size && gridClass.length > 0) {
[268] Fix | Delete
desktop_size = ThemifyStyles.gridBackwardCompatibility(gridClass);
[269] Fix | Delete
}
[270] Fix | Delete
if (desktop_size) {
[271] Fix | Delete
desktop_size = ThemifyStyles.getColSize(desktop_size, false);
[272] Fix | Delete
if (desktop_size !== '1' && desktop_size !== '2' && desktop_size !== '3' && desktop_size !== '4' && desktop_size !== '5' && desktop_size !== '6') {
[273] Fix | Delete
if (fields.desktop_dir === 'rtl' && (useResizing === true || desktop_size.toString().includes('_'))) {
[274] Fix | Delete
desktop_size = useResizing === true ? desktop_size.split(' ') : desktop_size.split('_');
[275] Fix | Delete
desktop_size = desktop_size.reverse();
[276] Fix | Delete
desktop_size = useResizing === true ? desktop_size.join(' ') : desktop_size.join('_');
[277] Fix | Delete
}
[278] Fix | Delete
sizes.desktop_size = desktop_size;
[279] Fix | Delete
}
[280] Fix | Delete
}
[281] Fix | Delete
for (let i = bpLength - 1; i > -1; --i) {
[282] Fix | Delete
let bp = points[i],
[283] Fix | Delete
dir = fields[bp + '_dir'] || 'ltr',
[284] Fix | Delete
col = fields['col_' + bp];
[285] Fix | Delete
[286] Fix | Delete
sizes[bp + '_dir'] = dir === '1' || dir === 1 ? 'rtl' : dir;
[287] Fix | Delete
[288] Fix | Delete
if (bp !== 'desktop') {
[289] Fix | Delete
//backward compatibility for themify-builder-style.css media-query(by default all cols in mobile should be fullwidth)
[290] Fix | Delete
let c = (col && col !== 'auto' && col !== '-auto') ? ThemifyStyles.gridBackwardCompatibility(col) : 'auto';
[291] Fix | Delete
[292] Fix | Delete
if (c === 'auto') {
[293] Fix | Delete
if (hasCustomWidth === true) {
[294] Fix | Delete
c = desktop_size;
[295] Fix | Delete
} else {
[296] Fix | Delete
let bpkey = bp[0],
[297] Fix | Delete
grid;
[298] Fix | Delete
if (bp.includes('_')) {
[299] Fix | Delete
bpkey += bp.split('_')[1][0];
[300] Fix | Delete
}
[301] Fix | Delete
grid = ThemifyStyles.getAreaValue('--area' + bpkey + count + '_' + c) || ThemifyStyles.getAreaValue('--area' + count + '_' + c); //check first for area for breakpoint e.g --aream5_3
[302] Fix | Delete
if (!grid) {
[303] Fix | Delete
for (let j = i + 1; j < bpLength; ++j) {
[304] Fix | Delete
grid = sizes[points[j] + '_size'];
[305] Fix | Delete
if (grid && grid !== 'auto') {
[306] Fix | Delete
grid = grid.includes('fr') ? grid : ThemifyStyles.gridBackwardCompatibility(grid);
[307] Fix | Delete
break;
[308] Fix | Delete
}
[309] Fix | Delete
}
[310] Fix | Delete
c = !grid ? count.toString() : grid;
[311] Fix | Delete
}
[312] Fix | Delete
}
[313] Fix | Delete
} else if (!c.toString().includes('_') && c > 0 && c < 6 && count < c) {
[314] Fix | Delete
c = '';
[315] Fix | Delete
for (let j = i + 1; j < bpLength; ++j) {
[316] Fix | Delete
if (sizes[points[j] + '_size'] !== undefined) {
[317] Fix | Delete
c = sizes[points[j] + '_size'];
[318] Fix | Delete
break;
[319] Fix | Delete
}
[320] Fix | Delete
}
[321] Fix | Delete
}
[322] Fix | Delete
sizes[bp + '_size'] = c === '' ? '' : ThemifyStyles.getColSize(c, false);
[323] Fix | Delete
}
[324] Fix | Delete
[325] Fix | Delete
delete fields[bp + '_dir'];
[326] Fix | Delete
delete fields['col_' + bp];
[327] Fix | Delete
}
[328] Fix | Delete
}
[329] Fix | Delete
if (align) {
[330] Fix | Delete
if (align === 'col_align_top') {
[331] Fix | Delete
align = '';
[332] Fix | Delete
} else {
[333] Fix | Delete
align = align === 'col_align_middle' ? 'center' : 'end';
[334] Fix | Delete
}
[335] Fix | Delete
if (align !== '') {
[336] Fix | Delete
sizes.desktop_align = align;
[337] Fix | Delete
}
[338] Fix | Delete
}
[339] Fix | Delete
sizes.desktop_auto_h = colh ? 1 : -1;
[340] Fix | Delete
delete fields.column_alignment;
[341] Fix | Delete
delete fields.gutter;
[342] Fix | Delete
delete fields.column_h;
[343] Fix | Delete
[344] Fix | Delete
} else if (count > 1) {
[345] Fix | Delete
for (let i = 0; i < bpLength - 1; ++i) {
[346] Fix | Delete
if (sizes[points[i] + '_size'] === undefined) {
[347] Fix | Delete
for (let j = i + 1; j < bpLength - 1; ++j) {
[348] Fix | Delete
if (sizes[points[j] + '_size'] !== undefined) {
[349] Fix | Delete
sizes[points[i] + '_size'] = sizes[points[j] + '_size'];
[350] Fix | Delete
break;
[351] Fix | Delete
}
[352] Fix | Delete
}
[353] Fix | Delete
}
[354] Fix | Delete
}
[355] Fix | Delete
}
[356] Fix | Delete
this.fields.sizes = sizes;
[357] Fix | Delete
}
[358] Fix | Delete
isLightboxOpen(){
[359] Fix | Delete
return api.activeModel?.id===this.id && api.LightBox.el.querySelector('#tb_grid_lb_root')!==null;
[360] Fix | Delete
}
[361] Fix | Delete
syncLightbox(k,value){
[362] Fix | Delete
let lb=api.LightBox.el.querySelector('#tb_grid_lb_root')?.shadowRoot.querySelector('#grid'),
[363] Fix | Delete
item;
[364] Fix | Delete
if(lb){
[365] Fix | Delete
if(k === 'size'){
[366] Fix | Delete
if(value.includes(' ')){
[367] Fix | Delete
value='user';
[368] Fix | Delete
}
[369] Fix | Delete
item=lb.querySelector('[data-col="grid"] [data-grid="'+value+'"]');
[370] Fix | Delete
}
[371] Fix | Delete
else if(k==='gutterVal'){
[372] Fix | Delete
item=lb.querySelector('#range');
[373] Fix | Delete
const gutterVal = parseFloat(value);
[374] Fix | Delete
item.value=gutterVal;
[375] Fix | Delete
lb.querySelector('#range_unit').value=value.toString().replace(gutterVal.toString(), '') || '%';
[376] Fix | Delete
Themify.triggerEvent(item,'change');
[377] Fix | Delete
return;
[378] Fix | Delete
}
[379] Fix | Delete
else{
[380] Fix | Delete
item=lb.querySelector('[data-col="'+k+'"] [data-value="'+value+'"]');
[381] Fix | Delete
}
[382] Fix | Delete
if(item && !item.classList.contains('selected')){
[383] Fix | Delete
Themify.triggerEvent(item,_CLICK_);
[384] Fix | Delete
}
[385] Fix | Delete
return true;
[386] Fix | Delete
}
[387] Fix | Delete
}
[388] Fix | Delete
saveLightbox(settings){
[389] Fix | Delete
delete settings[ThemifyConstructor.grid.id];
[390] Fix | Delete
const gridSetting=ThemifyConstructor.grid.get();
[391] Fix | Delete
if(gridSetting){
[392] Fix | Delete
this.set('sizes', {...gridSetting});
[393] Fix | Delete
}
[394] Fix | Delete
}
[395] Fix | Delete
getSizes(type, bp) {
[396] Fix | Delete
bp??= api.activeBreakPoint;
[397] Fix | Delete
let sizes =this.isLightboxOpen()?ThemifyConstructor.grid.get():this.get('sizes'),
[398] Fix | Delete
gutter, aligment, auto_h, area, size;
[399] Fix | Delete
if (sizes !== undefined) {
[400] Fix | Delete
for (let points = api.breakpointsReverse,i = points.indexOf(bp); i < points.length; ++i) {
[401] Fix | Delete
let _bp=points[i];
[402] Fix | Delete
gutter??= sizes[_bp + '_gutter'];
[403] Fix | Delete
aligment??= sizes[_bp + '_align'];
[404] Fix | Delete
size??= sizes[_bp + '_size'];
[405] Fix | Delete
auto_h??= sizes[_bp + '_auto_h'];
[406] Fix | Delete
area??= sizes[_bp + '_area'];
[407] Fix | Delete
if (gutter && aligment && size && auto_h && area) {
[408] Fix | Delete
break;
[409] Fix | Delete
}
[410] Fix | Delete
}
[411] Fix | Delete
}
[412] Fix | Delete
[413] Fix | Delete
[414] Fix | Delete
if (size) {
[415] Fix | Delete
size = ThemifyStyles.getColSize(size, false);
[416] Fix | Delete
}
[417] Fix | Delete
if (area) {
[418] Fix | Delete
const sel=this.type==='subrow'?'module_subrow':this.type + '_inner';
[419] Fix | Delete
area = ThemifyStyles.getArea(area, false, bp, api.Utils.getColumns(this.el.tfClass(sel)[0]).length);
[420] Fix | Delete
}
[421] Fix | Delete
aligment??= api.isFullSection === true ? 'center' : 'start';
[422] Fix | Delete
let res = {gutter: gutter, align: aligment, size: size, auto_h: auto_h, area: area};
[423] Fix | Delete
if (type) {
[424] Fix | Delete
res = res[type];
[425] Fix | Delete
}
[426] Fix | Delete
return res;
[427] Fix | Delete
}
[428] Fix | Delete
setSizes(vals, bp) {
[429] Fix | Delete
bp??= api.activeBreakPoint;
[430] Fix | Delete
const isSame=this.isLightboxOpen(),
[431] Fix | Delete
sel=this.type==='subrow'?'module_subrow':this.type + '_inner',
[432] Fix | Delete
inner = this.el.tfClass(sel)[0],
[433] Fix | Delete
count = api.Utils.getColumns(inner).length,
[434] Fix | Delete
sizes =isSame?ThemifyConstructor.grid.get():this.get('sizes');
[435] Fix | Delete
[436] Fix | Delete
for (let k in vals) {
[437] Fix | Delete
if (vals[k] === '') {
[438] Fix | Delete
delete sizes[bp + '_' + k];
[439] Fix | Delete
}
[440] Fix | Delete
else if (vals[k] !== undefined && vals[k] !== null) {
[441] Fix | Delete
if (k === 'gutter') {
[442] Fix | Delete
vals[k] = ThemifyStyles.getGutter(vals[k]);
[443] Fix | Delete
}
[444] Fix | Delete
else if (k === 'size' && vals[k].includes(' ')) {
[445] Fix | Delete
//if there is a grid with the same the size use it instead of custom size(e.g "2.1fr 1fr" will be become to grid 2_1)
[446] Fix | Delete
vals[k] =ThemifyStyles.getColSize(vals[k], false);
[447] Fix | Delete
}
[448] Fix | Delete
sizes[bp + '_' + k] =vals[k].toString().replace(/ +/g, ' ').trim();
[449] Fix | Delete
}
[450] Fix | Delete
}
[451] Fix | Delete
if(count===1){
[452] Fix | Delete
for (let k in sizes) {
[453] Fix | Delete
if(k===(bp+'_size')){
[454] Fix | Delete
sizes[k]='1';
[455] Fix | Delete
}
[456] Fix | Delete
}
[457] Fix | Delete
}
[458] Fix | Delete
if(isSame===true){
[459] Fix | Delete
ThemifyConstructor.grid.set(sizes);
[460] Fix | Delete
}
[461] Fix | Delete
else{
[462] Fix | Delete
this.set('sizes', sizes);
[463] Fix | Delete
}
[464] Fix | Delete
}
[465] Fix | Delete
getGridCss(vals, bp) {
[466] Fix | Delete
const data = {grid: {}};
[467] Fix | Delete
for (let k in vals) {
[468] Fix | Delete
if (k === 'size') {
[469] Fix | Delete
if (vals[k]?.includes(' ')) {
[470] Fix | Delete
vals[k] = ThemifyStyles.getColSize(vals[k], false);
[471] Fix | Delete
}
[472] Fix | Delete
} else if (k === 'gutter') {
[473] Fix | Delete
vals[k] = ThemifyStyles.getGutter(vals[k]);
[474] Fix | Delete
}
[475] Fix | Delete
if (bp !== k.split('_')[0]) {
[476] Fix | Delete
data.grid[bp + '_' + k] = vals[k];
[477] Fix | Delete
} else {
[478] Fix | Delete
data.grid[k] = vals[k];
[479] Fix | Delete
}
[480] Fix | Delete
}
[481] Fix | Delete
return ThemifyStyles.fields.grid.call(ThemifyStyles, 'grid', this.type, {}, data, this.id, null, bp, true);
[482] Fix | Delete
}
[483] Fix | Delete
setCols(vals, bp, update) {
[484] Fix | Delete
bp??=api.activeBreakPoint;
[485] Fix | Delete
if (vals.gutter !== undefined) {
[486] Fix | Delete
vals.gutter = ThemifyStyles.getGutter(vals.gutter);
[487] Fix | Delete
}
[488] Fix | Delete
[489] Fix | Delete
const res = this.getGridCss(vals, bp);
[490] Fix | Delete
if(bp==='desktop' && vals.size?.toString()==='1'){
[491] Fix | Delete
res['--area'] = res['--colg'] = res['--col']=res['--align_items']=res['--align_content']='';
[492] Fix | Delete
}
[493] Fix | Delete
else{
[494] Fix | Delete
if (res['--align_items'] === undefined && vals.auto_h === '-1') {
[495] Fix | Delete
res['--align_items'] = '';
[496] Fix | Delete
}
[497] Fix | Delete
if (res['--colg'] === undefined && vals.gutter === 'gutter') {
[498] Fix | Delete
res['--colg'] = '';
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function