ACS-8395: remove old and unused search picker components (#11573)

This commit is contained in:
Denys Vuika
2026-01-23 14:52:02 +00:00
committed by GitHub
parent a3c309c676
commit e78da9dea0
20 changed files with 0 additions and 576 deletions
@@ -34,7 +34,6 @@ export * from './search-panel';
export * from './search-properties';
export * from './search-radio';
export * from './search-slider';
export * from './search-sorting-picker';
export * from './search-text';
export * from './search-widget-container';
@@ -1,18 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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.
*/
export * from './search-sorting-picker.component';
@@ -1,6 +0,0 @@
<adf-sorting-picker
[options]="options"
[selected]="value"
[ascending]="ascending"
(valueChange)="onValueChanged($event)"
(sortingChange)="onSortingChanged($event)" />
@@ -1,5 +0,0 @@
.adf-search-sorting-picker {
.adf-sorting-picker-button {
color: var(--adf-theme-foreground-text-color-064);
}
}
@@ -1,96 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { SearchSortingPickerComponent } from './search-sorting-picker.component';
import { SearchQueryBuilderService } from '../../services/search-query-builder.service';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { SearchConfiguration } from '../../models';
import { BaseQueryBuilderService } from '../../services/base-query-builder.service';
describe('SearchSortingPickerComponent', () => {
let fixture: ComponentFixture<SearchSortingPickerComponent>;
let component: SearchSortingPickerComponent;
const config: SearchConfiguration = {
sorting: {
options: [
{ key: 'name', label: 'Name', type: 'FIELD', field: 'cm:name', ascending: true },
{ key: 'content.sizeInBytes', label: 'Size', type: 'FIELD', field: 'content.size', ascending: true },
{ key: 'description', label: 'Description', type: 'FIELD', field: 'cm:description', ascending: true }
],
defaults: [{ key: 'name', type: 'FIELD', field: 'cm:name', ascending: false } as any]
},
categories: [{ id: 'cat1', enabled: true } as any]
};
const queryBuilder: Partial<BaseQueryBuilderService> = {
getSortingOptions: () => config.sorting.options,
getPrimarySorting: () => config.sorting.defaults[0],
sorting: config.sorting.options,
update: jasmine.createSpy('update')
};
beforeEach(() => {
TestBed.configureTestingModule({
imports: [],
providers: [
{
provide: SearchQueryBuilderService,
useValue: queryBuilder
}
]
});
fixture = TestBed.createComponent(SearchSortingPickerComponent);
component = fixture.componentInstance;
});
it('should load options from query builder', () => {
component.ngOnInit();
expect(component.options.length).toBe(3);
expect(component.options[0].key).toEqual('name');
expect(component.options[1].key).toEqual('content.sizeInBytes');
expect(component.options[2].key).toEqual('description');
});
it('should pre-select the primary sorting definition', () => {
component.ngOnInit();
expect(component.value).toEqual('name');
expect(component.ascending).toBe(false);
});
it('should update query builder each time selection is changed', () => {
component.ngOnInit();
component.onValueChanged('description');
expect(queryBuilder.update).toHaveBeenCalled();
expect(queryBuilder.sorting.length).toBe(1);
expect(queryBuilder.sorting[0].key).toEqual('description');
expect(queryBuilder.sorting[0].ascending).toBeTruthy();
});
it('should update query builder each time sorting is changed', () => {
component.ngOnInit();
component.onSortingChanged(false);
expect(queryBuilder.update).toHaveBeenCalled();
expect(queryBuilder.sorting.length).toBe(1);
expect(queryBuilder.sorting[0].key).toEqual('name');
expect(queryBuilder.sorting[0].ascending).toBeFalsy();
});
});
@@ -1,88 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { SearchQueryBuilderService } from '../../services/search-query-builder.service';
import { SearchSortingDefinition } from '../../models/search-sorting-definition.interface';
import { CommonModule } from '@angular/common';
import { SortingPickerComponent } from '@alfresco/adf-core';
@Component({
selector: 'adf-search-sorting-picker',
imports: [CommonModule, SortingPickerComponent],
templateUrl: './search-sorting-picker.component.html',
styleUrls: ['./search-sorting-picker.component.scss'],
encapsulation: ViewEncapsulation.None,
host: { class: 'adf-search-sorting-picker' }
})
export class SearchSortingPickerComponent implements OnInit {
options: SearchSortingDefinition[] = [];
value: string;
ascending: boolean;
constructor(private queryBuilder: SearchQueryBuilderService) {}
ngOnInit() {
this.options = this.queryBuilder.getSortingOptions();
const primary = this.queryBuilder.getPrimarySorting();
if (primary) {
this.value = primary.key;
this.ascending = primary.ascending;
}
}
onValueChanged(key: string) {
this.value = key;
this.ascending = this.getSortingOrder();
this.applySorting();
}
onSortingChanged(ascending: boolean) {
this.ascending = ascending;
this.applySorting();
}
private findOptionByKey(key: string): SearchSortingDefinition {
if (key) {
return this.options.find((opt) => opt.key === key);
}
return null;
}
private applySorting() {
const option = this.findOptionByKey(this.value);
if (option) {
this.queryBuilder.sorting = [
{
...option,
ascending: this.ascending
}
];
this.queryBuilder.update();
}
}
private getSortingOrder(): boolean {
const option = this.findOptionByKey(this.value);
if (option) {
return option.ascending;
}
return this.queryBuilder.getPrimarySorting().ascending;
}
}
@@ -31,7 +31,6 @@ import { SearchSliderComponent } from './components/search-slider/search-slider.
import { SearchNumberRangeComponent } from './components/search-number-range/search-number-range.component';
import { SearchPanelComponent } from './components/search-panel/search-panel.component';
import { SearchCheckListComponent } from './components/search-check-list/search-check-list.component';
import { SearchSortingPickerComponent } from './components/search-sorting-picker/search-sorting-picker.component';
import { SearchFilterContainerComponent } from './components/search-filter-container/search-filter-container.component';
import { SearchDatetimeRangeComponent } from './components/search-datetime-range/search-datetime-range.component';
import { SearchFormComponent } from './components/search-form/search-form.component';
@@ -70,7 +69,6 @@ export const CONTENT_SEARCH_DIRECTIVES = [
SearchFilterTabbedComponent,
SearchFilterTabDirective,
SearchDateRangeTabbedComponent,
SearchSortingPickerComponent,
SearchSliderComponent,
SearchNumberRangeComponent,
SearchPanelComponent,
-3
View File
@@ -41,7 +41,6 @@ import { SEARCH_TEXT_INPUT_DIRECTIVES } from './search-text/search-text-input.mo
import { HttpClient } from '@angular/common/http';
import { AppConfigPipe } from './app-config';
import { IconComponent } from './icon';
import { SortingPickerComponent } from './sorting-picker';
import { DynamicChipListComponent } from './dynamic-chip-list';
import { IdentityUserInfoComponent } from './identity-user-info';
import { UnsavedChangesDialogComponent } from './dialogs';
@@ -82,7 +81,6 @@ import { provideAppConfig } from './app-config/provide-app-config';
...DATATABLE_DIRECTIVES,
...TEMPLATE_DIRECTIVES,
IconComponent,
SortingPickerComponent,
...NOTIFICATION_HISTORY_DIRECTIVES,
...SEARCH_TEXT_INPUT_DIRECTIVES,
UnsavedChangesDialogComponent,
@@ -111,7 +109,6 @@ import { provideAppConfig } from './app-config/provide-app-config';
...INFO_DRAWER_DIRECTIVES,
...DATATABLE_DIRECTIVES,
...TEMPLATE_DIRECTIVES,
SortingPickerComponent,
IconComponent,
...NOTIFICATION_HISTORY_DIRECTIVES,
...SEARCH_TEXT_INPUT_DIRECTIVES,
-18
View File
@@ -1,18 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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.
*/
export * from './public-api';
@@ -1,18 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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.
*/
export * from './sorting-picker.component';
@@ -1,13 +0,0 @@
<mat-form-field floatLabel="always">
<mat-label>{{'CORE.SEARCH.SORT_BY' | translate}}</mat-label>
<mat-select [(value)]="selected" (selectionChange)="onOptionChanged($event)">
<mat-option *ngFor="let option of options" [value]="option.key">
{{ option.label | translate }}
</mat-option>
</mat-select>
</mat-form-field>
<button *ngIf="selected" class="adf-sorting-picker-button" mat-icon-button (click)="toggleSortDirection()" aria-label="'CORE.SEARCH.TOGGLE_ASC_DESC_ORDER' | translate">
<mat-icon *ngIf="ascending" adf-icon="arrow_upward" />
<mat-icon *ngIf="!ascending" adf-icon="arrow_downward" />
</button>
@@ -1,46 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { SortingPickerComponent } from './sorting-picker.component';
describe('SortingPickerComponent', () => {
let component: SortingPickerComponent;
beforeEach(() => {
component = new SortingPickerComponent();
});
it('should raise changed event on changing value', (done) => {
component.selected = 'key1';
component.valueChange.subscribe((key: string) => {
expect(key).toBe('key2');
done();
});
component.onOptionChanged({ value: 'key2' } as any);
});
it('should raise changed event on changing direction', (done) => {
component.ascending = false;
component.sortingChange.subscribe((ascending: boolean) => {
expect(ascending).toBeTruthy();
done();
});
component.toggleSortDirection();
});
});
@@ -1,108 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { applicationConfig, Meta, StoryObj, moduleMetadata } from '@storybook/angular';
import { SortingPickerComponent } from './sorting-picker.component';
import { provideStoryCore } from '../stories/core-story.providers';
const initialSortingTypes: Array<{ key: string; label: string }> = [
{ key: 'sortByFirstName', label: 'First Name' },
{ key: 'sortByLastName', label: 'Last Name' },
{ key: 'sortByBirthDate', label: 'Birth Date' }
];
const initialOptionKeys = [...initialSortingTypes.map((type) => type.key.toString())];
const meta: Meta<SortingPickerComponent> = {
component: SortingPickerComponent,
title: 'Core/Sorting Picker/Sorting Picker',
decorators: [
moduleMetadata({
imports: [SortingPickerComponent]
}),
applicationConfig({
providers: [...provideStoryCore()]
})
],
parameters: {
docs: {
description: {
component: `The picker shows the user a menu of sorting options (which could be data columns to sort on alphabetical vs numerical search, etc)
and the choice of ascending vs descending sort order.
Note that picker only implements the menu, so you are responsible for implementing the sorting options yourself.`
}
}
},
argTypes: {
selected: {
control: 'select',
options: initialOptionKeys,
description: 'Currently selected option key',
table: {
type: { summary: 'string' },
defaultValue: { summary: 'undefined' }
}
},
ascending: {
control: 'boolean',
description: 'Current sorting direction',
table: {
type: { summary: 'boolean' },
defaultValue: { summary: 'true' }
}
},
options: {
description: 'Available sorting options',
table: {
type: { summary: 'Array<{key: string; label: string}>' },
defaultValue: { summary: '[]' }
}
},
valueChange: {
action: 'valueChange',
description: 'Raised each time sorting key gets changed',
table: {
type: { summary: 'EventEmitter <string>' },
category: 'Actions'
}
},
sortingChange: {
action: 'sortingChange',
description: 'Raised each time direction gets changed',
table: {
type: { summary: 'EventEmitter <boolean>' },
category: 'Actions'
}
}
},
args: {
ascending: true,
options: []
}
};
export default meta;
type Story = StoryObj<SortingPickerComponent>;
export const SortingPicker: Story = {
render: (args) => ({
props: args
}),
args: {
options: initialSortingTypes
}
};
@@ -1,63 +0,0 @@
/*!
* @license
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
*
* 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 { Component, ViewEncapsulation, Input, EventEmitter, Output } from '@angular/core';
import { MatSelectChange, MatSelectModule } from '@angular/material/select';
import { CommonModule } from '@angular/common';
import { TranslatePipe } from '@ngx-translate/core';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatButtonModule } from '@angular/material/button';
import { IconModule } from '../icon/icon.module';
@Component({
selector: 'adf-sorting-picker',
imports: [CommonModule, TranslatePipe, MatFormFieldModule, MatSelectModule, MatButtonModule, IconModule],
templateUrl: './sorting-picker.component.html',
encapsulation: ViewEncapsulation.None,
host: { class: 'adf-sorting-picker' }
})
export class SortingPickerComponent {
/** Available sorting options */
@Input()
options: Array<{ key: string; label: string }> = [];
/** Currently selected option key */
@Input()
selected: string;
/** Current sorting direction */
@Input()
ascending = true;
/** Raised each time sorting key gets changed. */
@Output()
valueChange = new EventEmitter<string>();
/** Raised each time direction gets changed. */
@Output()
sortingChange = new EventEmitter<boolean>();
onOptionChanged(event: MatSelectChange) {
this.selected = event.value;
this.valueChange.emit(this.selected);
}
toggleSortDirection() {
this.ascending = !this.ascending;
this.sortingChange.emit(this.ascending);
}
}
-1
View File
@@ -33,7 +33,6 @@ export * from './lib/app-config/index';
export * from './lib/form/index';
export * from './lib/layout/index';
export * from './lib/comments/index';
export * from './lib/sorting-picker/index';
export * from './lib/templates/index';
export * from './lib/pipes/index';
export * from './lib/directives/index';