Skip to content

Commit

Permalink
Merge pull request #1337 from ghiscoding/feat/node-extend
Browse files Browse the repository at this point in the history
feat: reimplement highlight row, node-extend also fixes #1332, #1333
  • Loading branch information
ghiscoding authored Dec 21, 2023
2 parents 87766e9 + cf7e6b1 commit 03eda77
Show file tree
Hide file tree
Showing 5 changed files with 178 additions and 177 deletions.
9 changes: 0 additions & 9 deletions cypress.config.ts

This file was deleted.

34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@
},
"dependencies": {
"@ngx-translate/core": "^15.0.0",
"@slickgrid-universal/common": "~4.0.3",
"@slickgrid-universal/custom-footer-component": "~4.0.3",
"@slickgrid-universal/empty-warning-component": "~4.0.3",
"@slickgrid-universal/event-pub-sub": "~4.0.2",
"@slickgrid-universal/pagination-component": "~4.0.3",
"@slickgrid-universal/row-detail-view-plugin": "~4.0.3",
"@slickgrid-universal/rxjs-observable": "~4.0.3",
"@slickgrid-universal/common": "~4.1.0",
"@slickgrid-universal/custom-footer-component": "~4.1.0",
"@slickgrid-universal/empty-warning-component": "~4.1.0",
"@slickgrid-universal/event-pub-sub": "~4.1.0",
"@slickgrid-universal/pagination-component": "~4.1.0",
"@slickgrid-universal/row-detail-view-plugin": "~4.1.0",
"@slickgrid-universal/rxjs-observable": "~4.1.0",
"dequal": "^2.0.3",
"dompurify": "^3.0.6",
"rxjs": "^7.8.1",
Expand Down Expand Up @@ -87,20 +87,20 @@
"@ngx-translate/http-loader": "^8.0.0",
"@popperjs/core": "^2.11.8",
"@release-it/conventional-changelog": "^8.0.1",
"@slickgrid-universal/composite-editor-component": "~4.0.3",
"@slickgrid-universal/custom-tooltip-plugin": "~4.0.3",
"@slickgrid-universal/excel-export": "~4.0.3",
"@slickgrid-universal/graphql": "~4.0.3",
"@slickgrid-universal/odata": "~4.0.3",
"@slickgrid-universal/text-export": "~4.0.3",
"@slickgrid-universal/composite-editor-component": "~4.1.0",
"@slickgrid-universal/custom-tooltip-plugin": "~4.1.0",
"@slickgrid-universal/excel-export": "~4.1.0",
"@slickgrid-universal/graphql": "~4.1.0",
"@slickgrid-universal/odata": "~4.1.0",
"@slickgrid-universal/text-export": "~4.1.0",
"@types/dompurify": "^3.0.5",
"@types/flatpickr": "^3.1.2",
"@types/fnando__sparkline": "^0.3.7",
"@types/jest": "^29.5.11",
"@types/node": "^20.10.4",
"@types/node": "^20.10.5",
"@types/sortablejs": "^1.15.7",
"@typescript-eslint/eslint-plugin": "^6.14.0",
"@typescript-eslint/parser": "^6.14.0",
"@typescript-eslint/eslint-plugin": "^6.15.0",
"@typescript-eslint/parser": "^6.15.0",
"bootstrap": "^5.3.2",
"copyfiles": "^2.4.1",
"custom-event-polyfill": "^1.0.7",
Expand All @@ -112,7 +112,7 @@
"jest-extended": "^4.0.2",
"jest-preset-angular": "^13.1.4",
"moment-mini": "^2.29.4",
"ng-packagr": "^17.0.2",
"ng-packagr": "^17.0.3",
"ngx-bootstrap": "^12.0.0",
"npm-run-all2": "^6.1.1",
"release-it": "^17.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import {
SlickDataView,
SlickEventHandler,
SlickGrid,
Utils as SlickUtils,
} from '@slickgrid-universal/common';

import {
Expand Down Expand Up @@ -72,6 +71,7 @@ import { SlickEmptyWarningComponent } from '@slickgrid-universal/empty-warning-c
import { SlickFooterComponent } from '@slickgrid-universal/custom-footer-component';
import { SlickPaginationComponent } from '@slickgrid-universal/pagination-component';
import { RxJsResource } from '@slickgrid-universal/rxjs-observable';
import { extend } from '@slickgrid-universal/utils';
import { dequal } from 'dequal/lite';

import { Constants } from '../constants';
Expand Down Expand Up @@ -1211,7 +1211,7 @@ export class AngularSlickgridComponent<TData = any> implements AfterViewInit, On
gridOptions.enablePagination = ((gridOptions.backendServiceApi && gridOptions.enablePagination === undefined) ? true : gridOptions.enablePagination) || false;

// use extend to deep merge & copy to avoid immutable properties being changed in GlobalGridOptions after a route change
const options = SlickUtils.extend(true, {}, GlobalGridOptions, this.forRootConfig, gridOptions) as GridOption;
const options = extend(true, {}, GlobalGridOptions, this.forRootConfig, gridOptions) as GridOption;

// using copy extend to do a deep clone has an unwanted side on objects and pageSizes but ES6 spread has other worst side effects
// so we will just overwrite the pageSizes when needed, this is the only one causing issues so far.
Expand Down
11 changes: 7 additions & 4 deletions test/cypress/e2e/example11.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
describe('Example 11 - Add / Update / Highlight a Datagrid Item', () => {
const GRID_ROW_HEIGHT = 35;
const fullTitles = ['', 'Title', 'Duration (days)', '% Complete', 'Start', 'Finish', 'Effort Driven'];

it('should display Example title', () => {
Expand Down Expand Up @@ -91,10 +92,12 @@ describe('Example 11 - Add / Update / Highlight a Datagrid Item', () => {
});

it('should scroll to top and expect certain rows on top', () => {
cy.get('[data-test="scroll-top-btn"]').click();
// cy.get('[data-test="scroll-top-btn"]').click();
cy.get('.slick-viewport.slick-viewport-top.slick-viewport-left')
.scrollTo('top');

cy.get('#grid11').find('.slick-row:nth(0) .slick-cell:nth(1)').should('contain.text', 'Task 1001');
cy.get('#grid11').find('.slick-row:nth(1) .slick-cell:nth(1)').should('contain.text', 'Task 1000');
cy.get('#grid11').find('.slick-row:nth(2) .slick-cell:nth(1)').should('contain.text', 'Task 1');
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 0}px;"] > .slick-cell:nth(1)`).should('contain', 'Task 1001');
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 1}px;"] > .slick-cell:nth(1)`).should('contain', 'Task 100');
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 2}px;"] > .slick-cell:nth(1)`).should('contain', 'Task 1');
});
});
Loading

0 comments on commit 03eda77

Please sign in to comment.