@carefrees/form-utils-react-native 0.0.8 → 0.0.9

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 CHANGED
@@ -5,3 +5,639 @@
5
5
  ```bash
6
6
  npm install @carefrees/form-utils-react-native # yarn add @carefrees/form-utils-react-native # pnpm add @carefrees/form-utils-react-native
7
7
  ```
8
+
9
+ ## 使用
10
+
11
+ ### 基本使用
12
+
13
+ ```ts
14
+ import { Form, FormItem } from '@carefrees/form-utils-react-native';
15
+ import React, { useState } from 'react';
16
+ import { View, Button, Input } from 'react-native';
17
+
18
+ const Demo = () => {
19
+ const [formData] = useState({ name: '张三', age: 18 });
20
+ const form = useForm();
21
+
22
+ const onSubmit = async () => {
23
+ try {
24
+ console.log(form);
25
+ const result = await form.validate();
26
+ console.log(result);
27
+ } catch (error) {
28
+ console.log(error);
29
+ }
30
+ };
31
+
32
+ return (
33
+ <Form formData={formData} form={form}>
34
+ <FormItem rules={[{ required: true, message: '必填' }]} name="name" label="name">
35
+ <Input style={{ width: '100%' }} placeholder="请输入" />
36
+ </FormItem>
37
+ <FormItem name="age" label="age">
38
+ <Input style={{ width: '100%' }} placeholder="请输入" />
39
+ </FormItem>
40
+ <Button onPress={onSubmit} title="验证" color="#841584" />
41
+ </Form>
42
+ );
43
+ };
44
+ ```
45
+
46
+ ### 控制隐藏
47
+
48
+ ```ts
49
+ import { Form, FormItem, FormHideItem } from '@carefrees/form-utils-react-native';
50
+ import React, { useState } from 'react';
51
+ import { View, Button, Input } from 'react-native';
52
+
53
+ const Demo = () => {
54
+ const [formData] = useState({ name: '张三', age: 18 });
55
+ const form = useForm();
56
+
57
+ const onSubmit = async () => {
58
+ try {
59
+ console.log(form);
60
+ const result = await form.validate();
61
+ console.log(result);
62
+ } catch (error) {
63
+ console.log(error);
64
+ }
65
+ };
66
+
67
+ const onValuesChange = (item: any) => {
68
+ console.log('item', item);
69
+ if (Reflect.has(item, 'age')) {
70
+ if (item.age === '18') {
71
+ form.updatedFieldHideValue({ address: false });
72
+ } else {
73
+ form.updatedFieldHideValue({ address: true });
74
+ }
75
+ }
76
+ };
77
+
78
+ return (
79
+ <Form formData={formData} form={form} onValuesChange={onValuesChange} hideData={{ address: true }}>
80
+ <FormItem rules={[{ required: true, message: '必填' }]} name="name" label="name">
81
+ <Input style={{ width: '100%' }} placeholder="请输入" />
82
+ </FormItem>
83
+ <FormItem name="age" label="age">
84
+ <Input style={{ width: '100%' }} placeholder="请输入18,显示address表单项" />
85
+ </FormItem>
86
+ <FormHideItem name="address" label="address">
87
+ <Input style={{ width: '100%' }} placeholder="请输入" />
88
+ </FormHideItem>
89
+ <Button onPress={onSubmit} title="验证" color="#841584" />
90
+ </Form>
91
+ );
92
+ };
93
+ ```
94
+
95
+ ### 表单字段监听
96
+
97
+ ```ts
98
+ import { Form, FormItem, useWatch } from '@carefrees/form-utils-react-native';
99
+ import React, { useState } from 'react';
100
+ import { View, Button, Input ,Text} from 'react-native';
101
+
102
+ // 子节点
103
+ const Child = () => {
104
+ // 第一次监听可以获取到值
105
+ const [value] = useWatch('name');
106
+ return <View><Text>name值:{value}</Text></View>;
107
+ };
108
+
109
+ const Demo = () => {
110
+ const [formData] = useState({ name: '张三', age: 18 });
111
+ const form = useForm();
112
+
113
+ // 在表单包裹内,第一次监听获取不到值
114
+ const [age] = useWatch('age', form);
115
+ console.log(age);
116
+
117
+ const onSubmit = async () => {
118
+ try {
119
+ console.log(form);
120
+ const result = await form.validate();
121
+ console.log(result);
122
+ } catch (error) {
123
+ console.log(error);
124
+ }
125
+ };
126
+
127
+ return (
128
+ <Form formData={formData} form={form}>
129
+ <FormItem rules={[{ required: true, message: '必填' }]} name="name" label="name">
130
+ <Input style={{ width: '100%' }} placeholder="请输入" />
131
+ </FormItem>
132
+ <FormItem name="age" label="age">
133
+ <Input style={{ width: '100%' }} placeholder="请输入" />
134
+ </FormItem>
135
+ <Child />
136
+ <Button onPress={onSubmit} title="验证" color="#841584" />
137
+ </Form>
138
+ );
139
+ };
140
+ ```
141
+
142
+ ### list 表单项
143
+
144
+ ```tsx
145
+ import { Form, FormItem, useWatch, useForm, FormList, FormLayoutRows, FormLayout } from '@carefrees/form-utils-react-native';
146
+ import React, { useState } from 'react';
147
+ import { View, Button, Input ,Text} from 'react-native';
148
+
149
+ // 子节点
150
+ const Child = () => {
151
+ // 第一次监听可以获取到值
152
+ const [value] = useWatch('list');
153
+ return <View><Text>list值:{JSON.stringify(value)}</Text></View>;
154
+ };
155
+
156
+ const Demo = () => {
157
+ const [formData] = useState({
158
+ name: '张三',
159
+ age: 18,
160
+ list: [{ name: '张三' }, { name: '李四' }],
161
+ });
162
+ const form = useForm();
163
+
164
+ const onSubmit = async () => {
165
+ try {
166
+ console.log(form);
167
+ const result = await form.validate();
168
+ console.log(result);
169
+ } catch (error) {
170
+ console.log(error);
171
+ }
172
+ };
173
+
174
+ return (
175
+ <Form formData={formData} form={form}>
176
+ <FormItem rules={[{ required: true, message: '必填' }]} name="name" label="name">
177
+ <Input style={{ width: '100%' }} placeholder="请输入" />
178
+ </FormItem>
179
+ <FormItem name="age" label="age">
180
+ <Input style={{ width: '100%' }} placeholder="请输入" />
181
+ </FormItem>
182
+ <FormLayoutRows>
183
+ <FormList name="list">
184
+ {(options) => {
185
+ const fields = options.fields;
186
+ return (
187
+ <View>
188
+ <Button onPress={() => options.onAdd({})} title="添加一项数据" color="#841584" />
189
+ {fields.map((item, index) => {
190
+ return (
191
+ <FormLayout key={item.key}>
192
+ <FormItem name={`[${item.name}].name`} label="子项name">
193
+ <Input style={{ width: '100%' }} placeholder="请输入" />
194
+ </FormItem>
195
+ <View
196
+ style={{
197
+ display: 'flex',
198
+ alignItems: 'flex-end',
199
+ padding: 8,
200
+ }}
201
+ >
202
+ <Button onPress={() => options.onDelete(index)} title="删除数据" color="#841584" />
203
+ </View>
204
+ </FormLayout>
205
+ );
206
+ })}
207
+ </View>
208
+ );
209
+ }}
210
+ </FormList>
211
+ </FormLayoutRows>
212
+ <FormLayoutRows>
213
+ <Child />
214
+ <View style={{ display: 'flex', alignItems: 'flex-end', padding: 8 }}>
215
+ <Button onPress={onSubmit} title="验证" color="#841584" />
216
+ </View>
217
+ </FormLayoutRows>
218
+ </Form>
219
+ );
220
+ };
221
+ export default Demo;
222
+ ```
223
+
224
+ ### 表单项依赖更新(dependencies 参数)
225
+
226
+ ```tsx
227
+ import { Form, FormItem, useWatch, useForm, FormLayoutRows, useFormInstance } from '@carefrees/form-utils-react-native';
228
+ import React, { useState, useMemo } from 'react';
229
+ import { View, Button, Input } from 'react-native';
230
+
231
+ // 子节点
232
+ const ChildInput = () => {
233
+ const form = useFormInstance();
234
+ const a = form.getFieldValue('a');
235
+ const b = form.getFieldValue('b');
236
+ const value = useMemo(() => {
237
+ if (a && b) {
238
+ return a * b;
239
+ }
240
+ return 0;
241
+ }, [a, b]);
242
+ // 第一次监听可以获取到值
243
+ return <Input placeholder="请输入a和b" disabled value={value} />;
244
+ };
245
+
246
+ const Demo = () => {
247
+ const [formData] = useState({ a: 0, b: 0 });
248
+ const form = useForm();
249
+
250
+ const onSubmit = async () => {
251
+ try {
252
+ console.log(form);
253
+ const result = await form.validate();
254
+ console.log(result);
255
+ } catch (error) {
256
+ console.log(error);
257
+ }
258
+ };
259
+
260
+ return (
261
+ <Form formData={formData} form={form}>
262
+ <FormItem name="a" label="a">
263
+ <Input type="number" style={{ width: '100%' }} placeholder="请输入" />
264
+ </FormItem>
265
+ <FormItem name="b" label="b">
266
+ <Input type="number" style={{ width: '100%' }} placeholder="请输入" />
267
+ </FormItem>
268
+ <FormItem dependencies={['a', 'b']} name="c" label="c">
269
+ <ChildInput />
270
+ </FormItem>
271
+ <FormLayoutRows>
272
+ <View style={{ display: 'flex', alignItems: 'flex-end', padding: 8 }}>
273
+ <Button onPress={onSubmit} title="验证" color="#841584" />
274
+ </View>
275
+ </FormLayoutRows>
276
+ </Form>
277
+ );
278
+ };
279
+ export default Demo;
280
+ ```
281
+
282
+ ### 布局组件
283
+
284
+ ```tsx
285
+ import {
286
+ Form,
287
+ FormItem,
288
+ useWatch,
289
+ useForm,
290
+ FormLayoutRows,
291
+ useFormInstance,
292
+ FormLayout,
293
+ } from '@carefrees/form-utils-react-native';
294
+ import React, { useState, useMemo } from 'react';
295
+ import { View, Button, Input } from 'react-native';
296
+
297
+ const Demo = () => {
298
+ const [formData] = useState({
299
+ a: '',
300
+ b: '',
301
+ c: '',
302
+ d: '',
303
+ e: '',
304
+ f: '',
305
+ g: '',
306
+ h: '',
307
+ j: '',
308
+ k: '',
309
+ l: '',
310
+ m: '',
311
+ address: '',
312
+ });
313
+ const form = useForm();
314
+
315
+ const onSubmit = async () => {
316
+ try {
317
+ console.log(form);
318
+ const result = await form.validate();
319
+ console.log(result);
320
+ } catch (error) {
321
+ console.log(error);
322
+ }
323
+ };
324
+
325
+ return (
326
+ <Form gap={14} colCount={2} formData={formData} form={form}>
327
+ <FormLayout formItemLabelStyle={{ width: 60 }} isAllColSpan labelMode="left" bordered title="标题1">
328
+ <FormItem rules={[{ required: true, message: '必填' }]} name="a" label="测试1">
329
+ <Input style={{ width: '100%' }} placeholder="请输入18,显示address表单项" />
330
+ </FormItem>
331
+ <FormItem name="address" label="address">
332
+ <Input style={{ width: '100%' }} placeholder="请输入" />
333
+ </FormItem>
334
+ </FormLayout>
335
+ <FormLayout
336
+ isAllColSpan
337
+ labelMode="top"
338
+ bordered
339
+ title="标题2"
340
+ >
341
+ <FormItem colSpan={2} rules={[{ required: true, message: '必填' }]} name="a" label="测试1">
342
+ <Input style={{ width: '100%' }} placeholder="请输入" />
343
+ </FormItem>
344
+ <FormItem rules={[{ required: true, message: '必填' }]} name="b" label="测试2">
345
+ <Input style={{ width: '100%', height: '100%' }} placeholder="请输入" />
346
+ </FormItem>
347
+ <FormItem name="c" label="测试3">
348
+ <Input style={{ width: '100%' }} placeholder="请输入" />
349
+ </FormItem>
350
+ <FormItem name="d" label="测试4">
351
+ <Input style={{ width: '100%' }} placeholder="请输入" />
352
+ </FormItem>
353
+ <FormItem name="e" label="测试5">
354
+ <Input style={{ width: '100%' }} placeholder="请输入" />
355
+ </FormItem>
356
+ <FormItem name="f" label="测试6">
357
+ <Input style={{ width: '100%' }} placeholder="请输入" />
358
+ </FormItem>
359
+ <FormItem name="g" label="测试7">
360
+ <Input style={{ width: '100%' }} placeholder="请输入" />
361
+ </FormItem>
362
+ <FormItem name="h" label="测试8">
363
+ <Input style={{ width: '100%' }} placeholder="请输入" />
364
+ </FormItem>
365
+ <FormItem name="j" label="测试9">
366
+ <Input style={{ width: '100%' }} placeholder="请输入" />
367
+ </FormItem>
368
+ <FormItem name="k" label="测试10">
369
+ <Input style={{ width: '100%' }} placeholder="请输入" />
370
+ </FormItem>
371
+ <View>
372
+ <Button onPress={onSubmit} title="验证" color="#841584" />
373
+ </View>
374
+ </FormLayout>
375
+ <FormLayout isAllColSpan labelMode="top" title="标题2">
376
+ <FormItem rules={[{ required: true, message: '必填' }]} name="a" label="测试1">
377
+ <Input style={{ width: '100%' }} placeholder="请输入" />
378
+ </FormItem>
379
+ <FormItem name="address" label="address">
380
+ <Input style={{ width: '100%' }} placeholder="请输入" />
381
+ </FormItem>
382
+ </FormLayout>
383
+ </Form>
384
+ );
385
+ };
386
+ export default Demo;
387
+ ```
388
+
389
+ ## 类型
390
+
391
+ ### Form 表单
392
+
393
+ ```ts
394
+ import React from 'react';
395
+ import { FormInstanceBase, ValidateErrorEntity } from '@carefrees/form-utils';
396
+ import { FormLayoutProps } from '@carefrees/form-utils-react-native-taro/esm/layout';
397
+ export interface FormProps<T = any> extends FormLayoutProps {
398
+ children?: React.ReactNode;
399
+ form?: FormInstanceBase;
400
+ style?: React.CSSProperties;
401
+ layoutStyle?: React.CSSProperties;
402
+ /**表单数据*/
403
+ formData?: any;
404
+ /**值更新触发*/
405
+ onValuesChange?: (changedValues: Partial<T>, values: T) => void;
406
+ /**提交保存 验证成功*/
407
+ onFinish?: (values: T) => void;
408
+ /**提交保存 验证失败*/
409
+ onFinishFailed?: (errorInfo: ValidateErrorEntity<T>) => void;
410
+ /**隐藏表单项初始值*/
411
+ hideData?: Record<string, boolean>;
412
+ /**表单名称*/
413
+ name?: string;
414
+ /**隐藏规则校验*/
415
+ hideRuleData?: Record<string, boolean>;
416
+ /**自动重置更新formData数据*/
417
+ isAutoUpdatedFormData?: boolean;
418
+ }
419
+ export declare function Form<T = any>(props: FormProps<T>): import('react/jsx-runtime').JSX.Element;
420
+ ```
421
+
422
+ ### FormItem 表单项
423
+
424
+ ```ts
425
+ import { LayoutFormItemProps } from '@carefrees/form-utils-react-native-taro/esm/layout/layout.formItem';
426
+ import { FormItemAttrOptions } from '@carefrees/form-utils-react-native-taro/esm/hooks/attr/attr.FormItem';
427
+ export interface FormItemProps extends FormItemAttrOptions, LayoutFormItemProps {
428
+ /**不进行样式渲染*/
429
+ noStyle?: boolean;
430
+ }
431
+ /**表单项*/
432
+ export declare const FormItem: import('react').MemoExoticComponent<
433
+ (props: Partial<FormItemProps>) => import('react/jsx-runtime').JSX.Element
434
+ >;
435
+ /**隐藏表单项*/
436
+ export declare const FormHideItem: import('react').MemoExoticComponent<
437
+ (props: FormItemProps) => import('react/jsx-runtime').JSX.Element
438
+ >;
439
+ ```
440
+
441
+ ### FormList 表单 List
442
+
443
+ ```ts
444
+ import { RuleInstanceBase, FormItemInstanceBase, FormListInstanceBase } from '@carefrees/form-utils';
445
+ import React from 'react';
446
+ import { RegisterFormListOptions } from '@carefrees/form-utils-react-native-hooks';
447
+ export interface FormListChildrenProps {
448
+ /**数据集合*/
449
+ fields: {
450
+ name: number;
451
+ key: number;
452
+ }[];
453
+ /**添加*/
454
+ onAdd: (initialValue?: Object) => void;
455
+ /**删除*/
456
+ onDelete: (index: number | number[]) => void;
457
+ /**移动*/
458
+ onMove: (from: number, to: number) => void;
459
+ }
460
+ export interface FormListProps extends RegisterFormListOptions {
461
+ children: (
462
+ options: FormListChildrenProps,
463
+ instances: {
464
+ ruleInstance: RuleInstanceBase;
465
+ formItemInstance: FormItemInstanceBase;
466
+ formListInstance: FormListInstanceBase;
467
+ },
468
+ ) => React.ReactNode;
469
+ }
470
+ /**form list 组件*/
471
+ export declare const FormList: React.MemoExoticComponent<
472
+ (props: FormListProps) => import('react/jsx-runtime').JSX.Element
473
+ >;
474
+ /**隐藏 form list item 组件*/
475
+ export declare const FormHideList: React.MemoExoticComponent<
476
+ (props: FormListProps) => import('react/jsx-runtime').JSX.Element
477
+ >;
478
+ ```
479
+
480
+ ### 布局组件 类型
481
+
482
+ ```ts
483
+ import React from 'react';
484
+ import { ViewProps } from 'react-native';
485
+ import { AttrsOptions } from '@carefrees/form-utils-react-native-hooks';
486
+ export interface FormLayoutProps extends AttrsOptions {
487
+ /**标题*/
488
+ title?: React.ReactNode;
489
+ /**额外内容*/
490
+ extra?: React.ReactNode;
491
+ /**内容*/
492
+ children?: React.ReactNode;
493
+ /**是否占据整行*/
494
+ isAllColSpan?: boolean;
495
+ style?: React.CSSProperties;
496
+ /**头部样式*/
497
+ headerStyle?: React.CSSProperties;
498
+ /**内容样式*/
499
+ bodyStyle?: React.CSSProperties;
500
+ /**是否添加边框*/
501
+ bordered?: boolean;
502
+ /**列数据*/
503
+ colCount?: number;
504
+ /**
505
+ * @description gap 属性是用来设置网格行与列之间的间隙,该属性是row-gap and column-gap的简写形式。
506
+ */
507
+ gap?: string | number;
508
+ }
509
+ /**布局组件*/
510
+ export declare const FormLayout: React.MemoExoticComponent<
511
+ (props: FormLayoutProps) => import('react/jsx-runtime').JSX.Element
512
+ >;
513
+ /**布局组件 占据一整行*/
514
+ export declare const FormLayoutRows: (props: ViewProps) => import('react/jsx-runtime').JSX.Element;
515
+ ```
516
+
517
+ ### 表单项布局组件类型
518
+
519
+ ```ts
520
+ import React from 'react';
521
+ export interface LayoutFormItemProps {
522
+ /**规则校验失败错误提示位置*/
523
+ errorLayout?: 'left-bottom' | 'right-bottom' | 'top-right' | 'top-left';
524
+ /**必填样式*/
525
+ required?: boolean;
526
+ /**label显示模式*/
527
+ labelMode?: 'left' | 'top' | 'between' | 'hide';
528
+ /**内容*/
529
+ children?: React.ReactNode;
530
+ /**只进行规则样式*/
531
+ onlyRuleStyle?: boolean;
532
+ label?: React.ReactNode;
533
+ /**底部提示内容*/
534
+ helpText?: React.ReactNode;
535
+ /**额外内容*/
536
+ extra?: React.ReactNode;
537
+ /**是否显示label后的冒号*/
538
+ showColon?: boolean;
539
+ /**
540
+ * 表单项占据列数
541
+ * @default 1
542
+ */
543
+ colSpan?: number;
544
+ htmlFor?: string;
545
+ /**规则验证结果*/
546
+ validateResult?: {
547
+ tip: string | (string | undefined)[];
548
+ isInvalid: boolean;
549
+ };
550
+ style?: React.CSSProperties;
551
+ labelStyle?: React.CSSProperties;
552
+ /**底部边框*/
553
+ inputBordered?: boolean;
554
+ }
555
+ /**布局组件 表单项*/
556
+ export declare const LayoutFormItem: React.MemoExoticComponent<
557
+ (props: LayoutFormItemProps) => import('react/jsx-runtime').JSX.Element
558
+ >;
559
+ ```
560
+
561
+ ### 表单项参数
562
+
563
+ ```ts
564
+ import { RuleInstanceBase, FormInstanceBase, FormItemInstanceBase } from '@carefrees/form-utils';
565
+ import { RegisterFormItemOptions } from '@carefrees/form-utils-react-hooks';
566
+ import React from 'react';
567
+ export interface FormItemAttrOptions extends RegisterFormItemOptions {
568
+ /**依赖更新项*/
569
+ dependencies?: string[];
570
+ /**通知 只用于校验规则提示 字段 */
571
+ noticeOnlyRuleDataField?: string[];
572
+ /**通知父级字段监听方法更新*/
573
+ isNoticeParentField?: boolean;
574
+ /**通知watch监听方法更新*/
575
+ noticeWatchField?: string[];
576
+ /**是否保护值(不进行表单项组件卸载重置初始值)*/
577
+ preserve?: boolean;
578
+ /**重写规则*/
579
+ useRules?: (ruleInstance: RuleInstanceBase, form: FormInstanceBase, formItemInstance: FormItemInstanceBase) => void;
580
+ /**输入框属性重写*/
581
+ useAttrs?: (attrs: any, form: FormInstanceBase, formItemInstance: FormItemInstanceBase) => any;
582
+ /**输入框属性*/
583
+ attrs?: any;
584
+ /**传递组件字段*/
585
+ valuePropName?: string;
586
+ /**取值字段(默认text)*/
587
+ getValuePath?: string;
588
+ /**自定义获取值*/
589
+ getValueFromEvent?: (event: any, form: FormInstanceBase, formItemInstance: FormItemInstanceBase) => any;
590
+ /**值格式化*/
591
+ formatValue?: (value: any, form: FormInstanceBase, formItemInstance: FormItemInstanceBase, event: any) => any;
592
+ /**触发数据更新之后触发(用于数据联动之类的)*/
593
+ onAfterUpdate?: (value: any, form: FormInstanceBase, formItemInstance: FormItemInstanceBase, event: any) => void;
594
+ /**事件名称*/
595
+ trigger?: string;
596
+ /**子元素*/
597
+ children?: React.ReactNode;
598
+ }
599
+ /**表单项参数*/
600
+ export declare const useFormItemAttr: (options: FormItemAttrOptions) => {
601
+ children: string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode>;
602
+ form: FormInstanceBase<any>;
603
+ formItemInstance: FormItemInstanceBase;
604
+ ruleInstance: RuleInstanceBase;
605
+ onChange: (event: any) => void;
606
+ htmlFor: string;
607
+ validateResult: {
608
+ tip: string | (string | undefined)[];
609
+ isInvalid: boolean;
610
+ };
611
+ };
612
+ ```
613
+
614
+ ### 公共参数类型
615
+
616
+ ```ts
617
+ import { ViewProps } from 'react-native';
618
+ export interface AttrsOptions {
619
+ /**列数据*/
620
+ colCount?: number;
621
+ /**规则校验失败错误提示位置*/
622
+ errorLayout?: 'left-bottom' | 'right-bottom' | 'top-right' | 'top-left';
623
+ /**
624
+ * label显示模式
625
+ */
626
+ labelMode?: 'left' | 'top' | 'between' | 'hide';
627
+ /**是否显示label后的冒号*/
628
+ showColon?: boolean;
629
+ /**表单项 style*/
630
+ formItemStyle?: ViewProps['style'];
631
+ /**表单项 label style*/
632
+ formItemLabelStyle?: ViewProps['style'];
633
+ /**
634
+ * 输入框底部边框
635
+ */
636
+ inputBordered?: boolean;
637
+ }
638
+ /**公共属性 Context */
639
+ export declare const AttrsContext: import("react").Context<AttrsOptions>;
640
+ /**子项中获取公共属性*/
641
+ export declare const useAttrs: () => AttrsOptions;
642
+
643
+ ```
@@ -6,7 +6,6 @@ export interface AttrsOptions {
6
6
  errorLayout?: 'left-bottom' | 'right-bottom' | 'top-right' | 'top-left';
7
7
  /**
8
8
  * label显示模式
9
- * @platform taro 支持 between
10
9
  */
11
10
  labelMode?: 'left' | 'top' | 'between' | 'hide';
12
11
  /**是否显示label后的冒号*/
@@ -17,7 +16,6 @@ export interface AttrsOptions {
17
16
  formItemLabelStyle?: ViewProps['style'];
18
17
  /**
19
18
  * 输入框底部边框
20
- * @platform taro
21
19
  */
22
20
  inputBordered?: boolean;
23
21
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "author": "SunLxy <1011771396@qq.com>",
4
4
  "description": "react-native 表单组件",
5
5
  "homepage": "https://github.com/SunLxy/carefrees-form-utils",
6
- "version": "0.0.8",
6
+ "version": "0.0.9",
7
7
  "main": "esm/index.js",
8
8
  "types": "esm/index.d.ts",
9
9
  "module": "esm/index.js",
@@ -20,8 +20,8 @@
20
20
  "esm"
21
21
  ],
22
22
  "dependencies": {
23
- "@carefrees/form-utils": "^0.0.8",
24
- "@carefrees/form-utils-react-hooks": "^0.0.8"
23
+ "@carefrees/form-utils": "^0.0.9",
24
+ "@carefrees/form-utils-react-hooks": "^0.0.9"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@types/react": "18.2.21",
@@ -9,7 +9,6 @@ export interface AttrsOptions {
9
9
  errorLayout?: 'left-bottom' | 'right-bottom' | 'top-right' | 'top-left';
10
10
  /**
11
11
  * label显示模式
12
- * @platform taro 支持 between
13
12
  */
14
13
  labelMode?: 'left' | 'top' | 'between' | 'hide';
15
14
  /**是否显示label后的冒号*/
@@ -20,7 +19,6 @@ export interface AttrsOptions {
20
19
  formItemLabelStyle?: ViewProps['style'];
21
20
  /**
22
21
  * 输入框底部边框
23
- * @platform taro
24
22
  */
25
23
  inputBordered?: boolean;
26
24
  }