tuain-ng-forms-lib 12.0.84 → 12.0.87

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.
@@ -1162,11 +1162,21 @@
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)) {
1172
+ return true;
1173
+ }
1174
+ if (fieldCurrentValue.length !== 2 || !fieldCurrentValue[0] || !fieldCurrentValue[1]) {
1175
+ return true;
1176
+ }
1177
+ return false;
1178
+ }
1179
+ ;
1170
1180
  return fieldCurrentValue === '';
1171
1181
  };
1172
1182
  FieldDescriptor.prototype.getValue = function () {
@@ -3423,17 +3433,18 @@
3423
3433
  return (name) ? ((_b = (_a = this.extraData) === null || _a === void 0 ? void 0 : _a[name]) !== null && _b !== void 0 ? _b : null) : null;
3424
3434
  };
3425
3435
  BasicFormComponent.prototype.preocessInputParams = function (params) {
3426
- var _a, _b, _c;
3436
+ var _a, _b, _c, _d;
3427
3437
  this._controlToken = (_a = params === null || params === void 0 ? void 0 : params[TOKEN]) !== null && _a !== void 0 ? _a : null;
3428
- var _j = this.formManagerService.getFormInfo(this._controlToken), token = _j.token, subject = _j.subject, state = _j.state, fields = _j.fields, extra = _j.extra, originToken = _j.originToken;
3429
- if (!this._controlToken || this._controlToken !== token) {
3430
- return null;
3438
+ this.formSubject = (_b = params === null || params === void 0 ? void 0 : params[SUBJECT]) !== null && _b !== void 0 ? _b : null;
3439
+ var tokenInfo = (this._controlToken) ? this.formManagerService.getFormInfo(this._controlToken) : {};
3440
+ var token = tokenInfo.token, subject = tokenInfo.subject, state = tokenInfo.state, fields = tokenInfo.fields, extra = tokenInfo.extra, originToken = tokenInfo.originToken;
3441
+ if (token && this._controlToken === token) {
3442
+ this.formSubject = (_d = (_c = this.formSubject) !== null && _c !== void 0 ? _c : subject) !== null && _d !== void 0 ? _d : null;
3443
+ this.inputDataFields = fields;
3444
+ this.extraData = extra;
3445
+ this._originToken = originToken;
3446
+ return state;
3431
3447
  }
3432
- this.formSubject = (_c = (_b = params === null || params === void 0 ? void 0 : params[SUBJECT]) !== null && _b !== void 0 ? _b : subject) !== null && _c !== void 0 ? _c : null;
3433
- this.inputDataFields = fields;
3434
- this.extraData = extra;
3435
- this._originToken = originToken;
3436
- return state;
3437
3448
  };
3438
3449
  BasicFormComponent.prototype.subscribeSectionActivation = function () {
3439
3450
  var _this = this;