rez-table-listing-mui 2.0.14 → 2.0.15

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.
@@ -21,6 +21,9 @@ export interface QuickFilterModalProps {
21
21
  activeTab?: string;
22
22
  selectAttributeData?: { label: string; value: string }[];
23
23
  selectSwinLandData?: { label: string; value: string }[];
24
+ laneHideListData?: { label: string; value: string }[];
25
+ swimLaneHideListData?: { label: string; value: string }[];
26
+ onSaveKanbanSettingsData?: (data: KanbanSettingsDataProps) => void;
24
27
  }
25
28
 
26
29
  type TabName = string;
@@ -33,6 +36,15 @@ export type QuickTabSortingType =
33
36
  | "count_dsc"
34
37
  | "custom";
35
38
 
39
+ export type KanbanSortingType =
40
+ | "asc"
41
+ | "dsc"
42
+ | "count_asc"
43
+ | "count_dsc"
44
+ | "custom"
45
+ | "sort_by"
46
+ | null;
47
+
36
48
  export interface QuickTabConfigProps {
37
49
  attribute?: string;
38
50
  sorting?: QuickTabSortingType;
@@ -41,6 +53,19 @@ export interface QuickTabConfigProps {
41
53
  isAllSelected?: boolean;
42
54
  isCombineOther?: boolean;
43
55
  }
56
+ export interface LaneTabConfigProps {
57
+ attribute?: string;
58
+ sorting?: KanbanSortingType;
59
+ hide_list?: { label: string; value: string }[];
60
+ show_list?: { label: string; value: string }[];
61
+ isSubLane?: boolean;
62
+ }
63
+ export interface SwimLameTabConfigProps {
64
+ attribute?: string;
65
+ sorting?: KanbanSortingType;
66
+ hide_list?: { label: string; value: string }[];
67
+ show_list?: { label: string; value: string }[];
68
+ }
44
69
 
45
70
  interface ColumnItem {
46
71
  label: string;
@@ -117,6 +142,10 @@ export interface SettingsDataProps {
117
142
  column?: ColumnTabConfigProps;
118
143
  sorting?: SortingConfigProps;
119
144
  }
145
+ export interface KanbanSettingsDataProps {
146
+ lane?: LaneTabConfigProps;
147
+ swim_lane?: SwimLameTabConfigProps;
148
+ }
120
149
 
121
150
  export interface ToggleButtonTabsProps {
122
151
  label: string;
@@ -15,6 +15,7 @@ import {
15
15
  } from "./filter";
16
16
  import {
17
17
  ColumnTabConfigProps,
18
+ KanbanSettingsDataProps,
18
19
  QuickTabConfigProps,
19
20
  SavedButtonErrorProps,
20
21
  SettingsDataProps,
@@ -61,6 +62,8 @@ export interface CraftTableOptionsProps {
61
62
  export interface craftTableFilterSettingsOptionsProps {
62
63
  settingsData: SettingsDataProps;
63
64
  setSettingsData: Dispatch<SetStateAction<SettingsDataProps>>;
65
+ kanbanSettingsData: KanbanSettingsDataProps;
66
+ setKanbanSettingsData: Dispatch<SetStateAction<KanbanSettingsDataProps>>;
64
67
  showListViewSettings: boolean;
65
68
  setShowListViewSettings: Dispatch<SetStateAction<boolean>>;
66
69
  quickTabStates: QuickTabConfigProps;
@@ -1,23 +1,52 @@
1
- import { useState } from "react";
1
+ import { useEffect, useState } from "react";
2
2
  import Kanban from "../kanban";
3
3
  import LeadCard from "../kanban/components/LeadCard";
4
- import { kanbanDropdownResults, useGetKanbanData } from "../kanban/hooks/hooks";
4
+ import {
5
+ kanbanDropdownResults,
6
+ useGetAttributeDropdown,
7
+ useGetKanbanData,
8
+ } from "../kanban/hooks/hooks";
5
9
  import { useCraftTable } from "../listing/libs/hooks/useCraftTable";
6
10
  import {
7
11
  useEntityTableAPI,
8
12
  useGetSettingsDataAPI,
13
+ useSaveSettingsDataAPI,
9
14
  } from "../listing/libs/hooks/useEntityTableAPI";
10
- import { ENTITY_TYPE } from "../listing/libs/utils/common";
15
+ import { ENTITY_TYPE, MAPPED_ENTITY_TYPE } from "../listing/libs/utils/common";
11
16
  import { useCraftTableFilterSettings } from "../listing/libs/hooks/useCraftTableFilterSettings";
12
17
  import { QuickFilterSettings } from "../listing/components/table-settings";
18
+ import { KanbanSettingsDataProps } from "../listing/types/filter-settings";
19
+ import { useQueryClient } from "@tanstack/react-query";
13
20
 
14
21
  const KanbanView = () => {
15
22
  const { metaData, isLoading } = useGetKanbanData("LEAD");
16
- const { getSettingsAPIData } = useGetSettingsDataAPI(ENTITY_TYPE);
23
+ const { getSettingsAPIData } = useGetSettingsDataAPI(ENTITY_TYPE, "kanban");
17
24
  const [selectedTab, setSelectedTab] = useState("All");
18
25
  const tableStates = useCraftTable();
26
+
27
+ const filterSettingStates = useCraftTableFilterSettings();
28
+
29
+ const {
30
+ showListViewSettings,
31
+ setShowListViewSettings,
32
+ kanbanSettingsData,
33
+ setKanbanSettingsData,
34
+ } = filterSettingStates;
35
+
36
+ const { data: laneHideListData } = useGetAttributeDropdown(
37
+ "LEAD",
38
+ kanbanSettingsData?.lane?.attribute ?? ""
39
+ );
40
+ const { data: swimLaneHideListData } = useGetAttributeDropdown(
41
+ "LEAD",
42
+ kanbanSettingsData?.swim_lane?.attribute ?? ""
43
+ );
44
+ const queryClient = useQueryClient();
45
+
19
46
  const [selectAttributeData] = kanbanDropdownResults("ATT", "1001");
20
47
  const [selectSwinLandData] = kanbanDropdownResults("SWM", "1001");
48
+ const { saveSettingsDataMutation: saveKanbanSettingsDataMutation } =
49
+ useSaveSettingsDataAPI(ENTITY_TYPE);
21
50
 
22
51
  const { tableData } = useEntityTableAPI({
23
52
  page: 0,
@@ -39,10 +68,36 @@ const KanbanView = () => {
39
68
  ],
40
69
  attributeFilter: [],
41
70
  });
42
- const filterSettingStates = useCraftTableFilterSettings();
43
71
 
44
- const { showListViewSettings, setShowListViewSettings, setSettingsData } =
45
- filterSettingStates;
72
+ const handleSaveKanbanSetSettingsData = (
73
+ kanbanSettingsData: KanbanSettingsDataProps
74
+ ) => {
75
+ console.log("kanbanSettingsData", kanbanSettingsData);
76
+
77
+ const payload = {
78
+ entity_type: MAPPED_ENTITY_TYPE,
79
+ mapped_entity_type: ENTITY_TYPE,
80
+ mapped_json: kanbanSettingsData,
81
+ type: "kanban",
82
+ };
83
+
84
+ saveKanbanSettingsDataMutation.mutate(
85
+ { payload },
86
+ {
87
+ onSuccess: () => {
88
+ queryClient.invalidateQueries({
89
+ queryKey: ["GET_NAVIGATION_LAYOUT", ENTITY_TYPE],
90
+ });
91
+ queryClient.invalidateQueries({
92
+ queryKey: ["meta", ENTITY_TYPE],
93
+ });
94
+ },
95
+ }
96
+ );
97
+ };
98
+ useEffect(() => {
99
+ setKanbanSettingsData(getSettingsAPIData?.mapped_json || {});
100
+ }, [getSettingsAPIData]);
46
101
 
47
102
  return (
48
103
  <div>
@@ -62,6 +117,9 @@ const KanbanView = () => {
62
117
  columnsDataLoading={isLoading}
63
118
  selectAttributeData={selectAttributeData?.data}
64
119
  selectSwinLandData={selectSwinLandData?.data}
120
+ laneHideListData={laneHideListData}
121
+ swimLaneHideListData={swimLaneHideListData}
122
+ onSaveKanbanSettingsData={handleSaveKanbanSetSettingsData}
65
123
  // tabsApiData={settingsTabDropdownData || []}
66
124
  // tabsApiDataLoading={settingsTabDropdownPending}
67
125
  // onSaveSettingsData={handleSaveSettingsData}