@wgalleti/primevue-components 0.3.4
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 +218 -0
- package/dist/components/crud/WCrudColumnRenderer.vue.d.ts +8 -0
- package/dist/components/crud/WCrudFormDialog.vue.d.ts +214 -0
- package/dist/components/crud/WCrudView.vue.d.ts +89 -0
- package/dist/components/form/WAutoCompleteFK.vue.d.ts +43 -0
- package/dist/components/form/WFormRenderer.vue.d.ts +41 -0
- package/dist/components/form/WMoneyInput.vue.d.ts +28 -0
- package/dist/components/form/WTransferList.vue.d.ts +25 -0
- package/dist/components/index.d.ts +18 -0
- package/dist/components/ui/WActionBar.vue.d.ts +27 -0
- package/dist/components/ui/WDetailHeader.vue.d.ts +29 -0
- package/dist/components/ui/WEmptyState.vue.d.ts +13 -0
- package/dist/components/ui/WFormSection.vue.d.ts +23 -0
- package/dist/components/ui/WInfoCard.vue.d.ts +11 -0
- package/dist/components/ui/WKpiCard.vue.d.ts +33 -0
- package/dist/components/ui/WKpiGrid.vue.d.ts +31 -0
- package/dist/components/ui/WPageHeader.vue.d.ts +27 -0
- package/dist/components/ui/WProgressFlow.vue.d.ts +33 -0
- package/dist/components/ui/WSectionHeader.vue.d.ts +25 -0
- package/dist/components/ui/WStatusTag.vue.d.ts +10 -0
- package/dist/composables/index.d.ts +6 -0
- package/dist/composables/useApi.d.ts +2 -0
- package/dist/composables/useApiError.d.ts +4 -0
- package/dist/composables/useAppConfirm.d.ts +4 -0
- package/dist/composables/useAppToast.d.ts +6 -0
- package/dist/composables/useCrudManager.d.ts +2 -0
- package/dist/composables/useFormatters.d.ts +19 -0
- package/dist/data-providers/axiosDataProvider.d.ts +3 -0
- package/dist/data-providers/index.d.ts +2 -0
- package/dist/data-providers/supabaseDataProvider.d.ts +54 -0
- package/dist/index.cjs +11 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +3287 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin.d.ts +2 -0
- package/dist/primevue-components.css +1 -0
- package/dist/types/api.d.ts +60 -0
- package/dist/types/components/crud/WCrudColumnRenderer.vue.d.ts +8 -0
- package/dist/types/components/crud/WCrudFormDialog.vue.d.ts +49 -0
- package/dist/types/components/crud/WCrudView.vue.d.ts +103 -0
- package/dist/types/components/form/WAutoCompleteFK.vue.d.ts +43 -0
- package/dist/types/components/form/WFormRenderer.vue.d.ts +40 -0
- package/dist/types/components/form/WMoneyInput.vue.d.ts +28 -0
- package/dist/types/components/form/WTransferList.vue.d.ts +25 -0
- package/dist/types/components/index.d.ts +18 -0
- package/dist/types/components/ui/WActionBar.vue.d.ts +25 -0
- package/dist/types/components/ui/WDetailHeader.vue.d.ts +24 -0
- package/dist/types/components/ui/WEmptyState.vue.d.ts +13 -0
- package/dist/types/components/ui/WFormSection.vue.d.ts +19 -0
- package/dist/types/components/ui/WInfoCard.vue.d.ts +11 -0
- package/dist/types/components/ui/WKpiCard.vue.d.ts +32 -0
- package/dist/types/components/ui/WKpiGrid.vue.d.ts +26 -0
- package/dist/types/components/ui/WPageHeader.vue.d.ts +22 -0
- package/dist/types/components/ui/WProgressFlow.vue.d.ts +28 -0
- package/dist/types/components/ui/WSectionHeader.vue.d.ts +22 -0
- package/dist/types/components/ui/WStatusTag.vue.d.ts +10 -0
- package/dist/types/composables/index.d.ts +6 -0
- package/dist/types/composables/useApi.d.ts +2 -0
- package/dist/types/composables/useApiError.d.ts +4 -0
- package/dist/types/composables/useAppConfirm.d.ts +4 -0
- package/dist/types/composables/useAppToast.d.ts +6 -0
- package/dist/types/composables/useCrudManager.d.ts +2 -0
- package/dist/types/composables/useFormatters.d.ts +19 -0
- package/dist/types/crud.d.ts +184 -0
- package/dist/types/data-providers/axiosDataProvider.d.ts +3 -0
- package/dist/types/data-providers/index.d.ts +2 -0
- package/dist/types/data-providers/supabaseDataProvider.d.ts +54 -0
- package/dist/types/dataProvider.d.ts +28 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/plugin.d.ts +2 -0
- package/dist/types/types/api.d.ts +60 -0
- package/dist/types/types/crud.d.ts +184 -0
- package/dist/types/types/dataProvider.d.ts +28 -0
- package/dist/types/types/index.d.ts +6 -0
- package/dist/types/types/plugin.d.ts +24 -0
- package/dist/types/utils/cep.d.ts +14 -0
- package/dist/types/utils/dates.d.ts +5 -0
- package/dist/types/utils/fieldMapper.d.ts +20 -0
- package/dist/types/utils/masks.d.ts +8 -0
- package/dist/utils/cep.d.ts +14 -0
- package/dist/utils/dates.d.ts +5 -0
- package/dist/utils/fieldMapper.d.ts +20 -0
- package/dist/utils/masks.d.ts +8 -0
- package/package.json +78 -0
package/README.md
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
# @wgalleti/primevue-components
|
|
2
|
+
|
|
3
|
+
Biblioteca de componentes Vue 3 + PrimeVue 4 para padronizar componentes reutilizáveis entre projetos. Inclui CRUD management, componentes de formulário, composables utilitários e mais.
|
|
4
|
+
|
|
5
|
+
## Instalação
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Via git (recomendado para projetos internos)
|
|
9
|
+
yarn add git+https://github.com/wgalleti/wPrimeVueComponents.git
|
|
10
|
+
|
|
11
|
+
# Ou npm link para desenvolvimento local
|
|
12
|
+
cd wPrimeVueComponents && yarn link
|
|
13
|
+
cd seu-projeto && yarn link @wgalleti/primevue-components
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### Peer Dependencies
|
|
17
|
+
|
|
18
|
+
Certifique-se de ter instalado no seu projeto:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
yarn add vue@^3.4 primevue@^4.0 dayjs@^1.11
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Se o projeto usar a camada Axios padrao, instale tambem `axios@^1.0`.
|
|
25
|
+
|
|
26
|
+
## Setup
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
// main.ts
|
|
30
|
+
import { createApp } from 'vue'
|
|
31
|
+
import PrimeVue from 'primevue/config'
|
|
32
|
+
import ToastService from 'primevue/toastservice'
|
|
33
|
+
import ConfirmationService from 'primevue/confirmationservice'
|
|
34
|
+
import { WPrimeVuePlugin } from '@wgalleti/primevue-components'
|
|
35
|
+
import api from './plugins/axios' // sua instância axios configurada
|
|
36
|
+
|
|
37
|
+
const app = createApp(App)
|
|
38
|
+
|
|
39
|
+
app.use(PrimeVue)
|
|
40
|
+
app.use(ToastService)
|
|
41
|
+
app.use(ConfirmationService)
|
|
42
|
+
|
|
43
|
+
app.use(WPrimeVuePlugin, {
|
|
44
|
+
axios: api, // compatibilidade: cria um dataProvider Axios automaticamente
|
|
45
|
+
defaultPageSize: 20, // opcional (default: 20)
|
|
46
|
+
dateFormat: 'DD/MM/YYYY', // opcional (default: 'DD/MM/YYYY')
|
|
47
|
+
locale: 'pt-BR', // opcional (default: 'pt-BR')
|
|
48
|
+
})
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Setup com Supabase
|
|
52
|
+
|
|
53
|
+
Projetos sem backend REST podem registrar um `dataProvider` Supabase. Os endpoints usados em `useCrudManager`, `useApi` e `WAutoCompleteFK` continuam sendo strings, mas precisam estar mapeados em `resources`.
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
import {
|
|
57
|
+
createSupabaseDataProvider,
|
|
58
|
+
WPrimeVuePlugin,
|
|
59
|
+
} from '@wgalleti/primevue-components'
|
|
60
|
+
import { supabase } from './plugins/supabase'
|
|
61
|
+
|
|
62
|
+
const dataProvider = createSupabaseDataProvider({
|
|
63
|
+
client: supabase,
|
|
64
|
+
resources: {
|
|
65
|
+
produtos: {
|
|
66
|
+
table: 'produtos',
|
|
67
|
+
searchFields: ['nome', 'descricao'],
|
|
68
|
+
defaultOrdering: 'nome',
|
|
69
|
+
softDelete: true,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
app.use(WPrimeVuePlugin, {
|
|
75
|
+
dataProvider,
|
|
76
|
+
defaultPageSize: 20,
|
|
77
|
+
})
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Uso Rápido
|
|
81
|
+
|
|
82
|
+
### CRUD Completo em ~30 linhas
|
|
83
|
+
|
|
84
|
+
```vue
|
|
85
|
+
<script setup lang="ts">
|
|
86
|
+
import { useCrudManager, WCrudView } from '@wgalleti/primevue-components'
|
|
87
|
+
import type { ColumnDef, FieldDef } from '@wgalleti/primevue-components'
|
|
88
|
+
|
|
89
|
+
interface Produto {
|
|
90
|
+
id: number
|
|
91
|
+
nome: string
|
|
92
|
+
preco: number
|
|
93
|
+
ativo: boolean
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const columns: ColumnDef[] = [
|
|
97
|
+
{ field: 'nome', header: 'Nome' },
|
|
98
|
+
{ field: 'preco', header: 'Preço', type: 'currency' },
|
|
99
|
+
{ field: 'ativo', header: 'Status', type: 'boolean' },
|
|
100
|
+
]
|
|
101
|
+
|
|
102
|
+
const form: FieldDef[] = [
|
|
103
|
+
{ field: 'nome', label: 'Nome', required: true },
|
|
104
|
+
{ field: 'preco', label: 'Preço', type: 'currency' },
|
|
105
|
+
{ field: 'ativo', label: 'Ativo', type: 'switch', defaultValue: true },
|
|
106
|
+
]
|
|
107
|
+
|
|
108
|
+
const crud = useCrudManager<Produto>({
|
|
109
|
+
endpoint: '/api/v1/produtos/',
|
|
110
|
+
columns,
|
|
111
|
+
form,
|
|
112
|
+
})
|
|
113
|
+
</script>
|
|
114
|
+
|
|
115
|
+
<template>
|
|
116
|
+
<WCrudView :crud="crud" title="Produtos" />
|
|
117
|
+
</template>
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Isso gera automaticamente:
|
|
121
|
+
|
|
122
|
+
- Tabela paginada com busca
|
|
123
|
+
- Botão "Novo" que abre dialog de criação
|
|
124
|
+
- Botões de editar/excluir em cada linha
|
|
125
|
+
- Dialog de formulário com validação
|
|
126
|
+
- Toast de sucesso/erro
|
|
127
|
+
- Confirmação antes de excluir
|
|
128
|
+
|
|
129
|
+
## WFormRenderer — Formularios Standalone (v0.2.0+)
|
|
130
|
+
|
|
131
|
+
O `WFormRenderer` renderiza formularios a partir de `FieldDef[]` sem dialog, ideal para views complexas com Cards e Dialogs customizados.
|
|
132
|
+
|
|
133
|
+
```vue
|
|
134
|
+
<script setup lang="ts">
|
|
135
|
+
import { WFormRenderer } from '@wgalleti/primevue-components'
|
|
136
|
+
import { compraHeaderForm } from '@/schemas/estoque/compra'
|
|
137
|
+
|
|
138
|
+
const form = reactive({
|
|
139
|
+
data: new Date(),
|
|
140
|
+
fornecedor: null,
|
|
141
|
+
numero_nf: '',
|
|
142
|
+
observacoes: '',
|
|
143
|
+
})
|
|
144
|
+
</script>
|
|
145
|
+
|
|
146
|
+
<template>
|
|
147
|
+
<Card>
|
|
148
|
+
<template #content>
|
|
149
|
+
<WFormRenderer
|
|
150
|
+
:fields="compraHeaderForm"
|
|
151
|
+
:form-data="form"
|
|
152
|
+
:is-editing="false"
|
|
153
|
+
@update:field="
|
|
154
|
+
(f, v) => {
|
|
155
|
+
;(form as Record<string, unknown>)[f] = v
|
|
156
|
+
}
|
|
157
|
+
"
|
|
158
|
+
/>
|
|
159
|
+
</template>
|
|
160
|
+
</Card>
|
|
161
|
+
</template>
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Schemas Centralizados
|
|
165
|
+
|
|
166
|
+
A pratica recomendada e centralizar definicoes em arquivos de schema para reutilizacao em 3 contextos:
|
|
167
|
+
|
|
168
|
+
1. **`useCrudManager` / `WCrudView`** — tabela + dialog CRUD
|
|
169
|
+
2. **`WFormRenderer`** — formularios em Cards e Dialogs de views complexas
|
|
170
|
+
3. **`WAutoCompleteFK`** — CRUD inline no modal de busca FK (via `crudFields`/`crudColumns`)
|
|
171
|
+
|
|
172
|
+
```typescript
|
|
173
|
+
// src/schemas/core/produto.ts — dados puros, sem Vue
|
|
174
|
+
import type { ColumnDef, FieldDef } from '@wgalleti/primevue-components'
|
|
175
|
+
|
|
176
|
+
export const produtoColumns: ColumnDef[] = [
|
|
177
|
+
{ field: 'nome', header: 'Nome' },
|
|
178
|
+
{ field: 'preco_medio', header: 'Preco', type: 'currency' },
|
|
179
|
+
]
|
|
180
|
+
|
|
181
|
+
export const produtoForm: FieldDef[] = [
|
|
182
|
+
{ field: 'nome', label: 'Nome', required: true },
|
|
183
|
+
{ field: 'preco_medio', label: 'Preco', type: 'currency' },
|
|
184
|
+
]
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Veja [WFormRenderer](./docs/components/w-form-renderer.md) para exemplos completos e convencoes.
|
|
188
|
+
|
|
189
|
+
## Documentacao Completa
|
|
190
|
+
|
|
191
|
+
- [Guia de Instalacao](./docs/installation.md)
|
|
192
|
+
- [Plugin e Configuracao](./docs/plugin.md)
|
|
193
|
+
- [useCrudManager](./docs/composables/use-crud-manager.md)
|
|
194
|
+
- [useApi](./docs/composables/use-api.md)
|
|
195
|
+
- [useFormatters](./docs/composables/use-formatters.md)
|
|
196
|
+
- [useAppToast](./docs/composables/use-app-toast.md)
|
|
197
|
+
- [useAppConfirm](./docs/composables/use-app-confirm.md)
|
|
198
|
+
- [useApiError](./docs/composables/use-api-error.md)
|
|
199
|
+
- [WCrudView](./docs/components/w-crud-view.md)
|
|
200
|
+
- [WCrudFormDialog](./docs/components/w-crud-form-dialog.md)
|
|
201
|
+
- [WFormRenderer](./docs/components/w-form-renderer.md) **(v0.2.0+)**
|
|
202
|
+
- [WCrudColumnRenderer](./docs/components/w-crud-column-renderer.md)
|
|
203
|
+
- [WAutoCompleteFK](./docs/components/w-auto-complete-fk.md)
|
|
204
|
+
- [WPageHeader](./docs/components/w-page-header.md)
|
|
205
|
+
- [WEmptyState](./docs/components/w-empty-state.md)
|
|
206
|
+
- [WSectionHeader](./docs/components/w-section-header.md)
|
|
207
|
+
- [WFormSection](./docs/components/w-form-section.md)
|
|
208
|
+
- [WActionBar](./docs/components/w-action-bar.md)
|
|
209
|
+
- [WKpiCard](./docs/components/w-kpi-card.md)
|
|
210
|
+
- [WKpiGrid](./docs/components/w-kpi-grid.md)
|
|
211
|
+
- [WProgressFlow](./docs/components/w-progress-flow.md)
|
|
212
|
+
- [WImageCropper](./docs/components/w-image-cropper.md)
|
|
213
|
+
- [Tipos](./docs/types.md)
|
|
214
|
+
- [Migracao de Projetos](./docs/migration.md)
|
|
215
|
+
|
|
216
|
+
## Licença
|
|
217
|
+
|
|
218
|
+
Uso interno — wGalleti.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ColumnDef } from '../../types/crud';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
column: ColumnDef;
|
|
4
|
+
value: unknown;
|
|
5
|
+
rowData: Record<string, unknown>;
|
|
6
|
+
};
|
|
7
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { FieldDef } from '../../types/crud';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
visible: boolean;
|
|
4
|
+
title: string;
|
|
5
|
+
fields: FieldDef[];
|
|
6
|
+
formData: Record<string, unknown>;
|
|
7
|
+
isEditing: boolean;
|
|
8
|
+
saving: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
width?: string;
|
|
11
|
+
};
|
|
12
|
+
declare function __VLS_template(): {
|
|
13
|
+
attrs: Partial<{}>;
|
|
14
|
+
slots: Partial<Record<`field-${string}`, (_: {
|
|
15
|
+
field: FieldDef;
|
|
16
|
+
formData: Record<string, unknown>;
|
|
17
|
+
isEditing: boolean;
|
|
18
|
+
setFormField: (f: string, v: unknown) => void;
|
|
19
|
+
}) => any>> & Partial<Record<`image-${string}`, (_: {
|
|
20
|
+
field: FieldDef;
|
|
21
|
+
formData: Record<string, unknown>;
|
|
22
|
+
}) => any>> & {
|
|
23
|
+
footer?(_: {
|
|
24
|
+
saving: boolean;
|
|
25
|
+
disabled: boolean;
|
|
26
|
+
}): any;
|
|
27
|
+
};
|
|
28
|
+
refs: {
|
|
29
|
+
rendererRef: ({
|
|
30
|
+
$: import('vue').ComponentInternalInstance;
|
|
31
|
+
$data: {};
|
|
32
|
+
$props: {
|
|
33
|
+
readonly fields: FieldDef[];
|
|
34
|
+
readonly formData: Record<string, unknown>;
|
|
35
|
+
readonly isEditing: boolean;
|
|
36
|
+
readonly disabled?: boolean | undefined;
|
|
37
|
+
readonly "onUpdate:field"?: ((field: string, value: unknown) => any) | undefined;
|
|
38
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps;
|
|
39
|
+
$attrs: {
|
|
40
|
+
[x: string]: unknown;
|
|
41
|
+
};
|
|
42
|
+
$refs: {
|
|
43
|
+
[x: string]: unknown;
|
|
44
|
+
};
|
|
45
|
+
$slots: Readonly<{
|
|
46
|
+
[name: string]: import('vue').Slot<any> | undefined;
|
|
47
|
+
}>;
|
|
48
|
+
$root: import('vue').ComponentPublicInstance | null;
|
|
49
|
+
$parent: import('vue').ComponentPublicInstance | null;
|
|
50
|
+
$host: Element | null;
|
|
51
|
+
$emit: (event: "update:field", field: string, value: unknown) => void;
|
|
52
|
+
$el: HTMLDivElement;
|
|
53
|
+
$options: import('vue').ComponentOptionsBase<Readonly<{
|
|
54
|
+
fields: FieldDef[];
|
|
55
|
+
formData: Record<string, unknown>;
|
|
56
|
+
isEditing: boolean;
|
|
57
|
+
disabled?: boolean;
|
|
58
|
+
}> & Readonly<{
|
|
59
|
+
"onUpdate:field"?: ((field: string, value: unknown) => any) | undefined;
|
|
60
|
+
}>, {
|
|
61
|
+
validateAll: () => string[];
|
|
62
|
+
clearErrors: () => void;
|
|
63
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
64
|
+
"update:field": (field: string, value: unknown) => any;
|
|
65
|
+
}, string, {
|
|
66
|
+
disabled: boolean;
|
|
67
|
+
}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & {
|
|
68
|
+
beforeCreate?: (() => void) | (() => void)[];
|
|
69
|
+
created?: (() => void) | (() => void)[];
|
|
70
|
+
beforeMount?: (() => void) | (() => void)[];
|
|
71
|
+
mounted?: (() => void) | (() => void)[];
|
|
72
|
+
beforeUpdate?: (() => void) | (() => void)[];
|
|
73
|
+
updated?: (() => void) | (() => void)[];
|
|
74
|
+
activated?: (() => void) | (() => void)[];
|
|
75
|
+
deactivated?: (() => void) | (() => void)[];
|
|
76
|
+
beforeDestroy?: (() => void) | (() => void)[];
|
|
77
|
+
beforeUnmount?: (() => void) | (() => void)[];
|
|
78
|
+
destroyed?: (() => void) | (() => void)[];
|
|
79
|
+
unmounted?: (() => void) | (() => void)[];
|
|
80
|
+
renderTracked?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
|
|
81
|
+
renderTriggered?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
|
|
82
|
+
errorCaptured?: ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void)[];
|
|
83
|
+
};
|
|
84
|
+
$forceUpdate: () => void;
|
|
85
|
+
$nextTick: typeof import('vue').nextTick;
|
|
86
|
+
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import('@vue/reactivity').OnCleanup]) => any : (...args: [any, any, import('@vue/reactivity').OnCleanup]) => any, options?: import('vue').WatchOptions): import('vue').WatchStopHandle;
|
|
87
|
+
} & Readonly<{
|
|
88
|
+
disabled: boolean;
|
|
89
|
+
}> & Omit<Readonly<{
|
|
90
|
+
fields: FieldDef[];
|
|
91
|
+
formData: Record<string, unknown>;
|
|
92
|
+
isEditing: boolean;
|
|
93
|
+
disabled?: boolean;
|
|
94
|
+
}> & Readonly<{
|
|
95
|
+
"onUpdate:field"?: ((field: string, value: unknown) => any) | undefined;
|
|
96
|
+
}>, "disabled" | "validateAll" | "clearErrors"> & import('vue').ShallowUnwrapRef<{
|
|
97
|
+
validateAll: () => string[];
|
|
98
|
+
clearErrors: () => void;
|
|
99
|
+
}> & {} & import('vue').ComponentCustomProperties & {} & {
|
|
100
|
+
$slots: Partial<Record<`field-${string}`, (_: {
|
|
101
|
+
field: FieldDef;
|
|
102
|
+
formData: Record<string, unknown>;
|
|
103
|
+
isEditing: boolean;
|
|
104
|
+
setFormField: (f: string, v: unknown) => void;
|
|
105
|
+
}) => any>> & Partial<Record<`image-${string}`, (_: {
|
|
106
|
+
field: FieldDef;
|
|
107
|
+
formData: Record<string, unknown>;
|
|
108
|
+
}) => any>>;
|
|
109
|
+
}) | null;
|
|
110
|
+
};
|
|
111
|
+
rootEl: any;
|
|
112
|
+
};
|
|
113
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
114
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
115
|
+
"update:visible": (value: boolean) => any;
|
|
116
|
+
"update:field": (field: string, value: unknown) => any;
|
|
117
|
+
save: () => any;
|
|
118
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
119
|
+
"onUpdate:visible"?: ((value: boolean) => any) | undefined;
|
|
120
|
+
"onUpdate:field"?: ((field: string, value: unknown) => any) | undefined;
|
|
121
|
+
onSave?: (() => any) | undefined;
|
|
122
|
+
}>, {
|
|
123
|
+
disabled: boolean;
|
|
124
|
+
width: string;
|
|
125
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
126
|
+
rendererRef: ({
|
|
127
|
+
$: import('vue').ComponentInternalInstance;
|
|
128
|
+
$data: {};
|
|
129
|
+
$props: {
|
|
130
|
+
readonly fields: FieldDef[];
|
|
131
|
+
readonly formData: Record<string, unknown>;
|
|
132
|
+
readonly isEditing: boolean;
|
|
133
|
+
readonly disabled?: boolean | undefined;
|
|
134
|
+
readonly "onUpdate:field"?: ((field: string, value: unknown) => any) | undefined;
|
|
135
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps;
|
|
136
|
+
$attrs: {
|
|
137
|
+
[x: string]: unknown;
|
|
138
|
+
};
|
|
139
|
+
$refs: {
|
|
140
|
+
[x: string]: unknown;
|
|
141
|
+
};
|
|
142
|
+
$slots: Readonly<{
|
|
143
|
+
[name: string]: import('vue').Slot<any> | undefined;
|
|
144
|
+
}>;
|
|
145
|
+
$root: import('vue').ComponentPublicInstance | null;
|
|
146
|
+
$parent: import('vue').ComponentPublicInstance | null;
|
|
147
|
+
$host: Element | null;
|
|
148
|
+
$emit: (event: "update:field", field: string, value: unknown) => void;
|
|
149
|
+
$el: HTMLDivElement;
|
|
150
|
+
$options: import('vue').ComponentOptionsBase<Readonly<{
|
|
151
|
+
fields: FieldDef[];
|
|
152
|
+
formData: Record<string, unknown>;
|
|
153
|
+
isEditing: boolean;
|
|
154
|
+
disabled?: boolean;
|
|
155
|
+
}> & Readonly<{
|
|
156
|
+
"onUpdate:field"?: ((field: string, value: unknown) => any) | undefined;
|
|
157
|
+
}>, {
|
|
158
|
+
validateAll: () => string[];
|
|
159
|
+
clearErrors: () => void;
|
|
160
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
161
|
+
"update:field": (field: string, value: unknown) => any;
|
|
162
|
+
}, string, {
|
|
163
|
+
disabled: boolean;
|
|
164
|
+
}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & {
|
|
165
|
+
beforeCreate?: (() => void) | (() => void)[];
|
|
166
|
+
created?: (() => void) | (() => void)[];
|
|
167
|
+
beforeMount?: (() => void) | (() => void)[];
|
|
168
|
+
mounted?: (() => void) | (() => void)[];
|
|
169
|
+
beforeUpdate?: (() => void) | (() => void)[];
|
|
170
|
+
updated?: (() => void) | (() => void)[];
|
|
171
|
+
activated?: (() => void) | (() => void)[];
|
|
172
|
+
deactivated?: (() => void) | (() => void)[];
|
|
173
|
+
beforeDestroy?: (() => void) | (() => void)[];
|
|
174
|
+
beforeUnmount?: (() => void) | (() => void)[];
|
|
175
|
+
destroyed?: (() => void) | (() => void)[];
|
|
176
|
+
unmounted?: (() => void) | (() => void)[];
|
|
177
|
+
renderTracked?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
|
|
178
|
+
renderTriggered?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
|
|
179
|
+
errorCaptured?: ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void)[];
|
|
180
|
+
};
|
|
181
|
+
$forceUpdate: () => void;
|
|
182
|
+
$nextTick: typeof import('vue').nextTick;
|
|
183
|
+
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import('@vue/reactivity').OnCleanup]) => any : (...args: [any, any, import('@vue/reactivity').OnCleanup]) => any, options?: import('vue').WatchOptions): import('vue').WatchStopHandle;
|
|
184
|
+
} & Readonly<{
|
|
185
|
+
disabled: boolean;
|
|
186
|
+
}> & Omit<Readonly<{
|
|
187
|
+
fields: FieldDef[];
|
|
188
|
+
formData: Record<string, unknown>;
|
|
189
|
+
isEditing: boolean;
|
|
190
|
+
disabled?: boolean;
|
|
191
|
+
}> & Readonly<{
|
|
192
|
+
"onUpdate:field"?: ((field: string, value: unknown) => any) | undefined;
|
|
193
|
+
}>, "disabled" | "validateAll" | "clearErrors"> & import('vue').ShallowUnwrapRef<{
|
|
194
|
+
validateAll: () => string[];
|
|
195
|
+
clearErrors: () => void;
|
|
196
|
+
}> & {} & import('vue').ComponentCustomProperties & {} & {
|
|
197
|
+
$slots: Partial<Record<`field-${string}`, (_: {
|
|
198
|
+
field: FieldDef;
|
|
199
|
+
formData: Record<string, unknown>;
|
|
200
|
+
isEditing: boolean;
|
|
201
|
+
setFormField: (f: string, v: unknown) => void;
|
|
202
|
+
}) => any>> & Partial<Record<`image-${string}`, (_: {
|
|
203
|
+
field: FieldDef;
|
|
204
|
+
formData: Record<string, unknown>;
|
|
205
|
+
}) => any>>;
|
|
206
|
+
}) | null;
|
|
207
|
+
}, any>;
|
|
208
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
209
|
+
export default _default;
|
|
210
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
211
|
+
new (): {
|
|
212
|
+
$slots: S;
|
|
213
|
+
};
|
|
214
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { CrudManagerReturn, KpiItem } from '../../types/crud';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
crud: CrudManagerReturn<any>;
|
|
4
|
+
title: string;
|
|
5
|
+
subtitle?: string;
|
|
6
|
+
showSearch?: boolean;
|
|
7
|
+
showHeader?: boolean;
|
|
8
|
+
dialogWidth?: string;
|
|
9
|
+
autoInit?: boolean;
|
|
10
|
+
showKpi?: boolean;
|
|
11
|
+
kpiIcon?: string;
|
|
12
|
+
kpiLabel?: string;
|
|
13
|
+
extraKpis?: KpiItem[];
|
|
14
|
+
expandable?: boolean;
|
|
15
|
+
viewToggle?: boolean;
|
|
16
|
+
defaultView?: 'table' | 'cards';
|
|
17
|
+
cardFields?: number;
|
|
18
|
+
};
|
|
19
|
+
declare function __VLS_template(): {
|
|
20
|
+
attrs: Partial<{}>;
|
|
21
|
+
slots: Partial<Record<`column-${string}`, (_: {
|
|
22
|
+
data: any;
|
|
23
|
+
value: any;
|
|
24
|
+
}) => any>> & Partial<Record<`column-${string}`, (_: {
|
|
25
|
+
data: any;
|
|
26
|
+
value: any;
|
|
27
|
+
}) => any>> & Partial<Record<`field-${string}`, (_: {
|
|
28
|
+
field: import('../../types/crud').FieldDef;
|
|
29
|
+
formData: Record<string, unknown>;
|
|
30
|
+
isEditing: boolean;
|
|
31
|
+
setFormField: (f: string, v: unknown) => void;
|
|
32
|
+
}) => any>> & {
|
|
33
|
+
'header-actions'?(_: {}): any;
|
|
34
|
+
'before-table'?(_: {}): any;
|
|
35
|
+
'toolbar-start'?(_: {}): any;
|
|
36
|
+
'toolbar-start'?(_: {}): any;
|
|
37
|
+
'toolbar-filters'?(_: {}): any;
|
|
38
|
+
'toolbar-filters'?(_: {}): any;
|
|
39
|
+
'toolbar-actions'?(_: {}): any;
|
|
40
|
+
'toolbar-actions'?(_: {}): any;
|
|
41
|
+
empty?(_: {}): any;
|
|
42
|
+
empty?(_: {}): any;
|
|
43
|
+
'row-actions'?(_: {
|
|
44
|
+
data: any;
|
|
45
|
+
crud: CrudManagerReturn<any>;
|
|
46
|
+
}): any;
|
|
47
|
+
'row-actions'?(_: {
|
|
48
|
+
data: any;
|
|
49
|
+
crud: CrudManagerReturn<any>;
|
|
50
|
+
}): any;
|
|
51
|
+
expansion?(_: {
|
|
52
|
+
data: any;
|
|
53
|
+
}): any;
|
|
54
|
+
'form-dialog'?(_: {
|
|
55
|
+
crud: CrudManagerReturn<any>;
|
|
56
|
+
dialogWidth: string;
|
|
57
|
+
}): any;
|
|
58
|
+
};
|
|
59
|
+
refs: {};
|
|
60
|
+
rootEl: HTMLDivElement;
|
|
61
|
+
};
|
|
62
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
63
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
64
|
+
"row-expand": (data: unknown) => any;
|
|
65
|
+
"row-collapse": (data: unknown) => any;
|
|
66
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
67
|
+
"onRow-expand"?: ((data: unknown) => any) | undefined;
|
|
68
|
+
"onRow-collapse"?: ((data: unknown) => any) | undefined;
|
|
69
|
+
}>, {
|
|
70
|
+
dialogWidth: string;
|
|
71
|
+
showHeader: boolean;
|
|
72
|
+
showSearch: boolean;
|
|
73
|
+
autoInit: boolean;
|
|
74
|
+
showKpi: boolean;
|
|
75
|
+
kpiIcon: string;
|
|
76
|
+
kpiLabel: string;
|
|
77
|
+
extraKpis: KpiItem[];
|
|
78
|
+
expandable: boolean;
|
|
79
|
+
viewToggle: boolean;
|
|
80
|
+
defaultView: "table" | "cards";
|
|
81
|
+
cardFields: number;
|
|
82
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
83
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
84
|
+
export default _default;
|
|
85
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
86
|
+
new (): {
|
|
87
|
+
$slots: S;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { FieldDef, ColumnDef } from '../../types/crud';
|
|
2
|
+
interface ColumnMeta {
|
|
3
|
+
field: string;
|
|
4
|
+
header: string;
|
|
5
|
+
}
|
|
6
|
+
type __VLS_Props = {
|
|
7
|
+
modelValue: string | number | Record<string, unknown> | null;
|
|
8
|
+
endpoint: string;
|
|
9
|
+
endpointParams?: Record<string, string | number | boolean>;
|
|
10
|
+
optionLabel?: string;
|
|
11
|
+
optionValue?: string;
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
showClear?: boolean;
|
|
15
|
+
forceSelection?: boolean;
|
|
16
|
+
columns?: ColumnMeta[];
|
|
17
|
+
minLength?: number;
|
|
18
|
+
dialogHeader?: string;
|
|
19
|
+
canCreate?: boolean;
|
|
20
|
+
canEdit?: boolean;
|
|
21
|
+
canDelete?: boolean;
|
|
22
|
+
crudFields?: FieldDef[];
|
|
23
|
+
crudColumns?: ColumnDef[];
|
|
24
|
+
dialogWidth?: string;
|
|
25
|
+
};
|
|
26
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
27
|
+
"update:modelValue": (value: Record<string, unknown> | null) => any;
|
|
28
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
29
|
+
"onUpdate:modelValue"?: ((value: Record<string, unknown> | null) => any) | undefined;
|
|
30
|
+
}>, {
|
|
31
|
+
optionLabel: string;
|
|
32
|
+
optionValue: string;
|
|
33
|
+
placeholder: string;
|
|
34
|
+
disabled: boolean;
|
|
35
|
+
showClear: boolean;
|
|
36
|
+
forceSelection: boolean;
|
|
37
|
+
minLength: number;
|
|
38
|
+
canCreate: boolean;
|
|
39
|
+
canEdit: boolean;
|
|
40
|
+
canDelete: boolean;
|
|
41
|
+
dialogWidth: string;
|
|
42
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
43
|
+
export default _default;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { FieldDef } from '../../types/crud';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
fields: FieldDef[];
|
|
4
|
+
formData: Record<string, unknown>;
|
|
5
|
+
isEditing: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare function validateAll(): string[];
|
|
9
|
+
declare function clearErrors(): void;
|
|
10
|
+
declare function __VLS_template(): {
|
|
11
|
+
attrs: Partial<{}>;
|
|
12
|
+
slots: Partial<Record<`field-${string}`, (_: {
|
|
13
|
+
field: FieldDef;
|
|
14
|
+
formData: Record<string, unknown>;
|
|
15
|
+
isEditing: boolean;
|
|
16
|
+
setFormField: (f: string, v: unknown) => void;
|
|
17
|
+
}) => any>> & Partial<Record<`image-${string}`, (_: {
|
|
18
|
+
field: FieldDef;
|
|
19
|
+
formData: Record<string, unknown>;
|
|
20
|
+
}) => any>>;
|
|
21
|
+
refs: {};
|
|
22
|
+
rootEl: HTMLDivElement;
|
|
23
|
+
};
|
|
24
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
25
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {
|
|
26
|
+
validateAll: typeof validateAll;
|
|
27
|
+
clearErrors: typeof clearErrors;
|
|
28
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
29
|
+
"update:field": (field: string, value: unknown) => any;
|
|
30
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
31
|
+
"onUpdate:field"?: ((field: string, value: unknown) => any) | undefined;
|
|
32
|
+
}>, {
|
|
33
|
+
disabled: boolean;
|
|
34
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
35
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
36
|
+
export default _default;
|
|
37
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
38
|
+
new (): {
|
|
39
|
+
$slots: S;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
/** Numeric model — the real value sent to the API (e.g. 1234.56). */
|
|
3
|
+
modelValue: number | null;
|
|
4
|
+
/** Fixed decimal places (default: 2). */
|
|
5
|
+
decimals?: number;
|
|
6
|
+
/** Show a "R$" prefix. Ignored when `prefix` is set. */
|
|
7
|
+
currency?: boolean;
|
|
8
|
+
/** Custom leading addon (overrides `currency`). */
|
|
9
|
+
prefix?: string;
|
|
10
|
+
/** Trailing addon. */
|
|
11
|
+
suffix?: string;
|
|
12
|
+
/** Display locale for grouping/decimal separators (default: 'pt-BR'). */
|
|
13
|
+
locale?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
invalid?: boolean;
|
|
17
|
+
};
|
|
18
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
19
|
+
"update:modelValue": (value: number | null) => any;
|
|
20
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
21
|
+
"onUpdate:modelValue"?: ((value: number | null) => any) | undefined;
|
|
22
|
+
}>, {
|
|
23
|
+
currency: boolean;
|
|
24
|
+
disabled: boolean;
|
|
25
|
+
decimals: number;
|
|
26
|
+
locale: string;
|
|
27
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
28
|
+
export default _default;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
type Id = string | number;
|
|
2
|
+
type Item = Record<string, unknown>;
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
/** Full pool of available records. */
|
|
5
|
+
source: Item[];
|
|
6
|
+
/** Currently selected ids (v-model:selected). */
|
|
7
|
+
selected: Id[];
|
|
8
|
+
/** Field used as the record id (default: 'id'). */
|
|
9
|
+
trackBy?: string;
|
|
10
|
+
/** Field used for the visible label (default: 'nome'). */
|
|
11
|
+
optionLabel?: string;
|
|
12
|
+
/** Fields to match when searching (default: [optionLabel]). */
|
|
13
|
+
searchFields?: string[];
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
};
|
|
16
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
17
|
+
"update:selected": (ids: Id[]) => any;
|
|
18
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
19
|
+
"onUpdate:selected"?: ((ids: Id[]) => any) | undefined;
|
|
20
|
+
}>, {
|
|
21
|
+
optionLabel: string;
|
|
22
|
+
selected: Id[];
|
|
23
|
+
trackBy: string;
|
|
24
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
25
|
+
export default _default;
|