@progressive-development/pd-forms 0.1.24 → 0.1.26

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.1.24",
6
+ "version": "0.1.26",
7
7
  "main": "index.js",
8
8
  "module": "index.js",
9
9
  "scripts": {
package/src/PdCheckbox.js CHANGED
@@ -236,8 +236,10 @@ export class PdCheckbox extends PdBaseUIInput {
236
236
  const checked = (this.value === 'true');
237
237
  const classMapVal = {'disabled': this.disabled, 'switch': this.isSwitch, 'readonly': this.readonly, 'div-container': true};
238
238
  const aClassMap = {'switch-paddle': this.isSwitch, 'checkbox': !this.isSwitch, 'isChecked': checked, 'isUnchecked': !checked};
239
+ const inputId = `${this.id}Check`;
239
240
 
240
241
  return html`
242
+ ${this._renderLabel(inputId)}
241
243
  <div @click="${this.onClick}" class="${classMap(classMapVal)}">
242
244
  <a href="#" @click="${this.linkClick}" @keypress="${this.onKeyPress}" class="${classMap(aClassMap)}">
243
245
  <pd-icon icon="checkBox" class="small" ?activeIcon="${checked}"></pd-icon>
@@ -259,7 +261,7 @@ export class PdCheckbox extends PdBaseUIInput {
259
261
 
260
262
  // set changed value and generate events (key-pressed, enter-pressed, validateForm)
261
263
  // if neccessary
262
- this._handleChangedValue(checked ? 'false' : 'true', e, false, true);
264
+ this._handleChangedValue(checked ? 'false' : 'true', e);
263
265
 
264
266
  // TODO: Idee, alle input elemente haben gleichen event!
265
267
  /*
@@ -73,7 +73,9 @@ export class PdFormContainer extends PdBaseUI {
73
73
  static get properties() {
74
74
  return {
75
75
  requiredFieldInfo: { type: Boolean},
76
+ commonError: { type: String},
76
77
  _requiredFieldsValid: { type: Boolean, state: true},
78
+
77
79
  };
78
80
  }
79
81
 
@@ -88,8 +90,9 @@ export class PdFormContainer extends PdBaseUI {
88
90
  <slot></slot>
89
91
  ${this.requiredFieldInfo ? html`
90
92
  <div class="validation-info-container">
91
- <p class="validation-info ${this._requiredFieldsValid ? 'filled' : 'unfilled'}">
92
- ${msg('* Pflichtfeld',{desc: '#pd.form.required.info#'})}
93
+ <p class="validation-info ${(this._requiredFieldsValid && (!this.commonError || this.commonError === "")) ? 'filled' : 'unfilled'}">
94
+ ${this.commonError || (this._requiredFieldsValid ? msg('* Pflichtfelder ausgefüllt',{desc: '#pd.form.required.valid#'})
95
+ : msg('* Pflichtfeld',{desc: '#pd.form.required.info#'}))}
93
96
  </p>
94
97
  </div>` : ''}
95
98
  </form>
@@ -149,6 +152,7 @@ export class PdFormContainer extends PdBaseUI {
149
152
  msg("Format +49123 123456 verwenden",{desc: '#pd.form.field.invalid.phone#'}));
150
153
  validateByType("vat", PdFormContainer._vatIsValid,
151
154
  msg("Format DE0123456789 verwenden",{desc: '#pd.form.field.invalid.vat#'}));
155
+ // eslint-disable-next-line no-restricted-globals
152
156
  validateByType("number", (val) => !isNaN(val),
153
157
  msg("Nur Zahlen erlaubt",{desc: '#pd.form.field.invalid.number#'}));
154
158
 
@@ -173,4 +177,4 @@ export class PdFormContainer extends PdBaseUI {
173
177
  return mValid;
174
178
  }
175
179
 
176
- }
180
+ }
package/src/PdFormRow.js CHANGED
@@ -23,61 +23,53 @@ export class PdFormRow extends PdBaseUI {
23
23
  --my-row-width: 800px;
24
24
  --my-gap: 20px;
25
25
  display: flex;
26
- flex: 1 1 100%;
26
+ flex: 1 1 100%;
27
27
  /*margin: 0 0 .5rem 0;*/
28
28
  box-sizing: border-box;
29
29
  min-width: var(--my-row-width);
30
30
  max-width: 100%;
31
31
  gap: var(--my-gap);
32
- align-items: flex-start;
33
- justify-content: var(--pd-form-row-allign, left);
34
- padding-top: var(--pd-form-row-padding-top, 10px);
32
+ align-items: flex-start;
33
+ padding-top: var(--pd-form-row-padding-top, 10px);
35
34
  }
36
35
 
37
36
  ::slotted(.full-size) {
38
37
  --pd-input-field-width: 100%;
39
- --pd-button-width: var(--pd-input-field-width);
40
38
  }
41
39
 
42
40
  ::slotted(.quarter1) {
43
41
  --pd-input-field-width: calc(var(--my-row-width) * 0.25 - (var(--my-gap) * 0.75));
44
- --pd-button-width: var(--pd-input-field-width);
42
+
45
43
  }
46
44
 
47
45
  ::slotted(.quarter1-area) {
48
46
  --pd-input-field-width: calc((var(--my-row-width) - 5px) * 0.25 - (var(--my-gap) * 0.75));
49
- --pd-button-width: var(--pd-input-field-width);
50
47
 
51
48
  }
52
49
 
53
50
  ::slotted(.quarter2) {
54
- --pd-input-field-width: calc((var(--my-row-width) * 0.5) - (var(--my-gap) / 2));
55
- --pd-button-width: var(--pd-input-field-width);
51
+ --pd-input-field-width: calc((var(--my-row-width) * 0.5) - (var(--my-gap) / 2));
52
+
56
53
  }
57
54
 
58
55
  ::slotted(.quarter2-area) {
59
56
  --pd-input-field-width: calc(((var(--my-row-width) - 8px) * 0.5) - (var(--my-gap) / 2));
60
- --pd-button-width: var(--pd-input-field-width);
61
57
  }
62
58
 
63
59
  ::slotted(.quarter3) {
64
60
  --pd-input-field-width: calc(var(--my-row-width) * 0.75 - (var(--my-gap) * 0.25));
65
- --pd-button-width: var(--pd-input-field-width);
66
61
  }
67
62
  /* Area is longer? Scrollbar? */
68
63
  ::slotted(.quarter3-area) {
69
64
  --pd-input-field-width: calc((var(--my-row-width) - 10px) * 0.75 - (var(--my-gap) * 0.25));
70
- --pd-button-width: var(--pd-input-field-width);
71
65
  }
72
66
 
73
67
  ::slotted(.quarter4) {
74
- --pd-input-field-width: var(--my-row-width);
75
- --pd-button-width: var(--pd-input-field-width);
68
+ --pd-input-field-width: var(--my-row-width);
76
69
  }
77
70
  /* Area is longer? Scrollbar? */
78
71
  ::slotted(.quarter4-area) {
79
72
  --pd-input-field-width: calc(var(--my-row-width) - 15px);
80
- --pd-button-width: var(--pd-input-field-width);
81
73
  }
82
74
 
83
75
  @media (max-width: 930px) {
package/src/PdRange.js CHANGED
@@ -42,6 +42,11 @@ export class PdRange extends PdBaseUIInput {
42
42
  * Style for SLIDER *
43
43
  ****************************************************/
44
44
 
45
+ :host([disabled]) {
46
+ --pd-range-bg-col: grey;
47
+ --pd-range-thumb-col: lightgrey;
48
+ }
49
+
45
50
  input[type=range] {
46
51
  -webkit-appearance: none; /* Hides the slider so that custom slider can be made */
47
52
  width: var(--pd-input-field-width, 250px); /* Specific width is required for Firefox. */
@@ -49,7 +54,7 @@ export class PdRange extends PdBaseUIInput {
49
54
 
50
55
  background-color: var(--pd-range-bg-col, var(--pd-default-col));
51
56
  padding: 0.5rem;
52
- height: var(--pd-input-field-height, 2.2rem);
57
+ height: var(--pd-input-field-range-height, 1.7rem);
53
58
  box-sizing: border-box;
54
59
 
55
60
  border-radius: 0.75rem;
@@ -82,7 +87,7 @@ export class PdRange extends PdBaseUIInput {
82
87
 
83
88
  /* redundant, check if it is possible to extract common definitions */
84
89
  cursor: pointer;
85
- height: 20px;
90
+ height: 15px;
86
91
  width: 39px;
87
92
  background: var(--pd-range-thumb-col, var(--pd-default-hover-col));
88
93
  border: 1px solid var(--pd-default-dark-col);
@@ -96,7 +101,7 @@ export class PdRange extends PdBaseUIInput {
96
101
  input[type=range]::-moz-range-thumb {
97
102
  /* redundant, check if it is possible to extract common definitions */
98
103
  cursor: pointer;
99
- height: 20px;
104
+ height: 15px;
100
105
  width: 39px;
101
106
  background: var(--pd-range-thumb-col, var(--pd-default-hover-col));
102
107
  border: 1px solid var(--pd-default-dark-col);
@@ -110,7 +115,7 @@ export class PdRange extends PdBaseUIInput {
110
115
  input[type=range]::-ms-thumb {
111
116
  /* redundant, check if it is possible to extract common definitions */
112
117
  cursor: pointer;
113
- height: 20px;
118
+ height: 15px;
114
119
  width: 39px;
115
120
  background: var(--pd-range-thumb-col, var(--pd-default-hover-col));
116
121
  border: 1px solid var(--pd-default-dark-col);
@@ -209,7 +214,7 @@ export class PdRange extends PdBaseUIInput {
209
214
  .value="${this.value}"
210
215
  ?readonly="${this.readonly}"
211
216
  ?disabled="${this.disabled}"
212
- min="0" max="${this.max}" step="1"
217
+ min="${this.min}" max="${this.max}" step="1"
213
218
  @change="${this._onChange}"
214
219
  @input="${this._onChange}"
215
220
  />
@@ -224,7 +229,7 @@ export class PdRange extends PdBaseUIInput {
224
229
  }
225
230
 
226
231
  _onChange(e) {
227
- this._handleChangedValue(this._input.value, e, false, true);
232
+ this._handleChangedValue(this._input.value, e, false);
228
233
  }
229
234
 
230
235
  }