@rxdi/forms 0.7.222 → 0.7.224
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.js +17 -8
- package/dist/form.tokens.d.ts +1 -1
- package/package.json +2 -2
package/dist/form.group.js
CHANGED
|
@@ -101,7 +101,9 @@ class FormGroup {
|
|
|
101
101
|
this.options = options;
|
|
102
102
|
this.controls.forEach((c) => {
|
|
103
103
|
var _a;
|
|
104
|
-
(_a = c.setOptions) === null || _a === void 0 ? void 0 : _a.call(c, Object.assign(Object.assign({}, options), { namespace: this.options.namespace
|
|
104
|
+
(_a = c.setOptions) === null || _a === void 0 ? void 0 : _a.call(c, Object.assign(Object.assign({}, options), { namespace: this.options.namespace
|
|
105
|
+
? `${this.options.namespace}.${c.name}`
|
|
106
|
+
: c.name }));
|
|
105
107
|
});
|
|
106
108
|
return this;
|
|
107
109
|
}
|
|
@@ -162,7 +164,9 @@ class FormGroup {
|
|
|
162
164
|
value = Number(value);
|
|
163
165
|
}
|
|
164
166
|
const inputsWithBindings = [
|
|
165
|
-
...self
|
|
167
|
+
...(self
|
|
168
|
+
.getFormElement()
|
|
169
|
+
.querySelectorAll(`input[name="${this.name}"]:checked`)).values(),
|
|
166
170
|
];
|
|
167
171
|
if (hasMultipleBindings > 1) {
|
|
168
172
|
if (!self.options.multi && this.type === 'checkbox') {
|
|
@@ -222,12 +226,14 @@ class FormGroup {
|
|
|
222
226
|
return form;
|
|
223
227
|
}
|
|
224
228
|
querySelectAll(name) {
|
|
225
|
-
return [
|
|
229
|
+
return [
|
|
230
|
+
...this.form.querySelectorAll(name).values(),
|
|
231
|
+
];
|
|
226
232
|
}
|
|
227
233
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
228
234
|
querySelectorAllInputs() {
|
|
229
|
-
|
|
230
|
-
return [...(
|
|
235
|
+
const customElements = this.options.customElements.map((v) => typeof v === 'string' ? v : typeof v === 'function' ? v.is() : v);
|
|
236
|
+
return [...(customElements !== null && customElements !== void 0 ? customElements : []), 'input', 'select', 'textarea']
|
|
231
237
|
.map((item) => this.querySelectAll(item))
|
|
232
238
|
.flat()
|
|
233
239
|
.filter((el) => this.isInputPresentOnStage(el))
|
|
@@ -243,7 +249,7 @@ class FormGroup {
|
|
|
243
249
|
};
|
|
244
250
|
}
|
|
245
251
|
const customAttributes = Object.keys(el.attributes)
|
|
246
|
-
.map((k) =>
|
|
252
|
+
.map((k) => el.attributes[k].name.startsWith('#') ? el.attributes[k] : null)
|
|
247
253
|
.filter((i) => !!i);
|
|
248
254
|
if (customAttributes.length) {
|
|
249
255
|
const attr = customAttributes.find((a) => a.name.startsWith('#'));
|
|
@@ -303,7 +309,9 @@ class FormGroup {
|
|
|
303
309
|
if (!element.checkValidity()) {
|
|
304
310
|
return {
|
|
305
311
|
errors: errors.concat(Object.keys(form_tokens_1.InputValidityState)
|
|
306
|
-
.map((key) =>
|
|
312
|
+
.map((key) => element.validity[key]
|
|
313
|
+
? { key, message: element.validationMessage }
|
|
314
|
+
: null)
|
|
307
315
|
.filter((i) => !!i)),
|
|
308
316
|
element,
|
|
309
317
|
};
|
|
@@ -360,7 +368,8 @@ class FormGroup {
|
|
|
360
368
|
*/
|
|
361
369
|
const key = name;
|
|
362
370
|
// Check if key exists in the model value even if not in inputs map
|
|
363
|
-
if (this._valueChanges.getValue() &&
|
|
371
|
+
if (this._valueChanges.getValue() &&
|
|
372
|
+
key in this._valueChanges.getValue()) {
|
|
364
373
|
// Create a "Virtual" AbstractInput to prevent crashes and allow subscription even if no DOM element present
|
|
365
374
|
return {
|
|
366
375
|
valueChanges: this._valueChanges.pipe((0, operators_1.map)((value) => value === null || value === void 0 ? void 0 : value[key]), (0, operators_1.distinctUntilChanged)()),
|
package/dist/form.tokens.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export interface FormOptions {
|
|
|
25
25
|
* When set form will expand capabilities by selecting another custom element made as a form element
|
|
26
26
|
* Example can be found here https://gist.github.com/Stradivario/57acf0fa19900867a7f55b0f01251d6e
|
|
27
27
|
* */
|
|
28
|
-
customElements?: string[];
|
|
28
|
+
customElements?: string[] | LitElement[];
|
|
29
29
|
/**
|
|
30
30
|
* Internal property for handling nested forms.
|
|
31
31
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rxdi/forms",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.224",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"author": "Kristiyan Tachev",
|
|
6
6
|
"license": "MIT",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"build": "tsc"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@rxdi/lit-html": "^0.7.
|
|
15
|
+
"@rxdi/lit-html": "^0.7.223",
|
|
16
16
|
"@types/node": "^25.0.3",
|
|
17
17
|
"rxjs": "^7.8.2",
|
|
18
18
|
"typescript": "^5.9.3"
|