@formio/js 5.1.0-dev.6109.79f22ad → 5.1.0-dev.6112.06b0f26

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.
Files changed (168) hide show
  1. package/README.md +7 -0
  2. package/dist/formio.builder.css +1 -0
  3. package/dist/formio.builder.min.css +1 -1
  4. package/dist/formio.form.css +1 -0
  5. package/dist/formio.form.js +116 -149
  6. package/dist/formio.form.min.css +1 -1
  7. package/dist/formio.form.min.js +1 -1
  8. package/dist/formio.full.css +1 -0
  9. package/dist/formio.full.js +123 -156
  10. package/dist/formio.full.min.css +1 -1
  11. package/dist/formio.full.min.js +1 -1
  12. package/dist/formio.js +65 -54
  13. package/dist/formio.min.js +1 -1
  14. package/dist/formio.utils.js +76 -76
  15. package/dist/formio.utils.min.js +1 -1
  16. package/lib/cjs/Element.d.ts +2 -1
  17. package/lib/cjs/Element.js +18 -39
  18. package/lib/cjs/EventEmitter.js +2 -25
  19. package/lib/cjs/Form.js +2 -25
  20. package/lib/cjs/PDF.js +1 -1
  21. package/lib/cjs/PDFBuilder.d.ts +1 -0
  22. package/lib/cjs/PDFBuilder.js +10 -11
  23. package/lib/cjs/Webform.d.ts +2 -2
  24. package/lib/cjs/Webform.js +9 -9
  25. package/lib/cjs/WebformBuilder.d.ts +1 -1
  26. package/lib/cjs/WebformBuilder.js +45 -21
  27. package/lib/cjs/Wizard.d.ts +1 -2
  28. package/lib/cjs/Wizard.js +18 -24
  29. package/lib/cjs/WizardBuilder.js +1 -1
  30. package/lib/cjs/components/_classes/component/Component.d.ts +0 -1
  31. package/lib/cjs/components/_classes/component/Component.js +55 -62
  32. package/lib/cjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
  33. package/lib/cjs/components/_classes/component/editForm/Component.edit.logic.js +1 -1
  34. package/lib/cjs/components/_classes/componentModal/ComponentModal.js +1 -1
  35. package/lib/cjs/components/_classes/input/Input.d.ts +1 -1
  36. package/lib/cjs/components/_classes/input/Input.js +3 -3
  37. package/lib/cjs/components/_classes/list/ListComponent.js +1 -1
  38. package/lib/cjs/components/_classes/nested/NestedComponent.js +7 -7
  39. package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
  40. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +1 -1
  41. package/lib/cjs/components/address/Address.js +1 -1
  42. package/lib/cjs/components/alert/Alert.js +1 -1
  43. package/lib/cjs/components/button/Button.js +1 -1
  44. package/lib/cjs/components/checkbox/Checkbox.js +1 -1
  45. package/lib/cjs/components/container/Container.js +1 -1
  46. package/lib/cjs/components/currency/Currency.js +1 -1
  47. package/lib/cjs/components/datagrid/DataGrid.js +1 -1
  48. package/lib/cjs/components/datamap/DataMap.js +7 -2
  49. package/lib/cjs/components/datetime/DateTime.d.ts +1 -1
  50. package/lib/cjs/components/datetime/DateTime.js +15 -13
  51. package/lib/cjs/components/day/Day.js +2 -2
  52. package/lib/cjs/components/editgrid/EditGrid.js +1 -1
  53. package/lib/cjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -1
  54. package/lib/cjs/components/fieldset/Fieldset.js +1 -0
  55. package/lib/cjs/components/file/File.js +1 -1
  56. package/lib/cjs/components/form/Form.js +14 -2
  57. package/lib/cjs/components/form/editForm/Form.edit.form.js +4 -3
  58. package/lib/cjs/components/number/Number.js +1 -1
  59. package/lib/cjs/components/panel/Panel.js +1 -1
  60. package/lib/cjs/components/radio/Radio.d.ts +8 -0
  61. package/lib/cjs/components/radio/Radio.js +16 -6
  62. package/lib/cjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +1 -1
  63. package/lib/cjs/components/select/Select.js +7 -3
  64. package/lib/cjs/components/select/editForm/Select.edit.data.js +1 -1
  65. package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +6 -0
  66. package/lib/cjs/components/selectboxes/SelectBoxes.js +1 -1
  67. package/lib/cjs/components/signature/Signature.js +1 -1
  68. package/lib/cjs/components/survey/Survey.js +1 -1
  69. package/lib/cjs/components/tags/Tags.js +1 -1
  70. package/lib/cjs/components/textarea/TextArea.js +9 -4
  71. package/lib/cjs/components/textfield/TextField.js +13 -31
  72. package/lib/cjs/components/time/Time.js +1 -1
  73. package/lib/cjs/formio.form.js +5 -5
  74. package/lib/cjs/providers/storage/uploadAdapter.js +1 -1
  75. package/lib/cjs/translations/en.d.ts +1 -232
  76. package/lib/cjs/translations/en.js +4 -2
  77. package/lib/cjs/utils/Evaluator.d.ts +20 -6
  78. package/lib/cjs/utils/Evaluator.js +38 -15
  79. package/lib/cjs/utils/builder.js +5 -5
  80. package/lib/cjs/utils/conditionOperators/IsEqualTo.js +3 -3
  81. package/lib/cjs/utils/formUtils.d.ts +2 -2
  82. package/lib/cjs/utils/index.d.ts +169 -2
  83. package/lib/cjs/utils/index.js +22 -2
  84. package/lib/cjs/utils/utils.d.ts +22 -37
  85. package/lib/cjs/utils/utils.js +64 -135
  86. package/lib/cjs/widgets/CalendarWidget.d.ts +1 -8
  87. package/lib/cjs/widgets/CalendarWidget.js +17 -43
  88. package/lib/mjs/Element.d.ts +2 -1
  89. package/lib/mjs/Element.js +11 -9
  90. package/lib/mjs/EventEmitter.js +2 -2
  91. package/lib/mjs/Form.js +1 -1
  92. package/lib/mjs/PDF.js +1 -1
  93. package/lib/mjs/PDFBuilder.d.ts +1 -0
  94. package/lib/mjs/PDFBuilder.js +9 -10
  95. package/lib/mjs/Webform.d.ts +2 -2
  96. package/lib/mjs/Webform.js +7 -7
  97. package/lib/mjs/WebformBuilder.d.ts +1 -1
  98. package/lib/mjs/WebformBuilder.js +36 -13
  99. package/lib/mjs/Wizard.d.ts +1 -2
  100. package/lib/mjs/Wizard.js +17 -23
  101. package/lib/mjs/WizardBuilder.js +1 -1
  102. package/lib/mjs/components/_classes/component/Component.d.ts +0 -1
  103. package/lib/mjs/components/_classes/component/Component.js +28 -12
  104. package/lib/mjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
  105. package/lib/mjs/components/_classes/component/editForm/Component.edit.logic.js +1 -1
  106. package/lib/mjs/components/_classes/componentModal/ComponentModal.js +1 -1
  107. package/lib/mjs/components/_classes/input/Input.d.ts +1 -1
  108. package/lib/mjs/components/_classes/input/Input.js +3 -3
  109. package/lib/mjs/components/_classes/list/ListComponent.js +1 -1
  110. package/lib/mjs/components/_classes/nested/NestedComponent.js +7 -7
  111. package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
  112. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +1 -1
  113. package/lib/mjs/components/address/Address.js +1 -1
  114. package/lib/mjs/components/alert/Alert.js +1 -1
  115. package/lib/mjs/components/button/Button.js +1 -1
  116. package/lib/mjs/components/checkbox/Checkbox.js +1 -1
  117. package/lib/mjs/components/container/Container.js +1 -1
  118. package/lib/mjs/components/currency/Currency.js +1 -1
  119. package/lib/mjs/components/datagrid/DataGrid.js +1 -1
  120. package/lib/mjs/components/datamap/DataMap.js +7 -2
  121. package/lib/mjs/components/datetime/DateTime.d.ts +1 -1
  122. package/lib/mjs/components/datetime/DateTime.js +15 -13
  123. package/lib/mjs/components/day/Day.js +2 -2
  124. package/lib/mjs/components/editgrid/EditGrid.js +1 -1
  125. package/lib/mjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -1
  126. package/lib/mjs/components/fieldset/Fieldset.js +1 -0
  127. package/lib/mjs/components/file/File.js +1 -1
  128. package/lib/mjs/components/form/Form.js +13 -2
  129. package/lib/mjs/components/form/editForm/Form.edit.form.js +3 -2
  130. package/lib/mjs/components/number/Number.js +1 -1
  131. package/lib/mjs/components/panel/Panel.js +1 -1
  132. package/lib/mjs/components/radio/Radio.d.ts +8 -0
  133. package/lib/mjs/components/radio/Radio.js +16 -6
  134. package/lib/mjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +1 -1
  135. package/lib/mjs/components/select/Select.js +7 -3
  136. package/lib/mjs/components/select/editForm/Select.edit.data.js +1 -1
  137. package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +6 -0
  138. package/lib/mjs/components/selectboxes/SelectBoxes.js +1 -1
  139. package/lib/mjs/components/signature/Signature.js +1 -1
  140. package/lib/mjs/components/survey/Survey.js +1 -1
  141. package/lib/mjs/components/tags/Tags.js +1 -1
  142. package/lib/mjs/components/textarea/TextArea.js +9 -4
  143. package/lib/mjs/components/textfield/TextField.js +7 -2
  144. package/lib/mjs/components/time/Time.js +1 -1
  145. package/lib/mjs/formio.form.js +3 -3
  146. package/lib/mjs/providers/storage/uploadAdapter.js +1 -1
  147. package/lib/mjs/translations/en.d.ts +1 -232
  148. package/lib/mjs/translations/en.js +8 -47
  149. package/lib/mjs/utils/Evaluator.d.ts +20 -6
  150. package/lib/mjs/utils/Evaluator.js +31 -13
  151. package/lib/mjs/utils/builder.js +1 -1
  152. package/lib/mjs/utils/conditionOperators/IsEqualTo.js +1 -1
  153. package/lib/mjs/utils/formUtils.d.ts +2 -2
  154. package/lib/mjs/utils/index.d.ts +169 -2
  155. package/lib/mjs/utils/index.js +18 -1
  156. package/lib/mjs/utils/utils.d.ts +22 -37
  157. package/lib/mjs/utils/utils.js +57 -109
  158. package/lib/mjs/widgets/CalendarWidget.d.ts +1 -8
  159. package/lib/mjs/widgets/CalendarWidget.js +17 -43
  160. package/package.json +5 -3
  161. package/lib/cjs/i18n.d.ts +0 -13
  162. package/lib/cjs/i18n.js +0 -19
  163. package/lib/cjs/utils/i18n.d.ts +0 -19
  164. package/lib/cjs/utils/i18n.js +0 -120
  165. package/lib/mjs/i18n.d.ts +0 -13
  166. package/lib/mjs/i18n.js +0 -14
  167. package/lib/mjs/utils/i18n.d.ts +0 -19
  168. package/lib/mjs/utils/i18n.js +0 -112
@@ -1,4 +1,4 @@
1
- import { getContextButtons } from '../../../utils/utils';
1
+ import { getContextButtons } from '../../../utils';
2
2
  export default [
3
3
  {
4
4
  key: 'recaptchaInfo',
@@ -2,7 +2,7 @@ import _ from 'lodash';
2
2
  import { Formio } from '../../Formio';
3
3
  import ListComponent from '../_classes/list/ListComponent';
4
4
  import Form from '../../Form';
5
- import { getRandomComponentId, boolValue, isPromise, componentValueTypes, getComponentSavedTypes, isSelectResourceWithObjectValue, removeHTML } from '../../utils/utils';
5
+ import { getRandomComponentId, boolValue, isPromise, componentValueTypes, getComponentSavedTypes, isSelectResourceWithObjectValue, removeHTML } from '../../utils';
6
6
  import Choices from '../../utils/ChoicesWrapper';
7
7
  export default class SelectComponent extends ListComponent {
8
8
  static schema(...extend) {
@@ -947,8 +947,9 @@ export default class SelectComponent extends ListComponent {
947
947
  });
948
948
  }
949
949
  // Add value options.
950
+ const value = this.undoValueTyping(this.dataValue);
950
951
  this.addValueOptions();
951
- this.setChoicesValue(this.dataValue);
952
+ this.setChoicesValue(value);
952
953
  if (this.isSelectResource && this.refs.addResource) {
953
954
  this.addEventListener(this.refs.addResource, 'click', (event) => {
954
955
  event.preventDefault();
@@ -1260,7 +1261,7 @@ export default class SelectComponent extends ListComponent {
1260
1261
  }
1261
1262
  _.set(submission.metadata.selectData, this.path, templateData);
1262
1263
  }
1263
- if (flags.resetValue && this.root?.submission && !this.options.readOnly) {
1264
+ if (flags.resetValue && !flags.fromSubmission && this.root?.submission && !this.options.readOnly) {
1264
1265
  const submission = this.root.submission;
1265
1266
  if (!submission.metadata) {
1266
1267
  submission.metadata = {};
@@ -1324,6 +1325,9 @@ export default class SelectComponent extends ListComponent {
1324
1325
  this.lazyLoadInit = true;
1325
1326
  const searchProperty = this.component.searchField || this.component.valueProperty;
1326
1327
  this.triggerUpdate(_.get(value.data || value, searchProperty, value), true);
1328
+ this.itemsLoaded.then(() => {
1329
+ this.setChoicesValue(value, hasPreviousValue, flags);
1330
+ });
1327
1331
  return changed;
1328
1332
  }
1329
1333
  // Add the value options.
@@ -1,5 +1,5 @@
1
1
  import _ from 'lodash';
2
- import { eachComponent } from '../../../utils/utils';
2
+ import { eachComponent } from '../../../utils';
3
3
  const calculateSingleSelectData = (context, defaultValue) => {
4
4
  const { instance, data } = context;
5
5
  const rawDefaultValue = instance.downloadedResources.find(resource => _.get(resource, data.valueProperty) === defaultValue);
@@ -8,6 +8,12 @@ export default class SelectBoxesComponent extends RadioComponent {
8
8
  * @returns {boolean} - If the value is empty.
9
9
  */
10
10
  isEmpty(value?: any): boolean;
11
+ /**
12
+ * Normalize values coming into updateValue.
13
+ * @param {any} value - The value to normalize.
14
+ * @returns {*} - The normalized value
15
+ */
16
+ normalizeValue(value: any): any;
11
17
  setInputsDisabled(value: any, onlyUnchecked: any): void;
12
18
  checkComponentValidity(data: any, dirty: any, rowData: any, options: any, errors?: any[]): boolean;
13
19
  }
@@ -1,5 +1,5 @@
1
1
  import _ from 'lodash';
2
- import { componentValueTypes, getComponentSavedTypes, boolValue, getComponent } from '../../utils/utils';
2
+ import { componentValueTypes, getComponentSavedTypes, boolValue, getComponent } from '../../utils';
3
3
  import RadioComponent from '../radio/Radio';
4
4
  export default class SelectBoxesComponent extends RadioComponent {
5
5
  static schema(...extend) {
@@ -1,7 +1,7 @@
1
1
  import SignaturePad from 'signature_pad';
2
2
  import Input from '../_classes/input/Input';
3
3
  import _ from 'lodash';
4
- import { componentValueTypes, getComponentSavedTypes } from '../../utils/utils';
4
+ import { componentValueTypes, getComponentSavedTypes } from '../../utils';
5
5
  export default class SignatureComponent extends Input {
6
6
  static schema(...extend) {
7
7
  return Input.schema({
@@ -1,6 +1,6 @@
1
1
  import _ from 'lodash';
2
2
  import Field from '../_classes/field/Field';
3
- import { boolValue, componentValueTypes, getComponentSavedTypes } from '../../utils/utils';
3
+ import { boolValue, componentValueTypes, getComponentSavedTypes } from '../../utils';
4
4
  export default class SurveyComponent extends Field {
5
5
  static schema(...extend) {
6
6
  return Field.schema({
@@ -1,4 +1,4 @@
1
- import { componentValueTypes, getComponentSavedTypes } from '../../utils/utils';
1
+ import { componentValueTypes, getComponentSavedTypes } from '../../utils';
2
2
  import Input from '../_classes/input/Input';
3
3
  import Choices from 'choices.js';
4
4
  export default class TagsComponent extends Input {
@@ -1,7 +1,7 @@
1
1
  /* global Quill */
2
2
  import TextFieldComponent from '../textfield/TextField';
3
3
  import _ from 'lodash';
4
- import { uniqueName, getBrowserInfo } from '../../utils/utils';
4
+ import { uniqueName, getBrowserInfo } from '../../utils';
5
5
  export default class TextAreaComponent extends TextFieldComponent {
6
6
  static schema(...extend) {
7
7
  return TextFieldComponent.schema({
@@ -58,8 +58,8 @@ export default class TextAreaComponent extends TextFieldComponent {
58
58
  if ((this.options.readOnly || this.disabled) && !this.isHtmlRenderMode()) {
59
59
  const elementStyle = this.info.attr.style || '';
60
60
  const children = `
61
- <div ${this._referenceAttributeName}="input"
62
- class="formio-editor-read-only-content"
61
+ <div ${this._referenceAttributeName}="input"
62
+ class="formio-editor-read-only-content"
63
63
  ${elementStyle ? `style='${elementStyle}'` : ''}
64
64
  role="textbox"
65
65
  aria-multiline="true"
@@ -188,7 +188,12 @@ export default class TextAreaComponent extends TextFieldComponent {
188
188
  const editorHeight = (numRows * 31) + 14;
189
189
  editor.ui.view.editable.editableElement.style.height = `${(editorHeight)}px`;
190
190
  }
191
- editor.isReadOnly = isReadOnly;
191
+ if (isReadOnly) {
192
+ editor.enableReadOnlyMode(this.id);
193
+ }
194
+ else {
195
+ editor.disableReadOnlyMode(this.id);
196
+ }
192
197
  editor.data.set(value);
193
198
  }
194
199
  editorReady(editor);
@@ -1,7 +1,7 @@
1
1
  import Input from '../_classes/input/Input';
2
2
  import { conformToMask } from '@formio/vanilla-text-mask';
3
3
  import Inputmask from 'inputmask';
4
- import * as FormioUtils from '../../utils/utils';
4
+ import FormioUtils from '../../utils';
5
5
  import _ from 'lodash';
6
6
  export default class TextFieldComponent extends Input {
7
7
  static schema(...extend) {
@@ -114,7 +114,12 @@ export default class TextFieldComponent extends Input {
114
114
  // If no value is provided, then set the defaultValue.
115
115
  if (!value.value) {
116
116
  const defaultValue = flags.noDefault ? this.emptyValue : this.defaultValue;
117
- value.value = Array.isArray(defaultValue) ? defaultValue[0] : defaultValue;
117
+ if (Array.isArray(defaultValue)) {
118
+ value.value = _.isObject(defaultValue[0]) ? defaultValue[0].value : defaultValue;
119
+ }
120
+ else {
121
+ value.value = _.isObject(defaultValue) ? defaultValue.value : defaultValue;
122
+ }
118
123
  }
119
124
  return value;
120
125
  }
@@ -1,6 +1,6 @@
1
1
  import moment from 'moment';
2
2
  import TextFieldComponent from '../textfield/TextField';
3
- import { getBrowserInfo } from '../../utils/utils';
3
+ import { getBrowserInfo } from '../../utils';
4
4
  const defaultDataFormat = 'HH:mm:ss';
5
5
  export default class TimeComponent extends TextFieldComponent {
6
6
  static schema(...extend) {
@@ -8,11 +8,11 @@ import Providers from './providers';
8
8
  import Widgets from './widgets';
9
9
  import Form from './Form';
10
10
  import Utils from './utils';
11
- import { Evaluator } from './utils/Evaluator';
12
11
  import Licenses from './licenses';
13
12
  import EventEmitter from './EventEmitter';
14
13
  import Webform from './Webform';
15
- import { I18n } from './utils/i18n';
14
+ import { I18n } from '@formio/core';
15
+ import { Evaluator, registerEvaluator } from './utils';
16
16
  Formio.loadModules = (path = `${Formio.getApiUrl()}/externalModules.js`, name = 'externalModules') => {
17
17
  Formio.requireLibrary(name, name, path, true)
18
18
  .then((modules) => {
@@ -83,7 +83,7 @@ export function registerModule(mod, defaultFn = null, options = {}) {
83
83
  Formio.Displays.addDisplays(mod.displays);
84
84
  break;
85
85
  case 'evaluator':
86
- Formio.Evaluator.registerEvaluator(mod.evaluator);
86
+ registerEvaluator(mod.evaluator);
87
87
  break;
88
88
  case 'translations':
89
89
  I18n.setDefaultTranslations(mod.translations);
@@ -1,4 +1,4 @@
1
- import { uniqueName } from '../../utils/utils';
1
+ import { uniqueName } from '../../utils';
2
2
  /**
3
3
  * UploadAdapter for CKEditor https://ckeditor.com/docs/ckeditor5/latest/framework/guides/deep-dive/upload-adapter.html
4
4
  */
@@ -1,233 +1,2 @@
1
- declare const _default: {
2
- unsavedRowsError: string;
3
- invalidRowsError: string;
4
- invalidRowError: string;
5
- invalidOption: string;
6
- invalidDay: string;
7
- complete: string;
8
- error: string;
9
- errorListHotkey: string;
10
- errorsListNavigationMessage: string;
11
- submitError: string;
12
- required: string;
13
- unique: string;
14
- array: string;
15
- array_nonempty: string;
16
- nonarray: string;
17
- select: string;
18
- pattern: string;
19
- minLength: string;
20
- maxLength: string;
21
- minWords: string;
22
- maxWords: string;
23
- min: string;
24
- max: string;
25
- maxDate: string;
26
- minDate: string;
27
- maxYear: string;
28
- minYear: string;
29
- minSelectedCount: string;
30
- maxSelectedCount: string;
31
- invalid_email: string;
32
- invalid_url: string;
33
- invalid_regex: string;
34
- invalid_date: string;
35
- invalid_day: string;
36
- invalidValueProperty: string;
37
- mask: string;
38
- valueIsNotAvailable: string;
39
- stripe: string;
40
- month: string;
41
- day: string;
42
- year: string;
43
- january: string;
44
- february: string;
45
- march: string;
46
- april: string;
47
- may: string;
48
- june: string;
49
- july: string;
50
- august: string;
51
- september: string;
52
- october: string;
53
- november: string;
54
- december: string;
55
- next: string;
56
- previous: string;
57
- cancel: string;
58
- submit: string;
59
- confirmCancel: string;
60
- saveDraftInstanceError: string;
61
- saveDraftAuthError: string;
62
- restoreDraftInstanceError: string;
63
- saveDraftError: string;
64
- restoreDraftError: string;
65
- time: string;
66
- cancelButtonAriaLabel: string;
67
- previousButtonAriaLabel: string;
68
- nextButtonAriaLabel: string;
69
- submitButtonAriaLabel: string;
70
- reCaptchaTokenValidationError: string;
71
- reCaptchaTokenNotSpecifiedError: string;
72
- apiKey: string;
73
- typeRemaining: string;
74
- typeCount: string;
75
- requiredDayField: string;
76
- requiredDayEmpty: string;
77
- requiredMonthField: string;
78
- requiredYearField: string;
79
- formNotReady: string;
80
- noFormElement: string;
81
- notUniqueKey: string;
82
- newFormSchema: string;
83
- missingUrl: string;
84
- urlNotAttachedToBtn: string;
85
- loadingProjectSettingsError: string;
86
- sessionStorageSupportError: string;
87
- builderUniqueError: string;
88
- pageNotFound: string;
89
- noDragInfoError: string;
90
- addonSupportTypeError: string;
91
- setPathError: string;
92
- calculatedPathDeprecation: string;
93
- unknownTemplate: string;
94
- unknownComponent: string;
95
- renderTemplateFunctionDeprecation: string;
96
- whenReadyDeprecation: string;
97
- loadResourcesError: string;
98
- noSelectDataConfiguration: string;
99
- indexedDBSupportError: string;
100
- caretPositionSavingError: string;
101
- iteratableRowsError: string;
102
- checkRowDeprecation: string;
103
- noOAuthBtn: string;
104
- noOAuthConfiguration: string;
105
- oAuthErrorsTitle: string;
106
- noOAuthFormUrl: string;
107
- oAuthStateError: string;
108
- componentInvalidRowValidation: string;
109
- videoPlayerNotFound: string;
110
- synchronizationFailed: string;
111
- fileWithDuplicatedNameInProgress: string;
112
- fileWithDuplicatedNameLoaded: string;
113
- nestedForm: string;
114
- noDataProvided: string;
115
- subformSubmissionLoadingError: string;
116
- noDelimiterSet: string;
117
- noSiteKey: string;
118
- failedToNormalize: string;
119
- failedToCompareItems: string;
120
- editorFocusError: string;
121
- quillImageUploadFailed: string;
122
- noFilesSelected: string;
123
- needConfigurationForQuill: string;
124
- waitPdfConverting: string;
125
- uploading: string;
126
- pasteBelow: string;
127
- copy: string;
128
- move: string;
129
- edit: string;
130
- editJson: string;
131
- remove: string;
132
- clickToSetValue: string;
133
- words: string;
134
- characters: string;
135
- addAnother: string;
136
- yes: string;
137
- no: string;
138
- wantToClearData: string;
139
- yesDelete: string;
140
- waitFileProcessing: string;
141
- wrongFileType: string;
142
- fileTooSmall: string;
143
- fileTooBig: string;
144
- noFileService: string;
145
- fileProcessingFailed: string;
146
- readyForUpload: string;
147
- readyForRemovingFromStorage: string;
148
- preparingFileToRemove: string;
149
- succefullyRemoved: string;
150
- succefullyUploaded: string;
151
- maxSelectItems: string;
152
- minSelectItems: string;
153
- clickToSign: string;
154
- surveyQuestion: string;
155
- surveyQuestionValue: string;
156
- success: string;
157
- noResultsFound: string;
158
- noChoices: string;
159
- typeToSearch: string;
160
- loading: string;
161
- help: string;
162
- component: string;
163
- save: string;
164
- preview: string;
165
- dragAndDropComponent: string;
166
- searchFields: string;
167
- noMatchesFound: string;
168
- fileName: string;
169
- size: string;
170
- type: string;
171
- gallery: string;
172
- camera: string;
173
- dropFilesToAttach: string;
174
- useCamera: string;
175
- browse: string;
176
- takePicture: string;
177
- switchToFileUpload: string;
178
- completeStatus: string;
179
- noStorageSet: string;
180
- noFileApiSupport: string;
181
- noFormDataSupport: string;
182
- noProgressSupport: string;
183
- close: string;
184
- addResource: string;
185
- autocomplete: string;
186
- showPreview: string;
187
- hidePreview: string;
188
- createPage: string;
189
- page: string;
190
- closeBtnDescription: string;
191
- cancelBtnDescription: string;
192
- saveBtnDescription: string;
193
- addOrRemove: string;
194
- anyFileTypesAllowed: string;
195
- allowedFileTypes: string;
196
- syncing: string;
197
- syncNow: string;
198
- pressToOpen: string;
199
- browseToAttachFileFor: string;
200
- or: string;
201
- numericOnly: string;
202
- uploadPdfFile: string;
203
- dropToStart: string;
204
- expand: string;
205
- collapse: string;
206
- add: string;
207
- delete: string;
208
- revert: string;
209
- removeBtnPressToRemove: string;
210
- file: string;
211
- captureVideo: string;
212
- captureAudio: string;
213
- captureImage: string;
214
- browseFiles: string;
215
- noComponentsSetInGrid: string;
216
- sortAscending: string;
217
- sortDescending: string;
218
- filter: string;
219
- clear: string;
220
- showItemsWithValue: string;
221
- gridItemsPerPage: string;
222
- gridAllItems: string;
223
- recordsSelectedOnPage: string;
224
- recordsSelectedInTable: string;
225
- gridSelectAll: string;
226
- itemsInTable: string;
227
- clearSelection: string;
228
- editGridRow: string;
229
- deleteGridRow: string;
230
- selected: string;
231
- actions: string;
232
- };
1
+ declare const _default: any;
233
2
  export default _default;
@@ -1,59 +1,26 @@
1
1
  import bootstrap from '@formio/bootstrap';
2
+ import { coreEnTranslation } from '@formio/core';
3
+ import _ from 'lodash';
2
4
  export default {
3
5
  ...(bootstrap?.translations?.en || {}),
6
+ // these keys contain a '-' to strip whitespace in core
7
+ // which is not handled correctly in the renderer, so we redefine them
8
+ ..._.omit(coreEnTranslation, ['maxDate', 'minDate']),
4
9
  unsavedRowsError: 'Please save all rows before proceeding.',
5
10
  invalidRowsError: 'Please correct invalid rows before proceeding.',
6
11
  invalidRowError: 'Invalid row. Please correct it or delete.',
7
12
  invalidOption: '{{field}} is an invalid value.',
8
13
  invalidDay: '{{field}} is not a valid day.',
14
+ alertMessageWithLabel: '{{label}}: {{message}}',
15
+ alertMessage: '{{message}}',
9
16
  complete: 'Submission Complete',
10
17
  error: 'Please fix the following errors before submitting.',
11
18
  errorListHotkey: 'Press Ctrl + Alt + X to go back to the error list.',
12
19
  errorsListNavigationMessage: 'Click to navigate to the field with following error.',
13
20
  submitError: 'Please check the form and correct all errors before submitting.',
14
- required: '{{field}} is required',
15
- unique: '{{field}} must be unique',
16
- array: '{{field}} must be an array',
17
- array_nonempty: '{{field}} must be a non-empty array', // eslint-disable-line camelcase
18
- nonarray: '{{field}} must not be an array',
19
- select: '{{field}} contains an invalid selection',
20
- pattern: '{{field}} does not match the pattern {{pattern}}',
21
- minLength: '{{field}} must have at least {{length}} characters.',
22
- maxLength: '{{field}} must have no more than {{length}} characters.',
23
- minWords: '{{field}} must have at least {{length}} words.',
24
- maxWords: '{{field}} must have no more than {{length}} words.',
25
- min: '{{field}} cannot be less than {{min}}.',
26
- max: '{{field}} cannot be greater than {{max}}.',
27
21
  maxDate: '{{field}} should not contain date after {{maxDate}}',
28
22
  minDate: '{{field}} should not contain date before {{minDate}}',
29
- maxYear: '{{field}} should not contain year greater than {{maxYear}}',
30
- minYear: '{{field}} should not contain year less than {{minYear}}',
31
- minSelectedCount: 'You must select at least {{minCount}} items',
32
- maxSelectedCount: 'You may only select up to {{maxCount}} items',
33
- invalid_email: '{{field}} must be a valid email.', // eslint-disable-line camelcase
34
- invalid_url: '{{field}} must be a valid url.', // eslint-disable-line camelcase
35
- invalid_regex: '{{field}} does not match the pattern {{regex}}.', // eslint-disable-line camelcase
36
- invalid_date: '{{field}} is not a valid date.', // eslint-disable-line camelcase
37
- invalid_day: '{{field}} is not a valid day.', // eslint-disable-line camelcase
38
- invalidValueProperty: 'Invalid Value Property',
39
- mask: '{{field}} does not match the mask.',
40
- valueIsNotAvailable: '{{ field }} is an invalid value.',
41
23
  stripe: '{{stripe}}',
42
- month: 'Month',
43
- day: 'Day',
44
- year: 'Year',
45
- january: 'January',
46
- february: 'February',
47
- march: 'March',
48
- april: 'April',
49
- may: 'May',
50
- june: 'June',
51
- july: 'July',
52
- august: 'August',
53
- september: 'September',
54
- october: 'October',
55
- november: 'November',
56
- december: 'December',
57
24
  next: 'Next',
58
25
  previous: 'Previous',
59
26
  cancel: 'Cancel',
@@ -72,12 +39,10 @@ export default {
72
39
  reCaptchaTokenValidationError: 'ReCAPTCHA: Token validation error',
73
40
  reCaptchaTokenNotSpecifiedError: 'ReCAPTCHA: Token is not specified in submission',
74
41
  apiKey: 'API Key is not unique: {{key}}',
42
+ apiKeyNotValid: 'API Key is not valid: {{key}}',
75
43
  typeRemaining: '{{ remaining }} {{ type }} remaining.',
76
44
  typeCount: '{{ count }} {{ type }}',
77
- requiredDayField: '{{ field }} is required',
78
45
  requiredDayEmpty: '{{ field }} is required',
79
- requiredMonthField: '{{ field }} is required',
80
- requiredYearField: '{{ field }} is required',
81
46
  formNotReady: 'Form not ready. Use form.ready promise',
82
47
  noFormElement: 'No DOM element for form.',
83
48
  notUniqueKey: 'API Key is not unique',
@@ -137,8 +102,6 @@ export default {
137
102
  words: 'words',
138
103
  characters: 'characters',
139
104
  addAnother: 'Add Another',
140
- yes: 'Yes',
141
- no: 'No',
142
105
  wantToClearData: 'Do you want to clear data?',
143
106
  yesDelete: 'Yes, delete it',
144
107
  waitFileProcessing: 'Processing file. Please wait...',
@@ -155,8 +118,6 @@ export default {
155
118
  maxSelectItems: 'You may only select up to {{maxCount}} items',
156
119
  minSelectItems: 'You must select at least {{minCount}} items',
157
120
  clickToSign: 'Click to Sign',
158
- surveyQuestion: 'Question',
159
- surveyQuestionValue: 'Value',
160
121
  success: 'Success',
161
122
  noResultsFound: 'No results found',
162
123
  noChoices: 'No choices to choose from',
@@ -1,7 +1,21 @@
1
- export class Evaluator {
2
- static cache: {};
3
- static protectedEval: boolean;
4
- static noeval: boolean;
5
- static template(template: any, hash: any): any;
6
- static interpolate(rawTemplate: any, data: any, _options: any): any;
1
+ /**
2
+ * For backwards compatibility we a standalone interpolate function. This merely calls the
3
+ * global mutable Evaluator instance's interpolate function.
4
+ * @param {...any} args - interpolate arguments, typically "rawTemplate", "data", and "options"
5
+ * @returns {any} the interpolation result.
6
+ */
7
+ export function interpolate(...args: any[]): any;
8
+ /**
9
+ * Set the evaluator to use for evaluating expressions.
10
+ * @param {CoreEvaluator} override - The new evaluator instance to use.
11
+ * @returns {void}
12
+ */
13
+ export function registerEvaluator(override: CoreEvaluator): void;
14
+ export class DefaultEvaluator extends CoreEvaluator {
15
+ cache: {};
16
+ protectedEval: boolean;
17
+ template(template: any, hash: any): any;
18
+ interpolate(rawTemplate: any, data: any, _options: any): any;
7
19
  }
20
+ export let Evaluator: DefaultEvaluator;
21
+ import { DefaultEvaluator as CoreEvaluator } from '@formio/core';
@@ -1,25 +1,24 @@
1
1
  import _ from 'lodash';
2
2
  import stringHash from 'string-hash';
3
- import { JSONLogicEvaluator as CoreEvaluator } from '@formio/core/utils';
4
- export class Evaluator extends CoreEvaluator {
5
- static cache = {};
6
- static protectedEval = false;
7
- static noeval = false;
8
- static template(template, hash) {
3
+ import { DefaultEvaluator as CoreEvaluator } from '@formio/core';
4
+ export class DefaultEvaluator extends CoreEvaluator {
5
+ cache = {};
6
+ protectedEval = false;
7
+ template(template, hash) {
9
8
  hash = hash || stringHash(template);
10
- if (Evaluator.cache[hash]) {
11
- return Evaluator.cache[hash];
9
+ if (this.cache[hash]) {
10
+ return this.cache[hash];
12
11
  }
13
12
  try {
14
13
  // Ensure we handle copied templates from the ejs files.
15
14
  template = template.replace(/ctx\./g, '');
16
- return (Evaluator.cache[hash] = _.template(template, Evaluator.templateSettings));
15
+ return (this.cache[hash] = _.template(template, this.templateSettings));
17
16
  }
18
17
  catch (err) {
19
18
  console.warn('Error while processing template', err, template);
20
19
  }
21
20
  }
22
- static interpolate(rawTemplate, data, _options) {
21
+ interpolate(rawTemplate, data, _options) {
23
22
  // Ensure reverse compatability.
24
23
  const options = _.isObject(_options) ? _options : { noeval: _options };
25
24
  if (typeof rawTemplate === 'function') {
@@ -33,11 +32,11 @@ export class Evaluator extends CoreEvaluator {
33
32
  }
34
33
  rawTemplate = String(rawTemplate);
35
34
  let template;
36
- if (Evaluator.noeval || options.noeval) {
37
- return CoreEvaluator.interpolateString(rawTemplate, data, _options);
35
+ if (this.noeval || options.noeval) {
36
+ return this.interpolateString(rawTemplate, data, _options);
38
37
  }
39
38
  else {
40
- template = Evaluator.template(rawTemplate);
39
+ template = this.template(rawTemplate);
41
40
  }
42
41
  if (typeof template === 'function') {
43
42
  try {
@@ -51,3 +50,22 @@ export class Evaluator extends CoreEvaluator {
51
50
  return template;
52
51
  }
53
52
  }
53
+ export let Evaluator = new DefaultEvaluator();
54
+ // preserve the standalone interpolate function for backwards compatibility
55
+ /**
56
+ * For backwards compatibility we a standalone interpolate function. This merely calls the
57
+ * global mutable Evaluator instance's interpolate function.
58
+ * @param {...any} args - interpolate arguments, typically "rawTemplate", "data", and "options"
59
+ * @returns {any} the interpolation result.
60
+ */
61
+ export function interpolate(...args) {
62
+ return Evaluator.interpolate(...args);
63
+ }
64
+ /**
65
+ * Set the evaluator to use for evaluating expressions.
66
+ * @param {CoreEvaluator} override - The new evaluator instance to use.
67
+ * @returns {void}
68
+ */
69
+ export function registerEvaluator(override) {
70
+ Evaluator = override;
71
+ }
@@ -1,5 +1,5 @@
1
1
  import _ from 'lodash';
2
- import { eachComponent, uniqueKey } from './utils';
2
+ import { eachComponent, uniqueKey } from './index';
3
3
  export default {
4
4
  /**
5
5
  * Appends a number to a component.key to keep it unique
@@ -1,6 +1,6 @@
1
1
  import ConditionOperator from './ConditionOperator';
2
2
  import _ from 'lodash';
3
- import { compareSelectResourceWithObjectTypeValues, isSelectResourceWithObjectValue } from '../utils';
3
+ import { compareSelectResourceWithObjectTypeValues, isSelectResourceWithObjectValue } from '../';
4
4
  export default class IsEqualTo extends ConditionOperator {
5
5
  static get operatorKey() {
6
6
  return 'isEqual';
@@ -26,8 +26,8 @@ export const getBestMatch: typeof Utils.getBestMatch;
26
26
  export const getComponentFromPath: typeof Utils.getComponentFromPath;
27
27
  export const getComponentValue: typeof Utils.getComponentValue;
28
28
  export const findComponents: typeof Utils.findComponents;
29
- export const eachComponentDataAsync: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataAsyncCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined) => Promise<void>;
30
- export const eachComponentData: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined) => void;
29
+ export const eachComponentDataAsync: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataAsyncCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined, noScopeReset?: boolean | undefined) => Promise<void>;
30
+ export const eachComponentData: (components: import("@formio/core").Component[], data: import("@formio/core").DataObject, fn: import("@formio/core").EachComponentDataCallback, includeAll?: boolean | undefined, local?: boolean | undefined, parent?: import("@formio/core").Component | undefined, parentPaths?: import("@formio/core").ComponentPaths | undefined, noScopeReset?: boolean | undefined) => void;
31
31
  export const getComponentKey: typeof Utils.getComponentKey;
32
32
  export const getContextualRowPath: typeof Utils.getContextualRowPath;
33
33
  export const getContextualRowData: typeof Utils.getContextualRowData;