detectField 可以配置成 & 能用更多的属性判断

This commit is contained in:
liaoxuezhi 2019-07-22 16:24:43 +08:00
parent 91b8fe8633
commit a10a3e3b28
3 changed files with 6 additions and 4 deletions

View File

@ -234,7 +234,7 @@ export function renderChild(prefix:string, node:SchemaNode, props:renderChildPro
const typeofnode = typeof node;
let schema:Schema = typeofnode === 'string' || typeofnode === 'number' ? {type: 'tpl', tpl: String(node)} : node as Schema;
const detectData = props[schema.detectField || 'data'];
const detectData = schema.detectField === '&' ? props : props[schema.detectField || 'data'];
const exprProps = detectData ? getExprProperties(schema, detectData) : null;
if (
@ -353,7 +353,7 @@ const defaultOmitList = [
'type', 'name', '$ref', 'className', 'data', 'children',
'ref', 'visible', 'visibleOn', 'hidden',
'hiddenOn', 'disabled', 'disabledOn',
'children'
'children', 'detectField'
];
class SchemaRenderer extends React.Component<SchemaRendererProps, any> {

View File

@ -1519,7 +1519,7 @@ class TableRow extends React.Component<TableRowProps> {
...rest,
width: null,
rowIndex: itemIndex,
colIndex: column.index,
colIndex: column.rawIndex,
key: column.index,
onAction: this.handleAction,
onQuickChange: this.handleQuickChange,
@ -1554,7 +1554,7 @@ class TableRow extends React.Component<TableRowProps> {
renderCell(`${itemIndex}/${column.index}`, column, item, {
...rest,
rowIndex: itemIndex,
colIndex: column.index,
colIndex: column.rawIndex,
key: column.index,
onAction: this.handleAction,
onQuickChange: this.handleQuickChange,

View File

@ -29,6 +29,7 @@ export const Column = types
filterable: types.optional(types.frozen(), undefined),
fixed: '',
index: 0,
rawIndex: 0,
breakpoint: types.optional(types.frozen(), undefined),
pristine: types.optional(types.frozen(), undefined),
remark: types.optional(types.frozen(), undefined),
@ -430,6 +431,7 @@ export const TableStore = iRendererStore
columns = columns.map((item, index) => ({
...item,
index,
rawIndex: index -3,
type: item.type || 'plain',
pristine: item,
toggled: item.toggled !== false,