diff --git a/package.json b/package.json index e852de15bfb..f169d2f826f 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,8 @@ "@types/react-dom": "^18.0.0", "@mapbox/hast-util-to-jsx": "~1.0.0", "yargs": "^16.x", - "commander": "^6.x" + "commander": "^6.x", + "ttypescript": "1.5.15" }, "devDependencies": { "@alifd/next": "^1.19.1", diff --git a/packages/react/docs/api/shared/Schema.md b/packages/react/docs/api/shared/Schema.md index d1a1d371de1..5baa7663a94 100644 --- a/packages/react/docs/api/shared/Schema.md +++ b/packages/react/docs/api/shared/Schema.md @@ -629,8 +629,9 @@ type SchemaEnum = Array< #### Description -Schema linkage protocol, if the reaction object contains target, it represents active linkage mode, otherwise it represents passive linkage mode -If you want to achieve more complex linkage, you can pass in the reaction responder function through the scope for processing +Schema linkage protocol, if the reaction object contains target, it represents active linkage mode, otherwise it represents passive linkage mode +If you want to achieve more complex linkage, you can pass in the reaction responder function through the scope for processing +FormPathPattern path syntax documentation is [here](https://core.formilyjs.org/api/entry/form-path#formpathpattern) #### Signature @@ -651,7 +652,18 @@ type SchemaReactionEffect = type SchemaReaction = | { - dependencies?: string[] | Record //The list of dependent field paths can only describe dependencies in dot paths, and supports relative paths. If it is an array format, then it is also an array format when reading, if it is an object format , It is also an object format when reading, but the object format is equivalent to an alias + dependencies?: //The list of dependent field paths can only describe dependencies in dot paths, and supports relative paths + | Array< + | string //If it is an array contains string format, then it is also an array format when reading + | { + //If it is an array contains object format, then it is an object format when reading, but the name field is equivalent to an alias + name?: string + type?: string + source?: string + property?: string + } + > + | Record //If it is an object format, It is also an object format when reading, but the key for object is equivalent to an alias when?: string | boolean //Linkage condition target?: string //The field path to be operated, supports FormPathPattern path syntax, note: relative path is not supported! ! effects?: SchemaReactionEffect[] //Independent life cycle hook in active mode diff --git a/packages/react/docs/api/shared/Schema.zh-CN.md b/packages/react/docs/api/shared/Schema.zh-CN.md index a255b5cd039..cd423ba39ba 100644 --- a/packages/react/docs/api/shared/Schema.zh-CN.md +++ b/packages/react/docs/api/shared/Schema.zh-CN.md @@ -629,8 +629,9 @@ type SchemaEnum = Array< #### 描述 -Schema 联动协议,如果 reaction 对象里包含 target,则代表主动联动模式,否则代表被动联动模式 -如果想实现更复杂的联动,可以通过作用域传入 reaction 响应器函数进行处理 +Schema 联动协议,如果 reaction 对象里包含 target,则代表主动联动模式,否则代表被动联动模式 +如果想实现更复杂的联动,可以通过作用域传入 reaction 响应器函数进行处理 +FormPathPattern 路径语法文档看[这里](https://core.formilyjs.org/zh-CN/api/entry/form-path#formpathpattern) #### 签名 @@ -651,9 +652,20 @@ type SchemaReactionEffect = type SchemaReaction = | { - dependencies?: string[] | Record //依赖的字段路径列表,只能以点路径描述依赖,支持相对路径,如果是数组格式,那么读的时候也是数组格式,如果是对象格式,读的时候也是对象格式,只是对象格式相当于是一个alias + dependencies?: //依赖的字段路径列表,支持FormPathPattern数据路径语法, 只能以点路径描述依赖,支持相对路径 + | Array< + | string //如果数组里是string,那么读的时候也是数组格式 + | { + //如果数组里是对象, 那么读的时候通过name从$deps获取 + name?: string //从$deps读取时的别名 + type?: string //字段类型 + source?: string //字段路径 + property?: string //依赖属性, 默认为value + } + > + | Record //如果是对象格式,读的时候也是对象格式,只是对象的key相当于别名 when?: string | boolean //联动条件 - target?: string //要操作的字段路径,支持FormPathPattern路径语法,注意:不支持相对路径!! + target?: string //要操作的字段路径,支持FormPathPattern匹配路径语法,注意:不支持相对路径!! effects?: SchemaReactionEffect[] //主动模式下的独立生命周期钩子 fulfill?: { //满足条件 @@ -668,11 +680,11 @@ type SchemaReaction = run?: string //执行语句 } } - | ((field: Field) => void) //可以复杂联动 + | ((field: Field) => void) //支持函数, 可以复杂联动 type SchemaReactions = | SchemaReaction - | SchemaReaction[] + | SchemaReaction[] //支持传入数组 ``` #### 用例 diff --git a/packages/vue/docs/api/shared/schema.md b/packages/vue/docs/api/shared/schema.md index d9e6c7fc160..cafbd957a33 100644 --- a/packages/vue/docs/api/shared/schema.md +++ b/packages/vue/docs/api/shared/schema.md @@ -627,8 +627,9 @@ type SchemaEnum = Array< #### 描述 -Schema 联动协议,如果 reaction 对象里包含 target,则代表主动联动模式,否则代表被动联动模式 -如果想实现更复杂的联动,可以通过作用域传入 reaction 响应器函数进行处理 +Schema 联动协议,如果 reaction 对象里包含 target,则代表主动联动模式,否则代表被动联动模式 +如果想实现更复杂的联动,可以通过作用域传入 reaction 响应器函数进行处理 +FormPathPattern 路径语法文档看[这里](https://core.formilyjs.org/zh-CN/api/entry/form-path#formpathpattern) #### 签名 @@ -649,9 +650,20 @@ type SchemaReactionEffect = type SchemaReaction = | { - dependencies?: string[] | Record //依赖的字段路径列表,只能以点路径描述依赖,支持相对路径,如果是数组格式,那么读的时候也是数组格式,如果是对象格式,读的时候也是对象格式,只是对象格式相当于是一个alias + dependencies?: //依赖的字段路径列表,支持FormPathPattern数据路径语法, 只能以点路径描述依赖,支持相对路径 + | Array< + | string //如果数组里是string,那么读的时候也是数组格式 + | { + //如果数组里是对象, 那么读的时候通过name从$deps获取 + name?: string //从$deps读取时的别名 + type?: string //字段类型 + source?: string //字段路径 + property?: string //依赖属性, 默认为value + } + > + | Record //如果是对象格式,读的时候也是对象格式,只是对象的key相当于别名 when?: string | boolean //联动条件 - target?: string //要操作的字段路径,支持FormPathPattern路径语法,注意:不支持相对路径!! + target?: string //要操作的字段路径,支持FormPathPattern匹配路径语法,注意:不支持相对路径!! effects?: SchemaReactionEffect[] //主动模式下的独立生命周期钩子 fulfill?: { //满足条件 @@ -666,11 +678,11 @@ type SchemaReaction = run?: string //执行语句 } } - | ((field: Field) => void) //可以复杂联动 + | ((field: Field) => void) //支持函数, 可以复杂联动 type SchemaReactions = | SchemaReaction - | SchemaReaction[] + | SchemaReaction[] //支持传入数组 ``` #### 用例