@apexcura/ui-components 0.0.14-Beta4 → 0.0.14-Beta40
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.css +3 -0
- package/dist/index.d.mts +9 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.js +174 -84
- package/dist/index.mjs +182 -94
- package/package.json +1 -1
package/dist/index.css
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -26,6 +26,9 @@ type ElementType = {
|
|
|
26
26
|
fields?: any[];
|
|
27
27
|
schema?: any[];
|
|
28
28
|
options?: any[];
|
|
29
|
+
firstOptions?: any[];
|
|
30
|
+
secondOptions?: any[];
|
|
31
|
+
view?: boolean;
|
|
29
32
|
onChange?: (value: string | number | boolean | object | any[] | undefined) => void;
|
|
30
33
|
onClick?: () => void;
|
|
31
34
|
dropDownOptions?: any[];
|
|
@@ -82,7 +85,7 @@ declare const SingleSelectElement: (props: ElementType) => React$1.JSX.Element;
|
|
|
82
85
|
|
|
83
86
|
declare const MultipleSelectElement: (props: ElementType) => React$1.JSX.Element;
|
|
84
87
|
|
|
85
|
-
declare const ButtonElement: React$1.
|
|
88
|
+
declare const ButtonElement: (props: any) => React$1.JSX.Element;
|
|
86
89
|
|
|
87
90
|
declare const AddMoreTable: (props: ElementType) => React$1.JSX.Element;
|
|
88
91
|
|
|
@@ -106,4 +109,8 @@ declare const FileUpload: (props: ElementType) => React$1.JSX.Element;
|
|
|
106
109
|
|
|
107
110
|
declare const TabsElement: (props: ElementType) => React$1.JSX.Element;
|
|
108
111
|
|
|
109
|
-
|
|
112
|
+
declare const SwitchElement: () => React$1.JSX.Element;
|
|
113
|
+
|
|
114
|
+
declare const Upload: (props: ElementType) => React$1.JSX.Element;
|
|
115
|
+
|
|
116
|
+
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,9 @@ type ElementType = {
|
|
|
26
26
|
fields?: any[];
|
|
27
27
|
schema?: any[];
|
|
28
28
|
options?: any[];
|
|
29
|
+
firstOptions?: any[];
|
|
30
|
+
secondOptions?: any[];
|
|
31
|
+
view?: boolean;
|
|
29
32
|
onChange?: (value: string | number | boolean | object | any[] | undefined) => void;
|
|
30
33
|
onClick?: () => void;
|
|
31
34
|
dropDownOptions?: any[];
|
|
@@ -82,7 +85,7 @@ declare const SingleSelectElement: (props: ElementType) => React$1.JSX.Element;
|
|
|
82
85
|
|
|
83
86
|
declare const MultipleSelectElement: (props: ElementType) => React$1.JSX.Element;
|
|
84
87
|
|
|
85
|
-
declare const ButtonElement: React$1.
|
|
88
|
+
declare const ButtonElement: (props: any) => React$1.JSX.Element;
|
|
86
89
|
|
|
87
90
|
declare const AddMoreTable: (props: ElementType) => React$1.JSX.Element;
|
|
88
91
|
|
|
@@ -106,4 +109,8 @@ declare const FileUpload: (props: ElementType) => React$1.JSX.Element;
|
|
|
106
109
|
|
|
107
110
|
declare const TabsElement: (props: ElementType) => React$1.JSX.Element;
|
|
108
111
|
|
|
109
|
-
|
|
112
|
+
declare const SwitchElement: () => React$1.JSX.Element;
|
|
113
|
+
|
|
114
|
+
declare const Upload: (props: ElementType) => React$1.JSX.Element;
|
|
115
|
+
|
|
116
|
+
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
|
|
|
@@ -375,13 +377,78 @@ var MultipleSelectElement = (props) => {
|
|
|
375
377
|
// src/Components/Button.tsx
|
|
376
378
|
var import_react11 = __toESM(require("react"));
|
|
377
379
|
var ButtonElement = (props) => {
|
|
380
|
+
const [svgContent, setSvgContent] = (0, import_react11.useState)(null);
|
|
381
|
+
const [hoverColor, setHoverColor] = (0, import_react11.useState)(null);
|
|
382
|
+
(0, import_react11.useEffect)(() => {
|
|
383
|
+
if (props.icon) {
|
|
384
|
+
fetch(props.icon).then((response) => response.text()).then((data) => {
|
|
385
|
+
const tempDiv = document.createElement("div");
|
|
386
|
+
tempDiv.innerHTML = data;
|
|
387
|
+
const svgElement = tempDiv.querySelector("svg");
|
|
388
|
+
if (svgElement) {
|
|
389
|
+
const textColorClass = props.className.match(/text-[\w-]+/g)?.[0];
|
|
390
|
+
const hoverColorClass = props.className.match(/hover:text-[\w-]+/g)?.[0];
|
|
391
|
+
if (textColorClass) {
|
|
392
|
+
const tempSpan = document.createElement("span");
|
|
393
|
+
tempSpan.className = textColorClass;
|
|
394
|
+
document.body.appendChild(tempSpan);
|
|
395
|
+
const computedColor = getComputedStyle(tempSpan).color;
|
|
396
|
+
document.body.removeChild(tempSpan);
|
|
397
|
+
const paths = svgElement.querySelectorAll("path");
|
|
398
|
+
paths.forEach((path) => path.setAttribute("fill", computedColor));
|
|
399
|
+
}
|
|
400
|
+
if (hoverColorClass) {
|
|
401
|
+
const tempSpan = document.createElement("span");
|
|
402
|
+
tempSpan.className = hoverColorClass.replace("hover:", "");
|
|
403
|
+
document.body.appendChild(tempSpan);
|
|
404
|
+
const computedHoverColor = getComputedStyle(tempSpan).color;
|
|
405
|
+
document.body.removeChild(tempSpan);
|
|
406
|
+
setHoverColor(computedHoverColor);
|
|
407
|
+
}
|
|
408
|
+
svgElement.setAttribute(
|
|
409
|
+
"class",
|
|
410
|
+
`${props.className ? props.className : ""}`
|
|
411
|
+
);
|
|
412
|
+
setSvgContent(tempDiv.innerHTML);
|
|
413
|
+
}
|
|
414
|
+
}).catch((error) => console.error("Error fetching SVG:", error));
|
|
415
|
+
}
|
|
416
|
+
}, [props.icon, props.className]);
|
|
417
|
+
const handleMouseEnter = () => {
|
|
418
|
+
if (hoverColor && svgContent) {
|
|
419
|
+
const tempDiv = document.createElement("div");
|
|
420
|
+
tempDiv.innerHTML = svgContent;
|
|
421
|
+
const svgElement = tempDiv.querySelector("svg");
|
|
422
|
+
const paths = svgElement?.querySelectorAll("path");
|
|
423
|
+
paths?.forEach((path) => path.setAttribute("fill", hoverColor));
|
|
424
|
+
setSvgContent(tempDiv.innerHTML);
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
const handleMouseLeave = () => {
|
|
428
|
+
if (svgContent) {
|
|
429
|
+
const tempDiv = document.createElement("div");
|
|
430
|
+
tempDiv.innerHTML = svgContent;
|
|
431
|
+
const svgElement = tempDiv.querySelector("svg");
|
|
432
|
+
const paths = svgElement?.querySelectorAll("path");
|
|
433
|
+
paths?.forEach((path) => path.removeAttribute("fill"));
|
|
434
|
+
setSvgContent(tempDiv.innerHTML);
|
|
435
|
+
}
|
|
436
|
+
};
|
|
378
437
|
return /* @__PURE__ */ import_react11.default.createElement(
|
|
379
438
|
"button",
|
|
380
439
|
{
|
|
381
440
|
onClick: () => props.onClick && props.onClick(),
|
|
382
|
-
className: `${props.className ? props.className : ""}
|
|
441
|
+
className: `${props.className ? props.className : ""}`,
|
|
442
|
+
onMouseEnter: handleMouseEnter,
|
|
443
|
+
onMouseLeave: handleMouseLeave
|
|
383
444
|
},
|
|
384
|
-
|
|
445
|
+
svgContent && /* @__PURE__ */ import_react11.default.createElement(
|
|
446
|
+
"span",
|
|
447
|
+
{
|
|
448
|
+
className: "svg-container",
|
|
449
|
+
dangerouslySetInnerHTML: { __html: svgContent }
|
|
450
|
+
}
|
|
451
|
+
),
|
|
385
452
|
props.label
|
|
386
453
|
);
|
|
387
454
|
};
|
|
@@ -464,9 +531,9 @@ var AddMoreTable = (props) => {
|
|
|
464
531
|
if (!element) return null;
|
|
465
532
|
const { element: type, label } = element;
|
|
466
533
|
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 });
|
|
534
|
+
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
535
|
} 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 });
|
|
536
|
+
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
537
|
} else {
|
|
471
538
|
return null;
|
|
472
539
|
}
|
|
@@ -667,11 +734,6 @@ var TableElement = (props) => {
|
|
|
667
734
|
dataIndex: "#",
|
|
668
735
|
key: "#"
|
|
669
736
|
},
|
|
670
|
-
{
|
|
671
|
-
title: "View",
|
|
672
|
-
dataIndex: "View",
|
|
673
|
-
key: "View"
|
|
674
|
-
},
|
|
675
737
|
...thead.map((col, ind) => ({
|
|
676
738
|
title: col.label,
|
|
677
739
|
dataIndex: col.name,
|
|
@@ -688,11 +750,28 @@ var TableElement = (props) => {
|
|
|
688
750
|
}
|
|
689
751
|
}))
|
|
690
752
|
];
|
|
753
|
+
if (props.view) {
|
|
754
|
+
columns.push({
|
|
755
|
+
title: "View",
|
|
756
|
+
dataIndex: "View",
|
|
757
|
+
key: "View",
|
|
758
|
+
render: (_, record) => /* @__PURE__ */ import_react20.default.createElement(
|
|
759
|
+
"a",
|
|
760
|
+
{
|
|
761
|
+
onClick: () => {
|
|
762
|
+
setSelectedRecord(record);
|
|
763
|
+
handleChange(record);
|
|
764
|
+
setModel(true);
|
|
765
|
+
}
|
|
766
|
+
},
|
|
767
|
+
"View"
|
|
768
|
+
)
|
|
769
|
+
});
|
|
770
|
+
}
|
|
691
771
|
}
|
|
692
772
|
const dataSource = tbody && tbody.map((row, index) => ({
|
|
693
773
|
...row,
|
|
694
|
-
[columns[0].key]: index + 1
|
|
695
|
-
[columns[-1].key]: "View"
|
|
774
|
+
[columns[0].key]: index + 1
|
|
696
775
|
}));
|
|
697
776
|
const count = dataSource ? dataSource.length : 0;
|
|
698
777
|
const onChangePage = (page, pageSize) => {
|
|
@@ -721,17 +800,7 @@ var TableElement = (props) => {
|
|
|
721
800
|
columns,
|
|
722
801
|
bordered: true,
|
|
723
802
|
rowSelection: rowSelectionConfig,
|
|
724
|
-
size: props.size && props.size
|
|
725
|
-
onRow: (record) => {
|
|
726
|
-
return {
|
|
727
|
-
onClick: () => {
|
|
728
|
-
setSelectedRecord(record);
|
|
729
|
-
handleChange(record);
|
|
730
|
-
setModel(true);
|
|
731
|
-
},
|
|
732
|
-
style: { cursor: "pointer" }
|
|
733
|
-
};
|
|
734
|
-
}
|
|
803
|
+
size: props.size && props.size
|
|
735
804
|
}
|
|
736
805
|
), model && /* @__PURE__ */ import_react20.default.createElement(ModelElement, { selectedRecord, ...props, columns, model, onCancel: () => setModel(false) }));
|
|
737
806
|
};
|
|
@@ -739,59 +808,40 @@ var TableElement = (props) => {
|
|
|
739
808
|
// src/Components/DatePicker.tsx
|
|
740
809
|
var import_react21 = __toESM(require("react"));
|
|
741
810
|
var import_antd15 = require("antd");
|
|
742
|
-
var
|
|
743
|
-
var
|
|
811
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
812
|
+
var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat.js"));
|
|
813
|
+
import_dayjs.default.extend(import_customParseFormat.default);
|
|
744
814
|
var DatePickerElement = (props) => {
|
|
745
|
-
const [
|
|
746
|
-
const handleChange = (
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
const formattedDate = dateString;
|
|
751
|
-
console.log("formattedDate-----------------", formattedDate);
|
|
752
|
-
setDate(date2);
|
|
753
|
-
console.log("changedDate------------", date2);
|
|
815
|
+
const [dateState, setDateState] = (0, import_react21.useState)("");
|
|
816
|
+
const handleChange = (date, dateString) => {
|
|
817
|
+
if (date) {
|
|
818
|
+
const formattedDate = date;
|
|
819
|
+
setDateState(date);
|
|
754
820
|
if (props.onChange) {
|
|
755
821
|
props.onChange(formattedDate);
|
|
756
822
|
}
|
|
757
823
|
} else {
|
|
758
|
-
|
|
824
|
+
setDateState("");
|
|
759
825
|
if (props.onChange) {
|
|
760
826
|
props.onChange("");
|
|
761
827
|
}
|
|
762
828
|
}
|
|
763
829
|
};
|
|
764
|
-
|
|
765
|
-
const currentDate = date || (0, import_moment.default)();
|
|
766
|
-
const newDate = (0, import_moment.default)(currentDate).subtract(1, "days");
|
|
767
|
-
setDate(newDate);
|
|
768
|
-
if (props.onChange) {
|
|
769
|
-
props.onChange(newDate.format("lll"));
|
|
770
|
-
}
|
|
771
|
-
};
|
|
772
|
-
const onHandleIncrement = () => {
|
|
773
|
-
const currentDate = date || (0, import_moment.default)();
|
|
774
|
-
const newDate = (0, import_moment.default)(currentDate).add(1, "days");
|
|
775
|
-
setDate(newDate);
|
|
776
|
-
if (props.onChange) {
|
|
777
|
-
props.onChange(newDate.format("lll"));
|
|
778
|
-
}
|
|
779
|
-
};
|
|
780
|
-
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(
|
|
830
|
+
return /* @__PURE__ */ import_react21.default.createElement("div", null, /* @__PURE__ */ import_react21.default.createElement(
|
|
781
831
|
import_antd15.DatePicker,
|
|
782
832
|
{
|
|
783
833
|
placeholder: props.placeholder,
|
|
784
|
-
value:
|
|
785
|
-
|
|
834
|
+
value: dateState,
|
|
835
|
+
format: { format: "DD-MM-YYYY" },
|
|
786
836
|
onChange: handleChange
|
|
787
837
|
}
|
|
788
|
-
)
|
|
838
|
+
));
|
|
789
839
|
};
|
|
790
840
|
|
|
791
841
|
// src/Components/DateRangePickerElement.tsx
|
|
792
842
|
var import_react22 = __toESM(require("react"));
|
|
793
843
|
var import_antd16 = require("antd");
|
|
794
|
-
var
|
|
844
|
+
var import_dayjs2 = __toESM(require("dayjs"));
|
|
795
845
|
var DateRangePickerElement = (props) => {
|
|
796
846
|
const { RangePicker } = import_antd16.DatePicker;
|
|
797
847
|
const handleChange = (dates, dateStrings) => {
|
|
@@ -802,10 +852,10 @@ var DateRangePickerElement = (props) => {
|
|
|
802
852
|
}
|
|
803
853
|
};
|
|
804
854
|
const rangePresets = [
|
|
805
|
-
{ label: "Last 7 Days", value: [(0,
|
|
806
|
-
{ label: "Last 14 Days", value: [(0,
|
|
807
|
-
{ label: "Last 30 Days", value: [(0,
|
|
808
|
-
{ label: "Last 90 Days", value: [(0,
|
|
855
|
+
{ label: "Last 7 Days", value: [(0, import_dayjs2.default)().add(-7, "d"), (0, import_dayjs2.default)()] },
|
|
856
|
+
{ label: "Last 14 Days", value: [(0, import_dayjs2.default)().add(-14, "d"), (0, import_dayjs2.default)()] },
|
|
857
|
+
{ label: "Last 30 Days", value: [(0, import_dayjs2.default)().add(-30, "d"), (0, import_dayjs2.default)()] },
|
|
858
|
+
{ label: "Last 90 Days", value: [(0, import_dayjs2.default)().add(-90, "d"), (0, import_dayjs2.default)()] }
|
|
809
859
|
];
|
|
810
860
|
return /* @__PURE__ */ import_react22.default.createElement(import_antd16.Space, { direction: "vertical", size: 12 }, /* @__PURE__ */ import_react22.default.createElement(RangePicker, { presets: rangePresets, onChange: handleChange }));
|
|
811
861
|
};
|
|
@@ -813,7 +863,7 @@ var DateRangePickerElement = (props) => {
|
|
|
813
863
|
// src/Components/Image.tsx
|
|
814
864
|
var import_react23 = __toESM(require("react"));
|
|
815
865
|
var Image = (props) => {
|
|
816
|
-
return /* @__PURE__ */ import_react23.default.createElement("
|
|
866
|
+
return /* @__PURE__ */ import_react23.default.createElement("img", { className: props.className, src: props.img, alt: "image" });
|
|
817
867
|
};
|
|
818
868
|
|
|
819
869
|
// src/Components/SingleCheckbox.tsx
|
|
@@ -832,33 +882,44 @@ var SingleCheckbox = (props) => {
|
|
|
832
882
|
var import_react25 = __toESM(require("react"));
|
|
833
883
|
var import_antd18 = require("antd");
|
|
834
884
|
var DropDownGroup = (props) => {
|
|
835
|
-
const [selectedValue, setSelectedValue] = (0, import_react25.useState)({
|
|
885
|
+
const [selectedValue, setSelectedValue] = (0, import_react25.useState)({
|
|
886
|
+
firstValue: {},
|
|
887
|
+
secondValue: {},
|
|
888
|
+
temp: ""
|
|
889
|
+
});
|
|
836
890
|
const handleFirstChange = (value) => {
|
|
837
|
-
|
|
891
|
+
console.log(selectedValue.temp);
|
|
892
|
+
const filterOption2 = props.firstOptions?.find(
|
|
893
|
+
(eachOption) => eachOption.value === value
|
|
894
|
+
);
|
|
838
895
|
setSelectedValue((prev) => {
|
|
839
896
|
const newValue = { ...prev, firstValue: filterOption2 };
|
|
897
|
+
const { temp, ...rest } = newValue;
|
|
840
898
|
if (newValue.firstValue) {
|
|
841
|
-
props.onChange?.(
|
|
899
|
+
props.onChange?.(rest);
|
|
842
900
|
}
|
|
843
|
-
return
|
|
901
|
+
return newValue;
|
|
844
902
|
});
|
|
845
903
|
};
|
|
846
904
|
const handleSecondChange = (value) => {
|
|
847
|
-
const filterOption2 = props.
|
|
905
|
+
const filterOption2 = props.secondOptions?.find(
|
|
906
|
+
(eachOption) => eachOption.value === value
|
|
907
|
+
);
|
|
848
908
|
setSelectedValue((prev) => {
|
|
849
909
|
const newValue = { ...prev, secondValue: filterOption2 };
|
|
910
|
+
const { temp, ...rest } = newValue;
|
|
850
911
|
if (newValue.secondValue) {
|
|
851
|
-
props.onChange?.(
|
|
912
|
+
props.onChange?.(rest);
|
|
852
913
|
}
|
|
853
|
-
return
|
|
914
|
+
return newValue;
|
|
854
915
|
});
|
|
855
916
|
};
|
|
856
|
-
return /* @__PURE__ */ import_react25.default.createElement("div", { className: props.containerClassName }, /* @__PURE__ */ import_react25.default.createElement(
|
|
917
|
+
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(
|
|
857
918
|
import_antd18.Select,
|
|
858
919
|
{
|
|
859
920
|
onChange: handleFirstChange,
|
|
860
921
|
variant: props.variant,
|
|
861
|
-
options: props.
|
|
922
|
+
options: props.firstOptions,
|
|
862
923
|
className: props.className
|
|
863
924
|
}
|
|
864
925
|
), /* @__PURE__ */ import_react25.default.createElement("div", { style: { borderLeft: "1px solid gray", height: "33px" } }), /* @__PURE__ */ import_react25.default.createElement(
|
|
@@ -866,27 +927,19 @@ var DropDownGroup = (props) => {
|
|
|
866
927
|
{
|
|
867
928
|
onChange: handleSecondChange,
|
|
868
929
|
variant: props.variant,
|
|
869
|
-
options: props.
|
|
930
|
+
options: props.secondOptions,
|
|
870
931
|
className: props.className
|
|
871
932
|
}
|
|
872
|
-
));
|
|
933
|
+
)));
|
|
873
934
|
};
|
|
874
935
|
|
|
875
936
|
// src/Components/FilesUpload.tsx
|
|
876
937
|
var import_react26 = __toESM(require("react"));
|
|
877
938
|
var import_antd19 = require("antd");
|
|
878
|
-
var
|
|
939
|
+
var import_icons4 = require("@ant-design/icons");
|
|
879
940
|
var FileUpload = (props) => {
|
|
880
941
|
const { Dragger } = import_antd19.Upload;
|
|
881
942
|
const [files, setFiles] = (0, import_react26.useState)([]);
|
|
882
|
-
const beforeUpload = (file) => {
|
|
883
|
-
const isCorrectFile = ["image/png", "image/jpg", "image/jpeg", "application/pdf"].includes(file.type);
|
|
884
|
-
if (!isCorrectFile) {
|
|
885
|
-
import_antd19.message.error(`(${file.name}) is an invalid file. Please upload files with the following extensions only (.png/.jpg/.jpeg/.pdf)`);
|
|
886
|
-
return import_antd19.Upload.LIST_IGNORE;
|
|
887
|
-
}
|
|
888
|
-
return true;
|
|
889
|
-
};
|
|
890
943
|
const handleChange = ({ fileList }) => {
|
|
891
944
|
setFiles(fileList);
|
|
892
945
|
if (props.onChange) {
|
|
@@ -910,12 +963,11 @@ var FileUpload = (props) => {
|
|
|
910
963
|
maxCount: props.max_count,
|
|
911
964
|
multiple: props.multiple,
|
|
912
965
|
fileList: files,
|
|
913
|
-
beforeUpload,
|
|
914
966
|
onChange: handleChange,
|
|
915
967
|
showUploadList: true,
|
|
916
968
|
customRequest
|
|
917
969
|
},
|
|
918
|
-
/* @__PURE__ */ import_react26.default.createElement("p", null, /* @__PURE__ */ import_react26.default.createElement(
|
|
970
|
+
/* @__PURE__ */ import_react26.default.createElement("p", null, /* @__PURE__ */ import_react26.default.createElement(import_icons4.InboxOutlined, null)),
|
|
919
971
|
/* @__PURE__ */ import_react26.default.createElement("p", null, "Click or drag file to upload")
|
|
920
972
|
));
|
|
921
973
|
};
|
|
@@ -931,6 +983,42 @@ var TabsElement = (props) => {
|
|
|
931
983
|
};
|
|
932
984
|
return /* @__PURE__ */ import_react27.default.createElement(import_antd20.Tabs, { className: props.containerClassName, items: props.options, onChange: handleChange });
|
|
933
985
|
};
|
|
986
|
+
|
|
987
|
+
// src/Components/SwitchElement.tsx
|
|
988
|
+
var import_react28 = __toESM(require("react"));
|
|
989
|
+
var import_antd21 = require("antd");
|
|
990
|
+
var onChange = (checked) => {
|
|
991
|
+
console.log(`switch to ${checked}`);
|
|
992
|
+
};
|
|
993
|
+
var SwitchElement = () => /* @__PURE__ */ import_react28.default.createElement(import_antd21.Switch, { defaultChecked: true, onChange });
|
|
994
|
+
|
|
995
|
+
// src/Components/Upload.tsx
|
|
996
|
+
var import_react29 = __toESM(require("react"));
|
|
997
|
+
var Upload2 = (props) => {
|
|
998
|
+
const [file, setFile] = (0, import_react29.useState)();
|
|
999
|
+
const handleFileChange = (e) => {
|
|
1000
|
+
setFile(e.target.files[0]);
|
|
1001
|
+
if (props.onChange) {
|
|
1002
|
+
props.onChange(e.target.files[0]);
|
|
1003
|
+
}
|
|
1004
|
+
};
|
|
1005
|
+
const handleUpload = async () => {
|
|
1006
|
+
if (!file) {
|
|
1007
|
+
console.error("No file selected");
|
|
1008
|
+
return;
|
|
1009
|
+
}
|
|
1010
|
+
};
|
|
1011
|
+
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(
|
|
1012
|
+
"button",
|
|
1013
|
+
{
|
|
1014
|
+
type: "button",
|
|
1015
|
+
onClick: handleUpload,
|
|
1016
|
+
disabled: !file,
|
|
1017
|
+
style: { marginTop: 16 }
|
|
1018
|
+
},
|
|
1019
|
+
"Upload"
|
|
1020
|
+
));
|
|
1021
|
+
};
|
|
934
1022
|
// Annotate the CommonJS export names for ESM import in node:
|
|
935
1023
|
0 && (module.exports = {
|
|
936
1024
|
AddMoreTable,
|
|
@@ -951,8 +1039,10 @@ var TabsElement = (props) => {
|
|
|
951
1039
|
Sidebar,
|
|
952
1040
|
SingleCheckbox,
|
|
953
1041
|
SingleSelectElement,
|
|
1042
|
+
SwitchElement,
|
|
954
1043
|
TableElement,
|
|
955
1044
|
TabsElement,
|
|
956
1045
|
TextElement,
|
|
957
|
-
TextareaElement
|
|
1046
|
+
TextareaElement,
|
|
1047
|
+
Upload
|
|
958
1048
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -316,26 +316,91 @@ var MultipleSelectElement = (props) => {
|
|
|
316
316
|
};
|
|
317
317
|
|
|
318
318
|
// src/Components/Button.tsx
|
|
319
|
-
import React11 from "react";
|
|
319
|
+
import React11, { useEffect, useState as useState4 } from "react";
|
|
320
320
|
var ButtonElement = (props) => {
|
|
321
|
+
const [svgContent, setSvgContent] = useState4(null);
|
|
322
|
+
const [hoverColor, setHoverColor] = useState4(null);
|
|
323
|
+
useEffect(() => {
|
|
324
|
+
if (props.icon) {
|
|
325
|
+
fetch(props.icon).then((response) => response.text()).then((data) => {
|
|
326
|
+
const tempDiv = document.createElement("div");
|
|
327
|
+
tempDiv.innerHTML = data;
|
|
328
|
+
const svgElement = tempDiv.querySelector("svg");
|
|
329
|
+
if (svgElement) {
|
|
330
|
+
const textColorClass = props.className.match(/text-[\w-]+/g)?.[0];
|
|
331
|
+
const hoverColorClass = props.className.match(/hover:text-[\w-]+/g)?.[0];
|
|
332
|
+
if (textColorClass) {
|
|
333
|
+
const tempSpan = document.createElement("span");
|
|
334
|
+
tempSpan.className = textColorClass;
|
|
335
|
+
document.body.appendChild(tempSpan);
|
|
336
|
+
const computedColor = getComputedStyle(tempSpan).color;
|
|
337
|
+
document.body.removeChild(tempSpan);
|
|
338
|
+
const paths = svgElement.querySelectorAll("path");
|
|
339
|
+
paths.forEach((path) => path.setAttribute("fill", computedColor));
|
|
340
|
+
}
|
|
341
|
+
if (hoverColorClass) {
|
|
342
|
+
const tempSpan = document.createElement("span");
|
|
343
|
+
tempSpan.className = hoverColorClass.replace("hover:", "");
|
|
344
|
+
document.body.appendChild(tempSpan);
|
|
345
|
+
const computedHoverColor = getComputedStyle(tempSpan).color;
|
|
346
|
+
document.body.removeChild(tempSpan);
|
|
347
|
+
setHoverColor(computedHoverColor);
|
|
348
|
+
}
|
|
349
|
+
svgElement.setAttribute(
|
|
350
|
+
"class",
|
|
351
|
+
`${props.className ? props.className : ""}`
|
|
352
|
+
);
|
|
353
|
+
setSvgContent(tempDiv.innerHTML);
|
|
354
|
+
}
|
|
355
|
+
}).catch((error) => console.error("Error fetching SVG:", error));
|
|
356
|
+
}
|
|
357
|
+
}, [props.icon, props.className]);
|
|
358
|
+
const handleMouseEnter = () => {
|
|
359
|
+
if (hoverColor && svgContent) {
|
|
360
|
+
const tempDiv = document.createElement("div");
|
|
361
|
+
tempDiv.innerHTML = svgContent;
|
|
362
|
+
const svgElement = tempDiv.querySelector("svg");
|
|
363
|
+
const paths = svgElement?.querySelectorAll("path");
|
|
364
|
+
paths?.forEach((path) => path.setAttribute("fill", hoverColor));
|
|
365
|
+
setSvgContent(tempDiv.innerHTML);
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
const handleMouseLeave = () => {
|
|
369
|
+
if (svgContent) {
|
|
370
|
+
const tempDiv = document.createElement("div");
|
|
371
|
+
tempDiv.innerHTML = svgContent;
|
|
372
|
+
const svgElement = tempDiv.querySelector("svg");
|
|
373
|
+
const paths = svgElement?.querySelectorAll("path");
|
|
374
|
+
paths?.forEach((path) => path.removeAttribute("fill"));
|
|
375
|
+
setSvgContent(tempDiv.innerHTML);
|
|
376
|
+
}
|
|
377
|
+
};
|
|
321
378
|
return /* @__PURE__ */ React11.createElement(
|
|
322
379
|
"button",
|
|
323
380
|
{
|
|
324
381
|
onClick: () => props.onClick && props.onClick(),
|
|
325
|
-
className: `${props.className ? props.className : ""}
|
|
382
|
+
className: `${props.className ? props.className : ""}`,
|
|
383
|
+
onMouseEnter: handleMouseEnter,
|
|
384
|
+
onMouseLeave: handleMouseLeave
|
|
326
385
|
},
|
|
327
|
-
|
|
386
|
+
svgContent && /* @__PURE__ */ React11.createElement(
|
|
387
|
+
"span",
|
|
388
|
+
{
|
|
389
|
+
className: "svg-container",
|
|
390
|
+
dangerouslySetInnerHTML: { __html: svgContent }
|
|
391
|
+
}
|
|
392
|
+
),
|
|
328
393
|
props.label
|
|
329
394
|
);
|
|
330
395
|
};
|
|
331
396
|
|
|
332
397
|
// src/Components/AddMoreTable.tsx
|
|
333
|
-
import React12, { useEffect, useState as
|
|
398
|
+
import React12, { useEffect as useEffect2, useState as useState5 } from "react";
|
|
334
399
|
import { Table, Button } from "antd";
|
|
335
400
|
import { PlusOutlined, DeleteOutlined } from "@ant-design/icons";
|
|
336
401
|
var AddMoreTable = (props) => {
|
|
337
402
|
const { thead, tbody } = props;
|
|
338
|
-
const [rows, setRows] =
|
|
403
|
+
const [rows, setRows] = useState5(tbody || []);
|
|
339
404
|
const onHandleRows = () => {
|
|
340
405
|
const newId = rows.length > 0 ? rows[rows.length - 1].id + 1 : 1;
|
|
341
406
|
let newRow = {
|
|
@@ -400,16 +465,16 @@ var AddMoreTable = (props) => {
|
|
|
400
465
|
});
|
|
401
466
|
});
|
|
402
467
|
};
|
|
403
|
-
|
|
468
|
+
useEffect2(() => {
|
|
404
469
|
console.log(rows);
|
|
405
470
|
}, [rows]);
|
|
406
471
|
const renderInputElement = (element, value) => {
|
|
407
472
|
if (!element) return null;
|
|
408
473
|
const { element: type, label } = element;
|
|
409
474
|
if (type === "single-select") {
|
|
410
|
-
return /* @__PURE__ */ React12.createElement(SingleSelectElement, { onChange: (value2) => console.log(label, value2), optionType: "", className: void 0, selectedStyle: false, style: false });
|
|
475
|
+
return /* @__PURE__ */ React12.createElement(SingleSelectElement, { onChange: (value2) => console.log(label, value2), optionType: "", className: void 0, selectedStyle: false, style: false, options1: [], options2: [], firstOptions: [], secondOptions: [] });
|
|
411
476
|
} else if (type === "textarea") {
|
|
412
|
-
return /* @__PURE__ */ React12.createElement(TextareaElement, { onChange: (value2) => console.log(label, value2), optionType: "", className: void 0, selectedStyle: false, style: false });
|
|
477
|
+
return /* @__PURE__ */ React12.createElement(TextareaElement, { onChange: (value2) => console.log(label, value2), optionType: "", className: void 0, selectedStyle: false, style: false, options1: [], options2: [], firstOptions: [], secondOptions: [] });
|
|
413
478
|
} else {
|
|
414
479
|
return null;
|
|
415
480
|
}
|
|
@@ -535,7 +600,7 @@ var Navbar = (props) => {
|
|
|
535
600
|
};
|
|
536
601
|
|
|
537
602
|
// src/Components/TableElement.tsx
|
|
538
|
-
import React20, { useState as
|
|
603
|
+
import React20, { useState as useState6 } from "react";
|
|
539
604
|
import { Table as Table2 } from "antd";
|
|
540
605
|
|
|
541
606
|
// src/Components/Model.tsx
|
|
@@ -593,9 +658,9 @@ var ModelElement = (props) => {
|
|
|
593
658
|
// src/Components/TableElement.tsx
|
|
594
659
|
var TableElement = (props) => {
|
|
595
660
|
const { thead, tbody } = props;
|
|
596
|
-
const [selectedRecord, setSelectedRecord] =
|
|
597
|
-
const [model, setModel] =
|
|
598
|
-
const [selectedRowKeys, setSelectedRowKeys] =
|
|
661
|
+
const [selectedRecord, setSelectedRecord] = useState6({});
|
|
662
|
+
const [model, setModel] = useState6(false);
|
|
663
|
+
const [selectedRowKeys, setSelectedRowKeys] = useState6([]);
|
|
599
664
|
const handleChange = (record) => {
|
|
600
665
|
console.log("record", record);
|
|
601
666
|
if (props.onChange) {
|
|
@@ -610,11 +675,6 @@ var TableElement = (props) => {
|
|
|
610
675
|
dataIndex: "#",
|
|
611
676
|
key: "#"
|
|
612
677
|
},
|
|
613
|
-
{
|
|
614
|
-
title: "View",
|
|
615
|
-
dataIndex: "View",
|
|
616
|
-
key: "View"
|
|
617
|
-
},
|
|
618
678
|
...thead.map((col, ind) => ({
|
|
619
679
|
title: col.label,
|
|
620
680
|
dataIndex: col.name,
|
|
@@ -631,11 +691,28 @@ var TableElement = (props) => {
|
|
|
631
691
|
}
|
|
632
692
|
}))
|
|
633
693
|
];
|
|
694
|
+
if (props.view) {
|
|
695
|
+
columns.push({
|
|
696
|
+
title: "View",
|
|
697
|
+
dataIndex: "View",
|
|
698
|
+
key: "View",
|
|
699
|
+
render: (_, record) => /* @__PURE__ */ React20.createElement(
|
|
700
|
+
"a",
|
|
701
|
+
{
|
|
702
|
+
onClick: () => {
|
|
703
|
+
setSelectedRecord(record);
|
|
704
|
+
handleChange(record);
|
|
705
|
+
setModel(true);
|
|
706
|
+
}
|
|
707
|
+
},
|
|
708
|
+
"View"
|
|
709
|
+
)
|
|
710
|
+
});
|
|
711
|
+
}
|
|
634
712
|
}
|
|
635
713
|
const dataSource = tbody && tbody.map((row, index) => ({
|
|
636
714
|
...row,
|
|
637
|
-
[columns[0].key]: index + 1
|
|
638
|
-
[columns[-1].key]: "View"
|
|
715
|
+
[columns[0].key]: index + 1
|
|
639
716
|
}));
|
|
640
717
|
const count = dataSource ? dataSource.length : 0;
|
|
641
718
|
const onChangePage = (page, pageSize) => {
|
|
@@ -664,77 +741,48 @@ var TableElement = (props) => {
|
|
|
664
741
|
columns,
|
|
665
742
|
bordered: true,
|
|
666
743
|
rowSelection: rowSelectionConfig,
|
|
667
|
-
size: props.size && props.size
|
|
668
|
-
onRow: (record) => {
|
|
669
|
-
return {
|
|
670
|
-
onClick: () => {
|
|
671
|
-
setSelectedRecord(record);
|
|
672
|
-
handleChange(record);
|
|
673
|
-
setModel(true);
|
|
674
|
-
},
|
|
675
|
-
style: { cursor: "pointer" }
|
|
676
|
-
};
|
|
677
|
-
}
|
|
744
|
+
size: props.size && props.size
|
|
678
745
|
}
|
|
679
746
|
), model && /* @__PURE__ */ React20.createElement(ModelElement, { selectedRecord, ...props, columns, model, onCancel: () => setModel(false) }));
|
|
680
747
|
};
|
|
681
748
|
|
|
682
749
|
// src/Components/DatePicker.tsx
|
|
683
|
-
import React21, { useState as
|
|
750
|
+
import React21, { useState as useState7 } from "react";
|
|
684
751
|
import { DatePicker } from "antd";
|
|
685
|
-
import
|
|
686
|
-
import
|
|
752
|
+
import dayjs from "dayjs";
|
|
753
|
+
import customParseFormat from "dayjs/plugin/customParseFormat.js";
|
|
754
|
+
dayjs.extend(customParseFormat);
|
|
687
755
|
var DatePickerElement = (props) => {
|
|
688
|
-
const [
|
|
689
|
-
const handleChange = (
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
const formattedDate = dateString;
|
|
694
|
-
console.log("formattedDate-----------------", formattedDate);
|
|
695
|
-
setDate(date2);
|
|
696
|
-
console.log("changedDate------------", date2);
|
|
756
|
+
const [dateState, setDateState] = useState7("");
|
|
757
|
+
const handleChange = (date, dateString) => {
|
|
758
|
+
if (date) {
|
|
759
|
+
const formattedDate = date;
|
|
760
|
+
setDateState(date);
|
|
697
761
|
if (props.onChange) {
|
|
698
762
|
props.onChange(formattedDate);
|
|
699
763
|
}
|
|
700
764
|
} else {
|
|
701
|
-
|
|
765
|
+
setDateState("");
|
|
702
766
|
if (props.onChange) {
|
|
703
767
|
props.onChange("");
|
|
704
768
|
}
|
|
705
769
|
}
|
|
706
770
|
};
|
|
707
|
-
|
|
708
|
-
const currentDate = date || moment();
|
|
709
|
-
const newDate = moment(currentDate).subtract(1, "days");
|
|
710
|
-
setDate(newDate);
|
|
711
|
-
if (props.onChange) {
|
|
712
|
-
props.onChange(newDate.format("lll"));
|
|
713
|
-
}
|
|
714
|
-
};
|
|
715
|
-
const onHandleIncrement = () => {
|
|
716
|
-
const currentDate = date || moment();
|
|
717
|
-
const newDate = moment(currentDate).add(1, "days");
|
|
718
|
-
setDate(newDate);
|
|
719
|
-
if (props.onChange) {
|
|
720
|
-
props.onChange(newDate.format("lll"));
|
|
721
|
-
}
|
|
722
|
-
};
|
|
723
|
-
return /* @__PURE__ */ React21.createElement("div", null, /* @__PURE__ */ React21.createElement("button", { onClick: onHandleDecrement }, /* @__PURE__ */ React21.createElement(LeftOutlined, null)), /* @__PURE__ */ React21.createElement(
|
|
771
|
+
return /* @__PURE__ */ React21.createElement("div", null, /* @__PURE__ */ React21.createElement(
|
|
724
772
|
DatePicker,
|
|
725
773
|
{
|
|
726
774
|
placeholder: props.placeholder,
|
|
727
|
-
value:
|
|
728
|
-
|
|
775
|
+
value: dateState,
|
|
776
|
+
format: { format: "DD-MM-YYYY" },
|
|
729
777
|
onChange: handleChange
|
|
730
778
|
}
|
|
731
|
-
)
|
|
779
|
+
));
|
|
732
780
|
};
|
|
733
781
|
|
|
734
782
|
// src/Components/DateRangePickerElement.tsx
|
|
735
783
|
import React22 from "react";
|
|
736
784
|
import { DatePicker as DatePicker2, Space } from "antd";
|
|
737
|
-
import
|
|
785
|
+
import dayjs2 from "dayjs";
|
|
738
786
|
var DateRangePickerElement = (props) => {
|
|
739
787
|
const { RangePicker } = DatePicker2;
|
|
740
788
|
const handleChange = (dates, dateStrings) => {
|
|
@@ -745,10 +793,10 @@ var DateRangePickerElement = (props) => {
|
|
|
745
793
|
}
|
|
746
794
|
};
|
|
747
795
|
const rangePresets = [
|
|
748
|
-
{ label: "Last 7 Days", value: [
|
|
749
|
-
{ label: "Last 14 Days", value: [
|
|
750
|
-
{ label: "Last 30 Days", value: [
|
|
751
|
-
{ label: "Last 90 Days", value: [
|
|
796
|
+
{ label: "Last 7 Days", value: [dayjs2().add(-7, "d"), dayjs2()] },
|
|
797
|
+
{ label: "Last 14 Days", value: [dayjs2().add(-14, "d"), dayjs2()] },
|
|
798
|
+
{ label: "Last 30 Days", value: [dayjs2().add(-30, "d"), dayjs2()] },
|
|
799
|
+
{ label: "Last 90 Days", value: [dayjs2().add(-90, "d"), dayjs2()] }
|
|
752
800
|
];
|
|
753
801
|
return /* @__PURE__ */ React22.createElement(Space, { direction: "vertical", size: 12 }, /* @__PURE__ */ React22.createElement(RangePicker, { presets: rangePresets, onChange: handleChange }));
|
|
754
802
|
};
|
|
@@ -756,7 +804,7 @@ var DateRangePickerElement = (props) => {
|
|
|
756
804
|
// src/Components/Image.tsx
|
|
757
805
|
import React23 from "react";
|
|
758
806
|
var Image = (props) => {
|
|
759
|
-
return /* @__PURE__ */ React23.createElement("
|
|
807
|
+
return /* @__PURE__ */ React23.createElement("img", { className: props.className, src: props.img, alt: "image" });
|
|
760
808
|
};
|
|
761
809
|
|
|
762
810
|
// src/Components/SingleCheckbox.tsx
|
|
@@ -772,36 +820,47 @@ var SingleCheckbox = (props) => {
|
|
|
772
820
|
};
|
|
773
821
|
|
|
774
822
|
// src/Components/DropDownGroup.tsx
|
|
775
|
-
import React25, { useState as
|
|
823
|
+
import React25, { useState as useState8 } from "react";
|
|
776
824
|
import { Select as Select4 } from "antd";
|
|
777
825
|
var DropDownGroup = (props) => {
|
|
778
|
-
const [selectedValue, setSelectedValue] =
|
|
826
|
+
const [selectedValue, setSelectedValue] = useState8({
|
|
827
|
+
firstValue: {},
|
|
828
|
+
secondValue: {},
|
|
829
|
+
temp: ""
|
|
830
|
+
});
|
|
779
831
|
const handleFirstChange = (value) => {
|
|
780
|
-
|
|
832
|
+
console.log(selectedValue.temp);
|
|
833
|
+
const filterOption2 = props.firstOptions?.find(
|
|
834
|
+
(eachOption) => eachOption.value === value
|
|
835
|
+
);
|
|
781
836
|
setSelectedValue((prev) => {
|
|
782
837
|
const newValue = { ...prev, firstValue: filterOption2 };
|
|
838
|
+
const { temp, ...rest } = newValue;
|
|
783
839
|
if (newValue.firstValue) {
|
|
784
|
-
props.onChange?.(
|
|
840
|
+
props.onChange?.(rest);
|
|
785
841
|
}
|
|
786
|
-
return
|
|
842
|
+
return newValue;
|
|
787
843
|
});
|
|
788
844
|
};
|
|
789
845
|
const handleSecondChange = (value) => {
|
|
790
|
-
const filterOption2 = props.
|
|
846
|
+
const filterOption2 = props.secondOptions?.find(
|
|
847
|
+
(eachOption) => eachOption.value === value
|
|
848
|
+
);
|
|
791
849
|
setSelectedValue((prev) => {
|
|
792
850
|
const newValue = { ...prev, secondValue: filterOption2 };
|
|
851
|
+
const { temp, ...rest } = newValue;
|
|
793
852
|
if (newValue.secondValue) {
|
|
794
|
-
props.onChange?.(
|
|
853
|
+
props.onChange?.(rest);
|
|
795
854
|
}
|
|
796
|
-
return
|
|
855
|
+
return newValue;
|
|
797
856
|
});
|
|
798
857
|
};
|
|
799
|
-
return /* @__PURE__ */ React25.createElement("div", { className: props.containerClassName }, /* @__PURE__ */ React25.createElement(
|
|
858
|
+
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(
|
|
800
859
|
Select4,
|
|
801
860
|
{
|
|
802
861
|
onChange: handleFirstChange,
|
|
803
862
|
variant: props.variant,
|
|
804
|
-
options: props.
|
|
863
|
+
options: props.firstOptions,
|
|
805
864
|
className: props.className
|
|
806
865
|
}
|
|
807
866
|
), /* @__PURE__ */ React25.createElement("div", { style: { borderLeft: "1px solid gray", height: "33px" } }), /* @__PURE__ */ React25.createElement(
|
|
@@ -809,27 +868,19 @@ var DropDownGroup = (props) => {
|
|
|
809
868
|
{
|
|
810
869
|
onChange: handleSecondChange,
|
|
811
870
|
variant: props.variant,
|
|
812
|
-
options: props.
|
|
871
|
+
options: props.secondOptions,
|
|
813
872
|
className: props.className
|
|
814
873
|
}
|
|
815
|
-
));
|
|
874
|
+
)));
|
|
816
875
|
};
|
|
817
876
|
|
|
818
877
|
// src/Components/FilesUpload.tsx
|
|
819
|
-
import React26, { useState as
|
|
820
|
-
import { Upload
|
|
878
|
+
import React26, { useState as useState9 } from "react";
|
|
879
|
+
import { Upload } from "antd";
|
|
821
880
|
import { InboxOutlined } from "@ant-design/icons";
|
|
822
881
|
var FileUpload = (props) => {
|
|
823
882
|
const { Dragger } = Upload;
|
|
824
|
-
const [files, setFiles] =
|
|
825
|
-
const beforeUpload = (file) => {
|
|
826
|
-
const isCorrectFile = ["image/png", "image/jpg", "image/jpeg", "application/pdf"].includes(file.type);
|
|
827
|
-
if (!isCorrectFile) {
|
|
828
|
-
message.error(`(${file.name}) is an invalid file. Please upload files with the following extensions only (.png/.jpg/.jpeg/.pdf)`);
|
|
829
|
-
return Upload.LIST_IGNORE;
|
|
830
|
-
}
|
|
831
|
-
return true;
|
|
832
|
-
};
|
|
883
|
+
const [files, setFiles] = useState9([]);
|
|
833
884
|
const handleChange = ({ fileList }) => {
|
|
834
885
|
setFiles(fileList);
|
|
835
886
|
if (props.onChange) {
|
|
@@ -853,7 +904,6 @@ var FileUpload = (props) => {
|
|
|
853
904
|
maxCount: props.max_count,
|
|
854
905
|
multiple: props.multiple,
|
|
855
906
|
fileList: files,
|
|
856
|
-
beforeUpload,
|
|
857
907
|
onChange: handleChange,
|
|
858
908
|
showUploadList: true,
|
|
859
909
|
customRequest
|
|
@@ -874,6 +924,42 @@ var TabsElement = (props) => {
|
|
|
874
924
|
};
|
|
875
925
|
return /* @__PURE__ */ React27.createElement(Tabs, { className: props.containerClassName, items: props.options, onChange: handleChange });
|
|
876
926
|
};
|
|
927
|
+
|
|
928
|
+
// src/Components/SwitchElement.tsx
|
|
929
|
+
import React28 from "react";
|
|
930
|
+
import { Switch } from "antd";
|
|
931
|
+
var onChange = (checked) => {
|
|
932
|
+
console.log(`switch to ${checked}`);
|
|
933
|
+
};
|
|
934
|
+
var SwitchElement = () => /* @__PURE__ */ React28.createElement(Switch, { defaultChecked: true, onChange });
|
|
935
|
+
|
|
936
|
+
// src/Components/Upload.tsx
|
|
937
|
+
import React29, { useState as useState10 } from "react";
|
|
938
|
+
var Upload2 = (props) => {
|
|
939
|
+
const [file, setFile] = useState10();
|
|
940
|
+
const handleFileChange = (e) => {
|
|
941
|
+
setFile(e.target.files[0]);
|
|
942
|
+
if (props.onChange) {
|
|
943
|
+
props.onChange(e.target.files[0]);
|
|
944
|
+
}
|
|
945
|
+
};
|
|
946
|
+
const handleUpload = async () => {
|
|
947
|
+
if (!file) {
|
|
948
|
+
console.error("No file selected");
|
|
949
|
+
return;
|
|
950
|
+
}
|
|
951
|
+
};
|
|
952
|
+
return /* @__PURE__ */ React29.createElement("div", { style: { marginTop: 16 } }, /* @__PURE__ */ React29.createElement("input", { type: "file", onChange: handleFileChange }), /* @__PURE__ */ React29.createElement(
|
|
953
|
+
"button",
|
|
954
|
+
{
|
|
955
|
+
type: "button",
|
|
956
|
+
onClick: handleUpload,
|
|
957
|
+
disabled: !file,
|
|
958
|
+
style: { marginTop: 16 }
|
|
959
|
+
},
|
|
960
|
+
"Upload"
|
|
961
|
+
));
|
|
962
|
+
};
|
|
877
963
|
export {
|
|
878
964
|
AddMoreTable,
|
|
879
965
|
ButtonElement,
|
|
@@ -893,8 +979,10 @@ export {
|
|
|
893
979
|
Sidebar,
|
|
894
980
|
SingleCheckbox,
|
|
895
981
|
SingleSelectElement,
|
|
982
|
+
SwitchElement,
|
|
896
983
|
TableElement,
|
|
897
984
|
TabsElement,
|
|
898
985
|
TextElement,
|
|
899
|
-
TextareaElement
|
|
986
|
+
TextareaElement,
|
|
987
|
+
Upload2 as Upload
|
|
900
988
|
};
|