@formio/js 5.0.0-rc.89 → 5.0.0-rc.90

Sign up to get free protection for your applications and to get access to all the features.
@@ -20,7 +20,7 @@
20
20
 
21
21
  /*! @license DOMPurify 3.1.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.6/LICENSE */
22
22
 
23
- /*! formiojs v5.0.0-rc.89 | https://unpkg.com/formiojs@5.0.0-rc.89/LICENSE.txt */
23
+ /*! formiojs v5.0.0-rc.90 | https://unpkg.com/formiojs@5.0.0-rc.90/LICENSE.txt */
24
24
 
25
25
  /**
26
26
  * @license
@@ -286,7 +286,7 @@ class DayComponent extends Field_1.default {
286
286
  if (!this.component.fields.day.hide && maxDay) {
287
287
  this.refs.day.max = maxDay;
288
288
  }
289
- if (maxDay && day > maxDay) {
289
+ if (maxDay && day > maxDay && this.refs.day) {
290
290
  this.refs.day.value = this.refs.day.max;
291
291
  }
292
292
  updateValueAndSaveFocus(this.refs.month, 'month')();
@@ -496,34 +496,40 @@ class DayComponent extends Field_1.default {
496
496
  if (defaultValue) {
497
497
  defaults = defaultValue.split('/').map(x => parseInt(x, 10));
498
498
  }
499
+ const isModalEditClosed = this.component.modalEdit && !this.componentModal.isOpened;
499
500
  if (this.showDay && this.refs.day) {
500
- day = this.refs.day.value === '' ? '' : parseInt(this.refs.day.value, 10);
501
+ day = (this.refs.day.value === '' && !isModalEditClosed) ? '' : parseInt(this.refs.day.value, 10);
501
502
  }
502
- if (day === undefined || lodash_1.default.isNaN(day)) {
503
- day = (defaults.length !== 3 && value)
503
+ if (day === undefined || lodash_1.default.isNaN(day) || value) {
504
+ day = (defaults.length !== 3)
504
505
  ? this.getDayWithHiddenFields(defaults).day
505
506
  : (defaults[DAY] && !lodash_1.default.isNaN(defaults[DAY]) ? defaults[DAY] : 0);
506
507
  }
507
508
  if (this.showMonth && this.refs.month) {
508
509
  // Months are 0 indexed.
509
- month = this.refs.month.value === '' ? '' : parseInt(this.refs.month.value, 10);
510
+ month = (this.refs.month.value === '' && !isModalEditClosed) ? '' : parseInt(this.refs.month.value, 10);
510
511
  }
511
- if (month === undefined || lodash_1.default.isNaN(month)) {
512
- month = (defaults.length !== 3 && value)
512
+ if (month === undefined || lodash_1.default.isNaN(month) || value) {
513
+ month = (defaults.length !== 3)
513
514
  ? this.getDayWithHiddenFields(defaults).month
514
515
  : (defaults[MONTH] && !lodash_1.default.isNaN(defaults[MONTH]) ? defaults[MONTH] : 0);
515
516
  }
516
517
  if (this.showYear && this.refs.year) {
517
- year = this.refs.year.value === '' ? '' : parseInt(this.refs.year.value);
518
+ year = (this.refs.year.value === '' && !isModalEditClosed) ? '' : parseInt(this.refs.year.value);
518
519
  }
519
- if (year === undefined || lodash_1.default.isNaN(year)) {
520
- year = (defaults.length !== 3 && value)
520
+ if (year === undefined || lodash_1.default.isNaN(year) || value) {
521
+ year = (defaults.length !== 3)
521
522
  ? this.getDayWithHiddenFields(defaults).year
522
523
  : (defaults[YEAR] && !lodash_1.default.isNaN(defaults[YEAR]) ? defaults[YEAR] : 0);
523
524
  }
524
525
  let result;
525
526
  if (!day && !month && !year) {
526
- this.dataValue = this.emptyValue;
527
+ if (!isModalEditClosed) {
528
+ this.dataValue = this.emptyValue;
529
+ if (this.options.building) {
530
+ this.triggerChange();
531
+ }
532
+ }
527
533
  return null;
528
534
  }
529
535
  // add trailing zeros if the data is showed
@@ -15,8 +15,8 @@ export const getComponentPath: typeof Utils.getComponentPath;
15
15
  export const isComponentNestedDataType: typeof Utils.isComponentNestedDataType;
16
16
  export const componentPath: typeof Utils.componentPath;
17
17
  export const componentChildPath: any;
18
- export const eachComponentDataAsync: (components: Component[], data: DataObject, fn: AsyncComponentDataCallback, path?: string | undefined, index?: number | undefined, parent?: any, includeAll?: boolean | undefined) => Promise<void>;
19
- export const eachComponentData: (components: Component[], data: DataObject, fn: ComponentDataCallback, path?: string | undefined, index?: number | undefined, parent?: any, includeAll?: boolean | undefined) => void;
18
+ export const eachComponentDataAsync: (components: Component[], data: DataObject, fn: EachComponentDataAsyncCallback, path?: string | undefined, index?: number | undefined, parent?: any, includeAll?: boolean | undefined) => Promise<void>;
19
+ export const eachComponentData: (components: Component[], data: DataObject, fn: EachComponentDataCallback, path?: string | undefined, index?: number | undefined, parent?: any, includeAll?: boolean | undefined) => void;
20
20
  export const getComponentKey: typeof Utils.getComponentKey;
21
21
  export const getContextualRowPath: typeof Utils.getContextualRowPath;
22
22
  export const getContextualRowData: typeof Utils.getContextualRowData;
@@ -284,7 +284,7 @@ export default class DayComponent extends Field {
284
284
  if (!this.component.fields.day.hide && maxDay) {
285
285
  this.refs.day.max = maxDay;
286
286
  }
287
- if (maxDay && day > maxDay) {
287
+ if (maxDay && day > maxDay && this.refs.day) {
288
288
  this.refs.day.value = this.refs.day.max;
289
289
  }
290
290
  updateValueAndSaveFocus(this.refs.month, 'month')();
@@ -494,34 +494,40 @@ export default class DayComponent extends Field {
494
494
  if (defaultValue) {
495
495
  defaults = defaultValue.split('/').map(x => parseInt(x, 10));
496
496
  }
497
+ const isModalEditClosed = this.component.modalEdit && !this.componentModal.isOpened;
497
498
  if (this.showDay && this.refs.day) {
498
- day = this.refs.day.value === '' ? '' : parseInt(this.refs.day.value, 10);
499
+ day = (this.refs.day.value === '' && !isModalEditClosed) ? '' : parseInt(this.refs.day.value, 10);
499
500
  }
500
- if (day === undefined || _.isNaN(day)) {
501
- day = (defaults.length !== 3 && value)
501
+ if (day === undefined || _.isNaN(day) || value) {
502
+ day = (defaults.length !== 3)
502
503
  ? this.getDayWithHiddenFields(defaults).day
503
504
  : (defaults[DAY] && !_.isNaN(defaults[DAY]) ? defaults[DAY] : 0);
504
505
  }
505
506
  if (this.showMonth && this.refs.month) {
506
507
  // Months are 0 indexed.
507
- month = this.refs.month.value === '' ? '' : parseInt(this.refs.month.value, 10);
508
+ month = (this.refs.month.value === '' && !isModalEditClosed) ? '' : parseInt(this.refs.month.value, 10);
508
509
  }
509
- if (month === undefined || _.isNaN(month)) {
510
- month = (defaults.length !== 3 && value)
510
+ if (month === undefined || _.isNaN(month) || value) {
511
+ month = (defaults.length !== 3)
511
512
  ? this.getDayWithHiddenFields(defaults).month
512
513
  : (defaults[MONTH] && !_.isNaN(defaults[MONTH]) ? defaults[MONTH] : 0);
513
514
  }
514
515
  if (this.showYear && this.refs.year) {
515
- year = this.refs.year.value === '' ? '' : parseInt(this.refs.year.value);
516
+ year = (this.refs.year.value === '' && !isModalEditClosed) ? '' : parseInt(this.refs.year.value);
516
517
  }
517
- if (year === undefined || _.isNaN(year)) {
518
- year = (defaults.length !== 3 && value)
518
+ if (year === undefined || _.isNaN(year) || value) {
519
+ year = (defaults.length !== 3)
519
520
  ? this.getDayWithHiddenFields(defaults).year
520
521
  : (defaults[YEAR] && !_.isNaN(defaults[YEAR]) ? defaults[YEAR] : 0);
521
522
  }
522
523
  let result;
523
524
  if (!day && !month && !year) {
524
- this.dataValue = this.emptyValue;
525
+ if (!isModalEditClosed) {
526
+ this.dataValue = this.emptyValue;
527
+ if (this.options.building) {
528
+ this.triggerChange();
529
+ }
530
+ }
525
531
  return null;
526
532
  }
527
533
  // add trailing zeros if the data is showed
@@ -15,8 +15,8 @@ export const getComponentPath: typeof Utils.getComponentPath;
15
15
  export const isComponentNestedDataType: typeof Utils.isComponentNestedDataType;
16
16
  export const componentPath: typeof Utils.componentPath;
17
17
  export const componentChildPath: any;
18
- export const eachComponentDataAsync: (components: Component[], data: DataObject, fn: AsyncComponentDataCallback, path?: string | undefined, index?: number | undefined, parent?: any, includeAll?: boolean | undefined) => Promise<void>;
19
- export const eachComponentData: (components: Component[], data: DataObject, fn: ComponentDataCallback, path?: string | undefined, index?: number | undefined, parent?: any, includeAll?: boolean | undefined) => void;
18
+ export const eachComponentDataAsync: (components: Component[], data: DataObject, fn: EachComponentDataAsyncCallback, path?: string | undefined, index?: number | undefined, parent?: any, includeAll?: boolean | undefined) => Promise<void>;
19
+ export const eachComponentData: (components: Component[], data: DataObject, fn: EachComponentDataCallback, path?: string | undefined, index?: number | undefined, parent?: any, includeAll?: boolean | undefined) => void;
20
20
  export const getComponentKey: typeof Utils.getComponentKey;
21
21
  export const getContextualRowPath: typeof Utils.getContextualRowPath;
22
22
  export const getContextualRowData: typeof Utils.getContextualRowData;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-rc.89",
3
+ "version": "5.0.0-rc.90",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {
@@ -81,7 +81,7 @@
81
81
  "dependencies": {
82
82
  "@formio/bootstrap": "3.0.0-rc.37",
83
83
  "@formio/choices.js": "^10.2.1",
84
- "@formio/core": "2.3.0-rc.8",
84
+ "@formio/core": "2.3.0-rc.9",
85
85
  "@formio/text-mask-addons": "^3.8.0-formio.2",
86
86
  "@formio/vanilla-text-mask": "^5.1.1-formio.1",
87
87
  "abortcontroller-polyfill": "^1.7.5",