From 34c963a2bcef1b841d3c62ea405a4bc49be98a5c Mon Sep 17 00:00:00 2001 From: Ghislain B Date: Mon, 30 Nov 2020 09:38:49 -0500 Subject: [PATCH] fix(core): rename i18n to translater & fix few other issues (#174) * fix(core): rename i18n to translater & fix few other issues - fix couple of issues found for the lib to work with Aurelia-Slickgrid --- .../src/examples/example10.ts | 2 +- .../src/editors/__tests__/dateEditor.spec.ts | 6 ++-- .../editors/__tests__/longTextEditor.spec.ts | 6 ++-- .../__tests__/multipleSelectEditor.spec.ts | 4 +-- .../editors/__tests__/selectEditor.spec.ts | 6 ++-- .../__tests__/singleSelectEditor.spec.ts | 4 +-- packages/common/src/editors/dateEditor.ts | 4 +-- packages/common/src/editors/longTextEditor.ts | 4 +-- packages/common/src/editors/selectEditor.ts | 4 +-- packages/common/src/enums/index.ts | 32 +++++++++---------- .../translateBooleanFormatter.spec.ts | 18 +++++------ .../__tests__/translateFormatter.spec.ts | 16 +++++----- .../common/src/formatters/formatters.index.ts | 4 +-- .../formatters/translateBooleanFormatter.ts | 8 ++--- .../src/formatters/translateFormatter.ts | 12 +++---- packages/common/src/global-grid-options.ts | 1 + .../src/interfaces/columnEditor.interface.ts | 2 +- .../src/interfaces/gridOption.interface.ts | 6 ++-- .../src/interfaces/resizerOption.interface.ts | 3 ++ .../src/interfaces/slickGrid.interface.ts | 4 +-- .../services/__tests__/grid.service.spec.ts | 19 +++++++---- packages/common/src/services/grid.service.ts | 7 ++-- .../src/excelExport.service.spec.ts | 20 ++++++------ .../excel-export/src/excelExport.service.ts | 4 +-- .../src/fileExport.service.spec.ts | 20 ++++++------ .../file-export/src/fileExport.service.ts | 4 +-- .../src/interfaces/graphqlResult.interface.ts | 4 +-- .../__tests__/graphql.service.spec.ts | 4 +-- .../graphql/src/services/graphql.service.ts | 2 +- .../components/slick-vanilla-grid-bundle.ts | 8 ++--- packages/vanilla-bundle/src/index.spec.ts | 1 + packages/vanilla-bundle/src/index.ts | 3 +- 32 files changed, 128 insertions(+), 114 deletions(-) diff --git a/examples/webpack-demo-vanilla-bundle/src/examples/example10.ts b/examples/webpack-demo-vanilla-bundle/src/examples/example10.ts index e2753215e..fe27e1c62 100644 --- a/examples/webpack-demo-vanilla-bundle/src/examples/example10.ts +++ b/examples/webpack-demo-vanilla-bundle/src/examples/example10.ts @@ -126,7 +126,7 @@ export class Example10 { this.gridOptions = { enableTranslate: true, - i18n: this.translateService, // pass the TranslateService instance to the grid + translater: this.translateService, // pass the TranslateService instance to the grid enableAutoResize: false, gridHeight: 275, gridWidth: 900, diff --git a/packages/common/src/editors/__tests__/dateEditor.spec.ts b/packages/common/src/editors/__tests__/dateEditor.spec.ts index 338bf1037..8c59a5072 100644 --- a/packages/common/src/editors/__tests__/dateEditor.spec.ts +++ b/packages/common/src/editors/__tests__/dateEditor.spec.ts @@ -19,7 +19,7 @@ const dataViewStub = { const gridOptionMock = { autoCommitEdit: false, editable: true, - i18n: null, + translater: null, } as unknown as GridOption; const getEditorLockMock = { @@ -96,7 +96,7 @@ describe('DateEditor', () => { }); it('should initialize the editor', () => { - gridOptionMock.i18n = translateService; + gridOptionMock.translater = translateService; editor = new DateEditor(editorArguments); const editorCount = divContainer.querySelectorAll('input.editor-text.editor-startDate').length; expect(editorCount).toBe(1); @@ -435,7 +435,7 @@ describe('DateEditor', () => { describe('with different locale', () => { it('should display text in new locale', (done) => { - gridOptionMock.i18n = translateService; + gridOptionMock.translater = translateService; translateService.use('fr-CA'); // will be trimmed to "fr" editor = new DateEditor(editorArguments); diff --git a/packages/common/src/editors/__tests__/longTextEditor.spec.ts b/packages/common/src/editors/__tests__/longTextEditor.spec.ts index 688f1ea80..e00275c86 100644 --- a/packages/common/src/editors/__tests__/longTextEditor.spec.ts +++ b/packages/common/src/editors/__tests__/longTextEditor.spec.ts @@ -18,7 +18,7 @@ const dataViewStub = { const gridOptionMock = { autoCommitEdit: false, editable: true, - i18n: null, + translater: null, editorTypingDebounce: 0, } as unknown as GridOption; @@ -101,7 +101,7 @@ describe('LongTextEditor', () => { }); it('should initialize the editor', () => { - gridOptionMock.i18n = translateService; + gridOptionMock.translater = translateService; editor = new LongTextEditor(editorArguments); const editorCount = document.body.querySelectorAll('.slick-large-editor-text.editor-title textarea').length; const editorTextCounter = document.body.querySelectorAll('.slick-large-editor-text.editor-title .editor-footer .counter'); @@ -120,7 +120,7 @@ describe('LongTextEditor', () => { }); it('should initialize the editor with default constant text when translate service is not provided', () => { - gridOptionMock.i18n = undefined as any; + gridOptionMock.translater = undefined as any; editor = new LongTextEditor(editorArguments); const editorCount = document.body.querySelectorAll('.slick-large-editor-text.editor-title textarea').length; const editorFooterElm = document.body.querySelector('.slick-large-editor-text.editor-title .editor-footer') as HTMLDivElement; diff --git a/packages/common/src/editors/__tests__/multipleSelectEditor.spec.ts b/packages/common/src/editors/__tests__/multipleSelectEditor.spec.ts index e0883f82b..3a63a49c3 100644 --- a/packages/common/src/editors/__tests__/multipleSelectEditor.spec.ts +++ b/packages/common/src/editors/__tests__/multipleSelectEditor.spec.ts @@ -20,7 +20,7 @@ const dataViewStub = { const gridOptionMock = { autoCommitEdit: false, editable: true, - i18n: null, + translater: null, } as unknown as GridOption; const getEditorLockMock = { @@ -83,7 +83,7 @@ describe('MultipleSelectEditor', () => { it('should initialize the editor', () => { (mockColumn.internalColumnEditor as ColumnEditor).collection = [{ value: 'male', label: 'male' }, { value: 'female', label: 'female' }]; - gridOptionMock.i18n = translateService; + gridOptionMock.translater = translateService; editor = new MultipleSelectEditor(editorArguments); const editorCount = document.body.querySelectorAll('select.ms-filter.editor-gender').length; const spy = jest.spyOn(editor, 'show'); diff --git a/packages/common/src/editors/__tests__/selectEditor.spec.ts b/packages/common/src/editors/__tests__/selectEditor.spec.ts index ca666af90..db169963c 100644 --- a/packages/common/src/editors/__tests__/selectEditor.spec.ts +++ b/packages/common/src/editors/__tests__/selectEditor.spec.ts @@ -20,7 +20,7 @@ const dataViewStub = { const gridOptionMock = { autoCommitEdit: false, editable: true, - i18n: null as any, + translater: null as any, } as unknown as GridOption; const getEditorLockMock = { @@ -141,7 +141,7 @@ describe('SelectEditor', () => { it('should initialize the editor', () => { (mockColumn.internalColumnEditor as ColumnEditor).collection = [{ value: 'male', label: 'male' }, { value: 'female', label: 'female' }]; - gridOptionMock.i18n = translateService; + gridOptionMock.translater = translateService; editor = new SelectEditor(editorArguments, true); editor.focus(); const editorCount = document.body.querySelectorAll('select.ms-filter.editor-gender').length; @@ -154,7 +154,7 @@ describe('SelectEditor', () => { const promise = new Promise(resolve => resolve(mockCollection)); (mockColumn.internalColumnEditor as ColumnEditor).collection = null as any; (mockColumn.internalColumnEditor as ColumnEditor).collectionAsync = promise; - gridOptionMock.i18n = translateService; + gridOptionMock.translater = translateService; editor = new SelectEditor(editorArguments, true); const disableSpy = jest.spyOn(editor, 'disable'); diff --git a/packages/common/src/editors/__tests__/singleSelectEditor.spec.ts b/packages/common/src/editors/__tests__/singleSelectEditor.spec.ts index 81d429cc6..996953ad9 100644 --- a/packages/common/src/editors/__tests__/singleSelectEditor.spec.ts +++ b/packages/common/src/editors/__tests__/singleSelectEditor.spec.ts @@ -18,7 +18,7 @@ const dataViewStub = { const gridOptionMock = { autoCommitEdit: false, editable: true, - i18n: null, + translater: null, } as unknown as GridOption; const getEditorLockMock = { @@ -81,7 +81,7 @@ describe('SingleSelectEditor', () => { it('should initialize the editor', () => { (mockColumn.internalColumnEditor as ColumnEditor).collection = [{ value: 'male', label: 'male' }, { value: 'female', label: 'female' }]; - gridOptionMock.i18n = translateService; + gridOptionMock.translater = translateService; editor = new SingleSelectEditor(editorArguments); const editorCount = document.body.querySelectorAll('select.ms-filter.editor-gender').length; diff --git a/packages/common/src/editors/dateEditor.ts b/packages/common/src/editors/dateEditor.ts index 03c850952..d39dbbc25 100644 --- a/packages/common/src/editors/dateEditor.ts +++ b/packages/common/src/editors/dateEditor.ts @@ -58,8 +58,8 @@ export class DateEditor implements Editor { } this.grid = args.grid; this.gridOptions = (this.grid.getOptions() || {}) as GridOption; - if (this.gridOptions && this.gridOptions.i18n) { - this._translaterService = this.gridOptions.i18n; + if (this.gridOptions?.translater) { + this._translaterService = this.gridOptions.translater; } this.init(); } diff --git a/packages/common/src/editors/longTextEditor.ts b/packages/common/src/editors/longTextEditor.ts index 998991c4f..7ba5942e9 100644 --- a/packages/common/src/editors/longTextEditor.ts +++ b/packages/common/src/editors/longTextEditor.ts @@ -54,8 +54,8 @@ export class LongTextEditor implements Editor { this.grid = args.grid; this.gridOptions = args.grid && args.grid.getOptions() as GridOption; const options = this.gridOptions || this.args.column.params || {}; - if (options && options.i18n) { - this._translater = options.i18n; + if (options?.translater) { + this._translater = options.translater; } // get locales provided by user in forRoot or else use default English locales via the Constants diff --git a/packages/common/src/editors/selectEditor.ts b/packages/common/src/editors/selectEditor.ts index 2b4da29ad..61404c608 100644 --- a/packages/common/src/editors/selectEditor.ts +++ b/packages/common/src/editors/selectEditor.ts @@ -88,8 +88,8 @@ export class SelectEditor implements Editor { } this.grid = args.grid; this.gridOptions = (this.grid.getOptions() || {}) as GridOption; - if (this.gridOptions && this.gridOptions.i18n) { - this._translaterService = this.gridOptions.i18n; + if (this.gridOptions?.translater) { + this._translaterService = this.gridOptions.translater; } // get locales provided by user in main file or else use default English locales via the Constants diff --git a/packages/common/src/enums/index.ts b/packages/common/src/enums/index.ts index 360c033bb..875b1f8f8 100644 --- a/packages/common/src/enums/index.ts +++ b/packages/common/src/enums/index.ts @@ -1,23 +1,23 @@ export * from './caseType.enum'; +export * from './columnReorderFunction.type'; export * from './compositeEditorModalType.type'; -export * from './fieldType.enum'; -export * from './extensionList.type'; -export * from './eventNamingStyle.enum'; -export * from './emitterType.enum'; -export * from './fileType.enum'; export * from './delimiterType.enum'; -export * from './columnReorderFunction.type'; +export * from './emitterType.enum'; +export * from './eventNamingStyle.enum'; +export * from './extensionList.type'; export * from './extensionName.enum'; +export * from './fieldType.enum'; +export * from './fileType.enum'; export * from './filterMultiplePassType.enum'; +export * from './filterMultiplePassTypeString.type'; +export * from './gridAutosizeColsMode.enum'; +export * from './gridStateType.enum'; +export * from './keyCode.enum'; +export * from './operatorString.type'; +export * from './operatorType.enum'; +export * from './searchTerm.type'; +export * from './slickControlList.enum'; +export * from './slickPluginList.enum'; +export * from './sortDirection.enum'; export * from './sortDirectionString.type'; export * from './sortDirectionNumber.enum'; -export * from './sortDirection.enum'; -export * from './slickPluginList.enum'; -export * from './slickControlList.enum'; -export * from './searchTerm.type'; -export * from './operatorType.enum'; -export * from './operatorString.type'; -export * from './keyCode.enum'; -export * from './gridStateType.enum'; -export * from './gridAutosizeColsMode.enum'; -export * from './filterMultiplePassTypeString.type'; diff --git a/packages/common/src/formatters/__tests__/translateBooleanFormatter.spec.ts b/packages/common/src/formatters/__tests__/translateBooleanFormatter.spec.ts index ab6e0d6b6..35b836c0e 100644 --- a/packages/common/src/formatters/__tests__/translateBooleanFormatter.spec.ts +++ b/packages/common/src/formatters/__tests__/translateBooleanFormatter.spec.ts @@ -16,48 +16,48 @@ describe('the Translate Boolean Formatter', () => { it('should return an empty string when null value is passed', async () => { await translateService.use('fr'); - (gridStub.getOptions as jest.Mock).mockReturnValueOnce({ i18n: translateService }); + (gridStub.getOptions as jest.Mock).mockReturnValueOnce({ translater: translateService }); const output = translateBooleanFormatter(1, 1, null, {} as Column, {}, gridStub); expect(output).toBe(''); }); it('should return an empty string when empty string value is passed', async () => { await translateService.use('fr'); - (gridStub.getOptions as jest.Mock).mockReturnValueOnce({ i18n: translateService }); + (gridStub.getOptions as jest.Mock).mockReturnValueOnce({ translater: translateService }); const output = translateBooleanFormatter(1, 1, '', {} as Column, {}, gridStub); expect(output).toBe(''); }); it('should return the translated value when value passed is boolean', async () => { await translateService.use('fr'); - (gridStub.getOptions as jest.Mock).mockReturnValueOnce({ i18n: translateService }); + (gridStub.getOptions as jest.Mock).mockReturnValueOnce({ translater: translateService }); const output = translateBooleanFormatter(1, 1, 'TRUE', {} as Column, {}, gridStub); expect(output).toBe('Vrai'); }); it('should return the translated value when value passed is a string', async () => { await translateService.use('fr'); - (gridStub.getOptions as jest.Mock).mockReturnValueOnce({ i18n: translateService }); + (gridStub.getOptions as jest.Mock).mockReturnValueOnce({ translater: translateService }); const output = translateBooleanFormatter(1, 1, 'TRUE', {} as Column, {}, gridStub); expect(output).toBe('Vrai'); }); - it('should return the translated value when value passed is a string and i18n service is passed as a ColumnDef Params', async () => { + it('should return the translated value when value passed is a string and translater service is passed as a ColumnDef Params', async () => { await translateService.use('fr'); (gridStub.getOptions as jest.Mock).mockReturnValueOnce({}); - const output = translateBooleanFormatter(1, 1, 'TRUE', { params: { i18n: translateService } } as Column, {}, gridStub); + const output = translateBooleanFormatter(1, 1, 'TRUE', { params: { translater: translateService } } as Column, {}, gridStub); expect(output).toBe('Vrai'); }); - it('should return the translated value when value passed is a string and i18n service is passed as a ColumnDef Params without any Grid object', async () => { + it('should return the translated value when value passed is a string and translater service is passed as a ColumnDef Params without any Grid object', async () => { await translateService.use('fr'); - const output = translateBooleanFormatter(1, 1, 'TRUE', { params: { i18n: translateService } } as Column, {}); + const output = translateBooleanFormatter(1, 1, 'TRUE', { params: { translater: translateService } } as Column, {}, {} as any); expect(output).toBe('Vrai'); }); it('should convert any type of value to string', async () => { await translateService.use('fr'); - (gridStub.getOptions as jest.Mock).mockReturnValueOnce({ i18n: translateService }); + (gridStub.getOptions as jest.Mock).mockReturnValueOnce({ translater: translateService }); const output = translateBooleanFormatter(1, 1, 99, {} as Column, {}, gridStub); expect(output).toBe('99'); }); diff --git a/packages/common/src/formatters/__tests__/translateFormatter.spec.ts b/packages/common/src/formatters/__tests__/translateFormatter.spec.ts index 113764117..23a1bdcbf 100644 --- a/packages/common/src/formatters/__tests__/translateFormatter.spec.ts +++ b/packages/common/src/formatters/__tests__/translateFormatter.spec.ts @@ -17,7 +17,7 @@ describe('the Translate Formatter', () => { it('should return an empty string when null value is passed', async () => { await translateService.use('fr'); - (gridStub.getOptions as jest.Mock).mockReturnValueOnce({ i18n: translateService }); + (gridStub.getOptions as jest.Mock).mockReturnValueOnce({ translater: translateService }); const output = translateFormatter(1, 1, null, {} as Column, {}, gridStub); expect(translateService.getCurrentLanguage()).toBe('fr'); expect(output).toBe(''); @@ -25,7 +25,7 @@ describe('the Translate Formatter', () => { it('should return an empty string when no value is passed', async () => { await translateService.use('fr'); - (gridStub.getOptions as jest.Mock).mockReturnValueOnce({ i18n: translateService }); + (gridStub.getOptions as jest.Mock).mockReturnValueOnce({ translater: translateService }); const output = translateFormatter(1, 1, '', {} as Column, {}, gridStub); expect(translateService.getCurrentLanguage()).toBe('fr'); expect(output).toBe(''); @@ -33,27 +33,27 @@ describe('the Translate Formatter', () => { it('should return the translated value as string', async () => { await translateService.use('fr'); - (gridStub.getOptions as jest.Mock).mockReturnValueOnce({ i18n: translateService }); + (gridStub.getOptions as jest.Mock).mockReturnValueOnce({ translater: translateService }); const output = translateFormatter(1, 1, 'HELLO', {} as Column, {}, gridStub); expect(output).toBe('Bonjour'); }); - it('should return the translated value when value passed is a string and i18n service is passed as a ColumnDef Params', async () => { + it('should return the translated value when value passed is a string and translater service is passed as a ColumnDef Params', async () => { await translateService.use('fr'); (gridStub.getOptions as jest.Mock).mockReturnValueOnce({}); - const output = translateFormatter(1, 1, 'HELLO', { params: { i18n: translateService } } as Column, {}, gridStub); + const output = translateFormatter(1, 1, 'HELLO', { params: { translater: translateService } } as Column, {}, gridStub); expect(output).toBe('Bonjour'); }); - it('should return the translated value when value passed is a string and i18n service is passed as a ColumnDef Params without any Grid object', async () => { + it('should return the translated value when value passed is a string and translater service is passed as a ColumnDef Params without any Grid object', async () => { await translateService.use('fr'); - const output = translateFormatter(1, 1, 'HELLO', { params: { i18n: translateService } } as Column, {}); + const output = translateFormatter(1, 1, 'HELLO', { params: { translater: translateService } } as Column, {}, {} as any); expect(output).toBe('Bonjour'); }); it('should convert any type of value to string', async () => { await translateService.use('fr'); - (gridStub.getOptions as jest.Mock).mockReturnValueOnce({ i18n: translateService }); + (gridStub.getOptions as jest.Mock).mockReturnValueOnce({ translater: translateService }); const output = translateFormatter(1, 1, 99, {} as Column, {}, gridStub); expect(output).toBe('99'); }); diff --git a/packages/common/src/formatters/formatters.index.ts b/packages/common/src/formatters/formatters.index.ts index 08fb321c4..d37a504e0 100644 --- a/packages/common/src/formatters/formatters.index.ts +++ b/packages/common/src/formatters/formatters.index.ts @@ -227,10 +227,10 @@ export const Formatters = { /** Takes a cell value number (between 0-100) and displays Bootstrap "progress-bar" a red (<30), silver (>30 & <70) or green (>=70) bar */ progressBar: progressBarFormatter, - /** Takes a cell value and translates it (i18n). Requires an instance of the Translate Service:: `i18n: this.translate */ + /** Takes a cell value and translates it. Requires an instance of the Translate Service:: `translater: this.translate */ translate: translateFormatter, - /** Takes a boolean value, cast it to upperCase string and finally translates it (i18n). */ + /** Takes a boolean value, cast it to upperCase string and finally translates it. Requires an instance of the Translate Service:: `translater: this.translate */ translateBoolean: translateBooleanFormatter, /** Formatter that must be use with a Tree Data column */ diff --git a/packages/common/src/formatters/translateBooleanFormatter.ts b/packages/common/src/formatters/translateBooleanFormatter.ts index 160b1ecd6..c8aee52ca 100644 --- a/packages/common/src/formatters/translateBooleanFormatter.ts +++ b/packages/common/src/formatters/translateBooleanFormatter.ts @@ -3,16 +3,16 @@ import { Formatter } from './../interfaces/index'; /** Takes a boolean value, cast it to upperCase string and finally translates it (i18n). */ export const translateBooleanFormatter: Formatter = (_row, _cell, value, columnDef, _dataContext, grid) => { const gridOptions = (grid && typeof grid.getOptions === 'function') ? grid.getOptions() : {}; - const i18n = gridOptions.i18n || (columnDef && columnDef.params && columnDef.params.i18n); + const translater = gridOptions.translater || (columnDef && columnDef.params && columnDef.params.translater); - if (!i18n || typeof i18n.translate !== 'function') { + if (!translater || typeof translater.translate !== 'function') { throw new Error(`The translate formatter requires the Translate Service to be provided as a Grid Options or Column Definition "i18n". - For example: this.gridOptions = { enableTranslate: true, i18n: this.translateService }`); + For example: this.gridOptions = { enableTranslate: true, translater: this.translateService }`); } // make sure the value is a string (for example a boolean value would throw an error) if (value !== undefined && value !== null && typeof value !== 'string') { value = value + ''; } - return value ? i18n.translate(value.toUpperCase() as string) : ''; + return value ? translater.translate(value.toUpperCase() as string) : ''; }; diff --git a/packages/common/src/formatters/translateFormatter.ts b/packages/common/src/formatters/translateFormatter.ts index 74fc2ba25..ea2d15241 100644 --- a/packages/common/src/formatters/translateFormatter.ts +++ b/packages/common/src/formatters/translateFormatter.ts @@ -1,13 +1,13 @@ import { Formatter } from './../interfaces/index'; -/** Takes a cell value and translates it (i18n). Requires an instance of the Translate Service:: `i18n: this.translate */ +/** Takes a cell value and translates it (translater). Requires an instance of the Translate Service:: `translater: this.translate */ export const translateFormatter: Formatter = (_row, _cell, value, columnDef, _dataContext, grid) => { const gridOptions = (grid && typeof grid.getOptions === 'function') ? grid.getOptions() : {}; - const i18n = gridOptions.i18n || (columnDef && columnDef.params && columnDef.params.i18n); + const translater = gridOptions.translater || (columnDef && columnDef.params && columnDef.params.translater); - if (!i18n || typeof i18n.translate !== 'function') { - throw new Error(`The translate formatter requires the Translate Service to be provided as a Grid Options or Column Definition "i18n". - For example: this.gridOptions = { enableTranslate: true, i18n: this.translateService }`); + if (!translater || typeof translater.translate !== 'function') { + throw new Error(`The translate formatter requires the Translate Service to be provided as a Grid Options or Column Definition "translater". + For example: this.gridOptions = { enableTranslate: true, translater: this.translateService }`); } // make sure the value is a string (for example a boolean value would throw an error) @@ -15,5 +15,5 @@ export const translateFormatter: Formatter = (_row, _cell, value, columnDef, _da value = value + ''; } - return value ? i18n.translate(value) : ''; + return value ? translater.translate(value) : ''; }; diff --git a/packages/common/src/global-grid-options.ts b/packages/common/src/global-grid-options.ts index 5a1028c9c..fc33add5f 100644 --- a/packages/common/src/global-grid-options.ts +++ b/packages/common/src/global-grid-options.ts @@ -9,6 +9,7 @@ export const GlobalGridOptions: GridOption = { asyncEditorLoading: false, autoFitColumnsOnFirstLoad: true, autoResize: { + applyResizeToContainer: true, calculateAvailableSizeBy: 'window', bottomPadding: 20, minHeight: 180, diff --git a/packages/common/src/interfaces/columnEditor.interface.ts b/packages/common/src/interfaces/columnEditor.interface.ts index 408a6a2cd..cadba18d2 100644 --- a/packages/common/src/interfaces/columnEditor.interface.ts +++ b/packages/common/src/interfaces/columnEditor.interface.ts @@ -1,4 +1,4 @@ -import { FieldType } from '../enums'; +import { FieldType } from '../enums/index'; import { CollectionCustomStructure, CollectionFilterBy, diff --git a/packages/common/src/interfaces/gridOption.interface.ts b/packages/common/src/interfaces/gridOption.interface.ts index 0c7425ea9..68949f671 100644 --- a/packages/common/src/interfaces/gridOption.interface.ts +++ b/packages/common/src/interfaces/gridOption.interface.ts @@ -367,9 +367,6 @@ export interface GridOption { /** Header menu options */ headerMenu?: HeaderMenu; - /** Translater i18n translation service instance */ - i18n?: TranslaterService; - /** * When using custom Locales (that is when user is NOT using a Translate Service, this property does nothing when used with Translate Service), * This is useful so that every component of the lib knows the locale. @@ -483,6 +480,9 @@ export interface GridOption { /** What is the top panel height in pixels (only type the number) */ topPanelHeight?: number; + /** Translater Service used by Slickgrid-Universal for translating locale. */ + translater?: TranslaterService; + /** I18N Namespace Translation Prefix, you can also optionally change the separator by setting "translationNamespaceSeparator" (defaults to ":") */ translationNamespace?: string; diff --git a/packages/common/src/interfaces/resizerOption.interface.ts b/packages/common/src/interfaces/resizerOption.interface.ts index 2f94c150d..bfe19dbb3 100644 --- a/packages/common/src/interfaces/resizerOption.interface.ts +++ b/packages/common/src/interfaces/resizerOption.interface.ts @@ -1,4 +1,7 @@ export interface ResizerOption { + /** Defaults to false, do we want to apply the resized dimentions to the grid container as well? */ + applyResizeToContainer?: boolean; + /** Defaults to 'window', which DOM element are we using to calculate the available size for the grid? */ calculateAvailableSizeBy?: 'container' | 'window'; diff --git a/packages/common/src/interfaces/slickGrid.interface.ts b/packages/common/src/interfaces/slickGrid.interface.ts index ad8dc954c..c24815079 100644 --- a/packages/common/src/interfaces/slickGrid.interface.ts +++ b/packages/common/src/interfaces/slickGrid.interface.ts @@ -157,7 +157,7 @@ export interface SlickGrid { */ getColumnIndex(id: string | number): number; - /** Returns an array of column definitions, containing the option settings for each individual column.*/ + /** Returns an array of column definitions, containing the option settings for each individual column. */ getColumns(): Column[]; /** Get Grid Canvas Node DOM Element */ @@ -241,7 +241,7 @@ export interface SlickGrid { /** Returns an array of row indices corresponding to the currently selected rows. */ getSelectedRows(): number[]; - /** Returns the current SelectionModel. See here for more information about SelectionModels.*/ + /** Returns the current SelectionModel. See here for more information about SelectionModels. */ getSelectionModel(): SlickCellSelectionModel | SlickRowSelectionModel; /** Get sorted columns **/ diff --git a/packages/common/src/services/__tests__/grid.service.spec.ts b/packages/common/src/services/__tests__/grid.service.spec.ts index fa51d80b6..efda5a760 100644 --- a/packages/common/src/services/__tests__/grid.service.spec.ts +++ b/packages/common/src/services/__tests__/grid.service.spec.ts @@ -1,6 +1,6 @@ import 'jest-extended'; -import { FilterService, GridService, ExtensionService, PaginationService, PubSubService, SharedService, SortService } from '../index'; +import { ExtensionService, FilterService, GridService, GridStateService, PaginationService, PubSubService, SharedService, SortService } from '../index'; import { GridOption, CellArgs, Column, OnEventArgs, SlickGrid, SlickDataView, SlickNamespace } from '../../interfaces/index'; jest.useFakeTimers(); @@ -54,6 +54,11 @@ const dataviewStub = { updateItem: jest.fn(), } as unknown as SlickDataView; +const gridStateServiceStub = { + needToPreserveRowSelection: jest.fn(), + resetColumns: jest.fn(), +} as unknown as GridStateService; + const gridStub = { autosizeColumns: jest.fn(), insertItem: jest.fn(), @@ -88,7 +93,7 @@ describe('Grid Service', () => { jest.spyOn(gridStub, 'getOptions').mockReturnValue(mockGridOptions); beforeEach(() => { - service = new GridService(extensionServiceStub, filterServiceStub, pubSubServiceStub, paginationServiceStub, sharedService, sortServiceStub); + service = new GridService(extensionServiceStub, gridStateServiceStub, filterServiceStub, pubSubServiceStub, paginationServiceStub, sharedService, sortServiceStub); service.init(gridStub); }); @@ -1503,7 +1508,7 @@ describe('Grid Service', () => { const extensionSpy = jest.spyOn(extensionServiceStub, 'getAllColumns').mockReturnValue(mockColumns); const setColSpy = jest.spyOn(gridStub, 'setColumns'); const autosizeSpy = jest.spyOn(gridStub, 'autosizeColumns'); - // const gridStateSpy = jest.spyOn(gridStateServiceStub, 'resetColumns'); + const gridStateSpy = jest.spyOn(gridStateServiceStub, 'resetColumns'); const filterSpy = jest.spyOn(filterServiceStub, 'clearFilters'); const sortSpy = jest.spyOn(sortServiceStub, 'clearSorting'); @@ -1512,7 +1517,7 @@ describe('Grid Service', () => { expect(extensionSpy).toHaveBeenCalled(); expect(setColSpy).toHaveBeenCalled(); expect(autosizeSpy).toHaveBeenCalled(); - // expect(gridStateSpy).toHaveBeenCalled(); + expect(gridStateSpy).toHaveBeenCalled(); expect(filterSpy).toHaveBeenCalled(); expect(sortSpy).toHaveBeenCalled(); }); @@ -1521,12 +1526,12 @@ describe('Grid Service', () => { const mockColumns = [{ id: 'field1', width: 100 }, { id: 'field2', width: 150 }, { id: 'field3', field: 'field3' }] as Column[]; jest.spyOn(gridStub, 'getOptions').mockReturnValue({ enableAutoResize: true, enableAutoSizeColumns: true } as GridOption); const extensionSpy = jest.spyOn(extensionServiceStub, 'getAllColumns').mockReturnValue(mockColumns); - // const gridStateSpy = jest.spyOn(gridStateServiceStub, 'resetColumns'); + const gridStateSpy = jest.spyOn(gridStateServiceStub, 'resetColumns'); - service.resetGrid(); + service.resetGrid(mockColumns); expect(extensionSpy).toHaveBeenCalled(); - // expect(gridStateSpy).toHaveBeenCalledWith(mockColumns); + expect(gridStateSpy).toHaveBeenCalledWith(mockColumns); }); }); }); diff --git a/packages/common/src/services/grid.service.ts b/packages/common/src/services/grid.service.ts index b8b0f2791..02a05d3ff 100644 --- a/packages/common/src/services/grid.service.ts +++ b/packages/common/src/services/grid.service.ts @@ -14,6 +14,7 @@ import { } from '../interfaces/index'; import { ExtensionService } from './extension.service'; import { FilterService } from './filter.service'; +import { GridStateService } from './gridState.service'; import { PaginationService } from '../services/pagination.service'; import { PubSubService } from '../services/pubSub.service'; import { SharedService } from './shared.service'; @@ -35,6 +36,7 @@ export class GridService { constructor( private extensionService: ExtensionService, + private gridStateService: GridStateService, private filterService: FilterService, private pubSubService: PubSubService, private paginationService: PaginationService, @@ -363,7 +365,7 @@ export class GridService { * The column definitions could be passed as argument to reset (this can be used after a Grid State reset) * The reset will clear the Filters & Sort, then will reset the Columns to their original state */ - resetGrid() { + resetGrid(columnDefinitions?: Column[]) { // reset columns to original states & refresh the grid if (this._grid && this._dataView) { const originalColumns = this.extensionService.getAllColumns(); @@ -374,6 +376,7 @@ export class GridService { if (this._gridOptions && this._gridOptions.enableAutoSizeColumns) { this._grid.autosizeColumns(); } + this.gridStateService.resetColumns(columnDefinitions); } } @@ -564,7 +567,7 @@ export class GridService { } // when user has row selection enabled, we should clear any selection to avoid confusion after a delete - const isSyncGridSelectionEnabled = /* this.gridStateService && this.gridStateService.needToPreserveRowSelection() || */ false; + const isSyncGridSelectionEnabled = this.gridStateService && this.gridStateService.needToPreserveRowSelection() || false; if (!isSyncGridSelectionEnabled && this._grid && this._gridOptions && (this._gridOptions.enableCheckboxSelector || this._gridOptions.enableRowSelection)) { this.setSelectedRows([]); } diff --git a/packages/excel-export/src/excelExport.service.spec.ts b/packages/excel-export/src/excelExport.service.spec.ts index b0874522c..cf93934dd 100644 --- a/packages/excel-export/src/excelExport.service.spec.ts +++ b/packages/excel-export/src/excelExport.service.spec.ts @@ -79,11 +79,11 @@ describe('ExcelExportService', () => { let mockExcelBlob: Blob; let mockExportExcelOptions: ExcelExportOption; - describe('with I18N Service', () => { + describe('with Translater Service', () => { beforeEach(() => { sharedService = new SharedService(); translateService = new TranslateServiceStub(); - mockGridOptions.i18n = translateService; + mockGridOptions.translater = translateService; sharedService.internalPubSubService = pubSubServiceStub; (navigator as any).__defineGetter__('appName', () => 'Netscape'); @@ -603,7 +603,7 @@ describe('ExcelExportService', () => { beforeEach(() => { mockGridOptions.enableTranslate = true; - mockGridOptions.i18n = translateService; + mockGridOptions.translater = translateService; mockColumns = [ { id: 'id', field: 'id', excludeFromExport: true }, @@ -617,7 +617,7 @@ describe('ExcelExportService', () => { jest.spyOn(gridStub, 'getColumns').mockReturnValue(mockColumns); }); - it(`should have the LastName header title translated when defined as a "nameKey" and "i18n" is set in grid option`, async () => { + it(`should have the LastName header title translated when defined as a "nameKey" and "translater" is set in grid option`, async () => { mockCollection = [{ id: 0, userId: '1E06', firstName: 'John', lastName: 'Z', position: 'SALES_REP', order: 10 }]; jest.spyOn(dataViewStub, 'getLength').mockReturnValue(mockCollection.length); jest.spyOn(dataViewStub, 'getItem').mockReturnValue(null).mockReturnValueOnce(mockCollection[0]); @@ -1316,7 +1316,7 @@ describe('ExcelExportService', () => { beforeEach(() => { mockGridOptions.enableTranslate = true; - mockGridOptions.i18n = translateService; + mockGridOptions.translater = translateService; mockColumns = [ { id: 'id', field: 'id', excludeFromExport: true }, @@ -1333,7 +1333,7 @@ describe('ExcelExportService', () => { jest.clearAllMocks(); }); - it(`should have the LastName header title translated when defined as a "headerKey" and "i18n" is set in grid option`, async () => { + it(`should have the LastName header title translated when defined as a "headerKey" and "translater" is set in grid option`, async () => { mockGridOptions.excelExportOptions!.sanitizeDataExport = false; mockTranslateCollection = [{ id: 0, userId: '1E06', firstName: 'John', lastName: 'Z', position: 'SALES_REP', order: 10 }]; jest.spyOn(dataViewStub, 'getLength').mockReturnValue(mockTranslateCollection.length); @@ -1373,17 +1373,17 @@ describe('ExcelExportService', () => { }); }); - describe('without I18N Service', () => { + describe('without Translater Service', () => { beforeEach(() => { translateService = undefined as any; service = new ExcelExportService(); }); - it('should throw an error if "enableTranslate" is set but the I18N Service is null', () => { - const gridOptionsMock = { enableTranslate: true, enableGridMenu: true, i18n: undefined as any, gridMenu: { hideForceFitButton: false, hideSyncResizeButton: true, columnTitleKey: 'TITLE' } } as GridOption; + it('should throw an error if "enableTranslate" is set but the Translater Service is null', () => { + const gridOptionsMock = { enableTranslate: true, enableGridMenu: true, translater: undefined as any, gridMenu: { hideForceFitButton: false, hideSyncResizeButton: true, columnTitleKey: 'TITLE' } } as GridOption; jest.spyOn(gridStub, 'getOptions').mockReturnValue(gridOptionsMock); - expect(() => service.init(gridStub, sharedService)).toThrowError('[Slickgrid-Universal] requires a Translate Service to be passed in the "i18n" Grid Options when "enableTranslate" is enabled.'); + expect(() => service.init(gridStub, sharedService)).toThrowError('[Slickgrid-Universal] requires a Translate Service to be passed in the "translater" Grid Options when "enableTranslate" is enabled.'); }); }); }); diff --git a/packages/excel-export/src/excelExport.service.ts b/packages/excel-export/src/excelExport.service.ts index 0eca6abbd..f1ee7d8a2 100644 --- a/packages/excel-export/src/excelExport.service.ts +++ b/packages/excel-export/src/excelExport.service.ts @@ -82,10 +82,10 @@ export class ExcelExportService implements BaseExcelExportService { // get locales provided by user in main file or else use default English locales via the Constants this._locales = this._gridOptions?.locales ?? Constants.locales; - this._translaterService = this._gridOptions?.i18n; + this._translaterService = this._gridOptions?.translater; if (this._gridOptions.enableTranslate && (!this._translaterService || !this._translaterService.translate)) { - throw new Error('[Slickgrid-Universal] requires a Translate Service to be passed in the "i18n" Grid Options when "enableTranslate" is enabled. (example: this.gridOptions = { enableTranslate: true, i18n: this.translaterService })'); + throw new Error('[Slickgrid-Universal] requires a Translate Service to be passed in the "translater" Grid Options when "enableTranslate" is enabled. (example: this.gridOptions = { enableTranslate: true, translater: this.translaterService })'); } } diff --git a/packages/file-export/src/fileExport.service.spec.ts b/packages/file-export/src/fileExport.service.spec.ts index 994d5118d..91ca631e8 100644 --- a/packages/file-export/src/fileExport.service.spec.ts +++ b/packages/file-export/src/fileExport.service.spec.ts @@ -75,11 +75,11 @@ describe('ExportService', () => { let mockCsvBlob: Blob; let mockTxtBlob: Blob; - describe('with I18N Service', () => { + describe('with Translater Service', () => { beforeEach(() => { sharedService = new SharedService(); translateService = new TranslateServiceStub(); - mockGridOptions.i18n = translateService; + mockGridOptions.translater = translateService; sharedService.internalPubSubService = pubSubServiceStub; (navigator as any).__defineGetter__('appName', () => 'Netscape'); @@ -544,7 +544,7 @@ describe('ExportService', () => { beforeEach(() => { mockGridOptions.enableTranslate = true; - mockGridOptions.i18n = translateService; + mockGridOptions.translater = translateService; mockColumns = [ { id: 'id', field: 'id', excludeFromExport: true }, @@ -562,7 +562,7 @@ describe('ExportService', () => { jest.clearAllMocks(); }); - it(`should have the LastName header title translated when defined as a "headerKey" and "i18n" is set in grid option`, (done) => { + it(`should have the LastName header title translated when defined as a "headerKey" and "translater" is set in grid option`, (done) => { mockGridOptions.exportOptions!.sanitizeDataExport = false; mockCollection = [{ id: 0, userId: '1E06', firstName: 'John', lastName: 'Z', position: 'SALES_REP', order: 10 }]; jest.spyOn(dataViewStub, 'getLength').mockReturnValue(mockCollection.length); @@ -1001,7 +1001,7 @@ describe('ExportService', () => { beforeEach(() => { mockGridOptions.enableTranslate = true; - mockGridOptions.i18n = translateService; + mockGridOptions.translater = translateService; mockColumns = [ { id: 'id', field: 'id', excludeFromExport: true }, @@ -1018,7 +1018,7 @@ describe('ExportService', () => { jest.clearAllMocks(); }); - it(`should have the LastName header title translated when defined as a "headerKey" and "i18n" is set in grid option`, (done) => { + it(`should have the LastName header title translated when defined as a "headerKey" and "translater" is set in grid option`, (done) => { mockGridOptions.exportOptions!.sanitizeDataExport = false; mockTranslateCollection = [{ id: 0, userId: '1E06', firstName: 'John', lastName: 'Z', position: 'SALES_REP', order: 10 }]; jest.spyOn(dataViewStub, 'getLength').mockReturnValue(mockTranslateCollection.length); @@ -1047,17 +1047,17 @@ describe('ExportService', () => { }); }); - describe('without I18N Service', () => { + describe('without Translater Service', () => { beforeEach(() => { translateService = undefined as any; service = new FileExportService(); }); - it('should throw an error if "enableTranslate" is set but the I18N Service is null', () => { - const gridOptionsMock = { enableTranslate: true, enableGridMenu: true, i18n: undefined as any, gridMenu: { hideForceFitButton: false, hideSyncResizeButton: true, columnTitleKey: 'TITLE' } } as GridOption; + it('should throw an error if "enableTranslate" is set but the Translater Service is null', () => { + const gridOptionsMock = { enableTranslate: true, enableGridMenu: true, translater: undefined as any, gridMenu: { hideForceFitButton: false, hideSyncResizeButton: true, columnTitleKey: 'TITLE' } } as GridOption; jest.spyOn(gridStub, 'getOptions').mockReturnValue(gridOptionsMock); - expect(() => service.init(gridStub, sharedService)).toThrowError('[Slickgrid-Universal] requires a Translate Service to be passed in the "i18n" Grid Options when "enableTranslate" is enabled.'); + expect(() => service.init(gridStub, sharedService)).toThrowError('[Slickgrid-Universal] requires a Translate Service to be passed in the "translater" Grid Options when "enableTranslate" is enabled.'); }); }); }); diff --git a/packages/file-export/src/fileExport.service.ts b/packages/file-export/src/fileExport.service.ts index 561e071a8..a4522fdf5 100644 --- a/packages/file-export/src/fileExport.service.ts +++ b/packages/file-export/src/fileExport.service.ts @@ -69,10 +69,10 @@ export class FileExportService implements BaseFileExportService { // get locales provided by user in main file or else use default English locales via the Constants this._locales = this._gridOptions && this._gridOptions.locales || Constants.locales; - this._translaterService = this._gridOptions?.i18n; + this._translaterService = this._gridOptions?.translater; if (this._gridOptions.enableTranslate && (!this._translaterService || !this._translaterService.translate)) { - throw new Error('[Slickgrid-Universal] requires a Translate Service to be passed in the "i18n" Grid Options when "enableTranslate" is enabled. (example: this.gridOptions = { enableTranslate: true, i18n: this.translaterService })'); + throw new Error('[Slickgrid-Universal] requires a Translate Service to be passed in the "translater" Grid Options when "enableTranslate" is enabled. (example: this.gridOptions = { enableTranslate: true, translater: this.translaterService })'); } } diff --git a/packages/graphql/src/interfaces/graphqlResult.interface.ts b/packages/graphql/src/interfaces/graphqlResult.interface.ts index 7ff486f52..cc733af5c 100644 --- a/packages/graphql/src/interfaces/graphqlResult.interface.ts +++ b/packages/graphql/src/interfaces/graphqlResult.interface.ts @@ -1,8 +1,8 @@ import { Metrics } from '@slickgrid-universal/common'; -export interface GraphqlResult { +export interface GraphqlResult { data: { - [datasetName: string]: any[]; + [datasetName: string]: T[]; }; /** Some metrics of the last executed query (startTime, endTime, executionTime, itemCount, totalItemCount) */ diff --git a/packages/graphql/src/services/__tests__/graphql.service.spec.ts b/packages/graphql/src/services/__tests__/graphql.service.spec.ts index 8ae003bbc..c506f00f1 100644 --- a/packages/graphql/src/services/__tests__/graphql.service.spec.ts +++ b/packages/graphql/src/services/__tests__/graphql.service.spec.ts @@ -334,7 +334,7 @@ describe('GraphqlService', () => { gridOptionMock.enablePagination = true; // reset it for the next test }); - it('should include default locale "en" in the query string when option "addLocaleIntoQuery" is enabled and i18n is not defined', () => { + it('should include default locale "en" in the query string when option "addLocaleIntoQuery" is enabled and translater is not defined', () => { const expectation = `query{ users(first:10, offset:0, locale: "en"){ totalCount, nodes{ id, field1, field2 }}}`; const columns = [{ id: 'field1', field: 'field1', width: 100 }, { id: 'field2', field: 'field2', width: 100 }]; jest.spyOn(gridStub, 'getColumns').mockReturnValue(columns); @@ -350,7 +350,7 @@ describe('GraphqlService', () => { const columns = [{ id: 'field1', field: 'field1', width: 100 }, { id: 'field2', field: 'field2', width: 100 }]; jest.spyOn(gridStub, 'getColumns').mockReturnValue(columns); - gridOptionMock.i18n = { getCurrentLanguage: () => 'fr-CA' } as TranslaterService; + gridOptionMock.translater = { getCurrentLanguage: () => 'fr-CA' } as TranslaterService; service.init({ datasetName: 'users', addLocaleIntoQuery: true }, paginationOptions, gridStub); const query = service.buildQuery(); diff --git a/packages/graphql/src/services/graphql.service.ts b/packages/graphql/src/services/graphql.service.ts index 8d1ebbb7b..bcd806eba 100644 --- a/packages/graphql/src/services/graphql.service.ts +++ b/packages/graphql/src/services/graphql.service.ts @@ -160,7 +160,7 @@ export class GraphqlService implements BackendService { } if (this.options.addLocaleIntoQuery) { // first: 20, ... locale: "en-CA" - datasetFilters.locale = this._gridOptions.i18n && this._gridOptions.i18n.getCurrentLanguage() || this._gridOptions.locale || 'en'; + datasetFilters.locale = this._gridOptions.translater?.getCurrentLanguage() || this._gridOptions.locale || 'en'; } if (this.options.extraQueryArguments) { // first: 20, ... userId: 123 diff --git a/packages/vanilla-bundle/src/components/slick-vanilla-grid-bundle.ts b/packages/vanilla-bundle/src/components/slick-vanilla-grid-bundle.ts index ab1a791b7..e4b39dc19 100644 --- a/packages/vanilla-bundle/src/components/slick-vanilla-grid-bundle.ts +++ b/packages/vanilla-bundle/src/components/slick-vanilla-grid-bundle.ts @@ -292,8 +292,8 @@ export class SlickVanillaGridBundle { this._gridOptions = this.mergeGridOptions(options || {}); const isDeepCopyDataOnPageLoadEnabled = !!(this._gridOptions && this._gridOptions.enableDeepCopyDatasetOnPageLoad); - // if user is providing a Translate Service, it has to be passed under the "i18n" grid option - this.translaterService = services?.translaterService ?? this._gridOptions.i18n; + // if user is providing a Translate Service, it has to be passed under the "translater" grid option + this.translaterService = services?.translaterService ?? this._gridOptions.translater; // initialize and assign all Service Dependencies this._eventPubSubService = services?.eventPubSubService ?? new EventPubSubService(gridParentContainerElm); @@ -344,8 +344,8 @@ export class SlickVanillaGridBundle { this.translaterService, ); - this.gridService = services?.gridService ?? new GridService(this.extensionService, this.filterService, this._eventPubSubService, this.paginationService, this.sharedService, this.sortService); this.gridStateService = services?.gridStateService ?? new GridStateService(this.extensionService, this.filterService, this._eventPubSubService, this.sharedService, this.sortService); + this.gridService = services?.gridService ?? new GridService(this.extensionService, this.gridStateService, this.filterService, this._eventPubSubService, this.paginationService, this.sharedService, this.sortService); this.groupingService = services?.groupingAndColspanService ?? new GroupingAndColspanService(this.extensionUtility, this.extensionService, this._eventPubSubService); @@ -1033,7 +1033,7 @@ export class SlickVanillaGridBundle { /** * Dynamically change or update the column definitions list. * We will re-render the grid so that the new header and data shows up correctly. - * If using i18n, we also need to trigger a re-translate of the column headers + * If using translater, we also need to trigger a re-translate of the column headers */ updateColumnDefinitionsList(newColumnDefinitions: Column[]) { // map/swap the internal library Editor to the SlickGrid Editor factory diff --git a/packages/vanilla-bundle/src/index.spec.ts b/packages/vanilla-bundle/src/index.spec.ts index 1690c4661..6d0d80311 100644 --- a/packages/vanilla-bundle/src/index.spec.ts +++ b/packages/vanilla-bundle/src/index.spec.ts @@ -19,6 +19,7 @@ describe('Testing library entry point', () => { expect(typeof entry.Slicker.SortComparers).toBe('object'); expect(typeof entry.Slicker.Utilities).toBe('object'); expect(typeof entry.SlickCompositeEditorComponent).toBe('function'); + expect(typeof entry.SlickEmptyWarningComponent).toBe('function'); expect(typeof entry.SlickVanillaGridBundle).toBe('function'); expect(typeof entry.Aggregators).toBe('object'); expect(typeof entry.Editors).toBe('object'); diff --git a/packages/vanilla-bundle/src/index.ts b/packages/vanilla-bundle/src/index.ts index af36355d1..375c28dd4 100644 --- a/packages/vanilla-bundle/src/index.ts +++ b/packages/vanilla-bundle/src/index.ts @@ -1,5 +1,6 @@ import { Aggregators, Editors, Enums, Filters, Formatters, GroupTotalFormatters, SortComparers, Utilities } from '@slickgrid-universal/common'; import { BindingService } from './services/index'; +import { SlickEmptyWarningComponent } from './components/slick-empty-warning.component'; import { SlickCompositeEditorComponent } from './components/slick-composite-editor.component'; import { SlickVanillaGridBundle } from './components/slick-vanilla-grid-bundle'; @@ -23,7 +24,7 @@ if (typeof window !== 'undefined') { export { BindingService }; export { Aggregators, Editors, Enums, Filters, Formatters, GroupTotalFormatters, SortComparers, Utilities }; -export { SlickCompositeEditorComponent, SlickVanillaGridBundle }; // just to export the interface +export { SlickCompositeEditorComponent, SlickEmptyWarningComponent, SlickVanillaGridBundle }; // export the custom components & interface export { Slicker }; export * from './interfaces/index'; export * from './services/index';