@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
|
@@ -0,0 +1,591 @@
|
|
|
1
|
+
import { DataAlignHorizontal, DataAlignVertical, TableViewSaveMode } from "../enums";
|
|
2
|
+
import { IColumnMetadata, IPredefinedFilter, ITableButton } from "../interfaces";
|
|
3
|
+
/** Configuration options for ECS Primeng table */
|
|
4
|
+
export interface ITableOptions {
|
|
5
|
+
/** Optional responsive behavior. Existing applications keep their current buttons by default. */
|
|
6
|
+
responsive?: {
|
|
7
|
+
/** CSS viewport width where Tablet starts. Default: 768. */
|
|
8
|
+
tabletMinWidth?: number;
|
|
9
|
+
/** CSS viewport width where Desktop starts; must exceed tabletMinWidth. Default: 1200. */
|
|
10
|
+
desktopMinWidth?: number;
|
|
11
|
+
/** Collapse header actions on Mobile/Tablet. Default: false. */
|
|
12
|
+
headerMenu?: boolean;
|
|
13
|
+
/** Collapse row actions on Mobile/Tablet. Default: false. */
|
|
14
|
+
rowMenu?: boolean;
|
|
15
|
+
/** Accessible labels for the menu triggers. */
|
|
16
|
+
headerMenuLabel?: string;
|
|
17
|
+
rowMenuLabel?: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Optional in-memory query state, shared only within a parent component scope.
|
|
21
|
+
* Provide ECSPrimengTableStateService on the parent containing list/detail routes.
|
|
22
|
+
* Leaving that parent destroys the state. Disabled by default.
|
|
23
|
+
*/
|
|
24
|
+
statePersistence?: {
|
|
25
|
+
/** Save on list destruction and restore before the first data request. @default false */
|
|
26
|
+
enabled?: boolean;
|
|
27
|
+
/** Unique table/context key within the scope. Required when enabled. */
|
|
28
|
+
key?: string;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Controls whether the table is active.
|
|
32
|
+
*
|
|
33
|
+
* - When `true`, the table will fetch configuration, columns, and data on init.
|
|
34
|
+
* - When `false`, the table will **not** automatically fetch or update data, even after initialization.
|
|
35
|
+
* Use this if you want to apply filters, column changes, or other manipulations
|
|
36
|
+
* without triggering automatic updates.
|
|
37
|
+
*
|
|
38
|
+
* @default true
|
|
39
|
+
*/
|
|
40
|
+
isActive?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Endpoint URL to fetch the table configuration.
|
|
43
|
+
*
|
|
44
|
+
* The configuration is fetched **once** when the table is initialized and is expected to return
|
|
45
|
+
* an `ITableConfiguration` object from the API. This includes data such as column definitions,
|
|
46
|
+
* the timezone to use, and other settings.
|
|
47
|
+
*
|
|
48
|
+
* If set to `undefined` or if `isActive` is `false`, the table will **not** fetch configuration automatically.
|
|
49
|
+
*
|
|
50
|
+
* @default undefined
|
|
51
|
+
*/
|
|
52
|
+
urlTableConfiguration?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Endpoint URL to fetch the table data.
|
|
55
|
+
*
|
|
56
|
+
* This endpoint is called **whenever the user filters, changes pages, or sorts** the table.
|
|
57
|
+
* It is expected to return an `ITablePagedResponse` object containing the paginated data.
|
|
58
|
+
*
|
|
59
|
+
* If set to `undefined` or if `isActive` is `false`, the table will **not** fetch or update data automatically.
|
|
60
|
+
*
|
|
61
|
+
* @default undefined
|
|
62
|
+
*/
|
|
63
|
+
urlTableData?: string;
|
|
64
|
+
/**
|
|
65
|
+
* The array of data to be displayed in the table.
|
|
66
|
+
*
|
|
67
|
+
* Each item should represent a row and match the table's column structure.
|
|
68
|
+
*
|
|
69
|
+
* @default []
|
|
70
|
+
*/
|
|
71
|
+
data?: any[];
|
|
72
|
+
/**
|
|
73
|
+
* Defines the icon shown in the column header when a description is present. If not specified, the default information icon will be used.
|
|
74
|
+
*
|
|
75
|
+
* @default "pi pi-info-circle"
|
|
76
|
+
*/
|
|
77
|
+
columnDescriptionIcon?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Configuration options for the table description section.
|
|
80
|
+
*/
|
|
81
|
+
description?: {
|
|
82
|
+
/**
|
|
83
|
+
* Icon displayed alongside the table description.
|
|
84
|
+
* You can use any PrimeIcons class or icons from third-party libraries
|
|
85
|
+
* such as Material Icons or Font Awesome.
|
|
86
|
+
*
|
|
87
|
+
* @default "pi pi-info-circle"
|
|
88
|
+
*/
|
|
89
|
+
icon?: string;
|
|
90
|
+
/**
|
|
91
|
+
* Determines how the description text is displayed.
|
|
92
|
+
* - `true`, the `text` content is shown as a tooltip when hovering
|
|
93
|
+
* over the description icon.
|
|
94
|
+
* - `false`, the `text` is displayed inline to the right of the icon.
|
|
95
|
+
*
|
|
96
|
+
* @default true
|
|
97
|
+
*/
|
|
98
|
+
tooltip?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* The description content to display.
|
|
101
|
+
* If left undefined or string empty, the table description will not be rendered.
|
|
102
|
+
* Supports basic HTML for rich text formatting.
|
|
103
|
+
*
|
|
104
|
+
* @default undefined
|
|
105
|
+
*/
|
|
106
|
+
text?: string;
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Configuration options for the table legend.
|
|
110
|
+
*/
|
|
111
|
+
legend?: {
|
|
112
|
+
/**
|
|
113
|
+
* The content to be displayed in the popover of the legend. Can be HTML rich.
|
|
114
|
+
*
|
|
115
|
+
* @default undefined
|
|
116
|
+
*/
|
|
117
|
+
content?: string;
|
|
118
|
+
/**
|
|
119
|
+
* Configuration options for the legend button.
|
|
120
|
+
*
|
|
121
|
+
* @default {
|
|
122
|
+
* icon: "pi pi-bars",
|
|
123
|
+
* label: "Legend",
|
|
124
|
+
* color: "p-button-primary"
|
|
125
|
+
* }
|
|
126
|
+
*/
|
|
127
|
+
button?: ITableButton;
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* Configurations related to options that are at the header of the table.
|
|
131
|
+
*/
|
|
132
|
+
header?: {
|
|
133
|
+
/**
|
|
134
|
+
* A collection of `ITableButton` to be shown in the table header.
|
|
135
|
+
*
|
|
136
|
+
* @default []
|
|
137
|
+
*/
|
|
138
|
+
buttons?: ITableButton[];
|
|
139
|
+
/**
|
|
140
|
+
* When set to `false`, the **clear sorts** button will be hidden.
|
|
141
|
+
*
|
|
142
|
+
* @default true
|
|
143
|
+
*/
|
|
144
|
+
clearSortsEnabled?: boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Allows customization of the **clear sorts** button icon. You may use any other icons from PrimeNG or third-party providers such as Material Icons or Font Awesome.
|
|
147
|
+
*
|
|
148
|
+
* @default "pi pi-sort-alt-slash"
|
|
149
|
+
*/
|
|
150
|
+
clearSortsIcon?: string;
|
|
151
|
+
/**
|
|
152
|
+
* When set to `false`, the **clear filters** button will be hidden.
|
|
153
|
+
*
|
|
154
|
+
* @default true
|
|
155
|
+
*/
|
|
156
|
+
clearFiltersEnabled?: boolean;
|
|
157
|
+
/**
|
|
158
|
+
* Allows customization of the **clear filters** button icon. Other icons from PrimeNG or third-party libraries (e.g., Material Icons, Font Awesome) may also be used.
|
|
159
|
+
*
|
|
160
|
+
* @default "pi pi-filter-slash"
|
|
161
|
+
*/
|
|
162
|
+
clearFiltersIcon?: string;
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* Configurations related to the columns of the table.
|
|
166
|
+
*/
|
|
167
|
+
columns?: {
|
|
168
|
+
/**
|
|
169
|
+
* Enables or disables the column selector feature.
|
|
170
|
+
*
|
|
171
|
+
* When `true`, a button is displayed in the top-left corner of the table.
|
|
172
|
+
* Clicking this button opens a modal that allows users to:
|
|
173
|
+
* - Show or hide columns.
|
|
174
|
+
* - Adjust the cell overflow behavior for each column.
|
|
175
|
+
* - Change the horizontal and vertical alignment of cells per column.
|
|
176
|
+
*
|
|
177
|
+
* When `false`, the button to open the column's selector modal will not be available.
|
|
178
|
+
*
|
|
179
|
+
* @default true
|
|
180
|
+
*/
|
|
181
|
+
selectorEnabled?: boolean;
|
|
182
|
+
/**
|
|
183
|
+
* Can be used to specifiy a different icon to be used by the column selector.
|
|
184
|
+
* You can replace it with any icon from PrimeNG or other libraries such as Font Awesome or Material Icons.
|
|
185
|
+
*
|
|
186
|
+
* @default "pi pi-pen-to-square"
|
|
187
|
+
*/
|
|
188
|
+
selectorIcon?: string;
|
|
189
|
+
/**
|
|
190
|
+
* When `true`, columns in the selector are displayed alphabetically (A–Z).
|
|
191
|
+
* When `false`, columns keep the order provided by the backend.
|
|
192
|
+
*
|
|
193
|
+
* @default true
|
|
194
|
+
*/
|
|
195
|
+
selectorOrderByColumnName?: boolean;
|
|
196
|
+
/**
|
|
197
|
+
* The combination of non-selectable columns and user-selected columns
|
|
198
|
+
* that must be displayed in the table.
|
|
199
|
+
*
|
|
200
|
+
* @default []
|
|
201
|
+
*/
|
|
202
|
+
shown?: IColumnMetadata[];
|
|
203
|
+
};
|
|
204
|
+
/**
|
|
205
|
+
* Configurations related to the rows of the table.
|
|
206
|
+
*/
|
|
207
|
+
rows?: {
|
|
208
|
+
/**
|
|
209
|
+
* Function to dynamically assign CSS classes to a row.
|
|
210
|
+
*
|
|
211
|
+
* Receives the `rowData` object for the current row and returns:
|
|
212
|
+
* - A string with a single CSS class name
|
|
213
|
+
* - An array of class names
|
|
214
|
+
* - A Set of class names
|
|
215
|
+
* - An object with class keys and truthy/falsy values
|
|
216
|
+
*
|
|
217
|
+
* The returned classes are applied to the row in addition to any global or default styles.
|
|
218
|
+
* Useful for changing appearance of a row based on column values.
|
|
219
|
+
*
|
|
220
|
+
* Example:
|
|
221
|
+
* ```ts
|
|
222
|
+
* class: (rowData) => {
|
|
223
|
+
* const classes = [];
|
|
224
|
+
* if (rowData.status === "Unemployed") classes.push("unemployedRow");
|
|
225
|
+
* return classes;
|
|
226
|
+
* }
|
|
227
|
+
* ```
|
|
228
|
+
*/
|
|
229
|
+
class?: (rowData: any) => string | string[] | Set<string> | {
|
|
230
|
+
[klass: string]: any;
|
|
231
|
+
};
|
|
232
|
+
/**
|
|
233
|
+
* Function to dynamically assign inline styles to a row.
|
|
234
|
+
*
|
|
235
|
+
* Receives the `rowData` object for the current row and returns an object
|
|
236
|
+
* with CSS properties to apply inline. This allows dynamic styling based
|
|
237
|
+
* on the row's content or values.
|
|
238
|
+
*
|
|
239
|
+
* If not provided, no dynamic styles are applied.
|
|
240
|
+
*
|
|
241
|
+
* Example:
|
|
242
|
+
* ```ts
|
|
243
|
+
* style: (rowData) => {
|
|
244
|
+
* if (rowData.status === "Full-time") {
|
|
245
|
+
* return { fontWeight: "bold", fontStyle: "italic" };
|
|
246
|
+
* }
|
|
247
|
+
* return {};
|
|
248
|
+
* }
|
|
249
|
+
* ```
|
|
250
|
+
*/
|
|
251
|
+
style?: (rowData: any) => {
|
|
252
|
+
[klass: string]: any;
|
|
253
|
+
};
|
|
254
|
+
/**
|
|
255
|
+
* Configurations related to the action column for the rows.
|
|
256
|
+
*/
|
|
257
|
+
action?: {
|
|
258
|
+
/**
|
|
259
|
+
* A collection of `ITableButton` to be shown by this column to perform actions over rows. At least one button needs to be enable the row actions column.
|
|
260
|
+
*
|
|
261
|
+
* @default []
|
|
262
|
+
*/
|
|
263
|
+
buttons?: ITableButton[];
|
|
264
|
+
/**
|
|
265
|
+
* The header label for the row actions column.
|
|
266
|
+
*
|
|
267
|
+
* @default "Actions"
|
|
268
|
+
*/
|
|
269
|
+
header?: string;
|
|
270
|
+
/**
|
|
271
|
+
* If `true`, the column will appear on the right side of the table. Otherwise, it will appear on the left.
|
|
272
|
+
*
|
|
273
|
+
* @default true
|
|
274
|
+
*/
|
|
275
|
+
positionRight?: boolean;
|
|
276
|
+
/**
|
|
277
|
+
* The fixed column width in pixels.
|
|
278
|
+
*
|
|
279
|
+
* @default 150
|
|
280
|
+
*/
|
|
281
|
+
width?: number;
|
|
282
|
+
/**
|
|
283
|
+
* If `true`, the column remains visible when horizontally scrolling the table.
|
|
284
|
+
*
|
|
285
|
+
* @default true
|
|
286
|
+
*/
|
|
287
|
+
frozen?: boolean;
|
|
288
|
+
/**
|
|
289
|
+
* If `true`, users can resize the column.
|
|
290
|
+
*
|
|
291
|
+
* @default false
|
|
292
|
+
*/
|
|
293
|
+
resizable?: boolean;
|
|
294
|
+
/**
|
|
295
|
+
* How the items inside the action column are horizontally aligned.
|
|
296
|
+
*
|
|
297
|
+
* @default DataAlignHorizontal.Center
|
|
298
|
+
*/
|
|
299
|
+
horizontalAlignment?: DataAlignHorizontal;
|
|
300
|
+
/**
|
|
301
|
+
* How the items inside the action column are vertically aligned.
|
|
302
|
+
*
|
|
303
|
+
* @default DataAlignVertical.Middle
|
|
304
|
+
*/
|
|
305
|
+
verticalAlignment?: DataAlignVertical;
|
|
306
|
+
};
|
|
307
|
+
/**
|
|
308
|
+
* Configurations related to the row checkbox selector.
|
|
309
|
+
*/
|
|
310
|
+
checkboxSelector?: {
|
|
311
|
+
/**
|
|
312
|
+
* If `true`, a new column with checkboxes will be displayed. Users can select or unselect rows using these checkboxes. Additionally an option to filter by this column will be enabled.
|
|
313
|
+
*
|
|
314
|
+
* @default false
|
|
315
|
+
*/
|
|
316
|
+
enabled?: boolean;
|
|
317
|
+
/**
|
|
318
|
+
* The header label for the checkbox selection column.
|
|
319
|
+
*
|
|
320
|
+
* @default "Selected"
|
|
321
|
+
*/
|
|
322
|
+
header?: string;
|
|
323
|
+
/**
|
|
324
|
+
* If `true`, the column will appear on the right side of the table. Otherwise, it will appear on the left.
|
|
325
|
+
*
|
|
326
|
+
* @default false
|
|
327
|
+
*/
|
|
328
|
+
positionRight?: boolean;
|
|
329
|
+
/**
|
|
330
|
+
* The fixed column width in pixels.
|
|
331
|
+
*
|
|
332
|
+
* @default 150
|
|
333
|
+
*/
|
|
334
|
+
width?: number;
|
|
335
|
+
/**
|
|
336
|
+
* If `true`, the column remains visible when horizontally scrolling the table.
|
|
337
|
+
*
|
|
338
|
+
* @default true
|
|
339
|
+
*/
|
|
340
|
+
frozen?: boolean;
|
|
341
|
+
/**
|
|
342
|
+
* If `true`, users can resize the column.
|
|
343
|
+
*
|
|
344
|
+
* @default false
|
|
345
|
+
*/
|
|
346
|
+
resizable?: boolean;
|
|
347
|
+
/**
|
|
348
|
+
* Function that determines whether the checkbox should be enabled or not.
|
|
349
|
+
* @param rowData The row data object.
|
|
350
|
+
* @returns True if the checkbox should be enabled; false otherwise.
|
|
351
|
+
*
|
|
352
|
+
* @default undefined
|
|
353
|
+
*/
|
|
354
|
+
enabledCondition?: (rowData: any) => boolean;
|
|
355
|
+
/**
|
|
356
|
+
* How the checkbox inside the selector column is horizontally aligned.
|
|
357
|
+
*
|
|
358
|
+
* @default DataAlignHorizontal.Center
|
|
359
|
+
*/
|
|
360
|
+
horizontalAlignment?: DataAlignHorizontal;
|
|
361
|
+
/**
|
|
362
|
+
* How the checkbox inside the selector column is vertically aligned.
|
|
363
|
+
*
|
|
364
|
+
* @default DataAlignVertical.Middle
|
|
365
|
+
*/
|
|
366
|
+
verticalAlignment?: DataAlignVertical;
|
|
367
|
+
};
|
|
368
|
+
/**
|
|
369
|
+
* Configurations related to the single row selector.
|
|
370
|
+
*/
|
|
371
|
+
singleSelector?: {
|
|
372
|
+
/**
|
|
373
|
+
* If set to `true`, users can click a row to select it. You can then subscribe to selection events to execute custom actions.
|
|
374
|
+
*
|
|
375
|
+
* @default false
|
|
376
|
+
*/
|
|
377
|
+
enabled?: boolean;
|
|
378
|
+
/**
|
|
379
|
+
* When `true`, users must hold **CTRL** and click on a selected row to unselect it. When `false`, users can unselect a row simply by clicking it again.
|
|
380
|
+
*
|
|
381
|
+
* On mobile devices (phones or tablets), the **CTRL** key configuration is ignored. Users can unselect a previously selected row by simply clicking it, as mobile devices do not have a **CTRL** key.
|
|
382
|
+
*
|
|
383
|
+
* @default true
|
|
384
|
+
*/
|
|
385
|
+
metakey?: boolean;
|
|
386
|
+
};
|
|
387
|
+
};
|
|
388
|
+
/** Configurations related to the vertical scroll of the table. */
|
|
389
|
+
verticalScroll?: {
|
|
390
|
+
/**
|
|
391
|
+
* Automatically adjust the table's height to fit its container.
|
|
392
|
+
*
|
|
393
|
+
* When set to `true`, the table will calculate the maximum height dynamically
|
|
394
|
+
* so that it exactly fits its container. This takes precedence over the `height` property.
|
|
395
|
+
*
|
|
396
|
+
* Ignored if a `cssFormula` has been provided.
|
|
397
|
+
*
|
|
398
|
+
* @default true
|
|
399
|
+
*/
|
|
400
|
+
fitToContainer?: boolean;
|
|
401
|
+
/**
|
|
402
|
+
* Fixed vertical height for the table when `fitToContainer` is `false`.
|
|
403
|
+
*
|
|
404
|
+
* - If a `cssFormula` has been provided, this property is ignored.
|
|
405
|
+
* - If `fitToContainer` from `verticalScroll` is `true`, this property is ignored.
|
|
406
|
+
* - If set to a value `<= 0`, this is ignored.
|
|
407
|
+
*
|
|
408
|
+
* Use this property to enable vertical scrolling with a fixed height when you do not want
|
|
409
|
+
* the table to dynamically fit its container.
|
|
410
|
+
*
|
|
411
|
+
* @default 0
|
|
412
|
+
*/
|
|
413
|
+
height?: number;
|
|
414
|
+
/**
|
|
415
|
+
* A CSS string used to define the table's vertical height.
|
|
416
|
+
*
|
|
417
|
+
* Can be a fixed value (e.g., `"500px"`) or a CSS formula (e.g., `"calc(100vh - 200px)"`).
|
|
418
|
+
* When provided, this value **overrides** both `fitToContainer` and `height`.
|
|
419
|
+
*
|
|
420
|
+
* @default undefined
|
|
421
|
+
*/
|
|
422
|
+
cssFormula?: string;
|
|
423
|
+
};
|
|
424
|
+
/** Configurations related to the global filter functionality of the table. */
|
|
425
|
+
globalFilter?: {
|
|
426
|
+
/**
|
|
427
|
+
* Enables or disables the global filter input.
|
|
428
|
+
*
|
|
429
|
+
* When set to `true`, users can search across all table columns using the global search bar.
|
|
430
|
+
* When `false`, the global search input will not be rendered.
|
|
431
|
+
*
|
|
432
|
+
* @default true
|
|
433
|
+
*/
|
|
434
|
+
enabled?: boolean;
|
|
435
|
+
/**
|
|
436
|
+
* Maximum number of characters allowed in the global filter input.
|
|
437
|
+
*
|
|
438
|
+
* Use this to limit the length of search queries and prevent excessively long input.
|
|
439
|
+
*
|
|
440
|
+
* @default 20
|
|
441
|
+
*/
|
|
442
|
+
maxLength?: number;
|
|
443
|
+
};
|
|
444
|
+
/**
|
|
445
|
+
* Predefined filters for table columns.
|
|
446
|
+
*
|
|
447
|
+
* Restricts filter options to a known set of values for a column.
|
|
448
|
+
* Suitable for columns with a limited number of distinct values.
|
|
449
|
+
* Supports plain text, tags, icons, and images. Works with `list` data types.
|
|
450
|
+
*
|
|
451
|
+
* @default {}
|
|
452
|
+
*/
|
|
453
|
+
predefinedFilters?: {
|
|
454
|
+
[key: string]: IPredefinedFilter[];
|
|
455
|
+
};
|
|
456
|
+
/**
|
|
457
|
+
* Configurations related to saved table views.
|
|
458
|
+
*/
|
|
459
|
+
views?: {
|
|
460
|
+
/**
|
|
461
|
+
* Determines how the table views are saved.
|
|
462
|
+
*
|
|
463
|
+
* - `TableViewSaveMode.None`: Do not save any views.
|
|
464
|
+
* - `TableViewSaveMode.SessionStorage`: Save views in the browser session storage (cleared when the tab/window closes).
|
|
465
|
+
* - `TableViewSaveMode.LocalStorage`: Save views in the browser local storage (persistent across sessions).
|
|
466
|
+
* - `TableViewSaveMode.DatabaseStorage`: Save views directly in the database via the backend API. If you are using this method you will need to specify also the `urlGet`and `urlSave`
|
|
467
|
+
*
|
|
468
|
+
* This allows users to keep their custom column orders, filters, sorting, and other table settings
|
|
469
|
+
* according to the selected storage option.
|
|
470
|
+
*
|
|
471
|
+
* @default TableViewSaveMode.None
|
|
472
|
+
*/
|
|
473
|
+
saveMode?: TableViewSaveMode;
|
|
474
|
+
/**
|
|
475
|
+
* Key used to identify the table when saving and retrieving its views.
|
|
476
|
+
*
|
|
477
|
+
* Each table should have a unique `saveKey` so that its saved views (filters, column order, sorting, etc.)
|
|
478
|
+
* do not conflict with other tables.
|
|
479
|
+
*
|
|
480
|
+
* If set to `undefined`, the table will not save or load any views.
|
|
481
|
+
*
|
|
482
|
+
* @default undefined
|
|
483
|
+
*/
|
|
484
|
+
saveKey?: string;
|
|
485
|
+
/**
|
|
486
|
+
* Endpoint URL to fetch saved views from the database.
|
|
487
|
+
*
|
|
488
|
+
* Only used if `saveMode` is `TableViewSaveMode.databaseStorage`.
|
|
489
|
+
* The `saveKey` is sent to identify the correct table views.
|
|
490
|
+
*
|
|
491
|
+
* @default undefined
|
|
492
|
+
*/
|
|
493
|
+
urlGet?: string;
|
|
494
|
+
/**
|
|
495
|
+
* Endpoint URL to save table views to the database.
|
|
496
|
+
*
|
|
497
|
+
* Only used if `saveMode` is `TableViewSaveMode.databaseStorage`.
|
|
498
|
+
* The `saveKey` is sent to identify the correct table views.
|
|
499
|
+
*
|
|
500
|
+
* @default undefined
|
|
501
|
+
*/
|
|
502
|
+
urlSave?: string;
|
|
503
|
+
/**
|
|
504
|
+
* A collection of custom CSS classes to apply to the button that opens the views menu.
|
|
505
|
+
* Multiple classes can be provided as a space-separated string.
|
|
506
|
+
*
|
|
507
|
+
* @default undefined
|
|
508
|
+
*/
|
|
509
|
+
selectViewButtonClass?: string;
|
|
510
|
+
/**
|
|
511
|
+
* CSS classes to apply to the button used to reapply a view.
|
|
512
|
+
* Multiple classes can be provided as a space-separated string.
|
|
513
|
+
*
|
|
514
|
+
* @default undefined
|
|
515
|
+
*/
|
|
516
|
+
reloadViewButtonClass?: string;
|
|
517
|
+
/**
|
|
518
|
+
* The icon that the reapply view button has.
|
|
519
|
+
*
|
|
520
|
+
* @default "pi pi-refresh"
|
|
521
|
+
*/
|
|
522
|
+
reloadViewButtonIcon?: string;
|
|
523
|
+
/**
|
|
524
|
+
* The text that is displayed when no view is selected.
|
|
525
|
+
*
|
|
526
|
+
* @default "--- Select a view ---"
|
|
527
|
+
*/
|
|
528
|
+
noViewSelectedText?: string;
|
|
529
|
+
};
|
|
530
|
+
/**
|
|
531
|
+
* Configurations related to the reset table view button.
|
|
532
|
+
*/
|
|
533
|
+
resetTableView?: {
|
|
534
|
+
/**
|
|
535
|
+
* If the reset table view button should be enabled.
|
|
536
|
+
*
|
|
537
|
+
* @default true
|
|
538
|
+
*/
|
|
539
|
+
enabled?: boolean;
|
|
540
|
+
/**
|
|
541
|
+
* Can be used to specifiy a different icon to be used by the reset table view button.
|
|
542
|
+
* You can replace it with any icon from PrimeNG or other libraries such as Font Awesome or Material Icons.
|
|
543
|
+
*
|
|
544
|
+
* @default "pi pi-eraser"
|
|
545
|
+
*/
|
|
546
|
+
icon?: string;
|
|
547
|
+
};
|
|
548
|
+
/**
|
|
549
|
+
* Configurations for exporting the table data to Excel.
|
|
550
|
+
*/
|
|
551
|
+
excelReport?: {
|
|
552
|
+
/**
|
|
553
|
+
* Endpoint URL of the API to perform the Excel export.
|
|
554
|
+
*
|
|
555
|
+
* When set, the table will send a request to this endpoint including the properties
|
|
556
|
+
* specified by the user, such as selected columns, filters, and sort order, to generate
|
|
557
|
+
* the export.
|
|
558
|
+
*
|
|
559
|
+
* If set to `undefined`, Excel export functionality will be disabled.
|
|
560
|
+
*
|
|
561
|
+
* @default undefined
|
|
562
|
+
*/
|
|
563
|
+
url?: string;
|
|
564
|
+
/**
|
|
565
|
+
* Default title shown in the Excel export modal when preparing the export.
|
|
566
|
+
*
|
|
567
|
+
* If the string is empty (after trimming) **and** `titleAllowUserEdit` is `false`,
|
|
568
|
+
* the export button will be disabled.
|
|
569
|
+
*
|
|
570
|
+
* @default "Report"
|
|
571
|
+
*/
|
|
572
|
+
defaultTitle?: string;
|
|
573
|
+
/**
|
|
574
|
+
* Determines whether the user can edit the title of the Excel file in the export modal.
|
|
575
|
+
*
|
|
576
|
+
* - If `true`, the user can modify the title before exporting.
|
|
577
|
+
* - If `false`, the title is fixed to `defaultTitle`.
|
|
578
|
+
*
|
|
579
|
+
* @default true
|
|
580
|
+
*/
|
|
581
|
+
titleAllowUserEdit?: boolean;
|
|
582
|
+
};
|
|
583
|
+
/**
|
|
584
|
+
* Defines the number of seconds the user must hold the mouse button on a cell before its content is copied to the clipboard. Set to a value <= 0 to turn off this feature entirely
|
|
585
|
+
*
|
|
586
|
+
* @default 0.5
|
|
587
|
+
*/
|
|
588
|
+
copyToClipboardTime?: number;
|
|
589
|
+
}
|
|
590
|
+
/** Default configuration options for ECS Primeng table */
|
|
591
|
+
export declare const DEFAULT_TABLE_OPTIONS: ITableOptions;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a paged response from a table query.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Provides information about the current page, total records, and the data for the page.
|
|
6
|
+
*/
|
|
7
|
+
export interface ITablePagedResponse {
|
|
8
|
+
/** The current page number. */
|
|
9
|
+
page: number;
|
|
10
|
+
/** Total number of records after applying any filters. */
|
|
11
|
+
totalRecords: number;
|
|
12
|
+
/** Total number of records without applying any filters. */
|
|
13
|
+
totalRecordsNotFiltered: number;
|
|
14
|
+
/** The data items for the current page. */
|
|
15
|
+
data: any;
|
|
16
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a request for querying table data with pagination, sorting, and filtering.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Includes information about page, page size, sorting, filters, and date formatting options.
|
|
6
|
+
*/
|
|
7
|
+
export interface ITableQueryRequest {
|
|
8
|
+
/** The current page number. */
|
|
9
|
+
page: number;
|
|
10
|
+
/** The number of items per page. */
|
|
11
|
+
pageSize: number;
|
|
12
|
+
/** Optional sorting configuration. */
|
|
13
|
+
sort?: any;
|
|
14
|
+
/** Filter criteria for the query. */
|
|
15
|
+
filter: any;
|
|
16
|
+
/** Optional global filter applied across all columns. */
|
|
17
|
+
globalFilter?: string | null;
|
|
18
|
+
/** Optional array of column names to include in the query. */
|
|
19
|
+
columns?: string[];
|
|
20
|
+
/** The date format used for query parameters. */
|
|
21
|
+
dateFormat: string;
|
|
22
|
+
/** The timezone used for formatting date values. */
|
|
23
|
+
dateTimezone: string;
|
|
24
|
+
/** The culture/locale used for formatting dates and numbers. */
|
|
25
|
+
dateCulture: string;
|
|
26
|
+
/** The date format used in exports. */
|
|
27
|
+
exportDateFormat: string;
|
|
28
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SortMeta } from "primeng/api";
|
|
2
|
+
import { IColumnMetadata } from "./columns-metadata.interface";
|
|
3
|
+
/**
|
|
4
|
+
* Represents the current state and configuration of a table view.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Includes information about displayed columns, widths, sorting, filtering, and pagination.
|
|
8
|
+
*/
|
|
9
|
+
export interface ITableViewData {
|
|
10
|
+
/** Array of columns currently visible in the table. */
|
|
11
|
+
columnsShown: IColumnMetadata[];
|
|
12
|
+
/** The total width of the table in pixels. */
|
|
13
|
+
tableWidth: any;
|
|
14
|
+
/** Widths of individual columns as a formatted string (in pixels). */
|
|
15
|
+
columnsWidth: string;
|
|
16
|
+
/** Sorting metadata for multiple columns, if applicable. */
|
|
17
|
+
multiSortMeta: SortMeta[] | null | undefined;
|
|
18
|
+
/** Current filter settings applied to the table. */
|
|
19
|
+
filters: any;
|
|
20
|
+
/** Text used for global search across all columns, if any. */
|
|
21
|
+
globalSearchText: string | null;
|
|
22
|
+
/** The current page number. */
|
|
23
|
+
currentPage: number;
|
|
24
|
+
/** The number of rows displayed per page. */
|
|
25
|
+
currentRowsPerPage: number;
|
|
26
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ITableViewData } from "./table-view-data.interface";
|
|
2
|
+
/**
|
|
3
|
+
* Represents a saved or active view of a table.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Contains information about whether the view is currently active, its alias, and the view data.
|
|
7
|
+
*/
|
|
8
|
+
export interface ITableView {
|
|
9
|
+
/** Indicates if this view is the last active one. */
|
|
10
|
+
lastActive: boolean;
|
|
11
|
+
/** Alias or name of the view. */
|
|
12
|
+
viewAlias: string;
|
|
13
|
+
/** The detailed data and configuration for this view. */
|
|
14
|
+
viewData: ITableViewData;
|
|
15
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ChangeDetectorRef, OnDestroy, PipeTransform } from '@angular/core';
|
|
2
|
+
import { ECSPrimengTableI18nService } from '../services/i18n.service';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/** Supports English defaults and live dictionary updates without mutating the source value. */
|
|
5
|
+
export declare class ECSTableTranslatePipe implements PipeTransform, OnDestroy {
|
|
6
|
+
private i18n;
|
|
7
|
+
private readonly subscription;
|
|
8
|
+
constructor(i18n: ECSPrimengTableI18nService, changeDetector: ChangeDetectorRef);
|
|
9
|
+
transform(key: string | null | undefined, params?: Record<string, any>): string;
|
|
10
|
+
ngOnDestroy(): void;
|
|
11
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ECSTableTranslatePipe, never>;
|
|
12
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<ECSTableTranslatePipe, "ecsTranslate", true>;
|
|
13
|
+
}
|