detectField 可以配置成 & 能用更多的属性判断
This commit is contained in:
parent
91b8fe8633
commit
a10a3e3b28
|
@ -234,7 +234,7 @@ export function renderChild(prefix:string, node:SchemaNode, props:renderChildPro
|
||||||
|
|
||||||
const typeofnode = typeof node;
|
const typeofnode = typeof node;
|
||||||
let schema:Schema = typeofnode === 'string' || typeofnode === 'number' ? {type: 'tpl', tpl: String(node)} : node as Schema;
|
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;
|
const exprProps = detectData ? getExprProperties(schema, detectData) : null;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
@ -353,7 +353,7 @@ const defaultOmitList = [
|
||||||
'type', 'name', '$ref', 'className', 'data', 'children',
|
'type', 'name', '$ref', 'className', 'data', 'children',
|
||||||
'ref', 'visible', 'visibleOn', 'hidden',
|
'ref', 'visible', 'visibleOn', 'hidden',
|
||||||
'hiddenOn', 'disabled', 'disabledOn',
|
'hiddenOn', 'disabled', 'disabledOn',
|
||||||
'children'
|
'children', 'detectField'
|
||||||
];
|
];
|
||||||
|
|
||||||
class SchemaRenderer extends React.Component<SchemaRendererProps, any> {
|
class SchemaRenderer extends React.Component<SchemaRendererProps, any> {
|
||||||
|
|
|
@ -1519,7 +1519,7 @@ class TableRow extends React.Component<TableRowProps> {
|
||||||
...rest,
|
...rest,
|
||||||
width: null,
|
width: null,
|
||||||
rowIndex: itemIndex,
|
rowIndex: itemIndex,
|
||||||
colIndex: column.index,
|
colIndex: column.rawIndex,
|
||||||
key: column.index,
|
key: column.index,
|
||||||
onAction: this.handleAction,
|
onAction: this.handleAction,
|
||||||
onQuickChange: this.handleQuickChange,
|
onQuickChange: this.handleQuickChange,
|
||||||
|
@ -1554,7 +1554,7 @@ class TableRow extends React.Component<TableRowProps> {
|
||||||
renderCell(`${itemIndex}/${column.index}`, column, item, {
|
renderCell(`${itemIndex}/${column.index}`, column, item, {
|
||||||
...rest,
|
...rest,
|
||||||
rowIndex: itemIndex,
|
rowIndex: itemIndex,
|
||||||
colIndex: column.index,
|
colIndex: column.rawIndex,
|
||||||
key: column.index,
|
key: column.index,
|
||||||
onAction: this.handleAction,
|
onAction: this.handleAction,
|
||||||
onQuickChange: this.handleQuickChange,
|
onQuickChange: this.handleQuickChange,
|
||||||
|
|
|
@ -29,6 +29,7 @@ export const Column = types
|
||||||
filterable: types.optional(types.frozen(), undefined),
|
filterable: types.optional(types.frozen(), undefined),
|
||||||
fixed: '',
|
fixed: '',
|
||||||
index: 0,
|
index: 0,
|
||||||
|
rawIndex: 0,
|
||||||
breakpoint: types.optional(types.frozen(), undefined),
|
breakpoint: types.optional(types.frozen(), undefined),
|
||||||
pristine: types.optional(types.frozen(), undefined),
|
pristine: types.optional(types.frozen(), undefined),
|
||||||
remark: types.optional(types.frozen(), undefined),
|
remark: types.optional(types.frozen(), undefined),
|
||||||
|
@ -430,6 +431,7 @@ export const TableStore = iRendererStore
|
||||||
columns = columns.map((item, index) => ({
|
columns = columns.map((item, index) => ({
|
||||||
...item,
|
...item,
|
||||||
index,
|
index,
|
||||||
|
rawIndex: index -3,
|
||||||
type: item.type || 'plain',
|
type: item.type || 'plain',
|
||||||
pristine: item,
|
pristine: item,
|
||||||
toggled: item.toggled !== false,
|
toggled: item.toggled !== false,
|
||||||
|
|
Loading…
Reference in New Issue