@react-aria/table 3.8.2-nightly.3734 → 3.8.2-nightly.3741

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/dist/import.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  import {useGridRowGroup as $lJcFS$useGridRowGroup, useGrid as $lJcFS$useGrid, GridKeyboardDelegate as $lJcFS$GridKeyboardDelegate, useGridCell as $lJcFS$useGridCell, useGridRow as $lJcFS$useGridRow, useGridSelectionCheckbox as $lJcFS$useGridSelectionCheckbox} from "@react-aria/grid";
2
2
  import {announce as $lJcFS$announce} from "@react-aria/live-announcer";
3
+ import {getChildNodes as $lJcFS$getChildNodes, getFirstItem as $lJcFS$getFirstItem, getNthItem as $lJcFS$getNthItem} from "@react-stately/collections";
3
4
  import {useId as $lJcFS$useId, useDescription as $lJcFS$useDescription, useUpdateEffect as $lJcFS$useUpdateEffect, mergeProps as $lJcFS$mergeProps, isAndroid as $lJcFS$isAndroid, focusWithoutScrolling as $lJcFS$focusWithoutScrolling} from "@react-aria/utils";
4
5
  import {useMemo as $lJcFS$useMemo, useRef as $lJcFS$useRef, useCallback as $lJcFS$useCallback} from "react";
5
6
  import {useCollator as $lJcFS$useCollator, useLocale as $lJcFS$useLocale, useLocalizedStringFormatter as $lJcFS$useLocalizedStringFormatter} from "@react-aria/i18n";
@@ -31,6 +32,7 @@ function $parcel$interopDefault(a) {
31
32
  * governing permissions and limitations under the License.
32
33
  */
33
34
 
35
+
34
36
  /*
35
37
  * Copyright 2020 Adobe. All rights reserved.
36
38
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -557,6 +559,7 @@ $ae7e9c471762b4d3$exports = {
557
559
  * OF ANY KIND, either express or implied. See the License for the specific language
558
560
  * governing permissions and limitations under the License.
559
561
  */
562
+
560
563
  class $0ba3c81c7f1caedd$export$da43f8f5cb04028d extends (0, $lJcFS$GridKeyboardDelegate) {
561
564
  isCell(node) {
562
565
  return node.type === "cell" || node.type === "rowheader" || node.type === "column";
@@ -567,16 +570,12 @@ class $0ba3c81c7f1caedd$export$da43f8f5cb04028d extends (0, $lJcFS$GridKeyboardD
567
570
  // If focus was on a column, then focus the first child column if any,
568
571
  // or find the corresponding cell in the first row.
569
572
  if (startItem.type === "column") {
570
- let child = [
571
- ...startItem.childNodes
572
- ][0];
573
+ let child = (0, $lJcFS$getFirstItem)((0, $lJcFS$getChildNodes)(startItem, this.collection));
573
574
  if (child) return child.key;
574
575
  let firstKey = this.getFirstKey();
575
576
  if (firstKey == null) return;
576
577
  let firstItem = this.collection.getItem(firstKey);
577
- return [
578
- ...firstItem.childNodes
579
- ][startItem.index].key;
578
+ return (0, $lJcFS$getNthItem)((0, $lJcFS$getChildNodes)(firstItem, this.collection), startItem.index).key;
580
579
  }
581
580
  return super.getKeyBelow(key);
582
581
  }
@@ -604,7 +603,7 @@ class $0ba3c81c7f1caedd$export$da43f8f5cb04028d extends (0, $lJcFS$GridKeyboardD
604
603
  if (key != null) return key;
605
604
  // Wrap around to the first column
606
605
  let row = this.collection.headerRows[column.level];
607
- for (let item of row.childNodes){
606
+ for (let item of (0, $lJcFS$getChildNodes)(row, this.collection)){
608
607
  if (item.type === "column") return item.key;
609
608
  }
610
609
  }
@@ -615,7 +614,7 @@ class $0ba3c81c7f1caedd$export$da43f8f5cb04028d extends (0, $lJcFS$GridKeyboardD
615
614
  // Wrap around to the last column
616
615
  let row = this.collection.headerRows[column.level];
617
616
  let childNodes = [
618
- ...row.childNodes
617
+ ...(0, $lJcFS$getChildNodes)(row, this.collection)
619
618
  ];
620
619
  for(let i = childNodes.length - 1; i >= 0; i--){
621
620
  let item = childNodes[i];
@@ -648,7 +647,7 @@ class $0ba3c81c7f1caedd$export$da43f8f5cb04028d extends (0, $lJcFS$GridKeyboardD
648
647
  while(key != null){
649
648
  let item = collection.getItem(key);
650
649
  // Check each of the row header cells in this row for a match
651
- for (let cell of item.childNodes){
650
+ for (let cell of (0, $lJcFS$getChildNodes)(item, this.collection)){
652
651
  let column = collection.columns[cell.index];
653
652
  if (collection.rowHeaderColumnKeys.has(column.key) && cell.textValue) {
654
653
  let substring = cell.textValue.slice(0, search.length);
@@ -682,9 +681,10 @@ function $6e31608fbba75bab$export$25bceaac3c7e4dc7(props, state, ref) {
682
681
  sensitivity: "base"
683
682
  });
684
683
  let { direction: direction } = (0, $lJcFS$useLocale)();
684
+ let disabledBehavior = state.selectionManager.disabledBehavior;
685
685
  let delegate = (0, $lJcFS$useMemo)(()=>keyboardDelegate || new (0, $0ba3c81c7f1caedd$export$da43f8f5cb04028d)({
686
686
  collection: state.collection,
687
- disabledKeys: state.disabledKeys,
687
+ disabledKeys: disabledBehavior === "selection" ? new Set() : state.disabledKeys,
688
688
  ref: ref,
689
689
  direction: direction,
690
690
  collator: collator,
@@ -693,6 +693,7 @@ function $6e31608fbba75bab$export$25bceaac3c7e4dc7(props, state, ref) {
693
693
  keyboardDelegate,
694
694
  state.collection,
695
695
  state.disabledKeys,
696
+ disabledBehavior,
696
697
  ref,
697
698
  direction,
698
699
  collator,
@@ -713,7 +714,7 @@ function $6e31608fbba75bab$export$25bceaac3c7e4dc7(props, state, ref) {
713
714
  let rowHeaderColumnKeys = state.collection.rowHeaderColumnKeys;
714
715
  if (rowHeaderColumnKeys) {
715
716
  let text = [];
716
- for (let cell of added.childNodes){
717
+ for (let cell of (0, $lJcFS$getChildNodes)(added, state.collection)){
717
718
  let column = state.collection.columns[cell.index];
718
719
  if (rowHeaderColumnKeys.has(column.key) && cell.textValue) text.push(cell.textValue);
719
720
  if (text.length === rowHeaderColumnKeys.size) break;
@@ -839,13 +840,13 @@ function $f329116d8ad0aba0$export$9514819a8c81e960(props, state, ref) {
839
840
 
840
841
  function $b2db214c022798eb$export$7f2f6ae19e707aa5(props, state, ref) {
841
842
  let { node: node } = props;
842
- let { rowProps: rowProps , isPressed: isPressed } = (0, $lJcFS$useGridRow)(props, state, ref);
843
+ let { rowProps: rowProps , ...states } = (0, $lJcFS$useGridRow)(props, state, ref);
843
844
  return {
844
845
  rowProps: {
845
846
  ...rowProps,
846
847
  "aria-labelledby": (0, $2140fb2337097f2d$export$85069b70317f543)(state, node.key)
847
848
  },
848
- isPressed: isPressed
849
+ ...states
849
850
  };
850
851
  }
851
852
 
package/dist/main.js CHANGED
@@ -1,5 +1,6 @@
1
1
  var $kJQf8$reactariagrid = require("@react-aria/grid");
2
2
  var $kJQf8$reactarialiveannouncer = require("@react-aria/live-announcer");
3
+ var $kJQf8$reactstatelycollections = require("@react-stately/collections");
3
4
  var $kJQf8$reactariautils = require("@react-aria/utils");
4
5
  var $kJQf8$react = require("react");
5
6
  var $kJQf8$reactariai18n = require("@react-aria/i18n");
@@ -44,6 +45,7 @@ $parcel$export(module.exports, "useTableColumnResize", () => $16d645f9e2153641$e
44
45
  * governing permissions and limitations under the License.
45
46
  */
46
47
 
48
+
47
49
  /*
48
50
  * Copyright 2020 Adobe. All rights reserved.
49
51
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -570,6 +572,7 @@ $41fef89bf1034745$exports = {
570
572
  * OF ANY KIND, either express or implied. See the License for the specific language
571
573
  * governing permissions and limitations under the License.
572
574
  */
575
+
573
576
  class $a911ff492b884835$export$da43f8f5cb04028d extends (0, $kJQf8$reactariagrid.GridKeyboardDelegate) {
574
577
  isCell(node) {
575
578
  return node.type === "cell" || node.type === "rowheader" || node.type === "column";
@@ -580,16 +583,12 @@ class $a911ff492b884835$export$da43f8f5cb04028d extends (0, $kJQf8$reactariagrid
580
583
  // If focus was on a column, then focus the first child column if any,
581
584
  // or find the corresponding cell in the first row.
582
585
  if (startItem.type === "column") {
583
- let child = [
584
- ...startItem.childNodes
585
- ][0];
586
+ let child = (0, $kJQf8$reactstatelycollections.getFirstItem)((0, $kJQf8$reactstatelycollections.getChildNodes)(startItem, this.collection));
586
587
  if (child) return child.key;
587
588
  let firstKey = this.getFirstKey();
588
589
  if (firstKey == null) return;
589
590
  let firstItem = this.collection.getItem(firstKey);
590
- return [
591
- ...firstItem.childNodes
592
- ][startItem.index].key;
591
+ return (0, $kJQf8$reactstatelycollections.getNthItem)((0, $kJQf8$reactstatelycollections.getChildNodes)(firstItem, this.collection), startItem.index).key;
593
592
  }
594
593
  return super.getKeyBelow(key);
595
594
  }
@@ -617,7 +616,7 @@ class $a911ff492b884835$export$da43f8f5cb04028d extends (0, $kJQf8$reactariagrid
617
616
  if (key != null) return key;
618
617
  // Wrap around to the first column
619
618
  let row = this.collection.headerRows[column.level];
620
- for (let item of row.childNodes){
619
+ for (let item of (0, $kJQf8$reactstatelycollections.getChildNodes)(row, this.collection)){
621
620
  if (item.type === "column") return item.key;
622
621
  }
623
622
  }
@@ -628,7 +627,7 @@ class $a911ff492b884835$export$da43f8f5cb04028d extends (0, $kJQf8$reactariagrid
628
627
  // Wrap around to the last column
629
628
  let row = this.collection.headerRows[column.level];
630
629
  let childNodes = [
631
- ...row.childNodes
630
+ ...(0, $kJQf8$reactstatelycollections.getChildNodes)(row, this.collection)
632
631
  ];
633
632
  for(let i = childNodes.length - 1; i >= 0; i--){
634
633
  let item = childNodes[i];
@@ -661,7 +660,7 @@ class $a911ff492b884835$export$da43f8f5cb04028d extends (0, $kJQf8$reactariagrid
661
660
  while(key != null){
662
661
  let item = collection.getItem(key);
663
662
  // Check each of the row header cells in this row for a match
664
- for (let cell of item.childNodes){
663
+ for (let cell of (0, $kJQf8$reactstatelycollections.getChildNodes)(item, this.collection)){
665
664
  let column = collection.columns[cell.index];
666
665
  if (collection.rowHeaderColumnKeys.has(column.key) && cell.textValue) {
667
666
  let substring = cell.textValue.slice(0, search.length);
@@ -695,9 +694,10 @@ function $25d14c0f8fad722e$export$25bceaac3c7e4dc7(props, state, ref) {
695
694
  sensitivity: "base"
696
695
  });
697
696
  let { direction: direction } = (0, $kJQf8$reactariai18n.useLocale)();
697
+ let disabledBehavior = state.selectionManager.disabledBehavior;
698
698
  let delegate = (0, $kJQf8$react.useMemo)(()=>keyboardDelegate || new (0, $a911ff492b884835$export$da43f8f5cb04028d)({
699
699
  collection: state.collection,
700
- disabledKeys: state.disabledKeys,
700
+ disabledKeys: disabledBehavior === "selection" ? new Set() : state.disabledKeys,
701
701
  ref: ref,
702
702
  direction: direction,
703
703
  collator: collator,
@@ -706,6 +706,7 @@ function $25d14c0f8fad722e$export$25bceaac3c7e4dc7(props, state, ref) {
706
706
  keyboardDelegate,
707
707
  state.collection,
708
708
  state.disabledKeys,
709
+ disabledBehavior,
709
710
  ref,
710
711
  direction,
711
712
  collator,
@@ -726,7 +727,7 @@ function $25d14c0f8fad722e$export$25bceaac3c7e4dc7(props, state, ref) {
726
727
  let rowHeaderColumnKeys = state.collection.rowHeaderColumnKeys;
727
728
  if (rowHeaderColumnKeys) {
728
729
  let text = [];
729
- for (let cell of added.childNodes){
730
+ for (let cell of (0, $kJQf8$reactstatelycollections.getChildNodes)(added, state.collection)){
730
731
  let column = state.collection.columns[cell.index];
731
732
  if (rowHeaderColumnKeys.has(column.key) && cell.textValue) text.push(cell.textValue);
732
733
  if (text.length === rowHeaderColumnKeys.size) break;
@@ -852,13 +853,13 @@ function $7669c34a63ef0113$export$9514819a8c81e960(props, state, ref) {
852
853
 
853
854
  function $10b2115217af7c93$export$7f2f6ae19e707aa5(props, state, ref) {
854
855
  let { node: node } = props;
855
- let { rowProps: rowProps , isPressed: isPressed } = (0, $kJQf8$reactariagrid.useGridRow)(props, state, ref);
856
+ let { rowProps: rowProps , ...states } = (0, $kJQf8$reactariagrid.useGridRow)(props, state, ref);
856
857
  return {
857
858
  rowProps: {
858
859
  ...rowProps,
859
860
  "aria-labelledby": (0, $6acf696f746f932c$export$85069b70317f543)(state, node.key)
860
861
  },
861
- isPressed: isPressed
862
+ ...states
862
863
  };
863
864
  }
864
865