Skip to content

Commit

Permalink
feat(salesforce): add Excel Export to Salesforce & upgrade zip to 2.x (
Browse files Browse the repository at this point in the history
…#862)

* feat(salesforce): add Excel Export to Salesforce & upgrade zip to 2.x
- rebuild vanilla zip file to Slickgrid-Universal 2.x and add new required SortableJS zip file in external lib
- fix excel-builder-webpacker import so that it works also in Salesforce via the default import
- add Excel Export to the Vanilla-Force-Bundle for Salesforce, while also keeping the CSV export as well
  • Loading branch information
ghiscoding committed Jan 6, 2023
1 parent c28a3d4 commit 80ff4b7
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/excel-export/src/excelExport.service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import * as ExcelBuilder from 'excel-builder-webpacker';
import * as ExcelBuilder_ from 'excel-builder-webpacker';
const ExcelBuilder = (ExcelBuilder_ as any)['default'] || ExcelBuilder_; // patch to fix rollup "ExcelBuilder has no default export" issue, document here https://github.com/rollup/rollup/issues/670

import {
// utility functions
exportWithFormatterWhenDefined,
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions packages/vanilla-force-bundle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"@slickgrid-universal/custom-tooltip-plugin": "workspace:~",
"@slickgrid-universal/empty-warning-component": "workspace:~",
"@slickgrid-universal/event-pub-sub": "workspace:~",
"@slickgrid-universal/excel-export": "workspace:~",
"@slickgrid-universal/pagination-component": "workspace:~",
"@slickgrid-universal/text-export": "workspace:~",
"@slickgrid-universal/utils": "workspace:~",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ describe('Vanilla-Force-Grid-Bundle Component instantiated via Constructor', ()

expect(TextExportService).toHaveBeenCalled();
expect(SlickCustomTooltip).toHaveBeenCalled();
expect(component.registeredResources.length).toBe(5); // TextExportService, SlickCustomTooltip, GridService, GridStateService, SlickEmptyCompositeEditorComponent
expect(component.registeredResources.length).toBe(6); // ExcelExportService, TextExportService, SlickCustomTooltip, GridService, GridStateService, SlickEmptyCompositeEditorComponent
});

it('should add RxJS resource to all necessary Services when RxJS external resource is registered', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ export const SalesforceGlobalGridOptions = {
customTooltip: {
tooltipTextMaxLength: 650,
},
enableExcelExport: true,
excelExportOptions: {
mimeType: '', // Salesforce doesn't like Excel MIME type (not allowed), but we can bypass the problem by using no type at all
sanitizeDataExport: true
},
filterTypingDebounce: 250,
formatterOptions: {
minDecimal: 0,
Expand Down
4 changes: 4 additions & 0 deletions packages/vanilla-force-bundle/src/vanilla-force-bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
TreeDataService,
} from '@slickgrid-universal/common';
import { EventPubSubService } from '@slickgrid-universal/event-pub-sub';
import { ExcelExportService } from '@slickgrid-universal/excel-export';
import { SlickCompositeEditorComponent } from '@slickgrid-universal/composite-editor-component';
import { SlickEmptyWarningComponent } from '@slickgrid-universal/empty-warning-component';
import { SlickCustomTooltip } from '@slickgrid-universal/custom-tooltip-plugin';
Expand Down Expand Up @@ -110,6 +111,9 @@ export class VanillaForceGridBundle extends SlickVanillaGridBundle {
if (this.gridOptions.enableTextExport) {
this._registeredResources.push(new TextExportService());
}
if (this.gridOptions.enableTextExport) {
this._registeredResources.push(new ExcelExportService());
}
this._registeredResources.push(new SlickCustomTooltip());

// at this point, we consider all the registered services as external services, anything else registered afterward aren't external
Expand Down
2 changes: 2 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 80ff4b7

Please sign in to comment.