@fairys/taro-tools-simple-form-ui 0.0.10 → 0.0.11
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/esm/form/form.item.d.ts
CHANGED
|
@@ -9,10 +9,10 @@ export interface FairysTaroValtioFormItemProps<T extends MObject<T> = object> ex
|
|
|
9
9
|
noStyle?: boolean;
|
|
10
10
|
}
|
|
11
11
|
/**普通表单项*/
|
|
12
|
-
export declare function
|
|
12
|
+
export declare function FairysTaroValtioFormItemBase<T extends MObject<T> = object>(props: Omit<FairysTaroValtioFormItemProps<T>, 'isHide' | 'noStyle'>): import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
/**控制隐藏的表单项*/
|
|
14
14
|
export declare function FairysTaroValtioFormHideItem<T extends MObject<T> = object>(props: Omit<FairysTaroValtioFormItemProps<T>, 'isHide' | 'noStyle'>): import("react/jsx-runtime").JSX.Element;
|
|
15
15
|
/**无样式表单项*/
|
|
16
16
|
export declare function FairysTaroValtioFormItemNoStyle<T extends MObject<T> = object>(props: Omit<FairysTaroValtioFormItemProps<T>, 'isHide' | 'noStyle'>): import("react/jsx-runtime").JSX.Element;
|
|
17
17
|
/**表单项基础组件(根据isHide和noStyle判断是否使用控制隐藏的表单项和无样式表单项)*/
|
|
18
|
-
export declare function
|
|
18
|
+
export declare function FairysTaroValtioFormItem<T extends MObject<T> = object>(props: FairysTaroValtioFormItemProps<T>): import("react/jsx-runtime").JSX.Element;
|
package/esm/form/form.item.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { View } from "@tarojs/components";
|
|
3
3
|
import { Fragment } from "react";
|
|
4
4
|
import { FairysValtioFormParentAttrsContext, useFairysValtioFormInstanceContextHideState, useFairysValtioFormItemAttrs, useFairysValtioFormItemNoStyleAttrs } from "@fairys/valtio-form-basic";
|
|
5
|
-
function
|
|
5
|
+
function FairysTaroValtioFormItemBase(props) {
|
|
6
6
|
const { label, extra, helpText } = props;
|
|
7
7
|
const { itemClassName, itemStyle, containerClassName, itemLabelClassName, itemLabelStyle, itemBodyClassName, itemBodyStyle, itemInputClassName, itemExtraClassName, errorClassName, helpClassName, isInvalid, itemBorderType, children, error, formAttrsNameInstance } = useFairysValtioFormItemAttrs(props);
|
|
8
8
|
return /*#__PURE__*/ jsxs(View, {
|
|
@@ -55,7 +55,7 @@ function FairysTaroValtioFormHideItem(props) {
|
|
|
55
55
|
const [state] = useFairysValtioFormInstanceContextHideState();
|
|
56
56
|
const isHide = state[props.name];
|
|
57
57
|
if (isHide) return /*#__PURE__*/ jsx(Fragment, {});
|
|
58
|
-
return /*#__PURE__*/ jsx(
|
|
58
|
+
return /*#__PURE__*/ jsx(FairysTaroValtioFormItemBase, {
|
|
59
59
|
...props
|
|
60
60
|
});
|
|
61
61
|
}
|
|
@@ -66,7 +66,7 @@ function FairysTaroValtioFormItemNoStyle(props) {
|
|
|
66
66
|
children: children
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function FairysTaroValtioFormItem(props) {
|
|
70
70
|
const { isHide, noStyle, ...rest } = props;
|
|
71
71
|
if (isHide) return /*#__PURE__*/ jsx(FairysTaroValtioFormHideItem, {
|
|
72
72
|
...rest
|
|
@@ -74,7 +74,7 @@ function FairysTaroValtioFormItemBase(props) {
|
|
|
74
74
|
if (noStyle) return /*#__PURE__*/ jsx(FairysTaroValtioFormItemNoStyle, {
|
|
75
75
|
...rest
|
|
76
76
|
});
|
|
77
|
-
return /*#__PURE__*/ jsx(
|
|
77
|
+
return /*#__PURE__*/ jsx(FairysTaroValtioFormItemBase, {
|
|
78
78
|
...rest
|
|
79
79
|
});
|
|
80
80
|
}
|
package/esm/form/item.config.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { View } from "@tarojs/components";
|
|
3
3
|
import { Fragment } from "react";
|
|
4
|
-
import { FairysTaroValtioFormHideItem,
|
|
4
|
+
import { FairysTaroValtioFormHideItem, FairysTaroValtioFormItemBase, FairysTaroValtioFormItemNoStyle } from "./form.item.js";
|
|
5
5
|
import { FairysTaroRadioGroupBase } from "../components/radio.group/index.js";
|
|
6
6
|
import { FairysTaroCalendarBase } from "../components/calendar/index.js";
|
|
7
7
|
import { FairysTaroCascaderBase } from "../components/cascader/index.js";
|
|
@@ -90,13 +90,13 @@ const create_itemConfig = (configList)=>/*#__PURE__*/ jsx(Fragment, {
|
|
|
90
90
|
if (isEmpty) return /*#__PURE__*/ jsx(View, {
|
|
91
91
|
className: "fairys-taro-simple-form-item-empty"
|
|
92
92
|
}, index);
|
|
93
|
-
if (noStyle) return /*#__PURE__*/ jsx(
|
|
93
|
+
if (noStyle) return /*#__PURE__*/ jsx(FairysTaroValtioFormItemNoStyle, {
|
|
94
94
|
...newItem
|
|
95
95
|
}, index);
|
|
96
96
|
if (isHide) return /*#__PURE__*/ jsx(FairysTaroValtioFormHideItem, {
|
|
97
97
|
...newItem
|
|
98
98
|
}, index);
|
|
99
|
-
return /*#__PURE__*/ jsx(
|
|
99
|
+
return /*#__PURE__*/ jsx(FairysTaroValtioFormItemBase, {
|
|
100
100
|
...newItem
|
|
101
101
|
}, index);
|
|
102
102
|
})
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"author": "SunLxy <1011771396@qq.com>",
|
|
4
4
|
"description": "框架组件库",
|
|
5
5
|
"homepage": "https://github.com/autumn-fairy-tales/fairys-taro-react",
|
|
6
|
-
"version": "0.0.
|
|
6
|
+
"version": "0.0.11",
|
|
7
7
|
"main": "lib/index.js",
|
|
8
8
|
"types": "esm/index.d.ts",
|
|
9
9
|
"module": "esm/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"esm"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@fairys/valtio-form-basic": "^0.0.
|
|
28
|
+
"@fairys/valtio-form-basic": "^0.0.11",
|
|
29
29
|
"@nutui/nutui-react-taro": "^3.0.18",
|
|
30
30
|
"async-validator": "~4.2.5",
|
|
31
31
|
"clsx": "2.1.1",
|
package/src/form/form.item.tsx
CHANGED
|
@@ -22,7 +22,7 @@ export interface FairysTaroValtioFormItemProps<T extends MObject<T> = object>
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/**普通表单项*/
|
|
25
|
-
export function
|
|
25
|
+
export function FairysTaroValtioFormItemBase<T extends MObject<T> = object>(
|
|
26
26
|
props: Omit<FairysTaroValtioFormItemProps<T>, 'isHide' | 'noStyle'>,
|
|
27
27
|
) {
|
|
28
28
|
const { label, extra, helpText } = props;
|
|
@@ -77,7 +77,7 @@ export function FairysTaroValtioFormHideItem<T extends MObject<T> = object>(
|
|
|
77
77
|
if (isHide) {
|
|
78
78
|
return <Fragment />;
|
|
79
79
|
}
|
|
80
|
-
return <
|
|
80
|
+
return <FairysTaroValtioFormItemBase<T> {...props} />;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
/**无样式表单项*/
|
|
@@ -93,7 +93,7 @@ export function FairysTaroValtioFormItemNoStyle<T extends MObject<T> = object>(
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
/**表单项基础组件(根据isHide和noStyle判断是否使用控制隐藏的表单项和无样式表单项)*/
|
|
96
|
-
export function
|
|
96
|
+
export function FairysTaroValtioFormItem<T extends MObject<T> = object>(props: FairysTaroValtioFormItemProps<T>) {
|
|
97
97
|
const { isHide, noStyle, ...rest } = props;
|
|
98
98
|
if (isHide) {
|
|
99
99
|
return <FairysTaroValtioFormHideItem<T> {...rest} />;
|
|
@@ -101,5 +101,5 @@ export function FairysTaroValtioFormItemBase<T extends MObject<T> = object>(prop
|
|
|
101
101
|
if (noStyle) {
|
|
102
102
|
return <FairysTaroValtioFormItemNoStyle<T> {...rest} />;
|
|
103
103
|
}
|
|
104
|
-
return <
|
|
104
|
+
return <FairysTaroValtioFormItemBase<T> {...rest} />;
|
|
105
105
|
}
|
package/src/form/form.tsx
CHANGED
|
@@ -37,7 +37,7 @@ FairysTaroValtioForm.useFormInstance = useFairysValtioFormInstanceContext;
|
|
|
37
37
|
FairysTaroValtioForm.FormItemListItem = FairysTaroValtioFormConfigListItem;
|
|
38
38
|
/**单个配置项*/
|
|
39
39
|
FairysTaroValtioForm.FormItemConfig = FairysTaroValtioFormConfigItem;
|
|
40
|
-
|
|
40
|
+
/**表单项基础组件*/
|
|
41
41
|
FairysTaroValtioForm.FormItemBase = FairysTaroValtioFormItemBase;
|
|
42
42
|
/**表单项*/
|
|
43
43
|
FairysTaroValtioForm.FormItem = FairysTaroValtioFormItem;
|
package/src/form/item.config.tsx
CHANGED
|
@@ -4,7 +4,11 @@
|
|
|
4
4
|
import { View } from '@tarojs/components';
|
|
5
5
|
|
|
6
6
|
import { Fragment } from 'react';
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
FairysTaroValtioFormItemBase,
|
|
9
|
+
FairysTaroValtioFormHideItem,
|
|
10
|
+
FairysTaroValtioFormItemNoStyle,
|
|
11
|
+
} from './form.item';
|
|
8
12
|
import type { FairysTaroValtioFormItemProps } from './form.item';
|
|
9
13
|
import { FairysTaroRadioGroupBase, FairysTaroRadioGroupProps } from 'components/radio.group';
|
|
10
14
|
import { FairysTaroCalendarBase, FairysTaroCalendarProps } from 'components/calendar';
|
|
@@ -168,16 +172,20 @@ const create_itemConfig = (configList: FairysTaroValtioInputConfigType[]) => {
|
|
|
168
172
|
const title = attrs.title || (typeof item.label === 'string' ? item.label : '') || '请选择';
|
|
169
173
|
newItem.children = <FairysTaroPopupSearchBase {...attrs} title={title} />;
|
|
170
174
|
}
|
|
175
|
+
/**添加空组件*/
|
|
171
176
|
if (isEmpty) {
|
|
172
177
|
return <View key={index} className="fairys-taro-simple-form-item-empty" />;
|
|
173
178
|
}
|
|
179
|
+
/**添加无样式组件*/
|
|
174
180
|
if (noStyle) {
|
|
175
|
-
return <
|
|
181
|
+
return <FairysTaroValtioFormItemNoStyle key={index} {...(newItem as FairysTaroValtioFormItemProps)} />;
|
|
176
182
|
}
|
|
183
|
+
/**添加隐藏组件*/
|
|
177
184
|
if (isHide) {
|
|
178
185
|
return <FairysTaroValtioFormHideItem key={index} {...(newItem as FairysTaroValtioFormItemProps)} />;
|
|
179
186
|
}
|
|
180
|
-
|
|
187
|
+
/**添加基础组件*/
|
|
188
|
+
return <FairysTaroValtioFormItemBase key={index} {...(newItem as FairysTaroValtioFormItemProps)} />;
|
|
181
189
|
})}
|
|
182
190
|
</Fragment>
|
|
183
191
|
);
|