UNPKG

pivot-chart

Version:

pivot table react component

68 lines 1.63 kB
var THEME_CONFIG = { root: { display: true, label: 'All' }, summary: { label: '(total)' }, table: { highlightBGColor: '#fff0f6', thead: { backgroundColor: '#E9EDF2', color: '#5A6C84' }, borderColor: '#DFE3E8', color: '#333333' } }; function deepMerge(origin, changes) { for (var key in changes) { // todo: array if (origin[key] instanceof Function) { origin[key] = changes[key]; } else if (origin[key] instanceof Object) { origin[key] = deepMerge(origin[key], changes[key]); } else { origin[key] = changes[key]; } } return origin; } function getInitTheme() { return { root: { display: true, label: 'All' }, summary: { label: '(total)' }, table: { highlightBGColor: '#fff0f6', thead: { backgroundColor: '#E9EDF2', color: '#5A6C84' }, borderColor: '#DFE3E8', color: '#333333' } }; } export function registerTheme(config) { var initTheme = getInitTheme(); if (typeof config === 'undefined') return initTheme; var mergedConfig = deepMerge(initTheme, config); for (var key in config) { if (THEME_CONFIG[key]) { THEME_CONFIG[key] = deepMerge(THEME_CONFIG[key], mergedConfig[key]); } } } export function getTheme() { return THEME_CONFIG; } //# sourceMappingURL=theme.js.map