File

src/lib/search/sz-search/sz-search-by-id.component.ts

Description

Provides a search box component that can search by id and/or record ids.

Example :
<!-- (WC javascript) SzSearchByIdComponent -->
<sz-wc-search-by-id
id="sz-search"
data-source="SAMPLE_PERSON"
record-id="1001"></sz-wc-search-by-id>
<script>
 document.getElementById('sz-search').addEventListener('resultChange', function(results) {
   console.log('results: ', results);
 });
</script>
Example :
<!-- (Angular) SzSearchByIdComponent -->
<sz-search-by-id
entityId="1004"
(resultChange)="myResultsHandler($event)"
(searchStart)="showSpinner()"
(searchEnd)="hideSpinner()"></sz-search-by-id>

Implements

OnInit OnDestroy

Metadata

Index

Properties
Methods
Inputs
Outputs
Accessors

Constructor

constructor(fb: UntypedFormBuilder, dataSourcesService: SzDataSourcesService, cd: ChangeDetectorRef, apiConfigService: SzConfigurationService, searchService: SzSearchService, breakpointObserver: BreakpointObserver)
Parameters :
Name Type Optional
fb UntypedFormBuilder No
dataSourcesService SzDataSourcesService No
cd ChangeDetectorRef No
apiConfigService SzConfigurationService No
searchService SzSearchService No
breakpointObserver BreakpointObserver No

Inputs

cancelButtonLabel
Type : string
Default value : "Clear Search Criteria"
cancelButtonLabelShort
Type : string
Default value : "Clear"
dataSource
Type : string

the currently selected datasource

disableClearButton
Type : any

disable the clear button. button is not clickable.

disableDataSourceOptions
Type : [] | string

disable a set of datasource options. format is "SOCIAL_NETWORK, DRIVERS_LICENSE_NUMBER" or array of strings

disableRecordId
Type : any

disable the "record id" field. input cannot be edited.

disableResetButton
Type : any

disable the reset button. button is not clickable.

disableSearchButton
Type : any

disable the search button. button is not clickable.

enforceModalSearch
Type : boolean
Default value : true
entityId
Type : string | number
forceLayout
Type : string | []

Takes a collection or a single value of layout enum css classnames to pass to all children components. this value overrides auto-responsive css adjustments.

Example :
getDataSourcesOnConfigChange
Type : boolean
Default value : true

whether or not to fetch new attributes from the api server when a configuration change is detected

hiddenDataSources
Type : {}
Default value : [ 'TEST', 'SEARCH' ]

array of datasources to hide in the pulldown.

hideClearButton
Type : any

hide the clear button

hideResetButton
Type : any

hide the reset button

hideSearchButton
Type : any

hide the search button

layoutBreakpoints
Type : {}
Default value : [ {cssClass: 'layout-wide', minWidth: 1021 }, {cssClass: 'layout-medium', minWidth: 700, maxWidth: 1120 }, {cssClass: 'layout-narrow', maxWidth: 699 } ]

the width to switch from wide to narrow layout

layoutClasses
Type : [] | string

css classes to apply to component

recordId
Type : string | number
searchButtonLabel
Type : string
Default value : "Search"

text that shows up in buttons

searchButtonLabelShort
Type : string
Default value : "Search"
searchValue
Type : SzSearchByIdFormParams

populate the search fields with an pre-existing set of search parameters.

showSearchLabel
Type : boolean
Default value : true

whether or not to show the search box label

updateDataSources
Type : () => void
Default value : (): void => { this.dataSourcesService.listDataSources('sz-search-by-id').subscribe((dataSrc: string[]) => { this._datasources = dataSrc; this.cd.markForCheck(); this.cd.detectChanges(); }, (err)=> { this.exception.next( err ); }); }

Pull in the list of data sources from the api server.

waitForConfigChange
Type : any

whether or not to show the wait for the the api conf to change before fetching resources like the identifiers list

Outputs

entityChange
Type : EventEmitter<SzEntityData>

event emmiter for when the _entity property has changed

exception
Type : EventEmitter<Error>

emitted when a search encounters an exception

parameterChange
Type : Subject<SzSearchByIdFormParams>

emmitted when parameters of the search have been changed.

resultChange
Type : EventEmitter<SzEntityRecord>

emmitted when the search results have been changed.

resultCleared
Type : EventEmitter<void>

emmitted when the results have been cleared.

searchEnd
Type : EventEmitter<number>

emitted when a search is done being performed.

searchException
Type : EventEmitter<Error>

emitted when a search encounters an exception

searchStart
Type : EventEmitter<SzSearchByIdFormParams>

emitted when a search is being performed.

Methods

Public clearSearch
clearSearch()

clear the search params and form inputs.

Returns : void
Public getAnyDisabled
getAnyDisabled(keys: string[])
Parameters :
Name Type Optional
keys string[] No
Returns : string
getCssQueryFromCriteria
getCssQueryFromCriteria(minWidth?: number, maxWidth?: number)

get the responsive breakpoint string from min and max width

Parameters :
Name Type Optional
minWidth number Yes
maxWidth number Yes
Returns : string | undefined
Public getDisabled
getDisabled(key: string)
Parameters :
Name Type Optional
key string No
Returns : string
Public getSearchParams
getSearchParams()

get the current search params from input values

Returns : SzSearchByIdFormParams
ngOnDestroy
ngOnDestroy()

unsubscribe when component is destroyed

Returns : void
Public onKeyEnter
onKeyEnter()

submits search form on enter press if the submit button is currently hidden

Returns : void
Public submitSearch
submitSearch()

submit current search params to search service. when search service returns a result it publishes the result through the resultChange event emitter, and any parameter changes through the paramsChange emmitter.

Returns : void

Properties

Public _datasources
Type : string[]
Default value : []

the datasources available to user

Public breakpointObserver
Type : BreakpointObserver
Public unsubscribe$
Default value : new Subject<void>()

subscription to notify subscribers to unbind

Accessors

hideSearchButton
sethideSearchButton(value: any)

hide the search button

Parameters :
Name Type Optional
value any No
Returns : void
hideResetButton
sethideResetButton(value: any)

hide the reset button

Parameters :
Name Type Optional
value any No
Returns : void
hideClearButton
sethideClearButton(value: any)

hide the clear button

Parameters :
Name Type Optional
value any No
Returns : void
disableSearchButton
setdisableSearchButton(value: any)

disable the search button. button is not clickable.

Parameters :
Name Type Optional
value any No
Returns : void
disableResetButton
setdisableResetButton(value: any)

disable the reset button. button is not clickable.

Parameters :
Name Type Optional
value any No
Returns : void
disableClearButton
setdisableClearButton(value: any)

disable the clear button. button is not clickable.

Parameters :
Name Type Optional
value any No
Returns : void
disableRecordId
setdisableRecordId(value: any)

disable the "record id" field. input cannot be edited.

Parameters :
Name Type Optional
value any No
Returns : void
disableDataSourceOptions
setdisableDataSourceOptions(options: string[] | string)

disable a set of datasource options. format is "SOCIAL_NETWORK, DRIVERS_LICENSE_NUMBER" or array of strings

Parameters :
Name Type Optional
options string[] | string No
Returns : void
forceLayout
setforceLayout(value: string | string[])

Takes a collection or a single value of layout enum css classnames to pass to all children components. this value overrides auto-responsive css adjustments.

Example :
Parameters :
Name Type Optional
value string | string[] No
Example :
forceLayout=&quot;layout-narrow&quot;
Returns : void
layoutClasses
getlayoutClasses()

css classes to apply to component

setlayoutClasses(value: string[] | string)

css classes to apply to component

Parameters :
Name Type Optional
value string[] | string No
Returns : void
dataSource
setdataSource(value: string)

the currently selected datasource

Parameters :
Name Type Optional
value string No
Returns : void
recordId
setrecordId(value: string | number)
Parameters :
Name Type Optional
value string | number No
Returns : void
entityId
setentityId(value: string | number)
Parameters :
Name Type Optional
value string | number No
Returns : void
waitForConfigChange
getwaitForConfigChange()

whether or not to show the wait for the the api conf to change before fetching resources like the identifiers list

Returns : boolean | any
setwaitForConfigChange(value: any)

whether or not to show the wait for the the api conf to change before fetching resources like the identifiers list

Parameters :
Name Type Optional
value any No
Returns : void

  <!-- @senzing/sdk/search/sz-search-by-id -->
  <!--
    NAME_FULL
    DATE_OF_BIRTH
    IDENTIFIER
    IDENTIFIER_TYPE
    ADDR_FULL
    PHONE_NUMBER
    EMAIL_ADDRESS
  -->
  <div class="content" *ngIf="true"
  [ngClass]="_layoutClasses"
  >
      <section class="entity search" (ngSubmit)="submitSearch()">
        <form class="form" [formGroup]="entitySearchForm" novalidate>
          <div class="sz-row">
              <div class="field datasource">
                  <label for="entity-datasource">Get by Record ID</label>
                  <select formControlName="dataSource"
                  class="datasource-dropdown"
                  id="datasource-name"
                  name="datasource-name">
                    <option [ngValue]="null" disabled [selected]="true">Data Source Name</option>
                    <option *ngFor="let dsName of filteredDataSources"
                            [value]="dsName">{{ dsName }}
                    </option>
                  </select>
              </div>
              <div class="field recordid" [class.disabled]="disabledFields['recordId']" *ngIf="!hiddenFields['recordId']">
                <input formControlName="recordId"
                        class="search-input"
                        id="record-id"
                        type="text"
                        [attr.disabled]="getDisabled('recordId')"
                        (keyup.enter)="onKeyEnter()"
                        placeholder="Record ID">
              </div>
              <div class="action-button__wrapper hide-on-narrow" [class.disabled]="disabledFields['searchButton']" *ngIf="!hiddenFields['searchButton']">
                <button mat-button class="button__search-go"
                [attr.disabled]="getDisabled('searchButton')"
                (click)="submitSearch()">{{searchButtonLabel}}</button>
              </div>
          </div>
          <div class="sz-row">
            <div class="field entityid">
              <label for="entity-id">Get by Entity ID</label>
              <input formControlName="entityId"
                      class="search-input"
                      id="entity-id"
                      type="text"
                      [attr.disabled]="getDisabled('entityId')"
                      (keyup.enter)="onKeyEnter()"
                      placeholder="Entity ID">
            </div>
            <div class="action-button__wrapper hide-on-narrow" [class.disabled]="disabledFields['resetButton']" *ngIf="!hiddenFields['resetButton']">
              <button mat-button class="button__search-clear"
              [attr.disabled]="getDisabled('resetButton')"
              (click)="clearSearch()">{{cancelButtonLabel}}</button>
            </div>
          </div>
          <div class="sz-row bottom">
            <div class="action-button__wrapper hide-on-medium hide-on-wide" [class.disabled]="disabledFields['resetButton']" *ngIf="!hiddenFields['resetButton']">
              <button mat-button class="button__search-clear"
              [attr.disabled]="getDisabled('resetButton')"
              (click)="clearSearch()">{{cancelButtonLabelShort}}</button>
            </div>
            <div class="action-button__wrapper hide-on-medium hide-on-wide" [class.disabled]="disabledFields['searchButton']" *ngIf="!hiddenFields['searchButton']">
              <button mat-button class="button__search-go"
              [attr.disabled]="getDisabled('searchButton')"
              (click)="submitSearch()">{{searchButtonLabelShort}}</button>
            </div>
          </div>
        </form>
      </section>

    </div>

./sz-search-by-id.component.scss

@use "../../scss/colors";

:host {
  display: flex;
  align-items: stretch;
  padding: 0;
  overflow: hidden;

  font-family: var(--sz-font-family);
  color: var(--sz-font-color);
  font-size: var(--sz-font-size);

  textarea {
    width: 1000px;
    height: 400px;
  }

  .label-title {
    text-transform: uppercase;
  }

  .layout-narrow {
    .hide-on-narrow {
      display: none;
    }

    /* actions buttons are in different spot in narrow layout*/
    .action-button__wrapper {
      width: auto;
      min-width: unset;
      margin: 0 1em 0 0;
    }
    .sz-row {
      flex-wrap: wrap;

      &.bottom {
        justify-content: flex-end;
        flex-flow: row;
      }
    }
    .field.identifier, .field.email {
      width: unset;
    }
    .field.email { flex-grow: 2; padding-right: 0; margin-right: 10px; }
  }
  .layout-medium {
    .hide-on-medium {
      display: none;
    }
  }
  .layout-wide {
    .hide-on-wide {
      display: none;
    }
  }

  .main-card__label {
    min-height: 150px;
    width: 200px;
    min-width: 200px;
    text-transform: uppercase;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    color: colors.$white;
    &.search {
      background-color: colors.$green;
    }
    &.insights {
      background-color: colors.$orange;
    }
    &.suggestions {
      background-color: colors.$brown;
    }
    &.data {
      background-color: colors.$dark2;
    }
    &.health {
      background-color: colors.$dark-blue;
    }
  }

  .action-button__wrapper {
    display: flex;
    justify-content: center;
    text-align: center;
    width: 203px;
    //max-width: 145px;
    min-width: 145px;
    margin-right: 10px;

    &.disabled {
      button.button__search-go {
        border-color: var(--sz-search-button-disabled-border-color);
        background-color: var(--sz-search-button-disabled-background-color);
        color: var(--sz-search-button-disabled-color);
      }
      button.button__search-clear {
        border-color: var(--sz-clear-button-disabled-border-color);
        background-color: var(--sz-clear-button-disabled-background-color);
        color: var(--sz-search-clear-button-disabled-color);
      }
    }

    button {
      border: var(--sz-search-button-border);
      border-radius: var(--sz-search-button-border-radius);
      padding: var(--sz-search-button-padding);
      margin: var(--sz-search-button-margin);
      height: 40px;

      &.button__search-go {
        background-color: var(--sz-search-button-submit-background-color);
        color: var(--sz-search-button-submit-color);
        border: var(--sz-search-button-submit-border);
        white-space: nowrap;
        padding: var(--sz-search-button-submit-padding);
        font-size: var(--sz-search-button-submit-font-size);
        font-weight: var(--sz-search-button-submit-font-weight);
      }
      &.button__search-clear {
        background-color: var(--sz-search-button-clear-background-color);
        color: var(--sz-search-button-clear-color);
        white-space: nowrap;
        padding: var(--sz-search-button-clear-padding);
        font-size: var(--sz-search-button-clear-font-size);
        font-weight: var(--sz-search-button-clear-font-weight);
      }
    }
  }
  .content {
    align-items: center;
    display: flex;
    padding: 0px;
    width: 100%;
  }

  select {
    padding: var(--sz-search-input-padding);
    margin: var(--sz-search-input-margin);
    border: var(--sz-search-input-border);
    border-radius: var(--sz-search-input-border-radius);
    background-color: var(--sz-search-input-background-color);
  }

  input {
    //margin: 0 20px;
    width: calc( 100% - 10px);
    font-size: var(--sz-search-input-font-size);
    color: var(--sz-search-input-color);
    background-color: var(--sz-search-input-background-color);
    line-height: 1.5;
    height: 30px;
    padding: var(--sz-search-input-padding);
    margin: var(--sz-search-input-margin);
    border: var(--sz-search-input-border);
    border-radius: var(--sz-search-input-border-radius);
    box-sizing: unset;

    &:hover, &:focus {
      /* box-shadow: inset 0 -2px #ccc; */
      border: var(--sz-search-input-hover-border);
      border-color: var(colors.$input-active-border-color);
      outline: none;
    }
    &::placeholder {
      color: var(colors.$input-placeholder-color);
      margin-left: 2em;
      transition: opacity 100ms linear;
    }
    &:focus::placeholder {
      opacity: .4;
    }
    &:disabled {
      pointer-events: var(--sz-disabled-input-pointer-events);
      cursor: var(--sz-disabled-input-cursor);
    }
  }

  i.label_icon {
    font-size: 5em;
    position: absolute;
    opacity: 0.1;
    z-index: 2;
  }
  .entity.search {
    width: 100%;
  }
  .sz-row {
    display: flex;
    padding: 10px 0 0 0;
    align-items: flex-end;
    justify-content: flex-start;

    &.bottom {
      padding-bottom: 20px;
    }
  }
  .field {
    display: inline-block;
    flex-direction: column;
    padding-right: 20px;

    &.hidden {
      display: none;
    }

    &.disabled {
      color: var(--sz-disabled-label-color);
      label {
        color: var(--sz-disabled-label-color);
      }
      input, select {
        border-color: var(--sz-disabled-input-border-color);
        color: var(--sz-disabled-input-color);
        background-color: var(--sz-disabled-input-background-color);
      }
      input::placeholder, select::placeholder {
        color: var(--sz-disabled-input-color);
      }
    }

    label {
      white-space: nowrap;
      display: var(--sz-search-label-display);
      color: var(--sz-search-label-color);
      padding: var(--sz-search-label-padding);
      margin: var(--sz-search-label-margin);
      font-size: var(--sz-search-label-font-size);
    }
    &.entityid, &.datasource {
      width: 15%;
      flex-grow: 3;
      min-width: 35%;
    }
    &.entityid {
      flex-grow: 1;
      min-width: 50%;
      width: 50%;
      input {
        width: 50%;
      }
    }
    &.recordid {
      width: 32%
    }

    .search-input {
      /*width: 100%*/
    }

    .datasource-dropdown {
      height: 40px;
      width: 100%;
    }
    ::-webkit-input-placeholder {
      font-size: 13px;
    }

  }
}

results matching ""

    No results matching ""