react-declarative 2.7.87 → 2.7.88

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
@@ -635,6 +635,7 @@ declare module "react-declarative" {
635
635
  export { useFilesView } from "react-declarative/components";
636
636
  export { useOutletModal } from "react-declarative/components";
637
637
  export { useWizardModal } from "react-declarative/components";
638
+ export { useTabsModal } from "react-declarative/components";
638
639
  export { createField, makeField } from "react-declarative/components";
639
640
  export { createLayout, makeLayout } from "react-declarative/components";
640
641
  export {
@@ -11716,6 +11717,7 @@ declare module "react-declarative/components/TabsView" {
11716
11717
  export { ITabsStep } from "react-declarative/components/TabsView/model/ITabsStep";
11717
11718
  export { ITabsModal } from "react-declarative/components/TabsView/model/ITabsModal";
11718
11719
  export { ITabsModalProps } from "react-declarative/components/TabsView/model/ITabsModalProps";
11720
+ export { useTabsModal } from "react-declarative/components/TabsView/hooks/useTabsModal";
11719
11721
  export { default } from "react-declarative/components/TabsView/TabsView";
11720
11722
  }
11721
11723
 
@@ -25585,6 +25587,92 @@ declare module "react-declarative/components/TabsView/model/ITabsModalProps" {
25585
25587
  export default ITabsModalProps;
25586
25588
  }
25587
25589
 
25590
+ declare module "react-declarative/components/TabsView/hooks/useTabsModal" {
25591
+ import { ITabsModalProps } from "react-declarative/components/TabsView/components/TabsOutletModal";
25592
+ import IAnything from "react-declarative/model/IAnything";
25593
+ import History from "react-declarative/model/History";
25594
+ /**
25595
+ * Interface representing the parameter options for a class or function.
25596
+ * @template Data The type of data to be submitted.
25597
+ * @template Payload The type of payload to be submitted.
25598
+ */
25599
+ interface IParams<Data extends {} = Record<string, any>, Payload = IAnything>
25600
+ extends Omit<
25601
+ ITabsModalProps<Data, Payload>,
25602
+ keyof {
25603
+ openSubject: never;
25604
+ history: never;
25605
+ onSubmit: never;
25606
+ className: never;
25607
+ }
25608
+ > {
25609
+ onSubmit?: (
25610
+ data: Data | null,
25611
+ payload: Payload,
25612
+ ) => Promise<boolean> | boolean;
25613
+ fullScreen?: boolean;
25614
+ history?: History;
25615
+ pathname?: string;
25616
+ }
25617
+ /**
25618
+ * Provides a modal component for displaying tabs with content and handling user interactions.
25619
+ *
25620
+ * @template Data - The type of data to be submitted to the modal.
25621
+ * @template Payload - The type of payload to be passed to the onSubmit function.
25622
+ *
25623
+ * @param params - The configuration parameters for the modal.
25624
+ * @param params.fallback - The fallback content to be displayed when the modal content is not available.
25625
+ * @param [params.pathname="/"] - The pathname to be used for history navigation.
25626
+ * @param [params.history] - The history object to be used for navigation. If not provided, a new memory history object will be created.
25627
+ * @param [params.fullScreen=true] - Whether the modal should be displayed in full screen mode.
25628
+ * @param [params.onLoadEnd] - The function to be called when the modal content finishes loading.
25629
+ * @param [params.onLoadStart] - The function to be called when the modal content starts loading.
25630
+ * @param [params.throwError] - Whether to throw an error if the onSubmit function returns false.
25631
+ * @param params.onChange - The function to be called when the value of the modal's content changes.
25632
+ * @param [params.onSubmit] - The function to be called when the modal is submitted. Returns a boolean indicating whether the submission was successful.
25633
+ * @param [params.onMount] - The function to be called when the modal is mounted.
25634
+ * @param [params.onUnmount] - The function to be called when the modal is unmounted.
25635
+ * @param [params.onClose] - The function to be called when the modal is closed.
25636
+ * @param [params.submitLabel] - The label to be used for the submit button in the modal.
25637
+ * @param [params.title] - The title of the modal.
25638
+ * @param [params.hidden] - Whether the modal should be hidden initially.
25639
+ * @param outletProps - Additional props to be passed to the TabsOutletModal component.
25640
+ *
25641
+ * @returns - An object containing the following methods:
25642
+ * - open: A behavior subject representing the open state of the modal.
25643
+ * - render: A function that renders the modal component.
25644
+ * - pickData: A function that triggers the opening of the modal.
25645
+ * - close: A function that closes the modal.
25646
+ */
25647
+ export const useTabsModal: <
25648
+ Data extends {} = Record<string, any>,
25649
+ Payload = any,
25650
+ >({
25651
+ fallback,
25652
+ pathname,
25653
+ history: upperHistory,
25654
+ fullScreen,
25655
+ onLoadEnd,
25656
+ onLoadStart,
25657
+ throwError,
25658
+ onChange,
25659
+ onSubmit,
25660
+ onMount,
25661
+ onUnmount,
25662
+ onClose,
25663
+ submitLabel,
25664
+ title,
25665
+ hidden,
25666
+ ...outletProps
25667
+ }: IParams<Data, Payload>) => {
25668
+ readonly open: typeof open;
25669
+ readonly render: () => JSX.Element;
25670
+ readonly pickData: () => void;
25671
+ readonly close: Promise<boolean>;
25672
+ };
25673
+ export default useTabsModal;
25674
+ }
25675
+
25588
25676
  declare module "react-declarative/components/FetchView/FetchView" {
25589
25677
  import * as React from "react";
25590
25678
  import { IAsyncProps } from "react-declarative/components/Async";
@@ -31549,6 +31637,141 @@ declare module "react-declarative/components/TabsView/model/ITabsViewProps" {
31549
31637
  export default ITabsViewProps;
31550
31638
  }
31551
31639
 
31640
+ declare module "react-declarative/components/TabsView/components/TabsOutletModal" {
31641
+ import * as React from "react";
31642
+ import { SxProps } from "@mui/material";
31643
+ import { IFetchViewProps } from "react-declarative/components/FetchView";
31644
+ import ITabsModal from "react-declarative/components/TabsView/model/ITabsModal";
31645
+ import TBehaviorSubject from "react-declarative/model/TBehaviorSubject";
31646
+ import ITabsViewProps from "react-declarative/components/TabsView/model/ITabsViewProps";
31647
+ import IAnything from "react-declarative/model/IAnything";
31648
+ import TSubject from "react-declarative/model/TSubject";
31649
+ import ISize from "react-declarative/model/ISize";
31650
+ /**
31651
+ * Represents the props for the ITabsModal component.
31652
+ *
31653
+ * @template Data - The type of data being passed to the ITabsModal component.
31654
+ * @template Payload - The type of payload being passed to the ITabsModal component.
31655
+ *
31656
+ * @property sizeRequest - A function that determines the size of the ITabsModal.
31657
+ * @property openSubject - The behavior subject that determines if the ITabsModal is open or closed.
31658
+ * @property fullScreen - Determines if the ITabsModal should be full screen or not.
31659
+ * @property withActionButton - Determines if the ITabsModal has an action button or not.
31660
+ * @property withStaticAction - Determines if the ITabsModal has a static action or not.
31661
+ * @property title - The title of the ITabsModal.
31662
+ * @property fetchState - The fetch state of the ITabsModal.
31663
+ * @property reloadSubject - The subject that triggers a reload of the ITabsModal.
31664
+ * @property onSubmit - A function that handles the submission of data and payload.
31665
+ * @property AfterTitle - A component that is rendered after the title of the ITabsModal.
31666
+ * @property BeforeTitle - A component that is rendered before the title of the ITabsModal.
31667
+ * @property routes - The routes of the ITabsModal.
31668
+ * @property data - The data of the ITabsModal.
31669
+ * @property onLoadStart - A function that is called when the ITabsModal starts loading.
31670
+ * @property onLoadEnd - A function that is called when the ITabsModal finishes loading.
31671
+ * @property fallback - A function that is called when an error occurs in the ITabsModal.
31672
+ * @property throwError - Determines if the ITabsModal should throw an error or not.
31673
+ * @property hidden - Determines if the ITabsModal should be hidden or not.
31674
+ * @property submitLabel - The label for the submit button of the ITabsModal.
31675
+ * @property mapPayload - A function that maps the data to the payload.
31676
+ * @property mapInitialData - A function that maps the data to the initialData.
31677
+ * @property onMount - A function that is called when the ITabsModal is mounted.
31678
+ * @property onUnmount - A function that is called when the ITabsModal is unmounted.
31679
+ * @property onClose - A function that is called when the ITabsModal is closed.
31680
+ */
31681
+ export interface ITabsModalProps<
31682
+ Data extends {} = Record<string, any>,
31683
+ Payload = IAnything,
31684
+ > extends Omit<
31685
+ ITabsViewProps<Data, Payload>,
31686
+ keyof {
31687
+ otherProps: never;
31688
+ onSubmit: never;
31689
+ initialData: never;
31690
+ payload: never;
31691
+ params: never;
31692
+ routes: never;
31693
+ data: never;
31694
+ id: never;
31695
+ outlinePaper: never;
31696
+ transparentPaper: never;
31697
+ }
31698
+ > {
31699
+ sizeRequest?: (size: ISize) => {
31700
+ height: number;
31701
+ width: number;
31702
+ sx?: SxProps<any>;
31703
+ };
31704
+ openSubject: TBehaviorSubject<boolean>;
31705
+ fullScreen?: boolean;
31706
+ withActionButton?: boolean;
31707
+ withStaticAction?: boolean;
31708
+ title?: string;
31709
+ fetchState?: IFetchViewProps["state"];
31710
+ reloadSubject?: TSubject<void>;
31711
+ onSubmit?: (
31712
+ data: Data | null,
31713
+ payload: Payload,
31714
+ ) => Promise<boolean> | boolean;
31715
+ AfterTitle?: React.ComponentType<{
31716
+ onClose: () => void;
31717
+ data: Data | null;
31718
+ }>;
31719
+ BeforeTitle?: React.ComponentType<{
31720
+ onClose: () => void;
31721
+ data: Data | null;
31722
+ }>;
31723
+ routes: ITabsModal<Data, Payload>[];
31724
+ data?: Data | null;
31725
+ onLoadStart?: () => void;
31726
+ onLoadEnd?: (isOk: boolean) => void;
31727
+ fallback?: (e: Error) => void;
31728
+ throwError?: boolean;
31729
+ hidden?: boolean;
31730
+ submitLabel?: string;
31731
+ submitIcon?: React.ComponentType<any>;
31732
+ mapPayload?: (data: Record<string, any>[]) => Payload | Promise<Payload>;
31733
+ mapInitialData?: (data: Record<string, any>[]) => Data | Promise<Data>;
31734
+ onMount?: () => void;
31735
+ onUnmount?: () => void;
31736
+ onClose?: () => void;
31737
+ }
31738
+ export const OutletModal: <
31739
+ Data extends {} = Record<string, any>,
31740
+ Payload = any,
31741
+ >({
31742
+ withActionButton,
31743
+ hidden,
31744
+ onSubmit,
31745
+ onChange,
31746
+ mapInitialData,
31747
+ mapPayload,
31748
+ onLoadStart,
31749
+ onLoadEnd,
31750
+ fallback,
31751
+ fullScreen,
31752
+ sizeRequest,
31753
+ reloadSubject,
31754
+ fetchState,
31755
+ AfterTitle,
31756
+ BeforeTitle,
31757
+ title,
31758
+ data: upperData,
31759
+ withStaticAction,
31760
+ throwError,
31761
+ submitLabel,
31762
+ submitIcon: SubmitIcon,
31763
+ waitForChangesDelay,
31764
+ openSubject,
31765
+ readonly,
31766
+ routes,
31767
+ onMount,
31768
+ onUnmount,
31769
+ onClose,
31770
+ ...outletProps
31771
+ }: ITabsModalProps<Data, Payload>) => JSX.Element;
31772
+ export default OutletModal;
31773
+ }
31774
+
31552
31775
  declare module "react-declarative/components/WizardView/model/IWizardViewProps" {
31553
31776
  import { SxProps } from "@mui/material";
31554
31777
  import History from "react-declarative/model/History";