@apexcura/ui-components 0.0.14-Beta178 → 0.0.14-Beta179

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/.env.defaults CHANGED
@@ -1,2 +1,2 @@
1
- GOOGLE_CLIENT_ID=1234
2
- GOOGLE_AUTH_ORIGINS=1234
1
+ GOOGLE_CLIENT_ID=1234
2
+ GOOGLE_AUTH_ORIGINS=1234
package/dist/index.css CHANGED
@@ -460,6 +460,9 @@ video {
460
460
  :where(.css-dev-only-do-not-override-1r287do).ant-radio-button-wrapper:first-child {
461
461
  border-inline-start: 1px solid rgb(145 145 145);
462
462
  }
463
+ :where(.css-dev-only-do-not-override-m4timi).ant-tabs-top > .ant-tabs-nav {
464
+ margin: 0px;
465
+ }
463
466
  .hover\:bg-\[\#F2F2F2\]:hover {
464
467
  --tw-bg-opacity: 1;
465
468
  background-color: rgb(242 242 242 / var(--tw-bg-opacity));
package/dist/index.d.mts CHANGED
@@ -69,6 +69,8 @@ type ElementType = {
69
69
  fillText2?: string;
70
70
  labels?: any[];
71
71
  data?: any[];
72
+ pagination?: boolean;
73
+ is_detail?: boolean;
72
74
  };
73
75
 
74
76
  declare const TextElement: (props: ElementType) => React$1.JSX.Element;
@@ -132,10 +134,8 @@ declare const HorizontalBarChart: (props: ElementType) => React$1.JSX.Element;
132
134
 
133
135
  declare const LineChart: (props: ElementType) => React$1.JSX.Element;
134
136
 
135
- declare const HighchartsLineChart: (props: ElementType) => React$1.JSX.Element;
136
-
137
137
  declare const DoubleBarChart: (props: ElementType) => React$1.JSX.Element;
138
138
 
139
139
  declare const BarChart: (props: ElementType) => React$1.JSX.Element;
140
140
 
141
- export { AddMoreTable, BarChart, ButtonElement, CheckboxElement, CircleDonut, CkEditor, DatePickerElement, DateRangePickerElement, DoubleBarChart, DropDownGroup, FileUpload, HighchartsLineChart, HorizontalBarChart, Image, LineChart, MultipleSelectElement, Navbar, NumberElement, OtpElement, PasswordElement, RadioElement, SelectElement, SemiCircleDonut, Sidebar, SingleCheckbox, SingleSelectElement, SwitchElement, TableElement, TabsElement, TextElement, TextareaElement, Upload };
141
+ export { AddMoreTable, BarChart, ButtonElement, CheckboxElement, CircleDonut, CkEditor, DatePickerElement, DateRangePickerElement, DoubleBarChart, DropDownGroup, FileUpload, HorizontalBarChart, Image, LineChart, MultipleSelectElement, Navbar, NumberElement, OtpElement, PasswordElement, RadioElement, SelectElement, SemiCircleDonut, Sidebar, SingleCheckbox, SingleSelectElement, SwitchElement, TableElement, TabsElement, TextElement, TextareaElement, Upload };
package/dist/index.d.ts CHANGED
@@ -69,6 +69,8 @@ type ElementType = {
69
69
  fillText2?: string;
70
70
  labels?: any[];
71
71
  data?: any[];
72
+ pagination?: boolean;
73
+ is_detail?: boolean;
72
74
  };
73
75
 
74
76
  declare const TextElement: (props: ElementType) => React$1.JSX.Element;
@@ -132,10 +134,8 @@ declare const HorizontalBarChart: (props: ElementType) => React$1.JSX.Element;
132
134
 
133
135
  declare const LineChart: (props: ElementType) => React$1.JSX.Element;
134
136
 
135
- declare const HighchartsLineChart: (props: ElementType) => React$1.JSX.Element;
136
-
137
137
  declare const DoubleBarChart: (props: ElementType) => React$1.JSX.Element;
138
138
 
139
139
  declare const BarChart: (props: ElementType) => React$1.JSX.Element;
140
140
 
141
- export { AddMoreTable, BarChart, ButtonElement, CheckboxElement, CircleDonut, CkEditor, DatePickerElement, DateRangePickerElement, DoubleBarChart, DropDownGroup, FileUpload, HighchartsLineChart, HorizontalBarChart, Image, LineChart, MultipleSelectElement, Navbar, NumberElement, OtpElement, PasswordElement, RadioElement, SelectElement, SemiCircleDonut, Sidebar, SingleCheckbox, SingleSelectElement, SwitchElement, TableElement, TabsElement, TextElement, TextareaElement, Upload };
141
+ export { AddMoreTable, BarChart, ButtonElement, CheckboxElement, CircleDonut, CkEditor, DatePickerElement, DateRangePickerElement, DoubleBarChart, DropDownGroup, FileUpload, HorizontalBarChart, Image, LineChart, MultipleSelectElement, Navbar, NumberElement, OtpElement, PasswordElement, RadioElement, SelectElement, SemiCircleDonut, Sidebar, SingleCheckbox, SingleSelectElement, SwitchElement, TableElement, TabsElement, TextElement, TextareaElement, Upload };
package/dist/index.js CHANGED
@@ -41,7 +41,6 @@ __export(src_exports, {
41
41
  DoubleBarChart: () => DoubleBarChart,
42
42
  DropDownGroup: () => DropDownGroup,
43
43
  FileUpload: () => FileUpload,
44
- HighchartsLineChart: () => HighchartsLineChart,
45
44
  HorizontalBarChart: () => HorizontalBarChart,
46
45
  Image: () => Image,
47
46
  LineChart: () => LineChart,
@@ -386,7 +385,9 @@ var MultipleSelectElement = (props) => {
386
385
  var import_react11 = __toESM(require("react"));
387
386
  var ButtonElement = (props) => {
388
387
  const [svgContent, setSvgContent] = (0, import_react11.useState)(null);
389
- const [originalSvgContent, setOriginalSvgContent] = (0, import_react11.useState)(null);
388
+ const [originalSvgContent, setOriginalSvgContent] = (0, import_react11.useState)(
389
+ null
390
+ );
390
391
  const [hoverColor, setHoverColor] = (0, import_react11.useState)(null);
391
392
  (0, import_react11.useEffect)(() => {
392
393
  if (props.icon) {
@@ -451,12 +452,14 @@ var ButtonElement = (props) => {
451
452
  cursor: props.loading ? "no-drop" : "pointer"
452
453
  }
453
454
  },
454
- 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" }), 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(
455
- "span",
455
+ 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" }), props.label) : /* @__PURE__ */ import_react11.default.createElement(import_react11.default.Fragment, null, props.isSVGStylesOverride === false ? props.icon ? /* @__PURE__ */ import_react11.default.createElement(
456
+ "img",
456
457
  {
457
- dangerouslySetInnerHTML: { __html: svgContent }
458
+ className: props.iconsClassName,
459
+ src: props.icon,
460
+ alt: props.label
458
461
  }
459
- ), props.label)
462
+ ) : /* @__PURE__ */ import_react11.default.createElement("img", { src: "", alt: "", className: props.iconsClassName }) : svgContent && /* @__PURE__ */ import_react11.default.createElement("span", { dangerouslySetInnerHTML: { __html: svgContent } }), props.label)
460
463
  );
461
464
  };
462
465
 
@@ -720,9 +723,22 @@ var ModelElement = (props) => {
720
723
  margin: "-10px"
721
724
  }
722
725
  },
723
- Object.entries(selectedRecord).map(([key, value]) => {
724
- const record = columns.filter((eachColumn) => eachColumn.key === key);
725
- return record.length > 0 ? /* @__PURE__ */ import_react19.default.createElement("p", { style: { fontWeight: "500", padding: "10px" }, key }, /* @__PURE__ */ import_react19.default.createElement("span", { style: { fontWeight: "200", color: "gray", paddingRight: "10px" } }, record[0].title), String(value)) : "";
726
+ columns.map((eachColumn) => {
727
+ if (!["index", "View"].includes(eachColumn.key) && eachColumn?.["is_detail"] !== false) {
728
+ return /* @__PURE__ */ import_react19.default.createElement("p", { style: { fontWeight: "500", padding: "10px" } }, /* @__PURE__ */ import_react19.default.createElement(
729
+ "span",
730
+ {
731
+ style: {
732
+ fontWeight: "200",
733
+ color: "gray",
734
+ paddingRight: "10px"
735
+ }
736
+ },
737
+ eachColumn.title
738
+ ), selectedRecord[eachColumn.key] !== "" ? selectedRecord[eachColumn.key] : "--");
739
+ } else {
740
+ return null;
741
+ }
726
742
  })
727
743
  )
728
744
  },
@@ -731,12 +747,24 @@ var ModelElement = (props) => {
731
747
  };
732
748
 
733
749
  // src/Components/TableElement.tsx
750
+ var import_icons4 = require("@ant-design/icons");
734
751
  var TableElement = (props) => {
735
752
  const { thead, tbody } = props;
736
753
  const [selectedRecord, setSelectedRecord] = (0, import_react20.useState)({});
737
754
  const [model, setModel] = (0, import_react20.useState)(false);
755
+ const [dataSource, setDataSource] = (0, import_react20.useState)([]);
756
+ (0, import_react20.useEffect)(() => {
757
+ if (tbody) {
758
+ setDataSource(
759
+ tbody.map((row, index) => ({
760
+ ...row,
761
+ key: index,
762
+ index: index + 1
763
+ }))
764
+ );
765
+ }
766
+ }, [tbody]);
738
767
  const handleChange = (record) => {
739
- console.log("record", record);
740
768
  if (props.onChange) {
741
769
  props.onChange(record);
742
770
  }
@@ -746,8 +774,8 @@ var TableElement = (props) => {
746
774
  columns = [
747
775
  {
748
776
  title: "#",
749
- dataIndex: "#",
750
- key: "#",
777
+ dataIndex: "index",
778
+ key: "index",
751
779
  fixed: "left"
752
780
  },
753
781
  ...thead.map((col, ind) => ({
@@ -758,9 +786,9 @@ var TableElement = (props) => {
758
786
  render: col.render,
759
787
  sorter: {
760
788
  compare: (a, b) => {
761
- if (typeof a[col.key] === "number" && typeof a[col.key] === "number") {
789
+ if (typeof a[col.key] === "number" && typeof b[col.key] === "number") {
762
790
  return a[col.key] - b[col.key];
763
- } else if (typeof a[col.key] === "string" && typeof a[col.key] === "string") {
791
+ } else if (typeof a[col.key] === "string" && typeof b[col.key] === "string") {
764
792
  return a[col.key].localeCompare(b[col.key]);
765
793
  }
766
794
  }
@@ -772,26 +800,34 @@ var TableElement = (props) => {
772
800
  title: "View",
773
801
  dataIndex: "View",
774
802
  key: "View",
775
- render: (_, record) => /* @__PURE__ */ import_react20.default.createElement(
776
- "a",
777
- {
778
- onClick: () => {
779
- setSelectedRecord(record);
780
- handleChange(record);
781
- setModel(true);
782
- }
783
- },
784
- "View"
785
- )
803
+ render: (_, record) => {
804
+ return /* @__PURE__ */ import_react20.default.createElement(
805
+ "a",
806
+ {
807
+ onClick: () => {
808
+ if (props.view) {
809
+ setSelectedRecord(record);
810
+ handleChange(record);
811
+ setModel(true);
812
+ }
813
+ }
814
+ },
815
+ /* @__PURE__ */ import_react20.default.createElement(import_icons4.EyeOutlined, null)
816
+ );
817
+ }
786
818
  });
787
819
  }
788
820
  }
789
- const dataSource = tbody && tbody.map((row, index) => ({
790
- ...row,
791
- key: index + 1,
792
- [columns[0].key]: index + 1
793
- }));
794
- const count = dataSource ? dataSource.length : 0;
821
+ const onChangeTable = (pagination, filters, sorter, extra) => {
822
+ if (extra && extra.currentDataSource) {
823
+ setDataSource(
824
+ extra.currentDataSource.map((row, index) => ({
825
+ ...row,
826
+ index: index + 1
827
+ }))
828
+ );
829
+ }
830
+ };
795
831
  const onChangePage = (page, pageSize) => {
796
832
  if (props.onChange) {
797
833
  props.onChange({ name: "pagination", page, pageSize });
@@ -799,7 +835,11 @@ var TableElement = (props) => {
799
835
  };
800
836
  const rowSelectionConfig = props.rowSelection ? {
801
837
  onChange: (selectedRowKeys, selectedRows) => {
802
- console.log(`selectedRowKeys: ${selectedRowKeys}`, "selectedRows: ", selectedRows);
838
+ console.log(
839
+ `selectedRowKeys: ${selectedRowKeys}`,
840
+ "selectedRows: ",
841
+ selectedRows
842
+ );
803
843
  if (props.onChange) {
804
844
  props.onChange(selectedRows);
805
845
  }
@@ -809,19 +849,41 @@ var TableElement = (props) => {
809
849
  import_antd14.Table,
810
850
  {
811
851
  className: props.className,
812
- pagination: {
852
+ pagination: props.pagination ? {
813
853
  showTotal: (total) => `Total: ${total} items`,
814
- total: count,
815
- showSizeChanger: count > 10,
854
+ total: props.count,
855
+ showSizeChanger: props.count ? props.count > 10 : 0 > 10,
816
856
  onChange: onChangePage
857
+ } : false,
858
+ onRow: (record) => {
859
+ return {
860
+ onClick: () => {
861
+ if (props.view) {
862
+ setSelectedRecord(record);
863
+ handleChange(record);
864
+ setModel(true);
865
+ }
866
+ },
867
+ style: { cursor: "pointer" }
868
+ };
817
869
  },
818
870
  rowSelection: rowSelectionConfig,
819
871
  dataSource,
820
872
  columns,
821
873
  size: props.size,
822
- bordered: true
874
+ bordered: true,
875
+ onChange: onChangeTable
876
+ }
877
+ ), model && /* @__PURE__ */ import_react20.default.createElement(
878
+ ModelElement,
879
+ {
880
+ selectedRecord,
881
+ ...props,
882
+ columns,
883
+ model,
884
+ onCancel: () => setModel(false)
823
885
  }
824
- ), model && /* @__PURE__ */ import_react20.default.createElement(ModelElement, { selectedRecord, ...props, columns, model, onCancel: () => setModel(false) }));
886
+ ));
825
887
  };
826
888
 
827
889
  // src/Components/DatePicker.tsx
@@ -955,7 +1017,7 @@ var DropDownGroup = (props) => {
955
1017
  // src/Components/FilesUpload.tsx
956
1018
  var import_react26 = __toESM(require("react"));
957
1019
  var import_antd19 = require("antd");
958
- var import_icons4 = require("@ant-design/icons");
1020
+ var import_icons5 = require("@ant-design/icons");
959
1021
  var FileUpload = (props) => {
960
1022
  const { Dragger } = import_antd19.Upload;
961
1023
  const [files, setFiles] = (0, import_react26.useState)([]);
@@ -986,7 +1048,7 @@ var FileUpload = (props) => {
986
1048
  showUploadList: true,
987
1049
  customRequest
988
1050
  },
989
- /* @__PURE__ */ import_react26.default.createElement("p", null, /* @__PURE__ */ import_react26.default.createElement(import_icons4.InboxOutlined, null)),
1051
+ /* @__PURE__ */ import_react26.default.createElement("p", null, /* @__PURE__ */ import_react26.default.createElement(import_icons5.InboxOutlined, null)),
990
1052
  /* @__PURE__ */ import_react26.default.createElement("p", null, "Click or drag file to upload")
991
1053
  ));
992
1054
  };
@@ -1383,21 +1445,13 @@ var LineChart = (props) => {
1383
1445
  return /* @__PURE__ */ import_react34.default.createElement("div", { className: props.className }, /* @__PURE__ */ import_react34.default.createElement("canvas", { ref: chartRef }));
1384
1446
  };
1385
1447
 
1386
- // src/Components/highchart.tsx
1387
- var import_react35 = __toESM(require("react"));
1388
- var import_highcharts = __toESM(require("highcharts"));
1389
- var import_highcharts_react_official = __toESM(require("highcharts-react-official"));
1390
- var HighchartsLineChart = (props) => {
1391
- return /* @__PURE__ */ import_react35.default.createElement("div", { className: props.className }, /* @__PURE__ */ import_react35.default.createElement(import_highcharts_react_official.default, { highcharts: import_highcharts.default, options: props.graph_data }));
1392
- };
1393
-
1394
1448
  // src/Components/DoubleBarChart.tsx
1395
- var import_react36 = __toESM(require("react"));
1449
+ var import_react35 = __toESM(require("react"));
1396
1450
  var import_auto2 = __toESM(require("chart.js/auto"));
1397
1451
  var DoubleBarChart = (props) => {
1398
- const chartRef = (0, import_react36.useRef)(null);
1399
- const chartInstance = (0, import_react36.useRef)(null);
1400
- (0, import_react36.useEffect)(() => {
1452
+ const chartRef = (0, import_react35.useRef)(null);
1453
+ const chartInstance = (0, import_react35.useRef)(null);
1454
+ (0, import_react35.useEffect)(() => {
1401
1455
  if (chartRef.current) {
1402
1456
  if (chartInstance.current) {
1403
1457
  chartInstance.current.destroy();
@@ -1466,11 +1520,11 @@ var DoubleBarChart = (props) => {
1466
1520
  }
1467
1521
  };
1468
1522
  }, []);
1469
- return /* @__PURE__ */ import_react36.default.createElement("div", { className: props.className }, /* @__PURE__ */ import_react36.default.createElement("h1", { className: props.labelClassName }, props.label), /* @__PURE__ */ import_react36.default.createElement("canvas", { ref: chartRef }));
1523
+ return /* @__PURE__ */ import_react35.default.createElement("div", { className: props.className }, /* @__PURE__ */ import_react35.default.createElement("h1", { className: props.labelClassName }, props.label), /* @__PURE__ */ import_react35.default.createElement("canvas", { ref: chartRef }));
1470
1524
  };
1471
1525
 
1472
1526
  // src/Components/BarChart.tsx
1473
- var import_react37 = __toESM(require("react"));
1527
+ var import_react36 = __toESM(require("react"));
1474
1528
  var import_react_chartjs_24 = require("react-chartjs-2");
1475
1529
  var import_chart4 = require("chart.js");
1476
1530
  import_chart4.Chart.register(import_chart4.BarElement, import_chart4.CategoryScale, import_chart4.LinearScale, import_chart4.Tooltip);
@@ -1532,7 +1586,7 @@ var BarChart = (props) => {
1532
1586
  }
1533
1587
  }
1534
1588
  };
1535
- return /* @__PURE__ */ import_react37.default.createElement("div", { className: props.className }, /* @__PURE__ */ import_react37.default.createElement("h1", { className: props.labelClassName }, props.label), /* @__PURE__ */ import_react37.default.createElement(import_react_chartjs_24.Bar, { data, options }));
1589
+ return /* @__PURE__ */ import_react36.default.createElement("div", { className: props.className }, /* @__PURE__ */ import_react36.default.createElement("h1", { className: props.labelClassName }, props.label), /* @__PURE__ */ import_react36.default.createElement(import_react_chartjs_24.Bar, { data, options }));
1536
1590
  };
1537
1591
  // Annotate the CommonJS export names for ESM import in node:
1538
1592
  0 && (module.exports = {
@@ -1547,7 +1601,6 @@ var BarChart = (props) => {
1547
1601
  DoubleBarChart,
1548
1602
  DropDownGroup,
1549
1603
  FileUpload,
1550
- HighchartsLineChart,
1551
1604
  HorizontalBarChart,
1552
1605
  Image,
1553
1606
  LineChart,
package/dist/index.mjs CHANGED
@@ -319,7 +319,9 @@ var MultipleSelectElement = (props) => {
319
319
  import React11, { useEffect, useState as useState4 } from "react";
320
320
  var ButtonElement = (props) => {
321
321
  const [svgContent, setSvgContent] = useState4(null);
322
- const [originalSvgContent, setOriginalSvgContent] = useState4(null);
322
+ const [originalSvgContent, setOriginalSvgContent] = useState4(
323
+ null
324
+ );
323
325
  const [hoverColor, setHoverColor] = useState4(null);
324
326
  useEffect(() => {
325
327
  if (props.icon) {
@@ -384,12 +386,14 @@ var ButtonElement = (props) => {
384
386
  cursor: props.loading ? "no-drop" : "pointer"
385
387
  }
386
388
  },
387
- props.isLoading ? /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement("svg", { className: "animate-spin h-5 w-5 mr-3", viewBox: "0 0 24 24" }), props.label) : /* @__PURE__ */ React11.createElement(React11.Fragment, null, props.isSVGStylesOverride === false ? props.icon && /* @__PURE__ */ React11.createElement("img", { className: props.iconsClassName, src: props.icon, alt: props.label }) : svgContent && /* @__PURE__ */ React11.createElement(
388
- "span",
389
+ props.isLoading ? /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement("svg", { className: "animate-spin h-5 w-5 mr-3", viewBox: "0 0 24 24" }), props.label) : /* @__PURE__ */ React11.createElement(React11.Fragment, null, props.isSVGStylesOverride === false ? props.icon ? /* @__PURE__ */ React11.createElement(
390
+ "img",
389
391
  {
390
- dangerouslySetInnerHTML: { __html: svgContent }
392
+ className: props.iconsClassName,
393
+ src: props.icon,
394
+ alt: props.label
391
395
  }
392
- ), props.label)
396
+ ) : /* @__PURE__ */ React11.createElement("img", { src: "", alt: "", className: props.iconsClassName }) : svgContent && /* @__PURE__ */ React11.createElement("span", { dangerouslySetInnerHTML: { __html: svgContent } }), props.label)
393
397
  );
394
398
  };
395
399
 
@@ -608,7 +612,7 @@ var Navbar = (props) => {
608
612
  };
609
613
 
610
614
  // src/Components/TableElement.tsx
611
- import React20, { useState as useState6 } from "react";
615
+ import React20, { useState as useState6, useEffect as useEffect3 } from "react";
612
616
  import { Table as Table2 } from "antd";
613
617
 
614
618
  // src/Components/Model.tsx
@@ -653,9 +657,22 @@ var ModelElement = (props) => {
653
657
  margin: "-10px"
654
658
  }
655
659
  },
656
- Object.entries(selectedRecord).map(([key, value]) => {
657
- const record = columns.filter((eachColumn) => eachColumn.key === key);
658
- return record.length > 0 ? /* @__PURE__ */ React19.createElement("p", { style: { fontWeight: "500", padding: "10px" }, key }, /* @__PURE__ */ React19.createElement("span", { style: { fontWeight: "200", color: "gray", paddingRight: "10px" } }, record[0].title), String(value)) : "";
660
+ columns.map((eachColumn) => {
661
+ if (!["index", "View"].includes(eachColumn.key) && eachColumn?.["is_detail"] !== false) {
662
+ return /* @__PURE__ */ React19.createElement("p", { style: { fontWeight: "500", padding: "10px" } }, /* @__PURE__ */ React19.createElement(
663
+ "span",
664
+ {
665
+ style: {
666
+ fontWeight: "200",
667
+ color: "gray",
668
+ paddingRight: "10px"
669
+ }
670
+ },
671
+ eachColumn.title
672
+ ), selectedRecord[eachColumn.key] !== "" ? selectedRecord[eachColumn.key] : "--");
673
+ } else {
674
+ return null;
675
+ }
659
676
  })
660
677
  )
661
678
  },
@@ -664,12 +681,24 @@ var ModelElement = (props) => {
664
681
  };
665
682
 
666
683
  // src/Components/TableElement.tsx
684
+ import { EyeOutlined } from "@ant-design/icons";
667
685
  var TableElement = (props) => {
668
686
  const { thead, tbody } = props;
669
687
  const [selectedRecord, setSelectedRecord] = useState6({});
670
688
  const [model, setModel] = useState6(false);
689
+ const [dataSource, setDataSource] = useState6([]);
690
+ useEffect3(() => {
691
+ if (tbody) {
692
+ setDataSource(
693
+ tbody.map((row, index) => ({
694
+ ...row,
695
+ key: index,
696
+ index: index + 1
697
+ }))
698
+ );
699
+ }
700
+ }, [tbody]);
671
701
  const handleChange = (record) => {
672
- console.log("record", record);
673
702
  if (props.onChange) {
674
703
  props.onChange(record);
675
704
  }
@@ -679,8 +708,8 @@ var TableElement = (props) => {
679
708
  columns = [
680
709
  {
681
710
  title: "#",
682
- dataIndex: "#",
683
- key: "#",
711
+ dataIndex: "index",
712
+ key: "index",
684
713
  fixed: "left"
685
714
  },
686
715
  ...thead.map((col, ind) => ({
@@ -691,9 +720,9 @@ var TableElement = (props) => {
691
720
  render: col.render,
692
721
  sorter: {
693
722
  compare: (a, b) => {
694
- if (typeof a[col.key] === "number" && typeof a[col.key] === "number") {
723
+ if (typeof a[col.key] === "number" && typeof b[col.key] === "number") {
695
724
  return a[col.key] - b[col.key];
696
- } else if (typeof a[col.key] === "string" && typeof a[col.key] === "string") {
725
+ } else if (typeof a[col.key] === "string" && typeof b[col.key] === "string") {
697
726
  return a[col.key].localeCompare(b[col.key]);
698
727
  }
699
728
  }
@@ -705,26 +734,34 @@ var TableElement = (props) => {
705
734
  title: "View",
706
735
  dataIndex: "View",
707
736
  key: "View",
708
- render: (_, record) => /* @__PURE__ */ React20.createElement(
709
- "a",
710
- {
711
- onClick: () => {
712
- setSelectedRecord(record);
713
- handleChange(record);
714
- setModel(true);
715
- }
716
- },
717
- "View"
718
- )
737
+ render: (_, record) => {
738
+ return /* @__PURE__ */ React20.createElement(
739
+ "a",
740
+ {
741
+ onClick: () => {
742
+ if (props.view) {
743
+ setSelectedRecord(record);
744
+ handleChange(record);
745
+ setModel(true);
746
+ }
747
+ }
748
+ },
749
+ /* @__PURE__ */ React20.createElement(EyeOutlined, null)
750
+ );
751
+ }
719
752
  });
720
753
  }
721
754
  }
722
- const dataSource = tbody && tbody.map((row, index) => ({
723
- ...row,
724
- key: index + 1,
725
- [columns[0].key]: index + 1
726
- }));
727
- const count = dataSource ? dataSource.length : 0;
755
+ const onChangeTable = (pagination, filters, sorter, extra) => {
756
+ if (extra && extra.currentDataSource) {
757
+ setDataSource(
758
+ extra.currentDataSource.map((row, index) => ({
759
+ ...row,
760
+ index: index + 1
761
+ }))
762
+ );
763
+ }
764
+ };
728
765
  const onChangePage = (page, pageSize) => {
729
766
  if (props.onChange) {
730
767
  props.onChange({ name: "pagination", page, pageSize });
@@ -732,7 +769,11 @@ var TableElement = (props) => {
732
769
  };
733
770
  const rowSelectionConfig = props.rowSelection ? {
734
771
  onChange: (selectedRowKeys, selectedRows) => {
735
- console.log(`selectedRowKeys: ${selectedRowKeys}`, "selectedRows: ", selectedRows);
772
+ console.log(
773
+ `selectedRowKeys: ${selectedRowKeys}`,
774
+ "selectedRows: ",
775
+ selectedRows
776
+ );
736
777
  if (props.onChange) {
737
778
  props.onChange(selectedRows);
738
779
  }
@@ -742,19 +783,41 @@ var TableElement = (props) => {
742
783
  Table2,
743
784
  {
744
785
  className: props.className,
745
- pagination: {
786
+ pagination: props.pagination ? {
746
787
  showTotal: (total) => `Total: ${total} items`,
747
- total: count,
748
- showSizeChanger: count > 10,
788
+ total: props.count,
789
+ showSizeChanger: props.count ? props.count > 10 : 0 > 10,
749
790
  onChange: onChangePage
791
+ } : false,
792
+ onRow: (record) => {
793
+ return {
794
+ onClick: () => {
795
+ if (props.view) {
796
+ setSelectedRecord(record);
797
+ handleChange(record);
798
+ setModel(true);
799
+ }
800
+ },
801
+ style: { cursor: "pointer" }
802
+ };
750
803
  },
751
804
  rowSelection: rowSelectionConfig,
752
805
  dataSource,
753
806
  columns,
754
807
  size: props.size,
755
- bordered: true
808
+ bordered: true,
809
+ onChange: onChangeTable
810
+ }
811
+ ), model && /* @__PURE__ */ React20.createElement(
812
+ ModelElement,
813
+ {
814
+ selectedRecord,
815
+ ...props,
816
+ columns,
817
+ model,
818
+ onCancel: () => setModel(false)
756
819
  }
757
- ), model && /* @__PURE__ */ React20.createElement(ModelElement, { selectedRecord, ...props, columns, model, onCancel: () => setModel(false) }));
820
+ ));
758
821
  };
759
822
 
760
823
  // src/Components/DatePicker.tsx
@@ -973,7 +1036,7 @@ var Upload2 = (props) => {
973
1036
  };
974
1037
 
975
1038
  // src/Components/OtpElement.tsx
976
- import React30, { useState as useState11, useRef, useEffect as useEffect3 } from "react";
1039
+ import React30, { useState as useState11, useRef, useEffect as useEffect4 } from "react";
977
1040
  import { Input as Input3 } from "antd";
978
1041
  var OtpElement = (props) => {
979
1042
  const length = props.length;
@@ -1010,7 +1073,7 @@ var OtpElement = (props) => {
1010
1073
  });
1011
1074
  }
1012
1075
  };
1013
- useEffect3(() => {
1076
+ useEffect4(() => {
1014
1077
  inputRefs.current[0]?.focus();
1015
1078
  }, []);
1016
1079
  return /* @__PURE__ */ React30.createElement("div", { className: props.containerClassName }, Array.from({ length }).map((_, index) => /* @__PURE__ */ React30.createElement(
@@ -1262,7 +1325,7 @@ var HorizontalBarChart = (props) => {
1262
1325
  };
1263
1326
 
1264
1327
  // src/Components/LineChart.tsx
1265
- import React34, { useEffect as useEffect4, useRef as useRef2 } from "react";
1328
+ import React34, { useEffect as useEffect5, useRef as useRef2 } from "react";
1266
1329
  import Chart from "chart.js/auto";
1267
1330
  var LineChart = (props) => {
1268
1331
  const chartRef = useRef2(null);
@@ -1273,7 +1336,7 @@ var LineChart = (props) => {
1273
1336
  { label: "Conversion Rate", data: [50, 100, 150, 180, 50] }
1274
1337
  ];
1275
1338
  const labels = ["Instagram", "Whatsapp", "Messages", "Telegram", "Linkedin"];
1276
- useEffect4(() => {
1339
+ useEffect5(() => {
1277
1340
  if (chartRef.current) {
1278
1341
  if (chartInstance.current) {
1279
1342
  chartInstance.current.destroy();
@@ -1334,21 +1397,13 @@ var LineChart = (props) => {
1334
1397
  return /* @__PURE__ */ React34.createElement("div", { className: props.className }, /* @__PURE__ */ React34.createElement("canvas", { ref: chartRef }));
1335
1398
  };
1336
1399
 
1337
- // src/Components/highchart.tsx
1338
- import React35 from "react";
1339
- import Highcharts from "highcharts";
1340
- import HighchartsReact from "highcharts-react-official";
1341
- var HighchartsLineChart = (props) => {
1342
- return /* @__PURE__ */ React35.createElement("div", { className: props.className }, /* @__PURE__ */ React35.createElement(HighchartsReact, { highcharts: Highcharts, options: props.graph_data }));
1343
- };
1344
-
1345
1400
  // src/Components/DoubleBarChart.tsx
1346
- import React36, { useEffect as useEffect5, useRef as useRef3 } from "react";
1401
+ import React35, { useEffect as useEffect6, useRef as useRef3 } from "react";
1347
1402
  import Chart2 from "chart.js/auto";
1348
1403
  var DoubleBarChart = (props) => {
1349
1404
  const chartRef = useRef3(null);
1350
1405
  const chartInstance = useRef3(null);
1351
- useEffect5(() => {
1406
+ useEffect6(() => {
1352
1407
  if (chartRef.current) {
1353
1408
  if (chartInstance.current) {
1354
1409
  chartInstance.current.destroy();
@@ -1417,11 +1472,11 @@ var DoubleBarChart = (props) => {
1417
1472
  }
1418
1473
  };
1419
1474
  }, []);
1420
- return /* @__PURE__ */ React36.createElement("div", { className: props.className }, /* @__PURE__ */ React36.createElement("h1", { className: props.labelClassName }, props.label), /* @__PURE__ */ React36.createElement("canvas", { ref: chartRef }));
1475
+ return /* @__PURE__ */ React35.createElement("div", { className: props.className }, /* @__PURE__ */ React35.createElement("h1", { className: props.labelClassName }, props.label), /* @__PURE__ */ React35.createElement("canvas", { ref: chartRef }));
1421
1476
  };
1422
1477
 
1423
1478
  // src/Components/BarChart.tsx
1424
- import React37 from "react";
1479
+ import React36 from "react";
1425
1480
  import { Bar as Bar2 } from "react-chartjs-2";
1426
1481
  import {
1427
1482
  Chart as ChartJS4,
@@ -1489,7 +1544,7 @@ var BarChart = (props) => {
1489
1544
  }
1490
1545
  }
1491
1546
  };
1492
- return /* @__PURE__ */ React37.createElement("div", { className: props.className }, /* @__PURE__ */ React37.createElement("h1", { className: props.labelClassName }, props.label), /* @__PURE__ */ React37.createElement(Bar2, { data, options }));
1547
+ return /* @__PURE__ */ React36.createElement("div", { className: props.className }, /* @__PURE__ */ React36.createElement("h1", { className: props.labelClassName }, props.label), /* @__PURE__ */ React36.createElement(Bar2, { data, options }));
1493
1548
  };
1494
1549
  export {
1495
1550
  AddMoreTable,
@@ -1503,7 +1558,6 @@ export {
1503
1558
  DoubleBarChart,
1504
1559
  DropDownGroup,
1505
1560
  FileUpload,
1506
- HighchartsLineChart,
1507
1561
  HorizontalBarChart,
1508
1562
  Image,
1509
1563
  LineChart,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/ui-components",
3
- "version": "0.0.14-Beta178",
3
+ "version": "0.0.14-Beta179",
4
4
  "description": "Apex cura React components library",
5
5
  "keywords": [
6
6
  "apex cura",
package/postcss.config.js CHANGED
@@ -1,6 +1,6 @@
1
- module.exports = {
2
- plugins: {
3
- tailwindcss: {},
4
- autoprefixer: {},
5
- },
6
- }
1
+ module.exports = {
2
+ plugins: {
3
+ tailwindcss: {},
4
+ autoprefixer: {},
5
+ },
6
+ }
@@ -1,10 +1,10 @@
1
- /** @type {import('tailwindcss').Config} */
2
- module.exports = {
3
-
4
- content: ['./src/**/*.{js,jsx,ts,tsx}'],
5
- theme: {
6
- extend: {},
7
- },
8
- plugins: [],
9
- }
10
-
1
+ /** @type {import('tailwindcss').Config} */
2
+ module.exports = {
3
+
4
+ content: ['./src/**/*.{js,jsx,ts,tsx}'],
5
+ theme: {
6
+ extend: {},
7
+ },
8
+ plugins: [],
9
+ }
10
+