saasufy-components 5.5.1 → 5.6.0

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
@@ -692,6 +692,7 @@ This component can be configured to provide its data to multiple components (con
692
692
  - `autocapitalize`: Can be `on` or `off` - It will set the auto-capitalize attribute on the inner input element. This is useful for mobile devices to enable or disable auto-capitalization of the first character which is typed into the input element.
693
693
  - `autocorrect`: Can be `on` or `off` - It will set the auto-correct attribute on the inner input element. This is useful for mobile devices to enable or disable auto-correct.
694
694
  - `input-props`: Can be used to set additional attributes on the inner `input` element. Must be in the format `attr1=value1,attr2=value2`.
695
+ - `force-init-change`: This attribute can be used to ensure that an `input-provider` of type `select` will trigger a change when initialized with a default (non-empty option). By default, the `input-provider` does not trigger a change when initialized with a default value.
695
696
 
696
697
  ### input-combiner
697
698
 
package/input-provider.js CHANGED
@@ -70,6 +70,10 @@ class InputProvider extends HTMLElement {
70
70
 
71
71
  set value(newValue) {
72
72
  if (this.inputElement) {
73
+ let forceInitChange = this.forceTriggerChange;
74
+ if (forceInitChange) {
75
+ delete this.forceTriggerChange;
76
+ }
73
77
  if (newValue && this.hasAttribute('computable-value')) {
74
78
  newValue = renderTemplate(newValue);
75
79
  }
@@ -82,15 +86,14 @@ class InputProvider extends HTMLElement {
82
86
  } else {
83
87
  this.inputElement.checked = newValue;
84
88
  }
85
- if (oldValue !== newValue) {
89
+ if (oldValue !== newValue || forceInitChange) {
86
90
  this.triggerChange();
87
91
  }
88
92
  return;
89
93
  }
90
94
  oldValue = this.inputElement.value;
91
95
  this.inputElement.value = newValue;
92
- if (oldValue !== newValue || this.forceTriggerChange) {
93
- delete this.forceTriggerChange;
96
+ if (oldValue !== newValue || forceInitChange) {
94
97
  this.triggerChange();
95
98
  }
96
99
  }
@@ -176,11 +179,8 @@ class InputProvider extends HTMLElement {
176
179
  }
177
180
  }
178
181
 
179
- if (type === 'select') {
180
- this.forceTriggerChange = true;
181
- if (!value) {
182
- value = this.inputElement.value;
183
- }
182
+ if (type === 'select' && !value) {
183
+ value = this.inputElement.value;
184
184
  }
185
185
 
186
186
  this.updateInputClassList(value);
@@ -189,6 +189,9 @@ class InputProvider extends HTMLElement {
189
189
  let destroyHandlers = this.updateConsumerElementsOnEdit();
190
190
 
191
191
  if (value) {
192
+ if (this.hasAttribute('force-init-change')) {
193
+ this.forceTriggerChange = true;
194
+ }
192
195
  this.value = value;
193
196
  }
194
197
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "saasufy-components",
3
- "version": "5.5.1",
3
+ "version": "5.6.0",
4
4
  "description": "Components for Saasufy.",
5
5
  "main": "index.js",
6
6
  "scripts": {