diff --git a/.eslintrc.js b/.eslintrc.js index 6a23cb515..504322bfe 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -81,8 +81,7 @@ module.exports = { "constructor-super": "error", "dot-notation": "off", "eqeqeq": [ - "error", - "smart" + "error" ], "guard-for-in": "error", "id-blacklist": "off", diff --git a/.vscode/launch.json b/.vscode/launch.json index 351de93b0..d52f60b80 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -9,7 +9,7 @@ "type": "chrome", "request": "launch", "breakOnLoad": false, - "url": "http://localhost:8080", + "url": "http://localhost:8082", "webRoot": "${workspaceRoot}", "userDataDir": "${workspaceRoot}/.chrome", "trace": true, diff --git a/README.md b/README.md index da59647c3..fe4bb0a40 100644 --- a/README.md +++ b/README.md @@ -123,8 +123,8 @@ npm run test:watch #### Other Todos - [x] VScode Chrome Debugger - [x] Jest Debugger -- [ ] Add Multiple Example Demos with Vanilla implementation - - [ ] Add GitHub Demo website +- [x] Add Multiple Example Demos with Vanilla implementation + - [x] Add GitHub Demo website - [x] Add CI/CD (CircleCI or GitHub Actions) - [x] Add Jest Unit tests - [ ] Add Cypress E2E tests diff --git a/packages/common/src/global-grid-options.ts b/packages/common/src/global-grid-options.ts index 7d02ed614..1f89e8b40 100644 --- a/packages/common/src/global-grid-options.ts +++ b/packages/common/src/global-grid-options.ts @@ -53,7 +53,7 @@ export const GlobalGridOptions: GridOption = { iconClearGroupingCommand: 'fa fa-times mdi mdi-close', iconCopyCellValueCommand: 'fa fa-clone mdi mdi-content-copy', iconExportCsvCommand: 'fa fa-download mdi mdi-download', - iconExportExcelCommand: 'fa fa-file-excel-o text-success', + iconExportExcelCommand: 'fa fa-file-excel-o text-success has-text-success', iconExportTextDelimitedCommand: 'fa fa-download mdi mdi-download', width: 200, }, @@ -135,10 +135,10 @@ export const GlobalGridOptions: GridOption = { hideToggleFilterCommand: false, hideTogglePreHeaderCommand: false, iconCssClass: 'fa fa-bars mdi mdi-menu', - iconClearAllFiltersCommand: 'fa fa-filter text-danger mdi mdi-filter-remove-outline', - iconClearAllSortingCommand: 'fa fa-unsorted mdi mdi-swap-vertical text-danger', + iconClearAllFiltersCommand: 'fa fa-filter text-danger has-text-danger mdi mdi-filter-remove-outline', + iconClearAllSortingCommand: 'fa fa-unsorted mdi mdi-swap-vertical text-danger has-text-danger', iconExportCsvCommand: 'fa fa-download mdi mdi-download', - iconExportExcelCommand: 'fa fa-file-excel-o text-success', + iconExportExcelCommand: 'fa fa-file-excel-o text-success has-text-success', iconExportTextDelimitedCommand: 'fa fa-download mdi mdi-download', iconRefreshDatasetCommand: 'fa fa-refresh mdi mdi-sync', iconToggleFilterCommand: 'fa fa-random mdi mdi-flip-vertical', @@ -150,7 +150,7 @@ export const GlobalGridOptions: GridOption = { autoAlign: true, autoAlignOffset: 12, minWidth: 140, - iconClearFilterCommand: 'fa fa-filter mdi mdi mdi-filter-remove-outline text-danger', + iconClearFilterCommand: 'fa fa-filter mdi mdi mdi-filter-remove-outline text-danger has-text-danger', iconClearSortCommand: 'fa fa-unsorted mdi mdi-swap-vertical', iconSortAscCommand: 'fa fa-sort-amount-asc mdi mdi-sort-ascending', iconSortDescCommand: 'fa fa-sort-amount-desc mdi mdi-sort-descending', diff --git a/packages/common/src/interfaces/gridOption.interface.ts b/packages/common/src/interfaces/gridOption.interface.ts index 4e9dfee6f..40f4b18e0 100644 --- a/packages/common/src/interfaces/gridOption.interface.ts +++ b/packages/common/src/interfaces/gridOption.interface.ts @@ -457,6 +457,12 @@ export interface GridOption { /** What is the top panel height in pixels (only type the number) */ topPanelHeight?: number; + /** Tree View options */ + treeViewOptions?: { + /** Column field property id associated to the tree view, in other words, which field in the dataaset is associated to the three column displayed */ + fieldId: string; + } + /** Defaults to false, when set to True will lead to multiple columns sorting without the need to hold or do shift-click to execute a multiple sort. */ tristateMultiColumnSort?: boolean; diff --git a/packages/common/src/services/utilities.ts b/packages/common/src/services/utilities.ts index 6e14fdc56..0de253fa7 100644 --- a/packages/common/src/services/utilities.ts +++ b/packages/common/src/services/utilities.ts @@ -81,27 +81,29 @@ export function convertArrayHierarchicalToFlat(hierarchicalArray: any[], options const inputArray = $.extend(true, [], hierarchicalArray); // make a deep copy of the input array to avoid modifying that array convertArrayHierarchicalToFlatByOutputArrayReference(inputArray, outputArray, options, 0); - console.log(outputArray.map(itm => ({ __treeLevel: itm.__treeLevel, title: itm.title }))); + // the output array is the one passed as reference return outputArray; } -export function convertArrayHierarchicalToFlatByOutputArrayReference(hierarchicalArray: any[], outputArray: any[], options?: { childPropName?: string; hasChildrenFlagPropName?: string; treeLevelPropName?: string; identifierPropName?: string; reevaluateTreeLevel?: boolean; }, treeLevel = 0) { +export function convertArrayHierarchicalToFlatByOutputArrayReference(hierarchicalArray: any[], outputArray: any[], options?: { childPropName?: string; parentIdPropName?: string; hasChildrenFlagPropName?: string; treeLevelPropName?: string; identifierPropName?: string; reevaluateTreeLevel?: boolean; }, treeLevel = 0, parentId?: string) { const childPropName = options?.childPropName || 'children'; const identifierPropName = options?.identifierPropName || 'id'; const hasChildrenFlagPropName = options?.hasChildrenFlagPropName || '__hasChildren'; const treeLevelPropName = options?.treeLevelPropName || '__treeLevel'; + const parentIdPropName = options?.parentIdPropName || '__parentId'; for (const item of hierarchicalArray) { if (item) { const itemExist = outputArray.find((itm: any) => itm[identifierPropName] === item[identifierPropName]); if (!itemExist) { item[treeLevelPropName] = treeLevel; // save tree level ref + item[parentIdPropName] = parentId || null; outputArray.push(item); } if (Array.isArray(item[childPropName])) { treeLevel++; - convertArrayHierarchicalToFlatByOutputArrayReference(item[childPropName], outputArray, options, treeLevel); + convertArrayHierarchicalToFlatByOutputArrayReference(item[childPropName], outputArray, options, treeLevel, item[identifierPropName]); treeLevel--; item[hasChildrenFlagPropName] = true; delete item[childPropName]; // remove the children property diff --git a/packages/vanilla-bundle-examples/index.ejs b/packages/vanilla-bundle-examples/index.ejs index cdebf1c0e..b7facd853 100644 --- a/packages/vanilla-bundle-examples/index.ejs +++ b/packages/vanilla-bundle-examples/index.ejs @@ -4,7 +4,6 @@ <%- htmlWebpackPlugin.options.metadata.title %> - diff --git a/packages/vanilla-bundle-examples/package.json b/packages/vanilla-bundle-examples/package.json index 96c08ced0..07270d093 100644 --- a/packages/vanilla-bundle-examples/package.json +++ b/packages/vanilla-bundle-examples/package.json @@ -6,6 +6,7 @@ "src": "src" }, "scripts": { + "build:prod": "webpack --env.production --extractCss", "dev:watch": "webpack-dev-server --env.server --extractCss", "test": "echo testing slickgrid-universal demo code" }, @@ -26,6 +27,7 @@ "dependencies": { "@slickgrid-universal/common": "^0.0.2", "@slickgrid-universal/vanilla-bundle": "^0.0.2", + "bulma": "^0.8.1", "moment-mini": "^2.24.0" }, "devDependencies": { @@ -33,6 +35,7 @@ "@types/moment": "^2.13.0", "@types/node": "^12.12.32", "@types/webpack": "^4.41.8", + "clean-webpack-plugin": "^3.0.0", "copy-webpack-plugin": "^5.1.1", "css-loader": "^3.4.2", "html-loader": "^1.0.0", diff --git a/packages/vanilla-bundle-examples/src/app-routing.ts b/packages/vanilla-bundle-examples/src/app-routing.ts index d3aa63d5a..5fdd075af 100644 --- a/packages/vanilla-bundle-examples/src/app-routing.ts +++ b/packages/vanilla-bundle-examples/src/app-routing.ts @@ -2,7 +2,7 @@ import { RouterConfig } from './interfaces'; export class AppRouting { constructor(config: RouterConfig) { - config.pushState = true; + config.pushState = false; config.routes = [ { route: 'example01', name: 'example01', title: 'Example01', moduleId: './examples/example01' }, { route: 'example02', name: 'example02', title: 'Example02', moduleId: './examples/example02' }, diff --git a/packages/vanilla-bundle-examples/src/app.html b/packages/vanilla-bundle-examples/src/app.html index 9796ae698..8f5db1f22 100644 --- a/packages/vanilla-bundle-examples/src/app.html +++ b/packages/vanilla-bundle-examples/src/app.html @@ -1,20 +1,20 @@