ocpview-plus 1.0.17 → 1.0.19

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,16 @@ 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
+ },
9119
9127
  methods: {
9120
9128
  customInit() {
9121
9129
  if (this.myConfig.items && this.myConfig.items.length > 0) {
@@ -9550,6 +9558,91 @@ const _sfc_main$1F = {
9550
9558
  this.setcheckInfo(index, config2.key);
9551
9559
  }
9552
9560
  },
9561
+ setEditGridFocus(rowIdx, colKey) {
9562
+ this.focusIndex = rowIdx;
9563
+ this.focusKey = colKey;
9564
+ this.editIndex = rowIdx;
9565
+ this.editKey = colKey;
9566
+ this.focusCell(rowIdx, colKey);
9567
+ },
9568
+ focusCell(rowIdx, colKey) {
9569
+ this.$nextTick(() => {
9570
+ const tableEl = this.$refs.table.$el;
9571
+ const selector = `div[cell-row="${rowIdx}"][cell-col="${colKey}"]`;
9572
+ let curElement = tableEl.querySelector(selector);
9573
+ if (curElement) {
9574
+ const arr = tableEl.querySelectorAll(".ivu-table-column-selected");
9575
+ if (arr.length != 0) {
9576
+ arr.forEach((el2) => {
9577
+ el2.classList.remove("ivu-table-column-selected");
9578
+ });
9579
+ }
9580
+ const cellDiv = curElement.closest("td");
9581
+ if (cellDiv) {
9582
+ cellDiv.classList.add("ivu-table-column-selected");
9583
+ cellDiv.scrollIntoView({ behavior: "smooth", block: "nearest" });
9584
+ }
9585
+ }
9586
+ });
9587
+ },
9588
+ handleKeydown(event) {
9589
+ if (this.focusIndex === null || this.focusKey === null)
9590
+ return;
9591
+ const colIdx = this.colKeys.findIndex((it2) => {
9592
+ return it2 == this.focusKey;
9593
+ });
9594
+ this.focusKey = this.colKeys[colIdx];
9595
+ let newRow = this.focusIndex;
9596
+ let newCol = colIdx;
9597
+ let name2 = "cell_" + this.editIndex + "_" + this.editKey;
9598
+ const { key } = event;
9599
+ if (key == "ArrowUp") {
9600
+ if (this.focusIndex > 0)
9601
+ newRow--;
9602
+ this.extEditStatus();
9603
+ }
9604
+ if (key == "ArrowDown") {
9605
+ if (this.focusIndex < this.data.length - 1)
9606
+ newRow++;
9607
+ this.extEditStatus();
9608
+ }
9609
+ if (key == "ArrowLeft") {
9610
+ if (colIdx > 1)
9611
+ newCol--;
9612
+ this.extEditStatus();
9613
+ }
9614
+ if (key == "ArrowRight") {
9615
+ if (colIdx < this.colKeys.length - 1)
9616
+ newCol++;
9617
+ this.extEditStatus();
9618
+ }
9619
+ if (key == "Enter") {
9620
+ if (colIdx < this.colKeys.length - 1)
9621
+ newCol++;
9622
+ }
9623
+ this.setEditGridFocus(newRow, this.colKeys[newCol]);
9624
+ if (!this.myConfig.readOnly) {
9625
+ if (this.$refs[name2] && this.$refs[name2].autofocus) {
9626
+ return true;
9627
+ }
9628
+ } else {
9629
+ this.handleOut();
9630
+ }
9631
+ event.preventDefault();
9632
+ },
9633
+ extEditStatus() {
9634
+ if (!this.myConfig.readOnly) {
9635
+ let name2 = "cell_" + this.editIndex + "_" + this.editKey;
9636
+ if (this.$refs[name2] && this.$refs[name2].setFocus) {
9637
+ this.$refs[name2].setFocus(false);
9638
+ }
9639
+ let self2 = this;
9640
+ this.$nextTick(() => {
9641
+ self2.editKey = "";
9642
+ self2.oldEditIndex = this.editIndex;
9643
+ });
9644
+ }
9645
+ },
9553
9646
  setcheckInfo(index, key) {
9554
9647
  let checkIndex = index;
9555
9648
  let row = this.getCurRow(index);
@@ -43970,6 +44063,41 @@ const _sfc_main$v = {
43970
44063
  effectData: []
43971
44064
  };
43972
44065
  },
44066
+ computed: {
44067
+ tableHeight() {
44068
+ let currentHeight = this.currentHeight - this.extraHeight - this.outsideHeight;
44069
+ if (this.isFull) {
44070
+ currentHeight = this.clientHeight - this.$refs.table.$el.offsetTop;
44071
+ } else {
44072
+ if (!this.myConfig.dynamicHeight) {
44073
+ currentHeight = this.currentHeight;
44074
+ if (this.extraHeight) {
44075
+ currentHeight = currentHeight - Number(this.extraHeight);
44076
+ }
44077
+ if (this.outsideHeight) {
44078
+ currentHeight = currentHeight - Number(this.outsideHeight);
44079
+ }
44080
+ if (this.myConfig.showSummary) {
44081
+ currentHeight = currentHeight - 50;
44082
+ }
44083
+ }
44084
+ }
44085
+ return currentHeight;
44086
+ },
44087
+ tableMaxHeight() {
44088
+ let currentHeight = this.currentHeight - this.extraHeight - this.outsideHeight;
44089
+ if (this.isFull) {
44090
+ currentHeight = this.clientHeight - this.$refs.table.$el.offsetTop;
44091
+ } else {
44092
+ if (this.myConfig.dynamicHeight) {
44093
+ if (this.myConfig.showSummary) {
44094
+ currentHeight = currentHeight - 50;
44095
+ }
44096
+ }
44097
+ }
44098
+ return currentHeight;
44099
+ }
44100
+ },
43973
44101
  methods: {
43974
44102
  customInit2() {
43975
44103
  if (this.myConfig.showTitle !== void 0) {
@@ -44098,7 +44226,7 @@ const _hoisted_2$k = {
44098
44226
  };
44099
44227
  const _hoisted_3$c = ["textContent"];
44100
44228
  const _hoisted_4$a = { key: 0 };
44101
- const _hoisted_5$8 = ["onClick"];
44229
+ const _hoisted_5$8 = ["onClick", "cell-row", "cell-col"];
44102
44230
  const _hoisted_6$5 = {
44103
44231
  key: 0,
44104
44232
  ref: "page",
@@ -44259,8 +44387,8 @@ function _sfc_render$s(_ctx, _cache, $props, $setup, $data, $options) {
44259
44387
  size: $data.myConfig.tableSize,
44260
44388
  stripe: $data.myConfig.showStripe,
44261
44389
  border: $data.myConfig.showBorder,
44262
- height: _ctx.tableHeight,
44263
- maxHeight: _ctx.tableMaxHeight,
44390
+ height: $options.tableHeight,
44391
+ maxHeight: $options.tableMaxHeight,
44264
44392
  "show-header": $data.myConfig.showHeader,
44265
44393
  onOnSelectionChange: _ctx.OnSelectionChange,
44266
44394
  columns: _ctx.tableColumns,
@@ -44276,7 +44404,9 @@ function _sfc_render$s(_ctx, _cache, $props, $setup, $data, $options) {
44276
44404
  fn: withCtx(({ index }) => [
44277
44405
  createElementVNode("div", {
44278
44406
  onClick: ($event) => _ctx.EditCell(index, config2),
44279
- class: normalizeClass(config2.cellClassName)
44407
+ class: normalizeClass(config2.cellClassName),
44408
+ "cell-row": index,
44409
+ "cell-col": config2.key
44280
44410
  }, [
44281
44411
  _ctx.editIndex === index && _ctx.editKey === config2.key ? (openBlock(), createBlock(_component_ControlBox, {
44282
44412
  key: 0,
@@ -44365,7 +44495,7 @@ function _sfc_render$s(_ctx, _cache, $props, $setup, $data, $options) {
44365
44495
  size: $data.myConfig.tableSize,
44366
44496
  border: $data.myConfig.showBorder,
44367
44497
  stripe: $data.myConfig.showStripe,
44368
- maxHeight: _ctx.tableMaxHeight,
44498
+ maxHeight: $options.tableMaxHeight,
44369
44499
  columns: _ctx.tableColumns,
44370
44500
  data: $data.curlEffectData,
44371
44501
  onOnColumnWidthResize: _ctx.onColumnWidthResize
@@ -44414,7 +44544,7 @@ function _sfc_render$s(_ctx, _cache, $props, $setup, $data, $options) {
44414
44544
  _: 3
44415
44545
  }, 512);
44416
44546
  }
44417
- var mEditGridCard = /* @__PURE__ */ _export_sfc$1(_sfc_main$v, [["render", _sfc_render$s], ["__scopeId", "data-v-52b06f05"]]);
44547
+ var mEditGridCard = /* @__PURE__ */ _export_sfc$1(_sfc_main$v, [["render", _sfc_render$s], ["__scopeId", "data-v-3cf9d240"]]);
44418
44548
  const _sfc_main$u = {
44419
44549
  name: "mformcard",
44420
44550
  extends: FormBox,