@react-stately/table 3.9.2-nightly.3964 → 3.9.2-nightly.3971

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,6 +1,5 @@
1
1
  import {Section as $6555104ff085bef4$re_export$Section, useCollection as $1BfjW$useCollection, getFirstItem as $1BfjW$getFirstItem, getLastItem as $1BfjW$getLastItem} from "@react-stately/collections";
2
2
  import $1BfjW$react, {useState as $1BfjW$useState, useMemo as $1BfjW$useMemo, useCallback as $1BfjW$useCallback} from "react";
3
- import $1BfjW$swchelperssrc_define_propertymjs from "@swc/helpers/src/_define_property.mjs";
4
3
  import {useGridState as $1BfjW$useGridState, GridCollection as $1BfjW$GridCollection} from "@react-stately/grid";
5
4
 
6
5
  /*
@@ -34,8 +33,7 @@ import {useGridState as $1BfjW$useGridState, GridCollection as $1BfjW$GridCollec
34
33
  * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
35
34
  * OF ANY KIND, either express or implied. See the License for the specific language
36
35
  * governing permissions and limitations under the License.
37
- */
38
- /*
36
+ */ /*
39
37
  * Copyright 2022 Adobe. All rights reserved.
40
38
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
41
39
  * you may not use this file except in compliance with the License. You may obtain a copy
@@ -337,9 +335,9 @@ class $a9e7ae544a4e41dd$export$7ff77a162970b30e {
337
335
  return this.columnWidths;
338
336
  }
339
337
  constructor(options){
340
- (0, $1BfjW$swchelperssrc_define_propertymjs)(this, "columnWidths", new Map());
341
- (0, $1BfjW$swchelperssrc_define_propertymjs)(this, "columnMinWidths", new Map());
342
- (0, $1BfjW$swchelperssrc_define_propertymjs)(this, "columnMaxWidths", new Map());
338
+ this.columnWidths = new Map();
339
+ this.columnMinWidths = new Map();
340
+ this.columnMaxWidths = new Map();
343
341
  var _options_getDefaultWidth;
344
342
  this.getDefaultWidth = (_options_getDefaultWidth = options === null || options === void 0 ? void 0 : options.getDefaultWidth) !== null && _options_getDefaultWidth !== void 0 ? _options_getDefaultWidth : ()=>"1fr";
345
343
  var _options_getDefaultMinWidth;
@@ -454,7 +452,6 @@ function $292bc4e09cd0eb62$export$cb895dcf85db1319(props, state) {
454
452
  * governing permissions and limitations under the License.
455
453
  */
456
454
 
457
-
458
455
  const $788781baa30117fa$var$ROW_HEADER_COLUMN_KEY = "row-header-column-" + Math.random().toString(36).slice(2);
459
456
  let $788781baa30117fa$var$ROW_HEADER_COLUMN_KEY_DRAG = "row-header-column-" + Math.random().toString(36).slice(2);
460
457
  while($788781baa30117fa$var$ROW_HEADER_COLUMN_KEY === $788781baa30117fa$var$ROW_HEADER_COLUMN_KEY_DRAG)$788781baa30117fa$var$ROW_HEADER_COLUMN_KEY_DRAG = "row-header-column-" + Math.random().toString(36).slice(2);
@@ -476,12 +473,12 @@ function $788781baa30117fa$export$7c127db850d4e81e(keyMap, columnNodes) {
476
473
  // in the previous column so it's level with the current column.
477
474
  if (seen.has(parent)) {
478
475
  parent.colspan++;
479
- let { column: column1 , index: index } = seen.get(parent);
476
+ let { column: column , index: index } = seen.get(parent);
480
477
  if (index > col.length) break;
481
- for(let i = index; i < col.length; i++)column1.splice(i, 0, null);
478
+ for(let i = index; i < col.length; i++)column.splice(i, 0, null);
482
479
  // Adjust shifted indices
483
- for(let i1 = col.length; i1 < column1.length; i1++)// eslint-disable-next-line max-depth
484
- if (column1[i1] && seen.has(column1[i1])) seen.get(column1[i1]).index = i1;
480
+ for(let i = col.length; i < column.length; i++)// eslint-disable-next-line max-depth
481
+ if (column[i] && seen.has(column[i])) seen.get(column[i]).index = i;
485
482
  } else {
486
483
  parent.colspan = 1;
487
484
  col.push(parent);
@@ -499,12 +496,12 @@ function $788781baa30117fa$export$7c127db850d4e81e(keyMap, columnNodes) {
499
496
  let headerRows = Array(maxLength).fill(0).map(()=>[]);
500
497
  // Convert columns into rows.
501
498
  let colIndex = 0;
502
- for (let column2 of columns){
503
- let i2 = maxLength - 1;
504
- for (let item of column2){
499
+ for (let column of columns){
500
+ let i = maxLength - 1;
501
+ for (let item of column){
505
502
  if (item) {
506
503
  // Fill the space up until the current column with a placeholder
507
- let row = headerRows[i2];
504
+ let row = headerRows[i];
508
505
  let rowLength = row.reduce((p, c)=>p + c.colspan, 0);
509
506
  if (rowLength < colIndex) {
510
507
  let placeholder = {
@@ -514,7 +511,7 @@ function $788781baa30117fa$export$7c127db850d4e81e(keyMap, columnNodes) {
514
511
  index: rowLength,
515
512
  value: null,
516
513
  rendered: null,
517
- level: i2,
514
+ level: i,
518
515
  hasChildNodes: false,
519
516
  childNodes: [],
520
517
  textValue: null
@@ -530,35 +527,35 @@ function $788781baa30117fa$export$7c127db850d4e81e(keyMap, columnNodes) {
530
527
  row[row.length - 1].nextKey = item.key;
531
528
  item.prevKey = row[row.length - 1].key;
532
529
  }
533
- item.level = i2;
530
+ item.level = i;
534
531
  item.colIndex = colIndex;
535
532
  row.push(item);
536
533
  }
537
- i2--;
534
+ i--;
538
535
  }
539
536
  colIndex++;
540
537
  }
541
538
  // Add placeholders at the end of each row that is shorter than the maximum
542
- let i3 = 0;
543
- for (let row1 of headerRows){
544
- let rowLength1 = row1.reduce((p, c)=>p + c.colspan, 0);
545
- if (rowLength1 < columnNodes.length) {
546
- let placeholder1 = {
539
+ let i = 0;
540
+ for (let row of headerRows){
541
+ let rowLength = row.reduce((p, c)=>p + c.colspan, 0);
542
+ if (rowLength < columnNodes.length) {
543
+ let placeholder = {
547
544
  type: "placeholder",
548
- key: "placeholder-" + row1[row1.length - 1].key,
549
- colspan: columnNodes.length - rowLength1,
550
- index: rowLength1,
545
+ key: "placeholder-" + row[row.length - 1].key,
546
+ colspan: columnNodes.length - rowLength,
547
+ index: rowLength,
551
548
  value: null,
552
549
  rendered: null,
553
- level: i3,
550
+ level: i,
554
551
  hasChildNodes: false,
555
552
  childNodes: [],
556
553
  textValue: null,
557
- prevKey: row1[row1.length - 1].key
554
+ prevKey: row[row.length - 1].key
558
555
  };
559
- row1.push(placeholder1);
556
+ row.push(placeholder);
560
557
  }
561
- i3++;
558
+ i++;
562
559
  }
563
560
  return headerRows.map((childNodes, index)=>{
564
561
  let row = {
@@ -575,9 +572,8 @@ function $788781baa30117fa$export$7c127db850d4e81e(keyMap, columnNodes) {
575
572
  return row;
576
573
  });
577
574
  }
578
- let $788781baa30117fa$var$_Symbol_iterator = Symbol.iterator;
579
575
  class $788781baa30117fa$export$596e1b2e2cf93690 extends (0, $1BfjW$GridCollection) {
580
- *[$788781baa30117fa$var$_Symbol_iterator]() {
576
+ *[Symbol.iterator]() {
581
577
  yield* this.body.childNodes;
582
578
  }
583
579
  get size() {
@@ -653,7 +649,7 @@ class $788781baa30117fa$export$596e1b2e2cf93690 extends (0, $1BfjW$GridCollectio
653
649
  }
654
650
  // Add cell for drag buttons if needed.
655
651
  if (opts === null || opts === void 0 ? void 0 : opts.showDragButtons) {
656
- let rowHeaderColumn1 = {
652
+ let rowHeaderColumn = {
657
653
  type: "column",
658
654
  key: $788781baa30117fa$var$ROW_HEADER_COLUMN_KEY_DRAG,
659
655
  value: null,
@@ -667,7 +663,7 @@ class $788781baa30117fa$export$596e1b2e2cf93690 extends (0, $1BfjW$GridCollectio
667
663
  isDragButtonCell: true
668
664
  }
669
665
  };
670
- columns.unshift(rowHeaderColumn1);
666
+ columns.unshift(rowHeaderColumn);
671
667
  }
672
668
  let rows = [];
673
669
  let columnKeyMap = new Map();
@@ -700,7 +696,7 @@ class $788781baa30117fa$export$596e1b2e2cf93690 extends (0, $1BfjW$GridCollectio
700
696
  return node;
701
697
  }
702
698
  });
703
- (0, $1BfjW$swchelperssrc_define_propertymjs)(this, "_size", 0);
699
+ this._size = 0;
704
700
  this.columns = columns;
705
701
  this.rowHeaderColumnKeys = rowHeaderColumnKeys;
706
702
  this.body = body;
@@ -791,14 +787,14 @@ $312ae3b56a94a86e$var$TableHeader.getCollectionNode = function* getCollectionNod
791
787
  renderer: children
792
788
  };
793
789
  } else {
794
- let columns1 = [];
790
+ let columns = [];
795
791
  (0, $1BfjW$react).Children.forEach(children, (column)=>{
796
- columns1.push({
792
+ columns.push({
797
793
  type: "column",
798
794
  element: column
799
795
  });
800
796
  });
801
- yield* columns1;
797
+ yield* columns;
802
798
  }
803
799
  };
804
800
  /**
@@ -837,14 +833,14 @@ $4ae5314bf50db1a3$var$TableBody.getCollectionNode = function* getCollectionNode(
837
833
  renderer: children
838
834
  };
839
835
  } else {
840
- let items1 = [];
836
+ let items = [];
841
837
  (0, $1BfjW$react).Children.forEach(children, (item)=>{
842
- items1.push({
838
+ items.push({
843
839
  type: "item",
844
840
  element: item
845
841
  });
846
842
  });
847
- yield* items1;
843
+ yield* items;
848
844
  }
849
845
  }
850
846
  };
@@ -886,14 +882,14 @@ $1cd244557c2f97d5$var$Column.getCollectionNode = function* getCollectionNode(pro
886
882
  value: child
887
883
  };
888
884
  else if (title) {
889
- let childColumns1 = [];
885
+ let childColumns = [];
890
886
  (0, $1BfjW$react).Children.forEach(children, (child)=>{
891
- childColumns1.push({
887
+ childColumns.push({
892
888
  type: "column",
893
889
  element: child
894
890
  });
895
891
  });
896
- yield* childColumns1;
892
+ yield* childColumns;
897
893
  }
898
894
  },
899
895
  shouldInvalidate (newContext) {
package/dist/main.js CHANGED
@@ -1,6 +1,5 @@
1
1
  var $56JBj$reactstatelycollections = require("@react-stately/collections");
2
2
  var $56JBj$react = require("react");
3
- var $56JBj$swchelperslib_define_propertyjs = require("@swc/helpers/lib/_define_property.js");
4
3
  var $56JBj$reactstatelygrid = require("@react-stately/grid");
5
4
 
6
5
  function $parcel$export(e, n, v, s) {
@@ -52,8 +51,7 @@ $parcel$export(module.exports, "TableColumnLayout", () => $2240a72410c17d51$expo
52
51
  * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
53
52
  * OF ANY KIND, either express or implied. See the License for the specific language
54
53
  * governing permissions and limitations under the License.
55
- */
56
- /*
54
+ */ /*
57
55
  * Copyright 2022 Adobe. All rights reserved.
58
56
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
59
57
  * you may not use this file except in compliance with the License. You may obtain a copy
@@ -355,9 +353,9 @@ class $2240a72410c17d51$export$7ff77a162970b30e {
355
353
  return this.columnWidths;
356
354
  }
357
355
  constructor(options){
358
- (0, ($parcel$interopDefault($56JBj$swchelperslib_define_propertyjs)))(this, "columnWidths", new Map());
359
- (0, ($parcel$interopDefault($56JBj$swchelperslib_define_propertyjs)))(this, "columnMinWidths", new Map());
360
- (0, ($parcel$interopDefault($56JBj$swchelperslib_define_propertyjs)))(this, "columnMaxWidths", new Map());
356
+ this.columnWidths = new Map();
357
+ this.columnMinWidths = new Map();
358
+ this.columnMaxWidths = new Map();
361
359
  var _options_getDefaultWidth;
362
360
  this.getDefaultWidth = (_options_getDefaultWidth = options === null || options === void 0 ? void 0 : options.getDefaultWidth) !== null && _options_getDefaultWidth !== void 0 ? _options_getDefaultWidth : ()=>"1fr";
363
361
  var _options_getDefaultMinWidth;
@@ -472,7 +470,6 @@ function $7aa22d80cd4ca621$export$cb895dcf85db1319(props, state) {
472
470
  * governing permissions and limitations under the License.
473
471
  */
474
472
 
475
-
476
473
  const $7f5a58334d8866a5$var$ROW_HEADER_COLUMN_KEY = "row-header-column-" + Math.random().toString(36).slice(2);
477
474
  let $7f5a58334d8866a5$var$ROW_HEADER_COLUMN_KEY_DRAG = "row-header-column-" + Math.random().toString(36).slice(2);
478
475
  while($7f5a58334d8866a5$var$ROW_HEADER_COLUMN_KEY === $7f5a58334d8866a5$var$ROW_HEADER_COLUMN_KEY_DRAG)$7f5a58334d8866a5$var$ROW_HEADER_COLUMN_KEY_DRAG = "row-header-column-" + Math.random().toString(36).slice(2);
@@ -494,12 +491,12 @@ function $7f5a58334d8866a5$export$7c127db850d4e81e(keyMap, columnNodes) {
494
491
  // in the previous column so it's level with the current column.
495
492
  if (seen.has(parent)) {
496
493
  parent.colspan++;
497
- let { column: column1 , index: index } = seen.get(parent);
494
+ let { column: column , index: index } = seen.get(parent);
498
495
  if (index > col.length) break;
499
- for(let i = index; i < col.length; i++)column1.splice(i, 0, null);
496
+ for(let i = index; i < col.length; i++)column.splice(i, 0, null);
500
497
  // Adjust shifted indices
501
- for(let i1 = col.length; i1 < column1.length; i1++)// eslint-disable-next-line max-depth
502
- if (column1[i1] && seen.has(column1[i1])) seen.get(column1[i1]).index = i1;
498
+ for(let i = col.length; i < column.length; i++)// eslint-disable-next-line max-depth
499
+ if (column[i] && seen.has(column[i])) seen.get(column[i]).index = i;
503
500
  } else {
504
501
  parent.colspan = 1;
505
502
  col.push(parent);
@@ -517,12 +514,12 @@ function $7f5a58334d8866a5$export$7c127db850d4e81e(keyMap, columnNodes) {
517
514
  let headerRows = Array(maxLength).fill(0).map(()=>[]);
518
515
  // Convert columns into rows.
519
516
  let colIndex = 0;
520
- for (let column2 of columns){
521
- let i2 = maxLength - 1;
522
- for (let item of column2){
517
+ for (let column of columns){
518
+ let i = maxLength - 1;
519
+ for (let item of column){
523
520
  if (item) {
524
521
  // Fill the space up until the current column with a placeholder
525
- let row = headerRows[i2];
522
+ let row = headerRows[i];
526
523
  let rowLength = row.reduce((p, c)=>p + c.colspan, 0);
527
524
  if (rowLength < colIndex) {
528
525
  let placeholder = {
@@ -532,7 +529,7 @@ function $7f5a58334d8866a5$export$7c127db850d4e81e(keyMap, columnNodes) {
532
529
  index: rowLength,
533
530
  value: null,
534
531
  rendered: null,
535
- level: i2,
532
+ level: i,
536
533
  hasChildNodes: false,
537
534
  childNodes: [],
538
535
  textValue: null
@@ -548,35 +545,35 @@ function $7f5a58334d8866a5$export$7c127db850d4e81e(keyMap, columnNodes) {
548
545
  row[row.length - 1].nextKey = item.key;
549
546
  item.prevKey = row[row.length - 1].key;
550
547
  }
551
- item.level = i2;
548
+ item.level = i;
552
549
  item.colIndex = colIndex;
553
550
  row.push(item);
554
551
  }
555
- i2--;
552
+ i--;
556
553
  }
557
554
  colIndex++;
558
555
  }
559
556
  // Add placeholders at the end of each row that is shorter than the maximum
560
- let i3 = 0;
561
- for (let row1 of headerRows){
562
- let rowLength1 = row1.reduce((p, c)=>p + c.colspan, 0);
563
- if (rowLength1 < columnNodes.length) {
564
- let placeholder1 = {
557
+ let i = 0;
558
+ for (let row of headerRows){
559
+ let rowLength = row.reduce((p, c)=>p + c.colspan, 0);
560
+ if (rowLength < columnNodes.length) {
561
+ let placeholder = {
565
562
  type: "placeholder",
566
- key: "placeholder-" + row1[row1.length - 1].key,
567
- colspan: columnNodes.length - rowLength1,
568
- index: rowLength1,
563
+ key: "placeholder-" + row[row.length - 1].key,
564
+ colspan: columnNodes.length - rowLength,
565
+ index: rowLength,
569
566
  value: null,
570
567
  rendered: null,
571
- level: i3,
568
+ level: i,
572
569
  hasChildNodes: false,
573
570
  childNodes: [],
574
571
  textValue: null,
575
- prevKey: row1[row1.length - 1].key
572
+ prevKey: row[row.length - 1].key
576
573
  };
577
- row1.push(placeholder1);
574
+ row.push(placeholder);
578
575
  }
579
- i3++;
576
+ i++;
580
577
  }
581
578
  return headerRows.map((childNodes, index)=>{
582
579
  let row = {
@@ -593,9 +590,8 @@ function $7f5a58334d8866a5$export$7c127db850d4e81e(keyMap, columnNodes) {
593
590
  return row;
594
591
  });
595
592
  }
596
- let $7f5a58334d8866a5$var$_Symbol_iterator = Symbol.iterator;
597
593
  class $7f5a58334d8866a5$export$596e1b2e2cf93690 extends (0, $56JBj$reactstatelygrid.GridCollection) {
598
- *[$7f5a58334d8866a5$var$_Symbol_iterator]() {
594
+ *[Symbol.iterator]() {
599
595
  yield* this.body.childNodes;
600
596
  }
601
597
  get size() {
@@ -671,7 +667,7 @@ class $7f5a58334d8866a5$export$596e1b2e2cf93690 extends (0, $56JBj$reactstatelyg
671
667
  }
672
668
  // Add cell for drag buttons if needed.
673
669
  if (opts === null || opts === void 0 ? void 0 : opts.showDragButtons) {
674
- let rowHeaderColumn1 = {
670
+ let rowHeaderColumn = {
675
671
  type: "column",
676
672
  key: $7f5a58334d8866a5$var$ROW_HEADER_COLUMN_KEY_DRAG,
677
673
  value: null,
@@ -685,7 +681,7 @@ class $7f5a58334d8866a5$export$596e1b2e2cf93690 extends (0, $56JBj$reactstatelyg
685
681
  isDragButtonCell: true
686
682
  }
687
683
  };
688
- columns.unshift(rowHeaderColumn1);
684
+ columns.unshift(rowHeaderColumn);
689
685
  }
690
686
  let rows = [];
691
687
  let columnKeyMap = new Map();
@@ -718,7 +714,7 @@ class $7f5a58334d8866a5$export$596e1b2e2cf93690 extends (0, $56JBj$reactstatelyg
718
714
  return node;
719
715
  }
720
716
  });
721
- (0, ($parcel$interopDefault($56JBj$swchelperslib_define_propertyjs)))(this, "_size", 0);
717
+ this._size = 0;
722
718
  this.columns = columns;
723
719
  this.rowHeaderColumnKeys = rowHeaderColumnKeys;
724
720
  this.body = body;
@@ -809,14 +805,14 @@ $f45775f5d6f744fa$var$TableHeader.getCollectionNode = function* getCollectionNod
809
805
  renderer: children
810
806
  };
811
807
  } else {
812
- let columns1 = [];
808
+ let columns = [];
813
809
  (0, ($parcel$interopDefault($56JBj$react))).Children.forEach(children, (column)=>{
814
- columns1.push({
810
+ columns.push({
815
811
  type: "column",
816
812
  element: column
817
813
  });
818
814
  });
819
- yield* columns1;
815
+ yield* columns;
820
816
  }
821
817
  };
822
818
  /**
@@ -855,14 +851,14 @@ $6ec527db6a3a5692$var$TableBody.getCollectionNode = function* getCollectionNode(
855
851
  renderer: children
856
852
  };
857
853
  } else {
858
- let items1 = [];
854
+ let items = [];
859
855
  (0, ($parcel$interopDefault($56JBj$react))).Children.forEach(children, (item)=>{
860
- items1.push({
856
+ items.push({
861
857
  type: "item",
862
858
  element: item
863
859
  });
864
860
  });
865
- yield* items1;
861
+ yield* items;
866
862
  }
867
863
  }
868
864
  };
@@ -904,14 +900,14 @@ $714483d9f6ca4c55$var$Column.getCollectionNode = function* getCollectionNode(pro
904
900
  value: child
905
901
  };
906
902
  else if (title) {
907
- let childColumns1 = [];
903
+ let childColumns = [];
908
904
  (0, ($parcel$interopDefault($56JBj$react))).Children.forEach(children, (child)=>{
909
- childColumns1.push({
905
+ childColumns.push({
910
906
  type: "column",
911
907
  element: child
912
908
  });
913
909
  });
914
- yield* childColumns1;
910
+ yield* childColumns;
915
911
  }
916
912
  },
917
913
  shouldInvalidate (newContext) {