@memberjunction/ng-form-toolbar 1.4.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.
@@ -0,0 +1,43 @@
1
+ import { OnInit } from '@angular/core';
2
+ import { BaseFormComponent } from '@memberjunction/ng-base-forms';
3
+ import { CompositeKey } from '@memberjunction/core';
4
+ import { Router } from '@angular/router';
5
+ import * as i0 from "@angular/core";
6
+ export declare class FormToolbarComponent implements OnInit {
7
+ private router;
8
+ ShowSkipChatButton: boolean;
9
+ form: BaseFormComponent;
10
+ /**
11
+ * This property does not get modified by the toolbar as things change within its state, it is the global setting you can change to disable the toolbar
12
+ */
13
+ Disabled: boolean;
14
+ /**
15
+ * Determines if the toolbar is enabled or disabled.
16
+ */
17
+ get CurrentlyDisabled(): boolean;
18
+ /**
19
+ * Internal property that changes over time based on the state of the record being managed. Don't access this directly, use the CurrentlyDisabled property instead.
20
+ */
21
+ _currentlyDisabled: boolean;
22
+ /**
23
+ * Internal property used to determine if the delete record confirmation dialog is currently displayed or not
24
+ */
25
+ _deleteDialogVisible: boolean;
26
+ /**
27
+ * Internal property used to determine if the skip chat window is currently displayed or not
28
+ */
29
+ _skipChatDialogVisible: boolean;
30
+ get LinkedEntityPrimaryKey(): CompositeKey;
31
+ constructor(router: Router);
32
+ ngOnInit(): Promise<void>;
33
+ saveExistingRecord(event: MouseEvent): Promise<void>;
34
+ /**
35
+ * This method is called internally when the user clicks on the Skip button, and also can be invoked manually in code to show the Skip dialog.
36
+ */
37
+ ShowSkipChat(): void;
38
+ toggleDeleteDialog(show: boolean): void;
39
+ deleteRecord(): Promise<void>;
40
+ static ɵfac: i0.ɵɵFactoryDeclaration<FormToolbarComponent, never>;
41
+ static ɵcmp: i0.ɵɵComponentDeclaration<FormToolbarComponent, "mj-form-toolbar", never, { "ShowSkipChatButton": { "alias": "ShowSkipChatButton"; "required": false; }; "form": { "alias": "form"; "required": false; }; }, {}, never, never, false, never>;
42
+ }
43
+ //# sourceMappingURL=form-toolbar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-toolbar.d.ts","sourceRoot":"","sources":["../../src/lib/form-toolbar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,MAAM,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,EAAc,YAAY,EAA8B,MAAM,sBAAsB,CAAC;AAC5F,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;;AAIzC,qBAKa,oBAAqB,YAAW,MAAM;IAmC5B,OAAO,CAAC,MAAM;IAlCxB,kBAAkB,EAAE,OAAO,CAAQ;IACnC,IAAI,EAAG,iBAAiB,CAAC;IAGlC;;OAEG;IACI,QAAQ,EAAE,OAAO,CAAS;IAEjC;;OAEG;IACH,IAAW,iBAAiB,IAAI,OAAO,CAEtC;IAED;;OAEG;IACI,kBAAkB,EAAE,OAAO,CAAS;IAE3C;;OAEG;IACI,oBAAoB,EAAE,OAAO,CAAS;IAC7C;;OAEG;IACI,sBAAsB,EAAE,OAAO,CAAS;IAE/C,IAAW,sBAAsB,IAAI,YAAY,CAEhD;gBAE0B,MAAM,EAAE,MAAM;IAG5B,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAGzB,kBAAkB,CAAC,KAAK,EAAE,UAAU;IAgEjD;;OAEG;IACI,YAAY,IAAI,IAAI;IAKpB,kBAAkB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IAIjC,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;yCArHjC,oBAAoB;2CAApB,oBAAoB;CA6IhC"}
@@ -0,0 +1,304 @@
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 } from '@angular/core';
11
+ import { EventCodes, SharedService } from '@memberjunction/ng-shared';
12
+ import { MJEventType, MJGlobal } from '@memberjunction/global';
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 "@memberjunction/ng-record-changes";
17
+ import * as i4 from "@progress/kendo-angular-buttons";
18
+ import * as i5 from "@progress/kendo-angular-dialog";
19
+ import * as i6 from "@memberjunction/ng-ask-skip";
20
+ function FormToolbarComponent_Conditional_1_Conditional_0_Template(rf, ctx) { if (rf & 1) {
21
+ const _r11 = i0.ɵɵgetCurrentView();
22
+ i0.ɵɵelementStart(0, "button", 8);
23
+ i0.ɵɵlistener("click", function FormToolbarComponent_Conditional_1_Conditional_0_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r11); const ctx_r10 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r10.form.StartEditMode()); });
24
+ i0.ɵɵelement(1, "span", 9);
25
+ i0.ɵɵelementStart(2, "span", 10);
26
+ i0.ɵɵtext(3, "Edit");
27
+ i0.ɵɵelementEnd()();
28
+ } }
29
+ function FormToolbarComponent_Conditional_1_Conditional_1_Template(rf, ctx) { if (rf & 1) {
30
+ const _r13 = i0.ɵɵgetCurrentView();
31
+ i0.ɵɵelementStart(0, "button", 11);
32
+ i0.ɵɵlistener("click", function FormToolbarComponent_Conditional_1_Conditional_1_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r13); const ctx_r12 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r12.toggleDeleteDialog(true)); });
33
+ i0.ɵɵelement(1, "span", 12);
34
+ i0.ɵɵelementEnd();
35
+ } }
36
+ function FormToolbarComponent_Conditional_1_Conditional_2_Conditional_0_Template(rf, ctx) { if (rf & 1) {
37
+ const _r17 = i0.ɵɵgetCurrentView();
38
+ i0.ɵɵelementStart(0, "button", 14);
39
+ i0.ɵɵlistener("click", function FormToolbarComponent_Conditional_1_Conditional_2_Conditional_0_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r17); const ctx_r16 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r16.form.RemoveFavorite()); });
40
+ i0.ɵɵelement(1, "span", 15);
41
+ i0.ɵɵelementEnd();
42
+ } }
43
+ function FormToolbarComponent_Conditional_1_Conditional_2_Conditional_1_Template(rf, ctx) { if (rf & 1) {
44
+ const _r19 = i0.ɵɵgetCurrentView();
45
+ i0.ɵɵelementStart(0, "button", 16);
46
+ i0.ɵɵlistener("click", function FormToolbarComponent_Conditional_1_Conditional_2_Conditional_1_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r19); const ctx_r18 = i0.ɵɵnextContext(3); return i0.ɵɵresetView(ctx_r18.form.MakeFavorite()); });
47
+ i0.ɵɵelement(1, "span", 17);
48
+ i0.ɵɵelementEnd();
49
+ } }
50
+ function FormToolbarComponent_Conditional_1_Conditional_2_Template(rf, ctx) { if (rf & 1) {
51
+ i0.ɵɵtemplate(0, FormToolbarComponent_Conditional_1_Conditional_2_Conditional_0_Template, 2, 0, "button", 13)(1, FormToolbarComponent_Conditional_1_Conditional_2_Conditional_1_Template, 2, 0);
52
+ } if (rf & 2) {
53
+ const ctx_r9 = i0.ɵɵnextContext(2);
54
+ i0.ɵɵconditional(0, ctx_r9.form.IsFavorite ? 0 : 1);
55
+ } }
56
+ function FormToolbarComponent_Conditional_1_Template(rf, ctx) { if (rf & 1) {
57
+ i0.ɵɵtemplate(0, FormToolbarComponent_Conditional_1_Conditional_0_Template, 4, 0, "button", 6)(1, FormToolbarComponent_Conditional_1_Conditional_1_Template, 2, 0, "button", 7)(2, FormToolbarComponent_Conditional_1_Conditional_2_Template, 2, 1);
58
+ } if (rf & 2) {
59
+ const ctx_r0 = i0.ɵɵnextContext();
60
+ i0.ɵɵconditional(0, ctx_r0.form.UserCanEdit ? 0 : -1);
61
+ i0.ɵɵadvance();
62
+ i0.ɵɵconditional(1, ctx_r0.form.UserCanDelete ? 1 : -1);
63
+ i0.ɵɵadvance();
64
+ i0.ɵɵconditional(2, ctx_r0.form.FavoriteInitDone ? 2 : -1);
65
+ } }
66
+ function FormToolbarComponent_Conditional_2_Conditional_4_Template(rf, ctx) { if (rf & 1) {
67
+ const _r23 = i0.ɵɵgetCurrentView();
68
+ i0.ɵɵelementStart(0, "button", 22);
69
+ i0.ɵɵlistener("click", function FormToolbarComponent_Conditional_2_Conditional_4_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r23); const ctx_r22 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r22.form.CancelEdit()); });
70
+ i0.ɵɵelement(1, "span", 23);
71
+ i0.ɵɵelementStart(2, "span", 10);
72
+ i0.ɵɵtext(3, "Cancel");
73
+ i0.ɵɵelementEnd()();
74
+ } }
75
+ function FormToolbarComponent_Conditional_2_Conditional_5_Template(rf, ctx) { if (rf & 1) {
76
+ const _r25 = i0.ɵɵgetCurrentView();
77
+ i0.ɵɵelementStart(0, "button", 24);
78
+ i0.ɵɵlistener("click", function FormToolbarComponent_Conditional_2_Conditional_5_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r25); const ctx_r24 = i0.ɵɵnextContext(2); return i0.ɵɵresetView(ctx_r24.form.ShowChanges()); });
79
+ i0.ɵɵelement(1, "span", 25);
80
+ i0.ɵɵelementStart(2, "span", 10);
81
+ i0.ɵɵtext(3, "Changes");
82
+ i0.ɵɵelementEnd()();
83
+ } }
84
+ function FormToolbarComponent_Conditional_2_Template(rf, ctx) { if (rf & 1) {
85
+ const _r27 = i0.ɵɵgetCurrentView();
86
+ i0.ɵɵelementStart(0, "button", 18);
87
+ i0.ɵɵlistener("mouseup", function FormToolbarComponent_Conditional_2_Template_button_mouseup_0_listener($event) { i0.ɵɵrestoreView(_r27); const ctx_r26 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r26.saveExistingRecord($event)); });
88
+ i0.ɵɵelement(1, "span", 19);
89
+ i0.ɵɵelementStart(2, "span", 10);
90
+ i0.ɵɵtext(3, "Save");
91
+ i0.ɵɵelementEnd()();
92
+ i0.ɵɵtemplate(4, FormToolbarComponent_Conditional_2_Conditional_4_Template, 4, 0, "button", 20)(5, FormToolbarComponent_Conditional_2_Conditional_5_Template, 4, 0, "button", 21);
93
+ } if (rf & 2) {
94
+ const ctx_r1 = i0.ɵɵnextContext();
95
+ i0.ɵɵadvance(4);
96
+ i0.ɵɵconditional(4, ctx_r1.form.record.IsSaved ? 4 : -1);
97
+ i0.ɵɵadvance();
98
+ i0.ɵɵconditional(5, ctx_r1.form.record.Dirty ? 5 : -1);
99
+ } }
100
+ function FormToolbarComponent_Conditional_3_Template(rf, ctx) { if (rf & 1) {
101
+ const _r29 = i0.ɵɵgetCurrentView();
102
+ i0.ɵɵelementStart(0, "button", 26);
103
+ i0.ɵɵlistener("click", function FormToolbarComponent_Conditional_3_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r29); const ctx_r28 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r28.form.handleHistoryDialog()); });
104
+ i0.ɵɵelement(1, "span", 27);
105
+ i0.ɵɵelementStart(2, "span", 10);
106
+ i0.ɵɵtext(3, "History");
107
+ i0.ɵɵelementEnd()();
108
+ } }
109
+ function FormToolbarComponent_Conditional_4_Template(rf, ctx) { if (rf & 1) {
110
+ const _r31 = i0.ɵɵgetCurrentView();
111
+ i0.ɵɵelementStart(0, "button", 28);
112
+ i0.ɵɵlistener("click", function FormToolbarComponent_Conditional_4_Template_button_click_0_listener() { i0.ɵɵrestoreView(_r31); const ctx_r30 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r30.ShowSkipChat()); });
113
+ i0.ɵɵelement(1, "span", 29);
114
+ i0.ɵɵelementEnd();
115
+ } }
116
+ function FormToolbarComponent_Conditional_5_Template(rf, ctx) { if (rf & 1) {
117
+ const _r34 = i0.ɵɵgetCurrentView();
118
+ i0.ɵɵelementStart(0, "mj-skip-chat-with-record-window", 30, 31);
119
+ i0.ɵɵlistener("WindowClosed", function FormToolbarComponent_Conditional_5_Template_mj_skip_chat_with_record_window_WindowClosed_0_listener() { i0.ɵɵrestoreView(_r34); const ctx_r33 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r33.ShowSkipChat()); });
120
+ i0.ɵɵelementEnd();
121
+ } if (rf & 2) {
122
+ const ctx_r4 = i0.ɵɵnextContext();
123
+ i0.ɵɵproperty("LinkedEntityID", ctx_r4.form.EntityInfo.ID)("LinkedEntityPrimaryKey", ctx_r4.LinkedEntityPrimaryKey)("WindowOpened", ctx_r4._skipChatDialogVisible);
124
+ } }
125
+ function FormToolbarComponent_Conditional_6_Template(rf, ctx) { if (rf & 1) {
126
+ const _r36 = i0.ɵɵgetCurrentView();
127
+ i0.ɵɵelementStart(0, "mj-record-changes", 32);
128
+ i0.ɵɵlistener("dialogClosed", function FormToolbarComponent_Conditional_6_Template_mj_record_changes_dialogClosed_0_listener() { i0.ɵɵrestoreView(_r36); const ctx_r35 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r35.form.handleHistoryDialog()); });
129
+ i0.ɵɵelementEnd();
130
+ } if (rf & 2) {
131
+ const ctx_r5 = i0.ɵɵnextContext();
132
+ i0.ɵɵproperty("record", ctx_r5.form.record);
133
+ } }
134
+ function FormToolbarComponent_kendo_dialog_7_Template(rf, ctx) { if (rf & 1) {
135
+ const _r38 = i0.ɵɵgetCurrentView();
136
+ i0.ɵɵelementStart(0, "kendo-dialog", 33);
137
+ i0.ɵɵlistener("close", function FormToolbarComponent_kendo_dialog_7_Template_kendo_dialog_close_0_listener() { i0.ɵɵrestoreView(_r38); const ctx_r37 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r37.toggleDeleteDialog(false)); });
138
+ i0.ɵɵelementStart(1, "p", 34);
139
+ i0.ɵɵtext(2, " Are you sure you want to delete this record? ");
140
+ i0.ɵɵelementEnd();
141
+ i0.ɵɵelementStart(3, "kendo-dialog-actions", 35)(4, "button", 36);
142
+ i0.ɵɵlistener("click", function FormToolbarComponent_kendo_dialog_7_Template_button_click_4_listener() { i0.ɵɵrestoreView(_r38); const ctx_r39 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r39.deleteRecord()); });
143
+ i0.ɵɵtext(5, " Yes, Delete ");
144
+ i0.ɵɵelementEnd();
145
+ i0.ɵɵelementStart(6, "button", 37);
146
+ i0.ɵɵlistener("click", function FormToolbarComponent_kendo_dialog_7_Template_button_click_6_listener() { i0.ɵɵrestoreView(_r38); const ctx_r40 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r40.toggleDeleteDialog(false)); });
147
+ i0.ɵɵtext(7, " No, Cancel ");
148
+ i0.ɵɵelementEnd()()();
149
+ } if (rf & 2) {
150
+ i0.ɵɵproperty("minWidth", 450)("width", 650);
151
+ } }
152
+ export class FormToolbarComponent {
153
+ /**
154
+ * Determines if the toolbar is enabled or disabled.
155
+ */
156
+ get CurrentlyDisabled() {
157
+ return this.Disabled && this._currentlyDisabled;
158
+ }
159
+ get LinkedEntityPrimaryKey() {
160
+ return this.form.record.PrimaryKey;
161
+ }
162
+ constructor(router) {
163
+ this.router = router;
164
+ this.ShowSkipChatButton = true;
165
+ /**
166
+ * This property does not get modified by the toolbar as things change within its state, it is the global setting you can change to disable the toolbar
167
+ */
168
+ this.Disabled = false;
169
+ /**
170
+ * Internal property that changes over time based on the state of the record being managed. Don't access this directly, use the CurrentlyDisabled property instead.
171
+ */
172
+ this._currentlyDisabled = false;
173
+ /**
174
+ * Internal property used to determine if the delete record confirmation dialog is currently displayed or not
175
+ */
176
+ this._deleteDialogVisible = false;
177
+ /**
178
+ * Internal property used to determine if the skip chat window is currently displayed or not
179
+ */
180
+ this._skipChatDialogVisible = false;
181
+ }
182
+ ngOnInit() {
183
+ return __awaiter(this, void 0, void 0, function* () {
184
+ });
185
+ }
186
+ saveExistingRecord(event) {
187
+ return __awaiter(this, void 0, void 0, function* () {
188
+ // Ensure the button takes focus
189
+ const button = event.target;
190
+ button.focus();
191
+ // while we are saving the record we are editing, we need to apply a UX effect on our peer elements in the browser to ensure they are
192
+ // not further edited and also disable all of the other stuff on this toolbar. So get the HTML reference to the toolbar, and disable it
193
+ // then get the HTML reference to the parent of the toolbar and opacity it out.
194
+ // Then create an HTML element that is centered horizaontall across the parent and is below the toolbar and show a status message of "Saving..." in it
195
+ // Disable the toolbar and apply the UX effect to the form parent
196
+ this._currentlyDisabled = true;
197
+ const toolbar = button.closest('.toolbar-container');
198
+ const formElement = toolbar.closest('form');
199
+ // Apply inline styles to disable interactions and set opacity
200
+ formElement.style.pointerEvents = 'none'; // This prevents interactions with the form
201
+ formElement.style.opacity = '0.75'; // This makes the form opaque
202
+ // Create and show the status message element
203
+ const statusMessage = document.createElement('div');
204
+ statusMessage.className = 'form-toolbar-status-message';
205
+ formElement.appendChild(statusMessage);
206
+ statusMessage.style.position = 'absolute';
207
+ statusMessage.style.top = `${100}px`;
208
+ // Timer variables
209
+ let elapsedTime = 0;
210
+ let serverUpdateMessage = "";
211
+ const timer = setInterval(() => {
212
+ elapsedTime += .1;
213
+ statusMessage.innerHTML = `<div>Saving...<span class="form-toolbar-elapsed-time">(${Math.floor(elapsedTime)} sec${elapsedTime === 0 || elapsedTime > 1 ? 's' : ''})</span></div>` + (serverUpdateMessage ? `<div class="form-toolbar-server-update-message">${serverUpdateMessage}</div>` : '');
214
+ }, 100);
215
+ try {
216
+ // listen for status updates from MJGlobal that come from the server
217
+ MJGlobal.Instance.GetEventListener(false).subscribe((event) => {
218
+ var _a;
219
+ if (event.eventCode === EventCodes.PushStatusUpdates) {
220
+ serverUpdateMessage = (_a = event.args) === null || _a === void 0 ? void 0 : _a.message;
221
+ console.log(event);
222
+ }
223
+ });
224
+ // Save the record
225
+ const result = yield this.form.SaveRecord(true);
226
+ if (!result)
227
+ alert(this.form.record.LatestResult.Message);
228
+ }
229
+ finally {
230
+ // Re-enable the toolbar and remove the UX effect
231
+ this._currentlyDisabled = false;
232
+ formElement.style.pointerEvents = 'auto'; // This re-enables interactions with the form
233
+ formElement.style.opacity = '1'; // This restores the form's opacity
234
+ // Remove the status message element
235
+ formElement.removeChild(statusMessage);
236
+ // Clear the timer
237
+ clearInterval(timer);
238
+ }
239
+ });
240
+ }
241
+ /**
242
+ * This method is called internally when the user clicks on the Skip button, and also can be invoked manually in code to show the Skip dialog.
243
+ */
244
+ ShowSkipChat() {
245
+ this._skipChatDialogVisible = !this._skipChatDialogVisible;
246
+ SharedService.Instance.InvokeManualResize();
247
+ }
248
+ toggleDeleteDialog(show) {
249
+ this._deleteDialogVisible = show;
250
+ }
251
+ deleteRecord() {
252
+ return __awaiter(this, void 0, void 0, function* () {
253
+ this.toggleDeleteDialog(false);
254
+ let dependencies = yield this.form.GetRecordDependencies();
255
+ if (dependencies.length > 0) {
256
+ SharedService.Instance.CreateSimpleNotification(`This record cannot be deleted because it is being used by ${dependencies.length} other records.`, 'error', 2000);
257
+ return;
258
+ }
259
+ const deleteResult = yield this.form.record.Delete();
260
+ if (deleteResult) {
261
+ SharedService.Instance.CreateSimpleNotification('Record deleted succesfully', 'success', 2000);
262
+ let event = {
263
+ event: MJEventType.ComponentEvent,
264
+ eventCode: EventCodes.CloseCurrentTab,
265
+ component: null,
266
+ args: null
267
+ };
268
+ MJGlobal.Instance.RaiseEvent(event);
269
+ }
270
+ else {
271
+ SharedService.Instance.CreateSimpleNotification('Error deleting record', 'error', 2000);
272
+ }
273
+ });
274
+ }
275
+ }
276
+ FormToolbarComponent.ɵfac = function FormToolbarComponent_Factory(t) { return new (t || FormToolbarComponent)(i0.ɵɵdirectiveInject(i1.Router)); };
277
+ FormToolbarComponent.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: FormToolbarComponent, selectors: [["mj-form-toolbar"]], inputs: { ShowSkipChatButton: "ShowSkipChatButton", form: "form" }, decls: 8, vars: 8, consts: [[1, "toolbar-container"], ["kendoButton", "", "title", "Show History"], ["kendoButton", "", "title", "Discuss this record with Skip"], [3, "LinkedEntityID", "LinkedEntityPrimaryKey", "WindowOpened"], [3, "record"], ["class", "dialog-wrapper", "title", "Confirm", 3, "minWidth", "width", "close", 4, "ngIf"], ["kendoButton", "", "title", "Edit this Record"], ["kendoButton", "", "title", "Delete this Record"], ["kendoButton", "", "title", "Edit this Record", 3, "click"], [1, "fa-solid", "fa-pen-to-square"], [1, "button-text"], ["kendoButton", "", "title", "Delete this Record", 3, "click"], [1, "fa-regular", "fa-trash-can"], ["kendoButton", "", "title", "Remove Favorite"], ["kendoButton", "", "title", "Remove Favorite", 3, "click"], [1, "fa-solid", "fa-star"], ["kendoButton", "", "title", "Make Favorite", 3, "click"], [1, "fa-regular", "fa-star"], ["kendoButton", "", "title", "Save Record", 3, "mouseup"], [1, "fa-solid", "fa-floppy-disk"], ["kendoButton", "", "title", "Cancel Edit"], ["kendoButton", "", "title", "Fields you have changed"], ["kendoButton", "", "title", "Cancel Edit", 3, "click"], [1, "fa-solid", "fa-rotate-left"], ["kendoButton", "", "title", "Fields you have changed", 3, "click"], [1, "fa-solid", "fa-clipboard-list"], ["kendoButton", "", "title", "Show History", 3, "click"], [1, "fa-solid", "fa-business-time"], ["kendoButton", "", "title", "Discuss this record with Skip", 3, "click"], [1, "fa-regular", "fa-comment-dots"], [3, "LinkedEntityID", "LinkedEntityPrimaryKey", "WindowOpened", "WindowClosed"], ["mjChat", ""], [3, "record", "dialogClosed"], ["title", "Confirm", 1, "dialog-wrapper", 3, "minWidth", "width", "close"], [1, "k-m-7.5", "k-text-center"], [1, "popup-actions-btn"], ["kendoButton", "", "themeColor", "info", 1, "cancel-btn", 3, "click"], ["kendoButton", "", "fillMode", "outline", "themeColor", "info", 1, "yes-btn", 3, "click"]], template: function FormToolbarComponent_Template(rf, ctx) { if (rf & 1) {
278
+ i0.ɵɵelementStart(0, "div", 0);
279
+ i0.ɵɵtemplate(1, FormToolbarComponent_Conditional_1_Template, 3, 3)(2, FormToolbarComponent_Conditional_2_Template, 6, 2)(3, FormToolbarComponent_Conditional_3_Template, 4, 0, "button", 1)(4, FormToolbarComponent_Conditional_4_Template, 2, 0, "button", 2)(5, FormToolbarComponent_Conditional_5_Template, 2, 3, "mj-skip-chat-with-record-window", 3)(6, FormToolbarComponent_Conditional_6_Template, 1, 1, "mj-record-changes", 4)(7, FormToolbarComponent_kendo_dialog_7_Template, 8, 2, "kendo-dialog", 5);
280
+ i0.ɵɵelementEnd();
281
+ } if (rf & 2) {
282
+ i0.ɵɵclassProp("disabled", ctx.CurrentlyDisabled);
283
+ i0.ɵɵadvance();
284
+ i0.ɵɵconditional(1, !ctx.form.EditMode ? 1 : 2);
285
+ i0.ɵɵadvance(2);
286
+ i0.ɵɵconditional(3, (ctx.form.EntityInfo == null ? null : ctx.form.EntityInfo.TrackRecordChanges) && !ctx.form.EditMode ? 3 : -1);
287
+ i0.ɵɵadvance();
288
+ i0.ɵɵconditional(4, ctx.ShowSkipChatButton && !ctx.form.EditMode ? 4 : -1);
289
+ i0.ɵɵadvance();
290
+ i0.ɵɵconditional(5, ctx.form.EntityInfo ? 5 : -1);
291
+ i0.ɵɵadvance();
292
+ i0.ɵɵconditional(6, ctx.form.isHistoryDialogOpen ? 6 : -1);
293
+ i0.ɵɵadvance();
294
+ i0.ɵɵproperty("ngIf", ctx._deleteDialogVisible);
295
+ } }, dependencies: [i2.NgIf, i3.RecordChangesComponent, i4.ButtonComponent, i5.DialogComponent, i5.DialogActionsComponent, i6.SkipChatWithRecordWindowComponent], styles: [".toolbar-container[_ngcontent-%COMP%] { \n border-bottom: solid 1px lightgray; \n padding-bottom: 10px; \n margin-bottom: 5px; \n}\n\n.toolbar-container[_ngcontent-%COMP%] button[_ngcontent-%COMP%] { \n margin-right: 7px; \n} \n.toolbar-container[_ngcontent-%COMP%] .button-text[_ngcontent-%COMP%] { \n margin-left: 7px; \n} \n\n.toolbar-container.disabled[_ngcontent-%COMP%] {\n pointer-events: none;\n opacity: 0.8;\n}\n\n.disabled[_ngcontent-%COMP%] {\n pointer-events: none;\n}\n\n .form-toolbar-status-message {\n background: #f0f0f0;\n padding: 15px;\n border-radius: 5px;\n box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);\n opacity: 1;\n z-index: 1000;\n color:#1d7032;\n font: 16px;\n font-weight: bold;\n min-width: 100px;\n\n text-align: center; \n\n}\n\n\n .form-toolbar-elapsed-time {\n \n\n\n\n position: absolute;\n top: 0;\n right: 0;\n color: darkgray;\n font-size: smaller;\n padding: 2px;\n border-radius: 5px;\n margin: 5px;\n z-index: 1000;\n}\n\n .form-toolbar-server-update-message {\n margin-top: 7px;\n font-size: smaller;\n color: black;\n}"] });
296
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(FormToolbarComponent, [{
297
+ type: Component,
298
+ args: [{ selector: 'mj-form-toolbar', template: "\n<div class=\"toolbar-container\" [class.disabled]=\"CurrentlyDisabled\">\n @if (!form.EditMode) {\n @if (form.UserCanEdit) {\n <button kendoButton (click)=\"form.StartEditMode()\" title=\"Edit this Record\">\n <span class=\"fa-solid fa-pen-to-square\"></span>\n <span class=\"button-text\">Edit</span>\n </button> \n }\n @if(form.UserCanDelete){\n <button kendoButton (click)=\"toggleDeleteDialog(true)\" title=\"Delete this Record\">\n <span class=\"fa-regular fa-trash-can\"></span>\n </button> \n }\n @if (form.FavoriteInitDone) {\n @if (form.IsFavorite) {\n <button kendoButton (click)=\"form.RemoveFavorite()\" title=\"Remove Favorite\">\n <span class=\"fa-solid fa-star\"></span>\n </button> \n }\n @else {\n <button kendoButton (click)=\"form.MakeFavorite()\" title=\"Make Favorite\">\n <span class=\"fa-regular fa-star\"></span>\n </button> \n }\n }\n }\n @else {\n <button kendoButton (mouseup)=\"saveExistingRecord($event)\" title=\"Save Record\">\n <span class=\"fa-solid fa-floppy-disk\"></span>\n <span class=\"button-text\">Save</span>\n </button> \n @if (form.record.IsSaved) {\n <!-- Only show the cancel button if the record has already been saved - don't show for a new record. -->\n <button kendoButton (click)=\"form.CancelEdit()\" title=\"Cancel Edit\">\n <span class=\"fa-solid fa-rotate-left\"></span>\n <span class=\"button-text\">Cancel</span>\n </button> \n }\n @if (form.record.Dirty) {\n <button kendoButton (click)=\"form.ShowChanges()\" title=\"Fields you have changed\">\n <span class=\"fa-solid fa-clipboard-list\"></span>\n <span class=\"button-text\">Changes</span>\n </button> \n }\n }\n @if (form.EntityInfo?.TrackRecordChanges && !form.EditMode) {\n <button kendoButton (click)=\"form.handleHistoryDialog()\" title=\"Show History\">\n <span class=\"fa-solid fa-business-time\"></span>\n <span class=\"button-text\">History</span>\n </button> \n }\n @if (ShowSkipChatButton && !form.EditMode) {\n <button kendoButton (click)=\"ShowSkipChat()\" title=\"Discuss this record with Skip\">\n <span class=\"fa-regular fa-comment-dots\"></span>\n </button> \n }\n @if (form.EntityInfo) {\n <mj-skip-chat-with-record-window\n [LinkedEntityID]=\"form.EntityInfo.ID\"\n [LinkedEntityPrimaryKey]=\"LinkedEntityPrimaryKey\" \n #mjChat\n [WindowOpened]=\"_skipChatDialogVisible\" \n (WindowClosed)=\"ShowSkipChat()\"\n >\n </mj-skip-chat-with-record-window>\n }\n @if (form.isHistoryDialogOpen) {\n <mj-record-changes [record]=\"form.record\" (dialogClosed)=\"form.handleHistoryDialog()\"></mj-record-changes>\n }\n <kendo-dialog \n [minWidth]=\"450\"\n [width]=\"650\"\n class=\"dialog-wrapper\" \n title=\"Confirm\" \n *ngIf=\"_deleteDialogVisible\" \n (close)=\"toggleDeleteDialog(false)\">\n <p class=\"k-m-7.5 k-text-center\">\n Are you sure you want to delete this record?\n </p>\n <kendo-dialog-actions class=\"popup-actions-btn\">\n <button class=\"cancel-btn\" (click)=\"deleteRecord()\" kendoButton themeColor=\"info\">\n Yes, Delete\n </button>\n <button class=\"yes-btn\" (click)=\"toggleDeleteDialog(false)\" kendoButton fillMode=\"outline\" themeColor=\"info\">\n No, Cancel\n </button>\n </kendo-dialog-actions>\n </kendo-dialog>\n</div>", styles: [".toolbar-container { \n border-bottom: solid 1px lightgray; \n padding-bottom: 10px; \n margin-bottom: 5px; \n}\n\n.toolbar-container button { \n margin-right: 7px; \n} \n.toolbar-container .button-text { \n margin-left: 7px; \n} \n\n.toolbar-container.disabled {\n pointer-events: none;\n opacity: 0.8;\n}\n\n.disabled {\n pointer-events: none;\n}\n\n::ng-deep .form-toolbar-status-message {\n background: #f0f0f0;\n padding: 15px;\n border-radius: 5px;\n box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);\n opacity: 1;\n z-index: 1000;\n color:#1d7032;\n font: 16px;\n font-weight: bold;\n min-width: 100px;\n\n text-align: center; /* Center the text horizontally */\n}\n\n\n::ng-deep .form-toolbar-elapsed-time {\n /*\n we want this littler timer to be small dark gray text in the top right corner with a white background\n*/\n position: absolute;\n top: 0;\n right: 0;\n color: darkgray;\n font-size: smaller;\n padding: 2px;\n border-radius: 5px;\n margin: 5px;\n z-index: 1000;\n}\n\n::ng-deep .form-toolbar-server-update-message {\n margin-top: 7px;\n font-size: smaller;\n color: black;\n}"] }]
299
+ }], () => [{ type: i1.Router }], { ShowSkipChatButton: [{
300
+ type: Input
301
+ }], form: [{
302
+ type: Input
303
+ }] }); })();
304
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(FormToolbarComponent, { className: "FormToolbarComponent", filePath: "src/lib/form-toolbar.ts", lineNumber: 14 }); })();
@@ -0,0 +1,19 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "./lib/form-toolbar";
3
+ import * as i2 from "@angular/common";
4
+ import * as i3 from "@angular/forms";
5
+ import * as i4 from "@memberjunction/ng-record-changes";
6
+ import * as i5 from "@memberjunction/ng-base-forms";
7
+ import * as i6 from "@progress/kendo-angular-buttons";
8
+ import * as i7 from "@progress/kendo-angular-inputs";
9
+ import * as i8 from "@progress/kendo-angular-dialog";
10
+ import * as i9 from "@memberjunction/ng-ask-skip";
11
+ import * as i10 from "@progress/kendo-angular-indicators";
12
+ import * as i11 from "@memberjunction/ng-shared";
13
+ import * as i12 from "ngx-markdown";
14
+ export declare class FormToolbarModule {
15
+ static ɵfac: i0.ɵɵFactoryDeclaration<FormToolbarModule, never>;
16
+ static ɵmod: i0.ɵɵNgModuleDeclaration<FormToolbarModule, [typeof i1.FormToolbarComponent], [typeof i2.CommonModule, typeof i3.FormsModule, typeof i4.RecordChangesModule, typeof i5.BaseFormsModule, typeof i6.ButtonsModule, typeof i7.InputsModule, typeof i8.DialogsModule, typeof i9.AskSkipModule, typeof i10.IndicatorsModule, typeof i11.MemberJunctionSharedModule, typeof i12.MarkdownModule], [typeof i1.FormToolbarComponent]>;
17
+ static ɵinj: i0.ɵɵInjectorDeclaration<FormToolbarModule>;
18
+ }
19
+ //# sourceMappingURL=module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAwBA,qBAqBa,iBAAiB;yCAAjB,iBAAiB;0CAAjB,iBAAiB;0CAAjB,iBAAiB;CAAI"}
package/dist/module.js ADDED
@@ -0,0 +1,69 @@
1
+ // Angular
2
+ import { NgModule } from '@angular/core';
3
+ import { CommonModule } from '@angular/common';
4
+ import { FormsModule } from '@angular/forms';
5
+ // Markdown
6
+ import { MarkdownModule } from 'ngx-markdown';
7
+ // Kendo UI Angular imports
8
+ import { ButtonsModule } from '@progress/kendo-angular-buttons';
9
+ import { InputsModule } from '@progress/kendo-angular-inputs';
10
+ import { IndicatorsModule } from '@progress/kendo-angular-indicators';
11
+ import { DialogsModule } from '@progress/kendo-angular-dialog';
12
+ // MJ
13
+ import { RecordChangesModule } from '@memberjunction/ng-record-changes';
14
+ import { AskSkipModule } from '@memberjunction/ng-ask-skip';
15
+ import { MemberJunctionSharedModule } from '@memberjunction/ng-shared';
16
+ // Local to package
17
+ import { FormToolbarComponent } from './lib/form-toolbar';
18
+ import { BaseFormsModule } from '@memberjunction/ng-base-forms';
19
+ import * as i0 from "@angular/core";
20
+ import * as i1 from "ngx-markdown";
21
+ export class FormToolbarModule {
22
+ }
23
+ FormToolbarModule.ɵfac = function FormToolbarModule_Factory(t) { return new (t || FormToolbarModule)(); };
24
+ FormToolbarModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: FormToolbarModule });
25
+ FormToolbarModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
26
+ FormsModule,
27
+ RecordChangesModule,
28
+ BaseFormsModule,
29
+ ButtonsModule,
30
+ InputsModule,
31
+ DialogsModule,
32
+ AskSkipModule,
33
+ IndicatorsModule,
34
+ MemberJunctionSharedModule,
35
+ MarkdownModule.forRoot()] });
36
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(FormToolbarModule, [{
37
+ type: NgModule,
38
+ args: [{
39
+ declarations: [
40
+ FormToolbarComponent,
41
+ ],
42
+ imports: [
43
+ CommonModule,
44
+ FormsModule,
45
+ RecordChangesModule,
46
+ BaseFormsModule,
47
+ ButtonsModule,
48
+ InputsModule,
49
+ DialogsModule,
50
+ AskSkipModule,
51
+ IndicatorsModule,
52
+ MemberJunctionSharedModule,
53
+ MarkdownModule.forRoot()
54
+ ],
55
+ exports: [
56
+ FormToolbarComponent,
57
+ ]
58
+ }]
59
+ }], null, null); })();
60
+ (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(FormToolbarModule, { declarations: [FormToolbarComponent], imports: [CommonModule,
61
+ FormsModule,
62
+ RecordChangesModule,
63
+ BaseFormsModule,
64
+ ButtonsModule,
65
+ InputsModule,
66
+ DialogsModule,
67
+ AskSkipModule,
68
+ IndicatorsModule,
69
+ MemberJunctionSharedModule, i1.MarkdownModule], exports: [FormToolbarComponent] }); })();
@@ -0,0 +1,3 @@
1
+ export * from './module';
2
+ export * from './lib/form-toolbar';
3
+ //# sourceMappingURL=public-api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public-api.d.ts","sourceRoot":"","sources":["../src/public-api.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC;AACzB,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,5 @@
1
+ /*
2
+ * Public API Surface
3
+ */
4
+ export * from './module';
5
+ export * from './lib/form-toolbar';
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@memberjunction/ng-form-toolbar",
3
+ "version": "1.4.1",
4
+ "description": "MemberJunction: Angular Form Toolbar",
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/global": "~1.4.1",
29
+ "@memberjunction/core": "~1.4.1",
30
+ "@memberjunction/ng-shared": "~1.4.1",
31
+ "@memberjunction/ng-base-forms": "~1.4.1",
32
+ "@memberjunction/ng-ask-skip": "~1.4.1",
33
+ "@memberjunction/ng-record-changes": "~1.4.1",
34
+ "@memberjunction/ng-container-directives": "~1.4.1",
35
+ "@progress/kendo-angular-buttons": "~15.1.0",
36
+ "@progress/kendo-angular-dialog": "~15.1.0",
37
+ "tslib": "^2.3.0"
38
+ },
39
+ "sideEffects": false
40
+ }