@factorialco/fcode-react-forms 3.7.0 → 3.7.1
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/components/json-schema-form/fcode-json-schema-form.d.ts +5 -0
- package/dist/components/json-schema-form/fcode-json-schema-form.test.d.ts +1 -0
- package/dist/components/json-schema-form/flat-const-options.d.ts +18 -0
- package/dist/components/json-schema-form/flat-const-options.test.d.ts +1 -0
- package/dist/fcode-form.cjs.js +66 -66
- package/dist/fcode-form.cjs.js.map +1 -1
- package/dist/fcode-form.es.js +5429 -5352
- package/dist/fcode-form.es.js.map +1 -1
- package/dist/fcode-form.umd.js +65 -65
- package/dist/fcode-form.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -5,6 +5,11 @@ import { EmbedFormOptions } from '../../types';
|
|
|
5
5
|
export interface FcodeJsonSchemaFormProps extends Omit<React.ComponentProps<typeof ReactJsonSchemaForm>, 'validator'> {
|
|
6
6
|
locale?: string;
|
|
7
7
|
fallbackLocale?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Replaces the default AJV validator. Either way, the validator only ever
|
|
10
|
+
* sees `oneOf`/`anyOf` lists of `{ const, title }` options as the equivalent
|
|
11
|
+
* `enum` (see `flat-const-options.ts`), so long selects cannot overflow it.
|
|
12
|
+
*/
|
|
8
13
|
validator?: React.ComponentProps<typeof ReactJsonSchemaForm>['validator'];
|
|
9
14
|
embedFormOptions?: EmbedFormOptions;
|
|
10
15
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FormContextType, RJSFSchema, StrictRJSFSchema, ValidatorType } from '@rjsf/utils';
|
|
2
|
+
/**
|
|
3
|
+
* Rewrites every `oneOf`/`anyOf` that only lists `{ const, title }` options
|
|
4
|
+
* into the equivalent `enum`. Labels are not needed to validate, and AJV
|
|
5
|
+
* compiles each `oneOf` entry as one more nested `if`, so a select listing a
|
|
6
|
+
* whole directory (every employee of a company) overflows the call stack. An
|
|
7
|
+
* `enum` compiles flat whatever its length.
|
|
8
|
+
*
|
|
9
|
+
* Untouched subtrees keep their identity, and the same input always yields
|
|
10
|
+
* the same output, so AJV's per-object compilation cache keeps working.
|
|
11
|
+
*/
|
|
12
|
+
export declare const flattenConstOptions: <S>(schema: S) => S;
|
|
13
|
+
/**
|
|
14
|
+
* Wraps a validator so every schema it receives is passed through
|
|
15
|
+
* `flattenConstOptions` first. Rendering keeps reading the original schema, so
|
|
16
|
+
* selects still show each option's `title`.
|
|
17
|
+
*/
|
|
18
|
+
export declare const withFlatConstOptions: <T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>(validator: ValidatorType<T, S, F>) => ValidatorType<T, S, F>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|