forlogic-core 1.8.4 → 1.8.5
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/README.md +117 -1
- package/dist/README.md +117 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2608,12 +2608,128 @@ import {
|
|
|
2608
2608
|
CrudCards, // Cards com CRUD
|
|
2609
2609
|
CrudPagination, // Paginação integrada
|
|
2610
2610
|
FilterBar, // Filtros integrados
|
|
2611
|
-
BulkActionBar
|
|
2611
|
+
BulkActionBar, // Ações em massa
|
|
2612
|
+
TableRowActions, // Dropdown de ações para linhas
|
|
2613
|
+
ActionMenuItems // Items de menu de ação
|
|
2612
2614
|
} from 'forlogic-core';
|
|
2613
2615
|
```
|
|
2614
2616
|
|
|
2617
|
+
### Componentes de Formulário
|
|
2618
|
+
|
|
2619
|
+
```typescript
|
|
2620
|
+
import {
|
|
2621
|
+
Form,
|
|
2622
|
+
FormField,
|
|
2623
|
+
FormItem,
|
|
2624
|
+
FormLabel,
|
|
2625
|
+
FormControl,
|
|
2626
|
+
FormMessage,
|
|
2627
|
+
FormDescription,
|
|
2628
|
+
Input,
|
|
2629
|
+
Label,
|
|
2630
|
+
Select,
|
|
2631
|
+
SelectContent,
|
|
2632
|
+
SelectItem,
|
|
2633
|
+
SelectTrigger,
|
|
2634
|
+
SelectValue,
|
|
2635
|
+
Textarea,
|
|
2636
|
+
MultiSelect,
|
|
2637
|
+
CreatableCombobox,
|
|
2638
|
+
LoadingState
|
|
2639
|
+
} from 'forlogic-core';
|
|
2640
|
+
```
|
|
2641
|
+
|
|
2642
|
+
**Exemplo de uso:**
|
|
2643
|
+
|
|
2644
|
+
```tsx
|
|
2645
|
+
<Form {...form}>
|
|
2646
|
+
<FormField
|
|
2647
|
+
control={form.control}
|
|
2648
|
+
name="name"
|
|
2649
|
+
render={({ field }) => (
|
|
2650
|
+
<FormItem>
|
|
2651
|
+
<FormLabel>Nome</FormLabel>
|
|
2652
|
+
<FormControl>
|
|
2653
|
+
<Input placeholder="Digite o nome" {...field} />
|
|
2654
|
+
</FormControl>
|
|
2655
|
+
<FormMessage />
|
|
2656
|
+
</FormItem>
|
|
2657
|
+
)}
|
|
2658
|
+
/>
|
|
2659
|
+
|
|
2660
|
+
<FormField
|
|
2661
|
+
control={form.control}
|
|
2662
|
+
name="category"
|
|
2663
|
+
render={({ field }) => (
|
|
2664
|
+
<FormItem>
|
|
2665
|
+
<FormLabel>Categoria</FormLabel>
|
|
2666
|
+
<Select onValueChange={field.onChange} defaultValue={field.value}>
|
|
2667
|
+
<FormControl>
|
|
2668
|
+
<SelectTrigger>
|
|
2669
|
+
<SelectValue placeholder="Selecione..." />
|
|
2670
|
+
</SelectTrigger>
|
|
2671
|
+
</FormControl>
|
|
2672
|
+
<SelectContent>
|
|
2673
|
+
<SelectItem value="cat1">Categoria 1</SelectItem>
|
|
2674
|
+
<SelectItem value="cat2">Categoria 2</SelectItem>
|
|
2675
|
+
</SelectContent>
|
|
2676
|
+
</Select>
|
|
2677
|
+
<FormMessage />
|
|
2678
|
+
</FormItem>
|
|
2679
|
+
)}
|
|
2680
|
+
/>
|
|
2681
|
+
|
|
2682
|
+
<FormField
|
|
2683
|
+
control={form.control}
|
|
2684
|
+
name="description"
|
|
2685
|
+
render={({ field }) => (
|
|
2686
|
+
<FormItem>
|
|
2687
|
+
<FormLabel>Descrição</FormLabel>
|
|
2688
|
+
<FormControl>
|
|
2689
|
+
<Textarea placeholder="Digite a descrição..." {...field} />
|
|
2690
|
+
</FormControl>
|
|
2691
|
+
<FormMessage />
|
|
2692
|
+
</FormItem>
|
|
2693
|
+
)}
|
|
2694
|
+
/>
|
|
2695
|
+
</Form>
|
|
2696
|
+
```
|
|
2697
|
+
|
|
2698
|
+
#### **TableRowActions**
|
|
2699
|
+
|
|
2700
|
+
Componente de dropdown com ações comuns para linhas de tabela.
|
|
2701
|
+
|
|
2702
|
+
**Props:**
|
|
2703
|
+
- `onEdit?: () => void` - Callback para editar
|
|
2704
|
+
- `onDelete?: () => void` - Callback para deletar
|
|
2705
|
+
- `canDelete?: boolean` - Se pode deletar (padrão: true)
|
|
2706
|
+
- `onToggleStatus?: () => void` - Callback para ativar/desativar
|
|
2707
|
+
- `isActive?: boolean` - Status atual (padrão: true)
|
|
2708
|
+
- `customActions?: Array<{icon, label, onClick}>` - Ações customizadas
|
|
2709
|
+
|
|
2615
2710
|
**Exemplo:**
|
|
2616
2711
|
|
|
2712
|
+
```typescript
|
|
2713
|
+
import { TableRowActions } from 'forlogic-core';
|
|
2714
|
+
import { Download } from 'lucide-react';
|
|
2715
|
+
|
|
2716
|
+
<TableRowActions
|
|
2717
|
+
onEdit={() => navigate(`/edit/${item.id}`)}
|
|
2718
|
+
onDelete={() => handleDelete(item.id)}
|
|
2719
|
+
onToggleStatus={() => handleToggle(item.id)}
|
|
2720
|
+
isActive={item.is_active}
|
|
2721
|
+
customActions={[
|
|
2722
|
+
{
|
|
2723
|
+
icon: Download,
|
|
2724
|
+
label: "Download",
|
|
2725
|
+
onClick: () => downloadItem(item)
|
|
2726
|
+
}
|
|
2727
|
+
]}
|
|
2728
|
+
/>
|
|
2729
|
+
```
|
|
2730
|
+
|
|
2731
|
+
#### **Exemplo Completo:**
|
|
2732
|
+
|
|
2617
2733
|
```typescript
|
|
2618
2734
|
<FilterBar
|
|
2619
2735
|
searchValue={manager.searchTerm}
|
package/dist/README.md
CHANGED
|
@@ -2608,12 +2608,128 @@ import {
|
|
|
2608
2608
|
CrudCards, // Cards com CRUD
|
|
2609
2609
|
CrudPagination, // Paginação integrada
|
|
2610
2610
|
FilterBar, // Filtros integrados
|
|
2611
|
-
BulkActionBar
|
|
2611
|
+
BulkActionBar, // Ações em massa
|
|
2612
|
+
TableRowActions, // Dropdown de ações para linhas
|
|
2613
|
+
ActionMenuItems // Items de menu de ação
|
|
2612
2614
|
} from 'forlogic-core';
|
|
2613
2615
|
```
|
|
2614
2616
|
|
|
2617
|
+
### Componentes de Formulário
|
|
2618
|
+
|
|
2619
|
+
```typescript
|
|
2620
|
+
import {
|
|
2621
|
+
Form,
|
|
2622
|
+
FormField,
|
|
2623
|
+
FormItem,
|
|
2624
|
+
FormLabel,
|
|
2625
|
+
FormControl,
|
|
2626
|
+
FormMessage,
|
|
2627
|
+
FormDescription,
|
|
2628
|
+
Input,
|
|
2629
|
+
Label,
|
|
2630
|
+
Select,
|
|
2631
|
+
SelectContent,
|
|
2632
|
+
SelectItem,
|
|
2633
|
+
SelectTrigger,
|
|
2634
|
+
SelectValue,
|
|
2635
|
+
Textarea,
|
|
2636
|
+
MultiSelect,
|
|
2637
|
+
CreatableCombobox,
|
|
2638
|
+
LoadingState
|
|
2639
|
+
} from 'forlogic-core';
|
|
2640
|
+
```
|
|
2641
|
+
|
|
2642
|
+
**Exemplo de uso:**
|
|
2643
|
+
|
|
2644
|
+
```tsx
|
|
2645
|
+
<Form {...form}>
|
|
2646
|
+
<FormField
|
|
2647
|
+
control={form.control}
|
|
2648
|
+
name="name"
|
|
2649
|
+
render={({ field }) => (
|
|
2650
|
+
<FormItem>
|
|
2651
|
+
<FormLabel>Nome</FormLabel>
|
|
2652
|
+
<FormControl>
|
|
2653
|
+
<Input placeholder="Digite o nome" {...field} />
|
|
2654
|
+
</FormControl>
|
|
2655
|
+
<FormMessage />
|
|
2656
|
+
</FormItem>
|
|
2657
|
+
)}
|
|
2658
|
+
/>
|
|
2659
|
+
|
|
2660
|
+
<FormField
|
|
2661
|
+
control={form.control}
|
|
2662
|
+
name="category"
|
|
2663
|
+
render={({ field }) => (
|
|
2664
|
+
<FormItem>
|
|
2665
|
+
<FormLabel>Categoria</FormLabel>
|
|
2666
|
+
<Select onValueChange={field.onChange} defaultValue={field.value}>
|
|
2667
|
+
<FormControl>
|
|
2668
|
+
<SelectTrigger>
|
|
2669
|
+
<SelectValue placeholder="Selecione..." />
|
|
2670
|
+
</SelectTrigger>
|
|
2671
|
+
</FormControl>
|
|
2672
|
+
<SelectContent>
|
|
2673
|
+
<SelectItem value="cat1">Categoria 1</SelectItem>
|
|
2674
|
+
<SelectItem value="cat2">Categoria 2</SelectItem>
|
|
2675
|
+
</SelectContent>
|
|
2676
|
+
</Select>
|
|
2677
|
+
<FormMessage />
|
|
2678
|
+
</FormItem>
|
|
2679
|
+
)}
|
|
2680
|
+
/>
|
|
2681
|
+
|
|
2682
|
+
<FormField
|
|
2683
|
+
control={form.control}
|
|
2684
|
+
name="description"
|
|
2685
|
+
render={({ field }) => (
|
|
2686
|
+
<FormItem>
|
|
2687
|
+
<FormLabel>Descrição</FormLabel>
|
|
2688
|
+
<FormControl>
|
|
2689
|
+
<Textarea placeholder="Digite a descrição..." {...field} />
|
|
2690
|
+
</FormControl>
|
|
2691
|
+
<FormMessage />
|
|
2692
|
+
</FormItem>
|
|
2693
|
+
)}
|
|
2694
|
+
/>
|
|
2695
|
+
</Form>
|
|
2696
|
+
```
|
|
2697
|
+
|
|
2698
|
+
#### **TableRowActions**
|
|
2699
|
+
|
|
2700
|
+
Componente de dropdown com ações comuns para linhas de tabela.
|
|
2701
|
+
|
|
2702
|
+
**Props:**
|
|
2703
|
+
- `onEdit?: () => void` - Callback para editar
|
|
2704
|
+
- `onDelete?: () => void` - Callback para deletar
|
|
2705
|
+
- `canDelete?: boolean` - Se pode deletar (padrão: true)
|
|
2706
|
+
- `onToggleStatus?: () => void` - Callback para ativar/desativar
|
|
2707
|
+
- `isActive?: boolean` - Status atual (padrão: true)
|
|
2708
|
+
- `customActions?: Array<{icon, label, onClick}>` - Ações customizadas
|
|
2709
|
+
|
|
2615
2710
|
**Exemplo:**
|
|
2616
2711
|
|
|
2712
|
+
```typescript
|
|
2713
|
+
import { TableRowActions } from 'forlogic-core';
|
|
2714
|
+
import { Download } from 'lucide-react';
|
|
2715
|
+
|
|
2716
|
+
<TableRowActions
|
|
2717
|
+
onEdit={() => navigate(`/edit/${item.id}`)}
|
|
2718
|
+
onDelete={() => handleDelete(item.id)}
|
|
2719
|
+
onToggleStatus={() => handleToggle(item.id)}
|
|
2720
|
+
isActive={item.is_active}
|
|
2721
|
+
customActions={[
|
|
2722
|
+
{
|
|
2723
|
+
icon: Download,
|
|
2724
|
+
label: "Download",
|
|
2725
|
+
onClick: () => downloadItem(item)
|
|
2726
|
+
}
|
|
2727
|
+
]}
|
|
2728
|
+
/>
|
|
2729
|
+
```
|
|
2730
|
+
|
|
2731
|
+
#### **Exemplo Completo:**
|
|
2732
|
+
|
|
2617
2733
|
```typescript
|
|
2618
2734
|
<FilterBar
|
|
2619
2735
|
searchValue={manager.searchTerm}
|