@memberjunction/ng-find-record 5.22.0 → 5.23.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.
@@ -1,16 +1,15 @@
1
1
  import { Component, Output, EventEmitter, Input } from '@angular/core';
2
2
  import * as i0 from "@angular/core";
3
- import * as i1 from "@progress/kendo-angular-dialog";
4
- import * as i2 from "@progress/kendo-angular-buttons";
5
- import * as i3 from "./find-record.component";
3
+ import * as i1 from "@memberjunction/ng-ui-components";
4
+ import * as i2 from "./find-record.component";
6
5
  function FindRecordDialogComponent_Conditional_0_Template(rf, ctx) { if (rf & 1) {
7
6
  const _r1 = i0.ɵɵgetCurrentView();
8
- i0.ɵɵelementStart(0, "kendo-dialog", 1);
9
- i0.ɵɵlistener("close", function FindRecordDialogComponent_Conditional_0_Template_kendo_dialog_close_0_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.OnCancel()); });
7
+ i0.ɵɵelementStart(0, "mj-dialog", 1);
8
+ i0.ɵɵlistener("Close", function FindRecordDialogComponent_Conditional_0_Template_mj_dialog_Close_0_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.OnCancel()); });
10
9
  i0.ɵɵelementStart(1, "mj-find-record", 2);
11
10
  i0.ɵɵlistener("OnRecordSelected", function FindRecordDialogComponent_Conditional_0_Template_mj_find_record_OnRecordSelected_1_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.BubbleOnRecordSelected($event)); });
12
11
  i0.ɵɵelementEnd();
13
- i0.ɵɵelementStart(2, "kendo-dialog-actions")(3, "button", 3);
12
+ i0.ɵɵelementStart(2, "mj-dialog-actions")(3, "button", 3);
14
13
  i0.ɵɵlistener("click", function FindRecordDialogComponent_Conditional_0_Template_button_click_3_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.OnOK()); });
15
14
  i0.ɵɵtext(4, "OK");
16
15
  i0.ɵɵelementEnd();
@@ -20,7 +19,7 @@ function FindRecordDialogComponent_Conditional_0_Template(rf, ctx) { if (rf & 1)
20
19
  i0.ɵɵelementEnd()()();
21
20
  } if (rf & 2) {
22
21
  const ctx_r1 = i0.ɵɵnextContext();
23
- i0.ɵɵproperty("width", ctx_r1.DialogWidth)("height", ctx_r1.DialogHeight)("title", ctx_r1.DialogTitle);
22
+ i0.ɵɵproperty("Visible", true)("Width", ctx_r1.DialogWidth)("Height", ctx_r1.DialogHeight)("Title", ctx_r1.DialogTitle);
24
23
  i0.ɵɵadvance();
25
24
  i0.ɵɵproperty("EntityName", ctx_r1.EntityName)("DisplayFields", ctx_r1.DisplayFields);
26
25
  } }
@@ -72,15 +71,15 @@ export class FindRecordDialogComponent {
72
71
  this.DialogClosed.emit(true);
73
72
  }
74
73
  static ɵfac = function FindRecordDialogComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || FindRecordDialogComponent)(); };
75
- static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: FindRecordDialogComponent, selectors: [["mj-find-record-dialog"]], inputs: { DialogTitle: "DialogTitle", DialogWidth: "DialogWidth", DialogHeight: "DialogHeight", SelectedRecord: "SelectedRecord", DialogVisible: "DialogVisible", EntityName: "EntityName", DisplayFields: "DisplayFields" }, outputs: { DialogClosed: "DialogClosed", OnRecordSelected: "OnRecordSelected" }, standalone: false, decls: 1, vars: 1, consts: [[3, "width", "height", "title"], [3, "close", "width", "height", "title"], [3, "OnRecordSelected", "EntityName", "DisplayFields"], ["kendoButton", "", "themeColor", "primary", 3, "click"], ["kendoButton", "", 3, "click"]], template: function FindRecordDialogComponent_Template(rf, ctx) { if (rf & 1) {
76
- i0.ɵɵconditionalCreate(0, FindRecordDialogComponent_Conditional_0_Template, 7, 5, "kendo-dialog", 0);
74
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: FindRecordDialogComponent, selectors: [["mj-find-record-dialog"]], inputs: { DialogTitle: "DialogTitle", DialogWidth: "DialogWidth", DialogHeight: "DialogHeight", SelectedRecord: "SelectedRecord", DialogVisible: "DialogVisible", EntityName: "EntityName", DisplayFields: "DisplayFields" }, outputs: { DialogClosed: "DialogClosed", OnRecordSelected: "OnRecordSelected" }, standalone: false, decls: 1, vars: 1, consts: [[3, "Visible", "Width", "Height", "Title"], [3, "Close", "Visible", "Width", "Height", "Title"], [3, "OnRecordSelected", "EntityName", "DisplayFields"], ["mjButton", "", "variant", "primary", 3, "click"], ["mjButton", "", 3, "click"]], template: function FindRecordDialogComponent_Template(rf, ctx) { if (rf & 1) {
75
+ i0.ɵɵconditionalCreate(0, FindRecordDialogComponent_Conditional_0_Template, 7, 6, "mj-dialog", 0);
77
76
  } if (rf & 2) {
78
77
  i0.ɵɵconditional(ctx.DialogVisible ? 0 : -1);
79
- } }, dependencies: [i1.DialogComponent, i1.DialogActionsComponent, i2.ButtonComponent, i3.FindRecordComponent], encapsulation: 2 });
78
+ } }, dependencies: [i1.MJButtonDirective, i1.MJDialogComponent, i1.MJDialogActionsComponent, i2.FindRecordComponent], encapsulation: 2 });
80
79
  }
81
80
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(FindRecordDialogComponent, [{
82
81
  type: Component,
83
- args: [{ standalone: false, selector: 'mj-find-record-dialog', template: "@if (DialogVisible) {\n <kendo-dialog\n [width]=\"DialogWidth\"\n [height]=\"DialogHeight\"\n [title]=\"DialogTitle\" \n (close)=\"OnCancel()\"\n >\n <mj-find-record\n [EntityName]=\"EntityName\"\n [DisplayFields]=\"DisplayFields\"\n (OnRecordSelected)=\"BubbleOnRecordSelected($event)\"\n >\n </mj-find-record>\n <kendo-dialog-actions>\n <button kendoButton (click)=\"OnOK()\" themeColor=\"primary\">OK</button>\n <button kendoButton (click)=\"OnCancel()\">Cancel</button>\n </kendo-dialog-actions> \n </kendo-dialog> \n}" }]
82
+ args: [{ standalone: false, selector: 'mj-find-record-dialog', template: "@if (DialogVisible) {\n <mj-dialog\n [Visible]=\"true\"\n [Width]=\"DialogWidth\"\n [Height]=\"DialogHeight\"\n [Title]=\"DialogTitle\"\n (Close)=\"OnCancel()\"\n >\n <mj-find-record\n [EntityName]=\"EntityName\"\n [DisplayFields]=\"DisplayFields\"\n (OnRecordSelected)=\"BubbleOnRecordSelected($event)\"\n >\n </mj-find-record>\n <mj-dialog-actions>\n <button mjButton variant=\"primary\" (click)=\"OnOK()\">OK</button>\n <button mjButton (click)=\"OnCancel()\">Cancel</button>\n </mj-dialog-actions>\n </mj-dialog>\n}\n" }]
84
83
  }], null, { DialogTitle: [{
85
84
  type: Input
86
85
  }], DialogWidth: [{
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.component.js","sourceRoot":"","sources":["../../src/lib/dialog.component.ts","../../src/lib/dialog.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAG,MAAM,eAAe,CAAC;;;;;;;ICCpE,uCAKC;IADG,mMAAS,iBAAU,KAAC;IAEpB,yCAIC;IADG,iOAAoB,qCAA8B,KAAC;IAEvD,iBAAiB;IAEb,AADJ,4CAAsB,gBACwC;IAAtC,6LAAS,aAAM,KAAC;IAAsB,kBAAE;IAAA,iBAAS;IACrE,iCAAyC;IAArB,6LAAS,iBAAU,KAAC;IAAC,sBAAM;IAEvD,AADI,AADmD,iBAAS,EACrC,EACZ;;;IAbX,AADA,AADA,0CAAqB,+BACE,6BACF;IAIjB,cAAyB;IACzB,AADA,8CAAyB,uCACM;;ADE3C,MAAM,OAAO,yBAAyB;IAC3B,WAAW,GAAW,aAAa,CAAC;IACpC,WAAW,GAAW,OAAO,CAAC;IAC9B,YAAY,GAAW,OAAO,CAAC;IAExC;;OAEG;IACM,cAAc,GAAsB,IAAI,CAAC;IAElD,IAAa,aAAa;QACxB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IACD,IAAI,aAAa,CAAC,KAAc;QAC9B,IAAI,KAAK,KAAK,IAAI,CAAC,cAAc,IAAI,KAAK,EAAE,CAAC;YAC3C,+BAA+B;QACjC,CAAC;QACD,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC;IAC9B,CAAC;IACO,cAAc,GAAY,KAAK,CAAC;IACxC;;OAEG;IACO,YAAY,GAAG,IAAI,YAAY,EAAW,CAAC;IAErD,gFAAgF;IAChF;;OAEG;IACM,UAAU,GAAW,EAAE,CAAC;IAEjC;;OAEG;IACM,aAAa,GAAsB,EAAE,CAAC,CAAC,gCAAgC;IAI/E;;OAEG;IACM,gBAAgB,GAAG,IAAI,YAAY,EAAc,CAAC;IAErD,QAAQ;QACb,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;QAC3B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;IAEM,sBAAsB,CAAC,MAAW;QACvC,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC;QAC7B,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;IAEM,IAAI;QACT,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;QAC3B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;mHAxDU,yBAAyB;6DAAzB,yBAAyB;YCXtC,oGAAqB;;YAArB,4CAkBC;;;iFDPY,yBAAyB;cANrC,SAAS;6BACI,KAAK,YACP,uBAAuB;;kBAKhC,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBAKL,KAAK;;kBAEL,KAAK;;kBAaL,MAAM;;kBAMN,KAAK;;kBAKL,KAAK;;kBAOL,MAAM;;kFAzCI,yBAAyB","sourcesContent":["import { Component, Output, EventEmitter, Input } from '@angular/core';\n\nimport { BaseEntity, EntityFieldInfo } from '@memberjunction/core';\n \n \n@Component({\n standalone: false,\n selector: 'mj-find-record-dialog',\n templateUrl: './dialog.component.html',\n styleUrls: ['./dialog.component.css']\n})\nexport class FindRecordDialogComponent {\n @Input() DialogTitle: string = 'Find Record';\n @Input() DialogWidth: string = '700px';\n @Input() DialogHeight: string = '450px';\n\n /**\n * Optional, set this to the currently selected record to start the dialog with that record selected, if desired. This property will be updated as the user selects records in the dialog.\n */\n @Input() SelectedRecord: BaseEntity | null = null;\n\n @Input() get DialogVisible(): boolean {\n return this._dialogVisible;\n }\n set DialogVisible(value: boolean) {\n if (value !== this._dialogVisible && value) {\n // do init stuff here as needed\n }\n this._dialogVisible = value;\n }\n private _dialogVisible: boolean = false;\n /**\n * Emits when the dialog is closed, the parameter is true if the dialog was closed with the OK button, false if it was closed with the Cancel button\n */\n @Output() DialogClosed = new EventEmitter<boolean>();\n\n ///// REST OF THE BELOW JUST GET MAPPED TO THE CONTAINED RecordSelectorComponent\n /**\n * The name of the entity to show records for.\n */\n @Input() EntityName: string = '';\n\n /**\n * Optional, list of fields to be displayed in the grid of search results, if not specified, the default fields will be displayed\n */\n @Input() DisplayFields: EntityFieldInfo[] = []; // Fields to display in the grid\n\n\n\n /**\n * When a record is selected, this event is emitted with the selected record\n */\n @Output() OnRecordSelected = new EventEmitter<BaseEntity>();\n\n public OnCancel() {\n this.DialogVisible = false;\n this.DialogClosed.emit(false);\n }\n\n public BubbleOnRecordSelected(record: any) {\n this.SelectedRecord = record;\n this.OnRecordSelected.emit(record);\n }\n\n public OnOK() {\n this.DialogVisible = false;\n this.DialogClosed.emit(true);\n }\n}\n","@if (DialogVisible) {\n <kendo-dialog\n [width]=\"DialogWidth\"\n [height]=\"DialogHeight\"\n [title]=\"DialogTitle\" \n (close)=\"OnCancel()\"\n >\n <mj-find-record\n [EntityName]=\"EntityName\"\n [DisplayFields]=\"DisplayFields\"\n (OnRecordSelected)=\"BubbleOnRecordSelected($event)\"\n >\n </mj-find-record>\n <kendo-dialog-actions>\n <button kendoButton (click)=\"OnOK()\" themeColor=\"primary\">OK</button>\n <button kendoButton (click)=\"OnCancel()\">Cancel</button>\n </kendo-dialog-actions> \n </kendo-dialog> \n}"]}
1
+ {"version":3,"file":"dialog.component.js","sourceRoot":"","sources":["../../src/lib/dialog.component.ts","../../src/lib/dialog.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAG,MAAM,eAAe,CAAC;;;;;;ICCpE,oCAMC;IADG,gMAAS,iBAAU,KAAC;IAEpB,yCAIC;IADG,iOAAoB,qCAA8B,KAAC;IAEvD,iBAAiB;IAEb,AADJ,yCAAmB,gBACqC;IAAjB,6LAAS,aAAM,KAAC;IAAC,kBAAE;IAAA,iBAAS;IAC/D,iCAAsC;IAArB,6LAAS,iBAAU,KAAC;IAAC,sBAAM;IAEpD,AADI,AADgD,iBAAS,EACrC,EACZ;;;IAbR,AADA,AADA,AADA,8BAAgB,6BACK,+BACE,6BACF;IAIjB,cAAyB;IACzB,AADA,8CAAyB,uCACM;;ADC3C,MAAM,OAAO,yBAAyB;IAC3B,WAAW,GAAW,aAAa,CAAC;IACpC,WAAW,GAAW,OAAO,CAAC;IAC9B,YAAY,GAAW,OAAO,CAAC;IAExC;;OAEG;IACM,cAAc,GAAsB,IAAI,CAAC;IAElD,IAAa,aAAa;QACxB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IACD,IAAI,aAAa,CAAC,KAAc;QAC9B,IAAI,KAAK,KAAK,IAAI,CAAC,cAAc,IAAI,KAAK,EAAE,CAAC;YAC3C,+BAA+B;QACjC,CAAC;QACD,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC;IAC9B,CAAC;IACO,cAAc,GAAY,KAAK,CAAC;IACxC;;OAEG;IACO,YAAY,GAAG,IAAI,YAAY,EAAW,CAAC;IAErD,gFAAgF;IAChF;;OAEG;IACM,UAAU,GAAW,EAAE,CAAC;IAEjC;;OAEG;IACM,aAAa,GAAsB,EAAE,CAAC,CAAC,gCAAgC;IAI/E;;OAEG;IACM,gBAAgB,GAAG,IAAI,YAAY,EAAc,CAAC;IAErD,QAAQ;QACb,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;QAC3B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;IAEM,sBAAsB,CAAC,MAAW;QACvC,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC;QAC7B,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;IAEM,IAAI;QACT,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;QAC3B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;mHAxDU,yBAAyB;6DAAzB,yBAAyB;YCXtC,iGAAqB;;YAArB,4CAmBC;;;iFDRY,yBAAyB;cANrC,SAAS;6BACI,KAAK,YACP,uBAAuB;;kBAKhC,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBAKL,KAAK;;kBAEL,KAAK;;kBAaL,MAAM;;kBAMN,KAAK;;kBAKL,KAAK;;kBAOL,MAAM;;kFAzCI,yBAAyB","sourcesContent":["import { Component, Output, EventEmitter, Input } from '@angular/core';\n\nimport { BaseEntity, EntityFieldInfo } from '@memberjunction/core';\n \n \n@Component({\n standalone: false,\n selector: 'mj-find-record-dialog',\n templateUrl: './dialog.component.html',\n styleUrls: ['./dialog.component.css']\n})\nexport class FindRecordDialogComponent {\n @Input() DialogTitle: string = 'Find Record';\n @Input() DialogWidth: string = '700px';\n @Input() DialogHeight: string = '450px';\n\n /**\n * Optional, set this to the currently selected record to start the dialog with that record selected, if desired. This property will be updated as the user selects records in the dialog.\n */\n @Input() SelectedRecord: BaseEntity | null = null;\n\n @Input() get DialogVisible(): boolean {\n return this._dialogVisible;\n }\n set DialogVisible(value: boolean) {\n if (value !== this._dialogVisible && value) {\n // do init stuff here as needed\n }\n this._dialogVisible = value;\n }\n private _dialogVisible: boolean = false;\n /**\n * Emits when the dialog is closed, the parameter is true if the dialog was closed with the OK button, false if it was closed with the Cancel button\n */\n @Output() DialogClosed = new EventEmitter<boolean>();\n\n ///// REST OF THE BELOW JUST GET MAPPED TO THE CONTAINED RecordSelectorComponent\n /**\n * The name of the entity to show records for.\n */\n @Input() EntityName: string = '';\n\n /**\n * Optional, list of fields to be displayed in the grid of search results, if not specified, the default fields will be displayed\n */\n @Input() DisplayFields: EntityFieldInfo[] = []; // Fields to display in the grid\n\n\n\n /**\n * When a record is selected, this event is emitted with the selected record\n */\n @Output() OnRecordSelected = new EventEmitter<BaseEntity>();\n\n public OnCancel() {\n this.DialogVisible = false;\n this.DialogClosed.emit(false);\n }\n\n public BubbleOnRecordSelected(record: any) {\n this.SelectedRecord = record;\n this.OnRecordSelected.emit(record);\n }\n\n public OnOK() {\n this.DialogVisible = false;\n this.DialogClosed.emit(true);\n }\n}\n","@if (DialogVisible) {\n <mj-dialog\n [Visible]=\"true\"\n [Width]=\"DialogWidth\"\n [Height]=\"DialogHeight\"\n [Title]=\"DialogTitle\"\n (Close)=\"OnCancel()\"\n >\n <mj-find-record\n [EntityName]=\"EntityName\"\n [DisplayFields]=\"DisplayFields\"\n (OnRecordSelected)=\"BubbleOnRecordSelected($event)\"\n >\n </mj-find-record>\n <mj-dialog-actions>\n <button mjButton variant=\"primary\" (click)=\"OnOK()\">OK</button>\n <button mjButton (click)=\"OnCancel()\">Cancel</button>\n </mj-dialog-actions>\n </mj-dialog>\n}\n"]}
@@ -1,5 +1,6 @@
1
1
  import { EventEmitter, OnDestroy, OnInit } from '@angular/core';
2
2
  import { BaseEntity, EntityFieldInfo } from '@memberjunction/core';
3
+ import { ColDef, GridReadyEvent, RowSelectionOptions, SelectionChangedEvent, type Theme } from 'ag-grid-community';
3
4
  import * as i0 from "@angular/core";
4
5
  export declare class FindRecordComponent implements OnInit, OnDestroy {
5
6
  /**
@@ -19,17 +20,24 @@ export declare class FindRecordComponent implements OnInit, OnDestroy {
19
20
  */
20
21
  OnRecordSelected: EventEmitter<BaseEntity<unknown>>;
21
22
  searchTerm: string;
22
- records: any[];
23
+ records: BaseEntity[];
23
24
  loading: boolean;
24
25
  searchHasRun: boolean;
25
26
  private entityInfo;
26
27
  private searchSubject;
27
28
  private searchSubscription;
29
+ ColumnDefs: ColDef[];
30
+ DefaultColDef: ColDef;
31
+ RowSelectionConfig: RowSelectionOptions;
32
+ GridTheme: Theme;
33
+ private gridApi;
28
34
  ngOnInit(): void;
29
35
  ngOnDestroy(): void;
30
36
  onFind(): void;
31
37
  onSearchTermChange(term: string): void;
32
- onSelectionChange(event: any): void;
38
+ onSelectionChange(event: SelectionChangedEvent): void;
39
+ onGridReady(event: GridReadyEvent): void;
40
+ private buildColumnDefs;
33
41
  protected doSearch(searchTerm: string): Promise<BaseEntity[]>;
34
42
  static ɵfac: i0.ɵɵFactoryDeclaration<FindRecordComponent, never>;
35
43
  static ɵcmp: i0.ɵɵComponentDeclaration<FindRecordComponent, "mj-find-record", never, { "EntityName": { "alias": "EntityName"; "required": false; }; "DisplayFields": { "alias": "DisplayFields"; "required": false; }; "SearchDebounceTime": { "alias": "SearchDebounceTime"; "required": false; }; }, { "OnRecordSelected": "OnRecordSelected"; }, never, never, false, never>;
@@ -1 +1 @@
1
- {"version":3,"file":"find-record.component.d.ts","sourceRoot":"","sources":["../../src/lib/find-record.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,YAAY,EAAU,SAAS,EAAE,MAAM,EAAU,MAAM,eAAe,CAAC;AAC5F,OAAO,EAAE,UAAU,EAAE,eAAe,EAA2C,MAAM,sBAAsB,CAAC;;AAI5G,qBAMa,mBAAoB,YAAW,MAAM,EAAE,SAAS;IAC3D;;OAEG;IACM,UAAU,EAAE,MAAM,CAAM;IAEjC;;OAEG;IACa,aAAa,EAAE,eAAe,EAAE,CAAM;IAEtD;;OAEG;IACa,kBAAkB,EAAE,MAAM,CAAO;IAGjD;;O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AA2B;IAG9C,UAAU,EAAE,MAAM,EAAE,CAAM;IAC1B,aAAa,EAAE,MAAM,CAI1B;IACK,kBAAkB,EAAE,mBAAmB,CAI5C;IACK,SAAS,EAAE,KAAK,CAA6C;IACpE,OAAO,CAAC,OAAO,CAAwB;IAGvC,QAAQ;IAyCR,WAAW;IAQX,MAAM;IAIN,kBAAkB,CAAC,IAAI,EAAE,MAAM;IAKxB,iBAAiB,CAAC,KAAK,EAAE,qBAAqB;IAO9C,WAAW,CAAC,KAAK,EAAE,cAAc;IAIxC,OAAO,CAAC,eAAe;cAQP,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;yCA7HxD,mBAAmB;2CAAnB,mBAAmB;CA8I/B"}
@@ -2,41 +2,33 @@ import { Component, EventEmitter, Input, Output } from '@angular/core';
2
2
  import { LogError, Metadata, RunView } from '@memberjunction/core';
3
3
  import { Subject } from 'rxjs';
4
4
  import { debounceTime, distinctUntilChanged, switchMap } from 'rxjs/operators';
5
+ import { ModuleRegistry, AllCommunityModule, themeAlpine, colorSchemeVariable } from 'ag-grid-community';
5
6
  import * as i0 from "@angular/core";
6
7
  import * as i1 from "@angular/forms";
7
- import * as i2 from "@progress/kendo-angular-grid";
8
- import * as i3 from "@progress/kendo-angular-buttons";
9
- import * as i4 from "@progress/kendo-angular-inputs";
10
- const _c0 = () => ({ mode: "single" });
8
+ import * as i2 from "ag-grid-angular";
9
+ import * as i3 from "@memberjunction/ng-ui-components";
11
10
  function FindRecordComponent_Conditional_4_Template(rf, ctx) { if (rf & 1) {
12
11
  i0.ɵɵelementStart(0, "div");
13
12
  i0.ɵɵtext(1, "Searching...");
14
13
  i0.ɵɵelementEnd();
15
14
  } }
16
- function FindRecordComponent_Conditional_5_For_3_Template(rf, ctx) { if (rf & 1) {
17
- i0.ɵɵelement(0, "kendo-grid-column", 3);
18
- } if (rf & 2) {
19
- const field_r3 = ctx.$implicit;
20
- i0.ɵɵproperty("field", field_r3.Name)("title", field_r3.DisplayNameOrName);
21
- } }
22
15
  function FindRecordComponent_Conditional_5_Template(rf, ctx) { if (rf & 1) {
23
16
  const _r1 = i0.ɵɵgetCurrentView();
24
- i0.ɵɵelementStart(0, "div")(1, "kendo-grid", 2);
25
- i0.ɵɵlistener("selectionChange", function FindRecordComponent_Conditional_5_Template_kendo_grid_selectionChange_1_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.onSelectionChange($event)); });
26
- i0.ɵɵrepeaterCreate(2, FindRecordComponent_Conditional_5_For_3_Template, 1, 2, "kendo-grid-column", 3, i0.ɵɵrepeaterTrackByIdentity);
17
+ i0.ɵɵelementStart(0, "div", 2)(1, "ag-grid-angular", 3);
18
+ i0.ɵɵlistener("selectionChanged", function FindRecordComponent_Conditional_5_Template_ag_grid_angular_selectionChanged_1_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.onSelectionChange($event)); })("gridReady", function FindRecordComponent_Conditional_5_Template_ag_grid_angular_gridReady_1_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.onGridReady($event)); });
27
19
  i0.ɵɵelementEnd()();
28
20
  } if (rf & 2) {
29
21
  const ctx_r1 = i0.ɵɵnextContext();
30
22
  i0.ɵɵadvance();
31
- i0.ɵɵproperty("data", ctx_r1.records)("height", 280)("selectable", i0.ɵɵpureFunction0(3, _c0));
32
- i0.ɵɵadvance();
33
- i0.ɵɵrepeater(ctx_r1.DisplayFields);
23
+ i0.ɵɵproperty("theme", ctx_r1.GridTheme)("rowData", ctx_r1.records)("columnDefs", ctx_r1.ColumnDefs)("defaultColDef", ctx_r1.DefaultColDef)("rowSelection", ctx_r1.RowSelectionConfig);
34
24
  } }
35
25
  function FindRecordComponent_Conditional_6_Template(rf, ctx) { if (rf & 1) {
36
26
  i0.ɵɵelementStart(0, "div");
37
27
  i0.ɵɵtext(1, "No records found.");
38
28
  i0.ɵɵelementEnd();
39
29
  } }
30
+ // Register AG Grid modules
31
+ ModuleRegistry.registerModules([AllCommunityModule]);
40
32
  export class FindRecordComponent {
41
33
  /**
42
34
  * The name of the entity to show records for.
@@ -61,6 +53,20 @@ export class FindRecordComponent {
61
53
  entityInfo; // Entity metadata
62
54
  searchSubject = new Subject(); // Subject to emit search term changes
63
55
  searchSubscription;
56
+ // AG Grid configuration
57
+ ColumnDefs = [];
58
+ DefaultColDef = {
59
+ sortable: true,
60
+ resizable: true,
61
+ filter: false
62
+ };
63
+ RowSelectionConfig = {
64
+ mode: 'singleRow',
65
+ checkboxes: false,
66
+ enableClickSelection: true
67
+ };
68
+ GridTheme = themeAlpine.withPart(colorSchemeVariable);
69
+ gridApi = null;
64
70
  ngOnInit() {
65
71
  // Fetch the entity metadata based on EntityName
66
72
  const md = new Metadata();
@@ -73,6 +79,8 @@ export class FindRecordComponent {
73
79
  if (this.DisplayFields.length === 0) {
74
80
  this.DisplayFields = this.entityInfo.Fields.filter((field) => field.DefaultInView || field.IsPrimaryKey || field.IsNameField || field.IncludeInUserSearchAPI);
75
81
  }
82
+ // Build AG Grid column definitions from display fields
83
+ this.ColumnDefs = this.buildColumnDefs();
76
84
  // Subscribe to the searchSubject with debounce
77
85
  this.searchSubscription = this.searchSubject.pipe(debounceTime(this.SearchDebounceTime), // Delay search execution by 300ms
78
86
  distinctUntilChanged(), // Only proceed if the search term has changed
@@ -106,8 +114,19 @@ export class FindRecordComponent {
106
114
  this.searchSubject.next(term); // Emit the new search term
107
115
  }
108
116
  onSelectionChange(event) {
109
- // Emit the selected record
110
- this.OnRecordSelected.emit(event.selectedRows[0].dataItem);
117
+ const selectedRows = event.api.getSelectedRows();
118
+ if (selectedRows.length > 0) {
119
+ this.OnRecordSelected.emit(selectedRows[0]);
120
+ }
121
+ }
122
+ onGridReady(event) {
123
+ this.gridApi = event.api;
124
+ }
125
+ buildColumnDefs() {
126
+ return this.DisplayFields.map((field) => ({
127
+ field: field.Name,
128
+ headerName: field.DisplayNameOrName
129
+ }));
111
130
  }
112
131
  // Stub function for simulating a database search (replace with actual search logic)
113
132
  async doSearch(searchTerm) {
@@ -128,17 +147,17 @@ export class FindRecordComponent {
128
147
  }
129
148
  }
130
149
  static ɵfac = function FindRecordComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || FindRecordComponent)(); };
131
- static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: FindRecordComponent, selectors: [["mj-find-record"]], inputs: { EntityName: "EntityName", DisplayFields: "DisplayFields", SearchDebounceTime: "SearchDebounceTime" }, outputs: { OnRecordSelected: "OnRecordSelected" }, standalone: false, decls: 7, vars: 4, consts: [["type", "text", "placeholder", "Start typing to search...", 1, "find-textbox", 3, "ngModelChange", "ngModel"], ["kendoButton", "", 1, "find-button", 3, "click"], [3, "selectionChange", "data", "height", "selectable"], [3, "field", "title"]], template: function FindRecordComponent_Template(rf, ctx) { if (rf & 1) {
132
- i0.ɵɵelementStart(0, "div")(1, "kendo-textbox", 0);
133
- i0.ɵɵtwoWayListener("ngModelChange", function FindRecordComponent_Template_kendo_textbox_ngModelChange_1_listener($event) { i0.ɵɵtwoWayBindingSet(ctx.searchTerm, $event) || (ctx.searchTerm = $event); return $event; });
134
- i0.ɵɵlistener("ngModelChange", function FindRecordComponent_Template_kendo_textbox_ngModelChange_1_listener($event) { return ctx.onSearchTermChange($event); });
150
+ static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: FindRecordComponent, selectors: [["mj-find-record"]], inputs: { EntityName: "EntityName", DisplayFields: "DisplayFields", SearchDebounceTime: "SearchDebounceTime" }, outputs: { OnRecordSelected: "OnRecordSelected" }, standalone: false, decls: 7, vars: 4, consts: [["type", "text", "placeholder", "Start typing to search...", 1, "mj-input", "find-textbox", 3, "ngModelChange", "ngModel"], ["mjButton", "", "variant", "primary", 1, "find-button", 3, "click"], [1, "find-grid-wrapper"], [1, "find-grid", 3, "selectionChanged", "gridReady", "theme", "rowData", "columnDefs", "defaultColDef", "rowSelection"]], template: function FindRecordComponent_Template(rf, ctx) { if (rf & 1) {
151
+ i0.ɵɵelementStart(0, "div")(1, "input", 0);
152
+ i0.ɵɵtwoWayListener("ngModelChange", function FindRecordComponent_Template_input_ngModelChange_1_listener($event) { i0.ɵɵtwoWayBindingSet(ctx.searchTerm, $event) || (ctx.searchTerm = $event); return $event; });
153
+ i0.ɵɵlistener("ngModelChange", function FindRecordComponent_Template_input_ngModelChange_1_listener($event) { return ctx.onSearchTermChange($event); });
135
154
  i0.ɵɵelementEnd();
136
155
  i0.ɵɵelementStart(2, "button", 1);
137
156
  i0.ɵɵlistener("click", function FindRecordComponent_Template_button_click_2_listener() { return ctx.onFind(); });
138
157
  i0.ɵɵtext(3, "Find");
139
158
  i0.ɵɵelementEnd();
140
159
  i0.ɵɵconditionalCreate(4, FindRecordComponent_Conditional_4_Template, 2, 0, "div");
141
- i0.ɵɵconditionalCreate(5, FindRecordComponent_Conditional_5_Template, 4, 4, "div");
160
+ i0.ɵɵconditionalCreate(5, FindRecordComponent_Conditional_5_Template, 2, 5, "div", 2);
142
161
  i0.ɵɵconditionalCreate(6, FindRecordComponent_Conditional_6_Template, 2, 0, "div");
143
162
  i0.ɵɵelementEnd();
144
163
  } if (rf & 2) {
@@ -150,11 +169,11 @@ export class FindRecordComponent {
150
169
  i0.ɵɵconditional(!ctx.loading && ctx.records.length > 0 ? 5 : -1);
151
170
  i0.ɵɵadvance();
152
171
  i0.ɵɵconditional(!ctx.loading && ctx.records.length === 0 && ctx.searchHasRun ? 6 : -1);
153
- } }, dependencies: [i1.NgControlStatus, i1.NgModel, i2.GridComponent, i2.ColumnComponent, i3.ButtonComponent, i4.TextBoxComponent], styles: [".list-box[_ngcontent-%COMP%] {\n width: 320px;\n height: 300px;\n}\n\n.k-listbox-actions-right[_ngcontent-%COMP%] {\n margin-left: 10px;\n}\n\n.item-icon[_ngcontent-%COMP%] {\n font-size: 16px;\n width: 25px;\n margin-right: 5px;\n}\n\n.find-textbox[_ngcontent-%COMP%] {\n width: 500px;\n margin-right: 10px;\n margin-bottom: 10px;\n}\n\n.find-button[_ngcontent-%COMP%] {\n width: 75px;\n margin-bottom: 10px;\n}"] });
172
+ } }, dependencies: [i1.DefaultValueAccessor, i1.NgControlStatus, i1.NgModel, i2.AgGridAngular, i3.MJButtonDirective], styles: [".list-box[_ngcontent-%COMP%] {\n width: 320px;\n height: 300px;\n}\n\n.k-listbox-actions-right[_ngcontent-%COMP%] {\n margin-left: 10px;\n}\n\n.item-icon[_ngcontent-%COMP%] {\n font-size: 16px;\n width: 25px;\n margin-right: 5px;\n}\n\n.find-textbox[_ngcontent-%COMP%] {\n width: 500px;\n margin-right: 10px;\n margin-bottom: 10px;\n}\n\n.find-button[_ngcontent-%COMP%] {\n width: 75px;\n margin-bottom: 10px;\n}\n\n.find-grid-wrapper[_ngcontent-%COMP%] {\n height: 280px;\n width: 100%;\n}\n\n.find-grid[_ngcontent-%COMP%] {\n width: 100%;\n height: 100%;\n}"] });
154
173
  }
155
174
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(FindRecordComponent, [{
156
175
  type: Component,
157
- args: [{ standalone: false, selector: 'mj-find-record', template: "<div>\n <kendo-textbox\n class=\"find-textbox\"\n type=\"text\"\n placeholder=\"Start typing to search...\"\n [(ngModel)]=\"searchTerm\"\n (ngModelChange)=\"onSearchTermChange($event)\"\n >\n </kendo-textbox>\n <button class=\"find-button\" kendoButton (click)=\"onFind()\">Find</button>\n\n @if (loading) {\n <div>Searching...</div>\n }\n @if (!loading && records.length > 0) {\n <div>\n <kendo-grid\n [data]=\"records\"\n [height]=\"280\"\n [selectable]=\"{ mode: 'single' }\"\n (selectionChange)=\"onSelectionChange($event)\"\n >\n @for (field of DisplayFields; track field) {\n <kendo-grid-column [field]=\"field.Name\" [title]=\"field.DisplayNameOrName\"></kendo-grid-column>\n }\n </kendo-grid>\n </div>\n }\n @if (!loading && records.length === 0 && searchHasRun) {\n <div>No records found.</div>\n }\n</div>\n", styles: [".list-box {\n width: 320px;\n height: 300px;\n}\n\n.k-listbox-actions-right {\n margin-left: 10px;\n}\n\n.item-icon {\n font-size: 16px;\n width: 25px;\n margin-right: 5px;\n}\n\n.find-textbox {\n width: 500px;\n margin-right: 10px;\n margin-bottom: 10px;\n}\n\n.find-button {\n width: 75px;\n margin-bottom: 10px;\n}"] }]
176
+ args: [{ standalone: false, selector: 'mj-find-record', template: "<div>\n <input\n type=\"text\"\n class=\"mj-input find-textbox\"\n placeholder=\"Start typing to search...\"\n [(ngModel)]=\"searchTerm\"\n (ngModelChange)=\"onSearchTermChange($event)\" />\n <button mjButton variant=\"primary\" class=\"find-button\" (click)=\"onFind()\">Find</button>\n\n @if (loading) {\n <div>Searching...</div>\n }\n @if (!loading && records.length > 0) {\n <div class=\"find-grid-wrapper\">\n <ag-grid-angular\n class=\"find-grid\"\n [theme]=\"GridTheme\"\n [rowData]=\"records\"\n [columnDefs]=\"ColumnDefs\"\n [defaultColDef]=\"DefaultColDef\"\n [rowSelection]=\"RowSelectionConfig\"\n (selectionChanged)=\"onSelectionChange($event)\"\n (gridReady)=\"onGridReady($event)\">\n </ag-grid-angular>\n </div>\n }\n @if (!loading && records.length === 0 && searchHasRun) {\n <div>No records found.</div>\n }\n</div>\n", styles: [".list-box {\n width: 320px;\n height: 300px;\n}\n\n.k-listbox-actions-right {\n margin-left: 10px;\n}\n\n.item-icon {\n font-size: 16px;\n width: 25px;\n margin-right: 5px;\n}\n\n.find-textbox {\n width: 500px;\n margin-right: 10px;\n margin-bottom: 10px;\n}\n\n.find-button {\n width: 75px;\n margin-bottom: 10px;\n}\n\n.find-grid-wrapper {\n height: 280px;\n width: 100%;\n}\n\n.find-grid {\n width: 100%;\n height: 100%;\n}"] }]
158
177
  }], null, { EntityName: [{
159
178
  type: Input
160
179
  }], DisplayFields: [{
@@ -164,5 +183,5 @@ export class FindRecordComponent {
164
183
  }], OnRecordSelected: [{
165
184
  type: Output
166
185
  }] }); })();
167
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(FindRecordComponent, { className: "FindRecordComponent", filePath: "src/lib/find-record.component.ts", lineNumber: 12 }); })();
186
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(FindRecordComponent, { className: "FindRecordComponent", filePath: "src/lib/find-record.component.ts", lineNumber: 27 }); })();
168
187
  //# sourceMappingURL=find-record.component.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"find-record.component.js","sourceRoot":"","sources":["../../src/lib/find-record.component.ts","../../src/lib/find-record.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAG,YAAY,EAAG,KAAK,EAAqB,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5F,OAAO,EAA2C,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC5G,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;;;;;;;;ICS3E,2BAAK;IAAA,4BAAY;IAAA,iBAAM;;;IAWjB,uCAA8F;;;IAAtD,AAArB,qCAAoB,qCAAkC;;;;IAP7E,AADF,2BAAK,oBAMA;IADD,qNAAmB,gCAAyB,KAAC;IAE7C,oIAEC;IAEL,AADE,iBAAa,EACT;;;IATF,cAAgB;IAEhB,AADA,AADA,qCAAgB,eACF,0CACmB;IAGjC,cAEC;IAFD,mCAEC;;;IAKL,2BAAK;IAAA,iCAAiB;IAAA,iBAAM;;ADlBhC,MAAM,OAAO,mBAAmB;IAC9B;;OAEG;IACM,UAAU,GAAW,EAAE,CAAC;IAEjC;;OAEG;IACa,aAAa,GAAsB,EAAE,CAAC,CAAC,gCAAgC;IAEvF;;OAEG;IACa,kBAAkB,GAAW,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B,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,gBAAgB,EAAE,UAAU;YAC5B,UAAU,EAAE,eAAe;SAC5B,CAAC,CAAC;QACH,IAAI,MAAM,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YAC7B,OAAO,MAAM,CAAC,OAAO,CAAC;YACtB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QAC3B,CAAC;aACK,CAAC;YACL,MAAM,YAAY,GAAG,uBAAuB,IAAI,CAAC,UAAU,KAAK,MAAM,CAAC,YAAY,EAAE,CAAC;YACtF,QAAQ,CAAC,YAAY,CAAC,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;6GA9GU,mBAAmB;6DAAnB,mBAAmB;YCV9B,AADF,2BAAK,uBAOA;YAFD,yNAAwB;YACxB,6HAAiB,8BAA0B,IAAC;YAE9C,iBAAgB;YAChB,iCAA2D;YAAnB,gGAAS,YAAQ,IAAC;YAAC,oBAAI;YAAA,iBAAS;YAExE,kFAAe;YAGf,kFAAsC;YActC,kFAAwD;YAG1D,iBAAM;;YA1BF,cAAwB;YAAxB,8CAAwB;YAM1B,eAEC;YAFD,sCAEC;YACD,cAaC;YAbD,iEAaC;YACD,cAEC;YAFD,uFAEC;;;iFDnBU,mBAAmB;cAN/B,SAAS;6BACI,KAAK,YACP,gBAAgB;;kBAQzB,KAAK;;kBAKL,KAAK;;kBAKL,KAAK;;kBAML,MAAM;;kFApBI,mBAAmB","sourcesContent":["import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core';\nimport { BaseEntity, EntityFieldInfo, EntityInfo, LogError, Metadata, RunView } from '@memberjunction/core';\nimport { Subject } from 'rxjs';\nimport { debounceTime, distinctUntilChanged, switchMap } from 'rxjs/operators';\n \n@Component({\n standalone: false,\n selector: 'mj-find-record',\n templateUrl: './find-record.component.html',\n styleUrls: ['./find-record.component.css']\n})\nexport class FindRecordComponent implements OnInit, OnDestroy {\n /**\n * The name of the entity to show records for.\n */\n @Input() EntityName: string = '';\n\n /**\n * Optional, list of fields to be displayed in the grid of search results, if not specified, the default fields will be displayed\n */\n @Input() public DisplayFields: EntityFieldInfo[] = []; // Fields to display in the grid\n\n /**\n * Optional, the number of milliseconds to wait after the last keypress before triggering a search. Default is 300ms\n */\n @Input() public SearchDebounceTime: number = 300; // Debounce time for search\n\n\n /**\n * When a record is selected, this event is emitted with the selected record\n */\n @Output() OnRecordSelected = new EventEmitter<BaseEntity>();\n\n public searchTerm: string = ''; // User search term\n public records: any[] = []; // Store search results\n\n public loading = false; // Loading state for search\n public searchHasRun: boolean = false; // has a search been run\n private entityInfo: EntityInfo | undefined; // Entity metadata\n\n private searchSubject = new Subject<string>(); // Subject to emit search term changes\n private searchSubscription: any;\n\n \n ngOnInit() {\n // Fetch the entity metadata based on EntityName\n const md = new Metadata();\n this.entityInfo = md.EntityByName(this.EntityName);\n if (!this.entityInfo) {\n LogError(`Entity ${this.EntityName} not found`);\n return;\n }\n\n // Set display fields (you can adjust the logic based on your entity structure)\n if (this.DisplayFields.length === 0) {\n this.DisplayFields = this.entityInfo.Fields.filter(\n (field: EntityFieldInfo) => field.DefaultInView || field.IsPrimaryKey || field.IsNameField || field.IncludeInUserSearchAPI\n );\n }\n\n // Subscribe to the searchSubject with debounce\n this.searchSubscription = this.searchSubject.pipe(\n debounceTime(this.SearchDebounceTime), // Delay search execution by 300ms\n distinctUntilChanged(), // Only proceed if the search term has changed\n switchMap(term => {\n this.loading = true;\n return this.doSearch(term);\n })\n ).subscribe({\n next: (results: any[]) => {\n this.records = results;\n this.loading = false;\n this.searchHasRun = true;\n },\n error: (error) => {\n LogError(error.message);\n this.loading = false;\n this.searchHasRun = true;\n }\n }); \n }\n\n ngOnDestroy() {\n // Cleanup the subscription\n if (this.searchSubscription) {\n this.searchSubscription.unsubscribe();\n }\n }\n\n\n onFind() {\n this.searchSubject.next(this.searchTerm); // Trigger the debounced search\n } \n\n onSearchTermChange(term: string) {\n this.searchTerm = term;\n this.searchSubject.next(term); // Emit the new search term\n }\n\n public onSelectionChange(event: any) {\n // Emit the selected record\n this.OnRecordSelected.emit(event.selectedRows[0].dataItem);\n }\n\n // Stub function for simulating a database search (replace with actual search logic)\n protected async doSearch(searchTerm: string): Promise<BaseEntity[]> {\n const rv = new RunView();\n const result = await rv.RunView({\n EntityName: this.EntityName, \n UserSearchString: searchTerm, \n ResultType: 'entity_object'\n });\n if (result && result.Success) {\n return result.Results;\n this.searchHasRun = true;\n }\n else {\n const errorMessage = `Error searching for ${this.EntityName}: ${result.ErrorMessage}`;\n LogError(errorMessage);\n throw new Error(errorMessage);\n }\n } \n}\n","<div>\n <kendo-textbox\n class=\"find-textbox\"\n type=\"text\"\n placeholder=\"Start typing to search...\"\n [(ngModel)]=\"searchTerm\"\n (ngModelChange)=\"onSearchTermChange($event)\"\n >\n </kendo-textbox>\n <button class=\"find-button\" kendoButton (click)=\"onFind()\">Find</button>\n\n @if (loading) {\n <div>Searching...</div>\n }\n @if (!loading && records.length > 0) {\n <div>\n <kendo-grid\n [data]=\"records\"\n [height]=\"280\"\n [selectable]=\"{ mode: 'single' }\"\n (selectionChange)=\"onSelectionChange($event)\"\n >\n @for (field of DisplayFields; track field) {\n <kendo-grid-column [field]=\"field.Name\" [title]=\"field.DisplayNameOrName\"></kendo-grid-column>\n }\n </kendo-grid>\n </div>\n }\n @if (!loading && records.length === 0 && searchHasRun) {\n <div>No records found.</div>\n }\n</div>\n"]}
1
+ {"version":3,"file":"find-record.component.js","sourceRoot":"","sources":["../../src/lib/find-record.component.ts","../../src/lib/find-record.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAG,YAAY,EAAG,KAAK,EAAqB,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5F,OAAO,EAA2C,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC5G,OAAO,EAAE,OAAO,EAAgB,MAAM,MAAM,CAAC;A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component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core';\nimport { BaseEntity, EntityFieldInfo, EntityInfo, LogError, Metadata, RunView } from '@memberjunction/core';\nimport { Subject, Subscription } from 'rxjs';\nimport { debounceTime, distinctUntilChanged, switchMap } from 'rxjs/operators';\nimport {\n ColDef,\n GridReadyEvent,\n GridApi,\n ModuleRegistry,\n AllCommunityModule,\n RowSelectionOptions,\n SelectionChangedEvent,\n themeAlpine,\n colorSchemeVariable,\n type Theme\n} from 'ag-grid-community';\n\n// Register AG Grid modules\nModuleRegistry.registerModules([AllCommunityModule]);\n \n@Component({\n standalone: false,\n selector: 'mj-find-record',\n templateUrl: './find-record.component.html',\n styleUrls: ['./find-record.component.css']\n})\nexport class FindRecordComponent implements OnInit, OnDestroy {\n /**\n * The name of the entity to show records for.\n */\n @Input() EntityName: string = '';\n\n /**\n * Optional, list of fields to be displayed in the grid of search results, if not specified, the default fields will be displayed\n */\n @Input() public DisplayFields: EntityFieldInfo[] = []; // Fields to display in the grid\n\n /**\n * Optional, the number of milliseconds to wait after the last keypress before triggering a search. Default is 300ms\n */\n @Input() public SearchDebounceTime: number = 300; // Debounce time for search\n\n\n /**\n * When a record is selected, this event is emitted with the selected record\n */\n @Output() OnRecordSelected = new EventEmitter<BaseEntity>();\n\n public searchTerm: string = ''; // User search term\n public records: BaseEntity[] = []; // Store search results\n\n public loading = false; // Loading state for search\n public searchHasRun: boolean = false; // has a search been run\n private entityInfo: EntityInfo | undefined; // Entity metadata\n\n private searchSubject = new Subject<string>(); // Subject to emit search term changes\n private searchSubscription: Subscription | undefined;\n\n // AG Grid configuration\n public ColumnDefs: ColDef[] = [];\n public DefaultColDef: ColDef = {\n sortable: true,\n resizable: true,\n filter: false\n };\n public RowSelectionConfig: RowSelectionOptions = {\n mode: 'singleRow',\n checkboxes: false,\n enableClickSelection: true\n };\n public GridTheme: Theme = themeAlpine.withPart(colorSchemeVariable);\n private gridApi: GridApi | null = null;\n\n \n ngOnInit() {\n // Fetch the entity metadata based on EntityName\n const md = new Metadata();\n this.entityInfo = md.EntityByName(this.EntityName);\n if (!this.entityInfo) {\n LogError(`Entity ${this.EntityName} not found`);\n return;\n }\n\n // Set display fields (you can adjust the logic based on your entity structure)\n if (this.DisplayFields.length === 0) {\n this.DisplayFields = this.entityInfo.Fields.filter(\n (field: EntityFieldInfo) => field.DefaultInView || field.IsPrimaryKey || field.IsNameField || field.IncludeInUserSearchAPI\n );\n }\n\n // Build AG Grid column definitions from display fields\n this.ColumnDefs = this.buildColumnDefs();\n\n // Subscribe to the searchSubject with debounce\n this.searchSubscription = this.searchSubject.pipe(\n debounceTime(this.SearchDebounceTime), // Delay search execution by 300ms\n distinctUntilChanged(), // Only proceed if the search term has changed\n switchMap(term => {\n this.loading = true;\n return this.doSearch(term);\n })\n ).subscribe({\n next: (results: BaseEntity[]) => {\n this.records = results;\n this.loading = false;\n this.searchHasRun = true;\n },\n error: (error) => {\n LogError(error.message);\n this.loading = false;\n this.searchHasRun = true;\n }\n }); \n }\n\n ngOnDestroy() {\n // Cleanup the subscription\n if (this.searchSubscription) {\n this.searchSubscription.unsubscribe();\n }\n }\n\n\n onFind() {\n this.searchSubject.next(this.searchTerm); // Trigger the debounced search\n } \n\n onSearchTermChange(term: string) {\n this.searchTerm = term;\n this.searchSubject.next(term); // Emit the new search term\n }\n\n public onSelectionChange(event: SelectionChangedEvent) {\n const selectedRows = event.api.getSelectedRows();\n if (selectedRows.length > 0) {\n this.OnRecordSelected.emit(selectedRows[0]);\n }\n }\n\n public onGridReady(event: GridReadyEvent) {\n this.gridApi = event.api;\n }\n\n private buildColumnDefs(): ColDef[] {\n return this.DisplayFields.map((field: EntityFieldInfo) => ({\n field: field.Name,\n headerName: field.DisplayNameOrName\n }));\n }\n\n // Stub function for simulating a database search (replace with actual search logic)\n protected async doSearch(searchTerm: string): Promise<BaseEntity[]> {\n const rv = new RunView();\n const result = await rv.RunView({\n EntityName: this.EntityName, \n UserSearchString: searchTerm, \n ResultType: 'entity_object'\n });\n if (result && result.Success) {\n return result.Results;\n this.searchHasRun = true;\n }\n else {\n const errorMessage = `Error searching for ${this.EntityName}: ${result.ErrorMessage}`;\n LogError(errorMessage);\n throw new Error(errorMessage);\n }\n } \n}\n","<div>\n <input\n type=\"text\"\n class=\"mj-input find-textbox\"\n placeholder=\"Start typing to search...\"\n [(ngModel)]=\"searchTerm\"\n (ngModelChange)=\"onSearchTermChange($event)\" />\n <button mjButton variant=\"primary\" class=\"find-button\" (click)=\"onFind()\">Find</button>\n\n @if (loading) {\n <div>Searching...</div>\n }\n @if (!loading && records.length > 0) {\n <div class=\"find-grid-wrapper\">\n <ag-grid-angular\n class=\"find-grid\"\n [theme]=\"GridTheme\"\n [rowData]=\"records\"\n [columnDefs]=\"ColumnDefs\"\n [defaultColDef]=\"DefaultColDef\"\n [rowSelection]=\"RowSelectionConfig\"\n (selectionChanged)=\"onSelectionChange($event)\"\n (gridReady)=\"onGridReady($event)\">\n </ag-grid-angular>\n </div>\n }\n @if (!loading && records.length === 0 && searchHasRun) {\n <div>No records found.</div>\n }\n</div>\n"]}
package/dist/module.d.ts CHANGED
@@ -2,16 +2,13 @@ import * as i0 from "@angular/core";
2
2
  import * as i1 from "./lib/find-record.component";
3
3
  import * as i2 from "./lib/dialog.component";
4
4
  import * as i3 from "@angular/common";
5
- import * as i4 from "@progress/kendo-angular-dialog";
6
- import * as i5 from "@angular/forms";
7
- import * as i6 from "@progress/kendo-angular-grid";
8
- import * as i7 from "@memberjunction/ng-container-directives";
9
- import * as i8 from "@progress/kendo-angular-buttons";
10
- import * as i9 from "@progress/kendo-angular-listbox";
11
- import * as i10 from "@progress/kendo-angular-inputs";
5
+ import * as i4 from "@angular/forms";
6
+ import * as i5 from "ag-grid-angular";
7
+ import * as i6 from "@memberjunction/ng-container-directives";
8
+ import * as i7 from "@memberjunction/ng-ui-components";
12
9
  export declare class FindRecordModule {
13
10
  static ɵfac: i0.ɵɵFactoryDeclaration<FindRecordModule, never>;
14
- static ɵmod: i0.ɵɵNgModuleDeclaration<FindRecordModule, [typeof i1.FindRecordComponent, typeof i2.FindRecordDialogComponent], [typeof i3.CommonModule, typeof i4.DialogsModule, typeof i5.FormsModule, typeof i6.GridModule, typeof i7.ContainerDirectivesModule, typeof i8.ButtonsModule, typeof i9.ListBoxModule, typeof i10.InputsModule], [typeof i1.FindRecordComponent, typeof i2.FindRecordDialogComponent]>;
11
+ static ɵmod: i0.ɵɵNgModuleDeclaration<FindRecordModule, [typeof i1.FindRecordComponent, typeof i2.FindRecordDialogComponent], [typeof i3.CommonModule, typeof i4.FormsModule, typeof i5.AgGridModule, typeof i6.ContainerDirectivesModule, typeof i7.MJButtonDirective, typeof i7.MJDialogComponent, typeof i7.MJDialogActionsComponent], [typeof i1.FindRecordComponent, typeof i2.FindRecordDialogComponent]>;
15
12
  static ɵinj: i0.ɵɵInjectorDeclaration<FindRecordModule>;
16
13
  }
17
14
  //# sourceMappingURL=module.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":";;;;;;;;;;;AAeA,qBAoBa,gBAAgB;yCAAhB,gBAAgB;0CAAhB,gBAAgB;0CAAhB,gBAAgB;CAAI"}
1
+ {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":";;;;;;;;AAaA,qBAmBa,gBAAgB;yCAAhB,gBAAgB;0CAAhB,gBAAgB;0CAAhB,gBAAgB;CAAI"}
package/dist/module.js CHANGED
@@ -1,27 +1,22 @@
1
1
  import { NgModule } from '@angular/core';
2
2
  import { CommonModule } from '@angular/common';
3
- // Kendo UI Angular imports
4
- import { DialogsModule } from "@progress/kendo-angular-dialog";
5
- import { ButtonsModule } from '@progress/kendo-angular-buttons';
6
- import { ListBoxModule } from '@progress/kendo-angular-listbox';
7
- import { InputsModule } from '@progress/kendo-angular-inputs';
3
+ import { FormsModule } from '@angular/forms';
4
+ import { AgGridModule } from 'ag-grid-angular';
5
+ // MJ UI Components
6
+ import { MJButtonDirective, MJDialogComponent, MJDialogActionsComponent } from '@memberjunction/ng-ui-components';
8
7
  import { ContainerDirectivesModule } from '@memberjunction/ng-container-directives';
9
8
  import { FindRecordComponent } from './lib/find-record.component';
10
9
  import { FindRecordDialogComponent } from './lib/dialog.component';
11
- import { FormsModule } from '@angular/forms';
12
- import { GridModule } from '@progress/kendo-angular-grid';
13
10
  import * as i0 from "@angular/core";
14
11
  export class FindRecordModule {
15
12
  static ɵfac = function FindRecordModule_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || FindRecordModule)(); };
16
13
  static ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: FindRecordModule });
17
14
  static ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
18
- DialogsModule,
19
15
  FormsModule,
20
- GridModule,
16
+ AgGridModule,
21
17
  ContainerDirectivesModule,
22
- ButtonsModule,
23
- ListBoxModule,
24
- InputsModule] });
18
+ MJDialogComponent,
19
+ MJDialogActionsComponent] });
25
20
  }
26
21
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(FindRecordModule, [{
27
22
  type: NgModule,
@@ -32,13 +27,12 @@ export class FindRecordModule {
32
27
  ],
33
28
  imports: [
34
29
  CommonModule,
35
- DialogsModule,
36
30
  FormsModule,
37
- GridModule,
31
+ AgGridModule,
38
32
  ContainerDirectivesModule,
39
- ButtonsModule,
40
- ListBoxModule,
41
- InputsModule
33
+ MJButtonDirective,
34
+ MJDialogComponent,
35
+ MJDialogActionsComponent
42
36
  ],
43
37
  exports: [
44
38
  FindRecordComponent,
@@ -48,12 +42,11 @@ export class FindRecordModule {
48
42
  }], null, null); })();
49
43
  (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(FindRecordModule, { declarations: [FindRecordComponent,
50
44
  FindRecordDialogComponent], imports: [CommonModule,
51
- DialogsModule,
52
45
  FormsModule,
53
- GridModule,
46
+ AgGridModule,
54
47
  ContainerDirectivesModule,
55
- ButtonsModule,
56
- ListBoxModule,
57
- InputsModule], exports: [FindRecordComponent,
48
+ MJButtonDirective,
49
+ MJDialogComponent,
50
+ MJDialogActionsComponent], exports: [FindRecordComponent,
58
51
  FindRecordDialogComponent] }); })();
59
52
  //# sourceMappingURL=module.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"module.js","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,2BAA2B;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAE9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;;AAsB1D,MAAM,OAAO,gBAAgB;0GAAhB,gBAAgB;4DAAhB,gBAAgB;gEAdzB,YAAY;YACZ,aAAa;YACb,WAAW;YACX,UAAU;YACV,yBAAyB;YACzB,aAAa;YACb,aAAa;YACb,YAAY;;iFAOH,gBAAgB;cApB5B,QAAQ;eAAC;gBACR,YAAY,EAAE;oBACZ,mBAAmB;oBACnB,yBAAyB;iBAC1B;gBACD,OAAO,EAAE;oBACP,YAAY;oBACZ,aAAa;oBACb,WAAW;oBACX,UAAU;oBACV,yBAAyB;oBACzB,aAAa;oBACb,aAAa;oBACb,YAAY;iBACb;gBACD,OAAO,EAAE;oBACP,mBAAmB;oBACnB,yBAAyB;iBAC1B;aACF;;wFACY,gBAAgB,mBAlBzB,mBAAmB;QACnB,yBAAyB,aAGzB,YAAY;QACZ,aAAa;QACb,WAAW;QACX,UAAU;QACV,yBAAyB;QACzB,aAAa;QACb,aAAa;QACb,YAAY,aAGZ,mBAAmB;QACnB,yBAAyB","sourcesContent":["import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\n\n// Kendo UI Angular imports\nimport { DialogsModule } from \"@progress/kendo-angular-dialog\";\nimport { ButtonsModule } from '@progress/kendo-angular-buttons'; \nimport { ListBoxModule } from '@progress/kendo-angular-listbox';\nimport { InputsModule } from '@progress/kendo-angular-inputs';\n \nimport { ContainerDirectivesModule } from '@memberjunction/ng-container-directives';\nimport { FindRecordComponent } from './lib/find-record.component';\nimport { FindRecordDialogComponent } from './lib/dialog.component';\nimport { FormsModule } from '@angular/forms';\nimport { GridModule } from '@progress/kendo-angular-grid';\n\n@NgModule({\n declarations: [\n FindRecordComponent,\n FindRecordDialogComponent\n ],\n imports: [\n CommonModule,\n DialogsModule,\n FormsModule,\n GridModule,\n ContainerDirectivesModule,\n ButtonsModule,\n ListBoxModule,\n InputsModule\n ],\n exports: [\n FindRecordComponent,\n FindRecordDialogComponent\n ]\n})\nexport class FindRecordModule { }"]}
1
+ {"version":3,"file":"module.js","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,mBAAmB;AACnB,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAElH,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;;AAqBnE,MAAM,OAAO,gBAAgB;0GAAhB,gBAAgB;4DAAhB,gBAAgB;gEAbzB,YAAY;YACZ,WAAW;YACX,YAAY;YACZ,yBAAyB;YAEzB,iBAAiB;YACjB,wBAAwB;;iFAOf,gBAAgB;cAnB5B,QAAQ;eAAC;gBACR,YAAY,EAAE;oBACZ,mBAAmB;oBACnB,yBAAyB;iBAC1B;gBACD,OAAO,EAAE;oBACP,YAAY;oBACZ,WAAW;oBACX,YAAY;oBACZ,yBAAyB;oBACzB,iBAAiB;oBACjB,iBAAiB;oBACjB,wBAAwB;iBACzB;gBACD,OAAO,EAAE;oBACP,mBAAmB;oBACnB,yBAAyB;iBAC1B;aACF;;wFACY,gBAAgB,mBAjBzB,mBAAmB;QACnB,yBAAyB,aAGzB,YAAY;QACZ,WAAW;QACX,YAAY;QACZ,yBAAyB;QACzB,iBAAiB;QACjB,iBAAiB;QACjB,wBAAwB,aAGxB,mBAAmB;QACnB,yBAAyB","sourcesContent":["import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\n\nimport { AgGridModule } from 'ag-grid-angular';\n\n// MJ UI Components\nimport { MJButtonDirective, MJDialogComponent, MJDialogActionsComponent } from '@memberjunction/ng-ui-components';\n\nimport { ContainerDirectivesModule } from '@memberjunction/ng-container-directives';\nimport { FindRecordComponent } from './lib/find-record.component';\nimport { FindRecordDialogComponent } from './lib/dialog.component';\n\n@NgModule({\n declarations: [\n FindRecordComponent,\n FindRecordDialogComponent\n ],\n imports: [\n CommonModule,\n FormsModule,\n AgGridModule,\n ContainerDirectivesModule,\n MJButtonDirective,\n MJDialogComponent,\n MJDialogActionsComponent\n ],\n exports: [\n FindRecordComponent,\n FindRecordDialogComponent\n ]\n})\nexport class FindRecordModule { }\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memberjunction/ng-find-record",
3
- "version": "5.22.0",
3
+ "version": "5.23.0",
4
4
  "description": "MemberJunction: Angular Component to allow a user to find a single record in any entity",
5
5
  "main": "./dist/public-api.js",
6
6
  "typings": "./dist/public-api.d.ts",
@@ -25,18 +25,16 @@
25
25
  "@angular/core": "21.1.3",
26
26
  "@angular/forms": "21.1.3",
27
27
  "@angular/router": "21.1.3",
28
- "@progress/kendo-angular-grid": "22.0.1",
29
- "@progress/kendo-angular-buttons": "22.0.1",
30
- "@progress/kendo-angular-inputs": "22.0.1",
31
- "@progress/kendo-angular-dialog": "22.0.1",
32
- "@progress/kendo-angular-listbox": "22.0.1"
28
+ "ag-grid-angular": "^35.0.1",
29
+ "ag-grid-community": "^35.0.1"
33
30
  },
34
31
  "dependencies": {
35
- "@memberjunction/core-entities": "5.22.0",
36
- "@memberjunction/global": "5.22.0",
37
- "@memberjunction/core": "5.22.0",
38
- "@memberjunction/ng-container-directives": "5.22.0",
39
- "@memberjunction/ng-shared": "5.22.0",
32
+ "@memberjunction/core": "5.23.0",
33
+ "@memberjunction/core-entities": "5.23.0",
34
+ "@memberjunction/global": "5.23.0",
35
+ "@memberjunction/ng-container-directives": "5.23.0",
36
+ "@memberjunction/ng-shared": "5.23.0",
37
+ "@memberjunction/ng-ui-components": "5.23.0",
40
38
  "rxjs": "^7.8.2",
41
39
  "tslib": "^2.8.1"
42
40
  },