From 7ccad8ed3d42b3cad5142d7843f33f909138dac9 Mon Sep 17 00:00:00 2001 From: Mert Sincan Date: Tue, 24 Sep 2024 09:46:58 +0100 Subject: [PATCH] Update BaseStyle.js --- packages/core/src/base/style/BaseStyle.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/core/src/base/style/BaseStyle.js b/packages/core/src/base/style/BaseStyle.js index c6bc964e72..a783238e14 100644 --- a/packages/core/src/base/style/BaseStyle.js +++ b/packages/core/src/base/style/BaseStyle.js @@ -1,5 +1,5 @@ import { Theme, dt } from '@primeuix/styled'; -import { minifyCSS, resolve } from '@primeuix/utils/object'; +import { isNotEmpty, minifyCSS, resolve } from '@primeuix/utils/object'; import { useStyle } from '@primevue/core/usestyle'; const theme = ({ dt }) => ` @@ -159,13 +159,13 @@ export default { load(style, options = {}, transform = (cs) => cs) { const computedStyle = transform(resolve(style, { dt })); - return computedStyle ? useStyle(minifyCSS(computedStyle), { name: this.name, ...options }) : {}; + return isNotEmpty(computedStyle) ? useStyle(minifyCSS(computedStyle), { name: this.name, ...options }) : {}; }, loadCSS(options = {}) { return this.load(this.css, options); }, loadTheme(options = {}, style = '') { - return this.load(this.theme, options, (computedStyle) => Theme.transformCSS(options.name || this.name, `${computedStyle}${style}`)); + return this.load(this.theme, options, (computedStyle = '') => Theme.transformCSS(options.name || this.name, `${computedStyle}${style}`)); }, getCommonTheme(params) { return Theme.getCommon(this.name, params); @@ -184,13 +184,13 @@ export default { }, getStyleSheet(extendedCSS = '', props = {}) { if (this.css) { - const _css = resolve(this.css, { dt }); + const _css = resolve(this.css, { dt }) || ''; const _style = minifyCSS(`${_css}${extendedCSS}`); const _props = Object.entries(props) .reduce((acc, [k, v]) => acc.push(`${k}="${v}"`) && acc, []) .join(' '); - return ``; + return isNotEmpty(_style) ? `` : ''; } return ''; @@ -209,7 +209,7 @@ export default { .reduce((acc, [k, v]) => acc.push(`${k}="${v}"`) && acc, []) .join(' '); - css.push(``); + isNotEmpty(_style) && css.push(``); } return css.join('');