@apexcura/ui-components 0.0.15-Beta32 → 0.0.15-Beta34

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.d.mts CHANGED
@@ -114,7 +114,14 @@ declare const Sidebar: (props: ElementType) => React$1.JSX.Element;
114
114
 
115
115
  declare const Navbar: (props: ElementType) => React$1.JSX.Element;
116
116
 
117
- declare const TableElement: (props: ElementType) => React$1.JSX.Element;
117
+ interface PaginationType {
118
+ page?: number;
119
+ pageSize?: number;
120
+ }
121
+ interface TableElementProps extends ElementType {
122
+ value?: PaginationType;
123
+ }
124
+ declare const TableElement: (props: TableElementProps) => React$1.JSX.Element;
118
125
 
119
126
  declare const DatePickerElement: (props: ElementType) => React$1.JSX.Element;
120
127
 
package/dist/index.d.ts CHANGED
@@ -114,7 +114,14 @@ declare const Sidebar: (props: ElementType) => React$1.JSX.Element;
114
114
 
115
115
  declare const Navbar: (props: ElementType) => React$1.JSX.Element;
116
116
 
117
- declare const TableElement: (props: ElementType) => React$1.JSX.Element;
117
+ interface PaginationType {
118
+ page?: number;
119
+ pageSize?: number;
120
+ }
121
+ interface TableElementProps extends ElementType {
122
+ value?: PaginationType;
123
+ }
124
+ declare const TableElement: (props: TableElementProps) => React$1.JSX.Element;
118
125
 
119
126
  declare const DatePickerElement: (props: ElementType) => React$1.JSX.Element;
120
127
 
package/dist/index.js CHANGED
@@ -772,7 +772,7 @@ var TableElement = (props) => {
772
772
  key: "index",
773
773
  fixed: "left"
774
774
  },
775
- ...thead.map((col, ind) => ({
775
+ ...thead.map((col) => ({
776
776
  title: col.label,
777
777
  dataIndex: col.name,
778
778
  key: col.key,
@@ -780,34 +780,27 @@ var TableElement = (props) => {
780
780
  render: col.render,
781
781
  sorter: {
782
782
  compare: (a, b) => {
783
- if (typeof a[col.key] === "number" && typeof b[col.key] === "number") {
784
- return a[col.key] - b[col.key];
785
- } else if (typeof a[col.key] === "string" && typeof b[col.key] === "string") {
786
- return a[col.key].localeCompare(b[col.key]);
783
+ const aValue = a[col.key];
784
+ const bValue = b[col.key];
785
+ if (typeof aValue === "number" && typeof bValue === "number") {
786
+ return aValue - bValue;
787
+ } else if (typeof aValue === "string" && typeof bValue === "string") {
788
+ return aValue.localeCompare(bValue);
789
+ } else {
790
+ return 0;
787
791
  }
788
792
  }
789
793
  }
790
794
  }))
791
795
  ];
792
796
  }
793
- const onChangeTable = (pagination, filters, sorter, extra) => {
794
- if (extra && extra.currentDataSource) {
795
- setDataSource(
796
- extra.currentDataSource.map((row, index) => ({
797
- ...row,
798
- index: index + 1
799
- }))
800
- );
801
- console.log(dataSource);
802
- }
803
- };
804
797
  const onChangePage = (page, pageSize) => {
805
798
  if (props.onChange) {
806
799
  props.onChange({ name: "pagination", page, pageSize });
807
800
  }
808
801
  };
809
802
  const rowSelectionConfig = props.rowSelection ? {
810
- onChange: (selectedRowKeys, selectedRows) => {
803
+ onChange: (selectedRows) => {
811
804
  if (props.onChange) {
812
805
  props.onChange(selectedRows);
813
806
  }
@@ -819,7 +812,7 @@ var TableElement = (props) => {
819
812
  loading: props.loading,
820
813
  className: props.className,
821
814
  pagination: props.pagination ? {
822
- current: props.value && props.value.page && props.value.page,
815
+ current: props.value?.page,
823
816
  showTotal: (total) => `Total: ${total} items`,
824
817
  total: props.count,
825
818
  showSizeChanger: props.count ? props.count > 10 : 0 > 10,
@@ -829,8 +822,7 @@ var TableElement = (props) => {
829
822
  dataSource,
830
823
  columns,
831
824
  size: props.size,
832
- bordered: true,
833
- onChange: onChangeTable
825
+ bordered: true
834
826
  }
835
827
  ));
836
828
  };
@@ -1017,11 +1009,6 @@ var FileUpload = (props) => {
1017
1009
  });
1018
1010
  }
1019
1011
  };
1020
- const customRequest = ({ file, onSuccess }) => {
1021
- setTimeout(() => {
1022
- onSuccess("ok");
1023
- }, 0);
1024
- };
1025
1012
  return /* @__PURE__ */ import_react25.default.createElement("div", null, /* @__PURE__ */ import_react25.default.createElement(
1026
1013
  Dragger,
1027
1014
  {
@@ -1032,8 +1019,7 @@ var FileUpload = (props) => {
1032
1019
  multiple: props.multiple,
1033
1020
  fileList: files,
1034
1021
  onChange: handleChange,
1035
- showUploadList: true,
1036
- customRequest
1022
+ showUploadList: true
1037
1023
  },
1038
1024
  /* @__PURE__ */ import_react25.default.createElement("p", null, /* @__PURE__ */ import_react25.default.createElement(import_icons5.InboxOutlined, null)),
1039
1025
  /* @__PURE__ */ import_react25.default.createElement("p", null, "Click or drag file to upload")
package/dist/index.mjs CHANGED
@@ -703,7 +703,7 @@ var TableElement = (props) => {
703
703
  key: "index",
704
704
  fixed: "left"
705
705
  },
706
- ...thead.map((col, ind) => ({
706
+ ...thead.map((col) => ({
707
707
  title: col.label,
708
708
  dataIndex: col.name,
709
709
  key: col.key,
@@ -711,34 +711,27 @@ var TableElement = (props) => {
711
711
  render: col.render,
712
712
  sorter: {
713
713
  compare: (a, b) => {
714
- if (typeof a[col.key] === "number" && typeof b[col.key] === "number") {
715
- return a[col.key] - b[col.key];
716
- } else if (typeof a[col.key] === "string" && typeof b[col.key] === "string") {
717
- return a[col.key].localeCompare(b[col.key]);
714
+ const aValue = a[col.key];
715
+ const bValue = b[col.key];
716
+ if (typeof aValue === "number" && typeof bValue === "number") {
717
+ return aValue - bValue;
718
+ } else if (typeof aValue === "string" && typeof bValue === "string") {
719
+ return aValue.localeCompare(bValue);
720
+ } else {
721
+ return 0;
718
722
  }
719
723
  }
720
724
  }
721
725
  }))
722
726
  ];
723
727
  }
724
- const onChangeTable = (pagination, filters, sorter, extra) => {
725
- if (extra && extra.currentDataSource) {
726
- setDataSource(
727
- extra.currentDataSource.map((row, index) => ({
728
- ...row,
729
- index: index + 1
730
- }))
731
- );
732
- console.log(dataSource);
733
- }
734
- };
735
728
  const onChangePage = (page, pageSize) => {
736
729
  if (props.onChange) {
737
730
  props.onChange({ name: "pagination", page, pageSize });
738
731
  }
739
732
  };
740
733
  const rowSelectionConfig = props.rowSelection ? {
741
- onChange: (selectedRowKeys, selectedRows) => {
734
+ onChange: (selectedRows) => {
742
735
  if (props.onChange) {
743
736
  props.onChange(selectedRows);
744
737
  }
@@ -750,7 +743,7 @@ var TableElement = (props) => {
750
743
  loading: props.loading,
751
744
  className: props.className,
752
745
  pagination: props.pagination ? {
753
- current: props.value && props.value.page && props.value.page,
746
+ current: props.value?.page,
754
747
  showTotal: (total) => `Total: ${total} items`,
755
748
  total: props.count,
756
749
  showSizeChanger: props.count ? props.count > 10 : 0 > 10,
@@ -760,8 +753,7 @@ var TableElement = (props) => {
760
753
  dataSource,
761
754
  columns,
762
755
  size: props.size,
763
- bordered: true,
764
- onChange: onChangeTable
756
+ bordered: true
765
757
  }
766
758
  ));
767
759
  };
@@ -948,11 +940,6 @@ var FileUpload = (props) => {
948
940
  });
949
941
  }
950
942
  };
951
- const customRequest = ({ file, onSuccess }) => {
952
- setTimeout(() => {
953
- onSuccess("ok");
954
- }, 0);
955
- };
956
943
  return /* @__PURE__ */ React25.createElement("div", null, /* @__PURE__ */ React25.createElement(
957
944
  Dragger,
958
945
  {
@@ -963,8 +950,7 @@ var FileUpload = (props) => {
963
950
  multiple: props.multiple,
964
951
  fileList: files,
965
952
  onChange: handleChange,
966
- showUploadList: true,
967
- customRequest
953
+ showUploadList: true
968
954
  },
969
955
  /* @__PURE__ */ React25.createElement("p", null, /* @__PURE__ */ React25.createElement(InboxOutlined, null)),
970
956
  /* @__PURE__ */ React25.createElement("p", null, "Click or drag file to upload")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apexcura/ui-components",
3
- "version": "0.0.15-Beta32",
3
+ "version": "0.0.15-Beta34",
4
4
  "description": "Apex cura React components library",
5
5
  "keywords": [
6
6
  "apex cura",