@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.
@@ -22,7 +22,7 @@ var __webpack_require__ = {};
22
22
  })();
23
23
  (()=>{
24
24
  __webpack_require__.r = (exports1)=>{
25
- if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
25
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
26
26
  value: 'Module'
27
27
  });
28
28
  Object.defineProperty(exports1, '__esModule', {
@@ -149,9 +149,9 @@ const LayoutFormItem = /*#__PURE__*/ (0, external_react_namespaceObject.memo)((p
149
149
  });
150
150
  });
151
151
  exports.LayoutFormItem = __webpack_exports__.LayoutFormItem;
152
- for(var __webpack_i__ in __webpack_exports__)if (-1 === [
152
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
153
153
  "LayoutFormItem"
154
- ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
154
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
155
155
  Object.defineProperty(exports, '__esModule', {
156
156
  value: true
157
157
  });
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "author": "SunLxy <1011771396@qq.com>",
4
4
  "description": "taro react 表单组件",
5
5
  "homepage": "https://github.com/SunLxy/carefrees-form-utils",
6
- "version": "0.0.14",
6
+ "version": "0.0.16",
7
7
  "main": "lib/index.js",
8
8
  "types": "lib/index.d.ts",
9
9
  "module": "esm/index.js",
@@ -15,6 +15,10 @@
15
15
  "publishConfig": {
16
16
  "access": "public"
17
17
  },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/SunLxy/carefrees-form-utils.git"
21
+ },
18
22
  "files": [
19
23
  "src",
20
24
  "lib",
@@ -22,8 +26,8 @@
22
26
  "assets"
23
27
  ],
24
28
  "dependencies": {
25
- "@carefrees/form-utils": "^0.0.14",
26
- "@carefrees/form-utils-react-hooks": "^0.0.14",
29
+ "@carefrees/form-utils": "^0.0.16",
30
+ "@carefrees/form-utils-react-hooks": "^0.0.16",
27
31
  "classnames": "2.5.1"
28
32
  },
29
33
  "devDependencies": {
package/src/index.tsx CHANGED
@@ -5,7 +5,6 @@ import { FormLayout, FormLayoutProps } from './layout';
5
5
  import { useRegisterForm, useForm, FormInstanceContext } from '@carefrees/form-utils-react-hooks';
6
6
  import { Form as TaroForm } from '@tarojs/components';
7
7
  import type { CommonEventFunction, FormProps as TaroFormProps } from '@tarojs/components';
8
- import './styles/index.css';
9
8
  export * from './formItem';
10
9
  export * from './formList';
11
10
  export * from './layout';
@@ -30,6 +30,8 @@ export interface FormLayoutProps extends AttrsOptions {
30
30
  * @description gap 属性是用来设置网格行与列之间的间隙,该属性是row-gap and column-gap的简写形式。
31
31
  */
32
32
  gap?: string | number;
33
+ /**是否添加输入框边框*/
34
+ inputBordered?: boolean;
33
35
  }
34
36
 
35
37
  const preCls = 'carefrees-form-layout';
@@ -45,6 +47,7 @@ export const FormLayout = memo((props: FormLayoutProps) => {
45
47
  formItemStyle: p_formItemStyle,
46
48
  formItemLabelClassName: p_formItemLabelClassName,
47
49
  formItemLabelStyle: p_formItemLabelStyle,
50
+ inputBordered: p_inputBordered,
48
51
  } = useAttrs();
49
52
  const {
50
53
  colCount = p_colCount,
@@ -66,6 +69,7 @@ export const FormLayout = memo((props: FormLayoutProps) => {
66
69
  formItemLabelClassName = p_formItemLabelClassName,
67
70
  formItemLabelStyle = p_formItemLabelStyle,
68
71
  bordered = false,
72
+ inputBordered = p_inputBordered,
69
73
  gap,
70
74
  } = props;
71
75
  const propsRef = useRef(props);
@@ -95,6 +99,7 @@ export const FormLayout = memo((props: FormLayoutProps) => {
95
99
  formItemStyle,
96
100
  formItemLabelClassName,
97
101
  formItemLabelStyle,
102
+ inputBordered,
98
103
  };
99
104
  }, [
100
105
  colCount,
@@ -105,6 +110,7 @@ export const FormLayout = memo((props: FormLayoutProps) => {
105
110
  formItemStyle,
106
111
  formItemLabelClassName,
107
112
  formItemLabelStyle,
113
+ inputBordered,
108
114
  ]);
109
115
  const styleBase = useMemo(() => {
110
116
  const css: React.CSSProperties = {};
@@ -1,199 +0,0 @@
1
- .carefrees-form {
2
- box-sizing: border-box;
3
- background-color: #fff;
4
- font-size: 14px;
5
- }
6
-
7
- .carefrees-form-layout {
8
- box-sizing: border-box;
9
- border-radius: 4px;
10
- width: 100%;
11
- padding-bottom: 8px;
12
- position: relative;
13
- }
14
-
15
- .carefrees-form-layout.all-colspan {
16
- grid-column: 1 / -1;
17
- }
18
-
19
- .carefrees-form-layout.bordered {
20
- border: 1px solid #e0e0e0;
21
- }
22
-
23
- .carefrees-form-layout.bordered .carefrees-form-layout-header {
24
- padding-inline: 8px;
25
- }
26
-
27
- .carefrees-form-layout-header {
28
- padding-top: 5px;
29
- padding-bottom: 5px;
30
- box-sizing: border-box;
31
- border-bottom: 1px solid #e0e0e0;
32
- flex-direction: row;
33
- justify-content: space-between;
34
- align-items: center;
35
- margin-block-end: 4px;
36
- padding-inline: 2px;
37
- display: flex;
38
- }
39
-
40
- .carefrees-form-layout-header-title {
41
- color: #1d2129;
42
- box-sizing: border-box;
43
- font-size: 14px;
44
- font-weight: 600;
45
- }
46
-
47
- .carefrees-form-layout-header-extra {
48
- color: #1d2129;
49
- box-sizing: border-box;
50
- font-size: 14px;
51
- font-weight: 500;
52
- }
53
-
54
- .carefrees-form-layout-body {
55
- box-sizing: border-box;
56
- grid-template-columns: repeat(1, auto);
57
- gap: 2px;
58
- width: 100%;
59
- padding-left: 2px;
60
- padding-right: 2px;
61
- display: grid;
62
- }
63
-
64
- .carefrees-form-item {
65
- box-sizing: border-box;
66
- color: #000000e0;
67
- flex-direction: row;
68
- align-items: flex-start;
69
- padding: 8px;
70
- font-size: 14px;
71
- display: flex;
72
- }
73
-
74
- .carefrees-form-item-container {
75
- box-sizing: border-box;
76
- flex-direction: column;
77
- flex: 1;
78
- gap: 4px;
79
- height: 100%;
80
- display: flex;
81
- }
82
-
83
- .carefrees-form-item-container.left {
84
- flex-direction: row;
85
- gap: 8px;
86
- }
87
-
88
- .carefrees-form-item-container.left .carefrees-form-item-label-warp {
89
- text-align: right;
90
- }
91
-
92
- .carefrees-form-item-container.between {
93
- text-align: left;
94
- flex-direction: row;
95
- justify-content: space-between;
96
- gap: 8px;
97
- }
98
-
99
- .carefrees-form-item-container.between .carefrees-form-item-body, .carefrees-form-item-container.between .carefrees-form-item-body-input {
100
- text-align: right;
101
- justify-content: flex-end;
102
- }
103
-
104
- .carefrees-form-item-label-warp {
105
- box-sizing: border-box;
106
- }
107
-
108
- .carefrees-form-item-label {
109
- box-sizing: border-box;
110
- color: #000000e0;
111
- justify-content: flex-start;
112
- align-items: center;
113
- min-height: 1.4rem;
114
- font-size: 14px;
115
- display: flex;
116
- position: relative;
117
- }
118
-
119
- .carefrees-form-item-label.show-colon:after {
120
- content: ":";
121
- text-align: center;
122
- box-sizing: border-box;
123
- margin: 0;
124
- margin-inline: 2px;
125
- display: inline-block;
126
- }
127
-
128
- .carefrees-form-item-label.required:before {
129
- content: "*";
130
- color: red;
131
- box-sizing: border-box;
132
- margin-inline-end: 4px;
133
- display: inline-block;
134
- }
135
-
136
- .carefrees-form-item-body {
137
- box-sizing: border-box;
138
- flex-direction: column;
139
- flex: 1;
140
- justify-content: flex-start;
141
- align-items: flex-start;
142
- gap: 4px;
143
- display: flex;
144
- position: relative;
145
- }
146
-
147
- .carefrees-form-item-body-input {
148
- box-sizing: border-box;
149
- flex-direction: row;
150
- flex: 1;
151
- justify-content: flex-start;
152
- align-items: center;
153
- width: 100%;
154
- display: flex;
155
- }
156
-
157
- .carefrees-form-item-body-input.input-bordered {
158
- border-bottom: 1px solid #e0e0e0;
159
- }
160
-
161
- .carefrees-form-item-body-help {
162
- box-sizing: border-box;
163
- width: 100%;
164
- }
165
-
166
- .carefrees-form-item-body-error {
167
- color: red;
168
- box-sizing: border-box;
169
- z-index: 10;
170
- pointer-events: none;
171
- flex-direction: row;
172
- justify-content: start;
173
- width: 100%;
174
- padding-top: 2px;
175
- font-size: 12px;
176
- display: flex;
177
- position: absolute;
178
- inset: auto 0 -16px;
179
- }
180
-
181
- .carefrees-form-item-body-error.right-bottom {
182
- justify-content: flex-end;
183
- inset: auto 0 -16px;
184
- }
185
-
186
- .carefrees-form-item-body-error.top-left {
187
- justify-content: start;
188
- inset: -16px 0 auto;
189
- }
190
-
191
- .carefrees-form-item-body-error.top-right {
192
- justify-content: flex-end;
193
- inset: -16px 0 auto;
194
- }
195
-
196
- .carefrees-form-item-extra {
197
- box-sizing: border-box;
198
- }
199
-
@@ -1,199 +0,0 @@
1
- .carefrees-form {
2
- box-sizing: border-box;
3
- background-color: #fff;
4
- font-size: 14px;
5
- }
6
-
7
- .carefrees-form-layout {
8
- box-sizing: border-box;
9
- border-radius: 4px;
10
- width: 100%;
11
- padding-bottom: 8px;
12
- position: relative;
13
- }
14
-
15
- .carefrees-form-layout.all-colspan {
16
- grid-column: 1 / -1;
17
- }
18
-
19
- .carefrees-form-layout.bordered {
20
- border: 1px solid #e0e0e0;
21
- }
22
-
23
- .carefrees-form-layout.bordered .carefrees-form-layout-header {
24
- padding-inline: 8px;
25
- }
26
-
27
- .carefrees-form-layout-header {
28
- padding-top: 5px;
29
- padding-bottom: 5px;
30
- box-sizing: border-box;
31
- border-bottom: 1px solid #e0e0e0;
32
- flex-direction: row;
33
- justify-content: space-between;
34
- align-items: center;
35
- margin-block-end: 4px;
36
- padding-inline: 2px;
37
- display: flex;
38
- }
39
-
40
- .carefrees-form-layout-header-title {
41
- color: #1d2129;
42
- box-sizing: border-box;
43
- font-size: 14px;
44
- font-weight: 600;
45
- }
46
-
47
- .carefrees-form-layout-header-extra {
48
- color: #1d2129;
49
- box-sizing: border-box;
50
- font-size: 14px;
51
- font-weight: 500;
52
- }
53
-
54
- .carefrees-form-layout-body {
55
- box-sizing: border-box;
56
- grid-template-columns: repeat(1, auto);
57
- gap: 2px;
58
- width: 100%;
59
- padding-left: 2px;
60
- padding-right: 2px;
61
- display: grid;
62
- }
63
-
64
- .carefrees-form-item {
65
- box-sizing: border-box;
66
- color: #000000e0;
67
- flex-direction: row;
68
- align-items: flex-start;
69
- padding: 8px;
70
- font-size: 14px;
71
- display: flex;
72
- }
73
-
74
- .carefrees-form-item-container {
75
- box-sizing: border-box;
76
- flex-direction: column;
77
- flex: 1;
78
- gap: 4px;
79
- height: 100%;
80
- display: flex;
81
- }
82
-
83
- .carefrees-form-item-container.left {
84
- flex-direction: row;
85
- gap: 8px;
86
- }
87
-
88
- .carefrees-form-item-container.left .carefrees-form-item-label-warp {
89
- text-align: right;
90
- }
91
-
92
- .carefrees-form-item-container.between {
93
- text-align: left;
94
- flex-direction: row;
95
- justify-content: space-between;
96
- gap: 8px;
97
- }
98
-
99
- .carefrees-form-item-container.between .carefrees-form-item-body, .carefrees-form-item-container.between .carefrees-form-item-body-input {
100
- text-align: right;
101
- justify-content: flex-end;
102
- }
103
-
104
- .carefrees-form-item-label-warp {
105
- box-sizing: border-box;
106
- }
107
-
108
- .carefrees-form-item-label {
109
- box-sizing: border-box;
110
- color: #000000e0;
111
- justify-content: flex-start;
112
- align-items: center;
113
- min-height: 1.4rem;
114
- font-size: 14px;
115
- display: flex;
116
- position: relative;
117
- }
118
-
119
- .carefrees-form-item-label.show-colon:after {
120
- content: ":";
121
- text-align: center;
122
- box-sizing: border-box;
123
- margin: 0;
124
- margin-inline: 2px;
125
- display: inline-block;
126
- }
127
-
128
- .carefrees-form-item-label.required:before {
129
- content: "*";
130
- color: red;
131
- box-sizing: border-box;
132
- margin-inline-end: 4px;
133
- display: inline-block;
134
- }
135
-
136
- .carefrees-form-item-body {
137
- box-sizing: border-box;
138
- flex-direction: column;
139
- flex: 1;
140
- justify-content: flex-start;
141
- align-items: flex-start;
142
- gap: 4px;
143
- display: flex;
144
- position: relative;
145
- }
146
-
147
- .carefrees-form-item-body-input {
148
- box-sizing: border-box;
149
- flex-direction: row;
150
- flex: 1;
151
- justify-content: flex-start;
152
- align-items: center;
153
- width: 100%;
154
- display: flex;
155
- }
156
-
157
- .carefrees-form-item-body-input.input-bordered {
158
- border-bottom: 1px solid #e0e0e0;
159
- }
160
-
161
- .carefrees-form-item-body-help {
162
- box-sizing: border-box;
163
- width: 100%;
164
- }
165
-
166
- .carefrees-form-item-body-error {
167
- color: red;
168
- box-sizing: border-box;
169
- z-index: 10;
170
- pointer-events: none;
171
- flex-direction: row;
172
- justify-content: start;
173
- width: 100%;
174
- padding-top: 2px;
175
- font-size: 12px;
176
- display: flex;
177
- position: absolute;
178
- inset: auto 0 -16px;
179
- }
180
-
181
- .carefrees-form-item-body-error.right-bottom {
182
- justify-content: flex-end;
183
- inset: auto 0 -16px;
184
- }
185
-
186
- .carefrees-form-item-body-error.top-left {
187
- justify-content: start;
188
- inset: -16px 0 auto;
189
- }
190
-
191
- .carefrees-form-item-body-error.top-right {
192
- justify-content: flex-end;
193
- inset: -16px 0 auto;
194
- }
195
-
196
- .carefrees-form-item-extra {
197
- box-sizing: border-box;
198
- }
199
-
@@ -1,207 +0,0 @@
1
- /* 表单 */
2
- .carefrees-form {
3
- box-sizing: border-box;
4
- background-color: #fff;
5
- font-size: 14px;
6
- }
7
-
8
- /* 布局 */
9
- .carefrees-form-layout {
10
- width: 100%;
11
- box-sizing: border-box;
12
- border-radius: 4px;
13
- padding-bottom: 8px;
14
- position: relative;
15
- }
16
-
17
- .carefrees-form-layout.all-colspan {
18
- grid-column: 1 / -1;
19
- }
20
-
21
- .carefrees-form-layout.bordered {
22
- border: 1px solid #e0e0e0;
23
- }
24
- .carefrees-form-layout.bordered .carefrees-form-layout-header {
25
- padding-inline-start: 8px;
26
- padding-inline-end: 8px;
27
- }
28
-
29
- .carefrees-form-layout-header {
30
- display: flex;
31
- justify-content: space-between;
32
- align-items: center;
33
- flex-direction: row;
34
- border-bottom: 1px solid #e0e0e0;
35
- padding-top: 5px;
36
- padding-bottom: 5px;
37
- margin-block-end: 4px;
38
- padding-inline-start: 2px;
39
- padding-inline-end: 2px;
40
- box-sizing: border-box;
41
- }
42
-
43
- .carefrees-form-layout-header-title {
44
- font-size: 14px;
45
- font-weight: 600;
46
- color: #1d2129;
47
- box-sizing: border-box;
48
- }
49
- .carefrees-form-layout-header-extra {
50
- font-size: 14px;
51
- font-weight: 500;
52
- color: #1d2129;
53
- box-sizing: border-box;
54
- }
55
-
56
- .carefrees-form-layout-body {
57
- width: 100%;
58
- display: grid;
59
- grid-template-columns: repeat(1, auto);
60
- gap: 2px;
61
- padding-left: 2px;
62
- padding-right: 2px;
63
- box-sizing: border-box;
64
- }
65
-
66
- /* 表单项 */
67
- .carefrees-form-item {
68
- font-size: 14px;
69
- display: flex;
70
- flex-direction: row;
71
- align-items: flex-start;
72
- padding: 8px;
73
- box-sizing: border-box;
74
- color: rgba(0, 0, 0, 0.88);
75
- }
76
-
77
- .carefrees-form-item-container {
78
- flex: 1;
79
- height: 100%;
80
- display: flex;
81
- flex-direction: column;
82
- gap: 4px;
83
- box-sizing: border-box;
84
- }
85
- .carefrees-form-item-container.left {
86
- flex-direction: row;
87
- gap: 8px;
88
- }
89
- .carefrees-form-item-container.left .carefrees-form-item-label-warp {
90
- text-align: right;
91
- }
92
- .carefrees-form-item-container.between {
93
- gap: 8px;
94
- text-align: left;
95
- flex-direction: row;
96
- justify-content: space-between;
97
- }
98
-
99
- .carefrees-form-item-container.between .carefrees-form-item-body,
100
- .carefrees-form-item-container.between .carefrees-form-item-body-input {
101
- justify-content: flex-end;
102
- text-align: right;
103
- }
104
-
105
- .carefrees-form-item-label-warp {
106
- box-sizing: border-box;
107
- }
108
-
109
- .carefrees-form-item-label {
110
- box-sizing: border-box;
111
- display: flex;
112
- align-items: center;
113
- justify-content: flex-start;
114
- position: relative;
115
- font-size: 14px;
116
- color: rgba(0, 0, 0, 0.88);
117
- min-height: 1.4rem;
118
- }
119
-
120
- .carefrees-form-item-label.show-colon::after {
121
- content: ':';
122
- display: inline-block;
123
- text-align: center;
124
- margin: 0;
125
- margin-inline-end: 2px;
126
- margin-inline-start: 2px;
127
- box-sizing: border-box;
128
- }
129
-
130
- .carefrees-form-item-label.required::before {
131
- content: '*';
132
- color: red;
133
- display: inline-block;
134
- margin-inline-end: 4px;
135
- box-sizing: border-box;
136
- }
137
-
138
- .carefrees-form-item-body {
139
- position: relative;
140
- display: flex;
141
- flex-direction: column;
142
- align-items: flex-start;
143
- justify-content: flex-start;
144
- box-sizing: border-box;
145
- gap: 4px;
146
- flex: 1;
147
- }
148
- .carefrees-form-item-body-input {
149
- box-sizing: border-box;
150
- width: 100%;
151
- flex: 1;
152
- display: flex;
153
- justify-content: flex-start;
154
- align-items: center;
155
- flex-direction: row;
156
- }
157
-
158
- .carefrees-form-item-body-input.input-bordered {
159
- border-bottom: 1px solid #e0e0e0;
160
- }
161
-
162
- .carefrees-form-item-body-help {
163
- width: 100%;
164
- box-sizing: border-box;
165
- }
166
-
167
- .carefrees-form-item-body-error {
168
- position: absolute;
169
- width: 100%;
170
- color: red;
171
- top: auto;
172
- left: 0;
173
- right: 0;
174
- bottom: -16px;
175
- padding-top: 2px;
176
- font-size: 12px;
177
- box-sizing: border-box;
178
- z-index: 10;
179
- pointer-events: none;
180
- display: flex;
181
- flex-direction: row;
182
- justify-content: start;
183
- }
184
- .carefrees-form-item-body-error.right-bottom {
185
- justify-content: flex-end;
186
- top: auto;
187
- left: 0;
188
- right: 0;
189
- bottom: -16px;
190
- }
191
- .carefrees-form-item-body-error.top-left {
192
- justify-content: start;
193
- top: -16px;
194
- left: 0px;
195
- right: 0px;
196
- bottom: auto;
197
- }
198
- .carefrees-form-item-body-error.top-right {
199
- justify-content: flex-end;
200
- top: -16px;
201
- left: 0px;
202
- right: 0px;
203
- bottom: auto;
204
- }
205
- .carefrees-form-item-extra {
206
- box-sizing: border-box;
207
- }