@wix/form-public 0.478.0 → 0.480.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.js CHANGED
@@ -51024,6 +51024,14 @@ var CHALLENGES_FIELD_TYPE_SET = new Set(CHALLENGES_FIELD_TYPES2);
51024
51024
  function isChallengesFieldType(identifier) {
51025
51025
  return identifier != null && CHALLENGES_FIELD_TYPE_SET.has(identifier);
51026
51026
  }
51027
+ var CHALLENGES_IMAGE_CHOICE_FIELD_TYPE = "QUIZ_IMAGE_CHOICE";
51028
+ function isChallengesImageChoice(identifier) {
51029
+ return identifier === CHALLENGES_IMAGE_CHOICE_FIELD_TYPE;
51030
+ }
51031
+ var SINGLE_ANSWER_MAX_ITEMS = 1;
51032
+ function isMultipleAnswersOfMaxItems(maxItems) {
51033
+ return maxItems !== SINGLE_ANSWER_MAX_ITEMS;
51034
+ }
51027
51035
 
51028
51036
  // ../form-transformer/dist/esm/lib/to-v1/make-validation-of-input-field.js
51029
51037
  function makeValidationOfInputField(inputOptions) {
@@ -51308,6 +51316,7 @@ function takeWixFileInputViewProperties(fileUpload, validation) {
51308
51316
  throw new Error(`Unknown file format: ${format}`);
51309
51317
  }
51310
51318
  });
51319
+ const labelMedia = toV1QuestionImageProperties(fileUpload.media, fileUpload.mediaSettings);
51311
51320
  return {
51312
51321
  [HideLabelKey]: !fileUpload.showLabel,
51313
51322
  [UploadFileFormatsKey]: fileFormats,
@@ -51323,7 +51332,8 @@ function takeWixFileInputViewProperties(fileUpload, validation) {
51323
51332
  },
51324
51333
  ...fileUpload.explanationText && {
51325
51334
  [ExplanationTextKey]: fileUpload.explanationText
51326
- }
51335
+ },
51336
+ ...labelMedia
51327
51337
  };
51328
51338
  }
51329
51339
  function takeSignatureInputViewProperties(signature) {
@@ -52007,7 +52017,7 @@ function resolveRootProperties(field) {
52007
52017
  fieldType: field.identifier,
52008
52018
  ...makeInputView(field.identifier, field.inputOptions)
52009
52019
  },
52010
- validation: makeValidationOfInputField(field.inputOptions)
52020
+ validation: makeInputValidation(field.identifier, field.inputOptions)
52011
52021
  };
52012
52022
  }
52013
52023
  if (field.displayOptions) {
@@ -52022,11 +52032,28 @@ function resolveRootProperties(field) {
52022
52032
  }
52023
52033
  function makeInputView(identifier, inputOptions) {
52024
52034
  const view = makeViewOfInputField(inputOptions);
52025
- if (isChallengesFieldType(identifier)) {
52026
- const { score, correctAnswers, ...viewWithoutQuizData } = view;
52035
+ if (!isChallengesFieldType(identifier)) {
52036
+ return view;
52037
+ }
52038
+ const { score, correctAnswers, ...viewWithoutQuizData } = view;
52039
+ if (!isChallengesImageChoice(identifier)) {
52027
52040
  return viewWithoutQuizData;
52028
52041
  }
52029
- return view;
52042
+ return {
52043
+ ...viewWithoutQuizData,
52044
+ isMultipleAnswers: isMultipleAnswersOfMaxItems(inputOptions.arrayOptions?.validation?.maxItems)
52045
+ };
52046
+ }
52047
+ function makeInputValidation(identifier, inputOptions) {
52048
+ const validation = makeValidationOfInputField(inputOptions);
52049
+ if (!isChallengesImageChoice(identifier) || !validation.array) {
52050
+ return validation;
52051
+ }
52052
+ const { maxItems: _maxItems, ...array } = validation.array;
52053
+ return {
52054
+ ...validation,
52055
+ array
52056
+ };
52030
52057
  }
52031
52058
 
52032
52059
  // ../form-fields/dist/esm/services/form-view.js