szld-libs 0.0.24 → 0.0.26
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/dist/szld-components.es.js +1728 -1710
- package/dist/szld-components.umd.js +28 -28
- package/es/components/CreateForm/index.d.ts +9 -6
- package/es/components/CreateForm/index.js +39 -21
- package/es/index.js +35 -68
- package/lib/components/CreateForm/index.d.ts +9 -6
- package/lib/components/CreateForm/index.js +38 -20
- package/lib/index.js +34 -67
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { FormProps, FormItemProps, ColProps, RowProps, InputProps, SelectProps, InputNumberProps, RadioGroupProps, SwitchProps, TimePickerProps, ButtonProps, CascaderProps } from "antd";
|
|
1
|
+
import { FormProps, FormItemProps, ColProps, RowProps, InputProps, SelectProps, InputNumberProps, RadioGroupProps, SwitchProps, TimePickerProps, ButtonProps, CascaderProps, RateProps } from "antd";
|
|
2
2
|
import { DefaultOptionType } from "antd/es/cascader";
|
|
3
3
|
import { CheckboxGroupProps } from "antd/es/checkbox";
|
|
4
4
|
import { DatePickerProps, RangePickerProps } from "antd/es/date-picker";
|
|
5
5
|
import { PasswordProps, TextAreaProps } from "antd/es/input";
|
|
6
|
-
import React, { ReactNode } from "react";
|
|
6
|
+
import React, { ReactElement, ReactNode } from "react";
|
|
7
7
|
import { UploadFileProps } from "../Upload";
|
|
8
|
-
export type ValueType = "rangePicker" | "select" | "input" | "password" | "textarea" | "radio" | "inputNumber" | "switch" | "checkbox" | "timePicker" | "datePicker" | "cascader" | "upload" | "modal" | "btns";
|
|
8
|
+
export type ValueType = "rangePicker" | "select" | "input" | "password" | "textarea" | "radio" | "inputNumber" | "switch" | "checkbox" | "timePicker" | "datePicker" | "cascader" | "upload" | "modal" | "rate" | "custom" | "btns";
|
|
9
9
|
interface ValueBtnProps extends ButtonProps {
|
|
10
10
|
title: string;
|
|
11
11
|
btnType: "submit" | "reset" | "cancel";
|
|
@@ -17,13 +17,16 @@ interface ValueModalProps {
|
|
|
17
17
|
labelKey: string;
|
|
18
18
|
value?: any;
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
interface customValueProps {
|
|
21
|
+
children: ReactElement;
|
|
22
|
+
}
|
|
23
|
+
export type ValueProps<T> = T extends "checkbox" ? CheckboxGroupProps : T extends "select" ? SelectProps : T extends "inputNumber" ? InputNumberProps : T extends "textarea" ? TextAreaProps : T extends "radio" ? RadioGroupProps : T extends "switch" ? SwitchProps : T extends "rangePicker" ? RangePickerProps : T extends "datePicker" ? DatePickerProps : T extends "timePicker" ? TimePickerProps : T extends "input" ? InputProps : T extends "cascader" ? CascaderProps<DefaultOptionType> : T extends "upload" ? UploadFileProps : T extends "modal" ? ValueModalProps : T extends "btns" ? ValueBtnProps[] : T extends "password" ? PasswordProps : T extends "rate" ? RateProps : T extends "custom" ? customValueProps : InputProps;
|
|
21
24
|
export interface CreateFormItemProps<T> {
|
|
22
25
|
formItemProps?: FormItemProps;
|
|
23
26
|
valueType?: T;
|
|
24
27
|
valueProps?: ValueProps<T>;
|
|
25
28
|
colProps?: ColProps;
|
|
26
|
-
dataIndex
|
|
29
|
+
dataIndex?: string;
|
|
27
30
|
title?: string;
|
|
28
31
|
onChange?: (e: any) => void;
|
|
29
32
|
hidden?: boolean;
|
|
@@ -44,5 +47,5 @@ interface FormFieldsProps extends Pick<CreateFormItemProps<ValueType>, "valueTyp
|
|
|
44
47
|
onBtnClick?: (e: React.MouseEvent<HTMLElement, MouseEvent>, item: ValueBtnProps) => void;
|
|
45
48
|
inputRef?: any;
|
|
46
49
|
}
|
|
47
|
-
export declare const FormFields: (props: FormFieldsProps) => React.FunctionComponentElement<any>;
|
|
50
|
+
export declare const FormFields: (props: FormFieldsProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.FunctionComponentElement<any>;
|
|
48
51
|
export default CreateForm;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React, { useMemo, createElement } from "react";
|
|
3
|
-
import { Form, Row, Col, Input, Space, Button, Cascader, TimePicker, DatePicker, Switch, Radio, InputNumber, Select, Checkbox } from "antd";
|
|
3
|
+
import { Form, Row, Col, Input, Space, Button, Cascader, TimePicker, DatePicker, Switch, Radio, InputNumber, Select, Checkbox, Rate } from "antd";
|
|
4
4
|
import { CloseCircleFilled } from "@ant-design/icons";
|
|
5
5
|
import _ from "lodash";
|
|
6
6
|
import UploadFile from "../Upload";
|
|
@@ -70,31 +70,38 @@ const CreateForm = (props) => {
|
|
|
70
70
|
form: formProps == null ? void 0 : formProps.form,
|
|
71
71
|
...formLayout,
|
|
72
72
|
...formProps || {},
|
|
73
|
-
children: /* @__PURE__ */ jsx(Row, { gutter: 16, ...rowProps, children: items.filter((v) => !v.hidden).map((item) => {
|
|
73
|
+
children: /* @__PURE__ */ jsx(Row, { gutter: 16, ...rowProps, children: items.filter((v) => !v.hidden).map((item, index) => {
|
|
74
74
|
var _a, _b;
|
|
75
|
-
return /* @__PURE__ */ jsx(
|
|
76
|
-
|
|
75
|
+
return /* @__PURE__ */ jsx(
|
|
76
|
+
Col,
|
|
77
77
|
{
|
|
78
|
-
...item.
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
label: !hiddenTitle ? item.title : "",
|
|
82
|
-
name: item.valueType === "btns" ? void 0 : item.dataIndex,
|
|
83
|
-
...item.formItemProps,
|
|
84
|
-
children: item.readonly ? /* @__PURE__ */ jsx("div", { children: item.value || ((_a = formProps == null ? void 0 : formProps.initialValues) == null ? void 0 : _a[item.dataIndex]) }) : item.readonly === void 0 && readonly ? /* @__PURE__ */ jsx("div", { children: item.value || ((_b = formProps == null ? void 0 : formProps.initialValues) == null ? void 0 : _b[item.dataIndex]) }) : /* @__PURE__ */ jsx(
|
|
85
|
-
FormFields,
|
|
78
|
+
...item.colProps || { span: 24 },
|
|
79
|
+
children: /* @__PURE__ */ jsx(
|
|
80
|
+
Form.Item,
|
|
86
81
|
{
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
valueType: item.
|
|
92
|
-
|
|
93
|
-
|
|
82
|
+
...item.valueType === "upload" ? {
|
|
83
|
+
getValueFromEvent: normFile
|
|
84
|
+
} : {},
|
|
85
|
+
label: !hiddenTitle ? item.title : "",
|
|
86
|
+
name: item.valueType === "btns" ? void 0 : item.dataIndex,
|
|
87
|
+
...item.formItemProps,
|
|
88
|
+
children: item.readonly ? /* @__PURE__ */ jsx("div", { children: item.value || item.dataIndex && ((_a = formProps == null ? void 0 : formProps.initialValues) == null ? void 0 : _a[item.dataIndex]) }) : item.readonly === void 0 && readonly ? /* @__PURE__ */ jsx("div", { children: item.value || item.dataIndex && ((_b = formProps == null ? void 0 : formProps.initialValues) == null ? void 0 : _b[item.dataIndex]) }) : /* @__PURE__ */ jsx(
|
|
89
|
+
FormFields,
|
|
90
|
+
{
|
|
91
|
+
onChange: (e) => {
|
|
92
|
+
var _a2;
|
|
93
|
+
return (_a2 = item == null ? void 0 : item.onChange) == null ? void 0 : _a2.call(item, e);
|
|
94
|
+
},
|
|
95
|
+
valueType: item.valueType,
|
|
96
|
+
onBtnClick,
|
|
97
|
+
valueProps: item.valueProps
|
|
98
|
+
}
|
|
99
|
+
)
|
|
94
100
|
}
|
|
95
101
|
)
|
|
96
|
-
}
|
|
97
|
-
|
|
102
|
+
},
|
|
103
|
+
item.dataIndex || index
|
|
104
|
+
);
|
|
98
105
|
}) })
|
|
99
106
|
}
|
|
100
107
|
);
|
|
@@ -104,6 +111,9 @@ const FormFields = (props) => {
|
|
|
104
111
|
const children = useMemo(() => {
|
|
105
112
|
let result = /* @__PURE__ */ jsx(Input, { placeholder: "请输入", ...valueProps, allowClear: true });
|
|
106
113
|
switch (valueType) {
|
|
114
|
+
case "rate":
|
|
115
|
+
result = /* @__PURE__ */ jsx(Rate, { ...valueProps });
|
|
116
|
+
break;
|
|
107
117
|
case "password":
|
|
108
118
|
result = /* @__PURE__ */ jsx(Input.Password, { ...valueProps });
|
|
109
119
|
break;
|
|
@@ -208,6 +218,14 @@ const FormFields = (props) => {
|
|
|
208
218
|
}
|
|
209
219
|
return result;
|
|
210
220
|
}, [valueType, valueProps, onChange, value]);
|
|
221
|
+
if (valueType === "custom") {
|
|
222
|
+
const params = valueProps;
|
|
223
|
+
return React.cloneElement(params.children, {
|
|
224
|
+
[getValuePropName(valueType || "input")]: value,
|
|
225
|
+
onChange,
|
|
226
|
+
ref: inputRef
|
|
227
|
+
});
|
|
228
|
+
}
|
|
211
229
|
return React.cloneElement(children, {
|
|
212
230
|
[getValuePropName(valueType || "input")]: value,
|
|
213
231
|
onChange,
|
package/es/index.js
CHANGED
|
@@ -2,10 +2,12 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
import ReactDOM from "react-dom/client";
|
|
4
4
|
import { BrowserRouter } from "react-router-dom";
|
|
5
|
-
import { BackHeader, AuthButton, SearchTable,
|
|
5
|
+
import { BackHeader, AuthButton, SearchTable, UploadFile } from "./main";
|
|
6
6
|
import CoralButton from "./components/CoralButton";
|
|
7
|
+
import { Form, Space, Input, Button } from "antd";
|
|
7
8
|
const Demo = () => {
|
|
8
|
-
const [
|
|
9
|
+
const [form] = Form.useForm();
|
|
10
|
+
useState([
|
|
9
11
|
{
|
|
10
12
|
PNOrderNo: 1,
|
|
11
13
|
PNName: "未分配",
|
|
@@ -25,41 +27,7 @@ const Demo = () => {
|
|
|
25
27
|
Remark: ""
|
|
26
28
|
}
|
|
27
29
|
]);
|
|
28
|
-
|
|
29
|
-
{
|
|
30
|
-
dataIndex: "PNOrderNo",
|
|
31
|
-
title: "序号",
|
|
32
|
-
width: 80
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
dataIndex: "PNName",
|
|
36
|
-
title: "节点名称"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
dataIndex: "PlanFinishDate",
|
|
40
|
-
title: "预计完成时间",
|
|
41
|
-
editable: true,
|
|
42
|
-
width: 400,
|
|
43
|
-
type: "datePicker",
|
|
44
|
-
valueProps: {
|
|
45
|
-
placeholder: "请输入内容"
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
dataIndex: "Remark",
|
|
50
|
-
title: "备注",
|
|
51
|
-
editable: true,
|
|
52
|
-
type: "textarea",
|
|
53
|
-
width: 400,
|
|
54
|
-
valueProps: {
|
|
55
|
-
placeholder: "请输入内容",
|
|
56
|
-
autoSize: {
|
|
57
|
-
minRows: 3
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
];
|
|
62
|
-
const [data, setData] = useState(
|
|
30
|
+
useState(
|
|
63
31
|
Array.from({ length: 1e5 }, (_, key) => ({
|
|
64
32
|
key,
|
|
65
33
|
age: key,
|
|
@@ -67,11 +35,6 @@ const Demo = () => {
|
|
|
67
35
|
}))
|
|
68
36
|
);
|
|
69
37
|
useState(false);
|
|
70
|
-
const columns2 = [
|
|
71
|
-
{ title: "A", dataIndex: "key", width: 150 },
|
|
72
|
-
{ title: "B", dataIndex: "title", editable: true },
|
|
73
|
-
{ title: "C", dataIndex: "age" }
|
|
74
|
-
];
|
|
75
38
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
76
39
|
/* @__PURE__ */ jsx(BackHeader, { title: "标题111", subTitle: /* @__PURE__ */ jsx("span", { children: "副标题" }) }),
|
|
77
40
|
/* @__PURE__ */ jsx(AuthButton, { type: "primary", children: "按钮1" }),
|
|
@@ -90,12 +53,39 @@ const Demo = () => {
|
|
|
90
53
|
span: 6
|
|
91
54
|
}
|
|
92
55
|
},
|
|
56
|
+
{
|
|
57
|
+
valueType: "custom",
|
|
58
|
+
valueProps: {
|
|
59
|
+
children: /* @__PURE__ */ jsxs(Space, { children: [
|
|
60
|
+
/* @__PURE__ */ jsx(Form.Item, { name: "yzm", noStyle: true, children: /* @__PURE__ */ jsx(Input, { placeholder: "请输入验证码" }) }),
|
|
61
|
+
/* @__PURE__ */ jsx(Button, { children: "发送验证码" })
|
|
62
|
+
] })
|
|
63
|
+
},
|
|
64
|
+
colProps: {
|
|
65
|
+
span: 6
|
|
66
|
+
}
|
|
67
|
+
},
|
|
93
68
|
{
|
|
94
69
|
dataIndex: "mm",
|
|
95
|
-
valueType: "password"
|
|
70
|
+
valueType: "password",
|
|
71
|
+
colProps: {
|
|
72
|
+
span: 6
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
dataIndex: "btns",
|
|
77
|
+
valueType: "btns",
|
|
78
|
+
valueProps: [
|
|
79
|
+
{
|
|
80
|
+
btnType: "submit",
|
|
81
|
+
title: "确定",
|
|
82
|
+
type: "primary",
|
|
83
|
+
onClick: (v) => console.log(v)
|
|
84
|
+
}
|
|
85
|
+
]
|
|
96
86
|
}
|
|
97
87
|
],
|
|
98
|
-
formProps: { wrapperCol: { span: 24 } }
|
|
88
|
+
formProps: { wrapperCol: { span: 24 }, form }
|
|
99
89
|
},
|
|
100
90
|
tableProps: {
|
|
101
91
|
columns: [
|
|
@@ -104,30 +94,7 @@ const Demo = () => {
|
|
|
104
94
|
],
|
|
105
95
|
pagination: false,
|
|
106
96
|
rowKey: "A",
|
|
107
|
-
dataSource: Array(
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
),
|
|
111
|
-
/* @__PURE__ */ jsx(
|
|
112
|
-
EditTable,
|
|
113
|
-
{
|
|
114
|
-
columns,
|
|
115
|
-
rowKey: "PNOrderNo",
|
|
116
|
-
onChange: (row) => {
|
|
117
|
-
console.log(row);
|
|
118
|
-
},
|
|
119
|
-
dataSource: list,
|
|
120
|
-
pagination: false
|
|
121
|
-
}
|
|
122
|
-
),
|
|
123
|
-
/* @__PURE__ */ jsx(
|
|
124
|
-
VirtualTable,
|
|
125
|
-
{
|
|
126
|
-
columns: columns2,
|
|
127
|
-
dataSource: data,
|
|
128
|
-
scroll: { y: 300, x: "100vw" },
|
|
129
|
-
onChange: (row) => {
|
|
130
|
-
console.log(row);
|
|
97
|
+
dataSource: Array(3).fill(0).map((v, i) => ({ A: i + 1 }))
|
|
131
98
|
}
|
|
132
99
|
}
|
|
133
100
|
),
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { FormProps, FormItemProps, ColProps, RowProps, InputProps, SelectProps, InputNumberProps, RadioGroupProps, SwitchProps, TimePickerProps, ButtonProps, CascaderProps } from "antd";
|
|
1
|
+
import { FormProps, FormItemProps, ColProps, RowProps, InputProps, SelectProps, InputNumberProps, RadioGroupProps, SwitchProps, TimePickerProps, ButtonProps, CascaderProps, RateProps } from "antd";
|
|
2
2
|
import { DefaultOptionType } from "antd/es/cascader";
|
|
3
3
|
import { CheckboxGroupProps } from "antd/es/checkbox";
|
|
4
4
|
import { DatePickerProps, RangePickerProps } from "antd/es/date-picker";
|
|
5
5
|
import { PasswordProps, TextAreaProps } from "antd/es/input";
|
|
6
|
-
import React, { ReactNode } from "react";
|
|
6
|
+
import React, { ReactElement, ReactNode } from "react";
|
|
7
7
|
import { UploadFileProps } from "../Upload";
|
|
8
|
-
export type ValueType = "rangePicker" | "select" | "input" | "password" | "textarea" | "radio" | "inputNumber" | "switch" | "checkbox" | "timePicker" | "datePicker" | "cascader" | "upload" | "modal" | "btns";
|
|
8
|
+
export type ValueType = "rangePicker" | "select" | "input" | "password" | "textarea" | "radio" | "inputNumber" | "switch" | "checkbox" | "timePicker" | "datePicker" | "cascader" | "upload" | "modal" | "rate" | "custom" | "btns";
|
|
9
9
|
interface ValueBtnProps extends ButtonProps {
|
|
10
10
|
title: string;
|
|
11
11
|
btnType: "submit" | "reset" | "cancel";
|
|
@@ -17,13 +17,16 @@ interface ValueModalProps {
|
|
|
17
17
|
labelKey: string;
|
|
18
18
|
value?: any;
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
interface customValueProps {
|
|
21
|
+
children: ReactElement;
|
|
22
|
+
}
|
|
23
|
+
export type ValueProps<T> = T extends "checkbox" ? CheckboxGroupProps : T extends "select" ? SelectProps : T extends "inputNumber" ? InputNumberProps : T extends "textarea" ? TextAreaProps : T extends "radio" ? RadioGroupProps : T extends "switch" ? SwitchProps : T extends "rangePicker" ? RangePickerProps : T extends "datePicker" ? DatePickerProps : T extends "timePicker" ? TimePickerProps : T extends "input" ? InputProps : T extends "cascader" ? CascaderProps<DefaultOptionType> : T extends "upload" ? UploadFileProps : T extends "modal" ? ValueModalProps : T extends "btns" ? ValueBtnProps[] : T extends "password" ? PasswordProps : T extends "rate" ? RateProps : T extends "custom" ? customValueProps : InputProps;
|
|
21
24
|
export interface CreateFormItemProps<T> {
|
|
22
25
|
formItemProps?: FormItemProps;
|
|
23
26
|
valueType?: T;
|
|
24
27
|
valueProps?: ValueProps<T>;
|
|
25
28
|
colProps?: ColProps;
|
|
26
|
-
dataIndex
|
|
29
|
+
dataIndex?: string;
|
|
27
30
|
title?: string;
|
|
28
31
|
onChange?: (e: any) => void;
|
|
29
32
|
hidden?: boolean;
|
|
@@ -44,5 +47,5 @@ interface FormFieldsProps extends Pick<CreateFormItemProps<ValueType>, "valueTyp
|
|
|
44
47
|
onBtnClick?: (e: React.MouseEvent<HTMLElement, MouseEvent>, item: ValueBtnProps) => void;
|
|
45
48
|
inputRef?: any;
|
|
46
49
|
}
|
|
47
|
-
export declare const FormFields: (props: FormFieldsProps) => React.FunctionComponentElement<any>;
|
|
50
|
+
export declare const FormFields: (props: FormFieldsProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.FunctionComponentElement<any>;
|
|
48
51
|
export default CreateForm;
|
|
@@ -72,31 +72,38 @@ const CreateForm = (props) => {
|
|
|
72
72
|
form: formProps == null ? void 0 : formProps.form,
|
|
73
73
|
...formLayout,
|
|
74
74
|
...formProps || {},
|
|
75
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(antd.Row, { gutter: 16, ...rowProps, children: items.filter((v) => !v.hidden).map((item) => {
|
|
75
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(antd.Row, { gutter: 16, ...rowProps, children: items.filter((v) => !v.hidden).map((item, index) => {
|
|
76
76
|
var _a, _b;
|
|
77
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
78
|
-
antd.
|
|
77
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
78
|
+
antd.Col,
|
|
79
79
|
{
|
|
80
|
-
...item.
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
label: !hiddenTitle ? item.title : "",
|
|
84
|
-
name: item.valueType === "btns" ? void 0 : item.dataIndex,
|
|
85
|
-
...item.formItemProps,
|
|
86
|
-
children: item.readonly ? /* @__PURE__ */ jsxRuntime.jsx("div", { children: item.value || ((_a = formProps == null ? void 0 : formProps.initialValues) == null ? void 0 : _a[item.dataIndex]) }) : item.readonly === void 0 && readonly ? /* @__PURE__ */ jsxRuntime.jsx("div", { children: item.value || ((_b = formProps == null ? void 0 : formProps.initialValues) == null ? void 0 : _b[item.dataIndex]) }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
87
|
-
FormFields,
|
|
80
|
+
...item.colProps || { span: 24 },
|
|
81
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
82
|
+
antd.Form.Item,
|
|
88
83
|
{
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
valueType: item.
|
|
94
|
-
|
|
95
|
-
|
|
84
|
+
...item.valueType === "upload" ? {
|
|
85
|
+
getValueFromEvent: normFile
|
|
86
|
+
} : {},
|
|
87
|
+
label: !hiddenTitle ? item.title : "",
|
|
88
|
+
name: item.valueType === "btns" ? void 0 : item.dataIndex,
|
|
89
|
+
...item.formItemProps,
|
|
90
|
+
children: item.readonly ? /* @__PURE__ */ jsxRuntime.jsx("div", { children: item.value || item.dataIndex && ((_a = formProps == null ? void 0 : formProps.initialValues) == null ? void 0 : _a[item.dataIndex]) }) : item.readonly === void 0 && readonly ? /* @__PURE__ */ jsxRuntime.jsx("div", { children: item.value || item.dataIndex && ((_b = formProps == null ? void 0 : formProps.initialValues) == null ? void 0 : _b[item.dataIndex]) }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
91
|
+
FormFields,
|
|
92
|
+
{
|
|
93
|
+
onChange: (e) => {
|
|
94
|
+
var _a2;
|
|
95
|
+
return (_a2 = item == null ? void 0 : item.onChange) == null ? void 0 : _a2.call(item, e);
|
|
96
|
+
},
|
|
97
|
+
valueType: item.valueType,
|
|
98
|
+
onBtnClick,
|
|
99
|
+
valueProps: item.valueProps
|
|
100
|
+
}
|
|
101
|
+
)
|
|
96
102
|
}
|
|
97
103
|
)
|
|
98
|
-
}
|
|
99
|
-
|
|
104
|
+
},
|
|
105
|
+
item.dataIndex || index
|
|
106
|
+
);
|
|
100
107
|
}) })
|
|
101
108
|
}
|
|
102
109
|
);
|
|
@@ -106,6 +113,9 @@ const FormFields = (props) => {
|
|
|
106
113
|
const children = React.useMemo(() => {
|
|
107
114
|
let result = /* @__PURE__ */ jsxRuntime.jsx(antd.Input, { placeholder: "请输入", ...valueProps, allowClear: true });
|
|
108
115
|
switch (valueType) {
|
|
116
|
+
case "rate":
|
|
117
|
+
result = /* @__PURE__ */ jsxRuntime.jsx(antd.Rate, { ...valueProps });
|
|
118
|
+
break;
|
|
109
119
|
case "password":
|
|
110
120
|
result = /* @__PURE__ */ jsxRuntime.jsx(antd.Input.Password, { ...valueProps });
|
|
111
121
|
break;
|
|
@@ -210,6 +220,14 @@ const FormFields = (props) => {
|
|
|
210
220
|
}
|
|
211
221
|
return result;
|
|
212
222
|
}, [valueType, valueProps, onChange, value]);
|
|
223
|
+
if (valueType === "custom") {
|
|
224
|
+
const params = valueProps;
|
|
225
|
+
return React.cloneElement(params.children, {
|
|
226
|
+
[getValuePropName(valueType || "input")]: value,
|
|
227
|
+
onChange,
|
|
228
|
+
ref: inputRef
|
|
229
|
+
});
|
|
230
|
+
}
|
|
213
231
|
return React.cloneElement(children, {
|
|
214
232
|
[getValuePropName(valueType || "input")]: value,
|
|
215
233
|
onChange,
|
package/lib/index.js
CHANGED
|
@@ -5,8 +5,10 @@ const ReactDOM = require("react-dom/client");
|
|
|
5
5
|
const reactRouterDom = require("react-router-dom");
|
|
6
6
|
const main = require("./main");
|
|
7
7
|
const CoralButton = require("./components/CoralButton");
|
|
8
|
+
const antd = require("antd");
|
|
8
9
|
const Demo = () => {
|
|
9
|
-
const [
|
|
10
|
+
const [form] = antd.Form.useForm();
|
|
11
|
+
react.useState([
|
|
10
12
|
{
|
|
11
13
|
PNOrderNo: 1,
|
|
12
14
|
PNName: "未分配",
|
|
@@ -26,41 +28,7 @@ const Demo = () => {
|
|
|
26
28
|
Remark: ""
|
|
27
29
|
}
|
|
28
30
|
]);
|
|
29
|
-
|
|
30
|
-
{
|
|
31
|
-
dataIndex: "PNOrderNo",
|
|
32
|
-
title: "序号",
|
|
33
|
-
width: 80
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
dataIndex: "PNName",
|
|
37
|
-
title: "节点名称"
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
dataIndex: "PlanFinishDate",
|
|
41
|
-
title: "预计完成时间",
|
|
42
|
-
editable: true,
|
|
43
|
-
width: 400,
|
|
44
|
-
type: "datePicker",
|
|
45
|
-
valueProps: {
|
|
46
|
-
placeholder: "请输入内容"
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
dataIndex: "Remark",
|
|
51
|
-
title: "备注",
|
|
52
|
-
editable: true,
|
|
53
|
-
type: "textarea",
|
|
54
|
-
width: 400,
|
|
55
|
-
valueProps: {
|
|
56
|
-
placeholder: "请输入内容",
|
|
57
|
-
autoSize: {
|
|
58
|
-
minRows: 3
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
];
|
|
63
|
-
const [data, setData] = react.useState(
|
|
31
|
+
react.useState(
|
|
64
32
|
Array.from({ length: 1e5 }, (_, key) => ({
|
|
65
33
|
key,
|
|
66
34
|
age: key,
|
|
@@ -68,11 +36,6 @@ const Demo = () => {
|
|
|
68
36
|
}))
|
|
69
37
|
);
|
|
70
38
|
react.useState(false);
|
|
71
|
-
const columns2 = [
|
|
72
|
-
{ title: "A", dataIndex: "key", width: 150 },
|
|
73
|
-
{ title: "B", dataIndex: "title", editable: true },
|
|
74
|
-
{ title: "C", dataIndex: "age" }
|
|
75
|
-
];
|
|
76
39
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
77
40
|
/* @__PURE__ */ jsxRuntime.jsx(main.BackHeader, { title: "标题111", subTitle: /* @__PURE__ */ jsxRuntime.jsx("span", { children: "副标题" }) }),
|
|
78
41
|
/* @__PURE__ */ jsxRuntime.jsx(main.AuthButton, { type: "primary", children: "按钮1" }),
|
|
@@ -91,12 +54,39 @@ const Demo = () => {
|
|
|
91
54
|
span: 6
|
|
92
55
|
}
|
|
93
56
|
},
|
|
57
|
+
{
|
|
58
|
+
valueType: "custom",
|
|
59
|
+
valueProps: {
|
|
60
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Space, { children: [
|
|
61
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Form.Item, { name: "yzm", noStyle: true, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Input, { placeholder: "请输入验证码" }) }),
|
|
62
|
+
/* @__PURE__ */ jsxRuntime.jsx(antd.Button, { children: "发送验证码" })
|
|
63
|
+
] })
|
|
64
|
+
},
|
|
65
|
+
colProps: {
|
|
66
|
+
span: 6
|
|
67
|
+
}
|
|
68
|
+
},
|
|
94
69
|
{
|
|
95
70
|
dataIndex: "mm",
|
|
96
|
-
valueType: "password"
|
|
71
|
+
valueType: "password",
|
|
72
|
+
colProps: {
|
|
73
|
+
span: 6
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
dataIndex: "btns",
|
|
78
|
+
valueType: "btns",
|
|
79
|
+
valueProps: [
|
|
80
|
+
{
|
|
81
|
+
btnType: "submit",
|
|
82
|
+
title: "确定",
|
|
83
|
+
type: "primary",
|
|
84
|
+
onClick: (v) => console.log(v)
|
|
85
|
+
}
|
|
86
|
+
]
|
|
97
87
|
}
|
|
98
88
|
],
|
|
99
|
-
formProps: { wrapperCol: { span: 24 } }
|
|
89
|
+
formProps: { wrapperCol: { span: 24 }, form }
|
|
100
90
|
},
|
|
101
91
|
tableProps: {
|
|
102
92
|
columns: [
|
|
@@ -105,30 +95,7 @@ const Demo = () => {
|
|
|
105
95
|
],
|
|
106
96
|
pagination: false,
|
|
107
97
|
rowKey: "A",
|
|
108
|
-
dataSource: Array(
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
),
|
|
112
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
113
|
-
main.EditTable,
|
|
114
|
-
{
|
|
115
|
-
columns,
|
|
116
|
-
rowKey: "PNOrderNo",
|
|
117
|
-
onChange: (row) => {
|
|
118
|
-
console.log(row);
|
|
119
|
-
},
|
|
120
|
-
dataSource: list,
|
|
121
|
-
pagination: false
|
|
122
|
-
}
|
|
123
|
-
),
|
|
124
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
125
|
-
main.VirtualTable,
|
|
126
|
-
{
|
|
127
|
-
columns: columns2,
|
|
128
|
-
dataSource: data,
|
|
129
|
-
scroll: { y: 300, x: "100vw" },
|
|
130
|
-
onChange: (row) => {
|
|
131
|
-
console.log(row);
|
|
98
|
+
dataSource: Array(3).fill(0).map((v, i) => ({ A: i + 1 }))
|
|
132
99
|
}
|
|
133
100
|
}
|
|
134
101
|
),
|