@react-aria/selection
Advanced tools
Comparing version 3.0.0-nightly.3114 to 3.0.0-nightly-07431f4b1-241030
@@ -27,19 +27,17 @@ var $2ac4508142683dcb$exports = require("./DOMLayoutDelegate.main.js"); | ||
} | ||
getNextKey(key) { | ||
key = this.collection.getKeyAfter(key); | ||
findNextNonDisabled(key, getNext) { | ||
while(key != null){ | ||
let item = this.collection.getItem(key); | ||
if (item.type === 'item' && !this.isDisabled(item)) return key; | ||
key = this.collection.getKeyAfter(key); | ||
if ((item === null || item === void 0 ? void 0 : item.type) === 'item' && !this.isDisabled(item)) return key; | ||
key = getNext(key); | ||
} | ||
return null; | ||
} | ||
getNextKey(key) { | ||
key = this.collection.getKeyAfter(key); | ||
return this.findNextNonDisabled(key, (key)=>this.collection.getKeyAfter(key)); | ||
} | ||
getPreviousKey(key) { | ||
key = this.collection.getKeyBefore(key); | ||
while(key != null){ | ||
let item = this.collection.getItem(key); | ||
if (item.type === 'item' && !this.isDisabled(item)) return key; | ||
key = this.collection.getKeyBefore(key); | ||
} | ||
return null; | ||
return this.findNextNonDisabled(key, (key)=>this.collection.getKeyBefore(key)); | ||
} | ||
@@ -75,2 +73,9 @@ findKey(key, nextKey, shouldSkip) { | ||
getKeyRightOf(key) { | ||
// This is a temporary solution for CardView until we refactor useSelectableCollection. | ||
// https://github.com/orgs/adobe/projects/19/views/32?pane=issue&itemId=77825042 | ||
let layoutDelegateMethod = this.direction === 'ltr' ? 'getKeyRightOf' : 'getKeyLeftOf'; | ||
if (this.layoutDelegate[layoutDelegateMethod]) { | ||
key = this.layoutDelegate[layoutDelegateMethod](key); | ||
return this.findNextNonDisabled(key, (key)=>this.layoutDelegate[layoutDelegateMethod](key)); | ||
} | ||
if (this.layout === 'grid') { | ||
@@ -83,2 +88,7 @@ if (this.orientation === 'vertical') return this.getNextColumn(key, this.direction === 'rtl'); | ||
getKeyLeftOf(key) { | ||
let layoutDelegateMethod = this.direction === 'ltr' ? 'getKeyLeftOf' : 'getKeyRightOf'; | ||
if (this.layoutDelegate[layoutDelegateMethod]) { | ||
key = this.layoutDelegate[layoutDelegateMethod](key); | ||
return this.findNextNonDisabled(key, (key)=>this.layoutDelegate[layoutDelegateMethod](key)); | ||
} | ||
if (this.layout === 'grid') { | ||
@@ -92,17 +102,7 @@ if (this.orientation === 'vertical') return this.getNextColumn(key, this.direction === 'ltr'); | ||
let key = this.collection.getFirstKey(); | ||
while(key != null){ | ||
let item = this.collection.getItem(key); | ||
if ((item === null || item === void 0 ? void 0 : item.type) === 'item' && !this.isDisabled(item)) return key; | ||
key = this.collection.getKeyAfter(key); | ||
} | ||
return null; | ||
return this.findNextNonDisabled(key, (key)=>this.collection.getKeyAfter(key)); | ||
} | ||
getLastKey() { | ||
let key = this.collection.getLastKey(); | ||
while(key != null){ | ||
let item = this.collection.getItem(key); | ||
if (item.type === 'item' && !this.isDisabled(item)) return key; | ||
key = this.collection.getKeyBefore(key); | ||
} | ||
return null; | ||
return this.findNextNonDisabled(key, (key)=>this.collection.getKeyBefore(key)); | ||
} | ||
@@ -157,3 +157,3 @@ getKeyPageAbove(key) { | ||
if (item.textValue && this.collator.compare(substring, search) === 0) return key; | ||
key = this.getKeyBelow(key); | ||
key = this.getNextKey(key); | ||
} | ||
@@ -160,0 +160,0 @@ return null; |
@@ -21,19 +21,17 @@ import {DOMLayoutDelegate as $657e4dc4a6e88df0$export$8f5ed9ff9f511381} from "./DOMLayoutDelegate.module.js"; | ||
} | ||
getNextKey(key) { | ||
key = this.collection.getKeyAfter(key); | ||
findNextNonDisabled(key, getNext) { | ||
while(key != null){ | ||
let item = this.collection.getItem(key); | ||
if (item.type === 'item' && !this.isDisabled(item)) return key; | ||
key = this.collection.getKeyAfter(key); | ||
if ((item === null || item === void 0 ? void 0 : item.type) === 'item' && !this.isDisabled(item)) return key; | ||
key = getNext(key); | ||
} | ||
return null; | ||
} | ||
getNextKey(key) { | ||
key = this.collection.getKeyAfter(key); | ||
return this.findNextNonDisabled(key, (key)=>this.collection.getKeyAfter(key)); | ||
} | ||
getPreviousKey(key) { | ||
key = this.collection.getKeyBefore(key); | ||
while(key != null){ | ||
let item = this.collection.getItem(key); | ||
if (item.type === 'item' && !this.isDisabled(item)) return key; | ||
key = this.collection.getKeyBefore(key); | ||
} | ||
return null; | ||
return this.findNextNonDisabled(key, (key)=>this.collection.getKeyBefore(key)); | ||
} | ||
@@ -69,2 +67,9 @@ findKey(key, nextKey, shouldSkip) { | ||
getKeyRightOf(key) { | ||
// This is a temporary solution for CardView until we refactor useSelectableCollection. | ||
// https://github.com/orgs/adobe/projects/19/views/32?pane=issue&itemId=77825042 | ||
let layoutDelegateMethod = this.direction === 'ltr' ? 'getKeyRightOf' : 'getKeyLeftOf'; | ||
if (this.layoutDelegate[layoutDelegateMethod]) { | ||
key = this.layoutDelegate[layoutDelegateMethod](key); | ||
return this.findNextNonDisabled(key, (key)=>this.layoutDelegate[layoutDelegateMethod](key)); | ||
} | ||
if (this.layout === 'grid') { | ||
@@ -77,2 +82,7 @@ if (this.orientation === 'vertical') return this.getNextColumn(key, this.direction === 'rtl'); | ||
getKeyLeftOf(key) { | ||
let layoutDelegateMethod = this.direction === 'ltr' ? 'getKeyLeftOf' : 'getKeyRightOf'; | ||
if (this.layoutDelegate[layoutDelegateMethod]) { | ||
key = this.layoutDelegate[layoutDelegateMethod](key); | ||
return this.findNextNonDisabled(key, (key)=>this.layoutDelegate[layoutDelegateMethod](key)); | ||
} | ||
if (this.layout === 'grid') { | ||
@@ -86,17 +96,7 @@ if (this.orientation === 'vertical') return this.getNextColumn(key, this.direction === 'ltr'); | ||
let key = this.collection.getFirstKey(); | ||
while(key != null){ | ||
let item = this.collection.getItem(key); | ||
if ((item === null || item === void 0 ? void 0 : item.type) === 'item' && !this.isDisabled(item)) return key; | ||
key = this.collection.getKeyAfter(key); | ||
} | ||
return null; | ||
return this.findNextNonDisabled(key, (key)=>this.collection.getKeyAfter(key)); | ||
} | ||
getLastKey() { | ||
let key = this.collection.getLastKey(); | ||
while(key != null){ | ||
let item = this.collection.getItem(key); | ||
if (item.type === 'item' && !this.isDisabled(item)) return key; | ||
key = this.collection.getKeyBefore(key); | ||
} | ||
return null; | ||
return this.findNextNonDisabled(key, (key)=>this.collection.getKeyBefore(key)); | ||
} | ||
@@ -151,3 +151,3 @@ getKeyPageAbove(key) { | ||
if (item.textValue && this.collator.compare(substring, search) === 0) return key; | ||
key = this.getKeyBelow(key); | ||
key = this.getNextKey(key); | ||
} | ||
@@ -154,0 +154,0 @@ return null; |
{ | ||
"name": "@react-aria/selection", | ||
"version": "3.0.0-nightly.3114+68403fe55", | ||
"version": "3.0.0-nightly-07431f4b1-241030", | ||
"description": "Spectrum UI components in React", | ||
@@ -25,8 +25,8 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@react-aria/focus": "3.0.0-nightly.3114+68403fe55", | ||
"@react-aria/i18n": "3.0.0-nightly.3114+68403fe55", | ||
"@react-aria/interactions": "3.0.0-nightly.3114+68403fe55", | ||
"@react-aria/utils": "3.0.0-nightly.3114+68403fe55", | ||
"@react-stately/selection": "3.0.0-nightly.3114+68403fe55", | ||
"@react-types/shared": "3.0.0-nightly.3114+68403fe55", | ||
"@react-aria/focus": "^3.0.0-nightly-07431f4b1-241030", | ||
"@react-aria/i18n": "^3.0.0-nightly-07431f4b1-241030", | ||
"@react-aria/interactions": "^3.0.0-nightly-07431f4b1-241030", | ||
"@react-aria/utils": "^3.0.0-nightly-07431f4b1-241030", | ||
"@react-stately/selection": "^3.0.0-nightly-07431f4b1-241030", | ||
"@react-types/shared": "^3.0.0-nightly-07431f4b1-241030", | ||
"@swc/helpers": "^0.5.0" | ||
@@ -41,3 +41,3 @@ }, | ||
}, | ||
"gitHead": "68403fe55489dce3de1b3094c957d598ad719861" | ||
} | ||
"stableVersion": "3.20.1" | ||
} |
@@ -77,11 +77,10 @@ /* | ||
getNextKey(key: Key) { | ||
key = this.collection.getKeyAfter(key); | ||
private findNextNonDisabled(key: Key, getNext: (key: Key) => Key | null): Key | null { | ||
while (key != null) { | ||
let item = this.collection.getItem(key); | ||
if (item.type === 'item' && !this.isDisabled(item)) { | ||
if (item?.type === 'item' && !this.isDisabled(item)) { | ||
return key; | ||
} | ||
key = this.collection.getKeyAfter(key); | ||
key = getNext(key); | ||
} | ||
@@ -92,14 +91,10 @@ | ||
getNextKey(key: Key) { | ||
key = this.collection.getKeyAfter(key); | ||
return this.findNextNonDisabled(key, key => this.collection.getKeyAfter(key)); | ||
} | ||
getPreviousKey(key: Key) { | ||
key = this.collection.getKeyBefore(key); | ||
while (key != null) { | ||
let item = this.collection.getItem(key); | ||
if (item.type === 'item' && !this.isDisabled(item)) { | ||
return key; | ||
} | ||
key = this.collection.getKeyBefore(key); | ||
} | ||
return null; | ||
return this.findNextNonDisabled(key, key => this.collection.getKeyBefore(key)); | ||
} | ||
@@ -156,2 +151,10 @@ | ||
getKeyRightOf(key: Key) { | ||
// This is a temporary solution for CardView until we refactor useSelectableCollection. | ||
// https://github.com/orgs/adobe/projects/19/views/32?pane=issue&itemId=77825042 | ||
let layoutDelegateMethod = this.direction === 'ltr' ? 'getKeyRightOf' : 'getKeyLeftOf'; | ||
if (this.layoutDelegate[layoutDelegateMethod]) { | ||
key = this.layoutDelegate[layoutDelegateMethod](key); | ||
return this.findNextNonDisabled(key, key => this.layoutDelegate[layoutDelegateMethod](key)); | ||
} | ||
if (this.layout === 'grid') { | ||
@@ -171,2 +174,8 @@ if (this.orientation === 'vertical') { | ||
getKeyLeftOf(key: Key) { | ||
let layoutDelegateMethod = this.direction === 'ltr' ? 'getKeyLeftOf' : 'getKeyRightOf'; | ||
if (this.layoutDelegate[layoutDelegateMethod]) { | ||
key = this.layoutDelegate[layoutDelegateMethod](key); | ||
return this.findNextNonDisabled(key, key => this.layoutDelegate[layoutDelegateMethod](key)); | ||
} | ||
if (this.layout === 'grid') { | ||
@@ -187,12 +196,3 @@ if (this.orientation === 'vertical') { | ||
let key = this.collection.getFirstKey(); | ||
while (key != null) { | ||
let item = this.collection.getItem(key); | ||
if (item?.type === 'item' && !this.isDisabled(item)) { | ||
return key; | ||
} | ||
key = this.collection.getKeyAfter(key); | ||
} | ||
return null; | ||
return this.findNextNonDisabled(key, key => this.collection.getKeyAfter(key)); | ||
} | ||
@@ -202,12 +202,3 @@ | ||
let key = this.collection.getLastKey(); | ||
while (key != null) { | ||
let item = this.collection.getItem(key); | ||
if (item.type === 'item' && !this.isDisabled(item)) { | ||
return key; | ||
} | ||
key = this.collection.getKeyBefore(key); | ||
} | ||
return null; | ||
return this.findNextNonDisabled(key, key => this.collection.getKeyBefore(key)); | ||
} | ||
@@ -289,3 +280,3 @@ | ||
key = this.getKeyBelow(key); | ||
key = this.getNextKey(key); | ||
} | ||
@@ -292,0 +283,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
0
373586
52
4286
+ Added@formatjs/ecma402-abstract@2.2.1(transitive)
+ Added@formatjs/fast-memoize@2.2.2(transitive)
+ Added@formatjs/icu-messageformat-parser@2.9.1(transitive)
+ Added@formatjs/icu-skeleton-parser@1.8.5(transitive)
+ Added@formatjs/intl-localematcher@0.5.6(transitive)
+ Added@internationalized/date@3.5.6(transitive)
+ Added@internationalized/message@3.1.5(transitive)
+ Added@internationalized/number@3.5.4(transitive)
+ Added@internationalized/string@3.2.4(transitive)
+ Added@react-aria/focus@3.18.4(transitive)
+ Added@react-aria/i18n@3.12.3(transitive)
+ Added@react-aria/interactions@3.22.4(transitive)
+ Added@react-aria/ssr@3.9.6(transitive)
+ Added@react-aria/utils@3.25.3(transitive)
+ Added@react-stately/collections@3.11.0(transitive)
+ Added@react-stately/selection@3.17.0(transitive)
+ Added@react-stately/utils@3.10.4(transitive)
+ Added@react-types/shared@3.25.0(transitive)
+ Addedclsx@2.1.1(transitive)
+ Addedintl-messageformat@10.7.3(transitive)
Updated@react-aria/interactions@^3.0.0-nightly-07431f4b1-241030
Updated@react-stately/selection@^3.0.0-nightly-07431f4b1-241030