initial
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,90 @@
|
||||
/**
|
||||
* Nome: Parâmetro de indicadores
|
||||
* Sigla: dashboard_ia
|
||||
* Descrição: Biblioteca compartilhada dos dashboards de indicadores da Diretoria: preferências de usuário (tema), CSS do topbar e toolbar, helpers de tema.
|
||||
*/
|
||||
(function() {
|
||||
var PREF_NS = 'preferences';
|
||||
|
||||
function loadPreferences(login) {
|
||||
try {
|
||||
var raw = vConfigService.getUserConfigAsString(String(login), PREF_NS);
|
||||
if (raw != null && String(raw) !== '') {
|
||||
return JSON.parse(String(raw));
|
||||
}
|
||||
} catch (e) {}
|
||||
return { dark_mode: true };
|
||||
}
|
||||
|
||||
function savePreferences(login, prefs) {
|
||||
try {
|
||||
vConfigService.saveUserConfig(String(login), PREF_NS, JSON.stringify(prefs));
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
function getTheme(engine) {
|
||||
return String(engine.getGlobalVariable('theme') || 'dark');
|
||||
}
|
||||
|
||||
function isLight(engine) {
|
||||
return getTheme(engine) === 'light';
|
||||
}
|
||||
|
||||
function applyTheme(themeName, page, btnTheme) {
|
||||
page.getJavaScript().execute(
|
||||
themeName === 'light'
|
||||
? "document.body.classList.add('theme-light-app');"
|
||||
: "document.body.classList.remove('theme-light-app');"
|
||||
);
|
||||
if (btnTheme != null) {
|
||||
btnTheme.setCaption(themeName === 'dark' ? '☽' : '☀');
|
||||
}
|
||||
}
|
||||
|
||||
function addSharedCss(page) {
|
||||
var style =
|
||||
".dash-topbar { background:#0f1923 !important; border-bottom:1px solid #243447; } " +
|
||||
".dash-topbar .v-button { background:transparent !important; border:1px solid transparent !important; color:#556677 !important; border-radius:4px !important; transition:none !important; } " +
|
||||
".dash-topbar .v-button .v-button-caption { color:#556677 !important; } " +
|
||||
".dash-topbar .v-button.dash-nav-active { background:#1a2733 !important; border-color:#4a9edd !important; } " +
|
||||
".dash-topbar .v-button.dash-nav-active .v-button-caption { color:#4a9edd !important; font-weight:bold !important; } " +
|
||||
".dash-topbar .v-caption { color:#8899aa !important; font-size:10px !important; } " +
|
||||
".dash-topbar input.v-textfield, .dash-topbar .v-datefield-textfield, .dash-topbar input.v-filterselect-input { background:#1a2733 !important; color:#ccc !important; border-color:#243447 !important; } " +
|
||||
".dash-topbar .v-datefield-button { background:#1a2733 !important; border-color:#243447 !important; } " +
|
||||
".dash-topbar .v-select-select { background:#1a2733 !important; color:#ccc !important; border-color:#243447 !important; } " +
|
||||
"body.theme-light-app .dash-topbar { background:#f8fafc !important; border-bottom:1px solid #e2e8f0; } " +
|
||||
"body.theme-light-app .dash-topbar .v-button { color:#475569 !important; } " +
|
||||
"body.theme-light-app .dash-topbar .v-button .v-button-caption { color:#475569 !important; } " +
|
||||
"body.theme-light-app .dash-topbar .v-button.dash-nav-active { background:#dbeafe !important; border-color:#2563eb !important; color:#2563eb !important; } " +
|
||||
"body.theme-light-app .dash-topbar .v-button.dash-nav-active .v-button-caption { color:#2563eb !important; } " +
|
||||
"body.theme-light-app .dash-topbar input.v-textfield, body.theme-light-app .dash-topbar .v-datefield-textfield, body.theme-light-app .dash-topbar input.v-filterselect-input { background:#ffffff !important; color:#334155 !important; border-color:#e2e8f0 !important; } " +
|
||||
"body.theme-light-app .dash-topbar .v-datefield-button { background:#ffffff !important; border-color:#e2e8f0 !important; } " +
|
||||
"body.theme-light-app .dash-topbar .v-select-select { background:#ffffff !important; color:#334155 !important; border-color:#e2e8f0 !important; } " +
|
||||
".theme-light.dash-wrapper { background:#f0f2f5; } " +
|
||||
".theme-light .dash-kpi { background:#ffffff; box-shadow:0 1px 3px rgba(0,0,0,.08); } " +
|
||||
".theme-light .dash-kpi-label { color:#64748b; } " +
|
||||
".theme-light .dash-kpi-value { color:#1e293b; } " +
|
||||
".theme-light .dash-chart-box { background:#ffffff; box-shadow:0 1px 3px rgba(0,0,0,.08); } " +
|
||||
".theme-light .dash-chart-title { color:#64748b; } " +
|
||||
".mov-toolbar { display:flex; align-items:center; gap:8px; margin-bottom:8px; } " +
|
||||
".mov-filter-input { background:#1a2733; border:1px solid #243447; color:#ccc; padding:5px 10px; border-radius:4px; font-size:11px; flex:1; outline:none; font-family:Arial; } " +
|
||||
".mov-filter-input:focus { border-color:#4a9edd; } " +
|
||||
".mov-export-btn { background:#1a2733; border:1px solid #243447; color:#8899aa; padding:5px 12px; border-radius:4px; font-size:11px; cursor:pointer; white-space:nowrap; font-family:Arial; } " +
|
||||
".mov-export-btn:hover { border-color:#4a9edd; color:#4a9edd; } " +
|
||||
".theme-light .mov-filter-input { background:#ffffff; border-color:#e2e8f0; color:#334155; } " +
|
||||
".theme-light .mov-filter-input:focus { border-color:#2563eb; } " +
|
||||
".theme-light .mov-export-btn { background:#ffffff; border-color:#e2e8f0; color:#64748b; } " +
|
||||
".theme-light .mov-export-btn:hover { border-color:#2563eb; color:#2563eb; } ";
|
||||
|
||||
page.getStyles().add(style);
|
||||
}
|
||||
|
||||
return {
|
||||
loadPreferences: loadPreferences,
|
||||
savePreferences: savePreferences,
|
||||
getTheme: getTheme,
|
||||
isLight: isLight,
|
||||
applyTheme: applyTheme,
|
||||
addSharedCss: addSharedCss
|
||||
};
|
||||
})()
|
||||
Reference in New Issue
Block a user