tuain-ng-forms-lib 12.0.80 → 12.0.84

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();
@@ -965,8 +965,15 @@
965
965
  var fld = (inputFieldReceived) ? inputFieldReceived : {};
966
966
  _this.setAttr(fldAttr.code, fld.fieldCode);
967
967
  _this.setAttr(fldAttr.title, (_a = fld.fieldTitle) !== null && _a !== void 0 ? _a : _this.fieldCode);
968
+ _this.setAttr(fldAttr.type, fld.fieldTypeCode);
968
969
  _this.setAttr(fldAttr.captureType, (_b = fld.captureType) !== null && _b !== void 0 ? _b : DEFAULT_CAPTURE_TYPE);
969
- _this.setAttr(fldAttr.defaultValue, (_c = fld.defaultValue) !== null && _c !== void 0 ? _c : null);
970
+ var defaultValue = (_c = fld.defaultValue) !== null && _c !== void 0 ? _c : null;
971
+ if (_this.fieldType === _this._formConfig.fieldTypes.boolean) {
972
+ _this.setAttr(fldAttr.defaultValue, defaultValue !== null && defaultValue !== void 0 ? defaultValue : false);
973
+ }
974
+ else {
975
+ _this.setAttr(fldAttr.defaultValue, defaultValue);
976
+ }
970
977
  var defaultTypeAlignment = (_this._formConfig.tableFieldStyles[_this.fieldType] != null)
971
978
  ? _this._formConfig.tableFieldStyles[_this.fieldType]['text-align'] : DEFAULT_ALIGNMENT;
972
979
  var fieldAlignment = (fld.alignment != null) ? fld.alignment.toLowerCase() : defaultTypeAlignment;
@@ -989,12 +996,11 @@
989
996
  var maxLength = (_h = fld.maxLength) !== null && _h !== void 0 ? _h : (_this.captureType === 'TEXTAREA' ? BIG_MAX_LENGTH : STD_MAX_LENGTH);
990
997
  _this.setAttr(fldAttr.maxLength, maxLength);
991
998
  _this.setAttr(fldAttr.intrinsicErrorMessage, (_j = _this._formConfig.fieldTypeErrMsg[_this.fieldType]) !== null && _j !== void 0 ? _j : _this._formConfig.fieldTypeErrMsg.DEFAULT);
992
- _this.setFieldType(fld.fieldTypeCode);
993
999
  _this.setEditable((_k = fld.editable) !== null && _k !== void 0 ? _k : true);
994
1000
  _this.setVisibleLabel((_l = fld.visibleLabel) !== null && _l !== void 0 ? _l : true);
995
1001
  _this.setVisibility(fld.visible);
996
1002
  _this.setFieldOptions(fld.fieldOptions);
997
- _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 : '');
998
1004
  return _this;
999
1005
  }
1000
1006
  Object.defineProperty(FieldDescriptor.prototype, "name", {
@@ -1193,13 +1199,10 @@
1193
1199
  (attrName === this._formConfig.apiFieldAttrs.value) && (this.setValue(fld.fieldValue) && this.setChanged(false));
1194
1200
  (attrName === this._formConfig.apiFieldAttrs.options) && this.setFieldOptions(fld.fieldOptions);
1195
1201
  (attrName === this._formConfig.apiFieldAttrs.captureType) && this.setAttr(fldAttr.captureType, fld.captureType || 'INPUT');
1196
- (attrName === this._formConfig.apiFieldAttrs.type) && this.setFieldType(fld.fieldTypeCode);
1202
+ (attrName === this._formConfig.apiFieldAttrs.type) && this.setAttr(fldAttr.type, fld.fieldTypeCode);
1197
1203
  (attrName === this._formConfig.apiFieldAttrs.maxLength) && this.setAttr(fldAttr.maxLength, fld.maxLength);
1198
1204
  }
1199
1205
  };
1200
- FieldDescriptor.prototype.setFieldType = function (inputFieldType) {
1201
- this.setAttr(fldAttr.type, inputFieldType);
1202
- };
1203
1206
  FieldDescriptor.prototype.setMinValue = function (inputMinValue) {
1204
1207
  var minValue = inputMinValue;
1205
1208
  if (this.fieldType === this._formConfig.fieldTypes.date) {
@@ -1257,13 +1260,14 @@
1257
1260
  };
1258
1261
  FieldDescriptor.prototype.setValue = function (newValue, widgetUpdate) {
1259
1262
  if (widgetUpdate === void 0) { widgetUpdate = true; }
1263
+ var _a;
1260
1264
  if (typeof newValue === UNDEFINED || newValue === null) {
1261
1265
  return true;
1262
1266
  }
1263
1267
  var newFinalValue;
1264
1268
  if (this.fieldType === this._formConfig.fieldTypes.boolean
1265
1269
  || this.fieldType === this._formConfig.fieldTypes.check) {
1266
- newFinalValue = yn__default['default'](newValue);
1270
+ newFinalValue = (_a = yn__default['default'](newValue)) !== null && _a !== void 0 ? _a : false;
1267
1271
  }
1268
1272
  else if (this.fieldType === this._formConfig.fieldTypes.array
1269
1273
  || this.fieldType === this._formConfig.fieldTypes.map) {
@@ -1440,8 +1444,7 @@
1440
1444
  configurable: true
1441
1445
  });
1442
1446
  TableRecordData.prototype.getFieldValue = function (fieldCode) {
1443
- return (fieldCode && this.recordData[fieldCode])
1444
- ? this.recordData[fieldCode] : null;
1447
+ return (fieldCode && this.recordData) ? this.recordData[fieldCode] : null;
1445
1448
  };
1446
1449
  TableRecordData.prototype.hasPattern = function (words) {
1447
1450
  var e_1, _a;