@apexcura/ui-components 0.0.14-Beta21 → 0.0.14-Beta210
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/dist/index.css +15 -0
- package/dist/index.d.mts +36 -7
- package/dist/index.d.ts +36 -7
- package/dist/index.js +781 -107
- package/dist/index.mjs +796 -106
- package/package.json +7 -3
package/dist/index.mjs
CHANGED
|
@@ -13,6 +13,7 @@ var TextElement = (props) => {
|
|
|
13
13
|
placeholder: props.placeholder,
|
|
14
14
|
allowClear: true,
|
|
15
15
|
id: props.name,
|
|
16
|
+
value: props.value,
|
|
16
17
|
prefix: props.prefix,
|
|
17
18
|
type: props.type,
|
|
18
19
|
status: props.status,
|
|
@@ -72,8 +73,7 @@ var NumberElement = (props) => {
|
|
|
72
73
|
{
|
|
73
74
|
placeholder: props.placeholder,
|
|
74
75
|
addonBefore: props.addonBefore,
|
|
75
|
-
|
|
76
|
-
defaultValue: props.defaultValue,
|
|
76
|
+
value: props.value,
|
|
77
77
|
disabled: props.disabled,
|
|
78
78
|
id: props.name,
|
|
79
79
|
prefix: props.prefix,
|
|
@@ -321,11 +321,14 @@ var ButtonElement = (props) => {
|
|
|
321
321
|
return /* @__PURE__ */ React11.createElement(
|
|
322
322
|
"button",
|
|
323
323
|
{
|
|
324
|
-
onClick:
|
|
325
|
-
className: `${props.className ? props.className : ""}
|
|
324
|
+
onClick: props.onClick,
|
|
325
|
+
className: `${props.className ? props.className : ""}`,
|
|
326
|
+
disabled: props.loading,
|
|
327
|
+
style: {
|
|
328
|
+
cursor: props.loading ? "no-drop" : "pointer"
|
|
329
|
+
}
|
|
326
330
|
},
|
|
327
|
-
|
|
328
|
-
props.label
|
|
331
|
+
/* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement("span", { className: props.iconsClassName }, /* @__PURE__ */ React11.createElement("img", { src: props.icon, className: "icon-active" })), props.label)
|
|
329
332
|
);
|
|
330
333
|
};
|
|
331
334
|
|
|
@@ -467,10 +470,19 @@ var Sidebar = (props) => {
|
|
|
467
470
|
props.onChange(item);
|
|
468
471
|
}
|
|
469
472
|
};
|
|
470
|
-
return /* @__PURE__ */ React13.createElement(
|
|
471
|
-
return /* @__PURE__ */ React13.createElement(
|
|
472
|
-
|
|
473
|
-
|
|
473
|
+
return /* @__PURE__ */ React13.createElement(React13.Fragment, { key: props.name }, /* @__PURE__ */ React13.createElement("div", { className: props.imgClassName }, /* @__PURE__ */ React13.createElement("img", { src: props.img, alt: "logo" })), /* @__PURE__ */ React13.createElement("div", { className: props.listClassName }, props.items?.map((item) => {
|
|
474
|
+
return /* @__PURE__ */ React13.createElement(React13.Fragment, { key: item.label }, /* @__PURE__ */ React13.createElement(
|
|
475
|
+
ButtonElement,
|
|
476
|
+
{
|
|
477
|
+
...item,
|
|
478
|
+
className: item.active ? props.activeClassName : props.className,
|
|
479
|
+
iconsClassName: props.iconsClassName,
|
|
480
|
+
onClick: (e) => {
|
|
481
|
+
e.preventDefault();
|
|
482
|
+
handleChange(item);
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
));
|
|
474
486
|
})));
|
|
475
487
|
};
|
|
476
488
|
|
|
@@ -535,7 +547,7 @@ var Navbar = (props) => {
|
|
|
535
547
|
};
|
|
536
548
|
|
|
537
549
|
// src/Components/TableElement.tsx
|
|
538
|
-
import React20, { useState as useState5 } from "react";
|
|
550
|
+
import React20, { useState as useState5, useEffect as useEffect2 } from "react";
|
|
539
551
|
import { Table as Table2 } from "antd";
|
|
540
552
|
|
|
541
553
|
// src/Components/Model.tsx
|
|
@@ -544,18 +556,48 @@ import { Modal } from "antd";
|
|
|
544
556
|
|
|
545
557
|
// src/Components/ModelBody.tsx
|
|
546
558
|
import React18 from "react";
|
|
559
|
+
import moment from "moment";
|
|
547
560
|
var ModelBody = (props) => {
|
|
548
|
-
return /* @__PURE__ */ React18.createElement("div", { className: props.modalContent && props.modalContent.className }, props.modalContent && props.modalContent.fields.map(
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
561
|
+
return /* @__PURE__ */ React18.createElement("div", { className: props.modalContent && props.modalContent.className }, props.modalContent && props.modalContent.fields.map(
|
|
562
|
+
(eachField) => {
|
|
563
|
+
if (eachField.element === "div") {
|
|
564
|
+
return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement("div", { className: eachField.className }, eachField.label), eachField.dateTime ? /* @__PURE__ */ React18.createElement(
|
|
565
|
+
"p",
|
|
566
|
+
{
|
|
567
|
+
style: {
|
|
568
|
+
fontSize: "10px",
|
|
569
|
+
textAlign: eachField.source === "bot" ? "left" : "right"
|
|
570
|
+
}
|
|
571
|
+
},
|
|
572
|
+
moment(eachField.dateTime).format("LT")
|
|
573
|
+
) : "");
|
|
574
|
+
} else if (eachField.element === "input-radio") {
|
|
575
|
+
return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement("div", { className: eachField.className }, /* @__PURE__ */ React18.createElement(RadioElement, { ...eachField })), eachField.dateTime ? /* @__PURE__ */ React18.createElement(
|
|
576
|
+
"p",
|
|
577
|
+
{
|
|
578
|
+
style: {
|
|
579
|
+
fontSize: "10px",
|
|
580
|
+
textAlign: eachField.source === "bot" ? "left" : "right"
|
|
581
|
+
}
|
|
582
|
+
},
|
|
583
|
+
moment(eachField.dateTime).format("LT")
|
|
584
|
+
) : "");
|
|
585
|
+
} else if (eachField.element === "button") {
|
|
586
|
+
return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement("div", { className: eachField.className }, /* @__PURE__ */ React18.createElement(ButtonElement, { ...eachField })), eachField.dateTime ? /* @__PURE__ */ React18.createElement(
|
|
587
|
+
"p",
|
|
588
|
+
{
|
|
589
|
+
style: {
|
|
590
|
+
fontSize: "10px",
|
|
591
|
+
textAlign: eachField.source === "bot" ? "left" : "right"
|
|
592
|
+
}
|
|
593
|
+
},
|
|
594
|
+
moment(eachField.dateTime).format("LT")
|
|
595
|
+
) : "");
|
|
596
|
+
} else {
|
|
597
|
+
return null;
|
|
598
|
+
}
|
|
557
599
|
}
|
|
558
|
-
|
|
600
|
+
));
|
|
559
601
|
};
|
|
560
602
|
|
|
561
603
|
// src/Components/Model.tsx
|
|
@@ -580,9 +622,22 @@ var ModelElement = (props) => {
|
|
|
580
622
|
margin: "-10px"
|
|
581
623
|
}
|
|
582
624
|
},
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
625
|
+
columns.map((eachColumn) => {
|
|
626
|
+
if (!["index", "View"].includes(eachColumn.key) && eachColumn?.["is_detail"] !== false) {
|
|
627
|
+
return /* @__PURE__ */ React19.createElement("p", { style: { fontWeight: "500", padding: "10px" } }, /* @__PURE__ */ React19.createElement(
|
|
628
|
+
"span",
|
|
629
|
+
{
|
|
630
|
+
style: {
|
|
631
|
+
fontWeight: "200",
|
|
632
|
+
color: "gray",
|
|
633
|
+
paddingRight: "10px"
|
|
634
|
+
}
|
|
635
|
+
},
|
|
636
|
+
eachColumn.title
|
|
637
|
+
), selectedRecord[eachColumn.key] !== "" ? selectedRecord[eachColumn.key] : "--");
|
|
638
|
+
} else {
|
|
639
|
+
return null;
|
|
640
|
+
}
|
|
586
641
|
})
|
|
587
642
|
)
|
|
588
643
|
},
|
|
@@ -591,15 +646,30 @@ var ModelElement = (props) => {
|
|
|
591
646
|
};
|
|
592
647
|
|
|
593
648
|
// src/Components/TableElement.tsx
|
|
649
|
+
import { EyeOutlined } from "@ant-design/icons";
|
|
594
650
|
var TableElement = (props) => {
|
|
595
651
|
const { thead, tbody } = props;
|
|
596
652
|
const [selectedRecord, setSelectedRecord] = useState5({});
|
|
597
653
|
const [model, setModel] = useState5(false);
|
|
598
|
-
const [
|
|
654
|
+
const [dataSource, setDataSource] = useState5([]);
|
|
655
|
+
console.log(props.value);
|
|
656
|
+
const defaultVal = props.value;
|
|
657
|
+
useEffect2(() => {
|
|
658
|
+
if (tbody) {
|
|
659
|
+
setDataSource(
|
|
660
|
+
tbody.map((row, index) => ({
|
|
661
|
+
...row,
|
|
662
|
+
key: index,
|
|
663
|
+
index: index + 1
|
|
664
|
+
}))
|
|
665
|
+
);
|
|
666
|
+
}
|
|
667
|
+
}, [tbody]);
|
|
599
668
|
const handleChange = (record) => {
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
669
|
+
if (record) {
|
|
670
|
+
props.onChange && props.onChange(record);
|
|
671
|
+
} else {
|
|
672
|
+
props.onChange && props.onChange(defaultVal);
|
|
603
673
|
}
|
|
604
674
|
};
|
|
605
675
|
let columns = [];
|
|
@@ -607,106 +677,153 @@ var TableElement = (props) => {
|
|
|
607
677
|
columns = [
|
|
608
678
|
{
|
|
609
679
|
title: "#",
|
|
610
|
-
dataIndex: "
|
|
611
|
-
key: "
|
|
680
|
+
dataIndex: "index",
|
|
681
|
+
key: "index",
|
|
682
|
+
fixed: "left"
|
|
612
683
|
},
|
|
613
684
|
...thead.map((col, ind) => ({
|
|
614
685
|
title: col.label,
|
|
615
686
|
dataIndex: col.name,
|
|
616
687
|
key: col.key,
|
|
688
|
+
ellipsis: col.ellipsis,
|
|
617
689
|
render: col.render,
|
|
618
690
|
sorter: {
|
|
619
691
|
compare: (a, b) => {
|
|
620
|
-
if (typeof a[col.key] === "number" && typeof
|
|
692
|
+
if (typeof a[col.key] === "number" && typeof b[col.key] === "number") {
|
|
621
693
|
return a[col.key] - b[col.key];
|
|
622
|
-
} else if (typeof a[col.key] === "string" && typeof
|
|
694
|
+
} else if (typeof a[col.key] === "string" && typeof b[col.key] === "string") {
|
|
623
695
|
return a[col.key].localeCompare(b[col.key]);
|
|
624
696
|
}
|
|
625
697
|
}
|
|
626
698
|
}
|
|
627
|
-
}))
|
|
628
|
-
|
|
699
|
+
}))
|
|
700
|
+
];
|
|
701
|
+
if (props.view) {
|
|
702
|
+
columns.push({
|
|
629
703
|
title: "View",
|
|
630
704
|
dataIndex: "View",
|
|
631
705
|
key: "View",
|
|
632
|
-
render: (_, record) =>
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
706
|
+
render: (_, record) => {
|
|
707
|
+
return /* @__PURE__ */ React20.createElement(
|
|
708
|
+
"a",
|
|
709
|
+
{
|
|
710
|
+
onClick: () => {
|
|
711
|
+
if (props.view) {
|
|
712
|
+
setSelectedRecord(record);
|
|
713
|
+
handleChange(record);
|
|
714
|
+
setModel(true);
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
},
|
|
718
|
+
/* @__PURE__ */ React20.createElement(EyeOutlined, null)
|
|
719
|
+
);
|
|
720
|
+
}
|
|
721
|
+
});
|
|
722
|
+
}
|
|
645
723
|
}
|
|
646
|
-
const
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
724
|
+
const onChangeTable = (pagination, filters, sorter, extra) => {
|
|
725
|
+
if (extra && extra.currentDataSource) {
|
|
726
|
+
setDataSource(
|
|
727
|
+
extra.currentDataSource.map((row, index) => ({
|
|
728
|
+
...row,
|
|
729
|
+
index: index + 1
|
|
730
|
+
}))
|
|
731
|
+
);
|
|
732
|
+
}
|
|
733
|
+
};
|
|
651
734
|
const onChangePage = (page, pageSize) => {
|
|
652
735
|
if (props.onChange) {
|
|
653
736
|
props.onChange({ name: "pagination", page, pageSize });
|
|
654
737
|
}
|
|
655
738
|
};
|
|
656
|
-
const onSelectChange = (newSelectedRowKeys) => {
|
|
657
|
-
console.log("selectedRowKeys changed: ", newSelectedRowKeys);
|
|
658
|
-
setSelectedRowKeys(newSelectedRowKeys);
|
|
659
|
-
};
|
|
660
739
|
const rowSelectionConfig = props.rowSelection ? {
|
|
661
|
-
selectedRowKeys,
|
|
662
|
-
|
|
740
|
+
onChange: (selectedRowKeys, selectedRows) => {
|
|
741
|
+
console.log(
|
|
742
|
+
`selectedRowKeys: ${selectedRowKeys}`,
|
|
743
|
+
"selectedRows: ",
|
|
744
|
+
selectedRows
|
|
745
|
+
);
|
|
746
|
+
if (props.onChange) {
|
|
747
|
+
props.onChange(selectedRows);
|
|
748
|
+
}
|
|
749
|
+
}
|
|
663
750
|
} : void 0;
|
|
664
751
|
return /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(
|
|
665
752
|
Table2,
|
|
666
753
|
{
|
|
667
|
-
|
|
754
|
+
loading: props.loading,
|
|
755
|
+
className: props.className,
|
|
756
|
+
pagination: props.pagination ? {
|
|
757
|
+
defaultCurrent: props.value && props.value.page,
|
|
668
758
|
showTotal: (total) => `Total: ${total} items`,
|
|
669
|
-
total: count,
|
|
670
|
-
showSizeChanger: count > 10,
|
|
759
|
+
total: props.count,
|
|
760
|
+
showSizeChanger: props.count ? props.count > 10 : 0 > 10,
|
|
671
761
|
onChange: onChangePage
|
|
762
|
+
} : false,
|
|
763
|
+
onRow: (record) => {
|
|
764
|
+
return {
|
|
765
|
+
onClick: () => {
|
|
766
|
+
if (props.view) {
|
|
767
|
+
setSelectedRecord(record);
|
|
768
|
+
handleChange(record);
|
|
769
|
+
setModel(true);
|
|
770
|
+
}
|
|
771
|
+
},
|
|
772
|
+
style: { cursor: "pointer" }
|
|
773
|
+
};
|
|
672
774
|
},
|
|
775
|
+
rowSelection: rowSelectionConfig,
|
|
673
776
|
dataSource,
|
|
674
777
|
columns,
|
|
778
|
+
size: props.size,
|
|
675
779
|
bordered: true,
|
|
676
|
-
|
|
677
|
-
|
|
780
|
+
onChange: onChangeTable
|
|
781
|
+
}
|
|
782
|
+
), model && /* @__PURE__ */ React20.createElement(
|
|
783
|
+
ModelElement,
|
|
784
|
+
{
|
|
785
|
+
selectedRecord,
|
|
786
|
+
...props,
|
|
787
|
+
columns,
|
|
788
|
+
model,
|
|
789
|
+
onCancel: () => setModel(false)
|
|
678
790
|
}
|
|
679
|
-
)
|
|
791
|
+
));
|
|
680
792
|
};
|
|
681
793
|
|
|
682
794
|
// src/Components/DatePicker.tsx
|
|
683
795
|
import React21, { useState as useState6 } from "react";
|
|
684
796
|
import { DatePicker } from "antd";
|
|
797
|
+
import dayjs from "dayjs";
|
|
798
|
+
import customParseFormat from "dayjs/plugin/customParseFormat.js";
|
|
799
|
+
import moment2 from "moment";
|
|
800
|
+
dayjs.extend(customParseFormat);
|
|
685
801
|
var DatePickerElement = (props) => {
|
|
686
|
-
const [
|
|
687
|
-
const
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
console.log("date==", date2);
|
|
692
|
-
const formattedDate = date2.format(dateFormat);
|
|
693
|
-
setDate(date2);
|
|
802
|
+
const [dateState, setDateState] = useState6("");
|
|
803
|
+
const handleChange = (date, dateString) => {
|
|
804
|
+
if (date) {
|
|
805
|
+
const formattedDate = dateString;
|
|
806
|
+
setDateState(date);
|
|
694
807
|
if (props.onChange) {
|
|
695
808
|
props.onChange(formattedDate);
|
|
696
809
|
}
|
|
697
810
|
} else {
|
|
698
|
-
|
|
811
|
+
setDateState("");
|
|
699
812
|
if (props.onChange) {
|
|
700
813
|
props.onChange("");
|
|
701
814
|
}
|
|
702
815
|
}
|
|
703
816
|
};
|
|
817
|
+
const disabledDate = (current) => {
|
|
818
|
+
return current && current > moment2();
|
|
819
|
+
};
|
|
704
820
|
return /* @__PURE__ */ React21.createElement("div", null, /* @__PURE__ */ React21.createElement(
|
|
705
821
|
DatePicker,
|
|
706
822
|
{
|
|
823
|
+
disabledDate,
|
|
707
824
|
placeholder: props.placeholder,
|
|
708
|
-
value:
|
|
709
|
-
|
|
825
|
+
value: dateState,
|
|
826
|
+
format: { format: "DD-MM-YYYY" },
|
|
710
827
|
onChange: handleChange
|
|
711
828
|
}
|
|
712
829
|
));
|
|
@@ -715,29 +832,51 @@ var DatePickerElement = (props) => {
|
|
|
715
832
|
// src/Components/DateRangePickerElement.tsx
|
|
716
833
|
import React22 from "react";
|
|
717
834
|
import { DatePicker as DatePicker2, Space } from "antd";
|
|
718
|
-
import
|
|
835
|
+
import dayjs2 from "dayjs";
|
|
836
|
+
import moment3 from "moment";
|
|
719
837
|
var DateRangePickerElement = (props) => {
|
|
838
|
+
const { value } = props;
|
|
720
839
|
const { RangePicker } = DatePicker2;
|
|
721
840
|
const handleChange = (dates, dateStrings) => {
|
|
722
|
-
|
|
723
|
-
|
|
841
|
+
console.log(dateStrings);
|
|
842
|
+
if (dates) {
|
|
843
|
+
const formattedDate = [];
|
|
844
|
+
formattedDate.push(moment3(dateStrings[0]).format("DD-MM-YYYY"));
|
|
845
|
+
formattedDate.push(moment3(dateStrings[1]).format("DD-MM-YYYY"));
|
|
846
|
+
console.log("formattedDate", formattedDate);
|
|
847
|
+
props.onChange && props.onChange(formattedDate);
|
|
724
848
|
} else {
|
|
725
|
-
|
|
849
|
+
props.onChange && props.onChange(["", ""]);
|
|
726
850
|
}
|
|
727
851
|
};
|
|
728
852
|
const rangePresets = [
|
|
729
|
-
{ label: "Last 7 Days", value: [
|
|
730
|
-
{ label: "Last 14 Days", value: [
|
|
731
|
-
{ label: "Last 30 Days", value: [
|
|
732
|
-
{ label: "Last 90 Days", value: [
|
|
853
|
+
{ label: "Last 7 Days", value: [dayjs2().add(-7, "d"), dayjs2()] },
|
|
854
|
+
{ label: "Last 14 Days", value: [dayjs2().add(-14, "d"), dayjs2()] },
|
|
855
|
+
{ label: "Last 30 Days", value: [dayjs2().add(-30, "d"), dayjs2()] },
|
|
856
|
+
{ label: "Last 90 Days", value: [dayjs2().add(-90, "d"), dayjs2()] }
|
|
733
857
|
];
|
|
734
|
-
|
|
858
|
+
const disabledDate = (current) => {
|
|
859
|
+
return current && current > dayjs2();
|
|
860
|
+
};
|
|
861
|
+
return /* @__PURE__ */ React22.createElement(Space, { direction: "vertical", size: 12 }, /* @__PURE__ */ React22.createElement(
|
|
862
|
+
RangePicker,
|
|
863
|
+
{
|
|
864
|
+
disabledDate,
|
|
865
|
+
presets: rangePresets,
|
|
866
|
+
format: { format: "DD-MM-YYYY" },
|
|
867
|
+
onChange: handleChange,
|
|
868
|
+
value: value && value.length === 2 && [
|
|
869
|
+
dayjs2(value[0], "DD-MM-YYYY"),
|
|
870
|
+
dayjs2(value[1], "DD-MM-YYYY")
|
|
871
|
+
]
|
|
872
|
+
}
|
|
873
|
+
));
|
|
735
874
|
};
|
|
736
875
|
|
|
737
876
|
// src/Components/Image.tsx
|
|
738
877
|
import React23 from "react";
|
|
739
878
|
var Image = (props) => {
|
|
740
|
-
return /* @__PURE__ */ React23.createElement("
|
|
879
|
+
return /* @__PURE__ */ React23.createElement("img", { className: props.className, src: props.img, alt: "image" });
|
|
741
880
|
};
|
|
742
881
|
|
|
743
882
|
// src/Components/SingleCheckbox.tsx
|
|
@@ -756,60 +895,64 @@ var SingleCheckbox = (props) => {
|
|
|
756
895
|
import React25, { useState as useState7 } from "react";
|
|
757
896
|
import { Select as Select4 } from "antd";
|
|
758
897
|
var DropDownGroup = (props) => {
|
|
759
|
-
const [selectedValue, setSelectedValue] = useState7({
|
|
760
|
-
|
|
898
|
+
const [selectedValue, setSelectedValue] = useState7({
|
|
899
|
+
firstValue: {},
|
|
900
|
+
secondValue: {},
|
|
901
|
+
temp: ""
|
|
902
|
+
});
|
|
761
903
|
const handleFirstChange = (value) => {
|
|
762
|
-
|
|
904
|
+
console.log(selectedValue.temp);
|
|
905
|
+
const filterOption2 = props.firstOptions?.find(
|
|
906
|
+
(eachOption) => eachOption.value === value
|
|
907
|
+
);
|
|
763
908
|
setSelectedValue((prev) => {
|
|
764
909
|
const newValue = { ...prev, firstValue: filterOption2 };
|
|
910
|
+
const { temp, ...rest } = newValue;
|
|
765
911
|
if (newValue.firstValue) {
|
|
766
|
-
props.onChange?.(
|
|
912
|
+
props.onChange?.(rest);
|
|
767
913
|
}
|
|
768
914
|
return newValue;
|
|
769
915
|
});
|
|
770
916
|
};
|
|
771
917
|
const handleSecondChange = (value) => {
|
|
772
|
-
const filterOption2 = props.secondOptions?.find(
|
|
918
|
+
const filterOption2 = props.secondOptions?.find(
|
|
919
|
+
(eachOption) => eachOption.value === value
|
|
920
|
+
);
|
|
773
921
|
setSelectedValue((prev) => {
|
|
774
922
|
const newValue = { ...prev, secondValue: filterOption2 };
|
|
923
|
+
const { temp, ...rest } = newValue;
|
|
775
924
|
if (newValue.secondValue) {
|
|
776
|
-
props.onChange?.(
|
|
925
|
+
props.onChange?.(rest);
|
|
777
926
|
}
|
|
778
927
|
return newValue;
|
|
779
928
|
});
|
|
780
929
|
};
|
|
781
|
-
return /* @__PURE__ */ React25.createElement("div", { className: props.
|
|
930
|
+
return /* @__PURE__ */ React25.createElement("div", { className: props.containerClassName }, props.label && /* @__PURE__ */ React25.createElement("label", { htmlFor: props.name, className: props.labelClassName }, props.label), /* @__PURE__ */ React25.createElement("div", { className: props.subContainerClassName }, /* @__PURE__ */ React25.createElement(
|
|
782
931
|
Select4,
|
|
783
932
|
{
|
|
784
933
|
onChange: handleFirstChange,
|
|
785
934
|
variant: props.variant,
|
|
786
|
-
options: props.firstOptions
|
|
935
|
+
options: props.firstOptions,
|
|
936
|
+
className: props.className
|
|
787
937
|
}
|
|
788
938
|
), /* @__PURE__ */ React25.createElement("div", { style: { borderLeft: "1px solid gray", height: "33px" } }), /* @__PURE__ */ React25.createElement(
|
|
789
939
|
Select4,
|
|
790
940
|
{
|
|
791
941
|
onChange: handleSecondChange,
|
|
792
942
|
variant: props.variant,
|
|
793
|
-
options: props.secondOptions
|
|
943
|
+
options: props.secondOptions,
|
|
944
|
+
className: props.className
|
|
794
945
|
}
|
|
795
|
-
));
|
|
946
|
+
)));
|
|
796
947
|
};
|
|
797
948
|
|
|
798
949
|
// src/Components/FilesUpload.tsx
|
|
799
950
|
import React26, { useState as useState8 } from "react";
|
|
800
|
-
import { Upload
|
|
951
|
+
import { Upload } from "antd";
|
|
801
952
|
import { InboxOutlined } from "@ant-design/icons";
|
|
802
953
|
var FileUpload = (props) => {
|
|
803
954
|
const { Dragger } = Upload;
|
|
804
955
|
const [files, setFiles] = useState8([]);
|
|
805
|
-
const beforeUpload = (file) => {
|
|
806
|
-
const isCorrectFile = ["image/*", "video/*", "application/*"].includes(file.type);
|
|
807
|
-
if (!isCorrectFile) {
|
|
808
|
-
message.error(`(${file.name}) is an invalid file. Please upload files with the following extensions only (.png/.jpg/.jpeg/.pdf)`);
|
|
809
|
-
return Upload.LIST_IGNORE;
|
|
810
|
-
}
|
|
811
|
-
return true;
|
|
812
|
-
};
|
|
813
956
|
const handleChange = ({ fileList }) => {
|
|
814
957
|
setFiles(fileList);
|
|
815
958
|
if (props.onChange) {
|
|
@@ -833,7 +976,6 @@ var FileUpload = (props) => {
|
|
|
833
976
|
maxCount: props.max_count,
|
|
834
977
|
multiple: props.multiple,
|
|
835
978
|
fileList: files,
|
|
836
|
-
beforeUpload,
|
|
837
979
|
onChange: handleChange,
|
|
838
980
|
showUploadList: true,
|
|
839
981
|
customRequest
|
|
@@ -862,22 +1004,569 @@ var onChange = (checked) => {
|
|
|
862
1004
|
console.log(`switch to ${checked}`);
|
|
863
1005
|
};
|
|
864
1006
|
var SwitchElement = () => /* @__PURE__ */ React28.createElement(Switch, { defaultChecked: true, onChange });
|
|
1007
|
+
|
|
1008
|
+
// src/Components/Upload.tsx
|
|
1009
|
+
import React29, { useState as useState9 } from "react";
|
|
1010
|
+
var Upload2 = (props) => {
|
|
1011
|
+
const [file, setFile] = useState9();
|
|
1012
|
+
const handleFileChange = (e) => {
|
|
1013
|
+
setFile(e.target.files[0]);
|
|
1014
|
+
if (props.onChange) {
|
|
1015
|
+
props.onChange(e.target.files[0]);
|
|
1016
|
+
}
|
|
1017
|
+
};
|
|
1018
|
+
const handleUpload = async () => {
|
|
1019
|
+
if (!file) {
|
|
1020
|
+
console.error("No file selected");
|
|
1021
|
+
return;
|
|
1022
|
+
}
|
|
1023
|
+
};
|
|
1024
|
+
return /* @__PURE__ */ React29.createElement("div", { style: { marginTop: 16 } }, /* @__PURE__ */ React29.createElement("input", { type: "file", onChange: handleFileChange }), /* @__PURE__ */ React29.createElement(
|
|
1025
|
+
"button",
|
|
1026
|
+
{
|
|
1027
|
+
type: "button",
|
|
1028
|
+
onClick: handleUpload,
|
|
1029
|
+
disabled: !file,
|
|
1030
|
+
style: { marginTop: 16 }
|
|
1031
|
+
},
|
|
1032
|
+
"Upload"
|
|
1033
|
+
));
|
|
1034
|
+
};
|
|
1035
|
+
|
|
1036
|
+
// src/Components/OtpElement.tsx
|
|
1037
|
+
import React30, { useState as useState10, useRef, useEffect as useEffect3 } from "react";
|
|
1038
|
+
import { Input as Input3 } from "antd";
|
|
1039
|
+
var OtpElement = (props) => {
|
|
1040
|
+
const length = props.length;
|
|
1041
|
+
const [otp, setOtp] = useState10(Array(length).fill(""));
|
|
1042
|
+
const inputRefs = useRef([]);
|
|
1043
|
+
const handleChange = (e, index) => {
|
|
1044
|
+
const value = e.target.value;
|
|
1045
|
+
if (/^[0-9]$/.test(value) || value === "") {
|
|
1046
|
+
const newOtp = [...otp];
|
|
1047
|
+
newOtp[index] = value;
|
|
1048
|
+
setOtp(newOtp);
|
|
1049
|
+
props.onChange && props.onChange(newOtp.join(""));
|
|
1050
|
+
if (value && index < length - 1) {
|
|
1051
|
+
inputRefs.current[index + 1]?.focus();
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
};
|
|
1055
|
+
const handleKeyDown = (e, index) => {
|
|
1056
|
+
if (e.key === "Backspace" && !otp[index] && index > 0) {
|
|
1057
|
+
inputRefs.current[index - 1]?.focus();
|
|
1058
|
+
}
|
|
1059
|
+
};
|
|
1060
|
+
const handlePaste = (e) => {
|
|
1061
|
+
e.preventDefault();
|
|
1062
|
+
const pasteData = e.clipboardData.getData("text");
|
|
1063
|
+
if (/^\d+$/.test(pasteData)) {
|
|
1064
|
+
const newOtp = pasteData.split("").slice(0, length);
|
|
1065
|
+
setOtp(newOtp.concat(Array(length - newOtp.length).fill("")));
|
|
1066
|
+
props.onChange && props.onChange(newOtp.join(""));
|
|
1067
|
+
newOtp.forEach((_, idx) => {
|
|
1068
|
+
if (inputRefs.current[idx]) {
|
|
1069
|
+
inputRefs.current[idx]?.focus();
|
|
1070
|
+
}
|
|
1071
|
+
});
|
|
1072
|
+
}
|
|
1073
|
+
};
|
|
1074
|
+
useEffect3(() => {
|
|
1075
|
+
inputRefs.current[0]?.focus();
|
|
1076
|
+
}, []);
|
|
1077
|
+
return /* @__PURE__ */ React30.createElement("div", { className: props.containerClassName }, Array.from({ length }).map((_, index) => /* @__PURE__ */ React30.createElement(
|
|
1078
|
+
Input3,
|
|
1079
|
+
{
|
|
1080
|
+
key: index,
|
|
1081
|
+
className: props.className,
|
|
1082
|
+
maxLength: 1,
|
|
1083
|
+
value: otp[index],
|
|
1084
|
+
onChange: (e) => handleChange(e, index),
|
|
1085
|
+
onKeyDown: (e) => handleKeyDown(e, index),
|
|
1086
|
+
onPaste: handlePaste,
|
|
1087
|
+
ref: (el) => inputRefs.current[index] = el
|
|
1088
|
+
}
|
|
1089
|
+
)));
|
|
1090
|
+
};
|
|
1091
|
+
|
|
1092
|
+
// src/Components/CircleDonut.tsx
|
|
1093
|
+
import React31 from "react";
|
|
1094
|
+
import { Doughnut } from "react-chartjs-2";
|
|
1095
|
+
import {
|
|
1096
|
+
Chart as ChartJS,
|
|
1097
|
+
DoughnutController,
|
|
1098
|
+
ArcElement,
|
|
1099
|
+
Tooltip,
|
|
1100
|
+
Legend
|
|
1101
|
+
} from "chart.js";
|
|
1102
|
+
ChartJS.register(DoughnutController, ArcElement, Tooltip, Legend);
|
|
1103
|
+
var CircleDonut = (props) => {
|
|
1104
|
+
const data = {
|
|
1105
|
+
labels: props.labels,
|
|
1106
|
+
datasets: [
|
|
1107
|
+
{
|
|
1108
|
+
label: "Bot Conversation",
|
|
1109
|
+
data: props.data,
|
|
1110
|
+
backgroundColor: [
|
|
1111
|
+
"#FFCB8A",
|
|
1112
|
+
"#CADBBF",
|
|
1113
|
+
"#8AC1BB",
|
|
1114
|
+
"#FCB0CB",
|
|
1115
|
+
"#CEB0FA"
|
|
1116
|
+
],
|
|
1117
|
+
borderWidth: 0
|
|
1118
|
+
}
|
|
1119
|
+
]
|
|
1120
|
+
};
|
|
1121
|
+
const options = {
|
|
1122
|
+
responsive: true,
|
|
1123
|
+
cutout: "80%",
|
|
1124
|
+
plugins: {
|
|
1125
|
+
legend: {
|
|
1126
|
+
position: "left",
|
|
1127
|
+
labels: {
|
|
1128
|
+
font: {
|
|
1129
|
+
size: 10
|
|
1130
|
+
},
|
|
1131
|
+
boxWidth: 15,
|
|
1132
|
+
generateLabels: (chart) => {
|
|
1133
|
+
const dataset = chart.data.datasets[0];
|
|
1134
|
+
return chart.data.labels.map((label, index) => {
|
|
1135
|
+
const value = dataset.data[index];
|
|
1136
|
+
return {
|
|
1137
|
+
text: `${label}: ${value}`,
|
|
1138
|
+
fillStyle: dataset.backgroundColor[index]
|
|
1139
|
+
};
|
|
1140
|
+
});
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
},
|
|
1144
|
+
tooltip: {
|
|
1145
|
+
enabled: true,
|
|
1146
|
+
callbacks: {
|
|
1147
|
+
label: function(context) {
|
|
1148
|
+
const label = context.label || "";
|
|
1149
|
+
const value = context.raw || 0;
|
|
1150
|
+
return `${label}: ${value}`;
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
};
|
|
1156
|
+
const centerTextPlugin = {
|
|
1157
|
+
id: "centerText",
|
|
1158
|
+
beforeDraw: (chart) => {
|
|
1159
|
+
const { ctx, chartArea: { left, right, top, bottom } } = chart;
|
|
1160
|
+
const width = right - left;
|
|
1161
|
+
const height = bottom - top;
|
|
1162
|
+
const centerX = left + width / 2;
|
|
1163
|
+
const centerY = top + height / 2;
|
|
1164
|
+
ctx.save();
|
|
1165
|
+
ctx.font = "7px Arial";
|
|
1166
|
+
ctx.fillStyle = "blue";
|
|
1167
|
+
ctx.textAlign = "center";
|
|
1168
|
+
ctx.textBaseline = "middle";
|
|
1169
|
+
ctx.fillText("Total Sessions", centerX, centerY - 10);
|
|
1170
|
+
ctx.font = "25px Arial";
|
|
1171
|
+
ctx.fillStyle = "black";
|
|
1172
|
+
ctx.fillText("85", centerX, centerY + 20);
|
|
1173
|
+
ctx.restore();
|
|
1174
|
+
}
|
|
1175
|
+
};
|
|
1176
|
+
return /* @__PURE__ */ React31.createElement("div", { className: props.className }, /* @__PURE__ */ React31.createElement("h1", { className: props.labelClassName }, props.label), /* @__PURE__ */ React31.createElement(Doughnut, { data, options, plugins: [centerTextPlugin] }));
|
|
1177
|
+
};
|
|
1178
|
+
|
|
1179
|
+
// src/Components/SemiCircleDonut.tsx
|
|
1180
|
+
import React32 from "react";
|
|
1181
|
+
import { Doughnut as Doughnut2 } from "react-chartjs-2";
|
|
1182
|
+
import {
|
|
1183
|
+
Chart as ChartJS2,
|
|
1184
|
+
DoughnutController as DoughnutController2,
|
|
1185
|
+
ArcElement as ArcElement2,
|
|
1186
|
+
Tooltip as Tooltip2,
|
|
1187
|
+
Legend as Legend2
|
|
1188
|
+
} from "chart.js";
|
|
1189
|
+
ChartJS2.register(DoughnutController2, ArcElement2, Tooltip2, Legend2);
|
|
1190
|
+
var SemiCircleDonut = (props) => {
|
|
1191
|
+
const data = {
|
|
1192
|
+
labels: [
|
|
1193
|
+
"Registration",
|
|
1194
|
+
"Book Appointment",
|
|
1195
|
+
"Diagnostic Tests",
|
|
1196
|
+
"Hospital Facility",
|
|
1197
|
+
"Others, Prescriptions"
|
|
1198
|
+
],
|
|
1199
|
+
datasets: [
|
|
1200
|
+
{
|
|
1201
|
+
label: "Bot Conversation",
|
|
1202
|
+
data: [30, 10, 27, 40, 12],
|
|
1203
|
+
backgroundColor: [
|
|
1204
|
+
"#FFCB8A",
|
|
1205
|
+
"#CADBBF",
|
|
1206
|
+
"#8AC1BB",
|
|
1207
|
+
"#FCB0CB",
|
|
1208
|
+
"#CEB0FA"
|
|
1209
|
+
],
|
|
1210
|
+
borderWidth: 0
|
|
1211
|
+
}
|
|
1212
|
+
]
|
|
1213
|
+
};
|
|
1214
|
+
const options = {
|
|
1215
|
+
responsive: true,
|
|
1216
|
+
circumference: 180,
|
|
1217
|
+
rotation: -90,
|
|
1218
|
+
cutout: "80%",
|
|
1219
|
+
plugins: {
|
|
1220
|
+
legend: {
|
|
1221
|
+
display: false
|
|
1222
|
+
// Disable the legend
|
|
1223
|
+
},
|
|
1224
|
+
tooltip: {
|
|
1225
|
+
enabled: true,
|
|
1226
|
+
callbacks: {
|
|
1227
|
+
label: function(context) {
|
|
1228
|
+
const label = context.label || "";
|
|
1229
|
+
const value = context.raw || 0;
|
|
1230
|
+
return `${label}: ${value}`;
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
};
|
|
1236
|
+
const centerTextPlugin = {
|
|
1237
|
+
id: "centerText",
|
|
1238
|
+
beforeDraw: (chart) => {
|
|
1239
|
+
const { ctx, chartArea: { left, right, top, bottom } } = chart;
|
|
1240
|
+
const width = right - left;
|
|
1241
|
+
const height = bottom - top;
|
|
1242
|
+
const centerX = left + width / 2;
|
|
1243
|
+
const centerY = top + height / 1.5;
|
|
1244
|
+
const maxWidth = width * 0.8;
|
|
1245
|
+
ctx.save();
|
|
1246
|
+
ctx.fillStyle = "black";
|
|
1247
|
+
ctx.textAlign = "center";
|
|
1248
|
+
ctx.textBaseline = "middle";
|
|
1249
|
+
const drawText = (text, y, fontSize) => {
|
|
1250
|
+
ctx.font = `${fontSize}px Arial`;
|
|
1251
|
+
const textWidth = ctx.measureText(text).width;
|
|
1252
|
+
if (textWidth > maxWidth) {
|
|
1253
|
+
const newFontSize = fontSize * maxWidth / textWidth;
|
|
1254
|
+
ctx.font = `${newFontSize}px Arial`;
|
|
1255
|
+
}
|
|
1256
|
+
ctx.fillText(text, centerX, y);
|
|
1257
|
+
};
|
|
1258
|
+
drawText(props.fillText1, centerY - 10, 16);
|
|
1259
|
+
drawText(props.fillText2, centerY + 20, 8);
|
|
1260
|
+
ctx.restore();
|
|
1261
|
+
}
|
|
1262
|
+
};
|
|
1263
|
+
return /* @__PURE__ */ React32.createElement("div", { className: props.className }, /* @__PURE__ */ React32.createElement("h1", { className: props.labelClassName }, props.label), /* @__PURE__ */ React32.createElement(Doughnut2, { data, options, plugins: [centerTextPlugin] }));
|
|
1264
|
+
};
|
|
1265
|
+
|
|
1266
|
+
// src/Components/HorizontalBarChart.tsx
|
|
1267
|
+
import React33 from "react";
|
|
1268
|
+
import { Bar } from "react-chartjs-2";
|
|
1269
|
+
import {
|
|
1270
|
+
Chart as ChartJS3,
|
|
1271
|
+
BarElement,
|
|
1272
|
+
CategoryScale,
|
|
1273
|
+
LinearScale,
|
|
1274
|
+
Tooltip as Tooltip3
|
|
1275
|
+
} from "chart.js";
|
|
1276
|
+
ChartJS3.register(BarElement, CategoryScale, LinearScale, Tooltip3);
|
|
1277
|
+
var HorizontalBarChart = (props) => {
|
|
1278
|
+
const data = {
|
|
1279
|
+
labels: ["18-24", "25-34", "35-44", "45-54", "55-64", "65+"],
|
|
1280
|
+
datasets: [
|
|
1281
|
+
{
|
|
1282
|
+
data: [30, 10, 27, 40, 12, 24],
|
|
1283
|
+
backgroundColor: "#6298D5",
|
|
1284
|
+
barThickness: 15
|
|
1285
|
+
}
|
|
1286
|
+
]
|
|
1287
|
+
};
|
|
1288
|
+
const options = {
|
|
1289
|
+
responsive: true,
|
|
1290
|
+
indexAxis: "y",
|
|
1291
|
+
scales: {
|
|
1292
|
+
x: {
|
|
1293
|
+
beginAtZero: true,
|
|
1294
|
+
ticks: {
|
|
1295
|
+
callback: function(value) {
|
|
1296
|
+
return `${value}%`;
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
},
|
|
1300
|
+
y: {
|
|
1301
|
+
grid: {
|
|
1302
|
+
display: false
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
},
|
|
1306
|
+
plugins: {
|
|
1307
|
+
tooltip: {
|
|
1308
|
+
enabled: true,
|
|
1309
|
+
callbacks: {
|
|
1310
|
+
label: function(context) {
|
|
1311
|
+
const label = context.label || "";
|
|
1312
|
+
const value = context.raw || 0;
|
|
1313
|
+
return `${label}: ${value}`;
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
},
|
|
1317
|
+
legend: {
|
|
1318
|
+
display: false
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
};
|
|
1322
|
+
return /* @__PURE__ */ React33.createElement("div", { className: props.className }, /* @__PURE__ */ React33.createElement("h1", { className: props.labelClassName }, props.label), /* @__PURE__ */ React33.createElement(Bar, { data, options }));
|
|
1323
|
+
};
|
|
1324
|
+
|
|
1325
|
+
// src/Components/LineChart.tsx
|
|
1326
|
+
import React34, { useEffect as useEffect4, useRef as useRef2 } from "react";
|
|
1327
|
+
import Chart from "chart.js/auto";
|
|
1328
|
+
var LineChart = (props) => {
|
|
1329
|
+
const chartRef = useRef2(null);
|
|
1330
|
+
const chartInstance = useRef2(null);
|
|
1331
|
+
const data = [
|
|
1332
|
+
{ label: "ROI", data: [10, 13, 20, 15, 10] },
|
|
1333
|
+
{ label: "Engagement Rate", data: [20, 23, 30, 28, 20] },
|
|
1334
|
+
{ label: "Conversion Rate", data: [50, 100, 150, 180, 50] }
|
|
1335
|
+
];
|
|
1336
|
+
const labels = ["Instagram", "Whatsapp", "Messages", "Telegram", "Linkedin"];
|
|
1337
|
+
useEffect4(() => {
|
|
1338
|
+
if (chartRef.current) {
|
|
1339
|
+
if (chartInstance.current) {
|
|
1340
|
+
chartInstance.current.destroy();
|
|
1341
|
+
}
|
|
1342
|
+
chartInstance.current = new Chart(chartRef.current, {
|
|
1343
|
+
type: "line",
|
|
1344
|
+
data: {
|
|
1345
|
+
labels,
|
|
1346
|
+
datasets: data.map((dataset, index) => ({
|
|
1347
|
+
label: dataset.label,
|
|
1348
|
+
data: dataset.data,
|
|
1349
|
+
borderColor: index === 0 ? "#FF8F00" : index === 1 ? "#F50057" : "#254AAA",
|
|
1350
|
+
backgroundColor: "rgba(0, 0, 0, 0)",
|
|
1351
|
+
pointBackgroundColor: index === 0 ? "#FF8F00" : index === 1 ? "#F50057" : "#254AAA",
|
|
1352
|
+
pointBorderColor: "white",
|
|
1353
|
+
pointStyle: "circle",
|
|
1354
|
+
pointRadius: 3,
|
|
1355
|
+
tension: 0.1,
|
|
1356
|
+
fill: true
|
|
1357
|
+
}))
|
|
1358
|
+
},
|
|
1359
|
+
options: {
|
|
1360
|
+
plugins: {
|
|
1361
|
+
legend: {
|
|
1362
|
+
labels: {
|
|
1363
|
+
usePointStyle: true
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
},
|
|
1367
|
+
scales: {
|
|
1368
|
+
x: {
|
|
1369
|
+
grid: {
|
|
1370
|
+
display: false
|
|
1371
|
+
}
|
|
1372
|
+
},
|
|
1373
|
+
y: {
|
|
1374
|
+
beginAtZero: true,
|
|
1375
|
+
suggestedMax: 200,
|
|
1376
|
+
ticks: {
|
|
1377
|
+
callback: function(value) {
|
|
1378
|
+
return value + "%";
|
|
1379
|
+
}
|
|
1380
|
+
},
|
|
1381
|
+
grid: {
|
|
1382
|
+
display: true
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
});
|
|
1388
|
+
}
|
|
1389
|
+
return () => {
|
|
1390
|
+
if (chartInstance.current) {
|
|
1391
|
+
chartInstance.current.destroy();
|
|
1392
|
+
}
|
|
1393
|
+
};
|
|
1394
|
+
}, [labels, data]);
|
|
1395
|
+
return /* @__PURE__ */ React34.createElement("div", { className: props.className }, /* @__PURE__ */ React34.createElement("canvas", { ref: chartRef }));
|
|
1396
|
+
};
|
|
1397
|
+
|
|
1398
|
+
// src/Components/DoubleBarChart.tsx
|
|
1399
|
+
import React35, { useEffect as useEffect5, useRef as useRef3 } from "react";
|
|
1400
|
+
import Chart2 from "chart.js/auto";
|
|
1401
|
+
var DoubleBarChart = (props) => {
|
|
1402
|
+
const chartRef = useRef3(null);
|
|
1403
|
+
const chartInstance = useRef3(null);
|
|
1404
|
+
useEffect5(() => {
|
|
1405
|
+
if (chartRef.current) {
|
|
1406
|
+
if (chartInstance.current) {
|
|
1407
|
+
chartInstance.current.destroy();
|
|
1408
|
+
}
|
|
1409
|
+
chartInstance.current = new Chart2(chartRef.current, {
|
|
1410
|
+
type: "bar",
|
|
1411
|
+
data: {
|
|
1412
|
+
labels: [
|
|
1413
|
+
"Summer Health Tips",
|
|
1414
|
+
"New Services Launch",
|
|
1415
|
+
"Discounts on Checkups",
|
|
1416
|
+
"Wellness Webinar",
|
|
1417
|
+
"LinkedIn Insights"
|
|
1418
|
+
],
|
|
1419
|
+
datasets: [
|
|
1420
|
+
{
|
|
1421
|
+
label: "Engagement Rate",
|
|
1422
|
+
data: [60, 70, 50, 80, 65],
|
|
1423
|
+
// Example data for male
|
|
1424
|
+
backgroundColor: "#93B8E2",
|
|
1425
|
+
barThickness: 10
|
|
1426
|
+
},
|
|
1427
|
+
{
|
|
1428
|
+
label: "Conversion Rate",
|
|
1429
|
+
data: [70, 65, 75, 55, 85],
|
|
1430
|
+
// Example data for female
|
|
1431
|
+
backgroundColor: "#4484CD",
|
|
1432
|
+
barThickness: 10
|
|
1433
|
+
}
|
|
1434
|
+
]
|
|
1435
|
+
},
|
|
1436
|
+
options: {
|
|
1437
|
+
scales: {
|
|
1438
|
+
x: {
|
|
1439
|
+
grid: {
|
|
1440
|
+
display: false
|
|
1441
|
+
// Display x-axis grid lines
|
|
1442
|
+
}
|
|
1443
|
+
},
|
|
1444
|
+
y: {
|
|
1445
|
+
beginAtZero: true,
|
|
1446
|
+
suggestedMax: 100,
|
|
1447
|
+
ticks: {
|
|
1448
|
+
callback: function(value) {
|
|
1449
|
+
return value + "%";
|
|
1450
|
+
}
|
|
1451
|
+
},
|
|
1452
|
+
grid: {
|
|
1453
|
+
display: true
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
},
|
|
1457
|
+
plugins: {
|
|
1458
|
+
legend: {
|
|
1459
|
+
labels: {
|
|
1460
|
+
usePointStyle: true
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
}
|
|
1464
|
+
}
|
|
1465
|
+
});
|
|
1466
|
+
}
|
|
1467
|
+
return () => {
|
|
1468
|
+
if (chartInstance.current) {
|
|
1469
|
+
chartInstance.current.destroy();
|
|
1470
|
+
}
|
|
1471
|
+
};
|
|
1472
|
+
}, []);
|
|
1473
|
+
return /* @__PURE__ */ React35.createElement("div", { className: props.className }, /* @__PURE__ */ React35.createElement("h1", { className: props.labelClassName }, props.label), /* @__PURE__ */ React35.createElement("canvas", { ref: chartRef }));
|
|
1474
|
+
};
|
|
1475
|
+
|
|
1476
|
+
// src/Components/BarChart.tsx
|
|
1477
|
+
import React36 from "react";
|
|
1478
|
+
import { Bar as Bar2 } from "react-chartjs-2";
|
|
1479
|
+
import {
|
|
1480
|
+
Chart as ChartJS4,
|
|
1481
|
+
BarElement as BarElement2,
|
|
1482
|
+
CategoryScale as CategoryScale2,
|
|
1483
|
+
LinearScale as LinearScale2,
|
|
1484
|
+
Tooltip as Tooltip4
|
|
1485
|
+
} from "chart.js";
|
|
1486
|
+
ChartJS4.register(BarElement2, CategoryScale2, LinearScale2, Tooltip4);
|
|
1487
|
+
var BarChart = (props) => {
|
|
1488
|
+
const data = {
|
|
1489
|
+
labels: [
|
|
1490
|
+
"17 June",
|
|
1491
|
+
"18 June",
|
|
1492
|
+
"19 June",
|
|
1493
|
+
"20 June",
|
|
1494
|
+
"21 June",
|
|
1495
|
+
"22 June",
|
|
1496
|
+
"23 June"
|
|
1497
|
+
],
|
|
1498
|
+
datasets: [
|
|
1499
|
+
{
|
|
1500
|
+
data: [30, 100, 270, 140, 120, 240],
|
|
1501
|
+
backgroundColor: "#1565C0",
|
|
1502
|
+
barThickness: 15
|
|
1503
|
+
}
|
|
1504
|
+
]
|
|
1505
|
+
};
|
|
1506
|
+
const options = {
|
|
1507
|
+
responsive: true,
|
|
1508
|
+
scales: {
|
|
1509
|
+
x: {
|
|
1510
|
+
beginAtZero: true,
|
|
1511
|
+
grid: {
|
|
1512
|
+
display: false
|
|
1513
|
+
}
|
|
1514
|
+
},
|
|
1515
|
+
y: {
|
|
1516
|
+
grid: {
|
|
1517
|
+
display: true
|
|
1518
|
+
},
|
|
1519
|
+
ticks: {
|
|
1520
|
+
min: 0,
|
|
1521
|
+
max: 400,
|
|
1522
|
+
stepSize: 200,
|
|
1523
|
+
callback: function(value) {
|
|
1524
|
+
return `${value}`;
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
},
|
|
1529
|
+
plugins: {
|
|
1530
|
+
tooltip: {
|
|
1531
|
+
enabled: true,
|
|
1532
|
+
callbacks: {
|
|
1533
|
+
label: function(context) {
|
|
1534
|
+
const label = context.label || "";
|
|
1535
|
+
const value = context.raw || 0;
|
|
1536
|
+
return ` ${label}: ${value}`;
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
},
|
|
1540
|
+
legend: {
|
|
1541
|
+
display: false
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
};
|
|
1545
|
+
return /* @__PURE__ */ React36.createElement("div", { className: props.className }, /* @__PURE__ */ React36.createElement("h1", { className: props.labelClassName }, props.label), /* @__PURE__ */ React36.createElement(Bar2, { data, options }));
|
|
1546
|
+
};
|
|
865
1547
|
export {
|
|
866
1548
|
AddMoreTable,
|
|
1549
|
+
BarChart,
|
|
867
1550
|
ButtonElement,
|
|
868
1551
|
CheckboxElement,
|
|
1552
|
+
CircleDonut,
|
|
869
1553
|
CkEditor,
|
|
870
1554
|
DatePickerElement,
|
|
871
1555
|
DateRangePickerElement,
|
|
1556
|
+
DoubleBarChart,
|
|
872
1557
|
DropDownGroup,
|
|
873
1558
|
FileUpload,
|
|
1559
|
+
HorizontalBarChart,
|
|
874
1560
|
Image,
|
|
1561
|
+
LineChart,
|
|
875
1562
|
MultipleSelectElement,
|
|
876
1563
|
Navbar,
|
|
877
1564
|
NumberElement,
|
|
1565
|
+
OtpElement,
|
|
878
1566
|
PasswordElement,
|
|
879
1567
|
RadioElement,
|
|
880
1568
|
SelectElement,
|
|
1569
|
+
SemiCircleDonut,
|
|
881
1570
|
Sidebar,
|
|
882
1571
|
SingleCheckbox,
|
|
883
1572
|
SingleSelectElement,
|
|
@@ -885,5 +1574,6 @@ export {
|
|
|
885
1574
|
TableElement,
|
|
886
1575
|
TabsElement,
|
|
887
1576
|
TextElement,
|
|
888
|
-
TextareaElement
|
|
1577
|
+
TextareaElement,
|
|
1578
|
+
Upload2 as Upload
|
|
889
1579
|
};
|