@judo/core 0.1.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/LICENSE +277 -0
- package/README.md +213 -0
- package/dist/contexts/application-context.d.ts +46 -0
- package/dist/contexts/application-context.d.ts.map +1 -0
- package/dist/contexts/customizations-context.d.ts +227 -0
- package/dist/contexts/customizations-context.d.ts.map +1 -0
- package/dist/contexts/data-context.d.ts +30 -0
- package/dist/contexts/data-context.d.ts.map +1 -0
- package/dist/contexts/dispatch-context.d.ts +39 -0
- package/dist/contexts/dispatch-context.d.ts.map +1 -0
- package/dist/contexts/index.d.ts +12 -0
- package/dist/contexts/index.d.ts.map +1 -0
- package/dist/contexts/mui-pro-context.d.ts +52 -0
- package/dist/contexts/mui-pro-context.d.ts.map +1 -0
- package/dist/contexts/navigation-context.d.ts +113 -0
- package/dist/contexts/navigation-context.d.ts.map +1 -0
- package/dist/contexts/page-context.d.ts +43 -0
- package/dist/contexts/page-context.d.ts.map +1 -0
- package/dist/contexts/refresh-signal-context.d.ts +18 -0
- package/dist/contexts/refresh-signal-context.d.ts.map +1 -0
- package/dist/contexts/runtime-config-context.d.ts +70 -0
- package/dist/contexts/runtime-config-context.d.ts.map +1 -0
- package/dist/contexts/selector-selection-context.d.ts +44 -0
- package/dist/contexts/selector-selection-context.d.ts.map +1 -0
- package/dist/contexts/validation-context.d.ts +57 -0
- package/dist/contexts/validation-context.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +9 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/use-data-selector.d.ts +51 -0
- package/dist/hooks/use-data-selector.d.ts.map +1 -0
- package/dist/hooks/use-debounced-callback.d.ts +36 -0
- package/dist/hooks/use-debounced-callback.d.ts.map +1 -0
- package/dist/hooks/use-edit-mode.d.ts +23 -0
- package/dist/hooks/use-edit-mode.d.ts.map +1 -0
- package/dist/hooks/use-element-disabled.d.ts +16 -0
- package/dist/hooks/use-element-disabled.d.ts.map +1 -0
- package/dist/hooks/use-element-visibility.d.ts +16 -0
- package/dist/hooks/use-element-visibility.d.ts.map +1 -0
- package/dist/hooks/use-validation.d.ts +32 -0
- package/dist/hooks/use-validation.d.ts.map +1 -0
- package/dist/hooks/use-visual-binding.d.ts +38 -0
- package/dist/hooks/use-visual-binding.d.ts.map +1 -0
- package/dist/hooks/use-visual-element.d.ts +13 -0
- package/dist/hooks/use-visual-element.d.ts.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +764 -0
- package/dist/index.js.map +1 -0
- package/dist/store/data-store.d.ts +168 -0
- package/dist/store/data-store.d.ts.map +1 -0
- package/dist/store/index.d.ts +3 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/selectors.d.ts +58 -0
- package/dist/store/selectors.d.ts.map +1 -0
- package/dist/utils/deep-equal.d.ts +10 -0
- package/dist/utils/deep-equal.d.ts.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/package.json +58 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { MutableRefObject, ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Selector selection context type.
|
|
4
|
+
* Provides a mutable ref that TableRenderer writes selected transfers to,
|
|
5
|
+
* and dialog footer buttons read from when dispatching Add/Set actions.
|
|
6
|
+
*
|
|
7
|
+
* Uses a ref instead of state to avoid re-renders when selection changes -
|
|
8
|
+
* the value is only read at dispatch time.
|
|
9
|
+
*/
|
|
10
|
+
export interface SelectorSelectionContextType {
|
|
11
|
+
/** Mutable ref holding the currently selected transfers */
|
|
12
|
+
selectedTransfersRef: MutableRefObject<unknown[]>;
|
|
13
|
+
/** The owner transfer for the selector (who owns the relation) */
|
|
14
|
+
ownerTransfer?: unknown;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Hook to access selector selection context.
|
|
18
|
+
*
|
|
19
|
+
* @returns SelectorSelectionContextType
|
|
20
|
+
* @throws Error if used outside SelectorSelectionProvider
|
|
21
|
+
*/
|
|
22
|
+
export declare function useSelectorSelection(): SelectorSelectionContextType;
|
|
23
|
+
/**
|
|
24
|
+
* Hook to access selector selection context (optional).
|
|
25
|
+
* Returns null when not inside a selector dialog.
|
|
26
|
+
*
|
|
27
|
+
* @returns SelectorSelectionContextType | null
|
|
28
|
+
*/
|
|
29
|
+
export declare function useSelectorSelectionOptional(): SelectorSelectionContextType | null;
|
|
30
|
+
/**
|
|
31
|
+
* Props for SelectorSelectionProvider.
|
|
32
|
+
*/
|
|
33
|
+
export interface SelectorSelectionProviderProps {
|
|
34
|
+
children: ReactNode;
|
|
35
|
+
/** The owner transfer for the selector relation */
|
|
36
|
+
ownerTransfer?: unknown;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Provider for selector selection state.
|
|
40
|
+
* Wraps selector dialog content to enable sharing selection state
|
|
41
|
+
* between TableRenderer (writer) and dialog footer buttons (reader).
|
|
42
|
+
*/
|
|
43
|
+
export declare function SelectorSelectionProvider({ children, ownerTransfer }: SelectorSelectionProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
44
|
+
//# sourceMappingURL=selector-selection-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selector-selection-context.d.ts","sourceRoot":"","sources":["../../src/contexts/selector-selection-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,SAAS,EAAqC,MAAM,OAAO,CAAC;AAEjG;;;;;;;GAOG;AACH,MAAM,WAAW,4BAA4B;IAC5C,2DAA2D;IAC3D,oBAAoB,EAAE,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAC;IAClD,kEAAkE;IAClE,aAAa,CAAC,EAAE,OAAO,CAAC;CACxB;AAID;;;;;GAKG;AACH,wBAAgB,oBAAoB,IAAI,4BAA4B,CAMnE;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,IAAI,4BAA4B,GAAG,IAAI,CAElF;AAED;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC9C,QAAQ,EAAE,SAAS,CAAC;IACpB,mDAAmD;IACnD,aAAa,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,EAAE,8BAA8B,2CAMpG"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Validation state.
|
|
4
|
+
*/
|
|
5
|
+
export interface ValidationState {
|
|
6
|
+
errors: Map<string, string>;
|
|
7
|
+
touched: Set<string>;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Validation context type.
|
|
11
|
+
*/
|
|
12
|
+
export interface ValidationContextType {
|
|
13
|
+
/** Get error for field */
|
|
14
|
+
getError: (fieldId: string) => string | null;
|
|
15
|
+
/** Set error for field */
|
|
16
|
+
setError: (fieldId: string, error: string | null) => void;
|
|
17
|
+
/** Mark field as touched */
|
|
18
|
+
touch: (fieldId: string) => void;
|
|
19
|
+
/** Check if field is touched */
|
|
20
|
+
isTouched: (fieldId: string) => boolean;
|
|
21
|
+
/** Clear all errors */
|
|
22
|
+
clearErrors: () => void;
|
|
23
|
+
/** Clear error for specific field */
|
|
24
|
+
clearError: (fieldId: string) => void;
|
|
25
|
+
/** Validate all fields */
|
|
26
|
+
validateAll: () => boolean;
|
|
27
|
+
/** Check if form is valid */
|
|
28
|
+
isValid: boolean;
|
|
29
|
+
/** Get all errors */
|
|
30
|
+
getAllErrors: () => Map<string, string>;
|
|
31
|
+
/** Set multiple errors at once */
|
|
32
|
+
setErrors: (errors: Record<string, string>) => void;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Hook to access validation context.
|
|
36
|
+
*
|
|
37
|
+
* @returns ValidationContextType
|
|
38
|
+
* @throws Error if used outside ValidationProvider
|
|
39
|
+
*/
|
|
40
|
+
export declare function useValidationContext(): ValidationContextType;
|
|
41
|
+
/**
|
|
42
|
+
* Hook to access validation context (optional).
|
|
43
|
+
*
|
|
44
|
+
* @returns ValidationContextType | null
|
|
45
|
+
*/
|
|
46
|
+
export declare function useValidationContextOptional(): ValidationContextType | null;
|
|
47
|
+
/**
|
|
48
|
+
* Props for ValidationProvider.
|
|
49
|
+
*/
|
|
50
|
+
export interface ValidationProviderProps {
|
|
51
|
+
children: ReactNode;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Provider for validation context.
|
|
55
|
+
*/
|
|
56
|
+
export declare function ValidationProvider({ children }: ValidationProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
57
|
+
//# sourceMappingURL=validation-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation-context.d.ts","sourceRoot":"","sources":["../../src/contexts/validation-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAoD,MAAM,OAAO,CAAC;AAEzF;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACrC,0BAA0B;IAC1B,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;IAC7C,0BAA0B;IAC1B,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC1D,4BAA4B;IAC5B,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,gCAAgC;IAChC,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC;IACxC,uBAAuB;IACvB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,qCAAqC;IACrC,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,0BAA0B;IAC1B,WAAW,EAAE,MAAM,OAAO,CAAC;IAC3B,6BAA6B;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,qBAAqB;IACrB,YAAY,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,kCAAkC;IAClC,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;CACpD;AAID;;;;;GAKG;AACH,wBAAgB,oBAAoB,IAAI,qBAAqB,CAM5D;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,IAAI,qBAAqB,GAAG,IAAI,CAE3E;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACvC,QAAQ,EAAE,SAAS,CAAC;CACpB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,QAAQ,EAAE,EAAE,uBAAuB,2CAgFvE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { useVisualBinding, type VisualBindingResult } from './use-visual-binding';
|
|
2
|
+
export { useValidation, useFormValidation, type ValidationResult } from './use-validation';
|
|
3
|
+
export { useDataSelector, useTransferState, useTransferField, useTransferLoading, useTransferDirty, } from './use-data-selector';
|
|
4
|
+
export { useEditMode, type EditModeResult } from './use-edit-mode';
|
|
5
|
+
export { getVisualElement } from './use-visual-element';
|
|
6
|
+
export { useElementVisibility } from './use-element-visibility';
|
|
7
|
+
export { useElementDisabled } from './use-element-disabled';
|
|
8
|
+
export { useDebouncedCallback, DEFAULT_DEBOUNCE_MS } from './use-debounced-callback';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC3F,OAAO,EACN,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,GAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { DataSelector, StrictTransferData, TransferState } from '../store';
|
|
2
|
+
/**
|
|
3
|
+
* Hook for selector-based data subscriptions.
|
|
4
|
+
* Only re-renders when selected value changes.
|
|
5
|
+
*
|
|
6
|
+
* @param selector - Function to select data from state
|
|
7
|
+
* @returns Selected value
|
|
8
|
+
*/
|
|
9
|
+
export declare function useDataSelector<T>(selector: DataSelector<T>): T;
|
|
10
|
+
/**
|
|
11
|
+
* Hook for transfer state by ID.
|
|
12
|
+
*
|
|
13
|
+
* When called with an explicit type parameter the returned `data` / `originalData`
|
|
14
|
+
* fields are narrowed to `StrictTransferData<T> | null`.
|
|
15
|
+
*
|
|
16
|
+
* @typeParam T - Optional strict transfer shape
|
|
17
|
+
* @param transferId - Transfer identifier
|
|
18
|
+
* @returns TransferState (optionally narrowed) or undefined
|
|
19
|
+
*/
|
|
20
|
+
export declare function useTransferState<T extends Record<string, unknown> = Record<string, unknown>>(transferId: string): (TransferState & {
|
|
21
|
+
data: StrictTransferData<T> | null;
|
|
22
|
+
originalData: StrictTransferData<T> | null;
|
|
23
|
+
}) | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Hook for transfer field value.
|
|
26
|
+
*
|
|
27
|
+
* When called with an explicit type parameter `T` and field `K`, the return type
|
|
28
|
+
* is narrowed to `T[K] | undefined`.
|
|
29
|
+
*
|
|
30
|
+
* @typeParam T - Optional strict transfer shape
|
|
31
|
+
* @typeParam K - Field key (restricted to `keyof T` when strict)
|
|
32
|
+
* @param transferId - Transfer identifier
|
|
33
|
+
* @param field - Field name
|
|
34
|
+
* @returns Field value (typed to `T[K]` when strict)
|
|
35
|
+
*/
|
|
36
|
+
export declare function useTransferField<T extends Record<string, unknown> = Record<string, unknown>, K extends string & keyof T = string & keyof T>(transferId: string, field: K): T[K] | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Hook for transfer loading state.
|
|
39
|
+
*
|
|
40
|
+
* @param transferId - Transfer identifier
|
|
41
|
+
* @returns Loading state
|
|
42
|
+
*/
|
|
43
|
+
export declare function useTransferLoading(transferId: string): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Hook for transfer dirty state.
|
|
46
|
+
*
|
|
47
|
+
* @param transferId - Transfer identifier
|
|
48
|
+
* @returns Dirty state
|
|
49
|
+
*/
|
|
50
|
+
export declare function useTransferDirty(transferId: string): boolean;
|
|
51
|
+
//# sourceMappingURL=use-data-selector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-data-selector.d.ts","sourceRoot":"","sources":["../../src/hooks/use-data-selector.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEhF;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,CAQ/D;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3F,UAAU,EAAE,MAAM,GAChB,CAAC,aAAa,GAAG;IAAE,IAAI,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAAC,YAAY,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAA;CAAE,CAAC,GAAG,SAAS,CASlH;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC/B,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3D,CAAC,SAAS,MAAM,GAAG,MAAM,CAAC,GAAG,MAAM,GAAG,MAAM,CAAC,EAC5C,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,CAOhD;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAO9D;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAO5D"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default debounce delay in milliseconds.
|
|
3
|
+
* Used for autocomplete/typeahead fetch operations to avoid
|
|
4
|
+
* excessive backend calls during rapid user input.
|
|
5
|
+
*/
|
|
6
|
+
export declare const DEFAULT_DEBOUNCE_MS = 300;
|
|
7
|
+
/**
|
|
8
|
+
* Returns a debounced version of the given callback.
|
|
9
|
+
*
|
|
10
|
+
* The returned function delays invoking `callback` until after `delay` ms
|
|
11
|
+
* have elapsed since the last invocation. Useful for search/autocomplete
|
|
12
|
+
* inputs that trigger backend fetches.
|
|
13
|
+
*
|
|
14
|
+
* - Automatically cleans up pending timers on unmount.
|
|
15
|
+
* - Provides a `cancel()` method on the returned function to manually
|
|
16
|
+
* discard any pending invocation.
|
|
17
|
+
* - The callback reference is always kept up-to-date (no stale closures).
|
|
18
|
+
*
|
|
19
|
+
* @param callback - The function to debounce
|
|
20
|
+
* @param delay - Debounce delay in ms (default: {@link DEFAULT_DEBOUNCE_MS})
|
|
21
|
+
* @returns A debounced function with an additional `cancel` method
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* const fetchSuggestions = useDebouncedCallback(async (text: string) => {
|
|
26
|
+
* const results = await api.search(text);
|
|
27
|
+
* setOptions(results);
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* <input onChange={(e) => fetchSuggestions(e.target.value)} />
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function useDebouncedCallback<Args extends unknown[]>(callback: (...args: Args) => void, delay?: number): ((...args: Args) => void) & {
|
|
34
|
+
cancel: () => void;
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=use-debounced-callback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-debounced-callback.d.ts","sourceRoot":"","sources":["../../src/hooks/use-debounced-callback.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAEvC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,SAAS,OAAO,EAAE,EAC1D,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,IAAI,EACjC,KAAK,GAAE,MAA4B,GACjC,CAAC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC,GAAG;IAAE,MAAM,EAAE,MAAM,IAAI,CAAA;CAAE,CA6BpD"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result from useEditMode hook.
|
|
3
|
+
*/
|
|
4
|
+
export interface EditModeResult {
|
|
5
|
+
/** Whether the current page is in edit mode (has unsaved changes) */
|
|
6
|
+
isEditMode: boolean;
|
|
7
|
+
/** The transfer ID being tracked */
|
|
8
|
+
transferId: string | null;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Hook to determine if the current page is in edit mode.
|
|
12
|
+
*
|
|
13
|
+
* Edit mode is derived from the DataStore's isDirty state for the current transfer.
|
|
14
|
+
* When a user modifies any field on a VIEW page, the transfer becomes dirty and
|
|
15
|
+
* the page enters edit mode. This affects:
|
|
16
|
+
* - Visibility of Cancel/Save buttons (only shown in edit mode)
|
|
17
|
+
* - Whether navigation away should prompt for unsaved changes
|
|
18
|
+
* - Whether Create actions can navigate to new pages
|
|
19
|
+
*
|
|
20
|
+
* @returns EditModeResult with isEditMode and transferId
|
|
21
|
+
*/
|
|
22
|
+
export declare function useEditMode(): EditModeResult;
|
|
23
|
+
//# sourceMappingURL=use-edit-mode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-edit-mode.d.ts","sourceRoot":"","sources":["../../src/hooks/use-edit-mode.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,qEAAqE;IACrE,UAAU,EAAE,OAAO,CAAC;IACpB,oCAAoC;IACpC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,IAAI,cAAc,CAY5C"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { VisualElement } from '@judo/model-api';
|
|
2
|
+
/**
|
|
3
|
+
* Hook for evaluating the runtime disabled state of any VisualElement.
|
|
4
|
+
*
|
|
5
|
+
* Resolution priority (highest to lowest):
|
|
6
|
+
* 1. VisualPropertyOverrides (customization) — `disabled` field
|
|
7
|
+
* 2. enabledBy dynamic data — if referenced boolean attribute is true, element is **enabled** (not disabled)
|
|
8
|
+
* 3. Static model property — element.disabled
|
|
9
|
+
*
|
|
10
|
+
* Safe to use outside DataProvider/PageProvider — returns static disabled value when context is unavailable.
|
|
11
|
+
*
|
|
12
|
+
* @param element - The VisualElement to evaluate disabled state for
|
|
13
|
+
* @returns `true` if the element should be disabled, `false` otherwise
|
|
14
|
+
*/
|
|
15
|
+
export declare function useElementDisabled(element: VisualElement): boolean;
|
|
16
|
+
//# sourceMappingURL=use-element-disabled.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-element-disabled.d.ts","sourceRoot":"","sources":["../../src/hooks/use-element-disabled.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAUrD;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CA0DlE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { VisualElement } from '@judo/model-api';
|
|
2
|
+
/**
|
|
3
|
+
* Hook for evaluating the runtime visibility of any VisualElement.
|
|
4
|
+
*
|
|
5
|
+
* Resolution priority (highest to lowest):
|
|
6
|
+
* 1. VisualPropertyOverrides (customization) — `hidden` field
|
|
7
|
+
* 2. hiddenBy dynamic data — resolved AttributeType boolean field from DataStore
|
|
8
|
+
* 3. Static model property — element.hidden
|
|
9
|
+
*
|
|
10
|
+
* Safe to use outside DataProvider/PageProvider — returns static hidden value when context is unavailable.
|
|
11
|
+
*
|
|
12
|
+
* @param element - The VisualElement to evaluate visibility for
|
|
13
|
+
* @returns `true` if the element should be hidden, `false` otherwise
|
|
14
|
+
*/
|
|
15
|
+
export declare function useElementVisibility(element: VisualElement): boolean;
|
|
16
|
+
//# sourceMappingURL=use-element-visibility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-element-visibility.d.ts","sourceRoot":"","sources":["../../src/hooks/use-element-visibility.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAUrD;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAyDpE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { VisualElement } from '@judo/model-api';
|
|
2
|
+
/**
|
|
3
|
+
* Result from useValidation hook.
|
|
4
|
+
*/
|
|
5
|
+
export interface ValidationResult {
|
|
6
|
+
/** Error message or null */
|
|
7
|
+
error: string | null;
|
|
8
|
+
/** Whether field has been touched */
|
|
9
|
+
isTouched: boolean;
|
|
10
|
+
/** Mark field as touched */
|
|
11
|
+
touch: () => void;
|
|
12
|
+
/** Set error for this field */
|
|
13
|
+
setError: (error: string | null) => void;
|
|
14
|
+
/** Clear error for this field */
|
|
15
|
+
clearError: () => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Hook for single element validation.
|
|
19
|
+
*
|
|
20
|
+
* @param element - Visual element
|
|
21
|
+
* @returns ValidationResult
|
|
22
|
+
*/
|
|
23
|
+
export declare function useValidation(element: VisualElement): ValidationResult;
|
|
24
|
+
/**
|
|
25
|
+
* Hook for form validation.
|
|
26
|
+
* Requires ValidationProvider.
|
|
27
|
+
*
|
|
28
|
+
* @returns Full validation context
|
|
29
|
+
* @throws Error if used outside ValidationProvider
|
|
30
|
+
*/
|
|
31
|
+
export declare function useFormValidation(): import('..').ValidationContextType;
|
|
32
|
+
//# sourceMappingURL=use-validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-validation.d.ts","sourceRoot":"","sources":["../../src/hooks/use-validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGrD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC,4BAA4B;IAC5B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,qCAAqC;IACrC,SAAS,EAAE,OAAO,CAAC;IACnB,4BAA4B;IAC5B,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,+BAA+B;IAC/B,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACzC,iCAAiC;IACjC,UAAU,EAAE,MAAM,IAAI,CAAC;CACvB;AAoBD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,gBAAgB,CAyBtE;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,uCAEhC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { AttributeType, VisualElement } from '@judo/model-api';
|
|
2
|
+
/**
|
|
3
|
+
* Result from useVisualBinding hook.
|
|
4
|
+
*/
|
|
5
|
+
export interface VisualBindingResult {
|
|
6
|
+
/** Current value from data store */
|
|
7
|
+
value: unknown;
|
|
8
|
+
/** Change handler */
|
|
9
|
+
onChange: (newValue: unknown) => void;
|
|
10
|
+
/** Validation error if any */
|
|
11
|
+
error: string | null;
|
|
12
|
+
/** Whether element is hidden (via hiddenBy or static hidden) */
|
|
13
|
+
hidden: boolean;
|
|
14
|
+
/** Whether field is disabled */
|
|
15
|
+
disabled: boolean;
|
|
16
|
+
/** Whether field is required */
|
|
17
|
+
required: boolean;
|
|
18
|
+
/** Display label */
|
|
19
|
+
label: string;
|
|
20
|
+
/** Whether field is read-only */
|
|
21
|
+
readOnly: boolean;
|
|
22
|
+
/** Whether data is loading */
|
|
23
|
+
isLoading: boolean;
|
|
24
|
+
/** Whether value has changed from original */
|
|
25
|
+
isDirty: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Dedicated hook for visual element to data binding.
|
|
29
|
+
*
|
|
30
|
+
* IMPORTANT: No memoization of values that could corrupt data consistency.
|
|
31
|
+
* Always reads fresh from DataContext via selector subscription.
|
|
32
|
+
*
|
|
33
|
+
* @param element - Visual element to bind
|
|
34
|
+
* @param attributeType - Optional pre-resolved AttributeType
|
|
35
|
+
* @returns VisualBindingResult
|
|
36
|
+
*/
|
|
37
|
+
export declare function useVisualBinding(element: VisualElement, attributeType?: AttributeType): VisualBindingResult;
|
|
38
|
+
//# sourceMappingURL=use-visual-binding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-visual-binding.d.ts","sourceRoot":"","sources":["../../src/hooks/use-visual-binding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAS,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAS3E;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC,oCAAoC;IACpC,KAAK,EAAE,OAAO,CAAC;IACf,qBAAqB;IACrB,QAAQ,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,8BAA8B;IAC9B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,gEAAgE;IAChE,MAAM,EAAE,OAAO,CAAC;IAChB,gCAAgC;IAChC,QAAQ,EAAE,OAAO,CAAC;IAClB,gCAAgC;IAChC,QAAQ,EAAE,OAAO,CAAC;IAClB,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,iCAAiC;IACjC,QAAQ,EAAE,OAAO,CAAC;IAClB,8BAA8B;IAC9B,SAAS,EAAE,OAAO,CAAC;IACnB,8CAA8C;IAC9C,OAAO,EAAE,OAAO,CAAC;CACjB;AASD;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,aAAa,EAAE,aAAa,CAAC,EAAE,aAAa,GAAG,mBAAmB,CAqK3G"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { VisualElement } from '@judo/model-api';
|
|
2
|
+
import { ModelRegistry } from '@judo/model-loader';
|
|
3
|
+
/**
|
|
4
|
+
* Retrieve visual element by sourceId.
|
|
5
|
+
* Note: This is a utility function, not a hook.
|
|
6
|
+
* For reactive updates, use a context-based approach.
|
|
7
|
+
*
|
|
8
|
+
* @param registry - Model registry
|
|
9
|
+
* @param sourceId - Source ID to find
|
|
10
|
+
* @returns VisualElement or undefined
|
|
11
|
+
*/
|
|
12
|
+
export declare function getVisualElement(registry: ModelRegistry, sourceId: string): VisualElement | undefined;
|
|
13
|
+
//# sourceMappingURL=use-visual-element.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-visual-element.d.ts","sourceRoot":"","sources":["../../src/hooks/use-visual-element.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAErG"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @judo/core
|
|
3
|
+
*
|
|
4
|
+
* Core React contexts and hooks for JUDO UI Runtime.
|
|
5
|
+
* Provides application state management, navigation, data binding, and validation.
|
|
6
|
+
*/
|
|
7
|
+
export { ApplicationProvider, useApplication, useApplicationOptional, type ApplicationContextType, type ApplicationProviderProps, NavigationProvider, useNavigation, useNavigationOptional, type NavigationContextType, type NavigationProviderProps, type NavigationState, type PageStackEntry, type DialogState, type DialogCloseResult, type DialogCloseResultType, type DialogCloseCallback, DataProvider, useDataStore, useDataStoreOptional, type DataProviderProps, ValidationProvider, useValidationContext, useValidationContextOptional, type ValidationContextType, type ValidationProviderProps, type ValidationState, PageProvider, usePageContext, usePageContextOptional, type PageContextType, type PageProviderProps, RuntimeConfigProvider, useRuntimeConfig, useRuntimeConfigOptional, type RuntimeConfigContextType, type RuntimeConfigProviderProps, type RuntimeConfig, type FeaturesConfig, DispatchProvider, useDispatch, useDispatchOptional, type DispatchContextType, type DispatchProviderProps, type DispatchFn, MuiProProvider, useMuiPro, useMuiProOptional, type MuiProContextType, type MuiProProviderProps, CustomizationsProvider, useCustomizations, useCustomizationsOptional, useComponentOverride, useComponentInterceptor, useSubThemeProvider, usePageActionOverrides, useVisualPropertyOverrides, useResolvedPageActionOverrides, useActionLifecycleOverrides, useTypeaheadProvider, useTableRowHighlighting, useEnumOptionFilter, useDateValidationProps, useColumnCustomizers, useItemContainerConfig, PageActionOverridesProvider, VisualPropertiesProvider, type CustomizationsContextType, type CustomizationsProviderProps, SelectorSelectionProvider, useSelectorSelection, useSelectorSelectionOptional, type SelectorSelectionContextType, type SelectorSelectionProviderProps, RefreshSignalProvider, useRefreshSignal, type RefreshSignalProviderProps, } from './contexts';
|
|
8
|
+
export { DataStore, createEmptyTransferState, selectTransfer, selectTransferField, selectTransferLoading, selectTransferError, selectTransferDirty, selectTransferIds, selectVersion, type TransferData, type StrictTransferData, type TransferState, type DataStoreState, type DataSelector, } from './store';
|
|
9
|
+
export { useVisualBinding, useValidation, useFormValidation, useDataSelector, useTransferState, useTransferField, useTransferLoading, useTransferDirty, useEditMode, useElementVisibility, useElementDisabled, getVisualElement, type VisualBindingResult, type ValidationResult, type EditModeResult, useDebouncedCallback, DEFAULT_DEBOUNCE_MS, } from './hooks';
|
|
10
|
+
export { deepEqual } from './utils';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAEN,mBAAmB,EACnB,cAAc,EACd,sBAAsB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAE7B,kBAAkB,EAClB,aAAa,EACb,qBAAqB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EAExB,YAAY,EACZ,YAAY,EACZ,oBAAoB,EACpB,KAAK,iBAAiB,EAEtB,kBAAkB,EAClB,oBAAoB,EACpB,4BAA4B,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EAEpB,YAAY,EACZ,cAAc,EACd,sBAAsB,EACtB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EAEtB,qBAAqB,EACrB,gBAAgB,EAChB,wBAAwB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,EAC/B,KAAK,aAAa,EAClB,KAAK,cAAc,EAEnB,gBAAgB,EAChB,WAAW,EACX,mBAAmB,EACnB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,UAAU,EAEf,cAAc,EACd,SAAS,EACT,iBAAiB,EACjB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EAExB,sBAAsB,EACtB,iBAAiB,EACjB,yBAAyB,EACzB,oBAAoB,EACpB,uBAAuB,EACvB,mBAAmB,EACnB,sBAAsB,EACtB,0BAA0B,EAC1B,8BAA8B,EAC9B,2BAA2B,EAC3B,oBAAoB,EACpB,uBAAuB,EACvB,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,EACtB,2BAA2B,EAC3B,wBAAwB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,2BAA2B,EAEhC,yBAAyB,EACzB,oBAAoB,EACpB,4BAA4B,EAC5B,KAAK,4BAA4B,EACjC,KAAK,8BAA8B,EAEnC,qBAAqB,EACrB,gBAAgB,EAChB,KAAK,0BAA0B,GAC/B,MAAM,YAAY,CAAC;AAGpB,OAAO,EACN,SAAS,EACT,wBAAwB,EAExB,cAAc,EACd,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EAEb,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,YAAY,GACjB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACN,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,WAAW,EACX,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,oBAAoB,EACpB,mBAAmB,GACnB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC"}
|