jrs-react 1.2.22 → 1.2.24
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 +80 -5914
- package/build/index.js +80 -5955
- package/package.json +1 -1
- package/src/components/JRFields/StyleJRFields.jsx +4 -1
- package/src/components/JRFrame/JRFrame.jsx +4 -3
- package/src/components/JRMask/JRMask.jsx +33 -23
- package/src/components/JRSubmit.jsx +5 -14
- package/src/components/JRTable/JRTable.jsx +1 -1
- package/src/components/JRTable/StyledJRTable.jsx +4 -4
- package/src/components/JRWindow/JRWindow.jsx +21 -15
- package/src/components/JRWindow/Slider.jsx +9 -7
- package/src/components/JRWindow/TitleBar.jsx +1 -1
- package/src/index.js +1 -1
- package/index.html +0 -13
- package/public/alert.json +0 -4
- package/public/data.json +0 -29
- package/public/data2.json +0 -19
- package/public/list.json +0 -132
- package/public/vite.svg +0 -1
- package/src/app/App.css +0 -42
- package/src/app/App.jsx +0 -35
- package/src/app/alert/AlertApp.jsx +0 -92
- package/src/app/axios/AxiosApp.jsx +0 -71
- package/src/app/dev/devApp.jsx +0 -146
- package/src/app/dev/tobeimport.js +0 -7
- package/src/app/fields/FieldsApp.jsx +0 -46
- package/src/app/fields/fieldsConfig.jsx +0 -472
- package/src/app/fields/tryHOC.jsx +0 -21
- package/src/app/fields/validator.jsx +0 -217
- package/src/app/index.css +0 -42
- package/src/app/input/InputApp.jsx +0 -43
- package/src/app/table/TableApp.jsx +0 -10
- package/src/app/table/tableConfig.jsx +0 -89
- package/src/app/test/index.jsx +0 -48
- package/src/app/window/WindowApp.jsx +0 -165
- package/vite.config.js +0 -15
- /package/src/components/JRAlert/{index.jsx → JRAlert.jsx} +0 -0
|
@@ -1,472 +0,0 @@
|
|
|
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
|
-
import styled from "styled-components";
|
|
8
|
-
import JRCheckbox from "../../components/JRInput/JRCheckbox";
|
|
9
|
-
import JRRadio from "../../components/JRInput/JRRadio";
|
|
10
|
-
|
|
11
|
-
export const fieldsConfig={
|
|
12
|
-
popup:true
|
|
13
|
-
,open:true
|
|
14
|
-
,mask:true
|
|
15
|
-
,width:'700px'
|
|
16
|
-
,height:'500px'
|
|
17
|
-
|
|
18
|
-
,get:{
|
|
19
|
-
url:'data.json'
|
|
20
|
-
,autoRun:true
|
|
21
|
-
,successMessage:'YES'
|
|
22
|
-
,mask:'Loading'
|
|
23
|
-
}
|
|
24
|
-
,style:{
|
|
25
|
-
padding:'18px'
|
|
26
|
-
,background:'black'
|
|
27
|
-
,gap:'20px'
|
|
28
|
-
}
|
|
29
|
-
,typeStyle:{
|
|
30
|
-
padding:'8px'
|
|
31
|
-
,background:'#eeeeee'
|
|
32
|
-
}
|
|
33
|
-
,columns:[
|
|
34
|
-
{name:'name',label:'姓名',type:JRText}
|
|
35
|
-
,{name:'birthday',label:'生日',type:Input}
|
|
36
|
-
,{name:'phone',label:'電話號碼',type:JRTable
|
|
37
|
-
,top({setStyle}){
|
|
38
|
-
return <>
|
|
39
|
-
<button
|
|
40
|
-
onClick={()=>{
|
|
41
|
-
this.get()
|
|
42
|
-
}}
|
|
43
|
-
>Get</button>
|
|
44
|
-
<button
|
|
45
|
-
onClick={()=>{
|
|
46
|
-
this.reset()
|
|
47
|
-
}}
|
|
48
|
-
>Reset</button>
|
|
49
|
-
</>
|
|
50
|
-
}
|
|
51
|
-
,bottom({setStyle}){
|
|
52
|
-
setStyle({color:'green',border:'1px solid green',height:'140px',overflow: 'overlay'})
|
|
53
|
-
return<div style={{
|
|
54
|
-
display: 'flex'
|
|
55
|
-
,justifyContent: 'space-around'
|
|
56
|
-
}}>
|
|
57
|
-
<pre style={{flex:1}}>
|
|
58
|
-
{JSON.stringify(this.getValue(),4,4)}
|
|
59
|
-
</pre>
|
|
60
|
-
<pre style={{flex:1}}>
|
|
61
|
-
{JSON.stringify(this.rawValue,4,4)}
|
|
62
|
-
</pre>
|
|
63
|
-
</div>
|
|
64
|
-
}
|
|
65
|
-
,get:{
|
|
66
|
-
url:'list.json'
|
|
67
|
-
}
|
|
68
|
-
,colSpan:2
|
|
69
|
-
,resizableColumns:true
|
|
70
|
-
,typeStyle:{
|
|
71
|
-
height:'300px'
|
|
72
|
-
}
|
|
73
|
-
,columns:[
|
|
74
|
-
{name:'name',label:'電信公司'}
|
|
75
|
-
,{name:'phone',label:'號碼',type:JRText}
|
|
76
|
-
,{
|
|
77
|
-
name:'address'
|
|
78
|
-
,label:'地址'
|
|
79
|
-
,type:JRFields
|
|
80
|
-
,labelProps:{
|
|
81
|
-
width:'min-content'
|
|
82
|
-
,style:{
|
|
83
|
-
paddingLeft:'20px'
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
,columns:[
|
|
87
|
-
{name:'no',label:'門牌',type:JRText}
|
|
88
|
-
,{name:'street',label:'街',type:JRText}
|
|
89
|
-
,{name:'country',label:'國家',type:JRSelect}
|
|
90
|
-
,{name:'p',label:'郵區',type:JRText}
|
|
91
|
-
]
|
|
92
|
-
,cols:4
|
|
93
|
-
}
|
|
94
|
-
]
|
|
95
|
-
}
|
|
96
|
-
// ,{
|
|
97
|
-
// name:'address'
|
|
98
|
-
// ,label:'地址'
|
|
99
|
-
// ,type:JRFields
|
|
100
|
-
// ,colSpan:2
|
|
101
|
-
// ,columns:[
|
|
102
|
-
// {name:'no',label:'號碼',type:JRText}
|
|
103
|
-
// ,{name:'street',label:'街',type:JRText}
|
|
104
|
-
// ,{name:'country',label:'國家',type:JRText}
|
|
105
|
-
// ]
|
|
106
|
-
// ,cols:1
|
|
107
|
-
// }
|
|
108
|
-
// ,{name:'email',label:'電子郵件',type:JRText}
|
|
109
|
-
// ,{name:'account',label:'帳號'}
|
|
110
|
-
]
|
|
111
|
-
,cols:2
|
|
112
|
-
,right({setStyle}){
|
|
113
|
-
setStyle({color:'green',border:'1px solid green',width:'100px',whiteSpace:'pre',overflow: 'overlay'})
|
|
114
|
-
return <>
|
|
115
|
-
<button
|
|
116
|
-
onClick={()=>{
|
|
117
|
-
this.get()
|
|
118
|
-
}}
|
|
119
|
-
>Get</button>
|
|
120
|
-
<button
|
|
121
|
-
onClick={()=>{
|
|
122
|
-
this.reset()
|
|
123
|
-
}}
|
|
124
|
-
>Reset</button>
|
|
125
|
-
</>
|
|
126
|
-
}
|
|
127
|
-
,bottom({setStyle}){
|
|
128
|
-
setStyle({color:'gray',border:'1px solid blue',whiteSpace:'pre',overflow: 'overlay'})
|
|
129
|
-
return <div style={{
|
|
130
|
-
display: 'flex'
|
|
131
|
-
,justifyContent: 'space-around'
|
|
132
|
-
}}>
|
|
133
|
-
<pre>
|
|
134
|
-
{JSON.stringify(this.getValue(),4,4)}
|
|
135
|
-
</pre>
|
|
136
|
-
<pre>rawValue
|
|
137
|
-
{JSON.stringify(this.rawValue,4,4)}
|
|
138
|
-
</pre>
|
|
139
|
-
</div>
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
//////////////////////////////////////////////////////
|
|
143
|
-
export const normalFields={
|
|
144
|
-
get:{
|
|
145
|
-
url:'data.json'
|
|
146
|
-
,autoRun:true
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
,columns:[
|
|
150
|
-
{name:'name',label:'Name',type:JRText,required:true}
|
|
151
|
-
,{name:'account',label:'Account',type:JRText
|
|
152
|
-
,validators:[
|
|
153
|
-
function(){
|
|
154
|
-
return 'Account always error'
|
|
155
|
-
}
|
|
156
|
-
]
|
|
157
|
-
}
|
|
158
|
-
,{name:'email',label:'Email',type:JRText}
|
|
159
|
-
,{name:'birthday',label:'Birthday',type:JRText}
|
|
160
|
-
,{name:'address',label:'Address',type:JRFields
|
|
161
|
-
,columns:[
|
|
162
|
-
{name:'no',label:'No',type:JRText,required:true}
|
|
163
|
-
,{name:'street',label:'Street',type:JRText}
|
|
164
|
-
,{name:'country',label:'Country',type:JRText}
|
|
165
|
-
]
|
|
166
|
-
,labelProps:{
|
|
167
|
-
layout:'h'
|
|
168
|
-
,colon:":"
|
|
169
|
-
}
|
|
170
|
-
,style:{
|
|
171
|
-
// border:'1px solid red'
|
|
172
|
-
}
|
|
173
|
-
,typeStyle:{
|
|
174
|
-
// border:'1px solid blue'
|
|
175
|
-
}
|
|
176
|
-
,columnStyle:{
|
|
177
|
-
padding:'0 10px 0 0'
|
|
178
|
-
,marginTop: '4px'
|
|
179
|
-
,border:'1px solid gray'
|
|
180
|
-
,borderRadius: '3px'
|
|
181
|
-
}
|
|
182
|
-
,gridStyle:{
|
|
183
|
-
padding:'unset'
|
|
184
|
-
// ,border:'1px solid black'
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
,{
|
|
188
|
-
columns:[
|
|
189
|
-
{name:'father',label:'Father',type:JRText,required:true
|
|
190
|
-
,labelProps:{
|
|
191
|
-
width:'min-content'
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
,{name:'mother',label:'Mother',type:JRText,required:true
|
|
195
|
-
,labelProps:{
|
|
196
|
-
width:'min-content'
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
,{name:'yo',label:'Yo',type:JRText,required:true
|
|
200
|
-
,labelProps:{
|
|
201
|
-
width:'min-content'
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
]
|
|
205
|
-
,cols:2
|
|
206
|
-
,columnStyle:{
|
|
207
|
-
padding:'6px'
|
|
208
|
-
,marginTop: '4px'
|
|
209
|
-
,border:'1px solid black'
|
|
210
|
-
,borderRadius: '3px'
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
,{name:'phone',label:'Phone',colSpan:2,type:JRTable
|
|
215
|
-
,columns:[
|
|
216
|
-
{name:'name',label:'Name',type:JRText,width:'160px'}
|
|
217
|
-
,{name:'phone',label:'Number',type:JRText}
|
|
218
|
-
]
|
|
219
|
-
,validators:[
|
|
220
|
-
function(value,column){
|
|
221
|
-
po(value,column)
|
|
222
|
-
return 'Validate table'
|
|
223
|
-
}
|
|
224
|
-
]
|
|
225
|
-
}
|
|
226
|
-
,{
|
|
227
|
-
name:'select'
|
|
228
|
-
,label:'Select'
|
|
229
|
-
,type:JRSelect
|
|
230
|
-
,valueName:'id'
|
|
231
|
-
,get:{
|
|
232
|
-
url:'list.json'
|
|
233
|
-
,autoRun:true
|
|
234
|
-
}
|
|
235
|
-
,multiple:true
|
|
236
|
-
,required:true
|
|
237
|
-
}
|
|
238
|
-
,{}
|
|
239
|
-
,{
|
|
240
|
-
name:'isMember'
|
|
241
|
-
,label:'Is member'
|
|
242
|
-
,type:JRCheckbox
|
|
243
|
-
,option:{
|
|
244
|
-
value:1
|
|
245
|
-
,label:'yes'
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
,{
|
|
249
|
-
name:'checkbox'
|
|
250
|
-
,label:'Checkbox'
|
|
251
|
-
,type:JRCheckbox
|
|
252
|
-
,valueName:'id'
|
|
253
|
-
,get:{
|
|
254
|
-
url:'list.json'
|
|
255
|
-
,autoRun:true
|
|
256
|
-
}
|
|
257
|
-
,required:true
|
|
258
|
-
}
|
|
259
|
-
]
|
|
260
|
-
,cols:2
|
|
261
|
-
,style:{
|
|
262
|
-
border:'1px solid gray'
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
}
|
|
266
|
-
////////////////////////////////////////////////////////////
|
|
267
|
-
const StyledDiv=styled.div`
|
|
268
|
-
display: flex;
|
|
269
|
-
gap: 10px;
|
|
270
|
-
padding: 5px;
|
|
271
|
-
`
|
|
272
|
-
export const withSomeButton={
|
|
273
|
-
top:function({setStyle}){
|
|
274
|
-
return <StyledDiv>
|
|
275
|
-
<button
|
|
276
|
-
onClick={()=>{
|
|
277
|
-
this.get({
|
|
278
|
-
url:'data2.json'
|
|
279
|
-
,value:{
|
|
280
|
-
abc:123
|
|
281
|
-
}
|
|
282
|
-
})
|
|
283
|
-
}}
|
|
284
|
-
>Get</button>
|
|
285
|
-
|
|
286
|
-
<button
|
|
287
|
-
onClick={()=>{
|
|
288
|
-
|
|
289
|
-
this.setValue(null,true)
|
|
290
|
-
}}
|
|
291
|
-
>Clear</button>
|
|
292
|
-
|
|
293
|
-
<button
|
|
294
|
-
onClick={()=>{
|
|
295
|
-
this.reset()
|
|
296
|
-
}}
|
|
297
|
-
>Reset</button>
|
|
298
|
-
|
|
299
|
-
<button
|
|
300
|
-
onClick={()=>{
|
|
301
|
-
this.validate()
|
|
302
|
-
.then(()=>{
|
|
303
|
-
alert('is valid')
|
|
304
|
-
})
|
|
305
|
-
.catch(()=>{
|
|
306
|
-
|
|
307
|
-
})
|
|
308
|
-
}}
|
|
309
|
-
>Validate</button>
|
|
310
|
-
|
|
311
|
-
<button
|
|
312
|
-
onClick={()=>{
|
|
313
|
-
this.validate()
|
|
314
|
-
.then(()=>{
|
|
315
|
-
po('submit this',this)
|
|
316
|
-
this.post()
|
|
317
|
-
})
|
|
318
|
-
.catch(()=>{
|
|
319
|
-
po('submit this',this)
|
|
320
|
-
})
|
|
321
|
-
}}
|
|
322
|
-
>Submit</button>
|
|
323
|
-
</StyledDiv>
|
|
324
|
-
}
|
|
325
|
-
,bottom({setStyle}){
|
|
326
|
-
setStyle({color:'gray',border:'1px solid blue',whiteSpace:'pre',overflow: 'overlay'})
|
|
327
|
-
return <div style={{
|
|
328
|
-
display: 'flex'
|
|
329
|
-
,justifyContent: 'space-around'
|
|
330
|
-
// ,maxHeight:'300px'
|
|
331
|
-
}}>
|
|
332
|
-
<pre>
|
|
333
|
-
{JSON.stringify(this.getValue(),4,4)}
|
|
334
|
-
</pre>
|
|
335
|
-
<pre>rawValue=
|
|
336
|
-
{JSON.stringify(this.getTestValue(),4,4)}
|
|
337
|
-
</pre>
|
|
338
|
-
</div>
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
///////////////////////////////////////////////////////////////////////
|
|
343
|
-
export const labelLayout={
|
|
344
|
-
...normalFields
|
|
345
|
-
,labelProps:{
|
|
346
|
-
layout:'v'
|
|
347
|
-
,colon:null
|
|
348
|
-
,gap:'10px'
|
|
349
|
-
}
|
|
350
|
-
,gap:'16px'
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
///////////////////////////////////////////////////////////////////////
|
|
354
|
-
export const devFields={
|
|
355
|
-
get:{
|
|
356
|
-
url:'data.json'
|
|
357
|
-
// ,autoRun:true
|
|
358
|
-
,callback(success,res){
|
|
359
|
-
po('success,data',success,res)
|
|
360
|
-
// setTimeout(()=>{
|
|
361
|
-
// po('callback setTimeout',this.getValue())
|
|
362
|
-
this.validate(res.data)
|
|
363
|
-
.then(()=>{
|
|
364
|
-
po('+++++++++++++++++++')
|
|
365
|
-
})
|
|
366
|
-
.catch(()=>{
|
|
367
|
-
po('-------------------')
|
|
368
|
-
})
|
|
369
|
-
// },1)
|
|
370
|
-
}
|
|
371
|
-
,xformatValue(data){
|
|
372
|
-
po('formatValue',data)
|
|
373
|
-
return {aaa:'111'}
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
,post:{
|
|
377
|
-
url:'post'
|
|
378
|
-
,method:'get'
|
|
379
|
-
,callback(){
|
|
380
|
-
this.setValue(null,true)
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
,columns:[
|
|
384
|
-
{name:'name',label:'Name',type:JRText,Xrequired:true
|
|
385
|
-
,validators:[
|
|
386
|
-
function(value){
|
|
387
|
-
if(value=='Joren'){
|
|
388
|
-
return Promise.reject('Test cannot be Joren')
|
|
389
|
-
}else{
|
|
390
|
-
return Promise.resolve('Test')
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
]
|
|
394
|
-
}
|
|
395
|
-
,{name:'email',label:'Email',type:JRText,required:true}
|
|
396
|
-
,{
|
|
397
|
-
label:'Parents'
|
|
398
|
-
,columns:[
|
|
399
|
-
{name:'father',label:'Father',type:JRText,required:true}
|
|
400
|
-
,{name:'mother',label:'Mother',type:JRText,required:true}
|
|
401
|
-
]
|
|
402
|
-
,cols:2
|
|
403
|
-
,columnStyle:{
|
|
404
|
-
border:'1px solid black'
|
|
405
|
-
,borderRadius: '3px'
|
|
406
|
-
}
|
|
407
|
-
,colSpan:2
|
|
408
|
-
}
|
|
409
|
-
,{
|
|
410
|
-
name:'isMember'
|
|
411
|
-
,label:'Is member'
|
|
412
|
-
,type:JRCheckbox
|
|
413
|
-
,options:{
|
|
414
|
-
value:1
|
|
415
|
-
,label:'yes'
|
|
416
|
-
}
|
|
417
|
-
,required:true
|
|
418
|
-
}
|
|
419
|
-
,{
|
|
420
|
-
name:'selectSingle'
|
|
421
|
-
,label:'Select'
|
|
422
|
-
,type:JRSelect
|
|
423
|
-
,valueName:'id'
|
|
424
|
-
,labelName:'name'
|
|
425
|
-
,get:{
|
|
426
|
-
url:'list.json'
|
|
427
|
-
,autoRun:true
|
|
428
|
-
}
|
|
429
|
-
,required:true
|
|
430
|
-
}
|
|
431
|
-
,{
|
|
432
|
-
name:'checkbox'
|
|
433
|
-
,label:'Checkbox'
|
|
434
|
-
,type:JRCheckbox
|
|
435
|
-
,valueName:'id'
|
|
436
|
-
,labelName:'name'
|
|
437
|
-
,get:{
|
|
438
|
-
url:'list.json'
|
|
439
|
-
,autoRun:true
|
|
440
|
-
}
|
|
441
|
-
,required:true
|
|
442
|
-
}
|
|
443
|
-
,{
|
|
444
|
-
name:'select'
|
|
445
|
-
,label:'Select'
|
|
446
|
-
,type:JRSelect
|
|
447
|
-
,valueName:'id'
|
|
448
|
-
,labelName:'name'
|
|
449
|
-
,get:{
|
|
450
|
-
url:'list.json'
|
|
451
|
-
,autoRun:true
|
|
452
|
-
}
|
|
453
|
-
,multiple:true
|
|
454
|
-
,required:true
|
|
455
|
-
}
|
|
456
|
-
,{
|
|
457
|
-
name:'radio'
|
|
458
|
-
,label:'Radio'
|
|
459
|
-
,type:JRRadio
|
|
460
|
-
,valueName:'id'
|
|
461
|
-
,labelName:'name'
|
|
462
|
-
,get:{
|
|
463
|
-
url:'list.json'
|
|
464
|
-
,autoRun:true
|
|
465
|
-
}
|
|
466
|
-
,multiple:true
|
|
467
|
-
,required:true
|
|
468
|
-
,colSpan:2
|
|
469
|
-
}
|
|
470
|
-
]
|
|
471
|
-
,cols:2
|
|
472
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import JRText from "../../components/JRInput/JRText";
|
|
2
|
-
import { po } from "../../components/JRUtils";
|
|
3
|
-
|
|
4
|
-
export const tryHOC={
|
|
5
|
-
open:true
|
|
6
|
-
,popup:true
|
|
7
|
-
,title:'HOC window'
|
|
8
|
-
,columns:[
|
|
9
|
-
{name:'name',label:'電信公司',type:JRText,required:true}
|
|
10
|
-
]
|
|
11
|
-
,bottom(){
|
|
12
|
-
return <div>
|
|
13
|
-
<button
|
|
14
|
-
onClick={()=>{
|
|
15
|
-
po(this)
|
|
16
|
-
// this.validate()
|
|
17
|
-
}}
|
|
18
|
-
>Validate</button>
|
|
19
|
-
</div>
|
|
20
|
-
}
|
|
21
|
-
}
|