@luftborn/custom-elements 2.11.4 → 2.12.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
@@ -2305,10 +2305,17 @@ var CustomForm = /** @class */ (function () {
2305
2305
  groupContainers.forEach(function (element) {
2306
2306
  var dependentField = element.getAttribute('data-depends-on');
2307
2307
  var dependentValue = element.getAttribute('data-dependent-value');
2308
+ var dependentValues;
2309
+ try {
2310
+ dependentValues = JSON.parse(dependentValue);
2311
+ }
2312
+ catch (e) {
2313
+ dependentValues = [dependentValue];
2314
+ }
2308
2315
  var customElement = document.forms[0].querySelector("[name=\"" + dependentField + "\"]");
2309
2316
  element.setAttribute("hidden", "");
2310
2317
  customElement.onChange.on(function (event) {
2311
- if (_this.groupShouldBeVisible(event.value, dependentValue)) {
2318
+ if (_this.groupShouldBeVisible(event.value, dependentValues)) {
2312
2319
  _this.showGroupAndItsDependencies(element);
2313
2320
  }
2314
2321
  else {
@@ -2317,7 +2324,7 @@ var CustomForm = /** @class */ (function () {
2317
2324
  });
2318
2325
  customElement.onVisibilityChanged.on(function (event) {
2319
2326
  var elmentIsHidden = customElement.hasAttribute('hidden');
2320
- if (_this.groupShouldBeVisible(customElement.value, dependentValue) && !elmentIsHidden) {
2327
+ if (_this.groupShouldBeVisible(customElement.value, dependentValues) && !elmentIsHidden) {
2321
2328
  _this.showGroupAndItsDependencies(element);
2322
2329
  }
2323
2330
  else {
@@ -2327,7 +2334,7 @@ var CustomForm = /** @class */ (function () {
2327
2334
  });
2328
2335
  };
2329
2336
  CustomForm.prototype.groupShouldBeVisible = function (eventValue, dependentValue) {
2330
- return eventValue === dependentValue || (Array.isArray(eventValue) && eventValue.indexOf(dependentValue) >= 0);
2337
+ return dependentValue.some(function (value) { return eventValue === value || (Array.isArray(eventValue) && eventValue.indexOf(value) >= 0); });
2331
2338
  };
2332
2339
  CustomForm.prototype.hideGroupAndItsDependencies = function (group) {
2333
2340
  var _this = this;