@dragonmastery/zinia-forms-core 0.4.8 → 0.5.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/index.d.ts +218 -21
- package/dist/index.js +2198 -205
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -734,7 +734,7 @@ type ComponentsType<T> = {
|
|
|
734
734
|
* Metadata about a form field
|
|
735
735
|
* This interface defines all the properties that describe a field's behavior and appearance
|
|
736
736
|
*/
|
|
737
|
-
interface FieldMetadata {
|
|
737
|
+
interface FieldMetadata$1 {
|
|
738
738
|
/** The full path to the field (e.g., 'user.firstName') */
|
|
739
739
|
path: string;
|
|
740
740
|
/** Whether the field is required (false if optional) */
|
|
@@ -763,9 +763,9 @@ interface FieldMetadata {
|
|
|
763
763
|
/** Whether the field is an array */
|
|
764
764
|
isArray?: boolean;
|
|
765
765
|
/** Metadata for array element type */
|
|
766
|
-
arrayOf?: FieldMetadata;
|
|
766
|
+
arrayOf?: FieldMetadata$1;
|
|
767
767
|
/** Child field metadata for object types */
|
|
768
|
-
children?: Record<string, FieldMetadata>;
|
|
768
|
+
children?: Record<string, FieldMetadata$1>;
|
|
769
769
|
/** Available items for array fields */
|
|
770
770
|
availableItems?: any[];
|
|
771
771
|
/** Help text to display with the field */
|
|
@@ -824,7 +824,7 @@ interface ArrayFieldSlots<ItemType> {
|
|
|
824
824
|
* @param metadata Optional metadata to apply to the field
|
|
825
825
|
* @returns A properly typed array field component with slot types preserved
|
|
826
826
|
*/
|
|
827
|
-
declare function createTypedArrayField<T, P extends Path<T>>(baseArrayField: FunctionalComponent<ArrayFieldProps<T, any>, {}, any, {}>, fieldPath: P, metadata?: FieldMetadata): FunctionalComponent<Omit<ArrayFieldProps<T, ArrayItemType<T, P>>, "name">, {}, ArrayFieldSlots<ArrayItemType<T, P>>, {}>;
|
|
827
|
+
declare function createTypedArrayField<T, P extends Path<T>>(baseArrayField: FunctionalComponent<ArrayFieldProps<T, any>, {}, any, {}>, fieldPath: P, metadata?: FieldMetadata$1): FunctionalComponent<Omit<ArrayFieldProps<T, ArrayItemType<T, P>>, "name">, {}, ArrayFieldSlots<ArrayItemType<T, P>>, {}>;
|
|
828
828
|
|
|
829
829
|
/**
|
|
830
830
|
* Functions for creating type-safe combobox fields
|
|
@@ -900,7 +900,7 @@ type DisplayComponentsType<T> = {
|
|
|
900
900
|
* @param renderStyle The style to use for rendering
|
|
901
901
|
* @returns Generated display field components
|
|
902
902
|
*/
|
|
903
|
-
declare function generateDisplayComponents<T extends z.ZodObject<any>>(schema: T, fieldsMetadata: Record<string, FieldMetadata>, styleName?: RegisteredStyleName): {
|
|
903
|
+
declare function generateDisplayComponents<T extends z.ZodObject<any>>(schema: T, fieldsMetadata: Record<string, FieldMetadata$1>, styleName?: RegisteredStyleName): {
|
|
904
904
|
generic: {
|
|
905
905
|
DisplayField: vue.FunctionalComponent<DisplayFieldProps<z.TypeOf<T>>, {}, any, {}>;
|
|
906
906
|
fields: { [K in Path<z.TypeOf<T>>]: DisplayFieldComponent<z.TypeOf<T>, K, string>; };
|
|
@@ -917,7 +917,7 @@ declare function generateDisplayComponents<T extends z.ZodObject<any>>(schema: T
|
|
|
917
917
|
* @param renderStyle The style to use for rendering
|
|
918
918
|
* @returns Generated field components
|
|
919
919
|
*/
|
|
920
|
-
declare function generateFieldComponents<T extends z.ZodObject<any>>(schema: T, fieldsMetadata: Record<string, FieldMetadata>, styleName?: RegisteredStyleName): {
|
|
920
|
+
declare function generateFieldComponents<T extends z.ZodObject<any>>(schema: T, fieldsMetadata: Record<string, FieldMetadata$1>, styleName?: RegisteredStyleName): {
|
|
921
921
|
generic: {
|
|
922
922
|
TextField: vue.FunctionalComponent<TextFieldProps<z.TypeOf<T>>, {}, any, {}>;
|
|
923
923
|
NumberField: vue.FunctionalComponent<NumberFieldProps<z.TypeOf<T>>, {}, any, {}>;
|
|
@@ -1851,6 +1851,142 @@ declare function createStyleTemplate(): StyleCreators;
|
|
|
1851
1851
|
*/
|
|
1852
1852
|
type RenderStyle = 'daisy_ui';
|
|
1853
1853
|
|
|
1854
|
+
/**
|
|
1855
|
+
* Valid operators for each data type
|
|
1856
|
+
*/
|
|
1857
|
+
declare const OPERATORS_BY_TYPE: {
|
|
1858
|
+
string: readonly ["eq", "ne", "contains", "sw", "ew", "in", "notIn"];
|
|
1859
|
+
number: readonly ["eq", "ne", "gt", "gte", "lt", "lte", "between"];
|
|
1860
|
+
date: readonly ["eq", "ne", "gt", "gte", "lt", "lte", "between", "isEmpty", "isNotEmpty"];
|
|
1861
|
+
boolean: readonly ["eq", "ne"];
|
|
1862
|
+
enum: readonly ["eq", "ne", "in", "notIn"];
|
|
1863
|
+
money: readonly ["eq", "ne", "gt", "gte", "lt", "lte", "between"];
|
|
1864
|
+
percentage: readonly ["eq", "ne", "gt", "gte", "lt", "lte", "between"];
|
|
1865
|
+
};
|
|
1866
|
+
/**
|
|
1867
|
+
* Infer DataType from OPERATORS_BY_TYPE keys
|
|
1868
|
+
*/
|
|
1869
|
+
type DataType = keyof typeof OPERATORS_BY_TYPE;
|
|
1870
|
+
/**
|
|
1871
|
+
* Infer operator types from OPERATORS_BY_TYPE
|
|
1872
|
+
*/
|
|
1873
|
+
type ExtractOperatorType<T> = T extends readonly (infer U)[] ? U : never;
|
|
1874
|
+
type StringOperator = ExtractOperatorType<typeof OPERATORS_BY_TYPE.string>;
|
|
1875
|
+
type NumberOperator = ExtractOperatorType<typeof OPERATORS_BY_TYPE.number>;
|
|
1876
|
+
type DateOperator = ExtractOperatorType<typeof OPERATORS_BY_TYPE.date>;
|
|
1877
|
+
type BooleanOperator = ExtractOperatorType<typeof OPERATORS_BY_TYPE.boolean>;
|
|
1878
|
+
type EnumOperator = ExtractOperatorType<typeof OPERATORS_BY_TYPE.enum>;
|
|
1879
|
+
/**
|
|
1880
|
+
* Union type of all operators
|
|
1881
|
+
*/
|
|
1882
|
+
type Operator = StringOperator | NumberOperator | DateOperator | BooleanOperator | EnumOperator;
|
|
1883
|
+
/**
|
|
1884
|
+
* Check if an operator is valid for a given data type
|
|
1885
|
+
*/
|
|
1886
|
+
declare function isValidOperatorForType(operator: string, type: DataType): boolean;
|
|
1887
|
+
|
|
1888
|
+
/**
|
|
1889
|
+
* Filtering Types - Matching Client-Side Data Table Filtering Specification v1.0.0
|
|
1890
|
+
*/
|
|
1891
|
+
/**
|
|
1892
|
+
* Data types supported by the filtering system - inferred from OPERATORS_BY_TYPE keys
|
|
1893
|
+
*/
|
|
1894
|
+
|
|
1895
|
+
/**
|
|
1896
|
+
* Field metadata entry in the registry
|
|
1897
|
+
*/
|
|
1898
|
+
interface FieldMetadata {
|
|
1899
|
+
type: DataType;
|
|
1900
|
+
filterable?: boolean;
|
|
1901
|
+
searchable?: boolean;
|
|
1902
|
+
sortable?: boolean;
|
|
1903
|
+
}
|
|
1904
|
+
/**
|
|
1905
|
+
* Field registry - single source of truth for field metadata
|
|
1906
|
+
* Maps field names to their metadata
|
|
1907
|
+
*/
|
|
1908
|
+
interface FieldRegistry {
|
|
1909
|
+
[fieldName: string]: FieldMetadata;
|
|
1910
|
+
}
|
|
1911
|
+
/**
|
|
1912
|
+
* Filter value object - represents a filtering condition for a specific field
|
|
1913
|
+
* Field name is the key in FilterConfiguration, type comes from registry
|
|
1914
|
+
*/
|
|
1915
|
+
interface FilterValueObject {
|
|
1916
|
+
operator: string;
|
|
1917
|
+
value?: any;
|
|
1918
|
+
values?: any[];
|
|
1919
|
+
caseSensitive?: boolean;
|
|
1920
|
+
}
|
|
1921
|
+
/**
|
|
1922
|
+
* Filter configuration - flat object mapping field names to filter conditions
|
|
1923
|
+
* All filters are combined with implicit AND logic
|
|
1924
|
+
*/
|
|
1925
|
+
interface FilterConfiguration {
|
|
1926
|
+
[fieldName: string]: FilterValueObject;
|
|
1927
|
+
}
|
|
1928
|
+
/**
|
|
1929
|
+
* Validation result
|
|
1930
|
+
*/
|
|
1931
|
+
interface ValidationResult {
|
|
1932
|
+
valid: boolean;
|
|
1933
|
+
errors: ValidationError[];
|
|
1934
|
+
}
|
|
1935
|
+
/**
|
|
1936
|
+
* Validation error
|
|
1937
|
+
*/
|
|
1938
|
+
interface ValidationError {
|
|
1939
|
+
field?: string;
|
|
1940
|
+
message: string;
|
|
1941
|
+
code: string;
|
|
1942
|
+
}
|
|
1943
|
+
|
|
1944
|
+
/**
|
|
1945
|
+
* Filter Validation - Registry-based validation per spec
|
|
1946
|
+
*/
|
|
1947
|
+
|
|
1948
|
+
/**
|
|
1949
|
+
* Validate field registry structure
|
|
1950
|
+
*/
|
|
1951
|
+
declare function validateFieldRegistry(registry: FieldRegistry): ValidationResult;
|
|
1952
|
+
/**
|
|
1953
|
+
* Validate filter configuration against field registry
|
|
1954
|
+
*/
|
|
1955
|
+
declare function validateFilterConfiguration(config: FilterConfiguration, registry: FieldRegistry): ValidationResult;
|
|
1956
|
+
|
|
1957
|
+
/**
|
|
1958
|
+
* Field Registry Building - Convert Zod schemas and metadata to filter registry format
|
|
1959
|
+
*/
|
|
1960
|
+
|
|
1961
|
+
/**
|
|
1962
|
+
* Build field registry from Zod schema and form metadata
|
|
1963
|
+
*
|
|
1964
|
+
* @param schema Zod schema object
|
|
1965
|
+
* @param fieldsMetadata Form field metadata (from useFormMetadata)
|
|
1966
|
+
* @returns FieldRegistry for filtering
|
|
1967
|
+
*/
|
|
1968
|
+
declare function buildFieldRegistryFromSchema(schema: z.ZodObject<any>, fieldsMetadata: Record<string, FieldMetadata$1>): FieldRegistry;
|
|
1969
|
+
|
|
1970
|
+
/**
|
|
1971
|
+
* Filter Serialization - Query string and JSON serialization/deserialization
|
|
1972
|
+
* Uses compact DrizzleORM-style format: flt[field]=value or flt[field][op]=value
|
|
1973
|
+
*/
|
|
1974
|
+
|
|
1975
|
+
/**
|
|
1976
|
+
* Serialize filter configuration to URL-safe query string
|
|
1977
|
+
* Returns a plain query string (NOT URL-encoded) that can be used directly in URLSearchParams or Vue Router
|
|
1978
|
+
* Format: filters[name][operator]=contains&filters[name][value]=john
|
|
1979
|
+
*
|
|
1980
|
+
* Note: This returns the raw query string. If you need it URL-encoded, use encodeURIComponent().
|
|
1981
|
+
*/
|
|
1982
|
+
declare function serializeFiltersToQueryString(config: FilterConfiguration): string;
|
|
1983
|
+
/**
|
|
1984
|
+
* Deserialize filter configuration from query string
|
|
1985
|
+
* Supports both URLSearchParams format and legacy base64 format for backward compatibility
|
|
1986
|
+
* Validates against registry before returning
|
|
1987
|
+
*/
|
|
1988
|
+
declare function deserializeFiltersFromQueryString(queryString: string, registry: FieldRegistry): FilterConfiguration;
|
|
1989
|
+
|
|
1854
1990
|
declare const ZINIA_DATA_TABLE_KEY = "ziniaDataTable";
|
|
1855
1991
|
declare const ZINIA_DATA_TABLE_COLUMNS_KEY = "ziniaDataTableColumns";
|
|
1856
1992
|
declare const ZINIA_DATA_TABLE_OPTIONS_KEY = "ziniaDataTableOptions";
|
|
@@ -1858,6 +1994,7 @@ declare const ZINIA_DATA_TABLE_ACTIONS_KEY = "ziniaDataTableActions";
|
|
|
1858
1994
|
declare const ZINIA_DATA_TABLE_SEARCH_INPUT_KEY = "ziniaDataTableSearchInput";
|
|
1859
1995
|
declare const ZINIA_DATA_TABLE_FILTER_INPUTS_KEY = "ziniaDataTableFilterInputs";
|
|
1860
1996
|
declare const ZINIA_DATA_TABLE_FILTER_OPERATORS_KEY = "ziniaDataTableFilterOperators";
|
|
1997
|
+
declare const ZINIA_DATA_TABLE_FILTER_CASE_SENSITIVE_KEY = "ziniaDataTableFilterCaseSensitive";
|
|
1861
1998
|
declare const ZINIA_DATA_TABLE_FILTER_OPTIONS_STATE_KEY = "ziniaDataTableFilterOptionsState";
|
|
1862
1999
|
declare const ZINIA_DATA_TABLE_FILTER_OPTIONS_LOADING_KEY = "ziniaDataTableFilterOptionsLoading";
|
|
1863
2000
|
declare const ZINIA_DATA_TABLE_NAME_KEY = "ziniaDataTableName";
|
|
@@ -1921,7 +2058,7 @@ interface ColumnDefinition<TData, TField extends keyof TData> {
|
|
|
1921
2058
|
textWrap?: 'truncate' | 'wrap';
|
|
1922
2059
|
format?: (value: TData[TField], row: TData) => string;
|
|
1923
2060
|
render?: (value: TData[TField], row: TData) => any;
|
|
1924
|
-
filterType?: 'text' | 'select' | 'number' | 'boolean' | 'combobox';
|
|
2061
|
+
filterType?: 'text' | 'select' | 'number' | 'boolean' | 'combobox' | 'date';
|
|
1925
2062
|
filterOptions?: FilterOptionItem[];
|
|
1926
2063
|
filterOptionsLoader?: () => Promise<FilterOptionItem[]>;
|
|
1927
2064
|
filterAllowCreate?: boolean;
|
|
@@ -1939,7 +2076,7 @@ interface FetchDataParams<TData> {
|
|
|
1939
2076
|
field: keyof TData;
|
|
1940
2077
|
direction: 'asc' | 'desc';
|
|
1941
2078
|
} | null;
|
|
1942
|
-
filters:
|
|
2079
|
+
filters: FilterConfiguration;
|
|
1943
2080
|
search: {
|
|
1944
2081
|
query: string;
|
|
1945
2082
|
searchableFields: Array<keyof TData>;
|
|
@@ -1979,6 +2116,7 @@ interface DataTableOptions<TData> {
|
|
|
1979
2116
|
schemaId?: string;
|
|
1980
2117
|
name?: string;
|
|
1981
2118
|
autoProvide?: boolean;
|
|
2119
|
+
autoLoad?: boolean;
|
|
1982
2120
|
debug?: boolean;
|
|
1983
2121
|
onLoad?: (data: TData[]) => void;
|
|
1984
2122
|
onError?: (error: Error) => void;
|
|
@@ -2013,9 +2151,12 @@ declare function useDataTable<TSchema extends z.ZodObject<any>>(schema: TSchema,
|
|
|
2013
2151
|
readonly direction: "asc" | "desc";
|
|
2014
2152
|
};
|
|
2015
2153
|
filters: {
|
|
2016
|
-
readonly active:
|
|
2154
|
+
readonly active: FilterConfiguration;
|
|
2017
2155
|
readonly count: number;
|
|
2156
|
+
readonly queryParams: Record<string, string>;
|
|
2157
|
+
readonly queryString: string;
|
|
2018
2158
|
};
|
|
2159
|
+
readonly fieldRegistry: FieldRegistry;
|
|
2019
2160
|
search: {
|
|
2020
2161
|
readonly query: string;
|
|
2021
2162
|
readonly searchableFields: Array<keyof z.TypeOf<TSchema>>;
|
|
@@ -2030,9 +2171,11 @@ declare function useDataTable<TSchema extends z.ZodObject<any>>(schema: TSchema,
|
|
|
2030
2171
|
refresh: () => Promise<void>;
|
|
2031
2172
|
sort: (field: keyof z.TypeOf<TSchema>, direction?: "asc" | "desc") => Promise<void>;
|
|
2032
2173
|
clearSort: () => Promise<void>;
|
|
2033
|
-
setFilter: (field: keyof z.TypeOf<TSchema>,
|
|
2174
|
+
setFilter: (field: keyof z.TypeOf<TSchema>, filter: FilterValueObject) => Promise<void>;
|
|
2034
2175
|
clearFilter: (field: keyof z.TypeOf<TSchema>) => Promise<void>;
|
|
2035
2176
|
clearAllFilters: () => Promise<void>;
|
|
2177
|
+
setFiltersFromQueryParams: (params: Record<string, string | string[]>) => Promise<void>;
|
|
2178
|
+
setFiltersFromQueryString: (queryString: string) => Promise<void>;
|
|
2036
2179
|
setSearch: (query: string) => Promise<void>;
|
|
2037
2180
|
clearSearch: () => Promise<void>;
|
|
2038
2181
|
goToPage: (page: number) => Promise<void>;
|
|
@@ -2052,7 +2195,7 @@ declare function useDataTable<TSchema extends z.ZodObject<any>>(schema: TSchema,
|
|
|
2052
2195
|
openFilterDrawer: () => boolean;
|
|
2053
2196
|
closeFilterDrawer: () => boolean;
|
|
2054
2197
|
};
|
|
2055
|
-
fieldsMetadata: Record<string, FieldMetadata>;
|
|
2198
|
+
fieldsMetadata: Record<string, FieldMetadata$1>;
|
|
2056
2199
|
columns: (z.TypeOf<TSchema> extends infer T ? { [K in keyof T]?: ColumnDefinition<z.TypeOf<TSchema>, K> | undefined; } : never) & {
|
|
2057
2200
|
[key: string]: ColumnDefinition<z.TypeOf<TSchema>, any>;
|
|
2058
2201
|
};
|
|
@@ -2077,9 +2220,10 @@ declare function useDataTable<TSchema extends z.ZodObject<any>>(schema: TSchema,
|
|
|
2077
2220
|
refresh: () => Promise<void>;
|
|
2078
2221
|
sort: (field: keyof z.TypeOf<TSchema>, direction?: "asc" | "desc") => Promise<void>;
|
|
2079
2222
|
clearSort: () => Promise<void>;
|
|
2080
|
-
setFilter: (field: keyof z.TypeOf<TSchema>,
|
|
2223
|
+
setFilter: (field: keyof z.TypeOf<TSchema>, filter: FilterValueObject) => Promise<void>;
|
|
2081
2224
|
clearFilter: (field: keyof z.TypeOf<TSchema>) => Promise<void>;
|
|
2082
2225
|
clearAllFilters: () => Promise<void>;
|
|
2226
|
+
setFiltersFromQueryString: (queryString: string) => Promise<void>;
|
|
2083
2227
|
setSearch: (query: string) => Promise<void>;
|
|
2084
2228
|
clearSearch: () => Promise<void>;
|
|
2085
2229
|
goToPage: (page: number) => Promise<void>;
|
|
@@ -2104,7 +2248,7 @@ interface CursorFetchParams<TData> {
|
|
|
2104
2248
|
field: keyof TData;
|
|
2105
2249
|
direction: 'asc' | 'desc';
|
|
2106
2250
|
} | null;
|
|
2107
|
-
filters:
|
|
2251
|
+
filters: FilterConfiguration;
|
|
2108
2252
|
search: {
|
|
2109
2253
|
query: string;
|
|
2110
2254
|
searchableFields: Array<keyof TData>;
|
|
@@ -2148,6 +2292,7 @@ interface CursorDataTableOptions<TData> {
|
|
|
2148
2292
|
schemaId?: string;
|
|
2149
2293
|
name?: string;
|
|
2150
2294
|
autoProvide?: boolean;
|
|
2295
|
+
autoLoad?: boolean;
|
|
2151
2296
|
debug?: boolean;
|
|
2152
2297
|
onLoad?: (data: TData[]) => void;
|
|
2153
2298
|
onError?: (error: Error) => void;
|
|
@@ -2182,9 +2327,12 @@ declare function useCursorDataTable<TSchema extends z.ZodObject<any>>(schema: TS
|
|
|
2182
2327
|
readonly direction: "asc" | "desc";
|
|
2183
2328
|
};
|
|
2184
2329
|
filters: {
|
|
2185
|
-
readonly active:
|
|
2330
|
+
readonly active: FilterConfiguration;
|
|
2186
2331
|
readonly count: number;
|
|
2332
|
+
readonly queryParams: Record<string, string>;
|
|
2333
|
+
readonly queryString: string;
|
|
2187
2334
|
};
|
|
2335
|
+
readonly fieldRegistry: FieldRegistry;
|
|
2188
2336
|
search: {
|
|
2189
2337
|
readonly query: string;
|
|
2190
2338
|
readonly searchableFields: Array<keyof z.TypeOf<TSchema>>;
|
|
@@ -2199,9 +2347,11 @@ declare function useCursorDataTable<TSchema extends z.ZodObject<any>>(schema: TS
|
|
|
2199
2347
|
refresh: () => Promise<void>;
|
|
2200
2348
|
sort: (field: keyof z.TypeOf<TSchema>, direction?: "asc" | "desc") => Promise<void>;
|
|
2201
2349
|
clearSort: () => Promise<void>;
|
|
2202
|
-
setFilter: (field: keyof z.TypeOf<TSchema>,
|
|
2350
|
+
setFilter: (field: keyof z.TypeOf<TSchema>, filter: FilterValueObject) => Promise<void>;
|
|
2203
2351
|
clearFilter: (field: keyof z.TypeOf<TSchema>) => Promise<void>;
|
|
2204
2352
|
clearAllFilters: () => Promise<void>;
|
|
2353
|
+
setFiltersFromQueryParams: (params: Record<string, string | string[]>) => Promise<void>;
|
|
2354
|
+
setFiltersFromQueryString: (queryString: string) => Promise<void>;
|
|
2205
2355
|
setSearch: (query: string) => Promise<void>;
|
|
2206
2356
|
clearSearch: () => Promise<void>;
|
|
2207
2357
|
nextPage: () => Promise<void>;
|
|
@@ -2221,7 +2371,7 @@ declare function useCursorDataTable<TSchema extends z.ZodObject<any>>(schema: TS
|
|
|
2221
2371
|
openFilterDrawer: () => boolean;
|
|
2222
2372
|
closeFilterDrawer: () => boolean;
|
|
2223
2373
|
};
|
|
2224
|
-
fieldsMetadata: Record<string, FieldMetadata>;
|
|
2374
|
+
fieldsMetadata: Record<string, FieldMetadata$1>;
|
|
2225
2375
|
columns: (z.TypeOf<TSchema> extends infer T ? { [K in keyof T]?: ColumnDefinition<z.TypeOf<TSchema>, K> | undefined; } : never) & {
|
|
2226
2376
|
[key: string]: ColumnDefinition<z.TypeOf<TSchema>, any>;
|
|
2227
2377
|
};
|
|
@@ -2246,9 +2396,10 @@ declare function useCursorDataTable<TSchema extends z.ZodObject<any>>(schema: TS
|
|
|
2246
2396
|
refresh: () => Promise<void>;
|
|
2247
2397
|
sort: (field: keyof z.TypeOf<TSchema>, direction?: "asc" | "desc") => Promise<void>;
|
|
2248
2398
|
clearSort: () => Promise<void>;
|
|
2249
|
-
setFilter: (field: keyof z.TypeOf<TSchema>,
|
|
2399
|
+
setFilter: (field: keyof z.TypeOf<TSchema>, filter: FilterValueObject) => Promise<void>;
|
|
2250
2400
|
clearFilter: (field: keyof z.TypeOf<TSchema>) => Promise<void>;
|
|
2251
2401
|
clearAllFilters: () => Promise<void>;
|
|
2402
|
+
setFiltersFromQueryString: (queryString: string) => Promise<void>;
|
|
2252
2403
|
setSearch: (query: string) => Promise<void>;
|
|
2253
2404
|
clearSearch: () => Promise<void>;
|
|
2254
2405
|
nextPage: () => Promise<void>;
|
|
@@ -2304,7 +2455,7 @@ declare function useDeleteModal<TSchema extends z.ZodObject<any>>(schema: TSchem
|
|
|
2304
2455
|
readonly data: z.TypeOf<TSchema>;
|
|
2305
2456
|
readonly isLoading: boolean;
|
|
2306
2457
|
readonly error: string | null;
|
|
2307
|
-
fieldsMetadata: Record<string, FieldMetadata>;
|
|
2458
|
+
fieldsMetadata: Record<string, FieldMetadata$1>;
|
|
2308
2459
|
confirmDelete: () => Promise<void>;
|
|
2309
2460
|
clearError: () => void;
|
|
2310
2461
|
getValue: (path: string) => any;
|
|
@@ -2357,7 +2508,7 @@ declare function useDisplay<TSchema extends z.ZodObject<any>, TExtra extends Rec
|
|
|
2357
2508
|
readonly isReady: boolean;
|
|
2358
2509
|
readonly error: string | null;
|
|
2359
2510
|
readonly lastLoadTime: number | null;
|
|
2360
|
-
fieldsMetadata: Record<string, FieldMetadata>;
|
|
2511
|
+
fieldsMetadata: Record<string, FieldMetadata$1>;
|
|
2361
2512
|
readonly isAsyncMode: boolean;
|
|
2362
2513
|
load: (options_?: {
|
|
2363
2514
|
data?: boolean;
|
|
@@ -2545,7 +2696,7 @@ declare function useForm<T extends z.ZodObject<any>, CalcType = (values: z.infer
|
|
|
2545
2696
|
timestamp: number;
|
|
2546
2697
|
timeoutId?: number;
|
|
2547
2698
|
}[]>;
|
|
2548
|
-
readonly fieldsMetadata: Record<string, FieldMetadata>;
|
|
2699
|
+
readonly fieldsMetadata: Record<string, FieldMetadata$1>;
|
|
2549
2700
|
validate: (options?: {
|
|
2550
2701
|
markErrorsAsTouched: boolean;
|
|
2551
2702
|
}) => boolean;
|
|
@@ -2684,6 +2835,52 @@ type ZiniaFormFields = UseFormType['zinia'];
|
|
|
2684
2835
|
type ZiniaFormGenericFields = UseFormType['ziniaGeneric'];
|
|
2685
2836
|
type UseFormTyped<T extends z.ZodObject<any>, CalcType = any, ExtraDataType extends Record<string, any> = Record<string, any>> = ReturnType<typeof useForm<T, CalcType, ExtraDataType>>;
|
|
2686
2837
|
|
|
2838
|
+
/**
|
|
2839
|
+
* useDataTableUrlSync - Syncs data table filters with URL query parameters
|
|
2840
|
+
*
|
|
2841
|
+
* Usage:
|
|
2842
|
+
* ```ts
|
|
2843
|
+
* import { useRouter } from 'vue-router';
|
|
2844
|
+
*
|
|
2845
|
+
* const router = useRouter();
|
|
2846
|
+
* const table = useCursorDataTable({ ... });
|
|
2847
|
+
* useDataTableUrlSync(table.table, router);
|
|
2848
|
+
* ```
|
|
2849
|
+
*/
|
|
2850
|
+
/** Minimal router interface (compatible with Vue Router's useRouter()) */
|
|
2851
|
+
interface Router {
|
|
2852
|
+
currentRoute: {
|
|
2853
|
+
value: {
|
|
2854
|
+
query: Record<string, any>;
|
|
2855
|
+
};
|
|
2856
|
+
};
|
|
2857
|
+
push: (options: {
|
|
2858
|
+
query: Record<string, any>;
|
|
2859
|
+
}) => void;
|
|
2860
|
+
}
|
|
2861
|
+
interface UrlSyncOptions {
|
|
2862
|
+
/** Whether to load filters from URL on mount (default: true) */
|
|
2863
|
+
loadOnMount?: boolean;
|
|
2864
|
+
}
|
|
2865
|
+
interface DataTable {
|
|
2866
|
+
setFilter: (field: any, filter: any) => Promise<void>;
|
|
2867
|
+
clearAllFilters: () => Promise<void>;
|
|
2868
|
+
setFiltersFromQueryParams: (params: Record<string, string | string[]>) => Promise<void>;
|
|
2869
|
+
load: () => Promise<void>;
|
|
2870
|
+
filters: {
|
|
2871
|
+
queryParams: Record<string, string>;
|
|
2872
|
+
};
|
|
2873
|
+
}
|
|
2874
|
+
/**
|
|
2875
|
+
* Syncs a data table's filters with URL query parameters.
|
|
2876
|
+
* Handles back/forward navigation and updates URL when filters change.
|
|
2877
|
+
*
|
|
2878
|
+
* @param table - The data table instance (from useCursorDataTable or useDataTable)
|
|
2879
|
+
* @param router - Vue Router instance (from useRouter())
|
|
2880
|
+
* @param options - Optional configuration
|
|
2881
|
+
*/
|
|
2882
|
+
declare function useDataTableUrlSync(table: DataTable, router: Router, options?: UrlSyncOptions): void;
|
|
2883
|
+
|
|
2687
2884
|
/**
|
|
2688
2885
|
* Form state management hook
|
|
2689
2886
|
* Provides reactive form state with proper reactivity handling
|
|
@@ -2827,4 +3024,4 @@ declare const DEBUG_CONFIG: {
|
|
|
2827
3024
|
*/
|
|
2828
3025
|
declare function isDebugEnabled(area: keyof Omit<typeof DEBUG_CONFIG, 'all'>): boolean;
|
|
2829
3026
|
|
|
2830
|
-
export { ActionIcons, type ActionItem, type ActionsConfig, type ArrayFieldProps, type ArrayFieldSlots, type ArrayItemType, type AsyncCascadingSelectsConfig, type AutoPopulateConfigs, type ButtonActionItem, COMBOBOX_FIELD_PROP_NAMES, type CheckboxFieldProps, type ColumnDefinition, type ComboboxFieldProps, type ComponentsType, type CurrencyFieldProps, type CursorDataTableOptions, type CursorFetchParams, type CursorFetchResult, DEBUG_CONFIG, type DataTableColumns, type DataTableOptions, type DataTableProps, type DateFieldProps, type DateTimeLocalFieldProps, type DeleteModalProps, type DisplayComponentsType, type DisplayFieldComponent, type DisplayFieldProps, type DisplayProps, type EmailFieldProps, type EnumValueToLabelMap, type EnumValuesFromField, ErrorDisplay, type ExtractEnumType, type FetchDataParams, type FetchDataResult, type FieldMetadata, type FieldNames, type FieldPathToEnum, type FieldType, type FileFieldProps, type FilterOptionItem, type FilterValue, type FormErrorsSummaryProps, type FormProps, type FormState, type FormStateResult, type FormValidationResult, type LinkActionItem, LoadingDisplay, type MergeOptions, type MetadataRegistry, NoDataDisplay, type NumberFieldProps, type PasswordFieldProps, type Path, type PathToPascalCase, type PathValue, type PathsOf, type RadioFieldProps, type RangeFieldProps, type RenderStyle, type ResetButtonProps, SCHEMA_ID_SYMBOL, SELECT_FIELD_PROP_NAMES, type SchemaFieldMetadata, type SearchFieldProps, type SelectFieldProps, type SelectOption, type StyleCreators, type SubmitButtonProps, type TelFieldProps, type TextFieldProps, type TextareaFieldProps, type TimeFieldProps, type ToppingsFieldProps, type TransferListFieldProps, type TypedSelectFieldComponent, type UrlFieldProps, type UseCursorDataTableType, type UseDataTableType, type UseDeleteModalType, type UseDisplayType, type UseFormType, type UseFormTyped, type ValueToLabelMapping, ZINIA_DATA_TABLE_ACTIONS_KEY, ZINIA_DATA_TABLE_COLUMNS_KEY, ZINIA_DATA_TABLE_FILTER_INPUTS_KEY, ZINIA_DATA_TABLE_FILTER_OPERATORS_KEY, ZINIA_DATA_TABLE_FILTER_OPTIONS_LOADING_KEY, ZINIA_DATA_TABLE_FILTER_OPTIONS_STATE_KEY, ZINIA_DATA_TABLE_KEY, ZINIA_DATA_TABLE_NAME_KEY, ZINIA_DATA_TABLE_OPTIONS_KEY, ZINIA_DATA_TABLE_SEARCH_INPUT_KEY, ZINIA_DELETE_MODAL_FIELDS_GENERIC_KEY, ZINIA_DELETE_MODAL_FIELDS_KEY, ZINIA_DELETE_MODAL_KEY, ZINIA_DELETE_MODAL_SCHEMA_KEY, ZINIA_DISPLAY_FIELDS_GENERIC_KEY, ZINIA_DISPLAY_FIELDS_KEY, ZINIA_DISPLAY_KEY, ZINIA_DISPLAY_SCHEMA_KEY, ZINIA_FIELDS_GENERIC_KEY, ZINIA_FIELDS_KEY, ZINIA_FORM_KEY, ZINIA_FORM_SCHEMA_KEY, type ZiniaDataTable, type ZiniaDeleteModal, type ZiniaDeleteModalFields, type ZiniaDeleteModalGenericFields, type ZiniaDisplay, type ZiniaDisplayFields, type ZiniaDisplayGenericFields, type ZiniaForm, type ZiniaFormFields, type ZiniaFormGenericFields, ZiniaPlugin, type ZiniaPluginOptions, type ZodEnumValues, clearAllMetadata, clearSchemaMetadata, createBaseComponents, createBaseDisplayComponents, createPartialStyle, createStyleTemplate, createTypedArrayField, createTypedComboboxField, createTypedSelectField, daisyUIStyle, extendStyle, generateDisplayComponents, generateFieldComponents, getAllSchemaMetadata, getDefaultStyle, getFieldMetadata, getRegisteredStyle, getRegisteredStyleNames, getSchemaId, hasRegisteredStyle, hasSchemaMetadata, isDebugEnabled, mergeStyles, registerSchemaMetadata, registerStyle, setSchemaMetadata, useCursorDataTable, useDataTable, useDeleteModal, useDisplay, useForm, withMetadata };
|
|
3027
|
+
export { ActionIcons, type ActionItem, type ActionsConfig, type ArrayFieldProps, type ArrayFieldSlots, type ArrayItemType, type AsyncCascadingSelectsConfig, type AutoPopulateConfigs, type ButtonActionItem, COMBOBOX_FIELD_PROP_NAMES, type CheckboxFieldProps, type ColumnDefinition, type ComboboxFieldProps, type ComponentsType, type CurrencyFieldProps, type CursorDataTableOptions, type CursorFetchParams, type CursorFetchResult, DEBUG_CONFIG, type DataTableColumns, type DataTableOptions, type DataTableProps, type DataType, type DateFieldProps, type DateTimeLocalFieldProps, type DeleteModalProps, type DisplayComponentsType, type DisplayFieldComponent, type DisplayFieldProps, type DisplayProps, type EmailFieldProps, type EnumValueToLabelMap, type EnumValuesFromField, ErrorDisplay, type ExtractEnumType, type FetchDataParams, type FetchDataResult, type FieldMetadata$1 as FieldMetadata, type FieldNames, type FieldPathToEnum, type FieldRegistry, type FieldType, type FileFieldProps, type FilterConfiguration, type FilterOptionItem, type FilterValue, type FilterValueObject, type FormErrorsSummaryProps, type FormProps, type FormState, type FormStateResult, type FormValidationResult, type LinkActionItem, LoadingDisplay, type MergeOptions, type MetadataRegistry, NoDataDisplay, type NumberFieldProps, type Operator, type PasswordFieldProps, type Path, type PathToPascalCase, type PathValue, type PathsOf, type RadioFieldProps, type RangeFieldProps, type RenderStyle, type ResetButtonProps, SCHEMA_ID_SYMBOL, SELECT_FIELD_PROP_NAMES, type SchemaFieldMetadata, type SearchFieldProps, type SelectFieldProps, type SelectOption, type StyleCreators, type SubmitButtonProps, type TelFieldProps, type TextFieldProps, type TextareaFieldProps, type TimeFieldProps, type ToppingsFieldProps, type TransferListFieldProps, type TypedSelectFieldComponent, type UrlFieldProps, type UseCursorDataTableType, type UseDataTableType, type UseDeleteModalType, type UseDisplayType, type UseFormType, type UseFormTyped, type ValidationError, type ValidationResult, type ValueToLabelMapping, ZINIA_DATA_TABLE_ACTIONS_KEY, ZINIA_DATA_TABLE_COLUMNS_KEY, ZINIA_DATA_TABLE_FILTER_CASE_SENSITIVE_KEY, ZINIA_DATA_TABLE_FILTER_INPUTS_KEY, ZINIA_DATA_TABLE_FILTER_OPERATORS_KEY, ZINIA_DATA_TABLE_FILTER_OPTIONS_LOADING_KEY, ZINIA_DATA_TABLE_FILTER_OPTIONS_STATE_KEY, ZINIA_DATA_TABLE_KEY, ZINIA_DATA_TABLE_NAME_KEY, ZINIA_DATA_TABLE_OPTIONS_KEY, ZINIA_DATA_TABLE_SEARCH_INPUT_KEY, ZINIA_DELETE_MODAL_FIELDS_GENERIC_KEY, ZINIA_DELETE_MODAL_FIELDS_KEY, ZINIA_DELETE_MODAL_KEY, ZINIA_DELETE_MODAL_SCHEMA_KEY, ZINIA_DISPLAY_FIELDS_GENERIC_KEY, ZINIA_DISPLAY_FIELDS_KEY, ZINIA_DISPLAY_KEY, ZINIA_DISPLAY_SCHEMA_KEY, ZINIA_FIELDS_GENERIC_KEY, ZINIA_FIELDS_KEY, ZINIA_FORM_KEY, ZINIA_FORM_SCHEMA_KEY, type ZiniaDataTable, type ZiniaDeleteModal, type ZiniaDeleteModalFields, type ZiniaDeleteModalGenericFields, type ZiniaDisplay, type ZiniaDisplayFields, type ZiniaDisplayGenericFields, type ZiniaForm, type ZiniaFormFields, type ZiniaFormGenericFields, ZiniaPlugin, type ZiniaPluginOptions, type ZodEnumValues, buildFieldRegistryFromSchema, clearAllMetadata, clearSchemaMetadata, createBaseComponents, createBaseDisplayComponents, createPartialStyle, createStyleTemplate, createTypedArrayField, createTypedComboboxField, createTypedSelectField, daisyUIStyle, deserializeFiltersFromQueryString, extendStyle, generateDisplayComponents, generateFieldComponents, getAllSchemaMetadata, getDefaultStyle, getFieldMetadata, getRegisteredStyle, getRegisteredStyleNames, getSchemaId, hasRegisteredStyle, hasSchemaMetadata, isDebugEnabled, isValidOperatorForType, mergeStyles, registerSchemaMetadata, registerStyle, serializeFiltersToQueryString, setSchemaMetadata, useCursorDataTable, useDataTable, useDataTableUrlSync, useDeleteModal, useDisplay, useForm, validateFieldRegistry, validateFilterConfiguration, withMetadata };
|