Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RangeSlider fix: Level indications + flexible boundaries + Removing 0 min range filters #828

Merged
merged 5 commits into from
Dec 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,24 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [3.0.0-canary.23](https://github.com/searchkit/searchkit/compare/v3.0.0-canary.19...v3.0.0-canary.23) (2020-12-20)


### Bug Fixes

* **client:** bug fix for unable to remove filter when range min is 0 ([93bd74e](https://github.com/searchkit/searchkit/commit/93bd74eeda712fb658f2deeb9b5908f087268bd9))
* **rangeslider:** fix slider when boundaries are not 0-100 ([ee22887](https://github.com/searchkit/searchkit/commit/ee2288780702a6799c2f27b87c2f2721983181ca)), closes [#827](https://github.com/searchkit/searchkit/issues/827)
* **searchkit/cli:** fix issue with cli not working ([#826](https://github.com/searchkit/searchkit/issues/826)) ([1a9784d](https://github.com/searchkit/searchkit/commit/1a9784d634fe6331b42b0af63a4dbe37a95269f3))


### Features

* re-order facets ([1f28f4c](https://github.com/searchkit/searchkit/commit/1f28f4c36c9089fcecc6d45f985d889784796949))





# [3.0.0-canary.22](https://github.com/searchkit/searchkit/compare/v3.0.0-canary.19...v3.0.0-canary.22) (2020-12-19)

**Note:** Version bump only for package searchkit
Expand Down
29 changes: 15 additions & 14 deletions examples/next/pages/api/graphql.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@ const searchkitConfig = {
}
}),

new RefinementSelectFacet({
field: 'rated',
identifier: 'rated',
label: 'Rated',
multipleSelect: true
}),

new DateRangeFacet({
field: 'released',
Expand All @@ -61,6 +55,18 @@ const searchkitConfig = {
multipleSelect: true
}),

new RefinementSelectFacet({
field: 'countries.keyword',
identifier: 'countries',
label: 'Countries',
display: 'ComboBoxFacet'
}),
new RefinementSelectFacet({
field: 'rated',
identifier: 'rated',
label: 'Rated',
multipleSelect: true
}),
new RefinementSelectFacet({
field: 'directors.keyword',
identifier: 'directors',
Expand All @@ -80,13 +86,6 @@ const searchkitConfig = {
multipleSelect: true
}),

new RefinementSelectFacet({
field: 'countries.keyword',
identifier: 'countries',
label: 'Countries',
display: 'ComboBoxFacet'
}),

new RangeFacet({
field: 'imdbrating',
identifier: 'imdbrating',
Expand All @@ -96,7 +95,9 @@ const searchkitConfig = {
max: 10,
min: 1
}
})
}),


]
}

Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"packages": [
"packages/*"
],
"version": "3.0.0-canary.22",
"version": "3.0.0-canary.23",
"includeMergedTags": true,
"command": {
"publish": {
Expand Down
11 changes: 11 additions & 0 deletions packages/searchkit-apollo-resolvers/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [3.0.0-canary.23](https://github.com/searchkit/searchkit/compare/v3.0.0-canary.19...v3.0.0-canary.23) (2020-12-20)


### Bug Fixes

* **searchkit/cli:** fix issue with cli not working ([#826](https://github.com/searchkit/searchkit/issues/826)) ([1a9784d](https://github.com/searchkit/searchkit/commit/1a9784d634fe6331b42b0af63a4dbe37a95269f3))





# [3.0.0-canary.22](https://github.com/searchkit/searchkit/compare/v3.0.0-canary.19...v3.0.0-canary.22) (2020-12-19)

**Note:** Version bump only for package @searchkit/apollo-resolvers
Expand Down
2 changes: 1 addition & 1 deletion packages/searchkit-apollo-resolvers/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@searchkit/apollo-resolvers",
"version": "3.0.0-canary.22",
"version": "3.0.0-canary.23",
"main": "lib/index.js",
"author": "Joseph McElroy <phoey1@gmail.com>",
"license": "Apache-2.0",
Expand Down
11 changes: 11 additions & 0 deletions packages/searchkit-cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [3.0.0-canary.23](https://github.com/searchkit/searchkit/compare/v3.0.0-canary.19...v3.0.0-canary.23) (2020-12-20)


### Bug Fixes

* **searchkit/cli:** fix issue with cli not working ([#826](https://github.com/searchkit/searchkit/issues/826)) ([1a9784d](https://github.com/searchkit/searchkit/commit/1a9784d634fe6331b42b0af63a4dbe37a95269f3))





# [3.0.0-canary.22](https://github.com/searchkit/searchkit/compare/v3.0.0-canary.19...v3.0.0-canary.22) (2020-12-19)

**Note:** Version bump only for package @searchkit/cli
Expand Down
2 changes: 1 addition & 1 deletion packages/searchkit-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@searchkit/cli",
"version": "3.0.0-canary.22",
"version": "3.0.0-canary.23",
"main": "lib/index.js",
"author": "Joseph McElroy <phoey1@gmail.com>",
"license": "Apache-2.0",
Expand Down
12 changes: 12 additions & 0 deletions packages/searchkit-client/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [3.0.0-canary.23](https://github.com/searchkit/searchkit/compare/v3.0.0-canary.19...v3.0.0-canary.23) (2020-12-20)


### Bug Fixes

* **client:** bug fix for unable to remove filter when range min is 0 ([93bd74e](https://github.com/searchkit/searchkit/commit/93bd74eeda712fb658f2deeb9b5908f087268bd9))
* **searchkit/cli:** fix issue with cli not working ([#826](https://github.com/searchkit/searchkit/issues/826)) ([1a9784d](https://github.com/searchkit/searchkit/commit/1a9784d634fe6331b42b0af63a4dbe37a95269f3))





# [3.0.0-canary.22](https://github.com/searchkit/searchkit/compare/v3.0.0-canary.19...v3.0.0-canary.22) (2020-12-19)

**Note:** Version bump only for package @searchkit/client
Expand Down
2 changes: 1 addition & 1 deletion packages/searchkit-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@searchkit/client",
"version": "3.0.0-canary.22",
"version": "3.0.0-canary.23",
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
"types": "./lib/esm/index.d.ts",
Expand Down
8 changes: 8 additions & 0 deletions packages/searchkit-client/src/__tests__/searchkit.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ describe('Searchkit Client', () => {
])
})

it('should toggle range filters', () => {
const api = new SearchkitClient()
api.addFilter({ identifier: 'type', min: 0, max: 100 })
expect(api.getFilters()).toEqual([{ identifier: 'type', min: 0, max: 100 }])
api.toggleFilter({ identifier: 'type', min: 0, max: 100 })
expect(api.getFilters()).toEqual([])
})

it('should remove multiple filters by id', () => {
const api = new SearchkitClient()
api.addFilter({ identifier: 'type', value: 'Movies' })
Expand Down
10 changes: 9 additions & 1 deletion packages/searchkit-client/src/searchkit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,17 @@ export interface SearchkitClientConfig {
searchOnLoad?: boolean
}

const isDefined = (str) => typeof str !== 'undefined' && str !== null

const filterSelector = (filter: Filter) => (f: Filter) => {
if (filter.identifier !== f.identifier) return false
if (filter.min && filter.max && filter.min === f.min && filter.max === f.max) return true
if (
isDefined(filter.min) &&
isDefined(filter.max) &&
filter.min === f.min &&
filter.max === f.max
)
return true
if (
filter.dateMin &&
filter.dateMax &&
Expand Down
12 changes: 12 additions & 0 deletions packages/searchkit-elastic-ui/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [3.0.0-canary.23](https://github.com/searchkit/searchkit/compare/v3.0.0-canary.19...v3.0.0-canary.23) (2020-12-20)


### Bug Fixes

* **rangeslider:** fix slider when boundaries are not 0-100 ([ee22887](https://github.com/searchkit/searchkit/commit/ee2288780702a6799c2f27b87c2f2721983181ca)), closes [#827](https://github.com/searchkit/searchkit/issues/827)
* **searchkit/cli:** fix issue with cli not working ([#826](https://github.com/searchkit/searchkit/issues/826)) ([1a9784d](https://github.com/searchkit/searchkit/commit/1a9784d634fe6331b42b0af63a4dbe37a95269f3))





# [3.0.0-canary.22](https://github.com/searchkit/searchkit/compare/v3.0.0-canary.19...v3.0.0-canary.22) (2020-12-19)

**Note:** Version bump only for package @searchkit/elastic-ui
Expand Down
4 changes: 2 additions & 2 deletions packages/searchkit-elastic-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@searchkit/elastic-ui",
"version": "3.0.0-canary.22",
"version": "3.0.0-canary.23",
"main": "./lib/cjs/index.js",
"module": "./lib/esm/index.js",
"types": "lib/esm/index.d.ts",
Expand Down Expand Up @@ -33,7 +33,7 @@
"access": "public"
},
"dependencies": {
"@searchkit/client": "^3.0.0-canary.22",
"@searchkit/client": "^3.0.0-canary.23",
"use-debounce": "^5.0.3"
},
"devDependencies": {
Expand Down