jrs-react 1.2.5 → 1.2.6
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/index.html +13 -0
- package/package.json +14 -3
- package/public/data.json +4 -2
- package/public/list.json +2 -0
- package/public/vite.svg +1 -0
- package/src/app/App.css +8 -0
- package/src/app/App.jsx +17 -0
- package/src/app/fields/FieldsApp.jsx +12 -0
- package/src/app/fields/fieldsConfig.jsx +137 -0
- package/src/app/index.css +42 -0
- package/src/app/table/TableApp.jsx +10 -0
- package/src/app/table/tableConfig.jsx +86 -0
- package/src/app/window/WindowApp.jsx +84 -0
- package/src/assets/react.svg +1 -0
- package/src/components/JRFields/JRFields.jsx +5 -6
- package/src/components/JRFields/StyleJRFields.jsx +2 -1
- package/src/components/JRFrame/JRFrame.jsx +9 -6
- package/src/components/JRInput/JRSelect.jsx +19 -0
- package/src/components/JRInput/JRText.jsx +1 -2
- package/src/components/JRSubmit.jsx +4 -3
- package/src/components/JRTable/JRTable.jsx +3 -2
- package/src/components/JRTable/Slider.jsx +1 -1
- package/src/components/JRTable/StyledJRTable.jsx +1 -2
- package/src/components/JRTable/TBodies.jsx +1 -1
- package/src/components/JRWindow/JRWindow.jsx +110 -0
- package/src/components/JRWindow/Slider.jsx +251 -0
- package/src/components/JRWindow/TitleBar.jsx +84 -0
- package/src/main.jsx +6 -0
- package/vite.config.js +7 -0
package/index.html
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>Vite + React</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body style="background: black;color:gray;">
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
<script type="module" src="/src/main.jsx"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jrs-react",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"module": "build/index.es.js",
|
|
@@ -8,19 +8,30 @@
|
|
|
8
8
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
9
|
"build": "rollup -c",
|
|
10
10
|
"storybook": "storybook dev -p 6006",
|
|
11
|
-
"build-storybook": "storybook build"
|
|
11
|
+
"build-storybook": "storybook build",
|
|
12
|
+
"vite": "vite"
|
|
12
13
|
},
|
|
13
14
|
"author": "JorenLai",
|
|
14
15
|
"license": "MIT",
|
|
15
16
|
"dependencies": {
|
|
17
|
+
"@eslint/js": "^9.21.0",
|
|
16
18
|
"@rollup/plugin-commonjs": "^28.0.3",
|
|
17
19
|
"@rollup/plugin-json": "^6.1.0",
|
|
20
|
+
"@types/react": "^19.0.10",
|
|
21
|
+
"@types/react-dom": "^19.0.4",
|
|
22
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
18
23
|
"antd": "^5.12.5",
|
|
19
24
|
"axios": "^1.6.2",
|
|
25
|
+
"eslint": "^9.21.0",
|
|
26
|
+
"eslint-plugin-react-hooks": "^5.1.0",
|
|
27
|
+
"eslint-plugin-react-refresh": "^0.4.19",
|
|
28
|
+
"globals": "^15.15.0",
|
|
20
29
|
"react": "^18.2.0",
|
|
21
30
|
"react-dom": "^18.2.0",
|
|
31
|
+
"react-router-dom": "^7.4.0",
|
|
22
32
|
"rollup-plugin-node-resolve": "^5.2.0",
|
|
23
|
-
"styled-components": "^6.1.15"
|
|
33
|
+
"styled-components": "^6.1.15",
|
|
34
|
+
"vite": "^6.2.0"
|
|
24
35
|
},
|
|
25
36
|
"devDependencies": {
|
|
26
37
|
"@babel/core": "^7.26.10",
|
package/public/data.json
CHANGED
package/public/list.json
CHANGED
package/public/vite.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
package/src/app/App.css
ADDED
package/src/app/App.jsx
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BrowserRouter, Route, Routes } from 'react-router-dom'
|
|
2
|
+
import './App.css'
|
|
3
|
+
import TableApp from './table/TableApp'
|
|
4
|
+
import FieldsApp from './fields/FieldsApp'
|
|
5
|
+
import WindowApp from './window/WindowApp'
|
|
6
|
+
|
|
7
|
+
function App() {
|
|
8
|
+
return <BrowserRouter>
|
|
9
|
+
<Routes>
|
|
10
|
+
<Route path="/table" element={<TableApp/>}/>
|
|
11
|
+
<Route path="/fields" element={<FieldsApp/>}/>
|
|
12
|
+
<Route path="/window" element={<WindowApp/>}/>
|
|
13
|
+
</Routes>
|
|
14
|
+
</BrowserRouter>
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default App
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
import JRFields from "../../components/JRFields/JRFields";
|
|
3
|
+
import JRText from "../../components/JRInput/JRText";
|
|
4
|
+
import JRTable from "../../components/JRTable/JRTable";
|
|
5
|
+
import { fieldsConfig } from "./fieldsConfig";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
export default function FieldsApp() {
|
|
9
|
+
return <JRFields
|
|
10
|
+
{...fieldsConfig}
|
|
11
|
+
/>
|
|
12
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { Input } from "antd";
|
|
2
|
+
import JRFields from "../../components/JRFields/JRFields";
|
|
3
|
+
import JRSelect from "../../components/JRInput/JRSelect";
|
|
4
|
+
import JRText from "../../components/JRInput/JRText";
|
|
5
|
+
import JRTable from "../../components/JRTable/JRTable";
|
|
6
|
+
import { po } from "../../components/JRUtils";
|
|
7
|
+
|
|
8
|
+
export const fieldsConfig={
|
|
9
|
+
popup:true
|
|
10
|
+
,mask:true
|
|
11
|
+
,width:'700px'
|
|
12
|
+
,height:'500px'
|
|
13
|
+
|
|
14
|
+
,get:{
|
|
15
|
+
url:'data.json'
|
|
16
|
+
,autoRun:true
|
|
17
|
+
,successMessage:'YES'
|
|
18
|
+
,mask:'Loading'
|
|
19
|
+
}
|
|
20
|
+
,style:{
|
|
21
|
+
padding:'18px'
|
|
22
|
+
,background:'black'
|
|
23
|
+
,gap:'20px'
|
|
24
|
+
}
|
|
25
|
+
,typeStyle:{
|
|
26
|
+
padding:'8px'
|
|
27
|
+
,background:'#eeeeee'
|
|
28
|
+
}
|
|
29
|
+
,columns:[
|
|
30
|
+
{name:'name',label:'姓名',type:JRText}
|
|
31
|
+
,{name:'birthday',label:'生日',type:Input}
|
|
32
|
+
,{name:'phone',label:'電話號碼',type:JRTable
|
|
33
|
+
,top({setStyle}){
|
|
34
|
+
return <>
|
|
35
|
+
<button
|
|
36
|
+
onClick={()=>{
|
|
37
|
+
this.get()
|
|
38
|
+
}}
|
|
39
|
+
>Get</button>
|
|
40
|
+
<button
|
|
41
|
+
onClick={()=>{
|
|
42
|
+
this.reset()
|
|
43
|
+
}}
|
|
44
|
+
>Reset</button>
|
|
45
|
+
</>
|
|
46
|
+
}
|
|
47
|
+
,bottom({setStyle}){
|
|
48
|
+
setStyle({color:'green',border:'1px solid green',height:'140px',overflow: 'overlay'})
|
|
49
|
+
return<div style={{
|
|
50
|
+
display: 'flex'
|
|
51
|
+
,justifyContent: 'space-around'
|
|
52
|
+
}}>
|
|
53
|
+
<pre style={{flex:1}}>
|
|
54
|
+
{JSON.stringify(this.getValue(),4,4)}
|
|
55
|
+
</pre>
|
|
56
|
+
<pre style={{flex:1}}>
|
|
57
|
+
{JSON.stringify(this.rawValue,4,4)}
|
|
58
|
+
</pre>
|
|
59
|
+
</div>
|
|
60
|
+
}
|
|
61
|
+
,get:{
|
|
62
|
+
url:'list.json'
|
|
63
|
+
}
|
|
64
|
+
,colSpan:2
|
|
65
|
+
,resizableColumns:true
|
|
66
|
+
,typeStyle:{
|
|
67
|
+
height:'300px'
|
|
68
|
+
}
|
|
69
|
+
,columns:[
|
|
70
|
+
{name:'name',label:'電信公司'}
|
|
71
|
+
,{name:'phone',label:'號碼',type:JRText}
|
|
72
|
+
,{
|
|
73
|
+
name:'address'
|
|
74
|
+
,label:'地址'
|
|
75
|
+
,type:JRFields
|
|
76
|
+
,labelProps:{
|
|
77
|
+
width:'min-content'
|
|
78
|
+
,style:{
|
|
79
|
+
paddingLeft:'20px'
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
,columns:[
|
|
83
|
+
{name:'no',label:'門牌',type:JRText}
|
|
84
|
+
,{name:'street',label:'街',type:JRText}
|
|
85
|
+
,{name:'country',label:'國家',type:JRSelect}
|
|
86
|
+
,{name:'p',label:'郵區',type:JRText}
|
|
87
|
+
]
|
|
88
|
+
,cols:4
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
// ,{
|
|
93
|
+
// name:'address'
|
|
94
|
+
// ,label:'地址'
|
|
95
|
+
// ,type:JRFields
|
|
96
|
+
// ,colSpan:2
|
|
97
|
+
// ,columns:[
|
|
98
|
+
// {name:'no',label:'號碼',type:JRText}
|
|
99
|
+
// ,{name:'street',label:'街',type:JRText}
|
|
100
|
+
// ,{name:'country',label:'國家',type:JRText}
|
|
101
|
+
// ]
|
|
102
|
+
// ,cols:1
|
|
103
|
+
// }
|
|
104
|
+
// ,{name:'email',label:'電子郵件',type:JRText}
|
|
105
|
+
// ,{name:'account',label:'帳號'}
|
|
106
|
+
]
|
|
107
|
+
,cols:2
|
|
108
|
+
,right({setStyle}){
|
|
109
|
+
setStyle({color:'green',border:'1px solid green',width:'100px',whiteSpace:'pre',overflow: 'overlay'})
|
|
110
|
+
return <>
|
|
111
|
+
<button
|
|
112
|
+
onClick={()=>{
|
|
113
|
+
this.get()
|
|
114
|
+
}}
|
|
115
|
+
>Get</button>
|
|
116
|
+
<button
|
|
117
|
+
onClick={()=>{
|
|
118
|
+
this.reset()
|
|
119
|
+
}}
|
|
120
|
+
>Reset</button>
|
|
121
|
+
</>
|
|
122
|
+
}
|
|
123
|
+
,bottom({setStyle}){
|
|
124
|
+
setStyle({color:'gray',border:'1px solid blue',whiteSpace:'pre',overflow: 'overlay'})
|
|
125
|
+
return <div style={{
|
|
126
|
+
display: 'flex'
|
|
127
|
+
,justifyContent: 'space-around'
|
|
128
|
+
}}>
|
|
129
|
+
<pre>
|
|
130
|
+
{JSON.stringify(this.getValue(),4,4)}
|
|
131
|
+
</pre>
|
|
132
|
+
<pre>
|
|
133
|
+
{JSON.stringify(this.rawValue,4,4)}
|
|
134
|
+
</pre>
|
|
135
|
+
</div>
|
|
136
|
+
}
|
|
137
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
a {
|
|
6
|
+
font-weight: 500;
|
|
7
|
+
color: #646cff;
|
|
8
|
+
text-decoration: inherit;
|
|
9
|
+
}
|
|
10
|
+
a:hover {
|
|
11
|
+
color: #535bf2;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
body {
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
h1 {
|
|
18
|
+
line-height: 1.1;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
button {
|
|
22
|
+
}
|
|
23
|
+
button:hover {
|
|
24
|
+
border-color: #646cff;
|
|
25
|
+
}
|
|
26
|
+
button:focus,
|
|
27
|
+
button:focus-visible {
|
|
28
|
+
outline: 4px auto -webkit-focus-ring-color;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@media (prefers-color-scheme: light) {
|
|
32
|
+
:root {
|
|
33
|
+
color: #213547;
|
|
34
|
+
background-color: #ffffff;
|
|
35
|
+
}
|
|
36
|
+
a:hover {
|
|
37
|
+
color: #747bff;
|
|
38
|
+
}
|
|
39
|
+
button {
|
|
40
|
+
background-color: #f9f9f9;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import JRFields from "../../components/JRFields/JRFields";
|
|
2
|
+
import JRText from "../../components/JRInput/JRText";
|
|
3
|
+
import JRTable from "../../components/JRTable/JRTable";
|
|
4
|
+
import { tableConfig } from "./tableConfig";
|
|
5
|
+
|
|
6
|
+
export default function TableApp() {
|
|
7
|
+
return <JRTable
|
|
8
|
+
{...tableConfig}
|
|
9
|
+
/>
|
|
10
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import JRText from "../../components/JRInput/JRText";
|
|
2
|
+
|
|
3
|
+
export const tableConfig={
|
|
4
|
+
popup:true
|
|
5
|
+
,height:500
|
|
6
|
+
,width:600
|
|
7
|
+
,get:{
|
|
8
|
+
url:'list.json'
|
|
9
|
+
,autoRun:true
|
|
10
|
+
,successMessage:'YES'
|
|
11
|
+
,mask:'Loading'
|
|
12
|
+
}
|
|
13
|
+
,columns:[
|
|
14
|
+
{name:'Test',label:'1'
|
|
15
|
+
,rowSpan:4
|
|
16
|
+
,columns:[
|
|
17
|
+
{name:'Test21',label:'1_1'
|
|
18
|
+
,columns:[
|
|
19
|
+
{name:'Test21',label:'1_1_1',xdescribewidth:'20%'}
|
|
20
|
+
,{name:'Test21',label:'1_1_2',xwidth:'20%'}
|
|
21
|
+
,{name:'Test21',label:'1_1_3',xwidth:'20%'}
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
}
|
|
25
|
+
,{name:'Test22',label:'1_2',xwidth:'30%'}
|
|
26
|
+
,{name:'Test22',label:'1_3',xwidth:'30%'}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
,{name:'Test2',label:'2'
|
|
31
|
+
,columns:[
|
|
32
|
+
{name:'Test21',label:'2_1'}
|
|
33
|
+
,{name:'Test21',label:'2_2'
|
|
34
|
+
,rowSpan:4
|
|
35
|
+
,columns:[
|
|
36
|
+
{name:'Test21',label:'2_2_1'}
|
|
37
|
+
,{name:'Test21',label:'2_2_2'}
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
,{name:'Test',label:'3'
|
|
44
|
+
,columns:[
|
|
45
|
+
{name:'Test21',label:'3_1'}
|
|
46
|
+
,{name:'Test22',label:'3_2'}
|
|
47
|
+
,{name:'Test22',label:'3_3'
|
|
48
|
+
,columns:[
|
|
49
|
+
{name:'Test21',label:'3_3_1'}
|
|
50
|
+
,{name:'Test21',label:'3_3_2'
|
|
51
|
+
,columns:[
|
|
52
|
+
{name:'Test21',label:'3_3_2_1'}
|
|
53
|
+
,{name:'Test21',label:'3_3_2_2'
|
|
54
|
+
,columns:[
|
|
55
|
+
{name:'Test21',label:'3_3_2_2_1'
|
|
56
|
+
,columns:[
|
|
57
|
+
{name:'Test21',label:'3_3_2_2_1_1'}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
,{name:'Test2',label:'4'
|
|
71
|
+
,columns:[
|
|
72
|
+
{name:'Test21',label:'4_1'}
|
|
73
|
+
,{name:'Test21',label:'4_2'
|
|
74
|
+
,columns:[
|
|
75
|
+
{name:'Test21',label:'4_2_1'}
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
,{name:'Test2',label:'5'}
|
|
81
|
+
// ,{name:'Test2',label:'6'}
|
|
82
|
+
// ,{name:'Test2',label:'7'}
|
|
83
|
+
// ,{name:'Test2',label:'8'}
|
|
84
|
+
]
|
|
85
|
+
,resizableColumns:true
|
|
86
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import JRWindow from "../../components/JRWindow/JRWindow";
|
|
2
|
+
import JRTable from "../../components/JRTable/JRTable";
|
|
3
|
+
import JRFields from "../../components/JRFields/JRFields";
|
|
4
|
+
import JRText from "../../components/JRInput/JRText";
|
|
5
|
+
import { po } from "../../components/JRUtils";
|
|
6
|
+
|
|
7
|
+
export default function WindowApp() {
|
|
8
|
+
return <>
|
|
9
|
+
<JRTable
|
|
10
|
+
title={function(){
|
|
11
|
+
return `共: ${this.getValue()?.length ??0 }筆`
|
|
12
|
+
}}
|
|
13
|
+
width={800}
|
|
14
|
+
// popup={true}
|
|
15
|
+
xxx={0}
|
|
16
|
+
xy={0}
|
|
17
|
+
get={{
|
|
18
|
+
url:'list.json'
|
|
19
|
+
,autoRun:true
|
|
20
|
+
}}
|
|
21
|
+
columns={[
|
|
22
|
+
{name:'name',label:'姓名'}
|
|
23
|
+
,{name:'birthday',label:'生日',type:JRText}
|
|
24
|
+
]}
|
|
25
|
+
resizableColumns={true}
|
|
26
|
+
/>
|
|
27
|
+
.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>.<br/>
|
|
28
|
+
|
|
29
|
+
<JRFields
|
|
30
|
+
title={function(){
|
|
31
|
+
return 'JRFields'//this.getValue()?.name
|
|
32
|
+
}}
|
|
33
|
+
width={480}
|
|
34
|
+
height={480}
|
|
35
|
+
popup={true}
|
|
36
|
+
get={{
|
|
37
|
+
url:'data.json'
|
|
38
|
+
,mask:'Loading'
|
|
39
|
+
}}
|
|
40
|
+
columns={[
|
|
41
|
+
{name:'name',label:'姓名',type:JRText}
|
|
42
|
+
,{name:'email',label:'E-mail',type:JRText}
|
|
43
|
+
]}
|
|
44
|
+
bottom={function(){
|
|
45
|
+
return <>
|
|
46
|
+
<button
|
|
47
|
+
onClick={()=>{
|
|
48
|
+
this.get()
|
|
49
|
+
}}
|
|
50
|
+
>Get</button>
|
|
51
|
+
<button
|
|
52
|
+
onClick={()=>{
|
|
53
|
+
this.reset()
|
|
54
|
+
}}
|
|
55
|
+
>Reset</button>
|
|
56
|
+
<button
|
|
57
|
+
onClick={()=>{
|
|
58
|
+
this.setValue(null,true)
|
|
59
|
+
}}
|
|
60
|
+
>Clear</button>
|
|
61
|
+
</>
|
|
62
|
+
}}
|
|
63
|
+
/>
|
|
64
|
+
|
|
65
|
+
{/* <JRWindow
|
|
66
|
+
title={'JRWindow'}
|
|
67
|
+
width={180}
|
|
68
|
+
height={180}
|
|
69
|
+
popup={true}
|
|
70
|
+
get={{
|
|
71
|
+
url:'data.json'
|
|
72
|
+
,autoRun:true
|
|
73
|
+
}}
|
|
74
|
+
columns={[
|
|
75
|
+
{name:'name',label:'姓名'}
|
|
76
|
+
]}
|
|
77
|
+
bottom={()=>{
|
|
78
|
+
return <button>Get</button>
|
|
79
|
+
}}
|
|
80
|
+
>
|
|
81
|
+
JRWindow
|
|
82
|
+
</JRWindow> */}
|
|
83
|
+
</>
|
|
84
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
|
|
@@ -3,6 +3,7 @@ import React from "react";
|
|
|
3
3
|
import { flexType, po } from "../JRUtils";
|
|
4
4
|
import JRFrame from "../JRFrame/JRFrame";
|
|
5
5
|
import {StyleJRFields} from "./StyleJRFields"
|
|
6
|
+
import JRWindow from "../JRWindow/JRWindow";
|
|
6
7
|
|
|
7
8
|
function checkMap(_name,inputValue,mapValue,nameList){
|
|
8
9
|
if(nameList.length) {
|
|
@@ -48,7 +49,7 @@ const StyledColumn=styled.div`
|
|
|
48
49
|
}
|
|
49
50
|
}}
|
|
50
51
|
`
|
|
51
|
-
const StyledColumnLabel=styled.
|
|
52
|
+
const StyledColumnLabel=styled.div`
|
|
52
53
|
${({$layout})=>{
|
|
53
54
|
if($layout=='v'){
|
|
54
55
|
return `text-align: start;`
|
|
@@ -157,7 +158,7 @@ const maxValidator=({value,max})=>{
|
|
|
157
158
|
|
|
158
159
|
|
|
159
160
|
|
|
160
|
-
export default class JRFields extends
|
|
161
|
+
export default class JRFields extends JRWindow {
|
|
161
162
|
UNSAFE_componentWillMount(){
|
|
162
163
|
this.#initValidateValue()
|
|
163
164
|
|
|
@@ -275,18 +276,14 @@ export default class JRFields extends JRFrame {
|
|
|
275
276
|
,fullname
|
|
276
277
|
){
|
|
277
278
|
const value=name?parentValue?.[name]:parentValue
|
|
278
|
-
|
|
279
279
|
const gap=column.gap??this.props.gap
|
|
280
280
|
const label=column.label
|
|
281
281
|
const _style=flexType(style,this,{},{})
|
|
282
282
|
if (colSpan) _style.gridColumn = `span ${colSpan}`
|
|
283
283
|
if (rowSpan) _style.gridRow = `span ${rowSpan}`
|
|
284
284
|
|
|
285
|
-
|
|
286
285
|
let content
|
|
287
|
-
|
|
288
286
|
const validators=this.createValidator({required,column})
|
|
289
|
-
|
|
290
287
|
const fn=fullname.join('.')
|
|
291
288
|
const onChange=(inputValue)=>{
|
|
292
289
|
const targetValue=inputValue?.target?.value ?? inputValue
|
|
@@ -349,6 +346,7 @@ export default class JRFields extends JRFrame {
|
|
|
349
346
|
</StyledColumnValue>
|
|
350
347
|
}
|
|
351
348
|
const layout=column.labelProps?.layout===undefined ? this.props.labelProps?.layout: column.labelProps?.layout
|
|
349
|
+
const labelStyle=column.labelProps?.style ?? this.props.labelProps?.style ?? {}
|
|
352
350
|
return <StyledColumn
|
|
353
351
|
$layout={layout}
|
|
354
352
|
$hasLabel={label!=null }
|
|
@@ -361,6 +359,7 @@ export default class JRFields extends JRFrame {
|
|
|
361
359
|
{
|
|
362
360
|
label!=null
|
|
363
361
|
&& <StyledColumnLabel
|
|
362
|
+
style={labelStyle}
|
|
364
363
|
$required={required}
|
|
365
364
|
className={'label'}
|
|
366
365
|
$layout={layout}
|
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import styled from "styled-components";
|
|
3
3
|
import JRSubmit from "../JRSubmit";
|
|
4
4
|
|
|
5
|
-
const FreeType=({tag:Tag,config,me,className})=>{
|
|
5
|
+
export const FreeType=({tag:Tag,config,me,className})=>{
|
|
6
6
|
if(typeof config==='function'){
|
|
7
7
|
let style
|
|
8
8
|
const setStyle=function(_style){
|
|
@@ -10,7 +10,10 @@ const FreeType=({tag:Tag,config,me,className})=>{
|
|
|
10
10
|
}
|
|
11
11
|
const content=config.bind(me)({setStyle})
|
|
12
12
|
return <Tag className={className} style={style}>{content}</Tag>
|
|
13
|
+
}else if(typeof config==='string'){
|
|
14
|
+
return <Tag className={className}>{config}</Tag>
|
|
13
15
|
}
|
|
16
|
+
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
const StyledJRFrame=styled.div`
|
|
@@ -28,7 +31,7 @@ const StyledJRFrame=styled.div`
|
|
|
28
31
|
flex-direction: column;
|
|
29
32
|
> *{
|
|
30
33
|
XXborder:1px solid gray;
|
|
31
|
-
|
|
34
|
+
XXmin-height:30px;
|
|
32
35
|
}
|
|
33
36
|
|
|
34
37
|
>header{
|
|
@@ -57,7 +60,7 @@ export default class JRFrame extends JRSubmit {
|
|
|
57
60
|
<FreeType tag='header' config={this.props.top} me={this}/>
|
|
58
61
|
<main>
|
|
59
62
|
<FreeType tag='div' config={this.props.left} me={this} className={'left'}/>
|
|
60
|
-
{this.renderMe()}
|
|
63
|
+
{this.renderMe?.() ?? this.props.children}
|
|
61
64
|
<FreeType tag='div' config={this.props.right} me={this} className={'right'}/>
|
|
62
65
|
</main>
|
|
63
66
|
<FreeType tag='footer' config={this.props.bottom} me={this}/>
|
|
@@ -65,8 +68,8 @@ export default class JRFrame extends JRSubmit {
|
|
|
65
68
|
<FreeType tag='div' config={this.props.end} me={this} className={'end'}/>
|
|
66
69
|
</StyledJRFrame>
|
|
67
70
|
}
|
|
68
|
-
renderMe(){
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
+
// renderMe(){
|
|
72
|
+
// return <div style={{flex:1}}>Render me</div>
|
|
73
|
+
// }
|
|
71
74
|
}
|
|
72
75
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { po } from "../JRUtils";
|
|
3
|
+
import JRInput from "./JRInput";
|
|
4
|
+
|
|
5
|
+
export default class JRSelect extends JRInput{
|
|
6
|
+
input(){
|
|
7
|
+
return <select value={this.props.value}
|
|
8
|
+
style={{
|
|
9
|
+
height: '30px'
|
|
10
|
+
,width: '100%'
|
|
11
|
+
}}
|
|
12
|
+
onChange={(e)=>{
|
|
13
|
+
this.setValue(e.target.value)
|
|
14
|
+
}}
|
|
15
|
+
>
|
|
16
|
+
<option value={1}>A</option>
|
|
17
|
+
</select>
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { po } from "../JRUtils";
|
|
3
2
|
import JRInput from "./JRInput";
|
|
4
3
|
|
|
5
4
|
export default class JRText extends JRInput{
|
|
6
5
|
input(){
|
|
7
|
-
return <input value={this.props.value}
|
|
6
|
+
return <input value={this.props.value??''}
|
|
8
7
|
style={{
|
|
9
8
|
height: '24px'
|
|
10
9
|
,width: '100%'
|
|
@@ -4,7 +4,6 @@ import { colonValueString, flexType, po } from './JRUtils'
|
|
|
4
4
|
import { displaySpinner } from './LoadingBar'
|
|
5
5
|
import styled from 'styled-components'
|
|
6
6
|
|
|
7
|
-
|
|
8
7
|
const axiosSubmit = axios.create({
|
|
9
8
|
authorization: `Bearer ${localStorage.getItem("accessToken")}`
|
|
10
9
|
,timeout: 120000
|
|
@@ -110,6 +109,8 @@ export default class JRSubmit extends React.Component {
|
|
|
110
109
|
}
|
|
111
110
|
setValue(value,reset=false){
|
|
112
111
|
if(this.props.onChange){
|
|
112
|
+
po('name',this.props.name)
|
|
113
|
+
po('onChange',value)
|
|
113
114
|
this.props.onChange(value)
|
|
114
115
|
}else{
|
|
115
116
|
this.setState({value})
|
|
@@ -278,8 +279,8 @@ export default class JRSubmit extends React.Component {
|
|
|
278
279
|
}
|
|
279
280
|
|
|
280
281
|
showMessage(success,message){
|
|
281
|
-
po('success',success)
|
|
282
|
-
po('message',message)
|
|
282
|
+
// po('success',success)
|
|
283
|
+
// po('message',message)
|
|
283
284
|
}
|
|
284
285
|
|
|
285
286
|
renderer(){
|
|
@@ -4,6 +4,7 @@ import { TBodies } from "./TBodies";
|
|
|
4
4
|
import { StyledJRTable } from "./StyledJRTable";
|
|
5
5
|
import JRFrame from "../JRFrame/JRFrame";
|
|
6
6
|
import React from "react";
|
|
7
|
+
import JRWindow from "../JRWindow/JRWindow";
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
const getMapObject=(map,names)=>{
|
|
@@ -26,14 +27,14 @@ const setMapObject=(map,names,value)=>{
|
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
export default class JRTable extends
|
|
30
|
+
export default class JRTable extends JRWindow {
|
|
30
31
|
constructor(props) {
|
|
31
32
|
super(props)
|
|
32
33
|
this.colGroupRef = React.createRef()
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
UNSAFE_componentWillMount(){
|
|
36
|
-
this.setColumns(this.props.columns)
|
|
37
|
+
this.setColumns(this.props.columns??[])
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
//------------------------------------------------------------------------------------
|
|
@@ -44,8 +44,7 @@ export const StyledJRTable=styled.div`
|
|
|
44
44
|
|
|
45
45
|
th{
|
|
46
46
|
position: relative;
|
|
47
|
-
|
|
48
|
-
padding: 4px;
|
|
47
|
+
padding: 2px 6px;
|
|
49
48
|
background: linear-gradient(180deg, rgba(227, 227, 226, 1) 0%, rgba(255, 255, 255, 1) 25%, rgba(210, 210, 210, 1) 100%);
|
|
50
49
|
box-shadow: 2px 2px 2px 0 #ffffffd6 inset, -1px -1px 2px 0px #8a847dbf inset;
|
|
51
50
|
color: #525252;
|
|
@@ -172,7 +172,7 @@ const TBody=({groupData,groupHeader,leafColumns,groupFooter,table,tbodyIndex})=>
|
|
|
172
172
|
{...neededProps}
|
|
173
173
|
/>}
|
|
174
174
|
{
|
|
175
|
-
groupData?.map((record,trIndex)=>{
|
|
175
|
+
groupData?.map?.((record,trIndex)=>{
|
|
176
176
|
const onRowClick=table.props.onRowClick?.bind(table)
|
|
177
177
|
return <tr key={trIndex}
|
|
178
178
|
onClick={()=>{
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import JRFrame from "../JRFrame/JRFrame";
|
|
3
|
+
import styled from "styled-components";
|
|
4
|
+
import TitleBar from "./TitleBar";
|
|
5
|
+
import { po } from "../JRUtils";
|
|
6
|
+
import Slider from "./Slider";
|
|
7
|
+
|
|
8
|
+
const StyledJRWindow=styled.div`
|
|
9
|
+
--padding-child:8px;
|
|
10
|
+
xborder:1px solid gray;
|
|
11
|
+
position: absolute;
|
|
12
|
+
padding: ${({$thick})=>$thick}px;
|
|
13
|
+
|
|
14
|
+
top: ${({$y})=>$y}px;
|
|
15
|
+
left: ${({$x})=>$x}px;
|
|
16
|
+
width: ${({$width=300})=>`${$width}px`};
|
|
17
|
+
height: ${({$height=300})=>`${$height}px`};
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
|
|
24
|
+
> main{
|
|
25
|
+
box-shadow: 0px 0px 5px 1px gray;
|
|
26
|
+
Xbackground: white;
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
overflow: hidden;
|
|
30
|
+
flex:1;
|
|
31
|
+
> main {
|
|
32
|
+
background: white;
|
|
33
|
+
Xpadding:var(--padding-child);
|
|
34
|
+
overflow: overlay;
|
|
35
|
+
flex:1;
|
|
36
|
+
display: flex;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
`
|
|
40
|
+
export default class JRWindow extends JRFrame {
|
|
41
|
+
x=0
|
|
42
|
+
y=0
|
|
43
|
+
width=300
|
|
44
|
+
height=300
|
|
45
|
+
padding=5
|
|
46
|
+
thick=3
|
|
47
|
+
|
|
48
|
+
constructor(props){
|
|
49
|
+
super(props)
|
|
50
|
+
this.ref=React.createRef()
|
|
51
|
+
this.titleBarRef=React.createRef()
|
|
52
|
+
if(this.props.popup===true)this.renderer=this.renderWindow
|
|
53
|
+
this.init()
|
|
54
|
+
}
|
|
55
|
+
init(){
|
|
56
|
+
this.height=window.innerHeight>=this.props.height?this.props.height:window.innerHeight
|
|
57
|
+
this.width=window.innerWidth>=this.props.width?this.props.width:window.innerWidth
|
|
58
|
+
this.x=this.props.x??((window.innerWidth-(this.width??300))/2)
|
|
59
|
+
this.y=this.props.y??(window.innerHeight-(this.height??300))/2
|
|
60
|
+
}
|
|
61
|
+
componentWillMount(){
|
|
62
|
+
}
|
|
63
|
+
// renderer(){
|
|
64
|
+
// return this.props.popup===true
|
|
65
|
+
// ?<StyledJRWindow>
|
|
66
|
+
// {super.renderer()}
|
|
67
|
+
// </StyledJRWindow>
|
|
68
|
+
// :super.renderer()
|
|
69
|
+
// }
|
|
70
|
+
renderWindow(){
|
|
71
|
+
return <StyledJRWindow
|
|
72
|
+
ref={this.ref}
|
|
73
|
+
className={`jr-window ${this.props.className??''}`}
|
|
74
|
+
$x={this.x}
|
|
75
|
+
$y={this.y}
|
|
76
|
+
$width={this.width}
|
|
77
|
+
$height={this.height}
|
|
78
|
+
$thick={this.thick}
|
|
79
|
+
// onMouseDown={()=>{
|
|
80
|
+
// po('onFocus')
|
|
81
|
+
// this.ref.current.style.zIndex=100
|
|
82
|
+
// }}
|
|
83
|
+
>
|
|
84
|
+
<main>
|
|
85
|
+
<TitleBar
|
|
86
|
+
titleBarRef={this.titleBarRef}
|
|
87
|
+
windowRef={this.ref}
|
|
88
|
+
window={this}
|
|
89
|
+
title={this.props.title}
|
|
90
|
+
/>
|
|
91
|
+
<main>
|
|
92
|
+
{super.renderer()}
|
|
93
|
+
</main>
|
|
94
|
+
</main>
|
|
95
|
+
<Slider direction={'n'} thick={this.thick} windowRef={this.ref} window={this} titleBarRef={this.titleBarRef}/>
|
|
96
|
+
<Slider direction={'e'} thick={this.thick} windowRef={this.ref} window={this} titleBarRef={this.titleBarRef}/>
|
|
97
|
+
<Slider direction={'s'} thick={this.thick} windowRef={this.ref} window={this} titleBarRef={this.titleBarRef}/>
|
|
98
|
+
<Slider direction={'w'} thick={this.thick} windowRef={this.ref} window={this} titleBarRef={this.titleBarRef}/>
|
|
99
|
+
|
|
100
|
+
<Slider direction={'nww'} thick={this.thick} windowRef={this.ref} window={this} titleBarRef={this.titleBarRef}/>
|
|
101
|
+
<Slider direction={'nnw'} thick={this.thick} windowRef={this.ref} window={this} titleBarRef={this.titleBarRef}/>
|
|
102
|
+
<Slider direction={'nne'} thick={this.thick} windowRef={this.ref} window={this} titleBarRef={this.titleBarRef}/>
|
|
103
|
+
<Slider direction={'nee'} thick={this.thick} windowRef={this.ref} window={this} titleBarRef={this.titleBarRef}/>
|
|
104
|
+
<Slider direction={'sse'} thick={this.thick} windowRef={this.ref} window={this} titleBarRef={this.titleBarRef}/>
|
|
105
|
+
<Slider direction={'see'} thick={this.thick} windowRef={this.ref} window={this} titleBarRef={this.titleBarRef}/>
|
|
106
|
+
<Slider direction={'sww'} thick={this.thick} windowRef={this.ref} window={this} titleBarRef={this.titleBarRef}/>
|
|
107
|
+
<Slider direction={'ssw'} thick={this.thick} windowRef={this.ref} window={this} titleBarRef={this.titleBarRef}/>
|
|
108
|
+
</StyledJRWindow>
|
|
109
|
+
}
|
|
110
|
+
}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import styled from "styled-components"
|
|
3
|
+
import { po } from "../JRUtils"
|
|
4
|
+
|
|
5
|
+
const borderWidth='px'
|
|
6
|
+
|
|
7
|
+
const StyledSlider=styled.div`
|
|
8
|
+
Xborder:1px solid ${({$direction:{color}})=>color};
|
|
9
|
+
xbackground:${({$direction:{color}})=>color};
|
|
10
|
+
position: absolute;
|
|
11
|
+
top: ${({$direction:{top}})=>top};
|
|
12
|
+
bottom: ${({$direction:{bottom}})=>bottom};
|
|
13
|
+
right: ${({$direction:{right}})=>right};
|
|
14
|
+
left: ${({$direction:{left}})=>left};
|
|
15
|
+
height: ${({$direction:{height}})=>height};
|
|
16
|
+
width: ${({$direction:{width}})=>width};
|
|
17
|
+
cursor: ${({$direction:{cursor}})=>cursor};
|
|
18
|
+
|
|
19
|
+
-webkit-user-select: none;
|
|
20
|
+
-khtml-user-select: none;
|
|
21
|
+
-moz-user-select: none;
|
|
22
|
+
-o-user-select: none;
|
|
23
|
+
user-select: none;
|
|
24
|
+
|
|
25
|
+
`
|
|
26
|
+
export default class Slider extends React.Component {
|
|
27
|
+
width='3px'
|
|
28
|
+
borderWidth='px'
|
|
29
|
+
borderLong='10px'
|
|
30
|
+
|
|
31
|
+
constructor(props){
|
|
32
|
+
super(props);
|
|
33
|
+
this.sliderRef=React.createRef()
|
|
34
|
+
}
|
|
35
|
+
directions={
|
|
36
|
+
n:{
|
|
37
|
+
top:0
|
|
38
|
+
,color:'red'
|
|
39
|
+
,width:'100%'
|
|
40
|
+
,height:`${this.props.thick}px`
|
|
41
|
+
,cursor: 'n-resize'
|
|
42
|
+
,resize:(props)=>{
|
|
43
|
+
this.resizeN(props)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
}
|
|
47
|
+
,e:{
|
|
48
|
+
color:'yellow'
|
|
49
|
+
,right:0
|
|
50
|
+
,width:`${this.props.thick}px`
|
|
51
|
+
,height:'100%'
|
|
52
|
+
,cursor: 'e-resize'
|
|
53
|
+
,resize:(props)=>{
|
|
54
|
+
this.resizeE(props)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
,s:{
|
|
58
|
+
color:'blue'
|
|
59
|
+
,bottom:0
|
|
60
|
+
,width:'100%'
|
|
61
|
+
,height:`${this.props.thick}px`
|
|
62
|
+
,cursor: 's-resize'
|
|
63
|
+
,resize:(props)=>{
|
|
64
|
+
this.resizeS(props)
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
,w:{
|
|
68
|
+
color:'green'
|
|
69
|
+
,left:0
|
|
70
|
+
,width:`${this.props.thick}px`
|
|
71
|
+
,height:'100%'
|
|
72
|
+
,cursor: 'w-resize'
|
|
73
|
+
,resize:(props)=>{
|
|
74
|
+
this.resizeW(props)
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
,nww:{
|
|
78
|
+
top:0
|
|
79
|
+
,left:0
|
|
80
|
+
,color:'blue'
|
|
81
|
+
,width:`${this.props.thick}px`
|
|
82
|
+
,height:this.borderLong
|
|
83
|
+
,cursor: 'nw-resize'
|
|
84
|
+
,resize:(props)=>{
|
|
85
|
+
this.resizeN(props)
|
|
86
|
+
this.resizeW(props)
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
,nnw:{
|
|
90
|
+
top:0
|
|
91
|
+
,left:0
|
|
92
|
+
,color:'blue'
|
|
93
|
+
,width:this.borderLong
|
|
94
|
+
,height:`${this.props.thick}px`
|
|
95
|
+
,cursor: 'nw-resize'
|
|
96
|
+
,resize:(props)=>{
|
|
97
|
+
this.resizeN(props)
|
|
98
|
+
this.resizeW(props)
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
,nne:{
|
|
102
|
+
top:0
|
|
103
|
+
,right:0
|
|
104
|
+
,color:'green'
|
|
105
|
+
,width:this.borderLong
|
|
106
|
+
,height:`${this.props.thick}px`
|
|
107
|
+
,cursor: 'ne-resize'
|
|
108
|
+
,resize:(props)=>{
|
|
109
|
+
this.resizeN(props)
|
|
110
|
+
this.resizeE(props)
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
,nee:{
|
|
114
|
+
top:0
|
|
115
|
+
,right:0
|
|
116
|
+
,color:'green'
|
|
117
|
+
,width:`${this.props.thick}px`
|
|
118
|
+
,height:this.borderLong
|
|
119
|
+
,cursor: 'ne-resize'
|
|
120
|
+
,resize:(props)=>{
|
|
121
|
+
this.resizeN(props)
|
|
122
|
+
this.resizeE(props)
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
,sse:{
|
|
126
|
+
color:'red'
|
|
127
|
+
,right:0
|
|
128
|
+
,bottom:0
|
|
129
|
+
,width:this.borderLong
|
|
130
|
+
,height:`${this.props.thick}px`
|
|
131
|
+
,cursor: 'se-resize'
|
|
132
|
+
,resize:(props)=>{
|
|
133
|
+
this.resizeS(props)
|
|
134
|
+
this.resizeE(props)
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
,see:{
|
|
138
|
+
color:'red'
|
|
139
|
+
,right:0
|
|
140
|
+
,bottom:0
|
|
141
|
+
,width:`${this.props.thick}px`
|
|
142
|
+
,height:this.borderLong
|
|
143
|
+
,cursor: 'se-resize'
|
|
144
|
+
,resize:(props)=>{
|
|
145
|
+
this.resizeS(props)
|
|
146
|
+
this.resizeE(props)
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
,ssw:{
|
|
150
|
+
color:'yellow'
|
|
151
|
+
,bottom:0
|
|
152
|
+
,left:0
|
|
153
|
+
,width:this.borderLong
|
|
154
|
+
,height:`${this.props.thick}px`
|
|
155
|
+
,cursor: 'sw-resize'
|
|
156
|
+
,resize:(props)=>{
|
|
157
|
+
this.resizeS(props)
|
|
158
|
+
this.resizeW(props)
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
,sww:{
|
|
162
|
+
color:'yellow'
|
|
163
|
+
,bottom:0
|
|
164
|
+
,left:0
|
|
165
|
+
,width:`${this.props.thick}px`
|
|
166
|
+
,height:this.borderLong
|
|
167
|
+
,cursor: 'sw-resize'
|
|
168
|
+
,resize:(props)=>{
|
|
169
|
+
this.resizeS(props)
|
|
170
|
+
this.resizeW(props)
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
stop=(e)=>{
|
|
176
|
+
document.body.style.cursor='default'
|
|
177
|
+
window.removeEventListener('mousemove',this.move)
|
|
178
|
+
window.removeEventListener('mouseup',this.stop)
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
resizeN=({window,cursorY,startY,startHeight,titleBarHeight})=>{
|
|
182
|
+
let y=cursorY-(this.props.thick)
|
|
183
|
+
if(y<0)y=0
|
|
184
|
+
let height=startHeight+(startY-y)
|
|
185
|
+
if(height<titleBarHeight+(this.props.thick*2)){
|
|
186
|
+
height=titleBarHeight+(this.props.thick*2)
|
|
187
|
+
y=startY + startHeight - titleBarHeight - (this.props.thick*2)
|
|
188
|
+
}
|
|
189
|
+
window.style.top=`${y}px`
|
|
190
|
+
window.style.height=`${height}px`
|
|
191
|
+
|
|
192
|
+
}
|
|
193
|
+
resizeE=({window,clientX,left,titleBarHeight})=>{
|
|
194
|
+
let width=clientX-left-this.props.thick
|
|
195
|
+
if(width<titleBarHeight)width=titleBarHeight
|
|
196
|
+
window.style.width=`${width+(this.props.thick*2)}px`
|
|
197
|
+
}
|
|
198
|
+
resizeS=({window,clientY,top,titleBarHeight})=>{
|
|
199
|
+
let height=clientY-top-this.props.thick
|
|
200
|
+
if(height<titleBarHeight)height=titleBarHeight
|
|
201
|
+
window.style.height=`${height+(this.props.thick*2)}px`
|
|
202
|
+
}
|
|
203
|
+
resizeW=({window,cursorX,startX,startWidth,titleBarHeight})=>{
|
|
204
|
+
let x=cursorX
|
|
205
|
+
if(x<=1)x=1
|
|
206
|
+
let width=startWidth+(startX-x)
|
|
207
|
+
if(width<titleBarHeight+ (this.props.thick*2)){
|
|
208
|
+
width=titleBarHeight+ (this.props.thick*2)
|
|
209
|
+
x=startX+startWidth -titleBarHeight - (this.props.thick*2)
|
|
210
|
+
}
|
|
211
|
+
window.style.left=`${x}px`
|
|
212
|
+
window.style.width=`${width}px`
|
|
213
|
+
}
|
|
214
|
+
move=(e)=>{
|
|
215
|
+
const {clientX,clientY,x:cursorX,y:cursorY}=e
|
|
216
|
+
const window=this.props.windowRef.current
|
|
217
|
+
const {left,top}=window.getBoundingClientRect()
|
|
218
|
+
const {x:startX,width:startWidth,y:startY,height:startHeight,titleBarHeight}=this.data
|
|
219
|
+
|
|
220
|
+
this.directions[this.props.direction].resize({
|
|
221
|
+
window,titleBarHeight
|
|
222
|
+
,clientX,cursorX,startX,startWidth,left
|
|
223
|
+
,clientY,cursorY,startY,startHeight,top
|
|
224
|
+
})
|
|
225
|
+
/////////////////////////////////////////////////////////////
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
/////////////////////////////////////////////////////////////
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
}
|
|
235
|
+
start=()=>{
|
|
236
|
+
const {height:titleBarHeight}=this.props.titleBarRef.current.getBoundingClientRect()
|
|
237
|
+
const {x,y,width,height}=this.props.windowRef.current.getBoundingClientRect()
|
|
238
|
+
this.data={x,y,width,height,titleBarHeight}
|
|
239
|
+
document.body.style.cursor=this.directions[this.props.direction].cursor
|
|
240
|
+
window.addEventListener('mousemove',this.move)
|
|
241
|
+
window.addEventListener('mouseup',this.stop)
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
render(){
|
|
245
|
+
return <StyledSlider
|
|
246
|
+
$direction={this.directions[this.props.direction]}
|
|
247
|
+
$padding={this.props.padding}
|
|
248
|
+
onMouseDown={this.start}
|
|
249
|
+
/>
|
|
250
|
+
}
|
|
251
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { po } from "../JRUtils";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { FreeType } from "../JRFrame/JRFrame";
|
|
5
|
+
|
|
6
|
+
const StyledTitle=styled.div`
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
display: flex;
|
|
9
|
+
padding:2px 8px;
|
|
10
|
+
border:1px solid black;
|
|
11
|
+
background:rgb(214, 214, 214);
|
|
12
|
+
color: black;
|
|
13
|
+
&:active:hover{
|
|
14
|
+
cursor: grabbing;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
-webkit-user-select: none;
|
|
18
|
+
-khtml-user-select: none;
|
|
19
|
+
-moz-user-select: none;
|
|
20
|
+
-o-user-select: none;
|
|
21
|
+
user-select: none;
|
|
22
|
+
|
|
23
|
+
> .title{
|
|
24
|
+
flex: 1;
|
|
25
|
+
}
|
|
26
|
+
`
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
export default class TitleBar extends React.Component{
|
|
32
|
+
pos1 = 0
|
|
33
|
+
pos2 = 0
|
|
34
|
+
pos3 = 0
|
|
35
|
+
pos4 = 0
|
|
36
|
+
x=0
|
|
37
|
+
y=0
|
|
38
|
+
|
|
39
|
+
move=(e)=>{
|
|
40
|
+
e.preventDefault()
|
|
41
|
+
const {clientX,clientY}=e
|
|
42
|
+
this.pos1 = this.pos3 - e.clientX
|
|
43
|
+
this.pos2 = this.pos4 - e.clientY
|
|
44
|
+
this.pos3 = e.clientX
|
|
45
|
+
this.pos4 = e.clientY
|
|
46
|
+
|
|
47
|
+
const w= this.props.windowRef.current
|
|
48
|
+
this.x=w.offsetLeft - this.pos1
|
|
49
|
+
this.y=w.offsetTop - this.pos2
|
|
50
|
+
w.style.top = this.y + 'px'
|
|
51
|
+
w.style.left = this.x + 'px'
|
|
52
|
+
}
|
|
53
|
+
stop=(e)=>{
|
|
54
|
+
// const w= this.props.windowRef.current
|
|
55
|
+
// if(this.y<1)this.props.windowRef.current.style.top = '1px'
|
|
56
|
+
// if(this.y>window.innerHeight)this.props.windowRef.current.style.top = `${window.innerHeight-32}px`
|
|
57
|
+
// if(this.x<1)this.props.windowRef.current.style.left = '1px'
|
|
58
|
+
// if(this.x>window.innerWidth)this.props.windowRef.current.style.left = `${window.innerWidth-100}px`
|
|
59
|
+
document.body.style.cursor='default'
|
|
60
|
+
window.removeEventListener('mousemove',this.move)
|
|
61
|
+
window.removeEventListener('mouseup',this.stop)
|
|
62
|
+
}
|
|
63
|
+
start(e){
|
|
64
|
+
e.preventDefault()
|
|
65
|
+
this.pos3 = e.clientX
|
|
66
|
+
this.pos4 = e.clientY
|
|
67
|
+
|
|
68
|
+
document.body.style.cursor='grabbing'
|
|
69
|
+
window.addEventListener('mousemove',this.move)
|
|
70
|
+
window.addEventListener('mouseup',this.stop)
|
|
71
|
+
}
|
|
72
|
+
render(){
|
|
73
|
+
return <StyledTitle
|
|
74
|
+
ref={this.props.titleBarRef}
|
|
75
|
+
draggable="false"
|
|
76
|
+
onMouseDown={(e)=>{
|
|
77
|
+
this.start(e)
|
|
78
|
+
}}
|
|
79
|
+
>
|
|
80
|
+
<FreeType tag='div' config={this.props.title??''} me={this.props.window} className={'title'}/>
|
|
81
|
+
<nav><button>X</button></nav>
|
|
82
|
+
</StyledTitle>
|
|
83
|
+
}
|
|
84
|
+
}
|
package/src/main.jsx
ADDED