@formio/js 5.0.0-rc.21 → 5.0.0-rc.23

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. package/dist/formio.builder.css +2 -0
  2. package/dist/formio.builder.min.css +1 -1
  3. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  4. package/dist/formio.form.css +2 -0
  5. package/dist/formio.form.js +12 -12
  6. package/dist/formio.form.min.css +1 -1
  7. package/dist/formio.form.min.js +1 -1
  8. package/dist/formio.form.min.js.LICENSE.txt +1 -1
  9. package/dist/formio.full.css +2 -0
  10. package/dist/formio.full.js +12 -12
  11. package/dist/formio.full.min.css +1 -1
  12. package/dist/formio.full.min.js +1 -1
  13. package/dist/formio.full.min.js.LICENSE.txt +1 -1
  14. package/dist/formio.js +1 -1
  15. package/dist/formio.min.js +1 -1
  16. package/dist/formio.min.js.LICENSE.txt +1 -1
  17. package/dist/formio.utils.js +1 -1
  18. package/dist/formio.utils.min.js.LICENSE.txt +1 -1
  19. package/lib/cjs/Element.js +5 -0
  20. package/lib/cjs/components/_classes/component/Component.js +3 -3
  21. package/lib/cjs/components/_classes/field/Field.d.ts +1 -0
  22. package/lib/cjs/components/_classes/field/Field.js +14 -0
  23. package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +0 -1
  24. package/lib/cjs/components/_classes/multivalue/Multivalue.js +0 -14
  25. package/lib/cjs/components/day/Day.d.ts +0 -1
  26. package/lib/cjs/components/day/Day.js +35 -11
  27. package/lib/cjs/components/day/fixtures/comp5.d.ts +29 -0
  28. package/lib/cjs/components/day/fixtures/comp5.js +32 -0
  29. package/lib/cjs/components/day/fixtures/comp6.d.ts +81 -0
  30. package/lib/cjs/components/day/fixtures/comp6.js +76 -0
  31. package/lib/cjs/components/day/fixtures/index.d.ts +3 -1
  32. package/lib/cjs/components/day/fixtures/index.js +5 -1
  33. package/lib/cjs/components/form/Form.js +2 -1
  34. package/lib/cjs/components/select/Select.js +2 -1
  35. package/lib/cjs/components/select/fixtures/comp19.d.ts +23 -0
  36. package/lib/cjs/components/select/fixtures/comp19.js +36 -0
  37. package/lib/cjs/components/select/fixtures/index.d.ts +2 -1
  38. package/lib/cjs/components/select/fixtures/index.js +3 -1
  39. package/lib/cjs/components/tags/Tags.js +2 -0
  40. package/lib/cjs/components/tags/fixtures/comp6.d.ts +17 -0
  41. package/lib/cjs/components/tags/fixtures/comp6.js +20 -0
  42. package/lib/cjs/components/tags/fixtures/index.d.ts +2 -1
  43. package/lib/cjs/components/tags/fixtures/index.js +3 -1
  44. package/lib/cjs/utils/utils.js +3 -3
  45. package/lib/mjs/Element.js +5 -0
  46. package/lib/mjs/components/_classes/component/Component.js +3 -3
  47. package/lib/mjs/components/_classes/field/Field.d.ts +1 -0
  48. package/lib/mjs/components/_classes/field/Field.js +13 -0
  49. package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +0 -1
  50. package/lib/mjs/components/_classes/multivalue/Multivalue.js +0 -13
  51. package/lib/mjs/components/day/Day.d.ts +0 -1
  52. package/lib/mjs/components/day/Day.js +34 -11
  53. package/lib/mjs/components/day/fixtures/comp5.d.ts +29 -0
  54. package/lib/mjs/components/day/fixtures/comp5.js +30 -0
  55. package/lib/mjs/components/day/fixtures/comp6.d.ts +81 -0
  56. package/lib/mjs/components/day/fixtures/comp6.js +74 -0
  57. package/lib/mjs/components/day/fixtures/index.d.ts +3 -1
  58. package/lib/mjs/components/day/fixtures/index.js +3 -1
  59. package/lib/mjs/components/form/Form.js +2 -1
  60. package/lib/mjs/components/select/Select.js +2 -1
  61. package/lib/mjs/components/select/fixtures/comp19.d.ts +23 -0
  62. package/lib/mjs/components/select/fixtures/comp19.js +34 -0
  63. package/lib/mjs/components/select/fixtures/index.d.ts +2 -1
  64. package/lib/mjs/components/select/fixtures/index.js +2 -1
  65. package/lib/mjs/components/tags/Tags.js +2 -0
  66. package/lib/mjs/components/tags/fixtures/comp6.d.ts +17 -0
  67. package/lib/mjs/components/tags/fixtures/comp6.js +18 -0
  68. package/lib/mjs/components/tags/fixtures/index.d.ts +2 -1
  69. package/lib/mjs/components/tags/fixtures/index.js +2 -1
  70. package/lib/mjs/utils/utils.js +3 -3
  71. package/package.json +2 -2
@@ -0,0 +1,74 @@
1
+ export default {
2
+ type: 'form',
3
+ display: 'form',
4
+ components: [
5
+ {
6
+ label: 'Text Field',
7
+ applyMaskOn: 'change',
8
+ tableView: true,
9
+ key: 'textField',
10
+ type: 'textfield',
11
+ input: true,
12
+ },
13
+ {
14
+ label: 'Day',
15
+ hideInputLabels: false,
16
+ inputsLabelPosition: 'top',
17
+ useLocaleSettings: false,
18
+ tableView: false,
19
+ fields: {
20
+ day: {
21
+ hide: true,
22
+ },
23
+ month: {
24
+ hide: false,
25
+ },
26
+ year: {
27
+ hide: false,
28
+ },
29
+ },
30
+ defaultValue: '00/00/0000',
31
+ key: 'day',
32
+ logic: [
33
+ {
34
+ name: 'Disable when Test is empty',
35
+ trigger: {
36
+ type: 'simple',
37
+ simple: {
38
+ show: true,
39
+ conjunction: 'all',
40
+ conditions: [
41
+ {
42
+ component: 'textField',
43
+ operator: 'isEmpty',
44
+ },
45
+ ],
46
+ },
47
+ },
48
+ actions: [
49
+ {
50
+ name: 'Disable',
51
+ type: 'property',
52
+ property: {
53
+ label: 'Disabled',
54
+ value: 'disabled',
55
+ type: 'boolean',
56
+ },
57
+ state: true,
58
+ },
59
+ ],
60
+ },
61
+ ],
62
+ type: 'day',
63
+ input: true,
64
+ },
65
+ {
66
+ type: 'button',
67
+ label: 'Submit',
68
+ key: 'submit',
69
+ disableOnInvalid: true,
70
+ input: true,
71
+ tableView: false,
72
+ },
73
+ ],
74
+ };
@@ -2,4 +2,6 @@ import comp1 from './comp1';
2
2
  import comp2 from './comp2';
3
3
  import comp3 from './comp3';
4
4
  import comp4 from './comp4';
5
- export { comp1, comp2, comp3, comp4 };
5
+ import comp5 from './comp5';
6
+ import comp6 from './comp6';
7
+ export { comp1, comp2, comp3, comp4, comp5, comp6 };
@@ -2,4 +2,6 @@ import comp1 from './comp1';
2
2
  import comp2 from './comp2';
3
3
  import comp3 from './comp3';
4
4
  import comp4 from './comp4';
5
- export { comp1, comp2, comp3, comp4 };
5
+ import comp5 from './comp5';
6
+ import comp6 from './comp6';
7
+ export { comp1, comp2, comp3, comp4, comp5, comp6 };
@@ -385,7 +385,8 @@ export default class FormComponent extends Component {
385
385
  if (this.builderMode || this.isHidden() || (this.isSubFormLazyLoad() && !fromAttach)) {
386
386
  return Promise.resolve();
387
387
  }
388
- if (this.hasLoadedForm && !this.isRevisionChanged) {
388
+ if (this.hasLoadedForm && !this.isRevisionChanged &&
389
+ !(this.options.pdf && this.useOriginalRevision && _.isNull(this.subForm) && !this.subFormLoading)) {
389
390
  // Pass config down to sub forms.
390
391
  if (this.root && this.root.form && this.root.form.config && !this.formObj.config) {
391
392
  this.formObj.config = this.root.form.config;
@@ -1,6 +1,7 @@
1
1
  import _ from 'lodash';
2
2
  import { Formio } from '../../Formio';
3
3
  import ListComponent from '../_classes/list/ListComponent';
4
+ import Input from '../_classes/input/Input';
4
5
  import Form from '../../Form';
5
6
  import { getRandomComponentId, boolValue, isPromise, componentValueTypes, getComponentSavedTypes } from '../../utils/utils';
6
7
  import Choices from '../../utils/ChoicesWrapper';
@@ -837,7 +838,7 @@ export default class SelectComponent extends ListComponent {
837
838
  this.choices.containerOuter.element.setAttribute('tabIndex', '-1');
838
839
  this.addEventListener(this.choices.containerOuter.element, 'focus', () => this.focusableElement.focus());
839
840
  }
840
- this.addFocusBlurEvents(this.focusableElement);
841
+ Input.prototype.addFocusBlurEvents.call(this, this.focusableElement);
841
842
  if (this.itemsFromUrl && !this.component.noRefreshOnScroll) {
842
843
  this.scrollList = this.choices.choiceList.element;
843
844
  this.addEventListener(this.scrollList, 'scroll', () => this.onScroll());
@@ -0,0 +1,23 @@
1
+ declare namespace _default {
2
+ const type: string;
3
+ const display: string;
4
+ const components: {
5
+ label: string;
6
+ widget: string;
7
+ tableView: boolean;
8
+ data: {
9
+ values: {
10
+ label: string;
11
+ value: string;
12
+ }[];
13
+ };
14
+ validateOn: string;
15
+ validate: {
16
+ custom: string;
17
+ };
18
+ key: string;
19
+ type: string;
20
+ input: boolean;
21
+ }[];
22
+ }
23
+ export default _default;
@@ -0,0 +1,34 @@
1
+ export default {
2
+ type: 'form',
3
+ display: 'form',
4
+ components: [
5
+ {
6
+ label: 'Select',
7
+ widget: 'choicesjs',
8
+ tableView: true,
9
+ data: {
10
+ values: [
11
+ {
12
+ label: 'Banana',
13
+ value: 'banana'
14
+ },
15
+ {
16
+ label: 'Apple',
17
+ value: 'apple'
18
+ },
19
+ {
20
+ label: 'Pineapple',
21
+ value: 'pineapple'
22
+ }
23
+ ]
24
+ },
25
+ validateOn: 'blur',
26
+ validate: {
27
+ custom: "valid = data.select == 'apple' ? true : 'You must select an apple';"
28
+ },
29
+ key: 'select',
30
+ type: 'select',
31
+ input: true
32
+ },
33
+ ]
34
+ };
@@ -15,5 +15,6 @@ import comp15 from './comp15';
15
15
  import comp16 from './comp16';
16
16
  import comp17 from './comp17';
17
17
  import comp18 from './comp18';
18
- export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18 };
18
+ import comp19 from './comp19';
19
+ export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19 };
19
20
  export { multiSelect, multiSelectOptions } from "./comp3";
@@ -16,4 +16,5 @@ import comp15 from './comp15';
16
16
  import comp16 from './comp16';
17
17
  import comp17 from './comp17';
18
18
  import comp18 from './comp18';
19
- export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18 };
19
+ import comp19 from './comp19';
20
+ export { comp1, comp2, comp4, comp5, comp6, comp7, comp8, comp9, comp10, comp11, comp12, comp13, comp14, comp15, comp16, comp17, comp18, comp19 };
@@ -82,6 +82,8 @@ export default class TagsComponent extends Input {
82
82
  });
83
83
  this.choices.itemList.element.tabIndex = element.tabIndex;
84
84
  this.addEventListener(this.choices.input.element, 'blur', () => {
85
+ // Emit event to the native Formio input, so the listener attached in the Input.js will be invoked
86
+ element.dispatchEvent(new Event('blur'));
85
87
  const value = this.choices.input.value;
86
88
  const maxTagsNumber = this.component.maxTags;
87
89
  const valuesCount = this.choices.getValue(true).length;
@@ -0,0 +1,17 @@
1
+ declare namespace _default {
2
+ const type: string;
3
+ const display: string;
4
+ const components: {
5
+ label: string;
6
+ tableView: boolean;
7
+ storeas: string;
8
+ validate: {
9
+ custom: string;
10
+ };
11
+ validateOn: string;
12
+ key: string;
13
+ type: string;
14
+ input: boolean;
15
+ }[];
16
+ }
17
+ export default _default;
@@ -0,0 +1,18 @@
1
+ export default {
2
+ type: 'form',
3
+ display: 'form',
4
+ components: [
5
+ {
6
+ label: 'Tags',
7
+ tableView: false,
8
+ storeas: 'array',
9
+ validate: {
10
+ custom: "valid = data && data.tags.length <= 2 ? true : 'You cannot add more than 2 items'"
11
+ },
12
+ validateOn: 'blur',
13
+ key: 'tags',
14
+ type: 'tags',
15
+ input: true
16
+ },
17
+ ]
18
+ };
@@ -3,4 +3,5 @@ import comp2 from './comp2';
3
3
  import comp3 from './comp3';
4
4
  import comp4 from './comp4';
5
5
  import comp5 from './comp5';
6
- export { comp1, comp2, comp3, comp4, comp5 };
6
+ import comp6 from './comp6';
7
+ export { comp1, comp2, comp3, comp4, comp5, comp6 };
@@ -3,4 +3,5 @@ import comp2 from './comp2';
3
3
  import comp3 from './comp3';
4
4
  import comp4 from './comp4';
5
5
  import comp5 from './comp5';
6
- export { comp1, comp2, comp3, comp4, comp5 };
6
+ import comp6 from './comp6';
7
+ export { comp1, comp2, comp3, comp4, comp5, comp6 };
@@ -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.21",
3
+ "version": "5.0.0-rc.23",
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'",