@vuu-ui/vuu-data-react 0.8.20-debug → 0.8.21-debug

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/esm/index.js CHANGED
@@ -22055,12 +22055,40 @@ import React9, {
22055
22055
  useState as useState27
22056
22056
  } from "react";
22057
22057
 
22058
- // ../vuu-ui-controls/src/combo-box/ComboBox.tsx
22059
- import { useId as useId7 } from "@vuu-ui/vuu-utils";
22058
+ // ../vuu-ui-controls/src/dropdown/DropdownBase.tsx
22059
+ import { useId as useId5 } from "@vuu-ui/vuu-utils";
22060
+ import { Children as Children3, cloneElement as cloneElement4, forwardRef as forwardRef7, useRef as useRef17 } from "react";
22061
+
22062
+ // ../vuu-ui-controls/src/utils/escapeRegExp.ts
22063
+ var regExp = /[.*+?^${}()|[\]\\]/g;
22064
+ function escapeRegExp(string2) {
22065
+ return string2.replace(regExp, "\\$&");
22066
+ }
22067
+
22068
+ // ../vuu-ui-controls/src/utils/forwardCallbackProps.ts
22069
+ var forwardCallbackProps = (ownProps, overrideProps) => {
22070
+ const props = Object.keys(ownProps).reduce(
22071
+ (map, name2) => {
22072
+ const ownProp = ownProps[name2];
22073
+ const overrideProp = overrideProps[name2];
22074
+ if (typeof ownProp === "function" && typeof overrideProp === "function") {
22075
+ map[name2] = (...args) => {
22076
+ ownProp(...args);
22077
+ overrideProp(...args);
22078
+ };
22079
+ }
22080
+ return map;
22081
+ },
22082
+ { ...overrideProps }
22083
+ );
22084
+ return props;
22085
+ };
22086
+
22087
+ // ../vuu-ui-controls/src/dropdown/useDropdownBase.ts
22060
22088
  import {
22061
- forwardRef as forwardRef11,
22062
- useCallback as useCallback39,
22063
- useRef as useRef34
22089
+ useCallback as useCallback18,
22090
+ useRef as useRef16,
22091
+ useState as useState16
22064
22092
  } from "react";
22065
22093
 
22066
22094
  // ../vuu-ui-controls/src/common-hooks/collectionProvider.tsx
@@ -22081,8 +22109,10 @@ function useCollection() {
22081
22109
  }
22082
22110
  }
22083
22111
 
22084
- // ../vuu-ui-controls/src/common-hooks/itemToString.ts
22112
+ // ../vuu-ui-controls/src/common-hooks/isPlainObject.ts
22085
22113
  var isPlainObject = (obj) => Object.prototype.toString.call(obj) === "[object Object]";
22114
+
22115
+ // ../vuu-ui-controls/src/common-hooks/itemToString.ts
22086
22116
  function itemToString(item) {
22087
22117
  if (typeof item === "string") {
22088
22118
  return item;
@@ -22277,31 +22307,6 @@ function replaceCollectionItem(nodes, id, props) {
22277
22307
  return newNodes;
22278
22308
  }
22279
22309
 
22280
- // ../vuu-ui-controls/src/utils/escapeRegExp.ts
22281
- var regExp = /[.*+?^${}()|[\]\\]/g;
22282
- function escapeRegExp(string2) {
22283
- return string2.replace(regExp, "\\$&");
22284
- }
22285
-
22286
- // ../vuu-ui-controls/src/utils/forwardCallbackProps.ts
22287
- var forwardCallbackProps = (ownProps, overrideProps) => {
22288
- const props = Object.keys(ownProps).reduce(
22289
- (map, name2) => {
22290
- const ownProp = ownProps[name2];
22291
- const overrideProp = overrideProps[name2];
22292
- if (typeof ownProp === "function" && typeof overrideProp === "function") {
22293
- map[name2] = (...args) => {
22294
- ownProp(...args);
22295
- overrideProp(...args);
22296
- };
22297
- }
22298
- return map;
22299
- },
22300
- { ...overrideProps }
22301
- );
22302
- return props;
22303
- };
22304
-
22305
22310
  // ../vuu-ui-controls/src/list/common-hooks/utils/filter-utils.ts
22306
22311
  var leftTrim = (value) => value ? value.replace(/^\s+/g, "") : value;
22307
22312
  var getDefaultFilterRegex = (value) => new RegExp(`(${escapeRegExp(leftTrim(value))})`, "gi");
@@ -22813,17 +22818,6 @@ var selectionIsDisallowed = (selection) => selection === "none";
22813
22818
  var hasSelection = (selected) => selected !== void 0 && selected.length > 0;
22814
22819
  var getFirstSelectedItem = (selected) => selected[0];
22815
22820
 
22816
- // ../vuu-ui-controls/src/dropdown/DropdownBase.tsx
22817
- import { useId as useId5 } from "@vuu-ui/vuu-utils";
22818
- import { Children as Children3, cloneElement as cloneElement4, forwardRef as forwardRef7, useRef as useRef17 } from "react";
22819
-
22820
- // ../vuu-ui-controls/src/dropdown/useDropdownBase.ts
22821
- import {
22822
- useCallback as useCallback18,
22823
- useRef as useRef16,
22824
- useState as useState16
22825
- } from "react";
22826
-
22827
22821
  // ../vuu-ui-controls/src/dropdown/useClickAway.ts
22828
22822
  import { useEffect as useEffect8, useRef as useRef15 } from "react";
22829
22823
  var NO_HANDLERS = [];
@@ -24161,7 +24155,7 @@ var useDragDropProvider = (id) => {
24161
24155
 
24162
24156
  // ../vuu-ui-controls/src/drag-drop/DragDropState.ts
24163
24157
  var DragDropState = class {
24164
- constructor(evt, dragElement) {
24158
+ constructor(mousePosition, dragElement) {
24165
24159
  /** Element being dragged, (initial element cloned and rendered in portal). */
24166
24160
  this.draggableElement = null;
24167
24161
  this.payload = null;
@@ -24170,13 +24164,13 @@ var DragDropState = class {
24170
24164
  this.draggableElement = el;
24171
24165
  };
24172
24166
  this.initialDragElement = dragElement;
24173
- this.mouseOffset = this.getMouseOffset(evt, dragElement);
24167
+ this.mouseOffset = this.getMouseOffset(mousePosition, dragElement);
24174
24168
  }
24175
24169
  setPayload(payload) {
24176
24170
  this.payload = payload;
24177
24171
  }
24178
- getMouseOffset(evt, dragElement) {
24179
- const { clientX, clientY } = evt;
24172
+ getMouseOffset(mousePosition, dragElement) {
24173
+ const { clientX, clientY } = mousePosition;
24180
24174
  const draggableRect = dragElement.getBoundingClientRect();
24181
24175
  return {
24182
24176
  x: clientX - draggableRect.left,
@@ -24185,7 +24179,7 @@ var DragDropState = class {
24185
24179
  }
24186
24180
  };
24187
24181
 
24188
- // ../vuu-ui-controls/src/drag-drop/useDragDropNext.tsx
24182
+ // ../vuu-ui-controls/src/drag-drop/useDragDrop.tsx
24189
24183
  import { dispatchCustomEvent } from "@vuu-ui/vuu-utils";
24190
24184
  import {
24191
24185
  useCallback as useCallback32,
@@ -24858,7 +24852,7 @@ var useDragDropIndicator = ({
24858
24852
  };
24859
24853
  };
24860
24854
 
24861
- // ../vuu-ui-controls/src/drag-drop/useDragDropNaturalMovementNext.tsx
24855
+ // ../vuu-ui-controls/src/drag-drop/useDragDropNaturalMovement.tsx
24862
24856
  import { useCallback as useCallback31, useMemo as useMemo17, useRef as useRef26, useState as useState19 } from "react";
24863
24857
 
24864
24858
  // ../vuu-ui-controls/src/drag-drop/useDragDisplacers.ts
@@ -24997,7 +24991,7 @@ var useDragDisplacers = (orientation = "horizontal") => {
24997
24991
  };
24998
24992
  };
24999
24993
 
25000
- // ../vuu-ui-controls/src/drag-drop/useDragDropNaturalMovementNext.tsx
24994
+ // ../vuu-ui-controls/src/drag-drop/useDragDropNaturalMovement.tsx
25001
24995
  import { dispatchMouseEvent } from "@vuu-ui/vuu-utils";
25002
24996
  var useDragDropNaturalMovement = ({
25003
24997
  onDrop,
@@ -25257,7 +25251,7 @@ var useDragDropNaturalMovement = ({
25257
25251
  };
25258
25252
  };
25259
25253
 
25260
- // ../vuu-ui-controls/src/drag-drop/useDragDropNext.tsx
25254
+ // ../vuu-ui-controls/src/drag-drop/useDragDrop.tsx
25261
25255
  import { jsx as jsx25 } from "react/jsx-runtime";
25262
25256
  var NULL_DRAG_DROP_RESULT = {
25263
25257
  beginDrag: () => void 0,
@@ -25278,14 +25272,14 @@ var UNBOUNDED = {
25278
25272
  };
25279
25273
  var noDragDrop = () => NULL_DRAG_DROP_RESULT;
25280
25274
  var dragThreshold = 3;
25281
- var getDraggableElement = (el, query) => el.closest(query);
25275
+ var getDraggableElement = (el, query) => el == null ? void 0 : el.closest(query);
25282
25276
  var getLastElement = (container, itemQuery) => {
25283
25277
  const fullItemQuery = `:is(${itemQuery}${NOT_OVERFLOWED},.vuuOverflowContainer-OverflowIndicator)`;
25284
25278
  const childElements = Array.from(container.querySelectorAll(fullItemQuery));
25285
25279
  const lastElement = childElements.pop();
25286
25280
  return [lastElement, isOverflowElement(lastElement)];
25287
25281
  };
25288
- var useDragDropNext = ({
25282
+ var useDragDrop = ({
25289
25283
  allowDragDrop,
25290
25284
  containerRef,
25291
25285
  draggableClassName,
@@ -25312,6 +25306,7 @@ var useDragDropNext = ({
25312
25306
  const dragDropStateRef = useRef27(null);
25313
25307
  const mouseDownTimer = useRef27(null);
25314
25308
  const isScrollableRef = useRef27(false);
25309
+ const mousedownElementRef = useRef27(null);
25315
25310
  const mousePosRef = useRef27({ x: 0, y: 0 });
25316
25311
  const startPosRef = useRef27({ x: 0, y: 0 });
25317
25312
  const settlingItemRef = useRef27(null);
@@ -25576,10 +25571,10 @@ var useDragDropNext = ({
25576
25571
  [attachDragHandlers, beginDrag, containerRef, setDragBoundaries]
25577
25572
  );
25578
25573
  const dragStart = useCallback32(
25579
- (evt) => {
25580
- const { target } = evt;
25581
- const dragElement = getDraggableElement(target, itemQuery);
25574
+ (mousePosition) => {
25582
25575
  const { current: container } = containerRef;
25576
+ const { current: target } = mousedownElementRef;
25577
+ const dragElement = getDraggableElement(target, itemQuery);
25583
25578
  if (container && dragElement) {
25584
25579
  const scrollableContainer = getScrollableContainer(
25585
25580
  container,
@@ -25593,7 +25588,7 @@ var useDragDropNext = ({
25593
25588
  const containerRect = container.getBoundingClientRect();
25594
25589
  const draggableRect = dragElement.getBoundingClientRect();
25595
25590
  const dragDropState = dragDropStateRef.current = new DragDropState(
25596
- evt,
25591
+ mousePosition,
25597
25592
  dragElement
25598
25593
  );
25599
25594
  setDragBoundaries(containerRect, draggableRect);
@@ -25618,6 +25613,7 @@ var useDragDropNext = ({
25618
25613
  });
25619
25614
  onDragStart == null ? void 0 : onDragStart(dragDropState);
25620
25615
  attachDragHandlers();
25616
+ mousedownElementRef.current = null;
25621
25617
  }
25622
25618
  },
25623
25619
  [
@@ -25634,9 +25630,10 @@ var useDragDropNext = ({
25634
25630
  );
25635
25631
  const preDragMouseMoveHandler = useCallback32(
25636
25632
  (evt) => {
25633
+ const { current: mouseDownPosition } = startPosRef;
25637
25634
  const { CLIENT_POS, POS } = dimensions(orientation);
25638
25635
  const { [CLIENT_POS]: clientPos } = evt;
25639
- const mouseMoveDistance = Math.abs(clientPos - startPosRef.current[POS]);
25636
+ const mouseMoveDistance = Math.abs(clientPos - mouseDownPosition[POS]);
25640
25637
  if (mouseMoveDistance > dragThreshold && containerRef.current) {
25641
25638
  if (mouseDownTimer.current) {
25642
25639
  window.clearTimeout(mouseDownTimer.current);
@@ -25644,7 +25641,11 @@ var useDragDropNext = ({
25644
25641
  }
25645
25642
  document.removeEventListener("mousemove", preDragMouseMoveHandler);
25646
25643
  document.removeEventListener("mouseup", preDragMouseUpHandler, false);
25647
- dragStart(evt);
25644
+ const mousePosition = {
25645
+ clientX: mouseDownPosition.x,
25646
+ clientY: mouseDownPosition.y
25647
+ };
25648
+ dragStart(mousePosition);
25648
25649
  }
25649
25650
  },
25650
25651
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -25666,6 +25667,11 @@ var useDragDropNext = ({
25666
25667
  const { clientX, clientY } = evt;
25667
25668
  mousePosRef.current.x = startPosRef.current.x = clientX;
25668
25669
  mousePosRef.current.y = startPosRef.current.y = clientY;
25670
+ mousedownElementRef.current = evt.target;
25671
+ const mousePosition = {
25672
+ clientX,
25673
+ clientY
25674
+ };
25669
25675
  document.addEventListener("mousemove", preDragMouseMoveHandler, false);
25670
25676
  document.addEventListener("mouseup", preDragMouseUpHandler, false);
25671
25677
  evt.persist();
@@ -25676,7 +25682,7 @@ var useDragDropNext = ({
25676
25682
  false
25677
25683
  );
25678
25684
  document.removeEventListener("mouseup", preDragMouseUpHandler, false);
25679
- dragStart(evt.nativeEvent);
25685
+ dragStart(mousePosition);
25680
25686
  }, 500);
25681
25687
  }
25682
25688
  },
@@ -25962,7 +25968,7 @@ var useList = ({
25962
25968
  isDragging,
25963
25969
  isScrolling: isDragDropScrolling,
25964
25970
  ...dragDropHook
25965
- } = useDragDropNext({
25971
+ } = useDragDrop({
25966
25972
  allowDragDrop,
25967
25973
  draggableClassName: "list-item",
25968
25974
  orientation: "vertical",
@@ -26513,6 +26519,14 @@ var List = forwardRef10(function List2({
26513
26519
  );
26514
26520
  });
26515
26521
 
26522
+ // ../vuu-ui-controls/src/combo-box/ComboBox.tsx
26523
+ import { useId as useId7 } from "@vuu-ui/vuu-utils";
26524
+ import {
26525
+ forwardRef as forwardRef11,
26526
+ useCallback as useCallback39,
26527
+ useRef as useRef34
26528
+ } from "react";
26529
+
26516
26530
  // ../vuu-ui-controls/src/list/ChevronIcon.tsx
26517
26531
  import { jsx as jsx27 } from "react/jsx-runtime";
26518
26532
  var classBase8 = "vuuChevronIcon";
@@ -27784,7 +27798,7 @@ var useTabstrip = ({
27784
27798
  suspendAnimation
27785
27799
  ]
27786
27800
  );
27787
- const { onMouseDown: dragDropHookHandleMouseDown, ...dragDropHook } = useDragDropNext({
27801
+ const { onMouseDown: dragDropHookHandleMouseDown, ...dragDropHook } = useDragDrop({
27788
27802
  allowDragDrop,
27789
27803
  containerRef,
27790
27804
  // this is for useDragDropNext
@@ -29527,7 +29541,7 @@ var useOverflowContainer = ({
29527
29541
  },
29528
29542
  [onMoveItem]
29529
29543
  );
29530
- const { onMouseDown: dragDropHookHandleMouseDown, ...dragDropHook } = useDragDropNext({
29544
+ const { onMouseDown: dragDropHookHandleMouseDown, ...dragDropHook } = useDragDrop({
29531
29545
  allowDragDrop,
29532
29546
  containerRef,
29533
29547
  // this is for useDragDropNext
@@ -30296,21 +30310,13 @@ var TextInput = forwardRef22(function TextInput2({
30296
30310
  const [typeaheadValues, setTypeaheadValues] = useState36([]);
30297
30311
  const getSuggestions = suggestionProvider();
30298
30312
  const handleSingleValueSelectionChange = useCallback61(
30299
- (evt, value2) => onInputComplete(value2),
30313
+ (_, value2) => onInputComplete(value2),
30300
30314
  [onInputComplete]
30301
30315
  );
30302
30316
  const handleMultiValueSelectionChange = useCallback61(
30303
- (evt, value2) => {
30304
- if (value2.length === 1) {
30305
- onInputComplete(value2[0]);
30306
- } else if (value2.length > 1) {
30307
- onInputComplete(value2);
30308
- }
30309
- },
30317
+ (_, values) => onInputComplete(values),
30310
30318
  [onInputComplete]
30311
30319
  );
30312
- useEffect17(() => {
30313
- }, [column]);
30314
30320
  useEffect17(() => {
30315
30321
  if (table) {
30316
30322
  const params = valueInputValue ? [table, column.name, valueInputValue] : [table, column.name];