jedison 1.20.2 → 1.21.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 +6 -0
- package/dist/cjs/jedison.cjs +1 -1
- package/dist/cjs/jedison.cjs.map +1 -1
- package/dist/esm/jedison.js +40 -3
- 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 -1
package/dist/esm/jedison.js
CHANGED
|
@@ -350,6 +350,9 @@ function getSchemaContains(schema) {
|
|
|
350
350
|
function getSchemaDefault(schema) {
|
|
351
351
|
return clone(schema.default);
|
|
352
352
|
}
|
|
353
|
+
function getSchemaDeprecated(schema) {
|
|
354
|
+
return isBoolean(schema.deprecated) ? clone(schema.deprecated) : void 0;
|
|
355
|
+
}
|
|
353
356
|
function getSchemaDependentRequired(schema) {
|
|
354
357
|
return isObject$1(schema.dependentRequired) ? clone(schema.dependentRequired) : void 0;
|
|
355
358
|
}
|
|
@@ -2167,6 +2170,15 @@ class Instance extends EventEmitter {
|
|
|
2167
2170
|
}
|
|
2168
2171
|
return this.parent ? this.parent.isReadOnly() : false;
|
|
2169
2172
|
}
|
|
2173
|
+
/**
|
|
2174
|
+
* Returns true if this instance's own schema is marked deprecated.
|
|
2175
|
+
* Unlike isReadOnly(), this does not cascade to/from the parent: per the
|
|
2176
|
+
* JSON Schema spec, "deprecated" applies only to the exact instance
|
|
2177
|
+
* location it's declared on.
|
|
2178
|
+
*/
|
|
2179
|
+
isDeprecated() {
|
|
2180
|
+
return getSchemaDeprecated(this.schema) === true;
|
|
2181
|
+
}
|
|
2170
2182
|
/**
|
|
2171
2183
|
* Destroy the instance and it's children
|
|
2172
2184
|
*/
|
|
@@ -2194,6 +2206,7 @@ class Editor {
|
|
|
2194
2206
|
this.control = null;
|
|
2195
2207
|
this.disabled = false;
|
|
2196
2208
|
this.readOnly = this.instance.isReadOnly();
|
|
2209
|
+
this.deprecated = this.instance.isDeprecated();
|
|
2197
2210
|
this.showingValidationErrors = false;
|
|
2198
2211
|
this.markdownEnabled = false;
|
|
2199
2212
|
this.purifyEnabled = false;
|
|
@@ -2204,6 +2217,7 @@ class Editor {
|
|
|
2204
2217
|
this.build();
|
|
2205
2218
|
this.setAttributes();
|
|
2206
2219
|
this.setReadOnlyAttribute();
|
|
2220
|
+
this.setDeprecatedAttribute();
|
|
2207
2221
|
this.addEventListeners();
|
|
2208
2222
|
this.setVisibility();
|
|
2209
2223
|
this.setContainerAttributes();
|
|
@@ -2221,6 +2235,15 @@ class Editor {
|
|
|
2221
2235
|
}
|
|
2222
2236
|
static resolves(schema) {
|
|
2223
2237
|
}
|
|
2238
|
+
/**
|
|
2239
|
+
* Resolution priority used by UiResolver to order candidate editors before
|
|
2240
|
+
* scanning them with resolves(). Higher values are tried first. Editors
|
|
2241
|
+
* that don't override this share the default and keep their relative
|
|
2242
|
+
* declaration order (stable sort).
|
|
2243
|
+
*/
|
|
2244
|
+
static priority() {
|
|
2245
|
+
return 0;
|
|
2246
|
+
}
|
|
2224
2247
|
/**
|
|
2225
2248
|
* Whether this editor already renders a heading for each of its children
|
|
2226
2249
|
* (e.g. an accordion toggle or a nav tab label), so a child editor can
|
|
@@ -2361,6 +2384,17 @@ class Editor {
|
|
|
2361
2384
|
});
|
|
2362
2385
|
}
|
|
2363
2386
|
}
|
|
2387
|
+
/**
|
|
2388
|
+
* Marks the control container so integrators can target deprecated fields
|
|
2389
|
+
* via CSS/JS and decide what to do with them (badge, hide, warn, etc.).
|
|
2390
|
+
* Theme-agnostic: operates on the built DOM rather than the theme's
|
|
2391
|
+
* control-building methods, so it applies uniformly across all themes.
|
|
2392
|
+
*/
|
|
2393
|
+
setDeprecatedAttribute() {
|
|
2394
|
+
if (this.deprecated) {
|
|
2395
|
+
this.control.container.classList.add("jedi-deprecated");
|
|
2396
|
+
}
|
|
2397
|
+
}
|
|
2364
2398
|
getIdFromPath(path) {
|
|
2365
2399
|
const optionId = this.instance.jedison.getOption("id");
|
|
2366
2400
|
return optionId ? optionId + "-" + pathToAttribute(path) : pathToAttribute(path);
|
|
@@ -7072,9 +7106,12 @@ class EditorStringFilepond extends EditorString {
|
|
|
7072
7106
|
super.destroy();
|
|
7073
7107
|
}
|
|
7074
7108
|
}
|
|
7109
|
+
function byPriorityDescending(a, b) {
|
|
7110
|
+
return b.priority() - a.priority();
|
|
7111
|
+
}
|
|
7075
7112
|
class UiResolver {
|
|
7076
7113
|
constructor(options) {
|
|
7077
|
-
this.customEditors = options.customEditors ?? [];
|
|
7114
|
+
this.customEditors = [...options.customEditors ?? []].sort(byPriorityDescending);
|
|
7078
7115
|
this.refParser = options.refParser ?? null;
|
|
7079
7116
|
this.editors = [
|
|
7080
7117
|
EditorNumberInputNullable,
|
|
@@ -7121,7 +7158,7 @@ class UiResolver {
|
|
|
7121
7158
|
EditorArrayNav,
|
|
7122
7159
|
EditorArray,
|
|
7123
7160
|
EditorNull
|
|
7124
|
-
];
|
|
7161
|
+
].sort(byPriorityDescending);
|
|
7125
7162
|
}
|
|
7126
7163
|
getClass(schema) {
|
|
7127
7164
|
for (const editor of this.customEditors) {
|
|
@@ -7425,7 +7462,7 @@ class JsonWalker {
|
|
|
7425
7462
|
}
|
|
7426
7463
|
}
|
|
7427
7464
|
}
|
|
7428
|
-
const version = "1.
|
|
7465
|
+
const version = "1.21.0";
|
|
7429
7466
|
class Jedison extends EventEmitter {
|
|
7430
7467
|
/**
|
|
7431
7468
|
* Creates a Jedison instance.
|