@gitlab/ui 126.0.0 → 126.0.2

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.
@@ -144,6 +144,10 @@ var script = {
144
144
  this.$emit('input', this.fieldValues);
145
145
  (_this$formElement = this.formElement) === null || _this$formElement === void 0 ? void 0 : _this$formElement.addEventListener('submit', this.onFormSubmission);
146
146
  },
147
+ created() {
148
+ this.batchedInputEvent = {};
149
+ this.isBatchedInputEventScheduled = false;
150
+ },
147
151
  destroyed() {
148
152
  var _this$formElement2;
149
153
  (_this$formElement2 = this.formElement) === null || _this$formElement2 === void 0 ? void 0 : _this$formElement2.removeEventListener('submit', this.onFormSubmission);
@@ -192,17 +196,9 @@ var script = {
192
196
  this.setFieldDirty(fieldName);
193
197
  }
194
198
  },
195
- onFieldInput(fieldName, inputValue) {
199
+ async onFieldInput(fieldName, inputValue) {
196
200
  const val = this.getMappedValue(fieldName, inputValue);
197
201
 
198
- /**
199
- * Emitted when any of the form values change. Used by `v-model`.
200
- */
201
- this.$emit('input', {
202
- ...this.values,
203
- [fieldName]: val
204
- });
205
-
206
202
  /**
207
203
  * Emitted when a form input emits the `input` event.
208
204
  */
@@ -210,6 +206,27 @@ var script = {
210
206
  name: fieldName,
211
207
  value: val
212
208
  });
209
+ this.batchedInputEvent = {
210
+ ...this.batchedInputEvent,
211
+ [fieldName]: val
212
+ };
213
+
214
+ // Return if a batched input event has already been scheduled
215
+ if (this.isBatchedInputEventScheduled) {
216
+ return;
217
+ }
218
+ this.isBatchedInputEventScheduled = true;
219
+ await this.$nextTick();
220
+
221
+ /**
222
+ * Emitted when any of the form values change. Used by `v-model`.
223
+ */
224
+ this.$emit('input', {
225
+ ...this.values,
226
+ ...this.batchedInputEvent
227
+ });
228
+ this.batchedInputEvent = {};
229
+ this.isBatchedInputEventScheduled = false;
213
230
  },
214
231
  async onFormSubmission(e) {
215
232
  e.preventDefault();