mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-02 03:02:19 +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) {
|
||||
this.setProps('componentProps', { ...(this.props.componentProps || {}), ...props });
|
||||
Object.assign(this.componentProps, props);
|
||||
}
|
||||
|
||||
getComponentProps() {
|
||||
return this.props.componentProps;
|
||||
return this.componentProps;
|
||||
}
|
||||
|
||||
setDataSource(dataSource) {
|
||||
this.setProps('componentProps', { ...(this.props.componentProps || {}), dataSource });
|
||||
}
|
||||
@ -110,13 +117,21 @@ export class TableColumnModel extends FieldModel {
|
||||
render() {
|
||||
return (value, record, index) => (
|
||||
<>
|
||||
<TableField record={record} model={this} value={value} index={index} />
|
||||
<Demo value={value} model={this} />
|
||||
{this.renderQuickEditButton(record)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const Demo = observer<any>(({ model, value }) => {
|
||||
return (
|
||||
<div>
|
||||
{model.componentProps.prefix} | {value} | {model.componentProps.suffix}
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
TableColumnModel.define({
|
||||
title: 'Table Column',
|
||||
icon: 'TableColumn',
|
||||
@ -145,5 +160,27 @@ TableColumnModel.registerFlow({
|
||||
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: {
|
||||
field: {
|
||||
use: 'TableFieldModel',
|
||||
stepParams: {
|
||||
default: {
|
||||
step1: {
|
||||
fieldPath: field.fullpath,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
// subModels: {
|
||||
// field: {
|
||||
// use: 'TableFieldModel',
|
||||
// stepParams: {
|
||||
// default: {
|
||||
// step1: {
|
||||
// fieldPath: field.fullpath,
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
})}
|
||||
appendItems={[
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user