mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-02 11:12:20 +08:00
feat: demo
This commit is contained in:
parent
5b70b68383
commit
d709d41d00
@ -75,12 +75,19 @@ export class TableColumnModel extends FieldModel {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentProps = observable.deep({
|
||||||
|
prefix: '',
|
||||||
|
suffix: '',
|
||||||
|
});
|
||||||
|
|
||||||
setComponentProps(props) {
|
setComponentProps(props) {
|
||||||
this.setProps('componentProps', { ...(this.props.componentProps || {}), ...props });
|
Object.assign(this.componentProps, props);
|
||||||
}
|
}
|
||||||
|
|
||||||
getComponentProps() {
|
getComponentProps() {
|
||||||
return this.props.componentProps;
|
return this.componentProps;
|
||||||
}
|
}
|
||||||
|
|
||||||
setDataSource(dataSource) {
|
setDataSource(dataSource) {
|
||||||
this.setProps('componentProps', { ...(this.props.componentProps || {}), dataSource });
|
this.setProps('componentProps', { ...(this.props.componentProps || {}), dataSource });
|
||||||
}
|
}
|
||||||
@ -110,13 +117,21 @@ export class TableColumnModel extends FieldModel {
|
|||||||
render() {
|
render() {
|
||||||
return (value, record, index) => (
|
return (value, record, index) => (
|
||||||
<>
|
<>
|
||||||
<TableField record={record} model={this} value={value} index={index} />
|
<Demo value={value} model={this} />
|
||||||
{this.renderQuickEditButton(record)}
|
{this.renderQuickEditButton(record)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Demo = observer<any>(({ model, value }) => {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{model.componentProps.prefix} | {value} | {model.componentProps.suffix}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
TableColumnModel.define({
|
TableColumnModel.define({
|
||||||
title: 'Table Column',
|
title: 'Table Column',
|
||||||
icon: 'TableColumn',
|
icon: 'TableColumn',
|
||||||
@ -145,5 +160,27 @@ TableColumnModel.registerFlow({
|
|||||||
ctx.model.setProps('dataIndex', field.name);
|
ctx.model.setProps('dataIndex', field.name);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
step2: {
|
||||||
|
title: 'Edit Title',
|
||||||
|
uiSchema: {
|
||||||
|
prefix: {
|
||||||
|
'x-component': 'Input',
|
||||||
|
'x-decorator': 'FormItem',
|
||||||
|
'x-component-props': {
|
||||||
|
placeholder: 'Prefix',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
suffix: {
|
||||||
|
'x-component': 'Input',
|
||||||
|
'x-decorator': 'FormItem',
|
||||||
|
'x-component-props': {
|
||||||
|
placeholder: 'Suffix',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
handler(ctx, params) {
|
||||||
|
ctx.model.setComponentProps(params);
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -53,18 +53,18 @@ export class TableModel extends DataBlockModel<S> {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
subModels: {
|
// subModels: {
|
||||||
field: {
|
// field: {
|
||||||
use: 'TableFieldModel',
|
// use: 'TableFieldModel',
|
||||||
stepParams: {
|
// stepParams: {
|
||||||
default: {
|
// default: {
|
||||||
step1: {
|
// step1: {
|
||||||
fieldPath: field.fullpath,
|
// fieldPath: field.fullpath,
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
})}
|
})}
|
||||||
appendItems={[
|
appendItems={[
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user