@memberjunction/ng-base-forms 0.9.3 → 0.9.5
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/base-form-component.js +14 -1
- package/dist/lib/form-toolbar.d.ts +1 -0
- package/dist/lib/form-toolbar.js +27 -19
- package/dist/module.d.ts +2 -1
- package/dist/module.js +7 -3
- package/package.json +5 -4
|
@@ -65,7 +65,7 @@ export class BaseFormComponent extends BaseRecordComponent {
|
|
|
65
65
|
// now resize after a pause to allow the UI to settle
|
|
66
66
|
setTimeout(() => {
|
|
67
67
|
this.sharedService.InvokeManualResize();
|
|
68
|
-
},
|
|
68
|
+
}, 250);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
}
|
|
@@ -211,6 +211,19 @@ export class BaseFormComponent extends BaseRecordComponent {
|
|
|
211
211
|
SaveRecord(StopEditModeAfterSave) {
|
|
212
212
|
return __awaiter(this, void 0, void 0, function* () {
|
|
213
213
|
try {
|
|
214
|
+
try {
|
|
215
|
+
// atempt to blur the active element to force any pending changes to be committed
|
|
216
|
+
document.activeElement.blur();
|
|
217
|
+
if (this.userViewGridComponents.length > 0) {
|
|
218
|
+
// tell all our grids to finish up their editing
|
|
219
|
+
// if we have grids, create a slight delay, ensuring focus is lost on components that require that to update the model
|
|
220
|
+
this.userViewGridComponents.forEach(grid => { grid.EditingComplete(); });
|
|
221
|
+
yield this.Wait(100);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
catch (e2) {
|
|
225
|
+
// ignore
|
|
226
|
+
}
|
|
214
227
|
if (this.record) {
|
|
215
228
|
yield this.PopulatePendingRecords(); // do this before we validate as we must validate pending records too
|
|
216
229
|
const valResults = this.Validate();
|
|
@@ -2,6 +2,7 @@ import { BaseFormComponent } from './base-form-component';
|
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
3
|
export declare class FormToolbarComponent {
|
|
4
4
|
form: BaseFormComponent;
|
|
5
|
+
saveRecord(event: MouseEvent): void;
|
|
5
6
|
static ɵfac: i0.ɵɵFactoryDeclaration<FormToolbarComponent, never>;
|
|
6
7
|
static ɵcmp: i0.ɵɵComponentDeclaration<FormToolbarComponent, "mj-form-toolbar", never, { "form": { "alias": "form"; "required": false; }; }, {}, never, never, false, never>;
|
|
7
8
|
}
|
package/dist/lib/form-toolbar.js
CHANGED
|
@@ -2,51 +2,52 @@ import { Component, Input } from '@angular/core';
|
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
3
|
import * as i1 from "@angular/common";
|
|
4
4
|
import * as i2 from "@memberjunction/ng-record-changes";
|
|
5
|
+
import * as i3 from "@progress/kendo-angular-buttons";
|
|
5
6
|
function FormToolbarComponent_button_0_Template(rf, ctx) { if (rf & 1) {
|
|
6
7
|
const _r8 = i0.ɵɵgetCurrentView();
|
|
7
|
-
i0.ɵɵelementStart(0, "button",
|
|
8
|
+
i0.ɵɵelementStart(0, "button", 3);
|
|
8
9
|
i0.ɵɵlistener("click", function FormToolbarComponent_button_0_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r8); const ctx_r7 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r7.form.StartEditMode()); });
|
|
9
10
|
i0.ɵɵtext(1, "Edit Record");
|
|
10
11
|
i0.ɵɵelementEnd();
|
|
11
12
|
} }
|
|
12
13
|
function FormToolbarComponent_button_1_Template(rf, ctx) { if (rf & 1) {
|
|
13
14
|
const _r10 = i0.ɵɵgetCurrentView();
|
|
14
|
-
i0.ɵɵelementStart(0, "button",
|
|
15
|
-
i0.ɵɵlistener("
|
|
15
|
+
i0.ɵɵelementStart(0, "button", 4);
|
|
16
|
+
i0.ɵɵlistener("mouseup", function FormToolbarComponent_button_1_Template_button_mouseup_0_listener($event) { i0.ɵɵrestoreView(_r10); const ctx_r9 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r9.saveRecord($event)); });
|
|
16
17
|
i0.ɵɵtext(1, "Save Record");
|
|
17
18
|
i0.ɵɵelementEnd();
|
|
18
19
|
} }
|
|
19
20
|
function FormToolbarComponent_button_2_Template(rf, ctx) { if (rf & 1) {
|
|
20
21
|
const _r12 = i0.ɵɵgetCurrentView();
|
|
21
|
-
i0.ɵɵelementStart(0, "button",
|
|
22
|
+
i0.ɵɵelementStart(0, "button", 3);
|
|
22
23
|
i0.ɵɵlistener("click", function FormToolbarComponent_button_2_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r12); const ctx_r11 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r11.form.CancelEdit()); });
|
|
23
24
|
i0.ɵɵtext(1, "Cancel");
|
|
24
25
|
i0.ɵɵelementEnd();
|
|
25
26
|
} }
|
|
26
27
|
function FormToolbarComponent_button_3_Template(rf, ctx) { if (rf & 1) {
|
|
27
28
|
const _r14 = i0.ɵɵgetCurrentView();
|
|
28
|
-
i0.ɵɵelementStart(0, "button",
|
|
29
|
+
i0.ɵɵelementStart(0, "button", 3);
|
|
29
30
|
i0.ɵɵlistener("click", function FormToolbarComponent_button_3_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r14); const ctx_r13 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r13.form.RemoveFavorite()); });
|
|
30
31
|
i0.ɵɵtext(1, "Remove Favorite");
|
|
31
32
|
i0.ɵɵelementEnd();
|
|
32
33
|
} }
|
|
33
34
|
function FormToolbarComponent_button_4_Template(rf, ctx) { if (rf & 1) {
|
|
34
35
|
const _r16 = i0.ɵɵgetCurrentView();
|
|
35
|
-
i0.ɵɵelementStart(0, "button",
|
|
36
|
+
i0.ɵɵelementStart(0, "button", 3);
|
|
36
37
|
i0.ɵɵlistener("click", function FormToolbarComponent_button_4_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r16); const ctx_r15 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r15.form.MakeFavorite()); });
|
|
37
38
|
i0.ɵɵtext(1, "Make Favorite");
|
|
38
39
|
i0.ɵɵelementEnd();
|
|
39
40
|
} }
|
|
40
41
|
function FormToolbarComponent_button_5_Template(rf, ctx) { if (rf & 1) {
|
|
41
42
|
const _r18 = i0.ɵɵgetCurrentView();
|
|
42
|
-
i0.ɵɵelementStart(0, "button",
|
|
43
|
+
i0.ɵɵelementStart(0, "button", 3);
|
|
43
44
|
i0.ɵɵlistener("click", function FormToolbarComponent_button_5_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r18); const ctx_r17 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r17.form.handleHistoryDialog()); });
|
|
44
45
|
i0.ɵɵtext(1, "History");
|
|
45
46
|
i0.ɵɵelementEnd();
|
|
46
47
|
} }
|
|
47
48
|
function FormToolbarComponent_mj_record_changes_7_Template(rf, ctx) { if (rf & 1) {
|
|
48
49
|
const _r20 = i0.ɵɵgetCurrentView();
|
|
49
|
-
i0.ɵɵelementStart(0, "mj-record-changes",
|
|
50
|
+
i0.ɵɵelementStart(0, "mj-record-changes", 5);
|
|
50
51
|
i0.ɵɵlistener("dialogClosed", function FormToolbarComponent_mj_record_changes_7_Template_mj_record_changes_dialogClosed_0_listener() { i0.ɵɵrestoreView(_r20); const ctx_r19 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r19.form.handleHistoryDialog()); });
|
|
51
52
|
i0.ɵɵelementEnd();
|
|
52
53
|
} if (rf & 2) {
|
|
@@ -54,12 +55,19 @@ function FormToolbarComponent_mj_record_changes_7_Template(rf, ctx) { if (rf & 1
|
|
|
54
55
|
i0.ɵɵproperty("record", ctx_r6.form.record);
|
|
55
56
|
} }
|
|
56
57
|
export class FormToolbarComponent {
|
|
58
|
+
saveRecord(event) {
|
|
59
|
+
// Ensure the button takes focus
|
|
60
|
+
const button = event.target;
|
|
61
|
+
button.focus();
|
|
62
|
+
// Proceed to call your save record function
|
|
63
|
+
this.form.SaveRecord(true);
|
|
64
|
+
}
|
|
57
65
|
}
|
|
58
66
|
FormToolbarComponent.ɵfac = function FormToolbarComponent_Factory(t) { return new (t || FormToolbarComponent)(); };
|
|
59
|
-
FormToolbarComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: FormToolbarComponent, selectors: [["mj-form-toolbar"]], inputs: { form: "form" }, decls: 8, vars: 7, consts: [["kendoButton", "", 3, "click", 4, "ngIf"], [3, "record", "dialogClosed", 4, "ngIf"], ["kendoButton", "", 3, "click"], [3, "record", "dialogClosed"]], template: function FormToolbarComponent_Template(rf, ctx) { if (rf & 1) {
|
|
60
|
-
i0.ɵɵtemplate(0, FormToolbarComponent_button_0_Template, 2, 0, "button", 0)(1, FormToolbarComponent_button_1_Template, 2, 0, "button",
|
|
67
|
+
FormToolbarComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: FormToolbarComponent, selectors: [["mj-form-toolbar"]], inputs: { form: "form" }, decls: 8, vars: 7, consts: [["kendoButton", "", 3, "click", 4, "ngIf"], ["kendoButton", "", 3, "mouseup", 4, "ngIf"], [3, "record", "dialogClosed", 4, "ngIf"], ["kendoButton", "", 3, "click"], ["kendoButton", "", 3, "mouseup"], [3, "record", "dialogClosed"]], template: function FormToolbarComponent_Template(rf, ctx) { if (rf & 1) {
|
|
68
|
+
i0.ɵɵtemplate(0, FormToolbarComponent_button_0_Template, 2, 0, "button", 0)(1, FormToolbarComponent_button_1_Template, 2, 0, "button", 1)(2, FormToolbarComponent_button_2_Template, 2, 0, "button", 0)(3, FormToolbarComponent_button_3_Template, 2, 0, "button", 0)(4, FormToolbarComponent_button_4_Template, 2, 0, "button", 0)(5, FormToolbarComponent_button_5_Template, 2, 0, "button", 0);
|
|
61
69
|
i0.ɵɵelement(6, "hr");
|
|
62
|
-
i0.ɵɵtemplate(7, FormToolbarComponent_mj_record_changes_7_Template, 1, 1, "mj-record-changes",
|
|
70
|
+
i0.ɵɵtemplate(7, FormToolbarComponent_mj_record_changes_7_Template, 1, 1, "mj-record-changes", 2);
|
|
63
71
|
} if (rf & 2) {
|
|
64
72
|
i0.ɵɵproperty("ngIf", !ctx.form.EditMode && ctx.form.UserCanEdit);
|
|
65
73
|
i0.ɵɵadvance();
|
|
@@ -74,18 +82,18 @@ FormToolbarComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: FormTo
|
|
|
74
82
|
i0.ɵɵproperty("ngIf", ctx.form.EntityInfo == null ? null : ctx.form.EntityInfo.TrackRecordChanges);
|
|
75
83
|
i0.ɵɵadvance(2);
|
|
76
84
|
i0.ɵɵproperty("ngIf", ctx.form.isHistoryDialogOpen);
|
|
77
|
-
} }, dependencies: [i1.NgIf, i2.RecordChangesComponent], styles: ["button[_ngcontent-%COMP%] { margin-right: 10px; }"] });
|
|
85
|
+
} }, dependencies: [i1.NgIf, i2.RecordChangesComponent, i3.ButtonComponent], styles: ["button[_ngcontent-%COMP%] { margin-right: 10px; }"] });
|
|
78
86
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(FormToolbarComponent, [{
|
|
79
87
|
type: Component,
|
|
80
88
|
args: [{ selector: 'mj-form-toolbar', template: `
|
|
81
|
-
<button kendoButton *ngIf="!
|
|
82
|
-
<button kendoButton *ngIf="
|
|
83
|
-
<button kendoButton *ngIf="
|
|
84
|
-
<button kendoButton *ngIf="
|
|
85
|
-
<button kendoButton *ngIf="
|
|
86
|
-
<button kendoButton *ngIf="
|
|
89
|
+
<button kendoButton *ngIf="!form.EditMode && form.UserCanEdit" (click)="form.StartEditMode()">Edit Record</button>
|
|
90
|
+
<button kendoButton *ngIf="form.EditMode" (mouseup)="saveRecord($event)">Save Record</button>
|
|
91
|
+
<button kendoButton *ngIf="form.EditMode" (click)="form.CancelEdit()">Cancel</button>
|
|
92
|
+
<button kendoButton *ngIf="form.FavoriteInitDone && form.IsFavorite" (click)="form.RemoveFavorite()">Remove Favorite</button>
|
|
93
|
+
<button kendoButton *ngIf="form.FavoriteInitDone && !form.IsFavorite" (click)="form.MakeFavorite()">Make Favorite</button>
|
|
94
|
+
<button kendoButton *ngIf="form.EntityInfo?.TrackRecordChanges" (click)="form.handleHistoryDialog()">History</button>
|
|
87
95
|
<hr />
|
|
88
|
-
<mj-record-changes *ngIf="
|
|
96
|
+
<mj-record-changes *ngIf="form.isHistoryDialogOpen" [record]="form.record" (dialogClosed)="form.handleHistoryDialog()"></mj-record-changes>
|
|
89
97
|
`, styles: ["button { margin-right: 10px; }"] }]
|
|
90
98
|
}], null, { form: [{
|
|
91
99
|
type: Input
|
package/dist/module.d.ts
CHANGED
|
@@ -5,8 +5,9 @@ import * as i3 from "@angular/common";
|
|
|
5
5
|
import * as i4 from "@angular/forms";
|
|
6
6
|
import * as i5 from "@progress/kendo-angular-layout";
|
|
7
7
|
import * as i6 from "@memberjunction/ng-record-changes";
|
|
8
|
+
import * as i7 from "@progress/kendo-angular-buttons";
|
|
8
9
|
export declare class BaseFormsModule {
|
|
9
10
|
static ɵfac: i0.ɵɵFactoryDeclaration<BaseFormsModule, never>;
|
|
10
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<BaseFormsModule, [typeof i1.SectionLoaderComponent, typeof i2.FormToolbarComponent], [typeof i3.CommonModule, typeof i4.FormsModule, typeof i5.TabStripModule, typeof i6.RecordChangesModule], [typeof i1.SectionLoaderComponent, typeof i2.FormToolbarComponent]>;
|
|
11
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<BaseFormsModule, [typeof i1.SectionLoaderComponent, typeof i2.FormToolbarComponent], [typeof i3.CommonModule, typeof i4.FormsModule, typeof i5.TabStripModule, typeof i6.RecordChangesModule, typeof i7.ButtonsModule], [typeof i1.SectionLoaderComponent, typeof i2.FormToolbarComponent]>;
|
|
11
12
|
static ɵinj: i0.ɵɵInjectorDeclaration<BaseFormsModule>;
|
|
12
13
|
}
|
package/dist/module.js
CHANGED
|
@@ -6,6 +6,7 @@ import { TabStripModule } from '@progress/kendo-angular-layout';
|
|
|
6
6
|
import { SectionLoaderComponent } from './lib/section-loader-component';
|
|
7
7
|
import { FormToolbarComponent } from './lib/form-toolbar';
|
|
8
8
|
import { RecordChangesModule } from '@memberjunction/ng-record-changes';
|
|
9
|
+
import { ButtonsModule } from '@progress/kendo-angular-buttons';
|
|
9
10
|
import * as i0 from "@angular/core";
|
|
10
11
|
export class BaseFormsModule {
|
|
11
12
|
}
|
|
@@ -14,7 +15,8 @@ BaseFormsModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: BaseFormsMod
|
|
|
14
15
|
BaseFormsModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
|
|
15
16
|
FormsModule,
|
|
16
17
|
TabStripModule,
|
|
17
|
-
RecordChangesModule
|
|
18
|
+
RecordChangesModule,
|
|
19
|
+
ButtonsModule] });
|
|
18
20
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(BaseFormsModule, [{
|
|
19
21
|
type: NgModule,
|
|
20
22
|
args: [{
|
|
@@ -26,7 +28,8 @@ BaseFormsModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonMo
|
|
|
26
28
|
CommonModule,
|
|
27
29
|
FormsModule,
|
|
28
30
|
TabStripModule,
|
|
29
|
-
RecordChangesModule
|
|
31
|
+
RecordChangesModule,
|
|
32
|
+
ButtonsModule
|
|
30
33
|
],
|
|
31
34
|
exports: [
|
|
32
35
|
SectionLoaderComponent,
|
|
@@ -38,5 +41,6 @@ BaseFormsModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonMo
|
|
|
38
41
|
FormToolbarComponent], imports: [CommonModule,
|
|
39
42
|
FormsModule,
|
|
40
43
|
TabStripModule,
|
|
41
|
-
RecordChangesModule
|
|
44
|
+
RecordChangesModule,
|
|
45
|
+
ButtonsModule], exports: [SectionLoaderComponent,
|
|
42
46
|
FormToolbarComponent] }); })();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/ng-base-forms",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.5",
|
|
4
4
|
"description": "MemberJunction: Angular Base Form Components",
|
|
5
5
|
"main": "./dist/public-api.js",
|
|
6
6
|
"typings": "./dist/public-api.d.ts",
|
|
@@ -27,10 +27,11 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@memberjunction/global": "^0.9.156",
|
|
29
29
|
"@memberjunction/core": "^0.9.177",
|
|
30
|
-
"@memberjunction/ng-shared": "^0.9.
|
|
31
|
-
"@memberjunction/ng-record-changes": "^0.9.
|
|
32
|
-
"@memberjunction/ng-user-view-grid": "^0.9.
|
|
30
|
+
"@memberjunction/ng-shared": "^0.9.36",
|
|
31
|
+
"@memberjunction/ng-record-changes": "^0.9.118",
|
|
32
|
+
"@memberjunction/ng-user-view-grid": "^0.9.219",
|
|
33
33
|
"@progress/kendo-angular-layout": "~15.1.0",
|
|
34
|
+
"@progress/kendo-angular-buttons": "~15.1.0",
|
|
34
35
|
"tslib": "^2.3.0"
|
|
35
36
|
},
|
|
36
37
|
"sideEffects": false
|