@formio/js 5.1.0-dev.5974.1be1688 → 5.1.0-dev.5976.f61da27

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 (108) hide show
  1. package/dist/formio.builder.css +19 -17
  2. package/dist/formio.builder.min.css +1 -1
  3. package/dist/formio.embed.js +1 -1
  4. package/dist/formio.embed.min.js +1 -1
  5. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  6. package/dist/formio.form.css +19 -17
  7. package/dist/formio.form.js +37 -37
  8. package/dist/formio.form.min.css +1 -1
  9. package/dist/formio.form.min.js +1 -1
  10. package/dist/formio.form.min.js.LICENSE.txt +3 -3
  11. package/dist/formio.full.css +19 -17
  12. package/dist/formio.full.js +43 -43
  13. package/dist/formio.full.min.css +2 -2
  14. package/dist/formio.full.min.js +1 -1
  15. package/dist/formio.full.min.js.LICENSE.txt +3 -3
  16. package/dist/formio.js +9 -9
  17. package/dist/formio.min.js +1 -1
  18. package/dist/formio.min.js.LICENSE.txt +1 -1
  19. package/dist/formio.utils.js +5 -5
  20. package/dist/formio.utils.min.js +1 -1
  21. package/dist/formio.utils.min.js.LICENSE.txt +1 -1
  22. package/lib/cjs/Embed.js +1 -1
  23. package/lib/cjs/Form.d.ts +2 -4
  24. package/lib/cjs/Form.js +3 -1
  25. package/lib/cjs/Formio.js +1 -1
  26. package/lib/cjs/PDFBuilder.js +2 -2
  27. package/lib/cjs/Webform.d.ts +5 -2
  28. package/lib/cjs/Webform.js +31 -16
  29. package/lib/cjs/WebformBuilder.d.ts +1 -0
  30. package/lib/cjs/WebformBuilder.js +14 -3
  31. package/lib/cjs/Wizard.js +2 -1
  32. package/lib/cjs/WizardBuilder.js +14 -1
  33. package/lib/cjs/components/Components.d.ts +3 -0
  34. package/lib/cjs/components/_classes/component/Component.js +12 -2
  35. package/lib/cjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
  36. package/lib/cjs/components/_classes/component/editForm/Component.edit.data.d.ts +37 -0
  37. package/lib/cjs/components/_classes/component/editForm/Component.edit.data.js +13 -2
  38. package/lib/cjs/components/_classes/component/editForm/utils.d.ts +1 -0
  39. package/lib/cjs/components/_classes/component/editForm/utils.js +3 -0
  40. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -0
  41. package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +3 -0
  42. package/lib/cjs/components/address/Address.js +1 -1
  43. package/lib/cjs/components/datetime/DateTime.d.ts +1 -1
  44. package/lib/cjs/components/datetime/DateTime.js +5 -5
  45. package/lib/cjs/components/day/Day.js +7 -5
  46. package/lib/cjs/components/file/File.js +2 -1
  47. package/lib/cjs/components/form/Form.d.ts +4 -2
  48. package/lib/cjs/components/form/Form.js +25 -10
  49. package/lib/cjs/components/form/editForm/Form.edit.data.js +1 -1
  50. package/lib/cjs/components/form/editForm/Form.edit.form.js +2 -2
  51. package/lib/cjs/components/select/Select.d.ts +0 -1
  52. package/lib/cjs/components/select/Select.js +3 -23
  53. package/lib/cjs/components/select/editForm/Select.edit.data.js +2 -2
  54. package/lib/cjs/components/tags/Tags.d.ts +1 -1
  55. package/lib/cjs/components/tags/Tags.js +2 -2
  56. package/lib/cjs/providers/storage/googleDrive.js +3 -2
  57. package/lib/cjs/providers/storage/s3.js +3 -3
  58. package/lib/cjs/providers/storage/xhr.d.ts +1 -0
  59. package/lib/cjs/providers/storage/xhr.js +6 -1
  60. package/lib/cjs/utils/ChoicesWrapper.d.ts +4 -25
  61. package/lib/cjs/utils/ChoicesWrapper.js +47 -124
  62. package/lib/cjs/utils/utils.d.ts +2 -1
  63. package/lib/cjs/utils/utils.js +3 -2
  64. package/lib/cjs/widgets/CalendarWidget.js +0 -14
  65. package/lib/mjs/Embed.js +1 -1
  66. package/lib/mjs/Form.d.ts +2 -4
  67. package/lib/mjs/Form.js +4 -2
  68. package/lib/mjs/Formio.js +1 -1
  69. package/lib/mjs/PDFBuilder.js +2 -2
  70. package/lib/mjs/Webform.d.ts +5 -2
  71. package/lib/mjs/Webform.js +31 -16
  72. package/lib/mjs/WebformBuilder.d.ts +1 -0
  73. package/lib/mjs/WebformBuilder.js +13 -2
  74. package/lib/mjs/Wizard.js +2 -1
  75. package/lib/mjs/WizardBuilder.js +14 -1
  76. package/lib/mjs/components/Components.d.ts +3 -0
  77. package/lib/mjs/components/_classes/component/Component.js +12 -2
  78. package/lib/mjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
  79. package/lib/mjs/components/_classes/component/editForm/Component.edit.data.d.ts +37 -0
  80. package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +13 -2
  81. package/lib/mjs/components/_classes/component/editForm/utils.d.ts +1 -0
  82. package/lib/mjs/components/_classes/component/editForm/utils.js +3 -0
  83. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -0
  84. package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +3 -0
  85. package/lib/mjs/components/address/Address.js +1 -1
  86. package/lib/mjs/components/datetime/DateTime.d.ts +1 -1
  87. package/lib/mjs/components/datetime/DateTime.js +5 -5
  88. package/lib/mjs/components/day/Day.js +7 -5
  89. package/lib/mjs/components/file/File.js +2 -1
  90. package/lib/mjs/components/form/Form.d.ts +4 -2
  91. package/lib/mjs/components/form/Form.js +25 -10
  92. package/lib/mjs/components/form/editForm/Form.edit.data.js +1 -1
  93. package/lib/mjs/components/form/editForm/Form.edit.form.js +2 -2
  94. package/lib/mjs/components/select/Select.d.ts +0 -1
  95. package/lib/mjs/components/select/Select.js +3 -22
  96. package/lib/mjs/components/select/editForm/Select.edit.data.js +2 -2
  97. package/lib/mjs/components/tags/Tags.d.ts +1 -1
  98. package/lib/mjs/components/tags/Tags.js +2 -2
  99. package/lib/mjs/providers/storage/googleDrive.js +3 -2
  100. package/lib/mjs/providers/storage/s3.js +3 -3
  101. package/lib/mjs/providers/storage/xhr.d.ts +1 -0
  102. package/lib/mjs/providers/storage/xhr.js +6 -1
  103. package/lib/mjs/utils/ChoicesWrapper.d.ts +4 -25
  104. package/lib/mjs/utils/ChoicesWrapper.js +26 -119
  105. package/lib/mjs/utils/utils.d.ts +2 -1
  106. package/lib/mjs/utils/utils.js +3 -2
  107. package/lib/mjs/widgets/CalendarWidget.js +0 -14
  108. package/package.json +3 -3
@@ -6,7 +6,7 @@ export default [
6
6
  {
7
7
  weight: 140,
8
8
  type: 'checkbox',
9
- label: 'Clear Value When Hidden',
9
+ label: 'Omit Value From Submission Data When Conditionally Hidden',
10
10
  key: 'clearOnHide',
11
11
  defaultValue: true,
12
12
  tooltip: 'When a field is hidden, clear the value.',
@@ -66,7 +66,7 @@ export default [
66
66
  input: true,
67
67
  weight: 20,
68
68
  key: 'reference',
69
- label: 'Save as reference',
70
- tooltip: 'Using this option will save this field as a reference and link its value to the value of the origin record.'
69
+ label: 'Submit as reference',
70
+ tooltip: 'When "Submit as reference" is enabled, the form submission will be recorded against the Parent Form as well as the Child Form. When a submission recorded with "Submit as reference" is edited, the update is applied to each submission made against the Parent Form and Child Form.'
71
71
  }
72
72
  ];
@@ -126,7 +126,6 @@ export default class SelectComponent extends ListComponent {
126
126
  get isLoadingAvailable(): any;
127
127
  onScroll(): void;
128
128
  attachRefreshOnBlur(): void;
129
- addPlaceholderItem(placeholderValue: any): void;
130
129
  update(): void;
131
130
  addCurrentChoices(values: any, items: any, keyValue: any): any;
132
131
  getValueAsString(data: any, options: any): any;
@@ -772,8 +772,8 @@ export default class SelectComponent extends ListComponent {
772
772
  removeItemButton: this.component.disabled ? false : _.get(this.component, 'removeItemButton', true),
773
773
  itemSelectText: '',
774
774
  classNames: {
775
- containerOuter: 'choices form-group formio-choices',
776
- containerInner: this.transform('class', 'form-control ui fluid selection dropdown')
775
+ containerOuter: ['choices', 'form-group', 'formio-choices'],
776
+ containerInner: this.transform('class', 'form-control ui fluid selection dropdown').split(' '),
777
777
  },
778
778
  addItemText: false,
779
779
  allowHTML: true,
@@ -801,6 +801,7 @@ export default class SelectComponent extends ListComponent {
801
801
  }),
802
802
  valueComparer: _.isEqual,
803
803
  resetScrollPosition: false,
804
+ duplicateItemsAllowed: false,
804
805
  ...customOptions,
805
806
  };
806
807
  }
@@ -933,12 +934,6 @@ export default class SelectComponent extends ListComponent {
933
934
  this.positionDropdown();
934
935
  });
935
936
  }
936
- if (this.choices && choicesOptions.placeholderValue && this.choices._isSelectOneElement) {
937
- this.addPlaceholderItem(choicesOptions.placeholderValue);
938
- this.addEventListener(input, 'removeItem', () => {
939
- this.addPlaceholderItem(choicesOptions.placeholderValue);
940
- });
941
- }
942
937
  // Add value options.
943
938
  this.addValueOptions();
944
939
  this.setChoicesValue(this.dataValue);
@@ -1024,20 +1019,6 @@ export default class SelectComponent extends ListComponent {
1024
1019
  });
1025
1020
  }
1026
1021
  }
1027
- addPlaceholderItem(placeholderValue) {
1028
- const items = this.choices._store.activeItems;
1029
- if (!items.length) {
1030
- this.choices._addItem({
1031
- value: '',
1032
- label: placeholderValue,
1033
- choiceId: 0,
1034
- groupId: -1,
1035
- customProperties: null,
1036
- placeholder: true,
1037
- keyCode: null
1038
- });
1039
- }
1040
- }
1041
1022
  /* eslint-enable max-statements */
1042
1023
  update() {
1043
1024
  if (this.component.dataSrc === 'custom') {
@@ -635,8 +635,8 @@ export default [
635
635
  input: true,
636
636
  weight: 25,
637
637
  key: 'reference',
638
- label: 'Save as reference',
639
- tooltip: 'Using this option will save this field as a reference and link its value to the value of the origin record.',
638
+ label: 'Submit as reference',
639
+ tooltip: 'Using this option will submit this field as a reference id and link its value to the value of the origin record.',
640
640
  conditional: {
641
641
  json: { '===': [{ var: 'data.dataSrc' }, 'resource'] },
642
642
  },
@@ -24,4 +24,4 @@ export default class TagsComponent extends Input {
24
24
  getValueAsString(value: any): any;
25
25
  }
26
26
  import Input from '../_classes/input/Input';
27
- import Choices from '@formio/choices.js';
27
+ import Choices from 'choices.js';
@@ -1,6 +1,6 @@
1
1
  import { componentValueTypes, getComponentSavedTypes } from '../../utils/utils';
2
2
  import Input from '../_classes/input/Input';
3
- import Choices from '@formio/choices.js';
3
+ import Choices from 'choices.js';
4
4
  export default class TagsComponent extends Input {
5
5
  static schema(...extend) {
6
6
  return Input.schema({
@@ -127,7 +127,7 @@ export default class TagsComponent extends Input {
127
127
  const changed = super.setValue(value, flags);
128
128
  if (this.choices) {
129
129
  let dataValue = this.dataValue;
130
- this.choices.removeActiveItems();
130
+ this.choices.clearStore();
131
131
  if (dataValue) {
132
132
  if (typeof dataValue === 'string') {
133
133
  dataValue = dataValue.split(this.delimiter).filter(result => result);
@@ -50,10 +50,11 @@ function googledrive(formio) {
50
50
  xhr.send(fd);
51
51
  }));
52
52
  },
53
- downloadFile(file) {
53
+ downloadFile(file, component) {
54
54
  const token = formio.getToken();
55
+ // Constructed the url with the fileId, fileName, displayImage, imageSize if applicable
55
56
  file.url =
56
- `${formio.formUrl}/storage/gdrive?fileId=${file.id}&fileName=${file.originalName}${token ? `&x-jwt-token=${token}` : ''}`;
57
+ `${formio.formUrl}/storage/gdrive?fileId=${file.id}&fileName=${file.originalName}${token ? `&x-jwt-token=${token}` : ''}${component.image ? '&displayImage=true' : ''}${component.imageSize ? `&imageSize=${component.imageSize}` : ''}`;
57
58
  return Promise.resolve(file);
58
59
  },
59
60
  deleteFile: function deleteFile(fileInfo) {
@@ -75,7 +75,7 @@ function s3(formio) {
75
75
  const { changeMessage } = multipart;
76
76
  changeMessage('Completing AWS S3 multipart upload...');
77
77
  const token = formio.getToken();
78
- const response = await fetch(`${formio.formUrl}/storage/s3/multipart/complete`, {
78
+ const response = await XHR.fetch(`${formio.formUrl}/storage/s3/multipart/complete`, {
79
79
  method: 'POST',
80
80
  headers: {
81
81
  'Content-Type': 'application/json',
@@ -96,7 +96,7 @@ function s3(formio) {
96
96
  abortMultipartUpload(serverResponse) {
97
97
  const { uploadId, key } = serverResponse;
98
98
  const token = formio.getToken();
99
- fetch(`${formio.formUrl}/storage/s3/multipart/abort`, {
99
+ XHR.fetch(`${formio.formUrl}/storage/s3/multipart/abort`, {
100
100
  method: 'POST',
101
101
  headers: {
102
102
  'Content-Type': 'application/json',
@@ -113,7 +113,7 @@ function s3(formio) {
113
113
  const start = i * partSize;
114
114
  const end = (i + 1) * partSize;
115
115
  const blob = i < urls.length ? file.slice(start, end) : file.slice(start);
116
- const promise = fetch(urls[i], {
116
+ const promise = XHR.fetch(urls[i], {
117
117
  method: 'PUT',
118
118
  headers,
119
119
  body: blob,
@@ -3,6 +3,7 @@ export default XHR;
3
3
  declare namespace XHR {
4
4
  function trim(text: any): any;
5
5
  function path(items: any): any;
6
+ function fetch(url: any, options: any): Promise<Response>;
6
7
  function upload(formio: any, type: any, xhrCallback: any, file: any, fileName: any, dir: any, progressCallback: any, groupPermissions: any, groupId: any, abortCallback: any, multipartOptions: any): Promise<any>;
7
8
  function makeXhrRequest(formio: any, xhrCallback: any, serverResponse: any, progressCallback: any, abortCallback: any): Promise<any>;
8
9
  }
@@ -1,4 +1,5 @@
1
1
  import _trim from 'lodash/trim';
2
+ import { Formio } from '../../Formio';
2
3
  export const setXhrHeaders = (formio, xhr) => {
3
4
  const { headers } = formio.options;
4
5
  if (headers) {
@@ -20,12 +21,16 @@ const XHR = {
20
21
  path(items) {
21
22
  return items.filter(item => !!item).map(XHR.trim).join('/');
22
23
  },
24
+ fetch(url, options) {
25
+ options = Formio.pluginAlter('requestOptions', options, url);
26
+ return fetch(url, options);
27
+ },
23
28
  async upload(formio, type, xhrCallback, file, fileName, dir, progressCallback, groupPermissions, groupId, abortCallback, multipartOptions) {
24
29
  // make request to Form.io server
25
30
  const token = formio.getToken();
26
31
  let response;
27
32
  try {
28
- response = await fetch(`${formio.formUrl}/storage/${type}`, {
33
+ response = await XHR.fetch(`${formio.formUrl}/storage/${type}`, {
29
34
  method: 'POST',
30
35
  headers: {
31
36
  'Accept': 'application/json',
@@ -1,38 +1,17 @@
1
- export namespace KEY_CODES {
2
- let BACK_KEY: number;
3
- let DELETE_KEY: number;
4
- let TAB_KEY: number;
5
- let ENTER_KEY: number;
6
- let A_KEY: number;
7
- let ESC_KEY: number;
8
- let UP_KEY: number;
9
- let DOWN_KEY: number;
10
- let PAGE_UP_KEY: number;
11
- let PAGE_DOWN_KEY: number;
12
- }
13
1
  export default ChoicesWrapper;
14
2
  declare class ChoicesWrapper extends Choices {
15
3
  constructor(...args: any[]);
16
- _onTabKey({ activeItems, hasActiveDropdown }: {
17
- activeItems: any;
18
- hasActiveDropdown: any;
19
- }): void;
4
+ _onTabKey(): void;
20
5
  isDirectionUsing: boolean;
21
6
  shouldOpenDropDown: boolean;
22
7
  _onTouchEnd(event: any): void;
23
- _handleButtonAction(activeItems: any, element: any): void;
24
- _onEnterKey(args: any): void;
8
+ _onEnterKey(...args: any[]): void;
25
9
  _onDirectionKey(...args: any[]): void;
26
10
  timeout: NodeJS.Timeout | undefined;
27
11
  _selectHighlightedChoice(): void;
28
12
  _onKeyDown(event: any): void;
29
- onSelectValue({ event, activeItems, hasActiveDropdown }: {
30
- event: any;
31
- activeItems: any;
32
- hasActiveDropdown: any;
33
- }): void;
13
+ onSelectValue(event: any, hasActiveDropdown: any): void;
34
14
  showDropdown(...args: any[]): void;
35
15
  hideDropdown(...args: any[]): void;
36
- _onBlur(...args: any[]): void;
37
16
  }
38
- import Choices from '@formio/choices.js';
17
+ import Choices from 'choices.js';
@@ -1,41 +1,7 @@
1
- import Choices from '@formio/choices.js';
2
- /**
3
- * TODO: REMOVE THIS ONCE THE PULL REQUEST HAS BEEN RESOLVED.
4
- *
5
- * https://github.com/jshjohnson/Choices/pull/788
6
- *
7
- * This is intentionally not part of the extended class, since other components use Choices and need this fix as well.
8
- * @type {Choices._generatePlaceholderValue}
9
- * @private
10
- */
11
- Choices.prototype._generatePlaceholderValue = function () {
12
- if (this._isSelectElement && this.passedElement.placeholderOption) {
13
- const { placeholderOption } = this.passedElement;
14
- return placeholderOption ? placeholderOption.text : false;
15
- }
16
- const { placeholder, placeholderValue } = this.config;
17
- const { element: { dataset }, } = this.passedElement;
18
- if (placeholder) {
19
- if (placeholderValue) {
20
- return placeholderValue;
21
- }
22
- if (dataset.placeholder) {
23
- return dataset.placeholder;
24
- }
25
- }
26
- return false;
27
- };
28
- export const KEY_CODES = {
29
- BACK_KEY: 46,
30
- DELETE_KEY: 8,
1
+ import Choices, { KeyCodeMap } from 'choices.js';
2
+ const ExtendedKeyCodeMap = {
3
+ ...KeyCodeMap,
31
4
  TAB_KEY: 9,
32
- ENTER_KEY: 13,
33
- A_KEY: 65,
34
- ESC_KEY: 27,
35
- UP_KEY: 38,
36
- DOWN_KEY: 40,
37
- PAGE_UP_KEY: 33,
38
- PAGE_DOWN_KEY: 34,
39
5
  };
40
6
  class ChoicesWrapper extends Choices {
41
7
  constructor(...args) {
@@ -63,24 +29,13 @@ class ChoicesWrapper extends Choices {
63
29
  }
64
30
  this._wasTap = true;
65
31
  }
66
- _handleButtonAction(activeItems, element) {
67
- if (!this._isSelectOneElement) {
68
- return super._handleButtonAction(activeItems, element);
69
- }
70
- if (!activeItems ||
71
- !element ||
72
- !this.config.removeItems ||
73
- !this.config.removeItemButton) {
74
- return;
75
- }
76
- super._handleButtonAction(activeItems, element);
77
- }
78
- _onEnterKey(args) {
32
+ _onEnterKey(...args) {
33
+ const [event] = args;
79
34
  // Prevent dropdown form opening when removeItemButton was pressed using 'Enter' on keyboard
80
- if (args.event.target.className === 'choices__button') {
35
+ if (event.target.className === 'choices__button') {
81
36
  this.shouldOpenDropDown = false;
82
37
  }
83
- super._onEnterKey(args);
38
+ super._onEnterKey(...args);
84
39
  }
85
40
  _onDirectionKey(...args) {
86
41
  if (!this._isSelectOneElement) {
@@ -94,17 +49,18 @@ class ChoicesWrapper extends Choices {
94
49
  this.isDirectionUsing = false;
95
50
  }, 250);
96
51
  }
97
- _onTabKey({ activeItems, hasActiveDropdown }) {
98
- if (hasActiveDropdown) {
99
- this._selectHighlightedChoice(activeItems);
52
+ _onTabKey() {
53
+ if (this.dropdown.isActive) {
54
+ this._selectHighlightedChoice();
100
55
  }
101
56
  }
102
57
  _selectHighlightedChoice() {
103
- const highlightedChoice = this.dropdown.getChild(`.${this.config.classNames.highlightedState}`);
58
+ const highlightedChoice = this.dropdown.element.querySelector(`.${this.config.classNames.highlightedState}`);
104
59
  if (highlightedChoice) {
105
60
  const id = highlightedChoice.dataset.id;
106
- const choice = id && this._store.getChoiceById(id);
61
+ const choice = id && this._store.getChoiceById(Number(id));
107
62
  this._addItem({
63
+ id: choice.id,
108
64
  value: choice.value,
109
65
  label: choice.label,
110
66
  choiceId: choice.id,
@@ -115,61 +71,16 @@ class ChoicesWrapper extends Choices {
115
71
  });
116
72
  this._triggerChange(choice.value);
117
73
  }
118
- event.preventDefault();
119
74
  }
120
75
  _onKeyDown(event) {
121
- if (!this._isSelectOneElement) {
122
- return super._onKeyDown(event);
123
- }
124
- const { target, keyCode, ctrlKey, metaKey } = event;
125
- if (target !== this.input.element &&
126
- !this.containerOuter.element.contains(target)) {
127
- return;
128
- }
129
- const activeItems = this._store.activeItems;
130
- const hasFocusedInput = this.input.isFocussed;
131
- const hasActiveDropdown = this.dropdown.isActive;
132
- const hasItems = this.itemList.hasChildren;
133
- const keyString = String.fromCharCode(keyCode);
134
- const { BACK_KEY, DELETE_KEY, TAB_KEY, ENTER_KEY, A_KEY, ESC_KEY, UP_KEY, DOWN_KEY, PAGE_UP_KEY, PAGE_DOWN_KEY, } = KEY_CODES;
135
- const hasCtrlDownKeyPressed = ctrlKey || metaKey;
136
- // If a user is typing and the dropdown is not active
137
- if (!hasActiveDropdown && !this._isTextElement && /[a-zA-Z0-9-_ ]/.test(keyString)) {
138
- const currentValue = this.input.element.value;
139
- this.input.element.value = currentValue ? `${currentValue}${keyString}` : keyString;
140
- this.showDropdown();
141
- }
142
- // Map keys to key actions
143
- const keyDownActions = {
144
- [A_KEY]: this._onAKey,
145
- [TAB_KEY]: this._onTabKey,
146
- [ENTER_KEY]: this._onEnterKey,
147
- [ESC_KEY]: this._onEscapeKey,
148
- [UP_KEY]: this._onDirectionKey,
149
- [PAGE_UP_KEY]: this._onDirectionKey,
150
- [DOWN_KEY]: this._onDirectionKey,
151
- [PAGE_DOWN_KEY]: this._onDirectionKey,
152
- [DELETE_KEY]: this._onDeleteKey,
153
- [BACK_KEY]: this._onDeleteKey,
154
- };
155
- // If keycode has a function, run it
156
- if (keyDownActions[keyCode]) {
157
- keyDownActions[keyCode]({
158
- event,
159
- target,
160
- keyCode,
161
- metaKey,
162
- activeItems,
163
- hasFocusedInput,
164
- hasActiveDropdown,
165
- hasItems,
166
- hasCtrlDownKeyPressed,
167
- });
168
- }
76
+ const keyCode = event.keyCode;
77
+ return this._isSelectOneElement && keyCode === ExtendedKeyCodeMap.TAB_KEY
78
+ ? this._onTabKey()
79
+ : super._onKeyDown(event);
169
80
  }
170
- onSelectValue({ event, activeItems, hasActiveDropdown }) {
81
+ onSelectValue(event, hasActiveDropdown) {
171
82
  if (hasActiveDropdown) {
172
- this._selectHighlightedChoice(activeItems);
83
+ this._selectHighlightedChoice();
173
84
  }
174
85
  else if (this._isSelectOneElement) {
175
86
  this.showDropdown();
@@ -177,11 +88,13 @@ class ChoicesWrapper extends Choices {
177
88
  }
178
89
  }
179
90
  showDropdown(...args) {
180
- if (!this.shouldOpenDropDown) {
181
- this.shouldOpenDropDown = true;
182
- return;
183
- }
184
- super.showDropdown(...args);
91
+ setTimeout(() => {
92
+ if (!this.shouldOpenDropDown) {
93
+ this.shouldOpenDropDown = true;
94
+ return;
95
+ }
96
+ super.showDropdown(...args);
97
+ }, 0);
185
98
  }
186
99
  hideDropdown(...args) {
187
100
  if (this.isDirectionUsing) {
@@ -189,11 +102,5 @@ class ChoicesWrapper extends Choices {
189
102
  }
190
103
  super.hideDropdown(...args);
191
104
  }
192
- _onBlur(...args) {
193
- if (this._isScrollingOnIe) {
194
- return;
195
- }
196
- super._onBlur(...args);
197
- }
198
105
  }
199
106
  export default ChoicesWrapper;
@@ -208,9 +208,10 @@ export function loadZones(url: string, timezone: string): Promise<any> | any;
208
208
  * @param {string|Date} value - The value to convert into a moment date.
209
209
  * @param {string} format - The format to convert the date to.
210
210
  * @param {string} timezone - The timezone to convert the date to.
211
+ * @param {object} options - The options object
211
212
  * @returns {Date} - The moment date object.
212
213
  */
213
- export function momentDate(value: string | Date, format: string, timezone: string): Date;
214
+ export function momentDate(value: string | Date, format: string, timezone: string, options: object): Date;
214
215
  /**
215
216
  * Format a date provided a value, format, and timezone object.
216
217
  * @param {string} timezonesUrl - The URL to load the timezone data from.
@@ -632,9 +632,10 @@ export function loadZones(url, timezone) {
632
632
  * @param {string|Date} value - The value to convert into a moment date.
633
633
  * @param {string} format - The format to convert the date to.
634
634
  * @param {string} timezone - The timezone to convert the date to.
635
+ * @param {object} options - The options object
635
636
  * @returns {Date} - The moment date object.
636
637
  */
637
- export function momentDate(value, format, timezone) {
638
+ export function momentDate(value, format, timezone, options) {
638
639
  const momentDate = moment(value);
639
640
  if (!timezone) {
640
641
  return momentDate;
@@ -642,7 +643,7 @@ export function momentDate(value, format, timezone) {
642
643
  if (timezone === 'UTC') {
643
644
  timezone = 'Etc/UTC';
644
645
  }
645
- if ((timezone !== currentTimezone() || (format && format.match(/\s(z$|z\s)/))) && moment.zonesLoaded) {
646
+ if ((timezone !== currentTimezone() || (format && format.match(/\s(z$|z\s)/))) && (moment.zonesLoaded || options?.email)) {
646
647
  return momentDate.tz(timezone);
647
648
  }
648
649
  return momentDate;
@@ -87,8 +87,6 @@ export default class CalendarWidget extends InputWidget {
87
87
  this.settings.disableWeekends ? this.settings.disable.push(this.disableWeekends) : '';
88
88
  this.settings.disableWeekdays ? this.settings.disable.push(this.disableWeekdays) : '';
89
89
  this.settings.disableFunction ? this.settings.disable.push(this.disableFunction) : '';
90
- this.settings.wasDefaultValueChanged = false;
91
- this.settings.defaultValue = '';
92
90
  this.settings.manualInputValue = '';
93
91
  this.settings.isManuallyOverriddenValue = false;
94
92
  this.settings.currentValue = '';
@@ -109,10 +107,6 @@ export default class CalendarWidget extends InputWidget {
109
107
  this.calendar._input.value = this.settings.isManuallyOverriddenValue ? this.settings.manualInputValue : this.calendar.altInput.value;
110
108
  this.emit('update');
111
109
  }
112
- if (this.settings.wasDefaultValueChanged) {
113
- this.calendar._input.value = this.settings.defaultValue;
114
- this.settings.wasDefaultValueChanged = false;
115
- }
116
110
  if (this.calendar) {
117
111
  this.emit('blur');
118
112
  }
@@ -351,14 +345,6 @@ export default class CalendarWidget extends InputWidget {
351
345
  this.settings.currentValue = event.target.value;
352
346
  this.emit('update');
353
347
  }
354
- if (event.target.value === '' && this.calendar.selectedDates.length > 0) {
355
- this.settings.wasDefaultValueChanged = true;
356
- this.settings.defaultValue = event.target.value;
357
- this.calendar.clear();
358
- }
359
- else {
360
- this.settings.wasDefaultValueChanged = false;
361
- }
362
348
  });
363
349
  if (this.calendar.daysContainer) {
364
350
  this.calendar.daysContainer.addEventListener('click', () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.1.0-dev.5974.1be1688",
3
+ "version": "5.1.0-dev.5976.f61da27",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {
@@ -81,8 +81,7 @@
81
81
  "homepage": "https://github.com/formio/formio.js#readme",
82
82
  "dependencies": {
83
83
  "@formio/bootstrap": "v3.0.0-dev.121.085d187",
84
- "@formio/choices.js": "^10.2.1",
85
- "@formio/core": "v2.4.0-dev.210.e634ab4",
84
+ "@formio/core": "v2.4.0-dev.2",
86
85
  "@formio/text-mask-addons": "3.8.0-formio.4",
87
86
  "@formio/vanilla-text-mask": "^5.1.1-formio.1",
88
87
  "abortcontroller-polyfill": "^1.7.5",
@@ -90,6 +89,7 @@
90
89
  "bootstrap": "^5.3.3",
91
90
  "browser-cookies": "^1.2.0",
92
91
  "browser-md5-file": "^1.1.1",
92
+ "choices.js": "^11.0.6",
93
93
  "compare-versions": "^6.1.1",
94
94
  "core-js": "^3.37.1",
95
95
  "dialog-polyfill": "^0.5.6",