@onehat/ui 0.3.234 → 0.3.235

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onehat/ui",
3
- "version": "0.3.234",
3
+ "version": "0.3.235",
4
4
  "description": "Base UI for OneHat apps",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -205,7 +205,7 @@ function GridComponent(props) {
205
205
  isAddingRef = useRef(),
206
206
  expandedRowsRef = useRef({}),
207
207
  cachedDragElements = useRef(),
208
- idsRef = useRef([]),
208
+ dragSelectionRef = useRef([]),
209
209
  [isInited, setIsInited] = useState(false),
210
210
  [isReady, setIsReady] = useState(false),
211
211
  [isLoading, setIsLoading] = useState(false),
@@ -449,9 +449,8 @@ function GridComponent(props) {
449
449
  let WhichRow = GridRow;
450
450
  if (CURRENT_MODE === UI_MODE_WEB) { // DND is currrently web-only TODO: implement for RN
451
451
  // Create a method that gets an always-current copy of the selection ids
452
- const ids = _.map(selection, (item) => item.id);
453
- idsRef.current = ids;
454
- const getIds = () => idsRef.current;
452
+ dragSelectionRef.current = selection;
453
+ const getSelection = () => dragSelectionRef.current;
455
454
 
456
455
  // assign event handlers
457
456
  if (canRowsReorder && isDragMode) {
@@ -461,7 +460,7 @@ function GridComponent(props) {
461
460
  const dragIx = showHeaders ? index - 1 : index;
462
461
  rowReorderProps.dragSourceItem = {
463
462
  id: item.id,
464
- getIds,
463
+ getSelection,
465
464
  onDrag: (dragState) => {
466
465
  onRowReorderDrag(dragState, dragIx);
467
466
  },
@@ -474,11 +473,11 @@ function GridComponent(props) {
474
473
  rowDragProps.isDragSource = true;
475
474
  rowDragProps.dragSourceType = rowDragSourceType;
476
475
  if (getRowDragSourceItem) {
477
- rowDragProps.dragSourceItem = getRowDragSourceItem(item, getIds, rowDragSourceType);
476
+ rowDragProps.dragSourceItem = getRowDragSourceItem(item, getSelection, rowDragSourceType);
478
477
  } else {
479
478
  rowDragProps.dragSourceItem = {
480
479
  id: item.id,
481
- getIds,
480
+ getSelection,
482
481
  type: rowDragSourceType,
483
482
  };
484
483
  }