@andersonalmeidax0/webcomponents 0.1.12 → 0.1.13

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.
@@ -1,18 +1,18 @@
1
1
  import React from "react";
2
- import {XButton} from "../XButton.jsx"
3
- import {XInputExternal} from "../XInput.jsx"
4
- import {XSelect3} from "../XSelect"
5
- import {XTextArea} from "../XTextArea"
6
- import {XCheckbox} from "../XCheckbox.jsx"
7
- import {XDateSelect} from "../XDateSelect.jsx"
2
+ import { XButton } from "../XButton.jsx"
3
+ import { XInputExternal } from "../XInput.jsx"
4
+ import { XSelect3 } from "../XSelect"
5
+ import { XTextArea } from "../XTextArea"
6
+ import { XCheckbox } from "../XCheckbox.jsx"
7
+ import { XDateSelect } from "../XDateSelect.jsx"
8
8
 
9
9
  import { JZInPlaceListComponent } from "./JZInPlaceListComponent.jsx";
10
10
 
11
11
 
12
12
 
13
- const DEBUG_ID=false;
14
- const DEBUG_ID2=DEBUG_ID;
15
- const DEBUG_ID3=false;
13
+ const DEBUG_ID = false;
14
+ const DEBUG_ID2 = DEBUG_ID;
15
+ const DEBUG_ID3 = false;
16
16
 
17
17
  //TODO: tirar debug de celulas (DEBUF_2)
18
18
  //atualizar e refres
@@ -23,83 +23,92 @@ const DEBUG_ID3=false;
23
23
  /** *********************************************************
24
24
  * XFormEdit: metadata, formData, btn0, btn0.label, btn0.evt
25
25
  * altera diretamente a prop, por isso nao tem estado (via input external)
26
- * ********************************************************* */
26
+ * ********************************************************* */
27
27
  class XFormEdit extends React.Component {
28
28
  constructor(props) {
29
29
  super(props)
30
30
  }
31
31
 
32
- inputChangeNew = (value,context) => {
33
- console.log("u.XFormEdit.inputChgNew.context"+context);
34
- var v=context.v;
35
- var item=context.item;
36
- console.log("u.XFormEdit.inputChgNew.value"+value);
37
- item[v.attr]=value;
32
+ inputChangeNew = (value, context) => {
33
+ console.log("u.XFormEdit.inputChgNew.context" + context);
34
+ var v = context.v;
35
+ var item = context.item;
36
+ console.log("u.XFormEdit.inputChgNew.value" + value);
37
+ item[v.attr] = value;
38
38
  //this.evtRefresh();
39
39
  //this.props.notifyChangeFn();
40
40
  }
41
41
 
42
42
 
43
- render () {
44
- if(!this.props.metadata.fields)
45
- return <h3>No metadata.fields on XFormEdit</h3>
43
+ render() {
44
+ if (!this.props.metadata.fields)
45
+ return <h3>No metadata.fields on XFormEdit</h3>
46
46
  else
47
- return (
48
- <React.Fragment>
49
- <h6>{DEBUG_ID2&&'['+this.props.id+']'}</h6>
50
- <h3>{this.props.metadata.title}</h3>
51
-
52
- {this.props.metadata.fields.filter((item)=>{return(item.show)}).map((v,i)=> {
53
- if(v.type==='l') /*list*/ {
54
- return <React.Fragment key={i}>
55
- <div xclassName="card">
56
- <div>{v.label}</div>
57
- <XSelect3 list={v.lov} value={this.props.formData[v.attr]} disabled={v.readOnly} onChange={(ev)=>this.props.formData[v.attr]=ev.target.value} />
58
- <br/>
59
- <p> </p>
47
+ return (
48
+ <React.Fragment>
49
+ <h6>{DEBUG_ID2 && '[' + this.props.id + ']'}</h6>
50
+ <h3>{this.props.metadata.title}</h3>
51
+
52
+ {this.props.metadata.fields.filter((item) => { return (item.show) }).map((v, i) => {
53
+ if (v.type === 'l') /*list*/ {
54
+ return <React.Fragment key={i}>
55
+ <div xclassName="card">
56
+ <div>{v.label}</div>
57
+ <XSelect3 list={v.lov} value={this.props.formData[v.attr]} disabled={v.readOnly} onChange={(ev) => this.props.formData[v.attr] = ev.target.value} />
58
+ <br />
59
+ <p> </p>
60
+ </div>
61
+ </React.Fragment>
62
+ }
63
+ else {
64
+ if (v.type === 'a') /* array */ {
65
+ return (
66
+ <React.Fragment key={i}>
67
+ <div xclassName="card"><div>{v.label}</div>
68
+ <JZInPlaceListComponent _id={this.props.id + '_F' + i} textlabels={true} list={this.props.formData[v.attr]} listConfig={v.listConfig} newItemFN={v.newItemFN} />
69
+ </div>
70
+ </React.Fragment>)
71
+ }
72
+ else
73
+ if (v.type === 'd') /* date */ {
74
+ return (
75
+ <React.Fragment key={i}>
76
+ <div className=""><div>{v.label}</div>
77
+ <XDateSelect id={this.props.id + '_F' + i} width={v.width} label={v.label} disabled={v.readOnly} value={this.props.formData[v.attr]} onChange={(v) => this.props.formData[v.attr] = v} />
60
78
  </div>
61
- </React.Fragment>
62
- }
63
- else {
64
- if(v.type==='a') /* array */ {
65
- return (
66
- <React.Fragment key={i}>
67
- <div xclassName="card"><div>{v.label}</div>
68
- <JZInPlaceListComponent _id={this.props.id+'_F'+i} textlabels={true} list={this.props.formData[v.attr]} listConfig={v.listConfig} newItemFN={v.newItemFN} />
69
- </div>
70
- </React.Fragment>)
71
- }
72
- else
73
- if(v.type==='d') /* date */ {
74
- return (
75
- <React.Fragment key={i}>
76
- <div className=""><div>{v.label}</div>
77
- <XDateSelect id={this.props.id+'_F'+i} width={v.width} label = {v.label} disabled={v.readOnly} value={this.props.formData[v.attr]} onChange={(v)=>this.props.formData[v.attr]=v} />
78
- </div>
79
- </React.Fragment>)
80
- }
81
- else
82
- if(v.type==='c') /* check */ {
83
- return (
84
- <React.Fragment key={i}>
85
- <div className=""><div>{v.label}</div>
86
- <XCheckbox id={this.props.id+'_F'+i} width={v.width} label = {v.label} disabled={v.readOnly} value={this.props.formData[v.attr]} onChange={(v)=>this.props.formData[v.attr]=v} />
87
- </div>
88
- </React.Fragment>)
89
- }
90
- else
91
- return (
92
- <React.Fragment key={i} >{DEBUG_ID2&&'['+this.props.id+'_F'+i+']'}
93
- <XInputExternal type={v.type=='n'?'number':''} id={this.props.id+'_F'+i} width={v.width} label = {v.label} readOnly={v.readOnly} value={this.props.formData[v.attr]} /*onChangeNew={(value)=>this.props.formData[v.attr]=ev.target.value}*/ onChangeNew={this.inputChangeNew} context={{item:this.props.formData,v:v}} />
94
- </React.Fragment>)
95
- }
96
- })}
97
- {this.props.btn0&& <XButton label = {this.props.btn0.label} onClick={this.props.btn0.evt} />}
98
- </React.Fragment>
99
- );
79
+ </React.Fragment>)
80
+ }
81
+ else
82
+ if (v.type === 'c') /* check */ {
83
+ return (
84
+ <React.Fragment key={i}>
85
+ <div className=""><div>{v.label}</div>
86
+ <XCheckbox id={this.props.id + '_F' + i} width={v.width} label={v.label} disabled={v.readOnly} value={this.props.formData[v.attr]} onChange={(v) => this.props.formData[v.attr] = v} />
87
+ </div>
88
+ </React.Fragment>)
89
+ }
90
+ else
91
+ if (v.type === 'f') /* file */ {
92
+ return (
93
+ <React.Fragment key={i}>
94
+ <div className=""><div>{v.label}</div>
95
+ <p>{this.props.formData[v.attr]}</p>
96
+ <XButton id={this.props.id + '_F' + i} attachFile={true} disabled={v.readOnly} onClick={(e)=>{this.props.formData[v.attr]=e.target.files[0].name;this.props.formData.filedata=e.target.files[0]}} textlabel='Select File'></XButton>
97
+ </div>
98
+ </React.Fragment>)
99
+ } else
100
+ return (
101
+ <React.Fragment key={i} >{DEBUG_ID2 && '[' + this.props.id + '_F' + i + ']'}
102
+ <XInputExternal type={v.type == 'n' ? 'number' : ''} id={this.props.id + '_F' + i} width={v.width} label={v.label} readOnly={v.readOnly} value={this.props.formData[v.attr]} /*onChangeNew={(value)=>this.props.formData[v.attr]=ev.target.value}*/ onChangeNew={this.inputChangeNew} context={{ item: this.props.formData, v: v }} />
103
+ </React.Fragment>)
104
+ }
105
+ })}
106
+ {this.props.btn0 && <XButton label={this.props.btn0.label} onClick={this.props.btn0.evt} />}
107
+ </React.Fragment>
108
+ );
100
109
  }
101
110
 
102
111
  }
103
112
 
104
113
 
105
- export {XFormEdit};
114
+ export { XFormEdit };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andersonalmeidax0/webcomponents",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "webcomponents",
5
5
  "main": "webcomponents",
6
6
  "scripts": {
package/releasenotes.txt CHANGED
@@ -9,7 +9,9 @@
9
9
  0.1.9: doc fix
10
10
  0.1.10: add css
11
11
  0.0.11: no alert on update / XButton upload com text=true
12
- 0.1.12: extract getStorage
12
+ 0.1.12: remove getStorage from APIAdapter
13
+ 0.1.13: new form type: "f"=file upload
14
+
13
15
 
14
16
  npm login
15
17
  npm publish --access public