@deephaven/components 0.5.2-beta.0 → 0.6.1-demo.10

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.
Files changed (119) hide show
  1. package/dist/AutoCompleteInput.js +410 -448
  2. package/dist/AutoCompleteInput.js.map +1 -1
  3. package/dist/AutoResizeTextarea.js +17 -46
  4. package/dist/AutoResizeTextarea.js.map +1 -1
  5. package/dist/BasicModal.js +18 -19
  6. package/dist/BasicModal.js.map +1 -1
  7. package/dist/Button.js +30 -21
  8. package/dist/Button.js.map +1 -1
  9. package/dist/ButtonGroup.js +6 -4
  10. package/dist/ButtonGroup.js.map +1 -1
  11. package/dist/ButtonOld.js +10 -8
  12. package/dist/ButtonOld.js.map +1 -1
  13. package/dist/CardFlip.js +10 -8
  14. package/dist/CardFlip.js.map +1 -1
  15. package/dist/Checkbox.js +18 -31
  16. package/dist/Checkbox.js.map +1 -1
  17. package/dist/Collapse.js +65 -105
  18. package/dist/Collapse.js.map +1 -1
  19. package/dist/ComboBox.js +432 -460
  20. package/dist/ComboBox.js.map +1 -1
  21. package/dist/CustomTimeSelect.js +485 -517
  22. package/dist/CustomTimeSelect.js.map +1 -1
  23. package/dist/DebouncedSearchInput.js +61 -91
  24. package/dist/DebouncedSearchInput.js.map +1 -1
  25. package/dist/DeephavenSpinner.js +6 -6
  26. package/dist/DeephavenSpinner.js.map +1 -1
  27. package/dist/DragUtils.js +65 -113
  28. package/dist/DragUtils.js.map +1 -1
  29. package/dist/DraggableItemList.d.ts +1 -0
  30. package/dist/DraggableItemList.d.ts.map +1 -1
  31. package/dist/DraggableItemList.js +219 -257
  32. package/dist/DraggableItemList.js.map +1 -1
  33. package/dist/HierarchicalCheckboxMenu.js +160 -227
  34. package/dist/HierarchicalCheckboxMenu.js.map +1 -1
  35. package/dist/ItemList.d.ts +4 -2
  36. package/dist/ItemList.d.ts.map +1 -1
  37. package/dist/ItemList.js +595 -598
  38. package/dist/ItemList.js.map +1 -1
  39. package/dist/ItemListItem.js +194 -215
  40. package/dist/ItemListItem.js.map +1 -1
  41. package/dist/LoadingOverlay.js +9 -10
  42. package/dist/LoadingOverlay.js.map +1 -1
  43. package/dist/LoadingSpinner.js +4 -3
  44. package/dist/LoadingSpinner.js.map +1 -1
  45. package/dist/MaskedInput.js +59 -70
  46. package/dist/MaskedInput.js.map +1 -1
  47. package/dist/Option.js +5 -3
  48. package/dist/Option.js.map +1 -1
  49. package/dist/RadioGroup.js +16 -34
  50. package/dist/RadioGroup.js.map +1 -1
  51. package/dist/RadioItem.js +14 -33
  52. package/dist/RadioItem.js.map +1 -1
  53. package/dist/SearchInput.js +42 -75
  54. package/dist/SearchInput.js.map +1 -1
  55. package/dist/Select.js +10 -8
  56. package/dist/Select.js.map +1 -1
  57. package/dist/SelectValueList.js +97 -134
  58. package/dist/SelectValueList.js.map +1 -1
  59. package/dist/SocketedButton.js +13 -11
  60. package/dist/SocketedButton.js.map +1 -1
  61. package/dist/ThemeExport.js.map +1 -1
  62. package/dist/TimeInput.js +16 -53
  63. package/dist/TimeInput.js.map +1 -1
  64. package/dist/TimeSlider.js +62 -88
  65. package/dist/TimeSlider.js.map +1 -1
  66. package/dist/ToastNotification.js +14 -13
  67. package/dist/ToastNotification.js.map +1 -1
  68. package/dist/UISwitch.js +9 -8
  69. package/dist/UISwitch.js.map +1 -1
  70. package/dist/context-actions/ContextActionUtils.js +173 -231
  71. package/dist/context-actions/ContextActionUtils.js.map +1 -1
  72. package/dist/context-actions/ContextActions.js +135 -177
  73. package/dist/context-actions/ContextActions.js.map +1 -1
  74. package/dist/context-actions/ContextMenu.js +509 -543
  75. package/dist/context-actions/ContextMenu.js.map +1 -1
  76. package/dist/context-actions/ContextMenuItem.js +32 -22
  77. package/dist/context-actions/ContextMenuItem.js.map +1 -1
  78. package/dist/context-actions/ContextMenuRoot.js +112 -152
  79. package/dist/context-actions/ContextMenuRoot.js.map +1 -1
  80. package/dist/context-actions/GlobalContextAction.js +49 -84
  81. package/dist/context-actions/GlobalContextAction.js.map +1 -1
  82. package/dist/context-actions/GlobalContextActions.js +25 -57
  83. package/dist/context-actions/GlobalContextActions.js.map +1 -1
  84. package/dist/context-actions/index.js +4 -4
  85. package/dist/context-actions/index.js.map +1 -1
  86. package/dist/index.js +39 -39
  87. package/dist/index.js.map +1 -1
  88. package/dist/menu-actions/DropdownMenu.js +126 -159
  89. package/dist/menu-actions/DropdownMenu.js.map +1 -1
  90. package/dist/menu-actions/Menu.js +215 -245
  91. package/dist/menu-actions/Menu.js.map +1 -1
  92. package/dist/menu-actions/index.js +1 -1
  93. package/dist/menu-actions/index.js.map +1 -1
  94. package/dist/navigation/Menu.js +14 -18
  95. package/dist/navigation/Menu.js.map +1 -1
  96. package/dist/navigation/MenuItem.js +15 -14
  97. package/dist/navigation/MenuItem.js.map +1 -1
  98. package/dist/navigation/Page.js +7 -5
  99. package/dist/navigation/Page.js.map +1 -1
  100. package/dist/navigation/Stack.js +14 -39
  101. package/dist/navigation/Stack.js.map +1 -1
  102. package/dist/navigation/index.js +4 -4
  103. package/dist/navigation/index.js.map +1 -1
  104. package/dist/popper/Popper.js +209 -235
  105. package/dist/popper/Popper.js.map +1 -1
  106. package/dist/popper/Tooltip.js +227 -257
  107. package/dist/popper/Tooltip.js.map +1 -1
  108. package/dist/popper/index.js +2 -2
  109. package/dist/popper/index.js.map +1 -1
  110. package/dist/shortcuts/GlobalShortcuts.js +2 -2
  111. package/dist/shortcuts/GlobalShortcuts.js.map +1 -1
  112. package/dist/shortcuts/Shortcut.js +263 -291
  113. package/dist/shortcuts/Shortcut.js.map +1 -1
  114. package/dist/shortcuts/ShortcutRegistry.js +48 -71
  115. package/dist/shortcuts/ShortcutRegistry.js.map +1 -1
  116. package/dist/shortcuts/index.js +4 -4
  117. package/dist/shortcuts/index.js.map +1 -1
  118. package/dist/tsconfig.tsbuildinfo +1 -1
  119. package/package.json +30 -54
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/DragUtils.ts"],"names":["flatten","DragUtils","sourceList","selectedRanges","destinationList","destinationIndex","insertIndex","adjustDestinationIndex","draggedItems","removeItems","splice","list","ranges","items","sortedRanges","map","range","index","sort","a","b","i","length","start","end","adjustedIndex","Math","min","document","documentElement","classList","add","remove"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,OAAP,MAAoB,gBAApB;;IAIMC,S;;;;;;;;AACJ;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACE,qBACEC,UADF,EAEEC,cAFF,EAGEC,eAHF,EAIEC,gBAJF,EAKO;AACL,UAAMC,WAAW,GACfJ,UAAU,KAAKE,eAAf,GACIH,SAAS,CAACM,sBAAV,CAAiCF,gBAAjC,EAAmDF,cAAnD,CADJ,GAEIE,gBAHN;AAIA,UAAMG,YAAY,GAAGP,SAAS,CAACQ,WAAV,CAAsBP,UAAtB,EAAkCC,cAAlC,CAArB;AACAC,MAAAA,eAAe,CAACM,MAAhB,OAAAN,eAAe,GAAQE,WAAR,EAAqB,CAArB,4BAA2BE,YAA3B,GAAf;AACA,aAAOA,YAAP;AACD;AAED;AACF;AACA;AACA;AACA;AACA;;;;WACE,qBAAsBG,IAAtB,EAAiCC,MAAjC,EAAuD;AACrD,UAAMC,KAAK,GAAG,EAAd,CADqD,CAGrD;;AACA,UAAMC,YAAY,GAAGF,MAAM,CACxBG,GADkB,CACd,UAACC,KAAD,EAAQC,KAAR;AAAA,eAAmB;AAAED,UAAAA,KAAK,EAALA,KAAF;AAASC,UAAAA,KAAK,EAALA;AAAT,SAAnB;AAAA,OADc,EAElBC,IAFkB,CAEb,UAACC,CAAD,EAAIC,CAAJ;AAAA,eAAUA,CAAC,CAACJ,KAAF,CAAQ,CAAR,IAAaG,CAAC,CAACH,KAAF,CAAQ,CAAR,CAAvB;AAAA,OAFa,CAArB;;AAGA,WAAK,IAAIK,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGP,YAAY,CAACQ,MAAjC,EAAyCD,CAAC,IAAI,CAA9C,EAAiD;AAC/C,8BAAyBP,YAAY,CAACO,CAAD,CAArC;AAAA,YAAQL,KAAR,mBAAQA,KAAR;AAAA,YAAeC,KAAf,mBAAeA,KAAf;;AACA,oCAAqBD,KAArB;AAAA,YAAOO,KAAP;AAAA,YAAcC,GAAd;;AACAX,QAAAA,KAAK,CAACI,KAAD,CAAL,GAAeN,IAAI,CAACD,MAAL,CAAYa,KAAZ,EAAmBC,GAAG,GAAGD,KAAN,GAAc,CAAjC,CAAf;AACD;;AAED,aAAOvB,OAAO,CAACa,KAAD,CAAd;AACD;AAED;AACF;AACA;AACA;AACA;AACA;;;;WACE,gCACER,gBADF,EAEEO,MAFF,EAGU;AACR,UAAIa,aAAa,GAAGpB,gBAApB;;AACA,WAAK,IAAIgB,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGT,MAAM,CAACU,MAA3B,EAAmCD,CAAC,IAAI,CAAxC,EAA2C;AACzC,uCAAqBT,MAAM,CAACS,CAAD,CAA3B;AAAA,YAAOE,KAAP;AAAA,YAAcC,GAAd;;AACA,YAAID,KAAK,GAAGlB,gBAAZ,EAA8B;AAC5B;AACD;;AAEDoB,QAAAA,aAAa,IAAIC,IAAI,CAACC,GAAL,CAASH,GAAT,EAAcnB,gBAAgB,GAAG,CAAjC,IAAsCkB,KAAtC,GAA8C,CAA/D;AACD;;AACD,aAAOE,aAAP;AACD;;;WAED,yBAA6B;AAC3BG,MAAAA,QAAQ,CAACC,eAAT,CAAyBC,SAAzB,CAAmCC,GAAnC,CAAuC,0BAAvC;AACD;;;WAED,wBAA4B;AAC1BH,MAAAA,QAAQ,CAACC,eAAT,CAAyBC,SAAzB,CAAmCE,MAAnC,CAA0C,0BAA1C;AACD;;;;;;AAGH,eAAe/B,SAAf","sourcesContent":["import flatten from 'lodash.flatten';\n\ntype Range = [number, number];\n\nclass DragUtils {\n /**\n * Re-orders the provided item lists in place based on the selectedRanges and destinationIndex provided\n * @param sourceList Array of the source items\n * @param selectedRanges Array of the selected ranges in the source list\n * @param destinationList Destination items. If dragging within the same list, set it to sourceItems\n * @param destinationIndex The index items are being dropped in the destinationList, adjusted for the removed items\n * @returns The items that were dragged\n */\n static reorder<T>(\n sourceList: T[],\n selectedRanges: Range[],\n destinationList: T[],\n destinationIndex: number\n ): T[] {\n const insertIndex =\n sourceList === destinationList\n ? DragUtils.adjustDestinationIndex(destinationIndex, selectedRanges)\n : destinationIndex;\n const draggedItems = DragUtils.removeItems(sourceList, selectedRanges);\n destinationList.splice(insertIndex, 0, ...draggedItems);\n return draggedItems;\n }\n\n /**\n * Removes the provided ranges from the list in place\n * @param list Array of items to remove the ranges.\n * @param ranges Array of the ranges to remove.\n * @returns The removed items, in the order of the ranges removed.\n */\n static removeItems<T>(list: T[], ranges: Range[]): T[] {\n const items = [];\n\n // Sort them in reverse, so we don't screw up the range indexes\n const sortedRanges = ranges\n .map((range, index) => ({ range, index }))\n .sort((a, b) => b.range[0] - a.range[0]);\n for (let i = 0; i < sortedRanges.length; i += 1) {\n const { range, index } = sortedRanges[i];\n const [start, end] = range;\n items[index] = list.splice(start, end - start + 1);\n }\n\n return flatten(items);\n }\n\n /**\n * Adjusts the destination index for when dropping into the same list you're dragging from.\n * @param destinationIndex The original destination index\n * @param ranges The ranges that are moving\n * @returns Index where item should be inserted after all ranges are removed\n */\n static adjustDestinationIndex(\n destinationIndex: number,\n ranges: Range[]\n ): number {\n let adjustedIndex = destinationIndex;\n for (let i = 0; i < ranges.length; i += 1) {\n const [start, end] = ranges[i];\n if (start > destinationIndex) {\n break;\n }\n\n adjustedIndex -= Math.min(end, destinationIndex - 1) - start + 1;\n }\n return adjustedIndex;\n }\n\n static startDragging(): void {\n document.documentElement.classList.add('drag-pointer-events-none');\n }\n\n static stopDragging(): void {\n document.documentElement.classList.remove('drag-pointer-events-none');\n }\n}\n\nexport default DragUtils;\n"],"file":"DragUtils.js"}
1
+ {"version":3,"sources":["../src/DragUtils.ts"],"names":["flatten","DragUtils","reorder","sourceList","selectedRanges","destinationList","destinationIndex","insertIndex","adjustDestinationIndex","draggedItems","removeItems","splice","list","ranges","items","sortedRanges","map","range","index","sort","a","b","i","length","start","end","adjustedIndex","Math","min","startDragging","document","documentElement","classList","add","stopDragging","remove"],"mappings":"AAAA,OAAOA,OAAP,MAAoB,gBAApB;;AAIA,MAAMC,SAAN,CAAgB;AACd;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACgB,SAAPC,OAAO,CACZC,UADY,EAEZC,cAFY,EAGZC,eAHY,EAIZC,gBAJY,EAKP;AACL,QAAMC,WAAW,GACfJ,UAAU,KAAKE,eAAf,GACIJ,SAAS,CAACO,sBAAV,CAAiCF,gBAAjC,EAAmDF,cAAnD,CADJ,GAEIE,gBAHN;AAIA,QAAMG,YAAY,GAAGR,SAAS,CAACS,WAAV,CAAsBP,UAAtB,EAAkCC,cAAlC,CAArB;AACAC,IAAAA,eAAe,CAACM,MAAhB,CAAuBJ,WAAvB,EAAoC,CAApC,EAAuC,GAAGE,YAA1C;AACA,WAAOA,YAAP;AACD;AAED;AACF;AACA;AACA;AACA;AACA;;;AACoB,SAAXC,WAAW,CAAIE,IAAJ,EAAeC,MAAf,EAAqC;AACrD,QAAMC,KAAK,GAAG,EAAd,CADqD,CAGrD;;AACA,QAAMC,YAAY,GAAGF,MAAM,CACxBG,GADkB,CACd,CAACC,KAAD,EAAQC,KAAR,MAAmB;AAAED,MAAAA,KAAF;AAASC,MAAAA;AAAT,KAAnB,CADc,EAElBC,IAFkB,CAEb,CAACC,CAAD,EAAIC,CAAJ,KAAUA,CAAC,CAACJ,KAAF,CAAQ,CAAR,IAAaG,CAAC,CAACH,KAAF,CAAQ,CAAR,CAFV,CAArB;;AAGA,SAAK,IAAIK,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGP,YAAY,CAACQ,MAAjC,EAAyCD,CAAC,IAAI,CAA9C,EAAiD;AAC/C,UAAM;AAAEL,QAAAA,KAAF;AAASC,QAAAA;AAAT,UAAmBH,YAAY,CAACO,CAAD,CAArC;AACA,UAAM,CAACE,KAAD,EAAQC,GAAR,IAAeR,KAArB;AACAH,MAAAA,KAAK,CAACI,KAAD,CAAL,GAAeN,IAAI,CAACD,MAAL,CAAYa,KAAZ,EAAmBC,GAAG,GAAGD,KAAN,GAAc,CAAjC,CAAf;AACD;;AAED,WAAOxB,OAAO,CAACc,KAAD,CAAd;AACD;AAED;AACF;AACA;AACA;AACA;AACA;;;AAC+B,SAAtBN,sBAAsB,CAC3BF,gBAD2B,EAE3BO,MAF2B,EAGnB;AACR,QAAIa,aAAa,GAAGpB,gBAApB;;AACA,SAAK,IAAIgB,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGT,MAAM,CAACU,MAA3B,EAAmCD,CAAC,IAAI,CAAxC,EAA2C;AACzC,UAAM,CAACE,KAAD,EAAQC,GAAR,IAAeZ,MAAM,CAACS,CAAD,CAA3B;;AACA,UAAIE,KAAK,GAAGlB,gBAAZ,EAA8B;AAC5B;AACD;;AAEDoB,MAAAA,aAAa,IAAIC,IAAI,CAACC,GAAL,CAASH,GAAT,EAAcnB,gBAAgB,GAAG,CAAjC,IAAsCkB,KAAtC,GAA8C,CAA/D;AACD;;AACD,WAAOE,aAAP;AACD;;AAEmB,SAAbG,aAAa,GAAS;AAC3BC,IAAAA,QAAQ,CAACC,eAAT,CAAyBC,SAAzB,CAAmCC,GAAnC,CAAuC,0BAAvC;AACD;;AAEkB,SAAZC,YAAY,GAAS;AAC1BJ,IAAAA,QAAQ,CAACC,eAAT,CAAyBC,SAAzB,CAAmCG,MAAnC,CAA0C,0BAA1C;AACD;;AA1Ea;;AA6EhB,eAAelC,SAAf","sourcesContent":["import flatten from 'lodash.flatten';\n\ntype Range = [number, number];\n\nclass DragUtils {\n /**\n * Re-orders the provided item lists in place based on the selectedRanges and destinationIndex provided\n * @param sourceList Array of the source items\n * @param selectedRanges Array of the selected ranges in the source list\n * @param destinationList Destination items. If dragging within the same list, set it to sourceItems\n * @param destinationIndex The index items are being dropped in the destinationList, adjusted for the removed items\n * @returns The items that were dragged\n */\n static reorder<T>(\n sourceList: T[],\n selectedRanges: Range[],\n destinationList: T[],\n destinationIndex: number\n ): T[] {\n const insertIndex =\n sourceList === destinationList\n ? DragUtils.adjustDestinationIndex(destinationIndex, selectedRanges)\n : destinationIndex;\n const draggedItems = DragUtils.removeItems(sourceList, selectedRanges);\n destinationList.splice(insertIndex, 0, ...draggedItems);\n return draggedItems;\n }\n\n /**\n * Removes the provided ranges from the list in place\n * @param list Array of items to remove the ranges.\n * @param ranges Array of the ranges to remove.\n * @returns The removed items, in the order of the ranges removed.\n */\n static removeItems<T>(list: T[], ranges: Range[]): T[] {\n const items = [];\n\n // Sort them in reverse, so we don't screw up the range indexes\n const sortedRanges = ranges\n .map((range, index) => ({ range, index }))\n .sort((a, b) => b.range[0] - a.range[0]);\n for (let i = 0; i < sortedRanges.length; i += 1) {\n const { range, index } = sortedRanges[i];\n const [start, end] = range;\n items[index] = list.splice(start, end - start + 1);\n }\n\n return flatten(items);\n }\n\n /**\n * Adjusts the destination index for when dropping into the same list you're dragging from.\n * @param destinationIndex The original destination index\n * @param ranges The ranges that are moving\n * @returns Index where item should be inserted after all ranges are removed\n */\n static adjustDestinationIndex(\n destinationIndex: number,\n ranges: Range[]\n ): number {\n let adjustedIndex = destinationIndex;\n for (let i = 0; i < ranges.length; i += 1) {\n const [start, end] = ranges[i];\n if (start > destinationIndex) {\n break;\n }\n\n adjustedIndex -= Math.min(end, destinationIndex - 1) - start + 1;\n }\n return adjustedIndex;\n }\n\n static startDragging(): void {\n document.documentElement.classList.add('drag-pointer-events-none');\n }\n\n static stopDragging(): void {\n document.documentElement.classList.remove('drag-pointer-events-none');\n }\n}\n\nexport default DragUtils;\n"],"file":"DragUtils.js"}
@@ -37,6 +37,7 @@ declare class DraggableItemList<T> extends PureComponent<DraggableItemListProps<
37
37
  offset: number;
38
38
  items: never[];
39
39
  rowHeight: number;
40
+ isDeselectOnClick: boolean;
40
41
  isDoubleClickSelect: boolean;
41
42
  isDropDisabled: boolean;
42
43
  isDragDisabled: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"DraggableItemList.d.ts","sourceRoot":"","sources":["../src/DraggableItemList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE7C,OAAO,OAAO,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAwB,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAGhF,OAAO,EAAc,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,QAAQ,EAAE,EACf,eAAe,EACf,eAAe,EACf,aAAa,EACd,MAAM,YAAY,CAAC;AAEpB,OAAO,0BAA0B,CAAC;AAElC,oBAAY,wBAAwB,CAAC,CAAC,IAAI,eAAe,CAAC,CAAC,CAAC,GAAG;IAC7D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,aAAK,qBAAqB,CAAC,CAAC,IAAI,CAC9B,KAAK,EAAE,wBAAwB,CAAC,CAAC,CAAC,KAC/B,KAAK,CAAC,SAAS,CAAC;AAErB,aAAK,sBAAsB,CAAC,CAAC,IAAI,IAAI,CACnC,aAAa,CAAC,CAAC,CAAC,EAChB,eAAe,GAAG,eAAe,GAAG,cAAc,CACnD,GAAG;IACF,SAAS,EAAE,MAAM,CAAC;IAClB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,cAAc,EAAE,OAAO,CAAC;IAExB,cAAc,EAAE,OAAO,CAAC;IAExB,UAAU,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAC;IACrC,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC;IAG3B,eAAe,EAAE,MAAM,CAAC;IAExB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,aAAK,sBAAsB,GAAG;IAC5B,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;;;;GAMG;AACH,cAAM,iBAAiB,CAAC,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;IAEF,MAAM,IAAI,GAAG,CAAC,OAAO;CA4EtB;AAED,eAAe,iBAAiB,CAAC"}
@@ -1,27 +1,5 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
2
-
3
1
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
2
 
5
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
-
7
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
8
-
9
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
10
-
11
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
12
-
13
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
14
-
15
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
16
-
17
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
18
-
19
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
20
-
21
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
22
-
23
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
24
-
25
3
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
26
4
 
27
5
  import React, { PureComponent } from 'react';
@@ -31,8 +9,8 @@ import { Draggable, Droppable } from 'react-beautiful-dnd';
31
9
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
32
10
  import { vsGripper } from '@deephaven/icons';
33
11
  import { RangeUtils } from '@deephaven/utils';
34
- import ItemList from './ItemList';
35
- import { Tooltip } from './popper';
12
+ import ItemList from "./ItemList.js";
13
+ import { Tooltip } from "./popper/index.js";
36
14
  import "./DraggableItemList.css";
37
15
 
38
16
  /**
@@ -42,250 +20,228 @@ import "./DraggableItemList.css";
42
20
  * One caveat with the use of react-beautiful-dnd is that it doesn't allow a drag to be initiated while
43
21
  * using a modifier key: https://github.com/atlassian/react-beautiful-dnd/issues/1678
44
22
  */
45
- var DraggableItemList = /*#__PURE__*/function (_PureComponent) {
46
- _inherits(DraggableItemList, _PureComponent);
47
-
48
- var _super = _createSuper(DraggableItemList);
49
-
50
- function DraggableItemList(props) {
51
- var _this;
52
-
53
- _classCallCheck(this, DraggableItemList);
54
-
55
- _this = _super.call(this, props);
56
-
57
- _defineProperty(_assertThisInitialized(_this), "itemList", void 0);
58
-
59
- _defineProperty(_assertThisInitialized(_this), "getCachedDraggableItem", memoize(function (draggablePrefix, renderItem, item, itemIndex, isFocused, isSelected, isDragDisabled, style) {
60
- return /*#__PURE__*/React.createElement(Draggable, {
61
- key: itemIndex,
62
- draggableId: DraggableItemList.getDraggableId(draggablePrefix, itemIndex),
63
- index: itemIndex,
64
- isDragDisabled: isDragDisabled
65
- }, function (provided) {
66
- return /*#__PURE__*/React.createElement("div", _extends({
67
- role: "menuitem",
68
- className: "draggable-item-list-item",
69
- ref: provided.innerRef,
70
- tabIndex: -1 // eslint-disable-next-line react/jsx-props-no-spreading
71
-
72
- }, provided.draggableProps, provided.dragHandleProps), renderItem({
73
- item: item,
74
- itemIndex: itemIndex,
75
- isFocused: isFocused,
76
- isSelected: isSelected,
77
- style: style,
78
- isClone: false
79
- }));
80
- });
81
- }, {
23
+ class DraggableItemList extends PureComponent {
24
+ static renderHandle() {
25
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Tooltip, null, "Drag to re-order"), /*#__PURE__*/React.createElement(FontAwesomeIcon, {
26
+ icon: vsGripper
27
+ }));
28
+ }
29
+
30
+ static renderBadge(_ref) {
31
+ var {
32
+ text
33
+ } = _ref;
34
+ return text ? /*#__PURE__*/React.createElement("span", {
35
+ className: "number-badge"
36
+ }, text) : null;
37
+ }
38
+
39
+ static renderTextItem(_ref2) {
40
+ var {
41
+ text,
42
+ badgeText = '',
43
+ className = ''
44
+ } = _ref2;
45
+ return /*#__PURE__*/React.createElement("div", {
46
+ className: classNames('item-list-item-content', 'draggable-item-list-item-content', className)
47
+ }, /*#__PURE__*/React.createElement("span", {
48
+ className: "title"
49
+ }, text), DraggableItemList.renderBadge({
50
+ text: badgeText
51
+ }), DraggableItemList.renderHandle());
52
+ }
53
+
54
+ static renderItem(_ref3) {
55
+ var {
56
+ item,
57
+ isClone,
58
+ selectedCount
59
+ } = _ref3;
60
+ var text = item && (item.displayValue || item.value || "".concat(item));
61
+ var badgeText = isClone ? "".concat(selectedCount) : '';
62
+ var className = isClone ? 'item-list-item-clone' : '';
63
+ return DraggableItemList.renderTextItem({
64
+ text,
65
+ badgeText,
66
+ className
67
+ });
68
+ }
69
+
70
+ static getDraggableId(draggablePrefix, itemIndex) {
71
+ return "".concat(draggablePrefix, "/").concat(itemIndex);
72
+ }
73
+
74
+ static getDraggableIndex(draggableId) {
75
+ return parseInt(draggableId.split('/').pop() || '', 10);
76
+ }
77
+
78
+ constructor(props) {
79
+ super(props);
80
+
81
+ _defineProperty(this, "itemList", void 0);
82
+
83
+ _defineProperty(this, "getCachedDraggableItem", memoize((draggablePrefix, renderItem, item, itemIndex, isFocused, isSelected, isDragDisabled, style) => /*#__PURE__*/React.createElement(Draggable, {
84
+ key: itemIndex,
85
+ draggableId: DraggableItemList.getDraggableId(draggablePrefix, itemIndex),
86
+ index: itemIndex,
87
+ isDragDisabled: isDragDisabled
88
+ }, provided => /*#__PURE__*/React.createElement("div", _extends({
89
+ role: "menuitem",
90
+ className: "draggable-item-list-item",
91
+ ref: provided.innerRef,
92
+ tabIndex: -1 // eslint-disable-next-line react/jsx-props-no-spreading
93
+
94
+ }, provided.draggableProps, provided.dragHandleProps), renderItem({
95
+ item,
96
+ itemIndex,
97
+ isFocused,
98
+ isSelected,
99
+ style,
100
+ isClone: false
101
+ }))), {
82
102
  max: ItemList.CACHE_SIZE
83
103
  }));
84
104
 
85
- _defineProperty(_assertThisInitialized(_this), "getCachedRenderDraggableItem", memoize(function (draggablePrefix, isDragDisabled, renderItem) {
86
- return function (_ref) {
87
- var item = _ref.item,
88
- itemIndex = _ref.itemIndex,
89
- isFocused = _ref.isFocused,
90
- isSelected = _ref.isSelected,
91
- style = _ref.style;
92
- return _this.getCachedDraggableItem(draggablePrefix, renderItem, item, itemIndex, isFocused, isSelected, isDragDisabled, style);
93
- };
105
+ _defineProperty(this, "getCachedRenderDraggableItem", memoize((draggablePrefix, isDragDisabled, renderItem) => (_ref4) => {
106
+ var {
107
+ item,
108
+ itemIndex,
109
+ isFocused,
110
+ isSelected,
111
+ style
112
+ } = _ref4;
113
+ return this.getCachedDraggableItem(draggablePrefix, renderItem, item, itemIndex, isFocused, isSelected, isDragDisabled, style);
94
114
  }, {
95
115
  max: 1
96
116
  }));
97
117
 
98
- _defineProperty(_assertThisInitialized(_this), "getCachedRenderClone", memoize(function (draggingItemClassName, items, offset, renderItem) {
99
- return function (provided, snapshot, rubric) {
100
- var selectedCount = _this.state.selectedCount;
101
- var itemIndex = rubric.source.index;
102
- var item = items[itemIndex - offset];
103
- return /*#__PURE__*/React.createElement("div", _extends({
104
- className: classNames('draggable-item-list-dragging-item-container', draggingItemClassName) // eslint-disable-next-line react/jsx-props-no-spreading
105
-
106
- }, provided.draggableProps, provided.dragHandleProps, {
107
- ref: provided.innerRef
108
- }), /*#__PURE__*/React.createElement("div", {
109
- className: classNames('draggable-item-list-dragging-item', {
110
- 'two-dragged': selectedCount === 2
111
- }, {
112
- 'multiple-dragged': selectedCount > 2
113
- })
114
- }, renderItem({
115
- item: item,
116
- itemIndex: itemIndex,
117
- isFocused: false,
118
- isSelected: true,
119
- style: {},
120
- isClone: true,
121
- selectedCount: selectedCount
122
- })));
123
- };
118
+ _defineProperty(this, "getCachedRenderClone", memoize((draggingItemClassName, items, offset, renderItem) => (provided, snapshot, rubric) => {
119
+ var {
120
+ selectedCount
121
+ } = this.state;
122
+ var {
123
+ index: itemIndex
124
+ } = rubric.source;
125
+ var item = items[itemIndex - offset];
126
+ return /*#__PURE__*/React.createElement("div", _extends({
127
+ className: classNames('draggable-item-list-dragging-item-container', draggingItemClassName) // eslint-disable-next-line react/jsx-props-no-spreading
128
+
129
+ }, provided.draggableProps, provided.dragHandleProps, {
130
+ ref: provided.innerRef
131
+ }), /*#__PURE__*/React.createElement("div", {
132
+ className: classNames('draggable-item-list-dragging-item', {
133
+ 'two-dragged': selectedCount === 2
134
+ }, {
135
+ 'multiple-dragged': selectedCount > 2
136
+ })
137
+ }, renderItem({
138
+ item,
139
+ itemIndex,
140
+ isFocused: false,
141
+ isSelected: true,
142
+ style: {},
143
+ isClone: true,
144
+ selectedCount
145
+ })));
124
146
  }, {
125
147
  max: 1
126
148
  }));
127
149
 
128
- _this.handleSelectionChange = _this.handleSelectionChange.bind(_assertThisInitialized(_this));
129
- _this.itemList = /*#__PURE__*/React.createRef();
130
- _this.state = {
150
+ this.handleSelectionChange = this.handleSelectionChange.bind(this);
151
+ this.itemList = /*#__PURE__*/React.createRef();
152
+ this.state = {
131
153
  selectedCount: 0
132
154
  };
133
- return _this;
134
155
  }
135
156
 
136
- _createClass(DraggableItemList, [{
137
- key: "selectItem",
138
- value: function selectItem(itemIndex) {
139
- var _this$itemList$curren;
140
-
141
- (_this$itemList$curren = this.itemList.current) === null || _this$itemList$curren === void 0 ? void 0 : _this$itemList$curren.selectItem(itemIndex);
142
- }
143
- }, {
144
- key: "focusItem",
145
- value: function focusItem(itemIndex) {
146
- var _this$itemList$curren2;
147
-
148
- (_this$itemList$curren2 = this.itemList.current) === null || _this$itemList$curren2 === void 0 ? void 0 : _this$itemList$curren2.focusItem(itemIndex);
149
- }
150
- }, {
151
- key: "scrollToItem",
152
- value: function scrollToItem(itemIndex) {
153
- var _this$itemList$curren3;
154
-
155
- (_this$itemList$curren3 = this.itemList.current) === null || _this$itemList$curren3 === void 0 ? void 0 : _this$itemList$curren3.scrollToItem(itemIndex);
156
- }
157
- }, {
158
- key: "handleSelectionChange",
159
- value: function handleSelectionChange(selectedRanges) {
160
- this.setState({
161
- selectedCount: RangeUtils.count(selectedRanges)
162
- });
163
- var onSelectionChange = this.props.onSelectionChange;
164
- onSelectionChange(selectedRanges);
165
- }
166
- }, {
167
- key: "render",
168
- value: function render() {
169
- var _this2 = this;
170
-
171
- var _this$props = this.props,
172
- className = _this$props.className,
173
- draggablePrefix = _this$props.draggablePrefix,
174
- draggingItemClassName = _this$props.draggingItemClassName,
175
- droppableId = _this$props.droppableId,
176
- isDoubleClickSelect = _this$props.isDoubleClickSelect,
177
- isDragDisabled = _this$props.isDragDisabled,
178
- isDropDisabled = _this$props.isDropDisabled,
179
- isMultiSelect = _this$props.isMultiSelect,
180
- isStickyBottom = _this$props.isStickyBottom,
181
- itemCount = _this$props.itemCount,
182
- items = _this$props.items,
183
- offset = _this$props.offset,
184
- onFocusChange = _this$props.onFocusChange,
185
- onSelect = _this$props.onSelect,
186
- onViewportChange = _this$props.onViewportChange,
187
- renderItem = _this$props.renderItem,
188
- rowHeight = _this$props.rowHeight,
189
- selectedRanges = _this$props.selectedRanges,
190
- style = _this$props.style;
191
- return /*#__PURE__*/React.createElement(Droppable, {
192
- isDropDisabled: isDropDisabled,
193
- droppableId: droppableId,
194
- mode: "virtual",
195
- renderClone: this.getCachedRenderClone(draggingItemClassName, items, offset, renderItem)
196
- }, function (provided, snapshot) {
197
- return /*#__PURE__*/React.createElement("div", _extends({
198
- role: "menu",
199
- className: classNames('draggable-item-list', className, {
200
- 'is-drop-disabled': isDropDisabled,
201
- 'is-drag-disabled': isDragDisabled,
202
- 'is-dragging-from-this': snapshot.draggingFromThisWith,
203
- 'is-dragging-over': snapshot.isDraggingOver,
204
- 'is-dropping': snapshot.draggingOverWith
205
- }),
206
- style: style,
207
- ref: provided.innerRef // eslint-disable-next-line react/jsx-props-no-spreading
208
-
209
- }, provided.droppableProps), /*#__PURE__*/React.createElement(ItemList, {
210
- focusSelector: ".draggable-item-list-item",
211
- isDoubleClickSelect: isDoubleClickSelect,
212
- isDragSelect: false,
213
- isMultiSelect: isMultiSelect,
214
- isStickyBottom: isStickyBottom,
215
- itemCount: itemCount,
216
- items: items,
217
- onFocusChange: onFocusChange,
218
- onSelect: onSelect,
219
- onSelectionChange: _this2.handleSelectionChange,
220
- onViewportChange: onViewportChange,
221
- offset: offset,
222
- ref: _this2.itemList,
223
- renderItem: _this2.getCachedRenderDraggableItem(draggablePrefix, isDragDisabled, renderItem),
224
- rowHeight: rowHeight,
225
- selectedRanges: selectedRanges
226
- }));
227
- });
228
- }
229
- }], [{
230
- key: "renderHandle",
231
- value: function renderHandle() {
232
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Tooltip, null, "Drag to re-order"), /*#__PURE__*/React.createElement(FontAwesomeIcon, {
233
- icon: vsGripper
234
- }));
235
- }
236
- }, {
237
- key: "renderBadge",
238
- value: function renderBadge(_ref2) {
239
- var text = _ref2.text;
240
- return text ? /*#__PURE__*/React.createElement("span", {
241
- className: "number-badge"
242
- }, text) : null;
243
- }
244
- }, {
245
- key: "renderTextItem",
246
- value: function renderTextItem(_ref3) {
247
- var text = _ref3.text,
248
- _ref3$badgeText = _ref3.badgeText,
249
- badgeText = _ref3$badgeText === void 0 ? '' : _ref3$badgeText,
250
- _ref3$className = _ref3.className,
251
- className = _ref3$className === void 0 ? '' : _ref3$className;
252
- return /*#__PURE__*/React.createElement("div", {
253
- className: classNames('item-list-item-content', 'draggable-item-list-item-content', className)
254
- }, /*#__PURE__*/React.createElement("span", {
255
- className: "title"
256
- }, text), DraggableItemList.renderBadge({
257
- text: badgeText
258
- }), DraggableItemList.renderHandle());
259
- }
260
- }, {
261
- key: "renderItem",
262
- value: function renderItem(_ref4) {
263
- var item = _ref4.item,
264
- isClone = _ref4.isClone,
265
- selectedCount = _ref4.selectedCount;
266
- var text = item && (item.displayValue || item.value || "".concat(item));
267
- var badgeText = isClone ? "".concat(selectedCount) : '';
268
- var className = isClone ? 'item-list-item-clone' : '';
269
- return DraggableItemList.renderTextItem({
270
- text: text,
271
- badgeText: badgeText,
272
- className: className
273
- });
274
- }
275
- }, {
276
- key: "getDraggableId",
277
- value: function getDraggableId(draggablePrefix, itemIndex) {
278
- return "".concat(draggablePrefix, "/").concat(itemIndex);
279
- }
280
- }, {
281
- key: "getDraggableIndex",
282
- value: function getDraggableIndex(draggableId) {
283
- return parseInt(draggableId.split('/').pop() || '', 10);
284
- }
285
- }]);
286
-
287
- return DraggableItemList;
288
- }(PureComponent);
157
+ selectItem(itemIndex) {
158
+ var _this$itemList$curren;
159
+
160
+ (_this$itemList$curren = this.itemList.current) === null || _this$itemList$curren === void 0 ? void 0 : _this$itemList$curren.selectItem(itemIndex);
161
+ }
162
+
163
+ focusItem(itemIndex) {
164
+ var _this$itemList$curren2;
165
+
166
+ (_this$itemList$curren2 = this.itemList.current) === null || _this$itemList$curren2 === void 0 ? void 0 : _this$itemList$curren2.focusItem(itemIndex);
167
+ }
168
+
169
+ scrollToItem(itemIndex) {
170
+ var _this$itemList$curren3;
171
+
172
+ (_this$itemList$curren3 = this.itemList.current) === null || _this$itemList$curren3 === void 0 ? void 0 : _this$itemList$curren3.scrollToItem(itemIndex);
173
+ }
174
+
175
+ handleSelectionChange(selectedRanges) {
176
+ this.setState({
177
+ selectedCount: RangeUtils.count(selectedRanges)
178
+ });
179
+ var {
180
+ onSelectionChange
181
+ } = this.props;
182
+ onSelectionChange(selectedRanges);
183
+ }
184
+
185
+ render() {
186
+ var {
187
+ className,
188
+ draggablePrefix,
189
+ draggingItemClassName,
190
+ droppableId,
191
+ isDoubleClickSelect,
192
+ isDragDisabled,
193
+ isDropDisabled,
194
+ isMultiSelect,
195
+ isStickyBottom,
196
+ itemCount,
197
+ items,
198
+ offset,
199
+ onFocusChange,
200
+ onSelect,
201
+ onViewportChange,
202
+ renderItem,
203
+ rowHeight,
204
+ selectedRanges,
205
+ style
206
+ } = this.props;
207
+ return /*#__PURE__*/React.createElement(Droppable, {
208
+ isDropDisabled: isDropDisabled,
209
+ droppableId: droppableId,
210
+ mode: "virtual",
211
+ renderClone: this.getCachedRenderClone(draggingItemClassName, items, offset, renderItem)
212
+ }, (provided, snapshot) => /*#__PURE__*/React.createElement("div", _extends({
213
+ role: "menu",
214
+ className: classNames('draggable-item-list', className, {
215
+ 'is-drop-disabled': isDropDisabled,
216
+ 'is-drag-disabled': isDragDisabled,
217
+ 'is-dragging-from-this': snapshot.draggingFromThisWith,
218
+ 'is-dragging-over': snapshot.isDraggingOver,
219
+ 'is-dropping': snapshot.draggingOverWith
220
+ }),
221
+ style: style,
222
+ ref: provided.innerRef // eslint-disable-next-line react/jsx-props-no-spreading
223
+
224
+ }, provided.droppableProps), /*#__PURE__*/React.createElement(ItemList, {
225
+ focusSelector: ".draggable-item-list-item",
226
+ isDoubleClickSelect: isDoubleClickSelect,
227
+ isDragSelect: false,
228
+ isMultiSelect: isMultiSelect,
229
+ isStickyBottom: isStickyBottom,
230
+ itemCount: itemCount,
231
+ items: items,
232
+ onFocusChange: onFocusChange,
233
+ onSelect: onSelect,
234
+ onSelectionChange: this.handleSelectionChange,
235
+ onViewportChange: onViewportChange,
236
+ offset: offset,
237
+ ref: this.itemList,
238
+ renderItem: this.getCachedRenderDraggableItem(draggablePrefix, isDragDisabled, renderItem),
239
+ rowHeight: rowHeight,
240
+ selectedRanges: selectedRanges
241
+ })));
242
+ }
243
+
244
+ }
289
245
 
290
246
  _defineProperty(DraggableItemList, "DEFAULT_ROW_HEIGHT", 30);
291
247
 
@@ -295,6 +251,7 @@ _defineProperty(DraggableItemList, "defaultProps", {
295
251
  offset: 0,
296
252
  items: [],
297
253
  rowHeight: DraggableItemList.DEFAULT_ROW_HEIGHT,
254
+ isDeselectOnClick: true,
298
255
  isDoubleClickSelect: true,
299
256
  isDropDisabled: false,
300
257
  isDragDisabled: false,
@@ -302,14 +259,19 @@ _defineProperty(DraggableItemList, "defaultProps", {
302
259
  isStickyBottom: false,
303
260
  disableSelect: false,
304
261
  style: null,
305
- onFocusChange: function onFocusChange() {// no-op
262
+
263
+ onFocusChange() {// no-op
306
264
  },
307
- onSelect: function onSelect() {// no-op
265
+
266
+ onSelect() {// no-op
308
267
  },
309
- onSelectionChange: function onSelectionChange() {// no-op
268
+
269
+ onSelectionChange() {// no-op
310
270
  },
311
- onViewportChange: function onViewportChange() {// no-op
271
+
272
+ onViewportChange() {// no-op
312
273
  },
274
+
313
275
  renderItem: DraggableItemList.renderItem,
314
276
  selectedRanges: [],
315
277
  draggablePrefix: 'draggable-item',