Clientes -> arreglos varios: imports, formateo, quitar AG Grid

This commit is contained in:
David Arranz 2025-11-04 17:01:13 +01:00
parent 7380b425ea
commit d062c4b5fe
7 changed files with 139 additions and 156 deletions

View File

@ -39,7 +39,6 @@
"@repo/rdx-utils": "workspace:*", "@repo/rdx-utils": "workspace:*",
"@repo/shadcn-ui": "workspace:*", "@repo/shadcn-ui": "workspace:*",
"@tanstack/react-query": "^5.75.4", "@tanstack/react-query": "^5.75.4",
"ag-grid-community": "^33.3.0",
"axios": "^1.9.0", "axios": "^1.9.0",
"express": "^4.18.2", "express": "^4.18.2",
"http-status": "^2.1.0", "http-status": "^2.1.0",
@ -48,7 +47,6 @@
"react-hook-form": "^7.58.1", "react-hook-form": "^7.58.1",
"react-i18next": "^15.5.1", "react-i18next": "^15.5.1",
"react-router-dom": "^6.26.0", "react-router-dom": "^6.26.0",
"sequelize": "^6.37.5",
"zod": "^4.1.11" "zod": "^4.1.11"
} }
} }

View File

@ -1,5 +1,4 @@
export * from "./json-tax-catalog.provider"; export * from "./json-tax-catalog.provider";
export * from "./spain-tax-catalog.provider"; export * from "./spain-tax-catalog.provider";
export * from "./tax-catalog-types";
export * from "./tax-catalog.provider"; export * from "./tax-catalog.provider";
export * from "./tax-catalog-types";

View File

@ -1,8 +1,8 @@
// --- Adaptador que carga el catálogo JSON en memoria e indexa por code --- // --- Adaptador que carga el catálogo JSON en memoria e indexa por code ---
import { Maybe } from "@repo/rdx-utils"; import { Maybe } from "@repo/rdx-utils";
import { TaxCatalogType, TaxItemType, TaxLookupItems } from "./tax-catalog-types";
import { TaxCatalogProvider } from "./tax-catalog.provider"; import { TaxCatalogProvider } from "./tax-catalog.provider";
import { TaxCatalogType, TaxItemType, TaxLookupItems } from "./tax-catalog-types";
export class JsonTaxCatalogProvider implements TaxCatalogProvider { export class JsonTaxCatalogProvider implements TaxCatalogProvider {
// Índice por código normalizado // Índice por código normalizado

View File

@ -1,9 +1,9 @@
import { useDebounce } from '@repo/rdx-ui/components'; import { useDebounce } from "@repo/rdx-ui/components";
import { import {
InputGroup, InputGroup,
InputGroupAddon, InputGroupAddon,
InputGroupButton, InputGroupButton,
InputGroupInput InputGroupInput,
} from "@repo/shadcn-ui/components"; } from "@repo/shadcn-ui/components";
import { Spinner } from "@repo/shadcn-ui/components/spinner"; import { Spinner } from "@repo/shadcn-ui/components/spinner";
import { SearchIcon, XIcon } from "lucide-react"; import { SearchIcon, XIcon } from "lucide-react";
@ -47,10 +47,7 @@ export const SimpleSearchInput = ({
const saveHistory = (term: string) => { const saveHistory = (term: string) => {
if (!term.trim()) return; if (!term.trim()) return;
const cleaned = term.trim(); const cleaned = term.trim();
const newHistory = [cleaned, ...history.filter((h) => h !== cleaned)].slice( const newHistory = [cleaned, ...history.filter((h) => h !== cleaned)].slice(0, maxHistory);
0,
maxHistory
);
setHistory(newHistory); setHistory(newHistory);
localStorage.setItem(SEARCH_HISTORY_KEY, JSON.stringify(newHistory)); localStorage.setItem(SEARCH_HISTORY_KEY, JSON.stringify(newHistory));
}; };
@ -106,20 +103,16 @@ export const SimpleSearchInput = ({
}; };
return ( return (
<div <div className='relative flex-1 max-w-xl'>
className="relative flex-1 max-w-xl" <InputGroup className='bg-background' data-disabled={loading}>
aria-label={t("pages.list.searchPlaceholder", "Search input")}
>
<InputGroup className="bg-background" data-disabled={loading}>
<InputGroupInput <InputGroupInput
ref={inputRef} ref={inputRef}
placeholder={t("common.search_placeholder", "Search...")} placeholder={t("common.search_placeholder", "Search...")}
value={searchValue} value={searchValue}
onChange={handleInputChange} onChange={handleInputChange}
onKeyDown={handleKeyDown} onKeyDown={handleKeyDown}
inputMode="search" inputMode='search'
autoComplete="off" autoComplete='off'
spellCheck={false} spellCheck={false}
disabled={loading} disabled={loading}
onFocus={() => history.length > 0 && setOpen(true)} onFocus={() => history.length > 0 && setOpen(true)}
@ -128,14 +121,12 @@ export const SimpleSearchInput = ({
<SearchIcon aria-hidden /> <SearchIcon aria-hidden />
</InputGroupAddon> </InputGroupAddon>
<InputGroupAddon align="inline-end"> <InputGroupAddon align='inline-end'>
{loading && ( {loading && <Spinner aria-label={t("common.loading", "Loading")} />}
<Spinner aria-label={t("common.loading", "Loading")} />
)}
{!searchValue && !loading && ( {!searchValue && !loading && (
<InputGroupButton <InputGroupButton
variant="secondary" variant='secondary'
className="cursor-pointer" className='cursor-pointer'
onClick={() => onSearchChange(searchValue)} onClick={() => onSearchChange(searchValue)}
> >
{t("common.search", "Search")} {t("common.search", "Search")}
@ -143,21 +134,17 @@ export const SimpleSearchInput = ({
)} )}
{searchValue && !loading && ( {searchValue && !loading && (
<InputGroupButton <InputGroupButton
variant="secondary" variant='secondary'
className="cursor-pointer" className='cursor-pointer'
aria-label={t("common.clear", "Clear search")} aria-label={t("common.clear", "Clear search")}
onClick={handleClear} onClick={handleClear}
> >
<XIcon className="size-4" aria-hidden /> <XIcon className='size-4' aria-hidden />
<span className="sr-only">{t("common.clear", "Clear")}</span> <span className='sr-only'>{t("common.clear", "Clear")}</span>
</InputGroupButton> </InputGroupButton>
)} )}
</InputGroupAddon> </InputGroupAddon>
</InputGroup> </InputGroup>
</div> </div>
); );
}; };

View File

@ -1,6 +1,2 @@
import { AllCommunityModule, ModuleRegistry } from "ag-grid-community";
ModuleRegistry.registerModules([AllCommunityModule]);
export * from "./form"; export * from "./form";
export * from "./page-header"; export * from "./page-header";

View File

@ -1,10 +1,8 @@
import { Button } from '@repo/shadcn-ui/components'; import { Button } from "@repo/shadcn-ui/components";
import { cn } from '@repo/shadcn-ui/lib/utils'; import { cn } from "@repo/shadcn-ui/lib/utils";
import { ChevronLeftIcon } from 'lucide-react'; import { ChevronLeftIcon } from "lucide-react";
// features/common/components/page-header.tsx
import type { ReactNode } from "react"; import type { ReactNode } from "react";
interface PageHeaderProps { interface PageHeaderProps {
backIcon?: ReactNode; backIcon?: ReactNode;
title: ReactNode; title: ReactNode;
@ -15,8 +13,13 @@ interface PageHeaderProps {
className?: string; className?: string;
} }
export function PageHeader({
export function PageHeader({ backIcon, title, description, rightSlot, className }: PageHeaderProps) { backIcon,
title,
description,
rightSlot,
className,
}: PageHeaderProps) {
return ( return (
<div className={cn("pt-6 pb-6 lg:flex lg:items-center lg:justify-between", className)}> <div className={cn("pt-6 pb-6 lg:flex lg:items-center lg:justify-between", className)}>
{/* Lado izquierdo */} {/* Lado izquierdo */}
@ -34,16 +37,16 @@ export function PageHeader({ backIcon, title, description, rightSlot, className
)} )}
<div> <div>
<h2 className='h-8 text-xl font-semibold text-foreground sm:truncate sm:tracking-tight'>{title}</h2> <h2 className='h-8 text-xl font-semibold text-foreground sm:truncate sm:tracking-tight'>
{title}
</h2>
{description && <p className='text-sm text-muted-foreground'>{description}</p>} {description && <p className='text-sm text-muted-foreground'>{description}</p>}
</div> </div>
</div> </div>
</div> </div>
{/* Lado derecho parametrizable */} {/* Lado derecho parametrizable */}
<div className="mt-4 flex lg:mt-0 lg:ml-4"> <div className='mt-4 flex lg:mt-0 lg:ml-4'>{rightSlot}</div>
{rightSlot}
</div>
</div> </div>
); );
} }

View File

@ -6,7 +6,7 @@ const MODULE_VERSION = "1.0.0";
export const CoreModuleManifiest: IModuleClient = { export const CoreModuleManifiest: IModuleClient = {
name: MODULE_NAME, name: MODULE_NAME,
version: MODULE_VERSION, version: MODULE_VERSION,
dependencies: ["core"], dependencies: [],
protected: true, protected: true,
layout: "app", layout: "app",