jedison 1.20.1 → 1.20.2
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 -0
- package/dist/cjs/jedison.cjs +1 -1
- package/dist/cjs/jedison.cjs.map +1 -1
- package/dist/esm/jedison.js +24 -5
- 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 +1 -1
package/dist/esm/jedison.js
CHANGED
|
@@ -1721,6 +1721,10 @@ class Validator {
|
|
|
1721
1721
|
constructor(config = {}) {
|
|
1722
1722
|
this.refParser = config.refParser;
|
|
1723
1723
|
this.constraints = config.constraints ?? {};
|
|
1724
|
+
if (isArray(this.constraints)) {
|
|
1725
|
+
console.warn('Jedison: option "constraints" must be an object keyed by constraint name, not an array. Ignoring the value.');
|
|
1726
|
+
this.constraints = {};
|
|
1727
|
+
}
|
|
1724
1728
|
this.assertFormat = config.assertFormat ? config.assertFormat : false;
|
|
1725
1729
|
this.translator = config.translator ? config.translator : false;
|
|
1726
1730
|
this.subErrors = config.subErrors ?? false;
|
|
@@ -1906,6 +1910,10 @@ class Instance extends EventEmitter {
|
|
|
1906
1910
|
setUI() {
|
|
1907
1911
|
if (this.jedison.isEditor) {
|
|
1908
1912
|
const EditorClass = this.jedison.uiResolver.getClass(this.schema);
|
|
1913
|
+
if (!EditorClass) {
|
|
1914
|
+
console.error(`Jedison: no editor could be resolved for the schema at "${this.path}". The field will not be rendered.`, this.schema);
|
|
1915
|
+
return;
|
|
1916
|
+
}
|
|
1909
1917
|
this.ui = new EditorClass(this);
|
|
1910
1918
|
}
|
|
1911
1919
|
}
|
|
@@ -7117,13 +7125,21 @@ class UiResolver {
|
|
|
7117
7125
|
}
|
|
7118
7126
|
getClass(schema) {
|
|
7119
7127
|
for (const editor of this.customEditors) {
|
|
7120
|
-
|
|
7121
|
-
|
|
7128
|
+
try {
|
|
7129
|
+
if (editor.resolves(schema, this.refParser)) {
|
|
7130
|
+
return editor;
|
|
7131
|
+
}
|
|
7132
|
+
} catch (e) {
|
|
7133
|
+
console.error(`Editor "${editor.name || "custom editor"}" threw while resolving the schema and will be skipped.`, e);
|
|
7122
7134
|
}
|
|
7123
7135
|
}
|
|
7124
7136
|
for (const editor of this.editors) {
|
|
7125
|
-
|
|
7126
|
-
|
|
7137
|
+
try {
|
|
7138
|
+
if (editor.resolves(schema, this.refParser)) {
|
|
7139
|
+
return editor;
|
|
7140
|
+
}
|
|
7141
|
+
} catch (e) {
|
|
7142
|
+
console.error(`Editor "${editor.name || "built-in editor"}" threw while resolving the schema and will be skipped.`, e);
|
|
7127
7143
|
}
|
|
7128
7144
|
}
|
|
7129
7145
|
return null;
|
|
@@ -7409,6 +7425,7 @@ class JsonWalker {
|
|
|
7409
7425
|
}
|
|
7410
7426
|
}
|
|
7411
7427
|
}
|
|
7428
|
+
const version = "1.20.1";
|
|
7412
7429
|
class Jedison extends EventEmitter {
|
|
7413
7430
|
/**
|
|
7414
7431
|
* Creates a Jedison instance.
|
|
@@ -7449,7 +7466,7 @@ class Jedison extends EventEmitter {
|
|
|
7449
7466
|
data: void 0,
|
|
7450
7467
|
assertFormat: false,
|
|
7451
7468
|
customEditors: [],
|
|
7452
|
-
constraints:
|
|
7469
|
+
constraints: {},
|
|
7453
7470
|
hiddenInputAttributes: {},
|
|
7454
7471
|
id: "",
|
|
7455
7472
|
radiosInline: false,
|
|
@@ -7928,6 +7945,7 @@ class Jedison extends EventEmitter {
|
|
|
7928
7945
|
});
|
|
7929
7946
|
}
|
|
7930
7947
|
}
|
|
7948
|
+
Jedison.version = version;
|
|
7931
7949
|
class RefParser {
|
|
7932
7950
|
constructor(options = {}) {
|
|
7933
7951
|
this.options = Object.assign({
|
|
@@ -12145,6 +12163,7 @@ const index = {
|
|
|
12145
12163
|
ThemeBootstrap5,
|
|
12146
12164
|
RefParser,
|
|
12147
12165
|
Create: Jedison,
|
|
12166
|
+
version,
|
|
12148
12167
|
SchemaGenerator,
|
|
12149
12168
|
applyOverlay
|
|
12150
12169
|
};
|