@mcurros2/microm 1.1.436-0 → 1.1.438-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
@@ -339,6 +339,8 @@ export type ValidatorConfigurationParms = {
339
339
  data?: any;
340
340
  };
341
341
  export type ValidatorConfiguration = Partial<Record<keyof typeof CommonValidators, ValidatorConfigurationParms>>;
342
+ /** `disabled` bypasses protection. `allways` skips dirty checks only in edit; view is unprotected. */
343
+ export type NavigationProtectionMode = 'save' | 'confirm' | 'allways' | 'disabled';
342
344
  export const ModalsManagerDefaultProps: {
343
345
  closeLabel: string;
344
346
  fullscreenLabel: string;
@@ -355,6 +357,10 @@ export type MicroMModalSettings = Partial<Omit<ModalSettings, 'size'>> & {
355
357
  withFullscreenButton?: boolean;
356
358
  };
357
359
  export interface ModalOpenProps {
360
+ /** Optional stable identifier for targeted programmatic closes. */
361
+ id?: string;
362
+ /** Internal confirmation dialogs use false; normal modals participate in Back. */
363
+ history?: boolean;
358
364
  content: ReactNode | Promise<ReactNode>;
359
365
  modalProps: MicroMModalSettings;
360
366
  onClosed?: () => void;
@@ -362,9 +368,10 @@ export interface ModalOpenProps {
362
368
  }
363
369
  export interface ModalContextType {
364
370
  open: (props: ModalOpenProps, onClosed?: () => void) => Promise<void>;
365
- close: () => Promise<void>;
371
+ close: (id?: string) => Promise<void>;
366
372
  }
367
373
  export interface ModalType {
374
+ history?: boolean;
368
375
  originalContent: ReactNode | Promise<ReactNode>;
369
376
  resolvedContent?: ReactNode;
370
377
  props: ModalSettings;
@@ -380,6 +387,7 @@ export interface ModalsManagerProps extends PropsWithChildren {
380
387
  /** This delay in milliseconds will be used to wait for the modal to be closed and fire the onClosed() event */
381
388
  animationDuration: number;
382
389
  }
390
+ export const useModalScope: () => string | undefined;
383
391
  export const ModalsManager: ({ modalProps, animationDuration, children }: ModalsManagerProps) => JSX.Element;
384
392
  export const useModal: () => ModalContextType;
385
393
  export type ConfirmLeaveStaySaveResult = 'save' | 'leave' | 'stay';
@@ -393,8 +401,6 @@ export interface ConfirmLeaveStaySaveProps {
393
401
  }
394
402
  export const ConfirmLeaveStaySaveDefaultProps: Partial<ConfirmLeaveStaySaveProps>;
395
403
  export function ConfirmLeaveStaySave(props: ConfirmLeaveStaySaveProps): JSX.Element;
396
- /** `allways` skips dirty/value checks only in edit mode; add uses those checks and view is unprotected. */
397
- export type NavigationProtectionMode = 'save' | 'confirm' | 'allways';
398
404
  export type ConfirmNavigationType = 'local' | 'remote';
399
405
  export interface UseConfirmNavigationOptions {
400
406
  mode?: NavigationProtectionMode;
@@ -573,6 +579,7 @@ export interface EntityFormModalProps {
573
579
  entityConstructor: (client: MicroMClient) => Entity<EntityDefinition>;
574
580
  initialFormMode?: FormMode;
575
581
  getDataOnInit?: boolean;
582
+ navigationProtection?: NavigationProtectionMode;
576
583
  openState: boolean;
577
584
  setOpenState: (open: boolean) => void;
578
585
  onModalClosed?: () => void;
@@ -2456,6 +2463,7 @@ export interface OpenFormProps {
2456
2463
  title?: string;
2457
2464
  element?: HTMLElement;
2458
2465
  getDataOnInit?: boolean;
2466
+ navigationProtection?: NavigationProtectionMode;
2459
2467
  onModalSaved?: (new_status: OperationStatus<DBStatusResult | null>) => void;
2460
2468
  onModalCancelled?: () => void;
2461
2469
  onModalClosed?: () => void;