@quansitech/antd-admin 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Column/Cascader.tsx +78 -78
- package/components/Column/File.tsx +165 -167
- package/components/Column/Image.tsx +76 -76
- package/components/{Table/Option → Column/Readonly/Action}/Link.tsx +77 -67
- package/components/{Table/Option → Column/Readonly/Action}/types.d.ts +5 -4
- package/components/Column/Readonly/Action.tsx +80 -0
- package/components/Column/Readonly/Cascader.tsx +50 -50
- package/components/Column/Readonly/File.tsx +52 -53
- package/components/Column/Readonly/Image.tsx +38 -77
- package/components/Column/Readonly/Ueditor.tsx +18 -0
- package/components/Column/Readonly/types.d.ts +9 -8
- package/components/Column/Ueditor.tsx +313 -313
- package/components/Column/types.d.ts +29 -28
- package/components/Form/Action/Button.tsx +128 -124
- package/components/Form/Action/types.d.ts +5 -4
- package/components/Form/Actions.tsx +38 -34
- package/components/Form.tsx +179 -170
- package/components/FormContext.ts +8 -7
- package/components/Layout/New.tsx +252 -0
- package/components/Layout.tsx +52 -237
- package/components/LayoutContext.ts +25 -25
- package/components/ModalContext.ts +15 -15
- package/components/Table/Action/Button.tsx +88 -88
- package/components/Table/Action/StartEditable.tsx +58 -58
- package/components/Table/Action/types.d.ts +7 -6
- package/components/Table/ToolbarActions.tsx +43 -38
- package/components/Table.scss +4 -7
- package/components/Table.tsx +283 -279
- package/components/TableContext.ts +14 -13
- package/components/Tabs.tsx +71 -71
- package/lib/container.ts +83 -81
- package/lib/customRule.ts +9 -9
- package/lib/global.ts +10 -10
- package/lib/helpers.tsx +145 -149
- package/lib/http.ts +73 -73
- package/lib/schemaHandler.ts +121 -121
- package/lib/upload.ts +177 -177
- package/package.json +2 -6
- package/readme.md +128 -128
- package/components/Column/Readonly/Option.tsx +0 -58
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import {Component, lazy, useEffect, useState} from "react";
|
|
2
|
-
import {ReactComponentLike} from "prop-types";
|
|
3
|
-
import container from "../../../lib/container";
|
|
4
|
-
import {Flex} from "antd";
|
|
5
|
-
import {ColumnReadonlyProps} from "./types";
|
|
6
|
-
import {asyncFilter, handleRules} from "../../../lib/helpers";
|
|
7
|
-
import {Rules} from "@rc-component/async-validator/lib/interface";
|
|
8
|
-
import upperFirst from "lodash/upperFirst";
|
|
9
|
-
|
|
10
|
-
type ComponentType = {
|
|
11
|
-
component: ReactComponentLike,
|
|
12
|
-
props: any,
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default ({options, record}: ColumnReadonlyProps & {
|
|
16
|
-
options?: {
|
|
17
|
-
type: string,
|
|
18
|
-
title: string,
|
|
19
|
-
showRules?: Rules,
|
|
20
|
-
}[],
|
|
21
|
-
}) => {
|
|
22
|
-
|
|
23
|
-
const [Components, setComponents] = useState<ComponentType[]>([]);
|
|
24
|
-
|
|
25
|
-
useEffect(() => {
|
|
26
|
-
if (options) {
|
|
27
|
-
asyncFilter(options, async (Component) => {
|
|
28
|
-
if (!Component.showRules) {
|
|
29
|
-
return true
|
|
30
|
-
}
|
|
31
|
-
return await handleRules(Component.showRules, record)
|
|
32
|
-
}).then((Components: { type: string }[]) => setComponents(Components.map(a => {
|
|
33
|
-
const c = `Table.Option.${upperFirst(a.type)}`
|
|
34
|
-
return {
|
|
35
|
-
props: {
|
|
36
|
-
...a,
|
|
37
|
-
record,
|
|
38
|
-
},
|
|
39
|
-
component: lazy(container.get(c)),
|
|
40
|
-
}
|
|
41
|
-
})))
|
|
42
|
-
}
|
|
43
|
-
}, []);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return <>
|
|
47
|
-
{
|
|
48
|
-
<Flex wrap={true}>
|
|
49
|
-
{
|
|
50
|
-
Components.map(Component => {
|
|
51
|
-
return <Component.component
|
|
52
|
-
key={Component.props.title} {...Component.props}></Component.component>
|
|
53
|
-
})
|
|
54
|
-
}
|
|
55
|
-
</Flex>
|
|
56
|
-
}
|
|
57
|
-
</>
|
|
58
|
-
}
|