procode-lowcode-core 1.0.8 → 1.0.9
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.esm.js +7 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/Action/StandardActions/handleCreateAndNavigate.ts +5 -5
- package/src/Action/helpers/validateUiElementSchema.ts +14 -7
- package/src/Renderer/WidgetRenderer/Widget.tsx +7 -2
- package/src/Screens/Screen.tsx +1 -1
- package/src/Services/helpers/replaceRequestParams.ts +3 -4
package/package.json
CHANGED
|
@@ -7,11 +7,11 @@ import handleNavigation from "./handleNavigation";
|
|
|
7
7
|
import { appActions } from "../../Store/Slices/appSlice";
|
|
8
8
|
|
|
9
9
|
const handleCreateAndNavigate = async (
|
|
10
|
-
actionInvokerProps: ActionInvokerProperties
|
|
10
|
+
actionInvokerProps: ActionInvokerProperties,
|
|
11
11
|
) => {
|
|
12
12
|
const eventService = actionInvokerProps.eventService;
|
|
13
13
|
const dispatch = eventService?.emit(eventServiceType.DISPATCH_STORE);
|
|
14
|
-
|
|
14
|
+
// const appActions = eventService?.emit(eventServiceType.DATASTATE_ACTION);
|
|
15
15
|
const uiSchema = eventService?.emit(eventServiceType.UISCHEMA);
|
|
16
16
|
|
|
17
17
|
const apiConfig =
|
|
@@ -28,14 +28,14 @@ const handleCreateAndNavigate = async (
|
|
|
28
28
|
uiSchema.rootScreenElement,
|
|
29
29
|
true,
|
|
30
30
|
{},
|
|
31
|
-
actionInvokerProps.executeValidation
|
|
31
|
+
actionInvokerProps.executeValidation,
|
|
32
32
|
);
|
|
33
33
|
validationResult.isSchemaValid = isSchemaValid;
|
|
34
34
|
validationResult.schemaInvalidMessages = schemaInvalidMessages;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
dispatch?.(
|
|
38
|
-
appActions?.loadValidation(validationResult.schemaInvalidMessages)
|
|
38
|
+
appActions?.loadValidation(validationResult.schemaInvalidMessages),
|
|
39
39
|
);
|
|
40
40
|
|
|
41
41
|
if (validationResult.isSchemaValid) {
|
|
@@ -44,7 +44,7 @@ const handleCreateAndNavigate = async (
|
|
|
44
44
|
?.createModel(
|
|
45
45
|
actionInvokerProps.viewModel.screenData,
|
|
46
46
|
apiConfig,
|
|
47
|
-
eventService
|
|
47
|
+
eventService,
|
|
48
48
|
);
|
|
49
49
|
|
|
50
50
|
handleNavigation(actionInvokerProps);
|
|
@@ -6,7 +6,7 @@ export const validateUiElementSchema = (
|
|
|
6
6
|
uiElement: any,
|
|
7
7
|
isSchemaValid: boolean,
|
|
8
8
|
schemaInvalidMessages: Record<string, string[]>,
|
|
9
|
-
executeValidation: ExecuteValidationFC
|
|
9
|
+
executeValidation: ExecuteValidationFC,
|
|
10
10
|
) => {
|
|
11
11
|
if (
|
|
12
12
|
uiElement.uiElementType === ScreenUIType.WIDGET &&
|
|
@@ -15,21 +15,24 @@ export const validateUiElementSchema = (
|
|
|
15
15
|
const { isComponentValid, invalidMessages } = executeValidation({
|
|
16
16
|
executeMode: ExecuteMode.ONSUBMIT,
|
|
17
17
|
modifiedViewModel: undefined,
|
|
18
|
-
screenDataField:uiElement.screenDataField,
|
|
19
|
-
validations:uiElement.validations
|
|
18
|
+
screenDataField: uiElement.screenDataField,
|
|
19
|
+
validations: uiElement.validations,
|
|
20
20
|
});
|
|
21
21
|
isSchemaValid = isSchemaValid && isComponentValid;
|
|
22
22
|
schemaInvalidMessages = {
|
|
23
23
|
...schemaInvalidMessages,
|
|
24
24
|
[uiElement.screenDataField]: invalidMessages,
|
|
25
25
|
};
|
|
26
|
-
} else if (
|
|
26
|
+
} else if (
|
|
27
|
+
uiElement.uiElementType === ScreenUIType.LAYOUT &&
|
|
28
|
+
uiElement.visible !== false
|
|
29
|
+
) {
|
|
27
30
|
uiElement.cells.forEach((cell: any) => {
|
|
28
31
|
const result = validateUiElementSchema(
|
|
29
32
|
cell,
|
|
30
33
|
isSchemaValid,
|
|
31
34
|
schemaInvalidMessages,
|
|
32
|
-
executeValidation
|
|
35
|
+
executeValidation,
|
|
33
36
|
);
|
|
34
37
|
isSchemaValid = isSchemaValid && result.isSchemaValid;
|
|
35
38
|
schemaInvalidMessages = {
|
|
@@ -37,13 +40,17 @@ export const validateUiElementSchema = (
|
|
|
37
40
|
...result.schemaInvalidMessages,
|
|
38
41
|
};
|
|
39
42
|
});
|
|
40
|
-
} else if (
|
|
43
|
+
} else if (
|
|
44
|
+
uiElement.children &&
|
|
45
|
+
uiElement.children.length > 0 &&
|
|
46
|
+
uiElement.visible !== false
|
|
47
|
+
) {
|
|
41
48
|
uiElement.children.forEach((child: any) => {
|
|
42
49
|
const result = validateUiElementSchema(
|
|
43
50
|
child,
|
|
44
51
|
isSchemaValid,
|
|
45
52
|
schemaInvalidMessages,
|
|
46
|
-
executeValidation
|
|
53
|
+
executeValidation,
|
|
47
54
|
);
|
|
48
55
|
isSchemaValid = isSchemaValid && result.isSchemaValid;
|
|
49
56
|
schemaInvalidMessages = {
|
|
@@ -26,7 +26,7 @@ const Widget: React.FC<WidgetInjectorProps> = ({
|
|
|
26
26
|
viewModel,
|
|
27
27
|
validation,
|
|
28
28
|
eventService,
|
|
29
|
-
navigate
|
|
29
|
+
navigate,
|
|
30
30
|
);
|
|
31
31
|
|
|
32
32
|
const standardWidgets = AppDependenceyProvider.getInstance()
|
|
@@ -54,7 +54,12 @@ const Widget: React.FC<WidgetInjectorProps> = ({
|
|
|
54
54
|
);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
return
|
|
57
|
+
return (
|
|
58
|
+
<WidgetComponent
|
|
59
|
+
{...widgetProps}
|
|
60
|
+
availableValidations={schemaElementProps.validations}
|
|
61
|
+
/>
|
|
62
|
+
);
|
|
58
63
|
};
|
|
59
64
|
|
|
60
65
|
export default Widget;
|
package/src/Screens/Screen.tsx
CHANGED
|
@@ -17,7 +17,7 @@ export type ReplaceHandler = (
|
|
|
17
17
|
url: string,
|
|
18
18
|
param: Param,
|
|
19
19
|
eventService: EventService,
|
|
20
|
-
routeParams?: any
|
|
20
|
+
routeParams?: any,
|
|
21
21
|
) => string;
|
|
22
22
|
|
|
23
23
|
const replaceHandlers: Record<ValueReplacePolicy, ReplaceHandler> = {
|
|
@@ -28,14 +28,13 @@ const replaceHandlers: Record<ValueReplacePolicy, ReplaceHandler> = {
|
|
|
28
28
|
[ValueReplacePolicy.ENVIROMENT]: enviromentHandler,
|
|
29
29
|
[ValueReplacePolicy.QUERYPARAMS]: queryParamHandler,
|
|
30
30
|
[ValueReplacePolicy.ROUTEPARAMS]: routeParamHandler,
|
|
31
|
-
|
|
32
31
|
};
|
|
33
32
|
|
|
34
33
|
export const replaceRequestParams = (
|
|
35
34
|
url: string,
|
|
36
35
|
params: Param[],
|
|
37
36
|
eventService: EventService,
|
|
38
|
-
routeParams?: any
|
|
37
|
+
routeParams?: any,
|
|
39
38
|
) => {
|
|
40
39
|
params.forEach((param) => {
|
|
41
40
|
let valueReplacePolicy = param.rightOperand.valueReplacePolicy;
|
|
@@ -48,7 +47,7 @@ export const replaceRequestParams = (
|
|
|
48
47
|
const handler = replaceHandlers[valueReplacePolicy];
|
|
49
48
|
|
|
50
49
|
if (handler) {
|
|
51
|
-
url = handler(url, param, eventService,routeParams);
|
|
50
|
+
url = handler(url, param, eventService, routeParams);
|
|
52
51
|
}
|
|
53
52
|
});
|
|
54
53
|
return url;
|