jrs-react 1.2.12 → 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.
Files changed (41) hide show
  1. package/build/index.es.js +964 -3488
  2. package/build/index.js +982 -3486
  3. package/index.html +2 -2
  4. package/package.json +6 -1
  5. package/public/alert.json +4 -0
  6. package/public/data.json +10 -0
  7. package/public/data2.json +19 -0
  8. package/public/list.json +99 -0
  9. package/src/app/App.css +28 -5
  10. package/src/app/App.jsx +22 -1
  11. package/src/app/alert/AlertApp.jsx +92 -0
  12. package/src/app/axios/AxiosApp.jsx +71 -0
  13. package/src/app/fields/FieldsApp.jsx +22 -6
  14. package/src/app/fields/fieldsConfig.jsx +227 -1
  15. package/src/app/fields/tryHOC.jsx +21 -0
  16. package/src/app/fields/validator.jsx +217 -0
  17. package/src/app/index.css +1 -1
  18. package/src/app/table/tableConfig.jsx +4 -1
  19. package/src/app/test/index.jsx +8 -0
  20. package/src/app/window/WindowApp.jsx +120 -73
  21. package/src/assets/icon/index.jsx +0 -13
  22. package/src/components/JRAlert/index.jsx +71 -0
  23. package/src/components/JRFields/JRFields.jsx +178 -129
  24. package/src/components/JRFields/StyleJRFields.jsx +2 -3
  25. package/src/components/JRFields/Validators.jsx +33 -0
  26. package/src/components/JRFrame/JRFrame.jsx +12 -7
  27. package/src/components/JRFrame/JRFrameHOC.jsx +61 -0
  28. package/src/components/JRInput/JRInput.jsx +3 -2
  29. package/src/components/JRS.jsx +4 -0
  30. package/src/components/JRSubmit.jsx +1 -3
  31. package/src/components/JRTable/JRTable.jsx +10 -7
  32. package/src/components/JRTable/StyledJRTable.jsx +8 -0
  33. package/src/components/JRTable/THead.jsx +1 -1
  34. package/src/components/JRWindow/JRWindow.jsx +74 -10
  35. package/src/components/JRWindow/JRWindowHOC.jsx +114 -0
  36. package/src/components/JRWindow/Slider.jsx +21 -15
  37. package/src/components/JRWindow/Style.module.css +35 -0
  38. package/src/components/JRWindow/TitleBar.jsx +137 -35
  39. package/src/index.js +2 -1
  40. package/src/main.jsx +2 -1
  41. package/src/components/JRUtil.jsx +0 -1
@@ -3,102 +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";
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
+ `
7
26
 
8
27
  export default function WindowApp() {
9
28
  const [popup,setPopup]=useState(true)
10
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
+ // },[])
11
38
  return <>
12
- <button
13
- onClick={()=>{
14
- setPopup(!popup)
15
- }}
16
- >Popup</button>
39
+
40
+ <div>
17
41
  <button
18
- onClick={()=>{
19
- setOpen(!open)
20
- }}
21
- >Open</button>
22
- {/* <JRTable
23
- title={function(){
24
- return `共: ${this.getValue()?.length ??0 }筆`
25
- }}
26
- width={600}
27
- height={350}
28
- popup={popup}
29
- open={open}
30
- setOpen={setOpen}
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
+ ]}
31
68
  get={{
32
69
  url:'list.json'
33
70
  ,autoRun:true
34
71
  }}
35
- columns={[
36
- {name:'name',label:'姓名'}
37
- ,{name:'birthday',label:'生日',type:JRText}
38
- ]}
39
- resizableColumns={true}
40
- /> */}
41
-
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
+
42
84
 
43
- {/* <JRFields
85
+ <JRFields
86
+ maskOn={'info'}
87
+ style={{
88
+ background:'black'
89
+ }}
44
90
  title={function(){
45
- return 'JRFields'//this.getValue()?.name
91
+ return this.getValue()?.name
46
92
  }}
47
- width={400}
48
- height={150}
93
+ width={200}
94
+ height={200}
95
+ // y={100}
49
96
  popup={popup}
50
97
  open={open}
51
98
  setOpen={setOpen}
52
99
  get={{
53
100
  url:'data.json'
54
- ,mask:'Loading'
101
+ // ,autoRun:true
55
102
  }}
56
103
  onOpen={function(){
57
- po('open',this)
58
- this.get()
104
+ this.get(open)
59
105
  }}
60
- columns={[
61
- {name:'name',type:JRText}
62
- ,{name:'email',label:'E-mail',type:JRText}
63
- ]}
64
- bottom={function(){
65
- return <>
66
- <button
67
- onClick={()=>{
68
- this.get()
69
- }}
70
- >Get</button>
71
- <button
72
- onClick={()=>{
73
- this.reset()
74
- }}
75
- >Reset</button>
76
- <button
77
- onClick={()=>{
78
- this.setValue(null,true)
79
- }}
80
- >Clear</button>
81
- </>
82
- }}
83
- /> */}
84
-
85
- <JRWindow
86
- title={'JRWindow'}
87
- width={180}
88
- height={180}
89
- popup={popup}
90
- open={open}
91
- setOpen={setOpen}
92
- get={{
93
- url:'data.json'
94
- ,autoRun:true
106
+ onClose={function(){
107
+ this.setValue(null,true)
95
108
  }}
96
109
  columns={[
97
- {name:'name',label:'姓名'}
110
+ {name:'name',label:'姓名',type:JRText}
98
111
  ]}
99
112
  bottom={()=>{
100
113
  return <button>Get</button>
101
114
  }}
115
+ xleft={function(){
116
+ return <>Left fsd gsdf gdf g</>
117
+ }}
118
+ xright={function(){
119
+ return <div>right</div>
120
+ }}
102
121
  >
103
122
  JRWindow<br/>
104
123
  1<br/>
@@ -109,10 +128,38 @@ export default function WindowApp() {
109
128
  6<br/>
110
129
  7<br/>
111
130
  8<br/>9<br/>10<br/>
131
+ </JRFields>
112
132
 
113
-
114
-
115
- </JRWindow>
116
- {/* .<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/> */}
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>
117
164
  </>
118
165
  }
@@ -1,22 +1,9 @@
1
- // import IconX from "./x.svg?react"
2
- // import IconCard from "./card.svg?react"
3
- // import IconCopy from "./copy.svg?react"
4
- // import IconSquare from "./square.svg?react"
5
- // import IconMinus from "./minus.svg?react"
6
-
7
1
  import IconX from "./x.svg"
8
2
  import IconCard from "./card.svg"
9
3
  import IconCopy from "./copy.svg"
10
4
  import IconSquare from "./square.svg"
11
5
  import IconMinus from "./minus.svg"
12
6
 
13
- // import { ReactComponent as IconX } from "./x.svg"
14
- // import { ReactComponent as IconCard } from "./card.svg"
15
- // import { ReactComponent as IconCopy } from "./copy.svg"
16
- // import { ReactComponent as IconSquare } from "./square.svg"
17
- // import { ReactComponent as IconMinus } from "./minus.svg"
18
-
19
- // import { ReactComponent as Logo } from './logo.svg'
20
7
  export {
21
8
  IconX
22
9
  ,IconCard
@@ -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
+ }