@fougere/nuxt 0.16.8-alpha.0 → 0.17.0-alpha.0
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/runtime/composables/useFormFor.d.ts +2 -9
- package/dist/runtime/composables/useFormFor.d.ts.map +1 -1
- package/dist/runtime/composables/useFormFor.js +1 -1
- package/dist/runtime/composables/useFormFor.js.map +1 -1
- package/package.json +5 -5
- package/src/runtime/composables/useFormFor.ts +3 -10
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
import { type Choice, type FormEntity, type FormField, type FormErrors, type FormFieldName, type FormRow, type FormValues } from '@fougere/app/client';
|
|
2
|
-
export
|
|
3
|
-
/** Command the submit rides. Default: 'create'. */
|
|
4
|
-
op?: string;
|
|
5
|
-
/** Initial values (edit mode: the loaded entity). */
|
|
6
|
-
initial?: Record<string, unknown>;
|
|
7
|
-
/** Call params designating the target (edit mode: { id }). */
|
|
8
|
-
params?: Record<string, string>;
|
|
9
|
-
}
|
|
1
|
+
import { type Choice, type FormEntity, type FormField, type FormErrors, type FormFieldName, type FormRow, type FormValues, type FormOptions } from '@fougere/app/client';
|
|
2
|
+
export type { FormOptions };
|
|
10
3
|
export declare function useFormFor<E extends FormEntity>(entity: E, options?: FormOptions): {
|
|
11
4
|
fields: FormField<FormFieldName<E>>[];
|
|
12
5
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFormFor.d.ts","sourceRoot":"","sources":["../../../src/runtime/composables/useFormFor.ts"],"names":[],"mappings":"AAKA,OAAO,EAA6D,KAAK,MAAM,EAAgB,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,KAAK,UAAU,EAAE,KAAK,aAAa,EAAE,KAAK,OAAO,EAAE,KAAK,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"useFormFor.d.ts","sourceRoot":"","sources":["../../../src/runtime/composables/useFormFor.ts"],"names":[],"mappings":"AAKA,OAAO,EAA6D,KAAK,MAAM,EAAgB,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,KAAK,UAAU,EAAE,KAAK,aAAa,EAAE,KAAK,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElP,YAAY,EAAE,WAAW,EAAE,CAAC;AAE5B,wBAAgB,UAAU,CAAC,CAAC,SAAS,UAAU,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,GAAE,WAAgB;;IA8DjF;;;OAGG;kBACiE,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAChH,UAAU,CAAC,CAAC,CAAC;YACb,UAAU,CAAC,CAAC,CAAC;aACX,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAC/D,0GAA0G;gBAChF,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;mBAnD1C,aAAa,CAAC,CAAC,CAAC,oBAAc,OAAO,CAAC,IAAI,CAAC;kBA+B9C,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;;IAwBjD,+EAA+E;;;EAIlF"}
|
|
@@ -15,7 +15,7 @@ export function useFormFor(entity, options = {}) {
|
|
|
15
15
|
const errors = reactive({});
|
|
16
16
|
// A form is designated by its ENTITY — it is a set of fields — so the facade it submits to is
|
|
17
17
|
// an address with no handler type behind it, and what it answers is the entity's row.
|
|
18
|
-
const command = useCommand(facadeOf(entity), options.op ?? 'create');
|
|
18
|
+
const command = useCommand(options.to ?? facadeOf(entity), options.op ?? 'create');
|
|
19
19
|
const fetcher = useRequestFetch();
|
|
20
20
|
const choices = reactive({});
|
|
21
21
|
const searchable = reactive({});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFormFor.js","sourceRoot":"","sources":["../../../src/runtime/composables/useFormFor.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"useFormFor.js","sourceRoot":"","sources":["../../../src/runtime/composables/useFormFor.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAoJ,MAAM,qBAAqB,CAAC;AAIlP,MAAM,UAAU,UAAU,CAAuB,MAAS,EAAE,OAAO,GAAgB,EAAE;IACnF,MAAM,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1C,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAE/C,qFAAqF;IACrF,iFAAiF;IACjF,iFAAiF;IACjF,+DAA+D;IAC/D,MAAM,MAAM,GAAG,QAAQ,CACrB,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,O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AAE,MAAuB;QAC/B,MAAM,EAAE,MAAuB;QAC/B,OAAO,EAAE,OAAsD;QAC/D,0GAA0G;QAC1G,UAAU,EAAE,UAAwD;QACpE,MAAM;QACN,MAAM;QACN,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,+EAA+E;QAC/E,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,KAAK,EAAE,QAAQ,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;KACxD,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fougere/nuxt",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0-alpha.0",
|
|
4
4
|
"description": "The Nuxt module: Fougere's client primitives and server surface.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fougere",
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
"template"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@fougere/app": "0.
|
|
36
|
-
"@fougere/core": "0.
|
|
37
|
-
"@fougere/defaults": "0.
|
|
35
|
+
"@fougere/app": "0.17.0-alpha.0",
|
|
36
|
+
"@fougere/core": "0.17.0-alpha.0",
|
|
37
|
+
"@fougere/defaults": "0.17.0-alpha.0",
|
|
38
38
|
"@nuxt/kit": "^4.5.1",
|
|
39
39
|
"jiti": "^2.6.1",
|
|
40
|
-
"@fougere/compiler": "0.
|
|
40
|
+
"@fougere/compiler": "0.17.0-alpha.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@nuxt/schema": "^4.5.1",
|
|
@@ -3,16 +3,9 @@ import { reactive, computed, onMounted } from 'vue';
|
|
|
3
3
|
import { useRequestFetch } from '#imports';
|
|
4
4
|
import { lowerFirst, validationErrorsOf } from '@fougere/core/contract';
|
|
5
5
|
import { useCommand } from './useFougereData.js';
|
|
6
|
-
import { Choices, facadeOf, formFieldsOf, payloadOf, errorsByField, type Choice, type Fetcher, type FormEntity, type FormField, type FormErrors, type FormFieldName, type FormRow, type FormValues } from '@fougere/app/client';
|
|
6
|
+
import { Choices, facadeOf, formFieldsOf, payloadOf, errorsByField, type Choice, type Fetcher, type FormEntity, type FormField, type FormErrors, type FormFieldName, type FormRow, type FormValues, type FormOptions } from '@fougere/app/client';
|
|
7
7
|
|
|
8
|
-
export
|
|
9
|
-
/** Command the submit rides. Default: 'create'. */
|
|
10
|
-
op?: string;
|
|
11
|
-
/** Initial values (edit mode: the loaded entity). */
|
|
12
|
-
initial?: Record<string, unknown>;
|
|
13
|
-
/** Call params designating the target (edit mode: { id }). */
|
|
14
|
-
params?: Record<string, string>;
|
|
15
|
-
}
|
|
8
|
+
export type { FormOptions };
|
|
16
9
|
|
|
17
10
|
export function useFormFor<E extends FormEntity>(entity: E, options: FormOptions = {}) {
|
|
18
11
|
const entityKey = lowerFirst(entity.name);
|
|
@@ -28,7 +21,7 @@ export function useFormFor<E extends FormEntity>(entity: E, options: FormOptions
|
|
|
28
21
|
const errors = reactive<Record<string, string>>({});
|
|
29
22
|
// A form is designated by its ENTITY — it is a set of fields — so the facade it submits to is
|
|
30
23
|
// an address with no handler type behind it, and what it answers is the entity's row.
|
|
31
|
-
const command = useCommand(facadeOf(entity), options.op ?? 'create');
|
|
24
|
+
const command = useCommand(options.to ?? facadeOf(entity), options.op ?? 'create');
|
|
32
25
|
const fetcher = useRequestFetch() as Fetcher;
|
|
33
26
|
const choices = reactive<Record<string, Choice[]>>({});
|
|
34
27
|
const searchable = reactive<Record<string, boolean>>({});
|