@bluemarble/bm-components 1.16.2 → 1.17.2
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.mts +69 -5
- package/dist/index.d.ts +69 -5
- package/dist/index.js +187 -59
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +259 -131
- package/dist/index.mjs.map +1 -1
- package/package.json +21 -12
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default, { ReactNode, FC, Provider } from 'react';
|
|
3
3
|
import * as _mui_material from '@mui/material';
|
|
4
|
-
import { TableCellProps, TableCell, TextFieldProps, StandardTextFieldProps, SelectProps as SelectProps$1, FormControlProps, InputLabelProps,
|
|
4
|
+
import { TableCellProps, TableCell, TextFieldProps, StandardTextFieldProps, SelectProps as SelectProps$1, FormControlProps, InputLabelProps, AutocompleteProps as AutocompleteProps$1, AutocompleteRenderInputParams, CheckboxProps as CheckboxProps$1, FormControlLabelProps, SwitchProps as SwitchProps$1, RadioGroupProps, ButtonProps, CircularProgressProps, Theme, SxProps, TableSortLabelProps, BoxProps, PaperProps, TableProps, TableHeadProps, TableBodyProps, ModalProps, DialogProps, StackProps, IconButtonProps, TypographyProps, AlertColor } from '@mui/material';
|
|
5
5
|
import * as _mui_material_OverridableComponent from '@mui/material/OverridableComponent';
|
|
6
6
|
import IMask$1 from 'imask';
|
|
7
7
|
import { IconType } from 'react-icons';
|
|
@@ -304,12 +304,13 @@ interface BaseGridAutoRowsProps<T> {
|
|
|
304
304
|
}
|
|
305
305
|
declare function BaseGridAutoRows<T>({ data, columns, rowKey }: BaseGridAutoRowsProps<T>): React__default.JSX.Element;
|
|
306
306
|
|
|
307
|
-
type
|
|
307
|
+
type TModalProps = {
|
|
308
308
|
open: boolean;
|
|
309
309
|
onClose: () => void;
|
|
310
310
|
children: React__default.ReactNode;
|
|
311
|
-
|
|
312
|
-
|
|
311
|
+
BoxProps?: BoxProps;
|
|
312
|
+
} & Omit<ModalProps, 'children'>;
|
|
313
|
+
declare const Modal: ({ open, onClose, BoxProps, ...rest }: TModalProps) => React__default.JSX.Element;
|
|
313
314
|
|
|
314
315
|
declare function GetInputLabel<T extends Array<Record<string, any>>, K extends T[number]['name']>(columns: T): (columnName: K) => {
|
|
315
316
|
label: any;
|
|
@@ -354,6 +355,69 @@ declare function UseDialogConfirm(): {
|
|
|
354
355
|
|
|
355
356
|
declare const DialogConfirm: (props: IDialogConfirmProps) => React__default.JSX.Element;
|
|
356
357
|
|
|
358
|
+
interface DialogHeaderProps extends StackProps {
|
|
359
|
+
title: string;
|
|
360
|
+
IconButtonProps?: IconButtonProps;
|
|
361
|
+
TypographyProps?: TypographyProps;
|
|
362
|
+
onClose?: () => void;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
interface IBaseDialogContext {
|
|
366
|
+
opened: symbol[];
|
|
367
|
+
isOpened(dialog: symbol): boolean;
|
|
368
|
+
toggle(dialog: symbol): boolean;
|
|
369
|
+
open(dialog: symbol): void;
|
|
370
|
+
close(dialog: symbol): void;
|
|
371
|
+
closeAll(): void;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
declare function useBaseDialog(): IBaseDialogContext;
|
|
375
|
+
declare function useBaseDialogInstance(): {
|
|
376
|
+
name: symbol;
|
|
377
|
+
actions: IBaseDialogContext;
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
interface IBaseDialogInstanceProviderProps {
|
|
381
|
+
children: React__default.ReactNode;
|
|
382
|
+
name: symbol;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
interface IBaseDialogContainerProps extends Omit<TModalProps, 'children' | 'open' | 'onClose'> {
|
|
386
|
+
children: React__default.ReactNode | ((props: {
|
|
387
|
+
close: () => void;
|
|
388
|
+
}) => React__default.ReactNode);
|
|
389
|
+
}
|
|
390
|
+
declare const BaseDialogContainer: ({ children, ...rest }: IBaseDialogContainerProps) => React__default.JSX.Element;
|
|
391
|
+
interface IBaseDialogBodyProps extends BoxProps {
|
|
392
|
+
}
|
|
393
|
+
declare const BaseDialogBody: (props: IBaseDialogBodyProps) => React__default.JSX.Element;
|
|
394
|
+
interface IBaseDialogTriggerProps extends Omit<ButtonProps, 'name'> {
|
|
395
|
+
name: symbol;
|
|
396
|
+
}
|
|
397
|
+
declare const BaseDialogTrigger: ({ name, onClick, ...props }: IBaseDialogTriggerProps) => React__default.JSX.Element;
|
|
398
|
+
declare const BaseDialogCreate: (name?: symbol) => {
|
|
399
|
+
Trigger: (props: Omit<IBaseDialogTriggerProps, 'name'>) => React__default.JSX.Element;
|
|
400
|
+
Root: (props: Omit<IBaseDialogInstanceProviderProps, 'name'>) => React__default.JSX.Element;
|
|
401
|
+
Container: ({ children, ...rest }: IBaseDialogContainerProps) => React__default.JSX.Element;
|
|
402
|
+
Header: ({ title, onClose, IconButtonProps, TypographyProps, ...props }: DialogHeaderProps) => React__default.JSX.Element;
|
|
403
|
+
Body: (props: IBaseDialogBodyProps) => React__default.JSX.Element;
|
|
404
|
+
};
|
|
405
|
+
declare const BaseDialog: {
|
|
406
|
+
Create: (name?: symbol) => {
|
|
407
|
+
Trigger: (props: Omit<IBaseDialogTriggerProps, 'name'>) => React__default.JSX.Element;
|
|
408
|
+
Root: (props: Omit<IBaseDialogInstanceProviderProps, 'name'>) => React__default.JSX.Element;
|
|
409
|
+
Container: ({ children, ...rest }: IBaseDialogContainerProps) => React__default.JSX.Element;
|
|
410
|
+
Header: ({ title, onClose, IconButtonProps, TypographyProps, ...props }: DialogHeaderProps) => React__default.JSX.Element;
|
|
411
|
+
Body: (props: IBaseDialogBodyProps) => React__default.JSX.Element;
|
|
412
|
+
};
|
|
413
|
+
Trigger: ({ name, onClick, ...props }: IBaseDialogTriggerProps) => React__default.JSX.Element;
|
|
414
|
+
Provider: (props: any) => React__default.JSX.Element;
|
|
415
|
+
Root: (props: IBaseDialogInstanceProviderProps) => React__default.JSX.Element;
|
|
416
|
+
Container: ({ children, ...rest }: IBaseDialogContainerProps) => React__default.JSX.Element;
|
|
417
|
+
Header: ({ title, onClose, IconButtonProps, TypographyProps, ...props }: DialogHeaderProps) => React__default.JSX.Element;
|
|
418
|
+
Body: (props: IBaseDialogBodyProps) => React__default.JSX.Element;
|
|
419
|
+
};
|
|
420
|
+
|
|
357
421
|
declare class HttpError extends Error {
|
|
358
422
|
status: number;
|
|
359
423
|
constructor(status: number, message: any);
|
|
@@ -576,4 +640,4 @@ declare function CreateAuthProvider<T>({ api, children, sessionTokenName, Provid
|
|
|
576
640
|
sessionTokenName: string;
|
|
577
641
|
}): React__default.JSX.Element;
|
|
578
642
|
|
|
579
|
-
export { AlertContext, AlertProvider, ApiHelper, type AuthContextProps, AuthHelper, Autocomplete, BaseGrid, BaseGridAutoRows, Checkbox, type ColumnTitleProps, type ColumnsProps, CreateAuthProvider, Dialog, DialogConfirm, DomainError, EditableTableCell, type FilterCompareType, type FilterProps, FormHelperContext, FormHelperProvider, GetInputLabel, Grid, HttpError, type IDialogConfirmProps, type IFilter, Input, InputMask, LargeButton, Modal, Radio, Select, type SortedByProps$1 as SortedByProps, Switch, type TUseDialogConfirm, TabPanel, type TabPanelProps, Td, Tr, UseDialogConfirm, createAuthContext, createFilter, filterData, getTabProps, useAlert, useAsyncGrid, useEvent, useFilter, useFormHelper, useGrid, useLoading };
|
|
643
|
+
export { AlertContext, AlertProvider, ApiHelper, type AuthContextProps, AuthHelper, Autocomplete, BaseDialog, BaseDialogBody, BaseDialogContainer, BaseDialogCreate, BaseDialogTrigger, BaseGrid, BaseGridAutoRows, Checkbox, type ColumnTitleProps, type ColumnsProps, CreateAuthProvider, Dialog, DialogConfirm, DomainError, EditableTableCell, type FilterCompareType, type FilterProps, FormHelperContext, FormHelperProvider, GetInputLabel, Grid, HttpError, type IBaseDialogBodyProps, type IBaseDialogContainerProps, type IBaseDialogTriggerProps, type IDialogConfirmProps, type IFilter, Input, InputMask, LargeButton, Modal, Radio, Select, type SortedByProps$1 as SortedByProps, Switch, type TUseDialogConfirm, TabPanel, type TabPanelProps, Td, Tr, UseDialogConfirm, createAuthContext, createFilter, filterData, getTabProps, useAlert, useAsyncGrid, useBaseDialog, useBaseDialogInstance, useEvent, useFilter, useFormHelper, useGrid, useLoading };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default, { ReactNode, FC, Provider } from 'react';
|
|
3
3
|
import * as _mui_material from '@mui/material';
|
|
4
|
-
import { TableCellProps, TableCell, TextFieldProps, StandardTextFieldProps, SelectProps as SelectProps$1, FormControlProps, InputLabelProps,
|
|
4
|
+
import { TableCellProps, TableCell, TextFieldProps, StandardTextFieldProps, SelectProps as SelectProps$1, FormControlProps, InputLabelProps, AutocompleteProps as AutocompleteProps$1, AutocompleteRenderInputParams, CheckboxProps as CheckboxProps$1, FormControlLabelProps, SwitchProps as SwitchProps$1, RadioGroupProps, ButtonProps, CircularProgressProps, Theme, SxProps, TableSortLabelProps, BoxProps, PaperProps, TableProps, TableHeadProps, TableBodyProps, ModalProps, DialogProps, StackProps, IconButtonProps, TypographyProps, AlertColor } from '@mui/material';
|
|
5
5
|
import * as _mui_material_OverridableComponent from '@mui/material/OverridableComponent';
|
|
6
6
|
import IMask$1 from 'imask';
|
|
7
7
|
import { IconType } from 'react-icons';
|
|
@@ -304,12 +304,13 @@ interface BaseGridAutoRowsProps<T> {
|
|
|
304
304
|
}
|
|
305
305
|
declare function BaseGridAutoRows<T>({ data, columns, rowKey }: BaseGridAutoRowsProps<T>): React__default.JSX.Element;
|
|
306
306
|
|
|
307
|
-
type
|
|
307
|
+
type TModalProps = {
|
|
308
308
|
open: boolean;
|
|
309
309
|
onClose: () => void;
|
|
310
310
|
children: React__default.ReactNode;
|
|
311
|
-
|
|
312
|
-
|
|
311
|
+
BoxProps?: BoxProps;
|
|
312
|
+
} & Omit<ModalProps, 'children'>;
|
|
313
|
+
declare const Modal: ({ open, onClose, BoxProps, ...rest }: TModalProps) => React__default.JSX.Element;
|
|
313
314
|
|
|
314
315
|
declare function GetInputLabel<T extends Array<Record<string, any>>, K extends T[number]['name']>(columns: T): (columnName: K) => {
|
|
315
316
|
label: any;
|
|
@@ -354,6 +355,69 @@ declare function UseDialogConfirm(): {
|
|
|
354
355
|
|
|
355
356
|
declare const DialogConfirm: (props: IDialogConfirmProps) => React__default.JSX.Element;
|
|
356
357
|
|
|
358
|
+
interface DialogHeaderProps extends StackProps {
|
|
359
|
+
title: string;
|
|
360
|
+
IconButtonProps?: IconButtonProps;
|
|
361
|
+
TypographyProps?: TypographyProps;
|
|
362
|
+
onClose?: () => void;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
interface IBaseDialogContext {
|
|
366
|
+
opened: symbol[];
|
|
367
|
+
isOpened(dialog: symbol): boolean;
|
|
368
|
+
toggle(dialog: symbol): boolean;
|
|
369
|
+
open(dialog: symbol): void;
|
|
370
|
+
close(dialog: symbol): void;
|
|
371
|
+
closeAll(): void;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
declare function useBaseDialog(): IBaseDialogContext;
|
|
375
|
+
declare function useBaseDialogInstance(): {
|
|
376
|
+
name: symbol;
|
|
377
|
+
actions: IBaseDialogContext;
|
|
378
|
+
};
|
|
379
|
+
|
|
380
|
+
interface IBaseDialogInstanceProviderProps {
|
|
381
|
+
children: React__default.ReactNode;
|
|
382
|
+
name: symbol;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
interface IBaseDialogContainerProps extends Omit<TModalProps, 'children' | 'open' | 'onClose'> {
|
|
386
|
+
children: React__default.ReactNode | ((props: {
|
|
387
|
+
close: () => void;
|
|
388
|
+
}) => React__default.ReactNode);
|
|
389
|
+
}
|
|
390
|
+
declare const BaseDialogContainer: ({ children, ...rest }: IBaseDialogContainerProps) => React__default.JSX.Element;
|
|
391
|
+
interface IBaseDialogBodyProps extends BoxProps {
|
|
392
|
+
}
|
|
393
|
+
declare const BaseDialogBody: (props: IBaseDialogBodyProps) => React__default.JSX.Element;
|
|
394
|
+
interface IBaseDialogTriggerProps extends Omit<ButtonProps, 'name'> {
|
|
395
|
+
name: symbol;
|
|
396
|
+
}
|
|
397
|
+
declare const BaseDialogTrigger: ({ name, onClick, ...props }: IBaseDialogTriggerProps) => React__default.JSX.Element;
|
|
398
|
+
declare const BaseDialogCreate: (name?: symbol) => {
|
|
399
|
+
Trigger: (props: Omit<IBaseDialogTriggerProps, 'name'>) => React__default.JSX.Element;
|
|
400
|
+
Root: (props: Omit<IBaseDialogInstanceProviderProps, 'name'>) => React__default.JSX.Element;
|
|
401
|
+
Container: ({ children, ...rest }: IBaseDialogContainerProps) => React__default.JSX.Element;
|
|
402
|
+
Header: ({ title, onClose, IconButtonProps, TypographyProps, ...props }: DialogHeaderProps) => React__default.JSX.Element;
|
|
403
|
+
Body: (props: IBaseDialogBodyProps) => React__default.JSX.Element;
|
|
404
|
+
};
|
|
405
|
+
declare const BaseDialog: {
|
|
406
|
+
Create: (name?: symbol) => {
|
|
407
|
+
Trigger: (props: Omit<IBaseDialogTriggerProps, 'name'>) => React__default.JSX.Element;
|
|
408
|
+
Root: (props: Omit<IBaseDialogInstanceProviderProps, 'name'>) => React__default.JSX.Element;
|
|
409
|
+
Container: ({ children, ...rest }: IBaseDialogContainerProps) => React__default.JSX.Element;
|
|
410
|
+
Header: ({ title, onClose, IconButtonProps, TypographyProps, ...props }: DialogHeaderProps) => React__default.JSX.Element;
|
|
411
|
+
Body: (props: IBaseDialogBodyProps) => React__default.JSX.Element;
|
|
412
|
+
};
|
|
413
|
+
Trigger: ({ name, onClick, ...props }: IBaseDialogTriggerProps) => React__default.JSX.Element;
|
|
414
|
+
Provider: (props: any) => React__default.JSX.Element;
|
|
415
|
+
Root: (props: IBaseDialogInstanceProviderProps) => React__default.JSX.Element;
|
|
416
|
+
Container: ({ children, ...rest }: IBaseDialogContainerProps) => React__default.JSX.Element;
|
|
417
|
+
Header: ({ title, onClose, IconButtonProps, TypographyProps, ...props }: DialogHeaderProps) => React__default.JSX.Element;
|
|
418
|
+
Body: (props: IBaseDialogBodyProps) => React__default.JSX.Element;
|
|
419
|
+
};
|
|
420
|
+
|
|
357
421
|
declare class HttpError extends Error {
|
|
358
422
|
status: number;
|
|
359
423
|
constructor(status: number, message: any);
|
|
@@ -576,4 +640,4 @@ declare function CreateAuthProvider<T>({ api, children, sessionTokenName, Provid
|
|
|
576
640
|
sessionTokenName: string;
|
|
577
641
|
}): React__default.JSX.Element;
|
|
578
642
|
|
|
579
|
-
export { AlertContext, AlertProvider, ApiHelper, type AuthContextProps, AuthHelper, Autocomplete, BaseGrid, BaseGridAutoRows, Checkbox, type ColumnTitleProps, type ColumnsProps, CreateAuthProvider, Dialog, DialogConfirm, DomainError, EditableTableCell, type FilterCompareType, type FilterProps, FormHelperContext, FormHelperProvider, GetInputLabel, Grid, HttpError, type IDialogConfirmProps, type IFilter, Input, InputMask, LargeButton, Modal, Radio, Select, type SortedByProps$1 as SortedByProps, Switch, type TUseDialogConfirm, TabPanel, type TabPanelProps, Td, Tr, UseDialogConfirm, createAuthContext, createFilter, filterData, getTabProps, useAlert, useAsyncGrid, useEvent, useFilter, useFormHelper, useGrid, useLoading };
|
|
643
|
+
export { AlertContext, AlertProvider, ApiHelper, type AuthContextProps, AuthHelper, Autocomplete, BaseDialog, BaseDialogBody, BaseDialogContainer, BaseDialogCreate, BaseDialogTrigger, BaseGrid, BaseGridAutoRows, Checkbox, type ColumnTitleProps, type ColumnsProps, CreateAuthProvider, Dialog, DialogConfirm, DomainError, EditableTableCell, type FilterCompareType, type FilterProps, FormHelperContext, FormHelperProvider, GetInputLabel, Grid, HttpError, type IBaseDialogBodyProps, type IBaseDialogContainerProps, type IBaseDialogTriggerProps, type IDialogConfirmProps, type IFilter, Input, InputMask, LargeButton, Modal, Radio, Select, type SortedByProps$1 as SortedByProps, Switch, type TUseDialogConfirm, TabPanel, type TabPanelProps, Td, Tr, UseDialogConfirm, createAuthContext, createFilter, filterData, getTabProps, useAlert, useAsyncGrid, useBaseDialog, useBaseDialogInstance, useEvent, useFilter, useFormHelper, useGrid, useLoading };
|
package/dist/index.js
CHANGED
|
@@ -2404,7 +2404,7 @@ function createBox(options = {}) {
|
|
|
2404
2404
|
const BoxRoot = styled("div", {
|
|
2405
2405
|
shouldForwardProp: (prop) => prop !== "theme" && prop !== "sx" && prop !== "as"
|
|
2406
2406
|
})(styleFunctionSx_default);
|
|
2407
|
-
const
|
|
2407
|
+
const Box9 = /* @__PURE__ */ React3.forwardRef(function Box10(inProps, ref) {
|
|
2408
2408
|
const theme = useTheme_default(defaultTheme);
|
|
2409
2409
|
const _extendSxProp = extendSxProp(inProps), {
|
|
2410
2410
|
className,
|
|
@@ -2417,7 +2417,7 @@ function createBox(options = {}) {
|
|
|
2417
2417
|
theme: themeId ? theme[themeId] || theme : theme
|
|
2418
2418
|
}, other));
|
|
2419
2419
|
});
|
|
2420
|
-
return
|
|
2420
|
+
return Box9;
|
|
2421
2421
|
}
|
|
2422
2422
|
|
|
2423
2423
|
// node_modules/@mui/utils/generateUtilityClass/generateUtilityClass.js
|
|
@@ -3992,11 +3992,11 @@ function BaseGridAutoRows({
|
|
|
3992
3992
|
|
|
3993
3993
|
|
|
3994
3994
|
var Modal = (_a) => {
|
|
3995
|
-
var _b = _a, { open, onClose } = _b, rest = __objRest(_b, ["open", "onClose"]);
|
|
3995
|
+
var _b = _a, { open, onClose, BoxProps: BoxProps3 } = _b, rest = __objRest(_b, ["open", "onClose", "BoxProps"]);
|
|
3996
3996
|
return /* @__PURE__ */ React2.default.createElement(_material.Modal, __spreadValues({ open, onClose }, rest), /* @__PURE__ */ React2.default.createElement(
|
|
3997
3997
|
_material.Box,
|
|
3998
|
-
{
|
|
3999
|
-
sx: {
|
|
3998
|
+
__spreadProps(__spreadValues({}, BoxProps3), {
|
|
3999
|
+
sx: __spreadValues({
|
|
4000
4000
|
outline: "none",
|
|
4001
4001
|
backgroundColor: "background.paper",
|
|
4002
4002
|
position: "absolute",
|
|
@@ -4004,9 +4004,9 @@ var Modal = (_a) => {
|
|
|
4004
4004
|
left: "50%",
|
|
4005
4005
|
transform: "translate(-50%, -50%)",
|
|
4006
4006
|
borderRadius: 1
|
|
4007
|
-
}
|
|
4008
|
-
},
|
|
4009
|
-
|
|
4007
|
+
}, BoxProps3 == null ? void 0 : BoxProps3.sx)
|
|
4008
|
+
}),
|
|
4009
|
+
rest.children
|
|
4010
4010
|
));
|
|
4011
4011
|
};
|
|
4012
4012
|
|
|
@@ -4157,6 +4157,175 @@ var DialogConfirm = (props) => {
|
|
|
4157
4157
|
))))));
|
|
4158
4158
|
};
|
|
4159
4159
|
|
|
4160
|
+
// src/components/BaseDialog/BaseDialog.tsx
|
|
4161
|
+
|
|
4162
|
+
|
|
4163
|
+
// src/components/BaseDialog/BaseDialogHook.ts
|
|
4164
|
+
|
|
4165
|
+
|
|
4166
|
+
// src/components/BaseDialog/BaseDialogContext.tsx
|
|
4167
|
+
|
|
4168
|
+
|
|
4169
|
+
var BaseDialogContext = _react.createContext.call(void 0, {});
|
|
4170
|
+
var BaseDialogProvider = (props) => {
|
|
4171
|
+
const [openedDialogs, setOpenedDialogs] = _react.useState.call(void 0, []);
|
|
4172
|
+
const isOpened = _react.useCallback.call(void 0,
|
|
4173
|
+
(dialog) => {
|
|
4174
|
+
return openedDialogs.includes(dialog);
|
|
4175
|
+
},
|
|
4176
|
+
[openedDialogs]
|
|
4177
|
+
);
|
|
4178
|
+
const toggleDialog = _react.useCallback.call(void 0,
|
|
4179
|
+
(dialog) => {
|
|
4180
|
+
return openedDialogs.includes(dialog);
|
|
4181
|
+
},
|
|
4182
|
+
[openedDialogs]
|
|
4183
|
+
);
|
|
4184
|
+
const openDialog = _react.useCallback.call(void 0, (dialog) => {
|
|
4185
|
+
return setOpenedDialogs((prev) => {
|
|
4186
|
+
const filteredArr = prev.filter((item) => item !== dialog);
|
|
4187
|
+
return [...filteredArr, dialog];
|
|
4188
|
+
});
|
|
4189
|
+
}, []);
|
|
4190
|
+
const closeDialog = _react.useCallback.call(void 0, (dialog) => {
|
|
4191
|
+
return setOpenedDialogs((prev) => prev.filter((item) => item !== dialog));
|
|
4192
|
+
}, []);
|
|
4193
|
+
const closeAllDialogs = _react.useCallback.call(void 0, () => {
|
|
4194
|
+
return setOpenedDialogs([]);
|
|
4195
|
+
}, [openedDialogs]);
|
|
4196
|
+
return /* @__PURE__ */ React2.default.createElement(
|
|
4197
|
+
BaseDialogContext.Provider,
|
|
4198
|
+
{
|
|
4199
|
+
value: {
|
|
4200
|
+
opened: openedDialogs,
|
|
4201
|
+
isOpened,
|
|
4202
|
+
toggle: toggleDialog,
|
|
4203
|
+
open: openDialog,
|
|
4204
|
+
closeAll: closeAllDialogs,
|
|
4205
|
+
close: closeDialog
|
|
4206
|
+
}
|
|
4207
|
+
},
|
|
4208
|
+
props.children
|
|
4209
|
+
);
|
|
4210
|
+
};
|
|
4211
|
+
|
|
4212
|
+
// src/components/BaseDialog/BaseDialogInstanceContext.tsx
|
|
4213
|
+
|
|
4214
|
+
|
|
4215
|
+
var BaseDialogInstanceContext = _react.createContext.call(void 0,
|
|
4216
|
+
{}
|
|
4217
|
+
);
|
|
4218
|
+
var BaseDialogInstanceProvider = (props) => {
|
|
4219
|
+
const actions = useBaseDialog();
|
|
4220
|
+
return /* @__PURE__ */ React2.default.createElement(BaseDialogInstanceContext.Provider, { value: { name: props.name, actions } }, props.children);
|
|
4221
|
+
};
|
|
4222
|
+
|
|
4223
|
+
// src/components/BaseDialog/BaseDialogHook.ts
|
|
4224
|
+
function useBaseDialog() {
|
|
4225
|
+
return _react.useContext.call(void 0, BaseDialogContext);
|
|
4226
|
+
}
|
|
4227
|
+
function useBaseDialogInstance() {
|
|
4228
|
+
return _react.useContext.call(void 0, BaseDialogInstanceContext);
|
|
4229
|
+
}
|
|
4230
|
+
|
|
4231
|
+
// src/components/BaseDialog/BaseDialog.tsx
|
|
4232
|
+
|
|
4233
|
+
|
|
4234
|
+
// src/components/BaseDialog/BaseDialogHeader.tsx
|
|
4235
|
+
|
|
4236
|
+
|
|
4237
|
+
|
|
4238
|
+
|
|
4239
|
+
|
|
4240
|
+
|
|
4241
|
+
|
|
4242
|
+
var BaseDialogHeader = (_a) => {
|
|
4243
|
+
var _b = _a, {
|
|
4244
|
+
title,
|
|
4245
|
+
onClose,
|
|
4246
|
+
IconButtonProps,
|
|
4247
|
+
TypographyProps: TypographyProps2
|
|
4248
|
+
} = _b, props = __objRest(_b, [
|
|
4249
|
+
"title",
|
|
4250
|
+
"onClose",
|
|
4251
|
+
"IconButtonProps",
|
|
4252
|
+
"TypographyProps"
|
|
4253
|
+
]);
|
|
4254
|
+
const { name } = useBaseDialogInstance();
|
|
4255
|
+
const { close: closeDialog } = useBaseDialog();
|
|
4256
|
+
function handleClose() {
|
|
4257
|
+
if (onClose)
|
|
4258
|
+
return onClose();
|
|
4259
|
+
closeDialog(name);
|
|
4260
|
+
}
|
|
4261
|
+
return /* @__PURE__ */ React2.default.createElement(
|
|
4262
|
+
_material.Stack,
|
|
4263
|
+
__spreadValues({
|
|
4264
|
+
direction: "row",
|
|
4265
|
+
alignItems: "center",
|
|
4266
|
+
justifyContent: "space-between",
|
|
4267
|
+
px: 2,
|
|
4268
|
+
my: 1
|
|
4269
|
+
}, props),
|
|
4270
|
+
/* @__PURE__ */ React2.default.createElement(_material.Typography, __spreadValues({ variant: "h6", fontWeight: "bold" }, TypographyProps2), title),
|
|
4271
|
+
/* @__PURE__ */ React2.default.createElement(_material.IconButton, __spreadProps(__spreadValues({}, IconButtonProps), { onClick: handleClose }), /* @__PURE__ */ React2.default.createElement(_md.MdClose, null))
|
|
4272
|
+
);
|
|
4273
|
+
};
|
|
4274
|
+
|
|
4275
|
+
// src/components/BaseDialog/BaseDialog.tsx
|
|
4276
|
+
var BaseDialogContainer = (_a) => {
|
|
4277
|
+
var _b = _a, {
|
|
4278
|
+
children
|
|
4279
|
+
} = _b, rest = __objRest(_b, [
|
|
4280
|
+
"children"
|
|
4281
|
+
]);
|
|
4282
|
+
const { name } = useBaseDialogInstance();
|
|
4283
|
+
const { isOpened, close: closeDialog } = useBaseDialog();
|
|
4284
|
+
return /* @__PURE__ */ React2.default.createElement(Modal, __spreadValues({ open: isOpened(name), onClose: () => closeDialog(name) }, rest), children instanceof Function ? children({ close: () => closeDialog(name) }) : children);
|
|
4285
|
+
};
|
|
4286
|
+
var BaseDialogBody = (props) => {
|
|
4287
|
+
return /* @__PURE__ */ React2.default.createElement(_material.Box, __spreadValues({ px: 2, pb: 2, width: "100vw", maxWidth: 650 }, props), props.children);
|
|
4288
|
+
};
|
|
4289
|
+
var BaseDialogTrigger = (_a) => {
|
|
4290
|
+
var _b = _a, {
|
|
4291
|
+
name,
|
|
4292
|
+
onClick
|
|
4293
|
+
} = _b, props = __objRest(_b, [
|
|
4294
|
+
"name",
|
|
4295
|
+
"onClick"
|
|
4296
|
+
]);
|
|
4297
|
+
const { open } = useBaseDialog();
|
|
4298
|
+
return /* @__PURE__ */ React2.default.createElement(
|
|
4299
|
+
_material.Button,
|
|
4300
|
+
__spreadProps(__spreadValues({}, props), {
|
|
4301
|
+
onClick: (...params) => {
|
|
4302
|
+
if (onClick)
|
|
4303
|
+
onClick(...params);
|
|
4304
|
+
open(name);
|
|
4305
|
+
}
|
|
4306
|
+
}),
|
|
4307
|
+
props.children
|
|
4308
|
+
);
|
|
4309
|
+
};
|
|
4310
|
+
var BaseDialogCreate = (name = Symbol()) => {
|
|
4311
|
+
return {
|
|
4312
|
+
Trigger: (props) => /* @__PURE__ */ React2.default.createElement(BaseDialogTrigger, __spreadValues({ name }, props)),
|
|
4313
|
+
Root: (props) => /* @__PURE__ */ React2.default.createElement(BaseDialogInstanceProvider, __spreadValues({ name }, props)),
|
|
4314
|
+
Container: BaseDialogContainer,
|
|
4315
|
+
Header: BaseDialogHeader,
|
|
4316
|
+
Body: BaseDialogBody
|
|
4317
|
+
};
|
|
4318
|
+
};
|
|
4319
|
+
var BaseDialog = {
|
|
4320
|
+
Create: BaseDialogCreate,
|
|
4321
|
+
Trigger: BaseDialogTrigger,
|
|
4322
|
+
Provider: BaseDialogProvider,
|
|
4323
|
+
Root: BaseDialogInstanceProvider,
|
|
4324
|
+
Container: BaseDialogContainer,
|
|
4325
|
+
Header: BaseDialogHeader,
|
|
4326
|
+
Body: BaseDialogBody
|
|
4327
|
+
};
|
|
4328
|
+
|
|
4160
4329
|
// src/errors/HttpError.ts
|
|
4161
4330
|
var HttpError = class extends Error {
|
|
4162
4331
|
constructor(status, message) {
|
|
@@ -4454,55 +4623,7 @@ function useFormHelper() {
|
|
|
4454
4623
|
// src/helpers/authHelper.ts
|
|
4455
4624
|
var _cookie = require('cookie');
|
|
4456
4625
|
var _nookies = require('nookies');
|
|
4457
|
-
|
|
4458
|
-
// node_modules/uuid/dist/esm-node/rng.js
|
|
4459
|
-
var _crypto = require('crypto'); var _crypto2 = _interopRequireDefault(_crypto);
|
|
4460
|
-
var rnds8Pool = new Uint8Array(256);
|
|
4461
|
-
var poolPtr = rnds8Pool.length;
|
|
4462
|
-
function rng() {
|
|
4463
|
-
if (poolPtr > rnds8Pool.length - 16) {
|
|
4464
|
-
_crypto2.default.randomFillSync(rnds8Pool);
|
|
4465
|
-
poolPtr = 0;
|
|
4466
|
-
}
|
|
4467
|
-
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
|
4468
|
-
}
|
|
4469
|
-
|
|
4470
|
-
// node_modules/uuid/dist/esm-node/stringify.js
|
|
4471
|
-
var byteToHex = [];
|
|
4472
|
-
for (let i = 0; i < 256; ++i) {
|
|
4473
|
-
byteToHex.push((i + 256).toString(16).slice(1));
|
|
4474
|
-
}
|
|
4475
|
-
function unsafeStringify(arr, offset = 0) {
|
|
4476
|
-
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
|
|
4477
|
-
}
|
|
4478
|
-
|
|
4479
|
-
// node_modules/uuid/dist/esm-node/native.js
|
|
4480
|
-
|
|
4481
|
-
var native_default = {
|
|
4482
|
-
randomUUID: _crypto2.default.randomUUID
|
|
4483
|
-
};
|
|
4484
|
-
|
|
4485
|
-
// node_modules/uuid/dist/esm-node/v4.js
|
|
4486
|
-
function v4(options, buf, offset) {
|
|
4487
|
-
if (native_default.randomUUID && !buf && !options) {
|
|
4488
|
-
return native_default.randomUUID();
|
|
4489
|
-
}
|
|
4490
|
-
options = options || {};
|
|
4491
|
-
const rnds = options.random || (options.rng || rng)();
|
|
4492
|
-
rnds[6] = rnds[6] & 15 | 64;
|
|
4493
|
-
rnds[8] = rnds[8] & 63 | 128;
|
|
4494
|
-
if (buf) {
|
|
4495
|
-
offset = offset || 0;
|
|
4496
|
-
for (let i = 0; i < 16; ++i) {
|
|
4497
|
-
buf[offset + i] = rnds[i];
|
|
4498
|
-
}
|
|
4499
|
-
return buf;
|
|
4500
|
-
}
|
|
4501
|
-
return unsafeStringify(rnds);
|
|
4502
|
-
}
|
|
4503
|
-
var v4_default = v4;
|
|
4504
|
-
|
|
4505
|
-
// src/helpers/authHelper.ts
|
|
4626
|
+
var _uuid = require('uuid');
|
|
4506
4627
|
var _jsonwebtoken = require('jsonwebtoken'); var _jsonwebtoken2 = _interopRequireDefault(_jsonwebtoken);
|
|
4507
4628
|
function decodeSessionToken({
|
|
4508
4629
|
req,
|
|
@@ -4547,7 +4668,7 @@ var AuthHelper = class {
|
|
|
4547
4668
|
expiresIn: this.tokenExpTimeInSeconds || 60 * 15
|
|
4548
4669
|
// 15 minutos
|
|
4549
4670
|
});
|
|
4550
|
-
const uniqueToken =
|
|
4671
|
+
const uniqueToken = _uuid.v4.call(void 0, );
|
|
4551
4672
|
yield this.onCreateRefreshToken(userId, uniqueToken);
|
|
4552
4673
|
return {
|
|
4553
4674
|
token,
|
|
@@ -5354,7 +5475,14 @@ function CreateAuthProvider({
|
|
|
5354
5475
|
|
|
5355
5476
|
|
|
5356
5477
|
|
|
5357
|
-
|
|
5478
|
+
|
|
5479
|
+
|
|
5480
|
+
|
|
5481
|
+
|
|
5482
|
+
|
|
5483
|
+
|
|
5484
|
+
|
|
5485
|
+
exports.AlertContext = AlertContext; exports.AlertProvider = AlertProvider; exports.ApiHelper = ApiHelper; exports.AuthHelper = AuthHelper; exports.Autocomplete = Autocomplete2; exports.BaseDialog = BaseDialog; exports.BaseDialogBody = BaseDialogBody; exports.BaseDialogContainer = BaseDialogContainer; exports.BaseDialogCreate = BaseDialogCreate; exports.BaseDialogTrigger = BaseDialogTrigger; exports.BaseGrid = BaseGrid; exports.BaseGridAutoRows = BaseGridAutoRows; exports.Checkbox = Checkbox; exports.CreateAuthProvider = CreateAuthProvider; exports.Dialog = Dialog; exports.DialogConfirm = DialogConfirm; exports.DomainError = DomainError; exports.EditableTableCell = EditableTableCell; exports.FormHelperContext = FormHelperContext; exports.FormHelperProvider = FormHelperProvider; exports.GetInputLabel = GetInputLabel; exports.Grid = Grid_default; exports.HttpError = HttpError; exports.Input = Input; exports.InputMask = InputMask2; exports.LargeButton = LargeButton; exports.Modal = Modal; exports.Radio = Radio; exports.Select = Select; exports.Switch = Switch; exports.TabPanel = TabPanel; exports.Td = Td; exports.Tr = Tr; exports.UseDialogConfirm = UseDialogConfirm; exports.createAuthContext = createAuthContext; exports.createFilter = createFilter; exports.filterData = filterData; exports.getTabProps = getTabProps; exports.useAlert = useAlert; exports.useAsyncGrid = useAsyncGrid; exports.useBaseDialog = useBaseDialog; exports.useBaseDialogInstance = useBaseDialogInstance; exports.useEvent = useEvent; exports.useFilter = useFilter; exports.useFormHelper = useFormHelper; exports.useGrid = useGrid; exports.useLoading = useLoading;
|
|
5358
5486
|
/*! Bundled license information:
|
|
5359
5487
|
|
|
5360
5488
|
react-is/cjs/react-is.production.min.js:
|