jrs-react 1.2.36 → 1.2.37

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 CHANGED
@@ -4065,7 +4065,9 @@ const FreeType = /*#__PURE__*/forwardRef(function ({
4065
4065
  style: style,
4066
4066
  ref: ref
4067
4067
  }, content);
4068
- } else if (typeof config === 'string') {
4068
+ // }else if(typeof config==='string'){
4069
+ // return <Tag className={className} ref={ref}>{config}</Tag>
4070
+ } else {
4069
4071
  return /*#__PURE__*/React__default.createElement(Tag, {
4070
4072
  className: className,
4071
4073
  ref: ref
@@ -4373,7 +4375,7 @@ class TitleBar extends React__default.Component {
4373
4375
  width,
4374
4376
  height
4375
4377
  } = this.props.windowRef.current.getBoundingClientRect();
4376
- if (y < 1 - this.props.thick) this.fullScreen(e);
4378
+ if (y < 1 - this.props.thick && this.props.resizable != false) this.fullScreen(e);
4377
4379
  if (y > window.innerHeight - titleBarHeight) this.props.windowRef.current.style.top = `${window.innerHeight - titleBarHeight}px`;
4378
4380
  if (x + width - this.props.thick < 0) this.props.windowRef.current.style.left = 0;
4379
4381
  if (x > window.innerWidth) this.props.windowRef.current.style.left = `${window.innerWidth - width}px`;
@@ -4457,7 +4459,7 @@ class TitleBar extends React__default.Component {
4457
4459
  onMouseDown: e => {
4458
4460
  this.start(e);
4459
4461
  },
4460
- onDoubleClick: this.adjustScreen
4462
+ onDoubleClick: this.props.resizable != false ? this.adjustScreen : null
4461
4463
  }, /*#__PURE__*/React__default.createElement(FreeType, {
4462
4464
  tag: "div",
4463
4465
  config: this.props.title ?? '',
@@ -4925,7 +4927,7 @@ z-index:1;
4925
4927
  }) => $x}px;
4926
4928
  width: ${({
4927
4929
  $width = 300
4928
- }) => `${$width}px`};
4930
+ }) => typeof $width === 'string' ? '50%' : `${$width}px`};
4929
4931
  height: ${({
4930
4932
  $height = 300
4931
4933
  }) => `${$height}px`};
@@ -5014,18 +5016,22 @@ class JRWindow extends JRFrame {
5014
5016
  }
5015
5017
  }
5016
5018
  init() {
5017
- this.height = window.innerHeight >= (this.props.height ?? this.height) ? this.props.height ?? this.height : window.innerHeight;
5018
- this.width = window.innerWidth >= (this.props.width ?? this.width) ? this.props.width ?? this.width : window.innerWidth;
5019
- this.x = this.props.x ?? (window.innerWidth - (this.width ?? 300)) / 2;
5020
- this.y = this.props.y ?? (window.innerHeight - (this.height ?? 300)) / 2;
5019
+ po('window', window.innerWidth);
5020
+ if (this.props.width?.indexOf?.('%') > -1) {
5021
+ this.width = this.props.width.split('%')[0] * window.innerWidth / 100;
5022
+ } else {
5023
+ this.width = window.innerWidth >= (this.props.width ?? this.width) ? this.props.width ?? this.width : window.innerWidth;
5024
+ }
5025
+ this.x = this.props.x ?? (window.innerWidth - this.width) / 2;
5026
+ if (this.props.height?.indexOf?.('%') > -1) {
5027
+ this.height = this.props.height.split('%')[0] * window.innerHeight / 100;
5028
+ } else {
5029
+ this.height = window.innerHeight >= (this.props.height ?? this.height) ? this.props.height ?? this.height : window.innerHeight;
5030
+ }
5031
+ this.y = this.props.y ?? (window.innerHeight - this.height) / 2;
5021
5032
  }
5022
5033
  renderer() {
5023
- return this.props.popup === true ? this.props.open ? /*#__PURE__*/React__default.createElement(StyledJRWindow
5024
-
5025
- // role="dialog"
5026
- // aria-labelledby="dialog1Title"
5027
- // aria-describedby="dialog1Desc"
5028
- , {
5034
+ return this.props.popup === true ? this.props.open ? /*#__PURE__*/React__default.createElement(StyledJRWindow, {
5029
5035
  rule: 'dialog',
5030
5036
  ref: this.ref,
5031
5037
  className: `jr-window ${this.props.className ?? ''}`,
@@ -5039,8 +5045,9 @@ class JRWindow extends JRFrame {
5039
5045
  windowRef: this.ref,
5040
5046
  window: this,
5041
5047
  title: this.props.title,
5042
- thick: this.thick
5043
- }), /*#__PURE__*/React__default.createElement("main", null, super.renderer())), /*#__PURE__*/React__default.createElement(Sliders, {
5048
+ thick: this.thick,
5049
+ resizable: this.props.resizable
5050
+ }), /*#__PURE__*/React__default.createElement("main", null, super.renderer())), this.props.resizable !== false && /*#__PURE__*/React__default.createElement(Sliders, {
5044
5051
  thick: this.thick,
5045
5052
  windowRef: this.ref,
5046
5053
  window: this,
@@ -6454,7 +6461,7 @@ function JRAlertWindow({
6454
6461
  },
6455
6462
  width: 440,
6456
6463
  height: 180,
6457
- maskOn: 'play'
6464
+ maskOn: 'root'
6458
6465
  }, props, {
6459
6466
  open: open,
6460
6467
  setOpen: setOpen,
package/build/index.js CHANGED
@@ -4092,7 +4092,9 @@ const FreeType = /*#__PURE__*/React.forwardRef(function ({
4092
4092
  style: style,
4093
4093
  ref: ref
4094
4094
  }, content);
4095
- } else if (typeof config === 'string') {
4095
+ // }else if(typeof config==='string'){
4096
+ // return <Tag className={className} ref={ref}>{config}</Tag>
4097
+ } else {
4096
4098
  return /*#__PURE__*/React__default["default"].createElement(Tag, {
4097
4099
  className: className,
4098
4100
  ref: ref
@@ -4400,7 +4402,7 @@ class TitleBar extends React__default["default"].Component {
4400
4402
  width,
4401
4403
  height
4402
4404
  } = this.props.windowRef.current.getBoundingClientRect();
4403
- if (y < 1 - this.props.thick) this.fullScreen(e);
4405
+ if (y < 1 - this.props.thick && this.props.resizable != false) this.fullScreen(e);
4404
4406
  if (y > window.innerHeight - titleBarHeight) this.props.windowRef.current.style.top = `${window.innerHeight - titleBarHeight}px`;
4405
4407
  if (x + width - this.props.thick < 0) this.props.windowRef.current.style.left = 0;
4406
4408
  if (x > window.innerWidth) this.props.windowRef.current.style.left = `${window.innerWidth - width}px`;
@@ -4484,7 +4486,7 @@ class TitleBar extends React__default["default"].Component {
4484
4486
  onMouseDown: e => {
4485
4487
  this.start(e);
4486
4488
  },
4487
- onDoubleClick: this.adjustScreen
4489
+ onDoubleClick: this.props.resizable != false ? this.adjustScreen : null
4488
4490
  }, /*#__PURE__*/React__default["default"].createElement(FreeType, {
4489
4491
  tag: "div",
4490
4492
  config: this.props.title ?? '',
@@ -4952,7 +4954,7 @@ z-index:1;
4952
4954
  }) => $x}px;
4953
4955
  width: ${({
4954
4956
  $width = 300
4955
- }) => `${$width}px`};
4957
+ }) => typeof $width === 'string' ? '50%' : `${$width}px`};
4956
4958
  height: ${({
4957
4959
  $height = 300
4958
4960
  }) => `${$height}px`};
@@ -5041,18 +5043,22 @@ class JRWindow extends JRFrame {
5041
5043
  }
5042
5044
  }
5043
5045
  init() {
5044
- this.height = window.innerHeight >= (this.props.height ?? this.height) ? this.props.height ?? this.height : window.innerHeight;
5045
- this.width = window.innerWidth >= (this.props.width ?? this.width) ? this.props.width ?? this.width : window.innerWidth;
5046
- this.x = this.props.x ?? (window.innerWidth - (this.width ?? 300)) / 2;
5047
- this.y = this.props.y ?? (window.innerHeight - (this.height ?? 300)) / 2;
5046
+ po('window', window.innerWidth);
5047
+ if (this.props.width?.indexOf?.('%') > -1) {
5048
+ this.width = this.props.width.split('%')[0] * window.innerWidth / 100;
5049
+ } else {
5050
+ this.width = window.innerWidth >= (this.props.width ?? this.width) ? this.props.width ?? this.width : window.innerWidth;
5051
+ }
5052
+ this.x = this.props.x ?? (window.innerWidth - this.width) / 2;
5053
+ if (this.props.height?.indexOf?.('%') > -1) {
5054
+ this.height = this.props.height.split('%')[0] * window.innerHeight / 100;
5055
+ } else {
5056
+ this.height = window.innerHeight >= (this.props.height ?? this.height) ? this.props.height ?? this.height : window.innerHeight;
5057
+ }
5058
+ this.y = this.props.y ?? (window.innerHeight - this.height) / 2;
5048
5059
  }
5049
5060
  renderer() {
5050
- return this.props.popup === true ? this.props.open ? /*#__PURE__*/React__default["default"].createElement(StyledJRWindow
5051
-
5052
- // role="dialog"
5053
- // aria-labelledby="dialog1Title"
5054
- // aria-describedby="dialog1Desc"
5055
- , {
5061
+ return this.props.popup === true ? this.props.open ? /*#__PURE__*/React__default["default"].createElement(StyledJRWindow, {
5056
5062
  rule: 'dialog',
5057
5063
  ref: this.ref,
5058
5064
  className: `jr-window ${this.props.className ?? ''}`,
@@ -5066,8 +5072,9 @@ class JRWindow extends JRFrame {
5066
5072
  windowRef: this.ref,
5067
5073
  window: this,
5068
5074
  title: this.props.title,
5069
- thick: this.thick
5070
- }), /*#__PURE__*/React__default["default"].createElement("main", null, super.renderer())), /*#__PURE__*/React__default["default"].createElement(Sliders, {
5075
+ thick: this.thick,
5076
+ resizable: this.props.resizable
5077
+ }), /*#__PURE__*/React__default["default"].createElement("main", null, super.renderer())), this.props.resizable !== false && /*#__PURE__*/React__default["default"].createElement(Sliders, {
5071
5078
  thick: this.thick,
5072
5079
  windowRef: this.ref,
5073
5080
  window: this,
@@ -6481,7 +6488,7 @@ function JRAlertWindow({
6481
6488
  },
6482
6489
  width: 440,
6483
6490
  height: 180,
6484
- maskOn: 'play'
6491
+ maskOn: 'root'
6485
6492
  }, props, {
6486
6493
  open: open,
6487
6494
  setOpen: setOpen,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jrs-react",
3
- "version": "1.2.36",
3
+ "version": "1.2.37",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "module": "build/index.es.js",
@@ -30,7 +30,7 @@ function JRAlertWindow({title,message,container,...props}){
30
30
  initValue={{message}}
31
31
  width={440}
32
32
  height={180}
33
- maskOn={'play'}
33
+ maskOn={'root'}
34
34
  {...props}
35
35
  open={open}
36
36
  setOpen={setOpen}
@@ -15,7 +15,9 @@ export const FreeType=forwardRef(function({tag:Tag,config,me,className}, ref){
15
15
  }else if(config?.render){
16
16
  const content=config.render.bind(me)({setStyle})
17
17
  return <Tag className={className} style={style} ref={ref}>{content}</Tag>
18
- }else if(typeof config==='string'){
18
+ // }else if(typeof config==='string'){
19
+ // return <Tag className={className} ref={ref}>{config}</Tag>
20
+ }else{
19
21
  return <Tag className={className} ref={ref}>{config}</Tag>
20
22
  }
21
23
  })
@@ -21,7 +21,7 @@ z-index:1;
21
21
 
22
22
  top: ${({$y})=>$y}px;
23
23
  left: ${({$x})=>$x}px;
24
- width: ${({$width=300})=>`${$width}px`};
24
+ width: ${({$width=300})=>typeof $width === 'string'? '50%' : `${$width}px`};
25
25
  height: ${({$height=300})=>`${$height}px`};
26
26
  overflow: hidden;
27
27
 
@@ -120,21 +120,26 @@ export default class JRWindow extends JRFrame {
120
120
  }
121
121
  }
122
122
  init(){
123
- this.height=window.innerHeight>=(this.props.height??this.height)?(this.props.height??this.height):window.innerHeight
124
- this.width=window.innerWidth>=(this.props.width??this.width)?(this.props.width??this.width):window.innerWidth
125
- this.x=this.props.x??((window.innerWidth-(this.width??300))/2)
126
- this.y=this.props.y??(window.innerHeight-(this.height??300))/2
123
+ po('window',window.innerWidth)
124
+ if(this.props.width?.indexOf?.('%')>-1){
125
+ this.width=(this.props.width.split('%')[0]*window.innerWidth)/100
126
+ }else{
127
+ this.width=window.innerWidth>=(this.props.width??this.width)?(this.props.width??this.width):window.innerWidth
128
+ }
129
+ this.x=this.props.x??((window.innerWidth-(this.width))/2)
130
+
131
+ if(this.props.height?.indexOf?.('%')>-1){
132
+ this.height=(this.props.height.split('%')[0]*window.innerHeight)/100
133
+ }else{
134
+ this.height=window.innerHeight>=(this.props.height??this.height)?(this.props.height??this.height):window.innerHeight
135
+ }
136
+ this.y=this.props.y??(window.innerHeight-(this.height))/2
127
137
  }
128
138
 
129
139
  renderer(){
130
140
  return this.props.popup===true
131
141
  ?this.props.open
132
142
  ?<StyledJRWindow
133
-
134
- // role="dialog"
135
- // aria-labelledby="dialog1Title"
136
- // aria-describedby="dialog1Desc"
137
-
138
143
  rule={'dialog'}
139
144
  ref={this.ref}
140
145
  className={`jr-window ${this.props.className??''}`}
@@ -151,17 +156,20 @@ export default class JRWindow extends JRFrame {
151
156
  window={this}
152
157
  title={this.props.title}
153
158
  thick={this.thick}
159
+ resizable={this.props.resizable}
154
160
  />
155
161
  <main>
156
162
  {super.renderer()}
157
163
  </main>
158
164
  </main>
159
- <Sliders
160
- thick={this.thick}
161
- windowRef={this.ref}
162
- window={this}
163
- titleBarRef={this.titleBarRef}
164
- />
165
+ {this.props.resizable !== false
166
+ && <Sliders
167
+ thick={this.thick}
168
+ windowRef={this.ref}
169
+ window={this}
170
+ titleBarRef={this.titleBarRef}
171
+ />
172
+ }
165
173
  </StyledJRWindow>
166
174
  :''
167
175
  :super.renderer()
@@ -2,10 +2,8 @@ import styled from "styled-components";
2
2
  import { po } from "../JRUtils";
3
3
  import React from "react";
4
4
  import { FreeType } from "../JRFrame/JRFrame";
5
- import { IconX,IconCard, IconSquare, IconMinus } from "../../assets/icon";
6
- import { background } from "storybook/internal/theming";
5
+ import { IconX} from "../../assets/icon";
7
6
  import JRButton from "../JRInput/JRButton";
8
- import { browser } from "globals";
9
7
 
10
8
  const StyledTitle=styled.div`
11
9
  overflow: hidden;
@@ -137,7 +135,7 @@ export default class TitleBar extends React.Component{
137
135
  const {height:titleBarHeight}=this.props.titleBarRef.current.getBoundingClientRect()
138
136
  const {x,y,width,height}=this.props.windowRef.current.getBoundingClientRect()
139
137
 
140
- if(y<1-this.props.thick)this.fullScreen(e)
138
+ if(y<1-this.props.thick && this.props.resizable!=false)this.fullScreen(e)
141
139
  if(y>window.innerHeight-titleBarHeight)this.props.windowRef.current.style.top = `${window.innerHeight-titleBarHeight}px`
142
140
  if(x+width-this.props.thick<0)this.props.windowRef.current.style.left = 0
143
141
  if(x>window.innerWidth)this.props.windowRef.current.style.left = `${window.innerWidth-width}px`
@@ -221,7 +219,7 @@ export default class TitleBar extends React.Component{
221
219
  onMouseDown={(e)=>{
222
220
  this.start(e)
223
221
  }}
224
- onDoubleClick={this.adjustScreen}
222
+ onDoubleClick={this.props.resizable!=false?this.adjustScreen:null}
225
223
  >
226
224
  <FreeType tag='div' config={this.props.title??''} me={this.props.window} className={'title'}/>
227
225
  <nav>