@apexcura/ui-components 0.0.14-Beta19 → 0.0.14-Beta2
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.d.mts +0 -2
- package/dist/index.d.ts +0 -2
- package/dist/index.js +50 -45
- package/dist/index.mjs +48 -43
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -26,8 +26,6 @@ type ElementType = {
|
|
|
26
26
|
fields?: any[];
|
|
27
27
|
schema?: any[];
|
|
28
28
|
options?: any[];
|
|
29
|
-
firstOptions: any[];
|
|
30
|
-
secondOptions: any[];
|
|
31
29
|
onChange?: (value: string | number | boolean | object | any[] | undefined) => void;
|
|
32
30
|
onClick?: () => void;
|
|
33
31
|
dropDownOptions?: any[];
|
package/dist/index.d.ts
CHANGED
|
@@ -26,8 +26,6 @@ type ElementType = {
|
|
|
26
26
|
fields?: any[];
|
|
27
27
|
schema?: any[];
|
|
28
28
|
options?: any[];
|
|
29
|
-
firstOptions: any[];
|
|
30
|
-
secondOptions: any[];
|
|
31
29
|
onChange?: (value: string | number | boolean | object | any[] | undefined) => void;
|
|
32
30
|
onClick?: () => void;
|
|
33
31
|
dropDownOptions?: any[];
|
package/dist/index.js
CHANGED
|
@@ -464,9 +464,9 @@ var AddMoreTable = (props) => {
|
|
|
464
464
|
if (!element) return null;
|
|
465
465
|
const { element: type, label } = element;
|
|
466
466
|
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
|
|
467
|
+
return /* @__PURE__ */ import_react12.default.createElement(SingleSelectElement, { onChange: (value2) => console.log(label, value2), optionType: "", className: void 0, selectedStyle: false, style: false });
|
|
468
468
|
} 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
|
|
469
|
+
return /* @__PURE__ */ import_react12.default.createElement(TextareaElement, { onChange: (value2) => console.log(label, value2), optionType: "", className: void 0, selectedStyle: false, style: false });
|
|
470
470
|
} else {
|
|
471
471
|
return null;
|
|
472
472
|
}
|
|
@@ -681,23 +681,7 @@ var TableElement = (props) => {
|
|
|
681
681
|
}
|
|
682
682
|
}
|
|
683
683
|
}
|
|
684
|
-
}))
|
|
685
|
-
{
|
|
686
|
-
title: "View",
|
|
687
|
-
dataIndex: "View",
|
|
688
|
-
key: "View",
|
|
689
|
-
render: (_, record) => /* @__PURE__ */ import_react20.default.createElement(
|
|
690
|
-
"a",
|
|
691
|
-
{
|
|
692
|
-
onClick: () => {
|
|
693
|
-
setSelectedRecord(record);
|
|
694
|
-
handleChange(record);
|
|
695
|
-
setModel(true);
|
|
696
|
-
}
|
|
697
|
-
},
|
|
698
|
-
"View"
|
|
699
|
-
)
|
|
700
|
-
}
|
|
684
|
+
}))
|
|
701
685
|
];
|
|
702
686
|
}
|
|
703
687
|
const dataSource = tbody && tbody.map((row, index) => ({
|
|
@@ -731,7 +715,17 @@ var TableElement = (props) => {
|
|
|
731
715
|
columns,
|
|
732
716
|
bordered: true,
|
|
733
717
|
rowSelection: rowSelectionConfig,
|
|
734
|
-
size: props.size && props.size
|
|
718
|
+
size: props.size && props.size,
|
|
719
|
+
onRow: (record) => {
|
|
720
|
+
return {
|
|
721
|
+
onClick: () => {
|
|
722
|
+
setSelectedRecord(record);
|
|
723
|
+
handleChange(record);
|
|
724
|
+
setModel(true);
|
|
725
|
+
},
|
|
726
|
+
style: { cursor: "pointer" }
|
|
727
|
+
};
|
|
728
|
+
}
|
|
735
729
|
}
|
|
736
730
|
), model && /* @__PURE__ */ import_react20.default.createElement(ModelElement, { selectedRecord, ...props, columns, model, onCancel: () => setModel(false) }));
|
|
737
731
|
};
|
|
@@ -739,14 +733,18 @@ var TableElement = (props) => {
|
|
|
739
733
|
// src/Components/DatePicker.tsx
|
|
740
734
|
var import_react21 = __toESM(require("react"));
|
|
741
735
|
var import_antd15 = require("antd");
|
|
736
|
+
var import_icons4 = require("@ant-design/icons");
|
|
737
|
+
var import_moment = __toESM(require("moment"));
|
|
742
738
|
var DatePickerElement = (props) => {
|
|
743
739
|
const [date, setDate] = (0, import_react21.useState)(null);
|
|
744
|
-
const dateFormat = "DD/MM/YYYY";
|
|
745
740
|
const handleChange = (date2, dateString) => {
|
|
746
|
-
console.log(
|
|
741
|
+
console.log("date---------", date2);
|
|
742
|
+
console.log("datestring", dateString);
|
|
747
743
|
if (date2) {
|
|
748
|
-
const formattedDate =
|
|
744
|
+
const formattedDate = dateString;
|
|
745
|
+
console.log("formattedDate-----------------", formattedDate);
|
|
749
746
|
setDate(date2);
|
|
747
|
+
console.log("changedDate------------", date2);
|
|
750
748
|
if (props.onChange) {
|
|
751
749
|
props.onChange(formattedDate);
|
|
752
750
|
}
|
|
@@ -757,15 +755,31 @@ var DatePickerElement = (props) => {
|
|
|
757
755
|
}
|
|
758
756
|
}
|
|
759
757
|
};
|
|
760
|
-
|
|
758
|
+
const onHandleDecrement = () => {
|
|
759
|
+
const currentDate = date || (0, import_moment.default)();
|
|
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
|
+
}
|
|
773
|
+
};
|
|
774
|
+
return /* @__PURE__ */ import_react21.default.createElement("div", null, /* @__PURE__ */ import_react21.default.createElement("button", { onClick: onHandleDecrement }, /* @__PURE__ */ import_react21.default.createElement(import_icons4.LeftOutlined, null)), /* @__PURE__ */ import_react21.default.createElement(
|
|
761
775
|
import_antd15.DatePicker,
|
|
762
776
|
{
|
|
763
777
|
placeholder: props.placeholder,
|
|
764
|
-
value: date
|
|
778
|
+
value: date,
|
|
765
779
|
variant: "borderless",
|
|
766
780
|
onChange: handleChange
|
|
767
781
|
}
|
|
768
|
-
));
|
|
782
|
+
), /* @__PURE__ */ import_react21.default.createElement("button", { onClick: onHandleIncrement }, /* @__PURE__ */ import_react21.default.createElement(import_icons4.RightOutlined, null)));
|
|
769
783
|
};
|
|
770
784
|
|
|
771
785
|
// src/Components/DateRangePickerElement.tsx
|
|
@@ -812,14 +826,9 @@ var SingleCheckbox = (props) => {
|
|
|
812
826
|
var import_react25 = __toESM(require("react"));
|
|
813
827
|
var import_antd18 = require("antd");
|
|
814
828
|
var DropDownGroup = (props) => {
|
|
815
|
-
const [selectedValue, setSelectedValue] = (0, import_react25.useState)({
|
|
816
|
-
firstValue: {},
|
|
817
|
-
secondValue: {}
|
|
818
|
-
});
|
|
829
|
+
const [selectedValue, setSelectedValue] = (0, import_react25.useState)({ firstValue: {}, secondValue: {} });
|
|
819
830
|
const handleFirstChange = (value) => {
|
|
820
|
-
const filterOption2 = props.
|
|
821
|
-
(eachOption) => eachOption.value === value
|
|
822
|
-
);
|
|
831
|
+
const filterOption2 = props.options?.find((eachOption) => eachOption.value === value);
|
|
823
832
|
setSelectedValue((prev) => {
|
|
824
833
|
const newValue = { ...prev, firstValue: filterOption2 };
|
|
825
834
|
if (newValue.firstValue) {
|
|
@@ -829,9 +838,7 @@ var DropDownGroup = (props) => {
|
|
|
829
838
|
});
|
|
830
839
|
};
|
|
831
840
|
const handleSecondChange = (value) => {
|
|
832
|
-
const filterOption2 = props.
|
|
833
|
-
(eachOption) => eachOption.value === value
|
|
834
|
-
);
|
|
841
|
+
const filterOption2 = props.options?.find((eachOption) => eachOption.value === value);
|
|
835
842
|
setSelectedValue((prev) => {
|
|
836
843
|
const newValue = { ...prev, secondValue: filterOption2 };
|
|
837
844
|
if (newValue.secondValue) {
|
|
@@ -840,34 +847,32 @@ var DropDownGroup = (props) => {
|
|
|
840
847
|
return selectedValue;
|
|
841
848
|
});
|
|
842
849
|
};
|
|
843
|
-
return /* @__PURE__ */ import_react25.default.createElement("div", { className: props.
|
|
850
|
+
return /* @__PURE__ */ import_react25.default.createElement("div", { className: props.className, style: { display: "flex", flexDirection: "row", backgroundColor: "white", borderRadius: 10, border: "1px solid gray" } }, /* @__PURE__ */ import_react25.default.createElement(
|
|
844
851
|
import_antd18.Select,
|
|
845
852
|
{
|
|
846
853
|
onChange: handleFirstChange,
|
|
847
854
|
variant: props.variant,
|
|
848
|
-
options: props.
|
|
849
|
-
className: props.className
|
|
855
|
+
options: props.options
|
|
850
856
|
}
|
|
851
857
|
), /* @__PURE__ */ import_react25.default.createElement("div", { style: { borderLeft: "1px solid gray", height: "33px" } }), /* @__PURE__ */ import_react25.default.createElement(
|
|
852
858
|
import_antd18.Select,
|
|
853
859
|
{
|
|
854
860
|
onChange: handleSecondChange,
|
|
855
861
|
variant: props.variant,
|
|
856
|
-
options: props.
|
|
857
|
-
className: props.className
|
|
862
|
+
options: props.options
|
|
858
863
|
}
|
|
859
|
-
))
|
|
864
|
+
));
|
|
860
865
|
};
|
|
861
866
|
|
|
862
867
|
// src/Components/FilesUpload.tsx
|
|
863
868
|
var import_react26 = __toESM(require("react"));
|
|
864
869
|
var import_antd19 = require("antd");
|
|
865
|
-
var
|
|
870
|
+
var import_icons5 = require("@ant-design/icons");
|
|
866
871
|
var FileUpload = (props) => {
|
|
867
872
|
const { Dragger } = import_antd19.Upload;
|
|
868
873
|
const [files, setFiles] = (0, import_react26.useState)([]);
|
|
869
874
|
const beforeUpload = (file) => {
|
|
870
|
-
const isCorrectFile = ["image
|
|
875
|
+
const isCorrectFile = ["image/png", "image/jpg", "image/jpeg", "application/pdf"].includes(file.type);
|
|
871
876
|
if (!isCorrectFile) {
|
|
872
877
|
import_antd19.message.error(`(${file.name}) is an invalid file. Please upload files with the following extensions only (.png/.jpg/.jpeg/.pdf)`);
|
|
873
878
|
return import_antd19.Upload.LIST_IGNORE;
|
|
@@ -902,7 +907,7 @@ var FileUpload = (props) => {
|
|
|
902
907
|
showUploadList: true,
|
|
903
908
|
customRequest
|
|
904
909
|
},
|
|
905
|
-
/* @__PURE__ */ import_react26.default.createElement("p", null, /* @__PURE__ */ import_react26.default.createElement(
|
|
910
|
+
/* @__PURE__ */ import_react26.default.createElement("p", null, /* @__PURE__ */ import_react26.default.createElement(import_icons5.InboxOutlined, null)),
|
|
906
911
|
/* @__PURE__ */ import_react26.default.createElement("p", null, "Click or drag file to upload")
|
|
907
912
|
));
|
|
908
913
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -407,9 +407,9 @@ var AddMoreTable = (props) => {
|
|
|
407
407
|
if (!element) return null;
|
|
408
408
|
const { element: type, label } = element;
|
|
409
409
|
if (type === "single-select") {
|
|
410
|
-
return /* @__PURE__ */ React12.createElement(SingleSelectElement, { onChange: (value2) => console.log(label, value2), optionType: "", className: void 0, selectedStyle: false, style: false
|
|
410
|
+
return /* @__PURE__ */ React12.createElement(SingleSelectElement, { onChange: (value2) => console.log(label, value2), optionType: "", className: void 0, selectedStyle: false, style: false });
|
|
411
411
|
} else if (type === "textarea") {
|
|
412
|
-
return /* @__PURE__ */ React12.createElement(TextareaElement, { onChange: (value2) => console.log(label, value2), optionType: "", className: void 0, selectedStyle: false, style: false
|
|
412
|
+
return /* @__PURE__ */ React12.createElement(TextareaElement, { onChange: (value2) => console.log(label, value2), optionType: "", className: void 0, selectedStyle: false, style: false });
|
|
413
413
|
} else {
|
|
414
414
|
return null;
|
|
415
415
|
}
|
|
@@ -624,23 +624,7 @@ var TableElement = (props) => {
|
|
|
624
624
|
}
|
|
625
625
|
}
|
|
626
626
|
}
|
|
627
|
-
}))
|
|
628
|
-
{
|
|
629
|
-
title: "View",
|
|
630
|
-
dataIndex: "View",
|
|
631
|
-
key: "View",
|
|
632
|
-
render: (_, record) => /* @__PURE__ */ React20.createElement(
|
|
633
|
-
"a",
|
|
634
|
-
{
|
|
635
|
-
onClick: () => {
|
|
636
|
-
setSelectedRecord(record);
|
|
637
|
-
handleChange(record);
|
|
638
|
-
setModel(true);
|
|
639
|
-
}
|
|
640
|
-
},
|
|
641
|
-
"View"
|
|
642
|
-
)
|
|
643
|
-
}
|
|
627
|
+
}))
|
|
644
628
|
];
|
|
645
629
|
}
|
|
646
630
|
const dataSource = tbody && tbody.map((row, index) => ({
|
|
@@ -674,7 +658,17 @@ var TableElement = (props) => {
|
|
|
674
658
|
columns,
|
|
675
659
|
bordered: true,
|
|
676
660
|
rowSelection: rowSelectionConfig,
|
|
677
|
-
size: props.size && props.size
|
|
661
|
+
size: props.size && props.size,
|
|
662
|
+
onRow: (record) => {
|
|
663
|
+
return {
|
|
664
|
+
onClick: () => {
|
|
665
|
+
setSelectedRecord(record);
|
|
666
|
+
handleChange(record);
|
|
667
|
+
setModel(true);
|
|
668
|
+
},
|
|
669
|
+
style: { cursor: "pointer" }
|
|
670
|
+
};
|
|
671
|
+
}
|
|
678
672
|
}
|
|
679
673
|
), model && /* @__PURE__ */ React20.createElement(ModelElement, { selectedRecord, ...props, columns, model, onCancel: () => setModel(false) }));
|
|
680
674
|
};
|
|
@@ -682,14 +676,18 @@ var TableElement = (props) => {
|
|
|
682
676
|
// src/Components/DatePicker.tsx
|
|
683
677
|
import React21, { useState as useState6 } from "react";
|
|
684
678
|
import { DatePicker } from "antd";
|
|
679
|
+
import { LeftOutlined, RightOutlined } from "@ant-design/icons";
|
|
680
|
+
import moment from "moment";
|
|
685
681
|
var DatePickerElement = (props) => {
|
|
686
682
|
const [date, setDate] = useState6(null);
|
|
687
|
-
const dateFormat = "DD/MM/YYYY";
|
|
688
683
|
const handleChange = (date2, dateString) => {
|
|
689
|
-
console.log(
|
|
684
|
+
console.log("date---------", date2);
|
|
685
|
+
console.log("datestring", dateString);
|
|
690
686
|
if (date2) {
|
|
691
|
-
const formattedDate =
|
|
687
|
+
const formattedDate = dateString;
|
|
688
|
+
console.log("formattedDate-----------------", formattedDate);
|
|
692
689
|
setDate(date2);
|
|
690
|
+
console.log("changedDate------------", date2);
|
|
693
691
|
if (props.onChange) {
|
|
694
692
|
props.onChange(formattedDate);
|
|
695
693
|
}
|
|
@@ -700,15 +698,31 @@ var DatePickerElement = (props) => {
|
|
|
700
698
|
}
|
|
701
699
|
}
|
|
702
700
|
};
|
|
703
|
-
|
|
701
|
+
const onHandleDecrement = () => {
|
|
702
|
+
const currentDate = date || moment();
|
|
703
|
+
const newDate = moment(currentDate).subtract(1, "days");
|
|
704
|
+
setDate(newDate);
|
|
705
|
+
if (props.onChange) {
|
|
706
|
+
props.onChange(newDate.format("lll"));
|
|
707
|
+
}
|
|
708
|
+
};
|
|
709
|
+
const onHandleIncrement = () => {
|
|
710
|
+
const currentDate = date || moment();
|
|
711
|
+
const newDate = moment(currentDate).add(1, "days");
|
|
712
|
+
setDate(newDate);
|
|
713
|
+
if (props.onChange) {
|
|
714
|
+
props.onChange(newDate.format("lll"));
|
|
715
|
+
}
|
|
716
|
+
};
|
|
717
|
+
return /* @__PURE__ */ React21.createElement("div", null, /* @__PURE__ */ React21.createElement("button", { onClick: onHandleDecrement }, /* @__PURE__ */ React21.createElement(LeftOutlined, null)), /* @__PURE__ */ React21.createElement(
|
|
704
718
|
DatePicker,
|
|
705
719
|
{
|
|
706
720
|
placeholder: props.placeholder,
|
|
707
|
-
value: date
|
|
721
|
+
value: date,
|
|
708
722
|
variant: "borderless",
|
|
709
723
|
onChange: handleChange
|
|
710
724
|
}
|
|
711
|
-
));
|
|
725
|
+
), /* @__PURE__ */ React21.createElement("button", { onClick: onHandleIncrement }, /* @__PURE__ */ React21.createElement(RightOutlined, null)));
|
|
712
726
|
};
|
|
713
727
|
|
|
714
728
|
// src/Components/DateRangePickerElement.tsx
|
|
@@ -755,14 +769,9 @@ var SingleCheckbox = (props) => {
|
|
|
755
769
|
import React25, { useState as useState7 } from "react";
|
|
756
770
|
import { Select as Select4 } from "antd";
|
|
757
771
|
var DropDownGroup = (props) => {
|
|
758
|
-
const [selectedValue, setSelectedValue] = useState7({
|
|
759
|
-
firstValue: {},
|
|
760
|
-
secondValue: {}
|
|
761
|
-
});
|
|
772
|
+
const [selectedValue, setSelectedValue] = useState7({ firstValue: {}, secondValue: {} });
|
|
762
773
|
const handleFirstChange = (value) => {
|
|
763
|
-
const filterOption2 = props.
|
|
764
|
-
(eachOption) => eachOption.value === value
|
|
765
|
-
);
|
|
774
|
+
const filterOption2 = props.options?.find((eachOption) => eachOption.value === value);
|
|
766
775
|
setSelectedValue((prev) => {
|
|
767
776
|
const newValue = { ...prev, firstValue: filterOption2 };
|
|
768
777
|
if (newValue.firstValue) {
|
|
@@ -772,9 +781,7 @@ var DropDownGroup = (props) => {
|
|
|
772
781
|
});
|
|
773
782
|
};
|
|
774
783
|
const handleSecondChange = (value) => {
|
|
775
|
-
const filterOption2 = props.
|
|
776
|
-
(eachOption) => eachOption.value === value
|
|
777
|
-
);
|
|
784
|
+
const filterOption2 = props.options?.find((eachOption) => eachOption.value === value);
|
|
778
785
|
setSelectedValue((prev) => {
|
|
779
786
|
const newValue = { ...prev, secondValue: filterOption2 };
|
|
780
787
|
if (newValue.secondValue) {
|
|
@@ -783,23 +790,21 @@ var DropDownGroup = (props) => {
|
|
|
783
790
|
return selectedValue;
|
|
784
791
|
});
|
|
785
792
|
};
|
|
786
|
-
return /* @__PURE__ */ React25.createElement("div", { className: props.
|
|
793
|
+
return /* @__PURE__ */ React25.createElement("div", { className: props.className, style: { display: "flex", flexDirection: "row", backgroundColor: "white", borderRadius: 10, border: "1px solid gray" } }, /* @__PURE__ */ React25.createElement(
|
|
787
794
|
Select4,
|
|
788
795
|
{
|
|
789
796
|
onChange: handleFirstChange,
|
|
790
797
|
variant: props.variant,
|
|
791
|
-
options: props.
|
|
792
|
-
className: props.className
|
|
798
|
+
options: props.options
|
|
793
799
|
}
|
|
794
800
|
), /* @__PURE__ */ React25.createElement("div", { style: { borderLeft: "1px solid gray", height: "33px" } }), /* @__PURE__ */ React25.createElement(
|
|
795
801
|
Select4,
|
|
796
802
|
{
|
|
797
803
|
onChange: handleSecondChange,
|
|
798
804
|
variant: props.variant,
|
|
799
|
-
options: props.
|
|
800
|
-
className: props.className
|
|
805
|
+
options: props.options
|
|
801
806
|
}
|
|
802
|
-
))
|
|
807
|
+
));
|
|
803
808
|
};
|
|
804
809
|
|
|
805
810
|
// src/Components/FilesUpload.tsx
|
|
@@ -810,7 +815,7 @@ var FileUpload = (props) => {
|
|
|
810
815
|
const { Dragger } = Upload;
|
|
811
816
|
const [files, setFiles] = useState8([]);
|
|
812
817
|
const beforeUpload = (file) => {
|
|
813
|
-
const isCorrectFile = ["image
|
|
818
|
+
const isCorrectFile = ["image/png", "image/jpg", "image/jpeg", "application/pdf"].includes(file.type);
|
|
814
819
|
if (!isCorrectFile) {
|
|
815
820
|
message.error(`(${file.name}) is an invalid file. Please upload files with the following extensions only (.png/.jpg/.jpeg/.pdf)`);
|
|
816
821
|
return Upload.LIST_IGNORE;
|