saasufy-components 5.5.0 → 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 +1 -0
- package/input-provider.js +10 -5
- package/package.json +1 -1
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 ||
|
|
93
|
-
delete this.forceTriggerChange;
|
|
96
|
+
if (oldValue !== newValue || forceInitChange) {
|
|
94
97
|
this.triggerChange();
|
|
95
98
|
}
|
|
96
99
|
}
|
|
@@ -176,8 +179,7 @@ class InputProvider extends HTMLElement {
|
|
|
176
179
|
}
|
|
177
180
|
}
|
|
178
181
|
|
|
179
|
-
if (type === 'select') {
|
|
180
|
-
this.forceTriggerChange = true;
|
|
182
|
+
if (type === 'select' && !value) {
|
|
181
183
|
value = this.inputElement.value;
|
|
182
184
|
}
|
|
183
185
|
|
|
@@ -187,6 +189,9 @@ class InputProvider extends HTMLElement {
|
|
|
187
189
|
let destroyHandlers = this.updateConsumerElementsOnEdit();
|
|
188
190
|
|
|
189
191
|
if (value) {
|
|
192
|
+
if (this.hasAttribute('force-init-change')) {
|
|
193
|
+
this.forceTriggerChange = true;
|
|
194
|
+
}
|
|
190
195
|
this.value = value;
|
|
191
196
|
}
|
|
192
197
|
|