@startinblox/core 0.18.1 → 0.18.2

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.
@@ -52,6 +52,8 @@ export const SolidFormSearch = {
52
52
  get defaultSetWidget() {
53
53
  return 'solid-set-default';
54
54
  },
55
+ // Returns the current value of the search from
56
+ // As a search query object
55
57
  get value() {
56
58
  const values = {};
57
59
  this.widgets.forEach(widget => {
@@ -61,6 +63,7 @@ export const SolidFormSearch = {
61
63
  try {
62
64
  value = JSON.parse(value);
63
65
  } catch {}
66
+ // Add another filter value in the values array
64
67
  value = {
65
68
  type: widget.component.type,
66
69
  list: !!widget.component.multiple,
@@ -67,7 +67,7 @@ const orThrow = (throwOn, ret) => {
67
67
  */
68
68
  const matchValue = async (val, query, throwOn) => {
69
69
  const subject = await val;
70
- if (subject == null && query.value === '') return orThrow(throwOn, true); // filter not set and subject not existing -> ignore filter
70
+ if (subject == null && query.value === '' && query.type !== 'string') return orThrow(throwOn, true); // filter not set and subject not existing -> ignore filter only if type is not string
71
71
  if (subject == null) return orThrow(throwOn, false); // return false; // property does not exist on resource
72
72
  if (query.list) {
73
73
  // Filter on a container
@@ -136,7 +136,10 @@ function fuzzyCompare(subject, search) {
136
136
  }
137
137
  const compare = {
138
138
  string(subject, query) {
139
- if (query === '') return true;
139
+ // Exact match on empty string between query and subject
140
+ if (query === '' && subject.toString() === '') return false;
141
+ // Else if query is empty and subject is something else, return true
142
+ else if (query === '') return true;
140
143
  if (subject.toString().toLowerCase().includes(String(query).toLowerCase())) return true;
141
144
  return fuzzyCompare(subject, query);
142
145
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@startinblox/core",
3
- "version": "0.18.1",
3
+ "version": "0.18.2",
4
4
  "description": "This is a series of web component respecting both the web components standards and the Linked Data Platform convention.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",