upconta.frontend-utils 2.3.2 → 2.4.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.
@@ -1,68 +1,20 @@
1
+ import { TypesEc } from './Seeker.utils.ec';
1
2
  import type { Params } from '../types';
2
- import { FC } from 'react';
3
- import { FormItemProps } from 'antd';
4
- import type { Tipos as TiposDefault } from './Seeker.utils';
5
- import type { Tipos as TiposMx } from './Seeker.utils.mx';
6
- type Tipos = TiposDefault | TiposMx;
7
- export interface SeekerProps {
8
- name: string | number | (number | string)[];
9
- label?: string | null;
10
- type?: Tipos;
3
+ import { AutoCompleteProps, FormItemProps } from 'antd';
4
+ export type SeekerProps<T> = Pick<FormItemProps, 'name' | 'label' | 'className' | 'initialValue'> & Pick<AutoCompleteProps, 'disabled' | 'allowClear' | 'placeholder'> & {
5
+ type?: T;
11
6
  required?: boolean;
12
- disabled?: boolean;
13
7
  hideMessage?: boolean;
14
- /**
15
- * Indica si se debe llenar el campo cuando se tipea en el buscador.
16
- */
17
- llenarCuandoTipea?: boolean;
18
- /**
19
- * Reemplaza el `params` que será proporcionado al axios para hacer consultas
20
- * mas personalizadas.
21
- */
8
+ fillWhileTyping?: boolean;
22
9
  params?: Params;
23
10
  canCreate?: boolean;
24
- /**
25
- * Este objeto hará que se habilité el botón para poder crear recurso. Una
26
- * vez que se cree el recurso esta variable debe volver a `undefined` para
27
- * que se deje de mostrar el botón.
28
- */
29
11
  cuerpoCrear?: any;
30
- /**
31
- * Las clases que se aplicaran al `Form.Field`
32
- */
33
- classNameFormItem?: FormItemProps['className'];
34
- /**
35
- * Si este campo es proporcionado en la carga inicial entonces se carga
36
- * automáticamente al seeker.
37
- */
38
- initialValue?: any;
39
12
  onSelect?: (data: any) => void;
40
- configs?: any;
41
- /**
42
- * Permite decidir que valor se utilizar a mostrar
43
- */
44
13
  fieldValue?: string;
45
- /**
46
- * Muestra el boton de limpiar para el autocompletar
47
- */
48
- allowClear?: boolean;
49
- /**
50
- * Permite establecer un documento por defecto en el seeker
51
- */
52
- documentoPorDefecto?: any;
53
- /**
54
- * Permite notificar cuando el documento por defecto cambia
55
- */
56
- onChangeDocumentoPorDefecto?: (documento: any) => void;
57
- /**
58
- * Indica si se ejecuta el onSelect en el onMounted
59
- */
60
14
  ejecutarSelect?: boolean;
61
- /**
62
- * @internal
63
- * Permite que el se estableca que Seeker.utils* usar para inicializar el seeker
64
- */
65
- _useSeekerHook?: any;
66
- }
67
- declare const Seeker: FC<SeekerProps>;
15
+ };
16
+ declare const Seeker: {
17
+ <T = TypesEc>(props: SeekerProps<T>): import("react/jsx-runtime").JSX.Element | null;
18
+ displayName: string;
19
+ };
68
20
  export default Seeker;
@@ -1,47 +1,21 @@
1
- import type { Options, Params } from '../types';
2
- import { VistaInsertar } from '../libs/hooks/vista-insertar';
3
1
  import { LegacyRef, ReactNode } from 'react';
4
- export interface SeekerModalRef {
5
- form: VistaInsertar['form'];
6
- onSubmit: VistaInsertar['onSubmit'];
7
- }
8
- export type Tipos = 'clients' | 'providers' | 'sellers' | 'transporters' | 'cuentas-contables' | 'empleados' | 'mesas' | 'meseros';
2
+ import type { Options, Params, SeekerModalRef } from '../types';
9
3
  export interface SeekerType {
10
- /**
11
- * El label que se va a mostrar en el FormItem.
12
- */
13
4
  label: string;
14
- /**
15
- * El endpoint del cual debe traer los datos.
16
- */
17
5
  endpoint: string;
18
- /**
19
- * Los parámetros que se madarán al axios para traer los datos.
20
- */
21
6
  params?: Params;
22
- /**
23
- * El campo que se mostrará en el input del autocomplete.
24
- */
25
7
  field: string;
26
- /**
27
- * El placeholder que se visualizará en el input del autocomplete.
28
- */
29
8
  placeholder: string;
30
- /**
31
- * Indica que el endpoint tiene opciones y que debe ser descargadas.
32
- */
33
9
  withOptions?: boolean;
34
10
  title: (record: never) => string;
35
11
  subtitle?: (record: never) => ReactNode;
36
- formItemTexto?: (record: never) => string;
37
12
  /**
38
- * El path al identificador único. Por defecto: `_id`.
13
+ * Obtiene el texto extra que se mostrará en el FormItem en vez del
14
+ * `subtitle`. Esta función es útil cuando el `subtitle` no es un string
15
+ * sin un `ReactNode`.
39
16
  */
17
+ getFormItemExtra?: (record: never) => string;
40
18
  customDocumentId?: string;
41
- /**
42
- * Si es `true` se busca uno por query string, caso contratio agregando el id
43
- * del documento: {api}/{id-recurso}.
44
- */
45
19
  buscarPorQueryString?: boolean;
46
20
  modal?: {
47
21
  itemNoEncontrado?: string;
@@ -51,14 +25,16 @@ export interface SeekerType {
51
25
  ref: LegacyRef<SeekerModalRef>;
52
26
  }) => ReactNode;
53
27
  };
54
- /**
55
- * Está función altera el valor con el cual se realizará una búsqueda por `q`.
56
- * Ideal para hacer uso de expresiones regulares como `^`.
57
- */
58
28
  preBusquedaQ?: (value: string) => string;
59
29
  }
60
- declare const useSeekerTypes: (args: {
61
- tipo: Tipos;
30
+ export type FnPack<T = never> = (args: {
31
+ type?: T;
62
32
  options?: Options;
63
- }) => SeekerType;
33
+ params?: Params;
34
+ }) => SeekerType | undefined;
35
+ export declare const initSeeker: (fc: FnPack) => FnPack<never>;
36
+ declare const useSeekerTypes: (args: {
37
+ type: never | undefined;
38
+ params?: Params;
39
+ }) => SeekerType | undefined;
64
40
  export default useSeekerTypes;
@@ -0,0 +1,4 @@
1
+ import { FnPack } from './Seeker.utils';
2
+ export type TypesEc = 'clients' | 'providers' | 'sellers' | 'transporters' | 'cuentas-contables' | 'cost-centers' | 'empleados' | 'mesas' | 'meseros' | 'products' | 'services' | 'products-services';
3
+ declare const seekerPackEc: FnPack<TypesEc>;
4
+ export default seekerPackEc;
@@ -1,66 +1,4 @@
1
- import type { Options, Params } from '../types';
2
- import { VistaInsertar } from '../libs/hooks/vista-insertar';
3
- import { LegacyRef, ReactNode } from 'react';
4
- export interface SeekerModalRef {
5
- form: VistaInsertar['form'];
6
- onSubmit: VistaInsertar['onSubmit'];
7
- }
8
- export type Tipos = 'clients-mx' | 'clients-rfc' | 'codigo-postal' | 'sellers' | 'cuentas-contables-mx' | 'transporters' | 'providers' | 'paises' | 'bankaccounts' | 'colonias' | 'localidades' | 'municipios' | 'estados' | 'ingresos-uuid' | 'products-services' | 'products-and-services-catalog' | 'claves-de-unidad' | 'alumnos' | 'providers-mx' | 'pettycash' | 'creditcards' | 'boxes' | 'faltas' | 'percepciones' | 'deducciones' | 'departamentos' | 'empleados' | 'bodegas' | 'puestos' | 'products' | 'cost-centers' | 'categorias' | 'figuras-transportes' | 'autotransportes';
9
- export interface SeekerType {
10
- /**
11
- * El label que se va a mostrar en el FormItem.
12
- */
13
- label: string;
14
- /**
15
- * El endpoint del cual debe traer los datos.
16
- */
17
- endpoint: string;
18
- /**
19
- * Los parámetros que se madarán al axios para traer los datos.
20
- */
21
- params?: Params;
22
- /**
23
- * El campo que se mostrará en el input del autocomplete.
24
- */
25
- field: string;
26
- /**
27
- * El placeholder que se visualizará en el input del autocomplete.
28
- */
29
- placeholder: string;
30
- /**
31
- * Indica que el endpoint tiene opciones y que debe ser descargadas.
32
- */
33
- withOptions?: boolean;
34
- title: (record: never) => string;
35
- subtitle?: (record: never) => ReactNode;
36
- formItemTexto?: (record: never) => string;
37
- /**
38
- * El path al identificador único. Por defecto: `_id`.
39
- */
40
- customDocumentId?: string;
41
- /**
42
- * Si es `true` se busca uno por query string, caso contratio agregando el id
43
- * del documento: {api}/{id-recurso}.
44
- */
45
- buscarPorQueryString?: boolean;
46
- modal?: {
47
- itemNoEncontrado?: string;
48
- title: string;
49
- getTexto: (doc: any) => string;
50
- componente: (props: {
51
- ref: LegacyRef<SeekerModalRef>;
52
- }) => ReactNode;
53
- };
54
- /**
55
- * Está función altera el valor con el cual se realizará una búsqueda por `q`.
56
- * Ideal para hacer uso de expresiones regulares como `^`.
57
- */
58
- preBusquedaQ?: (value: string) => string;
59
- }
60
- declare const useSeekerTypes: (args: {
61
- tipo: Tipos;
62
- options?: Options;
63
- params?: Params;
64
- configs?: SeekerType;
65
- }) => SeekerType;
66
- export default useSeekerTypes;
1
+ import { FnPack } from './Seeker.utils';
2
+ export type TypesMx = 'clients-mx' | 'clients-rfc' | 'codigo-postal' | 'sellers' | 'cuentas-contables-mx' | 'transporters' | 'providers' | 'paises' | 'bankaccounts' | 'colonias' | 'localidades' | 'municipios' | 'estados' | 'ingresos-uuid' | 'products-services' | 'products-and-services-catalog' | 'claves-de-unidad' | 'alumnos' | 'providers-mx' | 'pettycash' | 'creditcards' | 'boxes' | 'faltas' | 'percepciones' | 'deducciones' | 'departamentos' | 'empleados' | 'bodegas' | 'puestos' | 'products' | 'cost-centers' | 'categorias' | 'figuras-transportes' | 'autotransportes';
3
+ declare const seekerPackMx: FnPack<TypesMx>;
4
+ export default seekerPackMx;
@@ -1,4 +1,5 @@
1
- import { SeekerProps } from './Seeker';
2
1
  import { FC } from 'react';
3
- declare const SeekerMx: FC<Omit<SeekerProps, '_useSeekerHook'>>;
2
+ import { SeekerProps } from './Seeker';
3
+ import type { TypesMx } from './Seeker.utils.mx';
4
+ declare const SeekerMx: FC<SeekerProps<TypesMx>>;
4
5
  export default SeekerMx;
@@ -1,4 +1,4 @@
1
- import { SeekerModalRef } from '../Seeker.utils';
1
+ import { SeekerModalRef } from '../../types';
2
2
  declare const _default: import("react").ForwardRefExoticComponent<{
3
3
  type: "client" | "provider" | "transporter";
4
4
  ocultarBotones?: boolean;
@@ -1,6 +1,4 @@
1
1
  export { default as Header } from './Header';
2
- export { default as SeekerMx } from './SeekerMx';
3
- export { default as Seeker } from './Seeker';
4
2
  export { default as TemaPrincipal } from './TemaPrincipal';
5
3
  export { default as BotonMovimientos } from './BotonMovimientos';
6
4
  export { default as IdentificadorPersona } from './IdentificadorPersona';
@@ -10,8 +8,11 @@ export { default as FiltroFechas } from './FiltrosFechas';
10
8
  export { default as Tutoriales } from './Tutoriales';
11
9
  export { default as Autocompletado } from './Autocompletado';
12
10
  export { default as FormDirecciones } from './mx/administrative/FormDirecciones';
11
+ export { initSeeker } from './Seeker.utils';
12
+ export { default as Seeker } from './Seeker';
13
+ export { default as SeekerMx } from './SeekerMx';
14
+ export { default as seekerPackMx } from './Seeker.utils.mx';
13
15
  export { default as LayoutBase } from './LayoutBase';
14
16
  export { default as ContextoEmpresa, useContextoEmpresa, } from './contexts/Empresa';
15
17
  export { useFrontendUtils } from './contexts/FrontendUtils';
16
18
  export { default as FormularioPersonas } from './administrative/FormularioPersonas';
17
- export type { Tipos as TiposMx } from './Seeker.utils.mx';
@@ -1,4 +1,4 @@
1
- import type { SeekerModalRef } from '../../Seeker.utils.mx';
1
+ import { SeekerModalRef } from '../../../types';
2
2
  import { ComandaUtils } from '../../../types/mx/utils';
3
3
  import { FC } from 'react';
4
4
  import { FormInstance } from 'antd';
@@ -1,4 +1,4 @@
1
- import { SeekerModalRef } from '../../Seeker.utils';
1
+ import { SeekerModalRef } from '../../../types';
2
2
  declare const _default: import("react").ForwardRefExoticComponent<{
3
3
  ocultarBotones?: boolean;
4
4
  tipoPorDefecto?: "producto" | "servicio";
@@ -1,4 +1,4 @@
1
- import type { SeekerModalRef } from '../../Seeker.utils.mx';
1
+ import { SeekerModalRef } from '../../../types';
2
2
  declare const _default: import("react").ForwardRefExoticComponent<{
3
3
  ocultarBotones?: boolean;
4
4
  } & import("react").RefAttributes<SeekerModalRef>>;
@@ -0,0 +1,13 @@
1
+ import { FC } from 'react';
2
+ import { SeekerModalRef } from '../../types';
3
+ import React from 'react';
4
+ export declare const SelectCategorias: FC<{
5
+ value?: string[];
6
+ onChange?: (value: string[]) => void;
7
+ }>;
8
+ declare const _default: React.ForwardRefExoticComponent<{
9
+ ocultarBotones?: boolean;
10
+ tipoPorDefecto?: "producto" | "servicio";
11
+ bordered?: boolean;
12
+ } & React.RefAttributes<SeekerModalRef>>;
13
+ export default _default;