rez-table-listing-mui 1.3.42 → 1.3.44

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.
Files changed (28) hide show
  1. package/dist/index.d.ts +4 -48
  2. package/dist/index.js +1 -1
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.mjs +1 -1
  5. package/dist/index.mjs.map +1 -1
  6. package/package.json +1 -1
  7. package/src/listing/components/filter/components/attributes-filter.tsx +2 -2
  8. package/src/listing/components/filter/components/forms/components/Dropdown.tsx +2 -2
  9. package/src/listing/components/filter/components/forms/components/Filter-criteria.tsx +7 -9
  10. package/src/listing/components/filter/components/forms/components/Textfield.tsx +4 -2
  11. package/src/listing/components/filter/components/forms/components/filter-criteria-list.tsx +0 -1
  12. package/src/listing/components/filter/components/forms/index.tsx +14 -23
  13. package/src/listing/components/filter/components/forms/utils/filter-date-input-resolver.tsx +3 -3
  14. package/src/listing/components/filter/components/main-filter.tsx +6 -6
  15. package/src/listing/components/filter/components/saved-edit-filter.tsx +3 -5
  16. package/src/listing/components/filter/components/saved-filter.tsx +124 -300
  17. package/src/listing/components/filter/components/search/index.tsx +0 -1
  18. package/src/listing/components/filter/components/single-filter-rendering.tsx +3 -3
  19. package/src/listing/components/filter/index.tsx +5 -130
  20. package/src/listing/components/login/index.tsx +6 -3
  21. package/src/listing/libs/hooks/useEntityTableAPI.tsx +5 -8
  22. package/src/listing/libs/utils/apiColumn.ts +3 -3
  23. package/src/listing/libs/utils/common.ts +0 -1
  24. package/src/listing/libs/utils/hydrate-saved-filters.ts +2 -2
  25. package/src/listing/types/filter.ts +3 -51
  26. package/src/view/FIlterWrapper.tsx +0 -15
  27. package/src/view/ListingView.tsx +2 -3
  28. package/src/listing/components/common/saved-filter-modal/index.tsx +0 -517
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rez-table-listing-mui",
3
- "version": "1.3.42",
3
+ "version": "1.3.44",
4
4
  "type": "module",
5
5
  "description": "A rez table listing component built on TanStack Table",
6
6
  "main": "dist/index.js",
@@ -76,7 +76,7 @@ const AttributesFilter = ({
76
76
  } else {
77
77
  // Else, replace with new single selection
78
78
  const defaultOperator =
79
- columnsData?.operation_list[matchingColumn.data_type]?.[0]?.value ||
79
+ columnsData?.operation_list[matchingColumn.element_type]?.[0]?.value ||
80
80
  "in";
81
81
 
82
82
  const newFilter = {
@@ -173,7 +173,7 @@ const AttributesFilter = ({
173
173
  }}
174
174
  >
175
175
  {columnsData?.column_list
176
- ?.filter((column) => column.data_type.includes("select"))
176
+ ?.filter((column) => column.element_type.includes("select"))
177
177
  .map((column, index) => (
178
178
  <MenuItem
179
179
  key={index}
@@ -59,8 +59,8 @@ const FormDropdown = ({
59
59
  field.onChange(e);
60
60
 
61
61
  if (
62
- (filter?.filter_attribute_data_type === "date" ||
63
- filter?.filter_attribute_data_type === "year") &&
62
+ (filter?.filter_attribute_element_type === "date" ||
63
+ filter?.filter_attribute_element_type === "year") &&
64
64
  newOperator !== oldOperator
65
65
  ) {
66
66
  if (newOperator === "today") {
@@ -62,14 +62,15 @@ const FilterCriteria = ({
62
62
  const handleAddFilter = (
63
63
  attribute: FilterDataMainFilterEntityWiseCriteriaProps
64
64
  ) => {
65
- const dropdownOptions = columnsData?.operation_list[attribute?.data_type];
65
+ const dropdownOptions =
66
+ columnsData?.operation_list[attribute?.element_type];
66
67
 
67
- const defaultValue = attribute.data_type === "multiselect" ? [] : "";
68
+ const defaultValue = attribute.element_type === "multiselect" ? [] : "";
68
69
 
69
70
  const defaultOperator = dropdownOptions?.[0]?.value || "";
70
71
 
71
72
  const matchingDropdownList =
72
- columnsData?.operation_list[attribute.data_type] || [];
73
+ columnsData?.operation_list[attribute.element_type] || [];
73
74
 
74
75
  const newFilter = {
75
76
  filter_attribute: attribute.attribute_key,
@@ -82,8 +83,8 @@ const FilterCriteria = ({
82
83
  ...newFilter,
83
84
  // id: attribute?.id,
84
85
  filter_attribute_name: attribute?.name,
85
- filter_attribute_data_type:
86
- attribute?.data_type || attribute?.element_type,
86
+ filter_attribute_element_type:
87
+ attribute?.element_type || attribute?.element_type,
87
88
  datasource_list: attribute?.datasource_list,
88
89
  dropdown_list: matchingDropdownList,
89
90
  filter_entity_name: selectedFilterEntity?.label,
@@ -144,14 +145,11 @@ const FilterCriteria = ({
144
145
  >
145
146
  <Box
146
147
  sx={{
147
- maxHeight: filterMaster?.saved_filters?.selectedId
148
- ? `calc(100vh - 601px)`
149
- : `calc(100vh - 440px)`,
148
+ maxHeight: `calc(100vh - 440px)`,
150
149
  overflowY: "auto",
151
150
  width: "100%",
152
151
  ...filterStyles.scrollbarCustom,
153
152
  }}
154
- className="filter-criteria-list-box"
155
153
  >
156
154
  {selectedFilterEntity ? (
157
155
  <FilterCriteriaList
@@ -33,9 +33,11 @@ const FormTextfield = ({
33
33
  padding: "12px 20px",
34
34
  },
35
35
  }}
36
- // type={filter?.filter_attribute_data_type || "text" || "number"}
36
+ // type={filter?.filter_attribute_element_type || "text" || "number"}
37
37
  type={
38
- filter?.filter_attribute_data_type === "number" ? "number" : "text"
38
+ filter?.filter_attribute_element_type === "number"
39
+ ? "number"
40
+ : "text"
39
41
  }
40
42
  placeholder={"Enter value"}
41
43
  disabled={isLoading}
@@ -70,7 +70,6 @@ const FilterCriteriaList = ({
70
70
  onClick={() =>
71
71
  !isSingleEntity && setSelectedFilterEntity(undefined)
72
72
  }
73
- className="cross-icon"
74
73
  >
75
74
  <CloseIcon />
76
75
  </IconButton>
@@ -36,7 +36,7 @@ const FilterForm = ({
36
36
  handleRemoveFilter,
37
37
  editMode = false,
38
38
  tableStates,
39
- onSaveFilterButtonClick,
39
+ setSavedFilterModalOpen,
40
40
  setDeleteFilterModalOpen,
41
41
  onChangeFunction,
42
42
  filterComponentOptions,
@@ -48,7 +48,7 @@ const FilterForm = ({
48
48
  handleRemoveFilter: (filter_attribute: string) => void;
49
49
  editMode?: boolean;
50
50
  tableStates: CraftTableOptionsProps;
51
- onSaveFilterButtonClick?: () => void;
51
+ setSavedFilterModalOpen?: React.Dispatch<React.SetStateAction<boolean>>;
52
52
  setDeleteFilterModalOpen?: React.Dispatch<React.SetStateAction<boolean>>;
53
53
  onChangeFunction: ({
54
54
  updatedFilters,
@@ -67,7 +67,6 @@ const FilterForm = ({
67
67
  filterComponentOptions?.tabOptions?.mainFilter?.customButtons;
68
68
 
69
69
  const filterName = filterMaster?.saved_filters?.selectedName || "";
70
- const isOwner = filterMaster?.saved_filters?.is_owner || false;
71
70
 
72
71
  const defaultValues = useMemo(() => {
73
72
  const filterValues = filters?.reduce((acc, curr) => {
@@ -253,30 +252,22 @@ const FilterForm = ({
253
252
  />
254
253
  )}
255
254
  />
256
- {isOwner && (
257
- <Box onClick={(e) => e.stopPropagation()}>
258
- <IconButton
259
- size="small"
260
- onClick={() =>
261
- setDeleteFilterModalOpen && setDeleteFilterModalOpen(true)
262
- }
263
- >
264
- <DeleteIcon />
265
- </IconButton>
266
- </Box>
267
- )}
255
+ <Box onClick={(e) => e.stopPropagation()}>
256
+ <IconButton
257
+ size="small"
258
+ onClick={() =>
259
+ setDeleteFilterModalOpen && setDeleteFilterModalOpen(true)
260
+ }
261
+ >
262
+ <DeleteIcon />
263
+ </IconButton>
264
+ </Box>
268
265
  </Box>
269
266
  )}
270
267
 
271
268
  <Box
272
269
  className="filter-criteria-form"
273
- sx={{
274
- ...filterFormStyles.formFlexContainer,
275
- ...(editMode && {
276
- maxHeight: "calc(100vh - 570px)",
277
- overflowY: "auto",
278
- }),
279
- }}
270
+ sx={filterFormStyles.formFlexContainer}
280
271
  >
281
272
  <FilterCriteria
282
273
  columnsData={columnsData}
@@ -451,7 +442,7 @@ const FilterForm = ({
451
442
  },
452
443
  }}
453
444
  onClick={() => {
454
- onSaveFilterButtonClick && onSaveFilterButtonClick();
445
+ setSavedFilterModalOpen && setSavedFilterModalOpen(true);
455
446
  }}
456
447
  >
457
448
  Save Filter
@@ -33,7 +33,7 @@ export const resolveFilterInput = ({
33
33
  dropdownData: any;
34
34
  updateFiltersFromForm: () => void;
35
35
  }) => {
36
- const dataType = filter?.filter_attribute_data_type;
36
+ const dataType = filter?.filter_attribute_element_type;
37
37
 
38
38
  // TEXT / NUMBER → always textfield
39
39
  if (dataType === "text" || dataType === "number") {
@@ -84,9 +84,9 @@ export const resolveFilterInput = ({
84
84
 
85
85
  // SELECT / MULTISELECT / RADIO / CHECKBOX
86
86
  if (
87
- filter?.filter_attribute_data_type !== undefined &&
87
+ filter?.filter_attribute_element_type !== undefined &&
88
88
  ["select", "multiselect", "radio", "checkbox"].includes(
89
- filter?.filter_attribute_data_type
89
+ filter?.filter_attribute_element_type
90
90
  )
91
91
  ) {
92
92
  return (
@@ -11,7 +11,7 @@ const MainFilter = ({
11
11
  columnsData,
12
12
  dropdownData,
13
13
  tableStates,
14
- onSaveFilterButtonClick,
14
+ setSavedFilterModalOpen,
15
15
  onChangeFunction,
16
16
  filterComponentOptions,
17
17
  }: FilterFormComponentProps) => {
@@ -22,10 +22,10 @@ const MainFilter = ({
22
22
  useEffect(() => {
23
23
  setFilterMaster(
24
24
  (prev) =>
25
- ({
26
- ...prev,
27
- activeFilterTabIndex: 0,
28
- } as FilterMasterStateProps)
25
+ ({
26
+ ...prev,
27
+ activeFilterTabIndex: 0,
28
+ } as FilterMasterStateProps)
29
29
  );
30
30
  }, []);
31
31
 
@@ -61,7 +61,7 @@ const MainFilter = ({
61
61
  setSearchTerm={setSearchTerm}
62
62
  handleRemoveFilter={handleRemoveFilter}
63
63
  tableStates={tableStates}
64
- onSaveFilterButtonClick={onSaveFilterButtonClick}
64
+ setSavedFilterModalOpen={setSavedFilterModalOpen}
65
65
  dropdownData={dropdownData}
66
66
  onChangeFunction={onChangeFunction}
67
67
  filterComponentOptions={filterComponentOptions}
@@ -18,7 +18,7 @@ const SavedFilterEditComponent = ({
18
18
  setEditMode,
19
19
  searchTerm,
20
20
  setSearchTerm,
21
- onSaveFilterButtonClick,
21
+ setSavedFilterModalOpen,
22
22
  setDeleteFilterModalOpen,
23
23
  onChangeFunction,
24
24
  filterComponentOptions,
@@ -30,7 +30,7 @@ const SavedFilterEditComponent = ({
30
30
  setEditMode?: React.Dispatch<React.SetStateAction<boolean>>;
31
31
  searchTerm?: string;
32
32
  setSearchTerm: React.Dispatch<React.SetStateAction<string>>;
33
- onSaveFilterButtonClick?: () => void;
33
+ setSavedFilterModalOpen?: React.Dispatch<React.SetStateAction<boolean>>;
34
34
  setDeleteFilterModalOpen?: React.Dispatch<React.SetStateAction<boolean>>;
35
35
  onChangeFunction: ({
36
36
  updatedFilters,
@@ -62,8 +62,6 @@ const SavedFilterEditComponent = ({
62
62
  selectedId: "",
63
63
  selectedName: "",
64
64
  selectedCode: "",
65
- shareWithTeam: false,
66
- allowTeamEdit: false,
67
65
  },
68
66
  activeFilterTabIndex: -1,
69
67
  } as FilterMasterStateProps)
@@ -101,7 +99,7 @@ const SavedFilterEditComponent = ({
101
99
  dropdownData={dropdownData}
102
100
  searchTerm={searchTerm}
103
101
  setSearchTerm={setSearchTerm}
104
- onSaveFilterButtonClick={onSaveFilterButtonClick}
102
+ setSavedFilterModalOpen={setSavedFilterModalOpen}
105
103
  setDeleteFilterModalOpen={setDeleteFilterModalOpen}
106
104
  onChangeFunction={onChangeFunction}
107
105
  filterComponentOptions={filterComponentOptions}