rez-table-listing-mui 2.0.10 → 2.0.11

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": "2.0.10",
3
+ "version": "2.0.11",
4
4
  "type": "module",
5
5
  "description": "A rez table listing component built on TanStack Table",
6
6
  "main": "dist/index.js",
@@ -23,6 +23,7 @@ const AttributesFilter = ({
23
23
  setSearchTerm,
24
24
  tabValue,
25
25
  onChangeFunction,
26
+ isFlatJson,
26
27
  }: AttributesFilterProps) => {
27
28
  const { filterMaster, setFilterMaster, filters, setFilters } = tableStates;
28
29
 
@@ -16,12 +16,14 @@ const FormMultiSelect = ({
16
16
  dropdownData,
17
17
  sx,
18
18
  onValueChange,
19
+ isFlatJson,
19
20
  }: {
20
21
  filter: FilterStateProps;
21
22
  control: any;
22
23
  dropdownData: Record<string, DropdownOption[]>;
23
24
  sx?: SxProps<Theme>;
24
25
  onValueChange?: () => void;
26
+ isFlatJson: boolean;
25
27
  }) => {
26
28
  const options = dropdownData[filter.filter_attribute] || [];
27
29
 
@@ -72,7 +74,10 @@ const FormMultiSelect = ({
72
74
  }}
73
75
  >
74
76
  {options?.map((item, idx) => (
75
- <MenuItem key={idx} value={item.value}>
77
+ <MenuItem
78
+ key={idx}
79
+ value={isFlatJson ? item.label : item.value}
80
+ >
76
81
  <Checkbox
77
82
  checked={cleanedValue.includes(item.value)}
78
83
  sx={{ marginRight: 1 }}
@@ -40,6 +40,7 @@ const FilterForm = ({
40
40
  setDeleteFilterModalOpen,
41
41
  onChangeFunction,
42
42
  filterComponentOptions,
43
+ isFlatJson,
43
44
  }: {
44
45
  columnsData: FilterColumnsDataProps;
45
46
  dropdownData: FilterDropdownDataProps;
@@ -55,6 +56,7 @@ const FilterForm = ({
55
56
  filterMaster,
56
57
  }: onFilterChangeFunctionProps) => void;
57
58
  filterComponentOptions?: FilterComponentOptions;
59
+ isFlatJson: boolean;
58
60
  }) => {
59
61
  const { filterMaster, filters, setFilters, setFilterMaster, setPagination } =
60
62
  tableStates;
@@ -393,6 +395,7 @@ const FilterForm = ({
393
395
  control,
394
396
  dropdownData,
395
397
  updateFiltersFromForm,
398
+ isFlatJson,
396
399
  });
397
400
  })()}
398
401
  </Box>
@@ -26,12 +26,14 @@ export const resolveFilterInput = ({
26
26
  control,
27
27
  dropdownData,
28
28
  updateFiltersFromForm,
29
+ isFlatJson,
29
30
  }: {
30
31
  filter: FilterStateProps;
31
32
  operator: string | undefined;
32
33
  control: any;
33
34
  dropdownData: any;
34
35
  updateFiltersFromForm: () => void;
36
+ isFlatJson: boolean;
35
37
  }) => {
36
38
  const dataType = filter?.filter_attribute_data_type;
37
39
 
@@ -95,6 +97,7 @@ export const resolveFilterInput = ({
95
97
  control={control}
96
98
  dropdownData={dropdownData}
97
99
  onValueChange={updateFiltersFromForm}
100
+ isFlatJson={isFlatJson}
98
101
  />
99
102
  );
100
103
  }
@@ -14,6 +14,7 @@ const MainFilter = ({
14
14
  onSaveFilterButtonClick,
15
15
  onChangeFunction,
16
16
  filterComponentOptions,
17
+ isFlatJson,
17
18
  }: FilterFormComponentProps) => {
18
19
  const [searchTerm, setSearchTerm] = useState<string>("");
19
20
 
@@ -22,10 +23,10 @@ const MainFilter = ({
22
23
  useEffect(() => {
23
24
  setFilterMaster(
24
25
  (prev) =>
25
- ({
26
- ...prev,
27
- activeFilterTabIndex: 0,
28
- } as FilterMasterStateProps)
26
+ ({
27
+ ...prev,
28
+ activeFilterTabIndex: 0,
29
+ } as FilterMasterStateProps)
29
30
  );
30
31
  }, []);
31
32
 
@@ -65,6 +66,7 @@ const MainFilter = ({
65
66
  dropdownData={dropdownData}
66
67
  onChangeFunction={onChangeFunction}
67
68
  filterComponentOptions={filterComponentOptions}
69
+ isFlatJson={isFlatJson}
68
70
  />
69
71
  </Box>
70
72
  );
@@ -33,6 +33,7 @@ const SavedFilter = ({
33
33
  tabValue,
34
34
  onChangeFunction,
35
35
  filterComponentOptions,
36
+ isFlatJson,
36
37
  }: FilterFormComponentProps) => {
37
38
  const { filters, filterMaster, setFilterMaster, setFilterToDelete } =
38
39
  tableStates;
@@ -27,6 +27,7 @@ export function TableFilter({
27
27
  dropdownData,
28
28
  onChangeFunction,
29
29
  filterComponentOptions,
30
+ isFlatJson,
30
31
  }: FilterDrawerProps) {
31
32
  const [tabValue, setTabValue] = useState(0);
32
33
  const [editMode, setEditMode] = useState(false);
@@ -347,6 +348,7 @@ export function TableFilter({
347
348
  {...commonProps}
348
349
  onSaveFilterButtonClick={handleSaveFilterButtonClick}
349
350
  filterComponentOptions={finalComponentOptions}
351
+ isFlatJson={isFlatJson}
350
352
  />
351
353
  </CustomTabPanel>
352
354
  )}
@@ -362,6 +364,7 @@ export function TableFilter({
362
364
  {...savedFilterProps}
363
365
  onSaveFilterButtonClick={handleSaveFilterButtonClick}
364
366
  filterComponentOptions={finalComponentOptions}
367
+ isFlatJson={isFlatJson}
365
368
  />
366
369
  </CustomTabPanel>
367
370
  )}
@@ -376,6 +379,7 @@ export function TableFilter({
376
379
  {...commonProps}
377
380
  {...attributesProps}
378
381
  tabValue={tabValue}
382
+ isFlatJson={isFlatJson}
379
383
  />
380
384
  </CustomTabPanel>
381
385
  )}
@@ -57,6 +57,7 @@ const entityListingCall = async ({
57
57
  ],
58
58
  quickFilter = [],
59
59
  attributeFilter = [],
60
+ flatJson,
60
61
  }: EntityTableAPIProps): Promise<{
61
62
  responseStatus: number;
62
63
  data: EntityListingResponse;
@@ -69,6 +70,7 @@ const entityListingCall = async ({
69
70
  sortby,
70
71
  quickFilter,
71
72
  attributeFilter,
73
+ flatJson,
72
74
  };
73
75
 
74
76
  const params: APIParamsProps = {
@@ -99,6 +101,7 @@ export const useEntityTableAPI = ({
99
101
  },
100
102
  ],
101
103
  attributeFilter = [],
104
+ flatJson,
102
105
  }: EntityTableAPIProps) => {
103
106
  const { data, isPending: isTableDataPending } = useQuery({
104
107
  queryKey: ["entityTable", page, size, tabs, quickFilter],
@@ -111,6 +114,7 @@ export const useEntityTableAPI = ({
111
114
  quickFilter,
112
115
  sortby,
113
116
  attributeFilter,
117
+ flatJson,
114
118
  }),
115
119
  });
116
120
 
@@ -272,7 +276,7 @@ export const useCommonFilterDropdownAPI = (
272
276
  queryKey: ["commonDropdown", cfg?.dataSourceType],
273
277
  queryFn: () =>
274
278
  newCommonGetDropdownDataAPI({
275
- entity_type: "ROL",
279
+ entity_type: ENTITY_TYPE,
276
280
  attribute_key: cfg?.key,
277
281
  }),
278
282
  enabled: !!cfg?.dataSourceType,
@@ -78,7 +78,7 @@ export function customDebounce<T extends (...args: any[]) => any>(
78
78
 
79
79
  //ENTITY TYPE
80
80
  const ENVIRONMENT = "adm_dev";
81
- export const ENTITY_TYPE = "ROL";
81
+ export const ENTITY_TYPE = "SCH";
82
82
  export const MAPPED_ENTITY_TYPE = "LYPR"; // LAP OR LYPR
83
83
  export const USER_ID = 226;
84
84
 
@@ -64,6 +64,7 @@ export interface EntityTableAPIProps {
64
64
  filter_operator: string;
65
65
  filter_value: string[] | string;
66
66
  }[];
67
+ flatJson: boolean;
67
68
  }
68
69
 
69
70
  export interface viewSettingsDropDownAPIProps {
@@ -189,6 +189,7 @@ export interface FilterDrawerProps {
189
189
  filterMaster,
190
190
  }: onFilterChangeFunctionProps) => void;
191
191
  filterComponentOptions?: FilterComponentOptions;
192
+ isFlatJson: boolean;
192
193
  }
193
194
 
194
195
  export interface FilterCriteria {
@@ -292,6 +293,7 @@ export interface FilterFormComponentProps {
292
293
  filterMaster,
293
294
  }: onFilterChangeFunctionProps) => void;
294
295
  filterComponentOptions?: FilterComponentOptions;
296
+ isFlatJson: boolean;
295
297
  }
296
298
 
297
299
  export interface SavedFilterSharingPreference {
@@ -328,6 +330,7 @@ export interface AttributesFilterProps {
328
330
  updatedFilters,
329
331
  filterMaster,
330
332
  }: onFilterChangeFunctionProps) => void;
333
+ isFlatJson: boolean;
331
334
  }
332
335
 
333
336
  export interface AttributesFilterSelectProps {
@@ -24,6 +24,7 @@ const CraftTableFilterWrapper = ({
24
24
  onChangeFunction,
25
25
  columnsData,
26
26
  filterComponentOptions,
27
+ isFlatJson,
27
28
  }: {
28
29
  onClose?: () => void;
29
30
  tableStates: CraftTableOptionsProps;
@@ -34,6 +35,7 @@ const CraftTableFilterWrapper = ({
34
35
  filterMaster,
35
36
  }: onFilterChangeFunctionProps) => void;
36
37
  filterComponentOptions?: FilterComponentOptions;
38
+ isFlatJson: boolean;
37
39
  }) => {
38
40
  const getNavigationLayoutQuery = useGetNavigationLayoutAPI(ENTITY_TYPE);
39
41
 
@@ -199,6 +201,7 @@ const CraftTableFilterWrapper = ({
199
201
  onSaveFilter={handleSaveFilter}
200
202
  onChangeFunction={onChangeFunction}
201
203
  filterComponentOptions={filterComponentOptions}
204
+ isFlatJson={isFlatJson}
202
205
  />
203
206
  );
204
207
  };
@@ -186,6 +186,7 @@ function ListingView() {
186
186
  },
187
187
  ],
188
188
  attributeFilter: [],
189
+ flatJson: metaQuery.data?.is_flat_json || false,
189
190
  });
190
191
 
191
192
  const newData = useMemo(
@@ -436,6 +437,7 @@ function ListingView() {
436
437
  tableStates={tableStates}
437
438
  columnsData={metaQuery.data || {}}
438
439
  dropdownData={dropdownFilterData || []}
440
+ isFlatJson={metaQuery.data?.is_flat_json || false} // Added prop for sending the label instead of value in the dropdown case
439
441
  // onUpdateFilter={handleUpdateFilter}
440
442
  // onDeleteFilter={handleRemoveFilter}
441
443
  // onSaveFilter={handleSaveFilter}