@apexcura/ui-components 0.0.14-Beta194 → 0.0.14-Beta195
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/.env.defaults +2 -2
- package/dist/index.css +3 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +167 -53
- package/dist/index.mjs +172 -58
- package/package.json +1 -1
- package/postcss.config.js +6 -6
- package/tailwind.config.js +10 -10
package/.env.defaults
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
GOOGLE_CLIENT_ID=1234
|
|
2
|
-
GOOGLE_AUTH_ORIGINS=1234
|
|
1
|
+
GOOGLE_CLIENT_ID=1234
|
|
2
|
+
GOOGLE_AUTH_ORIGINS=1234
|
package/dist/index.css
CHANGED
|
@@ -460,6 +460,9 @@ video {
|
|
|
460
460
|
:where(.css-dev-only-do-not-override-1r287do).ant-radio-button-wrapper:first-child {
|
|
461
461
|
border-inline-start: 1px solid rgb(145 145 145);
|
|
462
462
|
}
|
|
463
|
+
:where(.css-dev-only-do-not-override-m4timi).ant-tabs-top > .ant-tabs-nav {
|
|
464
|
+
margin: 0px;
|
|
465
|
+
}
|
|
463
466
|
.hover\:bg-\[\#F2F2F2\]:hover {
|
|
464
467
|
--tw-bg-opacity: 1;
|
|
465
468
|
background-color: rgb(242 242 242 / var(--tw-bg-opacity));
|
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -385,10 +385,14 @@ var MultipleSelectElement = (props) => {
|
|
|
385
385
|
var import_react11 = __toESM(require("react"));
|
|
386
386
|
var ButtonElement = (props) => {
|
|
387
387
|
const [svgContent, setSvgContent] = (0, import_react11.useState)(null);
|
|
388
|
-
const [originalSvgContent, setOriginalSvgContent] = (0, import_react11.useState)(
|
|
388
|
+
const [originalSvgContent, setOriginalSvgContent] = (0, import_react11.useState)(
|
|
389
|
+
null
|
|
390
|
+
);
|
|
389
391
|
const [hoverColor, setHoverColor] = (0, import_react11.useState)(null);
|
|
392
|
+
const [loading, setLoading] = (0, import_react11.useState)(false);
|
|
390
393
|
(0, import_react11.useEffect)(() => {
|
|
391
394
|
if (props.icon) {
|
|
395
|
+
setLoading(true);
|
|
392
396
|
fetch(props.icon).then((response) => response.text()).then((data) => {
|
|
393
397
|
const tempDiv = document.createElement("div");
|
|
394
398
|
tempDiv.innerHTML = data;
|
|
@@ -422,7 +426,8 @@ var ButtonElement = (props) => {
|
|
|
422
426
|
}
|
|
423
427
|
}).catch((error) => console.error("Error fetching SVG:", error));
|
|
424
428
|
}
|
|
425
|
-
|
|
429
|
+
setLoading(false);
|
|
430
|
+
}, []);
|
|
426
431
|
const handleMouseEnter = () => {
|
|
427
432
|
if (hoverColor && originalSvgContent) {
|
|
428
433
|
const tempDiv = document.createElement("div");
|
|
@@ -450,12 +455,14 @@ var ButtonElement = (props) => {
|
|
|
450
455
|
cursor: props.loading ? "no-drop" : "pointer"
|
|
451
456
|
}
|
|
452
457
|
},
|
|
453
|
-
props.isLoading ? /* @__PURE__ */ import_react11.default.createElement(import_react11.default.Fragment, null, /* @__PURE__ */ import_react11.default.createElement("svg", { className: "animate-spin h-5 w-5 mr-3", viewBox: "0 0 24 24" }), props.label) : /* @__PURE__ */ import_react11.default.createElement(import_react11.default.Fragment, null, props.isSVGStylesOverride === false
|
|
454
|
-
"
|
|
458
|
+
props.isLoading ? /* @__PURE__ */ import_react11.default.createElement(import_react11.default.Fragment, null, /* @__PURE__ */ import_react11.default.createElement("svg", { className: "animate-spin h-5 w-5 mr-3", viewBox: "0 0 24 24" }), props.label) : /* @__PURE__ */ import_react11.default.createElement(import_react11.default.Fragment, null, props.isSVGStylesOverride === false && loading ? props.icon && /* @__PURE__ */ import_react11.default.createElement(
|
|
459
|
+
"img",
|
|
455
460
|
{
|
|
456
|
-
|
|
461
|
+
className: props.iconsClassName,
|
|
462
|
+
src: props.icon,
|
|
463
|
+
alt: props.label
|
|
457
464
|
}
|
|
458
|
-
), props.label)
|
|
465
|
+
) : svgContent && /* @__PURE__ */ import_react11.default.createElement("span", { className: props.iconsClassName, dangerouslySetInnerHTML: { __html: svgContent } }), props.label)
|
|
459
466
|
);
|
|
460
467
|
};
|
|
461
468
|
|
|
@@ -683,18 +690,48 @@ var import_antd13 = require("antd");
|
|
|
683
690
|
|
|
684
691
|
// src/Components/ModelBody.tsx
|
|
685
692
|
var import_react18 = __toESM(require("react"));
|
|
693
|
+
var import_moment = __toESM(require("moment"));
|
|
686
694
|
var ModelBody = (props) => {
|
|
687
|
-
return /* @__PURE__ */ import_react18.default.createElement("div", { className: props.modalContent && props.modalContent.className }, props.modalContent && props.modalContent.fields.map(
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
695
|
+
return /* @__PURE__ */ import_react18.default.createElement("div", { className: props.modalContent && props.modalContent.className }, props.modalContent && props.modalContent.fields.map(
|
|
696
|
+
(eachField) => {
|
|
697
|
+
if (eachField.element === "div") {
|
|
698
|
+
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(
|
|
699
|
+
"p",
|
|
700
|
+
{
|
|
701
|
+
style: {
|
|
702
|
+
fontSize: "10px",
|
|
703
|
+
textAlign: eachField.source === "bot" ? "left" : "right"
|
|
704
|
+
}
|
|
705
|
+
},
|
|
706
|
+
(0, import_moment.default)(eachField.dateTime).format("LT")
|
|
707
|
+
) : "");
|
|
708
|
+
} else if (eachField.element === "input-radio") {
|
|
709
|
+
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(
|
|
710
|
+
"p",
|
|
711
|
+
{
|
|
712
|
+
style: {
|
|
713
|
+
fontSize: "10px",
|
|
714
|
+
textAlign: eachField.source === "bot" ? "left" : "right"
|
|
715
|
+
}
|
|
716
|
+
},
|
|
717
|
+
(0, import_moment.default)(eachField.dateTime).format("LT")
|
|
718
|
+
) : "");
|
|
719
|
+
} else if (eachField.element === "button") {
|
|
720
|
+
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(
|
|
721
|
+
"p",
|
|
722
|
+
{
|
|
723
|
+
style: {
|
|
724
|
+
fontSize: "10px",
|
|
725
|
+
textAlign: eachField.source === "bot" ? "left" : "right"
|
|
726
|
+
}
|
|
727
|
+
},
|
|
728
|
+
(0, import_moment.default)(eachField.dateTime).format("LT")
|
|
729
|
+
) : "");
|
|
730
|
+
} else {
|
|
731
|
+
return null;
|
|
732
|
+
}
|
|
696
733
|
}
|
|
697
|
-
|
|
734
|
+
));
|
|
698
735
|
};
|
|
699
736
|
|
|
700
737
|
// src/Components/Model.tsx
|
|
@@ -719,9 +756,22 @@ var ModelElement = (props) => {
|
|
|
719
756
|
margin: "-10px"
|
|
720
757
|
}
|
|
721
758
|
},
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
759
|
+
columns.map((eachColumn) => {
|
|
760
|
+
if (!["index", "View"].includes(eachColumn.key) && eachColumn?.["is_detail"] !== false) {
|
|
761
|
+
return /* @__PURE__ */ import_react19.default.createElement("p", { style: { fontWeight: "500", padding: "10px" } }, /* @__PURE__ */ import_react19.default.createElement(
|
|
762
|
+
"span",
|
|
763
|
+
{
|
|
764
|
+
style: {
|
|
765
|
+
fontWeight: "200",
|
|
766
|
+
color: "gray",
|
|
767
|
+
paddingRight: "10px"
|
|
768
|
+
}
|
|
769
|
+
},
|
|
770
|
+
eachColumn.title
|
|
771
|
+
), selectedRecord[eachColumn.key] !== "" ? selectedRecord[eachColumn.key] : "--");
|
|
772
|
+
} else {
|
|
773
|
+
return null;
|
|
774
|
+
}
|
|
725
775
|
})
|
|
726
776
|
)
|
|
727
777
|
},
|
|
@@ -730,12 +780,24 @@ var ModelElement = (props) => {
|
|
|
730
780
|
};
|
|
731
781
|
|
|
732
782
|
// src/Components/TableElement.tsx
|
|
783
|
+
var import_icons4 = require("@ant-design/icons");
|
|
733
784
|
var TableElement = (props) => {
|
|
734
785
|
const { thead, tbody } = props;
|
|
735
786
|
const [selectedRecord, setSelectedRecord] = (0, import_react20.useState)({});
|
|
736
787
|
const [model, setModel] = (0, import_react20.useState)(false);
|
|
788
|
+
const [dataSource, setDataSource] = (0, import_react20.useState)([]);
|
|
789
|
+
(0, import_react20.useEffect)(() => {
|
|
790
|
+
if (tbody) {
|
|
791
|
+
setDataSource(
|
|
792
|
+
tbody.map((row, index) => ({
|
|
793
|
+
...row,
|
|
794
|
+
key: index,
|
|
795
|
+
index: index + 1
|
|
796
|
+
}))
|
|
797
|
+
);
|
|
798
|
+
}
|
|
799
|
+
}, [tbody]);
|
|
737
800
|
const handleChange = (record) => {
|
|
738
|
-
console.log("record", record);
|
|
739
801
|
if (props.onChange) {
|
|
740
802
|
props.onChange(record);
|
|
741
803
|
}
|
|
@@ -745,8 +807,8 @@ var TableElement = (props) => {
|
|
|
745
807
|
columns = [
|
|
746
808
|
{
|
|
747
809
|
title: "#",
|
|
748
|
-
dataIndex: "
|
|
749
|
-
key: "
|
|
810
|
+
dataIndex: "index",
|
|
811
|
+
key: "index",
|
|
750
812
|
fixed: "left"
|
|
751
813
|
},
|
|
752
814
|
...thead.map((col, ind) => ({
|
|
@@ -757,9 +819,9 @@ var TableElement = (props) => {
|
|
|
757
819
|
render: col.render,
|
|
758
820
|
sorter: {
|
|
759
821
|
compare: (a, b) => {
|
|
760
|
-
if (typeof a[col.key] === "number" && typeof
|
|
822
|
+
if (typeof a[col.key] === "number" && typeof b[col.key] === "number") {
|
|
761
823
|
return a[col.key] - b[col.key];
|
|
762
|
-
} else if (typeof a[col.key] === "string" && typeof
|
|
824
|
+
} else if (typeof a[col.key] === "string" && typeof b[col.key] === "string") {
|
|
763
825
|
return a[col.key].localeCompare(b[col.key]);
|
|
764
826
|
}
|
|
765
827
|
}
|
|
@@ -771,26 +833,34 @@ var TableElement = (props) => {
|
|
|
771
833
|
title: "View",
|
|
772
834
|
dataIndex: "View",
|
|
773
835
|
key: "View",
|
|
774
|
-
render: (_, record) =>
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
836
|
+
render: (_, record) => {
|
|
837
|
+
return /* @__PURE__ */ import_react20.default.createElement(
|
|
838
|
+
"a",
|
|
839
|
+
{
|
|
840
|
+
onClick: () => {
|
|
841
|
+
if (props.view) {
|
|
842
|
+
setSelectedRecord(record);
|
|
843
|
+
handleChange(record);
|
|
844
|
+
setModel(true);
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
},
|
|
848
|
+
/* @__PURE__ */ import_react20.default.createElement(import_icons4.EyeOutlined, null)
|
|
849
|
+
);
|
|
850
|
+
}
|
|
785
851
|
});
|
|
786
852
|
}
|
|
787
853
|
}
|
|
788
|
-
const
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
854
|
+
const onChangeTable = (pagination, filters, sorter, extra) => {
|
|
855
|
+
if (extra && extra.currentDataSource) {
|
|
856
|
+
setDataSource(
|
|
857
|
+
extra.currentDataSource.map((row, index) => ({
|
|
858
|
+
...row,
|
|
859
|
+
index: index + 1
|
|
860
|
+
}))
|
|
861
|
+
);
|
|
862
|
+
}
|
|
863
|
+
};
|
|
794
864
|
const onChangePage = (page, pageSize) => {
|
|
795
865
|
if (props.onChange) {
|
|
796
866
|
props.onChange({ name: "pagination", page, pageSize });
|
|
@@ -798,7 +868,11 @@ var TableElement = (props) => {
|
|
|
798
868
|
};
|
|
799
869
|
const rowSelectionConfig = props.rowSelection ? {
|
|
800
870
|
onChange: (selectedRowKeys, selectedRows) => {
|
|
801
|
-
console.log(
|
|
871
|
+
console.log(
|
|
872
|
+
`selectedRowKeys: ${selectedRowKeys}`,
|
|
873
|
+
"selectedRows: ",
|
|
874
|
+
selectedRows
|
|
875
|
+
);
|
|
802
876
|
if (props.onChange) {
|
|
803
877
|
props.onChange(selectedRows);
|
|
804
878
|
}
|
|
@@ -808,19 +882,41 @@ var TableElement = (props) => {
|
|
|
808
882
|
import_antd14.Table,
|
|
809
883
|
{
|
|
810
884
|
className: props.className,
|
|
811
|
-
pagination: {
|
|
885
|
+
pagination: props.pagination ? {
|
|
812
886
|
showTotal: (total) => `Total: ${total} items`,
|
|
813
|
-
total: count,
|
|
814
|
-
showSizeChanger: count > 10,
|
|
887
|
+
total: props.count,
|
|
888
|
+
showSizeChanger: props.count ? props.count > 10 : 0 > 10,
|
|
815
889
|
onChange: onChangePage
|
|
890
|
+
} : false,
|
|
891
|
+
onRow: (record) => {
|
|
892
|
+
return {
|
|
893
|
+
onClick: () => {
|
|
894
|
+
if (props.view) {
|
|
895
|
+
setSelectedRecord(record);
|
|
896
|
+
handleChange(record);
|
|
897
|
+
setModel(true);
|
|
898
|
+
}
|
|
899
|
+
},
|
|
900
|
+
style: { cursor: "pointer" }
|
|
901
|
+
};
|
|
816
902
|
},
|
|
817
903
|
rowSelection: rowSelectionConfig,
|
|
818
904
|
dataSource,
|
|
819
905
|
columns,
|
|
820
906
|
size: props.size,
|
|
821
|
-
bordered: true
|
|
907
|
+
bordered: true,
|
|
908
|
+
onChange: onChangeTable
|
|
822
909
|
}
|
|
823
|
-
), model && /* @__PURE__ */ import_react20.default.createElement(
|
|
910
|
+
), model && /* @__PURE__ */ import_react20.default.createElement(
|
|
911
|
+
ModelElement,
|
|
912
|
+
{
|
|
913
|
+
selectedRecord,
|
|
914
|
+
...props,
|
|
915
|
+
columns,
|
|
916
|
+
model,
|
|
917
|
+
onCancel: () => setModel(false)
|
|
918
|
+
}
|
|
919
|
+
));
|
|
824
920
|
};
|
|
825
921
|
|
|
826
922
|
// src/Components/DatePicker.tsx
|
|
@@ -828,6 +924,7 @@ var import_react21 = __toESM(require("react"));
|
|
|
828
924
|
var import_antd15 = require("antd");
|
|
829
925
|
var import_dayjs = __toESM(require("dayjs"));
|
|
830
926
|
var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat.js"));
|
|
927
|
+
var import_moment2 = __toESM(require("moment"));
|
|
831
928
|
import_dayjs.default.extend(import_customParseFormat.default);
|
|
832
929
|
var DatePickerElement = (props) => {
|
|
833
930
|
const [dateState, setDateState] = (0, import_react21.useState)("");
|
|
@@ -845,9 +942,13 @@ var DatePickerElement = (props) => {
|
|
|
845
942
|
}
|
|
846
943
|
}
|
|
847
944
|
};
|
|
945
|
+
const disabledDate = (current) => {
|
|
946
|
+
return current && current > (0, import_moment2.default)();
|
|
947
|
+
};
|
|
848
948
|
return /* @__PURE__ */ import_react21.default.createElement("div", null, /* @__PURE__ */ import_react21.default.createElement(
|
|
849
949
|
import_antd15.DatePicker,
|
|
850
950
|
{
|
|
951
|
+
disabledDate,
|
|
851
952
|
placeholder: props.placeholder,
|
|
852
953
|
value: dateState,
|
|
853
954
|
format: { format: "DD-MM-YYYY" },
|
|
@@ -860,13 +961,15 @@ var DatePickerElement = (props) => {
|
|
|
860
961
|
var import_react22 = __toESM(require("react"));
|
|
861
962
|
var import_antd16 = require("antd");
|
|
862
963
|
var import_dayjs2 = __toESM(require("dayjs"));
|
|
964
|
+
var import_moment3 = __toESM(require("moment"));
|
|
863
965
|
var DateRangePickerElement = (props) => {
|
|
966
|
+
const { value } = props;
|
|
864
967
|
const { RangePicker } = import_antd16.DatePicker;
|
|
865
968
|
const handleChange = (dates, dateStrings) => {
|
|
866
|
-
if (dates
|
|
867
|
-
props.onChange(dateStrings);
|
|
969
|
+
if (dates) {
|
|
970
|
+
props.onChange && props.onChange(dateStrings);
|
|
868
971
|
} else {
|
|
869
|
-
|
|
972
|
+
props.onChange && props.onChange("");
|
|
870
973
|
}
|
|
871
974
|
};
|
|
872
975
|
const rangePresets = [
|
|
@@ -875,7 +978,18 @@ var DateRangePickerElement = (props) => {
|
|
|
875
978
|
{ label: "Last 30 Days", value: [(0, import_dayjs2.default)().add(-30, "d"), (0, import_dayjs2.default)()] },
|
|
876
979
|
{ label: "Last 90 Days", value: [(0, import_dayjs2.default)().add(-90, "d"), (0, import_dayjs2.default)()] }
|
|
877
980
|
];
|
|
878
|
-
|
|
981
|
+
const disabledDate = (current) => {
|
|
982
|
+
return current && current > (0, import_moment3.default)();
|
|
983
|
+
};
|
|
984
|
+
return /* @__PURE__ */ import_react22.default.createElement(import_antd16.Space, { direction: "vertical", size: 12 }, /* @__PURE__ */ import_react22.default.createElement(
|
|
985
|
+
RangePicker,
|
|
986
|
+
{
|
|
987
|
+
disabledDate,
|
|
988
|
+
presets: rangePresets,
|
|
989
|
+
onChange: handleChange,
|
|
990
|
+
value: value && [(0, import_dayjs2.default)(value[0]), (0, import_dayjs2.default)(value[1])]
|
|
991
|
+
}
|
|
992
|
+
));
|
|
879
993
|
};
|
|
880
994
|
|
|
881
995
|
// src/Components/Image.tsx
|
|
@@ -954,7 +1068,7 @@ var DropDownGroup = (props) => {
|
|
|
954
1068
|
// src/Components/FilesUpload.tsx
|
|
955
1069
|
var import_react26 = __toESM(require("react"));
|
|
956
1070
|
var import_antd19 = require("antd");
|
|
957
|
-
var
|
|
1071
|
+
var import_icons5 = require("@ant-design/icons");
|
|
958
1072
|
var FileUpload = (props) => {
|
|
959
1073
|
const { Dragger } = import_antd19.Upload;
|
|
960
1074
|
const [files, setFiles] = (0, import_react26.useState)([]);
|
|
@@ -985,7 +1099,7 @@ var FileUpload = (props) => {
|
|
|
985
1099
|
showUploadList: true,
|
|
986
1100
|
customRequest
|
|
987
1101
|
},
|
|
988
|
-
/* @__PURE__ */ import_react26.default.createElement("p", null, /* @__PURE__ */ import_react26.default.createElement(
|
|
1102
|
+
/* @__PURE__ */ import_react26.default.createElement("p", null, /* @__PURE__ */ import_react26.default.createElement(import_icons5.InboxOutlined, null)),
|
|
989
1103
|
/* @__PURE__ */ import_react26.default.createElement("p", null, "Click or drag file to upload")
|
|
990
1104
|
));
|
|
991
1105
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -319,10 +319,14 @@ var MultipleSelectElement = (props) => {
|
|
|
319
319
|
import React11, { useEffect, useState as useState4 } from "react";
|
|
320
320
|
var ButtonElement = (props) => {
|
|
321
321
|
const [svgContent, setSvgContent] = useState4(null);
|
|
322
|
-
const [originalSvgContent, setOriginalSvgContent] = useState4(
|
|
322
|
+
const [originalSvgContent, setOriginalSvgContent] = useState4(
|
|
323
|
+
null
|
|
324
|
+
);
|
|
323
325
|
const [hoverColor, setHoverColor] = useState4(null);
|
|
326
|
+
const [loading, setLoading] = useState4(false);
|
|
324
327
|
useEffect(() => {
|
|
325
328
|
if (props.icon) {
|
|
329
|
+
setLoading(true);
|
|
326
330
|
fetch(props.icon).then((response) => response.text()).then((data) => {
|
|
327
331
|
const tempDiv = document.createElement("div");
|
|
328
332
|
tempDiv.innerHTML = data;
|
|
@@ -356,7 +360,8 @@ var ButtonElement = (props) => {
|
|
|
356
360
|
}
|
|
357
361
|
}).catch((error) => console.error("Error fetching SVG:", error));
|
|
358
362
|
}
|
|
359
|
-
|
|
363
|
+
setLoading(false);
|
|
364
|
+
}, []);
|
|
360
365
|
const handleMouseEnter = () => {
|
|
361
366
|
if (hoverColor && originalSvgContent) {
|
|
362
367
|
const tempDiv = document.createElement("div");
|
|
@@ -384,12 +389,14 @@ var ButtonElement = (props) => {
|
|
|
384
389
|
cursor: props.loading ? "no-drop" : "pointer"
|
|
385
390
|
}
|
|
386
391
|
},
|
|
387
|
-
props.isLoading ? /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement("svg", { className: "animate-spin h-5 w-5 mr-3", viewBox: "0 0 24 24" }), props.label) : /* @__PURE__ */ React11.createElement(React11.Fragment, null, props.isSVGStylesOverride === false
|
|
388
|
-
"
|
|
392
|
+
props.isLoading ? /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement("svg", { className: "animate-spin h-5 w-5 mr-3", viewBox: "0 0 24 24" }), props.label) : /* @__PURE__ */ React11.createElement(React11.Fragment, null, props.isSVGStylesOverride === false && loading ? props.icon && /* @__PURE__ */ React11.createElement(
|
|
393
|
+
"img",
|
|
389
394
|
{
|
|
390
|
-
|
|
395
|
+
className: props.iconsClassName,
|
|
396
|
+
src: props.icon,
|
|
397
|
+
alt: props.label
|
|
391
398
|
}
|
|
392
|
-
), props.label)
|
|
399
|
+
) : svgContent && /* @__PURE__ */ React11.createElement("span", { className: props.iconsClassName, dangerouslySetInnerHTML: { __html: svgContent } }), props.label)
|
|
393
400
|
);
|
|
394
401
|
};
|
|
395
402
|
|
|
@@ -608,7 +615,7 @@ var Navbar = (props) => {
|
|
|
608
615
|
};
|
|
609
616
|
|
|
610
617
|
// src/Components/TableElement.tsx
|
|
611
|
-
import React20, { useState as useState6 } from "react";
|
|
618
|
+
import React20, { useState as useState6, useEffect as useEffect3 } from "react";
|
|
612
619
|
import { Table as Table2 } from "antd";
|
|
613
620
|
|
|
614
621
|
// src/Components/Model.tsx
|
|
@@ -617,18 +624,48 @@ import { Modal } from "antd";
|
|
|
617
624
|
|
|
618
625
|
// src/Components/ModelBody.tsx
|
|
619
626
|
import React18 from "react";
|
|
627
|
+
import moment from "moment";
|
|
620
628
|
var ModelBody = (props) => {
|
|
621
|
-
return /* @__PURE__ */ React18.createElement("div", { className: props.modalContent && props.modalContent.className }, props.modalContent && props.modalContent.fields.map(
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
629
|
+
return /* @__PURE__ */ React18.createElement("div", { className: props.modalContent && props.modalContent.className }, props.modalContent && props.modalContent.fields.map(
|
|
630
|
+
(eachField) => {
|
|
631
|
+
if (eachField.element === "div") {
|
|
632
|
+
return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement("div", { className: eachField.className }, eachField.label), eachField.dateTime ? /* @__PURE__ */ React18.createElement(
|
|
633
|
+
"p",
|
|
634
|
+
{
|
|
635
|
+
style: {
|
|
636
|
+
fontSize: "10px",
|
|
637
|
+
textAlign: eachField.source === "bot" ? "left" : "right"
|
|
638
|
+
}
|
|
639
|
+
},
|
|
640
|
+
moment(eachField.dateTime).format("LT")
|
|
641
|
+
) : "");
|
|
642
|
+
} else if (eachField.element === "input-radio") {
|
|
643
|
+
return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement("div", { className: eachField.className }, /* @__PURE__ */ React18.createElement(RadioElement, { ...eachField })), eachField.dateTime ? /* @__PURE__ */ React18.createElement(
|
|
644
|
+
"p",
|
|
645
|
+
{
|
|
646
|
+
style: {
|
|
647
|
+
fontSize: "10px",
|
|
648
|
+
textAlign: eachField.source === "bot" ? "left" : "right"
|
|
649
|
+
}
|
|
650
|
+
},
|
|
651
|
+
moment(eachField.dateTime).format("LT")
|
|
652
|
+
) : "");
|
|
653
|
+
} else if (eachField.element === "button") {
|
|
654
|
+
return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement("div", { className: eachField.className }, /* @__PURE__ */ React18.createElement(ButtonElement, { ...eachField })), eachField.dateTime ? /* @__PURE__ */ React18.createElement(
|
|
655
|
+
"p",
|
|
656
|
+
{
|
|
657
|
+
style: {
|
|
658
|
+
fontSize: "10px",
|
|
659
|
+
textAlign: eachField.source === "bot" ? "left" : "right"
|
|
660
|
+
}
|
|
661
|
+
},
|
|
662
|
+
moment(eachField.dateTime).format("LT")
|
|
663
|
+
) : "");
|
|
664
|
+
} else {
|
|
665
|
+
return null;
|
|
666
|
+
}
|
|
630
667
|
}
|
|
631
|
-
|
|
668
|
+
));
|
|
632
669
|
};
|
|
633
670
|
|
|
634
671
|
// src/Components/Model.tsx
|
|
@@ -653,9 +690,22 @@ var ModelElement = (props) => {
|
|
|
653
690
|
margin: "-10px"
|
|
654
691
|
}
|
|
655
692
|
},
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
693
|
+
columns.map((eachColumn) => {
|
|
694
|
+
if (!["index", "View"].includes(eachColumn.key) && eachColumn?.["is_detail"] !== false) {
|
|
695
|
+
return /* @__PURE__ */ React19.createElement("p", { style: { fontWeight: "500", padding: "10px" } }, /* @__PURE__ */ React19.createElement(
|
|
696
|
+
"span",
|
|
697
|
+
{
|
|
698
|
+
style: {
|
|
699
|
+
fontWeight: "200",
|
|
700
|
+
color: "gray",
|
|
701
|
+
paddingRight: "10px"
|
|
702
|
+
}
|
|
703
|
+
},
|
|
704
|
+
eachColumn.title
|
|
705
|
+
), selectedRecord[eachColumn.key] !== "" ? selectedRecord[eachColumn.key] : "--");
|
|
706
|
+
} else {
|
|
707
|
+
return null;
|
|
708
|
+
}
|
|
659
709
|
})
|
|
660
710
|
)
|
|
661
711
|
},
|
|
@@ -664,12 +714,24 @@ var ModelElement = (props) => {
|
|
|
664
714
|
};
|
|
665
715
|
|
|
666
716
|
// src/Components/TableElement.tsx
|
|
717
|
+
import { EyeOutlined } from "@ant-design/icons";
|
|
667
718
|
var TableElement = (props) => {
|
|
668
719
|
const { thead, tbody } = props;
|
|
669
720
|
const [selectedRecord, setSelectedRecord] = useState6({});
|
|
670
721
|
const [model, setModel] = useState6(false);
|
|
722
|
+
const [dataSource, setDataSource] = useState6([]);
|
|
723
|
+
useEffect3(() => {
|
|
724
|
+
if (tbody) {
|
|
725
|
+
setDataSource(
|
|
726
|
+
tbody.map((row, index) => ({
|
|
727
|
+
...row,
|
|
728
|
+
key: index,
|
|
729
|
+
index: index + 1
|
|
730
|
+
}))
|
|
731
|
+
);
|
|
732
|
+
}
|
|
733
|
+
}, [tbody]);
|
|
671
734
|
const handleChange = (record) => {
|
|
672
|
-
console.log("record", record);
|
|
673
735
|
if (props.onChange) {
|
|
674
736
|
props.onChange(record);
|
|
675
737
|
}
|
|
@@ -679,8 +741,8 @@ var TableElement = (props) => {
|
|
|
679
741
|
columns = [
|
|
680
742
|
{
|
|
681
743
|
title: "#",
|
|
682
|
-
dataIndex: "
|
|
683
|
-
key: "
|
|
744
|
+
dataIndex: "index",
|
|
745
|
+
key: "index",
|
|
684
746
|
fixed: "left"
|
|
685
747
|
},
|
|
686
748
|
...thead.map((col, ind) => ({
|
|
@@ -691,9 +753,9 @@ var TableElement = (props) => {
|
|
|
691
753
|
render: col.render,
|
|
692
754
|
sorter: {
|
|
693
755
|
compare: (a, b) => {
|
|
694
|
-
if (typeof a[col.key] === "number" && typeof
|
|
756
|
+
if (typeof a[col.key] === "number" && typeof b[col.key] === "number") {
|
|
695
757
|
return a[col.key] - b[col.key];
|
|
696
|
-
} else if (typeof a[col.key] === "string" && typeof
|
|
758
|
+
} else if (typeof a[col.key] === "string" && typeof b[col.key] === "string") {
|
|
697
759
|
return a[col.key].localeCompare(b[col.key]);
|
|
698
760
|
}
|
|
699
761
|
}
|
|
@@ -705,26 +767,34 @@ var TableElement = (props) => {
|
|
|
705
767
|
title: "View",
|
|
706
768
|
dataIndex: "View",
|
|
707
769
|
key: "View",
|
|
708
|
-
render: (_, record) =>
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
770
|
+
render: (_, record) => {
|
|
771
|
+
return /* @__PURE__ */ React20.createElement(
|
|
772
|
+
"a",
|
|
773
|
+
{
|
|
774
|
+
onClick: () => {
|
|
775
|
+
if (props.view) {
|
|
776
|
+
setSelectedRecord(record);
|
|
777
|
+
handleChange(record);
|
|
778
|
+
setModel(true);
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
},
|
|
782
|
+
/* @__PURE__ */ React20.createElement(EyeOutlined, null)
|
|
783
|
+
);
|
|
784
|
+
}
|
|
719
785
|
});
|
|
720
786
|
}
|
|
721
787
|
}
|
|
722
|
-
const
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
788
|
+
const onChangeTable = (pagination, filters, sorter, extra) => {
|
|
789
|
+
if (extra && extra.currentDataSource) {
|
|
790
|
+
setDataSource(
|
|
791
|
+
extra.currentDataSource.map((row, index) => ({
|
|
792
|
+
...row,
|
|
793
|
+
index: index + 1
|
|
794
|
+
}))
|
|
795
|
+
);
|
|
796
|
+
}
|
|
797
|
+
};
|
|
728
798
|
const onChangePage = (page, pageSize) => {
|
|
729
799
|
if (props.onChange) {
|
|
730
800
|
props.onChange({ name: "pagination", page, pageSize });
|
|
@@ -732,7 +802,11 @@ var TableElement = (props) => {
|
|
|
732
802
|
};
|
|
733
803
|
const rowSelectionConfig = props.rowSelection ? {
|
|
734
804
|
onChange: (selectedRowKeys, selectedRows) => {
|
|
735
|
-
console.log(
|
|
805
|
+
console.log(
|
|
806
|
+
`selectedRowKeys: ${selectedRowKeys}`,
|
|
807
|
+
"selectedRows: ",
|
|
808
|
+
selectedRows
|
|
809
|
+
);
|
|
736
810
|
if (props.onChange) {
|
|
737
811
|
props.onChange(selectedRows);
|
|
738
812
|
}
|
|
@@ -742,19 +816,41 @@ var TableElement = (props) => {
|
|
|
742
816
|
Table2,
|
|
743
817
|
{
|
|
744
818
|
className: props.className,
|
|
745
|
-
pagination: {
|
|
819
|
+
pagination: props.pagination ? {
|
|
746
820
|
showTotal: (total) => `Total: ${total} items`,
|
|
747
|
-
total: count,
|
|
748
|
-
showSizeChanger: count > 10,
|
|
821
|
+
total: props.count,
|
|
822
|
+
showSizeChanger: props.count ? props.count > 10 : 0 > 10,
|
|
749
823
|
onChange: onChangePage
|
|
824
|
+
} : false,
|
|
825
|
+
onRow: (record) => {
|
|
826
|
+
return {
|
|
827
|
+
onClick: () => {
|
|
828
|
+
if (props.view) {
|
|
829
|
+
setSelectedRecord(record);
|
|
830
|
+
handleChange(record);
|
|
831
|
+
setModel(true);
|
|
832
|
+
}
|
|
833
|
+
},
|
|
834
|
+
style: { cursor: "pointer" }
|
|
835
|
+
};
|
|
750
836
|
},
|
|
751
837
|
rowSelection: rowSelectionConfig,
|
|
752
838
|
dataSource,
|
|
753
839
|
columns,
|
|
754
840
|
size: props.size,
|
|
755
|
-
bordered: true
|
|
841
|
+
bordered: true,
|
|
842
|
+
onChange: onChangeTable
|
|
756
843
|
}
|
|
757
|
-
), model && /* @__PURE__ */ React20.createElement(
|
|
844
|
+
), model && /* @__PURE__ */ React20.createElement(
|
|
845
|
+
ModelElement,
|
|
846
|
+
{
|
|
847
|
+
selectedRecord,
|
|
848
|
+
...props,
|
|
849
|
+
columns,
|
|
850
|
+
model,
|
|
851
|
+
onCancel: () => setModel(false)
|
|
852
|
+
}
|
|
853
|
+
));
|
|
758
854
|
};
|
|
759
855
|
|
|
760
856
|
// src/Components/DatePicker.tsx
|
|
@@ -762,6 +858,7 @@ import React21, { useState as useState7 } from "react";
|
|
|
762
858
|
import { DatePicker } from "antd";
|
|
763
859
|
import dayjs from "dayjs";
|
|
764
860
|
import customParseFormat from "dayjs/plugin/customParseFormat.js";
|
|
861
|
+
import moment2 from "moment";
|
|
765
862
|
dayjs.extend(customParseFormat);
|
|
766
863
|
var DatePickerElement = (props) => {
|
|
767
864
|
const [dateState, setDateState] = useState7("");
|
|
@@ -779,9 +876,13 @@ var DatePickerElement = (props) => {
|
|
|
779
876
|
}
|
|
780
877
|
}
|
|
781
878
|
};
|
|
879
|
+
const disabledDate = (current) => {
|
|
880
|
+
return current && current > moment2();
|
|
881
|
+
};
|
|
782
882
|
return /* @__PURE__ */ React21.createElement("div", null, /* @__PURE__ */ React21.createElement(
|
|
783
883
|
DatePicker,
|
|
784
884
|
{
|
|
885
|
+
disabledDate,
|
|
785
886
|
placeholder: props.placeholder,
|
|
786
887
|
value: dateState,
|
|
787
888
|
format: { format: "DD-MM-YYYY" },
|
|
@@ -794,13 +895,15 @@ var DatePickerElement = (props) => {
|
|
|
794
895
|
import React22 from "react";
|
|
795
896
|
import { DatePicker as DatePicker2, Space } from "antd";
|
|
796
897
|
import dayjs2 from "dayjs";
|
|
898
|
+
import moment3 from "moment";
|
|
797
899
|
var DateRangePickerElement = (props) => {
|
|
900
|
+
const { value } = props;
|
|
798
901
|
const { RangePicker } = DatePicker2;
|
|
799
902
|
const handleChange = (dates, dateStrings) => {
|
|
800
|
-
if (dates
|
|
801
|
-
props.onChange(dateStrings);
|
|
903
|
+
if (dates) {
|
|
904
|
+
props.onChange && props.onChange(dateStrings);
|
|
802
905
|
} else {
|
|
803
|
-
|
|
906
|
+
props.onChange && props.onChange("");
|
|
804
907
|
}
|
|
805
908
|
};
|
|
806
909
|
const rangePresets = [
|
|
@@ -809,7 +912,18 @@ var DateRangePickerElement = (props) => {
|
|
|
809
912
|
{ label: "Last 30 Days", value: [dayjs2().add(-30, "d"), dayjs2()] },
|
|
810
913
|
{ label: "Last 90 Days", value: [dayjs2().add(-90, "d"), dayjs2()] }
|
|
811
914
|
];
|
|
812
|
-
|
|
915
|
+
const disabledDate = (current) => {
|
|
916
|
+
return current && current > moment3();
|
|
917
|
+
};
|
|
918
|
+
return /* @__PURE__ */ React22.createElement(Space, { direction: "vertical", size: 12 }, /* @__PURE__ */ React22.createElement(
|
|
919
|
+
RangePicker,
|
|
920
|
+
{
|
|
921
|
+
disabledDate,
|
|
922
|
+
presets: rangePresets,
|
|
923
|
+
onChange: handleChange,
|
|
924
|
+
value: value && [dayjs2(value[0]), dayjs2(value[1])]
|
|
925
|
+
}
|
|
926
|
+
));
|
|
813
927
|
};
|
|
814
928
|
|
|
815
929
|
// src/Components/Image.tsx
|
|
@@ -973,7 +1087,7 @@ var Upload2 = (props) => {
|
|
|
973
1087
|
};
|
|
974
1088
|
|
|
975
1089
|
// src/Components/OtpElement.tsx
|
|
976
|
-
import React30, { useState as useState11, useRef, useEffect as
|
|
1090
|
+
import React30, { useState as useState11, useRef, useEffect as useEffect4 } from "react";
|
|
977
1091
|
import { Input as Input3 } from "antd";
|
|
978
1092
|
var OtpElement = (props) => {
|
|
979
1093
|
const length = props.length;
|
|
@@ -1010,7 +1124,7 @@ var OtpElement = (props) => {
|
|
|
1010
1124
|
});
|
|
1011
1125
|
}
|
|
1012
1126
|
};
|
|
1013
|
-
|
|
1127
|
+
useEffect4(() => {
|
|
1014
1128
|
inputRefs.current[0]?.focus();
|
|
1015
1129
|
}, []);
|
|
1016
1130
|
return /* @__PURE__ */ React30.createElement("div", { className: props.containerClassName }, Array.from({ length }).map((_, index) => /* @__PURE__ */ React30.createElement(
|
|
@@ -1262,7 +1376,7 @@ var HorizontalBarChart = (props) => {
|
|
|
1262
1376
|
};
|
|
1263
1377
|
|
|
1264
1378
|
// src/Components/LineChart.tsx
|
|
1265
|
-
import React34, { useEffect as
|
|
1379
|
+
import React34, { useEffect as useEffect5, useRef as useRef2 } from "react";
|
|
1266
1380
|
import Chart from "chart.js/auto";
|
|
1267
1381
|
var LineChart = (props) => {
|
|
1268
1382
|
const chartRef = useRef2(null);
|
|
@@ -1273,7 +1387,7 @@ var LineChart = (props) => {
|
|
|
1273
1387
|
{ label: "Conversion Rate", data: [50, 100, 150, 180, 50] }
|
|
1274
1388
|
];
|
|
1275
1389
|
const labels = ["Instagram", "Whatsapp", "Messages", "Telegram", "Linkedin"];
|
|
1276
|
-
|
|
1390
|
+
useEffect5(() => {
|
|
1277
1391
|
if (chartRef.current) {
|
|
1278
1392
|
if (chartInstance.current) {
|
|
1279
1393
|
chartInstance.current.destroy();
|
|
@@ -1335,12 +1449,12 @@ var LineChart = (props) => {
|
|
|
1335
1449
|
};
|
|
1336
1450
|
|
|
1337
1451
|
// src/Components/DoubleBarChart.tsx
|
|
1338
|
-
import React35, { useEffect as
|
|
1452
|
+
import React35, { useEffect as useEffect6, useRef as useRef3 } from "react";
|
|
1339
1453
|
import Chart2 from "chart.js/auto";
|
|
1340
1454
|
var DoubleBarChart = (props) => {
|
|
1341
1455
|
const chartRef = useRef3(null);
|
|
1342
1456
|
const chartInstance = useRef3(null);
|
|
1343
|
-
|
|
1457
|
+
useEffect6(() => {
|
|
1344
1458
|
if (chartRef.current) {
|
|
1345
1459
|
if (chartInstance.current) {
|
|
1346
1460
|
chartInstance.current.destroy();
|
package/package.json
CHANGED
package/postcss.config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
plugins: {
|
|
3
|
-
tailwindcss: {},
|
|
4
|
-
autoprefixer: {},
|
|
5
|
-
},
|
|
6
|
-
}
|
|
1
|
+
module.exports = {
|
|
2
|
+
plugins: {
|
|
3
|
+
tailwindcss: {},
|
|
4
|
+
autoprefixer: {},
|
|
5
|
+
},
|
|
6
|
+
}
|
package/tailwind.config.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/** @type {import('tailwindcss').Config} */
|
|
2
|
-
module.exports = {
|
|
3
|
-
|
|
4
|
-
content: ['./src/**/*.{js,jsx,ts,tsx}'],
|
|
5
|
-
theme: {
|
|
6
|
-
extend: {},
|
|
7
|
-
},
|
|
8
|
-
plugins: [],
|
|
9
|
-
}
|
|
10
|
-
|
|
1
|
+
/** @type {import('tailwindcss').Config} */
|
|
2
|
+
module.exports = {
|
|
3
|
+
|
|
4
|
+
content: ['./src/**/*.{js,jsx,ts,tsx}'],
|
|
5
|
+
theme: {
|
|
6
|
+
extend: {},
|
|
7
|
+
},
|
|
8
|
+
plugins: [],
|
|
9
|
+
}
|
|
10
|
+
|