You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/filter-types/filters-daterange.md
+70-15Lines changed: 70 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -31,6 +31,7 @@ public function filters(): array
31
31
'earliestDate' => '2020-01-01', // The earliest acceptable date
32
32
'latestDate' => '2023-08-01', // The latest acceptable date
33
33
'placeholder' => 'Enter Date Range', // A placeholder value
34
+
'locale' => 'en',
34
35
])
35
36
->setFilterPillValues([0 => 'minDate', 1 => 'maxDate']) // The values that will be displayed for the Min/Max Date Values
36
37
->filter(function (Builder $builder, array $dateRange) { // Expects an array.
@@ -42,31 +43,85 @@ public function filters(): array
42
43
}
43
44
```
44
45
46
+
## Configuration
47
+
By default, this filter will inject the Flatpickr JS Library and CSS. However, you can customise this behaviour using the configuration file.
48
+
49
+
### Option 1 - The default behaviour:
50
+
```
51
+
'inject_third_party_assets_enabled' => true,
52
+
```
45
53
54
+
### Option 2 - Bundled
55
+
If you choose to bundle the Tables JS/CSS (recommended) by adding the following to your build process:
46
56
47
-
## Configuration
48
-
By default, this filter will use a CDN to include the Flatpickr JS Library and CSS. However, you can customise this behaviour using the configuration file.
This will publish the tested version of Flatpickr to your public directory. You should then set
72
+
73
+
### Option 3 - CDN
74
+
You must ensure that Flatpickr is present PRIOR to the tables loading. For example, to add Flatpickr with the Spanish locale, ensure that the following is present in your Layout head section. Noting the "async" presence to ensure that the script is present before a page renders.
75
+
76
+
It is typically recommended not to utilise the CDN approach, as changes to core code may impact behaviour, and you may need to implement changes to your CSP if present.
77
+
78
+
If using the CDN approach, ensure the following config matches:
62
79
```
63
-
'published_third_party_assets' => true,
64
-
'remote_third_party_assets' => false,
80
+
'inject_third_party_assets_enabled' => false,
65
81
```
66
82
67
-
### Option 3 - Locally Installed
68
-
If you have a locally installed version of Flatpickr already, you can set both options to false, and your local version will be used instead.
If you have a locally installed version of Flatpickr already, you can set injection to false, and your local version will be used instead.
94
+
```
95
+
'inject_third_party_assets_enabled' => false,
96
+
```
97
+
98
+
## Localisation (BETA)
99
+
The default installation includes only the English (en) locale.
100
+
101
+
### Bundling
102
+
Should you wish to localise, you must include the Flatpickr locale files in your build pipeline. This applies to only the specific locales that you require in your app.js (requires adding the flatpickr library to your package.json by executing "npm i flatpickr --save")
103
+
```
104
+
import { Arabic } from "../imports/flatpickr/l10n/ar.js";
105
+
import { Catalan } from "../imports/flatpickr/l10n/cat.js";
106
+
import { Danish } from "../imports/flatpickr/l10n/da.js";
107
+
import { German } from "../imports/flatpickr/l10n/de.js";
108
+
import { Spanish } from "../imports/flatpickr/l10n/es.js";
109
+
import { French } from "../imports/flatpickr/l10n/fr.js";
110
+
import { Indonesian } from "../imports/flatpickr/l10n/id.js";
111
+
import { Italian } from "../imports/flatpickr/l10n/it.js";
112
+
import { Malaysian } from "../imports/flatpickr/l10n/ms.js";
113
+
import { Dutch } from "../imports/flatpickr/l10n/nl.js";
114
+
import { Portuguese } from "../imports/flatpickr/l10n/pt.js";
115
+
import { Russian } from "../imports/flatpickr/l10n/ru.js"
116
+
import { Thai } from "../imports/flatpickr/l10n/th.js"
117
+
import { Turkish } from "../imports/flatpickr/l10n/tr.js"
118
+
import { Ukrainian } from "../imports/flatpickr/l10n/uk.js"
119
+
```
120
+
121
+
### CDN
122
+
You can also add locales using the Flatpickr CDN, ensuring that these are loaded before the page renders.
123
+
124
+
For example to add German (de), ensure that the following is in the "head" section of your layout, ideally before your app.js
0 commit comments