@rxdi/forms 0.7.145 → 0.7.148
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/dist/form.group.d.ts +1 -1
- package/dist/form.group.js +9 -2
- package/package.json +2 -2
package/dist/form.group.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ export declare class FormGroup<T = FormInputOptions, E = {
|
|
|
43
43
|
set value(value: T);
|
|
44
44
|
unsubscribe(): void;
|
|
45
45
|
getValue(name: keyof T): T[keyof T];
|
|
46
|
-
setValue(name: keyof T, value:
|
|
46
|
+
setValue(name: keyof T, value: any): void;
|
|
47
47
|
setFormValue(value: T): void;
|
|
48
48
|
setFormElement(form: HTMLFormElement): this;
|
|
49
49
|
setInputs(inputs: AbstractInput[]): void;
|
package/dist/form.group.js
CHANGED
|
@@ -220,6 +220,9 @@ class FormGroup {
|
|
|
220
220
|
.map(v => {
|
|
221
221
|
this.errors[element.name] = this.errors[element.name] || {};
|
|
222
222
|
const error = v.bind(this.getParentElement())(element);
|
|
223
|
+
if (error) {
|
|
224
|
+
element.focus();
|
|
225
|
+
}
|
|
223
226
|
if (error && error.key) {
|
|
224
227
|
this.errors[element.name][error.key] = error.message;
|
|
225
228
|
this.errorMap.set(v, error.key);
|
|
@@ -271,10 +274,11 @@ class FormGroup {
|
|
|
271
274
|
return this.value[name];
|
|
272
275
|
}
|
|
273
276
|
setValue(name, value) {
|
|
277
|
+
const input = this.get(name);
|
|
278
|
+
input.value = value;
|
|
274
279
|
const values = this.value;
|
|
275
280
|
values[name] = value;
|
|
276
281
|
this.value = values;
|
|
277
|
-
return values;
|
|
278
282
|
}
|
|
279
283
|
setFormValue(value) {
|
|
280
284
|
this.value = value;
|
|
@@ -284,7 +288,10 @@ class FormGroup {
|
|
|
284
288
|
return this;
|
|
285
289
|
}
|
|
286
290
|
setInputs(inputs) {
|
|
287
|
-
this.inputs = new Map(inputs.map(e =>
|
|
291
|
+
this.inputs = new Map(inputs.map(e => {
|
|
292
|
+
e.value = this.getValue(e.name);
|
|
293
|
+
return [e.name, e];
|
|
294
|
+
}));
|
|
288
295
|
}
|
|
289
296
|
getFormElement() {
|
|
290
297
|
return this.form;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rxdi/forms",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.148",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"author": "Kristiyan Tachev",
|
|
6
6
|
"license": "MIT",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"build": "tsc || true"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@rxdi/lit-html": "^0.7.
|
|
15
|
+
"@rxdi/lit-html": "^0.7.147",
|
|
16
16
|
"@types/node": "^12.0.10",
|
|
17
17
|
"rxjs": "^6.5.3",
|
|
18
18
|
"typescript": "^4.3.5"
|