Add new theme-palette-change event
parent
be0092f0b4
commit
e8c9384c8d
|
@ -165,7 +165,7 @@ import EventBus from '@/layouts/AppEventBus';
|
|||
import { NodeService } from '@/service/NodeService';
|
||||
|
||||
export default {
|
||||
darkModeToggleListener: null,
|
||||
redrawListener: null,
|
||||
data() {
|
||||
return {
|
||||
value1: 24,
|
||||
|
@ -212,17 +212,20 @@ export default {
|
|||
};
|
||||
},
|
||||
beforeUnmount() {
|
||||
EventBus.off('dark-mode-toggle-complete', this.darkModeToggleListener);
|
||||
EventBus.off('dark-mode-toggle-complete', this.redrawListener);
|
||||
EventBus.off('theme-palette-change', this.redrawListener);
|
||||
},
|
||||
mounted() {
|
||||
this.chartData = this.setChartData();
|
||||
this.chartOptions = this.setChartOptions();
|
||||
|
||||
this.darkModeToggleListener = () => {
|
||||
this.redrawListener = () => {
|
||||
this.chartData = this.setChartData();
|
||||
this.chartOptions = this.setChartOptions();
|
||||
};
|
||||
|
||||
EventBus.on('dark-mode-toggle-complete', this.darkModeToggleListener);
|
||||
EventBus.on('dark-mode-toggle-complete', this.redrawListener);
|
||||
EventBus.on('theme-palette-change', this.redrawListener);
|
||||
|
||||
NodeService.getTreeNodes().then((data) => (this.nodes = data));
|
||||
},
|
||||
|
@ -231,6 +234,9 @@ export default {
|
|||
this.category = category;
|
||||
},
|
||||
setChartData() {
|
||||
const documentStyle = getComputedStyle(document.documentElement);
|
||||
const primaryColor = documentStyle.getPropertyValue('--primary-color');
|
||||
|
||||
return {
|
||||
labels: ['Q1', 'Q2', 'Q3', 'Q4'],
|
||||
datasets: [
|
||||
|
@ -238,9 +244,9 @@ export default {
|
|||
label: 'Annual Income',
|
||||
data: [40, 59, 40, 50, 56],
|
||||
fill: true,
|
||||
borderColor: '#10b981',
|
||||
borderColor: primaryColor,
|
||||
tension: 0.4,
|
||||
backgroundColor: 'rgba(16, 185, 129, .2)'
|
||||
backgroundColor: `color-mix(in srgb, ${primaryColor}, transparent 80%)`
|
||||
}
|
||||
]
|
||||
};
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
import EventBus from '@/layouts/AppEventBus';
|
||||
|
||||
export default {
|
||||
darkModeToggleListener: null,
|
||||
redrawListener: null,
|
||||
data() {
|
||||
return {
|
||||
chartData: null,
|
||||
|
@ -170,17 +170,19 @@ const setChartOptions = () => {
|
|||
};
|
||||
},
|
||||
beforeUnmount() {
|
||||
EventBus.off('dark-mode-toggle-complete', this.darkModeToggleListener);
|
||||
EventBus.off('dark-mode-toggle-complete', this.redrawListener);
|
||||
EventBus.off('theme-palette-change', this.redrawListener);
|
||||
},
|
||||
mounted() {
|
||||
this.chartData = this.setChartData();
|
||||
this.chartOptions = this.setChartOptions();
|
||||
|
||||
this.darkModeToggleListener = () => {
|
||||
this.redrawListener = () => {
|
||||
this.chartOptions = this.setChartOptions();
|
||||
};
|
||||
|
||||
EventBus.on('dark-mode-toggle-complete', this.darkModeToggleListener);
|
||||
EventBus.on('theme-palette-change', this.redrawListener);
|
||||
EventBus.on('dark-mode-toggle-complete', this.redrawListener);
|
||||
},
|
||||
methods: {
|
||||
setChartData() {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
import EventBus from '@/layouts/AppEventBus';
|
||||
|
||||
export default {
|
||||
darkModeToggleListener: null,
|
||||
redrawListener: null,
|
||||
data() {
|
||||
return {
|
||||
chartData: null,
|
||||
|
@ -205,17 +205,19 @@ const setChartOptions = () => {
|
|||
};
|
||||
},
|
||||
beforeUnmount() {
|
||||
EventBus.off('dark-mode-toggle-complete', this.darkModeToggleListener);
|
||||
EventBus.off('dark-mode-toggle-complete', this.redrawListener);
|
||||
EventBus.off('theme-palette-change', this.redrawListener);
|
||||
},
|
||||
mounted() {
|
||||
this.chartData = this.setChartData();
|
||||
this.chartOptions = this.setChartOptions();
|
||||
|
||||
this.darkModeToggleListener = () => {
|
||||
this.redrawListener = () => {
|
||||
this.chartOptions = this.setChartOptions();
|
||||
};
|
||||
|
||||
EventBus.on('dark-mode-toggle-complete', this.darkModeToggleListener);
|
||||
EventBus.on('theme-palette-change', this.redrawListener);
|
||||
EventBus.on('dark-mode-toggle-complete', this.redrawListener);
|
||||
},
|
||||
methods: {
|
||||
setChartData() {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
import EventBus from '@/layouts/AppEventBus';
|
||||
|
||||
export default {
|
||||
darkModeToggleListener: null,
|
||||
redrawListener: null,
|
||||
data() {
|
||||
return {
|
||||
chartData: null,
|
||||
|
@ -130,17 +130,19 @@ const setChartOptions = () => {
|
|||
};
|
||||
},
|
||||
beforeUnmount() {
|
||||
EventBus.off('dark-mode-toggle-complete', this.darkModeToggleListener);
|
||||
EventBus.off('dark-mode-toggle-complete', this.redrawListener);
|
||||
EventBus.off('theme-palette-change', this.redrawListener);
|
||||
},
|
||||
mounted() {
|
||||
this.chartData = this.setChartData();
|
||||
this.chartOptions = this.setChartOptions();
|
||||
|
||||
this.darkModeToggleListener = () => {
|
||||
this.redrawListener = () => {
|
||||
this.chartOptions = this.setChartOptions();
|
||||
};
|
||||
|
||||
EventBus.on('dark-mode-toggle-complete', this.darkModeToggleListener);
|
||||
EventBus.on('theme-palette-change', this.redrawListener);
|
||||
EventBus.on('dark-mode-toggle-complete', this.redrawListener);
|
||||
},
|
||||
methods: {
|
||||
setChartData() {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
import EventBus from '@/layouts/AppEventBus';
|
||||
|
||||
export default {
|
||||
darkModeToggleListener: null,
|
||||
redrawListener: null,
|
||||
data() {
|
||||
return {
|
||||
chartData: null,
|
||||
|
@ -195,17 +195,19 @@ const setChartOptions = () => {
|
|||
};
|
||||
},
|
||||
beforeUnmount() {
|
||||
EventBus.off('dark-mode-toggle-complete', this.darkModeToggleListener);
|
||||
EventBus.off('dark-mode-toggle-complete', this.redrawListener);
|
||||
EventBus.off('theme-palette-change', this.redrawListener);
|
||||
},
|
||||
mounted() {
|
||||
this.chartData = this.setChartData();
|
||||
this.chartOptions = this.setChartOptions();
|
||||
|
||||
this.darkModeToggleListener = () => {
|
||||
this.redrawListener = () => {
|
||||
this.chartOptions = this.setChartOptions();
|
||||
};
|
||||
|
||||
EventBus.on('dark-mode-toggle-complete', this.darkModeToggleListener);
|
||||
EventBus.on('theme-palette-change', this.redrawListener);
|
||||
EventBus.on('dark-mode-toggle-complete', this.redrawListener);
|
||||
},
|
||||
methods: {
|
||||
setChartData() {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
import EventBus from '@/layouts/AppEventBus';
|
||||
|
||||
export default {
|
||||
darkModeToggleListener: null,
|
||||
redrawListener: null,
|
||||
data() {
|
||||
return {
|
||||
chartData: null,
|
||||
|
@ -187,17 +187,19 @@ const setChartOptions = () => {
|
|||
};
|
||||
},
|
||||
beforeUnmount() {
|
||||
EventBus.off('dark-mode-toggle-complete', this.darkModeToggleListener);
|
||||
EventBus.off('dark-mode-toggle-complete', this.redrawListener);
|
||||
EventBus.off('theme-palette-change', this.redrawListener);
|
||||
},
|
||||
mounted() {
|
||||
this.chartData = this.setChartData();
|
||||
this.chartOptions = this.setChartOptions();
|
||||
|
||||
this.darkModeToggleListener = () => {
|
||||
this.redrawListener = () => {
|
||||
this.chartOptions = this.setChartOptions();
|
||||
};
|
||||
|
||||
EventBus.on('dark-mode-toggle-complete', this.darkModeToggleListener);
|
||||
EventBus.on('theme-palette-change', this.redrawListener);
|
||||
EventBus.on('dark-mode-toggle-complete', this.redrawListener);
|
||||
},
|
||||
methods: {
|
||||
setChartData() {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
import EventBus from '@/layouts/AppEventBus';
|
||||
|
||||
export default {
|
||||
darkModeToggleListener: null,
|
||||
redrawListener: null,
|
||||
data() {
|
||||
return {
|
||||
chartData: null,
|
||||
|
@ -205,17 +205,19 @@ const setChartOptions = () => {
|
|||
};
|
||||
},
|
||||
beforeUnmount() {
|
||||
EventBus.off('dark-mode-toggle-complete', this.darkModeToggleListener);
|
||||
EventBus.off('dark-mode-toggle-complete', this.redrawListener);
|
||||
EventBus.off('theme-palette-change', this.redrawListener);
|
||||
},
|
||||
mounted() {
|
||||
this.chartData = this.setChartData();
|
||||
this.chartOptions = this.setChartOptions();
|
||||
|
||||
this.darkModeToggleListener = () => {
|
||||
this.redrawListener = () => {
|
||||
this.chartOptions = this.setChartOptions();
|
||||
};
|
||||
|
||||
EventBus.on('dark-mode-toggle-complete', this.darkModeToggleListener);
|
||||
EventBus.on('theme-palette-change', this.redrawListener);
|
||||
EventBus.on('dark-mode-toggle-complete', this.redrawListener);
|
||||
},
|
||||
methods: {
|
||||
setChartData() {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
import EventBus from '@/layouts/AppEventBus';
|
||||
|
||||
export default {
|
||||
darkModeToggleListener: null,
|
||||
redrawListener: null,
|
||||
data() {
|
||||
return {
|
||||
chartData: null,
|
||||
|
@ -223,17 +223,19 @@ const setChartOptions = () => {
|
|||
};
|
||||
},
|
||||
beforeUnmount() {
|
||||
EventBus.off('dark-mode-toggle-complete', this.darkModeToggleListener);
|
||||
EventBus.off('dark-mode-toggle-complete', this.redrawListener);
|
||||
EventBus.off('theme-palette-change', this.redrawListener);
|
||||
},
|
||||
mounted() {
|
||||
this.chartData = this.setChartData();
|
||||
this.chartOptions = this.setChartOptions();
|
||||
|
||||
this.darkModeToggleListener = () => {
|
||||
this.redrawListener = () => {
|
||||
this.chartOptions = this.setChartOptions();
|
||||
};
|
||||
|
||||
EventBus.on('dark-mode-toggle-complete', this.darkModeToggleListener);
|
||||
EventBus.on('theme-palette-change', this.redrawListener);
|
||||
EventBus.on('dark-mode-toggle-complete', this.redrawListener);
|
||||
},
|
||||
methods: {
|
||||
setChartData() {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
import EventBus from '@/layouts/AppEventBus';
|
||||
|
||||
export default {
|
||||
darkModeToggleListener: null,
|
||||
redrawListener: null,
|
||||
data() {
|
||||
return {
|
||||
chartData: null,
|
||||
|
@ -128,17 +128,19 @@ const setChartOptions = () => {
|
|||
};
|
||||
},
|
||||
beforeUnmount() {
|
||||
EventBus.off('dark-mode-toggle-complete', this.darkModeToggleListener);
|
||||
EventBus.off('dark-mode-toggle-complete', this.redrawListener);
|
||||
EventBus.off('theme-palette-change', this.redrawListener);
|
||||
},
|
||||
mounted() {
|
||||
this.chartData = this.setChartData();
|
||||
this.chartOptions = this.setChartOptions();
|
||||
|
||||
this.darkModeToggleListener = () => {
|
||||
this.redrawListener = () => {
|
||||
this.chartOptions = this.setChartOptions();
|
||||
};
|
||||
|
||||
EventBus.on('dark-mode-toggle-complete', this.darkModeToggleListener);
|
||||
EventBus.on('theme-palette-change', this.redrawListener);
|
||||
EventBus.on('dark-mode-toggle-complete', this.redrawListener);
|
||||
},
|
||||
methods: {
|
||||
setChartData() {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
import EventBus from '@/layouts/AppEventBus';
|
||||
|
||||
export default {
|
||||
darkModeToggleListener: null,
|
||||
redrawListener: null,
|
||||
data() {
|
||||
return {
|
||||
chartData: null,
|
||||
|
@ -153,17 +153,19 @@ const setChartOptions = () => {
|
|||
};
|
||||
},
|
||||
beforeUnmount() {
|
||||
EventBus.off('dark-mode-toggle-complete', this.darkModeToggleListener);
|
||||
EventBus.off('dark-mode-toggle-complete', this.redrawListener);
|
||||
EventBus.off('theme-palette-change', this.redrawListener);
|
||||
},
|
||||
mounted() {
|
||||
this.chartData = this.setChartData();
|
||||
this.chartOptions = this.setChartOptions();
|
||||
|
||||
this.darkModeToggleListener = () => {
|
||||
this.redrawListener = () => {
|
||||
this.chartOptions = this.setChartOptions();
|
||||
};
|
||||
|
||||
EventBus.on('dark-mode-toggle-complete', this.darkModeToggleListener);
|
||||
EventBus.on('theme-palette-change', this.redrawListener);
|
||||
EventBus.on('dark-mode-toggle-complete', this.redrawListener);
|
||||
},
|
||||
methods: {
|
||||
setChartData() {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
import EventBus from '@/layouts/AppEventBus';
|
||||
|
||||
export default {
|
||||
darkModeToggleListener: null,
|
||||
redrawListener: null,
|
||||
data() {
|
||||
return {
|
||||
chartData: null,
|
||||
|
@ -169,17 +169,19 @@ const setChartOptions = () => {
|
|||
};
|
||||
},
|
||||
beforeUnmount() {
|
||||
EventBus.off('dark-mode-toggle-complete', this.darkModeToggleListener);
|
||||
EventBus.off('dark-mode-toggle-complete', this.redrawListener);
|
||||
EventBus.off('theme-palette-change', this.redrawListener);
|
||||
},
|
||||
mounted() {
|
||||
this.chartData = this.setChartData();
|
||||
this.chartOptions = this.setChartOptions();
|
||||
|
||||
this.darkModeToggleListener = () => {
|
||||
this.redrawListener = () => {
|
||||
this.chartOptions = this.setChartOptions();
|
||||
};
|
||||
|
||||
EventBus.on('dark-mode-toggle-complete', this.darkModeToggleListener);
|
||||
EventBus.on('theme-palette-change', this.redrawListener);
|
||||
EventBus.on('dark-mode-toggle-complete', this.redrawListener);
|
||||
},
|
||||
methods: {
|
||||
setChartData() {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
import EventBus from '@/layouts/AppEventBus';
|
||||
|
||||
export default {
|
||||
darkModeToggleListener: null,
|
||||
redrawListener: null,
|
||||
data() {
|
||||
return {
|
||||
chartData: null,
|
||||
|
@ -207,17 +207,19 @@ const setChartOptions = () => {
|
|||
};
|
||||
},
|
||||
beforeUnmount() {
|
||||
EventBus.off('dark-mode-toggle-complete', this.darkModeToggleListener);
|
||||
EventBus.off('dark-mode-toggle-complete', this.redrawListener);
|
||||
EventBus.off('theme-palette-change', this.redrawListener);
|
||||
},
|
||||
mounted() {
|
||||
this.chartData = this.setChartData();
|
||||
this.chartOptions = this.setChartOptions();
|
||||
|
||||
this.darkModeToggleListener = () => {
|
||||
this.redrawListener = () => {
|
||||
this.chartOptions = this.setChartOptions();
|
||||
};
|
||||
|
||||
EventBus.on('dark-mode-toggle-complete', this.darkModeToggleListener);
|
||||
EventBus.on('theme-palette-change', this.redrawListener);
|
||||
EventBus.on('dark-mode-toggle-complete', this.redrawListener);
|
||||
},
|
||||
methods: {
|
||||
setChartData() {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
import EventBus from '@/layouts/AppEventBus';
|
||||
|
||||
export default {
|
||||
darkModeToggleListener: null,
|
||||
redrawListener: null,
|
||||
data() {
|
||||
return {
|
||||
chartData: null,
|
||||
|
@ -193,17 +193,19 @@ const setChartOptions = () => {
|
|||
};
|
||||
},
|
||||
beforeUnmount() {
|
||||
EventBus.off('dark-mode-toggle-complete', this.darkModeToggleListener);
|
||||
EventBus.off('dark-mode-toggle-complete', this.redrawListener);
|
||||
EventBus.off('theme-palette-change', this.redrawListener);
|
||||
},
|
||||
mounted() {
|
||||
this.chartData = this.setChartData();
|
||||
this.chartOptions = this.setChartOptions();
|
||||
|
||||
this.darkModeToggleListener = () => {
|
||||
this.redrawListener = () => {
|
||||
this.chartOptions = this.setChartOptions();
|
||||
};
|
||||
|
||||
EventBus.on('dark-mode-toggle-complete', this.darkModeToggleListener);
|
||||
EventBus.on('theme-palette-change', this.redrawListener);
|
||||
EventBus.on('dark-mode-toggle-complete', this.redrawListener);
|
||||
},
|
||||
methods: {
|
||||
setChartData() {
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import EventBus from '@/layouts/AppEventBus';
|
||||
import { updatePreset, updateSurface } from 'primevue/themes';
|
||||
|
||||
export default {
|
||||
|
@ -94,7 +95,7 @@ export default {
|
|||
else if (type === 'surface') this.selectedSurfaceColor = color.name;
|
||||
|
||||
if (!document.startViewTransition) {
|
||||
this.applyTheme(color);
|
||||
this.applyTheme(type, color);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -179,6 +180,8 @@ export default {
|
|||
} else if (type === 'surface') {
|
||||
updateSurface(color.palette);
|
||||
}
|
||||
|
||||
EventBus.emit('theme-palette-change');
|
||||
},
|
||||
onRippleChange(value) {
|
||||
this.$appState.ripple = value;
|
||||
|
|
Loading…
Reference in New Issue