@prolibu-suite/cobalt-form-vue 1.0.0 → 3.0.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.
@@ -0,0 +1,29 @@
1
+ import type { FieldDescriptor } from '@prolibu-suite/cobalt-form-core';
2
+ import type { UseFormReturn } from '../composables/useForm';
3
+ /**
4
+ * Stable state key for a field: its dot-path from the form root. Top-level
5
+ * descriptors have `path === name` (or no `path` at all), so this is fully
6
+ * backward-compatible with the old `name`-keyed state maps.
7
+ */
8
+ export declare function fieldKey(f: FieldDescriptor): string;
9
+ /**
10
+ * Depth-first walk over fields **and their nested object children** (the
11
+ * nested descriptors live in `FieldDescriptor.children`).
12
+ */
13
+ export declare function walkFields(fields: FieldDescriptor[], visit: (f: FieldDescriptor) => void): void;
14
+ /** Read a value by dot-path from the form's values snapshot. */
15
+ export declare function getValueAtPath(values: Record<string, any>, path: string): any;
16
+ /**
17
+ * Write a value by dot-path through the form controller. The controller only
18
+ * accepts top-level names, so nested paths write via their top-level parent
19
+ * (`setValue(root, { ...root, child: v })`) — the same flow FieldObject uses
20
+ * when a child emits its full object up to the parent.
21
+ *
22
+ * Returns the `{ name, value }` pair actually written (the root field), so
23
+ * callers can emit `change` with the host-visible payload.
24
+ */
25
+ export declare function setValueAtPath(form: UseFormReturn, path: string, value: any): {
26
+ name: string;
27
+ value: any;
28
+ };
29
+ //# sourceMappingURL=fieldPath.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fieldPath.d.ts","sourceRoot":"","sources":["../../src/utils/fieldPath.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE5D;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,eAAe,GAAG,MAAM,CAEnD;AAED;;;GAGG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,eAAe,EAAE,EACzB,KAAK,EAAE,CAAC,CAAC,EAAE,eAAe,KAAK,IAAI,GAClC,IAAI,CAKN;AAED,gEAAgE;AAChE,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,GAAG,CAI7E;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,aAAa,EACnB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,GAAG,GACT;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,GAAG,CAAA;CAAE,CAU9B"}
@@ -1,4 +1,7 @@
1
1
  import type { InjectionKey, Ref } from 'vue';
2
+ import type { UploadedFileRef } from '@prolibu-suite/cobalt-form-core';
3
+ import type { FileItem } from '../components/fields/FieldFile.vue';
4
+ import type { RefState } from '../components/fields/FieldRef.vue';
2
5
  /**
3
6
  * Nesting depth of an object fieldset within the form tree. Top-level fields
4
7
  * inject the default `0`; each `FieldObject` provides `depth + 1` to its
@@ -37,4 +40,45 @@ export declare const FORM_TOUCHED: InjectionKey<Ref<Record<string, boolean>>>;
37
40
  * nested children can flag themselves touched by their `path`.
38
41
  */
39
42
  export declare const FORM_TOUCH: InjectionKey<(path: string) => void>;
43
+ /** Event handlers for a single ref field, resolved by path. */
44
+ export interface RefFieldHandlers {
45
+ search: (query: string) => void;
46
+ loadMore: () => void;
47
+ open: () => void;
48
+ }
49
+ /**
50
+ * Ref-field machine (options/selected-display/paging), keyed by full field
51
+ * dot-path. Provided once by `CoFormRenderer` so nested `FieldObject` children
52
+ * of kind `ref` can read their state and forward their events — the resolvers
53
+ * live at the form root, not per fieldset.
54
+ */
55
+ export interface RefFieldsContext {
56
+ stateFor: (path: string) => RefState | undefined;
57
+ handlersFor: (path: string) => RefFieldHandlers;
58
+ }
59
+ export declare const FORM_REF_FIELDS: InjectionKey<RefFieldsContext>;
60
+ /** Event handlers for a single file field, resolved by path. */
61
+ export interface FileFieldHandlers {
62
+ upload: (payload: {
63
+ files: File[];
64
+ tempIds: string[];
65
+ }) => void;
66
+ removeFile: (idOrTempId: string) => void;
67
+ reorder: (keys: string[]) => void;
68
+ addFiles: (refs: UploadedFileRef[]) => void;
69
+ copyUrl: (payload: {
70
+ id: string;
71
+ url: string;
72
+ }) => void;
73
+ }
74
+ /**
75
+ * File-field machine (upload/remove/reorder UI state), keyed by full field
76
+ * dot-path. Provided once by `CoFormRenderer` for nested `file` children —
77
+ * same rationale as {@link FORM_REF_FIELDS}.
78
+ */
79
+ export interface FileFieldsContext {
80
+ stateFor: (path: string) => FileItem[] | undefined;
81
+ handlersFor: (path: string) => FileFieldHandlers;
82
+ }
83
+ export declare const FORM_FILE_FIELDS: InjectionKey<FileFieldsContext>;
40
84
  //# sourceMappingURL=formContext.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"formContext.d.ts","sourceRoot":"","sources":["../../src/utils/formContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE7C;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,YAAY,CAAC,MAAM,CAA2B,CAAC;AAExE;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAAE,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAgC,CAAC;AAExF;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,EAAE,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,CAA6B,CAAC;AAEjF;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAA4B,CAAC;AAEjG;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAA6B,CAAC;AAElG;;;GAGG;AAC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ACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,QAAQ,GAAG,SAAS,CAAC;IACjD,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,gBAAgB,CAAC;CACjD;AACD,eAAO,MAAM,eAAe,EAAE,YAAY,CAAC,gBAAgB,CAAgC,CAAC;AAE5F,gEAAgE;AAChE,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,CAAC,OAAO,EAAE;QAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE,KAAK,IAAI,CAAC;IAChE,UAAU,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAClC,QAAQ,EAAE,CAAC,IAAI,EAAE,eAAe,EAAE,KAAK,IAAI,CAAC;IAC5C,OAAO,EAAE,CAAC,OAAO,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CACzD;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,QAAQ,EAAE,GAAG,SAAS,CAAC;IACnD,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,iBAAiB,CAAC;CAClD;AACD,eAAO,MAAM,gBAAgB,EAAE,YAAY,CAAC,iBAAiB,CAAiC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prolibu-suite/cobalt-form-vue",
3
- "version": "1.0.0",
3
+ "version": "3.0.0",
4
4
  "description": "Cobalt Form — Vue 3 adapter. useForm() composable + CoFormRenderer component.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -28,8 +28,8 @@
28
28
  "license": "MIT",
29
29
  "peerDependencies": {
30
30
  "vue": "^3.0.0",
31
- "@prolibu-suite/cobalt-core": "0.2.0",
32
- "@prolibu-suite/cobalt-vue": "0.2.0"
31
+ "@prolibu-suite/cobalt-vue": "0.3.1",
32
+ "@prolibu-suite/cobalt-core": "0.4.0"
33
33
  },
34
34
  "dependencies": {
35
35
  "imask": "^7.6.1",