jrs-react 1.2.12 → 1.2.14

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.
Files changed (41) hide show
  1. package/build/index.es.js +964 -3488
  2. package/build/index.js +982 -3486
  3. package/index.html +2 -2
  4. package/package.json +6 -1
  5. package/public/alert.json +4 -0
  6. package/public/data.json +10 -0
  7. package/public/data2.json +19 -0
  8. package/public/list.json +99 -0
  9. package/src/app/App.css +28 -5
  10. package/src/app/App.jsx +22 -1
  11. package/src/app/alert/AlertApp.jsx +92 -0
  12. package/src/app/axios/AxiosApp.jsx +71 -0
  13. package/src/app/fields/FieldsApp.jsx +22 -6
  14. package/src/app/fields/fieldsConfig.jsx +227 -1
  15. package/src/app/fields/tryHOC.jsx +21 -0
  16. package/src/app/fields/validator.jsx +217 -0
  17. package/src/app/index.css +1 -1
  18. package/src/app/table/tableConfig.jsx +4 -1
  19. package/src/app/test/index.jsx +8 -0
  20. package/src/app/window/WindowApp.jsx +120 -73
  21. package/src/assets/icon/index.jsx +0 -13
  22. package/src/components/JRAlert/index.jsx +71 -0
  23. package/src/components/JRFields/JRFields.jsx +178 -129
  24. package/src/components/JRFields/StyleJRFields.jsx +2 -3
  25. package/src/components/JRFields/Validators.jsx +33 -0
  26. package/src/components/JRFrame/JRFrame.jsx +12 -7
  27. package/src/components/JRFrame/JRFrameHOC.jsx +61 -0
  28. package/src/components/JRInput/JRInput.jsx +3 -2
  29. package/src/components/JRS.jsx +4 -0
  30. package/src/components/JRSubmit.jsx +1 -3
  31. package/src/components/JRTable/JRTable.jsx +10 -7
  32. package/src/components/JRTable/StyledJRTable.jsx +8 -0
  33. package/src/components/JRTable/THead.jsx +1 -1
  34. package/src/components/JRWindow/JRWindow.jsx +74 -10
  35. package/src/components/JRWindow/JRWindowHOC.jsx +114 -0
  36. package/src/components/JRWindow/Slider.jsx +21 -15
  37. package/src/components/JRWindow/Style.module.css +35 -0
  38. package/src/components/JRWindow/TitleBar.jsx +137 -35
  39. package/src/index.js +2 -1
  40. package/src/main.jsx +2 -1
  41. package/src/components/JRUtil.jsx +0 -1
@@ -1,9 +1,13 @@
1
1
  import styled from "styled-components";
2
2
  import React from "react";
3
3
  import { flexType, po } from "../JRUtils";
4
- import JRFrame from "../JRFrame/JRFrame";
4
+ // import JRFrame from "../JRFrame/JRFrame";
5
5
  import {StyleJRFields} from "./StyleJRFields"
6
6
  import JRWindow from "../JRWindow/JRWindow";
7
+ import { max, min, required } from "./Validators";
8
+ // import JRSubmit from "../JRSubmit";
9
+ // import { JRWindowHOC } from "../JRWindow/JRWindowHOC";
10
+ // import { JRFrameHOC } from "../JRFrame/JRFrameHOC";
7
11
 
8
12
  function checkMap(_name,inputValue,mapValue,nameList){
9
13
  if(nameList.length) {
@@ -54,7 +58,9 @@ const StyledColumnLabel=styled.div`
54
58
  if($layout=='v'){
55
59
  return `text-align: start;`
56
60
  }else{
57
- return `text-align: end;`
61
+ return `text-align: end;
62
+ padding: 3px 8px;
63
+ `
58
64
  }
59
65
  }}
60
66
 
@@ -82,9 +88,9 @@ const StyledColumnLabel=styled.div`
82
88
  `
83
89
  const StyledColumnValue=styled.main`
84
90
  flex:1;
85
- Xdisplay:flex;
86
91
  flex-direction: column;
87
92
  overflow: hidden;
93
+ padding: 4px 0;
88
94
 
89
95
  text-align: start;
90
96
  ${({$validateValue})=>{
@@ -112,13 +118,19 @@ const valueString=(str='',value = {})=>{
112
118
 
113
119
  const ColumnMessage=({value={},record})=>{
114
120
  if(value.isValid===false){
115
- return valueString(value.msg,record)
121
+ return value.msg?.map((msg)=>{
122
+ return valueString(msg,record)
123
+ })
124
+
116
125
  }
117
126
  }
118
127
  const StyledColumnFooter=styled.div`
119
- &:empty{
120
- display: none;
128
+ &:has(.left:empty):has(.right:empty)
129
+ {
130
+ border:1px solid blue;
131
+ display: none;
121
132
  }
133
+
122
134
  ${({$layout})=>{
123
135
  if($layout=='v'){
124
136
  return ``
@@ -141,114 +153,142 @@ const StyledColumnFooter=styled.div`
141
153
  }
142
154
  `
143
155
 
144
- function requiredValidator({value}){
145
- if( value==null || value==''){
146
- return {
147
- msg:this.msg ?? 'This is required'
148
- }
149
- }
150
- }
151
- const maxValidator=({value,max})=>{
152
- if(typeof value==='string' && value.length>max){
153
- return `Max is ${max}`
154
- }else if(value>max){
155
- return `Max is ${max}`
156
- }
157
- }
158
-
159
-
160
-
161
156
  export default class JRFields extends JRWindow {
162
157
  UNSAFE_componentWillMount(){
163
- this.#initValidateValue()
164
-
158
+ this.#initValidatorValue()
165
159
  }
166
160
  reset(){
167
- this.clearValidateValue()
161
+ this.clearTestValue()
168
162
  super.reset()
169
163
  }
164
+
170
165
  setValue(value,reset){
171
166
  super.setValue(value,reset)
172
167
  if(reset){
173
- this.clearValidateValue()
168
+ this.clearTestValue()
174
169
  }
175
170
  }
176
- //-----------------------------------------------------------------------------------
177
- #findValidator(acc,fullname,{required,...column}){
178
- const _required=required
179
- if(required==true || required?.value ){
180
- acc[fullname]={
181
- isValid:null
182
- ,validators:[requiredValidator.bind(_required)]
183
- }
171
+ //Validate-----------------------------------------------------------------------------------
172
+ #initValidatorValue(){
173
+ if(this.validateValueFrom=='state'){
174
+ this.setState({
175
+ validatorValue:{}
176
+ })
177
+ }else{
178
+ // 從props來的先不做
184
179
  }
185
180
  }
186
- #loopColumnsForValidateValue(no,_fullnameList,columns,tab,result){
187
- const validateValue= columns?.reduce((acc,{name,type,columns,...column},index)=>{
188
- no+=1
189
- const fullnameList=name?[..._fullnameList,name]:_fullnameList
190
- const fullname=fullnameList.join('.')
191
- this.#findValidator(acc,fullname,column)
192
- if(type==null&&columns){
193
- this.#loopColumnsForValidateValue(no,fullnameList,columns,`${tab}\t`,result)
194
- }
195
- return acc
196
- },result)
197
- return validateValue
198
- }
199
-
200
- clearValidateValue(){
201
- Object.values(this.getValidateValue()).forEach((v)=>v.isValid=null)
181
+ get testValueFrom(){
182
+ return this.props.testValue===undefined?'state':'props'
202
183
  }
203
- #initValidateValue(){
204
- const columns=this.getColumns()
205
- const validateValue=this.#loopColumnsForValidateValue(0,this.props.dataSourceName?[this.props.dataSourceName]:[],columns,'',{})
206
- this.setState({validateValue})
184
+ clearTestValue(){
185
+ this.setTestValue({})
207
186
  }
208
- #exeValidateConfig(validateConfig,value,record){
209
- validateConfig.isValid=true
210
- for(var i=0;i<validateConfig.validators.length;i++){
211
- const result=validateConfig.validators[i]({value,record})
212
- if(result){
213
- validateConfig.isValid=false
214
- validateConfig.msg=result.msg
215
- break
187
+ setTestValue(testValue,name){
188
+ if(this.testValueFrom=='state'){
189
+ if(name){
190
+ const newTestValue=this.getTestValue()
191
+ newTestValue[name]=testValue
192
+ this.setState({testValue:{
193
+ ...this.getTestValue()
194
+ ,...testValue
195
+ }})
196
+ }else{
197
+ this.setState({testValue})
216
198
  }
199
+ }else{
200
+ // 從props來的先不做
217
201
  }
218
202
  }
219
- validateFields(){
220
- console.clear()
221
- Object.entries(this.getValidateValue())
222
- .filter(([fullname,validateConfig])=>validateConfig.isValid!=true)
223
- .forEach(([fullname,validateConfig])=>{
224
- this.#exeValidateConfig(validateConfig,this.getValue(fullname),this.getValue())
225
- })
226
- this.setState({validateValue:this.getValidateValue()})
227
- }
228
- get validateValueFrom(){
229
- return this.props.validateValue===undefined?'state':'props'
230
- }
231
- getValidateValue(fullname){
232
- if(fullname===undefined){
233
- return this[this.validateValueFrom]?.validateValue
203
+ getTestValue(fullname){
204
+ if(fullname){
205
+ return this.state?.testValue?.[fullname]
234
206
  }else{
235
- return this[this.validateValueFrom]?.validateValue?.[fullname]
207
+ return this.state?.testValue
236
208
  }
237
209
  }
238
- setValidateValue(validateValue){
239
- if(this.props.setValidateValue){
240
- this.props.setValidateValue(validateValue)
241
- }else{
242
- this.setState({validateValue})
210
+
211
+ #validateField(column,fullNameArray,testValue,value){
212
+ const {name,validators:_validators,columns,type}=column
213
+ const fullName=fullNameArray.join('.')
214
+ const validators=_validators?[..._validators]:[]
215
+ if(column.required){
216
+ validators.push(required)
217
+ }
218
+ if(column.max){
219
+ validators.push(max)
220
+ }
221
+ if(column.min){
222
+ validators.push(min)
223
+ }
224
+ if(validators.length){
225
+ testValue[fullName]={
226
+ isValid:null
227
+ ,msg:[]
228
+ }
229
+
230
+ const promises=[]
231
+ for(let i=0;i<validators.length;i++){
232
+ const validator=validators[i].bind(this)(value,column)
233
+ if(validator?.then){
234
+ promises.push(validator)
235
+ }else if(typeof validator == 'string'){
236
+ promises.push(Promise.reject(validator))
237
+ break;
238
+ }
239
+ }
240
+ return Promise.all(promises)
241
+ .then((reason)=>{
242
+ testValue[fullName].isValid=true
243
+ return Promise.resolve(reason)
244
+ })
245
+ .catch((reason)=>{
246
+ testValue[fullName].msg.push(reason)
247
+ testValue[fullName].isValid=false
248
+ return Promise.reject(reason)
249
+ })
243
250
  }
244
251
  }
245
- createValidator({required}){
252
+ #validators(_columns,validators,names,testValue,value){
253
+ return _columns
254
+ ?.reduce((aco,column)=>{
255
+ const {name,validators,columns,type}=column
256
+ const fullNameArray=name?[...names,name]:names
257
+ const fullName=fullNameArray.join('.')
258
+
259
+ if(true){
260
+ // 要的 if(this.getTestValue(fullName)?.isValid==null){//執行過的不再執行
261
+ const validate=this.#validateField(column,fullNameArray,testValue,name?value?.[name]:value)
262
+ if(validate){
263
+ aco.push(validate)
264
+ }
265
+ }else if(this.getTestValue(fullName)?.isValid===false){
266
+ aco.push(Promise.reject())
267
+ }
268
+ if(columns && type==undefined){
269
+ this.#validators(columns,aco,fullNameArray,testValue,name?value?.[name]:value)
270
+ }
271
+ return aco
272
+ }
273
+ ,validators
274
+ )
275
+ }
276
+ validate(value){
277
+ console.clear()
246
278
  const validators=[]
247
- if(required===true && required.value){
248
- validators.push(requiredValidator)
249
- }
250
- return validators
279
+ const testValue=this.getTestValue()??{}
280
+ this.#validators(this.getColumns(),validators,[],testValue,value!==undefined?value:this.getValue())
281
+ return Promise.all(validators)
282
+ .then((msg)=>{
283
+ this.setTestValue(testValue)
284
+ return Promise.resolve()
285
+ })
286
+ .catch((msg)=>{
287
+ this.setTestValue(testValue)
288
+ return Promise.reject()
289
+ })
251
290
  }
291
+
252
292
  //--------------------------------------------------------------------------------------
253
293
  get columnsFrom(){
254
294
  return this.props.initColumns!==undefined?'state':'props'
@@ -257,10 +297,6 @@ export default class JRFields extends JRWindow {
257
297
  return this[this.columnsFrom]?.columns
258
298
  }
259
299
  //-------------------------------------------------------------------------------------------
260
-
261
- get colon(){
262
- return this.props.labelProps?.colon===undefined ?':':this.props.labelProps?.colon
263
- }
264
300
 
265
301
  createColumn(
266
302
  parentValue
@@ -268,23 +304,23 @@ export default class JRFields extends JRWindow {
268
304
  type,name,colSpan,rowSpan
269
305
  ,style
270
306
  ,typeStyle:_typeStyle
271
- ,required
307
+ ,columnStyle
272
308
  ,...column
273
309
  }
274
310
  ,index
275
311
  ,parentName
276
- ,fullname
312
+ ,fullnameArray
313
+ ,labelProps
277
314
  ){
278
315
  const value=name?parentValue?.[name]:parentValue
279
316
  const gap=column.gap??this.props.gap
280
317
  const label=column.label
281
318
  const _style=flexType(style,this,{},{})
319
+ const _columnStyle=flexType(columnStyle,this,{},{})
282
320
  if (colSpan) _style.gridColumn = `span ${colSpan}`
283
321
  if (rowSpan) _style.gridRow = `span ${rowSpan}`
284
322
 
285
323
  let content
286
- const validators=this.createValidator({required,column})
287
- const fn=fullname.join('.')
288
324
  const onChange=(inputValue)=>{
289
325
  const targetValue=inputValue?.target?.value ?? inputValue
290
326
  try{
@@ -295,7 +331,15 @@ export default class JRFields extends JRWindow {
295
331
  checkMap(name,targetValue,_value,[...parentName])
296
332
  this.setValue(_value)
297
333
  }
298
- if(this.getValidateValue()[fn]) this.#exeValidateConfig(this.getValidateValue()[fn],targetValue,this.getValue())
334
+
335
+ const testValue=this.getTestValue()??{}
336
+ this.#validateField(column,fullnameArray,testValue,targetValue)
337
+ ?.then(()=>{
338
+ this.setTestValue(testValue)
339
+ })
340
+ .catch(()=>{
341
+ this.setTestValue(testValue)
342
+ })
299
343
  }
300
344
 
301
345
  const _parentName=[...parentName]
@@ -308,26 +352,31 @@ export default class JRFields extends JRWindow {
308
352
  content=<StyledColumnValue className={'jr-column-value'}
309
353
  style={{
310
354
  gridColumn:label==null?'span 2':null
355
+ ,..._columnStyle
311
356
  }}
312
357
  >
313
358
  {
314
359
  React.createElement(
315
360
  type
316
361
  ,{
317
- value:value,onChange,record:parentValue,style:{width:'100%',...typeStyle}
362
+ value:value,onChange,record:parentValue
363
+ ,style:{width:'100%',...typeStyle}
318
364
  ,...column
319
365
  }
320
366
  )
321
367
  }
322
368
  </StyledColumnValue>
323
369
  }else if(column.columns){
324
- content=<StyledGrid cols={column.cols} className={'jr-grid'} $gap={gap}>
370
+ content=<StyledGrid cols={column.cols} className={'jr-grid'} $gap={gap}
371
+ style={_columnStyle}
372
+ >
325
373
  {
326
374
  this.createColumns(
327
375
  value
328
376
  ,column.columns
329
377
  ,_parentName
330
- ,fullname
378
+ ,fullnameArray
379
+ ,column.labelProps??this.props.labelProps
331
380
  )
332
381
  }
333
382
  </StyledGrid>
@@ -340,12 +389,13 @@ export default class JRFields extends JRWindow {
340
389
  >
341
390
  {
342
391
  column.render
343
- ?column.render.bind(this)({onChange,value: value,record:this.getValue()})
344
- :typeof value ==='object'?JSON.stringify(value):value
392
+ ?column.render.bind(this)({onChange,value: value,record:this.getValue()})
393
+ :typeof value ==='object'?JSON.stringify(value):value
345
394
  }
346
395
  </StyledColumnValue>
347
396
  }
348
- const layout=column.labelProps?.layout===undefined ? this.props.labelProps?.layout: column.labelProps?.layout
397
+ const layout=labelProps?.layout
398
+ const colon=labelProps?.colon === undefined ? ':' :labelProps.colon
349
399
  const labelStyle=column.labelProps?.style ?? this.props.labelProps?.style ?? {}
350
400
  return <StyledColumn
351
401
  $layout={layout}
@@ -360,59 +410,58 @@ export default class JRFields extends JRWindow {
360
410
  label!=null
361
411
  && <StyledColumnLabel
362
412
  style={labelStyle}
363
- $required={required}
413
+ $required={column.required}
364
414
  className={'label'}
365
415
  $layout={layout}
366
- $colon={column.labelProps?.colon===undefined ? this.colon:column.labelProps?.colon}>{label}
416
+ $colon={colon}
417
+ >
418
+ {label}
367
419
  </StyledColumnLabel>
368
420
  }
369
421
  {content}
370
- { this.props.debugMode &&
371
- <StyledColumnFooter>
372
- <div className="left">
373
- <ColumnMessage value={this.getValidateValue(_parentName.join('.'))} record={this.getValue()}/>
374
- </div>
375
- <div className="right">
376
- {/* {_parentName.join('.')} */}
377
- </div>
378
- </StyledColumnFooter>
379
- // validateValue?.[name]!==undefined && <StyledColumnFooter $layout={layout}>
380
- // {/* {validateValue?.[name]?.$message} */}
381
- // <ColumnMessage value={validateValue?.[name]}/>
382
- // </StyledColumnFooter>
383
- }
384
-
422
+ <StyledColumnFooter
423
+ $layout={layout}
424
+ >
425
+ <div className="left">
426
+ {
427
+ this.getTestValue(_parentName.join('.'))?.msg?.map((msg)=>{
428
+ return msg
429
+ })
430
+ }
431
+ </div>
432
+ <div className="right">
433
+ </div>
434
+ </StyledColumnFooter>
385
435
  </StyledColumn>
386
436
  }
387
437
 
388
- createColumns(parentValue,columns,parentName,fullname){
438
+ createColumns(parentValue,columns,parentName,fullname,labelProps){
389
439
  return columns?.map((column,index)=>{
390
440
  return this.createColumn(
391
441
  parentValue
392
442
  ,column,index,parentName
393
443
  ,column.name?[...fullname,column.name]:fullname
444
+ ,labelProps
394
445
  )
395
446
  })
396
447
  }
397
448
 
398
-
399
-
400
449
  renderMe(){
401
450
  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'}>
451
+ <StyledGrid cols={this.props.cols} style={this.props.gridStyle} className={'jr-grid'} $gap={this.props.gap}>
403
452
  {
404
453
  this.createColumns(
405
454
  this.props.dataSourceName?this.getValue()?.[this.props.dataSourceName]:this.getValue()
406
455
  ,this.props.columns
407
456
  ,this.props.dataSourceName?[this.props.dataSourceName]:[]
408
457
  ,this.props.dataSourceName?[this.props.dataSourceName]:[]
458
+ ,this.props.labelProps
409
459
  )
410
460
  }
411
461
  </StyledGrid>
412
462
  </StyleJRFields>
413
463
  }
464
+ }
414
465
 
415
- // render(){
416
- // return this.renderMe()
417
- // }
418
- }
466
+ // export const FFields=JRFrameHOC(JRFields)
467
+ // export const WFields=JRWindowHOC(FFields)
@@ -8,16 +8,15 @@ export const StyleJRFields=styled.main`
8
8
  flex-direction: column;
9
9
  flex:1;
10
10
  overflow: overlay;
11
- padding: 10px;
12
11
 
13
12
  color:#525252;
14
-
13
+
15
14
  >.jr-grid{
15
+ padding: 10px;
16
16
  .jr-column{
17
17
  > .label{
18
18
  color:#525252;
19
19
  text-wrap: nowrap;
20
- padding: 3px 8px;
21
20
  font-weight: bold;
22
21
  }
23
22
  > .jr-column-value{
@@ -0,0 +1,33 @@
1
+ import { po } from "../JRUtils"
2
+
3
+ export function required(value){
4
+ return value==null || value=='' || value.trim?.()==''
5
+ ? 'This is required'
6
+ : true
7
+ }
8
+
9
+ export function max(value,colum){
10
+ return value==null
11
+ ? true
12
+ :(typeof value ==='string') && (value.length > colum.max)
13
+ ? `Length can not more than ${colum.max}`
14
+ :Array.isArray(value) && (value.length > colum.max)
15
+ ? `Length can not more than ${colum.max}`
16
+ :(typeof value ==='number') && value > colum.max
17
+ ? `Length can not more than ${colum.max}`
18
+ :true
19
+
20
+ }
21
+
22
+
23
+ export function min(value,colum){
24
+ return value=null
25
+ ? true
26
+ :(typeof value ==='string') && (colum.min > value.length)
27
+ ? `Length can not less than ${colum.min}`
28
+ :Array.isArray(value) && (colum.min > value.length )
29
+ ? `Length can not less than ${colum.min}`
30
+ :(typeof value ==='number') && colum.min > value
31
+ ? `Can not less than ${colum.min}`
32
+ :true
33
+ }
@@ -27,7 +27,7 @@ const StyledJRFrame=styled.div`
27
27
  >main{
28
28
  display:flex;
29
29
  flex:1;
30
- overflow:overlay;
30
+ overflow:hidden;
31
31
  flex-direction: column;
32
32
  > *{
33
33
  XXborder:1px solid gray;
@@ -42,6 +42,13 @@ const StyledJRFrame=styled.div`
42
42
  display:flex;
43
43
  flex:1;
44
44
  overflow:hidden;
45
+
46
+ >main{
47
+ display:flex;
48
+ flex:1;
49
+ overflow: overlay;
50
+ }
51
+
45
52
  }
46
53
  >footer{
47
54
  XXborder:1px solid blue;
@@ -49,18 +56,19 @@ const StyledJRFrame=styled.div`
49
56
  }
50
57
 
51
58
  }
52
-
53
59
  `
54
60
 
55
61
  export default class JRFrame extends JRSubmit {
56
62
  renderer(){
57
- return <StyledJRFrame style={this.props.style} className={`${this.props.className} jr-frame`} >
63
+ return <StyledJRFrame id={this.props.id} style={this.props.style} className={`${this.props.className} jr-frame`} >
58
64
  <FreeType tag='div' config={this.props.start} me={this} className={'start'}/>
59
65
  <main>
60
66
  <FreeType tag='header' config={this.props.top} me={this}/>
61
67
  <main>
62
68
  <FreeType tag='div' config={this.props.left} me={this} className={'left'}/>
63
- {this.renderMe?.() ?? this.props.children}
69
+ <main className={'body'}>
70
+ {this.renderMe?.() ?? this.props.children}
71
+ </main>
64
72
  <FreeType tag='div' config={this.props.right} me={this} className={'right'}/>
65
73
  </main>
66
74
  <FreeType tag='footer' config={this.props.bottom} me={this}/>
@@ -68,8 +76,5 @@ export default class JRFrame extends JRSubmit {
68
76
  <FreeType tag='div' config={this.props.end} me={this} className={'end'}/>
69
77
  </StyledJRFrame>
70
78
  }
71
- // renderMe(){
72
- // return <div style={{flex:1}}>Render me</div>
73
- // }
74
79
  }
75
80
 
@@ -0,0 +1,61 @@
1
+ import React from "react"
2
+ import styled from "styled-components"
3
+ import { FreeType } from "./JRFrame"
4
+
5
+
6
+ const StyledJRFrame=styled.div`
7
+ display:flex;
8
+ flex:1;
9
+ overflow:hidden;
10
+
11
+ > *{
12
+ Xborder:1px solid gray;
13
+ }
14
+ >main{
15
+ display:flex;
16
+ flex:1;
17
+ overflow:overlay;
18
+ flex-direction: column;
19
+ > *{
20
+ XXborder:1px solid gray;
21
+ XXmin-height:30px;
22
+ }
23
+
24
+ >header{
25
+ XXborder:1px solid red;
26
+ XXoverflow: overlay;
27
+ }
28
+ >main{
29
+ display:flex;
30
+ flex:1;
31
+ overflow:hidden;
32
+ }
33
+ >footer{
34
+ XXborder:1px solid blue;
35
+ overflow: overlay;
36
+ }
37
+
38
+ }
39
+
40
+ `
41
+
42
+ export const JRFrameHOC = (WrappedComponent) => {
43
+ return class extends React.Component {
44
+ render(){
45
+ const {style,className,start,top,left,right,bottom,end,...props}=this.props
46
+ return <StyledJRFrame style={style} className={`${className} jr-frame`} >
47
+ <FreeType tag='div' config={start} me={this} className={'start'}/>
48
+ <main>
49
+ <FreeType tag='header' config={top} me={this}/>
50
+ <main>
51
+ <FreeType tag='div' config={left} me={this} className={'left'}/>
52
+ <WrappedComponent {...props} />
53
+ <FreeType tag='div' config={right} me={this} className={'right'}/>
54
+ </main>
55
+ <FreeType tag='footer' config={bottom} me={this}/>
56
+ </main>
57
+ <FreeType tag='div' config={end} me={this} className={'end'}/>
58
+ </StyledJRFrame>
59
+ }
60
+ }
61
+ }
@@ -1,10 +1,11 @@
1
1
  import React from "react";
2
2
  import styled from "styled-components";
3
3
 
4
-
5
-
6
4
  const StyledInput=styled.div`
7
5
  display:flex;
6
+ input:focus{
7
+ outline: none;
8
+ }
8
9
  `
9
10
  export default class JRInput extends React.Component{
10
11
  setValue(value){
@@ -0,0 +1,4 @@
1
+
2
+ export default function JRS(){
3
+ return <div id={'jrs'}/>
4
+ }
@@ -102,15 +102,13 @@ export default class JRSubmit extends React.Component {
102
102
  return this.state?.rawValue
103
103
  }
104
104
  setRawValue(rawValue){
105
- this.setState({rawValue:JSON.parse(JSON.stringify(rawValue??''))})
105
+ this.setState({rawValue:rawValue!=null?JSON.parse(JSON.stringify(rawValue)):null})
106
106
  }
107
107
  reset(){
108
108
  this.setValue(this.rawValue,true)
109
109
  }
110
110
  setValue(value,reset=false){
111
111
  if(this.props.onChange){
112
- po('name',this.props.name)
113
- po('onChange',value)
114
112
  this.props.onChange(value)
115
113
  }else{
116
114
  this.setState({value})