@mcurros2/microm 1.1.413-0 → 1.1.415-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>[];
@@ -468,6 +505,7 @@ export interface EntityFormProps extends PropsWithChildren {
468
505
  okButtonVariant?: Variants<'filled' | 'outline' | 'light' | 'white' | 'default' | 'subtle' | 'gradient'>;
469
506
  disableOKIfNotDirty?: boolean;
470
507
  formHeight?: string | number;
508
+ disableOK?: boolean;
471
509
  }
472
510
  export const EntityFormDefaultProps: Partial<EntityFormProps>;
473
511
  export function EntityForm(props: EntityFormProps): JSX.Element;
@@ -1216,6 +1254,20 @@ export interface KeyStringIndexer {
1216
1254
  export interface NumberIndexer {
1217
1255
  [key: number]: any;
1218
1256
  }
1257
+ export type ValidateFormResult = {
1258
+ success: true;
1259
+ warning?: never;
1260
+ error?: never;
1261
+ } | {
1262
+ warning: ReactNode;
1263
+ success?: never;
1264
+ error?: never;
1265
+ } | {
1266
+ error: ReactNode;
1267
+ success?: never;
1268
+ warning?: never;
1269
+ };
1270
+ export type ValidateFormCallback = (values: ValuesObject) => ValidateFormResult | Promise<ValidateFormResult>;
1219
1271
  export interface FormOptions<T extends Entity<EntityDefinition>> extends Omit<EntityFormProps, 'formAPI' | 'children'> {
1220
1272
  entity: T;
1221
1273
  initialFormMode: FormMode;
@@ -1223,6 +1275,7 @@ export interface FormOptions<T extends Entity<EntityDefinition>> extends Omit<En
1223
1275
  onSaved?: (status: OperationStatus<DBStatusResult>) => void;
1224
1276
  onCancel?: () => void;
1225
1277
  navigationProtection?: NavigationProtectionMode;
1278
+ validateForm?: ValidateFormCallback;
1226
1279
  }
1227
1280
  export type useStateReturnType<T> = [T, React.Dispatch<React.SetStateAction<T>>];
1228
1281
  export type ActionIconVariant = 'transparent' | 'subtle' | 'default' | 'outline' | 'filled' | 'light';
@@ -2177,30 +2230,6 @@ export interface CheckboxFieldProps extends CheckboxProps {
2177
2230
  requiredMessage?: ReactNode;
2178
2231
  }
2179
2232
  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
2233
  export interface EmailFieldProps extends Omit<TextFieldProps, 'validate'> {
2205
2234
  invalidMessage?: string;
2206
2235
  }