@juzhenfe/page-model 3.9.38 → 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.
@@ -99,6 +99,10 @@ export default class TableManager extends IManager {
99
99
  * 当前聚焦的单元格
100
100
  */
101
101
  focusCellKey: string;
102
+ /**
103
+ * 当前聚焦的列
104
+ */
105
+ focusEl: PageModel.TableBaseItem;
102
106
  /**
103
107
  * 移除当前单元格聚焦
104
108
  */
@@ -107,6 +111,10 @@ export default class TableManager extends IManager {
107
111
  * document点击事件
108
112
  */
109
113
  documentClickHandler: (e: MouseEvent) => void;
114
+ /**
115
+ * 移除单元格外点击事件
116
+ */
117
+ removeCellOutClickEvent(): void;
110
118
  /**
111
119
  * 单元格外点击,清理选中
112
120
  */
@@ -214,4 +222,5 @@ export default class TableManager extends IManager {
214
222
  updateScrollTop(top: any): void;
215
223
  scrollLeft: number;
216
224
  updateScrollLeft(left: any): void;
225
+ destroy(): void;
217
226
  }
package/dist/index.es.js CHANGED
@@ -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() {
@@ -6416,6 +6418,9 @@ const _PageModelManager = class extends Reflections {
6416
6418
  this.loadingInstance && this.loadingInstance.close();
6417
6419
  }
6418
6420
  destroy() {
6421
+ this.children.forEach((item) => {
6422
+ item.destroy();
6423
+ });
6419
6424
  this.destroyReflect();
6420
6425
  }
6421
6426
  };
@@ -6824,6 +6829,7 @@ class TableManager extends IManager {
6824
6829
  __publicField(this, "randomRowKey", null);
6825
6830
  __publicField(this, "totalEls", []);
6826
6831
  __publicField(this, "focusCellKey");
6832
+ __publicField(this, "focusEl");
6827
6833
  __publicField(this, "documentClickHandler");
6828
6834
  __publicField(this, "radioData", null);
6829
6835
  __publicField(this, "currentRenderTableEls");
@@ -7056,10 +7062,13 @@ class TableManager extends IManager {
7056
7062
  this.focusCellKey = null;
7057
7063
  }
7058
7064
  }
7059
- bindCellOutClickEvent() {
7065
+ removeCellOutClickEvent() {
7060
7066
  if (this.documentClickHandler) {
7061
7067
  document.removeEventListener("click", this.documentClickHandler);
7062
7068
  }
7069
+ }
7070
+ bindCellOutClickEvent() {
7071
+ this.removeCellOutClickEvent();
7063
7072
  const handler = (e) => {
7064
7073
  if (!this.focusCellKey) {
7065
7074
  return;
@@ -7067,8 +7076,14 @@ class TableManager extends IManager {
7067
7076
  const clickElement = e.target;
7068
7077
  let isInCurrentCell = false;
7069
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
+ }
7070
7085
  while (loopElement) {
7071
- if (loopElement.getAttribute("cell-key") === this.focusCellKey) {
7086
+ if (loopElement.getAttribute("cell-key") === this.focusCellKey || loopElement.className && poperClass && typeof loopElement.className === "string" && loopElement.className.includes(poperClass)) {
7072
7087
  isInCurrentCell = true;
7073
7088
  break;
7074
7089
  }
@@ -7117,6 +7132,7 @@ class TableManager extends IManager {
7117
7132
  this.blurCell();
7118
7133
  }
7119
7134
  cell.id = this.focusCellKey = cellKey;
7135
+ this.focusEl = tableEl;
7120
7136
  this.focusCell(cell);
7121
7137
  }.bind(this);
7122
7138
  this.bindCellOutClickEvent();
@@ -7127,14 +7143,15 @@ class TableManager extends IManager {
7127
7143
  const cellEle = document.querySelector(`#${cellKey}`);
7128
7144
  cellEle.setAttribute("data-edit", "true");
7129
7145
  setTimeout(() => {
7130
- var _a;
7131
- (_a = cellEle.querySelector("input")) == null ? void 0 : _a.click();
7132
- });
7146
+ var _a, _b;
7147
+ (_a = cellEle.querySelector("input")) == null ? void 0 : _a.focus();
7148
+ (_b = cellEle.querySelector("input")) == null ? void 0 : _b.click();
7149
+ }, 0);
7133
7150
  }
7134
7151
  closeCellEditing(cellKey) {
7135
7152
  this.editableOpen.set(cellKey, false);
7136
7153
  const cellEle = document.querySelector(`#${this.focusCellKey}`);
7137
- cellEle.setAttribute("data-edit", "false");
7154
+ cellEle && cellEle.setAttribute("data-edit", "false");
7138
7155
  }
7139
7156
  saveRowData(cellKey, data) {
7140
7157
  this.editableData.set(cellKey, JSON.stringify(data));
@@ -7460,6 +7477,9 @@ class TableManager extends IManager {
7460
7477
  updateScrollLeft(left) {
7461
7478
  this.scrollLeft = left;
7462
7479
  }
7480
+ destroy() {
7481
+ this.removeCellOutClickEvent();
7482
+ }
7463
7483
  }
7464
7484
  const _sfc_main$q = defineComponent({
7465
7485
  name: "TableCellRenderer",
@@ -14948,7 +14968,7 @@ const defineEditableTable = function(config) {
14948
14968
  return reactive(config);
14949
14969
  };
14950
14970
  const name = "@juzhenfe/page-model";
14951
- const version = "3.9.38";
14971
+ const version = "3.9.39";
14952
14972
  const types = "dist/main.d.ts";
14953
14973
  const main = "dist/index.umd.js";
14954
14974
  const keywords = [