@deephaven/components 0.19.2-beta.0 → 0.19.2-beta.5

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 (74) hide show
  1. package/dist/AutoCompleteInput.d.ts.map +1 -1
  2. package/dist/AutoCompleteInput.js +7 -11
  3. package/dist/AutoCompleteInput.js.map +1 -1
  4. package/dist/BasicModal.d.ts.map +1 -1
  5. package/dist/BasicModal.js +5 -7
  6. package/dist/BasicModal.js.map +1 -1
  7. package/dist/Button.d.ts +9 -3
  8. package/dist/Button.d.ts.map +1 -1
  9. package/dist/Button.js +18 -10
  10. package/dist/Button.js.map +1 -1
  11. package/dist/CardFlip.js +1 -1
  12. package/dist/CardFlip.js.map +1 -1
  13. package/dist/Collapse.js +2 -2
  14. package/dist/Collapse.js.map +1 -1
  15. package/dist/ComboBox.d.ts.map +1 -1
  16. package/dist/ComboBox.js +11 -15
  17. package/dist/ComboBox.js.map +1 -1
  18. package/dist/CustomTimeSelect.js +2 -2
  19. package/dist/CustomTimeSelect.js.map +1 -1
  20. package/dist/DraggableItemList.d.ts +1 -1
  21. package/dist/DraggableItemList.d.ts.map +1 -1
  22. package/dist/DraggableItemList.js +10 -7
  23. package/dist/DraggableItemList.js.map +1 -1
  24. package/dist/HierarchicalCheckboxMenu.d.ts.map +1 -1
  25. package/dist/HierarchicalCheckboxMenu.js +9 -6
  26. package/dist/HierarchicalCheckboxMenu.js.map +1 -1
  27. package/dist/ItemList.js +19 -17
  28. package/dist/ItemList.js.map +1 -1
  29. package/dist/LoadingOverlay.js +1 -1
  30. package/dist/LoadingOverlay.js.map +1 -1
  31. package/dist/MaskedInput.js +3 -1
  32. package/dist/MaskedInput.js.map +1 -1
  33. package/dist/RadioGroup.js +12 -8
  34. package/dist/RadioGroup.js.map +1 -1
  35. package/dist/SocketedButton.d.ts.map +1 -1
  36. package/dist/SocketedButton.js +1 -1
  37. package/dist/SocketedButton.js.map +1 -1
  38. package/dist/TimeSlider.d.ts.map +1 -1
  39. package/dist/TimeSlider.js +2 -2
  40. package/dist/TimeSlider.js.map +1 -1
  41. package/dist/ValidateLabelInput.d.ts.map +1 -1
  42. package/dist/ValidateLabelInput.js +2 -2
  43. package/dist/ValidateLabelInput.js.map +1 -1
  44. package/dist/context-actions/ContextActionUtils.d.ts +3 -3
  45. package/dist/context-actions/ContextActionUtils.js +14 -8
  46. package/dist/context-actions/ContextActionUtils.js.map +1 -1
  47. package/dist/context-actions/ContextActions.d.ts.map +1 -1
  48. package/dist/context-actions/ContextActions.js +9 -16
  49. package/dist/context-actions/ContextActions.js.map +1 -1
  50. package/dist/context-actions/ContextMenu.d.ts.map +1 -1
  51. package/dist/context-actions/ContextMenu.js +11 -13
  52. package/dist/context-actions/ContextMenu.js.map +1 -1
  53. package/dist/context-actions/ContextMenuItem.d.ts.map +1 -1
  54. package/dist/context-actions/ContextMenuItem.js +8 -6
  55. package/dist/context-actions/ContextMenuItem.js.map +1 -1
  56. package/dist/context-actions/GlobalContextAction.d.ts.map +1 -1
  57. package/dist/context-actions/GlobalContextAction.js +7 -12
  58. package/dist/context-actions/GlobalContextAction.js.map +1 -1
  59. package/dist/context-actions/GlobalContextActions.js +1 -1
  60. package/dist/context-actions/GlobalContextActions.js.map +1 -1
  61. package/dist/menu-actions/DropdownMenu.js +1 -1
  62. package/dist/menu-actions/DropdownMenu.js.map +1 -1
  63. package/dist/menu-actions/Menu.d.ts.map +1 -1
  64. package/dist/menu-actions/Menu.js +3 -3
  65. package/dist/menu-actions/Menu.js.map +1 -1
  66. package/dist/navigation/MenuItem.js +2 -2
  67. package/dist/navigation/MenuItem.js.map +1 -1
  68. package/dist/navigation/Stack.d.ts.map +1 -1
  69. package/dist/navigation/Stack.js +2 -2
  70. package/dist/navigation/Stack.js.map +1 -1
  71. package/dist/popper/Tooltip.js +1 -1
  72. package/dist/popper/Tooltip.js.map +1 -1
  73. package/package.json +8 -8
  74. package/scss/BaseStyleSheet.scss +5 -0
@@ -1 +1 @@
1
- {"version":3,"file":"ContextActionUtils.js","names":["isPromise","value","then","undefined","ContextActionUtils","disableAllActions","actionsDisabled","enableAllActions","isContextActionEvent","e","Array","isArray","contextActions","compareActions","a","b","group","order","title","sortActions","actions","sortedActions","slice","sort","isMacPlatform","platform","window","navigator","startsWith","getModifierKey","isModifierKeyDown","event","modifierKey","copyToClipboard","text","clipboard","copyToClipboardExecCommand","Promise","resolve","writeText","catch","oldFocus","document","activeElement","textArea","createElement","body","appendChild","focus","select","execCommand","Error","removeChild","HTMLElement","getMenuItems","actionsParam","includePromises","menuItems","i","length","action","newMenuItems","push","concat","filter","menuElement","getNextMenuItem","startIndex","delta","firstIndex","menuIndex","item","disabled"],"sources":["../../src/context-actions/ContextActionUtils.ts"],"sourcesContent":["import { IconDefinition } from '@deephaven/icons';\nimport React from 'react';\nimport type { Shortcut } from '../shortcuts';\n\nexport type ResolvableContextAction =\n | ContextAction\n | Promise<ContextAction[]>\n | (() => Promise<ContextAction[]> | ContextAction[] | ContextAction);\n\nexport type MenuItem = ContextAction | Promise<ContextAction[]>;\n\nexport interface ContextAction {\n title?: string;\n description?: string;\n action?(event?: KeyboardEvent): void;\n actions?: ResolvableContextAction[];\n icon?: IconDefinition | React.ReactElement;\n iconColor?: string;\n shortcut?: Shortcut;\n isGlobal?: boolean;\n group?: number;\n order?: number;\n disabled?: boolean;\n menuElement?: React.ReactElement;\n iconOutline?: boolean;\n}\n\nexport interface ContextActionEvent extends MouseEvent {\n contextActions: ResolvableContextAction[];\n}\n\nexport function isPromise<A, T>(value: A | Promise<T>): value is Promise<T> {\n return (value as Promise<T>).then !== undefined;\n}\n\nclass ContextActionUtils {\n static actionsDisabled = false;\n\n static disableAllActions(): void {\n ContextActionUtils.actionsDisabled = true;\n }\n\n static enableAllActions(): void {\n ContextActionUtils.actionsDisabled = false;\n }\n\n static isContextActionEvent(e: MouseEvent): e is ContextActionEvent {\n return Array.isArray((e as ContextActionEvent).contextActions);\n }\n\n /**\n * Compare two action items. Useful in Array.sort\n * @param a First context action to compare\n * @param b Second context action to compare\n */\n static compareActions(a: ContextAction, b: ContextAction): number {\n if (a.group !== b.group) {\n return (a.group || 0) > (b.group || 0) ? 1 : -1;\n }\n\n if (a.order !== b.order) {\n return (a.order || 0) > (b.order || 0) ? 1 : -1;\n }\n\n if (a.title !== b.title) {\n return (a.title || '') > (b.title || '') ? 1 : -1;\n }\n\n if (a !== b) {\n return a > b ? 1 : -1;\n }\n\n return 0;\n }\n\n /**\n *\n * @param actions The array of actions to sort\n */\n static sortActions(actions: ContextAction[]): ContextAction[] {\n if (!actions || !Array.isArray(actions)) {\n return [];\n }\n\n const sortedActions = actions.slice();\n sortedActions.sort(ContextActionUtils.compareActions);\n return sortedActions;\n }\n\n static isMacPlatform(): boolean {\n const { platform } = window.navigator;\n return platform.startsWith('Mac');\n }\n\n /**\n * Retrieve the preferred modifier key based on the current platform\n */\n static getModifierKey(): 'metaKey' | 'ctrlKey' {\n if (ContextActionUtils.isMacPlatform()) {\n return 'metaKey';\n }\n\n return 'ctrlKey';\n }\n\n /**\n * Returns true if the modifier key for the current platform is down for the event (Ctrl for windows/linux, Command (meta) for mac)\n * @param event The event to get the meta key status from\n */\n static isModifierKeyDown(\n event: KeyboardEvent | MouseEvent | React.KeyboardEvent | React.MouseEvent\n ): boolean {\n const modifierKey = ContextActionUtils.getModifierKey();\n return event[modifierKey];\n }\n\n /**\n * Copy the passed in text to the clipboard.\n * @param text The text to copy\n * @returns Promise Resolved on success, rejected on failure\n */\n static copyToClipboard(text: string): Promise<void> {\n const { clipboard } = navigator;\n if (clipboard === undefined) {\n ContextActionUtils.copyToClipboardExecCommand(text);\n return Promise.resolve();\n }\n return navigator.clipboard.writeText(text).catch(() => {\n ContextActionUtils.copyToClipboardExecCommand(text);\n });\n }\n\n /**\n * Copy the passed in text to the clipboard using the `execCommand` functionality\n * Throws on error/failure\n * @param text The text to copy\n */\n static copyToClipboardExecCommand(text: string): void {\n const oldFocus = document.activeElement;\n const textArea = document.createElement('textarea');\n textArea.value = text;\n document.body.appendChild(textArea);\n textArea.focus();\n textArea.select();\n\n if (!document.execCommand('copy')) {\n throw new Error('Unable to execute copy command');\n }\n\n document.body.removeChild(textArea);\n\n if (oldFocus instanceof HTMLElement) {\n oldFocus.focus();\n }\n }\n\n /**\n * Returns the menu items for the provided context actions, or empty array if none found.\n * @param actionsParam The actions to get menu items for\n * @param includePromises Whether or not to include promises in the returned menu items\n */\n static getMenuItems(\n actionsParam: ResolvableContextAction | ResolvableContextAction[],\n includePromises?: true\n ): MenuItem[];\n\n // If ignoring promises, then the return type is narrowed\n static getMenuItems(\n actionsParam: ResolvableContextAction | ResolvableContextAction[],\n includePromises: false\n ): ContextAction[];\n\n static getMenuItems(\n actionsParam: ResolvableContextAction | ResolvableContextAction[],\n includePromises = true\n ): MenuItem[] {\n let menuItems: MenuItem[] = [];\n let actions = actionsParam;\n if (!Array.isArray(actions)) {\n actions = [actions];\n }\n\n for (let i = 0; i < actions.length; i += 1) {\n const action = actions[i];\n let newMenuItems:\n | ContextAction\n | ContextAction[]\n | Promise<ContextAction[]>;\n if (typeof action === 'function') {\n newMenuItems = action();\n } else {\n newMenuItems = action;\n }\n\n if (newMenuItems != null) {\n if (newMenuItems instanceof Promise) {\n if (includePromises) {\n menuItems.push(newMenuItems);\n }\n } else if (Array.isArray(newMenuItems)) {\n menuItems = menuItems.concat(newMenuItems);\n } else {\n menuItems.push(newMenuItems);\n }\n }\n }\n\n menuItems = menuItems.filter(\n action =>\n (action as ContextAction).title ||\n (action as Promise<ContextAction[]>).then ||\n (action as ContextAction).menuElement\n );\n\n return menuItems;\n }\n\n /**\n * Returns the index of the next menu item in a list that doesn't have a disabled=true prop\n * @param startIndex the starting position for the iteration\n * @param delta the direction of travel, -1 or 1\n * @param menuItems an array of menuItems\n */\n static getNextMenuItem(\n startIndex: number,\n delta: -1 | 1,\n menuItems: MenuItem[]\n ): number {\n let firstIndex = startIndex;\n if (firstIndex < 0 && delta < 0) {\n // if menu index is -1 and delta -1 manually set start point\n firstIndex = menuItems.length;\n }\n // find the next non disabled menu option, iterating the list only once\n for (let i = 1; i < menuItems.length + 1; i += 1) {\n const menuIndex =\n (firstIndex + delta * i + menuItems.length) % menuItems.length;\n const item = menuItems[menuIndex];\n if (!(item instanceof Promise) && item.disabled !== true) {\n return menuIndex;\n }\n }\n return startIndex;\n }\n}\n\nexport default ContextActionUtils;\n"],"mappings":";;AA+BA,OAAO,SAASA,SAAT,CAAyBC,KAAzB,EAAqE;EAC1E,OAAQA,KAAD,CAAsBC,IAAtB,KAA+BC,SAAtC;AACD;;AAED,MAAMC,kBAAN,CAAyB;EAGC,OAAjBC,iBAAiB,GAAS;IAC/BD,kBAAkB,CAACE,eAAnB,GAAqC,IAArC;EACD;;EAEsB,OAAhBC,gBAAgB,GAAS;IAC9BH,kBAAkB,CAACE,eAAnB,GAAqC,KAArC;EACD;;EAE0B,OAApBE,oBAAoB,CAACC,CAAD,EAAyC;IAClE,OAAOC,KAAK,CAACC,OAAN,CAAeF,CAAD,CAA0BG,cAAxC,CAAP;EACD;EAED;AACF;AACA;AACA;AACA;;;EACuB,OAAdC,cAAc,CAACC,CAAD,EAAmBC,CAAnB,EAA6C;IAChE,IAAID,CAAC,CAACE,KAAF,KAAYD,CAAC,CAACC,KAAlB,EAAyB;MACvB,OAAO,CAACF,CAAC,CAACE,KAAF,IAAW,CAAZ,KAAkBD,CAAC,CAACC,KAAF,IAAW,CAA7B,IAAkC,CAAlC,GAAsC,CAAC,CAA9C;IACD;;IAED,IAAIF,CAAC,CAACG,KAAF,KAAYF,CAAC,CAACE,KAAlB,EAAyB;MACvB,OAAO,CAACH,CAAC,CAACG,KAAF,IAAW,CAAZ,KAAkBF,CAAC,CAACE,KAAF,IAAW,CAA7B,IAAkC,CAAlC,GAAsC,CAAC,CAA9C;IACD;;IAED,IAAIH,CAAC,CAACI,KAAF,KAAYH,CAAC,CAACG,KAAlB,EAAyB;MACvB,OAAO,CAACJ,CAAC,CAACI,KAAF,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,KAAkB,IAApD,EAA0D;QACxD,OAAOF,SAAP;MACD;IACF;;IACD,OAAOH,UAAP;EACD;;AAhNsB;;gBAAnB/D,kB,qBACqB,K;;AAkN3B,eAAeA,kBAAf"}
1
+ {"version":3,"file":"ContextActionUtils.js","names":["isPromise","value","then","undefined","ContextActionUtils","disableAllActions","actionsDisabled","enableAllActions","isContextActionEvent","e","Array","isArray","contextActions","compareActions","a","b","group","order","title","sortActions","actions","sortedActions","slice","sort","isMacPlatform","platform","window","navigator","startsWith","getModifierKey","isModifierKeyDown","event","modifierKey","copyToClipboard","text","clipboard","copyToClipboardExecCommand","Promise","resolve","writeText","catch","oldFocus","document","activeElement","textArea","createElement","body","appendChild","focus","select","execCommand","Error","removeChild","HTMLElement","getMenuItems","actionsParam","includePromises","menuItems","i","length","action","newMenuItems","push","concat","filter","menuElement","getNextMenuItem","startIndex","delta","firstIndex","menuIndex","item","disabled"],"sources":["../../src/context-actions/ContextActionUtils.ts"],"sourcesContent":["import { IconDefinition } from '@deephaven/icons';\nimport React from 'react';\nimport type { Shortcut } from '../shortcuts';\n\nexport type ResolvableContextAction =\n | ContextAction\n | Promise<ContextAction[]>\n | (() => Promise<ContextAction[]> | ContextAction[] | ContextAction);\n\nexport type MenuItem = ContextAction | Promise<ContextAction[]>;\n\nexport interface ContextAction {\n title?: string;\n description?: string;\n action?(event?: KeyboardEvent): void;\n actions?: ResolvableContextAction[];\n icon?: IconDefinition | React.ReactElement;\n iconColor?: string;\n shortcut?: Shortcut;\n isGlobal?: boolean;\n group?: number;\n order?: number;\n disabled?: boolean;\n menuElement?: React.ReactElement;\n iconOutline?: boolean;\n}\n\nexport interface ContextActionEvent extends MouseEvent {\n contextActions: ResolvableContextAction[];\n}\n\nexport function isPromise<A, T>(value: A | Promise<T>): value is Promise<T> {\n return (value as Promise<T>).then !== undefined;\n}\n\nclass ContextActionUtils {\n static actionsDisabled = false;\n\n static disableAllActions(): void {\n ContextActionUtils.actionsDisabled = true;\n }\n\n static enableAllActions(): void {\n ContextActionUtils.actionsDisabled = false;\n }\n\n static isContextActionEvent(e: MouseEvent): e is ContextActionEvent {\n return Array.isArray((e as ContextActionEvent).contextActions);\n }\n\n /**\n * Compare two action items. Useful in Array.sort\n * @param a First context action to compare\n * @param b Second context action to compare\n */\n static compareActions(a: ContextAction, b: ContextAction): number {\n if (a.group !== b.group) {\n return (a.group ?? 0) > (b.group ?? 0) ? 1 : -1;\n }\n\n if (a.order !== b.order) {\n return (a.order ?? 0) > (b.order ?? 0) ? 1 : -1;\n }\n\n if (a.title !== b.title) {\n return (a.title ?? '') > (b.title ?? '') ? 1 : -1;\n }\n\n if (a !== b) {\n return a > b ? 1 : -1;\n }\n\n return 0;\n }\n\n /**\n *\n * @param actions The array of actions to sort\n */\n static sortActions(actions: ContextAction[]): ContextAction[] {\n if (actions == null || !Array.isArray(actions)) {\n return [];\n }\n\n const sortedActions = actions.slice();\n sortedActions.sort(ContextActionUtils.compareActions);\n return sortedActions;\n }\n\n static isMacPlatform(): boolean {\n const { platform } = window.navigator;\n return platform.startsWith('Mac');\n }\n\n /**\n * Retrieve the preferred modifier key based on the current platform\n */\n static getModifierKey(): 'metaKey' | 'ctrlKey' {\n if (ContextActionUtils.isMacPlatform()) {\n return 'metaKey';\n }\n\n return 'ctrlKey';\n }\n\n /**\n * Returns true if the modifier key for the current platform is down for the event (Ctrl for windows/linux, Command (meta) for mac)\n * @param event The event to get the meta key status from\n */\n static isModifierKeyDown(\n event: KeyboardEvent | MouseEvent | React.KeyboardEvent | React.MouseEvent\n ): boolean {\n const modifierKey = ContextActionUtils.getModifierKey();\n return event[modifierKey];\n }\n\n /**\n * Copy the p assed in text to the clipboard.\n * @param text The text to copy\n * @returns Promise Resolved on success, rejected on failure\n */\n static copyToClipboard(text: string): Promise<void> {\n const { clipboard } = navigator;\n if (clipboard === undefined) {\n ContextActionUtils.copyToClipboardExecCommand(text);\n return Promise.resolve();\n }\n return navigator.clipboard.writeText(text).catch(() => {\n ContextActionUtils.copyToClipboardExecCommand(text);\n });\n }\n\n /**\n * Copy the passed in text to the clipboard using the `execCommand` functionality\n * Throws on error/failure\n * @param text The text to copy\n */\n static copyToClipboardExecCommand(text: string): void {\n const oldFocus = document.activeElement;\n const textArea = document.createElement('textarea');\n textArea.value = text;\n document.body.appendChild(textArea);\n textArea.focus();\n textArea.select();\n\n if (!document.execCommand('copy')) {\n throw new Error('Unable to execute copy command');\n }\n\n document.body.removeChild(textArea);\n\n if (oldFocus instanceof HTMLElement) {\n oldFocus.focus();\n }\n }\n\n /**\n * Returns the menu items for the provided context actions, or empty array if none foun d.\n * @param actionsParam The actions to get menu items for\n * @param includePromises Whether or not to include promises in the returned menu items\n */\n static getMenuItems(\n actionsParam: ResolvableContextAction | ResolvableContextAction[],\n includePromises?: true\n ): MenuItem[];\n\n // If ignoring promises, then the return type is narrowed\n static getMenuItems(\n actionsParam: ResolvableContextAction | ResolvableContextAction[],\n includePromises: false\n ): ContextAction[];\n\n static getMenuItems(\n actionsParam: ResolvableContextAction | ResolvableContextAction[],\n includePromises = true\n ): MenuItem[] {\n let menuItems: MenuItem[] = [];\n let actions = actionsParam;\n if (!Array.isArray(actions)) {\n actions = [actions];\n }\n\n for (let i = 0; i < actions.length; i += 1) {\n const action = actions[i];\n let newMenuItems:\n | ContextAction\n | ContextAction[]\n | Promise<ContextAction[]>;\n if (typeof action === 'function') {\n newMenuItems = action();\n } else {\n newMenuItems = action;\n }\n\n if (newMenuItems != null) {\n if (newMenuItems instanceof Promise) {\n if (includePromises) {\n menuItems.push(newMenuItems);\n }\n } else if (Array.isArray(newMenuItems)) {\n menuItems = menuItems.concat(newMenuItems);\n } else {\n menuItems.push(newMenuItems);\n }\n }\n }\n\n menuItems = menuItems.filter(\n action =>\n (action as ContextAction).title !== undefined ||\n (action as Promise<ContextAction[]>).then ||\n (action as ContextAction).menuElement\n );\n\n return menuItems;\n }\n\n /**\n * Returns the index of the next menu item in a list that doesn't have a disabled=true prop\n * @param startIndex the starting position for the iteration\n * @param delta the direction of travel, -1 or 1\n * @param menuItems an array of menuItems\n */\n static getNextMenuItem(\n startIndex: number,\n delta: -1 | 1,\n menuItems: MenuItem[]\n ): number {\n let firstIndex = startIndex;\n if (firstIndex < 0 && delta < 0) {\n // if menu index is -1 and delta -1 manually set start point\n firstIndex = menuItems.length;\n }\n // find the next non disabled menu option, iterating the list only once\n for (let i = 1; i < menuItems.length + 1; i += 1) {\n const menuIndex =\n (firstIndex + delta * i + menuItems.length) % menuItems.length;\n const item = menuItems[menuIndex];\n if (!(item instanceof Promise) && item.disabled !== true) {\n return menuIndex;\n }\n }\n return startIndex;\n }\n}\n\nexport default ContextActionUtils;\n"],"mappings":";;AA+BA,OAAO,SAASA,SAAT,CAAyBC,KAAzB,EAAqE;EAC1E,OAAQA,KAAD,CAAsBC,IAAtB,KAA+BC,SAAtC;AACD;;AAED,MAAMC,kBAAN,CAAyB;EAGC,OAAjBC,iBAAiB,GAAS;IAC/BD,kBAAkB,CAACE,eAAnB,GAAqC,IAArC;EACD;;EAEsB,OAAhBC,gBAAgB,GAAS;IAC9BH,kBAAkB,CAACE,eAAnB,GAAqC,KAArC;EACD;;EAE0B,OAApBE,oBAAoB,CAACC,CAAD,EAAyC;IAClE,OAAOC,KAAK,CAACC,OAAN,CAAeF,CAAD,CAA0BG,cAAxC,CAAP;EACD;EAED;AACF;AACA;AACA;AACA;;;EACuB,OAAdC,cAAc,CAACC,CAAD,EAAmBC,CAAnB,EAA6C;IAChE,IAAID,CAAC,CAACE,KAAF,KAAYD,CAAC,CAACC,KAAlB,EAAyB;MAAA;;MACvB,OAAO,aAACF,CAAC,CAACE,KAAH,+CAAY,CAAZ,iBAAkBD,CAAC,CAACC,KAApB,+CAA6B,CAA7B,IAAkC,CAAlC,GAAsC,CAAC,CAA9C;IACD;;IAED,IAAIF,CAAC,CAACG,KAAF,KAAYF,CAAC,CAACE,KAAlB,EAAyB;MAAA;;MACvB,OAAO,aAACH,CAAC,CAACG,KAAH,+CAAY,CAAZ,i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AS,GACb,CAACD,UAAU,GAAGD,KAAK,GAAGV,CAArB,GAAyBD,SAAS,CAACE,MAApC,IAA8CF,SAAS,CAACE,MAD1D;MAEA,IAAMY,IAAI,GAAGd,SAAS,CAACa,SAAD,CAAtB;;MACA,IAAI,EAAEC,IAAI,YAAYlC,OAAlB,KAA8BkC,IAAI,CAACC,QAAL,KAAkB,IAApD,EAA0D;QACxD,OAAOF,SAAP;MACD;IACF;;IACD,OAAOH,UAAP;EACD;;AAhNsB;;gBAAnB/D,kB,qBACqB,K;;AAkN3B,eAAeA,kBAAf"}
@@ -1 +1 @@
1
- {"version":3,"file":"ContextActions.d.ts","sourceRoot":"","sources":["../../src/context-actions/ContextActions.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,OAA2B,EACzB,uBAAuB,EAExB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,aAAa,EAAsB,MAAM,sBAAsB,CAAC;AAE9E,OAAO,uBAAuB,CAAC;AAI/B,UAAU,mBAAmB;IAC3B,OAAO,EAAE,uBAAuB,GAAG,uBAAuB,EAAE,CAAC;IAC7D,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,mBAAmB;IAC3B,aAAa,EAAE,aAAa,EAAE,CAAC;IAC/B,eAAe,EAAE,aAAa,EAAE,CAAC;CAClC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,cAAM,cAAe,SAAQ,SAAS,CACpC,mBAAmB,EACnB,mBAAmB,CACpB;IACC;;;;;OAKG;IACH,MAAM,CAAC,MAAM;;;;;;;MAQX;IAEF,MAAM,CAAC,WAAW,CAChB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,aAAa,EAAE,GACvB,IAAI;gBAmBK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AI;gBAmBK,KAAK,EAAE,mBAAmB;IAWtC,MAAM,CAAC,wBAAwB,CAC7B,KAAK,EAAE,mBAAmB,GACzB,mBAAmB;IAoBtB,iBAAiB,IAAI,IAAI;IAazB,oBAAoB,IAAI,IAAI;IAa5B,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAE3C,iBAAiB,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI;IAgDtC,aAAa,CAAC,CAAC,EAAE,aAAa,GAAG,IAAI;IAqBrC,MAAM,IAAI,GAAG,CAAC,OAAO;CAatB;AAED,eAAe,cAAc,CAAC"}
@@ -44,7 +44,7 @@ class ContextActions extends Component {
44
44
  * Items within groups are ordered by their order property, then by their title.
45
45
  */
46
46
  static triggerMenu(element, clientX, clientY, actions) {
47
- if (!element || !clientX || !clientY || !actions) {
47
+ if (actions.length === 0) {
48
48
  return;
49
49
  }
50
50
 
@@ -73,7 +73,7 @@ class ContextActions extends Component {
73
73
  }
74
74
 
75
75
  static getDerivedStateFromProps(props) {
76
- if (!props.actions || !Array.isArray(props.actions)) {
76
+ if (props.actions == null || !Array.isArray(props.actions)) {
77
77
  return {
78
78
  globalActions: [],
79
79
  keyboardActions: []
@@ -81,7 +81,7 @@ class ContextActions extends Component {
81
81
  }
82
82
 
83
83
  var globalActions = props.actions.filter(action => !isPromise(action) && typeof action !== 'function' && action.isGlobal);
84
- var keyboardActions = props.actions.filter(action => !isPromise(action) && typeof action !== 'function' && !action.isGlobal && action.shortcut != null);
84
+ var keyboardActions = props.actions.filter(action => !isPromise(action) && typeof action !== 'function' && action.isGlobal !== undefined && !action.isGlobal && action.shortcut != null);
85
85
  return {
86
86
  globalActions,
87
87
  keyboardActions
@@ -149,11 +149,11 @@ class ContextActions extends Component {
149
149
  actions
150
150
  } = this.props;
151
151
 
152
- if (actions) {
152
+ if (actions != null) {
153
153
  var contextActions = actions;
154
154
 
155
155
  if (Array.isArray(contextActions)) {
156
- contextActions = contextActions.filter(action => isPromise(action) || typeof action === 'function' || !action.isGlobal);
156
+ contextActions = contextActions.filter(action => isPromise(action) || typeof action === 'function' || action.isGlobal === undefined || action.isGlobal);
157
157
  }
158
158
 
159
159
  e.contextActions = e.contextActions.concat(contextActions);
@@ -168,22 +168,15 @@ class ContextActions extends Component {
168
168
  } = this.state;
169
169
 
170
170
  for (var i = 0; i < keyboardActions.length; i += 1) {
171
- var _keyboardAction$short;
172
-
173
171
  var keyboardAction = keyboardActions[i];
174
172
 
175
- if (!ContextActionUtils.actionsDisabled && (_keyboardAction$short = keyboardAction.shortcut) !== null && _keyboardAction$short !== void 0 && _keyboardAction$short.matchesEvent(e)) {
173
+ if (!ContextActionUtils.actionsDisabled && keyboardAction.shortcut != null && keyboardAction.shortcut.matchesEvent(e)) {
176
174
  var _keyboardAction$actio;
177
175
 
178
176
  log.debug('Context hotkey matched!', e);
179
- var result = (_keyboardAction$actio = keyboardAction.action) === null || _keyboardAction$actio === void 0 ? void 0 : _keyboardAction$actio.call(keyboardAction, e);
180
-
181
- if (result || result === undefined) {
182
- e.stopPropagation();
183
- e.preventDefault();
184
- return;
185
- }
186
-
177
+ (_keyboardAction$actio = keyboardAction.action) === null || _keyboardAction$actio === void 0 ? void 0 : _keyboardAction$actio.call(keyboardAction, e);
178
+ e.stopPropagation();
179
+ e.preventDefault();
187
180
  log.debug2('Matched hotkey returned false, key event not consumed');
188
181
  }
189
182
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ContextActions.js","names":["React","Component","Log","ContextActionUtils","isPromise","GlobalContextActions","log","module","ContextActions","triggerMenu","element","clientX","clientY","actions","mouseEvent","MouseEvent","bubbles","cancelable","contextActions","dispatchEvent","constructor","props","handleContextMenu","bind","handleKeyDown","container","createRef","state","globalActions","keyboardActions","getDerivedStateFromProps","Array","isArray","filter","action","isGlobal","shortcut","componentDidMount","current","parentElement","addEventListener","componentWillUnmount","removeEventListener","e","ignoreClassNames","length","el","target","classList","ignoredClassName","find","className","contains","undefined","debug2","isContextActionEvent","concat","debug","i","keyboardAction","actionsDisabled","matchesEvent","result","stopPropagation","preventDefault","render","dataTestId","default","high","medium","low","global","edit"],"sources":["../../src/context-actions/ContextActions.tsx"],"sourcesContent":["/**\n * Just a simple utility class for displaying a popup menu.\n */\nimport React, { Component } from 'react';\nimport Log from '@deephaven/log';\nimport ContextActionUtils, {\n ResolvableContextAction,\n isPromise,\n} from './ContextActionUtils';\nimport type { ContextAction, ContextActionEvent } from './ContextActionUtils';\nimport GlobalContextActions from './GlobalContextActions';\nimport './ContextActions.scss';\n\nconst log = Log.module('ContextActions');\n\ninterface ContextActionsProps {\n actions: ResolvableContextAction | ResolvableContextAction[];\n ignoreClassNames?: string[];\n 'data-testid'?: string;\n}\n\ninterface ContextActionsState {\n globalActions: ContextAction[];\n keyboardActions: ContextAction[];\n}\n\n/**\n * ContextActions that you add onto any component.\n *\n * Usage:\n * let actions = [{\n * title: 'My Action', // Omit the title to hide it from the context menu\n * action: () => { alert('My Action Clicked!') }\n * actions: [] // Submenu of actions\n * icon: faPrint, // Limited to FontAwesome icons for now.\n * iconColor: '#ff0000, // Color to use for the icon\n * shortcut: Shortcut, // Defaults to null\n * isGlobal: false, // Global context action. Defaults to false.\n * group: ContextActions.groups.default, // What group to group the context action with\n * order: null, // Int where to order within group\n * disabled: true // disable action\n * menuElement: null // Custom menu element for displaying in context menu. When null, creates a default menu item based on title\n * }];\n *\n * <div>\n * Right click in this container\n * <ContextActions actions={actions}/>\n * </div>\n *\n * Right clicking the container will then build the context menu, bubbling up until an element with a ContextMenuRoot is on it.\n * You should generally have a ContextMenuRoot on the root node of your document.\n */\nclass ContextActions extends Component<\n ContextActionsProps,\n ContextActionsState\n> {\n /**\n * Group you can assign to context menu actions to group them together.\n * Lower group IDs appear at the top of the list.\n * Groups are separated by a separator item.\n * Items within groups are ordered by their order property, then by their title.\n */\n static groups = {\n default: null,\n high: 100,\n medium: 5000,\n low: 10000,\n global: 100000,\n\n edit: 100,\n };\n\n static triggerMenu(\n element: Element,\n clientX: number,\n clientY: number,\n actions: ContextAction[]\n ): void {\n if (!element || !clientX || !clientY || !actions) {\n return;\n }\n\n const mouseEvent: Partial<ContextActionEvent> = new MouseEvent(\n 'contextmenu',\n {\n clientX,\n clientY,\n bubbles: true,\n cancelable: true,\n }\n );\n mouseEvent.contextActions = actions;\n\n element.dispatchEvent(mouseEvent as ContextActionEvent);\n }\n\n constructor(props: ContextActionsProps) {\n super(props);\n\n this.handleContextMenu = this.handleContextMenu.bind(this);\n this.handleKeyDown = this.handleKeyDown.bind(this);\n\n this.container = React.createRef();\n\n this.state = { globalActions: [], keyboardActions: [] };\n }\n\n static getDerivedStateFromProps(\n props: ContextActionsProps\n ): ContextActionsState {\n if (!props.actions || !Array.isArray(props.actions)) {\n return { globalActions: [], keyboardActions: [] };\n }\n const globalActions = props.actions.filter(\n action =>\n !isPromise(action) && typeof action !== 'function' && action.isGlobal\n ) as ContextAction[];\n const keyboardActions = props.actions.filter(\n action =>\n !isPromise(action) &&\n typeof action !== 'function' &&\n !action.isGlobal &&\n action.shortcut != null\n ) as ContextAction[];\n\n return { globalActions, keyboardActions };\n }\n\n componentDidMount(): void {\n if (this.container.current?.parentElement) {\n this.container.current.parentElement.addEventListener(\n 'contextmenu',\n this.handleContextMenu\n );\n this.container.current.parentElement.addEventListener(\n 'keydown',\n this.handleKeyDown\n );\n }\n }\n\n componentWillUnmount(): void {\n if (this.container.current?.parentElement) {\n this.container.current.parentElement.removeEventListener(\n 'contextmenu',\n this.handleContextMenu\n );\n this.container.current.parentElement.removeEventListener(\n 'keydown',\n this.handleKeyDown\n );\n }\n }\n\n container: React.RefObject<HTMLDivElement>;\n\n handleContextMenu(e: MouseEvent): void {\n const { ignoreClassNames = [] } = this.props;\n if (ignoreClassNames.length > 0) {\n let el = e.target as Element | null;\n while (el != null) {\n const { classList } = el;\n const ignoredClassName = ignoreClassNames.find(className =>\n classList.contains(className)\n );\n if (ignoredClassName !== undefined) {\n log.debug2(\n `Contextmenu event ignored based on the target className \"${ignoredClassName}\"`\n );\n return;\n }\n el = el.parentElement;\n }\n }\n if (!ContextActionUtils.isContextActionEvent(e)) {\n (e as ContextActionEvent).contextActions = [];\n }\n\n if (!ContextActionUtils.isContextActionEvent(e)) {\n return;\n }\n\n const { actions } = this.props;\n if (actions) {\n let contextActions = actions;\n if (Array.isArray(contextActions)) {\n contextActions = contextActions.filter(\n action =>\n isPromise(action) ||\n typeof action === 'function' ||\n !action.isGlobal\n );\n }\n\n e.contextActions = e.contextActions.concat(contextActions);\n }\n\n log.debug(\n 'Received context menu event! Menu items are now: ',\n e.contextActions\n );\n }\n\n handleKeyDown(e: KeyboardEvent): void {\n const { keyboardActions } = this.state;\n for (let i = 0; i < keyboardActions.length; i += 1) {\n const keyboardAction = keyboardActions[i];\n if (\n !ContextActionUtils.actionsDisabled &&\n keyboardAction.shortcut?.matchesEvent(e)\n ) {\n log.debug('Context hotkey matched!', e);\n\n const result = keyboardAction.action?.(e);\n\n if (result || result === undefined) {\n e.stopPropagation();\n e.preventDefault();\n return;\n }\n\n log.debug2('Matched hotkey returned false, key event not consumed');\n }\n }\n }\n\n render(): JSX.Element {\n const { 'data-testid': dataTestId } = this.props;\n const { globalActions } = this.state;\n return (\n <div\n className=\"context-actions-listener\"\n ref={this.container}\n data-testid={dataTestId}\n >\n <GlobalContextActions actions={globalActions} />\n </div>\n );\n }\n}\n\nexport default ContextActions;\n"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AACA,OAAOC,GAAP,MAAgB,gBAAhB;OACOC,kB,IAELC,S;OAGKC,oB;;AAGP,IAAMC,GAAG,GAAGJ,GAAG,CAACK,MAAJ,CAAW,gBAAX,CAAZ;;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,cAAN,SAA6BP,SAA7B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D,kBAAkB,CAACyD,eAApB,6BACAD,cAAc,CAACvB,QADf,kDACA,sBAAyByB,YAAzB,CAAsClB,CAAtC,CAFF,EAGE;QAAA;;QACArC,GAAG,CAACmD,KAAJ,CAAU,yBAAV,EAAqCd,CAArC;QAEA,IAAMmB,MAAM,4BAAGH,cAAc,CAACzB,MAAlB,0DAAG,2BAAAyB,cAAc,EAAUhB,CAAV,CAA7B;;QAEA,IAAImB,MAAM,IAAIA,MAAM,KAAKT,SAAzB,EAAoC;UAClCV,CAAC,CAACoB,eAAF;UACApB,CAAC,CAACqB,cAAF;UACA;QACD;;QAED1D,GAAG,CAACgD,MAAJ,CAAW,uDAAX;MACD;IACF;EACF;;EAEDW,MAAM,GAAgB;IACpB,IAAM;MAAE,eAAeC;IAAjB,IAAgC,KAAK7C,KAA3C;IACA,IAAM;MAAEO;IAAF,IAAoB,KAAKD,KAA/B;IACA,oBACE;MACE,SAAS,EAAC,0BADZ;MAEE,GAAG,EAAE,KAAKF,SAFZ;MAGE,eAAayC;IAHf,gBAKE,oBAAC,oBAAD;MAAsB,OAAO,EAAEtC;IAA/B,EALF,CADF;EASD;;AAvLD;;gBAHIpB,c,YAUY;EACd2D,OAAO,EAAE,IADK;EAEdC,IAAI,EAAE,GAFQ;EAGdC,MAAM,EAAE,IAHM;EAIdC,GAAG,EAAE,KAJS;EAKdC,MAAM,EAAE,MALM;EAOdC,IAAI,EAAE;AAPQ,C;;AAmLlB,eAAehE,cAAf"}
1
+ {"version":3,"file":"ContextActions.js","names":["React","Component","Log","ContextActionUtils","isPromise","GlobalContextActions","log","module","ContextActions","triggerMenu","element","clientX","clientY","actions","length","mouseEvent","MouseEvent","bubbles","cancelable","contextActions","dispatchEvent","constructor","props","handleContextMenu","bind","handleKeyDown","container","createRef","state","globalActions","keyboardActions","getDerivedStateFromProps","Array","isArray","filter","action","isGlobal","undefined","shortcut","componentDidMount","current","parentElement","addEventListener","componentWillUnmount","removeEventListener","e","ignoreClassNames","el","target","classList","ignoredClassName","find","className","contains","debug2","isContextActionEvent","concat","debug","i","keyboardAction","actionsDisabled","matchesEvent","stopPropagation","preventDefault","render","dataTestId","default","high","medium","low","global","edit"],"sources":["../../src/context-actions/ContextActions.tsx"],"sourcesContent":["/**\n * Just a simple utility class for displaying a popup menu.\n */\nimport React, { Component } from 'react';\nimport Log from '@deephaven/log';\nimport ContextActionUtils, {\n ResolvableContextAction,\n isPromise,\n} from './ContextActionUtils';\nimport type { ContextAction, ContextActionEvent } from './ContextActionUtils';\nimport GlobalContextActions from './GlobalContextActions';\nimport './ContextActions.scss';\n\nconst log = Log.module('ContextActions');\n\ninterface ContextActionsProps {\n actions: ResolvableContextAction | ResolvableContextAction[];\n ignoreClassNames?: string[];\n 'data-testid'?: string;\n}\n\ninterface ContextActionsState {\n globalActions: ContextAction[];\n keyboardActions: ContextAction[];\n}\n\n/**\n * ContextActions that you add onto any component.\n *\n * Usage:\n * let actions = [{\n * title: 'My Action', // Omit the title to hide it from the context menu\n * action: () => { alert('My Action Clicked!') }\n * actions: [] // Submenu of actions\n * icon: faPrint, // Limited to FontAwesome icons for now.\n * iconColor: '#ff0000, // Color to use for the icon\n * shortcut: Shortcut, // Defaults to null\n * isGlobal: false, // Global context action. Defaults to false.\n * group: ContextActions.groups.default, // What group to group the context action with\n * order: null, // Int where to order within group\n * disabled: true // disable action\n * menuElement: null // Custom menu element for displaying in context menu. When null, creates a default menu item based on title\n * }];\n *\n * <div>\n * Right click in this container\n * <ContextActions actions={actions}/>\n * </div>\n *\n * Right clicking the container will then build the context menu, bubbling up until an element with a ContextMenuRoot is on it.\n * You should generally have a ContextMenuRoot on the root node of your document.\n */\nclass ContextActions extends Component<\n ContextActionsProps,\n ContextActionsState\n> {\n /**\n * Group you can assign to context menu actions to group them together.\n * Lower group IDs appear at the top of the list.\n * Groups are separated by a separator item.\n * Items within groups are ordered by their order property, then by their title.\n */\n static groups = {\n default: null,\n high: 100,\n medium: 5000,\n low: 10000,\n global: 100000,\n\n edit: 100,\n };\n\n static triggerMenu(\n element: Element,\n clientX: number,\n clientY: number,\n actions: ContextAction[]\n ): void {\n if (actions.length === 0) {\n return;\n }\n\n const mouseEvent: Partial<ContextActionEvent> = new MouseEvent(\n 'contextmenu',\n {\n clientX,\n clientY,\n bubbles: true,\n cancelable: true,\n }\n );\n mouseEvent.contextActions = actions;\n\n element.dispatchEvent(mouseEvent as ContextActionEvent);\n }\n\n constructor(props: ContextActionsProps) {\n super(props);\n\n this.handleContextMenu = this.handleContextMenu.bind(this);\n this.handleKeyDown = this.handleKeyDown.bind(this);\n\n this.container = React.createRef();\n\n this.state = { globalActions: [], keyboardActions: [] };\n }\n\n static getDerivedStateFromProps(\n props: ContextActionsProps\n ): ContextActionsState {\n if (props.actions == null || !Array.isArray(props.actions)) {\n return { globalActions: [], keyboardActions: [] };\n }\n const globalActions = props.actions.filter(\n action =>\n !isPromise(action) && typeof action !== 'function' && action.isGlobal\n ) as ContextAction[];\n const keyboardActions = props.actions.filter(\n action =>\n !isPromise(action) &&\n typeof action !== 'function' &&\n action.isGlobal !== undefined &&\n !action.isGlobal &&\n action.shortcut != null\n ) as ContextAction[];\n\n return { globalActions, keyboardActions };\n }\n\n componentDidMount(): void {\n if (this.container.current?.parentElement) {\n this.container.current.parentElement.addEventListener(\n 'contextmenu',\n this.handleContextMenu\n );\n this.container.current.parentElement.addEventListener(\n 'keydown',\n this.handleKeyDown\n );\n }\n }\n\n componentWillUnmount(): void {\n if (this.container.current?.parentElement) {\n this.container.current.parentElement.removeEventListener(\n 'contextmenu',\n this.handleContextMenu\n );\n this.container.current.parentElement.removeEventListener(\n 'keydown',\n this.handleKeyDown\n );\n }\n }\n\n container: React.RefObject<HTMLDivElement>;\n\n handleContextMenu(e: MouseEvent): void {\n const { ignoreClassNames = [] } = this.props;\n if (ignoreClassNames.length > 0) {\n let el = e.target as Element | null;\n while (el != null) {\n const { classList } = el;\n const ignoredClassName = ignoreClassNames.find(className =>\n classList.contains(className)\n );\n if (ignoredClassName !== undefined) {\n log.debug2(\n `Contextmenu event ignored based on the target className \"${ignoredClassName}\"`\n );\n return;\n }\n el = el.parentElement;\n }\n }\n if (!ContextActionUtils.isContextActionEvent(e)) {\n (e as ContextActionEvent).contextActions = [];\n }\n\n if (!ContextActionUtils.isContextActionEvent(e)) {\n return;\n }\n\n const { actions } = this.props;\n if (actions != null) {\n let contextActions = actions;\n if (Array.isArray(contextActions)) {\n contextActions = contextActions.filter(\n action =>\n isPromise(action) ||\n typeof action === 'function' ||\n action.isGlobal === undefined ||\n action.isGlobal\n );\n }\n\n e.contextActions = e.contextActions.concat(contextActions);\n }\n\n log.debug(\n 'Received context menu event! Menu items are now: ',\n e.contextActions\n );\n }\n\n handleKeyDown(e: KeyboardEvent): void {\n const { keyboardActions } = this.state;\n for (let i = 0; i < keyboardActions.length; i += 1) {\n const keyboardAction = keyboardActions[i];\n if (\n !ContextActionUtils.actionsDisabled &&\n keyboardAction.shortcut != null &&\n keyboardAction.shortcut.matchesEvent(e)\n ) {\n log.debug('Context hotkey matched!', e);\n\n keyboardAction.action?.(e);\n\n e.stopPropagation();\n e.preventDefault();\n\n log.debug2('Matched hotkey returned false, key event not consumed');\n }\n }\n }\n\n render(): JSX.Element {\n const { 'data-testid': dataTestId } = this.props;\n const { globalActions } = this.state;\n return (\n <div\n className=\"context-actions-listener\"\n ref={this.container}\n data-testid={dataTestId}\n >\n <GlobalContextActions actions={globalActions} />\n </div>\n );\n }\n}\n\nexport default ContextActions;\n"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AACA,OAAOC,GAAP,MAAgB,gBAAhB;OACOC,kB,IAELC,S;OAGKC,oB;;AAGP,IAAMC,GAAG,GAAGJ,GAAG,CAACK,MAAJ,CAAW,gBAAX,CAAZ;;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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!== actions) {
113
- var _this$container$curre3;
114
-
115
113
  this.initMenu();
116
114
 
117
- if (!((_this$container$curre3 = this.container.current) !== null && _this$container$curre3 !== void 0 && _this$container$curre3.contains(document.activeElement))) {
118
- var _this$container$curre4;
115
+ if (this.container.current == null || !this.container.current.contains(document.activeElement)) {
116
+ var _this$container$curre3;
119
117
 
120
- (_this$container$curre4 = this.container.current) === null || _this$container$curre4 === void 0 ? void 0 : _this$container$curre4.focus();
118
+ (_this$container$curre3 = this.container.current) === null || _this$container$curre3 === void 0 ? void 0 : _this$container$curre3.focus();
121
119
  }
122
120
  }
123
121
 
@@ -135,7 +133,7 @@ class ContextMenu extends PureComponent {
135
133
  options
136
134
  } = this.props;
137
135
 
138
- if (options.separateKeyboardMouse) {
136
+ if (options.separateKeyboardMouse !== undefined && options.separateKeyboardMouse) {
139
137
  var {
140
138
  keyboardIndex
141
139
  } = this.state;
@@ -150,7 +148,7 @@ class ContextMenu extends PureComponent {
150
148
  options
151
149
  } = this.props;
152
150
 
153
- if (options.separateKeyboardMouse) {
151
+ if (options.separateKeyboardMouse !== undefined && options.separateKeyboardMouse) {
154
152
  this.setState({
155
153
  keyboardIndex: index
156
154
  });
@@ -289,7 +287,7 @@ class ContextMenu extends PureComponent {
289
287
 
290
288
 
291
289
  verifyPosition() {
292
- var _this$container$curre5, _this$container$curre6, _this$container$curre7, _this$container$curre8;
290
+ var _this$container$curre4, _this$container$curre5, _this$container$curre6, _this$container$curre7;
293
291
 
294
292
  var {
295
293
  options,
@@ -300,7 +298,7 @@ class ContextMenu extends PureComponent {
300
298
  left: oldLeft
301
299
  } = this.props;
302
300
 
303
- if (!this.container.current || options.doNotVerifyPosition) {
301
+ if (!this.container.current || options.doNotVerifyPosition != null && options.doNotVerifyPosition) {
304
302
  return;
305
303
  } // initial position is used rather than current position,
306
304
  // as the number of menu items can change (actions can bubble)
@@ -314,11 +312,11 @@ class ContextMenu extends PureComponent {
314
312
  var {
315
313
  width,
316
314
  height
317
- } = (_this$container$curre5 = (_this$container$curre6 = this.container.current) === null || _this$container$curre6 === void 0 ? void 0 : _this$container$curre6.getBoundingClientRect()) !== null && _this$container$curre5 !== void 0 ? _this$container$curre5 : {
315
+ } = (_this$container$curre4 = (_this$container$curre5 = this.container.current) === null || _this$container$curre5 === void 0 ? void 0 : _this$container$curre5.getBoundingClientRect()) !== null && _this$container$curre4 !== void 0 ? _this$container$curre4 : {
318
316
  width: 0,
319
317
  height: 0
320
318
  };
321
- var hasOverflow = ((_this$container$curre7 = (_this$container$curre8 = this.container.current) === null || _this$container$curre8 === void 0 ? void 0 : _this$container$curre8.scrollHeight) !== null && _this$container$curre7 !== void 0 ? _this$container$curre7 : 0) > window.innerHeight;
319
+ var hasOverflow = ((_this$container$curre6 = (_this$container$curre7 = this.container.current) === null || _this$container$curre7 === void 0 ? void 0 : _this$container$curre7.scrollHeight) !== null && _this$container$curre6 !== void 0 ? _this$container$curre6 : 0) > window.innerHeight;
322
320
 
323
321
  if (height === 0 || width === 0) {
324
322
  // We don't have a height or width yet, don't bother doing anything
@@ -492,7 +490,7 @@ class ContextMenu extends PureComponent {
492
490
  menuItems
493
491
  } = this.state;
494
492
 
495
- if (menuItem != null && !menuItem.disabled) {
493
+ if (menuItem != null && (menuItem.disabled === undefined || !menuItem.disabled)) {
496
494
  if (menuItem.actions != null) {
497
495
  this.openSubMenu(menuItems.indexOf(menuItem));
498
496
  } else if (menuItem.action != null) {
@@ -517,7 +515,7 @@ class ContextMenu extends PureComponent {
517
515
  var focusIndex = menuItems.indexOf(menuItem);
518
516
  this.setMouseIndex(focusIndex);
519
517
 
520
- if (focusIndex >= 0 && focusIndex < menuItems.length && !menuItem.disabled) {
518
+ if (focusIndex >= 0 && focusIndex < menuItems.length && (menuItem.disabled === undefined || !menuItem.disabled)) {
521
519
  this.openSubMenu(focusIndex);
522
520
  }
523
521
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ContextMenu.js","names":["React","PureComponent","classNames","Log","PromiseUtils","ContextActionUtils","ContextMenuItem","LoadingSpinner","log","module","ContextMenu","handleContextMenu","e","metaKey","stopPropagation","preventDefault","constructor","props","handleBlur","bind","handleCloseSubMenu","handleKeyDown","handleMenuItemClick","handleMenuItemContextMenu","handleMenuItemMouseMove","handleMouseLeave","handleWindowResize","container","createRef","oldFocus","document","activeElement","activeSubMenuRef","subMenuTimer","rAF","initialPosition","top","left","state","menuItems","pendingItems","activeSubMenu","hasOverflow","subMenuTop","subMenuLeft","subMenuParentWidth","subMenuParentHeight","keyboardIndex","mouseIndex","componentDidMount","initMenu","verifyPosition","window","addEventListener","requestAnimationFrame","current","focus","onMenuOpened","componentDidUpdate","prevProps","prevState","actions","setActiveSubMenuPosition","contains","componentWillUnmount","cancelPromises","removeEventListener","cancelAnimationFrame","getKeyboardIndex","options","separateKeyboardMouse","getMouseIndex","setKeyboardIndex","index","setState","setMouseIndex","initialKeyboardIndex","undefined","getMenuItems","nonPromiseItems","i","length","menuItem","Promise","initMenuPromise","push","sortActions","promise","cancellablePromise","makeCancelable","concat","then","resolvedMenuItems","indexOf","slice","splice","error","isCanceled","map","item","cancel","parentRect","getBoundingClientRect","right","height","width","updatePosition","oldTop","oldLeft","doNotVerifyPosition","scrollHeight","innerHeight","innerWidth","closeMenu","warn","relatedTarget","element","isContextMenuChild","hasAttribute","parentElement","isEscapeKey","key","newFocus","openSubMenu","shiftKey","getNextMenuItem","HTMLElement","newSubMenu","closeAll","onMenuClosed","closeSubMenu","closeAllMenus","disabled","action","focusIndex","render","menuItemElements","group","menuItemElement","pendingElement","menuStyle","dataTestId","showSubmenu","verifiedTop","verifiedLeft"],"sources":["../../src/context-actions/ContextMenu.tsx"],"sourcesContent":["import React, { PureComponent } from 'react';\nimport classNames from 'classnames';\nimport Log from '@deephaven/log';\nimport { PromiseUtils, CancelablePromise } from '@deephaven/utils';\nimport ContextActionUtils, {\n ContextAction,\n ResolvableContextAction,\n} from './ContextActionUtils';\nimport ContextMenuItem from './ContextMenuItem';\nimport LoadingSpinner from '../LoadingSpinner';\n\nconst log = Log.module('ContextMenu');\n\ninterface ContextMenuProps {\n top: number;\n left: number;\n updatePosition(top: number, left: number): void;\n // only submenus will have these, defaults to 0 otherwise\n // represents the width height of the parent menu item\n subMenuParentWidth: number;\n subMenuParentHeight: number;\n actions: ResolvableContextAction[];\n closeMenu(closeAll: boolean): void;\n onMenuClosed(menu: ContextMenu): void;\n onMenuOpened(menu: ContextMenu): void;\n options: {\n doNotVerifyPosition?: boolean;\n separateKeyboardMouse?: boolean;\n initialKeyboardIndex?: number;\n };\n menuStyle: React.CSSProperties;\n 'data-testid'?: string;\n}\n\ninterface ContextMenuState {\n menuItems: ContextAction[];\n pendingItems: CancelablePromise<ContextAction[]>[];\n activeSubMenu: number | null;\n hasOverflow: boolean;\n subMenuTop: number | null;\n subMenuLeft: number | null;\n subMenuParentWidth: number;\n subMenuParentHeight: number;\n keyboardIndex: number;\n mouseIndex: number;\n}\n\n/** Do not use this class directly. Use ContextMenuRoot and ContextActions instead. */\nclass ContextMenu extends PureComponent<ContextMenuProps, ContextMenuState> {\n static defaultProps = {\n subMenuParentWidth: 0,\n subMenuParentHeight: 0,\n closeMenu(): void {\n // no-op\n },\n onMenuOpened(): void {\n // no-op\n },\n onMenuClosed(): void {\n // no-op\n },\n options: {},\n menuStyle: {},\n 'data-testid': undefined,\n };\n\n static handleContextMenu(e: React.MouseEvent): void {\n if (e.metaKey) {\n return;\n }\n\n e.stopPropagation();\n e.preventDefault();\n }\n\n constructor(props: ContextMenuProps) {\n super(props);\n\n this.handleBlur = this.handleBlur.bind(this);\n this.handleCloseSubMenu = this.handleCloseSubMenu.bind(this);\n this.handleKeyDown = this.handleKeyDown.bind(this);\n this.handleMenuItemClick = this.handleMenuItemClick.bind(this);\n this.handleMenuItemContextMenu = this.handleMenuItemContextMenu.bind(this);\n this.handleMenuItemMouseMove = this.handleMenuItemMouseMove.bind(this);\n this.handleMouseLeave = this.handleMouseLeave.bind(this);\n this.handleWindowResize = this.handleWindowResize.bind(this);\n\n this.container = React.createRef();\n this.oldFocus = document.activeElement;\n this.activeSubMenuRef = React.createRef();\n this.subMenuTimer = 0;\n this.rAF = 0;\n\n this.initialPosition = { top: props.top, left: props.left };\n\n this.state = {\n menuItems: [],\n pendingItems: [],\n activeSubMenu: null,\n hasOverflow: false,\n subMenuTop: null,\n subMenuLeft: null,\n subMenuParentWidth: 0,\n subMenuParentHeight: 0,\n keyboardIndex: -1,\n mouseIndex: -1,\n };\n }\n\n componentDidMount(): void {\n this.initMenu();\n\n this.verifyPosition();\n\n window.addEventListener('resize', this.handleWindowResize);\n\n // rAF is needed to wait for a submenus popper to be created before\n // attempting to set focus, however on a quick mount/unmount when\n // mousing past an item, the submenu could be unmounted before the\n // async rAF finishes, so it is cancelled in willUnmount()\n this.rAF = window.requestAnimationFrame(() => {\n this.container.current?.focus();\n\n const { onMenuOpened } = this.props;\n onMenuOpened(this);\n });\n }\n\n componentDidUpdate(\n prevProps: ContextMenuProps,\n prevState: ContextMenuState\n ): void {\n const { actions } = this.props;\n const { activeSubMenu } = this.state;\n\n if (activeSubMenu !== prevState.activeSubMenu) {\n if (activeSubMenu == null) {\n // close sub menu, refocus parent menu\n this.container.current?.focus();\n } else {\n // open sub menu, set its initial position\n this.setActiveSubMenuPosition();\n }\n }\n\n if (prevProps.actions !== actions) {\n this.initMenu();\n\n if (!this.container.current?.contains(document.activeElement)) {\n this.container.current?.focus();\n }\n }\n\n this.verifyPosition();\n }\n\n componentWillUnmount(): void {\n this.cancelPromises();\n window.removeEventListener('resize', this.handleWindowResize);\n cancelAnimationFrame(this.rAF);\n }\n\n container: React.RefObject<HTMLDivElement>;\n\n oldFocus: Element | null;\n\n activeSubMenuRef: React.RefObject<HTMLDivElement>;\n\n subMenuTimer: number;\n\n rAF: number;\n\n initialPosition: { top: number; left: number };\n\n getKeyboardIndex(): number {\n const { options } = this.props;\n if (options.separateKeyboardMouse) {\n const { keyboardIndex } = this.state;\n return keyboardIndex;\n }\n\n return this.getMouseIndex();\n }\n\n setKeyboardIndex(index: number): void {\n const { options } = this.props;\n if (options.separateKeyboardMouse) {\n this.setState({ keyboardIndex: index });\n } else {\n this.setMouseIndex(index);\n }\n }\n\n getMouseIndex(): number {\n const { mouseIndex } = this.state;\n return mouseIndex;\n }\n\n setMouseIndex(index: number): void {\n this.setState({ mouseIndex: index });\n }\n\n initMenu(): void {\n // cancel any pending close and promises\n this.cancelPromises();\n cancelAnimationFrame(this.rAF);\n\n const { options } = this.props;\n let keyboardIndex = options.initialKeyboardIndex;\n if (keyboardIndex === undefined) {\n keyboardIndex = -1;\n }\n\n const { actions } = this.props;\n const menuItems = ContextActionUtils.getMenuItems(actions);\n const nonPromiseItems: ContextAction[] = [];\n for (let i = menuItems.length - 1; i >= 0; i -= 1) {\n const menuItem = menuItems[i];\n if (menuItem instanceof Promise) {\n this.initMenuPromise(menuItem as Promise<ContextAction[]>);\n } else {\n nonPromiseItems.push(menuItem as ContextAction);\n }\n }\n\n this.setState({\n mouseIndex: -1,\n keyboardIndex,\n activeSubMenu: null,\n menuItems: ContextActionUtils.sortActions(nonPromiseItems),\n });\n }\n\n initMenuPromise(promise: Promise<ContextAction[]>): void {\n // make all promises cancellable\n const cancellablePromise = PromiseUtils.makeCancelable(promise);\n\n this.setState(state => ({\n pendingItems: state.pendingItems.concat(cancellablePromise),\n }));\n\n cancellablePromise.then(\n resolvedMenuItems => {\n this.setState(state => {\n const index = state.pendingItems.indexOf(cancellablePromise);\n if (index >= 0) {\n const pendingItems = state.pendingItems.slice();\n pendingItems.splice(index, 1);\n\n return {\n menuItems: ContextActionUtils.sortActions(\n state.menuItems.concat(resolvedMenuItems)\n ),\n pendingItems,\n };\n }\n // This item is stale, don't update the menu\n return null;\n });\n },\n error => {\n if (PromiseUtils.isCanceled(error)) {\n return; // Canceled promise is ignored\n }\n\n // remove failed item from pending list\n this.setState(state => {\n const index = state.pendingItems.indexOf(cancellablePromise);\n if (index >= 0) {\n const pendingItems = state.pendingItems.slice();\n pendingItems.splice(index, 1);\n return {\n pendingItems,\n };\n }\n return null;\n });\n\n // Log the error\n log.error(error);\n }\n );\n }\n\n cancelPromises(): void {\n const { pendingItems } = this.state;\n pendingItems.map(item => item.cancel());\n }\n\n /**\n * Sets the unverfied start position of a submenu. Submenu then self-verfies\n * its own position and potentially reports back a new position.\n */\n setActiveSubMenuPosition(): void {\n if (this.activeSubMenuRef.current === null) return;\n const parentRect = this.activeSubMenuRef.current.getBoundingClientRect();\n\n // intentionally rect.right, we want the sub menu to start at the right edge of the current menu\n this.setState({\n subMenuTop: parentRect.top,\n subMenuLeft: parentRect.right,\n subMenuParentHeight: parentRect.height,\n subMenuParentWidth: parentRect.width,\n });\n }\n\n /**\n * Verifies the position of this menu in relation to the parent to make sure it's on screen.\n * Will update the top left state (updatePosition) if necessary (causing a re-render)\n * By default it tries to top-align with parent, at the right side of the parent.\n * Because we aren't a native context menu and can't escape window bounds, we also do\n * somethings to better fit on screen, such as the \"nudge\" offset position, and further\n * allow overflow scrolling for large menus in a small window.\n */\n verifyPosition(): void {\n const {\n options,\n updatePosition,\n subMenuParentWidth,\n subMenuParentHeight,\n top: oldTop,\n left: oldLeft,\n } = this.props;\n\n if (!this.container.current || options.doNotVerifyPosition) {\n return;\n }\n\n // initial position is used rather than current position,\n // as the number of menu items can change (actions can bubble)\n // and menu should always be positioned relative to spawn point\n let { top, left } = this.initialPosition;\n const {\n width,\n height,\n } = this.container.current?.getBoundingClientRect() ?? {\n width: 0,\n height: 0,\n };\n const hasOverflow =\n (this.container.current?.scrollHeight ?? 0) > window.innerHeight;\n\n if (height === 0 || width === 0) {\n // We don't have a height or width yet, don't bother doing anything\n return;\n }\n\n // does it fit below?\n if (top + height > window.innerHeight) {\n // can it be flipped to above? include offset if submenu (defaults to 0 if not submenu)\n if (top - height - subMenuParentHeight > 0) {\n // flip like a native menu would\n top -= height - subMenuParentHeight;\n } else {\n // still doesnt fit? okay, position at bottom edge\n top = window.innerHeight - height;\n }\n }\n\n if (left + width > window.innerWidth) {\n // less picky about left right positioning, just keep it going off to right\n left = left - width - subMenuParentWidth;\n }\n\n if (oldLeft !== left || oldTop !== top) {\n // parent owns positioning as single source of truth, ask to update props\n this.setState({ hasOverflow });\n updatePosition(top, left);\n }\n }\n\n // since window resize doesn't trigger blur, listen and close the menu\n handleWindowResize(): void {\n if (!this.container.current) {\n return;\n }\n this.closeMenu(true);\n }\n\n handleBlur(e: React.FocusEvent<HTMLDivElement>): void {\n if (!this.container.current) {\n log.warn('Container is null!');\n return;\n }\n\n if (!this.container.current.contains(e.relatedTarget as Node)) {\n let element: HTMLElement | null = e.relatedTarget as HTMLElement;\n let isContextMenuChild = false;\n while (element && !isContextMenuChild) {\n isContextMenuChild = element.hasAttribute('data-dh-context-menu');\n element = element.parentElement;\n }\n\n if (!isContextMenuChild) {\n // close all submenus on blur\n this.closeMenu(true);\n }\n }\n }\n\n /** Returns whether the specified key should remove the menu. Depends on the side the parent is on. */\n isEscapeKey(key: string): boolean {\n const { left } = this.props;\n return (\n key === 'Escape' ||\n (left < 0 && key === 'ArrowRight') ||\n key === 'ArrowLeft'\n );\n }\n\n handleKeyDown(e: React.KeyboardEvent<HTMLDivElement>): void {\n const { menuItems } = this.state;\n const oldFocus = this.getKeyboardIndex();\n let newFocus: number | null = oldFocus;\n let openSubMenu = false;\n\n if (e.key === 'Enter' || e.key === ' ') {\n if (oldFocus >= 0 && oldFocus < menuItems.length) {\n this.handleMenuItemClick(\n menuItems[oldFocus],\n (e as React.SyntheticEvent) as React.MouseEvent\n );\n }\n return;\n }\n\n if (e.key === 'ArrowRight') {\n if (oldFocus >= 0 && oldFocus <= menuItems.length) {\n openSubMenu = true;\n } else {\n newFocus = 0;\n }\n } else if (this.isEscapeKey(e.key)) {\n newFocus = null;\n } else if (e.key === 'ArrowUp' || (e.shiftKey && e.key === 'Tab')) {\n newFocus = ContextActionUtils.getNextMenuItem(newFocus, -1, menuItems);\n } else if (e.key === 'ArrowDown' || e.key === 'Tab') {\n newFocus = ContextActionUtils.getNextMenuItem(newFocus, 1, menuItems);\n }\n\n if (openSubMenu) {\n this.openSubMenu(oldFocus);\n e.preventDefault();\n e.stopPropagation();\n return;\n }\n\n if (oldFocus !== newFocus) {\n if (newFocus !== null) {\n this.setKeyboardIndex(newFocus);\n } else {\n this.closeMenu();\n if (this.oldFocus instanceof HTMLElement) {\n this.oldFocus.focus();\n }\n }\n\n e.preventDefault();\n e.stopPropagation();\n }\n }\n\n openSubMenu(index: number): void {\n const { menuItems, activeSubMenu } = this.state;\n const newSubMenu = menuItems[index].actions ? index : null;\n if (activeSubMenu === newSubMenu) return;\n this.setState({\n activeSubMenu: newSubMenu,\n subMenuTop: null,\n subMenuLeft: null,\n });\n }\n\n closeMenu(closeAll = false): void {\n const { closeMenu, onMenuClosed } = this.props;\n cancelAnimationFrame(this.rAF);\n this.rAF = window.requestAnimationFrame(() => {\n closeMenu(closeAll);\n onMenuClosed(this);\n });\n }\n\n closeSubMenu(): void {\n this.setState({\n activeSubMenu: null,\n });\n }\n\n handleCloseSubMenu(closeAllMenus: boolean): void {\n if (closeAllMenus) {\n this.closeMenu(true);\n } else {\n this.closeSubMenu();\n }\n }\n\n handleMenuItemClick(menuItem: ContextAction, e: React.MouseEvent): void {\n e.preventDefault();\n e.stopPropagation();\n\n const { menuItems } = this.state;\n if (menuItem != null && !menuItem.disabled) {\n if (menuItem.actions != null) {\n this.openSubMenu(menuItems.indexOf(menuItem));\n } else if (menuItem.action != null) {\n menuItem.action();\n this.closeMenu(true);\n }\n }\n }\n\n handleMenuItemContextMenu(\n menuItem: ContextAction,\n e: React.MouseEvent\n ): void {\n if (e.metaKey) {\n return;\n }\n\n this.handleMenuItemClick(menuItem, e);\n }\n\n handleMenuItemMouseMove(menuItem: ContextAction): void {\n const { menuItems } = this.state;\n const focusIndex = menuItems.indexOf(menuItem);\n this.setMouseIndex(focusIndex);\n\n if (\n focusIndex >= 0 &&\n focusIndex < menuItems.length &&\n !menuItem.disabled\n ) {\n this.openSubMenu(focusIndex);\n }\n }\n\n handleMouseLeave(): void {\n this.setMouseIndex(-1);\n }\n\n render(): JSX.Element {\n const menuItemElements = [];\n const { top, left } = this.props;\n const {\n activeSubMenu,\n hasOverflow,\n keyboardIndex,\n menuItems,\n mouseIndex,\n pendingItems,\n subMenuTop,\n subMenuLeft,\n subMenuParentWidth,\n subMenuParentHeight,\n } = this.state;\n for (let i = 0; i < menuItems.length; i += 1) {\n const menuItem = menuItems[i];\n\n if (i > 0 && menuItem.group !== menuItems[i - 1].group) {\n menuItemElements.push(<hr key={`${i}.separator`} />);\n }\n\n const menuItemElement = (\n <ContextMenuItem\n key={i}\n ref={activeSubMenu === i ? this.activeSubMenuRef : null}\n isKeyboardSelected={keyboardIndex === i}\n isMouseSelected={mouseIndex === i}\n menuItem={menuItem}\n closeMenu={this.handleCloseSubMenu}\n onMenuItemClick={this.handleMenuItemClick}\n onMenuItemMouseMove={this.handleMenuItemMouseMove}\n onMenuItemContextMenu={this.handleMenuItemContextMenu}\n />\n );\n\n menuItemElements.push(menuItemElement);\n }\n\n let pendingElement = null;\n if (pendingItems.length > 0) {\n pendingElement = (\n <div className=\"loading\">\n <LoadingSpinner />\n </div>\n );\n }\n\n const { menuStyle, 'data-testid': dataTestId } = this.props;\n\n // don't show submenu until it has an position initialized\n const showSubmenu =\n activeSubMenu !== null && subMenuTop !== null && subMenuLeft !== null;\n\n return (\n <>\n <div\n className={classNames(\n { 'has-overflow': hasOverflow },\n 'context-menu-container'\n )}\n style={{ top, left, ...menuStyle }}\n ref={this.container}\n data-dh-context-menu\n onBlur={this.handleBlur}\n onKeyDown={this.handleKeyDown}\n onMouseLeave={this.handleMouseLeave}\n onContextMenu={ContextMenu.handleContextMenu}\n role=\"menuitem\"\n tabIndex={0}\n data-testid={dataTestId}\n >\n {menuItemElements}\n {pendingElement}\n </div>\n {showSubmenu &&\n activeSubMenu !== null &&\n subMenuTop !== null &&\n subMenuLeft !== null && (\n <ContextMenu\n key={`sub-${activeSubMenu}`}\n actions={menuItems[activeSubMenu].actions || []}\n closeMenu={this.handleCloseSubMenu}\n top={subMenuTop}\n left={subMenuLeft}\n updatePosition={(verifiedTop, verifiedLeft) => {\n this.setState({\n subMenuTop: verifiedTop,\n subMenuLeft: verifiedLeft,\n });\n }}\n subMenuParentWidth={subMenuParentWidth}\n subMenuParentHeight={subMenuParentHeight}\n />\n )}\n </>\n );\n }\n}\n\nexport default ContextMenu;\n"],"mappings":";;;;;;AAAA,OAAOA,KAAP,IAAgBC,aAAhB,QAAqC,OAArC;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,GAAP,MAAgB,gBAAhB;AACA,SAASC,YAAT,QAAgD,kBAAhD;OACOC,kB;OAIAC,e;OACAC,c;AAEP,IAAMC,GAAG,GAAGL,GAAG,CAACM,MAAJ,CAAW,aAAX,CAAZ;;AAoCA;AACA,MAAMC,WAAN,SAA0BT,aAA1B,CAA4E;EAkBlD,OAAjBU,iBAAiB,CAACC,CAAD,EAA4B;IAClD,IAAIA,CAAC,CAACC,OAAN,EAAe;MACb;IACD;;IAEDD,CAAC,CAACE,eAAF;IACAF,CAAC,CAACG,cAAF;EACD;;EAEDC,WAAW,CAACC,KAAD,EAA0B;IACnC,MAAMA,KAAN;;IADmC;;IAAA;;IAAA;;IAAA;;IAAA;;IAAA;;IAGnC,KAAKC,UAAL,GAAkB,KAAKA,UAAL,CAAgBC,IAAhB,CAAqB,IAArB,CAAlB;IACA,KAAKC,kBAAL,GAA0B,KAAKA,kBAAL,CAAwBD,IAAxB,CAA6B,IAA7B,CAA1B;IACA,KAAKE,aAAL,GAAqB,KAAKA,aAAL,CAAmBF,IAAnB,CAAwB,IAAxB,CAArB;IACA,KAAKG,mBAAL,GAA2B,KAAKA,mBAAL,CAAyBH,IAAzB,CAA8B,IAA9B,CAA3B;IACA,KAAKI,yBAAL,GAAiC,KAAKA,yBAAL,CAA+BJ,IAA/B,CAAoC,IAApC,CAAjC;IACA,KAAKK,uBAAL,GAA+B,KAAKA,uBAAL,CAA6BL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D,CAAT,CAAyBoB,OAAzB,IAAoC,EAF/C;MAGE,SAAS,EAAE,KAAKzC,kBAHlB;MAIE,GAAG,EAAEuB,UAJP;MAKE,IAAI,EAAEC,WALR;MAME,cAAc,EAAE,CAACmG,WAAD,EAAcC,YAAd,KAA+B;QAC7C,KAAKtE,QAAL,CAAc;UACZ/B,UAAU,EAAEoG,WADA;UAEZnG,WAAW,EAAEoG;QAFD,CAAd;MAID,CAXH;MAYE,kBAAkB,EAAEnG,kBAZtB;MAaE,mBAAmB,EAAEC;IAbvB,EAxBN,CADF;EA2CD;;AA7kByE;;gBAAtEpC,W,kBACkB;EACpBmC,kBAAkB,EAAE,CADA;EAEpBC,mBAAmB,EAAE,CAFD;;EAGpBmE,SAAS,GAAS,CAChB;EACD,CALmB;;EAMpBxD,YAAY,GAAS,CACnB;EACD,CARmB;;EASpBwE,YAAY,GAAS,CACnB;EACD,CAXmB;;EAYpB5D,OAAO,EAAE,EAZW;EAapBuE,SAAS,EAAE,EAbS;EAcpB,eAAe/D;AAdK,C;;AA+kBxB,eAAenE,WAAf"}
1
+ {"version":3,"file":"ContextMenu.js","names":["React","PureComponent","classNames","Log","PromiseUtils","ContextActionUtils","ContextMenuItem","LoadingSpinner","log","module","ContextMenu","handleContextMenu","e","metaKey","stopPropagation","preventDefault","constructor","props","handleBlur","bind","handleCloseSubMenu","handleKeyDown","handleMenuItemClick","handleMenuItemContextMenu","handleMenuItemMouseMove","handleMouseLeave","handleWindowResize","container","createRef","oldFocus","document","activeElement","activeSubMenuRef","subMenuTimer","rAF","initialPosition","top","left","state","menuItems","pendingItems","activeSubMenu","hasOverflow","subMenuTop","subMenuLeft","subMenuParentWidth","subMenuParentHeight","keyboardIndex","mouseIndex","componentDidMount","initMenu","verifyPosition","window","addEventListener","requestAnimationFrame","current","focus","onMenuOpened","componentDidUpdate","prevProps","prevState","actions","setActiveSubMenuPosition","contains","componentWillUnmount","cancelPromises","removeEventListener","cancelAnimationFrame","getKeyboardIndex","options","separateKeyboardMouse","undefined","getMouseIndex","setKeyboardIndex","index","setState","setMouseIndex","initialKeyboardIndex","getMenuItems","nonPromiseItems","i","length","menuItem","Promise","initMenuPromise","push","sortActions","promise","cancellablePromise","makeCancelable","concat","then","resolvedMenuItems","indexOf","slice","splice","error","isCanceled","map","item","cancel","parentRect","getBoundingClientRect","right","height","width","updatePosition","oldTop","oldLeft","doNotVerifyPosition","scrollHeight","innerHeight","innerWidth","closeMenu","warn","relatedTarget","element","isContextMenuChild","hasAttribute","parentElement","isEscapeKey","key","newFocus","openSubMenu","shiftKey","getNextMenuItem","HTMLElement","newSubMenu","closeAll","onMenuClosed","closeSubMenu","closeAllMenus","disabled","action","focusIndex","render","menuItemElements","group","menuItemElement","pendingElement","menuStyle","dataTestId","showSubmenu","verifiedTop","verifiedLeft"],"sources":["../../src/context-actions/ContextMenu.tsx"],"sourcesContent":["import React, { PureComponent } from 'react';\nimport classNames from 'classnames';\nimport Log from '@deephaven/log';\nimport { PromiseUtils, CancelablePromise } from '@deephaven/utils';\nimport ContextActionUtils, {\n ContextAction,\n ResolvableContextAction,\n} from './ContextActionUtils';\nimport ContextMenuItem from './ContextMenuItem';\nimport LoadingSpinner from '../LoadingSpinner';\n\nconst log = Log.module('ContextMenu');\n\ninterface ContextMenuProps {\n top: number;\n left: number;\n updatePosition(top: number, left: number): void;\n // only submenus will have these, defaults to 0 otherwise\n // represents the width height of the parent menu item\n subMenuParentWidth: number;\n subMenuParentHeight: number;\n actions: ResolvableContextAction[];\n closeMenu(closeAll: boolean): void;\n onMenuClosed(menu: ContextMenu): void;\n onMenuOpened(menu: ContextMenu): void;\n options: {\n doNotVerifyPosition?: boolean;\n separateKeyboardMouse?: boolean;\n initialKeyboardIndex?: number;\n };\n menuStyle: React.CSSProperties;\n 'data-testid'?: string;\n}\n\ninterface ContextMenuState {\n menuItems: ContextAction[];\n pendingItems: CancelablePromise<ContextAction[]>[];\n activeSubMenu: number | null;\n hasOverflow: boolean;\n subMenuTop: number | null;\n subMenuLeft: number | null;\n subMenuParentWidth: number;\n subMenuParentHeight: number;\n keyboardIndex: number;\n mouseIndex: number;\n}\n\n/** Do not use this class directly. Use ContextMenuRoot and ContextActions instead. */\nclass ContextMenu extends PureComponent<ContextMenuProps, ContextMenuState> {\n static defaultProps = {\n subMenuParentWidth: 0,\n subMenuParentHeight: 0,\n closeMenu(): void {\n // no-op\n },\n onMenuOpened(): void {\n // no-op\n },\n onMenuClosed(): void {\n // no-op\n },\n options: {},\n menuStyle: {},\n 'data-testid': undefined,\n };\n\n static handleContextMenu(e: React.MouseEvent): void {\n if (e.metaKey) {\n return;\n }\n\n e.stopPropagation();\n e.preventDefault();\n }\n\n constructor(props: ContextMenuProps) {\n super(props);\n\n this.handleBlur = this.handleBlur.bind(this);\n this.handleCloseSubMenu = this.handleCloseSubMenu.bind(this);\n this.handleKeyDown = this.handleKeyDown.bind(this);\n this.handleMenuItemClick = this.handleMenuItemClick.bind(this);\n this.handleMenuItemContextMenu = this.handleMenuItemContextMenu.bind(this);\n this.handleMenuItemMouseMove = this.handleMenuItemMouseMove.bind(this);\n this.handleMouseLeave = this.handleMouseLeave.bind(this);\n this.handleWindowResize = this.handleWindowResize.bind(this);\n\n this.container = React.createRef();\n this.oldFocus = document.activeElement;\n this.activeSubMenuRef = React.createRef();\n this.subMenuTimer = 0;\n this.rAF = 0;\n\n this.initialPosition = { top: props.top, left: props.left };\n\n this.state = {\n menuItems: [],\n pendingItems: [],\n activeSubMenu: null,\n hasOverflow: false,\n subMenuTop: null,\n subMenuLeft: null,\n subMenuParentWidth: 0,\n subMenuParentHeight: 0,\n keyboardIndex: -1,\n mouseIndex: -1,\n };\n }\n\n componentDidMount(): void {\n this.initMenu();\n\n this.verifyPosition();\n\n window.addEventListener('resize', this.handleWindowResize);\n\n // rAF is needed to wait for a submenus popper to be created before\n // attempting to set focus, however on a quick mount/unmount when\n // mousing past an item, the submenu could be unmounted before the\n // async rAF finishes, so it is cancelled in willUnmount()\n this.rAF = window.requestAnimationFrame(() => {\n this.container.current?.focus();\n\n const { onMenuOpened } = this.props;\n onMenuOpened(this);\n });\n }\n\n componentDidUpdate(\n prevProps: ContextMenuProps,\n prevState: ContextMenuState\n ): void {\n const { actions } = this.props;\n const { activeSubMenu } = this.state;\n\n if (activeSubMenu !== prevState.activeSubMenu) {\n if (activeSubMenu == null) {\n // close sub menu, refocus parent menu\n this.container.current?.focus();\n } else {\n // open sub menu, set its initial position\n this.setActiveSubMenuPosition();\n }\n }\n\n if (prevProps.actions !== actions) {\n this.initMenu();\n\n if (\n this.container.current == null ||\n !this.container.current.contains(document.activeElement)\n ) {\n this.container.current?.focus();\n }\n }\n\n this.verifyPosition();\n }\n\n componentWillUnmount(): void {\n this.cancelPromises();\n window.removeEventListener('resize', this.handleWindowResize);\n cancelAnimationFrame(this.rAF);\n }\n\n container: React.RefObject<HTMLDivElement>;\n\n oldFocus: Element | null;\n\n activeSubMenuRef: React.RefObject<HTMLDivElement>;\n\n subMenuTimer: number;\n\n rAF: number;\n\n initialPosition: { top: number; left: number };\n\n getKeyboardIndex(): number {\n const { options } = this.props;\n if (\n options.separateKeyboardMouse !== undefined &&\n options.separateKeyboardMouse\n ) {\n const { keyboardIndex } = this.state;\n return keyboardIndex;\n }\n\n return this.getMouseIndex();\n }\n\n setKeyboardIndex(index: number): void {\n const { options } = this.props;\n if (\n options.separateKeyboardMouse !== undefined &&\n options.separateKeyboardMouse\n ) {\n this.setState({ keyboardIndex: index });\n } else {\n this.setMouseIndex(index);\n }\n }\n\n getMouseIndex(): number {\n const { mouseIndex } = this.state;\n return mouseIndex;\n }\n\n setMouseIndex(index: number): void {\n this.setState({ mouseIndex: index });\n }\n\n initMenu(): void {\n // cancel any pending close and promises\n this.cancelPromises();\n cancelAnimationFrame(this.rAF);\n\n const { options } = this.props;\n let keyboardIndex = options.initialKeyboardIndex;\n if (keyboardIndex === undefined) {\n keyboardIndex = -1;\n }\n\n const { actions } = this.props;\n const menuItems = ContextActionUtils.getMenuItems(actions);\n const nonPromiseItems: ContextAction[] = [];\n for (let i = menuItems.length - 1; i >= 0; i -= 1) {\n const menuItem = menuItems[i];\n if (menuItem instanceof Promise) {\n this.initMenuPromise(menuItem as Promise<ContextAction[]>);\n } else {\n nonPromiseItems.push(menuItem as ContextAction);\n }\n }\n\n this.setState({\n mouseIndex: -1,\n keyboardIndex,\n activeSubMenu: null,\n menuItems: ContextActionUtils.sortActions(nonPromiseItems),\n });\n }\n\n initMenuPromise(promise: Promise<ContextAction[]>): void {\n // make all promises cancellable\n const cancellablePromise = PromiseUtils.makeCancelable(promise);\n\n this.setState(state => ({\n pendingItems: state.pendingItems.concat(cancellablePromise),\n }));\n\n cancellablePromise.then(\n resolvedMenuItems => {\n this.setState(state => {\n const index = state.pendingItems.indexOf(cancellablePromise);\n if (index >= 0) {\n const pendingItems = state.pendingItems.slice();\n pendingItems.splice(index, 1);\n\n return {\n menuItems: ContextActionUtils.sortActions(\n state.menuItems.concat(resolvedMenuItems)\n ),\n pendingItems,\n };\n }\n // This item is stale, don't update the menu\n return null;\n });\n },\n error => {\n if (PromiseUtils.isCanceled(error)) {\n return; // Canceled promise is ignored\n }\n\n // remove failed item from pending list\n this.setState(state => {\n const index = state.pendingItems.indexOf(cancellablePromise);\n if (index >= 0) {\n const pendingItems = state.pendingItems.slice();\n pendingItems.splice(index, 1);\n return {\n pendingItems,\n };\n }\n return null;\n });\n\n // Log the error\n log.error(error);\n }\n );\n }\n\n cancelPromises(): void {\n const { pendingItems } = this.state;\n pendingItems.map(item => item.cancel());\n }\n\n /**\n * Sets the unverfied start position of a submenu. Submenu then self-verfies\n * its own position and potentially reports back a new position.\n */\n setActiveSubMenuPosition(): void {\n if (this.activeSubMenuRef.current === null) return;\n const parentRect = this.activeSubMenuRef.current.getBoundingClientRect();\n\n // intentionally rect.right, we want the sub menu to start at the right edge of the current menu\n this.setState({\n subMenuTop: parentRect.top,\n subMenuLeft: parentRect.right,\n subMenuParentHeight: parentRect.height,\n subMenuParentWidth: parentRect.width,\n });\n }\n\n /**\n * Verifies the position of this menu in relation to the parent to make sure it's on screen.\n * Will update the top left state (updatePosition) if necessary (causing a re-render)\n * By default it tries to top-align with parent, at the right side of the parent.\n * Because we aren't a native context menu and can't escape window bounds, we also do\n * somethings to better fit on screen, such as the \"nudge\" offset position, and further\n * allow overflow scrolling for large menus in a small window.\n */\n verifyPosition(): void {\n const {\n options,\n updatePosition,\n subMenuParentWidth,\n subMenuParentHeight,\n top: oldTop,\n left: oldLeft,\n } = this.props;\n\n if (\n !this.container.current ||\n (options.doNotVerifyPosition != null && options.doNotVerifyPosition)\n ) {\n return;\n }\n\n // initial position is used rather than current position,\n // as the number of menu items can change (actions can bubble)\n // and menu should always be positioned relative to spawn point\n let { top, left } = this.initialPosition;\n const {\n width,\n height,\n } = this.container.current?.getBoundingClientRect() ?? {\n width: 0,\n height: 0,\n };\n const hasOverflow =\n (this.container.current?.scrollHeight ?? 0) > window.innerHeight;\n\n if (height === 0 || width === 0) {\n // We don't have a height or width yet, don't bother doing anything\n return;\n }\n\n // does it fit below?\n if (top + height > window.innerHeight) {\n // can it be flipped to above? include offset if submenu (defaults to 0 if not submenu)\n if (top - height - subMenuParentHeight > 0) {\n // flip like a native menu would\n top -= height - subMenuParentHeight;\n } else {\n // still doesnt fit? okay, position at bottom edge\n top = window.innerHeight - height;\n }\n }\n\n if (left + width > window.innerWidth) {\n // less picky about left right positioning, just keep it going off to right\n left = left - width - subMenuParentWidth;\n }\n\n if (oldLeft !== left || oldTop !== top) {\n // parent owns positioning as single source of truth, ask to update props\n this.setState({ hasOverflow });\n updatePosition(top, left);\n }\n }\n\n // since window resize doesn't trigger blur, listen and close the menu\n handleWindowResize(): void {\n if (!this.container.current) {\n return;\n }\n this.closeMenu(true);\n }\n\n handleBlur(e: React.FocusEvent<HTMLDivElement>): void {\n if (!this.container.current) {\n log.warn('Container is null!');\n return;\n }\n\n if (!this.container.current.contains(e.relatedTarget as Node)) {\n let element: HTMLElement | null = e.relatedTarget as HTMLElement;\n let isContextMenuChild = false;\n while (element && !isContextMenuChild) {\n isContextMenuChild = element.hasAttribute('data-dh-context-menu');\n element = element.parentElement;\n }\n\n if (!isContextMenuChild) {\n // close all submenus on blur\n this.closeMenu(true);\n }\n }\n }\n\n /** Returns whether the specified key should remove the menu. Depends on the side the parent is on. */\n isEscapeKey(key: string): boolean {\n const { left } = this.props;\n return (\n key === 'Escape' ||\n (left < 0 && key === 'ArrowRight') ||\n key === 'ArrowLeft'\n );\n }\n\n handleKeyDown(e: React.KeyboardEvent<HTMLDivElement>): void {\n const { menuItems } = this.state;\n const oldFocus = this.getKeyboardIndex();\n let newFocus: number | null = oldFocus;\n let openSubMenu = false;\n\n if (e.key === 'Enter' || e.key === ' ') {\n if (oldFocus >= 0 && oldFocus < menuItems.length) {\n this.handleMenuItemClick(\n menuItems[oldFocus],\n (e as React.SyntheticEvent) as React.MouseEvent\n );\n }\n return;\n }\n\n if (e.key === 'ArrowRight') {\n if (oldFocus >= 0 && oldFocus <= menuItems.length) {\n openSubMenu = true;\n } else {\n newFocus = 0;\n }\n } else if (this.isEscapeKey(e.key)) {\n newFocus = null;\n } else if (e.key === 'ArrowUp' || (e.shiftKey && e.key === 'Tab')) {\n newFocus = ContextActionUtils.getNextMenuItem(newFocus, -1, menuItems);\n } else if (e.key === 'ArrowDown' || e.key === 'Tab') {\n newFocus = ContextActionUtils.getNextMenuItem(newFocus, 1, menuItems);\n }\n\n if (openSubMenu) {\n this.openSubMenu(oldFocus);\n e.preventDefault();\n e.stopPropagation();\n return;\n }\n\n if (oldFocus !== newFocus) {\n if (newFocus !== null) {\n this.setKeyboardIndex(newFocus);\n } else {\n this.closeMenu();\n if (this.oldFocus instanceof HTMLElement) {\n this.oldFocus.focus();\n }\n }\n\n e.preventDefault();\n e.stopPropagation();\n }\n }\n\n openSubMenu(index: number): void {\n const { menuItems, activeSubMenu } = this.state;\n const newSubMenu = menuItems[index].actions ? index : null;\n if (activeSubMenu === newSubMenu) return;\n this.setState({\n activeSubMenu: newSubMenu,\n subMenuTop: null,\n subMenuLeft: null,\n });\n }\n\n closeMenu(closeAll = false): void {\n const { closeMenu, onMenuClosed } = this.props;\n cancelAnimationFrame(this.rAF);\n this.rAF = window.requestAnimationFrame(() => {\n closeMenu(closeAll);\n onMenuClosed(this);\n });\n }\n\n closeSubMenu(): void {\n this.setState({\n activeSubMenu: null,\n });\n }\n\n handleCloseSubMenu(closeAllMenus: boolean): void {\n if (closeAllMenus) {\n this.closeMenu(true);\n } else {\n this.closeSubMenu();\n }\n }\n\n handleMenuItemClick(menuItem: ContextAction, e: React.MouseEvent): void {\n e.preventDefault();\n e.stopPropagation();\n\n const { menuItems } = this.state;\n if (\n menuItem != null &&\n (menuItem.disabled === undefined || !menuItem.disabled)\n ) {\n if (menuItem.actions != null) {\n this.openSubMenu(menuItems.indexOf(menuItem));\n } else if (menuItem.action != null) {\n menuItem.action();\n this.closeMenu(true);\n }\n }\n }\n\n handleMenuItemContextMenu(\n menuItem: ContextAction,\n e: React.MouseEvent\n ): void {\n if (e.metaKey) {\n return;\n }\n\n this.handleMenuItemClick(menuItem, e);\n }\n\n handleMenuItemMouseMove(menuItem: ContextAction): void {\n const { menuItems } = this.state;\n const focusIndex = menuItems.indexOf(menuItem);\n this.setMouseIndex(focusIndex);\n\n if (\n focusIndex >= 0 &&\n focusIndex < menuItems.length &&\n (menuItem.disabled === undefined || !menuItem.disabled)\n ) {\n this.openSubMenu(focusIndex);\n }\n }\n\n handleMouseLeave(): void {\n this.setMouseIndex(-1);\n }\n\n render(): JSX.Element {\n const menuItemElements = [];\n const { top, left } = this.props;\n const {\n activeSubMenu,\n hasOverflow,\n keyboardIndex,\n menuItems,\n mouseIndex,\n pendingItems,\n subMenuTop,\n subMenuLeft,\n subMenuParentWidth,\n subMenuParentHeight,\n } = this.state;\n for (let i = 0; i < menuItems.length; i += 1) {\n const menuItem = menuItems[i];\n\n if (i > 0 && menuItem.group !== menuItems[i - 1].group) {\n menuItemElements.push(<hr key={`${i}.separator`} />);\n }\n\n const menuItemElement = (\n <ContextMenuItem\n key={i}\n ref={activeSubMenu === i ? this.activeSubMenuRef : null}\n isKeyboardSelected={keyboardIndex === i}\n isMouseSelected={mouseIndex === i}\n menuItem={menuItem}\n closeMenu={this.handleCloseSubMenu}\n onMenuItemClick={this.handleMenuItemClick}\n onMenuItemMouseMove={this.handleMenuItemMouseMove}\n onMenuItemContextMenu={this.handleMenuItemContextMenu}\n />\n );\n\n menuItemElements.push(menuItemElement);\n }\n\n let pendingElement = null;\n if (pendingItems.length > 0) {\n pendingElement = (\n <div className=\"loading\">\n <LoadingSpinner />\n </div>\n );\n }\n\n const { menuStyle, 'data-testid': dataTestId } = this.props;\n\n // don't show submenu until it has an position initialized\n const showSubmenu =\n activeSubMenu !== null && subMenuTop !== null && subMenuLeft !== null;\n\n return (\n <>\n <div\n className={classNames(\n { 'has-overflow': hasOverflow },\n 'context-menu-container'\n )}\n style={{ top, left, ...menuStyle }}\n ref={this.container}\n data-dh-context-menu\n onBlur={this.handleBlur}\n onKeyDown={this.handleKeyDown}\n onMouseLeave={this.handleMouseLeave}\n onContextMenu={ContextMenu.handleContextMenu}\n role=\"menuitem\"\n tabIndex={0}\n data-testid={dataTestId}\n >\n {menuItemElements}\n {pendingElement}\n </div>\n {showSubmenu &&\n activeSubMenu !== null &&\n subMenuTop !== null &&\n subMenuLeft !== null && (\n <ContextMenu\n key={`sub-${activeSubMenu}`}\n actions={menuItems[activeSubMenu].actions || []}\n closeMenu={this.handleCloseSubMenu}\n top={subMenuTop}\n left={subMenuLeft}\n updatePosition={(verifiedTop, verifiedLeft) => {\n this.setState({\n subMenuTop: verifiedTop,\n subMenuLeft: verifiedLeft,\n });\n }}\n subMenuParentWidth={subMenuParentWidth}\n subMenuParentHeight={subMenuParentHeight}\n />\n )}\n </>\n );\n }\n}\n\nexport default ContextMenu;\n"],"mappings":";;;;;;AAAA,OAAOA,KAAP,IAAgBC,aAAhB,QAAqC,OAArC;AACA,OAAOC,UAAP,MAA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AC,UAAU,GAAG,IAAI,CAAC;IACtE,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,QAAA,MAAM,eAAe,6FAkIpB,CAAC;AAWF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"ContextMenuItem.d.ts","sourceRoot":"","sources":["../../src/context-actions/ContextMenuItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,UAAU,oBAAoB;IAC5B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAAC;IACnC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,EAAE,aAAa,CAAC;IACxB,eAAe,CAAC,IAAI,EAAE,aAAa,EAAE,CAAC,EAAE,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC;IAChE,mBAAmB,CAAC,IAAI,EAAE,aAAa,EAAE,CAAC,EAAE,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC;IACpE,qBAAqB,CAAC,IAAI,EAAE,aAAa,EAAE,CAAC,EAAE,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC;IACtE,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,QAAA,MAAM,eAAe,6FA4IpB,CAAC;AAWF,eAAe,eAAe,CAAC"}
@@ -74,7 +74,7 @@ var ContextMenuItem = /*#__PURE__*/React.forwardRef((props, ref) => {
74
74
  } else {
75
75
  var style;
76
76
 
77
- if (menuItem.iconColor && !menuItem.disabled) {
77
+ if (menuItem.iconColor != null && (menuItem.disabled === undefined || !menuItem.disabled)) {
78
78
  style = {
79
79
  color: menuItem.iconColor
80
80
  };
@@ -88,7 +88,7 @@ var ContextMenuItem = /*#__PURE__*/React.forwardRef((props, ref) => {
88
88
  }
89
89
 
90
90
  var subMenuIndicator = null;
91
- var isSubMenuActive = !!children;
91
+ var isSubMenuActive = Boolean(children);
92
92
 
93
93
  if (menuItem.actions) {
94
94
  subMenuIndicator = /*#__PURE__*/React.createElement(FontAwesomeIcon, {
@@ -104,6 +104,8 @@ var ContextMenuItem = /*#__PURE__*/React.forwardRef((props, ref) => {
104
104
  onMouseMove: handleMenuItemMouseMove
105
105
  }, renderCustomMenuElement(menuItem.menuElement, icon, displayShortcut));
106
106
  } else {
107
+ var _menuItem$description;
108
+
107
109
  var menuItemDisabled = menuItem.disabled;
108
110
  var iconHasOutline = menuItem.iconOutline;
109
111
  content = /*#__PURE__*/React.createElement("button", {
@@ -111,14 +113,14 @@ var ContextMenuItem = /*#__PURE__*/React.forwardRef((props, ref) => {
111
113
  className: classNames('btn-context-menu', {
112
114
  disabled: menuItemDisabled
113
115
  }, {
114
- active: (isSubMenuActive || isMouseSelected) && !menuItemDisabled
116
+ active: (isSubMenuActive || isMouseSelected) && (menuItemDisabled === undefined || !menuItemDisabled)
115
117
  }, {
116
- 'keyboard-active': isKeyboardSelected && !menuItemDisabled
118
+ 'keyboard-active': isKeyboardSelected !== undefined && isKeyboardSelected && (menuItemDisabled === undefined || !menuItemDisabled)
117
119
  }),
118
120
  onClick: handleMenuItemClick,
119
121
  onMouseMove: handleMenuItemMouseMove,
120
122
  onContextMenu: handleMenuItemContextMenu,
121
- title: menuItem.description || ''
123
+ title: (_menuItem$description = menuItem.description) !== null && _menuItem$description !== void 0 ? _menuItem$description : ''
122
124
  }, /*#__PURE__*/React.createElement("div", {
123
125
  className: "btn-context-menu-wrapper"
124
126
  }, /*#__PURE__*/React.createElement("span", {
@@ -127,7 +129,7 @@ var ContextMenuItem = /*#__PURE__*/React.forwardRef((props, ref) => {
127
129
  })
128
130
  }, icon), /*#__PURE__*/React.createElement("span", {
129
131
  className: "title"
130
- }, menuItem.title), displayShortcut && /*#__PURE__*/React.createElement("span", {
132
+ }, menuItem.title), displayShortcut !== undefined && /*#__PURE__*/React.createElement("span", {
131
133
  className: "shortcut"
132
134
  }, displayShortcut), subMenuIndicator && /*#__PURE__*/React.createElement("span", {
133
135
  className: classNames('submenu-indicator', {
@@ -1 +1 @@
1
- {"version":3,"file":"ContextMenuItem.js","names":["React","classNames","FontAwesomeIcon","vsChevronRight","ContextMenuItem","forwardRef","props","ref","handleMenuItemClick","e","menuItem","onMenuItemClick","handleMenuItemMouseMove","onMenuItemMouseMove","handleMenuItemContextMenu","onMenuItemContextMenu","renderCustomMenuElement","element","iconElement","displayShortcut","type","closeMenu","isKeyboardSelected","isMouseSelected","dataTestId","forwardedProps","cloneElement","children","shortcut","getDisplayText","icon","menuItemIcon","isValidElement","style","iconColor","disabled","color","subMenuIndicator","isSubMenuActive","actions","content","menuElement","menuItemDisabled","iconHasOutline","iconOutline","active","description","outline","title","displayName","defaultProps","undefined"],"sources":["../../src/context-actions/ContextMenuItem.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { vsChevronRight, IconDefinition } from '@deephaven/icons';\nimport type { ContextAction } from './ContextActionUtils';\n\ninterface ContextMenuItemProps {\n children?: React.ReactNode;\n closeMenu(closeAll: boolean): void;\n isKeyboardSelected?: boolean;\n isMouseSelected?: boolean;\n menuItem: ContextAction;\n onMenuItemClick(item: ContextAction, e: React.MouseEvent): void;\n onMenuItemMouseMove(item: ContextAction, e: React.MouseEvent): void;\n onMenuItemContextMenu(item: ContextAction, e: React.MouseEvent): void;\n 'data-testid'?: string;\n}\n\nconst ContextMenuItem = React.forwardRef<HTMLDivElement, ContextMenuItemProps>(\n (props: ContextMenuItemProps, ref) => {\n function handleMenuItemClick(e: React.MouseEvent) {\n const { menuItem, onMenuItemClick } = props;\n onMenuItemClick(menuItem, e);\n }\n\n function handleMenuItemMouseMove(e: React.MouseEvent) {\n const { menuItem, onMenuItemMouseMove } = props;\n onMenuItemMouseMove(menuItem, e);\n }\n\n function handleMenuItemContextMenu(e: React.MouseEvent) {\n const { menuItem, onMenuItemContextMenu } = props;\n onMenuItemContextMenu(menuItem, e);\n }\n\n function renderCustomMenuElement(\n element: React.ReactElement,\n iconElement: IconDefinition | React.ReactElement | null,\n displayShortcut: string | undefined\n ): JSX.Element {\n // Don't pass forwardedProps if menuElement is a native DOM node\n if (typeof element.type === 'string') {\n return element;\n }\n const {\n closeMenu,\n menuItem,\n isKeyboardSelected,\n isMouseSelected,\n 'data-testid': dataTestId,\n } = props;\n const forwardedProps = {\n menuItem,\n closeMenu,\n isKeyboardSelected,\n isMouseSelected,\n iconElement,\n displayShortcut,\n 'data-testid': dataTestId,\n };\n return React.cloneElement(element, {\n forwardedProps,\n });\n }\n\n const {\n children,\n menuItem,\n isKeyboardSelected,\n isMouseSelected,\n 'data-testid': dataTestId,\n } = props;\n\n const displayShortcut = menuItem.shortcut?.getDisplayText();\n let icon: IconDefinition | React.ReactElement | null = null;\n if (menuItem.icon) {\n const menuItemIcon = menuItem.icon;\n if (React.isValidElement(menuItemIcon)) {\n icon = menuItemIcon;\n } else {\n let style: React.CSSProperties | undefined;\n if (menuItem.iconColor && !menuItem.disabled) {\n style = { color: menuItem.iconColor };\n }\n icon = <FontAwesomeIcon icon={menuItemIcon} style={style} />;\n }\n }\n\n let subMenuIndicator = null;\n const isSubMenuActive = !!children;\n if (menuItem.actions) {\n subMenuIndicator = <FontAwesomeIcon icon={vsChevronRight} />;\n }\n let content = null;\n if (menuItem.menuElement) {\n content = (\n <div className=\"custom-menu-item\" onMouseMove={handleMenuItemMouseMove}>\n {renderCustomMenuElement(menuItem.menuElement, icon, displayShortcut)}\n </div>\n );\n } else {\n const menuItemDisabled = menuItem.disabled;\n const iconHasOutline = menuItem.iconOutline;\n content = (\n <button\n type=\"button\"\n className={classNames(\n 'btn-context-menu',\n { disabled: menuItemDisabled },\n {\n active: (isSubMenuActive || isMouseSelected) && !menuItemDisabled,\n },\n { 'keyboard-active': isKeyboardSelected && !menuItemDisabled }\n )}\n onClick={handleMenuItemClick}\n onMouseMove={handleMenuItemMouseMove}\n onContextMenu={handleMenuItemContextMenu}\n title={menuItem.description || ''}\n >\n <div className=\"btn-context-menu-wrapper\">\n <span className={classNames('icon', { outline: iconHasOutline })}>\n {icon}\n </span>\n <span className=\"title\">{menuItem.title}</span>\n {displayShortcut && (\n <span className=\"shortcut\">{displayShortcut}</span>\n )}\n {subMenuIndicator && (\n <span\n className={classNames('submenu-indicator', {\n disabled: menuItemDisabled,\n })}\n >\n {subMenuIndicator}\n </span>\n )}\n </div>\n </button>\n );\n }\n\n return (\n <div className=\"context-menu-item\" ref={ref} data-testid={dataTestId}>\n {children}\n {content}\n </div>\n );\n }\n);\n\nContextMenuItem.displayName = 'ContextMenuItem';\n\nContextMenuItem.defaultProps = {\n children: null,\n isKeyboardSelected: false,\n isMouseSelected: false,\n 'data-testid': undefined,\n};\n\nexport default ContextMenuItem;\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,SAASC,cAAT,QAA+C,kBAA/C;AAeA,IAAMC,eAAe,gBAAGJ,KAAK,CAACK,UAAN,CACtB,CAACC,KAAD,EAA8BC,GAA9B,KAAsC;EAAA;;EACpC,SAASC,mBAAT,CAA6BC,CAA7B,EAAkD;IAChD,IAAM;MAAEC,QAAF;MAAYC;IAAZ,IAAgCL,KAAtC;IACAK,eAAe,CAACD,QAAD,EAAWD,CAAX,CAAf;EACD;;EAED,SAASG,uBAAT,CAAiCH,CAAjC,EAAsD;IACpD,IAAM;MAAEC,QAAF;MAAYG;IAAZ,IAAoCP,KAA1C;IACAO,mBAAmB,CAACH,QAAD,EAAWD,CAAX,CAAnB;EACD;;EAED,SAASK,yBAAT,CAAmCL,CAAnC,EAAwD;IACtD,IAAM;MAAEC,QAAF;MAAYK;IAAZ,IAAsCT,KAA5C;IACAS,qBAAqB,CAACL,QAAD,EAAWD,CAAX,C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AAD,EAAsB;QACzCkC,QAAQ,EAAEO;MAD+B,CAAtB;IADvB,GAKGL,gBALH,CATJ,CAfF,CADF;EAoCD;;EAED,oBACE;IAAK,SAAS,EAAC,mBAAf;IAAmC,GAAG,EAAE9B,GAAxC;IAA6C,eAAaiB;EAA1D,GACGG,QADH,EAEGa,OAFH,CADF;AAMD,CAjIqB,CAAxB;AAoIApC,eAAe,CAAC6C,WAAhB,GAA8B,iBAA9B;AAEA7C,eAAe,CAAC8C,YAAhB,GAA+B;EAC7BvB,QAAQ,EAAE,IADmB;EAE7BL,kBAAkB,EAAE,KAFS;EAG7BC,eAAe,EAAE,KAHY;EAI7B,eAAe4B;AAJc,CAA/B;AAOA,eAAe/C,eAAf"}
1
+ {"version":3,"file":"ContextMenuItem.js","names":["React","classNames","FontAwesomeIcon","vsChevronRight","ContextMenuItem","forwardRef","props","ref","handleMenuItemClick","e","menuItem","onMenuItemClick","handleMenuItemMouseMove","onMenuItemMouseMove","handleMenuItemContextMenu","onMenuItemContextMenu","renderCustomMenuElement","element","iconElement","displayShortcut","type","closeMenu","isKeyboardSelected","isMouseSelected","dataTestId","forwardedProps","cloneElement","children","shortcut","getDisplayText","icon","menuItemIcon","isValidElement","style","iconColor","disabled","undefined","color","subMenuIndicator","isSubMenuActive","Boolean","actions","content","menuElement","menuItemDisabled","iconHasOutline","iconOutline","active","description","outline","title","displayName","defaultProps"],"sources":["../../src/context-actions/ContextMenuItem.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { vsChevronRight, IconDefinition } from '@deephaven/icons';\nimport type { ContextAction } from './ContextActionUtils';\n\ninterface ContextMenuItemProps {\n children?: React.ReactNode;\n closeMenu(closeAll: boolean): void;\n isKeyboardSelected?: boolean;\n isMouseSelected?: boolean;\n menuItem: ContextAction;\n onMenuItemClick(item: ContextAction, e: React.MouseEvent): void;\n onMenuItemMouseMove(item: ContextAction, e: React.MouseEvent): void;\n onMenuItemContextMenu(item: ContextAction, e: React.MouseEvent): void;\n 'data-testid'?: string;\n}\n\nconst ContextMenuItem = React.forwardRef<HTMLDivElement, ContextMenuItemProps>(\n (props: ContextMenuItemProps, ref) => {\n function handleMenuItemClick(e: React.MouseEvent) {\n const { menuItem, onMenuItemClick } = props;\n onMenuItemClick(menuItem, e);\n }\n\n function handleMenuItemMouseMove(e: React.MouseEvent) {\n const { menuItem, onMenuItemMouseMove } = props;\n onMenuItemMouseMove(menuItem, e);\n }\n\n function handleMenuItemContextMenu(e: React.MouseEvent) {\n const { menuItem, onMenuItemContextMenu } = props;\n onMenuItemContextMenu(menuItem, e);\n }\n\n function renderCustomMenuElement(\n element: React.ReactElement,\n iconElement: IconDefinition | React.ReactElement | null,\n displayShortcut: string | undefined\n ): JSX.Element {\n // Don't pass forwardedProps if menuElement is a native DOM node\n if (typeof element.type === 'string') {\n return element;\n }\n const {\n closeMenu,\n menuItem,\n isKeyboardSelected,\n isMouseSelected,\n 'data-testid': dataTestId,\n } = props;\n const forwardedProps = {\n menuItem,\n closeMenu,\n isKeyboardSelected,\n isMouseSelected,\n iconElement,\n displayShortcut,\n 'data-testid': dataTestId,\n };\n return React.cloneElement(element, {\n forwardedProps,\n });\n }\n\n const {\n children,\n menuItem,\n isKeyboardSelected,\n isMouseSelected,\n 'data-testid': dataTestId,\n } = props;\n\n const displayShortcut = menuItem.shortcut?.getDisplayText();\n let icon: IconDefinition | React.ReactElement | null = null;\n if (menuItem.icon) {\n const menuItemIcon = menuItem.icon;\n if (React.isValidElement(menuItemIcon)) {\n icon = menuItemIcon;\n } else {\n let style: React.CSSProperties | undefined;\n if (\n menuItem.iconColor != null &&\n (menuItem.disabled === undefined || !menuItem.disabled)\n ) {\n style = { color: menuItem.iconColor };\n }\n icon = <FontAwesomeIcon icon={menuItemIcon} style={style} />;\n }\n }\n\n let subMenuIndicator = null;\n const isSubMenuActive = Boolean(children);\n if (menuItem.actions) {\n subMenuIndicator = <FontAwesomeIcon icon={vsChevronRight} />;\n }\n let content = null;\n if (menuItem.menuElement) {\n content = (\n <div className=\"custom-menu-item\" onMouseMove={handleMenuItemMouseMove}>\n {renderCustomMenuElement(menuItem.menuElement, icon, displayShortcut)}\n </div>\n );\n } else {\n const menuItemDisabled = menuItem.disabled;\n const iconHasOutline = menuItem.iconOutline;\n content = (\n <button\n type=\"button\"\n className={classNames(\n 'btn-context-menu',\n { disabled: menuItemDisabled },\n {\n active:\n (isSubMenuActive || isMouseSelected) &&\n (menuItemDisabled === undefined || !menuItemDisabled),\n },\n {\n 'keyboard-active':\n isKeyboardSelected !== undefined &&\n isKeyboardSelected &&\n (menuItemDisabled === undefined || !menuItemDisabled),\n }\n )}\n onClick={handleMenuItemClick}\n onMouseMove={handleMenuItemMouseMove}\n onContextMenu={handleMenuItemContextMenu}\n title={menuItem.description ?? ''}\n >\n <div className=\"btn-context-menu-wrapper\">\n <span className={classNames('icon', { outline: iconHasOutline })}>\n {icon}\n </span>\n <span className=\"title\">{menuItem.title}</span>\n {displayShortcut !== undefined && (\n <span className=\"shortcut\">{displayShortcut}</span>\n )}\n {subMenuIndicator && (\n <span\n className={classNames('submenu-indicator', {\n disabled: menuItemDisabled,\n })}\n >\n {subMenuIndicator}\n </span>\n )}\n </div>\n </button>\n );\n }\n\n return (\n <div className=\"context-menu-item\" ref={ref} data-testid={dataTestId}>\n {children}\n {content}\n </div>\n );\n }\n);\n\nContextMenuItem.displayName = 'ContextMenuItem';\n\nContextMenuItem.defaultProps = {\n children: null,\n isKeyboardSelected: false,\n isMouseSelected: false,\n 'data-testid': undefined,\n};\n\nexport default ContextMenuItem;\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,SAASC,eAAT,QAAgC,gCAAhC;AACA,SAASC,cAAT,QAA+C,kBAA/C;AAeA,IAAMC,eAAe,gBAAGJ,KAAK,CAACK,UAAN,CACtB,CAACC,KAAD,EAA8BC,GAA9B,KAA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BADpC;MAFJ,CAHmB,EAQnB;QACE,mBACEtB,kBAAkB,KAAKc,SAAvB,IACAd,kBADA,KAECsB,gBAAgB,KAAKR,SAArB,IAAkC,CAACQ,gBAFpC;MAFJ,CARmB,CAFvB;MAiBE,OAAO,EAAEpC,mBAjBX;MAkBE,WAAW,EAAEI,uBAlBf;MAmBE,aAAa,EAAEE,yBAnBjB;MAoBE,KAAK,2BAAEJ,QAAQ,CAACsC,WAAX,yEAA0B;IApBjC,gBAsBE;MAAK,SAAS,EAAC;IAAf,gBACE;MAAM,SAAS,EAAE/C,UAAU,CAAC,MAAD,EAAS;QAAEgD,OAAO,EAAEJ;MAAX,CAAT;IAA3B,GACGf,IADH,CADF,eAIE;MAAM,SAAS,EAAC;IAAhB,GAAyBpB,QAAQ,CAACwC,KAAlC,CAJF,EAKG/B,eAAe,KAAKiB,SAApB,iBACC;MAAM,SAAS,EAAC;IAAhB,GAA4BjB,eAA5B,CANJ,EAQGmB,gBAAgB,iBACf;MACE,SAAS,EAAErC,UAAU,CAAC,mBAAD,EAAsB;QACzCkC,QAAQ,EAAES;MAD+B,CAAtB;IADvB,GAKGN,gBALH,CATJ,CAtBF,CADF;EA2CD;;EAED,oBACE;IAAK,SAAS,EAAC,mBAAf;IAAmC,GAAG,EAAE/B,GAAxC;IAA6C,eAAaiB;EAA1D,GACGG,QADH,EAEGe,OAFH,CADF;AAMD,CA3IqB,CAAxB;AA8IAtC,eAAe,CAAC+C,WAAhB,GAA8B,iBAA9B;AAEA/C,eAAe,CAACgD,YAAhB,GAA+B;EAC7BzB,QAAQ,EAAE,IADmB;EAE7BL,kBAAkB,EAAE,KAFS;EAG7BC,eAAe,EAAE,KAHY;EAI7B,eAAea;AAJc,CAA/B;AAOA,eAAehC,eAAf"}
@@ -1 +1 @@
1
- {"version":3,"file":"GlobalContextAction.d.ts","sourceRoot":"","sources":["../../src/context-actions/GlobalContextAction.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC,OAAO,KAAK,EAAE,aAAa,EAAsB,MAAM,sBAAsB,CAAC;AAI9E,UAAU,wBAAwB;IAChC,MAAM,EAAE,aAAa,CAAC;CACvB;AAED,cAAM,mBAAoB,SAAQ,SAAS,CAAC,wBAAwB,CAAC;gBACvD,KAAK,EAAE,wBAAwB;IAO3C,iBAAiB,IAAI,IAAI;IAKzB,oBAAoB,IAAI,IAAI;IAK5B,iBAAiB,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI;IAwBxC,aAAa,CAAC,CAAC,EAAE,aAAa,GAAG,IAAI;IAiBrC,MAAM,IAAI,IAAI;CAGf;AAED,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"GlobalContextAction.d.ts","sourceRoot":"","sources":["../../src/context-actions/GlobalContextAction.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC,OAAO,KAAK,EAAE,aAAa,EAAsB,MAAM,sBAAsB,CAAC;AAI9E,UAAU,wBAAwB;IAChC,MAAM,EAAE,aAAa,CAAC;CACvB;AAED,cAAM,mBAAoB,SAAQ,SAAS,CAAC,wBAAwB,CAAC;gBACvD,KAAK,EAAE,wBAAwB;IAO3C,iBAAiB,IAAI,IAAI;IAKzB,oBAAoB,IAAI,IAAI;IAK5B,iBAAiB,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI;IAwBxC,aAAa,CAAC,CAAC,EAAE,aAAa,GAAG,IAAI;IAgBrC,MAAM,IAAI,IAAI;CAGf;AAED,eAAe,mBAAmB,CAAC"}