@progressive-development/pd-contact 0.1.59 → 0.1.60

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/PdContact.js +24 -17
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Progressive Development Contact component",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "author": "PD Progressive Development",
6
- "version": "0.1.59",
6
+ "version": "0.1.60",
7
7
  "main": "index.js",
8
8
  "module": "index.js",
9
9
  "scripts": {
package/src/PdContact.js CHANGED
@@ -81,17 +81,24 @@
81
81
  };
82
82
  }
83
83
 
84
- constructor() {
85
- super();
86
- this.addressTitle = 'Adres';
87
- this.requiredFields = [];
88
- this.summary = false;
89
- this.business = false;
90
- this.match = {};
91
- this._errorMap = new Map();
92
- }
84
+ constructor() {
85
+ super();
86
+ this.addressTitle = 'Adres';
87
+ this.requiredFields = [];
88
+ this.summary = false;
89
+ this.business = false;
90
+ this.match = {};
91
+ this._errorMap = new Map();
92
+ }
93
+
94
+ update(changedProperties) {
95
+ if (changedProperties.has("contact") && this.contact) {
96
+ this.business = this.contact.business;
97
+ }
98
+ super.update(changedProperties);
99
+ }
93
100
 
94
- connectedCallback() {
101
+ connectedCallback() {
95
102
  super.connectedCallback();
96
103
  // add validation event listener
97
104
  this.addEventListener('validate-form', this._validateForm);
@@ -103,13 +110,13 @@
103
110
  this.removeEventListener('validate-form', this._validateForm);
104
111
  }
105
112
 
106
- firstUpdated() {
107
- this.addEventListener('key-pressed', e => {
108
- this._errorMap.set(e.detail.name, '');
109
- super.requestUpdate();
110
- });
113
+ firstUpdated() {
114
+ this.addEventListener('key-pressed', e => {
115
+ this._errorMap.set(e.detail.name, '');
116
+ super.requestUpdate();
117
+ });
111
118
 
112
- // first validation if form is already filled (edit)
119
+ // first validation if form is already filled (edit)
113
120
  if (this.contact) {
114
121
  const detail = {
115
122
  errorMap: new Map()
@@ -118,7 +125,7 @@
118
125
  new CustomEvent("validate-form", {detail})
119
126
  );
120
127
  }
121
- }
128
+ }
122
129
 
123
130
  render() {
124
131
  return html`