forlogic-core 1.8.3 → 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 +140 -12
- package/dist/README.md +140 -12
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1187,7 +1187,7 @@ function TagsPage() {
|
|
|
1187
1187
|
#### Uso Standalone (Fora do BaseForm)
|
|
1188
1188
|
|
|
1189
1189
|
```typescript
|
|
1190
|
-
import { CreatableCombobox } from 'forlogic-core
|
|
1190
|
+
import { CreatableCombobox } from 'forlogic-core';
|
|
1191
1191
|
import { useState } from 'react';
|
|
1192
1192
|
|
|
1193
1193
|
function MyComponent() {
|
|
@@ -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}
|
|
@@ -5624,23 +5740,35 @@ await notifyLeadershipChange(
|
|
|
5624
5740
|
|
|
5625
5741
|
### Imports Essenciais
|
|
5626
5742
|
|
|
5743
|
+
> **⚠️ IMPORTANTE**: A partir da versão 1.8.4+, todos os componentes devem ser importados diretamente de `forlogic-core`. Os exports modulares (`/ui`, `/modular`, `/crud`) foram removidos para simplificar o uso da biblioteca.
|
|
5744
|
+
|
|
5627
5745
|
```typescript
|
|
5628
|
-
//
|
|
5746
|
+
// ✅ CORRETO (v1.8.4+)
|
|
5629
5747
|
import {
|
|
5748
|
+
// CRUD
|
|
5630
5749
|
createSimpleService,
|
|
5631
5750
|
createCrudPage,
|
|
5632
5751
|
generateCrudConfig,
|
|
5633
|
-
createSimpleSaveHandler
|
|
5752
|
+
createSimpleSaveHandler,
|
|
5753
|
+
|
|
5754
|
+
// UI
|
|
5755
|
+
Button,
|
|
5756
|
+
Input,
|
|
5757
|
+
Card,
|
|
5758
|
+
toast,
|
|
5759
|
+
|
|
5760
|
+
// Auth
|
|
5761
|
+
useAuth,
|
|
5762
|
+
ProtectedRoute,
|
|
5763
|
+
|
|
5764
|
+
// Qualiex
|
|
5765
|
+
QualiexUserField,
|
|
5766
|
+
useQualiexUsers
|
|
5634
5767
|
} from 'forlogic-core';
|
|
5635
5768
|
|
|
5636
|
-
//
|
|
5637
|
-
import { Button, Input
|
|
5638
|
-
|
|
5639
|
-
// Auth
|
|
5640
|
-
import { useAuth, ProtectedRoute } from 'forlogic-core';
|
|
5641
|
-
|
|
5642
|
-
// Qualiex
|
|
5643
|
-
import { QualiexUserField, useQualiexUsers } from 'forlogic-core';
|
|
5769
|
+
// ❌ DEPRECATED (removido em v1.8.4+)
|
|
5770
|
+
// import { Button, Input } from 'forlogic-core/ui';
|
|
5771
|
+
// import { createCrudPage } from 'forlogic-core/crud';
|
|
5644
5772
|
```
|
|
5645
5773
|
|
|
5646
5774
|
### Estrutura de Arquivos
|
package/dist/README.md
CHANGED
|
@@ -1187,7 +1187,7 @@ function TagsPage() {
|
|
|
1187
1187
|
#### Uso Standalone (Fora do BaseForm)
|
|
1188
1188
|
|
|
1189
1189
|
```typescript
|
|
1190
|
-
import { CreatableCombobox } from 'forlogic-core
|
|
1190
|
+
import { CreatableCombobox } from 'forlogic-core';
|
|
1191
1191
|
import { useState } from 'react';
|
|
1192
1192
|
|
|
1193
1193
|
function MyComponent() {
|
|
@@ -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}
|
|
@@ -5624,23 +5740,35 @@ await notifyLeadershipChange(
|
|
|
5624
5740
|
|
|
5625
5741
|
### Imports Essenciais
|
|
5626
5742
|
|
|
5743
|
+
> **⚠️ IMPORTANTE**: A partir da versão 1.8.4+, todos os componentes devem ser importados diretamente de `forlogic-core`. Os exports modulares (`/ui`, `/modular`, `/crud`) foram removidos para simplificar o uso da biblioteca.
|
|
5744
|
+
|
|
5627
5745
|
```typescript
|
|
5628
|
-
//
|
|
5746
|
+
// ✅ CORRETO (v1.8.4+)
|
|
5629
5747
|
import {
|
|
5748
|
+
// CRUD
|
|
5630
5749
|
createSimpleService,
|
|
5631
5750
|
createCrudPage,
|
|
5632
5751
|
generateCrudConfig,
|
|
5633
|
-
createSimpleSaveHandler
|
|
5752
|
+
createSimpleSaveHandler,
|
|
5753
|
+
|
|
5754
|
+
// UI
|
|
5755
|
+
Button,
|
|
5756
|
+
Input,
|
|
5757
|
+
Card,
|
|
5758
|
+
toast,
|
|
5759
|
+
|
|
5760
|
+
// Auth
|
|
5761
|
+
useAuth,
|
|
5762
|
+
ProtectedRoute,
|
|
5763
|
+
|
|
5764
|
+
// Qualiex
|
|
5765
|
+
QualiexUserField,
|
|
5766
|
+
useQualiexUsers
|
|
5634
5767
|
} from 'forlogic-core';
|
|
5635
5768
|
|
|
5636
|
-
//
|
|
5637
|
-
import { Button, Input
|
|
5638
|
-
|
|
5639
|
-
// Auth
|
|
5640
|
-
import { useAuth, ProtectedRoute } from 'forlogic-core';
|
|
5641
|
-
|
|
5642
|
-
// Qualiex
|
|
5643
|
-
import { QualiexUserField, useQualiexUsers } from 'forlogic-core';
|
|
5769
|
+
// ❌ DEPRECATED (removido em v1.8.4+)
|
|
5770
|
+
// import { Button, Input } from 'forlogic-core/ui';
|
|
5771
|
+
// import { createCrudPage } from 'forlogic-core/crud';
|
|
5644
5772
|
```
|
|
5645
5773
|
|
|
5646
5774
|
### Estrutura de Arquivos
|