From 877d6c07df9c870132ee092448f052fe02aff313 Mon Sep 17 00:00:00 2001 From: mertsincan Date: Wed, 4 Oct 2023 10:20:15 +0100 Subject: [PATCH] Refactor #4530 --- components/lib/base/style/BaseStyle.js | 16 ++++++++++------ components/lib/button/style/ButtonStyle.js | 3 +-- components/lib/card/style/CardStyle.js | 3 +-- components/lib/checkbox/style/CheckboxStyle.js | 3 +-- .../confirmdialog/style/ConfirmDialogStyle.js | 3 +-- components/lib/dataview/style/DataViewStyle.js | 3 +-- .../style/DataViewLayoutOptionsStyle.js | 3 +-- components/lib/inputmask/style/InputMaskStyle.js | 3 +-- components/lib/inputtext/style/InputTextStyle.js | 3 +-- .../lib/radiobutton/style/RadioButtonStyle.js | 3 +-- .../lib/selectbutton/style/SelectButtonStyle.js | 3 +-- .../lib/togglebutton/style/ToggleButtonStyle.js | 3 +-- .../style/TriStateCheckboxStyle.js | 3 +-- 13 files changed, 22 insertions(+), 30 deletions(-) diff --git a/components/lib/base/style/BaseStyle.js b/components/lib/base/style/BaseStyle.js index 176689d49..a1e73d0db 100644 --- a/components/lib/base/style/BaseStyle.js +++ b/components/lib/base/style/BaseStyle.js @@ -33,16 +33,20 @@ export default { classes, inlineStyles, loadStyle(options = {}) { - return useStyle(this.css, { name: this.name, ...options }); + return this.css ? useStyle(this.css, { name: this.name, ...options }) : {}; }, getStyleSheet(extendedCSS = '', props = {}) { - const _props = Object.entries(props) - .reduce((acc, [k, v]) => acc.push(`${k}="${v}"`) && acc, []) - .join(' '); + if (this.css) { + const _props = Object.entries(props) + .reduce((acc, [k, v]) => acc.push(`${k}="${v}"`) && acc, []) + .join(' '); - return ``; + return ``; + } + + return ''; }, extend(style) { - return { ...this, ...style }; + return { ...this, css: undefined, ...style }; } }; diff --git a/components/lib/button/style/ButtonStyle.js b/components/lib/button/style/ButtonStyle.js index 7176adba3..a52cfc8af 100644 --- a/components/lib/button/style/ButtonStyle.js +++ b/components/lib/button/style/ButtonStyle.js @@ -35,6 +35,5 @@ const classes = { export default BaseStyle.extend({ name: 'button', - classes, - loadStyle: () => {} + classes }); diff --git a/components/lib/card/style/CardStyle.js b/components/lib/card/style/CardStyle.js index f0dfcfd86..0a3c98982 100644 --- a/components/lib/card/style/CardStyle.js +++ b/components/lib/card/style/CardStyle.js @@ -12,6 +12,5 @@ const classes = { export default BaseStyle.extend({ name: 'card', - classes, - loadStyle: () => {} + classes }); diff --git a/components/lib/checkbox/style/CheckboxStyle.js b/components/lib/checkbox/style/CheckboxStyle.js index c65e9fa48..10e698aaa 100644 --- a/components/lib/checkbox/style/CheckboxStyle.js +++ b/components/lib/checkbox/style/CheckboxStyle.js @@ -22,6 +22,5 @@ const classes = { export default BaseStyle.extend({ name: 'checkbox', - classes, - loadStyle: () => {} + classes }); diff --git a/components/lib/confirmdialog/style/ConfirmDialogStyle.js b/components/lib/confirmdialog/style/ConfirmDialogStyle.js index 19bb012db..d42fc578f 100644 --- a/components/lib/confirmdialog/style/ConfirmDialogStyle.js +++ b/components/lib/confirmdialog/style/ConfirmDialogStyle.js @@ -10,6 +10,5 @@ const classes = { export default BaseStyle.extend({ name: 'confirmdialog', - classes, - loadStyle: () => {} + classes }); diff --git a/components/lib/dataview/style/DataViewStyle.js b/components/lib/dataview/style/DataViewStyle.js index eaebd1ca8..9e843b398 100644 --- a/components/lib/dataview/style/DataViewStyle.js +++ b/components/lib/dataview/style/DataViewStyle.js @@ -19,6 +19,5 @@ const classes = { export default BaseStyle.extend({ name: 'dataview', - classes, - loadStyle: () => {} + classes }); diff --git a/components/lib/dataviewlayoutoptions/style/DataViewLayoutOptionsStyle.js b/components/lib/dataviewlayoutoptions/style/DataViewLayoutOptionsStyle.js index 222dcc074..9e2348984 100644 --- a/components/lib/dataviewlayoutoptions/style/DataViewLayoutOptionsStyle.js +++ b/components/lib/dataviewlayoutoptions/style/DataViewLayoutOptionsStyle.js @@ -18,6 +18,5 @@ const classes = { export default BaseStyle.extend({ name: 'dataviewlayoutoptions', - classes, - loadStyle: () => {} + classes }); diff --git a/components/lib/inputmask/style/InputMaskStyle.js b/components/lib/inputmask/style/InputMaskStyle.js index 6ee2dd37c..d9c27984b 100644 --- a/components/lib/inputmask/style/InputMaskStyle.js +++ b/components/lib/inputmask/style/InputMaskStyle.js @@ -11,6 +11,5 @@ const classes = { export default BaseStyle.extend({ name: 'inputmask', - classes, - loadStyle: () => {} + classes }); diff --git a/components/lib/inputtext/style/InputTextStyle.js b/components/lib/inputtext/style/InputTextStyle.js index c55acf520..efb5fba3f 100644 --- a/components/lib/inputtext/style/InputTextStyle.js +++ b/components/lib/inputtext/style/InputTextStyle.js @@ -13,6 +13,5 @@ const classes = { export default BaseStyle.extend({ name: 'inputtext', - classes, - loadStyle: () => {} + classes }); diff --git a/components/lib/radiobutton/style/RadioButtonStyle.js b/components/lib/radiobutton/style/RadioButtonStyle.js index ee0ae090f..3ed107f24 100644 --- a/components/lib/radiobutton/style/RadioButtonStyle.js +++ b/components/lib/radiobutton/style/RadioButtonStyle.js @@ -22,6 +22,5 @@ const classes = { export default BaseStyle.extend({ name: 'radiobutton', - classes, - loadStyle: () => {} + classes }); diff --git a/components/lib/selectbutton/style/SelectButtonStyle.js b/components/lib/selectbutton/style/SelectButtonStyle.js index 7de7e2172..a02305a1c 100644 --- a/components/lib/selectbutton/style/SelectButtonStyle.js +++ b/components/lib/selectbutton/style/SelectButtonStyle.js @@ -14,6 +14,5 @@ const classes = { export default BaseStyle.extend({ name: 'selectbutton', - classes, - loadStyle: () => {} + classes }); diff --git a/components/lib/togglebutton/style/ToggleButtonStyle.js b/components/lib/togglebutton/style/ToggleButtonStyle.js index 89df66a50..f52bd08b0 100644 --- a/components/lib/togglebutton/style/ToggleButtonStyle.js +++ b/components/lib/togglebutton/style/ToggleButtonStyle.js @@ -22,6 +22,5 @@ const classes = { export default BaseStyle.extend({ name: 'accordion', - classes, - loadStyle: () => {} + classes }); diff --git a/components/lib/tristatecheckbox/style/TriStateCheckboxStyle.js b/components/lib/tristatecheckbox/style/TriStateCheckboxStyle.js index a063c8cc8..364dd6caa 100644 --- a/components/lib/tristatecheckbox/style/TriStateCheckboxStyle.js +++ b/components/lib/tristatecheckbox/style/TriStateCheckboxStyle.js @@ -24,6 +24,5 @@ const classes = { export default BaseStyle.extend({ name: 'tristatecheckbox', - classes, - loadStyle: () => {} + classes });