@admin-layout/client 3.0.0-alpha.41 → 3.0.0-alpha.45
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.
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import "reflect-metadata";
|
|
3
|
+
import { ApplicationErrorState } from '../interfaces';
|
|
3
4
|
/**
|
|
4
5
|
* An HOC that will render components using SLOT-FILL in case of
|
|
5
6
|
* backendError else it will render the Component Passed
|
|
@@ -8,6 +9,17 @@ interface ApplicationErrorHandlerCommonProps {
|
|
|
8
9
|
plugins: Record<string, any>;
|
|
9
10
|
children: ReactNode;
|
|
10
11
|
}
|
|
12
|
+
declare type IRendererComponentType = (props: {
|
|
13
|
+
applicationErrors: ApplicationErrorState[];
|
|
14
|
+
backendError: ApplicationErrorState;
|
|
15
|
+
}) => ReactElement;
|
|
16
|
+
declare type IApplicationErrorSlotType = (props: {
|
|
17
|
+
name: string;
|
|
18
|
+
fillProps: {
|
|
19
|
+
active: boolean;
|
|
20
|
+
applicationErrors: ApplicationErrorState[];
|
|
21
|
+
};
|
|
22
|
+
}) => ReactElement;
|
|
11
23
|
/**
|
|
12
24
|
* ApplicationErrorSlot is needed for mobile. Since for mobile
|
|
13
25
|
* we import Slot from @common-stack/react-mobile. The default
|
|
@@ -15,8 +27,9 @@ interface ApplicationErrorHandlerCommonProps {
|
|
|
15
27
|
* both ant and chakra
|
|
16
28
|
*
|
|
17
29
|
* @param FallbackComponent ReactNode
|
|
18
|
-
* @param [ApplicationErrorSlot]
|
|
30
|
+
* @param [ApplicationErrorSlot] IApplicationErrorSlotType
|
|
31
|
+
* @param [RendererComponent] IRendererComponentType
|
|
19
32
|
* @returns ReactNode
|
|
20
33
|
*/
|
|
21
|
-
export declare const ApplicationErrorHandlerCommon: (FallbackComponent: any, ApplicationErrorSlot?:
|
|
34
|
+
export declare const ApplicationErrorHandlerCommon: (FallbackComponent: any, ApplicationErrorSlot?: IApplicationErrorSlotType, RendererComponent?: IRendererComponentType) => ({ plugins, children }: ApplicationErrorHandlerCommonProps) => ReactElement;
|
|
22
35
|
export {};
|
|
@@ -11,16 +11,20 @@ import { backendErrorSelector } from '../redux/selectors';
|
|
|
11
11
|
* both ant and chakra
|
|
12
12
|
*
|
|
13
13
|
* @param FallbackComponent ReactNode
|
|
14
|
-
* @param [ApplicationErrorSlot]
|
|
14
|
+
* @param [ApplicationErrorSlot] IApplicationErrorSlotType
|
|
15
|
+
* @param [RendererComponent] IRendererComponentType
|
|
15
16
|
* @returns ReactNode
|
|
16
17
|
*/
|
|
17
|
-
export const ApplicationErrorHandlerCommon = (FallbackComponent, ApplicationErrorSlot
|
|
18
|
+
export const ApplicationErrorHandlerCommon = (FallbackComponent, ApplicationErrorSlot, RendererComponent) => ({ plugins, children }) => {
|
|
18
19
|
const applicationErrors = useSelector((state) => state === null || state === void 0 ? void 0 : state.applicationErrors);
|
|
19
20
|
const errors = applicationErrors === null || applicationErrors === void 0 ? void 0 : applicationErrors.filter((error) => !!plugins.find((plugin) => plugin.name === (error === null || error === void 0 ? void 0 : error.pluginName)));
|
|
20
21
|
const backendError = useSelector(backendErrorSelector);
|
|
21
22
|
const RenderApplicationErrorSlot = (props) => {
|
|
22
23
|
return !!ApplicationErrorSlot ? React.createElement(ApplicationErrorSlot, Object.assign({}, props)) : React.createElement(Slot, Object.assign({}, props));
|
|
23
24
|
};
|
|
25
|
+
if (!!RendererComponent) {
|
|
26
|
+
return React.createElement(RendererComponent, { applicationErrors: errors, backendError: backendError });
|
|
27
|
+
}
|
|
24
28
|
return (React.createElement(React.Fragment, null,
|
|
25
29
|
!!backendError ? React.createElement(FallbackComponent, { error: backendError }) : null,
|
|
26
30
|
!!(errors === null || errors === void 0 ? void 0 : errors.length)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApplicationErrorHandlerCommon.js","sourceRoot":"","sources":["../../src/components/ApplicationErrorHandlerCommon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkC,MAAM,OAAO,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAA;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"ApplicationErrorHandlerCommon.js","sourceRoot":"","sources":["../../src/components/ApplicationErrorHandlerCommon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkC,MAAM,OAAO,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAA;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAyB1D;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC3C,iBAAiB,EACjB,oBAAgD,EAChD,iBAA0C,EAC1C,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAsC,EAAgB,EAAE;IAC/E,MAAM,iBAAiB,GAAG,WAAW,CAAC,CAAC,KAEtC,EAAE,EAAE,CAAC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,iBAAiB,CAAC,CAAC;IAEhC,MAAM,MAAM,GAAG,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,MAAK,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,CAAA,CAAC,CAAC,CAAA;IAClH,MAAM,YAAY,GAAG,WAAW,CAAC,oBAAoB,CAAC,CAAC;IACvD,MAAM,0BAA0B,GAAG,CAAC,KAAK,EAAE,EAAE;QAC3C,OAAO,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,oBAAC,oBAAoB,oBAAK,KAAK,EAAI,CAAC,CAAC,CAAC,oBAAC,IAAI,oBAAK,KAAK,EAAI,CAAA;IAC3F,CAAC,CAAA;IAED,IAAI,CAAC,CAAC,iBAAiB,EAAE;QACvB,OAAO,oBAAC,iBAAiB,IACvB,iBAAiB,EAAE,MAAM,EACzB,YAAY,EAAE,YAAqC,GACnD,CAAA;KACH;IAED,OAAO,CACL;QACG,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,oBAAC,iBAAiB,IAAC,KAAK,EAAE,YAAY,GAAI,CAAC,CAAC,CAAC,IAAI;QAClE,CAAC,CAAC,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,CAAA;YACf,CAAC,CAAC,oBAAC,0BAA0B,IAAC,IAAI,EAAE,2BAA2B,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,EAAE,MAAM,EAAE,GAAI;YAC3H,CAAC,CAAC,QAAQ,CAEX,CACJ,CAAA;AACH,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@admin-layout/client",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.45",
|
|
4
4
|
"description": "Sample client for higher packages to depend on",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "CDMBase LLC",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"typescript": {
|
|
35
35
|
"definition": "lib/index.d.ts"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "106adb8da250d860ee6ccc90b2e431af0457d518"
|
|
38
38
|
}
|