procode-lowcode-core 1.0.9 → 1.0.11

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.
Files changed (35) hide show
  1. package/dist/index.esm.js +346 -6
  2. package/dist/index.esm.js.map +1 -1
  3. package/dist/index.js +346 -5
  4. package/dist/index.js.map +1 -1
  5. package/dist/types/Utils/resolveAppPath.d.ts +8 -0
  6. package/dist/types/Validation/IValidationFactory.d.ts +9 -1
  7. package/dist/types/Validation/StandardValidations/StandardValidationFactory.d.ts +24 -0
  8. package/dist/types/Validation/StandardValidations/betweenValidation.d.ts +5 -0
  9. package/dist/types/Validation/StandardValidations/comparisonValidationHelper.d.ts +20 -0
  10. package/dist/types/Validation/StandardValidations/greaterThanEqualValidation.d.ts +5 -0
  11. package/dist/types/Validation/StandardValidations/greaterThanValidation.d.ts +5 -0
  12. package/dist/types/Validation/StandardValidations/lessThanEqualValidation.d.ts +5 -0
  13. package/dist/types/Validation/StandardValidations/lessThanValidation.d.ts +5 -0
  14. package/dist/types/Validation/StandardValidations/maxCharCountValidation.d.ts +5 -0
  15. package/dist/types/Validation/StandardValidations/minCharCountValidation.d.ts +5 -0
  16. package/dist/types/Validation/StandardValidations/notBetweenValidation.d.ts +5 -0
  17. package/dist/types/Validation/Types.d.ts +1 -0
  18. package/dist/types/index.d.ts +1 -0
  19. package/package.json +1 -1
  20. package/src/Action/StandardActions/handleAPICreate.ts +19 -4
  21. package/src/ApplicationStart/AppRouter.tsx +20 -0
  22. package/src/Utils/resolveAppPath.ts +22 -0
  23. package/src/Validation/IValidationFactory.ts +8 -0
  24. package/src/Validation/StandardValidations/StandardValidationFactory.ts +16 -0
  25. package/src/Validation/StandardValidations/betweenValidation.ts +62 -0
  26. package/src/Validation/StandardValidations/comparisonValidationHelper.ts +74 -0
  27. package/src/Validation/StandardValidations/greaterThanEqualValidation.ts +49 -0
  28. package/src/Validation/StandardValidations/greaterThanValidation.ts +48 -0
  29. package/src/Validation/StandardValidations/lessThanEqualValidation.ts +49 -0
  30. package/src/Validation/StandardValidations/lessThanValidation.ts +48 -0
  31. package/src/Validation/StandardValidations/maxCharCountValidation.ts +27 -0
  32. package/src/Validation/StandardValidations/minCharCountValidation.ts +27 -0
  33. package/src/Validation/StandardValidations/notBetweenValidation.ts +62 -0
  34. package/src/Validation/Types.ts +1 -0
  35. package/src/index.ts +3 -0
@@ -0,0 +1,27 @@
1
+ import { ValidationFcProperties } from "../Types";
2
+
3
+ export const minCharCountValidation = ({
4
+ validation,
5
+ value,
6
+ }: ValidationFcProperties): { isValid: boolean; message: string } => {
7
+ const minCharCount = validation.params?.minCharCount;
8
+
9
+ if (minCharCount === undefined || minCharCount === null) {
10
+ console.error("MIN_CHAR_COUNT validation requires 'minCharCount' in params");
11
+ return { isValid: false, message: "Validation misconfigured: minCharCount param is missing" };
12
+ }
13
+
14
+ if (value === null || value === undefined || value === "") {
15
+ return { isValid: true, message: "" };
16
+ }
17
+
18
+ const strValue = String(value);
19
+ const isValid = strValue.length >= minCharCount;
20
+
21
+ return {
22
+ isValid,
23
+ message: isValid
24
+ ? ""
25
+ : validation.message || `Minimum ${minCharCount} characters required`,
26
+ };
27
+ };
@@ -0,0 +1,62 @@
1
+ import { ValidationFcProperties } from "../Types";
2
+ import {
3
+ resolveCompareValue,
4
+ parseValue,
5
+ formatValueForMessage,
6
+ isEmpty,
7
+ } from "./comparisonValidationHelper";
8
+
9
+ export const notBetweenValidation = ({
10
+ validation,
11
+ viewModel,
12
+ value,
13
+ }: ValidationFcProperties): { isValid: boolean; message: string } => {
14
+ const {
15
+ minValue,
16
+ minFieldPath,
17
+ maxValue,
18
+ maxFieldPath,
19
+ dataType = "number",
20
+ } = validation.params || {};
21
+
22
+ if (minValue === undefined && !minFieldPath) {
23
+ console.error(
24
+ "NOT_BETWEEN validation requires 'minValue' or 'minFieldPath' in params"
25
+ );
26
+ return { isValid: false, message: "Validation misconfigured: min boundary is missing" };
27
+ }
28
+
29
+ if (maxValue === undefined && !maxFieldPath) {
30
+ console.error(
31
+ "NOT_BETWEEN validation requires 'maxValue' or 'maxFieldPath' in params"
32
+ );
33
+ return { isValid: false, message: "Validation misconfigured: max boundary is missing" };
34
+ }
35
+
36
+ if (isEmpty(value)) return { isValid: true, message: "" };
37
+
38
+ const rawMin = resolveCompareValue(minValue, minFieldPath, viewModel);
39
+ const rawMax = resolveCompareValue(maxValue, maxFieldPath, viewModel);
40
+
41
+ if (isEmpty(rawMin) || isEmpty(rawMax)) return { isValid: true, message: "" };
42
+
43
+ const parsedValue = parseValue(value, dataType);
44
+ const parsedMin = parseValue(rawMin, dataType);
45
+ const parsedMax = parseValue(rawMax, dataType);
46
+
47
+ if (parsedValue === null || parsedMin === null || parsedMax === null) {
48
+ return { isValid: false, message: validation.message || `Invalid ${dataType} value` };
49
+ }
50
+
51
+ const isValid = parsedValue < parsedMin || parsedValue > parsedMax;
52
+ const minLabel = formatValueForMessage(rawMin, dataType);
53
+ const maxLabel = formatValueForMessage(rawMax, dataType);
54
+
55
+ return {
56
+ isValid,
57
+ message: isValid
58
+ ? ""
59
+ : validation.message ||
60
+ `Value must not be between ${minLabel} and ${maxLabel}`,
61
+ };
62
+ };
@@ -15,6 +15,7 @@ export type Validation = {
15
15
  executeMode: ExecuteMode;
16
16
  disabled: boolean;
17
17
  screenDataField?: string;
18
+ params?: Record<string, any>;
18
19
  };
19
20
 
20
21
  export type ValidationInvokerProperties = {
package/src/index.ts CHANGED
@@ -26,6 +26,9 @@ export type { default as IValidationFactory } from './Validation/IValidationFact
26
26
  // Schema Reader Interface
27
27
  export type { ISchemaReaderProvider } from './UIElement/ISchemaReaderProvider';
28
28
 
29
+ // Utils
30
+ export { resolveAppPath } from './Utils/resolveAppPath';
31
+
29
32
  // Core Styles Path (for SCSS imports)
30
33
  export const coreStyles = './Assets/styles/index.scss';
31
34