mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
Move search-input-text from content-services to core (#8239)
* Move search-input-text from content-services to core * Move SearchConfigurationInterface into the content-services since is content related * Rename search-configuration.interface file to search-component.interface * Update import SearchConfigurationInterface from content-services * Decouple SearchComponentInterface from js-api * Decaplre NodeEntry instead using type any * Remove comment * Update component import to fix unit test * Import SearchTextModule into core
This commit is contained in:
@@ -15,9 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { QueryBody, NodePaging } from '@alfresco/js-api';
|
||||
import { Subject } from 'rxjs';
|
||||
import { ElementRef } from '@angular/core';
|
||||
import { QueryBody } from '@alfresco/js-api';
|
||||
|
||||
export interface SearchConfigurationInterface {
|
||||
|
||||
@@ -32,17 +30,3 @@ export interface SearchConfigurationInterface {
|
||||
generateQueryBody(searchTerm: string, maxResults: number, skipCount: number): QueryBody;
|
||||
|
||||
}
|
||||
|
||||
export interface SearchComponentInterface {
|
||||
|
||||
panel: ElementRef;
|
||||
showPanel: boolean;
|
||||
results: NodePaging;
|
||||
isOpen: boolean;
|
||||
keyPressedStream: Subject<string>;
|
||||
displayWith: ((value: any) => string) | null;
|
||||
|
||||
resetResults(): void;
|
||||
hidePanel(): void;
|
||||
setVisibility(): void;
|
||||
}
|
@@ -18,4 +18,5 @@
|
||||
export * from './services/favorites-api.service';
|
||||
export * from './services/card-view-content-update.service';
|
||||
export * from './services/sites.service';
|
||||
export * from './interface/search-configuration.interface';
|
||||
|
||||
export * from './interfaces/search-configuration.interface';
|
||||
|
@@ -18,7 +18,7 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule, ModuleWithProviders, APP_INITIALIZER } from '@angular/core';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { CoreModule, TRANSLATION_PROVIDER } from '@alfresco/adf-core';
|
||||
import { CoreModule, TRANSLATION_PROVIDER, SearchTextModule } from '@alfresco/adf-core';
|
||||
|
||||
import { MaterialModule } from './material.module';
|
||||
|
||||
@@ -47,7 +47,6 @@ import { VersionCompatibilityService } from './version-compatibility/version-com
|
||||
import { ContentPipeModule } from './pipes/content-pipe.module';
|
||||
import { NodeCommentsModule } from './node-comments/node-comments.module';
|
||||
import { TreeModule } from './tree/tree.module';
|
||||
import { SearchTextModule } from './search-text/search-text-input.module';
|
||||
import { AlfrescoViewerModule } from './viewer/alfresco-viewer.module';
|
||||
|
||||
@NgModule({
|
||||
|
@@ -16,8 +16,8 @@
|
||||
*/
|
||||
|
||||
import { QueryBody } from '@alfresco/js-api';
|
||||
import { SearchConfigurationInterface } from '../../../common/interface/search-configuration.interface';
|
||||
import { Injectable, Optional, Inject, InjectionToken } from '@angular/core';
|
||||
import { SearchConfigurationInterface } from '../../../common/interfaces/search-configuration.interface';
|
||||
|
||||
export const SEARCH_QUERY_TOKEN = new InjectionToken<QueryProvider>('Alfresco Search Query Token');
|
||||
export interface QueryProvider {
|
||||
|
@@ -20,6 +20,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import {
|
||||
AuthenticationService,
|
||||
SearchTextInputComponent,
|
||||
setupTestBed,
|
||||
UserPreferencesService
|
||||
} from '@alfresco/adf-core';
|
||||
@@ -29,7 +30,6 @@ import { SearchService } from '../services/search.service';
|
||||
import { of } from 'rxjs';
|
||||
import { ContentTestingModule } from '../../testing/content.testing.module';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { SearchTextInputComponent } from '../../search-text/search-text-input.component';
|
||||
|
||||
@Component({
|
||||
template: `
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { AuthenticationService, ThumbnailService } from '@alfresco/adf-core';
|
||||
import { AuthenticationService, ThumbnailService, SearchTextInputComponent } from '@alfresco/adf-core';
|
||||
import { Component, EventEmitter, Input, OnDestroy, Output,
|
||||
QueryList, ViewEncapsulation, ViewChild, ViewChildren, TemplateRef, ContentChild } from '@angular/core';
|
||||
import { NodeEntry } from '@alfresco/js-api';
|
||||
@@ -23,7 +23,6 @@ import { Subject } from 'rxjs';
|
||||
import { SearchComponent } from './search.component';
|
||||
import { MatListItem } from '@angular/material/list';
|
||||
import { EmptySearchResultComponent } from './empty-search-result.component';
|
||||
import { SearchTextInputComponent } from '../../search-text/search-text-input.component';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-search-control',
|
||||
|
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
import { SearchService } from '../services/search.service';
|
||||
import { SearchComponentInterface } from '../../common/interface/search-configuration.interface';
|
||||
import {
|
||||
AfterContentInit,
|
||||
Component,
|
||||
@@ -34,6 +33,7 @@ import {
|
||||
import { NodePaging, ResultSetPaging } from '@alfresco/js-api';
|
||||
import { Subject } from 'rxjs';
|
||||
import { debounceTime, takeUntil } from 'rxjs/operators';
|
||||
import { SearchComponentInterface } from '@alfresco/adf-core';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-search',
|
||||
|
@@ -20,7 +20,7 @@ import { NgModule } from '@angular/core';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { MaterialModule } from '../material.module';
|
||||
|
||||
import { CoreModule } from '@alfresco/adf-core';
|
||||
import { CoreModule, SearchTextModule } from '@alfresco/adf-core';
|
||||
|
||||
import { SearchControlComponent } from './components/search-control.component';
|
||||
import { SearchComponent } from './components/search.component';
|
||||
@@ -47,7 +47,6 @@ import { SearchFacetFieldComponent } from './components/search-facet-field/searc
|
||||
import { SearchWidgetChipComponent } from './components/search-filter-chips/search-widget-chip/search-widget-chip.component';
|
||||
import { SearchFacetChipComponent } from './components/search-filter-chips/search-facet-chip/search-facet-chip.component';
|
||||
import { ResetSearchDirective } from './components/reset-search.directive';
|
||||
import { SearchTextModule } from '../search-text/search-text-input.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@@ -17,7 +17,7 @@
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { QueryBody } from '@alfresco/js-api';
|
||||
import { SearchConfigurationInterface } from '../../common/interface/search-configuration.interface';
|
||||
import { SearchConfigurationInterface } from '../../common/interfaces/search-configuration.interface';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
@@ -43,7 +43,6 @@ export * from './lib/pipes/index';
|
||||
export * from './lib/common/index';
|
||||
export * from './lib/tree/index';
|
||||
export * from './lib/category/index';
|
||||
export * from './lib/search-text/index';
|
||||
export * from './lib/viewer/index';
|
||||
|
||||
export * from './lib/content.module';
|
||||
|
@@ -28,6 +28,8 @@ export * from './services/sort-by-category.service';
|
||||
|
||||
export * from './models/log-levels.model';
|
||||
|
||||
export * from './interface/search-component.interface';
|
||||
|
||||
export * from './mock/app-config.service.mock';
|
||||
|
||||
export * from './utils';
|
||||
|
@@ -0,0 +1,49 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2019 Alfresco Software, Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { ElementRef } from '@angular/core';
|
||||
import { Subject } from 'rxjs';
|
||||
|
||||
interface Node {
|
||||
id: string;
|
||||
}
|
||||
|
||||
interface NodeEntry {
|
||||
entry: Node;
|
||||
}
|
||||
|
||||
interface NodePagingList {
|
||||
entries?: NodeEntry[];
|
||||
}
|
||||
|
||||
interface NodePaging {
|
||||
list?: NodePagingList;
|
||||
}
|
||||
|
||||
export interface SearchComponentInterface {
|
||||
|
||||
panel: ElementRef;
|
||||
showPanel: boolean;
|
||||
results: NodePaging;
|
||||
isOpen: boolean;
|
||||
keyPressedStream: Subject<string>;
|
||||
displayWith: ((value: any) => string) | null;
|
||||
|
||||
resetResults(): void;
|
||||
hidePanel(): void;
|
||||
setVisibility(): void;
|
||||
}
|
@@ -56,6 +56,7 @@ import { TranslateLoaderService } from './translation/translate-loader.service';
|
||||
import { ExtensionsModule } from '@alfresco/adf-extensions';
|
||||
import { directionalityConfigFactory } from './common/services/directionality-config-factory';
|
||||
import { DirectionalityConfigService } from './common/services/directionality-config.service';
|
||||
import { SearchTextModule } from './search-text/search-text-input.module';
|
||||
import { AlfrescoJsClientsModule } from '@alfresco/adf-core/api';
|
||||
import { AuthenticationInterceptor, Authentication } from '@alfresco/adf-core/auth';
|
||||
import { LegacyApiClientModule } from './api-factories/legacy-api-client.module';
|
||||
@@ -96,6 +97,7 @@ import { MAT_SNACK_BAR_DEFAULT_OPTIONS } from '@angular/material/snack-bar';
|
||||
IconModule,
|
||||
SortingPickerModule,
|
||||
NotificationHistoryModule,
|
||||
SearchTextModule,
|
||||
BlankPageModule,
|
||||
LegacyApiClientModule,
|
||||
AlfrescoJsClientsModule,
|
||||
@@ -137,6 +139,7 @@ import { MAT_SNACK_BAR_DEFAULT_OPTIONS } from '@angular/material/snack-bar';
|
||||
SortingPickerModule,
|
||||
IconModule,
|
||||
NotificationHistoryModule,
|
||||
SearchTextModule,
|
||||
BlankPageModule,
|
||||
RichTextEditorModule
|
||||
]
|
||||
|
@@ -16,12 +16,14 @@
|
||||
*/
|
||||
|
||||
import { ComponentFixture, TestBed, discardPeriodicTasks, fakeAsync, tick } from '@angular/core/testing';
|
||||
import { CoreTestingModule, UserPreferencesService, setupTestBed } from '@alfresco/adf-core';
|
||||
import { CoreTestingModule } from '../testing/core.testing.module';
|
||||
import { SearchTextInputComponent } from './search-text-input.component';
|
||||
import { DebugElement } from '@angular/core';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { Subject } from 'rxjs';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { UserPreferencesService } from '../common/services/user-preferences.service';
|
||||
import { setupTestBed } from '../testing/setup-test-bed';
|
||||
|
||||
describe('SearchTextInputComponent', () => {
|
||||
|
@@ -20,7 +20,7 @@ import { Subject, Observable, Subscription } from 'rxjs';
|
||||
import { debounceTime, takeUntil, filter } from 'rxjs/operators';
|
||||
import { Direction } from '@angular/cdk/bidi';
|
||||
import { searchAnimation } from './animations';
|
||||
import { UserPreferencesService } from '@alfresco/adf-core';
|
||||
import { UserPreferencesService } from '../common/services/user-preferences.service';
|
||||
import { SearchTextStateEnum, SearchAnimationState, SearchAnimationDirection } from './models/search-text-input.model';
|
||||
|
||||
@Component({
|
@@ -33,7 +33,7 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
|
||||
import { DOCUMENT } from '@angular/common';
|
||||
import { Observable, Subject, Subscription, merge, of, fromEvent } from 'rxjs';
|
||||
import { filter, switchMap, takeUntil } from 'rxjs/operators';
|
||||
import { SearchComponentInterface } from '../common/interface/search-configuration.interface';
|
||||
import { SearchComponentInterface } from '../common/interface/search-component.interface';
|
||||
|
||||
export const SEARCH_AUTOCOMPLETE_VALUE_ACCESSOR: any = {
|
||||
provide: NG_VALUE_ACCESSOR,
|
@@ -43,6 +43,7 @@ export * from './lib/icon/index';
|
||||
export * from './lib/notifications/index';
|
||||
export * from './lib/blank-page/index';
|
||||
export * from './lib/rich-text-editor/index';
|
||||
export * from './lib/search-text/index';
|
||||
export * from './lib/snackbar-content/index';
|
||||
export * from './lib/translation/index';
|
||||
|
||||
|
Reference in New Issue
Block a user