@enki-tek/fms-web-components 0.0.90 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- package/components/Accordion/Accordion.svelte +3 -0
- package/components/Accordion/AccordionItem.svelte +3 -0
- package/components/Alert/Alert.svelte.d.ts +1 -1
- package/components/Badge/Badge.svelte +3 -0
- package/components/Breadcrumb/Breadcrumb.svelte +3 -0
- package/components/Button/Button.svelte +3 -0
- package/components/Button/Button.svelte.d.ts +8 -8
- package/components/Card/Card.svelte.d.ts +4 -4
- package/components/CardIcon/CardIcon.svelte +3 -0
- package/components/CardIcon/CardiconBody.svelte +3 -0
- package/components/CardIcon/CardiconSubtitle.svelte +3 -0
- package/components/CardIcon/CardiconTitle.svelte +3 -0
- package/components/CardIcon/CardiconTitle.svelte.d.ts +2 -2
- package/components/Charts/Barchart.svelte +74 -0
- package/components/Charts/Barchart.svelte.d.ts +23 -0
- package/components/Charts/DoughnutChart.svelte +73 -0
- package/components/Charts/DoughnutChart.svelte.d.ts +29 -0
- package/components/Charts/LineChart.svelte +62 -0
- package/components/Charts/LineChart.svelte.d.ts +23 -0
- package/components/Charts/PieChart.svelte +75 -0
- package/components/Charts/PieChart.svelte.d.ts +29 -0
- package/components/CheckBox/Checkbox.svelte +3 -0
- package/components/CheckBox/Checkbox.svelte.d.ts +8 -8
- package/components/Dropdown/Dropdown.svelte +3 -0
- package/components/Dropdown/DropdownItem.svelte +3 -0
- package/components/EnkiCard/CardBody.svelte.d.ts +2 -2
- package/components/EnkiSidbar/EnkiSidebar.svelte +3 -0
- package/components/EnkiSidbar/EnkiSidebar.svelte.d.ts +2 -2
- package/components/EnkiSidbar/NavIcon.svelte +3 -0
- package/components/EnkiSidbar/NavItem.svelte +3 -0
- package/components/EnkiSidbar/NavLink.svelte +3 -0
- package/components/EnkiTable/EnkiTable.svelte.d.ts +4 -4
- package/components/EnkiTable/TableCell.svelte.d.ts +2 -2
- package/components/Header/Brand.svelte +25 -16
- package/components/Header/Header.scss +40 -34
- package/components/Header/Header.svelte +26 -20
- package/components/Header/Header.svelte.d.ts +6 -2
- package/components/Header/HeaderDropDownLink.svelte +11 -0
- package/components/Header/HeaderDropDownLink.svelte.d.ts +29 -0
- package/components/Header/HeaderDropDownLinkItem.svelte +9 -0
- package/components/Header/HeaderDropDownLinkItem.svelte.d.ts +31 -0
- package/components/Header/HeaderItem.svelte +9 -0
- package/components/Header/HeaderItem.svelte.d.ts +2 -2
- package/components/Header/HeaderLink.svelte +9 -0
- package/components/Header/HeaderLink.svelte.d.ts +31 -0
- package/components/Header/HeaderLinks.svelte +9 -0
- package/components/Header/HeaderLinks.svelte.d.ts +27 -0
- package/components/Header/UserAvatar.svelte +12 -3
- package/components/Icon/ActionIcon.svelte.d.ts +2 -2
- package/components/Layout/Content.svelte +9 -0
- package/components/Layout/Content.svelte.d.ts +29 -0
- package/components/Layout/Footer.svelte +2 -0
- package/components/Layout/Layout.svelte +6 -0
- package/components/Layout/Layout.svelte.d.ts +27 -0
- package/components/Layout/Page.svelte +35 -9
- package/components/Layout/Page.svelte.d.ts +6 -2
- package/components/Layout/SortableGrid.svelte +28 -0
- package/components/Layout/SortableGrid.svelte.d.ts +27 -0
- package/components/ModalWindow/Modal.svelte +3 -0
- package/components/ModalWindow/Modal.svelte.d.ts +2 -2
- package/components/ModalWindow/ModalBody.svelte +3 -0
- package/components/ModalWindow/ModalFooter.svelte +3 -0
- package/components/ModalWindow/ModalHeader.svelte +3 -0
- package/components/NotFound/NotFound.svelte +3 -0
- package/components/Pagination/Pagination.svelte +3 -0
- package/components/RadioButton/RadioButton.svelte +3 -0
- package/components/Sidebar/MenuGroup.svelte +108 -0
- package/components/Sidebar/MenuGroup.svelte.d.ts +29 -0
- package/components/Sidebar/MenuItem.svelte +122 -0
- package/components/Sidebar/MenuItem.svelte.d.ts +35 -0
- package/components/Sidebar/SideBarMenu.svelte +148 -0
- package/components/Sidebar/SideBarMenu.svelte.d.ts +27 -0
- package/components/Sidebar/Sidebar.scss +29 -0
- package/components/Sidebar/Sidebar.svelte +29 -0
- package/components/StatusCard/StatusCard.scss +35 -0
- package/components/StatusCard/StatusCard.svelte +42 -0
- package/components/StatusCard/StatusCard.svelte.d.ts +27 -0
- package/components/StatusCard/StatusCardBody.svelte +57 -0
- package/components/StatusCard/StatusCardBody.svelte.d.ts +31 -0
- package/components/StatusCard/StatusCardTitle.svelte +47 -0
- package/components/StatusCard/StatusCardTitle.svelte.d.ts +29 -0
- package/components/Switches/Switch.svelte +3 -0
- package/components/Switches/Switch.svelte.d.ts +2 -2
- package/components/Tab/Tab.svelte +3 -0
- package/components/TextField/TextField.svelte +3 -0
- package/components/TextField/TextField.svelte.d.ts +8 -8
- package/components/Toast/Toast.svelte +3 -0
- package/components/Toast/Toast.svelte.d.ts +2 -2
- package/components/Tooltip/Tooltip.svelte +3 -0
- package/components/WidgetCard/Card.scss +108 -0
- package/components/WidgetCard/SensorStatusCard.svelte +130 -0
- package/components/WidgetCard/SensorStatusCard.svelte.d.ts +27 -0
- package/components/WidgetCard/StateCard.svelte +133 -0
- package/components/WidgetCard/StateCard.svelte.d.ts +29 -0
- package/components/WidgetCard/WidgetCard.svelte +152 -0
- package/components/WidgetCard/WidgetCard.svelte.d.ts +35 -0
- package/components/WidgetCard/WidgetCardBody.svelte +13 -0
- package/components/WidgetCard/WidgetCardBody.svelte.d.ts +27 -0
- package/components/common.scss +4 -0
- package/components/variable.scss +13 -3
- package/index.d.ts +65 -48
- package/index.js +65 -48
- package/package.json +30 -2
@@ -1,7 +1,7 @@
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
2
2
|
declare const __propDef: {
|
3
3
|
props: {
|
4
|
-
color?: "
|
4
|
+
color?: "info" | "success" | "danger" | "warning" | undefined;
|
5
5
|
};
|
6
6
|
events: {
|
7
7
|
[evt: string]: CustomEvent<any>;
|
@@ -3,12 +3,11 @@
|
|
3
3
|
/** @typedef {typeof __propDef.slots} ButtonSlots */
|
4
4
|
export default class Button extends SvelteComponentTyped<{
|
5
5
|
[x: string]: any;
|
6
|
-
|
7
|
-
|
6
|
+
config?: string | undefined;
|
7
|
+
className?: string | undefined;
|
8
8
|
disabled?: boolean | undefined;
|
9
9
|
type?: string | undefined;
|
10
10
|
label?: string | undefined;
|
11
|
-
config?: string | undefined;
|
12
11
|
icon?: {
|
13
12
|
state: boolean;
|
14
13
|
name: string;
|
@@ -16,7 +15,8 @@ export default class Button extends SvelteComponentTyped<{
|
|
16
15
|
} | undefined;
|
17
16
|
shade?: string | undefined;
|
18
17
|
outlineShade?: string | undefined;
|
19
|
-
|
18
|
+
size?: string | undefined;
|
19
|
+
id?: string | undefined;
|
20
20
|
actived?: {
|
21
21
|
state: boolean;
|
22
22
|
color: string;
|
@@ -38,12 +38,11 @@ import { SvelteComponentTyped } from "svelte";
|
|
38
38
|
declare const __propDef: {
|
39
39
|
props: {
|
40
40
|
[x: string]: any;
|
41
|
-
|
42
|
-
|
41
|
+
config?: string | undefined;
|
42
|
+
className?: string | undefined;
|
43
43
|
disabled?: boolean | undefined;
|
44
44
|
type?: string | undefined;
|
45
45
|
label?: string | undefined;
|
46
|
-
config?: string | undefined;
|
47
46
|
icon?: {
|
48
47
|
state: boolean;
|
49
48
|
name: string;
|
@@ -51,7 +50,8 @@ declare const __propDef: {
|
|
51
50
|
} | undefined;
|
52
51
|
shade?: string | undefined;
|
53
52
|
outlineShade?: string | undefined;
|
54
|
-
|
53
|
+
size?: string | undefined;
|
54
|
+
id?: string | undefined;
|
55
55
|
actived?: {
|
56
56
|
state: boolean;
|
57
57
|
color: string;
|
@@ -2,10 +2,10 @@
|
|
2
2
|
/** @typedef {typeof __propDef.events} CardEvents */
|
3
3
|
/** @typedef {typeof __propDef.slots} CardSlots */
|
4
4
|
export default class Card extends SvelteComponentTyped<{
|
5
|
-
link?: string | undefined;
|
6
|
-
text?: string | undefined;
|
7
5
|
title?: string | undefined;
|
8
6
|
subTitle?: string | undefined;
|
7
|
+
text?: string | undefined;
|
8
|
+
link?: string | undefined;
|
9
9
|
image?: string | undefined;
|
10
10
|
width?: string | undefined;
|
11
11
|
linkName1?: string | undefined;
|
@@ -27,10 +27,10 @@ export type CardSlots = typeof __propDef.slots;
|
|
27
27
|
import { SvelteComponentTyped } from "svelte";
|
28
28
|
declare const __propDef: {
|
29
29
|
props: {
|
30
|
-
link?: string | undefined;
|
31
|
-
text?: string | undefined;
|
32
30
|
title?: string | undefined;
|
33
31
|
subTitle?: string | undefined;
|
32
|
+
text?: string | undefined;
|
33
|
+
link?: string | undefined;
|
34
34
|
image?: string | undefined;
|
35
35
|
width?: string | undefined;
|
36
36
|
linkName1?: string | undefined;
|
@@ -3,8 +3,8 @@
|
|
3
3
|
/** @typedef {typeof __propDef.slots} CardiconTitleSlots */
|
4
4
|
export default class CardiconTitle extends SvelteComponentTyped<{
|
5
5
|
className: any;
|
6
|
-
name?: string | undefined;
|
7
6
|
title?: string | undefined;
|
7
|
+
name?: string | undefined;
|
8
8
|
iconLocation?: string | undefined;
|
9
9
|
}, {
|
10
10
|
[evt: string]: CustomEvent<any>;
|
@@ -17,8 +17,8 @@ import { SvelteComponentTyped } from "svelte";
|
|
17
17
|
declare const __propDef: {
|
18
18
|
props: {
|
19
19
|
className: any;
|
20
|
-
name?: string | undefined;
|
21
20
|
title?: string | undefined;
|
21
|
+
name?: string | undefined;
|
22
22
|
iconLocation?: string | undefined;
|
23
23
|
};
|
24
24
|
events: {
|
@@ -0,0 +1,74 @@
|
|
1
|
+
<!-- src/BarChart.svelte -->
|
2
|
+
<script>
|
3
|
+
import { onMount, onDestroy } from 'svelte';
|
4
|
+
import { Chart, registerables } from 'chart.js';
|
5
|
+
|
6
|
+
// Register all necessary components
|
7
|
+
Chart.register(...registerables);
|
8
|
+
|
9
|
+
let chart;
|
10
|
+
let canvas;
|
11
|
+
|
12
|
+
// Chart configuration
|
13
|
+
const chartData = {
|
14
|
+
labels: ['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'],
|
15
|
+
datasets: [
|
16
|
+
{
|
17
|
+
label: '# of Votes',
|
18
|
+
backgroundColor: [
|
19
|
+
'rgba(255, 99, 132, 0.2)',
|
20
|
+
'rgba(54, 162, 235, 0.2)',
|
21
|
+
'rgba(255, 206, 86, 0.2)',
|
22
|
+
'rgba(75, 192, 192, 0.2)',
|
23
|
+
'rgba(153, 102, 255, 0.2)',
|
24
|
+
'rgba(255, 159, 64, 0.2)',
|
25
|
+
],
|
26
|
+
borderColor: [
|
27
|
+
'rgba(255, 99, 132, 1)',
|
28
|
+
'rgba(54, 162, 235, 1)',
|
29
|
+
'rgba(255, 206, 86, 1)',
|
30
|
+
'rgba(75, 192, 192, 1)',
|
31
|
+
'rgba(153, 102, 255, 1)',
|
32
|
+
'rgba(255, 159, 64, 1)',
|
33
|
+
],
|
34
|
+
borderWidth: 1,
|
35
|
+
data: [12, 19, 3, 5, 2, 3],
|
36
|
+
},
|
37
|
+
],
|
38
|
+
};
|
39
|
+
|
40
|
+
const chartOptions = {
|
41
|
+
responsive: true,
|
42
|
+
maintainAspectRatio: false, // Allows the chart to resize freely
|
43
|
+
scales: {
|
44
|
+
y: {
|
45
|
+
beginAtZero: true,
|
46
|
+
},
|
47
|
+
},
|
48
|
+
};
|
49
|
+
|
50
|
+
onMount(() => {
|
51
|
+
const ctx = canvas.getContext('2d');
|
52
|
+
chart = new Chart(ctx, {
|
53
|
+
type: 'bar', // Set chart type to 'bar'
|
54
|
+
data: chartData,
|
55
|
+
options: chartOptions,
|
56
|
+
});
|
57
|
+
});
|
58
|
+
|
59
|
+
onDestroy(() => {
|
60
|
+
if (chart) {
|
61
|
+
chart.destroy();
|
62
|
+
}
|
63
|
+
});
|
64
|
+
</script>
|
65
|
+
|
66
|
+
<canvas bind:this={canvas} width="400" height="200" />
|
67
|
+
|
68
|
+
<style>
|
69
|
+
canvas {
|
70
|
+
max-width: 100%;
|
71
|
+
height: 100%; /* Ensures the canvas takes the full height of the container */
|
72
|
+
}
|
73
|
+
</style>
|
74
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
/** @typedef {typeof __propDef.props} BarchartProps */
|
2
|
+
/** @typedef {typeof __propDef.events} BarchartEvents */
|
3
|
+
/** @typedef {typeof __propDef.slots} BarchartSlots */
|
4
|
+
export default class Barchart extends SvelteComponentTyped<{
|
5
|
+
[x: string]: never;
|
6
|
+
}, {
|
7
|
+
[evt: string]: CustomEvent<any>;
|
8
|
+
}, {}> {
|
9
|
+
}
|
10
|
+
export type BarchartProps = typeof __propDef.props;
|
11
|
+
export type BarchartEvents = typeof __propDef.events;
|
12
|
+
export type BarchartSlots = typeof __propDef.slots;
|
13
|
+
import { SvelteComponentTyped } from "svelte";
|
14
|
+
declare const __propDef: {
|
15
|
+
props: {
|
16
|
+
[x: string]: never;
|
17
|
+
};
|
18
|
+
events: {
|
19
|
+
[evt: string]: CustomEvent<any>;
|
20
|
+
};
|
21
|
+
slots: {};
|
22
|
+
};
|
23
|
+
export {};
|
@@ -0,0 +1,73 @@
|
|
1
|
+
<!-- src/PieChart.svelte -->
|
2
|
+
<script>
|
3
|
+
import { onMount, onDestroy } from 'svelte';
|
4
|
+
import { Chart, registerables } from 'chart.js';
|
5
|
+
|
6
|
+
export let data = {};
|
7
|
+
export let label = '';
|
8
|
+
export let width = 200;
|
9
|
+
export let height = 200;
|
10
|
+
// Register all necessary components
|
11
|
+
Chart.register(...registerables);
|
12
|
+
|
13
|
+
let chart;
|
14
|
+
let canvas;
|
15
|
+
|
16
|
+
// Chart configuration
|
17
|
+
const chartData = {
|
18
|
+
labels: Object.keys(data),
|
19
|
+
datasets: [
|
20
|
+
{
|
21
|
+
label: label,
|
22
|
+
data: Object.values(data)
|
23
|
+
}
|
24
|
+
]
|
25
|
+
};
|
26
|
+
|
27
|
+
const chartOptions = {
|
28
|
+
plugins: {
|
29
|
+
legend: {
|
30
|
+
position: 'bottom' // Set legend position to bottom
|
31
|
+
},
|
32
|
+
datalabels: {
|
33
|
+
anchor: 'center',
|
34
|
+
align: 'end',
|
35
|
+
clamp: true,
|
36
|
+
font: {
|
37
|
+
size: 16, // Set the font size here
|
38
|
+
weight: 'bold', // Optional: set font weight
|
39
|
+
family: 'Roboto', // Set the font family to Roboto
|
40
|
+
},
|
41
|
+
formatter: (value) => {
|
42
|
+
return value; // Show the value directly
|
43
|
+
}
|
44
|
+
}
|
45
|
+
},
|
46
|
+
responsive: true,
|
47
|
+
maintainAspectRatio: false // Allows the chart to resize freely
|
48
|
+
};
|
49
|
+
|
50
|
+
onMount(() => {
|
51
|
+
const ctx = canvas.getContext('2d');
|
52
|
+
chart = new Chart(ctx, {
|
53
|
+
type: 'doughnut',
|
54
|
+
data: chartData,
|
55
|
+
options: chartOptions
|
56
|
+
});
|
57
|
+
});
|
58
|
+
|
59
|
+
onDestroy(() => {
|
60
|
+
if (chart) {
|
61
|
+
chart.destroy();
|
62
|
+
}
|
63
|
+
});
|
64
|
+
</script>
|
65
|
+
|
66
|
+
<canvas bind:this={canvas} {width} {height} />
|
67
|
+
|
68
|
+
<style>
|
69
|
+
canvas {
|
70
|
+
max-width: 100%;
|
71
|
+
height: auto; /* Ensures the canvas takes the full height of the container */
|
72
|
+
}
|
73
|
+
</style>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
/** @typedef {typeof __propDef.props} DoughnutChartProps */
|
2
|
+
/** @typedef {typeof __propDef.events} DoughnutChartEvents */
|
3
|
+
/** @typedef {typeof __propDef.slots} DoughnutChartSlots */
|
4
|
+
export default class DoughnutChart extends SvelteComponentTyped<{
|
5
|
+
label?: string | undefined;
|
6
|
+
width?: number | undefined;
|
7
|
+
height?: number | undefined;
|
8
|
+
data?: {} | undefined;
|
9
|
+
}, {
|
10
|
+
[evt: string]: CustomEvent<any>;
|
11
|
+
}, {}> {
|
12
|
+
}
|
13
|
+
export type DoughnutChartProps = typeof __propDef.props;
|
14
|
+
export type DoughnutChartEvents = typeof __propDef.events;
|
15
|
+
export type DoughnutChartSlots = typeof __propDef.slots;
|
16
|
+
import { SvelteComponentTyped } from "svelte";
|
17
|
+
declare const __propDef: {
|
18
|
+
props: {
|
19
|
+
label?: string | undefined;
|
20
|
+
width?: number | undefined;
|
21
|
+
height?: number | undefined;
|
22
|
+
data?: {} | undefined;
|
23
|
+
};
|
24
|
+
events: {
|
25
|
+
[evt: string]: CustomEvent<any>;
|
26
|
+
};
|
27
|
+
slots: {};
|
28
|
+
};
|
29
|
+
export {};
|
@@ -0,0 +1,62 @@
|
|
1
|
+
<!-- src/MyChart.svelte -->
|
2
|
+
<script>
|
3
|
+
import { onMount, onDestroy } from 'svelte';
|
4
|
+
import { Chart, registerables } from 'chart.js';
|
5
|
+
|
6
|
+
export let data = {};
|
7
|
+
|
8
|
+
// Register all necessary components
|
9
|
+
Chart.register(...registerables);
|
10
|
+
|
11
|
+
let chart;
|
12
|
+
let canvas;
|
13
|
+
|
14
|
+
// Chart configuration
|
15
|
+
const chartData = {
|
16
|
+
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
|
17
|
+
datasets: [
|
18
|
+
{
|
19
|
+
label: 'My First dataset',
|
20
|
+
backgroundColor: 'rgba(75, 192, 192, 0.2)',
|
21
|
+
borderColor: 'rgba(75, 192, 192, 1)',
|
22
|
+
borderWidth: 1,
|
23
|
+
data: [40, 30, 20, 50, 60, 70, 80]
|
24
|
+
}
|
25
|
+
]
|
26
|
+
};
|
27
|
+
|
28
|
+
const chartOptions = {
|
29
|
+
responsive: true,
|
30
|
+
maintainAspectRatio: false, // Allows the chart to resize without maintaining aspect ratio
|
31
|
+
scales: {
|
32
|
+
y: {
|
33
|
+
beginAtZero: true
|
34
|
+
}
|
35
|
+
}
|
36
|
+
};
|
37
|
+
|
38
|
+
onMount(() => {
|
39
|
+
const ctx = canvas.getContext('2d');
|
40
|
+
chart = new Chart(ctx, {
|
41
|
+
type: 'line', // Change this to 'bar' for a bar chart
|
42
|
+
data: chartData,
|
43
|
+
options: chartOptions
|
44
|
+
});
|
45
|
+
});
|
46
|
+
|
47
|
+
// Cleanup when component is destroyed
|
48
|
+
onDestroy(() => {
|
49
|
+
if (chart) {
|
50
|
+
chart.destroy();
|
51
|
+
}
|
52
|
+
});
|
53
|
+
</script>
|
54
|
+
|
55
|
+
<canvas bind:this={canvas} />
|
56
|
+
|
57
|
+
<style>
|
58
|
+
canvas {
|
59
|
+
max-width: 100%;
|
60
|
+
height: auto;
|
61
|
+
}
|
62
|
+
</style>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
/** @typedef {typeof __propDef.props} LineChartProps */
|
2
|
+
/** @typedef {typeof __propDef.events} LineChartEvents */
|
3
|
+
/** @typedef {typeof __propDef.slots} LineChartSlots */
|
4
|
+
export default class LineChart extends SvelteComponentTyped<{
|
5
|
+
data?: {} | undefined;
|
6
|
+
}, {
|
7
|
+
[evt: string]: CustomEvent<any>;
|
8
|
+
}, {}> {
|
9
|
+
}
|
10
|
+
export type LineChartProps = typeof __propDef.props;
|
11
|
+
export type LineChartEvents = typeof __propDef.events;
|
12
|
+
export type LineChartSlots = typeof __propDef.slots;
|
13
|
+
import { SvelteComponentTyped } from "svelte";
|
14
|
+
declare const __propDef: {
|
15
|
+
props: {
|
16
|
+
data?: {} | undefined;
|
17
|
+
};
|
18
|
+
events: {
|
19
|
+
[evt: string]: CustomEvent<any>;
|
20
|
+
};
|
21
|
+
slots: {};
|
22
|
+
};
|
23
|
+
export {};
|
@@ -0,0 +1,75 @@
|
|
1
|
+
<!-- src/PieChart.svelte -->
|
2
|
+
<script>
|
3
|
+
import { onMount, onDestroy } from 'svelte';
|
4
|
+
import { Chart, registerables } from 'chart.js';
|
5
|
+
import ChartDataLabels from 'chartjs-plugin-datalabels';
|
6
|
+
|
7
|
+
export let data = {};
|
8
|
+
export let label = '';
|
9
|
+
export let width = 300;
|
10
|
+
export let height = 300;
|
11
|
+
// Register all necessary components
|
12
|
+
Chart.register(...registerables);
|
13
|
+
Chart.register(ChartDataLabels);
|
14
|
+
let chart;
|
15
|
+
let canvas;
|
16
|
+
|
17
|
+
// Chart configuration
|
18
|
+
const chartData = {
|
19
|
+
labels: Object.keys(data),
|
20
|
+
datasets: [
|
21
|
+
{
|
22
|
+
label: label,
|
23
|
+
data: Object.values(data)
|
24
|
+
}
|
25
|
+
]
|
26
|
+
};
|
27
|
+
|
28
|
+
const chartOptions = {
|
29
|
+
plugins: {
|
30
|
+
legend: {
|
31
|
+
position: 'bottom' // Set legend position to bottom
|
32
|
+
},
|
33
|
+
datalabels: {
|
34
|
+
anchor: 'center',
|
35
|
+
align: 'end',
|
36
|
+
clamp: true,
|
37
|
+
font: {
|
38
|
+
size: 16, // Set the font size here
|
39
|
+
weight: 'bold', // Optional: set font weight
|
40
|
+
family: 'Roboto', // Set the font family to Roboto
|
41
|
+
},
|
42
|
+
formatter: (value) => {
|
43
|
+
return value; // Show the value directly
|
44
|
+
}
|
45
|
+
}
|
46
|
+
},
|
47
|
+
responsive: true,
|
48
|
+
maintainAspectRatio: false // Allows the chart to resize freely
|
49
|
+
};
|
50
|
+
|
51
|
+
onMount(() => {
|
52
|
+
// console.log(chartData);
|
53
|
+
const ctx = canvas.getContext('2d');
|
54
|
+
chart = new Chart(ctx, {
|
55
|
+
type: 'pie', // Set chart type to 'pie'
|
56
|
+
data: chartData,
|
57
|
+
options: chartOptions
|
58
|
+
});
|
59
|
+
});
|
60
|
+
|
61
|
+
onDestroy(() => {
|
62
|
+
if (chart) {
|
63
|
+
chart.destroy();
|
64
|
+
}
|
65
|
+
});
|
66
|
+
</script>
|
67
|
+
|
68
|
+
<canvas bind:this={canvas} {width} {height} />
|
69
|
+
|
70
|
+
<style>
|
71
|
+
canvas {
|
72
|
+
max-width: 100%;
|
73
|
+
height: auto; /* Ensures the canvas takes the full height of the container */
|
74
|
+
}
|
75
|
+
</style>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
/** @typedef {typeof __propDef.props} PieChartProps */
|
2
|
+
/** @typedef {typeof __propDef.events} PieChartEvents */
|
3
|
+
/** @typedef {typeof __propDef.slots} PieChartSlots */
|
4
|
+
export default class PieChart extends SvelteComponentTyped<{
|
5
|
+
label?: string | undefined;
|
6
|
+
width?: number | undefined;
|
7
|
+
height?: number | undefined;
|
8
|
+
data?: {} | undefined;
|
9
|
+
}, {
|
10
|
+
[evt: string]: CustomEvent<any>;
|
11
|
+
}, {}> {
|
12
|
+
}
|
13
|
+
export type PieChartProps = typeof __propDef.props;
|
14
|
+
export type PieChartEvents = typeof __propDef.events;
|
15
|
+
export type PieChartSlots = typeof __propDef.slots;
|
16
|
+
import { SvelteComponentTyped } from "svelte";
|
17
|
+
declare const __propDef: {
|
18
|
+
props: {
|
19
|
+
label?: string | undefined;
|
20
|
+
width?: number | undefined;
|
21
|
+
height?: number | undefined;
|
22
|
+
data?: {} | undefined;
|
23
|
+
};
|
24
|
+
events: {
|
25
|
+
[evt: string]: CustomEvent<any>;
|
26
|
+
};
|
27
|
+
slots: {};
|
28
|
+
};
|
29
|
+
export {};
|
@@ -3,14 +3,14 @@
|
|
3
3
|
/** @typedef {typeof __propDef.slots} CheckboxSlots */
|
4
4
|
export default class Checkbox extends SvelteComponentTyped<{
|
5
5
|
invalid: any;
|
6
|
-
valid: any;
|
7
|
-
feedback: any;
|
8
6
|
disable: any;
|
9
7
|
enable: any;
|
10
|
-
|
8
|
+
valid: any;
|
9
|
+
feedback: any;
|
11
10
|
label?: string | undefined;
|
12
|
-
|
11
|
+
size?: string | undefined;
|
13
12
|
name?: string | undefined;
|
13
|
+
value?: string | undefined;
|
14
14
|
}, {
|
15
15
|
[evt: string]: CustomEvent<any>;
|
16
16
|
}, {}> {
|
@@ -22,14 +22,14 @@ import { SvelteComponentTyped } from "svelte";
|
|
22
22
|
declare const __propDef: {
|
23
23
|
props: {
|
24
24
|
invalid: any;
|
25
|
-
valid: any;
|
26
|
-
feedback: any;
|
27
25
|
disable: any;
|
28
26
|
enable: any;
|
29
|
-
|
27
|
+
valid: any;
|
28
|
+
feedback: any;
|
30
29
|
label?: string | undefined;
|
31
|
-
|
30
|
+
size?: string | undefined;
|
32
31
|
name?: string | undefined;
|
32
|
+
value?: string | undefined;
|
33
33
|
};
|
34
34
|
events: {
|
35
35
|
[evt: string]: CustomEvent<any>;
|
@@ -2,8 +2,8 @@
|
|
2
2
|
/** @typedef {typeof __propDef.events} CardBodyEvents */
|
3
3
|
/** @typedef {typeof __propDef.slots} CardBodySlots */
|
4
4
|
export default class CardBody extends SvelteComponentTyped<{
|
5
|
-
type?: string | undefined;
|
6
5
|
className?: string | undefined;
|
6
|
+
type?: string | undefined;
|
7
7
|
}, {
|
8
8
|
[evt: string]: CustomEvent<any>;
|
9
9
|
}, {
|
@@ -16,8 +16,8 @@ export type CardBodySlots = typeof __propDef.slots;
|
|
16
16
|
import { SvelteComponentTyped } from "svelte";
|
17
17
|
declare const __propDef: {
|
18
18
|
props: {
|
19
|
-
type?: string | undefined;
|
20
19
|
className?: string | undefined;
|
20
|
+
type?: string | undefined;
|
21
21
|
};
|
22
22
|
events: {
|
23
23
|
[evt: string]: CustomEvent<any>;
|