tuain-ng-forms-lib 12.0.81 → 12.0.85

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.
@@ -955,7 +955,7 @@
955
955
  __extends(FieldDescriptor, _super);
956
956
  function FieldDescriptor(inputFieldReceived, formConfig) {
957
957
  var _this = this;
958
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
958
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
959
959
  _this = _super.call(this, inputFieldReceived, formConfig) || this;
960
960
  _this._editionFinish = new rxjs.Subject();
961
961
  _this._editionPartial = new rxjs.Subject();
@@ -1000,7 +1000,7 @@
1000
1000
  _this.setVisibleLabel((_l = fld.visibleLabel) !== null && _l !== void 0 ? _l : true);
1001
1001
  _this.setVisibility(fld.visible);
1002
1002
  _this.setFieldOptions(fld.fieldOptions);
1003
- _this.setValue(fld.fieldValue || _this.defaultValue || '');
1003
+ _this.setValue((_o = (_m = fld.fieldValue) !== null && _m !== void 0 ? _m : _this.defaultValue) !== null && _o !== void 0 ? _o : '');
1004
1004
  return _this;
1005
1005
  }
1006
1006
  Object.defineProperty(FieldDescriptor.prototype, "name", {
@@ -1162,11 +1162,22 @@
1162
1162
  if (fieldCurrentValue === undefined || fieldCurrentValue === null) {
1163
1163
  return true;
1164
1164
  }
1165
- if ((this.fieldType === this._formConfig.fieldTypes.array || this.fieldType === this._formConfig.fieldTypes.phone)
1165
+ if (this.fieldType === this._formConfig.fieldTypes.array
1166
1166
  && Array.isArray(fieldCurrentValue) && fieldCurrentValue.length === 0) {
1167
1167
  return true;
1168
1168
  }
1169
1169
  ;
1170
+ if (this.fieldType === this._formConfig.fieldTypes.phone) {
1171
+ if (Array.isArray(fieldCurrentValue) && fieldCurrentValue.length < 2) {
1172
+ return true;
1173
+ }
1174
+ if (Array.isArray(fieldCurrentValue) && fieldCurrentValue.length === 2
1175
+ && (!fieldCurrentValue[1] || fieldCurrentValue[1].length === 0)) {
1176
+ return true;
1177
+ }
1178
+ return true;
1179
+ }
1180
+ ;
1170
1181
  return fieldCurrentValue === '';
1171
1182
  };
1172
1183
  FieldDescriptor.prototype.getValue = function () {
@@ -1260,13 +1271,14 @@
1260
1271
  };
1261
1272
  FieldDescriptor.prototype.setValue = function (newValue, widgetUpdate) {
1262
1273
  if (widgetUpdate === void 0) { widgetUpdate = true; }
1274
+ var _a;
1263
1275
  if (typeof newValue === UNDEFINED || newValue === null) {
1264
1276
  return true;
1265
1277
  }
1266
1278
  var newFinalValue;
1267
1279
  if (this.fieldType === this._formConfig.fieldTypes.boolean
1268
1280
  || this.fieldType === this._formConfig.fieldTypes.check) {
1269
- newFinalValue = yn__default['default'](newValue);
1281
+ newFinalValue = (_a = yn__default['default'](newValue)) !== null && _a !== void 0 ? _a : false;
1270
1282
  }
1271
1283
  else if (this.fieldType === this._formConfig.fieldTypes.array
1272
1284
  || this.fieldType === this._formConfig.fieldTypes.map) {
@@ -1443,8 +1455,7 @@
1443
1455
  configurable: true
1444
1456
  });
1445
1457
  TableRecordData.prototype.getFieldValue = function (fieldCode) {
1446
- return (fieldCode && this.recordData[fieldCode])
1447
- ? this.recordData[fieldCode] : null;
1458
+ return (fieldCode && this.recordData) ? this.recordData[fieldCode] : null;
1448
1459
  };
1449
1460
  TableRecordData.prototype.hasPattern = function (words) {
1450
1461
  var e_1, _a;