szld-libs 0.0.30 → 0.0.31
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/style.css +1 -1
- package/dist/szld-components.es.js +1830 -1826
- package/dist/szld-components.umd.js +37 -37
- package/es/components/BackHeader/index.css +1 -0
- package/es/components/CreateForm/index.d.ts +1 -0
- package/es/components/CreateForm/index.js +10 -2
- package/lib/components/BackHeader/index.css +1 -0
- package/lib/components/CreateForm/index.d.ts +1 -0
- package/lib/components/CreateForm/index.js +10 -2
- package/package.json +1 -1
|
@@ -35,6 +35,7 @@ export interface CreateFormItemProps<T> {
|
|
|
35
35
|
hidden?: boolean;
|
|
36
36
|
readonly?: boolean;
|
|
37
37
|
value?: string | ReactNode;
|
|
38
|
+
render?: (value: any, record: any, index?: number) => ReactNode;
|
|
38
39
|
}
|
|
39
40
|
export interface CreateFormProps {
|
|
40
41
|
items: CreateFormItemProps<ValueType>[];
|
|
@@ -63,6 +63,14 @@ const CreateForm = (props) => {
|
|
|
63
63
|
}
|
|
64
64
|
return e && e.fileList;
|
|
65
65
|
};
|
|
66
|
+
const renderReadOnly = (item) => {
|
|
67
|
+
var _a;
|
|
68
|
+
const data = formProps == null ? void 0 : formProps.initialValues;
|
|
69
|
+
if (!item.dataIndex) {
|
|
70
|
+
return "";
|
|
71
|
+
}
|
|
72
|
+
return ((_a = item.render) == null ? void 0 : _a.call(item, data == null ? void 0 : data[item.dataIndex], data)) || item.value || (data == null ? void 0 : data[item.dataIndex]);
|
|
73
|
+
};
|
|
66
74
|
return /* @__PURE__ */ jsx(
|
|
67
75
|
Form,
|
|
68
76
|
{
|
|
@@ -71,7 +79,7 @@ const CreateForm = (props) => {
|
|
|
71
79
|
...formLayout,
|
|
72
80
|
...formProps || {},
|
|
73
81
|
children: /* @__PURE__ */ jsx(Row, { gutter: 16, ...rowProps, children: items.filter((v) => !v.hidden).map((item, index) => {
|
|
74
|
-
var _a
|
|
82
|
+
var _a;
|
|
75
83
|
return /* @__PURE__ */ jsx(
|
|
76
84
|
Col,
|
|
77
85
|
{
|
|
@@ -85,7 +93,7 @@ const CreateForm = (props) => {
|
|
|
85
93
|
label: !hiddenTitle ? item.title : "",
|
|
86
94
|
name: item.valueType === "btns" ? void 0 : item.dataIndex,
|
|
87
95
|
...item.formItemProps,
|
|
88
|
-
children: item.readonly ? /* @__PURE__ */ jsx("div", { children:
|
|
96
|
+
children: item.readonly ? /* @__PURE__ */ jsx("div", { children: renderReadOnly(item) }) : item.readonly === void 0 && readonly ? /* @__PURE__ */ jsx("div", { children: item.value || item.dataIndex && ((_a = formProps == null ? void 0 : formProps.initialValues) == null ? void 0 : _a[item.dataIndex]) }) : /* @__PURE__ */ jsx(
|
|
89
97
|
FormFields,
|
|
90
98
|
{
|
|
91
99
|
onChange: (e) => {
|
|
@@ -35,6 +35,7 @@ export interface CreateFormItemProps<T> {
|
|
|
35
35
|
hidden?: boolean;
|
|
36
36
|
readonly?: boolean;
|
|
37
37
|
value?: string | ReactNode;
|
|
38
|
+
render?: (value: any, record: any, index?: number) => ReactNode;
|
|
38
39
|
}
|
|
39
40
|
export interface CreateFormProps {
|
|
40
41
|
items: CreateFormItemProps<ValueType>[];
|
|
@@ -65,6 +65,14 @@ const CreateForm = (props) => {
|
|
|
65
65
|
}
|
|
66
66
|
return e && e.fileList;
|
|
67
67
|
};
|
|
68
|
+
const renderReadOnly = (item) => {
|
|
69
|
+
var _a;
|
|
70
|
+
const data = formProps == null ? void 0 : formProps.initialValues;
|
|
71
|
+
if (!item.dataIndex) {
|
|
72
|
+
return "";
|
|
73
|
+
}
|
|
74
|
+
return ((_a = item.render) == null ? void 0 : _a.call(item, data == null ? void 0 : data[item.dataIndex], data)) || item.value || (data == null ? void 0 : data[item.dataIndex]);
|
|
75
|
+
};
|
|
68
76
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
69
77
|
antd.Form,
|
|
70
78
|
{
|
|
@@ -73,7 +81,7 @@ const CreateForm = (props) => {
|
|
|
73
81
|
...formLayout,
|
|
74
82
|
...formProps || {},
|
|
75
83
|
children: /* @__PURE__ */ jsxRuntime.jsx(antd.Row, { gutter: 16, ...rowProps, children: items.filter((v) => !v.hidden).map((item, index) => {
|
|
76
|
-
var _a
|
|
84
|
+
var _a;
|
|
77
85
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
78
86
|
antd.Col,
|
|
79
87
|
{
|
|
@@ -87,7 +95,7 @@ const CreateForm = (props) => {
|
|
|
87
95
|
label: !hiddenTitle ? item.title : "",
|
|
88
96
|
name: item.valueType === "btns" ? void 0 : item.dataIndex,
|
|
89
97
|
...item.formItemProps,
|
|
90
|
-
children: item.readonly ? /* @__PURE__ */ jsxRuntime.jsx("div", { children:
|
|
98
|
+
children: item.readonly ? /* @__PURE__ */ jsxRuntime.jsx("div", { children: renderReadOnly(item) }) : item.readonly === void 0 && readonly ? /* @__PURE__ */ jsxRuntime.jsx("div", { children: item.value || item.dataIndex && ((_a = formProps == null ? void 0 : formProps.initialValues) == null ? void 0 : _a[item.dataIndex]) }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
91
99
|
FormFields,
|
|
92
100
|
{
|
|
93
101
|
onChange: (e) => {
|