@enki-tek/fms-web-components 0.1.24 → 0.1.26

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,46 @@
1
+ <!-- src/MyChart.svelte -->
2
+ <script>
3
+ import { Chart, registerables } from 'chart.js';
4
+ import { onDestroy, onMount } from 'svelte';
5
+ import { chartOptions, getChartData } from './chartOptions';
6
+
7
+ export let data = {};
8
+ export let label = '';
9
+ export let width = 200;
10
+ export let height = 200;
11
+ export let config = {
12
+ colorCount: 1
13
+ };
14
+ export let type = 'line';
15
+
16
+ // Register all necessary components
17
+ Chart.register(...registerables);
18
+
19
+ let chart;
20
+ let canvas;
21
+
22
+ onMount(() => {
23
+ const ctx = canvas.getContext('2d');
24
+ chart = new Chart(ctx, {
25
+ type: type, // Change this to 'bar' for a bar chart
26
+ data: getChartData({ data, label, config }),
27
+ options: chartOptions
28
+ });
29
+ });
30
+
31
+ // Cleanup when component is destroyed
32
+ onDestroy(() => {
33
+ if (chart) {
34
+ chart.destroy();
35
+ }
36
+ });
37
+ </script>
38
+
39
+ <canvas bind:this={canvas} {width} {height} />
40
+
41
+ <style>
42
+ canvas {
43
+ max-width: 100%;
44
+ height: auto;
45
+ }
46
+ </style>
@@ -0,0 +1,17 @@
1
+ /** @typedef {typeof __propDef.props} ChartProps */
2
+ /** @typedef {typeof __propDef.events} ChartEvents */
3
+ /** @typedef {typeof __propDef.slots} ChartSlots */
4
+ export default class Chart {
5
+ constructor();
6
+ }
7
+ export type ChartProps = typeof __propDef.props;
8
+ export type ChartEvents = typeof __propDef.events;
9
+ export type ChartSlots = typeof __propDef.slots;
10
+ declare const __propDef: {
11
+ props: {};
12
+ events: {
13
+ [evt: string]: CustomEvent<any>;
14
+ };
15
+ slots: {};
16
+ };
17
+ export {};
@@ -4,7 +4,7 @@
4
4
  </script>
5
5
 
6
6
  <span class="{status == 'active' ? "completed-tag" : (status == 'inactive' ? "inactive-tag" :
7
- (status == 'warning' ? "progress-tag" : "overdue-tag")) } badge fw-normal"> {title}</span>
7
+ (status == 'warning' ? "progress-tag" : "overdue-tag")) } badge "> {title}</span>
8
8
 
9
9
  <style>@import url(https://fonts.googleapis.com/icon?family=Material+Icons);
10
10
  @import url("https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap");
@@ -3,9 +3,12 @@
3
3
  export let subtitle;
4
4
  </script>
5
5
 
6
- <div class="column py-2 ">
6
+ <div class="column py-2">
7
7
  <div class="text-black-50">{title}</div>
8
- <div class="text-dark fs-6">{subtitle}</div>
8
+ <div class="text-dark fs-6">
9
+ {subtitle}
10
+ <slot />
11
+ </div>
9
12
  </div>
10
13
 
11
14
  <style>
@@ -6,7 +6,9 @@ export default class SensorWidgetData extends SvelteComponentTyped<{
6
6
  subtitle: any;
7
7
  }, {
8
8
  [evt: string]: CustomEvent<any>;
9
- }, {}> {
9
+ }, {
10
+ default: {};
11
+ }> {
10
12
  }
11
13
  export type SensorWidgetDataProps = typeof __propDef.props;
12
14
  export type SensorWidgetDataEvents = typeof __propDef.events;
@@ -20,6 +22,8 @@ declare const __propDef: {
20
22
  events: {
21
23
  [evt: string]: CustomEvent<any>;
22
24
  };
23
- slots: {};
25
+ slots: {
26
+ default: {};
27
+ };
24
28
  };
25
29
  export {};
package/index.d.ts CHANGED
@@ -83,5 +83,6 @@ import BadgeCard from './components/WidgetCard/BadgeCard.svelte';
83
83
  import AlertFooter from './components/WidgetCard/AlertFooter.svelte';
84
84
  import PlainCard from './components/StatusCard/PlainCard.svelte';
85
85
  import GrayCard from './components/StatusCard/GrayCard.svelte';
86
- export { Accordion, AccordionItem, ActionIcon, ActionIconGroup, Alert, Badge, Brand, Breadcrumb, Button, Card, CardBody, CardFooter, CardIcon, CardiconBody, CardiconSubtitle, CardiconTitle, CardLink, CardSubtitle, CardText, CardTitle, Checkbox, derivedStore, Dropdown, DropdownItem, EnkiCard, EnkiSidebar, EnkiTable, Footer, Header, HeaderItem, Icon, Layout, MainMenuHead, menuTypeStore, Modal, ModalBody, ModalFooter, ModalHeader, NavIcon, NavItem, NavLink, NotFound, Page, Pagination, RadioButton, smallMenuwidth, Switch, Tab, TableBody, TableCell, TableHead, TableHeadCell, TableRow, TextField, Toast, Tooltip, UserAvatar, HeaderDropDownLink, HeaderDropDownLinkItem, HeaderLink, HeaderLinks, Content, MenuGroup, MenuItem, SortableGrid, SideBarMenu, StatusCard, StatusCardBody, StatusCardTitle, StatusCardSubtitle, StateCard, WidgetCard, WidgetCardBody, DoughnutChart, PieChart, BarChart, LineChart, SensorWidgetBody, SensorWidgetTitle, SensorWidgetData, SensorWidgetFooter, BadgeCard, AlertFooter, PlainCard, GrayCard };
86
+ import Chart from './components/Charts/Chart.svelte';
87
+ export { Accordion, AccordionItem, ActionIcon, ActionIconGroup, Alert, Badge, Brand, Breadcrumb, Button, Card, CardBody, CardFooter, CardIcon, CardiconBody, CardiconSubtitle, CardiconTitle, CardLink, CardSubtitle, CardText, CardTitle, Checkbox, derivedStore, Dropdown, DropdownItem, EnkiCard, EnkiSidebar, EnkiTable, Footer, Header, HeaderItem, Icon, Layout, MainMenuHead, menuTypeStore, Modal, ModalBody, ModalFooter, ModalHeader, NavIcon, NavItem, NavLink, NotFound, Page, Pagination, RadioButton, smallMenuwidth, Switch, Tab, TableBody, TableCell, TableHead, TableHeadCell, TableRow, TextField, Toast, Tooltip, UserAvatar, HeaderDropDownLink, HeaderDropDownLinkItem, HeaderLink, HeaderLinks, Content, MenuGroup, MenuItem, SortableGrid, SideBarMenu, StatusCard, StatusCardBody, StatusCardTitle, StatusCardSubtitle, StateCard, WidgetCard, WidgetCardBody, DoughnutChart, PieChart, BarChart, LineChart, SensorWidgetBody, SensorWidgetTitle, SensorWidgetData, SensorWidgetFooter, BadgeCard, AlertFooter, PlainCard, GrayCard, Chart };
87
88
  export default i18nInit;
package/index.js CHANGED
@@ -84,5 +84,6 @@ import BadgeCard from './components/WidgetCard/BadgeCard.svelte';
84
84
  import AlertFooter from './components/WidgetCard/AlertFooter.svelte';
85
85
  import PlainCard from './components/StatusCard/PlainCard.svelte';
86
86
  import GrayCard from './components/StatusCard/GrayCard.svelte';
87
- export { Accordion, AccordionItem, ActionIcon, ActionIconGroup, Alert, Badge, Brand, Breadcrumb, Button, Card, CardBody, CardFooter, CardIcon, CardiconBody, CardiconSubtitle, CardiconTitle, CardLink, CardSubtitle, CardText, CardTitle, Checkbox, derivedStore, Dropdown, DropdownItem, EnkiCard, EnkiSidebar, EnkiTable, Footer, Header, HeaderItem, Icon, Layout, MainMenuHead, menuTypeStore, Modal, ModalBody, ModalFooter, ModalHeader, NavIcon, NavItem, NavLink, NotFound, Page, Pagination, RadioButton, smallMenuwidth, Switch, Tab, TableBody, TableCell, TableHead, TableHeadCell, TableRow, TextField, Toast, Tooltip, UserAvatar, HeaderDropDownLink, HeaderDropDownLinkItem, HeaderLink, HeaderLinks, Content, MenuGroup, MenuItem, SortableGrid, SideBarMenu, StatusCard, StatusCardBody, StatusCardTitle, StatusCardSubtitle, StateCard, WidgetCard, WidgetCardBody, DoughnutChart, PieChart, BarChart, LineChart, SensorWidgetBody, SensorWidgetTitle, SensorWidgetData, SensorWidgetFooter, BadgeCard, AlertFooter, PlainCard, GrayCard };
87
+ import Chart from './components/Charts/Chart.svelte';
88
+ export { Accordion, AccordionItem, ActionIcon, ActionIconGroup, Alert, Badge, Brand, Breadcrumb, Button, Card, CardBody, CardFooter, CardIcon, CardiconBody, CardiconSubtitle, CardiconTitle, CardLink, CardSubtitle, CardText, CardTitle, Checkbox, derivedStore, Dropdown, DropdownItem, EnkiCard, EnkiSidebar, EnkiTable, Footer, Header, HeaderItem, Icon, Layout, MainMenuHead, menuTypeStore, Modal, ModalBody, ModalFooter, ModalHeader, NavIcon, NavItem, NavLink, NotFound, Page, Pagination, RadioButton, smallMenuwidth, Switch, Tab, TableBody, TableCell, TableHead, TableHeadCell, TableRow, TextField, Toast, Tooltip, UserAvatar, HeaderDropDownLink, HeaderDropDownLinkItem, HeaderLink, HeaderLinks, Content, MenuGroup, MenuItem, SortableGrid, SideBarMenu, StatusCard, StatusCardBody, StatusCardTitle, StatusCardSubtitle, StateCard, WidgetCard, WidgetCardBody, DoughnutChart, PieChart, BarChart, LineChart, SensorWidgetBody, SensorWidgetTitle, SensorWidgetData, SensorWidgetFooter, BadgeCard, AlertFooter, PlainCard, GrayCard, Chart };
88
89
  export default i18nInit;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enki-tek/fms-web-components",
3
- "version": "0.1.24",
3
+ "version": "0.1.26",
4
4
  "devDependencies": {
5
5
  "@storybook/addon-essentials": "^7.6.14",
6
6
  "@storybook/addon-interactions": "^7.6.14",
@@ -78,6 +78,7 @@
78
78
  "./components/CardIcon/CardiconSubtitle.svelte": "./components/CardIcon/CardiconSubtitle.svelte",
79
79
  "./components/CardIcon/CardiconTitle.svelte": "./components/CardIcon/CardiconTitle.svelte",
80
80
  "./components/Charts/Barchart.svelte": "./components/Charts/Barchart.svelte",
81
+ "./components/Charts/Chart.svelte": "./components/Charts/Chart.svelte",
81
82
  "./components/Charts/DoughnutChart.svelte": "./components/Charts/DoughnutChart.svelte",
82
83
  "./components/Charts/LineChart.svelte": "./components/Charts/LineChart.svelte",
83
84
  "./components/Charts/PieChart.svelte": "./components/Charts/PieChart.svelte",