@andersonalmeidax0/webcomponents 0.1.5 → 0.1.7

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
@@ -36,3 +36,14 @@ class Page1 extends React.Component{
36
36
  }
37
37
  }
38
38
  ```
39
+ ### Example JZListComponentNoRouter
40
+ Atenção: objetos devem ter propriedade "_id" para serem editaveis
41
+ ```
42
+ <JZListComponentNoRouter _id={'JZ3'}
43
+ api={this.coinsAPI}
44
+ textlabels={true}
45
+ customEditcomponent={JZEditComponent}
46
+ listConfig={this.JZCoinsListConfig()}
47
+ editConfig={this.JZCoinsListConfig()}
48
+ />
49
+
package/RestAPIAdapter.js CHANGED
@@ -14,7 +14,7 @@ import {PlatAPIError,PlatAPIReturnCodeError,PlatAPIAuthError,PlatAPIDBNotFound,P
14
14
  //https://docs.oracle.com/en/cloud/saas/marketing/eloqua-rest-api/op-api-rest-1.0-data-account-post.html
15
15
 
16
16
 
17
- var DEBUG_APIFETCH=true;
17
+ //var DEBUG_APIFETCH=true;
18
18
 
19
19
  //TODO:
20
20
  //1-tem que usar heranca para metodos new, validate, etc
@@ -84,8 +84,8 @@ function getStorageWithExpiry(key) {
84
84
  * tableName is entity (after server)
85
85
  * Server is option (can be null for local API ou not for remote APIs)
86
86
  *********************** */
87
- constructor(tableName,urlServer,tagData,token,pnewVO) {
88
-
87
+ constructor(tableName,urlServer,tagData,token,pnewVO,debug) {
88
+ this.DEBUG_APIFETCH=debug;
89
89
  this.tableName=tableName;
90
90
  this.urlServer=urlServer;
91
91
  this.tagData=tagData;
@@ -119,7 +119,7 @@ function getStorageWithExpiry(key) {
119
119
  async getJSONResponse(response) {
120
120
  var r=null;
121
121
  r=await response.json();
122
- if(DEBUG_APIFETCH)alert(JSON.stringify(r,null,2));
122
+ if(this.DEBUG_APIFETCH)alert(JSON.stringify(r,null,2));
123
123
  if(r.error)
124
124
  throw new PlatAPIReturnCodeError(r.error.message);
125
125
  return r;
@@ -133,7 +133,7 @@ function getStorageWithExpiry(key) {
133
133
  //if(ptoken==null)
134
134
  // throw new PlatAPIAuthError( `An error has occured: ${response.status}`);
135
135
 
136
- var {method,url,body}=this.getParams(q,vo,"/"+this.tableName,filter);
136
+ var {method,url,body}=this.getParams(q,vo,this.tableName,filter);
137
137
  //server is optional
138
138
  url = this.urlServer==null?url:this.urlServer+url;
139
139
 
@@ -185,10 +185,10 @@ function getStorageWithExpiry(key) {
185
185
  *
186
186
  *********************** */
187
187
  async myFetch3 (token,url,method,body) {
188
- if(DEBUG_APIFETCH)alert("url:"+url);
189
- if(DEBUG_APIFETCH)alert("m:"+method);
190
- if(DEBUG_APIFETCH)alert("body:"+body);
191
- if(DEBUG_APIFETCH)alert("token:"+JSON.stringify(token));
188
+ if(this.DEBUG_APIFETCH)alert("url:"+url);
189
+ if(this.DEBUG_APIFETCH)alert("m:"+method);
190
+ if(this.DEBUG_APIFETCH)alert("body:"+body);
191
+ if(this.DEBUG_APIFETCH)alert("token:"+JSON.stringify(token));
192
192
 
193
193
  var r = await fetch(url,
194
194
  {
@@ -4,7 +4,7 @@ export class ErrorCard extends React.Component {
4
4
  render() {
5
5
  return (
6
6
  <div className="g--10 m--2">
7
- <h3>Erro de sistema inesperado. Entre em contato com metalmarket@gmail.com e informe a mensagem abaixo:</h3>
7
+ <h3>Erro de sistema inesperado. Entre em contato com suporte e informe a mensagem abaixo:</h3>
8
8
  <h4>{JSON.stringify(this.props.myException)}</h4>
9
9
  <h4>{JSON.stringify(this.props.myException.stack)}</h4>
10
10
  <div className="card g--10 m--0">
@@ -172,7 +172,8 @@ class JZListComponentNoRouter extends React.Component {
172
172
 
173
173
  /* ******** ####################### ********** */
174
174
  evtActionEdit = async (i,item) => {
175
- this.setState({showEditModal:true,editMode:'U',editKey:item._id});
175
+ var key = item._id?item._id:item.id;
176
+ this.setState({showEditModal:true,editMode:'U',editKey:key});
176
177
  if(this.props.onSelectItem) this.props.onSelectItem(item);
177
178
  }
178
179
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andersonalmeidax0/webcomponents",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "webcomponents",
5
5
  "main": "webcomponents",
6
6
  "scripts": {
package/releasenotes.txt CHANGED
@@ -3,6 +3,8 @@
3
3
  0.1.2: with text labels for buttons
4
4
  0.1.3: RestAPIAdapter init
5
5
  0.1.4: Error move to root
6
+ 0.1.6: url correct, debug
7
+ 0.1.7: readme, editKey _id ou id, errorCard msg, barra dupla na url
6
8
 
7
9
 
8
10
  TODO