@porscheinformatik/clr-addons 19.9.9 → 19.9.10
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ElementRef, EventEmitter } from '@angular/core';
|
|
2
2
|
import { ClrDatagrid } from '@clr/angular';
|
|
3
3
|
import { ExportDatagridService } from './export-datagrid.service';
|
|
4
4
|
import { ExportType, ExportTypeEnum } from './export-type.model';
|
|
@@ -11,12 +11,23 @@ export declare class ExportDatagridButtonComponent {
|
|
|
11
11
|
isBackendExport: import("@angular/core").InputSignal<boolean>;
|
|
12
12
|
exportTitlePrefix: import("@angular/core").InputSignal<string>;
|
|
13
13
|
exportButtonPosition: import("@angular/core").InputSignal<"right" | "left">;
|
|
14
|
+
possibleExportTypes: import("@angular/core").WritableSignal<ExportTypeEnum[]>;
|
|
14
15
|
readonly backendExport: EventEmitter<ExportTypeEnum>;
|
|
15
16
|
readonly exportTypes: ExportType[];
|
|
16
|
-
readonly exportTypesFiltered: import("@angular/core").Signal<
|
|
17
|
+
readonly exportTypesFiltered: import("@angular/core").Signal<{
|
|
18
|
+
type: ExportTypeEnum;
|
|
19
|
+
value: string;
|
|
20
|
+
}[]>;
|
|
17
21
|
constructor(exportService: ExportDatagridService);
|
|
18
22
|
private exportExcel;
|
|
19
23
|
onExport(type: ExportTypeEnum): void;
|
|
24
|
+
/**
|
|
25
|
+
* Updates the possible export types based on the current datagrid state and allowed export types.
|
|
26
|
+
* @param type the export type to update
|
|
27
|
+
* @param shouldExist whether the export type should exist in the possible export types
|
|
28
|
+
* @param exportTypesToShowVal the allowed export types to show
|
|
29
|
+
*/
|
|
30
|
+
private updateExportType;
|
|
20
31
|
private getRowsToExport;
|
|
21
32
|
private getColumnsTitle;
|
|
22
33
|
static ɵfac: i0.ɵɵFactoryDeclaration<ExportDatagridButtonComponent, never>;
|
package/fesm2022/clr-addons.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Component, NgModule, Injectable, EventEmitter,
|
|
2
|
+
import { Component, NgModule, Injectable, EventEmitter, Input, Output, Directive, ViewChild, ContentChildren, TemplateRef, ViewChildren, HostBinding, ElementRef, Renderer2, forwardRef, Inject, ContentChild, Optional, inject, ChangeDetectorRef, output, ChangeDetectionStrategy, DestroyRef, signal, input, IterableDiffers, ViewContainerRef, effect, InjectionToken, isSignal, HostListener, LOCALE_ID, Self, computed } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/common';
|
|
4
4
|
import { CommonModule, DOCUMENT, NgForOf, NgComponentOutlet, NgTemplateOutlet, getLocaleDateFormat, FormatWidth, NgIf, NgClass } from '@angular/common';
|
|
5
5
|
import { ClarityIcons, arrowIcon, angleIcon, timesIcon, trashIcon, plusCircleIcon, exclamationCircleIcon, searchIcon, ellipsisVerticalIcon, pencilIcon, historyIcon as historyIcon$1, treeViewIcon, organizationIcon, calendarIcon, checkCircleIcon, windowCloseIcon, exclamationTriangleIcon } from '@cds/core/icon';
|
|
6
6
|
import * as i2 from '@clr/angular';
|
|
7
|
-
import { ClarityModule, ClrFormsModule, ClrDropdown, ClrForm, ClrAlert,
|
|
7
|
+
import { ClarityModule, ClrFormsModule, ClrDropdown, ClrForm, ClrAlert, ClrAxis, ClrSide, ClrAlignment, ClrPopoverToggleService, ClrPopoverEventsService, ClrPopoverPositionService, ClrIconModule, ClrDropdownModule, ClrDatagrid, ClrDatagridColumn, ClrDatagridSortOrder, DatagridPropertyComparator, ClrDatagridPagination, ClrDatagridFilter, ClrDateContainer, ClrLabel, ClrControlHelper, ClrControlError, ClrControlSuccess, ClrDatepickerModule } from '@clr/angular';
|
|
8
8
|
import * as i3$1 from '@angular/forms';
|
|
9
9
|
import { FormsModule, NG_VALIDATORS, NgControl, NG_VALUE_ACCESSOR, ReactiveFormsModule, FormControl, NgModel } from '@angular/forms';
|
|
10
10
|
import { Subject, BehaviorSubject, timer as timer$1, asyncScheduler, interval, debounceTime, fromEvent, of, tap, switchMap, filter as filter$1, ReplaySubject, takeUntil as takeUntil$1, delay } from 'rxjs';
|
|
@@ -14884,6 +14884,7 @@ class ExportDatagridButtonComponent {
|
|
|
14884
14884
|
this.isBackendExport = input(false);
|
|
14885
14885
|
this.exportTitlePrefix = input('export-datagrid');
|
|
14886
14886
|
this.exportButtonPosition = input('right');
|
|
14887
|
+
this.possibleExportTypes = signal([ExportTypeEnum.ALL]);
|
|
14887
14888
|
/* outputs */
|
|
14888
14889
|
this.backendExport = new EventEmitter();
|
|
14889
14890
|
this.exportTypes = [
|
|
@@ -14892,12 +14893,26 @@ class ExportDatagridButtonComponent {
|
|
|
14892
14893
|
{ type: ExportTypeEnum.SELECTED, value: 'Selected entries' },
|
|
14893
14894
|
];
|
|
14894
14895
|
this.exportTypesFiltered = computed(() => {
|
|
14895
|
-
|
|
14896
|
+
this.possibleExportTypes();
|
|
14897
|
+
let exportTypesToShowVal = this.exportTypesToShow();
|
|
14896
14898
|
if (!exportTypesToShowVal || exportTypesToShowVal.length === 0) {
|
|
14897
|
-
|
|
14899
|
+
exportTypesToShowVal = this.exportTypes;
|
|
14898
14900
|
}
|
|
14901
|
+
for (const column of this.datagrid().columns) {
|
|
14902
|
+
// if a column filter is applied, show the FILTERED export type
|
|
14903
|
+
column.filterValueChange.subscribe((col) => {
|
|
14904
|
+
this.updateExportType(ExportTypeEnum.FILTERED, !!col, exportTypesToShowVal);
|
|
14905
|
+
});
|
|
14906
|
+
}
|
|
14907
|
+
this.datagrid().selectedChanged.subscribe(() => {
|
|
14908
|
+
const hasSelection = this.datagrid().selection.current.length > 0;
|
|
14909
|
+
// if a row is selected, show the SELECTED export type
|
|
14910
|
+
this.updateExportType(ExportTypeEnum.SELECTED, hasSelection, exportTypesToShowVal);
|
|
14911
|
+
});
|
|
14899
14912
|
// Map to translated value, falling back to default if value is not provided
|
|
14900
|
-
return exportTypesToShowVal
|
|
14913
|
+
return exportTypesToShowVal
|
|
14914
|
+
.filter(showType => this.possibleExportTypes().some(et => et === showType.type))
|
|
14915
|
+
.map(showType => {
|
|
14901
14916
|
const defaultType = this.exportTypes.find(et => et.type === showType.type);
|
|
14902
14917
|
return {
|
|
14903
14918
|
type: showType.type,
|
|
@@ -14933,6 +14948,22 @@ class ExportDatagridButtonComponent {
|
|
|
14933
14948
|
this.exportExcel(type);
|
|
14934
14949
|
}
|
|
14935
14950
|
}
|
|
14951
|
+
/**
|
|
14952
|
+
* Updates the possible export types based on the current datagrid state and allowed export types.
|
|
14953
|
+
* @param type the export type to update
|
|
14954
|
+
* @param shouldExist whether the export type should exist in the possible export types
|
|
14955
|
+
* @param exportTypesToShowVal the allowed export types to show
|
|
14956
|
+
*/
|
|
14957
|
+
updateExportType(type, shouldExist, exportTypesToShowVal) {
|
|
14958
|
+
const index = this.possibleExportTypes().findIndex(et => et === type);
|
|
14959
|
+
const allowed = !exportTypesToShowVal || exportTypesToShowVal.length === 0 || exportTypesToShowVal.some(et => et.type === type);
|
|
14960
|
+
if (index === -1 && allowed && shouldExist) {
|
|
14961
|
+
this.possibleExportTypes.update(prev => [...prev, type]);
|
|
14962
|
+
}
|
|
14963
|
+
else if (allowed && !shouldExist && index !== -1) {
|
|
14964
|
+
this.possibleExportTypes.update(prev => prev.filter(et => et !== type));
|
|
14965
|
+
}
|
|
14966
|
+
}
|
|
14936
14967
|
getRowsToExport(type) {
|
|
14937
14968
|
switch (type) {
|
|
14938
14969
|
case ExportTypeEnum.ALL:
|
|
@@ -14958,11 +14989,11 @@ class ExportDatagridButtonComponent {
|
|
|
14958
14989
|
return columnTitles;
|
|
14959
14990
|
}
|
|
14960
14991
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: ExportDatagridButtonComponent, deps: [{ token: ExportDatagridService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
14961
|
-
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
|
|
14992
|
+
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\n class=\"btn btn-sm btn-outline custom-button-export\"\n type=\"button\"\n (click)=\"onExport(exportTypesFiltered()[0].type)\"\n >\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}.custom-button-export{margin:0}\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"] }] }); }
|
|
14962
14993
|
}
|
|
14963
14994
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.6", ngImport: i0, type: ExportDatagridButtonComponent, decorators: [{
|
|
14964
14995
|
type: Component,
|
|
14965
|
-
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
|
|
14996
|
+
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\n class=\"btn btn-sm btn-outline custom-button-export\"\n type=\"button\"\n (click)=\"onExport(exportTypesFiltered()[0].type)\"\n >\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}.custom-button-export{margin:0}\n"] }]
|
|
14966
14997
|
}], ctorParameters: () => [{ type: ExportDatagridService }], propDecorators: { backendExport: [{
|
|
14967
14998
|
type: Output
|
|
14968
14999
|
}] } });
|