@mcurros2/microm 1.1.371-0 → 1.1.373-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;
@@ -352,6 +414,7 @@ export type GetColumnInputPropsReturnType = {
352
414
  onFocus?: any;
353
415
  onBlur?: any;
354
416
  };
417
+ export type SilentSaveResult = 'saved' | 'unchanged' | 'invalid' | 'failed';
355
418
  export interface UseEntityFormReturnType {
356
419
  form: UseFormReturnType<ValuesObject>;
357
420
  status: OperationStatus<DBStatusResult | ValuesObject>;
@@ -371,7 +434,7 @@ export interface UseEntityFormReturnType {
371
434
  clearAllAsyncErrors: () => void;
372
435
  isFormValid: () => boolean;
373
436
  isFormFieldValid: (column_name: string) => boolean;
374
- silentSave: (requestOptions?: MicroMRequestOptions) => Promise<void>;
437
+ silentSave: (requestOptions?: MicroMRequestOptions) => Promise<SilentSaveResult>;
375
438
  }
376
439
  export const UseEntityFormDefaultProps: Partial<UseEntityFormOptions>;
377
440
  export function useEntityForm(props: UseEntityFormOptions): UseEntityFormReturnType;
@@ -394,8 +457,6 @@ export interface EntityFormProps extends PropsWithChildren {
394
457
  isDirtyColor?: DefaultMantineColor;
395
458
  cancelButtonVariant?: Variants<'filled' | 'outline' | 'light' | 'white' | 'default' | 'subtle' | 'gradient'>;
396
459
  okButtonVariant?: Variants<'filled' | 'outline' | 'light' | 'white' | 'default' | 'subtle' | 'gradient'>;
397
- saveBeforeLocalNavigation?: boolean;
398
- saveBeforeRemoteNavigation?: boolean;
399
460
  disableOKIfNotDirty?: boolean;
400
461
  formHeight?: string | number;
401
462
  }
@@ -479,6 +540,7 @@ export interface FormOptions<T extends Entity<EntityDefinition>> extends Omit<En
479
540
  getDataOnInit?: boolean;
480
541
  onSaved?: (status: OperationStatus<DBStatusResult>) => void;
481
542
  onCancel?: () => void;
543
+ navigationProtection?: NavigationProtectionMode;
482
544
  }
483
545
  export type useStateReturnType<T> = [T, React.Dispatch<React.SetStateAction<T>>];
484
546
  export type ActionIconVariant = 'transparent' | 'subtle' | 'default' | 'outline' | 'filled' | 'light';
@@ -734,49 +796,6 @@ export interface ModalFormOptions {
734
796
  onCancel: (entity: Entity<EntityDefinition>) => void;
735
797
  }
736
798
  export function ModalForm({ entity, onSaved, onCancel }: ModalFormOptions): JSX.Element;
737
- export const ModalsManagerDefaultProps: {
738
- closeLabel: string;
739
- fullscreenLabel: string;
740
- minimizeLabel: string;
741
- toggleLabel: string;
742
- FullScreenIcon: ForwardRefExoticComponent<IconProps & RefAttributes<Icon>>;
743
- RestoreScreeSizeIcon: ForwardRefExoticComponent<IconProps & RefAttributes<Icon>>;
744
- withCloseButton: boolean;
745
- withFullscreenButton: boolean;
746
- };
747
- export type MicroMModalSize = MantineNumberSize | 'fullscreen';
748
- export type MicroMModalSettings = Partial<Omit<ModalSettings, 'size'>> & {
749
- size?: MicroMModalSize;
750
- withFullscreenButton?: boolean;
751
- };
752
- export interface ModalOpenProps {
753
- content: ReactNode | Promise<ReactNode>;
754
- modalProps: MicroMModalSettings;
755
- onClosed?: () => void;
756
- focusOnClosed?: HTMLElement;
757
- }
758
- export interface ModalContextType {
759
- open: (props: ModalOpenProps, onClosed?: () => void) => Promise<void>;
760
- close: () => Promise<void>;
761
- }
762
- export interface ModalType {
763
- originalContent: ReactNode | Promise<ReactNode>;
764
- resolvedContent?: ReactNode;
765
- props: ModalSettings;
766
- id: string;
767
- opened: boolean;
768
- onClosed?: () => void;
769
- focusOnClosed?: HTMLElement;
770
- initialSize?: MicroMModalSize;
771
- withFullscreenButton?: boolean;
772
- }
773
- export interface ModalsManagerProps extends PropsWithChildren {
774
- modalProps: MicroMModalSettings;
775
- /** This delay in milliseconds will be used to wait for the modal to be closed and fire the onClosed() event */
776
- animationDuration: number;
777
- }
778
- export const ModalsManager: ({ modalProps, animationDuration, children }: ModalsManagerProps) => JSX.Element;
779
- export const useModal: () => ModalContextType;
780
799
  export interface SearchInputProps extends TextInputProps {
781
800
  onSearchClick: React.MouseEventHandler;
782
801
  size: string;
@@ -3284,6 +3303,7 @@ export function useMultiDataMapGrid({ dataMapView, viewState, selectionMode, map
3284
3303
  groupMarkerRenderer?: _DataMapGroupMarkerRenderer1;
3285
3304
  centerMarkerColumnIndex?: number;
3286
3305
  search: string[];
3306
+ withBorder: boolean;
3287
3307
  entity: _Entity1<_EntityDefinition1>;
3288
3308
  formMode: "view" | "add" | "edit" | undefined;
3289
3309
  parentKeys: _ValuesObject1;
@@ -3291,7 +3311,6 @@ export function useMultiDataMapGrid({ dataMapView, viewState, selectionMode, map
3291
3311
  onModalSaved: (new_status: _OperationStatus1<_DBStatusResult1 | null>) => void;
3292
3312
  modalFormSize: string | number | undefined;
3293
3313
  onModalCancelled: () => void;
3294
- withBorder: boolean;
3295
3314
  labels: _DataGridLabels1;
3296
3315
  notExportableColumns: number[];
3297
3316
  withModalFullscreenButton: boolean;