@wwog/react 1.1.1 → 1.1.3
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/index.d.mts +5 -5
- package/dist/index.js +5 -7
- package/package.json +7 -1
- package/src/ProcessControl/If.tsx +5 -10
- package/src/utils/index.ts +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React$1, { FC
|
|
1
|
+
import React$1, { FC, ReactNode } from 'react';
|
|
2
2
|
|
|
3
3
|
interface SwitchProps<T> {
|
|
4
4
|
value: T;
|
|
@@ -66,9 +66,9 @@ interface ElseIfProps {
|
|
|
66
66
|
declare const If: {
|
|
67
67
|
({ condition, children, }: IfProps): React$1.ReactElement | null;
|
|
68
68
|
displayName: string;
|
|
69
|
-
Then: FC<ThenProps>;
|
|
70
|
-
ElseIf: FC<ElseIfProps>;
|
|
71
|
-
Else: FC<ElseProps>;
|
|
69
|
+
Then: React$1.FC<ThenProps>;
|
|
70
|
+
ElseIf: React$1.FC<ElseIfProps>;
|
|
71
|
+
Else: React$1.FC<ElseProps>;
|
|
72
72
|
createTyped(): {
|
|
73
73
|
If: (props: IfProps) => React$1.ReactElement | null;
|
|
74
74
|
Then: (props: ThenProps) => React$1.ReactElement;
|
|
@@ -88,7 +88,7 @@ interface SizeBoxProps {
|
|
|
88
88
|
/**
|
|
89
89
|
* @description SizeBox 组件用于设置一个固定大小的盒子
|
|
90
90
|
*/
|
|
91
|
-
declare const SizeBox: FC
|
|
91
|
+
declare const SizeBox: FC<SizeBoxProps>;
|
|
92
92
|
|
|
93
93
|
interface ArrayRenderProps<T> {
|
|
94
94
|
items: T[];
|
package/dist/index.js
CHANGED
|
@@ -134,15 +134,13 @@ const If = ({
|
|
|
134
134
|
if (condition) {
|
|
135
135
|
return thenChild ? /* @__PURE__ */ React$1.createElement(React$1.Fragment, null, thenChild.props.children) : null;
|
|
136
136
|
}
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
if (matchedElseIf) {
|
|
142
|
-
return /* @__PURE__ */ React$1.createElement(React$1.Fragment, null, matchedElseIf.props.children);
|
|
137
|
+
for (const elseIf of elseIfChildren) {
|
|
138
|
+
if (elseIf.props.condition) {
|
|
139
|
+
return /* @__PURE__ */ React$1.createElement(React$1.Fragment, null, elseIf.props.children);
|
|
140
|
+
}
|
|
143
141
|
}
|
|
144
142
|
if (elseChild) {
|
|
145
|
-
return
|
|
143
|
+
return /* @__PURE__ */ React$1.createElement(React$1.Fragment, null, elseChild.props.children);
|
|
146
144
|
}
|
|
147
145
|
return null;
|
|
148
146
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wwog/react",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "wwog",
|
|
@@ -24,11 +24,17 @@
|
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@biomejs/biome": "^1.9.4",
|
|
27
|
+
"@types/react": "^19.1.2",
|
|
28
|
+
"@types/react-dom": "^19.1.2",
|
|
27
29
|
"@vitest/coverage-v8": "^3.1.1",
|
|
28
30
|
"typescript": "^5.8.3",
|
|
29
31
|
"unbuild": "^3.5.0",
|
|
30
32
|
"vitest": "^3.1.1"
|
|
31
33
|
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"react": ">=16.8.0",
|
|
36
|
+
"react-dom": ">=16.8.0"
|
|
37
|
+
},
|
|
32
38
|
"engines": {
|
|
33
39
|
"node": ">= 20.0.0",
|
|
34
40
|
"pnpm": ">=8.15.0"
|
|
@@ -72,19 +72,14 @@ export const If = ({
|
|
|
72
72
|
return thenChild ? <>{thenChild.props.children}</> : null;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (matchedElseIf) {
|
|
81
|
-
return <>{matchedElseIf.props.children}</>;
|
|
75
|
+
for (const elseIf of elseIfChildren) {
|
|
76
|
+
if (elseIf.props.condition) {
|
|
77
|
+
return <>{elseIf.props.children}</>;
|
|
78
|
+
}
|
|
82
79
|
}
|
|
83
80
|
|
|
84
81
|
if (elseChild) {
|
|
85
|
-
return elseChild
|
|
86
|
-
<>{(elseChild as React.ReactElement<ElseProps>).props.children}</>
|
|
87
|
-
) : null;
|
|
82
|
+
return <>{(elseChild as React.ReactElement<ElseProps>).props.children}</>;
|
|
88
83
|
}
|
|
89
84
|
|
|
90
85
|
return null;
|