jrs-react 1.2.40 → 1.2.41

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
@@ -4967,6 +4967,27 @@ const StyledJRWindow = styled.div`
4967
4967
  }
4968
4968
  }
4969
4969
  `;
4970
+ class Backdrop extends JRHTML {
4971
+ backdropConfig = {
4972
+ yo: 'div',
4973
+ style: {
4974
+ background: '#ff000029',
4975
+ height: '100%',
4976
+ width: '100%',
4977
+ position: 'absolute',
4978
+ top: 0,
4979
+ left: 0
4980
+ }
4981
+ };
4982
+ show() {
4983
+ this.backdrop = this.agregarHijo(this.backdropConfig);
4984
+ po('this.hijos', this.hijos);
4985
+ }
4986
+ hide() {
4987
+ this.yo.removeChild(this.yo.children[this.yo.children.length - 1]);
4988
+ this.hijos = [];
4989
+ }
4990
+ }
4970
4991
  class JRWindow extends JRFrame {
4971
4992
  // x=0
4972
4993
  // y=0
@@ -4978,7 +4999,20 @@ class JRWindow extends JRFrame {
4978
4999
  super(props);
4979
5000
  this.ref = /*#__PURE__*/React__default.createRef();
4980
5001
  this.titleBarRef = /*#__PURE__*/React__default.createRef();
4981
- // this.init()
5002
+ }
5003
+ createBackdrop() {
5004
+ if (typeof this.props.backdrop === 'string') {
5005
+ po('find and create backdrop', this.props.backdrop);
5006
+ const target = document.getElementById(this.props.backdrop);
5007
+ if (target) {
5008
+ this.backdropTarget = new Backdrop({
5009
+ yo: target,
5010
+ style: {
5011
+ position: 'relative'
5012
+ }
5013
+ });
5014
+ }
5015
+ }
4982
5016
  }
4983
5017
  addMaskToTarget = target => {
4984
5018
  this.mask = document.createElement('div');
@@ -5008,8 +5042,10 @@ class JRWindow extends JRFrame {
5008
5042
 
5009
5043
  componentDidMount() {
5010
5044
  super.componentDidMount();
5045
+ po('-------------------------componentDidMount-------------------------');
5046
+ this.createBackdrop();
5011
5047
  // if(this.props.backdrop && this.props.open){
5012
- // this.backdropOn(this.props.open)
5048
+ // this.backdropTarget.show()
5013
5049
  // }
5014
5050
 
5015
5051
  if (this.props.open) {
@@ -5017,9 +5053,11 @@ class JRWindow extends JRFrame {
5017
5053
  }
5018
5054
  }
5019
5055
  open() {
5056
+ this.backdropTarget.show();
5020
5057
  this.props.onOpen?.bind(this)();
5021
5058
  }
5022
5059
  close() {
5060
+ this.backdropTarget.hide();
5023
5061
  this.props.onClose?.bind(this)();
5024
5062
  }
5025
5063
  componentDidUpdate(prevProps, prevState, snapshot) {
@@ -5083,7 +5121,7 @@ class JRWindow extends JRFrame {
5083
5121
  windowRef: this.ref,
5084
5122
  window: this,
5085
5123
  titleBarRef: this.titleBarRef
5086
- })), this.props.backdrop !== false && /*#__PURE__*/React__default.createElement(StyledBackdrop, {
5124
+ })), this.props.backdrop !== false && typeof this.props.backdrop !== 'string' && /*#__PURE__*/React__default.createElement(StyledBackdrop, {
5087
5125
  $zIndex: this.props.zIndex
5088
5126
  }))) : '' : super.renderer();
5089
5127
  }
package/build/index.js CHANGED
@@ -4994,6 +4994,27 @@ const StyledJRWindow = styled__default["default"].div`
4994
4994
  }
4995
4995
  }
4996
4996
  `;
4997
+ class Backdrop extends JRHTML {
4998
+ backdropConfig = {
4999
+ yo: 'div',
5000
+ style: {
5001
+ background: '#ff000029',
5002
+ height: '100%',
5003
+ width: '100%',
5004
+ position: 'absolute',
5005
+ top: 0,
5006
+ left: 0
5007
+ }
5008
+ };
5009
+ show() {
5010
+ this.backdrop = this.agregarHijo(this.backdropConfig);
5011
+ po('this.hijos', this.hijos);
5012
+ }
5013
+ hide() {
5014
+ this.yo.removeChild(this.yo.children[this.yo.children.length - 1]);
5015
+ this.hijos = [];
5016
+ }
5017
+ }
4997
5018
  class JRWindow extends JRFrame {
4998
5019
  // x=0
4999
5020
  // y=0
@@ -5005,7 +5026,20 @@ class JRWindow extends JRFrame {
5005
5026
  super(props);
5006
5027
  this.ref = /*#__PURE__*/React__default["default"].createRef();
5007
5028
  this.titleBarRef = /*#__PURE__*/React__default["default"].createRef();
5008
- // this.init()
5029
+ }
5030
+ createBackdrop() {
5031
+ if (typeof this.props.backdrop === 'string') {
5032
+ po('find and create backdrop', this.props.backdrop);
5033
+ const target = document.getElementById(this.props.backdrop);
5034
+ if (target) {
5035
+ this.backdropTarget = new Backdrop({
5036
+ yo: target,
5037
+ style: {
5038
+ position: 'relative'
5039
+ }
5040
+ });
5041
+ }
5042
+ }
5009
5043
  }
5010
5044
  addMaskToTarget = target => {
5011
5045
  this.mask = document.createElement('div');
@@ -5035,8 +5069,10 @@ class JRWindow extends JRFrame {
5035
5069
 
5036
5070
  componentDidMount() {
5037
5071
  super.componentDidMount();
5072
+ po('-------------------------componentDidMount-------------------------');
5073
+ this.createBackdrop();
5038
5074
  // if(this.props.backdrop && this.props.open){
5039
- // this.backdropOn(this.props.open)
5075
+ // this.backdropTarget.show()
5040
5076
  // }
5041
5077
 
5042
5078
  if (this.props.open) {
@@ -5044,9 +5080,11 @@ class JRWindow extends JRFrame {
5044
5080
  }
5045
5081
  }
5046
5082
  open() {
5083
+ this.backdropTarget.show();
5047
5084
  this.props.onOpen?.bind(this)();
5048
5085
  }
5049
5086
  close() {
5087
+ this.backdropTarget.hide();
5050
5088
  this.props.onClose?.bind(this)();
5051
5089
  }
5052
5090
  componentDidUpdate(prevProps, prevState, snapshot) {
@@ -5110,7 +5148,7 @@ class JRWindow extends JRFrame {
5110
5148
  windowRef: this.ref,
5111
5149
  window: this,
5112
5150
  titleBarRef: this.titleBarRef
5113
- })), this.props.backdrop !== false && /*#__PURE__*/React__default["default"].createElement(StyledBackdrop, {
5151
+ })), this.props.backdrop !== false && typeof this.props.backdrop !== 'string' && /*#__PURE__*/React__default["default"].createElement(StyledBackdrop, {
5114
5152
  $zIndex: this.props.zIndex
5115
5153
  }))) : '' : super.renderer();
5116
5154
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jrs-react",
3
- "version": "1.2.40",
3
+ "version": "1.2.41",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "module": "build/index.es.js",
@@ -5,6 +5,8 @@ import TitleBar from "./TitleBar";
5
5
  import { po } from "../JRUtils";
6
6
  import Sliders from "./Slider";
7
7
  import style from './Style.module.css'
8
+ import { JRHTML } from "jrs-js";
9
+ import { background } from "storybook/internal/theming";
8
10
 
9
11
  const StyledBackdrop=styled.div`
10
12
  ${({$zIndex})=>$zIndex!=null?`z-index:${$zIndex};`:null}
@@ -56,6 +58,29 @@ const StyledJRWindow=styled.div`
56
58
  }
57
59
  `
58
60
 
61
+ class Backdrop extends JRHTML{
62
+ backdropConfig={
63
+ yo:'div'
64
+ ,style:{
65
+ background:'#ff000029'
66
+ ,height: '100%'
67
+ ,width: '100%'
68
+ ,position: 'absolute'
69
+ ,top: 0
70
+ ,left: 0
71
+ }
72
+ }
73
+
74
+ show(){
75
+ this.backdrop=this.agregarHijo(this.backdropConfig)
76
+ po('this.hijos',this.hijos)
77
+ }
78
+ hide(){
79
+ this.yo.removeChild(this.yo.children[this.yo.children.length-1])
80
+ this.hijos=[]
81
+ }
82
+ }
83
+
59
84
  export default class JRWindow extends JRFrame {
60
85
  // x=0
61
86
  // y=0
@@ -68,7 +93,23 @@ export default class JRWindow extends JRFrame {
68
93
  super(props)
69
94
  this.ref=React.createRef()
70
95
  this.titleBarRef=React.createRef()
71
- // this.init()
96
+ }
97
+
98
+ createBackdrop(){
99
+ if(typeof this.props.backdrop === 'string'){
100
+ po('find and create backdrop',this.props.backdrop)
101
+ const target=document.getElementById(this.props.backdrop)
102
+ if(target){
103
+ this.backdropTarget=new Backdrop({
104
+ yo:target
105
+ ,style:{
106
+ position: 'relative'
107
+ }
108
+ })
109
+
110
+ }
111
+
112
+ }
72
113
  }
73
114
 
74
115
  addMaskToTarget=(target)=>{
@@ -99,8 +140,10 @@ export default class JRWindow extends JRFrame {
99
140
 
100
141
  componentDidMount(){
101
142
  super.componentDidMount()
143
+ po('-------------------------componentDidMount-------------------------')
144
+ this.createBackdrop()
102
145
  // if(this.props.backdrop && this.props.open){
103
- // this.backdropOn(this.props.open)
146
+ // this.backdropTarget.show()
104
147
  // }
105
148
 
106
149
  if(this.props.open){
@@ -109,9 +152,11 @@ export default class JRWindow extends JRFrame {
109
152
  }
110
153
 
111
154
  open(){
155
+ this.backdropTarget.show()
112
156
  this.props.onOpen?.bind(this)()
113
157
  }
114
158
  close(){
159
+ this.backdropTarget.hide()
115
160
  this.props.onClose?.bind(this)()
116
161
  }
117
162
 
@@ -188,7 +233,7 @@ export default class JRWindow extends JRFrame {
188
233
  />
189
234
  }
190
235
  </main>
191
- {this.props.backdrop!==false && <StyledBackdrop $zIndex={this.props.zIndex}/>}
236
+ {this.props.backdrop!==false && typeof this.props.backdrop!=='string' && <StyledBackdrop $zIndex={this.props.zIndex}/>}
192
237
  </StyledJRWindow>
193
238
  </>
194
239
  :''