@asaleh37/ui-base 26.2.13 → 26.2.131
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
|
@@ -48,7 +48,7 @@ const StyledToolbarButton = styled(ToolbarButton)<{ ownerState: OwnerState }>(
|
|
|
48
48
|
opacity: ownerState.expanded ? 0 : 1,
|
|
49
49
|
pointerEvents: ownerState.expanded ? "none" : "auto",
|
|
50
50
|
transition: theme.transitions.create(["opacity"]),
|
|
51
|
-
})
|
|
51
|
+
}),
|
|
52
52
|
);
|
|
53
53
|
|
|
54
54
|
const StyledTextField = styled(TextField)<{
|
|
@@ -62,7 +62,7 @@ const StyledTextField = styled(TextField)<{
|
|
|
62
62
|
}));
|
|
63
63
|
|
|
64
64
|
const TemplateGridTopBar: React.FC<TemplateGridTopBarProps> = (
|
|
65
|
-
props: TemplateGridTopBarProps
|
|
65
|
+
props: TemplateGridTopBarProps,
|
|
66
66
|
) => {
|
|
67
67
|
const { t } = useTranslation();
|
|
68
68
|
const session = useSession();
|
|
@@ -76,158 +76,175 @@ const TemplateGridTopBar: React.FC<TemplateGridTopBarProps> = (
|
|
|
76
76
|
type: "include",
|
|
77
77
|
},
|
|
78
78
|
props?.templateProps?.data || [],
|
|
79
|
-
props?.templateProps?.keyColumnName || "id"
|
|
79
|
+
props?.templateProps?.keyColumnName || "id",
|
|
80
80
|
);
|
|
81
81
|
return (
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
props?.templateProps?.
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
<
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
82
|
+
<>
|
|
83
|
+
<Toolbar>
|
|
84
|
+
{isCreationEnabled &&
|
|
85
|
+
isCreationAuthorized &&
|
|
86
|
+
props?.templateProps?.editMode?.editMode != "none" ? (
|
|
87
|
+
props?.templateProps?.hideCreateBtn === undefined ||
|
|
88
|
+
props?.templateProps?.hideCreateBtn === false ? (
|
|
89
|
+
<Button onClick={props?.handleCreateNewRecord}>
|
|
90
|
+
<FontAwesomeIcon
|
|
91
|
+
icon="add"
|
|
92
|
+
style={{ marginRight: 5, marginLeft: 5 }}
|
|
93
|
+
/>
|
|
94
|
+
{t("ADD_BTN_LABEL")}
|
|
95
|
+
</Button>
|
|
96
|
+
) : (
|
|
97
|
+
<></>
|
|
98
|
+
)
|
|
95
99
|
) : (
|
|
96
100
|
<></>
|
|
97
|
-
)
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
)
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
</Box>
|
|
123
|
-
|
|
124
|
-
<Tooltip title="Columns">
|
|
125
|
-
<ColumnsPanelTrigger render={<ToolbarButton />}>
|
|
126
|
-
<GridViewColumnIcon fontSize="small" />
|
|
127
|
-
</ColumnsPanelTrigger>
|
|
128
|
-
</Tooltip>
|
|
101
|
+
)}
|
|
102
|
+
{props?.templateProps?.rowActions ? (
|
|
103
|
+
props.templateProps.rowActions.map((rowAction, index) =>
|
|
104
|
+
rowAction?.gridActionProps?.multiRecord === true ? (
|
|
105
|
+
<TemplateGridMultiRecordAction
|
|
106
|
+
{...rowAction}
|
|
107
|
+
key={index}
|
|
108
|
+
reloadData={async () => {
|
|
109
|
+
props.templateProps.apiActions.reloadData(
|
|
110
|
+
props?.templateProps?.gridLoadParametersValues,
|
|
111
|
+
);
|
|
112
|
+
}}
|
|
113
|
+
recordIdsToProcessActionOn={gridSelection.selectedRecordIds}
|
|
114
|
+
recordsToProcessActionOn={gridSelection.selectedRecords}
|
|
115
|
+
/>
|
|
116
|
+
) : null,
|
|
117
|
+
)
|
|
118
|
+
) : (
|
|
119
|
+
<></>
|
|
120
|
+
)}
|
|
121
|
+
<Box
|
|
122
|
+
sx={{
|
|
123
|
+
flex: 1,
|
|
124
|
+
}}
|
|
125
|
+
></Box>
|
|
129
126
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
badgeContent={state.filterCount}
|
|
136
|
-
color="primary"
|
|
137
|
-
variant="dot"
|
|
138
|
-
>
|
|
139
|
-
<GridFilterListIcon fontSize="small" />
|
|
140
|
-
</Badge>
|
|
141
|
-
</ToolbarButton>
|
|
142
|
-
)}
|
|
143
|
-
/>
|
|
144
|
-
</Tooltip>
|
|
127
|
+
<Tooltip title="Columns">
|
|
128
|
+
<ColumnsPanelTrigger render={<ToolbarButton />}>
|
|
129
|
+
<GridViewColumnIcon fontSize="small" />
|
|
130
|
+
</ColumnsPanelTrigger>
|
|
131
|
+
</Tooltip>
|
|
145
132
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
133
|
+
<Tooltip title="Filters">
|
|
134
|
+
<FilterPanelTrigger
|
|
135
|
+
render={(props, state) => (
|
|
136
|
+
<ToolbarButton {...props} color="default">
|
|
137
|
+
<Badge
|
|
138
|
+
badgeContent={state.filterCount}
|
|
139
|
+
color="primary"
|
|
140
|
+
variant="dot"
|
|
141
|
+
>
|
|
142
|
+
<GridFilterListIcon fontSize="small" />
|
|
143
|
+
</Badge>
|
|
144
|
+
</ToolbarButton>
|
|
145
|
+
)}
|
|
146
|
+
/>
|
|
151
147
|
</Tooltip>
|
|
152
|
-
) : (
|
|
153
|
-
<></>
|
|
154
|
-
)}
|
|
155
148
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
149
|
+
{props?.templateProps?.gridStateKey ? (
|
|
150
|
+
<Tooltip title={t("RESET_GRID_STATE")}>
|
|
151
|
+
<IconButton onClick={props?.clearGridState}>
|
|
152
|
+
<FontAwesomeIcon icon="eraser" />
|
|
153
|
+
</IconButton>
|
|
154
|
+
</Tooltip>
|
|
155
|
+
) : (
|
|
156
|
+
<></>
|
|
157
|
+
)}
|
|
158
|
+
|
|
159
|
+
<Divider
|
|
160
|
+
orientation="vertical"
|
|
161
|
+
variant="middle"
|
|
162
|
+
flexItem
|
|
163
|
+
sx={{ mx: 0.5 }}
|
|
164
|
+
/>
|
|
162
165
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
166
|
+
<Tooltip title={t("EXPORT_EXECL_LABEL")}>
|
|
167
|
+
<ExportExcel render={<MenuItem />}>
|
|
168
|
+
<FontAwesomeIcon icon="file-excel" color="green" />
|
|
169
|
+
</ExportExcel>
|
|
170
|
+
</Tooltip>
|
|
168
171
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
172
|
+
<StyledQuickFilter>
|
|
173
|
+
<QuickFilterTrigger
|
|
174
|
+
render={(triggerProps, state) => (
|
|
175
|
+
<Tooltip title={t("SEARCH_BTN_LABEL")} enterDelay={0}>
|
|
176
|
+
<StyledToolbarButton
|
|
177
|
+
{...triggerProps}
|
|
178
|
+
ownerState={{ expanded: state.expanded }}
|
|
179
|
+
color="default"
|
|
180
|
+
aria-disabled={state.expanded}
|
|
181
|
+
>
|
|
182
|
+
<FontAwesomeIcon icon="search" />
|
|
183
|
+
</StyledToolbarButton>
|
|
184
|
+
</Tooltip>
|
|
185
|
+
)}
|
|
186
|
+
/>
|
|
187
|
+
<QuickFilterControl
|
|
188
|
+
render={({ ref, ...controlProps }, state) => (
|
|
189
|
+
<StyledTextField
|
|
190
|
+
{...controlProps}
|
|
175
191
|
ownerState={{ expanded: state.expanded }}
|
|
176
|
-
|
|
177
|
-
aria-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
/>
|
|
219
|
-
</StyledQuickFilter>
|
|
192
|
+
inputRef={ref}
|
|
193
|
+
aria-label="Search"
|
|
194
|
+
placeholder={`${t("SEARCH_BTN_LABEL")}...`}
|
|
195
|
+
size="small"
|
|
196
|
+
slotProps={{
|
|
197
|
+
input: {
|
|
198
|
+
startAdornment: (
|
|
199
|
+
<InputAdornment position="start">
|
|
200
|
+
<FontAwesomeIcon icon="search" />
|
|
201
|
+
</InputAdornment>
|
|
202
|
+
),
|
|
203
|
+
endAdornment: state.value ? (
|
|
204
|
+
<InputAdornment position="end">
|
|
205
|
+
<QuickFilterClear
|
|
206
|
+
edge="end"
|
|
207
|
+
size="small"
|
|
208
|
+
aria-label="Clear search"
|
|
209
|
+
// material={{ sx: { marginRight: -0.75 } }}
|
|
210
|
+
>
|
|
211
|
+
<FontAwesomeIcon icon="xmark" />
|
|
212
|
+
</QuickFilterClear>
|
|
213
|
+
</InputAdornment>
|
|
214
|
+
) : null,
|
|
215
|
+
...controlProps.slotProps?.input,
|
|
216
|
+
},
|
|
217
|
+
...controlProps.slotProps,
|
|
218
|
+
}}
|
|
219
|
+
/>
|
|
220
|
+
)}
|
|
221
|
+
/>
|
|
222
|
+
</StyledQuickFilter>
|
|
223
|
+
|
|
224
|
+
<IconButton
|
|
225
|
+
onClick={() => {
|
|
226
|
+
props.templateProps.apiActions.reloadData(
|
|
227
|
+
props?.templateProps?.gridLoadParametersValues,
|
|
228
|
+
);
|
|
229
|
+
}}
|
|
230
|
+
>
|
|
231
|
+
<FontAwesomeIcon icon="refresh" />
|
|
232
|
+
</IconButton>
|
|
233
|
+
</Toolbar>
|
|
220
234
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
235
|
+
{props?.templateProps?.tBar ? (
|
|
236
|
+
<Box
|
|
237
|
+
sx={{
|
|
238
|
+
display: "flex",
|
|
239
|
+
padding: 2,
|
|
240
|
+
}}
|
|
241
|
+
>
|
|
242
|
+
{props?.templateProps?.tBar}
|
|
243
|
+
</Box>
|
|
244
|
+
) : (
|
|
245
|
+
<></>
|
|
246
|
+
)}
|
|
247
|
+
</>
|
|
231
248
|
);
|
|
232
249
|
};
|
|
233
250
|
|