@mcurros2/microm 1.1.372-0 → 1.1.374-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,10 +1,10 @@
1
- import { AlertProps, DefaultMantineColor, ProgressProps, Variants, StepperProps, MantineTheme, TextareaProps, TextInputProps, MantineNumberSize, MantineColor, PasswordInputProps, NotificationProps, CheckboxProps, ButtonProps, ActionIconProps, NumberInputProps, ImageProps, MultiSelectProps, SelectItem, BadgeVariant, MantineSize, CardProps, OverlayProps, TransitionProps, AccordionProps, PinInputProps, SwitchProps, Radio, SelectProps, GroupProps, AvatarProps, AnchorProps, AutocompleteItem, AutocompleteProps, DefaultProps, BadgeProps } from "@mantine/core";
1
+ import { AlertProps, DefaultMantineColor, ProgressProps, MantineNumberSize, Variants, StepperProps, MantineTheme, TextareaProps, TextInputProps, MantineColor, PasswordInputProps, NotificationProps, CheckboxProps, ButtonProps, ActionIconProps, NumberInputProps, ImageProps, MultiSelectProps, SelectItem, BadgeVariant, MantineSize, CardProps, OverlayProps, TransitionProps, AccordionProps, PinInputProps, SwitchProps, Radio, SelectProps, GroupProps, AvatarProps, AnchorProps, AutocompleteItem, AutocompleteProps, DefaultProps, BadgeProps } from "@mantine/core";
2
2
  import { JSX } from "react/jsx-runtime";
3
- import React, { JSXElementConstructor, ReactElement, ReactNode, PropsWithChildren, ComponentType, RefAttributes, ForwardRefExoticComponent, MutableRefObject, useState, Dispatch, SetStateAction, KeyboardEvent, RefObject, CSSProperties, ComponentPropsWithoutRef, Context, ReactPortal } from "react";
3
+ import React, { JSXElementConstructor, ReactElement, ReactNode, PropsWithChildren, RefAttributes, ForwardRefExoticComponent, ComponentType, MutableRefObject, useState, Dispatch, SetStateAction, KeyboardEvent, RefObject, CSSProperties, ComponentPropsWithoutRef, Context, ReactPortal } from "react";
4
4
  import { hasLength, isNotEmpty, matches, UseFormReturnType } from "@mantine/form";
5
- import { LooseKeys } from "@mantine/form/lib/types";
6
- import { IconProps, Icon } from "@tabler/icons-react";
7
5
  import { ModalSettings } from "@mantine/modals/lib/context";
6
+ import { IconProps, Icon } from "@tabler/icons-react";
7
+ import { LooseKeys } from "@mantine/form/lib/types";
8
8
  import { PrismProps } from "@mantine/prism";
9
9
  import { DateInputProps, TimeInputProps, CalendarProps } from "@mantine/dates";
10
10
  import { DropzoneProps } from "@mantine/dropzone";
@@ -330,6 +330,68 @@ export type ValidatorConfigurationParms = {
330
330
  data?: any;
331
331
  };
332
332
  export type ValidatorConfiguration = Partial<Record<keyof typeof CommonValidators, ValidatorConfigurationParms>>;
333
+ export const ModalsManagerDefaultProps: {
334
+ closeLabel: string;
335
+ fullscreenLabel: string;
336
+ minimizeLabel: string;
337
+ toggleLabel: string;
338
+ FullScreenIcon: ForwardRefExoticComponent<IconProps & RefAttributes<Icon>>;
339
+ RestoreScreeSizeIcon: ForwardRefExoticComponent<IconProps & RefAttributes<Icon>>;
340
+ withCloseButton: boolean;
341
+ withFullscreenButton: boolean;
342
+ };
343
+ export type MicroMModalSize = MantineNumberSize | 'fullscreen';
344
+ export type MicroMModalSettings = Partial<Omit<ModalSettings, 'size'>> & {
345
+ size?: MicroMModalSize;
346
+ withFullscreenButton?: boolean;
347
+ };
348
+ export interface ModalOpenProps {
349
+ content: ReactNode | Promise<ReactNode>;
350
+ modalProps: MicroMModalSettings;
351
+ onClosed?: () => void;
352
+ focusOnClosed?: HTMLElement;
353
+ }
354
+ export interface ModalContextType {
355
+ open: (props: ModalOpenProps, onClosed?: () => void) => Promise<void>;
356
+ close: () => Promise<void>;
357
+ }
358
+ export interface ModalType {
359
+ originalContent: ReactNode | Promise<ReactNode>;
360
+ resolvedContent?: ReactNode;
361
+ props: ModalSettings;
362
+ id: string;
363
+ opened: boolean;
364
+ onClosed?: () => void;
365
+ focusOnClosed?: HTMLElement;
366
+ initialSize?: MicroMModalSize;
367
+ withFullscreenButton?: boolean;
368
+ }
369
+ export interface ModalsManagerProps extends PropsWithChildren {
370
+ modalProps: MicroMModalSettings;
371
+ /** This delay in milliseconds will be used to wait for the modal to be closed and fire the onClosed() event */
372
+ animationDuration: number;
373
+ }
374
+ export const ModalsManager: ({ modalProps, animationDuration, children }: ModalsManagerProps) => JSX.Element;
375
+ export const useModal: () => ModalContextType;
376
+ export type ConfirmLeaveStaySaveResult = 'save' | 'leave' | 'stay';
377
+ export interface ConfirmLeaveStaySaveProps {
378
+ title?: ReactNode;
379
+ message?: ReactNode;
380
+ saveLabel?: ReactNode;
381
+ leaveLabel?: ReactNode;
382
+ stayLabel?: ReactNode;
383
+ onResult: (result: ConfirmLeaveStaySaveResult) => void | Promise<void>;
384
+ }
385
+ export const ConfirmLeaveStaySaveDefaultProps: Partial<ConfirmLeaveStaySaveProps>;
386
+ export function ConfirmLeaveStaySave(props: ConfirmLeaveStaySaveProps): JSX.Element;
387
+ export type NavigationProtectionMode = 'save' | 'confirm';
388
+ export type ConfirmNavigationType = 'local' | 'remote';
389
+ export interface UseConfirmNavigationOptions {
390
+ mode?: NavigationProtectionMode;
391
+ hasUnsavedChanges: () => boolean;
392
+ onSave: (navigationType: ConfirmNavigationType) => Promise<boolean>;
393
+ }
394
+ export function useConfirmNavigation({ mode, hasUnsavedChanges, onSave }: UseConfirmNavigationOptions): void;
333
395
  export function getMantineInitialDirty(columns: ColumnsObject, exclude_system_columns: boolean): Record<string, boolean>;
334
396
  export function getMantineValuesObject(formValues: ValuesObject, columns: ColumnsObject, exclude_system_columns: boolean): ValuesObject;
335
397
  export function getMantineInitialValuesObject(columns: ColumnsObject, columnNames?: string[]): ValuesObject;
@@ -353,13 +415,6 @@ export type GetColumnInputPropsReturnType = {
353
415
  onBlur?: any;
354
416
  };
355
417
  export type SilentSaveResult = 'saved' | 'unchanged' | 'invalid' | 'failed';
356
- export interface NavigationConfirmationState {
357
- opened: boolean;
358
- saving: boolean;
359
- save: () => Promise<void>;
360
- discard: () => void;
361
- stay: () => void;
362
- }
363
418
  export interface UseEntityFormReturnType {
364
419
  form: UseFormReturnType<ValuesObject>;
365
420
  status: OperationStatus<DBStatusResult | ValuesObject>;
@@ -380,7 +435,6 @@ export interface UseEntityFormReturnType {
380
435
  isFormValid: () => boolean;
381
436
  isFormFieldValid: (column_name: string) => boolean;
382
437
  silentSave: (requestOptions?: MicroMRequestOptions) => Promise<SilentSaveResult>;
383
- navigationConfirmation: NavigationConfirmationState;
384
438
  }
385
439
  export const UseEntityFormDefaultProps: Partial<UseEntityFormOptions>;
386
440
  export function useEntityForm(props: UseEntityFormOptions): UseEntityFormReturnType;
@@ -403,14 +457,6 @@ export interface EntityFormProps extends PropsWithChildren {
403
457
  isDirtyColor?: DefaultMantineColor;
404
458
  cancelButtonVariant?: Variants<'filled' | 'outline' | 'light' | 'white' | 'default' | 'subtle' | 'gradient'>;
405
459
  okButtonVariant?: Variants<'filled' | 'outline' | 'light' | 'white' | 'default' | 'subtle' | 'gradient'>;
406
- saveBeforeLocalNavigation?: boolean;
407
- saveBeforeRemoteNavigation?: boolean;
408
- confirmBeforeNavigation?: boolean;
409
- navigationConfirmationTitle?: ReactNode;
410
- navigationConfirmationMessage?: ReactNode;
411
- navigationSaveLabel?: ReactNode;
412
- navigationDiscardLabel?: ReactNode;
413
- navigationStayLabel?: ReactNode;
414
460
  disableOKIfNotDirty?: boolean;
415
461
  formHeight?: string | number;
416
462
  }
@@ -494,6 +540,7 @@ export interface FormOptions<T extends Entity<EntityDefinition>> extends Omit<En
494
540
  getDataOnInit?: boolean;
495
541
  onSaved?: (status: OperationStatus<DBStatusResult>) => void;
496
542
  onCancel?: () => void;
543
+ navigationProtection?: NavigationProtectionMode;
497
544
  }
498
545
  export type useStateReturnType<T> = [T, React.Dispatch<React.SetStateAction<T>>];
499
546
  export type ActionIconVariant = 'transparent' | 'subtle' | 'default' | 'outline' | 'filled' | 'light';
@@ -749,49 +796,6 @@ export interface ModalFormOptions {
749
796
  onCancel: (entity: Entity<EntityDefinition>) => void;
750
797
  }
751
798
  export function ModalForm({ entity, onSaved, onCancel }: ModalFormOptions): JSX.Element;
752
- export const ModalsManagerDefaultProps: {
753
- closeLabel: string;
754
- fullscreenLabel: string;
755
- minimizeLabel: string;
756
- toggleLabel: string;
757
- FullScreenIcon: ForwardRefExoticComponent<IconProps & RefAttributes<Icon>>;
758
- RestoreScreeSizeIcon: ForwardRefExoticComponent<IconProps & RefAttributes<Icon>>;
759
- withCloseButton: boolean;
760
- withFullscreenButton: boolean;
761
- };
762
- export type MicroMModalSize = MantineNumberSize | 'fullscreen';
763
- export type MicroMModalSettings = Partial<Omit<ModalSettings, 'size'>> & {
764
- size?: MicroMModalSize;
765
- withFullscreenButton?: boolean;
766
- };
767
- export interface ModalOpenProps {
768
- content: ReactNode | Promise<ReactNode>;
769
- modalProps: MicroMModalSettings;
770
- onClosed?: () => void;
771
- focusOnClosed?: HTMLElement;
772
- }
773
- export interface ModalContextType {
774
- open: (props: ModalOpenProps, onClosed?: () => void) => Promise<void>;
775
- close: () => Promise<void>;
776
- }
777
- export interface ModalType {
778
- originalContent: ReactNode | Promise<ReactNode>;
779
- resolvedContent?: ReactNode;
780
- props: ModalSettings;
781
- id: string;
782
- opened: boolean;
783
- onClosed?: () => void;
784
- focusOnClosed?: HTMLElement;
785
- initialSize?: MicroMModalSize;
786
- withFullscreenButton?: boolean;
787
- }
788
- export interface ModalsManagerProps extends PropsWithChildren {
789
- modalProps: MicroMModalSettings;
790
- /** This delay in milliseconds will be used to wait for the modal to be closed and fire the onClosed() event */
791
- animationDuration: number;
792
- }
793
- export const ModalsManager: ({ modalProps, animationDuration, children }: ModalsManagerProps) => JSX.Element;
794
- export const useModal: () => ModalContextType;
795
799
  export interface SearchInputProps extends TextInputProps {
796
800
  onSearchClick: React.MouseEventHandler;
797
801
  size: string;
@@ -3299,6 +3303,7 @@ export function useMultiDataMapGrid({ dataMapView, viewState, selectionMode, map
3299
3303
  groupMarkerRenderer?: _DataMapGroupMarkerRenderer1;
3300
3304
  centerMarkerColumnIndex?: number;
3301
3305
  search: string[];
3306
+ withBorder: boolean;
3302
3307
  entity: _Entity1<_EntityDefinition1>;
3303
3308
  formMode: "view" | "add" | "edit" | undefined;
3304
3309
  parentKeys: _ValuesObject1;
@@ -3306,7 +3311,6 @@ export function useMultiDataMapGrid({ dataMapView, viewState, selectionMode, map
3306
3311
  onModalSaved: (new_status: _OperationStatus1<_DBStatusResult1 | null>) => void;
3307
3312
  modalFormSize: string | number | undefined;
3308
3313
  onModalCancelled: () => void;
3309
- withBorder: boolean;
3310
3314
  labels: _DataGridLabels1;
3311
3315
  notExportableColumns: number[];
3312
3316
  withModalFullscreenButton: boolean;