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.
- package/build/index.es.js +964 -3488
- package/build/index.js +982 -3486
- package/index.html +2 -2
- package/package.json +6 -1
- 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 +28 -5
- 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 -73
- package/src/assets/icon/index.jsx +0 -13
- 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 +74 -10
- package/src/components/JRWindow/JRWindowHOC.jsx +114 -0
- package/src/components/JRWindow/Slider.jsx +21 -15
- package/src/components/JRWindow/Style.module.css +35 -0
- package/src/components/JRWindow/TitleBar.jsx +137 -35
- package/src/index.js +2 -1
- package/src/main.jsx +2 -1
- package/src/components/JRUtil.jsx +0 -1
|
@@ -5,14 +5,18 @@ import { FreeType } from "../JRFrame/JRFrame";
|
|
|
5
5
|
import { IconX,IconCard, IconSquare, IconMinus } from "../../assets/icon";
|
|
6
6
|
import { background } from "storybook/internal/theming";
|
|
7
7
|
import JRButton from "../JRInput/JRButton";
|
|
8
|
+
import { browser } from "globals";
|
|
8
9
|
|
|
9
10
|
const StyledTitle=styled.div`
|
|
10
11
|
overflow: hidden;
|
|
11
12
|
display: flex;
|
|
12
13
|
border-radius: var(--jr-window-radius) var(--jr-window-radius) 0 0;
|
|
13
|
-
background
|
|
14
|
-
color:
|
|
15
|
-
|
|
14
|
+
background:#464646;
|
|
15
|
+
color: white;
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
min-height: min-content;
|
|
19
|
+
XX&:active{
|
|
16
20
|
cursor: grabbing;
|
|
17
21
|
}
|
|
18
22
|
|
|
@@ -36,6 +40,7 @@ const StyledTitle=styled.div`
|
|
|
36
40
|
|
|
37
41
|
|
|
38
42
|
>button{
|
|
43
|
+
outline: unset;
|
|
39
44
|
display:flex;
|
|
40
45
|
align-items: center;
|
|
41
46
|
justify-content: center;
|
|
@@ -52,14 +57,18 @@ const StyledTitle=styled.div`
|
|
|
52
57
|
color:white;
|
|
53
58
|
}
|
|
54
59
|
>svg{
|
|
60
|
+
color:#bababa;
|
|
55
61
|
width:14px;
|
|
56
62
|
height:14px;
|
|
57
63
|
cursor: pointer;
|
|
64
|
+
stroke-width: 3;
|
|
58
65
|
}
|
|
59
66
|
}
|
|
60
67
|
>button.danger:hover{
|
|
61
68
|
background: red;
|
|
62
|
-
|
|
69
|
+
>svg{
|
|
70
|
+
color:white;
|
|
71
|
+
}
|
|
63
72
|
}
|
|
64
73
|
}
|
|
65
74
|
`
|
|
@@ -75,32 +84,78 @@ export default class TitleBar extends React.Component{
|
|
|
75
84
|
x=0
|
|
76
85
|
y=0
|
|
77
86
|
|
|
78
|
-
|
|
87
|
+
remember=(e)=>{
|
|
88
|
+
po('remember')
|
|
89
|
+
const {clientX,clientY}=e
|
|
90
|
+
const {x,y,width,height}=this.props.windowRef.current.getBoundingClientRect()
|
|
91
|
+
this.props.window.orgHeight=height
|
|
92
|
+
this.props.window.orgWidth=width
|
|
93
|
+
this.props.window.orgTop=y
|
|
94
|
+
this.props.window.orgLeft=x
|
|
95
|
+
this.props.window.orgXd=clientX-x
|
|
96
|
+
this.props.window.orgBodyOverflow=document.body.style.overflow
|
|
97
|
+
}
|
|
98
|
+
adjustScreen=(e)=>{
|
|
99
|
+
po('double click adjustScreen')
|
|
79
100
|
e.preventDefault()
|
|
80
|
-
|
|
101
|
+
const {x,y,width,height}=this.props.windowRef.current.getBoundingClientRect()
|
|
102
|
+
if(y>1-this.props.thick){
|
|
103
|
+
this.remember(e)
|
|
104
|
+
this.fullScreen(e)
|
|
105
|
+
}else{
|
|
106
|
+
this.floatScreen(e)
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
floatScreen=(e)=>{
|
|
110
|
+
po('floatScreen')
|
|
111
|
+
const w=this.props.windowRef.current
|
|
112
|
+
const {clientX,clientY}=e
|
|
81
113
|
|
|
114
|
+
this.props.windowRef.current.style.transition='var(--transition-x-y), left .05s ease-in'
|
|
115
|
+
this.props.windowRef.current.style.left=`${this.props.window.orgLeft}px`
|
|
116
|
+
this.props.windowRef.current.style.top=`${this.props.window.orgTop}px`
|
|
117
|
+
this.props.windowRef.current.style.width=`${this.props.window.orgWidth}px`
|
|
118
|
+
this.props.windowRef.current.style.height=`${this.props.window.orgHeight}px`
|
|
119
|
+
document.body.style.overflow=this.props.window.orgBodyOverflow
|
|
120
|
+
}
|
|
121
|
+
fullScreen=(e)=>{
|
|
122
|
+
po('fullScreen',this.props.thick)
|
|
123
|
+
|
|
124
|
+
this.props.windowRef.current.style.transition='var(--transition-x-y), left .05s ease-in'
|
|
125
|
+
this.props.windowRef.current.style.left=`${-this.props.thick}px`
|
|
126
|
+
this.props.windowRef.current.style.top=`${-this.props.thick}px`
|
|
127
|
+
this.props.windowRef.current.style.width=`calc(100vw + ${this.props.thick*2}px)`//`${window.innerWidth+(this.props.thick*2)}px`
|
|
128
|
+
this.props.windowRef.current.style.height=`calc(100vh + ${this.props.thick*2}px)`//`${window.innerHeight+(this.props.thick*2)}px`
|
|
82
129
|
|
|
130
|
+
setTimeout(()=>{
|
|
131
|
+
document.body.style.overflow='hidden'
|
|
132
|
+
this.props.windowRef.current.style.transition='unset'
|
|
133
|
+
},50)
|
|
134
|
+
|
|
135
|
+
}
|
|
136
|
+
stop=(e)=>{
|
|
137
|
+
po('stop')
|
|
138
|
+
e.preventDefault()
|
|
139
|
+
if(this.moved){
|
|
140
|
+
const {clientX,clientY}=e
|
|
83
141
|
const {height:titleBarHeight}=this.props.titleBarRef.current.getBoundingClientRect()
|
|
84
142
|
const {x,y,width,height}=this.props.windowRef.current.getBoundingClientRect()
|
|
85
|
-
|
|
86
|
-
if(y<1)
|
|
87
|
-
|
|
88
|
-
this.props.windowRef.current.style.left=`${-this.props.thick}px`
|
|
89
|
-
this.props.windowRef.current.style.width=`calc(100vw + ${this.props.thick*2}px)`//`${window.innerWidth+(this.props.thick*2)}px`
|
|
90
|
-
this.props.windowRef.current.style.height=`calc(100vh + ${this.props.thick*2}px)`//`${window.innerHeight+(this.props.thick*2)}px`
|
|
91
|
-
|
|
92
|
-
this.props.window.orgHeight=height
|
|
93
|
-
this.props.window.orgWidth=width
|
|
94
|
-
}
|
|
95
|
-
if(y>window.innerHeight)this.props.windowRef.current.style.top = `${window.innerHeight-titleBarHeight}px`
|
|
143
|
+
|
|
144
|
+
if(y<1-this.props.thick)this.fullScreen(e)
|
|
145
|
+
if(y>window.innerHeight-titleBarHeight)this.props.windowRef.current.style.top = `${window.innerHeight-titleBarHeight}px`
|
|
96
146
|
if(x+width-this.props.thick<0)this.props.windowRef.current.style.left = 0
|
|
97
147
|
if(x>window.innerWidth)this.props.windowRef.current.style.left = `${window.innerWidth-width}px`
|
|
98
|
-
|
|
148
|
+
|
|
99
149
|
}
|
|
150
|
+
document.body.style.cursor='default'
|
|
100
151
|
window.removeEventListener('mousemove',this.move)
|
|
101
152
|
window.removeEventListener('mouseup',this.stop)
|
|
153
|
+
window.removeEventListener('mousemove',this.preMove)
|
|
154
|
+
|
|
155
|
+
|
|
102
156
|
}
|
|
103
157
|
move=(e)=>{
|
|
158
|
+
po('move')
|
|
104
159
|
e.preventDefault()
|
|
105
160
|
this.moved=true
|
|
106
161
|
const {clientX,clientY}=e
|
|
@@ -111,54 +166,101 @@ export default class TitleBar extends React.Component{
|
|
|
111
166
|
this.pos4 = y
|
|
112
167
|
|
|
113
168
|
const w= this.props.windowRef.current
|
|
114
|
-
this.x=w.offsetLeft - this.pos1
|
|
115
169
|
this.y=w.offsetTop - this.pos2
|
|
170
|
+
this.x=w.offsetLeft - this.pos1
|
|
171
|
+
|
|
172
|
+
// if(this.props.window.orgWidth){
|
|
173
|
+
// w.style.width=`${this.props.window.orgWidth}px`
|
|
174
|
+
// this.props.window.orgWidth=null
|
|
175
|
+
// }
|
|
176
|
+
|
|
177
|
+
this.y=this.y<-this.props.thick?-this.props.thick:this.y
|
|
178
|
+
w.style.transition='unset'
|
|
179
|
+
w.style.top = `${this.y}px`
|
|
180
|
+
w.style.left = `${this.x}px`
|
|
181
|
+
}
|
|
182
|
+
preMove=(e)=>{
|
|
183
|
+
console.clear()
|
|
184
|
+
po('preMove')
|
|
185
|
+
|
|
186
|
+
const w=this.props.windowRef.current
|
|
187
|
+
const {clientX,clientY,...oe}=e
|
|
188
|
+
po('e',e)
|
|
189
|
+
|
|
190
|
+
const {x,y,width,height}=w.getBoundingClientRect()
|
|
191
|
+
po('width',width)
|
|
192
|
+
|
|
193
|
+
if(y<=-this.props.thick){
|
|
194
|
+
|
|
116
195
|
|
|
117
|
-
if(this.props.window.orgHeight){
|
|
118
|
-
w.style.height=`${this.props.window.orgHeight}px`
|
|
119
|
-
this.props.window.orgHeight=null
|
|
120
196
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
197
|
+
w.style.transition='left .05s ease-in, height .05s ease-in'
|
|
198
|
+
if(y<=0){
|
|
199
|
+
// contt browserWidth=
|
|
200
|
+
const w1=window.innerWidth-(this.props.thick*2)
|
|
201
|
+
const x1=clientX
|
|
202
|
+
const w2=this.props.window.orgWidth-32
|
|
203
|
+
const x2=x1/w1 * w2
|
|
204
|
+
// po('xp' , x2)
|
|
205
|
+
w.style.left=`${clientX-x2}px`
|
|
206
|
+
|
|
125
207
|
w.style.width=`${this.props.window.orgWidth}px`
|
|
126
|
-
this.props.window.
|
|
208
|
+
w.style.height=`${this.props.window.orgHeight}px`
|
|
209
|
+
}else{
|
|
210
|
+
this.remember(e)
|
|
127
211
|
}
|
|
128
212
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
213
|
+
document.body.style.cursor='grabbing'
|
|
214
|
+
document.body.style.overflow=this.props.window.orgBodyOverflow
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
setTimeout(()=>{
|
|
218
|
+
window.addEventListener('mousemove',this.move)
|
|
219
|
+
},50)
|
|
220
|
+
window.removeEventListener('mousemove',this.preMove)
|
|
132
221
|
}
|
|
133
222
|
start(e){
|
|
223
|
+
po('start')
|
|
134
224
|
e.preventDefault()
|
|
135
225
|
this.moved=false
|
|
136
226
|
this.pos3 = e.clientX
|
|
137
227
|
this.pos4 = e.clientY
|
|
228
|
+
|
|
138
229
|
this.props.windowRef.current.style.transition='var(--transition-x-y)'
|
|
139
|
-
|
|
140
|
-
window.addEventListener('mousemove',this.move)
|
|
230
|
+
window.addEventListener('mousemove',this.preMove)
|
|
141
231
|
window.addEventListener('mouseup',this.stop)
|
|
142
232
|
}
|
|
233
|
+
onDoubleClick(){
|
|
234
|
+
po('onDoubleClick')
|
|
235
|
+
}
|
|
143
236
|
render(){
|
|
237
|
+
|
|
144
238
|
return <StyledTitle
|
|
145
239
|
ref={this.props.titleBarRef}
|
|
146
240
|
draggable="false"
|
|
147
241
|
onMouseDown={(e)=>{
|
|
148
242
|
this.start(e)
|
|
149
243
|
}}
|
|
244
|
+
onDoubleClick={this.adjustScreen}
|
|
150
245
|
>
|
|
151
246
|
<FreeType tag='div' config={this.props.title??''} me={this.props.window} className={'title'}/>
|
|
152
247
|
<nav>
|
|
153
|
-
<JRButton icon={<IconMinus />}/>
|
|
154
|
-
<JRButton icon={<IconSquare />}/>
|
|
248
|
+
{/* <JRButton icon={<IconMinus />}/>
|
|
249
|
+
<JRButton icon={<IconSquare />}/> */}
|
|
155
250
|
{
|
|
156
251
|
this.props.window.props.setOpen
|
|
157
252
|
?<JRButton icon={<IconX />}
|
|
158
253
|
className={'danger'}
|
|
159
|
-
onClick={()=>{
|
|
254
|
+
onClick={(e)=>{
|
|
255
|
+
e.stopPropagation()
|
|
256
|
+
if(this.props.window.orgBodyOverflow!=null){
|
|
257
|
+
document.body.style.overflow=this.props.window.orgBodyOverflow
|
|
258
|
+
}
|
|
160
259
|
this.props.window.props.setOpen(false)
|
|
161
260
|
}}
|
|
261
|
+
onMouseDown={(e)=>{
|
|
262
|
+
e.stopPropagation()
|
|
263
|
+
}}
|
|
162
264
|
/>
|
|
163
265
|
:null
|
|
164
266
|
}
|
package/src/index.js
CHANGED
|
@@ -4,8 +4,9 @@ import JRTable from './components/JRTable/JRTable'
|
|
|
4
4
|
import JRFields from './components/JRFields/JRFields'
|
|
5
5
|
import JRTestReact from './components/JRTest'
|
|
6
6
|
import JRButton from './components/JRInput/JRButton'
|
|
7
|
+
import JRWindow from './components/JRWindow/JRWindow'
|
|
7
8
|
export {
|
|
8
9
|
JRTestReact
|
|
9
|
-
,JRSubmit,JRFrame,JRTable,JRFields
|
|
10
|
+
,JRSubmit,JRFrame,JRWindow,JRTable,JRFields
|
|
10
11
|
,JRButton
|
|
11
12
|
}
|
package/src/main.jsx
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const po=console.debug
|