@r2digisolutions/components 0.14.8 → 0.14.9
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.
|
@@ -59,8 +59,12 @@ export declare function getRemoteFormId(action: string | undefined | null): stri
|
|
|
59
59
|
/**
|
|
60
60
|
* Resolve HTML input props for a field inside a Kit remote form.
|
|
61
61
|
* Prefer a precomputed `formId` string so fields never touch Kit proxies.
|
|
62
|
+
*
|
|
63
|
+
* Kit’s `fields.x.as(type)` uses plain names (`email`, `n:age`). Do **not** append
|
|
64
|
+
* `/formId` — remote ids look like `hash/name` and would produce invalid paths
|
|
65
|
+
* (`email/dp12ax/login_remote`) that break `convert_formdata`.
|
|
62
66
|
*/
|
|
63
|
-
export declare function resolveRemoteInputProps(
|
|
67
|
+
export declare function resolveRemoteInputProps(_formId: string | null | undefined, logicalName: string | undefined, type?: string): ResolvedRemoteInputProps;
|
|
64
68
|
export type ParsedRemoteFieldName = {
|
|
65
69
|
/** Field path for errors / `form.data` (`email`, `items[0].name`) */
|
|
66
70
|
logicalName: string | undefined;
|
|
@@ -76,6 +80,9 @@ export type ParsedRemoteFieldName = {
|
|
|
76
80
|
* When `formId` is known, uses Kit’s suffix rule (`/${formId}`).
|
|
77
81
|
* Otherwise treats the first `/` after an optional `n:`/`b:` prefix as the form-id boundary
|
|
78
82
|
* (logical paths use `.` / `[n]`, never `/`).
|
|
83
|
+
*
|
|
84
|
+
* Note: current Kit `.as()` emits plain names without `/formId`. Encoding with the
|
|
85
|
+
* full remote id (`hash/name`) must not be reintroduced — it breaks convert_formdata.
|
|
79
86
|
*/
|
|
80
87
|
export declare function parseRemoteFieldName(name: string | undefined, formId?: string | null): ParsedRemoteFieldName;
|
|
81
88
|
/**
|
|
@@ -20,18 +20,20 @@ export function getRemoteFormId(action) {
|
|
|
20
20
|
/**
|
|
21
21
|
* Resolve HTML input props for a field inside a Kit remote form.
|
|
22
22
|
* Prefer a precomputed `formId` string so fields never touch Kit proxies.
|
|
23
|
+
*
|
|
24
|
+
* Kit’s `fields.x.as(type)` uses plain names (`email`, `n:age`). Do **not** append
|
|
25
|
+
* `/formId` — remote ids look like `hash/name` and would produce invalid paths
|
|
26
|
+
* (`email/dp12ax/login_remote`) that break `convert_formdata`.
|
|
23
27
|
*/
|
|
24
|
-
export function resolveRemoteInputProps(
|
|
28
|
+
export function resolveRemoteInputProps(_formId, logicalName, type = 'text') {
|
|
25
29
|
if (!logicalName)
|
|
26
30
|
return {};
|
|
27
|
-
if (!formId)
|
|
28
|
-
return { name: logicalName };
|
|
29
31
|
let prefix = '';
|
|
30
32
|
if (type === 'number' || type === 'range')
|
|
31
33
|
prefix = 'n:';
|
|
32
34
|
else if (type === 'checkbox' || type === 'boolean')
|
|
33
35
|
prefix = 'b:';
|
|
34
|
-
return { name: `${prefix}${logicalName}
|
|
36
|
+
return { name: `${prefix}${logicalName}` };
|
|
35
37
|
}
|
|
36
38
|
/**
|
|
37
39
|
* Split a Kit-encoded HTML `name` (`email/1p9kxmo/login_user`, `n:age/...`)
|
|
@@ -40,6 +42,9 @@ export function resolveRemoteInputProps(formId, logicalName, type = 'text') {
|
|
|
40
42
|
* When `formId` is known, uses Kit’s suffix rule (`/${formId}`).
|
|
41
43
|
* Otherwise treats the first `/` after an optional `n:`/`b:` prefix as the form-id boundary
|
|
42
44
|
* (logical paths use `.` / `[n]`, never `/`).
|
|
45
|
+
*
|
|
46
|
+
* Note: current Kit `.as()` emits plain names without `/formId`. Encoding with the
|
|
47
|
+
* full remote id (`hash/name`) must not be reintroduced — it breaks convert_formdata.
|
|
43
48
|
*/
|
|
44
49
|
export function parseRemoteFieldName(name, formId) {
|
|
45
50
|
if (!name) {
|