mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
ACS-8395: remove old and unused search picker components (#11573)
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user