@apexcura/ui-components 0.0.14-Beta8 → 0.0.14-Beta80
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 +20 -7
- package/dist/index.d.ts +20 -7
- package/dist/index.js +332 -97
- package/dist/index.mjs +339 -108
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -36,22 +36,26 @@ __export(src_exports, {
|
|
|
36
36
|
CkEditor: () => CkEditor,
|
|
37
37
|
DatePickerElement: () => DatePickerElement,
|
|
38
38
|
DateRangePickerElement: () => DateRangePickerElement,
|
|
39
|
+
Donut: () => Donut,
|
|
39
40
|
DropDownGroup: () => DropDownGroup,
|
|
40
41
|
FileUpload: () => FileUpload,
|
|
41
42
|
Image: () => Image,
|
|
42
43
|
MultipleSelectElement: () => MultipleSelectElement,
|
|
43
44
|
Navbar: () => Navbar,
|
|
44
45
|
NumberElement: () => NumberElement,
|
|
46
|
+
OtpElement: () => OtpElement,
|
|
45
47
|
PasswordElement: () => PasswordElement,
|
|
46
48
|
RadioElement: () => RadioElement,
|
|
47
49
|
SelectElement: () => SelectElement,
|
|
48
50
|
Sidebar: () => Sidebar,
|
|
49
51
|
SingleCheckbox: () => SingleCheckbox,
|
|
50
52
|
SingleSelectElement: () => SingleSelectElement,
|
|
53
|
+
SwitchElement: () => SwitchElement,
|
|
51
54
|
TableElement: () => TableElement,
|
|
52
55
|
TabsElement: () => TabsElement,
|
|
53
56
|
TextElement: () => TextElement,
|
|
54
|
-
TextareaElement: () => TextareaElement
|
|
57
|
+
TextareaElement: () => TextareaElement,
|
|
58
|
+
Upload: () => Upload2
|
|
55
59
|
});
|
|
56
60
|
module.exports = __toCommonJS(src_exports);
|
|
57
61
|
|
|
@@ -70,6 +74,7 @@ var TextElement = (props) => {
|
|
|
70
74
|
placeholder: props.placeholder,
|
|
71
75
|
allowClear: true,
|
|
72
76
|
id: props.name,
|
|
77
|
+
value: props.value,
|
|
73
78
|
prefix: props.prefix,
|
|
74
79
|
type: props.type,
|
|
75
80
|
status: props.status,
|
|
@@ -129,8 +134,7 @@ var NumberElement = (props) => {
|
|
|
129
134
|
{
|
|
130
135
|
placeholder: props.placeholder,
|
|
131
136
|
addonBefore: props.addonBefore,
|
|
132
|
-
|
|
133
|
-
defaultValue: props.defaultValue,
|
|
137
|
+
value: props.value,
|
|
134
138
|
disabled: props.disabled,
|
|
135
139
|
id: props.name,
|
|
136
140
|
prefix: props.prefix,
|
|
@@ -375,13 +379,74 @@ var MultipleSelectElement = (props) => {
|
|
|
375
379
|
// src/Components/Button.tsx
|
|
376
380
|
var import_react11 = __toESM(require("react"));
|
|
377
381
|
var ButtonElement = (props) => {
|
|
382
|
+
const [svgContent, setSvgContent] = (0, import_react11.useState)(null);
|
|
383
|
+
const [originalSvgContent, setOriginalSvgContent] = (0, import_react11.useState)(null);
|
|
384
|
+
const [hoverColor, setHoverColor] = (0, import_react11.useState)(null);
|
|
385
|
+
(0, import_react11.useEffect)(() => {
|
|
386
|
+
if (props.icon) {
|
|
387
|
+
fetch(props.icon).then((response) => response.text()).then((data) => {
|
|
388
|
+
const tempDiv = document.createElement("div");
|
|
389
|
+
tempDiv.innerHTML = data;
|
|
390
|
+
const svgElement = tempDiv.querySelector("svg");
|
|
391
|
+
if (svgElement) {
|
|
392
|
+
const textColorClass = props.className?.match(/text-[\w-]+/g)?.[0];
|
|
393
|
+
const hoverColorClass = props.className?.match(/hover:text-[\w-]+/g)?.[0];
|
|
394
|
+
if (textColorClass) {
|
|
395
|
+
const tempSpan = document.createElement("span");
|
|
396
|
+
tempSpan.className = textColorClass;
|
|
397
|
+
document.body.appendChild(tempSpan);
|
|
398
|
+
const computedColor = getComputedStyle(tempSpan).color;
|
|
399
|
+
document.body.removeChild(tempSpan);
|
|
400
|
+
const paths = svgElement.querySelectorAll("path");
|
|
401
|
+
paths.forEach((path) => path.setAttribute("fill", computedColor));
|
|
402
|
+
}
|
|
403
|
+
if (hoverColorClass) {
|
|
404
|
+
const tempSpan = document.createElement("span");
|
|
405
|
+
tempSpan.className = hoverColorClass.replace("hover:", "");
|
|
406
|
+
document.body.appendChild(tempSpan);
|
|
407
|
+
const computedHoverColor = getComputedStyle(tempSpan).color;
|
|
408
|
+
document.body.removeChild(tempSpan);
|
|
409
|
+
setHoverColor(computedHoverColor);
|
|
410
|
+
}
|
|
411
|
+
svgElement.setAttribute(
|
|
412
|
+
"class",
|
|
413
|
+
`${props.iconsClassName ? props.iconsClassName : ""}`
|
|
414
|
+
);
|
|
415
|
+
setSvgContent(tempDiv.innerHTML);
|
|
416
|
+
setOriginalSvgContent(tempDiv.innerHTML);
|
|
417
|
+
}
|
|
418
|
+
}).catch((error) => console.error("Error fetching SVG:", error));
|
|
419
|
+
}
|
|
420
|
+
}, [props.icon, props.className]);
|
|
421
|
+
const handleMouseEnter = () => {
|
|
422
|
+
if (hoverColor && originalSvgContent) {
|
|
423
|
+
const tempDiv = document.createElement("div");
|
|
424
|
+
tempDiv.innerHTML = originalSvgContent;
|
|
425
|
+
const svgElement = tempDiv.querySelector("svg");
|
|
426
|
+
const paths = svgElement?.querySelectorAll("path");
|
|
427
|
+
paths?.forEach((path) => path.setAttribute("fill", hoverColor));
|
|
428
|
+
setSvgContent(tempDiv.innerHTML);
|
|
429
|
+
}
|
|
430
|
+
};
|
|
431
|
+
const handleMouseLeave = () => {
|
|
432
|
+
if (originalSvgContent) {
|
|
433
|
+
setSvgContent(originalSvgContent);
|
|
434
|
+
}
|
|
435
|
+
};
|
|
378
436
|
return /* @__PURE__ */ import_react11.default.createElement(
|
|
379
437
|
"button",
|
|
380
438
|
{
|
|
381
|
-
onClick:
|
|
382
|
-
className: `${props.className ? props.className : ""}
|
|
439
|
+
onClick: props.onClick,
|
|
440
|
+
className: `${props.className ? props.className : ""}`,
|
|
441
|
+
onMouseEnter: handleMouseEnter,
|
|
442
|
+
onMouseLeave: handleMouseLeave
|
|
383
443
|
},
|
|
384
|
-
props.icon && /* @__PURE__ */ import_react11.default.createElement("img", { className: props.iconsClassName, src: props.icon })
|
|
444
|
+
props.isSVGStylesOverride === false ? props.icon && /* @__PURE__ */ import_react11.default.createElement("img", { className: props.iconsClassName, src: props.icon, alt: props.label }) : svgContent && /* @__PURE__ */ import_react11.default.createElement(
|
|
445
|
+
"span",
|
|
446
|
+
{
|
|
447
|
+
dangerouslySetInnerHTML: { __html: svgContent }
|
|
448
|
+
}
|
|
449
|
+
),
|
|
385
450
|
props.label
|
|
386
451
|
);
|
|
387
452
|
};
|
|
@@ -464,9 +529,9 @@ var AddMoreTable = (props) => {
|
|
|
464
529
|
if (!element) return null;
|
|
465
530
|
const { element: type, label } = element;
|
|
466
531
|
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, options1: [], options2: [] });
|
|
532
|
+
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
533
|
} 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, options1: [], options2: [] });
|
|
534
|
+
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
535
|
} else {
|
|
471
536
|
return null;
|
|
472
537
|
}
|
|
@@ -524,10 +589,19 @@ var Sidebar = (props) => {
|
|
|
524
589
|
props.onChange(item);
|
|
525
590
|
}
|
|
526
591
|
};
|
|
527
|
-
return /* @__PURE__ */ import_react13.default.createElement(
|
|
528
|
-
return /* @__PURE__ */ import_react13.default.createElement(
|
|
529
|
-
|
|
530
|
-
|
|
592
|
+
return /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, { key: props.name }, /* @__PURE__ */ import_react13.default.createElement("div", { className: props.imgClassName }, /* @__PURE__ */ import_react13.default.createElement("img", { src: props.img, alt: "logo" })), /* @__PURE__ */ import_react13.default.createElement("div", { className: props.listClassName }, props.items?.map((item) => {
|
|
593
|
+
return /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, { key: item.label }, /* @__PURE__ */ import_react13.default.createElement(
|
|
594
|
+
ButtonElement,
|
|
595
|
+
{
|
|
596
|
+
...item,
|
|
597
|
+
className: item.active ? props.activeClassName : props.className,
|
|
598
|
+
iconsClassName: props.iconsClassName,
|
|
599
|
+
onClick: (e) => {
|
|
600
|
+
e.preventDefault();
|
|
601
|
+
handleChange(item);
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
));
|
|
531
605
|
})));
|
|
532
606
|
};
|
|
533
607
|
|
|
@@ -652,7 +726,6 @@ var TableElement = (props) => {
|
|
|
652
726
|
const { thead, tbody } = props;
|
|
653
727
|
const [selectedRecord, setSelectedRecord] = (0, import_react20.useState)({});
|
|
654
728
|
const [model, setModel] = (0, import_react20.useState)(false);
|
|
655
|
-
const [selectedRowKeys, setSelectedRowKeys] = (0, import_react20.useState)([]);
|
|
656
729
|
const handleChange = (record) => {
|
|
657
730
|
console.log("record", record);
|
|
658
731
|
if (props.onChange) {
|
|
@@ -667,12 +740,6 @@ var TableElement = (props) => {
|
|
|
667
740
|
dataIndex: "#",
|
|
668
741
|
key: "#"
|
|
669
742
|
},
|
|
670
|
-
{
|
|
671
|
-
title: "View",
|
|
672
|
-
dataIndex: "View",
|
|
673
|
-
key: "View",
|
|
674
|
-
render: (_, record) => /* @__PURE__ */ import_react20.default.createElement(import_antd14.Button, null, "View")
|
|
675
|
-
},
|
|
676
743
|
...thead.map((col, ind) => ({
|
|
677
744
|
title: col.label,
|
|
678
745
|
dataIndex: col.name,
|
|
@@ -689,9 +756,28 @@ var TableElement = (props) => {
|
|
|
689
756
|
}
|
|
690
757
|
}))
|
|
691
758
|
];
|
|
759
|
+
if (props.view) {
|
|
760
|
+
columns.push({
|
|
761
|
+
title: "View",
|
|
762
|
+
dataIndex: "View",
|
|
763
|
+
key: "View",
|
|
764
|
+
render: (_, record) => /* @__PURE__ */ import_react20.default.createElement(
|
|
765
|
+
"a",
|
|
766
|
+
{
|
|
767
|
+
onClick: () => {
|
|
768
|
+
setSelectedRecord(record);
|
|
769
|
+
handleChange(record);
|
|
770
|
+
setModel(true);
|
|
771
|
+
}
|
|
772
|
+
},
|
|
773
|
+
"View"
|
|
774
|
+
)
|
|
775
|
+
});
|
|
776
|
+
}
|
|
692
777
|
}
|
|
693
778
|
const dataSource = tbody && tbody.map((row, index) => ({
|
|
694
779
|
...row,
|
|
780
|
+
key: index + 1,
|
|
695
781
|
[columns[0].key]: index + 1
|
|
696
782
|
}));
|
|
697
783
|
const count = dataSource ? dataSource.length : 0;
|
|
@@ -700,38 +786,29 @@ var TableElement = (props) => {
|
|
|
700
786
|
props.onChange({ name: "pagination", page, pageSize });
|
|
701
787
|
}
|
|
702
788
|
};
|
|
703
|
-
const onSelectChange = (newSelectedRowKeys) => {
|
|
704
|
-
console.log("selectedRowKeys changed: ", newSelectedRowKeys);
|
|
705
|
-
setSelectedRowKeys(newSelectedRowKeys);
|
|
706
|
-
};
|
|
707
789
|
const rowSelectionConfig = props.rowSelection ? {
|
|
708
|
-
selectedRowKeys,
|
|
709
|
-
|
|
790
|
+
onChange: (selectedRowKeys, selectedRows) => {
|
|
791
|
+
console.log(`selectedRowKeys: ${selectedRowKeys}`, "selectedRows: ", selectedRows);
|
|
792
|
+
if (props.onChange) {
|
|
793
|
+
props.onChange(selectedRows);
|
|
794
|
+
}
|
|
795
|
+
}
|
|
710
796
|
} : void 0;
|
|
711
797
|
return /* @__PURE__ */ import_react20.default.createElement(import_react20.default.Fragment, null, /* @__PURE__ */ import_react20.default.createElement(
|
|
712
798
|
import_antd14.Table,
|
|
713
799
|
{
|
|
800
|
+
className: props.className,
|
|
714
801
|
pagination: {
|
|
715
802
|
showTotal: (total) => `Total: ${total} items`,
|
|
716
803
|
total: count,
|
|
717
804
|
showSizeChanger: count > 10,
|
|
718
805
|
onChange: onChangePage
|
|
719
806
|
},
|
|
807
|
+
rowSelection: rowSelectionConfig,
|
|
720
808
|
dataSource,
|
|
721
809
|
columns,
|
|
722
|
-
|
|
723
|
-
|
|
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
|
-
}
|
|
810
|
+
size: props.size,
|
|
811
|
+
bordered: true
|
|
735
812
|
}
|
|
736
813
|
), model && /* @__PURE__ */ import_react20.default.createElement(ModelElement, { selectedRecord, ...props, columns, model, onCancel: () => setModel(false) }));
|
|
737
814
|
};
|
|
@@ -739,59 +816,40 @@ var TableElement = (props) => {
|
|
|
739
816
|
// src/Components/DatePicker.tsx
|
|
740
817
|
var import_react21 = __toESM(require("react"));
|
|
741
818
|
var import_antd15 = require("antd");
|
|
742
|
-
var
|
|
743
|
-
var
|
|
819
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
820
|
+
var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat.js"));
|
|
821
|
+
import_dayjs.default.extend(import_customParseFormat.default);
|
|
744
822
|
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);
|
|
823
|
+
const [dateState, setDateState] = (0, import_react21.useState)("");
|
|
824
|
+
const handleChange = (date, dateString) => {
|
|
825
|
+
if (date) {
|
|
826
|
+
const formattedDate = date;
|
|
827
|
+
setDateState(date);
|
|
754
828
|
if (props.onChange) {
|
|
755
829
|
props.onChange(formattedDate);
|
|
756
830
|
}
|
|
757
831
|
} else {
|
|
758
|
-
|
|
832
|
+
setDateState("");
|
|
759
833
|
if (props.onChange) {
|
|
760
834
|
props.onChange("");
|
|
761
835
|
}
|
|
762
836
|
}
|
|
763
837
|
};
|
|
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(
|
|
838
|
+
return /* @__PURE__ */ import_react21.default.createElement("div", null, /* @__PURE__ */ import_react21.default.createElement(
|
|
781
839
|
import_antd15.DatePicker,
|
|
782
840
|
{
|
|
783
841
|
placeholder: props.placeholder,
|
|
784
|
-
value:
|
|
785
|
-
|
|
842
|
+
value: dateState,
|
|
843
|
+
format: { format: "DD-MM-YYYY" },
|
|
786
844
|
onChange: handleChange
|
|
787
845
|
}
|
|
788
|
-
)
|
|
846
|
+
));
|
|
789
847
|
};
|
|
790
848
|
|
|
791
849
|
// src/Components/DateRangePickerElement.tsx
|
|
792
850
|
var import_react22 = __toESM(require("react"));
|
|
793
851
|
var import_antd16 = require("antd");
|
|
794
|
-
var
|
|
852
|
+
var import_dayjs2 = __toESM(require("dayjs"));
|
|
795
853
|
var DateRangePickerElement = (props) => {
|
|
796
854
|
const { RangePicker } = import_antd16.DatePicker;
|
|
797
855
|
const handleChange = (dates, dateStrings) => {
|
|
@@ -802,10 +860,10 @@ var DateRangePickerElement = (props) => {
|
|
|
802
860
|
}
|
|
803
861
|
};
|
|
804
862
|
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,
|
|
863
|
+
{ label: "Last 7 Days", value: [(0, import_dayjs2.default)().add(-7, "d"), (0, import_dayjs2.default)()] },
|
|
864
|
+
{ label: "Last 14 Days", value: [(0, import_dayjs2.default)().add(-14, "d"), (0, import_dayjs2.default)()] },
|
|
865
|
+
{ label: "Last 30 Days", value: [(0, import_dayjs2.default)().add(-30, "d"), (0, import_dayjs2.default)()] },
|
|
866
|
+
{ label: "Last 90 Days", value: [(0, import_dayjs2.default)().add(-90, "d"), (0, import_dayjs2.default)()] }
|
|
809
867
|
];
|
|
810
868
|
return /* @__PURE__ */ import_react22.default.createElement(import_antd16.Space, { direction: "vertical", size: 12 }, /* @__PURE__ */ import_react22.default.createElement(RangePicker, { presets: rangePresets, onChange: handleChange }));
|
|
811
869
|
};
|
|
@@ -813,7 +871,7 @@ var DateRangePickerElement = (props) => {
|
|
|
813
871
|
// src/Components/Image.tsx
|
|
814
872
|
var import_react23 = __toESM(require("react"));
|
|
815
873
|
var Image = (props) => {
|
|
816
|
-
return /* @__PURE__ */ import_react23.default.createElement("
|
|
874
|
+
return /* @__PURE__ */ import_react23.default.createElement("img", { className: props.className, src: props.img, alt: "image" });
|
|
817
875
|
};
|
|
818
876
|
|
|
819
877
|
// src/Components/SingleCheckbox.tsx
|
|
@@ -834,30 +892,34 @@ var import_antd18 = require("antd");
|
|
|
834
892
|
var DropDownGroup = (props) => {
|
|
835
893
|
const [selectedValue, setSelectedValue] = (0, import_react25.useState)({
|
|
836
894
|
firstValue: {},
|
|
837
|
-
secondValue: {}
|
|
895
|
+
secondValue: {},
|
|
896
|
+
temp: ""
|
|
838
897
|
});
|
|
839
898
|
const handleFirstChange = (value) => {
|
|
840
|
-
|
|
899
|
+
console.log(selectedValue.temp);
|
|
900
|
+
const filterOption2 = props.firstOptions?.find(
|
|
841
901
|
(eachOption) => eachOption.value === value
|
|
842
902
|
);
|
|
843
903
|
setSelectedValue((prev) => {
|
|
844
904
|
const newValue = { ...prev, firstValue: filterOption2 };
|
|
905
|
+
const { temp, ...rest } = newValue;
|
|
845
906
|
if (newValue.firstValue) {
|
|
846
|
-
props.onChange?.(
|
|
907
|
+
props.onChange?.(rest);
|
|
847
908
|
}
|
|
848
|
-
return
|
|
909
|
+
return newValue;
|
|
849
910
|
});
|
|
850
911
|
};
|
|
851
912
|
const handleSecondChange = (value) => {
|
|
852
|
-
const filterOption2 = props.
|
|
913
|
+
const filterOption2 = props.secondOptions?.find(
|
|
853
914
|
(eachOption) => eachOption.value === value
|
|
854
915
|
);
|
|
855
916
|
setSelectedValue((prev) => {
|
|
856
917
|
const newValue = { ...prev, secondValue: filterOption2 };
|
|
918
|
+
const { temp, ...rest } = newValue;
|
|
857
919
|
if (newValue.secondValue) {
|
|
858
|
-
props.onChange?.(
|
|
920
|
+
props.onChange?.(rest);
|
|
859
921
|
}
|
|
860
|
-
return
|
|
922
|
+
return newValue;
|
|
861
923
|
});
|
|
862
924
|
};
|
|
863
925
|
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(
|
|
@@ -865,7 +927,7 @@ var DropDownGroup = (props) => {
|
|
|
865
927
|
{
|
|
866
928
|
onChange: handleFirstChange,
|
|
867
929
|
variant: props.variant,
|
|
868
|
-
options: props.
|
|
930
|
+
options: props.firstOptions,
|
|
869
931
|
className: props.className
|
|
870
932
|
}
|
|
871
933
|
), /* @__PURE__ */ import_react25.default.createElement("div", { style: { borderLeft: "1px solid gray", height: "33px" } }), /* @__PURE__ */ import_react25.default.createElement(
|
|
@@ -873,7 +935,7 @@ var DropDownGroup = (props) => {
|
|
|
873
935
|
{
|
|
874
936
|
onChange: handleSecondChange,
|
|
875
937
|
variant: props.variant,
|
|
876
|
-
options: props.
|
|
938
|
+
options: props.secondOptions,
|
|
877
939
|
className: props.className
|
|
878
940
|
}
|
|
879
941
|
)));
|
|
@@ -882,18 +944,10 @@ var DropDownGroup = (props) => {
|
|
|
882
944
|
// src/Components/FilesUpload.tsx
|
|
883
945
|
var import_react26 = __toESM(require("react"));
|
|
884
946
|
var import_antd19 = require("antd");
|
|
885
|
-
var
|
|
947
|
+
var import_icons4 = require("@ant-design/icons");
|
|
886
948
|
var FileUpload = (props) => {
|
|
887
949
|
const { Dragger } = import_antd19.Upload;
|
|
888
950
|
const [files, setFiles] = (0, import_react26.useState)([]);
|
|
889
|
-
const beforeUpload = (file) => {
|
|
890
|
-
const isCorrectFile = ["image/png", "image/jpg", "image/jpeg", "application/pdf"].includes(file.type);
|
|
891
|
-
if (!isCorrectFile) {
|
|
892
|
-
import_antd19.message.error(`(${file.name}) is an invalid file. Please upload files with the following extensions only (.png/.jpg/.jpeg/.pdf)`);
|
|
893
|
-
return import_antd19.Upload.LIST_IGNORE;
|
|
894
|
-
}
|
|
895
|
-
return true;
|
|
896
|
-
};
|
|
897
951
|
const handleChange = ({ fileList }) => {
|
|
898
952
|
setFiles(fileList);
|
|
899
953
|
if (props.onChange) {
|
|
@@ -917,12 +971,11 @@ var FileUpload = (props) => {
|
|
|
917
971
|
maxCount: props.max_count,
|
|
918
972
|
multiple: props.multiple,
|
|
919
973
|
fileList: files,
|
|
920
|
-
beforeUpload,
|
|
921
974
|
onChange: handleChange,
|
|
922
975
|
showUploadList: true,
|
|
923
976
|
customRequest
|
|
924
977
|
},
|
|
925
|
-
/* @__PURE__ */ import_react26.default.createElement("p", null, /* @__PURE__ */ import_react26.default.createElement(
|
|
978
|
+
/* @__PURE__ */ import_react26.default.createElement("p", null, /* @__PURE__ */ import_react26.default.createElement(import_icons4.InboxOutlined, null)),
|
|
926
979
|
/* @__PURE__ */ import_react26.default.createElement("p", null, "Click or drag file to upload")
|
|
927
980
|
));
|
|
928
981
|
};
|
|
@@ -938,6 +991,184 @@ var TabsElement = (props) => {
|
|
|
938
991
|
};
|
|
939
992
|
return /* @__PURE__ */ import_react27.default.createElement(import_antd20.Tabs, { className: props.containerClassName, items: props.options, onChange: handleChange });
|
|
940
993
|
};
|
|
994
|
+
|
|
995
|
+
// src/Components/SwitchElement.tsx
|
|
996
|
+
var import_react28 = __toESM(require("react"));
|
|
997
|
+
var import_antd21 = require("antd");
|
|
998
|
+
var onChange = (checked) => {
|
|
999
|
+
console.log(`switch to ${checked}`);
|
|
1000
|
+
};
|
|
1001
|
+
var SwitchElement = () => /* @__PURE__ */ import_react28.default.createElement(import_antd21.Switch, { defaultChecked: true, onChange });
|
|
1002
|
+
|
|
1003
|
+
// src/Components/Upload.tsx
|
|
1004
|
+
var import_react29 = __toESM(require("react"));
|
|
1005
|
+
var Upload2 = (props) => {
|
|
1006
|
+
const [file, setFile] = (0, import_react29.useState)();
|
|
1007
|
+
const handleFileChange = (e) => {
|
|
1008
|
+
setFile(e.target.files[0]);
|
|
1009
|
+
if (props.onChange) {
|
|
1010
|
+
props.onChange(e.target.files[0]);
|
|
1011
|
+
}
|
|
1012
|
+
};
|
|
1013
|
+
const handleUpload = async () => {
|
|
1014
|
+
if (!file) {
|
|
1015
|
+
console.error("No file selected");
|
|
1016
|
+
return;
|
|
1017
|
+
}
|
|
1018
|
+
};
|
|
1019
|
+
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(
|
|
1020
|
+
"button",
|
|
1021
|
+
{
|
|
1022
|
+
type: "button",
|
|
1023
|
+
onClick: handleUpload,
|
|
1024
|
+
disabled: !file,
|
|
1025
|
+
style: { marginTop: 16 }
|
|
1026
|
+
},
|
|
1027
|
+
"Upload"
|
|
1028
|
+
));
|
|
1029
|
+
};
|
|
1030
|
+
|
|
1031
|
+
// src/Components/OtpElement.tsx
|
|
1032
|
+
var import_react30 = __toESM(require("react"));
|
|
1033
|
+
var import_antd22 = require("antd");
|
|
1034
|
+
var OtpElement = (props) => {
|
|
1035
|
+
const length = props.length;
|
|
1036
|
+
const [otp, setOtp] = (0, import_react30.useState)(Array(length).fill(""));
|
|
1037
|
+
const inputRefs = (0, import_react30.useRef)([]);
|
|
1038
|
+
const handleChange = (e, index) => {
|
|
1039
|
+
const value = e.target.value;
|
|
1040
|
+
if (/^[0-9]$/.test(value) || value === "") {
|
|
1041
|
+
const newOtp = [...otp];
|
|
1042
|
+
newOtp[index] = value;
|
|
1043
|
+
setOtp(newOtp);
|
|
1044
|
+
props.onChange && props.onChange(newOtp.join(""));
|
|
1045
|
+
if (value && index < length - 1) {
|
|
1046
|
+
inputRefs.current[index + 1]?.focus();
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
};
|
|
1050
|
+
const handleKeyDown = (e, index) => {
|
|
1051
|
+
if (e.key === "Backspace" && !otp[index] && index > 0) {
|
|
1052
|
+
inputRefs.current[index - 1]?.focus();
|
|
1053
|
+
}
|
|
1054
|
+
};
|
|
1055
|
+
const handlePaste = (e) => {
|
|
1056
|
+
e.preventDefault();
|
|
1057
|
+
const pasteData = e.clipboardData.getData("text");
|
|
1058
|
+
if (/^\d+$/.test(pasteData)) {
|
|
1059
|
+
const newOtp = pasteData.split("").slice(0, length);
|
|
1060
|
+
setOtp(newOtp.concat(Array(length - newOtp.length).fill("")));
|
|
1061
|
+
props.onChange && props.onChange(newOtp.join(""));
|
|
1062
|
+
newOtp.forEach((_, idx) => {
|
|
1063
|
+
if (inputRefs.current[idx]) {
|
|
1064
|
+
inputRefs.current[idx]?.focus();
|
|
1065
|
+
}
|
|
1066
|
+
});
|
|
1067
|
+
}
|
|
1068
|
+
};
|
|
1069
|
+
(0, import_react30.useEffect)(() => {
|
|
1070
|
+
inputRefs.current[0]?.focus();
|
|
1071
|
+
}, []);
|
|
1072
|
+
return /* @__PURE__ */ import_react30.default.createElement("div", { className: props.containerClassName }, Array.from({ length }).map((_, index) => /* @__PURE__ */ import_react30.default.createElement(
|
|
1073
|
+
import_antd22.Input,
|
|
1074
|
+
{
|
|
1075
|
+
key: index,
|
|
1076
|
+
className: props.className,
|
|
1077
|
+
maxLength: 1,
|
|
1078
|
+
value: otp[index],
|
|
1079
|
+
onChange: (e) => handleChange(e, index),
|
|
1080
|
+
onKeyDown: (e) => handleKeyDown(e, index),
|
|
1081
|
+
onPaste: handlePaste,
|
|
1082
|
+
ref: (el) => inputRefs.current[index] = el
|
|
1083
|
+
}
|
|
1084
|
+
)));
|
|
1085
|
+
};
|
|
1086
|
+
|
|
1087
|
+
// src/Components/Donut.tsx
|
|
1088
|
+
var import_react31 = __toESM(require("react"));
|
|
1089
|
+
var import_highcharts = __toESM(require("highcharts"));
|
|
1090
|
+
var import_highcharts_react_official = __toESM(require("highcharts-react-official"));
|
|
1091
|
+
var Donut = (props) => {
|
|
1092
|
+
console.log(props);
|
|
1093
|
+
const girlsPercentage = 20;
|
|
1094
|
+
const chartOptions = {
|
|
1095
|
+
chart: {
|
|
1096
|
+
type: "pie",
|
|
1097
|
+
events: {
|
|
1098
|
+
render: function() {
|
|
1099
|
+
const chart = this;
|
|
1100
|
+
const width = chart.plotWidth;
|
|
1101
|
+
const height = chart.plotHeight;
|
|
1102
|
+
const centerX = chart.plotLeft + width / 2;
|
|
1103
|
+
const centerY = chart.plotTop + height / 2;
|
|
1104
|
+
if (!chart.customText) {
|
|
1105
|
+
chart.customText = chart.renderer.text(`Girls ${girlsPercentage.toFixed(1)}%`, centerX, centerY).attr({
|
|
1106
|
+
align: "center",
|
|
1107
|
+
zIndex: 5
|
|
1108
|
+
}).add();
|
|
1109
|
+
} else {
|
|
1110
|
+
chart.customText.attr({
|
|
1111
|
+
text: `${girlsPercentage.toFixed(1)}%`
|
|
1112
|
+
});
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
},
|
|
1117
|
+
title: {
|
|
1118
|
+
text: "Distribution of Students"
|
|
1119
|
+
},
|
|
1120
|
+
plotOptions: {
|
|
1121
|
+
pie: {
|
|
1122
|
+
innerSize: "70%",
|
|
1123
|
+
dataLabels: {
|
|
1124
|
+
enabled: false,
|
|
1125
|
+
format: "<b>{point.name}</b>: {point.percentage:.1f} %"
|
|
1126
|
+
},
|
|
1127
|
+
showInLegend: true
|
|
1128
|
+
}
|
|
1129
|
+
},
|
|
1130
|
+
series: [
|
|
1131
|
+
{
|
|
1132
|
+
type: "pie",
|
|
1133
|
+
name: "Percentage",
|
|
1134
|
+
data: [
|
|
1135
|
+
{
|
|
1136
|
+
name: "Girls",
|
|
1137
|
+
y: 20,
|
|
1138
|
+
color: "#FF6384"
|
|
1139
|
+
// Custom color for Girls
|
|
1140
|
+
},
|
|
1141
|
+
{
|
|
1142
|
+
name: "Boys",
|
|
1143
|
+
y: 40,
|
|
1144
|
+
color: "#36A2EB"
|
|
1145
|
+
// Custom color for Boys
|
|
1146
|
+
},
|
|
1147
|
+
{
|
|
1148
|
+
name: "Students",
|
|
1149
|
+
y: 40,
|
|
1150
|
+
color: "#FFCE56"
|
|
1151
|
+
// Custom color for Students
|
|
1152
|
+
}
|
|
1153
|
+
]
|
|
1154
|
+
}
|
|
1155
|
+
],
|
|
1156
|
+
// tooltip: {
|
|
1157
|
+
// // pointFormat: '<span style="color:{point.color}">\u25CF</span> {series.name}: <b>{point.y:.1f}%</b><br/>'
|
|
1158
|
+
// },
|
|
1159
|
+
legend: {
|
|
1160
|
+
enabled: true,
|
|
1161
|
+
align: "left",
|
|
1162
|
+
verticalAlign: "middle",
|
|
1163
|
+
layout: "vertical",
|
|
1164
|
+
labelFormatter: function() {
|
|
1165
|
+
const point = this;
|
|
1166
|
+
return `${point.name}: ${point.y?.toFixed(1)}%`;
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
};
|
|
1170
|
+
return /* @__PURE__ */ import_react31.default.createElement(import_react31.default.Fragment, null, /* @__PURE__ */ import_react31.default.createElement(import_highcharts_react_official.default, { highcharts: import_highcharts.default, options: chartOptions }));
|
|
1171
|
+
};
|
|
941
1172
|
// Annotate the CommonJS export names for ESM import in node:
|
|
942
1173
|
0 && (module.exports = {
|
|
943
1174
|
AddMoreTable,
|
|
@@ -946,20 +1177,24 @@ var TabsElement = (props) => {
|
|
|
946
1177
|
CkEditor,
|
|
947
1178
|
DatePickerElement,
|
|
948
1179
|
DateRangePickerElement,
|
|
1180
|
+
Donut,
|
|
949
1181
|
DropDownGroup,
|
|
950
1182
|
FileUpload,
|
|
951
1183
|
Image,
|
|
952
1184
|
MultipleSelectElement,
|
|
953
1185
|
Navbar,
|
|
954
1186
|
NumberElement,
|
|
1187
|
+
OtpElement,
|
|
955
1188
|
PasswordElement,
|
|
956
1189
|
RadioElement,
|
|
957
1190
|
SelectElement,
|
|
958
1191
|
Sidebar,
|
|
959
1192
|
SingleCheckbox,
|
|
960
1193
|
SingleSelectElement,
|
|
1194
|
+
SwitchElement,
|
|
961
1195
|
TableElement,
|
|
962
1196
|
TabsElement,
|
|
963
1197
|
TextElement,
|
|
964
|
-
TextareaElement
|
|
1198
|
+
TextareaElement,
|
|
1199
|
+
Upload
|
|
965
1200
|
});
|