virtua 0.52.0 → 0.52.1

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.
@@ -743,92 +743,90 @@ var createGridPlan = (rowLayout, colLayout, rowRange, colRange, headerRows = 0,
743
743
  const endPinned = colIndex >= colTrailStart;
744
744
  const colInRangeOrPinnedToEnd = endPinned || colIndex >= colRangeStart && colIndex <= colRangeEnd;
745
745
  const span = spanCells.get(rowKey + colIndex);
746
- if (span ? span.rowIndex !== rowIndex || span.colIndex !== colIndex : !(rowInRangeOrPinnedToEnd && colInRangeOrPinnedToEnd) && !pinnedTop && !isSectionHeaderRow && !startPinned) {
747
- continue;
748
- }
749
- const rowTo = span ? getSpanRowEnd(span, rowCount) : rowIndex + 1;
750
- const colTo = span ? getSpanColEnd(span, colCount) : colIndex + 1;
751
- const spansRows = rowTo - rowIndex > 1;
752
- const spansCols = colTo - colIndex > 1;
753
- const spanning = spansRows || spansCols;
754
- const rowSpan = spanning ? rowTo - rowIndex : undefined;
755
- const colSpan = spanning ? colTo - colIndex : undefined;
756
- let measureRowIndex;
757
- let measureColIndex;
758
- rowEnd = max(rowEnd, rowTo);
759
- const stickyStart = startPinned ? colLayout.$getItemOffset(colIndex) : null;
760
- const stickyEnd = endPinned ? colLayout.$getTotalSize() - colLayout.$getItemOffset(colTo - 1) - colLayout.$getItemSize(colTo - 1) : null;
761
- if (measuredRow === false && !spansRows) {
762
- measureRowIndex = rowIndex;
763
- measuredRow = true;
764
- }
765
- if (measuredCols[i] === false && !spansCols) {
766
- measureColIndex = colIndex;
767
- measuredCols[i] = true;
768
- }
769
- const role = pinnedTop ? "columnheader" : colIndex === rowHeaderCol && (startPinned || isSectionHeaderRow) ? "rowheader" : "cell";
770
- const sortOrder = role !== "cell" && sortedCell && sortedCell.rowIndex === rowIndex && sortedCell.colIndex === colIndex ? sortedCell.order : undefined;
771
- let cell;
772
- if (prevCells) {
773
- while (p < prevCells.length && prevCells[p].$col < colIndex) {
774
- p++;
746
+ if (span ? span.rowIndex === rowIndex && span.colIndex === colIndex : rowInRangeOrPinnedToEnd && colInRangeOrPinnedToEnd || pinnedTop || isSectionHeaderRow || startPinned) {
747
+ const rowTo = span ? getSpanRowEnd(span, rowCount) : rowIndex + 1;
748
+ const colTo = span ? getSpanColEnd(span, colCount) : colIndex + 1;
749
+ const spansRows = rowTo - rowIndex > 1;
750
+ const spansCols = colTo - colIndex > 1;
751
+ const spanning = spansRows || spansCols;
752
+ const rowSpan = spanning ? rowTo - rowIndex : undefined;
753
+ const colSpan = spanning ? colTo - colIndex : undefined;
754
+ let measureRowIndex;
755
+ let measureColIndex;
756
+ rowEnd = max(rowEnd, rowTo);
757
+ const stickyStart = startPinned ? colLayout.$getItemOffset(colIndex) : null;
758
+ const stickyEnd = endPinned ? colLayout.$getTotalSize() - colLayout.$getItemOffset(colTo - 1) - colLayout.$getItemSize(colTo - 1) : null;
759
+ if (measuredRow === false && !spansRows) {
760
+ measureRowIndex = rowIndex;
761
+ measuredRow = true;
775
762
  }
776
- if (p < prevCells.length) {
777
- cell = prevCells[p];
763
+ if (measuredCols[i] === false && !spansCols) {
764
+ measureColIndex = colIndex;
765
+ measuredCols[i] = true;
778
766
  }
779
- }
780
- if (!cell || cell.$col !== colIndex || cell.$rowSpan !== rowSpan || cell.$colSpan !== colSpan || cell.$start !== stickyStart || cell.$end !== stickyEnd || cell.$measureRow !== measureRowIndex || cell.$measureCol !== measureColIndex || cell.$role !== role || cell.$sort !== sortOrder) {
781
- const style = {
782
- contain: "layout style",
783
- display: "grid",
784
- gridArea: spanning ? "1/l" + colIndex + "/l" + rowTo + "/l" + colTo : "1/l" + colIndex
785
- };
786
- if (spansRows) {
787
- style["height"] = "0px";
788
- style["minHeight"] = "100%";
789
- style["zIndex"] = 1;
790
- }
791
- if (spansCols) {
792
- style["width"] = "0px";
793
- style["minWidth"] = "100%";
767
+ const role = pinnedTop ? "columnheader" : colIndex === rowHeaderCol && (startPinned || isSectionHeaderRow) ? "rowheader" : "cell";
768
+ const sortOrder = role !== "cell" && sortedCell && sortedCell.rowIndex === rowIndex && sortedCell.colIndex === colIndex ? sortedCell.order : undefined;
769
+ let cell;
770
+ if (prevCells) {
771
+ while (p < prevCells.length && prevCells[p].$col < colIndex) {
772
+ p++;
773
+ }
774
+ if (p < prevCells.length) {
775
+ cell = prevCells[p];
776
+ }
794
777
  }
795
- if (startPinned || endPinned) {
796
- if (startPinned) {
797
- style["insetInlineStart"] = stickyStart + "px";
798
- } else {
799
- style["insetInlineEnd"] = stickyEnd + "px";
778
+ if (!cell || cell.$col !== colIndex || cell.$rowSpan !== rowSpan || cell.$colSpan !== colSpan || cell.$start !== stickyStart || cell.$end !== stickyEnd || cell.$measureRow !== measureRowIndex || cell.$measureCol !== measureColIndex || cell.$role !== role || cell.$sort !== sortOrder) {
779
+ const style = {
780
+ contain: "layout style",
781
+ display: "grid",
782
+ gridArea: spanning ? "1/l" + colIndex + "/l" + rowTo + "/l" + colTo : "1/l" + colIndex
783
+ };
784
+ if (spansRows) {
785
+ style["height"] = "0px";
786
+ style["minHeight"] = "100%";
787
+ style["zIndex"] = 1;
788
+ }
789
+ if (spansCols) {
790
+ style["width"] = "0px";
791
+ style["minWidth"] = "100%";
800
792
  }
801
- style["position"] = "sticky";
802
- style["zIndex"] = 2;
793
+ if (startPinned || endPinned) {
794
+ if (startPinned) {
795
+ style["insetInlineStart"] = stickyStart + "px";
796
+ } else {
797
+ style["insetInlineEnd"] = stickyEnd + "px";
798
+ }
799
+ style["position"] = "sticky";
800
+ style["zIndex"] = 2;
801
+ }
802
+ cell = {
803
+ $col: colIndex,
804
+ $rowSpan: rowSpan,
805
+ $colSpan: colSpan,
806
+ $measureRow: measureRowIndex,
807
+ $measureCol: measureColIndex,
808
+ $role: role,
809
+ $sort: sortOrder,
810
+ $style: style,
811
+ $start: stickyStart,
812
+ $end: stickyEnd
813
+ };
814
+ changed = true;
803
815
  }
804
- cell = {
805
- $col: colIndex,
806
- $rowSpan: rowSpan,
807
- $colSpan: colSpan,
808
- $measureRow: measureRowIndex,
809
- $measureCol: measureColIndex,
810
- $role: role,
811
- $sort: sortOrder,
812
- $style: style,
813
- $start: stickyStart,
814
- $end: stickyEnd
815
- };
816
- changed = true;
816
+ rowCells.push(cell);
817
817
  }
818
- rowCells.push(cell);
819
818
  }
820
819
  measuredRows.push(measuredRow);
821
- if (!rowCells.length) {
822
- continue;
820
+ if (rowCells.length) {
821
+ const row = prevRow && !changed && prevRow.$cells.length === rowCells.length && prevRow.$top === rowTop ? prevRow : {
822
+ $row: rowIndex,
823
+ $cells: rowCells,
824
+ $style: getBoxStyle(rowIndex, rowEnd, rowTop, "top", 3),
825
+ $top: rowTop
826
+ };
827
+ rowStates.set(rowIndex, row);
828
+ groupRows.push(row);
823
829
  }
824
- const row = prevRow && !changed && prevRow.$cells.length === rowCells.length && prevRow.$top === rowTop ? prevRow : {
825
- $row: rowIndex,
826
- $cells: rowCells,
827
- $style: getBoxStyle(rowIndex, rowEnd, rowTop, "top", 3),
828
- $top: rowTop
829
- };
830
- rowStates.set(rowIndex, row);
831
- groupRows.push(row);
832
830
  }
833
831
  rowStatesCache.set(rowLayout, rowStates);
834
832
  return {