tuain-ng-forms-lib 12.0.29 → 12.0.33

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.
@@ -36,7 +36,7 @@
36
36
  Object.defineProperty(ActionComponent.prototype, "visible", {
37
37
  get: function () {
38
38
  var _a;
39
- return ((_a = this.action) === null || _a === void 0 ? void 0 : _a.visibleOn(this.currentState)) && this.visibleOnRestriction();
39
+ return ((_a = this.action) === null || _a === void 0 ? void 0 : _a.visibleOn(this.state)) && this.visibleOnRestriction();
40
40
  },
41
41
  enumerable: false,
42
42
  configurable: true
@@ -44,7 +44,7 @@
44
44
  Object.defineProperty(ActionComponent.prototype, "disabled", {
45
45
  get: function () {
46
46
  var _a;
47
- return !((_a = this.action) === null || _a === void 0 ? void 0 : _a.enabledOn(this.currentState));
47
+ return !((_a = this.action) === null || _a === void 0 ? void 0 : _a.enabledOn(this.state));
48
48
  },
49
49
  enumerable: false,
50
50
  configurable: true
@@ -61,7 +61,7 @@
61
61
  action: [{ type: core.Input }],
62
62
  busy: [{ type: core.Input }],
63
63
  relatedField: [{ type: core.Input }],
64
- currentState: [{ type: core.Input }],
64
+ state: [{ type: core.Input }],
65
65
  style: [{ type: core.Input }],
66
66
  showLabel: [{ type: core.Input }]
67
67
  };
@@ -422,18 +422,18 @@
422
422
  FieldComponent.prototype.start = function () { };
423
423
  FieldComponent.prototype.focus = function () { };
424
424
  FieldComponent.prototype.updateObject = function () {
425
- this.field._fieldValue = this.value;
425
+ this.field.setValue(this.value);
426
426
  };
427
427
  FieldComponent.prototype.inputChanged = function () {
428
- this.field._fieldValue = this.value;
428
+ this.field.setValue(this.value);
429
429
  this.onChangeContent();
430
430
  };
431
431
  FieldComponent.prototype.inputTyped = function () {
432
- this.field._fieldValue = this.value;
432
+ this.field.setValue(this.value);
433
433
  this.onInputChange();
434
434
  };
435
435
  FieldComponent.prototype.updateValue = function () {
436
- this.value = this.field._fieldValue;
436
+ this.value = this.field.getValue();
437
437
  };
438
438
  FieldComponent.prototype.onInputChange = function () {
439
439
  var _this = this;
@@ -454,7 +454,7 @@
454
454
  Object.defineProperty(FieldComponent.prototype, "visible", {
455
455
  get: function () {
456
456
  var _a;
457
- return (_a = this.field) === null || _a === void 0 ? void 0 : _a.visibleOn(this.currentState);
457
+ return (_a = this.field) === null || _a === void 0 ? void 0 : _a.visibleOn(this.state);
458
458
  },
459
459
  enumerable: false,
460
460
  configurable: true
@@ -462,7 +462,7 @@
462
462
  Object.defineProperty(FieldComponent.prototype, "disabled", {
463
463
  get: function () {
464
464
  var _a;
465
- return !((_a = this.field) === null || _a === void 0 ? void 0 : _a.enabledOn(this.currentState));
465
+ return !((_a = this.field) === null || _a === void 0 ? void 0 : _a.enabledOn(this.state));
466
466
  },
467
467
  enumerable: false,
468
468
  configurable: true
@@ -477,7 +477,7 @@
477
477
  ];
478
478
  FieldComponent.propDecorators = {
479
479
  field: [{ type: core.Input }],
480
- currentState: [{ type: core.Input }]
480
+ state: [{ type: core.Input }]
481
481
  };
482
482
 
483
483
  var ElementComponent = /** @class */ (function () {
@@ -492,7 +492,7 @@
492
492
  Object.defineProperty(ElementComponent.prototype, "visible", {
493
493
  get: function () {
494
494
  var _a;
495
- return (_a = this.element) === null || _a === void 0 ? void 0 : _a.visibleOn(this.currentState);
495
+ return (_a = this.element) === null || _a === void 0 ? void 0 : _a.visibleOn(this.state);
496
496
  },
497
497
  enumerable: false,
498
498
  configurable: true
@@ -500,7 +500,7 @@
500
500
  Object.defineProperty(ElementComponent.prototype, "disabled", {
501
501
  get: function () {
502
502
  var _a;
503
- return !((_a = this.element) === null || _a === void 0 ? void 0 : _a.enabledOn(this.currentState));
503
+ return !((_a = this.element) === null || _a === void 0 ? void 0 : _a.enabledOn(this.state));
504
504
  },
505
505
  enumerable: false,
506
506
  configurable: true
@@ -516,7 +516,7 @@
516
516
  ElementComponent.propDecorators = {
517
517
  element: [{ type: core.Input }],
518
518
  form: [{ type: core.Input }],
519
- currentState: [{ type: core.Input }]
519
+ state: [{ type: core.Input }]
520
520
  };
521
521
 
522
522
  var FormErrorComponent = /** @class */ (function () {
@@ -1638,7 +1638,7 @@
1638
1638
  table: [{ type: core.Input }],
1639
1639
  tableRecords: [{ type: core.Input }],
1640
1640
  disabled: [{ type: core.Input }],
1641
- currentState: [{ type: core.Input }],
1641
+ state: [{ type: core.Input }],
1642
1642
  waiting: [{ type: core.Input }]
1643
1643
  };
1644
1644
 
@@ -1691,7 +1691,7 @@
1691
1691
  var BIG_MAX_LENGTH = 500;
1692
1692
  var fldAttr = {
1693
1693
  validateOnServer: 'validateOnServer',
1694
- value: '_fieldValue',
1694
+ value: '_value',
1695
1695
  minValue: '_minValue',
1696
1696
  maxValue: '_maxValue',
1697
1697
  maxLength: '_maxLength',
@@ -1869,7 +1869,6 @@
1869
1869
  FieldDescriptor.prototype.hideLabel = function () { this.setVisibleLabel(false); };
1870
1870
  FieldDescriptor.prototype.setChanged = function (hasChanged) { this.setAttr(fldAttr.hasChanged, hasChanged); };
1871
1871
  FieldDescriptor.prototype.changed = function () { this.setChanged(true); };
1872
- FieldDescriptor.prototype.getRawValue = function () { return this._fieldValue; };
1873
1872
  FieldDescriptor.prototype.setLabel = function (label) { this.setAttr(fldAttr.title, label); };
1874
1873
  FieldDescriptor.prototype.clean = function () { this.setValue(this.defaultValue || ''); this.resetError(); };
1875
1874
  Object.defineProperty(FieldDescriptor.prototype, "backend", {
@@ -1918,22 +1917,11 @@
1918
1917
  return fieldCurrentValue === '';
1919
1918
  };
1920
1919
  FieldDescriptor.prototype.getValue = function () {
1921
- var _a, _b;
1922
- switch (this.fieldType) {
1923
- case this._formConfig.fieldTypes.boolean:
1924
- return (_a = this._fieldValue) !== null && _a !== void 0 ? _a : false;
1925
- break;
1926
- case this._formConfig.fieldTypes.check:
1927
- return (_b = this._fieldValue) !== null && _b !== void 0 ? _b : false;
1928
- break;
1929
- case this._formConfig.fieldTypes.currency:
1930
- return (typeof this._fieldValue === 'string')
1931
- ? this._fieldValue.replace(',', '') : this._fieldValue;
1932
- break;
1933
- default:
1934
- return this._fieldValue;
1935
- break;
1920
+ if (this.fieldType === this._formConfig.fieldTypes.boolean
1921
+ || this.fieldType === this._formConfig.fieldTypes.check) {
1922
+ return !!this._value;
1936
1923
  }
1924
+ return this._value;
1937
1925
  };
1938
1926
  FieldDescriptor.prototype.updateFromServer = function (fld) {
1939
1927
  var _a;
@@ -2012,14 +2000,14 @@
2012
2000
  if (this.fieldType === this._formConfig.fieldTypes.array && this.widget) {
2013
2001
  return (_a = this.widget) === null || _a === void 0 ? void 0 : _a.refereshContent();
2014
2002
  }
2015
- if (this._fieldValue) {
2016
- if (this.fieldType === this._formConfig.fieldTypes.array && Array.isArray(this._fieldValue)) {
2017
- var fieldValue = (_b = this._fieldValue) === null || _b === void 0 ? void 0 : _b.filter(function (item) { return _this.fieldOptions.find(function (opt) { return opt.fieldOptionId === item; }); });
2003
+ if (this._value) {
2004
+ if (this.fieldType === this._formConfig.fieldTypes.array && Array.isArray(this._value)) {
2005
+ var fieldValue = (_b = this._value) === null || _b === void 0 ? void 0 : _b.filter(function (item) { return _this.fieldOptions.find(function (opt) { return opt.fieldOptionId === item; }); });
2018
2006
  this.setAttr(fldAttr.value, fieldValue);
2019
2007
  }
2020
2008
  else {
2021
2009
  var valInOptions = this.fieldOptions
2022
- .find(function (item) { return item.fieldOptionId === _this._fieldValue; });
2010
+ .find(function (item) { return item.fieldOptionId === _this._value; });
2023
2011
  if (!valInOptions) {
2024
2012
  this.setValue('');
2025
2013
  }
@@ -2075,7 +2063,7 @@
2075
2063
  newFinalValue = newValue;
2076
2064
  break;
2077
2065
  }
2078
- if (this._fieldValue !== newFinalValue) {
2066
+ if (this._value !== newFinalValue) {
2079
2067
  this.setChanged(true);
2080
2068
  this.setAttr(fldAttr.value, newFinalValue);
2081
2069
  }
@@ -2583,7 +2571,7 @@
2583
2571
  FormStructureAndData.prototype.getField = function (code) { var _a; return (code && ((_a = this._fields) === null || _a === void 0 ? void 0 : _a[code])) ? this._fields[code] : null; };
2584
2572
  FormStructureAndData.prototype.enableField = function (code) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.enable(); };
2585
2573
  FormStructureAndData.prototype.disableField = function (code) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.disable(); };
2586
- FormStructureAndData.prototype.getFieldValue = function (code) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.getValue(); };
2574
+ FormStructureAndData.prototype.getFieldValue = function (code) { var _a; return (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.getValue(); };
2587
2575
  FormStructureAndData.prototype.getFieldOptions = function (code) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.getFieldOptions(); };
2588
2576
  FormStructureAndData.prototype.setFieldValue = function (code, value) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.setValue(value); };
2589
2577
  FormStructureAndData.prototype.setFieldError = function (code, message, type) {
@@ -3406,7 +3394,7 @@
3406
3394
  configurable: true
3407
3395
  });
3408
3396
  Object.defineProperty(BasicFormComponent.prototype, "state", {
3409
- get: function () { return this.getCurrentState(); },
3397
+ get: function () { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.state; },
3410
3398
  enumerable: false,
3411
3399
  configurable: true
3412
3400
  });
@@ -3416,11 +3404,6 @@
3416
3404
  enumerable: false,
3417
3405
  configurable: true
3418
3406
  });
3419
- Object.defineProperty(BasicFormComponent.prototype, "currentMode", {
3420
- get: function () { return this.currentState; },
3421
- enumerable: false,
3422
- configurable: true
3423
- });
3424
3407
  Object.defineProperty(BasicFormComponent.prototype, "immutableData", {
3425
3408
  get: function () { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.immutableData; },
3426
3409
  enumerable: false,
@@ -3505,7 +3488,7 @@
3505
3488
  if (!cleanStack) {
3506
3489
  origin = Object.assign(Object.assign({}, backData), { name: this.name, url: this._formRoute, token: this._controlToken });
3507
3490
  origin.subject = (_a = origin === null || origin === void 0 ? void 0 : origin.subject) !== null && _a !== void 0 ? _a : this.formSubject;
3508
- origin.state = (_b = origin === null || origin === void 0 ? void 0 : origin.state) !== null && _b !== void 0 ? _b : this.currentState;
3491
+ origin.state = (_b = origin === null || origin === void 0 ? void 0 : origin.state) !== null && _b !== void 0 ? _b : this.state;
3509
3492
  origin.fields = (_c = origin === null || origin === void 0 ? void 0 : origin.fields) !== null && _c !== void 0 ? _c : {};
3510
3493
  origin.extra = (_d = origin === null || origin === void 0 ? void 0 : origin.extra) !== null && _d !== void 0 ? _d : {};
3511
3494
  }