jedison 1.14.0 → 1.15.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.
@@ -5655,6 +5655,12 @@ class EditorMultiple extends Editor {
5655
5655
  });
5656
5656
  });
5657
5657
  }
5658
+ if (this.switcherInput === "select-inline") {
5659
+ this.control.switcher.input.addEventListener("change", () => {
5660
+ const index2 = Number(this.control.switcher.input.value);
5661
+ this.instance.switchInstance(index2, void 0, "user");
5662
+ });
5663
+ }
5658
5664
  }
5659
5665
  refreshUI() {
5660
5666
  var _a;
@@ -5672,7 +5678,7 @@ class EditorMultiple extends Editor {
5672
5678
  this.control.header.appendChild(this.control.switcher.container);
5673
5679
  }
5674
5680
  }
5675
- if (this.switcherInput === "modal") {
5681
+ if (this.switcherInput === "modal" || this.switcherInput === "select-inline") {
5676
5682
  const childControl = this.instance.activeInstance.ui.control;
5677
5683
  const infoContainer = childControl.infoContainer;
5678
5684
  const titleEl = childControl.legendText || childControl.label;
@@ -5689,6 +5695,9 @@ class EditorMultiple extends Editor {
5689
5695
  if (this.switcherInput === "select") {
5690
5696
  this.control.switcher.input.value = this.instance.index;
5691
5697
  }
5698
+ if (this.switcherInput === "select-inline") {
5699
+ this.control.switcher.input.value = this.instance.index;
5700
+ }
5692
5701
  if (this.switcherInput === "radios" || this.switcherInput === "radios-inline") {
5693
5702
  this.control.switcher.radios.forEach((radio) => {
5694
5703
  const radioIndex = Number(radio.value);
@@ -8851,7 +8860,7 @@ class Theme {
8851
8860
  const messages = this.getMessagesSlot();
8852
8861
  const childrenSlot = this.getChildrenSlot();
8853
8862
  const randomId = generateRandomID(5);
8854
- const knownSwitchers = ["select", "radios", "radios-inline", "modal"];
8863
+ const knownSwitchers = ["select", "radios", "radios-inline", "modal", "select-inline"];
8855
8864
  const switcherType = knownSwitchers.includes(config.switcher) ? config.switcher : "select";
8856
8865
  let switcher;
8857
8866
  if (switcherType === "select") {
@@ -8887,6 +8896,14 @@ class Theme {
8887
8896
  readOnly: config.readOnly
8888
8897
  });
8889
8898
  }
8899
+ if (switcherType === "select-inline") {
8900
+ switcher = this.getSwitcherSelectInline({
8901
+ values: config.switcherOptionValues,
8902
+ titles: config.switcherOptionsLabels,
8903
+ id: config.id + "-switcher-" + randomId,
8904
+ readOnly: config.readOnly
8905
+ });
8906
+ }
8890
8907
  switcher.container.classList.add("jedi-switcher");
8891
8908
  container.appendChild(header);
8892
8909
  container.appendChild(body);
@@ -9404,6 +9421,31 @@ class Theme {
9404
9421
  setSwitcherOptionActive(btn, active) {
9405
9422
  btn.classList.toggle("jedi-switcher-option-active", active);
9406
9423
  }
9424
+ /**
9425
+ * Compact inline <select> to switch between multiple editors options (no dialog)
9426
+ */
9427
+ getSwitcherSelectInline(config) {
9428
+ const container = document.createElement("span");
9429
+ const input = document.createElement("select");
9430
+ container.classList.add("jedi-switcher-select-inline");
9431
+ container.style.display = "inline-block";
9432
+ input.classList.add("jedi-switcher-select-inline-input");
9433
+ input.style.width = "auto";
9434
+ input.setAttribute("aria-label", "Switch type");
9435
+ if (config.readOnly) {
9436
+ input.setAttribute("disabled", "");
9437
+ }
9438
+ config.values.forEach((value, index2) => {
9439
+ const option = document.createElement("option");
9440
+ option.setAttribute("value", value);
9441
+ if (config.titles && config.titles[index2]) {
9442
+ option.textContent = config.titles[index2];
9443
+ }
9444
+ input.appendChild(option);
9445
+ });
9446
+ container.appendChild(input);
9447
+ return { container, input };
9448
+ }
9407
9449
  /**
9408
9450
  * Another type of error message container used for more complex editors like
9409
9451
  * object, array and multiple editors
@@ -9966,6 +10008,12 @@ class ThemeBootstrap3 extends Theme {
9966
10008
  control.input.classList.add("input-sm");
9967
10009
  return control;
9968
10010
  }
10011
+ getSwitcherSelectInline(config) {
10012
+ const control = super.getSwitcherSelectInline(config);
10013
+ control.container.style.marginBottom = "5px";
10014
+ control.input.classList.add("input-sm");
10015
+ return control;
10016
+ }
9969
10017
  getSwitcherModal(config) {
9970
10018
  const control = super.getSwitcherModal(config);
9971
10019
  control.trigger.classList.add("label", "label-primary");
@@ -10499,6 +10547,12 @@ class ThemeBootstrap4 extends Theme {
10499
10547
  control.input.classList.add("form-control-sm");
10500
10548
  return control;
10501
10549
  }
10550
+ getSwitcherSelectInline(config) {
10551
+ const control = super.getSwitcherSelectInline(config);
10552
+ control.container.classList.add("mb-2");
10553
+ control.input.classList.add("form-control", "form-control-sm");
10554
+ return control;
10555
+ }
10502
10556
  getSwitcherModal(config) {
10503
10557
  const control = super.getSwitcherModal(config);
10504
10558
  control.trigger.classList.add("badge", "badge-primary");
@@ -11044,6 +11098,12 @@ class ThemeBootstrap5 extends Theme {
11044
11098
  control.input.classList.add("form-select-sm");
11045
11099
  return control;
11046
11100
  }
11101
+ getSwitcherSelectInline(config) {
11102
+ const control = super.getSwitcherSelectInline(config);
11103
+ control.container.classList.add("mb-1");
11104
+ control.input.classList.add("form-select", "form-select-sm");
11105
+ return control;
11106
+ }
11047
11107
  getSwitcherModal(config) {
11048
11108
  const control = super.getSwitcherModal(config);
11049
11109
  control.trigger.classList.add("badge", "bg-primary");