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.
Files changed (39) hide show
  1. package/build/index.es.js +1015 -727
  2. package/build/index.js +1015 -727
  3. package/index.html +2 -2
  4. package/package.json +3 -2
  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 +25 -3
  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 -83
  21. package/src/components/JRAlert/index.jsx +71 -0
  22. package/src/components/JRFields/JRFields.jsx +178 -129
  23. package/src/components/JRFields/StyleJRFields.jsx +2 -3
  24. package/src/components/JRFields/Validators.jsx +33 -0
  25. package/src/components/JRFrame/JRFrame.jsx +12 -7
  26. package/src/components/JRFrame/JRFrameHOC.jsx +61 -0
  27. package/src/components/JRInput/JRInput.jsx +3 -2
  28. package/src/components/JRS.jsx +4 -0
  29. package/src/components/JRSubmit.jsx +1 -3
  30. package/src/components/JRTable/JRTable.jsx +10 -7
  31. package/src/components/JRTable/StyledJRTable.jsx +8 -0
  32. package/src/components/JRTable/THead.jsx +1 -1
  33. package/src/components/JRWindow/JRWindow.jsx +73 -15
  34. package/src/components/JRWindow/JRWindowHOC.jsx +114 -0
  35. package/src/components/JRWindow/Slider.jsx +8 -3
  36. package/src/components/JRWindow/Style.module.css +35 -0
  37. package/src/components/JRWindow/TitleBar.jsx +116 -33
  38. package/src/main.jsx +2 -1
  39. 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 { background } from "storybook/internal/theming";
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
- <button
14
- onClick={()=>{
15
- setPopup(!popup)
16
- }}
17
- >Popup</button>
39
+
40
+ <div>
18
41
  <button
19
- onClick={()=>{
20
- setOpen(!open)
21
- }}
22
- >Open</button>
23
- {/* <JRTable
24
- title={function(){
25
- return `共: ${this.getValue()?.length ??0 }筆`
26
- }}
27
- width={600}
28
- height={350}
29
- popup={popup}
30
- open={open}
31
- 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
+ ]}
32
68
  get={{
33
69
  url:'list.json'
34
70
  ,autoRun:true
35
71
  }}
36
- columns={[
37
- {name:'name',label:'姓名'}
38
- ,{name:'birthday',label:'生日',type:JRText}
39
- ]}
40
- resizableColumns={true}
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
- title={function(){
46
- return 'JRFields'//this.getValue()?.name
86
+ maskOn={'info'}
87
+ style={{
88
+ background:'black'
47
89
  }}
48
- gridStyle={{
49
- grid:'auto / repeat(auto-fill, minmax(260px, 1fr))'
90
+ title={function(){
91
+ return this.getValue()?.name
50
92
  }}
51
- width={400}
52
- height={450}
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
- ,mask:'Loading'
101
+ // ,autoRun:true
59
102
  }}
60
103
  onOpen={function(){
61
- po('open',this)
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
- title={'JRWindow'}
99
- width={380}
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
- </JRWindow> */}
126
- {/* .<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/> */}
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
+ }