jrs-react 1.2.36 → 1.2.38
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
|
-
|
|
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 ?? '',
|
|
@@ -4904,7 +4906,7 @@ var css_248z = ".Style-module_test__LrdEc{border:1px solid red;color:red}.Style-
|
|
|
4904
4906
|
styleInject(css_248z);
|
|
4905
4907
|
|
|
4906
4908
|
const StyledJRWindow = styled.div`
|
|
4907
|
-
z-index:1;
|
|
4909
|
+
z-index:1;
|
|
4908
4910
|
|
|
4909
4911
|
--jr-window-radius:3px;
|
|
4910
4912
|
--padding-child:8px;
|
|
@@ -4917,18 +4919,22 @@ z-index:1;
|
|
|
4917
4919
|
border-radius: var(--jr-window-radius);
|
|
4918
4920
|
user-select: text;
|
|
4919
4921
|
|
|
4920
|
-
top: ${({
|
|
4921
|
-
$y
|
|
4922
|
-
}) => $y}px;
|
|
4923
4922
|
left: ${({
|
|
4924
|
-
$
|
|
4925
|
-
}) => $x}px;
|
|
4923
|
+
$xw
|
|
4924
|
+
}) => $xw.x}px;
|
|
4926
4925
|
width: ${({
|
|
4927
|
-
$
|
|
4928
|
-
}) =>
|
|
4926
|
+
$xw
|
|
4927
|
+
}) => $xw.width}px;
|
|
4928
|
+
top: ${({
|
|
4929
|
+
$yh
|
|
4930
|
+
}) => $yh.y}px;
|
|
4929
4931
|
height: ${({
|
|
4930
|
-
$
|
|
4931
|
-
}) =>
|
|
4932
|
+
$yh
|
|
4933
|
+
}) => $yh.height}px;
|
|
4934
|
+
|
|
4935
|
+
xxxwidth: ${({
|
|
4936
|
+
$width = 300
|
|
4937
|
+
}) => typeof $width === 'string' ? '50%' : `${$width}px`};
|
|
4932
4938
|
overflow: hidden;
|
|
4933
4939
|
|
|
4934
4940
|
display: flex;
|
|
@@ -4952,17 +4958,17 @@ z-index:1;
|
|
|
4952
4958
|
}
|
|
4953
4959
|
`;
|
|
4954
4960
|
class JRWindow extends JRFrame {
|
|
4955
|
-
x
|
|
4956
|
-
y
|
|
4957
|
-
width
|
|
4958
|
-
height
|
|
4961
|
+
// x=0
|
|
4962
|
+
// y=0
|
|
4963
|
+
// width=300
|
|
4964
|
+
// height=300
|
|
4959
4965
|
padding = 1;
|
|
4960
4966
|
thick = 5;
|
|
4961
4967
|
constructor(props) {
|
|
4962
4968
|
super(props);
|
|
4963
4969
|
this.ref = /*#__PURE__*/React__default.createRef();
|
|
4964
4970
|
this.titleBarRef = /*#__PURE__*/React__default.createRef();
|
|
4965
|
-
this.init()
|
|
4971
|
+
// this.init()
|
|
4966
4972
|
}
|
|
4967
4973
|
addMaskToTarget = target => {
|
|
4968
4974
|
this.mask = document.createElement('div');
|
|
@@ -4982,8 +4988,6 @@ class JRWindow extends JRFrame {
|
|
|
4982
4988
|
};
|
|
4983
4989
|
backdropOn(on) {
|
|
4984
4990
|
const target = typeof this.props.backdrop === 'object' ? this.props.backdrop : typeof this.props.backdrop === 'string' ? document.getElementById(this.props.backdrop) : document.body;
|
|
4985
|
-
|
|
4986
|
-
// this[on?'addMaskToTarget':'removeMaskFromTarget'](target)
|
|
4987
4991
|
target?.classList[on ? 'add' : 'remove']('withMask');
|
|
4988
4992
|
}
|
|
4989
4993
|
componentDidMount() {
|
|
@@ -4999,6 +5003,7 @@ class JRWindow extends JRFrame {
|
|
|
4999
5003
|
this.props.onOpen?.bind(this)();
|
|
5000
5004
|
}
|
|
5001
5005
|
close() {
|
|
5006
|
+
// this.init()
|
|
5002
5007
|
this.props.onClose?.bind(this)();
|
|
5003
5008
|
}
|
|
5004
5009
|
componentDidUpdate(prevProps, prevState, snapshot) {
|
|
@@ -5013,34 +5018,64 @@ class JRWindow extends JRFrame {
|
|
|
5013
5018
|
}
|
|
5014
5019
|
}
|
|
5015
5020
|
}
|
|
5016
|
-
init()
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
+
// init(){
|
|
5022
|
+
// if(this.props.width?.indexOf?.('%')>-1){
|
|
5023
|
+
// this.width=(this.props.width.split('%')[0]*window.innerWidth)/100
|
|
5024
|
+
// }else{
|
|
5025
|
+
// this.width=window.innerWidth>=(this.props.width??this.width)?(this.props.width??this.width):window.innerWidth
|
|
5026
|
+
// }
|
|
5027
|
+
// this.x=this.props.x??((window.innerWidth-(this.width))/2)
|
|
5028
|
+
|
|
5029
|
+
// if(this.props.height?.indexOf?.('%')>-1){
|
|
5030
|
+
// this.height=(this.props.height.split('%')[0]*window.innerHeight)/100
|
|
5031
|
+
// }else{
|
|
5032
|
+
// this.height=window.innerHeight>=(this.props.height??this.height)?(this.props.height??this.height):window.innerHeight
|
|
5033
|
+
// }
|
|
5034
|
+
// this.y=this.props.y??(window.innerHeight-(this.height))/2
|
|
5035
|
+
// }
|
|
5036
|
+
|
|
5037
|
+
get xw() {
|
|
5038
|
+
let width;
|
|
5039
|
+
if (this.props.width?.indexOf?.('%') > -1) {
|
|
5040
|
+
width = this.props.width.split('%')[0] * window.innerWidth / 100;
|
|
5041
|
+
} else {
|
|
5042
|
+
width = window.innerWidth >= (this.props.width ?? width) ? this.props.width ?? width : window.innerWidth;
|
|
5043
|
+
}
|
|
5044
|
+
return {
|
|
5045
|
+
x: this.props.x ?? (window.innerWidth - width) / 2,
|
|
5046
|
+
width
|
|
5047
|
+
};
|
|
5048
|
+
}
|
|
5049
|
+
get yh() {
|
|
5050
|
+
let height;
|
|
5051
|
+
if (this.props.height?.indexOf?.('%') > -1) {
|
|
5052
|
+
height = this.props.height.split('%')[0] * window.innerHeight / 100;
|
|
5053
|
+
} else {
|
|
5054
|
+
height = window.innerHeight >= (this.props.height ?? height) ? this.props.height ?? height : window.innerHeight;
|
|
5055
|
+
}
|
|
5056
|
+
return {
|
|
5057
|
+
y: this.props.y ?? (window.innerHeight - height) / 2,
|
|
5058
|
+
height
|
|
5059
|
+
};
|
|
5021
5060
|
}
|
|
5022
5061
|
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
|
-
, {
|
|
5062
|
+
return this.props.popup === true ? this.props.open ? /*#__PURE__*/React__default.createElement(StyledJRWindow, {
|
|
5029
5063
|
rule: 'dialog',
|
|
5030
5064
|
ref: this.ref,
|
|
5031
5065
|
className: `jr-window ${this.props.className ?? ''}`,
|
|
5032
|
-
$
|
|
5033
|
-
$
|
|
5034
|
-
$width: this.width,
|
|
5035
|
-
$height: this.height,
|
|
5066
|
+
$xw: this.xw,
|
|
5067
|
+
$yh: this.yh,
|
|
5036
5068
|
$thick: this.thick
|
|
5069
|
+
// $width={this.width}
|
|
5070
|
+
// $height={this.height}
|
|
5037
5071
|
}, /*#__PURE__*/React__default.createElement("main", null, /*#__PURE__*/React__default.createElement(TitleBar, {
|
|
5038
5072
|
titleBarRef: this.titleBarRef,
|
|
5039
5073
|
windowRef: this.ref,
|
|
5040
5074
|
window: this,
|
|
5041
5075
|
title: this.props.title,
|
|
5042
|
-
thick: this.thick
|
|
5043
|
-
|
|
5076
|
+
thick: this.thick,
|
|
5077
|
+
resizable: this.props.resizable
|
|
5078
|
+
}), /*#__PURE__*/React__default.createElement("main", null, super.renderer())), this.props.resizable !== false && /*#__PURE__*/React__default.createElement(Sliders, {
|
|
5044
5079
|
thick: this.thick,
|
|
5045
5080
|
windowRef: this.ref,
|
|
5046
5081
|
window: this,
|
|
@@ -6454,7 +6489,7 @@ function JRAlertWindow({
|
|
|
6454
6489
|
},
|
|
6455
6490
|
width: 440,
|
|
6456
6491
|
height: 180,
|
|
6457
|
-
maskOn: '
|
|
6492
|
+
maskOn: 'root'
|
|
6458
6493
|
}, props, {
|
|
6459
6494
|
open: open,
|
|
6460
6495
|
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
|
-
|
|
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 ?? '',
|
|
@@ -4931,7 +4933,7 @@ var css_248z = ".Style-module_test__LrdEc{border:1px solid red;color:red}.Style-
|
|
|
4931
4933
|
styleInject(css_248z);
|
|
4932
4934
|
|
|
4933
4935
|
const StyledJRWindow = styled__default["default"].div`
|
|
4934
|
-
z-index:1;
|
|
4936
|
+
z-index:1;
|
|
4935
4937
|
|
|
4936
4938
|
--jr-window-radius:3px;
|
|
4937
4939
|
--padding-child:8px;
|
|
@@ -4944,18 +4946,22 @@ z-index:1;
|
|
|
4944
4946
|
border-radius: var(--jr-window-radius);
|
|
4945
4947
|
user-select: text;
|
|
4946
4948
|
|
|
4947
|
-
top: ${({
|
|
4948
|
-
$y
|
|
4949
|
-
}) => $y}px;
|
|
4950
4949
|
left: ${({
|
|
4951
|
-
$
|
|
4952
|
-
}) => $x}px;
|
|
4950
|
+
$xw
|
|
4951
|
+
}) => $xw.x}px;
|
|
4953
4952
|
width: ${({
|
|
4954
|
-
$
|
|
4955
|
-
}) =>
|
|
4953
|
+
$xw
|
|
4954
|
+
}) => $xw.width}px;
|
|
4955
|
+
top: ${({
|
|
4956
|
+
$yh
|
|
4957
|
+
}) => $yh.y}px;
|
|
4956
4958
|
height: ${({
|
|
4957
|
-
$
|
|
4958
|
-
}) =>
|
|
4959
|
+
$yh
|
|
4960
|
+
}) => $yh.height}px;
|
|
4961
|
+
|
|
4962
|
+
xxxwidth: ${({
|
|
4963
|
+
$width = 300
|
|
4964
|
+
}) => typeof $width === 'string' ? '50%' : `${$width}px`};
|
|
4959
4965
|
overflow: hidden;
|
|
4960
4966
|
|
|
4961
4967
|
display: flex;
|
|
@@ -4979,17 +4985,17 @@ z-index:1;
|
|
|
4979
4985
|
}
|
|
4980
4986
|
`;
|
|
4981
4987
|
class JRWindow extends JRFrame {
|
|
4982
|
-
x
|
|
4983
|
-
y
|
|
4984
|
-
width
|
|
4985
|
-
height
|
|
4988
|
+
// x=0
|
|
4989
|
+
// y=0
|
|
4990
|
+
// width=300
|
|
4991
|
+
// height=300
|
|
4986
4992
|
padding = 1;
|
|
4987
4993
|
thick = 5;
|
|
4988
4994
|
constructor(props) {
|
|
4989
4995
|
super(props);
|
|
4990
4996
|
this.ref = /*#__PURE__*/React__default["default"].createRef();
|
|
4991
4997
|
this.titleBarRef = /*#__PURE__*/React__default["default"].createRef();
|
|
4992
|
-
this.init()
|
|
4998
|
+
// this.init()
|
|
4993
4999
|
}
|
|
4994
5000
|
addMaskToTarget = target => {
|
|
4995
5001
|
this.mask = document.createElement('div');
|
|
@@ -5009,8 +5015,6 @@ class JRWindow extends JRFrame {
|
|
|
5009
5015
|
};
|
|
5010
5016
|
backdropOn(on) {
|
|
5011
5017
|
const target = typeof this.props.backdrop === 'object' ? this.props.backdrop : typeof this.props.backdrop === 'string' ? document.getElementById(this.props.backdrop) : document.body;
|
|
5012
|
-
|
|
5013
|
-
// this[on?'addMaskToTarget':'removeMaskFromTarget'](target)
|
|
5014
5018
|
target?.classList[on ? 'add' : 'remove']('withMask');
|
|
5015
5019
|
}
|
|
5016
5020
|
componentDidMount() {
|
|
@@ -5026,6 +5030,7 @@ class JRWindow extends JRFrame {
|
|
|
5026
5030
|
this.props.onOpen?.bind(this)();
|
|
5027
5031
|
}
|
|
5028
5032
|
close() {
|
|
5033
|
+
// this.init()
|
|
5029
5034
|
this.props.onClose?.bind(this)();
|
|
5030
5035
|
}
|
|
5031
5036
|
componentDidUpdate(prevProps, prevState, snapshot) {
|
|
@@ -5040,34 +5045,64 @@ class JRWindow extends JRFrame {
|
|
|
5040
5045
|
}
|
|
5041
5046
|
}
|
|
5042
5047
|
}
|
|
5043
|
-
init()
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5048
|
+
// init(){
|
|
5049
|
+
// if(this.props.width?.indexOf?.('%')>-1){
|
|
5050
|
+
// this.width=(this.props.width.split('%')[0]*window.innerWidth)/100
|
|
5051
|
+
// }else{
|
|
5052
|
+
// this.width=window.innerWidth>=(this.props.width??this.width)?(this.props.width??this.width):window.innerWidth
|
|
5053
|
+
// }
|
|
5054
|
+
// this.x=this.props.x??((window.innerWidth-(this.width))/2)
|
|
5055
|
+
|
|
5056
|
+
// if(this.props.height?.indexOf?.('%')>-1){
|
|
5057
|
+
// this.height=(this.props.height.split('%')[0]*window.innerHeight)/100
|
|
5058
|
+
// }else{
|
|
5059
|
+
// this.height=window.innerHeight>=(this.props.height??this.height)?(this.props.height??this.height):window.innerHeight
|
|
5060
|
+
// }
|
|
5061
|
+
// this.y=this.props.y??(window.innerHeight-(this.height))/2
|
|
5062
|
+
// }
|
|
5063
|
+
|
|
5064
|
+
get xw() {
|
|
5065
|
+
let width;
|
|
5066
|
+
if (this.props.width?.indexOf?.('%') > -1) {
|
|
5067
|
+
width = this.props.width.split('%')[0] * window.innerWidth / 100;
|
|
5068
|
+
} else {
|
|
5069
|
+
width = window.innerWidth >= (this.props.width ?? width) ? this.props.width ?? width : window.innerWidth;
|
|
5070
|
+
}
|
|
5071
|
+
return {
|
|
5072
|
+
x: this.props.x ?? (window.innerWidth - width) / 2,
|
|
5073
|
+
width
|
|
5074
|
+
};
|
|
5075
|
+
}
|
|
5076
|
+
get yh() {
|
|
5077
|
+
let height;
|
|
5078
|
+
if (this.props.height?.indexOf?.('%') > -1) {
|
|
5079
|
+
height = this.props.height.split('%')[0] * window.innerHeight / 100;
|
|
5080
|
+
} else {
|
|
5081
|
+
height = window.innerHeight >= (this.props.height ?? height) ? this.props.height ?? height : window.innerHeight;
|
|
5082
|
+
}
|
|
5083
|
+
return {
|
|
5084
|
+
y: this.props.y ?? (window.innerHeight - height) / 2,
|
|
5085
|
+
height
|
|
5086
|
+
};
|
|
5048
5087
|
}
|
|
5049
5088
|
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
|
-
, {
|
|
5089
|
+
return this.props.popup === true ? this.props.open ? /*#__PURE__*/React__default["default"].createElement(StyledJRWindow, {
|
|
5056
5090
|
rule: 'dialog',
|
|
5057
5091
|
ref: this.ref,
|
|
5058
5092
|
className: `jr-window ${this.props.className ?? ''}`,
|
|
5059
|
-
$
|
|
5060
|
-
$
|
|
5061
|
-
$width: this.width,
|
|
5062
|
-
$height: this.height,
|
|
5093
|
+
$xw: this.xw,
|
|
5094
|
+
$yh: this.yh,
|
|
5063
5095
|
$thick: this.thick
|
|
5096
|
+
// $width={this.width}
|
|
5097
|
+
// $height={this.height}
|
|
5064
5098
|
}, /*#__PURE__*/React__default["default"].createElement("main", null, /*#__PURE__*/React__default["default"].createElement(TitleBar, {
|
|
5065
5099
|
titleBarRef: this.titleBarRef,
|
|
5066
5100
|
windowRef: this.ref,
|
|
5067
5101
|
window: this,
|
|
5068
5102
|
title: this.props.title,
|
|
5069
|
-
thick: this.thick
|
|
5070
|
-
|
|
5103
|
+
thick: this.thick,
|
|
5104
|
+
resizable: this.props.resizable
|
|
5105
|
+
}), /*#__PURE__*/React__default["default"].createElement("main", null, super.renderer())), this.props.resizable !== false && /*#__PURE__*/React__default["default"].createElement(Sliders, {
|
|
5071
5106
|
thick: this.thick,
|
|
5072
5107
|
windowRef: this.ref,
|
|
5073
5108
|
window: this,
|
|
@@ -6481,7 +6516,7 @@ function JRAlertWindow({
|
|
|
6481
6516
|
},
|
|
6482
6517
|
width: 440,
|
|
6483
6518
|
height: 180,
|
|
6484
|
-
maskOn: '
|
|
6519
|
+
maskOn: 'root'
|
|
6485
6520
|
}, props, {
|
|
6486
6521
|
open: open,
|
|
6487
6522
|
setOpen: setOpen,
|
package/package.json
CHANGED
|
@@ -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
|
})
|
|
@@ -8,7 +8,7 @@ import style from './Style.module.css'
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
const StyledJRWindow=styled.div`
|
|
11
|
-
z-index:1;
|
|
11
|
+
z-index:1;
|
|
12
12
|
|
|
13
13
|
--jr-window-radius:3px;
|
|
14
14
|
--padding-child:8px;
|
|
@@ -19,10 +19,12 @@ z-index:1;
|
|
|
19
19
|
border-radius: var(--jr-window-radius);
|
|
20
20
|
user-select: text;
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
height: ${({$
|
|
22
|
+
left: ${({$xw})=>$xw.x}px;
|
|
23
|
+
width: ${({$xw})=>$xw.width}px;
|
|
24
|
+
top: ${({$yh})=>$yh.y}px;
|
|
25
|
+
height: ${({$yh})=>$yh.height}px;
|
|
26
|
+
|
|
27
|
+
xxxwidth: ${({$width=300})=>typeof $width === 'string'? '50%' : `${$width}px`};
|
|
26
28
|
overflow: hidden;
|
|
27
29
|
|
|
28
30
|
display: flex;
|
|
@@ -47,10 +49,10 @@ z-index:1;
|
|
|
47
49
|
`
|
|
48
50
|
|
|
49
51
|
export default class JRWindow extends JRFrame {
|
|
50
|
-
x=0
|
|
51
|
-
y=0
|
|
52
|
-
width=300
|
|
53
|
-
height=300
|
|
52
|
+
// x=0
|
|
53
|
+
// y=0
|
|
54
|
+
// width=300
|
|
55
|
+
// height=300
|
|
54
56
|
padding=1
|
|
55
57
|
thick=5
|
|
56
58
|
|
|
@@ -58,7 +60,7 @@ export default class JRWindow extends JRFrame {
|
|
|
58
60
|
super(props)
|
|
59
61
|
this.ref=React.createRef()
|
|
60
62
|
this.titleBarRef=React.createRef()
|
|
61
|
-
this.init()
|
|
63
|
+
// this.init()
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
addMaskToTarget=(target)=>{
|
|
@@ -84,8 +86,6 @@ export default class JRWindow extends JRFrame {
|
|
|
84
86
|
:typeof this.props.backdrop ==='string'
|
|
85
87
|
?document.getElementById(this.props.backdrop)
|
|
86
88
|
:document.body
|
|
87
|
-
|
|
88
|
-
// this[on?'addMaskToTarget':'removeMaskFromTarget'](target)
|
|
89
89
|
target?.classList[on?'add':'remove']('withMask')
|
|
90
90
|
}
|
|
91
91
|
|
|
@@ -104,6 +104,7 @@ export default class JRWindow extends JRFrame {
|
|
|
104
104
|
this.props.onOpen?.bind(this)()
|
|
105
105
|
}
|
|
106
106
|
close(){
|
|
107
|
+
// this.init()
|
|
107
108
|
this.props.onClose?.bind(this)()
|
|
108
109
|
}
|
|
109
110
|
|
|
@@ -119,30 +120,60 @@ export default class JRWindow extends JRFrame {
|
|
|
119
120
|
}
|
|
120
121
|
}
|
|
121
122
|
}
|
|
122
|
-
init(){
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
123
|
+
// init(){
|
|
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
|
|
137
|
+
// }
|
|
138
|
+
|
|
139
|
+
get xw(){
|
|
140
|
+
let width
|
|
141
|
+
if(this.props.width?.indexOf?.('%')>-1){
|
|
142
|
+
width=(this.props.width.split('%')[0]*window.innerWidth)/100
|
|
143
|
+
}else{
|
|
144
|
+
width=window.innerWidth>=(this.props.width??width)?(this.props.width??width):window.innerWidth
|
|
145
|
+
}
|
|
146
|
+
return {
|
|
147
|
+
x:this.props.x??((window.innerWidth-(width))/2)
|
|
148
|
+
,width
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
get yh(){
|
|
153
|
+
let height
|
|
154
|
+
if(this.props.height?.indexOf?.('%')>-1){
|
|
155
|
+
height=(this.props.height.split('%')[0]*window.innerHeight)/100
|
|
156
|
+
}else{
|
|
157
|
+
height=window.innerHeight>=(this.props.height??height)?(this.props.height??height):window.innerHeight
|
|
158
|
+
}
|
|
159
|
+
return {
|
|
160
|
+
y:this.props.y??(window.innerHeight-(height))/2
|
|
161
|
+
,height
|
|
162
|
+
}
|
|
127
163
|
}
|
|
128
164
|
|
|
129
165
|
renderer(){
|
|
130
166
|
return this.props.popup===true
|
|
131
167
|
?this.props.open
|
|
132
168
|
?<StyledJRWindow
|
|
133
|
-
|
|
134
|
-
// role="dialog"
|
|
135
|
-
// aria-labelledby="dialog1Title"
|
|
136
|
-
// aria-describedby="dialog1Desc"
|
|
137
|
-
|
|
138
169
|
rule={'dialog'}
|
|
139
170
|
ref={this.ref}
|
|
140
171
|
className={`jr-window ${this.props.className??''}`}
|
|
141
|
-
$
|
|
142
|
-
$
|
|
143
|
-
$width={this.width}
|
|
144
|
-
$height={this.height}
|
|
172
|
+
$xw={this.xw}
|
|
173
|
+
$yh={this.yh}
|
|
145
174
|
$thick={this.thick}
|
|
175
|
+
// $width={this.width}
|
|
176
|
+
// $height={this.height}
|
|
146
177
|
>
|
|
147
178
|
<main>
|
|
148
179
|
<TitleBar
|
|
@@ -151,17 +182,20 @@ export default class JRWindow extends JRFrame {
|
|
|
151
182
|
window={this}
|
|
152
183
|
title={this.props.title}
|
|
153
184
|
thick={this.thick}
|
|
185
|
+
resizable={this.props.resizable}
|
|
154
186
|
/>
|
|
155
187
|
<main>
|
|
156
188
|
{super.renderer()}
|
|
157
189
|
</main>
|
|
158
190
|
</main>
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
191
|
+
{this.props.resizable !== false
|
|
192
|
+
&& <Sliders
|
|
193
|
+
thick={this.thick}
|
|
194
|
+
windowRef={this.ref}
|
|
195
|
+
window={this}
|
|
196
|
+
titleBarRef={this.titleBarRef}
|
|
197
|
+
/>
|
|
198
|
+
}
|
|
165
199
|
</StyledJRWindow>
|
|
166
200
|
:''
|
|
167
201
|
: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
|
|
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>
|