ocpview-plus 1.0.17 → 1.0.18

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/README.md CHANGED
@@ -0,0 +1,3 @@
1
+
2
+ ### 1.0.18 更新说明
3
+ ListDetail 模板 EditGrid 增加键盘导航
@@ -9071,6 +9071,7 @@ function _sfc_render$1t(_ctx, _cache, $props, $setup, $data, $options) {
9071
9071
  ]);
9072
9072
  }
9073
9073
  var ViewGrid = /* @__PURE__ */ _export_sfc$1(_sfc_main$1G, [["render", _sfc_render$1t]]);
9074
+ var editgridbase_vue_vue_type_style_index_0_lang = "";
9074
9075
  const _sfc_main$1F = {
9075
9076
  name: "editgridbase",
9076
9077
  extends: _sfc_main$1I,
@@ -9113,9 +9114,19 @@ const _sfc_main$1F = {
9113
9114
  name: "editRowForm",
9114
9115
  text: "\u7F16\u8F91"
9115
9116
  }],
9116
- openChange: false
9117
+ openChange: false,
9118
+ focusIndex: null,
9119
+ focusKey: null
9117
9120
  };
9118
9121
  },
9122
+ computed: {
9123
+ colKeys() {
9124
+ return this.soltTableColumns.map((c10) => c10.key);
9125
+ }
9126
+ },
9127
+ beforeUnmount() {
9128
+ document.removeEventListener("keydown", this.handleKeydown);
9129
+ },
9119
9130
  methods: {
9120
9131
  customInit() {
9121
9132
  if (this.myConfig.items && this.myConfig.items.length > 0) {
@@ -9167,6 +9178,9 @@ const _sfc_main$1F = {
9167
9178
  this.customInit2();
9168
9179
  }
9169
9180
  this.myConfig.getGridObject = this.getGridObject;
9181
+ document.addEventListener("keydown", (e10) => {
9182
+ this.handleKeydown(e10);
9183
+ });
9170
9184
  },
9171
9185
  getGridObject() {
9172
9186
  let that = this;
@@ -9513,6 +9527,7 @@ const _sfc_main$1F = {
9513
9527
  return error;
9514
9528
  },
9515
9529
  EditCell(index, config2) {
9530
+ this.setEditGridFocus(index, config2.key);
9516
9531
  if (this.myConfig.readOnly) {
9517
9532
  this.cancelCellEditing();
9518
9533
  return;
@@ -9550,6 +9565,91 @@ const _sfc_main$1F = {
9550
9565
  this.setcheckInfo(index, config2.key);
9551
9566
  }
9552
9567
  },
9568
+ setEditGridFocus(rowIdx, colKey) {
9569
+ this.focusIndex = rowIdx;
9570
+ this.focusKey = colKey;
9571
+ this.editIndex = rowIdx;
9572
+ this.editKey = colKey;
9573
+ this.focusCell(rowIdx, colKey);
9574
+ },
9575
+ focusCell(rowIdx, colKey) {
9576
+ this.$nextTick(() => {
9577
+ const tableEl = this.$refs.table.$el;
9578
+ const selector = `div[cell-row="${rowIdx}"][cell-col="${colKey}"]`;
9579
+ let curElement = tableEl.querySelector(selector);
9580
+ if (curElement) {
9581
+ const arr = tableEl.querySelectorAll(".ivu-table-column-selected");
9582
+ if (arr.length != 0) {
9583
+ arr.forEach((el2) => {
9584
+ el2.classList.remove("ivu-table-column-selected");
9585
+ });
9586
+ }
9587
+ const cellDiv = curElement.closest("td");
9588
+ if (cellDiv) {
9589
+ cellDiv.classList.add("ivu-table-column-selected");
9590
+ cellDiv.scrollIntoView({ behavior: "smooth", block: "nearest" });
9591
+ }
9592
+ }
9593
+ });
9594
+ },
9595
+ handleKeydown(event) {
9596
+ if (this.focusIndex === null || this.focusKey === null)
9597
+ return;
9598
+ const colIdx = this.colKeys.findIndex((it2) => {
9599
+ return it2 == this.focusKey;
9600
+ });
9601
+ this.focusKey = this.colKeys[colIdx];
9602
+ let newRow = this.focusIndex;
9603
+ let newCol = colIdx;
9604
+ let name2 = "cell_" + this.editIndex + "_" + this.editKey;
9605
+ const { key } = event;
9606
+ if (key == "ArrowUp") {
9607
+ if (this.focusIndex > 0)
9608
+ newRow--;
9609
+ this.extEditStatus();
9610
+ }
9611
+ if (key == "ArrowDown") {
9612
+ if (this.focusIndex < this.data.length - 1)
9613
+ newRow++;
9614
+ this.extEditStatus();
9615
+ }
9616
+ if (key == "ArrowLeft") {
9617
+ if (colIdx > 1)
9618
+ newCol--;
9619
+ this.extEditStatus();
9620
+ }
9621
+ if (key == "ArrowRight") {
9622
+ if (colIdx < this.colKeys.length - 1)
9623
+ newCol++;
9624
+ this.extEditStatus();
9625
+ }
9626
+ if (key == "Enter") {
9627
+ if (colIdx < this.colKeys.length - 1)
9628
+ newCol++;
9629
+ }
9630
+ this.setEditGridFocus(newRow, this.colKeys[newCol]);
9631
+ if (!this.myConfig.readOnly) {
9632
+ if (this.$refs[name2] && this.$refs[name2].autofocus) {
9633
+ return true;
9634
+ }
9635
+ } else {
9636
+ this.handleOut();
9637
+ }
9638
+ event.preventDefault();
9639
+ },
9640
+ extEditStatus() {
9641
+ if (!this.myConfig.readOnly) {
9642
+ let name2 = "cell_" + this.editIndex + "_" + this.editKey;
9643
+ if (this.$refs[name2] && this.$refs[name2].setFocus) {
9644
+ this.$refs[name2].setFocus(false);
9645
+ }
9646
+ let self2 = this;
9647
+ this.$nextTick(() => {
9648
+ self2.editKey = "";
9649
+ self2.oldEditIndex = this.editIndex;
9650
+ });
9651
+ }
9652
+ },
9553
9653
  setcheckInfo(index, key) {
9554
9654
  let checkIndex = index;
9555
9655
  let row = this.getCurRow(index);
@@ -9694,6 +9794,7 @@ const _sfc_main$1F = {
9694
9794
  this.editIndex = nextKey.editIndex;
9695
9795
  this.editKey = nextKey.editKey;
9696
9796
  this.setcheckInfo(nextKey.editIndex, nextKey.editKey);
9797
+ this.setEditGridFocus(this.editIndex, this.editKey);
9697
9798
  }
9698
9799
  },
9699
9800
  findNextItems(editIndex, editName) {
@@ -43970,6 +44071,41 @@ const _sfc_main$v = {
43970
44071
  effectData: []
43971
44072
  };
43972
44073
  },
44074
+ computed: {
44075
+ tableHeight() {
44076
+ let currentHeight = this.currentHeight - this.extraHeight - this.outsideHeight;
44077
+ if (this.isFull) {
44078
+ currentHeight = this.clientHeight - this.$refs.table.$el.offsetTop;
44079
+ } else {
44080
+ if (!this.myConfig.dynamicHeight) {
44081
+ currentHeight = this.currentHeight;
44082
+ if (this.extraHeight) {
44083
+ currentHeight = currentHeight - Number(this.extraHeight);
44084
+ }
44085
+ if (this.outsideHeight) {
44086
+ currentHeight = currentHeight - Number(this.outsideHeight);
44087
+ }
44088
+ if (this.myConfig.showSummary) {
44089
+ currentHeight = currentHeight - 50;
44090
+ }
44091
+ }
44092
+ }
44093
+ return currentHeight;
44094
+ },
44095
+ tableMaxHeight() {
44096
+ let currentHeight = this.currentHeight - this.extraHeight - this.outsideHeight;
44097
+ if (this.isFull) {
44098
+ currentHeight = this.clientHeight - this.$refs.table.$el.offsetTop;
44099
+ } else {
44100
+ if (this.myConfig.dynamicHeight) {
44101
+ if (this.myConfig.showSummary) {
44102
+ currentHeight = currentHeight - 50;
44103
+ }
44104
+ }
44105
+ }
44106
+ return currentHeight;
44107
+ }
44108
+ },
43973
44109
  methods: {
43974
44110
  customInit2() {
43975
44111
  if (this.myConfig.showTitle !== void 0) {
@@ -44098,7 +44234,7 @@ const _hoisted_2$k = {
44098
44234
  };
44099
44235
  const _hoisted_3$c = ["textContent"];
44100
44236
  const _hoisted_4$a = { key: 0 };
44101
- const _hoisted_5$8 = ["onClick"];
44237
+ const _hoisted_5$8 = ["onClick", "cell-row", "cell-col"];
44102
44238
  const _hoisted_6$5 = {
44103
44239
  key: 0,
44104
44240
  ref: "page",
@@ -44259,8 +44395,8 @@ function _sfc_render$s(_ctx, _cache, $props, $setup, $data, $options) {
44259
44395
  size: $data.myConfig.tableSize,
44260
44396
  stripe: $data.myConfig.showStripe,
44261
44397
  border: $data.myConfig.showBorder,
44262
- height: _ctx.tableHeight,
44263
- maxHeight: _ctx.tableMaxHeight,
44398
+ height: $options.tableHeight,
44399
+ maxHeight: $options.tableMaxHeight,
44264
44400
  "show-header": $data.myConfig.showHeader,
44265
44401
  onOnSelectionChange: _ctx.OnSelectionChange,
44266
44402
  columns: _ctx.tableColumns,
@@ -44276,7 +44412,9 @@ function _sfc_render$s(_ctx, _cache, $props, $setup, $data, $options) {
44276
44412
  fn: withCtx(({ index }) => [
44277
44413
  createElementVNode("div", {
44278
44414
  onClick: ($event) => _ctx.EditCell(index, config2),
44279
- class: normalizeClass(config2.cellClassName)
44415
+ class: normalizeClass(config2.cellClassName),
44416
+ "cell-row": index,
44417
+ "cell-col": config2.key
44280
44418
  }, [
44281
44419
  _ctx.editIndex === index && _ctx.editKey === config2.key ? (openBlock(), createBlock(_component_ControlBox, {
44282
44420
  key: 0,
@@ -44365,7 +44503,7 @@ function _sfc_render$s(_ctx, _cache, $props, $setup, $data, $options) {
44365
44503
  size: $data.myConfig.tableSize,
44366
44504
  border: $data.myConfig.showBorder,
44367
44505
  stripe: $data.myConfig.showStripe,
44368
- maxHeight: _ctx.tableMaxHeight,
44506
+ maxHeight: $options.tableMaxHeight,
44369
44507
  columns: _ctx.tableColumns,
44370
44508
  data: $data.curlEffectData,
44371
44509
  onOnColumnWidthResize: _ctx.onColumnWidthResize
@@ -44414,7 +44552,7 @@ function _sfc_render$s(_ctx, _cache, $props, $setup, $data, $options) {
44414
44552
  _: 3
44415
44553
  }, 512);
44416
44554
  }
44417
- var mEditGridCard = /* @__PURE__ */ _export_sfc$1(_sfc_main$v, [["render", _sfc_render$s], ["__scopeId", "data-v-52b06f05"]]);
44555
+ var mEditGridCard = /* @__PURE__ */ _export_sfc$1(_sfc_main$v, [["render", _sfc_render$s], ["__scopeId", "data-v-3cf9d240"]]);
44418
44556
  const _sfc_main$u = {
44419
44557
  name: "mformcard",
44420
44558
  extends: FormBox,