@club-employes/utopia 4.71.0 → 4.73.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.
- package/dist/components/atoms/Button/Button.d.ts +3 -3
- package/dist/components/atoms/Button/types.d.ts +4 -2
- package/dist/components/atoms/InputText/InputText.d.ts +2 -2
- package/dist/components/atoms/Link/Link.d.ts +1 -1
- package/dist/components/atoms/ProgressBar/ProgressBar.d.ts +1 -1
- package/dist/components/atoms/ProgressBar/types.d.ts +5 -0
- package/dist/components/atoms/RangeSlider/RangeSlider.d.ts +1 -1
- package/dist/components/atoms/Text/Text.d.ts +3 -3
- package/dist/components/atoms/Text/types.d.ts +1 -1
- package/dist/components/layouts/AuthLayout/AuthLayout.d.ts +1 -1
- package/dist/components/molecules/DatePicker/DatePicker.d.ts +2 -1
- package/dist/components/molecules/DatePicker/types.d.ts +1 -0
- package/dist/components/molecules/DropDown/DropDown.d.ts +11 -11
- package/dist/components/molecules/DropDown/types.d.ts +3 -3
- package/dist/components/molecules/FilterSelect/FilterSelect.d.ts +1 -1
- package/dist/components/molecules/InputPhone/InputPhone.d.ts +20 -20
- package/dist/components/molecules/Modal/Modal.d.ts +16 -15
- package/dist/components/molecules/PriceTag/PriceTag.d.ts +1 -1
- package/dist/components/organisms/DropFile/DropFile.d.ts +24 -6
- package/dist/components/organisms/Table/DataCell.d.ts +24 -0
- package/dist/components/organisms/Table/EditorCell.d.ts +24 -0
- package/dist/components/organisms/Table/FilterCell.d.ts +12 -0
- package/dist/components/organisms/Table/Table.d.ts +68 -0
- package/dist/components/organisms/Table/index.d.ts +3 -0
- package/dist/components/organisms/Table/renderers/data/ActionsCell.d.ts +8 -0
- package/dist/components/organisms/Table/renderers/data/CustomCell.d.ts +23 -0
- package/dist/components/organisms/Table/renderers/data/DateCell.d.ts +12 -0
- package/dist/components/organisms/Table/renderers/data/DateRangeCell.d.ts +4 -0
- package/dist/components/organisms/Table/renderers/data/DropdownCell.d.ts +4 -0
- package/dist/components/organisms/Table/renderers/data/PriceCell.d.ts +4 -0
- package/dist/components/organisms/Table/renderers/data/ProgressBarCell.d.ts +4 -0
- package/dist/components/organisms/Table/renderers/data/TagCell.d.ts +4 -0
- package/dist/components/organisms/Table/renderers/data/TextImageCell.d.ts +4 -0
- package/dist/components/organisms/Table/renderers/data/ToggleCell.d.ts +4 -0
- package/dist/components/organisms/Table/renderers/editor/DateEditorCell.d.ts +4 -0
- package/dist/components/organisms/Table/renderers/editor/DefaultEditorCell.d.ts +4 -0
- package/dist/components/organisms/Table/renderers/editor/DropdownEditorCell.d.ts +4 -0
- package/dist/components/organisms/Table/renderers/editor/PriceEditorCell.d.ts +4 -0
- package/dist/components/organisms/Table/renderers/editor/TextEditorCell.d.ts +4 -0
- package/dist/components/organisms/Table/renderers/filters/DateFilterCell.d.ts +12 -0
- package/dist/components/organisms/Table/renderers/filters/DateRangeFilterCell.d.ts +12 -0
- package/dist/components/organisms/Table/renderers/filters/DropdownFilterCell.d.ts +12 -0
- package/dist/components/organisms/Table/renderers/filters/InputFilterCell.d.ts +12 -0
- package/dist/components/organisms/Table/types.d.ts +545 -0
- package/dist/components/organisms/Table/utils/errorValidation.d.ts +34 -0
- package/dist/components/organisms/Table/utils/getColumnErrors.d.ts +10 -0
- package/dist/components/organisms/index.d.ts +3 -2
- package/dist/composables/index.d.ts +8 -0
- package/dist/composables/useDateFormatters.d.ts +12 -0
- package/dist/composables/useIsoDate.d.ts +4 -0
- package/dist/composables/useTableColumns.d.ts +7 -0
- package/dist/composables/useTableFilters.d.ts +11 -0
- package/dist/composables/useTablePagination.d.ts +19 -0
- package/dist/composables/useTableRequestData.d.ts +16 -0
- package/dist/composables/useTableSelection.d.ts +16 -0
- package/dist/composables/useTableSort.d.ts +8 -0
- package/dist/composables/useTableTranslations.d.ts +27 -0
- package/dist/{dark-Bugw9CfG.js → dark-CGsOK8c0.js} +1 -1
- package/dist/{dark-CkQ4j_Qu.js → dark-gUmiZXhJ.js} +1 -1
- package/dist/icons-list.json +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +25527 -5771
- package/dist/{light-CBRrvcJ5.js → light-BmxdNyqF.js} +1 -1
- package/dist/{light-BS5JGAVQ.js → light-CqrOB4q6.js} +1 -1
- package/dist/tokens/club-employes/dark.css +1 -0
- package/dist/tokens/club-employes/dark.js +1 -0
- package/dist/tokens/club-employes/light.css +1 -0
- package/dist/tokens/club-employes/light.js +1 -0
- package/dist/tokens/gifteo/dark.css +1 -0
- package/dist/tokens/gifteo/dark.js +1 -0
- package/dist/tokens/gifteo/light.css +1 -0
- package/dist/tokens/gifteo/light.js +1 -0
- package/dist/utopia.css +1 -1
- package/package.json +1 -1
- package/dist/components/organisms/DataTable/DataTable.d.ts +0 -54
- package/dist/components/organisms/DataTable/index.d.ts +0 -1
|
@@ -0,0 +1,545 @@
|
|
|
1
|
+
import { IconSize } from '../../atoms/Icon/types';
|
|
2
|
+
import { TextSize, TextWeight } from '../../atoms/Text/types';
|
|
3
|
+
import { DropDownOption } from '../../molecules/DropDown/types';
|
|
4
|
+
import { DataTableFilterMeta } from 'primevue/datatable';
|
|
5
|
+
import { ButtonVariant, ButtonSize } from '../../atoms/Button/types';
|
|
6
|
+
export type ColumnFilterMatchModeOptions = Record<string, string>;
|
|
7
|
+
export declare enum CellFilterType {
|
|
8
|
+
TEXT = "text",
|
|
9
|
+
TAG = "tag",
|
|
10
|
+
DATE = "date",
|
|
11
|
+
DATE_RANGE = "dateRange",
|
|
12
|
+
SELECT = "select",
|
|
13
|
+
EMAIL = "email",
|
|
14
|
+
NUMBER = "number"
|
|
15
|
+
}
|
|
16
|
+
export declare enum CellContentType {
|
|
17
|
+
TEXT_IMAGE = "textImage",
|
|
18
|
+
TAG = "tag",
|
|
19
|
+
PRICE = "price",
|
|
20
|
+
DATE = "date",
|
|
21
|
+
TIME = "time",
|
|
22
|
+
DATE_TIME = "dateTime",
|
|
23
|
+
DATE_RANGE = "dateRange",
|
|
24
|
+
DROPDOWN = "dropdown",
|
|
25
|
+
TOGGLE = "toggle",
|
|
26
|
+
PROGRESS_BAR = "progressBar",
|
|
27
|
+
ACTIONS = "actions",
|
|
28
|
+
CUSTOM = "custom"
|
|
29
|
+
}
|
|
30
|
+
export type CellContent = TextImageContentType | DateContentType | DateRangeContentType | PriceContentType | TagContentType | DropdownContentType | ProgressBarContentType | ActionsContentType | ToggleContentType;
|
|
31
|
+
export interface ColumnType {
|
|
32
|
+
columnKey: string;
|
|
33
|
+
label: string;
|
|
34
|
+
content: CellContent;
|
|
35
|
+
contentType: CellContentType;
|
|
36
|
+
filterType?: CellFilterType;
|
|
37
|
+
field?: string | ((item: string) => string | number | boolean | null | undefined);
|
|
38
|
+
sortField?: string | ((item: string) => string | number | boolean | null | undefined);
|
|
39
|
+
filterField?: string | ((item: string) => string | number | boolean | null | undefined);
|
|
40
|
+
format?: (value: string | number | boolean | null | undefined) => string | number | boolean | null | undefined;
|
|
41
|
+
order?: number;
|
|
42
|
+
/**
|
|
43
|
+
* Désactive le tri pour cette colonne spécifique.
|
|
44
|
+
* Si `undefined`, utilise la valeur globale `sortable` du tableau.
|
|
45
|
+
* Si `false`, désactive le tri même si `sortable` est `true` sur le tableau.
|
|
46
|
+
*/
|
|
47
|
+
sortable?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Masque la ligne de recherche/filtre pour cette colonne (contrôle l'affichage).
|
|
50
|
+
* Si `undefined`, utilise la valeur globale `searchable` du tableau.
|
|
51
|
+
* Si `false`, masque la ligne de recherche même si `searchable` est `true` sur le tableau.
|
|
52
|
+
*/
|
|
53
|
+
searchable?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Désactive le filtrage pour cette colonne (contrôle la fonctionnalité).
|
|
56
|
+
* Si `undefined`, utilise la valeur globale `filterable` du tableau.
|
|
57
|
+
* Si `false`, désactive le filtrage même si `filterable` est `true` sur le tableau.
|
|
58
|
+
*/
|
|
59
|
+
filterable?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Désactive l'édition pour cette colonne.
|
|
62
|
+
* Si `undefined`, utilise la valeur globale `editable` du tableau.
|
|
63
|
+
* Si `false`, désactive l'édition même si `editable` est `true` sur le tableau.
|
|
64
|
+
*/
|
|
65
|
+
editable?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Désactive la réorganisation pour cette colonne.
|
|
68
|
+
* Si `undefined`, utilise la valeur globale `reorderableColumns` du tableau.
|
|
69
|
+
* Si `false`, désactive la réorganisation même si `reorderableColumns` est `true` sur le tableau.
|
|
70
|
+
*/
|
|
71
|
+
reorderableColumn?: boolean;
|
|
72
|
+
filterMatchModeOptions?: ColumnFilterMatchModeOptions[];
|
|
73
|
+
showFilterMatchModes?: boolean;
|
|
74
|
+
showFilterOperator?: boolean;
|
|
75
|
+
showClearButton?: boolean;
|
|
76
|
+
showApplyButton?: boolean;
|
|
77
|
+
excludeGlobalFilter?: boolean;
|
|
78
|
+
/** Largeur minimale de la colonne (ex: '200px') */
|
|
79
|
+
minWidth?: string;
|
|
80
|
+
/** Alignement du contenu dans les cellules */
|
|
81
|
+
align?: 'left' | 'center' | 'right';
|
|
82
|
+
/**
|
|
83
|
+
* Colonne "gelée" (fixe lors du défilement horizontal).
|
|
84
|
+
* ⚠️ **IMPORTANT** : Pour que cette propriété fonctionne, la prop `scrollable` du tableau doit être `true`.
|
|
85
|
+
* @example
|
|
86
|
+
* ```vue
|
|
87
|
+
* <Table :data="data" :columns="columns" scrollable>
|
|
88
|
+
* <!-- Colonnes avec frozen: true -->
|
|
89
|
+
* </Table>
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
frozen?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Alignement de la colonne gelée (gauche ou droite).
|
|
95
|
+
* ⚠️ **IMPORTANT** : Ne s'applique que si `frozen` est `true` et que `scrollable` est `true` sur le tableau.
|
|
96
|
+
* @default 'left'
|
|
97
|
+
*/
|
|
98
|
+
alignFrozen?: 'left' | 'right';
|
|
99
|
+
dataType?: string;
|
|
100
|
+
header?: string;
|
|
101
|
+
footer?: string;
|
|
102
|
+
style?: string | object;
|
|
103
|
+
class?: string | object;
|
|
104
|
+
classes?: string;
|
|
105
|
+
headerStyle?: string | object;
|
|
106
|
+
headerClass?: string | object;
|
|
107
|
+
bodyStyle?: string | object;
|
|
108
|
+
bodyClass?: string | object;
|
|
109
|
+
footerStyle?: string | object;
|
|
110
|
+
footerClass?: string | object;
|
|
111
|
+
filter?: boolean;
|
|
112
|
+
filterMatchMode?: string;
|
|
113
|
+
maxConstraints?: number;
|
|
114
|
+
selectionMode?: 'single' | 'multiple';
|
|
115
|
+
expander?: boolean;
|
|
116
|
+
rowReorder?: boolean;
|
|
117
|
+
rowReorderIcon?: string;
|
|
118
|
+
colspan?: number;
|
|
119
|
+
rowspan?: number;
|
|
120
|
+
exportable?: boolean;
|
|
121
|
+
exportHeader?: string;
|
|
122
|
+
exportFooter?: string;
|
|
123
|
+
hidden?: boolean;
|
|
124
|
+
pt?: Record<string, string | number | boolean | null | undefined>;
|
|
125
|
+
ptOptions?: Record<string, string | number | boolean | null | undefined>;
|
|
126
|
+
unstyled?: boolean;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Type pour représenter une erreur de validation d'un champ
|
|
130
|
+
* Les erreurs sont ajoutées par le backend après validation
|
|
131
|
+
*/
|
|
132
|
+
/**
|
|
133
|
+
* Type pour les valeurs de validation min/max avec support de différents formats
|
|
134
|
+
*/
|
|
135
|
+
export type ValidationValue = number | Date | string | {
|
|
136
|
+
/** Valeur de la validation (peut être un nombre, une date ISO, 'today', ou un nom de champ) */
|
|
137
|
+
value: number | string;
|
|
138
|
+
/** Type de la validation : 'number' | 'date' | 'field' */
|
|
139
|
+
type: 'number' | 'date' | 'field';
|
|
140
|
+
};
|
|
141
|
+
export interface ErrorType {
|
|
142
|
+
/** Nom du champ concerné par l'erreur */
|
|
143
|
+
field: string;
|
|
144
|
+
/** Message d'erreur à afficher */
|
|
145
|
+
message: string;
|
|
146
|
+
/** Code d'erreur optionnel */
|
|
147
|
+
code?: string;
|
|
148
|
+
/** Pattern regex pour valider le format (ex: email, téléphone) */
|
|
149
|
+
pattern?: string;
|
|
150
|
+
/** Longueur minimale (pour les strings) */
|
|
151
|
+
minLength?: number;
|
|
152
|
+
/** Longueur maximale (pour les strings) */
|
|
153
|
+
maxLength?: number;
|
|
154
|
+
/**
|
|
155
|
+
* Valeur minimale (pour les nombres) ou date minimale (pour les dates).
|
|
156
|
+
* Peut être :
|
|
157
|
+
* - Un nombre : `min: 10`
|
|
158
|
+
* - Une Date : `min: new Date('2025-01-01')`
|
|
159
|
+
* - Une string (date ISO) : `min: '2025-01-01'`
|
|
160
|
+
* - Un objet avec value et type : `min: { value: 10, type: 'number' }` ou `min: { value: 'today', type: 'date' }` ou `min: { value: 'startDate', type: 'field' }`
|
|
161
|
+
*/
|
|
162
|
+
min?: ValidationValue;
|
|
163
|
+
/**
|
|
164
|
+
* Valeur maximale (pour les nombres) ou date maximale (pour les dates).
|
|
165
|
+
* Peut être :
|
|
166
|
+
* - Un nombre : `max: 100`
|
|
167
|
+
* - Une Date : `max: new Date()`
|
|
168
|
+
* - Une string (date ISO) : `max: '2025-12-31'`
|
|
169
|
+
* - Un objet avec value et type : `max: { value: 100, type: 'number' }` ou `max: { value: 'today', type: 'date' }` ou `max: { value: 'maxPrice', type: 'field' }`
|
|
170
|
+
*/
|
|
171
|
+
max?: ValidationValue;
|
|
172
|
+
/** Indique si le champ est requis */
|
|
173
|
+
required?: boolean;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Type générique pour les données d'une ligne du tableau.
|
|
177
|
+
* Permet d'avoir un attribut `errors` optionnel pour la validation backend.
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* interface User {
|
|
181
|
+
* id: number
|
|
182
|
+
* name: string
|
|
183
|
+
* email: string
|
|
184
|
+
* profile: { avatar: string }
|
|
185
|
+
* }
|
|
186
|
+
*
|
|
187
|
+
* type UserWithErrors = TableRowData<User>
|
|
188
|
+
* // Résultat: User & { errors?: ErrorType[] }
|
|
189
|
+
*/
|
|
190
|
+
export type TableRowData<T = Record<string, any>> = T & {
|
|
191
|
+
/** Tableau d'erreurs de validation pour cette ligne (ajouté par le backend) */
|
|
192
|
+
errors?: ErrorType[];
|
|
193
|
+
};
|
|
194
|
+
export interface TableProps<T = Record<string, any>> {
|
|
195
|
+
/** Données du tableau. Chaque ligne peut avoir un attribut `errors` pour les erreurs de validation */
|
|
196
|
+
data?: TableRowData<T>[];
|
|
197
|
+
filters?: DataTableFilterMeta;
|
|
198
|
+
filterDisplay?: 'menu' | 'row';
|
|
199
|
+
globalFilterFields?: string[];
|
|
200
|
+
filterLocale?: string;
|
|
201
|
+
/**
|
|
202
|
+
* Autorise le tri sur toutes les colonnes.
|
|
203
|
+
* Peut être surchargé par colonne avec `ColumnType.sortable`.
|
|
204
|
+
* @default true
|
|
205
|
+
*/
|
|
206
|
+
sortable?: boolean;
|
|
207
|
+
/**
|
|
208
|
+
* Affiche la ligne de recherche/filtre (contrôle l'affichage).
|
|
209
|
+
* Peut être surchargé par colonne avec `ColumnType.searchable`.
|
|
210
|
+
* @default true
|
|
211
|
+
*/
|
|
212
|
+
searchable?: boolean;
|
|
213
|
+
/**
|
|
214
|
+
* Autorise le filtrage sur toutes les colonnes (contrôle la fonctionnalité).
|
|
215
|
+
* Peut être surchargé par colonne avec `ColumnType.filterable`.
|
|
216
|
+
* @default true
|
|
217
|
+
*/
|
|
218
|
+
filterable?: boolean;
|
|
219
|
+
/**
|
|
220
|
+
* Autorise le redimensionnement des colonnes par glisser-déposer.
|
|
221
|
+
* @default false
|
|
222
|
+
*/
|
|
223
|
+
resizableColumns?: boolean;
|
|
224
|
+
/**
|
|
225
|
+
* Mode de redimensionnement des colonnes.
|
|
226
|
+
* - `'fit'` : Ajuste les autres colonnes pour maintenir la largeur totale
|
|
227
|
+
* - `'expand'` : Agrandit le tableau pour accommoder la nouvelle largeur
|
|
228
|
+
* @default 'fit'
|
|
229
|
+
*/
|
|
230
|
+
columnResizeMode?: 'fit' | 'expand';
|
|
231
|
+
/**
|
|
232
|
+
* Autorise la réorganisation des colonnes par glisser-déposer.
|
|
233
|
+
* Peut être surchargé par colonne avec `ColumnType.reorderableColumn`.
|
|
234
|
+
* @default true
|
|
235
|
+
*/
|
|
236
|
+
reorderableColumns?: boolean;
|
|
237
|
+
/**
|
|
238
|
+
* si c'est le mode de vérification des données CSV ou non.
|
|
239
|
+
* @default false
|
|
240
|
+
*/
|
|
241
|
+
isCsvDataCheckMode?: boolean;
|
|
242
|
+
size?: 'small' | 'large';
|
|
243
|
+
onSizeChange?: (event: {
|
|
244
|
+
size: number;
|
|
245
|
+
}) => void;
|
|
246
|
+
doSelection?: boolean;
|
|
247
|
+
selectionMode?: 'single' | 'multiple';
|
|
248
|
+
dataKey?: string;
|
|
249
|
+
selection?: TableRowData<T>[] | TableRowData<T> | undefined;
|
|
250
|
+
compareSelectionBy?: 'equals' | 'deepEquals';
|
|
251
|
+
metaKeySelection?: boolean;
|
|
252
|
+
loading?: boolean;
|
|
253
|
+
showPaginator?: boolean;
|
|
254
|
+
rowsPerPageOptions?: number[];
|
|
255
|
+
columns: ColumnType[];
|
|
256
|
+
activatedColumns?: string[];
|
|
257
|
+
rows?: number;
|
|
258
|
+
language?: string;
|
|
259
|
+
totalRecords?: number;
|
|
260
|
+
currentPage?: number;
|
|
261
|
+
totalPages?: number;
|
|
262
|
+
pageSize?: number;
|
|
263
|
+
/**
|
|
264
|
+
* Détermine l'ordre de tri des valeurs nulles.
|
|
265
|
+
* - `1` : Les valeurs nulles sont placées en premier (comportement ASC)
|
|
266
|
+
* - `-1` : Les valeurs nulles sont placées en dernier (comportement DESC)
|
|
267
|
+
* @default undefined (comportement par défaut de PrimeVue)
|
|
268
|
+
* @example
|
|
269
|
+
* ```vue
|
|
270
|
+
* <Table :data="data" :columns="columns" :nullSortOrder="1" />
|
|
271
|
+
* <!-- Les valeurs nulles apparaîtront en premier lors du tri -->
|
|
272
|
+
* ```
|
|
273
|
+
*/
|
|
274
|
+
nullSortOrder?: 1 | -1;
|
|
275
|
+
/**
|
|
276
|
+
* Ordre de tri par défaut lors du premier clic sur une colonne.
|
|
277
|
+
* - `1` : Tri croissant (ASC)
|
|
278
|
+
* - `-1` : Tri décroissant (DESC)
|
|
279
|
+
* @default undefined
|
|
280
|
+
*/
|
|
281
|
+
defaultSortOrder?: 1 | -1;
|
|
282
|
+
multiSortMeta?: unknown[];
|
|
283
|
+
sortMode?: 'single' | 'multiple';
|
|
284
|
+
/**
|
|
285
|
+
* Active la possibilité de retirer le tri d'une colonne (état non-trié).
|
|
286
|
+
* Lorsque activé, un troisième clic sur l'en-tête de colonne retire le tri.
|
|
287
|
+
* @default false
|
|
288
|
+
*/
|
|
289
|
+
removableSort?: boolean;
|
|
290
|
+
rowHover?: boolean;
|
|
291
|
+
csvSeparator?: string;
|
|
292
|
+
exportFilename?: string;
|
|
293
|
+
exportFunction?: (options: {
|
|
294
|
+
data: TableRowData<T>;
|
|
295
|
+
field: string;
|
|
296
|
+
}) => string | number | boolean | null | undefined;
|
|
297
|
+
expandedRows?: object | null;
|
|
298
|
+
expandedRowIcon?: string;
|
|
299
|
+
collapsedRowIcon?: string;
|
|
300
|
+
rowGroupMode?: 'subheader' | 'rowspan';
|
|
301
|
+
groupRowsBy?: string | string[] | ((data: TableRowData<T>) => string | number | boolean | null | undefined);
|
|
302
|
+
expandableRowGroups?: boolean;
|
|
303
|
+
expandedRowGroups?: object;
|
|
304
|
+
stateStorage?: 'session' | 'local';
|
|
305
|
+
stateKey?: string;
|
|
306
|
+
canEdit?: boolean;
|
|
307
|
+
editable?: boolean;
|
|
308
|
+
editMode?: 'cell' | 'row';
|
|
309
|
+
editingRows?: object | undefined;
|
|
310
|
+
rowClass?: (data: TableRowData<T>) => string | object;
|
|
311
|
+
rowStyle?: (data: TableRowData<T>) => object | object[];
|
|
312
|
+
/**
|
|
313
|
+
* Active le défilement vertical/horizontal du tableau.
|
|
314
|
+
* ⚠️ **IMPORTANT** : Cette propriété doit être `true` pour que les colonnes avec `frozen: true` fonctionnent correctement.
|
|
315
|
+
* @default false
|
|
316
|
+
*/
|
|
317
|
+
scrollable?: boolean;
|
|
318
|
+
/** Hauteur de défilement (ex: '400px' ou 'flex') */
|
|
319
|
+
scrollHeight?: string;
|
|
320
|
+
virtualScrollerOptions?: object;
|
|
321
|
+
breakpoint?: string;
|
|
322
|
+
showGridlines?: boolean;
|
|
323
|
+
stripedRows?: boolean;
|
|
324
|
+
highlightOnSelect?: boolean;
|
|
325
|
+
tableStyle?: string | object;
|
|
326
|
+
tableClass?: string | object;
|
|
327
|
+
}
|
|
328
|
+
export interface CellProps {
|
|
329
|
+
/** Données de la ligne, peut contenir un attribut `errors` pour les erreurs de validation */
|
|
330
|
+
data: TableRowData<any>;
|
|
331
|
+
content?: CellContent;
|
|
332
|
+
language?: string;
|
|
333
|
+
columnConfig: ColumnType;
|
|
334
|
+
/** Mode de vérification CSV activé (pour afficher les tooltips d'erreur) */
|
|
335
|
+
isCsvDataCheckMode?: boolean;
|
|
336
|
+
format?: (value: string | number | boolean | null | undefined) => string | number | boolean | null | undefined;
|
|
337
|
+
formatDate?: (value: string | number | boolean | null | undefined) => string | number | boolean | null | undefined;
|
|
338
|
+
formatDateTime?: (value: string) => {
|
|
339
|
+
date: string;
|
|
340
|
+
time: string;
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
export interface CellEditorProps {
|
|
344
|
+
/** Données de la ligne, peut contenir un attribut `errors` pour les erreurs de validation */
|
|
345
|
+
data: TableRowData<any>;
|
|
346
|
+
content?: CellContent;
|
|
347
|
+
language?: string;
|
|
348
|
+
field: string;
|
|
349
|
+
columnConfig: ColumnType;
|
|
350
|
+
/** Erreurs de validation pour ce champ spécifique (filtrées depuis data.errors) */
|
|
351
|
+
fieldErrors?: ErrorType[];
|
|
352
|
+
format?: (value: string | number | boolean | null | undefined) => string | number | boolean | null | undefined;
|
|
353
|
+
formatDate?: (value: string | number | boolean | null | undefined) => string | number | boolean | null | undefined;
|
|
354
|
+
formatDateTime?: (value: string) => {
|
|
355
|
+
date: string;
|
|
356
|
+
time: string;
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
export interface TextImageContentType {
|
|
360
|
+
image?: {
|
|
361
|
+
key: string;
|
|
362
|
+
alt?: string;
|
|
363
|
+
title?: string;
|
|
364
|
+
};
|
|
365
|
+
title: {
|
|
366
|
+
key?: string;
|
|
367
|
+
size?: TextSize;
|
|
368
|
+
weight?: TextWeight;
|
|
369
|
+
color?: string;
|
|
370
|
+
format?: (value: string | number | boolean | null | undefined) => string | number | boolean | null | undefined;
|
|
371
|
+
icon?: {
|
|
372
|
+
key?: string;
|
|
373
|
+
size?: IconSize;
|
|
374
|
+
color?: string;
|
|
375
|
+
strokeWidth?: number;
|
|
376
|
+
position?: 'left' | 'right';
|
|
377
|
+
};
|
|
378
|
+
};
|
|
379
|
+
subtitle?: {
|
|
380
|
+
key?: string;
|
|
381
|
+
size?: TextSize;
|
|
382
|
+
weight?: TextWeight;
|
|
383
|
+
color?: string;
|
|
384
|
+
format?: (value: string | number | boolean | null | undefined) => string | number | boolean | null | undefined;
|
|
385
|
+
icon?: {
|
|
386
|
+
key?: string;
|
|
387
|
+
size?: IconSize;
|
|
388
|
+
color?: string;
|
|
389
|
+
strokeWidth?: number;
|
|
390
|
+
position?: 'left' | 'right';
|
|
391
|
+
};
|
|
392
|
+
};
|
|
393
|
+
supportingText?: {
|
|
394
|
+
key?: string;
|
|
395
|
+
size?: TextSize;
|
|
396
|
+
weight?: TextWeight;
|
|
397
|
+
color?: string;
|
|
398
|
+
format?: (value: string) => string | number | boolean | null | undefined;
|
|
399
|
+
icon?: {
|
|
400
|
+
key?: string;
|
|
401
|
+
size?: IconSize;
|
|
402
|
+
color?: string;
|
|
403
|
+
strokeWidth?: number;
|
|
404
|
+
position?: 'left' | 'right';
|
|
405
|
+
};
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
export interface TagContentType {
|
|
409
|
+
key: string;
|
|
410
|
+
size?: 'extra-small' | 'small' | 'medium' | 'large';
|
|
411
|
+
variant?: 'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'danger';
|
|
412
|
+
ghost?: boolean;
|
|
413
|
+
options?: DropDownOption[];
|
|
414
|
+
format?: (value: string) => string | number | boolean | null | undefined;
|
|
415
|
+
}
|
|
416
|
+
export interface PriceContentType {
|
|
417
|
+
key: string;
|
|
418
|
+
price?: number;
|
|
419
|
+
formattedPrice?: string;
|
|
420
|
+
formattedOldPrice?: string;
|
|
421
|
+
oldPrice?: number;
|
|
422
|
+
currency?: string;
|
|
423
|
+
variantCount?: number;
|
|
424
|
+
isDiscounted?: boolean;
|
|
425
|
+
isSubventioned?: boolean;
|
|
426
|
+
language?: 'fr' | 'en';
|
|
427
|
+
size?: TextSize;
|
|
428
|
+
weight?: TextWeight;
|
|
429
|
+
color?: string;
|
|
430
|
+
}
|
|
431
|
+
export interface DateContentType {
|
|
432
|
+
key: string;
|
|
433
|
+
date?: Date;
|
|
434
|
+
dateTime?: Date;
|
|
435
|
+
size?: TextSize;
|
|
436
|
+
weight?: TextWeight;
|
|
437
|
+
color?: string;
|
|
438
|
+
format?: (value: string) => string | number | boolean | null | undefined;
|
|
439
|
+
formatDate?: (value: string) => string;
|
|
440
|
+
formatTime?: (value: string) => string;
|
|
441
|
+
formatDateTime?: (value: string) => {
|
|
442
|
+
date: string;
|
|
443
|
+
time: string;
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
export interface DateRangeContentType {
|
|
447
|
+
key: string;
|
|
448
|
+
fromKey: string;
|
|
449
|
+
toKey: string;
|
|
450
|
+
fromSize?: TextSize;
|
|
451
|
+
toSize?: TextSize;
|
|
452
|
+
fromWeight?: TextWeight;
|
|
453
|
+
toWeight?: TextWeight;
|
|
454
|
+
fromColor?: string;
|
|
455
|
+
toColor?: string;
|
|
456
|
+
format?: (value: string) => string | number | boolean | null | undefined;
|
|
457
|
+
}
|
|
458
|
+
export interface DropdownContentType {
|
|
459
|
+
key: string;
|
|
460
|
+
options?: DropDownOption[];
|
|
461
|
+
placeholder?: string;
|
|
462
|
+
multiple?: boolean;
|
|
463
|
+
searchable?: boolean;
|
|
464
|
+
clearable?: boolean;
|
|
465
|
+
maxHeight?: string;
|
|
466
|
+
}
|
|
467
|
+
export interface ProgressBarContentType {
|
|
468
|
+
key: string;
|
|
469
|
+
value?: number;
|
|
470
|
+
maxKey?: string;
|
|
471
|
+
unit?: string;
|
|
472
|
+
size?: 'medium' | 'large';
|
|
473
|
+
valueSize?: TextSize;
|
|
474
|
+
valueWeight?: TextWeight;
|
|
475
|
+
labelSize?: TextSize;
|
|
476
|
+
labelWeight?: TextWeight;
|
|
477
|
+
label?: string;
|
|
478
|
+
hideValue?: boolean;
|
|
479
|
+
hideMax?: boolean;
|
|
480
|
+
showPercentage?: boolean;
|
|
481
|
+
loading?: boolean;
|
|
482
|
+
}
|
|
483
|
+
export interface ActionsContentType {
|
|
484
|
+
key: string;
|
|
485
|
+
actions?: ActionContentType[];
|
|
486
|
+
}
|
|
487
|
+
export interface ActionContentType {
|
|
488
|
+
key: string;
|
|
489
|
+
icon?: string;
|
|
490
|
+
color?: string;
|
|
491
|
+
size?: ButtonSize;
|
|
492
|
+
variant?: ButtonVariant;
|
|
493
|
+
disabled?: boolean;
|
|
494
|
+
loading?: boolean;
|
|
495
|
+
actionName?: string;
|
|
496
|
+
}
|
|
497
|
+
export interface ToggleContentType {
|
|
498
|
+
key: string;
|
|
499
|
+
modelValue?: boolean;
|
|
500
|
+
label?: string;
|
|
501
|
+
disabled?: boolean;
|
|
502
|
+
size?: 'small' | 'medium' | 'large';
|
|
503
|
+
options?: DropDownOption[];
|
|
504
|
+
}
|
|
505
|
+
export type MatchMode = 'contains' | 'equals' | 'notEquals' | 'startsWith' | 'endsWith' | 'contains' | 'notContains' | 'between' | 'notBetween' | 'in' | 'notIn' | 'any' | 'none' | 'all' | 'not';
|
|
506
|
+
/**
|
|
507
|
+
* Type pour représenter un tri (single ou multi-sort)
|
|
508
|
+
*/
|
|
509
|
+
export interface SortConfig {
|
|
510
|
+
field: string;
|
|
511
|
+
order: 1 | -1;
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* Type pour représenter un filtre actif (uniquement les colonnes avec un filtrage non vide)
|
|
515
|
+
*/
|
|
516
|
+
export interface ActiveFilter {
|
|
517
|
+
columnKey: string;
|
|
518
|
+
value: string | boolean | number | Date[] | Date | null | undefined;
|
|
519
|
+
matchMode: MatchMode;
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Type pour représenter l'ordre des colonnes
|
|
523
|
+
*/
|
|
524
|
+
export interface ColumnOrder {
|
|
525
|
+
columnKey: string;
|
|
526
|
+
order: number;
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Objet TableRequestData qui englobe tous les états du tableau gérés par le composant
|
|
530
|
+
* pour préparer l'envoi d'un appel API ou l'export CSV.
|
|
531
|
+
*
|
|
532
|
+
* Note: activatedColumns et filters.global sont gérés à l'extérieur du composant
|
|
533
|
+
* et doivent être combinés avec cet objet pour obtenir le RequestData complet.
|
|
534
|
+
*/
|
|
535
|
+
export interface TableRequestData {
|
|
536
|
+
columnOrder: ColumnOrder[];
|
|
537
|
+
pagination: {
|
|
538
|
+
currentPage: number;
|
|
539
|
+
pageSize: number;
|
|
540
|
+
};
|
|
541
|
+
sort: SortConfig[];
|
|
542
|
+
filters: {
|
|
543
|
+
columns: ActiveFilter[];
|
|
544
|
+
};
|
|
545
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ErrorType } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Vérifie si une erreur est toujours valide en fonction de la valeur actuelle du champ.
|
|
4
|
+
* Cette fonction est utilisée pour déterminer si une erreur de validation doit encore être affichée
|
|
5
|
+
* après que l'utilisateur ait modifié la valeur du champ.
|
|
6
|
+
*
|
|
7
|
+
* @param error - L'erreur à vérifier
|
|
8
|
+
* @param currentValue - La valeur actuelle du champ
|
|
9
|
+
* @param rowData - Les données complètes de la ligne (optionnel, nécessaire pour les références à d'autres champs)
|
|
10
|
+
* @returns true si l'erreur est toujours valide (la valeur ne respecte toujours pas la règle), false sinon
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* // Erreur de pattern email
|
|
15
|
+
* isErrorStillValid(
|
|
16
|
+
* { field: 'email', message: 'Email invalide', pattern: '^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$' },
|
|
17
|
+
* 'invalid-email' // → true (l'erreur est toujours valide)
|
|
18
|
+
* )
|
|
19
|
+
*
|
|
20
|
+
* // Erreur de date minimum
|
|
21
|
+
* isErrorStillValid(
|
|
22
|
+
* { field: 'createdAt', message: 'Date doit être au passé', min: new Date('2025-01-01') },
|
|
23
|
+
* '2024-12-31' // → true (l'erreur est toujours valide)
|
|
24
|
+
* )
|
|
25
|
+
*
|
|
26
|
+
* // Erreur avec référence à un autre champ
|
|
27
|
+
* isErrorStillValid(
|
|
28
|
+
* { field: 'endDate', message: 'Date de fin doit être après date de début', min: { value: 'startDate', type: 'field' } },
|
|
29
|
+
* '2025-01-01',
|
|
30
|
+
* { startDate: '2025-01-15', endDate: '2025-01-01' } // → true (endDate < startDate)
|
|
31
|
+
* )
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare function isErrorStillValid(error: ErrorType, currentValue: any, rowData?: any): boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ColumnType, ErrorType, TableRowData } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Récupère toutes les erreurs pertinentes pour une colonne donnée.
|
|
4
|
+
* Pour les colonnes composites (DATE_RANGE, PROGRESS_BAR), inclut les erreurs des champs sous-jacents.
|
|
5
|
+
*
|
|
6
|
+
* @param data - Les données de la ligne
|
|
7
|
+
* @param column - La configuration de la colonne
|
|
8
|
+
* @returns Liste des erreurs valides pour cette colonne
|
|
9
|
+
*/
|
|
10
|
+
export declare function getColumnErrors(data: TableRowData<any>, column: ColumnType): ErrorType[];
|
|
@@ -2,12 +2,13 @@ export { BalanceCard } from './BalanceCard';
|
|
|
2
2
|
export type { BalanceCardProps } from './BalanceCard';
|
|
3
3
|
export { BalanceCardGroup } from './BalanceCardGroup';
|
|
4
4
|
export type { BalanceCardData, BalanceCardGroupProps } from './BalanceCardGroup';
|
|
5
|
-
export { DataTable } from './DataTable';
|
|
6
5
|
export { Breadcrumbs } from './Breadcrumbs';
|
|
7
6
|
export { ProductCard } from './ProductCard';
|
|
8
7
|
export { FilterPrice } from './FilterPrice';
|
|
9
8
|
export { PageNavigation } from './PageNavigation';
|
|
9
|
+
export { Table } from './Table';
|
|
10
|
+
export type { TableProps, ColumnType, CellEditorProps, CellProps, CellContentType, CellFilterType, TableRequestData, SortConfig, ActiveFilter, ColumnOrder, MatchMode, ErrorType, TableRowData, TextImageContentType, TagContentType, PriceContentType, DateContentType, DateRangeContentType, DropdownContentType, ProgressBarContentType, ActionsContentType, ActionContentType, ToggleContentType } from './Table';
|
|
10
11
|
export { DropFile } from './DropFile';
|
|
11
|
-
export type { DropFileProps, DropFileVariant,
|
|
12
|
+
export type { DropFileProps, DropFileVariant, DropFileErrorCode, DropFileFileData, DropFileDropEvent, DropFileErrorEvent } from './DropFile';
|
|
12
13
|
export { FilterGroup } from './FilterGroup';
|
|
13
14
|
export type { FilterGroupProps, Filter, Sort } from './FilterGroup/types';
|
|
@@ -4,3 +4,11 @@ export { useScrollShadows, type UseScrollShadowsOptions, type UseScrollShadowsRe
|
|
|
4
4
|
export { useTheme, type BrandTheme, type ThemeMode } from './useTheme';
|
|
5
5
|
export { useBreakpoints } from './useBreakpoints';
|
|
6
6
|
export { useCurrency } from './useCurrency';
|
|
7
|
+
export { useTableTranslations, type TableLanguage } from './useTableTranslations';
|
|
8
|
+
export { useTableSelection, type SelectionMode, type UseTableSelectionOptions, type UseTableSelectionReturn } from './useTableSelection';
|
|
9
|
+
export { useTablePagination, type UseTablePaginationOptions, type UseTablePaginationReturn } from './useTablePagination';
|
|
10
|
+
export { useTableSort, type UseTableSortReturn } from './useTableSort';
|
|
11
|
+
export { useTableColumns, type UseTableColumnsReturn } from './useTableColumns';
|
|
12
|
+
export { useTableFilters, type UseTableFiltersReturn } from './useTableFilters';
|
|
13
|
+
export { useTableRequestData, type UseTableRequestDataOptions, type UseTableRequestDataReturn } from './useTableRequestData';
|
|
14
|
+
export { useDateFormatters, type DateFormatters } from './useDateFormatters';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ComputedRef } from 'vue';
|
|
2
|
+
import { DateContentType } from '../components/organisms/Table/types';
|
|
3
|
+
export interface DateFormatters {
|
|
4
|
+
data: (val: string) => string | number | boolean | null | undefined;
|
|
5
|
+
date: (val: string) => string;
|
|
6
|
+
time: (val: string) => string;
|
|
7
|
+
dateTime: (val: string) => {
|
|
8
|
+
date: string;
|
|
9
|
+
time: string;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export declare function useDateFormatters(dateConfig: ComputedRef<DateContentType | undefined>): DateFormatters;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Ref, ComputedRef } from 'vue';
|
|
2
|
+
import { ColumnType } from '../components/organisms/Table/types';
|
|
3
|
+
export interface UseTableColumnsReturn {
|
|
4
|
+
localColumns: Ref<ColumnType[]>;
|
|
5
|
+
handleColumnReorder: (event: any) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function useTableColumns(columns: ColumnType[] | ComputedRef<ColumnType[]>, emit: (value: any) => void): UseTableColumnsReturn;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { ColumnFilterMatchModeOptions } from 'primevue/column';
|
|
3
|
+
import { ColumnType } from '../components/organisms/Table/types';
|
|
4
|
+
export interface UseTableFiltersReturn {
|
|
5
|
+
allFilters: Ref<Record<string, any>>;
|
|
6
|
+
doUpdateFilter: (filter: Record<string, any>) => void;
|
|
7
|
+
getFilterOptions: (col: ColumnType) => ColumnFilterMatchModeOptions[];
|
|
8
|
+
}
|
|
9
|
+
export declare function useTableFilters(initialFilters: Record<string, any>, emit: (value: Record<string, any>) => void, translations: {
|
|
10
|
+
filter: Record<string, string>;
|
|
11
|
+
}): UseTableFiltersReturn;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Ref, ComputedRef } from 'vue';
|
|
2
|
+
export interface UseTablePaginationOptions {
|
|
3
|
+
currentPage?: number;
|
|
4
|
+
pageSize?: number;
|
|
5
|
+
totalRecords: number;
|
|
6
|
+
totalPages?: number;
|
|
7
|
+
dataLength: number;
|
|
8
|
+
}
|
|
9
|
+
export interface UseTablePaginationReturn {
|
|
10
|
+
internalCurrentPage: Ref<number>;
|
|
11
|
+
internalPageSize: Ref<number>;
|
|
12
|
+
handlePageChange: (page: number) => void;
|
|
13
|
+
handlePageSizeChange: (size: number) => void;
|
|
14
|
+
footerDetails: ComputedRef<string>;
|
|
15
|
+
}
|
|
16
|
+
export declare function useTablePagination(options: UseTablePaginationOptions, emitPageChange: (value: number) => void, emitPageSizeChange: (value: number) => void, translations: ComputedRef<{
|
|
17
|
+
to: string;
|
|
18
|
+
elements: string;
|
|
19
|
+
}>): UseTablePaginationReturn;
|