@memberjunction/ng-skip-chat 2.95.0 → 2.96.0
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/dist/lib/dynamic-report/linear-report.js +47 -48
- package/dist/lib/dynamic-report/linear-report.js.map +1 -1
- package/dist/lib/module.d.ts +25 -28
- package/dist/lib/module.d.ts.map +1 -1
- package/dist/lib/module.js +0 -18
- package/dist/lib/module.js.map +1 -1
- package/dist/lib/skip-chat/skip-chat.component.d.ts +6 -0
- package/dist/lib/skip-chat/skip-chat.component.d.ts.map +1 -1
- package/dist/lib/skip-chat/skip-chat.component.js +29 -2
- package/dist/lib/skip-chat/skip-chat.component.js.map +1 -1
- package/dist/public-api.d.ts +0 -2
- package/dist/public-api.d.ts.map +1 -1
- package/dist/public-api.js +0 -2
- package/dist/public-api.js.map +1 -1
- package/package.json +15 -18
- package/dist/lib/dynamic-report/dynamic-chart.d.ts +0 -32
- package/dist/lib/dynamic-report/dynamic-chart.d.ts.map +0 -1
- package/dist/lib/dynamic-report/dynamic-chart.js +0 -195
- package/dist/lib/dynamic-report/dynamic-chart.js.map +0 -1
- package/dist/lib/dynamic-report/dynamic-grid.d.ts +0 -38
- package/dist/lib/dynamic-report/dynamic-grid.d.ts.map +0 -1
- package/dist/lib/dynamic-report/dynamic-grid.js +0 -388
- package/dist/lib/dynamic-report/dynamic-grid.js.map +0 -1
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core';
|
|
2
|
-
import { GetEntityNameFromSchemaAndViewString } from '@memberjunction/core';
|
|
3
|
-
import * as Plotly from 'plotly.js-dist-min';
|
|
4
|
-
import { DrillDownInfo } from '../drill-down-info';
|
|
5
|
-
import { InvokeManualResize } from '@memberjunction/global';
|
|
6
|
-
import * as i0 from "@angular/core";
|
|
7
|
-
import * as i1 from "@angular/common";
|
|
8
|
-
import * as i2 from "@progress/kendo-angular-buttons";
|
|
9
|
-
import * as i3 from "angular-plotly.js";
|
|
10
|
-
const _c0 = ["plotlyPlot"];
|
|
11
|
-
const _c1 = ["plotContainer"];
|
|
12
|
-
function SkipDynamicChartComponent_button_0_Template(rf, ctx) { if (rf & 1) {
|
|
13
|
-
const _r2 = i0.ɵɵgetCurrentView();
|
|
14
|
-
i0.ɵɵelementStart(0, "button", 4);
|
|
15
|
-
i0.ɵɵlistener("click", function SkipDynamicChartComponent_button_0_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r2); const ctx_r2 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r2.SaveChartAsImage()); });
|
|
16
|
-
i0.ɵɵelement(1, "span", 5);
|
|
17
|
-
i0.ɵɵtext(2, " Save ");
|
|
18
|
-
i0.ɵɵelementEnd();
|
|
19
|
-
} }
|
|
20
|
-
export class SkipDynamicChartComponent {
|
|
21
|
-
el;
|
|
22
|
-
plotData;
|
|
23
|
-
plotLayout;
|
|
24
|
-
defaultPlotHeight = 550;
|
|
25
|
-
ShowSaveAsImage = true;
|
|
26
|
-
AllowDrillDown = true;
|
|
27
|
-
AutoResizeChart = false;
|
|
28
|
-
DrillDownEvent = new EventEmitter();
|
|
29
|
-
plotlyPlot;
|
|
30
|
-
plotContainer;
|
|
31
|
-
resizeObserver;
|
|
32
|
-
constructor(el) {
|
|
33
|
-
this.el = el;
|
|
34
|
-
}
|
|
35
|
-
ngOnInit() {
|
|
36
|
-
if (this.AutoResizeChart)
|
|
37
|
-
this.setupResizeObserver();
|
|
38
|
-
}
|
|
39
|
-
ngOnDestroy() {
|
|
40
|
-
if (this.resizeObserver) {
|
|
41
|
-
this.resizeObserver.disconnect();
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
async SaveChartAsImage() {
|
|
45
|
-
if (this.plotlyPlot) {
|
|
46
|
-
const el = this.plotContainer.nativeElement.querySelector('.js-plotly-plot');
|
|
47
|
-
const image = await Plotly.toImage(el, { format: 'png' });
|
|
48
|
-
if (image) {
|
|
49
|
-
// Create an <a> element
|
|
50
|
-
const downloadLink = document.createElement('a');
|
|
51
|
-
// Set the download attribute with a default file name
|
|
52
|
-
// reportTitle is the legacy name, title is the new name, so favor title if available
|
|
53
|
-
// otherwise use the plotLayout title, and finally default to 'chart'
|
|
54
|
-
const title = this.SkipData?.title || this.SkipData?.reportTitle || this.plotLayout?.title || 'chart';
|
|
55
|
-
downloadLink.download = `${title}.png`;
|
|
56
|
-
// Set the href to the data URL
|
|
57
|
-
downloadLink.href = image;
|
|
58
|
-
// Append the <a> element to the body (required for Firefox)
|
|
59
|
-
document.body.appendChild(downloadLink);
|
|
60
|
-
// Programmatically trigger a click on the <a> element
|
|
61
|
-
downloadLink.click();
|
|
62
|
-
// Remove the <a> element after download
|
|
63
|
-
document.body.removeChild(downloadLink);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
async handleChartClick(chartClickEvent) {
|
|
68
|
-
try {
|
|
69
|
-
if (!this.AllowDrillDown)
|
|
70
|
-
return;
|
|
71
|
-
const drillDownValue = chartClickEvent.points[0].label;
|
|
72
|
-
const drillDown = this.SkipData?.drillDown;
|
|
73
|
-
if (drillDown && drillDownValue && drillDownValue.length > 0) {
|
|
74
|
-
// we have a valid situation to drill down where we have the configuration and we have a drill down value.
|
|
75
|
-
// we can navigate to the drill down view
|
|
76
|
-
const entityName = GetEntityNameFromSchemaAndViewString(drillDown.viewName);
|
|
77
|
-
if (entityName) {
|
|
78
|
-
const filterSQL = drillDown.filters.map(f => {
|
|
79
|
-
const isDateValue = drillDownValue instanceof Date;
|
|
80
|
-
const isNumberValue = !isNaN(parseFloat(drillDownValue));
|
|
81
|
-
const needsQuotes = isDateValue ? true : (isNumberValue ? false : true);
|
|
82
|
-
const quotes = needsQuotes ? "'" : '';
|
|
83
|
-
return `${f.viewFieldName} = ${quotes}${drillDownValue}${quotes}`;
|
|
84
|
-
}).join(' AND ');
|
|
85
|
-
this.DrillDownEvent.emit(new DrillDownInfo(entityName, filterSQL));
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
catch (e) {
|
|
90
|
-
console.warn('Error handling chart click', e);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
setupResizeObserver() {
|
|
94
|
-
// Invoke manual resize to ensure the chart is sized correctly
|
|
95
|
-
InvokeManualResize();
|
|
96
|
-
// now wait 1ms - which really just results in the event loop being processed and the manual resize being invoked
|
|
97
|
-
setTimeout(() => {
|
|
98
|
-
this.resizeObserver = new ResizeObserver(entries => {
|
|
99
|
-
for (let entry of entries) {
|
|
100
|
-
const { height, width } = entry.contentRect;
|
|
101
|
-
this.updateChartSize(height - 15, width); // some pixels of margin to make sure it all fits
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
this.resizeObserver.observe(this.el.nativeElement);
|
|
105
|
-
}, 1);
|
|
106
|
-
}
|
|
107
|
-
updateChartHeight(newHeight) {
|
|
108
|
-
if (this.plotLayout && newHeight > 0)
|
|
109
|
-
this.plotLayout.height = newHeight;
|
|
110
|
-
}
|
|
111
|
-
updateChartSize(newHeight, newWidth) {
|
|
112
|
-
if (this.plotLayout) {
|
|
113
|
-
if (newHeight > 0)
|
|
114
|
-
this.plotLayout.height = newHeight;
|
|
115
|
-
if (newWidth > 0)
|
|
116
|
-
this.plotLayout.width = newWidth;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
_skipData;
|
|
120
|
-
get SkipData() {
|
|
121
|
-
return this._skipData ? this._skipData : undefined;
|
|
122
|
-
}
|
|
123
|
-
set SkipData(d) {
|
|
124
|
-
this._skipData = d;
|
|
125
|
-
if (d) {
|
|
126
|
-
this.plotData = d.executionResults?.plotData?.data;
|
|
127
|
-
this.plotLayout = d.executionResults?.plotData?.layout;
|
|
128
|
-
if (this.plotLayout) {
|
|
129
|
-
if (this.plotLayout.height === undefined || this.plotLayout.height === null || this.plotLayout.height === 0)
|
|
130
|
-
this.plotLayout.height = this.defaultPlotHeight;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
static ɵfac = function SkipDynamicChartComponent_Factory(t) { return new (t || SkipDynamicChartComponent)(i0.ɵɵdirectiveInject(i0.ElementRef)); };
|
|
135
|
-
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: SkipDynamicChartComponent, selectors: [["skip-dynamic-chart"]], viewQuery: function SkipDynamicChartComponent_Query(rf, ctx) { if (rf & 1) {
|
|
136
|
-
i0.ɵɵviewQuery(_c0, 5);
|
|
137
|
-
i0.ɵɵviewQuery(_c1, 5);
|
|
138
|
-
} if (rf & 2) {
|
|
139
|
-
let _t;
|
|
140
|
-
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.plotlyPlot = _t.first);
|
|
141
|
-
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.plotContainer = _t.first);
|
|
142
|
-
} }, inputs: { plotData: "plotData", plotLayout: "plotLayout", defaultPlotHeight: "defaultPlotHeight", ShowSaveAsImage: "ShowSaveAsImage", AllowDrillDown: "AllowDrillDown", AutoResizeChart: "AutoResizeChart", SkipData: "SkipData" }, outputs: { DrillDownEvent: "DrillDownEvent" }, decls: 5, vars: 4, consts: [["plotContainer", ""], ["plotlyPlot", ""], ["kendoButton", "", 3, "click", 4, "ngIf"], [3, "plotlyClick", "data", "layout", "useResizeHandler"], ["kendoButton", "", 3, "click"], [1, "fa-regular", "fa-image"]], template: function SkipDynamicChartComponent_Template(rf, ctx) { if (rf & 1) {
|
|
143
|
-
const _r1 = i0.ɵɵgetCurrentView();
|
|
144
|
-
i0.ɵɵtemplate(0, SkipDynamicChartComponent_button_0_Template, 3, 0, "button", 2);
|
|
145
|
-
i0.ɵɵelementStart(1, "div", null, 0)(3, "plotly-plot", 3, 1);
|
|
146
|
-
i0.ɵɵlistener("plotlyClick", function SkipDynamicChartComponent_Template_plotly_plot_plotlyClick_3_listener($event) { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.handleChartClick($event)); });
|
|
147
|
-
i0.ɵɵelementEnd()();
|
|
148
|
-
} if (rf & 2) {
|
|
149
|
-
i0.ɵɵproperty("ngIf", ctx.ShowSaveAsImage);
|
|
150
|
-
i0.ɵɵadvance(3);
|
|
151
|
-
i0.ɵɵproperty("data", ctx.plotData)("layout", ctx.plotLayout)("useResizeHandler", true);
|
|
152
|
-
} }, dependencies: [i1.NgIf, i2.ButtonComponent, i3.PlotlyComponent], styles: ["button[_ngcontent-%COMP%] { margin-top: 5px; margin-bottom: 5px;}"] });
|
|
153
|
-
}
|
|
154
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SkipDynamicChartComponent, [{
|
|
155
|
-
type: Component,
|
|
156
|
-
args: [{ selector: 'skip-dynamic-chart', template: `
|
|
157
|
-
<button kendoButton *ngIf="ShowSaveAsImage" (click)="SaveChartAsImage()">
|
|
158
|
-
<span class="fa-regular fa-image"></span>
|
|
159
|
-
Save
|
|
160
|
-
</button>
|
|
161
|
-
<div #plotContainer >
|
|
162
|
-
<plotly-plot #plotlyPlot
|
|
163
|
-
[data]="plotData"
|
|
164
|
-
[layout]="plotLayout"
|
|
165
|
-
|
|
166
|
-
[useResizeHandler]="true"
|
|
167
|
-
(plotlyClick)="handleChartClick($event)">
|
|
168
|
-
</plotly-plot>
|
|
169
|
-
</div>
|
|
170
|
-
`, styles: ["button { margin-top: 5px; margin-bottom: 5px;}"] }]
|
|
171
|
-
}], () => [{ type: i0.ElementRef }], { plotData: [{
|
|
172
|
-
type: Input
|
|
173
|
-
}], plotLayout: [{
|
|
174
|
-
type: Input
|
|
175
|
-
}], defaultPlotHeight: [{
|
|
176
|
-
type: Input
|
|
177
|
-
}], ShowSaveAsImage: [{
|
|
178
|
-
type: Input
|
|
179
|
-
}], AllowDrillDown: [{
|
|
180
|
-
type: Input
|
|
181
|
-
}], AutoResizeChart: [{
|
|
182
|
-
type: Input
|
|
183
|
-
}], DrillDownEvent: [{
|
|
184
|
-
type: Output
|
|
185
|
-
}], plotlyPlot: [{
|
|
186
|
-
type: ViewChild,
|
|
187
|
-
args: ['plotlyPlot']
|
|
188
|
-
}], plotContainer: [{
|
|
189
|
-
type: ViewChild,
|
|
190
|
-
args: ['plotContainer']
|
|
191
|
-
}], SkipData: [{
|
|
192
|
-
type: Input
|
|
193
|
-
}] }); })();
|
|
194
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(SkipDynamicChartComponent, { className: "SkipDynamicChartComponent", filePath: "src/lib/dynamic-report/dynamic-chart.ts", lineNumber: 28 }); })();
|
|
195
|
-
//# sourceMappingURL=dynamic-chart.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-chart.js","sourceRoot":"","sources":["../../../src/lib/dynamic-report/dynamic-chart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAc,YAAY,EAAE,KAAK,EAAqB,MAAM,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACjH,OAAO,EAAE,oCAAoC,EAAqB,MAAM,sBAAsB,CAAC;AAG/F,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;;;;;;;;;IAKxD,iCAAyE;IAA7B,wLAAS,yBAAkB,KAAC;IACtE,0BAAyC;IACzC,sBACF;IAAA,iBAAS;;AAab,MAAM,OAAO,yBAAyB;IAcd;IAbX,QAAQ,CAAM;IACd,UAAU,CAAM;IAChB,iBAAiB,GAAW,GAAG,CAAC;IAChC,eAAe,GAAY,IAAI,CAAC;IAChC,cAAc,GAAY,IAAI,CAAA;IAC9B,eAAe,GAAY,KAAK,CAAA;IAC/B,cAAc,GAAG,IAAI,YAAY,EAAiB,CAAC;IAEpC,UAAU,CAAmB;IAC1B,aAAa,CAAc;IAE/C,cAAc,CA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-types';
|
|
3
|
-
import { DecimalPipe, DatePipe } from '@angular/common';
|
|
4
|
-
import { GridDataResult, PageChangeEvent } from '@progress/kendo-angular-grid';
|
|
5
|
-
import { ExcelExportComponent } from '@progress/kendo-angular-excel-export';
|
|
6
|
-
import { DrillDownInfo } from '../drill-down-info';
|
|
7
|
-
import { MJNotificationService } from '@memberjunction/ng-notifications';
|
|
8
|
-
import * as i0 from "@angular/core";
|
|
9
|
-
export declare class SkipDynamicGridComponent implements AfterViewInit {
|
|
10
|
-
private decimalPipe;
|
|
11
|
-
private datePipe;
|
|
12
|
-
private notificationService;
|
|
13
|
-
data: any[];
|
|
14
|
-
columns: SkipColumnInfo[];
|
|
15
|
-
pageSize: number;
|
|
16
|
-
startingRow: number;
|
|
17
|
-
GridHeight: number | null;
|
|
18
|
-
ShowRefreshButton: boolean;
|
|
19
|
-
AllowDrillDown: boolean;
|
|
20
|
-
DrillDownEvent: EventEmitter<DrillDownInfo>;
|
|
21
|
-
private _skipData;
|
|
22
|
-
get SkipData(): SkipAPIAnalysisCompleteResponse | undefined;
|
|
23
|
-
set SkipData(d: SkipAPIAnalysisCompleteResponse | undefined);
|
|
24
|
-
gridView: GridDataResult;
|
|
25
|
-
constructor(decimalPipe: DecimalPipe, datePipe: DatePipe, notificationService: MJNotificationService);
|
|
26
|
-
kendoExcelExport: ExcelExportComponent | null;
|
|
27
|
-
formatData(dataType: string, data: any): any;
|
|
28
|
-
ngAfterViewInit(): void;
|
|
29
|
-
pageChange(event: PageChangeEvent): void;
|
|
30
|
-
private loadGridView;
|
|
31
|
-
cellClick(event: any): Promise<void>;
|
|
32
|
-
exportData: any[];
|
|
33
|
-
doExcelExport(): Promise<void>;
|
|
34
|
-
protected getExportData(): Promise<any[]>;
|
|
35
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<SkipDynamicGridComponent, never>;
|
|
36
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<SkipDynamicGridComponent, "skip-dynamic-grid", never, { "data": { "alias": "data"; "required": false; }; "columns": { "alias": "columns"; "required": false; }; "pageSize": { "alias": "pageSize"; "required": false; }; "startingRow": { "alias": "startingRow"; "required": false; }; "GridHeight": { "alias": "GridHeight"; "required": false; }; "ShowRefreshButton": { "alias": "ShowRefreshButton"; "required": false; }; "AllowDrillDown": { "alias": "AllowDrillDown"; "required": false; }; "SkipData": { "alias": "SkipData"; "required": false; }; }, { "DrillDownEvent": "DrillDownEvent"; }, never, never, false, never>;
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=dynamic-grid.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-grid.d.ts","sourceRoot":"","sources":["../../../src/lib/dynamic-report/dynamic-grid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAa,YAAY,EAA4B,MAAM,eAAe,CAAC;AACjG,OAAO,EAAE,cAAc,EAAE,+BAA+B,EAAE,MAAM,4BAA4B,CAAC;AAC7F,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;;AAEzE,qBAuEa,wBAAyB,YAAW,aAAa;IA0DhD,OAAO,CAAC,WAAW;IAAe,OAAO,CAAC,QAAQ;IAAY,OAAO,CAAC,mBAAmB;IAzD5F,IAAI,EAAE,GAAG,EAAE,CAAM;IACjB,OAAO,EAAE,cAAc,EAAE,CAAM;IACxB,QAAQ,SAAM;IACd,WAAW,SAAK;IAChB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAQ;IACjC,iBAAiB,EAAE,OAAO,CAAS;IAC1C,cAAc,EAAE,OAAO,CAAO;IAC7B,cAAc,8BAAqC;IAE7D,OAAO,CAAC,SAAS,CAA8C;IAC/D,IAAa,QAAQ,IAAI,+BAA+B,GAAG,SAAS,CAEnE;IAED,IAAI,QAAQ,CAAC,CAAC,EAAE,+BAA+B,GAAG,SAAS,EAuC1D;IAEM,QAAQ,EAAG,cAAc,CAAC;gBAEb,WAAW,EAAE,WAAW,EAAU,QAAQ,EAAE,QAAQ,EAAU,mBAAmB,EAAE,qBAAqB;IAElE,gBAAgB,EAAE,oBAAoB,GAAG,IAAI,CAAQ;IAG/G,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,GAAG;IAuB5C,eAAe;IAMR,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI;IAK/C,OAAO,CAAC,YAAY;IASP,SAAS,CAAC,KAAK,EAAE,GAAG;IA+B1B,UAAU,EAAE,GAAG,EAAE,CAAM;IACjB,aAAa;cA4BV,aAAa,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;yCAtKpC,wBAAwB;2CAAxB,wBAAwB;CA0KpC"}
|
|
@@ -1,388 +0,0 @@
|
|
|
1
|
-
import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core';
|
|
2
|
-
import { SkipColumnInfo } from '@memberjunction/skip-types';
|
|
3
|
-
import { DecimalPipe, DatePipe } from '@angular/common';
|
|
4
|
-
import { GetEntityNameFromSchemaAndViewString, LogError } from '@memberjunction/core';
|
|
5
|
-
import { ExcelExportComponent } from '@progress/kendo-angular-excel-export';
|
|
6
|
-
import { DrillDownInfo } from '../drill-down-info';
|
|
7
|
-
import * as i0 from "@angular/core";
|
|
8
|
-
import * as i1 from "@angular/common";
|
|
9
|
-
import * as i2 from "@memberjunction/ng-notifications";
|
|
10
|
-
import * as i3 from "@progress/kendo-angular-grid";
|
|
11
|
-
import * as i4 from "@progress/kendo-angular-buttons";
|
|
12
|
-
import * as i5 from "@progress/kendo-angular-excel-export";
|
|
13
|
-
const _c0 = ["excelExport"];
|
|
14
|
-
const _c1 = () => ({ "font-weight": "bold", "background-color": "#cyan" });
|
|
15
|
-
function SkipDynamicGridComponent_kendo_grid_0_ng_container_1_ng_template_2_Template(rf, ctx) { if (rf & 1) {
|
|
16
|
-
i0.ɵɵtext(0);
|
|
17
|
-
} if (rf & 2) {
|
|
18
|
-
const dataItem_r3 = ctx.$implicit;
|
|
19
|
-
const col_r4 = i0.ɵɵnextContext().$implicit;
|
|
20
|
-
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
21
|
-
i0.ɵɵtextInterpolate1(" ", ctx_r1.formatData(col_r4.simpleDataType, dataItem_r3[col_r4.fieldName]), " ");
|
|
22
|
-
} }
|
|
23
|
-
function SkipDynamicGridComponent_kendo_grid_0_ng_container_1_Template(rf, ctx) { if (rf & 1) {
|
|
24
|
-
i0.ɵɵelementContainerStart(0);
|
|
25
|
-
i0.ɵɵelementStart(1, "kendo-grid-column", 8);
|
|
26
|
-
i0.ɵɵtemplate(2, SkipDynamicGridComponent_kendo_grid_0_ng_container_1_ng_template_2_Template, 1, 1, "ng-template", 9);
|
|
27
|
-
i0.ɵɵelementEnd();
|
|
28
|
-
i0.ɵɵelementContainerEnd();
|
|
29
|
-
} if (rf & 2) {
|
|
30
|
-
const col_r4 = ctx.$implicit;
|
|
31
|
-
i0.ɵɵadvance();
|
|
32
|
-
i0.ɵɵpropertyInterpolate("field", col_r4.fieldName);
|
|
33
|
-
i0.ɵɵpropertyInterpolate("title", col_r4.displayName);
|
|
34
|
-
i0.ɵɵproperty("headerStyle", i0.ɵɵpureFunction0(3, _c1));
|
|
35
|
-
} }
|
|
36
|
-
function SkipDynamicGridComponent_kendo_grid_0_ng_template_2_Template(rf, ctx) { if (rf & 1) {
|
|
37
|
-
const _r5 = i0.ɵɵgetCurrentView();
|
|
38
|
-
i0.ɵɵelementStart(0, "button", 10);
|
|
39
|
-
i0.ɵɵlistener("click", function SkipDynamicGridComponent_kendo_grid_0_ng_template_2_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r5); const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.doExcelExport()); });
|
|
40
|
-
i0.ɵɵelement(1, "span", 11);
|
|
41
|
-
i0.ɵɵtext(2, " Export to Excel");
|
|
42
|
-
i0.ɵɵelementEnd();
|
|
43
|
-
} }
|
|
44
|
-
function SkipDynamicGridComponent_kendo_grid_0_kendo_excelexport_column_5_Template(rf, ctx) { if (rf & 1) {
|
|
45
|
-
i0.ɵɵelement(0, "kendo-excelexport-column", 12);
|
|
46
|
-
} if (rf & 2) {
|
|
47
|
-
const exportCol_r6 = ctx.$implicit;
|
|
48
|
-
i0.ɵɵproperty("field", exportCol_r6.fieldName)("title", exportCol_r6.displayName);
|
|
49
|
-
} }
|
|
50
|
-
function SkipDynamicGridComponent_kendo_grid_0_Template(rf, ctx) { if (rf & 1) {
|
|
51
|
-
const _r1 = i0.ɵɵgetCurrentView();
|
|
52
|
-
i0.ɵɵelementStart(0, "kendo-grid", 3);
|
|
53
|
-
i0.ɵɵlistener("pageChange", function SkipDynamicGridComponent_kendo_grid_0_Template_kendo_grid_pageChange_0_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.pageChange($event)); })("cellClick", function SkipDynamicGridComponent_kendo_grid_0_Template_kendo_grid_cellClick_0_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.cellClick($event)); });
|
|
54
|
-
i0.ɵɵtemplate(1, SkipDynamicGridComponent_kendo_grid_0_ng_container_1_Template, 3, 4, "ng-container", 4)(2, SkipDynamicGridComponent_kendo_grid_0_ng_template_2_Template, 3, 0, "ng-template", 5);
|
|
55
|
-
i0.ɵɵelementStart(3, "kendo-excelexport", 6, 0);
|
|
56
|
-
i0.ɵɵtemplate(5, SkipDynamicGridComponent_kendo_grid_0_kendo_excelexport_column_5_Template, 1, 2, "kendo-excelexport-column", 7);
|
|
57
|
-
i0.ɵɵelementEnd()();
|
|
58
|
-
} if (rf & 2) {
|
|
59
|
-
const ctx_r1 = i0.ɵɵnextContext();
|
|
60
|
-
i0.ɵɵproperty("height", ctx_r1.GridHeight)("data", ctx_r1.gridView)("skip", ctx_r1.startingRow)("pageSize", ctx_r1.pageSize)("rowHeight", 36)("reorderable", true)("resizable", true)("navigable", true);
|
|
61
|
-
i0.ɵɵadvance();
|
|
62
|
-
i0.ɵɵproperty("ngForOf", ctx_r1.columns);
|
|
63
|
-
i0.ɵɵadvance(2);
|
|
64
|
-
i0.ɵɵproperty("data", ctx_r1.exportData)("fileName", "Report_Grid_Export.xlsx");
|
|
65
|
-
i0.ɵɵadvance(2);
|
|
66
|
-
i0.ɵɵproperty("ngForOf", ctx_r1.columns);
|
|
67
|
-
} }
|
|
68
|
-
function SkipDynamicGridComponent_kendo_grid_1_ng_container_1_ng_template_2_Template(rf, ctx) { if (rf & 1) {
|
|
69
|
-
i0.ɵɵtext(0);
|
|
70
|
-
} if (rf & 2) {
|
|
71
|
-
const dataItem_r8 = ctx.$implicit;
|
|
72
|
-
const col_r9 = i0.ɵɵnextContext().$implicit;
|
|
73
|
-
const ctx_r1 = i0.ɵɵnextContext(2);
|
|
74
|
-
i0.ɵɵtextInterpolate1(" ", ctx_r1.formatData(col_r9.simpleDataType, dataItem_r8[col_r9.fieldName]), " ");
|
|
75
|
-
} }
|
|
76
|
-
function SkipDynamicGridComponent_kendo_grid_1_ng_container_1_Template(rf, ctx) { if (rf & 1) {
|
|
77
|
-
i0.ɵɵelementContainerStart(0);
|
|
78
|
-
i0.ɵɵelementStart(1, "kendo-grid-column", 8);
|
|
79
|
-
i0.ɵɵtemplate(2, SkipDynamicGridComponent_kendo_grid_1_ng_container_1_ng_template_2_Template, 1, 1, "ng-template", 9);
|
|
80
|
-
i0.ɵɵelementEnd();
|
|
81
|
-
i0.ɵɵelementContainerEnd();
|
|
82
|
-
} if (rf & 2) {
|
|
83
|
-
const col_r9 = ctx.$implicit;
|
|
84
|
-
i0.ɵɵadvance();
|
|
85
|
-
i0.ɵɵpropertyInterpolate("field", col_r9.fieldName);
|
|
86
|
-
i0.ɵɵpropertyInterpolate("title", col_r9.displayName);
|
|
87
|
-
i0.ɵɵproperty("headerStyle", i0.ɵɵpureFunction0(3, _c1));
|
|
88
|
-
} }
|
|
89
|
-
function SkipDynamicGridComponent_kendo_grid_1_ng_template_2_Template(rf, ctx) { if (rf & 1) {
|
|
90
|
-
const _r10 = i0.ɵɵgetCurrentView();
|
|
91
|
-
i0.ɵɵelementStart(0, "button", 10);
|
|
92
|
-
i0.ɵɵlistener("click", function SkipDynamicGridComponent_kendo_grid_1_ng_template_2_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r10); const ctx_r1 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r1.doExcelExport()); });
|
|
93
|
-
i0.ɵɵelement(1, "span", 11);
|
|
94
|
-
i0.ɵɵtext(2, " Export to Excel");
|
|
95
|
-
i0.ɵɵelementEnd();
|
|
96
|
-
} }
|
|
97
|
-
function SkipDynamicGridComponent_kendo_grid_1_kendo_excelexport_column_5_Template(rf, ctx) { if (rf & 1) {
|
|
98
|
-
i0.ɵɵelement(0, "kendo-excelexport-column", 12);
|
|
99
|
-
} if (rf & 2) {
|
|
100
|
-
const exportCol_r11 = ctx.$implicit;
|
|
101
|
-
i0.ɵɵproperty("field", exportCol_r11.fieldName)("title", exportCol_r11.displayName);
|
|
102
|
-
} }
|
|
103
|
-
function SkipDynamicGridComponent_kendo_grid_1_Template(rf, ctx) { if (rf & 1) {
|
|
104
|
-
const _r7 = i0.ɵɵgetCurrentView();
|
|
105
|
-
i0.ɵɵelementStart(0, "kendo-grid", 13);
|
|
106
|
-
i0.ɵɵlistener("pageChange", function SkipDynamicGridComponent_kendo_grid_1_Template_kendo_grid_pageChange_0_listener($event) { i0.ɵɵrestoreView(_r7); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.pageChange($event)); })("cellClick", function SkipDynamicGridComponent_kendo_grid_1_Template_kendo_grid_cellClick_0_listener($event) { i0.ɵɵrestoreView(_r7); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.cellClick($event)); });
|
|
107
|
-
i0.ɵɵtemplate(1, SkipDynamicGridComponent_kendo_grid_1_ng_container_1_Template, 3, 4, "ng-container", 4)(2, SkipDynamicGridComponent_kendo_grid_1_ng_template_2_Template, 3, 0, "ng-template", 5);
|
|
108
|
-
i0.ɵɵelementStart(3, "kendo-excelexport", 6, 0);
|
|
109
|
-
i0.ɵɵtemplate(5, SkipDynamicGridComponent_kendo_grid_1_kendo_excelexport_column_5_Template, 1, 2, "kendo-excelexport-column", 7);
|
|
110
|
-
i0.ɵɵelementEnd()();
|
|
111
|
-
} if (rf & 2) {
|
|
112
|
-
const ctx_r1 = i0.ɵɵnextContext();
|
|
113
|
-
i0.ɵɵproperty("data", ctx_r1.gridView)("skip", ctx_r1.startingRow)("pageSize", ctx_r1.pageSize)("rowHeight", 36)("reorderable", true)("resizable", true)("navigable", true);
|
|
114
|
-
i0.ɵɵadvance();
|
|
115
|
-
i0.ɵɵproperty("ngForOf", ctx_r1.columns);
|
|
116
|
-
i0.ɵɵadvance(2);
|
|
117
|
-
i0.ɵɵproperty("data", ctx_r1.exportData)("fileName", "Report_Grid_Export.xlsx");
|
|
118
|
-
i0.ɵɵadvance(2);
|
|
119
|
-
i0.ɵɵproperty("ngForOf", ctx_r1.columns);
|
|
120
|
-
} }
|
|
121
|
-
export class SkipDynamicGridComponent {
|
|
122
|
-
decimalPipe;
|
|
123
|
-
datePipe;
|
|
124
|
-
notificationService;
|
|
125
|
-
data = [];
|
|
126
|
-
columns = [];
|
|
127
|
-
pageSize = 30;
|
|
128
|
-
startingRow = 0;
|
|
129
|
-
GridHeight = null;
|
|
130
|
-
ShowRefreshButton = false;
|
|
131
|
-
AllowDrillDown = true;
|
|
132
|
-
DrillDownEvent = new EventEmitter();
|
|
133
|
-
_skipData;
|
|
134
|
-
get SkipData() {
|
|
135
|
-
return this._skipData ? this._skipData : undefined;
|
|
136
|
-
}
|
|
137
|
-
set SkipData(d) {
|
|
138
|
-
this._skipData = d;
|
|
139
|
-
if (d) {
|
|
140
|
-
// check to see if the tableDataColumns is NOT provided, in that case we need to check to see if we
|
|
141
|
-
// have column names that are valid in our table data. If we don't we need to prepend whatever was provided with a "_" prefix so that
|
|
142
|
-
// we don't have things like 2022 as a column name which is not valid in JavaScript
|
|
143
|
-
if (!d.tableDataColumns || d.tableDataColumns.length === 0) {
|
|
144
|
-
// no columns provided, so we check here to make sure the column names are valid
|
|
145
|
-
this.data = d.executionResults?.tableData ? d.executionResults?.tableData : [];
|
|
146
|
-
// now loop through the data and fix up the column names if needed
|
|
147
|
-
for (let i = 0; i < this.data.length; i++) {
|
|
148
|
-
const row = this.data[i];
|
|
149
|
-
for (let key in row) {
|
|
150
|
-
if (key.match(/^\d/)) {
|
|
151
|
-
const newKey = '_' + key;
|
|
152
|
-
row[newKey] = row[key];
|
|
153
|
-
delete row[key];
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
// now, populate the columns array with the column names
|
|
158
|
-
this.columns = [];
|
|
159
|
-
const row = this.data[0];
|
|
160
|
-
for (let key in row) {
|
|
161
|
-
const col = new SkipColumnInfo();
|
|
162
|
-
col.fieldName = key;
|
|
163
|
-
col.displayName = key;
|
|
164
|
-
col.simpleDataType = 'string'; // don't know the type, so default to string
|
|
165
|
-
this.columns.push(col);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
169
|
-
// we have table data columns provided, so use that info!
|
|
170
|
-
this.columns = d.tableDataColumns;
|
|
171
|
-
this.data = d.executionResults?.tableData ? d.executionResults?.tableData : [];
|
|
172
|
-
}
|
|
173
|
-
this.loadGridView();
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
gridView;
|
|
177
|
-
constructor(decimalPipe, datePipe, notificationService) {
|
|
178
|
-
this.decimalPipe = decimalPipe;
|
|
179
|
-
this.datePipe = datePipe;
|
|
180
|
-
this.notificationService = notificationService;
|
|
181
|
-
}
|
|
182
|
-
kendoExcelExport = null;
|
|
183
|
-
formatData(dataType, data) {
|
|
184
|
-
switch (dataType) {
|
|
185
|
-
case 'bigint':
|
|
186
|
-
case 'smallint':
|
|
187
|
-
case 'int':
|
|
188
|
-
case 'tinyint':
|
|
189
|
-
return data; // No specific formatting for integer types
|
|
190
|
-
case 'decimal':
|
|
191
|
-
case 'numeric':
|
|
192
|
-
case 'smallmoney':
|
|
193
|
-
case 'money':
|
|
194
|
-
return this.decimalPipe.transform(data, '1.2-2'); // Format as decimal with 2 digits after the decimal point
|
|
195
|
-
case 'date':
|
|
196
|
-
case 'datetime':
|
|
197
|
-
case 'datetime2':
|
|
198
|
-
case 'smalldatetime':
|
|
199
|
-
return this.datePipe.transform(data, 'short'); // Format as short date
|
|
200
|
-
// Add more cases as needed for other SQL Server datatypes
|
|
201
|
-
default:
|
|
202
|
-
return data; // For data types not handled, return data as is
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
ngAfterViewInit() {
|
|
206
|
-
if (this.data) {
|
|
207
|
-
this.loadGridView();
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
pageChange(event) {
|
|
211
|
-
this.startingRow = event.skip;
|
|
212
|
-
this.loadGridView();
|
|
213
|
-
}
|
|
214
|
-
loadGridView() {
|
|
215
|
-
Promise.resolve().then(() => {
|
|
216
|
-
this.gridView = {
|
|
217
|
-
data: this.data.slice(this.startingRow, this.startingRow + this.pageSize),
|
|
218
|
-
total: this.data.length,
|
|
219
|
-
};
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
async cellClick(event) {
|
|
223
|
-
try {
|
|
224
|
-
if (!this.AllowDrillDown)
|
|
225
|
-
return;
|
|
226
|
-
const rowSelected = event.dataItem;
|
|
227
|
-
const drillDown = this.SkipData?.drillDown;
|
|
228
|
-
if (drillDown && rowSelected) {
|
|
229
|
-
// we have a valid situation to drill down where we have the configuration and we have a drill down value.
|
|
230
|
-
// we can navigate to the drill down view
|
|
231
|
-
const entityName = GetEntityNameFromSchemaAndViewString(drillDown.viewName);
|
|
232
|
-
if (entityName) {
|
|
233
|
-
const filterSQL = drillDown.filters.map(f => {
|
|
234
|
-
const val = rowSelected[f.componentFieldName];
|
|
235
|
-
const isDateValue = val instanceof Date;
|
|
236
|
-
const isNumberValue = !isNaN(parseFloat(val));
|
|
237
|
-
const needsQuotes = isDateValue ? true : (isNumberValue ? false : true);
|
|
238
|
-
const quotes = needsQuotes ? "'" : '';
|
|
239
|
-
return `${f.viewFieldName} = ${quotes}${val}${quotes}`;
|
|
240
|
-
}).join(' AND ');
|
|
241
|
-
this.DrillDownEvent.emit(new DrillDownInfo(entityName, filterSQL));
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
catch (e) {
|
|
246
|
-
console.warn('Error handling grid row click', e);
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
// Export Functionality
|
|
250
|
-
exportData = [];
|
|
251
|
-
async doExcelExport() {
|
|
252
|
-
if (this.kendoExcelExport === null)
|
|
253
|
-
throw new Error("kendoExcelExport is null, cannot export data");
|
|
254
|
-
try {
|
|
255
|
-
this.exportData = await this.getExportData();
|
|
256
|
-
// next show an initial notification, but only if a lot of data
|
|
257
|
-
if (this.exportData.length > 5000)
|
|
258
|
-
this.notificationService.CreateSimpleNotification("Working on the export, will notify you when it is complete...", 'info', 2000);
|
|
259
|
-
// before we call the save, we need to let Angular do its thing that will result in the kendoExcelExport component binding properly to
|
|
260
|
-
// the exportColumns and exportData arrays. So we wait for the next tick before we call save()
|
|
261
|
-
setTimeout(() => {
|
|
262
|
-
// support the legacy report title as old conversation details had a reportTitle property
|
|
263
|
-
// but the new SkipData object has a title property, so favor the title property
|
|
264
|
-
const title = this.SkipData?.title || this.SkipData?.reportTitle || 'Report_Grid_Export';
|
|
265
|
-
this.kendoExcelExport.fileName = `${title}.xlsx`;
|
|
266
|
-
this.kendoExcelExport.save();
|
|
267
|
-
this.notificationService.CreateSimpleNotification("Excel Export Complete", 'success', 2000);
|
|
268
|
-
}, 100);
|
|
269
|
-
}
|
|
270
|
-
catch (e) {
|
|
271
|
-
this.notificationService.CreateSimpleNotification("Error exporting data", 'error', 5000);
|
|
272
|
-
LogError(e);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
async getExportData() {
|
|
276
|
-
return this.data;
|
|
277
|
-
}
|
|
278
|
-
static ɵfac = function SkipDynamicGridComponent_Factory(t) { return new (t || SkipDynamicGridComponent)(i0.ɵɵdirectiveInject(i1.DecimalPipe), i0.ɵɵdirectiveInject(i1.DatePipe), i0.ɵɵdirectiveInject(i2.MJNotificationService)); };
|
|
279
|
-
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: SkipDynamicGridComponent, selectors: [["skip-dynamic-grid"]], viewQuery: function SkipDynamicGridComponent_Query(rf, ctx) { if (rf & 1) {
|
|
280
|
-
i0.ɵɵviewQuery(_c0, 5, ExcelExportComponent);
|
|
281
|
-
} if (rf & 2) {
|
|
282
|
-
let _t;
|
|
283
|
-
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.kendoExcelExport = _t.first);
|
|
284
|
-
} }, inputs: { data: "data", columns: "columns", pageSize: "pageSize", startingRow: "startingRow", GridHeight: "GridHeight", ShowRefreshButton: "ShowRefreshButton", AllowDrillDown: "AllowDrillDown", SkipData: "SkipData" }, outputs: { DrillDownEvent: "DrillDownEvent" }, features: [i0.ɵɵProvidersFeature([DecimalPipe, DatePipe])], decls: 2, vars: 2, consts: [["excelExport", ""], ["scrollable", "virtual", 3, "height", "data", "skip", "pageSize", "rowHeight", "reorderable", "resizable", "navigable", "pageChange", "cellClick", 4, "ngIf"], ["scrollable", "virtual", 3, "data", "skip", "pageSize", "rowHeight", "reorderable", "resizable", "navigable", "pageChange", "cellClick", 4, "ngIf"], ["scrollable", "virtual", 3, "pageChange", "cellClick", "height", "data", "skip", "pageSize", "rowHeight", "reorderable", "resizable", "navigable"], [4, "ngFor", "ngForOf"], ["kendoGridToolbarTemplate", ""], [3, "data", "fileName"], [3, "field", "title", 4, "ngFor", "ngForOf"], [3, "field", "title", "headerStyle"], ["kendoGridCellTemplate", ""], ["kendoButton", "", 3, "click"], [1, "fa-solid", "fa-file-excel"], [3, "field", "title"], ["scrollable", "virtual", 3, "pageChange", "cellClick", "data", "skip", "pageSize", "rowHeight", "reorderable", "resizable", "navigable"]], template: function SkipDynamicGridComponent_Template(rf, ctx) { if (rf & 1) {
|
|
285
|
-
i0.ɵɵtemplate(0, SkipDynamicGridComponent_kendo_grid_0_Template, 6, 12, "kendo-grid", 1)(1, SkipDynamicGridComponent_kendo_grid_1_Template, 6, 11, "kendo-grid", 2);
|
|
286
|
-
} if (rf & 2) {
|
|
287
|
-
i0.ɵɵproperty("ngIf", ctx.GridHeight !== null);
|
|
288
|
-
i0.ɵɵadvance();
|
|
289
|
-
i0.ɵɵproperty("ngIf", ctx.GridHeight === null);
|
|
290
|
-
} }, dependencies: [i1.NgForOf, i1.NgIf, i3.GridComponent, i3.ToolbarTemplateDirective, i3.ColumnComponent, i3.CellTemplateDirective, i4.ButtonComponent, i5.ExcelExportComponent, i5.ColumnComponent], encapsulation: 2 });
|
|
291
|
-
}
|
|
292
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SkipDynamicGridComponent, [{
|
|
293
|
-
type: Component,
|
|
294
|
-
args: [{
|
|
295
|
-
selector: 'skip-dynamic-grid',
|
|
296
|
-
template: `
|
|
297
|
-
<kendo-grid *ngIf="GridHeight !== null"
|
|
298
|
-
[height]="GridHeight"
|
|
299
|
-
[data]="gridView"
|
|
300
|
-
[skip]="startingRow"
|
|
301
|
-
[pageSize]="pageSize"
|
|
302
|
-
scrollable="virtual"
|
|
303
|
-
[rowHeight]="36"
|
|
304
|
-
[reorderable]="true"
|
|
305
|
-
[resizable]="true"
|
|
306
|
-
(pageChange)="pageChange($event)"
|
|
307
|
-
(cellClick)="cellClick($event)"
|
|
308
|
-
[navigable]="true"
|
|
309
|
-
>
|
|
310
|
-
<ng-container *ngFor="let col of columns">
|
|
311
|
-
<kendo-grid-column
|
|
312
|
-
field="{{col.fieldName}}"
|
|
313
|
-
title="{{col.displayName}}"
|
|
314
|
-
[headerStyle]="{ 'font-weight' : 'bold', 'background-color': '#cyan' }">
|
|
315
|
-
<ng-template kendoGridCellTemplate let-dataItem>
|
|
316
|
-
{{ formatData(col.simpleDataType, dataItem[col.fieldName]) }}
|
|
317
|
-
</ng-template>
|
|
318
|
-
</kendo-grid-column>
|
|
319
|
-
</ng-container>
|
|
320
|
-
<ng-template kendoGridToolbarTemplate>
|
|
321
|
-
<button kendoButton (click)="doExcelExport()" ><span class="fa-solid fa-file-excel"></span> Export to Excel</button>
|
|
322
|
-
</ng-template>
|
|
323
|
-
|
|
324
|
-
<kendo-excelexport #excelExport [data]="exportData" [fileName]="'Report_Grid_Export.xlsx'">
|
|
325
|
-
<kendo-excelexport-column *ngFor="let exportCol of columns" [field]="exportCol.fieldName" [title]="exportCol.displayName">
|
|
326
|
-
</kendo-excelexport-column>
|
|
327
|
-
</kendo-excelexport>
|
|
328
|
-
</kendo-grid>
|
|
329
|
-
|
|
330
|
-
<!-- Now do the grid that does NOT have a height, wish kendo allowed you to do it another way! -->
|
|
331
|
-
<kendo-grid *ngIf="GridHeight === null"
|
|
332
|
-
[data]="gridView"
|
|
333
|
-
[skip]="startingRow"
|
|
334
|
-
[pageSize]="pageSize"
|
|
335
|
-
scrollable="virtual"
|
|
336
|
-
[rowHeight]="36"
|
|
337
|
-
[reorderable]="true"
|
|
338
|
-
[resizable]="true"
|
|
339
|
-
(pageChange)="pageChange($event)"
|
|
340
|
-
(cellClick)="cellClick($event)"
|
|
341
|
-
[navigable]="true"
|
|
342
|
-
>
|
|
343
|
-
<ng-container *ngFor="let col of columns">
|
|
344
|
-
<kendo-grid-column
|
|
345
|
-
field="{{col.fieldName}}"
|
|
346
|
-
title="{{col.displayName}}"
|
|
347
|
-
[headerStyle]="{ 'font-weight' : 'bold', 'background-color': '#cyan' }">
|
|
348
|
-
<ng-template kendoGridCellTemplate let-dataItem>
|
|
349
|
-
{{ formatData(col.simpleDataType, dataItem[col.fieldName]) }}
|
|
350
|
-
</ng-template>
|
|
351
|
-
</kendo-grid-column>
|
|
352
|
-
</ng-container>
|
|
353
|
-
<ng-template kendoGridToolbarTemplate>
|
|
354
|
-
<button kendoButton (click)="doExcelExport()" ><span class="fa-solid fa-file-excel"></span> Export to Excel</button>
|
|
355
|
-
</ng-template>
|
|
356
|
-
|
|
357
|
-
<kendo-excelexport #excelExport [data]="exportData" [fileName]="'Report_Grid_Export.xlsx'">
|
|
358
|
-
<kendo-excelexport-column *ngFor="let exportCol of columns" [field]="exportCol.fieldName" [title]="exportCol.displayName">
|
|
359
|
-
</kendo-excelexport-column>
|
|
360
|
-
</kendo-excelexport>
|
|
361
|
-
</kendo-grid>
|
|
362
|
-
`,
|
|
363
|
-
providers: [DecimalPipe, DatePipe]
|
|
364
|
-
}]
|
|
365
|
-
}], () => [{ type: i1.DecimalPipe }, { type: i1.DatePipe }, { type: i2.MJNotificationService }], { data: [{
|
|
366
|
-
type: Input
|
|
367
|
-
}], columns: [{
|
|
368
|
-
type: Input
|
|
369
|
-
}], pageSize: [{
|
|
370
|
-
type: Input
|
|
371
|
-
}], startingRow: [{
|
|
372
|
-
type: Input
|
|
373
|
-
}], GridHeight: [{
|
|
374
|
-
type: Input
|
|
375
|
-
}], ShowRefreshButton: [{
|
|
376
|
-
type: Input
|
|
377
|
-
}], AllowDrillDown: [{
|
|
378
|
-
type: Input
|
|
379
|
-
}], DrillDownEvent: [{
|
|
380
|
-
type: Output
|
|
381
|
-
}], SkipData: [{
|
|
382
|
-
type: Input
|
|
383
|
-
}], kendoExcelExport: [{
|
|
384
|
-
type: ViewChild,
|
|
385
|
-
args: ['excelExport', { read: ExcelExportComponent }]
|
|
386
|
-
}] }); })();
|
|
387
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(SkipDynamicGridComponent, { className: "SkipDynamicGridComponent", filePath: "src/lib/dynamic-report/dynamic-grid.ts", lineNumber: 81 }); })();
|
|
388
|
-
//# sourceMappingURL=dynamic-grid.js.map
|