adminator-admin-dashboard 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +162 -0
- package/LICENSE +21 -0
- package/README.md +376 -0
- package/RELEASE_NOTES.md +92 -0
- package/dist/1e59d2330b4c6deb84b3.ttf +0 -0
- package/dist/20fd1704ea223900efa9.woff2 +0 -0
- package/dist/29b39089170885ae2967.woff +0 -0
- package/dist/404.html +24 -0
- package/dist/500.html +24 -0
- package/dist/55b07f26c86c8e3d3754.svg +1 -0
- package/dist/8b43027f47b20503057d.eot +0 -0
- package/dist/9bad94440d49256265a5.eot +0 -0
- package/dist/9fad440d8ee7a949a9a9.svg +1 -0
- package/dist/assets/c1e38fd9e0e74ba58f7a2b77ef29fdd3.svg +2671 -0
- package/dist/assets/f0fc8c798eac5636249c4ea287832422.svg +362 -0
- package/dist/assets/static/fonts/icons/fontawesome/FontAwesome.otf +0 -0
- package/dist/assets/static/fonts/icons/fontawesome/fontawesome-webfont.eot +0 -0
- package/dist/assets/static/fonts/icons/fontawesome/fontawesome-webfont.svg +2671 -0
- package/dist/assets/static/fonts/icons/fontawesome/fontawesome-webfont.ttf +0 -0
- package/dist/assets/static/fonts/icons/fontawesome/fontawesome-webfont.woff +0 -0
- package/dist/assets/static/fonts/icons/fontawesome/fontawesome-webfont.woff2 +0 -0
- package/dist/assets/static/fonts/icons/themify/themify.eot +0 -0
- package/dist/assets/static/fonts/icons/themify/themify.svg +362 -0
- package/dist/assets/static/fonts/icons/themify/themify.ttf +0 -0
- package/dist/assets/static/fonts/icons/themify/themify.woff +0 -0
- package/dist/assets/static/images/404.png +0 -0
- package/dist/assets/static/images/500.png +0 -0
- package/dist/assets/static/images/bg.jpg +0 -0
- package/dist/assets/static/images/datatables/sort_asc.png +0 -0
- package/dist/assets/static/images/datatables/sort_asc_disabled.png +0 -0
- package/dist/assets/static/images/datatables/sort_both.png +0 -0
- package/dist/assets/static/images/datatables/sort_desc.png +0 -0
- package/dist/assets/static/images/datatables/sort_desc_disabled.png +0 -0
- package/dist/assets/static/images/logo-circle.svg +7 -0
- package/dist/assets/static/images/logo-gradient.svg +13 -0
- package/dist/assets/static/images/logo-outline.svg +7 -0
- package/dist/assets/static/images/logo.png +0 -0
- package/dist/assets/static/images/logo.svg +5 -0
- package/dist/basic-table.html +715 -0
- package/dist/blank.html +522 -0
- package/dist/buttons.html +467 -0
- package/dist/calendar.html +692 -0
- package/dist/charts.html +681 -0
- package/dist/chat.html +730 -0
- package/dist/compose.html +643 -0
- package/dist/datatable.html +1009 -0
- package/dist/eda8b94308c6f538f04a.ttf +0 -0
- package/dist/email.html +992 -0
- package/dist/f691f37e57f04c152e23.woff +0 -0
- package/dist/forms.html +760 -0
- package/dist/google-maps.html +530 -0
- package/dist/index.html +1090 -0
- package/dist/main.js +61239 -0
- package/dist/main.js.map +1 -0
- package/dist/signin.html +107 -0
- package/dist/signup.html +104 -0
- package/dist/test.html +91 -0
- package/dist/ui.html +931 -0
- package/dist/vector-maps.html +529 -0
- package/package.json +112 -0
- package/src/404.html +24 -0
- package/src/500.html +24 -0
- package/src/assets/scripts/app.js +644 -0
- package/src/assets/scripts/charts/chartJS/index.js +148 -0
- package/src/assets/scripts/charts/easyPieChart/index.js +200 -0
- package/src/assets/scripts/charts/index.js +3 -0
- package/src/assets/scripts/charts/sparkline/index.js +208 -0
- package/src/assets/scripts/chat/index.js +11 -0
- package/src/assets/scripts/components/Chart.js +1390 -0
- package/src/assets/scripts/components/Sidebar.js +241 -0
- package/src/assets/scripts/constants/colors.js +274 -0
- package/src/assets/scripts/datatable/index.js +379 -0
- package/src/assets/scripts/datepicker/index.js +302 -0
- package/src/assets/scripts/email/index.js +25 -0
- package/src/assets/scripts/fullcalendar/index.js +86 -0
- package/src/assets/scripts/googleMaps/index.js +93 -0
- package/src/assets/scripts/index.js +18 -0
- package/src/assets/scripts/masonry/index.js +14 -0
- package/src/assets/scripts/popover/index.js +109 -0
- package/src/assets/scripts/scrollbar/index.js +10 -0
- package/src/assets/scripts/search/index.js +15 -0
- package/src/assets/scripts/sidebar/index.js +140 -0
- package/src/assets/scripts/skycons/index.js +52 -0
- package/src/assets/scripts/ui/index.js +412 -0
- package/src/assets/scripts/utils/date.js +242 -0
- package/src/assets/scripts/utils/dom.js +349 -0
- package/src/assets/scripts/utils/index.js +45 -0
- package/src/assets/scripts/utils/theme.js +105 -0
- package/src/assets/scripts/vectorMaps/index.js +277 -0
- package/src/assets/static/fonts/icons/fontawesome/FontAwesome.otf +0 -0
- package/src/assets/static/fonts/icons/fontawesome/fontawesome-webfont.eot +0 -0
- package/src/assets/static/fonts/icons/fontawesome/fontawesome-webfont.svg +2671 -0
- package/src/assets/static/fonts/icons/fontawesome/fontawesome-webfont.ttf +0 -0
- package/src/assets/static/fonts/icons/fontawesome/fontawesome-webfont.woff +0 -0
- package/src/assets/static/fonts/icons/fontawesome/fontawesome-webfont.woff2 +0 -0
- package/src/assets/static/fonts/icons/themify/themify.eot +0 -0
- package/src/assets/static/fonts/icons/themify/themify.svg +362 -0
- package/src/assets/static/fonts/icons/themify/themify.ttf +0 -0
- package/src/assets/static/fonts/icons/themify/themify.woff +0 -0
- package/src/assets/static/images/404.png +0 -0
- package/src/assets/static/images/500.png +0 -0
- package/src/assets/static/images/bg.jpg +0 -0
- package/src/assets/static/images/datatables/sort_asc.png +0 -0
- package/src/assets/static/images/datatables/sort_asc_disabled.png +0 -0
- package/src/assets/static/images/datatables/sort_both.png +0 -0
- package/src/assets/static/images/datatables/sort_desc.png +0 -0
- package/src/assets/static/images/datatables/sort_desc_disabled.png +0 -0
- package/src/assets/static/images/logo-circle.svg +7 -0
- package/src/assets/static/images/logo-gradient.svg +13 -0
- package/src/assets/static/images/logo-outline.svg +7 -0
- package/src/assets/static/images/logo.png +0 -0
- package/src/assets/static/images/logo.svg +5 -0
- package/src/assets/styles/index.scss +801 -0
- package/src/assets/styles/spec/components/easyPieChart.scss +11 -0
- package/src/assets/styles/spec/components/footer.scss +4 -0
- package/src/assets/styles/spec/components/forms.scss +288 -0
- package/src/assets/styles/spec/components/index.scss +9 -0
- package/src/assets/styles/spec/components/loader.scss +46 -0
- package/src/assets/styles/spec/components/masonry.scss +1 -0
- package/src/assets/styles/spec/components/pageContainer.scss +255 -0
- package/src/assets/styles/spec/components/progressBar.scss +6 -0
- package/src/assets/styles/spec/components/sidebar.scss +642 -0
- package/src/assets/styles/spec/components/topbar.scss +455 -0
- package/src/assets/styles/spec/generic/base.scss +102 -0
- package/src/assets/styles/spec/generic/index.scss +1 -0
- package/src/assets/styles/spec/index.scss +4 -0
- package/src/assets/styles/spec/screens/chat.scss +147 -0
- package/src/assets/styles/spec/screens/email.scss +108 -0
- package/src/assets/styles/spec/screens/index.scss +2 -0
- package/src/assets/styles/spec/settings/baseColors.scss +103 -0
- package/src/assets/styles/spec/settings/borders.scss +6 -0
- package/src/assets/styles/spec/settings/breakpoints.scss +26 -0
- package/src/assets/styles/spec/settings/fonts.scss +4 -0
- package/src/assets/styles/spec/settings/index.scss +4 -0
- package/src/assets/styles/spec/settings/materialColors.scss +550 -0
- package/src/assets/styles/spec/tools/index.scss +1 -0
- package/src/assets/styles/spec/tools/mixins/clearfix.scss +15 -0
- package/src/assets/styles/spec/tools/mixins/index.scss +3 -0
- package/src/assets/styles/spec/tools/mixins/mediaQueriesRanges.scss +58 -0
- package/src/assets/styles/spec/tools/mixins/placeholder.scss +10 -0
- package/src/assets/styles/spec/utils/colors.scss +33 -0
- package/src/assets/styles/spec/utils/index.scss +2 -0
- package/src/assets/styles/spec/utils/layout/helpers/border.scss +78 -0
- package/src/assets/styles/spec/utils/layout/helpers/flex.scss +220 -0
- package/src/assets/styles/spec/utils/layout/helpers/index.scss +11 -0
- package/src/assets/styles/spec/utils/layout/helpers/layout.scss +137 -0
- package/src/assets/styles/spec/utils/layout/helpers/lists.scss +23 -0
- package/src/assets/styles/spec/utils/layout/helpers/margin.scss +266 -0
- package/src/assets/styles/spec/utils/layout/helpers/objects.scss +91 -0
- package/src/assets/styles/spec/utils/layout/helpers/padding.scss +147 -0
- package/src/assets/styles/spec/utils/layout/helpers/positions.scss +118 -0
- package/src/assets/styles/spec/utils/layout/helpers/pseudo.scss +6 -0
- package/src/assets/styles/spec/utils/layout/helpers/sizes.scss +157 -0
- package/src/assets/styles/spec/utils/layout/helpers/typography.scss +127 -0
- package/src/assets/styles/spec/utils/layout/index.scss +3 -0
- package/src/assets/styles/spec/utils/layout/mixins/generateResponsive.scss +25 -0
- package/src/assets/styles/spec/utils/layout/mixins/index.scss +2 -0
- package/src/assets/styles/spec/utils/layout/mixins/mediaQueryCondition.scss +28 -0
- package/src/assets/styles/spec/utils/layout/utils/center.scss +54 -0
- package/src/assets/styles/spec/utils/layout/utils/gap.scss +229 -0
- package/src/assets/styles/spec/utils/layout/utils/index.scss +5 -0
- package/src/assets/styles/spec/utils/layout/utils/layers.scss +5 -0
- package/src/assets/styles/spec/utils/layout/utils/peers.scss +35 -0
- package/src/assets/styles/utils/mobile.scss +954 -0
- package/src/assets/styles/utils/theme.css +97 -0
- package/src/assets/styles/vendor/datepicker.scss +183 -0
- package/src/assets/styles/vendor/font-awesome.css +2337 -0
- package/src/assets/styles/vendor/fullcalendar.scss +217 -0
- package/src/assets/styles/vendor/index.scss +8 -0
- package/src/assets/styles/vendor/jquery.datatables.scss +162 -0
- package/src/assets/styles/vendor/perfectScrollbar.scss +4 -0
- package/src/assets/styles/vendor/sparkline.scss +6 -0
- package/src/assets/styles/vendor/themify-icons.css +1081 -0
- package/src/basic-table.html +725 -0
- package/src/blank.html +532 -0
- package/src/buttons.html +477 -0
- package/src/calendar.html +702 -0
- package/src/charts.html +691 -0
- package/src/chat.html +740 -0
- package/src/compose.html +653 -0
- package/src/datatable.html +1019 -0
- package/src/email.html +1002 -0
- package/src/forms.html +770 -0
- package/src/google-maps.html +540 -0
- package/src/index.html +1100 -0
- package/src/signin.html +107 -0
- package/src/signup.html +104 -0
- package/src/test.html +96 -0
- package/src/ui.html +941 -0
- package/src/vector-maps.html +539 -0
- package/webpack.config.js +3 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import Chart from 'chart.js/auto';
|
|
2
|
+
import { COLORS } from '../../constants/colors';
|
|
3
|
+
|
|
4
|
+
export default (function () {
|
|
5
|
+
// ------------------------------------------------------
|
|
6
|
+
// @Line Charts
|
|
7
|
+
// ------------------------------------------------------
|
|
8
|
+
|
|
9
|
+
const lineChartBox = document.getElementById('line-chart');
|
|
10
|
+
|
|
11
|
+
if (lineChartBox) {
|
|
12
|
+
const lineCtx = lineChartBox.getContext('2d');
|
|
13
|
+
lineChartBox.height = 80;
|
|
14
|
+
|
|
15
|
+
new Chart(lineCtx, {
|
|
16
|
+
type: 'line',
|
|
17
|
+
data: {
|
|
18
|
+
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
|
|
19
|
+
datasets: [{
|
|
20
|
+
label : 'Series A',
|
|
21
|
+
backgroundColor : 'rgba(237, 231, 246, 0.5)',
|
|
22
|
+
borderColor : COLORS['deep-purple-500'],
|
|
23
|
+
pointBackgroundColor : COLORS['deep-purple-700'],
|
|
24
|
+
borderWidth : 2,
|
|
25
|
+
data : [60, 50, 70, 60, 50, 70, 60],
|
|
26
|
+
}, {
|
|
27
|
+
label : 'Series B',
|
|
28
|
+
backgroundColor : 'rgba(232, 245, 233, 0.5)',
|
|
29
|
+
borderColor : COLORS['blue-500'],
|
|
30
|
+
pointBackgroundColor : COLORS['blue-700'],
|
|
31
|
+
borderWidth : 2,
|
|
32
|
+
data : [70, 75, 85, 70, 75, 85, 70],
|
|
33
|
+
}],
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
options: {
|
|
37
|
+
legend: {
|
|
38
|
+
display: false,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// ------------------------------------------------------
|
|
46
|
+
// @Bar Charts
|
|
47
|
+
// ------------------------------------------------------
|
|
48
|
+
|
|
49
|
+
const barChartBox = document.getElementById('bar-chart');
|
|
50
|
+
|
|
51
|
+
if (barChartBox) {
|
|
52
|
+
const barCtx = barChartBox.getContext('2d');
|
|
53
|
+
|
|
54
|
+
new Chart(barCtx, {
|
|
55
|
+
type: 'bar',
|
|
56
|
+
data: {
|
|
57
|
+
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
|
|
58
|
+
datasets: [{
|
|
59
|
+
label : 'Dataset 1',
|
|
60
|
+
backgroundColor : COLORS['deep-purple-500'],
|
|
61
|
+
borderColor : COLORS['deep-purple-800'],
|
|
62
|
+
borderWidth : 1,
|
|
63
|
+
data : [10, 50, 20, 40, 60, 30, 70],
|
|
64
|
+
}, {
|
|
65
|
+
label : 'Dataset 2',
|
|
66
|
+
backgroundColor : COLORS['light-blue-500'],
|
|
67
|
+
borderColor : COLORS['light-blue-800'],
|
|
68
|
+
borderWidth : 1,
|
|
69
|
+
data : [10, 50, 20, 40, 60, 30, 70],
|
|
70
|
+
}],
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
options: {
|
|
74
|
+
responsive: true,
|
|
75
|
+
legend: {
|
|
76
|
+
position: 'bottom',
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// ------------------------------------------------------
|
|
83
|
+
// @Area Charts
|
|
84
|
+
// ------------------------------------------------------
|
|
85
|
+
|
|
86
|
+
const areaChartBox = document.getElementById('area-chart');
|
|
87
|
+
|
|
88
|
+
if (areaChartBox) {
|
|
89
|
+
const areaCtx = areaChartBox.getContext('2d');
|
|
90
|
+
|
|
91
|
+
new Chart(areaCtx, {
|
|
92
|
+
type: 'line',
|
|
93
|
+
data: {
|
|
94
|
+
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
|
|
95
|
+
datasets: [{
|
|
96
|
+
backgroundColor : 'rgba(3, 169, 244, 0.5)',
|
|
97
|
+
borderColor : COLORS['light-blue-800'],
|
|
98
|
+
data : [10, 50, 20, 40, 60, 30, 70],
|
|
99
|
+
label : 'Dataset',
|
|
100
|
+
fill : 'start',
|
|
101
|
+
}],
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// ------------------------------------------------------
|
|
107
|
+
// @Scatter Charts
|
|
108
|
+
// ------------------------------------------------------
|
|
109
|
+
|
|
110
|
+
const scatterChartBox = document.getElementById('scatter-chart');
|
|
111
|
+
|
|
112
|
+
if (scatterChartBox) {
|
|
113
|
+
const scatterCtx = scatterChartBox.getContext('2d');
|
|
114
|
+
|
|
115
|
+
new Chart(scatterCtx, {
|
|
116
|
+
type: 'scatter',
|
|
117
|
+
data: {
|
|
118
|
+
datasets: [{
|
|
119
|
+
label : 'My First dataset',
|
|
120
|
+
borderColor : COLORS['red-500'],
|
|
121
|
+
backgroundColor : COLORS['red-500'],
|
|
122
|
+
data: [
|
|
123
|
+
{ x: 10, y: 20 },
|
|
124
|
+
{ x: 30, y: 40 },
|
|
125
|
+
{ x: 50, y: 60 },
|
|
126
|
+
{ x: 70, y: 80 },
|
|
127
|
+
{ x: 90, y: 100 },
|
|
128
|
+
{ x: 110, y: 120 },
|
|
129
|
+
{ x: 130, y: 140 },
|
|
130
|
+
],
|
|
131
|
+
}, {
|
|
132
|
+
label : 'My Second dataset',
|
|
133
|
+
borderColor : COLORS['green-500'],
|
|
134
|
+
backgroundColor : COLORS['green-500'],
|
|
135
|
+
data: [
|
|
136
|
+
{ x: 150, y: 160 },
|
|
137
|
+
{ x: 170, y: 180 },
|
|
138
|
+
{ x: 190, y: 200 },
|
|
139
|
+
{ x: 210, y: 220 },
|
|
140
|
+
{ x: 230, y: 240 },
|
|
141
|
+
{ x: 250, y: 260 },
|
|
142
|
+
{ x: 270, y: 280 },
|
|
143
|
+
],
|
|
144
|
+
}],
|
|
145
|
+
},
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}())
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import Theme from '../../utils/theme.js';
|
|
2
|
+
|
|
3
|
+
export default (function () {
|
|
4
|
+
|
|
5
|
+
// Vanilla JS Pie Chart implementation using SVG
|
|
6
|
+
class VanillaPieChart {
|
|
7
|
+
constructor(element, options = {}) {
|
|
8
|
+
this.element = element;
|
|
9
|
+
this.options = {
|
|
10
|
+
size: 110,
|
|
11
|
+
lineWidth: 3,
|
|
12
|
+
lineCap: 'round',
|
|
13
|
+
trackColor: '#f2f2f2',
|
|
14
|
+
barColor: '#ef1e25',
|
|
15
|
+
scaleColor: false,
|
|
16
|
+
animate: 1000,
|
|
17
|
+
onStep: null,
|
|
18
|
+
...options,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
this.percentage = parseInt(element.dataset.percent || 0);
|
|
22
|
+
this.init();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
init() {
|
|
26
|
+
this.createSVG();
|
|
27
|
+
this.animate();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
createSVG() {
|
|
31
|
+
const size = this.options.size;
|
|
32
|
+
const lineWidth = this.options.lineWidth;
|
|
33
|
+
const radius = (size - lineWidth) / 2;
|
|
34
|
+
const circumference = 2 * Math.PI * radius;
|
|
35
|
+
|
|
36
|
+
// Create SVG element
|
|
37
|
+
const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
38
|
+
svg.setAttribute('width', size);
|
|
39
|
+
svg.setAttribute('height', size);
|
|
40
|
+
svg.style.transform = 'rotate(-90deg)';
|
|
41
|
+
|
|
42
|
+
// Create track (background circle)
|
|
43
|
+
const track = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
|
|
44
|
+
track.setAttribute('cx', size / 2);
|
|
45
|
+
track.setAttribute('cy', size / 2);
|
|
46
|
+
track.setAttribute('r', radius);
|
|
47
|
+
track.setAttribute('fill', 'none');
|
|
48
|
+
track.setAttribute('stroke', this.options.trackColor);
|
|
49
|
+
track.setAttribute('stroke-width', lineWidth);
|
|
50
|
+
|
|
51
|
+
// Create bar (progress circle)
|
|
52
|
+
const bar = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
|
|
53
|
+
bar.setAttribute('cx', size / 2);
|
|
54
|
+
bar.setAttribute('cy', size / 2);
|
|
55
|
+
bar.setAttribute('r', radius);
|
|
56
|
+
bar.setAttribute('fill', 'none');
|
|
57
|
+
bar.setAttribute('stroke', this.options.barColor);
|
|
58
|
+
bar.setAttribute('stroke-width', lineWidth);
|
|
59
|
+
bar.setAttribute('stroke-linecap', this.options.lineCap);
|
|
60
|
+
bar.setAttribute('stroke-dasharray', circumference);
|
|
61
|
+
bar.setAttribute('stroke-dashoffset', circumference);
|
|
62
|
+
|
|
63
|
+
// Add elements to SVG
|
|
64
|
+
svg.appendChild(track);
|
|
65
|
+
svg.appendChild(bar);
|
|
66
|
+
|
|
67
|
+
// Clear element and add SVG
|
|
68
|
+
this.element.innerHTML = '';
|
|
69
|
+
this.element.appendChild(svg);
|
|
70
|
+
|
|
71
|
+
// Add percentage text
|
|
72
|
+
const textElement = document.createElement('div');
|
|
73
|
+
textElement.style.position = 'absolute';
|
|
74
|
+
textElement.style.top = '50%';
|
|
75
|
+
textElement.style.left = '50%';
|
|
76
|
+
textElement.style.transform = 'translate(-50%, -50%)';
|
|
77
|
+
textElement.style.fontSize = '14px';
|
|
78
|
+
textElement.style.fontWeight = 'bold';
|
|
79
|
+
textElement.style.color = Theme.getCSSVar('--c-text-base') || '#333';
|
|
80
|
+
textElement.textContent = '0%';
|
|
81
|
+
|
|
82
|
+
this.element.style.position = 'relative';
|
|
83
|
+
this.element.appendChild(textElement);
|
|
84
|
+
|
|
85
|
+
// Store references
|
|
86
|
+
this.svg = svg;
|
|
87
|
+
this.bar = bar;
|
|
88
|
+
this.textElement = textElement;
|
|
89
|
+
this.circumference = circumference;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
animate() {
|
|
93
|
+
const targetOffset = this.circumference - (this.percentage / 100) * this.circumference;
|
|
94
|
+
const duration = this.options.animate;
|
|
95
|
+
const startTime = Date.now();
|
|
96
|
+
const startOffset = this.circumference;
|
|
97
|
+
|
|
98
|
+
const animateStep = () => {
|
|
99
|
+
const elapsed = Date.now() - startTime;
|
|
100
|
+
const progress = Math.min(elapsed / duration, 1);
|
|
101
|
+
|
|
102
|
+
// Easing function (easeOutCubic)
|
|
103
|
+
const easeProgress = 1 - Math.pow(1 - progress, 3);
|
|
104
|
+
|
|
105
|
+
const currentOffset = startOffset - (startOffset - targetOffset) * easeProgress;
|
|
106
|
+
const currentPercent = ((this.circumference - currentOffset) / this.circumference) * 100;
|
|
107
|
+
|
|
108
|
+
this.bar.setAttribute('stroke-dashoffset', currentOffset);
|
|
109
|
+
this.textElement.textContent = `${Math.round(currentPercent)}%`;
|
|
110
|
+
|
|
111
|
+
// Call onStep callback if provided
|
|
112
|
+
if (this.options.onStep) {
|
|
113
|
+
this.options.onStep.call(this, 0, this.percentage, currentPercent);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (progress < 1) {
|
|
117
|
+
requestAnimationFrame(animateStep);
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
requestAnimationFrame(animateStep);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
update(percentage) {
|
|
125
|
+
this.percentage = percentage;
|
|
126
|
+
this.animate();
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
destroy() {
|
|
130
|
+
if (this.element) {
|
|
131
|
+
this.element.innerHTML = '';
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Initialize all pie charts
|
|
137
|
+
const initializePieCharts = () => {
|
|
138
|
+
const pieChartElements = document.querySelectorAll('.easy-pie-chart');
|
|
139
|
+
|
|
140
|
+
pieChartElements.forEach(element => {
|
|
141
|
+
// Skip if already initialized
|
|
142
|
+
if (element.pieChartInstance) {
|
|
143
|
+
element.pieChartInstance.destroy();
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Get theme colors
|
|
147
|
+
const isDark = Theme.current() === 'dark';
|
|
148
|
+
const barColor = element.dataset.barColor || (isDark ? '#4f46e5' : '#ef4444');
|
|
149
|
+
const trackColor = element.dataset.trackColor || (isDark ? '#374151' : '#f3f4f6');
|
|
150
|
+
|
|
151
|
+
// Create pie chart instance
|
|
152
|
+
const pieChart = new VanillaPieChart(element, {
|
|
153
|
+
size: parseInt(element.dataset.size || 110),
|
|
154
|
+
lineWidth: parseInt(element.dataset.lineWidth || 3),
|
|
155
|
+
barColor,
|
|
156
|
+
trackColor,
|
|
157
|
+
animate: parseInt(element.dataset.animate || 1000),
|
|
158
|
+
onStep(from, to, percent) {
|
|
159
|
+
// Update the percentage display
|
|
160
|
+
const textElement = this.element.querySelector('div');
|
|
161
|
+
if (textElement) {
|
|
162
|
+
textElement.innerHTML = `${Math.round(percent)}%`;
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
// Store instance for cleanup
|
|
168
|
+
element.pieChartInstance = pieChart;
|
|
169
|
+
});
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
// Initialize on load
|
|
173
|
+
initializePieCharts();
|
|
174
|
+
|
|
175
|
+
// Reinitialize on theme change
|
|
176
|
+
window.addEventListener('adminator:themeChanged', () => {
|
|
177
|
+
setTimeout(initializePieCharts, 100);
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
// Reinitialize on window resize
|
|
181
|
+
window.addEventListener('resize', () => {
|
|
182
|
+
setTimeout(initializePieCharts, 100);
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
// Cleanup on page unload
|
|
186
|
+
window.addEventListener('beforeunload', () => {
|
|
187
|
+
const pieChartElements = document.querySelectorAll('.easy-pie-chart');
|
|
188
|
+
pieChartElements.forEach(element => {
|
|
189
|
+
if (element.pieChartInstance) {
|
|
190
|
+
element.pieChartInstance.destroy();
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
// Return public API
|
|
196
|
+
return {
|
|
197
|
+
init: initializePieCharts,
|
|
198
|
+
VanillaPieChart,
|
|
199
|
+
};
|
|
200
|
+
}());
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { Chart, registerables } from 'chart.js';
|
|
2
|
+
import { debounce } from 'lodash';
|
|
3
|
+
import { COLORS } from '../../constants/colors';
|
|
4
|
+
import Theme from '../../utils/theme.js';
|
|
5
|
+
|
|
6
|
+
// Register Chart.js components
|
|
7
|
+
Chart.register(...registerables);
|
|
8
|
+
|
|
9
|
+
export default (function () {
|
|
10
|
+
// Store chart instances for cleanup
|
|
11
|
+
let chartInstances = [];
|
|
12
|
+
|
|
13
|
+
// ------------------------------------------------------
|
|
14
|
+
// @Sparkline Chart Creation Helpers
|
|
15
|
+
// ------------------------------------------------------
|
|
16
|
+
|
|
17
|
+
const createSparklineChart = (elementId, data, color, type = 'bar') => {
|
|
18
|
+
const element = document.getElementById(elementId);
|
|
19
|
+
if (!element) return null;
|
|
20
|
+
|
|
21
|
+
// Clear existing chart
|
|
22
|
+
const existingChart = chartInstances.find(chart => chart.canvas.id === elementId);
|
|
23
|
+
if (existingChart) {
|
|
24
|
+
existingChart.destroy();
|
|
25
|
+
chartInstances = chartInstances.filter(chart => chart.canvas.id !== elementId);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Create canvas if it doesn't exist
|
|
29
|
+
let canvas = element.querySelector('canvas');
|
|
30
|
+
if (!canvas) {
|
|
31
|
+
canvas = document.createElement('canvas');
|
|
32
|
+
canvas.id = `${elementId }-canvas`;
|
|
33
|
+
element.appendChild(canvas);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Set canvas size
|
|
37
|
+
canvas.width = element.offsetWidth || 100;
|
|
38
|
+
canvas.height = 20;
|
|
39
|
+
|
|
40
|
+
const ctx = canvas.getContext('2d');
|
|
41
|
+
|
|
42
|
+
const chartConfig = {
|
|
43
|
+
type,
|
|
44
|
+
data: {
|
|
45
|
+
labels: data.map((_, index) => index),
|
|
46
|
+
datasets: [{
|
|
47
|
+
data,
|
|
48
|
+
backgroundColor: color,
|
|
49
|
+
borderColor: color,
|
|
50
|
+
borderWidth: type === 'line' ? 2 : 0,
|
|
51
|
+
barThickness: 3,
|
|
52
|
+
categoryPercentage: 1.0,
|
|
53
|
+
barPercentage: 0.8,
|
|
54
|
+
fill: false,
|
|
55
|
+
pointRadius: 0,
|
|
56
|
+
pointHoverRadius: 0,
|
|
57
|
+
}],
|
|
58
|
+
},
|
|
59
|
+
options: {
|
|
60
|
+
responsive: true,
|
|
61
|
+
maintainAspectRatio: false,
|
|
62
|
+
plugins: {
|
|
63
|
+
legend: {
|
|
64
|
+
display: false,
|
|
65
|
+
},
|
|
66
|
+
tooltip: {
|
|
67
|
+
enabled: false,
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
scales: {
|
|
71
|
+
x: {
|
|
72
|
+
display: false,
|
|
73
|
+
grid: {
|
|
74
|
+
display: false,
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
y: {
|
|
78
|
+
display: false,
|
|
79
|
+
grid: {
|
|
80
|
+
display: false,
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
elements: {
|
|
85
|
+
bar: {
|
|
86
|
+
borderRadius: 0,
|
|
87
|
+
},
|
|
88
|
+
line: {
|
|
89
|
+
tension: 0.1,
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
layout: {
|
|
93
|
+
padding: 0,
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const chart = new Chart(ctx, chartConfig);
|
|
99
|
+
chartInstances.push(chart);
|
|
100
|
+
return chart;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const createSparklineForElements = (selector, data, color, type = 'bar') => {
|
|
104
|
+
const elements = document.querySelectorAll(selector);
|
|
105
|
+
elements.forEach((element, index) => {
|
|
106
|
+
const elementId = element.id || `sparkline-${selector.replace(/[^a-zA-Z0-9]/g, '')}-${index}`;
|
|
107
|
+
if (!element.id) element.id = elementId;
|
|
108
|
+
createSparklineChart(elementId, data, color, type);
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
// ------------------------------------------------------
|
|
113
|
+
// @Dashboard Sparklines
|
|
114
|
+
// ------------------------------------------------------
|
|
115
|
+
|
|
116
|
+
const drawSparklines = () => {
|
|
117
|
+
const sparkColors = Theme.getSparklineColors();
|
|
118
|
+
const data = [0, 5, 6, 10, 9, 12, 4, 9];
|
|
119
|
+
|
|
120
|
+
// Dashboard sparklines
|
|
121
|
+
createSparklineChart('sparklinedash', data, sparkColors.success);
|
|
122
|
+
createSparklineChart('sparklinedash2', data, sparkColors.purple);
|
|
123
|
+
createSparklineChart('sparklinedash3', data, sparkColors.info);
|
|
124
|
+
createSparklineChart('sparklinedash4', data, sparkColors.danger);
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
// ------------------------------------------------------
|
|
128
|
+
// @Other Sparklines
|
|
129
|
+
// ------------------------------------------------------
|
|
130
|
+
|
|
131
|
+
const drawOtherSparklines = () => {
|
|
132
|
+
const sparkColors = Theme.getSparklineColors();
|
|
133
|
+
|
|
134
|
+
// Line sparklines
|
|
135
|
+
createSparklineChart('sparkline', [5, 6, 7, 9, 9, 5, 3, 2, 2, 4, 6, 7], COLORS['red-500'], 'line');
|
|
136
|
+
|
|
137
|
+
// Composite bar - simplified implementation
|
|
138
|
+
createSparklineChart('compositebar', [4, 1, 5, 7, 9, 9, 8, 7, 6, 6, 4, 7, 8, 4, 3, 2, 2, 5, 6, 7], sparkColors.light);
|
|
139
|
+
|
|
140
|
+
// Normal line
|
|
141
|
+
createSparklineChart('normalline', [5, 6, 7, 9, 9, 5, 3, 2, 2, 4, 6, 7], sparkColors.info, 'line');
|
|
142
|
+
|
|
143
|
+
// Various sparkline types for elements with classes
|
|
144
|
+
const values = [5, 4, 5, -2, 0, 3, -5, 6, 7, 9, 9, 5, -3, -2, 2, -4];
|
|
145
|
+
const valuesAlt = [1, 1, 0, 1, -1, -1, 1, -1, 0, 0, 1, 1];
|
|
146
|
+
|
|
147
|
+
// Line sparklines
|
|
148
|
+
createSparklineForElements('.sparkline', values, COLORS['red-500'], 'line');
|
|
149
|
+
|
|
150
|
+
// Bar sparklines
|
|
151
|
+
createSparklineForElements('.sparkbar', values, COLORS['deep-purple-500'], 'bar');
|
|
152
|
+
|
|
153
|
+
// Tristate sparklines (simplified as bar charts)
|
|
154
|
+
createSparklineForElements('.sparktri', valuesAlt, COLORS['light-blue-500'], 'bar');
|
|
155
|
+
createSparklineForElements('.sparktristate', valuesAlt, sparkColors.info, 'bar');
|
|
156
|
+
createSparklineForElements('.sparktristatecols', valuesAlt, '#fa7', 'bar');
|
|
157
|
+
|
|
158
|
+
// Discrete sparklines (as line charts)
|
|
159
|
+
createSparklineForElements('.sparkdisc', values, '#9f0', 'line');
|
|
160
|
+
|
|
161
|
+
// Bullet sparklines (simplified as bar charts)
|
|
162
|
+
createSparklineForElements('.sparkbull', values, COLORS['amber-500'], 'bar');
|
|
163
|
+
|
|
164
|
+
// Box sparklines (simplified as bar charts)
|
|
165
|
+
createSparklineForElements('.sparkbox', values, '#9f0', 'bar');
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
// ------------------------------------------------------
|
|
169
|
+
// @Initialization
|
|
170
|
+
// ------------------------------------------------------
|
|
171
|
+
|
|
172
|
+
const initializeSparklines = () => {
|
|
173
|
+
drawSparklines();
|
|
174
|
+
drawOtherSparklines();
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
// Initial draw
|
|
178
|
+
initializeSparklines();
|
|
179
|
+
|
|
180
|
+
// Redraw sparklines on window resize
|
|
181
|
+
window.addEventListener('resize', debounce(initializeSparklines, 150));
|
|
182
|
+
|
|
183
|
+
// Listen for theme changes
|
|
184
|
+
window.addEventListener('adminator:themeChanged', debounce(initializeSparklines, 150));
|
|
185
|
+
|
|
186
|
+
// Cleanup function for chart instances
|
|
187
|
+
window.addEventListener('beforeunload', () => {
|
|
188
|
+
chartInstances.forEach(chart => {
|
|
189
|
+
if (chart && typeof chart.destroy === 'function') {
|
|
190
|
+
chart.destroy();
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
chartInstances = [];
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
// Export for external access
|
|
197
|
+
return {
|
|
198
|
+
redraw: initializeSparklines,
|
|
199
|
+
destroy: () => {
|
|
200
|
+
chartInstances.forEach(chart => {
|
|
201
|
+
if (chart && typeof chart.destroy === 'function') {
|
|
202
|
+
chart.destroy();
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
chartInstances = [];
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
}());
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export default (function () {
|
|
2
|
+
const chatSidebarToggle = document.getElementById('chat-sidebar-toggle');
|
|
3
|
+
const chatSidebar = document.getElementById('chat-sidebar');
|
|
4
|
+
|
|
5
|
+
if (chatSidebarToggle && chatSidebar) {
|
|
6
|
+
chatSidebarToggle.addEventListener('click', e => {
|
|
7
|
+
chatSidebar.classList.toggle('open');
|
|
8
|
+
e.preventDefault();
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
}())
|