jrs-react 1.2.12 → 1.2.13
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 +164 -2976
- package/build/index.js +182 -2974
- package/package.json +5 -1
- package/src/app/App.css +3 -2
- package/src/app/window/WindowApp.jsx +21 -11
- package/src/assets/icon/index.jsx +0 -13
- package/src/components/JRWindow/JRWindow.jsx +6 -0
- package/src/components/JRWindow/Slider.jsx +18 -17
- package/src/components/JRWindow/TitleBar.jsx +33 -14
- package/src/index.js +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jrs-react",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.13",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"module": "build/index.es.js",
|
|
@@ -29,6 +29,10 @@
|
|
|
29
29
|
"vite": "^6.2.0",
|
|
30
30
|
"vite-plugin-svgr": "^4.3.0"
|
|
31
31
|
},
|
|
32
|
+
"peerDependencies":{
|
|
33
|
+
"react": "^18.2.0",
|
|
34
|
+
"react-dom": "^18.2.0"
|
|
35
|
+
},
|
|
32
36
|
"devDependencies": {
|
|
33
37
|
"@babel/core": "^7.26.10",
|
|
34
38
|
"@chromatic-com/storybook": "^3.2.6",
|
package/src/app/App.css
CHANGED
|
@@ -4,6 +4,7 @@ import JRFields from "../../components/JRFields/JRFields";
|
|
|
4
4
|
import JRText from "../../components/JRInput/JRText";
|
|
5
5
|
import { po } from "../../components/JRUtils";
|
|
6
6
|
import { useState } from "react";
|
|
7
|
+
import { background } from "storybook/internal/theming";
|
|
7
8
|
|
|
8
9
|
export default function WindowApp() {
|
|
9
10
|
const [popup,setPopup]=useState(true)
|
|
@@ -40,12 +41,15 @@ export default function WindowApp() {
|
|
|
40
41
|
/> */}
|
|
41
42
|
|
|
42
43
|
|
|
43
|
-
|
|
44
|
+
<JRFields
|
|
44
45
|
title={function(){
|
|
45
46
|
return 'JRFields'//this.getValue()?.name
|
|
46
47
|
}}
|
|
48
|
+
gridStyle={{
|
|
49
|
+
grid:'auto / repeat(auto-fill, minmax(260px, 1fr))'
|
|
50
|
+
}}
|
|
47
51
|
width={400}
|
|
48
|
-
height={
|
|
52
|
+
height={450}
|
|
49
53
|
popup={popup}
|
|
50
54
|
open={open}
|
|
51
55
|
setOpen={setOpen}
|
|
@@ -57,9 +61,14 @@ export default function WindowApp() {
|
|
|
57
61
|
po('open',this)
|
|
58
62
|
this.get()
|
|
59
63
|
}}
|
|
64
|
+
// cols={3}
|
|
60
65
|
columns={[
|
|
61
|
-
{name:'name',type:JRText}
|
|
66
|
+
{name:'name',label:'Name',type:JRText}
|
|
62
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}
|
|
63
72
|
]}
|
|
64
73
|
bottom={function(){
|
|
65
74
|
return <>
|
|
@@ -80,12 +89,16 @@ export default function WindowApp() {
|
|
|
80
89
|
>Clear</button>
|
|
81
90
|
</>
|
|
82
91
|
}}
|
|
83
|
-
/>
|
|
92
|
+
/>
|
|
84
93
|
|
|
85
|
-
<JRWindow
|
|
94
|
+
{/* <JRWindow
|
|
95
|
+
style={{
|
|
96
|
+
background:'black'
|
|
97
|
+
}}
|
|
86
98
|
title={'JRWindow'}
|
|
87
|
-
width={
|
|
88
|
-
height={
|
|
99
|
+
width={380}
|
|
100
|
+
height={220}
|
|
101
|
+
y={100}
|
|
89
102
|
popup={popup}
|
|
90
103
|
open={open}
|
|
91
104
|
setOpen={setOpen}
|
|
@@ -109,10 +122,7 @@ export default function WindowApp() {
|
|
|
109
122
|
6<br/>
|
|
110
123
|
7<br/>
|
|
111
124
|
8<br/>9<br/>10<br/>
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
</JRWindow>
|
|
125
|
+
</JRWindow> */}
|
|
116
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/> */}
|
|
117
127
|
</>
|
|
118
128
|
}
|
|
@@ -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
|
|
@@ -2,7 +2,6 @@ import React from "react"
|
|
|
2
2
|
import styled from "styled-components"
|
|
3
3
|
import { po } from "../JRUtils"
|
|
4
4
|
|
|
5
|
-
const borderWidth='px'
|
|
6
5
|
const directions=['n','e','s','w','nww','nnw','nne','nee','sse','see','sww','ssw']
|
|
7
6
|
export default class Sliders extends React.Component {
|
|
8
7
|
render(){
|
|
@@ -39,7 +38,7 @@ const StyledSlider=styled.div`
|
|
|
39
38
|
class Slider extends React.Component {
|
|
40
39
|
width='3px'
|
|
41
40
|
borderWidth='px'
|
|
42
|
-
borderLong=
|
|
41
|
+
borderLong=5
|
|
43
42
|
|
|
44
43
|
constructor(props){
|
|
45
44
|
super(props);
|
|
@@ -201,15 +200,12 @@ class Slider extends React.Component {
|
|
|
201
200
|
let y=cursorY-(this.props.thick)
|
|
202
201
|
if(y<0)y=0
|
|
203
202
|
let height=startHeight+(startY-y)
|
|
204
|
-
|
|
205
203
|
if(height<titleBarHeight+(this.props.thick*2)){
|
|
206
204
|
height=titleBarHeight+(this.props.thick*2)
|
|
207
205
|
y=startY + startHeight - titleBarHeight - (this.props.thick*2)
|
|
208
206
|
}
|
|
209
|
-
|
|
210
207
|
window.style.top=`${y}px`
|
|
211
208
|
window.style.height=`${height}px`
|
|
212
|
-
|
|
213
209
|
}
|
|
214
210
|
resizeE=({window,clientX,left,titleBarHeight})=>{
|
|
215
211
|
let width=clientX-left-this.props.thick
|
|
@@ -248,14 +244,16 @@ class Slider extends React.Component {
|
|
|
248
244
|
if(x>window.innerWidth)this.props.windowRef.current.style.left = `${window.innerWidth-width}px`
|
|
249
245
|
document.body.style.cursor='default'
|
|
250
246
|
window.removeEventListener('mousemove',this.move)
|
|
247
|
+
window.removeEventListener('mousemove',this.preMove)
|
|
251
248
|
window.removeEventListener('mouseup',this.stop)
|
|
252
249
|
}
|
|
253
250
|
move=(e)=>{
|
|
254
251
|
e.preventDefault()
|
|
252
|
+
this.props.windowRef.current.style.transition='unset'
|
|
255
253
|
const {clientX,clientY,x:cursorX,y:cursorY}=e
|
|
256
254
|
const window=this.props.windowRef.current
|
|
257
255
|
const {left,top}=window.getBoundingClientRect()
|
|
258
|
-
|
|
256
|
+
let {x:startX,width:startWidth,y:startY,height:startHeight,titleBarHeight}=this.data
|
|
259
257
|
|
|
260
258
|
this.directions[this.props.direction].resize({
|
|
261
259
|
window,titleBarHeight
|
|
@@ -263,20 +261,20 @@ class Slider extends React.Component {
|
|
|
263
261
|
,clientY,cursorY,startY,startHeight,top
|
|
264
262
|
})
|
|
265
263
|
}
|
|
264
|
+
preMove=()=>{
|
|
265
|
+
this.props.windowRef.current.style.height=`${this.props.window.orgHeight}px`
|
|
266
|
+
this.data.height=this.props.window.orgHeight
|
|
267
|
+
this.props.window.orgHeight=null
|
|
268
|
+
window.removeEventListener('mousemove',this.preMove)
|
|
269
|
+
setTimeout(()=>{
|
|
270
|
+
window.addEventListener('mousemove',this.move)
|
|
271
|
+
},100)
|
|
272
|
+
}
|
|
266
273
|
start=(e,direction)=>{
|
|
267
274
|
e.preventDefault()
|
|
268
275
|
const {height:titleBarHeight}=this.props.titleBarRef.current.getBoundingClientRect()
|
|
269
276
|
let {x,y,width,height}=this.props.windowRef.current.getBoundingClientRect()
|
|
270
277
|
|
|
271
|
-
if(direction.indexOf('n')>-1){
|
|
272
|
-
if(this.props.window.orgHeight){
|
|
273
|
-
height=this.props.window.orgHeight
|
|
274
|
-
this.props.window.orgHeight=null
|
|
275
|
-
}
|
|
276
|
-
}else if(direction.indexOf('s')>-1){
|
|
277
|
-
this.props.window.orgHeight=null
|
|
278
|
-
}
|
|
279
|
-
|
|
280
278
|
this.data={
|
|
281
279
|
x,y
|
|
282
280
|
,width
|
|
@@ -284,9 +282,12 @@ class Slider extends React.Component {
|
|
|
284
282
|
,titleBarHeight
|
|
285
283
|
,direction
|
|
286
284
|
}
|
|
287
|
-
this.props.windowRef.current.style.transition='unset'
|
|
288
285
|
document.body.style.cursor=this.directions[this.props.direction].cursor
|
|
289
|
-
|
|
286
|
+
if(this.props.window.orgHeight){
|
|
287
|
+
window.addEventListener('mousemove',this.preMove)
|
|
288
|
+
}else{
|
|
289
|
+
window.addEventListener('mousemove',this.move)
|
|
290
|
+
}
|
|
290
291
|
window.addEventListener('mouseup',this.stop)
|
|
291
292
|
}
|
|
292
293
|
|
|
@@ -52,6 +52,7 @@ const StyledTitle=styled.div`
|
|
|
52
52
|
color:white;
|
|
53
53
|
}
|
|
54
54
|
>svg{
|
|
55
|
+
color:black;
|
|
55
56
|
width:14px;
|
|
56
57
|
height:14px;
|
|
57
58
|
cursor: pointer;
|
|
@@ -59,7 +60,9 @@ const StyledTitle=styled.div`
|
|
|
59
60
|
}
|
|
60
61
|
>button.danger:hover{
|
|
61
62
|
background: red;
|
|
62
|
-
|
|
63
|
+
>svg{
|
|
64
|
+
color:white;
|
|
65
|
+
}
|
|
63
66
|
}
|
|
64
67
|
}
|
|
65
68
|
`
|
|
@@ -78,11 +81,9 @@ export default class TitleBar extends React.Component{
|
|
|
78
81
|
stop=(e)=>{
|
|
79
82
|
e.preventDefault()
|
|
80
83
|
if(this.moved){
|
|
81
|
-
|
|
82
|
-
|
|
84
|
+
const {clientX,clientY}=e
|
|
83
85
|
const {height:titleBarHeight}=this.props.titleBarRef.current.getBoundingClientRect()
|
|
84
86
|
const {x,y,width,height}=this.props.windowRef.current.getBoundingClientRect()
|
|
85
|
-
po('y',y)
|
|
86
87
|
if(y<1){
|
|
87
88
|
this.props.windowRef.current.style.transition='var(--transition-x-y), left .1s ease-in'
|
|
88
89
|
this.props.windowRef.current.style.left=`${-this.props.thick}px`
|
|
@@ -91,6 +92,8 @@ export default class TitleBar extends React.Component{
|
|
|
91
92
|
|
|
92
93
|
this.props.window.orgHeight=height
|
|
93
94
|
this.props.window.orgWidth=width
|
|
95
|
+
this.props.window.orgXd=clientX-x
|
|
96
|
+
|
|
94
97
|
}
|
|
95
98
|
if(y>window.innerHeight)this.props.windowRef.current.style.top = `${window.innerHeight-titleBarHeight}px`
|
|
96
99
|
if(x+width-this.props.thick<0)this.props.windowRef.current.style.left = 0
|
|
@@ -99,6 +102,7 @@ export default class TitleBar extends React.Component{
|
|
|
99
102
|
}
|
|
100
103
|
window.removeEventListener('mousemove',this.move)
|
|
101
104
|
window.removeEventListener('mouseup',this.stop)
|
|
105
|
+
window.removeEventListener('mousemove',this.preMove)
|
|
102
106
|
}
|
|
103
107
|
move=(e)=>{
|
|
104
108
|
e.preventDefault()
|
|
@@ -111,13 +115,9 @@ export default class TitleBar extends React.Component{
|
|
|
111
115
|
this.pos4 = y
|
|
112
116
|
|
|
113
117
|
const w= this.props.windowRef.current
|
|
114
|
-
this.x=w.offsetLeft - this.pos1
|
|
115
118
|
this.y=w.offsetTop - this.pos2
|
|
119
|
+
this.x=w.offsetLeft - this.pos1
|
|
116
120
|
|
|
117
|
-
if(this.props.window.orgHeight){
|
|
118
|
-
w.style.height=`${this.props.window.orgHeight}px`
|
|
119
|
-
this.props.window.orgHeight=null
|
|
120
|
-
}
|
|
121
121
|
if(this.props.window.orgWidth){
|
|
122
122
|
if(clientX>this.props.window.orgWidth){
|
|
123
123
|
this.x=clientX-(this.props.window.orgWidth/2)
|
|
@@ -127,8 +127,27 @@ export default class TitleBar extends React.Component{
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
this.y=this.y<-this.props.thick?-this.props.thick:this.y
|
|
130
|
-
w.style.
|
|
131
|
-
w.style.
|
|
130
|
+
w.style.transition='unset'
|
|
131
|
+
w.style.top = `${this.y}px`
|
|
132
|
+
w.style.left = `${this.x}px`
|
|
133
|
+
}
|
|
134
|
+
preMove=(e)=>{
|
|
135
|
+
const w=this.props.windowRef.current
|
|
136
|
+
const {clientX,clientY}=e
|
|
137
|
+
if(this.props.window.orgXd){
|
|
138
|
+
w.style.left=`${clientX-this.props.window.orgXd}px`
|
|
139
|
+
this.props.window.orgXd=null
|
|
140
|
+
}
|
|
141
|
+
if(this.props.window.orgHeight){
|
|
142
|
+
w.style.height=`${this.props.window.orgHeight}px`
|
|
143
|
+
this.props.window.orgHeight=null
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
w.style.transition='left .1s ease-in, height .1s ease-in'
|
|
147
|
+
setTimeout(()=>{
|
|
148
|
+
window.addEventListener('mousemove',this.move)
|
|
149
|
+
},100)
|
|
150
|
+
window.removeEventListener('mousemove',this.preMove)
|
|
132
151
|
}
|
|
133
152
|
start(e){
|
|
134
153
|
e.preventDefault()
|
|
@@ -137,7 +156,7 @@ export default class TitleBar extends React.Component{
|
|
|
137
156
|
this.pos4 = e.clientY
|
|
138
157
|
this.props.windowRef.current.style.transition='var(--transition-x-y)'
|
|
139
158
|
document.body.style.cursor='grabbing'
|
|
140
|
-
window.addEventListener('mousemove',this.
|
|
159
|
+
window.addEventListener('mousemove',this.preMove)
|
|
141
160
|
window.addEventListener('mouseup',this.stop)
|
|
142
161
|
}
|
|
143
162
|
render(){
|
|
@@ -150,8 +169,8 @@ export default class TitleBar extends React.Component{
|
|
|
150
169
|
>
|
|
151
170
|
<FreeType tag='div' config={this.props.title??''} me={this.props.window} className={'title'}/>
|
|
152
171
|
<nav>
|
|
153
|
-
<JRButton icon={<IconMinus />}/>
|
|
154
|
-
<JRButton icon={<IconSquare />}/>
|
|
172
|
+
{/* <JRButton icon={<IconMinus />}/>
|
|
173
|
+
<JRButton icon={<IconSquare />}/> */}
|
|
155
174
|
{
|
|
156
175
|
this.props.window.props.setOpen
|
|
157
176
|
?<JRButton icon={<IconX />}
|
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
|
}
|