@aemforms/af-core 0.22.90 → 0.22.91

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.
@@ -1,6 +1,6 @@
1
1
  import { E as EventSource, p as propertyChange, a as ExecuteRule, I as Initialize, R as RemoveItem, S as SubmitSuccess, C as CustomEvent, b as SubmitError, c as SubmitFailure, d as CaptchaDisplayMode, e as Submit, f as Save, g as RemoveInstance, A as AddInstance, h as Reset, i as AddItem, j as Click, k as Change, F as FormLoad, l as FocusOption, m as FieldChanged, V as ValidationComplete, n as constraintKeys, o as getConstraintTypeMessages, q as Valid, r as Invalid, s as ValidationError } from './Events-a66f7a2c.js';
2
2
  import Formula from '@adobe/json-formula';
3
- import { parseDefaultDate, datetimeToNumber, format, parseDateSkeleton, formatDate, numberToDatetime } from '@aemforms/af-formatters';
3
+ import { parseDefaultDate, datetimeToNumber, format, parseDateSkeleton, formatDate, numberToDatetime, parseDate } from '@aemforms/af-formatters';
4
4
 
5
5
  function __decorate(decorators, target, key, desc) {
6
6
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -3510,6 +3510,9 @@ class Field extends Scriptable {
3510
3510
  if (['plain-text', 'image'].indexOf(this.fieldType) === -1) {
3511
3511
  this._jsonModel.value = undefined;
3512
3512
  }
3513
+ else {
3514
+ this._jsonModel.default = this._jsonModel.default || this._jsonModel.value;
3515
+ }
3513
3516
  const value = this._jsonModel.value;
3514
3517
  if (value === undefined) {
3515
3518
  const typedRes = Constraints.type(this.getInternalType() || 'string', this._jsonModel.default);
@@ -3730,7 +3733,7 @@ class Field extends Scriptable {
3730
3733
  }
3731
3734
  updateDataNodeAndTypedValue(val) {
3732
3735
  const dataNode = this.getDataNode();
3733
- if (staticFields.indexOf(this.fieldType) > -1 && typeof dataNode !== 'undefined') {
3736
+ if (staticFields.indexOf(this.fieldType) > -1 && typeof dataNode !== 'undefined' && dataNode !== NullDataValue) {
3734
3737
  return;
3735
3738
  }
3736
3739
  const Constraints = this._getConstraintObject();
@@ -4405,7 +4408,18 @@ class DateField extends Field {
4405
4408
  }
4406
4409
  }
4407
4410
  else {
4408
- super.value = value;
4411
+ if (this._jsonModel.editFormat !== 'short' && this._jsonModel.editFormat !== 'date|short') {
4412
+ const date = parseDate(value, this.locale, this._jsonModel.editFormat);
4413
+ if (date !== null) {
4414
+ super.value = formatDate(date, this.locale, this._dataFormat);
4415
+ }
4416
+ else {
4417
+ super.value = value;
4418
+ }
4419
+ }
4420
+ else {
4421
+ super.value = value;
4422
+ }
4409
4423
  }
4410
4424
  }
4411
4425
  }
package/lib/DateField.js CHANGED
@@ -37,7 +37,18 @@ class DateField extends Field_1.default {
37
37
  }
38
38
  }
39
39
  else {
40
- super.value = value;
40
+ if (this._jsonModel.editFormat !== 'short' && this._jsonModel.editFormat !== 'date|short') {
41
+ const date = (0, af_formatters_1.parseDate)(value, this.locale, this._jsonModel.editFormat);
42
+ if (date !== null) {
43
+ super.value = (0, af_formatters_1.formatDate)(date, this.locale, this._dataFormat);
44
+ }
45
+ else {
46
+ super.value = value;
47
+ }
48
+ }
49
+ else {
50
+ super.value = value;
51
+ }
41
52
  }
42
53
  }
43
54
  }
package/lib/Field.js CHANGED
@@ -111,6 +111,9 @@ class Field extends Scriptable_1.default {
111
111
  if (['plain-text', 'image'].indexOf(this.fieldType) === -1) {
112
112
  this._jsonModel.value = undefined;
113
113
  }
114
+ else {
115
+ this._jsonModel.default = this._jsonModel.default || this._jsonModel.value;
116
+ }
114
117
  const value = this._jsonModel.value;
115
118
  if (value === undefined) {
116
119
  const typedRes = ValidationUtils_1.Constraints.type(this.getInternalType() || 'string', this._jsonModel.default);
@@ -329,7 +332,7 @@ class Field extends Scriptable_1.default {
329
332
  }
330
333
  updateDataNodeAndTypedValue(val) {
331
334
  const dataNode = this.getDataNode();
332
- if (BaseNode_1.staticFields.indexOf(this.fieldType) > -1 && typeof dataNode !== 'undefined') {
335
+ if (BaseNode_1.staticFields.indexOf(this.fieldType) > -1 && typeof dataNode !== 'undefined' && dataNode !== EmptyDataValue_1.default) {
333
336
  return;
334
337
  }
335
338
  const Constraints = this._getConstraintObject();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aemforms/af-core",
3
- "version": "0.22.90",
3
+ "version": "0.22.91",
4
4
  "description": "Core Module for Forms Runtime",
5
5
  "author": "Adobe Systems",
6
6
  "license": "Adobe Proprietary",
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@adobe/json-formula": "0.1.50",
40
- "@aemforms/af-formatters": "^0.22.90"
40
+ "@aemforms/af-formatters": "^0.22.91"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@babel/preset-env": "^7.20.2",