@apexcura/ui-components 0.0.14-Beta2 → 0.0.14-Beta200
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 +38 -5
- package/dist/index.d.ts +38 -5
- package/dist/index.js +775 -118
- package/dist/index.mjs +791 -119
- package/package.json +7 -3
package/dist/index.js
CHANGED
|
@@ -31,27 +31,36 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
33
|
AddMoreTable: () => AddMoreTable,
|
|
34
|
+
BarChart: () => BarChart,
|
|
34
35
|
ButtonElement: () => ButtonElement,
|
|
35
36
|
CheckboxElement: () => CheckboxElement,
|
|
37
|
+
CircleDonut: () => CircleDonut,
|
|
36
38
|
CkEditor: () => CkEditor,
|
|
37
39
|
DatePickerElement: () => DatePickerElement,
|
|
38
40
|
DateRangePickerElement: () => DateRangePickerElement,
|
|
41
|
+
DoubleBarChart: () => DoubleBarChart,
|
|
39
42
|
DropDownGroup: () => DropDownGroup,
|
|
40
43
|
FileUpload: () => FileUpload,
|
|
44
|
+
HorizontalBarChart: () => HorizontalBarChart,
|
|
41
45
|
Image: () => Image,
|
|
46
|
+
LineChart: () => LineChart,
|
|
42
47
|
MultipleSelectElement: () => MultipleSelectElement,
|
|
43
48
|
Navbar: () => Navbar,
|
|
44
49
|
NumberElement: () => NumberElement,
|
|
50
|
+
OtpElement: () => OtpElement,
|
|
45
51
|
PasswordElement: () => PasswordElement,
|
|
46
52
|
RadioElement: () => RadioElement,
|
|
47
53
|
SelectElement: () => SelectElement,
|
|
54
|
+
SemiCircleDonut: () => SemiCircleDonut,
|
|
48
55
|
Sidebar: () => Sidebar,
|
|
49
56
|
SingleCheckbox: () => SingleCheckbox,
|
|
50
57
|
SingleSelectElement: () => SingleSelectElement,
|
|
58
|
+
SwitchElement: () => SwitchElement,
|
|
51
59
|
TableElement: () => TableElement,
|
|
52
60
|
TabsElement: () => TabsElement,
|
|
53
61
|
TextElement: () => TextElement,
|
|
54
|
-
TextareaElement: () => TextareaElement
|
|
62
|
+
TextareaElement: () => TextareaElement,
|
|
63
|
+
Upload: () => Upload2
|
|
55
64
|
});
|
|
56
65
|
module.exports = __toCommonJS(src_exports);
|
|
57
66
|
|
|
@@ -70,6 +79,7 @@ var TextElement = (props) => {
|
|
|
70
79
|
placeholder: props.placeholder,
|
|
71
80
|
allowClear: true,
|
|
72
81
|
id: props.name,
|
|
82
|
+
value: props.value,
|
|
73
83
|
prefix: props.prefix,
|
|
74
84
|
type: props.type,
|
|
75
85
|
status: props.status,
|
|
@@ -129,8 +139,7 @@ var NumberElement = (props) => {
|
|
|
129
139
|
{
|
|
130
140
|
placeholder: props.placeholder,
|
|
131
141
|
addonBefore: props.addonBefore,
|
|
132
|
-
|
|
133
|
-
defaultValue: props.defaultValue,
|
|
142
|
+
value: props.value,
|
|
134
143
|
disabled: props.disabled,
|
|
135
144
|
id: props.name,
|
|
136
145
|
prefix: props.prefix,
|
|
@@ -378,11 +387,14 @@ var ButtonElement = (props) => {
|
|
|
378
387
|
return /* @__PURE__ */ import_react11.default.createElement(
|
|
379
388
|
"button",
|
|
380
389
|
{
|
|
381
|
-
onClick:
|
|
382
|
-
className: `${props.className ? props.className : ""}
|
|
390
|
+
onClick: props.onClick,
|
|
391
|
+
className: `${props.className ? props.className : ""}`,
|
|
392
|
+
disabled: props.loading,
|
|
393
|
+
style: {
|
|
394
|
+
cursor: props.loading ? "no-drop" : "pointer"
|
|
395
|
+
}
|
|
383
396
|
},
|
|
384
|
-
|
|
385
|
-
props.label
|
|
397
|
+
/* @__PURE__ */ import_react11.default.createElement(import_react11.default.Fragment, null, /* @__PURE__ */ import_react11.default.createElement("span", { className: props.iconsClassName }, /* @__PURE__ */ import_react11.default.createElement("img", { src: props.icon, className: "icon-active" })), props.label)
|
|
386
398
|
);
|
|
387
399
|
};
|
|
388
400
|
|
|
@@ -464,9 +476,9 @@ var AddMoreTable = (props) => {
|
|
|
464
476
|
if (!element) return null;
|
|
465
477
|
const { element: type, label } = element;
|
|
466
478
|
if (type === "single-select") {
|
|
467
|
-
return /* @__PURE__ */ import_react12.default.createElement(SingleSelectElement, { onChange: (value2) => console.log(label, value2), optionType: "", className: void 0, selectedStyle: false, style: false });
|
|
479
|
+
return /* @__PURE__ */ import_react12.default.createElement(SingleSelectElement, { onChange: (value2) => console.log(label, value2), optionType: "", className: void 0, selectedStyle: false, style: false, options1: [], options2: [], firstOptions: [], secondOptions: [] });
|
|
468
480
|
} else if (type === "textarea") {
|
|
469
|
-
return /* @__PURE__ */ import_react12.default.createElement(TextareaElement, { onChange: (value2) => console.log(label, value2), optionType: "", className: void 0, selectedStyle: false, style: false });
|
|
481
|
+
return /* @__PURE__ */ import_react12.default.createElement(TextareaElement, { onChange: (value2) => console.log(label, value2), optionType: "", className: void 0, selectedStyle: false, style: false, options1: [], options2: [], firstOptions: [], secondOptions: [] });
|
|
470
482
|
} else {
|
|
471
483
|
return null;
|
|
472
484
|
}
|
|
@@ -524,10 +536,19 @@ var Sidebar = (props) => {
|
|
|
524
536
|
props.onChange(item);
|
|
525
537
|
}
|
|
526
538
|
};
|
|
527
|
-
return /* @__PURE__ */ import_react13.default.createElement(
|
|
528
|
-
return /* @__PURE__ */ import_react13.default.createElement(
|
|
529
|
-
|
|
530
|
-
|
|
539
|
+
return /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, { key: props.name }, /* @__PURE__ */ import_react13.default.createElement("div", { className: props.imgClassName }, /* @__PURE__ */ import_react13.default.createElement("img", { src: props.img, alt: "logo" })), /* @__PURE__ */ import_react13.default.createElement("div", { className: props.listClassName }, props.items?.map((item) => {
|
|
540
|
+
return /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, { key: item.label }, /* @__PURE__ */ import_react13.default.createElement(
|
|
541
|
+
ButtonElement,
|
|
542
|
+
{
|
|
543
|
+
...item,
|
|
544
|
+
className: item.active ? props.activeClassName : props.className,
|
|
545
|
+
iconsClassName: props.iconsClassName,
|
|
546
|
+
onClick: (e) => {
|
|
547
|
+
e.preventDefault();
|
|
548
|
+
handleChange(item);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
));
|
|
531
552
|
})));
|
|
532
553
|
};
|
|
533
554
|
|
|
@@ -601,18 +622,48 @@ var import_antd13 = require("antd");
|
|
|
601
622
|
|
|
602
623
|
// src/Components/ModelBody.tsx
|
|
603
624
|
var import_react18 = __toESM(require("react"));
|
|
625
|
+
var import_moment = __toESM(require("moment"));
|
|
604
626
|
var ModelBody = (props) => {
|
|
605
|
-
return /* @__PURE__ */ import_react18.default.createElement("div", { className: props.modalContent && props.modalContent.className }, props.modalContent && props.modalContent.fields.map(
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
627
|
+
return /* @__PURE__ */ import_react18.default.createElement("div", { className: props.modalContent && props.modalContent.className }, props.modalContent && props.modalContent.fields.map(
|
|
628
|
+
(eachField) => {
|
|
629
|
+
if (eachField.element === "div") {
|
|
630
|
+
return /* @__PURE__ */ import_react18.default.createElement(import_react18.default.Fragment, null, /* @__PURE__ */ import_react18.default.createElement("div", { className: eachField.className }, eachField.label), eachField.dateTime ? /* @__PURE__ */ import_react18.default.createElement(
|
|
631
|
+
"p",
|
|
632
|
+
{
|
|
633
|
+
style: {
|
|
634
|
+
fontSize: "10px",
|
|
635
|
+
textAlign: eachField.source === "bot" ? "left" : "right"
|
|
636
|
+
}
|
|
637
|
+
},
|
|
638
|
+
(0, import_moment.default)(eachField.dateTime).format("LT")
|
|
639
|
+
) : "");
|
|
640
|
+
} else if (eachField.element === "input-radio") {
|
|
641
|
+
return /* @__PURE__ */ import_react18.default.createElement(import_react18.default.Fragment, null, /* @__PURE__ */ import_react18.default.createElement("div", { className: eachField.className }, /* @__PURE__ */ import_react18.default.createElement(RadioElement, { ...eachField })), eachField.dateTime ? /* @__PURE__ */ import_react18.default.createElement(
|
|
642
|
+
"p",
|
|
643
|
+
{
|
|
644
|
+
style: {
|
|
645
|
+
fontSize: "10px",
|
|
646
|
+
textAlign: eachField.source === "bot" ? "left" : "right"
|
|
647
|
+
}
|
|
648
|
+
},
|
|
649
|
+
(0, import_moment.default)(eachField.dateTime).format("LT")
|
|
650
|
+
) : "");
|
|
651
|
+
} else if (eachField.element === "button") {
|
|
652
|
+
return /* @__PURE__ */ import_react18.default.createElement(import_react18.default.Fragment, null, /* @__PURE__ */ import_react18.default.createElement("div", { className: eachField.className }, /* @__PURE__ */ import_react18.default.createElement(ButtonElement, { ...eachField })), eachField.dateTime ? /* @__PURE__ */ import_react18.default.createElement(
|
|
653
|
+
"p",
|
|
654
|
+
{
|
|
655
|
+
style: {
|
|
656
|
+
fontSize: "10px",
|
|
657
|
+
textAlign: eachField.source === "bot" ? "left" : "right"
|
|
658
|
+
}
|
|
659
|
+
},
|
|
660
|
+
(0, import_moment.default)(eachField.dateTime).format("LT")
|
|
661
|
+
) : "");
|
|
662
|
+
} else {
|
|
663
|
+
return null;
|
|
664
|
+
}
|
|
614
665
|
}
|
|
615
|
-
|
|
666
|
+
));
|
|
616
667
|
};
|
|
617
668
|
|
|
618
669
|
// src/Components/Model.tsx
|
|
@@ -637,9 +688,22 @@ var ModelElement = (props) => {
|
|
|
637
688
|
margin: "-10px"
|
|
638
689
|
}
|
|
639
690
|
},
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
691
|
+
columns.map((eachColumn) => {
|
|
692
|
+
if (!["index", "View"].includes(eachColumn.key) && eachColumn?.["is_detail"] !== false) {
|
|
693
|
+
return /* @__PURE__ */ import_react19.default.createElement("p", { style: { fontWeight: "500", padding: "10px" } }, /* @__PURE__ */ import_react19.default.createElement(
|
|
694
|
+
"span",
|
|
695
|
+
{
|
|
696
|
+
style: {
|
|
697
|
+
fontWeight: "200",
|
|
698
|
+
color: "gray",
|
|
699
|
+
paddingRight: "10px"
|
|
700
|
+
}
|
|
701
|
+
},
|
|
702
|
+
eachColumn.title
|
|
703
|
+
), selectedRecord[eachColumn.key] !== "" ? selectedRecord[eachColumn.key] : "--");
|
|
704
|
+
} else {
|
|
705
|
+
return null;
|
|
706
|
+
}
|
|
643
707
|
})
|
|
644
708
|
)
|
|
645
709
|
},
|
|
@@ -648,13 +712,24 @@ var ModelElement = (props) => {
|
|
|
648
712
|
};
|
|
649
713
|
|
|
650
714
|
// src/Components/TableElement.tsx
|
|
715
|
+
var import_icons4 = require("@ant-design/icons");
|
|
651
716
|
var TableElement = (props) => {
|
|
652
717
|
const { thead, tbody } = props;
|
|
653
718
|
const [selectedRecord, setSelectedRecord] = (0, import_react20.useState)({});
|
|
654
719
|
const [model, setModel] = (0, import_react20.useState)(false);
|
|
655
|
-
const [
|
|
720
|
+
const [dataSource, setDataSource] = (0, import_react20.useState)([]);
|
|
721
|
+
(0, import_react20.useEffect)(() => {
|
|
722
|
+
if (tbody) {
|
|
723
|
+
setDataSource(
|
|
724
|
+
tbody.map((row, index) => ({
|
|
725
|
+
...row,
|
|
726
|
+
key: index,
|
|
727
|
+
index: index + 1
|
|
728
|
+
}))
|
|
729
|
+
);
|
|
730
|
+
}
|
|
731
|
+
}, [tbody]);
|
|
656
732
|
const handleChange = (record) => {
|
|
657
|
-
console.log("record", record);
|
|
658
733
|
if (props.onChange) {
|
|
659
734
|
props.onChange(record);
|
|
660
735
|
}
|
|
@@ -664,150 +739,195 @@ var TableElement = (props) => {
|
|
|
664
739
|
columns = [
|
|
665
740
|
{
|
|
666
741
|
title: "#",
|
|
667
|
-
dataIndex: "
|
|
668
|
-
key: "
|
|
742
|
+
dataIndex: "index",
|
|
743
|
+
key: "index",
|
|
744
|
+
fixed: "left"
|
|
669
745
|
},
|
|
670
746
|
...thead.map((col, ind) => ({
|
|
671
747
|
title: col.label,
|
|
672
748
|
dataIndex: col.name,
|
|
673
749
|
key: col.key,
|
|
750
|
+
ellipsis: col.ellipsis,
|
|
674
751
|
render: col.render,
|
|
675
752
|
sorter: {
|
|
676
753
|
compare: (a, b) => {
|
|
677
|
-
if (typeof a[col.key] === "number" && typeof
|
|
754
|
+
if (typeof a[col.key] === "number" && typeof b[col.key] === "number") {
|
|
678
755
|
return a[col.key] - b[col.key];
|
|
679
|
-
} else if (typeof a[col.key] === "string" && typeof
|
|
756
|
+
} else if (typeof a[col.key] === "string" && typeof b[col.key] === "string") {
|
|
680
757
|
return a[col.key].localeCompare(b[col.key]);
|
|
681
758
|
}
|
|
682
759
|
}
|
|
683
760
|
}
|
|
684
761
|
}))
|
|
685
762
|
];
|
|
763
|
+
if (props.view) {
|
|
764
|
+
columns.push({
|
|
765
|
+
title: "View",
|
|
766
|
+
dataIndex: "View",
|
|
767
|
+
key: "View",
|
|
768
|
+
render: (_, record) => {
|
|
769
|
+
return /* @__PURE__ */ import_react20.default.createElement(
|
|
770
|
+
"a",
|
|
771
|
+
{
|
|
772
|
+
onClick: () => {
|
|
773
|
+
if (props.view) {
|
|
774
|
+
setSelectedRecord(record);
|
|
775
|
+
handleChange(record);
|
|
776
|
+
setModel(true);
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
},
|
|
780
|
+
/* @__PURE__ */ import_react20.default.createElement(import_icons4.EyeOutlined, null)
|
|
781
|
+
);
|
|
782
|
+
}
|
|
783
|
+
});
|
|
784
|
+
}
|
|
686
785
|
}
|
|
687
|
-
const
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
786
|
+
const onChangeTable = (pagination, filters, sorter, extra) => {
|
|
787
|
+
if (extra && extra.currentDataSource) {
|
|
788
|
+
setDataSource(
|
|
789
|
+
extra.currentDataSource.map((row, index) => ({
|
|
790
|
+
...row,
|
|
791
|
+
index: index + 1
|
|
792
|
+
}))
|
|
793
|
+
);
|
|
794
|
+
}
|
|
795
|
+
};
|
|
692
796
|
const onChangePage = (page, pageSize) => {
|
|
693
797
|
if (props.onChange) {
|
|
694
798
|
props.onChange({ name: "pagination", page, pageSize });
|
|
695
799
|
}
|
|
696
800
|
};
|
|
697
|
-
const onSelectChange = (newSelectedRowKeys) => {
|
|
698
|
-
console.log("selectedRowKeys changed: ", newSelectedRowKeys);
|
|
699
|
-
setSelectedRowKeys(newSelectedRowKeys);
|
|
700
|
-
};
|
|
701
801
|
const rowSelectionConfig = props.rowSelection ? {
|
|
702
|
-
selectedRowKeys,
|
|
703
|
-
|
|
802
|
+
onChange: (selectedRowKeys, selectedRows) => {
|
|
803
|
+
console.log(
|
|
804
|
+
`selectedRowKeys: ${selectedRowKeys}`,
|
|
805
|
+
"selectedRows: ",
|
|
806
|
+
selectedRows
|
|
807
|
+
);
|
|
808
|
+
if (props.onChange) {
|
|
809
|
+
props.onChange(selectedRows);
|
|
810
|
+
}
|
|
811
|
+
}
|
|
704
812
|
} : void 0;
|
|
705
813
|
return /* @__PURE__ */ import_react20.default.createElement(import_react20.default.Fragment, null, /* @__PURE__ */ import_react20.default.createElement(
|
|
706
814
|
import_antd14.Table,
|
|
707
815
|
{
|
|
708
|
-
|
|
816
|
+
className: props.className,
|
|
817
|
+
pagination: props.pagination ? {
|
|
709
818
|
showTotal: (total) => `Total: ${total} items`,
|
|
710
|
-
total: count,
|
|
711
|
-
showSizeChanger: count > 10,
|
|
819
|
+
total: props.count,
|
|
820
|
+
showSizeChanger: props.count ? props.count > 10 : 0 > 10,
|
|
712
821
|
onChange: onChangePage
|
|
713
|
-
},
|
|
714
|
-
dataSource,
|
|
715
|
-
columns,
|
|
716
|
-
bordered: true,
|
|
717
|
-
rowSelection: rowSelectionConfig,
|
|
718
|
-
size: props.size && props.size,
|
|
822
|
+
} : false,
|
|
719
823
|
onRow: (record) => {
|
|
720
824
|
return {
|
|
721
825
|
onClick: () => {
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
826
|
+
if (props.view) {
|
|
827
|
+
setSelectedRecord(record);
|
|
828
|
+
handleChange(record);
|
|
829
|
+
setModel(true);
|
|
830
|
+
}
|
|
725
831
|
},
|
|
726
832
|
style: { cursor: "pointer" }
|
|
727
833
|
};
|
|
728
|
-
}
|
|
834
|
+
},
|
|
835
|
+
rowSelection: rowSelectionConfig,
|
|
836
|
+
dataSource,
|
|
837
|
+
columns,
|
|
838
|
+
size: props.size,
|
|
839
|
+
bordered: true,
|
|
840
|
+
onChange: onChangeTable
|
|
841
|
+
}
|
|
842
|
+
), model && /* @__PURE__ */ import_react20.default.createElement(
|
|
843
|
+
ModelElement,
|
|
844
|
+
{
|
|
845
|
+
selectedRecord,
|
|
846
|
+
...props,
|
|
847
|
+
columns,
|
|
848
|
+
model,
|
|
849
|
+
onCancel: () => setModel(false)
|
|
729
850
|
}
|
|
730
|
-
)
|
|
851
|
+
));
|
|
731
852
|
};
|
|
732
853
|
|
|
733
854
|
// src/Components/DatePicker.tsx
|
|
734
855
|
var import_react21 = __toESM(require("react"));
|
|
735
856
|
var import_antd15 = require("antd");
|
|
736
|
-
var
|
|
737
|
-
var
|
|
857
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
858
|
+
var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat.js"));
|
|
859
|
+
var import_moment2 = __toESM(require("moment"));
|
|
860
|
+
import_dayjs.default.extend(import_customParseFormat.default);
|
|
738
861
|
var DatePickerElement = (props) => {
|
|
739
|
-
const [
|
|
740
|
-
const handleChange = (
|
|
741
|
-
|
|
742
|
-
console.log("datestring", dateString);
|
|
743
|
-
if (date2) {
|
|
862
|
+
const [dateState, setDateState] = (0, import_react21.useState)("");
|
|
863
|
+
const handleChange = (date, dateString) => {
|
|
864
|
+
if (date) {
|
|
744
865
|
const formattedDate = dateString;
|
|
745
|
-
|
|
746
|
-
setDate(date2);
|
|
747
|
-
console.log("changedDate------------", date2);
|
|
866
|
+
setDateState(date);
|
|
748
867
|
if (props.onChange) {
|
|
749
868
|
props.onChange(formattedDate);
|
|
750
869
|
}
|
|
751
870
|
} else {
|
|
752
|
-
|
|
871
|
+
setDateState("");
|
|
753
872
|
if (props.onChange) {
|
|
754
873
|
props.onChange("");
|
|
755
874
|
}
|
|
756
875
|
}
|
|
757
876
|
};
|
|
758
|
-
const
|
|
759
|
-
|
|
760
|
-
const newDate = (0, import_moment.default)(currentDate).subtract(1, "days");
|
|
761
|
-
setDate(newDate);
|
|
762
|
-
if (props.onChange) {
|
|
763
|
-
props.onChange(newDate.format("lll"));
|
|
764
|
-
}
|
|
765
|
-
};
|
|
766
|
-
const onHandleIncrement = () => {
|
|
767
|
-
const currentDate = date || (0, import_moment.default)();
|
|
768
|
-
const newDate = (0, import_moment.default)(currentDate).add(1, "days");
|
|
769
|
-
setDate(newDate);
|
|
770
|
-
if (props.onChange) {
|
|
771
|
-
props.onChange(newDate.format("lll"));
|
|
772
|
-
}
|
|
877
|
+
const disabledDate = (current) => {
|
|
878
|
+
return current && current > (0, import_moment2.default)();
|
|
773
879
|
};
|
|
774
|
-
return /* @__PURE__ */ import_react21.default.createElement("div", null, /* @__PURE__ */ import_react21.default.createElement(
|
|
880
|
+
return /* @__PURE__ */ import_react21.default.createElement("div", null, /* @__PURE__ */ import_react21.default.createElement(
|
|
775
881
|
import_antd15.DatePicker,
|
|
776
882
|
{
|
|
883
|
+
disabledDate,
|
|
777
884
|
placeholder: props.placeholder,
|
|
778
|
-
value:
|
|
779
|
-
|
|
885
|
+
value: dateState,
|
|
886
|
+
format: { format: "DD-MM-YYYY" },
|
|
780
887
|
onChange: handleChange
|
|
781
888
|
}
|
|
782
|
-
)
|
|
889
|
+
));
|
|
783
890
|
};
|
|
784
891
|
|
|
785
892
|
// src/Components/DateRangePickerElement.tsx
|
|
786
893
|
var import_react22 = __toESM(require("react"));
|
|
787
894
|
var import_antd16 = require("antd");
|
|
788
|
-
var
|
|
895
|
+
var import_dayjs2 = __toESM(require("dayjs"));
|
|
896
|
+
var import_moment3 = __toESM(require("moment"));
|
|
789
897
|
var DateRangePickerElement = (props) => {
|
|
898
|
+
const { value } = props;
|
|
790
899
|
const { RangePicker } = import_antd16.DatePicker;
|
|
791
900
|
const handleChange = (dates, dateStrings) => {
|
|
792
|
-
if (dates
|
|
793
|
-
props.onChange(dateStrings);
|
|
901
|
+
if (dates) {
|
|
902
|
+
props.onChange && props.onChange(dateStrings);
|
|
794
903
|
} else {
|
|
795
|
-
|
|
904
|
+
props.onChange && props.onChange("");
|
|
796
905
|
}
|
|
797
906
|
};
|
|
798
907
|
const rangePresets = [
|
|
799
|
-
{ label: "Last 7 Days", value: [(0,
|
|
800
|
-
{ label: "Last 14 Days", value: [(0,
|
|
801
|
-
{ label: "Last 30 Days", value: [(0,
|
|
802
|
-
{ label: "Last 90 Days", value: [(0,
|
|
908
|
+
{ label: "Last 7 Days", value: [(0, import_dayjs2.default)().add(-7, "d"), (0, import_dayjs2.default)()] },
|
|
909
|
+
{ label: "Last 14 Days", value: [(0, import_dayjs2.default)().add(-14, "d"), (0, import_dayjs2.default)()] },
|
|
910
|
+
{ label: "Last 30 Days", value: [(0, import_dayjs2.default)().add(-30, "d"), (0, import_dayjs2.default)()] },
|
|
911
|
+
{ label: "Last 90 Days", value: [(0, import_dayjs2.default)().add(-90, "d"), (0, import_dayjs2.default)()] }
|
|
803
912
|
];
|
|
804
|
-
|
|
913
|
+
const disabledDate = (current) => {
|
|
914
|
+
return current && current > (0, import_moment3.default)();
|
|
915
|
+
};
|
|
916
|
+
return /* @__PURE__ */ import_react22.default.createElement(import_antd16.Space, { direction: "vertical", size: 12 }, /* @__PURE__ */ import_react22.default.createElement(
|
|
917
|
+
RangePicker,
|
|
918
|
+
{
|
|
919
|
+
disabledDate,
|
|
920
|
+
presets: rangePresets,
|
|
921
|
+
onChange: handleChange,
|
|
922
|
+
value: value && [(0, import_dayjs2.default)(value[0]), (0, import_dayjs2.default)(value[1])]
|
|
923
|
+
}
|
|
924
|
+
));
|
|
805
925
|
};
|
|
806
926
|
|
|
807
927
|
// src/Components/Image.tsx
|
|
808
928
|
var import_react23 = __toESM(require("react"));
|
|
809
929
|
var Image = (props) => {
|
|
810
|
-
return /* @__PURE__ */ import_react23.default.createElement("
|
|
930
|
+
return /* @__PURE__ */ import_react23.default.createElement("img", { className: props.className, src: props.img, alt: "image" });
|
|
811
931
|
};
|
|
812
932
|
|
|
813
933
|
// src/Components/SingleCheckbox.tsx
|
|
@@ -826,42 +946,55 @@ var SingleCheckbox = (props) => {
|
|
|
826
946
|
var import_react25 = __toESM(require("react"));
|
|
827
947
|
var import_antd18 = require("antd");
|
|
828
948
|
var DropDownGroup = (props) => {
|
|
829
|
-
const [selectedValue, setSelectedValue] = (0, import_react25.useState)({
|
|
949
|
+
const [selectedValue, setSelectedValue] = (0, import_react25.useState)({
|
|
950
|
+
firstValue: {},
|
|
951
|
+
secondValue: {},
|
|
952
|
+
temp: ""
|
|
953
|
+
});
|
|
830
954
|
const handleFirstChange = (value) => {
|
|
831
|
-
|
|
955
|
+
console.log(selectedValue.temp);
|
|
956
|
+
const filterOption2 = props.firstOptions?.find(
|
|
957
|
+
(eachOption) => eachOption.value === value
|
|
958
|
+
);
|
|
832
959
|
setSelectedValue((prev) => {
|
|
833
960
|
const newValue = { ...prev, firstValue: filterOption2 };
|
|
961
|
+
const { temp, ...rest } = newValue;
|
|
834
962
|
if (newValue.firstValue) {
|
|
835
|
-
props.onChange?.(
|
|
963
|
+
props.onChange?.(rest);
|
|
836
964
|
}
|
|
837
|
-
return
|
|
965
|
+
return newValue;
|
|
838
966
|
});
|
|
839
967
|
};
|
|
840
968
|
const handleSecondChange = (value) => {
|
|
841
|
-
const filterOption2 = props.
|
|
969
|
+
const filterOption2 = props.secondOptions?.find(
|
|
970
|
+
(eachOption) => eachOption.value === value
|
|
971
|
+
);
|
|
842
972
|
setSelectedValue((prev) => {
|
|
843
973
|
const newValue = { ...prev, secondValue: filterOption2 };
|
|
974
|
+
const { temp, ...rest } = newValue;
|
|
844
975
|
if (newValue.secondValue) {
|
|
845
|
-
props.onChange?.(
|
|
976
|
+
props.onChange?.(rest);
|
|
846
977
|
}
|
|
847
|
-
return
|
|
978
|
+
return newValue;
|
|
848
979
|
});
|
|
849
980
|
};
|
|
850
|
-
return /* @__PURE__ */ import_react25.default.createElement("div", { className: props.
|
|
981
|
+
return /* @__PURE__ */ import_react25.default.createElement("div", { className: props.containerClassName }, props.label && /* @__PURE__ */ import_react25.default.createElement("label", { htmlFor: props.name, className: props.labelClassName }, props.label), /* @__PURE__ */ import_react25.default.createElement("div", { className: props.subContainerClassName }, /* @__PURE__ */ import_react25.default.createElement(
|
|
851
982
|
import_antd18.Select,
|
|
852
983
|
{
|
|
853
984
|
onChange: handleFirstChange,
|
|
854
985
|
variant: props.variant,
|
|
855
|
-
options: props.
|
|
986
|
+
options: props.firstOptions,
|
|
987
|
+
className: props.className
|
|
856
988
|
}
|
|
857
989
|
), /* @__PURE__ */ import_react25.default.createElement("div", { style: { borderLeft: "1px solid gray", height: "33px" } }), /* @__PURE__ */ import_react25.default.createElement(
|
|
858
990
|
import_antd18.Select,
|
|
859
991
|
{
|
|
860
992
|
onChange: handleSecondChange,
|
|
861
993
|
variant: props.variant,
|
|
862
|
-
options: props.
|
|
994
|
+
options: props.secondOptions,
|
|
995
|
+
className: props.className
|
|
863
996
|
}
|
|
864
|
-
));
|
|
997
|
+
)));
|
|
865
998
|
};
|
|
866
999
|
|
|
867
1000
|
// src/Components/FilesUpload.tsx
|
|
@@ -871,14 +1004,6 @@ var import_icons5 = require("@ant-design/icons");
|
|
|
871
1004
|
var FileUpload = (props) => {
|
|
872
1005
|
const { Dragger } = import_antd19.Upload;
|
|
873
1006
|
const [files, setFiles] = (0, import_react26.useState)([]);
|
|
874
|
-
const beforeUpload = (file) => {
|
|
875
|
-
const isCorrectFile = ["image/png", "image/jpg", "image/jpeg", "application/pdf"].includes(file.type);
|
|
876
|
-
if (!isCorrectFile) {
|
|
877
|
-
import_antd19.message.error(`(${file.name}) is an invalid file. Please upload files with the following extensions only (.png/.jpg/.jpeg/.pdf)`);
|
|
878
|
-
return import_antd19.Upload.LIST_IGNORE;
|
|
879
|
-
}
|
|
880
|
-
return true;
|
|
881
|
-
};
|
|
882
1007
|
const handleChange = ({ fileList }) => {
|
|
883
1008
|
setFiles(fileList);
|
|
884
1009
|
if (props.onChange) {
|
|
@@ -902,7 +1027,6 @@ var FileUpload = (props) => {
|
|
|
902
1027
|
maxCount: props.max_count,
|
|
903
1028
|
multiple: props.multiple,
|
|
904
1029
|
fileList: files,
|
|
905
|
-
beforeUpload,
|
|
906
1030
|
onChange: handleChange,
|
|
907
1031
|
showUploadList: true,
|
|
908
1032
|
customRequest
|
|
@@ -923,28 +1047,561 @@ var TabsElement = (props) => {
|
|
|
923
1047
|
};
|
|
924
1048
|
return /* @__PURE__ */ import_react27.default.createElement(import_antd20.Tabs, { className: props.containerClassName, items: props.options, onChange: handleChange });
|
|
925
1049
|
};
|
|
1050
|
+
|
|
1051
|
+
// src/Components/SwitchElement.tsx
|
|
1052
|
+
var import_react28 = __toESM(require("react"));
|
|
1053
|
+
var import_antd21 = require("antd");
|
|
1054
|
+
var onChange = (checked) => {
|
|
1055
|
+
console.log(`switch to ${checked}`);
|
|
1056
|
+
};
|
|
1057
|
+
var SwitchElement = () => /* @__PURE__ */ import_react28.default.createElement(import_antd21.Switch, { defaultChecked: true, onChange });
|
|
1058
|
+
|
|
1059
|
+
// src/Components/Upload.tsx
|
|
1060
|
+
var import_react29 = __toESM(require("react"));
|
|
1061
|
+
var Upload2 = (props) => {
|
|
1062
|
+
const [file, setFile] = (0, import_react29.useState)();
|
|
1063
|
+
const handleFileChange = (e) => {
|
|
1064
|
+
setFile(e.target.files[0]);
|
|
1065
|
+
if (props.onChange) {
|
|
1066
|
+
props.onChange(e.target.files[0]);
|
|
1067
|
+
}
|
|
1068
|
+
};
|
|
1069
|
+
const handleUpload = async () => {
|
|
1070
|
+
if (!file) {
|
|
1071
|
+
console.error("No file selected");
|
|
1072
|
+
return;
|
|
1073
|
+
}
|
|
1074
|
+
};
|
|
1075
|
+
return /* @__PURE__ */ import_react29.default.createElement("div", { style: { marginTop: 16 } }, /* @__PURE__ */ import_react29.default.createElement("input", { type: "file", onChange: handleFileChange }), /* @__PURE__ */ import_react29.default.createElement(
|
|
1076
|
+
"button",
|
|
1077
|
+
{
|
|
1078
|
+
type: "button",
|
|
1079
|
+
onClick: handleUpload,
|
|
1080
|
+
disabled: !file,
|
|
1081
|
+
style: { marginTop: 16 }
|
|
1082
|
+
},
|
|
1083
|
+
"Upload"
|
|
1084
|
+
));
|
|
1085
|
+
};
|
|
1086
|
+
|
|
1087
|
+
// src/Components/OtpElement.tsx
|
|
1088
|
+
var import_react30 = __toESM(require("react"));
|
|
1089
|
+
var import_antd22 = require("antd");
|
|
1090
|
+
var OtpElement = (props) => {
|
|
1091
|
+
const length = props.length;
|
|
1092
|
+
const [otp, setOtp] = (0, import_react30.useState)(Array(length).fill(""));
|
|
1093
|
+
const inputRefs = (0, import_react30.useRef)([]);
|
|
1094
|
+
const handleChange = (e, index) => {
|
|
1095
|
+
const value = e.target.value;
|
|
1096
|
+
if (/^[0-9]$/.test(value) || value === "") {
|
|
1097
|
+
const newOtp = [...otp];
|
|
1098
|
+
newOtp[index] = value;
|
|
1099
|
+
setOtp(newOtp);
|
|
1100
|
+
props.onChange && props.onChange(newOtp.join(""));
|
|
1101
|
+
if (value && index < length - 1) {
|
|
1102
|
+
inputRefs.current[index + 1]?.focus();
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
};
|
|
1106
|
+
const handleKeyDown = (e, index) => {
|
|
1107
|
+
if (e.key === "Backspace" && !otp[index] && index > 0) {
|
|
1108
|
+
inputRefs.current[index - 1]?.focus();
|
|
1109
|
+
}
|
|
1110
|
+
};
|
|
1111
|
+
const handlePaste = (e) => {
|
|
1112
|
+
e.preventDefault();
|
|
1113
|
+
const pasteData = e.clipboardData.getData("text");
|
|
1114
|
+
if (/^\d+$/.test(pasteData)) {
|
|
1115
|
+
const newOtp = pasteData.split("").slice(0, length);
|
|
1116
|
+
setOtp(newOtp.concat(Array(length - newOtp.length).fill("")));
|
|
1117
|
+
props.onChange && props.onChange(newOtp.join(""));
|
|
1118
|
+
newOtp.forEach((_, idx) => {
|
|
1119
|
+
if (inputRefs.current[idx]) {
|
|
1120
|
+
inputRefs.current[idx]?.focus();
|
|
1121
|
+
}
|
|
1122
|
+
});
|
|
1123
|
+
}
|
|
1124
|
+
};
|
|
1125
|
+
(0, import_react30.useEffect)(() => {
|
|
1126
|
+
inputRefs.current[0]?.focus();
|
|
1127
|
+
}, []);
|
|
1128
|
+
return /* @__PURE__ */ import_react30.default.createElement("div", { className: props.containerClassName }, Array.from({ length }).map((_, index) => /* @__PURE__ */ import_react30.default.createElement(
|
|
1129
|
+
import_antd22.Input,
|
|
1130
|
+
{
|
|
1131
|
+
key: index,
|
|
1132
|
+
className: props.className,
|
|
1133
|
+
maxLength: 1,
|
|
1134
|
+
value: otp[index],
|
|
1135
|
+
onChange: (e) => handleChange(e, index),
|
|
1136
|
+
onKeyDown: (e) => handleKeyDown(e, index),
|
|
1137
|
+
onPaste: handlePaste,
|
|
1138
|
+
ref: (el) => inputRefs.current[index] = el
|
|
1139
|
+
}
|
|
1140
|
+
)));
|
|
1141
|
+
};
|
|
1142
|
+
|
|
1143
|
+
// src/Components/CircleDonut.tsx
|
|
1144
|
+
var import_react31 = __toESM(require("react"));
|
|
1145
|
+
var import_react_chartjs_2 = require("react-chartjs-2");
|
|
1146
|
+
var import_chart = require("chart.js");
|
|
1147
|
+
import_chart.Chart.register(import_chart.DoughnutController, import_chart.ArcElement, import_chart.Tooltip, import_chart.Legend);
|
|
1148
|
+
var CircleDonut = (props) => {
|
|
1149
|
+
const data = {
|
|
1150
|
+
labels: props.labels,
|
|
1151
|
+
datasets: [
|
|
1152
|
+
{
|
|
1153
|
+
label: "Bot Conversation",
|
|
1154
|
+
data: props.data,
|
|
1155
|
+
backgroundColor: [
|
|
1156
|
+
"#FFCB8A",
|
|
1157
|
+
"#CADBBF",
|
|
1158
|
+
"#8AC1BB",
|
|
1159
|
+
"#FCB0CB",
|
|
1160
|
+
"#CEB0FA"
|
|
1161
|
+
],
|
|
1162
|
+
borderWidth: 0
|
|
1163
|
+
}
|
|
1164
|
+
]
|
|
1165
|
+
};
|
|
1166
|
+
const options = {
|
|
1167
|
+
responsive: true,
|
|
1168
|
+
cutout: "80%",
|
|
1169
|
+
plugins: {
|
|
1170
|
+
legend: {
|
|
1171
|
+
position: "left",
|
|
1172
|
+
labels: {
|
|
1173
|
+
font: {
|
|
1174
|
+
size: 10
|
|
1175
|
+
},
|
|
1176
|
+
boxWidth: 15,
|
|
1177
|
+
generateLabels: (chart) => {
|
|
1178
|
+
const dataset = chart.data.datasets[0];
|
|
1179
|
+
return chart.data.labels.map((label, index) => {
|
|
1180
|
+
const value = dataset.data[index];
|
|
1181
|
+
return {
|
|
1182
|
+
text: `${label}: ${value}`,
|
|
1183
|
+
fillStyle: dataset.backgroundColor[index]
|
|
1184
|
+
};
|
|
1185
|
+
});
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
},
|
|
1189
|
+
tooltip: {
|
|
1190
|
+
enabled: true,
|
|
1191
|
+
callbacks: {
|
|
1192
|
+
label: function(context) {
|
|
1193
|
+
const label = context.label || "";
|
|
1194
|
+
const value = context.raw || 0;
|
|
1195
|
+
return `${label}: ${value}`;
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
};
|
|
1201
|
+
const centerTextPlugin = {
|
|
1202
|
+
id: "centerText",
|
|
1203
|
+
beforeDraw: (chart) => {
|
|
1204
|
+
const { ctx, chartArea: { left, right, top, bottom } } = chart;
|
|
1205
|
+
const width = right - left;
|
|
1206
|
+
const height = bottom - top;
|
|
1207
|
+
const centerX = left + width / 2;
|
|
1208
|
+
const centerY = top + height / 2;
|
|
1209
|
+
ctx.save();
|
|
1210
|
+
ctx.font = "7px Arial";
|
|
1211
|
+
ctx.fillStyle = "blue";
|
|
1212
|
+
ctx.textAlign = "center";
|
|
1213
|
+
ctx.textBaseline = "middle";
|
|
1214
|
+
ctx.fillText("Total Sessions", centerX, centerY - 10);
|
|
1215
|
+
ctx.font = "25px Arial";
|
|
1216
|
+
ctx.fillStyle = "black";
|
|
1217
|
+
ctx.fillText("85", centerX, centerY + 20);
|
|
1218
|
+
ctx.restore();
|
|
1219
|
+
}
|
|
1220
|
+
};
|
|
1221
|
+
return /* @__PURE__ */ import_react31.default.createElement("div", { className: props.className }, /* @__PURE__ */ import_react31.default.createElement("h1", { className: props.labelClassName }, props.label), /* @__PURE__ */ import_react31.default.createElement(import_react_chartjs_2.Doughnut, { data, options, plugins: [centerTextPlugin] }));
|
|
1222
|
+
};
|
|
1223
|
+
|
|
1224
|
+
// src/Components/SemiCircleDonut.tsx
|
|
1225
|
+
var import_react32 = __toESM(require("react"));
|
|
1226
|
+
var import_react_chartjs_22 = require("react-chartjs-2");
|
|
1227
|
+
var import_chart2 = require("chart.js");
|
|
1228
|
+
import_chart2.Chart.register(import_chart2.DoughnutController, import_chart2.ArcElement, import_chart2.Tooltip, import_chart2.Legend);
|
|
1229
|
+
var SemiCircleDonut = (props) => {
|
|
1230
|
+
const data = {
|
|
1231
|
+
labels: [
|
|
1232
|
+
"Registration",
|
|
1233
|
+
"Book Appointment",
|
|
1234
|
+
"Diagnostic Tests",
|
|
1235
|
+
"Hospital Facility",
|
|
1236
|
+
"Others, Prescriptions"
|
|
1237
|
+
],
|
|
1238
|
+
datasets: [
|
|
1239
|
+
{
|
|
1240
|
+
label: "Bot Conversation",
|
|
1241
|
+
data: [30, 10, 27, 40, 12],
|
|
1242
|
+
backgroundColor: [
|
|
1243
|
+
"#FFCB8A",
|
|
1244
|
+
"#CADBBF",
|
|
1245
|
+
"#8AC1BB",
|
|
1246
|
+
"#FCB0CB",
|
|
1247
|
+
"#CEB0FA"
|
|
1248
|
+
],
|
|
1249
|
+
borderWidth: 0
|
|
1250
|
+
}
|
|
1251
|
+
]
|
|
1252
|
+
};
|
|
1253
|
+
const options = {
|
|
1254
|
+
responsive: true,
|
|
1255
|
+
circumference: 180,
|
|
1256
|
+
rotation: -90,
|
|
1257
|
+
cutout: "80%",
|
|
1258
|
+
plugins: {
|
|
1259
|
+
legend: {
|
|
1260
|
+
display: false
|
|
1261
|
+
// Disable the legend
|
|
1262
|
+
},
|
|
1263
|
+
tooltip: {
|
|
1264
|
+
enabled: true,
|
|
1265
|
+
callbacks: {
|
|
1266
|
+
label: function(context) {
|
|
1267
|
+
const label = context.label || "";
|
|
1268
|
+
const value = context.raw || 0;
|
|
1269
|
+
return `${label}: ${value}`;
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
};
|
|
1275
|
+
const centerTextPlugin = {
|
|
1276
|
+
id: "centerText",
|
|
1277
|
+
beforeDraw: (chart) => {
|
|
1278
|
+
const { ctx, chartArea: { left, right, top, bottom } } = chart;
|
|
1279
|
+
const width = right - left;
|
|
1280
|
+
const height = bottom - top;
|
|
1281
|
+
const centerX = left + width / 2;
|
|
1282
|
+
const centerY = top + height / 1.5;
|
|
1283
|
+
const maxWidth = width * 0.8;
|
|
1284
|
+
ctx.save();
|
|
1285
|
+
ctx.fillStyle = "black";
|
|
1286
|
+
ctx.textAlign = "center";
|
|
1287
|
+
ctx.textBaseline = "middle";
|
|
1288
|
+
const drawText = (text, y, fontSize) => {
|
|
1289
|
+
ctx.font = `${fontSize}px Arial`;
|
|
1290
|
+
const textWidth = ctx.measureText(text).width;
|
|
1291
|
+
if (textWidth > maxWidth) {
|
|
1292
|
+
const newFontSize = fontSize * maxWidth / textWidth;
|
|
1293
|
+
ctx.font = `${newFontSize}px Arial`;
|
|
1294
|
+
}
|
|
1295
|
+
ctx.fillText(text, centerX, y);
|
|
1296
|
+
};
|
|
1297
|
+
drawText(props.fillText1, centerY - 10, 16);
|
|
1298
|
+
drawText(props.fillText2, centerY + 20, 8);
|
|
1299
|
+
ctx.restore();
|
|
1300
|
+
}
|
|
1301
|
+
};
|
|
1302
|
+
return /* @__PURE__ */ import_react32.default.createElement("div", { className: props.className }, /* @__PURE__ */ import_react32.default.createElement("h1", { className: props.labelClassName }, props.label), /* @__PURE__ */ import_react32.default.createElement(import_react_chartjs_22.Doughnut, { data, options, plugins: [centerTextPlugin] }));
|
|
1303
|
+
};
|
|
1304
|
+
|
|
1305
|
+
// src/Components/HorizontalBarChart.tsx
|
|
1306
|
+
var import_react33 = __toESM(require("react"));
|
|
1307
|
+
var import_react_chartjs_23 = require("react-chartjs-2");
|
|
1308
|
+
var import_chart3 = require("chart.js");
|
|
1309
|
+
import_chart3.Chart.register(import_chart3.BarElement, import_chart3.CategoryScale, import_chart3.LinearScale, import_chart3.Tooltip);
|
|
1310
|
+
var HorizontalBarChart = (props) => {
|
|
1311
|
+
const data = {
|
|
1312
|
+
labels: ["18-24", "25-34", "35-44", "45-54", "55-64", "65+"],
|
|
1313
|
+
datasets: [
|
|
1314
|
+
{
|
|
1315
|
+
data: [30, 10, 27, 40, 12, 24],
|
|
1316
|
+
backgroundColor: "#6298D5",
|
|
1317
|
+
barThickness: 15
|
|
1318
|
+
}
|
|
1319
|
+
]
|
|
1320
|
+
};
|
|
1321
|
+
const options = {
|
|
1322
|
+
responsive: true,
|
|
1323
|
+
indexAxis: "y",
|
|
1324
|
+
scales: {
|
|
1325
|
+
x: {
|
|
1326
|
+
beginAtZero: true,
|
|
1327
|
+
ticks: {
|
|
1328
|
+
callback: function(value) {
|
|
1329
|
+
return `${value}%`;
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
},
|
|
1333
|
+
y: {
|
|
1334
|
+
grid: {
|
|
1335
|
+
display: false
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
},
|
|
1339
|
+
plugins: {
|
|
1340
|
+
tooltip: {
|
|
1341
|
+
enabled: true,
|
|
1342
|
+
callbacks: {
|
|
1343
|
+
label: function(context) {
|
|
1344
|
+
const label = context.label || "";
|
|
1345
|
+
const value = context.raw || 0;
|
|
1346
|
+
return `${label}: ${value}`;
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
},
|
|
1350
|
+
legend: {
|
|
1351
|
+
display: false
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
};
|
|
1355
|
+
return /* @__PURE__ */ import_react33.default.createElement("div", { className: props.className }, /* @__PURE__ */ import_react33.default.createElement("h1", { className: props.labelClassName }, props.label), /* @__PURE__ */ import_react33.default.createElement(import_react_chartjs_23.Bar, { data, options }));
|
|
1356
|
+
};
|
|
1357
|
+
|
|
1358
|
+
// src/Components/LineChart.tsx
|
|
1359
|
+
var import_react34 = __toESM(require("react"));
|
|
1360
|
+
var import_auto = __toESM(require("chart.js/auto"));
|
|
1361
|
+
var LineChart = (props) => {
|
|
1362
|
+
const chartRef = (0, import_react34.useRef)(null);
|
|
1363
|
+
const chartInstance = (0, import_react34.useRef)(null);
|
|
1364
|
+
const data = [
|
|
1365
|
+
{ label: "ROI", data: [10, 13, 20, 15, 10] },
|
|
1366
|
+
{ label: "Engagement Rate", data: [20, 23, 30, 28, 20] },
|
|
1367
|
+
{ label: "Conversion Rate", data: [50, 100, 150, 180, 50] }
|
|
1368
|
+
];
|
|
1369
|
+
const labels = ["Instagram", "Whatsapp", "Messages", "Telegram", "Linkedin"];
|
|
1370
|
+
(0, import_react34.useEffect)(() => {
|
|
1371
|
+
if (chartRef.current) {
|
|
1372
|
+
if (chartInstance.current) {
|
|
1373
|
+
chartInstance.current.destroy();
|
|
1374
|
+
}
|
|
1375
|
+
chartInstance.current = new import_auto.default(chartRef.current, {
|
|
1376
|
+
type: "line",
|
|
1377
|
+
data: {
|
|
1378
|
+
labels,
|
|
1379
|
+
datasets: data.map((dataset, index) => ({
|
|
1380
|
+
label: dataset.label,
|
|
1381
|
+
data: dataset.data,
|
|
1382
|
+
borderColor: index === 0 ? "#FF8F00" : index === 1 ? "#F50057" : "#254AAA",
|
|
1383
|
+
backgroundColor: "rgba(0, 0, 0, 0)",
|
|
1384
|
+
pointBackgroundColor: index === 0 ? "#FF8F00" : index === 1 ? "#F50057" : "#254AAA",
|
|
1385
|
+
pointBorderColor: "white",
|
|
1386
|
+
pointStyle: "circle",
|
|
1387
|
+
pointRadius: 3,
|
|
1388
|
+
tension: 0.1,
|
|
1389
|
+
fill: true
|
|
1390
|
+
}))
|
|
1391
|
+
},
|
|
1392
|
+
options: {
|
|
1393
|
+
plugins: {
|
|
1394
|
+
legend: {
|
|
1395
|
+
labels: {
|
|
1396
|
+
usePointStyle: true
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
},
|
|
1400
|
+
scales: {
|
|
1401
|
+
x: {
|
|
1402
|
+
grid: {
|
|
1403
|
+
display: false
|
|
1404
|
+
}
|
|
1405
|
+
},
|
|
1406
|
+
y: {
|
|
1407
|
+
beginAtZero: true,
|
|
1408
|
+
suggestedMax: 200,
|
|
1409
|
+
ticks: {
|
|
1410
|
+
callback: function(value) {
|
|
1411
|
+
return value + "%";
|
|
1412
|
+
}
|
|
1413
|
+
},
|
|
1414
|
+
grid: {
|
|
1415
|
+
display: true
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
});
|
|
1421
|
+
}
|
|
1422
|
+
return () => {
|
|
1423
|
+
if (chartInstance.current) {
|
|
1424
|
+
chartInstance.current.destroy();
|
|
1425
|
+
}
|
|
1426
|
+
};
|
|
1427
|
+
}, [labels, data]);
|
|
1428
|
+
return /* @__PURE__ */ import_react34.default.createElement("div", { className: props.className }, /* @__PURE__ */ import_react34.default.createElement("canvas", { ref: chartRef }));
|
|
1429
|
+
};
|
|
1430
|
+
|
|
1431
|
+
// src/Components/DoubleBarChart.tsx
|
|
1432
|
+
var import_react35 = __toESM(require("react"));
|
|
1433
|
+
var import_auto2 = __toESM(require("chart.js/auto"));
|
|
1434
|
+
var DoubleBarChart = (props) => {
|
|
1435
|
+
const chartRef = (0, import_react35.useRef)(null);
|
|
1436
|
+
const chartInstance = (0, import_react35.useRef)(null);
|
|
1437
|
+
(0, import_react35.useEffect)(() => {
|
|
1438
|
+
if (chartRef.current) {
|
|
1439
|
+
if (chartInstance.current) {
|
|
1440
|
+
chartInstance.current.destroy();
|
|
1441
|
+
}
|
|
1442
|
+
chartInstance.current = new import_auto2.default(chartRef.current, {
|
|
1443
|
+
type: "bar",
|
|
1444
|
+
data: {
|
|
1445
|
+
labels: [
|
|
1446
|
+
"Summer Health Tips",
|
|
1447
|
+
"New Services Launch",
|
|
1448
|
+
"Discounts on Checkups",
|
|
1449
|
+
"Wellness Webinar",
|
|
1450
|
+
"LinkedIn Insights"
|
|
1451
|
+
],
|
|
1452
|
+
datasets: [
|
|
1453
|
+
{
|
|
1454
|
+
label: "Engagement Rate",
|
|
1455
|
+
data: [60, 70, 50, 80, 65],
|
|
1456
|
+
// Example data for male
|
|
1457
|
+
backgroundColor: "#93B8E2",
|
|
1458
|
+
barThickness: 10
|
|
1459
|
+
},
|
|
1460
|
+
{
|
|
1461
|
+
label: "Conversion Rate",
|
|
1462
|
+
data: [70, 65, 75, 55, 85],
|
|
1463
|
+
// Example data for female
|
|
1464
|
+
backgroundColor: "#4484CD",
|
|
1465
|
+
barThickness: 10
|
|
1466
|
+
}
|
|
1467
|
+
]
|
|
1468
|
+
},
|
|
1469
|
+
options: {
|
|
1470
|
+
scales: {
|
|
1471
|
+
x: {
|
|
1472
|
+
grid: {
|
|
1473
|
+
display: false
|
|
1474
|
+
// Display x-axis grid lines
|
|
1475
|
+
}
|
|
1476
|
+
},
|
|
1477
|
+
y: {
|
|
1478
|
+
beginAtZero: true,
|
|
1479
|
+
suggestedMax: 100,
|
|
1480
|
+
ticks: {
|
|
1481
|
+
callback: function(value) {
|
|
1482
|
+
return value + "%";
|
|
1483
|
+
}
|
|
1484
|
+
},
|
|
1485
|
+
grid: {
|
|
1486
|
+
display: true
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1489
|
+
},
|
|
1490
|
+
plugins: {
|
|
1491
|
+
legend: {
|
|
1492
|
+
labels: {
|
|
1493
|
+
usePointStyle: true
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1498
|
+
});
|
|
1499
|
+
}
|
|
1500
|
+
return () => {
|
|
1501
|
+
if (chartInstance.current) {
|
|
1502
|
+
chartInstance.current.destroy();
|
|
1503
|
+
}
|
|
1504
|
+
};
|
|
1505
|
+
}, []);
|
|
1506
|
+
return /* @__PURE__ */ import_react35.default.createElement("div", { className: props.className }, /* @__PURE__ */ import_react35.default.createElement("h1", { className: props.labelClassName }, props.label), /* @__PURE__ */ import_react35.default.createElement("canvas", { ref: chartRef }));
|
|
1507
|
+
};
|
|
1508
|
+
|
|
1509
|
+
// src/Components/BarChart.tsx
|
|
1510
|
+
var import_react36 = __toESM(require("react"));
|
|
1511
|
+
var import_react_chartjs_24 = require("react-chartjs-2");
|
|
1512
|
+
var import_chart4 = require("chart.js");
|
|
1513
|
+
import_chart4.Chart.register(import_chart4.BarElement, import_chart4.CategoryScale, import_chart4.LinearScale, import_chart4.Tooltip);
|
|
1514
|
+
var BarChart = (props) => {
|
|
1515
|
+
const data = {
|
|
1516
|
+
labels: [
|
|
1517
|
+
"17 June",
|
|
1518
|
+
"18 June",
|
|
1519
|
+
"19 June",
|
|
1520
|
+
"20 June",
|
|
1521
|
+
"21 June",
|
|
1522
|
+
"22 June",
|
|
1523
|
+
"23 June"
|
|
1524
|
+
],
|
|
1525
|
+
datasets: [
|
|
1526
|
+
{
|
|
1527
|
+
data: [30, 100, 270, 140, 120, 240],
|
|
1528
|
+
backgroundColor: "#1565C0",
|
|
1529
|
+
barThickness: 15
|
|
1530
|
+
}
|
|
1531
|
+
]
|
|
1532
|
+
};
|
|
1533
|
+
const options = {
|
|
1534
|
+
responsive: true,
|
|
1535
|
+
scales: {
|
|
1536
|
+
x: {
|
|
1537
|
+
beginAtZero: true,
|
|
1538
|
+
grid: {
|
|
1539
|
+
display: false
|
|
1540
|
+
}
|
|
1541
|
+
},
|
|
1542
|
+
y: {
|
|
1543
|
+
grid: {
|
|
1544
|
+
display: true
|
|
1545
|
+
},
|
|
1546
|
+
ticks: {
|
|
1547
|
+
min: 0,
|
|
1548
|
+
max: 400,
|
|
1549
|
+
stepSize: 200,
|
|
1550
|
+
callback: function(value) {
|
|
1551
|
+
return `${value}`;
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
},
|
|
1556
|
+
plugins: {
|
|
1557
|
+
tooltip: {
|
|
1558
|
+
enabled: true,
|
|
1559
|
+
callbacks: {
|
|
1560
|
+
label: function(context) {
|
|
1561
|
+
const label = context.label || "";
|
|
1562
|
+
const value = context.raw || 0;
|
|
1563
|
+
return ` ${label}: ${value}`;
|
|
1564
|
+
}
|
|
1565
|
+
}
|
|
1566
|
+
},
|
|
1567
|
+
legend: {
|
|
1568
|
+
display: false
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
};
|
|
1572
|
+
return /* @__PURE__ */ import_react36.default.createElement("div", { className: props.className }, /* @__PURE__ */ import_react36.default.createElement("h1", { className: props.labelClassName }, props.label), /* @__PURE__ */ import_react36.default.createElement(import_react_chartjs_24.Bar, { data, options }));
|
|
1573
|
+
};
|
|
926
1574
|
// Annotate the CommonJS export names for ESM import in node:
|
|
927
1575
|
0 && (module.exports = {
|
|
928
1576
|
AddMoreTable,
|
|
1577
|
+
BarChart,
|
|
929
1578
|
ButtonElement,
|
|
930
1579
|
CheckboxElement,
|
|
1580
|
+
CircleDonut,
|
|
931
1581
|
CkEditor,
|
|
932
1582
|
DatePickerElement,
|
|
933
1583
|
DateRangePickerElement,
|
|
1584
|
+
DoubleBarChart,
|
|
934
1585
|
DropDownGroup,
|
|
935
1586
|
FileUpload,
|
|
1587
|
+
HorizontalBarChart,
|
|
936
1588
|
Image,
|
|
1589
|
+
LineChart,
|
|
937
1590
|
MultipleSelectElement,
|
|
938
1591
|
Navbar,
|
|
939
1592
|
NumberElement,
|
|
1593
|
+
OtpElement,
|
|
940
1594
|
PasswordElement,
|
|
941
1595
|
RadioElement,
|
|
942
1596
|
SelectElement,
|
|
1597
|
+
SemiCircleDonut,
|
|
943
1598
|
Sidebar,
|
|
944
1599
|
SingleCheckbox,
|
|
945
1600
|
SingleSelectElement,
|
|
1601
|
+
SwitchElement,
|
|
946
1602
|
TableElement,
|
|
947
1603
|
TabsElement,
|
|
948
1604
|
TextElement,
|
|
949
|
-
TextareaElement
|
|
1605
|
+
TextareaElement,
|
|
1606
|
+
Upload
|
|
950
1607
|
});
|