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
@@ -5,6 +5,9 @@ import { StyledJRTable } from "./StyledJRTable";
5
5
  import JRFrame from "../JRFrame/JRFrame";
6
6
  import React from "react";
7
7
  import JRWindow from "../JRWindow/JRWindow";
8
+ import JRSubmit from "../JRSubmit";
9
+ import { JRFrameHOC } from "../JRFrame/JRFrameHOC";
10
+ import { JRWindowHOC } from "../JRWindow/JRWindowHOC";
8
11
 
9
12
 
10
13
  const getMapObject=(map,names)=>{
@@ -38,9 +41,6 @@ export default class JRTable extends JRWindow {
38
41
  }
39
42
 
40
43
  //------------------------------------------------------------------------------------
41
- getChecked(){
42
- return [1,2,3,4]
43
- }
44
44
  checkableColumn(props){
45
45
  return {//方法1
46
46
  render({value,onChange}){
@@ -195,8 +195,7 @@ export default class JRTable extends JRWindow {
195
195
  }
196
196
  this.setValue(this.getValue())
197
197
  }else{
198
- //未完成. 沒有資料的時候, 要考慮有或沒有dataSourceName的不同處理
199
- this.setValue({[this.props.dataSourceName]:[record]})
198
+ this.setValue(this.props.dataSourceName?{[this.props.dataSourceName]:[record]}:[record])
200
199
  }
201
200
  }
202
201
 
@@ -230,7 +229,11 @@ export default class JRTable extends JRWindow {
230
229
  table={this}
231
230
  />
232
231
  </table>
233
- <div className={'empty'}>{this.noData() && '無資料'}</div>
232
+ {this.noData() && <div className={'empty'}></div>}
233
+
234
234
  </StyledJRTable>
235
235
  }
236
- }
236
+ }
237
+
238
+ // export const FTable=JRFrameHOC(JRTable)
239
+ // export const WTable=JRWindowHOC(JRTable)
@@ -130,5 +130,13 @@ export const StyledJRTable=styled.div`
130
130
  display:flex;
131
131
  justify-content: center;
132
132
  align-items: center;
133
+
134
+
133
135
  }
136
+
137
+ > .empty::after{
138
+ content:'無資料';
139
+ position: block;
140
+ }
141
+
134
142
  `
@@ -29,7 +29,7 @@ const Ths=({deep,rowColumn,rowIndex,table})=>{
29
29
  {/* [s={column.colSpan??0}]
30
30
  [c={column.columnNo??0}] */}
31
31
  {
32
- table.props.resizableColumns===true
32
+ (table.props.resizableColumns===undefined || table.props.resizableColumns)
33
33
  && <Slider table={table} thRef={thRef} column={column}/>
34
34
  }
35
35
  </th>
@@ -5,22 +5,27 @@ import TitleBar from "./TitleBar";
5
5
  import { po } from "../JRUtils";
6
6
  import Slider from "./Slider";
7
7
  import Sliders from "./Slider";
8
+ import Fields from "../JRFields/JRFields";
9
+ import JRText from "../JRInput/JRText";
10
+ import style from './Style.module.css'
8
11
 
9
12
 
10
13
  const StyledJRWindow=styled.div`
11
14
  --jr-window-radius:3px;
12
15
  --padding-child:8px;
13
- --transition-x-y:height .1s ease-in, width .1s ease-in;
16
+ --transition-x-y:height .05s ease-in, width .05s ease-in;
14
17
  xborder:1px solid gray;
15
18
  position: fixed;
16
19
  padding: ${({$thick})=>$thick}px;
17
20
  border-radius: var(--jr-window-radius);
21
+ user-select: text;
18
22
 
19
23
  top: ${({$y})=>$y}px;
20
24
  left: ${({$x})=>$x}px;
21
25
  width: ${({$width=300})=>`${$width}px`};
22
26
  height: ${({$height=300})=>`${$height}px`};
23
27
  overflow: hidden;
28
+ z-index: 2;
24
29
 
25
30
  display: flex;
26
31
  flex-direction: column;
@@ -29,25 +34,19 @@ const StyledJRWindow=styled.div`
29
34
  > main{
30
35
  border-radius: var(--jr-window-radius);
31
36
  box-shadow: 0px 0px 5px 1px gray;
32
- Xbackground: white;
33
37
  display: flex;
34
38
  flex-direction: column;
35
39
  overflow: hidden;
36
40
  flex:1;
37
41
  > main {
38
- background: white;
39
42
  Xpadding:var(--padding-child);
40
43
  overflow: overlay;
41
44
  flex:1;
42
45
  display: flex;
46
+ min-height:32px;
43
47
  }
44
48
  }
45
49
 
46
- @container (min-width: 700px) {
47
- &{
48
- border: 1px solid red;
49
- }
50
- }
51
50
  `
52
51
  export default class JRWindow extends JRFrame {
53
52
  x=0
@@ -63,9 +62,67 @@ export default class JRWindow extends JRFrame {
63
62
  this.titleBarRef=React.createRef()
64
63
  this.init()
65
64
  }
66
- componentWillUpdate(prevProps, prevState, snapshot){
67
- if(this.props.popup===true && this.props.open===true && prevProps.open===false){
68
- this.props.onOpen?.bind(this)()
65
+
66
+ addMaskToTarget=(target)=>{
67
+ this.mask=document.createElement('div')
68
+ this.mask.style.background='#868686cc'
69
+ this.mask.style.position='absolute'
70
+ this.mask.style.top='0'
71
+ this.mask.style.left='0'
72
+ this.mask.style.right='0'
73
+ this.mask.style.bottom='0'
74
+ this.mask.style.borderRadius='inherit'
75
+ this.mask.style.height='10000px'
76
+ this.mask.style.width='10000px'
77
+ target.appendChild(this.mask)
78
+ po('style.mask',style.mask)
79
+ po('addMask+++++++++++++++++++++++++++')
80
+ }
81
+ removeMaskFromTarget=()=>{
82
+ po('removeMask-----------------------')
83
+ this.mask.remove()
84
+ }
85
+
86
+ maskOnTarget(on){
87
+ po('typeof this.props.maskOn',typeof this.props.maskOn)
88
+ const target=(typeof this.props.maskOn)==='object'
89
+ ?this.props.maskOn
90
+ :typeof this.props.maskOn ==='string'
91
+ ?document.getElementById(this.props.maskOn)
92
+ :document.body
93
+
94
+ // this[on?'addMaskToTarget':'removeMaskFromTarget'](target)
95
+ target?.classList[on?'add':'remove']('withMask')
96
+ }
97
+
98
+ componentDidMount(){
99
+ super.componentDidMount()
100
+ if(this.props.maskOn && this.props.open){
101
+ this.maskOnTarget(this.props.open)
102
+ }
103
+
104
+ if(this.props.open){
105
+ this.open()
106
+ }
107
+ }
108
+
109
+ open(){
110
+ this.props.onOpen?.bind(this)()
111
+ }
112
+ close(){
113
+ this.props.onClose?.bind(this)()
114
+ }
115
+
116
+ componentDidUpdate(prevProps, prevState, snapshot){
117
+ if(this.props.popup===true){
118
+ if(this.props.open && prevProps.open===false){
119
+ this.open()
120
+ }else if(this.props.open===false && prevProps.open){
121
+ this.close()
122
+ }
123
+ if(this.props.maskOn && this.props.open!=prevProps.open){
124
+ this.maskOnTarget(this.props.open)
125
+ }
69
126
  }
70
127
  }
71
128
  init(){
@@ -74,10 +131,10 @@ export default class JRWindow extends JRFrame {
74
131
  this.x=this.props.x??((window.innerWidth-(this.width??300))/2)
75
132
  this.y=this.props.y??(window.innerHeight-(this.height??300))/2
76
133
  }
134
+
77
135
  renderer(){
78
-
79
136
  return this.props.popup===true
80
- ?this.props.open===true
137
+ ?this.props.open
81
138
  ?<StyledJRWindow
82
139
  ref={this.ref}
83
140
  className={`jr-window ${this.props.className??''}`}
@@ -94,7 +151,7 @@ export default class JRWindow extends JRFrame {
94
151
  window={this}
95
152
  title={this.props.title}
96
153
  thick={this.thick}
97
- />
154
+ />
98
155
  <main>
99
156
  {super.renderer()}
100
157
  </main>
@@ -109,4 +166,5 @@ export default class JRWindow extends JRFrame {
109
166
  :''
110
167
  :super.renderer()
111
168
  }
112
- }
169
+ }
170
+
@@ -0,0 +1,114 @@
1
+ import React from "react";
2
+ import JRFields from "../JRFields/JRFields";
3
+ import styled from "styled-components";
4
+ import Sliders from "./Slider";
5
+ import TitleBar from "./TitleBar";
6
+
7
+
8
+ const StyledJRWindow=styled.div`
9
+ --jr-window-radius:3px;
10
+ --padding-child:8px;
11
+ --transition-x-y:height .05s ease-in, width .05s ease-in;
12
+ xborder:1px solid gray;
13
+ position: fixed;
14
+ padding: ${({$thick})=>$thick}px;
15
+ border-radius: var(--jr-window-radius);
16
+
17
+ top: ${({$y})=>$y}px;
18
+ left: ${({$x})=>$x}px;
19
+ width: ${({$width=300})=>`${$width}px`};
20
+ height: ${({$height=300})=>`${$height}px`};
21
+ overflow: hidden;
22
+
23
+ display: flex;
24
+ flex-direction: column;
25
+ overflow: hidden;
26
+
27
+ > main{
28
+ border-radius: var(--jr-window-radius);
29
+ box-shadow: 0px 0px 5px 1px gray;
30
+ Xbackground: white;
31
+ display: flex;
32
+ flex-direction: column;
33
+ overflow: hidden;
34
+ flex:1;
35
+ > main {
36
+ background: white;
37
+ Xpadding:var(--padding-child);
38
+ overflow: overlay;
39
+ flex:1;
40
+ display: flex;
41
+ }
42
+ }
43
+
44
+ @container (min-width: 700px) {
45
+ &{
46
+ border: 1px solid red;
47
+ }
48
+ }
49
+ `
50
+
51
+ export const JRWindowHOC = (WrappedComponent) => {
52
+ return class extends React.Component {
53
+ x=0
54
+ y=0
55
+ width=300
56
+ height=300
57
+ padding=1
58
+ thick=5
59
+
60
+ constructor(props){
61
+ super(props)
62
+ this.ref=React.createRef()
63
+ this.titleBarRef=React.createRef()
64
+ this.init()
65
+ }
66
+ componentWillUpdate(prevProps, prevState, snapshot){
67
+ if(this.props.popup===true && this.props.open===true && prevProps.open===false){
68
+ this.props.onOpen?.bind(this)()
69
+ }
70
+ }
71
+ init(){
72
+ this.height=window.innerHeight>=(this.props.height??this.height)?(this.props.height??this.height):window.innerHeight
73
+ this.width=window.innerWidth>=(this.props.width??this.width)?(this.props.width??this.width):window.innerWidth
74
+ this.x=this.props.x??((window.innerWidth-(this.width??300))/2)
75
+ this.y=this.props.y??(window.innerHeight-(this.height??300))/2
76
+ }
77
+
78
+ render() {
79
+ return this.props.popup===true
80
+ ?this.props.open===true
81
+ ?<StyledJRWindow
82
+ ref={this.ref}
83
+ className={`jr-window ${this.props.className??''}`}
84
+ $x={this.x}
85
+ $y={this.y}
86
+ $width={this.width}
87
+ $height={this.height}
88
+ $thick={this.thick}
89
+ >
90
+ <main>
91
+ <TitleBar
92
+ titleBarRef={this.titleBarRef}
93
+ windowRef={this.ref}
94
+ window={this}
95
+ title={this.props.title}
96
+ thick={this.thick}
97
+ />
98
+ <main>
99
+ <WrappedComponent {...this.props} />
100
+ </main>
101
+ </main>
102
+ <Sliders
103
+ thick={this.thick}
104
+ windowRef={this.ref}
105
+ window={this}
106
+ titleBarRef={this.titleBarRef}
107
+ />
108
+ </StyledJRWindow>
109
+ :''
110
+ :<WrappedComponent {...this.props} />
111
+ }
112
+ }
113
+ };
114
+
@@ -262,9 +262,11 @@ class Slider extends React.Component {
262
262
  })
263
263
  }
264
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
265
+ if(this.props.direction.indexOf('n')>-1){
266
+ this.props.windowRef.current.style.height=`${this.props.window.orgHeight}px`
267
+ this.data.height=this.props.window.orgHeight
268
+ this.props.window.orgHeight=null
269
+ }
268
270
  window.removeEventListener('mousemove',this.preMove)
269
271
  setTimeout(()=>{
270
272
  window.addEventListener('mousemove',this.move)
@@ -275,6 +277,9 @@ class Slider extends React.Component {
275
277
  const {height:titleBarHeight}=this.props.titleBarRef.current.getBoundingClientRect()
276
278
  let {x,y,width,height}=this.props.windowRef.current.getBoundingClientRect()
277
279
 
280
+ if(this.props.direction.indexOf('s')>-1){
281
+ this.props.window.orgHeight=null
282
+ }
278
283
  this.data={
279
284
  x,y
280
285
  ,width
@@ -0,0 +1,35 @@
1
+ .test {
2
+ color: red;
3
+ border: 1px solid red;
4
+ }
5
+
6
+ .withMask{
7
+ position: relative;
8
+ overflow: hidden !important;
9
+ user-select: none;
10
+ &::after{
11
+ content:'' ;
12
+ background : #868686cc;
13
+ a:#868686cc;
14
+ position: absolute;
15
+ top: 0;
16
+ left: 0;
17
+ right: 0;
18
+ bottom: 0;
19
+ border-radius: inherit;
20
+ height: 10000px;
21
+ width: 10000px;
22
+ }
23
+ }
24
+
25
+ mask{
26
+ background : #868686cc;
27
+ position: absolute;
28
+ top: 0;
29
+ left: 0;
30
+ right: 0;
31
+ bottom: 0;
32
+ border-radius: inherit;
33
+ height: 10000px;
34
+ width: 10000px;
35
+ }
@@ -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:rgb(214, 214, 214);
14
- color: black;
15
- &:active:hover{
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,10 +57,11 @@ const StyledTitle=styled.div`
52
57
  color:white;
53
58
  }
54
59
  >svg{
55
- color:black;
60
+ color:#bababa;
56
61
  width:14px;
57
62
  height:14px;
58
63
  cursor: pointer;
64
+ stroke-width: 3;
59
65
  }
60
66
  }
61
67
  >button.danger:hover{
@@ -78,33 +84,78 @@ export default class TitleBar extends React.Component{
78
84
  x=0
79
85
  y=0
80
86
 
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')
100
+ e.preventDefault()
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
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`
129
+
130
+ setTimeout(()=>{
131
+ document.body.style.overflow='hidden'
132
+ this.props.windowRef.current.style.transition='unset'
133
+ },50)
134
+
135
+ }
81
136
  stop=(e)=>{
137
+ po('stop')
82
138
  e.preventDefault()
83
139
  if(this.moved){
84
140
  const {clientX,clientY}=e
85
141
  const {height:titleBarHeight}=this.props.titleBarRef.current.getBoundingClientRect()
86
142
  const {x,y,width,height}=this.props.windowRef.current.getBoundingClientRect()
87
- if(y<1){
88
- this.props.windowRef.current.style.transition='var(--transition-x-y), left .1s ease-in'
89
- this.props.windowRef.current.style.left=`${-this.props.thick}px`
90
- this.props.windowRef.current.style.width=`calc(100vw + ${this.props.thick*2}px)`//`${window.innerWidth+(this.props.thick*2)}px`
91
- this.props.windowRef.current.style.height=`calc(100vh + ${this.props.thick*2}px)`//`${window.innerHeight+(this.props.thick*2)}px`
92
-
93
- this.props.window.orgHeight=height
94
- this.props.window.orgWidth=width
95
- this.props.window.orgXd=clientX-x
96
143
 
97
- }
98
- if(y>window.innerHeight)this.props.windowRef.current.style.top = `${window.innerHeight-titleBarHeight}px`
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`
99
146
  if(x+width-this.props.thick<0)this.props.windowRef.current.style.left = 0
100
147
  if(x>window.innerWidth)this.props.windowRef.current.style.left = `${window.innerWidth-width}px`
101
- document.body.style.cursor='default'
148
+
102
149
  }
150
+ document.body.style.cursor='default'
103
151
  window.removeEventListener('mousemove',this.move)
104
152
  window.removeEventListener('mouseup',this.stop)
105
153
  window.removeEventListener('mousemove',this.preMove)
154
+
155
+
106
156
  }
107
157
  move=(e)=>{
158
+ po('move')
108
159
  e.preventDefault()
109
160
  this.moved=true
110
161
  const {clientX,clientY}=e
@@ -118,13 +169,10 @@ export default class TitleBar extends React.Component{
118
169
  this.y=w.offsetTop - this.pos2
119
170
  this.x=w.offsetLeft - this.pos1
120
171
 
121
- if(this.props.window.orgWidth){
122
- if(clientX>this.props.window.orgWidth){
123
- this.x=clientX-(this.props.window.orgWidth/2)
124
- }
125
- w.style.width=`${this.props.window.orgWidth}px`
126
- this.props.window.orgWidth=null
127
- }
172
+ // if(this.props.window.orgWidth){
173
+ // w.style.width=`${this.props.window.orgWidth}px`
174
+ // this.props.window.orgWidth=null
175
+ // }
128
176
 
129
177
  this.y=this.y<-this.props.thick?-this.props.thick:this.y
130
178
  w.style.transition='unset'
@@ -132,40 +180,68 @@ export default class TitleBar extends React.Component{
132
180
  w.style.left = `${this.x}px`
133
181
  }
134
182
  preMove=(e)=>{
183
+ console.clear()
184
+ po('preMove')
185
+
135
186
  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
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
+
195
+
140
196
  }
141
- if(this.props.window.orgHeight){
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
+
207
+ w.style.width=`${this.props.window.orgWidth}px`
142
208
  w.style.height=`${this.props.window.orgHeight}px`
143
- this.props.window.orgHeight=null
209
+ }else{
210
+ this.remember(e)
144
211
  }
145
212
 
146
- w.style.transition='left .1s ease-in, height .1s ease-in'
213
+ document.body.style.cursor='grabbing'
214
+ document.body.style.overflow=this.props.window.orgBodyOverflow
215
+
216
+
147
217
  setTimeout(()=>{
148
218
  window.addEventListener('mousemove',this.move)
149
- },100)
219
+ },50)
150
220
  window.removeEventListener('mousemove',this.preMove)
151
221
  }
152
222
  start(e){
223
+ po('start')
153
224
  e.preventDefault()
154
225
  this.moved=false
155
226
  this.pos3 = e.clientX
156
227
  this.pos4 = e.clientY
228
+
157
229
  this.props.windowRef.current.style.transition='var(--transition-x-y)'
158
- document.body.style.cursor='grabbing'
159
230
  window.addEventListener('mousemove',this.preMove)
160
231
  window.addEventListener('mouseup',this.stop)
161
232
  }
233
+ onDoubleClick(){
234
+ po('onDoubleClick')
235
+ }
162
236
  render(){
237
+
163
238
  return <StyledTitle
164
239
  ref={this.props.titleBarRef}
165
240
  draggable="false"
166
241
  onMouseDown={(e)=>{
167
242
  this.start(e)
168
243
  }}
244
+ onDoubleClick={this.adjustScreen}
169
245
  >
170
246
  <FreeType tag='div' config={this.props.title??''} me={this.props.window} className={'title'}/>
171
247
  <nav>
@@ -175,9 +251,16 @@ export default class TitleBar extends React.Component{
175
251
  this.props.window.props.setOpen
176
252
  ?<JRButton icon={<IconX />}
177
253
  className={'danger'}
178
- onClick={()=>{
254
+ onClick={(e)=>{
255
+ e.stopPropagation()
256
+ if(this.props.window.orgBodyOverflow!=null){
257
+ document.body.style.overflow=this.props.window.orgBodyOverflow
258
+ }
179
259
  this.props.window.props.setOpen(false)
180
260
  }}
261
+ onMouseDown={(e)=>{
262
+ e.stopPropagation()
263
+ }}
181
264
  />
182
265
  :null
183
266
  }
package/src/main.jsx CHANGED
@@ -3,4 +3,5 @@ import { createRoot } from 'react-dom/client'
3
3
  import './app/index.css'
4
4
  import App from './app/App.jsx'
5
5
 
6
- createRoot(document.getElementById('root')).render(<App/>)
6
+ const root = createRoot(document.getElementById('root'))
7
+ root.render(<App/>)
@@ -1 +0,0 @@
1
- export const po=console.debug