rez-table-listing-mui 1.2.10 → 1.2.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rez-table-listing-mui",
3
- "version": "1.2.10",
3
+ "version": "1.2.12",
4
4
  "type": "module",
5
5
  "description": "A rez table listing component built on TanStack Table",
6
6
  "main": "dist/index.js",
package/src/App.tsx CHANGED
@@ -26,15 +26,16 @@ import { SettingsDataProps } from "./types/filter-settings";
26
26
  import { FilterMasterStateProps } from "./types/filter";
27
27
  import { ColumnDef } from "@tanstack/react-table";
28
28
  import { ENTITY_TYPE } from "./libs/utils/common";
29
+ import { makeData, Person } from "./libs/utils/make-hierar-data";
29
30
 
30
31
  function App() {
31
32
  // const [mockLoading, setMockLoading] = useState<boolean>(true);
32
33
  // const [jsonData] = useState<any[]>([]);
33
34
  const [columns, setColumns] = useState<any[]>([]);
34
35
  const [searchTerm, setSearchTerm] = useState("");
35
- // const [data, setData] = useState<Person[]>(() => makeData(50, 3, 2));
36
+ const [data, setData] = useState<Person[]>(() => makeData(200, 3, 2));
36
37
 
37
- const [selectedTab, setSelectedTab] = useState("ALL");
38
+ const [selectedTab, setSelectedTab] = useState("All");
38
39
 
39
40
  const tableStates = useCraftTable();
40
41
  const filterSettingStates = useCraftTableFilterSettings();
@@ -195,9 +196,9 @@ function App() {
195
196
  (tab) => tab.tab_value?.toLowerCase() === "all"
196
197
  );
197
198
  if (allTab) {
198
- setSelectedTab(allTab.tab_value || "ALL");
199
+ setSelectedTab(allTab.tab_value || "All");
199
200
  } else {
200
- setSelectedTab(tabsData[0].tab_value || "ALL");
201
+ setSelectedTab(tabsData[0].tab_value || "All");
201
202
  }
202
203
  }
203
204
  }, [tabsData, selectedTab]);
@@ -205,7 +206,7 @@ function App() {
205
206
  const totalCount = useMemo(() => {
206
207
  return Number(
207
208
  tableData?.entity_tabs?.find((tab) => {
208
- const activeTab = selectedTab || "ALL";
209
+ const activeTab = selectedTab || "All";
209
210
  return (
210
211
  tab.tab_value?.toLocaleLowerCase() === activeTab.toLocaleLowerCase()
211
212
  );
@@ -225,6 +226,7 @@ function App() {
225
226
  fontWeight: 500,
226
227
  borderRadius: "4px",
227
228
  padding: "4px",
229
+ width: "fit-content",
228
230
  }}
229
231
  >
230
232
  {statusValue}
@@ -339,6 +341,8 @@ function App() {
339
341
 
340
342
  <TableWrapper
341
343
  data={filteredData}
344
+ // data={data}
345
+ // columns={defaultColumns}
342
346
  columns={columns && columns.length > 0 ? columns : defaultColumns}
343
347
  tableStates={tableStates}
344
348
  featureOptions={{
@@ -389,7 +393,7 @@ function App() {
389
393
  showIcon: true,
390
394
  onClick: () => setShowListViewSettings(!showListViewSettings),
391
395
  }}
392
- activeTab={selectedTab?.toUpperCase()}
396
+ activeTab={selectedTab}
393
397
  tableStates={tableStates}
394
398
  tabsData={tabsData}
395
399
  onClick={(state) => {
@@ -792,22 +792,22 @@ export const DragandDrogIcon = () => {
792
792
  );
793
793
  };
794
794
 
795
- export const SettingIcon = () => {
796
- return (
797
- <svg
798
- width="18"
799
- height="17"
800
- viewBox="0 0 18 17"
801
- fill="none"
802
- xmlns="http://www.w3.org/2000/svg"
803
- >
804
- <path
805
- d="M15.1935 9.31669C15.2269 9.05002 15.2519 8.78335 15.2519 8.50002C15.2519 8.21669 15.2269 7.95002 15.1935 7.68335L16.9519 6.30835C17.1102 6.18335 17.1518 5.95835 17.0518 5.77502L15.3852 2.89169C15.3102 2.75835 15.1685 2.68335 15.0185 2.68335C14.9685 2.68335 14.9185 2.69169 14.8768 2.70835L12.8018 3.54169C12.3685 3.20835 11.9018 2.93335 11.3935 2.72502L11.0768 0.516687C11.0518 0.316687 10.8769 0.166687 10.6685 0.166687H7.33518C7.12685 0.166687 6.95185 0.316687 6.92685 0.516687L6.61018 2.72502C6.10185 2.93335 5.63518 3.21669 5.20185 3.54169L3.12685 2.70835C3.07685 2.69169 3.02685 2.68335 2.97685 2.68335C2.83518 2.68335 2.69352 2.75835 2.61852 2.89169L0.95185 5.77502C0.843516 5.95835 0.893517 6.18335 1.05185 6.30835L2.81018 7.68335C2.77685 7.95002 2.75185 8.22502 2.75185 8.50002C2.75185 8.77502 2.77685 9.05002 2.81018 9.31669L1.05185 10.6917C0.893517 10.8167 0.85185 11.0417 0.95185 11.225L2.61852 14.1084C2.69352 14.2417 2.83518 14.3167 2.98518 14.3167C3.03518 14.3167 3.08518 14.3084 3.12685 14.2917L5.20185 13.4584C5.63518 13.7917 6.10185 14.0667 6.61018 14.275L6.92685 16.4834C6.95185 16.6834 7.12685 16.8334 7.33518 16.8334H10.6685C10.8769 16.8334 11.0518 16.6834 11.0768 16.4834L11.3935 14.275C11.9018 14.0667 12.3685 13.7834 12.8018 13.4584L14.8768 14.2917C14.9268 14.3084 14.9768 14.3167 15.0268 14.3167C15.1685 14.3167 15.3102 14.2417 15.3852 14.1084L17.0518 11.225C17.1518 11.0417 17.1102 10.8167 16.9519 10.6917L15.1935 9.31669ZM13.5435 7.89169C13.5769 8.15002 13.5852 8.32502 13.5852 8.50002C13.5852 8.67502 13.5685 8.85835 13.5435 9.10835L13.4268 10.05L14.1685 10.6334L15.0685 11.3334L14.4852 12.3417L13.4268 11.9167L12.5602 11.5667L11.8102 12.1334C11.4518 12.4 11.1102 12.6 10.7685 12.7417L9.88518 13.1L9.75185 14.0417L9.58518 15.1667H8.41852L8.12685 13.1L7.24352 12.7417C6.88518 12.5917 6.55185 12.4 6.21852 12.15L5.46018 11.5667L4.57685 11.925L3.51852 12.35L2.93518 11.3417L3.83518 10.6417L4.57685 10.0584L4.46018 9.11669C4.43518 8.85835 4.41852 8.66669 4.41852 8.50002C4.41852 8.33335 4.43518 8.14169 4.46018 7.89169L4.57685 6.95002L3.83518 6.36669L2.93518 5.66669L3.51852 4.65835L4.57685 5.08335L5.44352 5.43335L6.19352 4.86669C6.55185 4.60002 6.89352 4.40002 7.23518 4.25835L8.11852 3.90002L8.25185 2.95835L8.41852 1.83335H9.57685L9.86852 3.90002L10.7519 4.25835C11.1102 4.40835 11.4435 4.60002 11.7768 4.85002L12.5352 5.43335L13.4185 5.07502L14.4768 4.65002L15.0602 5.65835L14.1685 6.36669L13.4268 6.95002L13.5435 7.89169ZM9.00185 5.16669C7.16018 5.16669 5.66852 6.65835 5.66852 8.50002C5.66852 10.3417 7.16018 11.8334 9.00185 11.8334C10.8435 11.8334 12.3352 10.3417 12.3352 8.50002C12.3352 6.65835 10.8435 5.16669 9.00185 5.16669ZM9.00185 10.1667C8.08518 10.1667 7.33518 9.41669 7.33518 8.50002C7.33518 7.58335 8.08518 6.83335 9.00185 6.83335C9.91852 6.83335 10.6685 7.58335 10.6685 8.50002C10.6685 9.41669 9.91852 10.1667 9.00185 10.1667Z"
806
- fill="#1E1E1E"
807
- />
808
- </svg>
809
- );
810
- };
795
+ // export const SettingIcon = () => {
796
+ // return (
797
+ // <svg
798
+ // width="18"
799
+ // height="17"
800
+ // viewBox="0 0 18 17"
801
+ // fill="none"
802
+ // xmlns="http://www.w3.org/2000/svg"
803
+ // >
804
+ // <path
805
+ // d="M15.1935 9.31669C15.2269 9.05002 15.2519 8.78335 15.2519 8.50002C15.2519 8.21669 15.2269 7.95002 15.1935 7.68335L16.9519 6.30835C17.1102 6.18335 17.1518 5.95835 17.0518 5.77502L15.3852 2.89169C15.3102 2.75835 15.1685 2.68335 15.0185 2.68335C14.9685 2.68335 14.9185 2.69169 14.8768 2.70835L12.8018 3.54169C12.3685 3.20835 11.9018 2.93335 11.3935 2.72502L11.0768 0.516687C11.0518 0.316687 10.8769 0.166687 10.6685 0.166687H7.33518C7.12685 0.166687 6.95185 0.316687 6.92685 0.516687L6.61018 2.72502C6.10185 2.93335 5.63518 3.21669 5.20185 3.54169L3.12685 2.70835C3.07685 2.69169 3.02685 2.68335 2.97685 2.68335C2.83518 2.68335 2.69352 2.75835 2.61852 2.89169L0.95185 5.77502C0.843516 5.95835 0.893517 6.18335 1.05185 6.30835L2.81018 7.68335C2.77685 7.95002 2.75185 8.22502 2.75185 8.50002C2.75185 8.77502 2.77685 9.05002 2.81018 9.31669L1.05185 10.6917C0.893517 10.8167 0.85185 11.0417 0.95185 11.225L2.61852 14.1084C2.69352 14.2417 2.83518 14.3167 2.98518 14.3167C3.03518 14.3167 3.08518 14.3084 3.12685 14.2917L5.20185 13.4584C5.63518 13.7917 6.10185 14.0667 6.61018 14.275L6.92685 16.4834C6.95185 16.6834 7.12685 16.8334 7.33518 16.8334H10.6685C10.8769 16.8334 11.0518 16.6834 11.0768 16.4834L11.3935 14.275C11.9018 14.0667 12.3685 13.7834 12.8018 13.4584L14.8768 14.2917C14.9268 14.3084 14.9768 14.3167 15.0268 14.3167C15.1685 14.3167 15.3102 14.2417 15.3852 14.1084L17.0518 11.225C17.1518 11.0417 17.1102 10.8167 16.9519 10.6917L15.1935 9.31669ZM13.5435 7.89169C13.5769 8.15002 13.5852 8.32502 13.5852 8.50002C13.5852 8.67502 13.5685 8.85835 13.5435 9.10835L13.4268 10.05L14.1685 10.6334L15.0685 11.3334L14.4852 12.3417L13.4268 11.9167L12.5602 11.5667L11.8102 12.1334C11.4518 12.4 11.1102 12.6 10.7685 12.7417L9.88518 13.1L9.75185 14.0417L9.58518 15.1667H8.41852L8.12685 13.1L7.24352 12.7417C6.88518 12.5917 6.55185 12.4 6.21852 12.15L5.46018 11.5667L4.57685 11.925L3.51852 12.35L2.93518 11.3417L3.83518 10.6417L4.57685 10.0584L4.46018 9.11669C4.43518 8.85835 4.41852 8.66669 4.41852 8.50002C4.41852 8.33335 4.43518 8.14169 4.46018 7.89169L4.57685 6.95002L3.83518 6.36669L2.93518 5.66669L3.51852 4.65835L4.57685 5.08335L5.44352 5.43335L6.19352 4.86669C6.55185 4.60002 6.89352 4.40002 7.23518 4.25835L8.11852 3.90002L8.25185 2.95835L8.41852 1.83335H9.57685L9.86852 3.90002L10.7519 4.25835C11.1102 4.40835 11.4435 4.60002 11.7768 4.85002L12.5352 5.43335L13.4185 5.07502L14.4768 4.65002L15.0602 5.65835L14.1685 6.36669L13.4268 6.95002L13.5435 7.89169ZM9.00185 5.16669C7.16018 5.16669 5.66852 6.65835 5.66852 8.50002C5.66852 10.3417 7.16018 11.8334 9.00185 11.8334C10.8435 11.8334 12.3352 10.3417 12.3352 8.50002C12.3352 6.65835 10.8435 5.16669 9.00185 5.16669ZM9.00185 10.1667C8.08518 10.1667 7.33518 9.41669 7.33518 8.50002C7.33518 7.58335 8.08518 6.83335 9.00185 6.83335C9.91852 6.83335 10.6685 7.58335 10.6685 8.50002C10.6685 9.41669 9.91852 10.1667 9.00185 10.1667Z"
806
+ // fill="#1E1E1E"
807
+ // />
808
+ // </svg>
809
+ // );
810
+ // };
811
811
 
812
812
  export const DropDownIcon = () => {
813
813
  return (
@@ -954,3 +954,19 @@ export const ClosedEyeIcon = () => {
954
954
  </svg>
955
955
  );
956
956
  };
957
+
958
+ export const SettingIcon: React.FC = () => (
959
+ <svg
960
+ xmlns="http://www.w3.org/2000/svg"
961
+ width="20"
962
+ height="21"
963
+ viewBox="0 0 20 21"
964
+ fill="none"
965
+ >
966
+ <path
967
+ d="M11.3748 18.8346H8.62484C8.47206 18.8346 8.33664 18.786 8.21859 18.6888C8.10053 18.5916 8.02762 18.4666 7.99984 18.3138L7.6665 16.2096C7.40262 16.1124 7.12484 15.9805 6.83317 15.8138C6.5415 15.6471 6.28456 15.4735 6.06234 15.293L4.12484 16.1888C3.97206 16.2582 3.81928 16.2687 3.6665 16.2201C3.51373 16.1714 3.39567 16.0707 3.31234 15.918L1.93734 13.4805C1.854 13.3416 1.83317 13.1957 1.87484 13.043C1.9165 12.8902 1.99984 12.7652 2.12484 12.668L3.9165 11.3555C3.88873 11.2305 3.87137 11.0881 3.86442 10.9284C3.85748 10.7687 3.854 10.6263 3.854 10.5013C3.854 10.3763 3.85748 10.2339 3.86442 10.0742C3.87137 9.9145 3.88873 9.77214 3.9165 9.64714L2.12484 8.33464C1.99984 8.23741 1.9165 8.11241 1.87484 7.95964C1.83317 7.80686 1.854 7.66102 1.93734 7.52214L3.31234 5.08464C3.39567 4.93186 3.51373 4.83116 3.6665 4.78255C3.81928 4.73394 3.97206 4.74436 4.12484 4.8138L6.06234 5.70964C6.28456 5.52908 6.5415 5.35547 6.83317 5.1888C7.12484 5.02214 7.40262 4.89714 7.6665 4.8138L7.99984 2.6888C8.02762 2.53602 8.10053 2.41102 8.21859 2.3138C8.33664 2.21658 8.47206 2.16797 8.62484 2.16797H11.3748C11.5276 2.16797 11.663 2.21658 11.7811 2.3138C11.8991 2.41102 11.9721 2.53602 11.9998 2.6888L12.3332 4.79297C12.5971 4.89019 12.8783 5.01866 13.1769 5.17839C13.4755 5.33811 13.729 5.51519 13.9373 5.70964L15.8748 4.8138C16.0276 4.74436 16.1804 4.73394 16.3332 4.78255C16.4859 4.83116 16.604 4.93186 16.6873 5.08464L18.0623 7.5013C18.1457 7.64019 18.17 7.7895 18.1353 7.94922C18.1005 8.10894 18.0137 8.23741 17.8748 8.33464L16.0832 9.60547C16.1109 9.74436 16.1283 9.89366 16.1353 10.0534C16.1422 10.2131 16.1457 10.3624 16.1457 10.5013C16.1457 10.6402 16.1422 10.786 16.1353 10.9388C16.1283 11.0916 16.1109 11.2374 16.0832 11.3763L17.8748 12.668C17.9998 12.7652 18.0832 12.8902 18.1248 13.043C18.1665 13.1957 18.1457 13.3416 18.0623 13.4805L16.6873 15.918C16.604 16.0707 16.4859 16.1714 16.3332 16.2201C16.1804 16.2687 16.0276 16.2582 15.8748 16.1888L13.9373 15.293C13.7151 15.4735 13.4616 15.6506 13.1769 15.8242C12.8922 15.9978 12.6109 16.1263 12.3332 16.2096L11.9998 18.3138C11.9721 18.4666 11.8991 18.5916 11.7811 18.6888C11.663 18.786 11.5276 18.8346 11.3748 18.8346ZM9.99984 13.2096C10.7498 13.2096 11.3887 12.9457 11.9165 12.418C12.4443 11.8902 12.7082 11.2513 12.7082 10.5013C12.7082 9.7513 12.4443 9.11241 11.9165 8.58464C11.3887 8.05686 10.7498 7.79297 9.99984 7.79297C9.24984 7.79297 8.61095 8.05686 8.08317 8.58464C7.55539 9.11241 7.2915 9.7513 7.2915 10.5013C7.2915 11.2513 7.55539 11.8902 8.08317 12.418C8.61095 12.9457 9.24984 13.2096 9.99984 13.2096ZM9.99984 11.9596C9.59706 11.9596 9.25331 11.8173 8.96859 11.5326C8.68387 11.2478 8.5415 10.9041 8.5415 10.5013C8.5415 10.0985 8.68387 9.75477 8.96859 9.47005C9.25331 9.18533 9.59706 9.04297 9.99984 9.04297C10.4026 9.04297 10.7464 9.18533 11.0311 9.47005C11.3158 9.75477 11.4582 10.0985 11.4582 10.5013C11.4582 10.9041 11.3158 11.2478 11.0311 11.5326C10.7464 11.8173 10.4026 11.9596 9.99984 11.9596ZM9.08317 17.5846H10.9165L11.2082 15.2513C11.6665 15.1402 12.1005 14.9666 12.5103 14.7305C12.92 14.4944 13.2915 14.2096 13.6248 13.8763L15.8332 14.8346L16.6665 13.3346L14.7082 11.8971C14.7637 11.661 14.8089 11.4284 14.8436 11.1992C14.8783 10.9701 14.8957 10.7374 14.8957 10.5013C14.8957 10.2652 14.8818 10.0326 14.854 9.80339C14.8262 9.57422 14.7776 9.34158 14.7082 9.10547L16.6665 7.66797L15.8332 6.16797L13.6248 7.1263C13.3054 6.76519 12.9443 6.46311 12.5415 6.22005C12.1387 5.977 11.6943 5.82075 11.2082 5.7513L10.9165 3.41797H9.08317L8.7915 5.7513C8.31928 5.84852 7.87831 6.01519 7.46859 6.2513C7.05887 6.48741 6.69428 6.77908 6.37484 7.1263L4.1665 6.16797L3.33317 7.66797L5.2915 9.10547C5.23595 9.34158 5.19081 9.57422 5.15609 9.80339C5.12137 10.0326 5.104 10.2652 5.104 10.5013C5.104 10.7374 5.12137 10.9701 5.15609 11.1992C5.19081 11.4284 5.23595 11.661 5.2915 11.8971L3.33317 13.3346L4.1665 14.8346L6.37484 13.8763C6.70817 14.2096 7.0797 14.4944 7.48942 14.7305C7.89914 14.9666 8.33317 15.1402 8.7915 15.2513L9.08317 17.5846Z"
968
+ fill="#0E0C0B"
969
+ fill-opacity="0.7"
970
+ />
971
+ </svg>
972
+ );
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  ColumnDef,
3
+ ColumnMeta,
3
4
  getCoreRowModel,
4
5
  getExpandedRowModel,
5
6
  getPaginationRowModel,
@@ -21,6 +22,10 @@ import TableDND from "./table-dnd";
21
22
  import Table from "./table";
22
23
  import { useFullscreenPopoverContainer } from "../libs/hooks/useFullScreen";
23
24
 
25
+ interface CustomColumnMeta<T> extends ColumnMeta<T, unknown> {
26
+ defaultPinned?: "left" | "right" | undefined;
27
+ }
28
+
24
29
  function TableWrapper<T>({
25
30
  data = [],
26
31
  columns = [],
@@ -85,6 +90,17 @@ function TableWrapper<T>({
85
90
  }
86
91
  }, [columns]);
87
92
 
93
+ //For Default Column Pinning to work
94
+ useEffect(() => {
95
+ table.getAllLeafColumns().forEach((col) => {
96
+ const where = (col.columnDef.meta as CustomColumnMeta<T>)
97
+ ?.defaultPinned as "left" | "right" | undefined;
98
+ if (where && !col.getIsPinned()) {
99
+ col.pin(where);
100
+ }
101
+ });
102
+ }, [tableStates?.columnPinning?.left, metaColumns]);
103
+
88
104
  const [columnOrder, setColumnOrder] = useState<string[]>(() =>
89
105
  metaColumns.map((c) => c.id!)
90
106
  );
@@ -116,7 +116,7 @@
116
116
 
117
117
  .ts__head {
118
118
  position: relative;
119
- box-shadow: 0 2px 2px rgba(0, 0, 0, 0.05);
119
+ // box-shadow: 0 2px 2px rgba(0, 0, 0, 0.05); //removing shadow below table header
120
120
 
121
121
  .ts__head__tr {
122
122
  background-color: var(--white);
@@ -124,10 +124,11 @@
124
124
  .ts__head__th {
125
125
  position: relative;
126
126
  padding: 0.5rem 1rem;
127
- border: 1px solid var(--grey-300);
127
+ border: 1px solid var(--grey-500);
128
+ cursor: pointer;
128
129
 
129
130
  .ts__dnd__button {
130
- color: var(--grey-100);
131
+ color: var(--grey-300);
131
132
  // width: max-content;
132
133
  // height: max-content;
133
134
  // cursor: grabbing;
@@ -145,6 +146,7 @@
145
146
  display: flex;
146
147
  align-items: center;
147
148
  gap: 0.25rem;
149
+ min-height: 44px; // to give min height of 60 px
148
150
 
149
151
  .ts__content__sort {
150
152
  cursor: pointer;
@@ -28,7 +28,7 @@
28
28
 
29
29
  .pagination_btn_container {
30
30
  display: flex;
31
- gap: 0.5rem;
31
+ // gap: 0.3rem;
32
32
 
33
33
  .pagination_btn {
34
34
  position: relative;
@@ -71,3 +71,8 @@
71
71
  }
72
72
  }
73
73
  }
74
+
75
+ .rows_per_page_container select {
76
+ border-radius: 4px;
77
+ padding: 6px;
78
+ }
@@ -2,9 +2,11 @@ import { Table } from "@tanstack/react-table";
2
2
  import {
3
3
  TableFirstPageIcon,
4
4
  TableLastPageIcon,
5
- TableNextPageIcon,
6
- TablePreviousPageIcon,
5
+ // TableNextPageIcon,
6
+ // TablePreviousPageIcon,
7
7
  } from "../../../assets/svg";
8
+ import TablePreviousPageIcon from "@mui/icons-material/NavigateBeforeRounded";
9
+ import TableNextPageIcon from "@mui/icons-material/NavigateNextRounded";
8
10
  import "./index.scss";
9
11
  import { CraftTablePaginationProps } from "../../../types/table";
10
12
 
@@ -96,7 +98,7 @@ function DefaultPagination<T>({
96
98
  disabled={!table.getCanPreviousPage()}
97
99
  onClick={() => table.previousPage()}
98
100
  >
99
- <TablePreviousPageIcon />
101
+ <TablePreviousPageIcon fontSize="small" />
100
102
  </button>
101
103
  <button
102
104
  title="Next Page"
@@ -108,31 +108,33 @@ const QuickTab = ({
108
108
  );
109
109
 
110
110
  // Update the error state
111
- setSaveButtonError((prev) => {
112
- const otherMessages =
113
- prev?.messages?.filter((message) => message.type !== ERROR_CODE) ||
114
- [];
115
-
116
- return {
117
- ...prev,
118
- hasError: true,
119
- messages: hasQuickTabError
120
- ? [...prev?.messages]
121
- : [...otherMessages, errorMessage],
122
- };
123
- });
111
+
112
+ // Later we can use this to show error message when we will make error logic more simple
113
+ // setSaveButtonError((prev) => {
114
+ // const otherMessages =
115
+ // prev?.messages?.filter((message) => message.type !== ERROR_CODE) ||
116
+ // [];
117
+
118
+ // return {
119
+ // ...prev,
120
+ // hasError: true,
121
+ // messages: hasQuickTabError
122
+ // ? [...prev?.messages]
123
+ // : [...otherMessages, errorMessage],
124
+ // };
125
+ // });
124
126
  } else {
125
127
  const hasOtherMessages = saveButtonError?.messages?.some(
126
128
  (message) => message.type !== ERROR_CODE
127
129
  );
128
130
  // Reset error state if the list is valid
129
- setSaveButtonError((prev) => ({
130
- ...prev,
131
- hasError: hasOtherMessages,
132
- messages:
133
- prev?.messages?.filter((message) => message.type !== ERROR_CODE) ||
134
- [],
135
- }));
131
+ // setSaveButtonError((prev) => ({
132
+ // ...prev,
133
+ // hasError: hasOtherMessages,
134
+ // messages:
135
+ // prev?.messages?.filter((message) => message.type !== ERROR_CODE) ||
136
+ // [],
137
+ // }));
136
138
  }
137
139
  }
138
140
  }, [quickTabStates?.hide_list, quickTabStates?.show_list]);
@@ -149,6 +149,7 @@ export function QuickFilterSettings({
149
149
  <DialogActions>
150
150
  <CustomButton
151
151
  // disabled={saveButtonError?.hasError}
152
+ disabled={saveButtonError?.hasError}
152
153
  onClick={handleSaveSetSettingsData}
153
154
  >
154
155
  Save Quick Filter
@@ -5,6 +5,7 @@ import SettingsOutlinedIcon from "@mui/icons-material/SettingsOutlined";
5
5
  import { settingsOptionsProps } from "../../types/table";
6
6
  import { tableTabsStyles } from "./styles";
7
7
  import { useMemo } from "react";
8
+ import { SettingIcon } from "../../assets/svg";
8
9
 
9
10
  interface TabDataProps {
10
11
  tab_value: string | null;
@@ -24,7 +25,7 @@ interface TableTabsProps {
24
25
  export function TableTabs({
25
26
  loading = false,
26
27
  tabsData = [],
27
- activeTab = "ALL",
28
+ activeTab = "All",
28
29
  onClick,
29
30
  tableStates,
30
31
  settingsOptions,
@@ -42,13 +43,13 @@ export function TableTabs({
42
43
  ?.filter((tab) => tab.tab_value !== null)
43
44
  ?.map((tab) => ({
44
45
  ...tab,
45
- tab_value: tab.tab_value?.toUpperCase(),
46
+ tab_value: tab.tab_value,
46
47
  }));
47
48
  }, [tabsData]);
48
49
 
49
50
  const defaultTab = useMemo(() => {
50
51
  return (
51
- normalizedTabs.find((t) => t.tab_value === "ALL")?.tab_value ||
52
+ normalizedTabs.find((t) => t.tab_value === "All")?.tab_value ||
52
53
  normalizedTabs[0]?.tab_value ||
53
54
  ""
54
55
  );
@@ -62,9 +63,9 @@ export function TableTabs({
62
63
  {settingsOptions?.showIcon && (
63
64
  <IconButton
64
65
  onClick={settingsOptions?.onClick}
65
- sx={{ zIndex: 1000, mx: 1 }}
66
+ sx={{ zIndex: 1000, mx: 0 }}
66
67
  >
67
- <SettingsOutlinedIcon />
68
+ <SettingIcon />
68
69
  </IconButton>
69
70
  )}
70
71
 
@@ -91,12 +92,17 @@ export function TableTabs({
91
92
  sx={{
92
93
  ...tableTabsStyles.tabCount,
93
94
  ...(isSelected && {
94
- backgroundColor: "#ced3da",
95
- borderColor: "#ced3da",
95
+ // backgroundColor: "#ced3da",
96
+ // borderColor: "#ced3da",
97
+ backgroundColor: "#000",
98
+ color: "#fff",
99
+ fontWeight: "500",
96
100
  }),
97
101
  }}
98
102
  >
99
- {tab_value_count}
103
+ {tab_value_count == 0
104
+ ? "0"
105
+ : String(tab_value_count).padStart(2, "0")}
100
106
  </Box>
101
107
  </Box>
102
108
  }
@@ -26,8 +26,9 @@ export const tableTabsStyles: TabStylesProps = {
26
26
  },
27
27
 
28
28
  tabCount: {
29
- padding: "2px 6px",
30
- borderRadius: "4px",
31
- border: "1px solid #888",
29
+ padding: "2px 3px",
30
+ borderRadius: "6px",
31
+ border: "1px solid #0E0C0BE6",
32
+ color: "#0E0C0B",
32
33
  },
33
34
  };
@@ -175,13 +175,29 @@ function Topbar<T>({
175
175
  {rightSideComponent}
176
176
  {paginationComponent}
177
177
 
178
- {showSearch && (
178
+ {/* {showSearch && (
179
179
  <div title="Search">
180
180
  <TableSearch
181
181
  value={searchValue ?? ""}
182
182
  onChange={onSearchChange ?? (() => {})}
183
183
  />
184
184
  </div>
185
+ )} */}
186
+ {showSearch && (
187
+ <div
188
+ title="Search"
189
+ className="external-search-trigger"
190
+ onClick={() => {
191
+ const customEvent = new CustomEvent("triggerSearchInput");
192
+ window.dispatchEvent(customEvent);
193
+ }}
194
+ ref={searchContainerRef}
195
+ >
196
+ <TableSearch
197
+ value={searchValue ?? ""}
198
+ onChange={onSearchChange ?? (() => {})}
199
+ />
200
+ </div>
185
201
  )}
186
202
 
187
203
  {showChangeLayoutToggle && (
@@ -1,4 +1,5 @@
1
1
  import {
2
+ ColumnPinningState,
2
3
  ExpandedState,
3
4
  PaginationState,
4
5
  RowSelectionState,
@@ -49,6 +50,12 @@ export function useCraftTable(paginationPageSize: number = 25) {
49
50
  );
50
51
  }
51
52
 
53
+ // For Default Column Pinning
54
+ const [columnPinning, setColumnPinning] = useState<ColumnPinningState>({
55
+ left: [],
56
+ right: [],
57
+ });
58
+
52
59
  const craftTableOptions: CraftTableOptionsProps = {
53
60
  sorting: sorting,
54
61
  setSorting: setSorting,
@@ -74,6 +81,8 @@ export function useCraftTable(paginationPageSize: number = 25) {
74
81
  setShowTableFilter: setShowTableFilter,
75
82
  showFilterOptions: showFilterOptions,
76
83
  setShowFilterOption: setShowFilterOption,
84
+ columnPinning: columnPinning,
85
+ setColumnPinning: setColumnPinning,
77
86
  };
78
87
 
79
88
  return craftTableOptions;
@@ -58,7 +58,7 @@ export const useDefaultColumns = () => {
58
58
  header: "Last Name",
59
59
  accessorKey: "lastName",
60
60
  size: 100,
61
- meta: { label: "Last Name" },
61
+ meta: { label: "Last Name", defaultPinned: "left" },
62
62
  },
63
63
  {
64
64
  header: "Email Id",
@@ -97,6 +97,7 @@ export const useDefaultColumns = () => {
97
97
  label: "Status",
98
98
  type: "custom",
99
99
  propName: "renderStatus",
100
+ align: "right",
100
101
  },
101
102
  },
102
103
  {
@@ -106,6 +107,7 @@ export const useDefaultColumns = () => {
106
107
  label: "Action",
107
108
  type: "custom",
108
109
  propName: "renderAction",
110
+ align: "right",
109
111
  },
110
112
  },
111
113
  ],
@@ -78,7 +78,7 @@ export function customDebounce<T extends (...args: any[]) => any>(
78
78
 
79
79
  //ENTITY TYPE
80
80
  const ENVIRONMENT = "uat";
81
- export const ENTITY_TYPE = "NTM";
81
+ export const ENTITY_TYPE = "ROL";
82
82
 
83
83
  const environments = {
84
84
  adm_dev: "http://localhost:4010/api",
@@ -3,6 +3,7 @@ import {
3
3
  RowSelectionState,
4
4
  SortingState,
5
5
  ExpandedState,
6
+ ColumnPinningState,
6
7
  } from "@tanstack/react-table";
7
8
  import { Dispatch, SetStateAction } from "react";
8
9
  import {
@@ -45,6 +46,8 @@ export interface CraftTableOptionsProps {
45
46
  setShowTableFilter: Dispatch<SetStateAction<boolean>>;
46
47
  showFilterOptions: boolean;
47
48
  setShowFilterOption: Dispatch<SetStateAction<boolean>>;
49
+ columnPinning: ColumnPinningState;
50
+ setColumnPinning: Dispatch<SetStateAction<ColumnPinningState>>;
48
51
  }
49
52
 
50
53
  export interface craftTableFilterSettingsOptionsProps {