@mcurros2/microm 1.1.413-0 → 1.1.414-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 CHANGED
@@ -1,4 +1,4 @@
1
- import { AlertProps, DefaultMantineColor, ProgressProps, MantineNumberSize, Variants, StepperProps, SelectItem, BadgeVariant, MantineSize, CardProps, MantineTheme, ImageProps, MantineColor, TextareaProps, TextInputProps, PasswordInputProps, NotificationProps, CheckboxProps, ButtonProps, ActionIconProps, NumberInputProps, MultiSelectProps, SimpleGridProps, OverlayProps, TransitionProps, AccordionProps, PinInputProps, SwitchProps, Radio, SelectProps, GroupProps, AvatarProps, AnchorProps, AutocompleteItem, AutocompleteProps, DefaultProps, BadgeProps, BreadcrumbsProps, MenuProps as _MenuProps1, TitleOrder, CSSObject, StackProps, NavbarProps, TooltipProps } from "@mantine/core";
1
+ import { AlertProps, DefaultMantineColor, ProgressProps, MantineNumberSize, ButtonProps, Variants, StepperProps, SelectItem, BadgeVariant, MantineSize, CardProps, MantineTheme, ImageProps, MantineColor, TextareaProps, TextInputProps, PasswordInputProps, NotificationProps, CheckboxProps, ActionIconProps, NumberInputProps, MultiSelectProps, SimpleGridProps, OverlayProps, TransitionProps, AccordionProps, PinInputProps, SwitchProps, Radio, SelectProps, GroupProps, AvatarProps, AnchorProps, AutocompleteItem, AutocompleteProps, DefaultProps, BadgeProps, BreadcrumbsProps, MenuProps as _MenuProps1, TitleOrder, CSSObject, StackProps, NavbarProps, TooltipProps } from "@mantine/core";
2
2
  import { JSX } from "react/jsx-runtime";
3
3
  import React, { JSXElementConstructor, ReactElement, ReactNode, PropsWithChildren, RefAttributes, ForwardRefExoticComponent, Dispatch, RefObject, SetStateAction, ComponentType, CSSProperties, MutableRefObject, useState, KeyboardEvent, ComponentPropsWithoutRef, Context, ReactPortal } from "react";
4
4
  import { hasLength, isNotEmpty, matches, UseFormReturnType } from "@mantine/form";
@@ -404,6 +404,43 @@ export function useConfirmNavigation({ mode, hasUnsavedChanges, onSave }: UseCon
404
404
  export function getMantineInitialDirty(columns: ColumnsObject, exclude_system_columns: boolean): Record<string, boolean>;
405
405
  export function getMantineValuesObject(formValues: ValuesObject, columns: ColumnsObject, exclude_system_columns: boolean): ValuesObject;
406
406
  export function getMantineInitialValuesObject(columns: ColumnsObject, columnNames?: string[]): ValuesObject;
407
+ export interface UseOperationStatusCallback<T> {
408
+ callback: (...args: any[]) => Promise<T>;
409
+ operation: DataOperationType;
410
+ deps: React.DependencyList;
411
+ }
412
+ export type UseOperationStatusCallbackReturnType<T> = {
413
+ operationCallback: (...args: any[]) => Promise<OperationStatus<T>>;
414
+ status: OperationStatus<T>;
415
+ };
416
+ export function useOperationStatusCallback<T>(props: UseOperationStatusCallback<T>): UseOperationStatusCallbackReturnType<T>;
417
+ export interface ConfirmPanelProps {
418
+ content: ReactNode;
419
+ loadingContent?: ReactNode;
420
+ operation: DataOperationType;
421
+ onOK: () => Promise<unknown>;
422
+ onCancel: () => Promise<void> | void;
423
+ cancelButtonText?: string;
424
+ okButtonText?: string;
425
+ okButtonProps?: ButtonProps;
426
+ cancelButtonProps?: ButtonProps;
427
+ runOnOpen?: boolean;
428
+ }
429
+ export const ConfirmAndExecutePanelDefaultProps: Partial<ConfirmPanelProps>;
430
+ export function ConfirmAndExecutePanel(props: ConfirmPanelProps): JSX.Element;
431
+ export const ValidateFormLabelsDefaultProps: {
432
+ warningTitle: string;
433
+ errorTitle: string;
434
+ doYouWantToContinueLabel: string;
435
+ continueLabel: string;
436
+ cancelLabel: string;
437
+ closeLabel: string;
438
+ unexpectedErrorLabel: string;
439
+ };
440
+ export function useValidateFormModals(): {
441
+ confirmWarning: (warning: ReactNode) => Promise<boolean>;
442
+ showValidationError: (error: ReactNode) => Promise<void>;
443
+ };
407
444
  export interface UseEntityFormOptions extends FormOptions<Entity<EntityDefinition>> {
408
445
  validateInputOnBlur?: boolean;
409
446
  validateInputOnChange?: boolean | LooseKeys<ValuesObject>[];
@@ -1216,6 +1253,20 @@ export interface KeyStringIndexer {
1216
1253
  export interface NumberIndexer {
1217
1254
  [key: number]: any;
1218
1255
  }
1256
+ export type ValidateFormResult = {
1257
+ success: true;
1258
+ warning?: never;
1259
+ error?: never;
1260
+ } | {
1261
+ warning: ReactNode;
1262
+ success?: never;
1263
+ error?: never;
1264
+ } | {
1265
+ error: ReactNode;
1266
+ success?: never;
1267
+ warning?: never;
1268
+ };
1269
+ export type ValidateFormCallback = (values: ValuesObject) => ValidateFormResult | Promise<ValidateFormResult>;
1219
1270
  export interface FormOptions<T extends Entity<EntityDefinition>> extends Omit<EntityFormProps, 'formAPI' | 'children'> {
1220
1271
  entity: T;
1221
1272
  initialFormMode: FormMode;
@@ -1223,6 +1274,7 @@ export interface FormOptions<T extends Entity<EntityDefinition>> extends Omit<En
1223
1274
  onSaved?: (status: OperationStatus<DBStatusResult>) => void;
1224
1275
  onCancel?: () => void;
1225
1276
  navigationProtection?: NavigationProtectionMode;
1277
+ validateForm?: ValidateFormCallback;
1226
1278
  }
1227
1279
  export type useStateReturnType<T> = [T, React.Dispatch<React.SetStateAction<T>>];
1228
1280
  export type ActionIconVariant = 'transparent' | 'subtle' | 'default' | 'outline' | 'filled' | 'light';
@@ -2177,30 +2229,6 @@ export interface CheckboxFieldProps extends CheckboxProps {
2177
2229
  requiredMessage?: ReactNode;
2178
2230
  }
2179
2231
  export function CheckboxField(props: CheckboxFieldProps): JSX.Element;
2180
- export interface UseOperationStatusCallback<T> {
2181
- callback: (...args: any[]) => Promise<T>;
2182
- operation: DataOperationType;
2183
- deps: React.DependencyList;
2184
- }
2185
- export type UseOperationStatusCallbackReturnType<T> = {
2186
- operationCallback: (...args: any[]) => Promise<OperationStatus<T>>;
2187
- status: OperationStatus<T>;
2188
- };
2189
- export function useOperationStatusCallback<T>(props: UseOperationStatusCallback<T>): UseOperationStatusCallbackReturnType<T>;
2190
- export interface ConfirmPanelProps {
2191
- content: ReactNode;
2192
- loadingContent?: ReactNode;
2193
- operation: DataOperationType;
2194
- onOK: () => Promise<unknown>;
2195
- onCancel: () => Promise<void> | void;
2196
- cancelButtonText?: string;
2197
- okButtonText?: string;
2198
- okButtonProps?: ButtonProps;
2199
- cancelButtonProps?: ButtonProps;
2200
- runOnOpen?: boolean;
2201
- }
2202
- export const ConfirmAndExecutePanelDefaultProps: Partial<ConfirmPanelProps>;
2203
- export function ConfirmAndExecutePanel(props: ConfirmPanelProps): JSX.Element;
2204
2232
  export interface EmailFieldProps extends Omit<TextFieldProps, 'validate'> {
2205
2233
  invalidMessage?: string;
2206
2234
  }