@gitlab/ui 126.0.0 → 126.0.1
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();
|
package/package.json
CHANGED
|
@@ -154,6 +154,10 @@ export default {
|
|
|
154
154
|
|
|
155
155
|
this.formElement?.addEventListener('submit', this.onFormSubmission);
|
|
156
156
|
},
|
|
157
|
+
created() {
|
|
158
|
+
this.batchedInputEvent = {};
|
|
159
|
+
this.isBatchedInputEventScheduled = false;
|
|
160
|
+
},
|
|
157
161
|
destroyed() {
|
|
158
162
|
this.formElement?.removeEventListener('submit', this.onFormSubmission);
|
|
159
163
|
},
|
|
@@ -209,17 +213,9 @@ export default {
|
|
|
209
213
|
this.setFieldDirty(fieldName);
|
|
210
214
|
}
|
|
211
215
|
},
|
|
212
|
-
onFieldInput(fieldName, inputValue) {
|
|
216
|
+
async onFieldInput(fieldName, inputValue) {
|
|
213
217
|
const val = this.getMappedValue(fieldName, inputValue);
|
|
214
218
|
|
|
215
|
-
/**
|
|
216
|
-
* Emitted when any of the form values change. Used by `v-model`.
|
|
217
|
-
*/
|
|
218
|
-
this.$emit('input', {
|
|
219
|
-
...this.values,
|
|
220
|
-
[fieldName]: val,
|
|
221
|
-
});
|
|
222
|
-
|
|
223
219
|
/**
|
|
224
220
|
* Emitted when a form input emits the `input` event.
|
|
225
221
|
*/
|
|
@@ -227,6 +223,30 @@ export default {
|
|
|
227
223
|
name: fieldName,
|
|
228
224
|
value: val,
|
|
229
225
|
});
|
|
226
|
+
|
|
227
|
+
this.batchedInputEvent = {
|
|
228
|
+
...this.batchedInputEvent,
|
|
229
|
+
[fieldName]: val,
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
// Return if a batched input event has already been scheduled
|
|
233
|
+
if (this.isBatchedInputEventScheduled) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
this.isBatchedInputEventScheduled = true;
|
|
238
|
+
await this.$nextTick();
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Emitted when any of the form values change. Used by `v-model`.
|
|
242
|
+
*/
|
|
243
|
+
this.$emit('input', {
|
|
244
|
+
...this.values,
|
|
245
|
+
...this.batchedInputEvent,
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
this.batchedInputEvent = {};
|
|
249
|
+
this.isBatchedInputEventScheduled = false;
|
|
230
250
|
},
|
|
231
251
|
async onFormSubmission(e) {
|
|
232
252
|
e.preventDefault();
|