Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core)!: move SlickGrid core files directly into the project #1135

Merged
merged 21 commits into from
Nov 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
e2fcdfb
feat(core)!: use new SlickGrid ESM version (#1070)
ghiscoding Sep 19, 2023
cd90176
chore(deps): upgrade to official SlickGrid 5.0 version (#1111)
ghiscoding Sep 19, 2023
cb3e3f2
chore: test with latest SlickGrid 5.0.1 (#1120)
ghiscoding Sep 27, 2023
77b1cc3
chore: fix SlickRange typo
ghiscoding Oct 8, 2023
783e820
chore: upgrade to latest SlickGrid 5.1.0 (#1132)
ghiscoding Oct 8, 2023
352b0d2
feat(core)!: move SlickGrid core files directly into the project
ghiscoding Oct 15, 2023
00efe02
chore: cleanup unused functions
ghiscoding Oct 15, 2023
f0196c8
chore: merge latest version of SlickGrid with CSP safe code
ghiscoding Nov 15, 2023
8fc9fe4
chore: fix merge conflicts from master
ghiscoding Nov 15, 2023
443bd39
chore: small commit to trigger CI
ghiscoding Nov 15, 2023
ed7153e
chore: update pnpm lock file
ghiscoding Nov 15, 2023
c2616b2
chore: remove unused interface import
ghiscoding Nov 15, 2023
63bf71e
chore: fix some Cypress tests
ghiscoding Nov 15, 2023
6d700d3
chore: fix UI rendering regression found in SlickGrid v5.5.0 code
ghiscoding-SE Nov 16, 2023
9e4e624
docs: improve interface comments and fix some typos
ghiscoding-SE Nov 17, 2023
b6aa9ec
chore: add type and cleanup some code
ghiscoding Nov 18, 2023
39dea6f
chore: add more type import
ghiscoding Nov 18, 2023
96b64a4
chore: rename core files as camelCase
ghiscoding Nov 18, 2023
af85b57
chore: remove some ts-ignore
ghiscoding Nov 18, 2023
bd8d096
chore: remove unnecessary SlickGridModel
ghiscoding Nov 18, 2023
0ca5390
chore: add some argument types
ghiscoding Nov 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 0 additions & 4 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@
packageNames: ['rxjs'],
allowedVersions: '7.8.1',
},
{
packageNames: ['slickgrid'],
allowedVersions: '4.x',
}
],
schedule: ['every 2 weeks on friday'],
}
8 changes: 1 addition & 7 deletions examples/vite-demo-vanilla-bundle/src/app.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
import { AppRouting } from './app-routing';
import { Renderer } from './renderer';
import { RouterConfig } from './interfaces';
import { ElementEventListener, RouterConfig } from './interfaces';
const pageLayoutGlobs = import.meta.glob('./examples/**/*.html', { as: 'raw', eager: true });

interface ElementEventListener {
element: Element;
eventName: string;
listener: EventListenerOrEventListenerObject;
}

export class App {
private _boundedEventWithListeners: ElementEventListener[] = [];
documentTitle = 'Slickgrid-Universal';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GridOption } from '@slickgrid-universal/common';
import type { GridOption } from '@slickgrid-universal/common';

/** Default Grid Options */
export const ExampleGridOptions: GridOption = {
Expand Down
4 changes: 2 additions & 2 deletions examples/vite-demo-vanilla-bundle/src/examples/example01.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Column, ExtensionName, FieldType, Formatters, GridOption } from '@slickgrid-universal/common';
import { type Column, ExtensionName, FieldType, Formatters, type GridOption } from '@slickgrid-universal/common';
import { Slicker, SlickVanillaGridBundle } from '@slickgrid-universal/vanilla-bundle';
import { ExampleGridOptions } from './example-grid-options';
// import '@slickgrid-universal/common/dist/styles/sass/slickgrid-theme-salesforce.scss?inline';
Expand All @@ -11,7 +11,7 @@ import './example01.scss';

const NB_ITEMS = 995;

export default class Example1 {
export default class Example01 {
gridOptions1!: GridOption;
gridOptions2!: GridOption;
columnDefinitions1!: Column[];
Expand Down
10 changes: 5 additions & 5 deletions examples/vite-demo-vanilla-bundle/src/examples/example02.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import {
Aggregators,
BindingEventService,
Column,
type Column,
FieldType,
Filters,
FileType,
Formatters,
GridOption,
Grouping,
type GridOption,
type Grouping,
GroupTotalFormatters,
SliderOption,
type SliderOption,
SortComparers,
SortDirectionNumber,
} from '@slickgrid-universal/common';
Expand All @@ -23,7 +23,7 @@ import '../material-styles.scss';

const NB_ITEMS = 500;

export default class Example2 {
export default class Example02 {
private _bindingEventService: BindingEventService;
columnDefinitions: Column[];
gridOptions: GridOption;
Expand Down
26 changes: 13 additions & 13 deletions examples/vite-demo-vanilla-bundle/src/examples/example03.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import {
Aggregators,
BindingEventService,
Column,
EditCommand,
type Column,
type EditCommand,
Editors,
FieldType,
FileType,
Filters,
Formatters,
GridOption,
Grouping,
GroupingGetterFunction,
type GridOption,
type Grouping,
type GroupingGetterFunction,
GroupTotalFormatters,
SlickDraggableGrouping,
SlickNamespace,
type SlickDraggableGrouping,
SlickGlobalEditorLock,
SortComparers,
SortDirectionNumber,
} from '@slickgrid-universal/common';
Expand All @@ -24,9 +24,6 @@ import { Slicker, SlickVanillaGridBundle } from '@slickgrid-universal/vanilla-bu
import { ExampleGridOptions } from './example-grid-options';
import './example03.scss?inline';

// using external SlickGrid JS libraries
declare const Slick: SlickNamespace;

interface ReportItem {
title: string;
duration: number;
Expand All @@ -37,14 +34,14 @@ interface ReportItem {
effortDriven: boolean;
}

export default class Example3 {
export default class Example03 {
private _bindingEventService: BindingEventService;
columnDefinitions: Column<ReportItem & { action: string; }>[];
gridOptions: GridOption;
dataset: any[];
editCommandQueue: EditCommand[] = [];
excelExportService: ExcelExportService;
sgb: SlickVanillaGridBundle;
sgb: SlickVanillaGridBundle<ReportItem & { action: string; }>;
durationOrderByCount = false;
draggableGroupingPlugin: SlickDraggableGrouping;
loadingClass = '';
Expand Down Expand Up @@ -374,6 +371,9 @@ export default class Example3 {
if (this.sgb) {
this.sgb.dataset = tmpArray;
}
// const item = this.sgb.dataView?.getItemById<ReportItem & { myAction: string; }>(0);
// const item = this.sgb?.dataView?.getItemById(0);
// console.log('item', item);
return tmpArray;
}

Expand Down Expand Up @@ -504,7 +504,7 @@ export default class Example3 {

undo() {
const command = this.editCommandQueue.pop();
if (command && Slick.GlobalEditorLock.cancelCurrentEdit()) {
if (command && SlickGlobalEditorLock.cancelCurrentEdit()) {
command.undo();
this.sgb?.slickGrid?.gotoCell(command.row, command.cell, false);
}
Expand Down
16 changes: 8 additions & 8 deletions examples/vite-demo-vanilla-bundle/src/examples/example04.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import {
AutocompleterOption,
BindingEventService,
Column,
ColumnEditorDualInput,
EditCommand,
type Column,
type ColumnEditorDualInput,
type EditCommand,
Editors,
FieldType,
Filters,
Formatter,
type Formatter,
Formatters,
GridOption,
type GridOption,
OperatorType,
SlickDataView,
type SlickDataView,
} from '@slickgrid-universal/common';
import { ExcelExportService } from '@slickgrid-universal/excel-export';
import { Slicker, SlickVanillaGridBundle } from '@slickgrid-universal/vanilla-bundle';
Expand Down Expand Up @@ -46,11 +46,11 @@ interface ReportItem {
effortDriven: boolean;
}

const customEditableInputFormatter: Formatter<ReportItem> = (_row: number, _cell: number, _value: any, _columnDef: Column, item: ReportItem) => {
const customEditableInputFormatter: Formatter<ReportItem> = (_row, _cell, _value, _columnDef, item) => {
return item.title;
};

export default class Example4 {
export default class Example04 {
private _bindingEventService: BindingEventService;
columnDefinitions: Column<ReportItem & { action?: string; }>[];
gridOptions: GridOption;
Expand Down
16 changes: 8 additions & 8 deletions examples/vite-demo-vanilla-bundle/src/examples/example05.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import {
BindingEventService,
Column,
type Column,
FieldType,
Filters,
Formatters,
GridOption,
GridStateChange,
type GridOption,
type GridStateChange,
GridStateType,
OnSelectedRowsChangedEventArgs,
TreeToggledItem,
TreeToggleStateChange,
type OnSelectedRowsChangedEventArgs,
type TreeToggledItem,
type TreeToggleStateChange,
} from '@slickgrid-universal/common';
import { ExcelExportService } from '@slickgrid-universal/excel-export';
import { Slicker, SlickVanillaGridBundle } from '@slickgrid-universal/vanilla-bundle';
Expand All @@ -19,7 +19,7 @@ import './example05.scss';

const NB_ITEMS = 500;

export default class Example5 {
export default class Example05 {
private _bindingEventService: BindingEventService;
columnDefinitions: Column[];
gridOptions: GridOption;
Expand Down Expand Up @@ -318,7 +318,7 @@ export default class Example5 {
updateFirstRow() {
// to update any of the grid rows, we CANNOT simply pass a new updated object
// we MUST read it from the DataView first (that will include all mutated Tree Data props, like `__treeLevel`, `__parentId`, ...) and then update it
const item = this.sgb.dataView?.getItemById<any>(0);
const item = this.sgb.dataView?.getItemById(0);

// option 1
/*
Expand Down
14 changes: 7 additions & 7 deletions examples/vite-demo-vanilla-bundle/src/examples/example06.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import {
Aggregators,
Column,
type Column,
decimalFormatted,
FieldType,
Filters,
findItemInTreeStructure,
Formatter,
type Formatter,
Formatters,
GridOption,
type GridOption,
isNumber,
SlickDataView,
type SlickDataView,
// GroupTotalFormatters,
// italicFormatter,
} from '@slickgrid-universal/common';
Expand All @@ -20,7 +20,7 @@ import { Slicker, SlickVanillaGridBundle } from '@slickgrid-universal/vanilla-bu
import './example06.scss';
import { ExampleGridOptions } from './example-grid-options';

export default class Example6 {
export default class Example06 {
columnDefinitions: Column[];
gridOptions: GridOption;
datasetFlat: any[];
Expand Down Expand Up @@ -228,12 +228,12 @@ export default class Example6 {
}

treeFormatter: Formatter = (_row, _cell, value, _columnDef, dataContext, grid) => {
const gridOptions = grid.getOptions() as GridOption;
const gridOptions = grid.getOptions();
const treeLevelPropName = gridOptions?.treeDataOptions?.levelPropName || '__treeLevel';
if (value === null || value === undefined || dataContext === undefined) {
return '';
}
const dataView = grid.getData() as SlickDataView;
const dataView = grid.getData<SlickDataView>();
const data = dataView.getItems();
const identifierPropName = dataView.getIdPropertyName() || 'id';
const idx = dataView.getIdxById(dataContext[identifierPropName]) as number;
Expand Down
13 changes: 7 additions & 6 deletions examples/vite-demo-vanilla-bundle/src/examples/example07.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
import {
BindingEventService,
Column,
type Column,
Editors,
FieldType,
Filters,
Formatters,
GridOption,
type GridOption,
OperatorType,
SlickEventData,
} from '@slickgrid-universal/common';
import { ExcelExportService } from '@slickgrid-universal/excel-export';
import { Slicker, SlickVanillaGridBundle } from '@slickgrid-universal/vanilla-bundle';
import DOMPurify from 'dompurify';

import { TranslateService } from '../translate.service';
import { ExampleGridOptions } from './example-grid-options';
import { TranslateService } from '../translate.service';
import './example07.scss';
import '../material-styles.scss';

export default class Example7 {
export default class Example07 {
private _bindingEventService: BindingEventService;
columnDefinitions: Column[];
gridOptions: GridOption;
Expand Down Expand Up @@ -487,7 +488,7 @@ export default class Example7 {
return collection.sort((item1, item2) => item1.value - item2.value);
}

onBeforeMoveRow(e: Event, data: { rows: number[]; insertBefore: number; }) {
onBeforeMoveRow(e: MouseEvent | TouchEvent | SlickEventData, data: { rows: number[]; insertBefore: number; }) {
for (const rowIdx of data.rows) {
// no point in moving before or after itself
if (rowIdx === data.insertBefore || (rowIdx === data.insertBefore - 1 && ((data.insertBefore - 1) !== this.sgb.dataView?.getItemCount()))) {
Expand All @@ -498,7 +499,7 @@ export default class Example7 {
return true;
}

onMoveRows(_e: Event, args: { rows: number[]; insertBefore: number; }) {
onMoveRows(_e: MouseEvent | TouchEvent | SlickEventData, args: { rows: number[]; insertBefore: number; }) {
// rows and insertBefore references,
// note that these references are assuming that the dataset isn't filtered at all
// which is not always the case so we will recalcualte them and we won't use these reference afterward
Expand Down
8 changes: 4 additions & 4 deletions examples/vite-demo-vanilla-bundle/src/examples/example08.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {
Column,
GridOption,
type Column,
type GridOption,
FieldType,
ItemMetadata,
OperatorString,
type ItemMetadata,
type OperatorString,
} from '@slickgrid-universal/common';
import { ExcelExportService } from '@slickgrid-universal/excel-export';
import { TextExportService } from '@slickgrid-universal/text-export';
Expand Down
4 changes: 2 additions & 2 deletions examples/vite-demo-vanilla-bundle/src/examples/example09.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BindingEventService, Column, FieldType, Filters, GridOption, GridStateChange, Metrics, OperatorType, } from '@slickgrid-universal/common';
import { GridOdataService, OdataServiceApi, OdataOption } from '@slickgrid-universal/odata';
import { BindingEventService, type Column, FieldType, Filters, type GridOption, type GridStateChange, type Metrics, OperatorType, } from '@slickgrid-universal/common';
import { GridOdataService, OdataServiceApi, type OdataOption } from '@slickgrid-universal/odata';
import { Slicker, SlickVanillaGridBundle } from '@slickgrid-universal/vanilla-bundle';
import { ExampleGridOptions } from './example-grid-options';
import Data from './data/customers_100.json';
Expand Down
13 changes: 7 additions & 6 deletions examples/vite-demo-vanilla-bundle/src/examples/example10.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import {
BindingEventService,
Column,
CursorPageInfo,
type Column,
type CursorPageInfo,
FieldType,
Filters,
Formatters,
GridOption,
GridStateChange,
Metrics,
MultipleSelectOption,
type GridOption,
type GridStateChange,
type Metrics,
type MultipleSelectOption,
OperatorType,
SortDirection,
} from '@slickgrid-universal/common';
Expand Down Expand Up @@ -222,6 +222,7 @@ export default class Example10 {
* @param query
* @return Promise<GraphqlPaginatedResult>
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
getCustomerApiCall(_query: string): Promise<GraphqlPaginatedResult> {
let pageInfo: CursorPageInfo;
if (this.sgb) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {
BindingEventService,
Column,
DOMEvent,
type Column,
type DOMEvent,
emptyElement,
Formatter,
type Formatter,
Formatters,
GridOption,
type GridOption,
} from '@slickgrid-universal/common';
import { Slicker, SlickVanillaGridBundle } from '@slickgrid-universal/vanilla-bundle';

Expand Down
Loading