@asaleh37/ui-base 25.12.17 → 25.12.21
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/dist/index.d.ts +2 -0
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/App.tsx +16 -3
- package/src/components/templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid.tsx +2 -4
- package/src/components/templates/attachment/AttachmentImageViewer.tsx +2 -2
- package/src/components/templates/workflow/WorkflowDocumentPanel.tsx +6 -2
- package/src/layout/TopBar.tsx +33 -28
- package/src/redux/features/common/AppInfoSlice.ts +4 -0
package/package.json
CHANGED
package/src/components/App.tsx
CHANGED
|
@@ -103,14 +103,27 @@ const App: React.FC<AppInfo> = (props: AppInfo) => {
|
|
|
103
103
|
};
|
|
104
104
|
|
|
105
105
|
const AppLayoutState = useSelector((state: any) => state.AppLayout);
|
|
106
|
-
let themeOptions
|
|
107
|
-
if (
|
|
108
|
-
themeOptions = { ...
|
|
106
|
+
let themeOptions;
|
|
107
|
+
if (props?.allowThemeChange) {
|
|
108
|
+
themeOptions = { ...LightThemeOptions };
|
|
109
|
+
if (AppLayoutState.themeMode === "dark") {
|
|
110
|
+
themeOptions = { ...DarkThemeOptions };
|
|
111
|
+
}
|
|
112
|
+
} else {
|
|
113
|
+
if (props?.appThemeMode) {
|
|
114
|
+
themeOptions =
|
|
115
|
+
props?.appThemeMode === "light"
|
|
116
|
+
? { ...LightThemeOptions }
|
|
117
|
+
: { ...DarkThemeOptions };
|
|
118
|
+
} else {
|
|
119
|
+
themeOptions = { ...LightThemeOptions };
|
|
120
|
+
}
|
|
109
121
|
}
|
|
110
122
|
const theme = createTheme({
|
|
111
123
|
direction: AppLayoutState.appDirection,
|
|
112
124
|
...themeOptions,
|
|
113
125
|
});
|
|
126
|
+
|
|
114
127
|
useEffect(() => {
|
|
115
128
|
document.title = props.documentTitle;
|
|
116
129
|
dispatch(AppInfoActions.setAppInfo(props));
|
|
@@ -637,8 +637,7 @@ const TemplateGrid: React.FC<TemplateGridProps> = (props) => {
|
|
|
637
637
|
}
|
|
638
638
|
}
|
|
639
639
|
if (
|
|
640
|
-
record[props?.keyColumnName || "id"] &&
|
|
641
|
-
record[props?.keyColumnName || "id"] > 0 &&
|
|
640
|
+
(record[props?.keyColumnName] || (record["id"] && record["id"] > 0)) &&
|
|
642
641
|
props?.attachment
|
|
643
642
|
) {
|
|
644
643
|
actions?.push(
|
|
@@ -666,8 +665,7 @@ const TemplateGrid: React.FC<TemplateGridProps> = (props) => {
|
|
|
666
665
|
);
|
|
667
666
|
}
|
|
668
667
|
if (
|
|
669
|
-
record[props?.keyColumnName || "id"] &&
|
|
670
|
-
record[props?.keyColumnName || "id"] > 0 &&
|
|
668
|
+
(record[props?.keyColumnName] || (record["id"] && record["id"] > 0)) &&
|
|
671
669
|
props?.workFlowDocumentCode
|
|
672
670
|
) {
|
|
673
671
|
actions?.push(
|
|
@@ -30,10 +30,10 @@ const AttachmentImageViewer: React.FC<AttachmentImageViewerProps> = (props) => {
|
|
|
30
30
|
setImgSrc(imagePath);
|
|
31
31
|
};
|
|
32
32
|
useEffect(() => {
|
|
33
|
-
if (props?.refKey) {
|
|
33
|
+
if (props?.refKey || props?.attachmentId) {
|
|
34
34
|
handleImageSrc();
|
|
35
35
|
}
|
|
36
|
-
}, [props.refKey]);
|
|
36
|
+
}, [props.refKey, props?.attachmentId]);
|
|
37
37
|
{
|
|
38
38
|
/* </Avatar>
|
|
39
39
|
src={imgSrc}
|
|
@@ -240,8 +240,12 @@ const WorkflowDocumentPanel: React.FC<WorkflowDocumentPanelProps> = (props) => {
|
|
|
240
240
|
if (workflowDocumentInfo?.nextActionTakers) {
|
|
241
241
|
for (const actionTaker of workflowDocumentInfo.nextActionTakers) {
|
|
242
242
|
if (
|
|
243
|
-
UserInfo?.username
|
|
244
|
-
UserInfo?.username
|
|
243
|
+
UserInfo?.username == actionTaker?.username ||
|
|
244
|
+
UserInfo?.username == actionTaker?.USERNAME ||
|
|
245
|
+
UserInfo?.email == actionTaker?.email ||
|
|
246
|
+
UserInfo?.email == actionTaker?.EMAIL ||
|
|
247
|
+
UserInfo?.employeeNumber == actionTaker?.employeeNumber ||
|
|
248
|
+
UserInfo?.employeeNumber == actionTaker?.EMPLOYEE_NUMBER
|
|
245
249
|
) {
|
|
246
250
|
return true;
|
|
247
251
|
}
|
package/src/layout/TopBar.tsx
CHANGED
|
@@ -202,35 +202,40 @@ const TopBar: React.FC = () => {
|
|
|
202
202
|
: currentOrganization?.organizationArName
|
|
203
203
|
}`}
|
|
204
204
|
</Typography>
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
<IconButton
|
|
213
|
-
sx={{ mx: 1 }}
|
|
214
|
-
color="inherit"
|
|
215
|
-
onClick={() => {
|
|
216
|
-
dispatch(
|
|
217
|
-
AppLayoutActions.setThemeMode(
|
|
218
|
-
AppLayout.themeMode === "light" ? "dark" : "light"
|
|
219
|
-
)
|
|
220
|
-
);
|
|
221
|
-
localStorage.setItem(
|
|
222
|
-
"themeMode",
|
|
223
|
-
AppLayout.themeMode === "light" ? "dark" : "light"
|
|
224
|
-
);
|
|
225
|
-
}}
|
|
205
|
+
{AppInfo.allowThemeChange ? (
|
|
206
|
+
<Tooltip
|
|
207
|
+
title={
|
|
208
|
+
AppLayout.themeMode === "light"
|
|
209
|
+
? "Switch Theme to Dark"
|
|
210
|
+
: "Switch Theme to Light"
|
|
211
|
+
}
|
|
226
212
|
>
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
213
|
+
<IconButton
|
|
214
|
+
sx={{ mx: 1 }}
|
|
215
|
+
color="inherit"
|
|
216
|
+
onClick={() => {
|
|
217
|
+
dispatch(
|
|
218
|
+
AppLayoutActions.setThemeMode(
|
|
219
|
+
AppLayout.themeMode === "light" ? "dark" : "light"
|
|
220
|
+
)
|
|
221
|
+
);
|
|
222
|
+
localStorage.setItem(
|
|
223
|
+
"themeMode",
|
|
224
|
+
AppLayout.themeMode === "light" ? "dark" : "light"
|
|
225
|
+
);
|
|
226
|
+
}}
|
|
227
|
+
>
|
|
228
|
+
{AppLayout.themeMode === "light" ? (
|
|
229
|
+
<FontAwesomeIcon icon="moon" />
|
|
230
|
+
) : (
|
|
231
|
+
<FontAwesomeIcon icon={{ prefix: "far", iconName: "sun" }} />
|
|
232
|
+
)}
|
|
233
|
+
</IconButton>
|
|
234
|
+
</Tooltip>
|
|
235
|
+
) : (
|
|
236
|
+
<></>
|
|
237
|
+
)}
|
|
238
|
+
|
|
234
239
|
{AppInfo.isLocalizationEnabled ? (
|
|
235
240
|
<Tooltip
|
|
236
241
|
title={
|
|
@@ -21,6 +21,8 @@ export type AppInfo = {
|
|
|
21
21
|
ar: { [key: string]: string };
|
|
22
22
|
en: { [key: string]: string };
|
|
23
23
|
};
|
|
24
|
+
appThemeMode: "dark" | "light";
|
|
25
|
+
allowThemeChange?: boolean;
|
|
24
26
|
loginScreenStyle?: {
|
|
25
27
|
themeMode: "dark" | "light";
|
|
26
28
|
backgroundImageNameInPublicFolder?: string;
|
|
@@ -68,6 +70,8 @@ const initialState: AppInfoProp = {
|
|
|
68
70
|
businessNavigationItems: [],
|
|
69
71
|
businessReduxReducers: {},
|
|
70
72
|
businessCommonStoresMetaData: {},
|
|
73
|
+
appThemeMode: "light",
|
|
74
|
+
allowThemeChange: true,
|
|
71
75
|
appTheme: {
|
|
72
76
|
light: { primaryColor: "#37505C", secondaryColor: "#ff6d00" },
|
|
73
77
|
dark: { primaryColor: "#ea690e", secondaryColor: "#74776B" },
|