@pongrass/utils 1.0.1-v20 → 1.0.3-v20
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 +30 -0
- package/fesm2022/pongrass-utils.mjs +381 -2
- package/fesm2022/pongrass-utils.mjs.map +1 -1
- package/index.d.ts +83 -2
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -81,6 +81,36 @@ export class YourModule { }
|
|
|
81
81
|
- **DecimalInputDirective** - Restricts input to decimal values
|
|
82
82
|
- **MultiSelectStylerDirective** - Applies custom styling to multi-select components
|
|
83
83
|
- **ShowTooltipIfTruncatedDirective** - Shows a tooltip when text is truncated
|
|
84
|
+
- **BackgroundImageDirective** - Adds background images to elements with optional random selection
|
|
85
|
+
|
|
86
|
+
### BackgroundImageDirective
|
|
87
|
+
|
|
88
|
+
Adds background images to elements with support for random image selection from a list.
|
|
89
|
+
|
|
90
|
+
#### Inputs
|
|
91
|
+
|
|
92
|
+
- `backgroundImage` (string | string[]) - Path to a single background image or array of image paths
|
|
93
|
+
- `random` (boolean) - Flag to enable random image selection from array (defaults to false)
|
|
94
|
+
|
|
95
|
+
#### Usage
|
|
96
|
+
|
|
97
|
+
```html
|
|
98
|
+
<!-- Single background image -->
|
|
99
|
+
<div appBackgroundImage [backgroundImage]="'assets/background1.jpg'"></div>
|
|
100
|
+
|
|
101
|
+
<!-- Random background image from a list -->
|
|
102
|
+
<div appBackgroundImage
|
|
103
|
+
[random]="true"
|
|
104
|
+
[backgroundImage]="['assets/background1.jpg', 'assets/background2.jpg', 'assets/background3.jpg']">
|
|
105
|
+
</div>
|
|
106
|
+
|
|
107
|
+
<!-- First image from a list (random=false) -->
|
|
108
|
+
<div appBackgroundImage
|
|
109
|
+
[backgroundImage]="['assets/background1.jpg', 'assets/background2.jpg', 'assets/background3.jpg']">
|
|
110
|
+
</div>
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Place your background images in your application's assets folder and reference them using the directive.
|
|
84
114
|
|
|
85
115
|
## Available Services
|
|
86
116
|
|
|
@@ -21,6 +21,7 @@ import { AgGridModule } from '@ag-grid-community/angular';
|
|
|
21
21
|
import { ClientSideRowModelModule } from '@ag-grid-community/client-side-row-model';
|
|
22
22
|
import { ModuleRegistry, _EditCoreModule } from '@ag-grid-community/core';
|
|
23
23
|
import { CsvExportModule } from '@ag-grid-community/csv-export';
|
|
24
|
+
import * as ExcelJS from 'exceljs';
|
|
24
25
|
|
|
25
26
|
class ConfigurationServiceLib {
|
|
26
27
|
currentTablePreference;
|
|
@@ -1246,7 +1247,6 @@ class MultiFormComponent {
|
|
|
1246
1247
|
ngOnInit() {
|
|
1247
1248
|
this.buildFormControls();
|
|
1248
1249
|
this.saveInitialFormValues();
|
|
1249
|
-
console.log('config ->>>', this.configurationService);
|
|
1250
1250
|
}
|
|
1251
1251
|
ngOnChanges(changes) {
|
|
1252
1252
|
if (changes['config'] && !changes['config'].isFirstChange()) {
|
|
@@ -2127,6 +2127,385 @@ class ITableGridPagination {
|
|
|
2127
2127
|
paginationPageSizeSelector = this.configurationService.allConfigValues()?.tableGridConfig.defaultPageSizeSelector || false;
|
|
2128
2128
|
}
|
|
2129
2129
|
|
|
2130
|
+
class BackgroundImageDirective {
|
|
2131
|
+
el = inject(ElementRef);
|
|
2132
|
+
/**
|
|
2133
|
+
* Flag to enable random background selection
|
|
2134
|
+
* Defaults to false
|
|
2135
|
+
*/
|
|
2136
|
+
random = false;
|
|
2137
|
+
/**
|
|
2138
|
+
* Path to the background image (string) or images (string[])
|
|
2139
|
+
*/
|
|
2140
|
+
backgroundImage = '';
|
|
2141
|
+
ngOnInit() {
|
|
2142
|
+
this.setBackgroundImage();
|
|
2143
|
+
}
|
|
2144
|
+
setBackgroundImage() {
|
|
2145
|
+
let imageUrl = '';
|
|
2146
|
+
if (typeof this.backgroundImage === 'string') {
|
|
2147
|
+
// Single image path
|
|
2148
|
+
imageUrl = this.backgroundImage;
|
|
2149
|
+
}
|
|
2150
|
+
else if (Array.isArray(this.backgroundImage) && this.backgroundImage.length > 0) {
|
|
2151
|
+
// Array of image paths
|
|
2152
|
+
if (this.random) {
|
|
2153
|
+
// Select a random image from the array
|
|
2154
|
+
const randomIndex = Math.floor(Math.random() * this.backgroundImage.length);
|
|
2155
|
+
imageUrl = this.backgroundImage[randomIndex];
|
|
2156
|
+
}
|
|
2157
|
+
else {
|
|
2158
|
+
// Use the first image in the array
|
|
2159
|
+
imageUrl = this.backgroundImage[0];
|
|
2160
|
+
}
|
|
2161
|
+
}
|
|
2162
|
+
if (imageUrl) {
|
|
2163
|
+
this.el.nativeElement.style.backgroundImage = `url('${imageUrl}')`;
|
|
2164
|
+
this.el.nativeElement.style.backgroundSize = 'cover';
|
|
2165
|
+
this.el.nativeElement.style.backgroundPosition = 'center';
|
|
2166
|
+
this.el.nativeElement.style.backgroundRepeat = 'no-repeat';
|
|
2167
|
+
this.el.nativeElement.style.minHeight = '100vh';
|
|
2168
|
+
this.el.nativeElement.style.width = '100%';
|
|
2169
|
+
this.el.nativeElement.style.margin = '0';
|
|
2170
|
+
this.el.nativeElement.style.display = 'block';
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: BackgroundImageDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2174
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.9", type: BackgroundImageDirective, isStandalone: true, selector: "[appBackgroundImage]", inputs: { random: "random", backgroundImage: "backgroundImage" }, ngImport: i0 });
|
|
2175
|
+
}
|
|
2176
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: BackgroundImageDirective, decorators: [{
|
|
2177
|
+
type: Directive,
|
|
2178
|
+
args: [{
|
|
2179
|
+
selector: '[appBackgroundImage]',
|
|
2180
|
+
standalone: true
|
|
2181
|
+
}]
|
|
2182
|
+
}], propDecorators: { random: [{
|
|
2183
|
+
type: Input
|
|
2184
|
+
}], backgroundImage: [{
|
|
2185
|
+
type: Input
|
|
2186
|
+
}] } });
|
|
2187
|
+
|
|
2188
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2189
|
+
// Output: "2024-10-02 15:43:58"
|
|
2190
|
+
function convertToISOnString(date) {
|
|
2191
|
+
if (!date)
|
|
2192
|
+
return '';
|
|
2193
|
+
const dateString = date instanceof Date ? date.toISOString() : date;
|
|
2194
|
+
if (dateString.includes('T')) {
|
|
2195
|
+
return dateString.replace('T', ' ').split('.')[0];
|
|
2196
|
+
}
|
|
2197
|
+
return dateString;
|
|
2198
|
+
}
|
|
2199
|
+
// defaultDateFormat = 'DD/MM/YYYY';
|
|
2200
|
+
// Output: "02/10/2024"
|
|
2201
|
+
function regionalDateFormat(date) {
|
|
2202
|
+
if (!date)
|
|
2203
|
+
return '';
|
|
2204
|
+
const config = window.config;
|
|
2205
|
+
const month = ('0' + (date.getMonth() + 1)).slice(-2);
|
|
2206
|
+
const day = ('0' + date.getDate()).slice(-2);
|
|
2207
|
+
const year = date.getFullYear();
|
|
2208
|
+
switch (config.defaultDateFormat) {
|
|
2209
|
+
case 'MM/DD/YYYY':
|
|
2210
|
+
return `${month}/${day}/${year}`;
|
|
2211
|
+
case 'DD/MM/YYYY':
|
|
2212
|
+
return `${day}/${month}/${year}`;
|
|
2213
|
+
case 'YYYY/MM/DD':
|
|
2214
|
+
return `${year}/${month}/${day}`;
|
|
2215
|
+
default:
|
|
2216
|
+
return `${month}/${day}/${year}`;
|
|
2217
|
+
}
|
|
2218
|
+
}
|
|
2219
|
+
// convertIsoToFormat(date, 'YYYY/MM/DD');
|
|
2220
|
+
// Output: "2024/10/02"
|
|
2221
|
+
function convertIsoToFormat(date, dateFormat) {
|
|
2222
|
+
if (!date)
|
|
2223
|
+
return '';
|
|
2224
|
+
const config = window.config;
|
|
2225
|
+
let format;
|
|
2226
|
+
if (dateFormat)
|
|
2227
|
+
format = dateFormat;
|
|
2228
|
+
else
|
|
2229
|
+
format = config.defaultDateFormat;
|
|
2230
|
+
const dateObj = new Date(date);
|
|
2231
|
+
const year = dateObj.getFullYear();
|
|
2232
|
+
const month = String(dateObj.getMonth() + 1).padStart(2, '0');
|
|
2233
|
+
const day = String(dateObj.getDate()).padStart(2, '0');
|
|
2234
|
+
return format.replace('YYYY', String(year)).replace('MM', month).replace('DD', day);
|
|
2235
|
+
}
|
|
2236
|
+
// Output: 'Oct 2, 2024, 3:43:58 PM'
|
|
2237
|
+
function convertDateShort(dateString) {
|
|
2238
|
+
if (!dateString) {
|
|
2239
|
+
return '';
|
|
2240
|
+
}
|
|
2241
|
+
const date = new Date(dateString);
|
|
2242
|
+
return date.toLocaleString('en-US', {
|
|
2243
|
+
month: 'short',
|
|
2244
|
+
day: 'numeric',
|
|
2245
|
+
year: 'numeric',
|
|
2246
|
+
hour: 'numeric',
|
|
2247
|
+
minute: 'numeric',
|
|
2248
|
+
second: 'numeric',
|
|
2249
|
+
hour12: true
|
|
2250
|
+
});
|
|
2251
|
+
}
|
|
2252
|
+
|
|
2253
|
+
var ExportToExcelNames;
|
|
2254
|
+
(function (ExportToExcelNames) {
|
|
2255
|
+
ExportToExcelNames["ProdStatusReport"] = "Prod_Status_Report";
|
|
2256
|
+
ExportToExcelNames["NationalROPReport"] = "National ROP Report";
|
|
2257
|
+
ExportToExcelNames["NationalInserts"] = "National Inserts";
|
|
2258
|
+
ExportToExcelNames["ApprovedAdList"] = "Approved Ad List";
|
|
2259
|
+
ExportToExcelNames["PageStatusReport"] = "Page Status Report";
|
|
2260
|
+
})(ExportToExcelNames || (ExportToExcelNames = {}));
|
|
2261
|
+
var ExcelType;
|
|
2262
|
+
(function (ExcelType) {
|
|
2263
|
+
ExcelType["excelBlobType"] = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
2264
|
+
ExcelType["xlsxBookType"] = "xlsx";
|
|
2265
|
+
})(ExcelType || (ExcelType = {}));
|
|
2266
|
+
|
|
2267
|
+
class UtilsService {
|
|
2268
|
+
configurationServiceLib = inject(ConfigurationServiceLib);
|
|
2269
|
+
toastrService = inject(ToastrService);
|
|
2270
|
+
allConfigValues = this.configurationServiceLib.allConfigValues() || {};
|
|
2271
|
+
constructor() { }
|
|
2272
|
+
formatToTwoDecimalPlaces(value, decimalPlaces) {
|
|
2273
|
+
if (value !== undefined && value !== null) {
|
|
2274
|
+
const numValue = Number(value);
|
|
2275
|
+
if (!isNaN(numValue)) {
|
|
2276
|
+
return numValue.toFixed(decimalPlaces || 2);
|
|
2277
|
+
}
|
|
2278
|
+
}
|
|
2279
|
+
return value?.toString() || '';
|
|
2280
|
+
}
|
|
2281
|
+
// Truncate values to precision
|
|
2282
|
+
truncateFloat(value, precision) {
|
|
2283
|
+
const num = Number(value);
|
|
2284
|
+
if (isNaN(num))
|
|
2285
|
+
return '';
|
|
2286
|
+
const factor = Math.pow(10, precision);
|
|
2287
|
+
const truncated = Math.trunc(num * factor) / factor;
|
|
2288
|
+
return truncated.toFixed(precision);
|
|
2289
|
+
}
|
|
2290
|
+
/**
|
|
2291
|
+
*
|
|
2292
|
+
* @param excelData Table data to export
|
|
2293
|
+
* @param columns Array of Column keys and label '{ keys: '_key', label: '_label' }'
|
|
2294
|
+
* @param excelFileName Name of the excel file 'Example FileName_export_1740978888354'
|
|
2295
|
+
* @param headers (Optional) Adds Extra headings on top of the columns
|
|
2296
|
+
* @param showTotalValueCols (Optional) Calculates and shows the total of all the values of that column
|
|
2297
|
+
* @param columnAlignment (Optional) Aligns the cell value (currently only to right side)
|
|
2298
|
+
*/
|
|
2299
|
+
async exportAsExcelFile(excelData, columns, excelFileName, headers, showTotalValueCols, columnAlignment) {
|
|
2300
|
+
// this.loaderService.show();
|
|
2301
|
+
const workbook = new ExcelJS.Workbook();
|
|
2302
|
+
const worksheet = workbook.addWorksheet(excelFileName);
|
|
2303
|
+
// const currentRow = 1;
|
|
2304
|
+
// if (headers) {
|
|
2305
|
+
// headers.forEach((header: IExcelHeaders) => {
|
|
2306
|
+
// worksheet.mergeCells(`A${currentRow}:K${currentRow}`);
|
|
2307
|
+
// worksheet.getCell(`A${currentRow}`).value = header.heading;
|
|
2308
|
+
// worksheet.getCell(`A${currentRow}`).alignment = { horizontal: header.alignment, wrapText: true };
|
|
2309
|
+
// worksheet.getCell(`A${currentRow}`).font = { bold: header.bold, size: header.fontSize || 14 };
|
|
2310
|
+
// currentRow++;
|
|
2311
|
+
// });
|
|
2312
|
+
// worksheet.addRow({});
|
|
2313
|
+
// }
|
|
2314
|
+
const columnLabels = columns.map(col => col.label);
|
|
2315
|
+
const columnKeys = columns.map(col => col.key);
|
|
2316
|
+
const headerRow = worksheet.addRow(columnLabels);
|
|
2317
|
+
headerRow.eachCell(cell => {
|
|
2318
|
+
cell.font = { bold: true, size: 12 };
|
|
2319
|
+
});
|
|
2320
|
+
// Prepare worksheet data and add it to the worksheet
|
|
2321
|
+
const worksheetData = this.prepareWorksheetData(excelData, columns);
|
|
2322
|
+
worksheetData.forEach(dataRow => {
|
|
2323
|
+
const rowInstance = worksheet.addRow(Object.values(dataRow));
|
|
2324
|
+
// Align specific columns based on columnAlignment parameter
|
|
2325
|
+
if (columnAlignment?.align === 'end' && columnAlignment.headers.length > 0) {
|
|
2326
|
+
rowInstance.eachCell((cell, colNumber) => {
|
|
2327
|
+
const columnKey = columnKeys[colNumber - 1]; // Match index with headers
|
|
2328
|
+
if (columnAlignment.headers.includes(columnKey)) {
|
|
2329
|
+
cell.alignment = { horizontal: 'right' };
|
|
2330
|
+
}
|
|
2331
|
+
});
|
|
2332
|
+
}
|
|
2333
|
+
});
|
|
2334
|
+
// Calculate total for specified columns
|
|
2335
|
+
if (showTotalValueCols && showTotalValueCols.length > 0) {
|
|
2336
|
+
const totalRow = {};
|
|
2337
|
+
columns.forEach(col => {
|
|
2338
|
+
if (showTotalValueCols.includes(col.key)) {
|
|
2339
|
+
totalRow[col.label] = excelData.reduce((sum, row) => sum + (Number(row[col.key]) || 0), 0);
|
|
2340
|
+
}
|
|
2341
|
+
else {
|
|
2342
|
+
totalRow[col.label] = ''; // Empty for non-total columns
|
|
2343
|
+
}
|
|
2344
|
+
});
|
|
2345
|
+
const totalRowInstance = worksheet.addRow(Object.values(totalRow));
|
|
2346
|
+
totalRowInstance.eachCell((cell, colNumber) => {
|
|
2347
|
+
cell.font = { bold: true, color: { argb: '000' }, size: 12 };
|
|
2348
|
+
cell.alignment = { horizontal: 'left' };
|
|
2349
|
+
cell.fill = { type: 'pattern', pattern: 'solid', fgColor: { argb: 'FFFF00' } };
|
|
2350
|
+
cell.border = { top: { style: 'thin' }, left: { style: 'thin' }, bottom: { style: 'thin' }, right: { style: 'thin' } };
|
|
2351
|
+
// Apply right alignment for specified total columns
|
|
2352
|
+
const columnKey = columnKeys[colNumber - 1];
|
|
2353
|
+
if (columnAlignment?.headers.includes(columnKey)) {
|
|
2354
|
+
cell.alignment = { horizontal: 'right' };
|
|
2355
|
+
}
|
|
2356
|
+
});
|
|
2357
|
+
}
|
|
2358
|
+
// Set column widths
|
|
2359
|
+
columns.forEach((col, index) => {
|
|
2360
|
+
worksheet.getColumn(index + 1).width = 15;
|
|
2361
|
+
});
|
|
2362
|
+
// Generate Excel file and save
|
|
2363
|
+
const buffer = await workbook.xlsx.writeBuffer();
|
|
2364
|
+
this.saveAsExcelFile(buffer, excelFileName);
|
|
2365
|
+
}
|
|
2366
|
+
/** Prepare Data for Excel Export*/
|
|
2367
|
+
prepareWorksheetData(data, columns) {
|
|
2368
|
+
const rows = data.map(row => {
|
|
2369
|
+
const formattedRow = {};
|
|
2370
|
+
columns.forEach(col => {
|
|
2371
|
+
formattedRow[col.label] = row[col.key];
|
|
2372
|
+
});
|
|
2373
|
+
return formattedRow;
|
|
2374
|
+
});
|
|
2375
|
+
return [...rows];
|
|
2376
|
+
}
|
|
2377
|
+
/** Save Buffer File */
|
|
2378
|
+
saveAsExcelFile(buffer, fileName) {
|
|
2379
|
+
const data = new Blob([buffer], { type: ExcelType.excelBlobType });
|
|
2380
|
+
const url = window.URL.createObjectURL(data);
|
|
2381
|
+
const link = document.createElement('a');
|
|
2382
|
+
link.href = url;
|
|
2383
|
+
const unique = Math.random().toString(36).substring(2, 8).toUpperCase();
|
|
2384
|
+
link.download = `${fileName}_${convertIsoToFormat(new Date())}_${unique}.${ExcelType.xlsxBookType}`;
|
|
2385
|
+
document.body.appendChild(link);
|
|
2386
|
+
link.click();
|
|
2387
|
+
document.body.removeChild(link);
|
|
2388
|
+
window.URL.revokeObjectURL(url);
|
|
2389
|
+
setTimeout(() => {
|
|
2390
|
+
// this.loaderService.hide();
|
|
2391
|
+
this.toastrService.success(`${link.download} file downloaded successfully`, 'Success');
|
|
2392
|
+
}, 500);
|
|
2393
|
+
}
|
|
2394
|
+
/** Print Page Status Report */
|
|
2395
|
+
printHTMLTable(columns, data, headers, showTotalValueCols) {
|
|
2396
|
+
let headersAndHeadings = '';
|
|
2397
|
+
if (headers) {
|
|
2398
|
+
headersAndHeadings = this.generateHeaderHTML(headers);
|
|
2399
|
+
}
|
|
2400
|
+
const headerHTML = `<tr>${columns
|
|
2401
|
+
.map(col => `<th style="border: 1px solid #ddd; padding: 8px; background-color: #f2f2f2;">${col.label}</th>`)
|
|
2402
|
+
.join('')}</tr>`;
|
|
2403
|
+
const bodyHTML = data
|
|
2404
|
+
.map((row, index) => {
|
|
2405
|
+
const rowStyle = index % 2 === 0 ? 'background-color: #f9f9f9;' : 'background-color: #e9ecef;';
|
|
2406
|
+
const rowHTML = columns
|
|
2407
|
+
.map(col => {
|
|
2408
|
+
const cellBackground = col.key === 'page_status_name' ? `background-color: ${row?.html_color || ''};` : '';
|
|
2409
|
+
return `<td style="border: 1px solid #ddd; padding: 8px; ${cellBackground}}">${row[col.key] !== null ? row[col.key] : ''}</td>`;
|
|
2410
|
+
})
|
|
2411
|
+
.join('');
|
|
2412
|
+
return `<tr style="${rowStyle}">${rowHTML}</tr>`;
|
|
2413
|
+
})
|
|
2414
|
+
.join('');
|
|
2415
|
+
// Generate Footer Row with Totals
|
|
2416
|
+
let footerHTML = '';
|
|
2417
|
+
if (showTotalValueCols && showTotalValueCols.length > 0) {
|
|
2418
|
+
const totalRow = columns
|
|
2419
|
+
.map(col => {
|
|
2420
|
+
if (showTotalValueCols.includes(col.key)) {
|
|
2421
|
+
const total = data.reduce((sum, row) => sum + (Number(row[col.key]) || 0), 0);
|
|
2422
|
+
return `<td style="border: 1px solid #ddd; padding: 8px; background-color: yellow; font-weight: bold;">${this.formatToTwoDecimalPlaces(total)}</td>`;
|
|
2423
|
+
}
|
|
2424
|
+
return `<td style="border: 1px solid #ddd; padding: 8px; background-color: yellow;"></td>`; // Empty but styled
|
|
2425
|
+
})
|
|
2426
|
+
.join('');
|
|
2427
|
+
footerHTML = `<tr>${totalRow}</tr>`;
|
|
2428
|
+
}
|
|
2429
|
+
const tableHTML = `
|
|
2430
|
+
<table style="width: 100%; border-collapse: collapse;">
|
|
2431
|
+
<thead>${headerHTML}</thead>
|
|
2432
|
+
<tbody>${bodyHTML}</tbody>
|
|
2433
|
+
<tfoot>${footerHTML}</tfoot>
|
|
2434
|
+
</table>
|
|
2435
|
+
`;
|
|
2436
|
+
// Create a new window for printing
|
|
2437
|
+
const printWindow = window.open('', '', 'width=800, height=600');
|
|
2438
|
+
if (printWindow) {
|
|
2439
|
+
printWindow.document.write(`
|
|
2440
|
+
<html>
|
|
2441
|
+
<head>
|
|
2442
|
+
<style>
|
|
2443
|
+
@media print {
|
|
2444
|
+
@page {
|
|
2445
|
+
size: landscape;
|
|
2446
|
+
}
|
|
2447
|
+
body {
|
|
2448
|
+
-webkit-print-color-adjust: exact;
|
|
2449
|
+
print-color-adjust: exact;
|
|
2450
|
+
}
|
|
2451
|
+
table { width: 100%; border-collapse: collapse; }
|
|
2452
|
+
th, td { border: 1px solid black; padding: 10px; }
|
|
2453
|
+
th { background-color: #f2f2f2; }
|
|
2454
|
+
p { margin: 0; padding: 0; }
|
|
2455
|
+
}
|
|
2456
|
+
</style>
|
|
2457
|
+
</head>
|
|
2458
|
+
<body>
|
|
2459
|
+
<title>Report</title>
|
|
2460
|
+
${headersAndHeadings}
|
|
2461
|
+
${tableHTML}
|
|
2462
|
+
<script type="text/javascript">
|
|
2463
|
+
window.onload = function() {
|
|
2464
|
+
window.print();
|
|
2465
|
+
window.onafterprint = window.close();
|
|
2466
|
+
};
|
|
2467
|
+
</script>
|
|
2468
|
+
</body>
|
|
2469
|
+
</html>
|
|
2470
|
+
`);
|
|
2471
|
+
printWindow.document.close();
|
|
2472
|
+
printWindow.focus();
|
|
2473
|
+
}
|
|
2474
|
+
}
|
|
2475
|
+
// Function to generate header HTML from headers array
|
|
2476
|
+
generateHeaderHTML(headers) {
|
|
2477
|
+
return headers
|
|
2478
|
+
.map(header => {
|
|
2479
|
+
let style = '';
|
|
2480
|
+
if (header.alignment) {
|
|
2481
|
+
style += `text-align: ${header.alignment};`;
|
|
2482
|
+
}
|
|
2483
|
+
if (header.bold) {
|
|
2484
|
+
style += 'font-weight: bold;';
|
|
2485
|
+
}
|
|
2486
|
+
if (header.fontSize) {
|
|
2487
|
+
style += `font-size: ${header.fontSize}px;`;
|
|
2488
|
+
}
|
|
2489
|
+
if (header.marginBottom) {
|
|
2490
|
+
style += `margin-bottom: ${header.marginBottom}px;`;
|
|
2491
|
+
}
|
|
2492
|
+
if (header.marginTop) {
|
|
2493
|
+
style += `margin-bottom: ${header.marginTop}px;`;
|
|
2494
|
+
}
|
|
2495
|
+
return `<p style="${style}">${header.heading}</p>`;
|
|
2496
|
+
})
|
|
2497
|
+
.join('');
|
|
2498
|
+
}
|
|
2499
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: UtilsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2500
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: UtilsService, providedIn: 'root' });
|
|
2501
|
+
}
|
|
2502
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: UtilsService, decorators: [{
|
|
2503
|
+
type: Injectable,
|
|
2504
|
+
args: [{
|
|
2505
|
+
providedIn: 'root'
|
|
2506
|
+
}]
|
|
2507
|
+
}], ctorParameters: () => [] });
|
|
2508
|
+
|
|
2130
2509
|
/*
|
|
2131
2510
|
* Public API Surface of utils
|
|
2132
2511
|
*/
|
|
@@ -2135,5 +2514,5 @@ class ITableGridPagination {
|
|
|
2135
2514
|
* Generated bundle index. Do not edit.
|
|
2136
2515
|
*/
|
|
2137
2516
|
|
|
2138
|
-
export { CheckboxCellRendererComponent, CircularFocusDirective, ColorCellRendererComponent, CommentsButtonCellRendererComponent, ConfigurationServiceLib, CustomSelectFilterComponent, DecimalInputDirective, EditionListGroupedComponent, FormFieldType, GenericFilterModelComponent, ITableGridConfiguration, ITableGridPagination, IndustryUpdateListboxCellRendererComponent, MultiFormComponent, MultiFormModule, MultiSelectStylerDirective, PageStatusCellRendererComponent, ShowTooltipIfTruncatedDirective, StatusSelectCellRendererComponent, TableGridComponent, TableGridModule };
|
|
2517
|
+
export { BackgroundImageDirective, CheckboxCellRendererComponent, CircularFocusDirective, ColorCellRendererComponent, CommentsButtonCellRendererComponent, ConfigurationServiceLib, CustomSelectFilterComponent, DecimalInputDirective, EditionListGroupedComponent, ExcelType, ExportToExcelNames, FormFieldType, GenericFilterModelComponent, ITableGridConfiguration, ITableGridPagination, IndustryUpdateListboxCellRendererComponent, MultiFormComponent, MultiFormModule, MultiSelectStylerDirective, PageStatusCellRendererComponent, ShowTooltipIfTruncatedDirective, StatusSelectCellRendererComponent, TableGridComponent, TableGridModule, UtilsService, convertDateShort, convertIsoToFormat, convertToISOnString, regionalDateFormat };
|
|
2139
2518
|
//# sourceMappingURL=pongrass-utils.mjs.map
|