@luftborn/custom-elements 2.15.8 → 2.16.0

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
@@ -3285,8 +3285,9 @@ var ArrayUtil_1 = require("./framework/Utilities/ArrayUtil");
3285
3285
  var MakeRequest_1 = require("./framework/Utilities/MakeRequest");
3286
3286
  var Elements_1 = require("./elements/Elements");
3287
3287
  var CustomForm = /** @class */ (function () {
3288
- function CustomForm(form) {
3288
+ function CustomForm(form, previewContainerSelector) {
3289
3289
  this.form = form;
3290
+ this.previewContainerSelector = previewContainerSelector;
3290
3291
  this.action = form.action || '';
3291
3292
  this.method = form.method || 'get';
3292
3293
  this.attachForm();
@@ -3381,8 +3382,12 @@ var CustomForm = /** @class */ (function () {
3381
3382
  dependentValues = [dependentValue];
3382
3383
  }
3383
3384
  var customElement = document.forms[0].querySelector("[name=\"" + dependentField + "\"]");
3385
+ if (_this.previewContainerSelector) {
3386
+ var previewContainer = document.querySelector(_this.previewContainerSelector);
3387
+ customElement = previewContainer === null || previewContainer === void 0 ? void 0 : previewContainer.querySelector("[name=\"" + dependentField + "\"]");
3388
+ }
3384
3389
  element.setAttribute("hidden", "");
3385
- customElement.onChange.on(function (event) {
3390
+ customElement === null || customElement === void 0 ? void 0 : customElement.onChange.on(function (event) {
3386
3391
  if (_this.groupShouldBeVisible(event.value, dependentValues)) {
3387
3392
  _this.showGroupAndItsDependencies(element);
3388
3393
  }
@@ -3390,7 +3395,7 @@ var CustomForm = /** @class */ (function () {
3390
3395
  _this.hideGroupAndItsDependencies(element);
3391
3396
  }
3392
3397
  });
3393
- customElement.onVisibilityChanged.on(function (event) {
3398
+ customElement === null || customElement === void 0 ? void 0 : customElement.onVisibilityChanged.on(function (event) {
3394
3399
  var elmentIsHidden = customElement.hasAttribute('hidden');
3395
3400
  if (_this.groupShouldBeVisible(customElement.value, dependentValues) && !elmentIsHidden) {
3396
3401
  _this.showGroupAndItsDependencies(element);
@@ -7157,6 +7162,7 @@ var CustomInputElement = /** @class */ (function (_super) {
7157
7162
  _this.allDependenciesMustBeMet = false;
7158
7163
  _this.multi = false;
7159
7164
  _this.hideLabel = false;
7165
+ _this.designerMode = false;
7160
7166
  _this.compareValues = [];
7161
7167
  return _this;
7162
7168
  }
@@ -7190,6 +7196,11 @@ var CustomInputElement = /** @class */ (function (_super) {
7190
7196
  window.addEventListener("load", function () {
7191
7197
  _this.bindDependencies();
7192
7198
  });
7199
+ if (!this.designerMode) {
7200
+ window.addEventListener("preview-rendered", function () {
7201
+ _this.bindDependencies();
7202
+ });
7203
+ }
7193
7204
  };
7194
7205
  CustomInputElement.prototype.parseData = function () {
7195
7206
  try {
@@ -7244,8 +7255,11 @@ var CustomInputElement = /** @class */ (function (_super) {
7244
7255
  };
7245
7256
  CustomInputElement.prototype.setAttributes = function () {
7246
7257
  this.setAttribute("custom-input", "");
7247
- this.setAttribute("name", this.name);
7248
7258
  this.hideLabel = this.hasAttribute('hide-label') || this.hasAttribute('hideLabel');
7259
+ this.designerMode = this.hasAttribute('designer-mode') || this.hasAttribute('designerMode');
7260
+ if (!this.designerMode) {
7261
+ this.setAttribute("name", this.name);
7262
+ }
7249
7263
  };
7250
7264
  CustomInputElement.prototype.bindDependencies = function () {
7251
7265
  if (this.hasValueDependency && this.hasValueDependency.items.length) {