@luftborn/custom-elements 2.11.1 → 2.11.3

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.
package/demo/index.min.js CHANGED
@@ -3155,6 +3155,8 @@ var CustomDatepicker = /** @class */ (function () {
3155
3155
  if (moveMonthSteps !== 0) {
3156
3156
  this.moveMonth(moveMonthSteps);
3157
3157
  }
3158
+ var changeEvent = new Event('change');
3159
+ this.input.dispatchEvent(changeEvent);
3158
3160
  };
3159
3161
  CustomDatepicker.prototype.initSelectMonthYear = function () {
3160
3162
  var _this = this;
@@ -3375,7 +3377,7 @@ exports.CustomDatepickerStyles = "\n .custom-datepicker {\n position:
3375
3377
  },{}],17:[function(require,module,exports){
3376
3378
  "use strict";
3377
3379
  Object.defineProperty(exports, "__esModule", { value: true });
3378
- exports.convertStringToDate = exports.isMobileDevice = exports.formatDate = exports.supportedDateFormats = exports.defaultDateFormat = exports.daysOfWeek = exports.months = void 0;
3380
+ exports.validateDateString = exports.convertStringToDate = exports.isMobileDevice = exports.formatDate = exports.supportedDateFormats = exports.defaultDateFormat = exports.daysOfWeek = exports.months = void 0;
3379
3381
  var DatepickerTranslations_1 = require("./DatepickerTranslations");
3380
3382
  exports.months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
3381
3383
  exports.daysOfWeek = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'];
@@ -3484,8 +3486,12 @@ function convertStringToDate(dateString, dateFormat, language) {
3484
3486
  }
3485
3487
  }
3486
3488
  exports.convertStringToDate = convertStringToDate;
3487
- function validateDateString(dateString, dateFormat, language) {
3489
+ function validateDateString(dateString, dateFormat, language, allowEmpty) {
3488
3490
  if (language === void 0) { language = 'en'; }
3491
+ if (allowEmpty === void 0) { allowEmpty = true; }
3492
+ if (allowEmpty && !dateString) {
3493
+ return true;
3494
+ }
3489
3495
  var dateFormatsRegex = exports.supportedDateFormats.reduce(function (acc, format) {
3490
3496
  acc[format] = new RegExp("^" + format.replace('yyyy', '\\d{4}')
3491
3497
  .replace('yy', '\\d{2}')
@@ -3496,6 +3502,7 @@ function validateDateString(dateString, dateFormat, language) {
3496
3502
  }, {});
3497
3503
  return dateFormatsRegex[dateFormat].test(dateString);
3498
3504
  }
3505
+ exports.validateDateString = validateDateString;
3499
3506
 
3500
3507
  },{"./DatepickerTranslations":18}],18:[function(require,module,exports){
3501
3508
  "use strict";
@@ -3842,7 +3849,7 @@ var CustomFormatDateFieldElement = /** @class */ (function (_super) {
3842
3849
  });
3843
3850
  Object.defineProperty(CustomFormatDateFieldElement.prototype, "valid", {
3844
3851
  get: function () {
3845
- return this.date.validity.valid;
3852
+ return (0, CustomDatepickerUtils_1.validateDateString)(this.value, this.dateFormat, this.language, !this.required);
3846
3853
  },
3847
3854
  enumerable: false,
3848
3855
  configurable: true