diff --git a/docs/TOC.md b/docs/TOC.md index ffbb77874..44b1695b1 100644 --- a/docs/TOC.md +++ b/docs/TOC.md @@ -76,3 +76,4 @@ * [Migration Guide to 2.x](migrations/migration-to-2.x.md) * [Migration Guide to 3.x](migrations/migration-to-3.x.md) * [Migration Guide to 4.x](migrations/migration-to-4.x.md) +* [Migration Guide to 5.x](migrations/migration-to-5.x.md) diff --git a/docs/column-functionalities/Cell-Menu.md b/docs/column-functionalities/Cell-Menu.md index 48983d58f..4afffbfd1 100644 --- a/docs/column-functionalities/Cell-Menu.md +++ b/docs/column-functionalities/Cell-Menu.md @@ -38,7 +38,7 @@ this.columnDefinitions = [ console.log(args.dataContext, args.column); // action callback.. do something } }, - { command: 'help', title: 'HELP', iconCssClass: 'fa fa-question-circle', positionOrder: 62 }, + { command: 'help', title: 'HELP', iconCssClass: 'mdi mdi-help-circle', positionOrder: 62 }, // you can add sub-menus by adding nested `commandItems` { // we can also have multiple nested sub-menus @@ -74,8 +74,8 @@ this.columnDefinitions = [ cellMenu: { optionTitle: 'Change Effort Driven Flag', // optional, add title optionItems: [ - { option: true, title: 'True', iconCssClass: 'fa fa-check-square-o' }, - { option: false, title: 'False', iconCssClass: 'fa fa-square-o' }, + { option: true, title: 'True', iconCssClass: 'mdi mdi-check-box-outline' }, + { option: false, title: 'False', iconCssClass: 'mdi mdi-checkbox-blank-outline' }, { divider: true, command: '', positionOrder: 60 }, ], // subscribe to Context Menu onOptionSelected event (or use the "action" callback on each option) @@ -153,7 +153,7 @@ this.columnDefinitions = [ { id: 'action', field: 'action', name: 'Action', cellMenu: { menuUsabilityOverride: (args) => { - const dataContext = args && args.dataContext; + const dataContext = args?.dataContext; return (dataContext.id < 21); // say we want to display the menu only from Task 0 to 20 }, } @@ -163,24 +163,22 @@ this.columnDefinitions = [ To give another example, with Options this time, we could say that we enable the `n/a` option only when the row is Completed. So we could do it this way ```ts -this.columnDefinitions = [ - { id: 'action', field: 'action', name: 'Action', - cellMenu: { - optionItems: [ - { - option: 0, title: 'n/a', textCssClass: 'italic', - // only enable this option when the task is Not Completed - itemUsabilityOverride: (args) => { - const dataContext = args && args.dataContext; - return !dataContext.completed; - }, - { option: 1, iconCssClass: 'fa fa-star-o yellow', title: 'Low' }, - { option: 2, iconCssClass: 'fa fa-star-half-o orange', title: 'Medium' }, - { option: 3, iconCssClass: 'fa fa-star red', title: 'High' }, - ] - } +this.columnDefinitions = [{ + id: 'action', field: 'action', name: 'Action', + cellMenu: { + optionItems: [{ + option: 0, title: 'n/a', textCssClass: 'italic', + // only enable this option when the task is Not Completed + itemUsabilityOverride: (args) => { + const dataContext = args?.dataContext; + return !dataContext.completed; + }, + { option: 1, iconCssClass: 'mdi mdi-star-outline yellow', title: 'Low' }, + { option: 2, iconCssClass: 'mdi mdi-star orange', title: 'Medium' }, + { option: 3, iconCssClass: 'mdi mdi-star red', title: 'High' }, + }] } -]; +}]; ``` ### How to add Translations? @@ -191,9 +189,9 @@ this.columnDefinitions = [ cellMenu: { optionTitleKey: 'COMMANDS', // optionally pass a title to show over the Options optionItems: [ - { option: 1, titleKey: 'LOW', iconCssClass: 'fa fa-star-o yellow' }, - { option: 2, titleKey: 'MEDIUM', iconCssClass: 'fa fa-star-half-o orange' }, - { option: 3, titleKey: 'HIGH', iconCssClass: 'fa fa-star red' }, + { option: 1, titleKey: 'LOW', iconCssClass: 'mdi mdi-star-outline yellow' }, + { option: 2, titleKey: 'MEDIUM', iconCssClass: 'mdi mdi-star orange' }, + { option: 3, titleKey: 'HIGH', iconCssClass: 'mdi mdi-star red' }, ] } } diff --git a/docs/column-functionalities/Formatters.md b/docs/column-functionalities/Formatters.md index 752267fb3..aa16d44e4 100644 --- a/docs/column-functionalities/Formatters.md +++ b/docs/column-functionalities/Formatters.md @@ -195,7 +195,7 @@ For example, we will use `Font-Awesome` with a `boolean` as input data, and disp ```ts // create a custom Formatter with the Formatter type const myCustomCheckboxFormatter: Formatter = (row: number, cell: number, value: any, columnDef: Column, dataContext: any) => - value ? `` : ''; + value ? `` : ''; ``` #### Example with `FormatterResultObject` instead of a string @@ -203,7 +203,7 @@ Using this object return type will provide the user the same look and feel, it w ```ts // create a custom Formatter and returning a string and/or an object of type FormatterResultObject const myCustomCheckboxFormatter: Formatter = (row: number, cell: number, value: any, columnDef: Column, dataContext: any, grid?: any) => - value ? { addClasses: 'fa fa-fire', text: '', tooltip: 'burning fire' } : ''; + value ? { addClasses: 'mdi mdi-fire', text: '', tooltip: 'burning fire' } : ''; ``` ### Example of Custom Formatter with Native DOM Element diff --git a/docs/column-functionalities/editors/Autocomplete-Editor-(Kraaden-lib).md b/docs/column-functionalities/editors/Autocomplete-Editor-(Kraaden-lib).md index f669b165a..7af780e4a 100644 --- a/docs/column-functionalities/editors/Autocomplete-Editor-(Kraaden-lib).md +++ b/docs/column-functionalities/editors/Autocomplete-Editor-(Kraaden-lib).md @@ -276,11 +276,6 @@ export class GridBasicComponent { editorOptions: { showOnFocus: true, minLength: 1, - classes: { - // choose a custom style layout - // 'ui-autocomplete': 'autocomplete-custom-two-rows', - 'ui-autocomplete': 'autocomplete-custom-four-corners', - }, fetch: (searchText, updateCallback) => { yourAsyncApiCall(searchText) // typically you'll want to return no more than 10 results .then(result => updateCallback((results.length > 0) ? results : [{ label: 'No match found.', value: '' }]); }) diff --git a/docs/column-functionalities/editors/Select-Dropdown-Editor-(single,multiple).md b/docs/column-functionalities/editors/Select-Dropdown-Editor-(single,multiple).md index bd7fdd9a0..54bb00a4c 100644 --- a/docs/column-functionalities/editors/Select-Dropdown-Editor-(single,multiple).md +++ b/docs/column-functionalities/editors/Select-Dropdown-Editor-(single,multiple).md @@ -163,7 +163,7 @@ this.columnDefinitions = [ editor: { // display checkmark icon when True enableRenderHtml: true, - collection: [{ value: '', label: '' }, { value: true, label: 'True', labelPrefix: ` ` }, { value: false, label: 'False' }], + collection: [{ value: '', label: '' }, { value: true, label: 'True', labelPrefix: ` ` }, { value: false, label: 'False' }], model: Editors.singleSelect } } diff --git a/docs/column-functionalities/filters/Select-Filter.md b/docs/column-functionalities/filters/Select-Filter.md index 40872a9a5..a59ff38f9 100644 --- a/docs/column-functionalities/filters/Select-Filter.md +++ b/docs/column-functionalities/filters/Select-Filter.md @@ -416,7 +416,7 @@ this.columnDefinitions = [ filter: { // display checkmark icon when True enableRenderHtml: true, - collection: [{ value: '', label: '' }, { value: true, label: 'True', labelPrefix: ` ` }, { value: false, label: 'False' }], + collection: [{ value: '', label: '' }, { value: true, label: 'True', labelPrefix: ` ` }, { value: false, label: 'False' }], model: Filters.singleSelect } } diff --git a/docs/grid-functionalities/Context-Menu.md b/docs/grid-functionalities/Context-Menu.md index 64ca9c170..5e94673e9 100644 --- a/docs/grid-functionalities/Context-Menu.md +++ b/docs/grid-functionalities/Context-Menu.md @@ -39,7 +39,7 @@ this.gridOptions = { console.log(args.dataContext, args.column); // action callback.. do something } }, - { command: 'help', title: 'HELP', iconCssClass: 'fa fa-question-circle', positionOrder: 62 }, + { command: 'help', title: 'HELP', iconCssClass: 'mdi mdi-help-circle', positionOrder: 62 }, // you can add sub-menus by adding nested `commandItems` { // we can also have multiple nested sub-menus @@ -68,14 +68,14 @@ this.gridOptions = { hideCloseButton: false, optionTitle: 'Change Effort Driven Flag', // optional, add title optionItems: [ - { option: true, title: 'True', iconCssClass: 'fa fa-check-square-o' }, - { option: false, title: 'False', iconCssClass: 'fa fa-square-o' }, + { option: true, title: 'True', iconCssClass: 'mdi mdi-check-box-outline' }, + { option: false, title: 'False', iconCssClass: 'mdi mdi-checkbox-blank-outline' }, { divider: true, command: '', positionOrder: 60 }, ], // subscribe to Context Menu onOptionSelected event (or use the "action" callback on each option) onOptionSelected: (e, args) => { // change Priority - const dataContext = args && args.dataContext; + const dataContext = args?.dataContext; if (dataContext && dataContext.hasOwnProperty('priority')) { dataContext.priority = args.item.option; this.sgb.gridService.updateItem(dataContext); @@ -133,7 +133,7 @@ For example, say we want the Context Menu to only be available on the first 20 r ```ts contextMenu: { menuUsabilityOverride: (args) => { - const dataContext = args && args.dataContext; + const dataContext = args?.dataContext; return (dataContext.id < 21); // say we want to display the menu only from Task 0 to 20 }, ``` @@ -141,18 +141,17 @@ contextMenu: { To give another example, with Options this time, we could say that we enable the `n/a` option only when the row is Completed. So we could do it this way ```ts contextMenu: { - optionItems: [ - { + optionItems: [{ option: 0, title: 'n/a', textCssClass: 'italic', // only enable this option when the task is Not Completed itemUsabilityOverride: (args) => { - const dataContext = args && args.dataContext; + const dataContext = args?.dataContext; return !dataContext.completed; }, - { option: 1, iconCssClass: 'fa fa-star-o yellow', title: 'Low' }, - { option: 2, iconCssClass: 'fa fa-star-half-o orange', title: 'Medium' }, - { option: 3, iconCssClass: 'fa fa-star red', title: 'High' }, - ] + { option: 1, iconCssClass: 'mdi mdi-star-outline yellow', title: 'Low' }, + { option: 2, iconCssClass: 'mdi mdi-star orange', title: 'Medium' }, + { option: 3, iconCssClass: 'mdi mdi-star red', title: 'High' }, + }] } ``` @@ -161,12 +160,11 @@ It works exactly like the rest of the library when `enableTranslate` is set, all ```ts contextMenu: { optionTitleKey: 'COMMANDS', // optionally pass a title to show over the Options - optionItems: [ - { - { option: 1, titleKey: 'LOW', iconCssClass: 'fa fa-star-o yellow' }, - { option: 2, titleKey: 'MEDIUM', iconCssClass: 'fa fa-star-half-o orange' }, - { option: 3, titleKey: 'HIGH', iconCssClass: 'fa fa-star red' }, - ] + optionItems: [{ + { option: 1, titleKey: 'LOW', iconCssClass: 'mdi mdi-star-outline yellow' }, + { option: 2, titleKey: 'MEDIUM', iconCssClass: 'mdi mdi-star orange' }, + { option: 3, titleKey: 'HIGH', iconCssClass: 'mdi mdi-star red' }, + }] } ``` @@ -199,10 +197,10 @@ contextMenu: { hideExportTextDelimitedCommand: true, hideMenuOnScroll: true, hideOptionSection: false, - iconCopyCellValueCommand: 'fa fa-clone', - iconExportCsvCommand: 'fa fa-download', - iconExportExcelCommand: 'fa fa-file-excel-o text-success', - iconExportTextDelimitedCommand: 'fa fa-download', + iconCopyCellValueCommand: 'mdi mdi-content-copy', + iconExportCsvCommand: 'mdi mdi-download', + iconExportExcelCommand: 'mdi mdi-file-excel-outline text-success', + iconExportTextDelimitedCommand: 'mdi mdi-download', width: 200, }, ``` diff --git a/docs/grid-functionalities/Export-to-Excel.md b/docs/grid-functionalities/Export-to-Excel.md index eb8e09ae7..e6bbc0bdb 100644 --- a/docs/grid-functionalities/Export-to-Excel.md +++ b/docs/grid-functionalities/Export-to-Excel.md @@ -1,7 +1,6 @@ #### index - [Grid Options](#grid-options) - [Column Definition & Options](#column-definition-and-options) -- [Custom Column Width](#custom-column-width) - [Custom Cell Styling](#custom-cell-styling) - [Cell Value Parser](#cell-value-parser) - [Cell Format Auto-Detect Disable](#cell-format-auto-detect-disable) @@ -59,7 +58,7 @@ initializeGrid() { - So basically, if `exportWithFormatter` is set to True in the `excelExportOptions` of the Grid Options, but is set to False in the Column Definition, then the result will be False and will not evaluate it's Formatter. - `exportCustomFormatter` will let you choose a different Formatter when exporting - For example, you might have `formatter: Formatters.checkmark` but you want to see a boolean translated value, in this case you would define an extra property of `customFormatter: Formatters.translateBoolean`. -- set `sanitizeDataExport` to remove any HTML/Script code from being export. For example if your value is `True` will export `True` without any HTML (data is sanitized). +- set `sanitizeDataExport` to remove any HTML/Script code from being export. For example if your value is `True` will export `True` without any HTML (data is sanitized). - this flag can be used in the Grid Options (all columns) or in a Column Definition (per column). #### Grid Options @@ -74,7 +73,7 @@ Inside the column definition there are couple of flags you can set in `excelExpo - `sheetName` allows you to change the Excel Sheet Name (defaults to "Sheet1") - `groupingColumnHeaderTitle` The column header title (at A0 in Excel) of the Group by. If nothing is provided it will use "Group By" - `groupingAggregatorRowText` The default text to display in 1st column of the File Export, which will identify that the current row is a Grouping Aggregator -- set `sanitizeDataExport` to remove any HTML/Script code from being export. For example if your value is `True` will export `True` without any HTML (data is sanitized). +- set `sanitizeDataExport` to remove any HTML/Script code from being export. For example if your value is `True` will export `True` without any HTML (data is sanitized). - this flag can be used in the Grid Options (all columns) or in a Column Definition (per column). - `customExcelHeader` is a callback method that can be used to provide a custom Header Title to your Excel File @@ -118,21 +117,6 @@ initializeGrid() { What we can see from the example, is that it will use all Formatters (when exist) on this grid, except for the last column "Completed" since that column has explicitly defined `exportWithFormatter: false` -### Custom Column Width - -**NOTE** now deprecated, please use [Custom Cell Styling](#custom-cell-styling) instead - -You can define a custom Excel column width (the width Excel's own width which is not in pixel). You can define a custom width per column (in your column definitions) and/or for the entire grid (in your grid options). - -#### Per Column -You could set a custom width per column -```ts -this.columnDefinitions = [ - { id: 'firstName', name: 'FirstName', exportColumnWidth: 10, }, - // ... -]; -``` - #### For the entire Grid You could also set a custom width for the entire grid export via the `excelExportOptions` ```ts @@ -238,7 +222,7 @@ If you have lots of data, you might want to show a spinner telling the user that ##### View ```html - +
diff --git a/docs/grid-functionalities/Export-to-Text-File.md b/docs/grid-functionalities/Export-to-Text-File.md index 53c32373c..b32b4e651 100644 --- a/docs/grid-functionalities/Export-to-Text-File.md +++ b/docs/grid-functionalities/Export-to-Text-File.md @@ -52,7 +52,7 @@ Inside the column definition there are couple of flags you can set and also some - `exportCustomFormatter` will let you choose a different Formatter when exporting - For example, you might have `formatter: Formatters.checkmark` but you want to see a boolean translated value, in this case you would define an extra property of `exportCustomFormatter: Formatters.translateBoolean`. - you can set `exportCsvForceToKeepAsString` flag, this one will wrap the cell value into double quotes and add an equal sign in the front, this is especially useful on a column that could be turned into an exponential number by Excel. For example, we could have "1E06" and without this flag will become (1.0E06) in Excel, unless we enable the flag which will become `="1E06"` which will keep it as a string, also note that it will be shown as "1E06" but if you click on the cell value, you will see `="1E06"` -- set `sanitizeDataExport` to remove any HTML/Script code from being export. For example if your value is `True` will export `True` without any HTML (data is sanitized). +- set `sanitizeDataExport` to remove any HTML/Script code from being export. For example if your value is `True` will export `True` without any HTML (data is sanitized). - this flag can be used in the Grid Options (all columns) or in a Column Definition (per column). #### Behaviors @@ -140,7 +140,7 @@ If you have lots of data, you might want to show a spinner telling the user that ##### View ```html - +
diff --git a/docs/grid-functionalities/Grid-Menu.md b/docs/grid-functionalities/Grid-Menu.md index 4c8b2d30e..fce112f7e 100644 --- a/docs/grid-functionalities/Grid-Menu.md +++ b/docs/grid-functionalities/Grid-Menu.md @@ -29,18 +29,18 @@ this.gridOptions = { gridMenu: { commandTitle: 'Custom Commands', columnTitle: 'Columns', - iconCssClass: 'fa fa-ellipsis-v', + iconCssClass: 'mdi mdi-dots-vertical', menuWidth: 17, resizeOnShowHeaderRow: true, commandItems: [ { - iconCssClass: 'fa fa-filter text-danger', + iconCssClass: 'mdi mdi-filter-remove-outline', title: 'Clear All Filters', disabled: false, command: 'clear-filter' }, { - iconCssClass: 'fa fa-random', + iconCssClass: 'mdi-flip-vertical', title: 'Toggle Filter Row', disabled: false, command: 'toggle-filter' @@ -110,12 +110,12 @@ You can change any of the default command icon(s) by changing the `icon[X-comman this.gridOptions = { enableGridMenu: true, gridMenu: { - iconClearAllFiltersCommand: 'fa fa-filter text-danger' - iconClearAllSortingCommand: 'fa fa-unsorted text-danger', - iconExportCsvCommand: 'fa fa-download', - iconExportTextDelimitedCommand: 'fa fa-download', - iconRefreshDatasetCommand: 'fa fa-refresh', - iconToggleFilterCommand: 'fa fa-random', + iconClearAllFiltersCommand: 'mdi mdi-filter-remove-outline' + iconClearAllSortingCommand: 'mdi mdi-sort-variant-off', + iconExportCsvCommand: 'mdi mdi-download', + iconExportTextDelimitedCommand: 'mdi mdi-download', + iconRefreshDatasetCommand: 'mdi mdi-sync', + iconToggleFilterCommand: 'mdi-flip-vertical', }, }; ``` diff --git a/docs/grid-functionalities/Tree-Data-Grid.md b/docs/grid-functionalities/Tree-Data-Grid.md index 4065e6489..34afee089 100644 --- a/docs/grid-functionalities/Tree-Data-Grid.md +++ b/docs/grid-functionalities/Tree-Data-Grid.md @@ -349,10 +349,10 @@ this.columnDefinitions = [ if (avgVal !== undefined && sumVal !== undefined) { // when found Avg & Sum, we'll display both - return isNaN(sumVal) ? '' : `sum: ${decimalFormatted(sumVal, 0, 2)} MB / avg: ${decimalFormatted(avgVal, 0, 2)} MB (${treeLevel === 0 ? 'total' : 'sub-total'})`; + return isNaN(sumVal) ? '' : `sum: ${decimalFormatted(sumVal, 0, 2)} MB / avg: ${decimalFormatted(avgVal, 0, 2)} MB (${treeLevel === 0 ? 'total' : 'sub-total'})`; } else if (sumVal !== undefined) { // or when only Sum is aggregated, then just show Sum - return isNaN(sumVal) ? '' : `sum: ${decimalFormatted(sumVal, 0, 2)} MB (${treeLevel === 0 ? 'total' : 'sub-total'})`; + return isNaN(sumVal) ? '' : `sum: ${decimalFormatted(sumVal, 0, 2)} MB (${treeLevel === 0 ? 'total' : 'sub-total'})`; } } // reaching this line means it's a regular dataContext without totals, so regular formatter output will be used diff --git a/docs/grid-functionalities/frozen-columns-rows.md b/docs/grid-functionalities/frozen-columns-rows.md index 77e1f2825..f3aba1c33 100644 --- a/docs/grid-functionalities/frozen-columns-rows.md +++ b/docs/grid-functionalities/frozen-columns-rows.md @@ -81,7 +81,7 @@ You can change the number of pinned columns/rows and even the pinning of columns : ${ isFrozenBottom ? 'Bottom' : 'Top' } diff --git a/docs/grid-functionalities/grouping-aggregators.md b/docs/grid-functionalities/grouping-aggregators.md index d28fd8c7d..60179aff6 100644 --- a/docs/grid-functionalities/grouping-aggregators.md +++ b/docs/grid-functionalities/grouping-aggregators.md @@ -179,21 +179,19 @@ To "Clear all Grouping", "Collapse all Groups" and "Expand all Groups", we can s ``` ### Styling (change icons) -The current icons are Font Awesome chevron (right/down), however if you wish to use +/- icons. You can simply update the SASS variables to use whichever icons (or even Font Family icon) you desire. The SASS variables you can change are +The current icons are chevron (right/down), however if you wish to use +/- icons. You can simply update the SASS variables to use whichever SVG icon paths. The SASS variables you can change are ```css -$icon-group-color: $primary-color; -$icon-group-expanded: "\f107"; -$icon-group-collapsed: "\f105"; -$icon-group-font-size: ($icon-font-size + 2px); -$icon-group-font-weight: bold; -$icon-group-margin-right: 2px; -$icon-group-height: 20px; -$icon-group-width: 14px; +$slick-icon-group-color: $primary-color; +$slick-icon-group-expanded-svg-path: "M19,19V5H5V19H19M19,3A2,2 0 0,1 21,5V19A2,2 0 0,1 19,21H5A2,2 0 0,1 3,19V5C3,3.89 3.9,3 5,3H19M11,7H13V11H17V13H13V17H11V13H7V11H11V7Z"; +$slick-icon-group-collapsed-svg-path: "M19,19V5H5V19H19M19,3A2,2 0 0,1 21,5V19A2,2 0 0,1 19,21H5A2,2 0 0,1 3,19V5C3,3.89 3.9,3 5,3H19M17,11V13H7V11H17Z"; +$slick-icon-group-font-size: 20px; +$slick-icon-group-font-weight: bold; +$slick-icon-group-margin-right: 2px; /* Grouping Totals Formatter */ -$group-totals-formatter-color: gray; -$group-totals-formatter-bgcolor: white; -$group-totals-formatter-font-size: 14px; +$slick-group-totals-formatter-color: gray; +$slick-group-totals-formatter-bgcolor: white; +$slick-group-totals-formatter-font-size: 14px; ``` For more info on SASS styling and variables, please read the [Wiki - SASS Styling](../styling/styling.md), \ No newline at end of file diff --git a/docs/grid-functionalities/header-menu-header-buttons.md b/docs/grid-functionalities/header-menu-header-buttons.md index 42b15c577..97d6dfe64 100644 --- a/docs/grid-functionalities/header-menu-header-buttons.md +++ b/docs/grid-functionalities/header-menu-header-buttons.md @@ -64,9 +64,9 @@ You can change any of the default command icon(s) by changing the `icon[X-comman this.gridOptions = { enableHeaderMenu: true, headerMenu: { - iconColumnHideCommand: 'fa fa-times' - iconSortAscCommand: 'fa fa-sort-asc' - iconSortDescCommand: 'fa fa-sort-desc', + iconColumnHideCommand: 'mdi mdi-close' + iconSortAscCommand: 'mdi mdi-sort-ascending' + iconSortDescCommand: 'mdi mdi-sort-descending', }, }; ``` diff --git a/docs/migrations/migration-to-5.x.md b/docs/migrations/migration-to-5.x.md new file mode 100644 index 000000000..24f172227 --- /dev/null +++ b/docs/migrations/migration-to-5.x.md @@ -0,0 +1,107 @@ +## Version 5 - Better Dark Mode with Pure CSS SVG icons +This new release brings a lot of changes oriented towards better UI/UX, our SVG icons are now pure CSS and can be colorized like any other text via the `color` CSS property (which helps a lot for the Dark Mode Theme). + +Another noticeable UI change is the migration from [Flatpickr](https://flatpickr.js.org/) to [Vanilla-Calendar-Picker](https://github.com/ghiscoding/vanilla-calendar-picker) (which is in fact a fork of [Vanilla-Calendar-Pro](https://vanilla-calendar.pro/) and maybe one day we'll drop the fork if possible), there are multiple reasons to migrate our date picker to another library: +- Flatpickr cons: + - barely supported (lots of opened PR but nothing merged for the past 2 years) + - not fully ESM ready (it's only partially ESM, for example it is detected as CJS in Angular-Slickgrid and requires to be added to `allowedCommonJsDependencies`) + - styling could be a bit more modern (the use of native select/input to change year/month/time is a bit outdated and rudimentary) + - date range selection is not very user friendly (UX) +- Vanilla-Calendar pros: + - ESM ready + - modern styling and also include Dark Mode theme + - date range becomes a lot more easy by displaying a picker with 2 months + - much smaller size (a decrease of 2.9% (17Kb) was observed, expect even more decrease with gzip) +- Vanilla-Calendar cons: + - settings are named differently and are not using flat config (complex object settings) + - for example Flatpickr `minDate: 'today'` is instead `range: { min: 'today' }` + - some settings were missing, like the `'today'` shortcut which is why I forked the project + - I did open a few PRs on the main project, so the hope is to drop the fork in the future while being a totally transparent change to the user (you) + +Similar to previous releases, I managed to decrease the project build size even more (about 5%). At this point, the project has a similar size to what it was in v2.x that is when we were using jQuery/jQueryUI separately. However, since we're no longer using jQuery in the project, our project build size is in fact much smaller than it was 2 years ago. This is really nice to see especially since we keep adding features (like Dark Mode and others), we still size managed to decrease the project size yet again :) + +#### Major Changes - Quick Summary +- minimum requirements bump + - Node 18 is now required + - migrate to [Vanilla-Calendar-Picker](https://github.com/ghiscoding/vanilla-calendar-picker) (visit [Vanilla-Calendar-Pro](https://vanilla-calendar.pro/) for all docs) + +> **Note** for the entire list of tasks & code changes applied in this release, you may want to take a look at the [Discussion - Roadmap to 5.0](https://github.com/ghiscoding/slickgrid-universal/discussions/1482) + +--- + +**NOTE:** if you come from an earlier version, please make sure to follow each migrations in their respected order (review other migration guides) + +## Changes + +### Styling + +#### `.color-xx` are removed (use `.text-color-xx` instead) +Since the SVG icons are now pure CSS, we can now colorize them the same way that we would do for any other text via the `color` CSS property. Because of that, we no longer need any of the `.color-xx` classes (which were created via CSS [filter](https://developer.mozilla.org/en-US/docs/Web/CSS/filter)). They were useful to override the SVG icon colors, but since we can now use regular `color` property, I decided to keep only the `text-color-xx` and remove all `color-xx` + +```diff + +``` +or move the class to the parent container and have both the icon and the text inherit the color :) +```diff ++ +``` + +### Deprecated code removed/renamed + +##### SASS variables +A lot of SASS variables changed, we recommend you take a look at the [_variables.scss](https://github.com/ghiscoding/slickgrid-universal/blob/master/packages/common/src/styles/_variables.scss) file to compare with yours SASS overrides and fix any SASS build issues. + +##### SASS `math` polyfills are removed +When Dart-SASS released their version 1.33, it caused a lot of console warnings (and lot of unhappy users) in projects that were using `/` (for math division) instead of their new `math.div` function. To avoid seeing all these warnings, I had created a temporary polyfill (that piece of code was actually copied from Bootstrap project). This change happened 3 years ago, so I'm assuming that most users have already upgraded their SASS and fix these warnings and I think it's time to remove this polyfill since it was always meant to be a temp patch. If you see these warnings coming back, you can use the SASS option `--quiet-upstream`. + +For reference, below is an example of these old Math warnings when we used to compile it with SASS CLI + +```sh +Recommendation: math.div($m, $columns) +More info and automated migrator: https://sass-lang.com/d/slash-div +╷ +94 │ margin-right: $m / $columns * 100% +│ ^^^^^^^^^^^^^^^^^^ +``` + +##### jQueryUI CSS class leftovers +There were a few `.ui-state-default` and other jQueryUI CSS classes leftovers in the core lib, they were all removed in this release. If you were using any of them for styling purposes, you can simply rename them to `.slick-state-` + +```diff +- .ui-state-default, .ui-state-hover { ++ .slick-state-default, .slick-state-hover { +} +``` + +## Grid Functionalities +### Date Editor/Filter +We migrated from Flatpicker to Vanilla-Calendar and this require some changes since the option names are different. The changes are the same for both the Filter and the Editor. + +The biggest change that you will have to do is the min/max date setting when using the `'today'` shortcut as shown below: + +```diff +- import { type FlatpickrOption } from '@slickgrid-universal/common'; ++ import { type VanillaCalendarOption } from '@slickgrid-universal/common'; + +prepareGrid() { + this.columnDefinitions = [{ + id: 'finish', name: 'Finish', field: 'finish', + editor: { + model: Editors.date, +- editorOptions: { minDate: 'today' } as FlatpickrOption, ++ editorOptions: { range: { min: 'today' } } as VanillaCalendarOption, + } + }]; +} +``` + +> **Note** the `'today'` shortcut currently only exist in `Vanilla-Calendar-Picker` fork, however the rest of the settings should be similar, visit `Vanilla-Calendar-Pro` [settings](https://vanilla-calendar.pro/docs/reference/additionally/settings) website for all other options. The hope is to drop the fork whenever the original project receives all missing features. + diff --git a/docs/styling/dark-mode.md b/docs/styling/dark-mode.md index f5e567c64..b371694d4 100644 --- a/docs/styling/dark-mode.md +++ b/docs/styling/dark-mode.md @@ -83,7 +83,7 @@ export class MyDemo { }, // you can also change the icon and/or command name - iconToggleDarkModeCommand: 'fa fa-moon-o', + iconToggleDarkModeCommand: 'mdi mdi-brightness-4', commandLabels: { toggleDarkModeCommand: 'Toggle Dark Mode', }, @@ -97,4 +97,4 @@ export class MyDemo { The Dark Mode Theme was created by setting a few CSS variables, in some cases you might need to tweak some of these variables. Take a look at the Slickgrid-Universal [CSS variables](https://github.com/ghiscoding/slickgrid-universal/blob/670946dcedd330a70d2e88127a0042474e7a5348/packages/common/src/styles/_variables.scss#L976-L985) to see which variables were reassigned. Also note that if you're using other Themes like Material or Salesforce, then there's also other variables that are set (see [Material variables](https://github.com/ghiscoding/slickgrid-universal/blob/670946dcedd330a70d2e88127a0042474e7a5348/packages/common/src/styles/_variables-theme-material.scss#L159-L189) or [Salesforce variables](https://github.com/ghiscoding/slickgrid-universal/blob/670946dcedd330a70d2e88127a0042474e7a5348/packages/common/src/styles/_variables-theme-salesforce.scss#L202-L219)) -> **Note** currently the icon color is set only once for **both** the Light & Dark Mode, and for that reason the color is set to a light gray. That will change in the future but that will require a breaking change (major version) and so for a temporary solution a lighter gray color is used. \ No newline at end of file +> **Note** to support both Light and Dark Mode in the same Theme, we use CSS variables **only**. This mean that we **do not** have any dedicated SASS variables for Dark Mode, if you want to override some colors for Dark Mode, you'll need to override the CSS variable for that to work. The best way to find associated variable is to use your browser's debugger tool. \ No newline at end of file diff --git a/docs/styling/styling.md b/docs/styling/styling.md index 4307f8233..c500c2090 100644 --- a/docs/styling/styling.md +++ b/docs/styling/styling.md @@ -3,22 +3,25 @@ - [Using CSS Variables (CSS hooks in LWC)](#using-css-variables-instead-of-sass) - [Using SVG with SASS](#using-custom-svgs-with-sass) - [How to change SVG color?](#how-to-change-svg-color) -- [List of included Material SVG Icons](https://github.com/ghiscoding/slickgrid-universal/blob/master/packages/common/src/styles/material-svg-icons.scss) - - We only included the most popular icons, about 100 out of the 5000+ available [Material Design icons](https://materialdesignicons.com/) +- [List of included Material SVG Icons](https://github.com/ghiscoding/slickgrid-universal/blob/master/packages/common/src/styles/slickgrid-icons.scss) + - We only included the most popular icons for a grid, about 200 out of the 5000+ available [Material Design icons](https://materialdesignicons.com/) - [Icon List & Utilities Demo](https://ghiscoding.github.io/slickgrid-universal/#/icons) - [SVG Colors CSS Classes](#svg-colors---css-classes) ### Description -Slickgrid-Universal was built with a Font set, mainly Font-Awesome 4, and if you use SASS it was easy enough to replace Font-Awesome to any other Font based set. The question is how do we use SVG instead of a Font? Most frameworks are switching to SVGs instead of Fonts (for smaller size and also efficiency). Slickgrid-Universal now has 2/3 Styling Themes that support SVGs which are Material Design & Salesforce Themes. These 2 new Themes use a subset of [Material Design Icons](https://materialdesignicons.com/) SVGs (even a portion of the Salesforce theme). There are no Font-Awesome 5, I wouldn't mind adding a new Theme for that and if you wish to contribute then please open a new issue. +Slickgrid-Universal was originally using Font-Awesome to display internal icons but we now use SVG only for icons and the font was dropped completely. Our SVG are now also using pure CSS which mean that you can colorize them the same way that you would change text color (which is also helpful in dark mode). Slickgrid-Universal has 3 Styling Themes (Bootstrap, Material and Salesforce) and we also optionally provide extra SVG icons, which are a tiny a subset of [Material Design Icons](https://materialdesignicons.com/) SVGs. These extra SVG icons are optionals and can be imported manually (note however, they are part of the Material and Salesforce themes by default), when imported you'll want to use the `.mdi` CSS classes. -If you use SASS, you will find out that it's super easy to use either (Font) or (SVG), you simply have to replace the SASS necessary variables, more on that later. +> **Note** some icons are built-ins (sorting, grouping, row selections, ...) while some other icons are defined by CSS classes (grid menu, column picker, header menu, context menu, ...) and you could use `.mdi` icons or any other icons framework (if you do, then you'll want to override global grid options). + +If you use SASS and you want to change some of the default SVGs, you will find out it super easy to simply replace the SVG path via associated SASS variable, more on further down. ### Demo - Material Theme - [demo](https://ghiscoding.github.io/slickgrid-universal/#/example05) - Salesforce Theme - [demo](https://ghiscoding.github.io/slickgrid-universal/#/example06) +- Bootstrap Theme - visit [Angular-Slickgrid](https://github.com/ghiscoding/Angular-Slickgrid), [Aurelia-Slickgrid](https://github.com/ghiscoding/arelia-slickgrid) or [Slickgrid-React](https://github.com/ghiscoding/slickgrid-react) ### Using built-in Themes -The Material & Salesforce Themes are now using SVGs for the icons used by the grid. Each built-in Themes have CSS and SASS files associated with each theme. To take benefit of this, just import whichever CSS/SASS file associated with the Theme you wish to use. +The Material & Salesforce Themes are using SVGs internally for the icons used by the grid. Each built-in Themes have CSS and SASS files associated with each theme. To take benefit of this, just import whichever CSS/SASS file associated with the Theme you wish to use. ##### with CSS ```scss @@ -59,188 +62,156 @@ For example, if we take the following 3 SASS variables (`$slick-header-menu-disp } ``` -**NOTE:** you could use `:host` to only change current grid styling, **however** there are many DOM elements that are appended to the Document `body` (Grid Menu, Column Picker, Select Filter/Editor, Context Menu, ...) and the style **will not** be applied with `:host` and so in most cases you would want to use `:root` to make a global change which will also work with elements appended to the `body`. Also note that `:root` is not available in Salesforce LWC, so you won't be able to style everything in Salesforce. +> **Note:** you could use `:host` to only change current grid styling, **however** there are many DOM elements that are appended to the DOM `body` (Grid Menu, Column Picker, Select Filter/Editor, Context Menu, ...) and the styles **will not** be applied when simply using `:host` and so in most cases you would want to use `:root` (if possible) to make a global change which will also work with elements appended to the `body`. Also note that `:root` is not available in Salesforce LWC and so you unfortunately won't be able to style everything in Salesforce. ### Using Custom SVGs with SASS -You could use Custom SVGs and create your own Theme and/or a different set of SVG Icons, each of the icons used in Slickgrid-Universal has an associated SASS variables which allow you to override any one of them. All grid of the icons are loaded with the `content` property of the `:before` pseudo (for example, see this [line](https://github.com/ghiscoding/slickgrid-universal/blob/master/packages/common/src/styles/slick-bootstrap.scss#L322) and the difference between Font and SVG is simple, if you want to use a Font then you use the Font unicode but if you want an SVG then you use a `url` with `svg+xml` as shown below. - -##### with Font -```scss -$slick-primary-color: blue; -$slick-icon-sort-color: $slick-primary-color -$slick-icon-sort-asc: "\f0d8"; -$slick-icon-sort-desc: "\f0d7"; -$slick-icon-sort-font-size: 13px; -$slick-icon-sort-width: 13px; - -// then on the last line, import the Theme that you wish to override -@import '@slickgrid-universal/common/dist/styles/sass/slickgrid-theme-bootstrap.scss'; -``` +You could use Custom SVGs and create your own Theme and/or a different set of SVG Icons, each of the icons used in Slickgrid-Universal has an associated SASS variables ending with the suffix `"icon-svg-path"` which allow you to override any of the SVG path. All grid of the icons are generated by following AntFu's [icons in pure CSS](https://antfu.me/posts/icons-in-pure-css) approach. ##### with SVG ```scss -// a simple utility that will encode a color with hash sign into a valid HTML URL (e.g. #red => %23red) -// you could also skip the use of this and simply manually change # symbol to %23 -@import '@slickgrid-universal/common/dist/styles/sass/sass-utilities'; - $slick-primary-color: blue; - -$slick-icon-sort-color: $slick-primary-color -$slick-icon-sort-asc: url('data:image/svg+xml,'); -$slick-icon-sort-desc: url('data:image/svg+xml,'); -$slick-icon-sort-font-size: 13px; -$slick-icon-sort-width: 13px; +$slick-icon-group-color: $slick-primary-color; +$slick-icon-group-collapsed-svg-path: "M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z"; +$slick-icon-group-expanded-svg-path: "M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z"; +$slick-icon-group-font-size: 13px; // then on the last line, import the Theme that you wish to override -@import '@slickgrid-universal/common/dist/styles/sass/slickgrid-theme-material.scss'; +@import '@slickgrid-universal/common/dist/styles/sass/slickgrid-theme-bootstrap.scss'; ``` -### How to change SVG color? -#### The following works for both CSS and SASS -So there's a known caveat with using embedded SVG (which is what this lib does), you can only add color once with the `fill` property and for that I added SASS variables for each icon (for example `$slick-icon-sort-color` for the Sort icon color, or `$slick-icon-color` for all icons) but once you do that it will apply that same color across the document (want it or not). +> **Note** since the SVG are generated by a SASS function, you can easily override an SVG path in SASS but that is not the case with CSS variable. We still have a way to override an SVG via CSS variable but it requires to override the entire SVG content (not just its path) as can be seen below (also notice that the CSS variable is named without the `"-path"` suffix and also note that the URL must be encoded) -##### for CSS and SASS -After lot of research, I found a way to hack it via this SO answer [change any SVGs color via CSS `filter`](https://stackoverflow.com/a/53336754/1212166), for example if we wish to apply a red color on the `mdi-close` icon (for the Draggable Grouping feat), we'll have to do this `filter` ```css -.slick-groupby-remove.mdi-close { - /* close icon - red */ - filter: invert(32%) sepia(96%) saturate(7466%) hue-rotate(356deg) brightness(97%) contrast(120%); +:root { + --slick-checkbox-icon-checked-svg: url('data:image/svg+xml;utf8,%3Csvg viewBox="0 0 24 24" display="inline-block" height="1em" width="1em" vertical-align="text-bottom" xmlns="http://www.w3.org/2000/svg" %3E%3Cpath fill="currentColor" d="M10,17L5,12L6.41,10.58L10,14.17L17.59,6.58L19,8M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z"/%3E%3C/svg%3E'); } ``` -You might be thinking, like I did, but how to get this long `filter` calculation??? -For that you can visit the following blog post and use its **[color filter converter](https://dev.to/jsm91/css-filter-generator-to-convert-from-black-to-target-hex-color-188h)** that was posted to answer this SO [question](https://stackoverflow.com/q/42966641/1212166) - -##### for SASS only -There is also a SASS Mixin to convert the color using only SASS as posted [here](https://stackoverflow.com/a/62880368/1212166) in the same SO question. That will be part of the lib soon enough and we'll be able to use it this way (much cleaner): +the SASS equivalent is a lot easier to override ```scss -.slick-groupby-remove.mdi-close { - /* close icon - red */ - @include recolor(#ff0000, 0.8); -} +$slick-checkbox-icon-checked-svg-path: "M10,17L5,12L6.41,10.58L10,14.17L17.59,6.58L19,8M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z" ``` -Note that even though the code looks smaller and more human readable, in reality the code produced will still be a `filter` -`@include recolor(#ff0000, 0.8);` will in fact be converted to `filter: invert(32%) sepia(96%) saturate(7466%) hue-rotate(356deg) brightness(97%) contrast(120%);` +### How to change SVG color? +#### The following works for both CSS and SASS +The new version 5.x of this project is now creating SVG icons as pure CSS, this mean that you can colorize the icons the same way that you would change a text color. We also provide a few different color CSS classes which start with the prefixes `$color-` or `$text-color-` (e.g. `$color-primary`). ### SVG Colors - CSS Classes -To help with all of this, we added a few icon colors (basically took the same colors used by Bootstrap [here](https://getbootstrap.com/docs/4.5/utilities/colors/) using CSS `filter` and we also added a `light` and `dark` shades for of each colors (except `color-light`, `color-dark` since there's no need), they both use a 6% lighter/darker shades (you can override the shade with `$color-lighten-percentage` and the same for darken). These colors can be used with the `color-X` (for example `color-primary`), also note that the primary color will follow your `$slick-primary-color` that you might have override (it could also be different in each styling theme, shown below is the Salesforce theme colors). If you find that the colors are not exactly the colors you're looking for, we've also took some colors taken from [UiKit](https://getuikit.com/) and tagged them as `color-alt-X`. - -**NOTE:** You can use these colors on Icon and/or Text **but** remember that we're using CSS `filter` here which is very different compare to using regular CSS `color` or `background-color`. +Since SVG can now be colorize via the `color` the same as any other text, there isn't much to do. However a small subset of default colors is provided that can be used with the SVG icons or any text (basically took the same colors used by Bootstrap [here](https://getbootstrap.com/docs/4.5/utilities/colors/)). We also added a `light` and `dark` shades for of each colors (except `color-light`, `color-dark` since there's no need), they both use a 6% lighter/darker shades (you can override the shade with `$color-lighten-percentage` and the same for darken). These colors can be used with the `color-X` (for example `color-primary`), also note that the primary color will follow your `$slick-primary-color` that you might have already overriden (it could also be different in each styling theme, shown below is the Salesforce theme colors). If you find that the colors are not exactly the colors you're looking for, we've also took some colors taken from [UiKit](https://getuikit.com/) and tagged them as `color-alt-X`. -**NOTE 2:** The `colors.scss` is **only** included in the Material and Salesforce Themes since those are the only 2 themes currently using SVGs. If you wish to use these colors then simply add the necessary css/scss file. +**NOTE 1:** The `colors.scss` is **only** included in the Material and Salesforce Themes since those are the only 2 themes currently using SVGs. If you wish to use these colors then simply add the necessary css/scss file. -![image](https://user-images.githubusercontent.com/643976/90913834-cce92b80-e3aa-11ea-8720-3be5b171288b.png) +![image](https://github.com/ghiscoding/slickgrid-universal/assets/643976/986f16af-4e2b-4961-b2b5-32afc780b078) ```scss // SASS colors -$color-primary: $slick-primary-color; -$color-secondary: #6c757d; -$color-success: #28a745; -$color-danger: #dc3545; -$color-warning: #ffc107; -$color-info: #17a2b8; -$color-light: #f8f9fa; -$color-dark: #343a40; -$color-body: #212529; -$color-muted: #6c757d; -$color-white: #ffffff; -$color-alt-default: #1e87f0; -$color-alt-warning: #faa05a; -$color-alt-danger: #f0506e; -$color-alt-success: #32d296; -$color-se-primary: #3dcd58; -$color-se-link: #42b4e6; -$color-se-link-dark: #337ab7; -$color-se-danger: #b10043; -$color-se-secondary: #9fa0a4; -$color-se-warning: #e47f00; -$color-se-warning-light: #ffd100; +$text-color-primary: $slick-primary-color; +$text-color-secondary: #6c757d; +$text-color-success: #28a745; +$text-color-danger: #dc3545; +$text-color-warning: #ffc107; +$text-color-info: #17a2b8; +$text-color-light: #f8f9fa; +$text-color-dark: #343a40; +$text-color-body: #212529; +$text-color-muted: #6c757d; +$text-color-white: #ffffff; +$text-color-alt-default: #1e87f0; +$text-color-alt-warning: #faa05a; +$text-color-alt-danger: #f0506e; +$text-color-alt-success: #32d296; +$text-color-se-primary: #3dcd58; +$text-color-se-link: #42b4e6; +$text-color-se-link-dark: #337ab7; +$text-color-se-danger: #b10043; +$text-color-se-secondary: #9fa0a4; +$text-color-se-warning: #e47f00; +$text-color-se-warning-light: #ffd100; // lighter/darker shades -$color-lighten-percentage: 6%; -$color-darken-percentage: 6%; +$text-color-lighten-percentage: 6%; +$text-color-darken-percentage: 6%; ``` ##### HTML Color Test ```html
- color-primary - - color-primary-light - - color-primary-dark + text-color-primary - + text-color-primary-light - + text-color-primary-dark
- color-secondary - - color-secondary-light - - color-secondary-dark + text-color-secondary - + text-color-secondary-light - + text-color-secondary-dark
- color-success - - color-success-light - - color-success-dark + text-color-success - + text-color-success-light - + text-color-success-dark
- color-danger - - color-danger-light - - color-danger-dark + text-color-danger - + text-color-danger-light - + text-color-danger-dark
- color-warning - - color-warning-light - - color-warning-dark + text-color-warning - + text-color-warning-light - + text-color-warning-dark
- color-info - - color-info-light - - color-info-dark + text-color-info - + text-color-info-light - + text-color-info-dark
- color-body - - color-body-light - - color-body-dark + text-color-body - + text-color-body-light - + text-color-body-dark
- color-muted - - color-muted-light - - color-muted-dark + text-color-muted - + text-color-muted-light - + text-color-muted-dark
- color-dark + text-color-dark
- color-light + text-color-light
- color-white + text-color-white
- color-alt-default - - color-alt-default-light - - color-alt-default-dark + text-color-alt-default - + text-color-alt-default-light - + text-color-alt-default-dark
- color-alt-warning - - color-alt-warning-light - - color-alt-warning-dark + text-color-alt-warning - + text-color-alt-warning-light - + text-color-alt-warning-dark
- color-alt-success - - color-alt-success-light - - color-alt-success-dark + text-color-alt-success - + text-color-alt-success-light - + text-color-alt-success-dark
- color-alt-danger - - color-alt-danger-light - - color-alt-danger-dark + text-color-alt-danger - + text-color-alt-danger-light - + text-color-alt-danger-dark
-
color-se-primary
+
text-color-se-primary
- color-se-link - - color-se-link-dark + text-color-se-link - + text-color-se-link-dark
-
color-se-secondary
-
color-se-danger
+
text-color-se-secondary
+
text-color-se-danger
- color-se-warning - - color-se-warning-light + text-color-se-warning - + text-color-se-warning-light
``` \ No newline at end of file diff --git a/examples/vite-demo-vanilla-bundle/src/app.html b/examples/vite-demo-vanilla-bundle/src/app.html index c45aa91a9..12f0efdde 100644 --- a/examples/vite-demo-vanilla-bundle/src/app.html +++ b/examples/vite-demo-vanilla-bundle/src/app.html @@ -2,7 +2,7 @@ diff --git a/examples/vite-demo-vanilla-bundle/src/examples/example03.html b/examples/vite-demo-vanilla-bundle/src/examples/example03.html index 18a44f9eb..569227142 100644 --- a/examples/vite-demo-vanilla-bundle/src/examples/example03.html +++ b/examples/vite-demo-vanilla-bundle/src/examples/example03.html @@ -1,12 +1,18 @@

Example 03 - Draggable Grouping (with Salesforce Theme) + + +

diff --git a/examples/vite-demo-vanilla-bundle/src/examples/example03.ts b/examples/vite-demo-vanilla-bundle/src/examples/example03.ts index 3cf21f749..182a60e2b 100644 --- a/examples/vite-demo-vanilla-bundle/src/examples/example03.ts +++ b/examples/vite-demo-vanilla-bundle/src/examples/example03.ts @@ -35,6 +35,7 @@ interface ReportItem { export default class Example03 { private _bindingEventService: BindingEventService; + private _darkMode = false; columnDefinitions: Column[]; gridOptions: GridOption; dataset: any[]; @@ -68,6 +69,8 @@ export default class Example03 { dispose() { this.sgb?.dispose(); this._bindingEventService.unbindAll(); + document.querySelector('.demo-container')?.classList.remove('dark-mode'); + document.body.setAttribute('data-theme', 'light'); } initializeGrid() { @@ -84,7 +87,7 @@ export default class Example03 { filterable: true, grouping: { getter: 'title', - formatter: (g) => `Title: ${g.value} (${g.count} items)`, + formatter: (g) => `Title: ${g.value} (${g.count} items)`, aggregators: [new Aggregators.Sum('cost')], aggregateCollapsed: false, collapsed: false @@ -104,7 +107,7 @@ export default class Example03 { groupTotalsFormatter: GroupTotalFormatters.sumTotals, grouping: { getter: 'duration', - formatter: (g) => `Duration: ${g.value} (${g.count} items)`, + formatter: (g) => `Duration: ${g.value} (${g.count} items)`, comparer: (a, b) => { return this.durationOrderByCount ? (a.count - b.count) : SortComparers.numeric(a.value, b.value, SortDirectionNumber.asc); }, @@ -125,7 +128,7 @@ export default class Example03 { type: FieldType.number, grouping: { getter: 'cost', - formatter: (g) => `Cost: ${g.value} (${g.count} items)`, + formatter: (g) => `Cost: ${g.value} (${g.count} items)`, aggregators: [ new Aggregators.Sum('cost') ], @@ -146,7 +149,7 @@ export default class Example03 { groupTotalsFormatter: GroupTotalFormatters.avgTotalsPercentage, grouping: { getter: 'percentComplete', - formatter: (g) => `% Complete: ${g.value} (${g.count} items)`, + formatter: (g) => `% Complete: ${g.value} (${g.count} items)`, aggregators: [ new Aggregators.Sum('cost') ], @@ -164,7 +167,7 @@ export default class Example03 { editor: { model: Editors.date }, grouping: { getter: 'start', - formatter: (g) => `Start: ${g.value} (${g.count} items)`, + formatter: (g) => `Start: ${g.value} (${g.count} items)`, aggregators: [ new Aggregators.Sum('cost') ], @@ -181,7 +184,7 @@ export default class Example03 { filterable: true, filter: { model: Filters.dateRange }, grouping: { getter: 'finish', - formatter: (g) => `Finish: ${g.value} (${g.count} items)`, + formatter: (g) => `Finish: ${g.value} (${g.count} items)`, aggregators: [ new Aggregators.Sum('cost') ], @@ -203,7 +206,7 @@ export default class Example03 { formatter: Formatters.checkmarkMaterial, grouping: { getter: 'effortDriven', - formatter: (g) => `Effort-Driven: ${g.value ? 'True' : 'False'} (${g.count} items)`, + formatter: (g) => `Effort-Driven: ${g.value ? 'True' : 'False'} (${g.count} items)`, aggregators: [ new Aggregators.Sum('duration'), new Aggregators.Sum('cost') @@ -215,7 +218,7 @@ export default class Example03 { id: 'action', name: 'Action', field: 'action', width: 100, maxWidth: 100, excludeFromExport: true, formatter: () => { - return ``; + return ``; }, cellMenu: { hideCloseButton: false, @@ -309,8 +312,7 @@ export default class Example03 { draggableGrouping: { dropPlaceHolderText: 'Drop a column header here to group by the column', // hideGroupSortIcons: true, - // groupIconCssClass: 'fa fa-outdent', - deleteIconCssClass: 'mdi mdi-close color-danger', + deleteIconCssClass: 'mdi mdi-close text-color-danger', sortAscIconCssClass: 'mdi mdi-arrow-up', sortDescIconCssClass: 'mdi mdi-arrow-down', onGroupChanged: (_e, args) => this.onGroupChanged(args), @@ -443,6 +445,18 @@ export default class Example03 { this.sgb?.slickGrid?.setPreHeaderPanelVisibility(true); } + toggleDarkMode() { + this._darkMode = !this._darkMode; + if (this._darkMode) { + document.body.setAttribute('data-theme', 'dark'); + document.querySelector('.demo-container')?.classList.add('dark-mode'); + } else { + document.body.setAttribute('data-theme', 'light'); + document.querySelector('.demo-container')?.classList.remove('dark-mode'); + } + this.sgb.slickGrid?.setOptions({ darkMode: this._darkMode }); + } + toggleDraggableGroupingRow() { this.clearGroupsAndSelects(); this.sgb?.slickGrid?.setPreHeaderPanelVisibility(!this.sgb?.slickGrid?.getOptions().showPreHeaderPanel); diff --git a/examples/vite-demo-vanilla-bundle/src/examples/example04.html b/examples/vite-demo-vanilla-bundle/src/examples/example04.html index 0b99703de..182961024 100644 --- a/examples/vite-demo-vanilla-bundle/src/examples/example04.html +++ b/examples/vite-demo-vanilla-bundle/src/examples/example04.html @@ -5,7 +5,7 @@

- code + code

@@ -18,14 +18,14 @@
- - diff --git a/examples/vite-demo-vanilla-bundle/src/examples/example04.ts b/examples/vite-demo-vanilla-bundle/src/examples/example04.ts index dd2552b6d..12ac82a91 100644 --- a/examples/vite-demo-vanilla-bundle/src/examples/example04.ts +++ b/examples/vite-demo-vanilla-bundle/src/examples/example04.ts @@ -106,7 +106,7 @@ export default class Example04 { // We can also add HTML text to be rendered (any bad script will be sanitized) but we have to opt-in, else it will be sanitized enableRenderHtml: true, // collection: [{ value: '1', label: '1' }, { value: '2', label: '2' }, { value: '3', label: '3' }, { value: '4', label: '4' }, { value: '5', label: '5' }], - collection: Array.from(Array(101).keys()).map(k => ({ value: k, label: k, symbol: '' })), + collection: Array.from(Array(101).keys()).map(k => ({ value: k, label: k, symbol: '' })), customStructure: { value: 'value', label: 'label', @@ -424,16 +424,16 @@ export default class Example04 { } }, optionItems: [ - { option: 0, iconCssClass: 'mdi mdi-checkbox-blank-outline color-secondary', title: 'Not Started (0%)' }, + { option: 0, iconCssClass: 'mdi mdi-checkbox-blank-outline text-color-secondary', title: 'Not Started (0%)' }, { option: 50, iconCssClass: 'mdi mdi-flip-vertical', title: 'Half Completed (50%)' }, - { option: 100, iconCssClass: 'mdi mdi-checkbox-marked color-success', title: 'Completed (100%)' }, + { option: 100, iconCssClass: 'mdi mdi-checkbox-marked text-color-success', title: 'Completed (100%)' }, 'divider', { // we can also have multiple nested sub-menus option: null, title: 'Sub-Options (demo)', subMenuTitle: 'Set Percent Complete', optionItems: [ - { option: 0, iconCssClass: 'mdi mdi-checkbox-blank-outline color-secondary', title: 'Not Started (0%)' }, + { option: 0, iconCssClass: 'mdi mdi-checkbox-blank-outline text-color-secondary', title: 'Not Started (0%)' }, { option: 50, iconCssClass: 'mdi mdi-flip-vertical', title: 'Half Completed (50%)' }, - { option: 100, iconCssClass: 'mdi mdi-checkbox-marked color-success', title: 'Completed (100%)' }, + { option: 100, iconCssClass: 'mdi mdi-checkbox-marked text-color-success', title: 'Completed (100%)' }, ] } ], diff --git a/examples/vite-demo-vanilla-bundle/src/examples/example05.html b/examples/vite-demo-vanilla-bundle/src/examples/example05.html index 95acc78c9..23106916e 100644 --- a/examples/vite-demo-vanilla-bundle/src/examples/example05.html +++ b/examples/vite-demo-vanilla-bundle/src/examples/example05.html @@ -7,7 +7,7 @@

- code + code

diff --git a/examples/vite-demo-vanilla-bundle/src/examples/example05.scss b/examples/vite-demo-vanilla-bundle/src/examples/example05.scss index 4e3c31f91..d60049ada 100644 --- a/examples/vite-demo-vanilla-bundle/src/examples/example05.scss +++ b/examples/vite-demo-vanilla-bundle/src/examples/example05.scss @@ -1 +1,9 @@ // @import '@slickgrid-universal/common/dist/styles/sass/slickgrid-theme-material.scss'; + +.grid5 { + .slick-cell { + display: inline-flex; + align-items: center; + gap: 4px; + } +} \ No newline at end of file diff --git a/examples/vite-demo-vanilla-bundle/src/examples/example05.ts b/examples/vite-demo-vanilla-bundle/src/examples/example05.ts index 99a7ded30..b98dfdf64 100644 --- a/examples/vite-demo-vanilla-bundle/src/examples/example05.ts +++ b/examples/vite-demo-vanilla-bundle/src/examples/example05.ts @@ -77,7 +77,7 @@ export default class Example05 { showSpinner() { if (this.isLargeDataset) { - this.loadingClass = 'mdi mdi-load mdi-spin-1s mdi-24px color-alt-success'; + this.loadingClass = 'mdi mdi-load mdi-spin-1s mdi-24px text-color-alt-success'; } } @@ -252,7 +252,7 @@ export default class Example05 { titleFormatter: (_row, _cell, value, _def, dataContext) => { let titleResult = ''; if (dataContext.treeLevel > 0) { - titleResult = ``; + titleResult = ``; } titleResult += `${value}`; if (dataContext.parentId) { diff --git a/examples/vite-demo-vanilla-bundle/src/examples/example06.html b/examples/vite-demo-vanilla-bundle/src/examples/example06.html index 8823bf2f8..8f07e657b 100644 --- a/examples/vite-demo-vanilla-bundle/src/examples/example06.html +++ b/examples/vite-demo-vanilla-bundle/src/examples/example06.html @@ -6,7 +6,7 @@

Example 06 - Tree Data with Aggregators - code + code

@@ -63,7 +63,7 @@

- +

diff --git a/examples/vite-demo-vanilla-bundle/src/examples/example06.scss b/examples/vite-demo-vanilla-bundle/src/examples/example06.scss index 9f2aba6f9..2bd1ce618 100644 --- a/examples/vite-demo-vanilla-bundle/src/examples/example06.scss +++ b/examples/vite-demo-vanilla-bundle/src/examples/example06.scss @@ -1,7 +1,12 @@ // @import '@slickgrid-universal/common/dist/styles/sass/slickgrid-theme-salesforce.scss'; -@import '@slickgrid-universal/common/dist/styles/sass/sass-utilities.scss'; .grid6 { + .slick-cell { + display: inline-flex; + align-items: center; + gap: 4px; + } + .avg-total { color: #ac76ff; } @@ -16,25 +21,26 @@ } .mdi-file-pdf-outline { - /** 1. use `filter` color */ - // filter: invert(62%) sepia(93%) saturate(5654%) hue-rotate(325deg) brightness(100%) contrast(90%); - - /** 2. or use the SASS @mixin that will produce the `filter` color */ - @include recolor(#f14668, 0.9); + color: #f14668; + opacity: 0.9; } .mdi-folder, .mdi-folder-open { - @include recolor(#ffa500, 0.9); + color: #ffa500; + opacity: 0.9; } .mdi-file-music-outline { - @include recolor(#3298dc, 0.9); + color: #3298dc; + opacity: 0.9; } .mdi-file-excel-outline { - @include recolor(#1E9F75, 0.9); + color: #1E9F75; + opacity: 0.9; } .mdi-file-document-outline, .mdi-file-question-outline { - @include recolor(#686868, 0.9); + color: #686868; + opacity: 0.9; } } .display-inline-block { diff --git a/examples/vite-demo-vanilla-bundle/src/examples/example06.ts b/examples/vite-demo-vanilla-bundle/src/examples/example06.ts index b77ef9cf6..a346a680a 100644 --- a/examples/vite-demo-vanilla-bundle/src/examples/example06.ts +++ b/examples/vite-demo-vanilla-bundle/src/examples/example06.ts @@ -41,12 +41,12 @@ export default class Example06 { this.datasetHierarchical = this.mockDataset(); const gridContainerElm = document.querySelector('.grid6') as HTMLDivElement; this.sgb = new Slicker.GridBundle(gridContainerElm, this.columnDefinitions, { ...ExampleGridOptions, ...this.gridOptions }, undefined, this.datasetHierarchical); - document.body.classList.add('material-theme'); + document.body.classList.add('salesforce-theme'); } dispose() { this.sgb?.dispose(); - document.body.classList.remove('material-theme'); + document.body.classList.remove('salesforce-theme'); } initializeGrid() { @@ -97,10 +97,10 @@ export default class Example06 { if (avgVal !== undefined && sumVal !== undefined) { // when found Avg & Sum, we'll display both - return isNaN(sumVal) ? '' : `sum: ${decimalFormatted(sumVal, 0, 2)} MB / avg: ${decimalFormatted(avgVal, 0, 2)} MB (${treeLevel === 0 ? 'total' : 'sub-total'})`; + return isNaN(sumVal) ? '' : `sum: ${decimalFormatted(sumVal, 0, 2)} MB / avg: ${decimalFormatted(avgVal, 0, 2)} MB (${treeLevel === 0 ? 'total' : 'sub-total'})`; } else if (sumVal !== undefined) { // or when only Sum is aggregated, then just show Sum - return isNaN(sumVal) ? '' : `sum: ${decimalFormatted(sumVal, 0, 2)} MB (${treeLevel === 0 ? 'total' : 'sub-total'})`; + return isNaN(sumVal) ? '' : `sum: ${decimalFormatted(sumVal, 0, 2)} MB (${treeLevel === 0 ? 'total' : 'sub-total'})`; } } // reaching this line means it's a regular dataContext without totals, so regular formatter output will be used @@ -132,7 +132,7 @@ export default class Example06 { enableFiltering: true, enableTreeData: true, // you must enable this flag for the filtering & sorting to work as expected multiColumnSort: false, // multi-column sorting is not supported with Tree Data, so you need to disable it - rowHeight: 40, + rowHeight: 35, treeDataOptions: { columnId: 'file', childrenPropName: 'files', diff --git a/examples/vite-demo-vanilla-bundle/src/examples/example07.html b/examples/vite-demo-vanilla-bundle/src/examples/example07.html index bb0f27338..a38bdb013 100644 --- a/examples/vite-demo-vanilla-bundle/src/examples/example07.html +++ b/examples/vite-demo-vanilla-bundle/src/examples/example07.html @@ -10,7 +10,7 @@

see - code + code

diff --git a/examples/vite-demo-vanilla-bundle/src/examples/example07.ts b/examples/vite-demo-vanilla-bundle/src/examples/example07.ts index 31370f755..b5342c067 100644 --- a/examples/vite-demo-vanilla-bundle/src/examples/example07.ts +++ b/examples/vite-demo-vanilla-bundle/src/examples/example07.ts @@ -78,7 +78,7 @@ export default class Example07 { { id: 'action', name: 'Action', field: 'action', minWidth: 60, maxWidth: 60, excludeFromExport: true, excludeFromHeaderMenu: true, - formatter: () => `
`, + formatter: () => `
`, cellMenu: { hideCloseButton: false, subItemChevronClass: 'mdi mdi-chevron-down mdi-rotate-270', @@ -86,7 +86,7 @@ export default class Example07 { commandItems: [ { command: 'command1', titleKey: 'DELETE_ROW', - iconCssClass: 'mdi mdi-close color-danger', cssClass: 'has-text-danger', textCssClass: 'bold', + iconCssClass: 'mdi mdi-close', cssClass: 'has-text-danger', textCssClass: 'bold', action: (_e, args) => { if (confirm(`Do you really want to delete row (${args.row! + 1}) with "${args.dataContext.title}"?`)) { this.sgb?.gridService.deleteItemById(args.dataContext.id); @@ -193,8 +193,8 @@ export default class Example07 { enableRenderHtml: true, collection: [ { value: '', label: '' }, - { value: true, label: 'True', labelSuffix: ` ` }, - { value: false, label: 'False', labelSuffix: ` ` } + { value: true, label: 'True', labelSuffix: ` ` }, + { value: false, label: 'False', labelSuffix: ` ` } ], model: Filters.singleSelect }, @@ -208,8 +208,8 @@ export default class Example07 { enableRenderHtml: true, collectionAsync: new Promise(resolve => setTimeout(() => { resolve([ - { value: true, label: 'True', labelSuffix: ` ` }, - { value: false, label: 'False', labelSuffix: ` ` } + { value: true, label: 'True', labelSuffix: ` ` }, + { value: false, label: 'False', labelSuffix: ` ` } ]); }, 250)), }, @@ -403,7 +403,7 @@ export default class Example07 {