@competer/primeng-table 0.0.0-stage → 19.1.9
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 +190 -3
- package/fesm2022/competer-primeng-table.mjs +2579 -0
- package/fesm2022/competer-primeng-table.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/components/column-selector/column-selector.d.ts +53 -0
- package/lib/components/ecs-primeng-table/ecs-primeng-table.d.ts +205 -0
- package/lib/components/ecs-primeng-table/ecs-primeng-table.service.d.ts +51 -0
- package/lib/components/export-excel/export-excel.d.ts +49 -0
- package/lib/components/export-excel/export-excel.service.d.ts +6 -0
- package/lib/components/table-button/table-button.d.ts +16 -0
- package/lib/components/table-cell/table-cell.d.ts +67 -0
- package/lib/components/table-predefined-filters/table-predefined-filters.d.ts +39 -0
- package/lib/components/views-management/views-management.d.ts +34 -0
- package/lib/enums/cell-display.enum.d.ts +5 -0
- package/lib/enums/cell-overflow-behaviour.enum.d.ts +12 -0
- package/lib/enums/data-align-horizontal.enum.d.ts +14 -0
- package/lib/enums/data-align-vertical.enum.d.ts +14 -0
- package/lib/enums/data-type.enum.enum.d.ts +19 -0
- package/lib/enums/device-type.enum.d.ts +6 -0
- package/lib/enums/frozen-column-align.enum.d.ts +15 -0
- package/lib/enums/index.d.ts +8 -0
- package/lib/enums/table-view-save-mode.enum.d.ts +17 -0
- package/lib/interfaces/columns-metadata.interface.d.ts +66 -0
- package/lib/interfaces/excel-export-request.interface.d.ts +20 -0
- package/lib/interfaces/index.d.ts +10 -0
- package/lib/interfaces/predefined-filter.interface.d.ts +101 -0
- package/lib/interfaces/table-button.interface.d.ts +75 -0
- package/lib/interfaces/table-configuration.interface.d.ts +23 -0
- package/lib/interfaces/table-options.interface.d.ts +591 -0
- package/lib/interfaces/table-paged-response.interface.d.ts +16 -0
- package/lib/interfaces/table-query-request.interface.d.ts +28 -0
- package/lib/interfaces/table-view-data.interface.d.ts +26 -0
- package/lib/interfaces/table-view.interface.d.ts +15 -0
- package/lib/pipes/ui-translate.pipe.d.ts +13 -0
- package/lib/services/http.service.d.ts +34 -0
- package/lib/services/i18n.service.d.ts +18 -0
- package/lib/services/index.d.ts +4 -0
- package/lib/services/notification.service.d.ts +23 -0
- package/lib/services/table-state.service.d.ts +28 -0
- package/lib/utils/create-table-options.d.ts +5 -0
- package/lib/utils/data-align-horizontal-as-text.d.ts +11 -0
- package/lib/utils/data-align-vertical-as-text.d.ts +11 -0
- package/lib/utils/data-type-as-text.d.ts +11 -0
- package/lib/utils/frozen-column-align-as-text.d.ts +11 -0
- package/lib/utils/highlight-text.d.ts +17 -0
- package/lib/utils/index.d.ts +6 -0
- package/package.json +48 -3
- package/public-api.d.ts +9 -0
package/README.md
CHANGED
|
@@ -1,3 +1,190 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# Group Headers
|
|
2
|
+
|
|
3
|
+
Set `HeaderGroup` on backend column attributes:
|
|
4
|
+
|
|
5
|
+
```csharp
|
|
6
|
+
[ColumnAttributes("Name", HeaderGroup = "Group1")]
|
|
7
|
+
public string Name { get; set; } = "";
|
|
8
|
+
|
|
9
|
+
[ColumnAttributes("Age", dataType: DataType.Numeric, HeaderGroup = "Group1")]
|
|
10
|
+
public int Age { get; set; }
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Consecutive visible columns sharing `headerGroup` receive a centered spanning header. Reordering or hiding columns recalculates the runs, repeating the label when a group is split. Ungrouped columns leave a blank space; no extra row is rendered when no visible column has a group. Frozen alignment boundaries split runs to preserve scrolling alignment. Labels support translation keys just like `header`.
|
|
14
|
+
|
|
15
|
+
Use `ColumnMetadataOverrideModel.HeaderGroup` for dynamic overrides; an empty string removes a group. The `/progress` example groups the first three columns under `Grupo1` and the last two under `Grupo2`.
|
|
16
|
+
|
|
17
|
+
# ECS PrimeNG table
|
|
18
|
+
|
|
19
|
+
This NPM package contains ECS PrimeNG table.
|
|
20
|
+
For full documentation, usage instructions, examples, and updates, please visit the official GitHub repository:
|
|
21
|
+
[https://github.com/competergiga/ECSPrimengTable/tree/Angular19-publish](https://github.com/competergiga/ECSPrimengTable/tree/Angular19-publish)
|
|
22
|
+
|
|
23
|
+
> **Note:** Make sure to check the GitHub README for detailed guidance on how to integrate and use this component in your projects.
|
|
24
|
+
## Column header translations (Angular 19)
|
|
25
|
+
|
|
26
|
+
Install `@ngx-translate/core@^17` in the consuming application and configure
|
|
27
|
+
`provideTranslateService` once in its application providers. If your application
|
|
28
|
+
already uses ngx-translate, reuse its existing provider and dictionaries.
|
|
29
|
+
|
|
30
|
+
The table and column selector render `header | translate`. The selector searches
|
|
31
|
+
and sorts the translated labels and updates when the language changes. No metadata
|
|
32
|
+
is overwritten: `field`, cell values, filters, saved views and server-side Excel
|
|
33
|
+
exports keep their existing behavior. Other grid UI labels also support translation.
|
|
34
|
+
|
|
35
|
+
The consuming application loads its dictionaries from JSON files. The demo uses
|
|
36
|
+
`src/assets/i18n/es.json`, `en.json`, `fr.json` and `it.json`, copied to `assets/i18n/`
|
|
37
|
+
by the existing Angular assets configuration. Keys match the existing backend
|
|
38
|
+
headers, so no backend changes are required.
|
|
39
|
+
|
|
40
|
+
For example, `es.json` contains:
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
{
|
|
44
|
+
"Username": "Usuario",
|
|
45
|
+
"Age": "Edad"
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Install the loader in the application (the table library only needs core):
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
npm install @ngx-translate/core@^17 @ngx-translate/http-loader@^17
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Configure it once in `app.config.ts`, alongside the existing `provideHttpClient()`:
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
import { provideTranslateService } from '@ngx-translate/core';
|
|
59
|
+
import { provideTranslateHttpLoader } from '@ngx-translate/http-loader';
|
|
60
|
+
|
|
61
|
+
provideTranslateService({
|
|
62
|
+
lang: 'es',
|
|
63
|
+
fallbackLang: 'en',
|
|
64
|
+
loader: provideTranslateHttpLoader({
|
|
65
|
+
prefix: './assets/i18n/',
|
|
66
|
+
suffix: '.json'
|
|
67
|
+
})
|
|
68
|
+
})
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
If the application already uses ngx-translate, reuse its provider and add the
|
|
72
|
+
header keys to its existing JSON dictionaries instead of configuring another loader.
|
|
73
|
+
|
|
74
|
+
Call `TranslateService.use('en')`, `use('es')`, `use('fr')` or `use('it')` to switch languages without fetching
|
|
75
|
+
the table configuration again. Missing translations use the fallback language,
|
|
76
|
+
then the original key with ngx-translate's default missing-translation handler.
|
|
77
|
+
|
|
78
|
+
Alternatively, return `header: 'columns.username'` from the backend and define
|
|
79
|
+
`{ "columns": { "username": "Usuario" } }` in the Spanish JSON file.
|
|
80
|
+
|
|
81
|
+
For the complete integration guide, see [Multilanguage column headers](https://github.com/competergiga/ECSPrimengTable/blob/Angular19-publish/README.md#324-multilanguage-column-headers-angular-19).
|
|
82
|
+
|
|
83
|
+
## Optional navigation state
|
|
84
|
+
|
|
85
|
+
Set `statePersistence: { enabled: true, key: "people-list" }` in `createTableOptions` to preserve filters, global search, sorting and pagination when returning from a detail page. It is disabled by default. Provide `ECSPrimengTableStateService` on the parent component containing both list and detail routes. Leaving that component clears its in-memory state. Do not provide it at application root or on the list itself.
|
|
86
|
+
|
|
87
|
+
See the [scope setup and navigation examples](https://github.com/competergiga/ECSPrimengTable/blob/Angular19-publish/README.md#419-optional-state-when-returning-from-a-detail-page).
|
|
88
|
+
|
|
89
|
+
### Enable or disable
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
tableOptions = createTableOptions({
|
|
93
|
+
statePersistence: {
|
|
94
|
+
enabled: true, // Set false or omit this option to disable.
|
|
95
|
+
key: 'people-list'
|
|
96
|
+
}
|
|
97
|
+
// Add your existing endpoints and other table options.
|
|
98
|
+
});
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Register `providers: [ECSPrimengTableStateService]` on a parent component with a
|
|
102
|
+
`<router-outlet />` and put both list and detail routes under it. Use Angular
|
|
103
|
+
Router navigation between them. An enabled table requires a non-empty key and
|
|
104
|
+
this scope provider.
|
|
105
|
+
|
|
106
|
+
Returning from a detail restores the query and fetches fresh rows. Leaving the
|
|
107
|
+
scope for another section discards that query, as does a browser reload. Setting
|
|
108
|
+
`enabled` to false does not clear filters currently on screen; it prevents their
|
|
109
|
+
preservation for the next navigation. Explicitly saved startup views remain
|
|
110
|
+
independent of this option.
|
|
111
|
+
|
|
112
|
+
The `/home` demo includes a checkbox for enabled/disabled behavior, a row edit
|
|
113
|
+
button opening a navigation-only detail and an **Ir a otra sección** link to
|
|
114
|
+
leave the scope. Run `npm run test:state` from the frontend workspace for the
|
|
115
|
+
automated tests.
|
|
116
|
+
|
|
117
|
+
## Responsive options
|
|
118
|
+
|
|
119
|
+
Header and row menus are optional and disabled by default. Enable `responsive.headerMenu` and `responsive.rowMenu`. The optional DTO attribute `VisibleOnlyIn` sets initial visibility by viewport while keeping columns available in the selector.
|
|
120
|
+
|
|
121
|
+
See [configuration, precedence and examples](https://github.com/competergiga/ECSPrimengTable/blob/Angular19-publish/README.md#10-responsive-menus-and-initial-column-visibility).
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
### Translating all grid interface text
|
|
125
|
+
|
|
126
|
+
Use the same ngx-translate JSON dictionaries for headers, buttons, tooltips, descriptions, menus, dialogs, validation messages and counters. Built-in texts use their original English string as the key; configurable button labels/tooltips and descriptions may also use your own translation keys. Changing `TranslateService.use('fr')` updates the UI, including open menus and dialogs.
|
|
127
|
+
|
|
128
|
+
Example entries in `assets/i18n/es.json`:
|
|
129
|
+
|
|
130
|
+
```json
|
|
131
|
+
{
|
|
132
|
+
"Actions": "Acciones",
|
|
133
|
+
"Selected": "Seleccionado",
|
|
134
|
+
"CREATE": "CREAR",
|
|
135
|
+
"--- Select a view ---": "--- Selecciona una vista ---",
|
|
136
|
+
"MODIFY COLUMNS": "MODIFICAR COLUMNAS",
|
|
137
|
+
"Search keyword": "Buscar",
|
|
138
|
+
"Cancel changes": "Cancelar cambios",
|
|
139
|
+
"Save changes": "Guardar cambios",
|
|
140
|
+
"Showing {{count}} records of {{total}} available records": "Mostrando {{count}} registros de {{total}} disponibles",
|
|
141
|
+
"primeng": {
|
|
142
|
+
"startsWith": "Empieza por",
|
|
143
|
+
"contains": "Contiene",
|
|
144
|
+
"clear": "Limpiar",
|
|
145
|
+
"apply": "Aplicar",
|
|
146
|
+
"aria": { "nextPageLabel": "Página siguiente" }
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Keep interpolation names such as `{{count}}` and `{{total}}` unchanged. Missing UI translations fall back to the configured fallback language, then to the original text. Existing applications do not need to add every key at once.
|
|
152
|
+
|
|
153
|
+
The optional `primeng` section translates PrimeNG controls (filter operators, calendars, pagination and accessibility labels). The grid synchronizes this section with the **shared application PrimeNG configuration**, so it also affects other PrimeNG components. Unspecified entries retain the configuration captured at grid initialization; without this section the grid leaves the application's locale alone. Date formats and table data culture remain separately configured.
|
|
154
|
+
|
|
155
|
+
The demo provides complete examples in `src/assets/i18n/en.json`, `es.json`, `fr.json` and `it.json`, plus a language selector. Copy/merge the entries you need into your application's dictionaries. No additional npm dependencies are introduced by this extension.
|
|
156
|
+
|
|
157
|
+
Cell data, predefined-filter values, saved view aliases, user-entered text and backend field identifiers are not translated. A default export filename is translated when opening the export dialog; the filename subsequently entered by the user is preserved. Excel headers generated on the server remain the backend's responsibility.
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
### Per-item list tooltips
|
|
161
|
+
|
|
162
|
+
For `DataType.List` columns, `dataTooltipCustomColumnSource` references a semicolon-separated string in the same row. Each tooltip matches the item at the same position. For example:
|
|
163
|
+
|
|
164
|
+
```text
|
|
165
|
+
EmploymentStatusNameList = "Freelance;Military;Student"
|
|
166
|
+
ESList_tooltip = "Independent work;Military service;In education"
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Set `dataTooltipCustomColumnSource: "ESList_tooltip"` on the `EmploymentStatusNameList` attribute. The auxiliary property can be `string?`, with `dataType: DataType.Text` and `sendColumnAttributes: false`; it needs neither a visible column nor list metadata. The backend includes properties marked `sendColumnAttributes: false` in the returned row data.
|
|
170
|
+
|
|
171
|
+
This applies to predefined-filter tags and plain text lists. Positions are preserved, including duplicate items and empty entries. Missing properties or positions fall back to the item itself; an empty position suppresses its tooltip. Extra tooltips are ignored. `dataTooltipShow: false` still disables tooltips. Tooltip text remains untranslated data.
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
### Progress bars
|
|
175
|
+
|
|
176
|
+
Keep `DataType.Numeric` and set `cellDisplay: CellDisplay.ProgressBar` to display a bar on a 0–100 scale:
|
|
177
|
+
|
|
178
|
+
```csharp
|
|
179
|
+
[ColumnAttributes("Progress", dataType: DataType.Numeric,
|
|
180
|
+
cellDisplay: CellDisplay.ProgressBar, initialWidth: 160)]
|
|
181
|
+
public decimal? Progress { get; set; }
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
The backend sends `cellDisplay: 1` in column metadata and a number in row data, for example `"progress": 15.5`. For TypeScript configurations, import `CellDisplay` from the package and use `cellDisplay: CellDisplay.ProgressBar` with `dataType: DataType.Numeric`.
|
|
185
|
+
|
|
186
|
+
The bar has no inner label; the default tooltip shows `15.5 %`. Both `dataTooltipShow` and `dataTooltipCustomColumnSource` are respected. Zero displays an empty bar; null or nonnumeric values leave the cell empty. Only the visual fill is clamped to 0–100: filtering, sorting and Excel preserve the original number (15.5 exports as 15.5, not 0.155). Decimal values and dynamic metadata via `ColumnMetadataOverrideModel.CellDisplay` are supported.
|
|
187
|
+
|
|
188
|
+
`CellDisplay.Default` (0), or omitted frontend metadata, preserves existing presentation. `ProgressBar` applies only to numeric columns and takes precedence over predefined-filter tags. Update both the npm and NuGet packages to use this option.
|
|
189
|
+
|
|
190
|
+
The demo navigation switches between the full people example (`/home`) and progress bars (`/progress`). Each table has separate endpoints and views. The progress demo uses in-memory data in `ProgressDemoController`, independent of the people database.
|