2024-04-15 09:17:29 +00:00
|
|
|
import Theme, { dt } from 'primevue/themes';
|
2023-10-02 10:46:09 +00:00
|
|
|
import { useStyle } from 'primevue/usestyle';
|
2024-02-20 11:44:09 +00:00
|
|
|
import { ObjectUtils } from 'primevue/utils';
|
2023-10-02 10:46:09 +00:00
|
|
|
|
2024-04-15 09:17:29 +00:00
|
|
|
const css = ({ dt }) => `
|
2023-10-02 10:46:09 +00:00
|
|
|
.p-hidden-accessible {
|
|
|
|
border: 0;
|
|
|
|
clip: rect(0 0 0 0);
|
|
|
|
height: 1px;
|
|
|
|
margin: -1px;
|
|
|
|
overflow: hidden;
|
|
|
|
padding: 0;
|
|
|
|
position: absolute;
|
|
|
|
width: 1px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-hidden-accessible input,
|
|
|
|
.p-hidden-accessible select {
|
|
|
|
transform: scale(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
.p-overflow-hidden {
|
|
|
|
overflow: hidden;
|
2024-04-15 09:17:29 +00:00
|
|
|
padding-right: ${dt('scrollbar.width')};
|
2023-10-02 10:46:09 +00:00
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
const classes = {};
|
|
|
|
|
|
|
|
const inlineStyles = {};
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'base',
|
|
|
|
css,
|
|
|
|
classes,
|
|
|
|
inlineStyles,
|
|
|
|
loadStyle(options = {}) {
|
2024-04-15 09:17:29 +00:00
|
|
|
const css = ObjectUtils.getItemValue(this.css, { dt });
|
|
|
|
|
|
|
|
return css ? useStyle(ObjectUtils.minifyCSS(css), { name: this.name, ...options }) : {};
|
2023-10-02 10:46:09 +00:00
|
|
|
},
|
2024-01-02 10:18:28 +00:00
|
|
|
loadTheme(theme, options = {}) {
|
2024-04-16 10:15:21 +00:00
|
|
|
const callbacks = { onMounted: (name) => Theme.onStyleMounted(name), onUpdated: (name) => Theme.onStyleUpdated(name), onLoad: (event, options) => Theme.onStyleLoaded(event, options) };
|
|
|
|
|
|
|
|
return theme ? useStyle(ObjectUtils.minifyCSS(theme), { name: this.name, ...options, ...callbacks }) : {};
|
2024-01-02 10:18:28 +00:00
|
|
|
},
|
2024-03-29 11:25:15 +00:00
|
|
|
getCommonThemeCSS(params) {
|
|
|
|
return Theme.getCommonCSS(this.name, params);
|
2024-03-05 09:22:33 +00:00
|
|
|
},
|
2024-03-29 11:25:15 +00:00
|
|
|
getComponentThemeCSS(params) {
|
|
|
|
return Theme.getComponentCSS(this.name, params);
|
2024-03-05 09:22:33 +00:00
|
|
|
},
|
2024-03-29 11:25:15 +00:00
|
|
|
getDirectiveThemeCSS(params) {
|
|
|
|
return Theme.getDirectiveCSS(this.name, params);
|
2024-03-05 11:59:37 +00:00
|
|
|
},
|
2024-04-01 13:08:53 +00:00
|
|
|
getPresetThemeCSS(preset, selector, params) {
|
|
|
|
return Theme.getPresetCSS(this.name, preset, selector, params);
|
|
|
|
},
|
2024-03-18 10:57:17 +00:00
|
|
|
getLayerOrderThemeCSS() {
|
|
|
|
return Theme.getLayerOrderCSS(this.name);
|
|
|
|
},
|
2023-10-02 10:46:09 +00:00
|
|
|
getStyleSheet(extendedCSS = '', props = {}) {
|
2023-10-04 09:20:15 +00:00
|
|
|
if (this.css) {
|
2024-02-20 11:44:09 +00:00
|
|
|
const _css = ObjectUtils.minifyCSS(`${this.css}${extendedCSS}`);
|
2023-10-04 09:20:15 +00:00
|
|
|
const _props = Object.entries(props)
|
|
|
|
.reduce((acc, [k, v]) => acc.push(`${k}="${v}"`) && acc, [])
|
|
|
|
.join(' ');
|
2023-10-02 10:46:09 +00:00
|
|
|
|
2024-02-20 11:44:09 +00:00
|
|
|
return `<style type="text/css" data-primevue-style-id="${this.name}" ${_props}>${_css}</style>`;
|
2023-10-04 09:20:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return '';
|
2023-10-02 10:46:09 +00:00
|
|
|
},
|
2024-03-29 11:25:15 +00:00
|
|
|
getCommonThemeStyleSheet(params, props = {}) {
|
|
|
|
return Theme.getCommonStyleSheet(this.name, params, props);
|
2024-03-05 09:22:33 +00:00
|
|
|
},
|
2024-03-29 11:25:15 +00:00
|
|
|
getThemeStyleSheet(params, props = {}) {
|
|
|
|
return Theme.getStyleSheet(this.name, params, props);
|
2024-03-05 09:22:33 +00:00
|
|
|
},
|
2023-10-02 10:46:09 +00:00
|
|
|
extend(style) {
|
2023-10-04 09:20:15 +00:00
|
|
|
return { ...this, css: undefined, ...style };
|
2023-10-02 10:46:09 +00:00
|
|
|
}
|
|
|
|
};
|