jedison 1.13.0 → 1.14.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/CHANGELOG.md +4 -1
- package/dist/cjs/jedison.cjs +1 -1
- package/dist/cjs/jedison.cjs.map +1 -1
- package/dist/esm/jedison.js +63 -1
- package/dist/esm/jedison.js.map +1 -1
- package/dist/umd/jedison.umd.js +1 -1
- package/dist/umd/jedison.umd.js.map +1 -1
- package/package.json +3 -3
package/dist/esm/jedison.js
CHANGED
|
@@ -4644,6 +4644,59 @@ class EditorObjectHorizontal extends EditorObject {
|
|
|
4644
4644
|
});
|
|
4645
4645
|
}
|
|
4646
4646
|
}
|
|
4647
|
+
class EditorObjectRadios extends Editor {
|
|
4648
|
+
static resolves(schema) {
|
|
4649
|
+
const format2 = getSchemaXOption(schema, "format");
|
|
4650
|
+
return getSchemaType(schema) === "object" && (format2 === "radios" || format2 === "radios-inline") && isSet(getSchemaEnum(schema));
|
|
4651
|
+
}
|
|
4652
|
+
build() {
|
|
4653
|
+
const enumValues = getSchemaEnum(this.instance.schema);
|
|
4654
|
+
const enumTitles = getSchemaXOption(this.instance.schema, "enumTitles") || enumValues.map((v) => JSON.stringify(v));
|
|
4655
|
+
const inline = getSchemaXOption(this.instance.schema, "format") === "radios-inline";
|
|
4656
|
+
this.control = this.theme.getRadiosControl({
|
|
4657
|
+
title: this.getTitle(),
|
|
4658
|
+
description: this.getDescription(),
|
|
4659
|
+
values: enumTitles,
|
|
4660
|
+
titles: enumTitles,
|
|
4661
|
+
id: this.getIdFromPath(this.instance.path),
|
|
4662
|
+
titleHidden: getSchemaXOption(this.instance.schema, "titleHidden"),
|
|
4663
|
+
inline,
|
|
4664
|
+
info: this.getInfo()
|
|
4665
|
+
});
|
|
4666
|
+
this.control.radios.forEach((radio, index2) => {
|
|
4667
|
+
radio._enumValue = enumValues[index2];
|
|
4668
|
+
});
|
|
4669
|
+
}
|
|
4670
|
+
addEventListeners() {
|
|
4671
|
+
this.control.radios.forEach((radio) => {
|
|
4672
|
+
radio.addEventListener("change", () => {
|
|
4673
|
+
this.instance.setValue(radio._enumValue, true, "user");
|
|
4674
|
+
});
|
|
4675
|
+
});
|
|
4676
|
+
}
|
|
4677
|
+
refreshUI() {
|
|
4678
|
+
this.refreshDisabledState();
|
|
4679
|
+
const currentValue = this.instance.getValue();
|
|
4680
|
+
this.control.radios.forEach((radio) => {
|
|
4681
|
+
radio.checked = equal(radio._enumValue, currentValue);
|
|
4682
|
+
});
|
|
4683
|
+
}
|
|
4684
|
+
setAriaInvalid(invalid) {
|
|
4685
|
+
this.control.radios.forEach((radio) => {
|
|
4686
|
+
if (invalid) {
|
|
4687
|
+
radio.setAttribute("aria-invalid", "true");
|
|
4688
|
+
} else {
|
|
4689
|
+
radio.removeAttribute("aria-invalid");
|
|
4690
|
+
}
|
|
4691
|
+
});
|
|
4692
|
+
}
|
|
4693
|
+
adaptForTable() {
|
|
4694
|
+
this.theme.adaptForTableRadiosControl(this.control);
|
|
4695
|
+
}
|
|
4696
|
+
adaptForHorizontal(labelCol, inputCol) {
|
|
4697
|
+
this.theme.adaptForHorizontalRadiosControl(this.control, labelCol, inputCol);
|
|
4698
|
+
}
|
|
4699
|
+
}
|
|
4647
4700
|
class EditorArray extends Editor {
|
|
4648
4701
|
static resolves(schema) {
|
|
4649
4702
|
return getSchemaType(schema) === "array";
|
|
@@ -6597,6 +6650,7 @@ class UiResolver {
|
|
|
6597
6650
|
EditorObjectNav,
|
|
6598
6651
|
EditorObjectAccordion,
|
|
6599
6652
|
EditorObjectHorizontal,
|
|
6653
|
+
EditorObjectRadios,
|
|
6600
6654
|
EditorObject,
|
|
6601
6655
|
EditorArrayChoices,
|
|
6602
6656
|
EditorArrayCheckboxes,
|
|
@@ -7855,6 +7909,7 @@ class Theme {
|
|
|
7855
7909
|
config.propertiesContainer.close();
|
|
7856
7910
|
} else {
|
|
7857
7911
|
config.propertiesContainer.showModal();
|
|
7912
|
+
config.propertiesContainer.focus();
|
|
7858
7913
|
}
|
|
7859
7914
|
});
|
|
7860
7915
|
return toggle;
|
|
@@ -8033,6 +8088,11 @@ class Theme {
|
|
|
8033
8088
|
* Group for property activators
|
|
8034
8089
|
*/
|
|
8035
8090
|
getPropertiesGroup(config = {}) {
|
|
8091
|
+
if (config.accordion && config.name) {
|
|
8092
|
+
const id = "jedi-prop-group-" + config.name.toLowerCase().replace(/[^a-z0-9]+/g, "-");
|
|
8093
|
+
const item = this.getAccordionItem({ title: config.name, id });
|
|
8094
|
+
return { container: item.container, group: item.body, name: item.toggle };
|
|
8095
|
+
}
|
|
8036
8096
|
const container = document.createElement("div");
|
|
8037
8097
|
container.classList.add("jedi-properties-group-container");
|
|
8038
8098
|
const group = document.createElement("div");
|
|
@@ -8213,7 +8273,8 @@ class Theme {
|
|
|
8213
8273
|
dialog.classList.add("jedi-modal-dialog");
|
|
8214
8274
|
dialog.style.border = "1px solid #6c757d";
|
|
8215
8275
|
dialog.style.borderRadius = "4px";
|
|
8216
|
-
dialog.style.minWidth = "
|
|
8276
|
+
dialog.style.minWidth = "400px";
|
|
8277
|
+
dialog.style.maxWidth = "90vw";
|
|
8217
8278
|
return dialog;
|
|
8218
8279
|
}
|
|
8219
8280
|
/**
|
|
@@ -11166,6 +11227,7 @@ const index = {
|
|
|
11166
11227
|
EditorObjectNav,
|
|
11167
11228
|
EditorObjectAccordion,
|
|
11168
11229
|
EditorObjectHorizontal,
|
|
11230
|
+
EditorObjectRadios,
|
|
11169
11231
|
EditorObject,
|
|
11170
11232
|
EditorArrayChoices,
|
|
11171
11233
|
EditorArrayNav,
|