vxe-table 3.7.9-beta.0 → 3.7.9-beta.1

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.
@@ -29,7 +29,7 @@ function insertTreeRow (_vm, newRecords, isAppend) {
29
29
  }
30
30
  parentChilds[funcName](item)
31
31
  mapChilds[funcName](item)
32
- const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, items: parentChilds, parent, level: parentLevel + 1 }
32
+ const rest = { row: item, rowid, seq: -1, index: -1, _index: -1, $index: -1, items: parentChilds, parent: parentRow, level: parentLevel + 1 }
33
33
  fullDataRowIdData[rowid] = rest
34
34
  fullAllDataRowIdData[rowid] = rest
35
35
  } else {
@@ -55,7 +55,7 @@ function handleInsertRowAt (_vm, records, row, isInsertNextRow) {
55
55
  records = [records]
56
56
  }
57
57
  const newRecords = _vm.defineField(records.map(record => Object.assign(treeConfig && transform ? { [mapChildrenField]: [], [childrenField]: [] } : {}, record)))
58
- if (!row) {
58
+ if (XEUtils.eqNull(row)) {
59
59
  // 如果为虚拟树
60
60
  if (treeConfig && transform) {
61
61
  insertTreeRow(_vm, newRecords, false)
@@ -87,7 +87,7 @@ function renderColumn (h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, r
87
87
  columnOpts,
88
88
  validErrorMaps
89
89
  } = $xetable
90
- const { type, cellRender, editRender, align, showOverflow, className, treeNode } = column
90
+ const { type, cellRender, editRender, align, showOverflow, className, treeNode, slots } = column
91
91
  const { actived } = editStore
92
92
  const { rHeight: scrollYRHeight } = sYOpts
93
93
  const { height: rowHeight } = rowOpts
@@ -245,13 +245,16 @@ function renderColumn (h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, r
245
245
  }, column.renderCell(h, params))
246
246
  )
247
247
  if (showValidTip && errorValidItem) {
248
+ const errRule = errorValidItem.rule
249
+ const validSlot = slots ? slots.valid : null
250
+ const validParams = { ...params, ...errorValidItem }
248
251
  tdVNs.push(
249
252
  h('div', {
250
- class: 'vxe-cell--valid-error-hint',
251
- style: errorValidItem.rule && errorValidItem.rule.maxWidth ? {
252
- width: `${errorValidItem.rule.maxWidth}px`
253
+ class: ['vxe-cell--valid-error-hint', UtilTools.getClass(validOpts.className, errorValidItem)],
254
+ style: errRule && errRule.maxWidth ? {
255
+ width: `${errRule.maxWidth}px`
253
256
  } : null
254
- }, [
257
+ }, validSlot ? $xetable.callSlot(validSlot, validParams, h) : [
255
258
  h('span', {
256
259
  class: 'vxe-cell--valid-error-msg'
257
260
  }, errorValidItem.content)
@@ -680,7 +680,8 @@ const Methods = {
680
680
  }
681
681
  XEUtils.eachTree(rows, (childRow, index, items, path, parent, nodes) => {
682
682
  const rowid = getRowid(this, childRow)
683
- const rest = { row: childRow, rowid, seq: -1, index, _index: -1, $index: -1, items, parent, level: parentLevel + nodes.length }
683
+ const parentRow = parent || row
684
+ const rest = { row: childRow, rowid, seq: -1, index, _index: -1, $index: -1, items, parent: parentRow, level: parentLevel + nodes.length }
684
685
  fullDataRowIdData[rowid] = rest
685
686
  fullDataRowMap.set(childRow, rest)
686
687
  fullAllDataRowIdData[rowid] = rest
@@ -1382,7 +1383,8 @@ const Methods = {
1382
1383
  rowid = getRowid(this, rowOrRowid)
1383
1384
  }
1384
1385
  if (rowid) {
1385
- return fullDataRowIdData[rowid] ? fullDataRowIdData[rowid].parent : null
1386
+ const rest = fullDataRowIdData[rowid]
1387
+ return rest ? rest.parent : null
1386
1388
  }
1387
1389
  }
1388
1390
  return null
@@ -132,9 +132,11 @@ export const DomTools = {
132
132
  return getNodeOffset(elem, container, { left: 0, top: 0 })
133
133
  },
134
134
  getAbsolutePos (elem) {
135
+ // 当主页面嵌套在iframe时,elem.getBoundingClientRect()仅计算在当前body内的边界距离,忽略了body所在的边界距离
136
+ const bodyBounding = document.body.getBoundingClientRect()
135
137
  const bounding = elem.getBoundingClientRect()
136
- const boundingTop = bounding.top
137
- const boundingLeft = bounding.left
138
+ const boundingTop = bounding.top - bodyBounding.top
139
+ const boundingLeft = bounding.left - bodyBounding.left
138
140
  const { scrollTop, scrollLeft, visibleHeight, visibleWidth } = getDomNode()
139
141
  return { boundingTop, top: scrollTop + boundingTop, boundingLeft, left: scrollLeft + boundingLeft, visibleHeight, visibleWidth }
140
142
  },