jedison 1.6.0 → 1.7.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 +7 -0
- package/dist/cjs/jedison.cjs +1 -1
- package/dist/cjs/jedison.cjs.map +1 -1
- package/dist/esm/jedison.js +154 -25
- 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 -2
package/dist/esm/jedison.js
CHANGED
|
@@ -2427,6 +2427,24 @@ class Editor {
|
|
|
2427
2427
|
this.control.jsonData.input.value = JSON.stringify(this.instance.getValue(), null, 2);
|
|
2428
2428
|
}
|
|
2429
2429
|
}
|
|
2430
|
+
getNextChildPath(path) {
|
|
2431
|
+
const currentDepth = this.instance.path.split(this.instance.jedison.pathSeparator).length;
|
|
2432
|
+
const targetSegments = path.split(this.instance.jedison.pathSeparator);
|
|
2433
|
+
if (targetSegments.length <= currentDepth) return null;
|
|
2434
|
+
return targetSegments.slice(0, currentDepth + 1).join(this.instance.jedison.pathSeparator);
|
|
2435
|
+
}
|
|
2436
|
+
navigateTo(path) {
|
|
2437
|
+
if (path === this.instance.path) {
|
|
2438
|
+
this.control.container.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
2439
|
+
return;
|
|
2440
|
+
}
|
|
2441
|
+
const nextChildPath = this.getNextChildPath(path);
|
|
2442
|
+
if (!nextChildPath) return;
|
|
2443
|
+
const child = this.instance.children.find((c) => c.path === nextChildPath);
|
|
2444
|
+
if (child == null ? void 0 : child.ui) {
|
|
2445
|
+
child.ui.navigateTo(path);
|
|
2446
|
+
}
|
|
2447
|
+
}
|
|
2430
2448
|
/**
|
|
2431
2449
|
* Destroys the editor
|
|
2432
2450
|
*/
|
|
@@ -2538,19 +2556,23 @@ class InstanceIfThenElse extends Instance {
|
|
|
2538
2556
|
});
|
|
2539
2557
|
}
|
|
2540
2558
|
const startingValue = this.instanceStartingValues[index2];
|
|
2541
|
-
const currentValue = instance.getValue();
|
|
2542
2559
|
let instanceValue = value;
|
|
2543
2560
|
if (isObject(startingValue) && isObject(value)) {
|
|
2544
|
-
if (indexChanged) {
|
|
2561
|
+
if (indexChanged && initiator !== "api") {
|
|
2545
2562
|
instanceValue = overwriteExistingProperties(startingValue, withoutIf);
|
|
2546
|
-
this.jedison.updateInstancesWatchedData();
|
|
2547
2563
|
} else {
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2564
|
+
const audacity = this.jedison.options.audacity;
|
|
2565
|
+
if (audacity && initiator === "api" && index2 === fittestIndex) {
|
|
2566
|
+
const prePassValue = mergeDeep({}, instance.getValue(), value);
|
|
2567
|
+
instance.setValue(prePassValue, false, "api");
|
|
2568
|
+
}
|
|
2569
|
+
const currentValue = instance.getValue();
|
|
2551
2570
|
instanceValue = overwriteExistingProperties(currentValue, value);
|
|
2552
2571
|
}
|
|
2553
2572
|
}
|
|
2573
|
+
if (indexChanged) {
|
|
2574
|
+
this.jedison.updateInstancesWatchedData();
|
|
2575
|
+
}
|
|
2554
2576
|
instance.setValue(instanceValue, false, initiator);
|
|
2555
2577
|
instance.on("notifyParent", (initiator2) => {
|
|
2556
2578
|
const value2 = instance.getValueRaw();
|
|
@@ -3132,6 +3154,17 @@ class InstanceArray extends Instance {
|
|
|
3132
3154
|
this.emit("item-add", initiator, instance);
|
|
3133
3155
|
this.jedison.emit("item-add", initiator, instance);
|
|
3134
3156
|
}
|
|
3157
|
+
addItemAfter(afterIndex, initiator) {
|
|
3158
|
+
const tempEditor = this.createItemInstance();
|
|
3159
|
+
const raw = this.getValueRaw();
|
|
3160
|
+
const value = isArray(raw) ? clone(raw) : [];
|
|
3161
|
+
value.splice(afterIndex + 1, 0, tempEditor.getValueRaw());
|
|
3162
|
+
tempEditor.destroy();
|
|
3163
|
+
this.setValue(value, true, initiator);
|
|
3164
|
+
const instance = this.children[afterIndex + 1];
|
|
3165
|
+
this.emit("item-add", initiator, instance);
|
|
3166
|
+
this.jedison.emit("item-add", initiator, instance);
|
|
3167
|
+
}
|
|
3135
3168
|
deleteItem(itemIndex, initiator) {
|
|
3136
3169
|
const raw = this.getValueRaw();
|
|
3137
3170
|
if (!isArray(raw)) {
|
|
@@ -4243,6 +4276,29 @@ class EditorObjectCategories extends EditorObject {
|
|
|
4243
4276
|
super.init();
|
|
4244
4277
|
this.activeCategoryName = null;
|
|
4245
4278
|
}
|
|
4279
|
+
navigateTo(path) {
|
|
4280
|
+
const nextChildPath = this.getNextChildPath(path);
|
|
4281
|
+
if (nextChildPath) {
|
|
4282
|
+
const child = this.instance.children.find((c) => c.path === nextChildPath);
|
|
4283
|
+
if (child) {
|
|
4284
|
+
const defaultLabel = getSchemaXOption(this.instance.schema, "categoriesDefaultLabel") ?? "Basic";
|
|
4285
|
+
const childSchemaType = getSchemaType(child.schema);
|
|
4286
|
+
const xCategory = getSchemaXOption(child.schema, "category");
|
|
4287
|
+
let categoryName;
|
|
4288
|
+
if (isSet(xCategory)) {
|
|
4289
|
+
categoryName = xCategory;
|
|
4290
|
+
} else if (childSchemaType === "object" || childSchemaType === "array") {
|
|
4291
|
+
const schemaTitle = getSchemaTitle(child.schema);
|
|
4292
|
+
categoryName = isSet(schemaTitle) ? schemaTitle : child.getKey();
|
|
4293
|
+
} else {
|
|
4294
|
+
categoryName = defaultLabel;
|
|
4295
|
+
}
|
|
4296
|
+
this.activeCategoryName = categoryName;
|
|
4297
|
+
this.refreshUI();
|
|
4298
|
+
}
|
|
4299
|
+
}
|
|
4300
|
+
super.navigateTo(path);
|
|
4301
|
+
}
|
|
4246
4302
|
refreshEditors() {
|
|
4247
4303
|
while (this.control.childrenSlot.firstChild) {
|
|
4248
4304
|
this.control.childrenSlot.removeChild(this.control.childrenSlot.lastChild);
|
|
@@ -4284,7 +4340,7 @@ class EditorObjectCategories extends EditorObject {
|
|
|
4284
4340
|
categoryName = defaultLabel;
|
|
4285
4341
|
}
|
|
4286
4342
|
if (!categoriesMap.has(categoryName)) {
|
|
4287
|
-
categoriesMap.set(categoryName, { children: [], id:
|
|
4343
|
+
categoriesMap.set(categoryName, { children: [], id: this.getIdFromPath(child.path) });
|
|
4288
4344
|
}
|
|
4289
4345
|
categoriesMap.get(categoryName).children.push(child);
|
|
4290
4346
|
});
|
|
@@ -4347,6 +4403,17 @@ class EditorObjectNav extends EditorObject {
|
|
|
4347
4403
|
this.activeTabIndex = visibleIndices[0] ?? 0;
|
|
4348
4404
|
}
|
|
4349
4405
|
}
|
|
4406
|
+
navigateTo(path) {
|
|
4407
|
+
const nextChildPath = this.getNextChildPath(path);
|
|
4408
|
+
if (nextChildPath) {
|
|
4409
|
+
const childIndex = this.instance.children.findIndex((c) => c.path === nextChildPath);
|
|
4410
|
+
if (childIndex !== -1) {
|
|
4411
|
+
this.activeTabIndex = childIndex;
|
|
4412
|
+
this.refreshUI();
|
|
4413
|
+
}
|
|
4414
|
+
}
|
|
4415
|
+
super.navigateTo(path);
|
|
4416
|
+
}
|
|
4350
4417
|
refreshEditors() {
|
|
4351
4418
|
while (this.control.childrenSlot.firstChild) {
|
|
4352
4419
|
this.control.childrenSlot.removeChild(this.control.childrenSlot.lastChild);
|
|
@@ -4373,7 +4440,7 @@ class EditorObjectNav extends EditorObject {
|
|
|
4373
4440
|
this.instance.children.forEach((child, index2) => {
|
|
4374
4441
|
if (!this.isChildVisible(child)) return;
|
|
4375
4442
|
const active = index2 === this.activeTabIndex;
|
|
4376
|
-
const id =
|
|
4443
|
+
const id = this.getIdFromPath(child.path);
|
|
4377
4444
|
const schemaTitle = getSchemaTitle(child.schema);
|
|
4378
4445
|
const navWarning = getSchemaXOption(this.instance.schema, "navWarning") ?? true;
|
|
4379
4446
|
const navWarningMessage = getSchemaXOption(this.instance.schema, "navWarningMessage");
|
|
@@ -4457,6 +4524,7 @@ class EditorArray extends Editor {
|
|
|
4457
4524
|
const schemaMoveUpContent = getSchemaXOption(this.instance.schema, "arrayMoveUpContent");
|
|
4458
4525
|
const schemaMoveDownContent = getSchemaXOption(this.instance.schema, "arrayMoveDownContent");
|
|
4459
4526
|
const schemaDragContent = getSchemaXOption(this.instance.schema, "arrayDragContent");
|
|
4527
|
+
const schemaAddAfterContent = getSchemaXOption(this.instance.schema, "arrayAddAfterContent");
|
|
4460
4528
|
const deleteBtn = this.theme.getDeleteItemBtn({
|
|
4461
4529
|
content: schemaDeleteContent ?? this.instance.jedison.translator.translate("arrayDelete")
|
|
4462
4530
|
});
|
|
@@ -4469,6 +4537,9 @@ class EditorArray extends Editor {
|
|
|
4469
4537
|
const dragBtn = this.theme.getDragItemBtn({
|
|
4470
4538
|
content: schemaDragContent ?? this.instance.jedison.translator.translate("arrayDrag")
|
|
4471
4539
|
});
|
|
4540
|
+
const addAfterBtn = this.theme.getAddAfterItemBtn({
|
|
4541
|
+
content: schemaAddAfterContent ?? this.instance.jedison.translator.translate("arrayAddAfter")
|
|
4542
|
+
});
|
|
4472
4543
|
const btnGroup = this.theme.getBtnGroup();
|
|
4473
4544
|
deleteBtn.addEventListener("click", () => {
|
|
4474
4545
|
const schemaConfirm = getSchemaXOption(this.instance.schema, "arrayDeleteConfirm");
|
|
@@ -4496,13 +4567,17 @@ class EditorArray extends Editor {
|
|
|
4496
4567
|
this.activeItemIndex = toIndex;
|
|
4497
4568
|
this.instance.move(index2, toIndex, "user");
|
|
4498
4569
|
});
|
|
4570
|
+
addAfterBtn.addEventListener("click", () => {
|
|
4571
|
+
this.activeItemIndex = index2 + 1;
|
|
4572
|
+
this.instance.addItemAfter(index2, "user");
|
|
4573
|
+
});
|
|
4499
4574
|
if (index2 === 0) {
|
|
4500
4575
|
moveUpBtn.setAttribute("always-disabled", true);
|
|
4501
4576
|
}
|
|
4502
4577
|
if (index2 === this.instance.children.length - 1) {
|
|
4503
4578
|
moveDownBtn.setAttribute("always-disabled", true);
|
|
4504
4579
|
}
|
|
4505
|
-
return { deleteBtn, moveUpBtn, moveDownBtn, btnGroup, dragBtn };
|
|
4580
|
+
return { deleteBtn, moveUpBtn, moveDownBtn, btnGroup, dragBtn, addAfterBtn };
|
|
4506
4581
|
}
|
|
4507
4582
|
isSortable() {
|
|
4508
4583
|
return window.Sortable && isSet(getSchemaXOption(this.instance.schema, "sortable"));
|
|
@@ -4528,10 +4603,18 @@ class EditorArray extends Editor {
|
|
|
4528
4603
|
if (isSet(maxItems2) && enforceMaxItems && maxItems2 <= this.instance.value.length) {
|
|
4529
4604
|
this.control.addBtn.setAttribute("disabled", "");
|
|
4530
4605
|
this.control.addBtn.setAttribute("always-disabled", true);
|
|
4606
|
+
this.control.childrenSlot.querySelectorAll(".jedi-array-add-after").forEach((btn) => {
|
|
4607
|
+
btn.setAttribute("disabled", "");
|
|
4608
|
+
btn.setAttribute("always-disabled", true);
|
|
4609
|
+
});
|
|
4531
4610
|
} else {
|
|
4532
4611
|
if (!this.disabled && !this.readOnly) {
|
|
4533
4612
|
this.control.addBtn.removeAttribute("disabled");
|
|
4534
4613
|
this.control.addBtn.removeAttribute("always-disabled");
|
|
4614
|
+
this.control.childrenSlot.querySelectorAll(".jedi-array-add-after").forEach((btn) => {
|
|
4615
|
+
btn.removeAttribute("disabled");
|
|
4616
|
+
btn.removeAttribute("always-disabled");
|
|
4617
|
+
});
|
|
4535
4618
|
}
|
|
4536
4619
|
}
|
|
4537
4620
|
}
|
|
@@ -4540,9 +4623,10 @@ class EditorArray extends Editor {
|
|
|
4540
4623
|
const minItems2 = getSchemaMinItems(this.instance.schema);
|
|
4541
4624
|
const arrayDelete = getSchemaXOption(this.instance.schema, "arrayDelete") ?? this.instance.jedison.options.arrayDelete;
|
|
4542
4625
|
const arrayMove = getSchemaXOption(this.instance.schema, "arrayMove") ?? this.instance.jedison.options.arrayMove;
|
|
4626
|
+
const arrayAddAfter = getSchemaXOption(this.instance.schema, "arrayAddAfter") ?? this.instance.jedison.options.arrayAddAfter;
|
|
4543
4627
|
this.control.childrenSlot.innerHTML = "";
|
|
4544
4628
|
this.instance.children.forEach((child, index2) => {
|
|
4545
|
-
const { deleteBtn, moveUpBtn, moveDownBtn, dragBtn, btnGroup } = this.getButtons(index2);
|
|
4629
|
+
const { deleteBtn, moveUpBtn, moveDownBtn, dragBtn, btnGroup, addAfterBtn } = this.getButtons(index2);
|
|
4546
4630
|
const { container, arrayActions, body } = this.theme.getArrayItem({
|
|
4547
4631
|
readOnly: this.instance.isReadOnly(),
|
|
4548
4632
|
index: index2
|
|
@@ -4558,6 +4642,9 @@ class EditorArray extends Editor {
|
|
|
4558
4642
|
if (this.isSortable()) {
|
|
4559
4643
|
btnGroup.appendChild(dragBtn);
|
|
4560
4644
|
}
|
|
4645
|
+
if (isSet(arrayAddAfter) && arrayAddAfter === true) {
|
|
4646
|
+
btnGroup.appendChild(addAfterBtn);
|
|
4647
|
+
}
|
|
4561
4648
|
this.control.childrenSlot.appendChild(container);
|
|
4562
4649
|
body.appendChild(child.ui.control.container);
|
|
4563
4650
|
if (this.disabled || this.instance.isReadOnly()) {
|
|
@@ -4659,6 +4746,7 @@ class EditorArrayTable extends EditorArray {
|
|
|
4659
4746
|
const arrayDelete = getSchemaXOption(this.instance.schema, "arrayDelete") ?? this.instance.jedison.options.arrayDelete;
|
|
4660
4747
|
const arrayMove = getSchemaXOption(this.instance.schema, "arrayMove") ?? this.instance.jedison.options.arrayMove;
|
|
4661
4748
|
const arrayButtonsPosition = getSchemaXOption(this.instance.schema, "arrayButtonsPosition") ?? this.instance.jedison.options.arrayButtonsPosition;
|
|
4749
|
+
const arrayAddAfter = getSchemaXOption(this.instance.schema, "arrayAddAfter") ?? this.instance.jedison.options.arrayAddAfter;
|
|
4662
4750
|
const th = this.theme.getTableHeader();
|
|
4663
4751
|
const { label } = this.theme.getFakeLabel({
|
|
4664
4752
|
content: "Controls",
|
|
@@ -4696,7 +4784,7 @@ class EditorArrayTable extends EditorArray {
|
|
|
4696
4784
|
this.instance.children.forEach((child, index2) => {
|
|
4697
4785
|
const tbodyRow = document.createElement("tr");
|
|
4698
4786
|
const buttonsTd = this.theme.getTableDefinition({ isButtonColumn: true });
|
|
4699
|
-
const { deleteBtn, moveUpBtn, moveDownBtn, dragBtn, btnGroup } = this.getButtons(index2);
|
|
4787
|
+
const { deleteBtn, moveUpBtn, moveDownBtn, dragBtn, btnGroup, addAfterBtn } = this.getButtons(index2);
|
|
4700
4788
|
if (this.isSortable()) {
|
|
4701
4789
|
btnGroup.appendChild(dragBtn);
|
|
4702
4790
|
}
|
|
@@ -4707,6 +4795,9 @@ class EditorArrayTable extends EditorArray {
|
|
|
4707
4795
|
btnGroup.appendChild(moveUpBtn);
|
|
4708
4796
|
btnGroup.appendChild(moveDownBtn);
|
|
4709
4797
|
}
|
|
4798
|
+
if (isSet(arrayAddAfter) && arrayAddAfter === true) {
|
|
4799
|
+
btnGroup.appendChild(addAfterBtn);
|
|
4800
|
+
}
|
|
4710
4801
|
buttonsTd.appendChild(btnGroup);
|
|
4711
4802
|
if (arrayButtonsPosition === "left") {
|
|
4712
4803
|
tbodyRow.appendChild(buttonsTd);
|
|
@@ -4784,6 +4875,7 @@ class EditorArrayTableObject extends EditorArray {
|
|
|
4784
4875
|
const arrayDelete = getSchemaXOption(this.instance.schema, "arrayDelete") ?? this.instance.jedison.options.arrayDelete;
|
|
4785
4876
|
const arrayMove = getSchemaXOption(this.instance.schema, "arrayMove") ?? this.instance.jedison.options.arrayMove;
|
|
4786
4877
|
const arrayButtonsPosition = getSchemaXOption(this.instance.schema, "arrayButtonsPosition") ?? this.instance.jedison.options.arrayButtonsPosition;
|
|
4878
|
+
const arrayAddAfter = getSchemaXOption(this.instance.schema, "arrayAddAfter") ?? this.instance.jedison.options.arrayAddAfter;
|
|
4787
4879
|
const th = this.theme.getTableHeader();
|
|
4788
4880
|
const { label } = this.theme.getFakeLabel({
|
|
4789
4881
|
content: "Controls",
|
|
@@ -4827,7 +4919,7 @@ class EditorArrayTableObject extends EditorArray {
|
|
|
4827
4919
|
this.instance.children.forEach((child, index2) => {
|
|
4828
4920
|
const tbodyRow = document.createElement("tr");
|
|
4829
4921
|
const buttonsTd = this.theme.getTableDefinition({ isButtonColumn: true });
|
|
4830
|
-
const { deleteBtn, moveUpBtn, moveDownBtn, dragBtn, btnGroup } = this.getButtons(index2);
|
|
4922
|
+
const { deleteBtn, moveUpBtn, moveDownBtn, dragBtn, btnGroup, addAfterBtn } = this.getButtons(index2);
|
|
4831
4923
|
if (this.isSortable()) {
|
|
4832
4924
|
btnGroup.appendChild(dragBtn);
|
|
4833
4925
|
}
|
|
@@ -4838,6 +4930,9 @@ class EditorArrayTableObject extends EditorArray {
|
|
|
4838
4930
|
btnGroup.appendChild(moveUpBtn);
|
|
4839
4931
|
btnGroup.appendChild(moveDownBtn);
|
|
4840
4932
|
}
|
|
4933
|
+
if (isSet(arrayAddAfter) && arrayAddAfter === true) {
|
|
4934
|
+
btnGroup.appendChild(addAfterBtn);
|
|
4935
|
+
}
|
|
4841
4936
|
buttonsTd.appendChild(btnGroup);
|
|
4842
4937
|
if (arrayButtonsPosition === "left") {
|
|
4843
4938
|
tbodyRow.appendChild(buttonsTd);
|
|
@@ -5017,6 +5112,17 @@ class EditorArrayNav extends EditorArray {
|
|
|
5017
5112
|
const hasNavFormat = regex.test(format2);
|
|
5018
5113
|
return getSchemaType(schema) === "array" && hasNavFormat;
|
|
5019
5114
|
}
|
|
5115
|
+
navigateTo(path) {
|
|
5116
|
+
const nextChildPath = this.getNextChildPath(path);
|
|
5117
|
+
if (nextChildPath) {
|
|
5118
|
+
const childIndex = this.instance.children.findIndex((c) => c.path === nextChildPath);
|
|
5119
|
+
if (childIndex !== -1) {
|
|
5120
|
+
this.activeItemIndex = childIndex;
|
|
5121
|
+
this.refreshUI();
|
|
5122
|
+
}
|
|
5123
|
+
}
|
|
5124
|
+
super.navigateTo(path);
|
|
5125
|
+
}
|
|
5020
5126
|
addEventListeners() {
|
|
5021
5127
|
this.control.addBtn.addEventListener("click", () => {
|
|
5022
5128
|
this.activeItemIndex = this.instance.value.length;
|
|
@@ -5041,13 +5147,14 @@ class EditorArrayNav extends EditorArray {
|
|
|
5041
5147
|
});
|
|
5042
5148
|
const arrayDelete = getSchemaXOption(this.instance.schema, "arrayDelete") ?? this.instance.jedison.options.arrayDelete;
|
|
5043
5149
|
const arrayMove = getSchemaXOption(this.instance.schema, "arrayMove") ?? this.instance.jedison.options.arrayMove;
|
|
5150
|
+
const arrayAddAfter = getSchemaXOption(this.instance.schema, "arrayAddAfter") ?? this.instance.jedison.options.arrayAddAfter;
|
|
5044
5151
|
this.control.childrenSlot.appendChild(row);
|
|
5045
5152
|
row.appendChild(tabListCol);
|
|
5046
5153
|
row.appendChild(tabContentCol);
|
|
5047
5154
|
tabListCol.appendChild(tabList);
|
|
5048
5155
|
tabContentCol.appendChild(tabContent);
|
|
5049
5156
|
this.instance.children.forEach((child, index2) => {
|
|
5050
|
-
const { deleteBtn, moveUpBtn, moveDownBtn, btnGroup } = this.getButtons(index2);
|
|
5157
|
+
const { deleteBtn, moveUpBtn, moveDownBtn, btnGroup, addAfterBtn } = this.getButtons(index2);
|
|
5051
5158
|
if (isSet(arrayDelete) && arrayDelete === true) {
|
|
5052
5159
|
btnGroup.appendChild(deleteBtn);
|
|
5053
5160
|
}
|
|
@@ -5055,6 +5162,9 @@ class EditorArrayNav extends EditorArray {
|
|
|
5055
5162
|
btnGroup.appendChild(moveUpBtn);
|
|
5056
5163
|
btnGroup.appendChild(moveDownBtn);
|
|
5057
5164
|
}
|
|
5165
|
+
if (isSet(arrayAddAfter) && arrayAddAfter === true) {
|
|
5166
|
+
btnGroup.appendChild(addAfterBtn);
|
|
5167
|
+
}
|
|
5058
5168
|
this.control.childrenSlot.appendChild(child.ui.control.container);
|
|
5059
5169
|
const schemaTitle = getSchemaTitle(child.schema);
|
|
5060
5170
|
const childTitle = isSet(schemaTitle) ? schemaTitle + " " + (index2 + 1) : child.getKey();
|
|
@@ -5066,7 +5176,7 @@ class EditorArrayNav extends EditorArray {
|
|
|
5066
5176
|
titleTemplate = compileTemplate(template, data) ?? childTitle;
|
|
5067
5177
|
}
|
|
5068
5178
|
const active = index2 === this.activeItemIndex;
|
|
5069
|
-
const id =
|
|
5179
|
+
const id = this.getIdFromPath(child.path);
|
|
5070
5180
|
const navWarning = getSchemaXOption(this.instance.schema, "navWarning") ?? true;
|
|
5071
5181
|
const navWarningMessage = getSchemaXOption(this.instance.schema, "navWarningMessage");
|
|
5072
5182
|
const { list, arrayActions } = this.theme.getTab({
|
|
@@ -5961,6 +6071,7 @@ const defaultTranslations = {
|
|
|
5961
6071
|
arrayMoveDown: "Move down",
|
|
5962
6072
|
arrayDrag: "Drag",
|
|
5963
6073
|
arrayAdd: "Add item",
|
|
6074
|
+
arrayAddAfter: "Add after",
|
|
5964
6075
|
arrayConfirmDelete: "Are you sure you want to delete this item?",
|
|
5965
6076
|
objectAddProperty: "Add property",
|
|
5966
6077
|
objectPropertyAdded: "field was added to the form",
|
|
@@ -6216,6 +6327,7 @@ class Jedison extends EventEmitter {
|
|
|
6216
6327
|
arrayDeleteConfirm: true,
|
|
6217
6328
|
arrayMove: true,
|
|
6218
6329
|
arrayAdd: true,
|
|
6330
|
+
arrayAddAfter: false,
|
|
6219
6331
|
objectAdd: true,
|
|
6220
6332
|
arrayButtonsPosition: "left",
|
|
6221
6333
|
startCollapsed: false,
|
|
@@ -6249,7 +6361,8 @@ class Jedison extends EventEmitter {
|
|
|
6249
6361
|
enforceMaxItems: true,
|
|
6250
6362
|
enforceEnum: true,
|
|
6251
6363
|
subErrors: false,
|
|
6252
|
-
debug: false
|
|
6364
|
+
debug: false,
|
|
6365
|
+
audacity: true
|
|
6253
6366
|
}, options);
|
|
6254
6367
|
this.rootName = "#";
|
|
6255
6368
|
this.pathSeparator = "/";
|
|
@@ -6460,6 +6573,9 @@ class Jedison extends EventEmitter {
|
|
|
6460
6573
|
node.oneOf[index2] = this.refParser.expand(subschema);
|
|
6461
6574
|
});
|
|
6462
6575
|
}
|
|
6576
|
+
if (isObject(node.items) && this.refParser.hasRef(node.items)) {
|
|
6577
|
+
node.items = this.refParser.expand(node.items);
|
|
6578
|
+
}
|
|
6463
6579
|
});
|
|
6464
6580
|
}
|
|
6465
6581
|
if (this.isEditor) {
|
|
@@ -6580,6 +6696,14 @@ class Jedison extends EventEmitter {
|
|
|
6580
6696
|
getInstance(path) {
|
|
6581
6697
|
return this.instances.get(path);
|
|
6582
6698
|
}
|
|
6699
|
+
/**
|
|
6700
|
+
* Navigates to a specific instance by path, activating any ancestor nav/categories tabs as needed.
|
|
6701
|
+
* @param {string} path - The instance path (e.g. '#/address/street')
|
|
6702
|
+
*/
|
|
6703
|
+
navigateTo(path) {
|
|
6704
|
+
if (!this.isEditor) return;
|
|
6705
|
+
this.root.ui.navigateTo(path);
|
|
6706
|
+
}
|
|
6583
6707
|
/**
|
|
6584
6708
|
* Disables the root instance and it's children user interfaces
|
|
6585
6709
|
*/
|
|
@@ -7321,6 +7445,17 @@ class Theme {
|
|
|
7321
7445
|
html.classList.add("jedi-array-add");
|
|
7322
7446
|
return html;
|
|
7323
7447
|
}
|
|
7448
|
+
/**
|
|
7449
|
+
* Array "add after" item button
|
|
7450
|
+
*/
|
|
7451
|
+
getAddAfterItemBtn(config) {
|
|
7452
|
+
const addAfterItemBtn = this.getButton({
|
|
7453
|
+
content: config.content,
|
|
7454
|
+
icon: "add"
|
|
7455
|
+
});
|
|
7456
|
+
addAfterItemBtn.classList.add("jedi-array-add-after");
|
|
7457
|
+
return addAfterItemBtn;
|
|
7458
|
+
}
|
|
7324
7459
|
/**
|
|
7325
7460
|
* Array "delete" item button
|
|
7326
7461
|
*/
|
|
@@ -8717,10 +8852,8 @@ class ThemeBootstrap3 extends Theme {
|
|
|
8717
8852
|
setTabPaneAttributes(element, active, id) {
|
|
8718
8853
|
super.setTabPaneAttributes(element, active, id);
|
|
8719
8854
|
element.classList.add("tab-pane");
|
|
8720
|
-
|
|
8721
|
-
|
|
8722
|
-
element.classList.add("active");
|
|
8723
|
-
}
|
|
8855
|
+
element.classList.toggle("in", active);
|
|
8856
|
+
element.classList.toggle("active", active);
|
|
8724
8857
|
}
|
|
8725
8858
|
infoAsModal(info, id, config = {}) {
|
|
8726
8859
|
const modal = document.createElement("div");
|
|
@@ -9098,9 +9231,7 @@ class ThemeBootstrap4 extends Theme {
|
|
|
9098
9231
|
setTabPaneAttributes(element, active, id) {
|
|
9099
9232
|
super.setTabPaneAttributes(element, active, id);
|
|
9100
9233
|
element.classList.add("tab-pane");
|
|
9101
|
-
|
|
9102
|
-
element.classList.add("active");
|
|
9103
|
-
}
|
|
9234
|
+
element.classList.toggle("active", active);
|
|
9104
9235
|
}
|
|
9105
9236
|
infoAsModal(info, id, config = {}) {
|
|
9106
9237
|
const modal = document.createElement("div");
|
|
@@ -9474,9 +9605,7 @@ class ThemeBootstrap5 extends Theme {
|
|
|
9474
9605
|
setTabPaneAttributes(element, active, id) {
|
|
9475
9606
|
super.setTabPaneAttributes(element, active, id);
|
|
9476
9607
|
element.classList.add("tab-pane");
|
|
9477
|
-
|
|
9478
|
-
element.classList.add("active");
|
|
9479
|
-
}
|
|
9608
|
+
element.classList.toggle("active", active);
|
|
9480
9609
|
}
|
|
9481
9610
|
infoAsModal(info, id, config = {}) {
|
|
9482
9611
|
const modal = document.createElement("div");
|