@andersonalmeidax0/webcomponents 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +69 -1
- package/XButton.jsx +1 -0
- package/package.json +1 -1
- package/releasenotes.txt +1 -0
package/README.md
CHANGED
|
@@ -46,4 +46,72 @@ Atenção: objetos devem ter propriedade "_id" para serem editaveis
|
|
|
46
46
|
listConfig={this.JZCoinsListConfig()}
|
|
47
47
|
editConfig={this.JZCoinsListConfig()}
|
|
48
48
|
/>
|
|
49
|
-
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
### Complete Example:
|
|
52
|
+
```
|
|
53
|
+
import React from "react";
|
|
54
|
+
import {RestAPIAdapter} from "@andersonalmeidax0/webcomponents/RestAPIAdapter.js"
|
|
55
|
+
import {JZListComponent,JZListComponentNoRouter} from "@andersonalmeidax0/webcomponents/jzcomponents/JZListComponent"
|
|
56
|
+
import { JZEditComponent } from "@andersonalmeidax0/webcomponents/jzcomponents/JZEditComponent.jsx";
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
import {XButton} from "@andersonalmeidax0/webcomponents/XButton.jsx"
|
|
60
|
+
import { JZInPlaceListComponent } from "@andersonalmeidax0/webcomponents/jzcomponents/JZInPlaceListComponent.jsx";
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
/* ******************************************* */
|
|
64
|
+
/* ******************************************* */
|
|
65
|
+
class PageAPI extends React.Component{
|
|
66
|
+
constructor(props){
|
|
67
|
+
super(props);
|
|
68
|
+
//this.testAPI = new RestAPIAdapter('posts','https://jsonplaceholder.typicode.com',null,null, ()=>{return {userId:'999',name:'title'}},false);
|
|
69
|
+
this.testAPI = new RestAPIAdapter('records','http://localhost:9090/api',null,null, ()=>{return {name:'999',position:'level'}},false);
|
|
70
|
+
this.state ={}
|
|
71
|
+
}
|
|
72
|
+
componentDidMount() {
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
JZListConfig=()=> {
|
|
76
|
+
return {
|
|
77
|
+
title:'Test',numfields:0,
|
|
78
|
+
//For list
|
|
79
|
+
hasInsert:true,hasEditFn:(item)=>(true),hasDeleteFn:(item)=>(true),
|
|
80
|
+
//For edit
|
|
81
|
+
hasSaveFn:(item)=>(true),hasBackFn:(item)=>(true),extraButtons:[
|
|
82
|
+
{btnLabel:'ExtraButton',evtBtn:(obj)=>alert(obj.i_fullname)},
|
|
83
|
+
{btnLabel:'Exception',evtBtn:()=>{throw new Error()}}
|
|
84
|
+
],
|
|
85
|
+
fields:[
|
|
86
|
+
// {pos: 0,show:true, label:'userId' ,type:'s',attr:'userId',align:'left'},
|
|
87
|
+
// {pos: 0,show:true, label:'title', type:'s',attr:'title',align:'left'},
|
|
88
|
+
// {pos: 0,show:true, label:'id',type:'n',attr:'id',align:'right',renderFn:(c,r,i,r2)=>(r2)},
|
|
89
|
+
{pos: 0,show:true, label:'name' ,type:'s',attr:'name',align:'left'},
|
|
90
|
+
{pos: 0,show:true, label:'position', type:'s',attr:'position',align:'left'},
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
]};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
render() {
|
|
97
|
+
return (
|
|
98
|
+
<React.Fragment>
|
|
99
|
+
|
|
100
|
+
<section>
|
|
101
|
+
|
|
102
|
+
<h4>Posts </h4>
|
|
103
|
+
<JZListComponentNoRouter _id={'JZ3'}
|
|
104
|
+
api={this.testAPI}
|
|
105
|
+
textlabels={true}
|
|
106
|
+
customEditcomponent={JZEditComponent}
|
|
107
|
+
listConfig={this.JZListConfig()}
|
|
108
|
+
editConfig={this.JZListConfig()}
|
|
109
|
+
/>
|
|
110
|
+
|
|
111
|
+
</section>
|
|
112
|
+
</React.Fragment>
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
}
|
|
117
|
+
```
|
package/XButton.jsx
CHANGED
package/package.json
CHANGED