@juzhenfe/page-model 3.9.37 → 3.9.39

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/dist/index.es.js CHANGED
@@ -217,11 +217,11 @@ function retryFunc(fn, isCanExecute, retryTimes = 3, interval = 100) {
217
217
  });
218
218
  };
219
219
  }
220
- const _hoisted_1$t = { class: "scenes-tab" };
220
+ const _hoisted_1$s = { class: "scenes-tab" };
221
221
  const __default__$n = {
222
222
  name: "ScenesTab"
223
223
  };
224
- const _sfc_main$S = defineComponent({
224
+ const _sfc_main$R = defineComponent({
225
225
  ...__default__$n,
226
226
  setup(__props, { expose: __expose }) {
227
227
  const getValue = () => {
@@ -231,7 +231,7 @@ const _sfc_main$S = defineComponent({
231
231
  getValue
232
232
  });
233
233
  return (_ctx, _cache) => {
234
- return openBlock(), createElementBlock("div", _hoisted_1$t);
234
+ return openBlock(), createElementBlock("div", _hoisted_1$s);
235
235
  };
236
236
  }
237
237
  });
@@ -239,7 +239,7 @@ var index_vue_vue_type_style_index_0_lang$c = "";
239
239
  const __default__$m = {
240
240
  name: "NormalTab"
241
241
  };
242
- const _sfc_main$R = defineComponent({
242
+ const _sfc_main$Q = defineComponent({
243
243
  ...__default__$m,
244
244
  props: {
245
245
  panes: {},
@@ -1003,6 +1003,8 @@ class IManager extends Reflections {
1003
1003
  updateStaticData(data) {
1004
1004
  this.staticData = data;
1005
1005
  }
1006
+ destroy() {
1007
+ }
1006
1008
  }
1007
1009
  class TopTabsManager extends IManager {
1008
1010
  constructor() {
@@ -1035,7 +1037,7 @@ var index_vue_vue_type_style_index_0_lang$b = "";
1035
1037
  const __default__$l = {
1036
1038
  name: "TopTabs"
1037
1039
  };
1038
- const _sfc_main$Q = defineComponent({
1040
+ const _sfc_main$P = defineComponent({
1039
1041
  ...__default__$l,
1040
1042
  props: {
1041
1043
  tabs: {},
@@ -1056,12 +1058,12 @@ const _sfc_main$Q = defineComponent({
1056
1058
  const tabComponent = computed(() => {
1057
1059
  if (props.tabs.useScene) {
1058
1060
  return {
1059
- component: _sfc_main$S,
1061
+ component: _sfc_main$R,
1060
1062
  props: props.tabs.sceneTab
1061
1063
  };
1062
1064
  } else {
1063
1065
  return {
1064
- component: _sfc_main$R,
1066
+ component: _sfc_main$Q,
1065
1067
  props: {
1066
1068
  panes: props.tabs.panes,
1067
1069
  props: props.tabs.props
@@ -1681,29 +1683,8 @@ var _export_sfc$1 = (sfc, props) => {
1681
1683
  }
1682
1684
  return target;
1683
1685
  };
1684
- const _sfc_main$P = defineComponent({
1685
- name: "ArrowDownBold"
1686
- });
1687
- const _hoisted_1$s = {
1688
- class: "icon",
1689
- width: "200",
1690
- height: "200",
1691
- viewBox: "0 0 1024 1024",
1692
- xmlns: "http://www.w3.org/2000/svg"
1693
- };
1694
- const _hoisted_2$n = /* @__PURE__ */ createElementVNode("path", {
1695
- fill: "currentColor",
1696
- d: "M104.704 338.752a64 64 0 0190.496 0l316.8 316.8 316.8-316.8a64 64 0 0190.496 90.496L557.248 791.296a64 64 0 01-90.496 0L104.704 429.248a64 64 0 010-90.496z"
1697
- }, null, -1);
1698
- const _hoisted_3$m = [
1699
- _hoisted_2$n
1700
- ];
1701
- function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
1702
- return openBlock(), createElementBlock("svg", _hoisted_1$s, _hoisted_3$m);
1703
- }
1704
- var arrowDownBold = /* @__PURE__ */ _export_sfc$1(_sfc_main$P, [["render", _sfc_render$h]]);
1705
1686
  const _sfc_main$O = defineComponent({
1706
- name: "ArrowDown"
1687
+ name: "ArrowDownBold"
1707
1688
  });
1708
1689
  const _hoisted_1$r = {
1709
1690
  class: "icon",
@@ -1714,7 +1695,7 @@ const _hoisted_1$r = {
1714
1695
  };
1715
1696
  const _hoisted_2$m = /* @__PURE__ */ createElementVNode("path", {
1716
1697
  fill: "currentColor",
1717
- d: "M831.872 340.864L512 652.672 192.128 340.864a30.592 30.592 0 00-42.752 0 29.12 29.12 0 000 41.6L489.664 714.24a32 32 0 0044.672 0l340.288-331.712a29.12 29.12 0 000-41.728 30.592 30.592 0 00-42.752 0z"
1698
+ d: "M104.704 338.752a64 64 0 0190.496 0l316.8 316.8 316.8-316.8a64 64 0 0190.496 90.496L557.248 791.296a64 64 0 01-90.496 0L104.704 429.248a64 64 0 010-90.496z"
1718
1699
  }, null, -1);
1719
1700
  const _hoisted_3$l = [
1720
1701
  _hoisted_2$m
@@ -1722,9 +1703,9 @@ const _hoisted_3$l = [
1722
1703
  function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
1723
1704
  return openBlock(), createElementBlock("svg", _hoisted_1$r, _hoisted_3$l);
1724
1705
  }
1725
- var arrowDown = /* @__PURE__ */ _export_sfc$1(_sfc_main$O, [["render", _sfc_render$g]]);
1706
+ var arrowDownBold = /* @__PURE__ */ _export_sfc$1(_sfc_main$O, [["render", _sfc_render$g]]);
1726
1707
  const _sfc_main$N = defineComponent({
1727
- name: "CaretBottom"
1708
+ name: "ArrowDown"
1728
1709
  });
1729
1710
  const _hoisted_1$q = {
1730
1711
  class: "icon",
@@ -1735,7 +1716,7 @@ const _hoisted_1$q = {
1735
1716
  };
1736
1717
  const _hoisted_2$l = /* @__PURE__ */ createElementVNode("path", {
1737
1718
  fill: "currentColor",
1738
- d: "M192 384l320 384 320-384z"
1719
+ d: "M831.872 340.864L512 652.672 192.128 340.864a30.592 30.592 0 00-42.752 0 29.12 29.12 0 000 41.6L489.664 714.24a32 32 0 0044.672 0l340.288-331.712a29.12 29.12 0 000-41.728 30.592 30.592 0 00-42.752 0z"
1739
1720
  }, null, -1);
1740
1721
  const _hoisted_3$k = [
1741
1722
  _hoisted_2$l
@@ -1743,9 +1724,9 @@ const _hoisted_3$k = [
1743
1724
  function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
1744
1725
  return openBlock(), createElementBlock("svg", _hoisted_1$q, _hoisted_3$k);
1745
1726
  }
1746
- var caretBottom = /* @__PURE__ */ _export_sfc$1(_sfc_main$N, [["render", _sfc_render$f]]);
1727
+ var arrowDown = /* @__PURE__ */ _export_sfc$1(_sfc_main$N, [["render", _sfc_render$f]]);
1747
1728
  const _sfc_main$M = defineComponent({
1748
- name: "CaretRight"
1729
+ name: "CaretBottom"
1749
1730
  });
1750
1731
  const _hoisted_1$p = {
1751
1732
  class: "icon",
@@ -1756,7 +1737,7 @@ const _hoisted_1$p = {
1756
1737
  };
1757
1738
  const _hoisted_2$k = /* @__PURE__ */ createElementVNode("path", {
1758
1739
  fill: "currentColor",
1759
- d: "M384 192v640l384-320.064z"
1740
+ d: "M192 384l320 384 320-384z"
1760
1741
  }, null, -1);
1761
1742
  const _hoisted_3$j = [
1762
1743
  _hoisted_2$k
@@ -1764,9 +1745,9 @@ const _hoisted_3$j = [
1764
1745
  function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
1765
1746
  return openBlock(), createElementBlock("svg", _hoisted_1$p, _hoisted_3$j);
1766
1747
  }
1767
- var caretRight = /* @__PURE__ */ _export_sfc$1(_sfc_main$M, [["render", _sfc_render$e]]);
1748
+ var caretBottom = /* @__PURE__ */ _export_sfc$1(_sfc_main$M, [["render", _sfc_render$e]]);
1768
1749
  const _sfc_main$L = defineComponent({
1769
- name: "CaretTop"
1750
+ name: "CaretRight"
1770
1751
  });
1771
1752
  const _hoisted_1$o = {
1772
1753
  class: "icon",
@@ -1777,7 +1758,7 @@ const _hoisted_1$o = {
1777
1758
  };
1778
1759
  const _hoisted_2$j = /* @__PURE__ */ createElementVNode("path", {
1779
1760
  fill: "currentColor",
1780
- d: "M512 320L192 704h639.936z"
1761
+ d: "M384 192v640l384-320.064z"
1781
1762
  }, null, -1);
1782
1763
  const _hoisted_3$i = [
1783
1764
  _hoisted_2$j
@@ -1785,9 +1766,9 @@ const _hoisted_3$i = [
1785
1766
  function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
1786
1767
  return openBlock(), createElementBlock("svg", _hoisted_1$o, _hoisted_3$i);
1787
1768
  }
1788
- var caretTop = /* @__PURE__ */ _export_sfc$1(_sfc_main$L, [["render", _sfc_render$d]]);
1769
+ var caretRight = /* @__PURE__ */ _export_sfc$1(_sfc_main$L, [["render", _sfc_render$d]]);
1789
1770
  const _sfc_main$K = defineComponent({
1790
- name: "CirclePlusFilled"
1771
+ name: "CaretTop"
1791
1772
  });
1792
1773
  const _hoisted_1$n = {
1793
1774
  class: "icon",
@@ -1798,7 +1779,7 @@ const _hoisted_1$n = {
1798
1779
  };
1799
1780
  const _hoisted_2$i = /* @__PURE__ */ createElementVNode("path", {
1800
1781
  fill: "currentColor",
1801
- d: "M512 64a448 448 0 110 896 448 448 0 010-896zm-38.4 409.6H326.4a38.4 38.4 0 100 76.8h147.2v147.2a38.4 38.4 0 0076.8 0V550.4h147.2a38.4 38.4 0 000-76.8H550.4V326.4a38.4 38.4 0 10-76.8 0v147.2z"
1782
+ d: "M512 320L192 704h639.936z"
1802
1783
  }, null, -1);
1803
1784
  const _hoisted_3$h = [
1804
1785
  _hoisted_2$i
@@ -1806,9 +1787,9 @@ const _hoisted_3$h = [
1806
1787
  function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
1807
1788
  return openBlock(), createElementBlock("svg", _hoisted_1$n, _hoisted_3$h);
1808
1789
  }
1809
- var circlePlusFilled = /* @__PURE__ */ _export_sfc$1(_sfc_main$K, [["render", _sfc_render$c]]);
1790
+ var caretTop = /* @__PURE__ */ _export_sfc$1(_sfc_main$K, [["render", _sfc_render$c]]);
1810
1791
  const _sfc_main$J = defineComponent({
1811
- name: "CirclePlus"
1792
+ name: "CirclePlusFilled"
1812
1793
  });
1813
1794
  const _hoisted_1$m = {
1814
1795
  class: "icon",
@@ -1819,27 +1800,17 @@ const _hoisted_1$m = {
1819
1800
  };
1820
1801
  const _hoisted_2$h = /* @__PURE__ */ createElementVNode("path", {
1821
1802
  fill: "currentColor",
1822
- d: "M352 480h320a32 32 0 110 64H352a32 32 0 010-64z"
1823
- }, null, -1);
1824
- const _hoisted_3$g = /* @__PURE__ */ createElementVNode("path", {
1825
- fill: "currentColor",
1826
- d: "M480 672V352a32 32 0 1164 0v320a32 32 0 01-64 0z"
1827
- }, null, -1);
1828
- const _hoisted_4$5 = /* @__PURE__ */ createElementVNode("path", {
1829
- fill: "currentColor",
1830
- d: "M512 896a384 384 0 100-768 384 384 0 000 768zm0 64a448 448 0 110-896 448 448 0 010 896z"
1803
+ d: "M512 64a448 448 0 110 896 448 448 0 010-896zm-38.4 409.6H326.4a38.4 38.4 0 100 76.8h147.2v147.2a38.4 38.4 0 0076.8 0V550.4h147.2a38.4 38.4 0 000-76.8H550.4V326.4a38.4 38.4 0 10-76.8 0v147.2z"
1831
1804
  }, null, -1);
1832
- const _hoisted_5$3 = [
1833
- _hoisted_2$h,
1834
- _hoisted_3$g,
1835
- _hoisted_4$5
1805
+ const _hoisted_3$g = [
1806
+ _hoisted_2$h
1836
1807
  ];
1837
1808
  function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
1838
- return openBlock(), createElementBlock("svg", _hoisted_1$m, _hoisted_5$3);
1809
+ return openBlock(), createElementBlock("svg", _hoisted_1$m, _hoisted_3$g);
1839
1810
  }
1840
- var circlePlus = /* @__PURE__ */ _export_sfc$1(_sfc_main$J, [["render", _sfc_render$b]]);
1811
+ var circlePlusFilled = /* @__PURE__ */ _export_sfc$1(_sfc_main$J, [["render", _sfc_render$b]]);
1841
1812
  const _sfc_main$I = defineComponent({
1842
- name: "CloseBold"
1813
+ name: "CirclePlus"
1843
1814
  });
1844
1815
  const _hoisted_1$l = {
1845
1816
  class: "icon",
@@ -1850,40 +1821,51 @@ const _hoisted_1$l = {
1850
1821
  };
1851
1822
  const _hoisted_2$g = /* @__PURE__ */ createElementVNode("path", {
1852
1823
  fill: "currentColor",
1853
- d: "M195.2 195.2a64 64 0 0190.496 0L512 421.504 738.304 195.2a64 64 0 0190.496 90.496L602.496 512 828.8 738.304a64 64 0 01-90.496 90.496L512 602.496 285.696 828.8a64 64 0 01-90.496-90.496L421.504 512 195.2 285.696a64 64 0 010-90.496z"
1824
+ d: "M352 480h320a32 32 0 110 64H352a32 32 0 010-64z"
1854
1825
  }, null, -1);
1855
- const _hoisted_3$f = [
1856
- _hoisted_2$g
1826
+ const _hoisted_3$f = /* @__PURE__ */ createElementVNode("path", {
1827
+ fill: "currentColor",
1828
+ d: "M480 672V352a32 32 0 1164 0v320a32 32 0 01-64 0z"
1829
+ }, null, -1);
1830
+ const _hoisted_4$6 = /* @__PURE__ */ createElementVNode("path", {
1831
+ fill: "currentColor",
1832
+ d: "M512 896a384 384 0 100-768 384 384 0 000 768zm0 64a448 448 0 110-896 448 448 0 010 896z"
1833
+ }, null, -1);
1834
+ const _hoisted_5$3 = [
1835
+ _hoisted_2$g,
1836
+ _hoisted_3$f,
1837
+ _hoisted_4$6
1857
1838
  ];
1858
1839
  function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
1859
- return openBlock(), createElementBlock("svg", _hoisted_1$l, _hoisted_3$f);
1840
+ return openBlock(), createElementBlock("svg", _hoisted_1$l, _hoisted_5$3);
1860
1841
  }
1861
- var closeBold = /* @__PURE__ */ _export_sfc$1(_sfc_main$I, [["render", _sfc_render$a]]);
1842
+ var circlePlus = /* @__PURE__ */ _export_sfc$1(_sfc_main$I, [["render", _sfc_render$a]]);
1862
1843
  const _sfc_main$H = defineComponent({
1863
- name: "EditPen"
1844
+ name: "Edit"
1864
1845
  });
1865
1846
  const _hoisted_1$k = {
1866
- t: "1639990532110",
1867
1847
  class: "icon",
1868
- viewBox: "0 0 1024 1024",
1869
- version: "1.1",
1870
- xmlns: "http://www.w3.org/2000/svg",
1871
- "p-id": "12171",
1872
- "xmlns:xlink": "http://www.w3.org/1999/xlink",
1873
1848
  width: "200",
1874
- height: "200"
1849
+ height: "200",
1850
+ viewBox: "0 0 1024 1024",
1851
+ xmlns: "http://www.w3.org/2000/svg"
1875
1852
  };
1876
1853
  const _hoisted_2$f = /* @__PURE__ */ createElementVNode("path", {
1877
- d: "M199.04 672.64l193.984 112 224-387.968-193.92-112-224 388.032z m-23.872 60.16l32.896 148.288 144.896-45.696-177.792-102.592zM455.04 229.248l193.92 112 56.704-98.112-193.984-112-56.64 98.112zM104.32 708.8l384-665.024 304.768 175.936-383.936 665.088h0.064l-248.448 78.336-56.448-254.336z m384 254.272v-64h448v64h-448z",
1878
- "p-id": "12172"
1854
+ fill: "currentColor",
1855
+ d: "M832 512a32 32 0 1164 0v352a32 32 0 01-32 32H160a32 32 0 01-32-32V160a32 32 0 0132-32h352a32 32 0 010 64H192v640h640V512z"
1879
1856
  }, null, -1);
1880
- const _hoisted_3$e = [
1881
- _hoisted_2$f
1857
+ const _hoisted_3$e = /* @__PURE__ */ createElementVNode("path", {
1858
+ fill: "currentColor",
1859
+ d: "M469.952 554.24l52.8-7.552L847.104 222.4a32 32 0 10-45.248-45.248L477.44 501.44l-7.552 52.8zm422.4-422.4a96 96 0 010 135.808l-331.84 331.84a32 32 0 01-18.112 9.088L436.8 623.68a32 32 0 01-36.224-36.224l15.104-105.6a32 32 0 019.024-18.112l331.904-331.84a96 96 0 01135.744 0z"
1860
+ }, null, -1);
1861
+ const _hoisted_4$5 = [
1862
+ _hoisted_2$f,
1863
+ _hoisted_3$e
1882
1864
  ];
1883
1865
  function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
1884
- return openBlock(), createElementBlock("svg", _hoisted_1$k, _hoisted_3$e);
1866
+ return openBlock(), createElementBlock("svg", _hoisted_1$k, _hoisted_4$5);
1885
1867
  }
1886
- var editPen = /* @__PURE__ */ _export_sfc$1(_sfc_main$H, [["render", _sfc_render$9]]);
1868
+ var edit = /* @__PURE__ */ _export_sfc$1(_sfc_main$H, [["render", _sfc_render$9]]);
1887
1869
  const _sfc_main$G = defineComponent({
1888
1870
  name: "Filter"
1889
1871
  });
@@ -6436,6 +6418,9 @@ const _PageModelManager = class extends Reflections {
6436
6418
  this.loadingInstance && this.loadingInstance.close();
6437
6419
  }
6438
6420
  destroy() {
6421
+ this.children.forEach((item) => {
6422
+ item.destroy();
6423
+ });
6439
6424
  this.destroyReflect();
6440
6425
  }
6441
6426
  };
@@ -6844,8 +6829,8 @@ class TableManager extends IManager {
6844
6829
  __publicField(this, "randomRowKey", null);
6845
6830
  __publicField(this, "totalEls", []);
6846
6831
  __publicField(this, "focusCellKey");
6847
- __publicField(this, "currentRow");
6848
- __publicField(this, "currentColumn");
6832
+ __publicField(this, "focusEl");
6833
+ __publicField(this, "documentClickHandler");
6849
6834
  __publicField(this, "radioData", null);
6850
6835
  __publicField(this, "currentRenderTableEls");
6851
6836
  __publicField(this, "innerFilters", null);
@@ -7063,21 +7048,54 @@ class TableManager extends IManager {
7063
7048
  });
7064
7049
  }.bind(this);
7065
7050
  }
7066
- composeTableCellKey(columnKey, rowIndex) {
7067
- const currentPage = this.currentPage;
7068
- return `column-${columnKey}_${currentPage}_${rowIndex}`;
7051
+ composeTableCellKey(columnKey, rowKey) {
7052
+ return `cell-${columnKey}_${rowKey}`;
7053
+ }
7054
+ composeTableCellKeyByData(column, row) {
7055
+ return this.composeTableCellKey(column.columnKey, row[this.rowKey]);
7069
7056
  }
7070
- blurCell(blurRowData, blurColumn) {
7057
+ blurCell() {
7071
7058
  if (this.focusCellKey) {
7072
7059
  const cellEle = document.querySelector(`#${this.focusCellKey}`);
7073
7060
  cellEle.setAttribute("data-focus", "false");
7074
- if (cellEle.getAttribute("data-edit") === "true") {
7075
- const tableEl = this.currentRenderTableEls.find((el) => el._key === blurColumn.columnKey);
7076
- this.restoreCellValue(blurRowData, this.focusCellKey, tableEl.editData.prop || tableEl.prop);
7077
- }
7078
7061
  this.closeCellEditing(this.focusCellKey);
7062
+ this.focusCellKey = null;
7079
7063
  }
7080
7064
  }
7065
+ removeCellOutClickEvent() {
7066
+ if (this.documentClickHandler) {
7067
+ document.removeEventListener("click", this.documentClickHandler);
7068
+ }
7069
+ }
7070
+ bindCellOutClickEvent() {
7071
+ this.removeCellOutClickEvent();
7072
+ const handler = (e) => {
7073
+ if (!this.focusCellKey) {
7074
+ return;
7075
+ }
7076
+ const clickElement = e.target;
7077
+ let isInCurrentCell = false;
7078
+ let loopElement = clickElement;
7079
+ let poperClass = "";
7080
+ if (this.focusEl.editData.triggerPoperClassName) {
7081
+ poperClass = this.focusEl.editData.triggerPoperClassName;
7082
+ } else {
7083
+ poperClass = this.focusEl.editData.eType;
7084
+ }
7085
+ while (loopElement) {
7086
+ if (loopElement.getAttribute("cell-key") === this.focusCellKey || loopElement.className && poperClass && typeof loopElement.className === "string" && loopElement.className.includes(poperClass)) {
7087
+ isInCurrentCell = true;
7088
+ break;
7089
+ }
7090
+ loopElement = loopElement.parentElement;
7091
+ }
7092
+ if (!isInCurrentCell) {
7093
+ this.blurCell();
7094
+ }
7095
+ };
7096
+ this.documentClickHandler = handler;
7097
+ document.addEventListener("click", handler);
7098
+ }
7081
7099
  focusCell(cell) {
7082
7100
  if (this.focusCellKey) {
7083
7101
  let focusCell = cell != null ? cell : document.querySelector(`#${this.focusCellKey}`);
@@ -7100,43 +7118,43 @@ class TableManager extends IManager {
7100
7118
  if (!editable) {
7101
7119
  return false;
7102
7120
  }
7103
- const tableEl = this.currentRenderTableEls.find((el) => el._key === column.columnKey);
7121
+ const tableEl = this.currentRenderTableEls.find(
7122
+ (el) => el._key === column.columnKey
7123
+ );
7104
7124
  if (typeof ((_a = tableEl.editData) == null ? void 0 : _a.isDisabled) === "function") {
7105
7125
  const isDisabled = tableEl.editData.isDisabled.call(this, row);
7106
7126
  if (isDisabled) {
7107
7127
  return false;
7108
7128
  }
7109
7129
  }
7110
- const rowIndex = cellInnerContainer.getAttribute("data-index");
7111
- const cellKey = this.composeTableCellKey(column.columnKey, rowIndex);
7112
- if (this.focusCellKey !== cellKey) {
7113
- this.blurCell(this.currentRow, this.currentColumn);
7114
- cell.id = this.focusCellKey = cellKey;
7115
- this.focusCell(cell);
7116
- return false;
7130
+ const cellKey = this.composeTableCellKeyByData(column, row);
7131
+ if (this.focusCellKey && this.focusCellKey !== cellKey) {
7132
+ this.blurCell();
7117
7133
  }
7118
- this.currentRow = row;
7119
- this.currentColumn = column;
7120
- this.setCellEditing(cellKey);
7121
- this.saveRowData(cellKey, row);
7134
+ cell.id = this.focusCellKey = cellKey;
7135
+ this.focusEl = tableEl;
7136
+ this.focusCell(cell);
7122
7137
  }.bind(this);
7138
+ this.bindCellOutClickEvent();
7123
7139
  }
7124
7140
  setCellEditing(cellKey) {
7141
+ this.editableOpen.clear();
7125
7142
  this.editableOpen.set(cellKey, true);
7126
- const cellEle = document.querySelector(`#${this.focusCellKey}`);
7143
+ const cellEle = document.querySelector(`#${cellKey}`);
7127
7144
  cellEle.setAttribute("data-edit", "true");
7128
- nextTick(() => {
7129
- var _a;
7145
+ setTimeout(() => {
7146
+ var _a, _b;
7130
7147
  (_a = cellEle.querySelector("input")) == null ? void 0 : _a.focus();
7131
- });
7148
+ (_b = cellEle.querySelector("input")) == null ? void 0 : _b.click();
7149
+ }, 0);
7132
7150
  }
7133
7151
  closeCellEditing(cellKey) {
7134
7152
  this.editableOpen.set(cellKey, false);
7135
7153
  const cellEle = document.querySelector(`#${this.focusCellKey}`);
7136
- cellEle.setAttribute("data-edit", "false");
7154
+ cellEle && cellEle.setAttribute("data-edit", "false");
7137
7155
  }
7138
7156
  saveRowData(cellKey, data) {
7139
- this.editableData.set(cellKey, JSON.parse(JSON.stringify(data)));
7157
+ this.editableData.set(cellKey, JSON.stringify(data));
7140
7158
  }
7141
7159
  clearRowData(cellKey) {
7142
7160
  this.editableData.delete(cellKey);
@@ -7145,18 +7163,20 @@ class TableManager extends IManager {
7145
7163
  this.editableOpen.set(`${cellKey}-loading`, loading2);
7146
7164
  }
7147
7165
  restoreCellValue(row, cellKey, restoreKey) {
7148
- const originForm = this.editableData.get(cellKey);
7149
- row[restoreKey] = originForm[restoreKey];
7166
+ const originFormString = this.editableData.get(cellKey);
7167
+ try {
7168
+ row[restoreKey] = JSON.parse(originFormString)[restoreKey];
7169
+ } catch (error) {
7170
+ console.log("restoreCellValue error", error);
7171
+ }
7150
7172
  }
7151
7173
  resetTableEdit() {
7152
7174
  if (this.table.editable) {
7153
7175
  if (this.focusCellKey) {
7154
- this.blurCell(this.currentRow, this.currentColumn);
7176
+ this.blurCell();
7155
7177
  }
7156
7178
  this.editableData.clear();
7157
7179
  this.editableOpen.clear();
7158
- this.currentRow = null;
7159
- this.currentColumn = null;
7160
7180
  this.focusCellKey = null;
7161
7181
  }
7162
7182
  }
@@ -7457,6 +7477,9 @@ class TableManager extends IManager {
7457
7477
  updateScrollLeft(left) {
7458
7478
  this.scrollLeft = left;
7459
7479
  }
7480
+ destroy() {
7481
+ this.removeCellOutClickEvent();
7482
+ }
7460
7483
  }
7461
7484
  const _sfc_main$q = defineComponent({
7462
7485
  name: "TableCellRenderer",
@@ -7498,20 +7521,22 @@ const _sfc_main$q = defineComponent({
7498
7521
  });
7499
7522
  var index_vue_vue_type_style_index_0_lang$6 = "";
7500
7523
  const _hoisted_1$9 = { class: "el-table__header-cell" };
7501
- const _hoisted_2$5 = ["data-index", "editable"];
7524
+ const _hoisted_2$5 = ["data-index", "editable", "cell-key"];
7502
7525
  const _hoisted_3$4 = {
7503
7526
  key: 0,
7504
7527
  class: "el-table-cell_editable"
7505
7528
  };
7506
7529
  const _hoisted_4$3 = { class: "el-table-cell_editable-inputer" };
7507
- const _hoisted_5$2 = { class: "el-table-cell_editable-buttons" };
7508
- const _hoisted_6$2 = ["onClick"];
7509
- const _hoisted_7$2 = ["onClick"];
7510
- const _hoisted_8 = {
7530
+ const _hoisted_5$2 = {
7531
+ key: 0,
7532
+ class: "el-table-cell_loading"
7533
+ };
7534
+ const _hoisted_6$2 = {
7511
7535
  key: 1,
7512
7536
  class: "empty-edit"
7513
7537
  };
7514
- const _hoisted_9 = { key: 0 };
7538
+ const _hoisted_7$2 = { key: 0 };
7539
+ const _hoisted_8 = ["onClick"];
7515
7540
  const __default__$g = {
7516
7541
  name: "TableColumn"
7517
7542
  };
@@ -7526,6 +7551,13 @@ const _sfc_main$p = defineComponent({
7526
7551
  const tableManager = computed(() => {
7527
7552
  return props.context;
7528
7553
  });
7554
+ const handleClickEditIcon = (column, row) => {
7555
+ setTimeout(() => {
7556
+ const cellKey = tableManager.value.composeTableCellKeyByData(column, row);
7557
+ tableManager.value.setCellEditing(cellKey);
7558
+ tableManager.value.saveRowData(cellKey, row);
7559
+ }, 0);
7560
+ };
7529
7561
  const onUpdateTableCellModelValue = (row, prop, value) => {
7530
7562
  row[prop] = value;
7531
7563
  };
@@ -7554,30 +7586,40 @@ const _sfc_main$p = defineComponent({
7554
7586
  let updateResult;
7555
7587
  props.context.setRowUpdateLoading(cellKey, true);
7556
7588
  try {
7557
- if (column.editData.api) {
7558
- let api = typeof column.editData.api === "function" ? column.editData.api.call(tableManager, submitData) : column.editData.api;
7559
- updateResult = await manager.baseUpdDataRequest(
7560
- api,
7561
- column.editData.method || tableManager.value.config.updMethod,
7562
- submitData
7563
- );
7589
+ let updateFn;
7590
+ if (column.editData.customUpdate) {
7591
+ updateFn = column.editData.customUpdate.bind(tableManager, submitData);
7564
7592
  } else {
7565
- updateResult = await manager.postUpdDataRequest(submitData);
7593
+ if (column.editData.api) {
7594
+ let api = typeof column.editData.api === "function" ? column.editData.api.call(manager, submitData) : column.editData.api;
7595
+ updateFn = manager.baseUpdDataRequest.bind(
7596
+ manager,
7597
+ api,
7598
+ column.editData.method || tableManager.value.config.updMethod,
7599
+ submitData
7600
+ );
7601
+ } else {
7602
+ updateFn = manager.postUpdDataRequest.bind(manager, submitData);
7603
+ }
7566
7604
  }
7567
- if (updateResult) {
7605
+ updateResult = await updateFn();
7606
+ if (updateResult !== false) {
7568
7607
  props.context.closeCellEditing(cellKey);
7608
+ props.context.clearRowData(cellKey);
7569
7609
  } else {
7570
7610
  onCancelEditContent(row, cellKey, column.editData.prop || column.prop);
7571
7611
  }
7572
7612
  } catch (error) {
7613
+ console.log("custom edit error", error);
7614
+ onCancelEditContent(row, cellKey, column.editData.prop || column.prop);
7573
7615
  } finally {
7574
7616
  props.context.setRowUpdateLoading(cellKey, false);
7575
7617
  }
7576
7618
  };
7619
+ const onCellDataChange = (row, cellKey, column) => {
7620
+ onSaveEditContent(row, cellKey, column);
7621
+ };
7577
7622
  const onCancelEditContent = (row, cellKey, restoreKey) => {
7578
- if (tableManager.value.editableOpen.get(`${cellKey}-loading`)) {
7579
- return;
7580
- }
7581
7623
  props.context.closeCellEditing(cellKey);
7582
7624
  props.context.restoreCellValue(row, cellKey, restoreKey);
7583
7625
  props.context.clearRowData(cellKey);
@@ -7598,16 +7640,16 @@ const _sfc_main$p = defineComponent({
7598
7640
  }, column.props), {
7599
7641
  header: withCtx(($header) => [
7600
7642
  createElementVNode("div", _hoisted_1$9, [
7601
- createElementVNode("span", null, toDisplayString($header.column.label || ""), 1),
7602
- column.helpText || column.editData || column.icon ? (openBlock(), createBlock(_component_el_icon, {
7643
+ column.helpText || column.icon ? (openBlock(), createBlock(_component_el_icon, {
7603
7644
  key: 0,
7604
7645
  title: column.helpText
7605
7646
  }, {
7606
7647
  default: withCtx(() => [
7607
- column.icon ? (openBlock(), createBlock(resolveDynamicComponent(column.icon), { key: 0 })) : column.editData ? (openBlock(), createBlock(unref(editPen), { key: 1 })) : column.helpText ? (openBlock(), createBlock(unref(questionFilled), { key: 2 })) : createCommentVNode("", true)
7648
+ column.icon ? (openBlock(), createBlock(resolveDynamicComponent(column.icon), { key: 0 })) : column.helpText ? (openBlock(), createBlock(unref(questionFilled), { key: 1 })) : createCommentVNode("", true)
7608
7649
  ]),
7609
7650
  _: 2
7610
- }, 1032, ["title"])) : createCommentVNode("", true)
7651
+ }, 1032, ["title"])) : createCommentVNode("", true),
7652
+ createElementVNode("span", null, toDisplayString($header.column.label || ""), 1)
7611
7653
  ])
7612
7654
  ]),
7613
7655
  default: withCtx(({ row, $index, column: columnEl }) => [
@@ -7621,13 +7663,17 @@ const _sfc_main$p = defineComponent({
7621
7663
  key: 1,
7622
7664
  "data-index": $index,
7623
7665
  editable: column.editData ? 1 : 0,
7666
+ "cell-key": tableManager.value.composeTableCellKey(columnEl.columnKey, row[tableManager.value.rowKey]),
7624
7667
  class: normalizeClass([
7625
7668
  "el-table-cell_inner",
7626
7669
  column.showRowNumbers != null ? `show-${column.showRowNumbers}` : ""
7627
7670
  ])
7628
7671
  }, [
7629
7672
  column.showEdit || tableManager.value.editableOpen.get(
7630
- tableManager.value.composeTableCellKey(columnEl.columnKey, $index)
7673
+ tableManager.value.composeTableCellKey(
7674
+ columnEl.columnKey,
7675
+ row[tableManager.value.rowKey]
7676
+ )
7631
7677
  ) ? (openBlock(), createElementBlock("div", _hoisted_3$4, [
7632
7678
  column.editData ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
7633
7679
  createElementVNode("div", _hoisted_4$3, [
@@ -7641,54 +7687,31 @@ const _sfc_main$p = defineComponent({
7641
7687
  row,
7642
7688
  column.editData.prop || column.prop,
7643
7689
  $event
7644
- )
7645
- }, null, 8, ["modelValue", "renderFn", "context", "options", "model", "onUpdate:modelValue"])
7646
- ]),
7647
- createElementVNode("div", _hoisted_5$2, [
7648
- !column.showEdit ? (openBlock(), createElementBlock("span", {
7649
- key: 0,
7650
- class: "el-table-cell_editable-button btn-save",
7651
- title: "\u4FDD\u5B58",
7652
- onClick: ($event) => onSaveEditContent(
7690
+ ),
7691
+ onChange: ($event) => onCellDataChange(
7653
7692
  row,
7654
- tableManager.value.composeTableCellKey(columnEl.columnKey, $index),
7693
+ tableManager.value.composeTableCellKey(
7694
+ columnEl.columnKey,
7695
+ row[tableManager.value.rowKey]
7696
+ ),
7655
7697
  column
7656
7698
  )
7657
- }, [
7658
- createVNode(_component_el_icon, null, {
7659
- default: withCtx(() => [
7660
- tableManager.value.editableOpen.get(
7661
- `${tableManager.value.composeTableCellKey(
7662
- columnEl.columnKey,
7663
- $index
7664
- )}-loading`
7665
- ) ? (openBlock(), createBlock(unref(loading), {
7666
- key: 0,
7667
- class: "el-table-cell_editable-icon-loading"
7668
- })) : (openBlock(), createBlock(unref(select), { key: 1 }))
7669
- ]),
7670
- _: 2
7671
- }, 1024)
7672
- ], 8, _hoisted_6$2)) : createCommentVNode("", true),
7673
- !column.showEdit ? (openBlock(), createElementBlock("span", {
7674
- key: 1,
7675
- class: "el-table-cell_editable-button btn-cancel",
7676
- title: "\u4FDD\u5B58",
7677
- onClick: ($event) => onCancelEditContent(
7678
- row,
7679
- tableManager.value.composeTableCellKey(columnEl.columnKey, $index),
7680
- column.editData.prop || column.prop
7681
- )
7682
- }, [
7683
- createVNode(_component_el_icon, null, {
7684
- default: withCtx(() => [
7685
- createVNode(unref(closeBold))
7686
- ]),
7687
- _: 1
7688
- })
7689
- ], 8, _hoisted_7$2)) : createCommentVNode("", true)
7690
- ])
7691
- ], 64)) : (openBlock(), createElementBlock("div", _hoisted_8, "\u8BE5\u5217\u672A\u8BBE\u7F6E\u7F16\u8F91\u7EC4\u4EF6"))
7699
+ }, null, 8, ["modelValue", "renderFn", "context", "options", "model", "onUpdate:modelValue", "onChange"])
7700
+ ]),
7701
+ tableManager.value.editableOpen.get(
7702
+ tableManager.value.composeTableCellKey(
7703
+ columnEl.columnKey,
7704
+ row[tableManager.value.rowKey]
7705
+ ) + "-loading"
7706
+ ) ? (openBlock(), createElementBlock("div", _hoisted_5$2, [
7707
+ createVNode(_component_el_icon, { class: "is-loading" }, {
7708
+ default: withCtx(() => [
7709
+ createVNode(unref(loading))
7710
+ ]),
7711
+ _: 1
7712
+ })
7713
+ ])) : createCommentVNode("", true)
7714
+ ], 64)) : (openBlock(), createElementBlock("div", _hoisted_6$2, "\u8BE5\u5217\u672A\u8BBE\u7F6E\u7F16\u8F91\u7EC4\u4EF6"))
7692
7715
  ])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
7693
7716
  column.renderFn && $index !== -1 ? (openBlock(), createBlock(_sfc_main$q, {
7694
7717
  key: 0,
@@ -7698,8 +7721,20 @@ const _sfc_main$p = defineComponent({
7698
7721
  row,
7699
7722
  index: $index
7700
7723
  }, null, 8, ["render-fn", "context", "row", "index"])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
7701
- column.prop ? (openBlock(), createElementBlock("span", _hoisted_9, toDisplayString(row[column.prop]), 1)) : createCommentVNode("", true)
7702
- ], 64))
7724
+ column.prop ? (openBlock(), createElementBlock("span", _hoisted_7$2, toDisplayString(row[column.prop]), 1)) : createCommentVNode("", true)
7725
+ ], 64)),
7726
+ column.editData ? (openBlock(), createElementBlock("span", {
7727
+ key: 2,
7728
+ class: "el-table-cell__edit-icon",
7729
+ onClick: ($event) => handleClickEditIcon(columnEl, row)
7730
+ }, [
7731
+ createVNode(_component_el_icon, { size: 14 }, {
7732
+ default: withCtx(() => [
7733
+ createVNode(unref(edit))
7734
+ ]),
7735
+ _: 1
7736
+ })
7737
+ ], 8, _hoisted_8)) : createCommentVNode("", true)
7703
7738
  ], 64))
7704
7739
  ], 10, _hoisted_2$5))
7705
7740
  ]),
@@ -13929,7 +13964,7 @@ const _sfc_main$4 = defineComponent({
13929
13964
  key: 0,
13930
13965
  class: normalizeClass(unref(createBEMName)("top-tabs"))
13931
13966
  }, [
13932
- hasTabs.value ? (openBlock(), createBlock(_sfc_main$Q, {
13967
+ hasTabs.value ? (openBlock(), createBlock(_sfc_main$P, {
13933
13968
  key: 0,
13934
13969
  tabs: uConfig.value.tabs,
13935
13970
  manager,
@@ -14933,7 +14968,7 @@ const defineEditableTable = function(config) {
14933
14968
  return reactive(config);
14934
14969
  };
14935
14970
  const name = "@juzhenfe/page-model";
14936
- const version = "3.9.37";
14971
+ const version = "3.9.39";
14937
14972
  const types = "dist/main.d.ts";
14938
14973
  const main = "dist/index.umd.js";
14939
14974
  const keywords = [