@progressive-development/pd-forms 0.0.58 → 0.0.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.
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Webcomponent pd-forms following open-wc recommendations",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "author": "PD Progressive Development",
6
- "version": "0.0.58",
6
+ "version": "0.0.60",
7
7
  "main": "index.js",
8
8
  "module": "index.js",
9
9
  "scripts": {
@@ -25,20 +25,40 @@ export class PdFormContainer extends PdBaseUI {
25
25
  gap: 20px;
26
26
  }
27
27
  .hinweis {
28
- background-color:#ffaa71;
28
+ font-family: var(--pd-font-content);
29
+ font-size:0.95rem;
30
+
29
31
  padding:10px;
30
32
  color:#58585a;
31
- border-radius: 1rem;
32
- -moz-border-radius: 1rem;
33
+ border-radius: var(--squi-border-radius, 0);
34
+ -moz-border-radius: var(--squi-border-radius, 0);
33
35
  width:50%;
34
36
  min-width:300px;
35
37
  }
38
+
39
+ .filled {
40
+ border-left:4px solid #42a01c;
41
+ border-right:4px solid #42a01c;
42
+ border-top:1px solid #42a01c;
43
+ border-bottom:1px solid #42a01c;
44
+ background-color:#f5ffe8;
45
+ }
46
+
47
+ .unfilled {
48
+ border-left:4px solid #cc2029;
49
+ border-right:4px solid #cc2029;
50
+ border-top:1px solid #cc2029;
51
+ border-bottom:1px solid #cc2029;
52
+ background-color:#ffe8e8;
53
+ }
54
+
36
55
  `;
37
56
  }
38
57
 
39
58
  static get properties() {
40
59
  return {
41
60
  requiredFieldInfo: { type: Boolean},
61
+ _requiredFieldsValid: { type: Boolean, state: true},
42
62
  };
43
63
  }
44
64
 
@@ -52,7 +72,7 @@ export class PdFormContainer extends PdBaseUI {
52
72
  <form>
53
73
  <slot></slot>
54
74
  ${this.requiredFieldInfo ? html`
55
- <p class="hinweis">
75
+ <p class="hinweis ${this._requiredFieldsValid ? 'filled' : 'unfilled'}">
56
76
  ${msg('* Pflichtfeld',{desc: '#pd.form.required.info#'})}
57
77
  </p>` : ''}
58
78
  <br />
@@ -62,21 +82,26 @@ export class PdFormContainer extends PdBaseUI {
62
82
 
63
83
  _validateForm(e) {
64
84
 
65
- const reqEl = e.detail.singleElement ? [e.detail.singleElement] :
66
- this.querySelectorAll("[required]");
85
+ const reqEl = this.querySelectorAll("[required]");
67
86
 
68
87
  // validate required fields TODO: Auf PdInputxxx beschränken
69
88
  reqEl.forEach(el => {
70
89
  const tmpEl = el;
71
- if (!el.value || el.value === "") {
72
- tmpEl.errorMsg = el.requiredMsg ||
73
- msg('Eingabe erforderlich',{desc: '#pd.form.field.required#'});
74
- e.detail.errorMap.set(el.id, tmpEl.errorMsg);
90
+ if (!el.value || el.value === "") {
91
+ const erMsg = el.requiredMsg || msg('Eingabe erforderlich',{desc: '#pd.form.field.required#'});
92
+ if (!e.detail.singleElement || e.detail.singleElement === el) {
93
+ tmpEl.errorMsg = erMsg;
94
+ }
95
+ e.detail.errorMap.set(el.id, erMsg);
75
96
  } else {
76
- tmpEl.errorMsg = "";
97
+ if (!e.detail.singleElement || e.detail.singleElement === el) {
98
+ tmpEl.errorMsg = "";
99
+ }
77
100
  }
78
101
  })
79
102
 
103
+ this._requiredFieldsValid = e.detail.errorMap.size === 0;
104
+
80
105
  // general validate method
81
106
  const validateByType = (fieldType, validFunc, invalidMsgTxt) => {
82
107
 
package/src/PdInput.js CHANGED
@@ -175,7 +175,7 @@ export class PdInput extends PdBaseUIInput {
175
175
 
176
176
  Nachtrag: Nun auf interne propertie umgestellt, im Test...
177
177
  */
178
- if (this.errorMsg.length > 0) {
178
+ // if (this.errorMsg.length > 0) {
179
179
  this.dispatchEvent(
180
180
  new CustomEvent('validate-form', {
181
181
  detail: {
@@ -186,7 +186,7 @@ export class PdInput extends PdBaseUIInput {
186
186
  bubbles: true,
187
187
  })
188
188
  );
189
- }
189
+ // }
190
190
 
191
191
  this.dispatchEvent(
192
192
  new CustomEvent('key-pressed', {
@@ -156,7 +156,17 @@ export class PdInputArea extends PdBaseUIInput {
156
156
  event.preventDefault();
157
157
  } else {
158
158
  // If any other key, fire 'key-pressed'
159
- this.errorMsg = '';
159
+ this.dispatchEvent(
160
+ new CustomEvent('validate-form', {
161
+ detail: {
162
+ singleElement: this,
163
+ errorMap: new Map()
164
+ },
165
+ composed: true,
166
+ bubbles: true,
167
+ })
168
+ );
169
+
160
170
  this.dispatchEvent(new CustomEvent('key-pressed', {
161
171
  detail: {
162
172
  value: this._input.value,
@@ -76,7 +76,18 @@ export class PdRadioGroup extends LitElement {
76
76
  elCollection[keyValue].value = false;
77
77
  }
78
78
  elCollection[keyValue].readonly = (elCollection[keyValue].value === 'true');
79
- this.errorMsg = '';
79
+
80
+ this.dispatchEvent(
81
+ new CustomEvent('validate-form', {
82
+ detail: {
83
+ singleElement: this,
84
+ errorMap: new Map()
85
+ },
86
+ composed: true,
87
+ bubbles: true,
88
+ })
89
+ );
90
+
80
91
  });
81
92
  });
82
93
 
package/src/PdSelect.js CHANGED
@@ -88,6 +88,7 @@ export class PdSelect extends PdBaseUIInput {
88
88
  -moz-appearance: none;
89
89
  -webkit-appearance: none;
90
90
  appearance: none;
91
+ color: var(--my-input-placeholder-color);
91
92
 
92
93
  /* Define color */
93
94
  background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23007CB2%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E');
@@ -120,10 +121,13 @@ export class PdSelect extends PdBaseUIInput {
120
121
  .select-css:focus {
121
122
  border-color: var(--my-border-color-focus);
122
123
  /* It'd be nice to use -webkit-focus-ring-color here but it doesn't work on box-shadow */
124
+
125
+ /* Angaben nach MF DJK Umstellung entfernt
123
126
  box-shadow: 0 0 1px 3px rgba(59, 153, 252, 0.7);
124
127
  box-shadow: 0 0 0 3px -moz-mac-focusring;
125
128
  color: #222;
126
129
  outline: none;
130
+ */
127
131
  }
128
132
 
129
133
  .error .select-css {
@@ -274,7 +278,18 @@ export class PdSelect extends PdBaseUIInput {
274
278
 
275
279
  _onChange() {
276
280
  this.value = this._input.value;
277
- this.errorMsg = '';
281
+
282
+ this.dispatchEvent(
283
+ new CustomEvent('validate-form', {
284
+ detail: {
285
+ singleElement: this,
286
+ errorMap: new Map()
287
+ },
288
+ composed: true,
289
+ bubbles: true,
290
+ })
291
+ );
292
+
278
293
  this.dispatchEvent(
279
294
  new CustomEvent('change-value', {
280
295
  detail: {
@@ -30,19 +30,20 @@ export const SharedInputStyles = css`
30
30
  --my-lighter-background-color: var(--squi-lighter-color, #8caed8a1);
31
31
  --my-darker-background-color: var(--squi-darker-color, #012e649f);
32
32
  --my-background-gradient-color: var(--squi-third-color, #8caed8a1);
33
- --my-error-background-color: var(--squi-error-background-color, #f6d4d4a1);
33
+ --my-error-background-color: var(--squi-error-background-color, #ffe8e8);
34
34
 
35
35
  /* Error colors for Elements Select, Input, Input Area */
36
- --my-error-color: var(--squi-error-color, #d6242d);
36
+ --my-error-color: var(--squi-error-color, #cc2029);
37
37
 
38
38
  /* Text color input Elements Select, Input, Input Area */
39
39
  --my-text-color: var(--squi-text-color, #000000);
40
40
  --my-label-color: var(--squi-text-lable-color, #58585a);
41
+ --my-input-placeholder-color: var(--squi-input-placeholder-color:#474747);
42
+
41
43
  --my-font-family: var(--squi-display-font, 'Montserrat');
42
44
  --my-font-size: var(--squi-font-size, 1rem);
43
45
 
44
46
  --my-input-height: var(--squi-input-height, 2.4rem);
45
-
46
47
  }
47
48
 
48
49
  /* Describe input div (with icon) around input/select/area element */
@@ -167,7 +168,7 @@ export const SharedInputStyles = css`
167
168
 
168
169
  /* Fokus for input, area => select with own css.? */
169
170
  .input-style:focus {
170
- border: var(--my-border-color-focus) 2px solid;
171
+ border: var(--my-border-color-focus) 3px solid;
171
172
  outline: 0;
172
173
  }
173
174