@apexcura/ui-components 0.0.14-Beta154 → 0.0.14-Beta155
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.js +37 -11
- package/dist/index.mjs +45 -21
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -735,6 +735,18 @@ var TableElement = (props) => {
|
|
|
735
735
|
const { thead, tbody } = props;
|
|
736
736
|
const [selectedRecord, setSelectedRecord] = (0, import_react20.useState)({});
|
|
737
737
|
const [model, setModel] = (0, import_react20.useState)(false);
|
|
738
|
+
const [dataSource, setDataSource] = (0, import_react20.useState)([]);
|
|
739
|
+
(0, import_react20.useEffect)(() => {
|
|
740
|
+
if (tbody) {
|
|
741
|
+
setDataSource(
|
|
742
|
+
tbody.map((row, index) => ({
|
|
743
|
+
...row,
|
|
744
|
+
key: index,
|
|
745
|
+
index: index + 1
|
|
746
|
+
}))
|
|
747
|
+
);
|
|
748
|
+
}
|
|
749
|
+
}, [tbody]);
|
|
738
750
|
const handleChange = (record) => {
|
|
739
751
|
console.log("record", record);
|
|
740
752
|
if (props.onChange) {
|
|
@@ -746,8 +758,8 @@ var TableElement = (props) => {
|
|
|
746
758
|
columns = [
|
|
747
759
|
{
|
|
748
760
|
title: "#",
|
|
749
|
-
dataIndex: "
|
|
750
|
-
key: "
|
|
761
|
+
dataIndex: "index",
|
|
762
|
+
key: "index",
|
|
751
763
|
fixed: "left"
|
|
752
764
|
},
|
|
753
765
|
...thead.map((col, ind) => ({
|
|
@@ -758,9 +770,9 @@ var TableElement = (props) => {
|
|
|
758
770
|
render: col.render,
|
|
759
771
|
sorter: {
|
|
760
772
|
compare: (a, b) => {
|
|
761
|
-
if (typeof a[col.key] === "number" && typeof
|
|
773
|
+
if (typeof a[col.key] === "number" && typeof b[col.key] === "number") {
|
|
762
774
|
return a[col.key] - b[col.key];
|
|
763
|
-
} else if (typeof a[col.key] === "string" && typeof
|
|
775
|
+
} else if (typeof a[col.key] === "string" && typeof b[col.key] === "string") {
|
|
764
776
|
return a[col.key].localeCompare(b[col.key]);
|
|
765
777
|
}
|
|
766
778
|
}
|
|
@@ -790,11 +802,15 @@ var TableElement = (props) => {
|
|
|
790
802
|
});
|
|
791
803
|
}
|
|
792
804
|
}
|
|
793
|
-
const
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
805
|
+
const onChangeTable = (pagination, filters, sorter) => {
|
|
806
|
+
const { currentDataSource } = sorter;
|
|
807
|
+
setDataSource(
|
|
808
|
+
currentDataSource.map((row, index) => ({
|
|
809
|
+
...row,
|
|
810
|
+
index: index + 1
|
|
811
|
+
}))
|
|
812
|
+
);
|
|
813
|
+
};
|
|
798
814
|
const count = dataSource ? dataSource.length : 0;
|
|
799
815
|
const onChangePage = (page, pageSize) => {
|
|
800
816
|
if (props.onChange) {
|
|
@@ -823,9 +839,19 @@ var TableElement = (props) => {
|
|
|
823
839
|
dataSource,
|
|
824
840
|
columns,
|
|
825
841
|
size: props.size,
|
|
826
|
-
bordered: true
|
|
842
|
+
bordered: true,
|
|
843
|
+
onChange: onChangeTable
|
|
827
844
|
}
|
|
828
|
-
), model && /* @__PURE__ */ import_react20.default.createElement(
|
|
845
|
+
), model && /* @__PURE__ */ import_react20.default.createElement(
|
|
846
|
+
ModelElement,
|
|
847
|
+
{
|
|
848
|
+
selectedRecord,
|
|
849
|
+
...props,
|
|
850
|
+
columns,
|
|
851
|
+
model,
|
|
852
|
+
onCancel: () => setModel(false)
|
|
853
|
+
}
|
|
854
|
+
));
|
|
829
855
|
};
|
|
830
856
|
|
|
831
857
|
// src/Components/DatePicker.tsx
|
package/dist/index.mjs
CHANGED
|
@@ -608,7 +608,7 @@ var Navbar = (props) => {
|
|
|
608
608
|
};
|
|
609
609
|
|
|
610
610
|
// src/Components/TableElement.tsx
|
|
611
|
-
import React20, { useState as useState6 } from "react";
|
|
611
|
+
import React20, { useState as useState6, useEffect as useEffect3 } from "react";
|
|
612
612
|
import { Table as Table2 } from "antd";
|
|
613
613
|
|
|
614
614
|
// src/Components/Model.tsx
|
|
@@ -664,13 +664,23 @@ var ModelElement = (props) => {
|
|
|
664
664
|
};
|
|
665
665
|
|
|
666
666
|
// src/Components/TableElement.tsx
|
|
667
|
-
import {
|
|
668
|
-
EyeOutlined
|
|
669
|
-
} from "@ant-design/icons";
|
|
667
|
+
import { EyeOutlined } from "@ant-design/icons";
|
|
670
668
|
var TableElement = (props) => {
|
|
671
669
|
const { thead, tbody } = props;
|
|
672
670
|
const [selectedRecord, setSelectedRecord] = useState6({});
|
|
673
671
|
const [model, setModel] = useState6(false);
|
|
672
|
+
const [dataSource, setDataSource] = useState6([]);
|
|
673
|
+
useEffect3(() => {
|
|
674
|
+
if (tbody) {
|
|
675
|
+
setDataSource(
|
|
676
|
+
tbody.map((row, index) => ({
|
|
677
|
+
...row,
|
|
678
|
+
key: index,
|
|
679
|
+
index: index + 1
|
|
680
|
+
}))
|
|
681
|
+
);
|
|
682
|
+
}
|
|
683
|
+
}, [tbody]);
|
|
674
684
|
const handleChange = (record) => {
|
|
675
685
|
console.log("record", record);
|
|
676
686
|
if (props.onChange) {
|
|
@@ -682,8 +692,8 @@ var TableElement = (props) => {
|
|
|
682
692
|
columns = [
|
|
683
693
|
{
|
|
684
694
|
title: "#",
|
|
685
|
-
dataIndex: "
|
|
686
|
-
key: "
|
|
695
|
+
dataIndex: "index",
|
|
696
|
+
key: "index",
|
|
687
697
|
fixed: "left"
|
|
688
698
|
},
|
|
689
699
|
...thead.map((col, ind) => ({
|
|
@@ -694,9 +704,9 @@ var TableElement = (props) => {
|
|
|
694
704
|
render: col.render,
|
|
695
705
|
sorter: {
|
|
696
706
|
compare: (a, b) => {
|
|
697
|
-
if (typeof a[col.key] === "number" && typeof
|
|
707
|
+
if (typeof a[col.key] === "number" && typeof b[col.key] === "number") {
|
|
698
708
|
return a[col.key] - b[col.key];
|
|
699
|
-
} else if (typeof a[col.key] === "string" && typeof
|
|
709
|
+
} else if (typeof a[col.key] === "string" && typeof b[col.key] === "string") {
|
|
700
710
|
return a[col.key].localeCompare(b[col.key]);
|
|
701
711
|
}
|
|
702
712
|
}
|
|
@@ -726,11 +736,15 @@ var TableElement = (props) => {
|
|
|
726
736
|
});
|
|
727
737
|
}
|
|
728
738
|
}
|
|
729
|
-
const
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
739
|
+
const onChangeTable = (pagination, filters, sorter) => {
|
|
740
|
+
const { currentDataSource } = sorter;
|
|
741
|
+
setDataSource(
|
|
742
|
+
currentDataSource.map((row, index) => ({
|
|
743
|
+
...row,
|
|
744
|
+
index: index + 1
|
|
745
|
+
}))
|
|
746
|
+
);
|
|
747
|
+
};
|
|
734
748
|
const count = dataSource ? dataSource.length : 0;
|
|
735
749
|
const onChangePage = (page, pageSize) => {
|
|
736
750
|
if (props.onChange) {
|
|
@@ -759,9 +773,19 @@ var TableElement = (props) => {
|
|
|
759
773
|
dataSource,
|
|
760
774
|
columns,
|
|
761
775
|
size: props.size,
|
|
762
|
-
bordered: true
|
|
776
|
+
bordered: true,
|
|
777
|
+
onChange: onChangeTable
|
|
763
778
|
}
|
|
764
|
-
), model && /* @__PURE__ */ React20.createElement(
|
|
779
|
+
), model && /* @__PURE__ */ React20.createElement(
|
|
780
|
+
ModelElement,
|
|
781
|
+
{
|
|
782
|
+
selectedRecord,
|
|
783
|
+
...props,
|
|
784
|
+
columns,
|
|
785
|
+
model,
|
|
786
|
+
onCancel: () => setModel(false)
|
|
787
|
+
}
|
|
788
|
+
));
|
|
765
789
|
};
|
|
766
790
|
|
|
767
791
|
// src/Components/DatePicker.tsx
|
|
@@ -980,7 +1004,7 @@ var Upload2 = (props) => {
|
|
|
980
1004
|
};
|
|
981
1005
|
|
|
982
1006
|
// src/Components/OtpElement.tsx
|
|
983
|
-
import React30, { useState as useState11, useRef, useEffect as
|
|
1007
|
+
import React30, { useState as useState11, useRef, useEffect as useEffect4 } from "react";
|
|
984
1008
|
import { Input as Input3 } from "antd";
|
|
985
1009
|
var OtpElement = (props) => {
|
|
986
1010
|
const length = props.length;
|
|
@@ -1017,7 +1041,7 @@ var OtpElement = (props) => {
|
|
|
1017
1041
|
});
|
|
1018
1042
|
}
|
|
1019
1043
|
};
|
|
1020
|
-
|
|
1044
|
+
useEffect4(() => {
|
|
1021
1045
|
inputRefs.current[0]?.focus();
|
|
1022
1046
|
}, []);
|
|
1023
1047
|
return /* @__PURE__ */ React30.createElement("div", { className: props.containerClassName }, Array.from({ length }).map((_, index) => /* @__PURE__ */ React30.createElement(
|
|
@@ -1269,7 +1293,7 @@ var HorizontalBarChart = (props) => {
|
|
|
1269
1293
|
};
|
|
1270
1294
|
|
|
1271
1295
|
// src/Components/LineChart.tsx
|
|
1272
|
-
import React34, { useEffect as
|
|
1296
|
+
import React34, { useEffect as useEffect5, useRef as useRef2 } from "react";
|
|
1273
1297
|
import Chart from "chart.js/auto";
|
|
1274
1298
|
var LineChart = (props) => {
|
|
1275
1299
|
const chartRef = useRef2(null);
|
|
@@ -1280,7 +1304,7 @@ var LineChart = (props) => {
|
|
|
1280
1304
|
{ label: "Conversion Rate", data: [50, 100, 150, 180, 50] }
|
|
1281
1305
|
];
|
|
1282
1306
|
const labels = ["Instagram", "Whatsapp", "Messages", "Telegram", "Linkedin"];
|
|
1283
|
-
|
|
1307
|
+
useEffect5(() => {
|
|
1284
1308
|
if (chartRef.current) {
|
|
1285
1309
|
if (chartInstance.current) {
|
|
1286
1310
|
chartInstance.current.destroy();
|
|
@@ -1342,12 +1366,12 @@ var LineChart = (props) => {
|
|
|
1342
1366
|
};
|
|
1343
1367
|
|
|
1344
1368
|
// src/Components/DoubleBarChart.tsx
|
|
1345
|
-
import React35, { useEffect as
|
|
1369
|
+
import React35, { useEffect as useEffect6, useRef as useRef3 } from "react";
|
|
1346
1370
|
import Chart2 from "chart.js/auto";
|
|
1347
1371
|
var DoubleBarChart = (props) => {
|
|
1348
1372
|
const chartRef = useRef3(null);
|
|
1349
1373
|
const chartInstance = useRef3(null);
|
|
1350
|
-
|
|
1374
|
+
useEffect6(() => {
|
|
1351
1375
|
if (chartRef.current) {
|
|
1352
1376
|
if (chartInstance.current) {
|
|
1353
1377
|
chartInstance.current.destroy();
|