@gravitee/graphene-policy-studio 3.53.1 → 3.54.0-fix-found-460-validation-scope.9ee2b67
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/USAGE_GUIDE.md +2 -0
- package/dist/components/PolicyConfig/HiddenErrorSummary.d.ts +17 -0
- package/dist/components/PolicyConfig/HiddenErrorSummary.d.ts.map +1 -0
- package/dist/components/PolicyConfig/PolicyConfigForm.d.ts +8 -2
- package/dist/components/PolicyConfig/PolicyConfigForm.d.ts.map +1 -1
- package/dist/components/PolicyConfig/PolicyConfigPanel.d.ts.map +1 -1
- package/dist/hooks/use-policy-config.d.ts +7 -1
- package/dist/hooks/use-policy-config.d.ts.map +1 -1
- package/dist/index.js +3702 -3642
- package/dist/lib/step-config-validation.d.ts +5 -1
- package/dist/lib/step-config-validation.d.ts.map +1 -1
- package/package.json +2 -2
package/USAGE_GUIDE.md
CHANGED
|
@@ -293,6 +293,8 @@ The Save button is **disabled** by default and becomes enabled when any of the f
|
|
|
293
293
|
|
|
294
294
|
Save is also **blocked** when any step has invalid configuration — the button stays disabled and a tooltip shows the error count.
|
|
295
295
|
|
|
296
|
+
Every error that blocks a step is on screen when the step is opened: a field shows its own error, and an error no field can show (a rule on the whole configuration, an object, a field the form has no input for) is listed above the step's form, by path.
|
|
297
|
+
|
|
296
298
|
A step is validated as the policy form shows it, whether it has been opened or not: its stored `configuration` with the schema defaults of the visible fields filled in at every depth, and without the fields the form hides (a `gioConfig.displayIf` that does not match, an inactive `dependencies` branch, an inactive `oneOf` / `anyOf` variant, when the stored values name the active one by a discriminator). A stored `{}` is completed like a step just added.
|
|
297
299
|
|
|
298
300
|
A step that is not edited keeps the configuration it was loaded with: opening it and closing it changes nothing. Once a field is edited, the step's `configuration` becomes the values of the form: the stored values, the defaults that completed them, and no hidden field. A `context.X` condition hides its field while the studio has no value for `X`, so a value stored under such a field is dropped on the first edit made before that context is there.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { HiddenFormError } from '@gravitee/graphene-core';
|
|
2
|
+
interface HiddenErrorSummaryProps {
|
|
3
|
+
readonly errors: readonly HiddenFormError[];
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* The configuration errors no field of the form shows (an object, a root error, a field with no
|
|
7
|
+
* renderer, a variant discriminator), listed by path. An invalid step blocks Save: without this
|
|
8
|
+
* list, such an error would block it with nothing on screen.
|
|
9
|
+
*
|
|
10
|
+
* Render it as long as the form is there, with or without errors. The list changes as the user
|
|
11
|
+
* types, so it is announced politely, not as an alert that interrupts each time. A live region
|
|
12
|
+
* announces what is added to it, not the content it is mounted with: it stays mounted, empty when
|
|
13
|
+
* there is nothing to list.
|
|
14
|
+
*/
|
|
15
|
+
export declare function HiddenErrorSummary({ errors }: HiddenErrorSummaryProps): import("react").JSX.Element;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=HiddenErrorSummary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HiddenErrorSummary.d.ts","sourceRoot":"","sources":["../../../src/components/PolicyConfig/HiddenErrorSummary.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAI/D,UAAU,uBAAuB;IAC/B,QAAQ,CAAC,MAAM,EAAE,SAAS,eAAe,EAAE,CAAC;CAC7C;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,MAAM,EAAE,EAAE,uBAAuB,+BA4BrE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JsonSchema } from '@gravitee/graphene-core';
|
|
1
|
+
import { HiddenFormError, JsonSchema } from '@gravitee/graphene-core';
|
|
2
2
|
import { FieldValues, UseFormReturn } from 'react-hook-form';
|
|
3
3
|
import { FlowPhase, Step } from '../../types';
|
|
4
4
|
interface PolicyConfigFormProps {
|
|
@@ -10,10 +10,16 @@ interface PolicyConfigFormProps {
|
|
|
10
10
|
/** `false` hides the message condition even on message phases and even when the step already has one. */
|
|
11
11
|
readonly supportsMessageCondition?: boolean;
|
|
12
12
|
readonly disabled?: boolean;
|
|
13
|
+
/** The configuration errors no field shows, listed above the form. */
|
|
14
|
+
readonly hiddenErrors?: readonly HiddenFormError[];
|
|
15
|
+
/** The Map the form writes the user's variant picks in, which the panel's resolver reads. */
|
|
16
|
+
readonly variantPicks?: Map<string, number>;
|
|
17
|
+
/** Called once the user has picked another variant: the panel validates the form again. */
|
|
18
|
+
readonly onVariantChange?: () => void;
|
|
13
19
|
readonly onDescriptionChange?: (value: string) => void;
|
|
14
20
|
readonly onConditionChange?: (value: string) => void;
|
|
15
21
|
readonly onMessageConditionChange?: (value: string) => void;
|
|
16
22
|
}
|
|
17
|
-
export declare function PolicyConfigForm({ schema, form, step, flowPhase, isSpg, supportsMessageCondition, disabled, onDescriptionChange, onConditionChange, onMessageConditionChange, }: PolicyConfigFormProps): import("react").JSX.Element;
|
|
23
|
+
export declare function PolicyConfigForm({ schema, form, step, flowPhase, isSpg, supportsMessageCondition, disabled, hiddenErrors, variantPicks, onVariantChange, onDescriptionChange, onConditionChange, onMessageConditionChange, }: PolicyConfigFormProps): import("react").JSX.Element;
|
|
18
24
|
export {};
|
|
19
25
|
//# sourceMappingURL=PolicyConfigForm.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PolicyConfigForm.d.ts","sourceRoot":"","sources":["../../../src/components/PolicyConfig/PolicyConfigForm.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"PolicyConfigForm.d.ts","sourceRoot":"","sources":["../../../src/components/PolicyConfig/PolicyConfigForm.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE3E,OAAO,KAAK,EAAW,WAAW,EAAE,aAAa,EAAE,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EACN,IAAI,EACJ,SAAS,EACT,SAAgB,EAChB,mBAAmB,EACnB,UAAmB,EACnB,cAAqB,EACrB,OAAO,EACP,QAAQ,EACR,WAAW,EACX,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,SAAS,GACV,EAAE,sBAAsB,+BA8MxB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JsonSchema } from '@gravitee/graphene-core';
|
|
1
|
+
import { HiddenFormError, JsonSchema } from '@gravitee/graphene-core';
|
|
2
2
|
import { useForm } from 'react-hook-form';
|
|
3
3
|
import { ApiType, FlowPhase, Policy, Step } from '../types';
|
|
4
4
|
interface UsePolicyConfigOptions {
|
|
@@ -16,6 +16,12 @@ interface UsePolicyConfigResult {
|
|
|
16
16
|
readonly apiType: ApiType;
|
|
17
17
|
readonly flowPhase: FlowPhase;
|
|
18
18
|
readonly isSpg: boolean;
|
|
19
|
+
/** The errors of the last validation that no field of the form shows: the panel lists them. */
|
|
20
|
+
readonly hiddenErrors: readonly HiddenFormError[];
|
|
21
|
+
/** The Map the form writes the user's variant picks in (`<JsonSchemaForm variantPicks>`). */
|
|
22
|
+
readonly variantPicks: Map<string, number>;
|
|
23
|
+
/** Validates the form again once the user has picked another variant (`<JsonSchemaForm onVariantChange>`). */
|
|
24
|
+
readonly onVariantChange: () => void;
|
|
19
25
|
}
|
|
20
26
|
/**
|
|
21
27
|
* Fetches the policy JSON Schema and creates a react-hook-form instance
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-policy-config.d.ts","sourceRoot":"","sources":["../../src/hooks/use-policy-config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"use-policy-config.d.ts","sourceRoot":"","sources":["../../src/hooks/use-policy-config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE3E,OAAO,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