-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: 💡 pro-array-table-shadow-modal, docs, but no demos up
- Loading branch information
Showing
9 changed files
with
213 additions
and
44 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
# 👻 ShaowForm 影子表单 | ||
|
||
> 子表单 | ||
> 脱离于当前 Form 响应式上下文的子表单 | ||
这很有用, 解决表格中的弹窗编辑与增加, 以及对象弹窗编辑的 Pro!Editable | ||
|
||
### 代码案例: Confirm | ||
<code src="../demos/ShadowForm.tsx" /> | ||
|
||
|
||
### 代码案例: 在列表中使用 | ||
<code src="../demos/ShadowFormWithArray.tsx" /> | ||
|
||
### useShadowForm | ||
|
||
### ShadowFormProvider |
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from "./utils"; | ||
export * from "./pickomit"; |
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,33 @@ | ||
export const omit = <T extends object, K extends keyof T>( | ||
o: T, | ||
...keys: K[] | ||
) => { | ||
if (typeof o !== "object") return o; | ||
return Object.keys(o).reduce((p, k: string) => { | ||
if (!keys.includes(k as any)) { | ||
(p as any)[k] = (o as any)[k]; | ||
} | ||
return p; | ||
}, {} as T); | ||
}; | ||
|
||
export const pick = <T extends object, K extends keyof T>( | ||
o: T, | ||
...keys: K[] | ||
) => { | ||
if (typeof o !== "object") return o; | ||
return Object.keys(o).reduce( | ||
(p, k: string) => { | ||
if (keys.includes(k as any)) { | ||
(p as any)[k] = (o as any)[k]; | ||
} | ||
return p; | ||
}, | ||
{} as T, | ||
// { | ||
// // 不太好用, 晚点练习一下类型体操吧 | ||
// // https://github.com/ascoders/weekly/blob/master/TS%20%E7%B1%BB%E5%9E%8B%E4%BD%93%E6%93%8D/243.%E7%B2%BE%E8%AF%BB%E3%80%8APick%2C%20Awaited%2C%20If...%E3%80%8B.md | ||
// [Key in K]: T[K]; | ||
// }, | ||
); | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
export { ShadowForm, useShadowSchemaField } from "./shadow-form"; | ||
export { | ||
ShadowFormProvider as ShadowForm, | ||
useShadowSchemaField, | ||
} from "./shadow-form"; | ||
export { ShadowPopconfirm } from "./shadow-popconfirm"; |
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