@oneteme/jquery-table 0.0.1
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 +200 -0
- package/esm2022/lib/component/slice-panel/slice-panel.component.mjs +433 -0
- package/esm2022/lib/component/slice-panel/slice-panel.model.mjs +2 -0
- package/esm2022/lib/component/table.component.mjs +1092 -0
- package/esm2022/lib/component/table.utils.mjs +59 -0
- package/esm2022/lib/directive/jqt-cell-def.directive.mjs +35 -0
- package/esm2022/lib/jquery-table.model.mjs +2 -0
- package/esm2022/oneteme-jquery-table.mjs +5 -0
- package/esm2022/public-api.mjs +9 -0
- package/fesm2022/oneteme-jquery-table.mjs +1618 -0
- package/fesm2022/oneteme-jquery-table.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/component/slice-panel/slice-panel.component.d.ts +72 -0
- package/lib/component/slice-panel/slice-panel.model.d.ts +59 -0
- package/lib/component/table.component.d.ts +199 -0
- package/lib/component/table.utils.d.ts +17 -0
- package/lib/directive/jqt-cell-def.directive.d.ts +29 -0
- package/lib/jquery-table.model.d.ts +72 -0
- package/package.json +35 -0
- package/public-api.d.ts +5 -0
package/README.md
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# jQuery-Table
|
|
2
|
+
|
|
3
|
+
Bibliothèque Angular qui encapsule Angular Material Table avec une API orientée configuration runtime.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Colonnes dynamiques (ajout/retrait à l'exécution)
|
|
8
|
+
- Liste de colonnes optionnelles ajoutables via bouton `+`
|
|
9
|
+
- Slice catégories à gauche (ex: status)
|
|
10
|
+
- Filtrage temps réel selon la catégorie sélectionnée
|
|
11
|
+
- Settings par colonne (⋯): filter by values + actions custom
|
|
12
|
+
- Actions utilitaires custom par colonne (événements)
|
|
13
|
+
- Intégration avec `@oneteme/jquery-core` (`field`, `DataProvider`)
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @oneteme/jquery-core @oneteme/jquery-table @angular/material @angular/cdk
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Utilisation rapide
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { Component } from '@angular/core';
|
|
25
|
+
import { TableComponent, TableProvider, col } from '@oneteme/jquery-table';
|
|
26
|
+
|
|
27
|
+
interface Row {
|
|
28
|
+
issue: string;
|
|
29
|
+
status: 'Backlog' | 'In Progress' | 'Done';
|
|
30
|
+
owner: string;
|
|
31
|
+
priority: 'Low' | 'Medium' | 'High';
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@Component({
|
|
35
|
+
standalone: true,
|
|
36
|
+
imports: [TableComponent],
|
|
37
|
+
template: `
|
|
38
|
+
<jquery-table
|
|
39
|
+
[config]="tableConfig"
|
|
40
|
+
(columnAdded)="onColumnAdded($event)"
|
|
41
|
+
(columnRemoved)="onColumnRemoved($event)"
|
|
42
|
+
(categorySelected)="onCategorySelected($event)"
|
|
43
|
+
></jquery-table>
|
|
44
|
+
`,
|
|
45
|
+
})
|
|
46
|
+
export class DemoComponent {
|
|
47
|
+
tableConfig: TableProvider<Row> = {
|
|
48
|
+
title: 'Ticket board',
|
|
49
|
+
showAddColumnButton: true,
|
|
50
|
+
enableColumnRemoval: true,
|
|
51
|
+
columns: [col<Row>('issue', 'Issue'), col<Row>('status', 'Status')],
|
|
52
|
+
availableColumns: [col<Row>('owner', 'Owner'), col<Row>('priority', 'Priority')],
|
|
53
|
+
categorySlice: {
|
|
54
|
+
title: 'Status',
|
|
55
|
+
allLabel: 'Tous',
|
|
56
|
+
categories: [
|
|
57
|
+
{ key: 'backlog', label: 'Backlog', filter: (row) => row.status === 'Backlog' },
|
|
58
|
+
{ key: 'in-progress', label: 'In Progress', filter: (row) => row.status === 'In Progress' },
|
|
59
|
+
{ key: 'done', label: 'Done', filter: (row) => row.status === 'Done' },
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
data: [
|
|
63
|
+
{ issue: 'Fix auth', status: 'In Progress', owner: 'Anna', priority: 'High' },
|
|
64
|
+
{ issue: 'Improve docs', status: 'Backlog', owner: 'Leo', priority: 'Low' },
|
|
65
|
+
],
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
onColumnAdded() {}
|
|
69
|
+
onColumnRemoved() {}
|
|
70
|
+
onCategorySelected() {}
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Migration minimale depuis Angular Material Table
|
|
75
|
+
|
|
76
|
+
Si votre composant utilise déjà `dataSource` et `displayedColumns`, vous pouvez migrer avec très peu de changements:
|
|
77
|
+
|
|
78
|
+
```html
|
|
79
|
+
<!-- Avant -->
|
|
80
|
+
<!-- <table mat-table [dataSource]="dataSource"> ... -->
|
|
81
|
+
|
|
82
|
+
<!-- Après -->
|
|
83
|
+
<jquery-table
|
|
84
|
+
[dataSource]="dataSource"
|
|
85
|
+
[displayedColumns]="displayedColumns"
|
|
86
|
+
[columnLabels]="columnLabels"
|
|
87
|
+
></jquery-table>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
```ts
|
|
91
|
+
displayedColumns = ['issue', 'status', 'owner'];
|
|
92
|
+
|
|
93
|
+
columnLabels = {
|
|
94
|
+
issue: 'Issue',
|
|
95
|
+
status: 'Status',
|
|
96
|
+
owner: 'Owner',
|
|
97
|
+
};
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Le `config` complet reste disponible pour activer les fonctionnalités avancées (slice catégories, ajout/retrait de colonnes, menu d’options).
|
|
101
|
+
|
|
102
|
+
## API
|
|
103
|
+
|
|
104
|
+
### Inputs
|
|
105
|
+
|
|
106
|
+
- `dataSource`: alias compatible Material (`T[]` ou `{ data: T[] }`)
|
|
107
|
+
- `displayedColumns`: alias compatible Material (`string[]`)
|
|
108
|
+
- `columnLabels`: labels optionnels pour `displayedColumns`
|
|
109
|
+
- `config.showColumnSettings`: active les menus `⋯` en header de colonne
|
|
110
|
+
- `config.maxFilterValuesPerColumn`: limite le nombre de valeurs proposées dans `Filter by values`
|
|
111
|
+
- `config.columnUtilityActions`: actions custom globales par colonne
|
|
112
|
+
- `config.columns`: colonnes initiales visibles
|
|
113
|
+
- `config.optionalColumns` (ou `config.availableColumns`): colonnes optionnelles ajoutables via `+`
|
|
114
|
+
- `config.showAddColumnButton`: active/désactive le bouton `+`
|
|
115
|
+
- `config.showOptionsButton`: active/désactive le bouton `Options`
|
|
116
|
+
- `config.bottomActionsLabel`: libellé des actions dockées en bas-gauche
|
|
117
|
+
- `config.enableColumnRemoval`: autorise la suppression des colonnes
|
|
118
|
+
- `config.categorySlice`: configuration du panel de catégories à gauche
|
|
119
|
+
- `config.data`: dataset source
|
|
120
|
+
|
|
121
|
+
### Smart adaptation (intelligence data-driven)
|
|
122
|
+
Le wrapper est volontairement simple: pas de système d'inférence automatique complexe.
|
|
123
|
+
Le développeur fournit explicitement les colonnes de base, les colonnes optionnelles et les filtres.
|
|
124
|
+
|
|
125
|
+
### Outputs
|
|
126
|
+
|
|
127
|
+
- `columnAdded`: émis après ajout effectif d'une colonne
|
|
128
|
+
- `columnRemoved`: émis après suppression effective d'une colonne
|
|
129
|
+
- `categorySelected`: émis au changement de catégorie
|
|
130
|
+
- `columnSettingSelected`: émis au clic sur une action de menu colonne (built-in ou custom)
|
|
131
|
+
- `optionSelected`: émis depuis le menu d'options
|
|
132
|
+
|
|
133
|
+
### Exemple settings colonne
|
|
134
|
+
|
|
135
|
+
```ts
|
|
136
|
+
tableConfig = {
|
|
137
|
+
showColumnSettings: true,
|
|
138
|
+
maxFilterValuesPerColumn: 12,
|
|
139
|
+
columnUtilityActions: [
|
|
140
|
+
{ action: 'utility:copyColumnKey', label: 'Copy column key' },
|
|
141
|
+
],
|
|
142
|
+
};
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Personnalisation visuelle (CSS variables)
|
|
146
|
+
|
|
147
|
+
Toutes les couleurs principales sont exposées via des CSS custom properties sur `:host`.
|
|
148
|
+
Pour les surcharger, ciblez `jquery-table` dans votre feuille de styles globale :
|
|
149
|
+
|
|
150
|
+
```scss
|
|
151
|
+
jquery-table {
|
|
152
|
+
/* Texte */
|
|
153
|
+
--jqt-title-color: #1f2937; /* titre du tableau (h3) */
|
|
154
|
+
--jqt-text-color: #111827; /* texte principal (cellules, labels) */
|
|
155
|
+
--jqt-text-secondary: #6b7280; /* texte secondaire (badges, infos) */
|
|
156
|
+
--jqt-text-muted: #9ca3af; /* placeholder, icônes discrètes */
|
|
157
|
+
|
|
158
|
+
/* Surfaces */
|
|
159
|
+
--jqt-surface-color: #ffffff; /* fond des éléments (barre de recherche…) */
|
|
160
|
+
--jqt-surface-alt-color: #f9fafb; /* fond alternatif subtil */
|
|
161
|
+
--jqt-row-hover-bg: #f3f4f6; /* survol d'une ligne / fond badge */
|
|
162
|
+
|
|
163
|
+
/* Bordures */
|
|
164
|
+
--jqt-border-color: #e5e7eb; /* bordures du tableau et éléments UI */
|
|
165
|
+
|
|
166
|
+
/* Groupes (groupBy) */
|
|
167
|
+
--jqt-group-bg: #eef2f7; /* fond des lignes de groupe */
|
|
168
|
+
--jqt-group-bg-hover: #e4ecf4; /* fond au survol d'une ligne de groupe */
|
|
169
|
+
--jqt-group-accent: #94a3b8; /* bande colorée gauche des groupes */
|
|
170
|
+
--jqt-group-border: #d1d9e4; /* bordures haut/bas des groupes */
|
|
171
|
+
|
|
172
|
+
/* Accent & danger */
|
|
173
|
+
--jqt-primary-color: #1d4ed8; /* couleur d'accent (focus, sélection) */
|
|
174
|
+
--jqt-danger-color: #dc2626; /* bouton reset (survol) */
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**Exemple** — thème violet :
|
|
179
|
+
|
|
180
|
+
```scss
|
|
181
|
+
jquery-table {
|
|
182
|
+
--jqt-primary-color: #7c3aed;
|
|
183
|
+
--jqt-group-accent: #7c3aed;
|
|
184
|
+
--jqt-group-bg: #f5f3ff;
|
|
185
|
+
--jqt-group-border: #ddd6fe;
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Build
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
ng build @oneteme/jquery-table
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Publishing
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
cd dist/oneteme/jquery-table
|
|
199
|
+
npm publish
|
|
200
|
+
```
|