@formio/js 5.0.0-dev.5656.925a8ee → 5.0.0-dev.5661.22d0f16

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 (47) hide show
  1. package/dist/formio.form.js +6 -6
  2. package/dist/formio.form.min.js +1 -1
  3. package/dist/formio.full.js +6 -6
  4. package/dist/formio.full.min.js +1 -1
  5. package/lib/cjs/components/_classes/component/Component.js +1 -1
  6. package/lib/cjs/components/_classes/component/fixtures/comp6.d.ts +77 -0
  7. package/lib/cjs/components/_classes/component/fixtures/comp6.js +59 -0
  8. package/lib/cjs/components/_classes/component/fixtures/index.d.ts +2 -1
  9. package/lib/cjs/components/_classes/component/fixtures/index.js +3 -1
  10. package/lib/cjs/components/_classes/input/Input.js +6 -4
  11. package/lib/cjs/components/datagrid/fixtures/comp-with-checkboxes.d.ts +29 -0
  12. package/lib/cjs/components/datagrid/fixtures/comp-with-checkboxes.js +36 -0
  13. package/lib/cjs/components/datagrid/fixtures/index.d.ts +2 -1
  14. package/lib/cjs/components/datagrid/fixtures/index.js +3 -1
  15. package/lib/cjs/components/radio/Radio.js +3 -2
  16. package/lib/cjs/components/select/Select.d.ts +0 -38
  17. package/lib/cjs/components/select/Select.js +0 -10
  18. package/lib/cjs/components/select/fixtures/index.d.ts +1 -2
  19. package/lib/cjs/components/select/fixtures/index.js +1 -3
  20. package/lib/cjs/translations/en.d.ts +2 -0
  21. package/lib/cjs/translations/en.js +3 -1
  22. package/lib/cjs/utils/ChoicesWrapper.d.ts +1 -1
  23. package/lib/cjs/utils/ChoicesWrapper.js +13 -2
  24. package/lib/mjs/components/_classes/component/Component.js +1 -1
  25. package/lib/mjs/components/_classes/component/fixtures/comp6.d.ts +77 -0
  26. package/lib/mjs/components/_classes/component/fixtures/comp6.js +57 -0
  27. package/lib/mjs/components/_classes/component/fixtures/index.d.ts +2 -1
  28. package/lib/mjs/components/_classes/component/fixtures/index.js +2 -1
  29. package/lib/mjs/components/_classes/input/Input.js +6 -4
  30. package/lib/mjs/components/datagrid/fixtures/comp-with-checkboxes.d.ts +29 -0
  31. package/lib/mjs/components/datagrid/fixtures/comp-with-checkboxes.js +34 -0
  32. package/lib/mjs/components/datagrid/fixtures/index.d.ts +2 -1
  33. package/lib/mjs/components/datagrid/fixtures/index.js +2 -1
  34. package/lib/mjs/components/radio/Radio.js +3 -2
  35. package/lib/mjs/components/select/Select.d.ts +0 -38
  36. package/lib/mjs/components/select/Select.js +1 -13
  37. package/lib/mjs/components/select/fixtures/index.d.ts +1 -2
  38. package/lib/mjs/components/select/fixtures/index.js +1 -2
  39. package/lib/mjs/translations/en.d.ts +2 -0
  40. package/lib/mjs/translations/en.js +3 -1
  41. package/lib/mjs/utils/ChoicesWrapper.d.ts +1 -1
  42. package/lib/mjs/utils/ChoicesWrapper.js +13 -2
  43. package/package.json +1 -1
  44. package/lib/cjs/components/select/fixtures/comp25.d.ts +0 -44
  45. package/lib/cjs/components/select/fixtures/comp25.js +0 -59
  46. package/lib/mjs/components/select/fixtures/comp25.d.ts +0 -44
  47. package/lib/mjs/components/select/fixtures/comp25.js +0 -57
@@ -0,0 +1,29 @@
1
+ declare namespace _default {
2
+ let label: string;
3
+ let reorder: boolean;
4
+ let addAnotherPosition: string;
5
+ let layoutFixed: boolean;
6
+ let enableRowGroups: boolean;
7
+ let initEmpty: boolean;
8
+ let tableView: boolean;
9
+ let defaultValue: {}[];
10
+ let key: string;
11
+ let type: string;
12
+ let input: boolean;
13
+ let components: {
14
+ label: string;
15
+ optionsLabelPosition: string;
16
+ inline: boolean;
17
+ tableView: boolean;
18
+ values: {
19
+ label: string;
20
+ value: string;
21
+ shortcut: string;
22
+ }[];
23
+ key: string;
24
+ type: string;
25
+ input: boolean;
26
+ inputType: string;
27
+ }[];
28
+ }
29
+ export default _default;
@@ -0,0 +1,34 @@
1
+ export default {
2
+ 'label': 'Data Grid',
3
+ 'reorder': false,
4
+ 'addAnotherPosition': 'bottom',
5
+ 'layoutFixed': false,
6
+ 'enableRowGroups': false,
7
+ 'initEmpty': false,
8
+ 'tableView': false,
9
+ 'defaultValue': [
10
+ {}
11
+ ],
12
+ 'key': 'dataGrid',
13
+ 'type': 'datagrid',
14
+ 'input': true,
15
+ 'components': [
16
+ {
17
+ 'label': 'Radio',
18
+ 'optionsLabelPosition': 'right',
19
+ 'inline': false,
20
+ 'tableView': false,
21
+ 'values': [
22
+ {
23
+ 'label': 'yes',
24
+ 'value': 'yes',
25
+ 'shortcut': ''
26
+ }
27
+ ],
28
+ 'key': 'radio',
29
+ 'type': 'radio',
30
+ 'input': true,
31
+ 'inputType': 'checkbox'
32
+ }
33
+ ]
34
+ };
@@ -14,4 +14,5 @@ import withRowGroupsAndDefValue from './comp-row-groups-with-def-value';
14
14
  import modalWithRequiredFields from './comp-modal-with-required-fields';
15
15
  import withAllowCalculateOverride from './comp-with-allow-calculate-override';
16
16
  import twoWithAllowCalculatedOverride from './two-comp-with-allow-calculate-override';
17
- export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, withCollapsibleRowGroups, withConditionalFieldsAndValidations, withDefValue, withLogic, withRowGroupsAndDefValue, modalWithRequiredFields, withAllowCalculateOverride, twoWithAllowCalculatedOverride };
17
+ import withCheckboxes from './comp-with-checkboxes';
18
+ export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, withCollapsibleRowGroups, withConditionalFieldsAndValidations, withDefValue, withLogic, withRowGroupsAndDefValue, modalWithRequiredFields, withAllowCalculateOverride, twoWithAllowCalculatedOverride, withCheckboxes };
@@ -14,4 +14,5 @@ import withLogic from './comp-with-logic';
14
14
  import withCollapsibleRowGroups from './comp-with-collapsible-groups';
15
15
  import withAllowCalculateOverride from './comp-with-allow-calculate-override';
16
16
  import twoWithAllowCalculatedOverride from './two-comp-with-allow-calculate-override';
17
- export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, withCollapsibleRowGroups, withConditionalFieldsAndValidations, withDefValue, withLogic, withRowGroupsAndDefValue, modalWithRequiredFields, withAllowCalculateOverride, twoWithAllowCalculatedOverride };
17
+ import withCheckboxes from './comp-with-checkboxes';
18
+ export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, comp8, withCollapsibleRowGroups, withConditionalFieldsAndValidations, withDefValue, withLogic, withRowGroupsAndDefValue, modalWithRequiredFields, withAllowCalculateOverride, twoWithAllowCalculatedOverride, withCheckboxes };
@@ -200,7 +200,8 @@ export default class RadioComponent extends ListComponent {
200
200
  if (this.viewOnly || !this.refs.input || !this.refs.input.length) {
201
201
  return this.dataValue;
202
202
  }
203
- let value = this.dataValue;
203
+ // If the input type of the component is checkbox the value should be determined by the checkboxes checked property
204
+ let value = this.component.inputType === 'checkbox' ? '' : this.dataValue;
204
205
  this.refs.input.forEach((input, index) => {
205
206
  if (input.checked) {
206
207
  value = (this.isSelectURL && _.isObject(this.loadedOptions[index].value)) ?
@@ -322,7 +323,7 @@ export default class RadioComponent extends ListComponent {
322
323
  const value = this.dataValue;
323
324
  this.refs.wrapper.forEach((wrapper, index) => {
324
325
  const input = this.refs.input[index];
325
- const checked = (input.type === 'checkbox') ? value[input.value] : (input.value.toString() === value.toString());
326
+ const checked = (input.type === 'checkbox') ? value[input.value] || input.checked : (input.value.toString() === value.toString());
326
327
  if (checked) {
327
328
  //add class to container when selected
328
329
  this.addClass(wrapper, this.optionSelectedClass);
@@ -9,47 +9,9 @@ export default class SelectComponent extends ListComponent {
9
9
  };
10
10
  static get serverConditionSettings(): {
11
11
  valueComponent(classComp: any): any;
12
- dataTypeOperators: {
13
- number: string[];
14
- };
15
- dataTypeValueComponents: {
16
- number: {
17
- lessThan: () => {
18
- type: string;
19
- };
20
- greaterThan: () => {
21
- type: string;
22
- };
23
- lessThanOrEqual: () => {
24
- type: string;
25
- };
26
- greaterThanOrEqual: () => {
27
- type: string;
28
- };
29
- };
30
- };
31
12
  };
32
13
  static get conditionOperatorsSettings(): {
33
14
  valueComponent(classComp: any): any;
34
- dataTypeOperators: {
35
- number: string[];
36
- };
37
- dataTypeValueComponents: {
38
- number: {
39
- lessThan: () => {
40
- type: string;
41
- };
42
- greaterThan: () => {
43
- type: string;
44
- };
45
- lessThanOrEqual: () => {
46
- type: string;
47
- };
48
- greaterThanOrEqual: () => {
49
- type: string;
50
- };
51
- };
52
- };
53
15
  };
54
16
  static savedValueTypes(schema: any): any[];
55
17
  templateData: {} | undefined;
@@ -58,7 +58,6 @@ export default class SelectComponent extends ListComponent {
58
58
  return SelectComponent.conditionOperatorsSettings;
59
59
  }
60
60
  static get conditionOperatorsSettings() {
61
- const numberType = () => ({ type: 'number' });
62
61
  return {
63
62
  ...super.conditionOperatorsSettings,
64
63
  valueComponent(classComp) {
@@ -75,18 +74,7 @@ export default class SelectComponent extends ListComponent {
75
74
  `;
76
75
  }
77
76
  return valueComp;
78
- },
79
- dataTypeOperators: {
80
- number: ['lessThan', 'greaterThan', 'lessThanOrEqual', 'greaterThanOrEqual'],
81
- },
82
- dataTypeValueComponents: {
83
- number: {
84
- lessThan: numberType,
85
- greaterThan: numberType,
86
- lessThanOrEqual: numberType,
87
- greaterThanOrEqual: numberType,
88
- },
89
- },
77
+ }
90
78
  };
91
79
  }
92
80
  static savedValueTypes(schema) {
@@ -21,6 +21,5 @@ import comp21 from './comp21';
21
21
  import comp22 from './comp22';
22
22
  import comp23 from './comp23';
23
23
  import comp24 from './comp24';
24
- import comp25 from './comp25';
25
- export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, comp20, comp21, comp22, comp23, comp24, comp25 };
24
+ export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, comp20, comp21, comp22, comp23, comp24 };
26
25
  export { multiSelect, multiSelectOptions } from "./comp3";
@@ -22,5 +22,4 @@ import comp21 from './comp21';
22
22
  import comp22 from './comp22';
23
23
  import comp23 from './comp23';
24
24
  import comp24 from './comp24';
25
- import comp25 from './comp25';
26
- export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, comp20, comp21, comp22, comp23, comp24, comp25 };
25
+ export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19, comp20, comp21, comp22, comp23, comp24 };
@@ -72,5 +72,7 @@ declare namespace _default {
72
72
  let reCaptchaTokenValidationError: string;
73
73
  let reCaptchaTokenNotSpecifiedError: string;
74
74
  let apiKey: string;
75
+ let typeRemaining: string;
76
+ let typeCount: string;
75
77
  }
76
78
  export default _default;
@@ -71,5 +71,7 @@ export default {
71
71
  submitButtonAriaLabel: 'Submit Form button. Click to submit the form',
72
72
  reCaptchaTokenValidationError: 'ReCAPTCHA: Token validation error',
73
73
  reCaptchaTokenNotSpecifiedError: 'ReCAPTCHA: Token is not specified in submission',
74
- apiKey: 'API Key is not unique: {{key}}'
74
+ apiKey: 'API Key is not unique: {{key}}',
75
+ typeRemaining: '{{ remaining }} {{ type }} remaining.',
76
+ typeCount: '{{ count }} {{ type }}'
75
77
  };
@@ -24,7 +24,7 @@ declare class ChoicesWrapper extends Choices {
24
24
  _onEnterKey(args: any): void;
25
25
  _onDirectionKey(...args: any[]): void;
26
26
  timeout: NodeJS.Timeout | undefined;
27
- _selectHighlightedChoice(activeItems: any): void;
27
+ _selectHighlightedChoice(): void;
28
28
  _onKeyDown(event: any): void;
29
29
  onSelectValue({ event, activeItems, hasActiveDropdown }: {
30
30
  event: any;
@@ -99,10 +99,21 @@ class ChoicesWrapper extends Choices {
99
99
  this._selectHighlightedChoice(activeItems);
100
100
  }
101
101
  }
102
- _selectHighlightedChoice(activeItems) {
102
+ _selectHighlightedChoice() {
103
103
  const highlightedChoice = this.dropdown.getChild(`.${this.config.classNames.highlightedState}`);
104
104
  if (highlightedChoice) {
105
- this._handleChoiceAction(activeItems, highlightedChoice);
105
+ const id = highlightedChoice.dataset.id;
106
+ const choice = id && this._store.getChoiceById(id);
107
+ this._addItem({
108
+ value: choice.value,
109
+ label: choice.label,
110
+ choiceId: choice.id,
111
+ groupId: choice.groupId,
112
+ customProperties: choice.customProperties,
113
+ placeholder: choice.placeholder,
114
+ keyCode: choice.keyCode
115
+ });
116
+ this._triggerChange(choice.value);
106
117
  }
107
118
  event.preventDefault();
108
119
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-dev.5656.925a8ee",
3
+ "version": "5.0.0-dev.5661.22d0f16",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {
@@ -1,44 +0,0 @@
1
- declare namespace _default {
2
- let title: string;
3
- let name: string;
4
- let path: string;
5
- let type: string;
6
- let display: string;
7
- let components: ({
8
- label: string;
9
- widget: string;
10
- tableView: boolean;
11
- data: {
12
- values: {
13
- label: string;
14
- value: string;
15
- }[];
16
- };
17
- dataType: string;
18
- key: string;
19
- type: string;
20
- input: boolean;
21
- applyMaskOn?: undefined;
22
- conditional?: undefined;
23
- } | {
24
- label: string;
25
- applyMaskOn: string;
26
- tableView: boolean;
27
- key: string;
28
- type: string;
29
- input: boolean;
30
- conditional: {
31
- show: boolean;
32
- conjunction: string;
33
- conditions: {
34
- component: string;
35
- operator: string;
36
- value: number;
37
- }[];
38
- };
39
- widget?: undefined;
40
- data?: undefined;
41
- dataType?: undefined;
42
- })[];
43
- }
44
- export default _default;
@@ -1,59 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = {
4
- title: 'FIO-8072',
5
- name: 'fio8072',
6
- path: 'fio8072',
7
- type: 'form',
8
- display: 'form',
9
- components: [
10
- {
11
- label: 'Select',
12
- widget: 'choicesjs',
13
- tableView: true,
14
- data: {
15
- values: [
16
- {
17
- label: 'A',
18
- value: '1',
19
- },
20
- {
21
- label: 'B',
22
- value: '2',
23
- },
24
- {
25
- label: 'C',
26
- value: '10',
27
- },
28
- {
29
- label: 'D',
30
- value: '1d',
31
- },
32
- ],
33
- },
34
- dataType: 'number',
35
- key: 'select',
36
- type: 'select',
37
- input: true,
38
- },
39
- {
40
- label: 'Text Field',
41
- applyMaskOn: 'change',
42
- tableView: true,
43
- key: 'textField',
44
- type: 'textfield',
45
- input: true,
46
- conditional: {
47
- show: true,
48
- conjunction: 'all',
49
- conditions: [
50
- {
51
- component: 'select',
52
- operator: 'lessThan',
53
- value: 5,
54
- },
55
- ],
56
- },
57
- },
58
- ],
59
- };
@@ -1,44 +0,0 @@
1
- declare namespace _default {
2
- let title: string;
3
- let name: string;
4
- let path: string;
5
- let type: string;
6
- let display: string;
7
- let components: ({
8
- label: string;
9
- widget: string;
10
- tableView: boolean;
11
- data: {
12
- values: {
13
- label: string;
14
- value: string;
15
- }[];
16
- };
17
- dataType: string;
18
- key: string;
19
- type: string;
20
- input: boolean;
21
- applyMaskOn?: undefined;
22
- conditional?: undefined;
23
- } | {
24
- label: string;
25
- applyMaskOn: string;
26
- tableView: boolean;
27
- key: string;
28
- type: string;
29
- input: boolean;
30
- conditional: {
31
- show: boolean;
32
- conjunction: string;
33
- conditions: {
34
- component: string;
35
- operator: string;
36
- value: number;
37
- }[];
38
- };
39
- widget?: undefined;
40
- data?: undefined;
41
- dataType?: undefined;
42
- })[];
43
- }
44
- export default _default;
@@ -1,57 +0,0 @@
1
- export default {
2
- title: 'FIO-8072',
3
- name: 'fio8072',
4
- path: 'fio8072',
5
- type: 'form',
6
- display: 'form',
7
- components: [
8
- {
9
- label: 'Select',
10
- widget: 'choicesjs',
11
- tableView: true,
12
- data: {
13
- values: [
14
- {
15
- label: 'A',
16
- value: '1',
17
- },
18
- {
19
- label: 'B',
20
- value: '2',
21
- },
22
- {
23
- label: 'C',
24
- value: '10',
25
- },
26
- {
27
- label: 'D',
28
- value: '1d',
29
- },
30
- ],
31
- },
32
- dataType: 'number',
33
- key: 'select',
34
- type: 'select',
35
- input: true,
36
- },
37
- {
38
- label: 'Text Field',
39
- applyMaskOn: 'change',
40
- tableView: true,
41
- key: 'textField',
42
- type: 'textfield',
43
- input: true,
44
- conditional: {
45
- show: true,
46
- conjunction: 'all',
47
- conditions: [
48
- {
49
- component: 'select',
50
- operator: 'lessThan',
51
- value: 5,
52
- },
53
- ],
54
- },
55
- },
56
- ],
57
- };