@formio/js 5.1.0-rc.16 → 5.1.0-rc.17

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 (48) hide show
  1. package/dist/formio.embed.js +1 -1
  2. package/dist/formio.embed.min.js +1 -1
  3. package/dist/formio.embed.min.js.LICENSE.txt +1 -1
  4. package/dist/formio.form.js +6 -6
  5. package/dist/formio.form.min.js +1 -1
  6. package/dist/formio.form.min.js.LICENSE.txt +1 -1
  7. package/dist/formio.full.js +6 -6
  8. package/dist/formio.full.min.js +1 -1
  9. package/dist/formio.full.min.js.LICENSE.txt +1 -1
  10. package/dist/formio.js +2 -2
  11. package/dist/formio.min.js +1 -1
  12. package/dist/formio.min.js.LICENSE.txt +1 -1
  13. package/dist/formio.utils.js +1 -1
  14. package/dist/formio.utils.min.js +1 -1
  15. package/dist/formio.utils.min.js.LICENSE.txt +1 -1
  16. package/lib/cjs/Embed.js +1 -1
  17. package/lib/cjs/Formio.js +1 -1
  18. package/lib/cjs/Webform.js +2 -2
  19. package/lib/cjs/components/datetime/DateTime.d.ts +1 -1
  20. package/lib/cjs/components/datetime/DateTime.js +7 -3
  21. package/lib/cjs/components/datetime/fixtures/index.d.ts +6 -5
  22. package/lib/cjs/components/datetime/fixtures/index.js +5 -1
  23. package/lib/cjs/components/datetime/fixtures/requiredFieldLogicComp.d.ts +57 -0
  24. package/lib/cjs/components/datetime/fixtures/requiredFieldLogicComp.js +64 -0
  25. package/lib/cjs/components/textfield/TextField.js +3 -0
  26. package/lib/cjs/components/textfield/fixtures/index.d.ts +2 -1
  27. package/lib/cjs/components/textfield/fixtures/index.js +3 -1
  28. package/lib/cjs/components/textfield/fixtures/requiredFieldLogicComp.d.ts +48 -0
  29. package/lib/cjs/components/textfield/fixtures/requiredFieldLogicComp.js +55 -0
  30. package/lib/cjs/utils/utils.d.ts +2 -1
  31. package/lib/cjs/utils/utils.js +3 -2
  32. package/lib/mjs/Embed.js +1 -1
  33. package/lib/mjs/Formio.js +1 -1
  34. package/lib/mjs/Webform.js +2 -2
  35. package/lib/mjs/components/datetime/DateTime.d.ts +1 -1
  36. package/lib/mjs/components/datetime/DateTime.js +8 -4
  37. package/lib/mjs/components/datetime/fixtures/index.d.ts +6 -5
  38. package/lib/mjs/components/datetime/fixtures/index.js +3 -1
  39. package/lib/mjs/components/datetime/fixtures/requiredFieldLogicComp.d.ts +57 -0
  40. package/lib/mjs/components/datetime/fixtures/requiredFieldLogicComp.js +62 -0
  41. package/lib/mjs/components/textfield/TextField.js +3 -0
  42. package/lib/mjs/components/textfield/fixtures/index.d.ts +2 -1
  43. package/lib/mjs/components/textfield/fixtures/index.js +2 -1
  44. package/lib/mjs/components/textfield/fixtures/requiredFieldLogicComp.d.ts +48 -0
  45. package/lib/mjs/components/textfield/fixtures/requiredFieldLogicComp.js +53 -0
  46. package/lib/mjs/utils/utils.d.ts +2 -1
  47. package/lib/mjs/utils/utils.js +3 -2
  48. package/package.json +1 -1
@@ -0,0 +1,62 @@
1
+ export default {
2
+ components: [
3
+ {
4
+ "label": "dateTime",
5
+ "displayInTimezone": "submission",
6
+ "format": "MM/dd/yyyy:HH:mm:ss",
7
+ "tableView": false,
8
+ "datePicker": {
9
+ "disableWeekends": false,
10
+ "disableWeekdays": false
11
+ },
12
+ "timePicker": {
13
+ "showMeridian": false
14
+ },
15
+ "enableMinDateInput": false,
16
+ "enableMaxDateInput": false,
17
+ "validateWhenHidden": false,
18
+ "key": "dateTime",
19
+ "logic": [
20
+ {
21
+ "name": "requiredLogic",
22
+ "trigger": {
23
+ "type": "javascript",
24
+ "javascript": "result = true;"
25
+ },
26
+ "actions": [
27
+ {
28
+ "name": "setRequired",
29
+ "type": "property",
30
+ "property": {
31
+ "label": "Required",
32
+ "value": "validate.required",
33
+ "type": "boolean"
34
+ },
35
+ "state": true
36
+ }
37
+ ]
38
+ }
39
+ ],
40
+ "type": "datetime",
41
+ "input": true,
42
+ "widget": {
43
+ "type": "calendar",
44
+ "displayInTimezone": "submission",
45
+ "locale": "en",
46
+ "useLocaleSettings": false,
47
+ "allowInput": true,
48
+ "mode": "single",
49
+ "enableTime": true,
50
+ "noCalendar": false,
51
+ "format": "MM/dd/yyyy:HH:mm:ss",
52
+ "hourIncrement": 1,
53
+ "minuteIncrement": 1,
54
+ "time_24hr": true,
55
+ "minDate": null,
56
+ "disableWeekends": false,
57
+ "disableWeekdays": false,
58
+ "maxDate": null
59
+ }
60
+ }
61
+ ]
62
+ };
@@ -86,6 +86,9 @@ export default class TextFieldComponent extends Input {
86
86
  locale: this.component.widget.locale || this.options.language,
87
87
  saveAs: 'text'
88
88
  };
89
+ // update originalComponent to include widget settings after component initialization
90
+ // originalComponent is used to restore the component (and widget) after evaluating field logic
91
+ this.originalComponent = FormioUtils.fastCloneDeep(this.component);
89
92
  }
90
93
  }
91
94
  attach(element) {
@@ -6,4 +6,5 @@ import comp5 from './comp5';
6
6
  import comp6 from './comp6';
7
7
  import comp7 from './comp7';
8
8
  import withDisplayAndInputMasks from './comp-with-display-and-value-masks';
9
- export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, withDisplayAndInputMasks };
9
+ import requiredFieldLogicComp from './requiredFieldLogicComp';
10
+ export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, withDisplayAndInputMasks, requiredFieldLogicComp };
@@ -6,4 +6,5 @@ import comp5 from './comp5';
6
6
  import comp6 from './comp6';
7
7
  import withDisplayAndInputMasks from './comp-with-display-and-value-masks';
8
8
  import comp7 from './comp7';
9
- export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, withDisplayAndInputMasks };
9
+ import requiredFieldLogicComp from './requiredFieldLogicComp';
10
+ export { comp1, comp2, comp3, comp4, comp5, comp6, comp7, withDisplayAndInputMasks, requiredFieldLogicComp };
@@ -0,0 +1,48 @@
1
+ declare namespace _default {
2
+ let components: {
3
+ label: string;
4
+ widget: {
5
+ type: string;
6
+ altInput: boolean;
7
+ allowInput: boolean;
8
+ clickOpens: boolean;
9
+ enableDate: boolean;
10
+ enableTime: boolean;
11
+ mode: string;
12
+ noCalendar: boolean;
13
+ format: string;
14
+ dateFormat: string;
15
+ useLocaleSettings: boolean;
16
+ hourIncrement: number;
17
+ minuteIncrement: number;
18
+ time_24hr: boolean;
19
+ saveAs: string;
20
+ displayInTimezone: string;
21
+ locale: string;
22
+ };
23
+ applyMaskOn: string;
24
+ tableView: boolean;
25
+ validateWhenHidden: boolean;
26
+ key: string;
27
+ logic: {
28
+ name: string;
29
+ trigger: {
30
+ type: string;
31
+ javascript: string;
32
+ };
33
+ actions: {
34
+ name: string;
35
+ type: string;
36
+ property: {
37
+ label: string;
38
+ value: string;
39
+ type: string;
40
+ };
41
+ state: boolean;
42
+ }[];
43
+ }[];
44
+ type: string;
45
+ input: boolean;
46
+ }[];
47
+ }
48
+ export default _default;
@@ -0,0 +1,53 @@
1
+ export default {
2
+ components: [
3
+ {
4
+ "label": "Text Field",
5
+ "widget": {
6
+ "type": "calendar",
7
+ "altInput": true,
8
+ "allowInput": true,
9
+ "clickOpens": true,
10
+ "enableDate": true,
11
+ "enableTime": true,
12
+ "mode": "single",
13
+ "noCalendar": false,
14
+ "format": "MM/dd/yyyy:HH:mm:ss",
15
+ "dateFormat": "MM/dd/yyyy:HH:mm:ss",
16
+ "useLocaleSettings": false,
17
+ "hourIncrement": 1,
18
+ "minuteIncrement": 5,
19
+ "time_24hr": false,
20
+ "saveAs": "text",
21
+ "displayInTimezone": "viewer",
22
+ "locale": "en"
23
+ },
24
+ "applyMaskOn": "change",
25
+ "tableView": true,
26
+ "validateWhenHidden": false,
27
+ "key": "textField",
28
+ "logic": [
29
+ {
30
+ "name": "requiredLogic",
31
+ "trigger": {
32
+ "type": "javascript",
33
+ "javascript": "result = true;"
34
+ },
35
+ "actions": [
36
+ {
37
+ "name": "setRequired",
38
+ "type": "property",
39
+ "property": {
40
+ "label": "Required",
41
+ "value": "validate.required",
42
+ "type": "boolean"
43
+ },
44
+ "state": true
45
+ }
46
+ ]
47
+ }
48
+ ],
49
+ "type": "textfield",
50
+ "input": true
51
+ }
52
+ ]
53
+ };
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.1.0-rc.16",
3
+ "version": "5.1.0-rc.17",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {