Skip to content

Commit

Permalink
fix: 打印表格的字段优先使用表格字段
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhou-Bill committed Dec 5, 2024
1 parent 2cf1be3 commit f3fa9a9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/common/editor_add_field.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,18 @@ FieldList.propTypes = {
class EditorAddField extends React.Component {
render() {
const {
addFields: { tableFields, commonFields },
addFields: { tableFields, commonFields, ...rest },
editStore
} = this.props

let content = null
if (editStore.selectedRegion === null || editStore.isSelectingCombine) {
content = null
} else if (editStore.computedRegionIsTable) {
const dataKey = editStore.selectedTableDataKey
content = (
<FieldList
fields={tableFields}
fields={rest?.[dataKey] ?? tableFields}
handleAddField={editStore.addFieldToTable}
/>
)
Expand Down
10 changes: 10 additions & 0 deletions src/common/editor_store.js
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,16 @@ class EditorStore {
}
}

/** 选中的表格数据DataKey */
@computed
get selectedTableDataKey() {
if (this.computedRegionIsTable) {
const arr = this.selectedRegion.split('.')
return this.config.contents[arr[2]].dataKey
}
return null
}

@computed
get computedIsSelectBlock() {
if (this.selected) {
Expand Down

0 comments on commit f3fa9a9

Please sign in to comment.