jrs-react 1.2.13 → 1.2.14
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/build/index.es.js +1015 -727
- package/build/index.js +1015 -727
- package/index.html +2 -2
- package/package.json +3 -2
- package/public/alert.json +4 -0
- package/public/data.json +10 -0
- package/public/data2.json +19 -0
- package/public/list.json +99 -0
- package/src/app/App.css +25 -3
- package/src/app/App.jsx +22 -1
- package/src/app/alert/AlertApp.jsx +92 -0
- package/src/app/axios/AxiosApp.jsx +71 -0
- package/src/app/fields/FieldsApp.jsx +22 -6
- package/src/app/fields/fieldsConfig.jsx +227 -1
- package/src/app/fields/tryHOC.jsx +21 -0
- package/src/app/fields/validator.jsx +217 -0
- package/src/app/index.css +1 -1
- package/src/app/table/tableConfig.jsx +4 -1
- package/src/app/test/index.jsx +8 -0
- package/src/app/window/WindowApp.jsx +120 -83
- package/src/components/JRAlert/index.jsx +71 -0
- package/src/components/JRFields/JRFields.jsx +178 -129
- package/src/components/JRFields/StyleJRFields.jsx +2 -3
- package/src/components/JRFields/Validators.jsx +33 -0
- package/src/components/JRFrame/JRFrame.jsx +12 -7
- package/src/components/JRFrame/JRFrameHOC.jsx +61 -0
- package/src/components/JRInput/JRInput.jsx +3 -2
- package/src/components/JRS.jsx +4 -0
- package/src/components/JRSubmit.jsx +1 -3
- package/src/components/JRTable/JRTable.jsx +10 -7
- package/src/components/JRTable/StyledJRTable.jsx +8 -0
- package/src/components/JRTable/THead.jsx +1 -1
- package/src/components/JRWindow/JRWindow.jsx +73 -15
- package/src/components/JRWindow/JRWindowHOC.jsx +114 -0
- package/src/components/JRWindow/Slider.jsx +8 -3
- package/src/components/JRWindow/Style.module.css +35 -0
- package/src/components/JRWindow/TitleBar.jsx +116 -33
- package/src/main.jsx +2 -1
- package/src/components/JRUtil.jsx +0 -1
|
@@ -3,115 +3,121 @@ import JRTable from "../../components/JRTable/JRTable";
|
|
|
3
3
|
import JRFields from "../../components/JRFields/JRFields";
|
|
4
4
|
import JRText from "../../components/JRInput/JRText";
|
|
5
5
|
import { po } from "../../components/JRUtils";
|
|
6
|
-
import { useState } from "react";
|
|
7
|
-
import {
|
|
6
|
+
import { useEffect, useState } from "react";
|
|
7
|
+
import { createRoot } from 'react-dom/client'
|
|
8
|
+
import styled from "styled-components";
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const StyledDiv=styled.div`
|
|
12
|
+
border:10px solid gray;
|
|
13
|
+
width:400px;
|
|
14
|
+
height:400px;
|
|
15
|
+
margin:80px;
|
|
16
|
+
padding:20px;
|
|
17
|
+
border-radius: 5px;
|
|
18
|
+
overflow: overlay;
|
|
19
|
+
`
|
|
20
|
+
|
|
21
|
+
const Window=styled(JRWindow)`
|
|
22
|
+
.body{
|
|
23
|
+
padding:10px;
|
|
24
|
+
}
|
|
25
|
+
`
|
|
8
26
|
|
|
9
27
|
export default function WindowApp() {
|
|
10
28
|
const [popup,setPopup]=useState(true)
|
|
11
29
|
const [open,setOpen]=useState(true)
|
|
30
|
+
|
|
31
|
+
// useEffect(()=>{
|
|
32
|
+
// const w1=500
|
|
33
|
+
// const x1=250
|
|
34
|
+
// const w2=200
|
|
35
|
+
// const x2=(w1/x1)
|
|
36
|
+
// po('xp' , ((x1/w1)*100) * (w2/100))
|
|
37
|
+
// },[])
|
|
12
38
|
return <>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
setPopup(!popup)
|
|
16
|
-
}}
|
|
17
|
-
>Popup</button>
|
|
39
|
+
|
|
40
|
+
<div>
|
|
18
41
|
<button
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
42
|
+
onClick={()=>{
|
|
43
|
+
const textnode = document.createTextNode("Water");
|
|
44
|
+
document.getElementById('root').appendChild(textnode)
|
|
45
|
+
}}
|
|
46
|
+
>
|
|
47
|
+
Add
|
|
48
|
+
</button>
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
<button
|
|
54
|
+
onClick={()=>{
|
|
55
|
+
setPopup(!popup)
|
|
56
|
+
}}
|
|
57
|
+
>Popup</button>
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
<JRTable id={'info'}
|
|
62
|
+
// title={'Info'}
|
|
63
|
+
// open={true}
|
|
64
|
+
// popup={true}
|
|
65
|
+
columns={[
|
|
66
|
+
{name:'name',label:'Name'}
|
|
67
|
+
]}
|
|
32
68
|
get={{
|
|
33
69
|
url:'list.json'
|
|
34
70
|
,autoRun:true
|
|
35
71
|
}}
|
|
36
|
-
|
|
37
|
-
{
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
72
|
+
onRowClick={({record},b,c)=>{
|
|
73
|
+
setOpen({
|
|
74
|
+
value:record
|
|
75
|
+
})
|
|
76
|
+
}}
|
|
77
|
+
xstyle={{
|
|
78
|
+
height:'200px'
|
|
79
|
+
,width:'500px'
|
|
80
|
+
}}
|
|
81
|
+
>
|
|
82
|
+
</JRTable>
|
|
83
|
+
|
|
43
84
|
|
|
44
85
|
<JRFields
|
|
45
|
-
|
|
46
|
-
|
|
86
|
+
maskOn={'info'}
|
|
87
|
+
style={{
|
|
88
|
+
background:'black'
|
|
47
89
|
}}
|
|
48
|
-
|
|
49
|
-
|
|
90
|
+
title={function(){
|
|
91
|
+
return this.getValue()?.name
|
|
50
92
|
}}
|
|
51
|
-
width={
|
|
52
|
-
height={
|
|
93
|
+
width={200}
|
|
94
|
+
height={200}
|
|
95
|
+
// y={100}
|
|
53
96
|
popup={popup}
|
|
54
97
|
open={open}
|
|
55
98
|
setOpen={setOpen}
|
|
56
99
|
get={{
|
|
57
100
|
url:'data.json'
|
|
58
|
-
,
|
|
101
|
+
// ,autoRun:true
|
|
59
102
|
}}
|
|
60
103
|
onOpen={function(){
|
|
61
|
-
|
|
62
|
-
this.get()
|
|
63
|
-
}}
|
|
64
|
-
// cols={3}
|
|
65
|
-
columns={[
|
|
66
|
-
{name:'name',label:'Name',type:JRText}
|
|
67
|
-
,{name:'email',label:'E-mail',type:JRText}
|
|
68
|
-
,{name:'1',label:'1',type:JRText}
|
|
69
|
-
,{name:'2',label:'2',type:JRText}
|
|
70
|
-
,{name:'3',label:'3',type:JRText}
|
|
71
|
-
,{name:'4',label:'4',type:JRText}
|
|
72
|
-
]}
|
|
73
|
-
bottom={function(){
|
|
74
|
-
return <>
|
|
75
|
-
<button
|
|
76
|
-
onClick={()=>{
|
|
77
|
-
this.get()
|
|
78
|
-
}}
|
|
79
|
-
>Get</button>
|
|
80
|
-
<button
|
|
81
|
-
onClick={()=>{
|
|
82
|
-
this.reset()
|
|
83
|
-
}}
|
|
84
|
-
>Reset</button>
|
|
85
|
-
<button
|
|
86
|
-
onClick={()=>{
|
|
87
|
-
this.setValue(null,true)
|
|
88
|
-
}}
|
|
89
|
-
>Clear</button>
|
|
90
|
-
</>
|
|
91
|
-
}}
|
|
92
|
-
/>
|
|
93
|
-
|
|
94
|
-
{/* <JRWindow
|
|
95
|
-
style={{
|
|
96
|
-
background:'black'
|
|
104
|
+
this.get(open)
|
|
97
105
|
}}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
height={220}
|
|
101
|
-
y={100}
|
|
102
|
-
popup={popup}
|
|
103
|
-
open={open}
|
|
104
|
-
setOpen={setOpen}
|
|
105
|
-
get={{
|
|
106
|
-
url:'data.json'
|
|
107
|
-
,autoRun:true
|
|
106
|
+
onClose={function(){
|
|
107
|
+
this.setValue(null,true)
|
|
108
108
|
}}
|
|
109
109
|
columns={[
|
|
110
|
-
{name:'name',label:'姓名'}
|
|
110
|
+
{name:'name',label:'姓名',type:JRText}
|
|
111
111
|
]}
|
|
112
112
|
bottom={()=>{
|
|
113
113
|
return <button>Get</button>
|
|
114
114
|
}}
|
|
115
|
+
xleft={function(){
|
|
116
|
+
return <>Left fsd gsdf gdf g</>
|
|
117
|
+
}}
|
|
118
|
+
xright={function(){
|
|
119
|
+
return <div>right</div>
|
|
120
|
+
}}
|
|
115
121
|
>
|
|
116
122
|
JRWindow<br/>
|
|
117
123
|
1<br/>
|
|
@@ -122,7 +128,38 @@ export default function WindowApp() {
|
|
|
122
128
|
6<br/>
|
|
123
129
|
7<br/>
|
|
124
130
|
8<br/>9<br/>10<br/>
|
|
125
|
-
</
|
|
126
|
-
|
|
131
|
+
</JRFields>
|
|
132
|
+
|
|
133
|
+
<StyledDiv id='div'>
|
|
134
|
+
something here
|
|
135
|
+
<input/>
|
|
136
|
+
<button
|
|
137
|
+
style={{
|
|
138
|
+
zIndex:100
|
|
139
|
+
}}
|
|
140
|
+
onClick={()=>{
|
|
141
|
+
setOpen(!open)
|
|
142
|
+
}}
|
|
143
|
+
>Open ({open?'opend':'closed'})</button>
|
|
144
|
+
.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>
|
|
145
|
+
<button
|
|
146
|
+
style={{
|
|
147
|
+
zIndex:100
|
|
148
|
+
}}
|
|
149
|
+
onClick={()=>{
|
|
150
|
+
setOpen(!open)
|
|
151
|
+
}}
|
|
152
|
+
>Open ({open?'opend':'closed'})</button>
|
|
153
|
+
|
|
154
|
+
</StyledDiv>
|
|
155
|
+
.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>
|
|
156
|
+
<button
|
|
157
|
+
style={{
|
|
158
|
+
zIndex:100
|
|
159
|
+
}}
|
|
160
|
+
onClick={()=>{
|
|
161
|
+
setOpen(!open)
|
|
162
|
+
}}
|
|
163
|
+
>Open ({open?'opend':'closed'})</button>
|
|
127
164
|
</>
|
|
128
165
|
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { createRoot } from "react-dom/client"
|
|
2
|
+
import { po } from "../JRUtils"
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
import JRFields from "../JRFields/JRFields";
|
|
5
|
+
import JRWindow from "../JRWindow/JRWindow";
|
|
6
|
+
import styled from "styled-components";
|
|
7
|
+
|
|
8
|
+
class AlertWindow extends JRWindow{
|
|
9
|
+
renderMe(){
|
|
10
|
+
return this.getValue()?.message
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
const StyledAlert=styled(AlertWindow)`
|
|
14
|
+
.body{
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
padding: 20px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
footer{
|
|
21
|
+
display: flex;
|
|
22
|
+
justify-content: end;
|
|
23
|
+
padding: 8px;
|
|
24
|
+
}
|
|
25
|
+
`
|
|
26
|
+
function JRAlertWindow({title,message,container,...props}){
|
|
27
|
+
const [open,setOpen]=useState(true)
|
|
28
|
+
return <StyledAlert
|
|
29
|
+
initValue={{message}}
|
|
30
|
+
width={440}
|
|
31
|
+
height={180}
|
|
32
|
+
maskOn={'play'}
|
|
33
|
+
{...props}
|
|
34
|
+
open={open}
|
|
35
|
+
setOpen={setOpen}
|
|
36
|
+
popup={true}
|
|
37
|
+
title={title??''}
|
|
38
|
+
// onOpen={()=>{
|
|
39
|
+
// po('Open+++++++++++++++++')
|
|
40
|
+
// }}
|
|
41
|
+
onClose={()=>{
|
|
42
|
+
container.remove()
|
|
43
|
+
}}
|
|
44
|
+
bottom={function(){
|
|
45
|
+
return <button
|
|
46
|
+
onClick={()=>{
|
|
47
|
+
setOpen(false)
|
|
48
|
+
}}
|
|
49
|
+
>OK</button>
|
|
50
|
+
}}
|
|
51
|
+
|
|
52
|
+
>
|
|
53
|
+
{message}
|
|
54
|
+
</StyledAlert>
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export default function JRAlert(props){
|
|
58
|
+
const body=document.body
|
|
59
|
+
const containerId='jr-alert-div'
|
|
60
|
+
let container=document.getElementById(containerId)
|
|
61
|
+
if(container==null){
|
|
62
|
+
container=document.createElement('div')
|
|
63
|
+
container.id=containerId
|
|
64
|
+
body.appendChild(container)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const jrAlerDiv = document.createElement('div')
|
|
68
|
+
container.appendChild(jrAlerDiv);
|
|
69
|
+
|
|
70
|
+
createRoot(jrAlerDiv).render(<JRAlertWindow {...props} container={jrAlerDiv}/>);
|
|
71
|
+
}
|