@wix/form-public 0.143.0 → 0.144.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.cjs CHANGED
@@ -27644,6 +27644,7 @@ var NodeType4;
27644
27644
  NodeType5["CAPTION"] = "CAPTION";
27645
27645
  NodeType5["LAYOUT"] = "LAYOUT";
27646
27646
  NodeType5["LAYOUT_CELL"] = "LAYOUT_CELL";
27647
+ NodeType5["SHAPE"] = "SHAPE";
27647
27648
  })(NodeType4 || (NodeType4 = {}));
27648
27649
  var WidthType4;
27649
27650
  (function(WidthType5) {
@@ -28169,6 +28170,9 @@ var EditableProperties2;
28169
28170
  EditableProperties3["DESCRIPTION"] = "DESCRIPTION";
28170
28171
  EditableProperties3["INPUT_VALUE_LIMITS"] = "INPUT_VALUE_LIMITS";
28171
28172
  EditableProperties3["DEFAULT_VALUE"] = "DEFAULT_VALUE";
28173
+ EditableProperties3["ADDRESS_AUTOCOMPLETE"] = "ADDRESS_AUTOCOMPLETE";
28174
+ EditableProperties3["ADDRESS_FIELD_SETTINGS"] = "ADDRESS_FIELD_SETTINGS";
28175
+ EditableProperties3["ADDRESS_FIELD_VALIDATION"] = "ADDRESS_FIELD_VALIDATION";
28172
28176
  })(EditableProperties2 || (EditableProperties2 = {}));
28173
28177
  var RequiredIndicator4;
28174
28178
  (function(RequiredIndicator5) {
@@ -28221,6 +28225,8 @@ var FormatDescriptionKey = "formatDescription";
28221
28225
  var LocationIdsKey = "locationIds";
28222
28226
  var RepeaterFieldsKey = "fields";
28223
28227
  var RepeaterLayoutKey = "layout";
28228
+ var ScoreKey = "score";
28229
+ var CorrectAnswersKey = "correctAnswers";
28224
28230
  function makeViewOfInputField(inputOptions) {
28225
28231
  switch (inputOptions.inputType) {
28226
28232
  case InputType.STRING:
@@ -28305,13 +28311,23 @@ function takeSignatureInputViewProperties(signature) {
28305
28311
  };
28306
28312
  }
28307
28313
  function resolveArrayComponent(arrayComponent) {
28314
+ const quizSettings = resolveQuizFieldSettings(arrayComponent.quizFieldSettings);
28308
28315
  switch (arrayComponent.componentType) {
28309
28316
  case ComponentType.CHECKBOX_GROUP:
28310
- return takeCheckboxGroupViewProperties(arrayComponent.checkboxGroupOptions);
28317
+ return {
28318
+ ...takeCheckboxGroupViewProperties(arrayComponent.checkboxGroupOptions),
28319
+ ...quizSettings
28320
+ };
28311
28321
  case ComponentType.SERVICES_CHECKBOX_GROUP:
28312
- return takeCheckboxGroupViewProperties(arrayComponent.servicesCheckboxGroupOptions);
28322
+ return {
28323
+ ...takeCheckboxGroupViewProperties(arrayComponent.servicesCheckboxGroupOptions),
28324
+ ...quizSettings
28325
+ };
28313
28326
  case ComponentType.TAGS:
28314
- return takeTagsViewProperties(arrayComponent.tagsOptions);
28327
+ return {
28328
+ ...takeTagsViewProperties(arrayComponent.tagsOptions),
28329
+ ...quizSettings
28330
+ };
28315
28331
  default:
28316
28332
  throw new Error(`Unknown array component type: ${arrayComponent.componentType}`);
28317
28333
  }
@@ -28385,11 +28401,18 @@ function takeCheckBoxInputViewProperties(checkBox) {
28385
28401
  };
28386
28402
  }
28387
28403
  function resolveNumberComponent(numberComponent) {
28404
+ const quizSettings = resolveQuizFieldSettings(numberComponent.quizFieldSettings);
28388
28405
  switch (numberComponent.componentType) {
28389
28406
  case NumberComponentType.NUMBER_INPUT:
28390
- return takeNumberInputViewProperties(numberComponent.numberInputOptions);
28407
+ return {
28408
+ ...takeNumberInputViewProperties(numberComponent.numberInputOptions),
28409
+ ...quizSettings
28410
+ };
28391
28411
  case NumberComponentType.RATING_INPUT:
28392
- return takeRatingInputViewProperties(numberComponent.ratingInputOptions);
28412
+ return {
28413
+ ...takeRatingInputViewProperties(numberComponent.ratingInputOptions),
28414
+ ...quizSettings
28415
+ };
28393
28416
  default:
28394
28417
  throw new Error(`Unknown number component type: ${numberComponent.componentType}`);
28395
28418
  }
@@ -28423,27 +28446,58 @@ function takeRatingInputViewProperties(ratingInput) {
28423
28446
  };
28424
28447
  }
28425
28448
  function resolveStringComponent(stringComponent) {
28449
+ const quizSettings = resolveQuizFieldSettings(stringComponent.quizFieldSettings);
28426
28450
  switch (stringComponent.componentType) {
28427
28451
  case StringComponentType.TEXT_INPUT:
28428
- return takeTextInputViewProperties(stringComponent.textInputOptions);
28452
+ return {
28453
+ ...takeTextInputViewProperties(stringComponent.textInputOptions),
28454
+ ...quizSettings
28455
+ };
28429
28456
  case StringComponentType.PASSWORD:
28430
- return takePasswordViewProperties(stringComponent.passwordOptions);
28457
+ return {
28458
+ ...takePasswordViewProperties(stringComponent.passwordOptions),
28459
+ ...quizSettings
28460
+ };
28431
28461
  case StringComponentType.RADIO_GROUP:
28432
- return takeRadioGroupViewProperties(stringComponent.radioGroupOptions);
28462
+ return {
28463
+ ...takeRadioGroupViewProperties(stringComponent.radioGroupOptions),
28464
+ ...quizSettings
28465
+ };
28433
28466
  case StringComponentType.DROPDOWN:
28434
- return takeDropdownViewProperties(stringComponent.dropdownOptions);
28467
+ return {
28468
+ ...takeDropdownViewProperties(stringComponent.dropdownOptions),
28469
+ ...quizSettings
28470
+ };
28435
28471
  case StringComponentType.DATE_TIME:
28436
- return takeDateTimeViewProperties(stringComponent.dateTimeOptions);
28472
+ return {
28473
+ ...takeDateTimeViewProperties(stringComponent.dateTimeOptions),
28474
+ ...quizSettings
28475
+ };
28437
28476
  case StringComponentType.DATE_INPUT:
28438
- return takeDateInputViewProperties(stringComponent.dateInputOptions);
28477
+ return {
28478
+ ...takeDateInputViewProperties(stringComponent.dateInputOptions),
28479
+ ...quizSettings
28480
+ };
28439
28481
  case StringComponentType.TIME_INPUT:
28440
- return takeTimeInputViewProperties(stringComponent.timeInputOptions);
28482
+ return {
28483
+ ...takeTimeInputViewProperties(stringComponent.timeInputOptions),
28484
+ ...quizSettings
28485
+ };
28441
28486
  case StringComponentType.DATE_PICKER:
28442
- return takeDatePickerViewProperties(stringComponent.datePickerOptions);
28487
+ return {
28488
+ ...takeDatePickerViewProperties(stringComponent.datePickerOptions),
28489
+ ...quizSettings
28490
+ };
28443
28491
  case StringComponentType.PHONE_INPUT:
28444
- return takePhoneInputViewProperties(stringComponent.phoneInputOptions);
28492
+ return {
28493
+ ...takePhoneInputViewProperties(stringComponent.phoneInputOptions),
28494
+ ...quizSettings
28495
+ };
28445
28496
  case StringComponentType.SERVICES_DROPDOWN:
28446
- return takeServiceDropdownViewProperties(stringComponent.servicesDropdownOptions);
28497
+ return {
28498
+ ...takeServiceDropdownViewProperties(stringComponent.servicesDropdownOptions),
28499
+ ...quizSettings
28500
+ };
28447
28501
  default:
28448
28502
  throw new Error(`Unknown string component type: ${stringComponent.componentType}`);
28449
28503
  }
@@ -28815,6 +28869,18 @@ function takeRepeaterViewProperties(repeater) {
28815
28869
  }
28816
28870
  };
28817
28871
  }
28872
+ function resolveQuizFieldSettings(quizFieldSettings) {
28873
+ var _quizFieldSettings$co;
28874
+ const correctAnswers = quizFieldSettings == null || (_quizFieldSettings$co = quizFieldSettings.correctAnswersList) == null ? void 0 : _quizFieldSettings$co.correctAnswers;
28875
+ return {
28876
+ ...(quizFieldSettings == null ? void 0 : quizFieldSettings.score) !== void 0 && {
28877
+ [ScoreKey]: quizFieldSettings.score
28878
+ },
28879
+ ...(correctAnswers == null ? void 0 : correctAnswers.length) && {
28880
+ [CorrectAnswersKey]: correctAnswers
28881
+ }
28882
+ };
28883
+ }
28818
28884
 
28819
28885
  // ../form-transformer/dist/esm/lib/to-v1/make-view-of-display-properties.js
28820
28886
  var ContentKey = "content";