This commit is contained in:
2025-12-03 00:15:33 +02:00
parent 82272f2090
commit 2b3b56179a
3 changed files with 30 additions and 44 deletions
+17 -21
View File
@@ -70,34 +70,26 @@ export class Render {
});
}
if (node['hide-toolbar'] != 1) {
if (node.title || node.descr || node?.children?.toolbar) {
let topBar = El('div', { className: 'top-bar' });
content.append(topBar);
if (node.title || node.descr || (node.children && node.children.toolbar)) {
let topBarInner = El('div', { className: 'top-bar-inner' });
topBar.append(topBarInner);
const topBarInner = content.appendChild(El('div', { className: 'top-bar' }))
.appendChild(El('div', { className: 'top-bar-inner'}) );
if (node.title || node.descr) {
let titleWrapper = topBarInner.appendChild(El('div', { className: 'title-wrapper' }));
const titleWrapper = topBarInner.appendChild(El('div', { className: 'title-wrapper' }));
if (node.title) {
titleWrapper.append( El('h2', { className: 'title' }, Ut.tplString(node.title, node.template) ));
node.title && titleWrapper.append( El('h2', { className: 'title' }, Ut.tplString(node.title, node.template) ));
node.descr && titleWrapper.append( El('p', { className: 'descr' }, Ut.tplString(node.descr, node.template)) );
}
if (node.descr) {
titleWrapper.append( El('p', { className: 'descr' }, Ut.tplString(node.descr, node.template)) );
}
}
if (node.children && node.children.toolbar) {
Render.makeUiElements(Ut.objVal(node.children.toolbar).children, topBarInner.appendChild(El('div', { className: 'ml10 flex v-center no-shrink' })) );
}
if (node?.children?.toolbar) {
Render.makeUiElements(
Ut.objVal(node.children.toolbar).children,
topBarInner.appendChild(
El('div', { className: 'ml10 flex v-center no-shrink' })
)
);
}
}
@@ -137,6 +129,10 @@ export class Render {
block.dataset.title = Ut.tplString(node.title, node.template);
}
if (node.descr) {
block.dataset.descr = Ut.tplString(node.descr, node.template);
}
if (node.type) {
block.dataset.type = node.type;
}
+1 -1
View File
@@ -1020,7 +1020,7 @@
case 'textarea':
target.value = Ut.decode(val);
target.value = Ut.unescape(val);
const autoexpand = domUtils.data.call(target, 'autoexpand');
+7 -17
View File
@@ -86,10 +86,11 @@ export class Popup {
}, null)
};
this.card.toolbar = this.card.ui.dxFind('.top-bar-inner');
this.target.classList.add('popup-container');
this.card.container = this.card.ui.dxFind('.container');
this.target.classList.add('popup-container');
this.card.toolbar = this.card.ui.dxFind('.top-bar-inner');
this.card.container.append(this.target);
@@ -177,35 +178,24 @@ export class Popup {
*/
setEvents() {
let that = this;
if (this.opts.scrollBar) {
let tm = null;
window.dxOn('resize.popup' + this.ekey + ' orientationchange.popup' + this.ekey, function() {
window.dxOn('resize.popup' + this.ekey + ' orientationchange.popup' + this.ekey, (_, t) => {
if (tm) {
clearTimeout(tm);
tm = null;
}
tm = setTimeout(function() {
that.resize();
}, 300);
tm = setTimeout(_ => t.resize(), 300);
});
}
this.card.toolbar.dxOn('click', '.ic-close', function() {
that.destroy();
});
this.card.toolbar?.dxOn('click', '.ic-close', _ => this.destroy() );
document.dxOn('keyup.popup' + this.ekey, function(e) {
if (e.key == 'Escape') {
that.destroy();
}
});
document.dxOn('keyup.popup' + this.ekey, e => e.key == 'Escape' && this.destroy() );
}
/**