@apexcura/ui-components 0.0.14-Beta21 → 0.0.14-Beta211
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 +775 -107
- package/dist/index.mjs +790 -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 }, props.loading ? /* @__PURE__ */ React11.createElement("img", { src: props.icon, className: "icon-active" }) : /* @__PURE__ */ React11.createElement("span", { dangerouslySetInnerHTML: { __html: props.icon || "" } })), 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,45 @@ 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";
|
|
719
836
|
var DateRangePickerElement = (props) => {
|
|
837
|
+
const { value } = props;
|
|
720
838
|
const { RangePicker } = DatePicker2;
|
|
721
839
|
const handleChange = (dates, dateStrings) => {
|
|
722
|
-
if (dates
|
|
723
|
-
props.onChange(dateStrings);
|
|
840
|
+
if (dates) {
|
|
841
|
+
props.onChange && props.onChange(dateStrings);
|
|
724
842
|
} else {
|
|
725
|
-
|
|
843
|
+
props.onChange && props.onChange(["", ""]);
|
|
726
844
|
}
|
|
727
845
|
};
|
|
728
846
|
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: [
|
|
847
|
+
{ label: "Last 7 Days", value: [dayjs2().add(-7, "d"), dayjs2()] },
|
|
848
|
+
{ label: "Last 14 Days", value: [dayjs2().add(-14, "d"), dayjs2()] },
|
|
849
|
+
{ label: "Last 30 Days", value: [dayjs2().add(-30, "d"), dayjs2()] },
|
|
850
|
+
{ label: "Last 90 Days", value: [dayjs2().add(-90, "d"), dayjs2()] }
|
|
733
851
|
];
|
|
734
|
-
|
|
852
|
+
const disabledDate = (current) => {
|
|
853
|
+
return current && current > dayjs2();
|
|
854
|
+
};
|
|
855
|
+
return /* @__PURE__ */ React22.createElement(Space, { direction: "vertical", size: 12 }, /* @__PURE__ */ React22.createElement(
|
|
856
|
+
RangePicker,
|
|
857
|
+
{
|
|
858
|
+
disabledDate,
|
|
859
|
+
presets: rangePresets,
|
|
860
|
+
format: { format: "DD-MM-YYYY" },
|
|
861
|
+
onChange: handleChange,
|
|
862
|
+
value: value && value.length === 2 && [
|
|
863
|
+
dayjs2(value[0]),
|
|
864
|
+
dayjs2(value[1])
|
|
865
|
+
]
|
|
866
|
+
}
|
|
867
|
+
));
|
|
735
868
|
};
|
|
736
869
|
|
|
737
870
|
// src/Components/Image.tsx
|
|
738
871
|
import React23 from "react";
|
|
739
872
|
var Image = (props) => {
|
|
740
|
-
return /* @__PURE__ */ React23.createElement("
|
|
873
|
+
return /* @__PURE__ */ React23.createElement("img", { className: props.className, src: props.img, alt: "image" });
|
|
741
874
|
};
|
|
742
875
|
|
|
743
876
|
// src/Components/SingleCheckbox.tsx
|
|
@@ -756,60 +889,64 @@ var SingleCheckbox = (props) => {
|
|
|
756
889
|
import React25, { useState as useState7 } from "react";
|
|
757
890
|
import { Select as Select4 } from "antd";
|
|
758
891
|
var DropDownGroup = (props) => {
|
|
759
|
-
const [selectedValue, setSelectedValue] = useState7({
|
|
760
|
-
|
|
892
|
+
const [selectedValue, setSelectedValue] = useState7({
|
|
893
|
+
firstValue: {},
|
|
894
|
+
secondValue: {},
|
|
895
|
+
temp: ""
|
|
896
|
+
});
|
|
761
897
|
const handleFirstChange = (value) => {
|
|
762
|
-
|
|
898
|
+
console.log(selectedValue.temp);
|
|
899
|
+
const filterOption2 = props.firstOptions?.find(
|
|
900
|
+
(eachOption) => eachOption.value === value
|
|
901
|
+
);
|
|
763
902
|
setSelectedValue((prev) => {
|
|
764
903
|
const newValue = { ...prev, firstValue: filterOption2 };
|
|
904
|
+
const { temp, ...rest } = newValue;
|
|
765
905
|
if (newValue.firstValue) {
|
|
766
|
-
props.onChange?.(
|
|
906
|
+
props.onChange?.(rest);
|
|
767
907
|
}
|
|
768
908
|
return newValue;
|
|
769
909
|
});
|
|
770
910
|
};
|
|
771
911
|
const handleSecondChange = (value) => {
|
|
772
|
-
const filterOption2 = props.secondOptions?.find(
|
|
912
|
+
const filterOption2 = props.secondOptions?.find(
|
|
913
|
+
(eachOption) => eachOption.value === value
|
|
914
|
+
);
|
|
773
915
|
setSelectedValue((prev) => {
|
|
774
916
|
const newValue = { ...prev, secondValue: filterOption2 };
|
|
917
|
+
const { temp, ...rest } = newValue;
|
|
775
918
|
if (newValue.secondValue) {
|
|
776
|
-
props.onChange?.(
|
|
919
|
+
props.onChange?.(rest);
|
|
777
920
|
}
|
|
778
921
|
return newValue;
|
|
779
922
|
});
|
|
780
923
|
};
|
|
781
|
-
return /* @__PURE__ */ React25.createElement("div", { className: props.
|
|
924
|
+
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
925
|
Select4,
|
|
783
926
|
{
|
|
784
927
|
onChange: handleFirstChange,
|
|
785
928
|
variant: props.variant,
|
|
786
|
-
options: props.firstOptions
|
|
929
|
+
options: props.firstOptions,
|
|
930
|
+
className: props.className
|
|
787
931
|
}
|
|
788
932
|
), /* @__PURE__ */ React25.createElement("div", { style: { borderLeft: "1px solid gray", height: "33px" } }), /* @__PURE__ */ React25.createElement(
|
|
789
933
|
Select4,
|
|
790
934
|
{
|
|
791
935
|
onChange: handleSecondChange,
|
|
792
936
|
variant: props.variant,
|
|
793
|
-
options: props.secondOptions
|
|
937
|
+
options: props.secondOptions,
|
|
938
|
+
className: props.className
|
|
794
939
|
}
|
|
795
|
-
));
|
|
940
|
+
)));
|
|
796
941
|
};
|
|
797
942
|
|
|
798
943
|
// src/Components/FilesUpload.tsx
|
|
799
944
|
import React26, { useState as useState8 } from "react";
|
|
800
|
-
import { Upload
|
|
945
|
+
import { Upload } from "antd";
|
|
801
946
|
import { InboxOutlined } from "@ant-design/icons";
|
|
802
947
|
var FileUpload = (props) => {
|
|
803
948
|
const { Dragger } = Upload;
|
|
804
949
|
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
950
|
const handleChange = ({ fileList }) => {
|
|
814
951
|
setFiles(fileList);
|
|
815
952
|
if (props.onChange) {
|
|
@@ -833,7 +970,6 @@ var FileUpload = (props) => {
|
|
|
833
970
|
maxCount: props.max_count,
|
|
834
971
|
multiple: props.multiple,
|
|
835
972
|
fileList: files,
|
|
836
|
-
beforeUpload,
|
|
837
973
|
onChange: handleChange,
|
|
838
974
|
showUploadList: true,
|
|
839
975
|
customRequest
|
|
@@ -862,22 +998,569 @@ var onChange = (checked) => {
|
|
|
862
998
|
console.log(`switch to ${checked}`);
|
|
863
999
|
};
|
|
864
1000
|
var SwitchElement = () => /* @__PURE__ */ React28.createElement(Switch, { defaultChecked: true, onChange });
|
|
1001
|
+
|
|
1002
|
+
// src/Components/Upload.tsx
|
|
1003
|
+
import React29, { useState as useState9 } from "react";
|
|
1004
|
+
var Upload2 = (props) => {
|
|
1005
|
+
const [file, setFile] = useState9();
|
|
1006
|
+
const handleFileChange = (e) => {
|
|
1007
|
+
setFile(e.target.files[0]);
|
|
1008
|
+
if (props.onChange) {
|
|
1009
|
+
props.onChange(e.target.files[0]);
|
|
1010
|
+
}
|
|
1011
|
+
};
|
|
1012
|
+
const handleUpload = async () => {
|
|
1013
|
+
if (!file) {
|
|
1014
|
+
console.error("No file selected");
|
|
1015
|
+
return;
|
|
1016
|
+
}
|
|
1017
|
+
};
|
|
1018
|
+
return /* @__PURE__ */ React29.createElement("div", { style: { marginTop: 16 } }, /* @__PURE__ */ React29.createElement("input", { type: "file", onChange: handleFileChange }), /* @__PURE__ */ React29.createElement(
|
|
1019
|
+
"button",
|
|
1020
|
+
{
|
|
1021
|
+
type: "button",
|
|
1022
|
+
onClick: handleUpload,
|
|
1023
|
+
disabled: !file,
|
|
1024
|
+
style: { marginTop: 16 }
|
|
1025
|
+
},
|
|
1026
|
+
"Upload"
|
|
1027
|
+
));
|
|
1028
|
+
};
|
|
1029
|
+
|
|
1030
|
+
// src/Components/OtpElement.tsx
|
|
1031
|
+
import React30, { useState as useState10, useRef, useEffect as useEffect3 } from "react";
|
|
1032
|
+
import { Input as Input3 } from "antd";
|
|
1033
|
+
var OtpElement = (props) => {
|
|
1034
|
+
const length = props.length;
|
|
1035
|
+
const [otp, setOtp] = useState10(Array(length).fill(""));
|
|
1036
|
+
const inputRefs = useRef([]);
|
|
1037
|
+
const handleChange = (e, index) => {
|
|
1038
|
+
const value = e.target.value;
|
|
1039
|
+
if (/^[0-9]$/.test(value) || value === "") {
|
|
1040
|
+
const newOtp = [...otp];
|
|
1041
|
+
newOtp[index] = value;
|
|
1042
|
+
setOtp(newOtp);
|
|
1043
|
+
props.onChange && props.onChange(newOtp.join(""));
|
|
1044
|
+
if (value && index < length - 1) {
|
|
1045
|
+
inputRefs.current[index + 1]?.focus();
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
};
|
|
1049
|
+
const handleKeyDown = (e, index) => {
|
|
1050
|
+
if (e.key === "Backspace" && !otp[index] && index > 0) {
|
|
1051
|
+
inputRefs.current[index - 1]?.focus();
|
|
1052
|
+
}
|
|
1053
|
+
};
|
|
1054
|
+
const handlePaste = (e) => {
|
|
1055
|
+
e.preventDefault();
|
|
1056
|
+
const pasteData = e.clipboardData.getData("text");
|
|
1057
|
+
if (/^\d+$/.test(pasteData)) {
|
|
1058
|
+
const newOtp = pasteData.split("").slice(0, length);
|
|
1059
|
+
setOtp(newOtp.concat(Array(length - newOtp.length).fill("")));
|
|
1060
|
+
props.onChange && props.onChange(newOtp.join(""));
|
|
1061
|
+
newOtp.forEach((_, idx) => {
|
|
1062
|
+
if (inputRefs.current[idx]) {
|
|
1063
|
+
inputRefs.current[idx]?.focus();
|
|
1064
|
+
}
|
|
1065
|
+
});
|
|
1066
|
+
}
|
|
1067
|
+
};
|
|
1068
|
+
useEffect3(() => {
|
|
1069
|
+
inputRefs.current[0]?.focus();
|
|
1070
|
+
}, []);
|
|
1071
|
+
return /* @__PURE__ */ React30.createElement("div", { className: props.containerClassName }, Array.from({ length }).map((_, index) => /* @__PURE__ */ React30.createElement(
|
|
1072
|
+
Input3,
|
|
1073
|
+
{
|
|
1074
|
+
key: index,
|
|
1075
|
+
className: props.className,
|
|
1076
|
+
maxLength: 1,
|
|
1077
|
+
value: otp[index],
|
|
1078
|
+
onChange: (e) => handleChange(e, index),
|
|
1079
|
+
onKeyDown: (e) => handleKeyDown(e, index),
|
|
1080
|
+
onPaste: handlePaste,
|
|
1081
|
+
ref: (el) => inputRefs.current[index] = el
|
|
1082
|
+
}
|
|
1083
|
+
)));
|
|
1084
|
+
};
|
|
1085
|
+
|
|
1086
|
+
// src/Components/CircleDonut.tsx
|
|
1087
|
+
import React31 from "react";
|
|
1088
|
+
import { Doughnut } from "react-chartjs-2";
|
|
1089
|
+
import {
|
|
1090
|
+
Chart as ChartJS,
|
|
1091
|
+
DoughnutController,
|
|
1092
|
+
ArcElement,
|
|
1093
|
+
Tooltip,
|
|
1094
|
+
Legend
|
|
1095
|
+
} from "chart.js";
|
|
1096
|
+
ChartJS.register(DoughnutController, ArcElement, Tooltip, Legend);
|
|
1097
|
+
var CircleDonut = (props) => {
|
|
1098
|
+
const data = {
|
|
1099
|
+
labels: props.labels,
|
|
1100
|
+
datasets: [
|
|
1101
|
+
{
|
|
1102
|
+
label: "Bot Conversation",
|
|
1103
|
+
data: props.data,
|
|
1104
|
+
backgroundColor: [
|
|
1105
|
+
"#FFCB8A",
|
|
1106
|
+
"#CADBBF",
|
|
1107
|
+
"#8AC1BB",
|
|
1108
|
+
"#FCB0CB",
|
|
1109
|
+
"#CEB0FA"
|
|
1110
|
+
],
|
|
1111
|
+
borderWidth: 0
|
|
1112
|
+
}
|
|
1113
|
+
]
|
|
1114
|
+
};
|
|
1115
|
+
const options = {
|
|
1116
|
+
responsive: true,
|
|
1117
|
+
cutout: "80%",
|
|
1118
|
+
plugins: {
|
|
1119
|
+
legend: {
|
|
1120
|
+
position: "left",
|
|
1121
|
+
labels: {
|
|
1122
|
+
font: {
|
|
1123
|
+
size: 10
|
|
1124
|
+
},
|
|
1125
|
+
boxWidth: 15,
|
|
1126
|
+
generateLabels: (chart) => {
|
|
1127
|
+
const dataset = chart.data.datasets[0];
|
|
1128
|
+
return chart.data.labels.map((label, index) => {
|
|
1129
|
+
const value = dataset.data[index];
|
|
1130
|
+
return {
|
|
1131
|
+
text: `${label}: ${value}`,
|
|
1132
|
+
fillStyle: dataset.backgroundColor[index]
|
|
1133
|
+
};
|
|
1134
|
+
});
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
},
|
|
1138
|
+
tooltip: {
|
|
1139
|
+
enabled: true,
|
|
1140
|
+
callbacks: {
|
|
1141
|
+
label: function(context) {
|
|
1142
|
+
const label = context.label || "";
|
|
1143
|
+
const value = context.raw || 0;
|
|
1144
|
+
return `${label}: ${value}`;
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
};
|
|
1150
|
+
const centerTextPlugin = {
|
|
1151
|
+
id: "centerText",
|
|
1152
|
+
beforeDraw: (chart) => {
|
|
1153
|
+
const { ctx, chartArea: { left, right, top, bottom } } = chart;
|
|
1154
|
+
const width = right - left;
|
|
1155
|
+
const height = bottom - top;
|
|
1156
|
+
const centerX = left + width / 2;
|
|
1157
|
+
const centerY = top + height / 2;
|
|
1158
|
+
ctx.save();
|
|
1159
|
+
ctx.font = "7px Arial";
|
|
1160
|
+
ctx.fillStyle = "blue";
|
|
1161
|
+
ctx.textAlign = "center";
|
|
1162
|
+
ctx.textBaseline = "middle";
|
|
1163
|
+
ctx.fillText("Total Sessions", centerX, centerY - 10);
|
|
1164
|
+
ctx.font = "25px Arial";
|
|
1165
|
+
ctx.fillStyle = "black";
|
|
1166
|
+
ctx.fillText("85", centerX, centerY + 20);
|
|
1167
|
+
ctx.restore();
|
|
1168
|
+
}
|
|
1169
|
+
};
|
|
1170
|
+
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] }));
|
|
1171
|
+
};
|
|
1172
|
+
|
|
1173
|
+
// src/Components/SemiCircleDonut.tsx
|
|
1174
|
+
import React32 from "react";
|
|
1175
|
+
import { Doughnut as Doughnut2 } from "react-chartjs-2";
|
|
1176
|
+
import {
|
|
1177
|
+
Chart as ChartJS2,
|
|
1178
|
+
DoughnutController as DoughnutController2,
|
|
1179
|
+
ArcElement as ArcElement2,
|
|
1180
|
+
Tooltip as Tooltip2,
|
|
1181
|
+
Legend as Legend2
|
|
1182
|
+
} from "chart.js";
|
|
1183
|
+
ChartJS2.register(DoughnutController2, ArcElement2, Tooltip2, Legend2);
|
|
1184
|
+
var SemiCircleDonut = (props) => {
|
|
1185
|
+
const data = {
|
|
1186
|
+
labels: [
|
|
1187
|
+
"Registration",
|
|
1188
|
+
"Book Appointment",
|
|
1189
|
+
"Diagnostic Tests",
|
|
1190
|
+
"Hospital Facility",
|
|
1191
|
+
"Others, Prescriptions"
|
|
1192
|
+
],
|
|
1193
|
+
datasets: [
|
|
1194
|
+
{
|
|
1195
|
+
label: "Bot Conversation",
|
|
1196
|
+
data: [30, 10, 27, 40, 12],
|
|
1197
|
+
backgroundColor: [
|
|
1198
|
+
"#FFCB8A",
|
|
1199
|
+
"#CADBBF",
|
|
1200
|
+
"#8AC1BB",
|
|
1201
|
+
"#FCB0CB",
|
|
1202
|
+
"#CEB0FA"
|
|
1203
|
+
],
|
|
1204
|
+
borderWidth: 0
|
|
1205
|
+
}
|
|
1206
|
+
]
|
|
1207
|
+
};
|
|
1208
|
+
const options = {
|
|
1209
|
+
responsive: true,
|
|
1210
|
+
circumference: 180,
|
|
1211
|
+
rotation: -90,
|
|
1212
|
+
cutout: "80%",
|
|
1213
|
+
plugins: {
|
|
1214
|
+
legend: {
|
|
1215
|
+
display: false
|
|
1216
|
+
// Disable the legend
|
|
1217
|
+
},
|
|
1218
|
+
tooltip: {
|
|
1219
|
+
enabled: true,
|
|
1220
|
+
callbacks: {
|
|
1221
|
+
label: function(context) {
|
|
1222
|
+
const label = context.label || "";
|
|
1223
|
+
const value = context.raw || 0;
|
|
1224
|
+
return `${label}: ${value}`;
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
};
|
|
1230
|
+
const centerTextPlugin = {
|
|
1231
|
+
id: "centerText",
|
|
1232
|
+
beforeDraw: (chart) => {
|
|
1233
|
+
const { ctx, chartArea: { left, right, top, bottom } } = chart;
|
|
1234
|
+
const width = right - left;
|
|
1235
|
+
const height = bottom - top;
|
|
1236
|
+
const centerX = left + width / 2;
|
|
1237
|
+
const centerY = top + height / 1.5;
|
|
1238
|
+
const maxWidth = width * 0.8;
|
|
1239
|
+
ctx.save();
|
|
1240
|
+
ctx.fillStyle = "black";
|
|
1241
|
+
ctx.textAlign = "center";
|
|
1242
|
+
ctx.textBaseline = "middle";
|
|
1243
|
+
const drawText = (text, y, fontSize) => {
|
|
1244
|
+
ctx.font = `${fontSize}px Arial`;
|
|
1245
|
+
const textWidth = ctx.measureText(text).width;
|
|
1246
|
+
if (textWidth > maxWidth) {
|
|
1247
|
+
const newFontSize = fontSize * maxWidth / textWidth;
|
|
1248
|
+
ctx.font = `${newFontSize}px Arial`;
|
|
1249
|
+
}
|
|
1250
|
+
ctx.fillText(text, centerX, y);
|
|
1251
|
+
};
|
|
1252
|
+
drawText(props.fillText1, centerY - 10, 16);
|
|
1253
|
+
drawText(props.fillText2, centerY + 20, 8);
|
|
1254
|
+
ctx.restore();
|
|
1255
|
+
}
|
|
1256
|
+
};
|
|
1257
|
+
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] }));
|
|
1258
|
+
};
|
|
1259
|
+
|
|
1260
|
+
// src/Components/HorizontalBarChart.tsx
|
|
1261
|
+
import React33 from "react";
|
|
1262
|
+
import { Bar } from "react-chartjs-2";
|
|
1263
|
+
import {
|
|
1264
|
+
Chart as ChartJS3,
|
|
1265
|
+
BarElement,
|
|
1266
|
+
CategoryScale,
|
|
1267
|
+
LinearScale,
|
|
1268
|
+
Tooltip as Tooltip3
|
|
1269
|
+
} from "chart.js";
|
|
1270
|
+
ChartJS3.register(BarElement, CategoryScale, LinearScale, Tooltip3);
|
|
1271
|
+
var HorizontalBarChart = (props) => {
|
|
1272
|
+
const data = {
|
|
1273
|
+
labels: ["18-24", "25-34", "35-44", "45-54", "55-64", "65+"],
|
|
1274
|
+
datasets: [
|
|
1275
|
+
{
|
|
1276
|
+
data: [30, 10, 27, 40, 12, 24],
|
|
1277
|
+
backgroundColor: "#6298D5",
|
|
1278
|
+
barThickness: 15
|
|
1279
|
+
}
|
|
1280
|
+
]
|
|
1281
|
+
};
|
|
1282
|
+
const options = {
|
|
1283
|
+
responsive: true,
|
|
1284
|
+
indexAxis: "y",
|
|
1285
|
+
scales: {
|
|
1286
|
+
x: {
|
|
1287
|
+
beginAtZero: true,
|
|
1288
|
+
ticks: {
|
|
1289
|
+
callback: function(value) {
|
|
1290
|
+
return `${value}%`;
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
},
|
|
1294
|
+
y: {
|
|
1295
|
+
grid: {
|
|
1296
|
+
display: false
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
},
|
|
1300
|
+
plugins: {
|
|
1301
|
+
tooltip: {
|
|
1302
|
+
enabled: true,
|
|
1303
|
+
callbacks: {
|
|
1304
|
+
label: function(context) {
|
|
1305
|
+
const label = context.label || "";
|
|
1306
|
+
const value = context.raw || 0;
|
|
1307
|
+
return `${label}: ${value}`;
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
},
|
|
1311
|
+
legend: {
|
|
1312
|
+
display: false
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1315
|
+
};
|
|
1316
|
+
return /* @__PURE__ */ React33.createElement("div", { className: props.className }, /* @__PURE__ */ React33.createElement("h1", { className: props.labelClassName }, props.label), /* @__PURE__ */ React33.createElement(Bar, { data, options }));
|
|
1317
|
+
};
|
|
1318
|
+
|
|
1319
|
+
// src/Components/LineChart.tsx
|
|
1320
|
+
import React34, { useEffect as useEffect4, useRef as useRef2 } from "react";
|
|
1321
|
+
import Chart from "chart.js/auto";
|
|
1322
|
+
var LineChart = (props) => {
|
|
1323
|
+
const chartRef = useRef2(null);
|
|
1324
|
+
const chartInstance = useRef2(null);
|
|
1325
|
+
const data = [
|
|
1326
|
+
{ label: "ROI", data: [10, 13, 20, 15, 10] },
|
|
1327
|
+
{ label: "Engagement Rate", data: [20, 23, 30, 28, 20] },
|
|
1328
|
+
{ label: "Conversion Rate", data: [50, 100, 150, 180, 50] }
|
|
1329
|
+
];
|
|
1330
|
+
const labels = ["Instagram", "Whatsapp", "Messages", "Telegram", "Linkedin"];
|
|
1331
|
+
useEffect4(() => {
|
|
1332
|
+
if (chartRef.current) {
|
|
1333
|
+
if (chartInstance.current) {
|
|
1334
|
+
chartInstance.current.destroy();
|
|
1335
|
+
}
|
|
1336
|
+
chartInstance.current = new Chart(chartRef.current, {
|
|
1337
|
+
type: "line",
|
|
1338
|
+
data: {
|
|
1339
|
+
labels,
|
|
1340
|
+
datasets: data.map((dataset, index) => ({
|
|
1341
|
+
label: dataset.label,
|
|
1342
|
+
data: dataset.data,
|
|
1343
|
+
borderColor: index === 0 ? "#FF8F00" : index === 1 ? "#F50057" : "#254AAA",
|
|
1344
|
+
backgroundColor: "rgba(0, 0, 0, 0)",
|
|
1345
|
+
pointBackgroundColor: index === 0 ? "#FF8F00" : index === 1 ? "#F50057" : "#254AAA",
|
|
1346
|
+
pointBorderColor: "white",
|
|
1347
|
+
pointStyle: "circle",
|
|
1348
|
+
pointRadius: 3,
|
|
1349
|
+
tension: 0.1,
|
|
1350
|
+
fill: true
|
|
1351
|
+
}))
|
|
1352
|
+
},
|
|
1353
|
+
options: {
|
|
1354
|
+
plugins: {
|
|
1355
|
+
legend: {
|
|
1356
|
+
labels: {
|
|
1357
|
+
usePointStyle: true
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
},
|
|
1361
|
+
scales: {
|
|
1362
|
+
x: {
|
|
1363
|
+
grid: {
|
|
1364
|
+
display: false
|
|
1365
|
+
}
|
|
1366
|
+
},
|
|
1367
|
+
y: {
|
|
1368
|
+
beginAtZero: true,
|
|
1369
|
+
suggestedMax: 200,
|
|
1370
|
+
ticks: {
|
|
1371
|
+
callback: function(value) {
|
|
1372
|
+
return value + "%";
|
|
1373
|
+
}
|
|
1374
|
+
},
|
|
1375
|
+
grid: {
|
|
1376
|
+
display: true
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
});
|
|
1382
|
+
}
|
|
1383
|
+
return () => {
|
|
1384
|
+
if (chartInstance.current) {
|
|
1385
|
+
chartInstance.current.destroy();
|
|
1386
|
+
}
|
|
1387
|
+
};
|
|
1388
|
+
}, [labels, data]);
|
|
1389
|
+
return /* @__PURE__ */ React34.createElement("div", { className: props.className }, /* @__PURE__ */ React34.createElement("canvas", { ref: chartRef }));
|
|
1390
|
+
};
|
|
1391
|
+
|
|
1392
|
+
// src/Components/DoubleBarChart.tsx
|
|
1393
|
+
import React35, { useEffect as useEffect5, useRef as useRef3 } from "react";
|
|
1394
|
+
import Chart2 from "chart.js/auto";
|
|
1395
|
+
var DoubleBarChart = (props) => {
|
|
1396
|
+
const chartRef = useRef3(null);
|
|
1397
|
+
const chartInstance = useRef3(null);
|
|
1398
|
+
useEffect5(() => {
|
|
1399
|
+
if (chartRef.current) {
|
|
1400
|
+
if (chartInstance.current) {
|
|
1401
|
+
chartInstance.current.destroy();
|
|
1402
|
+
}
|
|
1403
|
+
chartInstance.current = new Chart2(chartRef.current, {
|
|
1404
|
+
type: "bar",
|
|
1405
|
+
data: {
|
|
1406
|
+
labels: [
|
|
1407
|
+
"Summer Health Tips",
|
|
1408
|
+
"New Services Launch",
|
|
1409
|
+
"Discounts on Checkups",
|
|
1410
|
+
"Wellness Webinar",
|
|
1411
|
+
"LinkedIn Insights"
|
|
1412
|
+
],
|
|
1413
|
+
datasets: [
|
|
1414
|
+
{
|
|
1415
|
+
label: "Engagement Rate",
|
|
1416
|
+
data: [60, 70, 50, 80, 65],
|
|
1417
|
+
// Example data for male
|
|
1418
|
+
backgroundColor: "#93B8E2",
|
|
1419
|
+
barThickness: 10
|
|
1420
|
+
},
|
|
1421
|
+
{
|
|
1422
|
+
label: "Conversion Rate",
|
|
1423
|
+
data: [70, 65, 75, 55, 85],
|
|
1424
|
+
// Example data for female
|
|
1425
|
+
backgroundColor: "#4484CD",
|
|
1426
|
+
barThickness: 10
|
|
1427
|
+
}
|
|
1428
|
+
]
|
|
1429
|
+
},
|
|
1430
|
+
options: {
|
|
1431
|
+
scales: {
|
|
1432
|
+
x: {
|
|
1433
|
+
grid: {
|
|
1434
|
+
display: false
|
|
1435
|
+
// Display x-axis grid lines
|
|
1436
|
+
}
|
|
1437
|
+
},
|
|
1438
|
+
y: {
|
|
1439
|
+
beginAtZero: true,
|
|
1440
|
+
suggestedMax: 100,
|
|
1441
|
+
ticks: {
|
|
1442
|
+
callback: function(value) {
|
|
1443
|
+
return value + "%";
|
|
1444
|
+
}
|
|
1445
|
+
},
|
|
1446
|
+
grid: {
|
|
1447
|
+
display: true
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
},
|
|
1451
|
+
plugins: {
|
|
1452
|
+
legend: {
|
|
1453
|
+
labels: {
|
|
1454
|
+
usePointStyle: true
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
});
|
|
1460
|
+
}
|
|
1461
|
+
return () => {
|
|
1462
|
+
if (chartInstance.current) {
|
|
1463
|
+
chartInstance.current.destroy();
|
|
1464
|
+
}
|
|
1465
|
+
};
|
|
1466
|
+
}, []);
|
|
1467
|
+
return /* @__PURE__ */ React35.createElement("div", { className: props.className }, /* @__PURE__ */ React35.createElement("h1", { className: props.labelClassName }, props.label), /* @__PURE__ */ React35.createElement("canvas", { ref: chartRef }));
|
|
1468
|
+
};
|
|
1469
|
+
|
|
1470
|
+
// src/Components/BarChart.tsx
|
|
1471
|
+
import React36 from "react";
|
|
1472
|
+
import { Bar as Bar2 } from "react-chartjs-2";
|
|
1473
|
+
import {
|
|
1474
|
+
Chart as ChartJS4,
|
|
1475
|
+
BarElement as BarElement2,
|
|
1476
|
+
CategoryScale as CategoryScale2,
|
|
1477
|
+
LinearScale as LinearScale2,
|
|
1478
|
+
Tooltip as Tooltip4
|
|
1479
|
+
} from "chart.js";
|
|
1480
|
+
ChartJS4.register(BarElement2, CategoryScale2, LinearScale2, Tooltip4);
|
|
1481
|
+
var BarChart = (props) => {
|
|
1482
|
+
const data = {
|
|
1483
|
+
labels: [
|
|
1484
|
+
"17 June",
|
|
1485
|
+
"18 June",
|
|
1486
|
+
"19 June",
|
|
1487
|
+
"20 June",
|
|
1488
|
+
"21 June",
|
|
1489
|
+
"22 June",
|
|
1490
|
+
"23 June"
|
|
1491
|
+
],
|
|
1492
|
+
datasets: [
|
|
1493
|
+
{
|
|
1494
|
+
data: [30, 100, 270, 140, 120, 240],
|
|
1495
|
+
backgroundColor: "#1565C0",
|
|
1496
|
+
barThickness: 15
|
|
1497
|
+
}
|
|
1498
|
+
]
|
|
1499
|
+
};
|
|
1500
|
+
const options = {
|
|
1501
|
+
responsive: true,
|
|
1502
|
+
scales: {
|
|
1503
|
+
x: {
|
|
1504
|
+
beginAtZero: true,
|
|
1505
|
+
grid: {
|
|
1506
|
+
display: false
|
|
1507
|
+
}
|
|
1508
|
+
},
|
|
1509
|
+
y: {
|
|
1510
|
+
grid: {
|
|
1511
|
+
display: true
|
|
1512
|
+
},
|
|
1513
|
+
ticks: {
|
|
1514
|
+
min: 0,
|
|
1515
|
+
max: 400,
|
|
1516
|
+
stepSize: 200,
|
|
1517
|
+
callback: function(value) {
|
|
1518
|
+
return `${value}`;
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
},
|
|
1523
|
+
plugins: {
|
|
1524
|
+
tooltip: {
|
|
1525
|
+
enabled: true,
|
|
1526
|
+
callbacks: {
|
|
1527
|
+
label: function(context) {
|
|
1528
|
+
const label = context.label || "";
|
|
1529
|
+
const value = context.raw || 0;
|
|
1530
|
+
return ` ${label}: ${value}`;
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
},
|
|
1534
|
+
legend: {
|
|
1535
|
+
display: false
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
};
|
|
1539
|
+
return /* @__PURE__ */ React36.createElement("div", { className: props.className }, /* @__PURE__ */ React36.createElement("h1", { className: props.labelClassName }, props.label), /* @__PURE__ */ React36.createElement(Bar2, { data, options }));
|
|
1540
|
+
};
|
|
865
1541
|
export {
|
|
866
1542
|
AddMoreTable,
|
|
1543
|
+
BarChart,
|
|
867
1544
|
ButtonElement,
|
|
868
1545
|
CheckboxElement,
|
|
1546
|
+
CircleDonut,
|
|
869
1547
|
CkEditor,
|
|
870
1548
|
DatePickerElement,
|
|
871
1549
|
DateRangePickerElement,
|
|
1550
|
+
DoubleBarChart,
|
|
872
1551
|
DropDownGroup,
|
|
873
1552
|
FileUpload,
|
|
1553
|
+
HorizontalBarChart,
|
|
874
1554
|
Image,
|
|
1555
|
+
LineChart,
|
|
875
1556
|
MultipleSelectElement,
|
|
876
1557
|
Navbar,
|
|
877
1558
|
NumberElement,
|
|
1559
|
+
OtpElement,
|
|
878
1560
|
PasswordElement,
|
|
879
1561
|
RadioElement,
|
|
880
1562
|
SelectElement,
|
|
1563
|
+
SemiCircleDonut,
|
|
881
1564
|
Sidebar,
|
|
882
1565
|
SingleCheckbox,
|
|
883
1566
|
SingleSelectElement,
|
|
@@ -885,5 +1568,6 @@ export {
|
|
|
885
1568
|
TableElement,
|
|
886
1569
|
TabsElement,
|
|
887
1570
|
TextElement,
|
|
888
|
-
TextareaElement
|
|
1571
|
+
TextareaElement,
|
|
1572
|
+
Upload2 as Upload
|
|
889
1573
|
};
|