@luftborn/custom-elements 2.11.2 → 2.11.4
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.js +16 -2
- package/demo/index.min.js +15 -1
- package/demo/index.min.js.map +1 -1
- package/dist/custom-form.d.ts +1 -0
- package/dist/custom-form.js +13 -1
- package/dist/custom-form.js.map +1 -1
- package/dist/elements/CustomFormatDateFieldElement/CustomDatepicker/CustomDatepicker.js +2 -0
- package/dist/elements/CustomFormatDateFieldElement/CustomDatepicker/CustomDatepicker.js.map +1 -1
- package/package.json +1 -1
- package/src/custom-form.ts +14 -1
- package/src/elements/CustomFormatDateFieldElement/CustomDatepicker/CustomDatepicker.ts +2 -0
package/demo/index.min.js
CHANGED
|
@@ -2308,7 +2308,16 @@ var CustomForm = /** @class */ (function () {
|
|
|
2308
2308
|
var customElement = document.forms[0].querySelector("[name=\"" + dependentField + "\"]");
|
|
2309
2309
|
element.setAttribute("hidden", "");
|
|
2310
2310
|
customElement.onChange.on(function (event) {
|
|
2311
|
-
if (
|
|
2311
|
+
if (_this.groupShouldBeVisible(event.value, dependentValue)) {
|
|
2312
|
+
_this.showGroupAndItsDependencies(element);
|
|
2313
|
+
}
|
|
2314
|
+
else {
|
|
2315
|
+
_this.hideGroupAndItsDependencies(element);
|
|
2316
|
+
}
|
|
2317
|
+
});
|
|
2318
|
+
customElement.onVisibilityChanged.on(function (event) {
|
|
2319
|
+
var elmentIsHidden = customElement.hasAttribute('hidden');
|
|
2320
|
+
if (_this.groupShouldBeVisible(customElement.value, dependentValue) && !elmentIsHidden) {
|
|
2312
2321
|
_this.showGroupAndItsDependencies(element);
|
|
2313
2322
|
}
|
|
2314
2323
|
else {
|
|
@@ -2317,6 +2326,9 @@ var CustomForm = /** @class */ (function () {
|
|
|
2317
2326
|
});
|
|
2318
2327
|
});
|
|
2319
2328
|
};
|
|
2329
|
+
CustomForm.prototype.groupShouldBeVisible = function (eventValue, dependentValue) {
|
|
2330
|
+
return eventValue === dependentValue || (Array.isArray(eventValue) && eventValue.indexOf(dependentValue) >= 0);
|
|
2331
|
+
};
|
|
2320
2332
|
CustomForm.prototype.hideGroupAndItsDependencies = function (group) {
|
|
2321
2333
|
var _this = this;
|
|
2322
2334
|
var inputElementsInsideGroup = this.inputs.filter(function (input) { return _this.isDescendant(group, input); });
|
|
@@ -3155,6 +3167,8 @@ var CustomDatepicker = /** @class */ (function () {
|
|
|
3155
3167
|
if (moveMonthSteps !== 0) {
|
|
3156
3168
|
this.moveMonth(moveMonthSteps);
|
|
3157
3169
|
}
|
|
3170
|
+
var changeEvent = new Event('change');
|
|
3171
|
+
this.input.dispatchEvent(changeEvent);
|
|
3158
3172
|
};
|
|
3159
3173
|
CustomDatepicker.prototype.initSelectMonthYear = function () {
|
|
3160
3174
|
var _this = this;
|