jedison 0.3.15 → 0.3.17
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 +9 -0
- package/dist/cjs/jedison.cjs +1 -1
- package/dist/cjs/jedison.cjs.map +1 -1
- package/dist/esm/jedison.js +28 -12
- 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 +7 -6
package/dist/esm/jedison.js
CHANGED
|
@@ -893,16 +893,15 @@ function properties(context) {
|
|
|
893
893
|
Object.keys(schemaProperties).forEach((propertyName) => {
|
|
894
894
|
if (hasOwn(context.value, propertyName)) {
|
|
895
895
|
const propertySchema = schemaProperties[propertyName];
|
|
896
|
-
const
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
if (
|
|
896
|
+
const propertyErrors = context.validator.getErrors(
|
|
897
|
+
context.value[propertyName],
|
|
898
|
+
propertySchema,
|
|
899
|
+
propertyName,
|
|
900
|
+
context.path + "/" + propertyName
|
|
901
|
+
);
|
|
902
|
+
if (propertyErrors.length > 0) {
|
|
903
903
|
invalidProperties.push(propertyName);
|
|
904
904
|
}
|
|
905
|
-
editor.destroy();
|
|
906
905
|
}
|
|
907
906
|
});
|
|
908
907
|
}
|
|
@@ -3819,8 +3818,20 @@ class EditorArray extends Editor {
|
|
|
3819
3818
|
});
|
|
3820
3819
|
}
|
|
3821
3820
|
}
|
|
3822
|
-
|
|
3821
|
+
refreshAddBtn() {
|
|
3823
3822
|
const maxItems2 = getSchemaMaxItems(this.instance.schema);
|
|
3823
|
+
const enforceMaxItems = getSchemaXOption(this.instance.schema, "enforceMaxItems") ?? this.instance.jedison.options.enforceMaxItems;
|
|
3824
|
+
if (isSet(maxItems2) && enforceMaxItems && maxItems2 <= this.instance.value.length) {
|
|
3825
|
+
this.control.addBtn.setAttribute("disabled", "");
|
|
3826
|
+
this.control.addBtn.setAttribute("always-disabled", true);
|
|
3827
|
+
} else {
|
|
3828
|
+
if (!this.disabled && !this.readOnly) {
|
|
3829
|
+
this.control.addBtn.removeAttribute("disabled");
|
|
3830
|
+
this.control.addBtn.removeAttribute("always-disabled");
|
|
3831
|
+
}
|
|
3832
|
+
}
|
|
3833
|
+
}
|
|
3834
|
+
refreshUI() {
|
|
3824
3835
|
const minItems2 = getSchemaMinItems(this.instance.schema);
|
|
3825
3836
|
const arrayDelete = getSchemaXOption(this.instance.schema, "arrayDelete") ?? this.instance.jedison.options.arrayDelete;
|
|
3826
3837
|
const arrayMove = getSchemaXOption(this.instance.schema, "arrayMove") ?? this.instance.jedison.options.arrayMove;
|
|
@@ -3858,9 +3869,7 @@ class EditorArray extends Editor {
|
|
|
3858
3869
|
this.instance.children.forEach((child) => {
|
|
3859
3870
|
child.ui.refreshUI();
|
|
3860
3871
|
});
|
|
3861
|
-
|
|
3862
|
-
this.control.addBtn.setAttribute("disabled", "");
|
|
3863
|
-
}
|
|
3872
|
+
this.refreshAddBtn();
|
|
3864
3873
|
}
|
|
3865
3874
|
}
|
|
3866
3875
|
class EditorArrayTable extends EditorArray {
|
|
@@ -3932,6 +3941,7 @@ class EditorArrayTable extends EditorArray {
|
|
|
3932
3941
|
table.tbody.appendChild(tbodyRow);
|
|
3933
3942
|
});
|
|
3934
3943
|
this.refreshSortable(table.tbody);
|
|
3944
|
+
this.refreshAddBtn();
|
|
3935
3945
|
this.refreshDisabledState();
|
|
3936
3946
|
this.refreshScrollPosition(table.container);
|
|
3937
3947
|
table.container.addEventListener("scroll", () => {
|
|
@@ -3996,6 +4006,9 @@ class EditorArrayTableObject extends EditorArray {
|
|
|
3996
4006
|
});
|
|
3997
4007
|
th.appendChild(label);
|
|
3998
4008
|
table.thead.appendChild(th);
|
|
4009
|
+
if (this.instance.getValue().length === 0) {
|
|
4010
|
+
table.table.removeChild(table.thead);
|
|
4011
|
+
}
|
|
3999
4012
|
let schemaItems = getSchemaItems(this.instance.schema);
|
|
4000
4013
|
if (this.instance.jedison.refParser) {
|
|
4001
4014
|
schemaItems = this.instance.jedison.refParser.expand(schemaItems);
|
|
@@ -4054,6 +4067,7 @@ class EditorArrayTableObject extends EditorArray {
|
|
|
4054
4067
|
table.tbody.appendChild(tbodyRow);
|
|
4055
4068
|
});
|
|
4056
4069
|
this.refreshSortable(table.tbody);
|
|
4070
|
+
this.refreshAddBtn();
|
|
4057
4071
|
this.refreshDisabledState();
|
|
4058
4072
|
this.refreshScrollPosition(table.container);
|
|
4059
4073
|
table.container.addEventListener("scroll", () => {
|
|
@@ -4248,6 +4262,7 @@ class EditorArrayNav extends EditorArray {
|
|
|
4248
4262
|
moveDownBtn.setAttribute("disabled", "");
|
|
4249
4263
|
}
|
|
4250
4264
|
});
|
|
4265
|
+
this.refreshAddBtn();
|
|
4251
4266
|
}
|
|
4252
4267
|
}
|
|
4253
4268
|
class EditorMultiple extends Editor {
|
|
@@ -5133,6 +5148,7 @@ class Jedison extends EventEmitter {
|
|
|
5133
5148
|
// todo: deprecated
|
|
5134
5149
|
enforceAdditionalProperties: true,
|
|
5135
5150
|
enforceMinItems: true,
|
|
5151
|
+
enforceMaxItems: true,
|
|
5136
5152
|
enforceEnum: true,
|
|
5137
5153
|
debug: false
|
|
5138
5154
|
}, options);
|