Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@react-stately/selection

Package Overview
Dependencies
Maintainers
2
Versions
847
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-stately/selection - npm Package Compare versions

Comparing version 3.0.0-nightly-73414999f-240916 to 3.0.0-nightly-7aa6265a2-241112

4

dist/Selection.main.js

@@ -21,4 +21,4 @@

if (keys instanceof $21c847070f1f9569$export$52baac22726c72bf) {
this.anchorKey = anchorKey || keys.anchorKey;
this.currentKey = currentKey || keys.currentKey;
this.anchorKey = anchorKey !== null && anchorKey !== void 0 ? anchorKey : keys.anchorKey;
this.currentKey = currentKey !== null && currentKey !== void 0 ? currentKey : keys.currentKey;
} else {

@@ -25,0 +25,0 @@ this.anchorKey = anchorKey;

@@ -15,4 +15,4 @@ /*

if (keys instanceof $e40ea825a81a3709$export$52baac22726c72bf) {
this.anchorKey = anchorKey || keys.anchorKey;
this.currentKey = currentKey || keys.currentKey;
this.anchorKey = anchorKey !== null && anchorKey !== void 0 ? anchorKey : keys.anchorKey;
this.currentKey = currentKey !== null && currentKey !== void 0 ? currentKey : keys.currentKey;
} else {

@@ -19,0 +19,0 @@ this.anchorKey = anchorKey;

@@ -138,5 +138,7 @@ var $21c847070f1f9569$exports = require("./Selection.main.js");

let selectedKeys = this.state.selectedKeys;
let anchorKey = selectedKeys.anchorKey || toKey;
var _selectedKeys_anchorKey;
let anchorKey = (_selectedKeys_anchorKey = selectedKeys.anchorKey) !== null && _selectedKeys_anchorKey !== void 0 ? _selectedKeys_anchorKey : toKey;
selection = new (0, $21c847070f1f9569$exports.Selection)(selectedKeys, anchorKey, toKey);
for (let key of this.getKeyRange(anchorKey, selectedKeys.currentKey || toKey))selection.delete(key);
var _selectedKeys_currentKey;
for (let key of this.getKeyRange(anchorKey, (_selectedKeys_currentKey = selectedKeys.currentKey) !== null && _selectedKeys_currentKey !== void 0 ? _selectedKeys_currentKey : toKey))selection.delete(key);
for (let key of this.getKeyRange(toKey, anchorKey))if (this.canSelectItem(key)) selection.add(key);

@@ -156,5 +158,7 @@ }

getKeyRangeInternal(from, to) {
var _this_layoutDelegate;
if ((_this_layoutDelegate = this.layoutDelegate) === null || _this_layoutDelegate === void 0 ? void 0 : _this_layoutDelegate.getKeyRange) return this.layoutDelegate.getKeyRange(from, to);
let keys = [];
let key = from;
while(key){
while(key != null){
let item = this.collection.getItem(key);

@@ -304,2 +308,3 @@ if (item && item.type === 'item' || item.type === 'cell' && this.allowsCellSelection) keys.push(key);

this._isSelectAll = null;
this.layoutDelegate = (options === null || options === void 0 ? void 0 : options.layoutDelegate) || null;
}

@@ -306,0 +311,0 @@ }

@@ -132,5 +132,7 @@ import {Selection as $e40ea825a81a3709$export$52baac22726c72bf} from "./Selection.module.js";

let selectedKeys = this.state.selectedKeys;
let anchorKey = selectedKeys.anchorKey || toKey;
var _selectedKeys_anchorKey;
let anchorKey = (_selectedKeys_anchorKey = selectedKeys.anchorKey) !== null && _selectedKeys_anchorKey !== void 0 ? _selectedKeys_anchorKey : toKey;
selection = new (0, $e40ea825a81a3709$export$52baac22726c72bf)(selectedKeys, anchorKey, toKey);
for (let key of this.getKeyRange(anchorKey, selectedKeys.currentKey || toKey))selection.delete(key);
var _selectedKeys_currentKey;
for (let key of this.getKeyRange(anchorKey, (_selectedKeys_currentKey = selectedKeys.currentKey) !== null && _selectedKeys_currentKey !== void 0 ? _selectedKeys_currentKey : toKey))selection.delete(key);
for (let key of this.getKeyRange(toKey, anchorKey))if (this.canSelectItem(key)) selection.add(key);

@@ -150,5 +152,7 @@ }

getKeyRangeInternal(from, to) {
var _this_layoutDelegate;
if ((_this_layoutDelegate = this.layoutDelegate) === null || _this_layoutDelegate === void 0 ? void 0 : _this_layoutDelegate.getKeyRange) return this.layoutDelegate.getKeyRange(from, to);
let keys = [];
let key = from;
while(key){
while(key != null){
let item = this.collection.getItem(key);

@@ -298,2 +302,3 @@ if (item && item.type === 'item' || item.type === 'cell' && this.allowsCellSelection) keys.push(key);

this._isSelectAll = null;
this.layoutDelegate = (options === null || options === void 0 ? void 0 : options.layoutDelegate) || null;
}

@@ -300,0 +305,0 @@ }

@@ -1,2 +0,2 @@

import { DisabledBehavior, FocusStrategy, Key, LongPressEvent, PressEvent, Selection, SelectionBehavior, SelectionMode, MultipleSelection, Collection, Node } from "@react-types/shared";
import { DisabledBehavior, FocusStrategy, Key, LongPressEvent, PressEvent, Selection, SelectionBehavior, SelectionMode, MultipleSelection, Collection, LayoutDelegate, Node } from "@react-types/shared";
export interface FocusState {

@@ -109,2 +109,3 @@ /** Whether the collection is currently focused. */

allowsCellSelection?: boolean;
layoutDelegate?: LayoutDelegate;
}

@@ -115,2 +116,3 @@ /**

export class SelectionManager implements MultipleSelectionManager {
collection: Collection<Node<unknown>>;
constructor(collection: Collection<Node<unknown>>, state: MultipleSelectionState, options?: SelectionManagerOptions);

@@ -117,0 +119,0 @@ /**

{
"name": "@react-stately/selection",
"version": "3.0.0-nightly-73414999f-240916",
"version": "3.0.0-nightly-7aa6265a2-241112",
"description": "Spectrum UI components in React",

@@ -25,5 +25,5 @@ "license": "Apache-2.0",

"dependencies": {
"@react-stately/collections": "^3.0.0-nightly-73414999f-240916",
"@react-stately/utils": "^3.0.0-nightly-73414999f-240916",
"@react-types/shared": "^3.0.0-nightly-73414999f-240916",
"@react-stately/collections": "^3.0.0-nightly-7aa6265a2-241112",
"@react-stately/utils": "^3.0.0-nightly-7aa6265a2-241112",
"@react-types/shared": "^3.0.0-nightly-7aa6265a2-241112",
"@swc/helpers": "^0.5.0"

@@ -37,3 +37,3 @@ },

},
"stableVersion": "3.16.2"
"stableVersion": "3.17.0"
}

@@ -26,4 +26,4 @@ /*

if (keys instanceof Selection) {
this.anchorKey = anchorKey || keys.anchorKey;
this.currentKey = currentKey || keys.currentKey;
this.anchorKey = anchorKey ?? keys.anchorKey;
this.currentKey = currentKey ?? keys.currentKey;
} else {

@@ -30,0 +30,0 @@ this.anchorKey = anchorKey;

@@ -18,2 +18,3 @@ /*

Key,
LayoutDelegate,
LongPressEvent,

@@ -30,3 +31,4 @@ Node,

interface SelectionManagerOptions {
allowsCellSelection?: boolean
allowsCellSelection?: boolean,
layoutDelegate?: LayoutDelegate
}

@@ -38,6 +40,7 @@

export class SelectionManager implements MultipleSelectionManager {
private collection: Collection<Node<unknown>>;
collection: Collection<Node<unknown>>;
private state: MultipleSelectionState;
private allowsCellSelection: boolean;
private _isSelectAll: boolean;
private layoutDelegate: LayoutDelegate | null;

@@ -49,2 +52,3 @@ constructor(collection: Collection<Node<unknown>>, state: MultipleSelectionState, options?: SelectionManagerOptions) {

this._isSelectAll = null;
this.layoutDelegate = options?.layoutDelegate || null;
}

@@ -229,5 +233,5 @@

let selectedKeys = this.state.selectedKeys as Selection;
let anchorKey = selectedKeys.anchorKey || toKey;
let anchorKey = selectedKeys.anchorKey ?? toKey;
selection = new Selection(selectedKeys, anchorKey, toKey);
for (let key of this.getKeyRange(anchorKey, selectedKeys.currentKey || toKey)) {
for (let key of this.getKeyRange(anchorKey, selectedKeys.currentKey ?? toKey)) {
selection.delete(key);

@@ -261,5 +265,9 @@ }

private getKeyRangeInternal(from: Key, to: Key) {
if (this.layoutDelegate?.getKeyRange) {
return this.layoutDelegate.getKeyRange(from, to);
}
let keys: Key[] = [];
let key = from;
while (key) {
while (key != null) {
let item = this.collection.getItem(key);

@@ -266,0 +274,0 @@ if (item && item.type === 'item' || (item.type === 'cell' && this.allowsCellSelection)) {

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc