@porscheinformatik/clr-addons 19.9.0 → 19.9.2
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/clr-addons.module.d.ts +2 -3
- package/export-datagrid-button/export-datagrid.service.d.ts +3 -0
- package/fesm2022/clr-addons.mjs +142 -138
- package/fesm2022/clr-addons.mjs.map +1 -1
- package/package.json +1 -1
- package/styles/clr-addons-phs.css +16 -6
- package/styles/clr-addons-phs.css.map +1 -1
- package/styles/clr-addons-phs.min.css +1 -1
- package/styles/clr-addons-phs.min.css.map +1 -1
package/clr-addons.module.d.ts
CHANGED
|
@@ -33,10 +33,9 @@ import * as i31 from "./daterangepicker/daterangepicker.module";
|
|
|
33
33
|
import * as i32 from "./clr-control-warning/if-warning.module";
|
|
34
34
|
import * as i33 from "./action-panel/action-panel.module";
|
|
35
35
|
import * as i34 from "./readonly/readonly.module";
|
|
36
|
-
import * as i35 from "./
|
|
37
|
-
import * as i36 from "./datagrid/column-reorder/datagrid-column-reorder.module";
|
|
36
|
+
import * as i35 from "./datagrid/column-reorder/datagrid-column-reorder.module";
|
|
38
37
|
export declare class ClrAddonsModule {
|
|
39
38
|
static ɵfac: i0.ɵɵFactoryDeclaration<ClrAddonsModule, never>;
|
|
40
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<ClrAddonsModule, never, never, [typeof i1.ClrViewEditSectionModule, typeof i2.ClrPagerModule, typeof i3.ClrDotPagerModule, typeof i4.ClrPagedSearchResultListModule, typeof i5.ClrCollapseExpandSectionModule, typeof i6.ClrBreadcrumbModule, typeof i7.ClrMainNavGroupModule, typeof i8.ClrContentPanelModule, typeof i9.ClrNotificationModule, typeof i10.ClrFlowBarModule, typeof i11.ClrBackButtonModule, typeof i12.ClrNumericFieldModule, typeof i13.ClrSearchFieldModule, typeof i14.ClrTreetableModule, typeof i15.ClrProgressSpinnerModule, typeof i16.ClrDateTimeModule, typeof i17.ClrQuickListModule, typeof i18.ClrLetterAvatarModule, typeof i19.ClrMultilingualModule, typeof i20.ClrGenericQuickListModule, typeof i21.ClrDataListValidatorModule, typeof i22.ClrHistoryModule, typeof i23.ClrAutocompleteOffModule, typeof i24.ClrBrandAvatarModule, typeof i25.ClrLocationBarModule, typeof i26.ClrFormModule, typeof i27.ClrDropdownOverflowModule, typeof i28.ClrDatagridStatePersistenceModule, typeof i29.ClrEnumFilterModule, typeof i30.ClrDateFilterModule, typeof i31.ClrDaterangepickerModule, typeof i32.ClrIfWarningModule, typeof i33.ClrActionPanelModule, typeof i34.ClrReadonlyDirectiveModule, typeof i35.
|
|
39
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<ClrAddonsModule, never, never, [typeof i1.ClrViewEditSectionModule, typeof i2.ClrPagerModule, typeof i3.ClrDotPagerModule, typeof i4.ClrPagedSearchResultListModule, typeof i5.ClrCollapseExpandSectionModule, typeof i6.ClrBreadcrumbModule, typeof i7.ClrMainNavGroupModule, typeof i8.ClrContentPanelModule, typeof i9.ClrNotificationModule, typeof i10.ClrFlowBarModule, typeof i11.ClrBackButtonModule, typeof i12.ClrNumericFieldModule, typeof i13.ClrSearchFieldModule, typeof i14.ClrTreetableModule, typeof i15.ClrProgressSpinnerModule, typeof i16.ClrDateTimeModule, typeof i17.ClrQuickListModule, typeof i18.ClrLetterAvatarModule, typeof i19.ClrMultilingualModule, typeof i20.ClrGenericQuickListModule, typeof i21.ClrDataListValidatorModule, typeof i22.ClrHistoryModule, typeof i23.ClrAutocompleteOffModule, typeof i24.ClrBrandAvatarModule, typeof i25.ClrLocationBarModule, typeof i26.ClrFormModule, typeof i27.ClrDropdownOverflowModule, typeof i28.ClrDatagridStatePersistenceModule, typeof i29.ClrEnumFilterModule, typeof i30.ClrDateFilterModule, typeof i31.ClrDaterangepickerModule, typeof i32.ClrIfWarningModule, typeof i33.ClrActionPanelModule, typeof i34.ClrReadonlyDirectiveModule, typeof i35.ClrDatagridColumnReorderModule]>;
|
|
41
40
|
static ɵinj: i0.ɵɵInjectorDeclaration<ClrAddonsModule>;
|
|
42
41
|
}
|
package/fesm2022/clr-addons.mjs
CHANGED
|
@@ -16,7 +16,6 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
|
16
16
|
import * as i1$1 from '@angular/common/http';
|
|
17
17
|
import '@cds/core/icon/register.js';
|
|
18
18
|
import { CdkDropList, moveItemInArray } from '@angular/cdk/drag-drop';
|
|
19
|
-
import zipcelx from 'zipcelx';
|
|
20
19
|
|
|
21
20
|
/*
|
|
22
21
|
* Copyright (c) 2018-2025 Porsche Informatik. All Rights Reserved.
|
|
@@ -14702,140 +14701,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImpor
|
|
|
14702
14701
|
}]
|
|
14703
14702
|
}] });
|
|
14704
14703
|
|
|
14705
|
-
class ExportDatagridService {
|
|
14706
|
-
exportToExcel(filename, headers, rows) {
|
|
14707
|
-
const config = {
|
|
14708
|
-
filename,
|
|
14709
|
-
sheet: {
|
|
14710
|
-
data: [headers, ...rows],
|
|
14711
|
-
},
|
|
14712
|
-
};
|
|
14713
|
-
zipcelx(config);
|
|
14714
|
-
}
|
|
14715
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: ExportDatagridService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
14716
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: ExportDatagridService, providedIn: 'root' }); }
|
|
14717
|
-
}
|
|
14718
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: ExportDatagridService, decorators: [{
|
|
14719
|
-
type: Injectable,
|
|
14720
|
-
args: [{
|
|
14721
|
-
providedIn: 'root',
|
|
14722
|
-
}]
|
|
14723
|
-
}] });
|
|
14724
|
-
|
|
14725
|
-
var ExportTypeEnum;
|
|
14726
|
-
(function (ExportTypeEnum) {
|
|
14727
|
-
ExportTypeEnum["ALL"] = "ALL";
|
|
14728
|
-
ExportTypeEnum["FILTERED"] = "FILTERED";
|
|
14729
|
-
ExportTypeEnum["SELECTED"] = "SELECTED";
|
|
14730
|
-
})(ExportTypeEnum || (ExportTypeEnum = {}));
|
|
14731
|
-
|
|
14732
|
-
class ExportDatagridButtonComponent {
|
|
14733
|
-
constructor(exportService) {
|
|
14734
|
-
this.exportService = exportService;
|
|
14735
|
-
/* input signals */
|
|
14736
|
-
this.datagrid = input();
|
|
14737
|
-
this.datagridRef = input();
|
|
14738
|
-
this.exportTypesToShow = input();
|
|
14739
|
-
this.isBackendExport = input(false);
|
|
14740
|
-
this.exportTitlePrefix = input('export-datagrid');
|
|
14741
|
-
this.exportButtonPosition = input('right');
|
|
14742
|
-
/* outputs */
|
|
14743
|
-
this.backendExport = new EventEmitter();
|
|
14744
|
-
this.exportTypes = [
|
|
14745
|
-
{ type: ExportTypeEnum.ALL, value: 'All entries' },
|
|
14746
|
-
{ type: ExportTypeEnum.FILTERED, value: 'Filtered entries' },
|
|
14747
|
-
{ type: ExportTypeEnum.SELECTED, value: 'Selected entries' },
|
|
14748
|
-
];
|
|
14749
|
-
this.exportTypesFiltered = computed(() => {
|
|
14750
|
-
const exportTypesToShowVal = this.exportTypesToShow();
|
|
14751
|
-
if (!exportTypesToShowVal || exportTypesToShowVal.length === 0) {
|
|
14752
|
-
return this.exportTypes;
|
|
14753
|
-
}
|
|
14754
|
-
// Map to translated value, falling back to default if value is not provided
|
|
14755
|
-
return exportTypesToShowVal.map(showType => {
|
|
14756
|
-
const defaultType = this.exportTypes.find(et => et.type === showType.type);
|
|
14757
|
-
return {
|
|
14758
|
-
type: showType.type,
|
|
14759
|
-
value: showType.value != null ? showType.value : defaultType?.value,
|
|
14760
|
-
};
|
|
14761
|
-
});
|
|
14762
|
-
});
|
|
14763
|
-
}
|
|
14764
|
-
exportExcel(type) {
|
|
14765
|
-
if (!this.datagrid() || !this.datagridRef()) {
|
|
14766
|
-
return;
|
|
14767
|
-
}
|
|
14768
|
-
// Filter visible columns once
|
|
14769
|
-
const visibleColumns = this.datagrid().columns.filter(col => !col.isHidden);
|
|
14770
|
-
// Get header titles for visible columns only
|
|
14771
|
-
const headerRow = this.getColumnsTitle().map(title => ({
|
|
14772
|
-
value: title,
|
|
14773
|
-
type: 'string',
|
|
14774
|
-
}));
|
|
14775
|
-
const rowsToExport = this.getRowsToExport(type);
|
|
14776
|
-
// Map data rows for visible columns only
|
|
14777
|
-
const dataRows = rowsToExport.map(row => visibleColumns.map(col => ({
|
|
14778
|
-
value: String(row[col.field] ?? ''),
|
|
14779
|
-
type: col.colType,
|
|
14780
|
-
})));
|
|
14781
|
-
this.exportService.exportToExcel(this.exportTitlePrefix(), headerRow, dataRows);
|
|
14782
|
-
}
|
|
14783
|
-
onExport(type) {
|
|
14784
|
-
if (this.isBackendExport()) {
|
|
14785
|
-
this.backendExport.emit(type);
|
|
14786
|
-
}
|
|
14787
|
-
else {
|
|
14788
|
-
this.exportExcel(type);
|
|
14789
|
-
}
|
|
14790
|
-
}
|
|
14791
|
-
getRowsToExport(type) {
|
|
14792
|
-
switch (type) {
|
|
14793
|
-
case ExportTypeEnum.ALL:
|
|
14794
|
-
return this.datagrid()?.items.all ?? [];
|
|
14795
|
-
case ExportTypeEnum.FILTERED:
|
|
14796
|
-
return this.datagrid()?.items.displayed ?? [];
|
|
14797
|
-
case ExportTypeEnum.SELECTED:
|
|
14798
|
-
return this.datagrid()?.selection.current ?? [];
|
|
14799
|
-
default:
|
|
14800
|
-
return [];
|
|
14801
|
-
}
|
|
14802
|
-
}
|
|
14803
|
-
getColumnsTitle() {
|
|
14804
|
-
const nativeEl = this.datagridRef()?.nativeElement;
|
|
14805
|
-
const headerEls = nativeEl?.querySelectorAll('clr-dg-column:not(.datagrid-hidden-column)') ?? [];
|
|
14806
|
-
const columnTitles = [];
|
|
14807
|
-
headerEls.forEach(columnEl => {
|
|
14808
|
-
const titleButton = columnEl.querySelector('button.datagrid-column-title');
|
|
14809
|
-
if (titleButton) {
|
|
14810
|
-
columnTitles.push(titleButton.textContent?.trim() ?? '');
|
|
14811
|
-
}
|
|
14812
|
-
});
|
|
14813
|
-
return columnTitles;
|
|
14814
|
-
}
|
|
14815
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: ExportDatagridButtonComponent, deps: [{ token: ExportDatagridService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
14816
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: ExportDatagridButtonComponent, isStandalone: true, selector: "clr-export-datagrid-button", inputs: { datagrid: { classPropertyName: "datagrid", publicName: "datagrid", isSignal: true, isRequired: false, transformFunction: null }, datagridRef: { classPropertyName: "datagridRef", publicName: "datagridRef", isSignal: true, isRequired: false, transformFunction: null }, exportTypesToShow: { classPropertyName: "exportTypesToShow", publicName: "exportTypesToShow", isSignal: true, isRequired: false, transformFunction: null }, isBackendExport: { classPropertyName: "isBackendExport", publicName: "isBackendExport", isSignal: true, isRequired: false, transformFunction: null }, exportTitlePrefix: { classPropertyName: "exportTitlePrefix", publicName: "exportTitlePrefix", isSignal: true, isRequired: false, transformFunction: null }, exportButtonPosition: { classPropertyName: "exportButtonPosition", publicName: "exportButtonPosition", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { backendExport: "backendExport" }, ngImport: i0, template: "<div\n [ngClass]=\"{\n 'export-btn-right': exportButtonPosition() === 'right',\n 'export-btn-left': exportButtonPosition() === 'left'\n }\"\n>\n <ng-container *ngIf=\"exportTypesFiltered().length === 1; else exportDropdown\">\n <button class=\"btn btn-sm btn-outline\" type=\"button\" (click)=\"onExport(exportTypesFiltered()[0].type)\">\n {{ exportTypesFiltered()[0].value }}\n </button>\n </ng-container>\n <ng-template #exportDropdown>\n <clr-dropdown>\n <button class=\"btn btn-sm btn-outline\" clrDropdownTrigger type=\"button\">\n Export\n <cds-icon shape=\"angle\" direction=\"down\" size=\"12\"></cds-icon>\n </button>\n <clr-dropdown-menu *clrIfOpen clrPosition=\"bottom-right\">\n <button *ngFor=\"let exportType of exportTypesFiltered()\" (click)=\"onExport(exportType.type)\" clrDropdownItem>\n {{ exportType.value }}\n </button>\n </clr-dropdown-menu>\n </clr-dropdown>\n </ng-template>\n</div>\n", styles: [".export-btn-right{display:flex;justify-content:flex-end}.export-btn-left{display:flex;justify-content:flex-start}\n"], dependencies: [{ kind: "ngmodule", type: ClarityModule }, { kind: "directive", type: i2.CdsIconCustomTag, selector: "cds-icon" }, { kind: "directive", type: i2.ClrIfOpen, selector: "[clrIfOpen]", inputs: ["clrIfOpen"], outputs: ["clrIfOpenChange"] }, { kind: "component", type: i2.ClrDropdown, selector: "clr-dropdown", inputs: ["clrCloseMenuOnItemClick"] }, { kind: "component", type: i2.ClrDropdownMenu, selector: "clr-dropdown-menu", inputs: ["clrPosition"] }, { kind: "directive", type: i2.ClrDropdownTrigger, selector: "[clrDropdownTrigger],[clrDropdownToggle]" }, { kind: "directive", type: i2.ClrDropdownItem, selector: "[clrDropdownItem]", inputs: ["clrDisabled", "id"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] }); }
|
|
14817
|
-
}
|
|
14818
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: ExportDatagridButtonComponent, decorators: [{
|
|
14819
|
-
type: Component,
|
|
14820
|
-
args: [{ selector: 'clr-export-datagrid-button', standalone: true, imports: [ClarityModule, NgIf, NgForOf, NgClass], template: "<div\n [ngClass]=\"{\n 'export-btn-right': exportButtonPosition() === 'right',\n 'export-btn-left': exportButtonPosition() === 'left'\n }\"\n>\n <ng-container *ngIf=\"exportTypesFiltered().length === 1; else exportDropdown\">\n <button class=\"btn btn-sm btn-outline\" type=\"button\" (click)=\"onExport(exportTypesFiltered()[0].type)\">\n {{ exportTypesFiltered()[0].value }}\n </button>\n </ng-container>\n <ng-template #exportDropdown>\n <clr-dropdown>\n <button class=\"btn btn-sm btn-outline\" clrDropdownTrigger type=\"button\">\n Export\n <cds-icon shape=\"angle\" direction=\"down\" size=\"12\"></cds-icon>\n </button>\n <clr-dropdown-menu *clrIfOpen clrPosition=\"bottom-right\">\n <button *ngFor=\"let exportType of exportTypesFiltered()\" (click)=\"onExport(exportType.type)\" clrDropdownItem>\n {{ exportType.value }}\n </button>\n </clr-dropdown-menu>\n </clr-dropdown>\n </ng-template>\n</div>\n", styles: [".export-btn-right{display:flex;justify-content:flex-end}.export-btn-left{display:flex;justify-content:flex-start}\n"] }]
|
|
14821
|
-
}], ctorParameters: () => [{ type: ExportDatagridService }], propDecorators: { backendExport: [{
|
|
14822
|
-
type: Output
|
|
14823
|
-
}] } });
|
|
14824
|
-
|
|
14825
|
-
class ClrExportDatagridButtonModule {
|
|
14826
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: ClrExportDatagridButtonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
14827
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.6", ngImport: i0, type: ClrExportDatagridButtonModule, imports: [ExportDatagridButtonComponent], exports: [ExportDatagridButtonComponent] }); }
|
|
14828
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: ClrExportDatagridButtonModule, providers: [ExportDatagridService], imports: [ExportDatagridButtonComponent] }); }
|
|
14829
|
-
}
|
|
14830
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: ClrExportDatagridButtonModule, decorators: [{
|
|
14831
|
-
type: NgModule,
|
|
14832
|
-
args: [{
|
|
14833
|
-
imports: [ExportDatagridButtonComponent],
|
|
14834
|
-
exports: [ExportDatagridButtonComponent],
|
|
14835
|
-
providers: [ExportDatagridService],
|
|
14836
|
-
}]
|
|
14837
|
-
}] });
|
|
14838
|
-
|
|
14839
14704
|
/*
|
|
14840
14705
|
* Copyright (c) 2018-2025 Porsche Informatik. All Rights Reserved.
|
|
14841
14706
|
* This software is released under MIT license.
|
|
@@ -14877,7 +14742,6 @@ class ClrAddonsModule {
|
|
|
14877
14742
|
ClrIfWarningModule,
|
|
14878
14743
|
ClrActionPanelModule,
|
|
14879
14744
|
ClrReadonlyDirectiveModule,
|
|
14880
|
-
ClrExportDatagridButtonModule,
|
|
14881
14745
|
ClrDatagridColumnReorderModule] }); }
|
|
14882
14746
|
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: ClrAddonsModule, imports: [ClrViewEditSectionModule,
|
|
14883
14747
|
ClrPagerModule,
|
|
@@ -14913,7 +14777,6 @@ class ClrAddonsModule {
|
|
|
14913
14777
|
ClrIfWarningModule,
|
|
14914
14778
|
ClrActionPanelModule,
|
|
14915
14779
|
ClrReadonlyDirectiveModule,
|
|
14916
|
-
ClrExportDatagridButtonModule,
|
|
14917
14780
|
ClrDatagridColumnReorderModule] }); }
|
|
14918
14781
|
}
|
|
14919
14782
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: ClrAddonsModule, decorators: [{
|
|
@@ -14954,7 +14817,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImpor
|
|
|
14954
14817
|
ClrIfWarningModule,
|
|
14955
14818
|
ClrActionPanelModule,
|
|
14956
14819
|
ClrReadonlyDirectiveModule,
|
|
14957
|
-
ClrExportDatagridButtonModule,
|
|
14958
14820
|
ClrDatagridColumnReorderModule,
|
|
14959
14821
|
],
|
|
14960
14822
|
}]
|
|
@@ -14966,6 +14828,148 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImpor
|
|
|
14966
14828
|
* The full license information can be found in LICENSE in the root directory of this project.
|
|
14967
14829
|
*/
|
|
14968
14830
|
|
|
14831
|
+
var ExportTypeEnum;
|
|
14832
|
+
(function (ExportTypeEnum) {
|
|
14833
|
+
ExportTypeEnum["ALL"] = "ALL";
|
|
14834
|
+
ExportTypeEnum["FILTERED"] = "FILTERED";
|
|
14835
|
+
ExportTypeEnum["SELECTED"] = "SELECTED";
|
|
14836
|
+
})(ExportTypeEnum || (ExportTypeEnum = {}));
|
|
14837
|
+
|
|
14838
|
+
class ExportDatagridService {
|
|
14839
|
+
constructor() {
|
|
14840
|
+
this.init();
|
|
14841
|
+
}
|
|
14842
|
+
async init() {
|
|
14843
|
+
try {
|
|
14844
|
+
this.zipcelx = await import('zipcelx');
|
|
14845
|
+
}
|
|
14846
|
+
catch (error) {
|
|
14847
|
+
console.warn('Optional feature requires `zipcelx`. Please install it: npm install zipcelx', error);
|
|
14848
|
+
}
|
|
14849
|
+
}
|
|
14850
|
+
exportToExcel(filename, headers, rows) {
|
|
14851
|
+
const config = {
|
|
14852
|
+
filename,
|
|
14853
|
+
sheet: {
|
|
14854
|
+
data: [headers, ...rows],
|
|
14855
|
+
},
|
|
14856
|
+
};
|
|
14857
|
+
this.zipcelx.default(config);
|
|
14858
|
+
}
|
|
14859
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: ExportDatagridService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
14860
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: ExportDatagridService }); }
|
|
14861
|
+
}
|
|
14862
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: ExportDatagridService, decorators: [{
|
|
14863
|
+
type: Injectable
|
|
14864
|
+
}], ctorParameters: () => [] });
|
|
14865
|
+
|
|
14866
|
+
class ExportDatagridButtonComponent {
|
|
14867
|
+
constructor(exportService) {
|
|
14868
|
+
this.exportService = exportService;
|
|
14869
|
+
/* input signals */
|
|
14870
|
+
this.datagrid = input();
|
|
14871
|
+
this.datagridRef = input();
|
|
14872
|
+
this.exportTypesToShow = input();
|
|
14873
|
+
this.isBackendExport = input(false);
|
|
14874
|
+
this.exportTitlePrefix = input('export-datagrid');
|
|
14875
|
+
this.exportButtonPosition = input('right');
|
|
14876
|
+
/* outputs */
|
|
14877
|
+
this.backendExport = new EventEmitter();
|
|
14878
|
+
this.exportTypes = [
|
|
14879
|
+
{ type: ExportTypeEnum.ALL, value: 'All entries' },
|
|
14880
|
+
{ type: ExportTypeEnum.FILTERED, value: 'Filtered entries' },
|
|
14881
|
+
{ type: ExportTypeEnum.SELECTED, value: 'Selected entries' },
|
|
14882
|
+
];
|
|
14883
|
+
this.exportTypesFiltered = computed(() => {
|
|
14884
|
+
const exportTypesToShowVal = this.exportTypesToShow();
|
|
14885
|
+
if (!exportTypesToShowVal || exportTypesToShowVal.length === 0) {
|
|
14886
|
+
return this.exportTypes;
|
|
14887
|
+
}
|
|
14888
|
+
// Map to translated value, falling back to default if value is not provided
|
|
14889
|
+
return exportTypesToShowVal.map(showType => {
|
|
14890
|
+
const defaultType = this.exportTypes.find(et => et.type === showType.type);
|
|
14891
|
+
return {
|
|
14892
|
+
type: showType.type,
|
|
14893
|
+
value: showType.value != null ? showType.value : defaultType?.value,
|
|
14894
|
+
};
|
|
14895
|
+
});
|
|
14896
|
+
});
|
|
14897
|
+
}
|
|
14898
|
+
exportExcel(type) {
|
|
14899
|
+
if (!this.datagrid() || !this.datagridRef()) {
|
|
14900
|
+
return;
|
|
14901
|
+
}
|
|
14902
|
+
// Filter visible columns once
|
|
14903
|
+
const visibleColumns = this.datagrid().columns.filter(col => !col.isHidden);
|
|
14904
|
+
// Get header titles for visible columns only
|
|
14905
|
+
const headerRow = this.getColumnsTitle().map(title => ({
|
|
14906
|
+
value: title,
|
|
14907
|
+
type: 'string',
|
|
14908
|
+
}));
|
|
14909
|
+
const rowsToExport = this.getRowsToExport(type);
|
|
14910
|
+
// Map data rows for visible columns only
|
|
14911
|
+
const dataRows = rowsToExport.map(row => visibleColumns.map(col => ({
|
|
14912
|
+
value: String(row[col.field] ?? ''),
|
|
14913
|
+
type: col.colType,
|
|
14914
|
+
})));
|
|
14915
|
+
this.exportService.exportToExcel(this.exportTitlePrefix(), headerRow, dataRows);
|
|
14916
|
+
}
|
|
14917
|
+
onExport(type) {
|
|
14918
|
+
if (this.isBackendExport()) {
|
|
14919
|
+
this.backendExport.emit(type);
|
|
14920
|
+
}
|
|
14921
|
+
else {
|
|
14922
|
+
this.exportExcel(type);
|
|
14923
|
+
}
|
|
14924
|
+
}
|
|
14925
|
+
getRowsToExport(type) {
|
|
14926
|
+
switch (type) {
|
|
14927
|
+
case ExportTypeEnum.ALL:
|
|
14928
|
+
return this.datagrid()?.items.all ?? [];
|
|
14929
|
+
case ExportTypeEnum.FILTERED:
|
|
14930
|
+
return this.datagrid()?.items.displayed ?? [];
|
|
14931
|
+
case ExportTypeEnum.SELECTED:
|
|
14932
|
+
return this.datagrid()?.selection.current ?? [];
|
|
14933
|
+
default:
|
|
14934
|
+
return [];
|
|
14935
|
+
}
|
|
14936
|
+
}
|
|
14937
|
+
getColumnsTitle() {
|
|
14938
|
+
const nativeEl = this.datagridRef()?.nativeElement;
|
|
14939
|
+
const headerEls = nativeEl?.querySelectorAll('clr-dg-column:not(.datagrid-hidden-column)') ?? [];
|
|
14940
|
+
const columnTitles = [];
|
|
14941
|
+
headerEls.forEach(columnEl => {
|
|
14942
|
+
const titleButton = columnEl.querySelector('button.datagrid-column-title');
|
|
14943
|
+
if (titleButton) {
|
|
14944
|
+
columnTitles.push(titleButton.textContent?.trim() ?? '');
|
|
14945
|
+
}
|
|
14946
|
+
});
|
|
14947
|
+
return columnTitles;
|
|
14948
|
+
}
|
|
14949
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: ExportDatagridButtonComponent, deps: [{ token: ExportDatagridService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
14950
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.6", type: ExportDatagridButtonComponent, isStandalone: true, selector: "clr-export-datagrid-button", inputs: { datagrid: { classPropertyName: "datagrid", publicName: "datagrid", isSignal: true, isRequired: false, transformFunction: null }, datagridRef: { classPropertyName: "datagridRef", publicName: "datagridRef", isSignal: true, isRequired: false, transformFunction: null }, exportTypesToShow: { classPropertyName: "exportTypesToShow", publicName: "exportTypesToShow", isSignal: true, isRequired: false, transformFunction: null }, isBackendExport: { classPropertyName: "isBackendExport", publicName: "isBackendExport", isSignal: true, isRequired: false, transformFunction: null }, exportTitlePrefix: { classPropertyName: "exportTitlePrefix", publicName: "exportTitlePrefix", isSignal: true, isRequired: false, transformFunction: null }, exportButtonPosition: { classPropertyName: "exportButtonPosition", publicName: "exportButtonPosition", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { backendExport: "backendExport" }, ngImport: i0, template: "<div\n [ngClass]=\"{\n 'export-btn-right': exportButtonPosition() === 'right',\n 'export-btn-left': exportButtonPosition() === 'left'\n }\"\n>\n <ng-container *ngIf=\"exportTypesFiltered().length === 1; else exportDropdown\">\n <button class=\"btn btn-sm btn-outline\" type=\"button\" (click)=\"onExport(exportTypesFiltered()[0].type)\">\n {{ exportTypesFiltered()[0].value }}\n </button>\n </ng-container>\n <ng-template #exportDropdown>\n <clr-dropdown>\n <button class=\"btn btn-sm btn-outline\" clrDropdownTrigger type=\"button\">\n Export\n <cds-icon shape=\"angle\" direction=\"down\" size=\"12\"></cds-icon>\n </button>\n <clr-dropdown-menu *clrIfOpen clrPosition=\"bottom-right\">\n <button *ngFor=\"let exportType of exportTypesFiltered()\" (click)=\"onExport(exportType.type)\" clrDropdownItem>\n {{ exportType.value }}\n </button>\n </clr-dropdown-menu>\n </clr-dropdown>\n </ng-template>\n</div>\n", styles: [".export-btn-right{display:flex;justify-content:flex-end}.export-btn-left{display:flex;justify-content:flex-start}\n"], dependencies: [{ kind: "ngmodule", type: ClarityModule }, { kind: "directive", type: i2.CdsIconCustomTag, selector: "cds-icon" }, { kind: "directive", type: i2.ClrIfOpen, selector: "[clrIfOpen]", inputs: ["clrIfOpen"], outputs: ["clrIfOpenChange"] }, { kind: "component", type: i2.ClrDropdown, selector: "clr-dropdown", inputs: ["clrCloseMenuOnItemClick"] }, { kind: "component", type: i2.ClrDropdownMenu, selector: "clr-dropdown-menu", inputs: ["clrPosition"] }, { kind: "directive", type: i2.ClrDropdownTrigger, selector: "[clrDropdownTrigger],[clrDropdownToggle]" }, { kind: "directive", type: i2.ClrDropdownItem, selector: "[clrDropdownItem]", inputs: ["clrDisabled", "id"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] }); }
|
|
14951
|
+
}
|
|
14952
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: ExportDatagridButtonComponent, decorators: [{
|
|
14953
|
+
type: Component,
|
|
14954
|
+
args: [{ selector: 'clr-export-datagrid-button', standalone: true, imports: [ClarityModule, NgIf, NgForOf, NgClass], template: "<div\n [ngClass]=\"{\n 'export-btn-right': exportButtonPosition() === 'right',\n 'export-btn-left': exportButtonPosition() === 'left'\n }\"\n>\n <ng-container *ngIf=\"exportTypesFiltered().length === 1; else exportDropdown\">\n <button class=\"btn btn-sm btn-outline\" type=\"button\" (click)=\"onExport(exportTypesFiltered()[0].type)\">\n {{ exportTypesFiltered()[0].value }}\n </button>\n </ng-container>\n <ng-template #exportDropdown>\n <clr-dropdown>\n <button class=\"btn btn-sm btn-outline\" clrDropdownTrigger type=\"button\">\n Export\n <cds-icon shape=\"angle\" direction=\"down\" size=\"12\"></cds-icon>\n </button>\n <clr-dropdown-menu *clrIfOpen clrPosition=\"bottom-right\">\n <button *ngFor=\"let exportType of exportTypesFiltered()\" (click)=\"onExport(exportType.type)\" clrDropdownItem>\n {{ exportType.value }}\n </button>\n </clr-dropdown-menu>\n </clr-dropdown>\n </ng-template>\n</div>\n", styles: [".export-btn-right{display:flex;justify-content:flex-end}.export-btn-left{display:flex;justify-content:flex-start}\n"] }]
|
|
14955
|
+
}], ctorParameters: () => [{ type: ExportDatagridService }], propDecorators: { backendExport: [{
|
|
14956
|
+
type: Output
|
|
14957
|
+
}] } });
|
|
14958
|
+
|
|
14959
|
+
class ClrExportDatagridButtonModule {
|
|
14960
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: ClrExportDatagridButtonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
14961
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.6", ngImport: i0, type: ClrExportDatagridButtonModule, imports: [ExportDatagridButtonComponent], exports: [ExportDatagridButtonComponent] }); }
|
|
14962
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: ClrExportDatagridButtonModule, providers: [ExportDatagridService], imports: [ExportDatagridButtonComponent] }); }
|
|
14963
|
+
}
|
|
14964
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: ClrExportDatagridButtonModule, decorators: [{
|
|
14965
|
+
type: NgModule,
|
|
14966
|
+
args: [{
|
|
14967
|
+
imports: [ExportDatagridButtonComponent],
|
|
14968
|
+
exports: [ExportDatagridButtonComponent],
|
|
14969
|
+
providers: [ExportDatagridService],
|
|
14970
|
+
}]
|
|
14971
|
+
}] });
|
|
14972
|
+
|
|
14969
14973
|
/*
|
|
14970
14974
|
* Copyright (c) 2018-2025 Porsche Informatik. All Rights Reserved.
|
|
14971
14975
|
* This software is released under MIT license.
|