@form-engine-ts/core 2.9.5 → 3.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 +2 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,7 +29,8 @@ if (!result.valid) console.error(result.issues);
|
|
|
29
29
|
Add `pages` to partition every field into an accessible wizard and use `validatePageAnswers(schema, pageIndex, values)`
|
|
30
30
|
for step-scoped validation. Schemas without `pages` remain single-page forms.
|
|
31
31
|
|
|
32
|
-
Store authoring-time translations on forms, fields, options, and pages. `resolveLocalizedSchema` applies
|
|
32
|
+
Store authoring-time translations on forms, fields, options, and pages. `resolveLocalizedSchema(schema, locale)` applies
|
|
33
|
+
them synchronously and returns the original schema when no locale is supplied,
|
|
33
34
|
while `populateSchemaTranslations` fills them through an injected `AsyncTranslationAdapter`. Population defaults to
|
|
34
35
|
`overwrite: "missing-only"`, accepts per-slot `shouldOverwrite` and `createMetadata` callbacks, and returns
|
|
35
36
|
`{ schema, report }` with updated and skipped translation slots.
|
package/dist/index.cjs
CHANGED
|
@@ -2035,7 +2035,7 @@ function translationSlots(schema, locale) {
|
|
|
2035
2035
|
return descriptors;
|
|
2036
2036
|
}
|
|
2037
2037
|
function resolveLocalizedSchema(schema, targetLocale) {
|
|
2038
|
-
if (targetLocale.length === 0 || targetLocale === schema.defaultLocale) return schema;
|
|
2038
|
+
if (targetLocale === void 0 || targetLocale.length === 0 || targetLocale === schema.defaultLocale) return schema;
|
|
2039
2039
|
const formTranslation = schema.translations?.[targetLocale];
|
|
2040
2040
|
const completionMessage = formTranslation?.completionMessage ?? schema.completionMessage;
|
|
2041
2041
|
return {
|
package/dist/index.d.cts
CHANGED
|
@@ -611,7 +611,7 @@ interface TranslationReport {
|
|
|
611
611
|
readonly updatedSlots: readonly TranslationSlot[];
|
|
612
612
|
readonly skippedSlots: readonly TranslationSlot[];
|
|
613
613
|
}
|
|
614
|
-
declare function resolveLocalizedSchema(schema: FormSchema, targetLocale
|
|
614
|
+
declare function resolveLocalizedSchema(schema: FormSchema, targetLocale?: string): FormSchema;
|
|
615
615
|
declare function populateSchemaTranslations(schema: FormSchema, targetLocales: readonly string[], adapter: AsyncTranslationAdapter, options?: PopulateTranslationOptions): Promise<{
|
|
616
616
|
readonly schema: FormSchema;
|
|
617
617
|
readonly report: TranslationReport;
|
package/dist/index.d.ts
CHANGED
|
@@ -611,7 +611,7 @@ interface TranslationReport {
|
|
|
611
611
|
readonly updatedSlots: readonly TranslationSlot[];
|
|
612
612
|
readonly skippedSlots: readonly TranslationSlot[];
|
|
613
613
|
}
|
|
614
|
-
declare function resolveLocalizedSchema(schema: FormSchema, targetLocale
|
|
614
|
+
declare function resolveLocalizedSchema(schema: FormSchema, targetLocale?: string): FormSchema;
|
|
615
615
|
declare function populateSchemaTranslations(schema: FormSchema, targetLocales: readonly string[], adapter: AsyncTranslationAdapter, options?: PopulateTranslationOptions): Promise<{
|
|
616
616
|
readonly schema: FormSchema;
|
|
617
617
|
readonly report: TranslationReport;
|
package/dist/index.js
CHANGED
|
@@ -1967,7 +1967,7 @@ function translationSlots(schema, locale) {
|
|
|
1967
1967
|
return descriptors;
|
|
1968
1968
|
}
|
|
1969
1969
|
function resolveLocalizedSchema(schema, targetLocale) {
|
|
1970
|
-
if (targetLocale.length === 0 || targetLocale === schema.defaultLocale) return schema;
|
|
1970
|
+
if (targetLocale === void 0 || targetLocale.length === 0 || targetLocale === schema.defaultLocale) return schema;
|
|
1971
1971
|
const formTranslation = schema.translations?.[targetLocale];
|
|
1972
1972
|
const completionMessage = formTranslation?.completionMessage ?? schema.completionMessage;
|
|
1973
1973
|
return {
|