@memberjunction/ng-simple-record-list 0.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.
@@ -0,0 +1,16 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "./simple-record-list/simple-record-list.component";
3
+ import * as i2 from "@angular/common";
4
+ import * as i3 from "@angular/forms";
5
+ import * as i4 from "@progress/kendo-angular-dialog";
6
+ import * as i5 from "@memberjunction/ng-container-directives";
7
+ import * as i6 from "@progress/kendo-angular-buttons";
8
+ import * as i7 from "@progress/kendo-angular-icons";
9
+ import * as i8 from "@progress/kendo-angular-dropdowns";
10
+ import * as i9 from "@memberjunction/ng-entity-form-dialog";
11
+ import * as i10 from "@progress/kendo-angular-indicators";
12
+ export declare class SimpleRecordListModule {
13
+ static ɵfac: i0.ɵɵFactoryDeclaration<SimpleRecordListModule, never>;
14
+ static ɵmod: i0.ɵɵNgModuleDeclaration<SimpleRecordListModule, [typeof i1.SimpleRecordListComponent], [typeof i2.CommonModule, typeof i3.FormsModule, typeof i4.DialogsModule, typeof i5.ContainerDirectivesModule, typeof i6.ButtonsModule, typeof i7.IconsModule, typeof i8.DropDownsModule, typeof i4.DialogsModule, typeof i9.EntityFormDialogModule, typeof i10.IndicatorsModule], [typeof i1.SimpleRecordListComponent]>;
15
+ static ɵinj: i0.ɵɵInjectorDeclaration<SimpleRecordListModule>;
16
+ }
@@ -0,0 +1,62 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { FormsModule } from '@angular/forms';
4
+ // Kendo UI Angular imports
5
+ import { DialogsModule } from "@progress/kendo-angular-dialog";
6
+ import { ButtonsModule } from '@progress/kendo-angular-buttons';
7
+ import { IconsModule } from '@progress/kendo-angular-icons';
8
+ import { DropDownsModule } from '@progress/kendo-angular-dropdowns';
9
+ import { IndicatorsModule } from '@progress/kendo-angular-indicators';
10
+ // MJ
11
+ import { ContainerDirectivesModule } from '@memberjunction/ng-container-directives';
12
+ import { EntityFormDialogModule } from '@memberjunction/ng-entity-form-dialog';
13
+ // LOCAL
14
+ import { SimpleRecordListComponent } from './simple-record-list/simple-record-list.component';
15
+ import * as i0 from "@angular/core";
16
+ export class SimpleRecordListModule {
17
+ }
18
+ SimpleRecordListModule.ɵfac = function SimpleRecordListModule_Factory(t) { return new (t || SimpleRecordListModule)(); };
19
+ SimpleRecordListModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: SimpleRecordListModule });
20
+ SimpleRecordListModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
21
+ FormsModule,
22
+ DialogsModule,
23
+ ContainerDirectivesModule,
24
+ ButtonsModule,
25
+ IconsModule,
26
+ DropDownsModule,
27
+ DialogsModule,
28
+ EntityFormDialogModule,
29
+ IndicatorsModule] });
30
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SimpleRecordListModule, [{
31
+ type: NgModule,
32
+ args: [{
33
+ declarations: [
34
+ SimpleRecordListComponent
35
+ ],
36
+ imports: [
37
+ CommonModule,
38
+ FormsModule,
39
+ DialogsModule,
40
+ ContainerDirectivesModule,
41
+ ButtonsModule,
42
+ IconsModule,
43
+ DropDownsModule,
44
+ DialogsModule,
45
+ EntityFormDialogModule,
46
+ IndicatorsModule
47
+ ],
48
+ exports: [
49
+ SimpleRecordListComponent
50
+ ]
51
+ }]
52
+ }], null, null); })();
53
+ (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(SimpleRecordListModule, { declarations: [SimpleRecordListComponent], imports: [CommonModule,
54
+ FormsModule,
55
+ DialogsModule,
56
+ ContainerDirectivesModule,
57
+ ButtonsModule,
58
+ IconsModule,
59
+ DropDownsModule,
60
+ DialogsModule,
61
+ EntityFormDialogModule,
62
+ IndicatorsModule], exports: [SimpleRecordListComponent] }); })();
@@ -0,0 +1,41 @@
1
+ import { OnInit, EventEmitter } from '@angular/core';
2
+ import { BaseEntity } from '@memberjunction/core';
3
+ import { kendoSVGIcon } from '@memberjunction/ng-shared';
4
+ import { Router } from '@angular/router';
5
+ import * as i0 from "@angular/core";
6
+ export declare class SimpleRecordListComponent implements OnInit {
7
+ private router;
8
+ EntityName: string;
9
+ Columns: string[];
10
+ SortBy: string;
11
+ AllowDelete: boolean;
12
+ AllowNew: boolean;
13
+ AllowEdit: boolean;
14
+ /**
15
+ * If AllowEdit or AllowNew is true, this is the section name to display for editing a new or existing record.
16
+ */
17
+ EditSectionName: string;
18
+ RecordSelected: EventEmitter<BaseEntity>;
19
+ RecordEdited: EventEmitter<BaseEntity>;
20
+ RecordCreated: EventEmitter<BaseEntity>;
21
+ isLoading: boolean;
22
+ records: BaseEntity[];
23
+ kendoSVGIcon: typeof kendoSVGIcon;
24
+ constructor(router: Router);
25
+ ngOnInit(): void;
26
+ Refresh(): Promise<void>;
27
+ selectRecord(event: MouseEvent | undefined, r: BaseEntity): void;
28
+ deleteRecordDialogVisible: boolean;
29
+ deleteRecordItem: BaseEntity | null;
30
+ deleteRecord(event: MouseEvent, r: BaseEntity): Promise<void>;
31
+ closeDeleteDialog(result: 'Yes' | 'No'): Promise<void>;
32
+ editOrNewRecord: BaseEntity;
33
+ showEditOrNewRecordForm: boolean;
34
+ recordMode: 'new' | 'edit';
35
+ createNewRecord(): Promise<void>;
36
+ editRecord(event: MouseEvent, r: BaseEntity): Promise<void>;
37
+ onEditOrNewRecordFormClosed(result: 'Save' | 'Cancel'): Promise<void>;
38
+ getRecordName(r: BaseEntity): string;
39
+ static ɵfac: i0.ɵɵFactoryDeclaration<SimpleRecordListComponent, never>;
40
+ static ɵcmp: i0.ɵɵComponentDeclaration<SimpleRecordListComponent, "mj-simple-record-list", never, { "EntityName": { "alias": "EntityName"; "required": false; }; "Columns": { "alias": "Columns"; "required": false; }; "SortBy": { "alias": "SortBy"; "required": false; }; "AllowDelete": { "alias": "AllowDelete"; "required": false; }; "AllowNew": { "alias": "AllowNew"; "required": false; }; "AllowEdit": { "alias": "AllowEdit"; "required": false; }; "EditSectionName": { "alias": "EditSectionName"; "required": false; }; }, { "RecordSelected": "RecordSelected"; "RecordEdited": "RecordEdited"; "RecordCreated": "RecordCreated"; }, never, never, false, never>;
41
+ }
@@ -0,0 +1,324 @@
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, Input, EventEmitter, Output } from '@angular/core';
11
+ import { Metadata, RunView } from '@memberjunction/core';
12
+ import { SharedService, kendoSVGIcon } from '@memberjunction/ng-shared';
13
+ import * as i0 from "@angular/core";
14
+ import * as i1 from "@angular/router";
15
+ import * as i2 from "@angular/common";
16
+ import * as i3 from "@progress/kendo-angular-dialog";
17
+ import * as i4 from "@memberjunction/ng-container-directives";
18
+ import * as i5 from "@progress/kendo-angular-buttons";
19
+ import * as i6 from "@progress/kendo-angular-icons";
20
+ import * as i7 from "@memberjunction/ng-entity-form-dialog";
21
+ import * as i8 from "@progress/kendo-angular-indicators";
22
+ function SimpleRecordListComponent_div_3_Template(rf, ctx) { if (rf & 1) {
23
+ i0.ɵɵelementStart(0, "div");
24
+ i0.ɵɵelement(1, "kendo-loader");
25
+ i0.ɵɵelementEnd();
26
+ } }
27
+ function SimpleRecordListComponent_table_4_th_3_Template(rf, ctx) { if (rf & 1) {
28
+ i0.ɵɵelementStart(0, "th");
29
+ i0.ɵɵtext(1);
30
+ i0.ɵɵelementEnd();
31
+ } if (rf & 2) {
32
+ const c_r6 = ctx.$implicit;
33
+ i0.ɵɵadvance();
34
+ i0.ɵɵtextInterpolate1(" ", c_r6, " ");
35
+ } }
36
+ function SimpleRecordListComponent_table_4_tr_5_td_1_span_3_kendo_svgicon_1_Template(rf, ctx) { if (rf & 1) {
37
+ const _r16 = i0.ɵɵgetCurrentView();
38
+ i0.ɵɵelementStart(0, "kendo-svgicon", 12);
39
+ i0.ɵɵlistener("click", function SimpleRecordListComponent_table_4_tr_5_td_1_span_3_kendo_svgicon_1_Template_kendo_svgicon_click_0_listener($event) { i0.ɵɵrestoreView(_r16); const r_r7 = i0.ɵɵnextContext(3).$implicit; const ctx_r14 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r14.editRecord($event, r_r7)); });
40
+ i0.ɵɵelementEnd();
41
+ } if (rf & 2) {
42
+ const ctx_r12 = i0.ɵɵnextContext(5);
43
+ i0.ɵɵproperty("icon", ctx_r12.kendoSVGIcon("pencil"));
44
+ } }
45
+ function SimpleRecordListComponent_table_4_tr_5_td_1_span_3_kendo_svgicon_2_Template(rf, ctx) { if (rf & 1) {
46
+ const _r19 = i0.ɵɵgetCurrentView();
47
+ i0.ɵɵelementStart(0, "kendo-svgicon", 12);
48
+ i0.ɵɵlistener("click", function SimpleRecordListComponent_table_4_tr_5_td_1_span_3_kendo_svgicon_2_Template_kendo_svgicon_click_0_listener($event) { i0.ɵɵrestoreView(_r19); const r_r7 = i0.ɵɵnextContext(3).$implicit; const ctx_r17 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r17.deleteRecord($event, r_r7)); });
49
+ i0.ɵɵelementEnd();
50
+ } if (rf & 2) {
51
+ const ctx_r13 = i0.ɵɵnextContext(5);
52
+ i0.ɵɵproperty("icon", ctx_r13.kendoSVGIcon("trash"));
53
+ } }
54
+ function SimpleRecordListComponent_table_4_tr_5_td_1_span_3_Template(rf, ctx) { if (rf & 1) {
55
+ i0.ɵɵelementStart(0, "span");
56
+ i0.ɵɵtemplate(1, SimpleRecordListComponent_table_4_tr_5_td_1_span_3_kendo_svgicon_1_Template, 1, 1, "kendo-svgicon", 11)(2, SimpleRecordListComponent_table_4_tr_5_td_1_span_3_kendo_svgicon_2_Template, 1, 1, "kendo-svgicon", 11);
57
+ i0.ɵɵelementEnd();
58
+ } if (rf & 2) {
59
+ const ctx_r11 = i0.ɵɵnextContext(4);
60
+ i0.ɵɵadvance();
61
+ i0.ɵɵproperty("ngIf", ctx_r11.AllowEdit);
62
+ i0.ɵɵadvance();
63
+ i0.ɵɵproperty("ngIf", ctx_r11.AllowEdit);
64
+ } }
65
+ function SimpleRecordListComponent_table_4_tr_5_td_1_Template(rf, ctx) { if (rf & 1) {
66
+ i0.ɵɵelementStart(0, "td")(1, "span");
67
+ i0.ɵɵtext(2);
68
+ i0.ɵɵelementEnd();
69
+ i0.ɵɵtemplate(3, SimpleRecordListComponent_table_4_tr_5_td_1_span_3_Template, 3, 2, "span", 2);
70
+ i0.ɵɵelementEnd();
71
+ } if (rf & 2) {
72
+ const c_r9 = ctx.$implicit;
73
+ const i_r10 = ctx.index;
74
+ const r_r7 = i0.ɵɵnextContext().$implicit;
75
+ const ctx_r8 = i0.ɵɵnextContext(2);
76
+ i0.ɵɵadvance(2);
77
+ i0.ɵɵtextInterpolate(r_r7.Get(c_r9));
78
+ i0.ɵɵadvance();
79
+ i0.ɵɵproperty("ngIf", i_r10 === 0 && (ctx_r8.AllowDelete || ctx_r8.AllowEdit));
80
+ } }
81
+ function SimpleRecordListComponent_table_4_tr_5_Template(rf, ctx) { if (rf & 1) {
82
+ const _r22 = i0.ɵɵgetCurrentView();
83
+ i0.ɵɵelementStart(0, "tr", 10);
84
+ i0.ɵɵlistener("click", function SimpleRecordListComponent_table_4_tr_5_Template_tr_click_0_listener() { const restoredCtx = i0.ɵɵrestoreView(_r22); const r_r7 = restoredCtx.$implicit; const ctx_r21 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r21.selectRecord(undefined, r_r7)); });
85
+ i0.ɵɵtemplate(1, SimpleRecordListComponent_table_4_tr_5_td_1_Template, 4, 2, "td", 8);
86
+ i0.ɵɵelementEnd();
87
+ } if (rf & 2) {
88
+ const ctx_r5 = i0.ɵɵnextContext(2);
89
+ i0.ɵɵadvance();
90
+ i0.ɵɵproperty("ngForOf", ctx_r5.Columns);
91
+ } }
92
+ function SimpleRecordListComponent_table_4_Template(rf, ctx) { if (rf & 1) {
93
+ i0.ɵɵelementStart(0, "table", 7)(1, "thead")(2, "tr");
94
+ i0.ɵɵtemplate(3, SimpleRecordListComponent_table_4_th_3_Template, 2, 1, "th", 8);
95
+ i0.ɵɵelementEnd()();
96
+ i0.ɵɵelementStart(4, "tbody");
97
+ i0.ɵɵtemplate(5, SimpleRecordListComponent_table_4_tr_5_Template, 2, 1, "tr", 9);
98
+ i0.ɵɵelementEnd()();
99
+ } if (rf & 2) {
100
+ const ctx_r1 = i0.ɵɵnextContext();
101
+ i0.ɵɵadvance(3);
102
+ i0.ɵɵproperty("ngForOf", ctx_r1.Columns);
103
+ i0.ɵɵadvance(2);
104
+ i0.ɵɵproperty("ngForOf", ctx_r1.records);
105
+ } }
106
+ function SimpleRecordListComponent_kendo_dialog_7_Template(rf, ctx) { if (rf & 1) {
107
+ const _r24 = i0.ɵɵgetCurrentView();
108
+ i0.ɵɵelementStart(0, "kendo-dialog", 13);
109
+ i0.ɵɵlistener("close", function SimpleRecordListComponent_kendo_dialog_7_Template_kendo_dialog_close_0_listener() { i0.ɵɵrestoreView(_r24); const ctx_r23 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r23.closeDeleteDialog("No")); });
110
+ i0.ɵɵelementStart(1, "div");
111
+ i0.ɵɵtext(2);
112
+ i0.ɵɵelementEnd();
113
+ i0.ɵɵelementStart(3, "kendo-dialog-actions")(4, "button", 14);
114
+ i0.ɵɵlistener("click", function SimpleRecordListComponent_kendo_dialog_7_Template_button_click_4_listener() { i0.ɵɵrestoreView(_r24); const ctx_r25 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r25.closeDeleteDialog("Yes")); });
115
+ i0.ɵɵtext(5, "Yes");
116
+ i0.ɵɵelementEnd();
117
+ i0.ɵɵelementStart(6, "button", 1);
118
+ i0.ɵɵlistener("click", function SimpleRecordListComponent_kendo_dialog_7_Template_button_click_6_listener() { i0.ɵɵrestoreView(_r24); const ctx_r26 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r26.closeDeleteDialog("No")); });
119
+ i0.ɵɵtext(7, "No");
120
+ i0.ɵɵelementEnd()()();
121
+ } if (rf & 2) {
122
+ const ctx_r3 = i0.ɵɵnextContext();
123
+ i0.ɵɵproperty("title", "Delete " + ctx_r3.EntityName + "?")("width", 450)("height", 200);
124
+ i0.ɵɵadvance(2);
125
+ i0.ɵɵtextInterpolate1(" Are you sure you want to delete '", ctx_r3.getRecordName(ctx_r3.deleteRecordItem), "'? ");
126
+ } }
127
+ export class SimpleRecordListComponent {
128
+ constructor(router) {
129
+ this.router = router;
130
+ this.EntityName = '';
131
+ this.Columns = [];
132
+ this.SortBy = '';
133
+ this.AllowDelete = true;
134
+ this.AllowNew = true;
135
+ this.AllowEdit = true;
136
+ /**
137
+ * If AllowEdit or AllowNew is true, this is the section name to display for editing a new or existing record.
138
+ */
139
+ this.EditSectionName = 'details';
140
+ this.RecordSelected = new EventEmitter();
141
+ this.RecordEdited = new EventEmitter();
142
+ this.RecordCreated = new EventEmitter();
143
+ this.isLoading = false;
144
+ this.records = [];
145
+ this.kendoSVGIcon = kendoSVGIcon;
146
+ this.deleteRecordDialogVisible = false;
147
+ this.showEditOrNewRecordForm = false;
148
+ this.recordMode = 'new';
149
+ }
150
+ ngOnInit() {
151
+ this.Refresh();
152
+ }
153
+ Refresh() {
154
+ return __awaiter(this, void 0, void 0, function* () {
155
+ this.isLoading = true;
156
+ const md = new Metadata();
157
+ if (this.Columns.length === 0) {
158
+ // populate this by default by taking all columns if entity has < 10 columns, otherwise include columns that have DefaultInView=1, and if we have no columns with DefaultInView=1, then include the first 10 columns
159
+ const e = md.Entities.find(e => e.Name === this.EntityName);
160
+ if (e) {
161
+ if (e.Fields.length < 10)
162
+ this.Columns = e.Fields.map(f => f.Name);
163
+ else {
164
+ const defaultInViewColumns = e.Fields.filter(c => c.DefaultInView);
165
+ if (defaultInViewColumns.length > 0)
166
+ this.Columns = defaultInViewColumns.map(f => f.Name);
167
+ else
168
+ this.Columns = e.Fields.slice(0, 10).map(f => f.Name);
169
+ }
170
+ }
171
+ }
172
+ const rv = new RunView();
173
+ const result = yield rv.RunView({
174
+ EntityName: this.EntityName,
175
+ ResultType: 'entity_object'
176
+ });
177
+ if (result.Success) {
178
+ this.records = result.Results;
179
+ if (this.SortBy && this.SortBy.trim().length > 0) {
180
+ this.records.sort((a, b) => a.Get(this.SortBy).localeCompare(b.Get(this.SortBy)));
181
+ }
182
+ }
183
+ else {
184
+ throw new Error("Error loading records: " + result.ErrorMessage);
185
+ }
186
+ this.isLoading = false;
187
+ });
188
+ }
189
+ selectRecord(event, r) {
190
+ if (event)
191
+ event.stopPropagation(); // prevent row from getting click
192
+ this.RecordSelected.emit(r);
193
+ }
194
+ deleteRecord(event, r) {
195
+ return __awaiter(this, void 0, void 0, function* () {
196
+ // confirm with the user first
197
+ this.deleteRecordItem = r;
198
+ this.deleteRecordDialogVisible = true;
199
+ if (event)
200
+ event.stopPropagation(); // prevent row from getting click
201
+ });
202
+ }
203
+ closeDeleteDialog(result) {
204
+ return __awaiter(this, void 0, void 0, function* () {
205
+ // if the user confirms, delete the record
206
+ this.deleteRecordDialogVisible = false;
207
+ if (result === 'Yes') {
208
+ if (!(yield this.deleteRecordItem.Delete())) {
209
+ // show an error message
210
+ SharedService.Instance.CreateSimpleNotification('Error deleting record', 'error', 3000);
211
+ }
212
+ else
213
+ this.Refresh(); // refresh the list
214
+ }
215
+ this.deleteRecordItem = null;
216
+ });
217
+ }
218
+ createNewRecord() {
219
+ return __awaiter(this, void 0, void 0, function* () {
220
+ // attempt to create a new record and if success, navigate to the new record
221
+ const md = new Metadata();
222
+ this.editOrNewRecord = yield md.GetEntityObject(this.EntityName);
223
+ if (this.editOrNewRecord) {
224
+ this.editOrNewRecord.NewRecord();
225
+ this.recordMode = 'new';
226
+ this.showEditOrNewRecordForm = true;
227
+ }
228
+ });
229
+ }
230
+ editRecord(event, r) {
231
+ return __awaiter(this, void 0, void 0, function* () {
232
+ this.editOrNewRecord = r;
233
+ this.recordMode = 'edit';
234
+ this.showEditOrNewRecordForm = true;
235
+ if (event)
236
+ event.stopPropagation(); // prevent row from getting click
237
+ });
238
+ }
239
+ onEditOrNewRecordFormClosed(result) {
240
+ return __awaiter(this, void 0, void 0, function* () {
241
+ this.showEditOrNewRecordForm = false;
242
+ if (result === 'Save') {
243
+ // the dialog already saved the record, just check to make sure it was saved and if so, navigate
244
+ if (this.editOrNewRecord.IsSaved) {
245
+ if (this.recordMode === 'edit')
246
+ this.RecordEdited.emit(this.editOrNewRecord);
247
+ else
248
+ this.RecordCreated.emit(this.editOrNewRecord);
249
+ // refresh our grid now
250
+ yield this.Refresh();
251
+ }
252
+ else
253
+ throw new Error('Record was not saved');
254
+ }
255
+ });
256
+ }
257
+ getRecordName(r) {
258
+ // check to see if we have any columns in the entity that have IsNameField = 1, the fall back from there is to look for a column named "Name", and if that doesn't work we return the primary key(s)
259
+ const md = new Metadata();
260
+ const e = md.Entities.find(e => e.Name === this.EntityName);
261
+ if (!e)
262
+ throw new Error('Entity not found: ' + this.EntityName);
263
+ const nameField = e.Fields.find(c => c.IsNameField);
264
+ if (nameField)
265
+ return r.Get(nameField.Name);
266
+ else {
267
+ const nameField = e.Fields.find(c => c.Name === 'Name');
268
+ if (nameField)
269
+ return r.Get("Name");
270
+ else {
271
+ // iterate through all primary keys and form a comma separated list
272
+ const pkString = r.PrimaryKeys.map(pk => r.Get(pk.Name)).join(', ');
273
+ return "Record: " + pkString;
274
+ }
275
+ }
276
+ }
277
+ }
278
+ SimpleRecordListComponent.ɵfac = function SimpleRecordListComponent_Factory(t) { return new (t || SimpleRecordListComponent)(i0.ɵɵdirectiveInject(i1.Router)); };
279
+ SimpleRecordListComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: SimpleRecordListComponent, selectors: [["mj-simple-record-list"]], inputs: { EntityName: "EntityName", Columns: "Columns", SortBy: "SortBy", AllowDelete: "AllowDelete", AllowNew: "AllowNew", AllowEdit: "AllowEdit", EditSectionName: "EditSectionName" }, outputs: { RecordSelected: "RecordSelected", RecordEdited: "RecordEdited", RecordCreated: "RecordCreated" }, decls: 8, vars: 10, consts: [["mjFillContainer", "", 1, "wrapper"], ["kendoButton", "", 3, "click"], [4, "ngIf"], ["class", "grid", 4, "ngIf"], ["Mode", "section", 3, "Record", "SectionName", "Visible", "AutoRevertOnCancel", "HandleSave", "Width", "Height", "close"], ["entityForm", ""], [3, "title", "width", "height", "close", 4, "ngIf"], [1, "grid"], [4, "ngFor", "ngForOf"], [3, "click", 4, "ngFor", "ngForOf"], [3, "click"], ["class", "icon", 3, "icon", "click", 4, "ngIf"], [1, "icon", 3, "icon", "click"], [3, "title", "width", "height", "close"], ["kendoButton", "", "themeColor", "primary", 3, "click"]], template: function SimpleRecordListComponent_Template(rf, ctx) { if (rf & 1) {
280
+ i0.ɵɵelementStart(0, "div", 0)(1, "button", 1);
281
+ i0.ɵɵlistener("click", function SimpleRecordListComponent_Template_button_click_1_listener() { return ctx.createNewRecord(); });
282
+ i0.ɵɵtext(2, "New Record");
283
+ i0.ɵɵelementEnd();
284
+ i0.ɵɵtemplate(3, SimpleRecordListComponent_div_3_Template, 2, 0, "div", 2)(4, SimpleRecordListComponent_table_4_Template, 6, 2, "table", 3);
285
+ i0.ɵɵelementEnd();
286
+ i0.ɵɵelementStart(5, "mj-entity-form-dialog", 4, 5);
287
+ i0.ɵɵlistener("close", function SimpleRecordListComponent_Template_mj_entity_form_dialog_close_5_listener($event) { return ctx.onEditOrNewRecordFormClosed($event); });
288
+ i0.ɵɵelementEnd();
289
+ i0.ɵɵtemplate(7, SimpleRecordListComponent_kendo_dialog_7_Template, 8, 4, "kendo-dialog", 6);
290
+ } if (rf & 2) {
291
+ i0.ɵɵadvance(3);
292
+ i0.ɵɵproperty("ngIf", ctx.isLoading);
293
+ i0.ɵɵadvance();
294
+ i0.ɵɵproperty("ngIf", !ctx.isLoading);
295
+ i0.ɵɵadvance();
296
+ i0.ɵɵproperty("Record", ctx.editOrNewRecord)("SectionName", ctx.EditSectionName)("Visible", ctx.showEditOrNewRecordForm)("AutoRevertOnCancel", true)("HandleSave", true)("Width", 550)("Height", 450);
297
+ i0.ɵɵadvance(2);
298
+ i0.ɵɵproperty("ngIf", ctx.deleteRecordDialogVisible && ctx.deleteRecord);
299
+ } }, dependencies: [i2.NgForOf, i2.NgIf, i3.DialogComponent, i3.DialogActionsComponent, i4.FillContainer, i5.ButtonComponent, i6.SVGIconComponent, i7.EntityFormDialog, i8.LoaderComponent], styles: ["button[_ngcontent-%COMP%] {\r\n margin-left: 5px;\r\n margin-top: 5px;\r\n width: 125px;\r\n}\r\n\r\n.wrapper[_ngcontent-%COMP%] {\r\n padding-right: 10px;\r\n}\r\n\r\n\n\r\ntable[_ngcontent-%COMP%] {\r\n margin-left: 5px;\r\n margin-top: 10px;\r\n margin-right: 5px;\r\n border-collapse: collapse; \n\r\n width: 100%;\r\n}\r\n \r\ntable[_ngcontent-%COMP%] th[_ngcontent-%COMP%] {\r\n background-color: #f2f2f2; \n\r\n color: black; \n\r\n font-weight: bold; \n\r\n text-align: left;\r\n}\r\n\r\n\n\r\ntable[_ngcontent-%COMP%] th[_ngcontent-%COMP%], table[_ngcontent-%COMP%] td[_ngcontent-%COMP%] {\r\n height: 36px; \n\r\n padding: 0 8px; \n\r\n}\r\n\r\n\n\r\ntable[_ngcontent-%COMP%] td[_ngcontent-%COMP%]:first-child {\r\n display: flex; \n\r\n justify-content: space-between; \n\r\n align-items: center; \n\r\n padding-right: 8px; \n\r\n}\r\n\r\n\n\r\ntd[_ngcontent-%COMP%]:first-child span[_ngcontent-%COMP%]:first-child {\r\n border: none; \n\r\n}\r\n\r\n\n\r\ntd[_ngcontent-%COMP%]:first-child span[_ngcontent-%COMP%]:last-child {\r\n border: none; \n\r\n}\r\n\r\n\n\r\ntd[_ngcontent-%COMP%]:first-child .icon[_ngcontent-%COMP%] {\r\n margin-left: 10px; \n\r\n cursor: pointer; \n\r\n}\r\n\r\ntable[_ngcontent-%COMP%] tr[_ngcontent-%COMP%] {\r\n cursor: pointer;\r\n}\r\n\r\ntable[_ngcontent-%COMP%] tr[_ngcontent-%COMP%]:hover {\r\n background-color: #e7f4ff; \n\r\n}"] });
300
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(SimpleRecordListComponent, [{
301
+ type: Component,
302
+ args: [{ selector: 'mj-simple-record-list', template: "<div mjFillContainer class=\"wrapper\">\r\n <button kendoButton (click)=\"createNewRecord()\">New Record</button>\r\n <div *ngIf=\"isLoading\"><kendo-loader></kendo-loader></div>\r\n <table *ngIf=\"!isLoading\" class=\"grid\">\r\n <thead>\r\n <tr>\r\n <th *ngFor=\"let c of Columns\">\r\n {{ c }}\r\n </th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr *ngFor=\"let r of records\" (click)=\"selectRecord(undefined, r)\">\r\n <td *ngFor=\"let c of Columns; let i = index\">\r\n <span>{{ r.Get(c) }}</span>\r\n <span *ngIf=\"i === 0 && (this.AllowDelete || this.AllowEdit)\">\r\n <kendo-svgicon *ngIf=\"this.AllowEdit\" class='icon' [icon]=\"kendoSVGIcon('pencil')\" (click)=\"editRecord($event, r)\"></kendo-svgicon> \r\n <kendo-svgicon *ngIf=\"this.AllowEdit\" class='icon' [icon]=\"kendoSVGIcon('trash')\" (click)=\"deleteRecord($event, r)\"></kendo-svgicon>\r\n </span>\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n</div>\r\n \r\n<mj-entity-form-dialog #entityForm \r\n [Record]=\"editOrNewRecord\" \r\n [SectionName]=\"EditSectionName\"\r\n Mode=\"section\" \r\n [Visible]=\"showEditOrNewRecordForm\" \r\n [AutoRevertOnCancel]=\"true\"\r\n [HandleSave]=\"true\"\r\n [Width]=\"550\"\r\n [Height]=\"450\"\r\n (close)=\"onEditOrNewRecordFormClosed($event)\">\r\n</mj-entity-form-dialog>\r\n\r\n<kendo-dialog\r\n *ngIf=\"deleteRecordDialogVisible && deleteRecord\" \r\n [title]=\"'Delete ' + EntityName + '?'\" \r\n [width]=\"450\"\r\n [height]=\"200\"\r\n (close)=\"closeDeleteDialog('No')\" >\r\n <div>\r\n Are you sure you want to delete '{{getRecordName(deleteRecordItem!)}}'?\r\n </div>\r\n <kendo-dialog-actions>\r\n <button kendoButton (click)=\"closeDeleteDialog('Yes')\" themeColor=\"primary\">Yes</button>\r\n <button kendoButton (click)=\"closeDeleteDialog('No')\">No</button>\r\n </kendo-dialog-actions>\r\n</kendo-dialog>", styles: ["button {\r\n margin-left: 5px;\r\n margin-top: 5px;\r\n width: 125px;\r\n}\r\n\r\n.wrapper {\r\n padding-right: 10px;\r\n}\r\n\r\n/* Style for the whole table */\r\ntable {\r\n margin-left: 5px;\r\n margin-top: 10px;\r\n margin-right: 5px;\r\n border-collapse: collapse; /* Ensures border collapse for a cleaner look */\r\n width: 100%;\r\n}\r\n \r\ntable th {\r\n background-color: #f2f2f2; /* Light gray background for headers */\r\n color: black; /* Black text color for headers */\r\n font-weight: bold; /* Bold font weight for headers */\r\n text-align: left;\r\n}\r\n\r\n/* Style for all table cells */\r\ntable th, table td {\r\n height: 36px; /* Fixed height for all rows */\r\n padding: 0 8px; /* Add some padding inside cells */\r\n}\r\n\r\n/* Style for the first column cells */\r\ntable td:first-child {\r\n display: flex; /* Make the cell a flex container */\r\n justify-content: space-between; /* Space out the text and icons */\r\n align-items: center; /* Center items vertically */\r\n padding-right: 8px; /* Ensure there is some padding on the right */\r\n}\r\n\r\n/* Style for the text span within the first column */\r\ntd:first-child span:first-child {\r\n border: none; /* Ensures no border is applied to the span */\r\n}\r\n\r\n/* Style for the icons container span within the first column */\r\ntd:first-child span:last-child {\r\n border: none; /* Ensures no border is applied to the span */\r\n}\r\n\r\n/* Style for the icons within the first column */\r\ntd:first-child .icon {\r\n margin-left: 10px; /* Space between icons if needed */\r\n cursor: pointer; /* Change cursor to pointer on hover */\r\n}\r\n\r\ntable tr {\r\n cursor: pointer;\r\n}\r\n\r\ntable tr:hover {\r\n background-color: #e7f4ff; /* Light blue for even rows */\r\n}\r\n "] }]
303
+ }], () => [{ type: i1.Router }], { EntityName: [{
304
+ type: Input
305
+ }], Columns: [{
306
+ type: Input
307
+ }], SortBy: [{
308
+ type: Input
309
+ }], AllowDelete: [{
310
+ type: Input
311
+ }], AllowNew: [{
312
+ type: Input
313
+ }], AllowEdit: [{
314
+ type: Input
315
+ }], EditSectionName: [{
316
+ type: Input
317
+ }], RecordSelected: [{
318
+ type: Output
319
+ }], RecordEdited: [{
320
+ type: Output
321
+ }], RecordCreated: [{
322
+ type: Output
323
+ }] }); })();
324
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(SimpleRecordListComponent, { className: "SimpleRecordListComponent", filePath: "src\\lib\\simple-record-list\\simple-record-list.component.ts", lineNumber: 13 }); })();
@@ -0,0 +1,2 @@
1
+ export * from './lib/simple-record-list/simple-record-list.component';
2
+ export * from './lib/module';
@@ -0,0 +1,5 @@
1
+ /*
2
+ * Public API Surface
3
+ */
4
+ export * from './lib/simple-record-list/simple-record-list.component';
5
+ export * from './lib/module';
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@memberjunction/ng-simple-record-list",
3
+ "version": "0.9.2",
4
+ "description": "MemberJunction: Very simple and reusable Angular component for displaying, editing, creating and deleting records in any entity",
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": "~17.2.2",
19
+ "@angular/compiler-cli": "~17.2.2"
20
+ },
21
+ "peerDependencies": {
22
+ "@angular/common": "~17.2.2",
23
+ "@angular/core": "~17.2.2",
24
+ "@angular/forms": "~17.2.2",
25
+ "@angular/router": "~17.2.2"
26
+ },
27
+ "dependencies": {
28
+ "@memberjunction/core-entities": "^0.9.166",
29
+ "@memberjunction/global": "^0.9.156",
30
+ "@memberjunction/core": "^0.9.177",
31
+ "@memberjunction/ng-container-directives": "^0.9.141",
32
+ "@memberjunction/ng-shared": "^0.9.34",
33
+ "@memberjunction/ng-entity-form-dialog": "^0.9.2",
34
+ "@progress/kendo-angular-buttons": "~15.1.0",
35
+ "@progress/kendo-angular-dialog": "~15.1.0",
36
+ "@progress/kendo-angular-layout": "~15.1.0",
37
+ "@progress/kendo-angular-indicators": "~15.1.0",
38
+ "tslib": "^2.3.0"
39
+ },
40
+ "sideEffects": false
41
+ }