@formio/js 5.0.0-rc.22 → 5.0.0-rc.24

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 (80) hide show
  1. package/README.md +24 -30
  2. package/dist/formio.builder.css +2 -0
  3. package/dist/formio.builder.min.css +1 -1
  4. package/dist/formio.embed.js +1 -1
  5. package/dist/formio.embed.min.js +1 -1
  6. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  7. package/dist/formio.form.css +2 -0
  8. package/dist/formio.form.js +14 -25
  9. package/dist/formio.form.min.css +1 -1
  10. package/dist/formio.form.min.js +1 -1
  11. package/dist/formio.form.min.js.LICENSE.txt +1 -1
  12. package/dist/formio.full.css +2 -0
  13. package/dist/formio.full.js +15 -26
  14. package/dist/formio.full.min.css +1 -1
  15. package/dist/formio.full.min.js +1 -1
  16. package/dist/formio.full.min.js.LICENSE.txt +1 -1
  17. package/dist/formio.js +1 -1
  18. package/dist/formio.min.js +1 -1
  19. package/dist/formio.min.js.LICENSE.txt +1 -1
  20. package/dist/formio.utils.js +1 -1
  21. package/dist/formio.utils.min.js.LICENSE.txt +1 -1
  22. package/lib/cjs/Embed.d.ts +4 -2
  23. package/lib/cjs/Embed.js +55 -42
  24. package/lib/cjs/WebformBuilder.js +1 -1
  25. package/lib/cjs/components/_classes/component/Component.js +3 -3
  26. package/lib/cjs/components/_classes/field/Field.d.ts +1 -0
  27. package/lib/cjs/components/_classes/field/Field.js +14 -0
  28. package/lib/cjs/components/_classes/list/ListComponent.d.ts +2 -2
  29. package/lib/cjs/components/_classes/list/ListComponent.js +6 -3
  30. package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +0 -1
  31. package/lib/cjs/components/_classes/multivalue/Multivalue.js +0 -14
  32. package/lib/cjs/components/day/Day.d.ts +0 -1
  33. package/lib/cjs/components/day/Day.js +34 -14
  34. package/lib/cjs/components/day/fixtures/comp6.d.ts +81 -0
  35. package/lib/cjs/components/day/fixtures/comp6.js +76 -0
  36. package/lib/cjs/components/day/fixtures/index.d.ts +2 -1
  37. package/lib/cjs/components/day/fixtures/index.js +3 -1
  38. package/lib/cjs/components/radio/Radio.js +22 -12
  39. package/lib/cjs/components/select/Select.d.ts +2 -0
  40. package/lib/cjs/components/select/Select.js +6 -1
  41. package/lib/cjs/components/selectboxes/SelectBoxes.js +9 -0
  42. package/lib/cjs/components/selectboxes/fixtures/comp7.d.ts +18 -0
  43. package/lib/cjs/components/selectboxes/fixtures/comp7.js +31 -0
  44. package/lib/cjs/components/selectboxes/fixtures/index.d.ts +2 -1
  45. package/lib/cjs/components/selectboxes/fixtures/index.js +3 -1
  46. package/lib/cjs/components/signature/Signature.d.ts +1 -2
  47. package/lib/cjs/components/signature/Signature.js +1 -2
  48. package/lib/cjs/utils/ChoicesWrapper.d.ts +1 -0
  49. package/lib/cjs/utils/ChoicesWrapper.js +19 -0
  50. package/lib/cjs/utils/utils.js +3 -3
  51. package/lib/mjs/Embed.d.ts +4 -2
  52. package/lib/mjs/Embed.js +54 -43
  53. package/lib/mjs/WebformBuilder.js +1 -1
  54. package/lib/mjs/components/_classes/component/Component.js +3 -3
  55. package/lib/mjs/components/_classes/field/Field.d.ts +1 -0
  56. package/lib/mjs/components/_classes/field/Field.js +13 -0
  57. package/lib/mjs/components/_classes/list/ListComponent.d.ts +2 -2
  58. package/lib/mjs/components/_classes/list/ListComponent.js +6 -3
  59. package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +0 -1
  60. package/lib/mjs/components/_classes/multivalue/Multivalue.js +0 -13
  61. package/lib/mjs/components/day/Day.d.ts +0 -1
  62. package/lib/mjs/components/day/Day.js +33 -14
  63. package/lib/mjs/components/day/fixtures/comp6.d.ts +81 -0
  64. package/lib/mjs/components/day/fixtures/comp6.js +74 -0
  65. package/lib/mjs/components/day/fixtures/index.d.ts +2 -1
  66. package/lib/mjs/components/day/fixtures/index.js +2 -1
  67. package/lib/mjs/components/radio/Radio.js +22 -12
  68. package/lib/mjs/components/select/Select.d.ts +2 -0
  69. package/lib/mjs/components/select/Select.js +6 -1
  70. package/lib/mjs/components/selectboxes/SelectBoxes.js +10 -1
  71. package/lib/mjs/components/selectboxes/fixtures/comp7.d.ts +18 -0
  72. package/lib/mjs/components/selectboxes/fixtures/comp7.js +29 -0
  73. package/lib/mjs/components/selectboxes/fixtures/index.d.ts +2 -1
  74. package/lib/mjs/components/selectboxes/fixtures/index.js +2 -1
  75. package/lib/mjs/components/signature/Signature.d.ts +1 -2
  76. package/lib/mjs/components/signature/Signature.js +1 -2
  77. package/lib/mjs/utils/ChoicesWrapper.d.ts +1 -0
  78. package/lib/mjs/utils/ChoicesWrapper.js +19 -0
  79. package/lib/mjs/utils/utils.js +3 -3
  80. package/package.json +3 -4
@@ -1,5 +1,5 @@
1
1
  import _ from 'lodash';
2
- import { componentValueTypes, getComponentSavedTypes } from '../../utils/utils';
2
+ import { componentValueTypes, getComponentSavedTypes, boolValue } from '../../utils/utils';
3
3
  import RadioComponent from '../radio/Radio';
4
4
  export default class SelectBoxesComponent extends RadioComponent {
5
5
  static schema(...extend) {
@@ -243,4 +243,13 @@ export default class SelectBoxesComponent extends RadioComponent {
243
243
  }
244
244
  return super.checkComponentValidity(data, dirty, rowData, options);
245
245
  }
246
+ validateValueAvailability(setting, value) {
247
+ if (!boolValue(setting) || !value) {
248
+ return true;
249
+ }
250
+ const values = this.component.values;
251
+ const availableValueKeys = (values || []).map(({ value: optionValue }) => optionValue);
252
+ const valueKeys = Object.keys(value);
253
+ return valueKeys.every((key) => availableValueKeys.includes(key));
254
+ }
246
255
  }
@@ -0,0 +1,18 @@
1
+ declare namespace _default {
2
+ const label: string;
3
+ const optionsLabelPosition: string;
4
+ const tableView: boolean;
5
+ const values: {
6
+ label: string;
7
+ value: string;
8
+ shortcut: string;
9
+ }[];
10
+ namespace validate {
11
+ const onlyAvailableItems: boolean;
12
+ }
13
+ const key: string;
14
+ const type: string;
15
+ const input: boolean;
16
+ const inputType: string;
17
+ }
18
+ export default _default;
@@ -0,0 +1,29 @@
1
+ export default {
2
+ label: 'Select Boxes',
3
+ optionsLabelPosition: 'right',
4
+ tableView: false,
5
+ values: [
6
+ {
7
+ label: 'a',
8
+ value: 'a',
9
+ shortcut: '',
10
+ },
11
+ {
12
+ label: 'b',
13
+ value: 'b',
14
+ shortcut: '',
15
+ },
16
+ {
17
+ label: 'c',
18
+ value: 'c',
19
+ shortcut: '',
20
+ },
21
+ ],
22
+ validate: {
23
+ onlyAvailableItems: true,
24
+ },
25
+ key: 'selectBoxes',
26
+ type: 'selectboxes',
27
+ input: true,
28
+ inputType: 'checkbox',
29
+ };
@@ -4,4 +4,5 @@ import comp3 from './comp3';
4
4
  import comp4 from './comp4';
5
5
  import comp5 from './comp5';
6
6
  import comp6 from './comp6';
7
- export { comp1, comp2, comp3, comp4, comp5, comp6 };
7
+ import comp7 from './comp7';
8
+ export { comp1, comp2, comp3, comp4, comp5, comp6, comp7 };
@@ -4,4 +4,5 @@ import comp3 from './comp3';
4
4
  import comp4 from './comp4';
5
5
  import comp5 from './comp5';
6
6
  import comp6 from './comp6';
7
- export { comp1, comp2, comp3, comp4, comp5, comp6 };
7
+ import comp7 from './comp7';
8
+ export { comp1, comp2, comp3, comp4, comp5, comp6, comp7 };
@@ -37,11 +37,10 @@ export default class SignatureComponent extends Input {
37
37
  onDisabled(): void;
38
38
  checkSize(force: any, scale: any): void;
39
39
  signaturePad: SignaturePad | null | undefined;
40
- observer: _ResizeObserver | null | undefined;
40
+ observer: any;
41
41
  getValueAsString(value: any): "" | "Yes" | "No";
42
42
  focus(): void;
43
43
  setDataToSigaturePad(): void;
44
44
  }
45
45
  import Input from '../_classes/input/Input';
46
46
  import SignaturePad from 'signature_pad';
47
- import _ResizeObserver from 'resize-observer-polyfill';
@@ -1,5 +1,4 @@
1
1
  import SignaturePad from 'signature_pad';
2
- import _ResizeObserver from 'resize-observer-polyfill';
3
2
  import Input from '../_classes/input/Input';
4
3
  import _ from 'lodash';
5
4
  import { componentValueTypes, getComponentSavedTypes } from '../../utils/utils';
@@ -199,7 +198,7 @@ export default class SignatureComponent extends Input {
199
198
  this.refs.padBody.style.maxWidth = '100%';
200
199
  }
201
200
  if (!this.builderMode && !this.options.preview) {
202
- this.observer = new _ResizeObserver(() => {
201
+ this.observer = new ResizeObserver(() => {
203
202
  this.checkSize();
204
203
  });
205
204
  this.observer.observe(this.refs.padBody);
@@ -19,6 +19,7 @@ declare class ChoicesWrapper extends Choices {
19
19
  }): void;
20
20
  isDirectionUsing: boolean;
21
21
  shouldOpenDropDown: boolean;
22
+ _onTouchEnd(event: any): void;
22
23
  _handleButtonAction(activeItems: any, element: any): void;
23
24
  _onEnterKey(args: any): void;
24
25
  _onDirectionKey(...args: any[]): void;
@@ -44,6 +44,25 @@ class ChoicesWrapper extends Choices {
44
44
  this.isDirectionUsing = false;
45
45
  this.shouldOpenDropDown = true;
46
46
  }
47
+ _onTouchEnd(event) {
48
+ var target = (event || event.touches[0]).target;
49
+ var touchWasWithinContainer = this._wasTap && this.containerOuter.element.contains(target);
50
+ if (touchWasWithinContainer) {
51
+ var containerWasExactTarget = target === this.containerOuter.element || target === this.containerInner.element;
52
+ if (containerWasExactTarget) {
53
+ if (this._isTextElement) {
54
+ this.input.focus();
55
+ }
56
+ else if (this._isSelectMultipleElement) {
57
+ this.input.focus();
58
+ this.showDropdown();
59
+ }
60
+ }
61
+ // Prevents focus event firing
62
+ event.stopPropagation();
63
+ }
64
+ this._wasTap = true;
65
+ }
47
66
  _handleButtonAction(activeItems, element) {
48
67
  if (!this._isSelectOneElement) {
49
68
  return super._handleButtonAction(activeItems, element);
@@ -214,9 +214,9 @@ export function checkSimpleConditional(component, condition, row, data, instance
214
214
  return true;
215
215
  }
216
216
  const value = getComponentActualValue(conditionComponentPath, data, row);
217
- const СonditionOperator = ConditionOperators[operator];
218
- return СonditionOperator
219
- ? new СonditionOperator().getResult({ value, comparedValue, instance, component, conditionComponentPath })
217
+ const ConditionOperator = ConditionOperators[operator];
218
+ return ConditionOperator
219
+ ? new ConditionOperator().getResult({ value, comparedValue, instance, component, conditionComponentPath })
220
220
  : true;
221
221
  });
222
222
  let result = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-rc.22",
3
+ "version": "5.0.0-rc.24",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -51,7 +51,7 @@
51
51
  "invalidate": "VERSION=$(yarn version);aws cloudfront create-invalidation --distribution-id E1MXNA5A4ZKRMZ --paths \"/$VERSION/*\"",
52
52
  "release": "yarn build-app && yarn deploy-s3",
53
53
  "tag": "VERSION=$(yarn version);git add -A; git commit -m \"Build $Version\";git push origin master;git tag v$VERSION;git push origin --tags;",
54
- "dopublish": "npm test;gulp build;yarn tag;npm publish lib --tag=rc;",
54
+ "dopublish": "npm run build && npm run tag && npm publish",
55
55
  "lint": "gulp eslint",
56
56
  "serve": "jekyll serve --config _config.yml,_config.dev.yml",
57
57
  "test": "mocha 'src/**/*.unit.js'",
@@ -106,7 +106,6 @@
106
106
  "moment": "^2.29.4",
107
107
  "moment-timezone": "^0.5.43",
108
108
  "quill": "^2.0.0-dev.3",
109
- "resize-observer-polyfill": "^1.5.1",
110
109
  "signature_pad": "^4.1.4",
111
110
  "string-hash": "^1.1.3",
112
111
  "tippy.js": "^6.3.7",
@@ -116,7 +115,7 @@
116
115
  "devDependencies": {
117
116
  "@typescript-eslint/eslint-plugin": "^5.60.1",
118
117
  "@typescript-eslint/parser": "^5.60.1",
119
- "ace-builds": "^1.4.12",
118
+ "ace-builds": "1.23.4",
120
119
  "async-limiter": "^2.0.0",
121
120
  "bootstrap-icons": "^1.10.5",
122
121
  "bootswatch": "^5.3.0",