@apexcura/ui-components 0.0.13-Beta101 → 0.0.13-Beta103
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 +29 -0
- package/dist/index.d.mts +21 -5
- package/dist/index.d.ts +21 -5
- package/dist/index.js +316 -95
- package/dist/index.mjs +321 -104
- 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,
|
|
@@ -182,7 +186,7 @@ var import_react5 = __toESM(require("react"));
|
|
|
182
186
|
var import_antd5 = require("antd");
|
|
183
187
|
var SelectElement = (props) => {
|
|
184
188
|
const handleChange = (value) => {
|
|
185
|
-
console.log("
|
|
189
|
+
console.log("++=====", typeof value);
|
|
186
190
|
if (props.onChange) {
|
|
187
191
|
if (typeof value === "string") {
|
|
188
192
|
const filterOption2 = props.options && props.options.find((eachOption) => eachOption.value === value);
|
|
@@ -375,14 +379,75 @@ 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,
|
|
443
|
+
disabled: props.isLoading
|
|
383
444
|
},
|
|
384
|
-
props.icon && /* @__PURE__ */ import_react11.default.createElement("img", { className: props.iconsClassName, src: props.icon })
|
|
385
|
-
|
|
445
|
+
props.isLoading ? /* @__PURE__ */ import_react11.default.createElement(import_react11.default.Fragment, null, /* @__PURE__ */ import_react11.default.createElement("svg", { className: "animate-spin h-5 w-5 mr-3", viewBox: "0 0 24 24" }, /* @__PURE__ */ import_react11.default.createElement("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }), /* @__PURE__ */ import_react11.default.createElement("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8v8H4z" })), props.label) : /* @__PURE__ */ import_react11.default.createElement(import_react11.default.Fragment, null, 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(
|
|
446
|
+
"span",
|
|
447
|
+
{
|
|
448
|
+
dangerouslySetInnerHTML: { __html: svgContent }
|
|
449
|
+
}
|
|
450
|
+
), props.label)
|
|
386
451
|
);
|
|
387
452
|
};
|
|
388
453
|
|
|
@@ -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 });
|
|
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 });
|
|
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: `${props.className} ${item.active ? props.activeClassName : ""}`,
|
|
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) {
|
|
@@ -665,12 +738,14 @@ var TableElement = (props) => {
|
|
|
665
738
|
{
|
|
666
739
|
title: "#",
|
|
667
740
|
dataIndex: "#",
|
|
668
|
-
key: "#"
|
|
741
|
+
key: "#",
|
|
742
|
+
fixed: "left"
|
|
669
743
|
},
|
|
670
744
|
...thead.map((col, ind) => ({
|
|
671
745
|
title: col.label,
|
|
672
746
|
dataIndex: col.name,
|
|
673
747
|
key: col.key,
|
|
748
|
+
ellipsis: col.ellipsis,
|
|
674
749
|
render: col.render,
|
|
675
750
|
sorter: {
|
|
676
751
|
compare: (a, b) => {
|
|
@@ -683,9 +758,28 @@ var TableElement = (props) => {
|
|
|
683
758
|
}
|
|
684
759
|
}))
|
|
685
760
|
];
|
|
761
|
+
if (props.view) {
|
|
762
|
+
columns.push({
|
|
763
|
+
title: "View",
|
|
764
|
+
dataIndex: "View",
|
|
765
|
+
key: "View",
|
|
766
|
+
render: (_, record) => /* @__PURE__ */ import_react20.default.createElement(
|
|
767
|
+
"a",
|
|
768
|
+
{
|
|
769
|
+
onClick: () => {
|
|
770
|
+
setSelectedRecord(record);
|
|
771
|
+
handleChange(record);
|
|
772
|
+
setModel(true);
|
|
773
|
+
}
|
|
774
|
+
},
|
|
775
|
+
"View"
|
|
776
|
+
)
|
|
777
|
+
});
|
|
778
|
+
}
|
|
686
779
|
}
|
|
687
780
|
const dataSource = tbody && tbody.map((row, index) => ({
|
|
688
781
|
...row,
|
|
782
|
+
key: index + 1,
|
|
689
783
|
[columns[0].key]: index + 1
|
|
690
784
|
}));
|
|
691
785
|
const count = dataSource ? dataSource.length : 0;
|
|
@@ -694,38 +788,30 @@ var TableElement = (props) => {
|
|
|
694
788
|
props.onChange({ name: "pagination", page, pageSize });
|
|
695
789
|
}
|
|
696
790
|
};
|
|
697
|
-
const onSelectChange = (newSelectedRowKeys) => {
|
|
698
|
-
console.log("selectedRowKeys changed: ", newSelectedRowKeys);
|
|
699
|
-
setSelectedRowKeys(newSelectedRowKeys);
|
|
700
|
-
};
|
|
701
791
|
const rowSelectionConfig = props.rowSelection ? {
|
|
702
|
-
selectedRowKeys,
|
|
703
|
-
|
|
792
|
+
onChange: (selectedRowKeys, selectedRows) => {
|
|
793
|
+
console.log(`selectedRowKeys: ${selectedRowKeys}`, "selectedRows: ", selectedRows);
|
|
794
|
+
if (props.onChange) {
|
|
795
|
+
props.onChange(selectedRows);
|
|
796
|
+
}
|
|
797
|
+
}
|
|
704
798
|
} : void 0;
|
|
705
799
|
return /* @__PURE__ */ import_react20.default.createElement(import_react20.default.Fragment, null, /* @__PURE__ */ import_react20.default.createElement(
|
|
706
800
|
import_antd14.Table,
|
|
707
801
|
{
|
|
802
|
+
className: props.className,
|
|
708
803
|
pagination: {
|
|
709
804
|
showTotal: (total) => `Total: ${total} items`,
|
|
710
805
|
total: count,
|
|
711
806
|
showSizeChanger: count > 10,
|
|
712
807
|
onChange: onChangePage
|
|
713
808
|
},
|
|
809
|
+
rowSelection: rowSelectionConfig,
|
|
714
810
|
dataSource,
|
|
715
811
|
columns,
|
|
812
|
+
size: props.size,
|
|
716
813
|
bordered: true,
|
|
717
|
-
|
|
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
|
-
}
|
|
814
|
+
scroll: { x: 1300 }
|
|
729
815
|
}
|
|
730
816
|
), model && /* @__PURE__ */ import_react20.default.createElement(ModelElement, { selectedRecord, ...props, columns, model, onCancel: () => setModel(false) }));
|
|
731
817
|
};
|
|
@@ -733,59 +819,40 @@ var TableElement = (props) => {
|
|
|
733
819
|
// src/Components/DatePicker.tsx
|
|
734
820
|
var import_react21 = __toESM(require("react"));
|
|
735
821
|
var import_antd15 = require("antd");
|
|
736
|
-
var
|
|
737
|
-
var
|
|
822
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
823
|
+
var import_customParseFormat = __toESM(require("dayjs/plugin/customParseFormat.js"));
|
|
824
|
+
import_dayjs.default.extend(import_customParseFormat.default);
|
|
738
825
|
var DatePickerElement = (props) => {
|
|
739
|
-
const [
|
|
740
|
-
const handleChange = (
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
const formattedDate = dateString;
|
|
745
|
-
console.log("formattedDate-----------------", formattedDate);
|
|
746
|
-
setDate(date2);
|
|
747
|
-
console.log("changedDate------------", date2);
|
|
826
|
+
const [dateState, setDateState] = (0, import_react21.useState)("");
|
|
827
|
+
const handleChange = (date, dateString) => {
|
|
828
|
+
if (date) {
|
|
829
|
+
const formattedDate = date;
|
|
830
|
+
setDateState(date);
|
|
748
831
|
if (props.onChange) {
|
|
749
832
|
props.onChange(formattedDate);
|
|
750
833
|
}
|
|
751
834
|
} else {
|
|
752
|
-
|
|
835
|
+
setDateState("");
|
|
753
836
|
if (props.onChange) {
|
|
754
837
|
props.onChange("");
|
|
755
838
|
}
|
|
756
839
|
}
|
|
757
840
|
};
|
|
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(
|
|
841
|
+
return /* @__PURE__ */ import_react21.default.createElement("div", null, /* @__PURE__ */ import_react21.default.createElement(
|
|
775
842
|
import_antd15.DatePicker,
|
|
776
843
|
{
|
|
777
844
|
placeholder: props.placeholder,
|
|
778
|
-
value:
|
|
779
|
-
|
|
845
|
+
value: dateState,
|
|
846
|
+
format: { format: "DD-MM-YYYY" },
|
|
780
847
|
onChange: handleChange
|
|
781
848
|
}
|
|
782
|
-
)
|
|
849
|
+
));
|
|
783
850
|
};
|
|
784
851
|
|
|
785
852
|
// src/Components/DateRangePickerElement.tsx
|
|
786
853
|
var import_react22 = __toESM(require("react"));
|
|
787
854
|
var import_antd16 = require("antd");
|
|
788
|
-
var
|
|
855
|
+
var import_dayjs2 = __toESM(require("dayjs"));
|
|
789
856
|
var DateRangePickerElement = (props) => {
|
|
790
857
|
const { RangePicker } = import_antd16.DatePicker;
|
|
791
858
|
const handleChange = (dates, dateStrings) => {
|
|
@@ -796,10 +863,10 @@ var DateRangePickerElement = (props) => {
|
|
|
796
863
|
}
|
|
797
864
|
};
|
|
798
865
|
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,
|
|
866
|
+
{ label: "Last 7 Days", value: [(0, import_dayjs2.default)().add(-7, "d"), (0, import_dayjs2.default)()] },
|
|
867
|
+
{ label: "Last 14 Days", value: [(0, import_dayjs2.default)().add(-14, "d"), (0, import_dayjs2.default)()] },
|
|
868
|
+
{ label: "Last 30 Days", value: [(0, import_dayjs2.default)().add(-30, "d"), (0, import_dayjs2.default)()] },
|
|
869
|
+
{ label: "Last 90 Days", value: [(0, import_dayjs2.default)().add(-90, "d"), (0, import_dayjs2.default)()] }
|
|
803
870
|
];
|
|
804
871
|
return /* @__PURE__ */ import_react22.default.createElement(import_antd16.Space, { direction: "vertical", size: 12 }, /* @__PURE__ */ import_react22.default.createElement(RangePicker, { presets: rangePresets, onChange: handleChange }));
|
|
805
872
|
};
|
|
@@ -807,7 +874,7 @@ var DateRangePickerElement = (props) => {
|
|
|
807
874
|
// src/Components/Image.tsx
|
|
808
875
|
var import_react23 = __toESM(require("react"));
|
|
809
876
|
var Image = (props) => {
|
|
810
|
-
return /* @__PURE__ */ import_react23.default.createElement("
|
|
877
|
+
return /* @__PURE__ */ import_react23.default.createElement("img", { className: props.className, src: props.img, alt: "image" });
|
|
811
878
|
};
|
|
812
879
|
|
|
813
880
|
// src/Components/SingleCheckbox.tsx
|
|
@@ -826,59 +893,64 @@ var SingleCheckbox = (props) => {
|
|
|
826
893
|
var import_react25 = __toESM(require("react"));
|
|
827
894
|
var import_antd18 = require("antd");
|
|
828
895
|
var DropDownGroup = (props) => {
|
|
829
|
-
const [selectedValue, setSelectedValue] = (0, import_react25.useState)({
|
|
896
|
+
const [selectedValue, setSelectedValue] = (0, import_react25.useState)({
|
|
897
|
+
firstValue: {},
|
|
898
|
+
secondValue: {},
|
|
899
|
+
temp: ""
|
|
900
|
+
});
|
|
830
901
|
const handleFirstChange = (value) => {
|
|
831
|
-
|
|
902
|
+
console.log(selectedValue.temp);
|
|
903
|
+
const filterOption2 = props.firstOptions?.find(
|
|
904
|
+
(eachOption) => eachOption.value === value
|
|
905
|
+
);
|
|
832
906
|
setSelectedValue((prev) => {
|
|
833
907
|
const newValue = { ...prev, firstValue: filterOption2 };
|
|
908
|
+
const { temp, ...rest } = newValue;
|
|
834
909
|
if (newValue.firstValue) {
|
|
835
|
-
props.onChange?.(
|
|
910
|
+
props.onChange?.(rest);
|
|
836
911
|
}
|
|
837
|
-
return
|
|
912
|
+
return newValue;
|
|
838
913
|
});
|
|
839
914
|
};
|
|
840
915
|
const handleSecondChange = (value) => {
|
|
841
|
-
const filterOption2 = props.
|
|
916
|
+
const filterOption2 = props.secondOptions?.find(
|
|
917
|
+
(eachOption) => eachOption.value === value
|
|
918
|
+
);
|
|
842
919
|
setSelectedValue((prev) => {
|
|
843
920
|
const newValue = { ...prev, secondValue: filterOption2 };
|
|
921
|
+
const { temp, ...rest } = newValue;
|
|
844
922
|
if (newValue.secondValue) {
|
|
845
|
-
props.onChange?.(
|
|
923
|
+
props.onChange?.(rest);
|
|
846
924
|
}
|
|
847
|
-
return
|
|
925
|
+
return newValue;
|
|
848
926
|
});
|
|
849
927
|
};
|
|
850
|
-
return /* @__PURE__ */ import_react25.default.createElement("div", { className: props.
|
|
928
|
+
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
929
|
import_antd18.Select,
|
|
852
930
|
{
|
|
853
931
|
onChange: handleFirstChange,
|
|
854
932
|
variant: props.variant,
|
|
855
|
-
options: props.
|
|
933
|
+
options: props.firstOptions,
|
|
934
|
+
className: props.className
|
|
856
935
|
}
|
|
857
936
|
), /* @__PURE__ */ import_react25.default.createElement("div", { style: { borderLeft: "1px solid gray", height: "33px" } }), /* @__PURE__ */ import_react25.default.createElement(
|
|
858
937
|
import_antd18.Select,
|
|
859
938
|
{
|
|
860
939
|
onChange: handleSecondChange,
|
|
861
940
|
variant: props.variant,
|
|
862
|
-
options: props.
|
|
941
|
+
options: props.secondOptions,
|
|
942
|
+
className: props.className
|
|
863
943
|
}
|
|
864
|
-
));
|
|
944
|
+
)));
|
|
865
945
|
};
|
|
866
946
|
|
|
867
947
|
// src/Components/FilesUpload.tsx
|
|
868
948
|
var import_react26 = __toESM(require("react"));
|
|
869
949
|
var import_antd19 = require("antd");
|
|
870
|
-
var
|
|
950
|
+
var import_icons4 = require("@ant-design/icons");
|
|
871
951
|
var FileUpload = (props) => {
|
|
872
952
|
const { Dragger } = import_antd19.Upload;
|
|
873
953
|
const [files, setFiles] = (0, import_react26.useState)([]);
|
|
874
|
-
const beforeUpload = (file) => {
|
|
875
|
-
const isCorrectFile = ["image/png", "image/jpg", "image/jpeg", "application/pdf"].includes(file.type);
|
|
876
|
-
if (!isCorrectFile) {
|
|
877
|
-
import_antd19.message.error(`(${file.name}) is an invalid file. Please upload files with the following extensions only (.png/.jpg/.jpeg/.pdf)`);
|
|
878
|
-
return import_antd19.Upload.LIST_IGNORE;
|
|
879
|
-
}
|
|
880
|
-
return true;
|
|
881
|
-
};
|
|
882
954
|
const handleChange = ({ fileList }) => {
|
|
883
955
|
setFiles(fileList);
|
|
884
956
|
if (props.onChange) {
|
|
@@ -902,12 +974,11 @@ var FileUpload = (props) => {
|
|
|
902
974
|
maxCount: props.max_count,
|
|
903
975
|
multiple: props.multiple,
|
|
904
976
|
fileList: files,
|
|
905
|
-
beforeUpload,
|
|
906
977
|
onChange: handleChange,
|
|
907
978
|
showUploadList: true,
|
|
908
979
|
customRequest
|
|
909
980
|
},
|
|
910
|
-
/* @__PURE__ */ import_react26.default.createElement("p", null, /* @__PURE__ */ import_react26.default.createElement(
|
|
981
|
+
/* @__PURE__ */ import_react26.default.createElement("p", null, /* @__PURE__ */ import_react26.default.createElement(import_icons4.InboxOutlined, null)),
|
|
911
982
|
/* @__PURE__ */ import_react26.default.createElement("p", null, "Click or drag file to upload")
|
|
912
983
|
));
|
|
913
984
|
};
|
|
@@ -923,6 +994,152 @@ var TabsElement = (props) => {
|
|
|
923
994
|
};
|
|
924
995
|
return /* @__PURE__ */ import_react27.default.createElement(import_antd20.Tabs, { className: props.containerClassName, items: props.options, onChange: handleChange });
|
|
925
996
|
};
|
|
997
|
+
|
|
998
|
+
// src/Components/SwitchElement.tsx
|
|
999
|
+
var import_react28 = __toESM(require("react"));
|
|
1000
|
+
var import_antd21 = require("antd");
|
|
1001
|
+
var onChange = (checked) => {
|
|
1002
|
+
console.log(`switch to ${checked}`);
|
|
1003
|
+
};
|
|
1004
|
+
var SwitchElement = () => /* @__PURE__ */ import_react28.default.createElement(import_antd21.Switch, { defaultChecked: true, onChange });
|
|
1005
|
+
|
|
1006
|
+
// src/Components/Upload.tsx
|
|
1007
|
+
var import_react29 = __toESM(require("react"));
|
|
1008
|
+
var Upload2 = (props) => {
|
|
1009
|
+
const [file, setFile] = (0, import_react29.useState)();
|
|
1010
|
+
const handleFileChange = (e) => {
|
|
1011
|
+
setFile(e.target.files[0]);
|
|
1012
|
+
if (props.onChange) {
|
|
1013
|
+
props.onChange(e.target.files[0]);
|
|
1014
|
+
}
|
|
1015
|
+
};
|
|
1016
|
+
const handleUpload = async () => {
|
|
1017
|
+
if (!file) {
|
|
1018
|
+
console.error("No file selected");
|
|
1019
|
+
return;
|
|
1020
|
+
}
|
|
1021
|
+
};
|
|
1022
|
+
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(
|
|
1023
|
+
"button",
|
|
1024
|
+
{
|
|
1025
|
+
type: "button",
|
|
1026
|
+
onClick: handleUpload,
|
|
1027
|
+
disabled: !file,
|
|
1028
|
+
style: { marginTop: 16 }
|
|
1029
|
+
},
|
|
1030
|
+
"Upload"
|
|
1031
|
+
));
|
|
1032
|
+
};
|
|
1033
|
+
|
|
1034
|
+
// src/Components/OtpElement.tsx
|
|
1035
|
+
var import_react30 = __toESM(require("react"));
|
|
1036
|
+
var import_antd22 = require("antd");
|
|
1037
|
+
var OtpElement = (props) => {
|
|
1038
|
+
const length = props.length;
|
|
1039
|
+
const [otp, setOtp] = (0, import_react30.useState)(Array(length).fill(""));
|
|
1040
|
+
const inputRefs = (0, import_react30.useRef)([]);
|
|
1041
|
+
const handleChange = (e, index) => {
|
|
1042
|
+
const value = e.target.value;
|
|
1043
|
+
if (/^[0-9]$/.test(value) || value === "") {
|
|
1044
|
+
const newOtp = [...otp];
|
|
1045
|
+
newOtp[index] = value;
|
|
1046
|
+
setOtp(newOtp);
|
|
1047
|
+
props.onChange && props.onChange(newOtp.join(""));
|
|
1048
|
+
if (value && index < length - 1) {
|
|
1049
|
+
inputRefs.current[index + 1]?.focus();
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
};
|
|
1053
|
+
const handleKeyDown = (e, index) => {
|
|
1054
|
+
if (e.key === "Backspace" && !otp[index] && index > 0) {
|
|
1055
|
+
inputRefs.current[index - 1]?.focus();
|
|
1056
|
+
}
|
|
1057
|
+
};
|
|
1058
|
+
const handlePaste = (e) => {
|
|
1059
|
+
e.preventDefault();
|
|
1060
|
+
const pasteData = e.clipboardData.getData("text");
|
|
1061
|
+
if (/^\d+$/.test(pasteData)) {
|
|
1062
|
+
const newOtp = pasteData.split("").slice(0, length);
|
|
1063
|
+
setOtp(newOtp.concat(Array(length - newOtp.length).fill("")));
|
|
1064
|
+
props.onChange && props.onChange(newOtp.join(""));
|
|
1065
|
+
newOtp.forEach((_, idx) => {
|
|
1066
|
+
if (inputRefs.current[idx]) {
|
|
1067
|
+
inputRefs.current[idx]?.focus();
|
|
1068
|
+
}
|
|
1069
|
+
});
|
|
1070
|
+
}
|
|
1071
|
+
};
|
|
1072
|
+
(0, import_react30.useEffect)(() => {
|
|
1073
|
+
inputRefs.current[0]?.focus();
|
|
1074
|
+
}, []);
|
|
1075
|
+
return /* @__PURE__ */ import_react30.default.createElement("div", { className: props.containerClassName }, Array.from({ length }).map((_, index) => /* @__PURE__ */ import_react30.default.createElement(
|
|
1076
|
+
import_antd22.Input,
|
|
1077
|
+
{
|
|
1078
|
+
key: index,
|
|
1079
|
+
className: props.className,
|
|
1080
|
+
maxLength: 1,
|
|
1081
|
+
value: otp[index],
|
|
1082
|
+
onChange: (e) => handleChange(e, index),
|
|
1083
|
+
onKeyDown: (e) => handleKeyDown(e, index),
|
|
1084
|
+
onPaste: handlePaste,
|
|
1085
|
+
ref: (el) => inputRefs.current[index] = el
|
|
1086
|
+
}
|
|
1087
|
+
)));
|
|
1088
|
+
};
|
|
1089
|
+
|
|
1090
|
+
// src/Components/Donut.tsx
|
|
1091
|
+
var import_react31 = __toESM(require("react"));
|
|
1092
|
+
var import_highcharts = __toESM(require("highcharts"));
|
|
1093
|
+
var import_highcharts_react_official = __toESM(require("highcharts-react-official"));
|
|
1094
|
+
var HighchartsChart = ({ options }) => {
|
|
1095
|
+
return /* @__PURE__ */ import_react31.default.createElement(import_highcharts_react_official.default, { highcharts: import_highcharts.default, options });
|
|
1096
|
+
};
|
|
1097
|
+
console.log(HighchartsChart);
|
|
1098
|
+
console.log(typeof HighchartsChart);
|
|
1099
|
+
var Donut = (props) => {
|
|
1100
|
+
const chartOptions = {
|
|
1101
|
+
title: {
|
|
1102
|
+
text: "Distribution of Students"
|
|
1103
|
+
},
|
|
1104
|
+
plotOptions: {
|
|
1105
|
+
pie: {
|
|
1106
|
+
innerSize: "70%",
|
|
1107
|
+
dataLabels: {
|
|
1108
|
+
enabled: false,
|
|
1109
|
+
format: "<b>{point.name}</b>: {point.percentage:.1f} %"
|
|
1110
|
+
},
|
|
1111
|
+
showInLegend: true
|
|
1112
|
+
}
|
|
1113
|
+
},
|
|
1114
|
+
series: [
|
|
1115
|
+
{
|
|
1116
|
+
type: "pie",
|
|
1117
|
+
name: "Percentage",
|
|
1118
|
+
data: [
|
|
1119
|
+
{
|
|
1120
|
+
name: "Girls",
|
|
1121
|
+
y: 20,
|
|
1122
|
+
color: "#FF6384"
|
|
1123
|
+
// Custom color for Girls
|
|
1124
|
+
},
|
|
1125
|
+
{
|
|
1126
|
+
name: "Boys",
|
|
1127
|
+
y: 40,
|
|
1128
|
+
color: "#36A2EB"
|
|
1129
|
+
// Custom color for Boys
|
|
1130
|
+
},
|
|
1131
|
+
{
|
|
1132
|
+
name: "Students",
|
|
1133
|
+
y: 40,
|
|
1134
|
+
color: "#FFCE56"
|
|
1135
|
+
// Custom color for Students
|
|
1136
|
+
}
|
|
1137
|
+
]
|
|
1138
|
+
}
|
|
1139
|
+
]
|
|
1140
|
+
};
|
|
1141
|
+
return /* @__PURE__ */ import_react31.default.createElement(import_react31.default.Fragment, null, /* @__PURE__ */ import_react31.default.createElement(HighchartsChart, { highcharts: import_highcharts.default, options: chartOptions }));
|
|
1142
|
+
};
|
|
926
1143
|
// Annotate the CommonJS export names for ESM import in node:
|
|
927
1144
|
0 && (module.exports = {
|
|
928
1145
|
AddMoreTable,
|
|
@@ -931,20 +1148,24 @@ var TabsElement = (props) => {
|
|
|
931
1148
|
CkEditor,
|
|
932
1149
|
DatePickerElement,
|
|
933
1150
|
DateRangePickerElement,
|
|
1151
|
+
Donut,
|
|
934
1152
|
DropDownGroup,
|
|
935
1153
|
FileUpload,
|
|
936
1154
|
Image,
|
|
937
1155
|
MultipleSelectElement,
|
|
938
1156
|
Navbar,
|
|
939
1157
|
NumberElement,
|
|
1158
|
+
OtpElement,
|
|
940
1159
|
PasswordElement,
|
|
941
1160
|
RadioElement,
|
|
942
1161
|
SelectElement,
|
|
943
1162
|
Sidebar,
|
|
944
1163
|
SingleCheckbox,
|
|
945
1164
|
SingleSelectElement,
|
|
1165
|
+
SwitchElement,
|
|
946
1166
|
TableElement,
|
|
947
1167
|
TabsElement,
|
|
948
1168
|
TextElement,
|
|
949
|
-
TextareaElement
|
|
1169
|
+
TextareaElement,
|
|
1170
|
+
Upload
|
|
950
1171
|
});
|