monkey-front-components 0.0.742 → 0.0.744
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/esm2020/lib/components/base/base-component.mjs +20 -1
- package/fesm2015/monkey-front-components.mjs +19 -0
- package/fesm2015/monkey-front-components.mjs.map +1 -1
- package/fesm2020/monkey-front-components.mjs +19 -0
- package/fesm2020/monkey-front-components.mjs.map +1 -1
- package/lib/components/base/base-component.d.ts +1 -0
- package/monkey-front-components-0.0.744.tgz +0 -0
- package/package.json +1 -1
- package/monkey-front-components-0.0.742.tgz +0 -0
|
@@ -140,6 +140,19 @@ class BaseComponent {
|
|
|
140
140
|
}
|
|
141
141
|
return '';
|
|
142
142
|
}
|
|
143
|
+
scrollToError() {
|
|
144
|
+
setTimeout(() => {
|
|
145
|
+
const error = document.getElementsByTagName('error');
|
|
146
|
+
let letHEele = null;
|
|
147
|
+
for (let i = 0; i <= error.length; i += 1) {
|
|
148
|
+
if (`${error[i].textContent}`.trim()) {
|
|
149
|
+
letHEele = error[i];
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
letHEele?.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
154
|
+
}, 0);
|
|
155
|
+
}
|
|
143
156
|
validateFormWithTranslate(f, index) {
|
|
144
157
|
const formErrors = f.value;
|
|
145
158
|
if (f.status === 'VALID')
|
|
@@ -216,6 +229,12 @@ class BaseComponent {
|
|
|
216
229
|
};
|
|
217
230
|
}
|
|
218
231
|
f.markAllAsTouched();
|
|
232
|
+
try {
|
|
233
|
+
this.scrollToError();
|
|
234
|
+
}
|
|
235
|
+
catch (e) {
|
|
236
|
+
// ignore
|
|
237
|
+
}
|
|
219
238
|
return false;
|
|
220
239
|
}
|
|
221
240
|
clearAllServiceData(clearData) {
|