@juzhenfe/page-model 3.9.36 → 3.9.38

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: {},
@@ -1035,7 +1035,7 @@ var index_vue_vue_type_style_index_0_lang$b = "";
1035
1035
  const __default__$l = {
1036
1036
  name: "TopTabs"
1037
1037
  };
1038
- const _sfc_main$Q = defineComponent({
1038
+ const _sfc_main$P = defineComponent({
1039
1039
  ...__default__$l,
1040
1040
  props: {
1041
1041
  tabs: {},
@@ -1056,12 +1056,12 @@ const _sfc_main$Q = defineComponent({
1056
1056
  const tabComponent = computed(() => {
1057
1057
  if (props.tabs.useScene) {
1058
1058
  return {
1059
- component: _sfc_main$S,
1059
+ component: _sfc_main$R,
1060
1060
  props: props.tabs.sceneTab
1061
1061
  };
1062
1062
  } else {
1063
1063
  return {
1064
- component: _sfc_main$R,
1064
+ component: _sfc_main$Q,
1065
1065
  props: {
1066
1066
  panes: props.tabs.panes,
1067
1067
  props: props.tabs.props
@@ -1681,29 +1681,8 @@ var _export_sfc$1 = (sfc, props) => {
1681
1681
  }
1682
1682
  return target;
1683
1683
  };
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
1684
  const _sfc_main$O = defineComponent({
1706
- name: "ArrowDown"
1685
+ name: "ArrowDownBold"
1707
1686
  });
1708
1687
  const _hoisted_1$r = {
1709
1688
  class: "icon",
@@ -1714,7 +1693,7 @@ const _hoisted_1$r = {
1714
1693
  };
1715
1694
  const _hoisted_2$m = /* @__PURE__ */ createElementVNode("path", {
1716
1695
  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"
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"
1718
1697
  }, null, -1);
1719
1698
  const _hoisted_3$l = [
1720
1699
  _hoisted_2$m
@@ -1722,9 +1701,9 @@ const _hoisted_3$l = [
1722
1701
  function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
1723
1702
  return openBlock(), createElementBlock("svg", _hoisted_1$r, _hoisted_3$l);
1724
1703
  }
1725
- var arrowDown = /* @__PURE__ */ _export_sfc$1(_sfc_main$O, [["render", _sfc_render$g]]);
1704
+ var arrowDownBold = /* @__PURE__ */ _export_sfc$1(_sfc_main$O, [["render", _sfc_render$g]]);
1726
1705
  const _sfc_main$N = defineComponent({
1727
- name: "CaretBottom"
1706
+ name: "ArrowDown"
1728
1707
  });
1729
1708
  const _hoisted_1$q = {
1730
1709
  class: "icon",
@@ -1735,7 +1714,7 @@ const _hoisted_1$q = {
1735
1714
  };
1736
1715
  const _hoisted_2$l = /* @__PURE__ */ createElementVNode("path", {
1737
1716
  fill: "currentColor",
1738
- d: "M192 384l320 384 320-384z"
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"
1739
1718
  }, null, -1);
1740
1719
  const _hoisted_3$k = [
1741
1720
  _hoisted_2$l
@@ -1743,9 +1722,9 @@ const _hoisted_3$k = [
1743
1722
  function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
1744
1723
  return openBlock(), createElementBlock("svg", _hoisted_1$q, _hoisted_3$k);
1745
1724
  }
1746
- var caretBottom = /* @__PURE__ */ _export_sfc$1(_sfc_main$N, [["render", _sfc_render$f]]);
1725
+ var arrowDown = /* @__PURE__ */ _export_sfc$1(_sfc_main$N, [["render", _sfc_render$f]]);
1747
1726
  const _sfc_main$M = defineComponent({
1748
- name: "CaretRight"
1727
+ name: "CaretBottom"
1749
1728
  });
1750
1729
  const _hoisted_1$p = {
1751
1730
  class: "icon",
@@ -1756,7 +1735,7 @@ const _hoisted_1$p = {
1756
1735
  };
1757
1736
  const _hoisted_2$k = /* @__PURE__ */ createElementVNode("path", {
1758
1737
  fill: "currentColor",
1759
- d: "M384 192v640l384-320.064z"
1738
+ d: "M192 384l320 384 320-384z"
1760
1739
  }, null, -1);
1761
1740
  const _hoisted_3$j = [
1762
1741
  _hoisted_2$k
@@ -1764,9 +1743,9 @@ const _hoisted_3$j = [
1764
1743
  function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
1765
1744
  return openBlock(), createElementBlock("svg", _hoisted_1$p, _hoisted_3$j);
1766
1745
  }
1767
- var caretRight = /* @__PURE__ */ _export_sfc$1(_sfc_main$M, [["render", _sfc_render$e]]);
1746
+ var caretBottom = /* @__PURE__ */ _export_sfc$1(_sfc_main$M, [["render", _sfc_render$e]]);
1768
1747
  const _sfc_main$L = defineComponent({
1769
- name: "CaretTop"
1748
+ name: "CaretRight"
1770
1749
  });
1771
1750
  const _hoisted_1$o = {
1772
1751
  class: "icon",
@@ -1777,7 +1756,7 @@ const _hoisted_1$o = {
1777
1756
  };
1778
1757
  const _hoisted_2$j = /* @__PURE__ */ createElementVNode("path", {
1779
1758
  fill: "currentColor",
1780
- d: "M512 320L192 704h639.936z"
1759
+ d: "M384 192v640l384-320.064z"
1781
1760
  }, null, -1);
1782
1761
  const _hoisted_3$i = [
1783
1762
  _hoisted_2$j
@@ -1785,9 +1764,9 @@ const _hoisted_3$i = [
1785
1764
  function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
1786
1765
  return openBlock(), createElementBlock("svg", _hoisted_1$o, _hoisted_3$i);
1787
1766
  }
1788
- var caretTop = /* @__PURE__ */ _export_sfc$1(_sfc_main$L, [["render", _sfc_render$d]]);
1767
+ var caretRight = /* @__PURE__ */ _export_sfc$1(_sfc_main$L, [["render", _sfc_render$d]]);
1789
1768
  const _sfc_main$K = defineComponent({
1790
- name: "CirclePlusFilled"
1769
+ name: "CaretTop"
1791
1770
  });
1792
1771
  const _hoisted_1$n = {
1793
1772
  class: "icon",
@@ -1798,7 +1777,7 @@ const _hoisted_1$n = {
1798
1777
  };
1799
1778
  const _hoisted_2$i = /* @__PURE__ */ createElementVNode("path", {
1800
1779
  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"
1780
+ d: "M512 320L192 704h639.936z"
1802
1781
  }, null, -1);
1803
1782
  const _hoisted_3$h = [
1804
1783
  _hoisted_2$i
@@ -1806,9 +1785,9 @@ const _hoisted_3$h = [
1806
1785
  function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
1807
1786
  return openBlock(), createElementBlock("svg", _hoisted_1$n, _hoisted_3$h);
1808
1787
  }
1809
- var circlePlusFilled = /* @__PURE__ */ _export_sfc$1(_sfc_main$K, [["render", _sfc_render$c]]);
1788
+ var caretTop = /* @__PURE__ */ _export_sfc$1(_sfc_main$K, [["render", _sfc_render$c]]);
1810
1789
  const _sfc_main$J = defineComponent({
1811
- name: "CirclePlus"
1790
+ name: "CirclePlusFilled"
1812
1791
  });
1813
1792
  const _hoisted_1$m = {
1814
1793
  class: "icon",
@@ -1819,27 +1798,17 @@ const _hoisted_1$m = {
1819
1798
  };
1820
1799
  const _hoisted_2$h = /* @__PURE__ */ createElementVNode("path", {
1821
1800
  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"
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"
1831
1802
  }, null, -1);
1832
- const _hoisted_5$3 = [
1833
- _hoisted_2$h,
1834
- _hoisted_3$g,
1835
- _hoisted_4$5
1803
+ const _hoisted_3$g = [
1804
+ _hoisted_2$h
1836
1805
  ];
1837
1806
  function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
1838
- return openBlock(), createElementBlock("svg", _hoisted_1$m, _hoisted_5$3);
1807
+ return openBlock(), createElementBlock("svg", _hoisted_1$m, _hoisted_3$g);
1839
1808
  }
1840
- var circlePlus = /* @__PURE__ */ _export_sfc$1(_sfc_main$J, [["render", _sfc_render$b]]);
1809
+ var circlePlusFilled = /* @__PURE__ */ _export_sfc$1(_sfc_main$J, [["render", _sfc_render$b]]);
1841
1810
  const _sfc_main$I = defineComponent({
1842
- name: "CloseBold"
1811
+ name: "CirclePlus"
1843
1812
  });
1844
1813
  const _hoisted_1$l = {
1845
1814
  class: "icon",
@@ -1850,40 +1819,51 @@ const _hoisted_1$l = {
1850
1819
  };
1851
1820
  const _hoisted_2$g = /* @__PURE__ */ createElementVNode("path", {
1852
1821
  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"
1822
+ d: "M352 480h320a32 32 0 110 64H352a32 32 0 010-64z"
1823
+ }, null, -1);
1824
+ const _hoisted_3$f = /* @__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$6 = /* @__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"
1854
1831
  }, null, -1);
1855
- const _hoisted_3$f = [
1856
- _hoisted_2$g
1832
+ const _hoisted_5$3 = [
1833
+ _hoisted_2$g,
1834
+ _hoisted_3$f,
1835
+ _hoisted_4$6
1857
1836
  ];
1858
1837
  function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
1859
- return openBlock(), createElementBlock("svg", _hoisted_1$l, _hoisted_3$f);
1838
+ return openBlock(), createElementBlock("svg", _hoisted_1$l, _hoisted_5$3);
1860
1839
  }
1861
- var closeBold = /* @__PURE__ */ _export_sfc$1(_sfc_main$I, [["render", _sfc_render$a]]);
1840
+ var circlePlus = /* @__PURE__ */ _export_sfc$1(_sfc_main$I, [["render", _sfc_render$a]]);
1862
1841
  const _sfc_main$H = defineComponent({
1863
- name: "EditPen"
1842
+ name: "Edit"
1864
1843
  });
1865
1844
  const _hoisted_1$k = {
1866
- t: "1639990532110",
1867
1845
  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
1846
  width: "200",
1874
- height: "200"
1847
+ height: "200",
1848
+ viewBox: "0 0 1024 1024",
1849
+ xmlns: "http://www.w3.org/2000/svg"
1875
1850
  };
1876
1851
  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"
1852
+ fill: "currentColor",
1853
+ 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"
1854
+ }, null, -1);
1855
+ const _hoisted_3$e = /* @__PURE__ */ createElementVNode("path", {
1856
+ fill: "currentColor",
1857
+ 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"
1879
1858
  }, null, -1);
1880
- const _hoisted_3$e = [
1881
- _hoisted_2$f
1859
+ const _hoisted_4$5 = [
1860
+ _hoisted_2$f,
1861
+ _hoisted_3$e
1882
1862
  ];
1883
1863
  function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
1884
- return openBlock(), createElementBlock("svg", _hoisted_1$k, _hoisted_3$e);
1864
+ return openBlock(), createElementBlock("svg", _hoisted_1$k, _hoisted_4$5);
1885
1865
  }
1886
- var editPen = /* @__PURE__ */ _export_sfc$1(_sfc_main$H, [["render", _sfc_render$9]]);
1866
+ var edit = /* @__PURE__ */ _export_sfc$1(_sfc_main$H, [["render", _sfc_render$9]]);
1887
1867
  const _sfc_main$G = defineComponent({
1888
1868
  name: "Filter"
1889
1869
  });
@@ -6844,8 +6824,7 @@ class TableManager extends IManager {
6844
6824
  __publicField(this, "randomRowKey", null);
6845
6825
  __publicField(this, "totalEls", []);
6846
6826
  __publicField(this, "focusCellKey");
6847
- __publicField(this, "currentRow");
6848
- __publicField(this, "currentColumn");
6827
+ __publicField(this, "documentClickHandler");
6849
6828
  __publicField(this, "radioData", null);
6850
6829
  __publicField(this, "currentRenderTableEls");
6851
6830
  __publicField(this, "innerFilters", null);
@@ -7063,21 +7042,45 @@ class TableManager extends IManager {
7063
7042
  });
7064
7043
  }.bind(this);
7065
7044
  }
7066
- composeTableCellKey(columnKey, rowIndex) {
7067
- const currentPage = this.currentPage;
7068
- return `column-${columnKey}_${currentPage}_${rowIndex}`;
7045
+ composeTableCellKey(columnKey, rowKey) {
7046
+ return `cell-${columnKey}_${rowKey}`;
7069
7047
  }
7070
- blurCell(blurRowData, blurColumn) {
7048
+ composeTableCellKeyByData(column, row) {
7049
+ return this.composeTableCellKey(column.columnKey, row[this.rowKey]);
7050
+ }
7051
+ blurCell() {
7071
7052
  if (this.focusCellKey) {
7072
7053
  const cellEle = document.querySelector(`#${this.focusCellKey}`);
7073
7054
  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
7055
  this.closeCellEditing(this.focusCellKey);
7056
+ this.focusCellKey = null;
7079
7057
  }
7080
7058
  }
7059
+ bindCellOutClickEvent() {
7060
+ if (this.documentClickHandler) {
7061
+ document.removeEventListener("click", this.documentClickHandler);
7062
+ }
7063
+ const handler = (e) => {
7064
+ if (!this.focusCellKey) {
7065
+ return;
7066
+ }
7067
+ const clickElement = e.target;
7068
+ let isInCurrentCell = false;
7069
+ let loopElement = clickElement;
7070
+ while (loopElement) {
7071
+ if (loopElement.getAttribute("cell-key") === this.focusCellKey) {
7072
+ isInCurrentCell = true;
7073
+ break;
7074
+ }
7075
+ loopElement = loopElement.parentElement;
7076
+ }
7077
+ if (!isInCurrentCell) {
7078
+ this.blurCell();
7079
+ }
7080
+ };
7081
+ this.documentClickHandler = handler;
7082
+ document.addEventListener("click", handler);
7083
+ }
7081
7084
  focusCell(cell) {
7082
7085
  if (this.focusCellKey) {
7083
7086
  let focusCell = cell != null ? cell : document.querySelector(`#${this.focusCellKey}`);
@@ -7100,34 +7103,32 @@ class TableManager extends IManager {
7100
7103
  if (!editable) {
7101
7104
  return false;
7102
7105
  }
7103
- const tableEl = this.currentRenderTableEls.find((el) => el._key === column.columnKey);
7106
+ const tableEl = this.currentRenderTableEls.find(
7107
+ (el) => el._key === column.columnKey
7108
+ );
7104
7109
  if (typeof ((_a = tableEl.editData) == null ? void 0 : _a.isDisabled) === "function") {
7105
7110
  const isDisabled = tableEl.editData.isDisabled.call(this, row);
7106
7111
  if (isDisabled) {
7107
7112
  return false;
7108
7113
  }
7109
7114
  }
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;
7115
+ const cellKey = this.composeTableCellKeyByData(column, row);
7116
+ if (this.focusCellKey && this.focusCellKey !== cellKey) {
7117
+ this.blurCell();
7117
7118
  }
7118
- this.currentRow = row;
7119
- this.currentColumn = column;
7120
- this.setCellEditing(cellKey);
7121
- this.saveRowData(cellKey, row);
7119
+ cell.id = this.focusCellKey = cellKey;
7120
+ this.focusCell(cell);
7122
7121
  }.bind(this);
7122
+ this.bindCellOutClickEvent();
7123
7123
  }
7124
7124
  setCellEditing(cellKey) {
7125
+ this.editableOpen.clear();
7125
7126
  this.editableOpen.set(cellKey, true);
7126
- const cellEle = document.querySelector(`#${this.focusCellKey}`);
7127
+ const cellEle = document.querySelector(`#${cellKey}`);
7127
7128
  cellEle.setAttribute("data-edit", "true");
7128
- nextTick(() => {
7129
+ setTimeout(() => {
7129
7130
  var _a;
7130
- (_a = cellEle.querySelector("input")) == null ? void 0 : _a.focus();
7131
+ (_a = cellEle.querySelector("input")) == null ? void 0 : _a.click();
7131
7132
  });
7132
7133
  }
7133
7134
  closeCellEditing(cellKey) {
@@ -7136,7 +7137,7 @@ class TableManager extends IManager {
7136
7137
  cellEle.setAttribute("data-edit", "false");
7137
7138
  }
7138
7139
  saveRowData(cellKey, data) {
7139
- this.editableData.set(cellKey, JSON.parse(JSON.stringify(data)));
7140
+ this.editableData.set(cellKey, JSON.stringify(data));
7140
7141
  }
7141
7142
  clearRowData(cellKey) {
7142
7143
  this.editableData.delete(cellKey);
@@ -7145,18 +7146,20 @@ class TableManager extends IManager {
7145
7146
  this.editableOpen.set(`${cellKey}-loading`, loading2);
7146
7147
  }
7147
7148
  restoreCellValue(row, cellKey, restoreKey) {
7148
- const originForm = this.editableData.get(cellKey);
7149
- row[restoreKey] = originForm[restoreKey];
7149
+ const originFormString = this.editableData.get(cellKey);
7150
+ try {
7151
+ row[restoreKey] = JSON.parse(originFormString)[restoreKey];
7152
+ } catch (error) {
7153
+ console.log("restoreCellValue error", error);
7154
+ }
7150
7155
  }
7151
7156
  resetTableEdit() {
7152
7157
  if (this.table.editable) {
7153
7158
  if (this.focusCellKey) {
7154
- this.blurCell(this.currentRow, this.currentColumn);
7159
+ this.blurCell();
7155
7160
  }
7156
7161
  this.editableData.clear();
7157
7162
  this.editableOpen.clear();
7158
- this.currentRow = null;
7159
- this.currentColumn = null;
7160
7163
  this.focusCellKey = null;
7161
7164
  }
7162
7165
  }
@@ -7498,20 +7501,22 @@ const _sfc_main$q = defineComponent({
7498
7501
  });
7499
7502
  var index_vue_vue_type_style_index_0_lang$6 = "";
7500
7503
  const _hoisted_1$9 = { class: "el-table__header-cell" };
7501
- const _hoisted_2$5 = ["data-index", "editable"];
7504
+ const _hoisted_2$5 = ["data-index", "editable", "cell-key"];
7502
7505
  const _hoisted_3$4 = {
7503
7506
  key: 0,
7504
7507
  class: "el-table-cell_editable"
7505
7508
  };
7506
7509
  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 = {
7510
+ const _hoisted_5$2 = {
7511
+ key: 0,
7512
+ class: "el-table-cell_loading"
7513
+ };
7514
+ const _hoisted_6$2 = {
7511
7515
  key: 1,
7512
7516
  class: "empty-edit"
7513
7517
  };
7514
- const _hoisted_9 = { key: 0 };
7518
+ const _hoisted_7$2 = { key: 0 };
7519
+ const _hoisted_8 = ["onClick"];
7515
7520
  const __default__$g = {
7516
7521
  name: "TableColumn"
7517
7522
  };
@@ -7526,6 +7531,13 @@ const _sfc_main$p = defineComponent({
7526
7531
  const tableManager = computed(() => {
7527
7532
  return props.context;
7528
7533
  });
7534
+ const handleClickEditIcon = (column, row) => {
7535
+ setTimeout(() => {
7536
+ const cellKey = tableManager.value.composeTableCellKeyByData(column, row);
7537
+ tableManager.value.setCellEditing(cellKey);
7538
+ tableManager.value.saveRowData(cellKey, row);
7539
+ }, 0);
7540
+ };
7529
7541
  const onUpdateTableCellModelValue = (row, prop, value) => {
7530
7542
  row[prop] = value;
7531
7543
  };
@@ -7554,30 +7566,40 @@ const _sfc_main$p = defineComponent({
7554
7566
  let updateResult;
7555
7567
  props.context.setRowUpdateLoading(cellKey, true);
7556
7568
  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
- );
7569
+ let updateFn;
7570
+ if (column.editData.customUpdate) {
7571
+ updateFn = column.editData.customUpdate.bind(tableManager, submitData);
7564
7572
  } else {
7565
- updateResult = await manager.postUpdDataRequest(submitData);
7573
+ if (column.editData.api) {
7574
+ let api = typeof column.editData.api === "function" ? column.editData.api.call(manager, submitData) : column.editData.api;
7575
+ updateFn = manager.baseUpdDataRequest.bind(
7576
+ manager,
7577
+ api,
7578
+ column.editData.method || tableManager.value.config.updMethod,
7579
+ submitData
7580
+ );
7581
+ } else {
7582
+ updateFn = manager.postUpdDataRequest.bind(manager, submitData);
7583
+ }
7566
7584
  }
7567
- if (updateResult) {
7585
+ updateResult = await updateFn();
7586
+ if (updateResult !== false) {
7568
7587
  props.context.closeCellEditing(cellKey);
7588
+ props.context.clearRowData(cellKey);
7569
7589
  } else {
7570
7590
  onCancelEditContent(row, cellKey, column.editData.prop || column.prop);
7571
7591
  }
7572
7592
  } catch (error) {
7593
+ console.log("custom edit error", error);
7594
+ onCancelEditContent(row, cellKey, column.editData.prop || column.prop);
7573
7595
  } finally {
7574
7596
  props.context.setRowUpdateLoading(cellKey, false);
7575
7597
  }
7576
7598
  };
7599
+ const onCellDataChange = (row, cellKey, column) => {
7600
+ onSaveEditContent(row, cellKey, column);
7601
+ };
7577
7602
  const onCancelEditContent = (row, cellKey, restoreKey) => {
7578
- if (tableManager.value.editableOpen.get(`${cellKey}-loading`)) {
7579
- return;
7580
- }
7581
7603
  props.context.closeCellEditing(cellKey);
7582
7604
  props.context.restoreCellValue(row, cellKey, restoreKey);
7583
7605
  props.context.clearRowData(cellKey);
@@ -7598,16 +7620,16 @@ const _sfc_main$p = defineComponent({
7598
7620
  }, column.props), {
7599
7621
  header: withCtx(($header) => [
7600
7622
  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, {
7623
+ column.helpText || column.icon ? (openBlock(), createBlock(_component_el_icon, {
7603
7624
  key: 0,
7604
7625
  title: column.helpText
7605
7626
  }, {
7606
7627
  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)
7628
+ column.icon ? (openBlock(), createBlock(resolveDynamicComponent(column.icon), { key: 0 })) : column.helpText ? (openBlock(), createBlock(unref(questionFilled), { key: 1 })) : createCommentVNode("", true)
7608
7629
  ]),
7609
7630
  _: 2
7610
- }, 1032, ["title"])) : createCommentVNode("", true)
7631
+ }, 1032, ["title"])) : createCommentVNode("", true),
7632
+ createElementVNode("span", null, toDisplayString($header.column.label || ""), 1)
7611
7633
  ])
7612
7634
  ]),
7613
7635
  default: withCtx(({ row, $index, column: columnEl }) => [
@@ -7621,13 +7643,17 @@ const _sfc_main$p = defineComponent({
7621
7643
  key: 1,
7622
7644
  "data-index": $index,
7623
7645
  editable: column.editData ? 1 : 0,
7646
+ "cell-key": tableManager.value.composeTableCellKey(columnEl.columnKey, row[tableManager.value.rowKey]),
7624
7647
  class: normalizeClass([
7625
7648
  "el-table-cell_inner",
7626
7649
  column.showRowNumbers != null ? `show-${column.showRowNumbers}` : ""
7627
7650
  ])
7628
7651
  }, [
7629
7652
  column.showEdit || tableManager.value.editableOpen.get(
7630
- tableManager.value.composeTableCellKey(columnEl.columnKey, $index)
7653
+ tableManager.value.composeTableCellKey(
7654
+ columnEl.columnKey,
7655
+ row[tableManager.value.rowKey]
7656
+ )
7631
7657
  ) ? (openBlock(), createElementBlock("div", _hoisted_3$4, [
7632
7658
  column.editData ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
7633
7659
  createElementVNode("div", _hoisted_4$3, [
@@ -7641,54 +7667,31 @@ const _sfc_main$p = defineComponent({
7641
7667
  row,
7642
7668
  column.editData.prop || column.prop,
7643
7669
  $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(
7670
+ ),
7671
+ onChange: ($event) => onCellDataChange(
7653
7672
  row,
7654
- tableManager.value.composeTableCellKey(columnEl.columnKey, $index),
7673
+ tableManager.value.composeTableCellKey(
7674
+ columnEl.columnKey,
7675
+ row[tableManager.value.rowKey]
7676
+ ),
7655
7677
  column
7656
7678
  )
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"))
7679
+ }, null, 8, ["modelValue", "renderFn", "context", "options", "model", "onUpdate:modelValue", "onChange"])
7680
+ ]),
7681
+ tableManager.value.editableOpen.get(
7682
+ tableManager.value.composeTableCellKey(
7683
+ columnEl.columnKey,
7684
+ row[tableManager.value.rowKey]
7685
+ ) + "-loading"
7686
+ ) ? (openBlock(), createElementBlock("div", _hoisted_5$2, [
7687
+ createVNode(_component_el_icon, { class: "is-loading" }, {
7688
+ default: withCtx(() => [
7689
+ createVNode(unref(loading))
7690
+ ]),
7691
+ _: 1
7692
+ })
7693
+ ])) : createCommentVNode("", true)
7694
+ ], 64)) : (openBlock(), createElementBlock("div", _hoisted_6$2, "\u8BE5\u5217\u672A\u8BBE\u7F6E\u7F16\u8F91\u7EC4\u4EF6"))
7692
7695
  ])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
7693
7696
  column.renderFn && $index !== -1 ? (openBlock(), createBlock(_sfc_main$q, {
7694
7697
  key: 0,
@@ -7698,8 +7701,20 @@ const _sfc_main$p = defineComponent({
7698
7701
  row,
7699
7702
  index: $index
7700
7703
  }, 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))
7704
+ column.prop ? (openBlock(), createElementBlock("span", _hoisted_7$2, toDisplayString(row[column.prop]), 1)) : createCommentVNode("", true)
7705
+ ], 64)),
7706
+ column.editData ? (openBlock(), createElementBlock("span", {
7707
+ key: 2,
7708
+ class: "el-table-cell__edit-icon",
7709
+ onClick: ($event) => handleClickEditIcon(columnEl, row)
7710
+ }, [
7711
+ createVNode(_component_el_icon, { size: 14 }, {
7712
+ default: withCtx(() => [
7713
+ createVNode(unref(edit))
7714
+ ]),
7715
+ _: 1
7716
+ })
7717
+ ], 8, _hoisted_8)) : createCommentVNode("", true)
7703
7718
  ], 64))
7704
7719
  ], 10, _hoisted_2$5))
7705
7720
  ]),
@@ -13929,7 +13944,7 @@ const _sfc_main$4 = defineComponent({
13929
13944
  key: 0,
13930
13945
  class: normalizeClass(unref(createBEMName)("top-tabs"))
13931
13946
  }, [
13932
- hasTabs.value ? (openBlock(), createBlock(_sfc_main$Q, {
13947
+ hasTabs.value ? (openBlock(), createBlock(_sfc_main$P, {
13933
13948
  key: 0,
13934
13949
  tabs: uConfig.value.tabs,
13935
13950
  manager,
@@ -14540,7 +14555,8 @@ const _sfc_main = defineComponent({
14540
14555
  emit("column-render", renderedTableEls.value);
14541
14556
  },
14542
14557
  {
14543
- deep: true
14558
+ deep: true,
14559
+ immediate: true
14544
14560
  }
14545
14561
  );
14546
14562
  const onSaveColumns = async (columns) => {
@@ -14927,12 +14943,12 @@ const _sfc_main = defineComponent({
14927
14943
  };
14928
14944
  }
14929
14945
  });
14930
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-0eb55d28"]]);
14946
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-25807568"]]);
14931
14947
  const defineEditableTable = function(config) {
14932
14948
  return reactive(config);
14933
14949
  };
14934
14950
  const name = "@juzhenfe/page-model";
14935
- const version = "3.9.36";
14951
+ const version = "3.9.38";
14936
14952
  const types = "dist/main.d.ts";
14937
14953
  const main = "dist/index.umd.js";
14938
14954
  const keywords = [