Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiscoding committed Oct 14, 2023
2 parents 93308ef + d7cce39 commit eb2abac
Show file tree
Hide file tree
Showing 60 changed files with 1,275 additions and 608 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ body:
id: system-info
attributes:
label: Environment Info
description: versions number of each frameworks and libs (Slickgrid-Universal/[packageName], TypeScript)
description: output of `npx envinfo --system --npmPackages 'slickgrid-universal/*' --binaries --browsers`
render: shell
placeholder: |
Framework used (x.y)
Expand Down Expand Up @@ -73,4 +73,4 @@ body:
- label: Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/ghiscoding/slickgrid-universal/discussions).
required: true
- label: The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.
required: true
required: true
2 changes: 1 addition & 1 deletion .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
wait-on: 'http://localhost:8888'
config-file: test/cypress.config.ts
browser: chrome
record: true
record: false
env:
# pass the Dashboard record key as an environment variable
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: CI Build & Jest Unit Tests
# CI Build & Jest Unit Tests (ship smaller name for CI badge)
name: CI Build & Tests
on:
# Trigger the workflow on push or pull request,
# but only for the master branch on Push and any branches on PR
Expand Down Expand Up @@ -72,13 +73,13 @@ jobs:
run: pnpm bundle

- name: Run Jest unit tests
if: "!contains(github.event.head_commit.message, 'chore(release)')"
if: ${{ !contains(github.event.head_commit.message, 'chore(release)') }}
run: pnpm test:ci

- name: Upload Jest coverage to Codecov
if: "!contains(github.event.head_commit.message, 'chore(release)')"
if: ${{ !contains(github.event.head_commit.message, 'chore(release)') }}
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: test/jest-coverage
verbose: true
verbose: true
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,29 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [3.3.2](https://github.com/ghiscoding/slickgrid-universal/compare/v3.3.1...v3.3.2) (2023-10-06)

### Bug Fixes

* **graphql:** column with complex object could throw null pointer exception ([#1130](https://github.com/ghiscoding/slickgrid-universal/issues/1130)) ([f3c85b8](https://github.com/ghiscoding/slickgrid-universal/commit/f3c85b86d3423591844f8bbb2844f7842fefdfa3)) - by @Harsgalt86

## [3.3.1](https://github.com/ghiscoding/slickgrid-universal/compare/v3.3.0...v3.3.1) (2023-10-05)

### Reverts

* Revert "feat: add option to cancel Row Detail opening (#1125)" (#1127) ([5e4b14a](https://github.com/ghiscoding/slickgrid-universal/commit/5e4b14a15e7933d0699ef4c11d6336e76f1af597)), closes [#1125](https://github.com/ghiscoding/slickgrid-universal/issues/1125) [#1127](https://github.com/ghiscoding/slickgrid-universal/issues/1127) - by @ghiscoding

# [3.3.0](https://github.com/ghiscoding/slickgrid-universal/compare/v3.2.2...v3.3.0) (2023-10-05)

### Bug Fixes

* **types:** small TS type fix on DataView setFilter ([1ab0930](https://github.com/ghiscoding/slickgrid-universal/commit/1ab0930213e68110e22b6f89681c4651586c9420)) - by @ghiscoding

### Features

* add option to cancel Row Detail opening ([#1125](https://github.com/ghiscoding/slickgrid-universal/issues/1125)) ([82ba377](https://github.com/ghiscoding/slickgrid-universal/commit/82ba377132d90335ea2bca5bf628ab47841fc913)) - by @ghiscoding
* add pageUp/pageDown/home/end to SlickCellSelection ([#1126](https://github.com/ghiscoding/slickgrid-universal/issues/1126)) ([b7e9e0d](https://github.com/ghiscoding/slickgrid-universal/commit/b7e9e0db9fde184c76cb835858d195ad28657b05)) - by @ghiscoding

## [3.2.2](https://github.com/ghiscoding/slickgrid-universal/compare/v3.2.1...v3.2.2) (2023-09-24)

### Bug Fixes
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![NPM downloads](https://img.shields.io/npm/dy/@slickgrid-universal/common.svg)](https://www.npmjs.com/package/@slickgrid-universal/common)
[![npm](https://img.shields.io/npm/v/@slickgrid-universal/common.svg?logo=npm&logoColor=fff&label=npm)](https://www.npmjs.com/package/@slickgrid-universal/common)

[![Actions Status](https://github.com/ghiscoding/slickgrid-universal/workflows/CI%20Build/badge.svg)](https://github.com/ghiscoding/slickgrid-universal/actions)
[![Actions Status](https://github.com/ghiscoding/slickgrid-universal/actions/workflows/main.yml/badge.svg)](https://github.com/ghiscoding/slickgrid-universal/actions)
[![Cypress.io](https://img.shields.io/badge/tested%20with-Cypress-04C38E.svg?logo=cypress)](https://www.cypress.io/)
[![jest](https://jestjs.io/img/jest-badge.svg)](https://github.com/facebook/jest)
[![codecov](https://codecov.io/gh/ghiscoding/slickgrid-universal/branch/master/graph/badge.svg)](https://codecov.io/gh/ghiscoding/slickgrid-universal)
Expand All @@ -15,7 +15,7 @@
This is a monorepo project (using [pnpm workspaces](https://pnpm.io/workspaces)) which is regrouping a few packages under a single repository. It is using and requiring SlickGrid core library (more specifically the [6pac/SlickGrid](https://github.com/6pac/SlickGrid/) fork) and behind the scene (the "Why?" is simply because there is no need to rewrite the core library itself, in other words this is a wrapper library). The main goal of this library is to create a common repo that includes all Editors, Filters, Extensions and Services that could be used by any Framework (it is framework agnostic). The original SlickGrid is like an IKEA product that requires assembling everything yourself, however in this project here, we offer an all assembled product including a lot more available Editors, Filters, OData, GraphQL, ... and SlickGrid simply does not offer that by default. See below for more project details.

### Why create this monorepo?
You might be wondering why was this monorepo created? Here are a few reasons:
Below is a list of reasons why this project was created and why it is a monorepo project:
1. it removed a lot of duplicate code that were common in both
[Angular-Slickgrid](https://github.com/ghiscoding/Angular-Slickgrid) and [Aurelia-Slickgrid](https://github.com/ghiscoding/aurelia-slickgrid) libraries
- prior to creating this monorepo, these 2 libs had ~90% of TypeScript code in common which was not very DRY, it is also a lot easier to maintain by pushing fixes in 1 common lib (this one here).
Expand Down
10 changes: 10 additions & 0 deletions examples/vite-demo-vanilla-bundle/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [3.3.2](https://github.com/ghiscoding/slickgrid-universal/compare/v3.3.1...v3.3.2) (2023-10-06)

**Note:** Version bump only for package slickgrid-universal-vite-demo

# [3.3.0](https://github.com/ghiscoding/slickgrid-universal/compare/v3.2.2...v3.3.0) (2023-10-05)

### Features

* add pageUp/pageDown/home/end to SlickCellSelection ([#1126](https://github.com/ghiscoding/slickgrid-universal/issues/1126)) ([b7e9e0d](https://github.com/ghiscoding/slickgrid-universal/commit/b7e9e0db9fde184c76cb835858d195ad28657b05)) - by @ghiscoding

## [3.2.2](https://github.com/ghiscoding/slickgrid-universal/compare/v3.2.1...v3.2.2) (2023-09-24)

### Bug Fixes
Expand Down
10 changes: 5 additions & 5 deletions examples/vite-demo-vanilla-bundle/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "slickgrid-universal-vite-demo",
"private": true,
"version": "3.2.2",
"version": "3.3.2",
"scripts": {
"build": "tsc && vite build",
"preview": "vite preview",
Expand All @@ -23,7 +23,7 @@
"@slickgrid-universal/vanilla-bundle": "workspace:~",
"@slickgrid-universal/vanilla-force-bundle": "workspace:~",
"bulma": "^0.9.4",
"dompurify": "^3.0.5",
"dompurify": "^3.0.6",
"fetch-jsonp": "^1.3.0",
"flatpickr": "^4.6.13",
"moment-mini": "^2.29.4",
Expand All @@ -33,10 +33,10 @@
},
"devDependencies": {
"@types/fnando__sparkline": "^0.3.5",
"@types/node": "^20.6.3",
"@types/node": "^20.8.6",
"@types/whatwg-fetch": "^0.0.33",
"sass": "^1.68.0",
"sass": "^1.69.3",
"typescript": "^5.2.2",
"vite": "^4.4.9"
"vite": "^4.4.11"
}
}
2 changes: 2 additions & 0 deletions examples/vite-demo-vanilla-bundle/src/app-routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import Example15 from './examples/example15';
import Example16 from './examples/example16';
import Example17 from './examples/example17';
import Example18 from './examples/example18';
import Example19 from './examples/example19';

export class AppRouting {
constructor(private config: RouterConfig) {
Expand All @@ -43,6 +44,7 @@ export class AppRouting {
{ route: 'example16', name: 'example16', view: './examples/example16.html', viewModel: Example16, title: 'Example16', },
{ route: 'example17', name: 'example17', view: './examples/example17.html', viewModel: Example17, title: 'Example17', },
{ route: 'example18', name: 'example18', view: './examples/example18.html', viewModel: Example18, title: 'Example18', },
{ route: 'example19', name: 'example19', view: './examples/example19.html', viewModel: Example19, title: 'Example19', },
{ route: '', redirect: 'example01' },
{ route: '**', redirect: 'example01' }
];
Expand Down
3 changes: 3 additions & 0 deletions examples/vite-demo-vanilla-bundle/src/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ <h4 class="title is-4 has-text-white">Slickgrid-Universal</h4>
<a class="navbar-item" onclick.delegate="loadRoute('example18')">
Example18 - Real-Time Trading Platform
</a>
<a class="navbar-item" onclick.delegate="loadRoute('example19')">
Example19 - ExcelCopyBuffer with Cell Selection
</a>
</div>
</div>
</div>
Expand Down
27 changes: 27 additions & 0 deletions examples/vite-demo-vanilla-bundle/src/examples/example19.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<h3 class="title is-3">
Example 19 - ExcelCopyBuffer with Cell Selection
<span class="subtitle">(with Salesforce Theme)</span>
<div class="subtitle" style="float: right; margin-top: -20px">
<span class="is-size-6">see</span>
<a class="is-size-5" target="_blank"
href="https://github.com/ghiscoding/slickgrid-universal/blob/master/examples/vite-demo-vanilla-bundle/src/examples/example19.ts">
<span class="mdi mdi-link-variant mdi-v-align-sub"></span> code
</a>
</div>
</h3>

<h5 class="title is-5 mb-3">
Grid - using <code>enableExcelCopyBuffer</code> which uses <code>SlickCellSelectionModel</code>
</h5>
<h6 class="title is-6">
<button class="button is-small is-primary" onclick.delegate="togglePagination()"
data-text="toggle-pagination-btn">
<span class="icon mdi mdi-swap-vertical"></span>
<span>Toggle Pagination</span>
</button>
<label class="ml-3">Range Selection</label>
<span id="selectionRange"></span>
</h6>

<div class="grid19">
</div>
10 changes: 10 additions & 0 deletions examples/vite-demo-vanilla-bundle/src/examples/example19.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/** override slick-cell to make it look like Excel sheet */
.grid19 {
--slick-border-color: #d4d4d4;
--slick-cell-odd-background-color: #fbfbfb;
--slick-cell-border-left: 1px solid var(--slick-border-color);
--slick-header-menu-display: none;
--slick-header-column-height: 20px;
--slick-grid-border-color: #d4d4d4;
--slick-row-selected-color: #d4ebfd;
}
132 changes: 132 additions & 0 deletions examples/vite-demo-vanilla-bundle/src/examples/example19.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
import { CellRange, Column, GridOption, SlickEventHandler, SlickNamespace, } from '@slickgrid-universal/common';
import { Slicker, SlickVanillaGridBundle } from '@slickgrid-universal/vanilla-bundle';
import { ExampleGridOptions } from './example-grid-options';
import '../salesforce-styles.scss';
import './example19.scss';

const NB_ITEMS = 100;
declare const Slick: SlickNamespace;
export default class Example34 {
protected _eventHandler: SlickEventHandler;
title = 'Example 19: ExcelCopyBuffer with Cell Selection';
subTitle = `Cell Selection using "Shift+{key}" where "key" can be any of:
<ul>
<li>Arrow Up/Down/Left/Right</li>
<li>Page Up/Down</li>
<li>Home</li>
<li>End</li>
</ul>`;

columnDefinitions: Column[] = [];
dataset: any[] = [];
gridOptions!: GridOption;
gridContainerElm: HTMLDivElement;
isWithPagination = true;
sgb: SlickVanillaGridBundle;

attached() {
this._eventHandler = new Slick.EventHandler();

// define the grid options & columns and then create the grid itself
this.defineGrid();

// mock some data (different in each dataset)
this.dataset = this.getData(NB_ITEMS);
this.gridContainerElm = document.querySelector<HTMLDivElement>(`.grid19`) as HTMLDivElement;
this.sgb = new Slicker.GridBundle(document.querySelector(`.grid19`) as HTMLDivElement, this.columnDefinitions, { ...ExampleGridOptions, ...this.gridOptions }, this.dataset);
document.body.classList.add('salesforce-theme');

// bind any of the grid events
const cellSelectionModel = this.sgb.slickGrid!.getSelectionModel();
this._eventHandler.subscribe(cellSelectionModel!.onSelectedRangesChanged, (_e, args: CellRange[]) => {
const targetRange = document.querySelector('#selectionRange') as HTMLSpanElement;
targetRange.textContent = '';

for (const slickRange of args) {
targetRange.textContent += JSON.stringify(slickRange);
}
});
}

dispose() {
this._eventHandler.unsubscribeAll();
this.sgb?.dispose();
this.gridContainerElm.remove();
document.body.classList.remove('salesforce-theme');
}

/* Define grid Options and Columns */
defineGrid() {
this.columnDefinitions = [
{
id: 'selector',
name: '',
field: 'num',
width: 30
}
];

for (let i = 0; i < NB_ITEMS; i++) {
this.columnDefinitions.push({
id: i,
name: i < 26
? String.fromCharCode('A'.charCodeAt(0) + (i % 26))
: String.fromCharCode('A'.charCodeAt(0) + ((i / 26) | 0) -1) + String.fromCharCode('A'.charCodeAt(0) + (i % 26)),
field: i as any,
minWidth: 60,
width: 60,
});
}

this.gridOptions = {
autoResize: {
container: '.demo-container',
},
enableCellNavigation: true,
enablePagination: true,
pagination: {
pageSizes: [5, 10, 15, 20, 25, 50, 75, 100],
pageSize: 20
},
headerRowHeight: 35,
rowHeight: 30,

// when using the ExcelCopyBuffer, you can see what the selection range is
enableExcelCopyBuffer: true,
// excelCopyBufferOptions: {
// onCopyCells: (e, args: { ranges: SelectedRange[] }) => console.log('onCopyCells', args.ranges),
// onPasteCells: (e, args: { ranges: SelectedRange[] }) => console.log('onPasteCells', args.ranges),
// onCopyCancelled: (e, args: { ranges: SelectedRange[] }) => console.log('onCopyCancelled', args.ranges),
// }
};
}

getData(itemCount: number) {
// mock a dataset
const datasetTmp: any[] = [];
for (let i = 0; i < itemCount; i++) {
const d: any = (datasetTmp[i] = {});
d['id'] = i;
d['num'] = i;
}

return datasetTmp;
}

generatePhoneNumber(): string {
let phone = '';
for (let i = 0; i < 10; i++) {
phone += Math.round(Math.random() * 9) + '';
}
return phone;
}

// Toggle the Grid Pagination
// IMPORTANT, the Pagination MUST BE CREATED on initial page load before you can start toggling it
// Basically you cannot toggle a Pagination that doesn't exist (must created at the time as the grid)
togglePagination() {
this.isWithPagination = !this.isWithPagination;
this.sgb.paginationService!.togglePaginationVisibility(this.isWithPagination);
this.sgb.slickGrid!.setSelectedRows([]);
}
}
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "node_modules/@lerna-lite/cli/schemas/lerna-schema.json",
"version": "3.2.2",
"version": "3.3.2",
"npmClient": "pnpm",
"loglevel": "info",
"command": {
Expand Down
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"node": ">=16.15.0",
"npm": ">=8.5.0"
},
"packageManager": "pnpm@8.7.6",
"packageManager": "pnpm@8.9.0",
"pnpm": {
"overrides": {
"json5@<1.0.2": ">=1.0.2",
Expand All @@ -70,25 +70,25 @@
"@lerna-lite/run": "^2.5.1",
"@lerna-lite/watch": "^2.5.1",
"@types/jest": "^29.5.5",
"@types/node": "^20.6.3",
"@typescript-eslint/eslint-plugin": "^6.7.2",
"@typescript-eslint/parser": "^6.7.2",
"@types/node": "^20.8.6",
"@typescript-eslint/eslint-plugin": "^6.7.5",
"@typescript-eslint/parser": "^6.7.5",
"cross-env": "^7.0.3",
"cypress": "^13.2.0",
"cypress": "^13.3.1",
"dotenv": "^16.3.1",
"eslint": "^8.50.0",
"eslint": "^8.51.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-prefer-arrow": "^1.2.3",
"jest": "^29.7.0",
"jest-cli": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jest-extended": "^4.0.1",
"jest-extended": "^4.0.2",
"jsdom": "^22.1.0",
"jsdom-global": "^3.0.2",
"moment-mini": "^2.29.4",
"npm-run-all2": "^6.0.6",
"pnpm": "^8.7.6",
"rimraf": "^5.0.1",
"npm-run-all2": "^6.1.1",
"pnpm": "^8.9.0",
"rimraf": "^5.0.5",
"rxjs": "^7.8.1",
"servor": "^4.0.2",
"slickgrid": "^4.0.1",
Expand Down
Loading

0 comments on commit eb2abac

Please sign in to comment.