@form-engine-ts/react 4.7.0 → 5.0.0
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/README.md +15 -2
- package/dist/index.cjs +560 -422
- package/dist/index.d.cts +62 -9
- package/dist/index.d.ts +62 -9
- package/dist/index.js +412 -275
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -80,11 +80,24 @@ single-slot or batch translation with stale/manual status handling. The MUI pack
|
|
|
80
80
|
schema-driven pre-submit confirmation controls in the builder.
|
|
81
81
|
|
|
82
82
|
`useTranslationWorkspace` validates added locales against `policy.allowedLocales` and `policy.maxLocales` and returns
|
|
83
|
-
a structured `{ success, error }` result from `addLocale
|
|
84
|
-
|
|
83
|
+
a structured `{ success, error }` result from `addLocale`, `translateAll`, and `translateSlot`. Errors use the exported
|
|
84
|
+
`TranslationWorkspaceError` discriminated union. Built-in BCP 47, duplicate, and policy checks always run
|
|
85
|
+
before the optional `validateLocale` callback, which receives the canonical locale and a plain context object containing
|
|
86
|
+
the canonical default locale, current locales, and policy.
|
|
87
|
+
Locale input is normalized to its canonical BCP 47 form before duplicate, policy, custom-validation, and schema updates;
|
|
88
|
+
underscore-separated values such as `EN_us` are accepted as compatibility input.
|
|
85
89
|
Use `isAddLocaleAllowed` to disable locale controls before submission. Removing a locale also clears its
|
|
86
90
|
localized values and metadata; the default locale remains protected.
|
|
87
91
|
|
|
92
|
+
Wrap a builder or renderer in `FormEngineI18nProvider` to supply a UI locale and typed Core translator independently
|
|
93
|
+
from the schema's `defaultLocale` and `supportedLocales`:
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
<FormEngineI18nProvider locale="ja">
|
|
97
|
+
<MuiFormBuilder schema={schema} onChange={setSchema} />
|
|
98
|
+
</FormEngineI18nProvider>
|
|
99
|
+
```
|
|
100
|
+
|
|
88
101
|
## Headless builder and renderer lifecycle
|
|
89
102
|
|
|
90
103
|
`useFormBuilder({ schema, onChange, policy, idFactory, factories })` exposes controlled field, option, page, condition,
|