@memberjunction/ng-base-forms 1.7.0 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -109,36 +109,37 @@ function MJFormField_Conditional_0_div_1_Conditional_2_Template(rf, ctx) { if (r
109
109
  } }
110
110
  function MJFormField_Conditional_0_div_1_Conditional_3_Case_0_Template(rf, ctx) { if (rf & 1) {
111
111
  const _r2 = i0.ɵɵgetCurrentView();
112
- i0.ɵɵelementStart(0, "kendo-textbox", 16);
113
- i0.ɵɵtwoWayListener("ngModelChange", function MJFormField_Conditional_0_div_1_Conditional_3_Case_0_Template_kendo_textbox_ngModelChange_0_listener($event) { i0.ɵɵrestoreView(_r2); const ctx_r0 = i0.ɵɵnextContext(4); i0.ɵɵtwoWayBindingSet(ctx_r0.Value, $event) || (ctx_r0.Value = $event); return i0.ɵɵresetView($event); });
112
+ i0.ɵɵelementStart(0, "mj-code-editor", 17);
113
+ i0.ɵɵtwoWayListener("ngModelChange", function MJFormField_Conditional_0_div_1_Conditional_3_Case_0_Template_mj_code_editor_ngModelChange_0_listener($event) { i0.ɵɵrestoreView(_r2); const ctx_r0 = i0.ɵɵnextContext(4); i0.ɵɵtwoWayBindingSet(ctx_r0.Value, $event) || (ctx_r0.Value = $event); return i0.ɵɵresetView($event); });
114
114
  i0.ɵɵelementEnd();
115
115
  } if (rf & 2) {
116
116
  const ctx_r0 = i0.ɵɵnextContext(4);
117
117
  i0.ɵɵtwoWayProperty("ngModel", ctx_r0.Value);
118
+ i0.ɵɵproperty("languages", ctx_r0.languages)("language", "JavaScript");
118
119
  } }
119
120
  function MJFormField_Conditional_0_div_1_Conditional_3_Case_1_Template(rf, ctx) { if (rf & 1) {
120
121
  const _r3 = i0.ɵɵgetCurrentView();
121
- i0.ɵɵelementStart(0, "kendo-textarea", 17);
122
- i0.ɵɵtwoWayListener("ngModelChange", function MJFormField_Conditional_0_div_1_Conditional_3_Case_1_Template_kendo_textarea_ngModelChange_0_listener($event) { i0.ɵɵrestoreView(_r3); const ctx_r0 = i0.ɵɵnextContext(4); i0.ɵɵtwoWayBindingSet(ctx_r0.Value, $event) || (ctx_r0.Value = $event); return i0.ɵɵresetView($event); });
122
+ i0.ɵɵelementStart(0, "kendo-textbox", 18);
123
+ i0.ɵɵtwoWayListener("ngModelChange", function MJFormField_Conditional_0_div_1_Conditional_3_Case_1_Template_kendo_textbox_ngModelChange_0_listener($event) { i0.ɵɵrestoreView(_r3); const ctx_r0 = i0.ɵɵnextContext(4); i0.ɵɵtwoWayBindingSet(ctx_r0.Value, $event) || (ctx_r0.Value = $event); return i0.ɵɵresetView($event); });
123
124
  i0.ɵɵelementEnd();
124
125
  } if (rf & 2) {
125
126
  const ctx_r0 = i0.ɵɵnextContext(4);
126
127
  i0.ɵɵtwoWayProperty("ngModel", ctx_r0.Value);
127
- i0.ɵɵproperty("fillWidth", ctx_r0.ShowLabel ? false : true)("fillHeight", ctx_r0.ShowLabel ? false : true);
128
128
  } }
129
129
  function MJFormField_Conditional_0_div_1_Conditional_3_Case_2_Template(rf, ctx) { if (rf & 1) {
130
130
  const _r4 = i0.ɵɵgetCurrentView();
131
- i0.ɵɵelementStart(0, "kendo-numerictextbox", 18);
132
- i0.ɵɵtwoWayListener("valueChange", function MJFormField_Conditional_0_div_1_Conditional_3_Case_2_Template_kendo_numerictextbox_valueChange_0_listener($event) { i0.ɵɵrestoreView(_r4); const ctx_r0 = i0.ɵɵnextContext(4); i0.ɵɵtwoWayBindingSet(ctx_r0.Value, $event) || (ctx_r0.Value = $event); return i0.ɵɵresetView($event); });
131
+ i0.ɵɵelementStart(0, "kendo-textarea", 19);
132
+ i0.ɵɵtwoWayListener("ngModelChange", function MJFormField_Conditional_0_div_1_Conditional_3_Case_2_Template_kendo_textarea_ngModelChange_0_listener($event) { i0.ɵɵrestoreView(_r4); const ctx_r0 = i0.ɵɵnextContext(4); i0.ɵɵtwoWayBindingSet(ctx_r0.Value, $event) || (ctx_r0.Value = $event); return i0.ɵɵresetView($event); });
133
133
  i0.ɵɵelementEnd();
134
134
  } if (rf & 2) {
135
135
  const ctx_r0 = i0.ɵɵnextContext(4);
136
- i0.ɵɵtwoWayProperty("value", ctx_r0.Value);
136
+ i0.ɵɵtwoWayProperty("ngModel", ctx_r0.Value);
137
+ i0.ɵɵproperty("fillWidth", ctx_r0.ShowLabel ? false : true)("fillHeight", ctx_r0.ShowLabel ? false : true);
137
138
  } }
138
139
  function MJFormField_Conditional_0_div_1_Conditional_3_Case_3_Template(rf, ctx) { if (rf & 1) {
139
140
  const _r5 = i0.ɵɵgetCurrentView();
140
- i0.ɵɵelementStart(0, "kendo-datepicker", 18);
141
- i0.ɵɵtwoWayListener("valueChange", function MJFormField_Conditional_0_div_1_Conditional_3_Case_3_Template_kendo_datepicker_valueChange_0_listener($event) { i0.ɵɵrestoreView(_r5); const ctx_r0 = i0.ɵɵnextContext(4); i0.ɵɵtwoWayBindingSet(ctx_r0.Value, $event) || (ctx_r0.Value = $event); return i0.ɵɵresetView($event); });
141
+ i0.ɵɵelementStart(0, "kendo-numerictextbox", 20);
142
+ i0.ɵɵtwoWayListener("valueChange", function MJFormField_Conditional_0_div_1_Conditional_3_Case_3_Template_kendo_numerictextbox_valueChange_0_listener($event) { i0.ɵɵrestoreView(_r5); const ctx_r0 = i0.ɵɵnextContext(4); i0.ɵɵtwoWayBindingSet(ctx_r0.Value, $event) || (ctx_r0.Value = $event); return i0.ɵɵresetView($event); });
142
143
  i0.ɵɵelementEnd();
143
144
  } if (rf & 2) {
144
145
  const ctx_r0 = i0.ɵɵnextContext(4);
@@ -146,27 +147,36 @@ function MJFormField_Conditional_0_div_1_Conditional_3_Case_3_Template(rf, ctx)
146
147
  } }
147
148
  function MJFormField_Conditional_0_div_1_Conditional_3_Case_4_Template(rf, ctx) { if (rf & 1) {
148
149
  const _r6 = i0.ɵɵgetCurrentView();
149
- i0.ɵɵelementStart(0, "input", 19);
150
- i0.ɵɵtwoWayListener("ngModelChange", function MJFormField_Conditional_0_div_1_Conditional_3_Case_4_Template_input_ngModelChange_0_listener($event) { i0.ɵɵrestoreView(_r6); const ctx_r0 = i0.ɵɵnextContext(4); i0.ɵɵtwoWayBindingSet(ctx_r0.Value, $event) || (ctx_r0.Value = $event); return i0.ɵɵresetView($event); });
150
+ i0.ɵɵelementStart(0, "kendo-datepicker", 20);
151
+ i0.ɵɵtwoWayListener("valueChange", function MJFormField_Conditional_0_div_1_Conditional_3_Case_4_Template_kendo_datepicker_valueChange_0_listener($event) { i0.ɵɵrestoreView(_r6); const ctx_r0 = i0.ɵɵnextContext(4); i0.ɵɵtwoWayBindingSet(ctx_r0.Value, $event) || (ctx_r0.Value = $event); return i0.ɵɵresetView($event); });
151
152
  i0.ɵɵelementEnd();
152
153
  } if (rf & 2) {
153
154
  const ctx_r0 = i0.ɵɵnextContext(4);
154
- i0.ɵɵtwoWayProperty("ngModel", ctx_r0.Value);
155
+ i0.ɵɵtwoWayProperty("value", ctx_r0.Value);
155
156
  } }
156
157
  function MJFormField_Conditional_0_div_1_Conditional_3_Case_5_Template(rf, ctx) { if (rf & 1) {
157
158
  const _r7 = i0.ɵɵgetCurrentView();
158
- i0.ɵɵelementStart(0, "kendo-dropdownlist", 20);
159
- i0.ɵɵtwoWayListener("ngModelChange", function MJFormField_Conditional_0_div_1_Conditional_3_Case_5_Template_kendo_dropdownlist_ngModelChange_0_listener($event) { i0.ɵɵrestoreView(_r7); const ctx_r0 = i0.ɵɵnextContext(4); i0.ɵɵtwoWayBindingSet(ctx_r0.Value, $event) || (ctx_r0.Value = $event); return i0.ɵɵresetView($event); });
159
+ i0.ɵɵelementStart(0, "input", 21);
160
+ i0.ɵɵtwoWayListener("ngModelChange", function MJFormField_Conditional_0_div_1_Conditional_3_Case_5_Template_input_ngModelChange_0_listener($event) { i0.ɵɵrestoreView(_r7); const ctx_r0 = i0.ɵɵnextContext(4); i0.ɵɵtwoWayBindingSet(ctx_r0.Value, $event) || (ctx_r0.Value = $event); return i0.ɵɵresetView($event); });
160
161
  i0.ɵɵelementEnd();
161
162
  } if (rf & 2) {
162
163
  const ctx_r0 = i0.ɵɵnextContext(4);
163
- i0.ɵɵproperty("data", ctx_r0.PossibleValues);
164
164
  i0.ɵɵtwoWayProperty("ngModel", ctx_r0.Value);
165
165
  } }
166
166
  function MJFormField_Conditional_0_div_1_Conditional_3_Case_6_Template(rf, ctx) { if (rf & 1) {
167
167
  const _r8 = i0.ɵɵgetCurrentView();
168
- i0.ɵɵelementStart(0, "kendo-combobox", 21);
169
- i0.ɵɵtwoWayListener("ngModelChange", function MJFormField_Conditional_0_div_1_Conditional_3_Case_6_Template_kendo_combobox_ngModelChange_0_listener($event) { i0.ɵɵrestoreView(_r8); const ctx_r0 = i0.ɵɵnextContext(4); i0.ɵɵtwoWayBindingSet(ctx_r0.Value, $event) || (ctx_r0.Value = $event); return i0.ɵɵresetView($event); });
168
+ i0.ɵɵelementStart(0, "kendo-dropdownlist", 22);
169
+ i0.ɵɵtwoWayListener("ngModelChange", function MJFormField_Conditional_0_div_1_Conditional_3_Case_6_Template_kendo_dropdownlist_ngModelChange_0_listener($event) { i0.ɵɵrestoreView(_r8); const ctx_r0 = i0.ɵɵnextContext(4); i0.ɵɵtwoWayBindingSet(ctx_r0.Value, $event) || (ctx_r0.Value = $event); return i0.ɵɵresetView($event); });
170
+ i0.ɵɵelementEnd();
171
+ } if (rf & 2) {
172
+ const ctx_r0 = i0.ɵɵnextContext(4);
173
+ i0.ɵɵproperty("data", ctx_r0.PossibleValues);
174
+ i0.ɵɵtwoWayProperty("ngModel", ctx_r0.Value);
175
+ } }
176
+ function MJFormField_Conditional_0_div_1_Conditional_3_Case_7_Template(rf, ctx) { if (rf & 1) {
177
+ const _r9 = i0.ɵɵgetCurrentView();
178
+ i0.ɵɵelementStart(0, "kendo-combobox", 23);
179
+ i0.ɵɵtwoWayListener("ngModelChange", function MJFormField_Conditional_0_div_1_Conditional_3_Case_7_Template_kendo_combobox_ngModelChange_0_listener($event) { i0.ɵɵrestoreView(_r9); const ctx_r0 = i0.ɵɵnextContext(4); i0.ɵɵtwoWayBindingSet(ctx_r0.Value, $event) || (ctx_r0.Value = $event); return i0.ɵɵresetView($event); });
170
180
  i0.ɵɵelementEnd();
171
181
  } if (rf & 2) {
172
182
  const ctx_r0 = i0.ɵɵnextContext(4);
@@ -174,15 +184,15 @@ function MJFormField_Conditional_0_div_1_Conditional_3_Case_6_Template(rf, ctx)
174
184
  i0.ɵɵtwoWayProperty("ngModel", ctx_r0.Value);
175
185
  } }
176
186
  function MJFormField_Conditional_0_div_1_Conditional_3_Template(rf, ctx) { if (rf & 1) {
177
- i0.ɵɵtemplate(0, MJFormField_Conditional_0_div_1_Conditional_3_Case_0_Template, 1, 1, "kendo-textbox", 10)(1, MJFormField_Conditional_0_div_1_Conditional_3_Case_1_Template, 1, 3, "kendo-textarea", 11)(2, MJFormField_Conditional_0_div_1_Conditional_3_Case_2_Template, 1, 1, "kendo-numerictextbox", 12)(3, MJFormField_Conditional_0_div_1_Conditional_3_Case_3_Template, 1, 1, "kendo-datepicker", 12)(4, MJFormField_Conditional_0_div_1_Conditional_3_Case_4_Template, 1, 1, "input", 13)(5, MJFormField_Conditional_0_div_1_Conditional_3_Case_5_Template, 1, 2, "kendo-dropdownlist", 14)(6, MJFormField_Conditional_0_div_1_Conditional_3_Case_6_Template, 1, 3, "kendo-combobox", 15);
187
+ i0.ɵɵtemplate(0, MJFormField_Conditional_0_div_1_Conditional_3_Case_0_Template, 1, 3, "mj-code-editor", 10)(1, MJFormField_Conditional_0_div_1_Conditional_3_Case_1_Template, 1, 1, "kendo-textbox", 11)(2, MJFormField_Conditional_0_div_1_Conditional_3_Case_2_Template, 1, 3, "kendo-textarea", 12)(3, MJFormField_Conditional_0_div_1_Conditional_3_Case_3_Template, 1, 1, "kendo-numerictextbox", 13)(4, MJFormField_Conditional_0_div_1_Conditional_3_Case_4_Template, 1, 1, "kendo-datepicker", 13)(5, MJFormField_Conditional_0_div_1_Conditional_3_Case_5_Template, 1, 1, "input", 14)(6, MJFormField_Conditional_0_div_1_Conditional_3_Case_6_Template, 1, 2, "kendo-dropdownlist", 15)(7, MJFormField_Conditional_0_div_1_Conditional_3_Case_7_Template, 1, 3, "kendo-combobox", 16);
178
188
  } if (rf & 2) {
179
189
  let tmp_3_0;
180
190
  const ctx_r0 = i0.ɵɵnextContext(3);
181
- i0.ɵɵconditional((tmp_3_0 = ctx_r0.Type) === "textbox" ? 0 : tmp_3_0 === "textarea" ? 1 : tmp_3_0 === "numerictextbox" ? 2 : tmp_3_0 === "datepicker" ? 3 : tmp_3_0 === "checkbox" ? 4 : tmp_3_0 === "dropdownlist" ? 5 : tmp_3_0 === "combobox" ? 6 : -1);
191
+ i0.ɵɵconditional((tmp_3_0 = ctx_r0.Type) === "code" ? 0 : tmp_3_0 === "textbox" ? 1 : tmp_3_0 === "textarea" ? 2 : tmp_3_0 === "numerictextbox" ? 3 : tmp_3_0 === "datepicker" ? 4 : tmp_3_0 === "checkbox" ? 5 : tmp_3_0 === "dropdownlist" ? 6 : tmp_3_0 === "combobox" ? 7 : -1);
182
192
  } }
183
193
  function MJFormField_Conditional_0_div_1_Template(rf, ctx) { if (rf & 1) {
184
194
  i0.ɵɵelementStart(0, "div", 2);
185
- i0.ɵɵtemplate(1, MJFormField_Conditional_0_div_1_Conditional_1_Template, 2, 1, "label")(2, MJFormField_Conditional_0_div_1_Conditional_2_Template, 1, 2, "mj-link-field", 9)(3, MJFormField_Conditional_0_div_1_Conditional_3_Template, 7, 1);
195
+ i0.ɵɵtemplate(1, MJFormField_Conditional_0_div_1_Conditional_1_Template, 2, 1, "label")(2, MJFormField_Conditional_0_div_1_Conditional_2_Template, 1, 2, "mj-link-field", 9)(3, MJFormField_Conditional_0_div_1_Conditional_3_Template, 8, 1);
186
196
  i0.ɵɵelementEnd();
187
197
  } if (rf & 2) {
188
198
  const ctx_r0 = i0.ɵɵnextContext(2);
@@ -343,14 +353,14 @@ MJFormField.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: MJFormField, se
343
353
  } if (rf & 2) {
344
354
  let _t;
345
355
  i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.markdown = _t.first);
346
- } }, inputs: { record: "record", EditMode: "EditMode", FieldName: "FieldName", Type: "Type", LinkType: "LinkType", ShowLabel: "ShowLabel", DisplayName: "DisplayName", PossibleValues: "PossibleValues", Value: "Value" }, outputs: { ValueChange: "ValueChange" }, features: [i0.ɵɵInheritDefinitionFeature], decls: 1, vars: 1, consts: [["markdown", ""], ["class", "record-form-row", 4, "ngIf"], [1, "record-form-row"], [4, "ngIf"], ["mjEmailLink", "", 3, "field"], ["mjWebLink", "", 3, "field"], ["mjFieldLink", "", 3, "record", "fieldName"], [3, "value", "readonly", "languages", "language"], [3, "data"], [3, "record", "FieldName"], [3, "ngModel"], ["mjFillContainer", "", 3, "ngModel", "fillWidth", "fillHeight"], [3, "value"], ["type", "checkbox", "kendoCheckBox", "", 3, "ngModel"], [3, "data", "ngModel"], [3, "data", "allowCustom", "ngModel"], [3, "ngModelChange", "ngModel"], ["mjFillContainer", "", 3, "ngModelChange", "ngModel", "fillWidth", "fillHeight"], [3, "valueChange", "value"], ["type", "checkbox", "kendoCheckBox", "", 3, "ngModelChange", "ngModel"], [3, "ngModelChange", "data", "ngModel"], [3, "ngModelChange", "data", "allowCustom", "ngModel"]], template: function MJFormField_Template(rf, ctx) { if (rf & 1) {
356
+ } }, inputs: { record: "record", EditMode: "EditMode", FieldName: "FieldName", Type: "Type", LinkType: "LinkType", ShowLabel: "ShowLabel", DisplayName: "DisplayName", PossibleValues: "PossibleValues", Value: "Value" }, outputs: { ValueChange: "ValueChange" }, features: [i0.ɵɵInheritDefinitionFeature], decls: 1, vars: 1, consts: [["markdown", ""], ["class", "record-form-row", 4, "ngIf"], [1, "record-form-row"], [4, "ngIf"], ["mjEmailLink", "", 3, "field"], ["mjWebLink", "", 3, "field"], ["mjFieldLink", "", 3, "record", "fieldName"], [3, "value", "readonly", "languages", "language"], [3, "data"], [3, "record", "FieldName"], [3, "ngModel", "languages", "language"], [3, "ngModel"], ["mjFillContainer", "", 3, "ngModel", "fillWidth", "fillHeight"], [3, "value"], ["type", "checkbox", "kendoCheckBox", "", 3, "ngModel"], [3, "data", "ngModel"], [3, "data", "allowCustom", "ngModel"], [3, "ngModelChange", "ngModel", "languages", "language"], [3, "ngModelChange", "ngModel"], ["mjFillContainer", "", 3, "ngModelChange", "ngModel", "fillWidth", "fillHeight"], [3, "valueChange", "value"], ["type", "checkbox", "kendoCheckBox", "", 3, "ngModelChange", "ngModel"], [3, "ngModelChange", "data", "ngModel"], [3, "ngModelChange", "data", "allowCustom", "ngModel"]], template: function MJFormField_Template(rf, ctx) { if (rf & 1) {
347
357
  i0.ɵɵtemplate(0, MJFormField_Conditional_0_Template, 2, 2);
348
358
  } if (rf & 2) {
349
359
  i0.ɵɵconditional(ctx.record.IsSaved || !ctx.IsFieldReadOnly ? 0 : -1);
350
360
  } }, dependencies: [i1.NgIf, i2.CheckboxControlValueAccessor, i2.NgControlStatus, i2.NgModel, i3.TextAreaComponent, i3.TextBoxComponent, i3.NumericTextBoxComponent, i3.CheckBoxDirective, i4.DatePickerComponent, i5.ComboBoxComponent, i5.DropDownListComponent, i6.EmailLink, i6.FieldLink, i6.WebLink, i7.FillContainer, i8.CodeEditorComponent, i9.MarkdownComponent, i10.MJLinkField], styles: [".record-form-row[_ngcontent-%COMP%] {\n display: grid;\n grid-template-columns: auto 1fr;\n align-items: start;\n gap: 10px;\n margin-bottom: 12px;\n padding-top: 5px;\n padding-bottom: 5px;\n align-items: start; \n\n} \n \n \n.record-form-row[_ngcontent-%COMP%] label[_ngcontent-%COMP%] {\n font-weight: bold;\n padding-right: 10px;\n width: 240px;\n margin-bottom: 0;\n align-self: start; \n\n}\n\n\n\n\n\n.record-form-row[_ngcontent-%COMP%] markdown[_ngcontent-%COMP%] > p[_ngcontent-%COMP%], \n.record-form-row[_ngcontent-%COMP%] markdown[_ngcontent-%COMP%] > h1[_ngcontent-%COMP%], \n.record-form-row[_ngcontent-%COMP%] markdown[_ngcontent-%COMP%] > h2[_ngcontent-%COMP%], \n.record-form-row[_ngcontent-%COMP%] markdown[_ngcontent-%COMP%] > h3[_ngcontent-%COMP%], \n.record-form-row[_ngcontent-%COMP%] markdown[_ngcontent-%COMP%] > h4[_ngcontent-%COMP%], \n.record-form-row[_ngcontent-%COMP%] markdown[_ngcontent-%COMP%] > h5[_ngcontent-%COMP%], \n.record-form-row[_ngcontent-%COMP%] markdown[_ngcontent-%COMP%] > h6[_ngcontent-%COMP%] {\n margin:0 !important;\n}\n\nmarkdown[_ngcontent-%COMP%] {\n font-size: 1rem; \n\n}\n\n\n@media (min-width: 768px) {\n .record-form-row[_ngcontent-%COMP%] {\n display: grid; \n\n grid-template-columns: auto 1fr;\n align-items: start; \n\n gap: 10px;\n margin-bottom: 12px;\n padding-top: 5px;\n padding-bottom: 5px;\n }\n\n .record-form-row[_ngcontent-%COMP%] label[_ngcontent-%COMP%] {\n width: 240px;\n margin-bottom: 0;\n align-self: start; \n\n }\n}"] });
351
361
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MJFormField, [{
352
362
  type: Component,
353
- args: [{ selector: 'mj-form-field', template: "<!--\n Using a blend of *ngIf and the new @switch control flow because of a bug in early Angular 17 where\n the @if wrapping the @switch didn't fully remove elements when swtiching back and forth. In the future if Angular fixes the bug\n we can get rid of the *ngIf outer div blocks and instead use @if and contain the @switch within the same div block.\n-->\n@if (record.IsSaved || !IsFieldReadOnly) {\n <!-- We only render a field if the record is either saved, or the field is editable. Meaning, for NEW records, we only show editable fields -->\n <div class=\"record-form-row\" *ngIf=\"!EditMode || IsFieldReadOnly\">\n <label *ngIf=\"ShowLabel\">{{DisplayName}}</label>\n @switch (LinkType) {\n @case ('None') {\n @if (ExtendedType === 'Code') {\n <mj-code-editor [value]=\"record.Get(FieldName)\" [readonly]=\"true\" [languages]=\"languages\" [language]=\"'JavaScript'\"></mj-code-editor>\n }\n @else if (FieldInfo.Length === -1) {\n <!-- this is a varchar(max) type of field -->\n <markdown #markdown [data]=\"record.Get(FieldName)\"></markdown>\n <!-- <span [innerHTML]=\"record.Get(FieldName) | formatText\"></span> -->\n }\n @else {\n <span>{{FormatValue(FieldName, 0)}}</span>\n }\n }\n @case ('Email') {\n <span mjEmailLink [field]=\"record.GetFieldByName(FieldName)\" >{{FormatValue(FieldName, 0)}}</span>\n }\n @case ('URL') {\n <span mjWebLink [field]=\"record.GetFieldByName(FieldName)\" >{{FormatValue(FieldName, 0)}}</span>\n }\n @case ('Record') {\n <span mjFieldLink [record]=\"record\" [fieldName]=\"FieldName\" >{{FormatValue(FieldName, 0)}}</span>\n }\n }\n </div>\n <div class=\"record-form-row\" *ngIf=\"EditMode && !IsFieldReadOnly\">\n @if (ShowLabel) {\n <label>{{DisplayName}}</label>\n }\n @if (FieldInfo && FieldInfo.RelatedEntity && FieldInfo.RelatedEntity.length > 0) {\n <!-- Foreign Key Link here -->\n <mj-link-field [record]=\"record\" [FieldName]=\"FieldName\"></mj-link-field>\n }\n @else {\n <!-- Not a foreign key -->\n @switch (Type) {\n @case ('textbox') {\n <kendo-textbox [(ngModel)]=\"Value\" />\n }\n @case ('textarea') {\n <kendo-textarea [(ngModel)]=\"Value\" mjFillContainer [fillWidth]=\"ShowLabel ? false : true\" [fillHeight]=\"ShowLabel ? false : true\" ></kendo-textarea>\n }\n @case ('numerictextbox') {\n <kendo-numerictextbox [(value)]=\"Value\" />\n }\n @case ('datepicker') {\n <kendo-datepicker [(value)]=\"Value\"></kendo-datepicker>\n }\n @case ('checkbox') {\n <input type=\"checkbox\" [(ngModel)]=\"Value\" kendoCheckBox />\n }\n @case ('dropdownlist') {\n <kendo-dropdownlist [data]=\"PossibleValues\" [(ngModel)]=\"Value\"></kendo-dropdownlist>\n }\n @case ('combobox') {\n <kendo-combobox [data]=\"PossibleValues\" [allowCustom]=\"true\" [(ngModel)]=\"Value\"></kendo-combobox>\n }\n }\n }\n </div>\n}\n", styles: [".record-form-row {\n display: grid;\n grid-template-columns: auto 1fr;\n align-items: start;\n gap: 10px;\n margin-bottom: 12px;\n padding-top: 5px;\n padding-bottom: 5px;\n align-items: start; /* Ensure items are aligned at the top */\n} \n \n \n.record-form-row label {\n font-weight: bold;\n padding-right: 10px;\n width: 240px;\n margin-bottom: 0;\n align-self: start; /* Align the label to the start (top) */\n}\n\n/*\n Eliminate the default margin and padding for the markdown elements\n */\n.record-form-row markdown > p,\n.record-form-row markdown > h1,\n.record-form-row markdown > h2,\n.record-form-row markdown > h3,\n.record-form-row markdown > h4,\n.record-form-row markdown > h5,\n.record-form-row markdown > h6 {\n margin:0 !important;\n}\n\nmarkdown {\n font-size: 1rem; /* Adjust this value to match your app's regular text size */\n}\n\n\n@media (min-width: 768px) {\n .record-form-row {\n display: grid; /* Ensure grid display is used for larger screens as well */\n grid-template-columns: auto 1fr;\n align-items: start; /* Keep the alignment at the top */\n gap: 10px;\n margin-bottom: 12px;\n padding-top: 5px;\n padding-bottom: 5px;\n }\n\n .record-form-row label {\n width: 240px;\n margin-bottom: 0;\n align-self: start; /* Ensure the label is aligned to the top */\n }\n}\n "] }]
363
+ args: [{ selector: 'mj-form-field', template: "<!--\n Using a blend of *ngIf and the new @switch control flow because of a bug in early Angular 17 where\n the @if wrapping the @switch didn't fully remove elements when swtiching back and forth. In the future if Angular fixes the bug\n we can get rid of the *ngIf outer div blocks and instead use @if and contain the @switch within the same div block.\n-->\n@if (record.IsSaved || !IsFieldReadOnly) {\n <!-- We only render a field if the record is either saved, or the field is editable. Meaning, for NEW records, we only show editable fields -->\n <div class=\"record-form-row\" *ngIf=\"!EditMode || IsFieldReadOnly\">\n <label *ngIf=\"ShowLabel\">{{DisplayName}}</label>\n @switch (LinkType) {\n @case ('None') {\n @if (ExtendedType === 'Code') {\n <mj-code-editor [value]=\"record.Get(FieldName)\" [readonly]=\"true\" [languages]=\"languages\" [language]=\"'JavaScript'\"></mj-code-editor>\n }\n @else if (FieldInfo.Length === -1) {\n <!-- this is a varchar(max) type of field -->\n <markdown #markdown [data]=\"record.Get(FieldName)\"></markdown>\n <!-- <span [innerHTML]=\"record.Get(FieldName) | formatText\"></span> -->\n }\n @else {\n <span>{{FormatValue(FieldName, 0)}}</span>\n }\n }\n @case ('Email') {\n <span mjEmailLink [field]=\"record.GetFieldByName(FieldName)\" >{{FormatValue(FieldName, 0)}}</span>\n }\n @case ('URL') {\n <span mjWebLink [field]=\"record.GetFieldByName(FieldName)\" >{{FormatValue(FieldName, 0)}}</span>\n }\n @case ('Record') {\n <span mjFieldLink [record]=\"record\" [fieldName]=\"FieldName\" >{{FormatValue(FieldName, 0)}}</span>\n }\n }\n </div>\n <div class=\"record-form-row\" *ngIf=\"EditMode && !IsFieldReadOnly\">\n @if (ShowLabel) {\n <label>{{DisplayName}}</label>\n }\n @if (FieldInfo && FieldInfo.RelatedEntity && FieldInfo.RelatedEntity.length > 0) {\n <!-- Foreign Key Link here -->\n <mj-link-field [record]=\"record\" [FieldName]=\"FieldName\"></mj-link-field>\n }\n @else {\n <!-- Not a foreign key -->\n @switch (Type) {\n @case ('code') {\n <mj-code-editor [(ngModel)]=\"Value\" [languages]=\"languages\" [language]=\"'JavaScript'\"></mj-code-editor>\n }\n @case ('textbox') {\n <kendo-textbox [(ngModel)]=\"Value\" />\n }\n @case ('textarea') {\n <kendo-textarea [(ngModel)]=\"Value\" mjFillContainer [fillWidth]=\"ShowLabel ? false : true\" [fillHeight]=\"ShowLabel ? false : true\" ></kendo-textarea>\n }\n @case ('numerictextbox') {\n <kendo-numerictextbox [(value)]=\"Value\" />\n }\n @case ('datepicker') {\n <kendo-datepicker [(value)]=\"Value\"></kendo-datepicker>\n }\n @case ('checkbox') {\n <input type=\"checkbox\" [(ngModel)]=\"Value\" kendoCheckBox />\n }\n @case ('dropdownlist') {\n <kendo-dropdownlist [data]=\"PossibleValues\" [(ngModel)]=\"Value\"></kendo-dropdownlist>\n }\n @case ('combobox') {\n <kendo-combobox [data]=\"PossibleValues\" [allowCustom]=\"true\" [(ngModel)]=\"Value\"></kendo-combobox>\n }\n }\n }\n </div>\n}\n", styles: [".record-form-row {\n display: grid;\n grid-template-columns: auto 1fr;\n align-items: start;\n gap: 10px;\n margin-bottom: 12px;\n padding-top: 5px;\n padding-bottom: 5px;\n align-items: start; /* Ensure items are aligned at the top */\n} \n \n \n.record-form-row label {\n font-weight: bold;\n padding-right: 10px;\n width: 240px;\n margin-bottom: 0;\n align-self: start; /* Align the label to the start (top) */\n}\n\n/*\n Eliminate the default margin and padding for the markdown elements\n */\n.record-form-row markdown > p,\n.record-form-row markdown > h1,\n.record-form-row markdown > h2,\n.record-form-row markdown > h3,\n.record-form-row markdown > h4,\n.record-form-row markdown > h5,\n.record-form-row markdown > h6 {\n margin:0 !important;\n}\n\nmarkdown {\n font-size: 1rem; /* Adjust this value to match your app's regular text size */\n}\n\n\n@media (min-width: 768px) {\n .record-form-row {\n display: grid; /* Ensure grid display is used for larger screens as well */\n grid-template-columns: auto 1fr;\n align-items: start; /* Keep the alignment at the top */\n gap: 10px;\n margin-bottom: 12px;\n padding-top: 5px;\n padding-bottom: 5px;\n }\n\n .record-form-row label {\n width: 240px;\n margin-bottom: 0;\n align-self: start; /* Ensure the label is aligned to the top */\n }\n}\n "] }]
354
364
  }], () => [{ type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }], { record: [{
355
365
  type: Input
356
366
  }], EditMode: [{
@@ -1,9 +1,10 @@
1
1
  import { AfterViewInit, OnInit, OnDestroy, QueryList, ElementRef, ChangeDetectorRef } from '@angular/core';
2
- import { EntityInfo, ValidationResult, BaseEntity, EntityPermissionType, EntityRelationshipInfo, RunViewParams, RecordDependency } from '@memberjunction/core';
2
+ import { EntityInfo, ValidationResult, EntityPermissionType, EntityRelationshipInfo, RunViewParams, RecordDependency } from '@memberjunction/core';
3
3
  import { BaseRecordComponent } from './base-record-component';
4
- import { BaseFormComponentEventCodes, SharedService } from '@memberjunction/ng-shared';
4
+ import { SharedService } from '@memberjunction/ng-shared';
5
5
  import { ActivatedRoute, Router } from '@angular/router';
6
6
  import { MJTabStripComponent } from '@memberjunction/ng-tabstrip';
7
+ import { FormEditingCompleteEvent, PendingRecordItem, BaseFormComponentEventCodes } from '@memberjunction/ng-base-types';
7
8
  import * as i0 from "@angular/core";
8
9
  export declare abstract class BaseFormComponent extends BaseRecordComponent implements AfterViewInit, OnInit, OnDestroy {
9
10
  protected elementRef: ElementRef;
@@ -42,7 +43,7 @@ export declare abstract class BaseFormComponent extends BaseRecordComponent impl
42
43
  CalcTopAreaHeight(): void;
43
44
  private resizeSub;
44
45
  ngOnDestroy(): void;
45
- protected get PendingRecords(): BaseEntity[];
46
+ protected get PendingRecords(): PendingRecordItem[];
46
47
  onTabSelect(e: any): void;
47
48
  StartEditMode(): void;
48
49
  handleHistoryDialog(): void;
@@ -52,6 +53,7 @@ export declare abstract class BaseFormComponent extends BaseRecordComponent impl
52
53
  SetFavoriteStatus(isFavorite: boolean): Promise<void>;
53
54
  private _isFavorite;
54
55
  get IsFavorite(): boolean;
56
+ private _userPermissions;
55
57
  CheckUserPermission(type: EntityPermissionType): boolean;
56
58
  get UserCanEdit(): boolean;
57
59
  get UserCanRead(): boolean;
@@ -87,12 +89,12 @@ export declare abstract class BaseFormComponent extends BaseRecordComponent impl
87
89
  GetRelatedEntityTabDisplayName(relatedEntityName: string): string;
88
90
  protected ValidatePendingRecords(): ValidationResult[];
89
91
  Validate(): ValidationResult;
90
- protected RaiseEvent(eventCode: BaseFormComponentEventCodes): any;
92
+ protected RaiseEvent(eventCode: BaseFormComponentEventCodes): FormEditingCompleteEvent;
91
93
  SaveRecord(StopEditModeAfterSave: boolean): Promise<boolean>;
92
94
  Wait(duration: number): Promise<void>;
93
95
  CancelEdit(): void;
94
96
  protected PendingRecordsDirty(): boolean;
95
- protected PopulatePendingRecords(): Promise<void>;
97
+ protected PopulatePendingRecords(): void;
96
98
  protected InternalSaveRecord(): Promise<boolean>;
97
99
  protected GetTabTopPosition(): number;
98
100
  private _tabMargin;
@@ -1 +1 @@
1
- {"version":3,"file":"base-form-component.d.ts","sourceRoot":"","sources":["../../src/lib/base-form-component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,SAAS,EAA2B,SAAS,EAAE,UAAU,EAAa,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAG/I,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,UAAU,EAAE,oBAAoB,EAC9D,sBAAsB,EAAY,aAAa,EAC/C,gBAAgB,EAEH,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAA0B,2BAA2B,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/G,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAY,MAAM,6BAA6B,CAAC;;AAG5E,8BACsB,iBAAkB,SAAQ,mBAAoB,YAAW,aAAa,EAAE,MAAM,EAAE,SAAS;IAsBjG,SAAS,CAAC,UAAU,EAAE,UAAU;IAAE,SAAS,CAAC,aAAa,EAAE,aAAa;IAAE,SAAS,CAAC,MAAM,EAAE,MAAM;IAAE,SAAS,CAAC,KAAK,EAAE,cAAc;IAAE,SAAS,CAAC,GAAG,EAAE,iBAAiB;IArB1K,QAAQ,EAAE,OAAO,CAAS;IAC1B,YAAY,EAAE,MAAM,CAAM;IAC1B,SAAS,EAAE,MAAM,CAAW;IACnC;;;;OAIG;IACI,aAAa,EAAE,MAAM,CAAW;IAChC,gBAAgB,EAAE,MAAM,CAAO;IAC/B,gBAAgB,EAAE,OAAO,CAAS;IAClC,mBAAmB,EAAE,OAAO,CAAS;IACrC,gBAAgB,EAAE,OAAO,CAAS;IAClC,gBAAgB,EAAE,OAAO,CAAS;IACzC,OAAO,CAAC,2BAA2B,CAAuB;IAE1D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GAAG,aAAa;IAQxF;;;;OAIG;IACI,wCAAwC,CAAC,iBAAiB,EAAE,MAAM,GAAG,sBAAsB,GAAG,SAAS;IAO9G;;;;OAIG;IACI,eAAe,CAAC,iBAAiB,EAAE,MAAM,GAAG,GAAG;IAQ/C,mCAAmC,CAAC,IAAI,EAAE,sBAAsB,GAAG,GAAG;IAItE,8BAA8B,CAAC,iBAAiB,EAAE,MAAM,GAAG,MAAM;IASxE,SAAS,CAAC,sBAAsB,IAAI,gBAAgB,EAAE;IAS/C,QAAQ,IAAI,gBAAgB;IAanC,SAAS,CAAC,UAAU,CAAC,SAAS,EAAE,2BAA2B;IAc9C,UAAU,CAAC,qBAAqB,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IA4C5D,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3C,UAAU;IA0BjB,SAAS,CAAC,mBAAmB,IAAI,OAAO;IAcxC,SAAS,CAAC,sBAAsB;cAehB,kBAAkB,IAAI,OAAO,CAAC,OAAO,CAAC;IA4BtD,SAAS,CAAC,iBAAiB,IAAI,MAAM;IAerC,OAAO,CAAC,UAAU,CAAM;IACxB,YAAY,IAAI,IAAI;IAepB,SAAS,KAAK,qBAAqB,IAAI,MAAM,CAE5C;IAED,SAAS,CAAC,SAAS,IAAI,IAAI;IAO3B,SAAS,CAAC,2BAA2B;IAY9B,oBAAoB,IAAI,IAAI;IAItB,gBAAgB;IAiBhB,qBAAqB,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAMjE,IAAW,UAAU,IAAI,UAAU,GAAG,SAAS,CAY9C;yCAlhBmB,iBAAiB;2CAAjB,iBAAiB;CAmhBtC"}
@@ -11,9 +11,9 @@ import { Directive, ViewChildren, ViewChild } from '@angular/core';
11
11
  import { Subject, debounceTime, fromEvent } from 'rxjs';
12
12
  import { EntityInfo, EntityPermissionType, Metadata, LogError } from '@memberjunction/core';
13
13
  import { BaseRecordComponent } from './base-record-component';
14
- import { BaseFormComponentEventCodes } from '@memberjunction/ng-shared';
15
14
  import { MJTabStripComponent } from '@memberjunction/ng-tabstrip';
16
15
  import { MJEventType, MJGlobal } from '@memberjunction/global';
16
+ import { FormEditingCompleteEvent, BaseFormComponentEventCodes } from '@memberjunction/ng-base-types';
17
17
  import * as i0 from "@angular/core";
18
18
  import * as i1 from "@memberjunction/ng-shared";
19
19
  import * as i2 from "@angular/router";
@@ -46,6 +46,7 @@ export class BaseFormComponent extends BaseRecordComponent {
46
46
  this.__debug = false;
47
47
  this.resizeSub = null;
48
48
  this._isFavorite = false;
49
+ this._userPermissions = [];
49
50
  this._tabMargin = 10;
50
51
  this.setupSplitterLayoutDebounce();
51
52
  }
@@ -176,8 +177,16 @@ export class BaseFormComponent extends BaseRecordComponent {
176
177
  }
177
178
  CheckUserPermission(type) {
178
179
  try {
179
- if (this.record)
180
- return this.record.CheckPermissions(type, false);
180
+ if (this.record) {
181
+ const perm = this._userPermissions.find(x => x.permission === type);
182
+ if (perm)
183
+ return perm.canDo;
184
+ else {
185
+ const result = this.record.CheckPermissions(type, false);
186
+ this._userPermissions.push({ permission: type, canDo: result });
187
+ return result;
188
+ }
189
+ }
181
190
  else
182
191
  return false;
183
192
  }
@@ -264,7 +273,7 @@ export class BaseFormComponent extends BaseRecordComponent {
264
273
  const results = [];
265
274
  for (let i = 0; i < this._pendingRecords.length; i++) {
266
275
  const pendingRecord = this._pendingRecords[i];
267
- results.push(pendingRecord.Validate());
276
+ results.push(pendingRecord.entityObject.Validate());
268
277
  }
269
278
  return results;
270
279
  }
@@ -281,21 +290,16 @@ export class BaseFormComponent extends BaseRecordComponent {
281
290
  return valResults;
282
291
  }
283
292
  RaiseEvent(eventCode) {
284
- const p = [];
285
- const event = {
286
- subEventCode: eventCode,
287
- elementRef: this.elementRef,
288
- returnValue: {
289
- pendingRecords: p
290
- }
291
- };
293
+ const event = new FormEditingCompleteEvent();
294
+ event.elementRef = this.elementRef;
295
+ event.subEventCode = eventCode;
292
296
  MJGlobal.Instance.RaiseEvent({
293
297
  event: MJEventType.ComponentEvent,
294
298
  component: this,
295
299
  eventCode: BaseFormComponentEventCodes.BASE_CODE,
296
300
  args: event
297
301
  });
298
- return event.returnValue; // if the recipients of the event provided any values, we have them now
302
+ return event; // if the recipients of the event provided any values, we have them now
299
303
  }
300
304
  SaveRecord(StopEditModeAfterSave) {
301
305
  return __awaiter(this, void 0, void 0, function* () {
@@ -304,13 +308,13 @@ export class BaseFormComponent extends BaseRecordComponent {
304
308
  // atempt to blur the active element to force any pending changes to be committed
305
309
  document.activeElement.blur();
306
310
  // notify child components of this component that they must stop editing with an EDITING_COMPLETE message via MJ_global
307
- this.RaiseEvent('EDITING_COMPLETE');
311
+ this.RaiseEvent(BaseFormComponentEventCodes.EDITING_COMPLETE);
308
312
  }
309
313
  catch (e2) {
310
314
  // ignore
311
315
  }
312
316
  if (this.record) {
313
- yield this.PopulatePendingRecords(); // do this before we validate as we must validate pending records too
317
+ this.PopulatePendingRecords(); // do this before we validate as we must validate pending records too
314
318
  const valResults = this.Validate();
315
319
  if (valResults.Success) {
316
320
  const result = yield this.InternalSaveRecord();
@@ -322,13 +326,15 @@ export class BaseFormComponent extends BaseRecordComponent {
322
326
  this.sharedService.CreateSimpleNotification('Record saved succesfully', 'success', 2500);
323
327
  return true;
324
328
  }
325
- else
329
+ else {
326
330
  this.sharedService.CreateSimpleNotification('Error saving record', 'error', 5000);
331
+ }
327
332
  }
328
333
  else {
329
334
  this.sharedService.CreateSimpleNotification('Validation Errors\n' + valResults.Errors.map(x => x.Message).join('\n'), 'warning', 10000);
330
335
  }
331
336
  }
337
+ LogError("Could not save reocrd: Record not found");
332
338
  return false; // if we get here, we have failed/validation error/etc
333
339
  }
334
340
  catch (e) {
@@ -355,10 +361,11 @@ export class BaseFormComponent extends BaseRecordComponent {
355
361
  if (pendingRecords && pendingRecords.length > 0) {
356
362
  // we have pending records, so we need to revert them as well
357
363
  pendingRecords.forEach(p => {
358
- p.Revert();
364
+ if (p.action === 'save')
365
+ p.entityObject.Revert(); // only do this if we are saving the record, ignore deletes
359
366
  });
360
367
  }
361
- this.RaiseEvent('REVERT_PENDING_CHANGES');
368
+ this.RaiseEvent(BaseFormComponentEventCodes.REVERT_PENDING_CHANGES);
362
369
  }
363
370
  // if we get here we are good to go
364
371
  this.EditMode = false;
@@ -368,32 +375,31 @@ export class BaseFormComponent extends BaseRecordComponent {
368
375
  this.PopulatePendingRecords();
369
376
  const pendingRecords = this.PendingRecords;
370
377
  if (pendingRecords && pendingRecords.length > 0) {
371
- for (let i = 0; i < pendingRecords.length; i++) {
372
- if (pendingRecords[i].Dirty)
378
+ for (const p of pendingRecords) {
379
+ if (p.action === 'delete')
380
+ return true;
381
+ else if (p.entityObject.Dirty)
373
382
  return true;
374
383
  }
375
384
  }
376
385
  return false;
377
386
  }
378
387
  PopulatePendingRecords() {
379
- return __awaiter(this, void 0, void 0, function* () {
380
- // this method is called by the parent class at the right time to populate all of the pending records for a transaction
381
- // all we do is talk to all of our child compoennts and get their pending records and xfer them over to the PendingRecords array
382
- // the parent class will then take care of the rest...
383
- this._pendingRecords = []; // wipe out our array first
384
- this.RaiseEvent('EDITING_COMPLETE'); // first tell the child components to finish up their editing
385
- const result = this.RaiseEvent('POPULATE_PENDING_RECORDS');
386
- if (result && result.pendingRecords) {
387
- for (const p of result.pendingRecords)
388
- this.PendingRecords.push(p);
389
- }
390
- });
388
+ // this method is called by the parent class at the right time to populate all of the pending records for a transaction
389
+ // all we do is talk to all of our child compoennts and get their pending records and xfer them over to the PendingRecords array
390
+ // the parent class will then take care of the rest...
391
+ this._pendingRecords = []; // wipe out our array first
392
+ this.RaiseEvent(BaseFormComponentEventCodes.EDITING_COMPLETE); // first tell the child components to finish up their editing
393
+ const result = this.RaiseEvent(BaseFormComponentEventCodes.POPULATE_PENDING_RECORDS);
394
+ if (result && result.pendingChanges) {
395
+ for (const p of result.pendingChanges)
396
+ this.PendingRecords.push(p);
397
+ }
391
398
  }
392
399
  InternalSaveRecord() {
393
400
  return __awaiter(this, void 0, void 0, function* () {
394
401
  if (this.record) {
395
- // save the record, but first create a transaction group if we have any other stuf to submit
396
- yield this.PopulatePendingRecords();
402
+ // DONT POPULATE PENDING RECORDS AGAIN HERE AS IT WAS DONE before Validate() was called
397
403
  if (this._pendingRecords.length > 0) {
398
404
  // we need to create a transaction group
399
405
  const md = new Metadata();
@@ -401,10 +407,12 @@ export class BaseFormComponent extends BaseRecordComponent {
401
407
  this.record.TransactionGroup = tg;
402
408
  this.record.Save(); // DO NOT USE await - trans group.submit() is where we await
403
409
  // now add to the rest of the pending records
404
- for (let i = 0; i < this._pendingRecords.length; i++) {
405
- const x = this._pendingRecords[i];
406
- x.TransactionGroup = tg;
407
- x.Save(); // DO NOT USE await - trans group.submit() is where we await
410
+ for (const x of this._pendingRecords) {
411
+ x.entityObject.TransactionGroup = tg;
412
+ if (x.action === 'save')
413
+ x.entityObject.Save(); // DO NOT AWAIT, part of a TG
414
+ else
415
+ x.entityObject.Delete(); // DO NOT AWAIT, part of a TG
408
416
  }
409
417
  // finally submit the TG
410
418
  return yield tg.Submit();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memberjunction/ng-base-forms",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "MemberJunction: Angular Base Form Components",
5
5
  "main": "./dist/public-api.js",
6
6
  "typings": "./dist/public-api.d.ts",
@@ -25,14 +25,15 @@
25
25
  "@angular/router": "18.0.2"
26
26
  },
27
27
  "dependencies": {
28
- "@memberjunction/global": "1.7.0",
29
- "@memberjunction/core": "1.7.0",
30
- "@memberjunction/ng-code-editor": "1.7.0",
31
- "@memberjunction/ng-shared": "1.7.0",
32
- "@memberjunction/ng-tabstrip": "1.7.0",
33
- "@memberjunction/ng-link-directives": "1.7.0",
34
- "@memberjunction/ng-container-directives": "1.7.0",
35
- "@memberjunction/ng-record-changes": "1.7.0",
28
+ "@memberjunction/global": "1.8.0",
29
+ "@memberjunction/core": "1.8.0",
30
+ "@memberjunction/ng-code-editor": "1.8.0",
31
+ "@memberjunction/ng-shared": "1.8.0",
32
+ "@memberjunction/ng-tabstrip": "1.8.0",
33
+ "@memberjunction/ng-link-directives": "1.8.0",
34
+ "@memberjunction/ng-container-directives": "1.8.0",
35
+ "@memberjunction/ng-record-changes": "1.8.0",
36
+ "@memberjunction/ng-base-types": "1.8.0",
36
37
  "@progress/kendo-angular-buttons": "16.2.0",
37
38
  "@progress/kendo-angular-dropdowns": "16.2.0",
38
39
  "@progress/kendo-angular-inputs": "16.2.0",