@topconsultnpm/sdkui-react-beta 6.6.119 → 6.6.120
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/lib/helper/helpers.d.ts +1 -4
- package/lib/helper/helpers.js +1 -25
- package/package.json +1 -1
package/lib/helper/helpers.d.ts
CHANGED
|
@@ -5,12 +5,9 @@ import { FormModes } from "../ts";
|
|
|
5
5
|
declare const TABLET_WIDTH = 1024;
|
|
6
6
|
declare const MOBILE_WIDTH = 640;
|
|
7
7
|
declare const calcResponsiveDirection: (deviceType: DeviceType, desktopDir: 'horizontal' | 'vertical', tabletDir: 'horizontal' | 'vertical', mobileDir: 'horizontal' | 'vertical') => 'horizontal' | 'vertical';
|
|
8
|
-
declare const calcResponsiveDirectionUsingWith: (currentWidth: number, desktopDir: 'horizontal' | 'vertical', tabletDir: 'horizontal' | 'vertical', mobileDir: 'horizontal' | 'vertical') => 'horizontal' | 'vertical';
|
|
9
8
|
declare const openApps: (appModule: AppModules, tmSession: ITopMediaSession, appRoutes?: any[]) => Promise<void>;
|
|
10
9
|
export declare const setSDK_GlobalsInfoAsync: (tms: ITopMediaSession | undefined) => Promise<ITopMediaSession>;
|
|
11
10
|
declare const calcResponsiveSizes: (deviceType: DeviceType | undefined, desktopSize: string, tabletSize: string, mobileSize: string) => string;
|
|
12
|
-
declare const calcResponsiveSizesUsingWith: (currentWidth: number, desktopSize: string, tabletSize: string, mobileSize: string) => string;
|
|
13
|
-
declare const useWindowWidth: () => number;
|
|
14
11
|
declare const getColor: (color: ColorsType) => string;
|
|
15
12
|
declare const makeID: (length: number) => string;
|
|
16
13
|
declare function genUniqueId(): string;
|
|
@@ -26,4 +23,4 @@ export declare const canPrev: (visibleItems: any[], selectedItems: any[]) => boo
|
|
|
26
23
|
export declare const getPrev: (visibleItems: any[], selectedItems: any[]) => any;
|
|
27
24
|
export declare const calcSaveFormTitle: (rootTitle: string | undefined, formMode: FormModes, updateId: number | undefined, pathKeys: string[] | undefined) => string;
|
|
28
25
|
export declare function calcIsModified(formData: any, formDataOrig: any): boolean;
|
|
29
|
-
export { openApps, calcResponsiveDirection, calcResponsiveSizes, getColor, genUniqueId, makeID,
|
|
26
|
+
export { openApps, calcResponsiveDirection, calcResponsiveSizes, getColor, genUniqueId, makeID, MOBILE_WIDTH, TABLET_WIDTH };
|
package/lib/helper/helpers.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { useLayoutEffect, useState } from "react";
|
|
2
1
|
import { Colors } from "../utils/theme";
|
|
3
2
|
import { ButtonNames, DeviceType, TMExceptionBoxManager, TMMessageBoxManager, TMSpinner } from "../components";
|
|
4
3
|
import { SDK_Globals, SystemMIDsAsNumber, TopMediaServer } from "@topconsultnpm/sdk-ts-beta";
|
|
@@ -15,13 +14,6 @@ const calcResponsiveDirection = (deviceType, desktopDir, tabletDir, mobileDir) =
|
|
|
15
14
|
return tabletDir;
|
|
16
15
|
return mobileDir;
|
|
17
16
|
};
|
|
18
|
-
const calcResponsiveDirectionUsingWith = (currentWidth, desktopDir, tabletDir, mobileDir) => {
|
|
19
|
-
if (currentWidth > TABLET_WIDTH)
|
|
20
|
-
return desktopDir;
|
|
21
|
-
if (currentWidth <= TABLET_WIDTH && currentWidth > MOBILE_WIDTH)
|
|
22
|
-
return tabletDir;
|
|
23
|
-
return mobileDir;
|
|
24
|
-
};
|
|
25
17
|
const openApps = async (appModule, tmSession, appRoutes) => {
|
|
26
18
|
try {
|
|
27
19
|
window.Buffer = Buffer;
|
|
@@ -65,22 +57,6 @@ const calcResponsiveSizes = (deviceType, desktopSize, tabletSize, mobileSize) =>
|
|
|
65
57
|
return tabletSize;
|
|
66
58
|
return mobileSize;
|
|
67
59
|
};
|
|
68
|
-
const calcResponsiveSizesUsingWith = (currentWidth, desktopSize, tabletSize, mobileSize) => {
|
|
69
|
-
if (currentWidth > TABLET_WIDTH)
|
|
70
|
-
return desktopSize;
|
|
71
|
-
if (currentWidth <= TABLET_WIDTH && currentWidth > MOBILE_WIDTH)
|
|
72
|
-
return tabletSize;
|
|
73
|
-
return mobileSize;
|
|
74
|
-
};
|
|
75
|
-
const useWindowWidth = () => {
|
|
76
|
-
const [windowWidth, setWindowWidth] = useState(window.innerWidth);
|
|
77
|
-
const handleSize = () => { setWindowWidth(window.innerWidth); };
|
|
78
|
-
useLayoutEffect(() => {
|
|
79
|
-
window.addEventListener('resize', handleSize);
|
|
80
|
-
return () => window.removeEventListener('resize', handleSize);
|
|
81
|
-
}, []);
|
|
82
|
-
return (windowWidth);
|
|
83
|
-
};
|
|
84
60
|
//#endregion
|
|
85
61
|
const getColor = (color) => {
|
|
86
62
|
let c = '';
|
|
@@ -278,4 +254,4 @@ export const calcSaveFormTitle = (rootTitle, formMode, updateId, pathKeys) => {
|
|
|
278
254
|
};
|
|
279
255
|
export function calcIsModified(formData, formDataOrig) { return JSON.stringify(formData) !== JSON.stringify(formDataOrig); }
|
|
280
256
|
//#endregion
|
|
281
|
-
export { openApps, calcResponsiveDirection, calcResponsiveSizes, getColor, genUniqueId, makeID,
|
|
257
|
+
export { openApps, calcResponsiveDirection, calcResponsiveSizes, getColor, genUniqueId, makeID, MOBILE_WIDTH, TABLET_WIDTH };
|