e-virt-table 0.1.9 → 0.1.11

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
@@ -790,7 +790,7 @@ class ii {
790
790
  t.forEach((i, s) => {
791
791
  let r = !1;
792
792
  Array.isArray(i.children) && (r = !0, this.initData(i.children, e + 1));
793
- const { ROW_KEY: o = "", DEFAULT_EXPAND_ALL: a, CELL_HEIGHT: l, SELECTABLE_METHOD: c, CHECKBOX_KEY: f } = this.ctx.config, d = i[o], x = d ?? Ut();
793
+ const { ROW_KEY: o = "", DEFAULT_EXPAND_ALL: a, CELL_HEIGHT: l, SELECTABLE_METHOD: c, CHECKBOX_KEY: f } = this.ctx.config, d = i[o], x = d != null ? `${d}` : Ut();
794
794
  this.itemRowKeyMap.set(i, x);
795
795
  const u = i._height || l, g = i._readonly;
796
796
  let w = !0;
@@ -1013,28 +1013,32 @@ class ii {
1013
1013
  batchSetItemValue(t, e = !1) {
1014
1014
  let i = [];
1015
1015
  const s = /* @__PURE__ */ new Set();
1016
- t.forEach((a) => {
1017
- const { value: l, rowKey: c, key: f } = a, { oldValue: d, newValue: x } = this.setItemValue(c, f, l);
1018
- s.add(c), i.push({
1019
- rowKey: c,
1020
- key: f,
1021
- oldValue: d,
1022
- newValue: x
1016
+ t.forEach((l) => {
1017
+ const { value: c, rowKey: f, key: d } = l, { oldValue: x, newValue: u } = this.setItemValue(f, d, c);
1018
+ s.add(f), i.push({
1019
+ rowKey: f,
1020
+ key: d,
1021
+ oldValue: x,
1022
+ newValue: u
1023
1023
  });
1024
1024
  });
1025
1025
  let r = [];
1026
- const o = i.map((a) => {
1027
- const l = this.ctx.database.getRowDataItemForRowKey(a.rowKey);
1026
+ const o = i.map((l) => {
1027
+ const c = this.ctx.database.getRowDataItemForRowKey(l.rowKey);
1028
1028
  return {
1029
- rowKey: a.rowKey,
1030
- key: a.key,
1031
- value: a.newValue,
1032
- row: l
1029
+ rowKey: l.rowKey,
1030
+ key: l.key,
1031
+ value: l.newValue,
1032
+ row: c
1033
1033
  };
1034
1034
  });
1035
- return s.forEach((a) => {
1036
- r.push(this.ctx.database.getRowDataItemForRowKey(a));
1037
- }), this.validationErrorMap.size === 0 && this.changedDataMap.size > 0 && this.ctx.emit("validateChangedData", this.getChangedData()), this.ctx.emit("change", o, r), e && this.ctx.history.pushState({
1035
+ s.forEach((l) => {
1036
+ r.push(this.ctx.database.getRowDataItemForRowKey(l));
1037
+ });
1038
+ const a = o.map(({ rowKey: l, key: c }) => this.getValidator(l, c));
1039
+ return Promise.all(a).then(() => {
1040
+ this.validationErrorMap.size === 0 && this.changedDataMap.size > 0 && this.ctx.emit("validateChangedData", this.getChangedData());
1041
+ }), this.ctx.emit("change", o, r), e && this.ctx.history.pushState({
1038
1042
  changeList: i,
1039
1043
  scrollX: this.ctx.scrollX,
1040
1044
  scrollY: this.ctx.scrollY,
@@ -1079,7 +1083,9 @@ class ii {
1079
1083
  value: x,
1080
1084
  row: u
1081
1085
  };
1082
- this.validationErrorMap.size === 0 && this.changedDataMap.size > 0 && this.ctx.emit("validateChangedData", this.getChangedData()), this.ctx.emit("change", [g], [u]), this.ctx.emit("editChange", {
1086
+ this.getValidator(t, e).then(() => {
1087
+ this.validationErrorMap.size === 0 && this.changedDataMap.size > 0 && this.ctx.emit("validateChangedData", this.getChangedData());
1088
+ }), this.ctx.emit("change", [g], [u]), this.ctx.emit("editChange", {
1083
1089
  rowKey: t,
1084
1090
  key: e,
1085
1091
  oldValue: l,
@@ -1107,7 +1113,7 @@ class ii {
1107
1113
  newValue: x
1108
1114
  }
1109
1115
  ]
1110
- }), this.getValidator(t, e), r && this.ctx.emit("draw"), {
1116
+ }), r && this.ctx.emit("draw"), {
1111
1117
  oldValue: l,
1112
1118
  newValue: x
1113
1119
  };
@@ -1118,7 +1124,7 @@ class ii {
1118
1124
  * @returns
1119
1125
  */
1120
1126
  getRowDataItemForRowKey(t) {
1121
- if (!this.rowKeyMap.has(t))
1127
+ if (console.log(typeof t), !this.rowKeyMap.has(t))
1122
1128
  return {};
1123
1129
  const { item: e } = this.rowKeyMap.get(t);
1124
1130
  return e;
@@ -1256,7 +1262,7 @@ class ii {
1256
1262
  rowKey: r,
1257
1263
  colKey: o,
1258
1264
  originalValue: s,
1259
- row: this.rowKeyMap.get(r),
1265
+ row: this.ctx.database.getRowDataItemForRowKey(r),
1260
1266
  value: e
1261
1267
  });
1262
1268
  }), t;
@@ -1350,7 +1356,7 @@ class ii {
1350
1356
  colIndex: r.colIndex
1351
1357
  };
1352
1358
  new nt(c).validate(f).then(() => {
1353
- this.clearValidationError(t, e), i([]), this.validationErrorMap.size === 0 && this.changedDataMap.size > 0 && this.ctx.emit("validateChangedData", this.getChangedData());
1359
+ this.clearValidationError(t, e), i([]);
1354
1360
  }).catch(({ errors: x }) => {
1355
1361
  const u = x.map((g) => ({
1356
1362
  ...g,