@memberjunction/ng-record-changes 0.9.1
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/ng-record-changes.component.d.ts +21 -0
- package/dist/lib/ng-record-changes.component.js +170 -0
- package/dist/lib/ng-record-changes.module.d.ts +17 -0
- package/dist/lib/ng-record-changes.module.js +64 -0
- package/dist/public-api.d.ts +2 -0
- package/dist/public-api.js +5 -0
- package/package.json +34 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { EventEmitter, OnInit } from '@angular/core';
|
|
2
|
+
import { DomSanitizer } from '@angular/platform-browser';
|
|
3
|
+
import { SortDescriptor } from '@progress/kendo-data-query';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class RecordChangesComponent implements OnInit {
|
|
6
|
+
private sanitizer;
|
|
7
|
+
showloader: boolean;
|
|
8
|
+
dialogClosed: EventEmitter<any>;
|
|
9
|
+
record: any;
|
|
10
|
+
viewData: any;
|
|
11
|
+
visibleColumns: any;
|
|
12
|
+
sortSettings: SortDescriptor[];
|
|
13
|
+
constructor(sanitizer: DomSanitizer);
|
|
14
|
+
ngOnInit(): void;
|
|
15
|
+
LoadRecordChanges(recordId: number, appName: string, entityName: string): Promise<void>;
|
|
16
|
+
prepareColumns(): void;
|
|
17
|
+
closePropertiesDialog(): void;
|
|
18
|
+
FormatColumnValue(col: any, value: any, maxLength?: number, trailingChars?: string): any;
|
|
19
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RecordChangesComponent, never>;
|
|
20
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<RecordChangesComponent, "mj-record-changes", never, { "record": "record"; }, { "dialogClosed": "dialogClosed"; }, never, never, false, never>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
|
11
|
+
import { LogError, RunView } from '@memberjunction/core';
|
|
12
|
+
import * as i0 from "@angular/core";
|
|
13
|
+
import * as i1 from "@angular/platform-browser";
|
|
14
|
+
import * as i2 from "@angular/common";
|
|
15
|
+
import * as i3 from "@progress/kendo-angular-grid";
|
|
16
|
+
import * as i4 from "@progress/kendo-angular-dialog";
|
|
17
|
+
import * as i5 from "@progress/kendo-angular-indicators";
|
|
18
|
+
function RecordChangesComponent_kendo_loader_2_Template(rf, ctx) { if (rf & 1) {
|
|
19
|
+
i0.ɵɵelement(0, "kendo-loader", 4);
|
|
20
|
+
} }
|
|
21
|
+
function RecordChangesComponent_div_3_kendo_grid_column_4_ng_template_1_Template(rf, ctx) { if (rf & 1) {
|
|
22
|
+
i0.ɵɵelement(0, "span", 12);
|
|
23
|
+
} if (rf & 2) {
|
|
24
|
+
const dataItem_r7 = ctx.$implicit;
|
|
25
|
+
const item_r4 = i0.ɵɵnextContext().$implicit;
|
|
26
|
+
const ctx_r6 = i0.ɵɵnextContext(2);
|
|
27
|
+
i0.ɵɵproperty("innerHTML", ctx_r6.FormatColumnValue(item_r4, dataItem_r7[item_r4.field]), i0.ɵɵsanitizeHtml);
|
|
28
|
+
} }
|
|
29
|
+
const _c0 = function () { return { "font-weight": "bold", "background-color": "#a9c2af" }; };
|
|
30
|
+
function RecordChangesComponent_div_3_kendo_grid_column_4_Template(rf, ctx) { if (rf & 1) {
|
|
31
|
+
i0.ɵɵelementStart(0, "kendo-grid-column", 10);
|
|
32
|
+
i0.ɵɵtemplate(1, RecordChangesComponent_div_3_kendo_grid_column_4_ng_template_1_Template, 1, 1, "ng-template", 11);
|
|
33
|
+
i0.ɵɵelementEnd();
|
|
34
|
+
} if (rf & 2) {
|
|
35
|
+
const item_r4 = ctx.$implicit;
|
|
36
|
+
i0.ɵɵpropertyInterpolate("field", item_r4.field);
|
|
37
|
+
i0.ɵɵpropertyInterpolate("title", item_r4.title);
|
|
38
|
+
i0.ɵɵproperty("width", item_r4.width)("headerStyle", i0.ɵɵpureFunction0(4, _c0));
|
|
39
|
+
} }
|
|
40
|
+
function RecordChangesComponent_div_3_Template(rf, ctx) { if (rf & 1) {
|
|
41
|
+
i0.ɵɵelementStart(0, "div", 5, 6)(2, "div", 7)(3, "kendo-grid", 8);
|
|
42
|
+
i0.ɵɵtemplate(4, RecordChangesComponent_div_3_kendo_grid_column_4_Template, 2, 5, "kendo-grid-column", 9);
|
|
43
|
+
i0.ɵɵelementEnd()()();
|
|
44
|
+
} if (rf & 2) {
|
|
45
|
+
const ctx_r1 = i0.ɵɵnextContext();
|
|
46
|
+
i0.ɵɵadvance(3);
|
|
47
|
+
i0.ɵɵproperty("kendoGridBinding", ctx_r1.viewData)("pageSize", 100)("sortable", true)("sort", ctx_r1.sortSettings)("loading", ctx_r1.showloader)("resizable", true)("navigable", true);
|
|
48
|
+
i0.ɵɵadvance(1);
|
|
49
|
+
i0.ɵɵproperty("ngForOf", ctx_r1.visibleColumns);
|
|
50
|
+
} }
|
|
51
|
+
export class RecordChangesComponent {
|
|
52
|
+
constructor(sanitizer) {
|
|
53
|
+
this.sanitizer = sanitizer;
|
|
54
|
+
this.showloader = false;
|
|
55
|
+
this.dialogClosed = new EventEmitter();
|
|
56
|
+
this.record = {};
|
|
57
|
+
this.viewData = [];
|
|
58
|
+
this.visibleColumns = [];
|
|
59
|
+
this.sortSettings = [
|
|
60
|
+
{
|
|
61
|
+
field: "ChangedAt",
|
|
62
|
+
dir: "desc",
|
|
63
|
+
},
|
|
64
|
+
];
|
|
65
|
+
}
|
|
66
|
+
ngOnInit() {
|
|
67
|
+
if (this.record) {
|
|
68
|
+
this.showloader = true;
|
|
69
|
+
this.LoadRecordChanges(this.record.ID, '', this.record.EntityInfo.Name);
|
|
70
|
+
this.prepareColumns();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
LoadRecordChanges(recordId, appName, entityName) {
|
|
74
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
+
// Perform any necessary actions with the ViewID, such as fetching data
|
|
76
|
+
if (recordId && entityName) {
|
|
77
|
+
const rv = new RunView();
|
|
78
|
+
const response = yield rv.RunView({ EntityName: "Record Changes", ExtraFilter: `Entity='${entityName}' AND RecordID=${recordId}` });
|
|
79
|
+
if (response.Success) {
|
|
80
|
+
this.viewData = response.Results;
|
|
81
|
+
this.showloader = false;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
LogError(response.ErrorMessage);
|
|
85
|
+
this.showloader = false;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
prepareColumns() {
|
|
91
|
+
this.visibleColumns = [{
|
|
92
|
+
field: 'ChangedAt',
|
|
93
|
+
title: 'Changed At (UTC)',
|
|
94
|
+
type: 'datetime',
|
|
95
|
+
width: 110,
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
field: 'ChangesDescription',
|
|
99
|
+
title: 'Changes',
|
|
100
|
+
type: 'description',
|
|
101
|
+
}];
|
|
102
|
+
}
|
|
103
|
+
closePropertiesDialog() {
|
|
104
|
+
this.dialogClosed.emit();
|
|
105
|
+
}
|
|
106
|
+
FormatColumnValue(col, value, maxLength = 0, trailingChars = "...") {
|
|
107
|
+
if (value === null)
|
|
108
|
+
return null;
|
|
109
|
+
try {
|
|
110
|
+
switch (col.type.toLowerCase()) {
|
|
111
|
+
case 'datetime':
|
|
112
|
+
let date = new Date(value);
|
|
113
|
+
return new Intl.DateTimeFormat('en-US', {
|
|
114
|
+
year: 'numeric',
|
|
115
|
+
month: 'short',
|
|
116
|
+
day: 'numeric',
|
|
117
|
+
hour: 'numeric',
|
|
118
|
+
minute: 'numeric',
|
|
119
|
+
second: 'numeric',
|
|
120
|
+
hour12: true,
|
|
121
|
+
}).format(date);
|
|
122
|
+
case 'int':
|
|
123
|
+
return new Intl.NumberFormat(undefined, { minimumFractionDigits: 0, maximumFractionDigits: 0 }).format(value);
|
|
124
|
+
case 'description':
|
|
125
|
+
const regex = /([^ ]+) changed from ([^]+?) to ([^]+?)(?=\n|$)/g;
|
|
126
|
+
let formattedDescription = '<ul>';
|
|
127
|
+
let match;
|
|
128
|
+
while ((match = regex.exec(value)) !== null) {
|
|
129
|
+
const fieldName = match[1];
|
|
130
|
+
const oldValue = match[2];
|
|
131
|
+
const newValue = match[3];
|
|
132
|
+
const formattedFieldChange = `<li>${fieldName} changed from <span style="color: darkgray;">${oldValue}</span> to <span style="color: blue;">${newValue}</span></li>`;
|
|
133
|
+
formattedDescription += formattedFieldChange;
|
|
134
|
+
}
|
|
135
|
+
formattedDescription += '</ul>';
|
|
136
|
+
return this.sanitizer.bypassSecurityTrustHtml(formattedDescription);
|
|
137
|
+
default:
|
|
138
|
+
return value;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
catch (e) {
|
|
142
|
+
LogError(e);
|
|
143
|
+
return value;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
RecordChangesComponent.ɵfac = function RecordChangesComponent_Factory(t) { return new (t || RecordChangesComponent)(i0.ɵɵdirectiveInject(i1.DomSanitizer)); };
|
|
148
|
+
RecordChangesComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: RecordChangesComponent, selectors: [["mj-record-changes"]], inputs: { record: "record" }, outputs: { dialogClosed: "dialogClosed" }, decls: 4, vars: 7, consts: [[1, "k-overlay"], ["title", "Record Changes", 1, "kendo-window-custom", 3, "width", "height", "minHeight", "minWidth", "resizable", "close"], ["type", "converging-spinner", 4, "ngIf"], ["class", "k-d-flex k-flex-col k-justify-content-between k-h-full", 4, "ngIf"], ["type", "converging-spinner"], [1, "k-d-flex", "k-flex-col", "k-justify-content-between", "k-h-full"], ["dialogContainer", ""], [1, "kendo-grid-container"], ["scrollable", "virtual", 3, "kendoGridBinding", "pageSize", "sortable", "sort", "loading", "resizable", "navigable"], [3, "field", "title", "width", "headerStyle", 4, "ngFor", "ngForOf"], [3, "field", "title", "width", "headerStyle"], ["kendoGridCellTemplate", ""], [3, "innerHTML"]], template: function RecordChangesComponent_Template(rf, ctx) { if (rf & 1) {
|
|
149
|
+
i0.ɵɵelement(0, "div", 0);
|
|
150
|
+
i0.ɵɵelementStart(1, "kendo-window", 1);
|
|
151
|
+
i0.ɵɵlistener("close", function RecordChangesComponent_Template_kendo_window_close_1_listener() { return ctx.closePropertiesDialog(); });
|
|
152
|
+
i0.ɵɵtemplate(2, RecordChangesComponent_kendo_loader_2_Template, 1, 0, "kendo-loader", 2);
|
|
153
|
+
i0.ɵɵtemplate(3, RecordChangesComponent_div_3_Template, 5, 8, "div", 3);
|
|
154
|
+
i0.ɵɵelementEnd();
|
|
155
|
+
} if (rf & 2) {
|
|
156
|
+
i0.ɵɵadvance(1);
|
|
157
|
+
i0.ɵɵproperty("width", 700)("height", 525)("minHeight", 300)("minWidth", 400)("resizable", true);
|
|
158
|
+
i0.ɵɵadvance(1);
|
|
159
|
+
i0.ɵɵproperty("ngIf", ctx.showloader);
|
|
160
|
+
i0.ɵɵadvance(1);
|
|
161
|
+
i0.ɵɵproperty("ngIf", !ctx.showloader);
|
|
162
|
+
} }, dependencies: [i2.NgForOf, i2.NgIf, i3.GridComponent, i3.DataBindingDirective, i3.ColumnComponent, i3.CellTemplateDirective, i4.WindowComponent, i5.LoaderComponent] });
|
|
163
|
+
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(RecordChangesComponent, [{
|
|
164
|
+
type: Component,
|
|
165
|
+
args: [{ selector: 'mj-record-changes', template: "<div class=\"k-overlay\"></div>\r\n<kendo-window \r\n class=\"kendo-window-custom\"\r\n [width]=\"700\"\r\n [height]=\"525\"\r\n [minHeight]=\"300\"\r\n [minWidth]=\"400\"\r\n [resizable]=\"true\"\r\n title=\"Record Changes\"\r\n (close)=\"closePropertiesDialog()\"\r\n >\r\n <kendo-loader *ngIf=\"showloader\" type=\"converging-spinner\" ></kendo-loader>\r\n <div class=\"k-d-flex k-flex-col k-justify-content-between k-h-full\" #dialogContainer *ngIf=\"!showloader\">\r\n <div class=\"kendo-grid-container\">\r\n <kendo-grid \r\n [kendoGridBinding]=\"viewData\" \r\n scrollable=\"virtual\" \r\n [pageSize]=\"100\" \r\n [sortable]=\"true\"\r\n [sort]=\"sortSettings\" \r\n [loading]=\"showloader\" \r\n [resizable]=\"true\" \r\n [navigable]=\"true\"\r\n >\r\n <kendo-grid-column \r\n *ngFor=\"let item of visibleColumns; let i = index\" \r\n field=\"{{item.field}}\"\r\n title=\"{{item.title}}\" \r\n [width]=\"item.width\"\r\n [headerStyle]=\"{ 'font-weight' : 'bold', 'background-color': '#a9c2af' }\"\r\n >\r\n <ng-template kendoGridCellTemplate let-dataItem>\r\n <span [innerHTML]=\"FormatColumnValue(item, dataItem[item.field])\"></span>\r\n </ng-template>\r\n </kendo-grid-column>\r\n </kendo-grid>\r\n </div>\r\n </div>\r\n \r\n</kendo-window>" }]
|
|
166
|
+
}], function () { return [{ type: i1.DomSanitizer }]; }, { dialogClosed: [{
|
|
167
|
+
type: Output
|
|
168
|
+
}], record: [{
|
|
169
|
+
type: Input
|
|
170
|
+
}] }); })();
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./ng-record-changes.component";
|
|
3
|
+
import * as i2 from "@angular/common";
|
|
4
|
+
import * as i3 from "@angular/forms";
|
|
5
|
+
import * as i4 from "@angular/router";
|
|
6
|
+
import * as i5 from "@progress/kendo-angular-grid";
|
|
7
|
+
import * as i6 from "@progress/kendo-angular-dialog";
|
|
8
|
+
import * as i7 from "@progress/kendo-angular-excel-export";
|
|
9
|
+
import * as i8 from "@progress/kendo-angular-buttons";
|
|
10
|
+
import * as i9 from "@memberjunction/ng-compare-records";
|
|
11
|
+
import * as i10 from "@memberjunction/ng-container-directives";
|
|
12
|
+
import * as i11 from "@progress/kendo-angular-indicators";
|
|
13
|
+
export declare class UserViewGridModule {
|
|
14
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<UserViewGridModule, never>;
|
|
15
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<UserViewGridModule, [typeof i1.RecordChangesComponent], [typeof i2.CommonModule, typeof i3.FormsModule, typeof i3.ReactiveFormsModule, typeof i4.RouterModule, typeof i5.GridModule, typeof i6.DialogsModule, typeof i7.ExcelExportModule, typeof i8.ButtonsModule, typeof i9.CompareRecordsModule, typeof i10.ContainerDirectivesModule, typeof i11.IndicatorsModule], [typeof i1.RecordChangesComponent]>;
|
|
16
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<UserViewGridModule>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { RecordChangesComponent } from './ng-record-changes.component';
|
|
3
|
+
import { CommonModule } from '@angular/common';
|
|
4
|
+
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
5
|
+
import { RouterModule } from '@angular/router';
|
|
6
|
+
// Kendo UI Angular imports
|
|
7
|
+
import { GridModule } from '@progress/kendo-angular-grid';
|
|
8
|
+
import { ExcelExportModule } from '@progress/kendo-angular-excel-export';
|
|
9
|
+
import { DialogsModule } from "@progress/kendo-angular-dialog";
|
|
10
|
+
import { ButtonsModule } from '@progress/kendo-angular-buttons';
|
|
11
|
+
import { IndicatorsModule } from '@progress/kendo-angular-indicators';
|
|
12
|
+
import { CompareRecordsModule } from '@memberjunction/ng-compare-records';
|
|
13
|
+
import { ContainerDirectivesModule } from '@memberjunction/ng-container-directives';
|
|
14
|
+
import * as i0 from "@angular/core";
|
|
15
|
+
export class UserViewGridModule {
|
|
16
|
+
}
|
|
17
|
+
UserViewGridModule.ɵfac = function UserViewGridModule_Factory(t) { return new (t || UserViewGridModule)(); };
|
|
18
|
+
UserViewGridModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: UserViewGridModule });
|
|
19
|
+
UserViewGridModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
|
|
20
|
+
FormsModule,
|
|
21
|
+
ReactiveFormsModule,
|
|
22
|
+
RouterModule,
|
|
23
|
+
GridModule,
|
|
24
|
+
DialogsModule,
|
|
25
|
+
ExcelExportModule,
|
|
26
|
+
ButtonsModule,
|
|
27
|
+
CompareRecordsModule,
|
|
28
|
+
ContainerDirectivesModule,
|
|
29
|
+
IndicatorsModule] });
|
|
30
|
+
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(UserViewGridModule, [{
|
|
31
|
+
type: NgModule,
|
|
32
|
+
args: [{
|
|
33
|
+
declarations: [
|
|
34
|
+
RecordChangesComponent
|
|
35
|
+
],
|
|
36
|
+
imports: [
|
|
37
|
+
CommonModule,
|
|
38
|
+
FormsModule,
|
|
39
|
+
ReactiveFormsModule,
|
|
40
|
+
RouterModule,
|
|
41
|
+
GridModule,
|
|
42
|
+
DialogsModule,
|
|
43
|
+
ExcelExportModule,
|
|
44
|
+
ButtonsModule,
|
|
45
|
+
CompareRecordsModule,
|
|
46
|
+
ContainerDirectivesModule,
|
|
47
|
+
IndicatorsModule
|
|
48
|
+
],
|
|
49
|
+
exports: [
|
|
50
|
+
RecordChangesComponent
|
|
51
|
+
]
|
|
52
|
+
}]
|
|
53
|
+
}], null, null); })();
|
|
54
|
+
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(UserViewGridModule, { declarations: [RecordChangesComponent], imports: [CommonModule,
|
|
55
|
+
FormsModule,
|
|
56
|
+
ReactiveFormsModule,
|
|
57
|
+
RouterModule,
|
|
58
|
+
GridModule,
|
|
59
|
+
DialogsModule,
|
|
60
|
+
ExcelExportModule,
|
|
61
|
+
ButtonsModule,
|
|
62
|
+
CompareRecordsModule,
|
|
63
|
+
ContainerDirectivesModule,
|
|
64
|
+
IndicatorsModule], exports: [RecordChangesComponent] }); })();
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@memberjunction/ng-record-changes",
|
|
3
|
+
"version": "0.9.1",
|
|
4
|
+
"description": "MemberJunction: Angular pop-up window and grid to show changes made to a specific individual record",
|
|
5
|
+
"main": "./dist/public-api.js",
|
|
6
|
+
"typings": "./dist/public-api.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"/dist"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
12
|
+
"build": "ngc"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [],
|
|
15
|
+
"author": "",
|
|
16
|
+
"license": "ISC",
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@angular/compiler": "^15.2.0",
|
|
19
|
+
"@angular/compiler-cli": "^15.2.0"
|
|
20
|
+
},
|
|
21
|
+
"peerDependencies": {
|
|
22
|
+
"@angular/common": "^15.2.0",
|
|
23
|
+
"@angular/core": "^15.2.0",
|
|
24
|
+
"@angular/forms": "^15.2.0",
|
|
25
|
+
"@angular/router": "^15.2.0",
|
|
26
|
+
"@progress/kendo-angular-grid": "^12.1.0"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@memberjunction/global": "^0.9.62",
|
|
30
|
+
"@memberjunction/core": "^0.9.59",
|
|
31
|
+
"tslib": "^2.3.0"
|
|
32
|
+
},
|
|
33
|
+
"sideEffects": false
|
|
34
|
+
}
|