jrs-react 1.2.4 → 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/build/index.es.js +11 -20
- package/build/index.js +11 -20
- package/index.html +13 -0
- package/package.json +14 -3
- package/public/data.json +9 -0
- package/public/list.json +20 -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 +11 -16
- package/src/components/JRFields/StyleJRFields.jsx +7 -10
- package/src/components/JRFrame/JRFrame.jsx +9 -6
- package/src/components/JRInput/JRInput.jsx +18 -0
- package/src/components/JRInput/JRSelect.jsx +19 -0
- package/src/components/JRInput/JRText.jsx +12 -3
- 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
|
@@ -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;`
|
|
@@ -80,8 +81,9 @@ const StyledColumnLabel=styled.label`
|
|
|
80
81
|
|
|
81
82
|
`
|
|
82
83
|
const StyledColumnValue=styled.main`
|
|
83
|
-
|
|
84
|
+
flex:1;
|
|
84
85
|
Xdisplay:flex;
|
|
86
|
+
flex-direction: column;
|
|
85
87
|
overflow: hidden;
|
|
86
88
|
|
|
87
89
|
text-align: start;
|
|
@@ -156,7 +158,7 @@ const maxValidator=({value,max})=>{
|
|
|
156
158
|
|
|
157
159
|
|
|
158
160
|
|
|
159
|
-
export default class JRFields extends
|
|
161
|
+
export default class JRFields extends JRWindow {
|
|
160
162
|
UNSAFE_componentWillMount(){
|
|
161
163
|
this.#initValidateValue()
|
|
162
164
|
|
|
@@ -186,7 +188,6 @@ export default class JRFields extends JRFrame {
|
|
|
186
188
|
no+=1
|
|
187
189
|
const fullnameList=name?[..._fullnameList,name]:_fullnameList
|
|
188
190
|
const fullname=fullnameList.join('.')
|
|
189
|
-
// po(`${no} - ${tab}fn= ${fullname}`)
|
|
190
191
|
this.#findValidator(acc,fullname,column)
|
|
191
192
|
if(type==null&&columns){
|
|
192
193
|
this.#loopColumnsForValidateValue(no,fullnameList,columns,`${tab}\t`,result)
|
|
@@ -264,7 +265,8 @@ export default class JRFields extends JRFrame {
|
|
|
264
265
|
createColumn(
|
|
265
266
|
parentValue
|
|
266
267
|
,{
|
|
267
|
-
type,name,colSpan,rowSpan
|
|
268
|
+
type,name,colSpan,rowSpan
|
|
269
|
+
,style
|
|
268
270
|
,typeStyle:_typeStyle
|
|
269
271
|
,required
|
|
270
272
|
,...column
|
|
@@ -273,27 +275,18 @@ export default class JRFields extends JRFrame {
|
|
|
273
275
|
,parentName
|
|
274
276
|
,fullname
|
|
275
277
|
){
|
|
276
|
-
// po('----------------------------------------')
|
|
277
|
-
// po('parentName',parentName)
|
|
278
|
-
// po('fullname',fullname)
|
|
279
278
|
const value=name?parentValue?.[name]:parentValue
|
|
280
|
-
|
|
281
279
|
const gap=column.gap??this.props.gap
|
|
282
280
|
const label=column.label
|
|
283
281
|
const _style=flexType(style,this,{},{})
|
|
284
282
|
if (colSpan) _style.gridColumn = `span ${colSpan}`
|
|
285
283
|
if (rowSpan) _style.gridRow = `span ${rowSpan}`
|
|
286
|
-
// Object.assign(_style,style)
|
|
287
|
-
|
|
288
284
|
|
|
289
285
|
let content
|
|
290
|
-
|
|
291
286
|
const validators=this.createValidator({required,column})
|
|
292
|
-
|
|
293
287
|
const fn=fullname.join('.')
|
|
294
288
|
const onChange=(inputValue)=>{
|
|
295
289
|
const targetValue=inputValue?.target?.value ?? inputValue
|
|
296
|
-
// po('===Form onChange===',targetValue)
|
|
297
290
|
try{
|
|
298
291
|
parentValue[name]=targetValue
|
|
299
292
|
this.setValue({...this.getValue()})
|
|
@@ -353,6 +346,7 @@ export default class JRFields extends JRFrame {
|
|
|
353
346
|
</StyledColumnValue>
|
|
354
347
|
}
|
|
355
348
|
const layout=column.labelProps?.layout===undefined ? this.props.labelProps?.layout: column.labelProps?.layout
|
|
349
|
+
const labelStyle=column.labelProps?.style ?? this.props.labelProps?.style ?? {}
|
|
356
350
|
return <StyledColumn
|
|
357
351
|
$layout={layout}
|
|
358
352
|
$hasLabel={label!=null }
|
|
@@ -365,6 +359,7 @@ export default class JRFields extends JRFrame {
|
|
|
365
359
|
{
|
|
366
360
|
label!=null
|
|
367
361
|
&& <StyledColumnLabel
|
|
362
|
+
style={labelStyle}
|
|
368
363
|
$required={required}
|
|
369
364
|
className={'label'}
|
|
370
365
|
$layout={layout}
|
|
@@ -403,8 +398,8 @@ export default class JRFields extends JRFrame {
|
|
|
403
398
|
|
|
404
399
|
|
|
405
400
|
renderMe(){
|
|
406
|
-
return <StyleJRFields className={'jr-fields'}>
|
|
407
|
-
<StyledGrid cols={this.props.cols} style={this.props.gridStyle} className={'jr-grid'} $gap={this.props.gap}>
|
|
401
|
+
return <StyleJRFields className={'jr-fields'} style={this.props.typeStyle}>
|
|
402
|
+
<StyledGrid cols={this.props.cols} style={this.props.gridStyle} className={'jr-grid'} $gap={this.props.gap??'8px'}>
|
|
408
403
|
{
|
|
409
404
|
this.createColumns(
|
|
410
405
|
this.props.dataSourceName?this.getValue()?.[this.props.dataSourceName]:this.getValue()
|
|
@@ -2,29 +2,26 @@ import styled from "styled-components";
|
|
|
2
2
|
|
|
3
3
|
export const StyleJRFields=styled.main`
|
|
4
4
|
--column-bd-color:#cccccc;
|
|
5
|
-
--column-b-color
|
|
5
|
+
--column-b-color:unset;
|
|
6
6
|
--column-b-hover-color:#ffffff;
|
|
7
7
|
|
|
8
8
|
flex-direction: column;
|
|
9
9
|
flex:1;
|
|
10
10
|
overflow: overlay;
|
|
11
|
-
|
|
11
|
+
padding: 10px;
|
|
12
|
+
|
|
12
13
|
color:#525252;
|
|
13
|
-
XXXborder: 1px solid #a0a0a0;
|
|
14
|
-
background: var(--column-b-color);
|
|
15
14
|
|
|
16
15
|
>.jr-grid{
|
|
17
|
-
background:var(--column-b-color);
|
|
18
|
-
|
|
19
16
|
.jr-column{
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
label{
|
|
17
|
+
> .label{
|
|
23
18
|
color:#525252;
|
|
24
19
|
text-wrap: nowrap;
|
|
25
|
-
padding:
|
|
20
|
+
padding: 3px 8px;
|
|
26
21
|
font-weight: bold;
|
|
27
22
|
}
|
|
23
|
+
> .jr-column-value{
|
|
24
|
+
}
|
|
28
25
|
}
|
|
29
26
|
}
|
|
30
27
|
`
|
|
@@ -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,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
const StyledInput=styled.div`
|
|
7
|
+
display:flex;
|
|
8
|
+
`
|
|
9
|
+
export default class JRInput extends React.Component{
|
|
10
|
+
setValue(value){
|
|
11
|
+
this.props?.onChange?.(value)
|
|
12
|
+
}
|
|
13
|
+
render(){
|
|
14
|
+
return <StyledInput>
|
|
15
|
+
{this.input()}
|
|
16
|
+
</StyledInput>
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -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,7 +1,16 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import JRInput from "./JRInput";
|
|
2
3
|
|
|
3
|
-
export default class JRText extends
|
|
4
|
-
|
|
5
|
-
return <input value={this.props.value}
|
|
4
|
+
export default class JRText extends JRInput{
|
|
5
|
+
input(){
|
|
6
|
+
return <input value={this.props.value??''}
|
|
7
|
+
style={{
|
|
8
|
+
height: '24px'
|
|
9
|
+
,width: '100%'
|
|
10
|
+
}}
|
|
11
|
+
onChange={(e)=>{
|
|
12
|
+
this.setValue(e.target.value)
|
|
13
|
+
}}
|
|
14
|
+
/>
|
|
6
15
|
}
|
|
7
16
|
}
|
|
@@ -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
|
+
}
|