@carefrees/form-utils-react-taro 0.0.14 → 0.0.16
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/README.md +6 -0
- package/assets/index.css +46 -39
- package/esm/index.d.ts +0 -1
- package/esm/index.js +0 -1
- package/esm/layout/index.d.ts +2 -0
- package/esm/layout/index.js +6 -4
- package/lib/formItem/index.js +3 -3
- package/lib/formList/index.js +3 -3
- package/lib/hooks/attr/attr.FormItem.js +3 -3
- package/lib/index.d.ts +0 -1
- package/lib/index.js +56 -72
- package/lib/layout/index.d.ts +2 -0
- package/lib/layout/index.js +11 -9
- package/lib/layout/layout.formItem.js +3 -3
- package/package.json +7 -3
- package/src/index.tsx +0 -1
- package/src/layout/index.tsx +6 -0
- package/esm/styles/index.css +0 -199
- package/lib/styles/index.css +0 -199
- package/src/styles/index.css +0 -207
package/README.md
CHANGED
|
@@ -6,6 +6,12 @@
|
|
|
6
6
|
npm install @carefrees/form-utils-react-taro # yarn add @carefrees/form-utils-react-taro # pnpm add @carefrees/form-utils-react-taro
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
+
## 加载样式
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import '@carefrees/form-utils-react-taro/assets/index.css';
|
|
13
|
+
```
|
|
14
|
+
|
|
9
15
|
## 使用
|
|
10
16
|
|
|
11
17
|
### 基本使用
|
package/assets/index.css
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
html.dark .carefrees-form {
|
|
3
3
|
--form-color: #e3e3e3;
|
|
4
4
|
--form-header-color: #e3e3e3;
|
|
5
|
-
--form-font-size:
|
|
5
|
+
--form-font-size: 0.7rem;
|
|
6
6
|
--form-border-color: #e0e0e0;
|
|
7
7
|
}
|
|
8
8
|
|
|
@@ -10,7 +10,7 @@ html.dark .carefrees-form {
|
|
|
10
10
|
.carefrees-form {
|
|
11
11
|
--form-color: rgba(0, 0, 0, 0.88);
|
|
12
12
|
--form-header-color: #1d2129;
|
|
13
|
-
--form-font-size:
|
|
13
|
+
--form-font-size: 0.7rem;
|
|
14
14
|
--form-border-color: #e0e0e0;
|
|
15
15
|
|
|
16
16
|
box-sizing: border-box;
|
|
@@ -18,12 +18,19 @@ html.dark .carefrees-form {
|
|
|
18
18
|
color: var(--form-color, rgba(0, 0, 0, 0.88));
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
/* 表单 */
|
|
22
|
+
/* .carefrees-form {
|
|
23
|
+
box-sizing: border-box;
|
|
24
|
+
background-color: #fff;
|
|
25
|
+
font-size: 0.7rem;
|
|
26
|
+
} */
|
|
27
|
+
|
|
21
28
|
/* 布局 */
|
|
22
29
|
.carefrees-form-layout {
|
|
23
30
|
width: 100%;
|
|
24
31
|
box-sizing: border-box;
|
|
25
|
-
border-radius:
|
|
26
|
-
padding-bottom:
|
|
32
|
+
border-radius: 0.2rem;
|
|
33
|
+
padding-bottom: 0.4rem;
|
|
27
34
|
position: relative;
|
|
28
35
|
}
|
|
29
36
|
|
|
@@ -32,11 +39,11 @@ html.dark .carefrees-form {
|
|
|
32
39
|
}
|
|
33
40
|
|
|
34
41
|
.carefrees-form-layout.bordered {
|
|
35
|
-
border: 1px solid
|
|
42
|
+
border: 1px solid #e0e0e0;
|
|
36
43
|
}
|
|
37
44
|
.carefrees-form-layout.bordered .carefrees-form-layout-header {
|
|
38
|
-
padding-inline-start:
|
|
39
|
-
padding-inline-end:
|
|
45
|
+
padding-inline-start: 0.4rem;
|
|
46
|
+
padding-inline-end: 0.4rem;
|
|
40
47
|
}
|
|
41
48
|
|
|
42
49
|
.carefrees-form-layout-header {
|
|
@@ -44,25 +51,25 @@ html.dark .carefrees-form {
|
|
|
44
51
|
justify-content: space-between;
|
|
45
52
|
align-items: center;
|
|
46
53
|
flex-direction: row;
|
|
47
|
-
border-bottom: 1px solid
|
|
48
|
-
padding-top:
|
|
49
|
-
padding-bottom:
|
|
50
|
-
margin-block-end:
|
|
51
|
-
padding-inline-start:
|
|
52
|
-
padding-inline-end:
|
|
54
|
+
border-bottom: 1px solid #e0e0e0;
|
|
55
|
+
padding-top: 0.25rem;
|
|
56
|
+
padding-bottom: 0.25rem;
|
|
57
|
+
margin-block-end: 0.2rem;
|
|
58
|
+
padding-inline-start: 0.1rem;
|
|
59
|
+
padding-inline-end: 0.1rem;
|
|
53
60
|
box-sizing: border-box;
|
|
54
61
|
}
|
|
55
62
|
|
|
56
63
|
.carefrees-form-layout-header-title {
|
|
57
|
-
font-size:
|
|
64
|
+
font-size: 0.7rem;
|
|
58
65
|
font-weight: 600;
|
|
59
|
-
color:
|
|
66
|
+
color: #1d2129;
|
|
60
67
|
box-sizing: border-box;
|
|
61
68
|
}
|
|
62
69
|
.carefrees-form-layout-header-extra {
|
|
63
|
-
font-size:
|
|
70
|
+
font-size: 0.7rem;
|
|
64
71
|
font-weight: 500;
|
|
65
|
-
color:
|
|
72
|
+
color: #1d2129;
|
|
66
73
|
box-sizing: border-box;
|
|
67
74
|
}
|
|
68
75
|
|
|
@@ -70,21 +77,21 @@ html.dark .carefrees-form {
|
|
|
70
77
|
width: 100%;
|
|
71
78
|
display: grid;
|
|
72
79
|
grid-template-columns: repeat(1, auto);
|
|
73
|
-
gap:
|
|
74
|
-
padding-left:
|
|
75
|
-
padding-right:
|
|
80
|
+
gap: 0.1rem;
|
|
81
|
+
padding-left: 0.1rem;
|
|
82
|
+
padding-right: 0.1rem;
|
|
76
83
|
box-sizing: border-box;
|
|
77
84
|
}
|
|
78
85
|
|
|
79
86
|
/* 表单项 */
|
|
80
87
|
.carefrees-form-item {
|
|
81
|
-
font-size:
|
|
88
|
+
font-size: 0.7rem;
|
|
82
89
|
display: flex;
|
|
83
90
|
flex-direction: row;
|
|
84
91
|
align-items: flex-start;
|
|
85
|
-
padding:
|
|
92
|
+
padding: 0.4rem;
|
|
86
93
|
box-sizing: border-box;
|
|
87
|
-
color:
|
|
94
|
+
color: rgba(0, 0, 0, 0.88);
|
|
88
95
|
}
|
|
89
96
|
|
|
90
97
|
.carefrees-form-item-container {
|
|
@@ -92,18 +99,18 @@ html.dark .carefrees-form {
|
|
|
92
99
|
height: 100%;
|
|
93
100
|
display: flex;
|
|
94
101
|
flex-direction: column;
|
|
95
|
-
gap:
|
|
102
|
+
gap: 0.2rem;
|
|
96
103
|
box-sizing: border-box;
|
|
97
104
|
}
|
|
98
105
|
.carefrees-form-item-container.left {
|
|
99
106
|
flex-direction: row;
|
|
100
|
-
gap:
|
|
107
|
+
gap: 0.4rem;
|
|
101
108
|
}
|
|
102
109
|
.carefrees-form-item-container.left .carefrees-form-item-label-warp {
|
|
103
110
|
text-align: right;
|
|
104
111
|
}
|
|
105
112
|
.carefrees-form-item-container.between {
|
|
106
|
-
gap:
|
|
113
|
+
gap: 0.4rem;
|
|
107
114
|
text-align: left;
|
|
108
115
|
flex-direction: row;
|
|
109
116
|
justify-content: space-between;
|
|
@@ -125,8 +132,8 @@ html.dark .carefrees-form {
|
|
|
125
132
|
align-items: center;
|
|
126
133
|
justify-content: flex-start;
|
|
127
134
|
position: relative;
|
|
128
|
-
font-size:
|
|
129
|
-
color:
|
|
135
|
+
font-size: 0.7rem;
|
|
136
|
+
color: rgba(0, 0, 0, 0.88);
|
|
130
137
|
min-height: 1.4rem;
|
|
131
138
|
}
|
|
132
139
|
|
|
@@ -135,8 +142,8 @@ html.dark .carefrees-form {
|
|
|
135
142
|
display: inline-block;
|
|
136
143
|
text-align: center;
|
|
137
144
|
margin: 0;
|
|
138
|
-
margin-inline-end:
|
|
139
|
-
margin-inline-start:
|
|
145
|
+
margin-inline-end: 0.1rem;
|
|
146
|
+
margin-inline-start: 0.1rem;
|
|
140
147
|
box-sizing: border-box;
|
|
141
148
|
}
|
|
142
149
|
|
|
@@ -144,7 +151,7 @@ html.dark .carefrees-form {
|
|
|
144
151
|
content: '*';
|
|
145
152
|
color: red;
|
|
146
153
|
display: inline-block;
|
|
147
|
-
margin-inline-end:
|
|
154
|
+
margin-inline-end: 0.2rem;
|
|
148
155
|
box-sizing: border-box;
|
|
149
156
|
}
|
|
150
157
|
|
|
@@ -155,7 +162,7 @@ html.dark .carefrees-form {
|
|
|
155
162
|
align-items: flex-start;
|
|
156
163
|
justify-content: flex-start;
|
|
157
164
|
box-sizing: border-box;
|
|
158
|
-
gap:
|
|
165
|
+
gap: 0.2rem;
|
|
159
166
|
flex: 1;
|
|
160
167
|
}
|
|
161
168
|
.carefrees-form-item-body-input {
|
|
@@ -169,7 +176,7 @@ html.dark .carefrees-form {
|
|
|
169
176
|
}
|
|
170
177
|
|
|
171
178
|
.carefrees-form-item-body-input.input-bordered {
|
|
172
|
-
border-bottom: 1px solid
|
|
179
|
+
border-bottom: 1px solid #e0e0e0;
|
|
173
180
|
}
|
|
174
181
|
|
|
175
182
|
.carefrees-form-item-body-help {
|
|
@@ -184,9 +191,9 @@ html.dark .carefrees-form {
|
|
|
184
191
|
top: auto;
|
|
185
192
|
left: 0;
|
|
186
193
|
right: 0;
|
|
187
|
-
bottom: -
|
|
188
|
-
padding-top:
|
|
189
|
-
font-size:
|
|
194
|
+
bottom: -0.8rem;
|
|
195
|
+
padding-top: 0.1rem;
|
|
196
|
+
font-size: 0.6rem;
|
|
190
197
|
box-sizing: border-box;
|
|
191
198
|
z-index: 10;
|
|
192
199
|
pointer-events: none;
|
|
@@ -199,18 +206,18 @@ html.dark .carefrees-form {
|
|
|
199
206
|
top: auto;
|
|
200
207
|
left: 0;
|
|
201
208
|
right: 0;
|
|
202
|
-
bottom: -
|
|
209
|
+
bottom: -0.8rem;
|
|
203
210
|
}
|
|
204
211
|
.carefrees-form-item-body-error.top-left {
|
|
205
212
|
justify-content: start;
|
|
206
|
-
top: -
|
|
213
|
+
top: -0.8rem;
|
|
207
214
|
left: 0px;
|
|
208
215
|
right: 0px;
|
|
209
216
|
bottom: auto;
|
|
210
217
|
}
|
|
211
218
|
.carefrees-form-item-body-error.top-right {
|
|
212
219
|
justify-content: flex-end;
|
|
213
|
-
top: -
|
|
220
|
+
top: -0.8rem;
|
|
214
221
|
left: 0px;
|
|
215
222
|
right: 0px;
|
|
216
223
|
bottom: auto;
|
package/esm/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FormInstanceBase, ValidateErrorEntity } from '@carefrees/form-utils';
|
|
3
3
|
import { FormLayoutProps } from './layout';
|
|
4
|
-
import './styles/index.css';
|
|
5
4
|
export * from './formItem';
|
|
6
5
|
export * from './formList';
|
|
7
6
|
export * from './layout';
|
package/esm/index.js
CHANGED
|
@@ -4,7 +4,6 @@ import classnames from "classnames";
|
|
|
4
4
|
import { FormLayout } from "./layout/index.js";
|
|
5
5
|
import { FormInstanceContext, useForm, useRegisterForm } from "@carefrees/form-utils-react-hooks";
|
|
6
6
|
import { Form } from "@tarojs/components";
|
|
7
|
-
import "./styles/index.css";
|
|
8
7
|
export * from "./formItem/index.js";
|
|
9
8
|
export * from "./formList/index.js";
|
|
10
9
|
export * from "./layout/index.js";
|
package/esm/layout/index.d.ts
CHANGED
|
@@ -28,6 +28,8 @@ export interface FormLayoutProps extends AttrsOptions {
|
|
|
28
28
|
* @description gap 属性是用来设置网格行与列之间的间隙,该属性是row-gap and column-gap的简写形式。
|
|
29
29
|
*/
|
|
30
30
|
gap?: string | number;
|
|
31
|
+
/**是否添加输入框边框*/
|
|
32
|
+
inputBordered?: boolean;
|
|
31
33
|
}
|
|
32
34
|
/**布局组件*/
|
|
33
35
|
export declare const FormLayout: React.MemoExoticComponent<(props: FormLayoutProps) => import("react/jsx-runtime").JSX.Element>;
|
package/esm/layout/index.js
CHANGED
|
@@ -5,8 +5,8 @@ import classnames from "classnames";
|
|
|
5
5
|
import { AttrsContext, useAttrs } from "@carefrees/form-utils-react-hooks";
|
|
6
6
|
const preCls = 'carefrees-form-layout';
|
|
7
7
|
const FormLayout = /*#__PURE__*/ memo((props)=>{
|
|
8
|
-
const { colCount: p_colCount = 4, errorLayout: p_errorLayout = 'left-bottom', labelMode: p_labelMode = 'left', showColon: p_showColon = true, formItemClassName: p_formItemClassName, formItemStyle: p_formItemStyle, formItemLabelClassName: p_formItemLabelClassName, formItemLabelStyle: p_formItemLabelStyle } = useAttrs();
|
|
9
|
-
const { colCount = p_colCount, title, extra, children, isAllColSpan, className, headerClassName, bodyClassName, style, headerStyle, bodyStyle, errorLayout = p_errorLayout, labelMode = p_labelMode, showColon = p_showColon, formItemClassName = p_formItemClassName, formItemStyle = p_formItemStyle, formItemLabelClassName = p_formItemLabelClassName, formItemLabelStyle = p_formItemLabelStyle, bordered = false, gap } = props;
|
|
8
|
+
const { colCount: p_colCount = 4, errorLayout: p_errorLayout = 'left-bottom', labelMode: p_labelMode = 'left', showColon: p_showColon = true, formItemClassName: p_formItemClassName, formItemStyle: p_formItemStyle, formItemLabelClassName: p_formItemLabelClassName, formItemLabelStyle: p_formItemLabelStyle, inputBordered: p_inputBordered } = useAttrs();
|
|
9
|
+
const { colCount = p_colCount, title, extra, children, isAllColSpan, className, headerClassName, bodyClassName, style, headerStyle, bodyStyle, errorLayout = p_errorLayout, labelMode = p_labelMode, showColon = p_showColon, formItemClassName = p_formItemClassName, formItemStyle = p_formItemStyle, formItemLabelClassName = p_formItemLabelClassName, formItemLabelStyle = p_formItemLabelStyle, bordered = false, inputBordered = p_inputBordered, gap } = props;
|
|
10
10
|
const propsRef = useRef(props);
|
|
11
11
|
propsRef.current = props;
|
|
12
12
|
const cls = useMemo(()=>classnames(preCls, className, {
|
|
@@ -31,7 +31,8 @@ const FormLayout = /*#__PURE__*/ memo((props)=>{
|
|
|
31
31
|
formItemClassName,
|
|
32
32
|
formItemStyle,
|
|
33
33
|
formItemLabelClassName,
|
|
34
|
-
formItemLabelStyle
|
|
34
|
+
formItemLabelStyle,
|
|
35
|
+
inputBordered
|
|
35
36
|
}), [
|
|
36
37
|
colCount,
|
|
37
38
|
errorLayout,
|
|
@@ -40,7 +41,8 @@ const FormLayout = /*#__PURE__*/ memo((props)=>{
|
|
|
40
41
|
formItemClassName,
|
|
41
42
|
formItemStyle,
|
|
42
43
|
formItemLabelClassName,
|
|
43
|
-
formItemLabelStyle
|
|
44
|
+
formItemLabelStyle,
|
|
45
|
+
inputBordered
|
|
44
46
|
]);
|
|
45
47
|
const styleBase = useMemo(()=>{
|
|
46
48
|
const css = {};
|
package/lib/formItem/index.js
CHANGED
|
@@ -13,7 +13,7 @@ var __webpack_require__ = {};
|
|
|
13
13
|
})();
|
|
14
14
|
(()=>{
|
|
15
15
|
__webpack_require__.r = (exports1)=>{
|
|
16
|
-
if (
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
17
|
value: 'Module'
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports1, '__esModule', {
|
|
@@ -97,10 +97,10 @@ const FormHideItem = /*#__PURE__*/ (0, external_react_namespaceObject.memo)((pro
|
|
|
97
97
|
});
|
|
98
98
|
exports.FormHideItem = __webpack_exports__.FormHideItem;
|
|
99
99
|
exports.FormItem = __webpack_exports__.FormItem;
|
|
100
|
-
for(var
|
|
100
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
101
101
|
"FormHideItem",
|
|
102
102
|
"FormItem"
|
|
103
|
-
].indexOf(
|
|
103
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
104
104
|
Object.defineProperty(exports, '__esModule', {
|
|
105
105
|
value: true
|
|
106
106
|
});
|
package/lib/formList/index.js
CHANGED
|
@@ -13,7 +13,7 @@ var __webpack_require__ = {};
|
|
|
13
13
|
})();
|
|
14
14
|
(()=>{
|
|
15
15
|
__webpack_require__.r = (exports1)=>{
|
|
16
|
-
if (
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
17
|
value: 'Module'
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports1, '__esModule', {
|
|
@@ -65,10 +65,10 @@ const FormHideList = /*#__PURE__*/ (0, external_react_namespaceObject.memo)((pro
|
|
|
65
65
|
});
|
|
66
66
|
exports.FormHideList = __webpack_exports__.FormHideList;
|
|
67
67
|
exports.FormList = __webpack_exports__.FormList;
|
|
68
|
-
for(var
|
|
68
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
69
69
|
"FormHideList",
|
|
70
70
|
"FormList"
|
|
71
|
-
].indexOf(
|
|
71
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
72
72
|
Object.defineProperty(exports, '__esModule', {
|
|
73
73
|
value: true
|
|
74
74
|
});
|
|
@@ -13,7 +13,7 @@ var __webpack_require__ = {};
|
|
|
13
13
|
})();
|
|
14
14
|
(()=>{
|
|
15
15
|
__webpack_require__.r = (exports1)=>{
|
|
16
|
-
if (
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
17
|
value: 'Module'
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports1, '__esModule', {
|
|
@@ -86,9 +86,9 @@ const useFormItemAttr = (options)=>{
|
|
|
86
86
|
};
|
|
87
87
|
};
|
|
88
88
|
exports.useFormItemAttr = __webpack_exports__.useFormItemAttr;
|
|
89
|
-
for(var
|
|
89
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
90
90
|
"useFormItemAttr"
|
|
91
|
-
].indexOf(
|
|
91
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
92
92
|
Object.defineProperty(exports, '__esModule', {
|
|
93
93
|
value: true
|
|
94
94
|
});
|
package/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FormInstanceBase, ValidateErrorEntity } from '@carefrees/form-utils';
|
|
3
3
|
import { FormLayoutProps } from './layout';
|
|
4
|
-
import './styles/index.css';
|
|
5
4
|
export * from './formItem';
|
|
6
5
|
export * from './formList';
|
|
7
6
|
export * from './layout';
|
package/lib/index.js
CHANGED
|
@@ -1,36 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_modules__ = {
|
|
3
|
-
"./formItem"
|
|
3
|
+
"./formItem" (module) {
|
|
4
4
|
module.exports = require("./formItem/index.js");
|
|
5
5
|
},
|
|
6
|
-
"./formList"
|
|
6
|
+
"./formList" (module) {
|
|
7
7
|
module.exports = require("./formList/index.js");
|
|
8
8
|
},
|
|
9
|
-
"./hooks/attr/attr.FormItem"
|
|
9
|
+
"./hooks/attr/attr.FormItem" (module) {
|
|
10
10
|
module.exports = require("./hooks/attr/attr.FormItem.js");
|
|
11
11
|
},
|
|
12
|
-
"./layout"
|
|
12
|
+
"./layout" (module) {
|
|
13
13
|
module.exports = require("./layout/index.js");
|
|
14
14
|
},
|
|
15
|
-
"./layout/layout.formItem"
|
|
15
|
+
"./layout/layout.formItem" (module) {
|
|
16
16
|
module.exports = require("./layout/layout.formItem.js");
|
|
17
17
|
},
|
|
18
|
-
"
|
|
19
|
-
module.exports = require("./styles/index.css");
|
|
20
|
-
},
|
|
21
|
-
"@carefrees/form-utils-react-hooks": function(module) {
|
|
18
|
+
"@carefrees/form-utils-react-hooks" (module) {
|
|
22
19
|
module.exports = require("@carefrees/form-utils-react-hooks");
|
|
23
20
|
},
|
|
24
|
-
"@tarojs/components"
|
|
21
|
+
"@tarojs/components" (module) {
|
|
25
22
|
module.exports = require("@tarojs/components");
|
|
26
23
|
},
|
|
27
|
-
classnames
|
|
24
|
+
classnames (module) {
|
|
28
25
|
module.exports = require("classnames");
|
|
29
26
|
},
|
|
30
|
-
react
|
|
27
|
+
react (module) {
|
|
31
28
|
module.exports = require("react");
|
|
32
29
|
},
|
|
33
|
-
"react/jsx-runtime"
|
|
30
|
+
"react/jsx-runtime" (module) {
|
|
34
31
|
module.exports = require("react/jsx-runtime");
|
|
35
32
|
}
|
|
36
33
|
};
|
|
@@ -66,7 +63,7 @@ function __webpack_require__(moduleId) {
|
|
|
66
63
|
})();
|
|
67
64
|
(()=>{
|
|
68
65
|
__webpack_require__.r = (exports1)=>{
|
|
69
|
-
if (
|
|
66
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
70
67
|
value: 'Module'
|
|
71
68
|
});
|
|
72
69
|
Object.defineProperty(exports1, '__esModule', {
|
|
@@ -80,76 +77,63 @@ var __webpack_exports__ = {};
|
|
|
80
77
|
__webpack_require__.d(__webpack_exports__, {
|
|
81
78
|
Form: ()=>Form
|
|
82
79
|
});
|
|
83
|
-
var
|
|
84
|
-
var
|
|
85
|
-
var
|
|
86
|
-
var
|
|
87
|
-
var
|
|
88
|
-
var
|
|
89
|
-
var
|
|
90
|
-
__webpack_require__("./
|
|
91
|
-
var
|
|
92
|
-
|
|
93
|
-
for(var __WEBPACK_IMPORT_KEY__ in _formItem__WEBPACK_IMPORTED_MODULE_7__)if ([
|
|
80
|
+
var react_jsx_runtime__rspack_import_0 = __webpack_require__("react/jsx-runtime");
|
|
81
|
+
var react__rspack_import_1 = __webpack_require__("react");
|
|
82
|
+
var classnames__rspack_import_2 = __webpack_require__("classnames");
|
|
83
|
+
var classnames__rspack_import_2_default = /*#__PURE__*/ __webpack_require__.n(classnames__rspack_import_2);
|
|
84
|
+
var _layout__rspack_import_3 = __webpack_require__("./layout");
|
|
85
|
+
var _carefrees_form_utils_react_hooks__rspack_import_4 = __webpack_require__("@carefrees/form-utils-react-hooks");
|
|
86
|
+
var _tarojs_components__rspack_import_5 = __webpack_require__("@tarojs/components");
|
|
87
|
+
var _formItem__rspack_import_6 = __webpack_require__("./formItem");
|
|
88
|
+
var __rspack_reexport = {};
|
|
89
|
+
for(const __rspack_import_key in _formItem__rspack_import_6)if ([
|
|
94
90
|
"Form",
|
|
95
91
|
"default"
|
|
96
|
-
].indexOf(
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
102
|
-
for(var __WEBPACK_IMPORT_KEY__ in _formList__WEBPACK_IMPORTED_MODULE_8__)if ([
|
|
92
|
+
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_formItem__rspack_import_6[__rspack_import_key];
|
|
93
|
+
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
94
|
+
var _formList__rspack_import_7 = __webpack_require__("./formList");
|
|
95
|
+
var __rspack_reexport = {};
|
|
96
|
+
for(const __rspack_import_key in _formList__rspack_import_7)if ([
|
|
103
97
|
"Form",
|
|
104
98
|
"default"
|
|
105
|
-
].indexOf(
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
110
|
-
for(var __WEBPACK_IMPORT_KEY__ in _layout__WEBPACK_IMPORTED_MODULE_3__)if ([
|
|
99
|
+
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_formList__rspack_import_7[__rspack_import_key];
|
|
100
|
+
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
101
|
+
var __rspack_reexport = {};
|
|
102
|
+
for(const __rspack_import_key in _layout__rspack_import_3)if ([
|
|
111
103
|
"Form",
|
|
112
104
|
"default"
|
|
113
|
-
].indexOf(
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
119
|
-
for(var __WEBPACK_IMPORT_KEY__ in _layout_layout_formItem__WEBPACK_IMPORTED_MODULE_9__)if ([
|
|
105
|
+
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_layout__rspack_import_3[__rspack_import_key];
|
|
106
|
+
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
107
|
+
var _layout_layout_formItem__rspack_import_8 = __webpack_require__("./layout/layout.formItem");
|
|
108
|
+
var __rspack_reexport = {};
|
|
109
|
+
for(const __rspack_import_key in _layout_layout_formItem__rspack_import_8)if ([
|
|
120
110
|
"Form",
|
|
121
111
|
"default"
|
|
122
|
-
].indexOf(
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
128
|
-
for(var __WEBPACK_IMPORT_KEY__ in _hooks_attr_attr_FormItem__WEBPACK_IMPORTED_MODULE_10__)if ([
|
|
112
|
+
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_layout_layout_formItem__rspack_import_8[__rspack_import_key];
|
|
113
|
+
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
114
|
+
var _hooks_attr_attr_FormItem__rspack_import_9 = __webpack_require__("./hooks/attr/attr.FormItem");
|
|
115
|
+
var __rspack_reexport = {};
|
|
116
|
+
for(const __rspack_import_key in _hooks_attr_attr_FormItem__rspack_import_9)if ([
|
|
129
117
|
"Form",
|
|
130
118
|
"default"
|
|
131
|
-
].indexOf(
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
136
|
-
for(var __WEBPACK_IMPORT_KEY__ in _carefrees_form_utils_react_hooks__WEBPACK_IMPORTED_MODULE_4__)if ([
|
|
119
|
+
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_hooks_attr_attr_FormItem__rspack_import_9[__rspack_import_key];
|
|
120
|
+
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
121
|
+
var __rspack_reexport = {};
|
|
122
|
+
for(const __rspack_import_key in _carefrees_form_utils_react_hooks__rspack_import_4)if ([
|
|
137
123
|
"Form",
|
|
138
124
|
"default"
|
|
139
|
-
].indexOf(
|
|
140
|
-
|
|
141
|
-
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
142
|
-
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
125
|
+
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_carefrees_form_utils_react_hooks__rspack_import_4[__rspack_import_key];
|
|
126
|
+
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
143
127
|
function Form(props) {
|
|
144
128
|
const { children, form, style, className, formData, hideData, hideRuleData, isAutoUpdatedFormData = false, name, onFinish, onFinishFailed, onValuesChange, layoutStyle, layoutClassName, ...rest } = props;
|
|
145
|
-
const formInstance = (0,
|
|
146
|
-
(0,
|
|
147
|
-
const cls = (0,
|
|
148
|
-
(0,
|
|
129
|
+
const formInstance = (0, _carefrees_form_utils_react_hooks__rspack_import_4.useForm)(form);
|
|
130
|
+
(0, _carefrees_form_utils_react_hooks__rspack_import_4.useRegisterForm)(formInstance, name);
|
|
131
|
+
const cls = (0, react__rspack_import_1.useMemo)(()=>classnames__rspack_import_2_default()('carefrees-form', className), []);
|
|
132
|
+
(0, react__rspack_import_1.useMemo)(()=>formInstance.ctor(formData, hideData, hideRuleData), []);
|
|
149
133
|
formInstance.onFinish = onFinish;
|
|
150
134
|
formInstance.onValuesChange = onValuesChange;
|
|
151
135
|
formInstance.onFinishFailed = onFinishFailed;
|
|
152
|
-
(0,
|
|
136
|
+
(0, react__rspack_import_1.useEffect)(()=>{
|
|
153
137
|
if (isAutoUpdatedFormData) formInstance.resetFormValues(formData);
|
|
154
138
|
}, [
|
|
155
139
|
isAutoUpdatedFormData,
|
|
@@ -160,13 +144,13 @@ var __webpack_exports__ = {};
|
|
|
160
144
|
event?.stopPropagation?.();
|
|
161
145
|
formInstance.submit();
|
|
162
146
|
};
|
|
163
|
-
return /*#__PURE__*/ (0,
|
|
147
|
+
return /*#__PURE__*/ (0, react_jsx_runtime__rspack_import_0.jsx)(_carefrees_form_utils_react_hooks__rspack_import_4.FormInstanceContext.Provider, {
|
|
164
148
|
value: formInstance,
|
|
165
|
-
children: /*#__PURE__*/ (0,
|
|
149
|
+
children: /*#__PURE__*/ (0, react_jsx_runtime__rspack_import_0.jsx)(_tarojs_components__rspack_import_5.Form, {
|
|
166
150
|
className: cls,
|
|
167
151
|
style: style,
|
|
168
152
|
onSubmit: onSubmit,
|
|
169
|
-
children: /*#__PURE__*/ (0,
|
|
153
|
+
children: /*#__PURE__*/ (0, react_jsx_runtime__rspack_import_0.jsx)(_layout__rspack_import_3.FormLayout, {
|
|
170
154
|
...rest,
|
|
171
155
|
className: layoutClassName,
|
|
172
156
|
style: layoutStyle,
|
|
@@ -177,9 +161,9 @@ var __webpack_exports__ = {};
|
|
|
177
161
|
}
|
|
178
162
|
})();
|
|
179
163
|
exports.Form = __webpack_exports__.Form;
|
|
180
|
-
for(var
|
|
164
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
181
165
|
"Form"
|
|
182
|
-
].indexOf(
|
|
166
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
183
167
|
Object.defineProperty(exports, '__esModule', {
|
|
184
168
|
value: true
|
|
185
169
|
});
|
package/lib/layout/index.d.ts
CHANGED
|
@@ -28,6 +28,8 @@ export interface FormLayoutProps extends AttrsOptions {
|
|
|
28
28
|
* @description gap 属性是用来设置网格行与列之间的间隙,该属性是row-gap and column-gap的简写形式。
|
|
29
29
|
*/
|
|
30
30
|
gap?: string | number;
|
|
31
|
+
/**是否添加输入框边框*/
|
|
32
|
+
inputBordered?: boolean;
|
|
31
33
|
}
|
|
32
34
|
/**布局组件*/
|
|
33
35
|
export declare const FormLayout: React.MemoExoticComponent<(props: FormLayoutProps) => import("react/jsx-runtime").JSX.Element>;
|
package/lib/layout/index.js
CHANGED
|
@@ -22,7 +22,7 @@ var __webpack_require__ = {};
|
|
|
22
22
|
})();
|
|
23
23
|
(()=>{
|
|
24
24
|
__webpack_require__.r = (exports1)=>{
|
|
25
|
-
if (
|
|
25
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
26
|
value: 'Module'
|
|
27
27
|
});
|
|
28
28
|
Object.defineProperty(exports1, '__esModule', {
|
|
@@ -33,8 +33,8 @@ var __webpack_require__ = {};
|
|
|
33
33
|
var __webpack_exports__ = {};
|
|
34
34
|
__webpack_require__.r(__webpack_exports__);
|
|
35
35
|
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
FormLayout: ()=>FormLayout,
|
|
37
|
+
FormLayoutRows: ()=>FormLayoutRows
|
|
38
38
|
});
|
|
39
39
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
40
40
|
const external_react_namespaceObject = require("react");
|
|
@@ -44,8 +44,8 @@ var external_classnames_default = /*#__PURE__*/ __webpack_require__.n(external_c
|
|
|
44
44
|
const form_utils_react_hooks_namespaceObject = require("@carefrees/form-utils-react-hooks");
|
|
45
45
|
const preCls = 'carefrees-form-layout';
|
|
46
46
|
const FormLayout = /*#__PURE__*/ (0, external_react_namespaceObject.memo)((props)=>{
|
|
47
|
-
const { colCount: p_colCount = 4, errorLayout: p_errorLayout = 'left-bottom', labelMode: p_labelMode = 'left', showColon: p_showColon = true, formItemClassName: p_formItemClassName, formItemStyle: p_formItemStyle, formItemLabelClassName: p_formItemLabelClassName, formItemLabelStyle: p_formItemLabelStyle } = (0, form_utils_react_hooks_namespaceObject.useAttrs)();
|
|
48
|
-
const { colCount = p_colCount, title, extra, children, isAllColSpan, className, headerClassName, bodyClassName, style, headerStyle, bodyStyle, errorLayout = p_errorLayout, labelMode = p_labelMode, showColon = p_showColon, formItemClassName = p_formItemClassName, formItemStyle = p_formItemStyle, formItemLabelClassName = p_formItemLabelClassName, formItemLabelStyle = p_formItemLabelStyle, bordered = false, gap } = props;
|
|
47
|
+
const { colCount: p_colCount = 4, errorLayout: p_errorLayout = 'left-bottom', labelMode: p_labelMode = 'left', showColon: p_showColon = true, formItemClassName: p_formItemClassName, formItemStyle: p_formItemStyle, formItemLabelClassName: p_formItemLabelClassName, formItemLabelStyle: p_formItemLabelStyle, inputBordered: p_inputBordered } = (0, form_utils_react_hooks_namespaceObject.useAttrs)();
|
|
48
|
+
const { colCount = p_colCount, title, extra, children, isAllColSpan, className, headerClassName, bodyClassName, style, headerStyle, bodyStyle, errorLayout = p_errorLayout, labelMode = p_labelMode, showColon = p_showColon, formItemClassName = p_formItemClassName, formItemStyle = p_formItemStyle, formItemLabelClassName = p_formItemLabelClassName, formItemLabelStyle = p_formItemLabelStyle, bordered = false, inputBordered = p_inputBordered, gap } = props;
|
|
49
49
|
const propsRef = (0, external_react_namespaceObject.useRef)(props);
|
|
50
50
|
propsRef.current = props;
|
|
51
51
|
const cls = (0, external_react_namespaceObject.useMemo)(()=>external_classnames_default()(preCls, className, {
|
|
@@ -70,7 +70,8 @@ const FormLayout = /*#__PURE__*/ (0, external_react_namespaceObject.memo)((props
|
|
|
70
70
|
formItemClassName,
|
|
71
71
|
formItemStyle,
|
|
72
72
|
formItemLabelClassName,
|
|
73
|
-
formItemLabelStyle
|
|
73
|
+
formItemLabelStyle,
|
|
74
|
+
inputBordered
|
|
74
75
|
}), [
|
|
75
76
|
colCount,
|
|
76
77
|
errorLayout,
|
|
@@ -79,7 +80,8 @@ const FormLayout = /*#__PURE__*/ (0, external_react_namespaceObject.memo)((props
|
|
|
79
80
|
formItemClassName,
|
|
80
81
|
formItemStyle,
|
|
81
82
|
formItemLabelClassName,
|
|
82
|
-
formItemLabelStyle
|
|
83
|
+
formItemLabelStyle,
|
|
84
|
+
inputBordered
|
|
83
85
|
]);
|
|
84
86
|
const styleBase = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
85
87
|
const css = {};
|
|
@@ -137,10 +139,10 @@ const FormLayoutRows = (props)=>{
|
|
|
137
139
|
};
|
|
138
140
|
exports.FormLayout = __webpack_exports__.FormLayout;
|
|
139
141
|
exports.FormLayoutRows = __webpack_exports__.FormLayoutRows;
|
|
140
|
-
for(var
|
|
142
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
141
143
|
"FormLayout",
|
|
142
144
|
"FormLayoutRows"
|
|
143
|
-
].indexOf(
|
|
145
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
144
146
|
Object.defineProperty(exports, '__esModule', {
|
|
145
147
|
value: true
|
|
146
148
|
});
|