@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 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
@@ -16,6 +16,7 @@ class XButton extends React.Component {
16
16
  this.evt = this.evt.bind(this);
17
17
  this.evtFile = this.evtFile.bind(this);
18
18
  }
19
+
19
20
  evt(ev) {
20
21
  ev.preventDefault();
21
22
  this.props.onClick(ev);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andersonalmeidax0/webcomponents",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "webcomponents",
5
5
  "main": "webcomponents",
6
6
  "scripts": {
package/releasenotes.txt CHANGED
@@ -5,6 +5,7 @@
5
5
  0.1.4: Error move to root
6
6
  0.1.6: url correct, debug
7
7
  0.1.7: readme, editKey _id ou id, errorCard msg, barra dupla na url
8
+ 0.1.8: doc example
8
9
 
9
10
 
10
11
  TODO