touchstudy-core 0.1.155 → 0.1.156

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.
@@ -8,7 +8,7 @@ export interface VirtualTableViewProps {
8
8
  columnCount: number;
9
9
  listHeight?: number;
10
10
  listWidth?: number;
11
- containerRef?: RefObject<HTMLDivElement>;
11
+ containerRef: RefObject<HTMLDivElement>;
12
12
  multiGridRef?: RefObject<MultiGrid>;
13
13
  overscanRowCount?: number;
14
14
  overscanColumnCount?: number;
package/dist/index.js CHANGED
@@ -24475,6 +24475,7 @@ var AttendanceCourseTable = function AttendanceCourseTable(_ref) {
24475
24475
  return state === null || state === void 0 ? void 0 : (_state$common2 = state.common) === null || _state$common2 === void 0 ? void 0 : _state$common2.language;
24476
24476
  });
24477
24477
  var dataString = JSON.stringify(data);
24478
+ var containerRef = React.useRef(null);
24478
24479
  var handleCheckInLesson = function handleCheckInLesson(lesson, studentId) {
24479
24480
  if (isAdmin) return;
24480
24481
  onCheckInLesson(lesson, studentId);
@@ -24532,15 +24533,43 @@ var AttendanceCourseTable = function AttendanceCourseTable(_ref) {
24532
24533
  }, (attendance === null || attendance === void 0 ? void 0 : attendance.status) === StudentAttendanceStatus.Late ? React__default.createElement(AlertCircleFill, null) : (attendance === null || attendance === void 0 ? void 0 : attendance.status) === StudentAttendanceStatus.Attended ? React__default.createElement(CheckCircleFill, null) : React__default.createElement(CloseCircleFill, null))));
24533
24534
  };
24534
24535
  var columnCount = data.length;
24536
+ var multiGridRef = React.useRef(null);
24537
+ React.useEffect(function () {
24538
+ var handleResize = function handleResize() {
24539
+ var _multiGridRef$current;
24540
+ (_multiGridRef$current = multiGridRef.current) === null || _multiGridRef$current === void 0 ? void 0 : _multiGridRef$current.invalidateCellSizeAfterRender();
24541
+ };
24542
+ window.addEventListener("resize", handleResize);
24543
+ return function () {
24544
+ window.removeEventListener("resize", handleResize);
24545
+ };
24546
+ }, []);
24547
+ var columnWidth = function columnWidth(params, cache) {
24548
+ if (!containerRef.current || params.index < columnCount - 1) return cache.columnWidth(params);
24549
+ var containerWidth = containerRef.current.clientWidth;
24550
+ var currentWidth = cache.columnWidth(params);
24551
+ var totalWidth = 0;
24552
+ for (var index = 0; index < params.index; index++) {
24553
+ var elementWidth = cache.columnWidth({
24554
+ index: index
24555
+ });
24556
+ totalWidth += elementWidth;
24557
+ }
24558
+ if (totalWidth + currentWidth < containerWidth) return containerWidth - totalWidth;
24559
+ return currentWidth;
24560
+ };
24535
24561
  return React__default.createElement(VirtualTableView, {
24536
24562
  loading: false,
24563
+ multiGridRef: multiGridRef,
24564
+ containerRef: containerRef,
24537
24565
  containerProps: containerProps,
24538
24566
  listHeight: listHeight,
24539
24567
  listWidth: listWidth,
24540
24568
  renderItem: renderItem,
24541
24569
  columnCount: columnCount,
24542
24570
  itemsCount: 2,
24543
- dataString: dataString
24571
+ dataString: dataString,
24572
+ columnWidth: columnWidth
24544
24573
  });
24545
24574
  };
24546
24575