@apexcura/ui-components 0.0.14-Beta3 → 0.0.14-Beta31
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 +104 -74
- package/dist/index.mjs +100 -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,41 @@ 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: dateState,
|
|
779
769
|
variant: "borderless",
|
|
780
770
|
onChange: handleChange
|
|
781
771
|
}
|
|
782
|
-
)
|
|
772
|
+
));
|
|
783
773
|
};
|
|
784
774
|
|
|
785
775
|
// src/Components/DateRangePickerElement.tsx
|
|
786
776
|
var import_react22 = __toESM(require("react"));
|
|
787
777
|
var import_antd16 = require("antd");
|
|
788
|
-
var
|
|
778
|
+
var import_dayjs2 = __toESM(require("dayjs"));
|
|
789
779
|
var DateRangePickerElement = (props) => {
|
|
790
780
|
const { RangePicker } = import_antd16.DatePicker;
|
|
791
781
|
const handleChange = (dates, dateStrings) => {
|
|
@@ -796,10 +786,10 @@ var DateRangePickerElement = (props) => {
|
|
|
796
786
|
}
|
|
797
787
|
};
|
|
798
788
|
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,
|
|
789
|
+
{ label: "Last 7 Days", value: [(0, import_dayjs2.default)().add(-7, "d"), (0, import_dayjs2.default)()] },
|
|
790
|
+
{ label: "Last 14 Days", value: [(0, import_dayjs2.default)().add(-14, "d"), (0, import_dayjs2.default)()] },
|
|
791
|
+
{ label: "Last 30 Days", value: [(0, import_dayjs2.default)().add(-30, "d"), (0, import_dayjs2.default)()] },
|
|
792
|
+
{ label: "Last 90 Days", value: [(0, import_dayjs2.default)().add(-90, "d"), (0, import_dayjs2.default)()] }
|
|
803
793
|
];
|
|
804
794
|
return /* @__PURE__ */ import_react22.default.createElement(import_antd16.Space, { direction: "vertical", size: 12 }, /* @__PURE__ */ import_react22.default.createElement(RangePicker, { presets: rangePresets, onChange: handleChange }));
|
|
805
795
|
};
|
|
@@ -826,33 +816,44 @@ var SingleCheckbox = (props) => {
|
|
|
826
816
|
var import_react25 = __toESM(require("react"));
|
|
827
817
|
var import_antd18 = require("antd");
|
|
828
818
|
var DropDownGroup = (props) => {
|
|
829
|
-
const [selectedValue, setSelectedValue] = (0, import_react25.useState)({
|
|
819
|
+
const [selectedValue, setSelectedValue] = (0, import_react25.useState)({
|
|
820
|
+
firstValue: {},
|
|
821
|
+
secondValue: {},
|
|
822
|
+
temp: ""
|
|
823
|
+
});
|
|
830
824
|
const handleFirstChange = (value) => {
|
|
831
|
-
|
|
825
|
+
console.log(selectedValue.temp);
|
|
826
|
+
const filterOption2 = props.firstOptions?.find(
|
|
827
|
+
(eachOption) => eachOption.value === value
|
|
828
|
+
);
|
|
832
829
|
setSelectedValue((prev) => {
|
|
833
830
|
const newValue = { ...prev, firstValue: filterOption2 };
|
|
831
|
+
const { temp, ...rest } = newValue;
|
|
834
832
|
if (newValue.firstValue) {
|
|
835
|
-
props.onChange?.(
|
|
833
|
+
props.onChange?.(rest);
|
|
836
834
|
}
|
|
837
|
-
return
|
|
835
|
+
return newValue;
|
|
838
836
|
});
|
|
839
837
|
};
|
|
840
838
|
const handleSecondChange = (value) => {
|
|
841
|
-
const filterOption2 = props.
|
|
839
|
+
const filterOption2 = props.secondOptions?.find(
|
|
840
|
+
(eachOption) => eachOption.value === value
|
|
841
|
+
);
|
|
842
842
|
setSelectedValue((prev) => {
|
|
843
843
|
const newValue = { ...prev, secondValue: filterOption2 };
|
|
844
|
+
const { temp, ...rest } = newValue;
|
|
844
845
|
if (newValue.secondValue) {
|
|
845
|
-
props.onChange?.(
|
|
846
|
+
props.onChange?.(rest);
|
|
846
847
|
}
|
|
847
|
-
return
|
|
848
|
+
return newValue;
|
|
848
849
|
});
|
|
849
850
|
};
|
|
850
|
-
return /* @__PURE__ */ import_react25.default.createElement("div", { className: props.containerClassName }, /* @__PURE__ */ import_react25.default.createElement(
|
|
851
|
+
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
852
|
import_antd18.Select,
|
|
852
853
|
{
|
|
853
854
|
onChange: handleFirstChange,
|
|
854
855
|
variant: props.variant,
|
|
855
|
-
options: props.
|
|
856
|
+
options: props.firstOptions,
|
|
856
857
|
className: props.className
|
|
857
858
|
}
|
|
858
859
|
), /* @__PURE__ */ import_react25.default.createElement("div", { style: { borderLeft: "1px solid gray", height: "33px" } }), /* @__PURE__ */ import_react25.default.createElement(
|
|
@@ -860,27 +861,19 @@ var DropDownGroup = (props) => {
|
|
|
860
861
|
{
|
|
861
862
|
onChange: handleSecondChange,
|
|
862
863
|
variant: props.variant,
|
|
863
|
-
options: props.
|
|
864
|
+
options: props.secondOptions,
|
|
864
865
|
className: props.className
|
|
865
866
|
}
|
|
866
|
-
));
|
|
867
|
+
)));
|
|
867
868
|
};
|
|
868
869
|
|
|
869
870
|
// src/Components/FilesUpload.tsx
|
|
870
871
|
var import_react26 = __toESM(require("react"));
|
|
871
872
|
var import_antd19 = require("antd");
|
|
872
|
-
var
|
|
873
|
+
var import_icons4 = require("@ant-design/icons");
|
|
873
874
|
var FileUpload = (props) => {
|
|
874
875
|
const { Dragger } = import_antd19.Upload;
|
|
875
876
|
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
877
|
const handleChange = ({ fileList }) => {
|
|
885
878
|
setFiles(fileList);
|
|
886
879
|
if (props.onChange) {
|
|
@@ -904,12 +897,11 @@ var FileUpload = (props) => {
|
|
|
904
897
|
maxCount: props.max_count,
|
|
905
898
|
multiple: props.multiple,
|
|
906
899
|
fileList: files,
|
|
907
|
-
beforeUpload,
|
|
908
900
|
onChange: handleChange,
|
|
909
901
|
showUploadList: true,
|
|
910
902
|
customRequest
|
|
911
903
|
},
|
|
912
|
-
/* @__PURE__ */ import_react26.default.createElement("p", null, /* @__PURE__ */ import_react26.default.createElement(
|
|
904
|
+
/* @__PURE__ */ import_react26.default.createElement("p", null, /* @__PURE__ */ import_react26.default.createElement(import_icons4.InboxOutlined, null)),
|
|
913
905
|
/* @__PURE__ */ import_react26.default.createElement("p", null, "Click or drag file to upload")
|
|
914
906
|
));
|
|
915
907
|
};
|
|
@@ -925,6 +917,42 @@ var TabsElement = (props) => {
|
|
|
925
917
|
};
|
|
926
918
|
return /* @__PURE__ */ import_react27.default.createElement(import_antd20.Tabs, { className: props.containerClassName, items: props.options, onChange: handleChange });
|
|
927
919
|
};
|
|
920
|
+
|
|
921
|
+
// src/Components/SwitchElement.tsx
|
|
922
|
+
var import_react28 = __toESM(require("react"));
|
|
923
|
+
var import_antd21 = require("antd");
|
|
924
|
+
var onChange = (checked) => {
|
|
925
|
+
console.log(`switch to ${checked}`);
|
|
926
|
+
};
|
|
927
|
+
var SwitchElement = () => /* @__PURE__ */ import_react28.default.createElement(import_antd21.Switch, { defaultChecked: true, onChange });
|
|
928
|
+
|
|
929
|
+
// src/Components/Upload.tsx
|
|
930
|
+
var import_react29 = __toESM(require("react"));
|
|
931
|
+
var Upload2 = (props) => {
|
|
932
|
+
const [file, setFile] = (0, import_react29.useState)();
|
|
933
|
+
const handleFileChange = (e) => {
|
|
934
|
+
setFile(e.target.files[0]);
|
|
935
|
+
if (props.onChange) {
|
|
936
|
+
props.onChange(e.target.files[0]);
|
|
937
|
+
}
|
|
938
|
+
};
|
|
939
|
+
const handleUpload = async () => {
|
|
940
|
+
if (!file) {
|
|
941
|
+
console.error("No file selected");
|
|
942
|
+
return;
|
|
943
|
+
}
|
|
944
|
+
};
|
|
945
|
+
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(
|
|
946
|
+
"button",
|
|
947
|
+
{
|
|
948
|
+
type: "button",
|
|
949
|
+
onClick: handleUpload,
|
|
950
|
+
disabled: !file,
|
|
951
|
+
style: { marginTop: 16 }
|
|
952
|
+
},
|
|
953
|
+
"Upload"
|
|
954
|
+
));
|
|
955
|
+
};
|
|
928
956
|
// Annotate the CommonJS export names for ESM import in node:
|
|
929
957
|
0 && (module.exports = {
|
|
930
958
|
AddMoreTable,
|
|
@@ -945,8 +973,10 @@ var TabsElement = (props) => {
|
|
|
945
973
|
Sidebar,
|
|
946
974
|
SingleCheckbox,
|
|
947
975
|
SingleSelectElement,
|
|
976
|
+
SwitchElement,
|
|
948
977
|
TableElement,
|
|
949
978
|
TabsElement,
|
|
950
979
|
TextElement,
|
|
951
|
-
TextareaElement
|
|
980
|
+
TextareaElement,
|
|
981
|
+
Upload
|
|
952
982
|
});
|
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,41 @@ 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: dateState,
|
|
722
710
|
variant: "borderless",
|
|
723
711
|
onChange: handleChange
|
|
724
712
|
}
|
|
725
|
-
)
|
|
713
|
+
));
|
|
726
714
|
};
|
|
727
715
|
|
|
728
716
|
// src/Components/DateRangePickerElement.tsx
|
|
729
717
|
import React22 from "react";
|
|
730
718
|
import { DatePicker as DatePicker2, Space } from "antd";
|
|
731
|
-
import
|
|
719
|
+
import dayjs2 from "dayjs";
|
|
732
720
|
var DateRangePickerElement = (props) => {
|
|
733
721
|
const { RangePicker } = DatePicker2;
|
|
734
722
|
const handleChange = (dates, dateStrings) => {
|
|
@@ -739,10 +727,10 @@ var DateRangePickerElement = (props) => {
|
|
|
739
727
|
}
|
|
740
728
|
};
|
|
741
729
|
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: [
|
|
730
|
+
{ label: "Last 7 Days", value: [dayjs2().add(-7, "d"), dayjs2()] },
|
|
731
|
+
{ label: "Last 14 Days", value: [dayjs2().add(-14, "d"), dayjs2()] },
|
|
732
|
+
{ label: "Last 30 Days", value: [dayjs2().add(-30, "d"), dayjs2()] },
|
|
733
|
+
{ label: "Last 90 Days", value: [dayjs2().add(-90, "d"), dayjs2()] }
|
|
746
734
|
];
|
|
747
735
|
return /* @__PURE__ */ React22.createElement(Space, { direction: "vertical", size: 12 }, /* @__PURE__ */ React22.createElement(RangePicker, { presets: rangePresets, onChange: handleChange }));
|
|
748
736
|
};
|
|
@@ -769,33 +757,44 @@ var SingleCheckbox = (props) => {
|
|
|
769
757
|
import React25, { useState as useState7 } from "react";
|
|
770
758
|
import { Select as Select4 } from "antd";
|
|
771
759
|
var DropDownGroup = (props) => {
|
|
772
|
-
const [selectedValue, setSelectedValue] = useState7({
|
|
760
|
+
const [selectedValue, setSelectedValue] = useState7({
|
|
761
|
+
firstValue: {},
|
|
762
|
+
secondValue: {},
|
|
763
|
+
temp: ""
|
|
764
|
+
});
|
|
773
765
|
const handleFirstChange = (value) => {
|
|
774
|
-
|
|
766
|
+
console.log(selectedValue.temp);
|
|
767
|
+
const filterOption2 = props.firstOptions?.find(
|
|
768
|
+
(eachOption) => eachOption.value === value
|
|
769
|
+
);
|
|
775
770
|
setSelectedValue((prev) => {
|
|
776
771
|
const newValue = { ...prev, firstValue: filterOption2 };
|
|
772
|
+
const { temp, ...rest } = newValue;
|
|
777
773
|
if (newValue.firstValue) {
|
|
778
|
-
props.onChange?.(
|
|
774
|
+
props.onChange?.(rest);
|
|
779
775
|
}
|
|
780
|
-
return
|
|
776
|
+
return newValue;
|
|
781
777
|
});
|
|
782
778
|
};
|
|
783
779
|
const handleSecondChange = (value) => {
|
|
784
|
-
const filterOption2 = props.
|
|
780
|
+
const filterOption2 = props.secondOptions?.find(
|
|
781
|
+
(eachOption) => eachOption.value === value
|
|
782
|
+
);
|
|
785
783
|
setSelectedValue((prev) => {
|
|
786
784
|
const newValue = { ...prev, secondValue: filterOption2 };
|
|
785
|
+
const { temp, ...rest } = newValue;
|
|
787
786
|
if (newValue.secondValue) {
|
|
788
|
-
props.onChange?.(
|
|
787
|
+
props.onChange?.(rest);
|
|
789
788
|
}
|
|
790
|
-
return
|
|
789
|
+
return newValue;
|
|
791
790
|
});
|
|
792
791
|
};
|
|
793
|
-
return /* @__PURE__ */ React25.createElement("div", { className: props.containerClassName }, /* @__PURE__ */ React25.createElement(
|
|
792
|
+
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
793
|
Select4,
|
|
795
794
|
{
|
|
796
795
|
onChange: handleFirstChange,
|
|
797
796
|
variant: props.variant,
|
|
798
|
-
options: props.
|
|
797
|
+
options: props.firstOptions,
|
|
799
798
|
className: props.className
|
|
800
799
|
}
|
|
801
800
|
), /* @__PURE__ */ React25.createElement("div", { style: { borderLeft: "1px solid gray", height: "33px" } }), /* @__PURE__ */ React25.createElement(
|
|
@@ -803,27 +802,19 @@ var DropDownGroup = (props) => {
|
|
|
803
802
|
{
|
|
804
803
|
onChange: handleSecondChange,
|
|
805
804
|
variant: props.variant,
|
|
806
|
-
options: props.
|
|
805
|
+
options: props.secondOptions,
|
|
807
806
|
className: props.className
|
|
808
807
|
}
|
|
809
|
-
));
|
|
808
|
+
)));
|
|
810
809
|
};
|
|
811
810
|
|
|
812
811
|
// src/Components/FilesUpload.tsx
|
|
813
812
|
import React26, { useState as useState8 } from "react";
|
|
814
|
-
import { Upload
|
|
813
|
+
import { Upload } from "antd";
|
|
815
814
|
import { InboxOutlined } from "@ant-design/icons";
|
|
816
815
|
var FileUpload = (props) => {
|
|
817
816
|
const { Dragger } = Upload;
|
|
818
817
|
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
818
|
const handleChange = ({ fileList }) => {
|
|
828
819
|
setFiles(fileList);
|
|
829
820
|
if (props.onChange) {
|
|
@@ -847,7 +838,6 @@ var FileUpload = (props) => {
|
|
|
847
838
|
maxCount: props.max_count,
|
|
848
839
|
multiple: props.multiple,
|
|
849
840
|
fileList: files,
|
|
850
|
-
beforeUpload,
|
|
851
841
|
onChange: handleChange,
|
|
852
842
|
showUploadList: true,
|
|
853
843
|
customRequest
|
|
@@ -868,6 +858,42 @@ var TabsElement = (props) => {
|
|
|
868
858
|
};
|
|
869
859
|
return /* @__PURE__ */ React27.createElement(Tabs, { className: props.containerClassName, items: props.options, onChange: handleChange });
|
|
870
860
|
};
|
|
861
|
+
|
|
862
|
+
// src/Components/SwitchElement.tsx
|
|
863
|
+
import React28 from "react";
|
|
864
|
+
import { Switch } from "antd";
|
|
865
|
+
var onChange = (checked) => {
|
|
866
|
+
console.log(`switch to ${checked}`);
|
|
867
|
+
};
|
|
868
|
+
var SwitchElement = () => /* @__PURE__ */ React28.createElement(Switch, { defaultChecked: true, onChange });
|
|
869
|
+
|
|
870
|
+
// src/Components/Upload.tsx
|
|
871
|
+
import React29, { useState as useState9 } from "react";
|
|
872
|
+
var Upload2 = (props) => {
|
|
873
|
+
const [file, setFile] = useState9();
|
|
874
|
+
const handleFileChange = (e) => {
|
|
875
|
+
setFile(e.target.files[0]);
|
|
876
|
+
if (props.onChange) {
|
|
877
|
+
props.onChange(e.target.files[0]);
|
|
878
|
+
}
|
|
879
|
+
};
|
|
880
|
+
const handleUpload = async () => {
|
|
881
|
+
if (!file) {
|
|
882
|
+
console.error("No file selected");
|
|
883
|
+
return;
|
|
884
|
+
}
|
|
885
|
+
};
|
|
886
|
+
return /* @__PURE__ */ React29.createElement("div", { style: { marginTop: 16 } }, /* @__PURE__ */ React29.createElement("input", { type: "file", onChange: handleFileChange }), /* @__PURE__ */ React29.createElement(
|
|
887
|
+
"button",
|
|
888
|
+
{
|
|
889
|
+
type: "button",
|
|
890
|
+
onClick: handleUpload,
|
|
891
|
+
disabled: !file,
|
|
892
|
+
style: { marginTop: 16 }
|
|
893
|
+
},
|
|
894
|
+
"Upload"
|
|
895
|
+
));
|
|
896
|
+
};
|
|
871
897
|
export {
|
|
872
898
|
AddMoreTable,
|
|
873
899
|
ButtonElement,
|
|
@@ -887,8 +913,10 @@ export {
|
|
|
887
913
|
Sidebar,
|
|
888
914
|
SingleCheckbox,
|
|
889
915
|
SingleSelectElement,
|
|
916
|
+
SwitchElement,
|
|
890
917
|
TableElement,
|
|
891
918
|
TabsElement,
|
|
892
919
|
TextElement,
|
|
893
|
-
TextareaElement
|
|
920
|
+
TextareaElement,
|
|
921
|
+
Upload2 as Upload
|
|
894
922
|
};
|