Skip to content

Commit

Permalink
feat!: remove Font-Awesome and use new SVG icons (#1191)
Browse files Browse the repository at this point in the history
* feat!: remove Font-Awesome and use new SVG icons
  • Loading branch information
ghiscoding committed May 7, 2024
1 parent 5b9b543 commit 6f7b6fe
Show file tree
Hide file tree
Showing 119 changed files with 1,098 additions and 1,180 deletions.
2 changes: 1 addition & 1 deletion docs/TOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@

* [Dark Mode](styling/dark-mode.md)
* [Styling CSS/SASS/Themes](styling/styling.md)
* [SVG Icons](styling/svg-icons.md)

## Column Functionalities

* [Cell Menu (Action Menu)](column-functionalities/cell-menu.md)
* [Editors](column-functionalities/editors.md)
* [new Autocomplete (Kraaden-lib)](column-functionalities/editors/autocomplete-editor-kraaden.md)
* [Date Picker (flatpickr)](column-functionalities/editors/date-editor-flatpickr.md)
* [Date Picker (vanilla-calendar)](column-functionalities/editors/date-editor-(vanilla-calendar).md)
* [LongText (textarea)](column-functionalities/editors/longtext-editor-textarea.md)
* [Select Dropdown Editor (single/multiple)](column-functionalities/editors/select-dropdown-editor.md)
* [Filters](column-functionalities/filters/README.md)
Expand Down
18 changes: 9 additions & 9 deletions docs/column-functionalities/cell-menu.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -174,9 +174,9 @@ this.columnDefinitions = [
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' },
{ 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' },
]
}
}
Expand All @@ -191,9 +191,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' },
]
}
}
Expand Down
12 changes: 6 additions & 6 deletions docs/column-functionalities/editors.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ this.columnDefinitions = [
}
},
{
id: 'effort-driven', name: 'Effort Driven', field: 'effortDriven', formatter: Formatters.checkmark,
id: 'effort-driven', name: 'Effort Driven', field: 'effortDriven', formatter: Formatters.checkmarkMaterial,
type: FieldType.number, editor: { model: Editors.checkbox }
}
];
Expand Down Expand Up @@ -91,7 +91,7 @@ this.columnDefinitions = [
];
```

So to make it more clear, the `saveOutputType` is the format that will be sent to the `onCellChange` event, then the `outputType` is how the date will show up in the date picker (Flatpickr) and finally the `type` is basically the input format (coming from your dataset). Note however that each property are cascading, if 1 property is missing it will go to the next one until 1 is found... for example, on the `onCellChange` if you aren't defining `saveOutputType`, it will try to use `outputType`, if again none is provided it will try to use `type` and finally if none is provided it will use `FieldType.dateIso` as the default.
So to make it more clear, the `saveOutputType` is the format that will be sent to the `onCellChange` event, then the `outputType` is how the date will show up in the date picker (Vanilla-Calendar) and finally the `type` is basically the input format (coming from your dataset). Note however that each property are cascading, if 1 property is missing it will go to the next one until 1 is found... for example, on the `onCellChange` if you aren't defining `saveOutputType`, it will try to use `outputType`, if again none is provided it will try to use `type` and finally if none is provided it will use `FieldType.dateIso` as the default.

## Perform an action After Inline Edit
#### Recommended way
Expand Down Expand Up @@ -325,12 +325,12 @@ By default HTML is not rendered and the `label` will simply show HTML as text. B
this.columnDefinitions = [
{
id: 'effort-driven', name: 'Effort Driven', field: 'effortDriven',
formatter: Formatters.checkmark,
formatter: Formatters.checkmarkMaterial,
type: FieldType.boolean,
editor: {
// display checkmark icon when True
enableRenderHtml: true,
collection: [{ value: '', label: '' }, { value: true, label: 'True', labelPrefix: `<i class="fa fa-check"></i> ` }, { value: false, label: 'False' }],
collection: [{ value: '', label: '' }, { value: true, label: 'True', labelPrefix: `<i class="mdi mdi-check"></i> ` }, { value: false, label: 'False' }],
model: Editors.singleSelect
}
}
Expand Down Expand Up @@ -386,7 +386,7 @@ this.columnDefinitions = [{
id: 'start', name: 'Start Date', field: 'start',
editor: {
model: Editors.date,
editorOptions: { minDate: 'today' }
editorOptions: { range: { date: 'today' } } as VanillaCalendarOption
}
}];
```
Expand All @@ -398,7 +398,7 @@ You could also define certain options as a global level (for the entire grid or
this.gridOptions = {
defaultEditorOptions: {
autocompleter: { debounceWaitMs: 150 }, // typed as AutocompleterOption
date: { minDate: 'today' },
date: { range: { date: 'today' } },
longText: { cols: 50, rows: 5 }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ By default HTML is not rendered and the `label` will simply show HTML as text. B
this.columnDefinitions = [
{
id: 'effort-driven', name: 'Effort Driven', field: 'effortDriven',
formatter: Formatters.checkmark,
formatter: Formatters.checkmarkMaterial,
type: FieldType.boolean,
editor: {
model: Editors.autocompleter,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
##### index
- [Editor Options](#editor-options)
- [Custom Validator](#custom-validator)
- See the [Editors - Wiki](../Editors.md) for more general info about Editors (validators, event handlers, ...)

### Information
The Date Editor is provided through an external library named [Vanilla-Calendar-Picker](https://github.com/ghiscoding/vanilla-calendar-picker) (a fork of [Vanilla-Calendar-Pro](https://vanilla-calendar.pro)) and all options from that library can be added to your `editorOptions` (see below), so in order to add things like minimum date, disabling dates, ... just review all the [Vanilla-Calendar-Pro](https://vanilla-calendar.pro/docs/reference/additionally/settings) and then add them into `editorOptions`. Also just so you know, `editorOptions` is use by all other editors as well to expose external library like Autocompleter, Multiple-Select, etc...

### Demo
[Demo Page](https://ghiscoding.github.io/slickgrid-universal/#/example12) | [Demo Component](https://github.com/ghiscoding/slickgrid-universal/blob/master/examples/webpack-demo-vanilla-bundle/src/examples/example12.ts)

### Editor Options
You can use any of the Vanilla-Calendar [settings](https://vanilla-calendar.pro/docs/reference/additionally/settings) by adding them to `editorOptions` as shown below.

> **Note** for easier implementation, you should import `VanillaCalendarOption` from Slickgrid-Universal common package.
```ts
import { type VanillaCalendarOption } from '@slickgrid-universal/common';

prepareGrid() {
this.columnDefinitions = [
{
id: 'title', name: 'Title', field: 'title',
editor: {
model: Editors.date,
editorOptions: {
range: {
max: 'today',
disabled: ['2022-08-15', '2022-08-20'],
}
} as VanillaCalendarOption,
},
},
];
}
```

#### Grid Option `defaultEditorOptions
You could also define certain options as a global level (for the entire grid or even all grids) by taking advantage of the `defaultEditorOptions` Grid Option. Note that they are set via the editor type as a key name (`autocompleter`, `date`, ...) and then the content is the same as `editorOptions` (also note that each key is already typed with the correct editor option interface), for example

```ts
this.gridOptions = {
defaultEditorOptions: {
date: { range: { min: 'today' } }, // typed as VanillaCalendarOption
}
}
```

### Custom Validator
You can add a Custom Validator from an external function or inline (inline is shown below and comes from [Example 12](https://ghiscoding.github.io/slickgrid-universal/#/example12))
```ts
initializeGrid() {
this.columnDefinitions = [
{
id: 'title', name: 'Title', field: 'title',
editor: {
model: Editors.date,
required: true,
validator: (value, args) => {
const dataContext = args && args.item;
if (dataContext && (dataContext.completed && !value)) {
return { valid: false, msg: 'You must provide a "Finish" date when "Completed" is checked.' };
}
return { valid: true, msg: '' };
}
},
},
];
}
```
6 changes: 3 additions & 3 deletions docs/column-functionalities/editors/select-dropdown-editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,12 @@ By default HTML is not rendered and the `label` will simply show HTML as text. B
this.columnDefinitions = [
{
id: 'effort-driven', name: 'Effort Driven', field: 'effortDriven',
formatter: Formatters.checkmark,
formatter: Formatters.checkmarkMaterial,
type: FieldType.boolean,
editor: {
// display checkmark icon when True
enableRenderHtml: true,
collection: [{ value: '', label: '' }, { value: true, label: 'True', labelPrefix: `<i class="fa fa-check"></i> ` }, { value: false, label: 'False' }],
collection: [{ value: '', label: '' }, { value: true, label: 'True', labelPrefix: `<i class="mdi mdi-check"></i> ` }, { value: false, label: 'False' }],
model: Editors.singleSelect
}
}
Expand All @@ -177,7 +177,7 @@ Sometime you wish that whenever you change your filter collection, you'd like th
this.columnDefinitions = [
{
id: 'effort-driven', name: 'Effort Driven', field: 'effortDriven',
formatter: Formatters.checkmark,
formatter: Formatters.checkmarkMaterial,
type: FieldType.boolean,
editor: {
// watch for any changes in the collection and re-render when that happens
Expand Down
36 changes: 8 additions & 28 deletions docs/column-functionalities/filters/compound-filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
- [SASS Styling](#sass-styling)
- [Compound Input Filter](#how-to-use-compoundinput-filter)
- [Compound Date Filter](#how-to-use-compounddate-filter)
- [Filter Options (`FlatpickrOption` interface)](#filter-options-flatpickroption-interface)
- [Compound Operator List (custom list)](#compound-operator-list-custom-list)
- [Compound Operator Alternate Texts](#compound-operator-alternate-texts)
- [Filter Complex Object](../Input-Filter.md#how-to-filter-complex-objects)
- [Update Filters Dynamically](../Input-Filter.md#update-filters-dynamically)
- [How to avoid filtering when only Operator dropdown is changed?](#how-to-avoid-filtering-when-only-operator-dropdown-is-changed)

### Description
Compound filters are a combination of 2 elements (Operator Select + Input Filter) used as a filter on a column. This is very useful to make it obvious to the user that there are Operator available and even more useful with a date picker (`Flatpickr`).
Compound filters are a combination of 2 elements (Operator Select + Input Filter) used as a filter on a column. This is very useful to make it obvious to the user that there are Operator available and even more useful with a date picker (`Vanilla-Calendar`).

### Demo
[Demo Page](https://ghiscoding.github.io/aurelia-slickgrid/#/slickgrid/example4) / [Demo Component](https://github.com/ghiscoding/aurelia-slickgrid/blob/master/packages/demo/src/examples/slickgrid/example4.ts)
Expand All @@ -21,12 +20,9 @@ There are multiple types of compound filters available
1. `Filters.compoundInputText` adds an Operator combine to an Input of type `text` (alias to `Filters.compoundInput`).
2. `Filters.compoundInputNumber` adds an Operator combine to an Input of type `number`.
3. `Filters.compoundInputPassword` adds an Operator combine to an Input of type `password.
4. `Filters.compoundDate` adds an Operator combine to a Date Picker (flatpickr).
4. `Filters.compoundDate` adds an Operator combine to a Date Picker.
5. `Filters.compoundSlider` adds an Operator combine to a Slider Filter.

### SASS Styling
You can change the `$flatpickr-bgcolor` and any of the `$compound-filter-X` SASS [variables](https://github.com/ghiscoding/slickgrid-universal/blob/master/packages/common/src/styles/_variables.scss#L660) for styling. For more info on how to use SASS in your project, read the [Wiki - Styling](../../styling/styling.md)

### How to use CompoundInput Filter
Simply set the flag `filterable` to True and use the filter type `Filters.compoundInput`. Here is an example with a full column definition:
```ts
Expand Down Expand Up @@ -125,43 +121,27 @@ this.gridOptions = {
};
```

#### Filter Options (`FlatpickrOption` interface)
All the available options that can be provided as `filterOptions` to your column definitions can be found under this [FlatpickrOption interface](https://github.com/ghiscoding/slickgrid-universal/blob/master/packages/common/src/interfaces/flatpickrOption.interface.ts) and you should cast your `filterOptions` to that interface to make sure that you use only valid options of the [Flatpickr](https://flatpickr.js.org/) library.
#### Filter Options (`VanillaCalendarOption` interface)
All the available options that can be provided as `filterOptions` to your column definitions can be found under this [VanillaCalendarOption interface](https://github.com/ghiscoding/slickgrid-universal/blob/master/packages/common/src/interfaces/vanillaCalendarOption.interface.ts) and you should cast your `filterOptions` with the expected interface to make sure that you use only valid settings of the [Vanilla-Calendar](https://vanilla-calendar.pro/docs/reference/additionally/settings) library.

```ts
filter: {
model: Filters.compoundDate,
filterOptions: {
minDate: 'today'
} as FlatpickrOption
range: { min: 'today' }
} as VanillaCalendarOption
}
```

### Date Picker - Flatpickr Localization
In order to use different locale, you will have to import whichever Flatpickr locale you need. The best place to do these imports is in your App Module so it's global and you do it only once. In some rare cases it might not be sufficient, you move the import into your first entry component, typically the App Component


##### with WebPack
```ts
import { Aurelia } from 'aurelia-framework';
import { GridOption } from 'aurelia-slickgrid';

export function configure(aurelia: Aurelia) {
aurelia.use.plugin(PLATFORM.moduleName('aurelia-slickgrid'), (config) => {
// load necessary Flatpickr Locale(s), but make sure it's imported AFTER loading Aurelia-Slickgrid plugin
import('flatpickr/dist/l10n/fr');
});
```
#### Grid Option `defaultFilterOptions
You could also define certain options as a global level (for the entire grid or even all grids) by taking advantage of the `defaultFilterOptions` Grid Option. Note that they are set via the filter type as a key name (`autocompleter`, `date`, ...) and then the content is the same as `filterOptions` (also note that each key is already typed with the correct filter option interface), for example

```ts
this.gridOptions = {
defaultFilterOptions: {
// Note: that `date`, `select` and `slider` are combining both compound & range filters together
date: { minDate: 'today' },
select: { minHeight: 350 }, // typed as MultipleSelectOption
date: { range: { min: 'today' } }, // typed as VanillaCalendarOption
select: { minHeight: 350 }, // typed as MultipleSelectOption
slider: { sliderStartValue: 10 }
}
}
Expand Down

0 comments on commit 6f7b6fe

Please sign in to comment.