mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 01:21:58 +00:00
fix: fix NextTable callback function
This commit is contained in:
parent
0ee8892190
commit
ce77375f66
@ -904,11 +904,7 @@
|
||||
},{
|
||||
"name": "callback",
|
||||
"description": "callback",
|
||||
"propType": "JsonSetter",
|
||||
"defaultValue": {
|
||||
"type": "JSFunction",
|
||||
"value": "(rowData, action, table) => {\n return table.editRow(rowData).then((row) => {\n console.log(row);\n })}"
|
||||
}
|
||||
"setter": "FunctionSetter"
|
||||
}]
|
||||
}
|
||||
},
|
||||
@ -916,7 +912,7 @@
|
||||
"title": "Title",
|
||||
"callback": {
|
||||
"type": "JSFunction",
|
||||
"value": "(rowData, action, table) => {\n return table.editRow(rowData).then((row) => {\n console.log(row);\n })}"
|
||||
"value": "function(){}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import React, { Component } from 'react';
|
||||
import { registerSetter } from '@ali/lowcode-editor-core';
|
||||
import { isJSExpression } from '@ali/lowcode-types';
|
||||
import { isJSExpression,isJSFunction } from '@ali/lowcode-types';
|
||||
import { DatePicker, TimePicker, Input, Radio, Select, Switch, NumberPicker } from '@alifd/next';
|
||||
import ExpressionSetter from './expression-setter';
|
||||
import ColorSetter from './color-setter';
|
||||
@ -91,6 +91,16 @@ const VariableSetter ={
|
||||
recommend: true,
|
||||
};
|
||||
|
||||
|
||||
const FunctionBindSetter = {
|
||||
component: FunctionSetter,
|
||||
title: '函数绑定',
|
||||
condition: (field: any) => {
|
||||
const v = field.getValue();
|
||||
return v == isJSFunction(v);
|
||||
},
|
||||
}
|
||||
|
||||
const builtinSetters: any = {
|
||||
StringSetter,
|
||||
NumberSetter,
|
||||
@ -110,7 +120,7 @@ const builtinSetters: any = {
|
||||
JsonSetter,
|
||||
StyleSetter,
|
||||
IconSetter,
|
||||
FunctionSetter
|
||||
FunctionSetter:FunctionBindSetter
|
||||
};
|
||||
|
||||
registerSetter(builtinSetters);
|
||||
|
||||
@ -17,6 +17,23 @@ export interface JSExpression {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
// 函数
|
||||
export interface JSFunction{
|
||||
type: 'JSFunction';
|
||||
/**
|
||||
* 函数字符串
|
||||
*/
|
||||
value: string;
|
||||
/**
|
||||
* 模拟值
|
||||
*/
|
||||
mock?: any;
|
||||
/**
|
||||
* 额外扩展属性,如 extType、events
|
||||
*/
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export interface JSSlot {
|
||||
name?: string;
|
||||
type: 'JSSlot';
|
||||
@ -39,7 +56,7 @@ export interface JSONObject {
|
||||
}
|
||||
|
||||
// 复合类型
|
||||
export type CompositeValue = JSONValue | JSExpression | JSSlot | CompositeArray | CompositeObject;
|
||||
export type CompositeValue = JSONValue | JSExpression | JSSlot | CompositeArray | CompositeObject | JSFunction;
|
||||
export type CompositeArray = CompositeValue[];
|
||||
export interface CompositeObject {
|
||||
[key: string]: CompositeValue;
|
||||
@ -50,6 +67,14 @@ export function isJSExpression(data: any): data is JSExpression {
|
||||
return data && data.type === 'JSExpression';
|
||||
}
|
||||
|
||||
|
||||
export function isJSFunction(data: any): data is JSFunction {
|
||||
return data && data.type === 'JSFunction';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
export function isJSSlot(data: any): data is JSSlot {
|
||||
return data && data.type === 'JSSlot';
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user