@streamline-pulse/formkrafter-core 0.17.1 → 0.18.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/dist/index.d.ts +1 -1
- package/dist/index.js +24 -5
- package/dist/index.js.map +5 -5
- package/dist/utils/brick-spec.d.ts +1 -0
- package/dist/validators/validator.d.ts +2 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { BrickMold } from "./utils/brick-mold";
|
|
|
3
3
|
export { DropType, BrickMoldDropType, BrickSpecDropType } from "./utils/drop-type";
|
|
4
4
|
export { BrickStyles } from "./utils/brick-styles";
|
|
5
5
|
export { BrickBaseConfigs, CommonBrickProps, WithBrickBaseConfigs } from "./utils/common-brick-props";
|
|
6
|
-
export { BrickSpec, buildValidationSchema, iterateBricks, iterateSchemaBricks } from "./utils/brick-spec";
|
|
6
|
+
export { BrickSpec, buildValidationSchema, iterateBricks, iterateSchemaBricks, defaultFormData, } from "./utils/brick-spec";
|
|
7
7
|
export { getBrickData, wrapBrickData } from "./utils/brick-data";
|
|
8
8
|
export { SelectOption, normalizeOptions } from "./utils/options";
|
|
9
9
|
export { RecapItem, collectRecapItems } from "./utils/recap";
|
package/dist/index.js
CHANGED
|
@@ -6963,6 +6963,17 @@ function* iterateSchemaBricks(spec) {
|
|
|
6963
6963
|
yield* iterateSchemaBricks(child);
|
|
6964
6964
|
}
|
|
6965
6965
|
}
|
|
6966
|
+
function defaultFormData(spec) {
|
|
6967
|
+
const defaults = {};
|
|
6968
|
+
for (const brick of iterateSchemaBricks(spec)) {
|
|
6969
|
+
const key = brick.configs?.key;
|
|
6970
|
+
const value = brick.configs?.defaultValue;
|
|
6971
|
+
if (key && value !== undefined && !(key in defaults)) {
|
|
6972
|
+
defaults[key] = value;
|
|
6973
|
+
}
|
|
6974
|
+
}
|
|
6975
|
+
return defaults;
|
|
6976
|
+
}
|
|
6966
6977
|
function buildValidationSchema(brickSpecs, locale) {
|
|
6967
6978
|
if (!brickSpecs)
|
|
6968
6979
|
return;
|
|
@@ -7102,6 +7113,9 @@ var en = {
|
|
|
7102
7113
|
"stepper.back": "← Back",
|
|
7103
7114
|
"stepper.next": "Next →",
|
|
7104
7115
|
"stepper.submit": "Submit",
|
|
7116
|
+
"form.submit": "Submit",
|
|
7117
|
+
"field.required": "(required)",
|
|
7118
|
+
"form.invalid": "This form has missing or invalid fields",
|
|
7105
7119
|
"panel.cfg.validateSteps": "Validate each step",
|
|
7106
7120
|
"panel.cfg.allowStepClick": "Allow clicking steps to jump",
|
|
7107
7121
|
"panel.cfg.showSubmit": "Submit button on last step",
|
|
@@ -7237,6 +7251,9 @@ var frFkTranslations = {
|
|
|
7237
7251
|
"stepper.back": "← Précédent",
|
|
7238
7252
|
"stepper.next": "Suivant →",
|
|
7239
7253
|
"stepper.submit": "Envoyer",
|
|
7254
|
+
"form.submit": "Envoyer",
|
|
7255
|
+
"field.required": "(obligatoire)",
|
|
7256
|
+
"form.invalid": "Ce formulaire a des champs manquants ou invalides",
|
|
7240
7257
|
"panel.cfg.validateSteps": "Valider chaque étape",
|
|
7241
7258
|
"panel.cfg.allowStepClick": "Autoriser le saut d’étapes au clic",
|
|
7242
7259
|
"panel.cfg.showSubmit": "Bouton d’envoi à la dernière étape",
|
|
@@ -8335,7 +8352,7 @@ var hiddenKeys = (brickSpec, dataMap) => {
|
|
|
8335
8352
|
walk(brickSpec, false);
|
|
8336
8353
|
return hidden;
|
|
8337
8354
|
};
|
|
8338
|
-
var validateBrickSpecDataDetailed = (brickSpec, data, locale) => {
|
|
8355
|
+
var validateBrickSpecDataDetailed = (brickSpec, data, locale, ruleScope) => {
|
|
8339
8356
|
const errors = {};
|
|
8340
8357
|
const validate = compiledValidator(brickSpec, locale);
|
|
8341
8358
|
if (validate && !validate(data)) {
|
|
@@ -8350,7 +8367,7 @@ var validateBrickSpecDataDetailed = (brickSpec, data, locale) => {
|
|
|
8350
8367
|
if (!(key in errors))
|
|
8351
8368
|
errors[key] = message;
|
|
8352
8369
|
}
|
|
8353
|
-
const dataMap = typeof data === "object" && data !== null ? data : undefined;
|
|
8370
|
+
const dataMap = ruleScope ?? (typeof data === "object" && data !== null ? data : undefined);
|
|
8354
8371
|
for (const key of hiddenKeys(brickSpec, dataMap)) {
|
|
8355
8372
|
delete errors[key];
|
|
8356
8373
|
}
|
|
@@ -8377,10 +8394,11 @@ var rowSpecOf = (collection) => {
|
|
|
8377
8394
|
}
|
|
8378
8395
|
return rowSpec;
|
|
8379
8396
|
};
|
|
8380
|
-
var validateFormData = (brickSpec, data, locale) => {
|
|
8397
|
+
var validateFormData = (brickSpec, data, locale, ruleScope) => {
|
|
8381
8398
|
const present = stripEmpty(data);
|
|
8399
|
+
const scope2 = ruleScope ? { ...present, ...ruleScope } : undefined;
|
|
8382
8400
|
const errors = {
|
|
8383
|
-
...validateBrickSpecDataDetailed(brickSpec, present, locale).errors
|
|
8401
|
+
...validateBrickSpecDataDetailed(brickSpec, present, locale, scope2).errors
|
|
8384
8402
|
};
|
|
8385
8403
|
for (const brick of iterateSchemaBricks(brickSpec)) {
|
|
8386
8404
|
if (brick.type !== "collection")
|
|
@@ -9220,6 +9238,7 @@ export {
|
|
|
9220
9238
|
ensureBrickUids,
|
|
9221
9239
|
duplicateBrick,
|
|
9222
9240
|
defaultValidationMessage,
|
|
9241
|
+
defaultFormData,
|
|
9223
9242
|
convertFormioForm,
|
|
9224
9243
|
collectRecapItems,
|
|
9225
9244
|
buildValidationSchema,
|
|
@@ -9236,5 +9255,5 @@ export {
|
|
|
9236
9255
|
Base64FileUploadService
|
|
9237
9256
|
};
|
|
9238
9257
|
|
|
9239
|
-
//# debugId=
|
|
9258
|
+
//# debugId=BBAD1058C46A2B4364756E2164756E21
|
|
9240
9259
|
//# sourceMappingURL=index.js.map
|