@processmaker/screen-builder 2.84.1 → 2.84.3

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,6 +48659,7 @@ const JX = {
48658
48659
  },
48659
48660
  data() {
48660
48661
  return {
48662
+ newName: "",
48661
48663
  draggedItem: 0,
48662
48664
  draggedOverItem: 0,
48663
48665
  editRowIndex: null
@@ -48671,14 +48673,25 @@ const JX = {
48671
48673
  }
48672
48674
  },
48673
48675
  methods: {
48674
- onBlur() {
48675
- this.editRowIndex = -1;
48676
+ validateState(t, e) {
48677
+ const r = !(t != null && t.trim()), a = this.items.filter((i) => i !== e).find((i) => i.name === t);
48678
+ return r || a ? !1 : null;
48676
48679
  },
48677
- onClick(t, e) {
48678
- if (this.editRowIndex === -1 || this.editRowIndex === e) {
48680
+ validateError(t, e) {
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.") : "";
48682
+ },
48683
+ onFocus(t) {
48684
+ this.newName = t.name;
48685
+ },
48686
+ async onBlur(t, e) {
48687
+ this.validateState(t, e) === !1 ? this.newName = e.name : e.name = t, await this.$nextTick(), setTimeout(() => {
48679
48688
  this.editRowIndex = null;
48680
- return;
48681
- }
48689
+ }, 250);
48690
+ },
48691
+ async onCancel(t) {
48692
+ this.newName = t.name, this.editRowIndex = null;
48693
+ },
48694
+ onClick(t, e) {
48682
48695
  this.editRowIndex = e, this.$emit("item-edit", t);
48683
48696
  },
48684
48697
  dragStart(t, e) {
@@ -48699,18 +48712,22 @@ const JX = {
48699
48712
  if (r !== a) {
48700
48713
  const i = e[a].order, n = this.draggedItem > this.draggedOverItem ? 1 : -1;
48701
48714
  if (r < a) {
48702
- for (let s = r + 1; s <= a; s++) {
48703
- const o = e[s].order;
48704
- 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;
48705
48718
  }
48706
48719
  e[r].order = i;
48707
48720
  } else if (r > a) {
48708
- for (let s = a; s <= r - 1; s++) {
48709
- const o = e[s].order;
48710
- 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;
48711
48724
  }
48712
48725
  e[r].order = i;
48713
48726
  }
48727
+ const s = [...e];
48728
+ s.sort((o, u) => o.order - u.order), s.forEach((o, u) => {
48729
+ o.order = u + 1;
48730
+ });
48714
48731
  }
48715
48732
  this.$emit("ordered", e);
48716
48733
  },
@@ -48722,11 +48739,17 @@ const JX = {
48722
48739
  var ZX = function() {
48723
48740
  var e = this, r = e._self._c;
48724
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) {
48725
- 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: "" }, on: { blur: function(n) {
48726
- return n.stopPropagation(), e.onBlur();
48727
- } }, model: { value: a.name, callback: function(n) {
48728
- e.$set(a, "name", n);
48729
- }, expression: "item.name" } }) : r("span", [e._v(e._s(a.name))])], 1), r("div", { staticClass: "border rounded-lg sortable-item-action" }, [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) {
48730
48753
  return n.stopPropagation(), e.onClick(a, i);
48731
48754
  } } }, [r("i", { staticClass: "fas fa-edit" })]), r("div", { staticClass: "sortable-item-vr" }), r("button", { staticClass: "btn", on: { click: function(n) {
48732
48755
  return e.$emit("item-delete", a);
@@ -48744,7 +48767,7 @@ var ZX = function() {
48744
48767
  XX,
48745
48768
  !1,
48746
48769
  null,
48747
- "79fd3284",
48770
+ "783e3808",
48748
48771
  null,
48749
48772
  null
48750
48773
  );
@@ -49063,12 +49086,21 @@ const oee = [
49063
49086
  }), t.open = !0;
49064
49087
  },
49065
49088
  migrateConfig(t = this.config) {
49066
- 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(
49067
49090
  (e) => this.removeDataVariableFromNestedScreens(e.items)
49068
49091
  ), t.forEach((e, r) => {
49069
49092
  e.order = e.order || r + 1;
49070
49093
  });
49071
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
+ },
49072
49104
  updateFieldNameValidation(t) {
49073
49105
  t.forEach((e) => {
49074
49106
  e.inspector && e.inspector.forEach((r) => {
@@ -49204,8 +49236,8 @@ const oee = [
49204
49236
  this.config[this.editPageIndex].name = this.editPageName, this.updateState();
49205
49237
  },
49206
49238
  addPage(t) {
49207
- if (this.showAddPageValidations = !0, this.checkPageName(this.addPageName, !0)) {
49208
- t.preventDefault();
49239
+ if (this.checkPageName(this.addPageName, !0)) {
49240
+ this.showAddPageValidations = !0, t.preventDefault();
49209
49241
  return;
49210
49242
  }
49211
49243
  const r = this.config.reduce((a, i) => i.order > a ? i.order : a, 0);
@@ -49255,7 +49287,7 @@ const oee = [
49255
49287
  this.config = t, ja.ProcessMaker.alert(e.message, "danger");
49256
49288
  return;
49257
49289
  }
49258
- this.$store.dispatch("undoRedoModule/pushState", {
49290
+ this.updatePageOrder(this.config), this.$store.dispatch("undoRedoModule/pushState", {
49259
49291
  config: JSON.stringify(this.config),
49260
49292
  currentPage: this.currentPage,
49261
49293
  deletedPage: !0
@@ -49456,7 +49488,7 @@ var dee = function() {
49456
49488
  pee,
49457
49489
  !1,
49458
49490
  null,
49459
- "6dca9fa7",
49491
+ "fdf4961e",
49460
49492
  null,
49461
49493
  null
49462
49494
  );