@apexcura/ui-components 0.0.14-Beta3 → 0.0.14-Beta30
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 +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +105 -74
- package/dist/index.mjs +101 -72
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -26,6 +26,8 @@ type ElementType = {
|
|
|
26
26
|
fields?: any[];
|
|
27
27
|
schema?: any[];
|
|
28
28
|
options?: any[];
|
|
29
|
+
firstOptions: any[];
|
|
30
|
+
secondOptions: any[];
|
|
29
31
|
onChange?: (value: string | number | boolean | object | any[] | undefined) => void;
|
|
30
32
|
onClick?: () => void;
|
|
31
33
|
dropDownOptions?: any[];
|
|
@@ -106,4 +108,8 @@ declare const FileUpload: (props: ElementType) => React$1.JSX.Element;
|
|
|
106
108
|
|
|
107
109
|
declare const TabsElement: (props: ElementType) => React$1.JSX.Element;
|
|
108
110
|
|
|
109
|
-
|
|
111
|
+
declare const SwitchElement: () => React$1.JSX.Element;
|
|
112
|
+
|
|
113
|
+
declare const Upload: (props: ElementType) => React$1.JSX.Element;
|
|
114
|
+
|
|
115
|
+
export { AddMoreTable, ButtonElement, CheckboxElement, CkEditor, DatePickerElement, DateRangePickerElement, DropDownGroup, FileUpload, Image, MultipleSelectElement, Navbar, NumberElement, PasswordElement, RadioElement, SelectElement, Sidebar, SingleCheckbox, SingleSelectElement, SwitchElement, TableElement, TabsElement, TextElement, TextareaElement, Upload };
|
package/dist/index.d.ts
CHANGED
|
@@ -26,6 +26,8 @@ type ElementType = {
|
|
|
26
26
|
fields?: any[];
|
|
27
27
|
schema?: any[];
|
|
28
28
|
options?: any[];
|
|
29
|
+
firstOptions: any[];
|
|
30
|
+
secondOptions: any[];
|
|
29
31
|
onChange?: (value: string | number | boolean | object | any[] | undefined) => void;
|
|
30
32
|
onClick?: () => void;
|
|
31
33
|
dropDownOptions?: any[];
|
|
@@ -106,4 +108,8 @@ declare const FileUpload: (props: ElementType) => React$1.JSX.Element;
|
|
|
106
108
|
|
|
107
109
|
declare const TabsElement: (props: ElementType) => React$1.JSX.Element;
|
|
108
110
|
|
|
109
|
-
|
|
111
|
+
declare const SwitchElement: () => React$1.JSX.Element;
|
|
112
|
+
|
|
113
|
+
declare const Upload: (props: ElementType) => React$1.JSX.Element;
|
|
114
|
+
|
|
115
|
+
export { AddMoreTable, ButtonElement, CheckboxElement, CkEditor, DatePickerElement, DateRangePickerElement, DropDownGroup, FileUpload, Image, MultipleSelectElement, Navbar, NumberElement, PasswordElement, RadioElement, SelectElement, Sidebar, SingleCheckbox, SingleSelectElement, SwitchElement, TableElement, TabsElement, TextElement, TextareaElement, Upload };
|
package/dist/index.js
CHANGED
|
@@ -48,10 +48,12 @@ __export(src_exports, {
|
|
|
48
48
|
Sidebar: () => Sidebar,
|
|
49
49
|
SingleCheckbox: () => SingleCheckbox,
|
|
50
50
|
SingleSelectElement: () => SingleSelectElement,
|
|
51
|
+
SwitchElement: () => SwitchElement,
|
|
51
52
|
TableElement: () => TableElement,
|
|
52
53
|
TabsElement: () => TabsElement,
|
|
53
54
|
TextElement: () => TextElement,
|
|
54
|
-
TextareaElement: () => TextareaElement
|
|
55
|
+
TextareaElement: () => TextareaElement,
|
|
56
|
+
Upload: () => Upload2
|
|
55
57
|
});
|
|
56
58
|
module.exports = __toCommonJS(src_exports);
|
|
57
59
|
|
|
@@ -464,9 +466,9 @@ var AddMoreTable = (props) => {
|
|
|
464
466
|
if (!element) return null;
|
|
465
467
|
const { element: type, label } = element;
|
|
466
468
|
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 });
|
|
469
|
+
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
470
|
} 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 });
|
|
471
|
+
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
472
|
} else {
|
|
471
473
|
return null;
|
|
472
474
|
}
|
|
@@ -681,7 +683,23 @@ var TableElement = (props) => {
|
|
|
681
683
|
}
|
|
682
684
|
}
|
|
683
685
|
}
|
|
684
|
-
}))
|
|
686
|
+
})),
|
|
687
|
+
{
|
|
688
|
+
title: "View",
|
|
689
|
+
dataIndex: "View",
|
|
690
|
+
key: "View",
|
|
691
|
+
render: (_, record) => /* @__PURE__ */ import_react20.default.createElement(
|
|
692
|
+
"a",
|
|
693
|
+
{
|
|
694
|
+
onClick: () => {
|
|
695
|
+
setSelectedRecord(record);
|
|
696
|
+
handleChange(record);
|
|
697
|
+
setModel(true);
|
|
698
|
+
}
|
|
699
|
+
},
|
|
700
|
+
"View"
|
|
701
|
+
)
|
|
702
|
+
}
|
|
685
703
|
];
|
|
686
704
|
}
|
|
687
705
|
const dataSource = tbody && tbody.map((row, index) => ({
|
|
@@ -715,17 +733,7 @@ var TableElement = (props) => {
|
|
|
715
733
|
columns,
|
|
716
734
|
bordered: true,
|
|
717
735
|
rowSelection: rowSelectionConfig,
|
|
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
|
-
}
|
|
736
|
+
size: props.size && props.size
|
|
729
737
|
}
|
|
730
738
|
), model && /* @__PURE__ */ import_react20.default.createElement(ModelElement, { selectedRecord, ...props, columns, model, onCancel: () => setModel(false) }));
|
|
731
739
|
};
|
|
@@ -733,59 +741,42 @@ var TableElement = (props) => {
|
|
|
733
741
|
// src/Components/DatePicker.tsx
|
|
734
742
|
var import_react21 = __toESM(require("react"));
|
|
735
743
|
var import_antd15 = require("antd");
|
|
736
|
-
var
|
|
737
|
-
var
|
|
744
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
745
|
+
var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat.js"));
|
|
746
|
+
import_dayjs.default.extend(import_customParseFormat.default);
|
|
738
747
|
var DatePickerElement = (props) => {
|
|
739
|
-
const [
|
|
740
|
-
const
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
console.log("formattedDate-----------------", formattedDate);
|
|
746
|
-
setDate(date2);
|
|
747
|
-
console.log("changedDate------------", date2);
|
|
748
|
+
const [dateState, setDateState] = (0, import_react21.useState)("");
|
|
749
|
+
const dateFormat = "DD/MM/YYYY";
|
|
750
|
+
const handleChange = (date, dateString) => {
|
|
751
|
+
if (date) {
|
|
752
|
+
const formattedDate = date.format(dateFormat);
|
|
753
|
+
setDateState(date);
|
|
748
754
|
if (props.onChange) {
|
|
749
755
|
props.onChange(formattedDate);
|
|
750
756
|
}
|
|
751
757
|
} else {
|
|
752
|
-
|
|
758
|
+
setDateState("");
|
|
753
759
|
if (props.onChange) {
|
|
754
760
|
props.onChange("");
|
|
755
761
|
}
|
|
756
762
|
}
|
|
757
763
|
};
|
|
758
|
-
|
|
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(
|
|
764
|
+
return /* @__PURE__ */ import_react21.default.createElement("div", null, /* @__PURE__ */ import_react21.default.createElement(
|
|
775
765
|
import_antd15.DatePicker,
|
|
776
766
|
{
|
|
777
767
|
placeholder: props.placeholder,
|
|
778
|
-
value:
|
|
768
|
+
value: (0, import_dayjs.default)(dateState, dateFormat),
|
|
769
|
+
format: dateFormat,
|
|
779
770
|
variant: "borderless",
|
|
780
771
|
onChange: handleChange
|
|
781
772
|
}
|
|
782
|
-
)
|
|
773
|
+
));
|
|
783
774
|
};
|
|
784
775
|
|
|
785
776
|
// src/Components/DateRangePickerElement.tsx
|
|
786
777
|
var import_react22 = __toESM(require("react"));
|
|
787
778
|
var import_antd16 = require("antd");
|
|
788
|
-
var
|
|
779
|
+
var import_dayjs2 = __toESM(require("dayjs"));
|
|
789
780
|
var DateRangePickerElement = (props) => {
|
|
790
781
|
const { RangePicker } = import_antd16.DatePicker;
|
|
791
782
|
const handleChange = (dates, dateStrings) => {
|
|
@@ -796,10 +787,10 @@ var DateRangePickerElement = (props) => {
|
|
|
796
787
|
}
|
|
797
788
|
};
|
|
798
789
|
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,
|
|
790
|
+
{ label: "Last 7 Days", value: [(0, import_dayjs2.default)().add(-7, "d"), (0, import_dayjs2.default)()] },
|
|
791
|
+
{ label: "Last 14 Days", value: [(0, import_dayjs2.default)().add(-14, "d"), (0, import_dayjs2.default)()] },
|
|
792
|
+
{ label: "Last 30 Days", value: [(0, import_dayjs2.default)().add(-30, "d"), (0, import_dayjs2.default)()] },
|
|
793
|
+
{ label: "Last 90 Days", value: [(0, import_dayjs2.default)().add(-90, "d"), (0, import_dayjs2.default)()] }
|
|
803
794
|
];
|
|
804
795
|
return /* @__PURE__ */ import_react22.default.createElement(import_antd16.Space, { direction: "vertical", size: 12 }, /* @__PURE__ */ import_react22.default.createElement(RangePicker, { presets: rangePresets, onChange: handleChange }));
|
|
805
796
|
};
|
|
@@ -826,33 +817,44 @@ var SingleCheckbox = (props) => {
|
|
|
826
817
|
var import_react25 = __toESM(require("react"));
|
|
827
818
|
var import_antd18 = require("antd");
|
|
828
819
|
var DropDownGroup = (props) => {
|
|
829
|
-
const [selectedValue, setSelectedValue] = (0, import_react25.useState)({
|
|
820
|
+
const [selectedValue, setSelectedValue] = (0, import_react25.useState)({
|
|
821
|
+
firstValue: {},
|
|
822
|
+
secondValue: {},
|
|
823
|
+
temp: ""
|
|
824
|
+
});
|
|
830
825
|
const handleFirstChange = (value) => {
|
|
831
|
-
|
|
826
|
+
console.log(selectedValue.temp);
|
|
827
|
+
const filterOption2 = props.firstOptions?.find(
|
|
828
|
+
(eachOption) => eachOption.value === value
|
|
829
|
+
);
|
|
832
830
|
setSelectedValue((prev) => {
|
|
833
831
|
const newValue = { ...prev, firstValue: filterOption2 };
|
|
832
|
+
const { temp, ...rest } = newValue;
|
|
834
833
|
if (newValue.firstValue) {
|
|
835
|
-
props.onChange?.(
|
|
834
|
+
props.onChange?.(rest);
|
|
836
835
|
}
|
|
837
|
-
return
|
|
836
|
+
return newValue;
|
|
838
837
|
});
|
|
839
838
|
};
|
|
840
839
|
const handleSecondChange = (value) => {
|
|
841
|
-
const filterOption2 = props.
|
|
840
|
+
const filterOption2 = props.secondOptions?.find(
|
|
841
|
+
(eachOption) => eachOption.value === value
|
|
842
|
+
);
|
|
842
843
|
setSelectedValue((prev) => {
|
|
843
844
|
const newValue = { ...prev, secondValue: filterOption2 };
|
|
845
|
+
const { temp, ...rest } = newValue;
|
|
844
846
|
if (newValue.secondValue) {
|
|
845
|
-
props.onChange?.(
|
|
847
|
+
props.onChange?.(rest);
|
|
846
848
|
}
|
|
847
|
-
return
|
|
849
|
+
return newValue;
|
|
848
850
|
});
|
|
849
851
|
};
|
|
850
|
-
return /* @__PURE__ */ import_react25.default.createElement("div", { className: props.containerClassName }, /* @__PURE__ */ import_react25.default.createElement(
|
|
852
|
+
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
853
|
import_antd18.Select,
|
|
852
854
|
{
|
|
853
855
|
onChange: handleFirstChange,
|
|
854
856
|
variant: props.variant,
|
|
855
|
-
options: props.
|
|
857
|
+
options: props.firstOptions,
|
|
856
858
|
className: props.className
|
|
857
859
|
}
|
|
858
860
|
), /* @__PURE__ */ import_react25.default.createElement("div", { style: { borderLeft: "1px solid gray", height: "33px" } }), /* @__PURE__ */ import_react25.default.createElement(
|
|
@@ -860,27 +862,19 @@ var DropDownGroup = (props) => {
|
|
|
860
862
|
{
|
|
861
863
|
onChange: handleSecondChange,
|
|
862
864
|
variant: props.variant,
|
|
863
|
-
options: props.
|
|
865
|
+
options: props.secondOptions,
|
|
864
866
|
className: props.className
|
|
865
867
|
}
|
|
866
|
-
));
|
|
868
|
+
)));
|
|
867
869
|
};
|
|
868
870
|
|
|
869
871
|
// src/Components/FilesUpload.tsx
|
|
870
872
|
var import_react26 = __toESM(require("react"));
|
|
871
873
|
var import_antd19 = require("antd");
|
|
872
|
-
var
|
|
874
|
+
var import_icons4 = require("@ant-design/icons");
|
|
873
875
|
var FileUpload = (props) => {
|
|
874
876
|
const { Dragger } = import_antd19.Upload;
|
|
875
877
|
const [files, setFiles] = (0, import_react26.useState)([]);
|
|
876
|
-
const beforeUpload = (file) => {
|
|
877
|
-
const isCorrectFile = ["image/png", "image/jpg", "image/jpeg", "application/pdf"].includes(file.type);
|
|
878
|
-
if (!isCorrectFile) {
|
|
879
|
-
import_antd19.message.error(`(${file.name}) is an invalid file. Please upload files with the following extensions only (.png/.jpg/.jpeg/.pdf)`);
|
|
880
|
-
return import_antd19.Upload.LIST_IGNORE;
|
|
881
|
-
}
|
|
882
|
-
return true;
|
|
883
|
-
};
|
|
884
878
|
const handleChange = ({ fileList }) => {
|
|
885
879
|
setFiles(fileList);
|
|
886
880
|
if (props.onChange) {
|
|
@@ -904,12 +898,11 @@ var FileUpload = (props) => {
|
|
|
904
898
|
maxCount: props.max_count,
|
|
905
899
|
multiple: props.multiple,
|
|
906
900
|
fileList: files,
|
|
907
|
-
beforeUpload,
|
|
908
901
|
onChange: handleChange,
|
|
909
902
|
showUploadList: true,
|
|
910
903
|
customRequest
|
|
911
904
|
},
|
|
912
|
-
/* @__PURE__ */ import_react26.default.createElement("p", null, /* @__PURE__ */ import_react26.default.createElement(
|
|
905
|
+
/* @__PURE__ */ import_react26.default.createElement("p", null, /* @__PURE__ */ import_react26.default.createElement(import_icons4.InboxOutlined, null)),
|
|
913
906
|
/* @__PURE__ */ import_react26.default.createElement("p", null, "Click or drag file to upload")
|
|
914
907
|
));
|
|
915
908
|
};
|
|
@@ -925,6 +918,42 @@ var TabsElement = (props) => {
|
|
|
925
918
|
};
|
|
926
919
|
return /* @__PURE__ */ import_react27.default.createElement(import_antd20.Tabs, { className: props.containerClassName, items: props.options, onChange: handleChange });
|
|
927
920
|
};
|
|
921
|
+
|
|
922
|
+
// src/Components/SwitchElement.tsx
|
|
923
|
+
var import_react28 = __toESM(require("react"));
|
|
924
|
+
var import_antd21 = require("antd");
|
|
925
|
+
var onChange = (checked) => {
|
|
926
|
+
console.log(`switch to ${checked}`);
|
|
927
|
+
};
|
|
928
|
+
var SwitchElement = () => /* @__PURE__ */ import_react28.default.createElement(import_antd21.Switch, { defaultChecked: true, onChange });
|
|
929
|
+
|
|
930
|
+
// src/Components/Upload.tsx
|
|
931
|
+
var import_react29 = __toESM(require("react"));
|
|
932
|
+
var Upload2 = (props) => {
|
|
933
|
+
const [file, setFile] = (0, import_react29.useState)();
|
|
934
|
+
const handleFileChange = (e) => {
|
|
935
|
+
setFile(e.target.files[0]);
|
|
936
|
+
if (props.onChange) {
|
|
937
|
+
props.onChange(e.target.files[0]);
|
|
938
|
+
}
|
|
939
|
+
};
|
|
940
|
+
const handleUpload = async () => {
|
|
941
|
+
if (!file) {
|
|
942
|
+
console.error("No file selected");
|
|
943
|
+
return;
|
|
944
|
+
}
|
|
945
|
+
};
|
|
946
|
+
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(
|
|
947
|
+
"button",
|
|
948
|
+
{
|
|
949
|
+
type: "button",
|
|
950
|
+
onClick: handleUpload,
|
|
951
|
+
disabled: !file,
|
|
952
|
+
style: { marginTop: 16 }
|
|
953
|
+
},
|
|
954
|
+
"Upload"
|
|
955
|
+
));
|
|
956
|
+
};
|
|
928
957
|
// Annotate the CommonJS export names for ESM import in node:
|
|
929
958
|
0 && (module.exports = {
|
|
930
959
|
AddMoreTable,
|
|
@@ -945,8 +974,10 @@ var TabsElement = (props) => {
|
|
|
945
974
|
Sidebar,
|
|
946
975
|
SingleCheckbox,
|
|
947
976
|
SingleSelectElement,
|
|
977
|
+
SwitchElement,
|
|
948
978
|
TableElement,
|
|
949
979
|
TabsElement,
|
|
950
980
|
TextElement,
|
|
951
|
-
TextareaElement
|
|
981
|
+
TextareaElement,
|
|
982
|
+
Upload
|
|
952
983
|
});
|
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, options1: [], options2: [], firstOptions: [], secondOptions: [] });
|
|
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, options1: [], options2: [], firstOptions: [], secondOptions: [] });
|
|
413
413
|
} else {
|
|
414
414
|
return null;
|
|
415
415
|
}
|
|
@@ -624,7 +624,23 @@ var TableElement = (props) => {
|
|
|
624
624
|
}
|
|
625
625
|
}
|
|
626
626
|
}
|
|
627
|
-
}))
|
|
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
|
+
}
|
|
628
644
|
];
|
|
629
645
|
}
|
|
630
646
|
const dataSource = tbody && tbody.map((row, index) => ({
|
|
@@ -658,17 +674,7 @@ var TableElement = (props) => {
|
|
|
658
674
|
columns,
|
|
659
675
|
bordered: true,
|
|
660
676
|
rowSelection: rowSelectionConfig,
|
|
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
|
-
}
|
|
677
|
+
size: props.size && props.size
|
|
672
678
|
}
|
|
673
679
|
), model && /* @__PURE__ */ React20.createElement(ModelElement, { selectedRecord, ...props, columns, model, onCancel: () => setModel(false) }));
|
|
674
680
|
};
|
|
@@ -676,59 +682,42 @@ var TableElement = (props) => {
|
|
|
676
682
|
// src/Components/DatePicker.tsx
|
|
677
683
|
import React21, { useState as useState6 } from "react";
|
|
678
684
|
import { DatePicker } from "antd";
|
|
679
|
-
import
|
|
680
|
-
import
|
|
685
|
+
import dayjs from "dayjs";
|
|
686
|
+
import customParseFormat from "dayjs/plugin/customParseFormat.js";
|
|
687
|
+
dayjs.extend(customParseFormat);
|
|
681
688
|
var DatePickerElement = (props) => {
|
|
682
|
-
const [
|
|
683
|
-
const
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
console.log("formattedDate-----------------", formattedDate);
|
|
689
|
-
setDate(date2);
|
|
690
|
-
console.log("changedDate------------", date2);
|
|
689
|
+
const [dateState, setDateState] = useState6("");
|
|
690
|
+
const dateFormat = "DD/MM/YYYY";
|
|
691
|
+
const handleChange = (date, dateString) => {
|
|
692
|
+
if (date) {
|
|
693
|
+
const formattedDate = date.format(dateFormat);
|
|
694
|
+
setDateState(date);
|
|
691
695
|
if (props.onChange) {
|
|
692
696
|
props.onChange(formattedDate);
|
|
693
697
|
}
|
|
694
698
|
} else {
|
|
695
|
-
|
|
699
|
+
setDateState("");
|
|
696
700
|
if (props.onChange) {
|
|
697
701
|
props.onChange("");
|
|
698
702
|
}
|
|
699
703
|
}
|
|
700
704
|
};
|
|
701
|
-
|
|
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(
|
|
705
|
+
return /* @__PURE__ */ React21.createElement("div", null, /* @__PURE__ */ React21.createElement(
|
|
718
706
|
DatePicker,
|
|
719
707
|
{
|
|
720
708
|
placeholder: props.placeholder,
|
|
721
|
-
value:
|
|
709
|
+
value: dayjs(dateState, dateFormat),
|
|
710
|
+
format: dateFormat,
|
|
722
711
|
variant: "borderless",
|
|
723
712
|
onChange: handleChange
|
|
724
713
|
}
|
|
725
|
-
)
|
|
714
|
+
));
|
|
726
715
|
};
|
|
727
716
|
|
|
728
717
|
// src/Components/DateRangePickerElement.tsx
|
|
729
718
|
import React22 from "react";
|
|
730
719
|
import { DatePicker as DatePicker2, Space } from "antd";
|
|
731
|
-
import
|
|
720
|
+
import dayjs2 from "dayjs";
|
|
732
721
|
var DateRangePickerElement = (props) => {
|
|
733
722
|
const { RangePicker } = DatePicker2;
|
|
734
723
|
const handleChange = (dates, dateStrings) => {
|
|
@@ -739,10 +728,10 @@ var DateRangePickerElement = (props) => {
|
|
|
739
728
|
}
|
|
740
729
|
};
|
|
741
730
|
const rangePresets = [
|
|
742
|
-
{ label: "Last 7 Days", value: [
|
|
743
|
-
{ label: "Last 14 Days", value: [
|
|
744
|
-
{ label: "Last 30 Days", value: [
|
|
745
|
-
{ label: "Last 90 Days", value: [
|
|
731
|
+
{ label: "Last 7 Days", value: [dayjs2().add(-7, "d"), dayjs2()] },
|
|
732
|
+
{ label: "Last 14 Days", value: [dayjs2().add(-14, "d"), dayjs2()] },
|
|
733
|
+
{ label: "Last 30 Days", value: [dayjs2().add(-30, "d"), dayjs2()] },
|
|
734
|
+
{ label: "Last 90 Days", value: [dayjs2().add(-90, "d"), dayjs2()] }
|
|
746
735
|
];
|
|
747
736
|
return /* @__PURE__ */ React22.createElement(Space, { direction: "vertical", size: 12 }, /* @__PURE__ */ React22.createElement(RangePicker, { presets: rangePresets, onChange: handleChange }));
|
|
748
737
|
};
|
|
@@ -769,33 +758,44 @@ var SingleCheckbox = (props) => {
|
|
|
769
758
|
import React25, { useState as useState7 } from "react";
|
|
770
759
|
import { Select as Select4 } from "antd";
|
|
771
760
|
var DropDownGroup = (props) => {
|
|
772
|
-
const [selectedValue, setSelectedValue] = useState7({
|
|
761
|
+
const [selectedValue, setSelectedValue] = useState7({
|
|
762
|
+
firstValue: {},
|
|
763
|
+
secondValue: {},
|
|
764
|
+
temp: ""
|
|
765
|
+
});
|
|
773
766
|
const handleFirstChange = (value) => {
|
|
774
|
-
|
|
767
|
+
console.log(selectedValue.temp);
|
|
768
|
+
const filterOption2 = props.firstOptions?.find(
|
|
769
|
+
(eachOption) => eachOption.value === value
|
|
770
|
+
);
|
|
775
771
|
setSelectedValue((prev) => {
|
|
776
772
|
const newValue = { ...prev, firstValue: filterOption2 };
|
|
773
|
+
const { temp, ...rest } = newValue;
|
|
777
774
|
if (newValue.firstValue) {
|
|
778
|
-
props.onChange?.(
|
|
775
|
+
props.onChange?.(rest);
|
|
779
776
|
}
|
|
780
|
-
return
|
|
777
|
+
return newValue;
|
|
781
778
|
});
|
|
782
779
|
};
|
|
783
780
|
const handleSecondChange = (value) => {
|
|
784
|
-
const filterOption2 = props.
|
|
781
|
+
const filterOption2 = props.secondOptions?.find(
|
|
782
|
+
(eachOption) => eachOption.value === value
|
|
783
|
+
);
|
|
785
784
|
setSelectedValue((prev) => {
|
|
786
785
|
const newValue = { ...prev, secondValue: filterOption2 };
|
|
786
|
+
const { temp, ...rest } = newValue;
|
|
787
787
|
if (newValue.secondValue) {
|
|
788
|
-
props.onChange?.(
|
|
788
|
+
props.onChange?.(rest);
|
|
789
789
|
}
|
|
790
|
-
return
|
|
790
|
+
return newValue;
|
|
791
791
|
});
|
|
792
792
|
};
|
|
793
|
-
return /* @__PURE__ */ React25.createElement("div", { className: props.containerClassName }, /* @__PURE__ */ React25.createElement(
|
|
793
|
+
return /* @__PURE__ */ React25.createElement("div", { className: props.containerClassName }, props.label && /* @__PURE__ */ React25.createElement("label", { htmlFor: props.name, className: props.labelClassName }, props.label), /* @__PURE__ */ React25.createElement("div", { className: props.subContainerClassName }, /* @__PURE__ */ React25.createElement(
|
|
794
794
|
Select4,
|
|
795
795
|
{
|
|
796
796
|
onChange: handleFirstChange,
|
|
797
797
|
variant: props.variant,
|
|
798
|
-
options: props.
|
|
798
|
+
options: props.firstOptions,
|
|
799
799
|
className: props.className
|
|
800
800
|
}
|
|
801
801
|
), /* @__PURE__ */ React25.createElement("div", { style: { borderLeft: "1px solid gray", height: "33px" } }), /* @__PURE__ */ React25.createElement(
|
|
@@ -803,27 +803,19 @@ var DropDownGroup = (props) => {
|
|
|
803
803
|
{
|
|
804
804
|
onChange: handleSecondChange,
|
|
805
805
|
variant: props.variant,
|
|
806
|
-
options: props.
|
|
806
|
+
options: props.secondOptions,
|
|
807
807
|
className: props.className
|
|
808
808
|
}
|
|
809
|
-
));
|
|
809
|
+
)));
|
|
810
810
|
};
|
|
811
811
|
|
|
812
812
|
// src/Components/FilesUpload.tsx
|
|
813
813
|
import React26, { useState as useState8 } from "react";
|
|
814
|
-
import { Upload
|
|
814
|
+
import { Upload } from "antd";
|
|
815
815
|
import { InboxOutlined } from "@ant-design/icons";
|
|
816
816
|
var FileUpload = (props) => {
|
|
817
817
|
const { Dragger } = Upload;
|
|
818
818
|
const [files, setFiles] = useState8([]);
|
|
819
|
-
const beforeUpload = (file) => {
|
|
820
|
-
const isCorrectFile = ["image/png", "image/jpg", "image/jpeg", "application/pdf"].includes(file.type);
|
|
821
|
-
if (!isCorrectFile) {
|
|
822
|
-
message.error(`(${file.name}) is an invalid file. Please upload files with the following extensions only (.png/.jpg/.jpeg/.pdf)`);
|
|
823
|
-
return Upload.LIST_IGNORE;
|
|
824
|
-
}
|
|
825
|
-
return true;
|
|
826
|
-
};
|
|
827
819
|
const handleChange = ({ fileList }) => {
|
|
828
820
|
setFiles(fileList);
|
|
829
821
|
if (props.onChange) {
|
|
@@ -847,7 +839,6 @@ var FileUpload = (props) => {
|
|
|
847
839
|
maxCount: props.max_count,
|
|
848
840
|
multiple: props.multiple,
|
|
849
841
|
fileList: files,
|
|
850
|
-
beforeUpload,
|
|
851
842
|
onChange: handleChange,
|
|
852
843
|
showUploadList: true,
|
|
853
844
|
customRequest
|
|
@@ -868,6 +859,42 @@ var TabsElement = (props) => {
|
|
|
868
859
|
};
|
|
869
860
|
return /* @__PURE__ */ React27.createElement(Tabs, { className: props.containerClassName, items: props.options, onChange: handleChange });
|
|
870
861
|
};
|
|
862
|
+
|
|
863
|
+
// src/Components/SwitchElement.tsx
|
|
864
|
+
import React28 from "react";
|
|
865
|
+
import { Switch } from "antd";
|
|
866
|
+
var onChange = (checked) => {
|
|
867
|
+
console.log(`switch to ${checked}`);
|
|
868
|
+
};
|
|
869
|
+
var SwitchElement = () => /* @__PURE__ */ React28.createElement(Switch, { defaultChecked: true, onChange });
|
|
870
|
+
|
|
871
|
+
// src/Components/Upload.tsx
|
|
872
|
+
import React29, { useState as useState9 } from "react";
|
|
873
|
+
var Upload2 = (props) => {
|
|
874
|
+
const [file, setFile] = useState9();
|
|
875
|
+
const handleFileChange = (e) => {
|
|
876
|
+
setFile(e.target.files[0]);
|
|
877
|
+
if (props.onChange) {
|
|
878
|
+
props.onChange(e.target.files[0]);
|
|
879
|
+
}
|
|
880
|
+
};
|
|
881
|
+
const handleUpload = async () => {
|
|
882
|
+
if (!file) {
|
|
883
|
+
console.error("No file selected");
|
|
884
|
+
return;
|
|
885
|
+
}
|
|
886
|
+
};
|
|
887
|
+
return /* @__PURE__ */ React29.createElement("div", { style: { marginTop: 16 } }, /* @__PURE__ */ React29.createElement("input", { type: "file", onChange: handleFileChange }), /* @__PURE__ */ React29.createElement(
|
|
888
|
+
"button",
|
|
889
|
+
{
|
|
890
|
+
type: "button",
|
|
891
|
+
onClick: handleUpload,
|
|
892
|
+
disabled: !file,
|
|
893
|
+
style: { marginTop: 16 }
|
|
894
|
+
},
|
|
895
|
+
"Upload"
|
|
896
|
+
));
|
|
897
|
+
};
|
|
871
898
|
export {
|
|
872
899
|
AddMoreTable,
|
|
873
900
|
ButtonElement,
|
|
@@ -887,8 +914,10 @@ export {
|
|
|
887
914
|
Sidebar,
|
|
888
915
|
SingleCheckbox,
|
|
889
916
|
SingleSelectElement,
|
|
917
|
+
SwitchElement,
|
|
890
918
|
TableElement,
|
|
891
919
|
TabsElement,
|
|
892
920
|
TextElement,
|
|
893
|
-
TextareaElement
|
|
921
|
+
TextareaElement,
|
|
922
|
+
Upload2 as Upload
|
|
894
923
|
};
|