jedison 1.22.0 → 1.22.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 +9 -0
- package/dist/cjs/jedison.cjs +1 -1
- package/dist/cjs/jedison.cjs.map +1 -1
- package/dist/esm/jedison.js +42 -8
- 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
|
@@ -2213,6 +2213,7 @@ class Editor {
|
|
|
2213
2213
|
this.title = null;
|
|
2214
2214
|
this.description = null;
|
|
2215
2215
|
this.storedEventListeners = [];
|
|
2216
|
+
this.schemaButtonListeners = [];
|
|
2216
2217
|
this.init();
|
|
2217
2218
|
this.build();
|
|
2218
2219
|
this.setAttributes();
|
|
@@ -2314,8 +2315,9 @@ class Editor {
|
|
|
2314
2315
|
* `jedison.on('jedison:<name>', ({ jedison, editor, path }) => ...)`. The
|
|
2315
2316
|
* listener map is private to the instance, so the payload is not exposed to
|
|
2316
2317
|
* unrelated scripts on the page (F3 contained).
|
|
2317
|
-
* - Click listeners are registered through
|
|
2318
|
-
* cleans them up
|
|
2318
|
+
* - Click listeners are registered through schemaButtonListeners so
|
|
2319
|
+
* destroy() cleans them up, without being cleared by an editor's
|
|
2320
|
+
* refreshUI() in the meantime (issue #79).
|
|
2319
2321
|
*/
|
|
2320
2322
|
appendSchemaButtons() {
|
|
2321
2323
|
const buttons = getSchemaXOption(this.instance.schema, "buttons");
|
|
@@ -2345,7 +2347,7 @@ class Editor {
|
|
|
2345
2347
|
});
|
|
2346
2348
|
};
|
|
2347
2349
|
button.addEventListener("click", handler);
|
|
2348
|
-
this.
|
|
2350
|
+
this.schemaButtonListeners.push({
|
|
2349
2351
|
element: button,
|
|
2350
2352
|
eventType: "click",
|
|
2351
2353
|
handler
|
|
@@ -2426,6 +2428,22 @@ class Editor {
|
|
|
2426
2428
|
}
|
|
2427
2429
|
this.storedEventListeners = [];
|
|
2428
2430
|
}
|
|
2431
|
+
/**
|
|
2432
|
+
* Clears the click listeners registered by appendSchemaButtons(). Separate
|
|
2433
|
+
* from clearStoredEventListeners() so editors that clear the latter on
|
|
2434
|
+
* every refreshUI() (e.g. EditorArrayNav) don't also detach the schema
|
|
2435
|
+
* buttons, which are only ever appended once and never rebuilt (issue #79).
|
|
2436
|
+
*/
|
|
2437
|
+
clearSchemaButtonListeners() {
|
|
2438
|
+
if (this.schemaButtonListeners) {
|
|
2439
|
+
this.schemaButtonListeners.forEach((listener) => {
|
|
2440
|
+
if (listener.element && listener.handler) {
|
|
2441
|
+
listener.element.removeEventListener(listener.eventType || "click", listener.handler);
|
|
2442
|
+
}
|
|
2443
|
+
});
|
|
2444
|
+
}
|
|
2445
|
+
this.schemaButtonListeners = [];
|
|
2446
|
+
}
|
|
2429
2447
|
/**
|
|
2430
2448
|
* Shows validation error messages in the editor container.
|
|
2431
2449
|
*/
|
|
@@ -2671,6 +2689,7 @@ class Editor {
|
|
|
2671
2689
|
*/
|
|
2672
2690
|
destroy() {
|
|
2673
2691
|
this.clearStoredEventListeners();
|
|
2692
|
+
this.clearSchemaButtonListeners();
|
|
2674
2693
|
if (this.control.container && this.control.container.parentNode) {
|
|
2675
2694
|
this.control.container.parentNode.removeChild(this.control.container);
|
|
2676
2695
|
}
|
|
@@ -2903,6 +2922,15 @@ class InstanceIfThenElse extends Instance {
|
|
|
2903
2922
|
}
|
|
2904
2923
|
}
|
|
2905
2924
|
class InstanceMultiple extends Instance {
|
|
2925
|
+
// A Multiple's real value always comes from resolving the active branch
|
|
2926
|
+
// (see switchInstance()) - never from its own wrapper schema. The base
|
|
2927
|
+
// class's type-based placeholder (e.g. {} when the wrapper also declares
|
|
2928
|
+
// "type": "object" alongside oneOf, a common x-discriminator pattern) is
|
|
2929
|
+
// not real data, but prepare()/switchInstance() below can't tell it apart
|
|
2930
|
+
// from one - propagating it stomps the freshly built branch's own
|
|
2931
|
+
// x-defaultProperties-activated children right after creation.
|
|
2932
|
+
setInitialValue() {
|
|
2933
|
+
}
|
|
2906
2934
|
prepare() {
|
|
2907
2935
|
this.instances = [];
|
|
2908
2936
|
this.activeInstance = null;
|
|
@@ -3477,6 +3505,7 @@ const glyphicons = {
|
|
|
3477
3505
|
properties: "glyphicon glyphicon-list",
|
|
3478
3506
|
delete: "glyphicon glyphicon-trash",
|
|
3479
3507
|
add: "glyphicon glyphicon-plus",
|
|
3508
|
+
addProperty: "glyphicon glyphicon-plus-sign",
|
|
3480
3509
|
moveUp: "glyphicon glyphicon-arrow-up",
|
|
3481
3510
|
moveDown: "glyphicon glyphicon-arrow-down",
|
|
3482
3511
|
collapse: "glyphicon glyphicon-chevron-down",
|
|
@@ -3494,6 +3523,7 @@ const bootstrapIcons = {
|
|
|
3494
3523
|
properties: "bi bi-card-list",
|
|
3495
3524
|
delete: "bi bi-trash2",
|
|
3496
3525
|
add: "bi bi-plus",
|
|
3526
|
+
addProperty: "bi bi-plus-circle",
|
|
3497
3527
|
moveUp: "bi bi-arrow-up",
|
|
3498
3528
|
moveDown: "bi bi-arrow-down",
|
|
3499
3529
|
collapse: "bi bi-chevron-down",
|
|
@@ -3510,6 +3540,7 @@ const fontAwesome3 = {
|
|
|
3510
3540
|
properties: "icon-list",
|
|
3511
3541
|
delete: "icon-trash",
|
|
3512
3542
|
add: "icon-plus",
|
|
3543
|
+
addProperty: "icon-plus-sign",
|
|
3513
3544
|
moveUp: "icon-arrow-up",
|
|
3514
3545
|
moveDown: "icon-arrow-down",
|
|
3515
3546
|
collapse: "icon-chevron-down",
|
|
@@ -3526,6 +3557,7 @@ const fontAwesome4 = {
|
|
|
3526
3557
|
properties: "fa fa-list",
|
|
3527
3558
|
delete: "fa fa-trash-o",
|
|
3528
3559
|
add: "fa fa-plus",
|
|
3560
|
+
addProperty: "fa fa-plus-circle",
|
|
3529
3561
|
moveUp: "fa fa-arrow-up",
|
|
3530
3562
|
moveDown: "fa fa-arrow-down",
|
|
3531
3563
|
collapse: "fa fa-chevron-down",
|
|
@@ -3542,6 +3574,7 @@ const fontAwesome5 = {
|
|
|
3542
3574
|
properties: "fas fa-list",
|
|
3543
3575
|
delete: "fas fa-trash",
|
|
3544
3576
|
add: "fas fa-plus",
|
|
3577
|
+
addProperty: "fas fa-plus-circle",
|
|
3545
3578
|
moveUp: "fas fa-arrow-up",
|
|
3546
3579
|
moveDown: "fas fa-arrow-down",
|
|
3547
3580
|
collapse: "fas fa-chevron-down",
|
|
@@ -3558,6 +3591,7 @@ const fontAwesome6 = {
|
|
|
3558
3591
|
properties: "fa-solid fa-list",
|
|
3559
3592
|
delete: "fa-solid fa-trash",
|
|
3560
3593
|
add: "fa-solid fa-plus",
|
|
3594
|
+
addProperty: "fa-solid fa-circle-plus",
|
|
3561
3595
|
moveUp: "fa-solid fa-arrow-up",
|
|
3562
3596
|
moveDown: "fa-solid fa-arrow-down",
|
|
3563
3597
|
collapse: "fa-solid fa-chevron-down",
|
|
@@ -7473,7 +7507,7 @@ class JsonWalker {
|
|
|
7473
7507
|
}
|
|
7474
7508
|
}
|
|
7475
7509
|
}
|
|
7476
|
-
const version = "1.22.
|
|
7510
|
+
const version = "1.22.2";
|
|
7477
7511
|
class Jedison extends EventEmitter {
|
|
7478
7512
|
/**
|
|
7479
7513
|
* Creates a Jedison instance.
|
|
@@ -9018,11 +9052,11 @@ class Theme {
|
|
|
9018
9052
|
});
|
|
9019
9053
|
const quickAddPropertyBtn = this.getAddPropertyButton({
|
|
9020
9054
|
content: config.addPropertyContent,
|
|
9021
|
-
icon: "
|
|
9055
|
+
icon: "addProperty"
|
|
9022
9056
|
});
|
|
9023
9057
|
const quickAddPropertyToggle = this.getQuickAddPropertyToggle({
|
|
9024
9058
|
content: config.addPropertyContent,
|
|
9025
|
-
icon: "
|
|
9059
|
+
icon: "addProperty",
|
|
9026
9060
|
propertiesContainer: quickAddPropertyContainer
|
|
9027
9061
|
});
|
|
9028
9062
|
const fieldset = this.getFieldset();
|
|
@@ -9135,10 +9169,10 @@ class Theme {
|
|
|
9135
9169
|
id: "jedi-quick-add-property-input-" + config.id,
|
|
9136
9170
|
title: config.addPropertyContent
|
|
9137
9171
|
});
|
|
9138
|
-
const quickAddPropertyBtn = this.getAddPropertyButton({ content: config.addPropertyContent, icon: "
|
|
9172
|
+
const quickAddPropertyBtn = this.getAddPropertyButton({ content: config.addPropertyContent, icon: "addProperty" });
|
|
9139
9173
|
const quickAddPropertyToggle = this.getQuickAddPropertyToggle({
|
|
9140
9174
|
content: config.addPropertyContent,
|
|
9141
|
-
icon: "
|
|
9175
|
+
icon: "addProperty",
|
|
9142
9176
|
propertiesContainer: quickAddPropertyContainer
|
|
9143
9177
|
});
|
|
9144
9178
|
const collapse = document.createElement("div");
|