diff --git a/scss/components/_crud.scss b/scss/components/_crud.scss index ff6d0286..48742b89 100644 --- a/scss/components/_crud.scss +++ b/scss/components/_crud.scss @@ -17,7 +17,7 @@ &-value { cursor: pointer; - vertical-align: top; + vertical-align: middle; user-select: none; line-height: $Form-input-lineHeight * $Form-input-fontSize - px2rem(2px); display: inline-block; @@ -59,7 +59,7 @@ user-select: none; margin-left: $gap-xs; margin-top: $gap-xs; - vertical-align: top; + vertical-align: middle; } &-toolbar-item { diff --git a/src/renderers/CRUD.tsx b/src/renderers/CRUD.tsx index b6c752c8..d2f283ae 100644 --- a/src/renderers/CRUD.tsx +++ b/src/renderers/CRUD.tsx @@ -25,6 +25,7 @@ import {evalExpression, filter} from '../utils/tpl'; import {isValidApi, buildApi} from '../utils/api'; import omit = require('lodash/omit'); import find = require('lodash/find'); +import Html from '../components/Html'; interface CRUDProps extends RendererProps { api?: Api; @@ -1264,7 +1265,7 @@ export default class CRUD extends React.Component { {labelTpl - ? filter(labelTpl, item) + ? () : getVariable(item, labelField || 'label') || getVariable(item, primaryField || 'id')} diff --git a/src/renderers/Form/Picker.tsx b/src/renderers/Form/Picker.tsx index 0789c69d..725e04f3 100644 --- a/src/renderers/Form/Picker.tsx +++ b/src/renderers/Form/Picker.tsx @@ -12,8 +12,10 @@ import { Action } from '../../types'; import find = require('lodash/find'); -import {anyChanged, autobind} from '../../utils/helper'; +import {anyChanged, autobind, getVariable} from '../../utils/helper'; import findIndex = require('lodash/findIndex'); +import Html from '../../components/Html'; +import { filter } from '../../utils/tpl'; export interface PickerProps extends OptionsControlProps { modalMode: 'dialog' | 'drawer'; @@ -172,6 +174,7 @@ export default class PickerControl extends React.PureComponent classPrefix: ns, selectedOptions, labelField, + labelTpl, disabled } = this.props; return ( @@ -181,7 +184,11 @@ export default class PickerControl extends React.PureComponent 'is-disabled': disabled })}> × - {item[labelField || 'label']} + + {labelTpl + ? () + : getVariable(item, labelField || 'label') || getVariable(item, 'id')} + ))} @@ -235,13 +242,13 @@ export default class PickerControl extends React.PureComponent className={`${ns}Picker-pickBtn`} tooltip="点击选择" tooltipContainer={env && env.getModalContainer ? env.getModalContainer() : undefined} - level="link" + level="info" size="sm" disabled={disabled} onClick={this.open} iconOnly > - + 选定 {render('modal', {