@mapomodule/uikit 1.0.0-alpha.13 → 1.0.0-alpha.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [1.0.0-alpha.14](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.13...v1.0.0-alpha.14) (2022-03-01)
7
+
8
+
9
+ ### Features
10
+
11
+ * added default choice to filtering ([75d4cb6](https://github.com/lotrekagency/mapo/commit/75d4cb6a4dfde8afc26bffe4b9d88ac3929bbdcd))
12
+
13
+
14
+
15
+
16
+
6
17
  # [1.0.0-alpha.13](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.12...v1.0.0-alpha.13) (2022-03-01)
7
18
 
8
19
 
@@ -261,15 +261,24 @@ export default {
261
261
  });
262
262
  },
263
263
  loadFilters() {
264
- this.compFilters = this.filters.map(filter => {
265
- if (filter.datepicker) {
266
- return {
267
- ...filter,
268
- dates: [],
269
- };
264
+ this.compFilters = this.filters.map(filter => ({...filter, dates: filter.datepicker ? [] : undefined}));
265
+ this.applyDefaultChoices()
266
+ },
267
+ applyDefaultChoices(){
268
+ this.compFilters.forEach(filter=>{
269
+ if (filter.defaultChoice){
270
+ if (filter.datepicker) {
271
+ filter.dates = [...filter.defaultChoice.split(",")];
272
+ this.addDateFilter(filter);
273
+ } else {
274
+ filter.choices.forEach((c) => {
275
+ filter.defaultChoice.split(",").includes(c.value + "") &&
276
+ this.addFilter(filter, c);
277
+ });
278
+ }
270
279
  }
271
- return filter;
272
- });
280
+ })
281
+
273
282
  }
274
283
  },
275
284
  watch: {
@@ -296,6 +305,7 @@ The filters prop is a list of `Filter` objects made of several keys:
296
305
 
297
306
  - **"text"** `String` ==> The name of the filter that will be renered inside the filter menu.
298
307
  - **"value"** `String` ==> The dotted path of the value we need to filter on.
308
+ - **"defaultChoice"** `String` ==> A choice value that is applied on the startup of the component. This lets you start the list with some filter already applied.
299
309
  - **"choices"** `Array<Choice>` ==> The list of choices rendered inside the filter. The text is the label, the value is the string we use as a filter.
300
310
  - **"datepicker"** `Boolean` ==> This is a boolean that determines if the filter has a datepicker layout.
301
311
  - **"multiple"** `Boolean` ==> This is a boolean that determines if the filter is exclusive or inclusive. In other words, if by selecting a choice it is added to the previous one or if it replaces it.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mapomodule/uikit",
3
- "version": "1.0.0-alpha.13",
3
+ "version": "1.0.0-alpha.14",
4
4
  "license": "MIT",
5
5
  "description": "This is part of Mapo nuxt module. Injects Mapo ui components in the nuxt component discovery system.",
6
6
  "author": "bnznamco <gabriele.baldi.01@gmail.com>",
@@ -13,5 +13,5 @@
13
13
  "publishConfig": {
14
14
  "access": "public"
15
15
  },
16
- "gitHead": "b0fac0f5ebde4c65cc5347dbb841392dc04ef5e8"
16
+ "gitHead": "0975dada05d34efb26a3c7ab0f3ebe8c01f1ca30"
17
17
  }