@cloudscape-design/components 3.0.140 → 3.0.141
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/internal/environment.js
CHANGED
package/internal/manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/property-filter/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAG7F,wBAAgB,sBAAsB,CACpC,mBAAmB,EAAE,SAAS,iBAAiB,EAAE,EACjD,aAAa,EAAE,MAAM,GACpB,IAAI,GAAG,iBAAiB,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/property-filter/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAG7F,wBAAgB,sBAAsB,CACpC,mBAAmB,EAAE,SAAS,iBAAiB,EAAE,EACjD,aAAa,EAAE,MAAM,GACpB,IAAI,GAAG,iBAAiB,CAmB1B;AAGD,wBAAgB,aAAa,CAC3B,gBAAgB,EAAE,SAAS,kBAAkB,EAAE,EAC/C,aAAa,EAAE,MAAM,GACpB,IAAI,GAAG,kBAAkB,CAc3B;AAGD,wBAAgB,mBAAmB,CACjC,gBAAgB,EAAE,SAAS,kBAAkB,EAAE,EAC/C,aAAa,EAAE,MAAM,GACpB,IAAI,GAAG,MAAM,CAUf;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,gBAAgB,EAAE,SAAS,eAAe,EAAE,GAAG,KAAK,CAYjG;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAUhD;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAErD"}
|
package/property-filter/utils.js
CHANGED
|
@@ -3,12 +3,16 @@
|
|
|
3
3
|
import { __assign } from "tslib";
|
|
4
4
|
// Finds the longest property the filtering text starts from.
|
|
5
5
|
export function matchFilteringProperty(filteringProperties, filteringText) {
|
|
6
|
-
filteringText = filteringText.toLowerCase();
|
|
7
6
|
var maxLength = 0;
|
|
8
7
|
var matchedProperty = null;
|
|
9
8
|
for (var _i = 0, filteringProperties_1 = filteringProperties; _i < filteringProperties_1.length; _i++) {
|
|
10
9
|
var property = filteringProperties_1[_i];
|
|
11
|
-
if (property.propertyLabel
|
|
10
|
+
if (property.propertyLabel === filteringText) {
|
|
11
|
+
matchedProperty = property;
|
|
12
|
+
break;
|
|
13
|
+
}
|
|
14
|
+
if (property.propertyLabel.length > maxLength &&
|
|
15
|
+
startsWith(filteringText.toLowerCase(), property.propertyLabel.toLowerCase())) {
|
|
12
16
|
maxLength = property.propertyLabel.length;
|
|
13
17
|
matchedProperty = property;
|
|
14
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/property-filter/utils.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAItC,6DAA6D;AAC7D,MAAM,UAAU,sBAAsB,CACpC,mBAAiD,EACjD,aAAqB;IAErB,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/property-filter/utils.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAItC,6DAA6D;AAC7D,MAAM,UAAU,sBAAsB,CACpC,mBAAiD,EACjD,aAAqB;IAErB,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,IAAI,eAAe,GAA6B,IAAI,CAAC;IAErD,KAAuB,UAAmB,EAAnB,2CAAmB,EAAnB,iCAAmB,EAAnB,IAAmB,EAAE;QAAvC,IAAM,QAAQ,4BAAA;QACjB,IAAI,QAAQ,CAAC,aAAa,KAAK,aAAa,EAAE;YAC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IAChD,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACtC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { ComparisonOperator, FilteringOption, FilteringProperty, Token } from './interfaces';\n\n// Finds the longest property the filtering text starts from.\nexport function matchFilteringProperty(\n filteringProperties: readonly FilteringProperty[],\n filteringText: string\n): null | FilteringProperty {\n let maxLength = 0;\n let matchedProperty: null | FilteringProperty = null;\n\n for (const property of filteringProperties) {\n if (property.propertyLabel === filteringText) {\n matchedProperty = property;\n break;\n }\n if (\n property.propertyLabel.length > maxLength &&\n startsWith(filteringText.toLowerCase(), property.propertyLabel.toLowerCase())\n ) {\n maxLength = property.propertyLabel.length;\n matchedProperty = property;\n }\n }\n\n return matchedProperty;\n}\n\n// Finds the longest operator the filtering text starts from.\nexport function matchOperator(\n allowedOperators: readonly ComparisonOperator[],\n filteringText: string\n): null | ComparisonOperator {\n filteringText = filteringText.toLowerCase();\n\n let maxLength = 0;\n let matchedOperator: null | ComparisonOperator = null;\n\n for (const operator of allowedOperators) {\n if (operator.length > maxLength && startsWith(filteringText, operator.toLowerCase())) {\n maxLength = operator.length;\n matchedOperator = operator;\n }\n }\n\n return matchedOperator;\n}\n\n// Finds if the filtering text matches any operator prefix.\nexport function matchOperatorPrefix(\n allowedOperators: readonly ComparisonOperator[],\n filteringText: string\n): null | string {\n if (filteringText.trim().length === 0) {\n return '';\n }\n for (const operator of allowedOperators) {\n if (startsWith(operator.toLowerCase(), filteringText.toLowerCase())) {\n return filteringText;\n }\n }\n return null;\n}\n\nexport function matchTokenValue(token: Token, filteringOptions: readonly FilteringOption[]): Token {\n const value = token.value.toLowerCase();\n\n const propertyOptions = filteringOptions.filter(option => option.propertyKey === token.propertyKey);\n for (const option of propertyOptions) {\n const optionText = (option.label ?? option.value ?? '').toLowerCase();\n if (optionText === value) {\n return { ...token, value: option.value };\n }\n }\n\n return token;\n}\n\nexport function trimStart(source: string): string {\n let spacesLength = 0;\n for (let i = 0; i < source.length; i++) {\n if (source[i] === ' ') {\n spacesLength++;\n } else {\n break;\n }\n }\n return source.slice(spacesLength);\n}\n\nexport function trimFirstSpace(source: string): string {\n return source[0] === ' ' ? source.slice(1) : source;\n}\n\nfunction startsWith(source: string, target: string): boolean {\n return source.indexOf(target) === 0;\n}\n"]}
|