From 2b3b56179ad21e0bac2a8a3b4397b0f0413eb0a7 Mon Sep 17 00:00:00 2001 From: grainsoft Date: Wed, 3 Dec 2025 00:15:33 +0200 Subject: [PATCH] updates --- src/core/Render.js | 46 +++++++++++++++++--------------------- src/utils/dom.js | 2 +- src/widgets/popup/Popup.js | 26 +++++++-------------- 3 files changed, 30 insertions(+), 44 deletions(-) diff --git a/src/core/Render.js b/src/core/Render.js index fcf23f4..7239488 100644 --- a/src/core/Render.js +++ b/src/core/Render.js @@ -69,35 +69,27 @@ export class Render { content?.dxFind('[data-group]:not(.hide)')?.dxFadeOut(_ => content?.dxFind('[data-group="'+ t.dataset.id +'"]')?.dxFadeIn()); }); } + + if (node.title || node.descr || node?.children?.toolbar) { - if (node['hide-toolbar'] != 1) { + const topBarInner = content.appendChild(El('div', { className: 'top-bar' })) + .appendChild(El('div', { className: 'top-bar-inner'}) ); - let topBar = El('div', { className: 'top-bar' }); + if (node.title || node.descr) { + + const titleWrapper = topBarInner.appendChild(El('div', { className: 'title-wrapper' })); - content.append(topBar); + 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.title || node.descr || (node.children && node.children.toolbar)) { - - let topBarInner = El('div', { className: 'top-bar-inner' }); - - topBar.append(topBarInner); - - if (node.title || node.descr) { - - let titleWrapper = topBarInner.appendChild(El('div', { className: 'title-wrapper' })); - - if (node.title) { - titleWrapper.append( El('h2', { className: 'title' }, Ut.tplString(node.title, 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; } diff --git a/src/utils/dom.js b/src/utils/dom.js index e31dfd5..8be9a6f 100644 --- a/src/utils/dom.js +++ b/src/utils/dom.js @@ -1020,7 +1020,7 @@ case 'textarea': - target.value = Ut.decode(val); + target.value = Ut.unescape(val); const autoexpand = domUtils.data.call(target, 'autoexpand'); diff --git a/src/widgets/popup/Popup.js b/src/widgets/popup/Popup.js index ed56555..6aaa11d 100644 --- a/src/widgets/popup/Popup.js +++ b/src/widgets/popup/Popup.js @@ -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() ); } /**