kwikid-forms 0.0.6 → 0.0.7

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.
@@ -1461,14 +1461,6 @@
1461
1461
  return title;
1462
1462
  });
1463
1463
  };
1464
- var formatDateToStandardFormat = function (date) {
1465
- var formattedDate;
1466
- var year = date.year;
1467
- var month = date.month;
1468
- var day = date.day;
1469
- formattedDate = day + "-" + (month + 1) + "-" + year;
1470
- return formattedDate;
1471
- };
1472
1464
  function highlightFieldError(field, error) {
1473
1465
  field.invalid = error;
1474
1466
  field.focus = error;
@@ -1564,19 +1556,29 @@
1564
1556
  fields[fieldIndex] = highlightFieldError(fields[fieldIndex], error);
1565
1557
  return fields;
1566
1558
  }
1567
- var convertValueFromKwikUIFormatToBasicFormat = function (type, value) {
1559
+ var convertDateStringToTuiDayFormat = function (date) {
1560
+ var splitDate = date.split("-");
1561
+ var tuiDay = new cdk.TuiDay(Number(splitDate[2]), // Year
1562
+ Number(splitDate[1]) - 1, // Month, Why '-1' => Because Taiga-UI Required It, So...
1563
+ Number(splitDate[0]) // Day
1564
+ );
1565
+ return tuiDay;
1566
+ };
1567
+ var convertTuiDayFormatToDateString = function (date) {
1568
+ var formattedDate;
1569
+ var year = date.year;
1570
+ var month = date.month;
1571
+ var day = date.day;
1572
+ formattedDate = day.toString().padStart(2, "0") + "-" + (month + 1)
1573
+ .toString()
1574
+ .padStart(2, "0") + "-" + year;
1575
+ return formattedDate;
1576
+ };
1577
+ var convertValueFromKwikUIFormatToBasicFormat = function (field, value) {
1568
1578
  var convertedValue = value;
1569
- switch (type) {
1579
+ switch (field.type) {
1570
1580
  case EFieldType.DATE:
1571
- var convertDateStringToTuiDayFormat = function (date) {
1572
- var splitDate = date.split("-");
1573
- var tuiDay = new cdk.TuiDay(Number(splitDate[2]), // Year
1574
- Number(splitDate[1]) - 1, // Month, Why '-1' => Because Taiga-UI Required It, So...
1575
- Number(splitDate[0]) // Day
1576
- );
1577
- return tuiDay;
1578
- };
1579
- convertedValue = convertDateStringToTuiDayFormat(value);
1581
+ convertedValue = convertTuiDayFormatToDateString(value);
1580
1582
  break;
1581
1583
  default:
1582
1584
  break;
@@ -1593,7 +1595,7 @@
1593
1595
  }
1594
1596
  break;
1595
1597
  case EFieldType.DATE:
1596
- convertedValue = formatDateToStandardFormat(value);
1598
+ convertedValue = convertDateStringToTuiDayFormat(value);
1597
1599
  break;
1598
1600
  case EFieldType.TITLE:
1599
1601
  break;
@@ -1824,7 +1826,7 @@
1824
1826
  return [4 /*yield*/, defaults.getDefaultValue()];
1825
1827
  case 3:
1826
1828
  value = _b.sent();
1827
- value = convertValueFromBasicFormatToKwikUIFormat(field.type, value);
1829
+ value = convertValueFromBasicFormatToKwikUIFormat(field, value);
1828
1830
  validators = new Validations$1(field, formData, previousFormData, allFormsData, takeAction).getFieldValidators(field);
1829
1831
  formGroup.addControl(field.key, new i6.FormControl({ value: value, disabled: field.disabled }, { validators: validators }));
1830
1832
  _b.label = 4;
@@ -2537,7 +2539,8 @@
2537
2539
  request: {
2538
2540
  mode: "POST",
2539
2541
  body: field.api.request.body.value,
2540
- headers: {}
2542
+ headers: {},
2543
+ url: field.api.request.url
2541
2544
  }
2542
2545
  });
2543
2546
  }
@@ -3457,14 +3460,6 @@
3457
3460
  return field;
3458
3461
  };
3459
3462
  var formatFieldTypeDate = function (field) {
3460
- var convertDateStringToTuiDayFormat = function (date) {
3461
- var splitDate = date.split("-");
3462
- var tuiDay = new cdk.TuiDay(Number(splitDate[2]), // Year
3463
- Number(splitDate[1]) - 1, // Month, Why '-1' => Because Taiga-UI Required It, So...
3464
- Number(splitDate[0]) // Day
3465
- );
3466
- return tuiDay;
3467
- };
3468
3463
  if (hasKey$2(field, "min")) {
3469
3464
  var tuiDay = convertDateStringToTuiDayFormat(field["min"]);
3470
3465
  field.properties = _this.setFieldKeyValue(field.properties, "min", tuiDay);