-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
77e9242
commit acafcc7
Showing
28 changed files
with
421 additions
and
347 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
|
||
import { computed} from "@speedform/reactive" | ||
import { createForm } from "@speedform/core" | ||
import { Project, getProjects } from "../../api/getProjects" | ||
import { delay } from "flex-tools/async/delay" | ||
|
||
|
||
|
||
// type NetworkType={ | ||
// title:Field<string> | ||
// interface:Field<'wifi' | 'ethernet'> | ||
// ip:Field<IP> | ||
// gateway:string | ||
// dhcp:Field<boolean> | ||
// dhcpStart:Field<string> | ||
// dhcpEnd:Field<string> | ||
// dns:string[] | ||
// subnetMask:string | ||
// mac:string | ||
// wifi:{ | ||
// ssid:Field<string> | ||
// password:Field<string> | ||
// } | ||
// } | ||
|
||
|
||
// 声明表单数据 | ||
const orderForm ={ | ||
title:"订单管理", | ||
visible:(orders:any)=>orders.orders.length<10, | ||
enable:(orders:any)=>orders.orders.length<10, | ||
valid:(orders:any)=>orders.orders.length<10, | ||
readonly:(orders:any)=>(orders).orders.length<10, | ||
fields:{ | ||
|
||
title:{ | ||
value:"React-Helux-Form", | ||
placeholder:"订单名称", | ||
title:"网络名称", | ||
validate:(orders:any)=>orders.title.value.length>3 | ||
}, | ||
id:{ | ||
value:"", | ||
title:"订单号", | ||
select:()=>{ | ||
return [{value:"wifi",title:"无线网卡"},{value:"ethernet",title:"有线网卡"}] | ||
} | ||
}, | ||
orders:[ | ||
{ | ||
book : {value:"AA"}, | ||
count: {title:"数量",value:1}, | ||
prict: {title:"单价",value:12}, | ||
sum : {title:"小计",value:12} | ||
}, | ||
{ | ||
book : {value:"BB"}, | ||
count: {title:"数量",value:2}, | ||
prict: {title:"单价",value:56}, | ||
sum : {title:"小计",value:112} | ||
}, | ||
], | ||
total:{ | ||
title:"总金额", | ||
value:100 | ||
} | ||
}, | ||
actions:{ | ||
addBook:{ | ||
title:"添加书籍", | ||
execute:async (scope:any)=>{ | ||
console.log(scope) | ||
} | ||
}, | ||
submit:{ | ||
title:"添加订单", | ||
visible:(scope:any)=>scope.orders.length<10, | ||
enable:(scope:any)=>scope.orders.length<10, | ||
// 提交数据 | ||
execute:async (scope:any)=>{ | ||
await delay(1000) | ||
await fetch(scope) | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
|
||
const BookOrders = createForm(orderForm,{ | ||
debug:true | ||
}) | ||
|
||
|
||
BookOrders.actions | ||
|
||
|
||
|
||
BookOrders.fields.orders[0]!.book.value | ||
|
||
// @ts-ignore | ||
globalThis.BookOrders = BookOrders | ||
export default BookOrders |
2 changes: 1 addition & 1 deletion
2
example/src/bookOrderDemo.tsx → example/src/forms/bookOrder/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.