@luftborn/custom-elements 2.5.8 → 2.6.1

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
@@ -3346,7 +3346,8 @@ var DropDownListElement = /** @class */ (function (_super) {
3346
3346
  __extends(DropDownListElement, _super);
3347
3347
  function DropDownListElement() {
3348
3348
  var _this = _super.call(this) || this;
3349
- _this.optionTemplate = "\n <option value='{0}'>\n {1}\n </option>";
3349
+ _this.optionTemplate = "\n\t\t<option value='{0}'>\n\t\t{1}\n\t\t</option>";
3350
+ _this.placeholderOptionTemplate = "\n\t\t<option selected disabled id=\"placeholder-option\">\n\t\t{0}\n\t\t</option>";
3350
3351
  return _this;
3351
3352
  }
3352
3353
  Object.defineProperty(DropDownListElement.prototype, "value", {
@@ -3361,7 +3362,8 @@ var DropDownListElement = /** @class */ (function (_super) {
3361
3362
  });
3362
3363
  Object.defineProperty(DropDownListElement.prototype, "valid", {
3363
3364
  get: function () {
3364
- return this.select.validity.valid;
3365
+ var placeholderOption = this.select.querySelector('#placeholder-option');
3366
+ return this.select.validity.valid && !(placeholderOption === null || placeholderOption === void 0 ? void 0 : placeholderOption.selected);
3365
3367
  },
3366
3368
  enumerable: false,
3367
3369
  configurable: true
@@ -3383,6 +3385,10 @@ var DropDownListElement = /** @class */ (function (_super) {
3383
3385
  DropDownListElement.prototype.addOptions = function () {
3384
3386
  var _this = this;
3385
3387
  this.select.innerHTML = "";
3388
+ if (this.placeholder) {
3389
+ this.select.insertAdjacentHTML('beforeend', StringUtil_1.StringUtil.StringFormat(this.placeholderOptionTemplate, this.placeholder));
3390
+ }
3391
+ ;
3386
3392
  this.options.forEach(function (element, index) {
3387
3393
  _this.select.insertAdjacentHTML('beforeend', StringUtil_1.StringUtil.StringFormat(_this.optionTemplate, element, element));
3388
3394
  });