Skip to content

Commit

Permalink
chore: rename GroupingAndColspanService to HeaderGroupingService (#…
Browse files Browse the repository at this point in the history
…1271)

* chore: rename `GroupingAndColspanService` to `HeaderGroupingService`
  • Loading branch information
ghiscoding authored Oct 19, 2024
1 parent 35b5c62 commit 1461f9a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import {
GridService,
GridStateService,
GridStateType,
GroupingAndColspanService,
HeaderGroupingService,
OnRowCountChangedEventArgs,
OnRowsChangedEventArgs,
OnSetItemsCalledEventArgs,
Expand Down Expand Up @@ -104,11 +104,11 @@ const mockExtensionUtility = {
translateItems: jest.fn(),
} as unknown as ExtensionUtility;

const groupingAndColspanServiceStub = {
const HeaderGroupingServiceStub = {
init: jest.fn(),
dispose: jest.fn(),
translateGroupingAndColSpan: jest.fn(),
} as unknown as GroupingAndColspanService;
translateHeaderGrouping: jest.fn(),
} as unknown as HeaderGroupingService;

const mockGraphqlService = {
getDatasetName: jest.fn(),
Expand Down Expand Up @@ -370,7 +370,7 @@ describe('Aurelia-Slickgrid Component instantiated via Constructor', () => {
// // gridEventService: gridEventServiceStub,
// // gridService: gridServiceStub,
// // gridStateService: gridStateServiceStub,
// // groupingAndColspanService: groupingAndColspanServiceStub,
// // HeaderGroupingService: HeaderGroupingServiceStub,
// // resizerService: resizerServiceStub,
// // paginationService: paginationServiceStub,
// // sharedService,
Expand Down Expand Up @@ -1577,17 +1577,17 @@ describe('Aurelia-Slickgrid Component instantiated via Constructor', () => {
// expect(gridSpy).toHaveBeenCalledWith(false, false);
// });

// it('should initialize groupingAndColspanService when "createPreHeaderPanel" grid option is enabled and "enableDraggableGrouping" is disabled', () => {
// const spy = jest.spyOn(groupingAndColspanServiceStub, 'init');
// it('should initialize HeaderGroupingService when "createPreHeaderPanel" grid option is enabled and "enableDraggableGrouping" is disabled', () => {
// const spy = jest.spyOn(HeaderGroupingServiceStub, 'init');

// customElement.gridOptions = { createPreHeaderPanel: true, enableDraggableGrouping: false } as unknown as GridOption;
// customElement.initialization(slickEventHandler);

// expect(spy).toHaveBeenCalledWith(mockGrid, containerService);
// });

// it('should not initialize groupingAndColspanService when "createPreHeaderPanel" grid option is enabled and "enableDraggableGrouping" is also enabled', () => {
// const spy = jest.spyOn(groupingAndColspanServiceStub, 'init');
// it('should not initialize HeaderGroupingService when "createPreHeaderPanel" grid option is enabled and "enableDraggableGrouping" is also enabled', () => {
// const spy = jest.spyOn(HeaderGroupingServiceStub, 'init');

// customElement.gridOptions = { createPreHeaderPanel: true, enableDraggableGrouping: true } as unknown as GridOption;
// customElement.initialization(slickEventHandler);
Expand Down Expand Up @@ -2023,7 +2023,7 @@ describe('Aurelia-Slickgrid Component instantiated via Constructor', () => {

// it('should call multiple translate methods when locale changes', (done) => {
// const transAllExtSpy = jest.spyOn(extensionServiceStub, 'translateAllExtensions');
// const transGroupingColSpanSpy = jest.spyOn(groupingAndColspanServiceStub, 'translateGroupingAndColSpan');
// const transGroupingColSpanSpy = jest.spyOn(HeaderGroupingServiceStub, 'translateHeaderGrouping');
// const setHeaderRowSpy = jest.spyOn(mockGrid, 'setHeaderRowVisibility');

// customElement.gridOptions = { enableTranslate: true, createPreHeaderPanel: false, enableDraggableGrouping: false, showCustomFooter: true } as unknown as GridOption;
Expand All @@ -2039,10 +2039,10 @@ describe('Aurelia-Slickgrid Component instantiated via Constructor', () => {
// });
// });

// it('should call "setHeaderRowVisibility", "translateGroupingAndColSpan" and other methods when locale changes', (done) => {
// it('should call "setHeaderRowVisibility", "translateHeaderGrouping" and other methods when locale changes', (done) => {
// customElement.columnDefinitions = [{ id: 'firstName', field: 'firstName', filterable: true }];
// const transAllExtSpy = jest.spyOn(extensionServiceStub, 'translateAllExtensions');
// const transGroupingColSpanSpy = jest.spyOn(groupingAndColspanServiceStub, 'translateGroupingAndColSpan');
// const transGroupingColSpanSpy = jest.spyOn(HeaderGroupingServiceStub, 'translateHeaderGrouping');

// customElement.gridOptions = { enableTranslate: true, createPreHeaderPanel: true, enableDraggableGrouping: false } as unknown as GridOption;
// customElement.initialization(slickEventHandler);
Expand All @@ -2056,8 +2056,8 @@ describe('Aurelia-Slickgrid Component instantiated via Constructor', () => {
// });
// });

// it('should call "translateGroupingAndColSpan" translate methods when locale changes and Column Grouping PreHeader are enabled', (done) => {
// const groupColSpanSpy = jest.spyOn(groupingAndColspanServiceStub, 'translateGroupingAndColSpan');
// it('should call "translateHeaderGrouping" translate methods when locale changes and Column Grouping PreHeader are enabled', (done) => {
// const groupColSpanSpy = jest.spyOn(HeaderGroupingServiceStub, 'translateHeaderGrouping');

// customElement.gridOptions = { enableTranslate: true, createPreHeaderPanel: true, enableDraggableGrouping: false } as unknown as GridOption;
// customElement.initialization(slickEventHandler);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
GridService,
GridStateService,
GridStateType,
GroupingAndColspanService,
HeaderGroupingService,
isColumnDateType,
type Observable,
PaginationService,
Expand Down Expand Up @@ -130,7 +130,7 @@ export class AureliaSlickgridCustomElement {
gridEventService: GridEventService;
gridService: GridService;
gridStateService: GridStateService;
groupingService: GroupingAndColspanService;
headerGroupingService: HeaderGroupingService;
paginationService: PaginationService;
resizerService!: ResizerService;
rxjs?: RxJsFacade;
Expand Down Expand Up @@ -193,15 +193,15 @@ export class AureliaSlickgridCustomElement {

this.gridStateService = new GridStateService(this.extensionService, this.filterService, this._eventPubSubService, this.sharedService, this.sortService, this.treeDataService);
this.gridService = new GridService(this.gridStateService, this.filterService, this._eventPubSubService, this.paginationService, this.sharedService, this.sortService, this.treeDataService);
this.groupingService = new GroupingAndColspanService(this.extensionUtility, this._eventPubSubService);
this.headerGroupingService = new HeaderGroupingService(this.extensionUtility, this._eventPubSubService);

this.serviceList = [
this.extensionService,
this.filterService,
this.gridEventService,
this.gridService,
this.gridStateService,
this.groupingService,
this.headerGroupingService,
this.paginationService,
this.resizerService,
this.sortService,
Expand All @@ -216,7 +216,7 @@ export class AureliaSlickgridCustomElement {
this.containerService.registerInstance('GridEventService', this.gridEventService);
this.containerService.registerInstance('GridService', this.gridService);
this.containerService.registerInstance('GridStateService', this.gridStateService);
this.containerService.registerInstance('GroupingAndColspanService', this.groupingService);
this.containerService.registerInstance('HeaderGroupingService', this.headerGroupingService);
this.containerService.registerInstance('PaginationService', this.paginationService);
this.containerService.registerInstance('ResizerService', this.resizerService);
this.containerService.registerInstance('SharedService', this.sharedService);
Expand Down Expand Up @@ -475,7 +475,8 @@ export class AureliaSlickgridCustomElement {
gridEventService: this.gridEventService,
gridStateService: this.gridStateService,
gridService: this.gridService,
groupingService: this.groupingService,
groupingService: this.headerGroupingService,
headerGroupingService: this.headerGroupingService,
extensionService: this.extensionService,
paginationService: this.paginationService,
resizerService: this.resizerService,
Expand Down Expand Up @@ -685,7 +686,7 @@ export class AureliaSlickgridCustomElement {
if (gridOptions.enableTranslate) {
this.extensionService.translateAllExtensions(args.newLocale);
if ((gridOptions.createPreHeaderPanel && gridOptions.createTopHeaderPanel) || (gridOptions.createPreHeaderPanel && !gridOptions.enableDraggableGrouping)) {
this.groupingService.translateGroupingAndColSpan();
this.headerGroupingService.translateHeaderGrouping();
}
}
})
Expand Down Expand Up @@ -1434,9 +1435,9 @@ export class AureliaSlickgridCustomElement {
// when using Grouping/DraggableGrouping/Colspan register its Service
if (
((this.gridOptions.createPreHeaderPanel && this.gridOptions.createTopHeaderPanel) || (this.gridOptions.createPreHeaderPanel && !this.gridOptions.enableDraggableGrouping))
&& !this._registeredResources.some(r => r instanceof GroupingAndColspanService)
&& !this._registeredResources.some(r => r instanceof HeaderGroupingService)
) {
this._registeredResources.push(this.groupingService);
this._registeredResources.push(this.headerGroupingService);
}

// when using Tree Data View, register its Service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type {
GridEventService,
GridService,
GridStateService,
GroupingAndColspanService,
HeaderGroupingService,
PaginationService,
ResizerService,
SlickDataView,
Expand Down Expand Up @@ -51,8 +51,11 @@ export interface AureliaGridInstance {
/** Grid State Service */
gridStateService: GridStateService;

/** @deprecated @use `headerGroupingService` */
groupingService: HeaderGroupingService;

/** Grouping (and colspan) Service */
groupingService: GroupingAndColspanService;
headerGroupingService: HeaderGroupingService;

/** Pagination Service (allows you to programmatically go to first/last page, etc...) */
paginationService?: PaginationService;
Expand Down

0 comments on commit 1461f9a

Please sign in to comment.