@apexcura/ui-components 0.0.14-Beta194 → 0.0.14-Beta196
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 +174 -53
- package/dist/index.mjs +179 -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,21 @@ 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 ? props.icon && /* @__PURE__ */ import_react11.default.createElement(
|
|
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 ? props.icon && /* @__PURE__ */ import_react11.default.createElement(
|
|
459
|
+
"img",
|
|
460
|
+
{
|
|
461
|
+
className: props.iconsClassName,
|
|
462
|
+
src: props.icon,
|
|
463
|
+
alt: props.label
|
|
464
|
+
}
|
|
465
|
+
) : loading ? /* @__PURE__ */ import_react11.default.createElement(
|
|
466
|
+
"img",
|
|
455
467
|
{
|
|
456
|
-
|
|
468
|
+
className: props.iconsClassName,
|
|
469
|
+
src: props.icon,
|
|
470
|
+
alt: props.label
|
|
457
471
|
}
|
|
458
|
-
), props.label)
|
|
472
|
+
) : /* @__PURE__ */ import_react11.default.createElement("span", { className: props.iconsClassName }, /* @__PURE__ */ import_react11.default.createElement("span", { dangerouslySetInnerHTML: { __html: svgContent || "" } })), props.label)
|
|
459
473
|
);
|
|
460
474
|
};
|
|
461
475
|
|
|
@@ -683,18 +697,48 @@ var import_antd13 = require("antd");
|
|
|
683
697
|
|
|
684
698
|
// src/Components/ModelBody.tsx
|
|
685
699
|
var import_react18 = __toESM(require("react"));
|
|
700
|
+
var import_moment = __toESM(require("moment"));
|
|
686
701
|
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
|
-
|
|
702
|
+
return /* @__PURE__ */ import_react18.default.createElement("div", { className: props.modalContent && props.modalContent.className }, props.modalContent && props.modalContent.fields.map(
|
|
703
|
+
(eachField) => {
|
|
704
|
+
if (eachField.element === "div") {
|
|
705
|
+
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(
|
|
706
|
+
"p",
|
|
707
|
+
{
|
|
708
|
+
style: {
|
|
709
|
+
fontSize: "10px",
|
|
710
|
+
textAlign: eachField.source === "bot" ? "left" : "right"
|
|
711
|
+
}
|
|
712
|
+
},
|
|
713
|
+
(0, import_moment.default)(eachField.dateTime).format("LT")
|
|
714
|
+
) : "");
|
|
715
|
+
} else if (eachField.element === "input-radio") {
|
|
716
|
+
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(
|
|
717
|
+
"p",
|
|
718
|
+
{
|
|
719
|
+
style: {
|
|
720
|
+
fontSize: "10px",
|
|
721
|
+
textAlign: eachField.source === "bot" ? "left" : "right"
|
|
722
|
+
}
|
|
723
|
+
},
|
|
724
|
+
(0, import_moment.default)(eachField.dateTime).format("LT")
|
|
725
|
+
) : "");
|
|
726
|
+
} else if (eachField.element === "button") {
|
|
727
|
+
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(
|
|
728
|
+
"p",
|
|
729
|
+
{
|
|
730
|
+
style: {
|
|
731
|
+
fontSize: "10px",
|
|
732
|
+
textAlign: eachField.source === "bot" ? "left" : "right"
|
|
733
|
+
}
|
|
734
|
+
},
|
|
735
|
+
(0, import_moment.default)(eachField.dateTime).format("LT")
|
|
736
|
+
) : "");
|
|
737
|
+
} else {
|
|
738
|
+
return null;
|
|
739
|
+
}
|
|
696
740
|
}
|
|
697
|
-
|
|
741
|
+
));
|
|
698
742
|
};
|
|
699
743
|
|
|
700
744
|
// src/Components/Model.tsx
|
|
@@ -719,9 +763,22 @@ var ModelElement = (props) => {
|
|
|
719
763
|
margin: "-10px"
|
|
720
764
|
}
|
|
721
765
|
},
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
766
|
+
columns.map((eachColumn) => {
|
|
767
|
+
if (!["index", "View"].includes(eachColumn.key) && eachColumn?.["is_detail"] !== false) {
|
|
768
|
+
return /* @__PURE__ */ import_react19.default.createElement("p", { style: { fontWeight: "500", padding: "10px" } }, /* @__PURE__ */ import_react19.default.createElement(
|
|
769
|
+
"span",
|
|
770
|
+
{
|
|
771
|
+
style: {
|
|
772
|
+
fontWeight: "200",
|
|
773
|
+
color: "gray",
|
|
774
|
+
paddingRight: "10px"
|
|
775
|
+
}
|
|
776
|
+
},
|
|
777
|
+
eachColumn.title
|
|
778
|
+
), selectedRecord[eachColumn.key] !== "" ? selectedRecord[eachColumn.key] : "--");
|
|
779
|
+
} else {
|
|
780
|
+
return null;
|
|
781
|
+
}
|
|
725
782
|
})
|
|
726
783
|
)
|
|
727
784
|
},
|
|
@@ -730,12 +787,24 @@ var ModelElement = (props) => {
|
|
|
730
787
|
};
|
|
731
788
|
|
|
732
789
|
// src/Components/TableElement.tsx
|
|
790
|
+
var import_icons4 = require("@ant-design/icons");
|
|
733
791
|
var TableElement = (props) => {
|
|
734
792
|
const { thead, tbody } = props;
|
|
735
793
|
const [selectedRecord, setSelectedRecord] = (0, import_react20.useState)({});
|
|
736
794
|
const [model, setModel] = (0, import_react20.useState)(false);
|
|
795
|
+
const [dataSource, setDataSource] = (0, import_react20.useState)([]);
|
|
796
|
+
(0, import_react20.useEffect)(() => {
|
|
797
|
+
if (tbody) {
|
|
798
|
+
setDataSource(
|
|
799
|
+
tbody.map((row, index) => ({
|
|
800
|
+
...row,
|
|
801
|
+
key: index,
|
|
802
|
+
index: index + 1
|
|
803
|
+
}))
|
|
804
|
+
);
|
|
805
|
+
}
|
|
806
|
+
}, [tbody]);
|
|
737
807
|
const handleChange = (record) => {
|
|
738
|
-
console.log("record", record);
|
|
739
808
|
if (props.onChange) {
|
|
740
809
|
props.onChange(record);
|
|
741
810
|
}
|
|
@@ -745,8 +814,8 @@ var TableElement = (props) => {
|
|
|
745
814
|
columns = [
|
|
746
815
|
{
|
|
747
816
|
title: "#",
|
|
748
|
-
dataIndex: "
|
|
749
|
-
key: "
|
|
817
|
+
dataIndex: "index",
|
|
818
|
+
key: "index",
|
|
750
819
|
fixed: "left"
|
|
751
820
|
},
|
|
752
821
|
...thead.map((col, ind) => ({
|
|
@@ -757,9 +826,9 @@ var TableElement = (props) => {
|
|
|
757
826
|
render: col.render,
|
|
758
827
|
sorter: {
|
|
759
828
|
compare: (a, b) => {
|
|
760
|
-
if (typeof a[col.key] === "number" && typeof
|
|
829
|
+
if (typeof a[col.key] === "number" && typeof b[col.key] === "number") {
|
|
761
830
|
return a[col.key] - b[col.key];
|
|
762
|
-
} else if (typeof a[col.key] === "string" && typeof
|
|
831
|
+
} else if (typeof a[col.key] === "string" && typeof b[col.key] === "string") {
|
|
763
832
|
return a[col.key].localeCompare(b[col.key]);
|
|
764
833
|
}
|
|
765
834
|
}
|
|
@@ -771,26 +840,34 @@ var TableElement = (props) => {
|
|
|
771
840
|
title: "View",
|
|
772
841
|
dataIndex: "View",
|
|
773
842
|
key: "View",
|
|
774
|
-
render: (_, record) =>
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
843
|
+
render: (_, record) => {
|
|
844
|
+
return /* @__PURE__ */ import_react20.default.createElement(
|
|
845
|
+
"a",
|
|
846
|
+
{
|
|
847
|
+
onClick: () => {
|
|
848
|
+
if (props.view) {
|
|
849
|
+
setSelectedRecord(record);
|
|
850
|
+
handleChange(record);
|
|
851
|
+
setModel(true);
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
},
|
|
855
|
+
/* @__PURE__ */ import_react20.default.createElement(import_icons4.EyeOutlined, null)
|
|
856
|
+
);
|
|
857
|
+
}
|
|
785
858
|
});
|
|
786
859
|
}
|
|
787
860
|
}
|
|
788
|
-
const
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
861
|
+
const onChangeTable = (pagination, filters, sorter, extra) => {
|
|
862
|
+
if (extra && extra.currentDataSource) {
|
|
863
|
+
setDataSource(
|
|
864
|
+
extra.currentDataSource.map((row, index) => ({
|
|
865
|
+
...row,
|
|
866
|
+
index: index + 1
|
|
867
|
+
}))
|
|
868
|
+
);
|
|
869
|
+
}
|
|
870
|
+
};
|
|
794
871
|
const onChangePage = (page, pageSize) => {
|
|
795
872
|
if (props.onChange) {
|
|
796
873
|
props.onChange({ name: "pagination", page, pageSize });
|
|
@@ -798,7 +875,11 @@ var TableElement = (props) => {
|
|
|
798
875
|
};
|
|
799
876
|
const rowSelectionConfig = props.rowSelection ? {
|
|
800
877
|
onChange: (selectedRowKeys, selectedRows) => {
|
|
801
|
-
console.log(
|
|
878
|
+
console.log(
|
|
879
|
+
`selectedRowKeys: ${selectedRowKeys}`,
|
|
880
|
+
"selectedRows: ",
|
|
881
|
+
selectedRows
|
|
882
|
+
);
|
|
802
883
|
if (props.onChange) {
|
|
803
884
|
props.onChange(selectedRows);
|
|
804
885
|
}
|
|
@@ -808,19 +889,41 @@ var TableElement = (props) => {
|
|
|
808
889
|
import_antd14.Table,
|
|
809
890
|
{
|
|
810
891
|
className: props.className,
|
|
811
|
-
pagination: {
|
|
892
|
+
pagination: props.pagination ? {
|
|
812
893
|
showTotal: (total) => `Total: ${total} items`,
|
|
813
|
-
total: count,
|
|
814
|
-
showSizeChanger: count > 10,
|
|
894
|
+
total: props.count,
|
|
895
|
+
showSizeChanger: props.count ? props.count > 10 : 0 > 10,
|
|
815
896
|
onChange: onChangePage
|
|
897
|
+
} : false,
|
|
898
|
+
onRow: (record) => {
|
|
899
|
+
return {
|
|
900
|
+
onClick: () => {
|
|
901
|
+
if (props.view) {
|
|
902
|
+
setSelectedRecord(record);
|
|
903
|
+
handleChange(record);
|
|
904
|
+
setModel(true);
|
|
905
|
+
}
|
|
906
|
+
},
|
|
907
|
+
style: { cursor: "pointer" }
|
|
908
|
+
};
|
|
816
909
|
},
|
|
817
910
|
rowSelection: rowSelectionConfig,
|
|
818
911
|
dataSource,
|
|
819
912
|
columns,
|
|
820
913
|
size: props.size,
|
|
821
|
-
bordered: true
|
|
914
|
+
bordered: true,
|
|
915
|
+
onChange: onChangeTable
|
|
822
916
|
}
|
|
823
|
-
), model && /* @__PURE__ */ import_react20.default.createElement(
|
|
917
|
+
), model && /* @__PURE__ */ import_react20.default.createElement(
|
|
918
|
+
ModelElement,
|
|
919
|
+
{
|
|
920
|
+
selectedRecord,
|
|
921
|
+
...props,
|
|
922
|
+
columns,
|
|
923
|
+
model,
|
|
924
|
+
onCancel: () => setModel(false)
|
|
925
|
+
}
|
|
926
|
+
));
|
|
824
927
|
};
|
|
825
928
|
|
|
826
929
|
// src/Components/DatePicker.tsx
|
|
@@ -828,6 +931,7 @@ var import_react21 = __toESM(require("react"));
|
|
|
828
931
|
var import_antd15 = require("antd");
|
|
829
932
|
var import_dayjs = __toESM(require("dayjs"));
|
|
830
933
|
var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat.js"));
|
|
934
|
+
var import_moment2 = __toESM(require("moment"));
|
|
831
935
|
import_dayjs.default.extend(import_customParseFormat.default);
|
|
832
936
|
var DatePickerElement = (props) => {
|
|
833
937
|
const [dateState, setDateState] = (0, import_react21.useState)("");
|
|
@@ -845,9 +949,13 @@ var DatePickerElement = (props) => {
|
|
|
845
949
|
}
|
|
846
950
|
}
|
|
847
951
|
};
|
|
952
|
+
const disabledDate = (current) => {
|
|
953
|
+
return current && current > (0, import_moment2.default)();
|
|
954
|
+
};
|
|
848
955
|
return /* @__PURE__ */ import_react21.default.createElement("div", null, /* @__PURE__ */ import_react21.default.createElement(
|
|
849
956
|
import_antd15.DatePicker,
|
|
850
957
|
{
|
|
958
|
+
disabledDate,
|
|
851
959
|
placeholder: props.placeholder,
|
|
852
960
|
value: dateState,
|
|
853
961
|
format: { format: "DD-MM-YYYY" },
|
|
@@ -860,13 +968,15 @@ var DatePickerElement = (props) => {
|
|
|
860
968
|
var import_react22 = __toESM(require("react"));
|
|
861
969
|
var import_antd16 = require("antd");
|
|
862
970
|
var import_dayjs2 = __toESM(require("dayjs"));
|
|
971
|
+
var import_moment3 = __toESM(require("moment"));
|
|
863
972
|
var DateRangePickerElement = (props) => {
|
|
973
|
+
const { value } = props;
|
|
864
974
|
const { RangePicker } = import_antd16.DatePicker;
|
|
865
975
|
const handleChange = (dates, dateStrings) => {
|
|
866
|
-
if (dates
|
|
867
|
-
props.onChange(dateStrings);
|
|
976
|
+
if (dates) {
|
|
977
|
+
props.onChange && props.onChange(dateStrings);
|
|
868
978
|
} else {
|
|
869
|
-
|
|
979
|
+
props.onChange && props.onChange("");
|
|
870
980
|
}
|
|
871
981
|
};
|
|
872
982
|
const rangePresets = [
|
|
@@ -875,7 +985,18 @@ var DateRangePickerElement = (props) => {
|
|
|
875
985
|
{ label: "Last 30 Days", value: [(0, import_dayjs2.default)().add(-30, "d"), (0, import_dayjs2.default)()] },
|
|
876
986
|
{ label: "Last 90 Days", value: [(0, import_dayjs2.default)().add(-90, "d"), (0, import_dayjs2.default)()] }
|
|
877
987
|
];
|
|
878
|
-
|
|
988
|
+
const disabledDate = (current) => {
|
|
989
|
+
return current && current > (0, import_moment3.default)();
|
|
990
|
+
};
|
|
991
|
+
return /* @__PURE__ */ import_react22.default.createElement(import_antd16.Space, { direction: "vertical", size: 12 }, /* @__PURE__ */ import_react22.default.createElement(
|
|
992
|
+
RangePicker,
|
|
993
|
+
{
|
|
994
|
+
disabledDate,
|
|
995
|
+
presets: rangePresets,
|
|
996
|
+
onChange: handleChange,
|
|
997
|
+
value: value && [(0, import_dayjs2.default)(value[0]), (0, import_dayjs2.default)(value[1])]
|
|
998
|
+
}
|
|
999
|
+
));
|
|
879
1000
|
};
|
|
880
1001
|
|
|
881
1002
|
// src/Components/Image.tsx
|
|
@@ -954,7 +1075,7 @@ var DropDownGroup = (props) => {
|
|
|
954
1075
|
// src/Components/FilesUpload.tsx
|
|
955
1076
|
var import_react26 = __toESM(require("react"));
|
|
956
1077
|
var import_antd19 = require("antd");
|
|
957
|
-
var
|
|
1078
|
+
var import_icons5 = require("@ant-design/icons");
|
|
958
1079
|
var FileUpload = (props) => {
|
|
959
1080
|
const { Dragger } = import_antd19.Upload;
|
|
960
1081
|
const [files, setFiles] = (0, import_react26.useState)([]);
|
|
@@ -985,7 +1106,7 @@ var FileUpload = (props) => {
|
|
|
985
1106
|
showUploadList: true,
|
|
986
1107
|
customRequest
|
|
987
1108
|
},
|
|
988
|
-
/* @__PURE__ */ import_react26.default.createElement("p", null, /* @__PURE__ */ import_react26.default.createElement(
|
|
1109
|
+
/* @__PURE__ */ import_react26.default.createElement("p", null, /* @__PURE__ */ import_react26.default.createElement(import_icons5.InboxOutlined, null)),
|
|
989
1110
|
/* @__PURE__ */ import_react26.default.createElement("p", null, "Click or drag file to upload")
|
|
990
1111
|
));
|
|
991
1112
|
};
|
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,21 @@ 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 ? props.icon && /* @__PURE__ */ React11.createElement(
|
|
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 ? props.icon && /* @__PURE__ */ React11.createElement(
|
|
393
|
+
"img",
|
|
394
|
+
{
|
|
395
|
+
className: props.iconsClassName,
|
|
396
|
+
src: props.icon,
|
|
397
|
+
alt: props.label
|
|
398
|
+
}
|
|
399
|
+
) : loading ? /* @__PURE__ */ React11.createElement(
|
|
400
|
+
"img",
|
|
389
401
|
{
|
|
390
|
-
|
|
402
|
+
className: props.iconsClassName,
|
|
403
|
+
src: props.icon,
|
|
404
|
+
alt: props.label
|
|
391
405
|
}
|
|
392
|
-
), props.label)
|
|
406
|
+
) : /* @__PURE__ */ React11.createElement("span", { className: props.iconsClassName }, /* @__PURE__ */ React11.createElement("span", { dangerouslySetInnerHTML: { __html: svgContent || "" } })), props.label)
|
|
393
407
|
);
|
|
394
408
|
};
|
|
395
409
|
|
|
@@ -608,7 +622,7 @@ var Navbar = (props) => {
|
|
|
608
622
|
};
|
|
609
623
|
|
|
610
624
|
// src/Components/TableElement.tsx
|
|
611
|
-
import React20, { useState as useState6 } from "react";
|
|
625
|
+
import React20, { useState as useState6, useEffect as useEffect3 } from "react";
|
|
612
626
|
import { Table as Table2 } from "antd";
|
|
613
627
|
|
|
614
628
|
// src/Components/Model.tsx
|
|
@@ -617,18 +631,48 @@ import { Modal } from "antd";
|
|
|
617
631
|
|
|
618
632
|
// src/Components/ModelBody.tsx
|
|
619
633
|
import React18 from "react";
|
|
634
|
+
import moment from "moment";
|
|
620
635
|
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
|
-
|
|
636
|
+
return /* @__PURE__ */ React18.createElement("div", { className: props.modalContent && props.modalContent.className }, props.modalContent && props.modalContent.fields.map(
|
|
637
|
+
(eachField) => {
|
|
638
|
+
if (eachField.element === "div") {
|
|
639
|
+
return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement("div", { className: eachField.className }, eachField.label), eachField.dateTime ? /* @__PURE__ */ React18.createElement(
|
|
640
|
+
"p",
|
|
641
|
+
{
|
|
642
|
+
style: {
|
|
643
|
+
fontSize: "10px",
|
|
644
|
+
textAlign: eachField.source === "bot" ? "left" : "right"
|
|
645
|
+
}
|
|
646
|
+
},
|
|
647
|
+
moment(eachField.dateTime).format("LT")
|
|
648
|
+
) : "");
|
|
649
|
+
} else if (eachField.element === "input-radio") {
|
|
650
|
+
return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement("div", { className: eachField.className }, /* @__PURE__ */ React18.createElement(RadioElement, { ...eachField })), eachField.dateTime ? /* @__PURE__ */ React18.createElement(
|
|
651
|
+
"p",
|
|
652
|
+
{
|
|
653
|
+
style: {
|
|
654
|
+
fontSize: "10px",
|
|
655
|
+
textAlign: eachField.source === "bot" ? "left" : "right"
|
|
656
|
+
}
|
|
657
|
+
},
|
|
658
|
+
moment(eachField.dateTime).format("LT")
|
|
659
|
+
) : "");
|
|
660
|
+
} else if (eachField.element === "button") {
|
|
661
|
+
return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement("div", { className: eachField.className }, /* @__PURE__ */ React18.createElement(ButtonElement, { ...eachField })), eachField.dateTime ? /* @__PURE__ */ React18.createElement(
|
|
662
|
+
"p",
|
|
663
|
+
{
|
|
664
|
+
style: {
|
|
665
|
+
fontSize: "10px",
|
|
666
|
+
textAlign: eachField.source === "bot" ? "left" : "right"
|
|
667
|
+
}
|
|
668
|
+
},
|
|
669
|
+
moment(eachField.dateTime).format("LT")
|
|
670
|
+
) : "");
|
|
671
|
+
} else {
|
|
672
|
+
return null;
|
|
673
|
+
}
|
|
630
674
|
}
|
|
631
|
-
|
|
675
|
+
));
|
|
632
676
|
};
|
|
633
677
|
|
|
634
678
|
// src/Components/Model.tsx
|
|
@@ -653,9 +697,22 @@ var ModelElement = (props) => {
|
|
|
653
697
|
margin: "-10px"
|
|
654
698
|
}
|
|
655
699
|
},
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
700
|
+
columns.map((eachColumn) => {
|
|
701
|
+
if (!["index", "View"].includes(eachColumn.key) && eachColumn?.["is_detail"] !== false) {
|
|
702
|
+
return /* @__PURE__ */ React19.createElement("p", { style: { fontWeight: "500", padding: "10px" } }, /* @__PURE__ */ React19.createElement(
|
|
703
|
+
"span",
|
|
704
|
+
{
|
|
705
|
+
style: {
|
|
706
|
+
fontWeight: "200",
|
|
707
|
+
color: "gray",
|
|
708
|
+
paddingRight: "10px"
|
|
709
|
+
}
|
|
710
|
+
},
|
|
711
|
+
eachColumn.title
|
|
712
|
+
), selectedRecord[eachColumn.key] !== "" ? selectedRecord[eachColumn.key] : "--");
|
|
713
|
+
} else {
|
|
714
|
+
return null;
|
|
715
|
+
}
|
|
659
716
|
})
|
|
660
717
|
)
|
|
661
718
|
},
|
|
@@ -664,12 +721,24 @@ var ModelElement = (props) => {
|
|
|
664
721
|
};
|
|
665
722
|
|
|
666
723
|
// src/Components/TableElement.tsx
|
|
724
|
+
import { EyeOutlined } from "@ant-design/icons";
|
|
667
725
|
var TableElement = (props) => {
|
|
668
726
|
const { thead, tbody } = props;
|
|
669
727
|
const [selectedRecord, setSelectedRecord] = useState6({});
|
|
670
728
|
const [model, setModel] = useState6(false);
|
|
729
|
+
const [dataSource, setDataSource] = useState6([]);
|
|
730
|
+
useEffect3(() => {
|
|
731
|
+
if (tbody) {
|
|
732
|
+
setDataSource(
|
|
733
|
+
tbody.map((row, index) => ({
|
|
734
|
+
...row,
|
|
735
|
+
key: index,
|
|
736
|
+
index: index + 1
|
|
737
|
+
}))
|
|
738
|
+
);
|
|
739
|
+
}
|
|
740
|
+
}, [tbody]);
|
|
671
741
|
const handleChange = (record) => {
|
|
672
|
-
console.log("record", record);
|
|
673
742
|
if (props.onChange) {
|
|
674
743
|
props.onChange(record);
|
|
675
744
|
}
|
|
@@ -679,8 +748,8 @@ var TableElement = (props) => {
|
|
|
679
748
|
columns = [
|
|
680
749
|
{
|
|
681
750
|
title: "#",
|
|
682
|
-
dataIndex: "
|
|
683
|
-
key: "
|
|
751
|
+
dataIndex: "index",
|
|
752
|
+
key: "index",
|
|
684
753
|
fixed: "left"
|
|
685
754
|
},
|
|
686
755
|
...thead.map((col, ind) => ({
|
|
@@ -691,9 +760,9 @@ var TableElement = (props) => {
|
|
|
691
760
|
render: col.render,
|
|
692
761
|
sorter: {
|
|
693
762
|
compare: (a, b) => {
|
|
694
|
-
if (typeof a[col.key] === "number" && typeof
|
|
763
|
+
if (typeof a[col.key] === "number" && typeof b[col.key] === "number") {
|
|
695
764
|
return a[col.key] - b[col.key];
|
|
696
|
-
} else if (typeof a[col.key] === "string" && typeof
|
|
765
|
+
} else if (typeof a[col.key] === "string" && typeof b[col.key] === "string") {
|
|
697
766
|
return a[col.key].localeCompare(b[col.key]);
|
|
698
767
|
}
|
|
699
768
|
}
|
|
@@ -705,26 +774,34 @@ var TableElement = (props) => {
|
|
|
705
774
|
title: "View",
|
|
706
775
|
dataIndex: "View",
|
|
707
776
|
key: "View",
|
|
708
|
-
render: (_, record) =>
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
777
|
+
render: (_, record) => {
|
|
778
|
+
return /* @__PURE__ */ React20.createElement(
|
|
779
|
+
"a",
|
|
780
|
+
{
|
|
781
|
+
onClick: () => {
|
|
782
|
+
if (props.view) {
|
|
783
|
+
setSelectedRecord(record);
|
|
784
|
+
handleChange(record);
|
|
785
|
+
setModel(true);
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
},
|
|
789
|
+
/* @__PURE__ */ React20.createElement(EyeOutlined, null)
|
|
790
|
+
);
|
|
791
|
+
}
|
|
719
792
|
});
|
|
720
793
|
}
|
|
721
794
|
}
|
|
722
|
-
const
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
795
|
+
const onChangeTable = (pagination, filters, sorter, extra) => {
|
|
796
|
+
if (extra && extra.currentDataSource) {
|
|
797
|
+
setDataSource(
|
|
798
|
+
extra.currentDataSource.map((row, index) => ({
|
|
799
|
+
...row,
|
|
800
|
+
index: index + 1
|
|
801
|
+
}))
|
|
802
|
+
);
|
|
803
|
+
}
|
|
804
|
+
};
|
|
728
805
|
const onChangePage = (page, pageSize) => {
|
|
729
806
|
if (props.onChange) {
|
|
730
807
|
props.onChange({ name: "pagination", page, pageSize });
|
|
@@ -732,7 +809,11 @@ var TableElement = (props) => {
|
|
|
732
809
|
};
|
|
733
810
|
const rowSelectionConfig = props.rowSelection ? {
|
|
734
811
|
onChange: (selectedRowKeys, selectedRows) => {
|
|
735
|
-
console.log(
|
|
812
|
+
console.log(
|
|
813
|
+
`selectedRowKeys: ${selectedRowKeys}`,
|
|
814
|
+
"selectedRows: ",
|
|
815
|
+
selectedRows
|
|
816
|
+
);
|
|
736
817
|
if (props.onChange) {
|
|
737
818
|
props.onChange(selectedRows);
|
|
738
819
|
}
|
|
@@ -742,19 +823,41 @@ var TableElement = (props) => {
|
|
|
742
823
|
Table2,
|
|
743
824
|
{
|
|
744
825
|
className: props.className,
|
|
745
|
-
pagination: {
|
|
826
|
+
pagination: props.pagination ? {
|
|
746
827
|
showTotal: (total) => `Total: ${total} items`,
|
|
747
|
-
total: count,
|
|
748
|
-
showSizeChanger: count > 10,
|
|
828
|
+
total: props.count,
|
|
829
|
+
showSizeChanger: props.count ? props.count > 10 : 0 > 10,
|
|
749
830
|
onChange: onChangePage
|
|
831
|
+
} : false,
|
|
832
|
+
onRow: (record) => {
|
|
833
|
+
return {
|
|
834
|
+
onClick: () => {
|
|
835
|
+
if (props.view) {
|
|
836
|
+
setSelectedRecord(record);
|
|
837
|
+
handleChange(record);
|
|
838
|
+
setModel(true);
|
|
839
|
+
}
|
|
840
|
+
},
|
|
841
|
+
style: { cursor: "pointer" }
|
|
842
|
+
};
|
|
750
843
|
},
|
|
751
844
|
rowSelection: rowSelectionConfig,
|
|
752
845
|
dataSource,
|
|
753
846
|
columns,
|
|
754
847
|
size: props.size,
|
|
755
|
-
bordered: true
|
|
848
|
+
bordered: true,
|
|
849
|
+
onChange: onChangeTable
|
|
756
850
|
}
|
|
757
|
-
), model && /* @__PURE__ */ React20.createElement(
|
|
851
|
+
), model && /* @__PURE__ */ React20.createElement(
|
|
852
|
+
ModelElement,
|
|
853
|
+
{
|
|
854
|
+
selectedRecord,
|
|
855
|
+
...props,
|
|
856
|
+
columns,
|
|
857
|
+
model,
|
|
858
|
+
onCancel: () => setModel(false)
|
|
859
|
+
}
|
|
860
|
+
));
|
|
758
861
|
};
|
|
759
862
|
|
|
760
863
|
// src/Components/DatePicker.tsx
|
|
@@ -762,6 +865,7 @@ import React21, { useState as useState7 } from "react";
|
|
|
762
865
|
import { DatePicker } from "antd";
|
|
763
866
|
import dayjs from "dayjs";
|
|
764
867
|
import customParseFormat from "dayjs/plugin/customParseFormat.js";
|
|
868
|
+
import moment2 from "moment";
|
|
765
869
|
dayjs.extend(customParseFormat);
|
|
766
870
|
var DatePickerElement = (props) => {
|
|
767
871
|
const [dateState, setDateState] = useState7("");
|
|
@@ -779,9 +883,13 @@ var DatePickerElement = (props) => {
|
|
|
779
883
|
}
|
|
780
884
|
}
|
|
781
885
|
};
|
|
886
|
+
const disabledDate = (current) => {
|
|
887
|
+
return current && current > moment2();
|
|
888
|
+
};
|
|
782
889
|
return /* @__PURE__ */ React21.createElement("div", null, /* @__PURE__ */ React21.createElement(
|
|
783
890
|
DatePicker,
|
|
784
891
|
{
|
|
892
|
+
disabledDate,
|
|
785
893
|
placeholder: props.placeholder,
|
|
786
894
|
value: dateState,
|
|
787
895
|
format: { format: "DD-MM-YYYY" },
|
|
@@ -794,13 +902,15 @@ var DatePickerElement = (props) => {
|
|
|
794
902
|
import React22 from "react";
|
|
795
903
|
import { DatePicker as DatePicker2, Space } from "antd";
|
|
796
904
|
import dayjs2 from "dayjs";
|
|
905
|
+
import moment3 from "moment";
|
|
797
906
|
var DateRangePickerElement = (props) => {
|
|
907
|
+
const { value } = props;
|
|
798
908
|
const { RangePicker } = DatePicker2;
|
|
799
909
|
const handleChange = (dates, dateStrings) => {
|
|
800
|
-
if (dates
|
|
801
|
-
props.onChange(dateStrings);
|
|
910
|
+
if (dates) {
|
|
911
|
+
props.onChange && props.onChange(dateStrings);
|
|
802
912
|
} else {
|
|
803
|
-
|
|
913
|
+
props.onChange && props.onChange("");
|
|
804
914
|
}
|
|
805
915
|
};
|
|
806
916
|
const rangePresets = [
|
|
@@ -809,7 +919,18 @@ var DateRangePickerElement = (props) => {
|
|
|
809
919
|
{ label: "Last 30 Days", value: [dayjs2().add(-30, "d"), dayjs2()] },
|
|
810
920
|
{ label: "Last 90 Days", value: [dayjs2().add(-90, "d"), dayjs2()] }
|
|
811
921
|
];
|
|
812
|
-
|
|
922
|
+
const disabledDate = (current) => {
|
|
923
|
+
return current && current > moment3();
|
|
924
|
+
};
|
|
925
|
+
return /* @__PURE__ */ React22.createElement(Space, { direction: "vertical", size: 12 }, /* @__PURE__ */ React22.createElement(
|
|
926
|
+
RangePicker,
|
|
927
|
+
{
|
|
928
|
+
disabledDate,
|
|
929
|
+
presets: rangePresets,
|
|
930
|
+
onChange: handleChange,
|
|
931
|
+
value: value && [dayjs2(value[0]), dayjs2(value[1])]
|
|
932
|
+
}
|
|
933
|
+
));
|
|
813
934
|
};
|
|
814
935
|
|
|
815
936
|
// src/Components/Image.tsx
|
|
@@ -973,7 +1094,7 @@ var Upload2 = (props) => {
|
|
|
973
1094
|
};
|
|
974
1095
|
|
|
975
1096
|
// src/Components/OtpElement.tsx
|
|
976
|
-
import React30, { useState as useState11, useRef, useEffect as
|
|
1097
|
+
import React30, { useState as useState11, useRef, useEffect as useEffect4 } from "react";
|
|
977
1098
|
import { Input as Input3 } from "antd";
|
|
978
1099
|
var OtpElement = (props) => {
|
|
979
1100
|
const length = props.length;
|
|
@@ -1010,7 +1131,7 @@ var OtpElement = (props) => {
|
|
|
1010
1131
|
});
|
|
1011
1132
|
}
|
|
1012
1133
|
};
|
|
1013
|
-
|
|
1134
|
+
useEffect4(() => {
|
|
1014
1135
|
inputRefs.current[0]?.focus();
|
|
1015
1136
|
}, []);
|
|
1016
1137
|
return /* @__PURE__ */ React30.createElement("div", { className: props.containerClassName }, Array.from({ length }).map((_, index) => /* @__PURE__ */ React30.createElement(
|
|
@@ -1262,7 +1383,7 @@ var HorizontalBarChart = (props) => {
|
|
|
1262
1383
|
};
|
|
1263
1384
|
|
|
1264
1385
|
// src/Components/LineChart.tsx
|
|
1265
|
-
import React34, { useEffect as
|
|
1386
|
+
import React34, { useEffect as useEffect5, useRef as useRef2 } from "react";
|
|
1266
1387
|
import Chart from "chart.js/auto";
|
|
1267
1388
|
var LineChart = (props) => {
|
|
1268
1389
|
const chartRef = useRef2(null);
|
|
@@ -1273,7 +1394,7 @@ var LineChart = (props) => {
|
|
|
1273
1394
|
{ label: "Conversion Rate", data: [50, 100, 150, 180, 50] }
|
|
1274
1395
|
];
|
|
1275
1396
|
const labels = ["Instagram", "Whatsapp", "Messages", "Telegram", "Linkedin"];
|
|
1276
|
-
|
|
1397
|
+
useEffect5(() => {
|
|
1277
1398
|
if (chartRef.current) {
|
|
1278
1399
|
if (chartInstance.current) {
|
|
1279
1400
|
chartInstance.current.destroy();
|
|
@@ -1335,12 +1456,12 @@ var LineChart = (props) => {
|
|
|
1335
1456
|
};
|
|
1336
1457
|
|
|
1337
1458
|
// src/Components/DoubleBarChart.tsx
|
|
1338
|
-
import React35, { useEffect as
|
|
1459
|
+
import React35, { useEffect as useEffect6, useRef as useRef3 } from "react";
|
|
1339
1460
|
import Chart2 from "chart.js/auto";
|
|
1340
1461
|
var DoubleBarChart = (props) => {
|
|
1341
1462
|
const chartRef = useRef3(null);
|
|
1342
1463
|
const chartInstance = useRef3(null);
|
|
1343
|
-
|
|
1464
|
+
useEffect6(() => {
|
|
1344
1465
|
if (chartRef.current) {
|
|
1345
1466
|
if (chartInstance.current) {
|
|
1346
1467
|
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
|
+
|