jrs-react 1.2.47 → 1.2.49
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/Readme.txt +7 -0
- package/build/index.es.js +3295 -3287
- package/build/index.js +3295 -3287
- package/package.json +61 -61
- package/src/assets/icon/card.svg +14 -14
- package/src/assets/icon/copy.svg +14 -14
- package/src/assets/icon/minus.svg +13 -13
- package/src/assets/icon/square.svg +13 -13
- package/src/assets/icon/x.svg +14 -14
- package/src/components/JRFields/JRFields.jsx +1 -0
- package/src/components/JRFrame/Slider.jsx +8 -0
- package/src/components/JRSubmit.jsx +7 -8
- package/src/components/JRWindow/JRWindow.jsx +121 -107
- package/src/components/JRWindow/TitleBar.jsx +2 -4
- package/src/main.jsx +10 -10
package/package.json
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "jrs-react",
|
|
3
|
-
"version": "1.2.
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "build/index.js",
|
|
6
|
-
"module": "build/index.es.js",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
|
-
"build": "rollup -c",
|
|
10
|
-
"storybook": "storybook dev -p 6006",
|
|
11
|
-
"build-storybook": "storybook build",
|
|
12
|
-
"vite": "vite"
|
|
13
|
-
},
|
|
14
|
-
"author": "JorenLai",
|
|
15
|
-
"license": "MIT",
|
|
16
|
-
"dependencies": {
|
|
17
|
-
"@rollup/plugin-commonjs": "^28.0.3",
|
|
18
|
-
"@rollup/plugin-json": "^6.1.0",
|
|
19
|
-
"@types/react": "^19.0.10",
|
|
20
|
-
"@types/react-dom": "^19.0.4",
|
|
21
|
-
"@vitejs/plugin-react": "^4.3.4",
|
|
22
|
-
"antd": "^5.12.5",
|
|
23
|
-
"axios": "^1.6.2",
|
|
24
|
-
"create-react-class": "^15.7.0",
|
|
25
|
-
"globals": "^15.15.0",
|
|
26
|
-
"jrs-js": "^0.0.0",
|
|
27
|
-
"react": "^18.2.0",
|
|
28
|
-
"react-dom": "^18.2.0",
|
|
29
|
-
"react-router-dom": "^7.4.0",
|
|
30
|
-
"styled-components": "^6.1.15",
|
|
31
|
-
"vite": "^6.2.0",
|
|
32
|
-
"vite-plugin-svgr": "^4.3.0"
|
|
33
|
-
},
|
|
34
|
-
"peerDependencies": {
|
|
35
|
-
"react": "^18.2.0",
|
|
36
|
-
"react-dom": "^18.2.0"
|
|
37
|
-
},
|
|
38
|
-
"devDependencies": {
|
|
39
|
-
"@babel/core": "^7.26.10",
|
|
40
|
-
"@chromatic-com/storybook": "^3.2.6",
|
|
41
|
-
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
42
|
-
"@storybook/addon-essentials": "^8.6.6",
|
|
43
|
-
"@storybook/addon-onboarding": "^8.6.6",
|
|
44
|
-
"@storybook/blocks": "^8.6.6",
|
|
45
|
-
"@storybook/experimental-addon-test": "^8.6.6",
|
|
46
|
-
"@storybook/react": "^8.6.6",
|
|
47
|
-
"@storybook/react-vite": "^8.6.6",
|
|
48
|
-
"@storybook/test": "^8.6.6",
|
|
49
|
-
"@svgr/rollup": "^8.1.0",
|
|
50
|
-
"@vitest/browser": "^3.0.8",
|
|
51
|
-
"@vitest/coverage-v8": "^3.0.8",
|
|
52
|
-
"prop-types": "^15.8.1",
|
|
53
|
-
"rollup": "^2.79.2",
|
|
54
|
-
"rollup-plugin-babel": "^4.4.0",
|
|
55
|
-
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
56
|
-
"rollup-plugin-postcss": "^4.0.2",
|
|
57
|
-
"rollup-plugin-terser": "^7.0.2",
|
|
58
|
-
"storybook": "^8.6.6",
|
|
59
|
-
"vitest": "^3.0.8"
|
|
60
|
-
}
|
|
61
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "jrs-react",
|
|
3
|
+
"version": "1.2.49",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "build/index.js",
|
|
6
|
+
"module": "build/index.es.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
|
+
"build": "rollup -c",
|
|
10
|
+
"storybook": "storybook dev -p 6006",
|
|
11
|
+
"build-storybook": "storybook build",
|
|
12
|
+
"vite": "vite"
|
|
13
|
+
},
|
|
14
|
+
"author": "JorenLai",
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@rollup/plugin-commonjs": "^28.0.3",
|
|
18
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
19
|
+
"@types/react": "^19.0.10",
|
|
20
|
+
"@types/react-dom": "^19.0.4",
|
|
21
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
22
|
+
"antd": "^5.12.5",
|
|
23
|
+
"axios": "^1.6.2",
|
|
24
|
+
"create-react-class": "^15.7.0",
|
|
25
|
+
"globals": "^15.15.0",
|
|
26
|
+
"jrs-js": "^0.0.0",
|
|
27
|
+
"react": "^18.2.0",
|
|
28
|
+
"react-dom": "^18.2.0",
|
|
29
|
+
"react-router-dom": "^7.4.0",
|
|
30
|
+
"styled-components": "^6.1.15",
|
|
31
|
+
"vite": "^6.2.0",
|
|
32
|
+
"vite-plugin-svgr": "^4.3.0"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"react": "^18.2.0",
|
|
36
|
+
"react-dom": "^18.2.0"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@babel/core": "^7.26.10",
|
|
40
|
+
"@chromatic-com/storybook": "^3.2.6",
|
|
41
|
+
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
42
|
+
"@storybook/addon-essentials": "^8.6.6",
|
|
43
|
+
"@storybook/addon-onboarding": "^8.6.6",
|
|
44
|
+
"@storybook/blocks": "^8.6.6",
|
|
45
|
+
"@storybook/experimental-addon-test": "^8.6.6",
|
|
46
|
+
"@storybook/react": "^8.6.6",
|
|
47
|
+
"@storybook/react-vite": "^8.6.6",
|
|
48
|
+
"@storybook/test": "^8.6.6",
|
|
49
|
+
"@svgr/rollup": "^8.1.0",
|
|
50
|
+
"@vitest/browser": "^3.0.8",
|
|
51
|
+
"@vitest/coverage-v8": "^3.0.8",
|
|
52
|
+
"prop-types": "^15.8.1",
|
|
53
|
+
"rollup": "^2.79.2",
|
|
54
|
+
"rollup-plugin-babel": "^4.4.0",
|
|
55
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
56
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
57
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
58
|
+
"storybook": "^8.6.6",
|
|
59
|
+
"vitest": "^3.0.8"
|
|
60
|
+
}
|
|
61
|
+
}
|
package/src/assets/icon/card.svg
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
<svg
|
|
2
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
3
|
-
width="24"
|
|
4
|
-
height="24"
|
|
5
|
-
viewBox="0 0 24 24"
|
|
6
|
-
fill="none"
|
|
7
|
-
stroke="currentColor"
|
|
8
|
-
stroke-width="2"
|
|
9
|
-
stroke-linecap="round"
|
|
10
|
-
stroke-linejoin="round"
|
|
11
|
-
>
|
|
12
|
-
<rect x="1" y="4" width="22" height="16" rx="2" ry="2" />
|
|
13
|
-
<line x1="1" y1="10" x2="23" y2="10" />
|
|
14
|
-
</svg>
|
|
1
|
+
<svg
|
|
2
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
3
|
+
width="24"
|
|
4
|
+
height="24"
|
|
5
|
+
viewBox="0 0 24 24"
|
|
6
|
+
fill="none"
|
|
7
|
+
stroke="currentColor"
|
|
8
|
+
stroke-width="2"
|
|
9
|
+
stroke-linecap="round"
|
|
10
|
+
stroke-linejoin="round"
|
|
11
|
+
>
|
|
12
|
+
<rect x="1" y="4" width="22" height="16" rx="2" ry="2" />
|
|
13
|
+
<line x1="1" y1="10" x2="23" y2="10" />
|
|
14
|
+
</svg>
|
package/src/assets/icon/copy.svg
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
<svg
|
|
2
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
3
|
-
width="24"
|
|
4
|
-
height="24"
|
|
5
|
-
viewBox="0 0 24 24"
|
|
6
|
-
fill="none"
|
|
7
|
-
stroke="currentColor"
|
|
8
|
-
stroke-width="2"
|
|
9
|
-
stroke-linecap="round"
|
|
10
|
-
stroke-linejoin="round"
|
|
11
|
-
>
|
|
12
|
-
<rect x="9" y="9" width="13" height="13" rx="2" ry="2" />
|
|
13
|
-
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" />
|
|
14
|
-
</svg>
|
|
1
|
+
<svg
|
|
2
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
3
|
+
width="24"
|
|
4
|
+
height="24"
|
|
5
|
+
viewBox="0 0 24 24"
|
|
6
|
+
fill="none"
|
|
7
|
+
stroke="currentColor"
|
|
8
|
+
stroke-width="2"
|
|
9
|
+
stroke-linecap="round"
|
|
10
|
+
stroke-linejoin="round"
|
|
11
|
+
>
|
|
12
|
+
<rect x="9" y="9" width="13" height="13" rx="2" ry="2" />
|
|
13
|
+
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" />
|
|
14
|
+
</svg>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
<svg
|
|
2
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
3
|
-
width="24"
|
|
4
|
-
height="24"
|
|
5
|
-
viewBox="0 0 24 24"
|
|
6
|
-
fill="none"
|
|
7
|
-
stroke="currentColor"
|
|
8
|
-
stroke-width="2"
|
|
9
|
-
stroke-linecap="round"
|
|
10
|
-
stroke-linejoin="round"
|
|
11
|
-
>
|
|
12
|
-
<line x1="5" y1="12" x2="19" y2="12" />
|
|
13
|
-
</svg>
|
|
1
|
+
<svg
|
|
2
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
3
|
+
width="24"
|
|
4
|
+
height="24"
|
|
5
|
+
viewBox="0 0 24 24"
|
|
6
|
+
fill="none"
|
|
7
|
+
stroke="currentColor"
|
|
8
|
+
stroke-width="2"
|
|
9
|
+
stroke-linecap="round"
|
|
10
|
+
stroke-linejoin="round"
|
|
11
|
+
>
|
|
12
|
+
<line x1="5" y1="12" x2="19" y2="12" />
|
|
13
|
+
</svg>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
<svg
|
|
2
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
3
|
-
width="24"
|
|
4
|
-
height="24"
|
|
5
|
-
viewBox="0 0 24 24"
|
|
6
|
-
fill="none"
|
|
7
|
-
stroke="currentColor"
|
|
8
|
-
stroke-width="2"
|
|
9
|
-
stroke-linecap="round"
|
|
10
|
-
stroke-linejoin="round"
|
|
11
|
-
>
|
|
12
|
-
<rect x="3" y="3" width="18" height="18" rx="2" ry="2" />
|
|
13
|
-
</svg>
|
|
1
|
+
<svg
|
|
2
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
3
|
+
width="24"
|
|
4
|
+
height="24"
|
|
5
|
+
viewBox="0 0 24 24"
|
|
6
|
+
fill="none"
|
|
7
|
+
stroke="currentColor"
|
|
8
|
+
stroke-width="2"
|
|
9
|
+
stroke-linecap="round"
|
|
10
|
+
stroke-linejoin="round"
|
|
11
|
+
>
|
|
12
|
+
<rect x="3" y="3" width="18" height="18" rx="2" ry="2" />
|
|
13
|
+
</svg>
|
package/src/assets/icon/x.svg
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
<svg
|
|
2
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
3
|
-
width="24"
|
|
4
|
-
height="24"
|
|
5
|
-
viewBox="0 0 24 24"
|
|
6
|
-
fill="none"
|
|
7
|
-
stroke="currentColor"
|
|
8
|
-
stroke-width="2"
|
|
9
|
-
stroke-linecap="round"
|
|
10
|
-
stroke-linejoin="round"
|
|
11
|
-
>
|
|
12
|
-
<line x1="18" y1="6" x2="6" y2="18" />
|
|
13
|
-
<line x1="6" y1="6" x2="18" y2="18" />
|
|
14
|
-
</svg>
|
|
1
|
+
<svg
|
|
2
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
3
|
+
width="24"
|
|
4
|
+
height="24"
|
|
5
|
+
viewBox="0 0 24 24"
|
|
6
|
+
fill="none"
|
|
7
|
+
stroke="currentColor"
|
|
8
|
+
stroke-width="2"
|
|
9
|
+
stroke-linecap="round"
|
|
10
|
+
stroke-linejoin="round"
|
|
11
|
+
>
|
|
12
|
+
<line x1="18" y1="6" x2="6" y2="18" />
|
|
13
|
+
<line x1="6" y1="6" x2="18" y2="18" />
|
|
14
|
+
</svg>
|
|
@@ -276,6 +276,7 @@ export default class JRFields extends JRWindow {
|
|
|
276
276
|
)
|
|
277
277
|
}
|
|
278
278
|
validate(value){
|
|
279
|
+
console.clear()
|
|
279
280
|
const validators=[]
|
|
280
281
|
const testValue=this.getTestValue()??{}
|
|
281
282
|
this.#validators(this.getColumns(),validators,[],testValue,value!==undefined?value:this.getValue())
|
|
@@ -22,15 +22,19 @@ export default class Slider extends React.Component {
|
|
|
22
22
|
const ref=this.props.contenerRef.current
|
|
23
23
|
let width=this.frame.x2-clientX-this.frame.shw
|
|
24
24
|
if(width<0)width=0
|
|
25
|
+
po('width',width)
|
|
25
26
|
ref.style.flexBasis=`${width}px`
|
|
26
27
|
}
|
|
27
28
|
,top:({clientY})=>{
|
|
29
|
+
po('top')
|
|
28
30
|
const ref=this.props.contenerRef.current
|
|
29
31
|
let height=clientY-this.frame.y-this.frame.shh
|
|
32
|
+
po('height',height)
|
|
30
33
|
// if(width<0)width=0
|
|
31
34
|
ref.style.flexBasis=`${height}px`
|
|
32
35
|
}
|
|
33
36
|
,bottom:({clientY})=>{
|
|
37
|
+
po('bottom')
|
|
34
38
|
const ref=this.props.contenerRef.current
|
|
35
39
|
let height=this.frame.w2-clientY-this.frame.shh
|
|
36
40
|
// clientY-this.frame.y-this.frame.shh
|
|
@@ -40,6 +44,7 @@ export default class Slider extends React.Component {
|
|
|
40
44
|
}
|
|
41
45
|
}
|
|
42
46
|
stop=(e)=>{
|
|
47
|
+
po('stop',this.stop)
|
|
43
48
|
document.body.style.cursor='default'
|
|
44
49
|
window.removeEventListener('mousemove',this.move)
|
|
45
50
|
window.removeEventListener('mouseup',this.stop)
|
|
@@ -48,8 +53,11 @@ export default class Slider extends React.Component {
|
|
|
48
53
|
this.resize[this.props.dir](e)
|
|
49
54
|
}
|
|
50
55
|
start=({clientX})=>{
|
|
56
|
+
console.clear()
|
|
51
57
|
const ref=this.props.contenerRef.current
|
|
52
58
|
const {x,y,width,height,...other}=ref.getBoundingClientRect()
|
|
59
|
+
po('other',ref.getBoundingClientRect())
|
|
60
|
+
po('ref.getBoundingClientRect()',this.ref.current.getBoundingClientRect())
|
|
53
61
|
const {width:sw,height:sh}=this.ref.current.getBoundingClientRect()
|
|
54
62
|
this.frame={
|
|
55
63
|
x,y
|
|
@@ -20,7 +20,6 @@ const Cover=({children})=>{
|
|
|
20
20
|
|
|
21
21
|
export default class JRSubmit extends React.Component {
|
|
22
22
|
#methods = ['get', 'post', 'put','patch','delete','download']
|
|
23
|
-
|
|
24
23
|
constructor(props) {
|
|
25
24
|
super(props)
|
|
26
25
|
if(this.props.value===undefined && this.props.initValue!==undefined ){
|
|
@@ -157,7 +156,10 @@ export default class JRSubmit extends React.Component {
|
|
|
157
156
|
return this.getValue()
|
|
158
157
|
}
|
|
159
158
|
|
|
160
|
-
getAxiosParams({url,method,value,extraValue,sendValue,transformValue
|
|
159
|
+
getAxiosParams({url,method,value,extraValue,sendValue,transformValue,paramsSerializer
|
|
160
|
+
,...params
|
|
161
|
+
}){
|
|
162
|
+
po('params',params)
|
|
161
163
|
const _extraValue=extraValue?.bind?.(this)() ?? extraValue
|
|
162
164
|
// let payload=typeof value === 'function'
|
|
163
165
|
// ?value.bind(this)({
|
|
@@ -196,10 +198,11 @@ export default class JRSubmit extends React.Component {
|
|
|
196
198
|
let params1={}
|
|
197
199
|
const params2={}
|
|
198
200
|
if(method=='get'){
|
|
199
|
-
if(sendValue==null || sendValue)params1.params=payload
|
|
201
|
+
if(sendValue==null || sendValue) params1.params=payload
|
|
200
202
|
params1.headers=headers
|
|
203
|
+
params1.paramsSerializer=paramsSerializer
|
|
201
204
|
}else if(method=='delete'){
|
|
202
|
-
if(sendValue==null || sendValue)params1.data=payload
|
|
205
|
+
if(sendValue==null || sendValue) params1.data=payload
|
|
203
206
|
params1.headers=headers
|
|
204
207
|
}else{
|
|
205
208
|
if(sendValue==null || sendValue){
|
|
@@ -275,9 +278,7 @@ export default class JRSubmit extends React.Component {
|
|
|
275
278
|
|
|
276
279
|
response = config?.response?.bind(this)(response,payload) ?? response
|
|
277
280
|
const isSuccess = response.status >= 200 && response.status <= 299
|
|
278
|
-
|
|
279
281
|
this.setRes(isSuccess,response,config)
|
|
280
|
-
|
|
281
282
|
if(config.delay!=null){
|
|
282
283
|
setTimeout(()=>{
|
|
283
284
|
this.showMessage(isSuccess,isSuccess?config.successMessage:config.failedMessage)
|
|
@@ -289,8 +290,6 @@ export default class JRSubmit extends React.Component {
|
|
|
289
290
|
config.callback?.bind(this)(isSuccess,response,payload)
|
|
290
291
|
config.removeMaskFunction?.()
|
|
291
292
|
}
|
|
292
|
-
|
|
293
|
-
|
|
294
293
|
}
|
|
295
294
|
|
|
296
295
|
showMessage(success,message){
|
|
@@ -4,9 +4,7 @@ import styled from "styled-components";
|
|
|
4
4
|
import TitleBar from "./TitleBar";
|
|
5
5
|
import Sliders from "./Slider";
|
|
6
6
|
import { JRHTML } from "jrs-js";
|
|
7
|
-
import { po
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
import { po } from "../JRUtils";
|
|
10
8
|
|
|
11
9
|
const StyledBackdrop=styled.div`
|
|
12
10
|
${({$zIndex})=>$zIndex!=null?`z-index:${$zIndex};`:null}
|
|
@@ -58,8 +56,6 @@ const StyledJRWindow=styled.div`
|
|
|
58
56
|
}
|
|
59
57
|
`
|
|
60
58
|
|
|
61
|
-
|
|
62
|
-
|
|
63
59
|
class Backdrop extends JRHTML{
|
|
64
60
|
backdropConfig={
|
|
65
61
|
yo:'div'
|
|
@@ -73,51 +69,115 @@ class Backdrop extends JRHTML{
|
|
|
73
69
|
}
|
|
74
70
|
}
|
|
75
71
|
|
|
76
|
-
constructor(
|
|
72
|
+
constructor(params){
|
|
77
73
|
super(params)
|
|
78
|
-
this.backdropConfig.style.zIndex=zIndex
|
|
79
|
-
this.backdropConfig.personajes={
|
|
80
|
-
id:params.backdropId
|
|
81
|
-
}
|
|
82
74
|
Object.assign(this.backdropConfig.style,params.backdropStyle)
|
|
83
75
|
}
|
|
76
|
+
|
|
84
77
|
show(){
|
|
85
|
-
this.agregarHijo(this.backdropConfig)
|
|
78
|
+
this.backdrop=this.agregarHijo(this.backdropConfig)
|
|
79
|
+
this.on=true
|
|
86
80
|
}
|
|
87
81
|
hide(){
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
82
|
+
if(this.on){
|
|
83
|
+
this.yo.removeChild(this.yo.children[this.yo.children.length-1])
|
|
84
|
+
this.hijos=[]
|
|
85
|
+
this.on=false
|
|
91
86
|
}
|
|
92
|
-
this.hijos=[]
|
|
93
87
|
}
|
|
94
88
|
}
|
|
95
89
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
90
|
+
export default class JRWindow extends JRFrame {
|
|
91
|
+
// x=0
|
|
92
|
+
// y=0
|
|
93
|
+
// width=300
|
|
94
|
+
// height=300
|
|
99
95
|
padding=1
|
|
100
96
|
thick=5
|
|
97
|
+
|
|
101
98
|
constructor(props){
|
|
102
99
|
super(props)
|
|
100
|
+
this.ref=React.createRef()
|
|
103
101
|
this.titleBarRef=React.createRef()
|
|
104
102
|
}
|
|
105
103
|
|
|
104
|
+
createBackdrop(){
|
|
105
|
+
if(typeof this.props.backdrop === 'string'){
|
|
106
|
+
const target=document.getElementById(this.props.backdrop)
|
|
107
|
+
if(target){
|
|
108
|
+
this.backdropTarget=new Backdrop({
|
|
109
|
+
yo:target
|
|
110
|
+
,style:{
|
|
111
|
+
position: 'relative'
|
|
112
|
+
}
|
|
113
|
+
,backdropStyle:this.props.backdropStyle
|
|
114
|
+
})
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
addMaskToTarget=(target)=>{
|
|
120
|
+
this.mask=document.createElement('div')
|
|
121
|
+
this.mask.style.background='#868686cc'
|
|
122
|
+
this.mask.style.position='absolute'
|
|
123
|
+
this.mask.style.top='0'
|
|
124
|
+
this.mask.style.left='0'
|
|
125
|
+
this.mask.style.right='0'
|
|
126
|
+
this.mask.style.bottom='0'
|
|
127
|
+
this.mask.style.borderRadius='inherit'
|
|
128
|
+
this.mask.style.height='10000px'
|
|
129
|
+
this.mask.style.width='10000px'
|
|
130
|
+
target.appendChild(this.mask)
|
|
131
|
+
}
|
|
132
|
+
removeMaskFromTarget=()=>{
|
|
133
|
+
this.mask.remove()
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// backdropOn(on){
|
|
137
|
+
// const target=(typeof this.props.backdrop)==='object'
|
|
138
|
+
// ?this.props.backdrop
|
|
139
|
+
// :typeof this.props.backdrop ==='string'
|
|
140
|
+
// ?document.getElementById(this.props.backdrop)
|
|
141
|
+
// :document.body
|
|
142
|
+
// target?.classList[on?'add':'remove']('withMask')
|
|
143
|
+
// }
|
|
144
|
+
|
|
106
145
|
componentDidMount(){
|
|
146
|
+
super.componentDidMount()
|
|
147
|
+
this.createBackdrop()
|
|
107
148
|
if(this.props.open){
|
|
108
|
-
this.
|
|
109
|
-
this.props.onOpen?.bind(this.props.jrWindow)()
|
|
149
|
+
this.open()
|
|
110
150
|
}
|
|
111
151
|
}
|
|
152
|
+
|
|
112
153
|
componentWillUnmount(){
|
|
113
|
-
|
|
114
|
-
this.props.jrWindow.backdropTarget?.hide()
|
|
115
|
-
}
|
|
154
|
+
this.backdropTarget?.hide()
|
|
116
155
|
}
|
|
117
156
|
|
|
157
|
+
open(){
|
|
158
|
+
this.backdropTarget?.show()
|
|
159
|
+
this.props.onOpen?.bind(this)()
|
|
160
|
+
}
|
|
161
|
+
close(){
|
|
162
|
+
this.backdropTarget?.hide()
|
|
163
|
+
this.props.onClose?.bind(this)()
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
componentDidUpdate(prevProps, prevState, snapshot){
|
|
167
|
+
if(this.props.popup===true){
|
|
168
|
+
if(this.props.open && prevProps.open===false){
|
|
169
|
+
this.open()
|
|
170
|
+
}else if(this.props.open===false && prevProps.open){
|
|
171
|
+
this.close()
|
|
172
|
+
}
|
|
173
|
+
// if(this.props.backdrop && this.props.open!=prevProps.open){
|
|
174
|
+
// this.backdropOn(this.props.open)
|
|
175
|
+
// }
|
|
176
|
+
}
|
|
177
|
+
}
|
|
118
178
|
|
|
119
179
|
get xw(){
|
|
120
|
-
let width
|
|
180
|
+
let width
|
|
121
181
|
if(this.props.width?.indexOf?.('%')>-1){
|
|
122
182
|
width=(this.props.width.split('%')[0]*window.innerWidth)/100
|
|
123
183
|
}else{
|
|
@@ -130,7 +190,7 @@ class RWindow extends React.Component {
|
|
|
130
190
|
}
|
|
131
191
|
|
|
132
192
|
get yh(){
|
|
133
|
-
let height
|
|
193
|
+
let height
|
|
134
194
|
if(this.props.height?.indexOf?.('%')>-1){
|
|
135
195
|
height=(this.props.height.split('%')[0]*window.innerHeight)/100
|
|
136
196
|
}else{
|
|
@@ -142,89 +202,43 @@ class RWindow extends React.Component {
|
|
|
142
202
|
}
|
|
143
203
|
}
|
|
144
204
|
|
|
145
|
-
render(){
|
|
146
|
-
const {children,title,resizable,jrWindow,...props}=this.props
|
|
147
|
-
return <StyledJRWindow
|
|
148
|
-
$zIndex={this.props.zIndex?this.props.zIndex+1:null}
|
|
149
|
-
className={`jr-window ${this.props.className??''}`}
|
|
150
|
-
ref={this.props.windowRef}
|
|
151
|
-
$xw={this.xw}
|
|
152
|
-
$yh={this.yh}
|
|
153
|
-
$thick={this.thick}
|
|
154
|
-
>
|
|
155
|
-
<main style={{zIndex:this.props.zIndex?this.props.zIndex+1:null}} >
|
|
156
|
-
<TitleBar
|
|
157
|
-
titleBarRef={this.titleBarRef}
|
|
158
|
-
jrWindow={jrWindow}
|
|
159
|
-
windowRef={this.props.windowRef}
|
|
160
|
-
window={this}
|
|
161
|
-
title={title}
|
|
162
|
-
thick={this.thick}
|
|
163
|
-
resizable={resizable}
|
|
164
|
-
/>
|
|
165
|
-
{children}
|
|
166
|
-
{this.props.resizable !== false
|
|
167
|
-
&& <Sliders
|
|
168
|
-
thick={this.thick}
|
|
169
|
-
windowRef={this.props.windowRef}
|
|
170
|
-
window={this}
|
|
171
|
-
titleBarRef={this.titleBarRef}
|
|
172
|
-
/>
|
|
173
|
-
}
|
|
174
|
-
</main>
|
|
175
|
-
{this.props.backdrop===true && <StyledBackdrop $zIndex={this.props.zIndex}/>}
|
|
176
|
-
</StyledJRWindow>
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
export default class JRWindow extends JRFrame {
|
|
181
|
-
constructor(props){
|
|
182
|
-
super(props)
|
|
183
|
-
this.windowRef=React.createRef()
|
|
184
|
-
this.backdropId=`backdropId-${random(10000,99999)}`
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
componentDidMount(){
|
|
188
|
-
super.componentDidMount()
|
|
189
|
-
this.createBackdrop()
|
|
190
|
-
}
|
|
191
|
-
componentWillUnmount(){
|
|
192
|
-
if(this.props.open){
|
|
193
|
-
this.backdropTarget?.hide()
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
componentDidUpdate(prevProps, prevState){
|
|
197
|
-
if(prevProps.open && prevProps.open!=this.props.open){
|
|
198
|
-
this.props.onClose?.bind(this)()
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
componentWillUpdate
|
|
203
|
-
createBackdrop(){
|
|
204
|
-
if(typeof this.props.backdrop === 'string'){
|
|
205
|
-
const target=document.getElementById(this.props.backdrop)
|
|
206
|
-
if(target){
|
|
207
|
-
this.backdropTarget=new Backdrop({
|
|
208
|
-
yo:target
|
|
209
|
-
,backdropId:this.backdropId
|
|
210
|
-
,fullScreen:this.props.backdrop===true
|
|
211
|
-
,zIndex:this.props.zIndex
|
|
212
|
-
,backdropStyle:this.props.backdropStyle
|
|
213
|
-
})
|
|
214
|
-
if(this.props.open){
|
|
215
|
-
this.backdropTarget.show()
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
|
|
221
205
|
renderer(){
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
206
|
+
return this.props.popup===true
|
|
207
|
+
?this.props.open
|
|
208
|
+
?<>
|
|
209
|
+
<StyledJRWindow
|
|
210
|
+
$zIndex={this.props.zIndex}
|
|
211
|
+
rule={'dialog'}
|
|
212
|
+
ref={this.ref}
|
|
213
|
+
className={`jr-window ${this.props.className??''}`}
|
|
214
|
+
$xw={this.xw}
|
|
215
|
+
$yh={this.yh}
|
|
216
|
+
$thick={this.thick}
|
|
217
|
+
>
|
|
218
|
+
<main style={{zIndex:1}}>
|
|
219
|
+
<TitleBar
|
|
220
|
+
titleBarRef={this.titleBarRef}
|
|
221
|
+
windowRef={this.ref}
|
|
222
|
+
window={this}
|
|
223
|
+
title={this.props.title}
|
|
224
|
+
thick={this.thick}
|
|
225
|
+
resizable={this.props.resizable}
|
|
226
|
+
/>
|
|
227
|
+
<main>
|
|
228
|
+
{super.renderer()}
|
|
229
|
+
</main>
|
|
230
|
+
{this.props.resizable !== false
|
|
231
|
+
&& <Sliders
|
|
232
|
+
thick={this.thick}
|
|
233
|
+
windowRef={this.ref}
|
|
234
|
+
window={this}
|
|
235
|
+
titleBarRef={this.titleBarRef}
|
|
236
|
+
/>
|
|
237
|
+
}
|
|
238
|
+
</main>
|
|
239
|
+
{this.props.backdrop!==false && typeof this.props.backdrop!=='string' && <StyledBackdrop $zIndex={this.props.zIndex}/>}
|
|
240
|
+
</StyledJRWindow>
|
|
241
|
+
</>
|
|
228
242
|
:''
|
|
229
243
|
:super.renderer()
|
|
230
244
|
}
|