@prolibu-suite/cobalt-form-vue 0.1.3 → 2.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.
- package/dist/FieldObject-Cxd3I0Jv.js +4 -0
- package/dist/components/CoFieldRenderer.test.d.ts +2 -0
- package/dist/components/CoFieldRenderer.test.d.ts.map +1 -0
- package/dist/components/CoFieldRenderer.vue.d.ts +40 -3
- package/dist/components/CoFieldRenderer.vue.d.ts.map +1 -1
- package/dist/components/CoFieldShell.vue.d.ts +23 -0
- package/dist/components/CoFieldShell.vue.d.ts.map +1 -0
- package/dist/components/CoFormRenderer.file.test.d.ts +2 -0
- package/dist/components/CoFormRenderer.file.test.d.ts.map +1 -0
- package/dist/components/CoFormRenderer.nested.test.d.ts +2 -0
- package/dist/components/CoFormRenderer.nested.test.d.ts.map +1 -0
- package/dist/components/CoFormRenderer.vue.d.ts +35 -6
- package/dist/components/CoFormRenderer.vue.d.ts.map +1 -1
- package/dist/components/fields/FieldBoolean.vue.d.ts.map +1 -1
- package/dist/components/fields/FieldColor.vue.d.ts +17 -0
- package/dist/components/fields/FieldColor.vue.d.ts.map +1 -0
- package/dist/components/fields/FieldDate.vue.d.ts.map +1 -1
- package/dist/components/fields/FieldDatePicker.vue.d.ts +18 -0
- package/dist/components/fields/FieldDatePicker.vue.d.ts.map +1 -0
- package/dist/components/fields/FieldFile.test.d.ts +2 -0
- package/dist/components/fields/FieldFile.test.d.ts.map +1 -0
- package/dist/components/fields/FieldFile.vue.d.ts +61 -0
- package/dist/components/fields/FieldFile.vue.d.ts.map +1 -0
- package/dist/components/fields/FieldMasked.test.d.ts +2 -0
- package/dist/components/fields/FieldMasked.test.d.ts.map +1 -0
- package/dist/components/fields/FieldMasked.vue.d.ts +23 -0
- package/dist/components/fields/FieldMasked.vue.d.ts.map +1 -0
- package/dist/components/fields/FieldMixed.vue.d.ts +17 -0
- package/dist/components/fields/FieldMixed.vue.d.ts.map +1 -0
- package/dist/components/fields/FieldMultiple.vue.d.ts +17 -0
- package/dist/components/fields/FieldMultiple.vue.d.ts.map +1 -0
- package/dist/components/fields/FieldNumber.vue.d.ts.map +1 -1
- package/dist/components/fields/FieldObject.vue.d.ts +18 -0
- package/dist/components/fields/FieldObject.vue.d.ts.map +1 -0
- package/dist/components/fields/FieldPhone.vue.d.ts +16 -0
- package/dist/components/fields/FieldPhone.vue.d.ts.map +1 -0
- package/dist/components/fields/FieldRef.vue.d.ts +2 -2
- package/dist/components/fields/FieldRichText.vue.d.ts +16 -0
- package/dist/components/fields/FieldRichText.vue.d.ts.map +1 -0
- package/dist/components/fields/FieldSelect.vue.d.ts.map +1 -1
- package/dist/components/fields/FieldText.vue.d.ts.map +1 -1
- package/dist/components/fields/FieldTextArea.vue.d.ts.map +1 -1
- package/dist/composables/useFileFieldStates.d.ts +41 -0
- package/dist/composables/useFileFieldStates.d.ts.map +1 -0
- package/dist/composables/useForm.d.ts.map +1 -1
- package/dist/composables/useForm.test.d.ts +2 -0
- package/dist/composables/useForm.test.d.ts.map +1 -0
- package/dist/composables/useRefFieldStates.d.ts +25 -0
- package/dist/composables/useRefFieldStates.d.ts.map +1 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +25 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3921 -386
- package/dist/utils/fieldPath.d.ts +29 -0
- package/dist/utils/fieldPath.d.ts.map +1 -0
- package/dist/utils/formContext.d.ts +84 -0
- package/dist/utils/formContext.d.ts.map +1 -0
- package/dist/utils/gridCell.d.ts +28 -0
- package/dist/utils/gridCell.d.ts.map +1 -0
- package/dist/utils/gridCell.test.d.ts +2 -0
- package/dist/utils/gridCell.test.d.ts.map +1 -0
- package/dist/utils/normalizeMaskConfig.d.ts +23 -0
- package/dist/utils/normalizeMaskConfig.d.ts.map +1 -0
- package/dist/utils/normalizeMaskConfig.test.d.ts +2 -0
- package/dist/utils/normalizeMaskConfig.test.d.ts.map +1 -0
- package/dist/utils/sectionPreview.d.ts +26 -0
- package/dist/utils/sectionPreview.d.ts.map +1 -0
- package/dist/utils/sectionPreview.test.d.ts +2 -0
- package/dist/utils/sectionPreview.test.d.ts.map +1 -0
- package/package.json +13 -6
|
@@ -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"}
|
|
@@ -0,0 +1,84 @@
|
|
|
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';
|
|
5
|
+
/**
|
|
6
|
+
* Nesting depth of an object fieldset within the form tree. Top-level fields
|
|
7
|
+
* inject the default `0`; each `FieldObject` provides `depth + 1` to its
|
|
8
|
+
* descendants so nested objects can render a progressive left indentation.
|
|
9
|
+
*/
|
|
10
|
+
export declare const FORM_DEPTH: InjectionKey<number>;
|
|
11
|
+
/**
|
|
12
|
+
* When true, every object fieldset starts expanded regardless of
|
|
13
|
+
* `computeInitialOpen`. Provided once by `CoFormRenderer` (via its `expandAll`
|
|
14
|
+
* prop) and read by every nested `FieldObject`. Defaults to a `false` ref when
|
|
15
|
+
* no provider is present.
|
|
16
|
+
*/
|
|
17
|
+
export declare const FORM_EXPAND_ALL: InjectionKey<Ref<boolean>>;
|
|
18
|
+
/**
|
|
19
|
+
* Effective grid column count inherited from the enclosing form/fieldset. The
|
|
20
|
+
* top-level `CoFormRenderer` provides its own column count; each `FieldObject`
|
|
21
|
+
* uses it as the default for its children grid (unless the schema overrides it
|
|
22
|
+
* via `originalAttrs.columns`) and re-provides its resolved value so deeper
|
|
23
|
+
* objects inherit too. Lets a single-column form (e.g. preferences) cascade to
|
|
24
|
+
* every nested object. Defaults to a `ref(2)` when no provider is present.
|
|
25
|
+
*/
|
|
26
|
+
export declare const FORM_COLUMNS: InjectionKey<Ref<number>>;
|
|
27
|
+
/**
|
|
28
|
+
* Validation errors keyed by full field dot-path (e.g.
|
|
29
|
+
* `stageRules.restrictProposalViewToStages`). Provided once by `CoFormRenderer`
|
|
30
|
+
* so nested `FieldObject` children can look up their own error by `path`.
|
|
31
|
+
*/
|
|
32
|
+
export declare const FORM_ERRORS: InjectionKey<Ref<Record<string, string[]>>>;
|
|
33
|
+
/**
|
|
34
|
+
* Touched map keyed by full field dot-path. A field shows its error only once
|
|
35
|
+
* its path is touched. Provided by `CoFormRenderer`.
|
|
36
|
+
*/
|
|
37
|
+
export declare const FORM_TOUCHED: InjectionKey<Ref<Record<string, boolean>>>;
|
|
38
|
+
/**
|
|
39
|
+
* Marks a field path as touched (on blur). Provided by `CoFormRenderer` so
|
|
40
|
+
* nested children can flag themselves touched by their `path`.
|
|
41
|
+
*/
|
|
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>;
|
|
84
|
+
//# sourceMappingURL=formContext.d.ts.map
|
|
@@ -0,0 +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;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAElE;;;;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;AACH,eAAO,MAAM,UAAU,EAAE,YAAY,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAA2B,CAAC;AAExF,+DAA+D;AAC/D,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,IAAI,EAAE,MAAM,IAAI,CAAC;CAClB;AAED;;;;;GAKG;AACH,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"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { FieldDescriptor } from '@prolibu-suite/cobalt-form-core';
|
|
2
|
+
export type FormGap = 'sm' | 'md' | 'lg';
|
|
3
|
+
/** uiComs that traditionally render full-width in Prolibu schemas. Single source
|
|
4
|
+
* of truth (used by both CoFormRenderer and FieldObject). */
|
|
5
|
+
export declare const FULL_WIDTH_UICOMS: Set<string>;
|
|
6
|
+
export declare function isFullWidthField(field: FieldDescriptor): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Inline grid style for a form/section root. Applied inline (not via a
|
|
9
|
+
* stylesheet) on purpose: suite-v2 consumes form-vue's JS but NOT its CSS
|
|
10
|
+
* bundle, so any layout that lives in a `.css` file never renders there. Inline
|
|
11
|
+
* styles always apply.
|
|
12
|
+
*
|
|
13
|
+
* - `columns <= 1` → a single stacked column.
|
|
14
|
+
* - `columns >= 2` → responsive auto-fit: as many `MIN_COL_TRACK`-wide columns
|
|
15
|
+
* as fit, collapsing to 1 when narrow (no media query needed).
|
|
16
|
+
*/
|
|
17
|
+
export declare function gridRootStyle(columns: number, gap: FormGap): Record<string, string>;
|
|
18
|
+
/** Effective span for one cell, clamped to the grid's column count. */
|
|
19
|
+
export declare function cellSpan(field: FieldDescriptor, columns: number): number;
|
|
20
|
+
/**
|
|
21
|
+
* Inline per-cell bindings. Full-width cells span every track; multi-span cells
|
|
22
|
+
* span N tracks (browser clamps to the rendered track count). A plain
|
|
23
|
+
* single-column cell needs no style. Spread on the cell via `v-bind`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function cellBindings(field: FieldDescriptor, columns: number, isFull: boolean): {
|
|
26
|
+
style?: Record<string, string>;
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=gridCell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gridCell.d.ts","sourceRoot":"","sources":["../../src/utils/gridCell.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAEvE,MAAM,MAAM,OAAO,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAWzC;8DAC8D;AAC9D,eAAO,MAAM,iBAAiB,aAQ5B,CAAC;AAEH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAIhE;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAQnF;AAED,uEAAuE;AACvE,wBAAgB,QAAQ,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAGxE;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,eAAe,EACtB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,OAAO,GACd;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAKpC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gridCell.test.d.ts","sourceRoot":"","sources":["../../src/utils/gridCell.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { MaskNormalizeMode, MaskRawMode } from '@prolibu-suite/cobalt-form-core';
|
|
2
|
+
export declare const DEFAULT_MASK_CONFIG: {
|
|
3
|
+
readonly lazy: true;
|
|
4
|
+
readonly placeholderChar: "_";
|
|
5
|
+
readonly rawMode: "unmasked";
|
|
6
|
+
readonly normalize: "none";
|
|
7
|
+
};
|
|
8
|
+
export interface NormalizedMaskConfig {
|
|
9
|
+
pattern: string;
|
|
10
|
+
lazy: boolean;
|
|
11
|
+
placeholderChar: string;
|
|
12
|
+
rawMode: MaskRawMode;
|
|
13
|
+
normalize: MaskNormalizeMode;
|
|
14
|
+
countryCode: string | null;
|
|
15
|
+
imaskOptions: {
|
|
16
|
+
mask: string;
|
|
17
|
+
lazy: boolean;
|
|
18
|
+
placeholderChar: string;
|
|
19
|
+
};
|
|
20
|
+
cacheKey: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function normalizeMaskConfig(mask: unknown): NormalizedMaskConfig | null;
|
|
23
|
+
//# sourceMappingURL=normalizeMaskConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalizeMaskConfig.d.ts","sourceRoot":"","sources":["../../src/utils/normalizeMaskConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,iBAAiB,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAElG,eAAO,MAAM,mBAAmB;;;;;CAKtB,CAAC;AAEX,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,WAAW,CAAC;IACrB,SAAS,EAAE,iBAAiB,CAAC;IAC7B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,YAAY,EAAE;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,OAAO,CAAC;QACd,eAAe,EAAE,MAAM,CAAC;KACzB,CAAC;IACF,QAAQ,EAAE,MAAM,CAAC;CAClB;AAoED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,OAAO,GAAG,oBAAoB,GAAG,IAAI,CAO9E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalizeMaskConfig.test.d.ts","sourceRoot":"","sources":["../../src/utils/normalizeMaskConfig.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { FieldDescriptor } from '@prolibu-suite/cobalt-form-core';
|
|
2
|
+
/** A value is "empty" when it carries no user information. */
|
|
3
|
+
export declare function isEmptyValue(v: any): boolean;
|
|
4
|
+
/** True if any value among the children is non-empty. */
|
|
5
|
+
export declare function hasAnyValue(children: FieldDescriptor[], objectValue: Record<string, any>): boolean;
|
|
6
|
+
/** True if a required child is empty (forces the section open). */
|
|
7
|
+
export declare function hasEmptyRequiredChild(children: FieldDescriptor[], objectValue: Record<string, any>): boolean;
|
|
8
|
+
export interface InitialOpenArgs {
|
|
9
|
+
children: FieldDescriptor[];
|
|
10
|
+
objectValue: Record<string, any>;
|
|
11
|
+
errors: string[];
|
|
12
|
+
originalAttrs?: Record<string, any>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Initial open/collapsed state for a fieldset accordion.
|
|
16
|
+
* Schema override wins: `expanded === true` → open; `collapsed === true` →
|
|
17
|
+
* collapsed (unless errors force open). Otherwise: open when there are errors,
|
|
18
|
+
* an empty required child, or no value at all; collapsed when filled & complete.
|
|
19
|
+
*/
|
|
20
|
+
export declare function computeInitialOpen({ children, objectValue, errors, originalAttrs, }: InitialOpenArgs): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Short, "·"-joined summary of the section's non-empty children. Caps at
|
|
23
|
+
* PREVIEW_CAP entries then "+N". Returns '' when there is nothing to show.
|
|
24
|
+
*/
|
|
25
|
+
export declare function formatSectionPreview(children: FieldDescriptor[], objectValue: Record<string, any>, _locale?: string): string;
|
|
26
|
+
//# sourceMappingURL=sectionPreview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sectionPreview.d.ts","sourceRoot":"","sources":["../../src/utils/sectionPreview.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAIvE,8DAA8D;AAC9D,wBAAgB,YAAY,CAAC,CAAC,EAAE,GAAG,GAAG,OAAO,CAK5C;AAMD,yDAAyD;AACzD,wBAAgB,WAAW,CACzB,QAAQ,EAAE,eAAe,EAAE,EAC3B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC/B,OAAO,CAET;AAED,mEAAmE;AACnE,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,eAAe,EAAE,EAC3B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC/B,OAAO,CAET;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACjC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACrC;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,WAAW,EACX,MAAM,EACN,aAAa,GACd,EAAE,eAAe,GAAG,OAAO,CAO3B;AA4CD;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,eAAe,EAAE,EAC3B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAChC,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,CAUR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sectionPreview.test.d.ts","sourceRoot":"","sources":["../../src/utils/sectionPreview.test.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prolibu-suite/cobalt-form-vue",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Cobalt Form — Vue 3 adapter. useForm() composable + CoFormRenderer component.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
11
12
|
"import": "./dist/index.js",
|
|
12
|
-
"
|
|
13
|
+
"default": "./dist/index.js"
|
|
13
14
|
},
|
|
14
15
|
"./style.css": "./dist/style.css"
|
|
15
16
|
},
|
|
@@ -27,16 +28,20 @@
|
|
|
27
28
|
"license": "MIT",
|
|
28
29
|
"peerDependencies": {
|
|
29
30
|
"vue": "^3.0.0",
|
|
30
|
-
"@prolibu-suite/cobalt-core": "0.
|
|
31
|
-
"@prolibu-suite/cobalt-vue": "0.
|
|
31
|
+
"@prolibu-suite/cobalt-core": "0.3.0",
|
|
32
|
+
"@prolibu-suite/cobalt-vue": "0.3.0"
|
|
32
33
|
},
|
|
33
34
|
"dependencies": {
|
|
34
|
-
"
|
|
35
|
+
"imask": "^7.6.1",
|
|
36
|
+
"@prolibu-suite/cobalt-form-core": "0.3.0"
|
|
35
37
|
},
|
|
36
38
|
"devDependencies": {
|
|
39
|
+
"@vue/test-utils": "^2.4.6",
|
|
37
40
|
"@vitejs/plugin-vue": "^5.2.1",
|
|
41
|
+
"jsdom": "^29.0.2",
|
|
38
42
|
"typescript": "^6.0.3",
|
|
39
43
|
"vite": "^6.0.0",
|
|
44
|
+
"vitest": "^4.1.4",
|
|
40
45
|
"vue": "^3.5.22",
|
|
41
46
|
"vue-tsc": "^2.2.0"
|
|
42
47
|
},
|
|
@@ -46,6 +51,8 @@
|
|
|
46
51
|
"scripts": {
|
|
47
52
|
"build": "vite build && vue-tsc --emitDeclarationOnly -p tsconfig.json",
|
|
48
53
|
"dev": "vite build --watch",
|
|
49
|
-
"clean": "rm -rf dist"
|
|
54
|
+
"clean": "rm -rf dist",
|
|
55
|
+
"test": "vitest run",
|
|
56
|
+
"test:watch": "vitest"
|
|
50
57
|
}
|
|
51
58
|
}
|