@luftborn/custom-elements 2.15.7 → 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/azure-pipeline.yml +2 -2
- package/demo/index.js +33 -18
- package/demo/index.min.js +32 -17
- package/demo/index.min.js.map +1 -1
- package/dist/custom-form.d.ts +2 -1
- package/dist/custom-form.js +8 -3
- package/dist/custom-form.js.map +1 -1
- package/dist/elements/CheckBoxElement/CheckBoxElement.js +5 -5
- package/dist/elements/CheckBoxElement/CheckBoxElement.js.map +1 -1
- package/dist/elements/RadioButtonGroup/RadioButtonGroupElement.js +3 -5
- package/dist/elements/RadioButtonGroup/RadioButtonGroupElement.js.map +1 -1
- package/dist/framework/CustomInputElement.d.ts +1 -0
- package/dist/framework/CustomInputElement.js +16 -4
- package/dist/framework/CustomInputElement.js.map +1 -1
- package/package.json +1 -1
- package/src/custom-form.ts +18 -12
- package/src/elements/CheckBoxElement/CheckBoxElement.ts +5 -5
- package/src/elements/RadioButtonGroup/RadioButtonGroupElement.ts +13 -14
- package/src/framework/CustomInputElement.ts +17 -4
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);
|
|
@@ -4059,12 +4064,12 @@ var CheckBoxElement = /** @class */ (function (_super) {
|
|
|
4059
4064
|
fieldset = document.createElement('fieldset');
|
|
4060
4065
|
wrapper.appendChild(fieldset);
|
|
4061
4066
|
}
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4067
|
+
var optionsAlreadyAdded = fieldset.querySelectorAll('input[type="checkbox"]').length;
|
|
4068
|
+
if (!optionsAlreadyAdded) {
|
|
4069
|
+
this.options.forEach(function (element, index) {
|
|
4065
4070
|
fieldset.insertAdjacentHTML('beforeend', StringUtil_1.StringUtil.StringFormat(_this.checkboxTemplate, _this.name, element, _this.name + "-" + index));
|
|
4066
|
-
}
|
|
4067
|
-
}
|
|
4071
|
+
});
|
|
4072
|
+
}
|
|
4068
4073
|
};
|
|
4069
4074
|
CheckBoxElement.prototype.addLegend = function () {
|
|
4070
4075
|
var fieldset = this.shadowRoot.querySelector('fieldset');
|
|
@@ -6279,12 +6284,10 @@ var RadioButtonGroupElement = /** @class */ (function (_super) {
|
|
|
6279
6284
|
fieldset = document.createElement('fieldset');
|
|
6280
6285
|
wrapper.appendChild(fieldset);
|
|
6281
6286
|
}
|
|
6282
|
-
|
|
6287
|
+
var optionsAlreadyAdded = fieldset.querySelectorAll('input[type="radio"]').length;
|
|
6288
|
+
if (!optionsAlreadyAdded) {
|
|
6283
6289
|
this.options.forEach(function (element, index) {
|
|
6284
|
-
|
|
6285
|
-
if (!existingRadio) {
|
|
6286
|
-
fieldset.insertAdjacentHTML('beforeend', StringUtil_1.StringUtil.StringFormat(_this.radioButtonTemplate, _this.name, element, _this.name + "-" + index, "" + (_this.required ? 'required' : '')));
|
|
6287
|
-
}
|
|
6290
|
+
fieldset.insertAdjacentHTML('beforeend', StringUtil_1.StringUtil.StringFormat(_this.radioButtonTemplate, _this.name, element, _this.name + "-" + index, "" + (_this.required ? 'required' : '')));
|
|
6288
6291
|
});
|
|
6289
6292
|
}
|
|
6290
6293
|
};
|
|
@@ -7159,6 +7162,7 @@ var CustomInputElement = /** @class */ (function (_super) {
|
|
|
7159
7162
|
_this.allDependenciesMustBeMet = false;
|
|
7160
7163
|
_this.multi = false;
|
|
7161
7164
|
_this.hideLabel = false;
|
|
7165
|
+
_this.designerMode = false;
|
|
7162
7166
|
_this.compareValues = [];
|
|
7163
7167
|
return _this;
|
|
7164
7168
|
}
|
|
@@ -7192,6 +7196,11 @@ var CustomInputElement = /** @class */ (function (_super) {
|
|
|
7192
7196
|
window.addEventListener("load", function () {
|
|
7193
7197
|
_this.bindDependencies();
|
|
7194
7198
|
});
|
|
7199
|
+
if (!this.designerMode) {
|
|
7200
|
+
window.addEventListener("preview-rendered", function () {
|
|
7201
|
+
_this.bindDependencies();
|
|
7202
|
+
});
|
|
7203
|
+
}
|
|
7195
7204
|
};
|
|
7196
7205
|
CustomInputElement.prototype.parseData = function () {
|
|
7197
7206
|
try {
|
|
@@ -7246,8 +7255,11 @@ var CustomInputElement = /** @class */ (function (_super) {
|
|
|
7246
7255
|
};
|
|
7247
7256
|
CustomInputElement.prototype.setAttributes = function () {
|
|
7248
7257
|
this.setAttribute("custom-input", "");
|
|
7249
|
-
this.setAttribute("name", this.name);
|
|
7250
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
|
+
}
|
|
7251
7263
|
};
|
|
7252
7264
|
CustomInputElement.prototype.bindDependencies = function () {
|
|
7253
7265
|
if (this.hasValueDependency && this.hasValueDependency.items.length) {
|
|
@@ -7391,9 +7403,12 @@ var CustomInputElement = /** @class */ (function (_super) {
|
|
|
7391
7403
|
newLabel.setAttribute('for', inputField.id);
|
|
7392
7404
|
newLabel.classList.add('field-label');
|
|
7393
7405
|
newLabel.textContent = this.label + ": ";
|
|
7394
|
-
var
|
|
7395
|
-
if (
|
|
7396
|
-
|
|
7406
|
+
var fieldLabelDiv = this.shadowRoot.querySelector('.field-label');
|
|
7407
|
+
if (fieldLabelDiv) {
|
|
7408
|
+
var existingLabel = fieldLabelDiv.querySelector('label.field-label');
|
|
7409
|
+
if (!existingLabel) {
|
|
7410
|
+
fieldLabelDiv.appendChild(newLabel);
|
|
7411
|
+
}
|
|
7397
7412
|
}
|
|
7398
7413
|
if (this.required) {
|
|
7399
7414
|
newLabel.innerHTML += '<span style="color: #e00040">*</span>';
|