rez-table-listing-mui 0.0.25 → 0.0.26
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/.env.uat +1 -0
- package/.eslintrc.cjs +11 -9
- package/dist/index.d.ts +101 -8
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +6 -10
- package/src/App.tsx +172 -129
- package/src/assets/svg.tsx +33 -2
- package/src/components/common/confirm-modal/index.tsx +200 -0
- package/src/components/filter/components/attributes-filter.tsx +26 -0
- package/src/components/filter/components/forms/components/Attributes-select.tsx +180 -0
- package/src/components/filter/components/forms/components/Date.tsx +58 -0
- package/src/components/filter/components/forms/components/Dropdown.tsx +62 -0
- package/src/components/filter/components/forms/components/Filter-criteria.tsx +164 -0
- package/src/components/filter/components/forms/components/Multi-Select.tsx +57 -0
- package/src/components/filter/components/forms/components/Select.tsx +53 -0
- package/src/components/filter/components/forms/components/Textfield.tsx +43 -0
- package/src/components/filter/components/forms/components/styles.tsx +11 -0
- package/src/components/filter/components/forms/index.tsx +424 -0
- package/src/components/filter/components/main-filter.tsx +53 -0
- package/src/components/filter/components/saved-edit-filter.tsx +101 -0
- package/src/components/filter/components/saved-filter.tsx +148 -0
- package/src/components/filter/components/search/index.tsx +56 -0
- package/src/components/filter/components/tabs/custom-tab-panel.tsx +29 -0
- package/src/components/filter/components/tabs/index.tsx +52 -0
- package/src/components/filter/index.tsx +258 -0
- package/src/components/index-table.tsx +3 -6
- package/src/components/index.scss +4 -0
- package/src/components/login/index.tsx +49 -0
- package/src/components/table-body.tsx +6 -4
- package/src/components/table-head.tsx +0 -10
- package/src/components/topbar/index.scss +5 -0
- package/src/components/topbar/index.tsx +54 -19
- package/src/components/viewmore/index.tsx +2 -2
- package/src/libs/hooks/useCraftTable.tsx +29 -5
- package/src/libs/hooks/useDefaultColumns.tsx +2 -2
- package/src/libs/hooks/useEntityTableAPI.tsx +183 -0
- package/src/libs/hooks/useEntityTableHooks.ts +25 -0
- package/src/libs/utils/apiColumn.ts +123 -0
- package/src/libs/utils/common.ts +42 -0
- package/src/main.tsx +6 -3
- package/src/types/common.ts +67 -0
- package/src/types/filter.ts +211 -0
- package/src/types/table-options.ts +15 -2
- package/src/types/table.ts +5 -5
- package/tsconfig.json +1 -1
- package/vite.config.ts +3 -3
package/src/types/common.ts
CHANGED
|
@@ -38,3 +38,70 @@ export const camelCaseToTitle = (str: string): string => {
|
|
|
38
38
|
.replace(/\b\w/g, (char) => char.toUpperCase()) // Capitalize each word's first letter
|
|
39
39
|
.trim();
|
|
40
40
|
};
|
|
41
|
+
|
|
42
|
+
//API INTEGRATION
|
|
43
|
+
export interface EntityTableAPIProps {
|
|
44
|
+
entity_type?: string;
|
|
45
|
+
page: number;
|
|
46
|
+
size: number;
|
|
47
|
+
tabs?: {
|
|
48
|
+
columnName: string;
|
|
49
|
+
sortBy: "ASC" | "DSC";
|
|
50
|
+
value?: string;
|
|
51
|
+
};
|
|
52
|
+
sortby?: {
|
|
53
|
+
sortColum: string;
|
|
54
|
+
sortType: "ASC" | "DSC";
|
|
55
|
+
}[];
|
|
56
|
+
quickFilter?: {
|
|
57
|
+
filter_attribute: string;
|
|
58
|
+
filter_operator: string;
|
|
59
|
+
filter_value: string[] | string;
|
|
60
|
+
}[];
|
|
61
|
+
attributeFilter?: {
|
|
62
|
+
filter_attribute: string;
|
|
63
|
+
filter_operator: string;
|
|
64
|
+
filter_value: string[] | string;
|
|
65
|
+
}[];
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
interface EntityListTab {
|
|
69
|
+
tab_value: string | null;
|
|
70
|
+
tab_value_count: string | number;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
interface EntityList {
|
|
74
|
+
id: string;
|
|
75
|
+
entity_type: string;
|
|
76
|
+
name: string;
|
|
77
|
+
status: string | null;
|
|
78
|
+
parent_type: string | null;
|
|
79
|
+
parent_id: string | null;
|
|
80
|
+
code: string;
|
|
81
|
+
created_by: string | null;
|
|
82
|
+
created_date: string | null;
|
|
83
|
+
modified_by: string | null;
|
|
84
|
+
modified_date: string | null;
|
|
85
|
+
enterprise_id: string | null;
|
|
86
|
+
organization_id: number | null;
|
|
87
|
+
app_code: string | null;
|
|
88
|
+
is_system: number | null;
|
|
89
|
+
description: string | null;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface EntityListingResponse {
|
|
93
|
+
data: {
|
|
94
|
+
entity_tabs: EntityListTab[];
|
|
95
|
+
entity_list: EntityList[];
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface APIParamsProps {
|
|
100
|
+
page?: number;
|
|
101
|
+
size?: number;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export type DropdownOption = {
|
|
105
|
+
value: string | number;
|
|
106
|
+
label: string;
|
|
107
|
+
};
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { CraftTableOptionsProps } from "./table-options";
|
|
2
|
+
|
|
3
|
+
interface OperationProps {
|
|
4
|
+
label: string;
|
|
5
|
+
value: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
type OperationMapProps = {
|
|
9
|
+
[key in FilterInputDataTypes]?: OperationProps[];
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export interface FilterOperationListProps {
|
|
13
|
+
label: string;
|
|
14
|
+
value: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type FilterInputDataTypes =
|
|
18
|
+
| "text"
|
|
19
|
+
| "select"
|
|
20
|
+
| "multiselect"
|
|
21
|
+
| "date"
|
|
22
|
+
| "number";
|
|
23
|
+
|
|
24
|
+
export interface FilterColumnsListProps {
|
|
25
|
+
created_date: string | null;
|
|
26
|
+
entity_type: string;
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
status: string | null;
|
|
30
|
+
parent_type: string;
|
|
31
|
+
parent_id: string;
|
|
32
|
+
code: string | null;
|
|
33
|
+
created_by: string | null;
|
|
34
|
+
modified_by: string | null;
|
|
35
|
+
modified_date: string | null;
|
|
36
|
+
enterprise_id: string | null;
|
|
37
|
+
organization_id: string | null;
|
|
38
|
+
app_code: string | null;
|
|
39
|
+
mapped_entity_type: string;
|
|
40
|
+
menu_code: string | null;
|
|
41
|
+
table_name: string | null;
|
|
42
|
+
col_position: number;
|
|
43
|
+
sortable: string | null;
|
|
44
|
+
searchable: string | null;
|
|
45
|
+
attribute_key: string;
|
|
46
|
+
sort_type: string | null;
|
|
47
|
+
data_type: FilterInputDataTypes;
|
|
48
|
+
data_source_type: string | null;
|
|
49
|
+
datasource_list: any | null;
|
|
50
|
+
visible: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface FilterColumnsDataProps {
|
|
54
|
+
column_list: FilterColumnsListProps[];
|
|
55
|
+
operation_list: OperationMapProps;
|
|
56
|
+
saved_filter: FilterOperationListProps[];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface FilterDropdownDataProps {
|
|
60
|
+
[key: string]: FilterOperationListProps[];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface FilterDrawerProps {
|
|
64
|
+
tableStates: CraftTableOptionsProps;
|
|
65
|
+
open?: boolean;
|
|
66
|
+
onClose?: () => void;
|
|
67
|
+
onDeleteFilter?: () => void;
|
|
68
|
+
onSaveFilter?: (name: string) => void;
|
|
69
|
+
onUpdateFilter?: (name: string) => void;
|
|
70
|
+
columnsData: FilterColumnsDataProps;
|
|
71
|
+
dropdownData: FilterDropdownDataProps;
|
|
72
|
+
defaultFilters?: Array<{
|
|
73
|
+
filter_attribute: string;
|
|
74
|
+
filter_operator: string;
|
|
75
|
+
filter_value: string;
|
|
76
|
+
}>;
|
|
77
|
+
savedFilters?: Array<{ label: string; value: string }>;
|
|
78
|
+
tableData?: {
|
|
79
|
+
entity_list: any[];
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface FilterCriteria {
|
|
84
|
+
columnId: string;
|
|
85
|
+
value: string | string[];
|
|
86
|
+
type: FilterInputDataTypes | undefined;
|
|
87
|
+
operator?: string | null;
|
|
88
|
+
dropdown?: {
|
|
89
|
+
label?: string;
|
|
90
|
+
value?: string;
|
|
91
|
+
};
|
|
92
|
+
optionList?: {
|
|
93
|
+
label?: string | undefined;
|
|
94
|
+
value?: string | undefined;
|
|
95
|
+
};
|
|
96
|
+
attribute_key?: string | undefined;
|
|
97
|
+
name: string | undefined;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface FilterStateProps {
|
|
101
|
+
filter_attribute: string;
|
|
102
|
+
filter_operator: string;
|
|
103
|
+
filter_value: string | string[];
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface UpdatedFilterStateProps extends FilterStateProps {
|
|
107
|
+
id: string | number;
|
|
108
|
+
name: string | undefined;
|
|
109
|
+
data_type: FilterInputDataTypes | undefined;
|
|
110
|
+
attribute_key?: string;
|
|
111
|
+
dropdown_list?: {
|
|
112
|
+
label?: string;
|
|
113
|
+
value?: string;
|
|
114
|
+
}[];
|
|
115
|
+
optionList?: {
|
|
116
|
+
label?: string | undefined;
|
|
117
|
+
value?: string | undefined;
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
interface FilterDetail {
|
|
122
|
+
filter_attribute: string;
|
|
123
|
+
filter_operator: string;
|
|
124
|
+
filter_value: string | string[];
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface createSavedFilterPaload {
|
|
128
|
+
name: string;
|
|
129
|
+
organization_id?: number;
|
|
130
|
+
enterprise_id?: number;
|
|
131
|
+
user_id?: number;
|
|
132
|
+
is_default: boolean;
|
|
133
|
+
mapped_entity_type: string;
|
|
134
|
+
status?: string;
|
|
135
|
+
entity_type: string;
|
|
136
|
+
filterDetails: FilterDetail[];
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export interface deleteSavedFilterPayload {
|
|
140
|
+
name: string;
|
|
141
|
+
is_default: boolean;
|
|
142
|
+
id: string | number;
|
|
143
|
+
status?: string;
|
|
144
|
+
entity_type: string;
|
|
145
|
+
mapped_entity_type: string;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export interface updateSavedFilterPayload {
|
|
149
|
+
name: string;
|
|
150
|
+
is_default: boolean;
|
|
151
|
+
id: string | number;
|
|
152
|
+
status?: string;
|
|
153
|
+
entity_type: string;
|
|
154
|
+
mapped_entity_type: string;
|
|
155
|
+
filterDetails: FilterDetail[];
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export interface deleteSavedFilterPayload {
|
|
159
|
+
name: string;
|
|
160
|
+
is_default: boolean;
|
|
161
|
+
id: string | number;
|
|
162
|
+
status?: string;
|
|
163
|
+
entity_type: string;
|
|
164
|
+
mapped_entity_type: string;
|
|
165
|
+
}
|
|
166
|
+
interface FilterDetail {
|
|
167
|
+
filter_attribute: string;
|
|
168
|
+
filter_operator: string;
|
|
169
|
+
filter_value: string | string[];
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export interface FilterFormComponentProps {
|
|
173
|
+
columnsData: FilterColumnsDataProps;
|
|
174
|
+
dropdownData: FilterDropdownDataProps;
|
|
175
|
+
tableStates: CraftTableOptionsProps;
|
|
176
|
+
selectedFilters: UpdatedFilterStateProps[];
|
|
177
|
+
setSelectedFilters: React.Dispatch<
|
|
178
|
+
React.SetStateAction<UpdatedFilterStateProps[]>
|
|
179
|
+
>;
|
|
180
|
+
editMode?: boolean;
|
|
181
|
+
setEditMode?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
182
|
+
setDeleteFilterModalOpen?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
183
|
+
setSavedFilterModalOpen?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export interface FilterMasterStateProps {
|
|
187
|
+
attributes: {
|
|
188
|
+
selected: string;
|
|
189
|
+
radio: string;
|
|
190
|
+
};
|
|
191
|
+
saved_filters: {
|
|
192
|
+
selectedId: string;
|
|
193
|
+
selectedName: string;
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export interface AttributesFilterProps {
|
|
198
|
+
columnsData: FilterColumnsDataProps;
|
|
199
|
+
tableStates: CraftTableOptionsProps;
|
|
200
|
+
dropdownData: FilterDropdownDataProps;
|
|
201
|
+
searchTerm: string;
|
|
202
|
+
setSearchTerm: React.Dispatch<React.SetStateAction<string>>;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export interface AttributesFilterSelectProps {
|
|
206
|
+
columnsData: FilterColumnsDataProps;
|
|
207
|
+
tableStates: CraftTableOptionsProps;
|
|
208
|
+
dropdownData: FilterDropdownDataProps;
|
|
209
|
+
searchTerm: string;
|
|
210
|
+
setSearchTerm: React.Dispatch<React.SetStateAction<string>>;
|
|
211
|
+
}
|
|
@@ -5,6 +5,11 @@ import {
|
|
|
5
5
|
ExpandedState,
|
|
6
6
|
} from "@tanstack/react-table";
|
|
7
7
|
import { Dispatch, SetStateAction } from "react";
|
|
8
|
+
import {
|
|
9
|
+
FilterMasterStateProps,
|
|
10
|
+
FilterOperationListProps,
|
|
11
|
+
FilterStateProps,
|
|
12
|
+
} from "./filter";
|
|
8
13
|
|
|
9
14
|
export interface CraftTableOptionsProps {
|
|
10
15
|
sorting: SortingState;
|
|
@@ -19,8 +24,16 @@ export interface CraftTableOptionsProps {
|
|
|
19
24
|
setExpanded: Dispatch<SetStateAction<ExpandedState>>;
|
|
20
25
|
wrapColumns: Record<string, boolean>;
|
|
21
26
|
setWrapColumns: Dispatch<SetStateAction<Record<string, boolean>>>;
|
|
22
|
-
|
|
23
|
-
|
|
27
|
+
filters: FilterStateProps[];
|
|
28
|
+
setFilters: Dispatch<SetStateAction<FilterStateProps[]>>;
|
|
29
|
+
savedFilterEditValue: string | number;
|
|
30
|
+
setSavedFilterEditValue: Dispatch<SetStateAction<string | number>>;
|
|
31
|
+
filterToDelete: FilterOperationListProps | null;
|
|
32
|
+
setFilterToDelete: Dispatch<SetStateAction<FilterOperationListProps | null>>;
|
|
33
|
+
filterSelectedAttributeValue: string;
|
|
34
|
+
setFilterSelectedAttributeValue: Dispatch<SetStateAction<string>>;
|
|
35
|
+
filterMaster: FilterMasterStateProps | null;
|
|
36
|
+
setFilterMaster: Dispatch<SetStateAction<FilterMasterStateProps | null>>;
|
|
24
37
|
}
|
|
25
38
|
|
|
26
39
|
export interface CraftTableFeatureProps {
|
package/src/types/table.ts
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
CraftTableOptionsProps,
|
|
11
11
|
} from "./table-options";
|
|
12
12
|
import React from "react";
|
|
13
|
+
import { FilterDrawerProps } from "./filter";
|
|
13
14
|
|
|
14
15
|
export interface CraftTablePaginationProps {
|
|
15
16
|
totalRows?: number;
|
|
@@ -26,20 +27,19 @@ interface LoadingOptionsProps {
|
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
export interface TopbarOptionsProps {
|
|
30
|
+
tableStates: CraftTableOptionsProps;
|
|
29
31
|
leftSideComponent?: React.ReactNode;
|
|
30
32
|
rightSideComponent?: React.ReactNode;
|
|
31
|
-
showFullscreenToggle?: boolean;
|
|
32
33
|
showColumnToggle?: boolean;
|
|
33
34
|
showCompactTableToggle?: boolean;
|
|
34
35
|
showChangeLayoutToggle?: boolean;
|
|
35
36
|
viewMoreToggle?: boolean;
|
|
36
|
-
showAddNewButton?: boolean;
|
|
37
37
|
showSearch?: boolean;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
tableStates: CraftTableOptionsProps;
|
|
38
|
+
showSortingToggle?: boolean;
|
|
39
|
+
showFilterToggle?: boolean;
|
|
41
40
|
searchValue?: string;
|
|
42
41
|
onSearchChange?: (val: string) => void;
|
|
42
|
+
filterOptions?: FilterDrawerProps;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
export interface CustomRenderContext<T> {
|
package/tsconfig.json
CHANGED
package/vite.config.ts
CHANGED