mooho-base-admin-plus 2.10.35 → 2.10.36

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/history.md CHANGED
@@ -206,3 +206,4 @@ mooho-base-admin-plus@2.10.32 - 修复上一版本的bug
206
206
  mooho-base-admin-plus@2.10.33 - 增加Excel表格组件
207
207
  mooho-base-admin-plus@2.10.34 - 修复上一版本的bug
208
208
  mooho-base-admin-plus@2.10.35 - 增加Excel表格冻结列、多级表头等功能
209
+ mooho-base-admin-plus@2.10.36 - 增加Excel表格允许新增、修改、删除功能
@@ -103195,66 +103195,7 @@ const _sfc_main$o = {
103195
103195
  // }
103196
103196
  // ],
103197
103197
  // minSpareRows: 1,
103198
- contextMenu: {
103199
- items: {
103200
- row_above: {
103201
- name: "上方插入行"
103202
- },
103203
- row_below: {
103204
- name: "下方插入行"
103205
- },
103206
- separator1: ContextMenu.SEPARATOR,
103207
- move_up: {
103208
- name: "整行上移",
103209
- callback: (a, r, o) => {
103210
- let s = r[0].start.row;
103211
- if (s > 0) {
103212
- let l = this.$refs.table.hotInstance.getSourceData(), c = l.splice(s, 1);
103213
- l.splice(s - 1, 0, c[0]), this.$refs.table.hotInstance.loadData(l);
103214
- }
103215
- }
103216
- },
103217
- move_down: {
103218
- name: "整行下移",
103219
- callback: (a, r, o) => {
103220
- let s = r[0].start.row, l = this.$refs.table.hotInstance.getSourceData();
103221
- if (s < l.length - 1) {
103222
- let c = l.splice(s, 1);
103223
- l.splice(s + 1, 0, c[0]), this.$refs.table.hotInstance.loadData(l);
103224
- }
103225
- }
103226
- },
103227
- remove_row: {
103228
- name: "整行删除",
103229
- callback: (a, r, o) => {
103230
- let s = [], l = [], c = [], u = this.$refs.table.hotInstance.getSourceData();
103231
- for (const d of r) {
103232
- let f = d.start.row, p = d.end.row;
103233
- s.push([f, p - f + 1]);
103234
- for (let g = f; g <= p; g++)
103235
- c.push(g);
103236
- for (let g = f; g < p; g++)
103237
- u[g].id && l.push(u[g].id);
103238
- }
103239
- this.confirm("确定要删除该行吗?", async () => {
103240
- let d = !0;
103241
- this.$emit("on-remove", c, (f) => {
103242
- d = f;
103243
- }), console.log(d), d && this.$refs.table.hotInstance.alter("remove_row", s);
103244
- });
103245
- }
103246
- }
103247
- // separator2: ContextMenu.SEPARATOR
103248
- // cut: { name: '剪切' },
103249
- // copy: { name: '复制' }
103250
- // 'paste': {
103251
- // name: '粘贴',
103252
- // callback: (key, selection, clickEvent) => {
103253
- // document.execCommand('paste');
103254
- // }
103255
- // }
103256
- }
103257
- },
103198
+ contextMenu: { items: {} },
103258
103199
  licenseKey: "non-commercial-and-evaluation"
103259
103200
  },
103260
103201
  coords: {},
@@ -103438,9 +103379,46 @@ const _sfc_main$o = {
103438
103379
  }));
103439
103380
  this.hotSetting.nestedHeaders = [l, c];
103440
103381
  }
103441
- this.$refs.table.hotInstance.addHook("afterChange", (l) => {
103382
+ console.log("xxx", "view", s), this.tableView.createEnable && (this.hotSetting.contextMenu.items.row_above = { name: "上方插入行" }, this.hotSetting.contextMenu.items.row_below = { name: "下方插入行" }, this.hotSetting.contextMenu.items.separator1 = ContextMenu.SEPARATOR), this.tableView.adjustEnable && (this.hotSetting.contextMenu.items.move_up = {
103383
+ name: "整行上移",
103384
+ callback: (l, c, u) => {
103385
+ let d = c[0].start.row;
103386
+ if (d > 0) {
103387
+ let f = this.$refs.table.hotInstance.getSourceData(), p = f.splice(d, 1);
103388
+ f.splice(d - 1, 0, p[0]), this.$refs.table.hotInstance.loadData(f);
103389
+ }
103390
+ }
103391
+ }, this.hotSetting.contextMenu.items.move_down = {
103392
+ name: "整行下移",
103393
+ callback: (l, c, u) => {
103394
+ let d = c[0].start.row, f = this.$refs.table.hotInstance.getSourceData();
103395
+ if (d < f.length - 1) {
103396
+ let p = f.splice(d, 1);
103397
+ f.splice(d + 1, 0, p[0]), this.$refs.table.hotInstance.loadData(f);
103398
+ }
103399
+ }
103400
+ }), this.tableView.removeEnable && (this.hotSetting.contextMenu.items.remove_row = {
103401
+ name: "整行删除",
103402
+ callback: (l, c, u) => {
103403
+ let d = [], f = [], p = [], g = this.$refs.table.hotInstance.getSourceData();
103404
+ for (const v of c) {
103405
+ let y = v.start.row, _ = v.end.row;
103406
+ d.push([y, _ - y + 1]);
103407
+ for (let S = y; S <= _; S++)
103408
+ p.push(S);
103409
+ for (let S = y; S < _; S++)
103410
+ g[S].id && f.push(g[S].id);
103411
+ }
103412
+ this.confirm("确定要删除该行吗?", async () => {
103413
+ let v = !0;
103414
+ this.$emit("on-remove", p, (y) => {
103415
+ v = y;
103416
+ }), console.log(v), v && this.$refs.table.hotInstance.alter("remove_row", d);
103417
+ });
103418
+ }
103419
+ }), this.$refs.table.hotInstance.addHook("afterChange", (l) => {
103442
103420
  l && l.forEach(([c, u, d, f]) => {
103443
- c == this.data.length - 1 && (d ?? "") != (f ?? "") && (this.data.push(this.getDefaultData()), this.$refs.table.hotInstance.loadData(this.data)), this.onDataChange(
103421
+ this.tableView.createEnable && c == this.data.length - 1 && (d ?? "") != (f ?? "") && (this.data.push(this.getDefaultData()), this.$refs.table.hotInstance.loadData(this.data)), this.onDataChange(
103444
103422
  this.data[c],
103445
103423
  this.columns.find((p) => p.code == u)
103446
103424
  );
@@ -103461,7 +103439,7 @@ const _sfc_main$o = {
103461
103439
  a && (this.staticData = this.copy(a), this.staticData.forEach((r) => {
103462
103440
  for (let o in r)
103463
103441
  r[o] != null && this.columns.some((s) => s.code === o && s.controlType === "Date") && (r[o] = format$6(new Date(r[o]), "yyyy-MM-dd"));
103464
- })), this.data = this.staticData, this.data.push(this.getDefaultData()), this.$refs.table.hotInstance.loadData(this.data), setTimeout(() => {
103442
+ })), this.data = this.staticData, this.tableView.createEnable && this.data.push(this.getDefaultData()), this.$refs.table.hotInstance.loadData(this.data), setTimeout(() => {
103465
103443
  this.$refs.table.hotInstance.render();
103466
103444
  }), this.data.forEach((r) => {
103467
103445
  r._disabled = this.readonly;