@processmaker/screen-builder 2.84.2 → 2.85.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.
@@ -48596,7 +48596,8 @@ const UX = WX.exports, av = 200, GX = {
48596
48596
  });
48597
48597
  },
48598
48598
  closeTab(t) {
48599
- this.localOpenedPages.splice(this.localOpenedPages.indexOf(t), 1), this.$emit("tab-closed", this.pages[t], this.localOpenedPages);
48599
+ const e = this.localOpenedPages[t];
48600
+ this.localOpenedPages.splice(t, 1), this.$emit("tab-closed", this.pages[e], this.localOpenedPages);
48600
48601
  },
48601
48602
  updateTabsReferences(t) {
48602
48603
  this.localOpenedPages = this.localOpenedPages.map(
@@ -48621,7 +48622,7 @@ const UX = WX.exports, av = 200, GX = {
48621
48622
  };
48622
48623
  var HX = function() {
48623
48624
  var e = this, r = e._self._c;
48624
- return r("b-tabs", { ref: "tabs", staticClass: "h-100 w-100 flat-tabs", attrs: { "content-class": "h-tab", lazy: "" }, on: { changed: e.tabsUpdated, input: e.tabOpened }, scopedSlots: e._u([{ key: "tabs-start", fn: function() {
48625
+ return r("b-tabs", { ref: "tabs", staticClass: "h-100 w-100 flat-tabs", attrs: { "content-class": "h-tab", "nav-class": "nav-tabs-nowrap", lazy: "" }, on: { changed: e.tabsUpdated, input: e.tabOpened }, scopedSlots: e._u([{ key: "tabs-start", fn: function() {
48625
48626
  return [r("div", { staticClass: "tabs-sticky d-flex flex-row tabs-start" }, [r("div", { directives: [{ name: "show", rawName: "v-show", value: e.tabsListOverflow, expression: "tabsListOverflow" }], staticClass: "position-relative overflow-visible" }, [r("div", { staticClass: "nav-scroll nav-scroll-left", attrs: { role: "link", "data-test": "scroll-left" }, on: { click: e.scrollTabsLeft } }, [r("i", { staticClass: "fas fa-chevron-left" })])])]), r("div", { class: { "dd-ml": e.tabsListOverflow } }, [e._t("tabs-start")], 2)];
48626
48627
  }, proxy: !0 }, { key: "tabs-end", fn: function() {
48627
48628
  return [e.tabsListOverflow ? r("div", { staticClass: "tabs-sticky overflow-visible" }, [r("div", { staticClass: "nav-scroll nav-scroll-right", attrs: { role: "link", "data-test": "scroll-right" }, on: { click: e.scrollTabsRight } }, [r("i", { staticClass: "fas fa-chevron-right" })])]) : e._e()];
@@ -48658,7 +48659,7 @@ const JX = {
48658
48659
  },
48659
48660
  data() {
48660
48661
  return {
48661
- originalName: "",
48662
+ newName: "",
48662
48663
  draggedItem: 0,
48663
48664
  draggedOverItem: 0,
48664
48665
  editRowIndex: null
@@ -48673,20 +48674,23 @@ const JX = {
48673
48674
  },
48674
48675
  methods: {
48675
48676
  validateState(t, e) {
48676
- const r = !t, a = this.items.filter((i) => i !== e).find((i) => i.name === t);
48677
+ const r = !(t != null && t.trim()), a = this.items.filter((i) => i !== e).find((i) => i.name === t);
48677
48678
  return r || a ? !1 : null;
48678
48679
  },
48679
48680
  validateError(t, e) {
48680
- return t ? this.$t("The Page Name field is required.") : this.items.filter((i) => i !== e).find((i) => i.name === t) ? this.$t("Must be unique.") : "";
48681
+ return t != null && t.trim() ? this.$t("The Page Name field is required.") : this.items.filter((i) => i !== e).find((i) => i.name === t) ? this.$t("Must be unique.") : "";
48681
48682
  },
48682
- onFocus(t, e) {
48683
- this.originalName = t;
48683
+ onFocus(t) {
48684
+ this.newName = t.name;
48684
48685
  },
48685
48686
  async onBlur(t, e) {
48686
- this.validateState(t, e) === !1 && (e.name = this.originalName), await this.$nextTick(), setTimeout(() => {
48687
+ this.validateState(t, e) === !1 ? this.newName = e.name : e.name = t, await this.$nextTick(), setTimeout(() => {
48687
48688
  this.editRowIndex = null;
48688
48689
  }, 250);
48689
48690
  },
48691
+ async onCancel(t) {
48692
+ this.newName = t.name, this.editRowIndex = null;
48693
+ },
48690
48694
  onClick(t, e) {
48691
48695
  this.editRowIndex = e, this.$emit("item-edit", t);
48692
48696
  },
@@ -48708,18 +48712,22 @@ const JX = {
48708
48712
  if (r !== a) {
48709
48713
  const i = e[a].order, n = this.draggedItem > this.draggedOverItem ? 1 : -1;
48710
48714
  if (r < a) {
48711
- for (let s = r + 1; s <= a; s++) {
48712
- const o = e[s].order;
48713
- e[s].order = o + n;
48715
+ for (let o = r + 1; o <= a; o++) {
48716
+ const u = e[o].order;
48717
+ e[o].order = u + n;
48714
48718
  }
48715
48719
  e[r].order = i;
48716
48720
  } else if (r > a) {
48717
- for (let s = a; s <= r - 1; s++) {
48718
- const o = e[s].order;
48719
- e[s].order = o + n;
48721
+ for (let o = a; o <= r - 1; o++) {
48722
+ const u = e[o].order;
48723
+ e[o].order = u + n;
48720
48724
  }
48721
48725
  e[r].order = i;
48722
48726
  }
48727
+ const s = [...e];
48728
+ s.sort((o, u) => o.order - u.order), s.forEach((o, u) => {
48729
+ o.order = u + 1;
48730
+ });
48723
48731
  }
48724
48732
  this.$emit("ordered", e);
48725
48733
  },
@@ -48731,15 +48739,17 @@ const JX = {
48731
48739
  var ZX = function() {
48732
48740
  var e = this, r = e._self._c;
48733
48741
  return r("div", { staticClass: "row mt-3" }, [r("div", { staticClass: "col p-0 border rounded-lg sortable-list" }, [e._m(0), r("div", { staticClass: "sortable-container", on: { dragover: e.dragOver } }, e._l(e.sortedItems, function(a, i) {
48734
- return r("div", { key: i, staticClass: "sortable-item sortable-draggable", attrs: { "data-order": a.order, "data-test": `item-${a.order}`, title: a.name, draggable: "true" }, on: { dragstart: (n) => e.dragStart(n, a.order), dragenter: (n) => e.dragEnter(n, a.order), dragend: e.dragEnd } }, [e._m(1, !0), r("div", { staticClass: "rounded sortable-item-name" }, [e.editRowIndex === i ? r("b-form-input", { attrs: { type: "text", autofocus: "", required: "", state: e.validateState(a.name, a), error: e.validateError(a.name, a) }, on: { blur: function(n) {
48735
- return n.stopPropagation(), e.onBlur(a.name, a);
48736
- }, keydown: function(n) {
48737
- return !n.type.indexOf("key") && e._k(n.keyCode, "enter", 13, n.key, "Enter") ? null : (n.stopPropagation(), e.onBlur(a.name, a));
48738
- }, focus: function(n) {
48739
- return e.onFocus(a.name, a);
48740
- } }, model: { value: a.name, callback: function(n) {
48741
- e.$set(a, "name", n);
48742
- }, expression: "item.name" } }) : r("span", [e._v(e._s(a.name))])], 1), r("div", { staticClass: "border rounded-lg sortable-item-action" }, [e.editRowIndex === i ? r("button", { staticClass: "btn" }, [r("i", { staticClass: "fas fa-check" })]) : r("button", { staticClass: "btn", on: { click: function(n) {
48742
+ return r("div", { key: i, staticClass: "sortable-item sortable-draggable", attrs: { "data-order": a.order, "data-test": `item-${a.order}`, title: a.name, draggable: "true" }, on: { dragstart: (n) => e.dragStart(n, a.order), dragenter: (n) => e.dragEnter(n, a.order), dragend: e.dragEnd } }, [e._m(1, !0), r("div", { staticClass: "rounded sortable-item-name" }, [e.editRowIndex === i ? r("b-form-input", { attrs: { type: "text", autofocus: "", required: "", state: e.validateState(e.newName, a), error: e.validateError(e.newName, a) }, on: { blur: function(n) {
48743
+ return n.stopPropagation(), e.onBlur(e.newName, a);
48744
+ }, keydown: [function(n) {
48745
+ return !n.type.indexOf("key") && e._k(n.keyCode, "enter", 13, n.key, "Enter") ? null : (n.stopPropagation(), e.onBlur(e.newName, a));
48746
+ }, function(n) {
48747
+ return !n.type.indexOf("key") && e._k(n.keyCode, "esc", 27, n.key, ["Esc", "Escape"]) ? null : (n.stopPropagation(), e.onCancel(a));
48748
+ }], focus: function(n) {
48749
+ return e.onFocus(a);
48750
+ } }, model: { value: e.newName, callback: function(n) {
48751
+ e.newName = n;
48752
+ }, expression: "newName" } }) : r("span", [e._v(e._s(a.name))])], 1), r("div", { staticClass: "border rounded-lg sortable-item-action" }, [e.editRowIndex === i ? r("button", { staticClass: "btn" }, [r("i", { staticClass: "fas fa-check" })]) : r("button", { staticClass: "btn", on: { click: function(n) {
48743
48753
  return n.stopPropagation(), e.onClick(a, i);
48744
48754
  } } }, [r("i", { staticClass: "fas fa-edit" })]), r("div", { staticClass: "sortable-item-vr" }), r("button", { staticClass: "btn", on: { click: function(n) {
48745
48755
  return e.$emit("item-delete", a);
@@ -48757,7 +48767,7 @@ var ZX = function() {
48757
48767
  XX,
48758
48768
  !1,
48759
48769
  null,
48760
- "94c99e35",
48770
+ "783e3808",
48761
48771
  null,
48762
48772
  null
48763
48773
  );
@@ -49076,12 +49086,21 @@ const oee = [
49076
49086
  }), t.open = !0;
49077
49087
  },
49078
49088
  migrateConfig(t = this.config) {
49079
- t.forEach((e) => this.replaceFormText(e.items)), t.forEach((e) => this.migrateFormSubmit(e.items)), t.forEach((e) => this.updateFieldNameValidation(e.items)), t.forEach(
49089
+ t.forEach((e) => this.replaceFormText(e.items)), t.forEach((e) => this.migrateFormSubmit(e.items)), t.forEach((e) => this.updateFieldNameValidation(e.items)), this.updatePageOrder(t), t.forEach(
49080
49090
  (e) => this.removeDataVariableFromNestedScreens(e.items)
49081
49091
  ), t.forEach((e, r) => {
49082
49092
  e.order = e.order || r + 1;
49083
49093
  });
49084
49094
  },
49095
+ updatePageOrder(t) {
49096
+ const e = [...t];
49097
+ e.sort((r, a) => {
49098
+ const i = r.order || t.indexOf(r) + 1, n = a.order || t.indexOf(a) + 1;
49099
+ return i - n;
49100
+ }), e.forEach((r, a) => {
49101
+ r.order = a + 1;
49102
+ });
49103
+ },
49085
49104
  updateFieldNameValidation(t) {
49086
49105
  t.forEach((e) => {
49087
49106
  e.inspector && e.inspector.forEach((r) => {
@@ -49217,8 +49236,8 @@ const oee = [
49217
49236
  this.config[this.editPageIndex].name = this.editPageName, this.updateState();
49218
49237
  },
49219
49238
  addPage(t) {
49220
- if (this.showAddPageValidations = !0, this.checkPageName(this.addPageName, !0)) {
49221
- t.preventDefault();
49239
+ if (this.checkPageName(this.addPageName, !0)) {
49240
+ this.showAddPageValidations = !0, t.preventDefault();
49222
49241
  return;
49223
49242
  }
49224
49243
  const r = this.config.reduce((a, i) => i.order > a ? i.order : a, 0);
@@ -49268,7 +49287,7 @@ const oee = [
49268
49287
  this.config = t, ja.ProcessMaker.alert(e.message, "danger");
49269
49288
  return;
49270
49289
  }
49271
- this.$store.dispatch("undoRedoModule/pushState", {
49290
+ this.updatePageOrder(this.config), this.$store.dispatch("undoRedoModule/pushState", {
49272
49291
  config: JSON.stringify(this.config),
49273
49292
  currentPage: this.currentPage,
49274
49293
  deletedPage: !0
@@ -49469,7 +49488,7 @@ var dee = function() {
49469
49488
  pee,
49470
49489
  !1,
49471
49490
  null,
49472
- "6dca9fa7",
49491
+ "fdf4961e",
49473
49492
  null,
49474
49493
  null
49475
49494
  );