@mcurros2/microm 1.1.435-0 → 1.1.437-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 +15 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +356 -140
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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;
|
|
@@ -1171,6 +1178,10 @@ export interface EntityClientAction {
|
|
|
1171
1178
|
showActionInViewMode?: boolean;
|
|
1172
1179
|
onClick: (props: EntityClientActionOnClickProps) => Promise<boolean>;
|
|
1173
1180
|
}
|
|
1181
|
+
/** Form actions complete through onClose(true, status). Successful completion clears
|
|
1182
|
+
* dirty state before invoking onSaved (OK) or onCancel (Cancel), including silent actions.
|
|
1183
|
+
* Failed statuses do not complete the form. Returning from onClick alone does not complete it.
|
|
1184
|
+
*/
|
|
1174
1185
|
export interface EntityFormClientActionOnClickProps extends EntityClientActionOnClickProps {
|
|
1175
1186
|
silent: boolean;
|
|
1176
1187
|
}
|
|
@@ -2452,6 +2463,7 @@ export interface OpenFormProps {
|
|
|
2452
2463
|
title?: string;
|
|
2453
2464
|
element?: HTMLElement;
|
|
2454
2465
|
getDataOnInit?: boolean;
|
|
2466
|
+
navigationProtection?: NavigationProtectionMode;
|
|
2455
2467
|
onModalSaved?: (new_status: OperationStatus<DBStatusResult | null>) => void;
|
|
2456
2468
|
onModalCancelled?: () => void;
|
|
2457
2469
|
onModalClosed?: () => void;
|