forked from NationalBankBelgium/stark
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request NationalBankBelgium#1000 from SuperITMan/feature/i…
…mplement-generic-search feat(stark-ui): implement generic search component in generic-search module
- Loading branch information
Showing
52 changed files
with
2,799 additions
and
21 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export * from "./generic-search/components"; | ||
export * from "./generic-search/classes"; | ||
export * from "./generic-search/entities"; | ||
export * from "./generic-search/generic-search.module"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export * from "./classes/abstract-form-component"; | ||
export * from "./classes/abstract-search-component"; | ||
export * from "./classes/generic-search.service.intf"; | ||
export * from "./classes/search-form-component.intf"; |
42 changes: 42 additions & 0 deletions
42
packages/stark-ui/src/modules/generic-search/classes/abstract-form-component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { StarkLoggingService } from "@nationalbankbelgium/stark-core"; | ||
|
||
/** | ||
* @ignore | ||
*/ | ||
const _cloneDeep: Function = require("lodash/cloneDeep"); | ||
|
||
/** | ||
* @ignore | ||
*/ | ||
const _isEqual: Function = require("lodash/isEqual"); | ||
|
||
export abstract class AbstractStarkFormComponent<CriteriaType> { | ||
public originalCopy: CriteriaType; | ||
public workingCopy: CriteriaType; | ||
|
||
protected constructor(public logger: StarkLoggingService) {} | ||
|
||
/** | ||
* Set the form's original copy to the object passed as parameter (a deep cloned copy). Default: empty object ({}) | ||
* @param originalCopy - The object to be set as the form's original copy | ||
*/ | ||
protected setOriginalCopy(originalCopy: CriteriaType = <any>{}): void { | ||
this.originalCopy = originalCopy; | ||
this.workingCopy = _cloneDeep(this.originalCopy); | ||
} | ||
|
||
/** | ||
* Revert the form's working copy back to the original copy (a deep clone copy) | ||
*/ | ||
protected reset(): void { | ||
this.workingCopy = _cloneDeep(this.originalCopy); | ||
} | ||
|
||
/** | ||
* Check whether the working copy is exactly the same as the original copy. | ||
* Performs a deep comparison between the two objects to determine if they are equivalent. | ||
*/ | ||
protected isDirty(): boolean { | ||
return !_isEqual(this.workingCopy, this.originalCopy); | ||
} | ||
} |
Oops, something went wrong.