@awsui/collection-hooks
Advanced tools
Comparing version 1.0.80 to 1.0.81
@@ -150,5 +150,10 @@ import * as React from 'react'; | ||
} | ||
export interface PropertyFilterTokenGroup { | ||
operation: PropertyFilterOperation; | ||
tokens: readonly (PropertyFilterToken | PropertyFilterTokenGroup)[]; | ||
} | ||
export interface PropertyFilterQuery { | ||
tokens: readonly PropertyFilterToken[]; | ||
operation: PropertyFilterOperation; | ||
tokenGroups?: readonly (PropertyFilterToken | PropertyFilterTokenGroup)[]; | ||
} | ||
@@ -155,0 +160,0 @@ export interface PropertyFilterProperty<TokenValue = any> { |
@@ -91,13 +91,21 @@ "use strict"; | ||
function defaultFilteringFunction(filteringPropertiesMap) { | ||
return function (item, _a) { | ||
var tokens = _a.tokens, operation = _a.operation; | ||
var result = operation === 'and' ? true : !tokens.length; | ||
for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) { | ||
var token = tokens_1[_i]; | ||
result = | ||
operation === 'and' | ||
? result && filterByToken(token, item, filteringPropertiesMap) | ||
: result || filterByToken(token, item, filteringPropertiesMap); | ||
return function (item, query) { | ||
var _a; | ||
function evaluate(tokenOrGroup) { | ||
if ('operation' in tokenOrGroup) { | ||
var result = tokenOrGroup.operation === 'and' ? true : !tokenOrGroup.tokens.length; | ||
for (var _i = 0, _a = tokenOrGroup.tokens; _i < _a.length; _i++) { | ||
var group = _a[_i]; | ||
result = tokenOrGroup.operation === 'and' ? result && evaluate(group) : result || evaluate(group); | ||
} | ||
return result; | ||
} | ||
else { | ||
return filterByToken(tokenOrGroup, item, filteringPropertiesMap); | ||
} | ||
} | ||
return result; | ||
return evaluate({ | ||
operation: query.operation, | ||
tokens: (_a = query.tokenGroups) !== null && _a !== void 0 ? _a : query.tokens, | ||
}); | ||
}; | ||
@@ -104,0 +112,0 @@ } |
{ | ||
"commit": "e53768646aed39d4a83c47099b97e37401808e6e" | ||
"commit": "0ec7db3ec48b45a54de3e89bb1cb7b335d763962" | ||
} |
@@ -150,5 +150,10 @@ import * as React from 'react'; | ||
} | ||
export interface PropertyFilterTokenGroup { | ||
operation: PropertyFilterOperation; | ||
tokens: readonly (PropertyFilterToken | PropertyFilterTokenGroup)[]; | ||
} | ||
export interface PropertyFilterQuery { | ||
tokens: readonly PropertyFilterToken[]; | ||
operation: PropertyFilterOperation; | ||
tokenGroups?: readonly (PropertyFilterToken | PropertyFilterTokenGroup)[]; | ||
} | ||
@@ -155,0 +160,0 @@ export interface PropertyFilterProperty<TokenValue = any> { |
@@ -88,13 +88,21 @@ import { compareDates, compareTimestamps } from '../date-utils/compare-dates.js'; | ||
function defaultFilteringFunction(filteringPropertiesMap) { | ||
return function (item, _a) { | ||
var tokens = _a.tokens, operation = _a.operation; | ||
var result = operation === 'and' ? true : !tokens.length; | ||
for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) { | ||
var token = tokens_1[_i]; | ||
result = | ||
operation === 'and' | ||
? result && filterByToken(token, item, filteringPropertiesMap) | ||
: result || filterByToken(token, item, filteringPropertiesMap); | ||
return function (item, query) { | ||
var _a; | ||
function evaluate(tokenOrGroup) { | ||
if ('operation' in tokenOrGroup) { | ||
var result = tokenOrGroup.operation === 'and' ? true : !tokenOrGroup.tokens.length; | ||
for (var _i = 0, _a = tokenOrGroup.tokens; _i < _a.length; _i++) { | ||
var group = _a[_i]; | ||
result = tokenOrGroup.operation === 'and' ? result && evaluate(group) : result || evaluate(group); | ||
} | ||
return result; | ||
} | ||
else { | ||
return filterByToken(tokenOrGroup, item, filteringPropertiesMap); | ||
} | ||
} | ||
return result; | ||
return evaluate({ | ||
operation: query.operation, | ||
tokens: (_a = query.tokenGroups) !== null && _a !== void 0 ? _a : query.tokens, | ||
}); | ||
}; | ||
@@ -101,0 +109,0 @@ } |
{ | ||
"name": "@awsui/collection-hooks", | ||
"version": "1.0.80", | ||
"version": "1.0.81", | ||
"license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/aws/awsui-documentation", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
106460
2094